Ignore:
Timestamp:
Feb 5, 2000, 3:12:20 AM (26 years ago)
Author:
sandervl
Message:

Rewrote dll entrypoint

File:
1 edited

Legend:

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

    r2455 r2649  
    1 /* $Id: initterm.cpp,v 1.7 2000-01-15 22:02:07 sandervl Exp $ */
     1/* $Id: initterm.cpp,v 1.8 2000-02-05 02:11:41 sandervl Exp $ */
    22
    33/*
     
    3333#include <odin.h>
    3434#include <win32type.h>
     35#include <winconst.h>
    3536#include <odinlx.h>
    3637#include <misc.h>       /*PLF Wed  98-03-18 23:18:15*/
     
    4950extern int WINAPI PROFILE_GetOdinIniInt(LPCSTR section,LPCSTR key_name,int def);
    5051TW_UINT16 (APIENTRY *TWAINOS2_DSM_Entry)( pTW_IDENTITY, pTW_IDENTITY,
    51            TW_UINT32, TW_UINT16, TW_UINT16, TW_MEMREF) = 0;
     52                                          TW_UINT32, TW_UINT16, TW_UINT16, TW_MEMREF) = 0;
    5253static HINSTANCE hTWAIN = 0;
    5354
    5455}
     56//******************************************************************************
     57//******************************************************************************
     58BOOL WINAPI LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
     59{
     60   switch (fdwReason)
     61   {
     62   case DLL_PROCESS_ATTACH:
     63        return TRUE;
    5564
    56 /*-------------------------------------------------------------------*/
    57 /* A clean up routine registered with DosExitList must be used if    */
    58 /* runtime calls are required and the runtime is dynamically linked. */
    59 /* This will guarantee that this clean up routine is run before the  */
    60 /* library DLL is terminated.                                        */
    61 /*-------------------------------------------------------------------*/
    62 static void APIENTRY cleanup(ULONG reason);
     65   case DLL_THREAD_ATTACH:
     66   case DLL_THREAD_DETACH:
     67        return TRUE;
    6368
    64 
     69   case DLL_PROCESS_DETACH:
     70        _ctordtorTerm();
     71        return TRUE;
     72   }
     73   return FALSE;
     74}
    6575/****************************************************************************/
    6676/* _DLL_InitTerm is the function that gets called by the operating system   */
     
    133143         }
    134144        }
    135          /*******************************************************************/
    136          /* A DosExitList routine must be used to clean up if runtime calls */
    137          /* are required and the runtime is dynamically linked.             */
    138          /*******************************************************************/
    139 
    140          if(RegisterLxDll(hModule, 0, (PVOID)&_Resource_PEResTab) == FALSE)
     145         if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE)
    141146                return 0UL;
    142 
    143          rc = DosExitList(0x0000F000|EXLST_ADD, cleanup);
    144          if(rc)
    145                 return 0UL;
    146147
    147148         break;
     
    161162   return 1UL;
    162163}
    163 
    164 
    165 static void APIENTRY cleanup(ULONG ulReason)
    166 {
    167    _ctordtorTerm();
    168    DosExitList(EXLST_EXIT, cleanup);
    169    return ;
    170 }
     164//******************************************************************************
     165//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.