Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
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
Hide 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);
static
NTSTATUS
(
WINAPI
*
pRtlFlsAlloc
)(
PFLS_CALLBACK_FUNCTION
,
DWORD
*
);
static
NTSTATUS
(
WINAPI
*
pRtlFlsFree
)(
ULONG
);
static
NTSTATUS
(
WINAPI
*
pRtlFlsSetValue
)(
ULONG
,
void
*
);
static
NTSTATUS
(
WINAPI
*
pRtlFlsGetValue
)(
ULONG
,
void
**
);
static
void
*
fibers
[
3
];
static
BYTE
testparam
=
185
;
static
DWORD
fls_index_to_set
=
FLS_OUT_OF_INDEXES
;
...
...
@@ -72,6 +73,7 @@ static VOID init_funcs(void)
X
(
RtlFlsAlloc
);
X
(
RtlFlsFree
);
X
(
RtlFlsSetValue
);
X
(
RtlFlsGetValue
);
#undef X
}
...
...
@@ -205,6 +207,16 @@ static void test_FiberLocalStorage(void)
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
)
{
fls_indices
[
i
]
=
0xdeadbeef
;
...
...
@@ -225,8 +237,21 @@ static void test_FiberLocalStorage(void)
/* FLS limits are increased since Win10 18312. */
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
)
{
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
]);
ok
(
!
status
,
"Got unexpected status %#x.
\n
"
,
status
);
}
...
...
@@ -250,6 +275,14 @@ static void test_FiberLocalStorage(void)
ok
(
val
==
NULL
,
"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
);
ok
(
ret
,
"setting fls index 127 (unallocated) failed with error %u
\n
"
,
GetLastError
()
);
...
...
@@ -259,6 +292,14 @@ static void test_FiberLocalStorage(void)
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"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
* ERROR_INVALID_PARAMETER
*/
...
...
@@ -283,6 +324,14 @@ static void test_FiberLocalStorage(void)
val
=
pFlsGetValue
(
0
);
ok
(
!
val
,
"fls index 0 set to %p
\n
"
,
val
);
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
);
ret
=
pFlsSetValue
(
0
,
(
void
*
)
0xdeadbeef
);
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 )
*/
PVOID
WINAPI
DECLSPEC_HOTPATCH
FlsGetValue
(
DWORD
index
)
{
if
(
!
index
||
index
>=
8
*
sizeof
(
NtCurrentTeb
()
->
Peb
->
FlsBitmapBits
)
||
!
NtCurrentTeb
()
->
FlsSlots
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
NULL
;
}
void
*
data
;
if
(
!
set_ntstatus
(
RtlFlsGetValue
(
index
,
&
data
)))
return
NULL
;
SetLastError
(
ERROR_SUCCESS
);
return
NtCurrentTeb
()
->
FlsSlots
[
index
]
;
return
data
;
}
...
...
dlls/ntdll/ntdll.spec
View file @
defcbc8b
...
...
@@ -668,6 +668,7 @@
@ stdcall RtlFirstFreeAce(ptr ptr)
@ stdcall RtlFlsAlloc(ptr ptr)
@ stdcall RtlFlsFree(long)
@ stdcall RtlFlsGetValue(long ptr)
@ stdcall RtlFlsSetValue(long ptr)
@ stub RtlFlushPropertySet
# @ stub RtlFlushSecureMemoryCache
...
...
dlls/ntdll/thread.c
View file @
defcbc8b
...
...
@@ -329,3 +329,17 @@ NTSTATUS WINAPI DECLSPEC_HOTPATCH RtlFlsSetValue( ULONG index, void *data )
NtCurrentTeb
()
->
FlsSlots
[
index
]
=
data
;
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
NTSYSAPI
BOOLEAN
WINAPI
RtlFirstFreeAce
(
PACL
,
PACE_HEADER
*
);
NTSYSAPI
NTSTATUS
WINAPI
RtlFlsAlloc
(
PFLS_CALLBACK_FUNCTION
,
ULONG
*
);
NTSYSAPI
NTSTATUS
WINAPI
RtlFlsFree
(
ULONG
);
NTSYSAPI
NTSTATUS
WINAPI
RtlFlsGetValue
(
ULONG
,
void
**
);
NTSYSAPI
NTSTATUS
WINAPI
RtlFlsSetValue
(
ULONG
,
void
*
);
NTSYSAPI
NTSTATUS
WINAPI
RtlFormatCurrentUserKeyPath
(
PUNICODE_STRING
);
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