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
22 #include "wine/test.h"
34 /* This GUID has been removed from the PSDK */
35 DEFINE_OLEGUID(WINE_IID_IDelayedRelease, 0x000214EDL, 0, 0);
37 /* Function ptrs for ordinal calls */
38 static HMODULE hShlwapi = 0;
39 static BOOL (WINAPI *pSHLWAPI_269)(LPCSTR, CLSID *) = 0;
40 static DWORD (WINAPI *pSHLWAPI_23)(REFGUID, LPSTR, INT) = 0;
43 const GUID * TEST_guids[] = {
46 &CATID_BrowsableShellExt,
55 &CGID_ShellServiceObject,
57 &IID_INewShortcutHookA,
61 &IID_IShellPropSheetExt,
65 &WINE_IID_IDelayedRelease,
73 &IID_IShellExecuteHookA,
75 &IID_INewShortcutHookW,
79 &IID_IShellExecuteHookW,
84 &IID_IDockingWindowSite,
99 DEFINE_GUID(IID_Endianess, 0x01020304, 0x0506, 0x0708, 0x09, 0x0A, 0x0B,
100 0x0C, 0x0D, 0x0E, 0x0F, 0x0A);
102 static void test_ClassIDs(void)
104 const GUID **guids = TEST_guids;
111 if (!pSHLWAPI_269 || !pSHLWAPI_23)
116 dwLen = pSHLWAPI_23(*guids, szBuff, 256);
117 ok(dwLen == 39, "wrong size for id %d\n", i);
119 bRet = pSHLWAPI_269(szBuff, &guid);
120 ok(bRet != FALSE, "created invalid string '%s'\n", szBuff);
123 ok(IsEqualGUID(*guids, &guid), "GUID created wrong %d\n", i);
130 dwLen = pSHLWAPI_23(&IID_Endianess, szBuff, 256);
131 ok(dwLen == 39, "wrong size for IID_Endianess\n");
133 ok(!strcmp(szBuff, "{01020304-0506-0708-090A-0B0C0D0E0F0A}"),
134 "Endianess Broken, got '%s'\n", szBuff);
138 dwLen = pSHLWAPI_23(&IID_Endianess, szBuff, 0);
139 ok(dwLen == 0, "accepted bad length\n");
140 ok(szBuff[0] == ':', "wrote to buffer with no length\n");
143 dwLen = pSHLWAPI_23(&IID_Endianess, szBuff, 38);
144 ok(dwLen == 0, "accepted bad length\n");
145 ok(szBuff[0] == ':', "wrote to buffer with no length\n");
148 dwLen = pSHLWAPI_23(&IID_Endianess, szBuff, 39);
149 ok(dwLen == 39, "rejected ok length\n");
150 ok(szBuff[0] == '{', "Didn't write to buffer with ok length\n");
153 strcpy(szBuff, "{xxx-");
154 bRet = pSHLWAPI_269(szBuff, &guid);
155 ok(bRet == FALSE, "accepted invalid string\n");
157 dwLen = pSHLWAPI_23(&IID_Endianess, szBuff, 39);
158 ok(dwLen == 39, "rejected ok length\n");
159 ok(szBuff[0] == '{', "Didn't write to buffer with ok length\n");
162 static void test_CLSIDFromProgIDWrap(void)
164 HRESULT (WINAPI *pCLSIDFromProgIDWrap)(LPCOLESTR,LPCLSID);
165 CLSID clsid = IID_NULL;
168 static const WCHAR wszStdPicture[] = {'S','t','d','P','i','c','t','u','r','e',0};
170 pCLSIDFromProgIDWrap = (void*)GetProcAddress(hShlwapi,(char*)435);
172 hres = pCLSIDFromProgIDWrap(wszStdPicture, &clsid);
173 ok(hres == S_OK, "CLSIDFromProgIDWrap failed: %08x\n", hres);
174 ok(IsEqualGUID(&CLSID_StdPicture, &clsid), "wrong clsid\n");
176 hres = pCLSIDFromProgIDWrap(NULL, &clsid);
177 ok(hres == E_INVALIDARG, "CLSIDFromProgIDWrap failed: %08x, expected E_INVALIDARG\n", hres);
179 hres = pCLSIDFromProgIDWrap(wszStdPicture, NULL);
180 ok(hres == E_INVALIDARG, "CLSIDFromProgIDWrap failed: %08x, expected E_INVALIDARG\n", hres);
185 hShlwapi = GetModuleHandleA("shlwapi.dll");
186 pSHLWAPI_269 = (void*)GetProcAddress(hShlwapi, (LPSTR)269);
187 pSHLWAPI_23 = (void*)GetProcAddress(hShlwapi, (LPSTR)23);
190 test_CLSIDFromProgIDWrap();