Changeset 21654 for trunk/src/kernel32/initterm.cpp
- Timestamp:
- Jun 27, 2011, 2:27:23 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/initterm.cpp
r21649 r21654 157 157 loadNr = globLoadNr++; 158 158 159 BOOL WGSS_OK = FALSE; 160 159 161 if (DosQueryModuleHandleStrict("WGSS50", &hModule) == NO_ERROR) 162 { 160 163 if (_O32__DLL_InitTerm(hModule, 0) != 0) 164 { 165 WGSS_OK = TRUE; 166 161 167 if (DosQueryModuleHandleStrict("KERNEL32", &hModule) == NO_ERROR) 162 168 return DLLENTRYPOINT_NAME(hModule, 0); 169 else 170 ReportFatalDllInitError("KERNEL32"); 171 } 172 } 173 174 if (!WGSS_OK) 175 ReportFatalDllInitError("WGSS50"); 163 176 164 177 return 0; // failure … … 166 179 //****************************************************************************** 167 180 //****************************************************************************** 181 VOID APIENTRY ReportFatalDllInitError(CHAR *pszModName) 182 { 183 static const char msg1[] = 184 "Failed to initialize the "; 185 static const char msg2[] = 186 " library while starting \""; 187 static const char msg3[] = 188 "\".\n\r" 189 "\n\r" 190 "It is possible that there is not enough memory in the system to " 191 "run this application. Please close other applications and try " 192 "again. If the problem persists, please report the details by " 193 "creating a ticket at http://svn.netlabs.org/odin32/.\n\r"; 194 195 char msg[sizeof(msg1) + 8 + sizeof(msg2) + CCHMAXPATH + sizeof(msg3)]; 196 197 strcpy(msg, msg1); 198 strncat(msg, pszModName, 8); 199 strcat(msg, msg2); 200 201 PPIB ppib; 202 DosGetInfoBlocks(NULL, &ppib); 203 if (DosQueryModuleName(ppib->pib_hmte, CCHMAXPATH, 204 msg + strlen(msg)) != NO_ERROR) 205 strcat(msg, "<unknown executable>"); 206 strcat(msg, msg3); 207 208 BOOL haveHMQ = FALSE; 209 MQINFO mqinfo; 210 if (WinQueryQueueInfo(1 /*HMQ_CURRENT*/, &mqinfo, sizeof(mqinfo)) == FALSE) 211 { 212 // attempt to initialize PM and try again 213 HAB hab = WinInitialize(0); 214 if (hab) 215 { 216 HMQ hmq = WinCreateMsgQueue(hab, 0); 217 if (hmq) 218 haveHMQ = TRUE; 219 } 220 } 221 else 222 haveHMQ = TRUE; 223 224 WinMessageBox(HWND_DESKTOP, NULL, msg, "Odin: Fatal Error", 0, 225 MB_APPLMODAL | MB_MOVEABLE | MB_ERROR | MB_OK); 226 227 // duplicate the message to the console just in case (PM may be not 228 // available) 229 ULONG dummy; 230 DosWrite((HFILE)1, (PVOID)&msg, strlen(msg), &dummy); 231 } 232 233 //****************************************************************************** 234 //****************************************************************************** 235
Note:
See TracChangeset
for help on using the changeset viewer.