[21896] | 1 | /* $Id: initterm.cpp,v 1.6 2001-09-05 13:37:19 bird Exp $ */
|
---|
[6588] | 2 | /*
|
---|
[21896] | 3 | * RICHED32 DLL entry point
|
---|
[6588] | 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 |
|
---|
[21896] | 24 | // Win32 resource table (produced by wrc)
|
---|
[6891] | 25 | extern DWORD riched32_PEResTab;
|
---|
[6588] | 26 |
|
---|
[21896] | 27 | static HMODULE dllHandle = 0;
|
---|
| 28 |
|
---|
[6588] | 29 | BOOL WINAPI RICHED32_LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
|
---|
[21896] | 30 |
|
---|
[6588] | 31 | static BOOL WINAPI OdinLibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
|
---|
| 32 | {
|
---|
[21896] | 33 | BOOL ret;
|
---|
[6588] | 34 |
|
---|
[21896] | 35 | switch (fdwReason)
|
---|
| 36 | {
|
---|
| 37 | case DLL_PROCESS_ATTACH:
|
---|
| 38 | return RICHED32_LibMain(hinstDLL, fdwReason, fImpLoad);
|
---|
[6588] | 39 |
|
---|
[21896] | 40 | case DLL_THREAD_ATTACH:
|
---|
| 41 | case DLL_THREAD_DETACH:
|
---|
| 42 | return RICHED32_LibMain(hinstDLL, fdwReason, fImpLoad);
|
---|
[6588] | 43 |
|
---|
[21896] | 44 | case DLL_PROCESS_DETACH:
|
---|
| 45 | ret = RICHED32_LibMain(hinstDLL, fdwReason, fImpLoad);
|
---|
| 46 | return ret;
|
---|
| 47 | }
|
---|
| 48 | return FALSE;
|
---|
[6588] | 49 | }
|
---|
[21896] | 50 |
|
---|
| 51 | ULONG SYSTEM DLL_InitRichEd32(ULONG hModule)
|
---|
[6588] | 52 | {
|
---|
[21896] | 53 | CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/
|
---|
[6588] | 54 |
|
---|
[21896] | 55 | dllHandle = RegisterLxDll(hModule, OdinLibMain, (PVOID)&riched32_PEResTab);
|
---|
| 56 | if (dllHandle == 0)
|
---|
| 57 | return -1;
|
---|
[6588] | 58 |
|
---|
[21896] | 59 | return 0;
|
---|
| 60 | }
|
---|
[6588] | 61 |
|
---|
[21896] | 62 | void SYSTEM DLL_TermRichEd32(ULONG hModule)
|
---|
| 63 | {
|
---|
| 64 | if (dllHandle)
|
---|
| 65 | UnregisterLxDll(dllHandle);
|
---|
| 66 | }
|
---|
[9407] | 67 |
|
---|
[21896] | 68 | ULONG SYSTEM DLL_Init(ULONG hModule)
|
---|
| 69 | {
|
---|
| 70 | if (DLL_InitDefault(hModule) == -1)
|
---|
| 71 | return -1;
|
---|
| 72 | return DLL_InitRichEd32(hModule);
|
---|
| 73 | }
|
---|
[6588] | 74 |
|
---|
[21896] | 75 | void SYSTEM DLL_Term(ULONG hModule)
|
---|
| 76 | {
|
---|
| 77 | DLL_TermRichEd32(hModule);
|
---|
| 78 | DLL_TermDefault(hModule);
|
---|
[6588] | 79 | }
|
---|