1 // DLLExports.cpp 2 3 #include "StdAfx.h" 4 5 #include "../../Common/MyInitGuid.h" 6 7 #if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES) 8 #include "../../../C/Alloc.h" 9 #endif 10 11 #include "../../Common/ComTry.h" 12 13 #include "../../Windows/NtCheck.h" 14 #include "../../Windows/PropVariant.h" 15 16 #include "../ICoder.h" 17 #include "../IPassword.h" 18 19 #include "IArchive.h" 20 21 HINSTANCE g_hInstance; 22 23 #define NT_CHECK_FAIL_ACTION return FALSE; 24 25 extern "C" 26 BOOL WINAPI DllMain( 27 #ifdef UNDER_CE 28 HANDLE 29 #else 30 HINSTANCE 31 #endif 32 hInstance, DWORD dwReason, LPVOID /*lpReserved*/) 33 { 34 if (dwReason == DLL_PROCESS_ATTACH) 35 { 36 g_hInstance = (HINSTANCE)hInstance; 37 NT_CHECK; 38 } 39 return TRUE; 40 } 41 42 DEFINE_GUID(CLSID_CArchiveHandler, 43 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x00); 44 45 static const UInt16 kDecodeId = 0x2790; 46 47 DEFINE_GUID(CLSID_CCodec, 48 0x23170F69, 0x40C1, kDecodeId, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); 49 50 STDAPI CreateCoder(const GUID *clsid, const GUID *iid, void **outObject); 51 STDAPI CreateArchiver(const GUID *classID, const GUID *iid, void **outObject); 52 53 STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject) 54 { 55 // COM_TRY_BEGIN 56 *outObject = 0; 57 if (*iid == IID_ICompressCoder || *iid == IID_ICompressCoder2 || *iid == IID_ICompressFilter) 58 { 59 return CreateCoder(clsid, iid, outObject); 60 } 61 else 62 { 63 return CreateArchiver(clsid, iid, outObject); 64 } 65 // COM_TRY_END 66 } 67 68 STDAPI SetLargePageMode() 69 { 70 #if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES) 71 SetLargePageSize(); 72 #endif 73 return S_OK; 74 } 75