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
c9d85dd5
Commit
c9d85dd5
authored
Aug 29, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Route the process startup through the platform-specific thread startup code.
parent
8824deb6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
34 deletions
+31
-34
process.c
dlls/kernel32/process.c
+19
-31
loader.c
dlls/ntdll/loader.c
+11
-2
winternl.h
include/winternl.h
+1
-1
No files found.
dlls/kernel32/process.c
View file @
c9d85dd5
...
...
@@ -47,7 +47,6 @@
#include "wine/winuser16.h"
#include "winternl.h"
#include "kernel_private.h"
#include "wine/exception.h"
#include "wine/server.h"
#include "wine/unicode.h"
#include "wine/debug.h"
...
...
@@ -930,38 +929,29 @@ static void start_wineboot( HANDLE handles[2] )
*
* Startup routine of a new process. Runs on the new process stack.
*/
static
void
start_process
(
void
*
arg
)
static
DWORD
WINAPI
start_process
(
PEB
*
peb
)
{
__TRY
{
PEB
*
peb
=
NtCurrentTeb
()
->
Peb
;
IMAGE_NT_HEADERS
*
nt
;
LPTHREAD_START_ROUTINE
entry
;
nt
=
RtlImageNtHeader
(
peb
->
ImageBaseAddress
);
entry
=
(
LPTHREAD_START_ROUTINE
)((
char
*
)
peb
->
ImageBaseAddress
+
nt
->
OptionalHeader
.
AddressOfEntryPoint
);
if
(
!
nt
->
OptionalHeader
.
AddressOfEntryPoint
)
{
ERR
(
"%s doesn't have an entry point, it cannot be executed
\n
"
,
debugstr_w
(
peb
->
ProcessParameters
->
ImagePathName
.
Buffer
)
);
ExitThread
(
1
);
}
IMAGE_NT_HEADERS
*
nt
;
LPTHREAD_START_ROUTINE
entry
;
if
(
TRACE_ON
(
relay
))
DPRINTF
(
"%04x:Starting process %s (entryproc=%p)
\n
"
,
GetCurrentThreadId
(),
debugstr_w
(
peb
->
ProcessParameters
->
ImagePathName
.
Buffer
),
entry
);
nt
=
RtlImageNtHeader
(
peb
->
ImageBaseAddress
);
entry
=
(
LPTHREAD_START_ROUTINE
)((
char
*
)
peb
->
ImageBaseAddress
+
nt
->
OptionalHeader
.
AddressOfEntryPoint
);
SetLastError
(
0
);
/* clear error code */
if
(
peb
->
BeingDebugged
)
DbgBreakPoint
();
ExitThread
(
entry
(
peb
)
);
}
__EXCEPT
(
UnhandledExceptionFilter
)
if
(
!
nt
->
OptionalHeader
.
AddressOfEntryPoint
)
{
TerminateThread
(
GetCurrentThread
(),
GetExceptionCode
()
);
ERR
(
"%s doesn't have an entry point, it cannot be executed
\n
"
,
debugstr_w
(
peb
->
ProcessParameters
->
ImagePathName
.
Buffer
)
);
ExitThread
(
1
);
}
__ENDTRY
if
(
TRACE_ON
(
relay
))
DPRINTF
(
"%04x:Starting process %s (entryproc=%p)
\n
"
,
GetCurrentThreadId
(),
debugstr_w
(
peb
->
ProcessParameters
->
ImagePathName
.
Buffer
),
entry
);
SetLastError
(
0
);
/* clear error code */
if
(
peb
->
BeingDebugged
)
DbgBreakPoint
();
return
entry
(
peb
);
}
...
...
@@ -1125,9 +1115,7 @@ void CDECL __wine_kernel_init(void)
ExitProcess
(
error
);
}
LdrInitializeThunk
(
0
,
0
,
0
,
0
);
/* switch to the new stack */
wine_switch_to_stack
(
start_process
,
NULL
,
NtCurrentTeb
()
->
Tib
.
StackBase
);
LdrInitializeThunk
(
start_process
,
0
,
0
,
0
);
error:
ExitProcess
(
GetLastError
()
);
...
...
dlls/ntdll/loader.c
View file @
c9d85dd5
...
...
@@ -2444,11 +2444,20 @@ static NTSTATUS attach_process_dlls( void *wm )
}
/***********************************************************************
* start_process
*/
static
void
start_process
(
void
*
kernel_start
)
{
call_thread_entry_point
(
kernel_start
,
NtCurrentTeb
()
->
Peb
);
}
/******************************************************************
* LdrInitializeThunk (NTDLL.@)
*
*/
void
WINAPI
LdrInitializeThunk
(
ULONG
unknown1
,
ULONG
unknown2
,
ULONG
unknown3
,
ULONG
unknown4
)
void
WINAPI
LdrInitializeThunk
(
void
*
kernel_start
,
ULONG_PTR
unknown2
,
ULONG_PTR
unknown3
,
ULONG_PTR
unknown4
)
{
NTSTATUS
status
;
WINE_MODREF
*
wm
;
...
...
@@ -2489,7 +2498,7 @@ void WINAPI LdrInitializeThunk( ULONG unknown1, ULONG unknown2, ULONG unknown3,
virtual_release_address_space
(
nt
->
FileHeader
.
Characteristics
&
IMAGE_FILE_LARGE_ADDRESS_AWARE
);
virtual_clear_thread_stack
();
return
;
wine_switch_to_stack
(
start_process
,
kernel_start
,
NtCurrentTeb
()
->
Tib
.
StackBase
)
;
error:
ERR
(
"Main exe initialization for %s failed, status %x
\n
"
,
...
...
include/winternl.h
View file @
c9d85dd5
...
...
@@ -1980,7 +1980,7 @@ NTSYSAPI NTSTATUS WINAPI LdrDisableThreadCalloutsForDll(HMODULE);
NTSYSAPI
NTSTATUS
WINAPI
LdrFindEntryForAddress
(
const
void
*
,
PLDR_MODULE
*
);
NTSYSAPI
NTSTATUS
WINAPI
LdrGetDllHandle
(
LPCWSTR
,
ULONG
,
const
UNICODE_STRING
*
,
HMODULE
*
);
NTSYSAPI
NTSTATUS
WINAPI
LdrGetProcedureAddress
(
HMODULE
,
const
ANSI_STRING
*
,
ULONG
,
void
**
);
NTSYSAPI
void
WINAPI
LdrInitializeThunk
(
ULONG
,
ULONG
,
ULONG
,
ULONG
);
NTSYSAPI
void
WINAPI
LdrInitializeThunk
(
void
*
,
ULONG_PTR
,
ULONG_PTR
,
ULONG_PTR
);
NTSYSAPI
NTSTATUS
WINAPI
LdrLoadDll
(
LPCWSTR
,
DWORD
,
const
UNICODE_STRING
*
,
HMODULE
*
);
NTSYSAPI
NTSTATUS
WINAPI
LdrLockLoaderLock
(
ULONG
,
ULONG
*
,
ULONG
*
);
IMAGE_BASE_RELOCATION
*
WINAPI
LdrProcessRelocationBlock
(
void
*
,
UINT
,
USHORT
*
,
INT_PTR
);
...
...
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