[6711] | 1 | /*
|
---|
[21855] | 2 | * OLE32 DLL entry point
|
---|
[6375] | 3 | *
|
---|
| 4 | * Copyright 1998 Sander van Leeuwen
|
---|
| 5 | * Copyright 1998 Peter Fitzsimmons
|
---|
| 6 | *
|
---|
| 7 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
| 8 | */
|
---|
| 9 |
|
---|
| 10 | #define INCL_DOSMODULEMGR
|
---|
| 11 | #define INCL_DOSPROCESS
|
---|
| 12 | #include <os2wrap.h> //Odin32 OS/2 api wrappers
|
---|
| 13 | #include <stdlib.h>
|
---|
| 14 | #include <stdio.h>
|
---|
| 15 | #include <string.h>
|
---|
| 16 | #include <odin.h>
|
---|
| 17 | #include <win32type.h>
|
---|
| 18 | #include <winconst.h>
|
---|
| 19 | #include <odinlx.h>
|
---|
| 20 | #include <misc.h> /*PLF Wed 98-03-18 23:18:15*/
|
---|
| 21 | #include <initdll.h>
|
---|
| 22 |
|
---|
[21855] | 23 | // Win32 resource table (produced by wrc)
|
---|
| 24 | extern DWORD ole32_PEResTab;
|
---|
| 25 |
|
---|
[6375] | 26 | static HMODULE dllHandle = 0;
|
---|
| 27 |
|
---|
| 28 | BOOL WINAPI OLE32_DllEntryPoint(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad);
|
---|
[21855] | 29 |
|
---|
[6375] | 30 | BOOL WINAPI LibMainOLE32(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
|
---|
| 31 | {
|
---|
| 32 | switch (fdwReason)
|
---|
| 33 | {
|
---|
| 34 | case DLL_PROCESS_ATTACH:
|
---|
| 35 | case DLL_THREAD_ATTACH:
|
---|
| 36 | case DLL_THREAD_DETACH:
|
---|
[6711] | 37 | return OLE32_DllEntryPoint(hinstDLL, fdwReason, fImpLoad);
|
---|
[6375] | 38 |
|
---|
| 39 | case DLL_PROCESS_DETACH:
|
---|
| 40 | OLE32_DllEntryPoint(hinstDLL, fdwReason, fImpLoad);
|
---|
[6711] | 41 | return TRUE;
|
---|
[6375] | 42 | }
|
---|
| 43 | return FALSE;
|
---|
| 44 | }
|
---|
[21855] | 45 |
|
---|
| 46 | ULONG SYSTEM DLL_InitOle32(ULONG hModule)
|
---|
[6375] | 47 | {
|
---|
[21855] | 48 | CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/
|
---|
[6375] | 49 |
|
---|
[21855] | 50 | dllHandle = RegisterLxDll(hModule, LibMainOLE32, (PVOID)&ole32_PEResTab);
|
---|
| 51 | if (dllHandle == 0)
|
---|
| 52 | return -1;
|
---|
[6375] | 53 |
|
---|
[21855] | 54 | return 0;
|
---|
| 55 | }
|
---|
[6375] | 56 |
|
---|
[21855] | 57 | void SYSTEM DLL_TermOle32(ULONG hModule)
|
---|
| 58 | {
|
---|
| 59 | if (dllHandle)
|
---|
| 60 | UnregisterLxDll(dllHandle);
|
---|
| 61 | }
|
---|
[6375] | 62 |
|
---|
[21855] | 63 | ULONG SYSTEM DLL_Init(ULONG hModule)
|
---|
| 64 | {
|
---|
| 65 | if (DLL_InitDefault(hModule) == -1)
|
---|
| 66 | return -1;
|
---|
| 67 | return DLL_InitOle32(hModule);
|
---|
| 68 | }
|
---|
[6375] | 69 |
|
---|
[21855] | 70 | void SYSTEM DLL_Term(ULONG hModule)
|
---|
| 71 | {
|
---|
| 72 | DLL_TermOle32(hModule);
|
---|
| 73 | DLL_TermDefault(hModule);
|
---|
[6375] | 74 | }
|
---|