Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
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
Aleksandr Isakov
wine-fonts
Commits
f59d2f61
Commit
f59d2f61
authored
Mar 14, 1999
by
Uwe Bonnes
Committed by
Alexandre Julliard
Mar 14, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make GetModuleHandle16 only look for module names, not path names.
parent
9bfdb1bc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
7 deletions
+52
-7
module.c
loader/ne/module.c
+52
-7
No files found.
loader/ne/module.c
View file @
f59d2f61
...
...
@@ -26,6 +26,7 @@
#include "snoop.h"
#include "stackframe.h"
#include "debug.h"
#include "file.h"
FARPROC16
(
*
fnSNOOP16_GetProcAddress16
)(
HMODULE16
,
DWORD
,
FARPROC16
)
=
NULL
;
void
(
*
fnSNOOP16_RegisterDLL
)(
NE_MODULE
*
,
LPCSTR
)
=
NULL
;
...
...
@@ -33,6 +34,7 @@ void (*fnSNOOP16_RegisterDLL)(NE_MODULE*,LPCSTR) = NULL;
#define hFirstModule (pThhook->hExeHead)
static
NE_MODULE
*
pCachedModule
=
0
;
/* Module cached by NE_OpenFile */
static
HMODULE16
GetModuleFromPath
(
LPCSTR
name
);
static
HMODULE16
NE_LoadBuiltin
(
LPCSTR
name
,
BOOL
force
)
{
return
0
;
}
HMODULE16
(
*
fnBUILTIN_LoadModule
)(
LPCSTR
name
,
BOOL
force
)
=
NE_LoadBuiltin
;
...
...
@@ -853,10 +855,9 @@ HINSTANCE16 WINAPI LoadModule16( LPCSTR name, LPVOID paramBlock )
NE_MODULE
*
pModule
;
PDB
*
pdb
;
/* Load module */
if
(
(
hModule
=
GetModuleHandle16
(
name
)
)
!=
0
)
if
(
(
hModule
=
GetModuleFromPath
(
name
)
)
!=
0
)
{
/* Special case: second instance of an already loaded NE module */
...
...
@@ -942,7 +943,7 @@ BOOL NE_CreateProcess( HFILE hFile, OFSTRUCT *ofs, LPCSTR cmd_line,
/* Special case: second instance of an already loaded NE module */
if
(
(
hModule
=
GetModule
Handle16
(
ofs
->
szPathName
)
)
!=
0
)
if
(
(
hModule
=
GetModule
FromPath
(
ofs
->
szPathName
)
)
!=
0
)
{
if
(
!
(
pModule
=
NE_GetPtr
(
hModule
)
)
||
(
pModule
->
flags
&
NE_FFLAGS_LIBMODULE
)
...
...
@@ -1202,7 +1203,7 @@ INT16 WINAPI GetModuleFileName16( HINSTANCE16 hModule, LPSTR lpFileName,
/**********************************************************************
* GetModuleHandle16 (KERNEL.47)
*
* Find a module from a
path
name.
* Find a module from a
module
name.
*
* RETURNS
* LOWORD:
...
...
@@ -1221,11 +1222,16 @@ DWORD WINAPI WIN16_GetModuleHandle( SEGPTR name )
HMODULE16
WINAPI
GetModuleHandle16
(
LPCSTR
name
)
{
HMODULE16
hModule
=
hFirstModule
;
LPCSTR
filename
,
dotptr
,
modulepath
,
modulename
;
LPCSTR
filename
,
dotptr
;
BYTE
len
,
*
name_table
;
if
(
!
(
filename
=
strrchr
(
name
,
'\\'
)))
filename
=
name
;
else
filename
++
;
if
(
!
(
filename
=
strrchr
(
name
,
'\\'
)))
filename
=
name
;
else
{
FIXME
(
module
,
"illegal usage of GetModuleHandle16
\n
"
);
filename
++
;
}
if
((
dotptr
=
strrchr
(
filename
,
'.'
))
!=
NULL
)
len
=
(
BYTE
)(
dotptr
-
filename
);
else
len
=
strlen
(
filename
);
...
...
@@ -1234,11 +1240,15 @@ HMODULE16 WINAPI GetModuleHandle16( LPCSTR name )
{
NE_MODULE
*
pModule
=
NE_GetPtr
(
hModule
);
if
(
!
pModule
)
break
;
/*
modulepath = NE_MODULE_NAME(pModule);
TRACE(module,"name %s modulepath %s\n",name,modulepath);
if (!(modulename = strrchr( modulepath, '\\' )))
modulename = modulepath;
else modulename++;
if (!lstrcmpiA( modulename, filename )) return hModule;
*/
name_table
=
(
BYTE
*
)
pModule
+
pModule
->
name_table
;
if
((
*
name_table
==
len
)
&&
!
lstrncmpiA
(
filename
,
name_table
+
1
,
len
))
...
...
@@ -1299,6 +1309,41 @@ BOOL16 WINAPI ModuleFindHandle16( MODULEENTRY *lpme, HMODULE16 hModule )
lpme
->
wNext
=
hModule
;
return
ModuleNext16
(
lpme
);
}
/**********************************************************************
*
* try to find a ne-module with the same path as a given name
*/
static
HMODULE16
GetModuleFromPath
(
LPCSTR
name
)
{
MODULEENTRY
lookforit
;
NE_MODULE
*
pModule
;
DOS_FULL_NAME
nametoload
,
nametocompare
;
LPCSTR
modulepath
;
if
(
!
name
)
return
0
;
if
(
!
DOSFS_GetFullName
(
name
,
TRUE
,
&
nametoload
))
/* we don't have a full qualified path */
return
GetModuleHandle16
(
name
);
lookforit
.
dwSize
=
sizeof
(
MODULEENTRY
);
for
(
ModuleFirst16
(
&
lookforit
);
ModuleNext16
(
&
lookforit
);)
{
pModule
=
NE_GetPtr
(
lookforit
.
hModule
);
if
(
!
pModule
)
break
;
modulepath
=
NE_MODULE_NAME
(
pModule
);
if
(
!
modulepath
)
break
;
/* Only comparing the Unix path will give valid results*/
if
(
DOSFS_GetFullName
(
modulepath
,
TRUE
,
&
nametocompare
))
if
(
!
strcmp
(
nametoload
.
long_name
,
nametocompare
.
long_name
))
return
lookforit
.
hModule
;
}
return
0
;
}
/***************************************************************************
* MapHModuleLS (KERNEL32.520)
...
...
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