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
abb3db5c
Commit
abb3db5c
authored
May 24, 2011
by
Piotr Caban
Committed by
Alexandre Julliard
May 25, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Improved tmpnam/wtmpnam implementation.
parent
12229aee
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
8 deletions
+23
-8
file.c
dlls/msvcrt/file.c
+20
-7
msvcrt.h
dlls/msvcrt/msvcrt.h
+3
-1
No files found.
dlls/msvcrt/file.c
View file @
abb3db5c
...
...
@@ -108,8 +108,6 @@ static int MSVCRT_umask = 0;
/* INTERNAL: static data for tmpnam and _wtmpname functions */
static
int
tmpnam_unique
;
static
char
MSVCRT_tmpname
[
MAX_PATH
];
static
MSVCRT_wchar_t
MSVCRT_wtmpname
[
MAX_PATH
];
static
const
unsigned
int
EXE
=
'e'
<<
16
|
'x'
<<
8
|
'e'
;
static
const
unsigned
int
BAT
=
'b'
<<
16
|
'a'
<<
8
|
't'
;
...
...
@@ -3654,8 +3652,16 @@ char * CDECL MSVCRT_tmpnam(char *s)
char
tmpstr
[
16
];
char
*
p
;
int
count
,
size
;
if
(
s
==
0
)
s
=
MSVCRT_tmpname
;
if
(
!
s
)
{
thread_data_t
*
data
=
msvcrt_get_thread_data
();
if
(
!
data
->
tmpnam_buffer
)
data
->
tmpnam_buffer
=
MSVCRT_malloc
(
MAX_PATH
);
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
++
)
...
...
@@ -3672,14 +3678,21 @@ char * CDECL MSVCRT_tmpnam(char *s)
/*********************************************************************
* _wtmpnam (MSVCRT.@)
*/
MSVCRT_wchar_t
*
MSVCRT_wtmpnam
(
MSVCRT_wchar_t
*
s
)
MSVCRT_wchar_t
*
CDECL
MSVCRT_wtmpnam
(
MSVCRT_wchar_t
*
s
)
{
static
const
MSVCRT_wchar_t
format
[]
=
{
'\\'
,
's'
,
'%'
,
's'
,
'.'
,
0
};
MSVCRT_wchar_t
tmpstr
[
16
];
MSVCRT_wchar_t
*
p
;
int
count
,
size
;
if
(
s
==
0
)
s
=
MSVCRT_wtmpname
;
if
(
!
s
)
{
thread_data_t
*
data
=
msvcrt_get_thread_data
();
if
(
!
data
->
wtmpnam_buffer
)
data
->
wtmpnam_buffer
=
MSVCRT_malloc
(
sizeof
(
MSVCRT_wchar_t
[
MAX_PATH
]));
s
=
data
->
wtmpnam_buffer
;
}
msvcrt_int_to_base32_w
(
GetCurrentProcessId
(),
tmpstr
);
p
=
s
+
MSVCRT__snwprintf
(
s
,
MAX_PATH
,
format
,
tmpstr
);
for
(
count
=
0
;
count
<
MSVCRT_TMP_MAX
;
count
++
)
...
...
dlls/msvcrt/msvcrt.h
View file @
abb3db5c
...
...
@@ -169,7 +169,9 @@ struct __thread_data {
unsigned
char
*
mbstok_next
;
/* next ptr for mbstok() */
char
*
strerror_buffer
;
/* buffer for strerror */
MSVCRT_wchar_t
*
wcserror_buffer
;
/* buffer for wcserror */
void
*
unk2
[
4
];
char
*
tmpnam_buffer
;
/* buffer for tmpname() */
MSVCRT_wchar_t
*
wtmpnam_buffer
;
/* buffer for wtmpname() */
void
*
unk2
[
2
];
char
*
asctime_buffer
;
/* buffer for asctime */
MSVCRT_wchar_t
*
wasctime_buffer
;
/* buffer for wasctime */
struct
MSVCRT_tm
*
time_buffer
;
/* buffer for localtime/gmtime */
...
...
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