Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
9b6c93f6
Commit
9b6c93f6
authored
Dec 22, 2015
by
Piotr Caban
Committed by
Alexandre Julliard
Dec 22, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Add tmpnam_s implementation.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5913a107
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
66 additions
and
25 deletions
+66
-25
api-ms-win-crt-stdio-l1-1-0.spec
...-ms-win-crt-stdio-l1-1-0/api-ms-win-crt-stdio-l1-1-0.spec
+1
-1
msvcr100.spec
dlls/msvcr100/msvcr100.spec
+1
-1
msvcr110.spec
dlls/msvcr110/msvcr110.spec
+1
-1
msvcr120.spec
dlls/msvcr120/msvcr120.spec
+1
-1
msvcr120_app.spec
dlls/msvcr120_app/msvcr120_app.spec
+1
-1
msvcr80.spec
dlls/msvcr80/msvcr80.spec
+1
-1
msvcr90.spec
dlls/msvcr90/msvcr90.spec
+1
-1
file.c
dlls/msvcrt/file.c
+56
-16
msvcrt.h
dlls/msvcrt/msvcrt.h
+1
-0
msvcrt.spec
dlls/msvcrt/msvcrt.spec
+1
-1
ucrtbase.spec
dlls/ucrtbase/ucrtbase.spec
+1
-1
No files found.
dlls/api-ms-win-crt-stdio-l1-1-0/api-ms-win-crt-stdio-l1-1-0.spec
View file @
9b6c93f6
...
...
@@ -154,6 +154,6 @@
@ cdecl tmpfile() ucrtbase.tmpfile
@ cdecl tmpfile_s(ptr) ucrtbase.tmpfile_s
@ cdecl tmpnam(ptr) ucrtbase.tmpnam
@
stub
tmpnam_s
@
cdecl tmpnam_s(ptr long) ucrtbase.
tmpnam_s
@ cdecl ungetc(long ptr) ucrtbase.ungetc
@ cdecl ungetwc(long ptr) ucrtbase.ungetwc
dlls/msvcr100/msvcr100.spec
View file @
9b6c93f6
...
...
@@ -1833,7 +1833,7 @@
@ cdecl tmpfile() MSVCRT_tmpfile
@ cdecl tmpfile_s(ptr) MSVCRT_tmpfile_s
@ cdecl tmpnam(ptr) MSVCRT_tmpnam
@
stub
tmpnam_s
@
cdecl tmpnam_s(ptr long) MSVCRT_
tmpnam_s
@ cdecl tolower(long) MSVCRT_tolower
@ cdecl toupper(long) MSVCRT_toupper
@ cdecl towlower(long) MSVCRT_towlower
...
...
dlls/msvcr110/msvcr110.spec
View file @
9b6c93f6
...
...
@@ -2192,7 +2192,7 @@
@ cdecl tmpfile() MSVCRT_tmpfile
@ cdecl tmpfile_s(ptr) MSVCRT_tmpfile_s
@ cdecl tmpnam(ptr) MSVCRT_tmpnam
@
stub
tmpnam_s
@
cdecl tmpnam_s(ptr long) MSVCRT_
tmpnam_s
@ cdecl tolower(long) MSVCRT_tolower
@ cdecl toupper(long) MSVCRT_toupper
@ cdecl towlower(long) MSVCRT_towlower
...
...
dlls/msvcr120/msvcr120.spec
View file @
9b6c93f6
...
...
@@ -2411,7 +2411,7 @@
@ cdecl tmpfile() MSVCRT_tmpfile
@ cdecl tmpfile_s(ptr) MSVCRT_tmpfile_s
@ cdecl tmpnam(ptr) MSVCRT_tmpnam
@
stub
tmpnam_s
@
cdecl tmpnam_s(ptr long) MSVCRT_
tmpnam_s
@ cdecl tolower(long) MSVCRT_tolower
@ cdecl toupper(long) MSVCRT_toupper
@ stub towctrans
...
...
dlls/msvcr120_app/msvcr120_app.spec
View file @
9b6c93f6
...
...
@@ -2073,7 +2073,7 @@
@ cdecl tmpfile() msvcr120.tmpfile
@ cdecl tmpfile_s(ptr) msvcr120.tmpfile_s
@ cdecl tmpnam(ptr) msvcr120.tmpnam
@
stub
tmpnam_s
@
cdecl tmpnam_s(ptr long) msvcr120.
tmpnam_s
@ cdecl tolower(long) msvcr120.tolower
@ cdecl toupper(long) msvcr120.toupper
@ stub towctrans
...
...
dlls/msvcr80/msvcr80.spec
View file @
9b6c93f6
...
...
@@ -1514,7 +1514,7 @@
@ cdecl tmpfile() MSVCRT_tmpfile
@ cdecl tmpfile_s(ptr) MSVCRT_tmpfile_s
@ cdecl tmpnam(ptr) MSVCRT_tmpnam
@
stub
tmpnam_s
@
cdecl tmpnam_s(ptr long) MSVCRT_
tmpnam_s
@ cdecl tolower(long) MSVCRT_tolower
@ cdecl toupper(long) MSVCRT_toupper
@ cdecl towlower(long) MSVCRT_towlower
...
...
dlls/msvcr90/msvcr90.spec
View file @
9b6c93f6
...
...
@@ -1486,7 +1486,7 @@
@ cdecl tmpfile() MSVCRT_tmpfile
@ cdecl tmpfile_s(ptr) MSVCRT_tmpfile_s
@ cdecl tmpnam(ptr) MSVCRT_tmpnam
@
stub
tmpnam_s
@
cdecl tmpnam_s(ptr long) MSVCRT_
tmpnam_s
@ cdecl tolower(long) MSVCRT_tolower
@ cdecl toupper(long) MSVCRT_toupper
@ cdecl towlower(long) MSVCRT_towlower
...
...
dlls/msvcrt/file.c
View file @
9b6c93f6
...
...
@@ -128,6 +128,7 @@ static int MSVCRT_umask = 0;
/* INTERNAL: static data for tmpnam and _wtmpname functions */
static
int
tmpnam_unique
;
static
int
tmpnam_s_unique
;
static
const
unsigned
int
EXE
=
'e'
<<
16
|
'x'
<<
8
|
'e'
;
static
const
unsigned
int
BAT
=
'b'
<<
16
|
'a'
<<
8
|
't'
;
...
...
@@ -4780,15 +4781,65 @@ void CDECL MSVCRT_setbuf(MSVCRT_FILE* file, char *buf)
MSVCRT_setvbuf
(
file
,
buf
,
buf
?
MSVCRT__IOFBF
:
MSVCRT__IONBF
,
MSVCRT_BUFSIZ
);
}
static
int
tmpnam_helper
(
char
*
s
,
MSVCRT_size_t
size
,
int
*
tmpnam_unique
,
int
tmp_max
)
{
char
tmpstr
[
8
];
char
*
p
=
s
;
int
digits
;
if
(
!
MSVCRT_CHECK_PMT
(
s
!=
NULL
))
return
MSVCRT_EINVAL
;
if
(
size
<
3
)
{
if
(
size
)
*
s
=
0
;
*
MSVCRT__errno
()
=
MSVCRT_ERANGE
;
return
MSVCRT_ERANGE
;
}
*
p
++
=
'\\'
;
*
p
++
=
's'
;
size
-=
2
;
digits
=
msvcrt_int_to_base32
(
GetCurrentProcessId
(),
tmpstr
);
if
(
digits
+
1
>
size
)
{
*
s
=
0
;
*
MSVCRT__errno
()
=
MSVCRT_ERANGE
;
return
MSVCRT_ERANGE
;
}
memcpy
(
p
,
tmpstr
,
digits
*
sizeof
(
tmpstr
[
0
]));
p
+=
digits
;
*
p
++
=
'.'
;
size
-=
digits
+
1
;
while
(
1
)
{
while
((
digits
=
*
tmpnam_unique
)
+
1
<
tmp_max
)
{
if
(
InterlockedCompareExchange
(
tmpnam_unique
,
digits
+
1
,
digits
)
==
digits
)
break
;
}
digits
=
msvcrt_int_to_base32
(
digits
,
tmpstr
);
if
(
digits
+
1
>
size
)
{
*
s
=
0
;
*
MSVCRT__errno
()
=
MSVCRT_ERANGE
;
return
MSVCRT_ERANGE
;
}
memcpy
(
p
,
tmpstr
,
digits
*
sizeof
(
tmpstr
[
0
]));
p
[
digits
]
=
0
;
if
(
GetFileAttributesA
(
s
)
==
INVALID_FILE_ATTRIBUTES
&&
GetLastError
()
==
ERROR_FILE_NOT_FOUND
)
break
;
}
return
0
;
}
int
CDECL
MSVCRT_tmpnam_s
(
char
*
s
,
MSVCRT_size_t
size
)
{
return
tmpnam_helper
(
s
,
size
,
&
tmpnam_s_unique
,
MSVCRT_TMP_MAX_S
);
}
/*********************************************************************
* tmpnam (MSVCRT.@)
*/
char
*
CDECL
MSVCRT_tmpnam
(
char
*
s
)
{
char
tmpstr
[
16
];
char
*
p
;
int
count
,
size
;
if
(
!
s
)
{
thread_data_t
*
data
=
msvcrt_get_thread_data
();
...
...
@@ -4798,18 +4849,7 @@ char * CDECL MSVCRT_tmpnam(char *s)
s
=
data
->
tmpnam_buffer
;
}
msvcrt_int_to_base32
(
GetCurrentProcessId
(),
tmpstr
);
p
=
s
+
sprintf
(
s
,
"
\\
s%s."
,
tmpstr
);
for
(
count
=
0
;
count
<
MSVCRT_TMP_MAX
;
count
++
)
{
size
=
msvcrt_int_to_base32
(
tmpnam_unique
++
,
tmpstr
);
memcpy
(
p
,
tmpstr
,
size
);
p
[
size
]
=
'\0'
;
if
(
GetFileAttributesA
(
s
)
==
INVALID_FILE_ATTRIBUTES
&&
GetLastError
()
==
ERROR_FILE_NOT_FOUND
)
break
;
}
return
s
;
return
tmpnam_helper
(
s
,
-
1
,
&
tmpnam_unique
,
MSVCRT_TMP_MAX
)
?
NULL
:
s
;
}
/*********************************************************************
...
...
dlls/msvcrt/msvcrt.h
View file @
9b6c93f6
...
...
@@ -663,6 +663,7 @@ struct MSVCRT__stat64 {
#define MSVCRT_WEOF (MSVCRT_wint_t)(0xFFFF)
#define MSVCRT_EOF (-1)
#define MSVCRT_TMP_MAX 0x7fff
#define MSVCRT_TMP_MAX_S 0x7fffffff
#define MSVCRT_RAND_MAX 0x7fff
#define MSVCRT_BUFSIZ 512
...
...
dlls/msvcrt/msvcrt.spec
View file @
9b6c93f6
...
...
@@ -1457,7 +1457,7 @@
@ cdecl tmpfile() MSVCRT_tmpfile
@ cdecl tmpfile_s(ptr) MSVCRT_tmpfile_s
@ cdecl tmpnam(ptr) MSVCRT_tmpnam
# stub tmpnam_s(ptr long)
@ cdecl tmpnam_s(ptr long) MSVCRT_tmpnam_s
@ cdecl tolower(long) MSVCRT_tolower
@ cdecl toupper(long) MSVCRT_toupper
@ cdecl towlower(long) MSVCRT_towlower
...
...
dlls/ucrtbase/ucrtbase.spec
View file @
9b6c93f6
...
...
@@ -2539,7 +2539,7 @@
@ cdecl tmpfile() MSVCRT_tmpfile
@ cdecl tmpfile_s(ptr) MSVCRT_tmpfile_s
@ cdecl tmpnam(ptr) MSVCRT_tmpnam
@
stub
tmpnam_s
@
cdecl tmpnam_s(ptr long) MSVCRT_
tmpnam_s
@ cdecl tolower(long) MSVCRT_tolower
@ cdecl toupper(long) MSVCRT_toupper
@ stub towctrans
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment