Ignore:
Timestamp:
Mar 18, 2001, 10:44:46 PM (24 years ago)
Author:
mike
Message:

Merged DDRAW and DDRAW\NEW

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/ddraw/initterm.cpp

    r5305 r5326  
    3333#include <winconst.h>
    3434#include <odinlx.h>
     35#include <exitlist.h>
    3536#include <misc.h>       /*PLF Wed  98-03-18 23:18:15*/
    3637#include <initdll.h>
     38#include "os2fsdd.h"    // For RestorePM()
     39
    3740
    3841extern "C" {
     
    4447static HMODULE dllHandle = 0;
    4548
     49static void APIENTRY cleanup(ULONG ulReason);
     50
    4651//******************************************************************************
    4752//******************************************************************************
    48 BOOL WINAPI OdinLibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
     53BOOL WINAPI LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
    4954{
    5055   switch (fdwReason)
     
    5863
    5964   case DLL_PROCESS_DETACH:
     65#ifdef __IBMCPP__
    6066        ctordtorTerm();
     67#endif
    6168        return TRUE;
    6269   }
     
    7178/* calling this function.                                                   */
    7279/****************************************************************************/
    73 ULONG DLLENTRYPOINT_CCONV DLLENTRYPOINT_NAME(ULONG hModule, ULONG ulFlag)
     80unsigned long SYSTEM _DLL_InitTerm(unsigned long hModule, unsigned long
     81                                   ulFlag)
    7482{
    7583
     
    8391      case 0 :
    8492      {
     93             APIRET rc;
     94               
     95#ifdef __IBMCPP__
     96         ctordtorInit();
     97#endif
    8598         DosQueryModuleName(hModule, CCHMAXPATH, ddrawPath);
    8699         char *endofpath = strrchr(ddrawPath, '\\');
    87          if(endofpath) *(endofpath+1) = 0;
    88 
    89          ctordtorInit();
     100         if (endofpath)
     101                        *(endofpath+1) = '\0';
    90102
    91103         CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    92104
    93          dllHandle = RegisterLxDll(hModule, OdinLibMain, (PVOID)&_Resource_PEResTab,
     105         dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab,
    94106                                   DDRAW_MAJORIMAGE_VERSION, DDRAW_MINORIMAGE_VERSION,
    95107                                   IMAGE_SUBSYSTEM_WINDOWS_GUI);
    96          if(dllHandle == 0)
    97                 return 0UL;
     108         if (dllHandle == 0)
     109                        return 0UL;
     110
     111         rc = DosExitList(EXITLIST_NONCOREDLL | EXLST_ADD, cleanup);
     112         if (rc)
     113                        return 0UL;
    98114
    99115         break;
     
    101117      case 1 :
    102118         if(dllHandle) {
    103                 UnregisterLxDll(dllHandle);
     119                        UnregisterLxDll(dllHandle);
    104120         }
    105121         break;
     
    115131//******************************************************************************
    116132//******************************************************************************
     133
     134static void APIENTRY cleanup(ULONG ulReason)
     135{
     136   dprintf(("DDRAW processing exitlist"));
     137   RestorePM();
     138   dprintf(("DDRAW exitlist done"));
     139
     140   DosExitList(EXLST_EXIT, cleanup);
     141}
     142//******************************************************************************
     143//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.