Changeset 10005 for trunk/src/msvcrt/exit.c
- Timestamp:
- Apr 10, 2003, 12:28:07 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/msvcrt/exit.c
r9633 r10005 23 23 #include "msvcrt/stdlib.h" 24 24 #include "mtdll.h" 25 25 #include "winuser.h" 26 #include <string.h> 26 27 #include "wine/debug.h" 27 28 … … 37 38 38 39 extern int MSVCRT_app_type; 40 extern char *MSVCRT__pgmptr; 41 42 static LPCSTR szMsgBoxTitle = "Wine C++ Runtime Library"; 39 43 40 44 /* INTERNAL: call atexit functions */ … … 92 96 void MSVCRT__exit(int exitcode) 93 97 { 94 TRACE(" (%d)\n", exitcode);98 TRACE("MSVCRT: _exit (%d)\n", exitcode); 95 99 ExitProcess(exitcode); 96 100 } 97 101 102 /* Print out an error message with an option to debug */ 103 static void DoMessageBox(LPCSTR lead, LPCSTR message) 104 { 105 MSGBOXPARAMSA msgbox; 106 char text[2048]; 107 INT ret; 108 109 _snprintf(text,sizeof(text),"%s\n\nProgram: %s\n%s\n\n" 110 "Press OK to exit the program, or Cancel to start the Wine debugger.\n ", 111 lead, MSVCRT__pgmptr, message); 112 113 msgbox.cbSize = sizeof(msgbox); 114 msgbox.hwndOwner = GetActiveWindow(); 115 msgbox.hInstance = 0; 116 msgbox.lpszText = text; 117 msgbox.lpszCaption = szMsgBoxTitle; 118 msgbox.dwStyle = MB_OKCANCEL|MB_ICONERROR; 119 msgbox.lpszIcon = NULL; 120 msgbox.dwContextHelpId = 0; 121 msgbox.lpfnMsgBoxCallback = NULL; 122 msgbox.dwLanguageId = LANG_NEUTRAL; 123 124 ret = MessageBoxIndirectA(&msgbox); 125 if (ret == IDCANCEL) 126 DebugBreak(); 127 } 128 98 129 /********************************************************************* 99 130 * _amsg_exit (MSVCRT.@) … … 101 132 void MSVCRT__amsg_exit(int errnum) 102 133 { 103 TRACE(" (%d)\n", errnum);134 TRACE("MSVCRT: _amsg_exit (%d)\n", errnum); 104 135 /* FIXME: text for the error number. */ 105 136 if (MSVCRT_app_type == 2) 106 137 { 107 /* FIXME: MsgBox */ 108 } 109 _cprintf("\nruntime error R60%d\n",errnum); 138 char text[32]; 139 sprintf(text, "Error: R60%d",errnum); 140 DoMessageBox("Runtime error!", text); 141 } 142 else 143 MSVCRT__cprintf("\nruntime error R60%d\n",errnum); 110 144 MSVCRT__exit(255); 111 145 } … … 116 150 void MSVCRT_abort(void) 117 151 { 118 TRACE(" (void)\n");152 TRACE("MSVCRT: _abort"); 119 153 if (MSVCRT_app_type == 2) 120 154 { 121 /* FIXME: MsgBox */ 122 } 123 _cputs("\nabnormal program termination\n"); 155 DoMessageBox("Runtime error!", "abnormal program termination"); 156 } 157 else 158 MSVCRT__cputs("\nabnormal program termination\n"); 124 159 MSVCRT__exit(3); 125 160 } … … 130 165 void MSVCRT__assert(const char* str, const char* file, unsigned int line) 131 166 { 132 TRACE(" (%s,%s,%d)\n",str,file,line);167 TRACE("MSVCRT: _assert (%s,%s,%d)\n",str,file,line); 133 168 if (MSVCRT_app_type == 2) 134 169 { 135 /* FIXME: MsgBox */ 136 } 137 _cprintf("Assertion failed: %s, file %s, line %d\n\n",str,file, line); 138 MSVCRT_abort(); 170 char text[2048]; 171 _snprintf(text, sizeof(text), "File: %s\nLine: %d\n\nEpression: \"%s\"", file, line, str); 172 DoMessageBox("Assertion failed!", text); 173 } 174 else 175 MSVCRT__cprintf("Assertion failed: %s, file %s, line %d\n\n",str, file, line); 176 MSVCRT__exit(3); 139 177 } 140 178 … … 144 182 void MSVCRT__c_exit(void) 145 183 { 146 TRACE(" (void)\n");184 TRACE("MSVCRT: _c_exit (void)\n"); 147 185 /* All cleanup is done on DLL detach; Return to caller */ 148 186 } … … 153 191 void MSVCRT__cexit(void) 154 192 { 155 TRACE(" (void)\n");193 TRACE("MSVCRT: _cexit (void)\n"); 156 194 /* All cleanup is done on DLL detach; Return to caller */ 157 195 } … … 160 198 * _onexit (MSVCRT.@) 161 199 */ 162 _onexit_t _onexit(_onexit_t func)163 { 164 TRACE(" (%p)\n",func);200 _onexit_t MSVCRT__onexit(_onexit_t func) 201 { 202 TRACE("MSVCRT: _onexit (%p)\n",func); 165 203 166 204 if (!func) … … 196 234 void MSVCRT_exit(int exitcode) 197 235 { 198 TRACE(" (%d)\n",exitcode);236 TRACE("MSVCRT: _exit (%d)\n",exitcode); 199 237 LOCK_EXIT; 200 238 __MSVCRT__call_atexit(); … … 208 246 int MSVCRT_atexit(void (*func)(void)) 209 247 { 210 TRACE(" (%p)\n", func);211 return _onexit((_onexit_t)func) == (_onexit_t)func ? 0 : -1;248 TRACE("MSVCRT: _atexit (%p)\n", func); 249 return MSVCRT__onexit((_onexit_t)func) == (_onexit_t)func ? 0 : -1; 212 250 } 213 251 … … 218 256 void _purecall(void) 219 257 { 220 TRACE(" (void)\n");258 TRACE("MSVCRT: _purecall (void)\n"); 221 259 MSVCRT__amsg_exit( 25 ); 222 260 }
Note:
See TracChangeset
for help on using the changeset viewer.