view src/win32/7zip/7z/CPP/7zip/Archive/DllExports2.cpp @ 1:f9f4f1b99eed

importing src directory
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:31:27 -0600
parents
children
line wrap: on
line source
1 // DLLExports.cpp
3 #include "StdAfx.h"
5 #include "../../Common/MyInitGuid.h"
6 #include "../../Common/ComTry.h"
7 #include "../../Common/Types.h"
8 #include "../../Windows/PropVariant.h"
9 #if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
10 extern "C"
11 {
12 #include "../../../C/Alloc.h"
13 }
14 #endif
16 #include "IArchive.h"
17 #include "../ICoder.h"
18 #include "../IPassword.h"
20 HINSTANCE g_hInstance;
21 #ifndef _UNICODE
22 #ifdef _WIN32
23 bool g_IsNT = false;
24 static bool IsItWindowsNT()
25 {
26 OSVERSIONINFO versionInfo;
27 versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
28 if (!::GetVersionEx(&versionInfo))
29 return false;
30 return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
31 }
32 #endif
33 #endif
35 extern "C"
36 BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
37 {
38 if (dwReason == DLL_PROCESS_ATTACH)
39 {
40 g_hInstance = hInstance;
41 #ifndef _UNICODE
42 #ifdef _WIN32
43 g_IsNT = IsItWindowsNT();
44 #endif
45 #endif
46 }
47 return TRUE;
48 }
50 DEFINE_GUID(CLSID_CArchiveHandler,
51 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x00);
53 static const UInt16 kDecodeId = 0x2790;
55 DEFINE_GUID(CLSID_CCodec,
56 0x23170F69, 0x40C1, kDecodeId, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
58 STDAPI CreateCoder(const GUID *clsid, const GUID *iid, void **outObject);
59 STDAPI CreateArchiver(const GUID *classID, const GUID *iid, void **outObject);
61 STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
62 {
63 // COM_TRY_BEGIN
64 *outObject = 0;
65 if (*iid == IID_ICompressCoder || *iid == IID_ICompressCoder2 || *iid == IID_ICompressFilter)
66 {
67 return CreateCoder(clsid, iid, outObject);
68 }
69 else
70 {
71 return CreateArchiver(clsid, iid, outObject);
72 }
73 // COM_TRY_END
74 }
76 STDAPI SetLargePageMode()
77 {
78 #if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
79 SetLargePageSize();
80 #endif
81 return S_OK;
82 }