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

kernelbase: Build with msvcrt.

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