ReactOS 0.4.16-dev-178-g8ba6102
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{
97
98static DWORD
99GetRegDWORD(HKEY hKey, LPCWSTR Name, DWORD &Value, DWORD DefaultValue = 0, BOOL Strict = FALSE)
100{
101 DWORD cb = sizeof(DWORD), type;
102 LRESULT ec = RegQueryValueExW(hKey, Name, 0, &type, (BYTE*)&Value, &cb);
103 if (ec == ERROR_SUCCESS)
104 {
105 if ((type == REG_DWORD && cb == sizeof(DWORD)) ||
106 (!Strict && type == REG_BINARY && (cb && cb <= sizeof(DWORD))))
107 {
108 Value &= (0xffffffffUL >> (32 - cb * 8));
109 return ec;
110 }
111 }
112 Value = DefaultValue;
113 return ec ? ec : ERROR_BAD_FORMAT;
114}
115
116static DWORD
118{
119 GetRegDWORD(hKey, Name, DefaultValue, DefaultValue, FALSE);
120 return DefaultValue;
121}
122
123static HRESULT
125{
126 HRESULT hr = S_OK;
127 LPCWSTR path = FTE.IsExtension() ? FTE.ClassKey : FTE.FileExtension;
128#if SUPPORT_EXTENSIONWITHOUTPROGID
129 if (!*path && FTE.IsExtension())
130 {
131 path = FTE.FileExtension;
132 hr = S_FALSE;
133 }
134#endif
135 ASSERT(*path);
136 SubKey = path;
137 return hr;
138}
139
140static void
142{
143 if (path.Find(' ') >= 0 && path.Find('\"') < 0)
144 path = CStringW(L"\"") + path + L"\"";
145}
146
147static BOOL
148DeleteExt(HWND hwndDlg, LPCWSTR pszExt)
149{
150 if (*pszExt != L'.')
151 return FALSE;
152
153 // open ".ext" key
154 HKEY hKey;
156 return FALSE;
157
158 // query "extfile" key name
159 WCHAR ProgId[MAX_PATH] = { 0 };
160 DWORD cb = sizeof(ProgId);
161 RegQueryValueExW(hKey, NULL, NULL, NULL, LPBYTE(ProgId), &cb);
163
164 // FIXME: Should verify that no other extensions are using this ProgId
165 // delete "extfile" key (if any)
166 if (ProgId[0])
168
169 // delete ".ext" key
171
172 // notify
174
175 return ret;
176}
177
178static inline HICON
180{
181 return SHELL32_SHExtractIcon(IconPath, iIndex, cx, cy);
182}
183
184static HICON
186{
189 return DoExtractIcon(IconPath, iIndex, cx, cy);
190}
191
192static BOOL
194{
195 Entry->hIconSmall = NULL;
196 if (lstrcmpW(IconLocation, L"%1") == 0)
197 {
198 LPCWSTR ext = Entry->FileExtension;
199 if (!lstrcmpiW(ext, L".exe") || !lstrcmpiW(ext, L".scr"))
200 {
202 IMAGE_ICON, IconSize, IconSize, 0));
203 Entry->nIconIndex = -IDI_SHELL_EXE;
204 }
205 // Set the icon path to %1 on purpose so PickIconDlg will issue a warning
206 StringCbCopyW(Entry->IconPath, sizeof(Entry->IconPath), IconLocation);
207 }
208 else
209 {
210 // Expand the REG_EXPAND_SZ string by environment variables
211 if (ExpandEnvironmentStringsW(IconLocation, Entry->IconPath, _countof(Entry->IconPath)))
212 {
213 Entry->nIconIndex = PathParseIconLocationW(Entry->IconPath);
214 Entry->hIconSmall = DoExtractIcon(Entry->IconPath, Entry->nIconIndex, IconSize, IconSize);
215 }
216 }
217 return Entry->hIconSmall != NULL;
218}
219
220static BOOL
222{
223 Entry->hIconSmall = NULL;
224
225 HKEY hDefIconKey;
226 LONG nResult = RegOpenKeyExW(hKey, L"DefaultIcon", 0, KEY_READ, &hDefIconKey);
227 if (nResult != ERROR_SUCCESS)
228 return FALSE;
229
230 // Get the icon location
231 WCHAR szLocation[ICONLOCATION_CCHMAX];
232 DWORD dwSize = sizeof(szLocation);
233 nResult = RegQueryValueExW(hDefIconKey, NULL, NULL, NULL, LPBYTE(szLocation), &dwSize);
234 szLocation[_countof(szLocation) - 1] = UNICODE_NULL;
235
236 RegCloseKey(hDefIconKey);
237 if (nResult != ERROR_SUCCESS || !szLocation[0])
238 return FALSE;
239
240 return GetFileTypeIconsEx(Entry, szLocation, IconSize);
241}
242
243static LPCWSTR
245{
246 if (!Entry->ProgramPath[1] && !Entry->ProgramPath[0])
247 {
248 DWORD cch = _countof(Entry->ProgramPath);
250 Entry->FileExtension, NULL, Entry->ProgramPath, &cch)))
251 {
252 Entry->ProgramPath[0] = UNICODE_NULL;
253 Entry->ProgramPath[1] = TRUE;
254 }
255 }
256 return Entry->ProgramPath;
257}
258
259static BOOL
261{
262 SHFILEINFOW fi;
264 if (SHGetFileInfoW(ProgramPath, 0, &fi, sizeof(fi), SHGFI_DISPLAYNAME))
265 {
267 return TRUE;
268 }
269 return !!GetFileTitleW(ProgramPath, pszName, cchName);
270}
271
272static LPCWSTR
274{
275 if (!Entry->AppName[1] && !Entry->AppName[0])
276 {
278 if (!*exe || !QueryFileDescription(exe, Entry->AppName, _countof(Entry->AppName)))
279 {
280 Entry->AppName[0] = UNICODE_NULL;
281 Entry->AppName[1] = TRUE;
282 }
283 }
284 return Entry->AppName;
285}
286
287static LPWSTR
289{
290 if (!Entry->FileDescription[1] && !Entry->FileDescription[0])
291 {
292 Entry->FileDescription[1] = TRUE;
293 if (Entry->IsExtension())
294 {
295 SHFILEINFOW fi;
296 if (SHGetFileInfoW(Entry->FileExtension, 0, &fi, sizeof(fi), SHGFI_TYPENAME |
298 {
299 StringCchCopyW(Entry->FileDescription, _countof(Entry->FileDescription), fi.szTypeName);
300 }
301 else
302 {
303 // FIXME: Remove this hack when SHGetFileInfo is able to handle extensions without a ProgId (.ASM etc)
304 StringCchPrintfW(Entry->FileDescription, _countof(Entry->FileDescription),
305 pG->DefExtTypeNameFmt, &Entry->FileExtension[1]);
306 }
307 }
308 else
309 {
310 // FIXME: Fix and use ASSOCSTR_FRIENDLYDOCNAME
311 DWORD cb = sizeof(Entry->FileDescription), Fallback = TRUE;
312 LPCWSTR ClassKey;
313 HRESULT hr = GetClassKey(*Entry, ClassKey);
314 HKEY hKey;
315 if (SUCCEEDED(hr) && !RegOpenKeyExW(HKEY_CLASSES_ROOT, ClassKey, 0, KEY_READ, &hKey))
316 {
317 Fallback = RegQueryValueExW(hKey, NULL, 0, NULL, (BYTE*)Entry->FileDescription, &cb) != ERROR_SUCCESS ||
318 !*Entry->FileDescription;
320 }
321 if (Fallback)
322 {
323 StringCchCopyW(Entry->FileDescription, _countof(Entry->FileDescription), Entry->FileExtension);
324 }
325 }
326 }
327 return Entry->FileDescription;
328}
329
330static void
332{
333 const INT ResId = NOASSOCRESID;
334 if (!pG->hDefExtIconSmall)
335 {
337 IMAGE_ICON, pG->IconSize, pG->IconSize, 0));
338 }
339
341 {
343 ASSERT(idx == 0);
344 }
345}
346
347static BOOL
349{
350 // We don't need this information until somebody tries to edit the entry
351 if (!Entry->IconPath[0])
352 {
353 StringCbCopyW(Entry->IconPath, sizeof(Entry->IconPath), g_pszShell32);
354 Entry->nIconIndex = NOASSOCRESID > 1 ? -NOASSOCRESID : 0;
355 }
356 return TRUE;
357}
358
360// EditTypeDlg
361
362#define LISTBOX_MARGIN 2
363
364enum EDITTYPEFLAGS { ETF_ALWAYSEXT = 1 << 0, ETF_BROWSESAME = 1 << 1 };
365
366typedef struct EDITTYPE_DIALOG
367{
378
379static void
381{
383 INT IconIndex = pEditType->nIconIndex;
385 if (PickIconDlg(hwndDlg, szPath, _countof(szPath), &IconIndex))
386 {
387 HICON hIconLarge = DoExtractIcon(szPath, IconIndex, FALSE);
388
389 // replace Windows directory with "%SystemRoot%" (for portability)
390 WCHAR szWinDir[MAX_PATH];
391 UINT lenWinDir = GetWindowsDirectoryW(szWinDir, _countof(szWinDir));
392 if (StrStrIW(szPath, szWinDir) == szPath)
393 {
394 CPathW str(L"%SystemRoot%");
395 str.Append(&szPath[lenWinDir]);
396 StringCbCopyW(szPath, sizeof(szPath), str);
397 }
398
399 // update EDITTYPE_DIALOG
400 StringCbCopyW(pEditType->szIconPath, sizeof(pEditType->szIconPath), szPath);
401 pEditType->nIconIndex = IconIndex;
402
403 // set icon to dialog
404 HICON hOld = (HICON)SendDlgItemMessageW(hwndDlg, IDC_EDITTYPE_ICON, STM_SETICON, (WPARAM)hIconLarge, 0);
405 if (hOld)
406 DestroyIcon(hOld);
407 }
408}
409
410static BOOL
412{
413 WCHAR szText[MAX_PATH];
414 HFONT hFont, hFont2;
415
416 if (!pDraw)
417 return FALSE;
418
419 // fill rect and set colors
420 if (pDraw->itemState & ODS_SELECTED)
421 {
422 FillRect(pDraw->hDC, &pDraw->rcItem, HBRUSH(COLOR_HIGHLIGHT + 1));
425 }
426 else
427 {
428 FillRect(pDraw->hDC, &pDraw->rcItem, HBRUSH(COLOR_WINDOW + 1));
431 }
432
433 // get listbox text
434 HWND hwndListBox = GetDlgItem(hwndDlg, IDC_EDITTYPE_LISTBOX);
435 SendMessageW(hwndListBox, LB_GETTEXT, pDraw->itemID, (LPARAM)szText);
436
437 // is it default?
438 hFont = (HFONT)SendMessageW(hwndListBox, WM_GETFONT, 0, 0);
439 if (lstrcmpiW(pEditType->szDefaultVerb, szText) == 0)
440 {
441 // default. set bold
442 LOGFONTW lf;
443 GetObject(hFont, sizeof(lf), &lf);
444 lf.lfWeight = FW_BOLD;
445 hFont2 = CreateFontIndirectW(&lf);
446 if (hFont2)
447 {
448 HGDIOBJ hFontOld = SelectObject(pDraw->hDC, hFont2);
450 DrawTextW(pDraw->hDC, szText, -1, &pDraw->rcItem,
453 SelectObject(pDraw->hDC, hFontOld);
454 DeleteObject(hFont2);
455 }
456 }
457 else
458 {
459 // non-default
461 DrawTextW(pDraw->hDC, szText, -1, &pDraw->rcItem,
464 }
465
466 // draw focus rect
467 if (pDraw->itemState & ODS_FOCUS)
468 {
469 DrawFocusRect(pDraw->hDC, &pDraw->rcItem);
470 }
471 return TRUE;
472}
473
474static BOOL
476{
477 if (!pMeasure)
478 return FALSE;
479
480 HWND hwndLB = GetDlgItem(hwndDlg, IDC_EDITTYPE_LISTBOX);
481
482 HDC hDC = GetDC(hwndLB);
483 if (hDC)
484 {
487 pMeasure->itemHeight = tm.tmHeight + LISTBOX_MARGIN * 2;
488 ReleaseDC(hwndLB, hDC);
489 return TRUE;
490 }
491 return FALSE;
492}
493
495// NewExtDlg
496
497typedef struct NEWEXT_DIALOG
498{
506
507static VOID
509{
510 // If "Advanced" button was clicked, then we shrink or expand the dialog.
511 RECT rc, rc1, rc2;
512
513 GetWindowRect(hwndDlg, &rc);
514 rc.bottom = rc.top + (pNewExt->rcDlg.bottom - pNewExt->rcDlg.top);
515
516 GetWindowRect(GetDlgItem(hwndDlg, IDOK), &rc1);
517 MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rc1, 2);
518
520 MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rc2, 2);
521
522 HWND hClassCombo = GetDlgItem(hwndDlg, IDC_NEWEXT_COMBOBOX);
523 if (pNewExt->bAdvanced)
524 {
525 rc1.top += pNewExt->dy;
526 rc1.bottom += pNewExt->dy;
527
528 rc2.top += pNewExt->dy;
529 rc2.bottom += pNewExt->dy;
530
532 ShowWindow(hClassCombo, SW_SHOWNOACTIVATE);
533
535 SetDlgItemTextW(hwndDlg, IDC_NEWEXT_ADVANCED, strLeft);
536
537 SetFocus(hClassCombo);
538 }
539 else
540 {
541 rc1.top -= pNewExt->dy;
542 rc1.bottom -= pNewExt->dy;
543
544 rc2.top -= pNewExt->dy;
545 rc2.bottom -= pNewExt->dy;
546
548 ShowWindow(hClassCombo, SW_HIDE);
549
551 SetDlgItemTextW(hwndDlg, IDC_NEWEXT_ADVANCED, strRight);
552
553 rc.bottom -= pNewExt->dy;
554
555 SendMessageW(hClassCombo, CB_SETCURSEL, 0, 0); // Reset the combo to the "new class" mode
556 }
557
558 HDWP hDWP = BeginDeferWindowPos(3);
559
560 if (hDWP)
561 hDWP = DeferWindowPos(hDWP, GetDlgItem(hwndDlg, IDOK), NULL,
562 rc1.left, rc1.top, rc1.right - rc1.left, rc1.bottom - rc1.top,
564 if (hDWP)
565 hDWP = DeferWindowPos(hDWP, GetDlgItem(hwndDlg, IDCANCEL), NULL,
566 rc2.left, rc2.top, rc2.right - rc2.left, rc2.bottom - rc2.top,
568 if (hDWP)
569 hDWP = DeferWindowPos(hDWP, hwndDlg, NULL,
570 rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
572
573 if (hDWP)
574 EndDeferWindowPos(hDWP);
575}
576
577static BOOL
579{
580 pNewExt->bAdvanced = FALSE;
581
582 // get window rectangle
583 GetWindowRect(hwndDlg, &pNewExt->rcDlg);
584
585 // get delta Y
586 RECT rc1, rc2;
589 pNewExt->dy = rc2.top - rc1.top;
590
591 // initialize
596
597 // shrink it first time
598 NewExtDlg_OnAdvanced(hwndDlg, pNewExt);
599
600 return TRUE;
601}
602
603static BOOL
605{
607 INT iItem;
608
609 GetDlgItemTextW(hwndDlg, IDC_NEWEXT_EDIT, pNewExt->szExt, _countof(pNewExt->szExt));
610 StrTrimW(pNewExt->szExt, g_pszSpace);
611 _wcsupr(pNewExt->szExt);
612
613#if 0
614 // FIXME: Implement the "choose existing class" mode
616 StrTrimW(pNewExt->szFileType, g_pszSpace);
617#endif
618 pNewExt->szFileType[0] = UNICODE_NULL; // "new class" mode
619
620 if (pNewExt->szExt[0] == 0)
621 {
624 MessageBoxW(hwndDlg, strText, strTitle, MB_ICONERROR);
625 return FALSE;
626 }
627
628 ZeroMemory(&find, sizeof(find));
629 find.flags = LVFI_STRING;
630 if (pNewExt->szExt[0] == L'.')
631 {
632 find.psz = &pNewExt->szExt[1];
633 }
634 else
635 {
636 find.psz = pNewExt->szExt;
637 }
638
639 iItem = ListView_FindItem(pNewExt->hwndLV, -1, &find);
640 if (iItem >= 0)
641 {
642 // already exists
643
644 // get file type
645 WCHAR szFileType[TYPENAME_CCHMAX];
647 ZeroMemory(&item, sizeof(item));
648 item.mask = LVIF_TEXT;
649 item.pszText = szFileType;
650 item.cchTextMax = _countof(szFileType);
651 item.iItem = iItem;
652 item.iSubItem = 1;
653 ListView_GetItem(pNewExt->hwndLV, &item);
654
655 // get text
656 CStringW strText;
657 strText.Format(IDS_NEWEXT_ALREADY_ASSOC, find.psz, szFileType, find.psz, szFileType);
658
659 // get title
660 CStringW strTitle;
662
663 if (MessageBoxW(hwndDlg, strText, strTitle, MB_ICONWARNING | MB_YESNO) == IDNO)
664 {
665 return FALSE;
666 }
667
668 // Delete the extension
669 CStringW strExt(L".");
670 strExt += find.psz;
671 strExt.MakeLower();
672 if (DeleteExt(hwndDlg, strExt))
673 ListView_DeleteItem(pNewExt->hwndLV, iItem);
674 }
675
676 EndDialog(hwndDlg, IDOK);
677 return TRUE;
678}
679
680// IDD_NEWEXTENSION
681static INT_PTR CALLBACK
683 HWND hwndDlg,
684 UINT uMsg,
687{
688 static PNEWEXT_DIALOG s_pNewExt = NULL;
689
690 switch (uMsg)
691 {
692 case WM_INITDIALOG:
693 s_pNewExt = (PNEWEXT_DIALOG)lParam;
694 NewExtDlg_OnInitDialog(hwndDlg, s_pNewExt);
695 return TRUE;
696
697 case WM_COMMAND:
698 switch (LOWORD(wParam))
699 {
700 case IDOK:
701 NewExtDlg_OnOK(hwndDlg, s_pNewExt);
702 break;
703
704 case IDCANCEL:
705 EndDialog(hwndDlg, IDCANCEL);
706 break;
707
709 s_pNewExt->bAdvanced = !s_pNewExt->bAdvanced;
710 NewExtDlg_OnAdvanced(hwndDlg, s_pNewExt);
711 break;
712 }
713 break;
714 }
715 return 0;
716}
717
718static PFILE_TYPE_ENTRY
720{
722 HKEY hKey, hTemp;
723 LVITEMW lvItem;
725
727 {
728 return NULL;
729 }
730 if (Assoc[0] != L'.' && !RegValueExists(hKey, L"URL Protocol"))
731 {
733 return NULL;
734 }
735
737 if (!Entry)
738 {
740 return NULL;
741 }
742 Entry->Initialize();
743
744 if (Assoc[0] == L'.')
745 {
746 if (PathIsExeW(Assoc))
747 {
748exclude:
749 HeapFree(pG->hHeap, 0, Entry);
751 return NULL;
752 }
753
754 dwSize = sizeof(Entry->ClassKey);
755 if (RegQueryValueExW(hKey, NULL, NULL, NULL, LPBYTE(Entry->ClassKey), &dwSize))
756 {
757 Entry->ClassKey[0] = UNICODE_NULL; // No ProgId
758 }
759#if SUPPORT_EXTENSIONWITHOUTPROGID
760 if (Entry->ClassKey[0] && !RegOpenKeyExW(HKEY_CLASSES_ROOT, Entry->ClassKey, 0, KEY_READ, &hTemp))
761 {
763 hKey = hTemp;
764 }
765#else
766 if (!Entry->ClassKey[0])
767 goto exclude;
768#endif
769 }
770
771 Entry->EditFlags = GetRegDWORD(hKey, L"EditFlags", 0);
772 if (Entry->EditFlags & FTA_Exclude)
773 goto exclude;
774
775 wcscpy(Entry->FileExtension, Assoc);
776
777 // get icon
778 Entry->IconPath[0] = UNICODE_NULL;
779 BOOL defaultIcon = !GetFileTypeIconsByKey(hKey, Entry, pG->IconSize);
780
782
783 // add icon to imagelist
784 INT iSmallImage = 0;
785 if (!defaultIcon && Entry->hIconSmall)
786 {
787 iSmallImage = ImageList_AddIcon(pG->himlSmall, Entry->hIconSmall);
788 }
789
790 lvItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
791 lvItem.iItem = iItem;
792 lvItem.iSubItem = 0;
793 lvItem.lParam = (LPARAM)Entry;
794 lvItem.iImage = iSmallImage;
795 lvItem.pszText = Assoc[0] == L'.' ? _wcsupr(&Entry->FileExtension[1]) : pG->NoneString;
796 SendMessageW(hListView, LVM_INSERTITEMW, 0, (LPARAM)&lvItem);
797
798 lvItem.mask = LVIF_TEXT;
799 lvItem.iItem = iItem;
800 lvItem.iSubItem = 1;
802 ListView_SetItem(hListView, &lvItem);
803
804 return Entry;
805}
806
807static BOOL
809{
810 DWORD dwValue = 1;
811 HKEY hKey;
812 WCHAR szKey[13]; // max. "ft4294967295" + "\0"
813 LONG nResult;
814
815 if (!*pszProgId)
816 {
817 pszProgId = szKey;
818 // Search the next "ft%06u" key name
819 do
820 {
821 StringCbPrintfW(szKey, sizeof(szKey), L"ft%06u", dwValue);
822
823 nResult = RegOpenKeyEx(HKEY_CLASSES_ROOT, szKey, 0, KEY_READ, &hKey);
824 if (nResult != ERROR_SUCCESS)
825 break;
826
828 ++dwValue;
829 } while (dwValue != 0);
830
832
833 if (dwValue == 0)
834 return FALSE;
835
836 // Create new "ft%06u" key
837 nResult = RegCreateKeyEx(HKEY_CLASSES_ROOT, szKey, 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL);
838 if (ERROR_SUCCESS != nResult)
839 return FALSE;
841 }
842
843 // Create the ".ext" key
844 WCHAR szExt[ASSOC_CCHMAX];
845 if (*pszExt == L'.') // The user is allowed to type the extension with or without the . in the new dialog!
846 ++pszExt;
847 StringCbPrintfW(szExt, sizeof(szExt), L".%s", pszExt);
848 _wcslwr(szExt);
849 nResult = RegCreateKeyEx(HKEY_CLASSES_ROOT, szExt, 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL);
850 _wcsupr(szExt);
851 if (ERROR_SUCCESS != nResult)
852 return FALSE;
853
854 // Set the default value of ".ext" to "ft%06u"
855 RegSetString(hKey, NULL, pszProgId, REG_SZ);
856
858
859 // Insert an item to the listview
860 HWND hListView = GetDlgItem(hwndDlg, IDC_FILETYPES_LISTVIEW);
861 INT iItem = ListView_GetItemCount(hListView);
862 if (!FileTypesDlg_InsertToLV(hListView, szExt, iItem, pG))
863 return FALSE;
864
865 ListView_SetItemState(hListView, iItem, -1, LVIS_FOCUSED | LVIS_SELECTED);
866 ListView_EnsureVisible(hListView, iItem, FALSE);
867 return TRUE;
868}
869
870static BOOL
872{
873 HWND hListView = GetDlgItem(hwndDlg, IDC_FILETYPES_LISTVIEW);
874
875 INT iItem = ListView_GetNextItem(hListView, -1, LVNI_SELECTED);
876 if (iItem == -1)
877 return FALSE;
878
879 WCHAR szExt[MAX_PATH];
880 szExt[0] = L'.';
881 ListView_GetItemText(hListView, iItem, 0, &szExt[1], _countof(szExt) - 1);
882 _wcslwr(szExt);
883
884 if (DeleteExt(hwndDlg, szExt))
885 {
886 ListView_DeleteItem(hListView, iItem);
887 }
888 return TRUE;
889}
890
892// common code of NewActionDlg and EditActionDlg
893
894typedef struct ACTION_DIALOG
895{
903
904static void
906{
907 WCHAR szFile[MAX_PATH];
908 szFile[0] = UNICODE_NULL;
909
912
914
916 ZeroMemory(&ofn, sizeof(ofn));
918 ofn.hwndOwner = hwndDlg;
920 ofn.lpstrFile = szFile;
921 ofn.nMaxFile = _countof(szFile);
922 ofn.lpstrTitle = strTitle;
924 ofn.lpstrDefExt = L"exe";
925 if (GetOpenFileNameW(&ofn))
926 {
927 if (bEdit)
928 {
929 CStringW str = szFile;
931 str += L" \"%1\"";
933 }
934 else
935 {
936 SetDlgItemTextW(hwndDlg, IDC_ACTION_APP, szFile);
937 }
938 }
939}
940
942// NewActionDlg
943
944static void
946{
947 // check action
948 GetDlgItemTextW(hwndDlg, IDC_ACTION_ACTION, pNewAct->szAction, _countof(pNewAct->szAction));
949 StrTrimW(pNewAct->szAction, g_pszSpace);
950 if (pNewAct->szAction[0] == 0)
951 {
952 // action was empty, error
953 HWND hwndCtrl = GetDlgItem(hwndDlg, IDC_ACTION_ACTION);
954 SendMessageW(hwndCtrl, EM_SETSEL, 0, -1);
955 SetFocus(hwndCtrl);
958 MessageBoxW(hwndDlg, strText, strTitle, MB_ICONERROR);
959 return;
960 }
961
962 // check app
963 GetDlgItemTextW(hwndDlg, IDC_ACTION_APP, pNewAct->szApp, _countof(pNewAct->szApp));
964 StrTrimW(pNewAct->szApp, g_pszSpace);
965 if (pNewAct->szApp[0] == 0 ||
967 {
968 // app was empty or invalid
969 HWND hwndCtrl = GetDlgItem(hwndDlg, IDC_ACTION_APP);
970 SendMessageW(hwndCtrl, EM_SETSEL, 0, -1);
971 SetFocus(hwndCtrl);
974 MessageBoxW(hwndDlg, strText, strTitle, MB_ICONERROR);
975 return;
976 }
977
978 EndDialog(hwndDlg, IDOK);
979}
980
981// IDD_ACTION
982static INT_PTR CALLBACK
984{
985 static PACTION_DIALOG s_pNewAct = NULL;
986
987 switch (uMsg)
988 {
989 case WM_INITDIALOG:
990 s_pNewAct = (PACTION_DIALOG)lParam;
991 s_pNewAct->bUseDDE = FALSE;
993 return TRUE;
994
995 case WM_COMMAND:
996 switch (LOWORD(wParam))
997 {
998 case IDOK:
999 NewActionDlg_OnOK(hwndDlg, s_pNewAct);
1000 break;
1001
1002 case IDCANCEL:
1003 EndDialog(hwndDlg, IDCANCEL);
1004 break;
1005
1006 case IDC_ACTION_BROWSE:
1007 ActionDlg_OnBrowse(hwndDlg, s_pNewAct, FALSE);
1008 break;
1009 }
1010 break;
1011 }
1012 return 0;
1013}
1014
1016// EditActionDlg
1017
1018static void
1020{
1021 // check action
1022 GetDlgItemTextW(hwndDlg, IDC_ACTION_ACTION, pEditAct->szAction, _countof(pEditAct->szAction));
1023 StrTrimW(pEditAct->szAction, g_pszSpace);
1024 if (pEditAct->szAction[0] == 0)
1025 {
1026 // action was empty. show error
1027 HWND hwndCtrl = GetDlgItem(hwndDlg, IDC_ACTION_ACTION);
1028 SendMessageW(hwndCtrl, EM_SETSEL, 0, -1);
1029 SetFocus(hwndCtrl);
1032 MessageBoxW(hwndDlg, strText, strTitle, MB_ICONERROR);
1033 }
1034
1035 // check app
1036 GetDlgItemTextW(hwndDlg, IDC_ACTION_APP, pEditAct->szApp, _countof(pEditAct->szApp));
1037 StrTrimW(pEditAct->szApp, g_pszSpace);
1038 if (pEditAct->szApp[0] == 0)
1039 {
1040 // app was empty. show error
1041 HWND hwndCtrl = GetDlgItem(hwndDlg, IDC_ACTION_APP);
1042 SendMessageW(hwndCtrl, EM_SETSEL, 0, -1);
1043 SetFocus(hwndCtrl);
1046 MessageBoxW(hwndDlg, strText, strTitle, MB_ICONERROR);
1047 }
1048
1049 EndDialog(hwndDlg, IDOK);
1050}
1051
1052// IDD_ACTION
1053static INT_PTR CALLBACK
1055{
1056 static PACTION_DIALOG s_pEditAct = NULL;
1057
1058 switch (uMsg)
1059 {
1060 case WM_INITDIALOG:
1061 s_pEditAct = (PACTION_DIALOG)lParam;
1062 s_pEditAct->bUseDDE = FALSE;
1063 SetDlgItemTextW(hwndDlg, IDC_ACTION_ACTION, s_pEditAct->szAction);
1064 SetDlgItemTextW(hwndDlg, IDC_ACTION_APP, s_pEditAct->szApp);
1067 {
1068 // set title
1070 str += GetTypeName(s_pEditAct->pEntry, s_pEditAct->pG);
1071 SetWindowTextW(hwndDlg, str);
1072 }
1073 return TRUE;
1074
1075 case WM_COMMAND:
1076 switch (LOWORD(wParam))
1077 {
1078 case IDOK:
1079 EditActionDlg_OnOK(hwndDlg, s_pEditAct);
1080 break;
1081
1082 case IDCANCEL:
1083 EndDialog(hwndDlg, IDCANCEL);
1084 break;
1085
1086 case IDC_ACTION_BROWSE:
1087 ActionDlg_OnBrowse(hwndDlg, s_pEditAct, TRUE);
1088 break;
1089 }
1090 break;
1091 }
1092 return 0;
1093}
1094
1096// EditTypeDlg
1097
1098static void
1100{
1101 PFILE_TYPE_ENTRY pEntry = pEditType->pEntry;
1102 static const WORD map[] = {
1109 };
1110 for (SIZE_T i = 0; i < _countof(map); i += 2)
1111 {
1112 if (pEntry->EditFlags & map[i + 0])
1113 EnableWindow(GetDlgItem(hwndDlg, map[i + 1]), FALSE);
1114 }
1115}
1116
1117static BOOL
1119{
1120 PFILE_TYPE_ENTRY pEntry = pEditType->pEntry;
1122
1123 pEntry->IconPath[0] = UNICODE_NULL; // I want the default icon
1125 pEntry->DestroyIcons();
1126 pEntry->hIconSmall = DoExtractIcon(pEntry->IconPath, pEntry->nIconIndex, TRUE);
1127 if (ExpandEnvironmentStringsW(pEditType->szIconPath, buf, _countof(buf)) && buf[0])
1128 {
1129 HICON hIco = DoExtractIcon(buf, pEditType->nIconIndex, TRUE);
1130 if (hIco)
1131 {
1132 pEntry->DestroyIcons();
1133 pEntry->hIconSmall = hIco;
1134 }
1135 }
1136 StringCbCopyW(pEntry->IconPath, sizeof(pEntry->IconPath), pEditType->szIconPath);
1137 pEntry->nIconIndex = pEditType->nIconIndex;
1138
1139 HWND hListView = pEditType->hwndLV;
1140 InitializeDefaultIcons(pEditType->pG);
1141 HIMAGELIST himlSmall = pEditType->pG->himlSmall;
1142 INT iSmallImage = ImageList_AddIcon(himlSmall, pEntry->hIconSmall);
1143
1144 INT iItem = ListView_GetNextItem(hListView, -1, LVNI_SELECTED);
1145 if (iItem != -1)
1146 {
1147 LV_ITEMW Item = { LVIF_IMAGE, iItem };
1148 Item.iImage = iSmallImage;
1149 ListView_SetItem(hListView, &Item);
1150 }
1151 return TRUE;
1152}
1153
1154static BOOL
1156 LPCWSTR TypeName, EDITTYPEFLAGS Etf)
1157{
1158 PFILE_TYPE_ENTRY pEntry = pEditType->pEntry;
1159 LPCWSTR ClassKey;
1160 HRESULT hr = GetClassKey(*pEntry, ClassKey);
1161 BOOL OnlyExt = hr != S_OK;
1163 if (FAILED(hr) || RegCreateKeyExW(HKEY_CLASSES_ROOT, ClassKey, 0, NULL, 0,
1166 {
1167 return FALSE;
1168 }
1169
1170 // Refresh the EditFlags
1171 DWORD dw;
1172 if (GetRegDWORD(hClassKey, L"EditFlags", dw, 0, FALSE) == ERROR_SUCCESS)
1173 pEntry->EditFlags = (dw & ~FTA_MODIFYMASK) | (pEntry->EditFlags & FTA_MODIFYMASK);
1174
1175 if (!OnlyExt)
1176 {
1177 // Set class properties
1178 RegSetOrDelete(hClassKey, L"EditFlags", REG_DWORD, pEntry->EditFlags ? &pEntry->EditFlags : NULL, 4);
1179 if (pEntry->IsExtension())
1180 {
1181 RegSetOrDelete(hClassKey, L"AlwaysShowExt", REG_SZ, (Etf & ETF_ALWAYSEXT) ? L"" : NULL, 0);
1182 }
1183 if (RegKeyExists(hClassKey, L"DocObject"))
1184 {
1185 LRESULT ec = GetRegDWORD(hClassKey, L"BrowserFlags", dw, 0, TRUE);
1186 if (ec == ERROR_SUCCESS || ec == ERROR_FILE_NOT_FOUND)
1187 {
1188 dw = (dw & ~8) | ((Etf & ETF_BROWSESAME) ? 0 : 8); // Note: 8 means NOT
1189 RegSetOrDelete(hClassKey, L"BrowserFlags", REG_DWORD, dw ? &dw : NULL, sizeof(dw));
1190 }
1191 }
1192 if (!(pEntry->EditFlags & FTA_NoEditDesc))
1193 {
1194 RegSetString(hClassKey, NULL, TypeName, REG_SZ);
1195 pEntry->InvalidateTypeName();
1196 }
1197 }
1198
1199 if (pEntry->IconPath[0] && !(pEntry->EditFlags & FTA_NoEditIcon))
1200 {
1201 HKEY hDefaultIconKey;
1202 if (RegCreateKeyExW(hClassKey, L"DefaultIcon", 0, NULL, 0, KEY_WRITE,
1203 NULL, &hDefaultIconKey, NULL) == ERROR_SUCCESS)
1204 {
1205 DWORD type = REG_SZ;
1207 LPCWSTR fmt = L"%s,%d";
1208 if (!lstrcmpW(pEntry->IconPath, L"%1"))
1209 {
1210 fmt = L"%s"; // No icon index for "%1"
1211 }
1212 else if (StrChrW(pEntry->IconPath, L'%'))
1213 {
1215 }
1216 StringCbPrintfW(buf, sizeof(buf), fmt, pEntry->IconPath, pEntry->nIconIndex);
1217
1218 RegSetString(hDefaultIconKey, NULL, buf, type);
1219 RegCloseKey(hDefaultIconKey);
1220 }
1221 }
1222
1223 HKEY hShellKey;
1224 if (RegCreateKeyExW(hClassKey, L"shell", 0, NULL, 0, KEY_READ | KEY_WRITE, NULL,
1225 &hShellKey, NULL) != ERROR_SUCCESS)
1226 {
1228 return FALSE;
1229 }
1230
1231 // set default action
1232 if (!(pEntry->EditFlags & FTA_NoEditDflt))
1233 {
1234 RegSetString(hShellKey, NULL, pEditType->szDefaultVerb, REG_SZ);
1235 }
1236
1237 // delete shell commands
1238 WCHAR szVerbName[VERBKEY_CCHMAX];
1239 DWORD dwIndex = 0;
1240 while (RegEnumKeyW(hShellKey, dwIndex, szVerbName, _countof(szVerbName)) == ERROR_SUCCESS)
1241 {
1242 if (pEditType->CommandLineMap.FindKey(szVerbName) == -1)
1243 {
1244 // doesn't exist in CommandLineMap, then delete it
1245 if (SHDeleteKeyW(hShellKey, szVerbName) == ERROR_SUCCESS)
1246 {
1247 --dwIndex;
1248 }
1249 }
1250 ++dwIndex;
1251 }
1252
1253 // write shell commands
1254 const INT nCount = pEditType->CommandLineMap.GetSize();
1255 for (INT i = 0; i < nCount; ++i)
1256 {
1257 const CStringW& key = pEditType->CommandLineMap.GetKeyAt(i);
1258 const CStringW& cmd = pEditType->CommandLineMap.GetValueAt(i);
1259 if (!pEditType->ModifiedVerbs.Find(key))
1260 {
1261 ASSERT(RegKeyExists(hShellKey, key));
1262 continue;
1263 }
1264
1265 // create verb key
1266 HKEY hVerbKey;
1267 if (RegCreateKeyExW(hShellKey, key, 0, NULL, 0, KEY_WRITE, NULL,
1268 &hVerbKey, NULL) == ERROR_SUCCESS)
1269 {
1270 // create command key
1271 HKEY hCommandKey;
1272 if (RegCreateKeyExW(hVerbKey, L"command", 0, NULL, 0, KEY_WRITE, NULL,
1273 &hCommandKey, NULL) == ERROR_SUCCESS)
1274 {
1275 DWORD dwSize = (cmd.GetLength() + 1) * sizeof(WCHAR);
1276 DWORD dwType = REG_SZ;
1277 int exp;
1278 if ((exp = cmd.Find('%', 0)) >= 0 && cmd.Find('%', exp + 1) >= 0)
1279 dwType = REG_EXPAND_SZ;
1280 RegSetValueExW(hCommandKey, NULL, 0, dwType, LPBYTE(LPCWSTR(cmd)), dwSize);
1281 RegCloseKey(hCommandKey);
1282 }
1283
1284 RegCloseKey(hVerbKey);
1285 }
1286 }
1287
1288 RegCloseKey(hShellKey);
1290 return TRUE;
1291}
1292
1293static BOOL
1295{
1296 PFILE_TYPE_ENTRY pEntry = pEditType->pEntry;
1297 LPCWSTR ClassKey;
1298 HRESULT hr = GetClassKey(*pEntry, ClassKey);
1300 if (FAILED(hr) || RegOpenKeyExW(HKEY_CLASSES_ROOT, ClassKey, 0, KEY_READ, &hClassKey))
1301 return FALSE;
1302
1303 UINT etfbits = (RegValueExists(hClassKey, L"AlwaysShowExt")) ? ETF_ALWAYSEXT : 0;
1304
1305 // 8 in BrowserFlags listed in KB 162059 seems to be our bit
1306 BOOL docobj = RegKeyExists(hClassKey, L"DocObject");
1308 etfbits |= (docobj && (GetRegDWORD(hClassKey, L"BrowserFlags") & 8)) ? 0 : ETF_BROWSESAME;
1309
1310 Etf = EDITTYPEFLAGS(etfbits);
1311
1312 // open "shell" key
1313 HKEY hShellKey;
1314 if (RegOpenKeyExW(hClassKey, L"shell", 0, KEY_READ, &hShellKey) != ERROR_SUCCESS)
1315 {
1317 return FALSE;
1318 }
1319
1320 WCHAR DefaultVerb[VERBKEY_CCHMAX];
1321 DWORD dwSize = sizeof(DefaultVerb);
1322 if (RegQueryValueExW(hShellKey, NULL, NULL, NULL,
1323 LPBYTE(DefaultVerb), &dwSize) == ERROR_SUCCESS)
1324 {
1325 StringCbCopyW(pEditType->szDefaultVerb, sizeof(pEditType->szDefaultVerb), DefaultVerb);
1326 }
1327 else
1328 {
1329 StringCbCopyW(pEditType->szDefaultVerb, sizeof(pEditType->szDefaultVerb), L"open");
1330 }
1331
1332 // enumerate shell verbs
1333 WCHAR szVerbName[VERBKEY_CCHMAX];
1334 DWORD dwIndex = 0;
1335 while (RegEnumKeyW(hShellKey, dwIndex, szVerbName, _countof(szVerbName)) == ERROR_SUCCESS)
1336 {
1337 // open verb key
1338 HKEY hVerbKey;
1339 LONG nResult = RegOpenKeyExW(hShellKey, szVerbName, 0, KEY_READ, &hVerbKey);
1340 if (nResult == ERROR_SUCCESS)
1341 {
1342 // open command key
1343 HKEY hCommandKey;
1344 nResult = RegOpenKeyExW(hVerbKey, L"command", 0, KEY_READ, &hCommandKey);
1345 if (nResult == ERROR_SUCCESS)
1346 {
1347 // get command line
1348 WCHAR szValue[MAX_PATH * 2];
1349 dwSize = sizeof(szValue);
1350 nResult = RegQueryValueExW(hCommandKey, NULL, NULL, NULL, LPBYTE(szValue), &dwSize);
1351 if (nResult == ERROR_SUCCESS)
1352 {
1353 pEditType->CommandLineMap.SetAt(szVerbName, szValue);
1354 }
1355
1356 RegCloseKey(hCommandKey);
1357 }
1358
1359 RegCloseKey(hVerbKey);
1360 }
1362 ++dwIndex;
1363 }
1364
1365 WCHAR TypeName[TYPENAME_CCHMAX];
1366 dwSize = sizeof(TypeName);
1367 if (!RegQueryValueExW(hClassKey, NULL, NULL, NULL, LPBYTE(TypeName), &dwSize))
1368 {
1369 TypeName[_countof(TypeName) - 1] = UNICODE_NULL; // Terminate
1370 SetDlgItemTextW(hwndDlg, IDC_EDITTYPE_TEXT, TypeName);
1371 }
1372
1373 RegCloseKey(hShellKey);
1375 return TRUE;
1376}
1377
1378static void
1380{
1381 PFILE_TYPE_ENTRY pEntry = pEditType->pEntry;
1382
1383 WCHAR TypeName[TYPENAME_CCHMAX];
1384 GetDlgItemTextW(hwndDlg, IDC_EDITTYPE_TEXT, TypeName, _countof(TypeName));
1385 StrTrimW(TypeName, g_pszSpace);
1386
1387 UINT etf = 0;
1388 pEntry->EditFlags &= ~(FTA_MODIFYMASK);
1390 pEntry->EditFlags |= FTA_OpenIsSafe;
1392 etf |= ETF_ALWAYSEXT;
1394 etf |= ETF_BROWSESAME;
1395
1396 // update entry icon
1397 EditTypeDlg_UpdateEntryIcon(hwndDlg, pEditType);
1398
1399 // write registry
1400 EditTypeDlg_WriteClass(hwndDlg, pEditType, TypeName, (EDITTYPEFLAGS)etf);
1401
1402 pEntry->InvalidateDefaultApp();
1403
1404 // update the icon cache
1406
1407 EndDialog(hwndDlg, IDOK);
1408}
1409
1410static BOOL
1412{
1413 // get current selection
1415 if (iItem == LB_ERR)
1416 return FALSE;
1417
1418 // ask user for removal
1421 if (MessageBoxW(hwndDlg, strText, strTitle, MB_ICONINFORMATION | MB_YESNO) == IDNO)
1422 return FALSE;
1423
1424 // get text
1425 WCHAR szText[VERBKEY_CCHMAX];
1426 szText[0] = 0;
1427 SendDlgItemMessageW(hwndDlg, IDC_EDITTYPE_LISTBOX, LB_GETTEXT, iItem, (LPARAM)szText);
1428 StrTrimW(szText, g_pszSpace);
1429
1430 // remove it
1431 pEditType->CommandLineMap.Remove(szText);
1433 return TRUE;
1434}
1435
1436static void
1438{
1439 INT iItem, iIndex;
1441 switch (id)
1442 {
1443 case IDOK:
1444 EditTypeDlg_OnOK(hwndDlg, pEditType);
1445 break;
1446
1447 case IDCANCEL:
1448 EndDialog(hwndDlg, IDCANCEL);
1449 break;
1450
1452 EditTypeDlg_OnChangeIcon(hwndDlg, pEditType);
1453 break;
1454
1455 case IDC_EDITTYPE_NEW:
1456 // open 'New Action' dialog
1457 action.bUseDDE = FALSE;
1458 action.hwndLB = GetDlgItem(hwndDlg, IDC_EDITTYPE_LISTBOX);
1459 action.pEntry = pEditType->pEntry;
1462 {
1463 if (SendMessageW(action.hwndLB, LB_FINDSTRING, -1, (LPARAM)action.szAction) != LB_ERR)
1464 {
1465 // already exists, error
1466 HWND hwndCtrl = GetDlgItem(hwndDlg, IDC_ACTION_ACTION);
1467 SendMessageW(hwndCtrl, EM_SETSEL, 0, -1);
1468 SetFocus(hwndCtrl);
1469
1470 CStringW strText, strTitle(MAKEINTRESOURCEW(IDS_FILE_TYPES));
1471 strText.Format(IDS_ACTION_EXISTS, action.szAction);
1472 MessageBoxW(hwndDlg, strText, strTitle, MB_ICONERROR);
1473 }
1474 else
1475 {
1476 // add it
1477 CStringW strCommandLine = action.szApp;
1478 QuoteAppPathForCommand(strCommandLine);
1479 strCommandLine += L" \"%1\"";
1480 pEditType->CommandLineMap.SetAt(action.szAction, strCommandLine);
1481 pEditType->ModifiedVerbs.AddHead(action.szAction);
1482 SendMessageW(action.hwndLB, LB_ADDSTRING, 0, LPARAM(action.szAction));
1483 if (SendMessageW(action.hwndLB, LB_GETCOUNT, 0, 0) == 1)
1484 {
1485 // set default
1486 StringCbCopyW(pEditType->szDefaultVerb, sizeof(pEditType->szDefaultVerb), action.szAction);
1487 InvalidateRect(action.hwndLB, NULL, TRUE);
1488 }
1489 }
1490 }
1491 break;
1492
1494 if (code == LBN_SELCHANGE)
1495 {
1496 action.hwndLB = GetDlgItem(hwndDlg, IDC_EDITTYPE_LISTBOX);
1497 INT iItem = SendMessageW(action.hwndLB, LB_GETCURSEL, 0, 0);
1498 SendMessageW(action.hwndLB, LB_GETTEXT, iItem, LPARAM(action.szAction));
1499 if (lstrcmpiW(action.szAction, pEditType->szDefaultVerb) == 0)
1500 {
1502 }
1503 else
1504 {
1506 }
1507 EditTypeDlg_Restrict(hwndDlg, pEditType);
1508 break;
1509 }
1510 else if (code != LBN_DBLCLK)
1511 {
1512 break;
1513 }
1514 // FALL THROUGH
1515
1517 action.bUseDDE = FALSE;
1518 action.hwndLB = GetDlgItem(hwndDlg, IDC_EDITTYPE_LISTBOX);
1519 action.pG = pEditType->pG;
1520 action.pEntry = pEditType->pEntry;
1521 iItem = SendMessageW(action.hwndLB, LB_GETCURSEL, 0, 0);
1522 if (iItem == LB_ERR)
1523 break;
1524
1525 // get action
1526 SendMessageW(action.hwndLB, LB_GETTEXT, iItem, LPARAM(action.szAction));
1527
1528 // get app
1529 {
1530 iIndex = pEditType->CommandLineMap.FindKey(action.szAction);
1531 CStringW str = pEditType->CommandLineMap.GetValueAt(iIndex);
1532 StringCbCopyW(action.szApp, sizeof(action.szApp), LPCWSTR(str));
1533 }
1534
1535 // open dialog
1538 {
1539 SendMessageW(action.hwndLB, LB_DELETESTRING, iItem, 0);
1540 SendMessageW(action.hwndLB, LB_INSERTSTRING, iItem, LPARAM(action.szAction));
1541 pEditType->CommandLineMap.SetAt(action.szAction, action.szApp);
1542 pEditType->ModifiedVerbs.AddHead(action.szAction);
1543 }
1544 break;
1545
1547 EditTypeDlg_OnRemove(hwndDlg, pEditType);
1548 break;
1549
1551 action.hwndLB = GetDlgItem(hwndDlg, IDC_EDITTYPE_LISTBOX);
1552 iItem = SendMessageW(action.hwndLB, LB_GETCURSEL, 0, 0);
1553 if (iItem == LB_ERR)
1554 break;
1555
1556 SendMessageW(action.hwndLB, LB_GETTEXT, iItem, LPARAM(action.szAction));
1557
1558 // set default
1559 StringCbCopyW(pEditType->szDefaultVerb, sizeof(pEditType->szDefaultVerb), action.szAction);
1561 InvalidateRect(action.hwndLB, NULL, TRUE);
1562 break;
1563 }
1564}
1565
1566static BOOL
1568{
1569 PFILE_TYPE_ENTRY pEntry = pEditType->pEntry;
1570 EDITTYPEFLAGS Etf;
1571 ExpandEnvironmentStringsW(pEntry->IconPath, pEditType->szIconPath, _countof(pEditType->szIconPath));
1572 pEditType->nIconIndex = pEntry->nIconIndex;
1573 StringCbCopyW(pEditType->szDefaultVerb, sizeof(pEditType->szDefaultVerb), L"open");
1574
1575 // set info
1576 HICON hIco = DoExtractIcon(pEditType->szIconPath, pEditType->nIconIndex);
1578 EditTypeDlg_ReadClass(hwndDlg, pEditType, Etf);
1581 EnableWindow(GetDlgItem(hwndDlg, IDC_EDITTYPE_SHOW_EXT), pEntry->IsExtension());
1584
1585 // select first item
1587 // is listbox empty?
1588 if (SendDlgItemMessageW(hwndDlg, IDC_EDITTYPE_LISTBOX, LB_GETCOUNT, 0, 0) == 0)
1589 {
1593 }
1594 EditTypeDlg_Restrict(hwndDlg, pEditType);
1595 return TRUE;
1596}
1597
1598// IDD_EDITTYPE
1599static INT_PTR CALLBACK
1601{
1602 static PEDITTYPE_DIALOG s_pEditType = NULL;
1603 LPDRAWITEMSTRUCT pDraw;
1604 LPMEASUREITEMSTRUCT pMeasure;
1605
1606 switch (uMsg)
1607 {
1608 case WM_INITDIALOG:
1609 s_pEditType = (PEDITTYPE_DIALOG)lParam;
1610 return EditTypeDlg_OnInitDialog(hwndDlg, s_pEditType);
1611
1612 case WM_DESTROY:
1613 {
1615 if (hOld)
1616 DestroyIcon(hOld);
1617 break;
1618 }
1619
1620 case WM_DRAWITEM:
1621 pDraw = LPDRAWITEMSTRUCT(lParam);
1622 return EditTypeDlg_OnDrawItem(hwndDlg, pDraw, s_pEditType);
1623
1624 case WM_MEASUREITEM:
1625 pMeasure = LPMEASUREITEMSTRUCT(lParam);
1626 return EditTypeDlg_OnMeasureItem(hwndDlg, pMeasure, s_pEditType);
1627
1628 case WM_COMMAND:
1629 EditTypeDlg_OnCommand(hwndDlg, LOWORD(wParam), HIWORD(wParam), s_pEditType);
1630 break;
1631 }
1632
1633 return 0;
1634}
1635
1637// FileTypesDlg
1638
1639static INT CALLBACK
1640FileTypesDlg_CompareItems(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
1641{
1642 PFILE_TYPE_GLOBALS pG = (PFILE_TYPE_GLOBALS)lParamSort;
1643 PFILE_TYPE_ENTRY entry1 = (PFILE_TYPE_ENTRY)lParam1, entry2 = (PFILE_TYPE_ENTRY)lParam2;
1644 int x = 0;
1645 if (pG->SortCol == 1)
1646 x = wcsicmp(GetTypeName(entry1, pG), GetTypeName(entry2, pG));
1647 if (!x && !(x = entry1->IsExtension() - entry2->IsExtension()))
1648 x = wcsicmp(entry1->FileExtension, entry2->FileExtension);
1649 return x * pG->SortReverse;
1650}
1651
1652static void
1654{
1655 pG->SortReverse = pG->SortCol == Column ? pG->SortReverse * -1 : 1;
1656 pG->SortCol = Column < 0 ? 0 : (INT8) Column;
1658}
1659
1660static VOID
1662{
1663 RECT clientRect;
1664 LPCWSTR columnName;
1665 WCHAR szBuf[50];
1666
1667 LVCOLUMNW col;
1669 col.fmt = 0;
1670
1671 GetClientRect(hListView, &clientRect);
1672 INT column0Size = (clientRect.right - clientRect.left) / 4;
1673
1674 columnName = L"Extensions"; // Default to English
1676 columnName = szBuf;
1677 col.pszText = const_cast<LPWSTR>(columnName);
1678 col.iSubItem = 0;
1679 col.cx = column0Size;
1680 SendMessageW(hListView, LVM_INSERTCOLUMNW, 0, (LPARAM)&col);
1681
1682 columnName = L"File Types"; // Default to English
1684 {
1685 columnName = szBuf;
1686 }
1687 else
1688 {
1689 ERR("Failed to load localized string!\n");
1690 }
1691 col.pszText = const_cast<LPWSTR>(columnName);
1692 col.iSubItem = 1;
1693 col.cx = clientRect.right - clientRect.left - column0Size - GetSystemMetrics(SM_CYVSCROLL);
1694 SendMessageW(hListView, LVM_INSERTCOLUMNW, 1, (LPARAM)&col);
1695
1696 const UINT lvexstyle = LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP;
1697 ListView_SetExtendedListViewStyleEx(hListView, lvexstyle, lvexstyle);
1698}
1699
1700static void
1702{
1703 CStringW buf;
1704 buf.Format(IDS_FILE_DETAILS, Assoc);
1705 SetDlgItemTextW(hwndDlg, IDC_FILETYPES_DETAILS_GROUPBOX, buf.GetString());
1706}
1707
1708static void
1710{
1711 ListView_DeleteAllItems(hListView);
1714 FileTypesDlg_SetGroupboxText(hwndDlg, L"");
1719#if DBG
1720 DWORD statTickStart = GetTickCount();
1721#endif
1722
1723 INT iItem = 0;
1725 DWORD dwName = _countof(szName);
1726 DWORD dwIndex = 0;
1727 SendMessage(hListView, WM_SETREDRAW, FALSE, 0);
1728 while (RegEnumKeyExW(HKEY_CLASSES_ROOT, dwIndex++, szName, &dwName,
1730 {
1731 if (FileTypesDlg_InsertToLV(hListView, szName, iItem, pG))
1732 ++iItem;
1733 dwName = _countof(szName);
1734 }
1735 FileTypesDlg_Sort(pG, hListView);
1736 SendMessage(hListView, WM_SETREDRAW, TRUE, 0);
1738
1739#if DBG
1740 DbgPrint("FT loaded %u (%ums)\n", iItem, GetTickCount() - statTickStart);
1741#endif
1742 // select first item
1744}
1745
1746static PFILE_TYPE_GLOBALS
1748{
1749 HWND hListView = GetDlgItem(hwndDlg, IDC_FILETYPES_LISTVIEW);
1751 if (!pG)
1752 return pG;
1753
1754 pG->SortReverse = 1;
1755 pG->hDefExtIconSmall = NULL;
1756 pG->hOpenWithImage = NULL;
1757 pG->IconSize = GetSystemMetrics(SM_CXSMICON); // Shell icons are always square
1758 pG->himlSmall = ImageList_Create(pG->IconSize, pG->IconSize, ILC_COLOR32 | ILC_MASK, 256, 20);
1759 pG->hHeap = GetProcessHeap();
1760
1763 {
1764 LPCWSTR fallback = L"%s File"; // Default to English
1766 }
1767 pG->NoneString[0] = UNICODE_NULL;
1769
1771 {
1772 HKEY hKey;
1773 if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Classes", 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL))
1774 pG->Restricted = TRUE;
1775 else
1777 }
1778
1779 FileTypesDlg_InitListView(hwndDlg, hListView);
1782
1783 // Delay loading the items so the propertysheet has time to finalize the UI
1784 PostMessage(hListView, WM_KEYDOWN, VK_F5, 0);
1785 return pG;
1786}
1787
1788static inline PFILE_TYPE_ENTRY
1789FileTypesDlg_GetEntry(HWND hListView, INT iItem = -1)
1790{
1791 if (iItem == -1)
1792 {
1793 iItem = ListView_GetNextItem(hListView, -1, LVNI_SELECTED);
1794 if (iItem == -1)
1795 return NULL;
1796 }
1797
1798 LV_ITEMW lvItem = { LVIF_PARAM, iItem };
1799 if (ListView_GetItem(hListView, &lvItem))
1800 return (PFILE_TYPE_ENTRY)lvItem.lParam;
1801
1802 return NULL;
1803}
1804
1805static void
1807{
1810 if (MessageBoxW(hwndDlg, strRemoveExt, strTitle, MB_ICONQUESTION | MB_YESNO) == IDYES)
1811 {
1812 FileTypesDlg_RemoveExt(hwndDlg);
1813
1814 // Select first item (Win2k3 does it)
1815 HWND hListView = GetDlgItem(hwndDlg, IDC_FILETYPES_LISTVIEW);
1817 }
1818}
1819
1820static void
1822{
1823 HBITMAP &hbmProgram = pG->hOpenWithImage;
1824 LPCWSTR DispAssoc = pEntry->GetAssocForDisplay();
1825 LPCWSTR TypeName = GetTypeName(pEntry, pG);
1826 CStringW buf;
1827
1828 // format buffer and set description
1829 FileTypesDlg_SetGroupboxText(hwndDlg, DispAssoc);
1830 if (pEntry->IsExtension())
1831 buf.Format(IDS_FILE_DETAILSADV, DispAssoc, TypeName, TypeName);
1832 else
1833 buf = L"";
1834 SetDlgItemTextW(hwndDlg, IDC_FILETYPES_DESCRIPTION, buf.GetString());
1835
1836 // delete previous program image
1837 if (hbmProgram)
1838 {
1839 DeleteObject(hbmProgram);
1840 hbmProgram = NULL;
1841 }
1842
1843 // set program name
1844 LPCWSTR appname = GetAppName(pEntry);
1845 SetDlgItemTextW(hwndDlg, IDC_FILETYPES_APPNAME, appname);
1846
1847 // set program image
1848 HICON hIconSm = NULL;
1850 if (*exe)
1851 {
1852 ExtractIconExW(exe, 0, NULL, &hIconSm, 1);
1853 }
1854 hbmProgram = BitmapFromIcon(hIconSm, 16, 16);
1857
1858 // Enable/Disable the buttons
1860 !pG->Restricted && pEntry->IsExtension());
1862 !(pEntry->EditFlags & FTA_NoEdit) && !pG->Restricted);
1864 !(pEntry->EditFlags & FTA_NoRemove) && !pG->Restricted && pEntry->IsExtension());
1865}
1866
1867// IDD_FOLDER_OPTIONS_FILETYPES
1870 HWND hwndDlg,
1871 UINT uMsg,
1872 WPARAM wParam,
1873 LPARAM lParam)
1874{
1876 if (!pGlobals && uMsg != WM_INITDIALOG)
1877 return FALSE;
1878 LPNMLISTVIEW lppl;
1880 NEWEXT_DIALOG newext;
1881 EDITTYPE_DIALOG edittype;
1882
1883 switch (uMsg)
1884 {
1885 case WM_INITDIALOG:
1888 return TRUE;
1889
1890 case WM_DESTROY:
1891 SetWindowLongPtrW(hwndDlg, DWLP_USER, 0);
1892 if (pGlobals)
1893 {
1894 DestroyIcon(pGlobals->hDefExtIconSmall);
1895 DeleteObject(pGlobals->hOpenWithImage);
1897 }
1898 break;
1899
1900 case WM_COMMAND:
1901 switch (LOWORD(wParam))
1902 {
1903 case IDC_FILETYPES_NEW:
1904 newext.hwndLV = GetDlgItem(hwndDlg, IDC_FILETYPES_LISTVIEW);
1906 hwndDlg, NewExtDlgProc, (LPARAM)&newext))
1907 {
1908 FileTypesDlg_AddExt(hwndDlg, newext.szExt, newext.szFileType, pGlobals);
1909 }
1910 break;
1911
1913 FileTypesDlg_OnDelete(hwndDlg);
1914 break;
1915
1918 if (pEntry)
1919 {
1920 OPENASINFO oai = { pEntry->FileExtension, 0, OAIF_ALLOW_REGISTRATION | OAIF_REGISTER_EXT };
1921 if (SUCCEEDED(SHOpenWithDialog(hwndDlg, &oai)))
1922 {
1923 pEntry->InvalidateDefaultApp();
1925 }
1926 }
1927 break;
1928
1930 edittype.hwndLV = GetDlgItem(hwndDlg, IDC_FILETYPES_LISTVIEW);
1931 edittype.pG = pGlobals;
1932 edittype.pEntry = FileTypesDlg_GetEntry(edittype.hwndLV);
1933 if (Normalize(edittype.pEntry))
1934 {
1936 hwndDlg, EditTypeDlgProc, (LPARAM)&edittype);
1937 FileTypesDlg_OnItemChanging(hwndDlg, edittype.pEntry, pGlobals);
1938 }
1939 break;
1940 }
1941 break;
1942
1943 case WM_NOTIFY:
1944 lppl = (LPNMLISTVIEW) lParam;
1945 switch (lppl->hdr.code)
1946 {
1947 case LVN_GETDISPINFO:
1948 {
1951 if (entry && (pLVDI->item.mask & LVIF_TEXT))
1952 {
1953 if (pLVDI->item.iSubItem == 1)
1954 {
1956 pLVDI->item.mask |= LVIF_DI_SETITEM;
1957 }
1958 }
1959 break;
1960 }
1961
1962 case LVN_KEYDOWN:
1963 {
1964 LV_KEYDOWN *pKeyDown = (LV_KEYDOWN *)lParam;
1965 switch (pKeyDown->wVKey)
1966 {
1967 case VK_DELETE:
1968 FileTypesDlg_OnDelete(hwndDlg);
1969 break;
1970 case VK_F5:
1971 FileTypesDlg_Refresh(hwndDlg, pKeyDown->hdr.hwndFrom, pGlobals);
1972 break;
1973 }
1974 break;
1975 }
1976
1977 case NM_DBLCLK:
1979 break;
1980
1981 case LVN_DELETEALLITEMS:
1982 return FALSE; // send LVN_DELETEITEM
1983
1984 case LVN_DELETEITEM:
1986 if (pEntry)
1987 {
1988 pEntry->DestroyIcons();
1989 HeapFree(pGlobals->hHeap, 0, pEntry);
1990 }
1991 return FALSE;
1992
1993 case LVN_ITEMCHANGING:
1995 if (!pEntry)
1996 {
1997 return TRUE;
1998 }
1999
2000 if (!(lppl->uOldState & LVIS_FOCUSED) && (lppl->uNewState & LVIS_FOCUSED))
2001 {
2003 }
2004 break;
2005
2006 case LVN_COLUMNCLICK:
2008 break;
2009
2010 case PSN_SETACTIVE:
2011 // On page activation, set the focus to the listview
2013 break;
2014 }
2015 break;
2016 }
2017
2018 return FALSE;
2019}
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 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:133
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
static TAGID TAGID find
Definition: db.cpp:155
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
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 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:2063
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
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:362
#define VERBKEY_CCHMAX
Definition: precomp.h:131
HICON SHELL32_SHExtractIcon(LPCWSTR File, int Index, int cx, int cy)
Definition: utils.h:42
BOOL RegKeyExists(HKEY hKey, LPCWSTR Path)
Definition: utils.h:17
DWORD RegSetString(HKEY hKey, LPCWSTR Name, LPCWSTR Str, DWORD Type=REG_SZ)
Definition: utils.h:35
BOOL RegValueExists(HKEY hKey, LPCWSTR Name)
Definition: utils.h:11
DWORD RegSetOrDelete(HKEY hKey, LPCWSTR Name, DWORD Type, LPCVOID Data, DWORD Size)
Definition: utils.h:26
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:1092
DWORD WINAPI SHDeleteKeyW(HKEY hKey, LPCWSTR lpszSubKey)
Definition: reg.c:1546
BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim)
Definition: string.c:1877
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:148
struct _FILE_TYPE_ENTRY FILE_TYPE_ENTRY
#define NOASSOCRESID
Definition: filetypes.cpp:34
#define LISTBOX_MARGIN
Definition: filetypes.cpp:362
static BOOL QueryFileDescription(LPCWSTR ProgramPath, LPWSTR pszName, INT cchName)
Definition: filetypes.cpp:260
static VOID FileTypesDlg_InitListView(HWND hwndDlg, HWND hListView)
Definition: filetypes.cpp:1661
static BOOL FileTypesDlg_RemoveExt(HWND hwndDlg)
Definition: filetypes.cpp:871
static BOOL EditTypeDlg_UpdateEntryIcon(HWND hwndDlg, PEDITTYPE_DIALOG pEditType)
Definition: filetypes.cpp:1118
struct EDITTYPE_DIALOG * PEDITTYPE_DIALOG
static BOOL GetFileTypeIconsEx(PFILE_TYPE_ENTRY Entry, LPCWSTR IconLocation, UINT IconSize)
Definition: filetypes.cpp:193
static INT CALLBACK FileTypesDlg_CompareItems(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
Definition: filetypes.cpp:1640
static BOOL NewExtDlg_OnInitDialog(HWND hwndDlg, PNEWEXT_DIALOG pNewExt)
Definition: filetypes.cpp:578
static INT_PTR CALLBACK NewActionDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: filetypes.cpp:983
static LPWSTR GetTypeName(PFILE_TYPE_ENTRY Entry, PFILE_TYPE_GLOBALS pG)
Definition: filetypes.cpp:288
static VOID NewExtDlg_OnAdvanced(HWND hwndDlg, PNEWEXT_DIALOG pNewExt)
Definition: filetypes.cpp:508
static HRESULT GetClassKey(const FILE_TYPE_ENTRY &FTE, LPCWSTR &SubKey)
Definition: filetypes.cpp:124
static BOOL EditTypeDlg_OnDrawItem(HWND hwndDlg, LPDRAWITEMSTRUCT pDraw, PEDITTYPE_DIALOG pEditType)
Definition: filetypes.cpp:411
static BOOL Normalize(PFILE_TYPE_ENTRY Entry)
Definition: filetypes.cpp:348
static BOOL EditTypeDlg_OnRemove(HWND hwndDlg, PEDITTYPE_DIALOG pEditType)
Definition: filetypes.cpp:1411
static void FileTypesDlg_Sort(PFILE_TYPE_GLOBALS pG, HWND hListView, INT Column=-1)
Definition: filetypes.cpp:1653
static BOOL EditTypeDlg_WriteClass(HWND hwndDlg, PEDITTYPE_DIALOG pEditType, LPCWSTR TypeName, EDITTYPEFLAGS Etf)
Definition: filetypes.cpp:1155
static void FileTypesDlg_OnDelete(HWND hwndDlg)
Definition: filetypes.cpp:1806
struct _FILE_TYPE_GLOBALS FILE_TYPE_GLOBALS
static INT_PTR CALLBACK NewExtDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: filetypes.cpp:682
static BOOL EditTypeDlg_OnMeasureItem(HWND hwndDlg, LPMEASUREITEMSTRUCT pMeasure, PEDITTYPE_DIALOG pEditType)
Definition: filetypes.cpp:475
static void EditActionDlg_OnOK(HWND hwndDlg, PACTION_DIALOG pEditAct)
Definition: filetypes.cpp:1019
#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:380
static void EditTypeDlg_Restrict(HWND hwndDlg, PEDITTYPE_DIALOG pEditType)
Definition: filetypes.cpp:1099
static BOOL NewExtDlg_OnOK(HWND hwndDlg, PNEWEXT_DIALOG pNewExt)
Definition: filetypes.cpp:604
static INT_PTR CALLBACK EditTypeDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: filetypes.cpp:1600
static void QuoteAppPathForCommand(CStringW &path)
Definition: filetypes.cpp:141
static PFILE_TYPE_ENTRY FileTypesDlg_GetEntry(HWND hListView, INT iItem=-1)
Definition: filetypes.cpp:1789
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:1709
static void InitializeDefaultIcons(PFILE_TYPE_GLOBALS pG)
Definition: filetypes.cpp:331
static LPCWSTR GetAppName(PFILE_TYPE_ENTRY Entry)
Definition: filetypes.cpp:273
static INT_PTR CALLBACK EditActionDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: filetypes.cpp:1054
static HICON DoExtractIcon(LPCWSTR IconPath, INT iIndex, UINT cx, UINT cy)
Definition: filetypes.cpp:179
#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:1869
static PFILE_TYPE_ENTRY FileTypesDlg_InsertToLV(HWND hListView, LPCWSTR Assoc, INT iItem, PFILE_TYPE_GLOBALS pG)
Definition: filetypes.cpp:719
static void NewActionDlg_OnOK(HWND hwndDlg, PACTION_DIALOG pNewAct)
Definition: filetypes.cpp:945
static DWORD GetRegDWORD(HKEY hKey, LPCWSTR Name, DWORD &Value, DWORD DefaultValue=0, BOOL Strict=FALSE)
Definition: filetypes.cpp:99
static void FileTypesDlg_OnItemChanging(HWND hwndDlg, PFILE_TYPE_ENTRY pEntry, PFILE_TYPE_GLOBALS pG)
Definition: filetypes.cpp:1821
static BOOL EditTypeDlg_OnInitDialog(HWND hwndDlg, PEDITTYPE_DIALOG pEditType)
Definition: filetypes.cpp:1567
static void FileTypesDlg_SetGroupboxText(HWND hwndDlg, LPCWSTR Assoc)
Definition: filetypes.cpp:1701
static BOOL GetFileTypeIconsByKey(HKEY hKey, PFILE_TYPE_ENTRY Entry, UINT IconSize)
Definition: filetypes.cpp:221
static BOOL FileTypesDlg_AddExt(HWND hwndDlg, LPCWSTR pszExt, LPCWSTR pszProgId, PFILE_TYPE_GLOBALS pG)
Definition: filetypes.cpp:808
static void EditTypeDlg_OnOK(HWND hwndDlg, PEDITTYPE_DIALOG pEditType)
Definition: filetypes.cpp:1379
static BOOL EditTypeDlg_ReadClass(HWND hwndDlg, PEDITTYPE_DIALOG pEditType, EDITTYPEFLAGS &Etf)
Definition: filetypes.cpp:1294
static LPCWSTR GetProgramPath(PFILE_TYPE_ENTRY Entry)
Definition: filetypes.cpp:244
static PFILE_TYPE_GLOBALS FileTypesDlg_Initialize(HWND hwndDlg)
Definition: filetypes.cpp:1747
EDITTYPEFLAGS
Definition: filetypes.cpp:364
@ ETF_BROWSESAME
Definition: filetypes.cpp:364
@ ETF_ALWAYSEXT
Definition: filetypes.cpp:364
static void ActionDlg_OnBrowse(HWND hwndDlg, PACTION_DIALOG pNewAct, BOOL bEdit=FALSE)
Definition: filetypes.cpp:905
static void EditTypeDlg_OnCommand(HWND hwndDlg, UINT id, UINT code, PEDITTYPE_DIALOG pEditType)
Definition: filetypes.cpp:1437
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:849
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 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
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_CRTIMP wchar_t *__cdecl _wcsupr(_Inout_z_ wchar_t *_String)
_CRTIMP wchar_t *__cdecl _wcslwr(_Inout_z_ wchar_t *_String)
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:414
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:166
#define SHGFI_TYPENAME
Definition: shellapi.h:167
#define SHGFI_USEFILEATTRIBUTES
Definition: shellapi.h:181
HRESULT hr
Definition: shlfolder.c:183
@ OAIF_REGISTER_EXT
Definition: shlobj.h:2681
@ OAIF_ALLOW_REGISTRATION
Definition: shlobj.h:2680
#define SHCNE_ASSOCCHANGED
Definition: shlobj.h:1911
#define SHCNF_FLUSHNOWAIT
Definition: shlobj.h:1929
@ REST_NOFILEASSOCIATE
Definition: shlobj.h:1868
@ ASSOCSTR_EXECUTABLE
Definition: shlwapi.h:604
@ ASSOCF_INIT_IGNOREUNKNOWN
Definition: shlwapi.h:593
@ FTA_NoEditDflt
Definition: shlwapi.h:660
@ FTA_NoEditDesc
Definition: shlwapi.h:658
@ FTA_NoRemove
Definition: shlwapi.h:654
@ FTA_NoEditVerb
Definition: shlwapi.h:656
@ FTA_NoEdit
Definition: shlwapi.h:653
@ FTA_NoRemoveVerb
Definition: shlwapi.h:657
@ FTA_OpenIsSafe
Definition: shlwapi.h:665
@ FTA_NoNewVerb
Definition: shlwapi.h:655
@ FTA_NoEditIcon
Definition: shlwapi.h:659
@ FTA_Exclude
Definition: shlwapi.h:650
DWORD WINAPI SHRestricted(RESTRICTIONS rest)
Definition: shpolicy.c:150
#define IDD_ACTION
Definition: shresdef.h:524
#define IDS_COLUMN_EXTENSION
Definition: shresdef.h:142
#define IDC_FILETYPES_DESCRIPTION
Definition: shresdef.h:449
#define IDS_FILE_DETAILS
Definition: shresdef.h:189
#define IDC_ACTION_BROWSE
Definition: shresdef.h:500
#define IDS_REMOVE_EXT
Definition: shresdef.h:338
#define IDC_EDITTYPE_SET_DEFAULT
Definition: shresdef.h:492
#define IDS_NEWEXT_SPECIFY_EXT
Definition: shresdef.h:327
#define IDC_EDITTYPE_ICON
Definition: shresdef.h:485
#define IDC_EDITTYPE_EDIT_BUTTON
Definition: shresdef.h:490
#define IDI_SHELL_EXE
Definition: shresdef.h:555
#define IDC_NEWEXT_ADVANCED
Definition: shresdef.h:455
#define IDC_NEWEXT_COMBOBOX
Definition: shresdef.h:456
#define IDC_FILETYPES_LISTVIEW
Definition: shresdef.h:443
#define IDC_EDITTYPE_CONFIRM_OPEN
Definition: shresdef.h:493
#define IDS_ANY_FILE
Definition: shresdef.h:184
#define IDC_EDITTYPE_TEXT
Definition: shresdef.h:486
#define IDC_ACTION_USE_DDE
Definition: shresdef.h:501
#define IDC_FILETYPES_DETAILS_GROUPBOX
Definition: shresdef.h:446
#define IDS_EXE_FILTER
Definition: shresdef.h:335
#define IDS_SPECIFY_ACTION
Definition: shresdef.h:331
#define IDD_NEWEXTENSION
Definition: shresdef.h:522
#define IDS_NEWEXT_EXT_IN_USE
Definition: shresdef.h:329
#define IDS_NEWEXT_ADVANCED_RIGHT
Definition: shresdef.h:325
#define IDS_NEWEXT_ALREADY_ASSOC
Definition: shresdef.h:328
#define IDC_FILETYPES_ICON
Definition: shresdef.h:451
#define IDS_INVALID_PROGRAM
Definition: shresdef.h:332
#define IDC_ACTION_APP
Definition: shresdef.h:499
#define IDS_NEWEXT_ADVANCED_LEFT
Definition: shresdef.h:324
#define IDC_EDITTYPE_LISTBOX
Definition: shresdef.h:488
#define IDC_EDITTYPE_SHOW_EXT
Definition: shresdef.h:494
#define IDD_EDITTYPE
Definition: shresdef.h:523
#define IDC_FILETYPES_APPNAME
Definition: shresdef.h:447
#define IDS_REMOVE_ACTION
Definition: shresdef.h:333
#define IDS_NEWEXT_NEW
Definition: shresdef.h:326
#define IDC_NEWEXT_ASSOC
Definition: shresdef.h:457
#define IDC_FILETYPES_ADVANCED
Definition: shresdef.h:450
#define IDS_OPEN_WITH
Definition: shresdef.h:134
#define IDS_FILE_TYPES
Definition: shresdef.h:188
#define IDS_ACTION_EXISTS
Definition: shresdef.h:334
#define IDC_FILETYPES_DELETE
Definition: shresdef.h:445
#define IDC_EDITTYPE_NEW
Definition: shresdef.h:489
#define IDC_EDITTYPE_SAME_WINDOW
Definition: shresdef.h:495
#define IDC_FILETYPES_CHANGE
Definition: shresdef.h:448
#define IDC_NEWEXT_EDIT
Definition: shresdef.h:454
#define IDS_FILE_DETAILSADV
Definition: shresdef.h:190
#define IDC_FILETYPES_NEW
Definition: shresdef.h:444
#define IDC_EDITTYPE_CHANGE_ICON
Definition: shresdef.h:487
#define IDS_EDITING_ACTION
Definition: shresdef.h:336
#define IDC_ACTION_ACTION
Definition: shresdef.h:498
#define IDC_EDITTYPE_REMOVE
Definition: shresdef.h:491
OPENFILENAME ofn
Definition: sndrec32.cpp:56
#define _countof(array)
Definition: sndvol32.h:70
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
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:897
PFILE_TYPE_ENTRY pEntry
Definition: filetypes.cpp:898
WCHAR szAction[VERBKEY_CCHMAX]
Definition: filetypes.cpp:899
WCHAR szApp[MAX_PATH]
Definition: filetypes.cpp:900
CSimpleMap< CStringW, CStringW > CommandLineMap
Definition: filetypes.cpp:371
CAtlList< CStringW > ModifiedVerbs
Definition: filetypes.cpp:372
WCHAR szDefaultVerb[VERBKEY_CCHMAX]
Definition: filetypes.cpp:375
WCHAR TypeName[TYPENAME_CCHMAX]
Definition: filetypes.cpp:376
WCHAR szIconPath[MAX_PATH]
Definition: filetypes.cpp:373
PFILE_TYPE_GLOBALS pG
Definition: filetypes.cpp:369
PFILE_TYPE_ENTRY pEntry
Definition: filetypes.cpp:370
base of all file and directory entries
Definition: entries.h:83
LONG lfWeight
Definition: dimm.idl:63
WCHAR szExt[16]
Definition: filetypes.cpp:503
WCHAR szFileType[64]
Definition: filetypes.cpp:504
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:93
WCHAR DefExtTypeNameFmt[TYPENAME_CCHMAX]
Definition: filetypes.cpp:92
WCHAR szTypeName[80]
Definition: shellapi.h:376
WCHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:375
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:3162
HWND hwndFrom
Definition: winuser.h:3160
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:1712
_In_ PSID _Out_writes_to_opt_ cchName LPSTR _Inout_ LPDWORD cchName
Definition: winbase.h:2767
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:2435
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
DWORD WINAPI GetSysColor(_In_ int)
#define LB_GETCOUNT
Definition: winuser.h:2041
#define ODS_SELECTED
Definition: winuser.h:2548
#define SW_HIDE
Definition: winuser.h:771
#define SWP_NOACTIVATE
Definition: winuser.h:1245
#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:875
#define GetWindowLongPtrW
Definition: winuser.h:4832
#define COLOR_WINDOW
Definition: winuser.h:921
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
struct tagMEASUREITEMSTRUCT * LPMEASUREITEMSTRUCT
#define STM_SETICON
Definition: winuser.h:2095
#define IDCANCEL
Definition: winuser.h:834
#define LB_GETTEXT
Definition: winuser.h:2052
#define SM_CYVSCROLL
Definition: winuser.h:984
#define IMAGE_ICON
Definition: winuser.h:212
#define COLOR_WINDOWTEXT
Definition: winuser.h:924
#define LBN_DBLCLK
Definition: winuser.h:2074
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:929
#define DT_SINGLELINE
Definition: winuser.h:540
#define WM_COMMAND
Definition: winuser.h:1743
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:2255
#define CB_SETCURSEL
Definition: winuser.h:1964
#define SM_CYSMICON
Definition: winuser.h:1016
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define SW_SHOWNOACTIVATE
Definition: winuser.h:777
#define RDW_UPDATENOW
Definition: winuser.h:1223
#define RDW_ERASE
Definition: winuser.h:1214
#define WM_INITDIALOG
Definition: winuser.h:1742
#define MB_YESNO
Definition: winuser.h:820
#define LB_ADDSTRING
Definition: winuser.h:2034
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:1654
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define STM_SETIMAGE
Definition: winuser.h:2096
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:833
#define WM_DRAWITEM
Definition: winuser.h:1648
#define BM_SETCHECK
Definition: winuser.h:1924
#define STM_GETICON
Definition: winuser.h:2093
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MB_ICONERROR
Definition: winuser.h:790
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define SM_CXSMICON
Definition: winuser.h:1015
#define DT_LEFT
Definition: winuser.h:534
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define LB_DELETESTRING
Definition: winuser.h:2035
#define SM_CYICON
Definition: winuser.h:976
#define VK_F5
Definition: winuser.h:2262
HWND WINAPI SetFocus(_In_opt_ HWND)
#define LB_FINDSTRING
Definition: winuser.h:2037
#define EM_SETLIMITTEXT
Definition: winuser.h:2014
#define RDW_ALLCHILDREN
Definition: winuser.h:1224
#define IDNO
Definition: winuser.h:839
#define LB_INSERTSTRING
Definition: winuser.h:2056
#define CB_ADDSTRING
Definition: winuser.h:1939
#define RDW_FRAME
Definition: winuser.h:1215
#define SendMessage
Definition: winuser.h:5855
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:930
HDC WINAPI GetDC(_In_opt_ HWND)
#define EM_SETSEL
Definition: winuser.h:2021
#define WM_MEASUREITEM
Definition: winuser.h:1649
#define MB_ICONWARNING
Definition: winuser.h:789
#define DT_VCENTER
Definition: winuser.h:543
#define PostMessage
Definition: winuser.h:5844
#define LBN_SELCHANGE
Definition: winuser.h:2078
#define MB_ICONQUESTION
Definition: winuser.h:792
#define MB_ICONINFORMATION
Definition: winuser.h:805
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:2236
#define WM_DESTROY
Definition: winuser.h:1612
#define LB_SETCURSEL
Definition: winuser.h:2066
#define WM_KEYDOWN
Definition: winuser.h:1718
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:838
#define SWP_NOZORDER
Definition: winuser.h:1250
#define LB_GETCURSEL
Definition: winuser.h:2042
#define SetWindowLongPtrW
Definition: winuser.h:5358
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define SM_CXICON
Definition: winuser.h:975
#define ODS_FOCUS
Definition: winuser.h:2552
int WINAPI GetSystemMetrics(_In_ int)
#define RDW_INVALIDATE
Definition: winuser.h:1217
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:1921
HDWP WINAPI BeginDeferWindowPos(_In_ int)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2105
#define WM_SETREDRAW
Definition: winuser.h:1619
__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