Changeset 6375 for trunk/src/kernel32/initterm.cpp
- Timestamp:
- Jul 20, 2001, 5:42:38 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/initterm.cpp
r6340 r6375 58 58 #include "dbglocal.h" 59 59 60 PVOID SYSTEM _O32_GetEnvironmentStrings( VOID );61 60 BOOL fVersionWarp3 = FALSE; 62 61 … … 68 67 /*-------------------------------------------------------------------*/ 69 68 static 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 Data77 #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;87 69 88 70 /****************************************************************************/ … … 110 92 case 0 : 111 93 { 112 ParseLogStatus();113 114 /*115 * Init the win32k library.116 * We will also need to tell win32k where the Odin32 environment is117 * located. Currently that is within Open32. I'm quite sure that it's118 * 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"));136 94 ctordtorInit(); 137 95 138 96 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 increase154 // the reference count here155 Win32DllBase *module = Win32DllBase::findModule(dllHandle);156 if (module)157 {158 module->AddRef();159 module->DisableUnload();160 }161 97 162 98 /*******************************************************************/ … … 169 105 return 0UL; 170 106 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 MB174 {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 else184 flAllocMem = 0; // no high memory support185 186 OSLibDosSetInitialMaxFileHandles(ODIN_DEFAULT_MAX_FILEHANDLES);187 188 //SvL: Do it here instead of during the exe object creation189 //(std handles can be used in win32 dll initialization routines190 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 199 107 rc = DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_VERSION_MINOR, version, sizeof(version)); 200 108 if(rc == 0){ … … 203 111 } 204 112 } 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); 216 115 break; 217 116 } 218 117 219 118 case 1 : 220 if (dllHandle) 221 { 222 UnregisterLxDll(dllHandle); 223 } 119 rc = inittermKernel32(hModule, ulFlag); 224 120 break; 225 121 … … 237 133 static void APIENTRY cleanup(ULONG ulReason) 238 134 { 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); 243 136 244 WriteOutProfiles();245 DestroyTIB();246 DestroySharedHeap();247 DestroyCodeHeap();248 137 ctordtorTerm(); 249 250 //NOTE: Must be done after DestroyTIB251 ClosePrivateLogFiles();252 CloseLogFile();253 254 /*255 * Terminate win32k library.256 */257 libWin32kSetEnvironment(NULL, 0, 0);258 libWin32kTerm();259 138 260 139 DosExitList(EXLST_EXIT, cleanup);
Note:
See TracChangeset
for help on using the changeset viewer.