ReactOS  0.4.14-dev-337-gf981a68
view.cpp File Reference
#include "precomp.h"
Include dependency graph for view.cpp:

Go to the source code of this file.

Classes

struct  VIEWTREE_ICON
 
struct  VIEWTREE_ENTRY
 

Macros

#define I_CHECKED   0
 
#define I_UNCHECKED   1
 
#define I_CHECKED_DISABLED   2
 
#define I_UNCHECKED_DISABLED   3
 
#define I_RADIO_CHECKED   4
 
#define I_RADIO_UNCHECKED   5
 
#define I_RADIO_CHECKED_DISABLED   6
 
#define I_RADIO_UNCHECKED_DISABLED   7
 
#define PREDEFINED_ICON_COUNT   8
 

Typedefs

typedef struct VIEWTREE_ICON VIEWTREE_ICON
 
typedef struct VIEWTREE_ICONPVIEWTREE_ICON
 
typedef enum VIEWTREE_ENTRY_TYPE VIEWTREE_ENTRY_TYPE
 
typedef enum VIEWTREE_ENTRY_TYPEPVIEWTREE_ENTRY_TYPE
 
typedef struct VIEWTREE_ENTRY VIEWTREE_ENTRY
 
typedef struct VIEWTREE_ENTRYPVIEWTREE_ENTRY
 

Enumerations

enum  VIEWTREE_ENTRY_TYPE { AETYPE_GROUP, AETYPE_CHECKBOX, AETYPE_RADIO }
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (fprop)
 
static INT ViewTree_FindIcon (LPCWSTR pszPath, UINT nIconIndex)
 
static INT ViewTree_AddIcon (LPCWSTR pszPath, UINT nIconIndex)
 
static PVIEWTREE_ENTRY ViewTree_GetItem (DWORD dwID)
 
static INT ViewTree_GetImage (PVIEWTREE_ENTRY pEntry)
 
static VOID ViewTree_InsertEntry (HWND hwndTreeView, PVIEWTREE_ENTRY pEntry)
 
static VOID ViewTree_InsertAll (HWND hwndTreeView)
 
static BOOL ViewTree_LoadTree (HKEY hKey, LPCWSTR pszKeyName, DWORD dwParentID)
 
static BOOL ViewTree_LoadAll (VOID)
 
static int ViewTree_Compare (const void *x, const void *y)
 
static VOID ViewTree_SortAll (VOID)
 
static HIMAGELIST ViewDlg_CreateTreeImageList (VOID)
 
static BOOL ViewDlg_OnInitDialog (HWND hwndDlg)
 
static BOOL ViewDlg_ToggleCheckItem (HWND hwndDlg, HTREEITEM hItem)
 
static VOID ViewDlg_OnTreeViewClick (HWND hwndDlg)
 
static void ViewDlg_OnTreeViewKeyDown (HWND hwndDlg, TV_KEYDOWN *KeyDown)
 
static INT_PTR ViewDlg_OnTreeCustomDraw (HWND hwndDlg, NMTVCUSTOMDRAW *Draw)
 
static VOID ViewDlg_RestoreDefaults (HWND hwndDlg)
 
static VOID ScanAdvancedSettings (SHELLSTATE *pSS, DWORD *pdwMask)
 
static BOOL CALLBACK RefreshBrowsersCallback (HWND hWnd, LPARAM msg)
 
static VOID ViewDlg_Apply (HWND hwndDlg)
 
INT_PTR CALLBACK FolderOptionsViewDlg (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Variables

static PVIEWTREE_ENTRY s_ViewTreeEntries = NULL
 
static INT s_ViewTreeEntryCount = 0
 
static PVIEWTREE_ICON s_ViewTreeIcons = NULL
 
static INT s_ViewTreeIconCount = 0
 
static HIMAGELIST s_hTreeImageList = NULL
 

Macro Definition Documentation

◆ I_CHECKED

#define I_CHECKED   0

Definition at line 30 of file view.cpp.

◆ I_CHECKED_DISABLED

#define I_CHECKED_DISABLED   2

Definition at line 32 of file view.cpp.

◆ I_RADIO_CHECKED

#define I_RADIO_CHECKED   4

Definition at line 34 of file view.cpp.

◆ I_RADIO_CHECKED_DISABLED

#define I_RADIO_CHECKED_DISABLED   6

Definition at line 36 of file view.cpp.

◆ I_RADIO_UNCHECKED

#define I_RADIO_UNCHECKED   5

Definition at line 35 of file view.cpp.

◆ I_RADIO_UNCHECKED_DISABLED

#define I_RADIO_UNCHECKED_DISABLED   7

Definition at line 37 of file view.cpp.

◆ I_UNCHECKED

#define I_UNCHECKED   1

Definition at line 31 of file view.cpp.

◆ I_UNCHECKED_DISABLED

#define I_UNCHECKED_DISABLED   3

Definition at line 33 of file view.cpp.

◆ PREDEFINED_ICON_COUNT

#define PREDEFINED_ICON_COUNT   8

Definition at line 38 of file view.cpp.

Typedef Documentation

◆ PVIEWTREE_ENTRY

◆ PVIEWTREE_ENTRY_TYPE

◆ PVIEWTREE_ICON

◆ VIEWTREE_ENTRY

◆ VIEWTREE_ENTRY_TYPE

◆ VIEWTREE_ICON

Enumeration Type Documentation

◆ VIEWTREE_ENTRY_TYPE

Enumerator
AETYPE_GROUP 
AETYPE_CHECKBOX 
AETYPE_RADIO 

Definition at line 48 of file view.cpp.

49 {
VIEWTREE_ENTRY_TYPE
Definition: view.cpp:48
enum VIEWTREE_ENTRY_TYPE * PVIEWTREE_ENTRY_TYPE

Function Documentation

◆ FolderOptionsViewDlg()

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

Definition at line 934 of file view.cpp.

939 {
940  INT_PTR Result;
942 
943  switch (uMsg)
944  {
945  case WM_INITDIALOG:
946  return ViewDlg_OnInitDialog(hwndDlg);
947 
948  case WM_COMMAND:
949  switch (LOWORD(wParam))
950  {
951  case IDC_VIEW_RESTORE_DEFAULTS: // Restore Defaults
952  ViewDlg_RestoreDefaults(hwndDlg);
953  break;
954  }
955  break;
956 
957  case WM_NOTIFY:
958  switch (LPNMHDR(lParam)->code)
959  {
960  case NM_CLICK: // clicked on treeview
961  ViewDlg_OnTreeViewClick(hwndDlg);
962  break;
963 
964  case NM_CUSTOMDRAW: // custom draw (for graying)
968  return Result;
969 
970  case TVN_KEYDOWN: // key is down
972  break;
973 
974  case PSN_APPLY: // [Apply] is clicked
975  ViewDlg_Apply(hwndDlg);
976  break;
977 
978  default:
979  break;
980  }
981  break;
982  }
983 
984  return FALSE;
985 }
static VOID ViewDlg_RestoreDefaults(HWND hwndDlg)
Definition: view.cpp:766
void Draw(HDC aDc)
Definition: magnifier.c:359
#define IDC_VIEW_RESTORE_DEFAULTS
Definition: shresdef.h:436
#define PSN_APPLY
Definition: prsht.h:117
int32_t INT_PTR
Definition: typedefs.h:62
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
#define DWLP_MSGRESULT
Definition: winuser.h:864
struct tagNMHDR * LPNMHDR
static VOID ViewDlg_OnTreeViewClick(HWND hwndDlg)
Definition: view.cpp:698
static BOOL ViewDlg_OnInitDialog(HWND hwndDlg)
Definition: view.cpp:623
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
static void ViewDlg_OnTreeViewKeyDown(HWND hwndDlg, TV_KEYDOWN *KeyDown)
Definition: view.cpp:720
#define TV_KEYDOWN
Definition: commctrl.h:3718
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
#define WM_COMMAND
Definition: winuser.h:1722
#define NM_CLICK
Definition: commctrl.h:130
static VOID ViewDlg_Apply(HWND hwndDlg)
Definition: view.cpp:871
static INT_PTR ViewDlg_OnTreeCustomDraw(HWND hwndDlg, NMTVCUSTOMDRAW *Draw)
Definition: view.cpp:736
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define TVN_KEYDOWN
Definition: commctrl.h:3709
#define WM_NOTIFY
Definition: richedit.h:61

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

◆ RefreshBrowsersCallback()

static BOOL CALLBACK RefreshBrowsersCallback ( HWND  hWnd,
LPARAM  msg 
)
static

Definition at line 855 of file view.cpp.

856 {
857  WCHAR ClassName[100];
858  if (GetClassNameW(hWnd, ClassName, _countof(ClassName)))
859  {
860  if (!wcscmp(ClassName, L"Progman") ||
861  !wcscmp(ClassName, L"CabinetWClass") ||
862  !wcscmp(ClassName, L"ExploreWClass"))
863  {
865  }
866  }
867  return TRUE;
868 }
#define TRUE
Definition: types.h:120
#define _countof(array)
Definition: fontsub.cpp:30
HWND hWnd
Definition: settings.c:17
#define FCIDM_DESKBROWSER_REFRESH
Definition: shresdef.h:732
int WINAPI GetClassNameW(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPWSTR lpClassName, _In_ int nMaxCount)
#define PostMessage
Definition: winuser.h:5733
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR L[]
Definition: oid.c:1250
#define WM_COMMAND
Definition: winuser.h:1722
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

Referenced by ViewDlg_Apply().

◆ ScanAdvancedSettings()

static VOID ScanAdvancedSettings ( SHELLSTATE pSS,
DWORD pdwMask 
)
static

Definition at line 804 of file view.cpp.

805 {
806  for (INT i = 0; i < s_ViewTreeEntryCount; ++i)
807  {
808  const VIEWTREE_ENTRY *pEntry = &s_ViewTreeEntries[i];
809  if (pEntry->dwType == AETYPE_GROUP || pEntry->bGrayed)
810  continue;
811 
812  BOOL bChecked = pEntry->bChecked;
813 
814  // FIXME: Add more items
815  if (lstrcmpiW(pEntry->szKeyName, L"SuperHidden") == 0)
816  {
817  pSS->fShowSuperHidden = !bChecked ? 1 : 0;
818  *pdwMask |= SSF_SHOWSUPERHIDDEN;
819  continue;
820  }
821  if (lstrcmpiW(pEntry->szKeyName, L"DesktopProcess") == 0)
822  {
823  pSS->fSepProcess = bChecked ? 1 : 0;
824  *pdwMask |= SSF_SEPPROCESS;
825  continue;
826  }
827  if (lstrcmpiW(pEntry->szKeyName, L"SHOWALL") == 0)
828  {
829  pSS->fShowAllObjects = !bChecked ? 1 : 0;
830  *pdwMask |= SSF_SHOWALLOBJECTS;
831  continue;
832  }
833  if (lstrcmpiW(pEntry->szKeyName, L"HideFileExt") == 0)
834  {
835  pSS->fShowExtensions = !bChecked ? 1 : 0;
836  *pdwMask |= SSF_SHOWEXTENSIONS;
837  continue;
838  }
839  if (lstrcmpiW(pEntry->szKeyName, L"ShowCompColor") == 0)
840  {
841  pSS->fShowCompColor = bChecked ? 1 : 0;
842  *pdwMask |= SSF_SHOWCOMPCOLOR;
843  continue;
844  }
845  if (lstrcmpiW(pEntry->szKeyName, L"ShowInfoTip") == 0)
846  {
847  pSS->fShowInfoTip = bChecked ? 1 : 0;
848  *pdwMask |= SSF_SHOWINFOTIP;
849  continue;
850  }
851  }
852 }
WCHAR szKeyName[64]
Definition: view.cpp:61
BOOL fShowInfoTip
Definition: shlobj.h:1469
Definition: view.cpp:56
#define SSF_SHOWEXTENSIONS
Definition: shlobj.h:1519
BOOL fShowSuperHidden
Definition: shlobj.h:1473
#define SSF_SHOWSUPERHIDDEN
Definition: shlobj.h:1531
int32_t INT
Definition: typedefs.h:56
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
BOOL fSepProcess
Definition: shlobj.h:1483
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
BOOL fShowAllObjects
Definition: shlobj.h:1457
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL fShowCompColor
Definition: shlobj.h:1462
#define SSF_SHOWALLOBJECTS
Definition: shlobj.h:1518
#define SSF_SHOWCOMPCOLOR
Definition: shlobj.h:1520
static PVIEWTREE_ENTRY s_ViewTreeEntries
Definition: view.cpp:81
static INT s_ViewTreeEntryCount
Definition: view.cpp:82
static const WCHAR L[]
Definition: oid.c:1250
#define SSF_SEPPROCESS
Definition: shlobj.h:1532
BOOL bGrayed
Definition: view.cpp:76
DWORD dwType
Definition: view.cpp:62
BOOL fShowExtensions
Definition: shlobj.h:1458
BOOL bChecked
Definition: view.cpp:77
#define SSF_SHOWINFOTIP
Definition: shlobj.h:1527

Referenced by ViewDlg_Apply().

◆ ViewDlg_Apply()

static VOID ViewDlg_Apply ( HWND  hwndDlg)
static

Definition at line 871 of file view.cpp.

872 {
873  for (INT i = 0; i < s_ViewTreeEntryCount; ++i)
874  {
875  // ignore the entry if the type is group or the entry is grayed
876  VIEWTREE_ENTRY *pEntry = &s_ViewTreeEntries[i];
877  if (pEntry->dwType == AETYPE_GROUP || pEntry->bGrayed)
878  continue;
879 
880  // open the registry key
881  HKEY hkeyTarget;
882  if (RegOpenKeyExW(HKEY(pEntry->hkeyRoot), pEntry->szRegPath, 0,
883  KEY_WRITE, &hkeyTarget) != ERROR_SUCCESS)
884  {
885  continue;
886  }
887 
888  // checked or unchecked?
889  DWORD dwValue, dwSize;
890  if (pEntry->bChecked)
891  {
892  dwValue = pEntry->dwCheckedValue;
893  }
894  else
895  {
896  if (pEntry->bHasUncheckedValue)
897  {
898  dwValue = pEntry->dwUncheckedValue;
899  }
900  else
901  {
902  // there is no unchecked value
903  RegCloseKey(hkeyTarget);
904  continue; // ignore
905  }
906  }
907 
908  // set the value
909  dwSize = sizeof(dwValue);
910  RegSetValueExW(hkeyTarget, pEntry->szValueName, 0, REG_DWORD,
911  LPBYTE(&dwValue), dwSize);
912 
913  // close now
914  RegCloseKey(hkeyTarget);
915  }
916 
917  // scan advanced settings for user's settings
918  DWORD dwMask = 0;
919  SHELLSTATE ShellState;
920  ZeroMemory(&ShellState, sizeof(ShellState));
921  ScanAdvancedSettings(&ShellState, &dwMask);
922 
923  // update user's settings
924  SHGetSetSettings(&ShellState, dwMask, TRUE);
925 
926  // notify all
928 
930 }
BOOL bHasUncheckedValue
Definition: view.cpp:73
#define TRUE
Definition: types.h:120
static BOOL CALLBACK RefreshBrowsersCallback(HWND hWnd, LPARAM msg)
Definition: view.cpp:855
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ZeroMemory
Definition: winbase.h:1642
Definition: view.cpp:56
int32_t INT
Definition: typedefs.h:56
WCHAR szValueName[64]
Definition: view.cpp:68
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:52
DWORD dwCheckedValue
Definition: view.cpp:70
HKEY hkeyRoot
Definition: view.cpp:66
smooth NULL
Definition: ftsmooth.c:416
#define WM_WININICHANGE
Definition: winuser.h:1612
WCHAR szRegPath[MAX_PATH]
Definition: view.cpp:67
VOID WINAPI SHGetSetSettings(LPSHELLSTATE lpss, DWORD dwMask, BOOL bSet)
Definition: shellord.c:198
#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
static PVIEWTREE_ENTRY s_ViewTreeEntries
Definition: view.cpp:81
DWORD dwUncheckedValue
Definition: view.cpp:71
static INT s_ViewTreeEntryCount
Definition: view.cpp:82
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC, _In_ LPARAM)
unsigned long DWORD
Definition: ntddk_ex.h:95
static VOID ScanAdvancedSettings(SHELLSTATE *pSS, DWORD *pdwMask)
Definition: view.cpp:804
BOOL bGrayed
Definition: view.cpp:76
#define SendMessage
Definition: winuser.h:5744
DWORD dwType
Definition: view.cpp:62
HANDLE HKEY
Definition: registry.h:24
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
BOOL bChecked
Definition: view.cpp:77
#define REG_DWORD
Definition: sdbapi.c:596
#define HWND_BROADCAST
Definition: winuser.h:1190
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by FolderOptionsViewDlg().

◆ ViewDlg_CreateTreeImageList()

static HIMAGELIST ViewDlg_CreateTreeImageList ( VOID  )
static

Definition at line 550 of file view.cpp.

551 {
552  HIMAGELIST hImageList;
553  hImageList = ImageList_Create(16, 16, ILC_COLOR24 | ILC_MASK, 9, 1);
554  if (hImageList == NULL)
555  return NULL; // failure
556 
557  // free if existed
558  if (s_ViewTreeIcons)
559  {
562  }
564 
565  // allocate now
566  PVIEWTREE_ICON pAllocated;
567  size_t Size = PREDEFINED_ICON_COUNT * sizeof(VIEWTREE_ICON);
568  pAllocated = (PVIEWTREE_ICON)calloc(1, Size);
569  if (pAllocated == NULL)
570  return NULL; // failure
571 
573  s_ViewTreeIcons = pAllocated;
574 
575  // add the predefined icons
576 
578  HBITMAP hbmMask = CreateCheckMask(hDC);
579 
580  HBITMAP hbmChecked, hbmUnchecked;
581 
582  hbmChecked = CreateCheckImage(hDC, TRUE);
583  ImageList_Add(hImageList, hbmChecked, hbmMask);
584  DeleteObject(hbmChecked);
585 
586  hbmUnchecked = CreateCheckImage(hDC, FALSE);
587  ImageList_Add(hImageList, hbmUnchecked, hbmMask);
588  DeleteObject(hbmUnchecked);
589 
590  hbmChecked = CreateCheckImage(hDC, TRUE, FALSE);
591  ImageList_Add(hImageList, hbmChecked, hbmMask);
592  DeleteObject(hbmChecked);
593 
594  hbmUnchecked = CreateCheckImage(hDC, FALSE, FALSE);
595  ImageList_Add(hImageList, hbmUnchecked, hbmMask);
596  DeleteObject(hbmUnchecked);
597 
598  DeleteObject(hbmMask);
599  hbmMask = CreateRadioMask(hDC);
600 
601  hbmChecked = CreateRadioImage(hDC, TRUE);
602  ImageList_Add(hImageList, hbmChecked, hbmMask);
603  DeleteObject(hbmChecked);
604 
605  hbmUnchecked = CreateRadioImage(hDC, FALSE);
606  ImageList_Add(hImageList, hbmUnchecked, hbmMask);
607  DeleteObject(hbmUnchecked);
608 
609  hbmChecked = CreateRadioImage(hDC, TRUE, FALSE);
610  ImageList_Add(hImageList, hbmChecked, hbmMask);
611  DeleteObject(hbmChecked);
612 
613  hbmUnchecked = CreateRadioImage(hDC, FALSE, FALSE);
614  ImageList_Add(hImageList, hbmUnchecked, hbmMask);
615  DeleteObject(hbmUnchecked);
616 
617  DeleteObject(hbmMask);
618 
619  return hImageList;
620 }
#define TRUE
Definition: types.h:120
INT WINAPI ImageList_Add(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask)
Definition: imagelist.c:448
HBITMAP CreateRadioMask(HDC hDC)
#define free
Definition: debug_ros.c:5
static HDC
Definition: imagelist.c:92
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HBITMAP CreateCheckMask(HDC hDC)
struct VIEWTREE_ICON * PVIEWTREE_ICON
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
HBITMAP CreateCheckImage(HDC hDC, BOOL bCheck, BOOL bEnabled)
smooth NULL
Definition: ftsmooth.c:416
#define PREDEFINED_ICON_COUNT
Definition: view.cpp:38
#define ILC_COLOR24
Definition: commctrl.h:353
struct VIEWTREE_ICON VIEWTREE_ICON
#define ILC_MASK
Definition: commctrl.h:347
HBITMAP CreateRadioImage(HDC hDC, BOOL bCheck, BOOL bEnabled)
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
static HDC hDC
Definition: 3dtext.c:33
static PVIEWTREE_ICON s_ViewTreeIcons
Definition: view.cpp:85
#define calloc
Definition: rosglue.h:14
static HBITMAP
Definition: button.c:44
static INT s_ViewTreeIconCount
Definition: view.cpp:86

Referenced by ViewDlg_OnInitDialog().

◆ ViewDlg_OnInitDialog()

static BOOL ViewDlg_OnInitDialog ( HWND  hwndDlg)
static

Definition at line 623 of file view.cpp.

624 {
626 
629 
633 
634  return TRUE; // set focus
635 }
#define IDC_VIEW_TREEVIEW
Definition: shresdef.h:435
#define TRUE
Definition: types.h:120
static BOOL ViewTree_LoadAll(VOID)
Definition: view.cpp:442
static VOID ViewTree_SortAll(VOID)
Definition: view.cpp:541
static HIMAGELIST s_hTreeImageList
Definition: view.cpp:87
#define TreeView_SetImageList(hwnd, himl, iImage)
Definition: commctrl.h:3443
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
static VOID ViewTree_InsertAll(HWND hwndTreeView)
Definition: view.cpp:226
HWND hwndTreeView
Definition: eventvwr.c:82
#define TVSIL_NORMAL
Definition: commctrl.h:3439
static HIMAGELIST ViewDlg_CreateTreeImageList(VOID)
Definition: view.cpp:550

Referenced by FolderOptionsViewDlg().

◆ ViewDlg_OnTreeCustomDraw()

static INT_PTR ViewDlg_OnTreeCustomDraw ( HWND  hwndDlg,
NMTVCUSTOMDRAW Draw 
)
static

Definition at line 736 of file view.cpp.

737 {
738  NMCUSTOMDRAW& nmcd = Draw->nmcd;
739  switch (nmcd.dwDrawStage)
740  {
741  case CDDS_PREPAINT:
742  return CDRF_NOTIFYITEMDRAW; // for CDDS_ITEMPREPAINT
743 
744  case CDDS_ITEMPREPAINT:
745  if (!(nmcd.uItemState & CDIS_SELECTED)) // not selected
746  {
747  LPARAM lParam = nmcd.lItemlParam;
749  if (pEntry && pEntry->bGrayed) // disabled
750  {
751  // draw as grayed
752  Draw->clrText = GetSysColor(COLOR_GRAYTEXT);
753  Draw->clrTextBk = GetSysColor(COLOR_WINDOW);
754  return CDRF_NEWFONT;
755  }
756  }
757  break;
758 
759  default:
760  break;
761  }
762  return CDRF_DODEFAULT;
763 }
void Draw(HDC aDc)
Definition: magnifier.c:359
static PVIEWTREE_ENTRY ViewTree_GetItem(DWORD dwID)
Definition: view.cpp:146
#define CDDS_ITEMPREPAINT
Definition: commctrl.h:281
Definition: view.cpp:56
#define COLOR_WINDOW
Definition: winuser.h:908
DWORD WINAPI GetSysColor(_In_ int)
#define CDIS_SELECTED
Definition: commctrl.h:287
LONG_PTR LPARAM
Definition: windef.h:208
#define CDRF_NOTIFYITEMDRAW
Definition: commctrl.h:271
#define CDRF_DODEFAULT
Definition: commctrl.h:264
#define CDDS_PREPAINT
Definition: commctrl.h:276
#define COLOR_GRAYTEXT
Definition: winuser.h:922
BOOL bGrayed
Definition: view.cpp:76
#define CDRF_NEWFONT
Definition: commctrl.h:265
LPARAM lParam
Definition: combotst.c:139

Referenced by FolderOptionsViewDlg().

◆ ViewDlg_OnTreeViewClick()

static VOID ViewDlg_OnTreeViewClick ( HWND  hwndDlg)
static

Definition at line 698 of file view.cpp.

699 {
701 
702  // do hit test to get the clicked item
703  TV_HITTESTINFO HitTest;
704  ZeroMemory(&HitTest, sizeof(HitTest));
705  DWORD dwPos = GetMessagePos();
706  HitTest.pt.x = LOWORD(dwPos);
707  HitTest.pt.y = HIWORD(dwPos);
708  ScreenToClient(hwndTreeView, &HitTest.pt);
710 
711  // toggle the check mark if possible
712  if (ViewDlg_ToggleCheckItem(hwndDlg, hItem))
713  {
714  // property sheet was changed
715  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
716  }
717 }
#define IDC_VIEW_TREEVIEW
Definition: shresdef.h:435
#define TV_HITTESTINFO
Definition: commctrl.h:3512
#define ZeroMemory
Definition: winbase.h:1642
DWORD WINAPI GetMessagePos(void)
Definition: message.c:1350
#define TreeView_HitTest(hwnd, lpht)
Definition: commctrl.h:3509
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define PropSheet_Changed(d, w)
Definition: prsht.h:326
unsigned long DWORD
Definition: ntddk_ex.h:95
HWND hwndTreeView
Definition: eventvwr.c:82
HWND WINAPI GetParent(_In_ HWND)
#define HIWORD(l)
Definition: typedefs.h:246
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
#define LOWORD(l)
Definition: pedump.c:82
static BOOL ViewDlg_ToggleCheckItem(HWND hwndDlg, HTREEITEM hItem)
Definition: view.cpp:638

Referenced by FolderOptionsViewDlg().

◆ ViewDlg_OnTreeViewKeyDown()

static void ViewDlg_OnTreeViewKeyDown ( HWND  hwndDlg,
TV_KEYDOWN KeyDown 
)
static

Definition at line 720 of file view.cpp.

721 {
723 
724  if (KeyDown->wVKey == VK_SPACE)
725  {
726  // [Space] key was pressed
728  if (ViewDlg_ToggleCheckItem(hwndDlg, hItem))
729  {
730  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
731  }
732  }
733 }
#define IDC_VIEW_TREEVIEW
Definition: shresdef.h:435
#define TreeView_GetSelection(hwnd)
Definition: commctrl.h:3469
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define PropSheet_Changed(d, w)
Definition: prsht.h:326
HWND hwndTreeView
Definition: eventvwr.c:82
HWND WINAPI GetParent(_In_ HWND)
#define VK_SPACE
Definition: winuser.h:2194
static BOOL ViewDlg_ToggleCheckItem(HWND hwndDlg, HTREEITEM hItem)
Definition: view.cpp:638

Referenced by FolderOptionsViewDlg().

◆ ViewDlg_RestoreDefaults()

static VOID ViewDlg_RestoreDefaults ( HWND  hwndDlg)
static

Definition at line 766 of file view.cpp.

767 {
769 
770  for (INT i = 0; i < s_ViewTreeEntryCount; ++i)
771  {
772  // ignore if the type is group
773  VIEWTREE_ENTRY *pEntry = &s_ViewTreeEntries[i];
774  if (pEntry->dwType == AETYPE_GROUP)
775  continue;
776 
777  // set default value on registry
778  HKEY hKey;
779  if (RegOpenKeyExW(HKEY(pEntry->hkeyRoot), pEntry->szRegPath,
780  0, KEY_WRITE, &hKey) != ERROR_SUCCESS)
781  {
782  continue;
783  }
784  RegSetValueExW(hKey, pEntry->szValueName, 0, REG_DWORD,
785  LPBYTE(&pEntry->dwDefaultValue), sizeof(DWORD));
786  RegCloseKey(hKey);
787 
788  // update check status
789  pEntry->bChecked = (pEntry->dwCheckedValue == pEntry->dwDefaultValue);
790 
791  // update the image
792  TV_ITEM Item;
793  ZeroMemory(&Item, sizeof(Item));
794  Item.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
795  Item.hItem = pEntry->hItem;
796  Item.iImage = Item.iSelectedImage = ViewTree_GetImage(pEntry);
798  }
799 
800  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
801 }
#define IDC_VIEW_TREEVIEW
Definition: shresdef.h:435
#define ERROR_SUCCESS
Definition: deptool.c:10
static INT ViewTree_GetImage(PVIEWTREE_ENTRY pEntry)
Definition: view.cpp:161
#define ZeroMemory
Definition: winbase.h:1642
Definition: view.cpp:56
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3267
int32_t INT
Definition: typedefs.h:56
WCHAR szValueName[64]
Definition: view.cpp:68
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:52
DWORD dwCheckedValue
Definition: view.cpp:70
HKEY hkeyRoot
Definition: view.cpp:66
WCHAR szRegPath[MAX_PATH]
Definition: view.cpp:67
HTREEITEM hItem
Definition: view.cpp:75
#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
static PVIEWTREE_ENTRY s_ViewTreeEntries
Definition: view.cpp:81
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define PropSheet_Changed(d, w)
Definition: prsht.h:326
static INT s_ViewTreeEntryCount
Definition: view.cpp:82
unsigned long DWORD
Definition: ntddk_ex.h:95
HWND hwndTreeView
Definition: eventvwr.c:82
#define TVIF_HANDLE
Definition: commctrl.h:3266
HWND WINAPI GetParent(_In_ HWND)
#define TV_ITEM
Definition: commctrl.h:3296
#define TVIF_IMAGE
Definition: commctrl.h:3263
#define TreeView_SetItem(hwnd, pitem)
Definition: commctrl.h:3493
DWORD dwType
Definition: view.cpp:62
HANDLE HKEY
Definition: registry.h:24
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
DWORD dwDefaultValue
Definition: view.cpp:72
BOOL bChecked
Definition: view.cpp:77
#define REG_DWORD
Definition: sdbapi.c:596
int iImage
Definition: treeview.c:151

Referenced by FolderOptionsViewDlg().

◆ ViewDlg_ToggleCheckItem()

static BOOL ViewDlg_ToggleCheckItem ( HWND  hwndDlg,
HTREEITEM  hItem 
)
static

Definition at line 638 of file view.cpp.

639 {
641 
642  // get the item
643  TV_ITEM Item;
644  INT i;
645  ZeroMemory(&Item, sizeof(Item));
646  Item.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_PARAM;
647  Item.hItem = hItem;
648  if (!TreeView_GetItem(hwndTreeView, &Item))
649  return FALSE; // no such item
650 
651  VIEWTREE_ENTRY *pEntry = ViewTree_GetItem(Item.lParam);
652  if (pEntry == NULL)
653  return FALSE; // no such item
654  if (pEntry->bGrayed)
655  return FALSE; // disabled
656 
657  // toggle check mark
658  Item.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
659  switch (pEntry->dwType)
660  {
661  case AETYPE_CHECKBOX:
662  pEntry->bChecked = !pEntry->bChecked;
663  break;
664 
665  case AETYPE_RADIO:
666  // reset all the entries of the same parent
667  for (i = 0; i < s_ViewTreeEntryCount; ++i)
668  {
669  VIEWTREE_ENTRY *pEntry2 = &s_ViewTreeEntries[i];
670  if (pEntry->dwParentID == pEntry2->dwParentID)
671  {
672  pEntry2->bChecked = FALSE;
673 
674  Item.hItem = pEntry2->hItem;
675  INT iImage = ViewTree_GetImage(pEntry2);
676  Item.iImage = Item.iSelectedImage = iImage;
678  }
679  }
680  pEntry->bChecked = TRUE;
681  break;
682 
683  default:
684  return FALSE; // failure
685  }
686  Item.iImage = Item.iSelectedImage = ViewTree_GetImage(pEntry);
687  Item.hItem = hItem;
689 
690  // redraw the item
691  RECT rcItem;
693  InvalidateRect(hwndTreeView, &rcItem, TRUE);
694  return TRUE; // success
695 }
#define IDC_VIEW_TREEVIEW
Definition: shresdef.h:435
#define TRUE
Definition: types.h:120
#define TreeView_GetItemRect(hwnd, hitem, prc, code)
Definition: commctrl.h:3425
static INT ViewTree_GetImage(PVIEWTREE_ENTRY pEntry)
Definition: view.cpp:161
static PVIEWTREE_ENTRY ViewTree_GetItem(DWORD dwID)
Definition: view.cpp:146
#define ZeroMemory
Definition: winbase.h:1642
Definition: view.cpp:56
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3267
int32_t INT
Definition: typedefs.h:56
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
HTREEITEM hItem
Definition: treelist.h:37
smooth NULL
Definition: ftsmooth.c:416
HTREEITEM hItem
Definition: view.cpp:75
static PVIEWTREE_ENTRY s_ViewTreeEntries
Definition: view.cpp:81
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
static INT s_ViewTreeEntryCount
Definition: view.cpp:82
DWORD dwParentID
Definition: view.cpp:59
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
HWND hwndTreeView
Definition: eventvwr.c:82
#define TVIF_HANDLE
Definition: commctrl.h:3266
#define TV_ITEM
Definition: commctrl.h:3296
#define TVIF_IMAGE
Definition: commctrl.h:3263
#define TreeView_SetItem(hwnd, pitem)
Definition: commctrl.h:3493
BOOL bGrayed
Definition: view.cpp:76
DWORD dwType
Definition: view.cpp:62
#define TVIF_PARAM
Definition: commctrl.h:3264
BOOL bChecked
Definition: view.cpp:77
#define TreeView_GetItem(hwnd, pitem)
Definition: commctrl.h:3486

Referenced by ViewDlg_OnTreeViewClick(), and ViewDlg_OnTreeViewKeyDown().

◆ ViewTree_AddIcon()

static INT ViewTree_AddIcon ( LPCWSTR  pszPath,
UINT  nIconIndex 
)
static

Definition at line 105 of file view.cpp.

106 {
107  PVIEWTREE_ICON pAllocated;
108 
109  // return the ID if already existed
110  INT nIconID = ViewTree_FindIcon(pszPath, nIconIndex);
111  if (nIconID != -1)
112  return nIconID; // already exists
113 
114  // extract a small icon
115  HICON hIconSmall = NULL;
116  ExtractIconExW(pszPath, nIconIndex, NULL, &hIconSmall, 1);
117  if (hIconSmall == NULL)
118  return -1; // failure
119 
120  // resize s_ViewTreeIcons
121  size_t Size = (s_ViewTreeIconCount + 1) * sizeof(VIEWTREE_ICON);
122  pAllocated = (PVIEWTREE_ICON)realloc(s_ViewTreeIcons, Size);
123  if (pAllocated == NULL)
124  return -1; // failure
125  else
126  s_ViewTreeIcons = pAllocated;
127 
128  // save icon information
130  lstrcpynW(pIcon->szPath, pszPath, _countof(pIcon->szPath));
131  pIcon->nIconIndex = nIconIndex;
132 
133  // add the icon to the image list
134  ImageList_AddIcon(s_hTreeImageList, hIconSmall);
135 
136  // increment the counter
137  nIconID = s_ViewTreeIconCount;
139 
140  DestroyIcon(hIconSmall);
141 
142  return nIconID; // newly-added icon ID
143 }
#define realloc
Definition: debug_ros.c:6
static HICON
Definition: imagelist.c:84
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define _countof(array)
Definition: fontsub.cpp:30
int32_t INT
Definition: typedefs.h:56
static INT ViewTree_FindIcon(LPCWSTR pszPath, UINT nIconIndex)
Definition: view.cpp:90
struct VIEWTREE_ICON * PVIEWTREE_ICON
#define lstrcpynW
Definition: compat.h:405
UINT WINAPI ExtractIconExW(LPCWSTR lpszFile, INT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIcons)
Definition: iconcache.cpp:873
smooth NULL
Definition: ftsmooth.c:416
static HIMAGELIST s_hTreeImageList
Definition: view.cpp:87
INT WINAPI ImageList_AddIcon(HIMAGELIST himl, HICON hIcon)
Definition: imagelist.c:540
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
static PVIEWTREE_ICON s_ViewTreeIcons
Definition: view.cpp:85
UINT nIconIndex
Definition: view.cpp:44
WCHAR szPath[MAX_PATH]
Definition: view.cpp:43
static INT s_ViewTreeIconCount
Definition: view.cpp:86

Referenced by ViewTree_LoadTree().

◆ ViewTree_Compare()

static int ViewTree_Compare ( const void x,
const void y 
)
static

Definition at line 487 of file view.cpp.

488 {
489  PVIEWTREE_ENTRY pEntry1 = (PVIEWTREE_ENTRY)x;
490  PVIEWTREE_ENTRY pEntry2 = (PVIEWTREE_ENTRY)y;
491 
492  DWORD dwParentID1 = pEntry1->dwParentID;
493  DWORD dwParentID2 = pEntry2->dwParentID;
494 
495  if (dwParentID1 == dwParentID2)
496  return lstrcmpi(pEntry1->szText, pEntry2->szText);
497 
498  DWORD i, m, n;
499  const UINT MAX_DEPTH = 32;
500  PVIEWTREE_ENTRY pArray1[MAX_DEPTH];
501  PVIEWTREE_ENTRY pArray2[MAX_DEPTH];
502 
503  // Make ancestor lists
504  for (i = m = n = 0; i < MAX_DEPTH; ++i)
505  {
506  PVIEWTREE_ENTRY pParent1 = ViewTree_GetItem(dwParentID1);
507  PVIEWTREE_ENTRY pParent2 = ViewTree_GetItem(dwParentID2);
508  if (!pParent1 && !pParent2)
509  break;
510 
511  if (pParent1)
512  {
513  pArray1[m++] = pParent1;
514  dwParentID1 = pParent1->dwParentID;
515  }
516  if (pParent2)
517  {
518  pArray2[n++] = pParent2;
519  dwParentID2 = pParent2->dwParentID;
520  }
521  }
522 
523  UINT k = min(m, n);
524  for (i = 0; i < k; ++i)
525  {
526  INT nCompare = lstrcmpi(pArray1[m - i - 1]->szText, pArray2[n - i - 1]->szText);
527  if (nCompare < 0)
528  return -1;
529  if (nCompare > 0)
530  return 1;
531  }
532 
533  if (m < n)
534  return -1;
535  if (m > n)
536  return 1;
537  return lstrcmpi(pEntry1->szText, pEntry2->szText);
538 }
#define lstrcmpi
Definition: winbase.h:3697
GLdouble n
Definition: glext.h:7729
static PVIEWTREE_ENTRY ViewTree_GetItem(DWORD dwID)
Definition: view.cpp:146
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
Definition: view.cpp:56
int32_t INT
Definition: typedefs.h:56
const GLfloat * m
Definition: glext.h:10848
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
static const WCHAR szText[]
Definition: dialog.c:139
#define MAX_DEPTH
Definition: config.h:145
DWORD dwParentID
Definition: view.cpp:59
unsigned long DWORD
Definition: ntddk_ex.h:95
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
struct VIEWTREE_ENTRY * PVIEWTREE_ENTRY
int k
Definition: mpi.c:3369
WCHAR szText[MAX_PATH]
Definition: view.cpp:63

Referenced by ViewTree_SortAll().

◆ ViewTree_FindIcon()

static INT ViewTree_FindIcon ( LPCWSTR  pszPath,
UINT  nIconIndex 
)
static

Definition at line 90 of file view.cpp.

91 {
93  {
95  if (pIcon->nIconIndex == nIconIndex &&
96  lstrcmpiW(pIcon->szPath, pszPath) == 0)
97  {
98  return i; // icon ID
99  }
100  }
101  return -1; // not found
102 }
int32_t INT
Definition: typedefs.h:56
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define PREDEFINED_ICON_COUNT
Definition: view.cpp:38
static PVIEWTREE_ICON s_ViewTreeIcons
Definition: view.cpp:85
UINT nIconIndex
Definition: view.cpp:44
WCHAR szPath[MAX_PATH]
Definition: view.cpp:43
static INT s_ViewTreeIconCount
Definition: view.cpp:86

Referenced by ViewTree_AddIcon().

◆ ViewTree_GetImage()

static INT ViewTree_GetImage ( PVIEWTREE_ENTRY  pEntry)
static

Definition at line 161 of file view.cpp.

162 {
163  switch (pEntry->dwType)
164  {
165  case AETYPE_GROUP:
166  return pEntry->nIconID;
167 
168  case AETYPE_CHECKBOX:
169  if (pEntry->bGrayed)
170  {
171  if (pEntry->bChecked)
172  return I_CHECKED_DISABLED;
173  else
174  return I_UNCHECKED_DISABLED;
175  }
176  else
177  {
178  if (pEntry->bChecked)
179  return I_CHECKED;
180  else
181  return I_UNCHECKED;
182  }
183 
184  case AETYPE_RADIO:
185  if (pEntry->bGrayed)
186  {
187  if (pEntry->bChecked)
189  else
191  }
192  else
193  {
194  if (pEntry->bChecked)
195  return I_RADIO_CHECKED;
196  else
197  return I_RADIO_UNCHECKED;
198  }
199  }
200  return -1; // failure
201 }
#define I_RADIO_CHECKED_DISABLED
Definition: view.cpp:36
#define I_RADIO_UNCHECKED
Definition: view.cpp:35
#define I_UNCHECKED_DISABLED
Definition: view.cpp:33
#define I_CHECKED
Definition: view.cpp:30
#define I_UNCHECKED
Definition: view.cpp:31
#define I_RADIO_UNCHECKED_DISABLED
Definition: view.cpp:37
#define I_CHECKED_DISABLED
Definition: view.cpp:32
BOOL bGrayed
Definition: view.cpp:76
DWORD dwType
Definition: view.cpp:62
BOOL bChecked
Definition: view.cpp:77
INT nIconID
Definition: view.cpp:64
#define I_RADIO_CHECKED
Definition: view.cpp:34

Referenced by ViewDlg_RestoreDefaults(), ViewDlg_ToggleCheckItem(), and ViewTree_InsertEntry().

◆ ViewTree_GetItem()

static PVIEWTREE_ENTRY ViewTree_GetItem ( DWORD  dwID)
static

Definition at line 146 of file view.cpp.

147 {
148  if (dwID == DWORD(-1))
149  return NULL;
150 
151  for (INT i = 0; i < s_ViewTreeEntryCount; ++i)
152  {
154  if (pEntry->dwID == dwID)
155  return pEntry;
156  }
157  return NULL; // failure
158 }
Definition: view.cpp:56
#define DWORD
Definition: nt_native.h:44
int32_t INT
Definition: typedefs.h:56
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
smooth NULL
Definition: ftsmooth.c:416
static PVIEWTREE_ENTRY s_ViewTreeEntries
Definition: view.cpp:81
static INT s_ViewTreeEntryCount
Definition: view.cpp:82
DWORD dwID
Definition: view.cpp:58

Referenced by ViewDlg_OnTreeCustomDraw(), ViewDlg_ToggleCheckItem(), ViewTree_Compare(), and ViewTree_InsertEntry().

◆ ViewTree_InsertAll()

static VOID ViewTree_InsertAll ( HWND  hwndTreeView)
static

Definition at line 226 of file view.cpp.

227 {
229 
230  // insert the entries
231  PVIEWTREE_ENTRY pEntry;
232  for (INT i = 0; i < s_ViewTreeEntryCount; ++i)
233  {
234  pEntry = &s_ViewTreeEntries[i];
236  }
237 
238  // expand all
239  for (INT i = 0; i < s_ViewTreeEntryCount; ++i)
240  {
241  pEntry = &s_ViewTreeEntries[i];
242  if (pEntry->dwType == AETYPE_GROUP)
243  {
245  }
246  }
247 }
#define TreeView_DeleteAllItems(hwnd)
Definition: commctrl.h:3413
Definition: view.cpp:56
int32_t INT
Definition: typedefs.h:56
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
HTREEITEM hItem
Definition: view.cpp:75
static PVIEWTREE_ENTRY s_ViewTreeEntries
Definition: view.cpp:81
static INT s_ViewTreeEntryCount
Definition: view.cpp:82
#define TVE_EXPAND
Definition: commctrl.h:3419
HWND hwndTreeView
Definition: eventvwr.c:82
static VOID ViewTree_InsertEntry(HWND hwndTreeView, PVIEWTREE_ENTRY pEntry)
Definition: view.cpp:204
DWORD dwType
Definition: view.cpp:62
#define TreeView_Expand(hwnd, hitem, code)
Definition: commctrl.h:3416

Referenced by ViewDlg_OnInitDialog().

◆ ViewTree_InsertEntry()

static VOID ViewTree_InsertEntry ( HWND  hwndTreeView,
PVIEWTREE_ENTRY  pEntry 
)
static

Definition at line 204 of file view.cpp.

205 {
206  PVIEWTREE_ENTRY pParent = ViewTree_GetItem(pEntry->dwParentID);
208  if (pParent)
209  hParent = pParent->hItem;
210 
211  TV_INSERTSTRUCT Insertion;
212  ZeroMemory(&Insertion, sizeof(Insertion));
213  Insertion.hParent = hParent;
214  Insertion.hInsertAfter = TVI_LAST;
215  Insertion.item.mask =
217  Insertion.item.pszText = pEntry->szText;
218 
219  INT iImage = ViewTree_GetImage(pEntry);
220  Insertion.item.iImage = Insertion.item.iSelectedImage = iImage;
221  Insertion.item.lParam = pEntry->dwID;
222  pEntry->hItem = TreeView_InsertItem(hwndTreeView, &Insertion);
223 }
static INT ViewTree_GetImage(PVIEWTREE_ENTRY pEntry)
Definition: view.cpp:161
static PVIEWTREE_ENTRY ViewTree_GetItem(DWORD dwID)
Definition: view.cpp:146
#define ZeroMemory
Definition: winbase.h:1642
Definition: view.cpp:56
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3267
int32_t INT
Definition: typedefs.h:56
#define TreeView_InsertItem(hwnd, lpis)
Definition: commctrl.h:3408
#define TVI_LAST
Definition: commctrl.h:3366
HTREEITEM hItem
Definition: view.cpp:75
DWORD dwParentID
Definition: view.cpp:59
#define TVI_ROOT
Definition: commctrl.h:3364
DWORD dwID
Definition: view.cpp:58
HWND hwndTreeView
Definition: eventvwr.c:82
const DOCKBAR PVOID HWND hParent
Definition: tooldock.h:22
#define TVIF_TEXT
Definition: commctrl.h:3262
#define TVIF_IMAGE
Definition: commctrl.h:3263
#define TVIF_PARAM
Definition: commctrl.h:3264
#define TV_INSERTSTRUCT
Definition: commctrl.h:3373
WCHAR szText[MAX_PATH]
Definition: view.cpp:63

Referenced by ViewTree_InsertAll().

◆ ViewTree_LoadAll()

static BOOL ViewTree_LoadAll ( VOID  )
static

Definition at line 442 of file view.cpp.

443 {
444  static const WCHAR s_szAdvanced[] =
445  L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced";
446 
447  // free if already existed
448  if (s_ViewTreeEntries)
449  {
452  }
454 
455  HKEY hKey;
456  if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, s_szAdvanced, 0,
457  KEY_READ, &hKey) != ERROR_SUCCESS)
458  {
459  return FALSE; // failure
460  }
461 
462  // load the children
463  WCHAR szKeyName[64];
464  DWORD dwIndex = 0;
465  while (RegEnumKeyW(hKey, dwIndex, szKeyName,
466  _countof(szKeyName)) == ERROR_SUCCESS)
467  {
468  HKEY hkeyChild;
469  if (RegOpenKeyExW(hKey, szKeyName, 0, KEY_READ,
470  &hkeyChild) != ERROR_SUCCESS)
471  {
472  ++dwIndex;
473  continue; // failure
474  }
475 
476  ViewTree_LoadTree(hkeyChild, szKeyName, DWORD(-1));
477  RegCloseKey(hkeyChild);
478 
479  ++dwIndex;
480  }
481 
482  RegCloseKey(hKey);
483 
484  return TRUE; // success
485 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
#define _countof(array)
Definition: fontsub.cpp:30
#define free
Definition: debug_ros.c:5
#define DWORD
Definition: nt_native.h:44
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
smooth NULL
Definition: ftsmooth.c:416
static PVIEWTREE_ENTRY s_ViewTreeEntries
Definition: view.cpp:81
__wchar_t WCHAR
Definition: xmlstorage.h:180
static INT s_ViewTreeEntryCount
Definition: view.cpp:82
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
LONG WINAPI RegEnumKeyW(HKEY hKey, DWORD dwIndex, LPWSTR lpName, DWORD cbName)
Definition: reg.c:2416
static BOOL ViewTree_LoadTree(HKEY hKey, LPCWSTR pszKeyName, DWORD dwParentID)
Definition: view.cpp:250
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by ViewDlg_OnInitDialog().

◆ ViewTree_LoadTree()

static BOOL ViewTree_LoadTree ( HKEY  hKey,
LPCWSTR  pszKeyName,
DWORD  dwParentID 
)
static

Definition at line 250 of file view.cpp.

251 {
252  DWORD dwIndex;
253  WCHAR szKeyName[64], szText[MAX_PATH], *pch;
254  DWORD Size, Value;
255  PVIEWTREE_ENTRY pAllocated;
256 
257  // resize s_ViewTreeEntries
258  Size = (s_ViewTreeEntryCount + 1) * sizeof(VIEWTREE_ENTRY);
260  if (pAllocated == NULL)
261  return FALSE; // failure
262  else
263  s_ViewTreeEntries = pAllocated;
264 
266 
267  // dwID, dwParentID, szKeyName
268  pEntry->dwID = s_ViewTreeEntryCount;
269  pEntry->dwParentID = dwParentID;
270  lstrcpynW(pEntry->szKeyName, pszKeyName, _countof(pEntry->szKeyName));
271 
272  // Text, ResourceID
273  pEntry->szText[0] = 0;
274  pEntry->dwResourceID = 0;
275  szText[0] = 0;
276  Size = sizeof(szText);
277  RegQueryValueExW(hKey, L"Text", NULL, NULL, LPBYTE(szText), &Size);
278  if (szText[0] == L'@')
279  {
280  pch = wcsrchr(szText, L',');
281  if (pch)
282  {
283  *pch = 0;
284  dwIndex = abs(_wtoi(pch + 1));
285  pEntry->dwResourceID = dwIndex;
286  }
288  LoadStringW(hInst, dwIndex, szText, _countof(szText));
290  }
291  else
292  {
293  pEntry->dwResourceID = DWORD(-1);
294  }
295  lstrcpynW(pEntry->szText, szText, _countof(pEntry->szText));
296 
297  // Type
298  szText[0] = 0;
299  RegQueryValueExW(hKey, L"Type", NULL, NULL, LPBYTE(szText), &Size);
300  if (lstrcmpiW(szText, L"checkbox") == 0)
301  pEntry->dwType = AETYPE_CHECKBOX;
302  else if (lstrcmpiW(szText, L"radio") == 0)
303  pEntry->dwType = AETYPE_RADIO;
304  else if (lstrcmpiW(szText, L"group") == 0)
305  pEntry->dwType = AETYPE_GROUP;
306  else
307  return FALSE; // failure
308 
309  pEntry->nIconID = -1;
310  if (pEntry->dwType == AETYPE_GROUP)
311  {
312  // Bitmap (Icon)
313  UINT nIconIndex = 0;
314  Size = sizeof(szText);
315  szText[0] = 0;
316  RegQueryValueExW(hKey, L"Bitmap", NULL, NULL, LPBYTE(szText), &Size);
317 
318  WCHAR szExpanded[MAX_PATH];
319  ExpandEnvironmentStringsW(szText, szExpanded, _countof(szExpanded));
320  pch = wcsrchr(szExpanded, L',');
321  if (pch)
322  {
323  *pch = 0;
324  nIconIndex = abs(_wtoi(pch + 1));
325  }
326  pEntry->nIconID = ViewTree_AddIcon(szExpanded, nIconIndex);
327  }
328 
329  if (pEntry->dwType == AETYPE_GROUP)
330  {
331  pEntry->hkeyRoot = NULL;
332  pEntry->szRegPath[0] = 0;
333  pEntry->szValueName[0] = 0;
334  pEntry->dwCheckedValue = 0;
335  pEntry->bHasUncheckedValue = FALSE;
336  pEntry->dwUncheckedValue = 0;
337  pEntry->dwDefaultValue = 0;
338  pEntry->hItem = NULL;
339  pEntry->bGrayed = FALSE;
340  pEntry->bChecked = FALSE;
341  }
342  else
343  {
344  // HKeyRoot
345  HKEY HKeyRoot = HKEY_CURRENT_USER;
346  Size = sizeof(HKeyRoot);
347  RegQueryValueExW(hKey, L"HKeyRoot", NULL, NULL, LPBYTE(&HKeyRoot), &Size);
348  pEntry->hkeyRoot = HKeyRoot;
349 
350  // RegPath
351  pEntry->szRegPath[0] = 0;
352  Size = sizeof(szText);
353  RegQueryValueExW(hKey, L"RegPath", NULL, NULL, LPBYTE(szText), &Size);
354  lstrcpynW(pEntry->szRegPath, szText, _countof(pEntry->szRegPath));
355 
356  // ValueName
357  pEntry->szValueName[0] = 0;
358  Size = sizeof(szText);
359  RegQueryValueExW(hKey, L"ValueName", NULL, NULL, LPBYTE(szText), &Size);
360  lstrcpynW(pEntry->szValueName, szText, _countof(pEntry->szValueName));
361 
362  // CheckedValue
363  Size = sizeof(Value);
364  Value = 0x00000001;
365  RegQueryValueExW(hKey, L"CheckedValue", NULL, NULL, LPBYTE(&Value), &Size);
366  pEntry->dwCheckedValue = Value;
367 
368  // UncheckedValue
369  Size = sizeof(Value);
370  Value = 0x00000000;
371  pEntry->bHasUncheckedValue = TRUE;
372  if (RegQueryValueExW(hKey, L"UncheckedValue", NULL,
374  {
375  pEntry->bHasUncheckedValue = FALSE;
376  }
377  pEntry->dwUncheckedValue = Value;
378 
379  // DefaultValue
380  Size = sizeof(Value);
381  Value = 0x00000001;
382  RegQueryValueExW(hKey, L"DefaultValue", NULL, NULL, LPBYTE(&Value), &Size);
383  pEntry->dwDefaultValue = Value;
384 
385  // hItem
386  pEntry->hItem = NULL;
387 
388  // bGrayed, bChecked
389  HKEY hkeyTarget;
390  Value = pEntry->dwDefaultValue;
391  pEntry->bGrayed = TRUE;
392  if (RegOpenKeyExW(HKEY(pEntry->hkeyRoot), pEntry->szRegPath, 0,
393  KEY_READ, &hkeyTarget) == ERROR_SUCCESS)
394  {
395  Size = sizeof(Value);
396  if (RegQueryValueExW(hkeyTarget, pEntry->szValueName, NULL, NULL,
397  LPBYTE(&Value), &Size) == ERROR_SUCCESS)
398  {
399  pEntry->bGrayed = FALSE;
400  }
401  RegCloseKey(hkeyTarget);
402  }
403  pEntry->bChecked = (Value == pEntry->dwCheckedValue);
404  }
405 
406  // Grayed (ReactOS extension)
407  Size = sizeof(Value);
408  Value = FALSE;
409  RegQueryValueExW(hKey, L"Grayed", NULL, NULL, LPBYTE(&Value), &Size);
410  if (!pEntry->bGrayed)
411  pEntry->bGrayed = Value;
412 
413  BOOL bIsGroup = (pEntry->dwType == AETYPE_GROUP);
414  dwParentID = pEntry->dwID;
416 
417  if (!bIsGroup)
418  return TRUE; // success
419 
420  // load the children
421  dwIndex = 0;
422  while (RegEnumKeyW(hKey, dwIndex, szKeyName,
423  _countof(szKeyName)) == ERROR_SUCCESS)
424  {
425  HKEY hkeyChild;
426  if (RegOpenKeyExW(hKey, szKeyName, 0, KEY_READ,
427  &hkeyChild) != ERROR_SUCCESS)
428  {
429  ++dwIndex;
430  continue; // failure
431  }
432 
433  ViewTree_LoadTree(hkeyChild, szKeyName, dwParentID);
434  RegCloseKey(hkeyChild);
435 
436  ++dwIndex;
437  }
438 
439  return TRUE; // success
440 }
#define realloc
Definition: debug_ros.c:6
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
#define abs(i)
Definition: fconv.c:206
BOOL bHasUncheckedValue
Definition: view.cpp:73
WCHAR szKeyName[64]
Definition: view.cpp:61
#define TRUE
Definition: types.h:120
static INT ViewTree_AddIcon(LPCWSTR pszPath, UINT nIconIndex)
Definition: view.cpp:105
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
#define _countof(array)
Definition: fontsub.cpp:30
#define HKEY_CURRENT_USER
Definition: winreg.h:11
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
Definition: view.cpp:56
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
#define pch(ap)
Definition: match.c:418
#define lstrcpynW
Definition: compat.h:405
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
WCHAR szValueName[64]
Definition: view.cpp:68
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
static const WCHAR szText[]
Definition: dialog.c:139
DWORD dwCheckedValue
Definition: view.cpp:70
unsigned int BOOL
Definition: ntddk_ex.h:94
HKEY hkeyRoot
Definition: view.cpp:66
#define LoadLibraryW(x)
Definition: compat.h:412
smooth NULL
Definition: ftsmooth.c:416
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(_In_z_ const wchar_t *_Str, _In_ wchar_t _Ch)
WCHAR szRegPath[MAX_PATH]
Definition: view.cpp:67
HTREEITEM hItem
Definition: view.cpp:75
#define FreeLibrary(x)
Definition: compat.h:413
static PVIEWTREE_ENTRY s_ViewTreeEntries
Definition: view.cpp:81
DWORD dwUncheckedValue
Definition: view.cpp:71
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 INT s_ViewTreeEntryCount
Definition: view.cpp:82
DWORD dwParentID
Definition: view.cpp:59
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD dwID
Definition: view.cpp:58
static const WCHAR L[]
Definition: oid.c:1250
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
LONG WINAPI RegEnumKeyW(HKEY hKey, DWORD dwIndex, LPWSTR lpName, DWORD cbName)
Definition: reg.c:2416
HINSTANCE hInst
Definition: dxdiag.c:13
static BOOL ViewTree_LoadTree(HKEY hKey, LPCWSTR pszKeyName, DWORD dwParentID)
Definition: view.cpp:250
unsigned int UINT
Definition: ndis.h:50
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
DWORD dwResourceID
Definition: view.cpp:60
BOOL bGrayed
Definition: view.cpp:76
DWORD dwType
Definition: view.cpp:62
HANDLE HKEY
Definition: registry.h:24
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
struct VIEWTREE_ENTRY * PVIEWTREE_ENTRY
DWORD dwDefaultValue
Definition: view.cpp:72
BOOL bChecked
Definition: view.cpp:77
INT nIconID
Definition: view.cpp:64
WCHAR szText[MAX_PATH]
Definition: view.cpp:63

Referenced by ViewTree_LoadAll().

◆ ViewTree_SortAll()

static VOID ViewTree_SortAll ( VOID  )
static

Definition at line 541 of file view.cpp.

542 {
544 }
Definition: view.cpp:56
void __cdecl qsort(_Inout_updates_bytes_(_NumOfElements *_SizeOfElements) void *_Base, _In_ size_t _NumOfElements, _In_ size_t _SizeOfElements, _In_ int(__cdecl *_PtFuncCompare)(const void *, const void *))
static int ViewTree_Compare(const void *x, const void *y)
Definition: view.cpp:487
static PVIEWTREE_ENTRY s_ViewTreeEntries
Definition: view.cpp:81
static INT s_ViewTreeEntryCount
Definition: view.cpp:82

Referenced by ViewDlg_OnInitDialog().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( fprop  )

Variable Documentation

◆ s_hTreeImageList

HIMAGELIST s_hTreeImageList = NULL
static

Definition at line 87 of file view.cpp.

Referenced by ViewDlg_OnInitDialog(), and ViewTree_AddIcon().

◆ s_ViewTreeEntries

◆ s_ViewTreeEntryCount

◆ s_ViewTreeIconCount

INT s_ViewTreeIconCount = 0
static

Definition at line 86 of file view.cpp.

Referenced by ViewDlg_CreateTreeImageList(), ViewTree_AddIcon(), and ViewTree_FindIcon().

◆ s_ViewTreeIcons

PVIEWTREE_ICON s_ViewTreeIcons = NULL
static

Definition at line 85 of file view.cpp.

Referenced by ViewDlg_CreateTreeImageList(), ViewTree_AddIcon(), and ViewTree_FindIcon().