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
31726e38
Commit
31726e38
authored
Aug 16, 2006
by
Robert Shearman
Committed by
Alexandre Julliard
Aug 16, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Add tests for the failure cases of CLSIDFromProgID and fix the function to conform to these.
parent
4bbc3ca8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
4 deletions
+28
-4
compobj.c
dlls/ole32/compobj.c
+14
-4
compobj.c
dlls/ole32/tests/compobj.c
+14
-0
No files found.
dlls/ole32/compobj.c
View file @
31726e38
...
...
@@ -1102,20 +1102,30 @@ HRESULT WINAPI ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *lplpszProgID)
*
* PARAMS
* progid [I] Unicode program ID, as found in registry.
*
riid
[O] Associated CLSID.
*
clsid
[O] Associated CLSID.
*
* RETURNS
* Success: S_OK
* Failure: CO_E_CLASSSTRING - the given ProgID cannot be found.
*/
HRESULT
WINAPI
CLSIDFromProgID
(
LPCOLESTR
progid
,
LPCLSID
ri
id
)
HRESULT
WINAPI
CLSIDFromProgID
(
LPCOLESTR
progid
,
LPCLSID
cls
id
)
{
static
const
WCHAR
clsidW
[]
=
{
'\\'
,
'C'
,
'L'
,
'S'
,
'I'
,
'D'
,
0
};
WCHAR
buf2
[
CHARS_IN_GUID
];
LONG
buf2len
=
sizeof
(
buf2
);
HKEY
xhkey
;
WCHAR
*
buf
;
WCHAR
*
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,(
strlenW
(
progid
)
+
8
)
*
sizeof
(
WCHAR
)
);
if
(
!
progid
||
!
clsid
)
{
ERR
(
"neither progid (%p) nor clsid (%p) are optional
\n
"
,
progid
,
clsid
);
return
E_INVALIDARG
;
}
/* initialise clsid in case of failure */
memset
(
clsid
,
0
,
sizeof
(
*
clsid
));
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,(
strlenW
(
progid
)
+
8
)
*
sizeof
(
WCHAR
)
);
strcpyW
(
buf
,
progid
);
strcatW
(
buf
,
clsidW
);
if
(
RegOpenKeyW
(
HKEY_CLASSES_ROOT
,
buf
,
&
xhkey
))
...
...
@@ -1131,7 +1141,7 @@ HRESULT WINAPI CLSIDFromProgID(LPCOLESTR progid, LPCLSID riid)
return
CO_E_CLASSSTRING
;
}
RegCloseKey
(
xhkey
);
return
CLSIDFromString
(
buf2
,
ri
id
);
return
CLSIDFromString
(
buf2
,
cls
id
);
}
...
...
dlls/ole32/tests/compobj.c
View file @
31726e38
...
...
@@ -37,6 +37,7 @@ HRESULT (WINAPI * pCoInitializeEx)(LPVOID lpReserved, DWORD dwCoInit);
static
const
CLSID
CLSID_non_existent
=
{
0x12345678
,
0x1234
,
0x1234
,
{
0x12
,
0x34
,
0x56
,
0x78
,
0x9a
,
0xbc
,
0xde
,
0xf0
}
};
static
const
CLSID
CLSID_CDeviceMoniker
=
{
0x4315d437
,
0x5b8c
,
0x11d0
,
{
0xbd
,
0x3b
,
0x00
,
0xa0
,
0xc9
,
0x11
,
0xce
,
0x86
}
};
static
const
WCHAR
devicedotone
[]
=
{
'd'
,
'e'
,
'v'
,
'i'
,
'c'
,
'e'
,
'.'
,
'1'
,
0
};
static
const
WCHAR
wszNonExistant
[]
=
{
'N'
,
'o'
,
'n'
,
'E'
,
'x'
,
'i'
,
's'
,
't'
,
'a'
,
'n'
,
't'
,
0
};
static
const
WCHAR
wszCLSID_CDeviceMoniker
[]
=
{
'{'
,
...
...
@@ -84,6 +85,19 @@ static void test_CLSIDFromProgID(void)
hr
=
CLSIDFromString
((
LPOLESTR
)
devicedotone
,
&
clsid
);
ok_ole_success
(
hr
,
"CLSIDFromString"
);
ok
(
IsEqualCLSID
(
&
clsid
,
&
CLSID_CDeviceMoniker
),
"clsid wasn't equal to CLSID_CDeviceMoniker
\n
"
);
/* test some failure cases */
hr
=
CLSIDFromProgID
(
wszNonExistant
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"CLSIDFromProgID should have returned E_INVALIDARG instead of 0x%08lx
\n
"
,
hr
);
hr
=
CLSIDFromProgID
(
NULL
,
&
clsid
);
ok
(
hr
==
E_INVALIDARG
,
"CLSIDFromProgID should have returned E_INVALIDARG instead of 0x%08lx
\n
"
,
hr
);
memset
(
&
clsid
,
0xcc
,
sizeof
(
clsid
));
hr
=
CLSIDFromProgID
(
wszNonExistant
,
&
clsid
);
ok
(
hr
==
CO_E_CLASSSTRING
,
"CLSIDFromProgID on non-existant ProgID should have returned CO_E_CLASSSTRING instead of 0x%08lx
\n
"
,
hr
);
ok
(
IsEqualCLSID
(
&
clsid
,
&
CLSID_NULL
),
"CLSIDFromProgID should have set clsid to all-zeros on failure
\n
"
);
}
static
void
test_CLSIDFromString
(
void
)
...
...
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