Changeset 6375 for trunk/src


Ignore:
Timestamp:
Jul 20, 2001, 5:42:38 PM (24 years ago)
Author:
sandervl
Message:

initterm update

Location:
trunk/src
Files:
25 added
47 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comctl32/comctl32.def

    r5630 r6375  
    1 ; $Id: comctl32.def,v 1.22 2001-04-29 10:30:56 sandervl Exp $
     1; $Id: comctl32.def,v 1.23 2001-07-20 15:35:30 sandervl Exp $
    22LIBRARY COMCTL32 INITINSTANCE
    33DESCRIPTION 'Odin32 System DLL - ComCtl32 - Common Controls Library'
     
    155155  DSA_EnumCallback    = _DSA_EnumCallback@12       @387
    156156  DSA_DestroyCallback = _DSA_DestroyCallback@12    @388
    157                         _COMCTL32_389@8            @389
    158                         _COMCTL32_390@16           @390
     157                        _COMCTL32_389@8            @389 NONAME
     158                        _COMCTL32_390@16           @390 NONAME
    159159
    160160  StrCSpnA            = _COMCTL32_StrCSpnA@8       @356
  • trunk/src/comctl32/initterm.cpp

    r5416 r6375  
    3636#include <initdll.h>
    3737
    38 extern "C" {
    39  //Win32 resource table (produced by wrc)
    40  extern DWORD _Resource_PEResTab;
    41 }
    42 
    43 static HMODULE dllHandle = 0;
    44 
    45 BOOL WINAPI COMCTL32_LibMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
    46 
    47 //******************************************************************************
    48 //******************************************************************************
    49 BOOL WINAPI LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
    50 {
    51    switch (fdwReason)
    52    {
    53    case DLL_PROCESS_ATTACH:
    54    case DLL_THREAD_ATTACH:
    55    case DLL_THREAD_DETACH:
    56         return COMCTL32_LibMain(hinstDLL, fdwReason, fImpLoad);
    57 
    58    case DLL_PROCESS_DETACH:
    59    {
    60         BOOL ret = COMCTL32_LibMain(hinstDLL, fdwReason, fImpLoad);
    61         ctordtorTerm();
    62         return ret;
    63    }
    64    }
    65    return FALSE;
    66 }
    6738/****************************************************************************/
    6839/* _DLL_InitTerm is the function that gets called by the operating system   */
     
    8758   switch (ulFlag) {
    8859      case 0 :
    89 
    9060         ctordtorInit();
    91 
    92          /*******************************************************************/
    93          /* A DosExitList routine must be used to clean up if runtime calls */
    94          /* are required and the runtime is dynamically linked.             */
    95          /*******************************************************************/
    96 
    97          dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab,
    98                                    COMCTL32_MAJORIMAGE_VERSION, COMCTL32_MINORIMAGE_VERSION,
    99                                    IMAGE_SUBSYSTEM_WINDOWS_GUI);
    100          if(dllHandle == 0)
    101                 return 0UL;
    102 
    10361         CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    10462
     63         return inittermComctl32(hModule, ulFlag);
     64
     65      case 1 :
     66         inittermComctl32(hModule, ulFlag);
     67         ctordtorTerm();
    10568         break;
    106       case 1 :
    107          if(dllHandle) {
    108                 UnregisterLxDll(dllHandle);
    109          }
    110          break;
     69
    11170      default  :
    11271         return 0UL;
  • trunk/src/comctl32/makefile

    r5630 r6375  
    1 # $Id: makefile,v 1.32 2001-04-29 10:30:56 sandervl Exp $
     1# $Id: makefile,v 1.33 2001-07-20 15:35:30 sandervl Exp $
    22
    33#
     
    2020$(OBJDIR)\comctl32.obj \
    2121$(OBJDIR)\initterm.obj \
     22$(OBJDIR)\initcomctl32.obj \
    2223$(OBJDIR)\progress.obj \
    2324$(OBJDIR)\comctl32undoc.obj \
  • trunk/src/comdlg32/initterm.cpp

    r5135 r6375  
    3636#include <initdll.h>
    3737
    38 extern "C" {
    39  //Win32 resource table (produced by wrc)
    40  extern DWORD _Resource_PEResTab;
    41 
    42  BOOL WINAPI COMDLG32_DllEntryPoint(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved);
    43 }
    44 
    45 static HMODULE dllHandle = 0;
    46 
    47 //******************************************************************************
    48 //******************************************************************************
    49 BOOL WINAPI LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
    50 {
    51    switch (fdwReason)
    52    {
    53    case DLL_PROCESS_ATTACH:
    54    case DLL_THREAD_ATTACH:
    55    case DLL_THREAD_DETACH:
    56         return COMDLG32_DllEntryPoint(hinstDLL, fdwReason, fImpLoad);
    57 
    58    case DLL_PROCESS_DETACH:
    59         COMDLG32_DllEntryPoint(hinstDLL, fdwReason, fImpLoad);
    60         ctordtorTerm();
    61         return TRUE;
    62    }
    63    return FALSE;
    64 }
    6538/****************************************************************************/
    6639/* _DLL_InitTerm is the function that gets called by the operating system   */
     
    8962         CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    9063
    91          /*******************************************************************/
    92          /* A DosExitList routine must be used to clean up if runtime calls */
    93          /* are required and the runtime is dynamically linked.             */
    94          /*******************************************************************/
     64         return inittermComdlg32(hModule, ulFlag);
    9565
    96          dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab,
    97                                    COMDLG32_MAJORIMAGE_VERSION, COMDLG32_MINORIMAGE_VERSION,
    98                                    IMAGE_SUBSYSTEM_WINDOWS_GUI);
    99          if(dllHandle == 0)
    100                 return 0UL;
     66      case 1 :
     67         inittermComdlg32(hModule, ulFlag);
     68         ctordtorTerm();
     69         break;
    10170
    102          break;
    103       case 1 :
    104          if(dllHandle) {
    105                 UnregisterLxDll(dllHandle);
    106          }
    107          break;
    10871      default  :
    10972         return 0UL;
  • trunk/src/comdlg32/makefile

    r6365 r6375  
    1 # $Id: makefile,v 1.27 2001-07-19 20:00:22 sandervl Exp $
     1# $Id: makefile,v 1.28 2001-07-20 15:36:49 sandervl Exp $
    22
    33#
     
    2828$(OBJDIR)\fontdlg.obj \
    2929$(OBJDIR)\initterm.obj \
     30$(OBJDIR)\initcomdlg32.obj \
    3031$(OBJDIR)\cdlg32.obj \
    3132$(OBJDIR)\filetitle.obj \
  • trunk/src/gdi32/dbglocal.cpp

    r6331 r6375  
    1 /* $Id: dbglocal.cpp,v 1.6 2001-07-14 15:31:38 sandervl Exp $ */
     1/* $Id: dbglocal.cpp,v 1.7 2001-07-20 15:35:57 sandervl Exp $ */
    22
    33/*
     
    1616#ifdef DEBUG
    1717
    18 USHORT DbgEnabled[DBG_MAXFILES] = {0};
    19 USHORT DbgEnabledLvl2[DBG_MAXFILES] = {0};
     18USHORT DbgEnabledGDI32[DBG_MAXFILES] = {0};
     19USHORT DbgEnabledLvl2GDI32[DBG_MAXFILES] = {0};
    2020
    21 char  *DbgFileNames[DBG_MAXFILES] =
     21static char  *DbgFileNames[DBG_MAXFILES] =
    2222{
    2323"gdi32",
     
    4444//******************************************************************************
    4545//******************************************************************************
    46 void ParseLogStatus()
     46void ParseLogStatusGDI32()
    4747{
    4848 char *envvar = getenv(DBG_ENVNAME);
     
    5252
    5353    for(i=0;i<DBG_MAXFILES;i++) {
    54         DbgEnabled[i] = 1;
     54        DbgEnabledGDI32[i] = 1;
    5555    }
    5656
     
    6262        if(*(dbgvar-1) == '-') {
    6363            for(i=0;i<DBG_MAXFILES;i++) {
    64                 DbgEnabled[i] = 0;
     64                DbgEnabledGDI32[i] = 0;
    6565            }
    6666        }
     
    7070        if(dbgvar) {
    7171            if(*(dbgvar-1) == '-') {
    72                     DbgEnabled[i] = 0;
     72                    DbgEnabledGDI32[i] = 0;
    7373            }
    7474            else   
    7575            if(*(dbgvar-1) == '+') {
    76                 DbgEnabled[i] = 1;
     76                DbgEnabledGDI32[i] = 1;
    7777            }
    7878        }
     
    8383                if(*(dbgvar-1) == '+') {
    8484                    for(i=0;i<DBG_MAXFILES;i++) {
    85                         DbgEnabledLvl2[i] = 1;
     85                        DbgEnabledLvl2GDI32[i] = 1;
    8686                    }
    8787                }
     
    9191                if(dbgvar) {
    9292                    if(*(dbgvar-1) == '-') {
    93                             DbgEnabledLvl2[i] = 0;
     93                            DbgEnabledLvl2GDI32[i] = 0;
    9494                    }
    9595                    else   
    9696                    if(*(dbgvar-1) == '+') {
    97                         DbgEnabledLvl2[i] = 1;
     97                        DbgEnabledLvl2GDI32[i] = 1;
    9898                    }
    9999                }
  • trunk/src/gdi32/dbglocal.h

    r6331 r6375  
    1 /* $Id: dbglocal.h,v 1.6 2001-07-14 15:31:39 sandervl Exp $ */
     1/* $Id: dbglocal.h,v 1.7 2001-07-20 15:35:57 sandervl Exp $ */
    22
    33/*
     
    1515#ifdef DEBUG
    1616//Parses environment variable for selective enabling/disabling of logging
    17 void ParseLogStatus();
     17void ParseLogStatusGDI32();
    1818
    1919#define DBG_ENVNAME        "dbg_gdi32"
     
    4242#define DBG_MAXFILES        20
    4343
    44 extern USHORT DbgEnabled[DBG_MAXFILES];
    45 extern USHORT DbgEnabledLvl2[DBG_MAXFILES];
     44extern USHORT DbgEnabledGDI32[DBG_MAXFILES];
     45extern USHORT DbgEnabledLvl2GDI32[DBG_MAXFILES];
    4646
    4747#ifdef dprintf
     
    4949#endif
    5050
    51 #define dprintf(a)      if(DbgEnabled[DBG_LOCALLOG] == 1) WriteLog a
     51#define dprintf(a)      if(DbgEnabledGDI32[DBG_LOCALLOG] == 1) WriteLog a
    5252
    5353#ifdef dprintf2
     
    5555#endif
    5656
    57 #define dprintf2(a)     if(DbgEnabledLvl2[DBG_LOCALLOG] == 1) WriteLog a
     57#define dprintf2(a)     if(DbgEnabledLvl2GDI32[DBG_LOCALLOG] == 1) WriteLog a
    5858
    5959#else
    6060
    61 #define ParseLogStatus()
     61#define ParseLogStatusGDI32()
    6262
    6363#endif //DEBUG
  • trunk/src/gdi32/initterm.cpp

    r5356 r6375  
    3939#include <initdll.h>
    4040
    41 extern "C" {
    42  //Win32 resource table (produced by wrc)
    43  extern DWORD _Resource_PEResTab;
    44 }
    45 static HMODULE dllHandle = 0;
    46 //******************************************************************************
    47 //******************************************************************************
    48 BOOL WINAPI OdinLibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
    49 {
    50    switch (fdwReason)
    51    {
    52    case DLL_PROCESS_ATTACH:
    53         return TRUE;
    54 
    55    case DLL_THREAD_ATTACH:
    56    case DLL_THREAD_DETACH:
    57         return TRUE;
    58 
    59    case DLL_PROCESS_DETACH:
    60         ctordtorTerm();
    61         return TRUE;
    62    }
    63    return FALSE;
    64 }
    6541/****************************************************************************/
    6642/* _DLL_InitTerm is the function that gets called by the operating system   */
     
    8662         ctordtorInit();
    8763
    88          ParseLogStatus();
    8964         CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    9065
    91          if(InitRegionSpace() == FALSE) {
    92                 return 0UL;
    93          }
    94          dllHandle = RegisterLxDll(hModule, OdinLibMain, (PVOID)&_Resource_PEResTab,
    95                                    GDI32_MAJORIMAGE_VERSION, GDI32_MINORIMAGE_VERSION,
    96                                    IMAGE_SUBSYSTEM_NATIVE);
    97          if(dllHandle == 0)
    98                 return 0UL;
     66         return inittermGdi32(hModule, ulFlag);
    9967
    100          dprintf(("gdi32 init %s %s (%x)", __DATE__, __TIME__, DLLENTRYPOINT_NAME));
     68      case 1 :
     69         return inittermGdi32(hModule, ulFlag);
    10170
    102          break;
    103       case 1 :
    104          if(dllHandle) {
    105                 UnregisterLxDll(dllHandle);
    106          }
    107          break;
    10871      default  :
    10972         return 0UL;
  • trunk/src/gdi32/makefile

    r6331 r6375  
    1 # $Id: makefile,v 1.36 2001-07-14 15:31:44 sandervl Exp $
     1# $Id: makefile,v 1.37 2001-07-20 15:35:57 sandervl Exp $
    22
    33#
     
    3131$(OBJDIR)\dibsect.obj \
    3232$(OBJDIR)\initterm.obj \
     33$(OBJDIR)\initgdi32.obj \
    3334$(OBJDIR)\oslibgdi.obj \
    3435$(OBJDIR)\font.obj \
  • trunk/src/kernel32/KERNEL32.DEF

    r6263 r6375  
    1 ; $Id: KERNEL32.DEF,v 1.114 2001-07-09 07:58:12 sandervl Exp $
     1; $Id: KERNEL32.DEF,v 1.115 2001-07-20 15:33:28 sandervl Exp $
    22
    33;Basis is Windows95 KERNEL32
     
    11641164    _Odin32GetBuildNumber@0                                       @1293 NONAME
    11651165
    1166 ;Export for MSACM32
    1167     _wsnprintfA                                                   @2000 NONAME
    1168 
    11691166    IsExeStarted__Fv                                              @2001 NONAME
    11701167    CheckCurFS                                                    @2002 NONAME
  • trunk/src/kernel32/dbglocal.cpp

    r5587 r6375  
    1 /* $Id: dbglocal.cpp,v 1.15 2001-04-26 13:22:43 sandervl Exp $ */
     1/* $Id: dbglocal.cpp,v 1.16 2001-07-20 15:33:29 sandervl Exp $ */
    22
    33/*
     
    1616#ifdef DEBUG
    1717
    18 USHORT DbgEnabled[DBG_MAXFILES] = {0};
    19 USHORT DbgEnabledLvl2[DBG_MAXFILES] = {0};
     18USHORT DbgEnabledKERNEL32[DBG_MAXFILES] = {0};
     19USHORT DbgEnabledLvl2KERNEL32[DBG_MAXFILES] = {0};
    2020
    21 char  *DbgFileNames[DBG_MAXFILES] =
     21static char  *DbgFileNames[DBG_MAXFILES] =
    2222{
    2323"kernel32",
     
    128128//******************************************************************************
    129129//******************************************************************************
    130 void ParseLogStatus()
     130void ParseLogStatusKERNEL32()
    131131{
    132132 char *envvar = getenv(DBG_ENVNAME);
     
    136136
    137137    for(i=0;i<DBG_MAXFILES;i++) {
    138         DbgEnabled[i] = 1;
     138        DbgEnabledKERNEL32[i] = 1;
    139139    }
    140140
     
    144144                if(*(dbgvar-1) == '-') {
    145145                    for(i=0;i<DBG_MAXFILES;i++) {
    146                         DbgEnabled[i] = 0;
     146                        DbgEnabledKERNEL32[i] = 0;
    147147                    }
    148148                }
     
    152152                if(dbgvar) {
    153153                    if(*(dbgvar-1) == '-') {
    154                             DbgEnabled[i] = 0;
     154                            DbgEnabledKERNEL32[i] = 0;
    155155                    }
    156156                    else   
    157157                    if(*(dbgvar-1) == '+') {
    158                         DbgEnabled[i] = 1;
     158                        DbgEnabledKERNEL32[i] = 1;
    159159                    }
    160160                }
     
    166166                if(*(dbgvar-1) == '+') {
    167167                    for(i=0;i<DBG_MAXFILES;i++) {
    168                         DbgEnabledLvl2[i] = 1;
     168                        DbgEnabledLvl2KERNEL32[i] = 1;
    169169                    }
    170170                }
     
    174174                if(dbgvar) {
    175175                    if(*(dbgvar-1) == '-') {
    176                             DbgEnabledLvl2[i] = 0;
     176                            DbgEnabledLvl2KERNEL32[i] = 0;
    177177                    }
    178178                    else   
    179179                    if(*(dbgvar-1) == '+') {
    180                         DbgEnabledLvl2[i] = 1;
     180                        DbgEnabledLvl2KERNEL32[i] = 1;
    181181                    }
    182182                }
  • trunk/src/kernel32/dbglocal.h

    r5587 r6375  
    1313#ifdef DEBUG
    1414//Parses environment variable for selective enabling/disabling of logging
    15 void ParseLogStatus();
     15void ParseLogStatusKERNEL32();
    1616
    1717#define DBG_ENVNAME        "dbg_kernel32"
     
    124124#define DBG_MAXFILES       104
    125125
    126 extern USHORT DbgEnabled[DBG_MAXFILES];
    127 extern USHORT DbgEnabledLvl2[DBG_MAXFILES];
     126extern USHORT DbgEnabledKERNEL32[DBG_MAXFILES];
     127extern USHORT DbgEnabledLvl2KERNEL32[DBG_MAXFILES];
    128128
    129129#ifdef dprintf
     
    131131#endif
    132132
    133 #define dprintf(a)      if(DbgEnabled[DBG_LOCALLOG] == 1) WriteLog a
     133#define dprintf(a)      if(DbgEnabledKERNEL32[DBG_LOCALLOG] == 1) WriteLog a
    134134
    135135#ifdef dprintf2
     
    137137#endif
    138138
    139 #define dprintf2(a)     if(DbgEnabledLvl2[DBG_LOCALLOG] == 1) WriteLog a
     139#define dprintf2(a)     if(DbgEnabledLvl2KERNEL32[DBG_LOCALLOG] == 1) WriteLog a
    140140
    141141#else
    142142
    143 #define ParseLogStatus()
     143#define ParseLogStatusKERNEL32()
    144144
    145145#endif //DEBUG
  • trunk/src/kernel32/exceptstackdump.cpp

    r4555 r6375  
    1 /* $Id: exceptstackdump.cpp,v 1.3 2000-11-05 13:40:45 sandervl Exp $ */
     1/* $Id: exceptstackdump.cpp,v 1.4 2001-07-20 15:33:29 sandervl Exp $ */
    22/*
    33 * Stack dump code
     
    3030
    3131#undef dprintf
    32 #define dprintf(a)     if(DbgEnabled[DBG_LOCALLOG] == 1) WriteLogNoEOL a
     32#define dprintf(a)     if(DbgEnabledKERNEL32[DBG_LOCALLOG] == 1) WriteLogNoEOL a
    3333
    3434/* ******************************************************************
  • trunk/src/kernel32/exceptutil.asm

    r6133 r6375  
    1 ; $Id: exceptutil.asm,v 1.17 2001-06-27 19:09:35 sandervl Exp $
     1; $Id: exceptutil.asm,v 1.18 2001-07-20 15:33:29 sandervl Exp $
    22
    33;/*
     
    160160getEAX  endp
    161161
     162public  getEDX
     163getEDX  proc    near
     164        mov     EAX, EDX
     165        ret
     166endp
     167
    162168getEBX  proc near
    163169        mov  eax, ebx
     
    292298        EXTRN _GetThreadTEB@0:PROC
    293299IFDEF DEBUG
    294         EXTRN DbgEnabled:DWORD
     300        EXTRN DbgEnabledKERNEL32:DWORD
    295301ENDIF
    296302
     
    375381; 299     dprintf(("KERNEL32: Calling handler at %p code=%lx flags=%lx\n",
    376382IFDEF DEBUG
    377         cmp     word ptr  DbgEnabled+020h,01h
     383        cmp     word ptr  DbgEnabledKERNEL32+020h,01h
    378384        jne     @BLBL20
    379385        mov     eax,[ebp+08h];  record
     
    400406IFDEF DEBUG
    401407; 302     dprintf(("KERNEL32: Handler returned %lx\n", ret));
    402         cmp     word ptr  DbgEnabled+020h,01h
     408        cmp     word ptr  DbgEnabledKERNEL32+020h,01h
    403409        jne     @BLBL21
    404410        push    dword ptr [ebp-010h];   ret
  • trunk/src/kernel32/initterm.cpp

    r6340 r6375  
    5858#include "dbglocal.h"
    5959
    60 PVOID   SYSTEM _O32_GetEnvironmentStrings( VOID );
    6160BOOL  fVersionWarp3 = FALSE;
    6261
     
    6867/*-------------------------------------------------------------------*/
    6968static void APIENTRY cleanup(ULONG reason);
    70 
    71 extern "C" {
    72  //Win32 resource table (produced by wrc)
    73  extern DWORD _Resource_PEResTab;
    74 }
    75 
    76 //Global DLL Data
    77 #pragma data_seg(_GLOBALDATA)
    78 int globLoadNr = 0;
    79 #pragma data_seg()
    80 
    81 /* Tue 03.03.1998: knut */
    82 ULONG flAllocMem = 0;    /* flag to optimize DosAllocMem to use all the memory on SMP machines */
    83 ULONG ulMaxAddr = 0x20000000; /* end of user address space. */
    84 int   loadNr = 0;
    85 char  kernel32Path[CCHMAXPATH] = "";
    86 static HMODULE dllHandle = 0;
    8769
    8870/****************************************************************************/
     
    11092        case 0 :
    11193        {
    112             ParseLogStatus();
    113 
    114             /*
    115              * Init the win32k library.
    116              * We will also need to tell win32k where the Odin32 environment is
    117              * located. Currently that is within Open32. I'm quite sure that it's
    118              * not relocated during run, so we're pretty well off.
    119              */
    120             if (!libWin32kInit())
    121             {
    122                 rc = libWin32kSetEnvironment((PSZ)_O32_GetEnvironmentStrings(), 0, 0);
    123                 if (rc)
    124                 {
    125                     dprintf(("KERNEL32: initterm: libWin32kSetEnvironment failed with rc=%d\n", rc));
    126                 }
    127             }
    128 
    129             loadNr = globLoadNr++;
    130 
    131             strcpy(kernel32Path, OSLibGetDllName(hModule));
    132             char *endofpath = strrchr(kernel32Path, '\\');
    133             *(endofpath+1) = 0;
    134             dprintf(("kernel32 init %s %s (%x) Win32k - %s", __DATE__, __TIME__, DLLENTRYPOINT_NAME,
    135                      libWin32kInstalled() ? "Installed" : "Not Installed"));
    13694            ctordtorInit();
    13795
    13896            CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    139 
    140             OpenPrivateLogFiles();
    141 
    142             if (InitializeSharedHeap() == FALSE)
    143                 return 0UL;
    144 
    145             if (InitializeCodeHeap() == FALSE)
    146                 return 0UL;
    147 
    148             PROFILE_LoadOdinIni();
    149             dllHandle = RegisterLxDll(hModule, 0, (PVOID)&_Resource_PEResTab);
    150             if (dllHandle == 0)
    151                 return 0UL;
    152 
    153             //SvL: Kernel32 is a special case; pe.exe loads it, so increase
    154             //     the reference count here
    155             Win32DllBase *module = Win32DllBase::findModule(dllHandle);
    156             if (module)
    157             {
    158                 module->AddRef();
    159                 module->DisableUnload();
    160             }
    16197
    16298            /*******************************************************************/
     
    169105                return 0UL;
    170106
    171             /* knut: check for high memory support */
    172             rc = DosQuerySysInfo(QSV_VIRTUALADDRESSLIMIT, QSV_VIRTUALADDRESSLIMIT, &ulSysinfo, sizeof(ulSysinfo));
    173             if (rc == 0 && ulSysinfo > 512)   //VirtualAddresslimit is in MB
    174             {
    175                 flAllocMem = PAG_ANY;      // high memory support. Let's use it!
    176                 ulMaxAddr = ulSysinfo * (1024*1024);
    177                 OSLibInitWSeBFileIO();
    178             if (PROFILE_GetOdinIniInt(ODINSYSTEM_SECTION, HIGHMEM_KEY, 1) == 0) {
    179                     dprintf(("WARNING: OS/2 kernel supports high memory, but support is DISABLED because of HIGHMEM odin.ini key"));
    180                     flAllocMem = 0;
    181                 }
    182             }
    183             else
    184                 flAllocMem = 0;        // no high memory support
    185 
    186             OSLibDosSetInitialMaxFileHandles(ODIN_DEFAULT_MAX_FILEHANDLES);
    187 
    188             //SvL: Do it here instead of during the exe object creation
    189             //(std handles can be used in win32 dll initialization routines
    190             HMInitialize();             /* store standard handles within HandleManager */
    191             InitDirectories();      //Must be done before InitializeTIB (which loads NTDLL -> USER32)
    192             InitializeTIB(TRUE);        //Must be done after HMInitialize!
    193             RegisterDevices();
    194             Win32DllBase::setDefaultRenaming();
    195             rc = DosQuerySysInfo(QSV_NUMPROCESSORS, QSV_NUMPROCESSORS, &ulSysinfo, sizeof(ulSysinfo));
    196             if (rc != 0)
    197                 ulSysinfo = 1;
    198 
    199107            rc = DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_VERSION_MINOR, version, sizeof(version));
    200108            if(rc == 0){
     
    203111                }
    204112            }
    205 
    206             /* Setup codepage info */
    207             CODEPAGE_Init();
    208 
    209             InitSystemInfo(ulSysinfo);
    210             //Set up environment as found in NT
    211             InitEnvironment(ulSysinfo);
    212 
    213             //InitDynamicRegistry creates/changes keys that may change (i.e. odin.ini
    214             //keys that affect windows version)
    215             InitDynamicRegistry();
     113           
     114            rc = inittermKernel32(hModule, ulFlag);
    216115            break;
    217116        }
    218117
    219118        case 1 :
    220             if (dllHandle)
    221             {
    222                 UnregisterLxDll(dllHandle);
    223             }
     119            rc = inittermKernel32(hModule, ulFlag);
    224120            break;
    225121
     
    237133static void APIENTRY cleanup(ULONG ulReason)
    238134{
    239     dprintf(("kernel32 exit %d\n", ulReason));
    240     //Flush and delete all open memory mapped files
    241     Win32MemMap::deleteAll();
    242     WinExe = NULL;
     135    cleanupKernel32(ulReason);
    243136
    244     WriteOutProfiles();
    245     DestroyTIB();
    246     DestroySharedHeap();
    247     DestroyCodeHeap();
    248137    ctordtorTerm();
    249 
    250     //NOTE: Must be done after DestroyTIB
    251     ClosePrivateLogFiles();
    252     CloseLogFile();
    253 
    254     /*
    255      * Terminate win32k library.
    256      */
    257     libWin32kSetEnvironment(NULL, 0, 0);
    258     libWin32kTerm();
    259138
    260139    DosExitList(EXLST_EXIT, cleanup);
  • trunk/src/kernel32/kernel32.mak

    r6060 r6375  
    1 # $Id: kernel32.mak,v 1.7 2001-06-21 21:07:54 sandervl Exp $
     1# $Id: kernel32.mak,v 1.8 2001-07-20 15:33:30 sandervl Exp $
    22
    33#
     
    2020# Overrides.
    2121#
    22 ##CDEFINES    = $(CDEFINES) -DUSE_OS2SEMAPHORES
     22##CDEFINES    = $(CDEFINES) -DTEST_BUILTIN
    2323
    2424
     
    6666$(OBJDIR)\vsemaphore.obj \
    6767$(OBJDIR)\initterm.obj \
     68$(OBJDIR)\initkernel32.obj \
    6869$(OBJDIR)\handlemanager.obj \
    6970$(OBJDIR)\environ.obj \
     
    138139LIBS = \
    139140$(ODIN32_LIB)/$(ODINCRT).lib \
     141##$(ODIN32_LIB)\wgss.lib \
    140142$(ODIN32_LIB)\PMWINX.LIB \
    141143$(ODIN32_LIB)\LIBULS.LIB \
  • trunk/src/kernel32/time.cpp

    r5818 r6375  
    1 /* $Id: time.cpp,v 1.15 2001-05-28 14:47:49 phaller Exp $ */
     1/* $Id: time.cpp,v 1.16 2001-07-20 15:33:30 sandervl Exp $ */
    22
    33/*
     
    191191  return O32_SetSystemTime(arg1);
    192192}
    193 
    194 /***********************************************************************
    195  *           WPRINTF_ParseFormatA
    196  *
    197  * Parse a format specification. A format specification has the form:
    198  *
    199  * [-][#][0][width][.precision]type
    200  *
    201  * Return value is the length of the format specification in characters.
    202  */
    203 static INT WPRINTF_ParseFormatA( LPCSTR format, WPRINTF_FORMAT *res )
    204 {
    205     LPCSTR p = format;
    206 
    207     res->flags = 0;
    208     res->width = 0;
    209     res->precision = 0;
    210     if (*p == '-') { res->flags |= WPRINTF_LEFTALIGN; p++; }
    211     if (*p == '#') { res->flags |= WPRINTF_PREFIX_HEX; p++; }
    212     if (*p == '0') { res->flags |= WPRINTF_ZEROPAD; p++; }
    213     while ((*p >= '0') && (*p <= '9'))  /* width field */
    214     {
    215         res->width = res->width * 10 + *p - '0';
    216         p++;
    217     }
    218     if (*p == '.')  /* precision field */
    219     {
    220         p++;
    221         while ((*p >= '0') && (*p <= '9'))
    222         {
    223             res->precision = res->precision * 10 + *p - '0';
    224             p++;
    225         }
    226     }
    227     if (*p == 'l') { res->flags |= WPRINTF_LONG; p++; }
    228     else if (*p == 'h') { res->flags |= WPRINTF_SHORT; p++; }
    229     else if (*p == 'w') { res->flags |= WPRINTF_WIDE; p++; }
    230     switch(*p)
    231     {
    232     case 'c':
    233         res->type = (res->flags & WPRINTF_LONG) ? WPR_WCHAR : WPR_CHAR;
    234         break;
    235     case 'C':
    236         res->type = (res->flags & WPRINTF_SHORT) ? WPR_CHAR : WPR_WCHAR;
    237         break;
    238     case 'd':
    239     case 'i':
    240         res->type = WPR_SIGNED;
    241         break;
    242     case 's':
    243         res->type = (res->flags & (WPRINTF_LONG |WPRINTF_WIDE))
    244                     ? WPR_WSTRING : WPR_STRING;
    245         break;
    246     case 'S':
    247         res->type = (res->flags & (WPRINTF_SHORT|WPRINTF_WIDE))
    248                     ? WPR_STRING : WPR_WSTRING;
    249         break;
    250     case 'u':
    251         res->type = WPR_UNSIGNED;
    252         break;
    253     case 'X':
    254         res->flags |= WPRINTF_UPPER_HEX;
    255         /* fall through */
    256     case 'x':
    257         res->type = WPR_HEXA;
    258         break;
    259     default: /* unknown format char */
    260         res->type = WPR_UNKNOWN;
    261         p--;  /* print format as normal char */
    262         break;
    263     }
    264     return (INT)(p - format) + 1;
    265 }
    266 
    267 
    268 /***********************************************************************
    269  *           WPRINTF_ParseFormatW
    270  *
    271  * Parse a format specification. A format specification has the form:
    272  *
    273  * [-][#][0][width][.precision]type
    274  *
    275  * Return value is the length of the format specification in characters.
    276  */
    277 static INT WPRINTF_ParseFormatW( LPCWSTR format, WPRINTF_FORMAT *res )
    278 {
    279     LPCWSTR p = format;
    280 
    281     res->flags = 0;
    282     res->width = 0;
    283     res->precision = 0;
    284     if (*p == '-') { res->flags |= WPRINTF_LEFTALIGN; p++; }
    285     if (*p == '#') { res->flags |= WPRINTF_PREFIX_HEX; p++; }
    286     if (*p == '0') { res->flags |= WPRINTF_ZEROPAD; p++; }
    287     while ((*p >= '0') && (*p <= '9'))  /* width field */
    288     {
    289         res->width = res->width * 10 + *p - '0';
    290         p++;
    291     }
    292     if (*p == '.')  /* precision field */
    293     {
    294         p++;
    295         while ((*p >= '0') && (*p <= '9'))
    296         {
    297             res->precision = res->precision * 10 + *p - '0';
    298             p++;
    299         }
    300     }
    301     if (*p == 'l') { res->flags |= WPRINTF_LONG; p++; }
    302     else if (*p == 'h') { res->flags |= WPRINTF_SHORT; p++; }
    303     else if (*p == 'w') { res->flags |= WPRINTF_WIDE; p++; }
    304     switch((CHAR)*p)
    305     {
    306     case 'c':
    307         res->type = (res->flags & WPRINTF_SHORT) ? WPR_CHAR : WPR_WCHAR;
    308         break;
    309     case 'C':
    310         res->type = (res->flags & WPRINTF_LONG) ? WPR_WCHAR : WPR_CHAR;
    311         break;
    312     case 'd':
    313     case 'i':
    314         res->type = WPR_SIGNED;
    315         break;
    316     case 's':
    317         res->type = ((res->flags & WPRINTF_SHORT) && !(res->flags & WPRINTF_WIDE)) ? WPR_STRING : WPR_WSTRING;
    318         break;
    319     case 'S':
    320         res->type = (res->flags & (WPRINTF_LONG|WPRINTF_WIDE)) ? WPR_WSTRING : WPR_STRING;
    321         break;
    322     case 'u':
    323         res->type = WPR_UNSIGNED;
    324         break;
    325     case 'X':
    326         res->flags |= WPRINTF_UPPER_HEX;
    327         /* fall through */
    328     case 'x':
    329         res->type = WPR_HEXA;
    330         break;
    331     default:
    332         res->type = WPR_UNKNOWN;
    333         p--;  /* print format as normal char */
    334         break;
    335     }
    336     return (INT)(p - format) + 1;
    337 }
    338 
    339 
    340 /***********************************************************************
    341  *           WPRINTF_GetLen
    342  */
    343 static UINT WPRINTF_GetLen( WPRINTF_FORMAT *format, WPRINTF_DATA *arg,
    344                               LPSTR number, UINT maxlen )
    345 {
    346     UINT len;
    347 
    348     if (format->flags & WPRINTF_LEFTALIGN) format->flags &= ~WPRINTF_ZEROPAD;
    349     if (format->width > maxlen) format->width = maxlen;
    350     switch(format->type)
    351     {
    352     case WPR_CHAR:
    353     case WPR_WCHAR:
    354         return (format->precision = 1);
    355     case WPR_STRING:
    356         if (!arg->lpcstr_view) arg->lpcstr_view = null_stringA;
    357         for (len = 0; !format->precision || (len < format->precision); len++)
    358             if (!*(arg->lpcstr_view + len)) break;
    359         if (len > maxlen) len = maxlen;
    360         return (format->precision = len);
    361     case WPR_WSTRING:
    362         if (!arg->lpcwstr_view) arg->lpcwstr_view = null_stringW;
    363         for (len = 0; !format->precision || (len < format->precision); len++)
    364             if (!*(arg->lpcwstr_view + len)) break;
    365         if (len > maxlen) len = maxlen;
    366         return (format->precision = len);
    367     case WPR_SIGNED:
    368         len = sprintf( number, "%d", arg->int_view );
    369         break;
    370     case WPR_UNSIGNED:
    371         len = sprintf( number, "%u", (UINT)arg->int_view );
    372         break;
    373     case WPR_HEXA:
    374         len = sprintf( number,
    375                         (format->flags & WPRINTF_UPPER_HEX) ? "%X" : "%x",
    376                         (UINT)arg->int_view);
    377         if (format->flags & WPRINTF_PREFIX_HEX) len += 2;
    378         break;
    379     default:
    380         return 0;
    381     }
    382     if (len > maxlen) len = maxlen;
    383     if (format->precision < len) format->precision = len;
    384     if (format->precision > maxlen) format->precision = maxlen;
    385     if ((format->flags & WPRINTF_ZEROPAD) && (format->width > format->precision))
    386         format->precision = format->width;
    387     return len;
    388 }
    389 
    390 /***********************************************************************
    391  *           WPRINTF_ExtractVAPtr (Not a Windows API)
    392  */
    393 static WPRINTF_DATA WPRINTF_ExtractVAPtr( WPRINTF_FORMAT *format, va_list* args )
    394 {
    395     WPRINTF_DATA result;
    396     switch(format->type)
    397     {
    398         case WPR_WCHAR:
    399             result.wchar_view = va_arg( *args, WCHAR );     break;
    400         case WPR_CHAR:
    401             result.char_view = va_arg( *args, CHAR );       break;
    402         case WPR_STRING:
    403             result.lpcstr_view = va_arg( *args, LPCSTR);    break;
    404         case WPR_WSTRING:
    405             result.lpcwstr_view = va_arg( *args, LPCWSTR);  break;
    406         case WPR_HEXA:
    407         case WPR_SIGNED:
    408         case WPR_UNSIGNED:
    409             result.int_view = va_arg( *args, INT );         break;
    410         default:
    411             result.wchar_view = 0;                          break;
    412     }
    413     return result;
    414 }
    415 
    416 /***********************************************************************
    417  *           wvsnprintfA   (Not a Windows API)
    418  */
    419 INT WINAPI wvsnprintfA( LPSTR buffer, UINT maxlen, LPCSTR spec,
    420                             va_list args )
    421 {
    422     WPRINTF_FORMAT format;
    423     LPSTR p = buffer;
    424     UINT i, len;
    425     CHAR number[20];
    426     WPRINTF_DATA argData;
    427 
    428     while (*spec && (maxlen > 1))
    429     {
    430         if (*spec != '%') { *p++ = *spec++; maxlen--; continue; }
    431         spec++;
    432         if (*spec == '%') { *p++ = *spec++; maxlen--; continue; }
    433         spec += WPRINTF_ParseFormatA( spec, &format );
    434         argData = WPRINTF_ExtractVAPtr( &format, &args );
    435         len = WPRINTF_GetLen( &format, &argData, number, maxlen - 1 );
    436         if (!(format.flags & WPRINTF_LEFTALIGN))
    437             for (i = format.precision; i < format.width; i++, maxlen--)
    438                 *p++ = ' ';
    439         switch(format.type)
    440         {
    441         case WPR_WCHAR:
    442             *p = argData.wchar_view;
    443             if (*p != '\0') p++;
    444             else if (format.width > 1) *p++ = ' ';
    445             else len = 0;
    446             break;
    447         case WPR_CHAR:
    448             *p = argData.char_view;
    449             if (*p != '\0') p++;
    450             else if (format.width > 1) *p++ = ' ';
    451             else len = 0;
    452             break;
    453         case WPR_STRING:
    454             memcpy( p, argData.lpcstr_view, len );
    455             p += len;
    456             break;
    457         case WPR_WSTRING:
    458             {
    459                 LPCWSTR ptr = argData.lpcwstr_view;
    460                 for (i = 0; i < len; i++) *p++ = (CHAR)*ptr++;
    461             }
    462             break;
    463         case WPR_HEXA:
    464             if ((format.flags & WPRINTF_PREFIX_HEX) && (maxlen > 3))
    465             {
    466                 *p++ = '0';
    467                 *p++ = (format.flags & WPRINTF_UPPER_HEX) ? 'X' : 'x';
    468                 maxlen -= 2;
    469                 len -= 2;
    470                 format.precision -= 2;
    471                 format.width -= 2;
    472             }
    473             /* fall through */
    474         case WPR_SIGNED:
    475         case WPR_UNSIGNED:
    476             for (i = len; i < format.precision; i++, maxlen--) *p++ = '0';
    477             memcpy( p, number, len );
    478             p += len;
    479             /* Go to the next arg */
    480             break;
    481         case WPR_UNKNOWN:
    482             continue;
    483         }
    484         if (format.flags & WPRINTF_LEFTALIGN)
    485             for (i = format.precision; i < format.width; i++, maxlen--)
    486                 *p++ = ' ';
    487         maxlen -= len;
    488     }
    489     *p = 0;
    490     //TRACE("%s\n",buffer);
    491     return (maxlen > 1) ? (INT)(p - buffer) : -1;
    492 }
    493 
    494 
    495 /***********************************************************************
    496  *           wvsnprintfW   (Not a Windows API)
    497  */
    498 INT WINAPI wvsnprintfW( LPWSTR buffer, UINT maxlen, LPCWSTR spec,
    499                             va_list args )
    500 {
    501     WPRINTF_FORMAT format;
    502     LPWSTR p = buffer;
    503     UINT i, len;
    504     CHAR number[20];
    505 
    506     while (*spec && (maxlen > 1))
    507     {
    508         if (*spec != '%') { *p++ = *spec++; maxlen--; continue; }
    509         spec++;
    510         if (*spec == '%') { *p++ = *spec++; maxlen--; continue; }
    511         spec += WPRINTF_ParseFormatW( spec, &format );
    512         len = WPRINTF_GetLen( &format, (WPRINTF_DATA*)args, number, maxlen - 1 );
    513         if (!(format.flags & WPRINTF_LEFTALIGN))
    514             for (i = format.precision; i < format.width; i++, maxlen--)
    515                 *p++ = ' ';
    516         switch(format.type)
    517         {
    518         case WPR_WCHAR:
    519             *p = va_arg( args, WCHAR );
    520             if (*p != '\0') p++;
    521             else if (format.width > 1) *p++ = ' ';
    522             else len = 0;
    523             break;
    524         case WPR_CHAR:
    525             *p = (WCHAR)va_arg( args, CHAR );
    526             if (*p != '\0') p++;
    527             else if (format.width > 1) *p++ = ' ';
    528             else len = 0;
    529             break;
    530         case WPR_STRING:
    531             {
    532                 LPCSTR ptr = va_arg( args, LPCSTR );
    533                 for (i = 0; i < len; i++) *p++ = (WCHAR)*ptr++;
    534             }
    535             break;
    536         case WPR_WSTRING:
    537             if (len) memcpy( p, va_arg( args, LPCWSTR ), len * sizeof(WCHAR) );
    538             p += len;
    539             break;
    540         case WPR_HEXA:
    541             if ((format.flags & WPRINTF_PREFIX_HEX) && (maxlen > 3))
    542             {
    543                 *p++ = '0';
    544                 *p++ = (format.flags & WPRINTF_UPPER_HEX) ? 'X' : 'x';
    545                 maxlen -= 2;
    546                 len -= 2;
    547                 format.precision -= 2;
    548                 format.width -= 2;
    549             }
    550             /* fall through */
    551         case WPR_SIGNED:
    552         case WPR_UNSIGNED:
    553             for (i = len; i < format.precision; i++, maxlen--) *p++ = '0';
    554             for (i = 0; i < len; i++) *p++ = (WCHAR)number[i];
    555             (void)va_arg( args, INT ); /* Go to the next arg */
    556             break;
    557         case WPR_UNKNOWN:
    558             continue;
    559         }
    560         if (format.flags & WPRINTF_LEFTALIGN)
    561             for (i = format.precision; i < format.width; i++, maxlen--)
    562                 *p++ = ' ';
    563         maxlen -= len;
    564     }
    565     *p = 0;
    566     return (maxlen > 1) ? (INT)(p - buffer) : -1;
    567 }
    568 
    569 /***********************************************************************
    570  *           wsnprintfA   (Not a Windows API)
    571  */
    572 INT WINAPIV wsnprintfA( LPSTR buffer, UINT maxlen, LPCSTR spec, ... )
    573 {
    574     va_list valist;
    575     INT res;
    576 
    577     va_start( valist, spec );
    578     res = wvsnprintfA( buffer, maxlen, spec, valist );
    579     va_end( valist );
    580     return res;
    581 }
    582 
    583 /***********************************************************************
    584  *           wsnprintfW   (Not a Windows API)
    585  */
    586 INT WINAPIV wsnprintfW( LPWSTR buffer, UINT maxlen, LPCWSTR spec, ... )
    587 {
    588     va_list valist;
    589     INT res;
    590 
    591     va_start( valist, spec );
    592     res = wvsnprintfW( buffer, maxlen, spec, valist );
    593     va_end( valist );
    594     return res;
    595 }
    596 
    597 
    598193/*****************************************************************************
    599194 * Name      : DWORD GetSystemTimeAsFileTime
  • trunk/src/ole32/initterm.cpp

    r5602 r6375  
    3636#include <initdll.h>
    3737
    38 extern "C" {
    39  //Win32 resource table (produced by wrc)
    40  extern DWORD _Resource_PEResTab;
    41 }
    42 static HMODULE dllHandle = 0;
    43 
    44 BOOL WINAPI OLE32_DllEntryPoint(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad);
    45 //******************************************************************************
    46 //******************************************************************************
    47 BOOL WINAPI LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
    48 {
    49    switch (fdwReason)
    50    {
    51    case DLL_PROCESS_ATTACH:
    52    case DLL_THREAD_ATTACH:
    53    case DLL_THREAD_DETACH:
    54         return OLE32_DllEntryPoint(hinstDLL, fdwReason, fImpLoad);
    55 
    56    case DLL_PROCESS_DETACH:
    57         OLE32_DllEntryPoint(hinstDLL, fdwReason, fImpLoad);
    58         ctordtorTerm();
    59         return TRUE;
    60    }
    61    return FALSE;
    62 }
    6338/****************************************************************************/
    6439/* _DLL_InitTerm is the function that gets called by the operating system   */
     
    8863         CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    8964
    90          dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab);
    91          if(dllHandle == 0)
    92                 return 0UL;
    93 
    94          break;
     65         return inittermOle32(hModule, ulFlag);
    9566      }
    9667      case 1 :
    97          if(dllHandle) {
    98                 UnregisterLxDll(dllHandle);
    99          }
     68         inittermOle32(hModule, ulFlag);
     69         ctordtorTerm();
    10070         break;
    10171
  • trunk/src/ole32/ole32.mak

    r5929 r6375  
    1 # $Id: ole32.mak,v 1.11 2001-06-08 06:50:52 sandervl Exp $
     1# $Id: ole32.mak,v 1.12 2001-07-20 15:38:24 sandervl Exp $
    22
    33#
     
    4949$(OBJDIR)\ole32_main.obj \
    5050$(OBJDIR)\initterm.obj \
     51$(OBJDIR)\initole32.obj \
    5152$(OBJDIR)\stg_bigblockfile.obj \
    5253$(OBJDIR)\stg_stream.obj \
  • trunk/src/rpcrt4/initterm.cpp

    r5135 r6375  
    3737#include <initdll.h>
    3838
    39 extern "C" {
    40  //Win32 resource table (produced by wrc)
    41  extern DWORD _Resource_PEResTab;
    42 }
    43 static HMODULE dllHandle = 0;
    44 
    45 //******************************************************************************
    46 //******************************************************************************
    47 BOOL WINAPI LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
    48 {
    49    switch (fdwReason)
    50    {
    51    case DLL_PROCESS_ATTACH:
    52         return TRUE;
    53 
    54    case DLL_THREAD_ATTACH:
    55    case DLL_THREAD_DETACH:
    56         return TRUE;
    57 
    58    case DLL_PROCESS_DETACH:
    59         ctordtorTerm();
    60         return TRUE;
    61    }
    62    return FALSE;
    63 }
    6439/****************************************************************************/
    6540/* _DLL_InitTerm is the function that gets called by the operating system   */
     
    8863         CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    8964
    90          dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab);
    91          if(dllHandle == 0)
    92                 return 0UL;
     65         return inittermRpcrt4(hModule, ulFlag);
    9366
    94          //SvL: Must be done here as the socket calls trash FS!
    95          /* Init the Uuid subsystem */
    96          UuidInit();
    97 
     67      case 1 :
     68         inittermRpcrt4(hModule, ulFlag);
     69         ctordtorTerm();
    9870         break;
    9971
    100       case 1 :
    101          if(dllHandle) {
    102                 UnregisterLxDll(dllHandle);
    103          }
    104          break;
    10572      default  :
    10673         return 0UL;
  • trunk/src/rpcrt4/makefile

    r4719 r6375  
    1 # $Id: makefile,v 1.5 2000-12-02 23:57:29 bird Exp $
     1# $Id: makefile,v 1.6 2001-07-20 15:38:52 sandervl Exp $
    22
    33#
     
    2020$(OBJDIR)\binding.obj \
    2121$(OBJDIR)\initterm.obj \
     22$(OBJDIR)\initrpcrt4.obj \
    2223$(OBJDIR)\mgmt.obj \
    2324$(OBJDIR)\rpcrt4rsrc.obj \
  • trunk/src/shell32/initterm.cpp

    r5309 r6375  
    3636#include <initdll.h>
    3737
    38 extern "C" {
    39  //Win32 resource table (produced by wrc)
    40  extern DWORD _Resource_PEResTab;
    41 }
    42 static HMODULE dllHandle = 0;
    43 
    44 BOOL WINAPI Shell32LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad);
    45 
    46 //******************************************************************************
    47 //******************************************************************************
    48 BOOL WINAPI OdinLibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
    49 {
    50  BOOL ret;
    51 
    52    switch (fdwReason)
    53    {
    54    case DLL_PROCESS_ATTACH:
    55    case DLL_THREAD_ATTACH:
    56    case DLL_THREAD_DETACH:
    57         return Shell32LibMain(hinstDLL, fdwReason, fImpLoad);
    58 
    59    case DLL_PROCESS_DETACH:
    60         ret = Shell32LibMain(hinstDLL, fdwReason, fImpLoad);
    61         ctordtorTerm();
    62         return ret;
    63    }
    64    return FALSE;
    65 }
    6638/****************************************************************************/
    6739/* _DLL_InitTerm is the function that gets called by the operating system   */
     
    8860
    8961         CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
     62         return inittermShell32(hModule, ulFlag);
    9063
    91          dllHandle = RegisterLxDll(hModule, OdinLibMain, (PVOID)&_Resource_PEResTab,
    92                                    SHELL32_MAJORIMAGE_VERSION, SHELL32_MINORIMAGE_VERSION,
    93                                    IMAGE_SUBSYSTEM_WINDOWS_GUI);
    94          if(dllHandle == 0)
    95                 return 0UL;
    96 
    97          break;
    9864      case 1 :
    99          if(dllHandle) {
    100                 UnregisterLxDll(dllHandle);
    101          }
     65         inittermShell32(hModule, ulFlag);
     66         ctordtorTerm();
    10267         break;
    10368      default  :
  • trunk/src/shell32/makefile

    r5618 r6375  
    1 # $Id: makefile,v 1.33 2001-04-28 13:33:44 sandervl Exp $
     1# $Id: makefile,v 1.34 2001-07-20 15:37:22 sandervl Exp $
    22
    33#
     
    2525OBJS = \
    2626$(OBJDIR)\initterm.obj \
     27$(OBJDIR)\initshell32.obj \
    2728$(OBJDIR)\brsfolder.obj \
    2829$(OBJDIR)\changenotify.obj \
  • trunk/src/shlwapi/makefile

    r6251 r6375  
    1 # $Id: makefile,v 1.22 2001-07-08 11:12:49 sandervl Exp $
     1# $Id: makefile,v 1.23 2001-07-20 15:37:52 sandervl Exp $
    22
    33#
     
    2525$(OBJDIR)\reg.obj \
    2626$(OBJDIR)\regstream.obj \
     27$(OBJDIR)\shlwapiguid.obj \
    2728$(OBJDIR)\pathcpp.obj \
    2829$(OBJDIR)\path.obj \
  • trunk/src/shlwapi/regstream.c

    r4081 r6375  
    1414#define ICOM_CINTERFACE 1
    1515#define CINTERFACE 1
    16 #define INITGUID
    1716
    1817#endif
  • trunk/src/shlwapi/shlwapi.cpp

    r5472 r6375  
    1 /* $Id: shlwapi.cpp,v 1.10 2001-04-04 09:05:50 sandervl Exp $ */
     1/* $Id: shlwapi.cpp,v 1.11 2001-07-20 15:37:52 sandervl Exp $ */
    22
    33/*
     
    7070}
    7171
    72 
     72#if 0
    7373// ----------------------------------------------------------------------
    7474// WINE_StringFromCLSID
     
    124124    return strLen;  // Num CHARACTERS including 0 terminator
    125125}
    126 
     126#endif
    127127
    128128/*****************************************************************************
  • trunk/src/shlwapi/string_odin.cpp

    r5618 r6375  
    1  /* $Id: string_odin.cpp,v 1.2 2001-04-28 13:32:21 sandervl Exp $ */
     1 /* $Id: string_odin.cpp,v 1.3 2001-07-20 15:37:53 sandervl Exp $ */
    22
    33/*
     
    9595
    9696
     97#if 0
    9798/*************************************************************************
    9899 * OleStrToStrN                                 [SHELL32.78]
     
    180181        return StrToOleStrA (lpWideCharStr, (LPCSTR)lpString);
    181182}
    182 
     183#endif
    183184
    184185
  • trunk/src/user32/Makefile

    r6254 r6375  
    1 # $Id: Makefile,v 1.87 2001-07-08 15:51:41 sandervl Exp $
     1# $Id: Makefile,v 1.88 2001-07-20 15:34:15 sandervl Exp $
    22
    33#
     
    4040$(OBJDIR)\char.obj \
    4141$(OBJDIR)\initterm.obj \
     42$(OBJDIR)\inituser32.obj \
    4243$(OBJDIR)\uitools.obj \
    4344$(OBJDIR)\unknown.obj \
  • trunk/src/user32/USER32.DEF

    r6149 r6375  
    1 ; $Id: USER32.DEF,v 1.60 2001-07-03 13:23:31 sandervl Exp $
     1; $Id: USER32.DEF,v 1.61 2001-07-20 15:34:15 sandervl Exp $
    22
    33LIBRARY USER32 INITINSTANCE TERMINSTANCE
     
    671671
    672672    _wvsnprintfA@16                                              @2010 NONAME
     673;Export for MSACM32
     674    _wsnprintfA                                                  @2100 NONAME
    673675
    674676    _KEYBOARD_Enable@4                                           @2011 NONAME
  • trunk/src/user32/dbglocal.cpp

    r3679 r6375  
    1 /* $Id: dbglocal.cpp,v 1.6 2000-06-08 18:10:09 sandervl Exp $ */
     1/* $Id: dbglocal.cpp,v 1.7 2001-07-20 15:34:15 sandervl Exp $ */
    22
    33/*
     
    1616#ifdef DEBUG
    1717
    18 USHORT DbgEnabled[DBG_MAXFILES] = {0};
    19 USHORT DbgEnabledLvl2[DBG_MAXFILES] = {0};
     18USHORT DbgEnabledUSER32[DBG_MAXFILES] = {0};
     19USHORT DbgEnabledLvl2USER32[DBG_MAXFILES] = {0};
    2020
    21 char  *DbgFileNames[DBG_MAXFILES] =
     21static char  *DbgFileNames[DBG_MAXFILES] =
    2222{
    2323"user32",
     
    9292//******************************************************************************
    9393//******************************************************************************
    94 void ParseLogStatus()
     94void ParseLogStatusUSER32()
    9595{
    9696 char *envvar = getenv(DBG_ENVNAME);
     
    100100
    101101    for(i=0;i<DBG_MAXFILES;i++) {
    102         DbgEnabled[i] = 1;
     102        DbgEnabledUSER32[i] = 1;
    103103    }
    104104
     
    108108                if(*(dbgvar-1) == '-') {
    109109                    for(i=0;i<DBG_MAXFILES;i++) {
    110                         DbgEnabled[i] = 0;
     110                        DbgEnabledUSER32[i] = 0;
    111111                    }
    112112                }
     
    116116                if(dbgvar) {
    117117                    if(*(dbgvar-1) == '-') {
    118                             DbgEnabled[i] = 0;
     118                            DbgEnabledUSER32[i] = 0;
    119119                    }
    120120                    else   
    121121                    if(*(dbgvar-1) == '+') {
    122                         DbgEnabled[i] = 1;
     122                        DbgEnabledUSER32[i] = 1;
    123123                    }
    124124                }
     
    130130                if(*(dbgvar-1) == '+') {
    131131                    for(i=0;i<DBG_MAXFILES;i++) {
    132                         DbgEnabledLvl2[i] = 1;
     132                        DbgEnabledLvl2USER32[i] = 1;
    133133                    }
    134134                }
     
    138138                if(dbgvar) {
    139139                    if(*(dbgvar-1) == '-') {
    140                             DbgEnabledLvl2[i] = 0;
     140                            DbgEnabledLvl2USER32[i] = 0;
    141141                    }
    142142                    else   
    143143                    if(*(dbgvar-1) == '+') {
    144                         DbgEnabledLvl2[i] = 1;
     144                        DbgEnabledLvl2USER32[i] = 1;
    145145                    }
    146146                }
  • trunk/src/user32/dbglocal.h

    r3679 r6375  
    1 /* $Id: dbglocal.h,v 1.5 2000-06-08 18:10:09 sandervl Exp $ */
     1/* $Id: dbglocal.h,v 1.6 2001-07-20 15:34:15 sandervl Exp $ */
    22
    33/*
     
    1515#ifdef DEBUG
    1616//Parses environment variable for selective enabling/disabling of logging
    17 void ParseLogStatus();
     17void ParseLogStatusUSER32();
    1818
    1919#define DBG_ENVNAME        "dbg_user32"
     
    9090#define DBG_MAXFILES             68
    9191
    92 extern USHORT DbgEnabled[DBG_MAXFILES];
    93 extern USHORT DbgEnabledLvl2[DBG_MAXFILES];
     92extern USHORT DbgEnabledUSER32[DBG_MAXFILES];
     93extern USHORT DbgEnabledLvl2USER32[DBG_MAXFILES];
    9494
    9595#ifdef dprintf
     
    9797#endif
    9898
    99 #define dprintf(a)      if(DbgEnabled[DBG_LOCALLOG] == 1) WriteLog a
     99#define dprintf(a)      if(DbgEnabledUSER32[DBG_LOCALLOG] == 1) WriteLog a
    100100
    101101#ifdef dprintf2
     
    103103#endif
    104104
    105 #define dprintf2(a)     if(DbgEnabledLvl2[DBG_LOCALLOG] == 1) WriteLog a
     105#define dprintf2(a)     if(DbgEnabledLvl2USER32[DBG_LOCALLOG] == 1) WriteLog a
    106106
    107107#else
    108108
    109 #define ParseLogStatus()
     109#define ParseLogStatusUSER32()
    110110
    111111#endif //DEBUG
  • trunk/src/user32/dc.cpp

    r5935 r6375  
    1 /* $Id: dc.cpp,v 1.109 2001-06-09 14:50:16 sandervl Exp $ */
     1/* $Id: dc.cpp,v 1.110 2001-07-20 15:34:16 sandervl Exp $ */
    22
    33/*
     
    7676
    7777#ifdef DEBUG
    78 #define dprintfRegion(a,b,c) if(DbgEnabledLvl2[DBG_LOCALLOG] == 1) dprintfRegion1(a,b,c)
     78#define dprintfRegion(a,b,c) if(DbgEnabledLvl2USER32[DBG_LOCALLOG] == 1) dprintfRegion1(a,b,c)
    7979
    8080void dprintfRegion1(HPS hps, HWND hWnd, HRGN hrgnClip)
  • trunk/src/user32/gen_object.cpp

    r5964 r6375  
    1 /* $Id: gen_object.cpp,v 1.11 2001-06-11 14:37:46 sandervl Exp $ */
     1/* $Id: gen_object.cpp,v 1.12 2001-07-20 15:34:16 sandervl Exp $ */
    22/*
    33 * Generic Object Class for OS/2
     
    9191LONG GenericObject::addRef()
    9292{
    93   dprintf2(("addRef %x -> refcount %x", this, refCount+1));
     93////  dprintf2(("addRef %x -> refcount %x", this, refCount+1));
    9494  return InterlockedIncrement(&refCount);
    9595}
     
    9999LONG GenericObject::release()
    100100{
    101   dprintf2(("release %x -> refcount %x", this, refCount-1));
     101////  dprintf2(("release %x -> refcount %x", this, refCount-1));
    102102#ifdef DEBUG
    103103  if(refCount-1 < 0) {
  • trunk/src/user32/initterm.cpp

    r6339 r6375  
    3737#include <winconst.h>
    3838#include <odinlx.h>
    39 #include <spy.h>
    40 #include <monitor.h>
    41 #include "pmwindow.h"
    42 #include "win32wdesktop.h"
    43 #include "syscolor.h"
    4439#include "initterm.h"
    4540#include <exitlist.h>
     
    5752static void APIENTRY cleanup(ULONG reason);
    5853
    59 extern "C" {
    60  //Win32 resource table (produced by wrc)
    61  extern DWORD _Resource_PEResTab;
    62 }
    63 DWORD hInstanceUser32 = 0;
    6454BOOL  fVersionWarp3 = FALSE;
    6555
     
    8777      case 0 :
    8878         ctordtorInit();
    89          ParseLogStatus();
    90 
    9179         CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    92 
    93          hInstanceUser32 = RegisterLxDll(hModule, 0, (PVOID)&_Resource_PEResTab,
    94                                          USER32_MAJORIMAGE_VERSION, USER32_MINORIMAGE_VERSION,
    95                                          IMAGE_SUBSYSTEM_WINDOWS_GUI);
    96          if(hInstanceUser32 == 0)
    97                 return 0UL;
    98 
    99          dprintf(("user32 init %s %s (%x)", __DATE__, __TIME__, DLLENTRYPOINT_NAME));
    10080
    10181         rc = DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_VERSION_MINOR, version, sizeof(version));
     
    11595                return 0UL;
    11696
    117          //SvL: Try to start communication with our message spy queue server
    118          InitSpyQueue();
    119 
    120          //SvL: Init win32 PM classes
    121          if(InitPM() == FALSE) {
    122                 return 0UL;
    123          }
    124 
    125          //SvL: 18-7-'98, Register system window classes (button, listbox etc etc)
    126          //CB: register internal classes
    127          RegisterSystemClasses(hModule);
    128 
    129          //CB: initialize PM monitor driver
    130          MONITOR_Initialize(&MONITOR_PrimaryMonitor);
    131 
     97         rc = inittermUser32(hModule, ulFlag);
    13298         break;
    13399      case 1 :
    134          if(hInstanceUser32) {
    135                 UnregisterLxDll(hInstanceUser32);
    136          }
     100         rc = inittermUser32(hModule, ulFlag);
    137101         break;
    138102      default  :
     
    148112static void APIENTRY cleanup(ULONG ulReason)
    149113{
    150    dprintf(("user32 exit\n"));
    151 //SvL: Causes PM hangs on some (a lot?) machines. Reason unknown.
    152 ////   RestoreCursor();
    153    DestroyDesktopWindow();
    154    Win32BaseWindow::DestroyAll();
    155    UnregisterSystemClasses();
    156    Win32WndClass::DestroyAll();
    157    MONITOR_Finalize(&MONITOR_PrimaryMonitor);
    158    SYSCOLOR_Save();
    159    CloseSpyQueue();
     114   cleanupUser32(ulReason);
    160115   ctordtorTerm();
    161    dprintf(("user32 exit done\n"));
    162116
    163117   DosExitList(EXLST_EXIT, cleanup);
  • trunk/src/user32/msgbox.c

    r3153 r6375  
    1 /* $Id: msgbox.c,v 1.3 2000-03-18 16:13:37 cbratschi Exp $ */
     1/* $Id: msgbox.c,v 1.4 2001-07-20 15:34:16 sandervl Exp $ */
    22/*
    33 * Message boxes (based on Wine code)
     
    366366}
    367367
     368#ifndef __WIN32OS2__
    368369/**************************************************************************
    369370 *           FatalAppExit32A   (KERNEL32.108)
     
    386387    ExitProcess(0);
    387388}
     389#endif
    388390
    389391/*****************************************************************************
  • trunk/src/user32/win32wbase.cpp

    r6317 r6375  
    1 /* $Id: win32wbase.cpp,v 1.276 2001-07-13 14:31:15 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.277 2001-07-20 15:34:17 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    38373837//    else    return hwnd;    //OS/2 window handle
    38383838}
     3839#ifdef DEBUG
     3840LONG  Win32BaseWindow::addRef()
     3841{
     3842    dprintf2(("addRef %x %d", getWindowHandle(), getRefCount()+1));
     3843    return GenericObject::addRef();
     3844}
     3845//******************************************************************************
     3846//******************************************************************************
     3847LONG  Win32BaseWindow::release(char *function, int line)
     3848{
     3849    dprintf2(("release %s %d %x %d", function, line, getWindowHandle(), getRefCount()-1));
     3850    return GenericObject::release();
     3851}
     3852#endif
    38393853//******************************************************************************
    38403854//******************************************************************************
  • trunk/src/user32/win32wbase.h

    r6169 r6375  
    1 /* $Id: win32wbase.h,v 1.123 2001-07-04 17:46:05 sandervl Exp $ */
     1/* $Id: win32wbase.h,v 1.124 2001-07-20 15:34:18 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    3636#define CheckMagicDword(a)      (a==WIN32PM_MAGIC)
    3737
     38#ifdef DEBUG
     39#define RELEASE_WNDOBJ(a)       { a->release(__FUNCTION__, __LINE__); a = NULL; }
     40#else
    3841#define RELEASE_WNDOBJ(a)       { a->release(); a = NULL; }
     42#endif
    3943
    4044typedef struct {
     
    328332         INT    enumPropsExW(PROPENUMPROCEXW func, LPARAM lParam);
    329333
     334#ifdef DEBUG
     335         LONG addRef();
     336         LONG release(char *function = __FUNCTION__, int line = __LINE__ );
     337#endif
     338
    330339//Locates window in linked list and increases reference count (if found)
    331340//Window object must be unreferenced after usage
  • trunk/src/user32/wsprintf.cpp

    r5271 r6375  
    645645    return ( res == -1 ) ? 1024 : res;
    646646}
     647
     648/***********************************************************************
     649 *           wsnprintfA   (Not a Windows API)
     650 */
     651INT WINAPIV wsnprintfA( LPSTR buffer, UINT maxlen, LPCSTR spec, ... )
     652{
     653    va_list valist;
     654    INT res;
     655
     656    va_start( valist, spec );
     657    res = wvsnprintfA( buffer, maxlen, spec, valist );
     658    va_end( valist );
     659    return res;
     660}
     661
     662/***********************************************************************
     663 *           wsnprintfW   (Not a Windows API)
     664 */
     665INT WINAPIV wsnprintfW( LPWSTR buffer, UINT maxlen, LPCWSTR spec, ... )
     666{
     667    va_list valist;
     668    INT res;
     669
     670    va_start( valist, spec );
     671    res = wvsnprintfW( buffer, maxlen, spec, valist );
     672    va_end( valist );
     673    return res;
     674}
  • trunk/src/winmm/dbglocal.cpp

    r5358 r6375  
    1 /* $Id: dbglocal.cpp,v 1.5 2001-03-23 16:23:42 sandervl Exp $ */
     1/* $Id: dbglocal.cpp,v 1.6 2001-07-20 15:35:00 sandervl Exp $ */
    22
    33/*
     
    1616#include "dbglocal.h"
    1717
    18 USHORT DbgEnabled[DBG_MAXFILES] = {0};
    19 USHORT DbgEnabledLvl2[DBG_MAXFILES] = {0};
     18USHORT DbgEnabledWINMM[DBG_MAXFILES] = {0};
     19USHORT DbgEnabledLvl2WINMM[DBG_MAXFILES] = {0};
    2020
    21 char  *DbgFileNames[DBG_MAXFILES] =
     21static char  *DbgFileNames[DBG_MAXFILES] =
    2222{
    2323"os2timer",
     
    4747//******************************************************************************
    4848//******************************************************************************
    49 void ParseLogStatus()
     49void ParseLogStatusWINMM()
    5050{
    5151 char *envvar = getenv(DBG_ENVNAME);
     
    5555
    5656    for(i=0;i<DBG_MAXFILES;i++) {
    57         DbgEnabled[i] = 1;
     57        DbgEnabledWINMM[i] = 1;
    5858    }
    5959
     
    6565        if(*(dbgvar-1) == '-') {
    6666            for(i=0;i<DBG_MAXFILES;i++) {
    67                 DbgEnabled[i] = 0;
     67                DbgEnabledWINMM[i] = 0;
    6868            }
    6969        }
     
    7373        if(dbgvar) {
    7474            if(*(dbgvar-1) == '-') {
    75                     DbgEnabled[i] = 0;
     75                    DbgEnabledWINMM[i] = 0;
    7676            }
    7777            else   
    7878            if(*(dbgvar-1) == '+') {
    79                 DbgEnabled[i] = 1;
     79                DbgEnabledWINMM[i] = 1;
    8080            }
    8181        }
     
    8686                if(*(dbgvar-1) == '+') {
    8787                    for(i=0;i<DBG_MAXFILES;i++) {
    88                         DbgEnabledLvl2[i] = 1;
     88                        DbgEnabledLvl2WINMM[i] = 1;
    8989                    }
    9090                }
     
    9494                if(dbgvar) {
    9595                    if(*(dbgvar-1) == '-') {
    96                             DbgEnabledLvl2[i] = 0;
     96                            DbgEnabledLvl2WINMM[i] = 0;
    9797                    }
    9898                    else   
    9999                    if(*(dbgvar-1) == '+') {
    100                         DbgEnabledLvl2[i] = 1;
     100                        DbgEnabledLvl2WINMM[i] = 1;
    101101                    }
    102102                }
  • trunk/src/winmm/dbglocal.h

    r5358 r6375  
    1 /* $Id: dbglocal.h,v 1.5 2001-03-23 16:23:42 sandervl Exp $ */
     1/* $Id: dbglocal.h,v 1.6 2001-07-20 15:35:00 sandervl Exp $ */
    22
    33/*
     
    1515#ifdef DEBUG
    1616//Parses environment variable for selective enabling/disabling of logging
    17 void ParseLogStatus();
     17void ParseLogStatusWINMM();
    1818
    1919#define DBG_ENVNAME        "dbg_winmm"
     
    4545#define DBG_MAXFILES        23
    4646
    47 extern USHORT DbgEnabled[DBG_MAXFILES];
    48 extern USHORT DbgEnabledLvl2[DBG_MAXFILES];
     47extern USHORT DbgEnabledWINMM[DBG_MAXFILES];
     48extern USHORT DbgEnabledLvl2WINMM[DBG_MAXFILES];
    4949
    5050#ifdef dprintf
     
    5252#endif
    5353
    54 #define dprintf(a)      if(DbgEnabled[DBG_LOCALLOG] == 1) WriteLog a
     54#define dprintf(a)      if(DbgEnabledWINMM[DBG_LOCALLOG] == 1) WriteLog a
    5555
    5656#ifdef dprintf2
     
    5858#endif
    5959
    60 #define dprintf2(a)     if(DbgEnabledLvl2[DBG_LOCALLOG] == 1) WriteLog a
     60#define dprintf2(a)     if(DbgEnabledLvl2WINMM[DBG_LOCALLOG] == 1) WriteLog a
    6161
    6262#else
    6363
    64 #define ParseLogStatus()
     64#define ParseLogStatusWINMM()
    6565
    6666#endif //DEBUG
  • trunk/src/winmm/initterm.cpp

    r5873 r6375  
    4646#include "dbglocal.h"
    4747
    48 BOOL MULTIMEDIA_MciInit(void);
    49 BOOL MULTIMEDIA_CreateIData(HINSTANCE hinstDLL);
    50 void MULTIMEDIA_DeleteIData(void);
    51 
    52 extern "C" {
    53 void IRTMidiShutdown();  // IRTMidi shutdown routine
    54 
    55  //Win32 resource table (produced by wrc)
    56  extern DWORD _Resource_PEResTab;
    57 }
    58 static HMODULE dllHandle = 0;
    59 
    60 //******************************************************************************
    61 //******************************************************************************
    62 BOOL WINAPI OdinLibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
    63 {
    64   static BOOL           bInitDone = FALSE;
    65 
    66   switch (fdwReason)
    67     {
    68     case DLL_PROCESS_ATTACH:
    69     {
    70         if (!MULTIMEDIA_CreateIData(hinstDLL))
    71             return FALSE;
    72 
    73         if (!bInitDone) { /* to be done only once */
    74             if (!MULTIMEDIA_MciInit() /*|| !MMDRV_Init() */ ) {
    75                 MULTIMEDIA_DeleteIData();
    76                 return FALSE;
    77             }
    78             bInitDone = TRUE;
    79         }
    80         DWORD dwVolume;
    81 
    82         dwVolume = PROFILE_GetOdinIniInt(WINMM_SECTION, DEFVOL_KEY, 100);
    83         dwVolume = (dwVolume*0xFFFF)/100;
    84         dwVolume = (dwVolume << 16) | dwVolume;
    85         WaveOut::setDefaultVolume(dwVolume);
    86         return TRUE;
    87    }
    88 
    89    case DLL_THREAD_ATTACH:
    90    case DLL_THREAD_DETACH:
    91         return TRUE;
    92 
    93    case DLL_PROCESS_DETACH:
    94         MULTIMEDIA_DeleteIData();
    95         auxOS2Close(); /* SvL: Close aux device if necessary */
    96         IRTMidiShutdown;  /* JT: Shutdown RT Midi subsystem, if running. */
    97         ctordtorTerm();
    98         return TRUE;
    99    }
    100    return FALSE;
    101 }
    10248/****************************************************************************/
    10349/* _DLL_InitTerm is the function that gets called by the operating system   */
     
    12167        ctordtorInit();
    12268
    123         ParseLogStatus();
    124 
    12569        CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    126         dllHandle = RegisterLxDll(hModule, OdinLibMain, (PVOID)&_Resource_PEResTab);
    127         if(dllHandle == 0)
    128             return 0UL;/* Error */
    129 
    130         dprintf(("winmm init %s %s (%x)", __DATE__, __TIME__, DLLENTRYPOINT_NAME));
    131         break;
     70        return inittermWinmm(hModule, ulFlag);
    13271    case 1 :
    133         auxOS2Close(); /* SvL: Close aux device if necessary */
    134         if(dllHandle) {
    135             UnregisterLxDll(dllHandle);
    136         }
     72        inittermWinmm(hModule, ulFlag);
     73        ctordtorTerm();
    13774        break;
    13875    default  :
  • trunk/src/winmm/mmio.cpp

    r3932 r6375  
    1 /* $Id: mmio.cpp,v 1.7 2000-08-02 17:18:33 bird Exp $ */
     1/* $Id: mmio.cpp,v 1.8 2001-07-20 15:35:00 sandervl Exp $ */
    22/*
    33 * MMIO functions
     
    115115                        LONG count;
    116116
     117#ifdef __WIN32OS2__
     118                        count = _lwrite((HFILE)lpmmioinfo->adwInfo[0], pch, cch);
     119#else
    117120                        count = _hwrite((HFILE)lpmmioinfo->adwInfo[0], pch, cch);
     121#endif
    118122                        if (count != -1)
    119123                                lpmmioinfo->lDiskOffset += count;
  • trunk/src/winmm/winmm.mak

    r5359 r6375  
    1 # $Id: winmm.mak,v 1.3 2001-03-23 16:23:47 sandervl Exp $
     1# $Id: winmm.mak,v 1.4 2001-07-20 15:35:01 sandervl Exp $
    22
    33#
     
    4040$(OBJDIR)\midistrm.obj \
    4141$(OBJDIR)\initterm.obj \
     42$(OBJDIR)\initwinmm.obj \
    4243$(OBJDIR)\mci.obj \
    4344$(OBJDIR)\joy.obj \
  • trunk/src/wsock32/dbglocal.cpp

    r3229 r6375  
    1 /* $Id: dbglocal.cpp,v 1.4 2000-03-24 19:28:05 sandervl Exp $ */
     1/* $Id: dbglocal.cpp,v 1.5 2001-07-20 15:41:04 sandervl Exp $ */
    22
    33/*
     
    1616#ifdef DEBUG
    1717
    18 USHORT DbgEnabled[DBG_MAXFILES];
    19 char  *DbgFileNames[DBG_MAXFILES] =
     18USHORT DbgEnabledWSOCK32[DBG_MAXFILES] = {0};
     19USHORT DbgEnabledLvl2WSOCK32[DBG_MAXFILES] = {0};
     20
     21static char  *DbgFileNames[DBG_MAXFILES] =
    2022{
    2123"initterm",
     
    2931//******************************************************************************
    3032//******************************************************************************
    31 void ParseLogStatus()
     33void ParseLogStatusWSOCK32()
    3234{
    3335 char *envvar = getenv(DBG_ENVNAME);
     36 char *envvar2= getenv(DBG_ENVNAME_LVL2);
    3437 char *dbgvar;
    3538 int   i;
    3639
    3740    for(i=0;i<DBG_MAXFILES;i++) {
    38         DbgEnabled[i] = 1;
     41        DbgEnabledWSOCK32[i] = 1;
    3942    }
    4043
     
    4649        if(*(dbgvar-1) == '-') {
    4750            for(i=0;i<DBG_MAXFILES;i++) {
    48                 DbgEnabled[i] = 0;
     51                DbgEnabledWSOCK32[i] = 0;
    4952            }
    5053        }
     
    5457        if(dbgvar) {
    5558            if(*(dbgvar-1) == '-') {
    56                     DbgEnabled[i] = 0;
     59                    DbgEnabledWSOCK32[i] = 0;
    5760            }
    5861            else   
    5962            if(*(dbgvar-1) == '+') {
    60                 DbgEnabled[i] = 1;
     63                DbgEnabledWSOCK32[i] = 1;
    6164            }
     65        }
     66    }
     67    if(envvar2) {
     68        dbgvar = strstr(envvar2, "dll");
     69        if(dbgvar) {
     70                if(*(dbgvar-1) == '+') {
     71                    for(i=0;i<DBG_MAXFILES;i++) {
     72                        DbgEnabledLvl2WSOCK32[i] = 1;
     73                    }
     74                }
     75        }
     76        for(i=0;i<DBG_MAXFILES;i++) {
     77                dbgvar = strstr(envvar2, DbgFileNames[i]);
     78                if(dbgvar) {
     79                    if(*(dbgvar-1) == '-') {
     80                            DbgEnabledLvl2WSOCK32[i] = 0;
     81                    }
     82                    else   
     83                    if(*(dbgvar-1) == '+') {
     84                        DbgEnabledLvl2WSOCK32[i] = 1;
     85                    }
     86                }
    6287        }
    6388    }
  • trunk/src/wsock32/dbglocal.h

    r3229 r6375  
    1 /* $Id: dbglocal.h,v 1.4 2000-03-24 19:28:05 sandervl Exp $ */
     1/* $Id: dbglocal.h,v 1.5 2001-07-20 15:41:04 sandervl Exp $ */
    22
    33/*
     
    1515#ifdef DEBUG
    1616//Parses environment variable for selective enabling/disabling of logging
    17 void ParseLogStatus();
     17void ParseLogStatusWSOCK32();
    1818
    1919#define DBG_ENVNAME        "dbg_wsock32"
     20#define DBG_ENVNAME_LVL2   "dbg_wsock32_lvl2"
    2021
    2122#define DBG_initterm       0
     
    2829#define DBG_MAXFILES       7
    2930
    30 extern USHORT DbgEnabled[DBG_MAXFILES];
     31extern USHORT DbgEnabledWSOCK32[DBG_MAXFILES];
     32extern USHORT DbgEnabledLvl2WSOCK32[DBG_MAXFILES];
    3133
    3234#ifdef dprintf
     
    3436#endif
    3537
    36 #define dprintf(a)      if(DbgEnabled[DBG_LOCALLOG] == 1) WriteLog a
     38#define dprintf(a)      if(DbgEnabledWSOCK32[DBG_LOCALLOG] == 1) WriteLog a
     39
     40#ifdef dprintf2
     41#undef dprintf2
     42#endif
     43
     44#define dprintf2(a)     if(DbgEnabledLvl2WSOCK32[DBG_LOCALLOG] == 1) WriteLog a
    3745
    3846#else
    3947
    40 #define ParseLogStatus()
     48#define ParseLogStatusWSOCK32()
    4149
    4250#endif //DEBUG
  • trunk/src/wsock32/initterm.cpp

    r5309 r6375  
    3939#include "dbglocal.h"
    4040
    41 extern "C" {
    42  //Win32 resource table (produced by wrc)
    43  extern DWORD _Resource_PEResTab;
    44 }
    45 static HMODULE dllHandle = 0;
    46 
    47 //******************************************************************************
    48 //******************************************************************************
    49 BOOL WINAPI OdinLibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
    50 {
    51    switch (fdwReason)
    52    {
    53    case DLL_PROCESS_ATTACH:
    54         return TRUE;
    55 
    56    case DLL_THREAD_ATTACH:
    57    case DLL_THREAD_DETACH:
    58         return TRUE;
    59 
    60    case DLL_PROCESS_DETACH:
    61         ctordtorTerm();
    62         return TRUE;
    63    }
    64    return FALSE;
    65 }
    6641/****************************************************************************/
    6742/* _DLL_InitTerm is the function that gets called by the operating system   */
     
    8762         ctordtorInit();
    8863
    89          ParseLogStatus();
    90 
    9164         CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    9265
    93          dllHandle = RegisterLxDll(hModule, OdinLibMain, (PVOID)&_Resource_PEResTab);
    94          if(dllHandle == 0)
    95                 return 0UL;
     66         return inittermWsock32(hModule, ulFlag);
    9667
     68      case 1 :
     69         inittermWsock32(hModule, ulFlag);
     70         ctordtorTerm();
    9771         break;
    98       case 1 :
    99          if(dllHandle) {
    100                 UnregisterLxDll(dllHandle);
    101          }
    102          break;
     72
    10373      default  :
    10474         return 0UL;
  • trunk/src/wsock32/makefile

    r6196 r6375  
    1 # $Id: makefile,v 1.30 2001-07-07 10:44:09 achimha Exp $
     1# $Id: makefile,v 1.31 2001-07-20 15:41:05 sandervl Exp $
    22
    33#
     
    3030$(OBJDIR)\wsock32rsrc.obj \
    3131$(OBJDIR)\initterm.obj \
     32$(OBJDIR)\initwsock32.obj \
    3233$(OBJDIR)\asyncapi.obj \
    3334$(OBJDIR)\asyncthread.obj \
Note: See TracChangeset for help on using the changeset viewer.