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
5c819a98
Commit
5c819a98
authored
May 23, 2005
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support unloading 16-bit builtin modules, and properly manage the
refcount of the 32-bit owner module.
parent
d9293bfc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
kernel16_private.h
dlls/kernel/kernel16_private.h
+1
-0
ne_module.c
dlls/kernel/ne_module.c
+9
-7
No files found.
dlls/kernel/kernel16_private.h
View file @
5c819a98
...
...
@@ -62,6 +62,7 @@ typedef struct _NE_MODULE
WORD
ne_expver
;
/* 3e Expected Windows version */
/* From here, these are extra fields not present in normal Windows */
HMODULE
module32
;
/* PE module handle for Win32 modules */
HMODULE
owner32
;
/* PE module containing this one for 16-bit builtins */
HMODULE16
self
;
/* Handle for this module */
WORD
self_loading_sel
;
/* Selector used for self-loading apps. */
LPVOID
rsrc32_map
;
/* HRSRC 16->32 map (for 32-bit modules) */
...
...
dlls/kernel/ne_module.c
View file @
5c819a98
...
...
@@ -993,7 +993,8 @@ static HINSTANCE16 NE_LoadModule( LPCSTR name, BOOL lib_only )
*
* Load a built-in Win16 module. Helper function for NE_LoadBuiltinModule.
*/
static
HMODULE16
NE_DoLoadBuiltinModule
(
const
IMAGE_DOS_HEADER
*
mz_header
,
const
char
*
file_name
)
static
HMODULE16
NE_DoLoadBuiltinModule
(
const
IMAGE_DOS_HEADER
*
mz_header
,
const
char
*
file_name
,
HMODULE
owner32
)
{
NE_MODULE
*
pModule
;
HMODULE16
hModule
;
...
...
@@ -1007,6 +1008,7 @@ static HMODULE16 NE_DoLoadBuiltinModule( const IMAGE_DOS_HEADER *mz_header, cons
if
(
hModule
<
32
)
return
hModule
;
pModule
=
GlobalLock16
(
hModule
);
pModule
->
ne_flags
|=
NE_FFLAGS_BUILTIN
;
pModule
->
owner32
=
owner32
;
/* fake the expected version the module should have according to the current Windows version */
versionInfo
.
dwOSVersionInfoSize
=
sizeof
(
versionInfo
);
...
...
@@ -1098,7 +1100,7 @@ static HINSTANCE16 MODULE_LoadModule16( LPCSTR libname, BOOL implicit, BOOL lib_
if
(
descr
)
{
TRACE
(
"Trying built-in '%s'
\n
"
,
libname
);
hinst
=
NE_DoLoadBuiltinModule
(
descr
,
file_name
);
hinst
=
NE_DoLoadBuiltinModule
(
descr
,
file_name
,
mod32
);
if
(
hinst
>
32
)
TRACE_
(
loaddll
)(
"Loaded module %s : builtin
\n
"
,
debugstr_a
(
file_name
));
}
else
...
...
@@ -1393,9 +1395,6 @@ static BOOL16 NE_FreeModule( HMODULE16 hModule, BOOL call_wep )
if
(((
INT16
)(
--
pModule
->
count
))
>
0
)
return
TRUE
;
else
pModule
->
count
=
0
;
if
(
pModule
->
ne_flags
&
NE_FFLAGS_BUILTIN
)
return
FALSE
;
/* Can't free built-in module */
if
(
call_wep
&&
!
(
pModule
->
ne_flags
&
NE_FFLAGS_WIN32
))
{
/* Free the objects owned by the DLL module */
...
...
@@ -1407,11 +1406,14 @@ static BOOL16 NE_FreeModule( HMODULE16 hModule, BOOL call_wep )
call_wep
=
FALSE
;
/* We are freeing a task -> no more WEPs */
}
TRACE_
(
loaddll
)(
"Unloaded module %s : %s
\n
"
,
debugstr_a
(
NE_MODULE_NAME
(
pModule
)),
(
pModule
->
ne_flags
&
NE_FFLAGS_BUILTIN
)
?
"builtin"
:
"native"
);
/* Clear magic number just in case */
pModule
->
ne_magic
=
pModule
->
self
=
0
;
if
(
!
(
pModule
->
ne_flags
&
NE_FFLAGS_BUILTIN
))
UnmapViewOfFile
(
(
void
*
)
pModule
->
mapping
);
if
(
pModule
->
owner32
)
FreeLibrary
(
pModule
->
owner32
);
else
if
(
pModule
->
mapping
)
UnmapViewOfFile
(
(
void
*
)
pModule
->
mapping
);
/* Remove it from the linked list */
...
...
@@ -2052,7 +2054,7 @@ static HMODULE16 create_dummy_module( HMODULE module32 )
pModule
->
ne_rsrctab
=
pModule
->
ne_imptab
=
pModule
->
ne_enttab
=
(
char
*
)
pStr
-
(
char
*
)
pModule
;
NE_RegisterModule
(
pModule
);
LoadLibraryA
(
filename
);
/* increment the ref count of the 32-bit module */
pModule
->
owner32
=
LoadLibraryA
(
filename
);
/* increment the ref count of the 32-bit module */
return
hModule
;
}
...
...
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