ReactOS 0.4.16-dev-1946-g52006dd
ordinal.c
Go to the documentation of this file.
1/*
2 * SHLWAPI ordinal functions
3 *
4 * Copyright 1997 Marcus Meissner
5 * 1998 Jürgen Schmied
6 * 2001-2003 Jon Griffiths
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 */
22
23#include "config.h"
24#include "wine/port.h"
25
26#include <stdarg.h>
27#include <stdio.h>
28#include <string.h>
29
30#define COBJMACROS
31
32#include "windef.h"
33#include "winbase.h"
34#include "winnls.h"
35#include "winreg.h"
36#include "wingdi.h"
37#include "winuser.h"
38#include "winver.h"
39#include "winnetwk.h"
40#include "mmsystem.h"
41#include "objbase.h"
42#include "exdisp.h"
43#include "shdeprecated.h"
44#include "shlobj.h"
45#include "shlwapi.h"
46#include "shellapi.h"
47#include "commdlg.h"
48#include "mlang.h"
49#include "mshtmhst.h"
50#ifdef __REACTOS__
51 #include <shlwapi_undoc.h>
52#endif
53#include "wine/unicode.h"
54#include "wine/debug.h"
55
56
58
59/* DLL handles for late bound calls */
62
64#ifdef __REACTOS__
66#else
68#endif
70
71/*
72 NOTES: Most functions exported by ordinal seem to be superfluous.
73 The reason for these functions to be there is to provide a wrapper
74 for unicode functions to provide these functions on systems without
75 unicode functions eg. win95/win98. Since we have such functions we just
76 call these. If running Wine with native DLLs, some late bound calls may
77 fail. However, it is better to implement the functions in the forward DLL
78 and recommend the builtin rather than reimplementing the calls here!
79*/
80
81/*************************************************************************
82 * @ [SHLWAPI.11]
83 *
84 * Copy a sharable memory handle from one process to another.
85 *
86 * PARAMS
87 * hShared [I] Shared memory handle to duplicate
88 * dwSrcProcId [I] ID of the process owning hShared
89 * dwDstProcId [I] ID of the process wanting the duplicated handle
90 * dwAccess [I] Desired DuplicateHandle() access
91 * dwOptions [I] Desired DuplicateHandle() options
92 *
93 * RETURNS
94 * Success: A handle suitable for use by the dwDstProcId process.
95 * Failure: A NULL handle.
96 *
97 */
98HANDLE WINAPI SHMapHandle(HANDLE hShared, DWORD dwSrcProcId, DWORD dwDstProcId,
99 DWORD dwAccess, DWORD dwOptions)
100{
101 HANDLE hDst, hSrc;
102 DWORD dwMyProcId = GetCurrentProcessId();
103 HANDLE hRet = NULL;
104
105 TRACE("(%p,%d,%d,%08x,%08x)\n", hShared, dwDstProcId, dwSrcProcId,
106 dwAccess, dwOptions);
107
108 if (!hShared)
109 {
110 TRACE("Returning handle NULL\n");
111 return NULL;
112 }
113
114 /* Get dest process handle */
115 if (dwDstProcId == dwMyProcId)
116 hDst = GetCurrentProcess();
117 else
118 hDst = OpenProcess(PROCESS_DUP_HANDLE, 0, dwDstProcId);
119
120 if (hDst)
121 {
122 /* Get src process handle */
123 if (dwSrcProcId == dwMyProcId)
124 hSrc = GetCurrentProcess();
125 else
126 hSrc = OpenProcess(PROCESS_DUP_HANDLE, 0, dwSrcProcId);
127
128 if (hSrc)
129 {
130 /* Make handle available to dest process */
131 if (!DuplicateHandle(hSrc, hShared, hDst, &hRet,
132 dwAccess, 0, dwOptions | DUPLICATE_SAME_ACCESS))
133 hRet = NULL;
134
135 if (dwSrcProcId != dwMyProcId)
136 CloseHandle(hSrc);
137 }
138
139 if (dwDstProcId != dwMyProcId)
140 CloseHandle(hDst);
141 }
142
143 TRACE("Returning handle %p\n", hRet);
144 return hRet;
145}
146
147/*************************************************************************
148 * @ [SHLWAPI.7]
149 *
150 * Create a block of sharable memory and initialise it with data.
151 *
152 * PARAMS
153 * lpvData [I] Pointer to data to write
154 * dwSize [I] Size of data
155 * dwProcId [I] ID of process owning data
156 *
157 * RETURNS
158 * Success: A shared memory handle
159 * Failure: NULL
160 *
161 * NOTES
162 * Ordinals 7-11 provide a set of calls to create shared memory between a
163 * group of processes. The shared memory is treated opaquely in that its size
164 * is not exposed to clients who map it. This is accomplished by storing
165 * the size of the map as the first DWORD of mapped data, and then offsetting
166 * the view pointer returned by this size.
167 *
168 */
170{
171 HANDLE hMap;
172 LPVOID pMapped;
173 HANDLE hRet = NULL;
174
175 TRACE("(%p,%d,%d)\n", lpvData, dwSize, dwProcId);
176
177 /* Create file mapping of the correct length */
179 dwSize + sizeof(dwSize), NULL);
180 if (!hMap)
181 return hRet;
182
183 /* Get a view in our process address space */
184 pMapped = MapViewOfFile(hMap, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0);
185
186 if (pMapped)
187 {
188 /* Write size of data, followed by the data, to the view */
189 *((DWORD*)pMapped) = dwSize;
190 if (lpvData)
191 memcpy((char *) pMapped + sizeof(dwSize), lpvData, dwSize);
192
193 /* Release view. All further views mapped will be opaque */
194 UnmapViewOfFile(pMapped);
195 hRet = SHMapHandle(hMap, GetCurrentProcessId(), dwProcId,
197 }
198
199 CloseHandle(hMap);
200 return hRet;
201}
202
203#ifdef __REACTOS__
204/*************************************************************************
205 * @ [SHLWAPI.510]
206 *
207 * Get a pointer to a block of shared memory from a shared memory handle,
208 * with specified access rights.
209 *
210 * PARAMS
211 * hShared [I] Shared memory handle
212 * dwProcId [I] ID of process owning hShared
213 * bWriteAccess [I] TRUE to get a writable block,
214 * FALSE to get a read-only block
215 *
216 * RETURNS
217 * Success: A pointer to the shared memory
218 * Failure: NULL
219 */
221SHLockSharedEx(HANDLE hShared, DWORD dwProcId, BOOL bWriteAccess)
222{
223 HANDLE hDup;
224 LPVOID pMapped;
225 DWORD dwAccess;
226
227 TRACE("(%p %d %d)\n", hShared, dwProcId, bWriteAccess);
228
229 /* Get handle to shared memory for current process */
230 hDup = SHMapHandle(hShared, dwProcId, GetCurrentProcessId(), FILE_MAP_ALL_ACCESS, 0);
231 if (hDup == NULL)
232 return NULL;
233
234 /* Get View */
235 dwAccess = (FILE_MAP_READ | (bWriteAccess ? FILE_MAP_WRITE : 0));
236 pMapped = MapViewOfFile(hDup, dwAccess, 0, 0, 0);
237 CloseHandle(hDup);
238
239 if (pMapped)
240 return (char *) pMapped + sizeof(DWORD); /* Hide size */
241 return NULL;
242}
243
244#endif
245/*************************************************************************
246 * @ [SHLWAPI.8]
247 *
248 * Get a pointer to a block of shared memory from a shared memory handle.
249 *
250 * PARAMS
251 * hShared [I] Shared memory handle
252 * dwProcId [I] ID of process owning hShared
253 *
254 * RETURNS
255 * Success: A pointer to the shared memory
256 * Failure: NULL
257 *
258 */
260{
261#ifdef __REACTOS__
262 return SHLockSharedEx(hShared, dwProcId, TRUE);
263#else
264 HANDLE hDup;
265 LPVOID pMapped;
266
267 TRACE("(%p %d)\n", hShared, dwProcId);
268
269 /* Get handle to shared memory for current process */
270 hDup = SHMapHandle(hShared, dwProcId, GetCurrentProcessId(), FILE_MAP_ALL_ACCESS, 0);
271
272 /* Get View */
273 pMapped = MapViewOfFile(hDup, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0);
274 CloseHandle(hDup);
275
276 if (pMapped)
277 return (char *) pMapped + sizeof(DWORD); /* Hide size */
278 return NULL;
279#endif
280}
281
282/*************************************************************************
283 * @ [SHLWAPI.9]
284 *
285 * Release a pointer to a block of shared memory.
286 *
287 * PARAMS
288 * lpView [I] Shared memory pointer
289 *
290 * RETURNS
291 * Success: TRUE
292 * Failure: FALSE
293 *
294 */
296{
297 TRACE("(%p)\n", lpView);
298 return UnmapViewOfFile((char *) lpView - sizeof(DWORD)); /* Include size */
299}
300
301/*************************************************************************
302 * @ [SHLWAPI.10]
303 *
304 * Destroy a block of sharable memory.
305 *
306 * PARAMS
307 * hShared [I] Shared memory handle
308 * dwProcId [I] ID of process owning hShared
309 *
310 * RETURNS
311 * Success: TRUE
312 * Failure: FALSE
313 *
314 */
316{
317 HANDLE hClose;
318
319 TRACE("(%p %d)\n", hShared, dwProcId);
320
321 if (!hShared)
322 return TRUE;
323
324 /* Get a copy of the handle for our process, closing the source handle */
325 hClose = SHMapHandle(hShared, dwProcId, GetCurrentProcessId(),
327 /* Close local copy */
328 return CloseHandle(hClose);
329}
330
331/*************************************************************************
332 * @ [SHLWAPI.13]
333 *
334 * Create and register a clipboard enumerator for a web browser.
335 *
336 * PARAMS
337 * lpBC [I] Binding context
338 * lpUnknown [I] An object exposing the IWebBrowserApp interface
339 *
340 * RETURNS
341 * Success: S_OK.
342 * Failure: An HRESULT error code.
343 *
344 * NOTES
345 * The enumerator is stored as a property of the web browser. If it does not
346 * yet exist, it is created and set before being registered.
347 */
349{
350 static const WCHAR szProperty[] = { '{','D','0','F','C','A','4','2','0',
351 '-','D','3','F','5','-','1','1','C','F', '-','B','2','1','1','-','0',
352 '0','A','A','0','0','4','A','E','8','3','7','}','\0' };
354 IEnumFORMATETC* pIEnumFormatEtc = NULL;
356 HRESULT hr;
357 IWebBrowserApp* pBrowser;
358
359 TRACE("(%p, %p)\n", lpBC, lpUnknown);
360
361 hr = IUnknown_QueryService(lpUnknown, &IID_IWebBrowserApp, &IID_IWebBrowserApp, (void**)&pBrowser);
362 if (FAILED(hr))
363 return hr;
364
365 V_VT(&var) = VT_EMPTY;
366
367 /* The property we get is the browsers clipboard enumerator */
368 property = SysAllocString(szProperty);
369 hr = IWebBrowserApp_GetProperty(pBrowser, property, &var);
371 if (FAILED(hr)) goto exit;
372
373 if (V_VT(&var) == VT_EMPTY)
374 {
375 /* Iterate through accepted documents and RegisterClipBoardFormatA() them */
376 char szKeyBuff[128], szValueBuff[128];
377 DWORD dwKeySize, dwValueSize, dwRet = 0, dwCount = 0, dwNumValues, dwType;
378 FORMATETC* formatList, *format;
379 HKEY hDocs;
380
381 TRACE("Registering formats and creating IEnumFORMATETC instance\n");
382
383 if (!RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\Current"
384 "Version\\Internet Settings\\Accepted Documents", &hDocs))
385 {
386 hr = E_FAIL;
387 goto exit;
388 }
389
390 /* Get count of values in key */
391 while (!dwRet)
392 {
393 dwKeySize = sizeof(szKeyBuff);
394 dwRet = RegEnumValueA(hDocs,dwCount,szKeyBuff,&dwKeySize,0,&dwType,0,0);
395 dwCount++;
396 }
397
398 dwNumValues = dwCount;
399
400 /* Note: dwCount = number of items + 1; The extra item is the end node */
401 format = formatList = HeapAlloc(GetProcessHeap(), 0, dwCount * sizeof(FORMATETC));
402 if (!formatList)
403 {
404 RegCloseKey(hDocs);
406 goto exit;
407 }
408
409 if (dwNumValues > 1)
410 {
411 dwRet = 0;
412 dwCount = 0;
413
414 dwNumValues--;
415
416 /* Register clipboard formats for the values and populate format list */
417 while(!dwRet && dwCount < dwNumValues)
418 {
419 dwKeySize = sizeof(szKeyBuff);
420 dwValueSize = sizeof(szValueBuff);
421 dwRet = RegEnumValueA(hDocs, dwCount, szKeyBuff, &dwKeySize, 0, &dwType,
422 (PBYTE)szValueBuff, &dwValueSize);
423 if (!dwRet)
424 {
425 HeapFree(GetProcessHeap(), 0, formatList);
426 RegCloseKey(hDocs);
427 hr = E_FAIL;
428 goto exit;
429 }
430
431 format->cfFormat = RegisterClipboardFormatA(szValueBuff);
432 format->ptd = NULL;
433 format->dwAspect = 1;
434 format->lindex = 4;
435 format->tymed = -1;
436
437 format++;
438 dwCount++;
439 }
440 }
441
442 RegCloseKey(hDocs);
443
444 /* Terminate the (maybe empty) list, last entry has a cfFormat of 0 */
445 format->cfFormat = 0;
446 format->ptd = NULL;
447 format->dwAspect = 1;
448 format->lindex = 4;
449 format->tymed = -1;
450
451 /* Create a clipboard enumerator */
452 hr = CreateFormatEnumerator(dwNumValues, formatList, &pIEnumFormatEtc);
453 HeapFree(GetProcessHeap(), 0, formatList);
454 if (FAILED(hr)) goto exit;
455
456 /* Set our enumerator as the browsers property */
457 V_VT(&var) = VT_UNKNOWN;
458 V_UNKNOWN(&var) = (IUnknown*)pIEnumFormatEtc;
459
460 property = SysAllocString(szProperty);
461 hr = IWebBrowserApp_PutProperty(pBrowser, property, var);
463 if (FAILED(hr))
464 {
465 IEnumFORMATETC_Release(pIEnumFormatEtc);
466 goto exit;
467 }
468 }
469
470 if (V_VT(&var) == VT_UNKNOWN)
471 {
472 /* Our variant is holding the clipboard enumerator */
473 IUnknown* pIUnknown = V_UNKNOWN(&var);
474 IEnumFORMATETC* pClone = NULL;
475
476 TRACE("Retrieved IEnumFORMATETC property\n");
477
478 /* Get an IEnumFormatEtc interface from the variants value */
479 pIEnumFormatEtc = NULL;
480 hr = IUnknown_QueryInterface(pIUnknown, &IID_IEnumFORMATETC, (void**)&pIEnumFormatEtc);
481 if (hr == S_OK && pIEnumFormatEtc)
482 {
483 /* Clone and register the enumerator */
484 hr = IEnumFORMATETC_Clone(pIEnumFormatEtc, &pClone);
485 if (hr == S_OK && pClone)
486 {
487 RegisterFormatEnumerator(lpBC, pClone, 0);
488
489 IEnumFORMATETC_Release(pClone);
490 }
491
492 IUnknown_Release(pIUnknown);
493 }
494 IUnknown_Release(V_UNKNOWN(&var));
495 }
496
497exit:
498 IWebBrowserApp_Release(pBrowser);
499 return hr;
500}
501
502/*************************************************************************
503 * @ [SHLWAPI.15]
504 *
505 * Get Explorers "AcceptLanguage" setting.
506 *
507 * PARAMS
508 * langbuf [O] Destination for language string
509 * buflen [I] Length of langbuf in characters
510 * [0] Success: used length of langbuf
511 *
512 * RETURNS
513 * Success: S_OK. langbuf is set to the language string found.
514 * Failure: E_FAIL, If any arguments are invalid, error occurred, or Explorer
515 * does not contain the setting.
516 * E_NOT_SUFFICIENT_BUFFER, If the buffer is not big enough
517 */
519{
520 static const WCHAR szkeyW[] = {
521 'S','o','f','t','w','a','r','e','\\',
522 'M','i','c','r','o','s','o','f','t','\\',
523 'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r','\\',
524 'I','n','t','e','r','n','a','t','i','o','n','a','l',0};
525 static const WCHAR valueW[] = {
526 'A','c','c','e','p','t','L','a','n','g','u','a','g','e',0};
527 DWORD mystrlen, mytype;
528 DWORD len;
529 HKEY mykey;
530 LCID mylcid;
531 WCHAR *mystr;
532 LONG lres;
533
534 TRACE("(%p, %p) *%p: %d\n", langbuf, buflen, buflen, buflen ? *buflen : -1);
535
536 if(!langbuf || !buflen || !*buflen)
537 return E_FAIL;
538
539 mystrlen = (*buflen > 20) ? *buflen : 20 ;
540 len = mystrlen * sizeof(WCHAR);
541 mystr = HeapAlloc(GetProcessHeap(), 0, len);
542 mystr[0] = 0;
543 RegOpenKeyW(HKEY_CURRENT_USER, szkeyW, &mykey);
544 lres = RegQueryValueExW(mykey, valueW, 0, &mytype, (PBYTE)mystr, &len);
545 RegCloseKey(mykey);
546 len = lstrlenW(mystr);
547
548 if (!lres && (*buflen > len)) {
549 lstrcpyW(langbuf, mystr);
550 *buflen = len;
551 HeapFree(GetProcessHeap(), 0, mystr);
552 return S_OK;
553 }
554
555 /* Did not find a value in the registry or the user buffer is too small */
556 mylcid = GetUserDefaultLCID();
557 LcidToRfc1766W(mylcid, mystr, mystrlen);
558 len = lstrlenW(mystr);
559
560 memcpy( langbuf, mystr, min(*buflen, len+1)*sizeof(WCHAR) );
561 HeapFree(GetProcessHeap(), 0, mystr);
562
563 if (*buflen > len) {
564 *buflen = len;
565 return S_OK;
566 }
567
568 *buflen = 0;
570}
571
572/*************************************************************************
573 * @ [SHLWAPI.14]
574 *
575 * Ascii version of GetAcceptLanguagesW.
576 */
578{
579 WCHAR *langbufW;
580 DWORD buflenW, convlen;
582
583 TRACE("(%p, %p) *%p: %d\n", langbuf, buflen, buflen, buflen ? *buflen : -1);
584
585 if(!langbuf || !buflen || !*buflen) return E_FAIL;
586
587 buflenW = *buflen;
588 langbufW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * buflenW);
589 retval = GetAcceptLanguagesW(langbufW, &buflenW);
590
591 if (retval == S_OK)
592 {
593 convlen = WideCharToMultiByte(CP_ACP, 0, langbufW, -1, langbuf, *buflen, NULL, NULL);
594 convlen--; /* do not count the terminating 0 */
595 }
596 else /* copy partial string anyway */
597 {
598 convlen = WideCharToMultiByte(CP_ACP, 0, langbufW, *buflen, langbuf, *buflen, NULL, NULL);
599 if (convlen < *buflen)
600 {
601 langbuf[convlen] = 0;
602 convlen--; /* do not count the terminating 0 */
603 }
604 else
605 {
606 convlen = *buflen;
607 }
608 }
609 *buflen = buflenW ? convlen : 0;
610
611 HeapFree(GetProcessHeap(), 0, langbufW);
612 return retval;
613}
614
615/*************************************************************************
616 * @ [SHLWAPI.23]
617 *
618 * Convert a GUID to a string.
619 *
620 * PARAMS
621 * guid [I] GUID to convert
622 * lpszDest [O] Destination for string
623 * cchMax [I] Length of output buffer
624 *
625 * RETURNS
626 * The length of the string created.
627 */
629{
630 char xguid[40];
631 INT iLen;
632
633 TRACE("(%s,%p,%d)\n", debugstr_guid(guid), lpszDest, cchMax);
634
635 sprintf(xguid, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
636 (UINT)guid->Data1, guid->Data2, guid->Data3,
637 guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
638 guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
639
640 iLen = strlen(xguid) + 1;
641
642 if (iLen > cchMax)
643 return 0;
644 memcpy(lpszDest, xguid, iLen);
645 return iLen;
646}
647
648/*************************************************************************
649 * @ [SHLWAPI.24]
650 *
651 * Convert a GUID to a string.
652 *
653 * PARAMS
654 * guid [I] GUID to convert
655 * str [O] Destination for string
656 * cmax [I] Length of output buffer
657 *
658 * RETURNS
659 * The length of the string created.
660 */
662{
663 WCHAR xguid[40];
664 INT iLen;
665 static const WCHAR wszFormat[] = {'{','%','0','8','l','X','-','%','0','4','X','-','%','0','4','X','-',
666 '%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X','%','0','2','X','%','0','2',
667 'X','%','0','2','X','%','0','2','X','}',0};
668
669 TRACE("(%s,%p,%d)\n", debugstr_guid(guid), lpszDest, cchMax);
670
671 sprintfW(xguid, wszFormat, guid->Data1, guid->Data2, guid->Data3,
672 guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
673 guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
674
675 iLen = strlenW(xguid) + 1;
676
677 if (iLen > cchMax)
678 return 0;
679 memcpy(lpszDest, xguid, iLen*sizeof(WCHAR));
680 return iLen;
681}
682
683/*************************************************************************
684 * @ [SHLWAPI.30]
685 *
686 * Determine if a Unicode character is a blank.
687 *
688 * PARAMS
689 * wc [I] Character to check.
690 *
691 * RETURNS
692 * TRUE, if wc is a blank,
693 * FALSE otherwise.
694 *
695 */
697{
698 WORD CharType;
699
700 return GetStringTypeW(CT_CTYPE1, &wc, 1, &CharType) && (CharType & C1_BLANK);
701}
702
703/*************************************************************************
704 * @ [SHLWAPI.31]
705 *
706 * Determine if a Unicode character is punctuation.
707 *
708 * PARAMS
709 * wc [I] Character to check.
710 *
711 * RETURNS
712 * TRUE, if wc is punctuation,
713 * FALSE otherwise.
714 */
716{
717 WORD CharType;
718
719 return GetStringTypeW(CT_CTYPE1, &wc, 1, &CharType) && (CharType & C1_PUNCT);
720}
721
722/*************************************************************************
723 * @ [SHLWAPI.32]
724 *
725 * Determine if a Unicode character is a control character.
726 *
727 * PARAMS
728 * wc [I] Character to check.
729 *
730 * RETURNS
731 * TRUE, if wc is a control character,
732 * FALSE otherwise.
733 */
735{
736 WORD CharType;
737
738 return GetStringTypeW(CT_CTYPE1, &wc, 1, &CharType) && (CharType & C1_CNTRL);
739}
740
741/*************************************************************************
742 * @ [SHLWAPI.33]
743 *
744 * Determine if a Unicode character is a digit.
745 *
746 * PARAMS
747 * wc [I] Character to check.
748 *
749 * RETURNS
750 * TRUE, if wc is a digit,
751 * FALSE otherwise.
752 */
754{
755 WORD CharType;
756
757 return GetStringTypeW(CT_CTYPE1, &wc, 1, &CharType) && (CharType & C1_DIGIT);
758}
759
760/*************************************************************************
761 * @ [SHLWAPI.34]
762 *
763 * Determine if a Unicode character is a hex digit.
764 *
765 * PARAMS
766 * wc [I] Character to check.
767 *
768 * RETURNS
769 * TRUE, if wc is a hex digit,
770 * FALSE otherwise.
771 */
773{
774 WORD CharType;
775
776 return GetStringTypeW(CT_CTYPE1, &wc, 1, &CharType) && (CharType & C1_XDIGIT);
777}
778
779/*************************************************************************
780 * @ [SHLWAPI.35]
781 *
782 */
784{
786}
787
788/*************************************************************************
789 * @ [SHLWAPI.151]
790 *
791 * Compare two Ascii strings up to a given length.
792 *
793 * PARAMS
794 * lpszSrc [I] Source string
795 * lpszCmp [I] String to compare to lpszSrc
796 * len [I] Maximum length
797 *
798 * RETURNS
799 * A number greater than, less than or equal to 0 depending on whether
800 * lpszSrc is greater than, less than or equal to lpszCmp.
801 */
803{
804 return StrCmpNA(lpszSrc, lpszCmp, len);
805}
806
807/*************************************************************************
808 * @ [SHLWAPI.152]
809 *
810 * Unicode version of StrCmpNCA.
811 */
813{
814 return StrCmpNW(lpszSrc, lpszCmp, len);
815}
816
817/*************************************************************************
818 * @ [SHLWAPI.153]
819 *
820 * Compare two Ascii strings up to a given length, ignoring case.
821 *
822 * PARAMS
823 * lpszSrc [I] Source string
824 * lpszCmp [I] String to compare to lpszSrc
825 * len [I] Maximum length
826 *
827 * RETURNS
828 * A number greater than, less than or equal to 0 depending on whether
829 * lpszSrc is greater than, less than or equal to lpszCmp.
830 */
832{
833 return StrCmpNIA(lpszSrc, lpszCmp, len);
834}
835
836/*************************************************************************
837 * @ [SHLWAPI.154]
838 *
839 * Unicode version of StrCmpNICA.
840 */
842{
843 return StrCmpNIW(lpszSrc, lpszCmp, len);
844}
845
846/*************************************************************************
847 * @ [SHLWAPI.155]
848 *
849 * Compare two Ascii strings.
850 *
851 * PARAMS
852 * lpszSrc [I] Source string
853 * lpszCmp [I] String to compare to lpszSrc
854 *
855 * RETURNS
856 * A number greater than, less than or equal to 0 depending on whether
857 * lpszSrc is greater than, less than or equal to lpszCmp.
858 */
860{
861 return lstrcmpA(lpszSrc, lpszCmp);
862}
863
864/*************************************************************************
865 * @ [SHLWAPI.156]
866 *
867 * Unicode version of StrCmpCA.
868 */
870{
871 return lstrcmpW(lpszSrc, lpszCmp);
872}
873
874/*************************************************************************
875 * @ [SHLWAPI.157]
876 *
877 * Compare two Ascii strings, ignoring case.
878 *
879 * PARAMS
880 * lpszSrc [I] Source string
881 * lpszCmp [I] String to compare to lpszSrc
882 *
883 * RETURNS
884 * A number greater than, less than or equal to 0 depending on whether
885 * lpszSrc is greater than, less than or equal to lpszCmp.
886 */
888{
889 return lstrcmpiA(lpszSrc, lpszCmp);
890}
891
892/*************************************************************************
893 * @ [SHLWAPI.158]
894 *
895 * Unicode version of StrCmpICA.
896 */
898{
899 return lstrcmpiW(lpszSrc, lpszCmp);
900}
901
902/*************************************************************************
903 * @ [SHLWAPI.160]
904 *
905 * Get an identification string for the OS and explorer.
906 *
907 * PARAMS
908 * lpszDest [O] Destination for Id string
909 * dwDestLen [I] Length of lpszDest
910 *
911 * RETURNS
912 * TRUE, If the string was created successfully
913 * FALSE, Otherwise
914 */
916{
917 WCHAR buff[2084];
918
919 TRACE("(%p,%d)\n", lpszDest, dwDestLen);
920
921 if (lpszDest && SHAboutInfoW(buff, dwDestLen))
922 {
923 WideCharToMultiByte(CP_ACP, 0, buff, -1, lpszDest, dwDestLen, NULL, NULL);
924 return TRUE;
925 }
926 return FALSE;
927}
928
929/*************************************************************************
930 * @ [SHLWAPI.161]
931 *
932 * Unicode version of SHAboutInfoA.
933 */
935{
936 static const WCHAR szIEKey[] = { 'S','O','F','T','W','A','R','E','\\',
937 'M','i','c','r','o','s','o','f','t','\\','I','n','t','e','r','n','e','t',
938 ' ','E','x','p','l','o','r','e','r','\0' };
939 static const WCHAR szWinNtKey[] = { 'S','O','F','T','W','A','R','E','\\',
940 'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s',' ',
941 'N','T','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\0' };
942 static const WCHAR szWinKey[] = { 'S','O','F','T','W','A','R','E','\\',
943 'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
944 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\0' };
945 static const WCHAR szRegKey[] = { 'S','O','F','T','W','A','R','E','\\',
946 'M','i','c','r','o','s','o','f','t','\\','I','n','t','e','r','n','e','t',
947 ' ','E','x','p','l','o','r','e','r','\\',
948 'R','e','g','i','s','t','r','a','t','i','o','n','\0' };
949 static const WCHAR szVersion[] = { 'V','e','r','s','i','o','n','\0' };
950 static const WCHAR szCustomized[] = { 'C','u','s','t','o','m','i','z','e','d',
951 'V','e','r','s','i','o','n','\0' };
952 static const WCHAR szOwner[] = { 'R','e','g','i','s','t','e','r','e','d',
953 'O','w','n','e','r','\0' };
954 static const WCHAR szOrg[] = { 'R','e','g','i','s','t','e','r','e','d',
955 'O','r','g','a','n','i','z','a','t','i','o','n','\0' };
956 static const WCHAR szProduct[] = { 'P','r','o','d','u','c','t','I','d','\0' };
957 static const WCHAR szUpdate[] = { 'I','E','A','K',
958 'U','p','d','a','t','e','U','r','l','\0' };
959 static const WCHAR szHelp[] = { 'I','E','A','K',
960 'H','e','l','p','S','t','r','i','n','g','\0' };
961 WCHAR buff[2084];
962 HKEY hReg;
963 DWORD dwType, dwLen;
964
965 TRACE("(%p,%d)\n", lpszDest, dwDestLen);
966
967 if (!lpszDest)
968 return FALSE;
969
970 *lpszDest = '\0';
971
972 /* Try the NT key first, followed by 95/98 key */
973 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szWinNtKey, 0, KEY_READ, &hReg) &&
974 RegOpenKeyExW(HKEY_LOCAL_MACHINE, szWinKey, 0, KEY_READ, &hReg))
975 return FALSE;
976
977 /* OS Version */
978 buff[0] = '\0';
979 dwLen = 30;
980 if (!SHGetValueW(HKEY_LOCAL_MACHINE, szIEKey, szVersion, &dwType, buff, &dwLen))
981 {
982 DWORD dwStrLen = strlenW(buff);
983 dwLen = 30 - dwStrLen;
985 szCustomized, &dwType, buff+dwStrLen, &dwLen);
986 }
987 StrCatBuffW(lpszDest, buff, dwDestLen);
988
989 /* ~Registered Owner */
990 buff[0] = '~';
991 dwLen = 256;
992 if (SHGetValueW(hReg, szOwner, 0, &dwType, buff+1, &dwLen))
993 buff[1] = '\0';
994 StrCatBuffW(lpszDest, buff, dwDestLen);
995
996 /* ~Registered Organization */
997 dwLen = 256;
998 if (SHGetValueW(hReg, szOrg, 0, &dwType, buff+1, &dwLen))
999 buff[1] = '\0';
1000 StrCatBuffW(lpszDest, buff, dwDestLen);
1001
1002 /* FIXME: Not sure where this number comes from */
1003 buff[0] = '~';
1004 buff[1] = '0';
1005 buff[2] = '\0';
1006 StrCatBuffW(lpszDest, buff, dwDestLen);
1007
1008 /* ~Product Id */
1009 dwLen = 256;
1010 if (SHGetValueW(HKEY_LOCAL_MACHINE, szRegKey, szProduct, &dwType, buff+1, &dwLen))
1011 buff[1] = '\0';
1012 StrCatBuffW(lpszDest, buff, dwDestLen);
1013
1014 /* ~IE Update Url */
1015 dwLen = 2048;
1016 if(SHGetValueW(HKEY_LOCAL_MACHINE, szWinKey, szUpdate, &dwType, buff+1, &dwLen))
1017 buff[1] = '\0';
1018 StrCatBuffW(lpszDest, buff, dwDestLen);
1019
1020 /* ~IE Help String */
1021 dwLen = 256;
1022 if(SHGetValueW(hReg, szHelp, 0, &dwType, buff+1, &dwLen))
1023 buff[1] = '\0';
1024 StrCatBuffW(lpszDest, buff, dwDestLen);
1025
1026 RegCloseKey(hReg);
1027 return TRUE;
1028}
1029
1030/*************************************************************************
1031 * @ [SHLWAPI.163]
1032 *
1033 * Call IOleCommandTarget_QueryStatus() on an object.
1034 *
1035 * PARAMS
1036 * lpUnknown [I] Object supporting the IOleCommandTarget interface
1037 * pguidCmdGroup [I] GUID for the command group
1038 * cCmds [I]
1039 * prgCmds [O] Commands
1040 * pCmdText [O] Command text
1041 *
1042 * RETURNS
1043 * Success: S_OK.
1044 * Failure: E_FAIL, if lpUnknown is NULL.
1045 * E_NOINTERFACE, if lpUnknown does not support IOleCommandTarget.
1046 * Otherwise, an error code from IOleCommandTarget_QueryStatus().
1047 */
1049 ULONG cCmds, OLECMD *prgCmds, OLECMDTEXT* pCmdText)
1050{
1051 HRESULT hRet = E_FAIL;
1052
1053 TRACE("(%p,%p,%d,%p,%p)\n",lpUnknown, pguidCmdGroup, cCmds, prgCmds, pCmdText);
1054
1055 if (lpUnknown)
1056 {
1057 IOleCommandTarget* lpOle;
1058
1059 hRet = IUnknown_QueryInterface(lpUnknown, &IID_IOleCommandTarget,
1060 (void**)&lpOle);
1061
1062 if (SUCCEEDED(hRet) && lpOle)
1063 {
1064 hRet = IOleCommandTarget_QueryStatus(lpOle, pguidCmdGroup, cCmds,
1065 prgCmds, pCmdText);
1066 IOleCommandTarget_Release(lpOle);
1067 }
1068 }
1069 return hRet;
1070}
1071
1072/*************************************************************************
1073 * @ [SHLWAPI.164]
1074 *
1075 * Call IOleCommandTarget_Exec() on an object.
1076 *
1077 * PARAMS
1078 * lpUnknown [I] Object supporting the IOleCommandTarget interface
1079 * pguidCmdGroup [I] GUID for the command group
1080 *
1081 * RETURNS
1082 * Success: S_OK.
1083 * Failure: E_FAIL, if lpUnknown is NULL.
1084 * E_NOINTERFACE, if lpUnknown does not support IOleCommandTarget.
1085 * Otherwise, an error code from IOleCommandTarget_Exec().
1086 */
1087HRESULT WINAPI IUnknown_Exec(IUnknown* lpUnknown, REFGUID pguidCmdGroup,
1088 DWORD nCmdID, DWORD nCmdexecopt, VARIANT* pvaIn,
1089 VARIANT* pvaOut)
1090{
1091 HRESULT hRet = E_FAIL;
1092
1093 TRACE("(%p,%p,%d,%d,%p,%p)\n",lpUnknown, pguidCmdGroup, nCmdID,
1094 nCmdexecopt, pvaIn, pvaOut);
1095
1096 if (lpUnknown)
1097 {
1098 IOleCommandTarget* lpOle;
1099
1100 hRet = IUnknown_QueryInterface(lpUnknown, &IID_IOleCommandTarget,
1101 (void**)&lpOle);
1102 if (SUCCEEDED(hRet) && lpOle)
1103 {
1104 hRet = IOleCommandTarget_Exec(lpOle, pguidCmdGroup, nCmdID,
1105 nCmdexecopt, pvaIn, pvaOut);
1106 IOleCommandTarget_Release(lpOle);
1107 }
1108 }
1109 return hRet;
1110}
1111
1112/*************************************************************************
1113 * @ [SHLWAPI.165]
1114 *
1115 * Retrieve, modify, and re-set a value from a window.
1116 *
1117 * PARAMS
1118 * hWnd [I] Window to get value from
1119 * offset [I] Offset of value
1120 * mask [I] Mask for flags
1121 * flags [I] Bits to set in window value
1122 *
1123 * RETURNS
1124 * The new value as it was set, or 0 if any parameter is invalid.
1125 *
1126 * NOTES
1127 * Only bits specified in mask are affected - set if present in flags and
1128 * reset otherwise.
1129 */
1131{
1133 LONG new_flags = (flags & mask) | (ret & ~mask);
1134
1135 TRACE("%p %d %x %x\n", hwnd, offset, mask, flags);
1136
1137 if (new_flags != ret)
1138 ret = SetWindowLongW(hwnd, offset, new_flags);
1139 return ret;
1140}
1141
1142/*************************************************************************
1143 * @ [SHLWAPI.167]
1144 *
1145 * Change a window's parent.
1146 *
1147 * PARAMS
1148 * hWnd [I] Window to change parent of
1149 * hWndParent [I] New parent window
1150 *
1151 * RETURNS
1152 * The old parent of hWnd.
1153 *
1154 * NOTES
1155 * If hWndParent is NULL (desktop), the window style is changed to WS_POPUP.
1156 * If hWndParent is NOT NULL then we set the WS_CHILD style.
1157 */
1159{
1160 TRACE("%p, %p\n", hWnd, hWndParent);
1161
1162 if(GetParent(hWnd) == hWndParent)
1163 return NULL;
1164
1165 if(hWndParent)
1167 else
1169
1171}
1172
1173/*************************************************************************
1174 * @ [SHLWAPI.168]
1175 *
1176 * Locate and advise a connection point in an IConnectionPointContainer object.
1177 *
1178 * PARAMS
1179 * lpUnkSink [I] Sink for the connection point advise call
1180 * riid [I] REFIID of connection point to advise
1181 * fConnect [I] TRUE = Connection being establisted, FALSE = broken
1182 * lpUnknown [I] Object supporting the IConnectionPointContainer interface
1183 * lpCookie [O] Pointer to connection point cookie
1184 * lppCP [O] Destination for the IConnectionPoint found
1185 *
1186 * RETURNS
1187 * Success: S_OK. If lppCP is non-NULL, it is filled with the IConnectionPoint
1188 * that was advised. The caller is responsible for releasing it.
1189 * Failure: E_FAIL, if any arguments are invalid.
1190 * E_NOINTERFACE, if lpUnknown isn't an IConnectionPointContainer,
1191 * Or an HRESULT error code if any call fails.
1192 */
1194 IUnknown* lpUnknown, LPDWORD lpCookie,
1195 IConnectionPoint **lppCP)
1196{
1197 HRESULT hRet;
1198 IConnectionPointContainer* lpContainer;
1199 IConnectionPoint *lpCP;
1200
1201 if(!lpUnknown || (fConnect && !lpUnkSink))
1202 return E_FAIL;
1203
1204 if(lppCP)
1205 *lppCP = NULL;
1206
1207 hRet = IUnknown_QueryInterface(lpUnknown, &IID_IConnectionPointContainer,
1208 (void**)&lpContainer);
1209 if (SUCCEEDED(hRet))
1210 {
1211 hRet = IConnectionPointContainer_FindConnectionPoint(lpContainer, riid, &lpCP);
1212
1213 if (SUCCEEDED(hRet))
1214 {
1215 if(!fConnect)
1216 hRet = IConnectionPoint_Unadvise(lpCP, *lpCookie);
1217 else
1218 hRet = IConnectionPoint_Advise(lpCP, lpUnkSink, lpCookie);
1219
1220 if (FAILED(hRet))
1221 *lpCookie = 0;
1222
1223 if (lppCP && SUCCEEDED(hRet))
1224 *lppCP = lpCP; /* Caller keeps the interface */
1225 else
1226 IConnectionPoint_Release(lpCP); /* Release it */
1227 }
1228
1229 IConnectionPointContainer_Release(lpContainer);
1230 }
1231 return hRet;
1232}
1233
1234/*************************************************************************
1235 * @ [SHLWAPI.169]
1236 *
1237 * Release an interface and zero a supplied pointer.
1238 *
1239 * PARAMS
1240 * lpUnknown [I] Object to release
1241 *
1242 * RETURNS
1243 * Nothing.
1244 */
1246{
1247 TRACE("(%p)\n", lpUnknown);
1248
1249 if(!lpUnknown || !*lpUnknown) return;
1250
1251 TRACE("doing Release\n");
1252
1253 IUnknown_Release(*lpUnknown);
1254 *lpUnknown = NULL;
1255}
1256
1257/*************************************************************************
1258 * @ [SHLWAPI.170]
1259 *
1260 * Skip '//' if present in a string.
1261 *
1262 * PARAMS
1263 * lpszSrc [I] String to check for '//'
1264 *
1265 * RETURNS
1266 * Success: The next character after the '//' or the string if not present
1267 * Failure: NULL, if lpszStr is NULL.
1268 */
1270{
1271 if (lpszSrc && lpszSrc[0] == '/' && lpszSrc[1] == '/')
1272 lpszSrc += 2;
1273 return lpszSrc;
1274}
1275
1276/*************************************************************************
1277 * @ [SHLWAPI.171]
1278 *
1279 * Check if two interfaces come from the same object.
1280 *
1281 * PARAMS
1282 * lpInt1 [I] Interface to check against lpInt2.
1283 * lpInt2 [I] Interface to check against lpInt1.
1284 *
1285 * RETURNS
1286 * TRUE, If the interfaces come from the same object.
1287 * FALSE Otherwise.
1288 */
1290{
1291 IUnknown *lpUnknown1, *lpUnknown2;
1292 BOOL ret;
1293
1294 TRACE("(%p %p)\n", lpInt1, lpInt2);
1295
1296 if (!lpInt1 || !lpInt2)
1297 return FALSE;
1298
1299 if (lpInt1 == lpInt2)
1300 return TRUE;
1301
1302 if (IUnknown_QueryInterface(lpInt1, &IID_IUnknown, (void**)&lpUnknown1) != S_OK)
1303 return FALSE;
1304
1305 if (IUnknown_QueryInterface(lpInt2, &IID_IUnknown, (void**)&lpUnknown2) != S_OK)
1306 {
1307 IUnknown_Release(lpUnknown1);
1308 return FALSE;
1309 }
1310
1311 ret = lpUnknown1 == lpUnknown2;
1312
1313 IUnknown_Release(lpUnknown1);
1314 IUnknown_Release(lpUnknown2);
1315
1316 return ret;
1317}
1318
1319/*************************************************************************
1320 * @ [SHLWAPI.172]
1321 *
1322 * Get the window handle of an object.
1323 *
1324 * PARAMS
1325 * lpUnknown [I] Object to get the window handle of
1326 * lphWnd [O] Destination for window handle
1327 *
1328 * RETURNS
1329 * Success: S_OK. lphWnd contains the objects window handle.
1330 * Failure: An HRESULT error code.
1331 *
1332 * NOTES
1333 * lpUnknown is expected to support one of the following interfaces:
1334 * IOleWindow(), IInternetSecurityMgrSite(), or IShellView().
1335 */
1337{
1338 IUnknown *lpOle;
1339 HRESULT hRet = E_FAIL;
1340
1341 TRACE("(%p,%p)\n", lpUnknown, lphWnd);
1342
1343 if (!lpUnknown)
1344 return hRet;
1345
1346 hRet = IUnknown_QueryInterface(lpUnknown, &IID_IOleWindow, (void**)&lpOle);
1347
1348 if (FAILED(hRet))
1349 {
1350 hRet = IUnknown_QueryInterface(lpUnknown,&IID_IShellView, (void**)&lpOle);
1351
1352 if (FAILED(hRet))
1353 {
1354 hRet = IUnknown_QueryInterface(lpUnknown, &IID_IInternetSecurityMgrSite,
1355 (void**)&lpOle);
1356 }
1357 }
1358
1359 if (SUCCEEDED(hRet))
1360 {
1361 /* Laziness here - Since GetWindow() is the first method for the above 3
1362 * interfaces, we use the same call for them all.
1363 */
1364 hRet = IOleWindow_GetWindow((IOleWindow*)lpOle, lphWnd);
1365 IUnknown_Release(lpOle);
1366 if (lphWnd)
1367 TRACE("Returning HWND=%p\n", *lphWnd);
1368 }
1369
1370 return hRet;
1371}
1372
1373/*************************************************************************
1374 * @ [SHLWAPI.173]
1375 *
1376 * Call a SetOwner method of IShellService from specified object.
1377 *
1378 * PARAMS
1379 * iface [I] Object that supports IShellService
1380 * pUnk [I] Argument for the SetOwner call
1381 *
1382 * RETURNS
1383 * Corresponding return value from last call or E_FAIL for null input
1384 */
1386{
1387 IShellService *service;
1388 HRESULT hr;
1389
1390 TRACE("(%p, %p)\n", iface, pUnk);
1391
1392 if (!iface) return E_FAIL;
1393
1394 hr = IUnknown_QueryInterface(iface, &IID_IShellService, (void**)&service);
1395 if (hr == S_OK)
1396 {
1397 hr = IShellService_SetOwner(service, pUnk);
1398 IShellService_Release(service);
1399 }
1400
1401 return hr;
1402}
1403
1404/*************************************************************************
1405 * @ [SHLWAPI.174]
1406 *
1407 * Call either IObjectWithSite_SetSite() or IInternetSecurityManager_SetSecuritySite() on
1408 * an object.
1409 *
1410 */
1412 IUnknown *obj, /* [in] OLE object */
1413 IUnknown *site) /* [in] Site interface */
1414{
1415 HRESULT hr;
1416 IObjectWithSite *iobjwithsite;
1417 IInternetSecurityManager *isecmgr;
1418
1419 if (!obj) return E_FAIL;
1420
1421 hr = IUnknown_QueryInterface(obj, &IID_IObjectWithSite, (LPVOID *)&iobjwithsite);
1422 TRACE("IID_IObjectWithSite QI ret=%08x, %p\n", hr, iobjwithsite);
1423 if (SUCCEEDED(hr))
1424 {
1425 hr = IObjectWithSite_SetSite(iobjwithsite, site);
1426 TRACE("done IObjectWithSite_SetSite ret=%08x\n", hr);
1427 IObjectWithSite_Release(iobjwithsite);
1428 }
1429 else
1430 {
1431 hr = IUnknown_QueryInterface(obj, &IID_IInternetSecurityManager, (LPVOID *)&isecmgr);
1432 TRACE("IID_IInternetSecurityManager QI ret=%08x, %p\n", hr, isecmgr);
1433 if (FAILED(hr)) return hr;
1434
1435 hr = IInternetSecurityManager_SetSecuritySite(isecmgr, (IInternetSecurityMgrSite *)site);
1436 TRACE("done IInternetSecurityManager_SetSecuritySite ret=%08x\n", hr);
1437 IInternetSecurityManager_Release(isecmgr);
1438 }
1439 return hr;
1440}
1441
1442/*************************************************************************
1443 * @ [SHLWAPI.175]
1444 *
1445 * Call IPersist_GetClassID() on an object.
1446 *
1447 * PARAMS
1448 * lpUnknown [I] Object supporting the IPersist interface
1449 * clsid [O] Destination for Class Id
1450 *
1451 * RETURNS
1452 * Success: S_OK. lpClassId contains the Class Id requested.
1453 * Failure: E_FAIL, If lpUnknown is NULL,
1454 * E_NOINTERFACE If lpUnknown does not support IPersist,
1455 * Or an HRESULT error code.
1456 */
1458{
1459 IPersist *persist;
1460 HRESULT hr;
1461
1462 TRACE("(%p, %p)\n", lpUnknown, clsid);
1463
1464 if (!lpUnknown)
1465 {
1466 memset(clsid, 0, sizeof(*clsid));
1467 return E_FAIL;
1468 }
1469
1470 hr = IUnknown_QueryInterface(lpUnknown, &IID_IPersist, (void**)&persist);
1471 if (hr != S_OK)
1472 {
1473 hr = IUnknown_QueryInterface(lpUnknown, &IID_IPersistFolder, (void**)&persist);
1474 if (hr != S_OK)
1475 return hr;
1476 }
1477
1478 hr = IPersist_GetClassID(persist, clsid);
1479 IPersist_Release(persist);
1480 return hr;
1481}
1482
1483/*************************************************************************
1484 * @ [SHLWAPI.176]
1485 *
1486 * Retrieve a Service Interface from an object.
1487 *
1488 * PARAMS
1489 * lpUnknown [I] Object to get an IServiceProvider interface from
1490 * sid [I] Service ID for IServiceProvider_QueryService() call
1491 * riid [I] Function requested for QueryService call
1492 * lppOut [O] Destination for the service interface pointer
1493 *
1494 * RETURNS
1495 * Success: S_OK. lppOut contains an object providing the requested service
1496 * Failure: An HRESULT error code
1497 *
1498 * NOTES
1499 * lpUnknown is expected to support the IServiceProvider interface.
1500 */
1502 LPVOID *lppOut)
1503{
1504 IServiceProvider* pService = NULL;
1505 HRESULT hRet;
1506
1507 if (!lppOut)
1508 return E_FAIL;
1509
1510 *lppOut = NULL;
1511
1512 if (!lpUnknown)
1513 return E_FAIL;
1514
1515 hRet = IUnknown_QueryInterface(lpUnknown, &IID_IServiceProvider,
1516 (LPVOID*)&pService);
1517
1518 if (hRet == S_OK && pService)
1519 {
1520 TRACE("QueryInterface returned (IServiceProvider*)%p\n", pService);
1521
1522 /* Get a Service interface from the object */
1523 hRet = IServiceProvider_QueryService(pService, sid, riid, lppOut);
1524
1525 TRACE("(IServiceProvider*)%p returned (IUnknown*)%p\n", pService, *lppOut);
1526
1527 IServiceProvider_Release(pService);
1528 }
1529 return hRet;
1530}
1531
1532/*************************************************************************
1533 * @ [SHLWAPI.484]
1534 *
1535 * Calls IOleCommandTarget::Exec() for specified service object.
1536 *
1537 * PARAMS
1538 * lpUnknown [I] Object to get an IServiceProvider interface from
1539 * service [I] Service ID for IServiceProvider_QueryService() call
1540 * group [I] Group ID for IOleCommandTarget::Exec() call
1541 * cmdId [I] Command ID for IOleCommandTarget::Exec() call
1542 * cmdOpt [I] Options flags for command
1543 * pIn [I] Input arguments for command
1544 * pOut [O] Output arguments for command
1545 *
1546 * RETURNS
1547 * Success: S_OK. lppOut contains an object providing the requested service
1548 * Failure: An HRESULT error code
1549 *
1550 * NOTES
1551 * lpUnknown is expected to support the IServiceProvider interface.
1552 */
1554 const GUID *group, DWORD cmdId, DWORD cmdOpt, VARIANT *pIn, VARIANT *pOut)
1555{
1557 HRESULT hr;
1558
1559 TRACE("%p %s %s %d %08x %p %p\n", lpUnknown, debugstr_guid(service),
1560 debugstr_guid(group), cmdId, cmdOpt, pIn, pOut);
1561
1562 hr = IUnknown_QueryService(lpUnknown, service, &IID_IOleCommandTarget, (void**)&target);
1563 if (hr == S_OK)
1564 {
1565 hr = IOleCommandTarget_Exec(target, group, cmdId, cmdOpt, pIn, pOut);
1566 IOleCommandTarget_Release(target);
1567 }
1568
1569 TRACE("<-- hr=0x%08x\n", hr);
1570
1571 return hr;
1572}
1573
1574/*************************************************************************
1575 * @ [SHLWAPI.514]
1576 *
1577 * Calls IProfferService methods to proffer/revoke specified service.
1578 *
1579 * PARAMS
1580 * lpUnknown [I] Object to get an IServiceProvider interface from
1581 * service [I] Service ID for IProfferService::Proffer/Revoke calls
1582 * pService [I] Service to proffer. If NULL ::Revoke is called
1583 * pCookie [IO] Group ID for IOleCommandTarget::Exec() call
1584 *
1585 * RETURNS
1586 * Success: S_OK. IProffer method returns S_OK
1587 * Failure: An HRESULT error code
1588 *
1589 * NOTES
1590 * lpUnknown is expected to support the IServiceProvider interface.
1591 */
1593{
1594 IProfferService *proffer;
1595 HRESULT hr;
1596
1597 TRACE("%p %s %p %p\n", lpUnknown, debugstr_guid(service), pService, pCookie);
1598
1599 hr = IUnknown_QueryService(lpUnknown, &IID_IProfferService, &IID_IProfferService, (void**)&proffer);
1600 if (hr == S_OK)
1601 {
1602 if (pService)
1603 hr = IProfferService_ProfferService(proffer, service, pService, pCookie);
1604 else
1605 {
1606 hr = IProfferService_RevokeService(proffer, *pCookie);
1607 *pCookie = 0;
1608 }
1609
1610 IProfferService_Release(proffer);
1611 }
1612
1613 return hr;
1614}
1615
1616/*************************************************************************
1617 * @ [SHLWAPI.479]
1618 *
1619 * Call an object's UIActivateIO method.
1620 *
1621 * PARAMS
1622 * unknown [I] Object to call the UIActivateIO method on
1623 * activate [I] Parameter for UIActivateIO call
1624 * msg [I] Parameter for UIActivateIO call
1625 *
1626 * RETURNS
1627 * Success: Value of UI_ActivateIO call
1628 * Failure: An HRESULT error code
1629 *
1630 * NOTES
1631 * unknown is expected to support the IInputObject interface.
1632 */
1634{
1635 IInputObject* object = NULL;
1636 HRESULT ret;
1637
1638 if (!unknown)
1639 return E_FAIL;
1640
1641 /* Get an IInputObject interface from the object */
1642 ret = IUnknown_QueryInterface(unknown, &IID_IInputObject, (LPVOID*) &object);
1643
1644 if (ret == S_OK)
1645 {
1646 ret = IInputObject_UIActivateIO(object, activate, msg);
1647 IInputObject_Release(object);
1648 }
1649
1650 return ret;
1651}
1652
1653/*************************************************************************
1654 * @ [SHLWAPI.177]
1655 *
1656 * Loads a popup menu.
1657 *
1658 * PARAMS
1659 * hInst [I] Instance handle
1660 * szName [I] Menu name
1661 *
1662 * RETURNS
1663 * Success: TRUE.
1664 * Failure: FALSE.
1665 */
1667{
1668 HMENU hMenu;
1669
1670 TRACE("%p %s\n", hInst, debugstr_w(szName));
1671
1672 if ((hMenu = LoadMenuW(hInst, szName)))
1673 {
1674 if (GetSubMenu(hMenu, 0))
1675 RemoveMenu(hMenu, 0, MF_BYPOSITION);
1676
1677 DestroyMenu(hMenu);
1678 return TRUE;
1679 }
1680 return FALSE;
1681}
1682
1683typedef struct _enumWndData
1684{
1690
1691/* Callback for SHLWAPI_178 */
1693{
1695
1696 TRACE("(%p,%p)\n", hWnd, data);
1697 data->pfnPost(hWnd, data->uiMsgId, data->wParam, data->lParam);
1698 return TRUE;
1699}
1700
1701/*************************************************************************
1702 * @ [SHLWAPI.178]
1703 *
1704 * Send or post a message to every child of a window.
1705 *
1706 * PARAMS
1707 * hWnd [I] Window whose children will get the messages
1708 * uiMsgId [I] Message Id
1709 * wParam [I] WPARAM of message
1710 * lParam [I] LPARAM of message
1711 * bSend [I] TRUE = Use SendMessageA(), FALSE = Use PostMessageA()
1712 *
1713 * RETURNS
1714 * Nothing.
1715 *
1716 * NOTES
1717 * The appropriate ASCII or Unicode function is called for the window.
1718 */
1720{
1722
1723 TRACE("(%p,%u,%ld,%ld,%d)\n", hWnd, uiMsgId, wParam, lParam, bSend);
1724
1725 if(hWnd)
1726 {
1727 data.uiMsgId = uiMsgId;
1728 data.wParam = wParam;
1729 data.lParam = lParam;
1730
1731 if (bSend)
1732 data.pfnPost = IsWindowUnicode(hWnd) ? (void*)SendMessageW : (void*)SendMessageA;
1733 else
1734 data.pfnPost = IsWindowUnicode(hWnd) ? (void*)PostMessageW : (void*)PostMessageA;
1735
1737 }
1738}
1739
1740/*************************************************************************
1741 * @ [SHLWAPI.180]
1742 *
1743 * Remove all sub-menus from a menu.
1744 *
1745 * PARAMS
1746 * hMenu [I] Menu to remove sub-menus from
1747 *
1748 * RETURNS
1749 * Success: 0. All sub-menus under hMenu are removed
1750 * Failure: -1, if any parameter is invalid
1751 */
1753{
1754 int iItemCount = GetMenuItemCount(hMenu) - 1;
1755
1756 TRACE("%p\n", hMenu);
1757
1758 while (iItemCount >= 0)
1759 {
1760 HMENU hSubMenu = GetSubMenu(hMenu, iItemCount);
1761 if (hSubMenu)
1762 RemoveMenu(hMenu, iItemCount, MF_BYPOSITION);
1763 iItemCount--;
1764 }
1765 return iItemCount;
1766}
1767
1768/*************************************************************************
1769 * @ [SHLWAPI.181]
1770 *
1771 * Enable or disable a menu item.
1772 *
1773 * PARAMS
1774 * hMenu [I] Menu holding menu item
1775 * uID [I] ID of menu item to enable/disable
1776 * bEnable [I] Whether to enable (TRUE) or disable (FALSE) the item.
1777 *
1778 * RETURNS
1779 * The return code from EnableMenuItem.
1780 */
1782{
1783 TRACE("%p, %u, %d\n", hMenu, wItemID, bEnable);
1784 return EnableMenuItem(hMenu, wItemID, bEnable ? MF_ENABLED : MF_GRAYED);
1785}
1786
1787/*************************************************************************
1788 * @ [SHLWAPI.182]
1789 *
1790 * Check or uncheck a menu item.
1791 *
1792 * PARAMS
1793 * hMenu [I] Menu holding menu item
1794 * uID [I] ID of menu item to check/uncheck
1795 * bCheck [I] Whether to check (TRUE) or uncheck (FALSE) the item.
1796 *
1797 * RETURNS
1798 * The return code from CheckMenuItem.
1799 */
1801{
1802 TRACE("%p, %u, %d\n", hMenu, uID, bCheck);
1803 return CheckMenuItem(hMenu, uID, bCheck ? MF_CHECKED : MF_UNCHECKED);
1804}
1805
1806/*************************************************************************
1807 * @ [SHLWAPI.183]
1808 *
1809 * Register a window class if it isn't already.
1810 *
1811 * PARAMS
1812 * lpWndClass [I] Window class to register
1813 *
1814 * RETURNS
1815 * The result of the RegisterClassA call.
1816 */
1818{
1819 WNDCLASSA wca;
1820 if (GetClassInfoA(wndclass->hInstance, wndclass->lpszClassName, &wca))
1821 return TRUE;
1822 return (DWORD)RegisterClassA(wndclass);
1823}
1824
1825/*************************************************************************
1826 * @ [SHLWAPI.186]
1827 */
1829 DWORD grfKeyState, PPOINTL lpPt, DWORD* pdwEffect)
1830{
1831 DWORD dwEffect = DROPEFFECT_LINK | DROPEFFECT_MOVE | DROPEFFECT_COPY;
1832 POINTL pt = { 0, 0 };
1833
1834 TRACE("%p %p 0x%08x %p %p\n", pDrop, pDataObj, grfKeyState, lpPt, pdwEffect);
1835
1836 if (!lpPt)
1837 lpPt = &pt;
1838
1839 if (!pdwEffect)
1840 pdwEffect = &dwEffect;
1841
1842 IDropTarget_DragEnter(pDrop, pDataObj, grfKeyState, *lpPt, pdwEffect);
1843
1844 if (*pdwEffect != DROPEFFECT_NONE)
1845 return IDropTarget_Drop(pDrop, pDataObj, grfKeyState, *lpPt, pdwEffect);
1846
1847 IDropTarget_DragLeave(pDrop);
1848 return TRUE;
1849}
1850
1851/*************************************************************************
1852 * @ [SHLWAPI.187]
1853 *
1854 * Call IPersistPropertyBag_Load() on an object.
1855 *
1856 * PARAMS
1857 * lpUnknown [I] Object supporting the IPersistPropertyBag interface
1858 * lpPropBag [O] Destination for loaded IPropertyBag
1859 *
1860 * RETURNS
1861 * Success: S_OK.
1862 * Failure: An HRESULT error code, or E_FAIL if lpUnknown is NULL.
1863 */
1865{
1866 IPersistPropertyBag* lpPPBag;
1867 HRESULT hRet = E_FAIL;
1868
1869 TRACE("(%p,%p)\n", lpUnknown, lpPropBag);
1870
1871 if (lpUnknown)
1872 {
1873 hRet = IUnknown_QueryInterface(lpUnknown, &IID_IPersistPropertyBag,
1874 (void**)&lpPPBag);
1875 if (SUCCEEDED(hRet) && lpPPBag)
1876 {
1877 hRet = IPersistPropertyBag_Load(lpPPBag, lpPropBag, NULL);
1878 IPersistPropertyBag_Release(lpPPBag);
1879 }
1880 }
1881 return hRet;
1882}
1883
1884/*************************************************************************
1885 * @ [SHLWAPI.188]
1886 *
1887 * Call IOleControlSite_TranslateAccelerator() on an object.
1888 *
1889 * PARAMS
1890 * lpUnknown [I] Object supporting the IOleControlSite interface.
1891 * lpMsg [I] Key message to be processed.
1892 * dwModifiers [I] Flags containing the state of the modifier keys.
1893 *
1894 * RETURNS
1895 * Success: S_OK.
1896 * Failure: An HRESULT error code, or E_INVALIDARG if lpUnknown is NULL.
1897 */
1899{
1900 IOleControlSite* lpCSite = NULL;
1901 HRESULT hRet = E_INVALIDARG;
1902
1903 TRACE("(%p,%p,0x%08x)\n", lpUnknown, lpMsg, dwModifiers);
1904 if (lpUnknown)
1905 {
1906 hRet = IUnknown_QueryInterface(lpUnknown, &IID_IOleControlSite,
1907 (void**)&lpCSite);
1908 if (SUCCEEDED(hRet) && lpCSite)
1909 {
1910 hRet = IOleControlSite_TranslateAccelerator(lpCSite, lpMsg, dwModifiers);
1911 IOleControlSite_Release(lpCSite);
1912 }
1913 }
1914 return hRet;
1915}
1916
1917
1918/*************************************************************************
1919 * @ [SHLWAPI.189]
1920 *
1921 * Call IOleControlSite_OnFocus() on an object.
1922 *
1923 * PARAMS
1924 * lpUnknown [I] Object supporting the IOleControlSite interface.
1925 * fGotFocus [I] Whether focus was gained (TRUE) or lost (FALSE).
1926 *
1927 * RETURNS
1928 * Success: S_OK.
1929 * Failure: An HRESULT error code, or E_FAIL if lpUnknown is NULL.
1930 */
1932{
1933 IOleControlSite* lpCSite = NULL;
1934 HRESULT hRet = E_FAIL;
1935
1936 TRACE("(%p, %d)\n", lpUnknown, fGotFocus);
1937 if (lpUnknown)
1938 {
1939 hRet = IUnknown_QueryInterface(lpUnknown, &IID_IOleControlSite,
1940 (void**)&lpCSite);
1941 if (SUCCEEDED(hRet) && lpCSite)
1942 {
1943 hRet = IOleControlSite_OnFocus(lpCSite, fGotFocus);
1944 IOleControlSite_Release(lpCSite);
1945 }
1946 }
1947 return hRet;
1948}
1949
1950/*************************************************************************
1951 * @ [SHLWAPI.190]
1952 */
1954 PVOID lpArg2, PVOID lpArg3, PVOID lpArg4)
1955{
1956 /* FIXME: {D12F26B2-D90A-11D0-830D-00AA005B4383} - What object does this represent? */
1957 static const DWORD service_id[] = { 0xd12f26b2, 0x11d0d90a, 0xaa000d83, 0x83435b00 };
1958 /* FIXME: {D12F26B1-D90A-11D0-830D-00AA005B4383} - Also Unknown/undocumented */
1959 static const DWORD function_id[] = { 0xd12f26b1, 0x11d0d90a, 0xaa000d83, 0x83435b00 };
1960 HRESULT hRet = E_INVALIDARG;
1961 LPUNKNOWN lpUnkInner = NULL; /* FIXME: Real type is unknown */
1962
1963 TRACE("(%p,%p,%p,%p,%p)\n", lpUnknown, lpArg1, lpArg2, lpArg3, lpArg4);
1964
1965 if (lpUnknown && lpArg4)
1966 {
1967 hRet = IUnknown_QueryService(lpUnknown, (REFGUID)service_id,
1968 (REFGUID)function_id, (void**)&lpUnkInner);
1969
1970 if (SUCCEEDED(hRet) && lpUnkInner)
1971 {
1972 /* FIXME: The type of service object requested is unknown, however
1973 * testing shows that its first method is called with 4 parameters.
1974 * Fake this by using IParseDisplayName_ParseDisplayName since the
1975 * signature and position in the vtable matches our unknown object type.
1976 */
1977 hRet = IParseDisplayName_ParseDisplayName((LPPARSEDISPLAYNAME)lpUnkInner,
1978 lpArg1, lpArg2, lpArg3, lpArg4);
1979 IUnknown_Release(lpUnkInner);
1980 }
1981 }
1982 return hRet;
1983}
1984
1985/*************************************************************************
1986 * @ [SHLWAPI.192]
1987 *
1988 * Get a sub-menu from a menu item.
1989 *
1990 * PARAMS
1991 * hMenu [I] Menu to get sub-menu from
1992 * uID [I] ID of menu item containing sub-menu
1993 *
1994 * RETURNS
1995 * The sub-menu of the item, or a NULL handle if any parameters are invalid.
1996 */
1998{
2000
2001 TRACE("(%p,%u)\n", hMenu, uID);
2002
2003 mi.cbSize = sizeof(mi);
2004 mi.fMask = MIIM_SUBMENU;
2005
2006 if (!GetMenuItemInfoW(hMenu, uID, FALSE, &mi))
2007 return NULL;
2008
2009 return mi.hSubMenu;
2010}
2011
2012/*************************************************************************
2013 * @ [SHLWAPI.193]
2014 *
2015 * Get the color depth of the primary display.
2016 *
2017 * PARAMS
2018 * None.
2019 *
2020 * RETURNS
2021 * The color depth of the primary display.
2022 */
2024{
2025 HDC hdc;
2026 DWORD ret;
2027
2028 TRACE("()\n");
2029
2030 hdc = GetDC(0);
2032 ReleaseDC(0, hdc);
2033 return ret;
2034}
2035
2036/*************************************************************************
2037 * @ [SHLWAPI.194]
2038 *
2039 * Wait for a message to arrive, with a timeout.
2040 *
2041 * PARAMS
2042 * hand [I] Handle to query
2043 * dwTimeout [I] Timeout in ticks or INFINITE to never timeout
2044 *
2045 * RETURNS
2046 * STATUS_TIMEOUT if no message is received before dwTimeout ticks passes.
2047 * Otherwise returns the value from MsgWaitForMultipleObjectsEx when a
2048 * message is available.
2049 */
2051{
2052 DWORD dwEndTicks = GetTickCount() + dwTimeout;
2053 DWORD dwRet;
2054
2055 while ((dwRet = MsgWaitForMultipleObjectsEx(1, &hand, dwTimeout, QS_SENDMESSAGE, 0)) == 1)
2056 {
2057 MSG msg;
2058
2059 PeekMessageW(&msg, NULL, 0, 0, PM_NOREMOVE);
2060
2061 if (dwTimeout != INFINITE)
2062 {
2063 if ((int)(dwTimeout = dwEndTicks - GetTickCount()) <= 0)
2064 return WAIT_TIMEOUT;
2065 }
2066 }
2067
2068 return dwRet;
2069}
2070
2071/*************************************************************************
2072 * @ [SHLWAPI.195]
2073 *
2074 * Determine if a shell folder can be expanded.
2075 *
2076 * PARAMS
2077 * lpFolder [I] Parent folder containing the object to test.
2078 * pidl [I] Id of the object to test.
2079 *
2080 * RETURNS
2081 * Success: S_OK, if the object is expandable, S_FALSE otherwise.
2082 * Failure: E_INVALIDARG, if any argument is invalid.
2083 *
2084 * NOTES
2085 * If the object to be tested does not expose the IQueryInfo() interface it
2086 * will not be identified as an expandable folder.
2087 */
2089{
2090 HRESULT hRet = E_INVALIDARG;
2091 IQueryInfo *lpInfo;
2092
2093 if (lpFolder && pidl)
2094 {
2095 hRet = IShellFolder_GetUIObjectOf(lpFolder, NULL, 1, &pidl, &IID_IQueryInfo,
2096 NULL, (void**)&lpInfo);
2097 if (FAILED(hRet))
2098 hRet = S_FALSE; /* Doesn't expose IQueryInfo */
2099 else
2100 {
2101 DWORD dwFlags = 0;
2102
2103 /* MSDN states of IQueryInfo_GetInfoFlags() that "This method is not
2104 * currently used". Really? You wouldn't be holding out on me would you?
2105 */
2106 hRet = IQueryInfo_GetInfoFlags(lpInfo, &dwFlags);
2107
2108 if (SUCCEEDED(hRet))
2109 {
2110 /* 0x2 is an undocumented flag apparently indicating expandability */
2111 hRet = dwFlags & 0x2 ? S_OK : S_FALSE;
2112 }
2113
2114 IQueryInfo_Release(lpInfo);
2115 }
2116 }
2117 return hRet;
2118}
2119
2120/*************************************************************************
2121 * @ [SHLWAPI.197]
2122 *
2123 * Blank out a region of text by drawing the background only.
2124 *
2125 * PARAMS
2126 * hDC [I] Device context to draw in
2127 * pRect [I] Area to draw in
2128 * cRef [I] Color to draw in
2129 *
2130 * RETURNS
2131 * Nothing.
2132 */
2134{
2135 COLORREF cOldColor = SetBkColor(hDC, cRef);
2136 ExtTextOutA(hDC, 0, 0, ETO_OPAQUE, pRect, 0, 0, 0);
2137 SetBkColor(hDC, cOldColor);
2138 return 0;
2139}
2140
2141/*************************************************************************
2142 * @ [SHLWAPI.198]
2143 *
2144 * Return the value associated with a key in a map.
2145 *
2146 * PARAMS
2147 * lpKeys [I] A list of keys of length iLen
2148 * lpValues [I] A list of values associated with lpKeys, of length iLen
2149 * iLen [I] Length of both lpKeys and lpValues
2150 * iKey [I] The key value to look up in lpKeys
2151 *
2152 * RETURNS
2153 * The value in lpValues associated with iKey, or -1 if iKey is not
2154 * found in lpKeys.
2155 *
2156 * NOTES
2157 * - If two elements in the map share the same key, this function returns
2158 * the value closest to the start of the map
2159 * - The native version of this function crashes if lpKeys or lpValues is NULL.
2160 */
2161int WINAPI SHSearchMapInt(const int *lpKeys, const int *lpValues, int iLen, int iKey)
2162{
2163 if (lpKeys && lpValues)
2164 {
2165 int i = 0;
2166
2167 while (i < iLen)
2168 {
2169 if (lpKeys[i] == iKey)
2170 return lpValues[i]; /* Found */
2171 i++;
2172 }
2173 }
2174 return -1; /* Not found */
2175}
2176
2177
2178/*************************************************************************
2179 * @ [SHLWAPI.199]
2180 *
2181 * Copy an interface pointer
2182 *
2183 * PARAMS
2184 * lppDest [O] Destination for copy
2185 * lpUnknown [I] Source for copy
2186 *
2187 * RETURNS
2188 * Nothing.
2189 */
2191{
2192 TRACE("(%p,%p)\n", lppDest, lpUnknown);
2193
2194 IUnknown_AtomicRelease(lppDest);
2195
2196 if (lpUnknown)
2197 {
2198 IUnknown_AddRef(lpUnknown);
2199 *lppDest = lpUnknown;
2200 }
2201}
2202
2203/*************************************************************************
2204 * @ [SHLWAPI.200]
2205 *
2206 */
2207#ifdef __REACTOS__
2210 _In_ IUnknown *lpUnknown,
2211 _In_ INT nUnknown,
2212 _In_opt_ REFGUID riidCmdGrp,
2213 _In_ ULONG cCmds,
2214 _Inout_ OLECMD *prgCmds,
2215 _Inout_ OLECMDTEXT *pCmdText)
2216{
2217 TRACE("(%p, %d, %s, %d, %p, %p)\n",
2218 lpUnknown, nUnknown, wine_dbgstr_guid(riidCmdGrp), cCmds, prgCmds, pCmdText);
2219
2220 HRESULT hr = IsQSForward(riidCmdGrp, cCmds, prgCmds);
2221 if (FAILED(hr) || !HRESULT_CODE(hr) || nUnknown <= 0)
2222 return OLECMDERR_E_NOTSUPPORTED;
2223
2224 return IUnknown_QueryStatus(lpUnknown, riidCmdGrp, cCmds, prgCmds, pCmdText);
2225}
2226#else
2228 REFGUID riidCmdGrp, ULONG cCmds,
2229 OLECMD *prgCmds, OLECMDTEXT* pCmdText)
2230{
2231 FIXME("(%p,%p,%p,%d,%p,%p) - stub\n",
2232 lpUnknown, lpReserved, riidCmdGrp, cCmds, prgCmds, pCmdText);
2233
2234 /* FIXME: Calls IsQSForward & IUnknown_QueryStatus */
2236}
2237#endif
2238
2239/*************************************************************************
2240 * @ [SHLWAPI.201]
2241 *
2242 */
2243#ifdef __REACTOS__
2246 _In_ IUnknown *lpUnknown,
2247 _In_ INT nUnknown,
2248 _In_opt_ REFGUID pguidCmdGroup,
2249 _In_ DWORD nCmdID,
2250 _In_ DWORD nCmdexecopt,
2251 _In_ VARIANT *pvaIn,
2252 _Inout_ VARIANT *pvaOut)
2253{
2254 TRACE("(%p, %d, %s, %d, %d, %p, %p)\n", lpUnknown, nUnknown,
2255 wine_dbgstr_guid(pguidCmdGroup), nCmdID, nCmdexecopt, pvaIn, pvaOut);
2256
2257 OLECMD cmd = { nCmdID };
2258 HRESULT hr = IsQSForward(pguidCmdGroup, 1, &cmd);
2259 if (FAILED(hr) || !HRESULT_CODE(hr) || nUnknown <= 0)
2260 return OLECMDERR_E_NOTSUPPORTED;
2261
2262 return IUnknown_Exec(lpUnknown, pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
2263}
2264#else
2265HRESULT WINAPI MayExecForward(IUnknown* lpUnknown, INT nUnknown, REFGUID pguidCmdGroup,
2266 DWORD nCmdID, DWORD nCmdexecopt, VARIANT* pvaIn,
2267 VARIANT* pvaOut)
2268{
2269 FIXME("(%p,%d,%p,%d,%d,%p,%p) - stub!\n", lpUnknown, nUnknown, pguidCmdGroup,
2270 nCmdID, nCmdexecopt, pvaIn, pvaOut);
2272}
2273#endif
2274
2275/*************************************************************************
2276 * @ [SHLWAPI.202]
2277 *
2278 */
2279#ifdef __REACTOS__
2281IsQSForward(_In_opt_ REFGUID pguidCmdGroup, _In_ ULONG cCmds, _In_ OLECMD *prgCmds)
2282{
2283 DWORD cmdFlags = 0;
2284 OLECMDID cmdID;
2285 ULONG iCmd;
2286 enum {
2287 CMD_FLAG_SUPPORTED_BASIC = 0x1,
2288 CMD_FLAG_SUPPORTED_ADVANCED = 0x2,
2289 CMD_FLAG_NOT_SUPPORTED = 0x4,
2290 };
2291
2292 TRACE("(%s, %lu, %p)\n", wine_dbgstr_guid(pguidCmdGroup), cCmds, prgCmds);
2293
2294 if ((LONG)cCmds <= 0)
2295 return OLECMDERR_E_NOTSUPPORTED;
2296
2297 if (!pguidCmdGroup)
2298 {
2299 for (iCmd = 0; iCmd < cCmds; ++iCmd)
2300 {
2301 cmdID = prgCmds[iCmd].cmdID;
2302 if (cmdID <= OLECMDID_PROPERTIES)
2303 {
2304 cmdFlags |= CMD_FLAG_NOT_SUPPORTED; // Not supported
2305 continue;
2306 }
2307
2308 if (cmdID <= OLECMDID_PASTE || cmdID == OLECMDID_SELECTALL)
2309 {
2310 cmdFlags |= CMD_FLAG_SUPPORTED_BASIC;
2311 continue;
2312 }
2313
2314 if (cmdID <= OLECMDID_UPDATECOMMANDS ||
2315 (OLECMDID_HIDETOOLBARS <= cmdID && cmdID != OLECMDID_ENABLE_INTERACTION))
2316 {
2317 cmdFlags |= CMD_FLAG_NOT_SUPPORTED; // Not supported
2318 continue;
2319 }
2320
2321 cmdFlags |= CMD_FLAG_SUPPORTED_ADVANCED;
2322 }
2323 }
2324 else
2325 {
2326 if (!IsEqualGUID(&CGID_Explorer, pguidCmdGroup))
2327 {
2328#if (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
2329 return OLECMDERR_E_UNKNOWNGROUP;
2330#else
2331 return OLECMDERR_E_NOTSUPPORTED;
2332#endif
2333 }
2334
2335 for (iCmd = 0; iCmd < cCmds; ++iCmd)
2336 {
2337 cmdID = prgCmds[iCmd].cmdID;
2338 if (cmdID == OLECMDID_SELECTALL ||
2339 (OLECMDID_SHOWFIND <= cmdID && cmdID <= OLECMDID_SHOWPRINT))
2340 {
2341 cmdFlags |= CMD_FLAG_SUPPORTED_BASIC;
2342 break;
2343 }
2344 }
2345 }
2346
2347 if (!cmdFlags || (cmdFlags & CMD_FLAG_NOT_SUPPORTED))
2348 return OLECMDERR_E_NOTSUPPORTED; // Not supported
2349
2350 return MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, cmdFlags);
2351}
2352#else
2353HRESULT WINAPI IsQSForward(REFGUID pguidCmdGroup,ULONG cCmds, OLECMD *prgCmds)
2354{
2355 FIXME("(%p,%d,%p) - stub!\n", pguidCmdGroup, cCmds, prgCmds);
2357}
2358#endif
2359
2360/*************************************************************************
2361 * @ [SHLWAPI.204]
2362 *
2363 * Determine if a window is not a child of another window.
2364 *
2365 * PARAMS
2366 * hParent [I] Suspected parent window
2367 * hChild [I] Suspected child window
2368 *
2369 * RETURNS
2370 * TRUE: If hChild is a child window of hParent
2371 * FALSE: If hChild is not a child window of hParent, or they are equal
2372 */
2374{
2375 TRACE("(%p,%p)\n", hParent, hChild);
2376
2377 if (!hParent || !hChild)
2378 return TRUE;
2379 else if(hParent == hChild)
2380 return FALSE;
2381 return !IsChild(hParent, hChild);
2382}
2383
2384/*************************************************************************
2385 * FDSA functions. Manage a dynamic array of fixed size memory blocks.
2386 */
2387
2388typedef struct
2389{
2390 DWORD num_items; /* Number of elements inserted */
2391 void *mem; /* Ptr to array */
2392 DWORD blocks_alloced; /* Number of elements allocated */
2393 BYTE inc; /* Number of elements to grow by when we need to expand */
2394 BYTE block_size; /* Size in bytes of an element */
2395 BYTE flags; /* Flags */
2396} FDSA_info;
2397
2398#define FDSA_FLAG_INTERNAL_ALLOC 0x01 /* When set we have allocated mem internally */
2399
2400/*************************************************************************
2401 * @ [SHLWAPI.208]
2402 *
2403 * Initialize an FDSA array.
2404 */
2406 DWORD init_blocks)
2407{
2408 TRACE("(0x%08x 0x%08x %p %p 0x%08x)\n", block_size, inc, info, mem, init_blocks);
2409
2410 if(inc == 0)
2411 inc = 1;
2412
2413 if(mem)
2414 memset(mem, 0, block_size * init_blocks);
2415
2416 info->num_items = 0;
2417 info->inc = inc;
2418 info->mem = mem;
2419 info->blocks_alloced = init_blocks;
2420 info->block_size = block_size;
2421 info->flags = 0;
2422
2423 return TRUE;
2424}
2425
2426/*************************************************************************
2427 * @ [SHLWAPI.209]
2428 *
2429 * Destroy an FDSA array
2430 */
2432{
2433 TRACE("(%p)\n", info);
2434
2435 if(info->flags & FDSA_FLAG_INTERNAL_ALLOC)
2436 {
2437 HeapFree(GetProcessHeap(), 0, info->mem);
2438 return FALSE;
2439 }
2440
2441 return TRUE;
2442}
2443
2444/*************************************************************************
2445 * @ [SHLWAPI.210]
2446 *
2447 * Insert element into an FDSA array
2448 */
2450{
2451 TRACE("(%p 0x%08x %p)\n", info, where, block);
2452 if(where > info->num_items)
2453 where = info->num_items;
2454
2455 if(info->num_items >= info->blocks_alloced)
2456 {
2457 DWORD size = (info->blocks_alloced + info->inc) * info->block_size;
2458 if(info->flags & 0x1)
2460 else
2461 {
2462 void *old_mem = info->mem;
2464 memcpy(info->mem, old_mem, info->blocks_alloced * info->block_size);
2465 }
2466 info->blocks_alloced += info->inc;
2467 info->flags |= 0x1;
2468 }
2469
2470 if(where < info->num_items)
2471 {
2472 memmove((char*)info->mem + (where + 1) * info->block_size,
2473 (char*)info->mem + where * info->block_size,
2474 (info->num_items - where) * info->block_size);
2475 }
2476 memcpy((char*)info->mem + where * info->block_size, block, info->block_size);
2477
2478 info->num_items++;
2479 return where;
2480}
2481
2482/*************************************************************************
2483 * @ [SHLWAPI.211]
2484 *
2485 * Delete an element from an FDSA array.
2486 */
2488{
2489 TRACE("(%p 0x%08x)\n", info, where);
2490
2491 if(where >= info->num_items)
2492 return FALSE;
2493
2494 if(where < info->num_items - 1)
2495 {
2496 memmove((char*)info->mem + where * info->block_size,
2497 (char*)info->mem + (where + 1) * info->block_size,
2498 (info->num_items - where - 1) * info->block_size);
2499 }
2500 memset((char*)info->mem + (info->num_items - 1) * info->block_size,
2501 0, info->block_size);
2502 info->num_items--;
2503 return TRUE;
2504}
2505
2506/*************************************************************************
2507 * @ [SHLWAPI.219]
2508 *
2509 * Call IUnknown_QueryInterface() on a table of objects.
2510 *
2511 * RETURNS
2512 * Success: S_OK.
2513 * Failure: E_POINTER or E_NOINTERFACE.
2514 */
2516 void *base, /* [in] Table of interfaces */
2517 const QITAB *table, /* [in] Array of REFIIDs and indexes into the table */
2518 REFIID riid, /* [in] REFIID to get interface for */
2519 void **ppv) /* [out] Destination for interface pointer */
2520{
2521 HRESULT ret;
2522 IUnknown *a_vtbl;
2523 const QITAB *xmove;
2524
2525 TRACE("(%p %p %s %p)\n", base, table, debugstr_guid(riid), ppv);
2526 if (ppv) {
2527 xmove = table;
2528 while (xmove->piid) {
2529 TRACE("trying (offset %d) %s\n", xmove->dwOffset, debugstr_guid(xmove->piid));
2530 if (IsEqualIID(riid, xmove->piid)) {
2531 a_vtbl = (IUnknown*)(xmove->dwOffset + (LPBYTE)base);
2532 TRACE("matched, returning (%p)\n", a_vtbl);
2533 *ppv = a_vtbl;
2534 IUnknown_AddRef(a_vtbl);
2535 return S_OK;
2536 }
2537 xmove++;
2538 }
2539
2540 if (IsEqualIID(riid, &IID_IUnknown)) {
2541 a_vtbl = (IUnknown*)(table->dwOffset + (LPBYTE)base);
2542 TRACE("returning first for IUnknown (%p)\n", a_vtbl);
2543 *ppv = a_vtbl;
2544 IUnknown_AddRef(a_vtbl);
2545 return S_OK;
2546 }
2547 *ppv = 0;
2549 } else
2550 ret = E_POINTER;
2551
2552 TRACE("-- 0x%08x\n", ret);
2553 return ret;
2554}
2555
2556/*************************************************************************
2557 * @ [SHLWAPI.220]
2558 *
2559 * Set the Font for a window and the "PropDlgFont" property of the parent window.
2560 *
2561 * PARAMS
2562 * hWnd [I] Parent Window to set the property
2563 * id [I] Index of child Window to set the Font
2564 *
2565 * RETURNS
2566#ifdef __REACTOS__
2567 * VOID
2568#else
2569 * Success: S_OK
2570#endif
2571 *
2572 */
2573#ifdef __REACTOS__
2575#else
2577#endif
2578{
2579#ifdef __REACTOS__
2580 HFONT hOldFont, hNewFont;
2581 LOGFONTW lfOldFont, lfNewFont;
2582 HWND hwndItem;
2583
2584 TRACE("(%p, %d)\n", hWnd, id);
2585
2586 hOldFont = (HFONT)SendMessageW(hWnd, WM_GETFONT, 0, 0);
2587 GetObjectW(hOldFont, sizeof(lfOldFont), &lfOldFont);
2588 SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(lfNewFont), &lfNewFont, 0);
2589
2590 if (lfOldFont.lfCharSet == lfNewFont.lfCharSet)
2591 return;
2592
2593 hNewFont = GetPropW(hWnd, L"PropDlgFont");
2594 if (!hNewFont)
2595 {
2596 /* Create the icon-title font of the same height */
2597 lfNewFont.lfHeight = lfOldFont.lfHeight;
2598 hNewFont = CreateFontIndirectW(&lfNewFont);
2599
2600 /* If creating the font is failed, then keep the old font */
2601 if (!hNewFont)
2602 hNewFont = hOldFont;
2603
2604 /* Set "PropDlgFont" property if the font is changed */
2605 if (hOldFont != hNewFont)
2606 SetPropW(hWnd, L"PropDlgFont", hNewFont);
2607 }
2608
2609 hwndItem = GetDlgItem(hWnd, id);
2610 SendMessageW(hwndItem, WM_SETFONT, (WPARAM)hNewFont, 0);
2611#else
2612 FIXME("(%p, %d) stub\n", hWnd, id);
2613 return S_OK;
2614#endif
2615}
2616
2617/*************************************************************************
2618 * @ [SHLWAPI.221]
2619 *
2620 * Remove the "PropDlgFont" property from a window.
2621 *
2622 * PARAMS
2623 * hWnd [I] Window to remove the property from
2624 *
2625 * RETURNS
2626 * A handle to the removed property, or NULL if it did not exist.
2627 */
2629{
2630 HANDLE hProp;
2631
2632 TRACE("(%p)\n", hWnd);
2633
2634 hProp = GetPropA(hWnd, "PropDlgFont");
2635
2636 if(hProp)
2637 {
2638 DeleteObject(hProp);
2639 hProp = RemovePropA(hWnd, "PropDlgFont");
2640 }
2641 return hProp;
2642}
2643
2644/*************************************************************************
2645 * @ [SHLWAPI.236]
2646 *
2647 * Load the in-process server of a given GUID.
2648 *
2649 * PARAMS
2650 * refiid [I] GUID of the server to load.
2651 *
2652 * RETURNS
2653 * Success: A handle to the loaded server dll.
2654 * Failure: A NULL handle.
2655 */
2657{
2658 HKEY newkey;
2659 DWORD type, count;
2660 CHAR value[MAX_PATH], string[MAX_PATH];
2661
2662 strcpy(string, "CLSID\\");
2663 SHStringFromGUIDA(refiid, string + 6, sizeof(string)/sizeof(char) - 6);
2664 strcat(string, "\\InProcServer32");
2665
2666 count = MAX_PATH;
2667 RegOpenKeyExA(HKEY_CLASSES_ROOT, string, 0, 1, &newkey);
2668 RegQueryValueExA(newkey, 0, 0, &type, (PBYTE)value, &count);
2669 RegCloseKey(newkey);
2670 return LoadLibraryExA(value, 0, 0);
2671}
2672
2673/*************************************************************************
2674 * @ [SHLWAPI.237]
2675 *
2676 * Unicode version of SHLWAPI_183.
2677 */
2679{
2681
2682 TRACE("(%p %s)\n",lpWndClass->hInstance, debugstr_w(lpWndClass->lpszClassName));
2683
2684 if (GetClassInfoW(lpWndClass->hInstance, lpWndClass->lpszClassName, &WndClass))
2685 return TRUE;
2686 return RegisterClassW(lpWndClass);
2687}
2688
2689/*************************************************************************
2690 * @ [SHLWAPI.238]
2691 *
2692 * Unregister a list of classes.
2693 *
2694 * PARAMS
2695 * hInst [I] Application instance that registered the classes
2696 * lppClasses [I] List of class names
2697 * iCount [I] Number of names in lppClasses
2698 *
2699 * RETURNS
2700 * Nothing.
2701 */
2703{
2705
2706 TRACE("(%p,%p,%d)\n", hInst, lppClasses, iCount);
2707
2708 while (iCount > 0)
2709 {
2710 if (GetClassInfoA(hInst, *lppClasses, &WndClass))
2711 UnregisterClassA(*lppClasses, hInst);
2712 lppClasses++;
2713 iCount--;
2714 }
2715}
2716
2717/*************************************************************************
2718 * @ [SHLWAPI.239]
2719 *
2720 * Unicode version of SHUnregisterClassesA.
2721 */
2723{
2725
2726 TRACE("(%p,%p,%d)\n", hInst, lppClasses, iCount);
2727
2728 while (iCount > 0)
2729 {
2730 if (GetClassInfoW(hInst, *lppClasses, &WndClass))
2731 UnregisterClassW(*lppClasses, hInst);
2732 lppClasses++;
2733 iCount--;
2734 }
2735}
2736
2737/*************************************************************************
2738 * @ [SHLWAPI.240]
2739 *
2740 * Call The correct (Ascii/Unicode) default window procedure for a window.
2741 *
2742 * PARAMS
2743 * hWnd [I] Window to call the default procedure for
2744 * uMessage [I] Message ID
2745 * wParam [I] WPARAM of message
2746 * lParam [I] LPARAM of message
2747 *
2748 * RETURNS
2749 * The result of calling DefWindowProcA() or DefWindowProcW().
2750 */
2752{
2753 if (IsWindowUnicode(hWnd))
2754 return DefWindowProcW(hWnd, uMessage, wParam, lParam);
2755 return DefWindowProcA(hWnd, uMessage, wParam, lParam);
2756}
2757
2758/*************************************************************************
2759 * @ [SHLWAPI.256]
2760 */
2762{
2763 HRESULT hRet = E_INVALIDARG;
2764 LPOBJECTWITHSITE lpSite = NULL;
2765
2766 TRACE("(%p,%s,%p)\n", lpUnknown, debugstr_guid(iid), lppSite);
2767
2768 if (lpUnknown && iid && lppSite)
2769 {
2770 hRet = IUnknown_QueryInterface(lpUnknown, &IID_IObjectWithSite,
2771 (void**)&lpSite);
2772 if (SUCCEEDED(hRet) && lpSite)
2773 {
2774 hRet = IObjectWithSite_GetSite(lpSite, iid, lppSite);
2775 IObjectWithSite_Release(lpSite);
2776 }
2777 }
2778 return hRet;
2779}
2780
2781/*************************************************************************
2782 * @ [SHLWAPI.257]
2783 *
2784 * Create a worker window using CreateWindowExA().
2785 *
2786 * PARAMS
2787 * wndProc [I] Window procedure
2788 * hWndParent [I] Parent window
2789 * dwExStyle [I] Extra style flags
2790 * dwStyle [I] Style flags
2791 * hMenu [I] Window menu
2792 * wnd_extra [I] Window extra bytes value
2793 *
2794 * RETURNS
2795 * Success: The window handle of the newly created window.
2796 * Failure: 0.
2797 */
2799 DWORD dwStyle, HMENU hMenu, LONG_PTR wnd_extra)
2800{
2801 static const char szClass[] = "WorkerA";
2802 WNDCLASSA wc;
2803 HWND hWnd;
2804
2805 TRACE("(%p, %p, 0x%08x, 0x%08x, %p, 0x%08lx)\n",
2806 wndProc, hWndParent, dwExStyle, dwStyle, hMenu, wnd_extra);
2807
2808 /* Create Window class */
2809 wc.style = 0;
2811 wc.cbClsExtra = 0;
2812 wc.cbWndExtra = sizeof(LONG_PTR);
2814 wc.hIcon = NULL;
2816 wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
2817 wc.lpszMenuName = NULL;
2818 wc.lpszClassName = szClass;
2819
2820 SHRegisterClassA(&wc);
2821
2822 hWnd = CreateWindowExA(dwExStyle, szClass, 0, dwStyle, 0, 0, 0, 0,
2823 hWndParent, hMenu, shlwapi_hInstance, 0);
2824 if (hWnd)
2825 {
2826 SetWindowLongPtrW(hWnd, 0, wnd_extra);
2828 }
2829
2830 return hWnd;
2831}
2832
2833#ifndef __REACTOS__ /* The followings are defined in <shlwapi_undoc.h> */
2834typedef struct tagPOLICYDATA
2835{
2836 DWORD policy; /* flags value passed to SHRestricted */
2837 LPCWSTR appstr; /* application str such as "Explorer" */
2838 LPCWSTR keystr; /* name of the actual registry key / policy */
2840
2841#define SHELL_NO_POLICY 0xffffffff
2842
2843/* default shell policy registry key */
2844static const WCHAR strRegistryPolicyW[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o',
2845 's','o','f','t','\\','W','i','n','d','o','w','s','\\',
2846 'C','u','r','r','e','n','t','V','e','r','s','i','o','n',
2847 '\\','P','o','l','i','c','i','e','s',0};
2848#endif /* ndef __REACTOS__ */
2849
2850/*************************************************************************
2851 * @ [SHLWAPI.271]
2852 *
2853 * Retrieve a policy value from the registry.
2854 *
2855 * PARAMS
2856 * lpSubKey [I] registry key name
2857 * lpSubName [I] subname of registry key
2858 * lpValue [I] value name of registry value
2859 *
2860 * RETURNS
2861 * the value associated with the registry key or 0 if not found
2862 */
2864{
2865#ifdef __REACTOS__
2867 DWORD dwSize, dwValue = 0;
2868
2869 TRACE("(%s, %s, %s)\n", debugstr_w(lpSubKey), debugstr_w(lpSubName), debugstr_w(lpValue));
2870
2871 if (!lpSubKey)
2872 lpSubKey = L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies";
2873
2874 PathCombineW(szPath, lpSubKey, lpSubName);
2875
2876 dwSize = sizeof(dwValue);
2877 if (SHGetValueW(HKEY_LOCAL_MACHINE, szPath, lpValue, NULL, &dwValue, &dwSize) == ERROR_SUCCESS)
2878 return dwValue;
2879
2880 dwSize = sizeof(dwValue);
2881 SHGetValueW(HKEY_CURRENT_USER, szPath, lpValue, NULL, &dwValue, &dwSize);
2882 return dwValue;
2883#else
2884 DWORD retval, datsize = sizeof(retval);
2885 HKEY hKey;
2886
2887 if (!lpSubKey)
2888 lpSubKey = strRegistryPolicyW;
2889
2891 if (retval != ERROR_SUCCESS)
2893 if (retval != ERROR_SUCCESS)
2894 return 0;
2895
2896 SHGetValueW(hKey, lpSubName, lpValue, NULL, &retval, &datsize);
2898 return retval;
2899#endif
2900}
2901
2902/*************************************************************************
2903 * @ [SHLWAPI.266]
2904 *
2905 * Helper function to retrieve the possibly cached value for a specific policy
2906 *
2907 * PARAMS
2908 * policy [I] The policy to look for
2909 * initial [I] Main registry key to open, if NULL use default
2910 * polTable [I] Table of known policies, 0 terminated
2911 * polArr [I] Cache array of policy values
2912 *
2913 * RETURNS
2914 * The retrieved policy value or 0 if not successful
2915 *
2916 * NOTES
2917 * This function is used by the native SHRestricted function to search for the
2918 * policy and cache it once retrieved. The current Wine implementation uses a
2919 * different POLICYDATA structure and implements a similar algorithm adapted to
2920 * that structure.
2921 */
2922#ifdef __REACTOS__
2926 _In_ LPCWSTR initial,
2927 _In_ const POLICYDATA *polTable,
2928 _Inout_ LPDWORD polArr)
2929#else
2931 DWORD policy,
2932 LPCWSTR initial,
2933 LPPOLICYDATA polTable,
2934 LPDWORD polArr)
2935#endif
2936{
2937 TRACE("(0x%08x %s %p %p)\n", policy, debugstr_w(initial), polTable, polArr);
2938
2939#ifndef __REACTOS__
2940 if (!polTable || !polArr)
2941 return 0;
2942#endif
2943
2944#ifndef __REACTOS__
2945 for (;polTable->appstr; polTable++, polArr++)
2946#else
2947 for (;polTable->policy; polTable++, polArr++)
2948#endif
2949 {
2950 if (policy == polTable->policy)
2951 {
2952 /* we have a known policy */
2953
2954 /* check if this policy has been cached */
2955 if (*polArr == SHELL_NO_POLICY)
2956 *polArr = SHGetRestriction(initial, polTable->appstr, polTable->keystr);
2957 return *polArr;
2958 }
2959 }
2960 /* we don't know this policy, return 0 */
2961 TRACE("unknown policy: (%08x)\n", policy);
2962 return 0;
2963}
2964
2965/*************************************************************************
2966 * @ [SHLWAPI.267]
2967 *
2968 * Get an interface from an object.
2969 *
2970 * RETURNS
2971 * Success: S_OK. ppv contains the requested interface.
2972 * Failure: An HRESULT error code.
2973 *
2974 * NOTES
2975 * This QueryInterface asks the inner object for an interface. In case
2976 * of aggregation this request would be forwarded by the inner to the
2977 * outer object. This function asks the inner object directly for the
2978 * interface circumventing the forwarding to the outer object.
2979 */
2981 IUnknown * pUnk, /* [in] Outer object */
2982 IUnknown * pInner, /* [in] Inner object */
2983 IID * riid, /* [in] Interface GUID to query for */
2984 LPVOID* ppv) /* [out] Destination for queried interface */
2985{
2986 HRESULT hret = E_NOINTERFACE;
2987 TRACE("(pUnk=%p pInner=%p\n\tIID: %s %p)\n",pUnk,pInner,debugstr_guid(riid), ppv);
2988
2989 *ppv = NULL;
2990 if(pUnk && pInner) {
2991 hret = IUnknown_QueryInterface(pInner, riid, ppv);
2992 if (SUCCEEDED(hret)) IUnknown_Release(pUnk);
2993 }
2994 TRACE("-- 0x%08x\n", hret);
2995 return hret;
2996}
2997
2998/*************************************************************************
2999 * @ [SHLWAPI.268]
3000 *
3001 * Move a reference from one interface to another.
3002 *
3003 * PARAMS
3004 * lpDest [O] Destination to receive the reference
3005 * lppUnknown [O] Source to give up the reference to lpDest
3006 *
3007 * RETURNS
3008 * Nothing.
3009 */
3011{
3012 TRACE("(%p,%p)\n", lpDest, lppUnknown);
3013
3014 if (*lppUnknown)
3015 {
3016 /* Copy Reference*/
3017 IUnknown_AddRef(lpDest);
3018 IUnknown_AtomicRelease(lppUnknown); /* Release existing interface */
3019 }
3020}
3021
3022/*************************************************************************
3023 * @ [SHLWAPI.269]
3024 *
3025 * Convert an ASCII string of a CLSID into a CLSID.
3026 *
3027 * PARAMS
3028 * idstr [I] String representing a CLSID in registry format
3029 * id [O] Destination for the converted CLSID
3030 *
3031 * RETURNS
3032 * Success: TRUE. id contains the converted CLSID.
3033 * Failure: FALSE.
3034 */
3036{
3037 WCHAR wClsid[40];
3038 MultiByteToWideChar(CP_ACP, 0, idstr, -1, wClsid, sizeof(wClsid)/sizeof(WCHAR));
3039 return SUCCEEDED(CLSIDFromString(wClsid, id));
3040}
3041
3042/*************************************************************************
3043 * @ [SHLWAPI.270]
3044 *
3045 * Unicode version of GUIDFromStringA.
3046 */
3048{
3049 return SUCCEEDED(CLSIDFromString((LPCOLESTR)idstr, id));
3050}
3051
3052/*************************************************************************
3053 * @ [SHLWAPI.276]
3054 *
3055 * Determine if the browser is integrated into the shell, and set a registry
3056 * key accordingly.
3057 *
3058 * PARAMS
3059 * None.
3060 *
3061 * RETURNS
3062 * 1, If the browser is not integrated.
3063 * 2, If the browser is integrated.
3064 *
3065 * NOTES
3066 * The key "HKLM\Software\Microsoft\Internet Explorer\IntegratedBrowser" is
3067 * either set to TRUE, or removed depending on whether the browser is deemed
3068 * to be integrated.
3069 */
3070#ifdef __REACTOS__
3072#else
3074#endif
3075{
3076 static const char szIntegratedBrowser[] = "IntegratedBrowser";
3077 static DWORD dwState = 0;
3078 HKEY hKey;
3079 DWORD dwRet, dwData, dwSize;
3080 HMODULE hshell32;
3081
3082 if (dwState)
3083 return dwState;
3084
3085 /* If shell32 exports DllGetVersion(), the browser is integrated */
3086 dwState = 1;
3087 hshell32 = LoadLibraryA("shell32.dll");
3088 if (hshell32)
3089 {
3090 FARPROC pDllGetVersion;
3091 pDllGetVersion = GetProcAddress(hshell32, "DllGetVersion");
3092 dwState = pDllGetVersion ? 2 : 1;
3093 FreeLibrary(hshell32);
3094 }
3095
3096 /* Set or delete the key accordingly */
3098 "Software\\Microsoft\\Internet Explorer", 0,
3100 if (!dwRet)
3101 {
3102 dwRet = RegQueryValueExA(hKey, szIntegratedBrowser, 0, 0,
3103 (LPBYTE)&dwData, &dwSize);
3104
3105 if (!dwRet && dwState == 1)
3106 {
3107 /* Value exists but browser is not integrated */
3108 RegDeleteValueA(hKey, szIntegratedBrowser);
3109 }
3110 else if (dwRet && dwState == 2)
3111 {
3112 /* Browser is integrated but value does not exist */
3113 dwData = TRUE;
3114 RegSetValueExA(hKey, szIntegratedBrowser, 0, REG_DWORD,
3115 (LPBYTE)&dwData, sizeof(dwData));
3116 }
3118 }
3119 return dwState;
3120}
3121
3122/*************************************************************************
3123 * @ [SHLWAPI.278]
3124 *
3125 * Unicode version of SHCreateWorkerWindowA.
3126 */
3128 DWORD dwStyle, HMENU hMenu, LONG_PTR wnd_extra)
3129{
3130 static const WCHAR szClass[] = { 'W', 'o', 'r', 'k', 'e', 'r', 'W', 0 };
3131 WNDCLASSW wc;
3132 HWND hWnd;
3133
3134 TRACE("(%p, %p, 0x%08x, 0x%08x, %p, 0x%08lx)\n",
3135 wndProc, hWndParent, dwExStyle, dwStyle, hMenu, wnd_extra);
3136
3137 /* If our OS is natively ANSI, use the ANSI version */
3138 if (GetVersion() & 0x80000000) /* not NT */
3139 {
3140 TRACE("fallback to ANSI, ver 0x%08x\n", GetVersion());
3141 return SHCreateWorkerWindowA(wndProc, hWndParent, dwExStyle, dwStyle, hMenu, wnd_extra);
3142 }
3143
3144 /* Create Window class */
3145 wc.style = 0;
3147 wc.cbClsExtra = 0;
3148 wc.cbWndExtra = sizeof(LONG_PTR);
3150 wc.hIcon = NULL;
3152 wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
3153 wc.lpszMenuName = NULL;
3154 wc.lpszClassName = szClass;
3155
3156 SHRegisterClassW(&wc);
3157
3158 hWnd = CreateWindowExW(dwExStyle, szClass, 0, dwStyle, 0, 0, 0, 0,
3159 hWndParent, hMenu, shlwapi_hInstance, 0);
3160 if (hWnd)
3161 {
3162 SetWindowLongPtrW(hWnd, 0, wnd_extra);
3164 }
3165
3166 return hWnd;
3167}
3168
3169/*************************************************************************
3170 * @ [SHLWAPI.279]
3171 *
3172 * Get and show a context menu from a shell folder.
3173 *
3174 * PARAMS
3175 * hWnd [I] Window displaying the shell folder
3176 * lpFolder [I] IShellFolder interface
3177 * lpApidl [I] Id for the particular folder desired
3178 *
3179 * RETURNS
3180 * Success: S_OK.
3181 * Failure: An HRESULT error code indicating the error.
3182 */
3184{
3185 TRACE("%p %p %p\n", hWnd, lpFolder, lpApidl);
3186#ifdef __REACTOS__
3187 return SHInvokeCommand(hWnd, lpFolder, lpApidl, NULL);
3188#else
3189 return SHInvokeCommand(hWnd, lpFolder, lpApidl, 0);
3190#endif
3191}
3192
3193/*************************************************************************
3194 * @ [SHLWAPI.281]
3195 *
3196 * _SHPackDispParamsV
3197 */
3199{
3200 VARIANTARG *iter;
3201
3202 TRACE("(%p %p %u ...)\n", params, args, cnt);
3203
3204 params->rgvarg = args;
3205 params->rgdispidNamedArgs = NULL;
3206 params->cArgs = cnt;
3207 params->cNamedArgs = 0;
3208
3209 iter = args+cnt;
3210
3211 while(iter-- > args) {
3212 V_VT(iter) = va_arg(valist, enum VARENUM);
3213
3214 TRACE("vt=%d\n", V_VT(iter));
3215
3216 if(V_VT(iter) & VT_BYREF) {
3217 V_BYREF(iter) = va_arg(valist, LPVOID);
3218 } else {
3219 switch(V_VT(iter)) {
3220 case VT_I4:
3221 V_I4(iter) = va_arg(valist, LONG);
3222 break;
3223 case VT_BSTR:
3224 V_BSTR(iter) = va_arg(valist, BSTR);
3225 break;
3226 case VT_DISPATCH:
3227 V_DISPATCH(iter) = va_arg(valist, IDispatch*);
3228 break;
3229 case VT_BOOL:
3230 V_BOOL(iter) = va_arg(valist, int);
3231 break;
3232 case VT_UNKNOWN:
3233 V_UNKNOWN(iter) = va_arg(valist, IUnknown*);
3234 break;
3235 default:
3236 V_VT(iter) = VT_I4;
3237 V_I4(iter) = va_arg(valist, LONG);
3238 }
3239 }
3240 }
3241
3242 return S_OK;
3243}
3244
3245/*************************************************************************
3246 * @ [SHLWAPI.282]
3247 *
3248 * SHPackDispParams
3249 */
3251{
3253 HRESULT hres;
3254
3258 return hres;
3259}
3260
3261/*************************************************************************
3262 * SHLWAPI_InvokeByIID
3263 *
3264 * This helper function calls IDispatch::Invoke for each sink
3265 * which implements given iid or IDispatch.
3266 *
3267 */
3269 IConnectionPoint* iCP,
3270 REFIID iid,
3271 DISPID dispId,
3272 DISPPARAMS* dispParams)
3273{
3274 IEnumConnections *enumerator;
3275 CONNECTDATA rgcd;
3276 static DISPPARAMS empty = {NULL, NULL, 0, 0};
3277 DISPPARAMS* params = dispParams;
3278
3279 HRESULT result = IConnectionPoint_EnumConnections(iCP, &enumerator);
3280 if (FAILED(result))
3281 return result;
3282
3283 /* Invoke is never happening with an NULL dispParams */
3284 if (!params)
3285 params = &empty;
3286
3287 while(IEnumConnections_Next(enumerator, 1, &rgcd, NULL)==S_OK)
3288 {
3289 IDispatch *dispIface;
3290 if ((iid && SUCCEEDED(IUnknown_QueryInterface(rgcd.pUnk, iid, (LPVOID*)&dispIface))) ||
3291 SUCCEEDED(IUnknown_QueryInterface(rgcd.pUnk, &IID_IDispatch, (LPVOID*)&dispIface)))
3292 {
3293 IDispatch_Invoke(dispIface, dispId, &IID_NULL, 0, DISPATCH_METHOD, params, NULL, NULL, NULL);
3294 IDispatch_Release(dispIface);
3295 }
3296 IUnknown_Release(rgcd.pUnk);
3297 }
3298
3299 IEnumConnections_Release(enumerator);
3300
3301 return S_OK;
3302}
3303
3304/*************************************************************************
3305 * IConnectionPoint_InvokeWithCancel [SHLWAPI.283]
3306 */
3308 DISPID dispId, DISPPARAMS* dispParams,
3309 DWORD unknown1, DWORD unknown2 )
3310{
3311 IID iid;
3313
3314 FIXME("(%p)->(0x%x %p %x %x) partial stub\n", iCP, dispId, dispParams, unknown1, unknown2);
3315
3316 result = IConnectionPoint_GetConnectionInterface(iCP, &iid);
3317 if (SUCCEEDED(result))
3318 result = SHLWAPI_InvokeByIID(iCP, &iid, dispId, dispParams);
3319 else
3320 result = SHLWAPI_InvokeByIID(iCP, NULL, dispId, dispParams);
3321
3322 return result;
3323}
3324
3325
3326/*************************************************************************
3327 * @ [SHLWAPI.284]
3328 *
3329 * IConnectionPoint_SimpleInvoke
3330 */
3332 IConnectionPoint* iCP,
3333 DISPID dispId,
3334 DISPPARAMS* dispParams)
3335{
3336 IID iid;
3338
3339 TRACE("(%p)->(0x%x %p)\n",iCP,dispId,dispParams);
3340
3341 result = IConnectionPoint_GetConnectionInterface(iCP, &iid);
3342 if (SUCCEEDED(result))
3343 result = SHLWAPI_InvokeByIID(iCP, &iid, dispId, dispParams);
3344 else
3345 result = SHLWAPI_InvokeByIID(iCP, NULL, dispId, dispParams);
3346
3347 return result;
3348}
3349
3350/*************************************************************************
3351 * @ [SHLWAPI.285]
3352 *
3353 * Notify an IConnectionPoint object of changes.
3354 *
3355 * PARAMS
3356 * lpCP [I] Object to notify
3357 * dispID [I]
3358 *
3359 * RETURNS
3360 * Success: S_OK.
3361 * Failure: E_NOINTERFACE, if lpCP is NULL or does not support the
3362 * IConnectionPoint interface.
3363 */
3365{
3366 IEnumConnections *lpEnum;
3367 HRESULT hRet = E_NOINTERFACE;
3368
3369 TRACE("(%p,0x%8X)\n", lpCP, dispID);
3370
3371 /* Get an enumerator for the connections */
3372 if (lpCP)
3373 hRet = IConnectionPoint_EnumConnections(lpCP, &lpEnum);
3374
3375 if (SUCCEEDED(hRet))
3376 {
3377 IPropertyNotifySink *lpSink;
3378 CONNECTDATA connData;
3379 ULONG ulFetched;
3380
3381 /* Call OnChanged() for every notify sink in the connection point */
3382 while (IEnumConnections_Next(lpEnum, 1, &connData, &ulFetched) == S_OK)
3383 {
3384 if (SUCCEEDED(IUnknown_QueryInterface(connData.pUnk, &IID_IPropertyNotifySink, (void**)&lpSink)) &&
3385 lpSink)
3386 {
3387 IPropertyNotifySink_OnChanged(lpSink, dispID);
3388 IPropertyNotifySink_Release(lpSink);
3389 }
3390 IUnknown_Release(connData.pUnk);
3391 }
3392
3393 IEnumConnections_Release(lpEnum);
3394 }
3395 return hRet;
3396}
3397
3398/*************************************************************************
3399 * @ [SHLWAPI.286]
3400 *
3401 * IUnknown_CPContainerInvokeParam
3402 */
3405 REFIID riid,
3406 DISPID dispId,
3408 DWORD cParams, ...)
3409{
3411 IConnectionPoint *iCP;
3413 DISPPARAMS dispParams = {buffer, NULL, cParams, 0};
3415
3416 if (!container)
3417 return E_NOINTERFACE;
3418
3419 result = IUnknown_QueryInterface(container, &IID_IConnectionPointContainer,(LPVOID*) &iCPC);
3420 if (FAILED(result))
3421 return result;
3422
3423 result = IConnectionPointContainer_FindConnectionPoint(iCPC, riid, &iCP);
3424 IConnectionPointContainer_Release(iCPC);
3425 if(FAILED(result))
3426 return result;
3427
3428 __ms_va_start(valist, cParams);
3429 SHPackDispParamsV(&dispParams, buffer, cParams, valist);
3431
3432 result = SHLWAPI_InvokeByIID(iCP, riid, dispId, &dispParams);
3433 IConnectionPoint_Release(iCP);
3434
3435 return result;
3436}
3437
3438/*************************************************************************
3439 * @ [SHLWAPI.287]
3440 *
3441 * Notify an IConnectionPointContainer object of changes.
3442 *
3443 * PARAMS
3444 * lpUnknown [I] Object to notify
3445 * dispID [I]
3446 *
3447 * RETURNS
3448 * Success: S_OK.
3449 * Failure: E_NOINTERFACE, if lpUnknown is NULL or does not support the
3450 * IConnectionPointContainer interface.
3451 */
3453{
3455 HRESULT hRet = E_NOINTERFACE;
3456
3457 TRACE("(%p,0x%8X)\n", lpUnknown, dispID);
3458
3459 if (lpUnknown)
3460 hRet = IUnknown_QueryInterface(lpUnknown, &IID_IConnectionPointContainer, (void**)&lpCPC);
3461
3462 if (SUCCEEDED(hRet))
3463 {
3464 IConnectionPoint* lpCP;
3465
3466 hRet = IConnectionPointContainer_FindConnectionPoint(lpCPC, &IID_IPropertyNotifySink, &lpCP);
3467 IConnectionPointContainer_Release(lpCPC);
3468
3469 hRet = IConnectionPoint_OnChanged(lpCP, dispID);
3470 IConnectionPoint_Release(lpCP);
3471 }
3472 return hRet;
3473}
3474
3475/*************************************************************************
3476 * @ [SHLWAPI.289]
3477 *
3478 * See PlaySoundW.
3479 */
3481{
3482 return PlaySoundW(pszSound, hmod, fdwSound);
3483}
3484
3485#ifndef __REACTOS__ /* See propbag.cpp */
3486/*************************************************************************
3487 * @ [SHLWAPI.294]
3488 *
3489 * Retrieve a key value from an INI file. See GetPrivateProfileString for
3490 * more information.
3491 *
3492 * PARAMS
3493 * appName [I] The section in the INI file that contains the key
3494 * keyName [I] The key to be retrieved
3495 * out [O] The buffer into which the key's value will be copied
3496 * outLen [I] The length of the `out' buffer
3497 * filename [I] The location of the INI file
3498 *
3499 * RETURNS
3500 * Length of string copied into `out'.
3501 */
3503 DWORD outLen, LPCWSTR filename)
3504{
3505 INT ret;
3506 WCHAR *buf;
3507
3508 TRACE("(%s,%s,%p,%08x,%s)\n", debugstr_w(appName), debugstr_w(keyName),
3509 out, outLen, debugstr_w(filename));
3510
3511 if(outLen == 0)
3512 return 0;
3513
3514 buf = HeapAlloc(GetProcessHeap(), 0, outLen * sizeof(WCHAR));
3515 if(!buf){
3516 *out = 0;
3517 return 0;
3518 }
3519
3520 ret = GetPrivateProfileStringW(appName, keyName, NULL, buf, outLen, filename);
3521 if(ret)
3522 strcpyW(out, buf);
3523 else
3524 *out = 0;
3525
3527
3528 return strlenW(out);
3529}
3530#endif
3531
3532#ifndef __REACTOS__ /* See propbag.cpp */
3533/*************************************************************************
3534 * @ [SHLWAPI.295]
3535 *
3536 * Set a key value in an INI file. See WritePrivateProfileString for
3537 * more information.
3538 *
3539 * PARAMS
3540 * appName [I] The section in the INI file that contains the key
3541 * keyName [I] The key to be set
3542 * str [O] The value of the key
3543 * filename [I] The location of the INI file
3544 *
3545 * RETURNS
3546 * Success: TRUE
3547 * Failure: FALSE
3548 */
3551{
3552 TRACE("(%s, %p, %s, %s)\n", debugstr_w(appName), keyName, debugstr_w(str),
3554
3556}
3557#endif
3558
3559/*************************************************************************
3560 * @ [SHLWAPI.313]
3561 *
3562 * See SHGetFileInfoW.
3563 */
3565 SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
3566{
3567 return SHGetFileInfoW(path, dwFileAttributes, psfi, sizeofpsfi, flags);
3568}
3569
3570/*************************************************************************
3571 * @ [SHLWAPI.318]
3572 *
3573 * See DragQueryFileW.
3574 */
3575UINT WINAPI DragQueryFileWrapW(HDROP hDrop, UINT lFile, LPWSTR lpszFile, UINT lLength)
3576{
3577 return DragQueryFileW(hDrop, lFile, lpszFile, lLength);
3578}
3579
3580/*************************************************************************
3581 * @ [SHLWAPI.333]
3582 *
3583 * See SHBrowseForFolderW.
3584 */
3586{
3587 return SHBrowseForFolderW(lpBi);
3588}
3589
3590/*************************************************************************
3591 * @ [SHLWAPI.334]
3592 *
3593 * See SHGetPathFromIDListW.
3594 */
3596{
3597 return SHGetPathFromIDListW(pidl, pszPath);
3598}
3599
3600/*************************************************************************
3601 * @ [SHLWAPI.335]
3602 *
3603 * See ShellExecuteExW.
3604 */
3606{
3607 return ShellExecuteExW(lpExecInfo);
3608}
3609
3610/*************************************************************************
3611 * @ [SHLWAPI.336]
3612 *
3613 * See SHFileOperationW.
3614 */
3616{
3617 return SHFileOperationW(lpFileOp);
3618}
3619
3620/*************************************************************************
3621 * @ [SHLWAPI.342]
3622 *
3623 */
3625{
3627}
3628
3629/*************************************************************************
3630 * @ [SHLWAPI.350]
3631 *
3632 * See GetFileVersionInfoSizeW.
3633 */
3635{
3637}
3638
3639/*************************************************************************
3640 * @ [SHLWAPI.351]
3641 *
3642 * See GetFileVersionInfoW.
3643 */
3646{
3648}
3649
3650/*************************************************************************
3651 * @ [SHLWAPI.352]
3652 *
3653 * See VerQueryValueW.
3654 */
3656 LPVOID *lplpBuffer, UINT *puLen )
3657{
3658 return VerQueryValueW( pBlock, lpSubBlock, lplpBuffer, puLen );
3659}
3660
3661#define IsIface(type) SUCCEEDED((hRet = IUnknown_QueryInterface(lpUnknown, &IID_##type, (void**)&lpObj)))
3662#define IShellBrowser_EnableModeless IShellBrowser_EnableModelessSB
3663#define EnableModeless(type) type##_EnableModeless((type*)lpObj, bModeless)
3664
3665/*************************************************************************
3666 * @ [SHLWAPI.355]
3667 *
3668 * Change the modality of a shell object.
3669 *
3670 * PARAMS
3671 * lpUnknown [I] Object to make modeless
3672 * bModeless [I] TRUE=Make modeless, FALSE=Make modal
3673 *
3674 * RETURNS
3675 * Success: S_OK. The modality lpUnknown is changed.
3676 * Failure: An HRESULT error code indicating the error.
3677 *
3678 * NOTES
3679 * lpUnknown must support the IOleInPlaceFrame interface, the
3680 * IInternetSecurityMgrSite interface, the IShellBrowser interface
3681 * the IDocHostUIHandler interface, or the IOleInPlaceActiveObject interface,
3682 * or this call will fail.
3683 */
3685{
3686 IUnknown *lpObj;
3687 HRESULT hRet;
3688
3689 TRACE("(%p,%d)\n", lpUnknown, bModeless);
3690
3691 if (!lpUnknown)
3692 return E_FAIL;
3693
3696 else if (IsIface(IOleInPlaceFrame))
3698 else if (IsIface(IShellBrowser))
3702 else if (IsIface(IDocHostUIHandler))
3704 else
3705 return hRet;
3706
3707 IUnknown_Release(lpObj);
3708 return S_OK;
3709}
3710
3711/*************************************************************************
3712 * @ [SHLWAPI.357]
3713 *
3714 * See SHGetNewLinkInfoW.
3715 */
3718{
3719 return SHGetNewLinkInfoW(pszLinkTo, pszDir, pszName, pfMustCopy, uFlags);
3720}
3721
3722/*************************************************************************
3723 * @ [SHLWAPI.358]
3724 *
3725 * See SHDefExtractIconW.
3726 */
3727UINT WINAPI SHDefExtractIconWrapW(LPCWSTR pszIconFile, int iIndex, UINT uFlags, HICON* phiconLarge,
3728 HICON* phiconSmall, UINT nIconSize)
3729{
3730 return SHDefExtractIconW(pszIconFile, iIndex, uFlags, phiconLarge, phiconSmall, nIconSize);
3731}
3732
3733/*************************************************************************
3734 * @ [SHLWAPI.363]
3735 *
3736 * Get and show a context menu from a shell folder.
3737 *
3738 * PARAMS
3739 * hWnd [I] Window displaying the shell folder
3740 * lpFolder [I] IShellFolder interface
3741 * lpApidl [I] Id for the particular folder desired
3742 * dwCommandId [I] The command ID to invoke (0=invoke default)
3743 *
3744 * RETURNS
3745 * Success: S_OK. If bInvokeDefault is TRUE, the default menu action was
3746 * executed.
3747 * Failure: An HRESULT error code indicating the error.
3748 */
3749#ifdef __REACTOS__
3752{
3753 return SHInvokeCommandWithFlagsAndSite(hWnd, NULL, lpFolder, lpApidl, 0, lpVerb);
3754}
3755#else
3757{
3758 IContextMenu *iContext;
3759 HRESULT hRet;
3760
3761 TRACE("(%p, %p, %p, %u)\n", hWnd, lpFolder, lpApidl, dwCommandId);
3762
3763 if (!lpFolder)
3764 return E_FAIL;
3765
3766 /* Get the context menu from the shell folder */
3767 hRet = IShellFolder_GetUIObjectOf(lpFolder, hWnd, 1, &lpApidl,
3768 &IID_IContextMenu, 0, (void**)&iContext);
3769 if (SUCCEEDED(hRet))
3770 {
3771 HMENU hMenu;
3772 if ((hMenu = CreatePopupMenu()))
3773 {
3774 HRESULT hQuery;
3775
3776 /* Add the context menu entries to the popup */
3777 hQuery = IContextMenu_QueryContextMenu(iContext, hMenu, 0, 1, 0x7FFF,
3778 dwCommandId ? CMF_NORMAL : CMF_DEFAULTONLY);
3779
3780 if (SUCCEEDED(hQuery))
3781 {
3782 if (!dwCommandId)
3783 dwCommandId = GetMenuDefaultItem(hMenu, 0, 0);
3784 if (dwCommandId != (UINT)-1)
3785 {
3786 CMINVOKECOMMANDINFO cmIci;
3787 /* Invoke the default item */
3788 memset(&cmIci,0,sizeof(cmIci));
3789 cmIci.cbSize = sizeof(cmIci);
3790 cmIci.fMask = CMIC_MASK_ASYNCOK;
3791 cmIci.hwnd = hWnd;
3792#ifdef __REACTOS__ /* r75561 */
3793 cmIci.lpVerb = MAKEINTRESOURCEA(dwCommandId - 1);
3794#else
3795 cmIci.lpVerb = MAKEINTRESOURCEA(dwCommandId);
3796#endif
3797 cmIci.nShow = SW_SHOWNORMAL;
3798
3799 hRet = IContextMenu_InvokeCommand(iContext, &cmIci);
3800 }
3801 }
3802 DestroyMenu(hMenu);
3803 }
3804 IContextMenu_Release(iContext);
3805 }
3806 return hRet;
3807}
3808#endif /* __REACTOS__ */
3809
3810/*************************************************************************
3811 * @ [SHLWAPI.370]
3812 *
3813 * See ExtractIconW.
3814 */
3816 UINT nIconIndex)
3817{
3818 return ExtractIconW(hInstance, lpszExeFileName, nIconIndex);
3819}
3820
3821/*************************************************************************
3822 * @ [SHLWAPI.377]
3823 *
3824 * Load a library from the directory of a particular process.
3825 *
3826 * PARAMS
3827 * new_mod [I] Library name
3828 * inst_hwnd [I] Module whose directory is to be used
3829 * dwCrossCodePage [I] Should be FALSE (currently ignored)
3830 *
3831 * RETURNS
3832 * Success: A handle to the loaded module
3833 * Failure: A NULL handle.
3834 */
3835HMODULE WINAPI MLLoadLibraryA(LPCSTR new_mod, HMODULE inst_hwnd, DWORD dwCrossCodePage)
3836{
3837 /* FIXME: Native appears to do DPA_Create and a DPA_InsertPtr for
3838 * each call here.
3839 * FIXME: Native shows calls to:
3840 * SHRegGetUSValue for "Software\Microsoft\Internet Explorer\International"
3841 * CheckVersion
3842 * RegOpenKeyExA for "HKLM\Software\Microsoft\Internet Explorer"
3843 * RegQueryValueExA for "LPKInstalled"
3844 * RegCloseKey
3845 * RegOpenKeyExA for "HKCU\Software\Microsoft\Internet Explorer\International"
3846 * RegQueryValueExA for "ResourceLocale"
3847 * RegCloseKey
3848 * RegOpenKeyExA for "HKLM\Software\Microsoft\Active Setup\Installed Components\{guid}"
3849 * RegQueryValueExA for "Locale"
3850 * RegCloseKey
3851 * and then tests the Locale ("en" for me).
3852 * code below
3853 * after the code then a DPA_Create (first time) and DPA_InsertPtr are done.
3854 */
3855 CHAR mod_path[2*MAX_PATH];
3856 LPSTR ptr;
3857 DWORD len;
3858
3859 FIXME("(%s,%p,%d) semi-stub!\n", debugstr_a(new_mod), inst_hwnd, dwCrossCodePage);
3860 len = GetModuleFileNameA(inst_hwnd, mod_path, sizeof(mod_path));
3861 if (!len || len >= sizeof(mod_path)) return NULL;
3862
3863 ptr = strrchr(mod_path, '\\');
3864 if (ptr) {
3865 strcpy(ptr+1, new_mod);
3866 TRACE("loading %s\n", debugstr_a(mod_path));
3867 return LoadLibraryA(mod_path);
3868 }
3869 return NULL;
3870}
3871
3872/*************************************************************************
3873 * @ [SHLWAPI.378]
3874 *
3875 * Unicode version of MLLoadLibraryA.
3876 */
3877HMODULE WINAPI MLLoadLibraryW(LPCWSTR new_mod, HMODULE inst_hwnd, DWORD dwCrossCodePage)
3878{
3879 WCHAR mod_path[2*MAX_PATH];
3880 LPWSTR ptr;
3881 DWORD len;
3882
3883 FIXME("(%s,%p,%d) semi-stub!\n", debugstr_w(new_mod), inst_hwnd, dwCrossCodePage);
3884 len = GetModuleFileNameW(inst_hwnd, mod_path, sizeof(mod_path) / sizeof(WCHAR));
3885 if (!len || len >= sizeof(mod_path) / sizeof(WCHAR)) return NULL;
3886
3887 ptr = strrchrW(mod_path, '\\');
3888 if (ptr) {
3889 strcpyW(ptr+1, new_mod);
3890 TRACE("loading %s\n", debugstr_w(mod_path));
3891 return LoadLibraryW(mod_path);
3892 }
3893 return NULL;
3894}
3895
3896/*************************************************************************
3897 * ColorAdjustLuma [SHLWAPI.@]
3898 *
3899 * Adjust the luminosity of a color
3900 *
3901 * PARAMS
3902 * cRGB [I] RGB value to convert
3903 * dwLuma [I] Luma adjustment
3904 * bUnknown [I] Unknown
3905 *
3906 * RETURNS
3907 * The adjusted RGB color.
3908 */
3909COLORREF WINAPI ColorAdjustLuma(COLORREF cRGB, int dwLuma, BOOL bUnknown)
3910{
3911 TRACE("(0x%8x,%d,%d)\n", cRGB, dwLuma, bUnknown);
3912
3913 if (dwLuma)
3914 {
3915 WORD wH, wL, wS;
3916
3917 ColorRGBToHLS(cRGB, &wH, &wL, &wS);
3918
3919 FIXME("Ignoring luma adjustment\n");
3920
3921 /* FIXME: The adjustment is not linear */
3922
3923 cRGB = ColorHLSToRGB(wH, wL, wS);
3924 }
3925 return cRGB;
3926}
3927
3928/*************************************************************************
3929 * @ [SHLWAPI.389]
3930 *
3931 * See GetSaveFileNameW.
3932 */
3934{
3935 return GetSaveFileNameW(ofn);
3936}
3937
3938/*************************************************************************
3939 * @ [SHLWAPI.390]
3940 *
3941 * See WNetRestoreConnectionW.
3942 */
3944{
3945 return WNetRestoreConnectionW(hwndOwner, lpszDevice);
3946}
3947
3948/*************************************************************************
3949 * @ [SHLWAPI.391]
3950 *
3951 * See WNetGetLastErrorW.
3952 */
3953DWORD WINAPI WNetGetLastErrorWrapW(LPDWORD lpError, LPWSTR lpErrorBuf, DWORD nErrorBufSize,
3954 LPWSTR lpNameBuf, DWORD nNameBufSize)
3955{
3956 return WNetGetLastErrorW(lpError, lpErrorBuf, nErrorBufSize, lpNameBuf, nNameBufSize);
3957}
3958
3959/*************************************************************************
3960 * @ [SHLWAPI.401]
3961 *
3962 * See PageSetupDlgW.
3963 */
3965{
3966 return PageSetupDlgW(pagedlg);
3967}
3968
3969/*************************************************************************
3970 * @ [SHLWAPI.402]
3971 *
3972 * See PrintDlgW.
3973 */
3975{
3976 return PrintDlgW(printdlg);
3977}
3978
3979/*************************************************************************
3980 * @ [SHLWAPI.403]
3981 *
3982 * See GetOpenFileNameW.
3983 */
3985{
3986 return GetOpenFileNameW(ofn);
3987}
3988
3989/*************************************************************************
3990 * @ [SHLWAPI.404]
3991 */
3993{
3994 /* Windows attempts to get an IPersist interface and, if that fails, an
3995 * IPersistFolder interface on the folder passed-in here. If one of those
3996 * interfaces is available, it then calls GetClassID on the folder... and
3997 * then calls IShellFolder_EnumObjects no matter what, even crashing if
3998 * lpFolder isn't actually an IShellFolder object. The purpose of getting
3999 * the ClassID is unknown, so we don't do it here.
4000 *
4001 * For discussion and detailed tests, see:
4002 * "shlwapi: Be less strict on which type of IShellFolder can be enumerated"
4003 * wine-devel mailing list, 3 Jun 2010
4004 */
4005
4006 return IShellFolder_EnumObjects(lpFolder, hwnd, flags, ppenum);
4007}
4008
4009/* INTERNAL: Map from HLS color space to RGB */
4010static WORD ConvertHue(int wHue, WORD wMid1, WORD wMid2)
4011{
4012 wHue = wHue > 240 ? wHue - 240 : wHue < 0 ? wHue + 240 : wHue;
4013
4014 if (wHue > 160)
4015 return wMid1;
4016 else if (wHue > 120)
4017 wHue = 160 - wHue;
4018 else if (wHue > 40)
4019 return wMid2;
4020
4021 return ((wHue * (wMid2 - wMid1) + 20) / 40) + wMid1;
4022}
4023
4024/* Convert to RGB and scale into RGB range (0..255) */
4025#define GET_RGB(h) (ConvertHue(h, wMid1, wMid2) * 255 + 120) / 240
4026
4027/*************************************************************************
4028 * ColorHLSToRGB [SHLWAPI.@]
4029 *
4030 * Convert from hls color space into an rgb COLORREF.
4031 *
4032 * PARAMS
4033 * wHue [I] Hue amount
4034 * wLuminosity [I] Luminosity amount
4035 * wSaturation [I] Saturation amount
4036 *
4037 * RETURNS
4038 * A COLORREF representing the converted color.
4039 *
4040 * NOTES
4041 * Input hls values are constrained to the range (0..240).
4042 */
4043COLORREF WINAPI ColorHLSToRGB(WORD wHue, WORD wLuminosity, WORD wSaturation)
4044{
4045 WORD wRed;
4046
4047 if (wSaturation)
4048 {
4049 WORD wGreen, wBlue, wMid1, wMid2;
4050
4051 if (wLuminosity > 120)
4052 wMid2 = wSaturation + wLuminosity - (wSaturation * wLuminosity + 120) / 240;
4053 else
4054 wMid2 = ((wSaturation + 240) * wLuminosity + 120) / 240;
4055
4056 wMid1 = wLuminosity * 2 - wMid2;
4057
4058 wRed = GET_RGB(wHue + 80);
4059 wGreen = GET_RGB(wHue);
4060 wBlue = GET_RGB(wHue - 80);
4061
4062 return RGB(wRed, wGreen, wBlue);
4063 }
4064
4065 wRed = wLuminosity * 255 / 240;
4066 return RGB(wRed, wRed, wRed);
4067}
4068
4069/*************************************************************************
4070 * @ [SHLWAPI.413]
4071 *
4072 * Get the current docking status of the system.
4073 *
4074 * PARAMS
4075 * dwFlags [I] DOCKINFO_ flags from "winbase.h", unused
4076 *
4077 * RETURNS
4078 * One of DOCKINFO_UNDOCKED, DOCKINFO_UNDOCKED, or 0 if the system is not
4079 * a notebook.
4080 */
4082{
4083 HW_PROFILE_INFOA hwInfo;
4084
4085 TRACE("(0x%08x)\n", dwFlags);
4086
4087 GetCurrentHwProfileA(&hwInfo);
4088 switch (hwInfo.dwDockInfo & (DOCKINFO_DOCKED|DOCKINFO_UNDOCKED))
4089 {
4090 case DOCKINFO_DOCKED:
4091 case DOCKINFO_UNDOCKED:
4093 default:
4094 return 0;
4095 }
4096}
4097
4098/*************************************************************************
4099 * @ [SHLWAPI.416]
4100 *
4101 */
4103{
4104
4105 FIXME("(%p, %s, 0x%x, %p, %d)\n", hwnd, debugstr_w(helpfile), flags1, ptr1, flags2);
4106 return 0;
4107}
4108
4109/*************************************************************************
4110 * @ [SHLWAPI.417]
4111 *
4112 */
4114{
4115
4116 FIXME("(%p, %s, 0x%x, %p, %d)\n", hwnd, debugstr_a(helpfile), flags1, ptr1, flags2);
4117 return 0;
4118}
4119
4120/*************************************************************************
4121 * @ [SHLWAPI.418]
4122 *
4123 * Function seems to do FreeLibrary plus other things.
4124 *
4125 * FIXME native shows the following calls:
4126 * RtlEnterCriticalSection
4127 * LocalFree
4128 * GetProcAddress(Comctl32??, 150L)
4129 * DPA_DeletePtr
4130 * RtlLeaveCriticalSection
4131 * followed by the FreeLibrary.
4132 * The above code may be related to .377 above.
4133 */
4135{
4136 FIXME("(%p) semi-stub\n", hModule);
4137 return FreeLibrary(hModule);
4138}
4139
4140/*************************************************************************
4141 * @ [SHLWAPI.419]
4142 */
4144 FIXME(": stub\n");
4145 return TRUE;
4146}
4147
4148/*************************************************************************
4149 * @ [SHLWAPI.429]
4150 * FIXME I have no idea what this function does or what its arguments are.
4151 */
4153{
4154 FIXME("(%p) stub\n", hInst);
4155 return FALSE;
4156}
4157
4158
4159/*************************************************************************
4160 * @ [SHLWAPI.430]
4161 */
4163{
4164 FIXME("(%p,%p) stub\n", hInst, hHeap);
4165 return E_FAIL; /* This is what is used if shlwapi not loaded */
4166}
4167
4168/*************************************************************************
4169 * @ [SHLWAPI.431]
4170 */
4172{
4173 FIXME("(0x%08x)stub\n", x);
4174 return 0xabba1247;
4175}
4176
4177/*************************************************************************
4178 * @ [SHLWAPI.432]
4179 *
4180 * See SHSendMessageBroadcastW
4181 *
4182 */
4184{
4186 SMTO_ABORTIFHUNG, 2000, NULL);
4187}
4188
4189/*************************************************************************
4190 * @ [SHLWAPI.433]
4191 *
4192 * A wrapper for sending Broadcast Messages to all top level Windows
4193 *
4194 */
4196{
4198 SMTO_ABORTIFHUNG, 2000, NULL);
4199}
4200
4201/*************************************************************************
4202 * @ [SHLWAPI.436]
4203 *
4204 * Convert a Unicode string CLSID into a CLSID.
4205 *
4206 * PARAMS
4207 * idstr [I] string containing a CLSID in text form
4208 * id [O] CLSID extracted from the string
4209 *
4210 * RETURNS
4211 * S_OK on success or E_INVALIDARG on failure
4212 */
4214{
4215 return CLSIDFromString((LPCOLESTR)idstr, id);
4216}
4217
4218/*************************************************************************
4219 * @ [SHLWAPI.437]
4220 *
4221 * Determine if the OS supports a given feature.
4222 *
4223 * PARAMS
4224 * dwFeature [I] Feature requested (undocumented)
4225 *
4226 * RETURNS
4227 * TRUE If the feature is available.
4228 * FALSE If the feature is not available.
4229 */
4231{
4232#ifdef __REACTOS__
4234 DWORD platform, majorv, minorv;
4235
4236 osvi.dwOSVersionInfoSize = sizeof(osvi);
4238 {
4241 {
4242 ERR("GetVersionEx failed\n");
4243 return FALSE;
4244 }
4245 osvi.wProductType = VER_NT_WORKSTATION;
4246 osvi.wSuiteMask = 0;
4247 }
4248#else
4250 DWORD platform, majorv, minorv;
4251
4253 if(!GetVersionExA(&osvi)) {
4254 ERR("GetVersionEx failed\n");
4255 return FALSE;
4256 }
4257#endif
4258 majorv = osvi.dwMajorVersion;
4259 minorv = osvi.dwMinorVersion;
4261
4262#define ISOS_RETURN(x) \
4263 TRACE("(0x%x) ret=%d\n",feature,(x)); \
4264 return (x);
4265
4266 switch(feature) {
4267 case OS_WIN32SORGREATER:
4270 case OS_NT:
4272 case OS_WIN95ORGREATER:
4274 case OS_NT4ORGREATER:
4275 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 4)
4278 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 5)
4279 case OS_WIN98ORGREATER:
4281 case OS_WIN98_GOLD:
4283 case OS_WIN2000PRO:
4284 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 5)
4285 case OS_WIN2000SERVER:
4286 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && (minorv == 0 || minorv == 1))
4288 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && (minorv == 0 || minorv == 1))
4290 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && (minorv == 0 || minorv == 1))
4291 case OS_WIN2000TERMINAL:
4292 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && (minorv == 0 || minorv == 1))
4293 case OS_EMBEDDED:
4294 FIXME("(OS_EMBEDDED) What should we return here?\n");
4295 return FALSE;
4296 case OS_TERMINALCLIENT:
4297 FIXME("(OS_TERMINALCLIENT) What should we return here?\n");
4298 return FALSE;
4300 FIXME("(OS_TERMINALREMOTEADMIN) What should we return here?\n");
4301 return FALSE;
4302 case OS_WIN95_GOLD:
4304 case OS_MEORGREATER:
4306 case OS_XPORGREATER:
4307 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 5 && minorv >= 1)
4308 case OS_HOME:
4309 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 5 && minorv >= 1)
4310 case OS_PROFESSIONAL:
4312 case OS_DATACENTER:
4314 case OS_ADVSERVER:
4315 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 5)
4316 case OS_SERVER:
4318 case OS_TERMINALSERVER:
4321 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && minorv >= 1 && majorv >= 5)
4323 FIXME("(OS_FASTUSERSWITCHING) What should we return here?\n");
4324 return TRUE;
4325 case OS_WELCOMELOGONUI:
4326 FIXME("(OS_WELCOMELOGONUI) What should we return here?\n");
4327 return FALSE;
4328 case OS_DOMAINMEMBER:
4329 FIXME("(OS_DOMAINMEMBER) What should we return here?\n");
4330 return TRUE;
4331 case OS_ANYSERVER:
4332#ifdef __REACTOS__
4333 ISOS_RETURN(osvi.wProductType > VER_NT_WORKSTATION)
4334#else
4336#endif
4337 case OS_WOW6432:
4338 {
4339 BOOL is_wow64;
4341 return is_wow64;
4342 }
4343 case OS_WEBSERVER:
4347 case OS_TABLETPC:
4348 FIXME("(OS_TABLETPC) What should we return here?\n");
4349 return FALSE;
4350 case OS_SERVERADMINUI:
4351#ifdef __REACTOS__
4352 {
4353 DWORD value = FALSE, size = sizeof(value);
4355 if (hKey)
4356 {
4357 SHQueryValueExW(hKey, L"ServerAdminUI", NULL, NULL, &value, &size);
4359 }
4361 }
4362#else
4363 FIXME("(OS_SERVERADMINUI) What should we return here?\n");
4364 return FALSE;
4365#endif
4366 case OS_MEDIACENTER:
4367 FIXME("(OS_MEDIACENTER) What should we return here?\n");
4368 return FALSE;
4369 case OS_APPLIANCE:
4370 FIXME("(OS_APPLIANCE) What should we return here?\n");
4371 return FALSE;
4372 case 0x25: /*OS_VISTAORGREATER*/
4373 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 6)
4374 }
4375
4376#undef ISOS_RETURN
4377
4378 WARN("(0x%x) unknown parameter\n",feature);
4379
4380 return FALSE;
4381}
4382
4383#ifdef __REACTOS__
4384/*************************************************************************
4385 * @ [SHLWAPI.438]
4386 */
4388{
4389 WCHAR valueW[MAX_PATH], bufferW[MAX_PATH];
4390 DWORD dwSize = ARRAY_SIZE(bufferW) * sizeof(CHAR);
4391 HRESULT hr;
4392
4394 valueW[ARRAY_SIZE(valueW) - 1] = UNICODE_NULL; /* Avoid buffer overrun */
4395
4396 if (RegQueryValueExW(hkey, valueW, NULL, NULL, (LPBYTE)bufferW, &dwSize) != ERROR_SUCCESS)
4397 return E_FAIL;
4398
4399 hr = SHLoadIndirectString(bufferW, bufferW, ARRAY_SIZE(bufferW), NULL);
4400 if (FAILED(hr))
4401 return hr;
4402
4403 WideCharToMultiByte(CP_ACP, 0, bufferW, -1, buf, size, NULL, NULL);
4404 if (size > 0)
4405 buf[size - 1] = ANSI_NULL; /* Avoid buffer overrun */
4406 return S_OK;
4407}
4408#endif
4409
4410/*************************************************************************
4411 * @ [SHLWAPI.439]
4412 */
4414{
4415 DWORD type, sz = size * sizeof(WCHAR);
4416
4417 if(RegQueryValueExW(hkey, value, NULL, &type, (LPBYTE)buf, &sz) != ERROR_SUCCESS)
4418 return E_FAIL;
4419
4421}
4422
4423/*************************************************************************
4424 * @ [SHLWAPI.478]
4425 *
4426 * Call IInputObject_TranslateAcceleratorIO() on an object.
4427 *
4428 * PARAMS
4429 * lpUnknown [I] Object supporting the IInputObject interface.
4430 * lpMsg [I] Key message to be processed.
4431 *
4432 * RETURNS
4433 * Success: S_OK.
4434 * Failure: An HRESULT error code, or E_INVALIDARG if lpUnknown is NULL.
4435 */
4437{
4438 IInputObject* lpInput = NULL;
4439 HRESULT hRet = E_INVALIDARG;
4440
4441 TRACE("(%p,%p)\n", lpUnknown, lpMsg);
4442 if (lpUnknown)
4443 {
4444 hRet = IUnknown_QueryInterface(lpUnknown, &IID_IInputObject,
4445 (void**)&lpInput);
4446 if (SUCCEEDED(hRet) && lpInput)
4447 {
4448 hRet = IInputObject_TranslateAcceleratorIO(lpInput, lpMsg);
4449 IInputObject_Release(lpInput);
4450 }
4451 }
4452 return hRet;
4453}
4454
4455/*************************************************************************
4456 * @ [SHLWAPI.481]
4457 *
4458 * Call IInputObject_HasFocusIO() on an object.
4459 *
4460 * PARAMS
4461 * lpUnknown [I] Object supporting the IInputObject interface.
4462 *
4463 * RETURNS
4464 * Success: S_OK, if lpUnknown is an IInputObject object and has the focus,
4465 * or S_FALSE otherwise.
4466 * Failure: An HRESULT error code, or E_INVALIDARG if lpUnknown is NULL.
4467 */
4469{
4470 IInputObject* lpInput = NULL;
4471 HRESULT hRet = E_INVALIDARG;
4472
4473 TRACE("(%p)\n", lpUnknown);
4474 if (lpUnknown)
4475 {
4476 hRet = IUnknown_QueryInterface(lpUnknown, &IID_IInputObject,
4477 (void**)&lpInput);
4478 if (SUCCEEDED(hRet) && lpInput)
4479 {
4480 hRet = IInputObject_HasFocusIO(lpInput);
4481 IInputObject_Release(lpInput);
4482 }
4483 }
4484 return hRet;
4485}
4486
4487/*************************************************************************
4488 * ColorRGBToHLS [SHLWAPI.@]
4489 *
4490 * Convert an rgb COLORREF into the hls color space.
4491 *
4492 * PARAMS
4493 * cRGB [I] Source rgb value
4494 * pwHue [O] Destination for converted hue
4495 * pwLuminance [O] Destination for converted luminance
4496 * pwSaturation [O] Destination for converted saturation
4497 *
4498 * RETURNS
4499 * Nothing. pwHue, pwLuminance and pwSaturation are set to the converted
4500 * values.
4501 *
4502 * NOTES
4503 * Output HLS values are constrained to the range (0..240).
4504 * For Achromatic conversions, Hue is set to 160.
4505 */
4507 LPWORD pwLuminance, LPWORD pwSaturation)
4508{
4509 int wR, wG, wB, wMax, wMin, wHue, wLuminosity, wSaturation;
4510
4511 TRACE("(%08x,%p,%p,%p)\n", cRGB, pwHue, pwLuminance, pwSaturation);
4512
4513 wR = GetRValue(cRGB);
4514 wG = GetGValue(cRGB);
4515 wB = GetBValue(cRGB);
4516
4517 wMax = max(wR, max(wG, wB));
4518 wMin = min(wR, min(wG, wB));
4519
4520 /* Luminosity */
4521 wLuminosity = ((wMax + wMin) * 240 + 255) / 510;
4522
4523 if (wMax == wMin)
4524 {
4525 /* Achromatic case */
4526 wSaturation = 0;
4527 /* Hue is now unrepresentable, but this is what native returns... */
4528 wHue = 160;
4529 }
4530 else
4531 {
4532 /* Chromatic case */
4533 int wDelta = wMax - wMin, wRNorm, wGNorm, wBNorm;
4534
4535 /* Saturation */
4536 if (wLuminosity <= 120)
4537 wSaturation = ((wMax + wMin)/2 + wDelta * 240) / (wMax + wMin);
4538 else
4539 wSaturation = ((510 - wMax - wMin)/2 + wDelta * 240) / (510 - wMax - wMin);
4540
4541 /* Hue */
4542 wRNorm = (wDelta/2 + wMax * 40 - wR * 40) / wDelta;
4543 wGNorm = (wDelta/2 + wMax * 40 - wG * 40) / wDelta;
4544 wBNorm = (wDelta/2 + wMax * 40 - wB * 40) / wDelta;
4545
4546 if (wR == wMax)
4547 wHue = wBNorm - wGNorm;
4548 else if (wG == wMax)
4549 wHue = 80 + wRNorm - wBNorm;
4550 else
4551 wHue = 160 + wGNorm - wRNorm;
4552 if (wHue < 0)
4553 wHue += 240;
4554 else if (wHue > 240)
4555 wHue -= 240;
4556 }
4557 if (pwHue)
4558 *pwHue = wHue;
4559 if (pwLuminance)
4560 *pwLuminance = wLuminosity;
4561 if (pwSaturation)
4562 *pwSaturation = wSaturation;
4563}
4564
4565#ifdef __REACTOS__
4566typedef struct tagLOGPALETTEMAX /* Compatible with LOGPALETTE but extended */
4567{
4570 PALETTEENTRY palPalEntry[256];
4571} LOGPALETTEMAX, *PLOGPALETTEMAX;
4572#endif
4573
4574/*************************************************************************
4575 * SHCreateShellPalette [SHLWAPI.@]
4576 */
4577#ifdef __REACTOS__
4578HPALETTE WINAPI
4580{
4581 HDC hdcMem;
4582 HPALETTE hHalftonePalette;
4583 LOGPALETTEMAX data;
4584 const UINT nExtractCount = 10;
4585 const UINT nSecondBlockStart = _countof(data.palPalEntry) - nExtractCount;
4586
4587 TRACE("(%p)\n", hdc);
4588
4589 /* Get the colors of the halftone palette */
4590 hHalftonePalette = CreateHalftonePalette(hdc);
4591 if (!hHalftonePalette)
4592 return NULL;
4593 data.palVersion = 0x300;
4594 data.palNumEntries = GetPaletteEntries(hHalftonePalette, 0,
4595 _countof(data.palPalEntry), data.palPalEntry);
4596 DeleteObject(hHalftonePalette);
4597
4599
4600 if (hdcMem)
4601 {
4602 /* The first 10 and last 10 entries in the system colors are considered important */
4603 GetSystemPaletteEntries(hdcMem, 0, nExtractCount, data.palPalEntry);
4604 GetSystemPaletteEntries(hdcMem, nSecondBlockStart, nExtractCount,
4605 &data.palPalEntry[nSecondBlockStart]);
4606 }
4607
4608 if (hdcMem && hdc != hdcMem)
4610
4611 /* Create a palette from the modified color entries */
4612 return CreatePalette((PLOGPALETTE)&data);
4613}
4614#else
4616{
4617 FIXME("stub\n");
4618 return CreateHalftonePalette(hdc);
4619}
4620#endif
4621
4622/*************************************************************************
4623 * SHGetInverseCMAP (SHLWAPI.@)
4624 *
4625 * Get an inverse color map table.
4626 *
4627 * PARAMS
4628 * lpCmap [O] Destination for color map
4629 * dwSize [I] Size of memory pointed to by lpCmap
4630 *
4631 * RETURNS
4632 * Success: S_OK.
4633 * Failure: E_POINTER, If lpCmap is invalid.
4634 * E_INVALIDARG, If dwFlags is invalid
4635 * E_OUTOFMEMORY, If there is no memory available
4636 *
4637 * NOTES
4638 * dwSize may only be CMAP_PTR_SIZE (4) or CMAP_SIZE (8192).
4639 * If dwSize = CMAP_PTR_SIZE, *lpCmap is set to the address of this DLL's
4640 * internal CMap.
4641 * If dwSize = CMAP_SIZE, lpCmap is filled with a copy of the data from
4642 * this DLL's internal CMap.
4643 */
4645{
4646 if (dwSize == 4) {
4647 FIXME(" - returning bogus address for SHGetInverseCMAP\n");
4648 *dest = (DWORD)0xabba1249;
4649 return 0;
4650 }
4651 FIXME("(%p, %#x) stub\n", dest, dwSize);
4652 return 0;
4653}
4654
4655/*************************************************************************
4656 * SHIsLowMemoryMachine [SHLWAPI.@]
4657 *
4658 * Determine if the current computer has low memory.
4659 *
4660 * PARAMS
4661 * dwType [I] Zero.
4662 *
4663 * RETURNS
4664 * TRUE if the users machine has 16 Megabytes of memory or less,
4665 * FALSE otherwise.
4666 */
4668{
4669#ifdef __REACTOS__
4671 static int is_low = -1;
4672 TRACE("(0x%08x)\n", dwType);
4673 if (dwType == 0 && is_low == -1)
4674 {
4676 is_low = (status.dwTotalPhys <= 0x1000000);
4677 }
4678 return is_low;
4679#else
4680 FIXME("(0x%08x) stub\n", dwType);
4681 return FALSE;
4682#endif
4683}
4684
4685/*************************************************************************
4686 * GetMenuPosFromID [SHLWAPI.@]
4687 *
4688 * Return the position of a menu item from its Id.
4689 *
4690 * PARAMS
4691 * hMenu [I] Menu containing the item
4692 * wID [I] Id of the menu item
4693 *
4694 * RETURNS
4695 * Success: The index of the menu item in hMenu.
4696 * Failure: -1, If the item is not found.
4697 */
4699{
4701 INT nCount = GetMenuItemCount(hMenu), nIter = 0;
4702
4703 TRACE("%p %u\n", hMenu, wID);
4704
4705 while (nIter < nCount)
4706 {
4707 mi.cbSize = sizeof(mi);
4708 mi.fMask = MIIM_ID;
4709 if (GetMenuItemInfoW(hMenu, nIter, TRUE, &mi) && mi.wID == wID)
4710 {
4711 TRACE("ret %d\n", nIter);
4712 return nIter;
4713 }
4714 nIter++;
4715 }
4716
4717 return -1;
4718}
4719
4720/*************************************************************************
4721 * @ [SHLWAPI.179]
4722 *
4723 * Same as SHLWAPI.GetMenuPosFromID
4724 */
4726{
4727 TRACE("%p %u\n", hMenu, uID);
4728 return GetMenuPosFromID(hMenu, uID);
4729}
4730
4731
4732/*************************************************************************
4733 * @ [SHLWAPI.448]
4734 */
4736{
4737 while (*lpwstr)
4738 {
4739 if (*lpwstr == '/')
4740 *lpwstr = '\\';
4741 lpwstr++;
4742 }
4743}
4744
4745#ifndef __REACTOS__ /* See appcompat.c */
4746/*************************************************************************
4747 * @ [SHLWAPI.461]
4748 */
4750{
4751 FIXME("(0x%08x) stub\n", dwUnknown);
4752 return 0;
4753}
4754#endif
4755
4756/*************************************************************************
4757 * @ [SHLWAPI.549]
4758 */
4760 DWORD dwClsContext, REFIID iid, LPVOID *ppv)
4761{
4762 return CoCreateInstance(rclsid, pUnkOuter, dwClsContext, iid, ppv);
4763}
4764
4765/*************************************************************************
4766 * SHSkipJunction [SHLWAPI.@]
4767 *
4768 * Determine if a bind context can be bound to an object
4769 *
4770 * PARAMS
4771 * pbc [I] Bind context to check
4772 * pclsid [I] CLSID of object to be bound to
4773 *
4774 * RETURNS
4775 * TRUE: If it is safe to bind
4776 * FALSE: If pbc is invalid or binding would not be safe
4777 *
4778 */
4780{
4781 static WCHAR szSkipBinding[] = { 'S','k','i','p',' ',
4782 'B','i','n','d','i','n','g',' ','C','L','S','I','D','\0' };
4783 BOOL bRet = FALSE;
4784
4785 if (pbc)
4786 {
4787 IUnknown* lpUnk;
4788
4789 if (SUCCEEDED(IBindCtx_GetObjectParam(pbc, szSkipBinding, &lpUnk)))
4790 {
4791 CLSID clsid;
4792
4793 if (SUCCEEDED(IUnknown_GetClassID(lpUnk, &clsid)) &&
4794 IsEqualGUID(pclsid, &clsid))
4795 bRet = TRUE;
4796
4797 IUnknown_Release(lpUnk);
4798 }
4799 }
4800 return bRet;
4801}
4802
4803/***********************************************************************
4804 * SHGetShellKey (SHLWAPI.491)
4805 */
4807{
4808#ifndef __REACTOS__
4809 enum _shellkey_flags {
4810 SHKEY_Root_HKCU = 0x1,
4811 SHKEY_Root_HKLM = 0x2,
4812 SHKEY_Key_Explorer = 0x00,
4813 SHKEY_Key_Shell = 0x10,
4814 SHKEY_Key_ShellNoRoam = 0x20,
4815 SHKEY_Key_Classes = 0x30,
4816 SHKEY_Subkey_Default = 0x0000,
4818 SHKEY_Subkey_Handlers = 0x2000,
4820 SHKEY_Subkey_Volatile = 0x4000,
4821 SHKEY_Subkey_MUICache = 0x5000,
4822 SHKEY_Subkey_FileExts = 0x6000
4823 };
4824#endif
4825
4826 static const WCHAR explorerW[] = {'S','o','f','t','w','a','r','e','\\',
4827 'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
4828 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
4829 'E','x','p','l','o','r','e','r','\\'};
4830 static const WCHAR shellW[] = {'S','o','f','t','w','a','r','e','\\',
4831 'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
4832 'S','h','e','l','l','\\'};
4833 static const WCHAR shell_no_roamW[] = {'S','o','f','t','w','a','r','e','\\',
4834 'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
4835 'S','h','e','l','l','N','o','R','o','a','m','\\'};
4836 static const WCHAR classesW[] = {'S','o','f','t','w','a','r','e','\\',
4837 'C','l','a','s','s','e','s','\\'};
4838
4839 static const WCHAR localized_resource_nameW[] = {'L','o','c','a','l','i','z','e','d',
4840 'R','e','s','o','u','r','c','e','N','a','m','e','\\'};
4841 static const WCHAR handlersW[] = {'H','a','n','d','l','e','r','s','\\'};
4842 static const WCHAR associationsW[] = {'A','s','s','o','c','i','a','t','i','o','n','s','\\'};
4843 static const WCHAR volatileW[] = {'V','o','l','a','t','i','l','e','\\'};
4844 static const WCHAR mui_cacheW[] = {'M','U','I','C','a','c','h','e','\\'};
4845 static const WCHAR file_extsW[] = {'F','i','l','e','E','x','t','s','\\'};
4846
4847 WCHAR *path;
4848 const WCHAR *key, *subkey;
4849 int size_key, size_subkey, size_user;
4850 HKEY hkey = NULL;
4851
4852 TRACE("(0x%08x, %s, %d)\n", flags, debugstr_w(sub_key), create);
4853
4854 /* For compatibility with Vista+ */
4855 if(flags == 0x1ffff)
4856 flags = 0x21;
4857
4858 switch(flags&0xff0) {
4859 case SHKEY_Key_Explorer:
4860 key = explorerW;
4861 size_key = sizeof(explorerW);
4862 break;
4863 case SHKEY_Key_Shell:
4864 key = shellW;
4865 size_key = sizeof(shellW);
4866 break;
4868 key = shell_no_roamW;
4869 size_key = sizeof(shell_no_roamW);
4870 break;
4871 case SHKEY_Key_Classes:
4872 key = classesW;
4873 size_key = sizeof(classesW);
4874 break;
4875 default:
4876 FIXME("unsupported flags (0x%08x)\n", flags);
4877 return NULL;
4878 }
4879
4880 switch(flags&0xff000) {
4882 subkey = NULL;
4883 size_subkey = 0;
4884 break;
4886 subkey = localized_resource_nameW;
4887 size_subkey = sizeof(localized_resource_nameW);
4888 break;
4890 subkey = handlersW;
4891 size_subkey = sizeof(handlersW);
4892 break;
4894 subkey = associationsW;
4895 size_subkey = sizeof(associationsW);
4896 break;
4898 subkey = volatileW;
4899 size_subkey = sizeof(volatileW);
4900 break;
4902 subkey = mui_cacheW;
4903 size_subkey = sizeof(mui_cacheW);
4904 break;
4906 subkey = file_extsW;
4907 size_subkey = sizeof(file_extsW);
4908 break;
4909 default:
4910 FIXME("unsupported flags (0x%08x)\n", flags);
4911 return NULL;
4912 }
4913
4914 if(sub_key)
4915 size_user = lstrlenW(sub_key)*sizeof(WCHAR);
4916 else
4917 size_user = 0;
4918
4919 path = HeapAlloc(GetProcessHeap(), 0, size_key+size_subkey+size_user+sizeof(WCHAR));
4920 if(!path) {
4921 ERR("Out of memory\n");
4922 return NULL;
4923 }
4924
4925 memcpy(path, key, size_key);
4926 if(subkey)
4927 memcpy(path+size_key/sizeof(WCHAR), subkey, size_subkey);
4928 if(sub_key)
4929 memcpy(path+(size_key+size_subkey)/sizeof(WCHAR), sub_key, size_user);
4930 path[(size_key+size_subkey+size_user)/sizeof(WCHAR)] = '\0';
4931
4932 if(create)
4934 path, 0, NULL, 0, MAXIMUM_ALLOWED, NULL, &hkey, NULL);
4935 else
4937 path, 0, MAXIMUM_ALLOWED, &hkey);
4938
4940 return hkey;
4941}
4942
4943/***********************************************************************
4944 * SHQueueUserWorkItem (SHLWAPI.@)
4945 */
4947 LPVOID pContext, LONG lPriority, DWORD_PTR dwTag,
4948 DWORD_PTR *pdwId, LPCSTR pszModule, DWORD dwFlags)
4949{
4950 TRACE("(%p, %p, %d, %lx, %p, %s, %08x)\n", pfnCallback, pContext,
4951 lPriority, dwTag, pdwId, debugstr_a(pszModule), dwFlags);
4952
4953 if(lPriority || dwTag || pdwId || pszModule || dwFlags)
4954 FIXME("Unsupported arguments\n");
4955
4956 return QueueUserWorkItem(pfnCallback, pContext, 0);
4957}
4958
4959/***********************************************************************
4960 * SHSetTimerQueueTimer (SHLWAPI.263)
4961 */
4963 WAITORTIMERCALLBACK pfnCallback, LPVOID pContext, DWORD dwDueTime,
4964 DWORD dwPeriod, LPCSTR lpszLibrary, DWORD dwFlags)
4965{
4966 HANDLE hNewTimer;
4967
4968 /* SHSetTimerQueueTimer flags -> CreateTimerQueueTimer flags */
4969 if (dwFlags & TPS_LONGEXECTIME) {
4970 dwFlags &= ~TPS_LONGEXECTIME;
4972 }
4973 if (dwFlags & TPS_EXECUTEIO) {
4974 dwFlags &= ~TPS_EXECUTEIO;
4976 }
4977
4978 if (!CreateTimerQueueTimer(&hNewTimer, hQueue, pfnCallback, pContext,
4979 dwDueTime, dwPeriod, dwFlags))
4980 return NULL;
4981
4982 return hNewTimer;
4983}
4984
4985/***********************************************************************
4986 * IUnknown_OnFocusChangeIS (SHLWAPI.@)
4987 */
4989{
4990 IInputObjectSite *pIOS = NULL;
4991 HRESULT hRet = E_INVALIDARG;
4992
4993 TRACE("(%p, %p, %s)\n", lpUnknown, pFocusObject, bFocus ? "TRUE" : "FALSE");
4994
4995 if (lpUnknown)
4996 {
4997 hRet = IUnknown_QueryInterface(lpUnknown, &IID_IInputObjectSite,
4998 (void **)&pIOS);
4999 if (SUCCEEDED(hRet) && pIOS)
5000 {
5001 hRet = IInputObjectSite_OnFocusChangeIS(pIOS, pFocusObject, bFocus);
5003 }
5004 }
5005 return hRet;
5006}
5007
5008/***********************************************************************
5009 * SKAllocValueW (SHLWAPI.519)
5010 */
5013{
5014 DWORD ret, size;
5015 HKEY hkey;
5016
5017 TRACE("(0x%x, %s, %s, %p, %p, %p)\n", flags, debugstr_w(subkey),
5019
5020 hkey = SHGetShellKey(flags, subkey, FALSE);
5021 if (!hkey)
5023
5024 ret = SHQueryValueExW(hkey, value, NULL, type, NULL, &size);
5025 if (ret) {
5026 RegCloseKey(hkey);
5027 return HRESULT_FROM_WIN32(ret);
5028 }
5029
5030 size += 2;
5031 *data = LocalAlloc(0, size);
5032 if (!*data) {
5033 RegCloseKey(hkey);
5034 return E_OUTOFMEMORY;
5035 }
5036
5037 ret = SHQueryValueExW(hkey, value, NULL, type, *data, &size);
5038 if (count)
5039 *count = size;
5040
5041 RegCloseKey(hkey);
5042 return HRESULT_FROM_WIN32(ret);
5043}
5044
5045/***********************************************************************
5046 * SKDeleteValueW (SHLWAPI.518)
5047 */
5049{
5050 DWORD ret;
5051 HKEY hkey;
5052
5053 TRACE("(0x%x, %s %s)\n", flags, debugstr_w(subkey), debugstr_w(value));
5054
5055 hkey = SHGetShellKey(flags, subkey, FALSE);
5056 if (!hkey)
5058
5059 ret = RegDeleteValueW(hkey, value);
5060
5061 RegCloseKey(hkey);
5062 return HRESULT_FROM_WIN32(ret);
5063}
5064
5065/***********************************************************************
5066 * SKGetValueW (SHLWAPI.516)
5067 */
5069 void *data, DWORD *count)
5070{
5071 DWORD ret;
5072 HKEY hkey;
5073
5074 TRACE("(0x%x, %s, %s, %p, %p, %p)\n", flags, debugstr_w(subkey),
5076
5077 hkey = SHGetShellKey(flags, subkey, FALSE);
5078 if (!hkey)
5080
5082
5083 RegCloseKey(hkey);
5084 return HRESULT_FROM_WIN32(ret);
5085}
5086
5087/***********************************************************************
5088 * SKSetValueW (SHLWAPI.516)
5089 */
5091 DWORD type, void *data, DWORD count)
5092{
5093 DWORD ret;
5094 HKEY hkey;
5095
5096 TRACE("(0x%x, %s, %s, %x, %p, %d)\n", flags, debugstr_w(subkey),
5098
5099 hkey = SHGetShellKey(flags, subkey, TRUE);
5100 if (!hkey)
5102
5103 ret = RegSetValueExW(hkey, value, 0, type, data, count);
5104
5105 RegCloseKey(hkey);
5106 return HRESULT_FROM_WIN32(ret);
5107}
5108
5110
5111/***********************************************************************
5112 * GetUIVersion (SHLWAPI.452)
5113 */
5115{
5116 static DWORD version;
5117
5118 if (!version)
5119 {
5120 DllGetVersion_func pDllGetVersion;
5121 HMODULE dll = LoadLibraryA("shell32.dll");
5122 if (!dll) return 0;
5123
5124 pDllGetVersion = (DllGetVersion_func)GetProcAddress(dll, "DllGetVersion");
5125 if (pDllGetVersion)
5126 {
5127 DLLVERSIONINFO dvi;
5128 dvi.cbSize = sizeof(DLLVERSIONINFO);
5129 if (pDllGetVersion(&dvi) == S_OK) version = dvi.dwMajorVersion;
5130 }
5131 FreeLibrary( dll );
5132 if (!version) version = 3; /* old shell dlls don't have DllGetVersion */
5133 }
5134 return version;
5135}
5136
5137/***********************************************************************
5138 * ShellMessageBoxWrapW [SHLWAPI.388]
5139 *
5140 * See shell32.ShellMessageBoxW
5141 *
5142#ifndef __REACTOS__
5143 *
5144 * NOTE:
5145 * shlwapi.ShellMessageBoxWrapW is a duplicate of shell32.ShellMessageBoxW
5146 * because we can't forward to it in the .spec file since it's exported by
5147 * ordinal. If you change the implementation here please update the code in
5148 * shell32 as well.
5149 *
5150#else // __REACTOS__
5151 *
5152 * From Vista+ onwards, all the implementation of ShellMessageBoxA/W that
5153 * were existing in shell32 has been completely moved to shlwapi, so that
5154 * shell32.ShellMessageBoxA and shell32.ShellMessageBoxW are redirections
5155 * to the corresponding shlwapi functions.
5156 *
5157 * For Win2003 compatibility, if you change the implementation here please
5158 * update the code of ShellMessageBoxA in shell32 as well.
5159 *
5160#endif
5161 */
5163 LPCWSTR lpCaption, UINT uType, ...)
5164{
5165 WCHAR *szText = NULL, szTitle[100];
5166 LPCWSTR pszText, pszTitle = szTitle;
5167 LPWSTR pszTemp;
5169 int ret;
5170
5171 __ms_va_start(args, uType);
5172
5173 TRACE("(%p,%p,%p,%p,%08x)\n", hInstance, hWnd, lpText, lpCaption, uType);
5174
5175 if (IS_INTRESOURCE(lpCaption))
5177 else
5178 pszTitle = lpCaption;
5179
5180 if (IS_INTRESOURCE(lpText))
5181 {
5182 const WCHAR *ptr;
5183 UINT len = LoadStringW(hInstance, LOWORD(lpText), (LPWSTR)&ptr, 0);
5184
5185 if (len)
5186 {
5187 szText = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR));
5188 if (szText) LoadStringW(hInstance, LOWORD(lpText), szText, len + 1);
5189 }
5190 pszText = szText;
5191 if (!pszText) {
5192 WARN("Failed to load id %d\n", LOWORD(lpText));
5194 return 0;
5195 }
5196 }
5197 else
5198 pszText = lpText;
5199
5201 pszText, 0, 0, (LPWSTR)&pszTemp, 0, &args);
5202
5204
5205#ifdef __REACTOS__
5206 uType |= MB_SETFOREGROUND;
5207#endif
5208 ret = MessageBoxW(hWnd, pszTemp, pszTitle, uType);
5209
5210 HeapFree(GetProcessHeap(), 0, szText);
5211 LocalFree(pszTemp);
5212 return ret;
5213}
5214
5215/***********************************************************************
5216 * ZoneComputePaneSize [SHLWAPI.382]
5217 */
5219{
5220 FIXME("\n");
5221 return 0x95;
5222}
5223
5224/***********************************************************************
5225 * SHChangeNotifyWrap [SHLWAPI.394]
5226 */
5227void WINAPI SHChangeNotifyWrap(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
5228{
5229 SHChangeNotify(wEventId, uFlags, dwItem1, dwItem2);
5230}
5231
5232typedef struct SHELL_USER_SID { /* according to MSDN this should be in shlobj.h... */
5237
5238typedef struct SHELL_USER_PERMISSION { /* ...and this should be in shlwapi.h */
5246
5247/***********************************************************************
5248 * GetShellSecurityDescriptor [SHLWAPI.475]
5249 *
5250 * prepares SECURITY_DESCRIPTOR from a set of ACEs
5251 *
5252 * PARAMS
5253 * apUserPerm [I] array of pointers to SHELL_USER_PERMISSION structures,
5254 * each of which describes permissions to apply
5255 * cUserPerm [I] number of entries in apUserPerm array
5256 *
5257 * RETURNS
5258 * success: pointer to SECURITY_DESCRIPTOR
5259 * failure: NULL
5260 *
5261 * NOTES
5262 * Call should free returned descriptor with LocalFree
5263 */
5265{
5266 PSID *sidlist;
5267 PSID cur_user = NULL;
5268 BYTE tuUser[2000];
5269 DWORD acl_size;
5270 int sid_count, i;
5272
5273 TRACE("%p %d\n", apUserPerm, cUserPerm);
5274
5275 if (apUserPerm == NULL || cUserPerm <= 0)
5276 return NULL;
5277
5278 sidlist = HeapAlloc(GetProcessHeap(), 0, cUserPerm * sizeof(PSID));
5279 if (!sidlist)
5280 return NULL;
5281
5282 acl_size = sizeof(ACL);
5283
5284 for(sid_count = 0; sid_count < cUserPerm; sid_count++)
5285 {
5286 static SHELL_USER_SID null_sid = {{SECURITY_NULL_SID_AUTHORITY}, 0, 0};
5287 PSHELL_USER_PERMISSION perm = apUserPerm[sid_count];
5288 PSHELL_USER_SID sid = &perm->susID;
5289 PSID pSid;
5290 BOOL ret = TRUE;
5291
5292 if (!memcmp((void*)sid, (void*)&null_sid, sizeof(SHELL_USER_SID)))
5293 { /* current user's SID */
5294 if (!cur_user)
5295 {
5296 HANDLE Token;
5297 DWORD bufsize = sizeof(tuUser);
5298
5300 if (ret)
5301 {
5302 ret = GetTokenInformation(Token, TokenUser, (void*)tuUser, bufsize, &bufsize );
5303 if (ret)
5304 cur_user = ((PTOKEN_USER)tuUser)->User.Sid;
5306 }
5307 }
5308 pSid = cur_user;
5309 } else if (sid->dwUserID==0) /* one sub-authority */
5310 ret = AllocateAndInitializeSid(&sid->sidAuthority, 1, sid->dwUserGroupID, 0,
5311 0, 0, 0, 0, 0, 0, &pSid);
5312 else
5313 ret = AllocateAndInitializeSid(&sid->sidAuthority, 2, sid->dwUserGroupID, sid->dwUserID,
5314 0, 0, 0, 0, 0, 0, &pSid);
5315 if (!ret)
5316 goto free_sids;
5317
5318 sidlist[sid_count] = pSid;
5319 /* increment acl_size (1 ACE for non-inheritable and 2 ACEs for inheritable records */
5320 acl_size += (sizeof(ACCESS_ALLOWED_ACE)-sizeof(DWORD) + GetLengthSid(pSid)) * (perm->fInherit ? 2 : 1);
5321 }
5322
5323 psd = LocalAlloc(0, sizeof(SECURITY_DESCRIPTOR) + acl_size);
5324
5325 if (psd != NULL)
5326 {
5327 PACL pAcl = (PACL)(((BYTE*)psd)+sizeof(SECURITY_DESCRIPTOR));
5328
5330 goto error;
5331
5332 if (!InitializeAcl(pAcl, acl_size, ACL_REVISION))
5333 goto error;
5334
5335 for(i = 0; i < sid_count; i++)
5336 {
5337 PSHELL_USER_PERMISSION sup = apUserPerm[i];
5338 PSID sid = sidlist[i];
5339
5340 switch(sup->dwAccessType)
5341 {
5344 goto error;
5345 if (sup->fInherit && !AddAccessAllowedAceEx(pAcl, ACL_REVISION,
5347 goto error;
5348 break;
5351 goto error;
5352 if (sup->fInherit && !AddAccessDeniedAceEx(pAcl, ACL_REVISION,
5354 goto error;
5355 break;
5356 default:
5357 goto error;
5358 }
5359 }
5360
5361 if (!SetSecurityDescriptorDacl(psd, TRUE, pAcl, FALSE))
5362 goto error;
5363 }
5364 goto free_sids;
5365
5366error:
5367 LocalFree(psd);
5368 psd = NULL;
5369free_sids:
5370 for(i = 0; i < sid_count; i++)
5371 {
5372 if (!cur_user || sidlist[i] != cur_user)
5373 FreeSid(sidlist[i]);
5374 }
5375 HeapFree(GetProcessHeap(), 0, sidlist);
5376
5377 return psd;
5378}
5379
5380#ifndef __REACTOS__ /* See propbag.cpp */
5381/***********************************************************************
5382 * SHCreatePropertyBagOnRegKey [SHLWAPI.471]
5383 *
5384 * Creates a property bag from a registry key
5385 *
5386 * PARAMS
5387 * hKey [I] Handle to the desired registry key
5388 * subkey [I] Name of desired subkey, or NULL to open hKey directly
5389 * grfMode [I] Optional flags
5390 * riid [I] IID of requested property bag interface
5391 * ppv [O] Address to receive pointer to the new interface
5392 *
5393 * RETURNS
5394 * success: 0
5395 * failure: error code
5396 *
5397 */
5399 DWORD grfMode, REFIID riid, void **ppv)
5400{
5401 FIXME("%p %s %d %s %p STUB\n", hKey, debugstr_w(subkey), grfMode,
5403
5404 return E_NOTIMPL;
5405}
5406#endif
5407
5408#ifndef __REACTOS__ /* See propbag.cpp */
5409/***********************************************************************
5410 * SHGetViewStatePropertyBag [SHLWAPI.515]
5411 *
5412 * Retrieves a property bag in which the view state information of a folder
5413 * can be stored.
5414 *
5415 * PARAMS
5416 * pidl [I] PIDL of the folder requested
5417 * bag_name [I] Name of the property bag requested
5418 * flags [I] Optional flags
5419 * riid [I] IID of requested property bag interface
5420 * ppv [O] Address to receive pointer to the new interface
5421 *
5422 * RETURNS
5423 * success: S_OK
5424 * failure: error code
5425 *
5426 */
5428 DWORD flags, REFIID riid, void **ppv)
5429{
5430 FIXME("%p %s %d %s %p STUB\n", pidl, debugstr_w(bag_name), flags,
5432
5433 return E_NOTIMPL;
5434}
5435#endif
5436
5437/***********************************************************************
5438 * SHFormatDateTimeW [SHLWAPI.354]
5439 *
5440 * Produces a string representation of a time.
5441 *
5442 * PARAMS
5443 * fileTime [I] Pointer to FILETIME structure specifying the time
5444 * flags [I] Flags specifying the desired output
5445 * buf [O] Pointer to buffer for output
5446 * size [I] Number of characters that can be contained in buffer
5447 *
5448 * RETURNS
5449 * success: number of characters written to the buffer
5450 * failure: 0
5451 *
5452 */
5455{
5456#define SHFORMATDT_UNSUPPORTED_FLAGS (FDTF_RELATIVE | FDTF_LTRDATE | FDTF_RTLDATE | FDTF_NOAUTOREADINGORDER)
5457 DWORD fmt_flags = flags ? *flags : FDTF_DEFAULT;
5458 SYSTEMTIME st;
5459 FILETIME ft;
5460 INT ret = 0;
5461
5462 TRACE("%p %p %p %u\n", fileTime, flags, buf, size);
5463
5464 if (!buf || !size)
5465 return 0;
5466
5467 if (fmt_flags & SHFORMATDT_UNSUPPORTED_FLAGS)
5468 FIXME("ignoring some flags - 0x%08x\n", fmt_flags & SHFORMATDT_UNSUPPORTED_FLAGS);
5469
5470 FileTimeToLocalFileTime(fileTime, &ft);
5471 FileTimeToSystemTime(&ft, &st);
5472
5473 /* first of all date */
5474 if (fmt_flags & (FDTF_LONGDATE | FDTF_SHORTDATE))
5475 {
5476 static const WCHAR sep1[] = {',',' ',0};
5477 static const WCHAR sep2[] = {' ',0};
5478
5481 if (ret >= size) return ret;
5482
5483 /* add separator */
5484 if (ret < size && (fmt_flags & (FDTF_LONGTIME | FDTF_SHORTTIME)))
5485 {
5486 if ((fmt_flags & FDTF_LONGDATE) && (ret < size + 2))
5487 {
5488 lstrcatW(&buf[ret-1], sep1);
5489 ret += 2;
5490 }
5491 else
5492 {
5493 lstrcatW(&buf[ret-1], sep2);
5494 ret++;
5495 }
5496 }
5497 }
5498 /* time part */
5499 if (fmt_flags & (FDTF_LONGTIME | FDTF_SHORTTIME))
5500 {
5501 DWORD time = fmt_flags & FDTF_LONGTIME ? 0 : TIME_NOSECONDS;
5502
5503 if (ret) ret--;
5505 }
5506
5507 return ret;
5508
5509#undef SHFORMATDT_UNSUPPORTED_FLAGS
5510}
5511
5512/***********************************************************************
5513 * SHFormatDateTimeA [SHLWAPI.353]
5514 *
5515 * See SHFormatDateTimeW.
5516 *
5517 */
5519 LPSTR buf, UINT size)
5520{
5521 WCHAR *bufW;
5522 INT retval;
5523
5524 if (!buf || !size)
5525 return 0;
5526
5527 bufW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * size);
5528 retval = SHFormatDateTimeW(fileTime, flags, bufW, size);
5529
5530 if (retval != 0)
5531 WideCharToMultiByte(CP_ACP, 0, bufW, -1, buf, size, NULL, NULL);
5532
5533 HeapFree(GetProcessHeap(), 0, bufW);
5534 return retval;
5535}
5536
5537/***********************************************************************
5538 * ZoneCheckUrlExW [SHLWAPI.231]
5539 *
5540 * Checks the details of the security zone for the supplied site. (?)
5541 *
5542 * PARAMS
5543 *
5544 * szURL [I] Pointer to the URL to check
5545 *
5546 * Other parameters currently unknown.
5547 *
5548 * RETURNS
5549 * unknown
5550 */
5551
5553 DWORD dwUnknown3, DWORD dwUnknown4, DWORD dwUnknown5, DWORD dwUnknown6,
5554 DWORD dwUnknown7)
5555{
5556 FIXME("(%s,%p,%x,%x,%x,%x,%x,%x) STUB\n", debugstr_w(szURL), pUnknown, dwUnknown2,
5557 dwUnknown3, dwUnknown4, dwUnknown5, dwUnknown6, dwUnknown7);
5558
5559 return 0;
5560}
5561
5562/***********************************************************************
5563 * SHVerbExistsNA [SHLWAPI.196]
5564 *
5565 *
5566 * PARAMS
5567 *
5568 * verb [I] a string, often appears to be an extension.
5569 *
5570 * Other parameters currently unknown.
5571 *
5572 * RETURNS
5573 * unknown
5574 */
5576{
5577 FIXME("(%s, %p, %p, %i) STUB\n",verb, pUnknown, pUnknown2, dwUnknown3);
5578 return 0;
5579}
5580
5581/*************************************************************************
5582 * @ [SHLWAPI.538]
5583 *
5584 * Undocumented: Implementation guessed at via Name and behavior
5585 *
5586 * PARAMS
5587 * lpUnknown [I] Object to get an IServiceProvider interface from
5588 * riid [I] Function requested for QueryService call
5589 * lppOut [O] Destination for the service interface pointer
5590 *
5591 * RETURNS
5592 * Success: S_OK. lppOut contains an object providing the requested service
5593 * Failure: An HRESULT error code
5594 *
5595 * NOTES
5596 * lpUnknown is expected to support the IServiceProvider interface.
5597 */
5599 REFGUID riid, LPVOID *lppOut)
5600{
5601 FIXME("%p %s %p semi-STUB\n", lpUnknown, debugstr_guid(riid), lppOut);
5602 return IUnknown_QueryService(lpUnknown,&IID_IWebBrowserApp,riid,lppOut);
5603}
5604
5605#ifdef __REACTOS__
5606HRESULT VariantChangeTypeForRead(_Inout_ VARIANTARG *pvarg, _In_ VARTYPE vt)
5607{
5608 HRESULT hr;
5609 VARIANTARG vargTemp;
5610 VARIANT variTemp;
5611
5612 if (V_VT(pvarg) == vt || vt == VT_EMPTY)
5613 return S_OK;
5614
5615 vargTemp = *pvarg;
5616
5617 if (V_VT(&vargTemp) != VT_BSTR || vt <= VT_NULL)
5618 goto DoDefault;
5619
5620 if (vt == VT_I1 || vt == VT_I2 || vt == VT_I4)
5621 {
5622 if (!StrToIntExW(V_BSTR(&vargTemp), STIF_SUPPORT_HEX, (int*)&V_I4(&variTemp)))
5623 goto DoDefault;
5624
5625 V_VT(&variTemp) = VT_INT;
5626 VariantInit(pvarg);
5627 hr = VariantChangeType(pvarg, &variTemp, 0, vt);
5628 VariantClear(&vargTemp);
5629 return hr;
5630 }
5631
5632 if (vt <= VT_DECIMAL)
5633 goto DoDefault;
5634
5635 if (vt == VT_UI1 || vt == VT_UI2 || vt == VT_UI4)
5636 {
5637 if (!StrToIntExW(V_BSTR(&vargTemp), STIF_SUPPORT_HEX, (int*)&V_UI4(&variTemp)))
5638 goto DoDefault;
5639
5640 V_VT(&variTemp) = VT_UINT;
5641 VariantInit(pvarg);
5642 hr = VariantChangeType(pvarg, &variTemp, 0, vt);
5643 VariantClear(&vargTemp);
5644 return hr;
5645 }
5646
5647 if (vt == VT_INT || vt == VT_UINT)
5648 {
5649 if (!StrToIntExW(V_BSTR(&vargTemp), STIF_SUPPORT_HEX, (int*)&V_INT(&variTemp)))
5650 goto DoDefault;
5651
5652 V_VT(&variTemp) = VT_UINT;
5653 VariantInit(pvarg);
5654 hr = VariantChangeType(pvarg, &variTemp, 0, vt);
5655 VariantClear(&vargTemp);
5656 return hr;
5657 }
5658
5659DoDefault:
5660 VariantInit(pvarg);
5661 hr = VariantChangeType(pvarg, &vargTemp, 0, vt);
5662 VariantClear(&vargTemp);
5663 return hr;
5664}
5665
5666BOOL
5667VariantArrayToBuffer(
5668 _In_ const VARIANT *pvarIn,
5669 _Out_writes_(cbSize) LPVOID pvDest,
5670 _In_ SIZE_T cbSize)
5671{
5672 LPVOID pvData;
5673 LONG LowerBound, UpperBound;
5674 LPSAFEARRAY pArray;
5675
5676 /* Only supports byte array */
5677 if (!pvarIn || V_VT(pvarIn) != (VT_UI1 | VT_ARRAY))
5678 return FALSE;
5679
5680 /* Boundary check and access */
5681 pArray = V_ARRAY(pvarIn);
5682 if (SafeArrayGetDim(pArray) == 1 &&
5683 SUCCEEDED(SafeArrayGetLBound(pArray, 1, &LowerBound)) &&
5684 SUCCEEDED(SafeArrayGetUBound(pArray, 1, &UpperBound)) &&
5685 ((LONG)cbSize <= UpperBound - LowerBound + 1) &&
5687 {
5688 CopyMemory(pvDest, pvData, cbSize);
5689 SafeArrayUnaccessData(pArray);
5690 return TRUE; /* Success */
5691 }
5692
5693 return FALSE; /* Failure */
5694}
5695
5696/**************************************************************************
5697 * SHPropertyBag_ReadType (SHLWAPI.493)
5698 *
5699 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readtype.htm
5700 */
5703{
5704 HRESULT hr;
5705
5706 VariantInit(pvarg);
5707 V_VT(pvarg) = vt;
5708
5709 hr = IPropertyBag_Read(ppb, pszPropName, pvarg, NULL);
5710 if (FAILED(hr))
5711 {
5712 ERR("%p %s\n", ppb, debugstr_w(pszPropName));
5713 VariantInit(pvarg);
5714 return hr;
5715 }
5716
5717 return VariantChangeTypeForRead(pvarg, vt);
5718}
5719
5720/**************************************************************************
5721 * SHPropertyBag_ReadBOOL (SHLWAPI.534)
5722 *
5723 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readbool.htm
5724 */
5725HRESULT WINAPI SHPropertyBag_ReadBOOL(IPropertyBag *ppb, LPCWSTR pszPropName, BOOL *pbValue)
5726{
5727 HRESULT hr;
5728 VARIANTARG varg;
5729
5730 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), pbValue);
5731
5732 if (!ppb || !pszPropName || !pbValue)
5733 {
5734 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), pbValue);
5735 return E_INVALIDARG;
5736 }
5737
5738 hr = SHPropertyBag_ReadType(ppb, pszPropName, &varg, VT_BOOL);
5739 if (SUCCEEDED(hr))
5740 *pbValue = (V_BOOL(&varg) == VARIANT_TRUE);
5741
5742 return hr;
5743}
5744
5745/**************************************************************************
5746 * SHPropertyBag_ReadBOOLOld (SHLWAPI.498)
5747 *
5748 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readboolold.htm
5749 */
5750BOOL WINAPI SHPropertyBag_ReadBOOLOld(IPropertyBag *ppb, LPCWSTR pszPropName, BOOL bDefValue)
5751{
5752 VARIANTARG varg;
5753 HRESULT hr;
5754
5755 TRACE("%p %s %d\n", ppb, debugstr_w(pszPropName), bDefValue);
5756
5757 hr = SHPropertyBag_ReadType(ppb, pszPropName, &varg, VT_BOOL);
5758 if (FAILED(hr))
5759 return bDefValue;
5760
5761 return V_BOOL(&varg) == VARIANT_TRUE;
5762}
5763
5764/**************************************************************************
5765 * SHPropertyBag_ReadSHORT (SHLWAPI.527)
5766 *
5767 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readshort.htm
5768 */
5770{
5771 HRESULT hr;
5772 VARIANTARG varg;
5773
5774 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), psValue);
5775
5776 if (!ppb || !pszPropName || !psValue)
5777 {
5778 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), psValue);
5779 return E_INVALIDARG;
5780 }
5781
5782 hr = SHPropertyBag_ReadType(ppb, pszPropName, &varg, VT_UI2);
5783 if (SUCCEEDED(hr))
5784 *psValue = V_UI2(&varg);
5785
5786 return hr;
5787}
5788#endif
5789
5790/**************************************************************************
5791 * SHPropertyBag_ReadLONG (SHLWAPI.496)
5792 *
5793 * This function asks a property bag to read a named property as a LONG.
5794 *
5795 * PARAMS
5796 * ppb: a IPropertyBag interface
5797 * pszPropName: Unicode string that names the property
5798 * pValue: address to receive the property value as a 32-bit signed integer
5799 *
5800 * RETURNS
5801 * HRESULT codes
5802#ifdef __REACTOS__
5803 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readlong.htm
5804#endif
5805 */
5807{
5808#ifdef __REACTOS__
5809 HRESULT hr;
5810 VARIANTARG varg;
5811
5812 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), pValue);
5813
5814 if (!ppb || !pszPropName || !pValue)
5815 {
5816 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), pValue);
5817 return E_INVALIDARG;
5818 }
5819
5820 hr = SHPropertyBag_ReadType(ppb, pszPropName, &varg, VT_I4);
5821 if (SUCCEEDED(hr))
5822 *pValue = V_I4(&varg);
5823#else
5824 VARIANT var;
5825 HRESULT hr;
5826 TRACE("%p %s %p\n", ppb,debugstr_w(pszPropName),pValue);
5827 if (!pszPropName || !ppb || !pValue)
5828 return E_INVALIDARG;
5829 V_VT(&var) = VT_I4;
5830 hr = IPropertyBag_Read(ppb, pszPropName, &var, NULL);
5831 if (SUCCEEDED(hr))
5832 {
5833 if (V_VT(&var) == VT_I4)
5834 *pValue = V_I4(&var);
5835 else
5837 }
5838#endif
5839 return hr;
5840}
5841
5842#ifdef __REACTOS__
5843/**************************************************************************
5844 * SHPropertyBag_ReadDWORD (SHLWAPI.507)
5845 *
5846 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readdword.htm
5847 */
5848HRESULT WINAPI SHPropertyBag_ReadDWORD(IPropertyBag *ppb, LPCWSTR pszPropName, DWORD *pdwValue)
5849{
5850 HRESULT hr;
5851 VARIANTARG varg;
5852
5853 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), pdwValue);
5854
5855 if (!ppb || !pszPropName || !pdwValue)
5856 {
5857 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), pdwValue);
5858 return E_INVALIDARG;
5859 }
5860
5861 hr = SHPropertyBag_ReadType(ppb, pszPropName, &varg, VT_UI4);
5862 if (SUCCEEDED(hr))
5863 *pdwValue = V_UI4(&varg);
5864
5865 return hr;
5866}
5867
5868/**************************************************************************
5869 * SHPropertyBag_ReadBSTR (SHLWAPI.520)
5870 *
5871 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readbstr.htm
5872 */
5874{
5875 HRESULT hr;
5876 VARIANTARG varg;
5877
5878 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), pbstr);
5879
5880 if (!ppb || !pszPropName || !pbstr)
5881 {
5882 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), pbstr);
5883 return E_INVALIDARG;
5884 }
5885
5886 hr = SHPropertyBag_ReadType(ppb, pszPropName, &varg, VT_BSTR);
5887 if (FAILED(hr))
5888 *pbstr = NULL;
5889 else
5890 *pbstr = V_BSTR(&varg);
5891
5892 return hr;
5893}
5894
5895/**************************************************************************
5896 * SHPropertyBag_ReadStr (SHLWAPI.494)
5897 *
5898 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readstr.htm
5899 */
5901{
5902 HRESULT hr;
5903 VARIANTARG varg;
5904
5905 TRACE("%p %s %p %d\n", ppb, debugstr_w(pszPropName), pszDst, cchMax);
5906
5907 if (!ppb || !pszPropName || !pszDst)
5908 {
5909 ERR("%p %s %p %d\n", ppb, debugstr_w(pszPropName), pszDst, cchMax);
5910 return E_INVALIDARG;
5911 }
5912
5913 hr = SHPropertyBag_ReadType(ppb, pszPropName, &varg, VT_BSTR);
5914 if (FAILED(hr))
5915 return E_FAIL;
5916
5917 StrCpyNW(pszDst, V_BSTR(&varg), cchMax);
5918 VariantClear(&varg);
5919 return hr;
5920}
5921
5922/**************************************************************************
5923 * SHPropertyBag_ReadPOINTL (SHLWAPI.521)
5924 *
5925 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readpointl.htm
5926 */
5928{
5929 HRESULT hr;
5930 int cch, cch2;
5931 WCHAR *pch, szBuff[MAX_PATH];
5932
5933 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), pptl);
5934
5935 if (!ppb || !pszPropName || !pptl)
5936 {
5937 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), pptl);
5938 return E_INVALIDARG;
5939 }
5940
5941 StrCpyNW(szBuff, pszPropName, _countof(szBuff));
5942
5943 cch = lstrlenW(szBuff);
5944 cch2 = _countof(szBuff) - cch;
5945 if (cch2 < _countof(L".x"))
5946 {
5947 ERR("%s is too long\n", debugstr_w(pszPropName));
5948 return E_FAIL;
5949 }
5950
5951 pch = &szBuff[cch];
5952
5953 StrCpyNW(pch, L".x", cch2);
5954 hr = SHPropertyBag_ReadLONG(ppb, szBuff, &pptl->x);
5955 if (FAILED(hr))
5956 return hr;
5957
5958 StrCpyNW(pch, L".y", cch2);
5959 return SHPropertyBag_ReadLONG(ppb, szBuff, &pptl->y);
5960}
5961
5962/**************************************************************************
5963 * SHPropertyBag_ReadPOINTS (SHLWAPI.525)
5964 *
5965 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readpoints.htm
5966 */
5968{
5969 HRESULT hr;
5970 POINTL ptl;
5971
5972 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), ppts);
5973
5974 if (!ppb || !pszPropName || !ppts)
5975 {
5976 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), ppts);
5977 return E_INVALIDARG;
5978 }
5979
5980 hr = SHPropertyBag_ReadPOINTL(ppb, pszPropName, &ptl);
5981 if (FAILED(hr))
5982 return hr;
5983
5984 ppts->x = ptl.x;
5985 ppts->y = ptl.y;
5986 return hr;
5987}
5988
5989/**************************************************************************
5990 * SHPropertyBag_ReadRECTL (SHLWAPI.523)
5991 *
5992 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readrectl.htm
5993 */
5995{
5996 HRESULT hr;
5997 int cch, cch2;
5998 WCHAR *pch, szBuff[MAX_PATH];
5999
6000 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), prcl);
6001
6002 if (!ppb || !pszPropName || !prcl)
6003 {
6004 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), prcl);
6005 return E_INVALIDARG;
6006 }
6007
6008 StrCpyNW(szBuff, pszPropName, _countof(szBuff));
6009
6010 cch = lstrlenW(szBuff);
6011 cch2 = _countof(szBuff) - cch;
6012 if (cch2 < _countof(L".bottom"))
6013 {
6014 ERR("%s is too long\n", debugstr_w(pszPropName));
6015 return E_FAIL;
6016 }
6017
6018 pch = &szBuff[cch];
6019
6020 StrCpyNW(pch, L".left", cch2);
6021 hr = SHPropertyBag_ReadLONG(ppb, szBuff, &prcl->left);
6022 if (FAILED(hr))
6023 return hr;
6024
6025 StrCpyNW(pch, L".top", cch2);
6026 hr = SHPropertyBag_ReadLONG(ppb, szBuff, &prcl->top);
6027 if (FAILED(hr))
6028 return hr;
6029
6030 StrCpyNW(pch, L".right", cch2);
6031 hr = SHPropertyBag_ReadLONG(ppb, szBuff, &prcl->right);
6032 if (FAILED(hr))
6033 return hr;
6034
6035 StrCpyNW(pch, L".bottom", cch2);
6036 return SHPropertyBag_ReadLONG(ppb, szBuff, &prcl->bottom);
6037}
6038
6039/**************************************************************************
6040 * SHPropertyBag_ReadGUID (SHLWAPI.505)
6041 *
6042 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readguid.htm
6043 */
6045{
6046 HRESULT hr;
6047 BOOL bRet;
6048 VARIANT vari;
6049
6050 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), pguid);
6051
6052 if (!ppb || !pszPropName || !pguid)
6053 {
6054 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), pguid);
6055 return E_INVALIDARG;
6056 }
6057
6058 hr = SHPropertyBag_ReadType(ppb, pszPropName, &vari, VT_EMPTY);
6059 if (FAILED(hr))
6060 {
6061 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), pguid);
6062 return hr;
6063 }
6064
6065 if (V_VT(&vari) == (VT_UI1 | VT_ARRAY)) /* Byte Array */
6066 bRet = VariantArrayToBuffer(&vari, pguid, sizeof(*pguid));
6067 else if (V_VT(&vari) == VT_BSTR)
6068 bRet = GUIDFromStringW(V_BSTR(&vari), pguid);
6069 else
6070#if (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
6071 bRet = FALSE;
6072#else
6073 bRet = TRUE; /* This is by design in WinXP/Win2k3. */
6074#endif
6075
6076 if (!bRet)
6077 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), pguid);
6078
6079 VariantClear(&vari);
6080 return (bRet ? S_OK : E_FAIL);
6081}
6082
6083/**************************************************************************
6084 * SHPropertyBag_ReadStream (SHLWAPI.531)
6085 *
6086 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readstream.htm
6087 */
6089{
6090 HRESULT hr;
6091 VARIANT vari;
6092
6093 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), ppStream);
6094
6095 if (!ppb || !pszPropName || !ppStream)
6096 {
6097 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), ppStream);
6098 return E_INVALIDARG;
6099 }
6100
6101 hr = SHPropertyBag_ReadType(ppb, pszPropName, &vari, VT_UNKNOWN);
6102 if (FAILED(hr))
6103 return hr;
6104
6105 hr = IUnknown_QueryInterface(V_UNKNOWN(&vari), &IID_IStream, (void **)ppStream);
6106 IUnknown_Release(V_UNKNOWN(&vari));
6107
6108 return hr;
6109}
6110
6111/**************************************************************************
6112 * SHPropertyBag_Delete (SHLWAPI.535)
6113 *
6114 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/delete.htm
6115 */
6117{
6118 VARIANT vari;
6119
6120 TRACE("%p %s\n", ppb, debugstr_w(pszPropName));
6121
6122 if (!ppb || !pszPropName)
6123 {
6124 ERR("%p %s\n", ppb, debugstr_w(pszPropName));
6125 return E_INVALIDARG;
6126 }
6127
6128 V_VT(&vari) = VT_EMPTY;
6129 return IPropertyBag_Write(ppb, pszPropName, &vari);
6130}
6131
6132/**************************************************************************
6133 * SHPropertyBag_WriteBOOL (SHLWAPI.499)
6134 *
6135 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/writebool.htm
6136 */
6138{
6139 VARIANT vari;
6140
6141 TRACE("%p %s %d\n", ppb, debugstr_w(pszPropName), bValue);
6142
6143 if (!ppb || !pszPropName)
6144 {
6145 ERR("%p %s\n", ppb, debugstr_w(pszPropName));
6146 return E_INVALIDARG;
6147 }
6148
6149 V_VT(&vari) = VT_BOOL;
6150 V_BOOL(&vari) = (bValue ? VARIANT_TRUE : VARIANT_FALSE); /* NOTE: VARIANT_TRUE is (SHORT)-1 */
6151 return IPropertyBag_Write(ppb, pszPropName, &vari);
6152}
6153
6154/**************************************************************************
6155 * SHPropertyBag_WriteSHORT (SHLWAPI.528)
6156 *
6157 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/writeshort.htm
6158 */
6160{
6161 VARIANT vari;
6162
6163 TRACE("%p %s %d\n", ppb, debugstr_w(pszPropName), sValue);
6164
6165 if (!ppb || !pszPropName)
6166 {
6167 ERR("%p %s\n", ppb, debugstr_w(pszPropName));
6168 return E_INVALIDARG;
6169 }
6170
6171 V_VT(&vari) = VT_UI2;
6172 V_UI2(&vari) = sValue;
6173 return IPropertyBag_Write(ppb, pszPropName, &vari);
6174}
6175
6176/**************************************************************************
6177 * SHPropertyBag_WriteLONG (SHLWAPI.497)
6178 *
6179 * This function asks a property bag to write a named property as a LONG.
6180 *
6181 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/writelong.htm
6182 */
6184{
6185 VARIANT vari;
6186
6187 TRACE("%p %s %ld\n", ppb, debugstr_w(pszPropName), lValue);
6188
6189 if (!ppb || !pszPropName)
6190 {
6191 ERR("%p %s\n", ppb, debugstr_w(pszPropName));
6192 return E_INVALIDARG;
6193 }
6194
6195 V_VT(&vari) = VT_I4;
6196 V_I4(&vari) = lValue;
6197 return IPropertyBag_Write(ppb, pszPropName, &vari);
6198}
6199
6200/**************************************************************************
6201 * SHPropertyBag_WriteDWORD (SHLWAPI.508)
6202 *
6203 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/writedword.htm
6204 */
6206{
6207 VARIANT vari;
6208
6209 TRACE("%p %s %lu\n", ppb, debugstr_w(pszPropName), dwValue);
6210
6211 if (!ppb || !pszPropName)
6212 {
6213 ERR("%p %s\n", ppb, debugstr_w(pszPropName));
6214 return E_INVALIDARG;
6215 }
6216
6217 V_VT(&vari) = VT_UI4;
6218 V_UI4(&vari) = dwValue;
6219 return IPropertyBag_Write(ppb, pszPropName, &vari);
6220}
6221
6222/**************************************************************************
6223 * SHPropertyBag_WriteStr (SHLWAPI.495)
6224 *
6225 * This function asks a property bag to write a string as the value of a named property.
6226 *
6227 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/writestr.htm
6228 */
6230{
6231 HRESULT hr;
6232 VARIANT vari;
6233
6234 TRACE("%p %s %s\n", ppb, debugstr_w(pszPropName), debugstr_w(pszValue));
6235
6236 if (!ppb || !pszPropName)
6237 {
6238 ERR("%p %s\n", ppb, debugstr_w(pszPropName));
6239 return E_INVALIDARG;
6240 }
6241
6242 V_BSTR(&vari) = SysAllocString(pszValue);
6243 if (!V_BSTR(&vari))
6244 return E_OUTOFMEMORY;
6245
6246 V_VT(&vari) = VT_BSTR;
6247 hr = IPropertyBag_Write(ppb, pszPropName, &vari);
6248
6249 SysFreeString(V_BSTR(&vari));
6250 return hr;
6251}
6252
6253/**************************************************************************
6254 * SHPropertyBag_WriteGUID (SHLWAPI.506)
6255 *
6256 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/writeguid.htm
6257 */
6258HRESULT WINAPI SHPropertyBag_WriteGUID(IPropertyBag *ppb, LPCWSTR pszPropName, const GUID *pguid)
6259{
6260 WCHAR szBuff[64];
6261
6262 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), pguid);
6263
6264 if (!ppb || !pszPropName || !pguid)
6265 {
6266 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), pguid);
6267 return E_INVALIDARG;
6268 }
6269
6270 SHStringFromGUIDW(pguid, szBuff, _countof(szBuff));
6271 return SHPropertyBag_WriteStr(ppb, pszPropName, szBuff);
6272}
6273
6274/**************************************************************************
6275 * SHPropertyBag_WriteStream (SHLWAPI.532)
6276 *
6277 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/writestream.htm
6278 */
6280{
6281 VARIANT vari;
6282
6283 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), pStream);
6284
6285 if (!ppb || !pszPropName || !pStream)
6286 {
6287 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), pStream);
6288 return E_INVALIDARG;
6289 }
6290
6291 V_VT(&vari) = VT_UNKNOWN;
6292 V_UNKNOWN(&vari) = (IUnknown*)pStream;
6293 return IPropertyBag_Write(ppb, pszPropName, &vari);
6294}
6295
6296/**************************************************************************
6297 * SHPropertyBag_WritePOINTL (SHLWAPI.522)
6298 *
6299 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/writepointl.htm
6300 */
6302{
6303 HRESULT hr;
6304 int cch, cch2;
6305 WCHAR *pch, szBuff[MAX_PATH];
6306
6307 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), pptl);
6308
6309 if (!ppb || !pszPropName || !pptl)
6310 {
6311 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), pptl);
6312 return E_INVALIDARG;
6313 }
6314
6315 StrCpyNW(szBuff, pszPropName, _countof(szBuff));
6316
6317 cch = lstrlenW(szBuff);
6318 cch2 = _countof(szBuff) - cch;
6319 if (cch2 < _countof(L".x"))
6320 {
6321 ERR("%s is too long\n", debugstr_w(pszPropName));
6322 return E_FAIL;
6323 }
6324
6325 pch = &szBuff[cch];
6326
6327 StrCpyNW(pch, L".x", cch2);
6328 hr = SHPropertyBag_WriteLONG(ppb, szBuff, pptl->x);
6329 if (FAILED(hr))
6330 return hr;
6331
6332 StrCpyNW(pch, L".y", cch2);
6333 hr = SHPropertyBag_WriteLONG(ppb, szBuff, pptl->y);
6334 if (FAILED(hr))
6335 {
6336 StrCpyNW(pch, L".x", cch2);
6337 return SHPropertyBag_Delete(ppb, szBuff);
6338 }
6339
6340 return hr;
6341}
6342
6343/**************************************************************************
6344 * SHPropertyBag_WritePOINTS (SHLWAPI.526)
6345 *
6346 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/writepoints.htm
6347 */
6348HRESULT WINAPI SHPropertyBag_WritePOINTS(IPropertyBag *ppb, LPCWSTR pszPropName, const POINTS *ppts)
6349{
6350 POINTL pt;
6351
6352 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), ppts);
6353
6354 if (!ppb || !pszPropName || !ppts)
6355 {
6356 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), ppts);
6357 return E_INVALIDARG;
6358 }
6359
6360 pt.x = ppts->x;
6361 pt.y = ppts->y;
6362 return SHPropertyBag_WritePOINTL(ppb, pszPropName, &pt);
6363}
6364
6365/**************************************************************************
6366 * SHPropertyBag_WriteRECTL (SHLWAPI.524)
6367 *
6368 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/writerectl.htm
6369 */
6371{
6372 HRESULT hr;
6373 int cch, cch2;
6374 WCHAR *pch, szBuff[MAX_PATH];
6375
6376 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), prcl);
6377
6378 if (!ppb || !pszPropName || !prcl)
6379 {
6380 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), prcl);
6381 return E_INVALIDARG;
6382 }
6383
6384 StrCpyNW(szBuff, pszPropName, _countof(szBuff));
6385
6386 cch = lstrlenW(szBuff);
6387 cch2 = _countof(szBuff) - cch;
6388 if (cch2 < _countof(L".bottom"))
6389 {
6390 ERR("%s is too long\n", debugstr_w(pszPropName));
6391 return E_FAIL;
6392 }
6393
6394 pch = &szBuff[cch];
6395
6396 StrCpyNW(pch, L".left", cch2);
6397 hr = SHPropertyBag_WriteLONG(ppb, szBuff, prcl->left);
6398 if (SUCCEEDED(hr))
6399 {
6400 StrCpyNW(pch, L".top", cch2);
6401 hr = SHPropertyBag_WriteLONG(ppb, szBuff, prcl->top);
6402 if (SUCCEEDED(hr))
6403 {
6404 StrCpyNW(pch, L".right", cch2);
6405 hr = SHPropertyBag_WriteLONG(ppb, szBuff, prcl->right);
6406 if (SUCCEEDED(hr))
6407 {
6408 StrCpyNW(pch, L".bottom", cch2);
6409 hr = SHPropertyBag_WriteLONG(ppb, szBuff, prcl->bottom);
6410 if (SUCCEEDED(hr))
6411 return hr; /* All successful */
6412
6413 StrCpyNW(pch, L".right", cch2);
6414 hr = SHPropertyBag_Delete(ppb, szBuff);
6415 if (SUCCEEDED(hr))
6416 return hr;
6417 }
6418
6419 StrCpyNW(pch, L".top", cch2);
6420 hr = SHPropertyBag_Delete(ppb, szBuff);
6421 if (SUCCEEDED(hr))
6422 return hr;
6423 }
6424
6425 StrCpyNW(pch, L".left", cch2);
6426 hr = SHPropertyBag_Delete(ppb, szBuff);
6427 if (SUCCEEDED(hr))
6428 return hr;
6429 }
6430
6431 return hr;
6432}
6433#endif
6434
6435/* return flags for SHGetObjectCompatFlags, names derived from registry value names */
6436#define OBJCOMPAT_OTNEEDSSFCACHE 0x00000001
6437#define OBJCOMPAT_NO_WEBVIEW 0x00000002
6438#define OBJCOMPAT_UNBINDABLE 0x00000004
6439#define OBJCOMPAT_PINDLL 0x00000008
6440#define OBJCOMPAT_NEEDSFILESYSANCESTOR 0x00000010
6441#define OBJCOMPAT_NOTAFILESYSTEM 0x00000020
6442#define OBJCOMPAT_CTXMENU_NOVERBS 0x00000040
6443#define OBJCOMPAT_CTXMENU_LIMITEDQI 0x00000080
6444#define OBJCOMPAT_COCREATESHELLFOLDERONLY 0x00000100
6445#define OBJCOMPAT_NEEDSSTORAGEANCESTOR 0x00000200
6446#define OBJCOMPAT_NOLEGACYWEBVIEW 0x00000400
6447#define OBJCOMPAT_CTXMENU_XPQCMFLAGS 0x00001000
6448#define OBJCOMPAT_NOIPROPERTYSTORE 0x00002000
6449
6450/* a search table for compatibility flags */
6452 const WCHAR name[30];
6454};
6455
6456/* expected to be sorted by name */
6457static const struct objcompat_entry objcompat_table[] = {
6458 { {'C','O','C','R','E','A','T','E','S','H','E','L','L','F','O','L','D','E','R','O','N','L','Y',0},
6460 { {'C','T','X','M','E','N','U','_','L','I','M','I','T','E','D','Q','I',0},
6462 { {'C','T','X','M','E','N','U','_','N','O','V','E','R','B','S',0},
6464 { {'C','T','X','M','E','N','U','_','X','P','Q','C','M','F','L','A','G','S',0},
6466 { {'N','E','E','D','S','F','I','L','E','S','Y','S','A','N','C','E','S','T','O','R',0},
6468 { {'N','E','E','D','S','S','T','O','R','A','G','E','A','N','C','E','S','T','O','R',0},
6470 { {'N','O','I','P','R','O','P','E','R','T','Y','S','T','O','R','E',0},
6472 { {'N','O','L','E','G','A','C','Y','W','E','B','V','I','E','W',0},
6474 { {'N','O','T','A','F','I','L','E','S','Y','S','T','E','M',0},
6476 { {'N','O','_','W','E','B','V','I','E','W',0},
6478 { {'O','T','N','E','E','D','S','S','F','C','A','C','H','E',0},
6480 { {'P','I','N','D','L','L',0},
6482 { {'U','N','B','I','N','D','A','B','L','E',0},
6484};
6485
6486/**************************************************************************
6487 * SHGetObjectCompatFlags (SHLWAPI.476)
6488 *
6489 * Function returns an integer representation of compatibility flags stored
6490 * in registry for CLSID under ShellCompatibility subkey.
6491 *
6492 * PARAMS
6493 * pUnk: pointer to object IUnknown interface, idetifies CLSID
6494 * clsid: pointer to CLSID to retrieve data for
6495 *
6496 * RETURNS
6497 * 0 on failure, flags set on success
6498 */
6500{
6501 static const WCHAR compatpathW[] =
6502 {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
6503 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
6504 'S','h','e','l','l','C','o','m','p','a','t','i','b','i','l','i','t','y','\\',
6505 'O','b','j','e','c','t','s','\\','%','s',0};
6506 WCHAR strW[sizeof(compatpathW)/sizeof(WCHAR) + 38 /* { CLSID } */];
6507 DWORD ret, length = sizeof(strW)/sizeof(WCHAR);
6508 OLECHAR *clsid_str;
6509 HKEY key;
6510 INT i;
6511
6512 TRACE("%p %s\n", pUnk, debugstr_guid(clsid));
6513
6514 if (!pUnk && !clsid) return 0;
6515
6516 if (pUnk && !clsid)
6517 {
6518 FIXME("iface not handled\n");
6519 return 0;
6520 }
6521
6522 StringFromCLSID(clsid, &clsid_str);
6523 sprintfW(strW, compatpathW, clsid_str);
6524 CoTaskMemFree(clsid_str);
6525
6527 if (ret != ERROR_SUCCESS) return 0;
6528
6529 /* now collect flag values */
6530 ret = 0;
6531 for (i = 0; RegEnumValueW(key, i, strW, &length, NULL, NULL, NULL, NULL) == ERROR_SUCCESS; i++)
6532 {
6533 INT left, right, res, x;
6534
6535 /* search in table */
6536 left = 0;
6537 right = sizeof(objcompat_table) / sizeof(struct objcompat_entry) - 1;
6538
6539 while (right >= left) {
6540 x = (left + right) / 2;
6542 if (res == 0)
6543 {
6544 ret |= objcompat_table[x].value;
6545 break;
6546 }
6547 else if (res < 0)
6548 right = x - 1;
6549 else
6550 left = x + 1;
6551 }
6552
6553 length = sizeof(strW)/sizeof(WCHAR);
6554 }
6555
6556 return ret;
6557}
6558
6559#ifdef __REACTOS__
6560/**************************************************************************
6561 * SHBoolSystemParametersInfo (SHLWAPI.537)
6562 *
6563 * Specialized SPI values from https://undoc.airesoft.co.uk/shlwapi.dll/SHBoolSystemParametersInfo.php
6564 */
6566{
6567 BOOL retval;
6568 PVOID pvOrgParam = pvParam;
6569 UINT uiParam = 0;
6570 ANIMATIONINFO animinfo;
6571
6572 switch (uiAction)
6573 {
6574 case SPI_GETANIMATION:
6575 case SPI_SETANIMATION:
6576 uiParam = animinfo.cbSize = sizeof(animinfo);
6577 animinfo.iMinAnimate = *(BOOL*)pvParam; /* SPI_SET */
6578 pvParam = &animinfo;
6579 break;
6580 case SPI_SETDRAGFULLWINDOWS:
6581 case SPI_SETFONTSMOOTHING:
6582 uiParam = *(BOOL*)pvParam;
6583 break;
6584 case SPI_GETDRAGFULLWINDOWS:
6585 case SPI_GETFONTSMOOTHING:
6586 /* pvParam already correct */
6587 break;
6588 default:
6589 if (uiAction < 0x1000)
6590 return FALSE;
6591 else if (uiAction & 1) /* SPI_SET */
6592 pvParam = (PVOID)(SIZE_T)(*(BOOL*)pvParam);
6593 break;
6594 }
6595
6596 retval = SystemParametersInfoW(uiAction, uiParam, pvParam, SPIF_SENDCHANGE | SPIF_UPDATEINIFILE);
6597 if (uiAction == SPI_GETANIMATION)
6598 *(BOOL*)pvOrgParam = animinfo.iMinAnimate;
6599 return retval;
6600}
6601#endif
static HDC hDC
Definition: 3dtext.c:33
DWORD dwFileAttributes
WORD palVersion
Definition: SetPixel.c:14
WORD palNumEntries
Definition: SetPixel.c:15
UINT cchMax
WCHAR lpszDest[260]
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define va_arg(ap, T)
Definition: acmsvcex.h:89
WINBASEAPI _Check_return_ _Out_ AppPolicyProcessTerminationMethod * policy
Definition: appmodel.h:73
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
static const TCHAR helpfile[]
Definition: dialog.c:19
#define ARRAY_SIZE(A)
Definition: main.h:20
static void free_sids(PSID *sids, int count)
Definition: acl.c:155
#define CHAR(Char)
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
#define EXTERN_C
Definition: basetyps.h:12
const GUID IID_IUnknown
#define RegCloseKey(hKey)
Definition: registry.h:49
EXTERN_C LPITEMIDLIST WINAPI SHBrowseForFolderW(LPBROWSEINFOW lpbi)
Definition: brfolder.cpp:1460
WCHAR WndClass[]
Definition: capicon.c:23
FT_UInt sid
Definition: cffcmap.c:139
EXTERN_C void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
HINSTANCE hInstance
Definition: charmap.c:19
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
static SIZE_T datasize
Definition: asm.c:30
#define WAIT_TIMEOUT
Definition: dderror.h:14
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define ERROR_SUCCESS
Definition: deptool.c:10
static LPVOID LPUNKNOWN
Definition: dinput.c:53
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4799
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3298
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3234
LONG WINAPI RegEnumValueA(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpdwReserved, _Out_opt_ LPDWORD lpdwType, _Out_opt_ LPBYTE lpData, _Inout_opt_ LPDWORD lpcbData)
Definition: reg.c:2668
LONG WINAPI RegDeleteValueA(HKEY hKey, LPCSTR lpValueName)
Definition: reg.c:2287
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3268
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2330
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2830
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4009
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:411
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:294
BOOL WINAPI AddAccessDeniedAceEx(PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, PSID pSid)
Definition: security.c:1114
BOOL WINAPI AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, PSID *pSid)
Definition: security.c:674
BOOL WINAPI InitializeAcl(PACL pAcl, DWORD nAclLength, DWORD dwAclRevision)
Definition: security.c:1006
BOOL WINAPI InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD dwRevision)
Definition: security.c:929
BOOL WINAPI AddAccessAllowedAce(PACL pAcl, DWORD dwAceRevision, DWORD AccessMask, PSID pSid)
Definition: security.c:1039
BOOL WINAPI AddAccessAllowedAceEx(PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, PSID pSid)
Definition: security.c:1063
DWORD WINAPI GetLengthSid(PSID pSid)
Definition: security.c:919
PVOID WINAPI FreeSid(PSID pSid)
Definition: security.c:698
BOOL WINAPI AddAccessDeniedAce(PACL pAcl, DWORD dwAceRevision, DWORD AccessMask, PSID pSid)
Definition: security.c:1090
UINT uFlags
Definition: api.c:59
INT WINAPI StrCmpNIA(LPCSTR lpszStr, LPCSTR lpszComp, INT iLen)
Definition: string.c:296
INT WINAPI StrCmpNIW(LPCWSTR lpszStr, LPCWSTR lpszComp, INT iLen)
Definition: string.c:307
INT WINAPI StrCmpNW(LPCWSTR lpszStr, LPCWSTR lpszComp, INT iLen)
Definition: string.c:500
INT WINAPI StrCmpNA(LPCSTR lpszStr, LPCSTR lpszComp, INT iLen)
Definition: string.c:489
BOOL WINAPI GetOpenFileNameW(OPENFILENAMEW *ofn)
Definition: filedlg.c:4736
BOOL WINAPI GetSaveFileNameW(LPOPENFILENAMEW ofn)
Definition: filedlg.c:4801
BOOL WINAPI PrintDlgW(LPPRINTDLGW lppd)
Definition: printdlg.c:2403
BOOL WINAPI PageSetupDlgW(LPPAGESETUPDLGW setupdlg)
Definition: printdlg.c:3938
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1605
static const WCHAR empty[]
Definition: main.c:47
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
int(* FARPROC)()
Definition: compat.h:36
#define UnmapViewOfFile
Definition: compat.h:746
#define CP_ACP
Definition: compat.h:109
HANDLE HWND
Definition: compat.h:19
#define GetProcAddress(x, y)
Definition: compat.h:753
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define HeapReAlloc
Definition: compat.h:734
WCHAR OLECHAR
Definition: compat.h:2292
#define FreeLibrary(x)
Definition: compat.h:748
OLECHAR * BSTR
Definition: compat.h:2293
#define GetCurrentProcess()
Definition: compat.h:759
#define IsWow64Process
Definition: compat.h:760
#define MAX_PATH
Definition: compat.h:34
unsigned short VARTYPE
Definition: compat.h:2254
#define HeapFree(x, y, z)
Definition: compat.h:735
#define FILE_MAP_READ
Definition: compat.h:776
#define CALLBACK
Definition: compat.h:35
#define lstrcpyW
Definition: compat.h:749
#define WideCharToMultiByte
Definition: compat.h:111
#define MapViewOfFile
Definition: compat.h:745
#define MultiByteToWideChar
Definition: compat.h:110
#define LoadLibraryW(x)
Definition: compat.h:747
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
VARENUM
Definition: compat.h:2294
@ VT_BSTR
Definition: compat.h:2303
@ VT_INT
Definition: compat.h:2316
@ VT_NULL
Definition: compat.h:2296
@ VT_UNKNOWN
Definition: compat.h:2308
@ VT_BYREF
Definition: compat.h:2342
@ VT_UI2
Definition: compat.h:2312
@ VT_DECIMAL
Definition: compat.h:2309
@ VT_ARRAY
Definition: compat.h:2341
@ VT_I1
Definition: compat.h:2310
@ VT_I4
Definition: compat.h:2298
@ VT_BOOL
Definition: compat.h:2306
@ VT_I2
Definition: compat.h:2297
@ VT_UI4
Definition: compat.h:2313
@ VT_UINT
Definition: compat.h:2317
@ VT_EMPTY
Definition: compat.h:2295
@ VT_DISPATCH
Definition: compat.h:2304
@ VT_UI1
Definition: compat.h:2311
#define lstrlenW
Definition: compat.h:750
static const WCHAR version[]
Definition: asmname.c:66
static const WCHAR valueW[]
Definition: object.c:48
BOOL WINAPI DuplicateHandle(IN HANDLE hSourceProcessHandle, IN HANDLE hSourceHandle, IN HANDLE hTargetProcessHandle, OUT LPHANDLE lpTargetHandle, IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwOptions)
Definition: handle.c:149
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExA(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:159
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
Definition: loader.c:539
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
Definition: proc.c:1227
BOOL WINAPI QueueUserWorkItem(IN LPTHREAD_START_ROUTINE Function, IN PVOID Context, IN ULONG Flags)
Definition: thread.c:1076
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:188
BOOL WINAPI FileTimeToLocalFileTime(IN CONST FILETIME *lpFileTime, OUT LPFILETIME lpLocalFileTime)
Definition: time.c:221
BOOL WINAPI CreateTimerQueueTimer(OUT PHANDLE phNewTimer, IN HANDLE TimerQueue, IN WAITORTIMERCALLBACK Callback, IN PVOID Parameter, IN DWORD DueTime, IN DWORD Period, IN ULONG Flags)
Definition: timerqueue.c:138
BOOL WINAPI GetVersionExA(IN LPOSVERSIONINFOA lpVersionInformation)
Definition: version.c:69
BOOL WINAPI WritePrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR string, LPCWSTR filename)
Definition: profile.c:1453
INT WINAPI GetPrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR def_val, LPWSTR buffer, UINT len, LPCWSTR filename)
Definition: profile.c:1142
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4246
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4198
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4265
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4227
BOOL WINAPI GetStringTypeW(DWORD type, LPCWSTR src, INT count, LPWORD chartype)
Definition: locale.c:3098
LCID WINAPI GetUserDefaultLCID(void)
Definition: locale.c:1216
#define IS_INTRESOURCE(x)
Definition: loader.c:613
BOOL WINAPI StrToIntExW(const WCHAR *str, DWORD flags, INT *ret)
Definition: string.c:972
WCHAR *WINAPI StrCatBuffW(WCHAR *str, const WCHAR *cat, INT max_len)
Definition: string.c:1390
INT WINAPI DECLSPEC_HOTPATCH LoadStringW(HINSTANCE instance, UINT resource_id, LPWSTR buffer, INT buflen)
Definition: string.c:1220
HRESULT WINAPI SHLoadIndirectString(const WCHAR *src, WCHAR *dst, UINT dst_len, void **reserved)
Definition: string.c:1455
WCHAR *WINAPI StrCpyNW(WCHAR *dst, const WCHAR *src, int count)
Definition: string.c:462
ULONG WINAPI DECLSPEC_HOTPATCH GetTickCount(void)
Definition: sync.c:182
GUID guid
Definition: version.c:147
DWORD WINAPI GetVersion(void)
Definition: version.c:1458
BOOL WINAPI GetFileVersionInfoW(LPCWSTR filename, DWORD handle, DWORD datasize, LPVOID data)
Definition: version.c:967
BOOL WINAPI VerQueryValueW(LPCVOID pBlock, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen)
Definition: version.c:1171
DWORD WINAPI GetFileVersionInfoSizeW(LPCWSTR filename, LPDWORD handle)
Definition: version.c:738
HRESULT WINAPI LcidToRfc1766W(LCID lcid, LPWSTR pszRfc1766, INT nChar)
Definition: mlang.c:1265
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:91
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2338
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412
HRESULT WINAPI SafeArrayGetUBound(SAFEARRAY *psa, UINT nDim, LONG *plUbound)
Definition: safearray.c:1033
HRESULT WINAPI SafeArrayAccessData(SAFEARRAY *psa, void **ppvData)
Definition: safearray.c:1137
HRESULT WINAPI SafeArrayUnaccessData(SAFEARRAY *psa)
Definition: safearray.c:1168
UINT WINAPI SafeArrayGetDim(SAFEARRAY *psa)
Definition: safearray.c:1094
HRESULT WINAPI SafeArrayGetLBound(SAFEARRAY *psa, UINT nDim, LONG *plLbound)
Definition: safearray.c:1066
UINT WINAPI DragQueryFileW(HDROP hDrop, UINT lFile, LPWSTR lpszwFile, UINT lLength)
Definition: shellole.c:666
#define OBJCOMPAT_NOIPROPERTYSTORE
Definition: ordinal.c:6448
HRESULT WINAPI IUnknown_UIActivateIO(IUnknown *unknown, BOOL activate, LPMSG msg)
Definition: ordinal.c:1633
HANDLE WINAPI SHRemoveDefaultDialogFont(HWND hWnd)
Definition: ordinal.c:2628
HANDLE WINAPI SHAllocShared(LPCVOID lpvData, DWORD dwSize, DWORD dwProcId)
Definition: ordinal.c:169
HRESULT WINAPI IUnknown_QueryServiceExec(IUnknown *lpUnknown, REFIID service, const GUID *group, DWORD cmdId, DWORD cmdOpt, VARIANT *pIn, VARIANT *pOut)
Definition: ordinal.c:1553
BOOL WINAPI IsCharXDigitW(WCHAR wc)
Definition: ordinal.c:772
HMODULE WINAPI MLLoadLibraryW(LPCWSTR new_mod, HMODULE inst_hwnd, DWORD dwCrossCodePage)
Definition: ordinal.c:3877
static const WCHAR strRegistryPolicyW[]
Definition: ordinal.c:2844
#define OBJCOMPAT_CTXMENU_XPQCMFLAGS
Definition: ordinal.c:6447
BOOL WINAPI SHSimulateDrop(IDropTarget *pDrop, IDataObject *pDataObj, DWORD grfKeyState, PPOINTL lpPt, DWORD *pdwEffect)
Definition: ordinal.c:1828
VOID WINAPI IUnknown_Set(IUnknown **lppDest, IUnknown *lpUnknown)
Definition: ordinal.c:2190
BOOL WINAPI GUIDFromStringA(LPCSTR idstr, CLSID *id)
Definition: ordinal.c:3035
BOOL WINAPI SHIsLowMemoryMachine(DWORD dwType)
Definition: ordinal.c:4667
BOOL WINAPI SHSetIniStringW(LPCWSTR appName, LPCWSTR keyName, LPCWSTR str, LPCWSTR filename)
Definition: ordinal.c:3549
HRESULT WINAPI IUnknown_TranslateAcceleratorOCS(IUnknown *lpUnknown, LPMSG lpMsg, DWORD dwModifiers)
Definition: ordinal.c:1898
HRESULT WINAPI IUnknown_TranslateAcceleratorIO(IUnknown *lpUnknown, LPMSG lpMsg)
Definition: ordinal.c:4436
#define OBJCOMPAT_NOLEGACYWEBVIEW
Definition: ordinal.c:6446
LONG WINAPI SHSetWindowBits(HWND hwnd, INT offset, UINT mask, UINT flags)
Definition: ordinal.c:1130
HRESULT WINAPI IUnknown_CPContainerOnChanged(IUnknown *lpUnknown, DISPID dispID)
Definition: ordinal.c:3452
HPALETTE WINAPI SHCreateShellPalette(HDC hdc)
Definition: ordinal.c:4615
DWORD WINAPI StrCmpNICW(LPCWSTR lpszSrc, LPCWSTR lpszCmp, DWORD len)
Definition: ordinal.c:841
HRESULT WINAPI IsQSForward(REFGUID pguidCmdGroup, ULONG cCmds, OLECMD *prgCmds)
Definition: ordinal.c:2353
HMENU WINAPI SHGetMenuFromID(HMENU hMenu, UINT uID)
Definition: ordinal.c:1997
HRESULT WINAPI IUnknown_HandleIRestrict(LPUNKNOWN lpUnknown, PVOID lpArg1, PVOID lpArg2, PVOID lpArg3, PVOID lpArg4)
Definition: ordinal.c:1953
DWORD WINAPI SHSendMessageBroadcastA(UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: ordinal.c:4183
HRESULT WINAPI GetAcceptLanguagesA(LPSTR langbuf, LPDWORD buflen)
Definition: ordinal.c:577
HRESULT WINAPI SHLoadRegUIStringW(HKEY hkey, LPCWSTR value, LPWSTR buf, DWORD size)
Definition: ordinal.c:4413
DWORD WINAPI SHSendMessageBroadcastW(UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: ordinal.c:4195
BOOL WINAPI GUIDFromStringW(LPCWSTR idstr, CLSID *id)
Definition: ordinal.c:3047
HRESULT WINAPI IUnknown_QueryStatus(IUnknown *lpUnknown, REFGUID pguidCmdGroup, ULONG cCmds, OLECMD *prgCmds, OLECMDTEXT *pCmdText)
Definition: ordinal.c:1048
BOOL WINAPI IsOS(DWORD feature)
Definition: ordinal.c:4230
DWORD WINAPI FDSA_InsertItem(FDSA_info *info, DWORD where, const void *block)
Definition: ordinal.c:2449
DWORD WINAPI SHRegisterClassW(WNDCLASSW *lpWndClass)
Definition: ordinal.c:2678
HWND WINAPI SHCreateWorkerWindowA(WNDPROC wndProc, HWND hWndParent, DWORD dwExStyle, DWORD dwStyle, HMENU hMenu, LONG_PTR wnd_extra)
Definition: ordinal.c:2798
BOOL WINAPI GetSaveFileNameWrapW(LPOPENFILENAMEW ofn)
Definition: ordinal.c:3933
HRESULT WINAPI SHSetDefaultDialogFont(HWND hWnd, INT id)
Definition: ordinal.c:2576
INT WINAPI GetMenuPosFromID(HMENU hMenu, UINT wID)
Definition: ordinal.c:4698
DWORD WINAPI MLClearMLHInstance(DWORD x)
Definition: ordinal.c:4171
#define EnableModeless(type)
Definition: ordinal.c:3663
DWORD WINAPI GetUIVersion(void)
Definition: ordinal.c:5114
HANDLE WINAPI SHMapHandle(HANDLE hShared, DWORD dwSrcProcId, DWORD dwDstProcId, DWORD dwAccess, DWORD dwOptions)
Definition: ordinal.c:98
VOID WINAPI SHWeakReleaseInterface(IUnknown *lpDest, IUnknown **lppUnknown)
Definition: ordinal.c:3010
DWORD WINAPI StrCmpCA(LPCSTR lpszSrc, LPCSTR lpszCmp)
Definition: ordinal.c:859
BOOL WINAPI SHFlushSFCacheWrap(void)
Definition: ordinal.c:4143
HRESULT WINAPI SHPackDispParamsV(DISPPARAMS *params, VARIANTARG *args, UINT cnt, __ms_va_list valist)
Definition: ordinal.c:3198
DWORD WINAPI SHGetAppCompatFlags(DWORD dwUnknown)
Definition: ordinal.c:4749
struct tagPOLICYDATA * LPPOLICYDATA
HRESULT WINAPIV IUnknown_CPContainerInvokeParam(IUnknown *container, REFIID riid, DISPID dispId, VARIANTARG *buffer, DWORD cParams,...)
Definition: ordinal.c:3403
DWORD WINAPI SHCheckMenuItem(HMENU hMenu, UINT uID, BOOL bCheck)
Definition: ordinal.c:1800
DWORD WINAPI SHGetFileInfoWrapW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: ordinal.c:3564
HRESULT WINAPI SHWeakQueryInterface(IUnknown *pUnk, IUnknown *pInner, IID *riid, LPVOID *ppv)
Definition: ordinal.c:2980
BOOL WINAPI GetStringType3ExW(LPWSTR src, INT count, LPWORD type)
Definition: ordinal.c:783
#define OBJCOMPAT_OTNEEDSSFCACHE
Definition: ordinal.c:6436
void WINAPI IUnknown_AtomicRelease(IUnknown **lpUnknown)
Definition: ordinal.c:1245
#define OBJCOMPAT_NEEDSFILESYSANCESTOR
Definition: ordinal.c:6440
HRESULT WINAPI IConnectionPoint_InvokeWithCancel(IConnectionPoint *iCP, DISPID dispId, DISPPARAMS *dispParams, DWORD unknown1, DWORD unknown2)
Definition: ordinal.c:3307
HRESULT WINAPI IUnknown_HasFocusIO(IUnknown *lpUnknown)
Definition: ordinal.c:4468
DWORD WINAPI SHGetIniStringW(LPCWSTR appName, LPCWSTR keyName, LPWSTR out, DWORD outLen, LPCWSTR filename)
Definition: ordinal.c:3502
HRESULT WINAPI IUnknown_ProfferService(IUnknown *lpUnknown, REFGUID service, IServiceProvider *pService, DWORD *pCookie)
Definition: ordinal.c:1592
HRESULT WINAPI IUnknown_EnableModeless(IUnknown *lpUnknown, BOOL bModeless)
Definition: ordinal.c:3684
WORD WINAPI VerQueryValueWrapW(LPVOID pBlock, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, UINT *puLen)
Definition: ordinal.c:3655
HRESULT WINAPI ConnectToConnectionPoint(IUnknown *lpUnkSink, REFIID riid, BOOL fConnect, IUnknown *lpUnknown, LPDWORD lpCookie, IConnectionPoint **lppCP)
Definition: ordinal.c:1193
BOOL WINAPI PageSetupDlgWrapW(LPPAGESETUPDLGW pagedlg)
Definition: ordinal.c:3964
DWORD WINAPI SHWaitForSendMessageThread(HANDLE hand, DWORD dwTimeout)
Definition: ordinal.c:2050
HRESULT WINAPI CLSIDFromStringWrap(LPCWSTR idstr, CLSID *id)
Definition: ordinal.c:4213
DWORD WINAPI SHFillRectClr(HDC hDC, LPCRECT pRect, COLORREF cRef)
Definition: ordinal.c:2133
BOOL WINAPI SHGetPathFromIDListWrapW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: ordinal.c:3595
LRESULT CALLBACK SHDefWindowProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
Definition: ordinal.c:2751
UINT WINAPI SHEnableMenuItem(HMENU hMenu, UINT wItemID, BOOL bEnable)
Definition: ordinal.c:1781
LPCSTR WINAPI PathSkipLeadingSlashesA(LPCSTR lpszSrc)
Definition: ordinal.c:1269
INT WINAPIV ShellMessageBoxWrapW(HINSTANCE hInstance, HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType,...)
Definition: ordinal.c:5162
HRESULT WINAPI IUnknown_OnFocusOCS(IUnknown *lpUnknown, BOOL fGotFocus)
Definition: ordinal.c:1931
DWORD WINAPI SHGetObjectCompatFlags(IUnknown *pUnk, const CLSID *clsid)
Definition: ordinal.c:6499
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1501
#define OBJCOMPAT_CTXMENU_LIMITEDQI
Definition: ordinal.c:6443
DWORD WINAPI SHGetMachineInfo(DWORD dwFlags)
Definition: ordinal.c:4081
BOOL WINAPI MLIsMLHInstance(HINSTANCE hInst)
Definition: ordinal.c:4152
INT WINAPI SHFileOperationWrapW(LPSHFILEOPSTRUCTW lpFileOp)
Definition: ordinal.c:3615
HRESULT WINAPI SHCreatePropertyBagOnRegKey(HKEY hKey, LPCWSTR subkey, DWORD grfMode, REFIID riid, void **ppv)
Definition: ordinal.c:5398
INT WINAPI SHFormatDateTimeW(const FILETIME UNALIGNED *fileTime, DWORD *flags, LPWSTR buf, UINT size)
Definition: ordinal.c:5453
HRESULT WINAPI SHCoCreateInstanceAC(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: ordinal.c:4759
HRESULT WINAPI SHIsExpandableFolder(LPSHELLFOLDER lpFolder, LPCITEMIDLIST pidl)
Definition: ordinal.c:2088
BOOL WINAPI PlaySoundWrapW(LPCWSTR pszSound, HMODULE hmod, DWORD fdwSound)
Definition: ordinal.c:3480
struct tagPOLICYDATA POLICYDATA
HRESULT WINAPI SKAllocValueW(DWORD flags, LPCWSTR subkey, LPCWSTR value, DWORD *type, LPVOID *data, DWORD *count)
Definition: ordinal.c:5011
BOOL WINAPI SHIsChildOrSelf(HWND hParent, HWND hChild)
Definition: ordinal.c:2373
DWORD WINAPI WhichPlatform(void)
Definition: ordinal.c:3073
DWORD SHLWAPI_ThreadRef_index
Definition: shlwapi_main.c:34
COLORREF WINAPI ColorHLSToRGB(WORD wHue, WORD wLuminosity, WORD wSaturation)
Definition: ordinal.c:4043
HRESULT WINAPI IUnknown_Exec(IUnknown *lpUnknown, REFGUID pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
Definition: ordinal.c:1087
HRESULT WINAPI IUnknown_GetClassID(IUnknown *lpUnknown, CLSID *clsid)
Definition: ordinal.c:1457
DWORD WINAPI SHGetCurColorRes(void)
Definition: ordinal.c:2023
#define GET_RGB(h)
Definition: ordinal.c:4025
BOOL WINAPI MLFreeLibrary(HMODULE hModule)
Definition: ordinal.c:4134
INT WINAPI SHStringFromGUIDW(REFGUID guid, LPWSTR lpszDest, INT cchMax)
Definition: ordinal.c:661
BOOL WINAPI IsCharCntrlW(WCHAR wc)
Definition: ordinal.c:734
PVOID WINAPI SHInterlockedCompareExchange(PVOID *dest, PVOID xchg, PVOID compare)
Definition: ordinal.c:3624
DWORD WINAPI SHWinHelpOnDemandW(HWND hwnd, LPCWSTR helpfile, DWORD flags1, VOID *ptr1, DWORD flags2)
Definition: ordinal.c:4102
UINT WINAPI SHDefExtractIconWrapW(LPCWSTR pszIconFile, int iIndex, UINT uFlags, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize)
Definition: ordinal.c:3727
BOOL WINAPI FDSA_Destroy(FDSA_info *info)
Definition: ordinal.c:2431
HRESULT WINAPI SHInvokeDefaultCommand(HWND hWnd, IShellFolder *lpFolder, LPCITEMIDLIST lpApidl)
Definition: ordinal.c:3183
PVOID WINAPI SHLockShared(HANDLE hShared, DWORD dwProcId)
Definition: ordinal.c:259
HRESULT WINAPI SHInvokeCommand(HWND, IShellFolder *, LPCITEMIDLIST, DWORD)
Definition: ordinal.c:3756
BOOL WINAPI SHIsSameObject(IUnknown *lpInt1, IUnknown *lpInt2)
Definition: ordinal.c:1289
INT WINAPI SHFormatDateTimeA(const FILETIME UNALIGNED *fileTime, DWORD *flags, LPSTR buf, UINT size)
Definition: ordinal.c:5518
DWORD WINAPI SHRestrictionLookup(DWORD policy, LPCWSTR initial, LPPOLICYDATA polTable, LPDWORD polArr)
Definition: ordinal.c:2930
BOOL WINAPI ShellExecuteExWrapW(LPSHELLEXECUTEINFOW lpExecInfo)
Definition: ordinal.c:3605
#define SHELL_NO_POLICY
Definition: ordinal.c:2841
HWND WINAPI SHCreateWorkerWindowW(WNDPROC wndProc, HWND hWndParent, DWORD dwExStyle, DWORD dwStyle, HMENU hMenu, LONG_PTR wnd_extra)
Definition: ordinal.c:3127
HRESULT WINAPI IUnknown_SetOwner(IUnknown *iface, IUnknown *pUnk)
Definition: ordinal.c:1385
HRESULT WINAPI SHGetInverseCMAP(LPDWORD dest, DWORD dwSize)
Definition: ordinal.c:4644
HRESULT WINAPI IUnknown_GetSite(LPUNKNOWN lpUnknown, REFIID iid, PVOID *lppSite)
Definition: ordinal.c:2761
#define OBJCOMPAT_NOTAFILESYSTEM
Definition: ordinal.c:6441
DWORD WINAPI SHGetRestriction(LPCWSTR lpSubKey, LPCWSTR lpSubName, LPCWSTR lpValue)
Definition: ordinal.c:2863
HRESULT WINAPI SHIShellFolder_EnumObjects(LPSHELLFOLDER lpFolder, HWND hwnd, SHCONTF flags, IEnumIDList **ppenum)
Definition: ordinal.c:3992
#define OBJCOMPAT_PINDLL
Definition: ordinal.c:6439
HRESULT WINAPI IUnknown_GetWindow(IUnknown *lpUnknown, HWND *lphWnd)
Definition: ordinal.c:1336
BOOL WINAPI GetOpenFileNameWrapW(LPOPENFILENAMEW ofn)
Definition: ordinal.c:3984
VOID WINAPI FixSlashesAndColonW(LPWSTR lpwstr)
Definition: ordinal.c:4735
HRESULT WINAPI QISearch(void *base, const QITAB *table, REFIID riid, void **ppv)
Definition: ordinal.c:2515
#define SHFORMATDT_UNSUPPORTED_FLAGS
HANDLE WINAPI SHSetTimerQueueTimer(HANDLE hQueue, WAITORTIMERCALLBACK pfnCallback, LPVOID pContext, DWORD dwDueTime, DWORD dwPeriod, LPCSTR lpszLibrary, DWORD dwFlags)
Definition: ordinal.c:4962
#define OBJCOMPAT_UNBINDABLE
Definition: ordinal.c:6438
HICON WINAPI ExtractIconWrapW(HINSTANCE hInstance, LPCWSTR lpszExeFileName, UINT nIconIndex)
Definition: ordinal.c:3815
#define OBJCOMPAT_NEEDSSTORAGEANCESTOR
Definition: ordinal.c:6445
DWORD WINAPI SHLoadFromPropertyBag(IUnknown *lpUnknown, IPropertyBag *lpPropBag)
Definition: ordinal.c:1864
HRESULT(WINAPI * DllGetVersion_func)(DLLVERSIONINFO *)
Definition: ordinal.c:5109
DWORD WINAPI GetFileVersionInfoSizeWrapW(LPCWSTR filename, LPDWORD handle)
Definition: ordinal.c:3634
BOOL WINAPI FDSA_DeleteItem(FDSA_info *info, DWORD where)
Definition: ordinal.c:2487
BOOL WINAPI IsCharDigitW(WCHAR wc)
Definition: ordinal.c:753
HRESULT WINAPI SKGetValueW(DWORD flags, LPCWSTR subkey, LPCWSTR value, DWORD *type, void *data, DWORD *count)
Definition: ordinal.c:5068
HRESULT WINAPIV SHPackDispParams(DISPPARAMS *params, VARIANTARG *args, UINT cnt,...)
Definition: ordinal.c:3250
BOOL WINAPI SHSkipJunction(IBindCtx *pbc, const CLSID *pclsid)
Definition: ordinal.c:4779
struct SHELL_USER_SID SHELL_USER_SID
static const struct objcompat_entry objcompat_table[]
Definition: ordinal.c:6457
struct _enumWndData enumWndData
struct SHELL_USER_PERMISSION SHELL_USER_PERMISSION
BOOL WINAPI SHFreeShared(HANDLE hShared, DWORD dwProcId)
Definition: ordinal.c:315
static HRESULT SHLWAPI_InvokeByIID(IConnectionPoint *iCP, REFIID iid, DISPID dispId, DISPPARAMS *dispParams)
Definition: ordinal.c:3268
DWORD WINAPI SHRemoveAllSubMenus(HMENU hMenu)
Definition: ordinal.c:1752
HMODULE WINAPI SHPinDllOfCLSID(REFIID refiid)
Definition: ordinal.c:2656
BOOL WINAPI IsCharBlankW(WCHAR wc)
Definition: ordinal.c:696
DWORD WINAPI StrCmpICA(LPCSTR lpszSrc, LPCSTR lpszCmp)
Definition: ordinal.c:887
HRESULT WINAPI IUnknown_OnFocusChangeIS(LPUNKNOWN lpUnknown, LPUNKNOWN pFocusObject, BOOL bFocus)
Definition: ordinal.c:4988
#define OBJCOMPAT_NO_WEBVIEW
Definition: ordinal.c:6437
HRESULT WINAPI IConnectionPoint_SimpleInvoke(IConnectionPoint *iCP, DISPID dispId, DISPPARAMS *dispParams)
Definition: ordinal.c:3331
UINT WINAPI ZoneComputePaneSize(HWND hwnd)
Definition: ordinal.c:5218
COLORREF WINAPI ColorAdjustLuma(COLORREF cRGB, int dwLuma, BOOL bUnknown)
Definition: ordinal.c:3909
void WINAPI SHPropagateMessage(HWND hWnd, UINT uiMsgId, WPARAM wParam, LPARAM lParam, BOOL bSend)
Definition: ordinal.c:1719
DWORD WINAPI WNetGetLastErrorWrapW(LPDWORD lpError, LPWSTR lpErrorBuf, DWORD nErrorBufSize, LPWSTR lpNameBuf, DWORD nNameBufSize)
Definition: ordinal.c:3953
static WORD ConvertHue(int wHue, WORD wMid1, WORD wMid2)
Definition: ordinal.c:4010
HRESULT WINAPI MayQSForward(IUnknown *lpUnknown, PVOID lpReserved, REFGUID riidCmdGrp, ULONG cCmds, OLECMD *prgCmds, OLECMDTEXT *pCmdText)
Definition: ordinal.c:2227
DWORD WINAPI StrCmpCW(LPCWSTR lpszSrc, LPCWSTR lpszCmp)
Definition: ordinal.c:869
HINSTANCE shlwapi_hInstance
Definition: shlwapi_main.c:33
#define FDSA_FLAG_INTERNAL_ALLOC
Definition: ordinal.c:2398
struct SHELL_USER_SID * PSHELL_USER_SID
DWORD WINAPI WNetRestoreConnectionWrapW(HWND hwndOwner, LPWSTR lpszDevice)
Definition: ordinal.c:3943
UINT WINAPI DragQueryFileWrapW(HDROP hDrop, UINT lFile, LPWSTR lpszFile, UINT lLength)
Definition: ordinal.c:3575
struct SHELL_USER_PERMISSION * PSHELL_USER_PERMISSION
BOOL WINAPI SHLoadMenuPopup(HINSTANCE hInst, LPCWSTR szName)
Definition: ordinal.c:1666
static BOOL CALLBACK SHLWAPI_EnumChildProc(HWND hWnd, LPARAM lParam)
Definition: ordinal.c:1692
HKEY WINAPI SHGetShellKey(DWORD flags, LPCWSTR sub_key, BOOL create)
Definition: ordinal.c:4806
HRESULT WINAPI SKSetValueW(DWORD flags, LPCWSTR subkey, LPCWSTR value, DWORD type, void *data, DWORD count)
Definition: ordinal.c:5090
#define OBJCOMPAT_COCREATESHELLFOLDERONLY
Definition: ordinal.c:6444
#define IsIface(type)
Definition: ordinal.c:3661
PSECURITY_DESCRIPTOR WINAPI GetShellSecurityDescriptor(const PSHELL_USER_PERMISSION *apUserPerm, int cUserPerm)
Definition: ordinal.c:5264
BOOL WINAPI SHAboutInfoW(LPWSTR, DWORD)
Definition: ordinal.c:934
int WINAPI SHSearchMapInt(const int *lpKeys, const int *lpValues, int iLen, int iKey)
Definition: ordinal.c:2161
DWORD WINAPI StrCmpNICA(LPCSTR lpszSrc, LPCSTR lpszCmp, DWORD len)
Definition: ordinal.c:831
DWORD WINAPI StrCmpNCA(LPCSTR lpszSrc, LPCSTR lpszCmp, INT len)
Definition: ordinal.c:802
HRESULT WINAPI IUnknown_QueryServiceForWebBrowserApp(IUnknown *lpUnknown, REFGUID riid, LPVOID *lppOut)
Definition: ordinal.c:5598
INT WINAPI ZoneCheckUrlExW(LPWSTR szURL, PVOID pUnknown, DWORD dwUnknown2, DWORD dwUnknown3, DWORD dwUnknown4, DWORD dwUnknown5, DWORD dwUnknown6, DWORD dwUnknown7)
Definition: ordinal.c:5552
HWND WINAPI SHSetParentHwnd(HWND hWnd, HWND hWndParent)
Definition: ordinal.c:1158
DWORD WINAPI StrCmpICW(LPCWSTR lpszSrc, LPCWSTR lpszCmp)
Definition: ordinal.c:897
void WINAPI SHChangeNotifyWrap(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
Definition: ordinal.c:5227
void WINAPI SHUnregisterClassesA(HINSTANCE hInst, LPCSTR *lppClasses, INT iCount)
Definition: ordinal.c:2702
LPITEMIDLIST WINAPI SHBrowseForFolderWrapW(LPBROWSEINFOW lpBi)
Definition: ordinal.c:3585
BOOL WINAPI SHGetNewLinkInfoWrapW(LPCWSTR pszLinkTo, LPCWSTR pszDir, LPWSTR pszName, BOOL *pfMustCopy, UINT uFlags)
Definition: ordinal.c:3716
BOOL WINAPI GetFileVersionInfoWrapW(LPCWSTR filename, DWORD handle, DWORD datasize, LPVOID data)
Definition: ordinal.c:3644
INT WINAPI SHVerbExistsNA(LPSTR verb, PVOID pUnknown, PVOID pUnknown2, DWORD dwUnknown3)
Definition: ordinal.c:5575
HMODULE WINAPI MLLoadLibraryA(LPCSTR new_mod, HMODULE inst_hwnd, DWORD dwCrossCodePage)
Definition: ordinal.c:3835
DWORD WINAPI SHMenuIndexFromID(HMENU hMenu, UINT uID)
Definition: ordinal.c:4725
HRESULT WINAPI MayExecForward(IUnknown *lpUnknown, INT nUnknown, REFGUID pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
Definition: ordinal.c:2265
BOOL WINAPI PrintDlgWrapW(LPPRINTDLGW printdlg)
Definition: ordinal.c:3974
HRESULT WINAPI SHGetViewStatePropertyBag(LPCITEMIDLIST pidl, LPWSTR bag_name, DWORD flags, REFIID riid, void **ppv)
Definition: ordinal.c:5427
DWORD WINAPI StrCmpNCW(LPCWSTR lpszSrc, LPCWSTR lpszCmp, INT len)
Definition: ordinal.c:812
#define ISOS_RETURN(x)
BOOL WINAPI FDSA_Initialize(DWORD block_size, DWORD inc, FDSA_info *info, void *mem, DWORD init_blocks)
Definition: ordinal.c:2405
BOOL WINAPI IsCharPunctW(WCHAR wc)
Definition: ordinal.c:715
BOOL WINAPI SHUnlockShared(LPVOID lpView)
Definition: ordinal.c:295
void WINAPI SHUnregisterClassesW(HINSTANCE hInst, LPCWSTR *lppClasses, INT iCount)
Definition: ordinal.c:2722
HRESULT WINAPI RegisterDefaultAcceptHeaders(LPBC lpBC, IUnknown *lpUnknown)
Definition: ordinal.c:348
VOID WINAPI ColorRGBToHLS(COLORREF cRGB, LPWORD pwHue, LPWORD pwLuminance, LPWORD pwSaturation)
Definition: ordinal.c:4506
HRESULT WINAPI IUnknown_SetSite(IUnknown *obj, IUnknown *site)
Definition: ordinal.c:1411
DWORD WINAPI MLSetMLHInstance(HINSTANCE hInst, HANDLE hHeap)
Definition: ordinal.c:4162
HRESULT WINAPI GetAcceptLanguagesW(LPWSTR langbuf, LPDWORD buflen)
Definition: ordinal.c:518
INT WINAPI SHStringFromGUIDA(REFGUID guid, LPSTR lpszDest, INT cchMax)
Definition: ordinal.c:628
DWORD WINAPI SHRegisterClassA(WNDCLASSA *wndclass)
Definition: ordinal.c:1817
BOOL WINAPI SHAboutInfoA(LPSTR lpszDest, DWORD dwDestLen)
Definition: ordinal.c:915
BOOL WINAPI SHQueueUserWorkItem(LPTHREAD_START_ROUTINE pfnCallback, LPVOID pContext, LONG lPriority, DWORD_PTR dwTag, DWORD_PTR *pdwId, LPCSTR pszModule, DWORD dwFlags)
Definition: ordinal.c:4946
HRESULT WINAPI IConnectionPoint_OnChanged(IConnectionPoint *lpCP, DISPID dispID)
Definition: ordinal.c:3364
HRESULT WINAPI SHPropertyBag_ReadLONG(IPropertyBag *ppb, LPCWSTR pszPropName, LPLONG pValue)
Definition: ordinal.c:5806
HRESULT WINAPI SKDeleteValueW(DWORD flags, LPCWSTR subkey, LPCWSTR value)
Definition: ordinal.c:5048
DWORD WINAPI SHWinHelpOnDemandA(HWND hwnd, LPCSTR helpfile, DWORD flags1, VOID *ptr1, DWORD flags2)
Definition: ordinal.c:4113
DWORD WINAPI SHGetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1236
DWORD WINAPI SHQueryValueExW(HKEY hKey, LPCWSTR lpszValue, LPDWORD lpReserved, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1461
EXTERN_C HRESULT WINAPI SHInvokeCommandWithFlagsAndSite(_In_opt_ HWND hWnd, _In_opt_ IUnknown *pUnk, _In_ IShellFolder *pShellFolder, _In_ LPCITEMIDLIST pidl, _In_ UINT fCMIC, _In_opt_ LPCSTR pszVerb)
Definition: utils.cpp:165
HRESULT WINAPI CreateFormatEnumerator(UINT cfmtetc, FORMATETC *rgfmtetc, IEnumFORMATETC **ppenumfmtetc)
Definition: format.c:177
HRESULT WINAPI RegisterFormatEnumerator(LPBC pBC, IEnumFORMATETC *pEFetc, DWORD reserved)
Definition: format.c:194
#define MAKE_HRESULT(sev, fac, code)
Definition: dmerror.h:29
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
#define pt(x, y)
Definition: drawing.c:79
#define RGB(r, g, b)
Definition: precomp.h:71
#define GetBValue(quad)
Definition: precomp.h:75
#define GetGValue(quad)
Definition: precomp.h:74
#define GetRValue(quad)
Definition: precomp.h:73
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
#define INFINITE
Definition: serial.h:102
_In_ PUNKNOWN pUnknown
Definition: drmk.h:76
HINSTANCE hInst
Definition: dxdiag.c:13
static unsigned char buff[32768]
Definition: fatten.c:17
HANDLE NTAPI CreateFileMappingA(IN HANDLE hFile, IN LPSECURITY_ATTRIBUTES lpFileMappingAttributes, IN DWORD flProtect, IN DWORD dwMaximumSizeHigh, IN DWORD dwMaximumSizeLow, IN LPCSTR lpName)
Definition: filemap.c:23
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
PWCHAR pValue
pKey DeleteObject()
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint res
Definition: glext.h:9613
GLenum src
Definition: glext.h:6340
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLintptr offset
Definition: glext.h:5920
GLenum GLint GLuint mask
Definition: glext.h:6028
GLdouble GLdouble right
Definition: glext.h:10859
GLenum const GLfloat * params
Definition: glext.h:5645
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLint left
Definition: glext.h:7726
GLbitfield flags
Definition: glext.h:7161
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLboolean GLuint group
Definition: glext.h:11120
GLuint64EXT * result
Definition: glext.h:11304
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
VOID NTAPI GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer)
Definition: heapmem.c:1365
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define C1_CNTRL
Definition: unicode.h:36
#define C1_DIGIT
Definition: unicode.h:33
#define C1_PUNCT
Definition: unicode.h:35
#define C1_BLANK
Definition: unicode.h:37
#define C1_XDIGIT
Definition: unicode.h:38
BOOL WINAPI GetCurrentHwProfileA(LPHW_PROFILE_INFOA lpHwProfileInfo)
Definition: hwprofiles.c:28
HRESULT WINAPI SHDefExtractIconW(LPCWSTR pszIconFile, int iIndex, UINT uFlags, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize)
Definition: iconcache.cpp:1015
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
static LRESULT WINAPI wndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: imm32.c:185
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define PROCESS_DUP_HANDLE
#define InterlockedCompareExchangePointer
Definition: interlocked.h:144
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
const char * filename
Definition: ioapi.h:137
static DWORD block_size(DWORD block)
Definition: jsutils.c:66
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_w
Definition: kernel32.h:32
BOOL is_wow64
Definition: main.c:38
INT WINAPI GetTimeFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpTimeStr, INT cchOut)
Definition: lcformat.c:1089
INT WINAPI GetDateFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpDateStr, INT cchOut)
Definition: lcformat.c:989
const char * appName(const char *argv0)
Definition: loadlib.c:89
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
#define CopyMemory
Definition: minwinbase.h:29
PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE
Definition: minwinbase.h:124
LONG_PTR LPARAM
Definition: minwindef.h:175
LONG_PTR LRESULT
Definition: minwindef.h:176
UINT_PTR WPARAM
Definition: minwindef.h:174
CONST void * LPCVOID
Definition: minwindef.h:164
__u16 date
Definition: mkdosfs.c:8
__u16 time
Definition: mkdosfs.c:8
#define error(str)
Definition: mkdosfs.c:1605
#define pch(ap)
Definition: match.c:418
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
LPCWSTR szPath
Definition: env.c:37
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
static PVOID ptr
Definition: dispmode.c:27
#define sprintf
Definition: sprintf.c:45
HDC hdc
Definition: main.c:9
static PSID pSid
Definition: security.c:74
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:143
static HDC
Definition: imagelist.c:88
static HICON
Definition: imagelist.c:80
static HTREEITEM hChild
Definition: treeview.c:383
const IID IID_IObjectWithSite
const char * var
Definition: shader.c:5666
static LPCWSTR szVersion
Definition: asmcache.c:748
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
HRESULT hres
Definition: protocol.c:465
static HANDLE ULONG_PTR dwData
Definition: file.c:35
static WAITORTIMERCALLBACK
Definition: thread.c:81
static IActiveScriptSite * site
Definition: script.c:149
static const struct access_res create[16]
Definition: package.c:7505
static va_list valist
Definition: printf.c:46
static char * dest
Definition: rtl.c:135
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
static SHCONTF
Definition: ordinal.c:61
_shellkey_flags
Definition: ordinal.c:2804
@ SHKEY_Subkey_Handlers
Definition: ordinal.c:2813
@ SHKEY_Root_HKLM
Definition: ordinal.c:2806
@ SHKEY_Key_ShellNoRoam
Definition: ordinal.c:2809
@ SHKEY_Subkey_Volatile
Definition: ordinal.c:2815
@ SHKEY_Subkey_Associations
Definition: ordinal.c:2814
@ SHKEY_Key_Classes
Definition: ordinal.c:2810
@ SHKEY_Subkey_MUICache
Definition: ordinal.c:2816
@ SHKEY_Key_Explorer
Definition: ordinal.c:2807
@ SHKEY_Root_HKCU
Definition: ordinal.c:2805
@ SHKEY_Subkey_FileExts
Definition: ordinal.c:2817
@ SHKEY_Key_Shell
Definition: ordinal.c:2808
@ SHKEY_Subkey_Default
Definition: ordinal.c:2811
@ SHKEY_Subkey_ResourceName
Definition: ordinal.c:2812
static VARIANTARG static DISPID
Definition: ordinal.c:49
INTERNETFEATURELIST feature
Definition: misc.c:1719
WCHAR strW[12]
Definition: clipboard.c:2025
static MONITORINFO mi
Definition: win.c:7338
#define min(a, b)
Definition: monoChain.cc:55
struct _ACL ACL
struct _SECURITY_DESCRIPTOR SECURITY_DESCRIPTOR
struct _ACL * PACL
Definition: security.c:105
struct _ACCESS_ALLOWED_ACE ACCESS_ALLOWED_ACE
const CLSID * clsid
Definition: msctf.cpp:50
platform
Definition: msipriv.h:364
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define VER_PLATFORM_WIN32_NT
Definition: rtltypes.h:238
#define VER_PLATFORM_WIN32_WINDOWS
Definition: rtltypes.h:237
#define VER_PLATFORM_WIN32s
Definition: rtltypes.h:236
HMODULE hModule
Definition: netsh.c:17
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
_In_ LPWSTR _In_ DWORD _In_ LPCVOID pvData
Definition: netsh.h:116
#define _Inout_
Definition: no_sal2.h:162
#define _Out_writes_(s)
Definition: no_sal2.h:176
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
#define KEY_ALL_ACCESS
Definition: nt_native.h:1044
#define KEY_READ
Definition: nt_native.h:1026
#define DWORD
Definition: nt_native.h:44
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
#define LOCALE_USER_DEFAULT
#define UNICODE_NULL
#define ANSI_NULL
interface IBindCtx * LPBC
Definition: objfwd.h:18
#define LRESULT
Definition: ole.h:14
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
#define V_BOOL(A)
Definition: oleauto.h:224
#define V_ARRAY(A)
Definition: oleauto.h:222
#define V_UNKNOWN(A)
Definition: oleauto.h:281
#define V_UI2(A)
Definition: oleauto.h:268
#define DISPATCH_METHOD
Definition: oleauto.h:1006
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
#define V_BYREF(A)
Definition: oleauto.h:228
#define V_I4(A)
Definition: oleauto.h:247
#define V_UI4(A)
Definition: oleauto.h:270
#define V_DISPATCH(A)
Definition: oleauto.h:239
const GUID IID_IConnectionPointContainer
const GUID IID_IPropertyNotifySink
const GUID IID_IOleWindow
const GUID IID_IEnumFORMATETC
const GUID IID_IOleControlSite
const GUID IID_IDispatch
#define PathCombineW
Definition: pathcch.h:318
#define UNALIGNED
Definition: pecoff.h:347
#define LOWORD(l)
Definition: pedump.c:82
#define WS_CHILD
Definition: pedump.c:617
BYTE * PBYTE
Definition: pedump.c:66
#define WS_POPUP
Definition: pedump.c:616
short SHORT
Definition: pedump.c:59
long LONG
Definition: pedump.c:60
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1490
BOOL WINAPI PlaySoundW(LPCWSTR pszSoundW, HMODULE hmod, DWORD fdwSound)
Definition: playsound.c:709
static const WCHAR szName[]
Definition: powrprof.c:45
const GUID IID_IPersist
Definition: proxy.cpp:14
const GUID IID_IPersistPropertyBag
Definition: proxy.cpp:11
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define IID_NULL
Definition: guiddef.h:98
#define REFCLSID
Definition: guiddef.h:117
#define OS_WIN2000TERMINAL
Definition: shlwapi.h:238
#define OS_WIN98_GOLD
Definition: shlwapi.h:232
#define OS_APPLIANCE
Definition: shlwapi.h:262
#define OS_WIN95ORGREATER
Definition: shlwapi.h:228
#define OS_MEDIACENTER
Definition: shlwapi.h:261
#define OS_WIN95_GOLD
Definition: shlwapi.h:242
#define FDTF_SHORTTIME
Definition: shlwapi.h:97
#define OS_SMALLBUSINESSSERVER
Definition: shlwapi.h:258
#define OS_WIN98ORGREATER
Definition: shlwapi.h:231
#define OS_NT
Definition: shlwapi.h:227
#define OS_MEORGREATER
Definition: shlwapi.h:243
#define OS_WIN2000ADVSERVER
Definition: shlwapi.h:236
#define OS_XPORGREATER
Definition: shlwapi.h:244
#define STIF_SUPPORT_HEX
Definition: shlwapi.h:1059
#define OS_WIN2000ORGREATER
Definition: shlwapi.h:233
#define FDTF_LONGDATE
Definition: shlwapi.h:100
#define OS_WIN2000PRO
Definition: shlwapi.h:234
#define OS_WIN2000SERVER
Definition: shlwapi.h:235
#define OS_TERMINALSERVER
Definition: shlwapi.h:250
#define OS_SERVERADMINUI
Definition: shlwapi.h:260
#define OS_PROFESSIONAL
Definition: shlwapi.h:246
#define OS_WOW6432
Definition: shlwapi.h:256
#define OS_TERMINALCLIENT
Definition: shlwapi.h:240
#define OS_DOMAINMEMBER
Definition: shlwapi.h:254
#define FDTF_DEFAULT
Definition: shlwapi.h:99
#define OS_WIN2000DATACENTER
Definition: shlwapi.h:237
#define OS_NT4ORGREATER
Definition: shlwapi.h:229
#define OS_TABLETPC
Definition: shlwapi.h:259
#define OS_ADVSERVER
Definition: shlwapi.h:248
#define OS_EMBEDDED
Definition: shlwapi.h:239
#define OS_SERVER
Definition: shlwapi.h:249
#define OS_TERMINALREMOTEADMIN
Definition: shlwapi.h:241
#define FDTF_LONGTIME
Definition: shlwapi.h:101
#define OS_FASTUSERSWITCHING
Definition: shlwapi.h:252
#define OS_PERSONALTERMINALSERVER
Definition: shlwapi.h:251
_In_ UINT uID
Definition: shlwapi.h:156
#define OS_WELCOMELOGONUI
Definition: shlwapi.h:253
#define OS_HOME
Definition: shlwapi.h:245
#define OS_ANYSERVER
Definition: shlwapi.h:255
#define OS_DATACENTER
Definition: shlwapi.h:247
#define OS_WEBSERVER
Definition: shlwapi.h:257
_In_opt_ LPCSTR _In_opt_ LPCSTR pszValue
Definition: shlwapi.h:783
_In_opt_ void _In_ DWORD _In_opt_ LPTHREAD_START_ROUTINE pfnCallback
Definition: shlwapi.h:66
struct _DllVersionInfo DLLVERSIONINFO
#define FDTF_SHORTDATE
Definition: shlwapi.h:98
const WCHAR * str
#define REG_DWORD
Definition: sdbapi.c:615
#define WINAPIV
Definition: sdbpapi.h:64
_CRT_RESTORE_GCC_WARNINGS _CRT_DISABLE_GCC_WARNINGS _Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
DWORD LCID
Definition: nls.h:13
strcat
Definition: string.h:92
strcpy
Definition: string.h:131
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197
#define exit(n)
Definition: config.h:202
#define memset(x, y, z)
Definition: compat.h:39
#define args
Definition: format.c:66
BOOL WINAPI SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bDaclPresent, PACL pDacl, BOOL bDaclDefaulted)
Definition: sec.c:262
HICON WINAPI ExtractIconW(HINSTANCE hInstance, LPCWSTR lpszFile, UINT nIconIndex)
Definition: shell32_main.c:877
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:430
_In_ UINT _In_ UINT cch
Definition: shellapi.h:432
_In_ LPCSTR pszDir
Definition: shellapi.h:601
_In_ LPCSTR _Out_ BOOL * pfMustCopy
Definition: shellapi.h:603
BOOL WINAPI SHGetNewLinkInfoW(LPCWSTR pszLinkTo, LPCWSTR pszDir, LPWSTR pszName, BOOL *pfMustCopy, UINT uFlags)
Definition: shellord.c:2563
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2723
int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
Definition: shlfileop.cpp:2200
HRESULT hr
Definition: shlfolder.c:183
#define IInputObjectSite_Release(p)
Definition: shlobj.h:740
#define IInputObject_TranslateAcceleratorIO(p, a)
Definition: shlobj.h:720
#define IInputObject_HasFocusIO(p)
Definition: shlobj.h:719
#define IQueryInfo_Release(p)
Definition: shlobj.h:691
#define IInputObject_Release(p)
Definition: shlobj.h:716
#define IQueryInfo_GetInfoFlags(p, a)
Definition: shlobj.h:694
#define IInputObjectSite_OnFocusChangeIS(p, a, b)
Definition: shlobj.h:742
#define IInputObject_UIActivateIO(p, a, b)
Definition: shlobj.h:718
HRESULT WINAPI SHPropertyBag_WriteRECTL(IPropertyBag *ppb, LPCWSTR pszPropName, const RECTL *prcl)
HRESULT WINAPI SHPropertyBag_ReadDWORD(IPropertyBag *ppb, LPCWSTR pszPropName, DWORD *pdwValue)
HRESULT WINAPI SHPropertyBag_ReadSHORT(IPropertyBag *ppb, LPCWSTR pszPropName, SHORT *psValue)
HRESULT WINAPI SHPropertyBag_ReadGUID(IPropertyBag *ppb, LPCWSTR pszPropName, GUID *pguid)
BOOL WINAPI SHPropertyBag_ReadBOOLOld(IPropertyBag *ppb, LPCWSTR pszPropName, BOOL bDefValue)
HRESULT WINAPI SHPropertyBag_ReadPOINTS(IPropertyBag *ppb, LPCWSTR pszPropName, POINTS *ppts)
HRESULT WINAPI SHPropertyBag_WriteBOOL(IPropertyBag *ppb, LPCWSTR pszPropName, BOOL bValue)
HRESULT WINAPI SHPropertyBag_ReadPOINTL(IPropertyBag *ppb, LPCWSTR pszPropName, POINTL *pptl)
HRESULT WINAPI SHPropertyBag_WriteGUID(IPropertyBag *ppb, LPCWSTR pszPropName, const GUID *pguid)
HRESULT WINAPI SHPropertyBag_WriteSHORT(IPropertyBag *ppb, LPCWSTR pszPropName, SHORT sValue)
HRESULT WINAPI SHPropertyBag_ReadStr(IPropertyBag *ppb, LPCWSTR pszPropName, LPWSTR pszDst, int cchMax)
EXTERN_C BOOL WINAPI SHBoolSystemParametersInfo(UINT uiAction, PVOID pvParam)
HRESULT WINAPI SHPropertyBag_ReadBSTR(IPropertyBag *ppb, LPCWSTR pszPropName, BSTR *pbstr)
HRESULT WINAPI SHPropertyBag_ReadRECTL(IPropertyBag *ppb, LPCWSTR pszPropName, RECTL *prcl)
HRESULT WINAPI SHPropertyBag_Delete(IPropertyBag *ppb, LPCWSTR pszPropName)
PVOID WINAPI SHLockSharedEx(HANDLE hData, DWORD dwProcessId, BOOL bWriteAccess)
HRESULT WINAPI SHPropertyBag_ReadStream(IPropertyBag *ppb, LPCWSTR pszPropName, IStream **ppStream)
HRESULT WINAPI SHPropertyBag_ReadBOOL(IPropertyBag *ppb, LPCWSTR pszPropName, BOOL *pbValue)
HRESULT WINAPI SHLoadRegUIStringA(HKEY hkey, LPCSTR value, LPSTR buf, DWORD size)
HRESULT WINAPI SHPropertyBag_WriteStr(IPropertyBag *ppb, LPCWSTR pszPropName, LPCWSTR pszValue)
HRESULT WINAPI SHPropertyBag_WriteStream(IPropertyBag *ppb, LPCWSTR pszPropName, IStream *pStream)
HRESULT WINAPI SHPropertyBag_WritePOINTL(IPropertyBag *ppb, LPCWSTR pszPropName, const POINTL *pptl)
HRESULT WINAPI SHPropertyBag_WritePOINTS(IPropertyBag *ppb, LPCWSTR pszPropName, const POINTS *ppts)
HRESULT WINAPI SHPropertyBag_WriteLONG(IPropertyBag *ppb, LPCWSTR pszPropName, LONG lValue)
HRESULT WINAPI SHPropertyBag_ReadType(IPropertyBag *ppb, LPCWSTR pszPropName, VARIANTARG *pvarg, VARTYPE vt)
HRESULT WINAPI SHPropertyBag_WriteDWORD(IPropertyBag *ppb, LPCWSTR pszPropName, DWORD dwValue)
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
OPENFILENAME ofn
Definition: sndrec32.cpp:56
#define _countof(array)
Definition: sndvol32.h:70
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwOptions
Definition: solitaire.cpp:25
BYTE block_size
Definition: ordinal.c:2394
BYTE flags
Definition: ordinal.c:2395
DWORD blocks_alloced
Definition: ordinal.c:2392
DWORD num_items
Definition: ordinal.c:2390
void * mem
Definition: ordinal.c:2391
BYTE inc
Definition: ordinal.c:2393
LONG lfHeight
Definition: dimm.idl:59
BYTE lfCharSet
Definition: dimm.idl:67
Definition: shlwapi.h:139
const IID * piid
Definition: shlwapi.h:140
DWORD dwOffset
Definition: shlwapi.h:142
SHELL_USER_SID susID
Definition: ordinal.c:5239
DWORD dwUserID
Definition: ordinal.c:5235
DWORD dwUserGroupID
Definition: ordinal.c:5234
SID_IDENTIFIER_AUTHORITY sidAuthority
Definition: ordinal.c:5233
DWORD dwMajorVersion
Definition: shlwapi.h:121
DWORD cbSize
Definition: shlwapi.h:120
Definition: scsiwmi.h:51
ULONG dwPlatformId
Definition: rtltypes.h:241
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:237
ULONG dwMajorVersion
Definition: rtltypes.h:238
ULONG dwMinorVersion
Definition: rtltypes.h:239
LONG y
Definition: windef.h:124
LONG x
Definition: windef.h:123
HBRUSH hbrBackground
Definition: winuser.h:3272
HICON hIcon
Definition: winuser.h:3270
HINSTANCE hInstance
Definition: winuser.h:3269
HCURSOR hCursor
Definition: winuser.h:3271
int cbWndExtra
Definition: winuser.h:3268
UINT style
Definition: winuser.h:3265
LPCSTR lpszMenuName
Definition: winuser.h:3273
LPCSTR lpszClassName
Definition: winuser.h:3274
WNDPROC lpfnWndProc
Definition: winuser.h:3266
int cbClsExtra
Definition: winuser.h:3267
LPCWSTR lpszClassName
Definition: winuser.h:3287
LPCWSTR lpszMenuName
Definition: winuser.h:3286
HBRUSH hbrBackground
Definition: winuser.h:3285
HICON hIcon
Definition: winuser.h:3283
HINSTANCE hInstance
Definition: winuser.h:3282
int cbClsExtra
Definition: winuser.h:3280
UINT style
Definition: winuser.h:3278
WNDPROC lpfnWndProc
Definition: winuser.h:3279
int cbWndExtra
Definition: winuser.h:3281
HCURSOR hCursor
Definition: winuser.h:3284
WPARAM wParam
Definition: ordinal.c:1686
LPARAM lParam
Definition: ordinal.c:1687
UINT uiMsgId
Definition: ordinal.c:1685
Definition: match.c:390
Definition: ftp_var.h:139
Definition: bug.cpp:8
Definition: format.c:58
Definition: copy.c:22
Definition: mem.c:349
Definition: name.c:39
Definition: ordinal.c:6451
DWORD value
Definition: ordinal.c:6453
Definition: ps.c:97
DWORD cbSize
Definition: winuser.h:3886
SHORT y
Definition: windef.h:137
SHORT x
Definition: windef.h:136
DWORD policy
Definition: ordinal.c:2836
LPCWSTR keystr
Definition: ordinal.c:2838
LPCWSTR appstr
Definition: ordinal.c:2837
Definition: windef.h:99
Definition: tools.h:99
#define max(a, b)
Definition: svc.c:63
#define LONG_PTR
Definition: treelist.c:79
#define GWLP_WNDPROC
Definition: treelist.c:66
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
uint32_t DWORD_PTR
Definition: typedefs.h:65
unsigned char * LPBYTE
Definition: typedefs.h:53
int32_t * LPLONG
Definition: typedefs.h:58
uint16_t * LPWORD
Definition: typedefs.h:56
void * PVOID
Definition: typedefs.h:50
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t * LPDWORD
Definition: typedefs.h:59
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
Definition: pdh_main.c:96
HRESULT WINAPI DECLSPEC_HOTPATCH VariantChangeType(VARIANTARG *pvargDest, VARIANTARG *pvargSrc, USHORT wFlags, VARTYPE vt)
Definition: variant.c:962
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:568
OSVERSIONINFO osvi
Definition: ver.c:28
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
int retval
Definition: wcstombs.cpp:91
_In_ size_t cnt
Definition: wcstombs.cpp:43
#define V_INT(x)
Definition: webchild.h:78
HDC hdcMem
Definition: welcome.c:104
UINT WINAPI GetPaletteEntries(HPALETTE hpal, UINT iStartIndex, UINT cEntries, LPPALETTEENTRY ppe)
Definition: palette.c:64
#define FILE_MAP_WRITE
Definition: winbase.h:156
#define DOCKINFO_DOCKED
Definition: winbase.h:271
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:398
#define FILE_MAP_ALL_ACCESS
Definition: winbase.h:158
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1158
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:396
#define DOCKINFO_UNDOCKED
Definition: winbase.h:270
_In_ POINTL * pptl
Definition: winddi.h:3741
_In_ ULONG _In_ CLIPOBJ _In_ RECTL * prcl
Definition: winddi.h:3531
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
_In_ BOOL bEnable
Definition: winddi.h:3426
#define __ms_va_list
Definition: windef.h:244
#define __ms_va_end(list)
Definition: windef.h:246
#define __ms_va_start(list, arg)
Definition: windef.h:245
DWORD COLORREF
Definition: windef.h:94
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
#define OS_WIN2000ORGREATER_ALT
Definition: shlwapi.h:1123
#define TPS_EXECUTEIO
Definition: shlwapi.h:1160
#define TPS_LONGEXECTIME
Definition: shlwapi.h:1161
#define OS_WIN32SORGREATER
Definition: shlwapi.h:1119
#define strcmpW(s1, s2)
Definition: unicode.h:44
#define strlenW(s)
Definition: unicode.h:34
#define strrchrW(s, c)
Definition: unicode.h:41
#define sprintfW
Definition: unicode.h:64
#define strcpyW(d, s)
Definition: unicode.h:35
#define FACILITY_NULL
Definition: winerror.h:24
#define S_FALSE
Definition: winerror.h:3451
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define E_NOT_SUFFICIENT_BUFFER
Definition: winerror.h:3437
#define E_NOINTERFACE
Definition: winerror.h:3479
#define DISP_E_BADVARTYPE
Definition: winerror.h:3620
#define DRAGDROP_E_NOTREGISTERED
Definition: winerror.h:3760
#define SEVERITY_SUCCESS
Definition: winerror.h:177
#define E_POINTER
Definition: winerror.h:3480
#define HRESULT_CODE(hr)
Definition: winerror.h:188
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
HPALETTE WINAPI CreatePalette(_In_reads_(_Inexpressible_(2 *sizeof(WORD)+plpal->palNumEntries *sizeof(PALETTEENTRY))) const LOGPALETTE *)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI ExtTextOutA(_In_ HDC hdc, _In_ int x, _In_ int y, _In_ UINT options, _In_opt_ const RECT *lprect, _In_reads_opt_(c) LPCSTR lpString, _In_ UINT c, _In_reads_opt_(c) const INT *lpDx)
UINT WINAPI GetSystemPaletteEntries(_In_ HDC hdc, _In_ UINT iStart, _In_ UINT cEntries, _Out_writes_opt_(cEntries) LPPALETTEENTRY pPalEntries)
#define ETO_OPAQUE
Definition: wingdi.h:647
#define PLANES
Definition: wingdi.h:721
#define BITSPIXEL
Definition: wingdi.h:720
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
BOOL WINAPI DeleteDC(_In_ HDC)
HPALETTE WINAPI CreateHalftonePalette(_In_opt_ HDC)
_In_ DWORD _In_ int _In_ int _In_opt_ LPNLSVERSIONINFO _In_opt_ LPVOID lpReserved
Definition: winnls.h:1268
#define CT_CTYPE3
Definition: winnls.h:257
#define CT_CTYPE1
Definition: winnls.h:255
#define TIME_NOSECONDS
Definition: winnls.h:296
#define DATE_LONGDATE
Definition: winnls.h:210
#define DATE_SHORTDATE
Definition: winnls.h:209
#define WT_EXECUTEINIOTHREAD
Definition: winnt_old.h:1085
#define WT_EXECUTELONGFUNCTION
Definition: winnt_old.h:1089
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define SW_SHOWNORMAL
Definition: winuser.h:781
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define SetWindowLongPtrA
Definition: winuser.h:5456
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:838
#define MB_SETFOREGROUND
Definition: winuser.h:825
UINT WINAPI GetMenuDefaultItem(_In_ HMENU hMenu, _In_ UINT fByPos, _In_ UINT gmdiFlags)
#define QS_SENDMESSAGE
Definition: winuser.h:891
#define MIIM_ID
Definition: winuser.h:733
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
BOOL WINAPI UnregisterClassA(_In_ LPCSTR, HINSTANCE)
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND WINAPI SetParent(_In_ HWND, _In_opt_ HWND)
#define HWND_BROADCAST
Definition: winuser.h:1215
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define IDC_ARROW
Definition: winuser.h:695
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MF_CHECKED
Definition: winuser.h:132
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1391
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2457
BOOL WINAPI EnumChildWindows(_In_opt_ HWND, _In_ WNDENUMPROC, _In_ LPARAM)
#define WM_GETFONT
Definition: winuser.h:1679
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
LRESULT WINAPI SendMessageTimeoutW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM, _In_ UINT, _In_ UINT, _Out_opt_ PDWORD_PTR)
#define MF_UNCHECKED
Definition: winuser.h:204
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define SPIF_SENDCHANGE
Definition: winuser.h:1600
BOOL WINAPI IsWindowUnicode(_In_ HWND)
DWORD WINAPI MsgWaitForMultipleObjectsEx(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask, _In_ DWORD dwFlags)
#define SPIF_UPDATEINIFILE
Definition: winuser.h:1599
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define MIIM_SUBMENU
Definition: winuser.h:734
#define MF_ENABLED
Definition: winuser.h:128
BOOL WINAPI IsChild(_In_ HWND, _In_ HWND)
LRESULT WINAPI SendMessageTimeoutA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM, _In_ UINT, _In_ UINT, _Out_opt_ PDWORD_PTR)
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define WM_SETFONT
Definition: winuser.h:1678
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define MF_BYPOSITION
Definition: winuser.h:203
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
HDC WINAPI GetDC(_In_opt_ HWND)
BOOL WINAPI GetClassInfoA(_In_opt_ HINSTANCE, _In_ LPCSTR, _Out_ LPWNDCLASSA)
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
HWND WINAPI GetParent(_In_ HWND)
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
BOOL WINAPI DestroyMenu(_In_ HMENU)
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
#define SMTO_ABORTIFHUNG
Definition: winuser.h:1234
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
HMENU WINAPI LoadMenuW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:3008
BOOL WINAPI GetClassInfoW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _Out_ LPWNDCLASSW)
#define SetWindowLongPtrW
Definition: winuser.h:5457
#define GWL_STYLE
Definition: winuser.h:863
UINT WINAPI RegisterClipboardFormatA(_In_ LPCSTR)
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define PM_NOREMOVE
Definition: winuser.h:1206
HANDLE WINAPI RemovePropA(_In_ HWND, _In_ LPCSTR)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2442
#define COLOR_BTNFACE
Definition: winuser.h:939
#define MF_GRAYED
Definition: winuser.h:129
DWORD WINAPI WNetRestoreConnectionW(HWND hwndOwner, LPCWSTR lpszDevice)
Definition: wnet.c:2475
DWORD WINAPI WNetGetLastErrorW(LPDWORD lpError, LPWSTR lpErrorBuf, DWORD nErrorBufSize, LPWSTR lpNameBuf, DWORD nNameBufSize)
Definition: wnet.c:3013
#define DUPLICATE_SAME_ACCESS
#define DUPLICATE_CLOSE_SOURCE
#define VER_NT_WORKSTATION
struct _OSVERSIONINFOA OSVERSIONINFOA
struct _TOKEN_USER * PTOKEN_USER
#define ACCESS_ALLOWED_ACE_TYPE
Definition: setypes.h:717
#define TOKEN_QUERY
Definition: setypes.h:940
@ TokenUser
Definition: setypes.h:978
#define ACCESS_DENIED_ACE_TYPE
Definition: setypes.h:718
#define SECURITY_DESCRIPTOR_REVISION
Definition: setypes.h:58
#define SECURITY_NULL_SID_AUTHORITY
Definition: setypes.h:524
#define ACL_REVISION
Definition: setypes.h:39
static unsigned int block
Definition: xmlmemory.c:101
const char * LPCSTR
Definition: xmlstorage.h:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
char * LPSTR
Definition: xmlstorage.h:182
char CHAR
Definition: xmlstorage.h:175
unsigned char BYTE
Definition: xxhash.c:193