source: trunk/src/dllentry/dllentry.cpp

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

Merge branch gcc-kmk to trunk.

File size: 1.4 KB
RevLine 
[6917]1/* $Id: dllentry.cpp,v 1.7 2001-10-01 01:39:17 bird Exp $ */
[2644]2
3/*
[21916]4 * Ordinary DLL entry point
[2644]5 *
6 * Copyright 1998 Sander van Leeuwen
7 * Copyright 1998 Peter Fitzsimmons
8 *
9 * Project Odin Software License can be found in LICENSE.TXT
10 */
11
12#define INCL_DOSMODULEMGR
13#define INCL_DOSPROCESS
14#include <os2wrap.h> //Odin32 OS/2 api wrappers
15#include <stdlib.h>
16#include <stdio.h>
17#include <string.h>
18#include <odin.h>
19#include <win32type.h>
20#include <winconst.h>
21#include <odinlx.h>
22#include <misc.h> /*PLF Wed 98-03-18 23:18:15*/
[5130]23#include <initdll.h>
[2644]24
[21916]25// Win32 resource table (produced by wrc)
26extern DWORD Resource_PEResTab;
[3993]27
28static HMODULE dllHandle = 0;
29
[21916]30#if 0
[2644]31
[21916]32// Not currently needed
[2644]33
[21916]34BOOL WINAPI LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
[2644]35{
[21916]36 switch (fdwReason)
37 {
38 case DLL_PROCESS_ATTACH:
39 return TRUE;
[2644]40
[21916]41 case DLL_THREAD_ATTACH:
42 case DLL_THREAD_DETACH:
43 return TRUE;
[2644]44
[21916]45 case DLL_PROCESS_DETACH:
46 return TRUE;
47 }
[4818]48
[21916]49 return FALSE;
[2644]50}
[4818]51
[21916]52#endif
53
54ULONG SYSTEM DLL_Init(ULONG hModule)
[4818]55{
[21916]56 if (DLL_InitDefault(hModule) == -1)
57 return -1;
58
59 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/
60 dllHandle = RegisterLxDll(hModule, NULL, (PVOID)&Resource_PEResTab);
[4818]61 if (dllHandle == 0)
[21916]62 return -1;
63
64 return 0;
[4818]65}
66
[21916]67void SYSTEM DLL_Term(ULONG hModule)
[4818]68{
[21916]69 if(dllHandle)
[4818]70 UnregisterLxDll(dllHandle);
[21916]71
72 DLL_TermDefault(hModule);
[4818]73}
Note: See TracBrowser for help on using the repository browser.