ReactOS 0.4.16-dev-1360-g66b782d
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 */
3071{
3072 static const char szIntegratedBrowser[] = "IntegratedBrowser";
3073 static DWORD dwState = 0;
3074 HKEY hKey;
3075 DWORD dwRet, dwData, dwSize;
3076 HMODULE hshell32;
3077
3078 if (dwState)
3079 return dwState;
3080
3081 /* If shell32 exports DllGetVersion(), the browser is integrated */
3082 dwState = 1;
3083 hshell32 = LoadLibraryA("shell32.dll");
3084 if (hshell32)
3085 {
3086 FARPROC pDllGetVersion;
3087 pDllGetVersion = GetProcAddress(hshell32, "DllGetVersion");
3088 dwState = pDllGetVersion ? 2 : 1;
3089 FreeLibrary(hshell32);
3090 }
3091
3092 /* Set or delete the key accordingly */
3094 "Software\\Microsoft\\Internet Explorer", 0,
3096 if (!dwRet)
3097 {
3098 dwRet = RegQueryValueExA(hKey, szIntegratedBrowser, 0, 0,
3099 (LPBYTE)&dwData, &dwSize);
3100
3101 if (!dwRet && dwState == 1)
3102 {
3103 /* Value exists but browser is not integrated */
3104 RegDeleteValueA(hKey, szIntegratedBrowser);
3105 }
3106 else if (dwRet && dwState == 2)
3107 {
3108 /* Browser is integrated but value does not exist */
3109 dwData = TRUE;
3110 RegSetValueExA(hKey, szIntegratedBrowser, 0, REG_DWORD,
3111 (LPBYTE)&dwData, sizeof(dwData));
3112 }
3114 }
3115 return dwState;
3116}
3117
3118/*************************************************************************
3119 * @ [SHLWAPI.278]
3120 *
3121 * Unicode version of SHCreateWorkerWindowA.
3122 */
3124 DWORD dwStyle, HMENU hMenu, LONG_PTR wnd_extra)
3125{
3126 static const WCHAR szClass[] = { 'W', 'o', 'r', 'k', 'e', 'r', 'W', 0 };
3127 WNDCLASSW wc;
3128 HWND hWnd;
3129
3130 TRACE("(%p, %p, 0x%08x, 0x%08x, %p, 0x%08lx)\n",
3131 wndProc, hWndParent, dwExStyle, dwStyle, hMenu, wnd_extra);
3132
3133 /* If our OS is natively ANSI, use the ANSI version */
3134 if (GetVersion() & 0x80000000) /* not NT */
3135 {
3136 TRACE("fallback to ANSI, ver 0x%08x\n", GetVersion());
3137 return SHCreateWorkerWindowA(wndProc, hWndParent, dwExStyle, dwStyle, hMenu, wnd_extra);
3138 }
3139
3140 /* Create Window class */
3141 wc.style = 0;
3143 wc.cbClsExtra = 0;
3144 wc.cbWndExtra = sizeof(LONG_PTR);
3146 wc.hIcon = NULL;
3148 wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
3149 wc.lpszMenuName = NULL;
3150 wc.lpszClassName = szClass;
3151
3152 SHRegisterClassW(&wc);
3153
3154 hWnd = CreateWindowExW(dwExStyle, szClass, 0, dwStyle, 0, 0, 0, 0,
3155 hWndParent, hMenu, shlwapi_hInstance, 0);
3156 if (hWnd)
3157 {
3158 SetWindowLongPtrW(hWnd, 0, wnd_extra);
3160 }
3161
3162 return hWnd;
3163}
3164
3165/*************************************************************************
3166 * @ [SHLWAPI.279]
3167 *
3168 * Get and show a context menu from a shell folder.
3169 *
3170 * PARAMS
3171 * hWnd [I] Window displaying the shell folder
3172 * lpFolder [I] IShellFolder interface
3173 * lpApidl [I] Id for the particular folder desired
3174 *
3175 * RETURNS
3176 * Success: S_OK.
3177 * Failure: An HRESULT error code indicating the error.
3178 */
3180{
3181 TRACE("%p %p %p\n", hWnd, lpFolder, lpApidl);
3182#ifdef __REACTOS__
3183 return SHInvokeCommand(hWnd, lpFolder, lpApidl, NULL);
3184#else
3185 return SHInvokeCommand(hWnd, lpFolder, lpApidl, 0);
3186#endif
3187}
3188
3189/*************************************************************************
3190 * @ [SHLWAPI.281]
3191 *
3192 * _SHPackDispParamsV
3193 */
3195{
3196 VARIANTARG *iter;
3197
3198 TRACE("(%p %p %u ...)\n", params, args, cnt);
3199
3200 params->rgvarg = args;
3201 params->rgdispidNamedArgs = NULL;
3202 params->cArgs = cnt;
3203 params->cNamedArgs = 0;
3204
3205 iter = args+cnt;
3206
3207 while(iter-- > args) {
3208 V_VT(iter) = va_arg(valist, enum VARENUM);
3209
3210 TRACE("vt=%d\n", V_VT(iter));
3211
3212 if(V_VT(iter) & VT_BYREF) {
3213 V_BYREF(iter) = va_arg(valist, LPVOID);
3214 } else {
3215 switch(V_VT(iter)) {
3216 case VT_I4:
3217 V_I4(iter) = va_arg(valist, LONG);
3218 break;
3219 case VT_BSTR:
3220 V_BSTR(iter) = va_arg(valist, BSTR);
3221 break;
3222 case VT_DISPATCH:
3223 V_DISPATCH(iter) = va_arg(valist, IDispatch*);
3224 break;
3225 case VT_BOOL:
3226 V_BOOL(iter) = va_arg(valist, int);
3227 break;
3228 case VT_UNKNOWN:
3229 V_UNKNOWN(iter) = va_arg(valist, IUnknown*);
3230 break;
3231 default:
3232 V_VT(iter) = VT_I4;
3233 V_I4(iter) = va_arg(valist, LONG);
3234 }
3235 }
3236 }
3237
3238 return S_OK;
3239}
3240
3241/*************************************************************************
3242 * @ [SHLWAPI.282]
3243 *
3244 * SHPackDispParams
3245 */
3247{
3249 HRESULT hres;
3250
3254 return hres;
3255}
3256
3257/*************************************************************************
3258 * SHLWAPI_InvokeByIID
3259 *
3260 * This helper function calls IDispatch::Invoke for each sink
3261 * which implements given iid or IDispatch.
3262 *
3263 */
3265 IConnectionPoint* iCP,
3266 REFIID iid,
3267 DISPID dispId,
3268 DISPPARAMS* dispParams)
3269{
3270 IEnumConnections *enumerator;
3271 CONNECTDATA rgcd;
3272 static DISPPARAMS empty = {NULL, NULL, 0, 0};
3273 DISPPARAMS* params = dispParams;
3274
3275 HRESULT result = IConnectionPoint_EnumConnections(iCP, &enumerator);
3276 if (FAILED(result))
3277 return result;
3278
3279 /* Invoke is never happening with an NULL dispParams */
3280 if (!params)
3281 params = &empty;
3282
3283 while(IEnumConnections_Next(enumerator, 1, &rgcd, NULL)==S_OK)
3284 {
3285 IDispatch *dispIface;
3286 if ((iid && SUCCEEDED(IUnknown_QueryInterface(rgcd.pUnk, iid, (LPVOID*)&dispIface))) ||
3287 SUCCEEDED(IUnknown_QueryInterface(rgcd.pUnk, &IID_IDispatch, (LPVOID*)&dispIface)))
3288 {
3289 IDispatch_Invoke(dispIface, dispId, &IID_NULL, 0, DISPATCH_METHOD, params, NULL, NULL, NULL);
3290 IDispatch_Release(dispIface);
3291 }
3292 IUnknown_Release(rgcd.pUnk);
3293 }
3294
3295 IEnumConnections_Release(enumerator);
3296
3297 return S_OK;
3298}
3299
3300/*************************************************************************
3301 * IConnectionPoint_InvokeWithCancel [SHLWAPI.283]
3302 */
3304 DISPID dispId, DISPPARAMS* dispParams,
3305 DWORD unknown1, DWORD unknown2 )
3306{
3307 IID iid;
3309
3310 FIXME("(%p)->(0x%x %p %x %x) partial stub\n", iCP, dispId, dispParams, unknown1, unknown2);
3311
3312 result = IConnectionPoint_GetConnectionInterface(iCP, &iid);
3313 if (SUCCEEDED(result))
3314 result = SHLWAPI_InvokeByIID(iCP, &iid, dispId, dispParams);
3315 else
3316 result = SHLWAPI_InvokeByIID(iCP, NULL, dispId, dispParams);
3317
3318 return result;
3319}
3320
3321
3322/*************************************************************************
3323 * @ [SHLWAPI.284]
3324 *
3325 * IConnectionPoint_SimpleInvoke
3326 */
3328 IConnectionPoint* iCP,
3329 DISPID dispId,
3330 DISPPARAMS* dispParams)
3331{
3332 IID iid;
3334
3335 TRACE("(%p)->(0x%x %p)\n",iCP,dispId,dispParams);
3336
3337 result = IConnectionPoint_GetConnectionInterface(iCP, &iid);
3338 if (SUCCEEDED(result))
3339 result = SHLWAPI_InvokeByIID(iCP, &iid, dispId, dispParams);
3340 else
3341 result = SHLWAPI_InvokeByIID(iCP, NULL, dispId, dispParams);
3342
3343 return result;
3344}
3345
3346/*************************************************************************
3347 * @ [SHLWAPI.285]
3348 *
3349 * Notify an IConnectionPoint object of changes.
3350 *
3351 * PARAMS
3352 * lpCP [I] Object to notify
3353 * dispID [I]
3354 *
3355 * RETURNS
3356 * Success: S_OK.
3357 * Failure: E_NOINTERFACE, if lpCP is NULL or does not support the
3358 * IConnectionPoint interface.
3359 */
3361{
3362 IEnumConnections *lpEnum;
3363 HRESULT hRet = E_NOINTERFACE;
3364
3365 TRACE("(%p,0x%8X)\n", lpCP, dispID);
3366
3367 /* Get an enumerator for the connections */
3368 if (lpCP)
3369 hRet = IConnectionPoint_EnumConnections(lpCP, &lpEnum);
3370
3371 if (SUCCEEDED(hRet))
3372 {
3373 IPropertyNotifySink *lpSink;
3374 CONNECTDATA connData;
3375 ULONG ulFetched;
3376
3377 /* Call OnChanged() for every notify sink in the connection point */
3378 while (IEnumConnections_Next(lpEnum, 1, &connData, &ulFetched) == S_OK)
3379 {
3380 if (SUCCEEDED(IUnknown_QueryInterface(connData.pUnk, &IID_IPropertyNotifySink, (void**)&lpSink)) &&
3381 lpSink)
3382 {
3383 IPropertyNotifySink_OnChanged(lpSink, dispID);
3384 IPropertyNotifySink_Release(lpSink);
3385 }
3386 IUnknown_Release(connData.pUnk);
3387 }
3388
3389 IEnumConnections_Release(lpEnum);
3390 }
3391 return hRet;
3392}
3393
3394/*************************************************************************
3395 * @ [SHLWAPI.286]
3396 *
3397 * IUnknown_CPContainerInvokeParam
3398 */
3401 REFIID riid,
3402 DISPID dispId,
3404 DWORD cParams, ...)
3405{
3407 IConnectionPoint *iCP;
3409 DISPPARAMS dispParams = {buffer, NULL, cParams, 0};
3411
3412 if (!container)
3413 return E_NOINTERFACE;
3414
3415 result = IUnknown_QueryInterface(container, &IID_IConnectionPointContainer,(LPVOID*) &iCPC);
3416 if (FAILED(result))
3417 return result;
3418
3419 result = IConnectionPointContainer_FindConnectionPoint(iCPC, riid, &iCP);
3420 IConnectionPointContainer_Release(iCPC);
3421 if(FAILED(result))
3422 return result;
3423
3424 __ms_va_start(valist, cParams);
3425 SHPackDispParamsV(&dispParams, buffer, cParams, valist);
3427
3428 result = SHLWAPI_InvokeByIID(iCP, riid, dispId, &dispParams);
3429 IConnectionPoint_Release(iCP);
3430
3431 return result;
3432}
3433
3434/*************************************************************************
3435 * @ [SHLWAPI.287]
3436 *
3437 * Notify an IConnectionPointContainer object of changes.
3438 *
3439 * PARAMS
3440 * lpUnknown [I] Object to notify
3441 * dispID [I]
3442 *
3443 * RETURNS
3444 * Success: S_OK.
3445 * Failure: E_NOINTERFACE, if lpUnknown is NULL or does not support the
3446 * IConnectionPointContainer interface.
3447 */
3449{
3451 HRESULT hRet = E_NOINTERFACE;
3452
3453 TRACE("(%p,0x%8X)\n", lpUnknown, dispID);
3454
3455 if (lpUnknown)
3456 hRet = IUnknown_QueryInterface(lpUnknown, &IID_IConnectionPointContainer, (void**)&lpCPC);
3457
3458 if (SUCCEEDED(hRet))
3459 {
3460 IConnectionPoint* lpCP;
3461
3462 hRet = IConnectionPointContainer_FindConnectionPoint(lpCPC, &IID_IPropertyNotifySink, &lpCP);
3463 IConnectionPointContainer_Release(lpCPC);
3464
3465 hRet = IConnectionPoint_OnChanged(lpCP, dispID);
3466 IConnectionPoint_Release(lpCP);
3467 }
3468 return hRet;
3469}
3470
3471/*************************************************************************
3472 * @ [SHLWAPI.289]
3473 *
3474 * See PlaySoundW.
3475 */
3477{
3478 return PlaySoundW(pszSound, hmod, fdwSound);
3479}
3480
3481#ifndef __REACTOS__ /* See propbag.cpp */
3482/*************************************************************************
3483 * @ [SHLWAPI.294]
3484 *
3485 * Retrieve a key value from an INI file. See GetPrivateProfileString for
3486 * more information.
3487 *
3488 * PARAMS
3489 * appName [I] The section in the INI file that contains the key
3490 * keyName [I] The key to be retrieved
3491 * out [O] The buffer into which the key's value will be copied
3492 * outLen [I] The length of the `out' buffer
3493 * filename [I] The location of the INI file
3494 *
3495 * RETURNS
3496 * Length of string copied into `out'.
3497 */
3499 DWORD outLen, LPCWSTR filename)
3500{
3501 INT ret;
3502 WCHAR *buf;
3503
3504 TRACE("(%s,%s,%p,%08x,%s)\n", debugstr_w(appName), debugstr_w(keyName),
3505 out, outLen, debugstr_w(filename));
3506
3507 if(outLen == 0)
3508 return 0;
3509
3510 buf = HeapAlloc(GetProcessHeap(), 0, outLen * sizeof(WCHAR));
3511 if(!buf){
3512 *out = 0;
3513 return 0;
3514 }
3515
3516 ret = GetPrivateProfileStringW(appName, keyName, NULL, buf, outLen, filename);
3517 if(ret)
3518 strcpyW(out, buf);
3519 else
3520 *out = 0;
3521
3523
3524 return strlenW(out);
3525}
3526#endif
3527
3528#ifndef __REACTOS__ /* See propbag.cpp */
3529/*************************************************************************
3530 * @ [SHLWAPI.295]
3531 *
3532 * Set a key value in an INI file. See WritePrivateProfileString for
3533 * more information.
3534 *
3535 * PARAMS
3536 * appName [I] The section in the INI file that contains the key
3537 * keyName [I] The key to be set
3538 * str [O] The value of the key
3539 * filename [I] The location of the INI file
3540 *
3541 * RETURNS
3542 * Success: TRUE
3543 * Failure: FALSE
3544 */
3547{
3548 TRACE("(%s, %p, %s, %s)\n", debugstr_w(appName), keyName, debugstr_w(str),
3550
3552}
3553#endif
3554
3555/*************************************************************************
3556 * @ [SHLWAPI.313]
3557 *
3558 * See SHGetFileInfoW.
3559 */
3561 SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
3562{
3563 return SHGetFileInfoW(path, dwFileAttributes, psfi, sizeofpsfi, flags);
3564}
3565
3566/*************************************************************************
3567 * @ [SHLWAPI.318]
3568 *
3569 * See DragQueryFileW.
3570 */
3571UINT WINAPI DragQueryFileWrapW(HDROP hDrop, UINT lFile, LPWSTR lpszFile, UINT lLength)
3572{
3573 return DragQueryFileW(hDrop, lFile, lpszFile, lLength);
3574}
3575
3576/*************************************************************************
3577 * @ [SHLWAPI.333]
3578 *
3579 * See SHBrowseForFolderW.
3580 */
3582{
3583 return SHBrowseForFolderW(lpBi);
3584}
3585
3586/*************************************************************************
3587 * @ [SHLWAPI.334]
3588 *
3589 * See SHGetPathFromIDListW.
3590 */
3592{
3593 return SHGetPathFromIDListW(pidl, pszPath);
3594}
3595
3596/*************************************************************************
3597 * @ [SHLWAPI.335]
3598 *
3599 * See ShellExecuteExW.
3600 */
3602{
3603 return ShellExecuteExW(lpExecInfo);
3604}
3605
3606/*************************************************************************
3607 * @ [SHLWAPI.336]
3608 *
3609 * See SHFileOperationW.
3610 */
3612{
3613 return SHFileOperationW(lpFileOp);
3614}
3615
3616/*************************************************************************
3617 * @ [SHLWAPI.342]
3618 *
3619 */
3621{
3623}
3624
3625/*************************************************************************
3626 * @ [SHLWAPI.350]
3627 *
3628 * See GetFileVersionInfoSizeW.
3629 */
3631{
3633}
3634
3635/*************************************************************************
3636 * @ [SHLWAPI.351]
3637 *
3638 * See GetFileVersionInfoW.
3639 */
3642{
3644}
3645
3646/*************************************************************************
3647 * @ [SHLWAPI.352]
3648 *
3649 * See VerQueryValueW.
3650 */
3652 LPVOID *lplpBuffer, UINT *puLen )
3653{
3654 return VerQueryValueW( pBlock, lpSubBlock, lplpBuffer, puLen );
3655}
3656
3657#define IsIface(type) SUCCEEDED((hRet = IUnknown_QueryInterface(lpUnknown, &IID_##type, (void**)&lpObj)))
3658#define IShellBrowser_EnableModeless IShellBrowser_EnableModelessSB
3659#define EnableModeless(type) type##_EnableModeless((type*)lpObj, bModeless)
3660
3661/*************************************************************************
3662 * @ [SHLWAPI.355]
3663 *
3664 * Change the modality of a shell object.
3665 *
3666 * PARAMS
3667 * lpUnknown [I] Object to make modeless
3668 * bModeless [I] TRUE=Make modeless, FALSE=Make modal
3669 *
3670 * RETURNS
3671 * Success: S_OK. The modality lpUnknown is changed.
3672 * Failure: An HRESULT error code indicating the error.
3673 *
3674 * NOTES
3675 * lpUnknown must support the IOleInPlaceFrame interface, the
3676 * IInternetSecurityMgrSite interface, the IShellBrowser interface
3677 * the IDocHostUIHandler interface, or the IOleInPlaceActiveObject interface,
3678 * or this call will fail.
3679 */
3681{
3682 IUnknown *lpObj;
3683 HRESULT hRet;
3684
3685 TRACE("(%p,%d)\n", lpUnknown, bModeless);
3686
3687 if (!lpUnknown)
3688 return E_FAIL;
3689
3692 else if (IsIface(IOleInPlaceFrame))
3694 else if (IsIface(IShellBrowser))
3698 else if (IsIface(IDocHostUIHandler))
3700 else
3701 return hRet;
3702
3703 IUnknown_Release(lpObj);
3704 return S_OK;
3705}
3706
3707/*************************************************************************
3708 * @ [SHLWAPI.357]
3709 *
3710 * See SHGetNewLinkInfoW.
3711 */
3714{
3715 return SHGetNewLinkInfoW(pszLinkTo, pszDir, pszName, pfMustCopy, uFlags);
3716}
3717
3718/*************************************************************************
3719 * @ [SHLWAPI.358]
3720 *
3721 * See SHDefExtractIconW.
3722 */
3723UINT WINAPI SHDefExtractIconWrapW(LPCWSTR pszIconFile, int iIndex, UINT uFlags, HICON* phiconLarge,
3724 HICON* phiconSmall, UINT nIconSize)
3725{
3726 return SHDefExtractIconW(pszIconFile, iIndex, uFlags, phiconLarge, phiconSmall, nIconSize);
3727}
3728
3729/*************************************************************************
3730 * @ [SHLWAPI.363]
3731 *
3732 * Get and show a context menu from a shell folder.
3733 *
3734 * PARAMS
3735 * hWnd [I] Window displaying the shell folder
3736 * lpFolder [I] IShellFolder interface
3737 * lpApidl [I] Id for the particular folder desired
3738 * dwCommandId [I] The command ID to invoke (0=invoke default)
3739 *
3740 * RETURNS
3741 * Success: S_OK. If bInvokeDefault is TRUE, the default menu action was
3742 * executed.
3743 * Failure: An HRESULT error code indicating the error.
3744 */
3745#ifdef __REACTOS__
3748{
3749 return SHInvokeCommandWithFlagsAndSite(hWnd, NULL, lpFolder, lpApidl, 0, lpVerb);
3750}
3751#else
3753{
3754 IContextMenu *iContext;
3755 HRESULT hRet;
3756
3757 TRACE("(%p, %p, %p, %u)\n", hWnd, lpFolder, lpApidl, dwCommandId);
3758
3759 if (!lpFolder)
3760 return E_FAIL;
3761
3762 /* Get the context menu from the shell folder */
3763 hRet = IShellFolder_GetUIObjectOf(lpFolder, hWnd, 1, &lpApidl,
3764 &IID_IContextMenu, 0, (void**)&iContext);
3765 if (SUCCEEDED(hRet))
3766 {
3767 HMENU hMenu;
3768 if ((hMenu = CreatePopupMenu()))
3769 {
3770 HRESULT hQuery;
3771
3772 /* Add the context menu entries to the popup */
3773 hQuery = IContextMenu_QueryContextMenu(iContext, hMenu, 0, 1, 0x7FFF,
3774 dwCommandId ? CMF_NORMAL : CMF_DEFAULTONLY);
3775
3776 if (SUCCEEDED(hQuery))
3777 {
3778 if (!dwCommandId)
3779 dwCommandId = GetMenuDefaultItem(hMenu, 0, 0);
3780 if (dwCommandId != (UINT)-1)
3781 {
3782 CMINVOKECOMMANDINFO cmIci;
3783 /* Invoke the default item */
3784 memset(&cmIci,0,sizeof(cmIci));
3785 cmIci.cbSize = sizeof(cmIci);
3786 cmIci.fMask = CMIC_MASK_ASYNCOK;
3787 cmIci.hwnd = hWnd;
3788#ifdef __REACTOS__ /* r75561 */
3789 cmIci.lpVerb = MAKEINTRESOURCEA(dwCommandId - 1);
3790#else
3791 cmIci.lpVerb = MAKEINTRESOURCEA(dwCommandId);
3792#endif
3793 cmIci.nShow = SW_SHOWNORMAL;
3794
3795 hRet = IContextMenu_InvokeCommand(iContext, &cmIci);
3796 }
3797 }
3798 DestroyMenu(hMenu);
3799 }
3800 IContextMenu_Release(iContext);
3801 }
3802 return hRet;
3803}
3804#endif /* __REACTOS__ */
3805
3806/*************************************************************************
3807 * @ [SHLWAPI.370]
3808 *
3809 * See ExtractIconW.
3810 */
3812 UINT nIconIndex)
3813{
3814 return ExtractIconW(hInstance, lpszExeFileName, nIconIndex);
3815}
3816
3817/*************************************************************************
3818 * @ [SHLWAPI.377]
3819 *
3820 * Load a library from the directory of a particular process.
3821 *
3822 * PARAMS
3823 * new_mod [I] Library name
3824 * inst_hwnd [I] Module whose directory is to be used
3825 * dwCrossCodePage [I] Should be FALSE (currently ignored)
3826 *
3827 * RETURNS
3828 * Success: A handle to the loaded module
3829 * Failure: A NULL handle.
3830 */
3831HMODULE WINAPI MLLoadLibraryA(LPCSTR new_mod, HMODULE inst_hwnd, DWORD dwCrossCodePage)
3832{
3833 /* FIXME: Native appears to do DPA_Create and a DPA_InsertPtr for
3834 * each call here.
3835 * FIXME: Native shows calls to:
3836 * SHRegGetUSValue for "Software\Microsoft\Internet Explorer\International"
3837 * CheckVersion
3838 * RegOpenKeyExA for "HKLM\Software\Microsoft\Internet Explorer"
3839 * RegQueryValueExA for "LPKInstalled"
3840 * RegCloseKey
3841 * RegOpenKeyExA for "HKCU\Software\Microsoft\Internet Explorer\International"
3842 * RegQueryValueExA for "ResourceLocale"
3843 * RegCloseKey
3844 * RegOpenKeyExA for "HKLM\Software\Microsoft\Active Setup\Installed Components\{guid}"
3845 * RegQueryValueExA for "Locale"
3846 * RegCloseKey
3847 * and then tests the Locale ("en" for me).
3848 * code below
3849 * after the code then a DPA_Create (first time) and DPA_InsertPtr are done.
3850 */
3851 CHAR mod_path[2*MAX_PATH];
3852 LPSTR ptr;
3853 DWORD len;
3854
3855 FIXME("(%s,%p,%d) semi-stub!\n", debugstr_a(new_mod), inst_hwnd, dwCrossCodePage);
3856 len = GetModuleFileNameA(inst_hwnd, mod_path, sizeof(mod_path));
3857 if (!len || len >= sizeof(mod_path)) return NULL;
3858
3859 ptr = strrchr(mod_path, '\\');
3860 if (ptr) {
3861 strcpy(ptr+1, new_mod);
3862 TRACE("loading %s\n", debugstr_a(mod_path));
3863 return LoadLibraryA(mod_path);
3864 }
3865 return NULL;
3866}
3867
3868/*************************************************************************
3869 * @ [SHLWAPI.378]
3870 *
3871 * Unicode version of MLLoadLibraryA.
3872 */
3873HMODULE WINAPI MLLoadLibraryW(LPCWSTR new_mod, HMODULE inst_hwnd, DWORD dwCrossCodePage)
3874{
3875 WCHAR mod_path[2*MAX_PATH];
3876 LPWSTR ptr;
3877 DWORD len;
3878
3879 FIXME("(%s,%p,%d) semi-stub!\n", debugstr_w(new_mod), inst_hwnd, dwCrossCodePage);
3880 len = GetModuleFileNameW(inst_hwnd, mod_path, sizeof(mod_path) / sizeof(WCHAR));
3881 if (!len || len >= sizeof(mod_path) / sizeof(WCHAR)) return NULL;
3882
3883 ptr = strrchrW(mod_path, '\\');
3884 if (ptr) {
3885 strcpyW(ptr+1, new_mod);
3886 TRACE("loading %s\n", debugstr_w(mod_path));
3887 return LoadLibraryW(mod_path);
3888 }
3889 return NULL;
3890}
3891
3892/*************************************************************************
3893 * ColorAdjustLuma [SHLWAPI.@]
3894 *
3895 * Adjust the luminosity of a color
3896 *
3897 * PARAMS
3898 * cRGB [I] RGB value to convert
3899 * dwLuma [I] Luma adjustment
3900 * bUnknown [I] Unknown
3901 *
3902 * RETURNS
3903 * The adjusted RGB color.
3904 */
3905COLORREF WINAPI ColorAdjustLuma(COLORREF cRGB, int dwLuma, BOOL bUnknown)
3906{
3907 TRACE("(0x%8x,%d,%d)\n", cRGB, dwLuma, bUnknown);
3908
3909 if (dwLuma)
3910 {
3911 WORD wH, wL, wS;
3912
3913 ColorRGBToHLS(cRGB, &wH, &wL, &wS);
3914
3915 FIXME("Ignoring luma adjustment\n");
3916
3917 /* FIXME: The adjustment is not linear */
3918
3919 cRGB = ColorHLSToRGB(wH, wL, wS);
3920 }
3921 return cRGB;
3922}
3923
3924/*************************************************************************
3925 * @ [SHLWAPI.389]
3926 *
3927 * See GetSaveFileNameW.
3928 */
3930{
3931 return GetSaveFileNameW(ofn);
3932}
3933
3934/*************************************************************************
3935 * @ [SHLWAPI.390]
3936 *
3937 * See WNetRestoreConnectionW.
3938 */
3940{
3941 return WNetRestoreConnectionW(hwndOwner, lpszDevice);
3942}
3943
3944/*************************************************************************
3945 * @ [SHLWAPI.391]
3946 *
3947 * See WNetGetLastErrorW.
3948 */
3949DWORD WINAPI WNetGetLastErrorWrapW(LPDWORD lpError, LPWSTR lpErrorBuf, DWORD nErrorBufSize,
3950 LPWSTR lpNameBuf, DWORD nNameBufSize)
3951{
3952 return WNetGetLastErrorW(lpError, lpErrorBuf, nErrorBufSize, lpNameBuf, nNameBufSize);
3953}
3954
3955/*************************************************************************
3956 * @ [SHLWAPI.401]
3957 *
3958 * See PageSetupDlgW.
3959 */
3961{
3962 return PageSetupDlgW(pagedlg);
3963}
3964
3965/*************************************************************************
3966 * @ [SHLWAPI.402]
3967 *
3968 * See PrintDlgW.
3969 */
3971{
3972 return PrintDlgW(printdlg);
3973}
3974
3975/*************************************************************************
3976 * @ [SHLWAPI.403]
3977 *
3978 * See GetOpenFileNameW.
3979 */
3981{
3982 return GetOpenFileNameW(ofn);
3983}
3984
3985/*************************************************************************
3986 * @ [SHLWAPI.404]
3987 */
3989{
3990 /* Windows attempts to get an IPersist interface and, if that fails, an
3991 * IPersistFolder interface on the folder passed-in here. If one of those
3992 * interfaces is available, it then calls GetClassID on the folder... and
3993 * then calls IShellFolder_EnumObjects no matter what, even crashing if
3994 * lpFolder isn't actually an IShellFolder object. The purpose of getting
3995 * the ClassID is unknown, so we don't do it here.
3996 *
3997 * For discussion and detailed tests, see:
3998 * "shlwapi: Be less strict on which type of IShellFolder can be enumerated"
3999 * wine-devel mailing list, 3 Jun 2010
4000 */
4001
4002 return IShellFolder_EnumObjects(lpFolder, hwnd, flags, ppenum);
4003}
4004
4005/* INTERNAL: Map from HLS color space to RGB */
4006static WORD ConvertHue(int wHue, WORD wMid1, WORD wMid2)
4007{
4008 wHue = wHue > 240 ? wHue - 240 : wHue < 0 ? wHue + 240 : wHue;
4009
4010 if (wHue > 160)
4011 return wMid1;
4012 else if (wHue > 120)
4013 wHue = 160 - wHue;
4014 else if (wHue > 40)
4015 return wMid2;
4016
4017 return ((wHue * (wMid2 - wMid1) + 20) / 40) + wMid1;
4018}
4019
4020/* Convert to RGB and scale into RGB range (0..255) */
4021#define GET_RGB(h) (ConvertHue(h, wMid1, wMid2) * 255 + 120) / 240
4022
4023/*************************************************************************
4024 * ColorHLSToRGB [SHLWAPI.@]
4025 *
4026 * Convert from hls color space into an rgb COLORREF.
4027 *
4028 * PARAMS
4029 * wHue [I] Hue amount
4030 * wLuminosity [I] Luminosity amount
4031 * wSaturation [I] Saturation amount
4032 *
4033 * RETURNS
4034 * A COLORREF representing the converted color.
4035 *
4036 * NOTES
4037 * Input hls values are constrained to the range (0..240).
4038 */
4039COLORREF WINAPI ColorHLSToRGB(WORD wHue, WORD wLuminosity, WORD wSaturation)
4040{
4041 WORD wRed;
4042
4043 if (wSaturation)
4044 {
4045 WORD wGreen, wBlue, wMid1, wMid2;
4046
4047 if (wLuminosity > 120)
4048 wMid2 = wSaturation + wLuminosity - (wSaturation * wLuminosity + 120) / 240;
4049 else
4050 wMid2 = ((wSaturation + 240) * wLuminosity + 120) / 240;
4051
4052 wMid1 = wLuminosity * 2 - wMid2;
4053
4054 wRed = GET_RGB(wHue + 80);
4055 wGreen = GET_RGB(wHue);
4056 wBlue = GET_RGB(wHue - 80);
4057
4058 return RGB(wRed, wGreen, wBlue);
4059 }
4060
4061 wRed = wLuminosity * 255 / 240;
4062 return RGB(wRed, wRed, wRed);
4063}
4064
4065/*************************************************************************
4066 * @ [SHLWAPI.413]
4067 *
4068 * Get the current docking status of the system.
4069 *
4070 * PARAMS
4071 * dwFlags [I] DOCKINFO_ flags from "winbase.h", unused
4072 *
4073 * RETURNS
4074 * One of DOCKINFO_UNDOCKED, DOCKINFO_UNDOCKED, or 0 if the system is not
4075 * a notebook.
4076 */
4078{
4079 HW_PROFILE_INFOA hwInfo;
4080
4081 TRACE("(0x%08x)\n", dwFlags);
4082
4083 GetCurrentHwProfileA(&hwInfo);
4084 switch (hwInfo.dwDockInfo & (DOCKINFO_DOCKED|DOCKINFO_UNDOCKED))
4085 {
4086 case DOCKINFO_DOCKED:
4087 case DOCKINFO_UNDOCKED:
4089 default:
4090 return 0;
4091 }
4092}
4093
4094/*************************************************************************
4095 * @ [SHLWAPI.416]
4096 *
4097 */
4099{
4100
4101 FIXME("(%p, %s, 0x%x, %p, %d)\n", hwnd, debugstr_w(helpfile), flags1, ptr1, flags2);
4102 return 0;
4103}
4104
4105/*************************************************************************
4106 * @ [SHLWAPI.417]
4107 *
4108 */
4110{
4111
4112 FIXME("(%p, %s, 0x%x, %p, %d)\n", hwnd, debugstr_a(helpfile), flags1, ptr1, flags2);
4113 return 0;
4114}
4115
4116/*************************************************************************
4117 * @ [SHLWAPI.418]
4118 *
4119 * Function seems to do FreeLibrary plus other things.
4120 *
4121 * FIXME native shows the following calls:
4122 * RtlEnterCriticalSection
4123 * LocalFree
4124 * GetProcAddress(Comctl32??, 150L)
4125 * DPA_DeletePtr
4126 * RtlLeaveCriticalSection
4127 * followed by the FreeLibrary.
4128 * The above code may be related to .377 above.
4129 */
4131{
4132 FIXME("(%p) semi-stub\n", hModule);
4133 return FreeLibrary(hModule);
4134}
4135
4136/*************************************************************************
4137 * @ [SHLWAPI.419]
4138 */
4140 FIXME(": stub\n");
4141 return TRUE;
4142}
4143
4144/*************************************************************************
4145 * @ [SHLWAPI.429]
4146 * FIXME I have no idea what this function does or what its arguments are.
4147 */
4149{
4150 FIXME("(%p) stub\n", hInst);
4151 return FALSE;
4152}
4153
4154
4155/*************************************************************************
4156 * @ [SHLWAPI.430]
4157 */
4159{
4160 FIXME("(%p,%p) stub\n", hInst, hHeap);
4161 return E_FAIL; /* This is what is used if shlwapi not loaded */
4162}
4163
4164/*************************************************************************
4165 * @ [SHLWAPI.431]
4166 */
4168{
4169 FIXME("(0x%08x)stub\n", x);
4170 return 0xabba1247;
4171}
4172
4173/*************************************************************************
4174 * @ [SHLWAPI.432]
4175 *
4176 * See SHSendMessageBroadcastW
4177 *
4178 */
4180{
4182 SMTO_ABORTIFHUNG, 2000, NULL);
4183}
4184
4185/*************************************************************************
4186 * @ [SHLWAPI.433]
4187 *
4188 * A wrapper for sending Broadcast Messages to all top level Windows
4189 *
4190 */
4192{
4194 SMTO_ABORTIFHUNG, 2000, NULL);
4195}
4196
4197/*************************************************************************
4198 * @ [SHLWAPI.436]
4199 *
4200 * Convert a Unicode string CLSID into a CLSID.
4201 *
4202 * PARAMS
4203 * idstr [I] string containing a CLSID in text form
4204 * id [O] CLSID extracted from the string
4205 *
4206 * RETURNS
4207 * S_OK on success or E_INVALIDARG on failure
4208 */
4210{
4211 return CLSIDFromString((LPCOLESTR)idstr, id);
4212}
4213
4214/*************************************************************************
4215 * @ [SHLWAPI.437]
4216 *
4217 * Determine if the OS supports a given feature.
4218 *
4219 * PARAMS
4220 * dwFeature [I] Feature requested (undocumented)
4221 *
4222 * RETURNS
4223 * TRUE If the feature is available.
4224 * FALSE If the feature is not available.
4225 */
4227{
4228#ifdef __REACTOS__
4230 DWORD platform, majorv, minorv;
4231
4232 osvi.dwOSVersionInfoSize = sizeof(osvi);
4234 {
4237 {
4238 ERR("GetVersionEx failed\n");
4239 return FALSE;
4240 }
4241 osvi.wProductType = VER_NT_WORKSTATION;
4242 osvi.wSuiteMask = 0;
4243 }
4244#else
4246 DWORD platform, majorv, minorv;
4247
4249 if(!GetVersionExA(&osvi)) {
4250 ERR("GetVersionEx failed\n");
4251 return FALSE;
4252 }
4253#endif
4254 majorv = osvi.dwMajorVersion;
4255 minorv = osvi.dwMinorVersion;
4257
4258#define ISOS_RETURN(x) \
4259 TRACE("(0x%x) ret=%d\n",feature,(x)); \
4260 return (x);
4261
4262 switch(feature) {
4263 case OS_WIN32SORGREATER:
4266 case OS_NT:
4268 case OS_WIN95ORGREATER:
4270 case OS_NT4ORGREATER:
4271 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 4)
4274 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 5)
4275 case OS_WIN98ORGREATER:
4277 case OS_WIN98_GOLD:
4279 case OS_WIN2000PRO:
4280 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 5)
4281 case OS_WIN2000SERVER:
4282 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && (minorv == 0 || minorv == 1))
4284 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && (minorv == 0 || minorv == 1))
4286 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && (minorv == 0 || minorv == 1))
4287 case OS_WIN2000TERMINAL:
4288 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && (minorv == 0 || minorv == 1))
4289 case OS_EMBEDDED:
4290 FIXME("(OS_EMBEDDED) What should we return here?\n");
4291 return FALSE;
4292 case OS_TERMINALCLIENT:
4293 FIXME("(OS_TERMINALCLIENT) What should we return here?\n");
4294 return FALSE;
4296 FIXME("(OS_TERMINALREMOTEADMIN) What should we return here?\n");
4297 return FALSE;
4298 case OS_WIN95_GOLD:
4300 case OS_MEORGREATER:
4302 case OS_XPORGREATER:
4303 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 5 && minorv >= 1)
4304 case OS_HOME:
4305 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 5 && minorv >= 1)
4306 case OS_PROFESSIONAL:
4308 case OS_DATACENTER:
4310 case OS_ADVSERVER:
4311 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 5)
4312 case OS_SERVER:
4314 case OS_TERMINALSERVER:
4317 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && minorv >= 1 && majorv >= 5)
4319 FIXME("(OS_FASTUSERSWITCHING) What should we return here?\n");
4320 return TRUE;
4321 case OS_WELCOMELOGONUI:
4322 FIXME("(OS_WELCOMELOGONUI) What should we return here?\n");
4323 return FALSE;
4324 case OS_DOMAINMEMBER:
4325 FIXME("(OS_DOMAINMEMBER) What should we return here?\n");
4326 return TRUE;
4327 case OS_ANYSERVER:
4328#ifdef __REACTOS__
4329 ISOS_RETURN(osvi.wProductType > VER_NT_WORKSTATION)
4330#else
4332#endif
4333 case OS_WOW6432:
4334 {
4335 BOOL is_wow64;
4337 return is_wow64;
4338 }
4339 case OS_WEBSERVER:
4343 case OS_TABLETPC:
4344 FIXME("(OS_TABLETPC) What should we return here?\n");
4345 return FALSE;
4346 case OS_SERVERADMINUI:
4347 FIXME("(OS_SERVERADMINUI) What should we return here?\n");
4348 return FALSE;
4349 case OS_MEDIACENTER:
4350 FIXME("(OS_MEDIACENTER) What should we return here?\n");
4351 return FALSE;
4352 case OS_APPLIANCE:
4353 FIXME("(OS_APPLIANCE) What should we return here?\n");
4354 return FALSE;
4355 case 0x25: /*OS_VISTAORGREATER*/
4356 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 6)
4357 }
4358
4359#undef ISOS_RETURN
4360
4361 WARN("(0x%x) unknown parameter\n",feature);
4362
4363 return FALSE;
4364}
4365
4366#ifdef __REACTOS__
4367/*************************************************************************
4368 * @ [SHLWAPI.438]
4369 */
4371{
4372 WCHAR valueW[MAX_PATH], bufferW[MAX_PATH];
4373 DWORD dwSize = ARRAY_SIZE(bufferW) * sizeof(CHAR);
4374 HRESULT hr;
4375
4377 valueW[ARRAY_SIZE(valueW) - 1] = UNICODE_NULL; /* Avoid buffer overrun */
4378
4379 if (RegQueryValueExW(hkey, valueW, NULL, NULL, (LPBYTE)bufferW, &dwSize) != ERROR_SUCCESS)
4380 return E_FAIL;
4381
4382 hr = SHLoadIndirectString(bufferW, bufferW, ARRAY_SIZE(bufferW), NULL);
4383 if (FAILED(hr))
4384 return hr;
4385
4386 WideCharToMultiByte(CP_ACP, 0, bufferW, -1, buf, size, NULL, NULL);
4387 if (size > 0)
4388 buf[size - 1] = ANSI_NULL; /* Avoid buffer overrun */
4389 return S_OK;
4390}
4391#endif
4392
4393/*************************************************************************
4394 * @ [SHLWAPI.439]
4395 */
4397{
4398 DWORD type, sz = size * sizeof(WCHAR);
4399
4400 if(RegQueryValueExW(hkey, value, NULL, &type, (LPBYTE)buf, &sz) != ERROR_SUCCESS)
4401 return E_FAIL;
4402
4404}
4405
4406/*************************************************************************
4407 * @ [SHLWAPI.478]
4408 *
4409 * Call IInputObject_TranslateAcceleratorIO() on an object.
4410 *
4411 * PARAMS
4412 * lpUnknown [I] Object supporting the IInputObject interface.
4413 * lpMsg [I] Key message to be processed.
4414 *
4415 * RETURNS
4416 * Success: S_OK.
4417 * Failure: An HRESULT error code, or E_INVALIDARG if lpUnknown is NULL.
4418 */
4420{
4421 IInputObject* lpInput = NULL;
4422 HRESULT hRet = E_INVALIDARG;
4423
4424 TRACE("(%p,%p)\n", lpUnknown, lpMsg);
4425 if (lpUnknown)
4426 {
4427 hRet = IUnknown_QueryInterface(lpUnknown, &IID_IInputObject,
4428 (void**)&lpInput);
4429 if (SUCCEEDED(hRet) && lpInput)
4430 {
4431 hRet = IInputObject_TranslateAcceleratorIO(lpInput, lpMsg);
4432 IInputObject_Release(lpInput);
4433 }
4434 }
4435 return hRet;
4436}
4437
4438/*************************************************************************
4439 * @ [SHLWAPI.481]
4440 *
4441 * Call IInputObject_HasFocusIO() on an object.
4442 *
4443 * PARAMS
4444 * lpUnknown [I] Object supporting the IInputObject interface.
4445 *
4446 * RETURNS
4447 * Success: S_OK, if lpUnknown is an IInputObject object and has the focus,
4448 * or S_FALSE otherwise.
4449 * Failure: An HRESULT error code, or E_INVALIDARG if lpUnknown is NULL.
4450 */
4452{
4453 IInputObject* lpInput = NULL;
4454 HRESULT hRet = E_INVALIDARG;
4455
4456 TRACE("(%p)\n", lpUnknown);
4457 if (lpUnknown)
4458 {
4459 hRet = IUnknown_QueryInterface(lpUnknown, &IID_IInputObject,
4460 (void**)&lpInput);
4461 if (SUCCEEDED(hRet) && lpInput)
4462 {
4463 hRet = IInputObject_HasFocusIO(lpInput);
4464 IInputObject_Release(lpInput);
4465 }
4466 }
4467 return hRet;
4468}
4469
4470/*************************************************************************
4471 * ColorRGBToHLS [SHLWAPI.@]
4472 *
4473 * Convert an rgb COLORREF into the hls color space.
4474 *
4475 * PARAMS
4476 * cRGB [I] Source rgb value
4477 * pwHue [O] Destination for converted hue
4478 * pwLuminance [O] Destination for converted luminance
4479 * pwSaturation [O] Destination for converted saturation
4480 *
4481 * RETURNS
4482 * Nothing. pwHue, pwLuminance and pwSaturation are set to the converted
4483 * values.
4484 *
4485 * NOTES
4486 * Output HLS values are constrained to the range (0..240).
4487 * For Achromatic conversions, Hue is set to 160.
4488 */
4490 LPWORD pwLuminance, LPWORD pwSaturation)
4491{
4492 int wR, wG, wB, wMax, wMin, wHue, wLuminosity, wSaturation;
4493
4494 TRACE("(%08x,%p,%p,%p)\n", cRGB, pwHue, pwLuminance, pwSaturation);
4495
4496 wR = GetRValue(cRGB);
4497 wG = GetGValue(cRGB);
4498 wB = GetBValue(cRGB);
4499
4500 wMax = max(wR, max(wG, wB));
4501 wMin = min(wR, min(wG, wB));
4502
4503 /* Luminosity */
4504 wLuminosity = ((wMax + wMin) * 240 + 255) / 510;
4505
4506 if (wMax == wMin)
4507 {
4508 /* Achromatic case */
4509 wSaturation = 0;
4510 /* Hue is now unrepresentable, but this is what native returns... */
4511 wHue = 160;
4512 }
4513 else
4514 {
4515 /* Chromatic case */
4516 int wDelta = wMax - wMin, wRNorm, wGNorm, wBNorm;
4517
4518 /* Saturation */
4519 if (wLuminosity <= 120)
4520 wSaturation = ((wMax + wMin)/2 + wDelta * 240) / (wMax + wMin);
4521 else
4522 wSaturation = ((510 - wMax - wMin)/2 + wDelta * 240) / (510 - wMax - wMin);
4523
4524 /* Hue */
4525 wRNorm = (wDelta/2 + wMax * 40 - wR * 40) / wDelta;
4526 wGNorm = (wDelta/2 + wMax * 40 - wG * 40) / wDelta;
4527 wBNorm = (wDelta/2 + wMax * 40 - wB * 40) / wDelta;
4528
4529 if (wR == wMax)
4530 wHue = wBNorm - wGNorm;
4531 else if (wG == wMax)
4532 wHue = 80 + wRNorm - wBNorm;
4533 else
4534 wHue = 160 + wGNorm - wRNorm;
4535 if (wHue < 0)
4536 wHue += 240;
4537 else if (wHue > 240)
4538 wHue -= 240;
4539 }
4540 if (pwHue)
4541 *pwHue = wHue;
4542 if (pwLuminance)
4543 *pwLuminance = wLuminosity;
4544 if (pwSaturation)
4545 *pwSaturation = wSaturation;
4546}
4547
4548#ifdef __REACTOS__
4549typedef struct tagLOGPALETTEMAX /* Compatible with LOGPALETTE but extended */
4550{
4553 PALETTEENTRY palPalEntry[256];
4554} LOGPALETTEMAX, *PLOGPALETTEMAX;
4555#endif
4556
4557/*************************************************************************
4558 * SHCreateShellPalette [SHLWAPI.@]
4559 */
4560#ifdef __REACTOS__
4561HPALETTE WINAPI
4563{
4564 HDC hdcMem;
4565 HPALETTE hHalftonePalette;
4566 LOGPALETTEMAX data;
4567 const UINT nExtractCount = 10;
4568 const UINT nSecondBlockStart = _countof(data.palPalEntry) - nExtractCount;
4569
4570 TRACE("(%p)\n", hdc);
4571
4572 /* Get the colors of the halftone palette */
4573 hHalftonePalette = CreateHalftonePalette(hdc);
4574 if (!hHalftonePalette)
4575 return NULL;
4576 data.palVersion = 0x300;
4577 data.palNumEntries = GetPaletteEntries(hHalftonePalette, 0,
4578 _countof(data.palPalEntry), data.palPalEntry);
4579 DeleteObject(hHalftonePalette);
4580
4582
4583 if (hdcMem)
4584 {
4585 /* The first 10 and last 10 entries in the system colors are considered important */
4586 GetSystemPaletteEntries(hdcMem, 0, nExtractCount, data.palPalEntry);
4587 GetSystemPaletteEntries(hdcMem, nSecondBlockStart, nExtractCount,
4588 &data.palPalEntry[nSecondBlockStart]);
4589 }
4590
4591 if (hdcMem && hdc != hdcMem)
4593
4594 /* Create a palette from the modified color entries */
4595 return CreatePalette((PLOGPALETTE)&data);
4596}
4597#else
4599{
4600 FIXME("stub\n");
4601 return CreateHalftonePalette(hdc);
4602}
4603#endif
4604
4605/*************************************************************************
4606 * SHGetInverseCMAP (SHLWAPI.@)
4607 *
4608 * Get an inverse color map table.
4609 *
4610 * PARAMS
4611 * lpCmap [O] Destination for color map
4612 * dwSize [I] Size of memory pointed to by lpCmap
4613 *
4614 * RETURNS
4615 * Success: S_OK.
4616 * Failure: E_POINTER, If lpCmap is invalid.
4617 * E_INVALIDARG, If dwFlags is invalid
4618 * E_OUTOFMEMORY, If there is no memory available
4619 *
4620 * NOTES
4621 * dwSize may only be CMAP_PTR_SIZE (4) or CMAP_SIZE (8192).
4622 * If dwSize = CMAP_PTR_SIZE, *lpCmap is set to the address of this DLL's
4623 * internal CMap.
4624 * If dwSize = CMAP_SIZE, lpCmap is filled with a copy of the data from
4625 * this DLL's internal CMap.
4626 */
4628{
4629 if (dwSize == 4) {
4630 FIXME(" - returning bogus address for SHGetInverseCMAP\n");
4631 *dest = (DWORD)0xabba1249;
4632 return 0;
4633 }
4634 FIXME("(%p, %#x) stub\n", dest, dwSize);
4635 return 0;
4636}
4637
4638/*************************************************************************
4639 * SHIsLowMemoryMachine [SHLWAPI.@]
4640 *
4641 * Determine if the current computer has low memory.
4642 *
4643 * PARAMS
4644 * dwType [I] Zero.
4645 *
4646 * RETURNS
4647 * TRUE if the users machine has 16 Megabytes of memory or less,
4648 * FALSE otherwise.
4649 */
4651{
4652#ifdef __REACTOS__
4654 static int is_low = -1;
4655 TRACE("(0x%08x)\n", dwType);
4656 if (dwType == 0 && is_low == -1)
4657 {
4659 is_low = (status.dwTotalPhys <= 0x1000000);
4660 }
4661 return is_low;
4662#else
4663 FIXME("(0x%08x) stub\n", dwType);
4664 return FALSE;
4665#endif
4666}
4667
4668/*************************************************************************
4669 * GetMenuPosFromID [SHLWAPI.@]
4670 *
4671 * Return the position of a menu item from its Id.
4672 *
4673 * PARAMS
4674 * hMenu [I] Menu containing the item
4675 * wID [I] Id of the menu item
4676 *
4677 * RETURNS
4678 * Success: The index of the menu item in hMenu.
4679 * Failure: -1, If the item is not found.
4680 */
4682{
4684 INT nCount = GetMenuItemCount(hMenu), nIter = 0;
4685
4686 TRACE("%p %u\n", hMenu, wID);
4687
4688 while (nIter < nCount)
4689 {
4690 mi.cbSize = sizeof(mi);
4691 mi.fMask = MIIM_ID;
4692 if (GetMenuItemInfoW(hMenu, nIter, TRUE, &mi) && mi.wID == wID)
4693 {
4694 TRACE("ret %d\n", nIter);
4695 return nIter;
4696 }
4697 nIter++;
4698 }
4699
4700 return -1;
4701}
4702
4703/*************************************************************************
4704 * @ [SHLWAPI.179]
4705 *
4706 * Same as SHLWAPI.GetMenuPosFromID
4707 */
4709{
4710 TRACE("%p %u\n", hMenu, uID);
4711 return GetMenuPosFromID(hMenu, uID);
4712}
4713
4714
4715/*************************************************************************
4716 * @ [SHLWAPI.448]
4717 */
4719{
4720 while (*lpwstr)
4721 {
4722 if (*lpwstr == '/')
4723 *lpwstr = '\\';
4724 lpwstr++;
4725 }
4726}
4727
4728#ifndef __REACTOS__ /* See appcompat.c */
4729/*************************************************************************
4730 * @ [SHLWAPI.461]
4731 */
4733{
4734 FIXME("(0x%08x) stub\n", dwUnknown);
4735 return 0;
4736}
4737#endif
4738
4739/*************************************************************************
4740 * @ [SHLWAPI.549]
4741 */
4743 DWORD dwClsContext, REFIID iid, LPVOID *ppv)
4744{
4745 return CoCreateInstance(rclsid, pUnkOuter, dwClsContext, iid, ppv);
4746}
4747
4748/*************************************************************************
4749 * SHSkipJunction [SHLWAPI.@]
4750 *
4751 * Determine if a bind context can be bound to an object
4752 *
4753 * PARAMS
4754 * pbc [I] Bind context to check
4755 * pclsid [I] CLSID of object to be bound to
4756 *
4757 * RETURNS
4758 * TRUE: If it is safe to bind
4759 * FALSE: If pbc is invalid or binding would not be safe
4760 *
4761 */
4763{
4764 static WCHAR szSkipBinding[] = { 'S','k','i','p',' ',
4765 'B','i','n','d','i','n','g',' ','C','L','S','I','D','\0' };
4766 BOOL bRet = FALSE;
4767
4768 if (pbc)
4769 {
4770 IUnknown* lpUnk;
4771
4772 if (SUCCEEDED(IBindCtx_GetObjectParam(pbc, szSkipBinding, &lpUnk)))
4773 {
4774 CLSID clsid;
4775
4776 if (SUCCEEDED(IUnknown_GetClassID(lpUnk, &clsid)) &&
4777 IsEqualGUID(pclsid, &clsid))
4778 bRet = TRUE;
4779
4780 IUnknown_Release(lpUnk);
4781 }
4782 }
4783 return bRet;
4784}
4785
4786/***********************************************************************
4787 * SHGetShellKey (SHLWAPI.491)
4788 */
4790{
4791#ifndef __REACTOS__
4792 enum _shellkey_flags {
4793 SHKEY_Root_HKCU = 0x1,
4794 SHKEY_Root_HKLM = 0x2,
4795 SHKEY_Key_Explorer = 0x00,
4796 SHKEY_Key_Shell = 0x10,
4797 SHKEY_Key_ShellNoRoam = 0x20,
4798 SHKEY_Key_Classes = 0x30,
4799 SHKEY_Subkey_Default = 0x0000,
4801 SHKEY_Subkey_Handlers = 0x2000,
4803 SHKEY_Subkey_Volatile = 0x4000,
4804 SHKEY_Subkey_MUICache = 0x5000,
4805 SHKEY_Subkey_FileExts = 0x6000
4806 };
4807#endif
4808
4809 static const WCHAR explorerW[] = {'S','o','f','t','w','a','r','e','\\',
4810 'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
4811 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
4812 'E','x','p','l','o','r','e','r','\\'};
4813 static const WCHAR shellW[] = {'S','o','f','t','w','a','r','e','\\',
4814 'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
4815 'S','h','e','l','l','\\'};
4816 static const WCHAR shell_no_roamW[] = {'S','o','f','t','w','a','r','e','\\',
4817 'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
4818 'S','h','e','l','l','N','o','R','o','a','m','\\'};
4819 static const WCHAR classesW[] = {'S','o','f','t','w','a','r','e','\\',
4820 'C','l','a','s','s','e','s','\\'};
4821
4822 static const WCHAR localized_resource_nameW[] = {'L','o','c','a','l','i','z','e','d',
4823 'R','e','s','o','u','r','c','e','N','a','m','e','\\'};
4824 static const WCHAR handlersW[] = {'H','a','n','d','l','e','r','s','\\'};
4825 static const WCHAR associationsW[] = {'A','s','s','o','c','i','a','t','i','o','n','s','\\'};
4826 static const WCHAR volatileW[] = {'V','o','l','a','t','i','l','e','\\'};
4827 static const WCHAR mui_cacheW[] = {'M','U','I','C','a','c','h','e','\\'};
4828 static const WCHAR file_extsW[] = {'F','i','l','e','E','x','t','s','\\'};
4829
4830 WCHAR *path;
4831 const WCHAR *key, *subkey;
4832 int size_key, size_subkey, size_user;
4833 HKEY hkey = NULL;
4834
4835 TRACE("(0x%08x, %s, %d)\n", flags, debugstr_w(sub_key), create);
4836
4837 /* For compatibility with Vista+ */
4838 if(flags == 0x1ffff)
4839 flags = 0x21;
4840
4841 switch(flags&0xff0) {
4842 case SHKEY_Key_Explorer:
4843 key = explorerW;
4844 size_key = sizeof(explorerW);
4845 break;
4846 case SHKEY_Key_Shell:
4847 key = shellW;
4848 size_key = sizeof(shellW);
4849 break;
4851 key = shell_no_roamW;
4852 size_key = sizeof(shell_no_roamW);
4853 break;
4854 case SHKEY_Key_Classes:
4855 key = classesW;
4856 size_key = sizeof(classesW);
4857 break;
4858 default:
4859 FIXME("unsupported flags (0x%08x)\n", flags);
4860 return NULL;
4861 }
4862
4863 switch(flags&0xff000) {
4865 subkey = NULL;
4866 size_subkey = 0;
4867 break;
4869 subkey = localized_resource_nameW;
4870 size_subkey = sizeof(localized_resource_nameW);
4871 break;
4873 subkey = handlersW;
4874 size_subkey = sizeof(handlersW);
4875 break;
4877 subkey = associationsW;
4878 size_subkey = sizeof(associationsW);
4879 break;
4881 subkey = volatileW;
4882 size_subkey = sizeof(volatileW);
4883 break;
4885 subkey = mui_cacheW;
4886 size_subkey = sizeof(mui_cacheW);
4887 break;
4889 subkey = file_extsW;
4890 size_subkey = sizeof(file_extsW);
4891 break;
4892 default:
4893 FIXME("unsupported flags (0x%08x)\n", flags);
4894 return NULL;
4895 }
4896
4897 if(sub_key)
4898 size_user = lstrlenW(sub_key)*sizeof(WCHAR);
4899 else
4900 size_user = 0;
4901
4902 path = HeapAlloc(GetProcessHeap(), 0, size_key+size_subkey+size_user+sizeof(WCHAR));
4903 if(!path) {
4904 ERR("Out of memory\n");
4905 return NULL;
4906 }
4907
4908 memcpy(path, key, size_key);
4909 if(subkey)
4910 memcpy(path+size_key/sizeof(WCHAR), subkey, size_subkey);
4911 if(sub_key)
4912 memcpy(path+(size_key+size_subkey)/sizeof(WCHAR), sub_key, size_user);
4913 path[(size_key+size_subkey+size_user)/sizeof(WCHAR)] = '\0';
4914
4915 if(create)
4917 path, 0, NULL, 0, MAXIMUM_ALLOWED, NULL, &hkey, NULL);
4918 else
4920 path, 0, MAXIMUM_ALLOWED, &hkey);
4921
4923 return hkey;
4924}
4925
4926/***********************************************************************
4927 * SHQueueUserWorkItem (SHLWAPI.@)
4928 */
4930 LPVOID pContext, LONG lPriority, DWORD_PTR dwTag,
4931 DWORD_PTR *pdwId, LPCSTR pszModule, DWORD dwFlags)
4932{
4933 TRACE("(%p, %p, %d, %lx, %p, %s, %08x)\n", pfnCallback, pContext,
4934 lPriority, dwTag, pdwId, debugstr_a(pszModule), dwFlags);
4935
4936 if(lPriority || dwTag || pdwId || pszModule || dwFlags)
4937 FIXME("Unsupported arguments\n");
4938
4939 return QueueUserWorkItem(pfnCallback, pContext, 0);
4940}
4941
4942/***********************************************************************
4943 * SHSetTimerQueueTimer (SHLWAPI.263)
4944 */
4946 WAITORTIMERCALLBACK pfnCallback, LPVOID pContext, DWORD dwDueTime,
4947 DWORD dwPeriod, LPCSTR lpszLibrary, DWORD dwFlags)
4948{
4949 HANDLE hNewTimer;
4950
4951 /* SHSetTimerQueueTimer flags -> CreateTimerQueueTimer flags */
4952 if (dwFlags & TPS_LONGEXECTIME) {
4953 dwFlags &= ~TPS_LONGEXECTIME;
4955 }
4956 if (dwFlags & TPS_EXECUTEIO) {
4957 dwFlags &= ~TPS_EXECUTEIO;
4959 }
4960
4961 if (!CreateTimerQueueTimer(&hNewTimer, hQueue, pfnCallback, pContext,
4962 dwDueTime, dwPeriod, dwFlags))
4963 return NULL;
4964
4965 return hNewTimer;
4966}
4967
4968/***********************************************************************
4969 * IUnknown_OnFocusChangeIS (SHLWAPI.@)
4970 */
4972{
4973 IInputObjectSite *pIOS = NULL;
4974 HRESULT hRet = E_INVALIDARG;
4975
4976 TRACE("(%p, %p, %s)\n", lpUnknown, pFocusObject, bFocus ? "TRUE" : "FALSE");
4977
4978 if (lpUnknown)
4979 {
4980 hRet = IUnknown_QueryInterface(lpUnknown, &IID_IInputObjectSite,
4981 (void **)&pIOS);
4982 if (SUCCEEDED(hRet) && pIOS)
4983 {
4984 hRet = IInputObjectSite_OnFocusChangeIS(pIOS, pFocusObject, bFocus);
4986 }
4987 }
4988 return hRet;
4989}
4990
4991/***********************************************************************
4992 * SKAllocValueW (SHLWAPI.519)
4993 */
4996{
4997 DWORD ret, size;
4998 HKEY hkey;
4999
5000 TRACE("(0x%x, %s, %s, %p, %p, %p)\n", flags, debugstr_w(subkey),
5002
5003 hkey = SHGetShellKey(flags, subkey, FALSE);
5004 if (!hkey)
5006
5007 ret = SHQueryValueExW(hkey, value, NULL, type, NULL, &size);
5008 if (ret) {
5009 RegCloseKey(hkey);
5010 return HRESULT_FROM_WIN32(ret);
5011 }
5012
5013 size += 2;
5014 *data = LocalAlloc(0, size);
5015 if (!*data) {
5016 RegCloseKey(hkey);
5017 return E_OUTOFMEMORY;
5018 }
5019
5020 ret = SHQueryValueExW(hkey, value, NULL, type, *data, &size);
5021 if (count)
5022 *count = size;
5023
5024 RegCloseKey(hkey);
5025 return HRESULT_FROM_WIN32(ret);
5026}
5027
5028/***********************************************************************
5029 * SKDeleteValueW (SHLWAPI.518)
5030 */
5032{
5033 DWORD ret;
5034 HKEY hkey;
5035
5036 TRACE("(0x%x, %s %s)\n", flags, debugstr_w(subkey), debugstr_w(value));
5037
5038 hkey = SHGetShellKey(flags, subkey, FALSE);
5039 if (!hkey)
5041
5042 ret = RegDeleteValueW(hkey, value);
5043
5044 RegCloseKey(hkey);
5045 return HRESULT_FROM_WIN32(ret);
5046}
5047
5048/***********************************************************************
5049 * SKGetValueW (SHLWAPI.516)
5050 */
5052 void *data, DWORD *count)
5053{
5054 DWORD ret;
5055 HKEY hkey;
5056
5057 TRACE("(0x%x, %s, %s, %p, %p, %p)\n", flags, debugstr_w(subkey),
5059
5060 hkey = SHGetShellKey(flags, subkey, FALSE);
5061 if (!hkey)
5063
5065
5066 RegCloseKey(hkey);
5067 return HRESULT_FROM_WIN32(ret);
5068}
5069
5070/***********************************************************************
5071 * SKSetValueW (SHLWAPI.516)
5072 */
5074 DWORD type, void *data, DWORD count)
5075{
5076 DWORD ret;
5077 HKEY hkey;
5078
5079 TRACE("(0x%x, %s, %s, %x, %p, %d)\n", flags, debugstr_w(subkey),
5081
5082 hkey = SHGetShellKey(flags, subkey, TRUE);
5083 if (!hkey)
5085
5086 ret = RegSetValueExW(hkey, value, 0, type, data, count);
5087
5088 RegCloseKey(hkey);
5089 return HRESULT_FROM_WIN32(ret);
5090}
5091
5093
5094/***********************************************************************
5095 * GetUIVersion (SHLWAPI.452)
5096 */
5098{
5099 static DWORD version;
5100
5101 if (!version)
5102 {
5103 DllGetVersion_func pDllGetVersion;
5104 HMODULE dll = LoadLibraryA("shell32.dll");
5105 if (!dll) return 0;
5106
5107 pDllGetVersion = (DllGetVersion_func)GetProcAddress(dll, "DllGetVersion");
5108 if (pDllGetVersion)
5109 {
5110 DLLVERSIONINFO dvi;
5111 dvi.cbSize = sizeof(DLLVERSIONINFO);
5112 if (pDllGetVersion(&dvi) == S_OK) version = dvi.dwMajorVersion;
5113 }
5114 FreeLibrary( dll );
5115 if (!version) version = 3; /* old shell dlls don't have DllGetVersion */
5116 }
5117 return version;
5118}
5119
5120/***********************************************************************
5121 * ShellMessageBoxWrapW [SHLWAPI.388]
5122 *
5123 * See shell32.ShellMessageBoxW
5124 *
5125#ifndef __REACTOS__
5126 *
5127 * NOTE:
5128 * shlwapi.ShellMessageBoxWrapW is a duplicate of shell32.ShellMessageBoxW
5129 * because we can't forward to it in the .spec file since it's exported by
5130 * ordinal. If you change the implementation here please update the code in
5131 * shell32 as well.
5132 *
5133#else // __REACTOS__
5134 *
5135 * From Vista+ onwards, all the implementation of ShellMessageBoxA/W that
5136 * were existing in shell32 has been completely moved to shlwapi, so that
5137 * shell32.ShellMessageBoxA and shell32.ShellMessageBoxW are redirections
5138 * to the corresponding shlwapi functions.
5139 *
5140 * For Win2003 compatibility, if you change the implementation here please
5141 * update the code of ShellMessageBoxA in shell32 as well.
5142 *
5143#endif
5144 */
5146 LPCWSTR lpCaption, UINT uType, ...)
5147{
5148 WCHAR *szText = NULL, szTitle[100];
5149 LPCWSTR pszText, pszTitle = szTitle;
5150 LPWSTR pszTemp;
5152 int ret;
5153
5154 __ms_va_start(args, uType);
5155
5156 TRACE("(%p,%p,%p,%p,%08x)\n", hInstance, hWnd, lpText, lpCaption, uType);
5157
5158 if (IS_INTRESOURCE(lpCaption))
5160 else
5161 pszTitle = lpCaption;
5162
5163 if (IS_INTRESOURCE(lpText))
5164 {
5165 const WCHAR *ptr;
5166 UINT len = LoadStringW(hInstance, LOWORD(lpText), (LPWSTR)&ptr, 0);
5167
5168 if (len)
5169 {
5170 szText = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR));
5171 if (szText) LoadStringW(hInstance, LOWORD(lpText), szText, len + 1);
5172 }
5173 pszText = szText;
5174 if (!pszText) {
5175 WARN("Failed to load id %d\n", LOWORD(lpText));
5177 return 0;
5178 }
5179 }
5180 else
5181 pszText = lpText;
5182
5184 pszText, 0, 0, (LPWSTR)&pszTemp, 0, &args);
5185
5187
5188#ifdef __REACTOS__
5189 uType |= MB_SETFOREGROUND;
5190#endif
5191 ret = MessageBoxW(hWnd, pszTemp, pszTitle, uType);
5192
5193 HeapFree(GetProcessHeap(), 0, szText);
5194 LocalFree(pszTemp);
5195 return ret;
5196}
5197
5198/***********************************************************************
5199 * ZoneComputePaneSize [SHLWAPI.382]
5200 */
5202{
5203 FIXME("\n");
5204 return 0x95;
5205}
5206
5207/***********************************************************************
5208 * SHChangeNotifyWrap [SHLWAPI.394]
5209 */
5210void WINAPI SHChangeNotifyWrap(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
5211{
5212 SHChangeNotify(wEventId, uFlags, dwItem1, dwItem2);
5213}
5214
5215typedef struct SHELL_USER_SID { /* according to MSDN this should be in shlobj.h... */
5220
5221typedef struct SHELL_USER_PERMISSION { /* ...and this should be in shlwapi.h */
5229
5230/***********************************************************************
5231 * GetShellSecurityDescriptor [SHLWAPI.475]
5232 *
5233 * prepares SECURITY_DESCRIPTOR from a set of ACEs
5234 *
5235 * PARAMS
5236 * apUserPerm [I] array of pointers to SHELL_USER_PERMISSION structures,
5237 * each of which describes permissions to apply
5238 * cUserPerm [I] number of entries in apUserPerm array
5239 *
5240 * RETURNS
5241 * success: pointer to SECURITY_DESCRIPTOR
5242 * failure: NULL
5243 *
5244 * NOTES
5245 * Call should free returned descriptor with LocalFree
5246 */
5248{
5249 PSID *sidlist;
5250 PSID cur_user = NULL;
5251 BYTE tuUser[2000];
5252 DWORD acl_size;
5253 int sid_count, i;
5255
5256 TRACE("%p %d\n", apUserPerm, cUserPerm);
5257
5258 if (apUserPerm == NULL || cUserPerm <= 0)
5259 return NULL;
5260
5261 sidlist = HeapAlloc(GetProcessHeap(), 0, cUserPerm * sizeof(PSID));
5262 if (!sidlist)
5263 return NULL;
5264
5265 acl_size = sizeof(ACL);
5266
5267 for(sid_count = 0; sid_count < cUserPerm; sid_count++)
5268 {
5269 static SHELL_USER_SID null_sid = {{SECURITY_NULL_SID_AUTHORITY}, 0, 0};
5270 PSHELL_USER_PERMISSION perm = apUserPerm[sid_count];
5271 PSHELL_USER_SID sid = &perm->susID;
5272 PSID pSid;
5273 BOOL ret = TRUE;
5274
5275 if (!memcmp((void*)sid, (void*)&null_sid, sizeof(SHELL_USER_SID)))
5276 { /* current user's SID */
5277 if (!cur_user)
5278 {
5279 HANDLE Token;
5280 DWORD bufsize = sizeof(tuUser);
5281
5283 if (ret)
5284 {
5285 ret = GetTokenInformation(Token, TokenUser, (void*)tuUser, bufsize, &bufsize );
5286 if (ret)
5287 cur_user = ((PTOKEN_USER)tuUser)->User.Sid;
5289 }
5290 }
5291 pSid = cur_user;
5292 } else if (sid->dwUserID==0) /* one sub-authority */
5293 ret = AllocateAndInitializeSid(&sid->sidAuthority, 1, sid->dwUserGroupID, 0,
5294 0, 0, 0, 0, 0, 0, &pSid);
5295 else
5296 ret = AllocateAndInitializeSid(&sid->sidAuthority, 2, sid->dwUserGroupID, sid->dwUserID,
5297 0, 0, 0, 0, 0, 0, &pSid);
5298 if (!ret)
5299 goto free_sids;
5300
5301 sidlist[sid_count] = pSid;
5302 /* increment acl_size (1 ACE for non-inheritable and 2 ACEs for inheritable records */
5303 acl_size += (sizeof(ACCESS_ALLOWED_ACE)-sizeof(DWORD) + GetLengthSid(pSid)) * (perm->fInherit ? 2 : 1);
5304 }
5305
5306 psd = LocalAlloc(0, sizeof(SECURITY_DESCRIPTOR) + acl_size);
5307
5308 if (psd != NULL)
5309 {
5310 PACL pAcl = (PACL)(((BYTE*)psd)+sizeof(SECURITY_DESCRIPTOR));
5311
5313 goto error;
5314
5315 if (!InitializeAcl(pAcl, acl_size, ACL_REVISION))
5316 goto error;
5317
5318 for(i = 0; i < sid_count; i++)
5319 {
5320 PSHELL_USER_PERMISSION sup = apUserPerm[i];
5321 PSID sid = sidlist[i];
5322
5323 switch(sup->dwAccessType)
5324 {
5327 goto error;
5328 if (sup->fInherit && !AddAccessAllowedAceEx(pAcl, ACL_REVISION,
5330 goto error;
5331 break;
5334 goto error;
5335 if (sup->fInherit && !AddAccessDeniedAceEx(pAcl, ACL_REVISION,
5337 goto error;
5338 break;
5339 default:
5340 goto error;
5341 }
5342 }
5343
5344 if (!SetSecurityDescriptorDacl(psd, TRUE, pAcl, FALSE))
5345 goto error;
5346 }
5347 goto free_sids;
5348
5349error:
5350 LocalFree(psd);
5351 psd = NULL;
5352free_sids:
5353 for(i = 0; i < sid_count; i++)
5354 {
5355 if (!cur_user || sidlist[i] != cur_user)
5356 FreeSid(sidlist[i]);
5357 }
5358 HeapFree(GetProcessHeap(), 0, sidlist);
5359
5360 return psd;
5361}
5362
5363#ifndef __REACTOS__ /* See propbag.cpp */
5364/***********************************************************************
5365 * SHCreatePropertyBagOnRegKey [SHLWAPI.471]
5366 *
5367 * Creates a property bag from a registry key
5368 *
5369 * PARAMS
5370 * hKey [I] Handle to the desired registry key
5371 * subkey [I] Name of desired subkey, or NULL to open hKey directly
5372 * grfMode [I] Optional flags
5373 * riid [I] IID of requested property bag interface
5374 * ppv [O] Address to receive pointer to the new interface
5375 *
5376 * RETURNS
5377 * success: 0
5378 * failure: error code
5379 *
5380 */
5382 DWORD grfMode, REFIID riid, void **ppv)
5383{
5384 FIXME("%p %s %d %s %p STUB\n", hKey, debugstr_w(subkey), grfMode,
5386
5387 return E_NOTIMPL;
5388}
5389#endif
5390
5391#ifndef __REACTOS__ /* See propbag.cpp */
5392/***********************************************************************
5393 * SHGetViewStatePropertyBag [SHLWAPI.515]
5394 *
5395 * Retrieves a property bag in which the view state information of a folder
5396 * can be stored.
5397 *
5398 * PARAMS
5399 * pidl [I] PIDL of the folder requested
5400 * bag_name [I] Name of the property bag requested
5401 * flags [I] Optional flags
5402 * riid [I] IID of requested property bag interface
5403 * ppv [O] Address to receive pointer to the new interface
5404 *
5405 * RETURNS
5406 * success: S_OK
5407 * failure: error code
5408 *
5409 */
5411 DWORD flags, REFIID riid, void **ppv)
5412{
5413 FIXME("%p %s %d %s %p STUB\n", pidl, debugstr_w(bag_name), flags,
5415
5416 return E_NOTIMPL;
5417}
5418#endif
5419
5420/***********************************************************************
5421 * SHFormatDateTimeW [SHLWAPI.354]
5422 *
5423 * Produces a string representation of a time.
5424 *
5425 * PARAMS
5426 * fileTime [I] Pointer to FILETIME structure specifying the time
5427 * flags [I] Flags specifying the desired output
5428 * buf [O] Pointer to buffer for output
5429 * size [I] Number of characters that can be contained in buffer
5430 *
5431 * RETURNS
5432 * success: number of characters written to the buffer
5433 * failure: 0
5434 *
5435 */
5438{
5439#define SHFORMATDT_UNSUPPORTED_FLAGS (FDTF_RELATIVE | FDTF_LTRDATE | FDTF_RTLDATE | FDTF_NOAUTOREADINGORDER)
5440 DWORD fmt_flags = flags ? *flags : FDTF_DEFAULT;
5441 SYSTEMTIME st;
5442 FILETIME ft;
5443 INT ret = 0;
5444
5445 TRACE("%p %p %p %u\n", fileTime, flags, buf, size);
5446
5447 if (!buf || !size)
5448 return 0;
5449
5450 if (fmt_flags & SHFORMATDT_UNSUPPORTED_FLAGS)
5451 FIXME("ignoring some flags - 0x%08x\n", fmt_flags & SHFORMATDT_UNSUPPORTED_FLAGS);
5452
5453 FileTimeToLocalFileTime(fileTime, &ft);
5454 FileTimeToSystemTime(&ft, &st);
5455
5456 /* first of all date */
5457 if (fmt_flags & (FDTF_LONGDATE | FDTF_SHORTDATE))
5458 {
5459 static const WCHAR sep1[] = {',',' ',0};
5460 static const WCHAR sep2[] = {' ',0};
5461
5464 if (ret >= size) return ret;
5465
5466 /* add separator */
5467 if (ret < size && (fmt_flags & (FDTF_LONGTIME | FDTF_SHORTTIME)))
5468 {
5469 if ((fmt_flags & FDTF_LONGDATE) && (ret < size + 2))
5470 {
5471 lstrcatW(&buf[ret-1], sep1);
5472 ret += 2;
5473 }
5474 else
5475 {
5476 lstrcatW(&buf[ret-1], sep2);
5477 ret++;
5478 }
5479 }
5480 }
5481 /* time part */
5482 if (fmt_flags & (FDTF_LONGTIME | FDTF_SHORTTIME))
5483 {
5484 DWORD time = fmt_flags & FDTF_LONGTIME ? 0 : TIME_NOSECONDS;
5485
5486 if (ret) ret--;
5488 }
5489
5490 return ret;
5491
5492#undef SHFORMATDT_UNSUPPORTED_FLAGS
5493}
5494
5495/***********************************************************************
5496 * SHFormatDateTimeA [SHLWAPI.353]
5497 *
5498 * See SHFormatDateTimeW.
5499 *
5500 */
5502 LPSTR buf, UINT size)
5503{
5504 WCHAR *bufW;
5505 INT retval;
5506
5507 if (!buf || !size)
5508 return 0;
5509
5510 bufW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * size);
5511 retval = SHFormatDateTimeW(fileTime, flags, bufW, size);
5512
5513 if (retval != 0)
5514 WideCharToMultiByte(CP_ACP, 0, bufW, -1, buf, size, NULL, NULL);
5515
5516 HeapFree(GetProcessHeap(), 0, bufW);
5517 return retval;
5518}
5519
5520/***********************************************************************
5521 * ZoneCheckUrlExW [SHLWAPI.231]
5522 *
5523 * Checks the details of the security zone for the supplied site. (?)
5524 *
5525 * PARAMS
5526 *
5527 * szURL [I] Pointer to the URL to check
5528 *
5529 * Other parameters currently unknown.
5530 *
5531 * RETURNS
5532 * unknown
5533 */
5534
5536 DWORD dwUnknown3, DWORD dwUnknown4, DWORD dwUnknown5, DWORD dwUnknown6,
5537 DWORD dwUnknown7)
5538{
5539 FIXME("(%s,%p,%x,%x,%x,%x,%x,%x) STUB\n", debugstr_w(szURL), pUnknown, dwUnknown2,
5540 dwUnknown3, dwUnknown4, dwUnknown5, dwUnknown6, dwUnknown7);
5541
5542 return 0;
5543}
5544
5545/***********************************************************************
5546 * SHVerbExistsNA [SHLWAPI.196]
5547 *
5548 *
5549 * PARAMS
5550 *
5551 * verb [I] a string, often appears to be an extension.
5552 *
5553 * Other parameters currently unknown.
5554 *
5555 * RETURNS
5556 * unknown
5557 */
5559{
5560 FIXME("(%s, %p, %p, %i) STUB\n",verb, pUnknown, pUnknown2, dwUnknown3);
5561 return 0;
5562}
5563
5564/*************************************************************************
5565 * @ [SHLWAPI.538]
5566 *
5567 * Undocumented: Implementation guessed at via Name and behavior
5568 *
5569 * PARAMS
5570 * lpUnknown [I] Object to get an IServiceProvider interface from
5571 * riid [I] Function requested for QueryService call
5572 * lppOut [O] Destination for the service interface pointer
5573 *
5574 * RETURNS
5575 * Success: S_OK. lppOut contains an object providing the requested service
5576 * Failure: An HRESULT error code
5577 *
5578 * NOTES
5579 * lpUnknown is expected to support the IServiceProvider interface.
5580 */
5582 REFGUID riid, LPVOID *lppOut)
5583{
5584 FIXME("%p %s %p semi-STUB\n", lpUnknown, debugstr_guid(riid), lppOut);
5585 return IUnknown_QueryService(lpUnknown,&IID_IWebBrowserApp,riid,lppOut);
5586}
5587
5588#ifdef __REACTOS__
5589HRESULT VariantChangeTypeForRead(_Inout_ VARIANTARG *pvarg, _In_ VARTYPE vt)
5590{
5591 HRESULT hr;
5592 VARIANTARG vargTemp;
5593 VARIANT variTemp;
5594
5595 if (V_VT(pvarg) == vt || vt == VT_EMPTY)
5596 return S_OK;
5597
5598 vargTemp = *pvarg;
5599
5600 if (V_VT(&vargTemp) != VT_BSTR || vt <= VT_NULL)
5601 goto DoDefault;
5602
5603 if (vt == VT_I1 || vt == VT_I2 || vt == VT_I4)
5604 {
5605 if (!StrToIntExW(V_BSTR(&vargTemp), STIF_SUPPORT_HEX, (int*)&V_I4(&variTemp)))
5606 goto DoDefault;
5607
5608 V_VT(&variTemp) = VT_INT;
5609 VariantInit(pvarg);
5610 hr = VariantChangeType(pvarg, &variTemp, 0, vt);
5611 VariantClear(&vargTemp);
5612 return hr;
5613 }
5614
5615 if (vt <= VT_DECIMAL)
5616 goto DoDefault;
5617
5618 if (vt == VT_UI1 || vt == VT_UI2 || vt == VT_UI4)
5619 {
5620 if (!StrToIntExW(V_BSTR(&vargTemp), STIF_SUPPORT_HEX, (int*)&V_UI4(&variTemp)))
5621 goto DoDefault;
5622
5623 V_VT(&variTemp) = VT_UINT;
5624 VariantInit(pvarg);
5625 hr = VariantChangeType(pvarg, &variTemp, 0, vt);
5626 VariantClear(&vargTemp);
5627 return hr;
5628 }
5629
5630 if (vt == VT_INT || vt == VT_UINT)
5631 {
5632 if (!StrToIntExW(V_BSTR(&vargTemp), STIF_SUPPORT_HEX, (int*)&V_INT(&variTemp)))
5633 goto DoDefault;
5634
5635 V_VT(&variTemp) = VT_UINT;
5636 VariantInit(pvarg);
5637 hr = VariantChangeType(pvarg, &variTemp, 0, vt);
5638 VariantClear(&vargTemp);
5639 return hr;
5640 }
5641
5642DoDefault:
5643 VariantInit(pvarg);
5644 hr = VariantChangeType(pvarg, &vargTemp, 0, vt);
5645 VariantClear(&vargTemp);
5646 return hr;
5647}
5648
5649BOOL
5650VariantArrayToBuffer(
5651 _In_ const VARIANT *pvarIn,
5652 _Out_writes_(cbSize) LPVOID pvDest,
5653 _In_ SIZE_T cbSize)
5654{
5655 LPVOID pvData;
5656 LONG LowerBound, UpperBound;
5657 LPSAFEARRAY pArray;
5658
5659 /* Only supports byte array */
5660 if (!pvarIn || V_VT(pvarIn) != (VT_UI1 | VT_ARRAY))
5661 return FALSE;
5662
5663 /* Boundary check and access */
5664 pArray = V_ARRAY(pvarIn);
5665 if (SafeArrayGetDim(pArray) == 1 &&
5666 SUCCEEDED(SafeArrayGetLBound(pArray, 1, &LowerBound)) &&
5667 SUCCEEDED(SafeArrayGetUBound(pArray, 1, &UpperBound)) &&
5668 ((LONG)cbSize <= UpperBound - LowerBound + 1) &&
5670 {
5671 CopyMemory(pvDest, pvData, cbSize);
5672 SafeArrayUnaccessData(pArray);
5673 return TRUE; /* Success */
5674 }
5675
5676 return FALSE; /* Failure */
5677}
5678
5679/**************************************************************************
5680 * SHPropertyBag_ReadType (SHLWAPI.493)
5681 *
5682 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readtype.htm
5683 */
5686{
5687 HRESULT hr;
5688
5689 VariantInit(pvarg);
5690 V_VT(pvarg) = vt;
5691
5692 hr = IPropertyBag_Read(ppb, pszPropName, pvarg, NULL);
5693 if (FAILED(hr))
5694 {
5695 ERR("%p %s\n", ppb, debugstr_w(pszPropName));
5696 VariantInit(pvarg);
5697 return hr;
5698 }
5699
5700 return VariantChangeTypeForRead(pvarg, vt);
5701}
5702
5703/**************************************************************************
5704 * SHPropertyBag_ReadBOOL (SHLWAPI.534)
5705 *
5706 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readbool.htm
5707 */
5708HRESULT WINAPI SHPropertyBag_ReadBOOL(IPropertyBag *ppb, LPCWSTR pszPropName, BOOL *pbValue)
5709{
5710 HRESULT hr;
5711 VARIANTARG varg;
5712
5713 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), pbValue);
5714
5715 if (!ppb || !pszPropName || !pbValue)
5716 {
5717 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), pbValue);
5718 return E_INVALIDARG;
5719 }
5720
5721 hr = SHPropertyBag_ReadType(ppb, pszPropName, &varg, VT_BOOL);
5722 if (SUCCEEDED(hr))
5723 *pbValue = (V_BOOL(&varg) == VARIANT_TRUE);
5724
5725 return hr;
5726}
5727
5728/**************************************************************************
5729 * SHPropertyBag_ReadBOOLOld (SHLWAPI.498)
5730 *
5731 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readboolold.htm
5732 */
5733BOOL WINAPI SHPropertyBag_ReadBOOLOld(IPropertyBag *ppb, LPCWSTR pszPropName, BOOL bDefValue)
5734{
5735 VARIANTARG varg;
5736 HRESULT hr;
5737
5738 TRACE("%p %s %d\n", ppb, debugstr_w(pszPropName), bDefValue);
5739
5740 hr = SHPropertyBag_ReadType(ppb, pszPropName, &varg, VT_BOOL);
5741 if (FAILED(hr))
5742 return bDefValue;
5743
5744 return V_BOOL(&varg) == VARIANT_TRUE;
5745}
5746
5747/**************************************************************************
5748 * SHPropertyBag_ReadSHORT (SHLWAPI.527)
5749 *
5750 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readshort.htm
5751 */
5753{
5754 HRESULT hr;
5755 VARIANTARG varg;
5756
5757 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), psValue);
5758
5759 if (!ppb || !pszPropName || !psValue)
5760 {
5761 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), psValue);
5762 return E_INVALIDARG;
5763 }
5764
5765 hr = SHPropertyBag_ReadType(ppb, pszPropName, &varg, VT_UI2);
5766 if (SUCCEEDED(hr))
5767 *psValue = V_UI2(&varg);
5768
5769 return hr;
5770}
5771#endif
5772
5773/**************************************************************************
5774 * SHPropertyBag_ReadLONG (SHLWAPI.496)
5775 *
5776 * This function asks a property bag to read a named property as a LONG.
5777 *
5778 * PARAMS
5779 * ppb: a IPropertyBag interface
5780 * pszPropName: Unicode string that names the property
5781 * pValue: address to receive the property value as a 32-bit signed integer
5782 *
5783 * RETURNS
5784 * HRESULT codes
5785#ifdef __REACTOS__
5786 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readlong.htm
5787#endif
5788 */
5790{
5791#ifdef __REACTOS__
5792 HRESULT hr;
5793 VARIANTARG varg;
5794
5795 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), pValue);
5796
5797 if (!ppb || !pszPropName || !pValue)
5798 {
5799 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), pValue);
5800 return E_INVALIDARG;
5801 }
5802
5803 hr = SHPropertyBag_ReadType(ppb, pszPropName, &varg, VT_I4);
5804 if (SUCCEEDED(hr))
5805 *pValue = V_I4(&varg);
5806#else
5807 VARIANT var;
5808 HRESULT hr;
5809 TRACE("%p %s %p\n", ppb,debugstr_w(pszPropName),pValue);
5810 if (!pszPropName || !ppb || !pValue)
5811 return E_INVALIDARG;
5812 V_VT(&var) = VT_I4;
5813 hr = IPropertyBag_Read(ppb, pszPropName, &var, NULL);
5814 if (SUCCEEDED(hr))
5815 {
5816 if (V_VT(&var) == VT_I4)
5817 *pValue = V_I4(&var);
5818 else
5820 }
5821#endif
5822 return hr;
5823}
5824
5825#ifdef __REACTOS__
5826/**************************************************************************
5827 * SHPropertyBag_ReadDWORD (SHLWAPI.507)
5828 *
5829 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readdword.htm
5830 */
5831HRESULT WINAPI SHPropertyBag_ReadDWORD(IPropertyBag *ppb, LPCWSTR pszPropName, DWORD *pdwValue)
5832{
5833 HRESULT hr;
5834 VARIANTARG varg;
5835
5836 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), pdwValue);
5837
5838 if (!ppb || !pszPropName || !pdwValue)
5839 {
5840 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), pdwValue);
5841 return E_INVALIDARG;
5842 }
5843
5844 hr = SHPropertyBag_ReadType(ppb, pszPropName, &varg, VT_UI4);
5845 if (SUCCEEDED(hr))
5846 *pdwValue = V_UI4(&varg);
5847
5848 return hr;
5849}
5850
5851/**************************************************************************
5852 * SHPropertyBag_ReadBSTR (SHLWAPI.520)
5853 *
5854 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readbstr.htm
5855 */
5857{
5858 HRESULT hr;
5859 VARIANTARG varg;
5860
5861 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), pbstr);
5862
5863 if (!ppb || !pszPropName || !pbstr)
5864 {
5865 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), pbstr);
5866 return E_INVALIDARG;
5867 }
5868
5869 hr = SHPropertyBag_ReadType(ppb, pszPropName, &varg, VT_BSTR);
5870 if (FAILED(hr))
5871 *pbstr = NULL;
5872 else
5873 *pbstr = V_BSTR(&varg);
5874
5875 return hr;
5876}
5877
5878/**************************************************************************
5879 * SHPropertyBag_ReadStr (SHLWAPI.494)
5880 *
5881 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readstr.htm
5882 */
5884{
5885 HRESULT hr;
5886 VARIANTARG varg;
5887
5888 TRACE("%p %s %p %d\n", ppb, debugstr_w(pszPropName), pszDst, cchMax);
5889
5890 if (!ppb || !pszPropName || !pszDst)
5891 {
5892 ERR("%p %s %p %d\n", ppb, debugstr_w(pszPropName), pszDst, cchMax);
5893 return E_INVALIDARG;
5894 }
5895
5896 hr = SHPropertyBag_ReadType(ppb, pszPropName, &varg, VT_BSTR);
5897 if (FAILED(hr))
5898 return E_FAIL;
5899
5900 StrCpyNW(pszDst, V_BSTR(&varg), cchMax);
5901 VariantClear(&varg);
5902 return hr;
5903}
5904
5905/**************************************************************************
5906 * SHPropertyBag_ReadPOINTL (SHLWAPI.521)
5907 *
5908 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readpointl.htm
5909 */
5911{
5912 HRESULT hr;
5913 int cch, cch2;
5914 WCHAR *pch, szBuff[MAX_PATH];
5915
5916 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), pptl);
5917
5918 if (!ppb || !pszPropName || !pptl)
5919 {
5920 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), pptl);
5921 return E_INVALIDARG;
5922 }
5923
5924 StrCpyNW(szBuff, pszPropName, _countof(szBuff));
5925
5926 cch = lstrlenW(szBuff);
5927 cch2 = _countof(szBuff) - cch;
5928 if (cch2 < _countof(L".x"))
5929 {
5930 ERR("%s is too long\n", debugstr_w(pszPropName));
5931 return E_FAIL;
5932 }
5933
5934 pch = &szBuff[cch];
5935
5936 StrCpyNW(pch, L".x", cch2);
5937 hr = SHPropertyBag_ReadLONG(ppb, szBuff, &pptl->x);
5938 if (FAILED(hr))
5939 return hr;
5940
5941 StrCpyNW(pch, L".y", cch2);
5942 return SHPropertyBag_ReadLONG(ppb, szBuff, &pptl->y);
5943}
5944
5945/**************************************************************************
5946 * SHPropertyBag_ReadPOINTS (SHLWAPI.525)
5947 *
5948 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readpoints.htm
5949 */
5951{
5952 HRESULT hr;
5953 POINTL ptl;
5954
5955 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), ppts);
5956
5957 if (!ppb || !pszPropName || !ppts)
5958 {
5959 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), ppts);
5960 return E_INVALIDARG;
5961 }
5962
5963 hr = SHPropertyBag_ReadPOINTL(ppb, pszPropName, &ptl);
5964 if (FAILED(hr))
5965 return hr;
5966
5967 ppts->x = ptl.x;
5968 ppts->y = ptl.y;
5969 return hr;
5970}
5971
5972/**************************************************************************
5973 * SHPropertyBag_ReadRECTL (SHLWAPI.523)
5974 *
5975 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readrectl.htm
5976 */
5978{
5979 HRESULT hr;
5980 int cch, cch2;
5981 WCHAR *pch, szBuff[MAX_PATH];
5982
5983 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), prcl);
5984
5985 if (!ppb || !pszPropName || !prcl)
5986 {
5987 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), prcl);
5988 return E_INVALIDARG;
5989 }
5990
5991 StrCpyNW(szBuff, pszPropName, _countof(szBuff));
5992
5993 cch = lstrlenW(szBuff);
5994 cch2 = _countof(szBuff) - cch;
5995 if (cch2 < _countof(L".bottom"))
5996 {
5997 ERR("%s is too long\n", debugstr_w(pszPropName));
5998 return E_FAIL;
5999 }
6000
6001 pch = &szBuff[cch];
6002
6003 StrCpyNW(pch, L".left", cch2);
6004 hr = SHPropertyBag_ReadLONG(ppb, szBuff, &prcl->left);
6005 if (FAILED(hr))
6006 return hr;
6007
6008 StrCpyNW(pch, L".top", cch2);
6009 hr = SHPropertyBag_ReadLONG(ppb, szBuff, &prcl->top);
6010 if (FAILED(hr))
6011 return hr;
6012
6013 StrCpyNW(pch, L".right", cch2);
6014 hr = SHPropertyBag_ReadLONG(ppb, szBuff, &prcl->right);
6015 if (FAILED(hr))
6016 return hr;
6017
6018 StrCpyNW(pch, L".bottom", cch2);
6019 return SHPropertyBag_ReadLONG(ppb, szBuff, &prcl->bottom);
6020}
6021
6022/**************************************************************************
6023 * SHPropertyBag_ReadGUID (SHLWAPI.505)
6024 *
6025 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readguid.htm
6026 */
6028{
6029 HRESULT hr;
6030 BOOL bRet;
6031 VARIANT vari;
6032
6033 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), pguid);
6034
6035 if (!ppb || !pszPropName || !pguid)
6036 {
6037 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), pguid);
6038 return E_INVALIDARG;
6039 }
6040
6041 hr = SHPropertyBag_ReadType(ppb, pszPropName, &vari, VT_EMPTY);
6042 if (FAILED(hr))
6043 {
6044 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), pguid);
6045 return hr;
6046 }
6047
6048 if (V_VT(&vari) == (VT_UI1 | VT_ARRAY)) /* Byte Array */
6049 bRet = VariantArrayToBuffer(&vari, pguid, sizeof(*pguid));
6050 else if (V_VT(&vari) == VT_BSTR)
6051 bRet = GUIDFromStringW(V_BSTR(&vari), pguid);
6052 else
6053#if (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
6054 bRet = FALSE;
6055#else
6056 bRet = TRUE; /* This is by design in WinXP/Win2k3. */
6057#endif
6058
6059 if (!bRet)
6060 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), pguid);
6061
6062 VariantClear(&vari);
6063 return (bRet ? S_OK : E_FAIL);
6064}
6065
6066/**************************************************************************
6067 * SHPropertyBag_ReadStream (SHLWAPI.531)
6068 *
6069 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/readstream.htm
6070 */
6072{
6073 HRESULT hr;
6074 VARIANT vari;
6075
6076 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), ppStream);
6077
6078 if (!ppb || !pszPropName || !ppStream)
6079 {
6080 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), ppStream);
6081 return E_INVALIDARG;
6082 }
6083
6084 hr = SHPropertyBag_ReadType(ppb, pszPropName, &vari, VT_UNKNOWN);
6085 if (FAILED(hr))
6086 return hr;
6087
6088 hr = IUnknown_QueryInterface(V_UNKNOWN(&vari), &IID_IStream, (void **)ppStream);
6089 IUnknown_Release(V_UNKNOWN(&vari));
6090
6091 return hr;
6092}
6093
6094/**************************************************************************
6095 * SHPropertyBag_Delete (SHLWAPI.535)
6096 *
6097 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/delete.htm
6098 */
6100{
6101 VARIANT vari;
6102
6103 TRACE("%p %s\n", ppb, debugstr_w(pszPropName));
6104
6105 if (!ppb || !pszPropName)
6106 {
6107 ERR("%p %s\n", ppb, debugstr_w(pszPropName));
6108 return E_INVALIDARG;
6109 }
6110
6111 V_VT(&vari) = VT_EMPTY;
6112 return IPropertyBag_Write(ppb, pszPropName, &vari);
6113}
6114
6115/**************************************************************************
6116 * SHPropertyBag_WriteBOOL (SHLWAPI.499)
6117 *
6118 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/writebool.htm
6119 */
6121{
6122 VARIANT vari;
6123
6124 TRACE("%p %s %d\n", ppb, debugstr_w(pszPropName), bValue);
6125
6126 if (!ppb || !pszPropName)
6127 {
6128 ERR("%p %s\n", ppb, debugstr_w(pszPropName));
6129 return E_INVALIDARG;
6130 }
6131
6132 V_VT(&vari) = VT_BOOL;
6133 V_BOOL(&vari) = (bValue ? VARIANT_TRUE : VARIANT_FALSE); /* NOTE: VARIANT_TRUE is (SHORT)-1 */
6134 return IPropertyBag_Write(ppb, pszPropName, &vari);
6135}
6136
6137/**************************************************************************
6138 * SHPropertyBag_WriteSHORT (SHLWAPI.528)
6139 *
6140 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/writeshort.htm
6141 */
6143{
6144 VARIANT vari;
6145
6146 TRACE("%p %s %d\n", ppb, debugstr_w(pszPropName), sValue);
6147
6148 if (!ppb || !pszPropName)
6149 {
6150 ERR("%p %s\n", ppb, debugstr_w(pszPropName));
6151 return E_INVALIDARG;
6152 }
6153
6154 V_VT(&vari) = VT_UI2;
6155 V_UI2(&vari) = sValue;
6156 return IPropertyBag_Write(ppb, pszPropName, &vari);
6157}
6158
6159/**************************************************************************
6160 * SHPropertyBag_WriteLONG (SHLWAPI.497)
6161 *
6162 * This function asks a property bag to write a named property as a LONG.
6163 *
6164 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/writelong.htm
6165 */
6167{
6168 VARIANT vari;
6169
6170 TRACE("%p %s %ld\n", ppb, debugstr_w(pszPropName), lValue);
6171
6172 if (!ppb || !pszPropName)
6173 {
6174 ERR("%p %s\n", ppb, debugstr_w(pszPropName));
6175 return E_INVALIDARG;
6176 }
6177
6178 V_VT(&vari) = VT_I4;
6179 V_I4(&vari) = lValue;
6180 return IPropertyBag_Write(ppb, pszPropName, &vari);
6181}
6182
6183/**************************************************************************
6184 * SHPropertyBag_WriteDWORD (SHLWAPI.508)
6185 *
6186 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/writedword.htm
6187 */
6189{
6190 VARIANT vari;
6191
6192 TRACE("%p %s %lu\n", ppb, debugstr_w(pszPropName), dwValue);
6193
6194 if (!ppb || !pszPropName)
6195 {
6196 ERR("%p %s\n", ppb, debugstr_w(pszPropName));
6197 return E_INVALIDARG;
6198 }
6199
6200 V_VT(&vari) = VT_UI4;
6201 V_UI4(&vari) = dwValue;
6202 return IPropertyBag_Write(ppb, pszPropName, &vari);
6203}
6204
6205/**************************************************************************
6206 * SHPropertyBag_WriteStr (SHLWAPI.495)
6207 *
6208 * This function asks a property bag to write a string as the value of a named property.
6209 *
6210 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/writestr.htm
6211 */
6213{
6214 HRESULT hr;
6215 VARIANT vari;
6216
6217 TRACE("%p %s %s\n", ppb, debugstr_w(pszPropName), debugstr_w(pszValue));
6218
6219 if (!ppb || !pszPropName)
6220 {
6221 ERR("%p %s\n", ppb, debugstr_w(pszPropName));
6222 return E_INVALIDARG;
6223 }
6224
6225 V_BSTR(&vari) = SysAllocString(pszValue);
6226 if (!V_BSTR(&vari))
6227 return E_OUTOFMEMORY;
6228
6229 V_VT(&vari) = VT_BSTR;
6230 hr = IPropertyBag_Write(ppb, pszPropName, &vari);
6231
6232 SysFreeString(V_BSTR(&vari));
6233 return hr;
6234}
6235
6236/**************************************************************************
6237 * SHPropertyBag_WriteGUID (SHLWAPI.506)
6238 *
6239 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/writeguid.htm
6240 */
6241HRESULT WINAPI SHPropertyBag_WriteGUID(IPropertyBag *ppb, LPCWSTR pszPropName, const GUID *pguid)
6242{
6243 WCHAR szBuff[64];
6244
6245 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), pguid);
6246
6247 if (!ppb || !pszPropName || !pguid)
6248 {
6249 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), pguid);
6250 return E_INVALIDARG;
6251 }
6252
6253 SHStringFromGUIDW(pguid, szBuff, _countof(szBuff));
6254 return SHPropertyBag_WriteStr(ppb, pszPropName, szBuff);
6255}
6256
6257/**************************************************************************
6258 * SHPropertyBag_WriteStream (SHLWAPI.532)
6259 *
6260 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/writestream.htm
6261 */
6263{
6264 VARIANT vari;
6265
6266 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), pStream);
6267
6268 if (!ppb || !pszPropName || !pStream)
6269 {
6270 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), pStream);
6271 return E_INVALIDARG;
6272 }
6273
6274 V_VT(&vari) = VT_UNKNOWN;
6275 V_UNKNOWN(&vari) = (IUnknown*)pStream;
6276 return IPropertyBag_Write(ppb, pszPropName, &vari);
6277}
6278
6279/**************************************************************************
6280 * SHPropertyBag_WritePOINTL (SHLWAPI.522)
6281 *
6282 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/writepointl.htm
6283 */
6285{
6286 HRESULT hr;
6287 int cch, cch2;
6288 WCHAR *pch, szBuff[MAX_PATH];
6289
6290 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), pptl);
6291
6292 if (!ppb || !pszPropName || !pptl)
6293 {
6294 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), pptl);
6295 return E_INVALIDARG;
6296 }
6297
6298 StrCpyNW(szBuff, pszPropName, _countof(szBuff));
6299
6300 cch = lstrlenW(szBuff);
6301 cch2 = _countof(szBuff) - cch;
6302 if (cch2 < _countof(L".x"))
6303 {
6304 ERR("%s is too long\n", debugstr_w(pszPropName));
6305 return E_FAIL;
6306 }
6307
6308 pch = &szBuff[cch];
6309
6310 StrCpyNW(pch, L".x", cch2);
6311 hr = SHPropertyBag_WriteLONG(ppb, szBuff, pptl->x);
6312 if (FAILED(hr))
6313 return hr;
6314
6315 StrCpyNW(pch, L".y", cch2);
6316 hr = SHPropertyBag_WriteLONG(ppb, szBuff, pptl->y);
6317 if (FAILED(hr))
6318 {
6319 StrCpyNW(pch, L".x", cch2);
6320 return SHPropertyBag_Delete(ppb, szBuff);
6321 }
6322
6323 return hr;
6324}
6325
6326/**************************************************************************
6327 * SHPropertyBag_WritePOINTS (SHLWAPI.526)
6328 *
6329 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/writepoints.htm
6330 */
6331HRESULT WINAPI SHPropertyBag_WritePOINTS(IPropertyBag *ppb, LPCWSTR pszPropName, const POINTS *ppts)
6332{
6333 POINTL pt;
6334
6335 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), ppts);
6336
6337 if (!ppb || !pszPropName || !ppts)
6338 {
6339 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), ppts);
6340 return E_INVALIDARG;
6341 }
6342
6343 pt.x = ppts->x;
6344 pt.y = ppts->y;
6345 return SHPropertyBag_WritePOINTL(ppb, pszPropName, &pt);
6346}
6347
6348/**************************************************************************
6349 * SHPropertyBag_WriteRECTL (SHLWAPI.524)
6350 *
6351 * @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/propbag/writerectl.htm
6352 */
6354{
6355 HRESULT hr;
6356 int cch, cch2;
6357 WCHAR *pch, szBuff[MAX_PATH];
6358
6359 TRACE("%p %s %p\n", ppb, debugstr_w(pszPropName), prcl);
6360
6361 if (!ppb || !pszPropName || !prcl)
6362 {
6363 ERR("%p %s %p\n", ppb, debugstr_w(pszPropName), prcl);
6364 return E_INVALIDARG;
6365 }
6366
6367 StrCpyNW(szBuff, pszPropName, _countof(szBuff));
6368
6369 cch = lstrlenW(szBuff);
6370 cch2 = _countof(szBuff) - cch;
6371 if (cch2 < _countof(L".bottom"))
6372 {
6373 ERR("%s is too long\n", debugstr_w(pszPropName));
6374 return E_FAIL;
6375 }
6376
6377 pch = &szBuff[cch];
6378
6379 StrCpyNW(pch, L".left", cch2);
6380 hr = SHPropertyBag_WriteLONG(ppb, szBuff, prcl->left);
6381 if (SUCCEEDED(hr))
6382 {
6383 StrCpyNW(pch, L".top", cch2);
6384 hr = SHPropertyBag_WriteLONG(ppb, szBuff, prcl->top);
6385 if (SUCCEEDED(hr))
6386 {
6387 StrCpyNW(pch, L".right", cch2);
6388 hr = SHPropertyBag_WriteLONG(ppb, szBuff, prcl->right);
6389 if (SUCCEEDED(hr))
6390 {
6391 StrCpyNW(pch, L".bottom", cch2);
6392 hr = SHPropertyBag_WriteLONG(ppb, szBuff, prcl->bottom);
6393 if (SUCCEEDED(hr))
6394 return hr; /* All successful */
6395
6396 StrCpyNW(pch, L".right", cch2);
6397 hr = SHPropertyBag_Delete(ppb, szBuff);
6398 if (SUCCEEDED(hr))
6399 return hr;
6400 }
6401
6402 StrCpyNW(pch, L".top", cch2);
6403 hr = SHPropertyBag_Delete(ppb, szBuff);
6404 if (SUCCEEDED(hr))
6405 return hr;
6406 }
6407
6408 StrCpyNW(pch, L".left", cch2);
6409 hr = SHPropertyBag_Delete(ppb, szBuff);
6410 if (SUCCEEDED(hr))
6411 return hr;
6412 }
6413
6414 return hr;
6415}
6416#endif
6417
6418/* return flags for SHGetObjectCompatFlags, names derived from registry value names */
6419#define OBJCOMPAT_OTNEEDSSFCACHE 0x00000001
6420#define OBJCOMPAT_NO_WEBVIEW 0x00000002
6421#define OBJCOMPAT_UNBINDABLE 0x00000004
6422#define OBJCOMPAT_PINDLL 0x00000008
6423#define OBJCOMPAT_NEEDSFILESYSANCESTOR 0x00000010
6424#define OBJCOMPAT_NOTAFILESYSTEM 0x00000020
6425#define OBJCOMPAT_CTXMENU_NOVERBS 0x00000040
6426#define OBJCOMPAT_CTXMENU_LIMITEDQI 0x00000080
6427#define OBJCOMPAT_COCREATESHELLFOLDERONLY 0x00000100
6428#define OBJCOMPAT_NEEDSSTORAGEANCESTOR 0x00000200
6429#define OBJCOMPAT_NOLEGACYWEBVIEW 0x00000400
6430#define OBJCOMPAT_CTXMENU_XPQCMFLAGS 0x00001000
6431#define OBJCOMPAT_NOIPROPERTYSTORE 0x00002000
6432
6433/* a search table for compatibility flags */
6435 const WCHAR name[30];
6437};
6438
6439/* expected to be sorted by name */
6440static const struct objcompat_entry objcompat_table[] = {
6441 { {'C','O','C','R','E','A','T','E','S','H','E','L','L','F','O','L','D','E','R','O','N','L','Y',0},
6443 { {'C','T','X','M','E','N','U','_','L','I','M','I','T','E','D','Q','I',0},
6445 { {'C','T','X','M','E','N','U','_','N','O','V','E','R','B','S',0},
6447 { {'C','T','X','M','E','N','U','_','X','P','Q','C','M','F','L','A','G','S',0},
6449 { {'N','E','E','D','S','F','I','L','E','S','Y','S','A','N','C','E','S','T','O','R',0},
6451 { {'N','E','E','D','S','S','T','O','R','A','G','E','A','N','C','E','S','T','O','R',0},
6453 { {'N','O','I','P','R','O','P','E','R','T','Y','S','T','O','R','E',0},
6455 { {'N','O','L','E','G','A','C','Y','W','E','B','V','I','E','W',0},
6457 { {'N','O','T','A','F','I','L','E','S','Y','S','T','E','M',0},
6459 { {'N','O','_','W','E','B','V','I','E','W',0},
6461 { {'O','T','N','E','E','D','S','S','F','C','A','C','H','E',0},
6463 { {'P','I','N','D','L','L',0},
6465 { {'U','N','B','I','N','D','A','B','L','E',0},
6467};
6468
6469/**************************************************************************
6470 * SHGetObjectCompatFlags (SHLWAPI.476)
6471 *
6472 * Function returns an integer representation of compatibility flags stored
6473 * in registry for CLSID under ShellCompatibility subkey.
6474 *
6475 * PARAMS
6476 * pUnk: pointer to object IUnknown interface, idetifies CLSID
6477 * clsid: pointer to CLSID to retrieve data for
6478 *
6479 * RETURNS
6480 * 0 on failure, flags set on success
6481 */
6483{
6484 static const WCHAR compatpathW[] =
6485 {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
6486 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
6487 'S','h','e','l','l','C','o','m','p','a','t','i','b','i','l','i','t','y','\\',
6488 'O','b','j','e','c','t','s','\\','%','s',0};
6489 WCHAR strW[sizeof(compatpathW)/sizeof(WCHAR) + 38 /* { CLSID } */];
6490 DWORD ret, length = sizeof(strW)/sizeof(WCHAR);
6491 OLECHAR *clsid_str;
6492 HKEY key;
6493 INT i;
6494
6495 TRACE("%p %s\n", pUnk, debugstr_guid(clsid));
6496
6497 if (!pUnk && !clsid) return 0;
6498
6499 if (pUnk && !clsid)
6500 {
6501 FIXME("iface not handled\n");
6502 return 0;
6503 }
6504
6505 StringFromCLSID(clsid, &clsid_str);
6506 sprintfW(strW, compatpathW, clsid_str);
6507 CoTaskMemFree(clsid_str);
6508
6510 if (ret != ERROR_SUCCESS) return 0;
6511
6512 /* now collect flag values */
6513 ret = 0;
6514 for (i = 0; RegEnumValueW(key, i, strW, &length, NULL, NULL, NULL, NULL) == ERROR_SUCCESS; i++)
6515 {
6516 INT left, right, res, x;
6517
6518 /* search in table */
6519 left = 0;
6520 right = sizeof(objcompat_table) / sizeof(struct objcompat_entry) - 1;
6521
6522 while (right >= left) {
6523 x = (left + right) / 2;
6525 if (res == 0)
6526 {
6527 ret |= objcompat_table[x].value;
6528 break;
6529 }
6530 else if (res < 0)
6531 right = x - 1;
6532 else
6533 left = x + 1;
6534 }
6535
6536 length = sizeof(strW)/sizeof(WCHAR);
6537 }
6538
6539 return ret;
6540}
6541
6542#ifdef __REACTOS__
6543/**************************************************************************
6544 * SHBoolSystemParametersInfo (SHLWAPI.537)
6545 *
6546 * Specialized SPI values from https://undoc.airesoft.co.uk/shlwapi.dll/SHBoolSystemParametersInfo.php
6547 */
6549{
6550 BOOL retval;
6551 PVOID pvOrgParam = pvParam;
6552 UINT uiParam = 0;
6553 ANIMATIONINFO animinfo;
6554
6555 switch (uiAction)
6556 {
6557 case SPI_GETANIMATION:
6558 case SPI_SETANIMATION:
6559 uiParam = animinfo.cbSize = sizeof(animinfo);
6560 animinfo.iMinAnimate = *(BOOL*)pvParam; /* SPI_SET */
6561 pvParam = &animinfo;
6562 break;
6563 case SPI_SETDRAGFULLWINDOWS:
6564 case SPI_SETFONTSMOOTHING:
6565 uiParam = *(BOOL*)pvParam;
6566 break;
6567 case SPI_GETDRAGFULLWINDOWS:
6568 case SPI_GETFONTSMOOTHING:
6569 /* pvParam already correct */
6570 break;
6571 default:
6572 if (uiAction < 0x1000)
6573 return FALSE;
6574 else if (uiAction & 1) /* SPI_SET */
6575 pvParam = (PVOID)(SIZE_T)(*(BOOL*)pvParam);
6576 break;
6577 }
6578
6579 retval = SystemParametersInfoW(uiAction, uiParam, pvParam, SPIF_SENDCHANGE | SPIF_UPDATEINIFILE);
6580 if (uiAction == SPI_GETANIMATION)
6581 *(BOOL*)pvOrgParam = animinfo.iMinAnimate;
6582 return retval;
6583}
6584#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:47
#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
#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
HMODULE hModule
Definition: animate.c:44
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:633
#define OBJCOMPAT_NOIPROPERTYSTORE
Definition: ordinal.c:6431
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:3873
static const WCHAR strRegistryPolicyW[]
Definition: ordinal.c:2844
#define OBJCOMPAT_CTXMENU_XPQCMFLAGS
Definition: ordinal.c:6430
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:4650
BOOL WINAPI SHSetIniStringW(LPCWSTR appName, LPCWSTR keyName, LPCWSTR str, LPCWSTR filename)
Definition: ordinal.c:3545
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:4419
#define OBJCOMPAT_NOLEGACYWEBVIEW
Definition: ordinal.c:6429
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:3448
HPALETTE WINAPI SHCreateShellPalette(HDC hdc)
Definition: ordinal.c:4598
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:4179
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:4396
DWORD WINAPI SHSendMessageBroadcastW(UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: ordinal.c:4191
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:4226
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:3929
HRESULT WINAPI SHSetDefaultDialogFont(HWND hWnd, INT id)
Definition: ordinal.c:2576
INT WINAPI GetMenuPosFromID(HMENU hMenu, UINT wID)
Definition: ordinal.c:4681
DWORD WINAPI MLClearMLHInstance(DWORD x)
Definition: ordinal.c:4167
#define EnableModeless(type)
Definition: ordinal.c:3659
DWORD WINAPI GetUIVersion(void)
Definition: ordinal.c:5097
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:4139
HRESULT WINAPI SHPackDispParamsV(DISPPARAMS *params, VARIANTARG *args, UINT cnt, __ms_va_list valist)
Definition: ordinal.c:3194
DWORD WINAPI SHGetAppCompatFlags(DWORD dwUnknown)
Definition: ordinal.c:4732
struct tagPOLICYDATA * LPPOLICYDATA
HRESULT WINAPIV IUnknown_CPContainerInvokeParam(IUnknown *container, REFIID riid, DISPID dispId, VARIANTARG *buffer, DWORD cParams,...)
Definition: ordinal.c:3399
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:3560
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:6419
void WINAPI IUnknown_AtomicRelease(IUnknown **lpUnknown)
Definition: ordinal.c:1245
#define OBJCOMPAT_NEEDSFILESYSANCESTOR
Definition: ordinal.c:6423
HRESULT WINAPI IConnectionPoint_InvokeWithCancel(IConnectionPoint *iCP, DISPID dispId, DISPPARAMS *dispParams, DWORD unknown1, DWORD unknown2)
Definition: ordinal.c:3303
HRESULT WINAPI IUnknown_HasFocusIO(IUnknown *lpUnknown)
Definition: ordinal.c:4451
DWORD WINAPI SHGetIniStringW(LPCWSTR appName, LPCWSTR keyName, LPWSTR out, DWORD outLen, LPCWSTR filename)
Definition: ordinal.c:3498
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:3680
WORD WINAPI VerQueryValueWrapW(LPVOID pBlock, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, UINT *puLen)
Definition: ordinal.c:3651
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:3960
DWORD WINAPI SHWaitForSendMessageThread(HANDLE hand, DWORD dwTimeout)
Definition: ordinal.c:2050
HRESULT WINAPI CLSIDFromStringWrap(LPCWSTR idstr, CLSID *id)
Definition: ordinal.c:4209
DWORD WINAPI SHFillRectClr(HDC hDC, LPCRECT pRect, COLORREF cRef)
Definition: ordinal.c:2133
BOOL WINAPI SHGetPathFromIDListWrapW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: ordinal.c:3591
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:5145
HRESULT WINAPI IUnknown_OnFocusOCS(IUnknown *lpUnknown, BOOL fGotFocus)
Definition: ordinal.c:1931
DWORD WINAPI SHGetObjectCompatFlags(IUnknown *pUnk, const CLSID *clsid)
Definition: ordinal.c:6482
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1501
#define OBJCOMPAT_CTXMENU_LIMITEDQI
Definition: ordinal.c:6426
DWORD WINAPI SHGetMachineInfo(DWORD dwFlags)
Definition: ordinal.c:4077
BOOL WINAPI MLIsMLHInstance(HINSTANCE hInst)
Definition: ordinal.c:4148
INT WINAPI SHFileOperationWrapW(LPSHFILEOPSTRUCTW lpFileOp)
Definition: ordinal.c:3611
HRESULT WINAPI SHCreatePropertyBagOnRegKey(HKEY hKey, LPCWSTR subkey, DWORD grfMode, REFIID riid, void **ppv)
Definition: ordinal.c:5381
INT WINAPI SHFormatDateTimeW(const FILETIME UNALIGNED *fileTime, DWORD *flags, LPWSTR buf, UINT size)
Definition: ordinal.c:5436
HRESULT WINAPI SHCoCreateInstanceAC(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: ordinal.c:4742
HRESULT WINAPI SHIsExpandableFolder(LPSHELLFOLDER lpFolder, LPCITEMIDLIST pidl)
Definition: ordinal.c:2088
BOOL WINAPI PlaySoundWrapW(LPCWSTR pszSound, HMODULE hmod, DWORD fdwSound)
Definition: ordinal.c:3476
struct tagPOLICYDATA POLICYDATA
HRESULT WINAPI SKAllocValueW(DWORD flags, LPCWSTR subkey, LPCWSTR value, DWORD *type, LPVOID *data, DWORD *count)
Definition: ordinal.c:4994
BOOL WINAPI SHIsChildOrSelf(HWND hParent, HWND hChild)
Definition: ordinal.c:2373
DWORD WINAPI WhichPlatform(void)
Definition: ordinal.c:3070
DWORD SHLWAPI_ThreadRef_index
Definition: shlwapi_main.c:34
COLORREF WINAPI ColorHLSToRGB(WORD wHue, WORD wLuminosity, WORD wSaturation)
Definition: ordinal.c:4039
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:4021
BOOL WINAPI MLFreeLibrary(HMODULE hModule)
Definition: ordinal.c:4130
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:3620
DWORD WINAPI SHWinHelpOnDemandW(HWND hwnd, LPCWSTR helpfile, DWORD flags1, VOID *ptr1, DWORD flags2)
Definition: ordinal.c:4098
UINT WINAPI SHDefExtractIconWrapW(LPCWSTR pszIconFile, int iIndex, UINT uFlags, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize)
Definition: ordinal.c:3723
BOOL WINAPI FDSA_Destroy(FDSA_info *info)
Definition: ordinal.c:2431
HRESULT WINAPI SHInvokeDefaultCommand(HWND hWnd, IShellFolder *lpFolder, LPCITEMIDLIST lpApidl)
Definition: ordinal.c:3179
PVOID WINAPI SHLockShared(HANDLE hShared, DWORD dwProcId)
Definition: ordinal.c:259
HRESULT WINAPI SHInvokeCommand(HWND, IShellFolder *, LPCITEMIDLIST, DWORD)
Definition: ordinal.c:3752
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:5501
DWORD WINAPI SHRestrictionLookup(DWORD policy, LPCWSTR initial, LPPOLICYDATA polTable, LPDWORD polArr)
Definition: ordinal.c:2930
BOOL WINAPI ShellExecuteExWrapW(LPSHELLEXECUTEINFOW lpExecInfo)
Definition: ordinal.c:3601
#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:3123
HRESULT WINAPI IUnknown_SetOwner(IUnknown *iface, IUnknown *pUnk)
Definition: ordinal.c:1385
HRESULT WINAPI SHGetInverseCMAP(LPDWORD dest, DWORD dwSize)
Definition: ordinal.c:4627
HRESULT WINAPI IUnknown_GetSite(LPUNKNOWN lpUnknown, REFIID iid, PVOID *lppSite)
Definition: ordinal.c:2761
#define OBJCOMPAT_NOTAFILESYSTEM
Definition: ordinal.c:6424
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:3988
#define OBJCOMPAT_PINDLL
Definition: ordinal.c:6422
HRESULT WINAPI IUnknown_GetWindow(IUnknown *lpUnknown, HWND *lphWnd)
Definition: ordinal.c:1336
BOOL WINAPI GetOpenFileNameWrapW(LPOPENFILENAMEW ofn)
Definition: ordinal.c:3980
VOID WINAPI FixSlashesAndColonW(LPWSTR lpwstr)
Definition: ordinal.c:4718
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:4945
#define OBJCOMPAT_UNBINDABLE
Definition: ordinal.c:6421
HICON WINAPI ExtractIconWrapW(HINSTANCE hInstance, LPCWSTR lpszExeFileName, UINT nIconIndex)
Definition: ordinal.c:3811
#define OBJCOMPAT_NEEDSSTORAGEANCESTOR
Definition: ordinal.c:6428
DWORD WINAPI SHLoadFromPropertyBag(IUnknown *lpUnknown, IPropertyBag *lpPropBag)
Definition: ordinal.c:1864
HRESULT(WINAPI * DllGetVersion_func)(DLLVERSIONINFO *)
Definition: ordinal.c:5092
DWORD WINAPI GetFileVersionInfoSizeWrapW(LPCWSTR filename, LPDWORD handle)
Definition: ordinal.c:3630
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:5051
HRESULT WINAPIV SHPackDispParams(DISPPARAMS *params, VARIANTARG *args, UINT cnt,...)
Definition: ordinal.c:3246
BOOL WINAPI SHSkipJunction(IBindCtx *pbc, const CLSID *pclsid)
Definition: ordinal.c:4762
struct SHELL_USER_SID SHELL_USER_SID
static const struct objcompat_entry objcompat_table[]
Definition: ordinal.c:6440
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:3264
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:4971
#define OBJCOMPAT_NO_WEBVIEW
Definition: ordinal.c:6420
HRESULT WINAPI IConnectionPoint_SimpleInvoke(IConnectionPoint *iCP, DISPID dispId, DISPPARAMS *dispParams)
Definition: ordinal.c:3327
UINT WINAPI ZoneComputePaneSize(HWND hwnd)
Definition: ordinal.c:5201
COLORREF WINAPI ColorAdjustLuma(COLORREF cRGB, int dwLuma, BOOL bUnknown)
Definition: ordinal.c:3905
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:3949
static WORD ConvertHue(int wHue, WORD wMid1, WORD wMid2)
Definition: ordinal.c:4006
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:3939
UINT WINAPI DragQueryFileWrapW(HDROP hDrop, UINT lFile, LPWSTR lpszFile, UINT lLength)
Definition: ordinal.c:3571
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:4789
HRESULT WINAPI SKSetValueW(DWORD flags, LPCWSTR subkey, LPCWSTR value, DWORD type, void *data, DWORD count)
Definition: ordinal.c:5073
#define OBJCOMPAT_COCREATESHELLFOLDERONLY
Definition: ordinal.c:6427
#define IsIface(type)
Definition: ordinal.c:3657
PSECURITY_DESCRIPTOR WINAPI GetShellSecurityDescriptor(const PSHELL_USER_PERMISSION *apUserPerm, int cUserPerm)
Definition: ordinal.c:5247
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:5581
INT WINAPI ZoneCheckUrlExW(LPWSTR szURL, PVOID pUnknown, DWORD dwUnknown2, DWORD dwUnknown3, DWORD dwUnknown4, DWORD dwUnknown5, DWORD dwUnknown6, DWORD dwUnknown7)
Definition: ordinal.c:5535
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:5210
void WINAPI SHUnregisterClassesA(HINSTANCE hInst, LPCSTR *lppClasses, INT iCount)
Definition: ordinal.c:2702
LPITEMIDLIST WINAPI SHBrowseForFolderWrapW(LPBROWSEINFOW lpBi)
Definition: ordinal.c:3581
BOOL WINAPI SHGetNewLinkInfoWrapW(LPCWSTR pszLinkTo, LPCWSTR pszDir, LPWSTR pszName, BOOL *pfMustCopy, UINT uFlags)
Definition: ordinal.c:3712
BOOL WINAPI GetFileVersionInfoWrapW(LPCWSTR filename, DWORD handle, DWORD datasize, LPVOID data)
Definition: ordinal.c:3640
INT WINAPI SHVerbExistsNA(LPSTR verb, PVOID pUnknown, PVOID pUnknown2, DWORD dwUnknown3)
Definition: ordinal.c:5558
HMODULE WINAPI MLLoadLibraryA(LPCSTR new_mod, HMODULE inst_hwnd, DWORD dwCrossCodePage)
Definition: ordinal.c:3831
DWORD WINAPI SHMenuIndexFromID(HMENU hMenu, UINT uID)
Definition: ordinal.c:4708
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:3970
HRESULT WINAPI SHGetViewStatePropertyBag(LPCITEMIDLIST pidl, LPWSTR bag_name, DWORD flags, REFIID riid, void **ppv)
Definition: ordinal.c:5410
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:4489
HRESULT WINAPI IUnknown_SetSite(IUnknown *obj, IUnknown *site)
Definition: ordinal.c:1411
DWORD WINAPI MLSetMLHInstance(HINSTANCE hInst, HANDLE hHeap)
Definition: ordinal.c:4158
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:4929
HRESULT WINAPI IConnectionPoint_OnChanged(IConnectionPoint *lpCP, DISPID dispID)
Definition: ordinal.c:3360
HRESULT WINAPI SHPropertyBag_ReadLONG(IPropertyBag *ppb, LPCWSTR pszPropName, LPLONG pValue)
Definition: ordinal.c:5789
HRESULT WINAPI SKDeleteValueW(DWORD flags, LPCWSTR subkey, LPCWSTR value)
Definition: ordinal.c:5031
DWORD WINAPI SHWinHelpOnDemandA(HWND hwnd, LPCSTR helpfile, DWORD flags1, VOID *ptr1, DWORD flags2)
Definition: ordinal.c:4109
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:30
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 int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
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
GLenum target
Definition: glext.h:7315
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
__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(buf, format,...)
Definition: sprintf.c:55
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
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:202
static HMODULE dll
Definition: str.c:188
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:63
static SHCONTF
Definition: ordinal.c:64
_shellkey_flags
Definition: ordinal.c:2803
@ SHKEY_Subkey_Handlers
Definition: ordinal.c:2812
@ SHKEY_Root_HKLM
Definition: ordinal.c:2805
@ SHKEY_Key_ShellNoRoam
Definition: ordinal.c:2808
@ SHKEY_Subkey_Volatile
Definition: ordinal.c:2814
@ SHKEY_Subkey_Associations
Definition: ordinal.c:2813
@ SHKEY_Key_Classes
Definition: ordinal.c:2809
@ SHKEY_Subkey_MUICache
Definition: ordinal.c:2815
@ SHKEY_Key_Explorer
Definition: ordinal.c:2806
@ SHKEY_Root_HKCU
Definition: ordinal.c:2804
@ SHKEY_Subkey_FileExts
Definition: ordinal.c:2816
@ SHKEY_Key_Shell
Definition: ordinal.c:2807
@ SHKEY_Subkey_Default
Definition: ordinal.c:2810
@ SHKEY_Subkey_ResourceName
Definition: ordinal.c:2811
static VARIANTARG static DISPID
Definition: ordinal.c:52
INTERNETFEATURELIST feature
Definition: misc.c:1719
WCHAR strW[12]
Definition: clipboard.c:2029
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
REFCLSID clsid
Definition: msctf.c:82
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
static LPUNKNOWN
Definition: ndr_ole.c:49
#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:1041
#define KEY_READ
Definition: nt_native.h:1023
#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:317
#define UNALIGNED
Definition: pecoff.h:227
#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 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
const WCHAR * str
#define REG_DWORD
Definition: sdbapi.c:596
#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
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197
strcat
Definition: string.h:92
strcpy
Definition: string.h:131
#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_ 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:2552
int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
Definition: shlfileop.cpp:2200
HRESULT hr
Definition: shlfolder.c:183
#define IInputObjectSite_Release(p)
Definition: shlobj.h:743
#define IInputObject_TranslateAcceleratorIO(p, a)
Definition: shlobj.h:723
#define IInputObject_HasFocusIO(p)
Definition: shlobj.h:722
#define IQueryInfo_Release(p)
Definition: shlobj.h:694
#define IInputObject_Release(p)
Definition: shlobj.h:719
#define IQueryInfo_GetInfoFlags(p, a)
Definition: shlobj.h:697
#define IInputObjectSite_OnFocusChangeIS(p, a, b)
Definition: shlobj.h:745
#define IInputObject_UIActivateIO(p, a, b)
Definition: shlobj.h:721
#define OS_WIN2000TERMINAL
Definition: shlwapi.h:2084
#define OS_WIN98_GOLD
Definition: shlwapi.h:2078
#define OS_APPLIANCE
Definition: shlwapi.h:2108
#define OS_WIN95ORGREATER
Definition: shlwapi.h:2074
#define OS_MEDIACENTER
Definition: shlwapi.h:2107
#define OS_WIN95_GOLD
Definition: shlwapi.h:2088
#define FDTF_SHORTTIME
Definition: shlwapi.h:2117
#define OS_WIN2000ORGREATER_ALT
Definition: shlwapi.h:2076
#define OS_SMALLBUSINESSSERVER
Definition: shlwapi.h:2104
#define TPS_EXECUTEIO
Definition: shlwapi.h:2113
#define OS_WIN98ORGREATER
Definition: shlwapi.h:2077
#define OS_NT
Definition: shlwapi.h:2073
#define OS_MEORGREATER
Definition: shlwapi.h:2089
#define OS_WIN2000ADVSERVER
Definition: shlwapi.h:2082
#define OS_XPORGREATER
Definition: shlwapi.h:2090
#define STIF_SUPPORT_HEX
Definition: shlwapi.h:1498
#define OS_WIN2000ORGREATER
Definition: shlwapi.h:2079
#define FDTF_LONGDATE
Definition: shlwapi.h:2120
#define TPS_LONGEXECTIME
Definition: shlwapi.h:2114
#define OS_WIN2000PRO
Definition: shlwapi.h:2080
#define OS_WIN2000SERVER
Definition: shlwapi.h:2081
#define OS_TERMINALSERVER
Definition: shlwapi.h:2096
#define OS_SERVERADMINUI
Definition: shlwapi.h:2106
#define OS_PROFESSIONAL
Definition: shlwapi.h:2092
#define OS_WOW6432
Definition: shlwapi.h:2102
#define OS_TERMINALCLIENT
Definition: shlwapi.h:2086
#define OS_DOMAINMEMBER
Definition: shlwapi.h:2100
#define FDTF_DEFAULT
Definition: shlwapi.h:2119
#define OS_WIN32SORGREATER
Definition: shlwapi.h:2072
#define OS_WIN2000DATACENTER
Definition: shlwapi.h:2083
#define OS_NT4ORGREATER
Definition: shlwapi.h:2075
#define OS_TABLETPC
Definition: shlwapi.h:2105
#define OS_ADVSERVER
Definition: shlwapi.h:2094
#define OS_EMBEDDED
Definition: shlwapi.h:2085
#define OS_SERVER
Definition: shlwapi.h:2095
#define OS_TERMINALREMOTEADMIN
Definition: shlwapi.h:2087
#define FDTF_LONGTIME
Definition: shlwapi.h:2121
#define OS_FASTUSERSWITCHING
Definition: shlwapi.h:2098
#define OS_PERSONALTERMINALSERVER
Definition: shlwapi.h:2097
#define OS_WELCOMELOGONUI
Definition: shlwapi.h:2099
#define OS_HOME
Definition: shlwapi.h:2091
#define OS_ANYSERVER
Definition: shlwapi.h:2101
#define OS_DATACENTER
Definition: shlwapi.h:2093
#define OS_WEBSERVER
Definition: shlwapi.h:2103
struct _DllVersionInfo DLLVERSIONINFO
#define FDTF_SHORTDATE
Definition: shlwapi.h:2118
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
const IID * piid
Definition: shlwapi.h:2130
DWORD dwOffset
Definition: shlwapi.h:2132
SHELL_USER_SID susID
Definition: ordinal.c:5222
DWORD dwUserID
Definition: ordinal.c:5218
DWORD dwUserGroupID
Definition: ordinal.c:5217
SID_IDENTIFIER_AUTHORITY sidAuthority
Definition: ordinal.c:5216
DWORD dwMajorVersion
Definition: shlwapi.h:2011
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:330
LONG x
Definition: windef.h:329
HBRUSH hbrBackground
Definition: winuser.h:3246
HICON hIcon
Definition: winuser.h:3244
HINSTANCE hInstance
Definition: winuser.h:3243
HCURSOR hCursor
Definition: winuser.h:3245
int cbWndExtra
Definition: winuser.h:3242
UINT style
Definition: winuser.h:3239
LPCSTR lpszMenuName
Definition: winuser.h:3247
LPCSTR lpszClassName
Definition: winuser.h:3248
WNDPROC lpfnWndProc
Definition: winuser.h:3240
int cbClsExtra
Definition: winuser.h:3241
LPCWSTR lpszClassName
Definition: winuser.h:3261
LPCWSTR lpszMenuName
Definition: winuser.h:3260
HBRUSH hbrBackground
Definition: winuser.h:3259
HICON hIcon
Definition: winuser.h:3257
HINSTANCE hInstance
Definition: winuser.h:3256
int cbClsExtra
Definition: winuser.h:3254
UINT style
Definition: winuser.h:3252
WNDPROC lpfnWndProc
Definition: winuser.h:3253
int cbWndExtra
Definition: winuser.h:3255
HCURSOR hCursor
Definition: winuser.h:3258
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:6434
DWORD value
Definition: ordinal.c:6436
Definition: ps.c:97
DWORD cbSize
Definition: winuser.h:3860
SHORT y
Definition: windef.h:343
SHORT x
Definition: windef.h:342
DWORD policy
Definition: ordinal.c:2836
LPCWSTR keystr
Definition: ordinal.c:2838
LPCWSTR appstr
Definition: ordinal.c:2837
#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
uint16_t * LPWORD
Definition: typedefs.h:56
int32_t * LPLONG
Definition: typedefs.h:58
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:162
#define DOCKINFO_DOCKED
Definition: winbase.h:280
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:454
#define FILE_MAP_ALL_ACCESS
Definition: winbase.h:164
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1158
#define CopyMemory
Definition: winbase.h:1751
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:452
#define DOCKINFO_UNDOCKED
Definition: winbase.h:279
DWORD(WINAPI * LPTHREAD_START_ROUTINE)(LPVOID)
Definition: winbase.h:764
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD dwTimeout
Definition: wincrypt.h:6081
_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
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3749
LONG_PTR LPARAM
Definition: windef.h:208
#define __ms_va_list
Definition: windef.h:456
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define __ms_va_end(list)
Definition: windef.h:458
#define __ms_va_start(list, arg)
Definition: windef.h:457
DWORD COLORREF
Definition: windef.h:300
CONST void * LPCVOID
Definition: windef.h:191
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
#define FACILITY_NULL
Definition: winerror.h:22
#define S_FALSE
Definition: winerror.h:2357
#define E_NOT_SUFFICIENT_BUFFER
Definition: winerror.h:2345
#define E_NOINTERFACE
Definition: winerror.h:2364
#define DISP_E_BADVARTYPE
Definition: winerror.h:2517
#define DRAGDROP_E_NOTREGISTERED
Definition: winerror.h:2652
#define SEVERITY_SUCCESS
Definition: winerror.h:64
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define E_POINTER
Definition: winerror.h:2365
#define HRESULT_CODE(hr)
Definition: winerror.h:76
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:1199
#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:1066
#define WT_EXECUTELONGFUNCTION
Definition: winnt_old.h:1070
#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:5430
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:2442
BOOL WINAPI EnumChildWindows(_In_opt_ HWND, _In_ WNDENUMPROC, _In_ LPARAM)
#define WM_GETFONT
Definition: winuser.h:1670
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:1591
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:1590
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:1669
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:2982
BOOL WINAPI GetClassInfoW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _Out_ LPWNDCLASSW)
#define SetWindowLongPtrW
Definition: winuser.h:5431
#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:2427
#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
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
char CHAR
Definition: xmlstorage.h:175
unsigned char BYTE
Definition: xxhash.c:193