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