[21876] | 1 | /* $Id: initterm.cpp,v 1.3 2002-04-30 14:52:03 sandervl Exp $ */
|
---|
[8346] | 2 | /*
|
---|
[21876] | 3 | * DINPUT DLL entry point
|
---|
[8346] | 4 | *
|
---|
| 5 | * Copyright 1998 Sander van Leeuwen
|
---|
| 6 | * Copyright 1998 Peter Fitzsimmons
|
---|
| 7 | * Copyright 1999 Achim Hasenmueller
|
---|
| 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 <misc.h> /*PLF Wed 98-03-18 23:18:29*/
|
---|
| 19 | #include <win32type.h>
|
---|
| 20 | #include <winconst.h>
|
---|
| 21 | #include <odinlx.h>
|
---|
| 22 | #include <initdll.h>
|
---|
| 23 |
|
---|
[21876] | 24 | // Win32 resource table (produced by wrc)
|
---|
| 25 | extern DWORD dinput_PEResTab;
|
---|
| 26 |
|
---|
[8346] | 27 | extern "C" {
|
---|
[21876] | 28 | extern void mousedev_register();
|
---|
| 29 | extern void keyboarddev_register();
|
---|
[8346] | 30 | }
|
---|
| 31 |
|
---|
| 32 | static HMODULE dllHandle = 0;
|
---|
| 33 |
|
---|
[8413] | 34 | BOOL WINAPI DInputLibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
|
---|
[8346] | 35 | {
|
---|
| 36 | switch (fdwReason)
|
---|
| 37 | {
|
---|
| 38 | case DLL_PROCESS_ATTACH:
|
---|
| 39 | keyboarddev_register();
|
---|
| 40 | mousedev_register();
|
---|
| 41 | return TRUE;
|
---|
| 42 |
|
---|
| 43 | case DLL_THREAD_ATTACH:
|
---|
| 44 | case DLL_THREAD_DETACH:
|
---|
| 45 | case DLL_PROCESS_DETACH:
|
---|
| 46 | return TRUE;
|
---|
| 47 | }
|
---|
| 48 | return FALSE;
|
---|
| 49 | }
|
---|
[21876] | 50 |
|
---|
| 51 | ULONG SYSTEM DLL_InitDInput(ULONG hModule)
|
---|
[8346] | 52 | {
|
---|
[21876] | 53 | CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/
|
---|
[8346] | 54 |
|
---|
[21876] | 55 | dllHandle = RegisterLxDll(hModule, DInputLibMain, (PVOID)&dinput_PEResTab);
|
---|
| 56 | if (dllHandle == 0)
|
---|
| 57 | return -1;
|
---|
[8346] | 58 |
|
---|
[21876] | 59 | return 0;
|
---|
| 60 | }
|
---|
[8346] | 61 |
|
---|
[21876] | 62 | void SYSTEM DLL_TermDInput(ULONG hModule)
|
---|
| 63 | {
|
---|
| 64 | if (dllHandle)
|
---|
| 65 | UnregisterLxDll(dllHandle);
|
---|
| 66 | }
|
---|
[8346] | 67 |
|
---|
[21876] | 68 | ULONG SYSTEM DLL_Init(ULONG hModule)
|
---|
| 69 | {
|
---|
| 70 | if (DLL_InitDefault(hModule) == -1)
|
---|
| 71 | return -1;
|
---|
| 72 | return DLL_InitDInput(hModule);
|
---|
[8346] | 73 | }
|
---|
[21876] | 74 |
|
---|
| 75 | void SYSTEM DLL_Term(ULONG hModule)
|
---|
| 76 | {
|
---|
| 77 | DLL_TermDInput(hModule);
|
---|
| 78 | DLL_TermDefault(hModule);
|
---|
| 79 | }
|
---|