Changeset 21650 for trunk/src/kernel32/initkernel32.cpp
- Timestamp:
- Jun 23, 2011, 2:14:29 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/initkernel32.cpp
r21649 r21650 144 144 else fWin32k = TRUE; 145 145 } 146 strcpy(kernel32Path, OSLibGetDllName(hModule)); 146 147 char *kernel32Name = OSLibGetDllName(hModule); 148 if (!kernel32Name) 149 return 0; // failure 150 151 strcpy(kernel32Path, kernel32Name); 147 152 char *endofpath = strrchr(kernel32Path, '\\'); 148 153 *(endofpath+1) = 0; … … 167 172 //SvL: Do it here instead of during the exe object creation 168 173 //(std handles can be used in win32 dll initialization routines 169 HMInitialize(); /* store standard handles within HandleManager */ 174 if (HMInitialize() != NO_ERROR) 175 return 0; 170 176 171 177 // VP: Shared heap should be initialized before call to PROFILE_* 172 178 // because they use a critical section which in turn uses smalloc 173 179 // in debug build 174 if ( InitializeSharedHeap() == FALSE)175 return 0 UL;180 if (!InitializeSharedHeap()) 181 return 0; 176 182 177 183 // VP: initialize profile internal data (critical section actually). … … 188 194 } 189 195 190 if ( InitializeCodeHeap() == FALSE)191 return 0 UL;196 if (!InitializeCodeHeap()) 197 return 0; 192 198 193 199 InitializeMemMaps(); … … 196 202 dllHandle = RegisterLxDll(hModule, 0, (PVOID)&kernel32_PEResTab); 197 203 if (dllHandle == 0) 198 return 0 UL;204 return 0; 199 205 200 206 //SvL: Kernel32 is a special case; pe.exe loads it, so increase … … 209 215 OSLibDosSetInitialMaxFileHandles(ODIN_DEFAULT_MAX_FILEHANDLES); 210 216 211 212 217 #ifdef DEBUG 213 218 { 214 LPSTR WIN32API GetEnvironmentStringsA(); 215 216 char *tmpenvnew = GetEnvironmentStringsA(); 217 dprintf(("Environment:")); 218 while(*tmpenvnew) { 219 dprintf(("%s", tmpenvnew)); 220 tmpenvnew += strlen(tmpenvnew)+1; 221 } 222 } 223 #endif 224 225 InitDirectories(); //Must be done before InitializeTIB (which loads NTDLL -> USER32) 226 InitializeMainThread(); //Must be done after HMInitialize! 219 LPSTR WIN32API GetEnvironmentStringsA(); 220 221 char *tmpenvnew = GetEnvironmentStringsA(); 222 dprintf(("Environment:")); 223 while(*tmpenvnew) { 224 dprintf(("%s", tmpenvnew)); 225 tmpenvnew += strlen(tmpenvnew)+1; 226 } 227 } 228 #endif 229 230 // Must be done before InitializeTIB (which loads NTDLL -> USER32) 231 InitDirectories(); 232 233 // Must be done after HMInitialize! 234 if (InitializeMainThread() == NULL) 235 return 0; 236 227 237 RegisterDevices(); 228 238 Win32DllBase::setDefaultRenaming(); 229 rc = DosQuerySysInfo(QSV_NUMPROCESSORS, QSV_NUMPROCESSORS, &ulSysinfo, sizeof(ulSysinfo)); 239 240 rc = DosQuerySysInfo(QSV_NUMPROCESSORS, QSV_NUMPROCESSORS, 241 &ulSysinfo, sizeof(ulSysinfo)); 230 242 if (rc != 0) 231 243 ulSysinfo = 1; 232 244 233 / * Setup codepage info */245 // Setup codepage info 234 246 CODEPAGE_Init(); 235 247 236 if( IsDBCSEnv() && DosLoadModule( szModName, sizeof( szModName ), "OS2IM", &imHandle ) == 0 ) 237 DosQueryProcAddr( imHandle, 140, NULL, &pfnImSetMsgQueueProperty ); 248 if (IsDBCSEnv() && DosLoadModule(szModName, sizeof( szModName ), 249 "OS2IM", &imHandle) == 0) 250 DosQueryProcAddr(imHandle, 140, NULL, &pfnImSetMsgQueueProperty); 238 251 239 252 InitSystemInfo(ulSysinfo); 240 //Set up environment as found in NT 253 254 // Set up environment as found in NT 241 255 InitEnvironment(ulSysinfo); 242 256 243 // InitDynamicRegistry creates/changes keys that may change (i.e. odin.ini244 // keys that affect windows version)257 // InitDynamicRegistry creates/changes keys that may change (i.e. 258 // odin.ini keys that affect windows version) 245 259 InitDynamicRegistry(); 246 260 247 // Set the process affinity mask to the system affinity mask261 // Set the process affinity mask to the system affinity mask 248 262 DWORD dwProcessAffinityMask, dwSystemAffinityMask; 249 GetProcessAffinityMask(GetCurrentProcess(), &dwProcessAffinityMask, &dwSystemAffinityMask); 263 GetProcessAffinityMask(GetCurrentProcess(), &dwProcessAffinityMask, 264 &dwSystemAffinityMask); 250 265 SetProcessAffinityMask(GetCurrentProcess(), dwSystemAffinityMask); 251 266 252 //Set default paths for PE & NE loaders 253 InitLoaders(); 254 255 RasEntry (RAS_EVENT_Kernel32InitComplete, &dllHandle, sizeof (dllHandle)); 267 // Set default paths for PE & NE loaders 268 if (!InitLoaders()) 269 return 0; 270 271 RasEntry(RAS_EVENT_Kernel32InitComplete, 272 &dllHandle, sizeof (dllHandle)); 256 273 257 274 fInit = TRUE; … … 261 278 262 279 case 1: 280 263 281 if (dllHandle) 264 {265 282 UnregisterLxDll(dllHandle); 266 } 283 267 284 break; 268 285 … … 274 291 /* A non-zero value must be returned to indicate success. */ 275 292 /***********************************************************/ 276 return 1 UL;293 return 1; 277 294 } 278 295 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.