diff --git a/dlls/msvcr100/msvcr100.c b/dlls/msvcr100/msvcr100.c index d4254552872..28d4d6ed8be 100644 --- a/dlls/msvcr100/msvcr100.c +++ b/dlls/msvcr100/msvcr100.c @@ -25,6 +25,7 @@ #include "stdlib.h" #include "errno.h" #include "malloc.h" +#include "mbstring.h" #include "limits.h" #include "sys/stat.h" #include "windef.h" @@ -489,6 +490,11 @@ int CDECL MSVCR100_atoi(const char *str) return _atoi_l(str, NULL); } +unsigned char* CDECL MSVCR100__mbstok(unsigned char *str, const unsigned char *delim) +{ + return _mbstok_l(str, delim, NULL); +} + /********************************************************************* * DllMain (MSVCR100.@) */ diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index 63a0caac3f8..8e728c17d84 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -1182,7 +1182,7 @@ @ stub _mbsspnp_l @ cdecl _mbsstr(str str) msvcrt._mbsstr @ stub _mbsstr_l -@ cdecl _mbstok(str str) msvcrt._mbstok +@ cdecl _mbstok(str str) MSVCR100__mbstok @ cdecl _mbstok_l(str str ptr) msvcrt._mbstok_l @ cdecl _mbstok_s(str str ptr) msvcrt._mbstok_s @ cdecl _mbstok_s_l(str str ptr ptr) msvcrt._mbstok_s_l diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index e82f100c567..7b43159d03e 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -1544,7 +1544,7 @@ @ stub _mbsspnp_l @ cdecl _mbsstr(str str) msvcrt._mbsstr @ stub _mbsstr_l -@ cdecl _mbstok(str str) msvcrt._mbstok +@ cdecl _mbstok(str str) msvcr100._mbstok #don't forward to msvcrt @ cdecl _mbstok_l(str str ptr) msvcrt._mbstok_l @ cdecl _mbstok_s(str str ptr) msvcrt._mbstok_s @ cdecl _mbstok_s_l(str str ptr ptr) msvcrt._mbstok_s_l diff --git a/dlls/msvcr70/msvcr70.spec b/dlls/msvcr70/msvcr70.spec index 1a33fbb08a6..dc6dc039fdd 100644 --- a/dlls/msvcr70/msvcr70.spec +++ b/dlls/msvcr70/msvcr70.spec @@ -468,7 +468,7 @@ @ cdecl _mbsspn(str str) msvcrt._mbsspn @ cdecl _mbsspnp(str str) msvcrt._mbsspnp @ cdecl _mbsstr(str str) msvcrt._mbsstr -@ cdecl _mbstok(str str) msvcrt._mbstok +@ cdecl _mbstok(str str) msvcr100._mbstok #don't forward to msvcrt @ cdecl _mbstrlen(str) msvcrt._mbstrlen @ cdecl _mbsupr(str) msvcrt._mbsupr @ cdecl _memccpy(ptr ptr long long) msvcrt._memccpy diff --git a/dlls/msvcr71/msvcr71.spec b/dlls/msvcr71/msvcr71.spec index afdab05e1dd..3e3cf6f04f0 100644 --- a/dlls/msvcr71/msvcr71.spec +++ b/dlls/msvcr71/msvcr71.spec @@ -463,7 +463,7 @@ @ cdecl _mbsspn(str str) msvcrt._mbsspn @ cdecl _mbsspnp(str str) msvcrt._mbsspnp @ cdecl _mbsstr(str str) msvcrt._mbsstr -@ cdecl _mbstok(str str) msvcrt._mbstok +@ cdecl _mbstok(str str) msvcr100._mbstok #don't forward to msvcrt @ cdecl _mbstrlen(str) msvcrt._mbstrlen @ cdecl _mbsupr(str) msvcrt._mbsupr @ cdecl _memccpy(ptr ptr long long) msvcrt._memccpy diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index 521a69d0db2..2344f0fcccb 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -853,7 +853,7 @@ @ stub _mbsspnp_l @ cdecl _mbsstr(str str) msvcrt._mbsstr @ stub _mbsstr_l -@ cdecl _mbstok(str str) msvcrt._mbstok +@ cdecl _mbstok(str str) msvcr100._mbstok #don't forward to msvcrt @ cdecl _mbstok_l(str str ptr) msvcrt._mbstok_l @ cdecl _mbstok_s(str str ptr) msvcrt._mbstok_s @ cdecl _mbstok_s_l(str str ptr ptr) msvcrt._mbstok_s_l diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index fd71ef4c576..e31da911feb 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -831,7 +831,7 @@ @ stub _mbsspnp_l @ cdecl _mbsstr(str str) msvcrt._mbsstr @ stub _mbsstr_l -@ cdecl _mbstok(str str) msvcrt._mbstok +@ cdecl _mbstok(str str) msvcr100._mbstok #don't forward to msvcrt @ cdecl _mbstok_l(str str ptr) msvcrt._mbstok_l @ cdecl _mbstok_s(str str ptr) msvcrt._mbstok_s @ cdecl _mbstok_s_l(str str ptr ptr) msvcrt._mbstok_s_l diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c index b70ffa01084..b25649b6638 100644 --- a/dlls/msvcrt/mbcs.c +++ b/dlls/msvcrt/mbcs.c @@ -1149,7 +1149,12 @@ unsigned char* CDECL _mbstok_l(unsigned char *str, */ unsigned char* CDECL _mbstok(unsigned char *str, const unsigned char *delim) { - return _mbstok_s_l(str, delim, &msvcrt_get_thread_data()->mbstok_next, NULL); + thread_data_t *data = msvcrt_get_thread_data(); + + if(!str && !data->mbstok_next) + return NULL; + + return _mbstok_s_l(str, delim, &data->mbstok_next, NULL); } /********************************************************************* diff --git a/include/msvcrt/mbstring.h b/include/msvcrt/mbstring.h index a4d0746bcaf..7a40f7b4cb7 100644 --- a/include/msvcrt/mbstring.h +++ b/include/msvcrt/mbstring.h @@ -102,6 +102,7 @@ size_t __cdecl _mbsspn(const unsigned char*,const unsigned char*); unsigned char* __cdecl _mbsspnp(const unsigned char*,const unsigned char*); unsigned char* __cdecl _mbsstr(const unsigned char*,const unsigned char*); unsigned char* __cdecl _mbstok(unsigned char*,const unsigned char*); +unsigned char* __cdecl _mbstok_l(unsigned char*,const unsigned char*,_locale_t); unsigned char* __cdecl _mbsupr(unsigned char*); #ifndef _MBLEADTRAIL_DEFINED