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
a33f318f
Commit
a33f318f
authored
Sep 26, 2003
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid depending on MODULE_GetBinaryType in load_library_as_datafile.
parent
2d139562
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
18 deletions
+18
-18
module.c
loader/module.c
+18
-18
No files found.
loader/module.c
View file @
a33f318f
...
@@ -489,6 +489,7 @@ static BOOL load_library_as_datafile( LPCWSTR name, HMODULE* hmod)
...
@@ -489,6 +489,7 @@ static BOOL load_library_as_datafile( LPCWSTR name, HMODULE* hmod)
WCHAR
filenameW
[
MAX_PATH
];
WCHAR
filenameW
[
MAX_PATH
];
HANDLE
hFile
=
INVALID_HANDLE_VALUE
;
HANDLE
hFile
=
INVALID_HANDLE_VALUE
;
HANDLE
mapping
;
HANDLE
mapping
;
HMODULE
module
;
*
hmod
=
0
;
*
hmod
=
0
;
...
@@ -499,23 +500,23 @@ static BOOL load_library_as_datafile( LPCWSTR name, HMODULE* hmod)
...
@@ -499,23 +500,23 @@ static BOOL load_library_as_datafile( LPCWSTR name, HMODULE* hmod)
NULL
,
OPEN_EXISTING
,
0
,
0
);
NULL
,
OPEN_EXISTING
,
0
,
0
);
}
}
if
(
hFile
==
INVALID_HANDLE_VALUE
)
return
FALSE
;
if
(
hFile
==
INVALID_HANDLE_VALUE
)
return
FALSE
;
switch
(
MODULE_GetBinaryType
(
hFile
))
{
mapping
=
CreateFileMappingW
(
hFile
,
NULL
,
PAGE_READONLY
,
0
,
0
,
NULL
);
case
BINARY_PE_EXE
:
case
BINARY_PE_DLL
:
mapping
=
CreateFileMappingW
(
hFile
,
NULL
,
PAGE_READONLY
,
0
,
0
,
NULL
);
if
(
mapping
)
{
*
hmod
=
MapViewOfFile
(
mapping
,
FILE_MAP_READ
,
0
,
0
,
0
);
CloseHandle
(
mapping
);
}
break
;
default:
break
;
}
CloseHandle
(
hFile
);
CloseHandle
(
hFile
);
if
(
!
mapping
)
return
FALSE
;
module
=
MapViewOfFile
(
mapping
,
FILE_MAP_READ
,
0
,
0
,
0
);
CloseHandle
(
mapping
);
if
(
!
module
)
return
FALSE
;
return
*
hmod
!=
0
;
/* make sure it's a valid PE file */
if
(
!
RtlImageNtHeader
(
module
))
{
UnmapViewOfFile
(
module
);
return
FALSE
;
}
*
hmod
=
(
HMODULE
)((
char
*
)
module
+
1
);
/* set low bit of handle to indicate datafile module */
return
TRUE
;
}
}
/******************************************************************
/******************************************************************
...
@@ -548,7 +549,7 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags)
...
@@ -548,7 +549,7 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags)
if
(
load_library_as_datafile
(
wstr
.
Buffer
,
&
hModule
))
if
(
load_library_as_datafile
(
wstr
.
Buffer
,
&
hModule
))
{
{
RtlFreeUnicodeString
(
&
wstr
);
RtlFreeUnicodeString
(
&
wstr
);
return
(
HMODULE
)((
ULONG_PTR
)
hModule
+
1
)
;
return
hModule
;
}
}
flags
|=
DONT_RESOLVE_DLL_REFERENCES
;
/* Just in case */
flags
|=
DONT_RESOLVE_DLL_REFERENCES
;
/* Just in case */
/* Fallback to normal behaviour */
/* Fallback to normal behaviour */
...
@@ -585,8 +586,7 @@ HMODULE WINAPI LoadLibraryExW(LPCWSTR libnameW, HANDLE hfile, DWORD flags)
...
@@ -585,8 +586,7 @@ HMODULE WINAPI LoadLibraryExW(LPCWSTR libnameW, HANDLE hfile, DWORD flags)
/* The method in load_library_as_datafile allows searching for the
/* The method in load_library_as_datafile allows searching for the
* 'native' libraries only
* 'native' libraries only
*/
*/
if
(
load_library_as_datafile
(
libnameW
,
&
hModule
))
if
(
load_library_as_datafile
(
libnameW
,
&
hModule
))
return
hModule
;
return
(
HMODULE
)((
ULONG_PTR
)
hModule
+
1
);
flags
|=
DONT_RESOLVE_DLL_REFERENCES
;
/* Just in case */
flags
|=
DONT_RESOLVE_DLL_REFERENCES
;
/* Just in case */
/* Fallback to normal behaviour */
/* Fallback to normal behaviour */
}
}
...
...
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