1 | /* $Id: initterm.cpp,v 1.17 2001/09/05 10:26:30 bird Exp $
|
---|
2 | *
|
---|
3 | * CRYPT32 DLL entry point
|
---|
4 | *
|
---|
5 | * Copyright 1998 Sander van Leeuwen
|
---|
6 | * Copyright 1998 Peter Fitzsimmons
|
---|
7 | *
|
---|
8 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
9 | */
|
---|
10 |
|
---|
11 | #define INCL_DOSMODULEMGR
|
---|
12 | #define INCL_DOSPROCESS
|
---|
13 | #include <os2wrap.h> //Odin32 OS/2 api wrappers
|
---|
14 | #include <stdlib.h>
|
---|
15 | #include <stdio.h>
|
---|
16 | #include <string.h>
|
---|
17 | #include <odin.h>
|
---|
18 | #include <win32api.h>
|
---|
19 | #include <winconst.h>
|
---|
20 | #include <odinlx.h>
|
---|
21 | #include <cpuhlp.h>
|
---|
22 | #include <dbglog.h>
|
---|
23 | #include <initdll.h>
|
---|
24 |
|
---|
25 | // Win32 resource table (produced by wrc)
|
---|
26 | extern DWORD crypt32_PEResTab;
|
---|
27 |
|
---|
28 | BOOL WINAPI Crypt32DllMain(HINSTANCE hInst, DWORD fdwReason, PVOID pvReserved);
|
---|
29 |
|
---|
30 | static HMODULE dllHandle = 0;
|
---|
31 |
|
---|
32 | static BOOL WINAPI OdinLibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
|
---|
33 | {
|
---|
34 | BOOL ret;
|
---|
35 |
|
---|
36 | switch (fdwReason)
|
---|
37 | {
|
---|
38 | case DLL_PROCESS_ATTACH:
|
---|
39 | return Crypt32DllMain(hinstDLL, fdwReason, fImpLoad);
|
---|
40 |
|
---|
41 | case DLL_THREAD_ATTACH:
|
---|
42 | case DLL_THREAD_DETACH:
|
---|
43 | return Crypt32DllMain(hinstDLL, fdwReason, fImpLoad);
|
---|
44 |
|
---|
45 | case DLL_PROCESS_DETACH:
|
---|
46 | ret = Crypt32DllMain(hinstDLL, fdwReason, fImpLoad);
|
---|
47 | return ret;
|
---|
48 | }
|
---|
49 | return FALSE;
|
---|
50 | }
|
---|
51 |
|
---|
52 | ULONG SYSTEM DLL_InitCrypt32(ULONG hModule)
|
---|
53 | {
|
---|
54 | //CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/
|
---|
55 |
|
---|
56 | if (!InitializeKernel32())
|
---|
57 | return -1;
|
---|
58 |
|
---|
59 | dllHandle = RegisterLxDll(hModule, OdinLibMain, (PVOID)&crypt32_PEResTab);
|
---|
60 | if (dllHandle == 0)
|
---|
61 | return -1;
|
---|
62 |
|
---|
63 | dprintf(("crypt32 init %s %s (%x)", __DATE__, __TIME__, DLL_InitCrypt32));
|
---|
64 |
|
---|
65 | return 0;
|
---|
66 | }
|
---|
67 |
|
---|
68 | void SYSTEM DLL_TermCrypt32(ULONG hModule)
|
---|
69 | {
|
---|
70 | if (dllHandle)
|
---|
71 | UnregisterLxDll(dllHandle);
|
---|
72 | }
|
---|
73 |
|
---|
74 | ULONG SYSTEM DLL_Init(ULONG hModule)
|
---|
75 | {
|
---|
76 | if (DLL_InitDefault(hModule) == -1)
|
---|
77 | return -1;
|
---|
78 | return DLL_InitCrypt32(hModule);
|
---|
79 | }
|
---|
80 |
|
---|
81 | void SYSTEM DLL_Term(ULONG hModule)
|
---|
82 | {
|
---|
83 | DLL_TermCrypt32(hModule);
|
---|
84 | DLL_TermDefault(hModule);
|
---|
85 | }
|
---|