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
42dec97d
Commit
42dec97d
authored
Jul 22, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wow64: Load the backend cpu dll at process init.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c5168261
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
1 deletion
+101
-1
syscall.c
dlls/wow64/syscall.c
+60
-1
wow64_private.h
dlls/wow64/wow64_private.h
+41
-0
No files found.
dlls/wow64/syscall.c
View file @
42dec97d
...
...
@@ -27,10 +27,14 @@
#include "winnt.h"
#include "winternl.h"
#include "wine/exception.h"
#include "wow64_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
wow
);
USHORT
native_machine
=
0
;
USHORT
current_machine
=
0
;
void
*
dummy
=
RtlUnwind
;
BOOL
WINAPI
DllMain
(
HINSTANCE
inst
,
DWORD
reason
,
void
*
reserved
)
...
...
@@ -55,6 +59,55 @@ void __cdecl __wine_spec_unimplemented_stub( const char *module, const char *fun
/**********************************************************************
* load_cpu_dll
*/
static
HMODULE
load_cpu_dll
(
void
)
{
NTSTATUS
status
;
HMODULE
module
;
UNICODE_STRING
str
;
WCHAR
path
[
MAX_PATH
];
const
WCHAR
*
dir
,
*
name
;
switch
(
current_machine
)
{
case
IMAGE_FILE_MACHINE_I386
:
name
=
(
native_machine
==
IMAGE_FILE_MACHINE_ARM64
?
L"xtajit.dll"
:
L"wow64cpu.dll"
);
break
;
case
IMAGE_FILE_MACHINE_ARM
:
name
=
L"wowarmhw.dll"
;
break
;
default:
ERR
(
"unsupported machine %04x
\n
"
,
current_machine
);
RtlExitUserProcess
(
1
);
}
dir
=
get_machine_wow64_dir
(
IMAGE_FILE_MACHINE_TARGET_HOST
);
swprintf
(
path
,
MAX_PATH
,
L"%s
\\
%s"
,
dir
,
name
);
RtlInitUnicodeString
(
&
str
,
path
);
if
((
status
=
LdrLoadDll
(
NULL
,
0
,
&
str
,
&
module
)))
{
ERR
(
"failed to load CPU dll %x
\n
"
,
status
);
NtTerminateProcess
(
GetCurrentProcess
(),
status
);
}
return
module
;
}
/**********************************************************************
* process_init
*/
static
void
process_init
(
void
)
{
RtlWow64GetProcessMachines
(
GetCurrentProcess
(),
&
current_machine
,
&
native_machine
);
if
(
!
current_machine
)
current_machine
=
native_machine
;
load_cpu_dll
();
}
/**********************************************************************
* Wow64SystemServiceEx (NTDLL.@)
*/
NTSTATUS
WINAPI
Wow64SystemServiceEx
(
UINT
num
,
UINT
*
args
)
...
...
@@ -69,5 +122,11 @@ NTSTATUS WINAPI Wow64SystemServiceEx( UINT num, UINT *args )
*/
void
WINAPI
Wow64LdrpInitialize
(
CONTEXT
*
context
)
{
FIXME
(
"stub
\n
"
);
static
BOOL
init_done
;
if
(
!
init_done
)
{
init_done
=
TRUE
;
process_init
();
}
}
dlls/wow64/wow64_private.h
0 → 100644
View file @
42dec97d
/*
* WoW64 private definitions
*
* Copyright 2021 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WOW64_PRIVATE_H
#define __WOW64_PRIVATE_H
extern
USHORT
native_machine
DECLSPEC_HIDDEN
;
extern
USHORT
current_machine
DECLSPEC_HIDDEN
;
/* cf. GetSystemWow64Directory2 */
static
inline
const
WCHAR
*
get_machine_wow64_dir
(
USHORT
machine
)
{
switch
(
machine
)
{
case
IMAGE_FILE_MACHINE_TARGET_HOST
:
return
L"
\\
??
\\
C:
\\
windows
\\
system32"
;
case
IMAGE_FILE_MACHINE_I386
:
return
L"
\\
??
\\
C:
\\
windows
\\
syswow64"
;
case
IMAGE_FILE_MACHINE_ARMNT
:
return
L"
\\
??
\\
C:
\\
windows
\\
sysarm32"
;
case
IMAGE_FILE_MACHINE_AMD64
:
return
L"
\\
??
\\
C:
\\
windows
\\
sysx8664"
;
case
IMAGE_FILE_MACHINE_ARM64
:
return
L"
\\
??
\\
C:
\\
windows
\\
sysarm64"
;
default:
return
NULL
;
}
}
#endif
/* __WOW64_PRIVATE_H */
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