ReactOS  0.4.15-dev-5461-g062a8f2
listview.c File Reference
#include "regedit.h"
Include dependency graph for listview.c:

Go to the source code of this file.

Classes

struct  tagLINE_INFO
 
struct  tagSORT_INFO
 

Macros

#define CX_ICON   16
 
#define CY_ICON   16
 
#define LISTVIEW_NUM_ICONS   2
 
#define MAX_LIST_COLUMNS   (IDS_LIST_COLUMN_LAST - IDS_LIST_COLUMN_FIRST + 1)
 

Typedefs

typedef struct tagLINE_INFO LINE_INFO
 
typedef struct tagLINE_INFOPLINE_INFO
 
typedef struct tagSORT_INFO SORT_INFO
 
typedef struct tagSORT_INFOPSORT_INFO
 

Functions

WCHARGetValueName (HWND hwndLV, int iStartAt)
 
VOID SetValueName (HWND hwndLV, LPCWSTR pszValueName)
 
BOOL IsDefaultValue (HWND hwndLV, int i)
 
static void AddEntryToList (HWND hwndLV, LPWSTR Name, DWORD dwValType, void *ValBuf, DWORD dwCount, int Position, BOOL ValExists)
 
static BOOL CreateListColumns (HWND hWndListView, INT cxTotal)
 
static BOOL InitListViewImageLists (HWND hwndLV)
 
static void OnGetDispInfo (NMLVDISPINFO *plvdi)
 
static int CALLBACK CompareFunc (LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
 
static BOOL ListView_Sort (HWND hListView, int iSortingColumn, int iSortedColumn)
 
BOOL ListWndNotifyProc (HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result)
 
HWND CreateListView (HWND hwndParent, HMENU id, INT cx)
 
void DestroyListView (HWND hwndLV)
 
BOOL RefreshListView (HWND hwndLV, HKEY hKey, LPCWSTR keyPath)
 

Variables

int Image_String = 0
 
int Image_Bin = 0
 
INT iListViewSelect = -1
 
static INT g_iSortedColumn = 0
 
static const int default_column_widths [MAX_LIST_COLUMNS] = { 35, 25, 40 }
 
static const int column_alignment [MAX_LIST_COLUMNS] = { LVCFMT_LEFT, LVCFMT_LEFT, LVCFMT_LEFT }
 

Macro Definition Documentation

◆ CX_ICON

#define CX_ICON   16

Definition at line 23 of file listview.c.

◆ CY_ICON

#define CY_ICON   16

Definition at line 24 of file listview.c.

◆ LISTVIEW_NUM_ICONS

#define LISTVIEW_NUM_ICONS   2

Definition at line 25 of file listview.c.

◆ MAX_LIST_COLUMNS

#define MAX_LIST_COLUMNS   (IDS_LIST_COLUMN_LAST - IDS_LIST_COLUMN_FIRST + 1)

Definition at line 51 of file listview.c.

Typedef Documentation

◆ LINE_INFO

◆ PLINE_INFO

◆ PSORT_INFO

◆ SORT_INFO

Function Documentation

◆ AddEntryToList()

static void AddEntryToList ( HWND  hwndLV,
LPWSTR  Name,
DWORD  dwValType,
void ValBuf,
DWORD  dwCount,
int  Position,
BOOL  ValExists 
)
static

Definition at line 125 of file listview.c.

126 {
127  PLINE_INFO linfo;
128  LVITEMW item;
129  int index;
130 
131  linfo = (PLINE_INFO)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LINE_INFO) + dwCount);
132  linfo->dwValType = dwValType;
133  linfo->val_len = dwCount;
134  if (dwCount > 0)
135  {
136  memcpy(&linfo[1], ValBuf, dwCount);
137  linfo->val = &linfo[1];
138  }
139  linfo->name = _wcsdup(Name);
140 
141  item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
142  item.iItem = (Position == -1 ? 0: Position);
143  item.iSubItem = 0;
144  item.state = 0;
145  item.stateMask = 0;
146  item.pszText = Name;
147  item.cchTextMax = (int)wcslen(item.pszText);
148  if (item.cchTextMax == 0)
149  item.pszText = LPSTR_TEXTCALLBACK;
150  item.iImage = 0;
151  item.lParam = (LPARAM)linfo;
152  switch(dwValType)
153  {
154  case REG_SZ:
155  case REG_EXPAND_SZ:
156  case REG_MULTI_SZ:
157  item.iImage = Image_String;
158  break;
159  default:
160  item.iImage = Image_Bin;
161  break;
162  }
163 
164  /* item.lParam = (LPARAM)ValBuf; */
165 #if (_WIN32_IE >= 0x0300)
166  item.iIndent = 0;
167 #endif
168 
169  index = ListView_InsertItem(hwndLV, &item);
170  if (index != -1)
171  {
172  switch (dwValType)
173  {
174  case REG_SZ:
175  case REG_EXPAND_SZ:
176  if(dwCount > 0)
177  {
178  ListView_SetItemText(hwndLV, index, 2, ValBuf);
179  }
180  else if(!ValExists)
181  {
182  WCHAR buffer[255];
183  /* load (value not set) string */
185  ListView_SetItemText(hwndLV, index, 2, buffer);
186  }
187  break;
188  case REG_MULTI_SZ:
189  {
190  LPWSTR src, str;
191  if(dwCount >= 2)
192  {
193  src = (LPWSTR)ValBuf;
194  str = HeapAlloc(GetProcessHeap(), 0, dwCount + sizeof(WCHAR));
195  if(str != NULL)
196  {
197  *str = L'\0';
198  /* concatenate all srings */
199  while(*src != L'\0')
200  {
201  wcscat(str, src);
202  wcscat(str, L" ");
203  src += wcslen(src) + 1;
204  }
205  ListView_SetItemText(hwndLV, index, 2, str);
206  HeapFree(GetProcessHeap(), 0, str);
207  }
208  else
209  ListView_SetItemText(hwndLV, index, 2, L"");
210  }
211  else
212  ListView_SetItemText(hwndLV, index, 2, L"");
213  }
214  break;
215  case REG_DWORD:
216  case REG_NONE:
217  {
218  WCHAR buf[200];
219  if(dwCount == sizeof(DWORD))
220  {
221  wsprintf(buf, L"0x%08x (%u)", *(DWORD*)ValBuf, *(DWORD*)ValBuf);
222  }
223  else
224  {
226  }
227  ListView_SetItemText(hwndLV, index, 2, buf);
228  }
229  /* lpsRes = convertHexToDWORDStr(lpbData, dwLen); */
230  break;
231  default:
232  {
233  unsigned int i;
234  LPBYTE pData = (LPBYTE)ValBuf;
235  LPWSTR strBinary;
236  if(dwCount > 0)
237  {
238  strBinary = HeapAlloc(GetProcessHeap(), 0, (dwCount * sizeof(WCHAR) * 3) + sizeof(WCHAR));
239  for (i = 0; i < dwCount; i++)
240  {
241  wsprintf( strBinary + i*3, L"%02X ", pData[i] );
242  }
243  strBinary[dwCount * 3] = 0;
244  ListView_SetItemText(hwndLV, index, 2, strBinary);
245  HeapFree(GetProcessHeap(), 0, strBinary);
246  }
247  else
248  {
249  WCHAR szText[128];
250  LoadStringW(hInst, IDS_BINARY_EMPTY, szText, ARRAY_SIZE(szText));
251  ListView_SetItemText(hwndLV, index, 2, szText);
252  }
253  }
254  break;
255  }
256  }
257 }
struct tagLINE_INFO LINE_INFO
int Image_Bin
Definition: listview.c:28
static COORD Position
Definition: mouse.c:34
GLuint buffer
Definition: glext.h:5915
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2408
#define IDS_INVALID_DWORD
Definition: resource.h:132
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
struct tagLINE_INFO * PLINE_INFO
#define LVIF_TEXT
Definition: commctrl.h:2309
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
size_t val_len
Definition: listview.c:36
#define L(x)
Definition: ntvdm.h:50
unsigned char * LPBYTE
Definition: typedefs.h:53
#define REG_MULTI_SZ
Definition: nt_native.h:1501
struct NameRec_ * Name
Definition: cdprocs.h:459
const WCHAR * str
LONG_PTR LPARAM
Definition: windef.h:208
GLuint index
Definition: glext.h:6031
#define ListView_SetItemText(hwndLV, i, iSubItem_, pszText_)
Definition: commctrl.h:2691
DWORD dwValType
Definition: listview.c:33
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static int
Definition: listview.c:31
#define LVIF_IMAGE
Definition: commctrl.h:2310
unsigned long DWORD
Definition: ntddk_ex.h:95
#define index(s, c)
Definition: various.h:29
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum src
Definition: glext.h:6340
LPWSTR name
Definition: listview.c:34
int Image_String
Definition: listview.c:27
HINSTANCE hInst
Definition: dxdiag.c:13
static ATOM item
Definition: dde.c:856
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 ARRAY_SIZE(a)
Definition: main.h:24
#define IDS_BINARY_EMPTY
Definition: resource.h:125
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
void * val
Definition: listview.c:35
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define LVIF_PARAM
Definition: commctrl.h:2311
#define REG_NONE
Definition: nt_native.h:1492
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define LPSTR_TEXTCALLBACK
Definition: commctrl.h:2383
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
_Check_return_ _CRTIMP wchar_t *__cdecl _wcsdup(_In_z_ const wchar_t *_Str)
#define wsprintf
Definition: winuser.h:5855
#define IDS_VALUE_NOT_SET
Definition: resource.h:127
#define REG_DWORD
Definition: sdbapi.c:596
#define HeapFree(x, y, z)
Definition: compat.h:735
#define REG_SZ
Definition: layer.c:22

Referenced by RefreshListView().

◆ CompareFunc()

static int CALLBACK CompareFunc ( LPARAM  lParam1,
LPARAM  lParam2,
LPARAM  lParamSort 
)
static

Definition at line 381 of file listview.c.

382 {
383  PSORT_INFO pSortInfo = (PSORT_INFO)lParamSort;
384  LINE_INFO *l, *r;
385  DWORD dw1, dw2;
386  DWORDLONG qw1, qw2;
387 
388  l = (LINE_INFO*)lParam1;
389  r = (LINE_INFO*)lParam2;
390 
391  if (pSortInfo->iSortingColumn == 1 && l->dwValType != r->dwValType)
392  {
393  /* Sort by type */
394  if (pSortInfo->bSortAscending)
395  return ((int)l->dwValType - (int)r->dwValType);
396  else
397  return ((int)r->dwValType - (int)l->dwValType);
398  }
399  if (pSortInfo->iSortingColumn == 2)
400  {
401  /* Sort by value */
402  if (l->dwValType != r->dwValType)
403  {
404  if (pSortInfo->bSortAscending)
405  return ((int)l->dwValType - (int)r->dwValType);
406  else
407  return ((int)r->dwValType - (int)l->dwValType);
408  }
409 
410  if (l->val == NULL && r->val == NULL)
411  return 0;
412 
413  if (pSortInfo->bSortAscending)
414  {
415  if (l->val == NULL)
416  return -1;
417  if (r->val == NULL)
418  return 1;
419  }
420  else
421  {
422  if (l->val == NULL)
423  return 1;
424  if (r->val == NULL)
425  return -1;
426  }
427 
428  switch(l->dwValType)
429  {
430  case REG_DWORD:
431  {
432  dw1 = *(DWORD*)l->val;
433  dw2 = *(DWORD*)r->val;
434  if (pSortInfo->bSortAscending)
435  // return (dw1 > dw2 ? 1 : -1);
436  return ((int)dw1 - (int)dw2);
437  else
438  // return (dw1 > dw2 ? -1 : 1);
439  return ((int)dw2 - (int)dw1);
440  }
441 
442  case REG_QWORD: /* REG_QWORD_LITTLE_ENDIAN */
443  {
444  qw1 = *(DWORDLONG*)l->val;
445  qw2 = *(DWORDLONG*)r->val;
446  if (pSortInfo->bSortAscending)
447  // return (qw1 > qw2 ? 1 : -1);
448  return ((int)qw1 - (int)qw2);
449  else
450  // return (qw1 > qw2 ? -1 : 1);
451  return ((int)qw2 - (int)qw1);
452  }
453 
454  default:
455  {
456  INT nCompare = 0;
457 
458  if (pSortInfo->bSortAscending)
459  {
460  nCompare = memcmp(l->val, r->val, min(l->val_len, r->val_len));
461  if (nCompare == 0)
462  nCompare = l->val_len - r->val_len;
463  }
464  else
465  {
466  nCompare = memcmp(r->val, l->val, min(r->val_len, l->val_len));
467  if (nCompare == 0)
468  nCompare = r->val_len - l->val_len;
469  }
470 
471  return nCompare;
472  }
473  }
474  }
475 
476  /* Sort by name */
477  return (pSortInfo->bSortAscending ? StrCmpLogicalW(l->name, r->name) : StrCmpLogicalW(r->name, l->name));
478 }
BOOL bSortAscending
Definition: listview.c:42
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
int32_t INT
Definition: typedefs.h:58
r l[0]
Definition: byte_order.h:167
static int
Definition: listview.c:31
unsigned long DWORD
Definition: ntddk_ex.h:95
INT WINAPI StrCmpLogicalW(LPCWSTR lpszStr, LPCWSTR lpszComp)
Definition: string.c:2296
INT iSortingColumn
Definition: listview.c:41
#define min(a, b)
Definition: monoChain.cc:55
#define NULL
Definition: types.h:112
struct tagSORT_INFO * PSORT_INFO
unsigned long long DWORDLONG
Definition: intsafe.h:93
#define REG_QWORD
Definition: sdbapi.c:597
#define REG_DWORD
Definition: sdbapi.c:596

Referenced by ListView_Sort().

◆ CreateListColumns()

static BOOL CreateListColumns ( HWND  hWndListView,
INT  cxTotal 
)
static

Definition at line 259 of file listview.c.

260 {
261  WCHAR szText[50];
262  int index;
263  LVCOLUMN lvC;
264 
265  /* Create columns. */
266  lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
267  lvC.pszText = szText;
268 
269  /* Load the column labels from the resource file. */
270  for (index = 0; index < MAX_LIST_COLUMNS; index++)
271  {
272  lvC.iSubItem = index;
273  lvC.cx = (cxTotal * default_column_widths[index]) / 100;
274  lvC.fmt = column_alignment[index];
276  if (ListView_InsertColumn(hWndListView, index, &lvC) == -1) return FALSE;
277  }
278  return TRUE;
279 }
#define LVCF_WIDTH
Definition: commctrl.h:2587
#define LVCF_TEXT
Definition: commctrl.h:2588
#define TRUE
Definition: types.h:120
#define MAX_LIST_COLUMNS
Definition: listview.c:51
#define IDS_LIST_COLUMN_FIRST
Definition: resource.h:29
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define LVCF_SUBITEM
Definition: commctrl.h:2589
#define LVCOLUMN
Definition: commctrl.h:2581
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2636
#define FALSE
Definition: types.h:117
GLuint index
Definition: glext.h:6031
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define index(s, c)
Definition: various.h:29
static const int default_column_widths[MAX_LIST_COLUMNS]
Definition: listview.c:52
#define LVCF_FMT
Definition: commctrl.h:2586
HINSTANCE hInst
Definition: dxdiag.c:13
#define ARRAY_SIZE(a)
Definition: main.h:24
static const int column_alignment[MAX_LIST_COLUMNS]
Definition: listview.c:53

Referenced by CreateListView().

◆ CreateListView()

HWND CreateListView ( HWND  hwndParent,
HMENU  id,
INT  cx 
)

Definition at line 631 of file listview.c.

632 {
633  RECT rcClient;
634  HWND hwndLV;
635 
636  /* Get the dimensions of the parent window's client area, and create the list view control. */
637  GetClientRect(hwndParent, &rcClient);
638  hwndLV = CreateWindowExW(WS_EX_CLIENTEDGE, WC_LISTVIEW, L"List View",
640  0, 0, rcClient.right, rcClient.bottom,
641  hwndParent, id, hInst, NULL);
642  if (!hwndLV) return NULL;
643 
644  /* Initialize the image list, and add items to the control. */
645  if (!CreateListColumns(hwndLV, cx)) goto fail;
646  if (!InitListViewImageLists(hwndLV)) goto fail;
647 
648  return hwndLV;
649 fail:
650  DestroyWindow(hwndLV);
651  return NULL;
652 }
#define LVS_SHOWSELALWAYS
Definition: commctrl.h:2267
#define LVS_REPORT
Definition: commctrl.h:2262
static BOOL CreateListColumns(HWND hWndListView, INT cxTotal)
Definition: listview.c:259
#define WS_CHILD
Definition: pedump.c:617
LONG right
Definition: windef.h:308
BOOL WINAPI DestroyWindow(_In_ HWND)
#define L(x)
Definition: ntvdm.h:50
static HWND hwndParent
Definition: cryptui.c:300
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define WS_TABSTOP
Definition: pedump.c:634
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HINSTANCE hInst
Definition: dxdiag.c:13
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
static BOOL InitListViewImageLists(HWND hwndLV)
Definition: listview.c:281
#define LVS_EDITLABELS
Definition: commctrl.h:2273
#define NULL
Definition: types.h:112
#define WC_LISTVIEW
Definition: commctrl.h:2259
_Out_opt_ int * cx
Definition: commctrl.h:585
LONG bottom
Definition: windef.h:309
#define WS_VISIBLE
Definition: pedump.c:620

◆ DestroyListView()

void DestroyListView ( HWND  hwndLV)

Definition at line 654 of file listview.c.

655 {
656  INT count, i;
657  LVITEMW item;
658 
659  count = ListView_GetItemCount(hwndLV);
660  for (i = 0; i < count; i++)
661  {
662  item.mask = LVIF_PARAM;
663  item.iItem = i;
664  (void)ListView_GetItem(hwndLV, &item);
665  free(((LINE_INFO*)item.lParam)->name);
666  HeapFree(GetProcessHeap(), 0, (void*)item.lParam);
667  }
668 
669 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define free
Definition: debug_ros.c:5
int32_t INT
Definition: typedefs.h:58
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2307
#define GetProcessHeap()
Definition: compat.h:736
static ATOM item
Definition: dde.c:856
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 ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2394
#define LVIF_PARAM
Definition: commctrl.h:2311
#define HeapFree(x, y, z)
Definition: compat.h:735

Referenced by ChildWndProc(), and RefreshListView().

◆ GetValueName()

WCHAR* GetValueName ( HWND  hwndLV,
int  iStartAt 
)

Definition at line 55 of file listview.c.

56 {
57  int item;
58  LVITEMW LVItem;
59  PLINE_INFO lineinfo;
60 
61  /*
62  if a new item is inserted, then no allocation,
63  otherwise the heap block will be lost!
64  */
65  item = ListView_GetNextItem(hwndLV, iStartAt, LVNI_SELECTED);
66  if (item == -1) return NULL;
67 
68  /*
69  Should be always TRUE anyways
70  */
71  LVItem.iItem = item;
72  LVItem.iSubItem = 0;
73  LVItem.mask = LVIF_PARAM;
74  if (ListView_GetItem(hwndLV, &LVItem) == FALSE)
75  return NULL;
76 
77  lineinfo = (PLINE_INFO)LVItem.lParam;
78  if (lineinfo == NULL)
79  return NULL;
80 
81  return lineinfo->name;
82 }
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2434
#define LVNI_SELECTED
Definition: commctrl.h:2424
if(dx==0 &&dy==0)
Definition: linetemp.h:174
struct tagLINE_INFO * PLINE_INFO
#define FALSE
Definition: types.h:117
int iSubItem
Definition: commctrl.h:2362
LPARAM lParam
Definition: commctrl.h:2368
UINT mask
Definition: commctrl.h:2360
LPWSTR name
Definition: listview.c:34
static ATOM item
Definition: dde.c:856
#define NULL
Definition: types.h:112
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2394
#define LVIF_PARAM
Definition: commctrl.h:2311

Referenced by _CmdWndProc(), and FindNext().

◆ InitListViewImageLists()

static BOOL InitListViewImageLists ( HWND  hwndLV)
static

Definition at line 281 of file listview.c.

282 {
283  HIMAGELIST himl; /* handle to image list */
284  HICON hico; /* handle to icon */
285 
286  /* Create the image list. */
289  {
290  return FALSE;
291  }
292 
295 
298 
299  /* Fail if not all of the images were added. */
301  {
302  return FALSE;
303  }
304 
305  /* Associate the image list with the tree view control. */
307 
308  return TRUE;
309 }
INT WINAPI ImageList_GetImageCount(HIMAGELIST himl)
Definition: imagelist.c:2063
static HICON
Definition: imagelist.c:84
#define CY_ICON
Definition: listview.c:24
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define LVSIL_SMALL
Definition: commctrl.h:2299
#define TRUE
Definition: types.h:120
int Image_Bin
Definition: listview.c:28
HIMAGELIST himl
#define IDI_BIN
Definition: resource.h:44
#define CX_ICON
Definition: listview.c:23
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
#define FALSE
Definition: types.h:117
#define ListView_SetImageList(hwnd, himl, iImageList)
Definition: commctrl.h:2304
#define IDI_STRING
Definition: resource.h:43
INT WINAPI ImageList_AddIcon(HIMAGELIST himl, HICON hIcon)
Definition: imagelist.c:540
HICON hico
#define ILC_MASK
Definition: commctrl.h:351
int Image_String
Definition: listview.c:27
HINSTANCE hInst
Definition: dxdiag.c:13
#define NULL
Definition: types.h:112
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define LISTVIEW_NUM_ICONS
Definition: listview.c:25

Referenced by CreateListView().

◆ IsDefaultValue()

BOOL IsDefaultValue ( HWND  hwndLV,
int  i 
)

Definition at line 107 of file listview.c.

108 {
109  PLINE_INFO lineinfo;
110  LVITEMW Item;
111 
112  Item.mask = LVIF_PARAM;
113  Item.iItem = i;
114  if(ListView_GetItem(hwndLV, &Item))
115  {
116  lineinfo = (PLINE_INFO)Item.lParam;
117  return lineinfo && (!lineinfo->name || !wcscmp(lineinfo->name, L""));
118  }
119  return FALSE;
120 }
struct tagLINE_INFO * PLINE_INFO
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
LPWSTR name
Definition: listview.c:34
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
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
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2394
#define LVIF_PARAM
Definition: commctrl.h:2311

Referenced by ChildWndProc().

◆ ListView_Sort()

static BOOL ListView_Sort ( HWND  hListView,
int  iSortingColumn,
int  iSortedColumn 
)
static

Definition at line 480 of file listview.c.

481 {
482  if (!(GetWindowLongPtr(hListView, GWL_STYLE) & LVS_NOSORTHEADER) &&
483  (iSortingColumn >= 0) )
484  {
486  SORT_INFO SortInfo;
487 
488  HWND hHeader = ListView_GetHeader(hListView);
489  HDITEM hColumn = {0};
490 
491  /* If we are sorting according to another column, uninitialize the old one */
492  if ( (iSortedColumn >= 0) && (iSortingColumn != iSortedColumn) )
493  {
494  hColumn.mask = HDI_FORMAT;
495  Header_GetItem(hHeader, iSortedColumn, &hColumn);
496  hColumn.fmt &= ~(HDF_SORTUP | HDF_SORTDOWN);
497  Header_SetItem(hHeader, iSortedColumn, &hColumn);
498  }
499 
500  /* Get the sorting state of the new column */
501  hColumn.mask = HDI_FORMAT;
502  Header_GetItem(hHeader, iSortingColumn, &hColumn);
503 
504  /*
505  * Check whether we are sorting the list because the user clicked
506  * on a column, or because we are refreshing the list:
507  *
508  * iSortedColumn >= 0 - User clicked on a column; holds the
509  * old sorting column index.
510  * iSortedColumn < 0 - List being refreshed.
511  */
512  if (iSortedColumn >= 0)
513  {
514  /* Invert the sorting direction */
515  bSortAscending = ((hColumn.fmt & HDF_SORTUP) == 0);
516  }
517  else
518  {
519  /*
520  * If the sorting state of the column is uninitialized,
521  * initialize it by default to ascending sorting.
522  */
523  if ((hColumn.fmt & (HDF_SORTUP | HDF_SORTDOWN)) == 0)
524  hColumn.fmt |= HDF_SORTUP;
525 
526  /* Keep the same sorting direction */
527  bSortAscending = ((hColumn.fmt & HDF_SORTUP) != 0);
528  }
529 
530  /* Set the new column sorting state */
531  hColumn.fmt &= ~(bSortAscending ? HDF_SORTDOWN : HDF_SORTUP );
532  hColumn.fmt |= (bSortAscending ? HDF_SORTUP : HDF_SORTDOWN);
533  Header_SetItem(hHeader, iSortingColumn, &hColumn);
534 
535  /* Sort the list */
536  SortInfo.iSortingColumn = iSortingColumn;
537  SortInfo.bSortAscending = bSortAscending;
538  return ListView_SortItems(hListView, CompareFunc, (LPARAM)&SortInfo);
539  }
540  else
541  return TRUE;
542 }
BOOL bSortAscending
Definition: listview.c:42
#define TRUE
Definition: types.h:120
#define ListView_GetHeader(hwnd)
Definition: commctrl.h:2651
static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
Definition: listview.c:381
#define HDF_SORTUP
Definition: commctrl.h:724
#define HDITEM
Definition: commctrl.h:697
unsigned int BOOL
Definition: ntddk_ex.h:94
#define HDI_FORMAT
Definition: commctrl.h:705
#define Header_GetItem(hwndHD, i, phdi)
Definition: commctrl.h:751
static int iSortedColumn
Definition: srvpage.cpp:27
LONG_PTR LPARAM
Definition: windef.h:208
static BOOL bSortAscending
Definition: applpage.c:42
#define HDF_SORTDOWN
Definition: commctrl.h:725
INT iSortingColumn
Definition: listview.c:41
#define GWL_STYLE
Definition: winuser.h:846
#define ListView_SortItems(hwndLV, _pfnCompare, _lPrm)
Definition: commctrl.h:2703
#define LVS_NOSORTHEADER
Definition: commctrl.h:2285
#define GetWindowLongPtr
Definition: treelist.c:73
#define Header_SetItem(hwndHD, i, phdi)
Definition: commctrl.h:758

Referenced by ListWndNotifyProc(), and RefreshListView().

◆ ListWndNotifyProc()

BOOL ListWndNotifyProc ( HWND  hWnd,
WPARAM  wParam,
LPARAM  lParam,
BOOL Result 
)

Definition at line 544 of file listview.c.

545 {
547  int iSortingColumn;
549  *Result = TRUE;
550  switch (((LPNMHDR)lParam)->code)
551  {
552  case LVN_GETDISPINFO:
554  return TRUE;
555  case LVN_COLUMNCLICK:
556  iSortingColumn = ((LPNMLISTVIEW)lParam)->iSubItem;
557  (void)ListView_Sort(hWnd, iSortingColumn, g_iSortedColumn);
558  g_iSortedColumn = iSortingColumn;
559  return TRUE;
560  case NM_DBLCLK:
561  case NM_RETURN:
562  {
564  }
565  return TRUE;
566  case NM_SETFOCUS:
568  break;
569  case LVN_BEGINLABELEDIT:
571  if(Info)
572  {
573  PLINE_INFO lineinfo = (PLINE_INFO)Info->item.lParam;
574  if(!lineinfo->name || !wcscmp(lineinfo->name, L""))
575  {
576  *Result = TRUE;
577  }
578  else
579  {
580  *Result = FALSE;
581  }
582  }
583  else
584  *Result = TRUE;
585  return TRUE;
586  case LVN_ENDLABELEDIT:
588  if(Info && Info->item.pszText)
589  {
590  PLINE_INFO lineinfo = (PLINE_INFO)Info->item.lParam;
591  if(!lineinfo->name || !wcscmp(lineinfo->name, L""))
592  {
593  *Result = FALSE;
594  }
595  else
596  {
597  if(wcslen(Info->item.pszText) == 0)
598  {
599  WCHAR msg[128], caption[128];
600 
602  LoadStringW(hInst, IDS_ERR_RENVAL_CAPTION, caption, ARRAY_SIZE(caption));
603  MessageBoxW(0, msg, caption, 0);
604  *Result = TRUE;
605  }
606  else
607  {
608  HKEY hKeyRoot;
609  LPCWSTR keyPath;
610  LONG lResult;
611 
612  keyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot);
613  lResult = RenameValue(hKeyRoot, keyPath, Info->item.pszText, lineinfo->name);
614  lineinfo->name = realloc(lineinfo->name, (wcslen(Info->item.pszText)+1)*sizeof(WCHAR));
615  if (lineinfo->name != NULL)
616  wcscpy(lineinfo->name, Info->item.pszText);
617 
618  *Result = TRUE;
619  return (lResult == ERROR_SUCCESS);
620  }
621  }
622  }
623  else
624  *Result = TRUE;
625 
626  return TRUE;
627  }
628  return FALSE;
629 }
#define realloc
Definition: debug_ros.c:6
#define LVN_BEGINLABELEDIT
Definition: commctrl.h:3158
#define MAKEWPARAM(l, h)
Definition: winuser.h:3999
ChildWnd * g_pChildWnd
Definition: childwnd.c:23
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
HWND hTreeWnd
Definition: main.h:63
LONG RenameValue(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpDestValue, LPCWSTR lpSrcValue)
Definition: edit.c:1522
HWND hWnd
Definition: settings.c:17
static void OnGetDispInfo(NMLVDISPINFO *plvdi)
Definition: listview.c:313
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
WPARAM wParam
Definition: combotst.c:138
struct tagLINE_INFO * PLINE_INFO
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
_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
LPCWSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY *phRootKey)
Definition: treeview.c:88
#define NMLVDISPINFO
Definition: commctrl.h:3182
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NM_SETFOCUS
Definition: commctrl.h:135
#define IDS_ERR_RENVAL_TOEMPTY
Definition: resource.h:139
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define IDS_ERR_RENVAL_CAPTION
Definition: resource.h:138
#define WM_COMMAND
Definition: winuser.h:1730
Definition: inflate.c:139
LPWSTR name
Definition: listview.c:34
#define LVN_GETDISPINFO
Definition: commctrl.h:3160
static INT g_iSortedColumn
Definition: listview.c:49
#define ID_EDIT_MODIFY
Definition: resource.h:62
#define NM_RETURN
Definition: commctrl.h:132
HWND hFrameWnd
Definition: main.c:35
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
HINSTANCE hInst
Definition: dxdiag.c:13
static BOOL ListView_Sort(HWND hListView, int iSortingColumn, int iSortedColumn)
Definition: listview.c:480
#define NM_DBLCLK
Definition: commctrl.h:131
struct tagNMLISTVIEW * LPNMLISTVIEW
#define ARRAY_SIZE(a)
Definition: main.h:24
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
#define LVN_COLUMNCLICK
Definition: commctrl.h:3139
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define msg(x)
Definition: auth_time.c:54
#define LVN_ENDLABELEDIT
Definition: commctrl.h:3159
LPARAM lParam
Definition: combotst.c:139
int nFocusPanel
Definition: main.h:68

Referenced by ChildWndProc().

◆ OnGetDispInfo()

static void OnGetDispInfo ( NMLVDISPINFO plvdi)
static

Definition at line 313 of file listview.c.

314 {
315  static WCHAR buffer[200];
316 
317  plvdi->item.pszText = NULL;
318  plvdi->item.cchTextMax = 0;
319 
320  switch (plvdi->item.iSubItem)
321  {
322  case 0:
324  plvdi->item.pszText = buffer;
325  break;
326  case 1:
327  switch (((LINE_INFO*)plvdi->item.lParam)->dwValType)
328  {
329  case REG_NONE:
330  plvdi->item.pszText = L"REG_NONE";
331  break;
332  case REG_SZ:
333  plvdi->item.pszText = L"REG_SZ";
334  break;
335  case REG_EXPAND_SZ:
336  plvdi->item.pszText = L"REG_EXPAND_SZ";
337  break;
338  case REG_BINARY:
339  plvdi->item.pszText = L"REG_BINARY";
340  break;
341  case REG_DWORD: /* REG_DWORD_LITTLE_ENDIAN */
342  plvdi->item.pszText = L"REG_DWORD";
343  break;
345  plvdi->item.pszText = L"REG_DWORD_BIG_ENDIAN";
346  break;
347  case REG_LINK:
348  plvdi->item.pszText = L"REG_LINK";
349  break;
350  case REG_MULTI_SZ:
351  plvdi->item.pszText = L"REG_MULTI_SZ";
352  break;
353  case REG_RESOURCE_LIST:
354  plvdi->item.pszText = L"REG_RESOURCE_LIST";
355  break;
357  plvdi->item.pszText = L"REG_FULL_RESOURCE_DESCRIPTOR";
358  break;
360  plvdi->item.pszText = L"REG_RESOURCE_REQUIREMENTS_LIST";
361  break;
362  case REG_QWORD: /* REG_QWORD_LITTLE_ENDIAN */
363  plvdi->item.pszText = L"REG_QWORD";
364  break;
365  default:
366  {
367  WCHAR buf2[200];
369  wsprintf(buffer, buf2, ((LINE_INFO*)plvdi->item.lParam)->dwValType);
370  plvdi->item.pszText = buffer;
371  break;
372  }
373  }
374  break;
375  case 3:
376  plvdi->item.pszText = L"";
377  break;
378  }
379 }
#define IDS_DEFAULT_VALUE_NAME
Definition: resource.h:126
#define REG_BINARY
Definition: nt_native.h:1496
GLuint buffer
Definition: glext.h:5915
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define REG_RESOURCE_REQUIREMENTS_LIST
Definition: nt_native.h:1504
#define IDS_UNKNOWN_TYPE
Definition: resource.h:128
#define L(x)
Definition: ntvdm.h:50
#define REG_MULTI_SZ
Definition: nt_native.h:1501
#define REG_RESOURCE_LIST
Definition: nt_native.h:1502
#define REG_FULL_RESOURCE_DESCRIPTOR
Definition: nt_native.h:1503
#define REG_LINK
Definition: nt_native.h:1500
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define REG_DWORD_BIG_ENDIAN
Definition: nt_native.h:1499
HINSTANCE hInst
Definition: dxdiag.c:13
#define ARRAY_SIZE(a)
Definition: main.h:24
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define NULL
Definition: types.h:112
#define REG_QWORD
Definition: sdbapi.c:597
#define REG_NONE
Definition: nt_native.h:1492
#define wsprintf
Definition: winuser.h:5855
#define REG_DWORD
Definition: sdbapi.c:596
#define REG_SZ
Definition: layer.c:22

Referenced by ListWndNotifyProc().

◆ RefreshListView()

BOOL RefreshListView ( HWND  hwndLV,
HKEY  hKey,
LPCWSTR  keyPath 
)

Definition at line 671 of file listview.c.

672 {
673  DWORD max_sub_key_len;
674  DWORD max_val_name_len;
675  DWORD max_val_size;
676  DWORD val_count;
677  HKEY hNewKey;
678  LONG errCode;
679  INT i, c;
680  BOOL AddedDefault = FALSE;
681 
682  if (!hwndLV) return FALSE;
683 
684  (void)ListView_EditLabel(hwndLV, -1);
685 
686  SendMessageW(hwndLV, WM_SETREDRAW, FALSE, 0);
687  DestroyListView(hwndLV);
688 
689  (void)ListView_DeleteAllItems(hwndLV);
690 
691  if(!hKey) return FALSE;
692 
693  errCode = RegOpenKeyExW(hKey, keyPath, 0, KEY_READ, &hNewKey);
694  if (errCode != ERROR_SUCCESS) return FALSE;
695 
696  /* get size information and resize the buffers if necessary */
697  errCode = RegQueryInfoKeyW(hNewKey, NULL, NULL, NULL, NULL, &max_sub_key_len, NULL,
698  &val_count, &max_val_name_len, &max_val_size, NULL, NULL);
699 
700  if (errCode == ERROR_SUCCESS)
701  {
702  WCHAR* ValName = HeapAlloc(GetProcessHeap(), 0, ++max_val_name_len * sizeof(WCHAR));
703  DWORD dwValNameLen = max_val_name_len;
704  BYTE* ValBuf = HeapAlloc(GetProcessHeap(), 0, max_val_size + sizeof(WCHAR));
705  DWORD dwValSize = max_val_size;
706  DWORD dwIndex = 0L;
707  DWORD dwValType;
708  /* if (RegQueryValueExW(hNewKey, NULL, NULL, &dwValType, ValBuf, &dwValSize) == ERROR_SUCCESS) { */
709  /* AddEntryToList(hwndLV, L"(Default)", dwValType, ValBuf, dwValSize); */
710  /* } */
711  /* dwValSize = max_val_size; */
712  while (RegEnumValueW(hNewKey, dwIndex, ValName, &dwValNameLen, NULL, &dwValType, ValBuf, &dwValSize) == ERROR_SUCCESS)
713  {
714  /* Add a terminating 0 character. Usually this is only necessary for strings. */
715  ValBuf[dwValSize] = ValBuf[dwValSize + 1] = 0;
716 
717  AddEntryToList(hwndLV, ValName, dwValType, ValBuf, dwValSize, -1, TRUE);
718  dwValNameLen = max_val_name_len;
719  dwValSize = max_val_size;
720  dwValType = 0L;
721  ++dwIndex;
722  if(!wcscmp(ValName, L""))
723  {
724  AddedDefault = TRUE;
725  }
726  }
727  HeapFree(GetProcessHeap(), 0, ValBuf);
728  HeapFree(GetProcessHeap(), 0, ValName);
729  }
730  RegCloseKey(hNewKey);
731 
732  if(!AddedDefault)
733  {
734  AddEntryToList(hwndLV, L"", REG_SZ, NULL, 0, 0, FALSE);
735  }
736  c = ListView_GetItemCount(hwndLV);
737  for(i = 0; i < c; i++)
738  {
740  }
744  (void)ListView_Sort(hwndLV, g_iSortedColumn, -1);
745  SendMessageW(hwndLV, WM_SETREDRAW, TRUE, 0);
746 
747  return TRUE;
748 }
void DestroyListView(HWND hwndLV)
Definition: listview.c:654
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
INT iListViewSelect
Definition: listview.c:29
#define KEY_READ
Definition: nt_native.h:1023
#define TRUE
Definition: types.h:120
#define WM_SETREDRAW
Definition: winuser.h:1606
static void AddEntryToList(HWND hwndLV, LPWSTR Name, DWORD dwValType, void *ValBuf, DWORD dwCount, int Position, BOOL ValExists)
Definition: listview.c:125
int32_t INT
Definition: typedefs.h:58
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
#define ListView_SetItemState(hwndLV, i, data, mask)
Definition: commctrl.h:2673
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2853
#define LVIS_SELECTED
Definition: commctrl.h:2319
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2307
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
const GLubyte * c
Definition: glext.h:8905
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3690
unsigned char BYTE
Definition: xxhash.c:193
static INT g_iSortedColumn
Definition: listview.c:49
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
static BOOL ListView_Sort(HWND hListView, int iSortingColumn, int iSortedColumn)
Definition: listview.c:480
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
FxAutoRegKey hKey
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
#define c
Definition: ke_i.h:80
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
#define HeapFree(x, y, z)
Definition: compat.h:735
#define RegCloseKey(hKey)
Definition: registry.h:47
#define LVIS_FOCUSED
Definition: commctrl.h:2318
#define ListView_EditLabel(hwndLV, i)
Definition: commctrl.h:2540
#define ListView_DeleteAllItems(hwnd)
Definition: commctrl.h:2414
#define REG_SZ
Definition: layer.c:22

Referenced by _CmdWndProc(), CreateNewValue(), ImportRegistryFile(), LoadHive(), UnloadHive(), and UpdateAddress().

◆ SetValueName()

VOID SetValueName ( HWND  hwndLV,
LPCWSTR  pszValueName 
)

Definition at line 84 of file listview.c.

85 {
86  INT i, c;
87  LVFINDINFOW fi;
88 
89  c = ListView_GetItemCount(hwndLV);
90  for(i = 0; i < c; i++)
91  {
93  }
94  if (pszValueName == NULL)
95  i = 0;
96  else
97  {
98  fi.flags = LVFI_STRING;
99  fi.psz = pszValueName;
100  i = ListView_FindItem(hwndLV, -1, &fi);
101  }
104  iListViewSelect = i;
105 }
INT iListViewSelect
Definition: listview.c:29
int32_t INT
Definition: typedefs.h:58
#define ListView_SetItemState(hwndLV, i, data, mask)
Definition: commctrl.h:2673
#define LVIS_SELECTED
Definition: commctrl.h:2319
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2307
LPCWSTR psz
Definition: commctrl.h:2457
const GLubyte * c
Definition: glext.h:8905
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 NULL
Definition: types.h:112
#define LVFI_STRING
Definition: commctrl.h:2437
#define ListView_FindItem(hwnd, iStart, plvfi)
Definition: commctrl.h:2470
#define c
Definition: ke_i.h:80
#define LVIS_FOCUSED
Definition: commctrl.h:2318

Referenced by FindNext().

Variable Documentation

◆ column_alignment

const int column_alignment[MAX_LIST_COLUMNS] = { LVCFMT_LEFT, LVCFMT_LEFT, LVCFMT_LEFT }
static

Definition at line 53 of file listview.c.

Referenced by CreateListColumns().

◆ default_column_widths

const int default_column_widths[MAX_LIST_COLUMNS] = { 35, 25, 40 }
static

Definition at line 52 of file listview.c.

Referenced by CreateListColumns().

◆ g_iSortedColumn

INT g_iSortedColumn = 0
static

Definition at line 49 of file listview.c.

Referenced by ListWndNotifyProc(), and RefreshListView().

◆ iListViewSelect

INT iListViewSelect = -1

Definition at line 29 of file listview.c.

Referenced by RefreshListView(), and SetValueName().

◆ Image_Bin

int Image_Bin = 0

Definition at line 28 of file listview.c.

Referenced by AddEntryToList(), and InitListViewImageLists().

◆ Image_String

int Image_String = 0

Definition at line 27 of file listview.c.

Referenced by AddEntryToList(), and InitListViewImageLists().