ReactOS  0.4.15-dev-1177-g6cb3b62
filetypes.cpp File Reference
#include "precomp.h"
Include dependency graph for filetypes.cpp:

Go to the source code of this file.

Classes

struct  FILE_TYPE_ENTRY
 
struct  EDITTYPE_DIALOG
 
struct  NEWEXT_DIALOG
 
struct  ACTION_DIALOG
 

Macros

#define LISTBOX_MARGIN   2
 

Typedefs

typedef struct FILE_TYPE_ENTRY FILE_TYPE_ENTRY
 
typedef struct FILE_TYPE_ENTRYPFILE_TYPE_ENTRY
 
typedef struct EDITTYPE_DIALOG EDITTYPE_DIALOG
 
typedef struct EDITTYPE_DIALOGPEDITTYPE_DIALOG
 
typedef struct NEWEXT_DIALOG NEWEXT_DIALOG
 
typedef struct NEWEXT_DIALOGPNEWEXT_DIALOG
 
typedef struct ACTION_DIALOG ACTION_DIALOG
 
typedef struct ACTION_DIALOGPACTION_DIALOG
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (fprop)
 
static BOOL DeleteExt (HWND hwndDlg, LPCWSTR pszExt)
 
static HICON DoExtractIcon (PFILE_TYPE_ENTRY Entry, LPCWSTR IconPath, INT iIndex=0, BOOL bSmall=FALSE)
 
static void DoFileTypeIconLocation (PFILE_TYPE_ENTRY Entry, LPCWSTR IconLocation)
 
static BOOL GetFileTypeIconsEx (PFILE_TYPE_ENTRY Entry, LPCWSTR IconLocation)
 
static BOOL GetFileTypeIconsByKey (HKEY hKey, PFILE_TYPE_ENTRY Entry)
 
static BOOL QueryFileDescription (LPCWSTR ProgramPath, LPWSTR pszName, INT cchName)
 
static void SetFileTypeEntryDefaultIcon (PFILE_TYPE_ENTRY Entry)
 
static void EditTypeDlg_OnChangeIcon (HWND hwndDlg, PEDITTYPE_DIALOG pEditType)
 
static BOOL EditTypeDlg_OnDrawItem (HWND hwndDlg, LPDRAWITEMSTRUCT pDraw, PEDITTYPE_DIALOG pEditType)
 
static BOOL EditTypeDlg_OnMeasureItem (HWND hwndDlg, LPMEASUREITEMSTRUCT pMeasure, PEDITTYPE_DIALOG pEditType)
 
static VOID NewExtDlg_OnAdvanced (HWND hwndDlg, PNEWEXT_DIALOG pNewExt)
 
static BOOL NewExtDlg_OnInitDialog (HWND hwndDlg, PNEWEXT_DIALOG pNewExt)
 
static BOOL NewExtDlg_OnOK (HWND hwndDlg, PNEWEXT_DIALOG pNewExt)
 
static INT_PTR CALLBACK NewExtDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static BOOL FileTypesDlg_InsertToLV (HWND hListView, LPCWSTR szName, INT iItem, LPCWSTR szFile)
 
static BOOL FileTypesDlg_AddExt (HWND hwndDlg, LPCWSTR pszExt, LPCWSTR pszFileType)
 
static BOOL FileTypesDlg_RemoveExt (HWND hwndDlg)
 
static void ActionDlg_OnBrowse (HWND hwndDlg, PACTION_DIALOG pNewAct, BOOL bEdit=FALSE)
 
static void NewActionDlg_OnOK (HWND hwndDlg, PACTION_DIALOG pNewAct)
 
static INT_PTR CALLBACK NewActionDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static void EditActionDlg_OnOK (HWND hwndDlg, PACTION_DIALOG pEditAct)
 
static INT_PTR CALLBACK EditActionDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static BOOL EditTypeDlg_UpdateEntryIcon (HWND hwndDlg, PEDITTYPE_DIALOG pEditType, LPCWSTR IconPath, INT IconIndex)
 
static BOOL EditTypeDlg_WriteClass (HWND hwndDlg, PEDITTYPE_DIALOG pEditType, LPCWSTR ClassKey, LPCWSTR ClassName, INT cchName)
 
static BOOL EditTypeDlg_ReadClass (HWND hwndDlg, PEDITTYPE_DIALOG pEditType, LPCWSTR ClassKey)
 
static void EditTypeDlg_OnOK (HWND hwndDlg, PEDITTYPE_DIALOG pEditType)
 
static BOOL EditTypeDlg_OnRemove (HWND hwndDlg, PEDITTYPE_DIALOG pEditType)
 
static void EditTypeDlg_OnCommand (HWND hwndDlg, UINT id, UINT code, PEDITTYPE_DIALOG pEditType)
 
static BOOL EditTypeDlg_OnInitDialog (HWND hwndDlg, PEDITTYPE_DIALOG pEditType)
 
static INT_PTR CALLBACK EditTypeDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT CALLBACK FileTypesDlg_CompareItems (LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
 
static VOID FileTypesDlg_InitListView (HWND hwndDlg, HWND hListView)
 
static PFILE_TYPE_ENTRY FileTypesDlg_DoList (HWND hwndDlg)
 
static PFILE_TYPE_ENTRY FileTypesDlg_GetEntry (HWND hListView, INT iItem=-1)
 
static void FileTypesDlg_OnDelete (HWND hwndDlg)
 
static void FileTypesDlg_OnItemChanging (HWND hwndDlg, PFILE_TYPE_ENTRY pEntry)
 
INT_PTR CALLBACK FolderOptionsFileTypesDlg (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Macro Definition Documentation

◆ LISTBOX_MARGIN

#define LISTBOX_MARGIN   2

Definition at line 205 of file filetypes.cpp.

Typedef Documentation

◆ ACTION_DIALOG

◆ EDITTYPE_DIALOG

◆ FILE_TYPE_ENTRY

◆ NEWEXT_DIALOG

◆ PACTION_DIALOG

◆ PEDITTYPE_DIALOG

◆ PFILE_TYPE_ENTRY

◆ PNEWEXT_DIALOG

Function Documentation

◆ ActionDlg_OnBrowse()

static void ActionDlg_OnBrowse ( HWND  hwndDlg,
PACTION_DIALOG  pNewAct,
BOOL  bEdit = FALSE 
)
static

Definition at line 819 of file filetypes.cpp.

820 {
821  WCHAR szFile[MAX_PATH];
822  szFile[0] = 0;
823 
826 
828 
830  ZeroMemory(&ofn, sizeof(ofn));
832  ofn.hwndOwner = hwndDlg;
834  ofn.lpstrFile = szFile;
835  ofn.nMaxFile = _countof(szFile);
836  ofn.lpstrTitle = strTitle;
838  ofn.lpstrDefExt = L"exe";
839  if (GetOpenFileNameW(&ofn))
840  {
841  if (bEdit)
842  {
843  CStringW str = szFile;
844  str += L" \"%1\"";
846  }
847  else
848  {
849  SetDlgItemTextW(hwndDlg, IDC_ACTION_APP, szFile);
850  }
851  }
852 }
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
HWND hwndOwner
Definition: commdlg.h:330
OPENFILENAME ofn
Definition: main.cpp:37
#define ZeroMemory
Definition: winbase.h:1648
LPCSTR lpstrDefExt
Definition: commdlg.h:345
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
DWORD nMaxFile
Definition: commdlg.h:337
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
BOOL WINAPI GetOpenFileNameW(OPENFILENAMEW *ofn)
Definition: filedlg.c:4671
const WCHAR * str
LPTSTR szFilter
Definition: mplay32.c:30
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
DWORD lStructSize
Definition: commdlg.h:329
static const WCHAR L[]
Definition: oid.c:1250
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
#define IDC_ACTION_APP
Definition: shresdef.h:450
#define OPENFILENAME_SIZE_VERSION_400W
Definition: commdlg.h:397
#define shell32_hInstance
LPSTR lpstrFile
Definition: commdlg.h:336
#define IDS_OPEN_WITH
Definition: shresdef.h:126
LPCSTR lpstrFilter
Definition: commdlg.h:332
#define IDS_EXE_FILTER
Definition: shresdef.h:292
LPCSTR lpstrTitle
Definition: commdlg.h:341
CAtlStringW CStringW
Definition: atlstr.h:130
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define OFN_ENABLESIZING
Definition: commdlg.h:101
DWORD Flags
Definition: commdlg.h:342

Referenced by EditActionDlgProc(), and NewActionDlgProc().

◆ DeleteExt()

static BOOL DeleteExt ( HWND  hwndDlg,
LPCWSTR  pszExt 
)
static

Definition at line 48 of file filetypes.cpp.

49 {
50  if (*pszExt != L'.')
51  return FALSE;
52 
53  // open ".ext" key
54  HKEY hKey;
55  if (RegOpenKeyExW(HKEY_CLASSES_ROOT, pszExt, 0, KEY_READ, &hKey) != ERROR_SUCCESS)
56  return FALSE;
57 
58  // query "extfile" key name
59  WCHAR szValue[64] = { 0 };
60  DWORD cbValue = sizeof(szValue);
61  RegQueryValueExW(hKey, NULL, NULL, NULL, LPBYTE(szValue), &cbValue);
62  RegCloseKey(hKey);
63 
64  // delete "extfile" key (if any)
65  if (szValue[0])
67 
68  // delete ".ext" key
69  return SHDeleteKeyW(HKEY_CLASSES_ROOT, pszExt) == ERROR_SUCCESS;
70 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
DWORD WINAPI SHDeleteKeyW(HKEY hKey, LPCWSTR lpszSubKey)
Definition: reg.c:1546

Referenced by FileTypesDlg_RemoveExt(), and NewExtDlg_OnOK().

◆ DoExtractIcon()

static HICON DoExtractIcon ( PFILE_TYPE_ENTRY  Entry,
LPCWSTR  IconPath,
INT  iIndex = 0,
BOOL  bSmall = FALSE 
)
inlinestatic

Definition at line 73 of file filetypes.cpp.

75 {
76  HICON hIcon = NULL;
77 
78  if (iIndex < 0)
79  {
80  // A negative value will be interpreted as a negated resource ID.
81  iIndex = -iIndex;
82 
83  INT cx, cy;
85  if (bSmall)
86  {
89  }
90  else
91  {
94  }
96  cx, cy, 0));
97  FreeLibrary(hDLL);
98  }
99  else
100  {
101  // A positive value is icon index.
102  if (bSmall)
103  ExtractIconExW(IconPath, iIndex, NULL, &hIcon, 1);
104  else
105  ExtractIconExW(IconPath, iIndex, &hIcon, NULL, 1);
106  }
107  return hIcon;
108 }
static HICON
Definition: imagelist.c:84
#define IMAGE_ICON
Definition: winuser.h:212
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:288
#define SM_CYSMICON
Definition: winuser.h:1003
int32_t INT
Definition: typedefs.h:58
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
UINT WINAPI ExtractIconExW(LPCWSTR lpszFile, INT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIcons)
Definition: iconcache.cpp:872
#define SM_CXICON
Definition: winuser.h:962
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
smooth NULL
Definition: ftsmooth.c:416
#define FreeLibrary(x)
Definition: compat.h:496
int WINAPI GetSystemMetrics(_In_ int)
#define SM_CXSMICON
Definition: winuser.h:1002
#define SM_CYICON
Definition: winuser.h:963
#define LOAD_LIBRARY_AS_DATAFILE
Definition: winbase.h:338
HICON hIcon
Definition: msconfig.c:44
static const WCHAR IconPath[]
Definition: install.c:51
_Out_opt_ int * cx
Definition: commctrl.h:581
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by DoFileTypeIconLocation(), EditTypeDlg_OnChangeIcon(), and EditTypeDlg_UpdateEntryIcon().

◆ DoFileTypeIconLocation()

static void DoFileTypeIconLocation ( PFILE_TYPE_ENTRY  Entry,
LPCWSTR  IconLocation 
)
static

Definition at line 111 of file filetypes.cpp.

112 {
113  // Expand the REG_EXPAND_SZ string by environment variables
114  WCHAR szLocation[MAX_PATH + 32];
116  return;
117 
118  Entry->nIconIndex = PathParseIconLocationW(szLocation);
119  StringCbCopyW(Entry->IconPath, sizeof(Entry->IconPath), szLocation);
120  Entry->hIconLarge = DoExtractIcon(Entry, szLocation, Entry->nIconIndex, FALSE);
121  Entry->hIconSmall = DoExtractIcon(Entry, szLocation, Entry->nIconIndex, TRUE);
122 }
#define TRUE
Definition: types.h:120
static HICON DoExtractIcon(PFILE_TYPE_ENTRY Entry, LPCWSTR IconPath, INT iIndex=0, BOOL bSmall=FALSE)
Definition: filetypes.cpp:73
#define FALSE
Definition: types.h:117
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
static const WCHAR szLocation[]
Definition: http.c:111
int WINAPI PathParseIconLocationW(LPWSTR lpszPath)
Definition: path.c:1087
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
base of all file and directory entries
Definition: entries.h:82

Referenced by GetFileTypeIconsEx().

◆ EditActionDlg_OnOK()

static void EditActionDlg_OnOK ( HWND  hwndDlg,
PACTION_DIALOG  pEditAct 
)
static

Definition at line 932 of file filetypes.cpp.

933 {
934  // check action
935  GetDlgItemTextW(hwndDlg, IDC_ACTION_ACTION, pEditAct->szAction, _countof(pEditAct->szAction));
936  StrTrimW(pEditAct->szAction, g_pszSpace);
937  if (pEditAct->szAction[0] == 0)
938  {
939  // action was empty. show error
940  HWND hwndCtrl = GetDlgItem(hwndDlg, IDC_ACTION_ACTION);
941  SendMessageW(hwndCtrl, EM_SETSEL, 0, -1);
942  SetFocus(hwndCtrl);
945  MessageBoxW(hwndDlg, strText, strTitle, MB_ICONERROR);
946  }
947 
948  // check app
949  GetDlgItemTextW(hwndDlg, IDC_ACTION_APP, pEditAct->szApp, _countof(pEditAct->szApp));
950  StrTrimW(pEditAct->szApp, g_pszSpace);
951  if (pEditAct->szApp[0] == 0)
952  {
953  // app was empty. show error
954  HWND hwndCtrl = GetDlgItem(hwndDlg, IDC_ACTION_APP);
955  SendMessageW(hwndCtrl, EM_SETSEL, 0, -1);
956  SetFocus(hwndCtrl);
959  MessageBoxW(hwndDlg, strText, strTitle, MB_ICONERROR);
960  }
961 
962  EndDialog(hwndDlg, IDOK);
963 }
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2271
#define IDOK
Definition: winuser.h:824
#define IDC_ACTION_ACTION
Definition: shresdef.h:449
#define IDS_INVALID_PROGRAM
Definition: shresdef.h:289
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
LPCWSTR g_pszSpace
#define IDS_SPECIFY_ACTION
Definition: shresdef.h:288
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define _countof(array)
Definition: sndvol32.h:68
#define EM_SETSEL
Definition: winuser.h:2000
WCHAR szApp[MAX_PATH]
Definition: filetypes.cpp:814
#define IDS_FILE_TYPES
Definition: shresdef.h:176
#define MB_ICONERROR
Definition: winuser.h:781
#define IDC_ACTION_APP
Definition: shresdef.h:450
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim)
Definition: string.c:1869
CAtlStringW CStringW
Definition: atlstr.h:130
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
WCHAR szAction[64]
Definition: filetypes.cpp:813

Referenced by EditActionDlgProc().

◆ EditActionDlgProc()

static INT_PTR CALLBACK EditActionDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 967 of file filetypes.cpp.

968 {
969  static PACTION_DIALOG s_pEditAct = NULL;
970 
971  switch (uMsg)
972  {
973  case WM_INITDIALOG:
974  s_pEditAct = (PACTION_DIALOG)lParam;
975  s_pEditAct->bUseDDE = FALSE;
976  SetDlgItemTextW(hwndDlg, IDC_ACTION_ACTION, s_pEditAct->szAction);
977  SetDlgItemTextW(hwndDlg, IDC_ACTION_APP, s_pEditAct->szApp);
980  {
981  // set title
983  str += s_pEditAct->ClassName;
984  SetWindowTextW(hwndDlg, str);
985  }
986  return TRUE;
987 
988  case WM_COMMAND:
989  switch (LOWORD(wParam))
990  {
991  case IDOK:
992  EditActionDlg_OnOK(hwndDlg, s_pEditAct);
993  break;
994 
995  case IDCANCEL:
996  EndDialog(hwndDlg, IDCANCEL);
997  break;
998 
999  case IDC_ACTION_BROWSE:
1000  ActionDlg_OnBrowse(hwndDlg, s_pEditAct, TRUE);
1001  break;
1002  }
1003  break;
1004  }
1005  return 0;
1006 }
#define IDS_EDITING_ACTION
Definition: shresdef.h:293
#define IDOK
Definition: winuser.h:824
#define TRUE
Definition: types.h:120
#define IDC_ACTION_ACTION
Definition: shresdef.h:449
#define IDC_ACTION_USE_DDE
Definition: shresdef.h:452
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define FALSE
Definition: types.h:117
struct ACTION_DIALOG * PACTION_DIALOG
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
static void ActionDlg_OnBrowse(HWND hwndDlg, PACTION_DIALOG pNewAct, BOOL bEdit=FALSE)
Definition: filetypes.cpp:819
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
WCHAR szApp[MAX_PATH]
Definition: filetypes.cpp:814
#define WM_COMMAND
Definition: winuser.h:1722
#define IDC_ACTION_APP
Definition: shresdef.h:450
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
static void EditActionDlg_OnOK(HWND hwndDlg, PACTION_DIALOG pEditAct)
Definition: filetypes.cpp:932
CAtlStringW CStringW
Definition: atlstr.h:130
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDCANCEL
Definition: winuser.h:825
#define IDC_ACTION_BROWSE
Definition: shresdef.h:451
WCHAR ClassName[64]
Definition: filetypes.cpp:812
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
WCHAR szAction[64]
Definition: filetypes.cpp:813

Referenced by EditTypeDlg_OnCommand().

◆ EditTypeDlg_OnChangeIcon()

static void EditTypeDlg_OnChangeIcon ( HWND  hwndDlg,
PEDITTYPE_DIALOG  pEditType 
)
static

Definition at line 218 of file filetypes.cpp.

219 {
221  INT IconIndex;
222 
224  IconIndex = pEditType->nIconIndex;
225  if (PickIconDlg(hwndDlg, szPath, _countof(szPath), &IconIndex))
226  {
227  // replace Windows directory with "%SystemRoot%" (for portability)
228  WCHAR szWinDir[MAX_PATH];
229  GetWindowsDirectoryW(szWinDir, _countof(szWinDir));
230  if (wcsstr(szPath, szWinDir) == 0)
231  {
232  CStringW str(L"%SystemRoot%");
233  str += &szPath[wcslen(szWinDir)];
234  StringCbCopyW(szPath, sizeof(szPath), LPCWSTR(str));
235  }
236 
237  // update FILE_TYPE_ENTRY
238  PFILE_TYPE_ENTRY pEntry = pEditType->pEntry;
239  DestroyIcon(pEntry->hIconLarge);
240  DestroyIcon(pEntry->hIconSmall);
241  pEntry->hIconLarge = DoExtractIcon(pEntry, szPath, IconIndex, FALSE);
242  pEntry->hIconSmall = DoExtractIcon(pEntry, szPath, IconIndex, TRUE);
243 
244  // update EDITTYPE_DIALOG
245  StringCbCopyW(pEditType->szIconPath, sizeof(pEditType->szIconPath), szPath);
246  pEditType->nIconIndex = IconIndex;
247 
248  // set icon to dialog
250  }
251 }
#define STM_SETICON
Definition: winuser.h:2074
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define TRUE
Definition: types.h:120
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
PFILE_TYPE_ENTRY pEntry
Definition: filetypes.cpp:210
HICON hIconLarge
Definition: filetypes.cpp:40
WCHAR szIconPath[MAX_PATH]
Definition: filetypes.cpp:212
UINT_PTR WPARAM
Definition: windef.h:207
int32_t INT
Definition: typedefs.h:58
static HICON DoExtractIcon(PFILE_TYPE_ENTRY Entry, LPCWSTR IconPath, INT iIndex=0, BOOL bSmall=FALSE)
Definition: filetypes.cpp:73
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2351
#define FALSE
Definition: types.h:117
#define IDC_EDITTYPE_ICON
Definition: shresdef.h:436
BOOL WINAPI PickIconDlg(HWND hWndOwner, LPWSTR lpstrFile, UINT nMaxFile, INT *lpdwIconIndex)
Definition: dialogs.cpp:351
HICON hIconSmall
Definition: filetypes.cpp:41
const WCHAR * str
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static const WCHAR IconIndex[]
Definition: install.c:52
static const WCHAR L[]
Definition: oid.c:1250
LPCWSTR szPath
Definition: env.c:35
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
CAtlStringW CStringW
Definition: atlstr.h:130
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
Definition: filetypes.cpp:32
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by EditTypeDlg_OnCommand().

◆ EditTypeDlg_OnCommand()

static void EditTypeDlg_OnCommand ( HWND  hwndDlg,
UINT  id,
UINT  code,
PEDITTYPE_DIALOG  pEditType 
)
static

Definition at line 1273 of file filetypes.cpp.

1274 {
1275  INT iItem, iIndex;
1277  switch (id)
1278  {
1279  case IDOK:
1280  EditTypeDlg_OnOK(hwndDlg, pEditType);
1281  break;
1282 
1283  case IDCANCEL:
1284  EndDialog(hwndDlg, IDCANCEL);
1285  break;
1286 
1288  EditTypeDlg_OnChangeIcon(hwndDlg, pEditType);
1289  break;
1290 
1291  case IDC_EDITTYPE_NEW:
1292  action.bUseDDE = FALSE;
1293  action.hwndLB = GetDlgItem(hwndDlg, IDC_EDITTYPE_LISTBOX);
1294  StringCbPrintfW(action.ClassName, sizeof(action.ClassName), pEditType->pEntry->ClassName);
1295  // open 'New Action' dialog
1298  {
1299  if (SendMessageW(action.hwndLB, LB_FINDSTRING, -1, (LPARAM)action.szAction) != LB_ERR)
1300  {
1301  // already exists, error
1302  HWND hwndCtrl = GetDlgItem(hwndDlg, IDC_ACTION_ACTION);
1303  SendMessageW(hwndCtrl, EM_SETSEL, 0, -1);
1304  SetFocus(hwndCtrl);
1305 
1306  CStringW strText, strTitle(MAKEINTRESOURCEW(IDS_FILE_TYPES));
1307  strText.Format(IDS_ACTION_EXISTS, action.szAction);
1308  MessageBoxW(hwndDlg, strText, strTitle, MB_ICONERROR);
1309  }
1310  else
1311  {
1312  // add it
1313  CStringW strCommandLine = action.szApp;
1314  strCommandLine += L" \"%1\"";
1315  pEditType->CommandLineMap.SetAt(action.szAction, strCommandLine);
1316  SendMessageW(action.hwndLB, LB_ADDSTRING, 0, LPARAM(action.szAction));
1317  if (SendMessageW(action.hwndLB, LB_GETCOUNT, 0, 0) == 1)
1318  {
1319  // set default
1320  StringCbCopyW(pEditType->szDefaultVerb, sizeof(pEditType->szDefaultVerb), action.szAction);
1321  InvalidateRect(action.hwndLB, NULL, TRUE);
1322  }
1323  }
1324  }
1325  break;
1326 
1327  case IDC_EDITTYPE_LISTBOX:
1328  if (code == LBN_SELCHANGE)
1329  {
1330  action.hwndLB = GetDlgItem(hwndDlg, IDC_EDITTYPE_LISTBOX);
1331  INT iItem = SendMessageW(action.hwndLB, LB_GETCURSEL, 0, 0);
1332  SendMessageW(action.hwndLB, LB_GETTEXT, iItem, LPARAM(action.szAction));
1333  if (lstrcmpiW(action.szAction, pEditType->szDefaultVerb) == 0)
1334  {
1336  }
1337  else
1338  {
1340  }
1341  break;
1342  }
1343  else if (code != LBN_DBLCLK)
1344  {
1345  break;
1346  }
1347  // FALL THROUGH
1348 
1350  action.bUseDDE = FALSE;
1351  action.hwndLB = GetDlgItem(hwndDlg, IDC_EDITTYPE_LISTBOX);
1352  StringCbPrintfW(action.ClassName, sizeof(action.ClassName), pEditType->pEntry->ClassName);
1353  iItem = SendMessageW(action.hwndLB, LB_GETCURSEL, 0, 0);
1354  if (iItem == LB_ERR)
1355  break;
1356 
1357  // get action
1358  SendMessageW(action.hwndLB, LB_GETTEXT, iItem, LPARAM(action.szAction));
1359 
1360  // get app
1361  {
1362  iIndex = pEditType->CommandLineMap.FindKey(action.szAction);
1363  CStringW str = pEditType->CommandLineMap.GetValueAt(iIndex);
1364  StringCbCopyW(action.szApp, sizeof(action.szApp), LPCWSTR(str));
1365  }
1366 
1367  // open dialog
1370  {
1371  SendMessageW(action.hwndLB, LB_DELETESTRING, iItem, 0);
1372  SendMessageW(action.hwndLB, LB_INSERTSTRING, iItem, LPARAM(action.szAction));
1373  pEditType->CommandLineMap.SetAt(action.szAction, action.szApp);
1374  }
1375  break;
1376 
1377  case IDC_EDITTYPE_REMOVE:
1378  EditTypeDlg_OnRemove(hwndDlg, pEditType);
1379  break;
1380 
1382  action.hwndLB = GetDlgItem(hwndDlg, IDC_EDITTYPE_LISTBOX);
1383  iItem = SendMessageW(action.hwndLB, LB_GETCURSEL, 0, 0);
1384  if (iItem == LB_ERR)
1385  break;
1386 
1387  SendMessageW(action.hwndLB, LB_GETTEXT, iItem, LPARAM(action.szAction));
1388 
1389  // set default
1390  StringCbCopyW(pEditType->szDefaultVerb, sizeof(pEditType->szDefaultVerb), action.szAction);
1392  InvalidateRect(action.hwndLB, NULL, TRUE);
1393  break;
1394  }
1395 }
#define IDS_ACTION_EXISTS
Definition: shresdef.h:291
#define IDOK
Definition: winuser.h:824
#define IDD_ACTION
Definition: shresdef.h:468
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define LB_ADDSTRING
Definition: winuser.h:2013
#define TRUE
Definition: types.h:120
#define IDC_ACTION_ACTION
Definition: shresdef.h:449
PFILE_TYPE_ENTRY pEntry
Definition: filetypes.cpp:210
static INT_PTR CALLBACK EditActionDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: filetypes.cpp:967
HWND WINAPI SetFocus(_In_opt_ HWND)
#define LBN_SELCHANGE
Definition: winuser.h:2057
int32_t INT
Definition: typedefs.h:58
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
#define IDC_EDITTYPE_EDIT_BUTTON
Definition: shresdef.h:441
#define FALSE
Definition: types.h:117
#define LB_ERR
Definition: winuser.h:2407
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
LONG_PTR LPARAM
Definition: windef.h:208
CSimpleMap< CStringW, CStringW > CommandLineMap
Definition: filetypes.cpp:211
#define LB_GETCOUNT
Definition: winuser.h:2020
#define IDC_EDITTYPE_REMOVE
Definition: shresdef.h:442
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define EM_SETSEL
Definition: winuser.h:2000
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define IDC_EDITTYPE_LISTBOX
Definition: shresdef.h:439
#define LBN_DBLCLK
Definition: winuser.h:2053
#define IDS_FILE_TYPES
Definition: shresdef.h:176
WCHAR ClassName[64]
Definition: filetypes.cpp:37
#define LB_GETTEXT
Definition: winuser.h:2031
static const WCHAR L[]
Definition: oid.c:1250
#define MB_ICONERROR
Definition: winuser.h:781
#define IDC_EDITTYPE_NEW
Definition: shresdef.h:440
WCHAR szDefaultVerb[64]
Definition: filetypes.cpp:214
Definition: inflate.c:139
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define LB_FINDSTRING
Definition: winuser.h:2016
#define shell32_hInstance
static void EditTypeDlg_OnChangeIcon(HWND hwndDlg, PEDITTYPE_DIALOG pEditType)
Definition: filetypes.cpp:218
const WCHAR * action
Definition: action.c:7783
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDC_EDITTYPE_CHANGE_ICON
Definition: shresdef.h:438
#define LB_GETCURSEL
Definition: winuser.h:2021
CAtlStringW CStringW
Definition: atlstr.h:130
static BOOL EditTypeDlg_OnRemove(HWND hwndDlg, PEDITTYPE_DIALOG pEditType)
Definition: filetypes.cpp:1247
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
static void EditTypeDlg_OnOK(HWND hwndDlg, PEDITTYPE_DIALOG pEditType)
Definition: filetypes.cpp:1225
#define IDCANCEL
Definition: winuser.h:825
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
#define LB_DELETESTRING
Definition: winuser.h:2014
static INT_PTR CALLBACK NewActionDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: filetypes.cpp:896
#define LB_INSERTSTRING
Definition: winuser.h:2035
#define IDC_EDITTYPE_SET_DEFAULT
Definition: shresdef.h:443

Referenced by EditTypeDlgProc().

◆ EditTypeDlg_OnDrawItem()

static BOOL EditTypeDlg_OnDrawItem ( HWND  hwndDlg,
LPDRAWITEMSTRUCT  pDraw,
PEDITTYPE_DIALOG  pEditType 
)
static

Definition at line 254 of file filetypes.cpp.

255 {
256  WCHAR szText[64];
257  HFONT hFont, hFont2;
258 
259  if (!pDraw)
260  return FALSE;
261 
262  // fill rect and set colors
263  if (pDraw->itemState & ODS_SELECTED)
264  {
265  FillRect(pDraw->hDC, &pDraw->rcItem, HBRUSH(COLOR_HIGHLIGHT + 1));
268  }
269  else
270  {
271  FillRect(pDraw->hDC, &pDraw->rcItem, HBRUSH(COLOR_WINDOW + 1));
274  }
275 
276  // get listbox text
277  HWND hwndListBox = GetDlgItem(hwndDlg, IDC_EDITTYPE_LISTBOX);
278  SendMessageW(hwndListBox, LB_GETTEXT, pDraw->itemID, (LPARAM)szText);
279 
280  // is it default?
281  hFont = (HFONT)SendMessageW(hwndListBox, WM_GETFONT, 0, 0);
282  if (lstrcmpiW(pEditType->szDefaultVerb, szText) == 0)
283  {
284  // default. set bold
285  LOGFONTW lf;
286  GetObject(hFont, sizeof(lf), &lf);
287  lf.lfWeight = FW_BOLD;
288  hFont2 = CreateFontIndirectW(&lf);
289  if (hFont2)
290  {
291  HGDIOBJ hFontOld = SelectObject(pDraw->hDC, hFont2);
293  DrawTextW(pDraw->hDC, szText, -1, &pDraw->rcItem,
296  SelectObject(pDraw->hDC, hFontOld);
297  DeleteObject(hFont2);
298  }
299  }
300  else
301  {
302  // non-default
304  DrawTextW(pDraw->hDC, szText, -1, &pDraw->rcItem,
307  }
308 
309  // draw focus rect
310  if (pDraw->itemState & ODS_FOCUS)
311  {
312  DrawFocusRect(pDraw->hDC, &pDraw->rcItem);
313  }
314  return TRUE;
315 }
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define COLOR_HIGHLIGHT
Definition: winuser.h:916
#define LISTBOX_MARGIN
Definition: filetypes.cpp:205
#define TRUE
Definition: types.h:120
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1499
#define ODS_FOCUS
Definition: winuser.h:2524
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define DT_NOPREFIX
Definition: winuser.h:537
#define COLOR_WINDOW
Definition: winuser.h:908
DWORD WINAPI GetSysColor(_In_ int)
HFONT hFont
Definition: main.c:53
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:977
#define FALSE
Definition: types.h:117
#define DT_LEFT
Definition: winuser.h:534
static const WCHAR szText[]
Definition: dialog.c:139
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
#define WM_GETFONT
Definition: winuser.h:1633
LONG_PTR LPARAM
Definition: windef.h:208
#define DT_VCENTER
Definition: winuser.h:543
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:917
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define COLOR_WINDOWTEXT
Definition: winuser.h:911
#define IDC_EDITTYPE_LISTBOX
Definition: shresdef.h:439
#define GetObject
Definition: wingdi.h:4467
#define LB_GETTEXT
Definition: winuser.h:2031
WCHAR szDefaultVerb[64]
Definition: filetypes.cpp:214
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:888
#define DT_SINGLELINE
Definition: winuser.h:540
#define FW_BOLD
Definition: wingdi.h:377
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define ODS_SELECTED
Definition: winuser.h:2520
LONG lfWeight
Definition: dimm.idl:63
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17

Referenced by EditTypeDlgProc().

◆ EditTypeDlg_OnInitDialog()

static BOOL EditTypeDlg_OnInitDialog ( HWND  hwndDlg,
PEDITTYPE_DIALOG  pEditType 
)
static

Definition at line 1398 of file filetypes.cpp.

1399 {
1400  PFILE_TYPE_ENTRY pEntry = pEditType->pEntry;
1401  StringCbCopyW(pEditType->szIconPath, sizeof(pEditType->szIconPath), pEntry->IconPath);
1402  pEditType->nIconIndex = pEntry->nIconIndex;
1403  StringCbCopyW(pEditType->szDefaultVerb, sizeof(pEditType->szDefaultVerb), L"open");
1404 
1405  // set info
1407  SetDlgItemTextW(hwndDlg, IDC_EDITTYPE_TEXT, pEntry->ClassName);
1408  EditTypeDlg_ReadClass(hwndDlg, pEditType, pEntry->ClassKey);
1410 
1411  // is listbox empty?
1412  if (SendDlgItemMessageW(hwndDlg, IDC_EDITTYPE_LISTBOX, LB_GETCOUNT, 0, 0) == 0)
1413  {
1417  }
1418  else
1419  {
1420  // select first item
1422  }
1423 
1425 
1426  return TRUE;
1427 }
#define LB_SETCURSEL
Definition: winuser.h:2045
#define STM_SETICON
Definition: winuser.h:2074
static BOOL EditTypeDlg_ReadClass(HWND hwndDlg, PEDITTYPE_DIALOG pEditType, LPCWSTR ClassKey)
Definition: filetypes.cpp:1158
WCHAR ClassKey[MAX_PATH]
Definition: filetypes.cpp:36
#define IDC_EDITTYPE_SAME_WINDOW
Definition: shresdef.h:446
#define TRUE
Definition: types.h:120
PFILE_TYPE_ENTRY pEntry
Definition: filetypes.cpp:210
HICON hIconLarge
Definition: filetypes.cpp:40
WCHAR szIconPath[MAX_PATH]
Definition: filetypes.cpp:212
WCHAR IconPath[MAX_PATH]
Definition: filetypes.cpp:43
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define IDC_EDITTYPE_EDIT_BUTTON
Definition: shresdef.h:441
#define FALSE
Definition: types.h:117
#define IDC_EDITTYPE_ICON
Definition: shresdef.h:436
smooth NULL
Definition: ftsmooth.c:416
INT nIconIndex
Definition: filetypes.cpp:44
#define LB_GETCOUNT
Definition: winuser.h:2020
#define IDC_EDITTYPE_REMOVE
Definition: shresdef.h:442
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define IDC_EDITTYPE_LISTBOX
Definition: shresdef.h:439
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WCHAR ClassName[64]
Definition: filetypes.cpp:37
static const WCHAR L[]
Definition: oid.c:1250
WCHAR szDefaultVerb[64]
Definition: filetypes.cpp:214
#define IDC_EDITTYPE_TEXT
Definition: shresdef.h:437
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
Definition: filetypes.cpp:32
#define IDC_EDITTYPE_SET_DEFAULT
Definition: shresdef.h:443

Referenced by EditTypeDlgProc().

◆ EditTypeDlg_OnMeasureItem()

static BOOL EditTypeDlg_OnMeasureItem ( HWND  hwndDlg,
LPMEASUREITEMSTRUCT  pMeasure,
PEDITTYPE_DIALOG  pEditType 
)
static

Definition at line 318 of file filetypes.cpp.

319 {
320  if (!pMeasure)
321  return FALSE;
322 
323  HWND hwndLB = GetDlgItem(hwndDlg, IDC_EDITTYPE_LISTBOX);
324 
325  HDC hDC = GetDC(hwndLB);
326  if (hDC)
327  {
328  TEXTMETRICW tm;
330  pMeasure->itemHeight = tm.tmHeight + LISTBOX_MARGIN * 2;
331  ReleaseDC(hwndLB, hDC);
332  return TRUE;
333  }
334  return FALSE;
335 }
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
#define LISTBOX_MARGIN
Definition: filetypes.cpp:205
HDC WINAPI GetDC(_In_opt_ HWND)
#define TRUE
Definition: types.h:120
static HDC
Definition: imagelist.c:92
#define FALSE
Definition: types.h:117
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_EDITTYPE_LISTBOX
Definition: shresdef.h:439
Definition: time.h:76
static HDC hDC
Definition: 3dtext.c:33

Referenced by EditTypeDlgProc().

◆ EditTypeDlg_OnOK()

static void EditTypeDlg_OnOK ( HWND  hwndDlg,
PEDITTYPE_DIALOG  pEditType 
)
static

Definition at line 1225 of file filetypes.cpp.

1226 {
1227  PFILE_TYPE_ENTRY pEntry = pEditType->pEntry;
1228 
1229  // get class name
1230  GetDlgItemTextW(hwndDlg, IDC_EDITTYPE_TEXT, pEntry->ClassName, _countof(pEntry->ClassName));
1231  StrTrimW(pEntry->ClassName, g_pszSpace);
1232 
1233  // update entry icon
1234  EditTypeDlg_UpdateEntryIcon(hwndDlg, pEditType, pEditType->szIconPath, pEditType->nIconIndex);
1235 
1236  // write registry
1237  EditTypeDlg_WriteClass(hwndDlg, pEditType, pEntry->ClassKey, pEntry->ClassName,
1238  _countof(pEntry->ClassName));
1239 
1240  // update the icon cache
1242 
1243  EndDialog(hwndDlg, IDOK);
1244 }
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2271
#define IDOK
Definition: winuser.h:824
WCHAR ClassKey[MAX_PATH]
Definition: filetypes.cpp:36
PFILE_TYPE_ENTRY pEntry
Definition: filetypes.cpp:210
WCHAR szIconPath[MAX_PATH]
Definition: filetypes.cpp:212
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
LPCWSTR g_pszSpace
smooth NULL
Definition: ftsmooth.c:416
#define _countof(array)
Definition: sndvol32.h:68
EXTERN_C void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
WCHAR ClassName[64]
Definition: filetypes.cpp:37
#define IDC_EDITTYPE_TEXT
Definition: shresdef.h:437
static BOOL EditTypeDlg_WriteClass(HWND hwndDlg, PEDITTYPE_DIALOG pEditType, LPCWSTR ClassKey, LPCWSTR ClassName, INT cchName)
Definition: filetypes.cpp:1056
BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim)
Definition: string.c:1869
Definition: filetypes.cpp:32
static BOOL EditTypeDlg_UpdateEntryIcon(HWND hwndDlg, PEDITTYPE_DIALOG pEditType, LPCWSTR IconPath, INT IconIndex)
Definition: filetypes.cpp:1012
#define SHCNF_FLUSHNOWAIT
Definition: shlobj.h:1768
#define SHCNE_ASSOCCHANGED
Definition: shlobj.h:1750

Referenced by EditTypeDlg_OnCommand().

◆ EditTypeDlg_OnRemove()

static BOOL EditTypeDlg_OnRemove ( HWND  hwndDlg,
PEDITTYPE_DIALOG  pEditType 
)
static

Definition at line 1247 of file filetypes.cpp.

1248 {
1249  // get current selection
1250  INT iItem = SendDlgItemMessageW(hwndDlg, IDC_EDITTYPE_LISTBOX, LB_GETCURSEL, 0, 0);
1251  if (iItem == LB_ERR)
1252  return FALSE;
1253 
1254  // ask user for removal
1257  if (MessageBoxW(hwndDlg, strText, strTitle, MB_ICONINFORMATION | MB_YESNO) == IDNO)
1258  return FALSE;
1259 
1260  // get text
1261  WCHAR szText[64];
1262  szText[0] = 0;
1265 
1266  // remove it
1267  pEditType->CommandLineMap.Remove(szText);
1269  return TRUE;
1270 }
#define TRUE
Definition: types.h:120
#define IDS_REMOVE_ACTION
Definition: shresdef.h:290
int32_t INT
Definition: typedefs.h:58
#define FALSE
Definition: types.h:117
#define MB_YESNO
Definition: winuser.h:811
static const WCHAR szText[]
Definition: dialog.c:139
#define LB_ERR
Definition: winuser.h:2407
LPCWSTR g_pszSpace
LONG_PTR LPARAM
Definition: windef.h:208
CSimpleMap< CStringW, CStringW > CommandLineMap
Definition: filetypes.cpp:211
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDC_EDITTYPE_LISTBOX
Definition: shresdef.h:439
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MB_ICONINFORMATION
Definition: winuser.h:796
#define IDS_FILE_TYPES
Definition: shresdef.h:176
#define LB_GETTEXT
Definition: winuser.h:2031
#define LB_GETCURSEL
Definition: winuser.h:2021
BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim)
Definition: string.c:1869
CAtlStringW CStringW
Definition: atlstr.h:130
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDNO
Definition: winuser.h:830
#define LB_DELETESTRING
Definition: winuser.h:2014

Referenced by EditTypeDlg_OnCommand().

◆ EditTypeDlg_ReadClass()

static BOOL EditTypeDlg_ReadClass ( HWND  hwndDlg,
PEDITTYPE_DIALOG  pEditType,
LPCWSTR  ClassKey 
)
static

Definition at line 1158 of file filetypes.cpp.

1159 {
1160  // open class key
1161  HKEY hClassKey;
1163  return FALSE;
1164 
1165  // open "shell" key
1166  HKEY hShellKey;
1167  if (RegOpenKeyExW(hClassKey, L"shell", 0, KEY_READ, &hShellKey) != ERROR_SUCCESS)
1168  {
1170  return FALSE;
1171  }
1172 
1173  WCHAR DefaultVerb[64];
1174  DWORD dwSize = sizeof(DefaultVerb);
1175  if (RegQueryValueExW(hShellKey, NULL, NULL, NULL,
1176  LPBYTE(DefaultVerb), &dwSize) == ERROR_SUCCESS)
1177  {
1178  StringCbCopyW(pEditType->szDefaultVerb, sizeof(pEditType->szDefaultVerb), DefaultVerb);
1179  }
1180  else
1181  {
1182  StringCbCopyW(pEditType->szDefaultVerb, sizeof(pEditType->szDefaultVerb), L"open");
1183  }
1184 
1185  // enumerate shell verbs
1186  WCHAR szVerbName[64];
1187  DWORD dwIndex = 0;
1188  while (RegEnumKeyW(hShellKey, dwIndex, szVerbName, _countof(szVerbName)) == ERROR_SUCCESS)
1189  {
1190  // open verb key
1191  HKEY hVerbKey;
1192  LONG nResult = RegOpenKeyExW(hShellKey, szVerbName, 0, KEY_READ, &hVerbKey);
1193  if (nResult == ERROR_SUCCESS)
1194  {
1195  // open command key
1196  HKEY hCommandKey;
1197  nResult = RegOpenKeyExW(hVerbKey, L"command", 0, KEY_READ, &hCommandKey);
1198  if (nResult == ERROR_SUCCESS)
1199  {
1200  // get command line
1201  WCHAR szValue[MAX_PATH + 32];
1202  dwSize = sizeof(szValue);
1203  nResult = RegQueryValueExW(hCommandKey, NULL, NULL, NULL, LPBYTE(szValue), &dwSize);
1204  if (nResult == ERROR_SUCCESS)
1205  {
1206  pEditType->CommandLineMap.SetAt(szVerbName, szValue);
1207  }
1208 
1209  RegCloseKey(hCommandKey);
1210  }
1211 
1212  RegCloseKey(hVerbKey);
1213  }
1214  SendDlgItemMessageW(hwndDlg, IDC_EDITTYPE_LISTBOX, LB_ADDSTRING, 0, LPARAM(szVerbName));
1215  ++dwIndex;
1216  }
1217 
1218  RegCloseKey(hShellKey);
1220 
1221  return TRUE;
1222 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define LB_ADDSTRING
Definition: winuser.h:2013
#define KEY_READ
Definition: nt_native.h:1023
#define TRUE
Definition: types.h:120
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
CSimpleMap< CStringW, CStringW > CommandLineMap
Definition: filetypes.cpp:211
HKEY hClassKey
Definition: umpnpmgr.c:45
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDC_EDITTYPE_LISTBOX
Definition: shresdef.h:439
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static const WCHAR L[]
Definition: oid.c:1250
WCHAR szDefaultVerb[64]
Definition: filetypes.cpp:214
LONG WINAPI RegEnumKeyW(HKEY hKey, DWORD dwIndex, LPWSTR lpName, DWORD cbName)
Definition: reg.c:2416
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by EditTypeDlg_OnInitDialog().

◆ EditTypeDlg_UpdateEntryIcon()

static BOOL EditTypeDlg_UpdateEntryIcon ( HWND  hwndDlg,
PEDITTYPE_DIALOG  pEditType,
LPCWSTR  IconPath,
INT  IconIndex 
)
static

Definition at line 1012 of file filetypes.cpp.

1014 {
1015  PFILE_TYPE_ENTRY pEntry = pEditType->pEntry;
1016 
1017  BOOL bIconSet = FALSE;
1018  if (IconPath && IconPath[0])
1019  {
1020  DestroyIcon(pEntry->hIconLarge);
1021  DestroyIcon(pEntry->hIconSmall);
1022  pEntry->hIconLarge = DoExtractIcon(pEntry, IconPath, IconIndex, FALSE);
1023  pEntry->hIconSmall = DoExtractIcon(pEntry, IconPath, IconIndex, TRUE);
1024 
1025  bIconSet = (pEntry->hIconLarge && pEntry->hIconSmall);
1026  }
1027  if (bIconSet)
1028  {
1029  StringCbCopyW(pEntry->IconPath, sizeof(pEntry->IconPath), IconPath);
1030  pEntry->nIconIndex = IconIndex;
1031  }
1032  else
1033  {
1035  }
1036 
1037  HWND hListView = pEditType->hwndLV;
1038  HIMAGELIST himlLarge = ListView_GetImageList(hListView, LVSIL_NORMAL);
1039  HIMAGELIST himlSmall = ListView_GetImageList(hListView, LVSIL_SMALL);
1040 
1041  INT iLargeImage = ImageList_AddIcon(himlLarge, pEntry->hIconLarge);
1042  INT iSmallImage = ImageList_AddIcon(himlSmall, pEntry->hIconSmall);
1043  ASSERT(iLargeImage == iSmallImage);
1044 
1045  INT iItem = ListView_GetNextItem(hListView, -1, LVNI_SELECTED);
1046  if (iItem != -1)
1047  {
1048  LV_ITEMW Item = { LVIF_IMAGE, iItem };
1049  Item.iImage = iSmallImage;
1050  ListView_SetItem(hListView, &Item);
1051  }
1052  return TRUE;
1053 }
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2430
#define LVSIL_SMALL
Definition: commctrl.h:2295
#define ListView_SetItem(hwnd, pitem)
Definition: commctrl.h:2397
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define TRUE
Definition: types.h:120
PFILE_TYPE_ENTRY pEntry
Definition: filetypes.cpp:210
HICON hIconLarge
Definition: filetypes.cpp:40
WCHAR IconPath[MAX_PATH]
Definition: filetypes.cpp:43
#define LVNI_SELECTED
Definition: commctrl.h:2420
int32_t INT
Definition: typedefs.h:58
static HICON DoExtractIcon(PFILE_TYPE_ENTRY Entry, LPCWSTR IconPath, INT iIndex=0, BOOL bSmall=FALSE)
Definition: filetypes.cpp:73
#define ListView_GetImageList(hwnd, iImageList)
Definition: commctrl.h:2292
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
HICON hIconSmall
Definition: filetypes.cpp:41
#define LV_ITEMW
Definition: commctrl.h:2328
INT nIconIndex
Definition: filetypes.cpp:44
#define LVIF_IMAGE
Definition: commctrl.h:2306
INT WINAPI ImageList_AddIcon(HIMAGELIST himl, HICON hIcon)
Definition: imagelist.c:540
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static const WCHAR IconIndex[]
Definition: install.c:52
static void SetFileTypeEntryDefaultIcon(PFILE_TYPE_ENTRY Entry)
Definition: filetypes.cpp:191
#define LVSIL_NORMAL
Definition: commctrl.h:2294
static const WCHAR IconPath[]
Definition: install.c:51
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
Definition: filetypes.cpp:32

Referenced by EditTypeDlg_OnOK().

◆ EditTypeDlg_WriteClass()

static BOOL EditTypeDlg_WriteClass ( HWND  hwndDlg,
PEDITTYPE_DIALOG  pEditType,
LPCWSTR  ClassKey,
LPCWSTR  ClassName,
INT  cchName 
)
static

Definition at line 1056 of file filetypes.cpp.

1058 {
1059  PFILE_TYPE_ENTRY pEntry = pEditType->pEntry;
1060 
1061  if (ClassKey[0] == 0)
1062  return FALSE;
1063 
1064  // create or open class key
1065  HKEY hClassKey;
1066  if (RegCreateKeyExW(HKEY_CLASSES_ROOT, ClassKey, 0, NULL, 0, KEY_WRITE, NULL,
1068  {
1069  return FALSE;
1070  }
1071 
1072  // create "DefaultIcon" key
1073  if (pEntry->IconPath[0])
1074  {
1075  HKEY hDefaultIconKey;
1076  if (RegCreateKeyExW(hClassKey, L"DefaultIcon", 0, NULL, 0, KEY_WRITE, NULL,
1077  &hDefaultIconKey, NULL) == ERROR_SUCCESS)
1078  {
1080  StringCbPrintfW(szText, sizeof(szText), L"%s,%d",
1081  pEntry->IconPath, pEntry->nIconIndex);
1082 
1083  // set icon location
1084  DWORD dwSize = (lstrlenW(szText) + 1) * sizeof(WCHAR);
1085  RegSetValueExW(hDefaultIconKey, NULL, 0, REG_EXPAND_SZ, LPBYTE(szText), dwSize);
1086 
1087  RegCloseKey(hDefaultIconKey);
1088  }
1089  }
1090 
1091  // create "shell" key
1092  HKEY hShellKey;
1093  if (RegCreateKeyExW(hClassKey, L"shell", 0, NULL, 0, KEY_WRITE, NULL,
1094  &hShellKey, NULL) != ERROR_SUCCESS)
1095  {
1097  return FALSE;
1098  }
1099 
1100  // delete shell commands
1101  WCHAR szVerbName[64];
1102  DWORD dwIndex = 0;
1103  while (RegEnumKeyW(hShellKey, dwIndex, szVerbName, _countof(szVerbName)) == ERROR_SUCCESS)
1104  {
1105  if (pEditType->CommandLineMap.FindKey(szVerbName) == -1)
1106  {
1107  // doesn't exist in CommandLineMap, then delete it
1108  if (SHDeleteKeyW(hShellKey, szVerbName) == ERROR_SUCCESS)
1109  {
1110  --dwIndex;
1111  }
1112  }
1113  ++dwIndex;
1114  }
1115 
1116  // set default action
1117  RegSetValueExW(hShellKey, NULL, 0, REG_SZ,
1118  LPBYTE(pEditType->szDefaultVerb), sizeof(pEditType->szDefaultVerb));
1119 
1120  // write shell commands
1121  const INT nCount = pEditType->CommandLineMap.GetSize();
1122  for (INT i = 0; i < nCount; ++i)
1123  {
1124  CStringW& key = pEditType->CommandLineMap.GetKeyAt(i);
1125  CStringW& value = pEditType->CommandLineMap.GetValueAt(i);
1126 
1127  // create verb key
1128  HKEY hVerbKey;
1129  if (RegCreateKeyExW(hShellKey, key, 0, NULL, 0, KEY_WRITE, NULL,
1130  &hVerbKey, NULL) == ERROR_SUCCESS)
1131  {
1132  // create command key
1133  HKEY hCommandKey;
1134  if (RegCreateKeyExW(hVerbKey, L"command", 0, NULL, 0, KEY_WRITE, NULL,
1135  &hCommandKey, NULL) == ERROR_SUCCESS)
1136  {
1137  // write the default value
1138  DWORD dwSize = (value.GetLength() + 1) * sizeof(WCHAR);
1139  RegSetValueExW(hCommandKey, NULL, 0, REG_EXPAND_SZ, LPBYTE(LPCWSTR(value)), dwSize);
1140 
1141  RegCloseKey(hCommandKey);
1142  }
1143 
1144  RegCloseKey(hVerbKey);
1145  }
1146  }
1147 
1148  // set class name to class key
1149  RegSetValueExW(hClassKey, NULL, 0, REG_SZ, LPBYTE(ClassName), cchName);
1150 
1151  RegCloseKey(hShellKey);
1153 
1154  return TRUE;
1155 }
#define ERROR_SUCCESS
Definition: deptool.c:10
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define TRUE
Definition: types.h:120
PFILE_TYPE_ENTRY pEntry
Definition: filetypes.cpp:210
WCHAR IconPath[MAX_PATH]
Definition: filetypes.cpp:43
#define lstrlenW
Definition: compat.h:498
int32_t INT
Definition: typedefs.h:58
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:1091
_In_ PSID _Out_writes_to_opt_ cchName LPSTR _Inout_ LPDWORD cchName
Definition: winbase.h:2729
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
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
static const WCHAR szText[]
Definition: dialog.c:139
smooth NULL
Definition: ftsmooth.c:416
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
CSimpleMap< CStringW, CStringW > CommandLineMap
Definition: filetypes.cpp:211
HKEY hClassKey
Definition: umpnpmgr.c:45
INT nIconIndex
Definition: filetypes.cpp:44
#define KEY_WRITE
Definition: nt_native.h:1031
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:4895
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
WCHAR szDefaultVerb[64]
Definition: filetypes.cpp:214
LONG WINAPI RegEnumKeyW(HKEY hKey, DWORD dwIndex, LPWSTR lpName, DWORD cbName)
Definition: reg.c:2416
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
CAtlStringW CStringW
Definition: atlstr.h:130
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
Definition: filetypes.cpp:32
DWORD WINAPI SHDeleteKeyW(HKEY hKey, LPCWSTR lpszSubKey)
Definition: reg.c:1546
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
Definition: path.c:41
#define REG_SZ
Definition: layer.c:22

Referenced by EditTypeDlg_OnOK().

◆ EditTypeDlgProc()

static INT_PTR CALLBACK EditTypeDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1431 of file filetypes.cpp.

1432 {
1433  static PEDITTYPE_DIALOG s_pEditType = NULL;
1434  LPDRAWITEMSTRUCT pDraw;
1435  LPMEASUREITEMSTRUCT pMeasure;
1436 
1437  switch (uMsg)
1438  {
1439  case WM_INITDIALOG:
1440  s_pEditType = (PEDITTYPE_DIALOG)lParam;
1441  return EditTypeDlg_OnInitDialog(hwndDlg, s_pEditType);
1442 
1443  case WM_DRAWITEM:
1444  pDraw = LPDRAWITEMSTRUCT(lParam);
1445  return EditTypeDlg_OnDrawItem(hwndDlg, pDraw, s_pEditType);
1446 
1447  case WM_MEASUREITEM:
1448  pMeasure = LPMEASUREITEMSTRUCT(lParam);
1449  return EditTypeDlg_OnMeasureItem(hwndDlg, pMeasure, s_pEditType);
1450 
1451  case WM_COMMAND:
1452  EditTypeDlg_OnCommand(hwndDlg, LOWORD(wParam), HIWORD(wParam), s_pEditType);
1453  break;
1454  }
1455 
1456  return 0;
1457 }
static BOOL EditTypeDlg_OnInitDialog(HWND hwndDlg, PEDITTYPE_DIALOG pEditType)
Definition: filetypes.cpp:1398
struct tagMEASUREITEMSTRUCT * LPMEASUREITEMSTRUCT
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
struct EDITTYPE_DIALOG * PEDITTYPE_DIALOG
WPARAM wParam
Definition: combotst.c:138
static BOOL EditTypeDlg_OnDrawItem(HWND hwndDlg, LPDRAWITEMSTRUCT pDraw, PEDITTYPE_DIALOG pEditType)
Definition: filetypes.cpp:254
smooth NULL
Definition: ftsmooth.c:416
#define WM_MEASUREITEM
Definition: winuser.h:1628
#define WM_COMMAND
Definition: winuser.h:1722
static void EditTypeDlg_OnCommand(HWND hwndDlg, UINT id, UINT code, PEDITTYPE_DIALOG pEditType)
Definition: filetypes.cpp:1273
static BOOL EditTypeDlg_OnMeasureItem(HWND hwndDlg, LPMEASUREITEMSTRUCT pMeasure, PEDITTYPE_DIALOG pEditType)
Definition: filetypes.cpp:318
#define WM_DRAWITEM
Definition: winuser.h:1627
#define HIWORD(l)
Definition: typedefs.h:247
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by FolderOptionsFileTypesDlg().

◆ FileTypesDlg_AddExt()

static BOOL FileTypesDlg_AddExt ( HWND  hwndDlg,
LPCWSTR  pszExt,
LPCWSTR  pszFileType 
)
static

Definition at line 709 of file filetypes.cpp.

710 {
711  DWORD dwValue = 1;
712  HKEY hKey;
713  WCHAR szKey[13]; // max. "ft4294967295" + "\0"
714  LONG nResult;
715 
716  // Search the next "ft%06u" key name
717  do
718  {
719  StringCbPrintfW(szKey, sizeof(szKey), L"ft%06u", dwValue);
720 
721  nResult = RegOpenKeyEx(HKEY_CLASSES_ROOT, szKey, 0, KEY_READ, &hKey);
722  if (nResult != ERROR_SUCCESS)
723  break;
724 
725  RegCloseKey(hKey);
726  ++dwValue;
727  } while (dwValue != 0);
728 
729  RegCloseKey(hKey);
730 
731  if (dwValue == 0)
732  return FALSE;
733 
734  // Create new "ft%06u" key
735  nResult = RegCreateKeyEx(HKEY_CLASSES_ROOT, szKey, 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL);
736  if (ERROR_SUCCESS != nResult)
737  return FALSE;
738 
739  RegCloseKey(hKey);
740 
741  // Create the ".ext" key
742  WCHAR szExt[16];
743  if (*pszExt == L'.')
744  ++pszExt;
745  StringCbPrintfW(szExt, sizeof(szExt), L".%s", pszExt);
746  _wcslwr(szExt);
747  nResult = RegCreateKeyEx(HKEY_CLASSES_ROOT, szExt, 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL);
748  _wcsupr(szExt);
749  if (ERROR_SUCCESS != nResult)
750  return FALSE;
751 
752  // Set the default value of ".ext" to "ft%06u"
753  DWORD dwSize = (lstrlen(szKey) + 1) * sizeof(WCHAR);
754  RegSetValueExW(hKey, NULL, 0, REG_SZ, (LPBYTE)szKey, dwSize);
755 
756  RegCloseKey(hKey);
757 
758  // Make up the file type name
759  WCHAR szFile[100];
761  StringCbPrintfW(szFile, sizeof(szFile), strFormat, &szExt[1]);
762 
763  // Insert an item to the listview
764  HWND hListView = GetDlgItem(hwndDlg, IDC_FILETYPES_LISTVIEW);
765  INT iItem = ListView_GetItemCount(hListView);
766  if (!FileTypesDlg_InsertToLV(hListView, szExt, iItem, szFile))
767  return FALSE;
768 
769  LV_ITEM item;
770  ZeroMemory(&item, sizeof(item));
771  item.mask = LVIF_STATE | LVIF_TEXT;
772  item.iItem = iItem;
773  item.state = LVIS_SELECTED | LVIS_FOCUSED;
774  item.stateMask = LVIS_SELECTED | LVIS_FOCUSED;
775  item.pszText = &szExt[1];
776  ListView_SetItem(hListView, &item);
777 
778  item.pszText = szFile;
779  item.iSubItem = 1;
780  ListView_SetItem(hListView, &item);
781 
782  ListView_EnsureVisible(hListView, iItem, FALSE);
783 
784  return TRUE;
785 }
#define ListView_EnsureVisible(hwndLV, i, fPartialOK)
Definition: commctrl.h:2515
#define LV_ITEM
Definition: commctrl.h:2333
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ListView_SetItem(hwnd, pitem)
Definition: commctrl.h:2397
#define KEY_READ
Definition: nt_native.h:1023
#define TRUE
Definition: types.h:120
#define ZeroMemory
Definition: winbase.h:1648
int32_t INT
Definition: typedefs.h:58
#define LVIF_TEXT
Definition: commctrl.h:2305
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define LVIS_SELECTED
Definition: commctrl.h:2315
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2303
_CRTIMP wchar_t *__cdecl _wcsupr(_Inout_z_ wchar_t *_String)
#define KEY_WRITE
Definition: nt_native.h:1031
#define IDS_FILE_EXT_TYPE
Definition: shresdef.h:179
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:4895
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
_CRTIMP wchar_t *__cdecl _wcslwr(_Inout_z_ wchar_t *_String)
#define RegOpenKeyEx
Definition: winreg.h:520
#define lstrlen
Definition: winbase.h:3716
static ATOM item
Definition: dde.c:856
#define IDC_FILETYPES_LISTVIEW
Definition: shresdef.h:394
CAtlStringW CStringW
Definition: atlstr.h:130
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define LVIF_STATE
Definition: commctrl.h:2308
static BOOL FileTypesDlg_InsertToLV(HWND hListView, LPCWSTR szName, INT iItem, LPCWSTR szFile)
Definition: filetypes.cpp:560
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define RegCreateKeyEx
Definition: winreg.h:501
#define LVIS_FOCUSED
Definition: commctrl.h:2314
#define REG_SZ
Definition: layer.c:22

Referenced by FolderOptionsFileTypesDlg().

◆ FileTypesDlg_CompareItems()

static INT CALLBACK FileTypesDlg_CompareItems ( LPARAM  lParam1,
LPARAM  lParam2,
LPARAM  lParamSort 
)
static

Definition at line 1463 of file filetypes.cpp.

1464 {
1465  PFILE_TYPE_ENTRY Entry1, Entry2;
1466  int x;
1467 
1468  Entry1 = (PFILE_TYPE_ENTRY)lParam1;
1469  Entry2 = (PFILE_TYPE_ENTRY)lParam2;
1470 
1471  x = wcsicmp(Entry1->FileExtension, Entry2->FileExtension);
1472  if (x != 0)
1473  return x;
1474 
1475  return wcsicmp(Entry1->FileDescription, Entry2->FileDescription);
1476 }
WCHAR FileDescription[100]
Definition: filetypes.cpp:35
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
WCHAR FileExtension[30]
Definition: filetypes.cpp:34
#define wcsicmp
Definition: compat.h:15
struct FILE_TYPE_ENTRY * PFILE_TYPE_ENTRY
Definition: filetypes.cpp:32

Referenced by FileTypesDlg_DoList().

◆ FileTypesDlg_DoList()

static PFILE_TYPE_ENTRY FileTypesDlg_DoList ( HWND  hwndDlg)
static

Definition at line 1527 of file filetypes.cpp.

1528 {
1529  HWND hListView;
1530  DWORD dwIndex = 0;
1531  WCHAR szName[50];
1532  WCHAR szFile[100];
1533  DWORD dwName;
1534  LVITEMW lvItem;
1535  INT iItem = 0;
1536  HIMAGELIST himlLarge, himlSmall;
1537 
1538  // create imagelists
1540  ILC_COLOR32 | ILC_MASK, 256, 20);
1542  ILC_COLOR32 | ILC_MASK, 256, 20);
1543 
1544  // set imagelists to listview.
1545  hListView = GetDlgItem(hwndDlg, IDC_FILETYPES_LISTVIEW);
1546  ListView_SetImageList(hListView, himlLarge, LVSIL_NORMAL);
1547  ListView_SetImageList(hListView, himlSmall, LVSIL_SMALL);
1548 
1549  FileTypesDlg_InitListView(hwndDlg, hListView);
1550 
1551  szFile[0] = 0;
1552  if (!LoadStringW(shell32_hInstance, IDS_FILE_EXT_TYPE, szFile, _countof(szFile)))
1553  {
1554  // default to english
1555  wcscpy(szFile, L"%s File");
1556  }
1557  szFile[(_countof(szFile)) - 1] = 0;
1558 
1559  dwName = _countof(szName);
1560 
1561  while (RegEnumKeyExW(HKEY_CLASSES_ROOT, dwIndex++, szName, &dwName,
1562  NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
1563  {
1564  if (FileTypesDlg_InsertToLV(hListView, szName, iItem, szFile))
1565  ++iItem;
1566  dwName = _countof(szName);
1567  }
1568 
1569  // Leave if the list is empty
1570  if (iItem == 0)
1571  return NULL;
1572 
1573  // sort list
1575 
1576  // select first item
1577  ZeroMemory(&lvItem, sizeof(LVITEMW));
1578  lvItem.mask = LVIF_STATE;
1579  lvItem.stateMask = (UINT)-1;
1580  lvItem.state = LVIS_FOCUSED | LVIS_SELECTED;
1581  lvItem.iItem = 0;
1582  ListView_SetItem(hListView, &lvItem);
1583 
1584  lvItem.mask = LVIF_PARAM;
1585  ListView_GetItem(hListView, &lvItem);
1586 
1587  return (PFILE_TYPE_ENTRY)lvItem.lParam;
1588 }
#define LVSIL_SMALL
Definition: commctrl.h:2295
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ListView_SetItem(hwnd, pitem)
Definition: commctrl.h:2397
#define ZeroMemory
Definition: winbase.h:1648
#define SM_CYSMICON
Definition: winuser.h:1003
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:58
UINT stateMask
Definition: commctrl.h:2360
#define ILC_COLOR32
Definition: commctrl.h:354
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
static INT CALLBACK FileTypesDlg_CompareItems(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
Definition: filetypes.cpp:1463
LPARAM lParam
Definition: commctrl.h:2364
#define SM_CXICON
Definition: winuser.h:962
#define ListView_SetImageList(hwnd, himl, iImageList)
Definition: commctrl.h:2300
smooth NULL
Definition: ftsmooth.c:416
#define LVIS_SELECTED
Definition: commctrl.h:2315
#define IDS_FILE_EXT_TYPE
Definition: shresdef.h:179
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
int WINAPI GetSystemMetrics(_In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
UINT mask
Definition: commctrl.h:2356
#define SM_CXSMICON
Definition: winuser.h:1002
#define SM_CYICON
Definition: winuser.h:963
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
#define ILC_MASK
Definition: commctrl.h:347
#define LVSIL_NORMAL
Definition: commctrl.h:2294
static VOID FileTypesDlg_InitListView(HWND hwndDlg, HWND hListView)
Definition: filetypes.cpp:1479
UINT state
Definition: commctrl.h:2359
#define shell32_hInstance
unsigned int UINT
Definition: ndis.h:50
#define IDC_FILETYPES_LISTVIEW
Definition: shresdef.h:394
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2390
static const WCHAR szName[]
Definition: msipriv.h:1194
#define ListView_SortItems(hwndLV, _pfnCompare, _lPrm)
Definition: commctrl.h:2699
#define LVIF_PARAM
Definition: commctrl.h:2307
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
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:2527
#define LVIF_STATE
Definition: commctrl.h:2308
Definition: filetypes.cpp:32
static BOOL FileTypesDlg_InsertToLV(HWND hListView, LPCWSTR szName, INT iItem, LPCWSTR szFile)
Definition: filetypes.cpp:560
#define LVIS_FOCUSED
Definition: commctrl.h:2314

Referenced by FolderOptionsFileTypesDlg().

◆ FileTypesDlg_GetEntry()

static PFILE_TYPE_ENTRY FileTypesDlg_GetEntry ( HWND  hListView,
INT  iItem = -1 
)
inlinestatic

Definition at line 1591 of file filetypes.cpp.

1592 {
1593  if (iItem == -1)
1594  {
1595  iItem = ListView_GetNextItem(hListView, -1, LVNI_SELECTED);
1596  if (iItem == -1)
1597  return NULL;
1598  }
1599 
1600  LV_ITEMW lvItem = { LVIF_PARAM, iItem };
1601  if (ListView_GetItem(hListView, &lvItem))
1602  return (PFILE_TYPE_ENTRY)lvItem.lParam;
1603 
1604  return NULL;
1605 }
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2430
#define LVNI_SELECTED
Definition: commctrl.h:2420
#define LV_ITEMW
Definition: commctrl.h:2328
smooth NULL
Definition: ftsmooth.c:416
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2390
#define LVIF_PARAM
Definition: commctrl.h:2307
Definition: filetypes.cpp:32

Referenced by FolderOptionsFileTypesDlg().

◆ FileTypesDlg_InitListView()

static VOID FileTypesDlg_InitListView ( HWND  hwndDlg,
HWND  hListView 
)
static

Definition at line 1479 of file filetypes.cpp.

1480 {
1481  RECT clientRect;
1482  LVCOLUMNW col;
1483  WCHAR szName[50];
1484  DWORD dwStyle;
1485  INT columnSize = 140;
1486 
1488  {
1489  // default to english
1490  wcscpy(szName, L"Extensions");
1491  }
1492 
1493  // make sure its null terminated
1494  szName[_countof(szName) - 1] = 0;
1495 
1496  GetClientRect(hListView, &clientRect);
1497  ZeroMemory(&col, sizeof(LV_COLUMN));
1498  columnSize = 120;
1499  col.iSubItem = 0;
1501  col.fmt = LVCFMT_FIXED_WIDTH;
1502  col.cx = columnSize | LVCFMT_LEFT;
1503  col.cchTextMax = wcslen(szName);
1504  col.pszText = szName;
1505  SendMessageW(hListView, LVM_INSERTCOLUMNW, 0, (LPARAM)&col);
1506 
1508  {
1509  // default to english
1510  wcscpy(szName, L"File Types");
1511  ERR("Failed to load localized string!\n");
1512  }
1513 
1514  col.iSubItem = 1;
1515  col.cx = clientRect.right - clientRect.left - columnSize;
1516  col.cchTextMax = wcslen(szName);
1517  col.pszText = szName;
1518  SendMessageW(hListView, LVM_INSERTCOLUMNW, 1, (LPARAM)&col);
1519 
1520  // set full select style
1521  dwStyle = (DWORD)SendMessage(hListView, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
1522  dwStyle = dwStyle | LVS_EX_FULLROWSELECT;
1523  SendMessage(hListView, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, dwStyle);
1524 }
#define LVCF_WIDTH
Definition: commctrl.h:2583
#define LVCF_TEXT
Definition: commctrl.h:2584
#define IDS_COLUMN_EXTENSION
Definition: shresdef.h:133
#define LV_COLUMN
Definition: commctrl.h:2543
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2730
#define LVCFMT_LEFT
Definition: commctrl.h:2594
#define ZeroMemory
Definition: winbase.h:1648
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define DWORD
Definition: nt_native.h:44
int32_t INT
Definition: typedefs.h:58
#define LVCF_SUBITEM
Definition: commctrl.h:2585
#define LVM_INSERTCOLUMNW
Definition: commctrl.h:2628
LONG_PTR LPARAM
Definition: windef.h:208
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
LPWSTR pszText
Definition: commctrl.h:2563
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LVM_SETEXTENDEDLISTVIEWSTYLE
Definition: commctrl.h:2720
#define IDS_FILE_TYPES
Definition: shresdef.h:176
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
#define LVM_GETEXTENDEDLISTVIEWSTYLE
Definition: commctrl.h:2723
int cchTextMax
Definition: commctrl.h:2564
#define ERR(fmt,...)
Definition: debug.h:110
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define LVCF_FMT
Definition: commctrl.h:2582
#define shell32_hInstance
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static const WCHAR szName[]
Definition: msipriv.h:1194
#define SendMessage
Definition: winuser.h:5818
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by FileTypesDlg_DoList().

◆ FileTypesDlg_InsertToLV()

static BOOL FileTypesDlg_InsertToLV ( HWND  hListView,
LPCWSTR  szName,
INT  iItem,
LPCWSTR  szFile 
)
static

Definition at line 560 of file filetypes.cpp.

561 {
563  HKEY hKey;
564  LVITEMW lvItem;
565  DWORD dwSize;
566  DWORD dwType;
567 
568  if (szName[0] != L'.')
569  {
570  // FIXME handle URL protocol handlers
571  return FALSE;
572  }
573 
574  // get imagelists of listview
575  HIMAGELIST himlLarge = ListView_GetImageList(hListView, LVSIL_NORMAL);
576  HIMAGELIST himlSmall = ListView_GetImageList(hListView, LVSIL_SMALL);
577 
578  // allocate file type entry
580  if (!Entry)
581  return FALSE;
582 
583  // open key
585  {
587  return FALSE;
588  }
589 
590  // FIXME check for duplicates
591 
592  // query for the default key
593  dwSize = sizeof(Entry->ClassKey);
594  if (RegQueryValueExW(hKey, NULL, NULL, NULL, LPBYTE(Entry->ClassKey), &dwSize) != ERROR_SUCCESS)
595  {
596  // no link available
597  Entry->ClassKey[0] = 0;
598  }
599 
600  Entry->ClassName[0] = 0;
601  if (Entry->ClassKey[0])
602  {
603  HKEY hTemp;
604  // try open linked key
605  if (RegOpenKeyExW(HKEY_CLASSES_ROOT, Entry->ClassKey, 0, KEY_READ, &hTemp) == ERROR_SUCCESS)
606  {
607  DWORD dwSize = sizeof(Entry->ClassName);
608  RegQueryValueExW(hTemp, NULL, NULL, NULL, LPBYTE(Entry->ClassName), &dwSize);
609 
610  // use linked key
611  RegCloseKey(hKey);
612  hKey = hTemp;
613  }
614  }
615 
616  // read friendly type name
617  if (RegLoadMUIStringW(hKey, L"FriendlyTypeName", Entry->FileDescription,
618  sizeof(Entry->FileDescription), NULL, 0, NULL) != ERROR_SUCCESS)
619  {
620  // read file description
621  dwSize = sizeof(Entry->FileDescription);
622  Entry->FileDescription[0] = 0;
623 
624  // read default key
625  RegQueryValueExW(hKey, NULL, NULL, NULL, LPBYTE(Entry->FileDescription), &dwSize);
626  }
627 
628  // Read the EditFlags value
629  Entry->EditFlags = 0;
630  if (!RegQueryValueExW(hKey, L"EditFlags", NULL, &dwType, NULL, &dwSize))
631  {
632  if ((dwType == REG_DWORD || dwType == REG_BINARY) && dwSize == sizeof(DWORD))
633  RegQueryValueExW(hKey, L"EditFlags", NULL, NULL, (LPBYTE)&Entry->EditFlags, &dwSize);
634  }
635 
636  // convert extension to upper case
637  wcscpy(Entry->FileExtension, szName);
638  _wcsupr(Entry->FileExtension);
639 
640  // get icon
641  if (!GetFileTypeIconsByKey(hKey, Entry))
642  {
643  // set default icon
645  }
646 
647  // close key
648  RegCloseKey(hKey);
649 
650  // get program path and app name
651  DWORD cch = _countof(Entry->ProgramPath);
653  Entry->FileExtension, NULL, Entry->ProgramPath, &cch))
654  {
655  QueryFileDescription(Entry->ProgramPath, Entry->AppName, _countof(Entry->AppName));
656  }
657  else
658  {
659  Entry->ProgramPath[0] = Entry->AppName[0] = 0;
660  }
661 
662  // add icon to imagelist
663  INT iLargeImage = -1, iSmallImage = -1;
664  if (Entry->hIconLarge && Entry->hIconSmall)
665  {
666  iLargeImage = ImageList_AddIcon(himlLarge, Entry->hIconLarge);
667  iSmallImage = ImageList_AddIcon(himlSmall, Entry->hIconSmall);
668  ASSERT(iLargeImage == iSmallImage);
669  }
670 
671  // Do not add excluded entries
672  if (Entry->EditFlags & 0x00000001) //FTA_Exclude
673  {
674  DestroyIcon(Entry->hIconLarge);
675  DestroyIcon(Entry->hIconSmall);
677  return FALSE;
678  }
679 
680  if (!Entry->FileDescription[0])
681  {
682  // construct default 'FileExtensionFile' by formatting the uppercase extension
683  // with IDS_FILE_EXT_TYPE, outputting something like a l18n 'INI File'
684 
685  StringCbPrintfW(Entry->FileDescription, sizeof(Entry->FileDescription),
686  szFile, &Entry->FileExtension[1]);
687  }
688 
689  ZeroMemory(&lvItem, sizeof(LVITEMW));
690  lvItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
691  lvItem.iSubItem = 0;
692  lvItem.pszText = &Entry->FileExtension[1];
693  lvItem.iItem = iItem;
694  lvItem.lParam = (LPARAM)Entry;
695  lvItem.iImage = iSmallImage;
696  SendMessageW(hListView, LVM_INSERTITEMW, 0, (LPARAM)&lvItem);
697 
698  ZeroMemory(&lvItem, sizeof(LVITEMW));
699  lvItem.mask = LVIF_TEXT;
700  lvItem.pszText = Entry->FileDescription;
701  lvItem.iItem = iItem;
702  lvItem.iSubItem = 1;
703  ListView_SetItem(hListView, &lvItem);
704 
705  return TRUE;
706 }
int iImage
Definition: commctrl.h:2363
#define LVSIL_SMALL
Definition: commctrl.h:2295
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ListView_SetItem(hwnd, pitem)
Definition: commctrl.h:2397
struct _Entry Entry
Definition: kefuncs.h:627
#define REG_BINARY
Definition: nt_native.h:1496
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define KEY_READ
Definition: nt_native.h:1023
#define TRUE
Definition: types.h:120
#define ZeroMemory
Definition: winbase.h:1648
int32_t INT
Definition: typedefs.h:58
#define LVIF_TEXT
Definition: commctrl.h:2305
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
#define ListView_GetImageList(hwnd, iImageList)
Definition: commctrl.h:2292
#define FALSE
Definition: types.h:117
int iSubItem
Definition: commctrl.h:2358
LPARAM lParam
Definition: commctrl.h:2364
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:201
struct FILE_TYPE_ENTRY FILE_TYPE_ENTRY
smooth NULL
Definition: ftsmooth.c:416
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
LONG_PTR LPARAM
Definition: windef.h:208
_CRTIMP wchar_t *__cdecl _wcsupr(_Inout_z_ wchar_t *_String)
HRESULT WINAPI AssocQueryStringW(ASSOCF cfFlags, ASSOCSTR str, LPCWSTR pszAssoc, LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut)
Definition: assoc.c:427
LONG RegLoadMUIStringW(IN HKEY hKey, IN LPCWSTR pszValue OPTIONAL, OUT LPWSTR pszOutBuf, IN DWORD cbOutBuf, OUT LPDWORD pcbData OPTIONAL, IN DWORD Flags, IN LPCWSTR pszDirectory OPTIONAL)
Definition: muireg.c:53
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
#define _countof(array)
Definition: sndvol32.h:68
LPWSTR pszText
Definition: commctrl.h:2361
#define LVIF_IMAGE
Definition: commctrl.h:2306
unsigned long DWORD
Definition: ntddk_ex.h:95
INT WINAPI ImageList_AddIcon(HIMAGELIST himl, HICON hIcon)
Definition: imagelist.c:540
UINT mask
Definition: commctrl.h:2356
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
static void SetFileTypeEntryDefaultIcon(PFILE_TYPE_ENTRY Entry)
Definition: filetypes.cpp:191
#define LVSIL_NORMAL
Definition: commctrl.h:2294
#define LVM_INSERTITEMW
Definition: commctrl.h:2400
#define S_OK
Definition: intsafe.h:51
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static BOOL GetFileTypeIconsByKey(HKEY hKey, PFILE_TYPE_ENTRY Entry)
Definition: filetypes.cpp:154
static const WCHAR szName[]
Definition: msipriv.h:1194
#define LVIF_PARAM
Definition: commctrl.h:2307
struct FILE_TYPE_ENTRY * PFILE_TYPE_ENTRY
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
static BOOL QueryFileDescription(LPCWSTR ProgramPath, LPWSTR pszName, INT cchName)
Definition: filetypes.cpp:178
Definition: filetypes.cpp:32
#define REG_DWORD
Definition: sdbapi.c:596
#define HeapFree(x, y, z)
Definition: compat.h:483
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
base of all file and directory entries
Definition: entries.h:82

Referenced by FileTypesDlg_AddExt(), and FileTypesDlg_DoList().

◆ FileTypesDlg_OnDelete()

static void FileTypesDlg_OnDelete ( HWND  hwndDlg)
static

Definition at line 1608 of file filetypes.cpp.

1609 {
1610  CStringW strRemoveExt(MAKEINTRESOURCEW(IDS_REMOVE_EXT));
1612  if (MessageBoxW(hwndDlg, strRemoveExt, strTitle, MB_ICONQUESTION | MB_YESNO) == IDYES)
1613  {
1614  FileTypesDlg_RemoveExt(hwndDlg);
1615  }
1616 }
#define IDYES
Definition: winuser.h:829
#define MB_YESNO
Definition: winuser.h:811
#define IDS_REMOVE_EXT
Definition: shresdef.h:295
#define MB_ICONQUESTION
Definition: winuser.h:783
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
#define IDS_FILE_TYPES
Definition: shresdef.h:176
static BOOL FileTypesDlg_RemoveExt(HWND hwndDlg)
Definition: filetypes.cpp:788
CAtlStringW CStringW
Definition: atlstr.h:130
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by FolderOptionsFileTypesDlg().

◆ FileTypesDlg_OnItemChanging()

static void FileTypesDlg_OnItemChanging ( HWND  hwndDlg,
PFILE_TYPE_ENTRY  pEntry 
)
static

Definition at line 1619 of file filetypes.cpp.

1620 {
1621  WCHAR Buffer[255];
1622  static HBITMAP s_hbmProgram = NULL;
1623 
1624  // format buffer and set groupbox text
1626  StringCbPrintfW(Buffer, sizeof(Buffer), strFormat, &pEntry->FileExtension[1]);
1628 
1629  // format buffer and set description
1630  strFormat.LoadString(IDS_FILE_DETAILSADV);
1631  StringCbPrintfW(Buffer, sizeof(Buffer), strFormat,
1632  &pEntry->FileExtension[1], pEntry->FileDescription,
1633  pEntry->FileDescription);
1635 
1636  // delete previous program image
1637  if (s_hbmProgram)
1638  {
1639  DeleteObject(s_hbmProgram);
1640  s_hbmProgram = NULL;
1641  }
1642 
1643  // set program image
1644  HICON hIconSm = NULL;
1645  ExtractIconExW(pEntry->ProgramPath, 0, NULL, &hIconSm, 1);
1646  s_hbmProgram = BitmapFromIcon(hIconSm, 16, 16);
1649 
1650  // set program name
1651  if (pEntry->AppName[0])
1652  SetDlgItemTextW(hwndDlg, IDC_FILETYPES_APPNAME, pEntry->AppName);
1653  else
1654  SetDlgItemTextW(hwndDlg, IDC_FILETYPES_APPNAME, L"ReactOS");
1655 
1656  // Enable the Delete button
1657  if (pEntry->EditFlags & 0x00000010) // FTA_NoRemove
1659  else
1661 }
WCHAR FileDescription[100]
Definition: filetypes.cpp:35
static HICON
Definition: imagelist.c:84
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define TRUE
Definition: types.h:120
#define IDC_FILETYPES_APPNAME
Definition: shresdef.h:398
DWORD EditFlags
Definition: filetypes.cpp:38
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define IDC_FILETYPES_DETAILS_GROUPBOX
Definition: shresdef.h:397
#define IDC_FILETYPES_DESCRIPTION
Definition: shresdef.h:400
#define FALSE
Definition: types.h:117
UINT WINAPI ExtractIconExW(LPCWSTR lpszFile, INT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIcons)
Definition: iconcache.cpp:872
WCHAR FileExtension[30]
Definition: filetypes.cpp:34
smooth NULL
Definition: ftsmooth.c:416
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
LONG_PTR LPARAM
Definition: windef.h:208
Definition: bufpool.h:45
WCHAR AppName[64]
Definition: filetypes.cpp:39
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDS_FILE_DETAILS
Definition: shresdef.h:177
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static const WCHAR L[]
Definition: oid.c:1250
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define IDS_FILE_DETAILSADV
Definition: shresdef.h:178
#define IDC_FILETYPES_DELETE
Definition: shresdef.h:396
#define IMAGE_BITMAP
Definition: winuser.h:211
#define STM_SETIMAGE
Definition: winuser.h:2075
#define IDC_FILETYPES_ICON
Definition: shresdef.h:402
HICON hIconSm
Definition: msconfig.c:44
HBITMAP BitmapFromIcon(HICON hIcon, INT cx, INT cy)
CAtlStringW CStringW
Definition: atlstr.h:130
static HBITMAP
Definition: button.c:44
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
WCHAR ProgramPath[MAX_PATH]
Definition: filetypes.cpp:42

Referenced by FolderOptionsFileTypesDlg().

◆ FileTypesDlg_RemoveExt()

static BOOL FileTypesDlg_RemoveExt ( HWND  hwndDlg)
static

Definition at line 788 of file filetypes.cpp.

789 {
790  HWND hListView = GetDlgItem(hwndDlg, IDC_FILETYPES_LISTVIEW);
791 
792  INT iItem = ListView_GetNextItem(hListView, -1, LVNI_SELECTED);
793  if (iItem == -1)
794  return FALSE;
795 
796  WCHAR szExt[20];
797  szExt[0] = L'.';
798  ListView_GetItemText(hListView, iItem, 0, &szExt[1], _countof(szExt) - 1);
799  _wcslwr(szExt);
800 
801  DeleteExt(hwndDlg, szExt);
802  ListView_DeleteItem(hListView, iItem);
803  return TRUE;
804 }
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2430
#define TRUE
Definition: types.h:120
#define ListView_GetItemText(hwndLV, i, iSubItem_, pszText_, cchTextMax_)
Definition: commctrl.h:2680
#define LVNI_SELECTED
Definition: commctrl.h:2420
int32_t INT
Definition: typedefs.h:58
#define FALSE
Definition: types.h:117
#define ListView_DeleteItem(hwnd, i)
Definition: commctrl.h:2407
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
static BOOL DeleteExt(HWND hwndDlg, LPCWSTR pszExt)
Definition: filetypes.cpp:48
static const WCHAR L[]
Definition: oid.c:1250
_CRTIMP wchar_t *__cdecl _wcslwr(_Inout_z_ wchar_t *_String)
#define IDC_FILETYPES_LISTVIEW
Definition: shresdef.h:394

Referenced by FileTypesDlg_OnDelete().

◆ FolderOptionsFileTypesDlg()

INT_PTR CALLBACK FolderOptionsFileTypesDlg ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1665 of file filetypes.cpp.

1670 {
1671  LPNMLISTVIEW lppl;
1672  PFILE_TYPE_ENTRY pEntry;
1673  OPENASINFO Info;
1674  NEWEXT_DIALOG newext;
1675  EDITTYPE_DIALOG edittype;
1676 
1677  switch (uMsg)
1678  {
1679  case WM_INITDIALOG:
1680  pEntry = FileTypesDlg_DoList(hwndDlg);
1681 
1682  // Disable the Delete button if the listview is empty
1683  // the selected item should not be deleted by the user
1684  if (pEntry == NULL || (pEntry->EditFlags & 0x00000010)) // FTA_NoRemove
1686  return TRUE;
1687 
1688  case WM_COMMAND:
1689  switch (LOWORD(wParam))
1690  {
1691  case IDC_FILETYPES_NEW:
1692  newext.hwndLV = GetDlgItem(hwndDlg, IDC_FILETYPES_LISTVIEW);
1694  hwndDlg, NewExtDlgProc, (LPARAM)&newext))
1695  {
1696  FileTypesDlg_AddExt(hwndDlg, newext.szExt, newext.szFileType);
1697  }
1698  break;
1699 
1700  case IDC_FILETYPES_DELETE:
1701  FileTypesDlg_OnDelete(hwndDlg);
1702  break;
1703 
1704  case IDC_FILETYPES_CHANGE:
1706  if (pEntry)
1707  {
1708  ZeroMemory(&Info, sizeof(Info));
1710  Info.pcszFile = pEntry->FileExtension;
1711  Info.pcszClass = NULL;
1712  SHOpenWithDialog(hwndDlg, &Info);
1713  }
1714  break;
1715 
1717  edittype.hwndLV = GetDlgItem(hwndDlg, IDC_FILETYPES_LISTVIEW);
1718  edittype.pEntry = FileTypesDlg_GetEntry(edittype.hwndLV);
1720  hwndDlg, EditTypeDlgProc, (LPARAM)&edittype);
1721  break;
1722  }
1723  break;
1724 
1725  case WM_NOTIFY:
1726  lppl = (LPNMLISTVIEW) lParam;
1727  switch (lppl->hdr.code)
1728  {
1729  case LVN_KEYDOWN:
1730  {
1731  LV_KEYDOWN *pKeyDown = (LV_KEYDOWN *)lParam;
1732  if (pKeyDown->wVKey == VK_DELETE)
1733  {
1734  FileTypesDlg_OnDelete(hwndDlg);
1735  }
1736  break;
1737  }
1738 
1739  case NM_DBLCLK:
1740  edittype.hwndLV = GetDlgItem(hwndDlg, IDC_FILETYPES_LISTVIEW);
1741  edittype.pEntry = FileTypesDlg_GetEntry(edittype.hwndLV);
1743  hwndDlg, EditTypeDlgProc, (LPARAM)&edittype);
1744  break;
1745 
1746  case LVN_DELETEALLITEMS:
1747  return FALSE; // send LVN_DELETEITEM
1748 
1749  case LVN_DELETEITEM:
1750  pEntry = FileTypesDlg_GetEntry(lppl->hdr.hwndFrom, lppl->iItem);
1751  if (pEntry)
1752  {
1753  DestroyIcon(pEntry->hIconLarge);
1754  DestroyIcon(pEntry->hIconSmall);
1755  HeapFree(GetProcessHeap(), 0, pEntry);
1756  }
1757  return FALSE;
1758 
1759  case LVN_ITEMCHANGING:
1760  pEntry = FileTypesDlg_GetEntry(lppl->hdr.hwndFrom, lppl->iItem);
1761  if (!pEntry)
1762  {
1763  return TRUE;
1764  }
1765 
1766  if (!(lppl->uOldState & LVIS_FOCUSED) && (lppl->uNewState & LVIS_FOCUSED))
1767  {
1768  FileTypesDlg_OnItemChanging(hwndDlg, pEntry);
1769  }
1770  break;
1771 
1772  case PSN_SETACTIVE:
1773  // On page activation, set the focus to the listview
1775  break;
1776  }
1777  break;
1778  }
1779 
1780  return FALSE;
1781 }
#define IDOK
Definition: winuser.h:824
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
UINT uNewState
Definition: commctrl.h:3032
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define TRUE
Definition: types.h:120
static PFILE_TYPE_ENTRY FileTypesDlg_DoList(HWND hwndDlg)
Definition: filetypes.cpp:1527
PFILE_TYPE_ENTRY pEntry
Definition: filetypes.cpp:210
#define LV_KEYDOWN
Definition: commctrl.h:3182
DWORD EditFlags
Definition: filetypes.cpp:38
HICON hIconLarge
Definition: filetypes.cpp:40
#define ZeroMemory
Definition: winbase.h:1648
static void FileTypesDlg_OnItemChanging(HWND hwndDlg, PFILE_TYPE_ENTRY pEntry)
Definition: filetypes.cpp:1619
static BOOL FileTypesDlg_AddExt(HWND hwndDlg, LPCWSTR pszExt, LPCWSTR pszFileType)
Definition: filetypes.cpp:709
HWND WINAPI SetFocus(_In_opt_ HWND)
#define PSN_SETACTIVE
Definition: prsht.h:115
WPARAM wParam
Definition: combotst.c:138
struct TraceInfo Info
#define LVN_ITEMCHANGING
Definition: commctrl.h:3126
UINT code
Definition: winuser.h:3134
#define LVN_KEYDOWN
Definition: commctrl.h:3180
#define FALSE
Definition: types.h:117
HICON hIconSmall
Definition: filetypes.cpp:41
#define IDC_FILETYPES_ADVANCED
Definition: shresdef.h:401
WCHAR FileExtension[30]
Definition: filetypes.cpp:34
smooth NULL
Definition: ftsmooth.c:416
UINT uOldState
Definition: commctrl.h:3033
LONG_PTR LPARAM
Definition: windef.h:208
#define VK_DELETE
Definition: winuser.h:2208
static INT_PTR CALLBACK NewExtDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: filetypes.cpp:523
#define LVN_DELETEALLITEMS
Definition: commctrl.h:3130
static INT_PTR CALLBACK EditTypeDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: filetypes.cpp:1431
#define GetProcessHeap()
Definition: compat.h:484
HRESULT WINAPI SHOpenWithDialog(HWND hwndParent, const OPENASINFO *poainfo)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define LVN_DELETEITEM
Definition: commctrl.h:3129
static PFILE_TYPE_ENTRY FileTypesDlg_GetEntry(HWND hListView, INT iItem=-1)
Definition: filetypes.cpp:1591
#define IDD_EDITTYPE
Definition: shresdef.h:467
#define IDC_FILETYPES_NEW
Definition: shresdef.h:395
#define WM_COMMAND
Definition: winuser.h:1722
HWND hwndFrom
Definition: winuser.h:3132
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define shell32_hInstance
#define IDC_FILETYPES_DELETE
Definition: shresdef.h:396
#define NM_DBLCLK
Definition: commctrl.h:131
struct tagNMLISTVIEW * LPNMLISTVIEW
#define IDC_FILETYPES_CHANGE
Definition: shresdef.h:399
#define IDC_FILETYPES_LISTVIEW
Definition: shresdef.h:394
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDD_NEWEXTENSION
Definition: shresdef.h:466
Definition: filetypes.cpp:32
static void FileTypesDlg_OnDelete(HWND hwndDlg)
Definition: filetypes.cpp:1608
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:483
#define LVIS_FOCUSED
Definition: commctrl.h:2314
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by CFolderOptions::AddPages(), and ShowFolderOptionsDialog().

◆ GetFileTypeIconsByKey()

static BOOL GetFileTypeIconsByKey ( HKEY  hKey,
PFILE_TYPE_ENTRY  Entry 
)
static

Definition at line 154 of file filetypes.cpp.

155 {
156  Entry->hIconLarge = Entry->hIconSmall = NULL;
157 
158  // Open the "DefaultIcon" registry key
159  HKEY hDefIconKey;
160  LONG nResult = RegOpenKeyExW(hKey, L"DefaultIcon", 0, KEY_READ, &hDefIconKey);
161  if (nResult != ERROR_SUCCESS)
162  return FALSE;
163 
164  // Get the icon location
165  WCHAR szLocation[MAX_PATH + 32] = { 0 };
166  DWORD dwSize = sizeof(szLocation);
167  nResult = RegQueryValueExW(hDefIconKey, NULL, NULL, NULL, LPBYTE(szLocation), &dwSize);
168 
169  RegCloseKey(hDefIconKey);
170 
171  if (nResult != ERROR_SUCCESS || szLocation[0] == 0)
172  return FALSE;
173 
175 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
static BOOL GetFileTypeIconsEx(PFILE_TYPE_ENTRY Entry, LPCWSTR IconLocation)
Definition: filetypes.cpp:125
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR szLocation[]
Definition: http.c:111
static const WCHAR L[]
Definition: oid.c:1250
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
base of all file and directory entries
Definition: entries.h:82

Referenced by FileTypesDlg_InsertToLV().

◆ GetFileTypeIconsEx()

static BOOL GetFileTypeIconsEx ( PFILE_TYPE_ENTRY  Entry,
LPCWSTR  IconLocation 
)
static

Definition at line 125 of file filetypes.cpp.

126 {
127  Entry->hIconLarge = Entry->hIconSmall = NULL;
128 
129  if (lstrcmpiW(Entry->FileExtension, L".exe") == 0 ||
130  lstrcmpiW(Entry->FileExtension, L".scr") == 0)
131  {
132  // It's an executable
137  IMAGE_ICON, cx, cy, 0));
138  StringCbCopyW(Entry->IconPath, sizeof(Entry->IconPath), g_pszShell32);
139  Entry->nIconIndex = -IDI_SHELL_EXE;
140  }
141  else if (lstrcmpW(IconLocation, L"%1") == 0)
142  {
143  return FALSE; // self icon
144  }
145  else
146  {
148  }
149 
150  return Entry->hIconLarge && Entry->hIconSmall;
151 }
static void DoFileTypeIconLocation(PFILE_TYPE_ENTRY Entry, LPCWSTR IconLocation)
Definition: filetypes.cpp:111
static HICON
Definition: imagelist.c:84
#define IMAGE_ICON
Definition: winuser.h:212
LPCWSTR g_pszShell32
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define SM_CYSMICON
Definition: winuser.h:1003
int32_t INT
Definition: typedefs.h:58
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
#define FALSE
Definition: types.h:117
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
smooth NULL
Definition: ftsmooth.c:416
int WINAPI GetSystemMetrics(_In_ int)
#define SM_CXSMICON
Definition: winuser.h:1002
static const WCHAR L[]
Definition: oid.c:1250
#define IDI_SHELL_EXE
Definition: shresdef.h:498
#define shell32_hInstance
_Out_opt_ int * cx
Definition: commctrl.h:581
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
base of all file and directory entries
Definition: entries.h:82

Referenced by GetFileTypeIconsByKey().

◆ NewActionDlg_OnOK()

static void NewActionDlg_OnOK ( HWND  hwndDlg,
PACTION_DIALOG  pNewAct 
)
static

Definition at line 858 of file filetypes.cpp.

859 {
860  // check action
861  GetDlgItemTextW(hwndDlg, IDC_ACTION_ACTION, pNewAct->szAction, _countof(pNewAct->szAction));
862  StrTrimW(pNewAct->szAction, g_pszSpace);
863  if (pNewAct->szAction[0] == 0)
864  {
865  // action was empty, error
866  HWND hwndCtrl = GetDlgItem(hwndDlg, IDC_ACTION_ACTION);
867  SendMessageW(hwndCtrl, EM_SETSEL, 0, -1);
868  SetFocus(hwndCtrl);
871  MessageBoxW(hwndDlg, strText, strTitle, MB_ICONERROR);
872  return;
873  }
874 
875  // check app
876  GetDlgItemTextW(hwndDlg, IDC_ACTION_APP, pNewAct->szApp, _countof(pNewAct->szApp));
877  StrTrimW(pNewAct->szApp, g_pszSpace);
878  if (pNewAct->szApp[0] == 0 ||
880  {
881  // app was empty or invalid
882  HWND hwndCtrl = GetDlgItem(hwndDlg, IDC_ACTION_APP);
883  SendMessageW(hwndCtrl, EM_SETSEL, 0, -1);
884  SetFocus(hwndCtrl);
887  MessageBoxW(hwndDlg, strText, strTitle, MB_ICONERROR);
888  return;
889  }
890 
891  EndDialog(hwndDlg, IDOK);
892 }
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2271
#define IDOK
Definition: winuser.h:824
#define IDC_ACTION_ACTION
Definition: shresdef.h:449
#define IDS_INVALID_PROGRAM
Definition: shresdef.h:289
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
LPCWSTR g_pszSpace
#define IDS_SPECIFY_ACTION
Definition: shresdef.h:288
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define _countof(array)
Definition: sndvol32.h:68
#define EM_SETSEL
Definition: winuser.h:2000
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
WCHAR szApp[MAX_PATH]
Definition: filetypes.cpp:814
#define IDS_FILE_TYPES
Definition: shresdef.h:176
#define MB_ICONERROR
Definition: winuser.h:781
#define IDC_ACTION_APP
Definition: shresdef.h:450
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim)
Definition: string.c:1869
CAtlStringW CStringW
Definition: atlstr.h:130
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
WCHAR szAction[64]
Definition: filetypes.cpp:813

Referenced by NewActionDlgProc().

◆ NewActionDlgProc()

static INT_PTR CALLBACK NewActionDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 896 of file filetypes.cpp.

897 {
898  static PACTION_DIALOG s_pNewAct = NULL;
899 
900  switch (uMsg)
901  {
902  case WM_INITDIALOG:
903  s_pNewAct = (PACTION_DIALOG)lParam;
904  s_pNewAct->bUseDDE = FALSE;
906  return TRUE;
907 
908  case WM_COMMAND:
909  switch (LOWORD(wParam))
910  {
911  case IDOK:
912  NewActionDlg_OnOK(hwndDlg, s_pNewAct);
913  break;
914 
915  case IDCANCEL:
916  EndDialog(hwndDlg, IDCANCEL);
917  break;
918 
919  case IDC_ACTION_BROWSE:
920  ActionDlg_OnBrowse(hwndDlg, s_pNewAct, FALSE);
921  break;
922  }
923  break;
924  }
925  return 0;
926 }
#define IDOK
Definition: winuser.h:824
#define TRUE
Definition: types.h:120
#define IDC_ACTION_USE_DDE
Definition: shresdef.h:452
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
struct ACTION_DIALOG * PACTION_DIALOG
smooth NULL
Definition: ftsmooth.c:416
static void ActionDlg_OnBrowse(HWND hwndDlg, PACTION_DIALOG pNewAct, BOOL bEdit=FALSE)
Definition: filetypes.cpp:819
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_COMMAND
Definition: winuser.h:1722
static void NewActionDlg_OnOK(HWND hwndDlg, PACTION_DIALOG pNewAct)
Definition: filetypes.cpp:858
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define IDCANCEL
Definition: winuser.h:825
#define IDC_ACTION_BROWSE
Definition: shresdef.h:451
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by EditTypeDlg_OnCommand().

◆ NewExtDlg_OnAdvanced()

static VOID NewExtDlg_OnAdvanced ( HWND  hwndDlg,
PNEWEXT_DIALOG  pNewExt 
)
static

Definition at line 351 of file filetypes.cpp.

352 {
353  // If "Advanced" button was clicked, then we shrink or expand the dialog.
354  RECT rc, rc1, rc2;
355 
356  GetWindowRect(hwndDlg, &rc);
357  rc.bottom = rc.top + (pNewExt->rcDlg.bottom - pNewExt->rcDlg.top);
358 
359  GetWindowRect(GetDlgItem(hwndDlg, IDOK), &rc1);
360  MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rc1, 2);
361 
362  GetWindowRect(GetDlgItem(hwndDlg, IDCANCEL), &rc2);
363  MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rc2, 2);
364 
365  if (pNewExt->bAdvanced)
366  {
367  rc1.top += pNewExt->dy;
368  rc1.bottom += pNewExt->dy;
369 
370  rc2.top += pNewExt->dy;
371  rc2.bottom += pNewExt->dy;
372 
375 
377  SetDlgItemTextW(hwndDlg, IDC_NEWEXT_ADVANCED, strLeft);
378 
380  }
381  else
382  {
383  rc1.top -= pNewExt->dy;
384  rc1.bottom -= pNewExt->dy;
385 
386  rc2.top -= pNewExt->dy;
387  rc2.bottom -= pNewExt->dy;
388 
391 
393  SetDlgItemTextW(hwndDlg, IDC_NEWEXT_ADVANCED, strRight);
394 
395  rc.bottom -= pNewExt->dy;
396 
398  SetDlgItemTextW(hwndDlg, IDC_NEWEXT_COMBOBOX, strText);
399  }
400 
401  HDWP hDWP = BeginDeferWindowPos(3);
402 
403  if (hDWP)
404  hDWP = DeferWindowPos(hDWP, GetDlgItem(hwndDlg, IDOK), NULL,
405  rc1.left, rc1.top, rc1.right - rc1.left, rc1.bottom - rc1.top,
407  if (hDWP)
408  hDWP = DeferWindowPos(hDWP, GetDlgItem(hwndDlg, IDCANCEL), NULL,
409  rc2.left, rc2.top, rc2.right - rc2.left, rc2.bottom - rc2.top,
411  if (hDWP)
412  hDWP = DeferWindowPos(hDWP, hwndDlg, NULL,
413  rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
415 
416  if (hDWP)
417  EndDeferWindowPos(hDWP);
418 }
HDWP WINAPI BeginDeferWindowPos(_In_ int)
#define IDOK
Definition: winuser.h:824
#define SW_SHOWNOACTIVATE
Definition: winuser.h:768
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define SW_HIDE
Definition: winuser.h:762
LONG top
Definition: windef.h:307
HWND WINAPI SetFocus(_In_opt_ HWND)
LONG left
Definition: windef.h:306
#define SWP_NOZORDER
Definition: winuser.h:1232
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
LONG right
Definition: windef.h:308
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
#define IDC_NEWEXT_ASSOC
Definition: shresdef.h:408
smooth NULL
Definition: ftsmooth.c:416
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDS_NEWEXT_ADVANCED_LEFT
Definition: shresdef.h:281
#define SWP_NOACTIVATE
Definition: winuser.h:1227
#define IDS_NEWEXT_NEW
Definition: shresdef.h:283
LONG bottom
Definition: windef.h:309
CAtlStringW CStringW
Definition: atlstr.h:130
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
static const WCHAR rc2[]
Definition: oid.c:1216
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDCANCEL
Definition: winuser.h:825
#define IDS_NEWEXT_ADVANCED_RIGHT
Definition: shresdef.h:282
#define IDC_NEWEXT_ADVANCED
Definition: shresdef.h:406
#define IDC_NEWEXT_COMBOBOX
Definition: shresdef.h:407

Referenced by NewExtDlg_OnInitDialog(), and NewExtDlgProc().

◆ NewExtDlg_OnInitDialog()

static BOOL NewExtDlg_OnInitDialog ( HWND  hwndDlg,
PNEWEXT_DIALOG  pNewExt 
)
static

Definition at line 421 of file filetypes.cpp.

422 {
423  pNewExt->bAdvanced = FALSE;
424 
425  // get window rectangle
426  GetWindowRect(hwndDlg, &pNewExt->rcDlg);
427 
428  // get delta Y
429  RECT rc1, rc2;
430  GetWindowRect(GetDlgItem(hwndDlg, IDC_NEWEXT_EDIT), &rc1);
432  pNewExt->dy = rc2.top - rc1.top;
433 
434  // initialize
439 
440  // shrink it first time
441  NewExtDlg_OnAdvanced(hwndDlg, pNewExt);
442 
443  return TRUE;
444 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define IDC_NEWEXT_EDIT
Definition: shresdef.h:405
#define TRUE
Definition: types.h:120
#define EM_SETLIMITTEXT
Definition: winuser.h:1993
LONG top
Definition: windef.h:307
#define FALSE
Definition: types.h:117
#define CB_ADDSTRING
Definition: winuser.h:1918
LONG_PTR LPARAM
Definition: windef.h:208
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define _countof(array)
Definition: sndvol32.h:68
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_SETCURSEL
Definition: winuser.h:1943
WCHAR szExt[16]
Definition: filetypes.cpp:346
#define IDS_NEWEXT_NEW
Definition: shresdef.h:283
CAtlStringW CStringW
Definition: atlstr.h:130
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
static const WCHAR rc2[]
Definition: oid.c:1216
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
static VOID NewExtDlg_OnAdvanced(HWND hwndDlg, PNEWEXT_DIALOG pNewExt)
Definition: filetypes.cpp:351
#define IDC_NEWEXT_COMBOBOX
Definition: shresdef.h:407

Referenced by NewExtDlgProc().

◆ NewExtDlg_OnOK()

static BOOL NewExtDlg_OnOK ( HWND  hwndDlg,
PNEWEXT_DIALOG  pNewExt 
)
static

Definition at line 447 of file filetypes.cpp.

448 {
450  INT iItem;
451 
452  GetDlgItemTextW(hwndDlg, IDC_NEWEXT_EDIT, pNewExt->szExt, _countof(pNewExt->szExt));
453  StrTrimW(pNewExt->szExt, g_pszSpace);
454  _wcsupr(pNewExt->szExt);
455 
456  GetDlgItemTextW(hwndDlg, IDC_NEWEXT_COMBOBOX, pNewExt->szFileType, _countof(pNewExt->szFileType));
457  StrTrimW(pNewExt->szFileType, g_pszSpace);
458 
459  if (pNewExt->szExt[0] == 0)
460  {
463  MessageBoxW(hwndDlg, strText, strTitle, MB_ICONERROR);
464  return FALSE;
465  }
466 
467  ZeroMemory(&find, sizeof(find));
468  find.flags = LVFI_STRING;
469  if (pNewExt->szExt[0] == L'.')
470  {
471  find.psz = &pNewExt->szExt[1];
472  }
473  else
474  {
475  find.psz = pNewExt->szExt;
476  }
477 
478  iItem = ListView_FindItem(pNewExt->hwndLV, -1, &find);
479  if (iItem >= 0)
480  {
481  // already exists
482 
483  // get file type
484  WCHAR szFileType[64];
485  LV_ITEM item;
486  ZeroMemory(&item, sizeof(item));
487  item.mask = LVIF_TEXT;
488  item.pszText = szFileType;
489  item.cchTextMax = _countof(szFileType);
490  item.iItem = iItem;
491  item.iSubItem = 1;
492  ListView_GetItem(pNewExt->hwndLV, &item);
493 
494  // get text
495  CStringW strText;
496  strText.Format(IDS_NEWEXT_ALREADY_ASSOC, find.psz, szFileType, find.psz, szFileType);
497 
498  // get title
499  CStringW strTitle;
501 
502  if (MessageBoxW(hwndDlg, strText, strTitle, MB_ICONWARNING | MB_YESNO) == IDNO)
503  {
504  return FALSE;
505  }
506 
507  // Delete the extension
508  CStringW strExt(L".");
509  strExt += find.psz;
510  strExt.MakeLower();
511  DeleteExt(hwndDlg, strExt);
512 
513  // Delete the item
514  ListView_DeleteItem(pNewExt->hwndLV, iItem);
515  }
516 
517  EndDialog(hwndDlg, IDOK);
518  return TRUE;
519 }
#define LV_ITEM
Definition: commctrl.h:2333
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2271
#define IDOK
Definition: winuser.h:824
#define IDC_NEWEXT_EDIT
Definition: shresdef.h:405
#define TRUE
Definition: types.h:120
WCHAR szFileType[64]
Definition: filetypes.cpp:347
#define ZeroMemory
Definition: winbase.h:1648
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:716
#define LV_FINDINFO
Definition: commctrl.h:2441
int32_t INT
Definition: typedefs.h:58
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define MB_ICONWARNING
Definition: winuser.h:780
#define LVIF_TEXT
Definition: commctrl.h:2305
#define FALSE
Definition: types.h:117
#define MB_YESNO
Definition: winuser.h:811
#define IDS_NEWEXT_EXT_IN_USE
Definition: shresdef.h:286
LPCWSTR g_pszSpace
#define ListView_DeleteItem(hwnd, i)
Definition: commctrl.h:2407
#define IDS_NEWEXT_SPECIFY_EXT
Definition: shresdef.h:284
_CRTIMP wchar_t *__cdecl _wcsupr(_Inout_z_ wchar_t *_String)
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
static BOOL DeleteExt(HWND hwndDlg, LPCWSTR pszExt)
Definition: filetypes.cpp:48
#define IDS_FILE_TYPES
Definition: shresdef.h:176
static const WCHAR L[]
Definition: oid.c:1250
#define MB_ICONERROR
Definition: winuser.h:781
#define IDS_NEWEXT_ALREADY_ASSOC
Definition: shresdef.h:285
static ATOM item
Definition: dde.c:856
WCHAR szExt[16]
Definition: filetypes.cpp:346
BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim)
Definition: string.c:1869
static TAGID TAGID find
Definition: db.cpp:153
#define LVFI_STRING
Definition: commctrl.h:2433
#define ListView_FindItem(hwnd, iStart, plvfi)
Definition: commctrl.h:2466
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2390
BOOL LoadString(_In_ UINT nID)
Definition: cstringt.h:554
CAtlStringW CStringW
Definition: atlstr.h:130
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDNO
Definition: winuser.h:830
#define IDC_NEWEXT_COMBOBOX
Definition: shresdef.h:407

Referenced by NewExtDlgProc().

◆ NewExtDlgProc()

static INT_PTR CALLBACK NewExtDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 523 of file filetypes.cpp.

528 {
529  static PNEWEXT_DIALOG s_pNewExt = NULL;
530 
531  switch (uMsg)
532  {
533  case WM_INITDIALOG:
534  s_pNewExt = (PNEWEXT_DIALOG)lParam;
535  NewExtDlg_OnInitDialog(hwndDlg, s_pNewExt);
536  return TRUE;
537 
538  case WM_COMMAND:
539  switch (LOWORD(wParam))
540  {
541  case IDOK:
542  NewExtDlg_OnOK(hwndDlg, s_pNewExt);
543  break;
544 
545  case IDCANCEL:
546  EndDialog(hwndDlg, IDCANCEL);
547  break;
548 
549  case IDC_NEWEXT_ADVANCED:
550  s_pNewExt->bAdvanced = !s_pNewExt->bAdvanced;
551  NewExtDlg_OnAdvanced(hwndDlg, s_pNewExt);
552  break;
553  }
554  break;
555  }
556  return 0;
557 }
#define IDOK
Definition: winuser.h:824
struct NEWEXT_DIALOG * PNEWEXT_DIALOG
static BOOL NewExtDlg_OnOK(HWND hwndDlg, PNEWEXT_DIALOG pNewExt)
Definition: filetypes.cpp:447
#define TRUE
Definition: types.h:120
static BOOL NewExtDlg_OnInitDialog(HWND hwndDlg, PNEWEXT_DIALOG pNewExt)
Definition: filetypes.cpp:421
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
smooth NULL
Definition: ftsmooth.c:416
#define WM_COMMAND
Definition: winuser.h:1722
#define IDCANCEL
Definition: winuser.h:825
#define IDC_NEWEXT_ADVANCED
Definition: shresdef.h:406
static VOID NewExtDlg_OnAdvanced(HWND hwndDlg, PNEWEXT_DIALOG pNewExt)
Definition: filetypes.cpp:351
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by FolderOptionsFileTypesDlg().

◆ QueryFileDescription()

static BOOL QueryFileDescription ( LPCWSTR  ProgramPath,
LPWSTR  pszName,
INT  cchName 
)
static

Definition at line 178 of file filetypes.cpp.

179 {
180  SHFILEINFOW FileInfo = { 0 };
181  if (SHGetFileInfoW(ProgramPath, 0, &FileInfo, sizeof(FileInfo), SHGFI_DISPLAYNAME))
182  {
183  StringCchCopyW(pszName, cchName, FileInfo.szDisplayName);
184  return TRUE;
185  }
186 
187  return !!GetFileTitleW(ProgramPath, pszName, cchName);
188 }
#define TRUE
Definition: types.h:120
short WINAPI GetFileTitleW(LPCWSTR lpFile, LPWSTR lpTitle, WORD cbBuf)
Definition: filedlg.c:4791
_In_ PSID _Out_writes_to_opt_ cchName LPSTR _Inout_ LPDWORD cchName
Definition: winbase.h:2729
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:164
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:413

Referenced by FileTypesDlg_InsertToLV().

◆ SetFileTypeEntryDefaultIcon()

static void SetFileTypeEntryDefaultIcon ( PFILE_TYPE_ENTRY  Entry)
static

Definition at line 191 of file filetypes.cpp.

192 {
194  INT cxSmall = GetSystemMetrics(SM_CXSMICON);
195  INT cySmall = GetSystemMetrics(SM_CYSMICON);
197  IMAGE_ICON, cxSmall, cySmall, 0));
198  StringCbCopyW(Entry->IconPath, sizeof(Entry->IconPath), g_pszShell32);
199  Entry->nIconIndex = -IDI_SHELL_FOLDER_OPTIONS;
200 }
static HICON
Definition: imagelist.c:84
#define IMAGE_ICON
Definition: winuser.h:212
#define IDI_SHELL_FOLDER_OPTIONS
Definition: shresdef.h:605
LPCWSTR g_pszShell32
#define SM_CYSMICON
Definition: winuser.h:1003
int32_t INT
Definition: typedefs.h:58
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
int WINAPI GetSystemMetrics(_In_ int)
#define SM_CXSMICON
Definition: winuser.h:1002
#define shell32_hInstance
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
base of all file and directory entries
Definition: entries.h:82

Referenced by EditTypeDlg_UpdateEntryIcon(), and FileTypesDlg_InsertToLV().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( fprop  )