Ignore:
Timestamp:
Mar 16, 2004, 2:34:58 PM (21 years ago)
Author:
sandervl
Message:

init update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/initkernel32.cpp

    r9878 r10528  
    1 /* $Id: initkernel32.cpp,v 1.26 2003-02-28 11:32:27 sandervl Exp $
     1/* $Id: initkernel32.cpp,v 1.27 2004-03-16 13:34:23 sandervl Exp $
    22 *
    33 * KERNEL32 DLL entry point
     
    5959#include <process.h>
    6060#include <stats.h>
     61#include <heapshared.h>
    6162
    6263#define DBG_LOCALLOG    DBG_initterm
     
    131132            CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    132133
     134            /* knut: check for high memory support */
     135            rc = DosQuerySysInfo(QSV_VIRTUALADDRESSLIMIT, QSV_VIRTUALADDRESSLIMIT, &ulSysinfo, sizeof(ulSysinfo));
     136            if (rc == 0 && ulSysinfo > 512)   //VirtualAddresslimit is in MB
     137            {
     138                flAllocMem = PAG_ANY;      // high memory support. Let's use it!
     139                ulMaxAddr = ulSysinfo * (1024*1024);
     140            }
     141            else
     142                flAllocMem = 0;        // no high memory support
     143
    133144            dprintf(("kernel32 init %s %s (%x) Win32k - %s", __DATE__, __TIME__, inittermKernel32,
    134145                     libWin32kInstalled() ? "Installed" : "Not Installed"));
     
    139150            //(std handles can be used in win32 dll initialization routines
    140151            HMInitialize();             /* store standard handles within HandleManager */
    141 
    142             /* knut: check for high memory support */
    143             rc = DosQuerySysInfo(QSV_VIRTUALADDRESSLIMIT, QSV_VIRTUALADDRESSLIMIT, &ulSysinfo, sizeof(ulSysinfo));
    144             if (rc == 0 && ulSysinfo > 512)   //VirtualAddresslimit is in MB
    145             {
    146                 flAllocMem = PAG_ANY;      // high memory support. Let's use it!
    147                 ulMaxAddr = ulSysinfo * (1024*1024);
     152           
     153            // VP: Shared heap should be initialized before call to PROFILE_*
     154            // because they use a critical section which in turn uses smalloc
     155            // in debug build
     156            if (InitializeSharedHeap() == FALSE)
     157                return 0UL;
     158
     159            // VP: initialize profile internal data (critical section actually).
     160            // This was done in PROFILE_LoadOdinIni but PROFILE_GetOdinIniInt
     161            // is called earlier and this lead to a handle leak.
     162            PROFILE_Initialize();
     163
     164            if(flAllocMem == PAG_ANY) {
    148165                OSLibInitWSeBFileIO();
    149166                if (PROFILE_GetOdinIniInt(ODINSYSTEM_SECTION, HIGHMEM_KEY, 1) == 0) {
     
    152169                }
    153170            }
    154             else
    155                 flAllocMem = 0;        // no high memory support
    156 
    157             if (InitializeSharedHeap() == FALSE)
    158                 return 0UL;
    159171
    160172            if (InitializeCodeHeap() == FALSE)
     
    178190
    179191            OSLibDosSetInitialMaxFileHandles(ODIN_DEFAULT_MAX_FILEHANDLES);
     192
     193
     194#ifdef DEBUG
     195            {
     196            LPSTR WIN32API GetEnvironmentStringsA();
     197
     198            char *tmpenvnew = GetEnvironmentStringsA();
     199            dprintf(("Environment:"));
     200            while(*tmpenvnew) {
     201                dprintf(("%s", tmpenvnew));
     202                tmpenvnew += strlen(tmpenvnew)+1;
     203            }
     204            }
     205#endif
    180206
    181207            InitDirectories();          //Must be done before InitializeTIB (which loads NTDLL -> USER32)
Note: See TracChangeset for help on using the changeset viewer.