source: branches/gcc-kmk/src/ole32/initterm.cpp@ 21855

Last change on this file since 21855 was 21855, checked in by dmik, 13 years ago

Port OLE32 and REGSVR32 to GCC/kBuild.

File size: 1.6 KB
Line 
1/*
2 * OLE32 DLL entry point
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
23// Win32 resource table (produced by wrc)
24extern DWORD ole32_PEResTab;
25
26static HMODULE dllHandle = 0;
27
28BOOL WINAPI OLE32_DllEntryPoint(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad);
29
30BOOL 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:
37 return OLE32_DllEntryPoint(hinstDLL, fdwReason, fImpLoad);
38
39 case DLL_PROCESS_DETACH:
40 OLE32_DllEntryPoint(hinstDLL, fdwReason, fImpLoad);
41 return TRUE;
42 }
43 return FALSE;
44}
45
46ULONG SYSTEM DLL_InitOle32(ULONG hModule)
47{
48 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/
49
50 dllHandle = RegisterLxDll(hModule, LibMainOLE32, (PVOID)&ole32_PEResTab);
51 if (dllHandle == 0)
52 return -1;
53
54 return 0;
55}
56
57void SYSTEM DLL_TermOle32(ULONG hModule)
58{
59 if (dllHandle)
60 UnregisterLxDll(dllHandle);
61}
62
63ULONG SYSTEM DLL_Init(ULONG hModule)
64{
65 if (DLL_InitDefault(hModule) == -1)
66 return -1;
67 return DLL_InitOle32(hModule);
68}
69
70void SYSTEM DLL_Term(ULONG hModule)
71{
72 DLL_TermOle32(hModule);
73 DLL_TermDefault(hModule);
74}
Note: See TracBrowser for help on using the repository browser.