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
eee9b8ee
Commit
eee9b8ee
authored
Oct 10, 2012
by
Francois Gouget
Committed by
Alexandre Julliard
Oct 10, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32/tests: Simplify shlexec's test_directory() and add some more tests.
parent
c82d96fd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
33 deletions
+35
-33
shlexec.c
dlls/shell32/tests/shlexec.c
+35
-33
No files found.
dlls/shell32/tests/shlexec.c
View file @
eee9b8ee
...
...
@@ -818,26 +818,6 @@ static DWORD get_long_path_name(const char* shortpath, char* longpath, DWORD lon
/***
*
* PathFindFileNameA equivalent that supports WinNT
*
***/
static
LPSTR
path_find_file_name
(
LPCSTR
lpszPath
)
{
LPCSTR
lastSlash
=
lpszPath
;
while
(
lpszPath
&&
*
lpszPath
)
{
if
((
*
lpszPath
==
'\\'
||
*
lpszPath
==
'/'
||
*
lpszPath
==
':'
)
&&
lpszPath
[
1
]
&&
lpszPath
[
1
]
!=
'\\'
&&
lpszPath
[
1
]
!=
'/'
)
lastSlash
=
lpszPath
+
1
;
lpszPath
=
CharNext
(
lpszPath
);
}
return
(
LPSTR
)
lastSlash
;
}
/***
*
* Tests
*
***/
...
...
@@ -2592,33 +2572,55 @@ static void cleanup_test(void)
static
void
test_directory
(
void
)
{
char
path
[
MAX_PATH
],
new
dir
[
MAX_PATH
];
char
params
[
1024
];
char
path
[
MAX_PATH
],
cur
dir
[
MAX_PATH
];
char
params
[
1024
]
,
dirpath
[
1024
]
;
INT_PTR
rc
;
/* copy this executable to a new folder and cd to it */
sprintf
(
newdir
,
"%s
\\
newfolder"
,
tmpdir
);
rc
=
CreateDirectoryA
(
newdir
,
NULL
);
ok
(
rc
,
"failed to create %s err %u
\n
"
,
newdir
,
GetLastError
()
);
sprintf
(
path
,
"%s
\\
%s"
,
newdir
,
path_find_file_name
(
argv0
));
sprintf
(
path
,
"%s
\\
test2.exe"
,
tmpdir
);
CopyFileA
(
argv0
,
path
,
FALSE
);
SetCurrentDirectory
(
tmpdir
);
sprintf
(
params
,
"shlexec
\"
%s
\"
Exec"
,
child_file
);
/* Test with the current directory */
GetCurrentDirectoryA
(
sizeof
(
curdir
),
curdir
);
SetCurrentDirectoryA
(
tmpdir
);
rc
=
shell_execute_ex
(
SEE_MASK_NOZONECHECKS
|
SEE_MASK_FLAG_NO_UI
,
NULL
,
path_find_file_name
(
argv0
),
params
,
NULL
,
NULL
);
todo_wine
ok
(
rc
==
SE_ERR_FNF
,
"%s returned %lu
\n
"
,
shell_call
,
rc
);
NULL
,
"test2.exe"
,
params
,
NULL
,
NULL
);
ok
(
rc
>
32
,
"%s returned %lu
\n
"
,
shell_call
,
rc
);
okChildInt
(
"argcA"
,
4
);
okChildString
(
"argvA3"
,
"Exec"
);
todo_wine
okChildPath
(
"longPath"
,
path
);
SetCurrentDirectoryA
(
curdir
);
rc
=
shell_execute_ex
(
SEE_MASK_NOZONECHECKS
|
SEE_MASK_FLAG_NO_UI
,
NULL
,
"test2.exe"
,
params
,
NULL
,
NULL
);
ok
(
rc
==
SE_ERR_FNF
,
"%s returned %lu
\n
"
,
shell_call
,
rc
);
/* Explicitly specify the directory to use */
rc
=
shell_execute_ex
(
SEE_MASK_NOZONECHECKS
|
SEE_MASK_FLAG_NO_UI
,
NULL
,
"test2.exe"
,
params
,
tmpdir
,
NULL
);
ok
(
rc
>
32
,
"%s returned %lu
\n
"
,
shell_call
,
rc
);
okChildInt
(
"argcA"
,
4
);
okChildString
(
"argvA3"
,
"Exec"
);
todo_wine
okChildPath
(
"longPath"
,
path
);
/* Specify it through an environment variable */
rc
=
shell_execute_ex
(
SEE_MASK_NOZONECHECKS
|
SEE_MASK_FLAG_NO_UI
,
NULL
,
path_find_file_name
(
argv0
),
params
,
newdir
,
NULL
);
NULL
,
"test2.exe"
,
params
,
"%TMPDIR%"
,
NULL
);
todo_wine
ok
(
rc
==
SE_ERR_FNF
,
"%s returned %lu
\n
"
,
shell_call
,
rc
);
rc
=
shell_execute_ex
(
SEE_MASK_DOENVSUBST
|
SEE_MASK_NOZONECHECKS
|
SEE_MASK_FLAG_NO_UI
,
NULL
,
"test2.exe"
,
params
,
"%TMPDIR%"
,
NULL
);
ok
(
rc
>
32
,
"%s returned %lu
\n
"
,
shell_call
,
rc
);
okChildInt
(
"argcA"
,
4
);
okChildString
(
"argvA3"
,
"Exec"
);
todo_wine
okChildPath
(
"longPath"
,
path
);
DeleteFile
(
path
);
RemoveDirectoryA
(
newdir
);
/* Not a colon-separated directory list */
sprintf
(
dirpath
,
"%s:%s"
,
curdir
,
tmpdir
);
rc
=
shell_execute_ex
(
SEE_MASK_NOZONECHECKS
|
SEE_MASK_FLAG_NO_UI
,
NULL
,
"test2.exe"
,
params
,
dirpath
,
NULL
);
ok
(
rc
==
SE_ERR_FNF
,
"%s returned %lu
\n
"
,
shell_call
,
rc
);
}
START_TEST
(
shlexec
)
...
...
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