source: trunk/src/riched32/initterm.cpp

Last change on this file was 21916, checked in by dmik, 14 years ago

Merge branch gcc-kmk to trunk.

File size: 1.8 KB
Line 
1/* $Id: initterm.cpp,v 1.6 2001-09-05 13:37:19 bird Exp $ */
2/*
3 * RICHED32 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 <win32type.h>
19#include <winconst.h>
20#include <odinlx.h>
21#include <misc.h> /*PLF Wed 98-03-18 23:18:15*/
22#include <initdll.h>
23
24// Win32 resource table (produced by wrc)
25extern DWORD riched32_PEResTab;
26
27static HMODULE dllHandle = 0;
28
29BOOL WINAPI RICHED32_LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
30
31static BOOL WINAPI OdinLibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
32{
33 BOOL ret;
34
35 switch (fdwReason)
36 {
37 case DLL_PROCESS_ATTACH:
38 return RICHED32_LibMain(hinstDLL, fdwReason, fImpLoad);
39
40 case DLL_THREAD_ATTACH:
41 case DLL_THREAD_DETACH:
42 return RICHED32_LibMain(hinstDLL, fdwReason, fImpLoad);
43
44 case DLL_PROCESS_DETACH:
45 ret = RICHED32_LibMain(hinstDLL, fdwReason, fImpLoad);
46 return ret;
47 }
48 return FALSE;
49}
50
51ULONG SYSTEM DLL_InitRichEd32(ULONG hModule)
52{
53 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/
54
55 dllHandle = RegisterLxDll(hModule, OdinLibMain, (PVOID)&riched32_PEResTab);
56 if (dllHandle == 0)
57 return -1;
58
59 return 0;
60}
61
62void SYSTEM DLL_TermRichEd32(ULONG hModule)
63{
64 if (dllHandle)
65 UnregisterLxDll(dllHandle);
66}
67
68ULONG SYSTEM DLL_Init(ULONG hModule)
69{
70 if (DLL_InitDefault(hModule) == -1)
71 return -1;
72 return DLL_InitRichEd32(hModule);
73}
74
75void SYSTEM DLL_Term(ULONG hModule)
76{
77 DLL_TermRichEd32(hModule);
78 DLL_TermDefault(hModule);
79}
Note: See TracBrowser for help on using the repository browser.