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
39f73dde
Commit
39f73dde
authored
Apr 04, 2003
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merged PE_InitDLL into MODULE_InitDLL.
Fixed a few traces.
parent
56b5e086
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
53 deletions
+25
-53
loader.c
dlls/ntdll/loader.c
+25
-23
module.h
include/module.h
+0
-1
pe_image.c
loader/pe_image.c
+0
-29
No files found.
dlls/ntdll/loader.c
View file @
39f73dde
...
...
@@ -33,11 +33,12 @@
#include "wine/server.h"
#include "ntdll_misc.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
ntdll
);
WINE_DECLARE_DEBUG_CHANNEL
(
module
);
WINE_DECLARE_DEBUG_CHANNEL
(
module
);
WINE_DEFAULT_DEBUG_CHANNEL
(
module
);
WINE_DECLARE_DEBUG_CHANNEL
(
relay
);
WINE_DECLARE_DEBUG_CHANNEL
(
loaddll
);
typedef
DWORD
(
CALLBACK
*
DLLENTRYPROC
)(
HMODULE
,
DWORD
,
LPVOID
);
WINE_MODREF
*
MODULE_modref_list
=
NULL
;
static
WINE_MODREF
*
exe_modref
;
...
...
@@ -144,20 +145,30 @@ static BOOL MODULE_InitDLL( WINE_MODREF *wm, DWORD type, LPVOID lpReserved )
static
const
char
*
const
typeName
[]
=
{
"PROCESS_DETACH"
,
"PROCESS_ATTACH"
,
"THREAD_ATTACH"
,
"THREAD_DETACH"
};
BOOL
retv
=
TRUE
;
DLLENTRYPROC
entry
=
wm
->
ldr
.
EntryPoint
;
void
*
module
=
wm
->
ldr
.
BaseAddress
;
/* Skip calls for modules loaded with special load flags */
if
(
wm
->
ldr
.
Flags
&
LDR_DONT_RESOLVE_REFS
)
return
TRUE
;
if
(
!
entry
||
!
(
wm
->
ldr
.
Flags
&
LDR_IMAGE_IS_DLL
))
return
TRUE
;
TRACE
(
"(%p (%s),%s,%p) - CALL
\n
"
,
module
,
wm
->
modname
,
typeName
[
type
],
lpReserved
);
if
(
TRACE_ON
(
relay
))
DPRINTF
(
"%04lx:Call PE DLL (proc=%p,module=%p,type=%ld,res=%p)
\n
"
,
GetCurrentThreadId
(),
entry
,
module
,
type
,
lpReserved
);
TRACE
(
"(%s,%s,%p) - CALL
\n
"
,
wm
->
modname
,
typeName
[
type
]
,
lpReserved
);
retv
=
entry
(
module
,
type
,
lpReserved
);
/* Call the initialization routine */
retv
=
PE_InitDLL
(
wm
->
ldr
.
BaseAddress
,
type
,
lpReserved
);
if
(
TRACE_ON
(
relay
))
DPRINTF
(
"%04lx:Ret PE DLL (proc=%p,module=%p,type=%ld,res=%p) retval=%x
\n
"
,
GetCurrentThreadId
(),
entry
,
module
,
type
,
lpReserved
,
retv
);
/* The state of the module list may have changed due to the call
to
PE_InitDLL
. We cannot assume that this module has not been
to
the dll
. We cannot assume that this module has not been
deleted. */
TRACE
(
"(%p,%s,%p) - RETURN %d
\n
"
,
wm
,
typeName
[
type
],
lpReserved
,
retv
);
TRACE
(
"(%p,%s,%p) - RETURN %d
\n
"
,
module
,
typeName
[
type
],
lpReserved
,
retv
);
return
retv
;
}
...
...
@@ -445,9 +456,6 @@ NTSTATUS WINAPI LdrGetDllHandle(ULONG x, ULONG y, PUNICODE_STRING name, HMODULE
{
WINE_MODREF
*
wm
;
TRACE
(
"%08lx %08lx %s %p
\n
"
,
x
,
y
,
name
?
debugstr_wn
(
name
->
Buffer
,
name
->
Length
)
:
NULL
,
base
);
if
(
x
!=
0
||
y
!=
0
)
FIXME
(
"Unknown behavior, please report
\n
"
);
...
...
@@ -471,6 +479,10 @@ NTSTATUS WINAPI LdrGetDllHandle(ULONG x, ULONG y, PUNICODE_STRING name, HMODULE
}
*
base
=
wm
->
ldr
.
BaseAddress
;
TRACE
(
"%lx %lx %s -> %p
\n
"
,
x
,
y
,
name
?
debugstr_wn
(
name
->
Buffer
,
name
->
Length
/
sizeof
(
WCHAR
))
:
"(null)"
,
*
base
);
return
STATUS_SUCCESS
;
}
...
...
@@ -486,11 +498,6 @@ FARPROC MODULE_GetProcAddress(
WINE_MODREF
*
wm
;
FARPROC
retproc
=
0
;
if
(
HIWORD
(
function
))
TRACE
(
"(%p,%s (%d))
\n
"
,
hModule
,
function
,
hint
);
else
TRACE
(
"(%p,%p)
\n
"
,
hModule
,
function
);
RtlEnterCriticalSection
(
&
loader_section
);
if
((
wm
=
MODULE32_LookupHMODULE
(
hModule
)))
{
...
...
@@ -503,15 +510,10 @@ FARPROC MODULE_GetProcAddress(
/******************************************************************
* LdrGetProcedureAddress (NTDLL.@)
*
*
*/
NTSTATUS
WINAPI
LdrGetProcedureAddress
(
HMODULE
base
,
PANSI_STRING
name
,
ULONG
ord
,
PVOID
*
address
)
{
WARN
(
"%p %s %ld %p
\n
"
,
base
,
name
?
debugstr_an
(
name
->
Buffer
,
name
->
Length
)
:
NULL
,
ord
,
address
);
*
address
=
MODULE_GetProcAddress
(
base
,
name
?
name
->
Buffer
:
(
LPSTR
)
ord
,
-
1
,
TRUE
);
return
(
*
address
)
?
STATUS_SUCCESS
:
STATUS_PROCEDURE_NOT_FOUND
;
}
...
...
@@ -678,7 +680,7 @@ NTSTATUS MODULE_LoadLibraryExA( LPCSTR libname, DWORD flags, WINE_MODREF** pwm)
if
(
nts
==
STATUS_SUCCESS
)
{
/* Initialize DLL just loaded */
TRACE
(
"Loaded module '%s'
at %p
\n
"
,
filenam
e
,
(
*
pwm
)
->
ldr
.
BaseAddress
);
TRACE
(
"Loaded module '%s'
(%s) at %p
\n
"
,
filename
,
filetyp
e
,
(
*
pwm
)
->
ldr
.
BaseAddress
);
if
(
!
TRACE_ON
(
module
))
TRACE_
(
loaddll
)(
"Loaded module '%s' : %s
\n
"
,
filename
,
filetype
);
/* Set the ldr.LoadCount here so that an attach failure will */
...
...
@@ -733,7 +735,7 @@ NTSTATUS WINAPI LdrLoadDll(LPCWSTR path_name, DWORD flags, PUNICODE_STRING libna
case
STATUS_SUCCESS
:
if
(
!
MODULE_DllProcessAttach
(
wm
,
NULL
)
)
{
WARN
_
(
module
)
(
"Attach failed for module '%s'.
\n
"
,
str
.
Buffer
);
WARN
(
"Attach failed for module '%s'.
\n
"
,
str
.
Buffer
);
LdrUnloadDll
(
wm
->
ldr
.
BaseAddress
);
nts
=
STATUS_DLL_INIT_FAILED
;
wm
=
NULL
;
...
...
include/module.h
View file @
39f73dde
...
...
@@ -237,7 +237,6 @@ extern HMODULE PE_LoadImage( HANDLE hFile, LPCSTR filename, DWORD flags );
extern
WINE_MODREF
*
PE_CreateModule
(
HMODULE
hModule
,
LPCSTR
filename
,
DWORD
flags
,
HANDLE
hFile
,
BOOL
builtin
);
extern
void
PE_InitTls
(
void
);
extern
BOOL
PE_InitDLL
(
HMODULE
module
,
DWORD
type
,
LPVOID
lpReserved
);
extern
DWORD
PE_fixup_imports
(
WINE_MODREF
*
wm
);
/* loader/loadorder.c */
...
...
loader/pe_image.c
View file @
39f73dde
...
...
@@ -632,35 +632,6 @@ NTSTATUS PE_LoadLibraryExA (LPCSTR name, DWORD flags, WINE_MODREF** pwm)
}
/* Called if the library is loaded or freed.
* NOTE: if a thread attaches a DLL, the current thread will only do
* DLL_PROCESS_ATTACH. Only newly created threads do DLL_THREAD_ATTACH
* (SDK)
*/
typedef
DWORD
(
CALLBACK
*
DLLENTRYPROC
)(
HMODULE
,
DWORD
,
LPVOID
);
BOOL
PE_InitDLL
(
HMODULE
module
,
DWORD
type
,
LPVOID
lpReserved
)
{
BOOL
retv
=
TRUE
;
IMAGE_NT_HEADERS
*
nt
=
RtlImageNtHeader
(
module
);
/* Is this a library? And has it got an entrypoint? */
if
(
nt
&&
(
nt
->
FileHeader
.
Characteristics
&
IMAGE_FILE_DLL
)
&&
(
nt
->
OptionalHeader
.
AddressOfEntryPoint
))
{
DLLENTRYPROC
entry
=
(
void
*
)((
char
*
)
module
+
nt
->
OptionalHeader
.
AddressOfEntryPoint
);
if
(
TRACE_ON
(
relay
))
DPRINTF
(
"%04lx:Call PE DLL (proc=%p,module=%p,type=%ld,res=%p)
\n
"
,
GetCurrentThreadId
(),
entry
,
module
,
type
,
lpReserved
);
retv
=
entry
(
module
,
type
,
lpReserved
);
if
(
TRACE_ON
(
relay
))
DPRINTF
(
"%04lx:Ret PE DLL (proc=%p,module=%p,type=%ld,res=%p) retval=%x
\n
"
,
GetCurrentThreadId
(),
entry
,
module
,
type
,
lpReserved
,
retv
);
}
return
retv
;
}
/************************************************************************
* PE_InitTls (internal)
*
...
...
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