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/rpcrt4/initterm.cpp

    r6649 r21916  
    11/* $Id: initterm.cpp,v 1.7 2001-09-05 13:37:51 bird Exp $ */
    22/*
    3  * DLL entry point
     3 * RPCRT4 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
     
    3823#include <initdll.h>
    3924
    40 /****************************************************************************/
    41 /* _DLL_InitTerm is the function that gets called by the operating system   */
    42 /* loader when it loads and frees this DLL for each process that accesses   */
    43 /* this DLL.  However, it only gets called the first time the DLL is loaded */
    44 /* and the last time it is freed for a particular process.  The system      */
    45 /* linkage convention MUST be used because the operating system loader is   */
    46 /* calling this function.                                                   */
    47 /****************************************************************************/
    48 unsigned long SYSTEM _DLL_InitTerm(unsigned long hModule, unsigned long
    49                                    ulFlag)
     25// Win32 resource table (produced by wrc)
     26extern DWORD rpcrt4_PEResTab;
     27
     28static HMODULE dllHandle = 0;
     29
     30ULONG SYSTEM DLL_InitRpcRt4(ULONG hModule)
    5031{
    51    size_t i;
    52    APIRET rc;
     32    CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    5333
    54    /*-------------------------------------------------------------------------*/
    55    /* If ulFlag is zero then the DLL is being loaded so initialization should */
    56    /* be performed.  If ulFlag is 1 then the DLL is being freed so            */
    57    /* termination should be performed.                                        */
    58    /*-------------------------------------------------------------------------*/
     34    dllHandle = RegisterLxDll(hModule, NULL, (PVOID)&rpcrt4_PEResTab);
     35    if (dllHandle == 0)
     36           return -1;
    5937
    60    switch (ulFlag) {
    61       case 0 :
    62          ctordtorInit();
     38    //SvL: Must be done here as the socket calls trash FS!
     39    /* Init the Uuid subsystem */
     40    UuidInit();
    6341
    64          CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
     42    return 0;
     43}
    6544
    66          return inittermRpcrt4(hModule, ulFlag);
     45void SYSTEM DLL_TermRpcRt4(ULONG hModule)
     46{
     47    if (dllHandle)
     48       UnregisterLxDll(dllHandle);
     49}
    6750
    68       case 1 :
    69          inittermRpcrt4(hModule, ulFlag);
    70          ctordtorTerm();
    71          break;
     51ULONG SYSTEM DLL_Init(ULONG hModule)
     52{
     53    if (DLL_InitDefault(hModule) == -1)
     54        return -1;
     55    return DLL_InitRpcRt4(hModule);
     56}
    7257
    73       default  :
    74          return 0UL;
    75    }
    76 
    77    /***********************************************************/
    78    /* A non-zero value must be returned to indicate success.  */
    79    /***********************************************************/
    80    return 1UL;
     58void SYSTEM DLL_Term(ULONG hModule)
     59{
     60    DLL_TermRpcRt4(hModule);
     61    DLL_TermDefault(hModule);
    8162}
Note: See TracChangeset for help on using the changeset viewer.