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
33f65267
Commit
33f65267
authored
Jun 17, 2022
by
Alex Henrie
Committed by
Alexandre Julliard
Jun 20, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32/tests: Add tests for Program Manager name sanitization.
Signed-off-by:
Alex Henrie
<
alexhenrie24@gmail.com
>
parent
a2935a51
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
1 deletion
+71
-1
progman_dde.c
dlls/shell32/tests/progman_dde.c
+71
-1
No files found.
dlls/shell32/tests/progman_dde.c
View file @
33f65267
...
...
@@ -23,7 +23,7 @@
* functionality
* - Todo: Handle CommonGroupFlag
* Better AddItem Tests (Lots of parameters to test)
* Tests for
Invalid Characters in Names / Invalid P
arameters
* Tests for
invalid p
arameters
*/
#include <stdio.h>
...
...
@@ -425,6 +425,75 @@ static void test_request_groups(DWORD instance, HCONV hconv)
FindClose
(
hfind
);
}
static
void
test_name_sanitization
(
DWORD
instance
,
HCONV
hConv
)
{
static
const
char
original_name
[]
=
"
\x01\x1F
!#$%&'*+,-./:;<=>?@[
\\
]^`{|}~
\x7F\xFF
"
;
static
const
char
sanitized_name
[]
=
"__ !#$%&'_+,-.__;_=__@[_]^`{_}~
\x7F\xFF
"
;
char
buf
[
128
];
UINT
error
;
if
(
0
)
/* the directory isn't deleted on windows < 7 */
{
error
=
dde_execute
(
instance
,
hConv
,
"[CreateGroup(
\"
\"
)]"
);
ok
(
error
==
DMLERR_NO_ERROR
,
"expected DMLERR_NO_ERROR, got %#x
\n
"
,
error
);
ok
(
check_exists
(
" "
),
"directory not created
\n
"
);
ok
(
!
check_window_exists
(
" "
),
"window should not exist
\n
"
);
error
=
dde_execute
(
instance
,
hConv
,
"[DeleteGroup(
\"
\"
)]"
);
ok
(
error
==
DMLERR_NO_ERROR
,
"expected DMLERR_NO_ERROR, got %#x
\n
"
,
error
);
ok
(
!
check_exists
(
" "
),
"directory should not exist
\n
"
);
}
if
(
0
)
/* these calls will actually delete the start menu */
{
error
=
dde_execute
(
instance
,
hConv
,
"[DeleteGroup(
\"\"
)]"
);
ok
(
error
==
DMLERR_NO_ERROR
,
"expected DMLERR_NO_ERROR, got %#x
\n
"
,
error
);
ok
(
!
check_exists
(
"../Programs"
),
"directory should not exist
\n
"
);
error
=
dde_execute
(
instance
,
hConv
,
"[DeleteGroup(
\"
..
\"
)]"
);
ok
(
error
==
DMLERR_NO_ERROR
,
"expected DMLERR_NO_ERROR, got %#x
\n
"
,
error
);
ok
(
!
check_exists
(
"../../Start Menu"
),
"directory should not exist
\n
"
);
}
sprintf
(
buf
,
"[CreateGroup(
\"
Group%s
\"
)]"
,
original_name
);
error
=
dde_execute
(
instance
,
hConv
,
buf
);
ok
(
error
==
DMLERR_NO_ERROR
,
"expected DMLERR_NO_ERROR, got %#x
\n
"
,
error
);
sprintf
(
buf
,
"Group%s"
,
sanitized_name
);
todo_wine
ok
(
check_exists
(
buf
),
"directory not created
\n
"
);
if
(
!
check_exists
(
buf
))
return
;
ok
(
check_window_exists
(
buf
),
"window not created
\n
"
);
sprintf
(
buf
,
"[ShowGroup(
\"
Group%s
\"
, 0)]"
,
original_name
);
error
=
dde_execute
(
instance
,
hConv
,
buf
);
ok
(
error
==
DMLERR_NO_ERROR
,
"expected DMLERR_NO_ERROR, got %#x
\n
"
,
error
);
sprintf
(
buf
,
"Group%s"
,
sanitized_name
);
ok
(
check_window_exists
(
buf
),
"window not created
\n
"
);
sprintf
(
buf
,
"[AddItem(notepad,
\"
Notepad%s
\"
)]"
,
original_name
);
error
=
dde_execute
(
instance
,
hConv
,
buf
);
ok
(
error
==
DMLERR_NO_ERROR
,
"expected DMLERR_NO_ERROR, got %#x
\n
"
,
error
);
sprintf
(
buf
,
"Group%s/Notepad%s.lnk"
,
sanitized_name
,
sanitized_name
);
ok
(
check_exists
(
buf
),
"link not created
\n
"
);
sprintf
(
buf
,
"[ReplaceItem(
\"
Notepad%s
\"
)]"
,
original_name
);
error
=
dde_execute
(
instance
,
hConv
,
buf
);
ok
(
error
==
DMLERR_NOTPROCESSED
,
"expected DMLERR_NOTPROCESSED, got %#x
\n
"
,
error
);
sprintf
(
buf
,
"Group%s/Notepad%s.lnk"
,
sanitized_name
,
sanitized_name
);
ok
(
check_exists
(
buf
),
"link should still exist
\n
"
);
sprintf
(
buf
,
"[DeleteItem(
\"
Notepad%s
\"
)]"
,
original_name
);
error
=
dde_execute
(
instance
,
hConv
,
buf
);
ok
(
error
==
DMLERR_NOTPROCESSED
,
"expected DMLERR_NOTPROCESSED, got %#x
\n
"
,
error
);
sprintf
(
buf
,
"Group%s/Notepad%s.lnk"
,
sanitized_name
,
sanitized_name
);
ok
(
check_exists
(
buf
),
"link should still exist
\n
"
);
sprintf
(
buf
,
"[DeleteGroup(
\"
Group%s
\"
)]"
,
original_name
);
error
=
dde_execute
(
instance
,
hConv
,
buf
);
ok
(
error
==
DMLERR_NO_ERROR
,
"expected DMLERR_NO_ERROR, got %#x
\n
"
,
error
);
sprintf
(
buf
,
"Group%s"
,
sanitized_name
);
ok
(
!
check_exists
(
buf
),
"directory should not exist
\n
"
);
}
START_TEST
(
progman_dde
)
{
DWORD
instance
=
0
;
...
...
@@ -479,6 +548,7 @@ START_TEST(progman_dde)
/* Run Tests */
test_progman_dde2
(
instance
,
hConv
);
test_name_sanitization
(
instance
,
hConv
);
/* Cleanup & Exit */
ret
=
DdeDisconnect
(
hConv
);
...
...
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