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
88a883df
Commit
88a883df
authored
Nov 02, 2008
by
Francois Gouget
Committed by
Alexandre Julliard
Nov 03, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shlwapi/tests: AssocQueryStringA/W() are missing on Windows 98.
parent
628b5aeb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
15 deletions
+41
-15
assoc.c
dlls/shlwapi/tests/assoc.c
+41
-15
No files found.
dlls/shlwapi/tests/assoc.c
View file @
88a883df
...
...
@@ -25,6 +25,9 @@
#define expect(expected, got) ok ( expected == got, "Expected %d, got %d\n", expected, got)
#define expect_hr(expected, got) ok ( expected == got, "Expected %08x, got %08x\n", expected, got)
static
HRESULT
(
WINAPI
*
pAssocQueryStringA
)(
ASSOCF
,
ASSOCSTR
,
LPCSTR
,
LPCSTR
,
LPSTR
,
LPDWORD
)
=
NULL
;
static
HRESULT
(
WINAPI
*
pAssocQueryStringW
)(
ASSOCF
,
ASSOCSTR
,
LPCWSTR
,
LPCWSTR
,
LPWSTR
,
LPDWORD
)
=
NULL
;
/* Every version of Windows with IE should have this association? */
static
const
WCHAR
dotHtml
[]
=
{
'.'
,
'h'
,
't'
,
'm'
,
'l'
,
0
};
static
const
WCHAR
badBad
[]
=
{
'b'
,
'a'
,
'd'
,
'b'
,
'a'
,
'd'
,
0
};
...
...
@@ -37,45 +40,51 @@ static void test_getstring_bad(void)
HRESULT
hr
;
DWORD
len
;
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_EXECUTABLE
,
NULL
,
open
,
NULL
,
&
len
);
if
(
!
pAssocQueryStringW
)
{
win_skip
(
"AssocQueryStringW() is missing
\n
"
);
return
;
}
hr
=
pAssocQueryStringW
(
0
,
ASSOCSTR_EXECUTABLE
,
NULL
,
open
,
NULL
,
&
len
);
expect_hr
(
E_INVALIDARG
,
hr
);
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_EXECUTABLE
,
badBad
,
open
,
NULL
,
&
len
);
hr
=
p
AssocQueryStringW
(
0
,
ASSOCSTR_EXECUTABLE
,
badBad
,
open
,
NULL
,
&
len
);
ok
(
hr
==
E_FAIL
||
hr
==
HRESULT_FROM_WIN32
(
ERROR_NO_ASSOCIATION
),
/* Win9x/WinMe/NT4/W2K/Vista/W2K8 */
"Unexpected result : %08x
\n
"
,
hr
);
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_EXECUTABLE
,
dotBad
,
open
,
NULL
,
&
len
);
hr
=
p
AssocQueryStringW
(
0
,
ASSOCSTR_EXECUTABLE
,
dotBad
,
open
,
NULL
,
&
len
);
ok
(
hr
==
E_FAIL
||
hr
==
HRESULT_FROM_WIN32
(
ERROR_NO_ASSOCIATION
),
/* Win9x/WinMe/NT4/W2K/Vista/W2K8 */
"Unexpected result : %08x
\n
"
,
hr
);
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_EXECUTABLE
,
dotHtml
,
invalid
,
NULL
,
hr
=
p
AssocQueryStringW
(
0
,
ASSOCSTR_EXECUTABLE
,
dotHtml
,
invalid
,
NULL
,
&
len
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
)
||
hr
==
HRESULT_FROM_WIN32
(
ERROR_NO_ASSOCIATION
),
/* Win9x/WinMe/NT4/W2K/Vista/W2K8 */
"Unexpected result : %08x
\n
"
,
hr
);
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_EXECUTABLE
,
dotHtml
,
open
,
NULL
,
NULL
);
hr
=
p
AssocQueryStringW
(
0
,
ASSOCSTR_EXECUTABLE
,
dotHtml
,
open
,
NULL
,
NULL
);
ok
(
hr
==
E_UNEXPECTED
||
hr
==
E_INVALIDARG
,
/* Win9x/WinMe/NT4/W2K/Vista/W2K8 */
"Unexpected result : %08x
\n
"
,
hr
);
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_FRIENDLYAPPNAME
,
NULL
,
open
,
NULL
,
&
len
);
hr
=
p
AssocQueryStringW
(
0
,
ASSOCSTR_FRIENDLYAPPNAME
,
NULL
,
open
,
NULL
,
&
len
);
expect_hr
(
E_INVALIDARG
,
hr
);
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_FRIENDLYAPPNAME
,
badBad
,
open
,
NULL
,
hr
=
p
AssocQueryStringW
(
0
,
ASSOCSTR_FRIENDLYAPPNAME
,
badBad
,
open
,
NULL
,
&
len
);
ok
(
hr
==
E_FAIL
||
hr
==
HRESULT_FROM_WIN32
(
ERROR_NO_ASSOCIATION
),
/* Win9x/WinMe/NT4/W2K/Vista/W2K8 */
"Unexpected result : %08x
\n
"
,
hr
);
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_FRIENDLYAPPNAME
,
dotBad
,
open
,
NULL
,
hr
=
p
AssocQueryStringW
(
0
,
ASSOCSTR_FRIENDLYAPPNAME
,
dotBad
,
open
,
NULL
,
&
len
);
ok
(
hr
==
E_FAIL
||
hr
==
HRESULT_FROM_WIN32
(
ERROR_NO_ASSOCIATION
),
/* Win9x/WinMe/NT4/W2K/Vista/W2K8 */
"Unexpected result : %08x
\n
"
,
hr
);
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_FRIENDLYAPPNAME
,
dotHtml
,
invalid
,
NULL
,
hr
=
p
AssocQueryStringW
(
0
,
ASSOCSTR_FRIENDLYAPPNAME
,
dotHtml
,
invalid
,
NULL
,
&
len
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
)
||
hr
==
HRESULT_FROM_WIN32
(
ERROR_NO_ASSOCIATION
)
||
/* W2K/Vista/W2K8 */
hr
==
E_FAIL
,
/* Win9x/WinMe/NT4 */
"Unexpected result : %08x
\n
"
,
hr
);
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_FRIENDLYAPPNAME
,
dotHtml
,
open
,
NULL
,
hr
=
p
AssocQueryStringW
(
0
,
ASSOCSTR_FRIENDLYAPPNAME
,
dotHtml
,
open
,
NULL
,
NULL
);
ok
(
hr
==
E_UNEXPECTED
||
hr
==
E_INVALIDARG
,
/* Win9x/WinMe/NT4/W2K/Vista/W2K8 */
...
...
@@ -89,7 +98,13 @@ static void test_getstring_basic(void)
WCHAR
*
executableName
;
DWORD
len
,
len2
,
slen
;
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_EXECUTABLE
,
dotHtml
,
open
,
NULL
,
&
len
);
if
(
!
pAssocQueryStringW
)
{
win_skip
(
"AssocQueryStringW() is missing
\n
"
);
return
;
}
hr
=
pAssocQueryStringW
(
0
,
ASSOCSTR_EXECUTABLE
,
dotHtml
,
open
,
NULL
,
&
len
);
expect_hr
(
S_FALSE
,
hr
);
if
(
hr
!=
S_FALSE
)
{
...
...
@@ -106,14 +121,14 @@ static void test_getstring_basic(void)
}
len2
=
len
;
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_EXECUTABLE
,
dotHtml
,
open
,
hr
=
p
AssocQueryStringW
(
0
,
ASSOCSTR_EXECUTABLE
,
dotHtml
,
open
,
executableName
,
&
len2
);
expect_hr
(
S_OK
,
hr
);
slen
=
lstrlenW
(
executableName
)
+
1
;
expect
(
len
,
len2
);
expect
(
len
,
slen
);
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_FRIENDLYAPPNAME
,
dotHtml
,
open
,
NULL
,
hr
=
p
AssocQueryStringW
(
0
,
ASSOCSTR_FRIENDLYAPPNAME
,
dotHtml
,
open
,
NULL
,
&
len
);
expect_hr
(
S_FALSE
,
hr
);
if
(
hr
!=
S_FALSE
)
...
...
@@ -133,7 +148,7 @@ static void test_getstring_basic(void)
}
len2
=
len
;
hr
=
AssocQueryStringW
(
0
,
ASSOCSTR_FRIENDLYAPPNAME
,
dotHtml
,
open
,
hr
=
p
AssocQueryStringW
(
0
,
ASSOCSTR_FRIENDLYAPPNAME
,
dotHtml
,
open
,
friendlyName
,
&
len2
);
expect_hr
(
S_OK
,
hr
);
slen
=
lstrlenW
(
friendlyName
)
+
1
;
...
...
@@ -167,6 +182,12 @@ static void test_getstring_no_extra(void)
CHAR
buf
[
MAX_PATH
];
DWORD
len
=
MAX_PATH
;
if
(
!
pAssocQueryStringA
)
{
win_skip
(
"AssocQueryStringA() is missing
\n
"
);
return
;
}
buf
[
0
]
=
'\0'
;
ret
=
RegCreateKeyA
(
HKEY_CLASSES_ROOT
,
dotWinetest
,
&
hkey
);
if
(
ret
!=
ERROR_SUCCESS
)
{
...
...
@@ -197,7 +218,7 @@ static void test_getstring_no_extra(void)
goto
cleanup
;
}
hr
=
AssocQueryStringA
(
0
,
ASSOCSTR_EXECUTABLE
,
dotWinetest
,
NULL
,
buf
,
&
len
);
hr
=
p
AssocQueryStringA
(
0
,
ASSOCSTR_EXECUTABLE
,
dotWinetest
,
NULL
,
buf
,
&
len
);
expect_hr
(
S_OK
,
hr
);
ok
(
strstr
(
buf
,
action
)
!=
NULL
,
"got '%s' (Expected result to include 'notepad.exe')
\n
"
,
buf
);
...
...
@@ -210,6 +231,11 @@ cleanup:
START_TEST
(
assoc
)
{
HMODULE
hshlwapi
;
hshlwapi
=
GetModuleHandleA
(
"shlwapi.dll"
);
pAssocQueryStringA
=
(
void
*
)
GetProcAddress
(
hshlwapi
,
"AssocQueryStringA"
);
pAssocQueryStringW
=
(
void
*
)
GetProcAddress
(
hshlwapi
,
"AssocQueryStringW"
);
test_getstring_bad
();
test_getstring_basic
();
test_getstring_no_extra
();
...
...
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