winedbg: Also recognize 'rep ret' as a valid return insn for i386 as we did for x86_64.
[wine] / programs / cscript / main.c
1 /*
2  * CSCRIPT Implementation
3  *
4  * Copyright 2011 AndrĂ© Hentschel
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #define WIN32_LEAN_AND_MEAN
22 #include <stdio.h>
23 #include <windows.h>
24 #include <winbase.h>
25
26 #include <wine/debug.h>
27 #include <wine/unicode.h>
28
29 WINE_DEFAULT_DEBUG_CHANNEL(cscript);
30
31 int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cmdshow)
32 {
33     static const WCHAR wscriptW[] = {'\\','w','s','c','r','i','p','t','.','e','x','e',0};
34     static const WCHAR parbW[] = {' ','/','B',' ',0};
35     WCHAR app[MAX_PATH];
36     WCHAR cmd[MAX_PATH];
37     PROCESS_INFORMATION pi;
38     BOOL ret;
39     DWORD exitcode;
40     STARTUPINFOW si = { sizeof(si) };
41
42     WINE_FIXME("(%p %p %s %x) forwarding to wscript\n", hInst, hPrevInst, wine_dbgstr_w(cmdline), cmdshow);
43
44     GetSystemDirectoryW(app, MAX_PATH);
45     strcatW(app, wscriptW);
46     strcpyW(cmd, app);
47     strcatW(app, parbW);
48     strcatW(app, cmdline);
49
50     if (!CreateProcessW(app, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) return 1;
51     WaitForSingleObject( pi.hProcess, INFINITE );
52
53     ret = GetExitCodeProcess(pi.hProcess, &exitcode);
54     CloseHandle( pi.hProcess );
55     CloseHandle( pi.hThread );
56
57     if (ret)
58         return exitcode;
59     else
60         return 1;
61 }