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
ae21ddb0
Commit
ae21ddb0
authored
Aug 04, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wow64: Add support for jumping to 32-bit code in Wow64LdrpInitialize().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9f24bc44
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
7 deletions
+83
-7
process.c
dlls/wow64/process.c
+15
-0
sync.c
dlls/wow64/sync.c
+9
-0
syscall.c
dlls/wow64/syscall.c
+57
-7
syscall.h
dlls/wow64/syscall.h
+2
-0
No files found.
dlls/wow64/process.c
View file @
ae21ddb0
...
...
@@ -310,6 +310,21 @@ NTSTATUS WINAPI wow64_NtAssignProcessToJobObject( UINT *args )
/**********************************************************************
* wow64_NtContinue
*/
NTSTATUS
WINAPI
wow64_NtContinue
(
UINT
*
args
)
{
void
*
context
=
get_ptr
(
&
args
);
BOOLEAN
alertable
=
get_ulong
(
&
args
);
NtSetInformationThread
(
GetCurrentThread
(),
ThreadWow64Context
,
context
,
get_machine_context_size
(
current_machine
));
if
(
alertable
)
NtTestAlert
();
return
STATUS_SUCCESS
;
}
/**********************************************************************
* wow64_NtCreateThread
*/
NTSTATUS
WINAPI
wow64_NtCreateThread
(
UINT
*
args
)
...
...
dlls/wow64/sync.c
View file @
ae21ddb0
...
...
@@ -1462,6 +1462,15 @@ NTSTATUS WINAPI wow64_NtTerminateJobObject( UINT *args )
/**********************************************************************
* wow64_NtTestAlert
*/
NTSTATUS
WINAPI
wow64_NtTestAlert
(
UINT
*
args
)
{
return
NtTestAlert
();
}
/**********************************************************************
* wow64_NtWaitForDebugEvent
*/
NTSTATUS
WINAPI
wow64_NtWaitForDebugEvent
(
UINT
*
args
)
...
...
dlls/wow64/syscall.c
View file @
ae21ddb0
...
...
@@ -393,7 +393,7 @@ static HMODULE load_cpu_dll(void)
/**********************************************************************
* process_init
*/
static
void
process_init
(
void
)
static
DWORD
WINAPI
process_init
(
RTL_RUN_ONCE
*
once
,
void
*
param
,
void
**
context
)
{
HMODULE
module
;
UNICODE_STRING
str
;
...
...
@@ -421,12 +421,64 @@ static void process_init(void)
*
pWow64Transition
=
*
p__wine_syscall_dispatcher
=
pBTCpuGetBopCode
();
init_file_redirects
();
return
TRUE
;
#undef GET_PTR
}
/**********************************************************************
* thread_init
*/
static
void
thread_init
(
void
)
{
/* update initial context to jump to 32-bit LdrInitializeThunk (cf. 32-bit call_init_thunk) */
switch
(
current_machine
)
{
case
IMAGE_FILE_MACHINE_I386
:
{
I386_CONTEXT
*
ctx_ptr
,
ctx
=
{
CONTEXT_I386_ALL
};
ULONG
*
stack
;
NtQueryInformationThread
(
GetCurrentThread
(),
ThreadWow64Context
,
&
ctx
,
sizeof
(
ctx
),
NULL
);
ctx_ptr
=
(
I386_CONTEXT
*
)
ULongToPtr
(
ctx
.
Esp
)
-
1
;
*
ctx_ptr
=
ctx
;
stack
=
(
ULONG
*
)
ctx_ptr
;
*
(
--
stack
)
=
0
;
*
(
--
stack
)
=
0
;
*
(
--
stack
)
=
0
;
*
(
--
stack
)
=
PtrToUlong
(
ctx_ptr
);
*
(
--
stack
)
=
0xdeadbabe
;
ctx
.
Esp
=
PtrToUlong
(
stack
);
ctx
.
Eip
=
pLdrSystemDllInitBlock
->
pLdrInitializeThunk
;
NtSetInformationThread
(
GetCurrentThread
(),
ThreadWow64Context
,
&
ctx
,
sizeof
(
ctx
)
);
}
break
;
case
IMAGE_FILE_MACHINE_ARMNT
:
{
ARM_CONTEXT
*
ctx_ptr
,
ctx
=
{
CONTEXT_ARM_ALL
};
NtQueryInformationThread
(
GetCurrentThread
(),
ThreadWow64Context
,
&
ctx
,
sizeof
(
ctx
),
NULL
);
ctx_ptr
=
(
ARM_CONTEXT
*
)
ULongToPtr
(
ctx
.
Sp
&
~
15
)
-
1
;
*
ctx_ptr
=
ctx
;
ctx
.
R0
=
PtrToUlong
(
ctx_ptr
);
ctx
.
Sp
=
PtrToUlong
(
ctx_ptr
);
ctx
.
Pc
=
pLdrSystemDllInitBlock
->
pLdrInitializeThunk
;
NtSetInformationThread
(
GetCurrentThread
(),
ThreadWow64Context
,
&
ctx
,
sizeof
(
ctx
)
);
}
break
;
default:
ERR
(
"not supported machine %x
\n
"
,
current_machine
);
NtTerminateProcess
(
GetCurrentProcess
(),
STATUS_INVALID_IMAGE_FORMAT
);
}
}
/**********************************************************************
* free_temp_data
*/
static
void
free_temp_data
(
void
)
...
...
@@ -500,11 +552,9 @@ void WINAPI Wow64ApcRoutine( ULONG_PTR arg1, ULONG_PTR arg2, ULONG_PTR arg3, CON
*/
void
WINAPI
Wow64LdrpInitialize
(
CONTEXT
*
context
)
{
static
BOOL
init_done
;
static
RTL_RUN_ONCE
init_done
;
if
(
!
init_done
)
{
init_done
=
TRUE
;
process_init
();
}
RtlRunOnceExecuteOnce
(
&
init_done
,
process_init
,
NULL
,
NULL
);
thread_init
();
pBTCpuSimulate
();
}
dlls/wow64/syscall.h
View file @
ae21ddb0
...
...
@@ -43,6 +43,7 @@
SYSCALL_ENTRY( NtClose ) \
SYSCALL_ENTRY( NtCompleteConnectPort ) \
SYSCALL_ENTRY( NtConnectPort ) \
SYSCALL_ENTRY( NtContinue ) \
SYSCALL_ENTRY( NtCreateDebugObject ) \
SYSCALL_ENTRY( NtCreateDirectoryObject ) \
SYSCALL_ENTRY( NtCreateEvent ) \
...
...
@@ -217,6 +218,7 @@
SYSCALL_ENTRY( NtTerminateJobObject ) \
SYSCALL_ENTRY( NtTerminateProcess ) \
SYSCALL_ENTRY( NtTerminateThread ) \
SYSCALL_ENTRY( NtTestAlert ) \
SYSCALL_ENTRY( NtUnloadDriver ) \
SYSCALL_ENTRY( NtUnloadKey ) \
SYSCALL_ENTRY( NtUnlockFile ) \
...
...
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