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
bcbd83d1
Commit
bcbd83d1
authored
Nov 09, 2014
by
Iván Matellanes
Committed by
Alexandre Julliard
Nov 10, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Added _fread_nolock_s implementation.
parent
e4f9f537
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
67 additions
and
7 deletions
+67
-7
msvcr100.spec
dlls/msvcr100/msvcr100.spec
+1
-1
msvcr100.c
dlls/msvcr100/tests/msvcr100.c
+35
-0
msvcr110.spec
dlls/msvcr110/msvcr110.spec
+1
-1
msvcr120.spec
dlls/msvcr120/msvcr120.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
+24
-2
msvcrt.h
dlls/msvcrt/msvcrt.h
+1
-0
stdio.h
include/msvcrt/stdio.h
+2
-0
No files found.
dlls/msvcr100/msvcr100.spec
View file @
bcbd83d1
...
...
@@ -835,7 +835,7 @@
@ cdecl _fputwc_nolock(long ptr) MSVCRT__fputwc_nolock
@ cdecl _fputwchar(long) MSVCRT__fputwchar
@ cdecl _fread_nolock(ptr long long ptr) MSVCRT__fread_nolock
@
stub
_fread_nolock_s
@
cdecl _fread_nolock_s(ptr long long long ptr) MSVCRT_
_fread_nolock_s
@ cdecl _free_locale(ptr) MSVCRT__free_locale
@ stub _freea
@ stub _freea_s
...
...
dlls/msvcr100/tests/msvcr100.c
View file @
bcbd83d1
...
...
@@ -140,6 +140,8 @@ static int (__cdecl *p_wmemmove_s)(wchar_t *dest, size_t numberOfElements, const
static
FILE
*
(
__cdecl
*
p_fopen
)(
const
char
*
,
const
char
*
);
static
int
(
__cdecl
*
p_fclose
)(
FILE
*
);
static
size_t
(
__cdecl
*
p_fread_s
)(
void
*
,
size_t
,
size_t
,
size_t
,
FILE
*
);
static
void
(
__cdecl
*
p_lock_file
)(
FILE
*
);
static
void
(
__cdecl
*
p_unlock_file
)(
FILE
*
);
static
void
*
(
__cdecl
*
p__aligned_offset_malloc
)(
size_t
,
size_t
,
size_t
);
static
void
(
__cdecl
*
p__aligned_free
)(
void
*
);
static
size_t
(
__cdecl
*
p__aligned_msize
)(
void
*
,
size_t
,
size_t
);
...
...
@@ -178,6 +180,8 @@ static BOOL init(void)
SET
(
p_fopen
,
"fopen"
);
SET
(
p_fclose
,
"fclose"
);
SET
(
p_fread_s
,
"fread_s"
);
SET
(
p_lock_file
,
"_lock_file"
);
SET
(
p_unlock_file
,
"_unlock_file"
);
SET
(
p__aligned_offset_malloc
,
"_aligned_offset_malloc"
);
SET
(
p__aligned_free
,
"_aligned_free"
);
SET
(
p__aligned_msize
,
"_aligned_msize"
);
...
...
@@ -357,11 +361,30 @@ static void test_wmemmove_s(void)
"Cannot reset invalid parameter handler
\n
"
);
}
struct
block_file_arg
{
FILE
*
test_file
;
HANDLE
init
;
HANDLE
finish
;
};
static
DWORD
WINAPI
block_file
(
void
*
arg
)
{
struct
block_file_arg
*
files
=
arg
;
p_lock_file
(
files
->
test_file
);
SetEvent
(
files
->
init
);
WaitForSingleObject
(
files
->
finish
,
INFINITE
);
p_unlock_file
(
files
->
test_file
);
return
0
;
}
static
void
test_fread_s
(
void
)
{
static
const
char
test_file
[]
=
"fread_s.tst"
;
int
ret
;
char
buf
[
10
];
HANDLE
thread
;
struct
block_file_arg
arg
;
FILE
*
f
=
fopen
(
test_file
,
"w"
);
if
(
!
f
)
{
...
...
@@ -382,6 +405,12 @@ static void test_fread_s(void)
CHECK_CALLED
(
invalid_parameter_handler
);
f
=
p_fopen
(
test_file
,
"r"
);
arg
.
test_file
=
f
;
arg
.
init
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
);
arg
.
finish
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
);
thread
=
CreateThread
(
NULL
,
0
,
block_file
,
(
void
*
)
&
arg
,
0
,
NULL
);
WaitForSingleObject
(
arg
.
init
,
INFINITE
);
errno
=
0xdeadbeef
;
ret
=
p_fread_s
(
NULL
,
sizeof
(
buf
),
0
,
1
,
f
);
ok
(
ret
==
0
,
"fread_s returned %d, expected 0
\n
"
,
ret
);
...
...
@@ -390,6 +419,9 @@ static void test_fread_s(void)
ok
(
ret
==
0
,
"fread_s returned %d, expected 0
\n
"
,
ret
);
ok
(
errno
==
0xdeadbeef
,
"errno = %d, expected 0xdeadbeef
\n
"
,
errno
);
SetEvent
(
arg
.
finish
);
WaitForSingleObject
(
thread
,
INFINITE
);
SET_EXPECT
(
invalid_parameter_handler
);
errno
=
0xdeadbeef
;
ret
=
p_fread_s
(
NULL
,
sizeof
(
buf
),
1
,
1
,
f
);
...
...
@@ -426,6 +458,9 @@ static void test_fread_s(void)
ok
(
p_set_invalid_parameter_handler
(
NULL
)
==
test_invalid_parameter_handler
,
"Cannot reset invalid parameter handler
\n
"
);
CloseHandle
(
arg
.
init
);
CloseHandle
(
arg
.
finish
);
CloseHandle
(
thread
);
unlink
(
test_file
);
}
...
...
dlls/msvcr110/msvcr110.spec
View file @
bcbd83d1
...
...
@@ -1183,7 +1183,7 @@
@ cdecl _fputwc_nolock(long ptr) MSVCRT__fputwc_nolock
@ cdecl _fputwchar(long) MSVCRT__fputwchar
@ cdecl _fread_nolock(ptr long long ptr) MSVCRT__fread_nolock
@
stub
_fread_nolock_s
@
cdecl _fread_nolock_s(ptr long long long ptr) MSVCRT_
_fread_nolock_s
@ cdecl _free_locale(ptr) MSVCRT__free_locale
@ stub _freea
@ stub _freea_s
...
...
dlls/msvcr120/msvcr120.spec
View file @
bcbd83d1
...
...
@@ -1181,7 +1181,7 @@
@ cdecl _fputwc_nolock(long ptr) MSVCRT__fputwc_nolock
@ cdecl _fputwchar(long) MSVCRT__fputwchar
@ cdecl _fread_nolock(ptr long long ptr) MSVCRT__fread_nolock
@
stub
_fread_nolock_s
@
cdecl _fread_nolock_s(ptr long long long ptr) MSVCRT_
_fread_nolock_s
@ cdecl _free_locale(ptr) MSVCRT__free_locale
@ stub _freea
@ stub _freea_s
...
...
dlls/msvcr80/msvcr80.spec
View file @
bcbd83d1
...
...
@@ -502,7 +502,7 @@
@ cdecl _fputwc_nolock(long ptr) MSVCRT__fputwc_nolock
@ cdecl _fputwchar(long) MSVCRT__fputwchar
@ cdecl _fread_nolock(ptr long long ptr) MSVCRT__fread_nolock
@
stub
_fread_nolock_s
@
cdecl _fread_nolock_s(ptr long long long ptr) MSVCRT_
_fread_nolock_s
@ cdecl _free_locale(ptr) MSVCRT__free_locale
@ stub _freea
@ stub _freea_s
...
...
dlls/msvcr90/msvcr90.spec
View file @
bcbd83d1
...
...
@@ -484,7 +484,7 @@
@ cdecl _fputwc_nolock(long ptr) MSVCRT__fputwc_nolock
@ cdecl _fputwchar(long) MSVCRT__fputwchar
@ cdecl _fread_nolock(ptr long long ptr) MSVCRT__fread_nolock
@
stub
_fread_nolock_s
@
cdecl _fread_nolock_s(ptr long long long ptr) MSVCRT_
_fread_nolock_s
@ cdecl _free_locale(ptr) MSVCRT__free_locale
@ stub _freea
@ stub _freea_s
...
...
dlls/msvcrt/file.c
View file @
bcbd83d1
...
...
@@ -4130,9 +4130,31 @@ MSVCRT_size_t CDECL MSVCRT__fread_nolock(void *ptr, MSVCRT_size_t size, MSVCRT_s
MSVCRT_size_t
CDECL
MSVCRT_fread_s
(
void
*
buf
,
MSVCRT_size_t
buf_size
,
MSVCRT_size_t
elem_size
,
MSVCRT_size_t
count
,
MSVCRT_FILE
*
stream
)
{
MSVCRT_size_t
ret
;
if
(
!
MSVCRT_CHECK_PMT
(
stream
!=
NULL
))
{
if
(
buf
&&
buf_size
)
memset
(
buf
,
0
,
buf_size
);
return
0
;
}
if
(
!
elem_size
||
!
count
)
return
0
;
MSVCRT__lock_file
(
stream
);
ret
=
MSVCRT__fread_nolock_s
(
buf
,
buf_size
,
elem_size
,
count
,
stream
);
MSVCRT__unlock_file
(
stream
);
return
ret
;
}
/*********************************************************************
* _fread_nolock_s (MSVCR80.@)
*/
MSVCRT_size_t
CDECL
MSVCRT__fread_nolock_s
(
void
*
buf
,
MSVCRT_size_t
buf_size
,
MSVCRT_size_t
elem_size
,
MSVCRT_size_t
count
,
MSVCRT_FILE
*
stream
)
{
size_t
bytes_left
,
buf_pos
;
TRACE
(
"(%p %lu %lu %lu %p
\n
"
,
buf
,
buf_size
,
elem_size
,
count
,
stream
);
TRACE
(
"(%p %lu %lu %lu %p
)
\n
"
,
buf
,
buf_size
,
elem_size
,
count
,
stream
);
if
(
!
MSVCRT_CHECK_PMT
(
stream
!=
NULL
))
{
if
(
buf
&&
buf_size
)
...
...
@@ -4154,7 +4176,7 @@ MSVCRT_size_t CDECL MSVCRT_fread_s(void *buf, MSVCRT_size_t buf_size, MSVCRT_siz
return
0
;
}
MSVCRT_
fread
((
char
*
)
buf
+
buf_pos
,
1
,
size
,
stream
);
MSVCRT_
_fread_nolock
((
char
*
)
buf
+
buf_pos
,
1
,
size
,
stream
);
buf_pos
+=
size
;
bytes_left
-=
size
;
}
else
{
...
...
dlls/msvcrt/msvcrt.h
View file @
bcbd83d1
...
...
@@ -934,6 +934,7 @@ MSVCRT_ulong* __cdecl MSVCRT___doserrno(void);
int
*
__cdecl
MSVCRT__errno
(
void
);
char
*
__cdecl
MSVCRT_getenv
(
const
char
*
);
MSVCRT_size_t
__cdecl
MSVCRT__fread_nolock
(
void
*
,
MSVCRT_size_t
,
MSVCRT_size_t
,
MSVCRT_FILE
*
);
MSVCRT_size_t
__cdecl
MSVCRT__fread_nolock_s
(
void
*
,
MSVCRT_size_t
,
MSVCRT_size_t
,
MSVCRT_size_t
,
MSVCRT_FILE
*
);
MSVCRT_size_t
__cdecl
MSVCRT__fwrite_nolock
(
const
void
*
,
MSVCRT_size_t
,
MSVCRT_size_t
,
MSVCRT_FILE
*
);
int
__cdecl
MSVCRT_fclose
(
MSVCRT_FILE
*
);
int
__cdecl
MSVCRT__fclose_nolock
(
MSVCRT_FILE
*
);
...
...
include/msvcrt/stdio.h
View file @
bcbd83d1
...
...
@@ -128,6 +128,7 @@ int __cdecl _vsnprintf_s(char*,size_t,size_t,const char*,__ms_va_list);
int
__cdecl
_vsprintf_p_l
(
char
*
,
size_t
,
const
char
*
,
_locale_t
,
__ms_va_list
);
size_t
__cdecl
_fread_nolock
(
void
*
,
size_t
,
size_t
,
FILE
*
);
size_t
__cdecl
_fread_nolock_s
(
void
*
,
size_t
,
size_t
,
size_t
,
FILE
*
);
size_t
__cdecl
_fwrite_nolock
(
const
void
*
,
size_t
,
size_t
,
FILE
*
);
int
__cdecl
_fclose_nolock
(
FILE
*
);
int
__cdecl
_fflush_nolock
(
FILE
*
);
...
...
@@ -156,6 +157,7 @@ int __cdecl fprintf_s(FILE*,const char*,...);
int
__cdecl
fputc
(
int
,
FILE
*
);
int
__cdecl
fputs
(
const
char
*
,
FILE
*
);
size_t
__cdecl
fread
(
void
*
,
size_t
,
size_t
,
FILE
*
);
size_t
__cdecl
fread_s
(
void
*
,
size_t
,
size_t
,
size_t
,
FILE
*
);
FILE
*
__cdecl
freopen
(
const
char
*
,
const
char
*
,
FILE
*
);
int
__cdecl
fscanf
(
FILE
*
,
const
char
*
,...);
int
__cdecl
fscanf_s
(
FILE
*
,
const
char
*
,...);
...
...
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