Commit 483de1a8 authored by Alexandre Julliard's avatar Alexandre Julliard

kernelbase: Build with msvcrt.

parent bdd48b41
MODULE = kernelbase.dll MODULE = kernelbase.dll
IMPORTS = uuid advapi32 IMPORTS = uuid advapi32 ntdll winecrt0 kernel32
EXTRADLLFLAGS = -nodefaultlibs -nostartfiles -mno-cygwin
C_SRCS = \ C_SRCS = \
main.c \ main.c \
......
...@@ -31,6 +31,16 @@ ...@@ -31,6 +31,16 @@
WINE_DEFAULT_DEBUG_CHANNEL(kernelbase); WINE_DEFAULT_DEBUG_CHANNEL(kernelbase);
/*************************************************************
* DllMainCRTStartup
*/
BOOL WINAPI DllMainCRTStartup( HANDLE inst, DWORD reason, LPVOID reserved )
{
return TRUE;
}
/*********************************************************************** /***********************************************************************
* AppPolicyGetProcessTerminationMethod (KERNELBASE.@) * AppPolicyGetProcessTerminationMethod (KERNELBASE.@)
*/ */
......
...@@ -26,10 +26,13 @@ ...@@ -26,10 +26,13 @@
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/exception.h" #include "wine/exception.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(string); WINE_DEFAULT_DEBUG_CHANNEL(string);
#define isxdigit(ch) (((ch) >= '0' && (ch) <= '9') || \
((ch) >= 'A' && (ch) <= 'F') || \
((ch) >= 'a' && (ch) <= 'f'))
static WORD get_char_type(WCHAR ch) static WORD get_char_type(WCHAR ch)
{ {
WORD type = 0; WORD type = 0;
...@@ -200,7 +203,7 @@ WCHAR * WINAPI StrChrW(const WCHAR *str, WCHAR ch) ...@@ -200,7 +203,7 @@ WCHAR * WINAPI StrChrW(const WCHAR *str, WCHAR ch)
if (!str) if (!str)
return NULL; return NULL;
return strchrW(str, ch); return wcschr(str, ch);
} }
char * WINAPI StrChrIA(const char *str, WORD ch) char * WINAPI StrChrIA(const char *str, WORD ch)
...@@ -227,10 +230,10 @@ WCHAR * WINAPI StrChrIW(const WCHAR *str, WCHAR ch) ...@@ -227,10 +230,10 @@ WCHAR * WINAPI StrChrIW(const WCHAR *str, WCHAR ch)
if (!str) if (!str)
return NULL; return NULL;
ch = toupperW(ch); ch = towupper(ch);
while (*str) while (*str)
{ {
if (toupperW(*str) == ch) if (towupper(*str) == ch)
return (WCHAR *)str; return (WCHAR *)str;
str++; str++;
} }
...@@ -284,7 +287,7 @@ WCHAR * WINAPI StrDupW(const WCHAR *str) ...@@ -284,7 +287,7 @@ WCHAR * WINAPI StrDupW(const WCHAR *str)
TRACE("%s\n", wine_dbgstr_w(str)); TRACE("%s\n", wine_dbgstr_w(str));
len = (str ? strlenW(str) + 1 : 1) * sizeof(WCHAR); len = (str ? lstrlenW(str) + 1 : 1) * sizeof(WCHAR);
ret = LocalAlloc(LMEM_FIXED, len); ret = LocalAlloc(LMEM_FIXED, len);
if (ret) if (ret)
...@@ -351,7 +354,7 @@ WCHAR * WINAPI StrStrW(const WCHAR *str, const WCHAR *search) ...@@ -351,7 +354,7 @@ WCHAR * WINAPI StrStrW(const WCHAR *str, const WCHAR *search)
if (!str || !search || !*search) if (!str || !search || !*search)
return NULL; return NULL;
return strstrW(str, search); return wcsstr(str, search);
} }
WCHAR * WINAPI StrStrNW(const WCHAR *str, const WCHAR *search, UINT max_len) WCHAR * WINAPI StrStrNW(const WCHAR *str, const WCHAR *search, UINT max_len)
...@@ -363,11 +366,11 @@ WCHAR * WINAPI StrStrNW(const WCHAR *str, const WCHAR *search, UINT max_len) ...@@ -363,11 +366,11 @@ WCHAR * WINAPI StrStrNW(const WCHAR *str, const WCHAR *search, UINT max_len)
if (!str || !search || !*search || !max_len) if (!str || !search || !*search || !max_len)
return NULL; return NULL;
len = strlenW(search); len = lstrlenW(search);
for (i = max_len; *str && (i > 0); i--, str++) for (i = max_len; *str && (i > 0); i--, str++)
{ {
if (!strncmpW(str, search, len)) if (!wcsncmp(str, search, len))
return (WCHAR *)str; return (WCHAR *)str;
} }
...@@ -389,11 +392,11 @@ WCHAR * WINAPI StrStrNIW(const WCHAR *str, const WCHAR *search, UINT max_len) ...@@ -389,11 +392,11 @@ WCHAR * WINAPI StrStrNIW(const WCHAR *str, const WCHAR *search, UINT max_len)
if (!str || !search || !*search || !max_len) if (!str || !search || !*search || !max_len)
return NULL; return NULL;
len = strlenW(search); len = lstrlenW(search);
for (i = max_len; *str && (i > 0); i--, str++) for (i = max_len; *str && (i > 0); i--, str++)
{ {
if (!strncmpiW(str, search, len)) if (!wcsnicmp(str, search, len))
return (WCHAR *)str; return (WCHAR *)str;
} }
...@@ -477,8 +480,8 @@ WCHAR * WINAPI StrStrIW(const WCHAR *str, const WCHAR *search) ...@@ -477,8 +480,8 @@ WCHAR * WINAPI StrStrIW(const WCHAR *str, const WCHAR *search)
if (!str || !search || !*search) if (!str || !search || !*search)
return NULL; return NULL;
len = strlenW(search); len = lstrlenW(search);
end = str + strlenW(str); end = str + lstrlenW(str);
while (str + len <= end) while (str + len <= end)
{ {
...@@ -522,7 +525,7 @@ int WINAPI StrSpnA(const char *str, const char *match) ...@@ -522,7 +525,7 @@ int WINAPI StrSpnA(const char *str, const char *match)
int WINAPI StrSpnW(const WCHAR *str, const WCHAR *match) int WINAPI StrSpnW(const WCHAR *str, const WCHAR *match)
{ {
if (!str || !match) return 0; if (!str || !match) return 0;
return strspnW(str, match); return wcsspn(str, match);
} }
int WINAPI StrCSpnA(const char *str, const char *match) int WINAPI StrCSpnA(const char *str, const char *match)
...@@ -537,7 +540,7 @@ int WINAPI StrCSpnW(const WCHAR *str, const WCHAR *match) ...@@ -537,7 +540,7 @@ int WINAPI StrCSpnW(const WCHAR *str, const WCHAR *match)
if (!str || !match) if (!str || !match)
return 0; return 0;
return strcspnW(str, match); return wcscspn(str, match);
} }
int WINAPI StrCSpnIA(const char *str, const char *match) int WINAPI StrCSpnIA(const char *str, const char *match)
...@@ -600,7 +603,7 @@ WCHAR * WINAPI StrRChrW(const WCHAR *str, const WCHAR *end, WORD ch) ...@@ -600,7 +603,7 @@ WCHAR * WINAPI StrRChrW(const WCHAR *str, const WCHAR *end, WORD ch)
WCHAR *ret = NULL; WCHAR *ret = NULL;
if (!str) return NULL; if (!str) return NULL;
if (!end) end = str + strlenW(str); if (!end) end = str + lstrlenW(str);
while (str < end) while (str < end)
{ {
if (*str == ch) ret = (WCHAR *)str; if (*str == ch) ret = (WCHAR *)str;
...@@ -621,7 +624,7 @@ WCHAR * WINAPI StrRChrIW(const WCHAR *str, const WCHAR *end, WORD ch) ...@@ -621,7 +624,7 @@ WCHAR * WINAPI StrRChrIW(const WCHAR *str, const WCHAR *end, WORD ch)
WCHAR *ret = NULL; WCHAR *ret = NULL;
if (!str) return NULL; if (!str) return NULL;
if (!end) end = str + strlenW(str); if (!end) end = str + lstrlenW(str);
while (str < end) while (str < end)
{ {
if (!ChrCmpIW(*str, ch)) ret = (WCHAR *)str; if (!ChrCmpIW(*str, ch)) ret = (WCHAR *)str;
...@@ -677,10 +680,10 @@ WCHAR * WINAPI StrRStrIW(const WCHAR *str, const WCHAR *end, const WCHAR *search ...@@ -677,10 +680,10 @@ WCHAR * WINAPI StrRStrIW(const WCHAR *str, const WCHAR *end, const WCHAR *search
if (!str || !search || !*search) if (!str || !search || !*search)
return NULL; return NULL;
len = strlenW(search); len = lstrlenW(search);
if (!end) if (!end)
end = str + strlenW(str); end = str + lstrlenW(str);
else else
end += min(len - 1, lstrlenW(end)); end += min(len - 1, lstrlenW(end));
...@@ -717,7 +720,7 @@ char * WINAPI StrPBrkA(const char *str, const char *match) ...@@ -717,7 +720,7 @@ char * WINAPI StrPBrkA(const char *str, const char *match)
WCHAR * WINAPI StrPBrkW(const WCHAR *str, const WCHAR *match) WCHAR * WINAPI StrPBrkW(const WCHAR *str, const WCHAR *match)
{ {
if (!str || !match) return NULL; if (!str || !match) return NULL;
return strpbrkW(str, match); return wcspbrk(str, match);
} }
BOOL WINAPI StrTrimA(char *str, const char *trim) BOOL WINAPI StrTrimA(char *str, const char *trim)
...@@ -772,7 +775,7 @@ BOOL WINAPI StrTrimW(WCHAR *str, const WCHAR *trim) ...@@ -772,7 +775,7 @@ BOOL WINAPI StrTrimW(WCHAR *str, const WCHAR *trim)
while (*ptr && StrChrW(trim, *ptr)) while (*ptr && StrChrW(trim, *ptr))
ptr++; ptr++;
len = strlenW(ptr); len = lstrlenW(ptr);
if (ptr != str) if (ptr != str)
{ {
...@@ -810,7 +813,7 @@ BOOL WINAPI StrToInt64ExA(const char *str, DWORD flags, LONGLONG *ret) ...@@ -810,7 +813,7 @@ BOOL WINAPI StrToInt64ExA(const char *str, DWORD flags, LONGLONG *ret)
WARN("Unknown flags %#x\n", flags); WARN("Unknown flags %#x\n", flags);
/* Skip leading space, '+', '-' */ /* Skip leading space, '+', '-' */
while (isspace(*str)) while (*str == ' ' || (*str >= '\t' && *str <= '\r'))
str = CharNextA(str); str = CharNextA(str);
if (*str == '-') if (*str == '-')
...@@ -821,7 +824,7 @@ BOOL WINAPI StrToInt64ExA(const char *str, DWORD flags, LONGLONG *ret) ...@@ -821,7 +824,7 @@ BOOL WINAPI StrToInt64ExA(const char *str, DWORD flags, LONGLONG *ret)
else if (*str == '+') else if (*str == '+')
str++; str++;
if (flags & STIF_SUPPORT_HEX && *str == '0' && tolower(str[1]) == 'x') if (flags & STIF_SUPPORT_HEX && *str == '0' && (str[1] == 'x' || str[1] == 'X'))
{ {
/* Read hex number */ /* Read hex number */
str += 2; str += 2;
...@@ -832,10 +835,12 @@ BOOL WINAPI StrToInt64ExA(const char *str, DWORD flags, LONGLONG *ret) ...@@ -832,10 +835,12 @@ BOOL WINAPI StrToInt64ExA(const char *str, DWORD flags, LONGLONG *ret)
while (isxdigit(*str)) while (isxdigit(*str))
{ {
value *= 16; value *= 16;
if (isdigit(*str)) if (*str >= '0' && *str <= '9')
value += (*str - '0'); value += (*str - '0');
else if (*str >= 'A' && *str <= 'F')
value += 10 + *str - 'A';
else else
value += 10 + (tolower(*str) - 'a'); value += 10 + *str - 'a';
str++; str++;
} }
...@@ -844,10 +849,10 @@ BOOL WINAPI StrToInt64ExA(const char *str, DWORD flags, LONGLONG *ret) ...@@ -844,10 +849,10 @@ BOOL WINAPI StrToInt64ExA(const char *str, DWORD flags, LONGLONG *ret)
} }
/* Read decimal number */ /* Read decimal number */
if (!isdigit(*str)) if (*str < '0' || *str > '9')
return FALSE; return FALSE;
while (isdigit(*str)) while (*str >= '0' && *str <= '9')
{ {
value *= 10; value *= 10;
value += (*str - '0'); value += (*str - '0');
...@@ -872,7 +877,7 @@ BOOL WINAPI StrToInt64ExW(const WCHAR *str, DWORD flags, LONGLONG *ret) ...@@ -872,7 +877,7 @@ BOOL WINAPI StrToInt64ExW(const WCHAR *str, DWORD flags, LONGLONG *ret)
WARN("Unknown flags %#x.\n", flags); WARN("Unknown flags %#x.\n", flags);
/* Skip leading space, '+', '-' */ /* Skip leading space, '+', '-' */
while (isspaceW(*str)) while (iswspace(*str))
str++; str++;
if (*str == '-') if (*str == '-')
...@@ -883,21 +888,21 @@ BOOL WINAPI StrToInt64ExW(const WCHAR *str, DWORD flags, LONGLONG *ret) ...@@ -883,21 +888,21 @@ BOOL WINAPI StrToInt64ExW(const WCHAR *str, DWORD flags, LONGLONG *ret)
else if (*str == '+') else if (*str == '+')
str++; str++;
if (flags & STIF_SUPPORT_HEX && *str == '0' && tolowerW(str[1]) == 'x') if (flags & STIF_SUPPORT_HEX && *str == '0' && towlower(str[1]) == 'x')
{ {
/* Read hex number */ /* Read hex number */
str += 2; str += 2;
if (!isxdigitW(*str)) if (!iswxdigit(*str))
return FALSE; return FALSE;
while (isxdigitW(*str)) while (iswxdigit(*str))
{ {
value *= 16; value *= 16;
if (isdigitW(*str)) if (iswdigit(*str))
value += (*str - '0'); value += (*str - '0');
else else
value += 10 + (tolowerW(*str) - 'a'); value += 10 + (towlower(*str) - 'a');
str++; str++;
} }
...@@ -906,10 +911,10 @@ BOOL WINAPI StrToInt64ExW(const WCHAR *str, DWORD flags, LONGLONG *ret) ...@@ -906,10 +911,10 @@ BOOL WINAPI StrToInt64ExW(const WCHAR *str, DWORD flags, LONGLONG *ret)
} }
/* Read decimal number */ /* Read decimal number */
if (!isdigitW(*str)) if (!iswdigit(*str))
return FALSE; return FALSE;
while (isdigitW(*str)) while (iswdigit(*str))
{ {
value *= 10; value *= 10;
value += (*str - '0'); value += (*str - '0');
...@@ -968,7 +973,7 @@ int WINAPI StrToIntW(const WCHAR *str) ...@@ -968,7 +973,7 @@ int WINAPI StrToIntW(const WCHAR *str)
if (!str) if (!str)
return 0; return 0;
if (*str == '-' || isdigitW(*str)) if (*str == '-' || iswdigit(*str))
StrToIntExW(str, 0, &value); StrToIntExW(str, 0, &value);
return value; return value;
} }
...@@ -1270,11 +1275,11 @@ int WINAPI StrCmpLogicalW(const WCHAR *str, const WCHAR *comp) ...@@ -1270,11 +1275,11 @@ int WINAPI StrCmpLogicalW(const WCHAR *str, const WCHAR *comp)
{ {
if (!*comp) if (!*comp)
return 1; return 1;
else if (isdigitW(*str)) else if (iswdigit(*str))
{ {
int str_value, comp_value; int str_value, comp_value;
if (!isdigitW(*comp)) if (!iswdigit(*comp))
return -1; return -1;
/* Compare the numbers */ /* Compare the numbers */
...@@ -1287,12 +1292,12 @@ int WINAPI StrCmpLogicalW(const WCHAR *str, const WCHAR *comp) ...@@ -1287,12 +1292,12 @@ int WINAPI StrCmpLogicalW(const WCHAR *str, const WCHAR *comp)
return 1; return 1;
/* Skip */ /* Skip */
while (isdigitW(*str)) while (iswdigit(*str))
str++; str++;
while (isdigitW(*comp)) while (iswdigit(*comp))
comp++; comp++;
} }
else if (isdigitW(*comp)) else if (iswdigit(*comp))
return 1; return 1;
else else
{ {
...@@ -1371,7 +1376,7 @@ WCHAR * WINAPI StrCatBuffW(WCHAR *str, const WCHAR *cat, INT max_len) ...@@ -1371,7 +1376,7 @@ WCHAR * WINAPI StrCatBuffW(WCHAR *str, const WCHAR *cat, INT max_len)
if (!str) if (!str)
return NULL; return NULL;
len = strlenW(str); len = lstrlenW(str);
max_len -= len; max_len -= len;
if (max_len > 0) if (max_len > 0)
StrCpyNW(str + len, cat, max_len); StrCpyNW(str + len, cat, max_len);
...@@ -1384,7 +1389,7 @@ DWORD WINAPI StrCatChainW(WCHAR *str, DWORD max_len, DWORD at, const WCHAR *cat) ...@@ -1384,7 +1389,7 @@ DWORD WINAPI StrCatChainW(WCHAR *str, DWORD max_len, DWORD at, const WCHAR *cat)
TRACE("%s, %u, %d, %s\n", wine_dbgstr_w(str), max_len, at, wine_dbgstr_w(cat)); TRACE("%s, %u, %d, %s\n", wine_dbgstr_w(str), max_len, at, wine_dbgstr_w(cat));
if (at == -1) if (at == -1)
at = strlenW(str); at = lstrlenW(str);
if (!max_len) if (!max_len)
return at; return at;
...@@ -1442,13 +1447,13 @@ HRESULT WINAPI SHLoadIndirectString(const WCHAR *src, WCHAR *dst, UINT dst_len, ...@@ -1442,13 +1447,13 @@ HRESULT WINAPI SHLoadIndirectString(const WCHAR *src, WCHAR *dst, UINT dst_len,
dst[0] = 0; dst[0] = 0;
dllname = StrDupW(src + 1); dllname = StrDupW(src + 1);
index_str = strchrW(dllname, ','); index_str = wcschr(dllname, ',');
if(!index_str) goto end; if(!index_str) goto end;
*index_str = 0; *index_str = 0;
index_str++; index_str++;
index = atoiW(index_str); index = wcstol(index_str, NULL, 10);
hmod = LoadLibraryW(dllname); hmod = LoadLibraryW(dllname);
if (!hmod) goto end; if (!hmod) goto end;
......
...@@ -1158,6 +1158,8 @@ static void build(struct options* opts) ...@@ -1158,6 +1158,8 @@ static void build(struct options* opts)
strarray_add(link_args, "-lc"); strarray_add(link_args, "-lc");
} }
if (opts->nodefaultlibs && is_pe) strarray_add( link_args, "-lgcc" );
spawn(opts->prefix, link_args, 0); spawn(opts->prefix, link_args, 0);
strarray_free (link_args); strarray_free (link_args);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment