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
520b7c6d
Commit
520b7c6d
authored
Mar 18, 2024
by
Yuxuan Shui
Committed by
Alexandre Julliard
Mar 21, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: PathResolve(file, NULL, ...) should not look in the current directory.
Unless it's explicitly specified.
parent
c6fa51a9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
3 deletions
+35
-3
shellpath.c
dlls/shell32/shellpath.c
+2
-2
shellpath.c
dlls/shell32/tests/shellpath.c
+33
-1
No files found.
dlls/shell32/shellpath.c
View file @
520b7c6d
...
@@ -695,7 +695,7 @@ static BOOL PathResolveA(char *path, const char **dirs, DWORD flags)
...
@@ -695,7 +695,7 @@ static BOOL PathResolveA(char *path, const char **dirs, DWORD flags)
{
{
if
(
PathFindOnPathExA
(
path
,
dirs
,
dwWhich
))
if
(
PathFindOnPathExA
(
path
,
dirs
,
dwWhich
))
return
TRUE
;
return
TRUE
;
if
(
PathFileExistsDefExtA
(
path
,
dwWhich
))
if
(
!
is_file_spec
&&
PathFileExistsDefExtA
(
path
,
dwWhich
))
return
TRUE
;
return
TRUE
;
if
(
!
is_file_spec
)
GetFullPathNameA
(
path
,
MAX_PATH
,
path
,
NULL
);
if
(
!
is_file_spec
)
GetFullPathNameA
(
path
,
MAX_PATH
,
path
,
NULL
);
SetLastError
(
ERROR_FILE_NOT_FOUND
);
SetLastError
(
ERROR_FILE_NOT_FOUND
);
...
@@ -724,7 +724,7 @@ static BOOL PathResolveW(WCHAR *path, const WCHAR **dirs, DWORD flags)
...
@@ -724,7 +724,7 @@ static BOOL PathResolveW(WCHAR *path, const WCHAR **dirs, DWORD flags)
{
{
if
(
PathFindOnPathExW
(
path
,
dirs
,
dwWhich
))
if
(
PathFindOnPathExW
(
path
,
dirs
,
dwWhich
))
return
TRUE
;
return
TRUE
;
if
(
PathFileExistsDefExtW
(
path
,
dwWhich
))
if
(
!
is_file_spec
&&
PathFileExistsDefExtW
(
path
,
dwWhich
))
return
TRUE
;
return
TRUE
;
if
(
!
is_file_spec
)
GetFullPathNameW
(
path
,
MAX_PATH
,
path
,
NULL
);
if
(
!
is_file_spec
)
GetFullPathNameW
(
path
,
MAX_PATH
,
path
,
NULL
);
SetLastError
(
ERROR_FILE_NOT_FOUND
);
SetLastError
(
ERROR_FILE_NOT_FOUND
);
...
...
dlls/shell32/tests/shellpath.c
View file @
520b7c6d
...
@@ -2942,7 +2942,8 @@ if (0) { /* crashes on native */
...
@@ -2942,7 +2942,8 @@ if (0) { /* crashes on native */
static
void
test_PathResolve
(
void
)
static
void
test_PathResolve
(
void
)
{
{
WCHAR
testfile
[
MAX_PATH
],
testfile_lnk
[
MAX_PATH
],
regedit_in_testdir
[
MAX_PATH
],
regedit_cmd
[
MAX_PATH
];
WCHAR
testfile
[
MAX_PATH
],
testfile_lnk
[
MAX_PATH
],
regedit_in_testdir
[
MAX_PATH
],
regedit_cmd
[
MAX_PATH
];
WCHAR
tempdir
[
MAX_PATH
],
path
[
MAX_PATH
];
WCHAR
tempdir
[
MAX_PATH
],
path
[
MAX_PATH
],
curdir
[
MAX_PATH
];
WCHAR
argv0_dir
[
MAX_PATH
]
=
{
0
},
argv0_base
[
MAX_PATH
]
=
{
0
},
*
argv0_basep
=
NULL
;
const
WCHAR
*
dirs
[
2
]
=
{
tempdir
,
NULL
};
const
WCHAR
*
dirs
[
2
]
=
{
tempdir
,
NULL
};
HANDLE
file
,
file2
;
HANDLE
file
,
file2
;
BOOL
ret
;
BOOL
ret
;
...
@@ -3013,6 +3014,15 @@ static void test_PathResolve(void)
...
@@ -3013,6 +3014,15 @@ static void test_PathResolve(void)
return
;
return
;
}
}
ret
=
GetModuleFileNameW
(
NULL
,
argv0_dir
,
sizeof
(
argv0_dir
));
ok
(
ret
!=
0
&&
ret
<
sizeof
(
argv0_dir
),
"GetModuleFileName failed
\n
"
);
if
(
ret
!=
0
&&
ret
<
sizeof
(
argv0_dir
))
{
argv0_basep
=
wcsrchr
(
argv0_dir
,
'\\'
);
*
argv0_basep
=
0
;
argv0_basep
++
;
}
GetTempPathW
(
MAX_PATH
,
tempdir
);
GetTempPathW
(
MAX_PATH
,
tempdir
);
lstrcpyW
(
testfile
,
tempdir
);
lstrcpyW
(
testfile
,
tempdir
);
...
@@ -3038,6 +3048,28 @@ static void test_PathResolve(void)
...
@@ -3038,6 +3048,28 @@ static void test_PathResolve(void)
ok
(
!
lstrcmpiW
(
path
,
L"C:
\\
windows
\\
regedit.exe"
)
||
!
lstrcmpiW
(
path
,
L"C:
\\
windows
\\
system32
\\
regedit.exe"
),
ok
(
!
lstrcmpiW
(
path
,
L"C:
\\
windows
\\
regedit.exe"
)
||
!
lstrcmpiW
(
path
,
L"C:
\\
windows
\\
system32
\\
regedit.exe"
),
"unexpected path %s
\n
"
,
wine_dbgstr_w
(
path
));
"unexpected path %s
\n
"
,
wine_dbgstr_w
(
path
));
/* show that PathResolve doesn't check current directory */
if
(
argv0_basep
)
{
WCHAR
*
ext
;
lstrcpyW
(
argv0_base
,
argv0_basep
);
GetCurrentDirectoryW
(
MAX_PATH
,
curdir
);
SetCurrentDirectoryW
(
argv0_dir
);
ret
=
pPathResolve
(
argv0_base
,
NULL
,
PRF_VERIFYEXISTS
|
PRF_TRYPROGRAMEXTENSIONS
);
ok
(
!
ret
,
"resolving argv0 succeeded unexpectedly, result: %s
\n
"
,
wine_dbgstr_w
(
argv0_base
));
lstrcpyW
(
argv0_base
,
argv0_basep
);
if
((
ext
=
wcsrchr
(
argv0_base
,
'.'
)))
{
*
ext
=
0
;
ret
=
pPathResolve
(
argv0_base
,
NULL
,
PRF_VERIFYEXISTS
|
PRF_TRYPROGRAMEXTENSIONS
);
ok
(
!
ret
,
"resolving argv0 without extension succeeded unexpectedly, result: %s
\n
"
,
wine_dbgstr_w
(
argv0_base
));
}
SetCurrentDirectoryW
(
curdir
);
}
else
win_skip
(
"couldn't get module filename
\n
"
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
tests
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
tests
);
i
++
)
{
{
winetest_push_context
(
"test %d"
,
i
);
winetest_push_context
(
"test %d"
,
i
);
...
...
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