ReactOS 0.4.17-dev-1071-gb2116d0
intshcut.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winerror.h"
#include "shlobj.h"
#include "shobjidl.h"
#include "shlguid.h"
#include "ole2.h"
#include "mshtml.h"
#include "initguid.h"
#include "isguids.h"
#include "intshcut.h"
#include "wine/test.h"
Include dependency graph for intshcut.c:

Go to the source code of this file.

Classes

struct  load_test_t
 

Macros

#define COBJMACROS
 
#define test_shortcut_url(a, b)   _test_shortcut_url(__LINE__,a,b)
 
#define check_string_transform(a, b, c, d, e)   _check_string_transform(__LINE__,a,b,c,d,e)
 

Functions

static HRESULT WINAPI Unknown_QueryInterface (IUnknown *pUnknown, REFIID riid, void **ppvObject)
 
static ULONG WINAPI Unknown_AddRef (IUnknown *pUnknown)
 
static ULONG WINAPI Unknown_Release (IUnknown *pUnknown)
 
static void test_Aggregability (void)
 
static void can_query_interface (IUnknown *pUnknown, REFIID riid)
 
static void test_QueryInterface (void)
 
static void _test_shortcut_url (unsigned line, IUnknown *unk, const char *exurl)
 
static void _check_string_transform (unsigned line, IUniformResourceLocatorA *urlA, LPCSTR input, DWORD flags, LPCSTR expectedOutput, BOOL is_todo)
 
static void test_ReadAndWriteProperties (void)
 
static void test_NullURLs (void)
 
static void test_Load (void)
 
static void test_SetURLFlags (void)
 
static void test_InternetShortcut (void)
 
 START_TEST (intshcut)
 

Variables

static IUnknownVtbl unknownVtbl
 
static IUnknown unknown
 
static const load_test_t load_tests []
 

Macro Definition Documentation

◆ check_string_transform

#define check_string_transform (   a,
  b,
  c,
  d,
  e 
)    _check_string_transform(__LINE__,a,b,c,d,e)

Definition at line 135 of file intshcut.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 24 of file intshcut.c.

◆ test_shortcut_url

#define test_shortcut_url (   a,
  b 
)    _test_shortcut_url(__LINE__,a,b)

Definition at line 117 of file intshcut.c.

Function Documentation

◆ _check_string_transform()

static void _check_string_transform ( unsigned  line,
IUniformResourceLocatorA *  urlA,
LPCSTR  input,
DWORD  flags,
LPCSTR  expectedOutput,
BOOL  is_todo 
)
static

Definition at line 136 of file intshcut.c.

138{
139 CHAR *output;
140 HRESULT hr;
141
142 hr = urlA->lpVtbl->SetURL(urlA, input, flags);
143 ok_(__FILE__,line)(hr == S_OK, "SetUrl failed, hr=0x%lx\n", hr);
144 if (FAILED(hr))
145 return;
146
147 output = (void*)0xdeadbeef;
148 hr = urlA->lpVtbl->GetURL(urlA, &output);
149 if(expectedOutput) {
150 todo_wine_if(is_todo) {
151 ok_(__FILE__,line)(hr == S_OK, "GetUrl failed, hr=0x%lx\n", hr);
152 }
154 ok_(__FILE__,line)(!lstrcmpA(output, expectedOutput), "unexpected URL change %s -> %s (expected %s)\n",
155 input, output, expectedOutput);
156 }else {
158 ok_(__FILE__,line)(hr == S_FALSE, "GetUrl failed, hr=0x%lx\n", hr);
160 ok_(__FILE__,line)(!output, "GetUrl returned %s\n", output);
161 }
162 if (hr == S_OK)
163 CoTaskMemFree(output);
164}
#define ok_(x1, x2)
Definition: atltest.h:61
HRESULT hr
Definition: delayimp.cpp:582
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4104
GLbitfield flags
Definition: glext.h:7161
GLenum GLenum GLenum input
Definition: glext.h:9031
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
#define todo_wine_if(is_todo)
Definition: minitest.h:81
#define todo_wine
Definition: minitest.h:80
char CHAR
Definition: pedump.c:57
Definition: parser.c:49
#define S_FALSE
Definition: winerror.h:3451

◆ _test_shortcut_url()

static void _test_shortcut_url ( unsigned  line,
IUnknown *  unk,
const char *  exurl 
)
static

Definition at line 118 of file intshcut.c.

119{
120 IUniformResourceLocatorA *locator_a;
121 char *url_a;
123
124 hres = IUnknown_QueryInterface(unk, &IID_IUniformResourceLocatorA, (void**)&locator_a);
125 ok_(__FILE__,line)(hres == S_OK, "Could not get IUniformResourceLocatorA iface: %08lx\n", hres);
126
127 hres = locator_a->lpVtbl->GetURL(locator_a, &url_a);
128 ok_(__FILE__,line)(hres == S_OK, "GetURL failed: %08lx\n", hres);
129 ok_(__FILE__,line)(!strcmp(url_a, exurl), "unexpected URL, got %s, expected %s\n", url_a, exurl);
130 CoTaskMemFree(url_a);
131
132 IUnknown_Release((IUnknown*)locator_a);
133}
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3324
HRESULT hres
Definition: protocol.c:432

◆ can_query_interface()

static void can_query_interface ( IUnknown *  pUnknown,
REFIID  riid 
)
static

Definition at line 93 of file intshcut.c.

94{
95 HRESULT hr;
96 IUnknown *newInterface;
97 hr = IUnknown_QueryInterface(pUnknown, riid, (void**)&newInterface);
98 ok(hr == S_OK, "interface %s could not be queried\n", wine_dbgstr_guid(riid));
99 if (SUCCEEDED(hr))
100 IUnknown_Release(newInterface);
101}
#define ok(value,...)
Definition: atltest.h:57
_In_ PUNKNOWN pUnknown
Definition: drmk.h:76
REFIID riid
Definition: atlbase.h:39
#define SUCCEEDED(hr)
Definition: intsafe.h:50
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:181

Referenced by test_QueryInterface().

◆ START_TEST()

START_TEST ( intshcut  )

Definition at line 450 of file intshcut.c.

451{
453
455
457}
#define NULL
Definition: types.h:112
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:162
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:218
static void test_InternetShortcut(void)
Definition: intshcut.c:431

◆ test_Aggregability()

static void test_Aggregability ( void  )
static

Definition at line 72 of file intshcut.c.

73{
74 HRESULT hr;
76
77 hr = CoCreateInstance(&CLSID_InternetShortcut, NULL, CLSCTX_ALL, &IID_IUnknown, (void**)&pUnknown);
78 ok(hr == S_OK, "could not create instance of CLSID_InternetShortcut with IID_IUnknown, hr = 0x%lx\n", hr);
79 if (pUnknown)
80 IUnknown_Release(pUnknown);
81
82 hr = CoCreateInstance(&CLSID_InternetShortcut, NULL, CLSCTX_ALL, &IID_IUniformResourceLocatorA, (void**)&pUnknown);
83 ok(hr == S_OK, "could not create instance of CLSID_InternetShortcut with IID_IUniformResourceLocatorA, hr = 0x%lx\n", hr);
84 if (pUnknown)
85 IUnknown_Release(pUnknown);
86
87 hr = CoCreateInstance(&CLSID_InternetShortcut, &unknown, CLSCTX_ALL, &IID_IUnknown, (void**)&pUnknown);
88 ok(hr == CLASS_E_NOAGGREGATION, "aggregation didn't fail like it should, hr = 0x%lx\n", hr);
89 if (pUnknown)
90 IUnknown_Release(pUnknown);
91}
const GUID IID_IUnknown
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
static IUnknown unknown
Definition: intshcut.c:68
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:3771

Referenced by test_InternetShortcut().

◆ test_InternetShortcut()

static void test_InternetShortcut ( void  )
static

Definition at line 431 of file intshcut.c.

432{
433 IUniformResourceLocatorA *url;
435
436 hres = CoCreateInstance(&CLSID_InternetShortcut, NULL, CLSCTX_ALL, &IID_IUniformResourceLocatorA, (void**)&url);
437 ok(hres == S_OK, "Could not create CLSID_InternetShortcut instance: %08lx\n", hres);
438 if(FAILED(hres))
439 return;
440 url->lpVtbl->Release(url);
441
447 test_Load();
448}
static const WCHAR url[]
Definition: encode.c:1384
static void test_Aggregability(void)
Definition: intshcut.c:72
static void test_ReadAndWriteProperties(void)
Definition: intshcut.c:166
static void test_QueryInterface(void)
Definition: intshcut.c:103
static void test_NullURLs(void)
Definition: intshcut.c:312
static void test_SetURLFlags(void)
Definition: intshcut.c:414
static void test_Load(void)
Definition: intshcut.c:352

Referenced by START_TEST().

◆ test_Load()

static void test_Load ( void  )
static

Definition at line 352 of file intshcut.c.

353{
354 IPersistFile *persist_file;
355 const load_test_t *test;
357 DWORD size;
358 HANDLE file;
360
362 lstrcatW(file_path, L"test.url");
363
365 IPropertySetStorage *propsetstorage;
366 IPropertyStorage *propstorage;
367 PROPVARIANT v;
368 PROPSPEC ps;
369
371 ok(file != INVALID_HANDLE_VALUE, "could not create test file\n");
373 continue;
374
375 WriteFile(file, test->data, strlen(test->data), &size, NULL);
377
378 hres = CoCreateInstance(&CLSID_InternetShortcut, NULL, CLSCTX_ALL, &IID_IPersistFile, (void**)&persist_file);
379 ok(hres == S_OK, "Could not create InternetShortcut instance: %08lx\n", hres);
380
381 hres = IPersistFile_Load(persist_file, file_path, 0);
382 ok(hres == S_OK, "Load failed: %08lx\n", hres);
383
384 test_shortcut_url((IUnknown*)persist_file, test->url);
385
386 hres = IPersistFile_QueryInterface(persist_file, &IID_IPropertySetStorage, (void **)&propsetstorage);
387 ok(hres == S_OK, "Unable to get an IPropertySetStorage, hr=0x%lx\n", hres);
388
389 hres = IPropertySetStorage_Open(propsetstorage, &FMTID_Intshcut, STGM_READ | STGM_SHARE_EXCLUSIVE, &propstorage);
390 ok(hres == S_OK, "Unable to get an IPropertyStorage for reading, hr=0x%lx\n", hres);
391
392 ps.ulKind = PRSPEC_PROPID;
393 ps.propid = PID_IS_ICONFILE;
394 v.vt = VT_NULL;
395 hres = IPropertyStorage_ReadMultiple(propstorage, 1, &ps, &v);
396 ok(hres == S_FALSE, "got 0x%08lx\n", hres);
397 ok(v.vt == VT_EMPTY, "got %d\n", v.vt);
398
399 ps.ulKind = PRSPEC_PROPID;
400 ps.propid = PID_IS_ICONINDEX;
401 v.vt = VT_EMPTY;
402 hres = IPropertyStorage_ReadMultiple(propstorage, 1, &ps, &v);
403 ok(hres == S_FALSE, "got 0x%08lx\n", hres);
404 ok(v.vt == VT_EMPTY, "got %d\n", v.vt);
405
406 IPropertyStorage_Release(propstorage);
407 IPropertySetStorage_Release(propsetstorage);
408
409 IPersistFile_Release(persist_file);
411 }
412}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
@ VT_NULL
Definition: compat.h:2296
@ VT_EMPTY
Definition: compat.h:2295
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
BOOL WINAPI WriteFile(_In_ HANDLE hFile, _In_reads_bytes_opt_(nNumberOfBytesToWrite) LPCVOID lpBuffer, _In_ DWORD nNumberOfBytesToWrite, _Out_opt_ LPDWORD lpNumberOfBytesWritten, _Inout_opt_ LPOVERLAPPED lpOverlapped)
Definition: rw.c:25
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2098
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
#define L(x)
Definition: resources.c:13
unsigned long DWORD
Definition: ntddk_ex.h:95
const GLdouble * v
Definition: gl.h:2040
GLsizeiptr size
Definition: glext.h:5919
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define CREATE_ALWAYS
Definition: disk.h:72
#define test_shortcut_url(a, b)
Definition: intshcut.c:117
static const load_test_t load_tests[]
Definition: intshcut.c:340
#define GENERIC_WRITE
Definition: nt_native.h:90
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:942
#define STGM_READ
Definition: objbase.h:936
const GUID IID_IPersistFile
short WCHAR
Definition: pedump.c:58
#define test
Definition: rosglue.h:37
#define PID_IS_ICONINDEX
Definition: shlobj.h:2511
#define PID_IS_ICONFILE
Definition: shlobj.h:2512
TCHAR file_path[MAX_PATH]
Definition: sndrec32.cpp:57
Definition: fci.c:123

Referenced by test_InternetShortcut(), and test_Persist().

◆ test_NullURLs()

static void test_NullURLs ( void  )
static

Definition at line 312 of file intshcut.c.

313{
314 LPSTR url = NULL;
315 HRESULT hr;
316 IUniformResourceLocatorA *urlA;
317
318 hr = CoCreateInstance(&CLSID_InternetShortcut, NULL, CLSCTX_ALL, &IID_IUniformResourceLocatorA, (void**)&urlA);
319 ok(hr == S_OK, "Could not create InternetShortcut object: %08lx\n", hr);
320
321 hr = urlA->lpVtbl->GetURL(urlA, &url);
322 ok(hr == S_FALSE, "getting uninitialized URL unexpectedly failed, hr=0x%lx\n", hr);
323 ok(url == NULL, "uninitialized URL is not NULL but %s\n", url);
324
325 hr = urlA->lpVtbl->SetURL(urlA, NULL, 0);
326 ok(hr == S_OK, "setting NULL URL unexpectedly failed, hr=0x%lx\n", hr);
327
328 hr = urlA->lpVtbl->GetURL(urlA, &url);
329 ok(hr == S_FALSE, "getting NULL URL unexpectedly failed, hr=0x%lx\n", hr);
330 ok(url == NULL, "URL unexpectedly not NULL but %s\n", url);
331
332 urlA->lpVtbl->Release(urlA);
333}
char * LPSTR
Definition: typedefs.h:51

Referenced by test_InternetShortcut().

◆ test_QueryInterface()

static void test_QueryInterface ( void  )
static

Definition at line 103 of file intshcut.c.

104{
105 HRESULT hr;
107
108 hr = CoCreateInstance(&CLSID_InternetShortcut, NULL, CLSCTX_ALL, &IID_IUnknown, (void**)&pUnknown);
109 ok(hr == S_OK, "Could not create InternetShortcut object: %08lx\n", hr);
110
111 can_query_interface(pUnknown, &IID_IUniformResourceLocatorA);
112 can_query_interface(pUnknown, &IID_IUniformResourceLocatorW);
114 IUnknown_Release(pUnknown);
115}
static void can_query_interface(IUnknown *pUnknown, REFIID riid)
Definition: intshcut.c:93

Referenced by test_InternetShortcut().

◆ test_ReadAndWriteProperties()

static void test_ReadAndWriteProperties ( void  )
static

Definition at line 166 of file intshcut.c.

167{
168 int iconIndex = 7;
169 PROPSPEC ps[2];
170 HRESULT hr;
171 IUniformResourceLocatorA *urlA;
172 IUniformResourceLocatorA *urlAFromFile;
173 WCHAR fileNameW[MAX_PATH];
174 static WCHAR iconPath[] = L"file:///C:/arbitrary/icon/path";
175 char testurl[] = "http://some/bogus/url.html";
176 PROPVARIANT pv[2], pvread[2];
177
178 ps[0].ulKind = PRSPEC_PROPID;
179 ps[0].propid = PID_IS_ICONFILE;
180 ps[1].ulKind = PRSPEC_PROPID;
181 ps[1].propid = PID_IS_ICONINDEX;
182
183 pv[0].vt = VT_LPWSTR;
184 pv[0].pwszVal = iconPath;
185 pv[1].vt = VT_I4;
186 pv[1].lVal = iconIndex;
187
188 /* Make sure we have a valid temporary directory */
189 GetTempPathW(MAX_PATH, fileNameW);
190 lstrcatW(fileNameW, L"testshortcut.url");
191
192 hr = CoCreateInstance(&CLSID_InternetShortcut, NULL, CLSCTX_ALL, &IID_IUniformResourceLocatorA, (void**)&urlA);
193 ok(hr == S_OK, "Could not create CLSID_InternetShortcut instance: %08lx\n", hr);
194 if (hr == S_OK)
195 {
196 IPersistFile *pf;
197 IPropertyStorage *pPropStgWrite;
198 IPropertySetStorage *pPropSetStg;
199
200 /* We need to set a URL -- IPersistFile refuses to save without one. */
201 hr = urlA->lpVtbl->SetURL(urlA, testurl, 0);
202 ok(hr == S_OK, "Failed to set a URL. hr=0x%lx\n", hr);
203
204 /* Write this shortcut out to a file so that we can test reading it in again. */
205 hr = urlA->lpVtbl->QueryInterface(urlA, &IID_IPersistFile, (void **) &pf);
206 ok(hr == S_OK, "Failed to get the IPersistFile for writing. hr=0x%lx\n", hr);
207
208 hr = IPersistFile_Save(pf, fileNameW, TRUE);
209 ok(hr == S_OK, "Failed to save via IPersistFile. hr=0x%lx\n", hr);
210
211 IPersistFile_Release(pf);
212
213 hr = urlA->lpVtbl->QueryInterface(urlA, &IID_IPropertySetStorage, (void **) &pPropSetStg);
214 ok(hr == S_OK, "Unable to get an IPropertySetStorage, hr=0x%lx\n", hr);
215
216 hr = IPropertySetStorage_Open(pPropSetStg, &FMTID_Intshcut, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, &pPropStgWrite);
217 ok(hr == S_OK, "Unable to get an IPropertyStorage for writing, hr=0x%lx\n", hr);
218
219 hr = IPropertyStorage_WriteMultiple(pPropStgWrite, 2, ps, pv, 0);
220 ok(hr == S_OK, "Unable to set properties, hr=0x%lx\n", hr);
221
222 memset(pvread, 0, sizeof(pvread));
223 hr = IPropertyStorage_ReadMultiple(pPropStgWrite, 2, ps, pvread);
224 ok(hr == S_OK, "Unable to read properties, hr=0x%lx\n", hr);
225 ok(pvread[1].vt == VT_I4, "got %d\n", pvread[1].vt);
226 ok(pvread[1].lVal == iconIndex, "Read wrong icon index: %d\n", pvread[1].iVal);
227 ok(pvread[0].vt == VT_LPWSTR, "got %d\n", pvread[0].vt);
228 ok(lstrcmpW(pvread[0].pwszVal, iconPath) == 0, "Wrong icon path read: %s\n", wine_dbgstr_w(pvread[0].pwszVal));
229 PropVariantClear(&pvread[0]);
230 PropVariantClear(&pvread[1]);
231
232 hr = IPropertyStorage_Commit(pPropStgWrite, STGC_DEFAULT);
233 ok(hr == S_OK, "Failed to commit properties, hr=0x%lx\n", hr);
234
235 pPropStgWrite->lpVtbl->Release(pPropStgWrite);
236
237 /* Test with STGM_WRITE */
238 hr = IPropertySetStorage_Open(pPropSetStg, &FMTID_Intshcut, STGM_WRITE, &pPropStgWrite);
239 ok(hr == S_OK, "Unable to get an IPropertyStorage for writing, hr=0x%lx\n", hr);
240
241 if (hr == S_OK)
242 {
243 memset(pvread, 0, sizeof(pvread));
244 hr = IPropertyStorage_ReadMultiple(pPropStgWrite, 2, ps, pvread);
245 ok(hr == S_OK, "Unable to read properties, hr=0x%lx\n", hr);
246 ok(pvread[1].vt == VT_I4, "got %d\n", pvread[1].vt);
247 ok(pvread[1].lVal == iconIndex, "Read wrong icon index: %d\n", pvread[1].iVal);
248 ok(pvread[0].vt == VT_LPWSTR, "got %d\n", pvread[0].vt);
249 ok(lstrcmpW(pvread[0].pwszVal, iconPath) == 0, "Wrong icon path read: %s\n", wine_dbgstr_w(pvread[0].pwszVal));
250 PropVariantClear(&pvread[0]);
251 PropVariantClear(&pvread[1]);
252
253 IPropertyStorage_Release(pPropStgWrite);
254 }
255 urlA->lpVtbl->Release(urlA);
256 IPropertySetStorage_Release(pPropSetStg);
257 }
258
259 hr = CoCreateInstance(&CLSID_InternetShortcut, NULL, CLSCTX_ALL, &IID_IUniformResourceLocatorA, (void**)&urlAFromFile);
260 ok(hr == S_OK, "Could not create CLSID_InternetShortcut instance: %08lx\n", hr);
261 if (hr == S_OK)
262 {
263 IPropertySetStorage *pPropSetStg;
264 IPropertyStorage *pPropStgRead;
265 PROPVARIANT pvread[2];
266 IPersistFile *pf;
267 LPSTR url = NULL;
268
269 /* Now read that .url file back in. */
270 hr = urlAFromFile->lpVtbl->QueryInterface(urlAFromFile, &IID_IPersistFile, (void **) &pf);
271 ok(hr == S_OK, "Failed to get the IPersistFile for reading. hr=0x%lx\n", hr);
272
273 hr = IPersistFile_Load(pf, fileNameW, 0);
274 ok(hr == S_OK, "Failed to load via IPersistFile. hr=0x%lx\n", hr);
275 IPersistFile_Release(pf);
276
277
278 hr = urlAFromFile->lpVtbl->GetURL(urlAFromFile, &url);
279 ok(hr == S_OK, "Unable to get url from file, hr=0x%lx\n", hr);
280 ok(lstrcmpA(url, testurl) == 0, "Wrong url read from file: %s\n",url);
282
283 hr = urlAFromFile->lpVtbl->QueryInterface(urlAFromFile, &IID_IPropertySetStorage, (void **) &pPropSetStg);
284 ok(hr == S_OK, "Unable to get an IPropertySetStorage, hr=0x%lx\n", hr);
285
286 hr = IPropertySetStorage_Open(pPropSetStg, &FMTID_Intshcut, STGM_READ | STGM_SHARE_EXCLUSIVE, &pPropStgRead);
287 ok(hr == S_OK, "Unable to get an IPropertyStorage for reading, hr=0x%lx\n", hr);
288
289 memset(pvread, 0, sizeof(pvread));
290 hr = IPropertyStorage_ReadMultiple(pPropStgRead, 2, ps, pvread);
291 todo_wine /* Wine doesn't yet support setting properties after save */
292 {
293 ok(hr == S_OK, "Unable to read properties, hr=0x%lx\n", hr);
294 ok(pvread[1].vt == VT_I4, "got %d\n", pvread[1].vt);
295 ok(pvread[1].lVal == iconIndex, "Read wrong icon index: %d\n", pvread[1].iVal);
296 ok(pvread[0].vt == VT_LPWSTR, "got %d\n", pvread[0].vt);
297 ok(lstrcmpW(pvread[0].pwszVal, iconPath) == 0, "Wrong icon path read: %s\n", wine_dbgstr_w(pvread[0].pwszVal));
298 }
299 PropVariantClear(&pvread[0]);
300 PropVariantClear(&pvread[1]);
301
302 hr = IPropertyStorage_WriteMultiple(pPropStgRead, 2, ps, pv, 0);
303 ok(hr == STG_E_ACCESSDENIED, "setting properties should return STG_E_ACCESSDENIED instead of 0x%lx\n", hr);
304
305 IPropertyStorage_Release(pPropStgRead);
306 IPropertySetStorage_Release(pPropSetStg);
307 urlAFromFile->lpVtbl->Release(urlAFromFile);
308 DeleteFileW(fileNameW);
309 }
310}
#define TRUE
Definition: types.h:120
HRESULT WINAPI PropVariantClear(PROPVARIANT *pvar)
Definition: combase.c:709
@ VT_LPWSTR
Definition: compat.h:2325
@ VT_I4
Definition: compat.h:2298
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:90
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
ULONG Release()
#define wine_dbgstr_w
Definition: kernel32.h:34
#define STGM_READWRITE
Definition: objbase.h:938
#define STGM_WRITE
Definition: objbase.h:937
#define memset(x, y, z)
Definition: compat.h:39
#define STG_E_ACCESSDENIED
Definition: winerror.h:3663

Referenced by test_InternetShortcut().

◆ test_SetURLFlags()

static void test_SetURLFlags ( void  )
static

Definition at line 414 of file intshcut.c.

415{
416 HRESULT hr;
417 IUniformResourceLocatorA *urlA;
418
419 hr = CoCreateInstance(&CLSID_InternetShortcut, NULL, CLSCTX_ALL, &IID_IUniformResourceLocatorA, (void**)&urlA);
420 ok(hr == S_OK, "Could not create InternetShortcut object: %08lx\n", hr);
421
422 check_string_transform(urlA, "somerandomstring", 0, NULL, TRUE);
423 check_string_transform(urlA, "www.winehq.org", 0, NULL, TRUE);
424
425 check_string_transform(urlA, "www.winehq.org", IURL_SETURL_FL_GUESS_PROTOCOL, "http://www.winehq.org/", FALSE);
426 check_string_transform(urlA, "ftp.winehq.org", IURL_SETURL_FL_GUESS_PROTOCOL, "ftp://ftp.winehq.org/", FALSE);
427
428 urlA->lpVtbl->Release(urlA);
429}
#define FALSE
Definition: types.h:117
@ IURL_SETURL_FL_GUESS_PROTOCOL
Definition: intshcut.h:36
#define check_string_transform(a, b, c, d, e)
Definition: intshcut.c:135

Referenced by test_InternetShortcut().

◆ Unknown_AddRef()

static ULONG WINAPI Unknown_AddRef ( IUnknown *  pUnknown)
static

Definition at line 52 of file intshcut.c.

53{
54 return 2;
55}

◆ Unknown_QueryInterface()

static HRESULT WINAPI Unknown_QueryInterface ( IUnknown *  pUnknown,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 42 of file intshcut.c.

43{
45 {
46 *ppvObject = pUnknown;
47 return S_OK;
48 }
49 return E_NOINTERFACE;
50}
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ Unknown_Release()

static ULONG WINAPI Unknown_Release ( IUnknown *  pUnknown)
static

Definition at line 57 of file intshcut.c.

58{
59 return 1;
60}

Variable Documentation

◆ load_tests

const load_test_t load_tests[]
static
Initial value:
= {
{"[InternetShortcut]\n"
"URL=http://www.winehq.org/\n"
"HotKey=0\n"
"IDList=\n"
"[{000214A0-0000-0000-C000-000000000046}]\n"
"Prop0=1,2\n",
"http://www.winehq.org/"
}
}

Definition at line 340 of file intshcut.c.

Referenced by test_Load().

◆ unknown

IUnknown unknown
static
Initial value:
= {
}
static IUnknownVtbl unknownVtbl
Definition: intshcut.c:62

Definition at line 68 of file intshcut.c.

Referenced by test_Aggregability().

◆ unknownVtbl

IUnknownVtbl unknownVtbl
static
Initial value:
= {
}
static ULONG Unknown_Release(InternetShortcut *This)
Definition: intshcut.c:184
static HRESULT Unknown_QueryInterface(InternetShortcut *This, REFIID riid, PVOID *ppvObject)
Definition: intshcut.c:145
static ULONG Unknown_AddRef(InternetShortcut *This)
Definition: intshcut.c:178

Definition at line 62 of file intshcut.c.