Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
dbe9f348
Commit
dbe9f348
authored
Jul 30, 2023
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Aug 01, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32/tests: Get rid of the a2bstr() helper.
parent
a16cf638
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
30 deletions
+18
-30
shelldispatch.c
dlls/shell32/tests/shelldispatch.c
+18
-30
No files found.
dlls/shell32/tests/shelldispatch.c
View file @
dbe9f348
...
@@ -47,22 +47,10 @@ static HRESULT (WINAPI *pSHGetNameFromIDList)(PCIDLIST_ABSOLUTE,SIGDN,PWSTR*);
...
@@ -47,22 +47,10 @@ static HRESULT (WINAPI *pSHGetNameFromIDList)(PCIDLIST_ABSOLUTE,SIGDN,PWSTR*);
/* Updated Windows 7 has a new IShellDispatch6 in its typelib */
/* Updated Windows 7 has a new IShellDispatch6 in its typelib */
DEFINE_GUID
(
IID_IWin7ShellDispatch6
,
0x34936ba1
,
0x67ad
,
0x4c41
,
0x99
,
0xb8
,
0x8c
,
0x12
,
0xdf
,
0xf1
,
0xe9
,
0x74
);
DEFINE_GUID
(
IID_IWin7ShellDispatch6
,
0x34936ba1
,
0x67ad
,
0x4c41
,
0x99
,
0xb8
,
0x8c
,
0x12
,
0xdf
,
0xf1
,
0xe9
,
0x74
);
static
BSTR
a2bstr
(
const
char
*
str
)
static
void
variant_set_string
(
VARIANT
*
v
,
const
WCHAR
*
s
)
{
BSTR
ret
;
int
len
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
NULL
,
0
);
ret
=
SysAllocStringLen
(
NULL
,
len
);
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
ret
,
len
);
return
ret
;
}
static
void
variant_set_string
(
VARIANT
*
v
,
const
char
*
s
)
{
{
V_VT
(
v
)
=
VT_BSTR
;
V_VT
(
v
)
=
VT_BSTR
;
V_BSTR
(
v
)
=
a2bstr
(
s
);
V_BSTR
(
v
)
=
SysAllocString
(
s
);
}
}
static
void
init_function_pointers
(
void
)
static
void
init_function_pointers
(
void
)
...
@@ -356,7 +344,7 @@ static void test_items(void)
...
@@ -356,7 +344,7 @@ static void test_items(void)
{
{
static
const
struct
static
const
struct
{
{
char
name
[
32
];
WCHAR
name
[
32
];
enum
enum
{
{
DIRECTORY
,
DIRECTORY
,
...
@@ -366,8 +354,8 @@ static void test_items(void)
...
@@ -366,8 +354,8 @@ static void test_items(void)
}
}
file_defs
[]
=
file_defs
[]
=
{
{
{
"00-Myfolder"
,
DIRECTORY
},
{
L
"00-Myfolder"
,
DIRECTORY
},
{
"01-empty.bin"
,
EMPTY_FILE
},
{
L
"01-empty.bin"
,
EMPTY_FILE
},
};
};
WCHAR
path
[
MAX_PATH
],
cur_dir
[
MAX_PATH
],
orig_dir
[
MAX_PATH
];
WCHAR
path
[
MAX_PATH
],
cur_dir
[
MAX_PATH
],
orig_dir
[
MAX_PATH
];
HRESULT
r
;
HRESULT
r
;
...
@@ -384,7 +372,7 @@ static void test_items(void)
...
@@ -384,7 +372,7 @@ static void test_items(void)
IUnknown
*
unk
;
IUnknown
*
unk
;
HANDLE
file
;
HANDLE
file
;
BSTR
bstr
;
BSTR
bstr
;
char
cstr
[
64
];
WCHAR
cstr
[
64
];
BOOL
ret
;
BOOL
ret
;
int
i
;
int
i
;
...
@@ -475,16 +463,16 @@ static void test_items(void)
...
@@ -475,16 +463,16 @@ static void test_items(void)
switch
(
file_defs
[
i
].
type
)
switch
(
file_defs
[
i
].
type
)
{
{
case
DIRECTORY
:
case
DIRECTORY
:
r
=
CreateDirectory
A
(
file_defs
[
i
].
name
,
NULL
);
r
=
CreateDirectory
W
(
file_defs
[
i
].
name
,
NULL
);
ok
(
r
,
"CreateDirectory failed: %08lx
\n
"
,
GetLastError
());
ok
(
r
,
"CreateDirectory failed: %08lx
\n
"
,
GetLastError
());
PathCombine
A
(
cstr
,
file_defs
[
i
].
name
,
"foo.txt"
);
PathCombine
W
(
cstr
,
file_defs
[
i
].
name
,
L
"foo.txt"
);
file
=
CreateFile
A
(
cstr
,
0
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
file
=
CreateFile
W
(
cstr
,
0
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"CreateFile failed: %08lx
\n
"
,
GetLastError
());
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"CreateFile failed: %08lx
\n
"
,
GetLastError
());
CloseHandle
(
file
);
CloseHandle
(
file
);
break
;
break
;
case
EMPTY_FILE
:
case
EMPTY_FILE
:
file
=
CreateFile
A
(
file_defs
[
i
].
name
,
0
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
file
=
CreateFile
W
(
file_defs
[
i
].
name
,
0
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"CreateFile failed: %08lx
\n
"
,
GetLastError
());
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"CreateFile failed: %08lx
\n
"
,
GetLastError
());
CloseHandle
(
file
);
CloseHandle
(
file
);
break
;
break
;
...
@@ -644,7 +632,7 @@ static void test_items(void)
...
@@ -644,7 +632,7 @@ static void test_items(void)
"file_defs[%d]: expected %s, got %s
\n
"
,
i
,
wine_dbgstr_w
(
path
),
wine_dbgstr_w
(
bstr
));
"file_defs[%d]: expected %s, got %s
\n
"
,
i
,
wine_dbgstr_w
(
path
),
wine_dbgstr_w
(
bstr
));
SysFreeString
(
bstr
);
SysFreeString
(
bstr
);
bstr
=
a2bstr
(
file_defs
[
i
].
name
);
bstr
=
SysAllocString
(
file_defs
[
i
].
name
);
r
=
FolderItem_get_Name
(
item
,
&
name
);
r
=
FolderItem_get_Name
(
item
,
&
name
);
ok
(
r
==
S_OK
,
"Failed to get item name, hr %#lx.
\n
"
,
r
);
ok
(
r
==
S_OK
,
"Failed to get item name, hr %#lx.
\n
"
,
r
);
/* Returned display name does not have to strictly match file name, e.g. extension could be omitted. */
/* Returned display name does not have to strictly match file name, e.g. extension could be omitted. */
...
@@ -678,7 +666,7 @@ static void test_items(void)
...
@@ -678,7 +666,7 @@ static void test_items(void)
if
(
file_defs
[
i
].
type
==
DIRECTORY
)
if
(
file_defs
[
i
].
type
==
DIRECTORY
)
{
{
/* test that getting an item object for a file in a subdirectory succeeds */
/* test that getting an item object for a file in a subdirectory succeeds */
PathCombine
A
(
cstr
,
file_defs
[
i
].
name
,
"foo.txt"
);
PathCombine
W
(
cstr
,
file_defs
[
i
].
name
,
L
"foo.txt"
);
variant_set_string
(
&
str_index2
,
cstr
);
variant_set_string
(
&
str_index2
,
cstr
);
item2
=
NULL
;
item2
=
NULL
;
r
=
FolderItems_Item
(
items
,
str_index2
,
&
item2
);
r
=
FolderItems_Item
(
items
,
str_index2
,
&
item2
);
...
@@ -688,13 +676,13 @@ static void test_items(void)
...
@@ -688,13 +676,13 @@ static void test_items(void)
VariantClear
(
&
str_index2
);
VariantClear
(
&
str_index2
);
/* delete the file in the subdirectory */
/* delete the file in the subdirectory */
ret
=
DeleteFile
A
(
cstr
);
ret
=
DeleteFile
W
(
cstr
);
ok
(
ret
,
"file_defs[%d]: DeleteFile failed: %08lx
\n
"
,
i
,
GetLastError
());
ok
(
ret
,
"file_defs[%d]: DeleteFile failed: %08lx
\n
"
,
i
,
GetLastError
());
/* test that getting an item object via a relative path fails */
/* test that getting an item object via a relative path fails */
str
cpy
(
cstr
,
file_defs
[
i
].
name
);
wcs
cpy
(
cstr
,
file_defs
[
i
].
name
);
strcat
(
cstr
,
"
\\
..
\\
"
);
wcscat
(
cstr
,
L
"
\\
..
\\
"
);
str
cat
(
cstr
,
file_defs
[
i
].
name
);
wcs
cat
(
cstr
,
file_defs
[
i
].
name
);
variant_set_string
(
&
str_index2
,
cstr
);
variant_set_string
(
&
str_index2
,
cstr
);
item2
=
(
FolderItem
*
)
0xdeadbeef
;
item2
=
(
FolderItem
*
)
0xdeadbeef
;
r
=
FolderItems_Item
(
items
,
str_index2
,
&
item2
);
r
=
FolderItems_Item
(
items
,
str_index2
,
&
item2
);
...
@@ -703,12 +691,12 @@ static void test_items(void)
...
@@ -703,12 +691,12 @@ static void test_items(void)
VariantClear
(
&
str_index2
);
VariantClear
(
&
str_index2
);
/* remove the directory */
/* remove the directory */
ret
=
RemoveDirectory
A
(
file_defs
[
i
].
name
);
ret
=
RemoveDirectory
W
(
file_defs
[
i
].
name
);
ok
(
ret
,
"file_defs[%d]: RemoveDirectory failed: %08lx
\n
"
,
i
,
GetLastError
());
ok
(
ret
,
"file_defs[%d]: RemoveDirectory failed: %08lx
\n
"
,
i
,
GetLastError
());
}
}
else
else
{
{
ret
=
DeleteFile
A
(
file_defs
[
i
].
name
);
ret
=
DeleteFile
W
(
file_defs
[
i
].
name
);
ok
(
ret
,
"file_defs[%d]: DeleteFile failed: %08lx
\n
"
,
i
,
GetLastError
());
ok
(
ret
,
"file_defs[%d]: DeleteFile failed: %08lx
\n
"
,
i
,
GetLastError
());
}
}
...
...
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