ReactOS 0.4.16-dev-975-g3b8cfa4
COpenWithMenu.cpp
Go to the documentation of this file.
1/*
2 * Open With Context Menu extension
3 *
4 * Copyright 2007 Johannes Anderwald <johannes.anderwald@reactos.org>
5 * Copyright 2009 Andrew Hill
6 * Copyright 2012 Rafal Harabien
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 "precomp.h"
24
26
27//
28// [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system]
29// "NoInternetOpenWith"=dword:00000001
30//
31
33
35{
36 SIZE_T count = 0;
37 WCHAR stop = ' ';
38 if (pszIn[0] == '"')
39 stop = *(pszIn++);
40
41 for (LPCWSTR pwszSrc = pszIn; *pwszSrc && *pwszSrc != stop; ++pwszSrc)
42 {
43 if (++count >= cchMax)
44 return 0;
45 *(pszOut++) = *pwszSrc;
46 }
47 *pszOut = UNICODE_NULL;
48 return count;
49}
50
52{
53 WCHAR szDll[MAX_PATH + 100];
54 if (!PathGetAppFromCommandLine(pszCmd, szDll, _countof(szDll)))
56
57 PWSTR pszName = PathFindFileNameW(szDll);
58 if (_wcsicmp(pszName, L"rundll32") && _wcsicmp(pszName, L"rundll32.exe"))
59 return E_UNEXPECTED;
60
61 PCWSTR pszDllStart = pszCmd + (pszName - szDll) + lstrlenW(pszName);
62
63 if (*pszDllStart == '\"')
64 ++pszDllStart; // Skip possible end quote of ..\rundll32.exe" foo.dll,func
65 while (*pszDllStart <= ' ' && *pszDllStart)
66 ++pszDllStart;
67 if (PathGetAppFromCommandLine(pszDllStart, szDll, _countof(szDll)))
68 {
69 BOOL quoted = *pszDllStart == '\"';
70 PWSTR pszComma = szDll + lstrlenW(szDll);
71 while (!quoted && pszComma > szDll && *pszComma != ',' && *pszComma != '\\' && *pszComma != '/')
72 --pszComma;
73 SIZE_T cch = pszComma - szDll;
74 if (cch <= cchMax && (quoted || *pszComma == ','))
75 {
76 *pszComma = UNICODE_NULL;
77 lstrcpynW(pszOut, szDll, cchMax);
78 return S_OK;
79 }
80 }
82}
83
85{
86 public:
87 struct SApp
88 {
91 //WCHAR wszManufacturer[256];
97 };
98
101
102 BOOL Load();
103 SApp *Add(LPCWSTR pwszPath);
104 static BOOL SaveApp(SApp *pApp);
105 SApp *Find(LPCWSTR pwszFilename);
106 static LPCWSTR GetName(SApp *pApp);
107 static HICON GetIcon(SApp *pApp);
108 static BOOL Execute(SApp *pApp, LPCWSTR pwszFilePath);
109 static BOOL IsHidden(SApp *pApp);
110 inline BOOL IsNoOpen(VOID) { return m_bNoOpen; }
111 BOOL LoadRecommended(LPCWSTR pwszFilePath);
112 BOOL SetDefaultHandler(SApp *pApp, LPCWSTR pwszFilename);
113
114 inline SApp *GetList() { return m_pApp; }
115 inline UINT GetCount() { return m_cApp; }
117
118 private:
119 typedef struct _LANGANDCODEPAGE
120 {
124
128
129 SApp *AddInternal(LPCWSTR pwszFilename);
130 static BOOL LoadInfo(SApp *pApp);
131 static BOOL GetPathFromCmd(LPWSTR pwszAppPath, LPCWSTR pwszCmd);
133 static HANDLE OpenMRUList(HKEY hKey);
139 static BOOL AddAppToMRUList(SApp *pApp, LPCWSTR pwszFilename);
140
142 {
143 if (!pApp->bRecommended)
145 pApp->bRecommended = TRUE;
146 }
147};
148
150 m_pApp(NULL), m_cApp(0), m_cRecommended(0), m_bNoOpen(FALSE) {}
151
153{
154 for (UINT i = 0; i < m_cApp; ++i)
155 if (m_pApp[i].hIcon)
157
159}
160
162{
163 HKEY hKey, hKeyApp;
164 WCHAR wszName[256], wszBuf[100];
165 DWORD i = 0, cchName, dwSize;
166 SApp *pApp;
167
168 if (RegOpenKeyEx(HKEY_CLASSES_ROOT, L"Applications", 0, KEY_READ, &hKey) != ERROR_SUCCESS)
169 {
170 ERR("RegOpenKeyEx HKCR\\Applications failed!\n");
171 return FALSE;
172 }
173
174 while (TRUE)
175 {
176 cchName = _countof(wszName);
177 if (RegEnumKeyEx(hKey, i++, wszName, &cchName, NULL, NULL, NULL, NULL) != ERROR_SUCCESS)
178 break;
179
180 pApp = AddInternal(wszName);
181
182 if (pApp)
183 {
184 if (RegOpenKeyW(hKey, wszName, &hKeyApp) == ERROR_SUCCESS)
185 {
186 if ((RegQueryValueExW(hKeyApp, L"NoOpenWith", NULL, NULL, NULL, NULL) != ERROR_SUCCESS) &&
187 (RegQueryValueExW(hKeyApp, L"NoStartPage", NULL, NULL, NULL, NULL) != ERROR_SUCCESS))
188 {
189 StringCbPrintfW(wszBuf, sizeof(wszBuf), L"%s\\shell\\open\\command", wszName);
190 dwSize = sizeof(pApp->wszCmd);
191 if (RegGetValueW(hKey, wszBuf, L"", RRF_RT_REG_SZ, NULL, pApp->wszCmd, &dwSize) != ERROR_SUCCESS)
192 {
193 ERR("Failed to add app %ls\n", wszName);
194 pApp->bHidden = TRUE;
195 }
196 else
197 {
198 TRACE("App added %ls\n", pApp->wszCmd);
199 }
200 }
201 else
202 {
203 pApp->bHidden = TRUE;
204 }
205 RegCloseKey(hKeyApp);
206 }
207 else
208 {
209 pApp->bHidden = TRUE;
210 }
211 }
212 else
213 {
214 ERR("AddInternal failed\n");
215 }
216 }
217
219 return TRUE;
220}
221
223{
224 SApp *pApp = AddInternal(PathFindFileNameW(pwszPath));
225
226 if (pApp)
227 {
228 StringCbPrintfW(pApp->wszCmd, sizeof(pApp->wszCmd), L"\"%s\" \"%%1\"", pwszPath);
229 SaveApp(pApp);
230 }
231
232 return pApp;
233}
234
236{
237 WCHAR wszBuf[256];
238 HKEY hKey;
239
240 StringCbPrintfW(wszBuf, sizeof(wszBuf), L"Applications\\%s\\shell\\open\\command", pApp->wszFilename);
242 {
243 ERR("RegOpenKeyEx failed\n");
244 return FALSE;
245 }
246
247 if (RegSetValueEx(hKey, L"", 0, REG_SZ, (PBYTE)pApp->wszCmd, (wcslen(pApp->wszCmd)+1)*sizeof(WCHAR)) != ERROR_SUCCESS)
248 ERR("Cannot add app to registry\n");
249
251 return TRUE;
252}
253
255{
256 for (UINT i = 0; i < m_cApp; ++i)
257 if (_wcsicmp(m_pApp[i].wszFilename, pwszFilename) == 0)
258 return &m_pApp[i];
259 return NULL;
260}
261
263{
264 if (!pApp->wszName[0])
265 {
266 if (!LoadInfo(pApp))
267 {
268 WARN("Failed to load %ls info\n", pApp->wszFilename);
269 StringCbCopyW(pApp->wszName, sizeof(pApp->wszName), pApp->wszFilename);
270
271 WCHAR wszPath[MAX_PATH];
272 if (!GetPathFromCmd(wszPath, pApp->wszCmd))
273 {
274 return NULL;
275 }
276 }
277 }
278
279 TRACE("%ls name: %ls\n", pApp->wszFilename, pApp->wszName);
280 return pApp->wszName;
281}
282
284{
285 if (!pApp->hIcon)
286 {
287 WCHAR wszPath[MAX_PATH];
288
289 GetPathFromCmd(wszPath, pApp->wszCmd);
290 if (!ExtractIconExW(wszPath, 0, NULL, &pApp->hIcon, 1))
291 {
292 SHFILEINFO fi;
293 /* FIXME: Ideally we should include SHGFI_USEFILEATTRIBUTES because we already
294 ** know the file has no icons but SHGetFileInfo is broken in that case (CORE-19122).
295 ** Without SHGFI_USEFILEATTRIBUTES we needlessly hit the disk again but it will
296 ** return the correct default .exe icon.
297 */
298 SHGetFileInfoW(wszPath, 0, &fi, sizeof(fi), SHGFI_ICON|SHGFI_SMALLICON|SHGFI_SHELLICONSIZE);
299 pApp->hIcon = fi.hIcon;
300 }
301 }
302
303 TRACE("%ls icon: %p\n", pApp->wszFilename, pApp->hIcon);
304
305 return pApp->hIcon;
306}
307
309{
310 WCHAR wszBuf[256];
311 HKEY hKey;
312
313 /* Add app to registry if it wasnt there before */
314 SaveApp(pApp);
315 if (!pApp->bMRUList)
316 AddAppToMRUList(pApp, pwszFilePath);
317
318 /* Get a handle to the reg key */
319 StringCbPrintfW(wszBuf, sizeof(wszBuf), L"Applications\\%s", pApp->wszFilename);
321 {
322 ERR("RegOpenKeyEx failed\n");
323 return FALSE;
324 }
325
326 /* Let ShellExecuteExW do the work */
328 sei.nShow = SW_SHOWNORMAL;
329 sei.hkeyClass = hKey;
330 sei.lpFile = pwszFilePath;
331
332 ShellExecuteExW(&sei);
333
334 return TRUE;
335}
336
338{
339 WCHAR wszBuf[100];
340 DWORD dwSize = 0;
341
342 if (pApp->bHidden)
343 return pApp->bHidden;
344
345 if (FAILED(StringCbPrintfW(wszBuf, sizeof(wszBuf), L"Applications\\%s", pApp->wszFilename)))
346 {
347 ERR("insufficient buffer\n");
348 return FALSE;
349 }
350
351 if (RegGetValueW(HKEY_CLASSES_ROOT, wszBuf, L"NoOpenWith", RRF_RT_REG_SZ, NULL, NULL, &dwSize) != ERROR_SUCCESS)
352 return FALSE;
353
354 pApp->bHidden = TRUE;
355 return TRUE;
356}
357
359{
360 /* Check for duplicate */
361 SApp *pApp = Find(pwszFilename);
362 if (pApp)
363 return pApp;
364
365 /* Create new item */
366 if (!m_pApp)
367 m_pApp = static_cast<SApp *>(HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(m_pApp[0])));
368 else
369 m_pApp = static_cast<SApp *>(HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, m_pApp, (m_cApp + 1)*sizeof(m_pApp[0])));
370 if (!m_pApp)
371 {
372 ERR("Allocation failed\n");
373 return NULL;
374 }
375
376 pApp = &m_pApp[m_cApp++];
377 wcscpy(pApp->wszFilename, pwszFilename);
378 return pApp;
379}
380
382{
383 UINT cbSize, cchLen;
384 LPVOID pBuf;
385 WORD wLang = 0, wCode = 0;
386 LPLANGANDCODEPAGE lpLangCode;
387 WCHAR wszBuf[100];
388 WCHAR *pResult;
389 WCHAR wszPath[MAX_PATH];
391
392 GetPathFromCmd(wszPath, pApp->wszCmd);
393 TRACE("LoadInfo %ls\n", wszPath);
394
395 /* query version info size */
396 cbSize = GetFileVersionInfoSizeW(wszPath, NULL);
397 if (!cbSize)
398 {
399 ERR("GetFileVersionInfoSizeW %ls failed: %lu\n", wszPath, GetLastError());
400 return FALSE;
401 }
402
403 /* allocate buffer */
404 pBuf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cbSize + 200);
405 if (!pBuf)
406 {
407 ERR("HeapAlloc failed\n");
408 return FALSE;
409 }
410
411 /* query version info */
412 if (!GetFileVersionInfoW(wszPath, 0, cbSize, pBuf))
413 {
414 ERR("GetFileVersionInfoW %ls failed: %lu\n", wszPath, GetLastError());
415 HeapFree(GetProcessHeap(), 0, pBuf);
416 return FALSE;
417 }
418
419 /* query lang code */
420 if (VerQueryValueW(pBuf, L"VarFileInfo\\Translation", (LPVOID*)&lpLangCode, &cbSize))
421 {
422 /* FIXME: find language from current locale / if not available,
423 * default to english
424 * for now default to first available language
425 */
426 wLang = lpLangCode->lang;
427 wCode = lpLangCode->code;
428 }
429
430 /* Query name */
431 swprintf(wszBuf, L"\\StringFileInfo\\%04x%04x\\FileDescription", wLang, wCode);
432 success = VerQueryValueW(pBuf, wszBuf, (LPVOID *)&pResult, &cchLen) && (cchLen > 1);
433 if (success)
434 StringCchCopyNW(pApp->wszName, _countof(pApp->wszName), pResult, cchLen);
435 else
436 ERR("Cannot get app name\n");
437
438 /* Query manufacturer */
439 /*swprintf(wszBuf, L"\\StringFileInfo\\%04x%04x\\CompanyName", wLang, wCode);
440
441 if (VerQueryValueW(pBuf, wszBuf, (LPVOID *)&pResult, &cchLen))
442 StringCchCopyNW(pApp->wszManufacturer, _countof(pApp->wszManufacturer), pResult, cchLen);*/
443 HeapFree(GetProcessHeap(), 0, pBuf);
444 return success;
445}
446
448{
449 WCHAR wszBuf[MAX_PATH];
450
451 /* Remove arguments */
452 if (!PathGetAppFromCommandLine(pwszCmd, wszBuf, _countof(wszBuf)))
453 return FALSE;
454
455 /* Replace rundll32.exe with the dll path */
456 SHELL32_GetDllFromRundll32CommandLine(pwszCmd, wszBuf, _countof(wszBuf));
457
458 /* Expand env. vars and optionally search for path */
459 ExpandEnvironmentStrings(wszBuf, pwszAppPath, MAX_PATH);
460 if (!PathFileExists(pwszAppPath))
461 {
462 UINT cch = SearchPathW(NULL, pwszAppPath, NULL, MAX_PATH, pwszAppPath, NULL);
463 if (!cch || cch >= MAX_PATH)
464 return FALSE;
465 }
466 return TRUE;
467}
468
470{
471 LPCWSTR pwszExt;
472
473 pwszExt = PathFindExtensionW(pwszFilePath);
474 if (!pwszExt[0])
475 return FALSE;
476
477 /* load programs directly associated from HKCU */
479
480 /* load programs associated from HKCR\Extension */
482
483 return TRUE;
484}
485
487{
488 HKEY hSubkey, hSubkey2;
489 WCHAR wszProgId[256];
490 DWORD i = 0, cchProgId;
491
492 if (RegOpenKeyExW(hKey, L"OpenWithProgIDs", 0, KEY_READ, &hSubkey) != ERROR_SUCCESS)
493 return FALSE;
494
495 while (TRUE)
496 {
497 /* Enumerate values - value name is ProgId */
498 cchProgId = _countof(wszProgId);
499 if (RegEnumValue(hSubkey, i++, wszProgId, &cchProgId, NULL, NULL, NULL, NULL) != ERROR_SUCCESS)
500 break;
501
502 /* If ProgId exists load it */
503 if (RegOpenKeyExW(HKEY_CLASSES_ROOT, wszProgId, 0, KEY_READ, &hSubkey2) == ERROR_SUCCESS)
504 {
505 LoadFromProgIdKey(hSubkey2, pwszExt);
506 RegCloseKey(hSubkey2);
507 }
508 }
509
510 RegCloseKey(hSubkey);
511 return TRUE;
512}
513
515{
517
518 /* Initialize mru list info */
519 Info.cbSize = sizeof(Info);
520 Info.uMax = 32;
521 Info.fFlags = MRU_STRING;
522 Info.hKey = hKey;
523 Info.lpszSubKey = L"OpenWithList";
524 Info.lpfnCompare = NULL;
525
526 return CreateMRUListW(&Info);
527}
528
530{
532 int nItem, nCount, nResult;
533 WCHAR wszAppFilename[MAX_PATH];
534
535 /* Open MRU list */
537 if (!hList)
538 {
539 TRACE("OpenMRUList failed\n");
540 return FALSE;
541 }
542
543 /* Get list count */
544 nCount = EnumMRUListW(hList, -1, NULL, 0);
545
546 for(nItem = 0; nItem < nCount; nItem++)
547 {
548 nResult = EnumMRUListW(hList, nItem, wszAppFilename, _countof(wszAppFilename));
549 if (nResult <= 0)
550 continue;
551
552 /* Insert item */
553 SApp *pApp = Find(wszAppFilename);
554
555 TRACE("Recommended app %ls: %p\n", wszAppFilename, pApp);
556 if (pApp)
557 {
558 pApp->bMRUList = TRUE;
559 SetRecommended(pApp);
560 }
561 }
562
563 /* Free the MRU list */
565 return TRUE;
566}
567
569{
570 WCHAR wszAppFilename[MAX_PATH];
571 HKEY hSubkey;
572 DWORD i = 0, cchAppFilename;
573
574 if (RegOpenKeyExW(hKey, L"OpenWithList", 0, KEY_READ, &hSubkey) != ERROR_SUCCESS)
575 return FALSE;
576
577 while (TRUE)
578 {
579 /* Enum registry keys - each of them is app name */
580 cchAppFilename = _countof(wszAppFilename);
581 if (RegEnumKeyExW(hSubkey, i++, wszAppFilename, &cchAppFilename, NULL, NULL, NULL, NULL) != ERROR_SUCCESS)
582 break;
583
584 /* Set application as recommended */
585 SApp *pApp = Find(wszAppFilename);
586
587 TRACE("Recommended app %ls: %p\n", wszAppFilename, pApp);
588 if (pApp)
589 SetRecommended(pApp);
590 }
591
592 RegCloseKey(hSubkey);
593 return TRUE;
594}
595
597{
598 WCHAR wszCmd[MAX_PATH], wszPath[MAX_PATH];
599 DWORD dwSize = 0;
600
601 /* Check if NoOpen value exists */
603 {
604 /* Display warning dialog */
605 m_bNoOpen = TRUE;
606 }
607
608 /* Check if there is a directly available execute key */
609 dwSize = sizeof(wszCmd);
610 if (RegGetValueW(hKey, L"shell\\open\\command", NULL, RRF_RT_REG_SZ, NULL, (PVOID)wszCmd, &dwSize) == ERROR_SUCCESS)
611 {
612 /* Erase extra arguments */
613 GetPathFromCmd(wszPath, wszCmd);
614
615 /* Add application */
616 SApp *pApp = AddInternal(PathFindFileNameW(wszPath));
617 TRACE("Add app %ls: %p\n", wszPath, pApp);
618
619 if (pApp)
620 {
621 StringCbCopyW(pApp->wszCmd, sizeof(pApp->wszCmd), wszCmd);
622 SetRecommended(pApp);
623 }
624 }
625}
626
628{
629 HKEY hKey, hSubkey;
630 WCHAR wszBuf[MAX_PATH], wszBuf2[MAX_PATH];
632
633 /* Check if extension exists */
635 {
636 /* Load items from SystemFileAssociations\Ext key */
637 StringCbPrintfW(wszBuf, sizeof(wszBuf), L"SystemFileAssociations\\%s", pwszExt);
639 return;
640 }
641
642 /* Load programs referenced from HKCR\ProgId */
643 dwSize = sizeof(wszBuf);
644 if (RegGetValueW(hKey, NULL, L"", RRF_RT_REG_SZ, NULL, wszBuf, &dwSize) == ERROR_SUCCESS &&
645 RegOpenKeyExW(HKEY_CLASSES_ROOT, wszBuf, 0, KEY_READ, &hSubkey) == ERROR_SUCCESS)
646 {
647 LoadFromProgIdKey(hSubkey, pwszExt);
648 RegCloseKey(hSubkey);
649 }
650 else
651 LoadFromProgIdKey(hKey, pwszExt);
652
653 /* Load items from HKCR\Ext\OpenWithList */
655
656 /* Load items from HKCR\Ext\OpenWithProgIDs */
657 if (RegOpenKeyExW(hKey, L"OpenWithProgIDs", 0, KEY_READ, &hSubkey) == ERROR_SUCCESS)
658 {
659 LoadProgIdList(hSubkey, pwszExt);
660 RegCloseKey(hSubkey);
661 }
662
663 /* Load additional items from referenced PerceivedType */
664 dwSize = sizeof(wszBuf);
665 if (RegGetValueW(hKey, NULL, L"PerceivedType", RRF_RT_REG_SZ, NULL, wszBuf, &dwSize) == ERROR_SUCCESS)
666 {
667 StringCbPrintfW(wszBuf2, sizeof(wszBuf2), L"SystemFileAssociations\\%s", wszBuf);
668 if (RegOpenKeyExW(HKEY_CLASSES_ROOT, wszBuf2, 0, KEY_READ | KEY_WRITE, &hSubkey) == ERROR_SUCCESS)
669 {
670 /* Load from OpenWithList key */
671 LoadAppList(hSubkey);
672 RegCloseKey(hSubkey);
673 }
674 }
675
676 /* Close the key */
678}
679
681{
682 WCHAR wszBuf[MAX_PATH];
683 HKEY hKey;
684
685 StringCbPrintfW(wszBuf, sizeof(wszBuf),
686 L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\%s",
687 pwszExt);
689 {
690 /* Load MRU and ProgId lists */
692 LoadProgIdList(hKey, pwszExt);
693
694 /* Handle "Application" value */
695 DWORD cbBuf = sizeof(wszBuf);
696 if (RegGetValueW(hKey, NULL, L"Application", RRF_RT_REG_SZ, NULL, wszBuf, &cbBuf) == ERROR_SUCCESS)
697 {
698 SApp *pApp = Find(wszBuf);
699 if (pApp)
700 SetRecommended(pApp);
701 }
702
703 /* Close the key */
705 }
706}
707
709{
710 WCHAR wszBuf[100];
711 LPCWSTR pwszExt;
712 HKEY hKey;
714
715 /* Get file extension */
716 pwszExt = PathFindExtensionW(pwszFilename);
717 if (!pwszExt[0])
718 return FALSE;
719
720 /* Build registry key */
721 if (FAILED(StringCbPrintfW(wszBuf, sizeof(wszBuf),
722 L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\%s",
723 pwszExt)))
724 {
725 ERR("insufficient buffer\n");
726 return FALSE;
727 }
728
729 /* Open base key for this file extension */
731 return FALSE;
732
733 /* Open MRU list */
735 if (hList)
736 {
737 /* Insert the entry */
739
740 /* Set MRU presence */
741 pApp->bMRUList = TRUE;
742
743 /* Close MRU list */
745 }
746
748 return TRUE;
749}
750
752{
753 HKEY hKey, hSrcKey, hDestKey;
754 WCHAR wszBuf[256];
755
756 TRACE("SetDefaultHandler %ls %ls\n", pApp->wszFilename, pwszFilename);
757
758 /* Extract file extension */
759 LPCWSTR pwszExt = PathFindExtensionW(pwszFilename);
760 if (!pwszExt[0] || !pwszExt[1])
761 return FALSE;
762
763 /* Create file extension key */
765 {
766 ERR("Can't open ext key\n");
767 return FALSE;
768 }
769
770 DWORD dwSize = sizeof(wszBuf);
771 LONG lResult = RegGetValueW(hKey, NULL, L"", RRF_RT_REG_SZ, NULL, wszBuf, &dwSize);
772
773 if (lResult == ERROR_FILE_NOT_FOUND)
774 {
775 /* A new entry was created or the default key is not set: set the prog key id */
776 StringCbPrintfW(wszBuf, sizeof(wszBuf), L"%s_auto_file", pwszExt + 1);
777 if (RegSetValueExW(hKey, L"", 0, REG_SZ, (const BYTE*)wszBuf, (wcslen(wszBuf) + 1) * sizeof(WCHAR)) != ERROR_SUCCESS)
778 {
780 ERR("RegSetValueExW failed\n");
781 return FALSE;
782 }
783 }
784 else if (lResult != ERROR_SUCCESS)
785 {
787 ERR("RegGetValueExW failed: 0x%08x\n", lResult);
788 return FALSE;
789 }
790
791 /* Close file extension key */
793
794 /* Create prog id key */
796 {
797 ERR("RegCreateKeyExW failed\n");
798 return FALSE;
799 }
800
801 /* Check if there already verbs existing for that app */
802 StringCbPrintfW(wszBuf, sizeof(wszBuf), L"Applications\\%s\\shell", pApp->wszFilename);
803 if (RegOpenKeyExW(HKEY_CLASSES_ROOT, wszBuf, 0, KEY_READ, &hSrcKey) != ERROR_SUCCESS)
804 {
805 ERR("RegOpenKeyExW %ls failed\n", wszBuf);
807 return FALSE;
808 }
809
810 /* Open destination key */
811 if (RegCreateKeyExW(hKey, L"shell", 0, NULL, 0, KEY_WRITE, NULL, &hDestKey, NULL) != ERROR_SUCCESS)
812 {
813 ERR("RegCreateKeyExW failed\n");
814 RegCloseKey(hSrcKey);
816 return FALSE;
817 }
818
819 /* Copy static verbs from Classes\Applications key */
820 /* FIXME: SHCopyKey does not copy the security attributes of the keys */
821 /* FIXME: Windows does not actually copy the verb keys */
822 /* FIXME: Should probably delete any existing DelegateExecute/DropTarget/DDE verb information first */
823 LSTATUS Result = SHCopyKeyW(hSrcKey, NULL, hDestKey, 0);
824#ifdef __REACTOS__
825 // FIXME: When OpenWith is used to set a new default on Windows, the FileExts key
826 // is changed to force this association. ROS does not support this. The best
827 // we can do is to try to set the verb we (incorrectly) copied as the new default.
828 HKEY hAppKey;
829 StringCbPrintfW(wszBuf, sizeof(wszBuf), L"Applications\\%s", pApp->wszFilename);
830 if (Result == ERROR_SUCCESS && !RegOpenKeyExW(HKEY_CLASSES_ROOT, wszBuf, 0, KEY_READ, &hAppKey))
831 {
832 if (HCR_GetDefaultVerbW(hAppKey, NULL, wszBuf, _countof(wszBuf)) && *wszBuf)
833 RegSetString(hDestKey, NULL, wszBuf, REG_SZ);
834 RegCloseKey(hAppKey);
835 }
836#endif // __REACTOS__
837 RegCloseKey(hDestKey);
838 RegCloseKey(hSrcKey);
840
841 if (Result != ERROR_SUCCESS)
842 {
843 ERR("SHCopyKeyW failed\n");
844 return FALSE;
845 }
846
847 return TRUE;
848}
849
851{
852 public:
853 COpenWithDialog(const OPENASINFO *pInfo, COpenWithList *pAppList);
855 static INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
857
858 private:
860 VOID AddApp(COpenWithList::SApp *pApp, BOOL bSelected);
861 VOID Browse();
862 VOID Accept();
865
874};
875
877 m_pInfo(pInfo), m_pAppList(pAppList), m_hImgList(NULL), m_bNoOpen(FALSE)
878{
879 if (!m_pAppList)
880 {
883 }
884 else
886}
887
889{
891 delete m_pAppList;
892 if (m_hImgList)
894}
895
897{
898 switch(Message)
899 {
900 case WM_INITDIALOG:
901 {
902 return TRUE;
903 }
904 case WM_CLOSE:
906 break;
907 case WM_COMMAND:
908 switch(LOWORD(wParam))
909 {
910 case IDYES:
912 break;
913 case IDNO:
915 break;
916 }
917 break;
918 default:
919 return FALSE;
920 }
921 return TRUE;
922}
923
925{
926 /* Only do the actual check if the file type has the 'NoOpen' flag. */
927 if (m_bNoOpen)
928 {
930
931 if (dReturnValue == IDNO)
932 return TRUE;
933 else if (dReturnValue == -1)
934 {
935 ERR("IsNoOpen failed to load dialog box\n");
936 return TRUE;
937 }
938 }
939
940 return FALSE;
941}
942
944{
945 LPCWSTR pwszName = m_pAppList->GetName(pApp);
946 if (!pwszName) return;
947 HICON hIcon = m_pAppList->GetIcon(pApp);
948
949 TRACE("AddApp Cmd %ls Name %ls\n", pApp->wszCmd, pwszName);
950
951 /* Add item to the list */
952 TVINSERTSTRUCT tvins;
953
954 if (pApp->bRecommended)
955 tvins.hParent = tvins.hInsertAfter = m_hRecommend;
956 else
957 tvins.hParent = tvins.hInsertAfter = m_hOther;
958
959 tvins.item.mask = TVIF_TEXT|TVIF_PARAM;
960 tvins.item.pszText = const_cast<LPWSTR>(pwszName);
961 tvins.item.lParam = (LPARAM)pApp;
962
963 if (hIcon)
964 {
965 tvins.item.mask |= TVIF_IMAGE | TVIF_SELECTEDIMAGE;
966 tvins.item.iImage = tvins.item.iSelectedImage = ImageList_AddIcon(m_hImgList, hIcon);
967 }
968
970
971 if (bSelected)
973}
974
976{
977 WCHAR wszTitle[64];
978 WCHAR wszFilter[256];
979 WCHAR wszPath[MAX_PATH];
981
982 /* Initialize OPENFILENAMEW structure */
983 ZeroMemory(&ofn, sizeof(OPENFILENAMEW));
984 ofn.lStructSize = sizeof(OPENFILENAMEW);
988 ofn.nMaxFile = (sizeof(wszPath) / sizeof(WCHAR));
989 ofn.lpstrFile = wszPath;
990 ofn.lpstrInitialDir = L"%programfiles%";
991
992 /* Init title */
993 if (LoadStringW(shell32_hInstance, IDS_OPEN_WITH, wszTitle, sizeof(wszTitle) / sizeof(WCHAR)))
994 {
995 ofn.lpstrTitle = wszTitle;
996 ofn.nMaxFileTitle = wcslen(wszTitle);
997 }
998
999 /* Init the filter string */
1002 ZeroMemory(wszPath, sizeof(wszPath));
1003
1004 /* Create OpenFile dialog */
1005 if (!GetOpenFileNameW(&ofn))
1006 return;
1007
1008 /* Setup context for insert proc */
1009 COpenWithList::SApp *pApp = m_pAppList->Add(wszPath);
1010 AddApp(pApp, TRUE);
1011}
1012
1014{
1015 TVITEM tvi;
1017 if (!tvi.hItem)
1018 return NULL;
1019
1020 tvi.mask = TVIF_PARAM;
1021 if (!TreeView_GetItem(m_hTreeView, &tvi))
1022 return NULL;
1023
1024 return (COpenWithList::SApp*)tvi.lParam;
1025}
1026
1028{
1029 TRACE("COpenWithDialog::Init hwnd %p\n", hwnd);
1030
1031 m_hDialog = hwnd;
1033
1034 /* Handle register checkbox */
1035 HWND hRegisterCheckbox = GetDlgItem(hwnd, 14003);
1037 EnableWindow(hRegisterCheckbox, FALSE);
1039 SendMessage(hRegisterCheckbox, BM_SETCHECK, BST_CHECKED, 0);
1041 ShowWindow(hRegisterCheckbox, SW_HIDE);
1042
1043 if (m_pInfo->pcszFile)
1044 {
1045 WCHAR wszBuf[MAX_PATH];
1046 UINT cchBuf;
1047
1048 /* Add filename to label */
1049 cchBuf = GetDlgItemTextW(hwnd, 14001, wszBuf, _countof(wszBuf));
1050 StringCchCopyW(wszBuf + cchBuf, _countof(wszBuf) - cchBuf, PathFindFileNameW(m_pInfo->pcszFile));
1051 SetDlgItemTextW(hwnd, 14001, wszBuf);
1052
1053 /* Load applications from registry */
1054 m_pAppList->Load();
1056
1057 /* Determine if the type of file can be opened directly from the shell */
1058 if (m_pAppList->IsNoOpen() != FALSE)
1059 m_bNoOpen = TRUE;
1060
1061 /* Init treeview */
1062 m_hTreeView = GetDlgItem(hwnd, 14002);
1065
1066 /* If there are some recommendations add parent nodes: Recommended and Others */
1067 UINT cRecommended = m_pAppList->GetRecommendedCount();
1068 if (cRecommended > 0)
1069 {
1070 TVINSERTSTRUCT tvins;
1071 HICON hFolderIcon;
1072
1073 tvins.hParent = tvins.hInsertAfter = TVI_ROOT;
1075 tvins.item.pszText = (LPWSTR)wszBuf;
1076 tvins.item.state = tvins.item.stateMask = TVIS_EXPANDED;
1078 tvins.item.iImage = tvins.item.iSelectedImage = ImageList_AddIcon(m_hImgList, hFolderIcon);
1079
1082
1085 }
1086 else
1088
1089 /* Add all applications */
1090 BOOL bNoAppSelected = TRUE;
1091 COpenWithList::SApp *pAppList = m_pAppList->GetList();
1092 for (UINT i = 0; i < m_pAppList->GetCount(); ++i)
1093 {
1094 if (!COpenWithList::IsHidden(&pAppList[i]))
1095 {
1096 if (bNoAppSelected && (pAppList[i].bRecommended || !cRecommended))
1097 {
1098 AddApp(&pAppList[i], TRUE);
1099 bNoAppSelected = FALSE;
1100 }
1101 else
1102 AddApp(&pAppList[i], FALSE);
1103 }
1104 }
1105 }
1106}
1107
1109{
1111 if (pApp)
1112 {
1113 /* Set programm as default handler */
1115 {
1117 // FIXME: Update DefaultIcon registry
1119 }
1120
1121 /* Execute program */
1124
1125 EndDialog(m_hDialog, 1);
1126 }
1127}
1128
1130{
1131 COpenWithDialog *pThis = reinterpret_cast<COpenWithDialog *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
1132
1133 switch(uMsg)
1134 {
1135 case WM_INITDIALOG:
1136 {
1137 COpenWithDialog *pThis = reinterpret_cast<COpenWithDialog *>(lParam);
1138
1139 pThis->Init(hwndDlg);
1140 return TRUE;
1141 }
1142 case WM_COMMAND:
1143 switch(LOWORD(wParam))
1144 {
1145 case 14004: /* browse */
1146 {
1147 pThis->Browse();
1148 return TRUE;
1149 }
1150 case IDOK: /* ok */
1151 {
1152 pThis->Accept();
1153 return TRUE;
1154 }
1155 case IDCANCEL: /* cancel */
1156 EndDialog(hwndDlg, 0);
1157 return TRUE;
1158 default:
1159 break;
1160 }
1161 break;
1162 case WM_NOTIFY:
1163 switch (((LPNMHDR)lParam)->code)
1164 {
1165 case TVN_SELCHANGED:
1166 EnableWindow(GetDlgItem(hwndDlg, IDOK), pThis->GetCurrentApp() ? TRUE : FALSE);
1167 break;
1168 case NM_DBLCLK:
1169 case NM_RETURN:
1170 pThis->Accept();
1171 break;
1172 }
1173 break;
1174 case WM_CLOSE:
1175 EndDialog(hwndDlg, 0);
1176 return TRUE;
1177 default:
1178 break;
1179 }
1180 return FALSE;
1181}
1182
1184{
1185 m_idCmdFirst = 0;
1186 m_idCmdLast = 0;
1188}
1189
1191{
1192 TRACE("Destroying COpenWithMenu(%p)\n", this);
1193
1194 if (m_hSubMenu)
1195 {
1196 INT Count, Index;
1197 MENUITEMINFOW mii;
1198
1199 /* get item count */
1201 if (Count == -1)
1202 return;
1203
1204 /* setup menuitem info */
1205 ZeroMemory(&mii, sizeof(mii));
1206 mii.cbSize = sizeof(mii);
1208
1209 for(Index = 0; Index < Count; Index++)
1210 {
1212 {
1213 if (mii.hbmpChecked)
1215 }
1216 }
1217 }
1218
1219 if (m_pAppList)
1220 delete m_pAppList;
1221}
1222
1224{
1225 HDC hdc, hdcScr;
1226 HBITMAP hbm, hbmOld;
1227 RECT rc;
1228
1229 hdcScr = GetDC(NULL);
1230 hdc = CreateCompatibleDC(hdcScr);
1232 hbm = CreateCompatibleBitmap(hdcScr, rc.right, rc.bottom);
1233 ReleaseDC(NULL, hdcScr);
1234
1235 hbmOld = (HBITMAP)SelectObject(hdc, hbm);
1236 FillRect(hdc, &rc, (HBRUSH)(COLOR_MENU + 1));
1237 if (!DrawIconEx(hdc, 0, 0, hIcon, rc.right, rc.bottom, 0, NULL, DI_NORMAL))
1238 ERR("DrawIcon failed: %x\n", GetLastError());
1239 SelectObject(hdc, hbmOld);
1240
1241 DeleteDC(hdc);
1242
1243 return hbm;
1244}
1245
1247{
1248 MENUITEMINFOW mii;
1249 WCHAR wszBuf[128];
1250
1251 ZeroMemory(&mii, sizeof(mii));
1252 mii.cbSize = sizeof(mii);
1253 mii.fMask = MIIM_TYPE | MIIM_ID;
1254 mii.fType = MFT_SEPARATOR;
1255 mii.wID = -1;
1256 InsertMenuItemW(m_hSubMenu, -1, TRUE, &mii);
1257
1259 {
1260 ERR("Failed to load string\n");
1261 return;
1262 }
1263
1265 mii.fType = MFT_STRING;
1266 mii.fState = MFS_ENABLED;
1267 mii.wID = m_idCmdLast;
1268 mii.dwTypeData = (LPWSTR)wszBuf;
1269 mii.cch = wcslen(wszBuf);
1270
1271 InsertMenuItemW(m_hSubMenu, -1, TRUE, &mii);
1272}
1273
1275{
1276 MENUITEMINFOW mii;
1277 LPCWSTR pwszName = m_pAppList->GetName((COpenWithList::SApp*)pApp);
1278 if (!pwszName) return;
1279
1280 ZeroMemory(&mii, sizeof(mii));
1281 mii.cbSize = sizeof(mii);
1283 mii.fType = MFT_STRING;
1284 mii.fState = MFS_ENABLED;
1285 mii.wID = m_idCmdLast;
1286 mii.dwTypeData = const_cast<LPWSTR>(pwszName);
1287 mii.dwItemData = (ULONG_PTR)pApp;
1288
1290 if (hIcon)
1291 {
1292 mii.fMask |= MIIM_CHECKMARKS;
1294 }
1295
1296 if (InsertMenuItemW(m_hSubMenu, -1, TRUE, &mii))
1297 m_idCmdLast++;
1298}
1299
1300static const CMVERBMAP g_VerbMap[] =
1301{
1302 { "openas", 0 },
1303 { NULL }
1304};
1305
1307 HMENU hMenu,
1308 UINT indexMenu,
1309 UINT idCmdFirst,
1310 UINT idCmdLast,
1311 UINT uFlags)
1312{
1313 TRACE("hMenu %p indexMenu %u idFirst %u idLast %u uFlags %u\n", hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
1314
1315 INT DefaultPos = GetMenuDefaultItem(hMenu, TRUE, 0);
1316
1317 WCHAR wszName[100];
1318 UINT NameId = (DefaultPos == -1 ? IDS_OPEN : IDS_OPEN_WITH);
1319 if (!LoadStringW(shell32_hInstance, NameId, wszName, _countof(wszName)))
1320 {
1321 ERR("Failed to load string\n");
1322 return E_FAIL;
1323 }
1324
1325 /* Init first cmd id and submenu */
1326 m_idCmdFirst = m_idCmdLast = idCmdFirst;
1327 m_hSubMenu = NULL;
1328
1329 /* We can only be a submenu if we are not the default */
1330 if (DefaultPos != -1)
1331 {
1332 /* Load applications list */
1333 m_pAppList->Load();
1335
1336 /* Create submenu only if there is more than one application and menu has a default item */
1338 {
1340
1341 for(UINT i = 0; i < m_pAppList->GetCount(); ++i)
1342 {
1344 if (pApp->bRecommended)
1345 AddApp(pApp);
1346 }
1347
1349 }
1350 }
1351
1352 /* Insert menu item */
1353 MENUITEMINFOW mii;
1354 ZeroMemory(&mii, sizeof(mii));
1355 mii.cbSize = sizeof(mii);
1357 if (m_hSubMenu)
1358 {
1359 mii.fMask |= MIIM_SUBMENU;
1360 mii.hSubMenu = m_hSubMenu;
1361 mii.wID = -1;
1362 }
1363 else
1364 mii.wID = m_idCmdLast;
1365
1366 mii.fType = MFT_STRING;
1367 mii.dwTypeData = (LPWSTR)wszName;
1368 mii.fState = MFS_ENABLED;
1369 if (DefaultPos == -1)
1370 {
1371 mii.fState |= MFS_DEFAULT;
1372 indexMenu = 0;
1373 }
1374
1375 if (!InsertMenuItemW(hMenu, indexMenu, TRUE, &mii))
1376 return E_FAIL;
1377
1379}
1380
1383{
1384 const SIZE_T idChooseApp = m_idCmdLast;
1385 HRESULT hr = E_FAIL;
1386
1387 TRACE("This %p idFirst %u idLast %u idCmd %u\n", this, m_idCmdFirst, m_idCmdLast, m_idCmdFirst + LOWORD(lpici->lpVerb));
1388
1390 goto DoChooseApp;
1391
1392 if (IS_INTRESOURCE(lpici->lpVerb) && m_idCmdFirst + LOWORD(lpici->lpVerb) <= m_idCmdLast)
1393 {
1394 if (m_idCmdFirst + LOWORD(lpici->lpVerb) == idChooseApp)
1395 {
1396DoChooseApp:
1399
1400 info.pcszFile = m_wszPath;
1401 info.oaifInFlags = OAIF_EXEC;
1402 if (pwszExt[0])
1404 info.pcszClass = NULL;
1405 hr = SHOpenWithDialog(lpici->hwnd, &info);
1406 }
1407 else
1408 {
1409 /* retrieve menu item info */
1410 MENUITEMINFOW mii;
1411 ZeroMemory(&mii, sizeof(mii));
1412 mii.cbSize = sizeof(mii);
1413 mii.fMask = MIIM_DATA | MIIM_FTYPE;
1414
1415 if (GetMenuItemInfoW(m_hSubMenu, LOWORD(lpici->lpVerb), TRUE, &mii) && mii.dwItemData)
1416 {
1417 /* launch item with specified app */
1420 hr = S_OK;
1421 }
1422 }
1423 }
1424
1425 return hr;
1426}
1427
1430 UINT* pwReserved, LPSTR pszName, UINT cchMax )
1431{
1432 TRACE("%p %lu %u %p %p %u\n", this,
1433 idCmd, uType, pwReserved, pszName, cchMax );
1434
1435 const SIZE_T idChooseApp = m_idCmdLast;
1436 if (m_idCmdFirst + idCmd == idChooseApp)
1437 return SHELL_GetCommandStringImpl(0, uType, pszName, cchMax, g_VerbMap);
1438
1439 return E_NOTIMPL;
1440}
1441
1443 UINT uMsg,
1444 WPARAM wParam,
1445 LPARAM lParam)
1446{
1447 TRACE("This %p uMsg %x\n", this, uMsg);
1448
1449 return E_NOTIMPL;
1450}
1451
1454 IDataObject *pdtobj,
1455 HKEY hkeyProgID)
1456{
1457 LPCITEMIDLIST pidlFolder2;
1458 LPCITEMIDLIST pidlChild;
1459
1460 TRACE("This %p\n", this);
1461
1462 if (pdtobj == NULL)
1463 return E_INVALIDARG;
1464
1465 CDataObjectHIDA pida(pdtobj);
1466 if (FAILED(pida.hr()))
1467 {
1468 ERR("pdtobj->GetData failed with 0x%x\n", pida.hr());
1469 return pida.hr();
1470 }
1471
1472 ASSERT(pida->cidl >= 1);
1473
1474 pidlFolder2 = HIDA_GetPIDLFolder(pida);
1475 pidlChild = HIDA_GetPIDLItem(pida, 0);
1476
1477 if (!_ILIsValue(pidlChild))
1478 {
1479 TRACE("pidl is not a file\n");
1480 return E_FAIL;
1481 }
1482
1483 CComHeapPtr<ITEMIDLIST> pidl(ILCombine(pidlFolder2, pidlChild));
1484 if (!pidl)
1485 {
1486 ERR("no mem\n");
1487 return E_OUTOFMEMORY;
1488 }
1489
1490 if (!SHGetPathFromIDListW(pidl, m_wszPath))
1491 {
1492 ERR("SHGetPathFromIDListW failed\n");
1493 return E_FAIL;
1494 }
1495
1496 TRACE("szPath %s\n", debugstr_w(m_wszPath));
1497
1499 if (PathIsExeW(pwszExt) || !_wcsicmp(pwszExt, L".lnk"))
1500 {
1501 TRACE("file is a executable or shortcut\n");
1502 return E_FAIL;
1503 }
1504
1505 return S_OK;
1506}
1507
1510{
1511 INT_PTR ret;
1512
1513 TRACE("SHOpenWithDialog hwndParent %p poainfo %p\n", hwndParent, poainfo);
1514
1516
1517 if (poainfo->pcszClass == NULL && poainfo->pcszFile == NULL)
1518 return E_FAIL;
1519
1520 COpenWithDialog pDialog(poainfo);
1521
1522 if (pDialog.IsNoOpen(hwndParent))
1523 return S_OK;
1524
1527
1528 if (ret == (INT_PTR)-1)
1529 {
1530 ERR("Failed to create dialog: %u\n", GetLastError());
1531 return E_FAIL;
1532 }
1533
1534 return S_OK;
1535}
static const CMVERBMAP g_VerbMap[]
HRESULT WINAPI SHOpenWithDialog(HWND hwndParent, const OPENASINFO *poainfo)
EXTERN_C BOOL PathIsExeW(LPCWSTR lpszPath)
Definition: shellpath.c:539
static SIZE_T PathGetAppFromCommandLine(LPCWSTR pszIn, LPWSTR pszOut, SIZE_T cchMax)
static const CMVERBMAP g_VerbMap[]
HRESULT SHELL32_GetDllFromRundll32CommandLine(LPCWSTR pszCmd, LPWSTR pszOut, SIZE_T cchMax)
#define shell32_hInstance
UINT cchMax
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define IDS_OPEN
Definition: resource.h:18
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
static WCHAR wszFilter[MAX_STRING_LEN *4+6 *3+5]
Definition: wordpad.c:72
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
#define EXTERN_C
Definition: basetyps.h:12
#define RegCloseKey(hKey)
Definition: registry.h:49
EXTERN_C void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
COpenWithList * m_pAppList
VOID AddApp(COpenWithList::SApp *pApp, BOOL bSelected)
static INT_PTR CALLBACK NoOpenDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
HTREEITEM m_hRecommend
COpenWithList::SApp * GetCurrentApp()
HIMAGELIST m_hImgList
VOID Init(HWND hwnd)
BOOL IsNoOpen(HWND hwnd)
COpenWithDialog(const OPENASINFO *pInfo, COpenWithList *pAppList)
static INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
const OPENASINFO * m_pInfo
struct COpenWithList::_LANGANDCODEPAGE * LPLANGANDCODEPAGE
static BOOL SaveApp(SApp *pApp)
SApp * Find(LPCWSTR pwszFilename)
BOOL LoadRecommended(LPCWSTR pwszFilePath)
static LPCWSTR GetName(SApp *pApp)
BOOL LoadAppList(HKEY hKey)
static BOOL Execute(SApp *pApp, LPCWSTR pwszFilePath)
BOOL IsNoOpen(VOID)
static BOOL GetPathFromCmd(LPWSTR pwszAppPath, LPCWSTR pwszCmd)
static BOOL LoadInfo(SApp *pApp)
VOID LoadRecommendedFromHKCR(LPCWSTR pwszExt)
UINT GetRecommendedCount()
static HICON GetIcon(SApp *pApp)
SApp * Add(LPCWSTR pwszPath)
BOOL SetDefaultHandler(SApp *pApp, LPCWSTR pwszFilename)
struct COpenWithList::_LANGANDCODEPAGE LANGANDCODEPAGE
VOID LoadRecommendedFromHKCU(LPCWSTR pwszExt)
static BOOL AddAppToMRUList(SApp *pApp, LPCWSTR pwszFilename)
SApp * AddInternal(LPCWSTR pwszFilename)
VOID SetRecommended(SApp *pApp)
static BOOL IsHidden(SApp *pApp)
static HANDLE OpenMRUList(HKEY hKey)
VOID LoadFromProgIdKey(HKEY hKey, LPCWSTR pwszExt)
BOOL LoadMRUList(HKEY hKey)
BOOL LoadProgIdList(HKEY hKey, LPCWSTR pwszExt)
COpenWithList * m_pAppList
Definition: COpenWithMenu.h:38
VOID AddChooseProgramItem()
STDMETHOD() GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen) override
HBITMAP IconToBitmap(HICON hIcon)
VOID AddApp(PVOID pApp)
STDMETHOD() Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID) override
WCHAR m_wszPath[MAX_PATH]
Definition: COpenWithMenu.h:36
STDMETHOD() QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override
STDMETHOD() HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam) override
STDMETHOD() InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi) override
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
INT WINAPI AddMRUStringW(HANDLE hList, LPCWSTR lpszString)
INT WINAPI EnumMRUListW(HANDLE hList, INT nItemPos, LPVOID lpBuffer, DWORD nBufferSize)
HANDLE WINAPI CreateMRUListW(const MRUINFOW *infoW)
void WINAPI FreeMRUList(HANDLE hMRUList)
#define MRU_STRING
VOID WINAPI InitCommonControls(void)
Definition: commctrl.c:870
#define OFN_EXPLORER
Definition: commdlg.h:104
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
struct tagOFNW OPENFILENAMEW
wcscpy
static HWND hwndParent
Definition: cryptui.c:300
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define ERROR_SUCCESS
Definition: deptool.c:10
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
#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
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1931
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2504
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 RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
UINT uFlags
Definition: api.c:59
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:941
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:814
BOOL WINAPI GetOpenFileNameW(OPENFILENAMEW *ofn)
Definition: filedlg.c:4736
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapReAlloc
Definition: compat.h:734
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define lstrcpynW
Definition: compat.h:738
#define lstrlenW
Definition: compat.h:750
DWORD WINAPI SearchPathW(IN LPCWSTR lpPath OPTIONAL, IN LPCWSTR lpFileName, IN LPCWSTR lpExtension OPTIONAL, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart OPTIONAL)
Definition: path.c:1298
#define RRF_RT_REG_SZ
Definition: driver.c:575
HRESULT SHELL_GetCommandStringImpl(SIZE_T CmdId, UINT uFlags, LPSTR Buf, UINT cchBuf, const CMVERBMAP *pMap)
Definition: utils.cpp:1783
HRESULT SHELL_MapContextMenuVerbToCmdId(LPCMINVOKECOMMANDINFO pICI, const CMVERBMAP *pMap)
Definition: utils.cpp:1749
static DWORD RegSetString(HKEY hKey, LPCWSTR Name, LPCWSTR Str, DWORD Type OPTIONAL_(REG_SZ))
Definition: utils.h:67
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:394
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
DWORD WINAPI SHCopyKeyW(HKEY hKeySrc, LPCWSTR lpszSrcSubKey, HKEY hKeyDst, DWORD dwReserved)
Definition: reg.c:2261
BOOL WINAPI GetFileVersionInfoW(LPCWSTR filename, DWORD handle, DWORD datasize, LPVOID data)
Definition: version.c:845
BOOL WINAPI VerQueryValueW(LPCVOID pBlock, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen)
Definition: version.c:1057
DWORD WINAPI GetFileVersionInfoSizeW(LPCWSTR filename, LPDWORD handle)
Definition: version.c:611
#define swprintf
Definition: precomp.h:40
static const WCHAR Message[]
Definition: register.c:74
#define MAKE_HRESULT(sev, fac, code)
Definition: dmerror.h:30
#define ULONG_PTR
Definition: config.h:101
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
FxAutoRegKey hKey
pKey DeleteObject()
GLuint GLuint GLsizei count
Definition: gl.h:1545
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
UINT WINAPI ExtractIconExW(LPCWSTR lpszFile, INT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIcons)
Definition: iconcache.cpp:855
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_w
Definition: kernel32.h:32
#define REG_SZ
Definition: layer.c:22
HWND hList
Definition: livecd.c:10
#define ASSERT(a)
Definition: mode.c:44
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
static HICON
Definition: imagelist.c:80
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:202
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
HICON hIcon
Definition: msconfig.c:44
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
unsigned int UINT
Definition: ndis.h:50
int Count
Definition: noreturn.cpp:7
#define KEY_READ
Definition: nt_native.h:1023
#define KEY_WRITE
Definition: nt_native.h:1031
#define UNICODE_NULL
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
#define L(x)
Definition: ntvdm.h:50
#define MAKEINTRESOURCE(i)
Definition: ntverrsrc.c:25
#define LOWORD(l)
Definition: pedump.c:82
BYTE * PBYTE
Definition: pedump.c:66
long LONG
Definition: pedump.c:60
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:816
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1454
BOOL _ILIsValue(LPCITEMIDLIST pidl)
Definition: pidl.c:2109
#define TVITEM
Definition: commctrl.h:3370
#define TVN_SELCHANGED
Definition: commctrl.h:3740
#define TVIF_TEXT
Definition: commctrl.h:3271
#define TreeView_SelectItem(hwnd, hitem)
Definition: commctrl.h:3486
#define NM_DBLCLK
Definition: commctrl.h:131
#define TVINSERTSTRUCT
Definition: commctrl.h:3407
#define TVIF_IMAGE
Definition: commctrl.h:3272
#define TVSIL_NORMAL
Definition: commctrl.h:3448
#define ILC_COLOR32
Definition: commctrl.h:358
#define TreeView_GetSelection(hwnd)
Definition: commctrl.h:3478
#define TreeView_GetItem(hwnd, pitem)
Definition: commctrl.h:3495
#define TVI_ROOT
Definition: commctrl.h:3373
#define NM_RETURN
Definition: commctrl.h:132
#define TVIS_EXPANDED
Definition: commctrl.h:3289
#define ImageList_AddIcon(himl, hicon)
Definition: commctrl.h:415
#define ILC_MASK
Definition: commctrl.h:351
#define TVIF_PARAM
Definition: commctrl.h:3273
#define TreeView_SetImageList(hwnd, himl, iImage)
Definition: commctrl.h:3452
#define TreeView_InsertItem(hwnd, lpis)
Definition: commctrl.h:3417
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3276
#define TVIF_STATE
Definition: commctrl.h:3274
#define WM_NOTIFY
Definition: richedit.h:61
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
BOOL HCR_GetDefaultVerbW(HKEY hkeyClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len)
Definition: classes.c:152
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:430
#define SEE_MASK_CLASSKEY
Definition: shellapi.h:26
#define SHGFI_ICON
Definition: shellapi.h:165
struct _SHELLEXECUTEINFOW SHELLEXECUTEINFOW
#define SHGFI_SMALLICON
Definition: shellapi.h:177
#define SHGFI_SHELLICONSIZE
Definition: shellapi.h:180
static PCUIDLIST_RELATIVE HIDA_GetPIDLItem(CIDA const *pida, SIZE_T i)
Definition: shellutils.h:641
static PCUIDLIST_ABSOLUTE HIDA_GetPIDLFolder(CIDA const *pida)
Definition: shellutils.h:636
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2452
HRESULT hr
Definition: shlfolder.c:183
@ OAIF_EXEC
Definition: shlobj.h:2690
@ OAIF_REGISTER_EXT
Definition: shlobj.h:2689
@ OAIF_ALLOW_REGISTRATION
Definition: shlobj.h:2688
@ OAIF_HIDE_REGISTRATION
Definition: shlobj.h:2693
@ OAIF_FORCE_REGISTRATION
Definition: shlobj.h:2691
#define SHCNE_ASSOCCHANGED
Definition: shlobj.h:1919
#define SHCNF_FLUSHNOWAIT
Definition: shlobj.h:1937
#define PathFileExists
Definition: shlwapi.h:934
#define IDS_OPEN_WITH_FILTER
Definition: shresdef.h:146
#define IDD_OPEN_WITH
Definition: shresdef.h:544
#define IDS_OPEN_WITH_CHOOSE
Definition: shresdef.h:135
#define IDS_OPEN_WITH_RECOMMENDED
Definition: shresdef.h:192
#define IDI_SHELL_PROGRAMS_FOLDER
Definition: shresdef.h:598
#define IDD_NOOPEN
Definition: shresdef.h:547
#define IDS_OPEN_WITH
Definition: shresdef.h:134
#define IDS_OPEN_WITH_OTHER
Definition: shresdef.h:193
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
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
STRSAFEAPI StringCchCopyNW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:236
WCHAR wszFilename[MAX_PATH]
WCHAR wszCmd[MAX_PATH]
HICON hIcon
Definition: shellapi.h:366
Definition: inflate.c:139
ULONG_PTR dwItemData
Definition: winuser.h:3279
LPWSTR dwTypeData
Definition: winuser.h:3280
HBITMAP hbmpChecked
Definition: winuser.h:3277
HBITMAP hbmpUnchecked
Definition: winuser.h:3278
HWND hwndOwner
Definition: commdlg.h:330
LPCSTR lpstrTitle
Definition: commdlg.h:341
HINSTANCE hInstance
Definition: commdlg.h:331
LPSTR lpstrFile
Definition: commdlg.h:336
DWORD nMaxFileTitle
Definition: commdlg.h:339
DWORD Flags
Definition: commdlg.h:342
LPCSTR lpstrInitialDir
Definition: commdlg.h:340
DWORD lStructSize
Definition: commdlg.h:329
LPCSTR lpstrFilter
Definition: commdlg.h:332
DWORD nMaxFile
Definition: commdlg.h:337
LPCWSTR pcszFile
Definition: shlobj.h:2701
LPCWSTR pcszClass
Definition: shlobj.h:2702
OPEN_AS_INFO_FLAGS oaifInFlags
Definition: shlobj.h:2703
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
uint16_t * PWSTR
Definition: typedefs.h:56
int32_t INT_PTR
Definition: typedefs.h:64
const uint16_t * PCWSTR
Definition: typedefs.h:57
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
int ret
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_In_ WDFCOLLECTION _In_ ULONG Index
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
#define success(from, fromstr, to, tostr)
#define ZeroMemory
Definition: winbase.h:1743
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define ExpandEnvironmentStrings
Definition: winbase.h:3805
_In_ PSID _Out_writes_to_opt_ cchName LPSTR _Inout_ LPDWORD cchName
Definition: winbase.h:2798
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:185
#define SEVERITY_SUCCESS
Definition: winerror.h:64
#define E_UNEXPECTED
Definition: winerror.h:2456
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
#define DI_NORMAL
Definition: wingdi.h:72
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
BOOL WINAPI DeleteDC(_In_ HDC)
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define RegOpenKeyEx
Definition: winreg.h:520
#define RegSetValueEx
Definition: winreg.h:533
#define RegCreateKeyEx
Definition: winreg.h:501
#define RegEnumValue
Definition: winreg.h:511
#define RegEnumKeyEx
Definition: winreg.h:510
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define SW_SHOWNORMAL
Definition: winuser.h:781
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:838
#define SW_HIDE
Definition: winuser.h:779
UINT WINAPI GetMenuDefaultItem(_In_ HMENU hMenu, _In_ UINT fByPos, _In_ UINT gmdiFlags)
#define WM_CLOSE
Definition: winuser.h:1632
#define DWLP_USER
Definition: winuser.h:883
#define MIIM_ID
Definition: winuser.h:733
#define COLOR_MENU
Definition: winuser.h:928
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
#define IDCANCEL
Definition: winuser.h:842
#define IMAGE_ICON
Definition: winuser.h:212
#define SM_CXMENUCHECK
Definition: winuser.h:1042
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define MIIM_CHECKMARKS
Definition: winuser.h:735
#define WM_COMMAND
Definition: winuser.h:1751
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
#define MIIM_FTYPE
Definition: winuser.h:740
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define WM_INITDIALOG
Definition: winuser.h:1750
#define MFT_SEPARATOR
Definition: winuser.h:755
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:841
#define BM_SETCHECK
Definition: winuser.h:1932
#define MIIM_STATE
Definition: winuser.h:732
#define MFS_DEFAULT
Definition: winuser.h:759
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define SM_CYMENUCHECK
Definition: winuser.h:1043
#define MIIM_SUBMENU
Definition: winuser.h:734
BOOL WINAPI DrawIconEx(_In_ HDC, _In_ int, _In_ int, _In_ HICON, _In_ int, _In_ int, _In_ UINT, _In_opt_ HBRUSH, _In_ UINT)
Definition: cursoricon.c:2366
#define IDNO
Definition: winuser.h:847
#define SendMessage
Definition: winuser.h:5863
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HDC WINAPI GetDC(_In_opt_ HWND)
#define MFS_ENABLED
Definition: winuser.h:761
#define LoadImage
Definition: winuser.h:5835
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
#define MFT_STRING
Definition: winuser.h:757
#define IDYES
Definition: winuser.h:846
int WINAPI GetSystemMetrics(_In_ int)
#define MIIM_DATA
Definition: winuser.h:737
#define MIIM_TYPE
Definition: winuser.h:736
#define BST_CHECKED
Definition: winuser.h:197
BOOL WINAPI InsertMenuItemW(_In_ HMENU, _In_ UINT, _In_ BOOL, _In_ LPCMENUITEMINFOW)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
#define DialogBox
Definition: winuser.h:5781
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2391
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
unsigned char BYTE
Definition: xxhash.c:193