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
2a8a4cbb
Commit
2a8a4cbb
authored
Mar 31, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Move kernel32 loading into LdrInitializeThunk().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0bbbf016
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
36 deletions
+21
-36
loader.c
dlls/ntdll/loader.c
+20
-25
locale.c
dlls/ntdll/locale.c
+0
-10
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+1
-1
No files found.
dlls/ntdll/loader.c
View file @
2a8a4cbb
...
...
@@ -68,6 +68,7 @@ const WCHAR windows_dir[] = L"C:\\windows";
const
WCHAR
system_dir
[]
=
L"C:
\\
windows
\\
system32
\\
"
;
const
WCHAR
syswow64_dir
[]
=
L"C:
\\
windows
\\
syswow64
\\
"
;
HMODULE
kernel32_handle
=
0
;
BOOL
is_wow64
=
FALSE
;
/* system search path */
...
...
@@ -3517,6 +3518,23 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
if
(
!
imports_fixup_done
)
{
ANSI_STRING
func_name
;
WINE_MODREF
*
kernel32
;
if
((
status
=
load_dll
(
NULL
,
L"kernel32.dll"
,
NULL
,
0
,
&
kernel32
))
!=
STATUS_SUCCESS
)
{
MESSAGE
(
"wine: could not load kernel32.dll, status %x
\n
"
,
status
);
NtTerminateProcess
(
GetCurrentProcess
(),
status
);
}
kernel32_handle
=
kernel32
->
ldr
.
DllBase
;
RtlInitAnsiString
(
&
func_name
,
"BaseThreadInitThunk"
);
if
((
status
=
LdrGetProcedureAddress
(
kernel32_handle
,
&
func_name
,
0
,
(
void
**
)
&
pBaseThreadInitThunk
))
!=
STATUS_SUCCESS
)
{
MESSAGE
(
"wine: could not find BaseThreadInitThunk in kernel32.dll, status %x
\n
"
,
status
);
NtTerminateProcess
(
GetCurrentProcess
(),
status
);
}
actctx_init
();
if
(
wm
->
ldr
.
Flags
&
LDR_COR_ILONLY
)
status
=
fixup_imports_ilonly
(
wm
,
NULL
,
entry
);
...
...
@@ -4002,9 +4020,6 @@ static void map_wow64cpu(void)
*/
static
NTSTATUS
process_init
(
void
)
{
WINE_MODREF
*
wm
;
NTSTATUS
status
;
ANSI_STRING
func_name
;
INITIAL_TEB
stack
;
TEB
*
teb
=
NtCurrentTeb
();
PEB
*
peb
=
teb
->
Peb
;
...
...
@@ -4039,6 +4054,7 @@ static NTSTATUS process_init(void)
load_global_options
();
version_init
();
build_main_module
();
build_ntdll_module
();
#ifndef _WIN64
if
(
NtCurrentTeb64
())
...
...
@@ -4050,30 +4066,9 @@ static NTSTATUS process_init(void)
peb64
->
OSBuildNumber
=
peb
->
OSBuildNumber
;
peb64
->
OSPlatformId
=
peb
->
OSPlatformId
;
peb64
->
SessionId
=
peb
->
SessionId
;
}
#endif
build_ntdll_module
();
#ifndef _WIN64
if
(
is_wow64
)
map_wow64cpu
();
#endif
if
((
status
=
load_dll
(
NULL
,
L"C:
\\
windows
\\
system32
\\
kernel32.dll"
,
NULL
,
0
,
&
wm
))
!=
STATUS_SUCCESS
)
{
MESSAGE
(
"wine: could not load kernel32.dll, status %x
\n
"
,
status
);
NtTerminateProcess
(
GetCurrentProcess
(),
status
);
}
RtlInitAnsiString
(
&
func_name
,
"BaseThreadInitThunk"
);
if
((
status
=
LdrGetProcedureAddress
(
wm
->
ldr
.
DllBase
,
&
func_name
,
0
,
(
void
**
)
&
pBaseThreadInitThunk
))
!=
STATUS_SUCCESS
)
{
MESSAGE
(
"wine: could not find BaseThreadInitThunk in kernel32.dll, status %x
\n
"
,
status
);
NtTerminateProcess
(
GetCurrentProcess
(),
status
);
}
init_locale
(
wm
->
ldr
.
DllBase
);
#endif
RtlCreateUserStack
(
0
,
0
,
0
,
0x10000
,
0x10000
,
&
stack
);
teb
->
Tib
.
StackBase
=
stack
.
StackBase
;
...
...
dlls/ntdll/locale.c
View file @
2a8a4cbb
...
...
@@ -101,7 +101,6 @@ struct norm_table
};
static
NLSTABLEINFO
nls_info
;
static
HMODULE
kernel32_handle
;
static
struct
norm_table
*
norm_tables
[
16
];
...
...
@@ -531,15 +530,6 @@ static unsigned int compose_string( const struct norm_table *info, WCHAR *str, u
}
/******************************************************************
* init_locale
*/
void
init_locale
(
HMODULE
module
)
{
kernel32_handle
=
module
;
}
static
NTSTATUS
get_dummy_preferred_ui_language
(
DWORD
flags
,
LANGID
lang
,
ULONG
*
count
,
WCHAR
*
buffer
,
ULONG
*
size
)
{
...
...
dlls/ntdll/ntdll_misc.h
View file @
2a8a4cbb
...
...
@@ -61,7 +61,6 @@ extern void version_init(void) DECLSPEC_HIDDEN;
extern
void
debug_init
(
void
)
DECLSPEC_HIDDEN
;
extern
void
actctx_init
(
void
)
DECLSPEC_HIDDEN
;
extern
void
heap_set_debug_flags
(
HANDLE
handle
)
DECLSPEC_HIDDEN
;
extern
void
init_locale
(
HMODULE
module
)
DECLSPEC_HIDDEN
;
extern
void
init_user_process_params
(
void
)
DECLSPEC_HIDDEN
;
extern
void
CDECL
DECLSPEC_NORETURN
signal_start_thread
(
CONTEXT
*
ctx
)
DECLSPEC_HIDDEN
;
...
...
@@ -79,6 +78,7 @@ extern void SNOOP_SetupDLL( HMODULE hmod ) DECLSPEC_HIDDEN;
extern
const
WCHAR
windows_dir
[]
DECLSPEC_HIDDEN
;
extern
const
WCHAR
system_dir
[]
DECLSPEC_HIDDEN
;
extern
const
WCHAR
syswow64_dir
[]
DECLSPEC_HIDDEN
;
extern
HMODULE
kernel32_handle
DECLSPEC_HIDDEN
;
extern
void
(
FASTCALL
*
pBaseThreadInitThunk
)(
DWORD
,
LPTHREAD_START_ROUTINE
,
void
*
)
DECLSPEC_HIDDEN
;
extern
const
struct
unix_funcs
*
unix_funcs
DECLSPEC_HIDDEN
;
...
...
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