• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // DLLExports2.cpp
2 
3 #include "StdAfx.h"
4 
5 #include "../../Common/MyInitGuid.h"
6 
7 #if 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"
DllMain(HANDLE hInstance,DWORD dwReason,LPVOID)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, 0, 0, 0, 0, 0, 0, 0, 0);
49 
50 STDAPI CreateCoder(const GUID *clsid, const GUID *iid, void **outObject);
51 STDAPI CreateHasher(const GUID *clsid, IHasher **hasher);
52 STDAPI CreateArchiver(const GUID *classID, const GUID *iid, void **outObject);
53 
CreateObject(const GUID * clsid,const GUID * iid,void ** outObject)54 STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
55 {
56   // COM_TRY_BEGIN
57   *outObject = 0;
58   if (*iid == IID_ICompressCoder ||
59       *iid == IID_ICompressCoder2 ||
60       *iid == IID_ICompressFilter)
61     return CreateCoder(clsid, iid, outObject);
62   if (*iid == IID_IHasher)
63     return CreateHasher(clsid, (IHasher **)outObject);
64   return CreateArchiver(clsid, iid, outObject);
65   // COM_TRY_END
66 }
67 
SetLargePageMode()68 STDAPI SetLargePageMode()
69 {
70   #if defined(_7ZIP_LARGE_PAGES)
71   SetLargePageSize();
72   #endif
73   return S_OK;
74 }
75 
76 extern bool g_CaseSensitive;
77 
SetCaseSensitive(Int32 caseSensitive)78 STDAPI SetCaseSensitive(Int32 caseSensitive)
79 {
80   g_CaseSensitive = (caseSensitive != 0);
81   return S_OK;
82 }
83