dmime: Remove unneeded casts.
[wine] / dlls / shlwapi / tests / ordinal.c
1 /* Unit test suite for SHLWAPI ordinal functions
2  *
3  * Copyright 2004 Jon Griffiths
4  *
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.
9  *
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.
14  *
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
18  */
19
20 #include <stdio.h>
21
22 #include "wine/test.h"
23 #include "winbase.h"
24 #include "winerror.h"
25 #include "winuser.h"
26 #include "ole2.h"
27 #include "oaidl.h"
28
29 /* Function ptrs for ordinal calls */
30 static HMODULE hShlwapi;
31 static int (WINAPI *pSHSearchMapInt)(const int*,const int*,int,int);
32 static HRESULT (WINAPI *pGetAcceptLanguagesA)(LPSTR,LPDWORD);
33
34 static HANDLE (WINAPI *pSHAllocShared)(LPCVOID,DWORD,DWORD);
35 static LPVOID (WINAPI *pSHLockShared)(HANDLE,DWORD);
36 static BOOL   (WINAPI *pSHUnlockShared)(LPVOID);
37 static BOOL   (WINAPI *pSHFreeShared)(HANDLE,DWORD);
38 static HRESULT(WINAPIV *pSHPackDispParams)(DISPPARAMS*,VARIANTARG*,UINT,...);
39
40 static void test_GetAcceptLanguagesA(void)
41 {   HRESULT retval;
42     DWORD buffersize, buffersize2, exactsize;
43     char buffer[100];
44
45     if (!pGetAcceptLanguagesA)
46         return;
47
48     buffersize = sizeof(buffer);
49     memset(buffer, 0, sizeof(buffer));
50     SetLastError(ERROR_SUCCESS);
51     retval = pGetAcceptLanguagesA( buffer, &buffersize);
52     trace("GetAcceptLanguagesA: retval %08x, size %08x, buffer (%s),"
53         " last error %u\n", retval, buffersize, buffer, GetLastError());
54     if(retval != S_OK) {
55         trace("GetAcceptLanguagesA: skipping tests\n");
56         return;
57     }
58     ok( (ERROR_NO_IMPERSONATION_TOKEN == GetLastError()) || 
59         (ERROR_CLASS_DOES_NOT_EXIST == GetLastError()) ||
60         (ERROR_PROC_NOT_FOUND == GetLastError()) ||
61         (ERROR_CALL_NOT_IMPLEMENTED == GetLastError()) ||
62         (ERROR_SUCCESS == GetLastError()), "last error set to %u\n", GetLastError());
63     exactsize = strlen(buffer);
64
65     SetLastError(ERROR_SUCCESS);
66     retval = pGetAcceptLanguagesA( NULL, NULL);
67     ok(retval == E_FAIL,
68        "function result wrong: got %08x; expected E_FAIL\n", retval);
69     ok(ERROR_SUCCESS == GetLastError(), "last error set to %u\n", GetLastError());
70
71     buffersize = sizeof(buffer);
72     SetLastError(ERROR_SUCCESS);
73     retval = pGetAcceptLanguagesA( NULL, &buffersize);
74     ok(retval == E_FAIL,
75        "function result wrong: got %08x; expected E_FAIL\n", retval);
76     ok(buffersize == sizeof(buffer),
77        "buffersize was changed (2nd parameter; not on Win2k)\n");
78     ok(ERROR_SUCCESS == GetLastError(), "last error set to %u\n", GetLastError());
79
80     SetLastError(ERROR_SUCCESS);
81     retval = pGetAcceptLanguagesA( buffer, NULL);
82     ok(retval == E_FAIL,
83        "function result wrong: got %08x; expected E_FAIL\n", retval);
84     ok(ERROR_SUCCESS == GetLastError(), "last error set to %u\n", GetLastError());
85
86     buffersize = 0;
87     memset(buffer, 0, sizeof(buffer));
88     SetLastError(ERROR_SUCCESS);
89     retval = pGetAcceptLanguagesA( buffer, &buffersize);
90     ok(retval == E_FAIL,
91        "function result wrong: got %08x; expected E_FAIL\n", retval);
92     ok(buffersize == 0,
93        "buffersize wrong(changed) got %08x; expected 0 (2nd parameter; not on Win2k)\n", buffersize);
94     ok(ERROR_SUCCESS == GetLastError(), "last error set to %u\n", GetLastError());
95
96     buffersize = buffersize2 = 1;
97     memset(buffer, 0, sizeof(buffer));
98     SetLastError(ERROR_SUCCESS);
99     retval = pGetAcceptLanguagesA( buffer, &buffersize);
100     switch(retval) {
101         case 0L:
102             if(buffersize == exactsize) {
103             ok( (ERROR_SUCCESS == GetLastError()) || (ERROR_CALL_NOT_IMPLEMENTED == GetLastError()) ||
104                 (ERROR_PROC_NOT_FOUND == GetLastError()) || (ERROR_NO_IMPERSONATION_TOKEN == GetLastError()),
105                 "last error wrong: got %u; expected ERROR_SUCCESS(NT4)/ERROR_CALL_NOT_IMPLEMENTED(98/ME)/"
106                 "ERROR_PROC_NOT_FOUND(NT4)/ERROR_NO_IMPERSONATION_TOKEN(XP)\n", GetLastError());
107             ok(exactsize == strlen(buffer),
108                  "buffer content (length) wrong: got %08x, expected %08x\n", lstrlenA(buffer), exactsize);
109             } else if((buffersize +1) == buffersize2) {
110                 ok(ERROR_SUCCESS == GetLastError(),
111                     "last error wrong: got %u; expected ERROR_SUCCESS\n", GetLastError());
112                 ok(buffersize == strlen(buffer),
113                     "buffer content (length) wrong: got %08x, expected %08x\n", lstrlenA(buffer), buffersize);
114             } else
115                 ok( 0, "retval %08x, size %08x, buffer (%s), last error %u\n",
116                     retval, buffersize, buffer, GetLastError());
117             break;
118         case E_INVALIDARG:
119             ok(buffersize == 0,
120                "buffersize wrong: got %08x, expected 0 (2nd parameter;Win2k)\n", buffersize);
121             ok(ERROR_INSUFFICIENT_BUFFER == GetLastError(),
122                "last error wrong: got %u; expected ERROR_INSUFFICIENT_BUFFER\n", GetLastError());
123             ok(buffersize2 == strlen(buffer),
124                "buffer content (length) wrong: got %08x, expected %08x\n", lstrlenA(buffer), buffersize2);
125             break;
126         default:
127             ok( 0, "retval %08x, size %08x, buffer (%s), last error %u\n",
128                 retval, buffersize, buffer, GetLastError());
129             break;
130     }
131
132     buffersize = buffersize2 = exactsize;
133     memset(buffer, 0, sizeof(buffer));
134     SetLastError(ERROR_SUCCESS);
135     retval = pGetAcceptLanguagesA( buffer, &buffersize);
136     switch(retval) {
137         case 0L:
138             ok(ERROR_SUCCESS == GetLastError(),
139                  "last error wrong: got %u; expected ERROR_SUCCESS\n", GetLastError());
140             if((buffersize == exactsize) /* XP */ ||
141                ((buffersize +1)== exactsize) /* 98 */)
142                 ok(buffersize == strlen(buffer),
143                     "buffer content (length) wrong: got %08x, expected %08x\n", lstrlenA(buffer), buffersize);
144             else
145                 ok( 0, "retval %08x, size %08x, buffer (%s), last error %u\n",
146                     retval, buffersize, buffer, GetLastError());
147             break;
148         case E_INVALIDARG:
149             ok(buffersize == 0,
150                "buffersize wrong: got %08x, expected 0 (2nd parameter;Win2k)\n", buffersize);
151             ok(ERROR_INSUFFICIENT_BUFFER == GetLastError(),
152                "last error wrong: got %u; expected ERROR_INSUFFICIENT_BUFFER\n", GetLastError());
153             ok(buffersize2 == strlen(buffer),
154                "buffer content (length) wrong: got %08x, expected %08x\n", lstrlenA(buffer), buffersize2);
155             break;
156         default:
157             ok( 0, "retval %08x, size %08x, buffer (%s), last error %u\n",
158                 retval, buffersize, buffer, GetLastError());
159             break;
160     }
161 }
162
163 static void test_SHSearchMapInt(void)
164 {
165   int keys[8], values[8];
166   int i = 0;
167
168   if (!pSHSearchMapInt)
169     return;
170
171   memset(keys, 0, sizeof(keys));
172   memset(values, 0, sizeof(values));
173   keys[0] = 99; values[0] = 101;
174
175   /* NULL key/value lists crash native, so skip testing them */
176
177   /* 1 element */
178   i = pSHSearchMapInt(keys, values, 1, keys[0]);
179   ok(i == values[0], "Len 1, expected %d, got %d\n", values[0], i);
180
181   /* Key doesn't exist */
182   i = pSHSearchMapInt(keys, values, 1, 100);
183   ok(i == -1, "Len 1 - bad key, expected -1, got %d\n", i);
184
185   /* Len = 0 => not found */
186   i = pSHSearchMapInt(keys, values, 0, keys[0]);
187   ok(i == -1, "Len 1 - passed len 0, expected -1, got %d\n", i);
188
189   /* 2 elements, len = 1 */
190   keys[1] = 98; values[1] = 102;
191   i = pSHSearchMapInt(keys, values, 1, keys[1]);
192   ok(i == -1, "Len 1 - array len 2, expected -1, got %d\n", i);
193
194   /* 2 elements, len = 2 */
195   i = pSHSearchMapInt(keys, values, 2, keys[1]);
196   ok(i == values[1], "Len 2, expected %d, got %d\n", values[1], i);
197
198   /* Searches forward */
199   keys[2] = 99; values[2] = 103;
200   i = pSHSearchMapInt(keys, values, 3, keys[0]);
201   ok(i == values[0], "Len 3, expected %d, got %d\n", values[0], i);
202 }
203
204 static void test_alloc_shared(void)
205 {
206     DWORD procid;
207     HANDLE hmem;
208     int val;
209     int* p;
210     BOOL ret;
211
212     procid=GetCurrentProcessId();
213     hmem=pSHAllocShared(NULL,10,procid);
214     ok(hmem!=NULL,"SHAllocShared(NULL...) failed: %u\n", GetLastError());
215     ret = pSHFreeShared(hmem, procid);
216     ok( ret, "SHFreeShared failed: %u\n", GetLastError());
217
218     val=0x12345678;
219     hmem=pSHAllocShared(&val,4,procid);
220     ok(hmem!=NULL,"SHAllocShared(NULL...) failed: %u\n", GetLastError());
221
222     p=(int*)pSHLockShared(hmem,procid);
223     ok(p!=NULL,"SHLockShared failed: %u\n", GetLastError());
224     if (p!=NULL)
225         ok(*p==val,"Wrong value in shared memory: %d instead of %d\n",*p,val);
226     ret = pSHUnlockShared(p);
227     ok( ret, "SHUnlockShared failed: %u\n", GetLastError());
228
229     ret = pSHFreeShared(hmem, procid);
230     ok( ret, "SHFreeShared failed: %u\n", GetLastError());
231 }
232
233 static void test_fdsa(void)
234 {
235     typedef struct
236     {
237         DWORD num_items;       /* Number of elements inserted */
238         void *mem;             /* Ptr to array */
239         DWORD blocks_alloced;  /* Number of elements allocated */
240         BYTE inc;              /* Number of elements to grow by when we need to expand */
241         BYTE block_size;       /* Size in bytes of an element */
242         BYTE flags;            /* Flags */
243     } FDSA_info;
244
245     BOOL (WINAPI *pFDSA_Initialize)(DWORD block_size, DWORD inc, FDSA_info *info, void *mem,
246                                     DWORD init_blocks);
247     BOOL (WINAPI *pFDSA_Destroy)(FDSA_info *info);
248     DWORD (WINAPI *pFDSA_InsertItem)(FDSA_info *info, DWORD where, const void *block);
249     BOOL (WINAPI *pFDSA_DeleteItem)(FDSA_info *info, DWORD where);
250
251     FDSA_info info;
252     int block_size = 10, init_blocks = 4, inc = 2;
253     DWORD ret;
254     char *mem;
255
256     pFDSA_Initialize = (void *)GetProcAddress(hShlwapi, (LPSTR)208);
257     pFDSA_Destroy    = (void *)GetProcAddress(hShlwapi, (LPSTR)209);
258     pFDSA_InsertItem = (void *)GetProcAddress(hShlwapi, (LPSTR)210);
259     pFDSA_DeleteItem = (void *)GetProcAddress(hShlwapi, (LPSTR)211);
260
261     mem = HeapAlloc(GetProcessHeap(), 0, block_size * init_blocks);
262     memset(&info, 0, sizeof(info));
263
264     ok(pFDSA_Initialize(block_size, inc, &info, mem, init_blocks), "FDSA_Initialize rets FALSE\n");
265     ok(info.num_items == 0, "num_items = %d\n", info.num_items);
266     ok(info.mem == mem, "mem = %p\n", info.mem);
267     ok(info.blocks_alloced == init_blocks, "blocks_alloced = %d\n", info.blocks_alloced);
268     ok(info.inc == inc, "inc = %d\n", info.inc);
269     ok(info.block_size == block_size, "block_size = %d\n", info.block_size);
270     ok(info.flags == 0, "flags = %d\n", info.flags);
271
272     ret = pFDSA_InsertItem(&info, 1234, "1234567890");
273     ok(ret == 0, "ret = %d\n", ret);
274     ok(info.num_items == 1, "num_items = %d\n", info.num_items);
275     ok(info.mem == mem, "mem = %p\n", info.mem);
276     ok(info.blocks_alloced == init_blocks, "blocks_alloced = %d\n", info.blocks_alloced);
277     ok(info.inc == inc, "inc = %d\n", info.inc);
278     ok(info.block_size == block_size, "block_size = %d\n", info.block_size);
279     ok(info.flags == 0, "flags = %d\n", info.flags);
280
281     ret = pFDSA_InsertItem(&info, 1234, "abcdefghij");
282     ok(ret == 1, "ret = %d\n", ret);
283
284     ret = pFDSA_InsertItem(&info, 1, "klmnopqrst");
285     ok(ret == 1, "ret = %d\n", ret);
286
287     ret = pFDSA_InsertItem(&info, 0, "uvwxyzABCD");
288     ok(ret == 0, "ret = %d\n", ret);
289     ok(info.mem == mem, "mem = %p\n", info.mem);
290     ok(info.flags == 0, "flags = %d\n", info.flags);
291
292     /* This next InsertItem will cause shlwapi to allocate its own mem buffer */
293     ret = pFDSA_InsertItem(&info, 0, "EFGHIJKLMN");
294     ok(ret == 0, "ret = %d\n", ret);
295     ok(info.mem != mem, "mem = %p\n", info.mem);
296     ok(info.blocks_alloced == init_blocks + inc, "blocks_alloced = %d\n", info.blocks_alloced);
297     ok(info.flags == 0x1, "flags = %d\n", info.flags);
298
299     ok(!memcmp(info.mem, "EFGHIJKLMNuvwxyzABCD1234567890klmnopqrstabcdefghij", 50), "mem %s\n", (char*)info.mem);
300
301     ok(pFDSA_DeleteItem(&info, 2), "rets FALSE\n");
302     ok(info.mem != mem, "mem = %p\n", info.mem);
303     ok(info.blocks_alloced == init_blocks + inc, "blocks_alloced = %d\n", info.blocks_alloced);
304     ok(info.flags == 0x1, "flags = %d\n", info.flags);
305
306     ok(!memcmp(info.mem, "EFGHIJKLMNuvwxyzABCDklmnopqrstabcdefghij", 40), "mem %s\n", (char*)info.mem);
307
308     ok(pFDSA_DeleteItem(&info, 3), "rets FALSE\n");
309     ok(info.mem != mem, "mem = %p\n", info.mem);
310     ok(info.blocks_alloced == init_blocks + inc, "blocks_alloced = %d\n", info.blocks_alloced);
311     ok(info.flags == 0x1, "flags = %d\n", info.flags);
312
313     ok(!memcmp(info.mem, "EFGHIJKLMNuvwxyzABCDklmnopqrst", 30), "mem %s\n", (char*)info.mem);
314
315     ok(!pFDSA_DeleteItem(&info, 4), "does not ret FALSE\n");
316
317     /* As shlwapi has allocated memory internally, Destroy will ret FALSE */
318     ok(!pFDSA_Destroy(&info), "FDSA_Destroy does not ret FALSE\n");
319
320
321     /* When Initialize is called with inc = 0, set it to 1 */
322     ok(pFDSA_Initialize(block_size, 0, &info, mem, init_blocks), "FDSA_Initialize rets FALSE\n");
323     ok(info.inc == 1, "inc = %d\n", info.inc);
324
325     /* This time, because shlwapi hasn't had to allocate memory
326        internally, Destroy rets non-zero */
327     ok(pFDSA_Destroy(&info), "FDSA_Destroy rets FALSE\n");
328
329
330     HeapFree(GetProcessHeap(), 0, mem);
331 }
332
333
334 typedef struct SHELL_USER_SID {
335     SID_IDENTIFIER_AUTHORITY sidAuthority;
336     DWORD                    dwUserGroupID;
337     DWORD                    dwUserID;
338 } SHELL_USER_SID, *PSHELL_USER_SID;
339 typedef struct SHELL_USER_PERMISSION {
340     SHELL_USER_SID susID;
341     DWORD          dwAccessType;
342     BOOL           fInherit;
343     DWORD          dwAccessMask;
344     DWORD          dwInheritMask;
345     DWORD          dwInheritAccessMask;
346 } SHELL_USER_PERMISSION, *PSHELL_USER_PERMISSION;
347 static void test_GetShellSecurityDescriptor(void)
348 {
349     SHELL_USER_PERMISSION supCurrentUserFull = {
350         { {SECURITY_NULL_SID_AUTHORITY}, 0, 0 },
351         ACCESS_ALLOWED_ACE_TYPE, FALSE,
352         GENERIC_ALL, 0, 0 };
353 #define MY_INHERITANCE 0xBE /* invalid value to proof behavior */
354     SHELL_USER_PERMISSION supEveryoneDenied = {
355         { {SECURITY_WORLD_SID_AUTHORITY}, SECURITY_WORLD_RID, 0 },
356         ACCESS_DENIED_ACE_TYPE, TRUE,
357         GENERIC_WRITE, MY_INHERITANCE | 0xDEADBA00, GENERIC_READ };
358     PSHELL_USER_PERMISSION rgsup[2] = {
359         &supCurrentUserFull, &supEveryoneDenied,
360     };
361     SECURITY_DESCRIPTOR* psd;
362     SECURITY_DESCRIPTOR* (WINAPI*pGetShellSecurityDescriptor)(PSHELL_USER_PERMISSION*,int);
363
364     pGetShellSecurityDescriptor=(void*)GetProcAddress(hShlwapi,(char*)475);
365
366     psd = pGetShellSecurityDescriptor(NULL, 2);
367     ok(psd==NULL, "GetShellSecurityDescriptor should fail\n");
368     psd = pGetShellSecurityDescriptor(rgsup, 0);
369     ok(psd==NULL, "GetShellSecurityDescriptor should fail\n");
370
371     psd = pGetShellSecurityDescriptor(rgsup, 2);
372     ok(psd!=NULL, "GetShellSecurityDescriptor failed\n");
373     if (psd!=NULL)
374     {
375         BOOL bHasDacl = FALSE, bDefaulted;
376         PACL pAcl;
377         DWORD dwRev;
378         SECURITY_DESCRIPTOR_CONTROL control;
379
380         ok(IsValidSecurityDescriptor(psd), "returned value is not valid SD\n");
381
382         ok(GetSecurityDescriptorControl(psd, &control, &dwRev),
383                 "GetSecurityDescriptorControl failed with error %u\n", GetLastError());
384         ok(0 == (control & SE_SELF_RELATIVE), "SD should be absolute\n");
385
386         ok(GetSecurityDescriptorDacl(psd, &bHasDacl, &pAcl, &bDefaulted), 
387             "GetSecurityDescriptorDacl failed with error %u\n", GetLastError());
388
389         ok(bHasDacl, "SD has no DACL\n");
390         if (bHasDacl)
391         {
392             ok(!bDefaulted, "DACL should not be defaulted\n");
393
394             ok(pAcl != NULL, "NULL DACL!\n");
395             if (pAcl != NULL)
396             {
397                 ACL_SIZE_INFORMATION asiSize;
398
399                 ok(IsValidAcl(pAcl), "DACL is not valid\n");
400
401                 ok(GetAclInformation(pAcl, &asiSize, sizeof(asiSize), AclSizeInformation),
402                         "GetAclInformation failed with error %u\n", GetLastError());
403
404                 ok(asiSize.AceCount == 3, "Incorrect number of ACEs: %d entries\n", asiSize.AceCount);
405                 if (asiSize.AceCount == 3)
406                 {
407                     ACCESS_ALLOWED_ACE *paaa; /* will use for DENIED too */
408
409                     ok(GetAce(pAcl, 0, (LPVOID*)&paaa), "GetAce failed with error %u\n", GetLastError());
410                     ok(paaa->Header.AceType == ACCESS_ALLOWED_ACE_TYPE, 
411                             "Invalid ACE type %d\n", paaa->Header.AceType); 
412                     ok(paaa->Header.AceFlags == 0, "Invalid ACE flags %x\n", paaa->Header.AceFlags);
413                     ok(paaa->Mask == GENERIC_ALL, "Invalid ACE mask %x\n", paaa->Mask);
414
415                     ok(GetAce(pAcl, 1, (LPVOID*)&paaa), "GetAce failed with error %u\n", GetLastError());
416                     ok(paaa->Header.AceType == ACCESS_DENIED_ACE_TYPE, 
417                             "Invalid ACE type %d\n", paaa->Header.AceType); 
418                     /* first one of two ACEs generated from inheritable entry - without inheritance */
419                     ok(paaa->Header.AceFlags == 0, "Invalid ACE flags %x\n", paaa->Header.AceFlags);
420                     ok(paaa->Mask == GENERIC_WRITE, "Invalid ACE mask %x\n", paaa->Mask);
421
422                     ok(GetAce(pAcl, 2, (LPVOID*)&paaa), "GetAce failed with error %u\n", GetLastError());
423                     ok(paaa->Header.AceType == ACCESS_DENIED_ACE_TYPE, 
424                             "Invalid ACE type %d\n", paaa->Header.AceType); 
425                     /* second ACE - with inheritance */
426                     ok(paaa->Header.AceFlags == MY_INHERITANCE,
427                             "Invalid ACE flags %x\n", paaa->Header.AceFlags);
428                     ok(paaa->Mask == GENERIC_READ, "Invalid ACE mask %x\n", paaa->Mask);
429                 }
430             }
431         }
432
433         LocalFree(psd);
434     }
435 }
436
437 static void test_SHPackDispParams(void)
438 {
439     DISPPARAMS params;
440     VARIANT vars[10];
441     HRESULT hres;
442
443     if(!pSHPackDispParams)
444         skip("SHPackSidpParams not available\n");
445
446     memset(&params, 0xc0, sizeof(params));
447     memset(vars, 0xc0, sizeof(vars));
448     hres = pSHPackDispParams(&params, vars, 1, VT_I4, 0xdeadbeef);
449     ok(hres == S_OK, "SHPackDispParams failed: %08x\n", hres);
450     ok(params.cArgs == 1, "params.cArgs = %d\n", params.cArgs);
451     ok(params.cNamedArgs == 0, "params.cNamedArgs = %d\n", params.cArgs);
452     ok(params.rgdispidNamedArgs == NULL, "params.rgdispidNamedArgs = %p\n", params.rgdispidNamedArgs);
453     ok(params.rgvarg == vars, "params.rgvarg = %p\n", params.rgvarg);
454     ok(V_VT(vars) == VT_I4, "V_VT(var) = %d\n", V_VT(vars));
455     ok(V_DISPATCH(vars) == (void*)0xdeadbeef, "failed\n");
456
457     memset(&params, 0xc0, sizeof(params));
458     hres = pSHPackDispParams(&params, NULL, 0, 0);
459     ok(hres == S_OK, "SHPackDispParams failed: %08x\n", hres);
460     ok(params.cArgs == 0, "params.cArgs = %d\n", params.cArgs);
461     ok(params.cNamedArgs == 0, "params.cNamedArgs = %d\n", params.cArgs);
462     ok(params.rgdispidNamedArgs == NULL, "params.rgdispidNamedArgs = %p\n", params.rgdispidNamedArgs);
463     ok(params.rgvarg == NULL, "params.rgvarg = %p\n", params.rgvarg);
464
465     memset(vars, 0xc0, sizeof(vars));
466     memset(&params, 0xc0, sizeof(params));
467     hres = pSHPackDispParams(&params, vars, 4, VT_BSTR, (void*)0xdeadbeef, VT_EMPTY, 10,
468             VT_I4, 100, VT_DISPATCH, (void*)0xdeadbeef);
469     ok(hres == S_OK, "SHPackDispParams failed: %08x\n", hres);
470     ok(params.cArgs == 4, "params.cArgs = %d\n", params.cArgs);
471     ok(params.cNamedArgs == 0, "params.cNamedArgs = %d\n", params.cArgs);
472     ok(params.rgdispidNamedArgs == NULL, "params.rgdispidNamedArgs = %p\n", params.rgdispidNamedArgs);
473     ok(params.rgvarg == vars, "params.rgvarg = %p\n", params.rgvarg);
474     ok(V_VT(vars) == VT_DISPATCH, "V_VT(vars[0]) = %x\n", V_VT(vars));
475     ok(V_I4(vars) == 0xdeadbeef, "V_I4(vars[0]) = %x\n", V_I4(vars));
476     ok(V_VT(vars+1) == VT_I4, "V_VT(vars[1]) = %d\n", V_VT(vars+1));
477     ok(V_I4(vars+1) == 100, "V_I4(vars[1]) = %x\n", V_I4(vars+1));
478     ok(V_VT(vars+2) == VT_I4, "V_VT(vars[2]) = %d\n", V_VT(vars+2));
479     ok(V_I4(vars+2) == 10, "V_I4(vars[2]) = %x\n", V_I4(vars+2));
480     ok(V_VT(vars+3) == VT_BSTR, "V_VT(vars[3]) = %d\n", V_VT(vars+3));
481     ok(V_BSTR(vars+3) == (void*)0xdeadbeef, "V_BSTR(vars[3]) = %p\n", V_BSTR(vars+3));
482 }
483
484 START_TEST(ordinal)
485 {
486   hShlwapi = GetModuleHandleA("shlwapi.dll");
487
488   pGetAcceptLanguagesA = (void*)GetProcAddress(hShlwapi, (LPSTR)14);
489   pSHSearchMapInt = (void*)GetProcAddress(hShlwapi, (LPSTR)198);
490   pSHAllocShared=(void*)GetProcAddress(hShlwapi,(char*)7);
491   pSHLockShared=(void*)GetProcAddress(hShlwapi,(char*)8);
492   pSHUnlockShared=(void*)GetProcAddress(hShlwapi,(char*)9);
493   pSHFreeShared=(void*)GetProcAddress(hShlwapi,(char*)10);
494   pSHPackDispParams=(void*)GetProcAddress(hShlwapi,(char*)282);
495
496   test_GetAcceptLanguagesA();
497   test_SHSearchMapInt();
498   test_alloc_shared();
499   test_fdsa();
500   test_GetShellSecurityDescriptor();
501   test_SHPackDispParams();
502 }