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
beff5c56
Commit
beff5c56
authored
Apr 05, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Move the PEB initialization to LdrInitializeThunk().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
04762b35
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
42 deletions
+28
-42
loader.c
dlls/ntdll/loader.c
+27
-35
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+0
-1
thread.c
dlls/ntdll/thread.c
+1
-6
No files found.
dlls/ntdll/loader.c
View file @
beff5c56
...
...
@@ -154,7 +154,14 @@ static RTL_CRITICAL_SECTION_DEBUG peb_critsect_debug =
};
static
RTL_CRITICAL_SECTION
peb_lock
=
{
&
peb_critsect_debug
,
-
1
,
0
,
0
,
0
,
0
};
static
PEB_LDR_DATA
ldr
=
{
sizeof
(
ldr
),
TRUE
};
static
PEB_LDR_DATA
ldr
=
{
sizeof
(
ldr
),
TRUE
,
NULL
,
{
&
ldr
.
InLoadOrderModuleList
,
&
ldr
.
InLoadOrderModuleList
},
{
&
ldr
.
InMemoryOrderModuleList
,
&
ldr
.
InMemoryOrderModuleList
},
{
&
ldr
.
InInitializationOrderModuleList
,
&
ldr
.
InInitializationOrderModuleList
}
};
static
RTL_BITMAP
tls_bitmap
;
static
RTL_BITMAP
tls_expansion_bitmap
;
...
...
@@ -3615,6 +3622,24 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
{
ANSI_STRING
func_name
;
WINE_MODREF
*
kernel32
;
PEB
*
peb
=
NtCurrentTeb
()
->
Peb
;
peb
->
LdrData
=
&
ldr
;
peb
->
FastPebLock
=
&
peb_lock
;
peb
->
TlsBitmap
=
&
tls_bitmap
;
peb
->
TlsExpansionBitmap
=
&
tls_expansion_bitmap
;
peb
->
LoaderLock
=
&
loader_section
;
peb
->
OSMajorVersion
=
5
;
peb
->
OSMinorVersion
=
1
;
peb
->
OSBuildNumber
=
0xA28
;
peb
->
OSPlatformId
=
VER_PLATFORM_WIN32_NT
;
peb
->
SessionId
=
1
;
peb
->
ProcessHeap
=
RtlCreateHeap
(
HEAP_GROWABLE
,
NULL
,
0
,
0
,
NULL
,
NULL
);
RtlInitializeBitMap
(
&
tls_bitmap
,
peb
->
TlsBitmapBits
,
sizeof
(
peb
->
TlsBitmapBits
)
*
8
);
RtlInitializeBitMap
(
&
tls_expansion_bitmap
,
peb
->
TlsExpansionBitmapBits
,
sizeof
(
peb
->
TlsExpansionBitmapBits
)
*
8
);
RtlSetBits
(
peb
->
TlsBitmap
,
0
,
1
);
/* TLS index 0 is reserved and should be initialized to NULL. */
init_user_process_params
();
load_global_options
();
...
...
@@ -4041,44 +4066,11 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
/***********************************************************************
* process_init
*/
static
NTSTATUS
process_init
(
void
)
{
TEB
*
teb
=
NtCurrentTeb
();
PEB
*
peb
=
teb
->
Peb
;
peb
->
LdrData
=
&
ldr
;
peb
->
FastPebLock
=
&
peb_lock
;
peb
->
TlsBitmap
=
&
tls_bitmap
;
peb
->
TlsExpansionBitmap
=
&
tls_expansion_bitmap
;
peb
->
LoaderLock
=
&
loader_section
;
peb
->
OSMajorVersion
=
5
;
peb
->
OSMinorVersion
=
1
;
peb
->
OSBuildNumber
=
0xA28
;
peb
->
OSPlatformId
=
VER_PLATFORM_WIN32_NT
;
peb
->
SessionId
=
1
;
peb
->
ProcessHeap
=
RtlCreateHeap
(
HEAP_GROWABLE
,
NULL
,
0
,
0
,
NULL
,
NULL
);
RtlInitializeBitMap
(
&
tls_bitmap
,
peb
->
TlsBitmapBits
,
sizeof
(
peb
->
TlsBitmapBits
)
*
8
);
RtlInitializeBitMap
(
&
tls_expansion_bitmap
,
peb
->
TlsExpansionBitmapBits
,
sizeof
(
peb
->
TlsExpansionBitmapBits
)
*
8
);
RtlSetBits
(
peb
->
TlsBitmap
,
0
,
1
);
/* TLS index 0 is reserved and should be initialized to NULL. */
init_global_fls_data
();
InitializeListHead
(
&
ldr
.
InLoadOrderModuleList
);
InitializeListHead
(
&
ldr
.
InMemoryOrderModuleList
);
InitializeListHead
(
&
ldr
.
InInitializationOrderModuleList
);
return
STATUS_SUCCESS
;
}
/***********************************************************************
* __wine_set_unix_funcs
*/
NTSTATUS
CDECL
__wine_set_unix_funcs
(
int
version
,
const
struct
unix_funcs
*
funcs
)
{
if
(
version
!=
NTDLL_UNIXLIB_VERSION
)
return
STATUS_REVISION_MISMATCH
;
unix_funcs
=
funcs
;
return
process_init
()
;
return
STATUS_SUCCESS
;
}
dlls/ntdll/ntdll_misc.h
View file @
beff5c56
...
...
@@ -106,7 +106,6 @@ static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len )
}
/* FLS data */
extern
void
init_global_fls_data
(
void
)
DECLSPEC_HIDDEN
;
extern
TEB_FLS_DATA
*
fls_alloc_data
(
void
)
DECLSPEC_HIDDEN
;
#endif
dlls/ntdll/thread.c
View file @
beff5c56
...
...
@@ -241,7 +241,7 @@ TEB_ACTIVE_FRAME * WINAPI RtlGetFrame(void)
***********************************************************************/
static
GLOBAL_FLS_DATA
fls_data
;
static
GLOBAL_FLS_DATA
fls_data
=
{
{
NULL
},
{
&
fls_data
.
fls_list_head
,
&
fls_data
.
fls_list_head
}
}
;
static
RTL_CRITICAL_SECTION
fls_section
;
static
RTL_CRITICAL_SECTION_DEBUG
fls_critsect_debug
=
...
...
@@ -254,11 +254,6 @@ static RTL_CRITICAL_SECTION fls_section = { &fls_critsect_debug, -1, 0, 0, 0, 0
#define MAX_FLS_DATA_COUNT 0xff0
void
init_global_fls_data
(
void
)
{
InitializeListHead
(
&
fls_data
.
fls_list_head
);
}
static
void
lock_fls_data
(
void
)
{
RtlEnterCriticalSection
(
&
fls_section
);
...
...
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