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
6a859fb0
Commit
6a859fb0
authored
Feb 21, 2007
by
Eric Pouech
Committed by
Alexandre Julliard
Feb 22, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbghelp: Move PE module loading to Unicode.
parent
bcc19133
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
29 deletions
+23
-29
dbghelp_private.h
dlls/dbghelp/dbghelp_private.h
+3
-3
module.c
dlls/dbghelp/module.c
+3
-3
msc.c
dlls/dbghelp/msc.c
+2
-2
pe_module.c
dlls/dbghelp/pe_module.c
+15
-21
No files found.
dlls/dbghelp/dbghelp_private.h
View file @
6a859fb0
...
...
@@ -477,11 +477,11 @@ extern BOOL pdb_fetch_file_info(struct pdb_lookup* pdb_lookup);
/* pe_module.c */
extern
BOOL
pe_load_nt_header
(
HANDLE
hProc
,
DWORD
base
,
IMAGE_NT_HEADERS
*
nth
);
extern
struct
module
*
pe_load_module
(
struct
process
*
pcs
,
const
char
*
name
,
pe_load_module
(
struct
process
*
pcs
,
const
WCHAR
*
name
,
HANDLE
hFile
,
DWORD
base
,
DWORD
size
);
extern
struct
module
*
pe_load_module_from_pcs
(
struct
process
*
pcs
,
const
char
*
name
,
const
char
*
mod_name
,
DWORD
base
,
DWORD
size
);
pe_load_module_from_pcs
(
struct
process
*
pcs
,
const
WCHAR
*
name
,
const
WCHAR
*
mod_name
,
DWORD
base
,
DWORD
size
);
extern
BOOL
pe_load_debug_info
(
const
struct
process
*
pcs
,
struct
module
*
module
);
/* source.c */
...
...
dlls/dbghelp/module.c
View file @
6a859fb0
...
...
@@ -517,21 +517,21 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE hProcess, HANDLE hFile, PCWSTR wImageNam
if
(
module_is_elf_container_loaded
(
pcs
,
wImageName
,
wModuleName
))
{
/* force the loading of DLL as builtin */
if
((
module
=
pe_load_module_from_pcs
(
pcs
,
ImageName
,
ModuleName
,
if
((
module
=
pe_load_module_from_pcs
(
pcs
,
wImageName
,
w
ModuleName
,
BaseOfDll
,
SizeOfDll
)))
goto
done
;
WARN
(
"Couldn't locate %s
\n
"
,
debugstr_w
(
wImageName
));
return
0
;
}
TRACE
(
"Assuming %s as native DLL
\n
"
,
debugstr_w
(
wImageName
));
if
(
!
(
module
=
pe_load_module
(
pcs
,
ImageName
,
hFile
,
BaseOfDll
,
SizeOfDll
)))
if
(
!
(
module
=
pe_load_module
(
pcs
,
w
ImageName
,
hFile
,
BaseOfDll
,
SizeOfDll
)))
{
if
(
module_get_type_by_name
(
ImageName
)
==
DMT_ELF
&&
(
module
=
elf_load_module
(
pcs
,
ImageName
,
BaseOfDll
)))
goto
done
;
FIXME
(
"Should have successfully loaded debug information for image %s
\n
"
,
debugstr_w
(
wImageName
));
if
((
module
=
pe_load_module_from_pcs
(
pcs
,
ImageName
,
ModuleName
,
if
((
module
=
pe_load_module_from_pcs
(
pcs
,
wImageName
,
w
ModuleName
,
BaseOfDll
,
SizeOfDll
)))
goto
done
;
WARN
(
"Couldn't locate %s
\n
"
,
debugstr_w
(
wImageName
));
...
...
dlls/dbghelp/msc.c
View file @
6a859fb0
...
...
@@ -2139,7 +2139,7 @@ static BOOL pdb_process_internal(const struct process* pcs,
/* Open and map() .PDB file */
if
((
hFile
=
open_pdb_file
(
pcs
,
pdb_lookup
))
==
NULL
||
((
hMap
=
CreateFileMapping
A
(
hFile
,
NULL
,
PAGE_READONLY
,
0
,
0
,
NULL
))
==
NULL
)
||
((
hMap
=
CreateFileMapping
W
(
hFile
,
NULL
,
PAGE_READONLY
,
0
,
0
,
NULL
))
==
NULL
)
||
((
image
=
MapViewOfFile
(
hMap
,
FILE_MAP_READ
,
0
,
0
,
0
))
==
NULL
))
{
WARN
(
"Unable to open .PDB file: %s
\n
"
,
pdb_lookup
->
filename
);
...
...
@@ -2269,7 +2269,7 @@ BOOL pdb_fetch_file_info(struct pdb_lookup* pdb_lookup)
if
((
hFile
=
CreateFileA
(
pdb_lookup
->
filename
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
))
==
INVALID_HANDLE_VALUE
||
((
hMap
=
CreateFileMapping
A
(
hFile
,
NULL
,
PAGE_READONLY
,
0
,
0
,
NULL
))
==
NULL
)
||
((
hMap
=
CreateFileMapping
W
(
hFile
,
NULL
,
PAGE_READONLY
,
0
,
0
,
NULL
))
==
NULL
)
||
((
image
=
MapViewOfFile
(
hMap
,
FILE_MAP_READ
,
0
,
0
,
0
))
==
NULL
))
{
WARN
(
"Unable to open .PDB file: %s
\n
"
,
pdb_lookup
->
filename
);
...
...
dlls/dbghelp/pe_module.c
View file @
6a859fb0
...
...
@@ -103,7 +103,7 @@ static BOOL pe_load_dbg_file(const struct process* pcs, struct module* module,
if
(
SymFindFileInPath
(
pcs
->
handle
,
NULL
,
dbg_name
,
NULL
,
0
,
0
,
0
,
tmp
,
dbg_match
,
NULL
)
&&
(
hFile
=
CreateFileA
(
tmp
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
))
!=
INVALID_HANDLE_VALUE
&&
((
hMap
=
CreateFileMapping
A
(
hFile
,
NULL
,
PAGE_READONLY
,
0
,
0
,
NULL
))
!=
0
)
&&
((
hMap
=
CreateFileMapping
W
(
hFile
,
NULL
,
PAGE_READONLY
,
0
,
0
,
NULL
))
!=
0
)
&&
((
dbg_mapping
=
MapViewOfFile
(
hMap
,
FILE_MAP_READ
,
0
,
0
,
0
))
!=
NULL
))
{
hdr
=
(
const
IMAGE_SEPARATE_DEBUG_HEADER
*
)
dbg_mapping
;
...
...
@@ -323,38 +323,32 @@ BOOL pe_load_debug_info(const struct process* pcs, struct module* module)
* pe_load_module
*
*/
struct
module
*
pe_load_module
(
struct
process
*
pcs
,
const
char
*
name
,
struct
module
*
pe_load_module
(
struct
process
*
pcs
,
const
WCHAR
*
name
,
HANDLE
hFile
,
DWORD
base
,
DWORD
size
)
{
struct
module
*
module
=
NULL
;
BOOL
opened
=
FALSE
;
HANDLE
hMap
;
void
*
mapping
;
char
loaded_name
[
MAX_PATH
];
WCHAR
loaded_name
[
MAX_PATH
];
loaded_name
[
0
]
=
'\0'
;
if
(
!
hFile
)
{
unsigned
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
pcs
->
search_path
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
char
*
sp
;
if
(
!
name
)
{
/* FIXME SetLastError */
return
NULL
;
}
sp
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
if
(
!
sp
)
return
FALSE
;
WideCharToMultiByte
(
CP_ACP
,
0
,
pcs
->
search_path
,
-
1
,
sp
,
len
,
NULL
,
NULL
);
if
((
hFile
=
FindExecutableImage
(
name
,
sp
,
loaded_name
))
==
NULL
)
if
((
hFile
=
FindExecutableImage
ExW
(
name
,
pcs
->
search_path
,
loaded_name
,
NULL
,
NULL
))
==
NULL
)
return
NULL
;
opened
=
TRUE
;
}
else
if
(
name
)
strcpy
(
loaded_name
,
name
);
else
if
(
name
)
strcpy
W
(
loaded_name
,
name
);
else
if
(
dbghelp_options
&
SYMOPT_DEFERRED_LOADS
)
FIXME
(
"Trouble ahead (no module name passed in deferred mode)
\n
"
);
if
(
!
(
module
=
module_find_by_name
A
(
pcs
,
loaded_name
,
DMT_PE
))
&&
if
(
!
(
module
=
module_find_by_name
(
pcs
,
loaded_name
,
DMT_PE
))
&&
(
hMap
=
CreateFileMappingW
(
hFile
,
NULL
,
PAGE_READONLY
,
0
,
0
,
NULL
))
!=
NULL
)
{
if
((
mapping
=
MapViewOfFile
(
hMap
,
FILE_MAP_READ
,
0
,
0
,
0
))
!=
NULL
)
...
...
@@ -366,7 +360,7 @@ struct module* pe_load_module(struct process* pcs, const char* name,
if
(
!
base
)
base
=
nth
->
OptionalHeader
.
ImageBase
;
if
(
!
size
)
size
=
nth
->
OptionalHeader
.
SizeOfImage
;
module
=
module_new
A
(
pcs
,
loaded_name
,
DMT_PE
,
FALSE
,
base
,
size
,
module
=
module_new
(
pcs
,
loaded_name
,
DMT_PE
,
FALSE
,
base
,
size
,
nth
->
FileHeader
.
TimeDateStamp
,
nth
->
OptionalHeader
.
CheckSum
);
if
(
module
)
...
...
@@ -405,17 +399,17 @@ BOOL pe_load_nt_header(HANDLE hProc, DWORD base, IMAGE_NT_HEADERS* nth)
* pe_load_module_from_pcs
*
*/
struct
module
*
pe_load_module_from_pcs
(
struct
process
*
pcs
,
const
char
*
name
,
const
char
*
mod_name
,
DWORD
base
,
DWORD
size
)
struct
module
*
pe_load_module_from_pcs
(
struct
process
*
pcs
,
const
WCHAR
*
name
,
const
WCHAR
*
mod_name
,
DWORD
base
,
DWORD
size
)
{
struct
module
*
module
;
const
char
*
ptr
;
const
WCHAR
*
ptr
;
if
((
module
=
module_find_by_name
A
(
pcs
,
name
,
DMT_PE
)))
return
module
;
if
((
module
=
module_find_by_name
(
pcs
,
name
,
DMT_PE
)))
return
module
;
if
(
mod_name
)
ptr
=
mod_name
;
else
{
for
(
ptr
=
name
+
strlen
(
name
)
-
1
;
ptr
>=
name
;
ptr
--
)
for
(
ptr
=
name
+
strlen
W
(
name
)
-
1
;
ptr
>=
name
;
ptr
--
)
{
if
(
*
ptr
==
'/'
||
*
ptr
==
'\\'
)
{
...
...
@@ -424,7 +418,7 @@ struct module* pe_load_module_from_pcs(struct process* pcs, const char* name,
}
}
}
if
(
ptr
&&
(
module
=
module_find_by_name
A
(
pcs
,
ptr
,
DMT_PE
)))
return
module
;
if
(
ptr
&&
(
module
=
module_find_by_name
(
pcs
,
ptr
,
DMT_PE
)))
return
module
;
if
(
base
)
{
if
(
pcs
->
dbg_hdr_addr
)
...
...
@@ -434,12 +428,12 @@ struct module* pe_load_module_from_pcs(struct process* pcs, const char* name,
if
(
pe_load_nt_header
(
pcs
->
handle
,
base
,
&
nth
))
{
if
(
!
size
)
size
=
nth
.
OptionalHeader
.
SizeOfImage
;
module
=
module_new
A
(
pcs
,
name
,
DMT_PE
,
FALSE
,
base
,
size
,
module
=
module_new
(
pcs
,
name
,
DMT_PE
,
FALSE
,
base
,
size
,
nth
.
FileHeader
.
TimeDateStamp
,
nth
.
OptionalHeader
.
CheckSum
);
}
}
else
if
(
size
)
module
=
module_new
A
(
pcs
,
name
,
DMT_PE
,
FALSE
,
base
,
size
,
module
=
module_new
(
pcs
,
name
,
DMT_PE
,
FALSE
,
base
,
size
,
0
/* FIXME */
,
0
/* FIXME */
);
}
return
module
;
...
...
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