Ignore:
Timestamp:
Dec 18, 2011, 10:28:22 PM (14 years ago)
Author:
dmik
Message:

Merge branch gcc-kmk to trunk.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        1 bin
        2 Makefile.inc
         1env.cmd
         2LocalConfig.kmk
    • Property svn:mergeinfo set to
      /branches/gcc-kmkmergedeligible
  • trunk/src/ws2_32/initterm.cpp

    r7040 r21916  
    11/* $Id: initterm.cpp,v 1.3 2001-10-13 18:50:52 sandervl Exp $
    22 *
    3  * DLL entry point
     3 * WS2_32 DLL entry point
    44 *
    55 * Copyright 1998 Sander van Leeuwen
    66 * Copyright 1998 Peter Fitzsimmons
    77 *
    8  *
    98 * Project Odin Software License can be found in LICENSE.TXT
    10  *
    119 */
    1210
    13 /*-------------------------------------------------------------*/
    14 /* INITERM.C -- Source for a custom dynamic link library       */
    15 /*              initialization and termination (_DLL_InitTerm) */
    16 /*              function.                                      */
    17 /*                                                             */
    18 /* When called to perform initialization, this sample function */
    19 /* gets storage for an array of integers, and initializes its  */
    20 /* elements with random integers.  At termination time, it     */
    21 /* frees the array.  Substitute your own special processing.   */
    22 /*-------------------------------------------------------------*/
    23 
    24 
    25 /* Include files */
    2611#define  INCL_DOSMODULEMGR
    2712#define  INCL_DOSPROCESS
     
    4025#include "dbglocal.h"
    4126
    42 extern "C" {
    43  //Win32 resource table (produced by wrc)
    44  extern DWORD _Resource_PEResTab;
    45 }
     27// Win32 resource table (produced by wrc)
     28extern DWORD ws2_32_PEResTab;
     29
    4630static HMODULE dllHandle = 0;
    4731
    48 //******************************************************************************
    49 //******************************************************************************
    5032BOOL WINAPI OdinLibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
    5133{
    52    switch (fdwReason)
    53    {
    54    case DLL_PROCESS_ATTACH:
    55     return TRUE;
     34    switch (fdwReason)
     35    {
     36    case DLL_PROCESS_ATTACH:
     37        return TRUE;
    5638
    57    case DLL_THREAD_ATTACH:
    58    case DLL_THREAD_DETACH:
    59     return TRUE;
     39    case DLL_THREAD_ATTACH:
     40    case DLL_THREAD_DETACH:
     41        return TRUE;
    6042
    61    case DLL_PROCESS_DETACH:
    62     ctordtorTerm();
    63     return TRUE;
    64    }
    65    return FALSE;
     43    case DLL_PROCESS_DETACH:
     44#ifdef __IBMC__
     45        ctordtorTerm();
     46#endif
     47        return TRUE;
     48    }
     49    return FALSE;
    6650}
    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 DLLENTRYPOINT_CCONV DLLENTRYPOINT_NAME(ULONG hModule, ULONG ulFlag)
     51
     52ULONG SYSTEM DLL_InitWS2_32(ULONG hModule)
    7653{
    77    size_t i;
    78    APIRET rc;
     54    ParseLogStatus();
    7955
    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    /*-------------------------------------------------------------------------*/
     56    CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    8557
    86    switch (ulFlag) {
    87       case 0 :
    88          ctordtorInit();
     58    dllHandle = RegisterLxDll(hModule, OdinLibMain, (PVOID)&ws2_32_PEResTab);
     59    if(dllHandle == 0)
     60        return -1;
    8961
    90          ParseLogStatus();
     62    return 0;
     63}
    9164
    92          CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
     65void SYSTEM DLL_TermWS2_32(ULONG hModule)
     66{
     67    if (dllHandle)
     68       UnregisterLxDll(dllHandle);
     69}
    9370
    94          dllHandle = RegisterLxDll(hModule, OdinLibMain, (PVOID)&_Resource_PEResTab);
    95          if(dllHandle == 0)
    96              return 0UL;
     71ULONG SYSTEM DLL_Init(ULONG hModule)
     72{
     73    if (DLL_InitDefault(hModule) == -1)
     74        return -1;
     75    return DLL_InitWS2_32(hModule);
     76}
    9777
    98          break;
    99       case 1 :
    100          if(dllHandle) {
    101              UnregisterLxDll(dllHandle);
    102          }
    103          break;
    104       default  :
    105          return 0UL;
    106    }
    107 
    108    /***********************************************************/
    109    /* A non-zero value must be returned to indicate success.  */
    110    /***********************************************************/
    111    return 1UL;
     78void SYSTEM DLL_Term(ULONG hModule)
     79{
     80    DLL_TermWS2_32(hModule);
     81    DLL_TermDefault(hModule);
    11282}
    113 //******************************************************************************
    114 //******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.