start: Build with msvcrt.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-05-01 10:40:12 +02:00
parent 32d7838da7
commit dae088939b
2 changed files with 15 additions and 14 deletions

View file

@ -1,7 +1,8 @@
MODULE = start.exe MODULE = start.exe
APPMODE = -mconsole -municode
IMPORTS = shell32 user32 IMPORTS = shell32 user32
EXTRADLLFLAGS = -mconsole -municode -mno-cygwin
C_SRCS = start.c C_SRCS = start.c
RC_SRCS = start.rc RC_SRCS = start.rc

View file

@ -26,7 +26,6 @@
#include <shlobj.h> #include <shlobj.h>
#include <shellapi.h> #include <shellapi.h>
#include <wine/unicode.h>
#include <wine/debug.h> #include <wine/debug.h>
#include "resources.h" #include "resources.h"
@ -40,7 +39,7 @@ static void output(const WCHAR *message)
{ {
DWORD count; DWORD count;
DWORD res; DWORD res;
int wlen = strlenW(message); int wlen = lstrlenW(message);
if (!wlen) return; if (!wlen) return;
@ -131,8 +130,8 @@ static WCHAR *build_args( int argc, WCHAR **argvW )
for (i = 0; i < argc; i++ ) for (i = 0; i < argc; i++ )
{ {
wlen += strlenW(argvW[i]) + 1; wlen += lstrlenW(argvW[i]) + 1;
if (strchrW(argvW[i], ' ')) if (wcschr(argvW[i], ' '))
wlen += 2; wlen += 2;
} }
ret = HeapAlloc( GetProcessHeap(), 0, wlen*sizeof(WCHAR) ); ret = HeapAlloc( GetProcessHeap(), 0, wlen*sizeof(WCHAR) );
@ -140,10 +139,10 @@ static WCHAR *build_args( int argc, WCHAR **argvW )
for (i = 0, p = ret; i < argc; i++ ) for (i = 0, p = ret; i < argc; i++ )
{ {
if (strchrW(argvW[i], ' ')) if (wcschr(argvW[i], ' '))
p += sprintfW(p, FormatQuotesW, argvW[i]); p += swprintf(p, wlen - (p - ret), FormatQuotesW, argvW[i]);
else else
p += sprintfW(p, FormatW, argvW[i]); p += swprintf(p, wlen - (p - ret), FormatW, argvW[i]);
} }
return ret; return ret;
} }
@ -154,7 +153,7 @@ static WCHAR *get_parent_dir(WCHAR* path)
WCHAR *result; WCHAR *result;
int len; int len;
last_slash = strrchrW( path, '\\' ); last_slash = wcsrchr( path, '\\' );
if (last_slash == NULL) if (last_slash == NULL)
len = 1; len = 1;
else else
@ -376,8 +375,9 @@ int wmain (int argc, WCHAR *argv[])
/* explorer on windows always quotes the filename when running a binary on windows (see bug 5224) so we have to use CreateProcessW in this case */ /* explorer on windows always quotes the filename when running a binary on windows (see bug 5224) so we have to use CreateProcessW in this case */
commandline = HeapAlloc(GetProcessHeap(), 0, (strlenW(sei.lpFile)+3+strlenW(sei.lpParameters))*sizeof(WCHAR)); commandline = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(sei.lpFile)+3+lstrlenW(sei.lpParameters))*sizeof(WCHAR));
sprintfW(commandline, commandlineformat, sei.lpFile, sei.lpParameters); swprintf(commandline, lstrlenW(sei.lpFile) + 3 + lstrlenW(sei.lpParameters),
commandlineformat, sei.lpFile, sei.lpParameters);
ZeroMemory(&startup_info, sizeof(startup_info)); ZeroMemory(&startup_info, sizeof(startup_info));
startup_info.cb = sizeof(startup_info); startup_info.cb = sizeof(startup_info);
@ -419,14 +419,14 @@ int wmain (int argc, WCHAR *argv[])
fatal_string_error(STRING_EXECFAIL, ERROR_OUTOFMEMORY, sei.lpFile); fatal_string_error(STRING_EXECFAIL, ERROR_OUTOFMEMORY, sei.lpFile);
GetEnvironmentVariableW(pathextW, env, size); GetEnvironmentVariableW(pathextW, env, size);
filename_len = strlenW(filename); filename_len = lstrlenW(filename);
name = HeapAlloc(GetProcessHeap(), 0, (filename_len + size) * sizeof(WCHAR)); name = HeapAlloc(GetProcessHeap(), 0, (filename_len + size) * sizeof(WCHAR));
if (!name) if (!name)
fatal_string_error(STRING_EXECFAIL, ERROR_OUTOFMEMORY, sei.lpFile); fatal_string_error(STRING_EXECFAIL, ERROR_OUTOFMEMORY, sei.lpFile);
sei.lpFile = name; sei.lpFile = name;
start = env; start = env;
while ((ptr = strchrW(start, ';'))) while ((ptr = wcschr(start, ';')))
{ {
if (start == ptr) if (start == ptr)
{ {
@ -434,7 +434,7 @@ int wmain (int argc, WCHAR *argv[])
continue; continue;
} }
strcpyW(name, filename); lstrcpyW(name, filename);
memcpy(&name[filename_len], start, (ptr - start) * sizeof(WCHAR)); memcpy(&name[filename_len], start, (ptr - start) * sizeof(WCHAR));
name[filename_len + (ptr - start)] = 0; name[filename_len + (ptr - start)] = 0;