Index: base/applications/write/write.c =================================================================== --- base/applications/write/write.c (revision 56335) +++ base/applications/write/write.c (working copy) @@ -28,6 +28,14 @@ static const WCHAR SZ_BACKSLASH[] = {'\\',0}; static const WCHAR SZ_WORDPAD[] = {'w','o','r','d','p','a','d','.','e','x','e',0}; +void ErrorMsg(void) +{ + WCHAR tmpBuffer[MAX_PATH]; + + LoadStringW(GetModuleHandleW(NULL), IDS_FAILED, tmpBuffer, MAX_PATH); + MessageBoxW(NULL, tmpBuffer, NULL, MB_OK|MB_ICONERROR); +} + int CALLBACK wWinMain(HINSTANCE hInstance, HINSTANCE hOldInstance, LPWSTR szCmdParagraph, int res) { WCHAR path[MAX_PATH]; @@ -35,7 +43,10 @@ PROCESS_INFORMATION info; if (!GetSystemDirectoryW(path, MAX_PATH - 1 - lstrlenW(SZ_WORDPAD))) - goto failed; + { + ErrorMsg(); + return 1; + } if (path[lstrlenW(path) - 1] != '\\') lstrcatW(path, SZ_BACKSLASH); lstrcatW(path, SZ_WORDPAD); @@ -44,13 +55,12 @@ GetStartupInfoW(&stinf); if (!CreateProcessW(path, GetCommandLineW(), NULL, NULL, FALSE, 0, NULL, NULL, &stinf, &info)) - goto failed; + { + ErrorMsg(); + return 1; + } CloseHandle(info.hProcess); CloseHandle(info.hThread); + return 0; - -failed: - LoadStringW(GetModuleHandleW(NULL), IDS_FAILED, path, MAX_PATH); - MessageBoxW(NULL, path, NULL, MB_OK|MB_ICONERROR); - return 1; }