mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 04:39:45 +00:00
msvcrt: Add _mktemp_s implementation.
This commit is contained in:
parent
ce9d4b807e
commit
7d41f9b3e9
@ -1204,7 +1204,7 @@
|
||||
@ cdecl _mkgmtime32(ptr) msvcrt._mkgmtime32
|
||||
@ cdecl _mkgmtime64(ptr) msvcrt._mkgmtime64
|
||||
@ cdecl _mktemp(str) msvcrt._mktemp
|
||||
@ stub _mktemp_s
|
||||
@ cdecl _mktemp_s(str long) msvcrt._mktemp_s
|
||||
@ cdecl _mktime32(ptr) msvcrt._mktime32
|
||||
@ cdecl _mktime64(ptr) msvcrt._mktime64
|
||||
@ cdecl _msize(ptr) msvcrt._msize
|
||||
|
@ -1566,7 +1566,7 @@
|
||||
@ cdecl _mkgmtime32(ptr) msvcrt._mkgmtime32
|
||||
@ cdecl _mkgmtime64(ptr) msvcrt._mkgmtime64
|
||||
@ cdecl _mktemp(str) msvcrt._mktemp
|
||||
@ stub _mktemp_s
|
||||
@ cdecl _mktemp_s(str long) msvcrt._mktemp_s
|
||||
@ cdecl _mktime32(ptr) msvcrt._mktime32
|
||||
@ cdecl _mktime64(ptr) msvcrt._mktime64
|
||||
@ cdecl _msize(ptr) msvcrt._msize
|
||||
|
@ -875,7 +875,7 @@
|
||||
@ cdecl _mkgmtime32(ptr) msvcrt._mkgmtime32
|
||||
@ cdecl _mkgmtime64(ptr) msvcrt._mkgmtime64
|
||||
@ cdecl _mktemp(str) msvcrt._mktemp
|
||||
@ stub _mktemp_s
|
||||
@ cdecl _mktemp_s(str long) msvcrt._mktemp_s
|
||||
@ cdecl _mktime32(ptr) msvcrt._mktime32
|
||||
@ cdecl _mktime64(ptr) msvcrt._mktime64
|
||||
@ cdecl _msize(ptr) msvcrt._msize
|
||||
|
@ -853,7 +853,7 @@
|
||||
@ cdecl _mkgmtime32(ptr) msvcrt._mkgmtime32
|
||||
@ cdecl _mkgmtime64(ptr) msvcrt._mkgmtime64
|
||||
@ cdecl _mktemp(str) msvcrt._mktemp
|
||||
@ stub _mktemp_s
|
||||
@ cdecl _mktemp_s(str long) msvcrt._mktemp_s
|
||||
@ cdecl _mktime32(ptr) msvcrt._mktime32
|
||||
@ cdecl _mktime64(ptr) msvcrt._mktime64
|
||||
@ cdecl _msize(ptr) msvcrt._msize
|
||||
|
@ -1681,6 +1681,45 @@ MSVCRT_intptr_t CDECL MSVCRT__get_osfhandle(int fd)
|
||||
return (MSVCRT_intptr_t)hand;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* _mktemp_s (MSVCRT.@)
|
||||
*/
|
||||
int CDECL MSVCRT__mktemp_s(char *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(GetFileAttributesA(pattern) == INVALID_FILE_ATTRIBUTES)
|
||||
return 0;
|
||||
}
|
||||
|
||||
pattern[0] = 0;
|
||||
*MSVCRT__errno() = MSVCRT_EEXIST;
|
||||
return MSVCRT_EEXIST;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* _mktemp (MSVCRT.@)
|
||||
*/
|
||||
|
@ -830,7 +830,7 @@
|
||||
@ cdecl _mkgmtime32(ptr) MSVCRT__mkgmtime32
|
||||
@ cdecl _mkgmtime64(ptr) MSVCRT__mkgmtime64
|
||||
@ cdecl _mktemp(str) MSVCRT__mktemp
|
||||
# stub _mktemp_s(str long)
|
||||
@ cdecl _mktemp_s(str long) MSVCRT__mktemp_s
|
||||
@ cdecl _mktime32(ptr) MSVCRT__mktime32
|
||||
@ cdecl _mktime64(ptr) MSVCRT__mktime64
|
||||
@ cdecl _msize(ptr)
|
||||
|
@ -108,6 +108,7 @@ int __cdecl _locking(int,int,__msvcrt_long);
|
||||
__msvcrt_long __cdecl _lseek(int,__msvcrt_long,int);
|
||||
__int64 __cdecl _lseeki64(int,__int64,int);
|
||||
char* __cdecl _mktemp(char*);
|
||||
int __cdecl _mktemp_s(char*,size_t);
|
||||
int __cdecl _open(const char*,int,...);
|
||||
int __cdecl _open_osfhandle(intptr_t,int);
|
||||
int __cdecl _pipe(int*,unsigned int,int);
|
||||
|
Loading…
Reference in New Issue
Block a user