Ignore:
Timestamp:
Dec 9, 2011, 9:41:08 PM (14 years ago)
Author:
dmik
Message:

Port DINPUT to GCC/kBuild.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • branches/gcc-kmk/src/dinput/initterm.cpp

    r21842 r21876  
    1 /* $Id: initdinput.cpp,v 1.2 2002-05-15 09:29:27 sandervl Exp $ */
     1/* $Id: initterm.cpp,v 1.3 2002-04-30 14:52:03 sandervl Exp $ */
    22/*
    3  * COMCTL32 DLL entry point
     3 * DINPUT DLL entry point
    44 *
    55 * Copyright 1998 Sander van Leeuwen
     
    88 *
    99 * Project Odin Software License can be found in LICENSE.TXT
    10  *
    11  *
    1210 */
    1311
    14 /*-------------------------------------------------------------*/
    15 /* INITERM.C -- Source for a custom dynamic link library       */
    16 /*              initialization and termination (_DLL_InitTerm) */
    17 /*              function.                                      */
    18 /*                                                             */
    19 /* When called to perform initialization, this sample function */
    20 /* gets storage for an array of integers, and initializes its  */
    21 /* elements with random integers.  At termination time, it     */
    22 /* frees the array.  Substitute your own special processing.   */
    23 /*-------------------------------------------------------------*/
    24 
    25 
    26 /* Include files */
    2712#define  INCL_DOSMODULEMGR
    2813#define  INCL_DOSPROCESS
     
    3722#include <initdll.h>
    3823
     24// Win32 resource table (produced by wrc)
     25extern DWORD dinput_PEResTab;
     26
    3927extern "C" {
    40  //Win32 resource table (produced by wrc)
    41  extern DWORD dinput_PEResTab;
    42 
    43  extern void mousedev_register();
    44  extern void keyboarddev_register();
     28extern void mousedev_register();
     29extern void keyboarddev_register();
    4530}
    4631
    4732static HMODULE dllHandle = 0;
    4833
    49 //******************************************************************************
    50 //******************************************************************************
    5134BOOL WINAPI DInputLibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
    5235{
     
    6548   return FALSE;
    6649}
    67 /****************************************************************************/
    68 /* _DLL_InitTerm is the function that gets called by the operating system   */
    69 /* loader when it loads and frees this DLL for each process that accesses   */
    70 /* this DLL.  However, it only gets called the first time the DLL is loaded */
    71 /* and the last time it is freed for a particular process.  The system      */
    72 /* linkage convention MUST be used because the operating system loader is   */
    73 /* calling this function.                                                   */
    74 /****************************************************************************/
    75 ULONG APIENTRY inittermDInput(ULONG hModule, ULONG ulFlag)
     50
     51ULONG SYSTEM DLL_InitDInput(ULONG hModule)
    7652{
    77    size_t i;
    78    APIRET rc;
     53    CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    7954
    80    /*-------------------------------------------------------------------------*/
    81    /* If ulFlag is zero then the DLL is being loaded so initialization should */
    82    /* be performed.  If ulFlag is 1 then the DLL is being freed so            */
    83    /* termination should be performed.                                        */
    84    /*-------------------------------------------------------------------------*/
     55    dllHandle = RegisterLxDll(hModule, DInputLibMain, (PVOID)&dinput_PEResTab);
     56    if (dllHandle == 0)
     57        return -1;
    8558
    86    switch (ulFlag) {
    87       case 0 :
    88          dllHandle = RegisterLxDll(hModule, DInputLibMain, (PVOID)&dinput_PEResTab);
    89          if(dllHandle == 0)
    90              return 0UL;
     59    return 0;
     60}
    9161
    92          break;
    93       case 1 :
    94          if(dllHandle) {
    95              UnregisterLxDll(dllHandle);
    96          }
    97          break;
    98       default  :
    99          return 0UL;
    100    }
     62void SYSTEM DLL_TermDInput(ULONG hModule)
     63{
     64    if (dllHandle)
     65       UnregisterLxDll(dllHandle);
     66}
    10167
    102    /***********************************************************/
    103    /* A non-zero value must be returned to indicate success.  */
    104    /***********************************************************/
    105    return 1UL;
     68ULONG SYSTEM DLL_Init(ULONG hModule)
     69{
     70    if (DLL_InitDefault(hModule) == -1)
     71        return -1;
     72    return DLL_InitDInput(hModule);
    10673}
    107 //******************************************************************************
    108 //******************************************************************************
     74
     75void SYSTEM DLL_Term(ULONG hModule)
     76{
     77    DLL_TermDInput(hModule);
     78    DLL_TermDefault(hModule);
     79}
Note: See TracChangeset for help on using the changeset viewer.