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
defcbc8b
Commit
defcbc8b
authored
Sep 29, 2020
by
Paul Gofman
Committed by
Alexandre Julliard
Oct 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Move FlsGetValue() implementation to ntdll.RtlFlsGetValue().
Signed-off-by:
Paul Gofman
<
pgofman@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e596f404
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
6 deletions
+69
-6
fiber.c
dlls/kernel32/tests/fiber.c
+49
-0
thread.c
dlls/kernelbase/thread.c
+4
-6
ntdll.spec
dlls/ntdll/ntdll.spec
+1
-0
thread.c
dlls/ntdll/thread.c
+14
-0
winternl.h
include/winternl.h
+1
-0
No files found.
dlls/kernel32/tests/fiber.c
View file @
defcbc8b
...
@@ -40,6 +40,7 @@ static BOOL (WINAPI *pFlsSetValue)(DWORD,PVOID);
...
@@ -40,6 +40,7 @@ static BOOL (WINAPI *pFlsSetValue)(DWORD,PVOID);
static
NTSTATUS
(
WINAPI
*
pRtlFlsAlloc
)(
PFLS_CALLBACK_FUNCTION
,
DWORD
*
);
static
NTSTATUS
(
WINAPI
*
pRtlFlsAlloc
)(
PFLS_CALLBACK_FUNCTION
,
DWORD
*
);
static
NTSTATUS
(
WINAPI
*
pRtlFlsFree
)(
ULONG
);
static
NTSTATUS
(
WINAPI
*
pRtlFlsFree
)(
ULONG
);
static
NTSTATUS
(
WINAPI
*
pRtlFlsSetValue
)(
ULONG
,
void
*
);
static
NTSTATUS
(
WINAPI
*
pRtlFlsSetValue
)(
ULONG
,
void
*
);
static
NTSTATUS
(
WINAPI
*
pRtlFlsGetValue
)(
ULONG
,
void
**
);
static
void
*
fibers
[
3
];
static
void
*
fibers
[
3
];
static
BYTE
testparam
=
185
;
static
BYTE
testparam
=
185
;
static
DWORD
fls_index_to_set
=
FLS_OUT_OF_INDEXES
;
static
DWORD
fls_index_to_set
=
FLS_OUT_OF_INDEXES
;
...
@@ -72,6 +73,7 @@ static VOID init_funcs(void)
...
@@ -72,6 +73,7 @@ static VOID init_funcs(void)
X
(
RtlFlsAlloc
);
X
(
RtlFlsAlloc
);
X
(
RtlFlsFree
);
X
(
RtlFlsFree
);
X
(
RtlFlsSetValue
);
X
(
RtlFlsSetValue
);
X
(
RtlFlsGetValue
);
#undef X
#undef X
}
}
...
@@ -205,6 +207,16 @@ static void test_FiberLocalStorage(void)
...
@@ -205,6 +207,16 @@ static void test_FiberLocalStorage(void)
if
(
pRtlFlsAlloc
)
if
(
pRtlFlsAlloc
)
{
{
if
(
pRtlFlsGetValue
)
{
status
=
pRtlFlsGetValue
(
0
,
NULL
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"Got unexpected status %#x.
\n
"
,
status
);
}
else
{
win_skip
(
"RtlFlsGetValue is not available.
\n
"
);
}
for
(
i
=
0
;
i
<
FLS_TEST_INDEX_COUNT
;
++
i
)
for
(
i
=
0
;
i
<
FLS_TEST_INDEX_COUNT
;
++
i
)
{
{
fls_indices
[
i
]
=
0xdeadbeef
;
fls_indices
[
i
]
=
0xdeadbeef
;
...
@@ -225,8 +237,21 @@ static void test_FiberLocalStorage(void)
...
@@ -225,8 +237,21 @@ static void test_FiberLocalStorage(void)
/* FLS limits are increased since Win10 18312. */
/* FLS limits are increased since Win10 18312. */
ok
(
count
&&
(
count
<=
127
||
(
count
>
4000
&&
count
<
4096
)),
"Got unexpected count %u.
\n
"
,
count
);
ok
(
count
&&
(
count
<=
127
||
(
count
>
4000
&&
count
<
4096
)),
"Got unexpected count %u.
\n
"
,
count
);
if
(
0
)
{
/* crashes on Windows. */
pRtlFlsGetValue
(
fls_indices
[
0
],
NULL
);
}
for
(
i
=
0
;
i
<
count
;
++
i
)
for
(
i
=
0
;
i
<
count
;
++
i
)
{
{
if
(
pRtlFlsGetValue
)
{
status
=
pRtlFlsGetValue
(
fls_indices
[
i
],
&
val
);
ok
(
!
status
,
"Got unexpected status %#x.
\n
"
,
status
);
ok
(
val
==
(
void
*
)(
ULONG_PTR
)(
i
+
1
),
"Got unexpected val %p.
\n
"
,
val
);
}
status
=
pRtlFlsFree
(
fls_indices
[
i
]);
status
=
pRtlFlsFree
(
fls_indices
[
i
]);
ok
(
!
status
,
"Got unexpected status %#x.
\n
"
,
status
);
ok
(
!
status
,
"Got unexpected status %#x.
\n
"
,
status
);
}
}
...
@@ -250,6 +275,14 @@ static void test_FiberLocalStorage(void)
...
@@ -250,6 +275,14 @@ static void test_FiberLocalStorage(void)
ok
(
val
==
NULL
,
ok
(
val
==
NULL
,
"getting fls index 127 (unallocated) failed with error %u
\n
"
,
GetLastError
()
);
"getting fls index 127 (unallocated) failed with error %u
\n
"
,
GetLastError
()
);
if
(
pRtlFlsGetValue
)
{
val
=
(
void
*
)
0xdeadbeef
;
status
=
pRtlFlsGetValue
(
127
,
&
val
);
ok
(
!
status
,
"Got unexpected status %#x.
\n
"
,
status
);
ok
(
!
val
,
"Got unexpected val %p.
\n
"
,
val
);
}
ret
=
pFlsSetValue
(
127
,
(
void
*
)
0x217
);
ret
=
pFlsSetValue
(
127
,
(
void
*
)
0x217
);
ok
(
ret
,
"setting fls index 127 (unallocated) failed with error %u
\n
"
,
GetLastError
()
);
ok
(
ret
,
"setting fls index 127 (unallocated) failed with error %u
\n
"
,
GetLastError
()
);
...
@@ -259,6 +292,14 @@ static void test_FiberLocalStorage(void)
...
@@ -259,6 +292,14 @@ static void test_FiberLocalStorage(void)
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"getting fls index 127 (unallocated) failed with error %u
\n
"
,
GetLastError
()
);
"getting fls index 127 (unallocated) failed with error %u
\n
"
,
GetLastError
()
);
if
(
pRtlFlsGetValue
)
{
val
=
(
void
*
)
0xdeadbeef
;
status
=
pRtlFlsGetValue
(
127
,
&
val
);
ok
(
!
status
,
"Got unexpected status %#x.
\n
"
,
status
);
ok
(
val
==
(
void
*
)
0x217
,
"Got unexpected val %p.
\n
"
,
val
);
}
/* FlsFree, FlsGetValue, and FlsSetValue out of bounds should return
/* FlsFree, FlsGetValue, and FlsSetValue out of bounds should return
* ERROR_INVALID_PARAMETER
* ERROR_INVALID_PARAMETER
*/
*/
...
@@ -283,6 +324,14 @@ static void test_FiberLocalStorage(void)
...
@@ -283,6 +324,14 @@ static void test_FiberLocalStorage(void)
val
=
pFlsGetValue
(
0
);
val
=
pFlsGetValue
(
0
);
ok
(
!
val
,
"fls index 0 set to %p
\n
"
,
val
);
ok
(
!
val
,
"fls index 0 set to %p
\n
"
,
val
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"setting fls index wrong error %u
\n
"
,
GetLastError
()
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"setting fls index wrong error %u
\n
"
,
GetLastError
()
);
if
(
pRtlFlsGetValue
)
{
val
=
(
void
*
)
0xdeadbeef
;
status
=
pRtlFlsGetValue
(
0
,
&
val
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"Got unexpected status %#x.
\n
"
,
status
);
ok
(
val
==
(
void
*
)
0xdeadbeef
,
"Got unexpected val %p.
\n
"
,
val
);
}
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
ret
=
pFlsSetValue
(
0
,
(
void
*
)
0xdeadbeef
);
ret
=
pFlsSetValue
(
0
,
(
void
*
)
0xdeadbeef
);
ok
(
!
ret
,
"setting fls index 0 succeeded
\n
"
);
ok
(
!
ret
,
"setting fls index 0 succeeded
\n
"
);
...
...
dlls/kernelbase/thread.c
View file @
defcbc8b
...
@@ -1086,13 +1086,11 @@ BOOL WINAPI DECLSPEC_HOTPATCH FlsFree( DWORD index )
...
@@ -1086,13 +1086,11 @@ BOOL WINAPI DECLSPEC_HOTPATCH FlsFree( DWORD index )
*/
*/
PVOID
WINAPI
DECLSPEC_HOTPATCH
FlsGetValue
(
DWORD
index
)
PVOID
WINAPI
DECLSPEC_HOTPATCH
FlsGetValue
(
DWORD
index
)
{
{
if
(
!
index
||
index
>=
8
*
sizeof
(
NtCurrentTeb
()
->
Peb
->
FlsBitmapBits
)
||
!
NtCurrentTeb
()
->
FlsSlots
)
void
*
data
;
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
if
(
!
set_ntstatus
(
RtlFlsGetValue
(
index
,
&
data
)))
return
NULL
;
return
NULL
;
}
SetLastError
(
ERROR_SUCCESS
);
SetLastError
(
ERROR_SUCCESS
);
return
NtCurrentTeb
()
->
FlsSlots
[
index
]
;
return
data
;
}
}
...
...
dlls/ntdll/ntdll.spec
View file @
defcbc8b
...
@@ -668,6 +668,7 @@
...
@@ -668,6 +668,7 @@
@ stdcall RtlFirstFreeAce(ptr ptr)
@ stdcall RtlFirstFreeAce(ptr ptr)
@ stdcall RtlFlsAlloc(ptr ptr)
@ stdcall RtlFlsAlloc(ptr ptr)
@ stdcall RtlFlsFree(long)
@ stdcall RtlFlsFree(long)
@ stdcall RtlFlsGetValue(long ptr)
@ stdcall RtlFlsSetValue(long ptr)
@ stdcall RtlFlsSetValue(long ptr)
@ stub RtlFlushPropertySet
@ stub RtlFlushPropertySet
# @ stub RtlFlushSecureMemoryCache
# @ stub RtlFlushSecureMemoryCache
...
...
dlls/ntdll/thread.c
View file @
defcbc8b
...
@@ -329,3 +329,17 @@ NTSTATUS WINAPI DECLSPEC_HOTPATCH RtlFlsSetValue( ULONG index, void *data )
...
@@ -329,3 +329,17 @@ NTSTATUS WINAPI DECLSPEC_HOTPATCH RtlFlsSetValue( ULONG index, void *data )
NtCurrentTeb
()
->
FlsSlots
[
index
]
=
data
;
NtCurrentTeb
()
->
FlsSlots
[
index
]
=
data
;
return
STATUS_SUCCESS
;
return
STATUS_SUCCESS
;
}
}
/***********************************************************************
* RtlFlsGetValue (NTDLL.@)
*/
NTSTATUS
WINAPI
DECLSPEC_HOTPATCH
RtlFlsGetValue
(
ULONG
index
,
void
**
data
)
{
if
(
!
index
||
index
>=
8
*
sizeof
(
NtCurrentTeb
()
->
Peb
->
FlsBitmapBits
)
||
!
NtCurrentTeb
()
->
FlsSlots
)
return
STATUS_INVALID_PARAMETER
;
*
data
=
NtCurrentTeb
()
->
FlsSlots
[
index
];
return
STATUS_SUCCESS
;
}
include/winternl.h
View file @
defcbc8b
...
@@ -3373,6 +3373,7 @@ NTSYSAPI ULONG WINAPI RtlFindSetRuns(PCRTL_BITMAP,PRTL_BITMAP_RUN,ULONG,BOOL
...
@@ -3373,6 +3373,7 @@ NTSYSAPI ULONG WINAPI RtlFindSetRuns(PCRTL_BITMAP,PRTL_BITMAP_RUN,ULONG,BOOL
NTSYSAPI
BOOLEAN
WINAPI
RtlFirstFreeAce
(
PACL
,
PACE_HEADER
*
);
NTSYSAPI
BOOLEAN
WINAPI
RtlFirstFreeAce
(
PACL
,
PACE_HEADER
*
);
NTSYSAPI
NTSTATUS
WINAPI
RtlFlsAlloc
(
PFLS_CALLBACK_FUNCTION
,
ULONG
*
);
NTSYSAPI
NTSTATUS
WINAPI
RtlFlsAlloc
(
PFLS_CALLBACK_FUNCTION
,
ULONG
*
);
NTSYSAPI
NTSTATUS
WINAPI
RtlFlsFree
(
ULONG
);
NTSYSAPI
NTSTATUS
WINAPI
RtlFlsFree
(
ULONG
);
NTSYSAPI
NTSTATUS
WINAPI
RtlFlsGetValue
(
ULONG
,
void
**
);
NTSYSAPI
NTSTATUS
WINAPI
RtlFlsSetValue
(
ULONG
,
void
*
);
NTSYSAPI
NTSTATUS
WINAPI
RtlFlsSetValue
(
ULONG
,
void
*
);
NTSYSAPI
NTSTATUS
WINAPI
RtlFormatCurrentUserKeyPath
(
PUNICODE_STRING
);
NTSYSAPI
NTSTATUS
WINAPI
RtlFormatCurrentUserKeyPath
(
PUNICODE_STRING
);
NTSYSAPI
NTSTATUS
WINAPI
RtlFormatMessage
(
LPCWSTR
,
ULONG
,
BOOLEAN
,
BOOLEAN
,
BOOLEAN
,
__ms_va_list
*
,
LPWSTR
,
ULONG
,
ULONG
*
);
NTSYSAPI
NTSTATUS
WINAPI
RtlFormatMessage
(
LPCWSTR
,
ULONG
,
BOOLEAN
,
BOOLEAN
,
BOOLEAN
,
__ms_va_list
*
,
LPWSTR
,
ULONG
,
ULONG
*
);
...
...
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