source: trunk/src/dinput/initterm.cpp@ 22014

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

Merge branch gcc-kmk to trunk.

File size: 1.7 KB
Line 
1/* $Id: initterm.cpp,v 1.3 2002-04-30 14:52:03 sandervl Exp $ */
2/*
3 * DINPUT DLL entry point
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
24// Win32 resource table (produced by wrc)
25extern DWORD dinput_PEResTab;
26
27extern "C" {
28extern void mousedev_register();
29extern void keyboarddev_register();
30}
31
32static HMODULE dllHandle = 0;
33
34BOOL WINAPI DInputLibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
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}
50
51ULONG SYSTEM DLL_InitDInput(ULONG hModule)
52{
53 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/
54
55 dllHandle = RegisterLxDll(hModule, DInputLibMain, (PVOID)&dinput_PEResTab);
56 if (dllHandle == 0)
57 return -1;
58
59 return 0;
60}
61
62void SYSTEM DLL_TermDInput(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_InitDInput(hModule);
73}
74
75void SYSTEM DLL_Term(ULONG hModule)
76{
77 DLL_TermDInput(hModule);
78 DLL_TermDefault(hModule);
79}
Note: See TracBrowser for help on using the repository browser.