ReactOS 0.4.16-dev-980-g00983aa
filetypes.cpp
Go to the documentation of this file.
1/*
2 * 'File Types' tab property sheet of Folder Options
3 *
4 * Copyright 2007 Johannes Anderwald <johannes.anderwald@reactos.org>
5 * Copyright 2016-2018 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22#include "precomp.h"
23#include <atlpath.h>
24
26
27// rundll32.exe shell32.dll,Options_RunDLL 0
28
30
32
33#define FTA_MODIFYMASK (FTA_OpenIsSafe) // Bits modified by EditTypeDlg
34#define NOASSOCRESID IDI_SHELL_DOCUMENT
35#define SUPPORT_EXTENSIONWITHOUTPROGID 1 // NT5 does not support these but NT6 does
36
37#define ASSOC_CCHMAX (32 + 1) // Extension or protocol (INTERNET_MAX_SCHEME_LENGTH)
38#define TYPENAME_CCHMAX max(100, RTL_FIELD_SIZE(SHFILEINFOA, szTypeName))
39#define ICONLOCATION_CCHMAX (MAX_PATH + 1 + 11)
40
41typedef struct _FILE_TYPE_ENTRY
42{
52
53 bool IsExtension() const
54 {
55 return FileExtension[0] == '.';
56 }
58 {
59 return FileExtension + (FileExtension[0] == '.');
60 }
62 {
64 }
66 {
68 }
70 {
73 nIconIndex = 0;
76 }
78 {
79 if (hIconSmall)
82 }
84
85typedef struct _FILE_TYPE_GLOBALS
86{
96
97static DWORD
98GetRegDWORD(HKEY hKey, LPCWSTR Name, DWORD &Value, DWORD DefaultValue = 0, BOOL Strict = FALSE)
99{
100 DWORD cb = sizeof(DWORD), type;
101 LRESULT ec = RegQueryValueExW(hKey, Name, 0, &type, (BYTE*)&Value, &cb);
102 if (ec == ERROR_SUCCESS)
103 {
104 if ((type == REG_DWORD && cb == sizeof(DWORD)) ||
105 (!Strict && type == REG_BINARY && (cb && cb <= sizeof(DWORD))))
106 {
107 Value &= (0xffffffffUL >> (32 - cb * 8));
108 return ec;
109 }
110 }
111 Value = DefaultValue;
112 return ec ? ec : ERROR_BAD_FORMAT;
113}
114
115static DWORD
117{
118 GetRegDWORD(hKey, Name, DefaultValue, DefaultValue, FALSE);
119 return DefaultValue;
120}
121
122static HRESULT
124{
125 HRESULT hr = S_OK;
126 LPCWSTR path = FTE.IsExtension() ? FTE.ClassKey : FTE.FileExtension;
127#if SUPPORT_EXTENSIONWITHOUTPROGID
128 if (!*path && FTE.IsExtension())
129 {
130 path = FTE.FileExtension;
131 hr = S_FALSE;
132 }
133#endif
134 ASSERT(*path);
135 SubKey = path;
136 return hr;
137}
138
139static void
141{
142 if (path.Find(' ') >= 0 && path.Find('\"') < 0)
143 path = CStringW(L"\"") + path + L"\"";
144}
145
146static BOOL
147DeleteExt(HWND hwndDlg, LPCWSTR pszExt)
148{
149 if (*pszExt != L'.')
150 return FALSE;
151
152 // open ".ext" key
153 HKEY hKey;
155 return FALSE;
156
157 // query "extfile" key name
158 WCHAR ProgId[MAX_PATH] = { 0 };
159 DWORD cb = sizeof(ProgId);
160 RegQueryValueExW(hKey, NULL, NULL, NULL, LPBYTE(ProgId), &cb);
162
163 // FIXME: Should verify that no other extensions are using this ProgId
164 // delete "extfile" key (if any)
165 if (ProgId[0])
167
168 // delete ".ext" key
170
171 // notify
173
174 return ret;
175}
176
177static inline HICON
179{
180 return SHELL32_SHExtractIcon(IconPath, iIndex, cx, cy);
181}
182
183static HICON
185{
188 return DoExtractIcon(IconPath, iIndex, cx, cy);
189}
190
191static BOOL
193{
194 Entry->hIconSmall = NULL;
195 if (lstrcmpW(IconLocation, L"%1") == 0)
196 {
197 LPCWSTR ext = Entry->FileExtension;
198 if (!lstrcmpiW(ext, L".exe") || !lstrcmpiW(ext, L".scr"))
199 {
201 IMAGE_ICON, IconSize, IconSize, 0));
202 Entry->nIconIndex = -IDI_SHELL_EXE;
203 }
204 // Set the icon path to %1 on purpose so PickIconDlg will issue a warning
205 StringCbCopyW(Entry->IconPath, sizeof(Entry->IconPath), IconLocation);
206 }
207 else
208 {
209 // Expand the REG_EXPAND_SZ string by environment variables
210 if (ExpandEnvironmentStringsW(IconLocation, Entry->IconPath, _countof(Entry->IconPath)))
211 {
212 Entry->nIconIndex = PathParseIconLocationW(Entry->IconPath);
213 Entry->hIconSmall = DoExtractIcon(Entry->IconPath, Entry->nIconIndex, IconSize, IconSize);
214 }
215 }
216 return Entry->hIconSmall != NULL;
217}
218
219static BOOL
221{
222 Entry->hIconSmall = NULL;
223
224 HKEY hDefIconKey;
225 LONG nResult = RegOpenKeyExW(hKey, L"DefaultIcon", 0, KEY_READ, &hDefIconKey);
226 if (nResult != ERROR_SUCCESS)
227 return FALSE;
228
229 // Get the icon location
230 WCHAR szLocation[ICONLOCATION_CCHMAX];
231 DWORD dwSize = sizeof(szLocation);
232 nResult = RegQueryValueExW(hDefIconKey, NULL, NULL, NULL, LPBYTE(szLocation), &dwSize);
233 szLocation[_countof(szLocation) - 1] = UNICODE_NULL;
234
235 RegCloseKey(hDefIconKey);
236 if (nResult != ERROR_SUCCESS || !szLocation[0])
237 return FALSE;
238
239 return GetFileTypeIconsEx(Entry, szLocation, IconSize);
240}
241
242static LPCWSTR
244{
245 if (!Entry->ProgramPath[1] && !Entry->ProgramPath[0])
246 {
247 DWORD cch = _countof(Entry->ProgramPath);
249 Entry->FileExtension, NULL, Entry->ProgramPath, &cch)))
250 {
251 Entry->ProgramPath[0] = UNICODE_NULL;
252 Entry->ProgramPath[1] = TRUE;
253 }
254 }
255 return Entry->ProgramPath;
256}
257
258static BOOL
260{
261 SHFILEINFOW fi;
263 if (SHGetFileInfoW(ProgramPath, 0, &fi, sizeof(fi), SHGFI_DISPLAYNAME))
264 {
266 return TRUE;
267 }
268 return !!GetFileTitleW(ProgramPath, pszName, cchName);
269}
270
271static LPCWSTR
273{
274 if (!Entry->AppName[1] && !Entry->AppName[0])
275 {
277 if (!*exe || !QueryFileDescription(exe, Entry->AppName, _countof(Entry->AppName)))
278 {
279 Entry->AppName[0] = UNICODE_NULL;
280 Entry->AppName[1] = TRUE;
281 }
282 }
283 return Entry->AppName;
284}
285
286static LPWSTR
288{
289 if (!Entry->FileDescription[1] && !Entry->FileDescription[0])
290 {
291 Entry->FileDescription[1] = TRUE;
292 if (Entry->IsExtension())
293 {
294 SHFILEINFOW fi;
295 if (SHGetFileInfoW(Entry->FileExtension, 0, &fi, sizeof(fi), SHGFI_TYPENAME |
297 {
298 StringCchCopyW(Entry->FileDescription, _countof(Entry->FileDescription), fi.szTypeName);
299 }
300 }
301 else
302 {
303 // FIXME: Fix and use ASSOCSTR_FRIENDLYDOCNAME
304 DWORD cb = sizeof(Entry->FileDescription), Fallback = TRUE;
305 LPCWSTR ClassKey;
306 HRESULT hr = GetClassKey(*Entry, ClassKey);
307 HKEY hKey;
308 if (SUCCEEDED(hr) && !RegOpenKeyExW(HKEY_CLASSES_ROOT, ClassKey, 0, KEY_READ, &hKey))
309 {
310 Fallback = RegQueryValueExW(hKey, NULL, 0, NULL, (BYTE*)Entry->FileDescription, &cb) != ERROR_SUCCESS ||
311 !*Entry->FileDescription;
313 }
314 if (Fallback)
315 {
316 StringCchCopyW(Entry->FileDescription, _countof(Entry->FileDescription), Entry->FileExtension);
317 }
318 }
319 }
320 return Entry->FileDescription;
321}
322
323static void
325{
326 const INT ResId = NOASSOCRESID;
327 if (!pG->hDefExtIconSmall)
328 {
330 IMAGE_ICON, pG->IconSize, pG->IconSize, 0));
331 }
332
334 {
336 ASSERT(idx == 0);
338 }
339}
340
341static BOOL
343{
344 // We don't need this information until somebody tries to edit the entry
345 if (!Entry->IconPath[0])
346 {
347 StringCbCopyW(Entry->IconPath, sizeof(Entry->IconPath), g_pszShell32);
348 Entry->nIconIndex = NOASSOCRESID > 1 ? -NOASSOCRESID : 0;
349 }
350 return TRUE;
351}
352
354// EditTypeDlg
355
356#define LISTBOX_MARGIN 2
357
358enum EDITTYPEFLAGS { ETF_ALWAYSEXT = 1 << 0, ETF_BROWSESAME = 1 << 1 };
359
360typedef struct EDITTYPE_DIALOG
361{
373
374static void
376{
378 INT IconIndex = pEditType->nIconIndex;
380 if (PickIconDlg(hwndDlg, szPath, _countof(szPath), &IconIndex))
381 {
382 HICON hIconLarge = DoExtractIcon(szPath, IconIndex, FALSE);
383
384 // replace Windows directory with "%SystemRoot%" (for portability)
385 WCHAR szWinDir[MAX_PATH];
386 UINT lenWinDir = GetWindowsDirectoryW(szWinDir, _countof(szWinDir));
387 if (StrStrIW(szPath, szWinDir) == szPath)
388 {
389 CPathW str(L"%SystemRoot%");
390 str.Append(&szPath[lenWinDir]);
391 StringCbCopyW(szPath, sizeof(szPath), str);
392 }
393
394 // update EDITTYPE_DIALOG
395 StringCbCopyW(pEditType->szIconPath, sizeof(pEditType->szIconPath), szPath);
396 pEditType->nIconIndex = IconIndex;
397 pEditType->ChangedIcon = true;
398
399 // set icon to dialog
400 HICON hOld = (HICON)SendDlgItemMessageW(hwndDlg, IDC_EDITTYPE_ICON, STM_SETICON, (WPARAM)hIconLarge, 0);
401 if (hOld)
402 DestroyIcon(hOld);
403 }
404}
405
406static BOOL
408{
409 WCHAR szText[MAX_PATH];
410 HFONT hFont, hFont2;
411
412 if (!pDraw)
413 return FALSE;
414
415 // fill rect and set colors
416 if (pDraw->itemState & ODS_SELECTED)
417 {
418 FillRect(pDraw->hDC, &pDraw->rcItem, HBRUSH(COLOR_HIGHLIGHT + 1));
421 }
422 else
423 {
424 FillRect(pDraw->hDC, &pDraw->rcItem, HBRUSH(COLOR_WINDOW + 1));
427 }
428
429 // get listbox text
430 HWND hwndListBox = GetDlgItem(hwndDlg, IDC_EDITTYPE_LISTBOX);
431 SendMessageW(hwndListBox, LB_GETTEXT, pDraw->itemID, (LPARAM)szText);
432
433 // is it default?
434 hFont = (HFONT)SendMessageW(hwndListBox, WM_GETFONT, 0, 0);
435 if (lstrcmpiW(pEditType->szDefaultVerb, szText) == 0)
436 {
437 // default. set bold
438 LOGFONTW lf;
439 GetObject(hFont, sizeof(lf), &lf);
440 lf.lfWeight = FW_BOLD;
441 hFont2 = CreateFontIndirectW(&lf);
442 if (hFont2)
443 {
444 HGDIOBJ hFontOld = SelectObject(pDraw->hDC, hFont2);
446 DrawTextW(pDraw->hDC, szText, -1, &pDraw->rcItem,
449 SelectObject(pDraw->hDC, hFontOld);
450 DeleteObject(hFont2);
451 }
452 }
453 else
454 {
455 // non-default
457 DrawTextW(pDraw->hDC, szText, -1, &pDraw->rcItem,
460 }
461
462 // draw focus rect
463 if (pDraw->itemState & ODS_FOCUS)
464 {
465 DrawFocusRect(pDraw->hDC, &pDraw->rcItem);
466 }
467 return TRUE;
468}
469
470static BOOL
472{
473 if (!pMeasure)
474 return FALSE;
475
476 HWND hwndLB = GetDlgItem(hwndDlg, IDC_EDITTYPE_LISTBOX);
477
478 HDC hDC = GetDC(hwndLB);
479 if (hDC)
480 {
483 pMeasure->itemHeight = tm.tmHeight + LISTBOX_MARGIN * 2;
484 ReleaseDC(hwndLB, hDC);
485 return TRUE;
486 }
487 return FALSE;
488}
489
491// NewExtDlg
492
493typedef struct NEWEXT_DIALOG
494{
502
503static VOID
505{
506 // If "Advanced" button was clicked, then we shrink or expand the dialog.
507 RECT rc, rc1, rc2;
508
509 GetWindowRect(hwndDlg, &rc);
510 rc.bottom = rc.top + (pNewExt->rcDlg.bottom - pNewExt->rcDlg.top);
511
512 GetWindowRect(GetDlgItem(hwndDlg, IDOK), &rc1);
513 MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rc1, 2);
514
516 MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rc2, 2);
517
518 HWND hClassCombo = GetDlgItem(hwndDlg, IDC_NEWEXT_COMBOBOX);
519 if (pNewExt->bAdvanced)
520 {
521 rc1.top += pNewExt->dy;
522 rc1.bottom += pNewExt->dy;
523
524 rc2.top += pNewExt->dy;
525 rc2.bottom += pNewExt->dy;
526
528 ShowWindow(hClassCombo, SW_SHOWNOACTIVATE);
529
531 SetDlgItemTextW(hwndDlg, IDC_NEWEXT_ADVANCED, strLeft);
532
533 SetFocus(hClassCombo);
534 }
535 else
536 {
537 rc1.top -= pNewExt->dy;
538 rc1.bottom -= pNewExt->dy;
539
540 rc2.top -= pNewExt->dy;
541 rc2.bottom -= pNewExt->dy;
542
544 ShowWindow(hClassCombo, SW_HIDE);
545
547 SetDlgItemTextW(hwndDlg, IDC_NEWEXT_ADVANCED, strRight);
548
549 rc.bottom -= pNewExt->dy;
550
551 SendMessageW(hClassCombo, CB_SETCURSEL, 0, 0); // Reset the combo to the "new class" mode
552 }
553
554 HDWP hDWP = BeginDeferWindowPos(3);
555
556 if (hDWP)
557 hDWP = DeferWindowPos(hDWP, GetDlgItem(hwndDlg, IDOK), NULL,
558 rc1.left, rc1.top, rc1.right - rc1.left, rc1.bottom - rc1.top,
560 if (hDWP)
561 hDWP = DeferWindowPos(hDWP, GetDlgItem(hwndDlg, IDCANCEL), NULL,
562 rc2.left, rc2.top, rc2.right - rc2.left, rc2.bottom - rc2.top,
564 if (hDWP)
565 hDWP = DeferWindowPos(hDWP, hwndDlg, NULL,
566 rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
568
569 if (hDWP)
570 EndDeferWindowPos(hDWP);
571}
572
573static BOOL
575{
576 pNewExt->bAdvanced = FALSE;
577
578 // get window rectangle
579 GetWindowRect(hwndDlg, &pNewExt->rcDlg);
580
581 // get delta Y
582 RECT rc1, rc2;
585 pNewExt->dy = rc2.top - rc1.top;
586
587 // initialize
592
593 // shrink it first time
594 NewExtDlg_OnAdvanced(hwndDlg, pNewExt);
595
596 return TRUE;
597}
598
599static BOOL
601{
603 INT iItem;
604
605 GetDlgItemTextW(hwndDlg, IDC_NEWEXT_EDIT, pNewExt->szExt, _countof(pNewExt->szExt));
606 StrTrimW(pNewExt->szExt, g_pszSpace);
607 _wcsupr(pNewExt->szExt);
608
609#if 0
610 // FIXME: Implement the "choose existing class" mode
612 StrTrimW(pNewExt->szFileType, g_pszSpace);
613#endif
614 pNewExt->szFileType[0] = UNICODE_NULL; // "new class" mode
615
616 if (pNewExt->szExt[0] == 0)
617 {
620 MessageBoxW(hwndDlg, strText, strTitle, MB_ICONERROR);
621 return FALSE;
622 }
623
624 ZeroMemory(&find, sizeof(find));
625 find.flags = LVFI_STRING;
626 if (pNewExt->szExt[0] == L'.')
627 {
628 find.psz = &pNewExt->szExt[1];
629 }
630 else
631 {
632 find.psz = pNewExt->szExt;
633 }
634
635 iItem = ListView_FindItem(pNewExt->hwndLV, -1, &find);
636 if (iItem >= 0)
637 {
638 // already exists
639
640 // get file type
641 WCHAR szFileType[TYPENAME_CCHMAX];
643 ZeroMemory(&item, sizeof(item));
644 item.mask = LVIF_TEXT;
645 item.pszText = szFileType;
646 item.cchTextMax = _countof(szFileType);
647 item.iItem = iItem;
648 item.iSubItem = 1;
649 ListView_GetItem(pNewExt->hwndLV, &item);
650
651 // get text
652 CStringW strText;
653 strText.Format(IDS_NEWEXT_ALREADY_ASSOC, find.psz, szFileType, find.psz, szFileType);
654
655 // get title
656 CStringW strTitle;
658
659 if (MessageBoxW(hwndDlg, strText, strTitle, MB_ICONWARNING | MB_YESNO) == IDNO)
660 {
661 return FALSE;
662 }
663
664 // Delete the extension
665 CStringW strExt(L".");
666 strExt += find.psz;
667 strExt.MakeLower();
668 if (DeleteExt(hwndDlg, strExt))
669 ListView_DeleteItem(pNewExt->hwndLV, iItem);
670 }
671
672 EndDialog(hwndDlg, IDOK);
673 return TRUE;
674}
675
676// IDD_NEWEXTENSION
677static INT_PTR CALLBACK
679 HWND hwndDlg,
680 UINT uMsg,
683{
684 static PNEWEXT_DIALOG s_pNewExt = NULL;
685
686 switch (uMsg)
687 {
688 case WM_INITDIALOG:
689 s_pNewExt = (PNEWEXT_DIALOG)lParam;
690 NewExtDlg_OnInitDialog(hwndDlg, s_pNewExt);
691 return TRUE;
692
693 case WM_COMMAND:
694 switch (LOWORD(wParam))
695 {
696 case IDOK:
697 NewExtDlg_OnOK(hwndDlg, s_pNewExt);
698 break;
699
700 case IDCANCEL:
701 EndDialog(hwndDlg, IDCANCEL);
702 break;
703
705 s_pNewExt->bAdvanced = !s_pNewExt->bAdvanced;
706 NewExtDlg_OnAdvanced(hwndDlg, s_pNewExt);
707 break;
708 }
709 break;
710 }
711 return 0;
712}
713
714static PFILE_TYPE_ENTRY
716{
718 HKEY hKey, hTemp;
719 LVITEMW lvItem;
721
723 {
724 return NULL;
725 }
726 if (Assoc[0] != L'.' && !RegValueExists(hKey, L"URL Protocol"))
727 {
729 return NULL;
730 }
731
733 if (!Entry)
734 {
736 return NULL;
737 }
738 Entry->Initialize();
739
740 if (Assoc[0] == L'.')
741 {
742 if (PathIsExeW(Assoc))
743 {
744exclude:
745 HeapFree(pG->hHeap, 0, Entry);
747 return NULL;
748 }
749
750 dwSize = sizeof(Entry->ClassKey);
751 if (RegQueryValueExW(hKey, NULL, NULL, NULL, LPBYTE(Entry->ClassKey), &dwSize))
752 {
753 Entry->ClassKey[0] = UNICODE_NULL; // No ProgId
754 }
755#if SUPPORT_EXTENSIONWITHOUTPROGID
756 if (Entry->ClassKey[0] && !RegOpenKeyExW(HKEY_CLASSES_ROOT, Entry->ClassKey, 0, KEY_READ, &hTemp))
757 {
759 hKey = hTemp;
760 }
761#else
762 if (!Entry->ClassKey[0])
763 goto exclude;
764#endif
765 }
766
767 Entry->EditFlags = GetRegDWORD(hKey, L"EditFlags", 0);
768 if (Entry->EditFlags & FTA_Exclude)
769 goto exclude;
770
771 wcscpy(Entry->FileExtension, Assoc);
772
773 // get icon
774 Entry->IconPath[0] = UNICODE_NULL;
775 BOOL defaultIcon = !GetFileTypeIconsByKey(hKey, Entry, pG->IconSize);
776
778
779 // add icon to imagelist
780 INT iSmallImage = 0;
781 if (!defaultIcon && Entry->hIconSmall)
782 {
783 iSmallImage = ImageList_AddIcon(pG->himlSmall, Entry->hIconSmall);
784 }
785
786 lvItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
787 lvItem.iItem = iItem;
788 lvItem.iSubItem = 0;
789 lvItem.lParam = (LPARAM)Entry;
790 lvItem.iImage = iSmallImage;
791 lvItem.pszText = Assoc[0] == L'.' ? _wcsupr(&Entry->FileExtension[1]) : pG->NoneString;
792 SendMessageW(hListView, LVM_INSERTITEMW, 0, (LPARAM)&lvItem);
793
794 lvItem.mask = LVIF_TEXT;
795 lvItem.iItem = iItem;
796 lvItem.iSubItem = 1;
798 ListView_SetItem(hListView, &lvItem);
799
800 return Entry;
801}
802
803static BOOL
805{
806 DWORD dwValue = 1;
807 HKEY hKey;
808 WCHAR szKey[13]; // max. "ft4294967295" + "\0"
809 LONG nResult;
810
811 if (!*pszProgId)
812 {
813 pszProgId = szKey;
814 // Search the next "ft%06u" key name
815 do
816 {
817 StringCbPrintfW(szKey, sizeof(szKey), L"ft%06u", dwValue);
818
819 nResult = RegOpenKeyEx(HKEY_CLASSES_ROOT, szKey, 0, KEY_READ, &hKey);
820 if (nResult != ERROR_SUCCESS)
821 break;
822
824 ++dwValue;
825 } while (dwValue != 0);
826
828
829 if (dwValue == 0)
830 return FALSE;
831
832 // Create new "ft%06u" key
833 nResult = RegCreateKeyEx(HKEY_CLASSES_ROOT, szKey, 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL);
834 if (ERROR_SUCCESS != nResult)
835 return FALSE;
837 }
838
839 // Create the ".ext" key
840 WCHAR szExt[ASSOC_CCHMAX];
841 if (*pszExt == L'.') // The user is allowed to type the extension with or without the . in the new dialog!
842 ++pszExt;
843 StringCbPrintfW(szExt, sizeof(szExt), L".%s", pszExt);
844 _wcslwr(szExt);
845 nResult = RegCreateKeyEx(HKEY_CLASSES_ROOT, szExt, 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL);
846 _wcsupr(szExt);
847 if (ERROR_SUCCESS != nResult)
848 return FALSE;
849
850 // Set the default value of ".ext" to "ft%06u"
851 RegSetString(hKey, NULL, pszProgId, REG_SZ);
852
854
855 // Insert an item to the listview
856 HWND hListView = GetDlgItem(hwndDlg, IDC_FILETYPES_LISTVIEW);
857 INT iItem = ListView_GetItemCount(hListView);
858 if (!FileTypesDlg_InsertToLV(hListView, szExt, iItem, pG))
859 return FALSE;
860
861 ListView_SetItemState(hListView, iItem, -1, LVIS_FOCUSED | LVIS_SELECTED);
862 ListView_EnsureVisible(hListView, iItem, FALSE);
863 return TRUE;
864}
865
866static BOOL
868{
869 HWND hListView = GetDlgItem(hwndDlg, IDC_FILETYPES_LISTVIEW);
870
871 INT iItem = ListView_GetNextItem(hListView, -1, LVNI_SELECTED);
872 if (iItem == -1)
873 return FALSE;
874
875 WCHAR szExt[MAX_PATH];
876 szExt[0] = L'.';
877 ListView_GetItemText(hListView, iItem, 0, &szExt[1], _countof(szExt) - 1);
878 _wcslwr(szExt);
879
880 if (DeleteExt(hwndDlg, szExt))
881 {
882 ListView_DeleteItem(hListView, iItem);
883 }
884 return TRUE;
885}
886
888// common code of NewActionDlg and EditActionDlg
889
890typedef struct ACTION_DIALOG
891{
899
900static void
902{
903 WCHAR szFile[MAX_PATH];
904 szFile[0] = UNICODE_NULL;
905
908
910
912 ZeroMemory(&ofn, sizeof(ofn));
914 ofn.hwndOwner = hwndDlg;
916 ofn.lpstrFile = szFile;
917 ofn.nMaxFile = _countof(szFile);
918 ofn.lpstrTitle = strTitle;
920 ofn.lpstrDefExt = L"exe";
921 if (GetOpenFileNameW(&ofn))
922 {
923 if (bEdit)
924 {
925 CStringW str = szFile;
927 str += L" \"%1\"";
929 }
930 else
931 {
932 SetDlgItemTextW(hwndDlg, IDC_ACTION_APP, szFile);
933 }
934 }
935}
936
938// NewActionDlg
939
940static void
942{
943 // check action
944 GetDlgItemTextW(hwndDlg, IDC_ACTION_ACTION, pNewAct->szAction, _countof(pNewAct->szAction));
945 StrTrimW(pNewAct->szAction, g_pszSpace);
946 if (pNewAct->szAction[0] == 0)
947 {
948 // action was empty, error
949 HWND hwndCtrl = GetDlgItem(hwndDlg, IDC_ACTION_ACTION);
950 SendMessageW(hwndCtrl, EM_SETSEL, 0, -1);
951 SetFocus(hwndCtrl);
954 MessageBoxW(hwndDlg, strText, strTitle, MB_ICONERROR);
955 return;
956 }
957
958 // check app
959 GetDlgItemTextW(hwndDlg, IDC_ACTION_APP, pNewAct->szApp, _countof(pNewAct->szApp));
960 StrTrimW(pNewAct->szApp, g_pszSpace);
961 if (pNewAct->szApp[0] == 0 ||
963 {
964 // app was empty or invalid
965 HWND hwndCtrl = GetDlgItem(hwndDlg, IDC_ACTION_APP);
966 SendMessageW(hwndCtrl, EM_SETSEL, 0, -1);
967 SetFocus(hwndCtrl);
970 MessageBoxW(hwndDlg, strText, strTitle, MB_ICONERROR);
971 return;
972 }
973
974 EndDialog(hwndDlg, IDOK);
975}
976
977// IDD_ACTION
978static INT_PTR CALLBACK
980{
981 static PACTION_DIALOG s_pNewAct = NULL;
982
983 switch (uMsg)
984 {
985 case WM_INITDIALOG:
986 s_pNewAct = (PACTION_DIALOG)lParam;
987 s_pNewAct->bUseDDE = FALSE;
989 return TRUE;
990
991 case WM_COMMAND:
992 switch (LOWORD(wParam))
993 {
994 case IDOK:
995 NewActionDlg_OnOK(hwndDlg, s_pNewAct);
996 break;
997
998 case IDCANCEL:
999 EndDialog(hwndDlg, IDCANCEL);
1000 break;
1001
1002 case IDC_ACTION_BROWSE:
1003 ActionDlg_OnBrowse(hwndDlg, s_pNewAct, FALSE);
1004 break;
1005 }
1006 break;
1007 }
1008 return 0;
1009}
1010
1012// EditActionDlg
1013
1014static void
1016{
1017 // check action
1018 GetDlgItemTextW(hwndDlg, IDC_ACTION_ACTION, pEditAct->szAction, _countof(pEditAct->szAction));
1019 StrTrimW(pEditAct->szAction, g_pszSpace);
1020 if (pEditAct->szAction[0] == 0)
1021 {
1022 // action was empty. show error
1023 HWND hwndCtrl = GetDlgItem(hwndDlg, IDC_ACTION_ACTION);
1024 SendMessageW(hwndCtrl, EM_SETSEL, 0, -1);
1025 SetFocus(hwndCtrl);
1028 MessageBoxW(hwndDlg, strText, strTitle, MB_ICONERROR);
1029 }
1030
1031 // check app
1032 GetDlgItemTextW(hwndDlg, IDC_ACTION_APP, pEditAct->szApp, _countof(pEditAct->szApp));
1033 StrTrimW(pEditAct->szApp, g_pszSpace);
1034 if (pEditAct->szApp[0] == 0)
1035 {
1036 // app was empty. show error
1037 HWND hwndCtrl = GetDlgItem(hwndDlg, IDC_ACTION_APP);
1038 SendMessageW(hwndCtrl, EM_SETSEL, 0, -1);
1039 SetFocus(hwndCtrl);
1042 MessageBoxW(hwndDlg, strText, strTitle, MB_ICONERROR);
1043 }
1044
1045 EndDialog(hwndDlg, IDOK);
1046}
1047
1048// IDD_ACTION
1049static INT_PTR CALLBACK
1051{
1052 static PACTION_DIALOG s_pEditAct = NULL;
1053
1054 switch (uMsg)
1055 {
1056 case WM_INITDIALOG:
1057 s_pEditAct = (PACTION_DIALOG)lParam;
1058 s_pEditAct->bUseDDE = FALSE;
1059 SetDlgItemTextW(hwndDlg, IDC_ACTION_ACTION, s_pEditAct->szAction);
1060 SetDlgItemTextW(hwndDlg, IDC_ACTION_APP, s_pEditAct->szApp);
1063 {
1064 // set title
1066 str += GetTypeName(s_pEditAct->pEntry, s_pEditAct->pG);
1067 SetWindowTextW(hwndDlg, str);
1068 }
1069 return TRUE;
1070
1071 case WM_COMMAND:
1072 switch (LOWORD(wParam))
1073 {
1074 case IDOK:
1075 EditActionDlg_OnOK(hwndDlg, s_pEditAct);
1076 break;
1077
1078 case IDCANCEL:
1079 EndDialog(hwndDlg, IDCANCEL);
1080 break;
1081
1082 case IDC_ACTION_BROWSE:
1083 ActionDlg_OnBrowse(hwndDlg, s_pEditAct, TRUE);
1084 break;
1085 }
1086 break;
1087 }
1088 return 0;
1089}
1090
1092// EditTypeDlg
1093
1094static void
1096{
1097 PFILE_TYPE_ENTRY pEntry = pEditType->pEntry;
1098 static const WORD map[] = {
1105 };
1106 for (SIZE_T i = 0; i < _countof(map); i += 2)
1107 {
1108 if (pEntry->EditFlags & map[i + 0])
1109 EnableWindow(GetDlgItem(hwndDlg, map[i + 1]), FALSE);
1110 }
1111}
1112
1113static BOOL
1115{
1116 PFILE_TYPE_ENTRY pEntry = pEditType->pEntry;
1118
1119 pEntry->IconPath[0] = UNICODE_NULL; // I want the default icon
1121 pEntry->DestroyIcons();
1122 pEntry->hIconSmall = DoExtractIcon(pEntry->IconPath, pEntry->nIconIndex, TRUE);
1123 if (ExpandEnvironmentStringsW(pEditType->szIconPath, buf, _countof(buf)) && buf[0])
1124 {
1125 HICON hIco = DoExtractIcon(buf, pEditType->nIconIndex, TRUE);
1126 if (hIco)
1127 {
1128 pEntry->DestroyIcons();
1129 pEntry->hIconSmall = hIco;
1130 }
1131 }
1132 StringCbCopyW(pEntry->IconPath, sizeof(pEntry->IconPath), pEditType->szIconPath);
1133 pEntry->nIconIndex = pEditType->nIconIndex;
1134
1135 HWND hListView = pEditType->hwndLV;
1136 InitializeDefaultIcons(pEditType->pG);
1137 HIMAGELIST himlSmall = pEditType->pG->himlSmall;
1138 INT iSmallImage = ImageList_AddIcon(himlSmall, pEntry->hIconSmall);
1139
1140 INT iItem = ListView_GetNextItem(hListView, -1, LVNI_SELECTED);
1141 if (iItem != -1)
1142 {
1143 LV_ITEMW Item = { LVIF_IMAGE, iItem };
1144 Item.iImage = iSmallImage;
1145 ListView_SetItem(hListView, &Item);
1146 }
1147 return TRUE;
1148}
1149
1150static BOOL
1152 LPCWSTR TypeName, EDITTYPEFLAGS Etf)
1153{
1154 PFILE_TYPE_ENTRY pEntry = pEditType->pEntry;
1155 LPCWSTR ClassKey;
1156 HRESULT hr = GetClassKey(*pEntry, ClassKey);
1157 BOOL OnlyExt = hr != S_OK;
1159 if (FAILED(hr) || RegCreateKeyExW(HKEY_CLASSES_ROOT, ClassKey, 0, NULL, 0,
1162 {
1163 return FALSE;
1164 }
1165
1166 // Refresh the EditFlags
1167 DWORD dw;
1168 if (GetRegDWORD(hClassKey, L"EditFlags", dw, 0, FALSE) == ERROR_SUCCESS)
1169 pEntry->EditFlags = (dw & ~FTA_MODIFYMASK) | (pEntry->EditFlags & FTA_MODIFYMASK);
1170
1171 if (!OnlyExt)
1172 {
1173 // Set class properties
1174 RegSetOrDelete(hClassKey, L"EditFlags", REG_DWORD, pEntry->EditFlags ? &pEntry->EditFlags : NULL, 4);
1175 if (pEntry->IsExtension())
1176 {
1177 RegSetOrDelete(hClassKey, L"AlwaysShowExt", REG_SZ, (Etf & ETF_ALWAYSEXT) ? L"" : NULL, 0);
1178 }
1179 if (RegKeyExists(hClassKey, L"DocObject"))
1180 {
1181 LRESULT ec = GetRegDWORD(hClassKey, L"BrowserFlags", dw, 0, TRUE);
1182 if (ec == ERROR_SUCCESS || ec == ERROR_FILE_NOT_FOUND)
1183 {
1184 dw = (dw & ~8) | ((Etf & ETF_BROWSESAME) ? 0 : 8); // Note: 8 means NOT
1185 RegSetOrDelete(hClassKey, L"BrowserFlags", REG_DWORD, dw ? &dw : NULL, sizeof(dw));
1186 }
1187 }
1188 }
1189 if (!(pEntry->EditFlags & FTA_NoEditDesc))
1190 {
1191 if (!OnlyExt)
1192 RegDeleteValueW(hClassKey, NULL); // Legacy name (in ProgId only)
1193
1194 // Deleting this value is always the correct thing to do but Windows does not do this.
1195 // This means the user cannot override the translated known type names set by the OS.
1196 if (OnlyExt)
1197 RegDeleteValueW(hClassKey, L"FriendlyTypeName"); // MUI name (extension or ProgId)
1198
1199 if (TypeName[0])
1200 RegSetString(hClassKey, OnlyExt ? L"FriendlyTypeName" : NULL, TypeName, REG_SZ);
1201 pEntry->InvalidateTypeName();
1202 }
1203
1204 if (pEntry->IconPath[0] && !(pEntry->EditFlags & FTA_NoEditIcon) && pEditType->ChangedIcon)
1205 {
1206 HKEY hDefaultIconKey;
1207 if (RegCreateKeyExW(hClassKey, L"DefaultIcon", 0, NULL, 0, KEY_WRITE,
1208 NULL, &hDefaultIconKey, NULL) == ERROR_SUCCESS)
1209 {
1210 DWORD type = REG_SZ;
1212 LPCWSTR fmt = L"%s,%d";
1213 if (!lstrcmpW(pEntry->IconPath, L"%1"))
1214 {
1215 fmt = L"%s"; // No icon index for "%1"
1216 }
1217 else if (StrChrW(pEntry->IconPath, L'%'))
1218 {
1220 }
1221 StringCbPrintfW(buf, sizeof(buf), fmt, pEntry->IconPath, pEntry->nIconIndex);
1222
1223 RegSetString(hDefaultIconKey, NULL, buf, type);
1224 RegCloseKey(hDefaultIconKey);
1225 }
1226 }
1227
1228 HKEY hShellKey;
1229 if (RegCreateKeyExW(hClassKey, L"shell", 0, NULL, 0, KEY_READ | KEY_WRITE, NULL,
1230 &hShellKey, NULL) != ERROR_SUCCESS)
1231 {
1233 return FALSE;
1234 }
1235
1236 // set default action
1237 if (!(pEntry->EditFlags & FTA_NoEditDflt))
1238 {
1239 if (pEditType->szDefaultVerb[0])
1240 RegSetString(hShellKey, NULL, pEditType->szDefaultVerb, REG_SZ);
1241 else
1242 RegDeleteValueW(hShellKey, NULL);
1243 }
1244
1245 // delete shell commands
1246 WCHAR szVerbName[VERBKEY_CCHMAX];
1247 DWORD dwIndex = 0;
1248 while (RegEnumKeyW(hShellKey, dwIndex, szVerbName, _countof(szVerbName)) == ERROR_SUCCESS)
1249 {
1250 if (pEditType->CommandLineMap.FindKey(szVerbName) == -1)
1251 {
1252 // doesn't exist in CommandLineMap, then delete it
1253 if (SHDeleteKeyW(hShellKey, szVerbName) == ERROR_SUCCESS)
1254 {
1255 --dwIndex;
1256 }
1257 }
1258 ++dwIndex;
1259 }
1260
1261 // write shell commands
1262 const INT nCount = pEditType->CommandLineMap.GetSize();
1263 for (INT i = 0; i < nCount; ++i)
1264 {
1265 const CStringW& key = pEditType->CommandLineMap.GetKeyAt(i);
1266 const CStringW& cmd = pEditType->CommandLineMap.GetValueAt(i);
1267 if (!pEditType->ModifiedVerbs.Find(key))
1268 {
1269 ASSERT(RegKeyExists(hShellKey, key));
1270 continue;
1271 }
1272
1273 // create verb key
1274 HKEY hVerbKey;
1275 if (RegCreateKeyExW(hShellKey, key, 0, NULL, 0, KEY_WRITE, NULL,
1276 &hVerbKey, NULL) == ERROR_SUCCESS)
1277 {
1278 // create command key
1279 HKEY hCommandKey;
1280 if (RegCreateKeyExW(hVerbKey, L"command", 0, NULL, 0, KEY_WRITE, NULL,
1281 &hCommandKey, NULL) == ERROR_SUCCESS)
1282 {
1283 DWORD dwSize = (cmd.GetLength() + 1) * sizeof(WCHAR);
1284 DWORD dwType = REG_SZ;
1285 int exp;
1286 if ((exp = cmd.Find('%', 0)) >= 0 && cmd.Find('%', exp + 1) >= 0)
1287 dwType = REG_EXPAND_SZ;
1288 RegSetValueExW(hCommandKey, NULL, 0, dwType, LPBYTE(LPCWSTR(cmd)), dwSize);
1289 RegCloseKey(hCommandKey);
1290 }
1291
1292 RegCloseKey(hVerbKey);
1293 }
1294 }
1295
1296 RegCloseKey(hShellKey);
1298 return TRUE;
1299}
1300
1301static BOOL
1303{
1304 PFILE_TYPE_ENTRY pEntry = pEditType->pEntry;
1305 LPCWSTR ClassKey;
1306 HRESULT hr = GetClassKey(*pEntry, ClassKey);
1308 if (FAILED(hr) || RegOpenKeyExW(HKEY_CLASSES_ROOT, ClassKey, 0, KEY_READ, &hClassKey))
1309 return FALSE;
1310
1311 UINT etfbits = (RegValueExists(hClassKey, L"AlwaysShowExt")) ? ETF_ALWAYSEXT : 0;
1312
1313 // 8 in BrowserFlags listed in KB 162059 seems to be our bit
1314 BOOL docobj = RegKeyExists(hClassKey, L"DocObject");
1316 etfbits |= (docobj && (GetRegDWORD(hClassKey, L"BrowserFlags") & 8)) ? 0 : ETF_BROWSESAME;
1317
1318 Etf = EDITTYPEFLAGS(etfbits);
1319
1320 // open "shell" key
1321 HKEY hShellKey;
1322 if (RegOpenKeyExW(hClassKey, L"shell", 0, KEY_READ, &hShellKey) != ERROR_SUCCESS)
1323 {
1325 return FALSE;
1326 }
1327
1328 WCHAR DefaultVerb[VERBKEY_CCHMAX];
1329 DWORD dwSize = sizeof(DefaultVerb);
1330 if (RegQueryValueExW(hShellKey, NULL, NULL, NULL,
1331 LPBYTE(DefaultVerb), &dwSize) == ERROR_SUCCESS)
1332 {
1333 StringCbCopyW(pEditType->szDefaultVerb, sizeof(pEditType->szDefaultVerb), DefaultVerb);
1334 }
1335 else
1336 {
1337 StringCbCopyW(pEditType->szDefaultVerb, sizeof(pEditType->szDefaultVerb), L"open");
1338 }
1339
1340 // enumerate shell verbs
1341 WCHAR szVerbName[VERBKEY_CCHMAX];
1342 DWORD dwIndex = 0;
1343 while (RegEnumKeyW(hShellKey, dwIndex, szVerbName, _countof(szVerbName)) == ERROR_SUCCESS)
1344 {
1345 // open verb key
1346 HKEY hVerbKey;
1347 LONG nResult = RegOpenKeyExW(hShellKey, szVerbName, 0, KEY_READ, &hVerbKey);
1348 if (nResult == ERROR_SUCCESS)
1349 {
1350 // open command key
1351 HKEY hCommandKey;
1352 nResult = RegOpenKeyExW(hVerbKey, L"command", 0, KEY_READ, &hCommandKey);
1353 if (nResult == ERROR_SUCCESS)
1354 {
1355 // get command line
1356 WCHAR szValue[MAX_PATH * 2];
1357 dwSize = sizeof(szValue);
1358 nResult = RegQueryValueExW(hCommandKey, NULL, NULL, NULL, LPBYTE(szValue), &dwSize);
1359 if (nResult == ERROR_SUCCESS)
1360 {
1361 pEditType->CommandLineMap.SetAt(szVerbName, szValue);
1362 }
1363
1364 RegCloseKey(hCommandKey);
1365 }
1366
1367 RegCloseKey(hVerbKey);
1368 }
1370 ++dwIndex;
1371 }
1372
1373 WCHAR TypeName[TYPENAME_CCHMAX];
1374 dwSize = sizeof(TypeName);
1375 if (!RegQueryValueExW(hClassKey, NULL, NULL, NULL, LPBYTE(TypeName), &dwSize))
1376 {
1377 TypeName[_countof(TypeName) - 1] = UNICODE_NULL; // Terminate
1378 SetDlgItemTextW(hwndDlg, IDC_EDITTYPE_TEXT, TypeName);
1379 }
1380
1381 RegCloseKey(hShellKey);
1383 return TRUE;
1384}
1385
1386static void
1388{
1389 PFILE_TYPE_ENTRY pEntry = pEditType->pEntry;
1390
1391 WCHAR TypeName[TYPENAME_CCHMAX];
1392 GetDlgItemTextW(hwndDlg, IDC_EDITTYPE_TEXT, TypeName, _countof(TypeName));
1393 StrTrimW(TypeName, g_pszSpace);
1394
1395 UINT etf = 0;
1396 pEntry->EditFlags &= ~(FTA_MODIFYMASK);
1398 pEntry->EditFlags |= FTA_OpenIsSafe;
1400 etf |= ETF_ALWAYSEXT;
1402 etf |= ETF_BROWSESAME;
1403
1404 // update entry icon
1405 EditTypeDlg_UpdateEntryIcon(hwndDlg, pEditType);
1406
1407 // write registry
1408 EditTypeDlg_WriteClass(hwndDlg, pEditType, TypeName, (EDITTYPEFLAGS)etf);
1409
1410 pEntry->InvalidateDefaultApp();
1411
1412 // update the icon cache
1414
1415 EndDialog(hwndDlg, IDOK);
1416}
1417
1418static BOOL
1420{
1421 // get current selection
1423 if (iItem == LB_ERR)
1424 return FALSE;
1425
1426 // ask user for removal
1429 if (MessageBoxW(hwndDlg, strText, strTitle, MB_ICONINFORMATION | MB_YESNO) == IDNO)
1430 return FALSE;
1431
1432 // get text
1433 WCHAR szText[VERBKEY_CCHMAX];
1434 szText[0] = 0;
1435 SendDlgItemMessageW(hwndDlg, IDC_EDITTYPE_LISTBOX, LB_GETTEXT, iItem, (LPARAM)szText);
1436 StrTrimW(szText, g_pszSpace);
1437
1438 // remove it
1439 pEditType->CommandLineMap.Remove(szText);
1441 return TRUE;
1442}
1443
1444static void
1446{
1447 INT iItem, iIndex;
1449 switch (id)
1450 {
1451 case IDOK:
1452 EditTypeDlg_OnOK(hwndDlg, pEditType);
1453 break;
1454
1455 case IDCANCEL:
1456 EndDialog(hwndDlg, IDCANCEL);
1457 break;
1458
1460 EditTypeDlg_OnChangeIcon(hwndDlg, pEditType);
1461 break;
1462
1463 case IDC_EDITTYPE_NEW:
1464 // open 'New Action' dialog
1465 action.bUseDDE = FALSE;
1466 action.hwndLB = GetDlgItem(hwndDlg, IDC_EDITTYPE_LISTBOX);
1467 action.pEntry = pEditType->pEntry;
1470 {
1471 if (SendMessageW(action.hwndLB, LB_FINDSTRING, -1, (LPARAM)action.szAction) != LB_ERR)
1472 {
1473 // already exists, error
1474 HWND hwndCtrl = GetDlgItem(hwndDlg, IDC_ACTION_ACTION);
1475 SendMessageW(hwndCtrl, EM_SETSEL, 0, -1);
1476 SetFocus(hwndCtrl);
1477
1478 CStringW strText, strTitle(MAKEINTRESOURCEW(IDS_FILE_TYPES));
1479 strText.Format(IDS_ACTION_EXISTS, action.szAction);
1480 MessageBoxW(hwndDlg, strText, strTitle, MB_ICONERROR);
1481 }
1482 else
1483 {
1484 // add it
1485 CStringW strCommandLine = action.szApp;
1486 QuoteAppPathForCommand(strCommandLine);
1487 strCommandLine += L" \"%1\"";
1488 pEditType->CommandLineMap.SetAt(action.szAction, strCommandLine);
1489 pEditType->ModifiedVerbs.AddHead(action.szAction);
1490 SendMessageW(action.hwndLB, LB_ADDSTRING, 0, LPARAM(action.szAction));
1491 if (SendMessageW(action.hwndLB, LB_GETCOUNT, 0, 0) == 1)
1492 {
1493 // set default
1494 StringCbCopyW(pEditType->szDefaultVerb, sizeof(pEditType->szDefaultVerb), action.szAction);
1495 InvalidateRect(action.hwndLB, NULL, TRUE);
1496 }
1497 }
1498 }
1499 break;
1500
1502 if (code == LBN_SELCHANGE)
1503 {
1504 action.hwndLB = GetDlgItem(hwndDlg, IDC_EDITTYPE_LISTBOX);
1505 INT iItem = SendMessageW(action.hwndLB, LB_GETCURSEL, 0, 0);
1506 SendMessageW(action.hwndLB, LB_GETTEXT, iItem, LPARAM(action.szAction));
1507 if (lstrcmpiW(action.szAction, pEditType->szDefaultVerb) == 0)
1508 {
1510 }
1511 else
1512 {
1514 }
1515 EditTypeDlg_Restrict(hwndDlg, pEditType);
1516 break;
1517 }
1518 else if (code != LBN_DBLCLK)
1519 {
1520 break;
1521 }
1522 // FALL THROUGH
1523
1525 action.bUseDDE = FALSE;
1526 action.hwndLB = GetDlgItem(hwndDlg, IDC_EDITTYPE_LISTBOX);
1527 action.pG = pEditType->pG;
1528 action.pEntry = pEditType->pEntry;
1529 iItem = SendMessageW(action.hwndLB, LB_GETCURSEL, 0, 0);
1530 if (iItem == LB_ERR)
1531 break;
1532
1533 // get action
1534 SendMessageW(action.hwndLB, LB_GETTEXT, iItem, LPARAM(action.szAction));
1535
1536 // get app
1537 {
1538 iIndex = pEditType->CommandLineMap.FindKey(action.szAction);
1539 CStringW str = pEditType->CommandLineMap.GetValueAt(iIndex);
1540 StringCbCopyW(action.szApp, sizeof(action.szApp), LPCWSTR(str));
1541 }
1542
1543 // open dialog
1546 {
1547 SendMessageW(action.hwndLB, LB_DELETESTRING, iItem, 0);
1548 SendMessageW(action.hwndLB, LB_INSERTSTRING, iItem, LPARAM(action.szAction));
1549 pEditType->CommandLineMap.SetAt(action.szAction, action.szApp);
1550 pEditType->ModifiedVerbs.AddHead(action.szAction);
1551 }
1552 break;
1553
1555 EditTypeDlg_OnRemove(hwndDlg, pEditType);
1556 break;
1557
1559 action.hwndLB = GetDlgItem(hwndDlg, IDC_EDITTYPE_LISTBOX);
1560 iItem = SendMessageW(action.hwndLB, LB_GETCURSEL, 0, 0);
1561 if (iItem == LB_ERR)
1562 break;
1563
1564 SendMessageW(action.hwndLB, LB_GETTEXT, iItem, LPARAM(action.szAction));
1565
1566 // set default
1567 StringCbCopyW(pEditType->szDefaultVerb, sizeof(pEditType->szDefaultVerb), action.szAction);
1569 InvalidateRect(action.hwndLB, NULL, TRUE);
1570 break;
1571 }
1572}
1573
1574static BOOL
1576{
1577 PFILE_TYPE_ENTRY pEntry = pEditType->pEntry;
1578 EDITTYPEFLAGS Etf;
1579 ExpandEnvironmentStringsW(pEntry->IconPath, pEditType->szIconPath, _countof(pEditType->szIconPath));
1580 pEditType->nIconIndex = pEntry->nIconIndex;
1581 StringCbCopyW(pEditType->szDefaultVerb, sizeof(pEditType->szDefaultVerb), L"open");
1582 pEditType->ChangedIcon = false;
1583
1584 // set info
1585 HICON hIco = DoExtractIcon(pEditType->szIconPath, pEditType->nIconIndex);
1587 EditTypeDlg_ReadClass(hwndDlg, pEditType, Etf);
1590 EnableWindow(GetDlgItem(hwndDlg, IDC_EDITTYPE_SHOW_EXT), pEntry->IsExtension());
1593
1594 // select first item
1596 // is listbox empty?
1597 if (SendDlgItemMessageW(hwndDlg, IDC_EDITTYPE_LISTBOX, LB_GETCOUNT, 0, 0) == 0)
1598 {
1602 }
1603 EditTypeDlg_Restrict(hwndDlg, pEditType);
1604 return TRUE;
1605}
1606
1607// IDD_EDITTYPE
1608static INT_PTR CALLBACK
1610{
1611 static PEDITTYPE_DIALOG s_pEditType = NULL;
1612 LPDRAWITEMSTRUCT pDraw;
1613 LPMEASUREITEMSTRUCT pMeasure;
1614
1615 switch (uMsg)
1616 {
1617 case WM_INITDIALOG:
1618 s_pEditType = (PEDITTYPE_DIALOG)lParam;
1619 return EditTypeDlg_OnInitDialog(hwndDlg, s_pEditType);
1620
1621 case WM_DESTROY:
1622 {
1624 if (hOld)
1625 DestroyIcon(hOld);
1626 break;
1627 }
1628
1629 case WM_DRAWITEM:
1630 pDraw = LPDRAWITEMSTRUCT(lParam);
1631 return EditTypeDlg_OnDrawItem(hwndDlg, pDraw, s_pEditType);
1632
1633 case WM_MEASUREITEM:
1634 pMeasure = LPMEASUREITEMSTRUCT(lParam);
1635 return EditTypeDlg_OnMeasureItem(hwndDlg, pMeasure, s_pEditType);
1636
1637 case WM_COMMAND:
1638 EditTypeDlg_OnCommand(hwndDlg, LOWORD(wParam), HIWORD(wParam), s_pEditType);
1639 break;
1640 }
1641
1642 return 0;
1643}
1644
1646// FileTypesDlg
1647
1648static INT CALLBACK
1649FileTypesDlg_CompareItems(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
1650{
1651 PFILE_TYPE_GLOBALS pG = (PFILE_TYPE_GLOBALS)lParamSort;
1652 PFILE_TYPE_ENTRY entry1 = (PFILE_TYPE_ENTRY)lParam1, entry2 = (PFILE_TYPE_ENTRY)lParam2;
1653 int x = 0;
1654 if (pG->SortCol == 1)
1655 x = wcsicmp(GetTypeName(entry1, pG), GetTypeName(entry2, pG));
1656 if (!x && !(x = entry1->IsExtension() - entry2->IsExtension()))
1657 x = wcsicmp(entry1->FileExtension, entry2->FileExtension);
1658 return x * pG->SortReverse;
1659}
1660
1661static void
1663{
1664 pG->SortReverse = pG->SortCol == Column ? pG->SortReverse * -1 : 1;
1665 pG->SortCol = Column < 0 ? 0 : (INT8) Column;
1667}
1668
1669static VOID
1671{
1672 RECT clientRect;
1673 LPCWSTR columnName;
1674 WCHAR szBuf[50];
1675
1676 LVCOLUMNW col;
1678 col.fmt = 0;
1679
1680 GetClientRect(hListView, &clientRect);
1681 INT column0Size = (clientRect.right - clientRect.left) / 4;
1682
1683 columnName = L"Extensions"; // Default to English
1685 columnName = szBuf;
1686 col.pszText = const_cast<LPWSTR>(columnName);
1687 col.iSubItem = 0;
1688 col.cx = column0Size;
1689 SendMessageW(hListView, LVM_INSERTCOLUMNW, 0, (LPARAM)&col);
1690
1691 columnName = L"File Types"; // Default to English
1693 {
1694 columnName = szBuf;
1695 }
1696 else
1697 {
1698 ERR("Failed to load localized string!\n");
1699 }
1700 col.pszText = const_cast<LPWSTR>(columnName);
1701 col.iSubItem = 1;
1702 col.cx = clientRect.right - clientRect.left - column0Size - GetSystemMetrics(SM_CYVSCROLL);
1703 SendMessageW(hListView, LVM_INSERTCOLUMNW, 1, (LPARAM)&col);
1704
1705 const UINT lvexstyle = LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP;
1706 ListView_SetExtendedListViewStyleEx(hListView, lvexstyle, lvexstyle);
1707}
1708
1709static void
1711{
1712 CStringW buf;
1713 buf.Format(IDS_FILE_DETAILS, Assoc);
1714 SetDlgItemTextW(hwndDlg, IDC_FILETYPES_DETAILS_GROUPBOX, buf.GetString());
1715}
1716
1717static void
1719{
1720 ListView_DeleteAllItems(hListView);
1723 FileTypesDlg_SetGroupboxText(hwndDlg, L"");
1728#if DBG
1729 DWORD statTickStart = GetTickCount();
1730#endif
1731
1732 INT iItem = 0;
1734 DWORD dwName = _countof(szName);
1735 DWORD dwIndex = 0;
1736 SendMessage(hListView, WM_SETREDRAW, FALSE, 0);
1737 while (RegEnumKeyExW(HKEY_CLASSES_ROOT, dwIndex++, szName, &dwName,
1739 {
1740 if (FileTypesDlg_InsertToLV(hListView, szName, iItem, pG))
1741 ++iItem;
1742 dwName = _countof(szName);
1743 }
1744 FileTypesDlg_Sort(pG, hListView);
1745 SendMessage(hListView, WM_SETREDRAW, TRUE, 0);
1747
1748#if DBG
1749 DbgPrint("FT loaded %u (%ums)\n", iItem, GetTickCount() - statTickStart);
1750#endif
1751 // select first item
1753}
1754
1755static PFILE_TYPE_GLOBALS
1757{
1758 HWND hListView = GetDlgItem(hwndDlg, IDC_FILETYPES_LISTVIEW);
1760 if (!pG)
1761 return pG;
1762
1763 pG->SortReverse = 1;
1764 pG->hDefExtIconSmall = NULL;
1765 pG->hOpenWithImage = NULL;
1766 pG->IconSize = GetSystemMetrics(SM_CXSMICON); // Shell icons are always square
1767 pG->himlSmall = ImageList_Create(pG->IconSize, pG->IconSize, ILC_COLOR32 | ILC_MASK, 256, 20);
1768 pG->hHeap = GetProcessHeap();
1769
1770 pG->NoneString[0] = UNICODE_NULL;
1772
1774 {
1775 HKEY hKey;
1776 if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Classes", 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL))
1777 pG->Restricted = TRUE;
1778 else
1780 }
1781
1782 FileTypesDlg_InitListView(hwndDlg, hListView);
1785
1786 // Delay loading the items so the propertysheet has time to finalize the UI
1787 PostMessage(hListView, WM_KEYDOWN, VK_F5, 0);
1788 return pG;
1789}
1790
1791static inline PFILE_TYPE_ENTRY
1792FileTypesDlg_GetEntry(HWND hListView, INT iItem = -1)
1793{
1794 if (iItem == -1)
1795 {
1796 iItem = ListView_GetNextItem(hListView, -1, LVNI_SELECTED);
1797 if (iItem == -1)
1798 return NULL;
1799 }
1800
1801 LV_ITEMW lvItem = { LVIF_PARAM, iItem };
1802 if (ListView_GetItem(hListView, &lvItem))
1803 return (PFILE_TYPE_ENTRY)lvItem.lParam;
1804
1805 return NULL;
1806}
1807
1808static void
1810{
1813 if (MessageBoxW(hwndDlg, strRemoveExt, strTitle, MB_ICONQUESTION | MB_YESNO) == IDYES)
1814 {
1815 FileTypesDlg_RemoveExt(hwndDlg);
1816
1817 // Select first item (Win2k3 does it)
1818 HWND hListView = GetDlgItem(hwndDlg, IDC_FILETYPES_LISTVIEW);
1820 }
1821}
1822
1823static void
1825{
1826 HBITMAP &hbmProgram = pG->hOpenWithImage;
1827 LPCWSTR DispAssoc = pEntry->GetAssocForDisplay();
1828 LPCWSTR TypeName = GetTypeName(pEntry, pG);
1829 CStringW buf;
1830
1831 // format buffer and set description
1832 FileTypesDlg_SetGroupboxText(hwndDlg, DispAssoc);
1833 if (pEntry->IsExtension())
1834 buf.Format(IDS_FILE_DETAILSADV, DispAssoc, TypeName, TypeName);
1835 else
1836 buf = L"";
1837 SetDlgItemTextW(hwndDlg, IDC_FILETYPES_DESCRIPTION, buf.GetString());
1838
1839 // delete previous program image
1840 if (hbmProgram)
1841 {
1842 DeleteObject(hbmProgram);
1843 hbmProgram = NULL;
1844 }
1845
1846 // set program name
1847 LPCWSTR appname = GetAppName(pEntry);
1848 SetDlgItemTextW(hwndDlg, IDC_FILETYPES_APPNAME, appname);
1849
1850 // set program image
1851 HICON hIconSm = NULL;
1853 if (*exe)
1854 {
1855 ExtractIconExW(exe, 0, NULL, &hIconSm, 1);
1856 }
1857 hbmProgram = BitmapFromIcon(hIconSm, 16, 16);
1860
1861 // Enable/Disable the buttons
1863 !pG->Restricted && pEntry->IsExtension());
1865 !(pEntry->EditFlags & FTA_NoEdit) && !pG->Restricted);
1867 !(pEntry->EditFlags & FTA_NoRemove) && !pG->Restricted && pEntry->IsExtension());
1868}
1869
1870// IDD_FOLDER_OPTIONS_FILETYPES
1873 HWND hwndDlg,
1874 UINT uMsg,
1875 WPARAM wParam,
1876 LPARAM lParam)
1877{
1879 if (!pGlobals && uMsg != WM_INITDIALOG)
1880 return FALSE;
1881 LPNMLISTVIEW lppl;
1883 NEWEXT_DIALOG newext;
1884 EDITTYPE_DIALOG edittype;
1885
1886 switch (uMsg)
1887 {
1888 case WM_INITDIALOG:
1891 return TRUE;
1892
1893 case WM_DESTROY:
1894 SetWindowLongPtrW(hwndDlg, DWLP_USER, 0);
1895 if (pGlobals)
1896 {
1897 DestroyIcon(pGlobals->hDefExtIconSmall);
1898 DeleteObject(pGlobals->hOpenWithImage);
1900 }
1901 break;
1902
1903 case WM_COMMAND:
1904 switch (LOWORD(wParam))
1905 {
1906 case IDC_FILETYPES_NEW:
1907 newext.hwndLV = GetDlgItem(hwndDlg, IDC_FILETYPES_LISTVIEW);
1909 hwndDlg, NewExtDlgProc, (LPARAM)&newext))
1910 {
1911 FileTypesDlg_AddExt(hwndDlg, newext.szExt, newext.szFileType, pGlobals);
1912 }
1913 break;
1914
1916 FileTypesDlg_OnDelete(hwndDlg);
1917 break;
1918
1921 if (pEntry)
1922 {
1923 OPENASINFO oai = { pEntry->FileExtension, 0, OAIF_FORCE_REGISTRATION | OAIF_REGISTER_EXT };
1924 if (SUCCEEDED(SHOpenWithDialog(hwndDlg, &oai)))
1925 {
1926 pEntry->InvalidateDefaultApp();
1928 }
1929 }
1930 break;
1931
1933 edittype.hwndLV = GetDlgItem(hwndDlg, IDC_FILETYPES_LISTVIEW);
1934 edittype.pG = pGlobals;
1935 edittype.pEntry = FileTypesDlg_GetEntry(edittype.hwndLV);
1936 if (Normalize(edittype.pEntry))
1937 {
1939 hwndDlg, EditTypeDlgProc, (LPARAM)&edittype);
1940 FileTypesDlg_OnItemChanging(hwndDlg, edittype.pEntry, pGlobals);
1941 }
1942 break;
1943 }
1944 break;
1945
1946 case WM_NOTIFY:
1947 lppl = (LPNMLISTVIEW) lParam;
1948 switch (lppl->hdr.code)
1949 {
1950 case LVN_GETDISPINFO:
1951 {
1954 if (entry && (pLVDI->item.mask & LVIF_TEXT))
1955 {
1956 if (pLVDI->item.iSubItem == 1)
1957 {
1959 pLVDI->item.mask |= LVIF_DI_SETITEM;
1960 }
1961 }
1962 break;
1963 }
1964
1965 case LVN_KEYDOWN:
1966 {
1967 LV_KEYDOWN *pKeyDown = (LV_KEYDOWN *)lParam;
1968 switch (pKeyDown->wVKey)
1969 {
1970 case VK_DELETE:
1971 FileTypesDlg_OnDelete(hwndDlg);
1972 break;
1973 case VK_F5:
1974 FileTypesDlg_Refresh(hwndDlg, pKeyDown->hdr.hwndFrom, pGlobals);
1975 break;
1976 }
1977 break;
1978 }
1979
1980 case NM_DBLCLK:
1982 break;
1983
1984 case LVN_DELETEALLITEMS:
1985 return FALSE; // send LVN_DELETEITEM
1986
1987 case LVN_DELETEITEM:
1989 if (pEntry)
1990 {
1991 pEntry->DestroyIcons();
1992 HeapFree(pGlobals->hHeap, 0, pEntry);
1993 }
1994 return FALSE;
1995
1996 case LVN_ITEMCHANGING:
1998 if (!pEntry)
1999 {
2000 return TRUE;
2001 }
2002
2003 if (!(lppl->uOldState & LVIS_FOCUSED) && (lppl->uNewState & LVIS_FOCUSED))
2004 {
2006 }
2007 break;
2008
2009 case LVN_COLUMNCLICK:
2011 break;
2012
2013 case PSN_SETACTIVE:
2014 // On page activation, set the focus to the listview
2016 break;
2017 }
2018 break;
2019 }
2020
2021 return FALSE;
2022}
static HDC hDC
Definition: 3dtext.c:33
HRESULT WINAPI SHOpenWithDialog(HWND hwndParent, const OPENASINFO *poainfo)
signed char INT8
#define shell32_hInstance
xD9 x84 xD8 xAD xD9 x80 xF0 x90 xAC x9A xE0 xA7 xA6 xE0 xA7 xAA xF0 x91 x84 xA4 xF0 x91 x84 x89 xF0 x91 x84 x9B xF0 x90 x8A xAB xF0 x90 x8B x89 xE2 xB2 x9E xE2 xB2 x9F xD0 xBE xD0 x9E xF0 x90 x90 x84 xF0 x90 x90 xAC xE1 x83 x98 xE1 x83 x94 xE1 x83 x90 xE1 xB2 xBF xE2 xB0 x95 xE2 xB1 x85 xCE xBF xCE x9F xE0 xA8 xA0 xE0 xA8 xB0 xE0 xA9 xA6 Kayah xEA xA4 x8D xEA xA4 x80 Khmer xE1 xA7 xA1 xE1 xA7 xAA xE0 xBB x90 Latin Subscript Fallback
Definition: afscript.h:223
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define IDS_NONE
Definition: resource.h:135
HFONT hFont
Definition: main.c:53
HKEY hClassKey
Definition: umpnpmgr.c:45
#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)
POSITION AddHead(INARGTYPE element)
Definition: atlcoll.h:612
POSITION Find(INARGTYPE element, _In_opt_ POSITION posStartAfter=NULL) const
Definition: atlcoll.h:794
TVal & GetValueAt(int nIndex)
Definition: atlsimpcoll.h:358
TKey & GetKeyAt(int nIndex)
Definition: atlsimpcoll.h:341
BOOL SetAt(const TKey &key, const TVal &val)
Definition: atlsimpcoll.h:402
int FindKey(const TKey &key) const
Definition: atlsimpcoll.h:315
BOOL Remove(const TKey &key)
Definition: atlsimpcoll.h:378
int GetSize() const
Definition: atlsimpcoll.h:353
BOOL LoadString(_In_ UINT nID)
Definition: cstringt.h:639
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:818
CStringT & MakeLower()
Definition: cstringt.h:674
Definition: _map.h:48
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define OFN_EXPLORER
Definition: commdlg.h:104
#define OPENFILENAME_SIZE_VERSION_400W
Definition: commdlg.h:397
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
#define OFN_ENABLESIZING
Definition: commdlg.h:101
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
_wcslwr
_wcsupr
wcscpy
static TAGID TAGID find
Definition: db.cpp:155
#define ERROR_SUCCESS
Definition: deptool.c:10
LPWSTR Name
Definition: desk.c:124
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int idx
Definition: utils.c:41
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 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 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 RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
LONG WINAPI RegEnumKeyW(HKEY hKey, DWORD dwIndex, LPWSTR lpName, DWORD cbName)
Definition: reg.c:2393
INT WINAPI ImageList_GetImageCount(HIMAGELIST himl)
Definition: imagelist.c:2081
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:814
LPWSTR WINAPI StrChrW(LPCWSTR lpszStr, WCHAR ch)
Definition: string.c:464
LPWSTR WINAPI StrStrIW(LPCWSTR lpszStr, LPCWSTR lpszSearch)
Definition: string.c:380
short WINAPI GetFileTitleW(LPCWSTR lpFile, LPWSTR lpTitle, WORD cbBuf)
Definition: filedlg.c:4856
BOOL WINAPI GetOpenFileNameW(OPENFILENAMEW *ofn)
Definition: filedlg.c:4736
static const WCHAR rc2[]
Definition: oid.c:1216
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
#define wcsicmp
Definition: compat.h:15
static const WCHAR *const ext[]
Definition: module.c:53
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2352
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4243
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4262
const WCHAR * action
Definition: action.c:7509
static const WCHAR IconIndex[]
Definition: install.c:52
static const WCHAR IconPath[]
Definition: install.c:51
BOOL WINAPI PickIconDlg(HWND hWndOwner, LPWSTR lpstrFile, UINT nMaxFile, INT *lpdwIconIndex)
Definition: dialogs.cpp:351
#define VERBKEY_CCHMAX
Definition: precomp.h:130
HICON SHELL32_SHExtractIcon(LPCWSTR File, int Index, int cx, int cy)
Definition: utils.h:85
BOOL RegKeyExists(HKEY hKey, LPCWSTR Path)
Definition: utils.h:49
static DWORD RegSetString(HKEY hKey, LPCWSTR Name, LPCWSTR Str, DWORD Type OPTIONAL_(REG_SZ))
Definition: utils.h:67
static BOOL RegValueExists(HKEY hKey, LPCWSTR Name)
Definition: utils.h:43
DWORD RegSetOrDelete(HKEY hKey, LPCWSTR Name, DWORD Type, LPCVOID Data, DWORD Size)
Definition: utils.h:58
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:304
HRESULT WINAPI AssocQueryStringW(ASSOCF cfFlags, ASSOCSTR str, LPCWSTR pszAssoc, LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut)
Definition: assoc.c:436
int WINAPI PathParseIconLocationW(LPWSTR lpszPath)
Definition: path.c:1098
DWORD WINAPI SHDeleteKeyW(HKEY hKey, LPCWSTR lpszSubKey)
Definition: reg.c:1546
BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim)
Definition: string.c:1883
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
static BOOL DeleteExt(HWND hwndDlg, LPCWSTR pszExt)
Definition: filetypes.cpp:147
struct _FILE_TYPE_ENTRY FILE_TYPE_ENTRY
#define NOASSOCRESID
Definition: filetypes.cpp:34
#define LISTBOX_MARGIN
Definition: filetypes.cpp:356
static BOOL QueryFileDescription(LPCWSTR ProgramPath, LPWSTR pszName, INT cchName)
Definition: filetypes.cpp:259
static VOID FileTypesDlg_InitListView(HWND hwndDlg, HWND hListView)
Definition: filetypes.cpp:1670
static BOOL FileTypesDlg_RemoveExt(HWND hwndDlg)
Definition: filetypes.cpp:867
static BOOL EditTypeDlg_UpdateEntryIcon(HWND hwndDlg, PEDITTYPE_DIALOG pEditType)
Definition: filetypes.cpp:1114
struct EDITTYPE_DIALOG * PEDITTYPE_DIALOG
static BOOL GetFileTypeIconsEx(PFILE_TYPE_ENTRY Entry, LPCWSTR IconLocation, UINT IconSize)
Definition: filetypes.cpp:192
static INT CALLBACK FileTypesDlg_CompareItems(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
Definition: filetypes.cpp:1649
static BOOL NewExtDlg_OnInitDialog(HWND hwndDlg, PNEWEXT_DIALOG pNewExt)
Definition: filetypes.cpp:574
static INT_PTR CALLBACK NewActionDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: filetypes.cpp:979
static LPWSTR GetTypeName(PFILE_TYPE_ENTRY Entry, PFILE_TYPE_GLOBALS pG)
Definition: filetypes.cpp:287
static VOID NewExtDlg_OnAdvanced(HWND hwndDlg, PNEWEXT_DIALOG pNewExt)
Definition: filetypes.cpp:504
static HRESULT GetClassKey(const FILE_TYPE_ENTRY &FTE, LPCWSTR &SubKey)
Definition: filetypes.cpp:123
static BOOL EditTypeDlg_OnDrawItem(HWND hwndDlg, LPDRAWITEMSTRUCT pDraw, PEDITTYPE_DIALOG pEditType)
Definition: filetypes.cpp:407
static BOOL Normalize(PFILE_TYPE_ENTRY Entry)
Definition: filetypes.cpp:342
static BOOL EditTypeDlg_OnRemove(HWND hwndDlg, PEDITTYPE_DIALOG pEditType)
Definition: filetypes.cpp:1419
static void FileTypesDlg_Sort(PFILE_TYPE_GLOBALS pG, HWND hListView, INT Column=-1)
Definition: filetypes.cpp:1662
static BOOL EditTypeDlg_WriteClass(HWND hwndDlg, PEDITTYPE_DIALOG pEditType, LPCWSTR TypeName, EDITTYPEFLAGS Etf)
Definition: filetypes.cpp:1151
static void FileTypesDlg_OnDelete(HWND hwndDlg)
Definition: filetypes.cpp:1809
struct _FILE_TYPE_GLOBALS FILE_TYPE_GLOBALS
static INT_PTR CALLBACK NewExtDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: filetypes.cpp:678
static BOOL EditTypeDlg_OnMeasureItem(HWND hwndDlg, LPMEASUREITEMSTRUCT pMeasure, PEDITTYPE_DIALOG pEditType)
Definition: filetypes.cpp:471
static void EditActionDlg_OnOK(HWND hwndDlg, PACTION_DIALOG pEditAct)
Definition: filetypes.cpp:1015
#define TYPENAME_CCHMAX
Definition: filetypes.cpp:38
#define FTA_MODIFYMASK
Definition: filetypes.cpp:33
static void EditTypeDlg_OnChangeIcon(HWND hwndDlg, PEDITTYPE_DIALOG pEditType)
Definition: filetypes.cpp:375
static void EditTypeDlg_Restrict(HWND hwndDlg, PEDITTYPE_DIALOG pEditType)
Definition: filetypes.cpp:1095
static BOOL NewExtDlg_OnOK(HWND hwndDlg, PNEWEXT_DIALOG pNewExt)
Definition: filetypes.cpp:600
static INT_PTR CALLBACK EditTypeDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: filetypes.cpp:1609
static void QuoteAppPathForCommand(CStringW &path)
Definition: filetypes.cpp:140
static PFILE_TYPE_ENTRY FileTypesDlg_GetEntry(HWND hListView, INT iItem=-1)
Definition: filetypes.cpp:1792
EXTERN_C BOOL PathIsExeW(LPCWSTR lpszPath)
Definition: shellpath.c:539
#define ICONLOCATION_CCHMAX
Definition: filetypes.cpp:39
struct ACTION_DIALOG * PACTION_DIALOG
static void FileTypesDlg_Refresh(HWND hwndDlg, HWND hListView, PFILE_TYPE_GLOBALS pG)
Definition: filetypes.cpp:1718
static void InitializeDefaultIcons(PFILE_TYPE_GLOBALS pG)
Definition: filetypes.cpp:324
static LPCWSTR GetAppName(PFILE_TYPE_ENTRY Entry)
Definition: filetypes.cpp:272
static INT_PTR CALLBACK EditActionDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: filetypes.cpp:1050
static HICON DoExtractIcon(LPCWSTR IconPath, INT iIndex, UINT cx, UINT cy)
Definition: filetypes.cpp:178
#define ASSOC_CCHMAX
Definition: filetypes.cpp:37
struct NEWEXT_DIALOG * PNEWEXT_DIALOG
struct _FILE_TYPE_GLOBALS * PFILE_TYPE_GLOBALS
INT_PTR CALLBACK FolderOptionsFileTypesDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: filetypes.cpp:1872
static PFILE_TYPE_ENTRY FileTypesDlg_InsertToLV(HWND hListView, LPCWSTR Assoc, INT iItem, PFILE_TYPE_GLOBALS pG)
Definition: filetypes.cpp:715
static void NewActionDlg_OnOK(HWND hwndDlg, PACTION_DIALOG pNewAct)
Definition: filetypes.cpp:941
static DWORD GetRegDWORD(HKEY hKey, LPCWSTR Name, DWORD &Value, DWORD DefaultValue=0, BOOL Strict=FALSE)
Definition: filetypes.cpp:98
static void FileTypesDlg_OnItemChanging(HWND hwndDlg, PFILE_TYPE_ENTRY pEntry, PFILE_TYPE_GLOBALS pG)
Definition: filetypes.cpp:1824
static BOOL EditTypeDlg_OnInitDialog(HWND hwndDlg, PEDITTYPE_DIALOG pEditType)
Definition: filetypes.cpp:1575
static void FileTypesDlg_SetGroupboxText(HWND hwndDlg, LPCWSTR Assoc)
Definition: filetypes.cpp:1710
static BOOL GetFileTypeIconsByKey(HKEY hKey, PFILE_TYPE_ENTRY Entry, UINT IconSize)
Definition: filetypes.cpp:220
static BOOL FileTypesDlg_AddExt(HWND hwndDlg, LPCWSTR pszExt, LPCWSTR pszProgId, PFILE_TYPE_GLOBALS pG)
Definition: filetypes.cpp:804
static void EditTypeDlg_OnOK(HWND hwndDlg, PEDITTYPE_DIALOG pEditType)
Definition: filetypes.cpp:1387
static BOOL EditTypeDlg_ReadClass(HWND hwndDlg, PEDITTYPE_DIALOG pEditType, EDITTYPEFLAGS &Etf)
Definition: filetypes.cpp:1302
static LPCWSTR GetProgramPath(PFILE_TYPE_ENTRY Entry)
Definition: filetypes.cpp:243
static PFILE_TYPE_GLOBALS FileTypesDlg_Initialize(HWND hwndDlg)
Definition: filetypes.cpp:1756
EDITTYPEFLAGS
Definition: filetypes.cpp:358
@ ETF_BROWSESAME
Definition: filetypes.cpp:358
@ ETF_ALWAYSEXT
Definition: filetypes.cpp:358
static void ActionDlg_OnBrowse(HWND hwndDlg, PACTION_DIALOG pNewAct, BOOL bEdit=FALSE)
Definition: filetypes.cpp:901
static void EditTypeDlg_OnCommand(HWND hwndDlg, UINT id, UINT code, PEDITTYPE_DIALOG pEditType)
Definition: filetypes.cpp:1445
struct _FILE_TYPE_ENTRY * PFILE_TYPE_ENTRY
LPCWSTR g_pszSpace
LPCWSTR g_pszShell32
FxAutoRegKey hKey
PLIST_ENTRY pEntry
Definition: fxioqueue.cpp:4484
PFX_DRIVER_GLOBALS pGlobals
pKey DeleteObject()
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
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
#define DbgPrint
Definition: hal.h:12
UINT WINAPI ExtractIconExW(LPCWSTR lpszFile, INT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIcons)
Definition: iconcache.cpp:855
REFIID LPVOID DWORD_PTR dw
Definition: atlbase.h:40
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
uint32_t entry
Definition: isohybrid.c:63
static HBITMAP BitmapFromIcon(HICON hIcon)
Definition: kbswitch.c:300
#define REG_SZ
Definition: layer.c:22
if(dx< 0)
Definition: linetemp.h:194
#define ASSERT(a)
Definition: mode.c:44
#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 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 DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
static ATOM item
Definition: dde.c:856
DWORD exp
Definition: msg.c:16058
LPTSTR szFilter
Definition: mplay32.c:30
HICON hIconSm
Definition: msconfig.c:44
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
CAtlStringW CStringW
Definition: atlstr.h:130
unsigned int UINT
Definition: ndis.h:50
#define REG_BINARY
Definition: nt_native.h:1496
#define KEY_READ
Definition: nt_native.h:1023
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define KEY_WRITE
Definition: nt_native.h:1031
#define DWORD
Definition: nt_native.h:44
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
Definition: ntbasedef.h:327
#define UNICODE_NULL
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
#define L(x)
Definition: ntvdm.h:50
#define LOWORD(l)
Definition: pedump.c:82
long LONG
Definition: pedump.c:60
static const WCHAR szName[]
Definition: powrprof.c:45
#define PSN_SETACTIVE
Definition: prsht.h:115
#define LVSIL_SMALL
Definition: commctrl.h:2304
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
#define ListView_SetItemState(hwndLV, i, data, mask)
Definition: commctrl.h:2678
#define ListView_SetExtendedListViewStyleEx(hwndLV, dwMask, dw)
Definition: commctrl.h:2731
#define LVFI_STRING
Definition: commctrl.h:2442
#define LVS_EX_LABELTIP
Definition: commctrl.h:2748
#define LVN_COLUMNCLICK
Definition: commctrl.h:3144
#define NM_DBLCLK
Definition: commctrl.h:131
#define ListView_SetImageList(hwnd, himl, iImageList)
Definition: commctrl.h:2309
#define LVNI_SELECTED
Definition: commctrl.h:2429
#define ListView_GetItemText(hwndLV, i, iSubItem_, pszText_, cchTextMax_)
Definition: commctrl.h:2689
#define LVN_DELETEALLITEMS
Definition: commctrl.h:3139
#define LVN_GETDISPINFO
Definition: commctrl.h:3165
#define LVCF_WIDTH
Definition: commctrl.h:2592
_Out_opt_ int * cx
Definition: commctrl.h:585
#define ILC_COLOR32
Definition: commctrl.h:358
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2439
#define LVN_ITEMCHANGING
Definition: commctrl.h:3135
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2739
#define ImageList_RemoveAll(himl)
Definition: commctrl.h:556
#define LPSTR_TEXTCALLBACK
Definition: commctrl.h:2388
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2312
#define ListView_SortItems(hwndLV, _pfnCompare, _lPrm)
Definition: commctrl.h:2708
#define LVIS_SELECTED
Definition: commctrl.h:2324
#define LV_FINDINFO
Definition: commctrl.h:2450
#define LVIF_PARAM
Definition: commctrl.h:2316
#define LV_ITEM
Definition: commctrl.h:2342
struct tagNMLISTVIEW * LPNMLISTVIEW
#define ListView_DeleteAllItems(hwnd)
Definition: commctrl.h:2419
struct tagLVDISPINFOW * LPNMLVDISPINFOW
#define LVM_INSERTCOLUMNW
Definition: commctrl.h:2637
#define LVIF_TEXT
Definition: commctrl.h:2314
#define ListView_SetItem(hwnd, pitem)
Definition: commctrl.h:2406
#define LVCF_FMT
Definition: commctrl.h:2591
#define ImageList_AddIcon(himl, hicon)
Definition: commctrl.h:415
#define LVCF_SUBITEM
Definition: commctrl.h:2594
#define LV_ITEMW
Definition: commctrl.h:2337
#define ILC_MASK
Definition: commctrl.h:351
#define ListView_DeleteItem(hwnd, i)
Definition: commctrl.h:2416
#define LVN_KEYDOWN
Definition: commctrl.h:3189
#define LV_KEYDOWN
Definition: commctrl.h:3191
#define LVIF_IMAGE
Definition: commctrl.h:2315
#define LVIF_DI_SETITEM
Definition: commctrl.h:3171
#define LVM_INSERTITEMW
Definition: commctrl.h:2409
#define LVCF_TEXT
Definition: commctrl.h:2593
#define LVN_DELETEITEM
Definition: commctrl.h:3138
#define LVIS_FOCUSED
Definition: commctrl.h:2323
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2399
#define ListView_FindItem(hwnd, iStart, plvfi)
Definition: commctrl.h:2475
#define ListView_EnsureVisible(hwndLV, i, fPartialOK)
Definition: commctrl.h:2524
#define WM_NOTIFY
Definition: richedit.h:61
const WCHAR * str
#define REG_DWORD
Definition: sdbapi.c:596
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:430
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:167
#define SHGFI_TYPENAME
Definition: shellapi.h:168
#define SHGFI_USEFILEATTRIBUTES
Definition: shellapi.h:182
HRESULT hr
Definition: shlfolder.c:183
@ OAIF_REGISTER_EXT
Definition: shlobj.h:2689
@ OAIF_FORCE_REGISTRATION
Definition: shlobj.h:2691
#define SHCNE_ASSOCCHANGED
Definition: shlobj.h:1919
#define SHCNF_FLUSHNOWAIT
Definition: shlobj.h:1937
@ REST_NOFILEASSOCIATE
Definition: shlobj.h:1876
@ ASSOCSTR_EXECUTABLE
Definition: shlwapi.h:613
@ ASSOCF_INIT_IGNOREUNKNOWN
Definition: shlwapi.h:602
@ FTA_NoEditDflt
Definition: shlwapi.h:669
@ FTA_NoEditDesc
Definition: shlwapi.h:667
@ FTA_NoRemove
Definition: shlwapi.h:663
@ FTA_NoEditVerb
Definition: shlwapi.h:665
@ FTA_NoEdit
Definition: shlwapi.h:662
@ FTA_NoRemoveVerb
Definition: shlwapi.h:666
@ FTA_OpenIsSafe
Definition: shlwapi.h:674
@ FTA_NoNewVerb
Definition: shlwapi.h:664
@ FTA_NoEditIcon
Definition: shlwapi.h:668
@ FTA_Exclude
Definition: shlwapi.h:659
DWORD WINAPI SHRestricted(RESTRICTIONS rest)
Definition: shpolicy.c:150
#define IDD_ACTION
Definition: shresdef.h:550
#define IDS_COLUMN_EXTENSION
Definition: shresdef.h:142
#define IDC_FILETYPES_DESCRIPTION
Definition: shresdef.h:475
#define IDS_FILE_DETAILS
Definition: shresdef.h:189
#define IDC_ACTION_BROWSE
Definition: shresdef.h:526
#define IDS_REMOVE_EXT
Definition: shresdef.h:362
#define IDC_EDITTYPE_SET_DEFAULT
Definition: shresdef.h:518
#define IDS_NEWEXT_SPECIFY_EXT
Definition: shresdef.h:348
#define IDC_EDITTYPE_ICON
Definition: shresdef.h:511
#define IDC_EDITTYPE_EDIT_BUTTON
Definition: shresdef.h:516
#define IDI_SHELL_EXE
Definition: shresdef.h:581
#define IDC_NEWEXT_ADVANCED
Definition: shresdef.h:481
#define IDC_NEWEXT_COMBOBOX
Definition: shresdef.h:482
#define IDC_FILETYPES_LISTVIEW
Definition: shresdef.h:469
#define IDC_EDITTYPE_CONFIRM_OPEN
Definition: shresdef.h:519
#define IDC_EDITTYPE_TEXT
Definition: shresdef.h:512
#define IDC_ACTION_USE_DDE
Definition: shresdef.h:527
#define IDC_FILETYPES_DETAILS_GROUPBOX
Definition: shresdef.h:472
#define IDS_EXE_FILTER
Definition: shresdef.h:359
#define IDS_SPECIFY_ACTION
Definition: shresdef.h:355
#define IDD_NEWEXTENSION
Definition: shresdef.h:548
#define IDS_NEWEXT_EXT_IN_USE
Definition: shresdef.h:350
#define IDS_NEWEXT_ADVANCED_RIGHT
Definition: shresdef.h:353
#define IDS_NEWEXT_ALREADY_ASSOC
Definition: shresdef.h:349
#define IDC_FILETYPES_ICON
Definition: shresdef.h:477
#define IDS_INVALID_PROGRAM
Definition: shresdef.h:356
#define IDC_ACTION_APP
Definition: shresdef.h:525
#define IDS_NEWEXT_ADVANCED_LEFT
Definition: shresdef.h:352
#define IDC_EDITTYPE_LISTBOX
Definition: shresdef.h:514
#define IDC_EDITTYPE_SHOW_EXT
Definition: shresdef.h:520
#define IDD_EDITTYPE
Definition: shresdef.h:549
#define IDC_FILETYPES_APPNAME
Definition: shresdef.h:473
#define IDS_REMOVE_ACTION
Definition: shresdef.h:357
#define IDS_NEWEXT_NEW
Definition: shresdef.h:351
#define IDC_NEWEXT_ASSOC
Definition: shresdef.h:483
#define IDC_FILETYPES_ADVANCED
Definition: shresdef.h:476
#define IDS_OPEN_WITH
Definition: shresdef.h:134
#define IDS_FILE_TYPES
Definition: shresdef.h:188
#define IDS_ACTION_EXISTS
Definition: shresdef.h:358
#define IDC_FILETYPES_DELETE
Definition: shresdef.h:471
#define IDC_EDITTYPE_NEW
Definition: shresdef.h:515
#define IDC_EDITTYPE_SAME_WINDOW
Definition: shresdef.h:521
#define IDC_FILETYPES_CHANGE
Definition: shresdef.h:474
#define IDC_NEWEXT_EDIT
Definition: shresdef.h:480
#define IDS_FILE_DETAILSADV
Definition: shresdef.h:190
#define IDC_FILETYPES_NEW
Definition: shresdef.h:470
#define IDC_EDITTYPE_CHANGE_ICON
Definition: shresdef.h:513
#define IDS_EDITING_ACTION
Definition: shresdef.h:360
#define IDC_ACTION_ACTION
Definition: shresdef.h:524
#define IDC_EDITTYPE_REMOVE
Definition: shresdef.h:517
OPENFILENAME ofn
Definition: sndrec32.cpp:56
#define _countof(array)
Definition: sndvol32.h:70
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
PFILE_TYPE_GLOBALS pG
Definition: filetypes.cpp:893
PFILE_TYPE_ENTRY pEntry
Definition: filetypes.cpp:894
WCHAR szAction[VERBKEY_CCHMAX]
Definition: filetypes.cpp:895
WCHAR szApp[MAX_PATH]
Definition: filetypes.cpp:896
CSimpleMap< CStringW, CStringW > CommandLineMap
Definition: filetypes.cpp:365
CAtlList< CStringW > ModifiedVerbs
Definition: filetypes.cpp:366
WCHAR szDefaultVerb[VERBKEY_CCHMAX]
Definition: filetypes.cpp:370
WCHAR TypeName[TYPENAME_CCHMAX]
Definition: filetypes.cpp:371
WCHAR szIconPath[MAX_PATH]
Definition: filetypes.cpp:367
PFILE_TYPE_GLOBALS pG
Definition: filetypes.cpp:363
PFILE_TYPE_ENTRY pEntry
Definition: filetypes.cpp:364
base of all file and directory entries
Definition: entries.h:83
LONG lfWeight
Definition: dimm.idl:63
WCHAR szExt[16]
Definition: filetypes.cpp:499
WCHAR szFileType[64]
Definition: filetypes.cpp:500
Definition: filetypes.cpp:42
DWORD EditFlags
Definition: filetypes.cpp:46
void DestroyIcons()
Definition: filetypes.cpp:77
bool IsExtension() const
Definition: filetypes.cpp:53
WCHAR AppName[64]
Definition: filetypes.cpp:47
WCHAR ClassKey[MAX_PATH]
Definition: filetypes.cpp:45
void Initialize()
Definition: filetypes.cpp:69
WCHAR FileExtension[ASSOC_CCHMAX]
Definition: filetypes.cpp:43
void InvalidateDefaultApp()
Definition: filetypes.cpp:65
WCHAR FileDescription[TYPENAME_CCHMAX]
Definition: filetypes.cpp:44
HICON hIconSmall
Definition: filetypes.cpp:48
INT nIconIndex
Definition: filetypes.cpp:51
WCHAR IconPath[MAX_PATH]
Definition: filetypes.cpp:50
void InvalidateTypeName()
Definition: filetypes.cpp:61
WCHAR ProgramPath[MAX_PATH]
Definition: filetypes.cpp:49
LPCWSTR GetAssocForDisplay() const
Definition: filetypes.cpp:57
HIMAGELIST himlSmall
Definition: filetypes.cpp:87
HBITMAP hOpenWithImage
Definition: filetypes.cpp:90
WCHAR NoneString[42]
Definition: filetypes.cpp:92
WCHAR szTypeName[80]
Definition: shellapi.h:377
WCHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:376
Definition: ftp_var.h:139
Definition: inflate.c:139
Definition: dsound.c:943
Definition: copy.c:22
LPWSTR pszText
Definition: commctrl.h:2572
LVITEMW item
Definition: commctrl.h:3184
LPWSTR pszText
Definition: commctrl.h:2370
int iSubItem
Definition: commctrl.h:2367
UINT mask
Definition: commctrl.h:2365
LPARAM lParam
Definition: commctrl.h:2373
int iImage
Definition: commctrl.h:2372
UINT code
Definition: winuser.h:3170
HWND hwndFrom
Definition: winuser.h:3168
UINT uNewState
Definition: commctrl.h:3041
UINT uOldState
Definition: commctrl.h:3042
LPCSTR lpstrDefExt
Definition: commdlg.h:345
HWND hwndOwner
Definition: commdlg.h:330
LPCSTR lpstrTitle
Definition: commdlg.h:341
LPSTR lpstrFile
Definition: commdlg.h:336
DWORD Flags
Definition: commdlg.h:342
DWORD lStructSize
Definition: commdlg.h:329
LPCSTR lpstrFilter
Definition: commdlg.h:332
DWORD nMaxFile
Definition: commdlg.h:337
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
Definition: time.h:68
int32_t INT_PTR
Definition: typedefs.h:64
unsigned char * LPBYTE
Definition: typedefs.h:53
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
#define HIWORD(l)
Definition: typedefs.h:247
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
int ret
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
#define ZeroMemory
Definition: winbase.h:1743
_In_ PSID _Out_writes_to_opt_ cchName LPSTR _Inout_ LPDWORD cchName
Definition: winbase.h:2798
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define S_FALSE
Definition: winerror.h:2357
#define ERROR_BAD_FORMAT
Definition: winerror.h:114
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
#define FW_BOLD
Definition: wingdi.h:378
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
#define GetObject
Definition: wingdi.h:4468
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define RegOpenKeyEx
Definition: winreg.h:520
#define RegCreateKeyEx
Definition: winreg.h:501
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define LB_ERR
Definition: winuser.h:2443
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
DWORD WINAPI GetSysColor(_In_ int)
#define LB_GETCOUNT
Definition: winuser.h:2049
#define ODS_SELECTED
Definition: winuser.h:2556
#define SW_HIDE
Definition: winuser.h:779
#define SWP_NOACTIVATE
Definition: winuser.h:1253
#define DT_NOPREFIX
Definition: winuser.h:537
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define IMAGE_BITMAP
Definition: winuser.h:211
#define DWLP_USER
Definition: winuser.h:883
#define GetWindowLongPtrW
Definition: winuser.h:4840
#define COLOR_WINDOW
Definition: winuser.h:929
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
struct tagMEASUREITEMSTRUCT * LPMEASUREITEMSTRUCT
#define STM_SETICON
Definition: winuser.h:2103
#define IDCANCEL
Definition: winuser.h:842
#define LB_GETTEXT
Definition: winuser.h:2060
#define SM_CYVSCROLL
Definition: winuser.h:992
#define IMAGE_ICON
Definition: winuser.h:212
#define COLOR_WINDOWTEXT
Definition: winuser.h:932
#define LBN_DBLCLK
Definition: winuser.h:2082
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define COLOR_HIGHLIGHT
Definition: winuser.h:937
#define DT_SINGLELINE
Definition: winuser.h:540
#define WM_COMMAND
Definition: winuser.h:1751
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2540
#define CB_SETCURSEL
Definition: winuser.h:1972
#define SM_CYSMICON
Definition: winuser.h:1024
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define SW_SHOWNOACTIVATE
Definition: winuser.h:785
#define RDW_UPDATENOW
Definition: winuser.h:1231
#define RDW_ERASE
Definition: winuser.h:1222
#define WM_INITDIALOG
Definition: winuser.h:1750
#define MB_YESNO
Definition: winuser.h:828
#define LB_ADDSTRING
Definition: winuser.h:2042
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define WM_GETFONT
Definition: winuser.h:1662
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define STM_SETIMAGE
Definition: winuser.h:2104
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:841
#define WM_DRAWITEM
Definition: winuser.h:1656
#define BM_SETCHECK
Definition: winuser.h:1932
#define STM_GETICON
Definition: winuser.h:2101
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MB_ICONERROR
Definition: winuser.h:798
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define SM_CXSMICON
Definition: winuser.h:1023
#define DT_LEFT
Definition: winuser.h:534
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define LB_DELETESTRING
Definition: winuser.h:2043
#define SM_CYICON
Definition: winuser.h:984
#define VK_F5
Definition: winuser.h:2270
HWND WINAPI SetFocus(_In_opt_ HWND)
#define LB_FINDSTRING
Definition: winuser.h:2045
#define EM_SETLIMITTEXT
Definition: winuser.h:2022
#define RDW_ALLCHILDREN
Definition: winuser.h:1232
#define IDNO
Definition: winuser.h:847
#define LB_INSERTSTRING
Definition: winuser.h:2064
#define CB_ADDSTRING
Definition: winuser.h:1947
#define RDW_FRAME
Definition: winuser.h:1223
#define SendMessage
Definition: winuser.h:5863
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:938
HDC WINAPI GetDC(_In_opt_ HWND)
#define EM_SETSEL
Definition: winuser.h:2029
#define WM_MEASUREITEM
Definition: winuser.h:1657
#define MB_ICONWARNING
Definition: winuser.h:797
#define DT_VCENTER
Definition: winuser.h:543
#define PostMessage
Definition: winuser.h:5852
#define LBN_SELCHANGE
Definition: winuser.h:2086
#define MB_ICONQUESTION
Definition: winuser.h:800
#define MB_ICONINFORMATION
Definition: winuser.h:813
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define VK_DELETE
Definition: winuser.h:2244
#define WM_DESTROY
Definition: winuser.h:1620
#define LB_SETCURSEL
Definition: winuser.h:2074
#define WM_KEYDOWN
Definition: winuser.h:1726
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDYES
Definition: winuser.h:846
#define SWP_NOZORDER
Definition: winuser.h:1258
#define LB_GETCURSEL
Definition: winuser.h:2050
#define SetWindowLongPtrW
Definition: winuser.h:5366
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define SM_CXICON
Definition: winuser.h:983
#define ODS_FOCUS
Definition: winuser.h:2560
int WINAPI GetSystemMetrics(_In_ int)
#define RDW_INVALIDATE
Definition: winuser.h:1225
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define BM_GETCHECK
Definition: winuser.h:1929
HDWP WINAPI BeginDeferWindowPos(_In_ int)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2390
#define WM_SETREDRAW
Definition: winuser.h:1627
__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