diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index 9012225b040..ef6d3544497 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -1557,7 +1557,7 @@ @ cdecl _wmakepath_s(ptr long wstr wstr wstr wstr) msvcrt._wmakepath_s @ cdecl _wmkdir(wstr) msvcrt._wmkdir @ cdecl _wmktemp(wstr) msvcrt._wmktemp -@ stub _wmktemp_s +@ cdecl _wmktemp_s(wstr long) msvcrt._wmktemp_s @ varargs _wopen(wstr long) msvcrt._wopen @ cdecl _wperror(wstr) msvcrt._wperror @ extern _wpgmptr msvcrt._wpgmptr diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index ad6d15929ee..dd768788037 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -1919,7 +1919,7 @@ @ cdecl _wmakepath_s(ptr long wstr wstr wstr wstr) msvcrt._wmakepath_s @ cdecl _wmkdir(wstr) msvcrt._wmkdir @ cdecl _wmktemp(wstr) msvcrt._wmktemp -@ stub _wmktemp_s +@ cdecl _wmktemp_s(wstr long) msvcrt._wmktemp_s @ varargs _wopen(wstr long) msvcrt._wopen @ cdecl _wperror(wstr) msvcrt._wperror @ extern _wpgmptr msvcrt._wpgmptr diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index 59ee88d0df3..87fbc5da3a5 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -1238,7 +1238,7 @@ @ cdecl _wmakepath_s(ptr long wstr wstr wstr wstr) msvcrt._wmakepath_s @ cdecl _wmkdir(wstr) msvcrt._wmkdir @ cdecl _wmktemp(wstr) msvcrt._wmktemp -@ stub _wmktemp_s +@ cdecl _wmktemp_s(wstr long) msvcrt._wmktemp_s @ varargs _wopen(wstr long) msvcrt._wopen @ cdecl _wperror(wstr) msvcrt._wperror @ extern _wpgmptr msvcrt._wpgmptr diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index 5d2ebf6d120..98000231c57 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -1211,7 +1211,7 @@ @ cdecl _wmakepath_s(ptr long wstr wstr wstr wstr) msvcrt._wmakepath_s @ cdecl _wmkdir(wstr) msvcrt._wmkdir @ cdecl _wmktemp(wstr) msvcrt._wmktemp -@ stub _wmktemp_s +@ cdecl _wmktemp_s(wstr long) msvcrt._wmktemp_s @ varargs _wopen(wstr long) msvcrt._wopen @ cdecl _wperror(wstr) msvcrt._wperror @ extern _wpgmptr msvcrt._wpgmptr diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index 35e2c004b83..8403b4b9517 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -1756,6 +1756,45 @@ char * CDECL MSVCRT__mktemp(char *pattern) return NULL; } +/********************************************************************* + * _wmktemp_s (MSVCRT.@) + */ +int CDECL MSVCRT__wmktemp_s(MSVCRT_wchar_t *pattern, MSVCRT_size_t size) +{ + DWORD len, xno, id; + + if(!MSVCRT_CHECK_PMT(pattern!=NULL)) + return MSVCRT_EINVAL; + + for(len=0; len=6)) { + if(size) + pattern[0] = 0; + return MSVCRT_EINVAL; + } + + for(xno=1; xno<=6; xno++) + if(!MSVCRT_CHECK_PMT(pattern[len-xno] == 'X')) + return MSVCRT_EINVAL; + + id = GetCurrentProcessId(); + for(xno=1; xno<6; xno++) { + pattern[len-xno] = id%10 + '0'; + id /= 10; + } + + for(pattern[len-6]='a'; pattern[len-6]<='z'; pattern[len-6]++) { + if(GetFileAttributesW(pattern) == INVALID_FILE_ATTRIBUTES) + return 0; + } + + pattern[0] = 0; + *MSVCRT__errno() = MSVCRT_EEXIST; + return MSVCRT_EEXIST; +} + /********************************************************************* * _wmktemp (MSVCRT.@) */ diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index e566440e320..e0e628710d1 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -1180,7 +1180,7 @@ @ cdecl _wmakepath_s(ptr long wstr wstr wstr wstr) @ cdecl _wmkdir(wstr) MSVCRT__wmkdir @ cdecl _wmktemp(wstr) MSVCRT__wmktemp -# stub _wmktemp_s(wstr long) +@ cdecl _wmktemp_s(wstr long) MSVCRT__wmktemp_s @ varargs _wopen(wstr long) MSVCRT__wopen # stub _woutput_s @ stub _wperror(wstr)