Commit b6fc57ec authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Add _wmktemp_s implementation.

parent 7d41f9b3
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -1757,6 +1757,45 @@ char * CDECL MSVCRT__mktemp(char *pattern)
}
/*********************************************************************
* _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<size; len++)
if(!pattern[len])
break;
if(!MSVCRT_CHECK_PMT(len!=size && 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.@)
*/
MSVCRT_wchar_t * CDECL MSVCRT__wmktemp(MSVCRT_wchar_t *pattern)
......
......@@ -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)
......
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