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
dd7b4431
Commit
dd7b4431
authored
Mar 23, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Add a helper function to check for Wow64 mode.
parent
f3d90fd5
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
37 additions
and
36 deletions
+37
-36
process.c
dlls/ntdll/unix/process.c
+3
-3
server.c
dlls/ntdll/unix/server.c
+1
-1
system.c
dlls/ntdll/unix/system.c
+1
-1
thread.c
dlls/ntdll/unix/thread.c
+1
-1
unix_private.h
dlls/ntdll/unix/unix_private.h
+29
-27
virtual.c
dlls/ntdll/unix/virtual.c
+2
-3
No files found.
dlls/ntdll/unix/process.c
View file @
dd7b4431
...
@@ -1434,7 +1434,7 @@ NTSTATUS WINAPI NtQueryInformationProcess( HANDLE handle, PROCESSINFOCLASS class
...
@@ -1434,7 +1434,7 @@ NTSTATUS WINAPI NtQueryInformationProcess( HANDLE handle, PROCESSINFOCLASS class
if
(
size
!=
len
)
ret
=
STATUS_INFO_LENGTH_MISMATCH
;
if
(
size
!=
len
)
ret
=
STATUS_INFO_LENGTH_MISMATCH
;
else
if
(
!
info
)
ret
=
STATUS_ACCESS_VIOLATION
;
else
if
(
!
info
)
ret
=
STATUS_ACCESS_VIOLATION
;
else
if
(
!
handle
)
ret
=
STATUS_INVALID_HANDLE
;
else
if
(
!
handle
)
ret
=
STATUS_INVALID_HANDLE
;
else
if
(
handle
==
GetCurrentProcess
())
*
(
ULONG_PTR
*
)
info
=
!!
NtCurrentTeb
()
->
WowTebOffset
;
else
if
(
handle
==
GetCurrentProcess
())
*
(
ULONG_PTR
*
)
info
=
is_wow64
()
;
else
else
{
{
ULONG_PTR
val
=
0
;
ULONG_PTR
val
=
0
;
...
@@ -1476,7 +1476,7 @@ NTSTATUS WINAPI NtQueryInformationProcess( HANDLE handle, PROCESSINFOCLASS class
...
@@ -1476,7 +1476,7 @@ NTSTATUS WINAPI NtQueryInformationProcess( HANDLE handle, PROCESSINFOCLASS class
len
=
sizeof
(
ULONG
);
len
=
sizeof
(
ULONG
);
if
(
size
!=
len
)
if
(
size
!=
len
)
ret
=
STATUS_INFO_LENGTH_MISMATCH
;
ret
=
STATUS_INFO_LENGTH_MISMATCH
;
else
if
(
is_win64
&&
!
NtCurrentTeb
()
->
WowTebOffset
)
else
if
(
is_win64
&&
!
is_wow64
()
)
*
(
ULONG
*
)
info
=
MEM_EXECUTE_OPTION_DISABLE
|
*
(
ULONG
*
)
info
=
MEM_EXECUTE_OPTION_DISABLE
|
MEM_EXECUTE_OPTION_DISABLE_THUNK_EMULATION
|
MEM_EXECUTE_OPTION_DISABLE_THUNK_EMULATION
|
MEM_EXECUTE_OPTION_PERMANENT
;
MEM_EXECUTE_OPTION_PERMANENT
;
...
@@ -1639,7 +1639,7 @@ NTSTATUS WINAPI NtSetInformationProcess( HANDLE handle, PROCESSINFOCLASS class,
...
@@ -1639,7 +1639,7 @@ NTSTATUS WINAPI NtSetInformationProcess( HANDLE handle, PROCESSINFOCLASS class,
break
;
break
;
case
ProcessExecuteFlags
:
case
ProcessExecuteFlags
:
if
((
is_win64
&&
!
NtCurrentTeb
()
->
WowTebOffset
)
||
size
!=
sizeof
(
ULONG
))
return
STATUS_INVALID_PARAMETER
;
if
((
is_win64
&&
!
is_wow64
()
)
||
size
!=
sizeof
(
ULONG
))
return
STATUS_INVALID_PARAMETER
;
if
(
execute_flags
&
MEM_EXECUTE_OPTION_PERMANENT
)
return
STATUS_ACCESS_DENIED
;
if
(
execute_flags
&
MEM_EXECUTE_OPTION_PERMANENT
)
return
STATUS_ACCESS_DENIED
;
else
else
{
{
...
...
dlls/ntdll/unix/server.c
View file @
dd7b4431
...
@@ -419,7 +419,7 @@ static void invoke_system_apc( const apc_call_t *call, apc_result_t *result, BOO
...
@@ -419,7 +419,7 @@ static void invoke_system_apc( const apc_call_t *call, apc_result_t *result, BOO
};
};
SYSTEM_BASIC_INFORMATION
sbi
;
SYSTEM_BASIC_INFORMATION
sbi
;
virtual_get_system_info
(
&
sbi
,
!!
NtCurrentTeb
()
->
WowTebOffset
);
virtual_get_system_info
(
&
sbi
,
is_wow64
()
);
result
->
type
=
call
->
type
;
result
->
type
=
call
->
type
;
addr
=
wine_server_get_ptr
(
call
->
virtual_alloc_ex
.
addr
);
addr
=
wine_server_get_ptr
(
call
->
virtual_alloc_ex
.
addr
);
size
=
call
->
virtual_alloc_ex
.
size
;
size
=
call
->
virtual_alloc_ex
.
size
;
...
...
dlls/ntdll/unix/system.c
View file @
dd7b4431
...
@@ -2998,7 +2998,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
...
@@ -2998,7 +2998,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
{
{
SYSTEM_BASIC_INFORMATION
sbi
;
SYSTEM_BASIC_INFORMATION
sbi
;
virtual_get_system_info
(
&
sbi
,
!!
NtCurrentTeb
()
->
WowTebOffset
);
virtual_get_system_info
(
&
sbi
,
is_wow64
()
);
len
=
sizeof
(
sbi
);
len
=
sizeof
(
sbi
);
if
(
size
==
len
)
if
(
size
==
len
)
{
{
...
...
dlls/ntdll/unix/thread.c
View file @
dd7b4431
...
@@ -1130,7 +1130,7 @@ void *get_cpu_area( USHORT machine )
...
@@ -1130,7 +1130,7 @@ void *get_cpu_area( USHORT machine )
WOW64_CPURESERVED
*
cpu
;
WOW64_CPURESERVED
*
cpu
;
ULONG
align
;
ULONG
align
;
if
(
!
NtCurrentTeb
()
->
WowTebOffset
)
return
NULL
;
if
(
!
is_wow64
()
)
return
NULL
;
#ifdef _WIN64
#ifdef _WIN64
cpu
=
NtCurrentTeb
()
->
TlsSlots
[
WOW64_TLS_CPURESERVED
];
cpu
=
NtCurrentTeb
()
->
TlsSlots
[
WOW64_TLS_CPURESERVED
];
#else
#else
...
...
dlls/ntdll/unix/unix_private.h
View file @
dd7b4431
...
@@ -52,6 +52,34 @@ static inline BOOL is_machine_64bit( WORD machine )
...
@@ -52,6 +52,34 @@ static inline BOOL is_machine_64bit( WORD machine )
return
(
machine
==
IMAGE_FILE_MACHINE_AMD64
||
machine
==
IMAGE_FILE_MACHINE_ARM64
);
return
(
machine
==
IMAGE_FILE_MACHINE_AMD64
||
machine
==
IMAGE_FILE_MACHINE_ARM64
);
}
}
#ifdef _WIN64
typedef
TEB32
WOW_TEB
;
typedef
PEB32
WOW_PEB
;
static
inline
TEB64
*
NtCurrentTeb64
(
void
)
{
return
NULL
;
}
#else
typedef
TEB64
WOW_TEB
;
typedef
PEB64
WOW_PEB
;
static
inline
TEB64
*
NtCurrentTeb64
(
void
)
{
return
(
TEB64
*
)
NtCurrentTeb
()
->
GdiBatchCount
;
}
#endif
extern
WOW_PEB
*
wow_peb
DECLSPEC_HIDDEN
;
static
inline
WOW_TEB
*
get_wow_teb
(
TEB
*
teb
)
{
return
teb
->
WowTebOffset
?
(
WOW_TEB
*
)((
char
*
)
teb
+
teb
->
WowTebOffset
)
:
NULL
;
}
static
inline
BOOL
is_wow64
(
void
)
{
return
!!
wow_peb
;
}
/* check for old-style Wow64 (using a 32-bit ntdll.so) */
static
inline
BOOL
is_old_wow64
(
void
)
{
return
!
is_win64
&&
wow_peb
;
}
/* thread private data, stored in NtCurrentTeb()->GdiTebBatch */
/* thread private data, stored in NtCurrentTeb()->GdiTebBatch */
struct
ntdll_thread_data
struct
ntdll_thread_data
{
{
...
@@ -366,10 +394,7 @@ static inline NTSTATUS wait_async( HANDLE handle, BOOL alertable )
...
@@ -366,10 +394,7 @@ static inline NTSTATUS wait_async( HANDLE handle, BOOL alertable )
static
inline
BOOL
in_wow64_call
(
void
)
static
inline
BOOL
in_wow64_call
(
void
)
{
{
#ifdef _WIN64
return
is_win64
&&
is_wow64
();
return
!!
NtCurrentTeb
()
->
WowTebOffset
;
#endif
return
FALSE
;
}
}
static
inline
void
set_async_iosb
(
client_ptr_t
iosb
,
NTSTATUS
status
,
ULONG_PTR
info
)
static
inline
void
set_async_iosb
(
client_ptr_t
iosb
,
NTSTATUS
status
,
ULONG_PTR
info
)
...
@@ -426,29 +451,6 @@ static inline client_ptr_t iosb_client_ptr( IO_STATUS_BLOCK *io )
...
@@ -426,29 +451,6 @@ static inline client_ptr_t iosb_client_ptr( IO_STATUS_BLOCK *io )
return
wine_server_client_ptr
(
io
);
return
wine_server_client_ptr
(
io
);
}
}
#ifdef _WIN64
typedef
TEB32
WOW_TEB
;
typedef
PEB32
WOW_PEB
;
static
inline
TEB64
*
NtCurrentTeb64
(
void
)
{
return
NULL
;
}
#else
typedef
TEB64
WOW_TEB
;
typedef
PEB64
WOW_PEB
;
static
inline
TEB64
*
NtCurrentTeb64
(
void
)
{
return
(
TEB64
*
)
NtCurrentTeb
()
->
GdiBatchCount
;
}
#endif
extern
WOW_PEB
*
wow_peb
DECLSPEC_HIDDEN
;
static
inline
WOW_TEB
*
get_wow_teb
(
TEB
*
teb
)
{
return
teb
->
WowTebOffset
?
(
WOW_TEB
*
)((
char
*
)
teb
+
teb
->
WowTebOffset
)
:
NULL
;
}
/* check for old-style Wow64 (using a 32-bit ntdll.so) */
static
inline
BOOL
is_old_wow64
(
void
)
{
return
!
is_win64
&&
wow_peb
;
}
enum
loadorder
enum
loadorder
{
{
LO_INVALID
,
LO_INVALID
,
...
...
dlls/ntdll/unix/virtual.c
View file @
dd7b4431
...
@@ -2974,7 +2974,6 @@ NTSTATUS virtual_alloc_teb( TEB **ret_teb )
...
@@ -2974,7 +2974,6 @@ NTSTATUS virtual_alloc_teb( TEB **ret_teb )
void
*
ptr
=
NULL
;
void
*
ptr
=
NULL
;
NTSTATUS
status
=
STATUS_SUCCESS
;
NTSTATUS
status
=
STATUS_SUCCESS
;
SIZE_T
block_size
=
signal_stack_mask
+
1
;
SIZE_T
block_size
=
signal_stack_mask
+
1
;
BOOL
is_wow
=
!!
NtCurrentTeb
()
->
WowTebOffset
;
server_enter_uninterrupted_section
(
&
virtual_mutex
,
&
sigset
);
server_enter_uninterrupted_section
(
&
virtual_mutex
,
&
sigset
);
if
(
next_free_teb
)
if
(
next_free_teb
)
...
@@ -2989,7 +2988,7 @@ NTSTATUS virtual_alloc_teb( TEB **ret_teb )
...
@@ -2989,7 +2988,7 @@ NTSTATUS virtual_alloc_teb( TEB **ret_teb )
{
{
SIZE_T
total
=
32
*
block_size
;
SIZE_T
total
=
32
*
block_size
;
if
((
status
=
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
&
ptr
,
is_win64
&&
is_wow
?
0x7fffffff
:
0
,
if
((
status
=
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
&
ptr
,
is_win64
&&
is_wow
64
()
?
0x7fffffff
:
0
,
&
total
,
MEM_RESERVE
,
PAGE_READWRITE
)))
&
total
,
MEM_RESERVE
,
PAGE_READWRITE
)))
{
{
server_leave_uninterrupted_section
(
&
virtual_mutex
,
&
sigset
);
server_leave_uninterrupted_section
(
&
virtual_mutex
,
&
sigset
);
...
@@ -3002,7 +3001,7 @@ NTSTATUS virtual_alloc_teb( TEB **ret_teb )
...
@@ -3002,7 +3001,7 @@ NTSTATUS virtual_alloc_teb( TEB **ret_teb )
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
(
void
**
)
&
ptr
,
0
,
&
block_size
,
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
(
void
**
)
&
ptr
,
0
,
&
block_size
,
MEM_COMMIT
,
PAGE_READWRITE
);
MEM_COMMIT
,
PAGE_READWRITE
);
}
}
*
ret_teb
=
teb
=
init_teb
(
ptr
,
is_wow
);
*
ret_teb
=
teb
=
init_teb
(
ptr
,
is_wow
64
()
);
server_leave_uninterrupted_section
(
&
virtual_mutex
,
&
sigset
);
server_leave_uninterrupted_section
(
&
virtual_mutex
,
&
sigset
);
if
((
status
=
signal_alloc_thread
(
teb
)))
if
((
status
=
signal_alloc_thread
(
teb
)))
...
...
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