f6067312027499d1b1df6144f29282b86e7156cb
1 /* Unit test suite for SHLWAPI Class ID functions
3 * Copyright 2003 Jon Griffiths
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #define WIN32_NO_STATUS
22 #define COM_NO_WINDOWS_H
26 #include <wine/test.h>
27 //#include "winbase.h"
28 //#include "winerror.h"
30 //#include "winuser.h"
37 DEFINE_GUID(GUID_NULL
,0,0,0,0,0,0,0,0,0,0,0);
39 /* This GUID has been removed from the PSDK */
40 DEFINE_OLEGUID(WINE_IID_IDelayedRelease
, 0x000214EDL
, 0, 0);
42 /* Function ptrs for ordinal calls */
43 static HMODULE hShlwapi
= 0;
44 static BOOL (WINAPI
*pSHLWAPI_269
)(LPCSTR
, CLSID
*) = 0;
45 static DWORD (WINAPI
*pSHLWAPI_23
)(REFGUID
, LPSTR
, INT
) = 0;
48 static const GUID
* TEST_guids
[] = {
51 &CATID_BrowsableShellExt
,
60 &CGID_ShellServiceObject
,
62 &IID_INewShortcutHookA
,
66 &IID_IShellPropSheetExt
,
70 &WINE_IID_IDelayedRelease
,
78 &IID_IShellExecuteHookA
,
80 &IID_INewShortcutHookW
,
84 &IID_IShellExecuteHookW
,
89 &IID_IDockingWindowSite
,
104 DEFINE_GUID(IID_Endianness
, 0x01020304, 0x0506, 0x0708, 0x09, 0x0A, 0x0B,
105 0x0C, 0x0D, 0x0E, 0x0F, 0x0A);
107 static void test_ClassIDs(void)
109 const GUID
**guids
= TEST_guids
;
117 if (!pSHLWAPI_269
|| !pSHLWAPI_23
)
122 dwLen
= pSHLWAPI_23(*guids
, szBuff
, 256);
123 if (!i
&& dwLen
== S_OK
) is_vista
= 1; /* seems to return an HRESULT on vista */
124 ok(dwLen
== (is_vista
? S_OK
: 39), "wrong size %u for id %d\n", dwLen
, i
);
126 bRet
= pSHLWAPI_269(szBuff
, &guid
);
127 ok(bRet
!= FALSE
, "created invalid string '%s'\n", szBuff
);
130 ok(IsEqualGUID(*guids
, &guid
), "GUID created wrong %d\n", i
);
136 /* Test endianness */
137 dwLen
= pSHLWAPI_23(&IID_Endianness
, szBuff
, 256);
138 ok(dwLen
== (is_vista
? S_OK
: 39), "wrong size %u for IID_Endianness\n", dwLen
);
140 ok(!strcmp(szBuff
, "{01020304-0506-0708-090A-0B0C0D0E0F0A}"),
141 "Endianness Broken, got '%s'\n", szBuff
);
145 dwLen
= pSHLWAPI_23(&IID_Endianness
, szBuff
, 0);
146 ok(dwLen
== (is_vista
? E_FAIL
: 0), "accepted bad length\n");
147 ok(szBuff
[0] == ':', "wrote to buffer with no length\n");
150 dwLen
= pSHLWAPI_23(&IID_Endianness
, szBuff
, 38);
151 ok(dwLen
== (is_vista
? E_FAIL
: 0), "accepted bad length\n");
152 ok(szBuff
[0] == ':', "wrote to buffer with no length\n");
155 dwLen
= pSHLWAPI_23(&IID_Endianness
, szBuff
, 39);
156 ok(dwLen
== (is_vista
? S_OK
: 39), "rejected ok length\n");
157 ok(szBuff
[0] == '{', "Didn't write to buffer with ok length\n");
160 strcpy(szBuff
, "{xxx-");
161 bRet
= pSHLWAPI_269(szBuff
, &guid
);
162 ok(bRet
== FALSE
, "accepted invalid string\n");
164 dwLen
= pSHLWAPI_23(&IID_Endianness
, szBuff
, 39);
165 ok(dwLen
== (is_vista
? S_OK
: 39), "rejected ok length\n");
166 ok(szBuff
[0] == '{', "Didn't write to buffer with ok length\n");
169 static void test_CLSIDFromProgIDWrap(void)
171 HRESULT (WINAPI
*pCLSIDFromProgIDWrap
)(LPCOLESTR
,LPCLSID
);
172 CLSID clsid
= IID_NULL
;
175 static const WCHAR wszStdPicture
[] = {'S','t','d','P','i','c','t','u','r','e',0};
177 pCLSIDFromProgIDWrap
= (void*)GetProcAddress(hShlwapi
,(char*)435);
179 hres
= pCLSIDFromProgIDWrap(wszStdPicture
, &clsid
);
180 ok(hres
== S_OK
, "CLSIDFromProgIDWrap failed: %08x\n", hres
);
181 ok(IsEqualGUID(&CLSID_StdPicture
, &clsid
), "wrong clsid\n");
183 hres
= pCLSIDFromProgIDWrap(NULL
, &clsid
);
184 ok(hres
== E_INVALIDARG
, "CLSIDFromProgIDWrap failed: %08x, expected E_INVALIDARG\n", hres
);
186 hres
= pCLSIDFromProgIDWrap(wszStdPicture
, NULL
);
187 ok(hres
== E_INVALIDARG
, "CLSIDFromProgIDWrap failed: %08x, expected E_INVALIDARG\n", hres
);
192 hShlwapi
= GetModuleHandleA("shlwapi.dll");
194 /* SHCreateStreamOnFileEx was introduced in shlwapi v6.0 */
195 if(!GetProcAddress(hShlwapi
, "SHCreateStreamOnFileEx")){
196 win_skip("Too old shlwapi version\n");
200 pSHLWAPI_269
= (void*)GetProcAddress(hShlwapi
, (LPSTR
)269);
201 pSHLWAPI_23
= (void*)GetProcAddress(hShlwapi
, (LPSTR
)23);
204 test_CLSIDFromProgIDWrap();