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
c7a51eec
Commit
c7a51eec
authored
May 20, 2003
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only create the 16-bit dummy module when we need really it.
parent
69c71649
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
36 deletions
+24
-36
loader.c
dlls/ntdll/loader.c
+0
-1
module.h
include/module.h
+1
-2
module.c
loader/module.c
+12
-11
module.c
loader/ne/module.c
+9
-2
pe_image.c
loader/pe_image.c
+2
-20
No files found.
dlls/ntdll/loader.c
View file @
c7a51eec
...
...
@@ -1272,7 +1272,6 @@ static void MODULE_FlushModrefs(void)
if
(
wm
->
dlhandle
)
wine_dll_unload
(
wm
->
dlhandle
);
else
NtUnmapViewOfSection
(
GetCurrentProcess
(),
wm
->
ldr
.
BaseAddress
);
FreeLibrary16
(
wm
->
hDummyMod
);
if
(
cached_modref
==
wm
)
cached_modref
=
NULL
;
RtlFreeHeap
(
ntdll_get_process_heap
(),
0
,
wm
->
deps
);
RtlFreeHeap
(
ntdll_get_process_heap
(),
0
,
wm
);
...
...
include/module.h
View file @
c7a51eec
...
...
@@ -130,7 +130,6 @@ typedef struct _wine_modref
{
struct
_wine_modref
*
next
;
struct
_wine_modref
*
prev
;
HMODULE16
hDummyMod
;
/* Win16 dummy module */
void
*
dlhandle
;
/* handle returned by dlopen() */
LDR_MODULE
ldr
;
...
...
@@ -184,7 +183,7 @@ enum binary_type
extern
NTSTATUS
MODULE_DllProcessAttach
(
WINE_MODREF
*
wm
,
LPVOID
lpReserved
);
extern
NTSTATUS
MODULE_DllThreadAttach
(
LPVOID
lpReserved
);
extern
WINE_MODREF
*
MODULE_FindModule
(
LPCSTR
path
);
extern
HMODULE16
MODULE_CreateDummyModule
(
LPCSTR
filename
,
HMODULE
module32
);
extern
HMODULE16
MODULE_CreateDummyModule
(
HMODULE
module32
);
extern
enum
binary_type
MODULE_GetBinaryType
(
HANDLE
hfile
);
extern
FARPROC16
WINAPI
WIN32_GetProcAddress16
(
HMODULE
hmodule
,
LPCSTR
name
);
extern
SEGPTR
WINAPI
HasGPHandler16
(
SEGPTR
address
);
...
...
loader/module.c
View file @
c7a51eec
...
...
@@ -90,7 +90,7 @@ BOOL WINAPI DisableThreadLibraryCalls( HMODULE hModule )
*
* Create a dummy NE module for Win32 or Winelib.
*/
HMODULE16
MODULE_CreateDummyModule
(
LPCSTR
filename
,
HMODULE
module32
)
HMODULE16
MODULE_CreateDummyModule
(
HMODULE
module32
)
{
HMODULE16
hModule
;
NE_MODULE
*
pModule
;
...
...
@@ -100,8 +100,13 @@ HMODULE16 MODULE_CreateDummyModule( LPCSTR filename, HMODULE module32 )
const
char
*
basename
;
OFSTRUCT
*
ofs
;
int
of_size
,
size
;
char
filename
[
MAX_PATH
];
IMAGE_NT_HEADERS
*
nt
=
RtlImageNtHeader
(
module32
);
if
(
!
nt
)
return
(
HMODULE16
)
11
;
/* invalid exe */
/* Extract base filename */
GetModuleFileNameA
(
module32
,
filename
,
sizeof
(
filename
)
);
basename
=
strrchr
(
filename
,
'\\'
);
if
(
!
basename
)
basename
=
filename
;
else
basename
++
;
...
...
@@ -131,7 +136,7 @@ HMODULE16 MODULE_CreateDummyModule( LPCSTR filename, HMODULE module32 )
pModule
->
magic
=
IMAGE_OS2_SIGNATURE
;
pModule
->
count
=
1
;
pModule
->
next
=
0
;
pModule
->
flags
=
0
;
pModule
->
flags
=
NE_FFLAGS_WIN32
;
pModule
->
dgroup
=
0
;
pModule
->
ss
=
1
;
pModule
->
cs
=
2
;
...
...
@@ -146,15 +151,10 @@ HMODULE16 MODULE_CreateDummyModule( LPCSTR filename, HMODULE module32 )
pModule
->
module32
=
module32
;
/* Set version and flags */
if
(
module32
)
{
IMAGE_NT_HEADERS
*
nt
=
RtlImageNtHeader
(
module32
);
pModule
->
expected_version
=
((
nt
->
OptionalHeader
.
MajorSubsystemVersion
&
0xff
)
<<
8
)
|
(
nt
->
OptionalHeader
.
MinorSubsystemVersion
&
0xff
);
pModule
->
flags
|=
NE_FFLAGS_WIN32
;
if
(
nt
->
FileHeader
.
Characteristics
&
IMAGE_FILE_DLL
)
pModule
->
flags
|=
NE_FFLAGS_LIBMODULE
|
NE_FFLAGS_SINGLEDATA
;
}
pModule
->
expected_version
=
((
nt
->
OptionalHeader
.
MajorSubsystemVersion
&
0xff
)
<<
8
)
|
(
nt
->
OptionalHeader
.
MinorSubsystemVersion
&
0xff
);
if
(
nt
->
FileHeader
.
Characteristics
&
IMAGE_FILE_DLL
)
pModule
->
flags
|=
NE_FFLAGS_LIBMODULE
|
NE_FFLAGS_SINGLEDATA
;
/* Set loaded file information */
ofs
=
(
OFSTRUCT
*
)(
pModule
+
1
);
...
...
@@ -186,6 +186,7 @@ HMODULE16 MODULE_CreateDummyModule( LPCSTR filename, HMODULE module32 )
(
int
)
pStr
-
(
int
)
pModule
;
NE_RegisterModule
(
pModule
);
LoadLibraryA
(
filename
);
/* increment the ref count of the 32-bit module */
return
hModule
;
}
...
...
loader/ne/module.c
View file @
c7a51eec
...
...
@@ -1714,7 +1714,9 @@ BOOL16 WINAPI IsRomFile16( HFILE16 unused )
/***************************************************************************
* MapHModuleLS (KERNEL32.@)
*/
HMODULE16
WINAPI
MapHModuleLS
(
HMODULE
hmod
)
{
HMODULE16
WINAPI
MapHModuleLS
(
HMODULE
hmod
)
{
HMODULE16
ret
;
NE_MODULE
*
pModule
;
if
(
!
hmod
)
...
...
@@ -1727,7 +1729,12 @@ HMODULE16 WINAPI MapHModuleLS(HMODULE hmod) {
return
pModule
->
self
;
pModule
=
(
NE_MODULE
*
)
GlobalLock16
(
pModule
->
next
);
}
return
0
;
if
((
ret
=
MODULE_CreateDummyModule
(
hmod
))
<
32
)
{
SetLastError
(
ret
);
ret
=
0
;
}
return
ret
;
}
/***************************************************************************
...
...
loader/pe_image.c
View file @
c7a51eec
...
...
@@ -41,7 +41,7 @@
#include <sys/mman.h>
#endif
#include <string.h>
#include "win
e/winbase16
.h"
#include "win
base
.h"
#include "winerror.h"
#include "snoop.h"
#include "wine/server.h"
...
...
@@ -183,7 +183,6 @@ WINE_MODREF *PE_CreateModule( HMODULE hModule, LPCSTR filename, DWORD flags,
IMAGE_DATA_DIRECTORY
*
dir
;
IMAGE_EXPORT_DIRECTORY
*
pe_export
=
NULL
;
WINE_MODREF
*
wm
;
HMODULE16
hModule16
;
/* Retrieve DataDirectory entries */
...
...
@@ -247,29 +246,12 @@ WINE_MODREF *PE_CreateModule( HMODULE hModule, LPCSTR filename, DWORD flags,
dir
=
nt
->
OptionalHeader
.
DataDirectory
+
15
;
if
(
dir
->
Size
)
FIXME
(
"Unknown directory 15 ignored
\n
"
);
/* Create 16-bit dummy module */
if
((
hModule16
=
MODULE_CreateDummyModule
(
filename
,
hModule
))
<
32
)
{
SetLastError
(
(
DWORD
)
hModule16
);
/* This should give the correct error */
return
NULL
;
}
/* Allocate and fill WINE_MODREF */
if
(
!
(
wm
=
MODULE_AllocModRef
(
hModule
,
filename
)))
{
FreeLibrary16
(
hModule16
);
return
NULL
;
}
wm
->
hDummyMod
=
hModule16
;
if
(
!
(
wm
=
MODULE_AllocModRef
(
hModule
,
filename
)))
return
NULL
;
if
(
builtin
)
{
NE_MODULE
*
pModule
=
(
NE_MODULE
*
)
GlobalLock16
(
hModule16
);
pModule
->
flags
|=
NE_FFLAGS_BUILTIN
;
wm
->
ldr
.
Flags
|=
LDR_WINE_INTERNAL
;
}
else
if
(
flags
&
DONT_RESOLVE_DLL_REFERENCES
)
wm
->
ldr
.
Flags
|=
LDR_DONT_RESOLVE_REFS
;
...
...
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