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
31e76b53
Commit
31e76b53
authored
Nov 09, 2022
by
Eric Pouech
Committed by
Alexandre Julliard
Nov 09, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbghelp: Introduce a helper for module lookup.
Signed-off-by:
Eric Pouech
<
eric.pouech@gmail.com
>
parent
e6fd3021
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
36 deletions
+17
-36
path.c
dlls/dbghelp/path.c
+17
-36
No files found.
dlls/dbghelp/path.c
View file @
31e76b53
...
...
@@ -705,14 +705,24 @@ WCHAR *get_dos_file_name(const WCHAR *filename)
return
dos_path
;
}
static
BOOL
try_match_file
(
const
WCHAR
*
name
,
BOOL
(
*
match
)(
void
*
,
HANDLE
,
const
WCHAR
*
),
void
*
param
)
{
HANDLE
file
=
CreateFileW
(
name
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
file
!=
INVALID_HANDLE_VALUE
)
{
BOOL
ret
=
match
(
param
,
file
,
name
);
CloseHandle
(
file
);
return
ret
;
}
return
FALSE
;
}
BOOL
search_dll_path
(
const
struct
process
*
process
,
const
WCHAR
*
name
,
BOOL
(
*
match
)(
void
*
,
HANDLE
,
const
WCHAR
*
),
void
*
param
)
{
const
WCHAR
*
env
;
WCHAR
*
p
,
*
end
;
size_t
len
,
i
;
HANDLE
file
;
WCHAR
*
buf
;
BOOL
ret
;
name
=
file_name
(
name
);
...
...
@@ -733,13 +743,7 @@ BOOL search_dll_path(const struct process *process, const WCHAR *name, BOOL (*ma
p
=
end
+
lstrlenW
(
end
);
*
p
++
=
'\\'
;
lstrcpyW
(
p
,
name
);
file
=
CreateFileW
(
buf
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
file
!=
INVALID_HANDLE_VALUE
)
{
ret
=
match
(
param
,
file
,
buf
);
CloseHandle
(
file
);
if
(
ret
)
goto
found
;
}
if
(
try_match_file
(
buf
,
match
,
param
))
goto
found
;
memcpy
(
end
,
programsW
,
sizeof
(
programsW
));
end
+=
ARRAY_SIZE
(
programsW
);
...
...
@@ -749,13 +753,7 @@ BOOL search_dll_path(const struct process *process, const WCHAR *name, BOOL (*ma
p
=
end
+
lstrlenW
(
end
);
*
p
++
=
'\\'
;
lstrcpyW
(
p
,
name
);
file
=
CreateFileW
(
buf
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
file
!=
INVALID_HANDLE_VALUE
)
{
ret
=
match
(
param
,
file
,
buf
);
CloseHandle
(
file
);
if
(
ret
)
goto
found
;
}
if
(
try_match_file
(
buf
,
match
,
param
))
goto
found
;
heap_free
(
buf
);
}
...
...
@@ -771,21 +769,9 @@ BOOL search_dll_path(const struct process *process, const WCHAR *name, BOOL (*ma
swprintf
(
buf
,
len
,
L"%s%s
\\
%s"
,
env
,
so_dir
,
name
);
else
swprintf
(
buf
,
len
,
L"%s%s
\\
%s"
,
env
,
pe_dir
,
name
);
file
=
CreateFileW
(
buf
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
file
!=
INVALID_HANDLE_VALUE
)
{
ret
=
match
(
param
,
file
,
buf
);
CloseHandle
(
file
);
if
(
ret
)
goto
found
;
}
if
(
try_match_file
(
buf
,
match
,
param
))
goto
found
;
swprintf
(
buf
,
len
,
L"%s
\\
%s"
,
env
,
name
);
file
=
CreateFileW
(
buf
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
file
!=
INVALID_HANDLE_VALUE
)
{
ret
=
match
(
param
,
file
,
buf
);
CloseHandle
(
file
);
if
(
ret
)
goto
found
;
}
if
(
try_match_file
(
buf
,
match
,
param
))
goto
found
;
heap_free
(
buf
);
}
...
...
@@ -822,13 +808,8 @@ BOOL search_unix_path(const WCHAR *name, const WCHAR *path, BOOL (*match)(void*,
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
name
,
-
1
,
buf
+
len
,
size
-
len
,
NULL
,
NULL
);
if
((
dos_path
=
wine_get_dos_file_name
(
buf
)))
{
HANDLE
file
=
CreateFileW
(
dos_path
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
file
!=
INVALID_HANDLE_VALUE
)
{
ret
=
match
(
param
,
file
,
dos_path
);
CloseHandle
(
file
);
ret
=
try_match_file
(
dos_path
,
match
,
param
);
if
(
ret
)
TRACE
(
"found %s
\n
"
,
debugstr_w
(
dos_path
));
}
heap_free
(
dos_path
);
if
(
ret
)
break
;
}
...
...
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