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
f3d90fd5
Commit
f3d90fd5
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 old-style Wow64 mode.
parent
da7411fd
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
22 additions
and
33 deletions
+22
-33
file.c
dlls/ntdll/unix/file.c
+1
-1
process.c
dlls/ntdll/unix/process.c
+1
-3
server.c
dlls/ntdll/unix/server.c
+1
-7
signal_i386.c
dlls/ntdll/unix/signal_i386.c
+6
-6
system.c
dlls/ntdll/unix/system.c
+1
-3
thread.c
dlls/ntdll/unix/thread.c
+3
-7
unix_private.h
dlls/ntdll/unix/unix_private.h
+6
-3
virtual.c
dlls/ntdll/unix/virtual.c
+3
-3
No files found.
dlls/ntdll/unix/file.c
View file @
f3d90fd5
...
...
@@ -2997,7 +2997,7 @@ void init_files(void)
HANDLE
key
;
#ifndef _WIN64
if
(
is_
wow64
)
init_redirects
();
if
(
is_
old_wow64
()
)
init_redirects
();
#endif
/* a couple of directories that we don't want to return in directory searches */
ignore_file
(
config_dir
);
...
...
dlls/ntdll/unix/process.c
View file @
f3d90fd5
...
...
@@ -1152,15 +1152,13 @@ NTSTATUS WINAPI NtQueryInformationProcess( HANDLE handle, PROCESSINFOCLASS class
pbi
.
BasePriority
=
reply
->
priority
;
pbi
.
UniqueProcessId
=
reply
->
pid
;
pbi
.
InheritedFromUniqueProcessId
=
reply
->
ppid
;
#ifndef _WIN64
if
(
is_wow64
)
if
(
is_old_wow64
())
{
if
(
reply
->
machine
!=
native_machine
)
pbi
.
PebBaseAddress
=
(
PEB
*
)((
char
*
)
pbi
.
PebBaseAddress
+
0x1000
);
else
pbi
.
PebBaseAddress
=
NULL
;
}
#endif
}
}
SERVER_END_REQ
;
...
...
dlls/ntdll/unix/server.c
View file @
f3d90fd5
...
...
@@ -96,9 +96,6 @@ unsigned int supported_machines_count = 0;
USHORT
supported_machines
[
8
]
=
{
0
};
USHORT
native_machine
=
0
;
BOOL
process_exiting
=
FALSE
;
#ifndef _WIN64
BOOL
is_wow64
=
FALSE
;
#endif
timeout_t
server_start_time
=
0
;
/* time of server startup */
...
...
@@ -576,10 +573,8 @@ static void invoke_system_apc( const apc_call_t *call, apc_result_t *result, BOO
if
(
reserve
==
call
->
create_thread
.
reserve
&&
commit
==
call
->
create_thread
.
commit
&&
(
ULONG_PTR
)
func
==
call
->
create_thread
.
func
&&
(
ULONG_PTR
)
arg
==
call
->
create_thread
.
arg
)
{
#ifndef _WIN64
/* FIXME: hack for debugging 32-bit process without a 64-bit ntdll */
if
(
is_wow64
&&
func
==
(
void
*
)
0x7ffe1000
)
func
=
pDbgUiRemoteBreakin
;
#endif
if
(
is_old_wow64
()
&&
func
==
(
void
*
)
0x7ffe1000
)
func
=
pDbgUiRemoteBreakin
;
attr
->
TotalLength
=
sizeof
(
buffer
);
attr
->
Attributes
[
0
].
Attribute
=
PS_ATTRIBUTE_CLIENT_ID
;
attr
->
Attributes
[
0
].
Size
=
sizeof
(
id
);
...
...
@@ -1579,7 +1574,6 @@ size_t server_init_process(void)
if
(
arch
&&
!
strcmp
(
arch
,
"win32"
))
fatal_error
(
"WINEARCH set to win32 but '%s' is a 64-bit installation.
\n
"
,
config_dir
);
#ifndef _WIN64
is_wow64
=
TRUE
;
NtCurrentTeb
()
->
GdiBatchCount
=
PtrToUlong
(
(
char
*
)
NtCurrentTeb
()
-
teb_offset
);
NtCurrentTeb
()
->
WowTebOffset
=
-
teb_offset
;
wow_peb
=
(
PEB64
*
)((
char
*
)
peb
-
page_size
);
...
...
dlls/ntdll/unix/signal_i386.c
View file @
f3d90fd5
...
...
@@ -869,7 +869,7 @@ NTSTATUS signal_set_full_context( CONTEXT *context )
*/
void
*
get_native_context
(
CONTEXT
*
context
)
{
return
is_
wow64
?
NULL
:
context
;
return
is_
old_wow64
()
?
NULL
:
context
;
}
...
...
@@ -878,7 +878,7 @@ void *get_native_context( CONTEXT *context )
*/
void
*
get_wow_context
(
CONTEXT
*
context
)
{
return
is_
wow64
?
context
:
NULL
;
return
is_
old_wow64
()
?
context
:
NULL
;
}
...
...
@@ -1731,7 +1731,7 @@ static BOOL handle_interrupt( unsigned int interrupt, ucontext_t *sigcontext, vo
NtRaiseException
(
rec
,
context
,
FALSE
);
return
TRUE
;
case
0x2d
:
if
(
!
is_
wow64
)
if
(
!
is_
old_wow64
()
)
{
/* On Wow64, the upper DWORD of Rax contains garbage, and the debug
* service is usually not recognized when called from usermode. */
...
...
@@ -1748,7 +1748,7 @@ static BOOL handle_interrupt( unsigned int interrupt, ucontext_t *sigcontext, vo
context
->
Eip
+=
3
;
rec
->
ExceptionCode
=
EXCEPTION_BREAKPOINT
;
rec
->
ExceptionAddress
=
(
void
*
)
context
->
Eip
;
rec
->
NumberParameters
=
is_
wow64
?
1
:
3
;
rec
->
NumberParameters
=
is_
old_wow64
()
?
1
:
3
;
rec
->
ExceptionInformation
[
0
]
=
context
->
Eax
;
rec
->
ExceptionInformation
[
1
]
=
context
->
Ecx
;
rec
->
ExceptionInformation
[
2
]
=
context
->
Edx
;
...
...
@@ -1974,7 +1974,7 @@ static void trap_handler( int signal, siginfo_t *siginfo, void *sigcontext )
/* fall through */
default
:
rec
.
ExceptionCode
=
EXCEPTION_BREAKPOINT
;
rec
.
NumberParameters
=
is_
wow64
?
1
:
3
;
rec
.
NumberParameters
=
is_
old_wow64
()
?
1
:
3
;
rec
.
ExceptionInformation
[
0
]
=
0
;
rec
.
ExceptionInformation
[
1
]
=
0
;
/* FIXME */
rec
.
ExceptionInformation
[
2
]
=
0
;
/* FIXME */
...
...
@@ -2018,7 +2018,7 @@ static void fpe_handler( int signal, siginfo_t *siginfo, void *sigcontext )
rec
.
ExceptionCode
=
STATUS_FLOAT_MULTIPLE_TRAPS
;
rec
.
ExceptionInformation
[
rec
.
NumberParameters
++
]
=
0
;
if
(
is_
wow64
)
rec
.
ExceptionInformation
[
rec
.
NumberParameters
++
]
=
((
XSAVE_FORMAT
*
)
xcontext
.
c
.
ExtendedRegisters
)
->
MxCsr
;
if
(
is_
old_wow64
()
)
rec
.
ExceptionInformation
[
rec
.
NumberParameters
++
]
=
((
XSAVE_FORMAT
*
)
xcontext
.
c
.
ExtendedRegisters
)
->
MxCsr
;
break
;
default
:
WINE_ERR
(
"Got unexpected trap %d
\n
"
,
TRAP_sig
(
ucontext
)
);
...
...
dlls/ntdll/unix/system.c
View file @
f3d90fd5
...
...
@@ -2572,10 +2572,8 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
{
SYSTEM_CPU_INFORMATION
cpu
=
cpu_info
;
#ifndef _WIN64
if
(
is_wow64
&&
cpu
.
ProcessorArchitecture
==
PROCESSOR_ARCHITECTURE_INTEL
)
if
(
is_old_wow64
()
&&
cpu
.
ProcessorArchitecture
==
PROCESSOR_ARCHITECTURE_INTEL
)
cpu
.
ProcessorArchitecture
=
PROCESSOR_ARCHITECTURE_AMD64
;
#endif
memcpy
(
info
,
&
cpu
,
len
);
}
else
ret
=
STATUS_INFO_LENGTH_MISMATCH
;
...
...
dlls/ntdll/unix/thread.c
View file @
f3d90fd5
...
...
@@ -1290,7 +1290,7 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle, ACCESS_MASK access, OBJECT_ATT
if
(
zero_bits
>
21
&&
zero_bits
<
32
)
return
STATUS_INVALID_PARAMETER_3
;
#ifndef _WIN64
if
(
!
is_
wow64
&&
zero_bits
>=
32
)
return
STATUS_INVALID_PARAMETER_3
;
if
(
!
is_
old_wow64
()
&&
zero_bits
>=
32
)
return
STATUS_INVALID_PARAMETER_3
;
#endif
if
(
process
!=
NtCurrentProcess
())
...
...
@@ -1950,14 +1950,13 @@ static void set_native_thread_name( HANDLE handle, const UNICODE_STRING *name )
#endif
}
#ifndef _WIN64
static
BOOL
is_process_wow64
(
const
CLIENT_ID
*
id
)
{
HANDLE
handle
;
ULONG_PTR
info
;
BOOL
ret
=
FALSE
;
if
(
id
->
UniqueProcess
==
ULongToHandle
(
GetCurrentProcessId
()))
return
is_
wow64
;
if
(
id
->
UniqueProcess
==
ULongToHandle
(
GetCurrentProcessId
()))
return
is_
old_wow64
()
;
if
(
!
NtOpenProcess
(
&
handle
,
PROCESS_QUERY_LIMITED_INFORMATION
,
NULL
,
id
))
{
if
(
!
NtQueryInformationProcess
(
handle
,
ProcessWow64Information
,
&
info
,
sizeof
(
info
),
NULL
))
...
...
@@ -1966,7 +1965,6 @@ static BOOL is_process_wow64( const CLIENT_ID *id )
}
return
ret
;
}
#endif
/******************************************************************************
* NtQueryInformationThread (NTDLL.@)
...
...
@@ -2002,15 +2000,13 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
SERVER_END_REQ
;
if
(
status
==
STATUS_SUCCESS
)
{
#ifndef _WIN64
if
(
is_wow64
)
if
(
is_old_wow64
())
{
if
(
is_process_wow64
(
&
info
.
ClientId
))
info
.
TebBaseAddress
=
(
char
*
)
info
.
TebBaseAddress
+
teb_offset
;
else
info
.
TebBaseAddress
=
NULL
;
}
#endif
if
(
data
)
memcpy
(
data
,
&
info
,
min
(
length
,
sizeof
(
info
)
));
if
(
ret_len
)
*
ret_len
=
min
(
length
,
sizeof
(
info
)
);
}
...
...
dlls/ntdll/unix/unix_private.h
View file @
f3d90fd5
...
...
@@ -138,9 +138,6 @@ extern timeout_t server_start_time DECLSPEC_HIDDEN;
extern
sigset_t
server_block_set
DECLSPEC_HIDDEN
;
extern
struct
_KUSER_SHARED_DATA
*
user_shared_data
DECLSPEC_HIDDEN
;
extern
SYSTEM_CPU_INFORMATION
cpu_info
DECLSPEC_HIDDEN
;
#ifndef _WIN64
extern
BOOL
is_wow64
DECLSPEC_HIDDEN
;
#endif
#ifdef __i386__
extern
struct
ldt_copy
__wine_ldt_copy
DECLSPEC_HIDDEN
;
#endif
...
...
@@ -446,6 +443,12 @@ 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
{
LO_INVALID
,
...
...
dlls/ntdll/unix/virtual.c
View file @
f3d90fd5
...
...
@@ -3848,7 +3848,7 @@ NTSTATUS WINAPI NtAllocateVirtualMemory( HANDLE process, PVOID *ret, ULONG_PTR z
if
(
zero_bits
>
21
&&
zero_bits
<
32
)
return
STATUS_INVALID_PARAMETER_3
;
if
(
zero_bits
>
32
&&
zero_bits
<
granularity_mask
)
return
STATUS_INVALID_PARAMETER_3
;
#ifndef _WIN64
if
(
!
is_
wow64
&&
zero_bits
>=
32
)
return
STATUS_INVALID_PARAMETER_3
;
if
(
!
is_
old_wow64
()
&&
zero_bits
>=
32
)
return
STATUS_INVALID_PARAMETER_3
;
#endif
if
(
process
!=
NtCurrentProcess
())
...
...
@@ -4648,7 +4648,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
return
STATUS_INVALID_PARAMETER_4
;
#ifndef _WIN64
if
(
!
is_
wow64
)
if
(
!
is_
old_wow64
()
)
{
if
(
zero_bits
>=
32
)
return
STATUS_INVALID_PARAMETER_4
;
if
(
alloc_type
&
AT_ROUND_TO_PAGE
)
...
...
@@ -5330,7 +5330,7 @@ NTSTATUS WINAPI NtWow64GetNativeSystemInformation( SYSTEM_INFORMATION_CLASS clas
case
SystemNativeBasicInformation
:
return
NtQuerySystemInformation
(
SystemBasicInformation
,
info
,
len
,
retlen
);
default:
if
(
is_
wow64
)
return
STATUS_INVALID_INFO_CLASS
;
if
(
is_
old_wow64
()
)
return
STATUS_INVALID_INFO_CLASS
;
return
NtQuerySystemInformation
(
class
,
info
,
len
,
retlen
);
}
}
...
...
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