msvcrt: Add _wmktemp_s implementation.

This commit is contained in:
Piotr Caban 2013-07-24 12:20:52 +02:00 committed by Alexandre Julliard
parent 7d41f9b3e9
commit b6fc57ec84
6 changed files with 44 additions and 5 deletions

View File

@ -1557,7 +1557,7 @@
@ cdecl _wmakepath_s(ptr long wstr wstr wstr wstr) msvcrt._wmakepath_s @ cdecl _wmakepath_s(ptr long wstr wstr wstr wstr) msvcrt._wmakepath_s
@ cdecl _wmkdir(wstr) msvcrt._wmkdir @ cdecl _wmkdir(wstr) msvcrt._wmkdir
@ cdecl _wmktemp(wstr) msvcrt._wmktemp @ cdecl _wmktemp(wstr) msvcrt._wmktemp
@ stub _wmktemp_s @ cdecl _wmktemp_s(wstr long) msvcrt._wmktemp_s
@ varargs _wopen(wstr long) msvcrt._wopen @ varargs _wopen(wstr long) msvcrt._wopen
@ cdecl _wperror(wstr) msvcrt._wperror @ cdecl _wperror(wstr) msvcrt._wperror
@ extern _wpgmptr msvcrt._wpgmptr @ extern _wpgmptr msvcrt._wpgmptr

View File

@ -1919,7 +1919,7 @@
@ cdecl _wmakepath_s(ptr long wstr wstr wstr wstr) msvcrt._wmakepath_s @ cdecl _wmakepath_s(ptr long wstr wstr wstr wstr) msvcrt._wmakepath_s
@ cdecl _wmkdir(wstr) msvcrt._wmkdir @ cdecl _wmkdir(wstr) msvcrt._wmkdir
@ cdecl _wmktemp(wstr) msvcrt._wmktemp @ cdecl _wmktemp(wstr) msvcrt._wmktemp
@ stub _wmktemp_s @ cdecl _wmktemp_s(wstr long) msvcrt._wmktemp_s
@ varargs _wopen(wstr long) msvcrt._wopen @ varargs _wopen(wstr long) msvcrt._wopen
@ cdecl _wperror(wstr) msvcrt._wperror @ cdecl _wperror(wstr) msvcrt._wperror
@ extern _wpgmptr msvcrt._wpgmptr @ extern _wpgmptr msvcrt._wpgmptr

View File

@ -1238,7 +1238,7 @@
@ cdecl _wmakepath_s(ptr long wstr wstr wstr wstr) msvcrt._wmakepath_s @ cdecl _wmakepath_s(ptr long wstr wstr wstr wstr) msvcrt._wmakepath_s
@ cdecl _wmkdir(wstr) msvcrt._wmkdir @ cdecl _wmkdir(wstr) msvcrt._wmkdir
@ cdecl _wmktemp(wstr) msvcrt._wmktemp @ cdecl _wmktemp(wstr) msvcrt._wmktemp
@ stub _wmktemp_s @ cdecl _wmktemp_s(wstr long) msvcrt._wmktemp_s
@ varargs _wopen(wstr long) msvcrt._wopen @ varargs _wopen(wstr long) msvcrt._wopen
@ cdecl _wperror(wstr) msvcrt._wperror @ cdecl _wperror(wstr) msvcrt._wperror
@ extern _wpgmptr msvcrt._wpgmptr @ extern _wpgmptr msvcrt._wpgmptr

View File

@ -1211,7 +1211,7 @@
@ cdecl _wmakepath_s(ptr long wstr wstr wstr wstr) msvcrt._wmakepath_s @ cdecl _wmakepath_s(ptr long wstr wstr wstr wstr) msvcrt._wmakepath_s
@ cdecl _wmkdir(wstr) msvcrt._wmkdir @ cdecl _wmkdir(wstr) msvcrt._wmkdir
@ cdecl _wmktemp(wstr) msvcrt._wmktemp @ cdecl _wmktemp(wstr) msvcrt._wmktemp
@ stub _wmktemp_s @ cdecl _wmktemp_s(wstr long) msvcrt._wmktemp_s
@ varargs _wopen(wstr long) msvcrt._wopen @ varargs _wopen(wstr long) msvcrt._wopen
@ cdecl _wperror(wstr) msvcrt._wperror @ cdecl _wperror(wstr) msvcrt._wperror
@ extern _wpgmptr msvcrt._wpgmptr @ extern _wpgmptr msvcrt._wpgmptr

View File

@ -1756,6 +1756,45 @@ char * CDECL MSVCRT__mktemp(char *pattern)
return NULL; 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<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.@) * _wmktemp (MSVCRT.@)
*/ */

View File

@ -1180,7 +1180,7 @@
@ cdecl _wmakepath_s(ptr long wstr wstr wstr wstr) @ cdecl _wmakepath_s(ptr long wstr wstr wstr wstr)
@ cdecl _wmkdir(wstr) MSVCRT__wmkdir @ cdecl _wmkdir(wstr) MSVCRT__wmkdir
@ cdecl _wmktemp(wstr) MSVCRT__wmktemp @ cdecl _wmktemp(wstr) MSVCRT__wmktemp
# stub _wmktemp_s(wstr long) @ cdecl _wmktemp_s(wstr long) MSVCRT__wmktemp_s
@ varargs _wopen(wstr long) MSVCRT__wopen @ varargs _wopen(wstr long) MSVCRT__wopen
# stub _woutput_s # stub _woutput_s
@ stub _wperror(wstr) @ stub _wperror(wstr)