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
0ffbec44
Commit
0ffbec44
authored
Jun 25, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Initialize the RealClientId field in the TEB.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
38d863f1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
0 deletions
+35
-0
process.c
dlls/kernel32/tests/process.c
+33
-0
thread.c
dlls/ntdll/unix/thread.c
+2
-0
No files found.
dlls/kernel32/tests/process.c
View file @
0ffbec44
...
...
@@ -80,6 +80,7 @@ static BOOL (WINAPI *pSetInformationJobObject)(HANDLE job, JOBOBJECTINFOCLASS
static
HANDLE
(
WINAPI
*
pCreateIoCompletionPort
)(
HANDLE
file
,
HANDLE
existing_port
,
ULONG_PTR
key
,
DWORD
threads
);
static
BOOL
(
WINAPI
*
pGetNumaProcessorNode
)(
UCHAR
,
PUCHAR
);
static
NTSTATUS
(
WINAPI
*
pNtQueryInformationProcess
)(
HANDLE
,
PROCESSINFOCLASS
,
PVOID
,
ULONG
,
PULONG
);
static
NTSTATUS
(
WINAPI
*
pNtQueryInformationThread
)(
HANDLE
,
THREADINFOCLASS
,
PVOID
,
ULONG
,
PULONG
);
static
NTSTATUS
(
WINAPI
*
pNtQuerySystemInformationEx
)(
SYSTEM_INFORMATION_CLASS
,
void
*
,
ULONG
,
void
*
,
ULONG
,
ULONG
*
);
static
DWORD
(
WINAPI
*
pWTSGetActiveConsoleSessionId
)(
void
);
static
HANDLE
(
WINAPI
*
pCreateToolhelp32Snapshot
)(
DWORD
,
DWORD
);
...
...
@@ -248,6 +249,7 @@ static BOOL init(void)
hntdll
=
GetModuleHandleA
(
"ntdll.dll"
);
pNtQueryInformationProcess
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtQueryInformationProcess"
);
pNtQueryInformationThread
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtQueryInformationThread"
);
pNtQuerySystemInformationEx
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtQuerySystemInformationEx"
);
pGetNativeSystemInfo
=
(
void
*
)
GetProcAddress
(
hkernel32
,
"GetNativeSystemInfo"
);
...
...
@@ -3517,6 +3519,37 @@ static void test_SuspendProcessState(void)
ok
(
child_peb
.
OSPlatformId
==
VER_PLATFORM_WIN32_NT
,
"OSPlatformId not set %u
\n
"
,
child_peb
.
OSPlatformId
);
ok
(
child_peb
.
SessionId
==
1
,
"SessionId not set %u
\n
"
,
child_peb
.
SessionId
);
if
(
pNtQueryInformationThread
)
{
TEB
child_teb
;
THREAD_BASIC_INFORMATION
info
;
NTSTATUS
status
=
pNtQueryInformationThread
(
pi
.
hThread
,
ThreadBasicInformation
,
&
info
,
sizeof
(
info
),
NULL
);
ok
(
!
status
,
"NtQueryInformationProcess failed %x
\n
"
,
status
);
ret
=
ReadProcessMemory
(
pi
.
hProcess
,
info
.
TebBaseAddress
,
&
child_teb
,
sizeof
(
child_teb
),
NULL
);
ok
(
ret
,
"Failed to read TEB (%u)
\n
"
,
GetLastError
()
);
ok
(
child_teb
.
Peb
==
peb_ptr
,
"wrong Peb %p / %p
\n
"
,
child_teb
.
Peb
,
peb_ptr
);
ok
(
PtrToUlong
(
child_teb
.
ClientId
.
UniqueProcess
)
==
pi
.
dwProcessId
,
"wrong pid %x / %x
\n
"
,
PtrToUlong
(
child_teb
.
ClientId
.
UniqueProcess
),
pi
.
dwProcessId
);
ok
(
PtrToUlong
(
child_teb
.
ClientId
.
UniqueThread
)
==
pi
.
dwThreadId
,
"wrong tid %x / %x
\n
"
,
PtrToUlong
(
child_teb
.
ClientId
.
UniqueThread
),
pi
.
dwThreadId
);
ok
(
PtrToUlong
(
child_teb
.
RealClientId
.
UniqueProcess
)
==
pi
.
dwProcessId
,
"wrong real pid %x / %x
\n
"
,
PtrToUlong
(
child_teb
.
RealClientId
.
UniqueProcess
),
pi
.
dwProcessId
);
ok
(
PtrToUlong
(
child_teb
.
RealClientId
.
UniqueThread
)
==
pi
.
dwThreadId
,
"wrong real tid %x / %x
\n
"
,
PtrToUlong
(
child_teb
.
RealClientId
.
UniqueThread
),
pi
.
dwThreadId
);
ok
(
child_teb
.
StaticUnicodeString
.
MaximumLength
==
sizeof
(
child_teb
.
StaticUnicodeBuffer
),
"StaticUnicodeString.MaximumLength wrong %x
\n
"
,
child_teb
.
StaticUnicodeString
.
MaximumLength
);
ok
(
(
char
*
)
child_teb
.
StaticUnicodeString
.
Buffer
==
(
char
*
)
info
.
TebBaseAddress
+
offsetof
(
TEB
,
StaticUnicodeBuffer
),
"StaticUnicodeString.Buffer wrong %p
\n
"
,
child_teb
.
StaticUnicodeString
.
Buffer
);
ok
(
!
child_teb
.
CurrentLocale
,
"CurrentLocale set %x
\n
"
,
child_teb
.
CurrentLocale
);
ok
(
!
child_teb
.
TlsLinks
.
Flink
,
"TlsLinks.Flink set %p
\n
"
,
child_teb
.
TlsLinks
.
Flink
);
ok
(
!
child_teb
.
TlsLinks
.
Blink
,
"TlsLinks.Blink set %p
\n
"
,
child_teb
.
TlsLinks
.
Blink
);
ok
(
!
child_teb
.
TlsExpansionSlots
,
"TlsExpansionSlots set %p
\n
"
,
child_teb
.
TlsExpansionSlots
);
ok
(
!
child_teb
.
FlsSlots
,
"FlsSlots set %p
\n
"
,
child_teb
.
FlsSlots
);
}
ret
=
SetThreadContext
(
pi
.
hThread
,
&
ctx
);
ok
(
ret
,
"Failed to set remote thread context (%d)
\n
"
,
GetLastError
());
...
...
dlls/ntdll/unix/thread.c
View file @
0ffbec44
...
...
@@ -761,10 +761,12 @@ void set_thread_id( TEB *teb, DWORD pid, DWORD tid )
teb
->
ClientId
.
UniqueProcess
=
ULongToHandle
(
pid
);
teb
->
ClientId
.
UniqueThread
=
ULongToHandle
(
tid
);
teb
->
RealClientId
=
teb
->
ClientId
;
if
(
wow_teb
)
{
wow_teb
->
ClientId
.
UniqueProcess
=
pid
;
wow_teb
->
ClientId
.
UniqueThread
=
tid
;
wow_teb
->
RealClientId
=
wow_teb
->
ClientId
;
}
}
...
...
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