Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenwrite.c
Go to the documentation of this file.
00001 /* 00002 * Write.exe - this program only calls wordpad.exe 00003 * 00004 * Copyright 2007 by Mikolaj Zalewski 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00019 */ 00020 00021 #define WIN32_LEAN_AND_MEAN 00022 00023 #include <stdarg.h> 00024 00025 #include <windows.h> 00026 #include "resources.h" 00027 00028 static const WCHAR SZ_BACKSLASH[] = {'\\',0}; 00029 static const WCHAR SZ_WORDPAD[] = {'w','o','r','d','p','a','d','.','e','x','e',0}; 00030 00031 int CALLBACK wWinMain(HINSTANCE hInstance, HINSTANCE hOldInstance, LPWSTR szCmdParagraph, int res) 00032 { 00033 WCHAR path[MAX_PATH]; 00034 STARTUPINFOW stinf; 00035 PROCESS_INFORMATION info; 00036 00037 if (!GetSystemDirectoryW(path, MAX_PATH - 1 - lstrlenW(SZ_WORDPAD))) 00038 goto failed; 00039 if (path[lstrlenW(path) - 1] != '\\') 00040 lstrcatW(path, SZ_BACKSLASH); 00041 lstrcatW(path, SZ_WORDPAD); 00042 00043 stinf.cb = sizeof(STARTUPINFOW); 00044 GetStartupInfoW(&stinf); 00045 00046 if (!CreateProcessW(path, GetCommandLineW(), NULL, NULL, FALSE, 0, NULL, NULL, &stinf, &info)) 00047 goto failed; 00048 CloseHandle(info.hProcess); 00049 CloseHandle(info.hThread); 00050 return 0; 00051 00052 failed: 00053 LoadStringW(GetModuleHandleW(NULL), IDS_FAILED, path, MAX_PATH); 00054 MessageBoxW(NULL, path, NULL, MB_OK|MB_ICONERROR); 00055 return 1; 00056 } Generated on Sun May 27 2012 04:17:50 for ReactOS by
1.7.6.1
|