ReactOS  0.4.12-dev-721-g03c3dd5
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

LPCWSTR GetValueName (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)
 
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)
 
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] = { 200, 175, 400 }
 
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  {
217  WCHAR buf[200];
218  if(dwCount == sizeof(DWORD))
219  {
220  wsprintf(buf, L"0x%08x (%u)", *(DWORD*)ValBuf, *(DWORD*)ValBuf);
221  }
222  else
223  {
225  }
226  ListView_SetItemText(hwndLV, index, 2, buf);
227  }
228  /* lpsRes = convertHexToDWORDStr(lpbData, dwLen); */
229  break;
230  default:
231  {
232  unsigned int i;
233  LPBYTE pData = (LPBYTE)ValBuf;
234  LPWSTR strBinary;
235  if(dwCount > 0)
236  {
237  strBinary = HeapAlloc(GetProcessHeap(), 0, (dwCount * sizeof(WCHAR) * 3) + sizeof(WCHAR));
238  for (i = 0; i < dwCount; i++)
239  {
240  wsprintf( strBinary + i*3, L"%02X ", pData[i] );
241  }
242  strBinary[dwCount * 3] = 0;
243  ListView_SetItemText(hwndLV, index, 2, strBinary);
244  HeapFree(GetProcessHeap(), 0, strBinary);
245  }
246  else
247  {
248  WCHAR szText[128];
250  ListView_SetItemText(hwndLV, index, 2, szText);
251  }
252  }
253  break;
254  }
255  }
256 }
struct tagLINE_INFO LINE_INFO
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
__wchar_t WCHAR
Definition: xmlstorage.h:180
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:2380
#define IDS_INVALID_DWORD
Definition: resource.h:134
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:2281
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
size_t val_len
Definition: listview.c:36
unsigned char * LPBYTE
Definition: typedefs.h:52
static const WCHAR szText[]
Definition: dialog.c:139
#define REG_MULTI_SZ
Definition: nt_native.h:1501
struct NameRec_ * Name
Definition: cdprocs.h:464
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
#define ListView_SetItemText(hwndLV, i, iSubItem_, pszText_)
Definition: commctrl.h:2663
#define COUNT_OF(a)
Definition: main.h:33
DWORD dwValType
Definition: listview.c:33
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static int
Definition: listview.c:31
#define LVIF_IMAGE
Definition: commctrl.h:2282
unsigned long DWORD
Definition: ntddk_ex.h:95
#define index(s, c)
Definition: various.h:29
static const WCHAR L[]
Definition: oid.c:1250
#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
#define IDS_BINARY_EMPTY
Definition: resource.h:127
#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 HEAP_ZERO_MEMORY
Definition: compat.h:123
void * val
Definition: listview.c:35
#define LVIF_PARAM
Definition: commctrl.h:2283
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define LPSTR_TEXTCALLBACK
Definition: commctrl.h:2355
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:5731
#define IDS_VALUE_NOT_SET
Definition: resource.h:129
#define REG_DWORD
Definition: sdbapi.c:539
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:394
#define LPARAM
Definition: msvc.h:38
#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 380 of file listview.c.

381 {
382  PSORT_INFO pSortInfo = (PSORT_INFO)lParamSort;
383  LINE_INFO *l, *r;
384  DWORD dw1, dw2;
385  DWORDLONG qw1, qw2;
386 
387  l = (LINE_INFO*)lParam1;
388  r = (LINE_INFO*)lParam2;
389 
390  if (pSortInfo->iSortingColumn == 1 && l->dwValType != r->dwValType)
391  {
392  /* Sort by type */
393  if (pSortInfo->bSortAscending)
394  return ((int)l->dwValType - (int)r->dwValType);
395  else
396  return ((int)r->dwValType - (int)l->dwValType);
397  }
398  if (pSortInfo->iSortingColumn == 2)
399  {
400  /* Sort by value */
401  if (l->dwValType != r->dwValType)
402  {
403  if (pSortInfo->bSortAscending)
404  return ((int)l->dwValType - (int)r->dwValType);
405  else
406  return ((int)r->dwValType - (int)l->dwValType);
407  }
408 
409  if (l->val == NULL && r->val == NULL)
410  return 0;
411 
412  if (pSortInfo->bSortAscending)
413  {
414  if (l->val == NULL)
415  return -1;
416  if (r->val == NULL)
417  return 1;
418  }
419  else
420  {
421  if (l->val == NULL)
422  return 1;
423  if (r->val == NULL)
424  return -1;
425  }
426 
427  switch(l->dwValType)
428  {
429  case REG_DWORD:
430  {
431  dw1 = *(DWORD*)l->val;
432  dw2 = *(DWORD*)r->val;
433  if (pSortInfo->bSortAscending)
434  // return (dw1 > dw2 ? 1 : -1);
435  return ((int)dw1 - (int)dw2);
436  else
437  // return (dw1 > dw2 ? -1 : 1);
438  return ((int)dw2 - (int)dw1);
439  }
440 
441  case REG_QWORD: /* REG_QWORD_LITTLE_ENDIAN */
442  {
443  qw1 = *(DWORDLONG*)l->val;
444  qw2 = *(DWORDLONG*)r->val;
445  if (pSortInfo->bSortAscending)
446  // return (qw1 > qw2 ? 1 : -1);
447  return ((int)qw1 - (int)qw2);
448  else
449  // return (qw1 > qw2 ? -1 : 1);
450  return ((int)qw2 - (int)qw1);
451  }
452 
453  default:
454  {
455  INT nCompare = 0;
456 
457  if (pSortInfo->bSortAscending)
458  {
459  nCompare = memcmp(l->val, r->val, min(l->val_len, r->val_len));
460  if (nCompare == 0)
461  nCompare = l->val_len - r->val_len;
462  }
463  else
464  {
465  nCompare = memcmp(r->val, l->val, min(r->val_len, l->val_len));
466  if (nCompare == 0)
467  nCompare = r->val_len - l->val_len;
468  }
469 
470  return nCompare;
471  }
472  }
473  }
474 
475  /* Sort by name */
476  return (pSortInfo->bSortAscending ? StrCmpLogicalW(l->name, r->name) : StrCmpLogicalW(r->name, l->name));
477 }
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:56
smooth NULL
Definition: ftsmooth.c:416
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
struct tagSORT_INFO * PSORT_INFO
unsigned long long DWORDLONG
Definition: intsafe.h:99
#define REG_QWORD
Definition: sdbapi.c:540
#define REG_DWORD
Definition: sdbapi.c:539

Referenced by ListView_Sort().

◆ CreateListColumns()

static BOOL CreateListColumns ( HWND  hWndListView)
static

Definition at line 258 of file listview.c.

259 {
260  WCHAR szText[50];
261  int index;
262  LVCOLUMN lvC;
263 
264  /* Create columns. */
265  lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
266  lvC.pszText = szText;
267 
268  /* Load the column labels from the resource file. */
269  for (index = 0; index < MAX_LIST_COLUMNS; index++)
270  {
271  lvC.iSubItem = index;
272  lvC.cx = default_column_widths[index];
273  lvC.fmt = column_alignment[index];
275  if (ListView_InsertColumn(hWndListView, index, &lvC) == -1) return FALSE;
276  }
277  return TRUE;
278 }
#define TRUE
Definition: types.h:120
#define LVCF_WIDTH
Definition: commctrl.h:2559
#define LVCF_TEXT
Definition: commctrl.h:2560
__wchar_t WCHAR
Definition: xmlstorage.h:180
#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:2561
#define LVCOLUMN
Definition: commctrl.h:2553
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2608
static const WCHAR szText[]
Definition: dialog.c:139
GLuint index
Definition: glext.h:6031
#define COUNT_OF(a)
Definition: main.h:33
#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:2558
HINSTANCE hInst
Definition: dxdiag.c:13
static const int column_alignment[MAX_LIST_COLUMNS]
Definition: listview.c:53

Referenced by CreateListView().

◆ CreateListView()

HWND CreateListView ( HWND  hwndParent,
HMENU  id 
)

Definition at line 630 of file listview.c.

631 {
632  RECT rcClient;
633  HWND hwndLV;
634 
635  /* Get the dimensions of the parent window's client area, and create the list view control. */
636  GetClientRect(hwndParent, &rcClient);
637  hwndLV = CreateWindowExW(WS_EX_CLIENTEDGE, WC_LISTVIEW, L"List View",
639  0, 0, rcClient.right, rcClient.bottom,
640  hwndParent, id, hInst, NULL);
641  if (!hwndLV) return NULL;
642 
643  /* Initialize the image list, and add items to the control. */
644  if (!CreateListColumns(hwndLV)) goto fail;
645  if (!InitListViewImageLists(hwndLV)) goto fail;
646 
647  return hwndLV;
648 fail:
649  DestroyWindow(hwndLV);
650  return NULL;
651 }
#define LVS_SHOWSELALWAYS
Definition: commctrl.h:2239
#define LVS_REPORT
Definition: commctrl.h:2234
#define WS_CHILD
Definition: pedump.c:617
LONG right
Definition: windef.h:293
BOOL WINAPI DestroyWindow(_In_ HWND)
smooth NULL
Definition: ftsmooth.c:416
static HWND hwndParent
Definition: cryptui.c:300
static const WCHAR L[]
Definition: oid.c:1250
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:280
#define LVS_EDITLABELS
Definition: commctrl.h:2245
#define WC_LISTVIEW
Definition: commctrl.h:2231
static BOOL CreateListColumns(HWND hWndListView)
Definition: listview.c:258
LONG bottom
Definition: windef.h:294
#define WS_VISIBLE
Definition: pedump.c:620

◆ DestroyListView()

void DestroyListView ( HWND  hwndLV)

Definition at line 653 of file listview.c.

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

Referenced by ChildWndProc(), and RefreshListView().

◆ GetValueName()

LPCWSTR 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:2406
#define LVNI_SELECTED
Definition: commctrl.h:2396
struct tagLINE_INFO * PLINE_INFO
int iSubItem
Definition: commctrl.h:2334
LPARAM lParam
Definition: commctrl.h:2340
smooth NULL
Definition: ftsmooth.c:416
if(!(yy_init))
Definition: macro.lex.yy.c:714
UINT mask
Definition: commctrl.h:2332
LPWSTR name
Definition: listview.c:34
static ATOM item
Definition: dde.c:856
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2366
#define LVIF_PARAM
Definition: commctrl.h:2283

Referenced by _CmdWndProc(), and FindNext().

◆ InitListViewImageLists()

static BOOL InitListViewImageLists ( HWND  hwndLV)
static

Definition at line 280 of file listview.c.

281 {
282  HIMAGELIST himl; /* handle to image list */
283  HICON hico; /* handle to icon */
284 
285  /* Create the image list. */
288  {
289  return FALSE;
290  }
291 
294 
297 
298  /* Fail if not all of the images were added. */
300  {
301  return FALSE;
302  }
303 
304  /* Associate the image list with the tree view control. */
306 
307  return TRUE;
308 }
INT WINAPI ImageList_GetImageCount(HIMAGELIST himl)
Definition: imagelist.c:1967
static HICON
Definition: imagelist.c:84
#define TRUE
Definition: types.h:120
#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:47
#define LVSIL_SMALL
Definition: commctrl.h:2271
int Image_Bin
Definition: listview.c:28
HIMAGELIST himl
#define IDI_BIN
Definition: resource.h:46
#define CX_ICON
Definition: listview.c:23
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:769
#define ListView_SetImageList(hwnd, himl, iImageList)
Definition: commctrl.h:2276
smooth NULL
Definition: ftsmooth.c:416
#define IDI_STRING
Definition: resource.h:45
INT WINAPI ImageList_AddIcon(HIMAGELIST himl, HICON hIcon)
Definition: imagelist.c:505
HICON hico
#define ILC_MASK
Definition: commctrl.h:336
int Image_String
Definition: listview.c:27
HINSTANCE hInst
Definition: dxdiag.c:13
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
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
LPARAM lParam
Definition: commctrl.h:2340
UINT mask
Definition: commctrl.h:2332
static const WCHAR L[]
Definition: oid.c:1250
LPWSTR name
Definition: listview.c:34
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2366
#define LVIF_PARAM
Definition: commctrl.h:2283

Referenced by ChildWndProc().

◆ ListView_Sort()

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

Definition at line 479 of file listview.c.

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

Referenced by ListWndNotifyProc(), and RefreshListView().

◆ ListWndNotifyProc()

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

Definition at line 543 of file listview.c.

544 {
546  int iSortingColumn;
548  *Result = TRUE;
549  switch (((LPNMHDR)lParam)->code)
550  {
551  case LVN_GETDISPINFO:
553  return TRUE;
554  case LVN_COLUMNCLICK:
555  iSortingColumn = ((LPNMLISTVIEW)lParam)->iSubItem;
556  (void)ListView_Sort(hWnd, iSortingColumn, g_iSortedColumn);
557  g_iSortedColumn = iSortingColumn;
558  return TRUE;
559  case NM_DBLCLK:
560  case NM_RETURN:
561  {
563  }
564  return TRUE;
565  case NM_SETFOCUS:
567  break;
568  case LVN_BEGINLABELEDIT:
570  if(Info)
571  {
572  PLINE_INFO lineinfo = (PLINE_INFO)Info->item.lParam;
573  if(!lineinfo->name || !wcscmp(lineinfo->name, L""))
574  {
575  *Result = TRUE;
576  }
577  else
578  {
579  *Result = FALSE;
580  }
581  }
582  else
583  *Result = TRUE;
584  return TRUE;
585  case LVN_ENDLABELEDIT:
587  if(Info && Info->item.pszText)
588  {
589  PLINE_INFO lineinfo = (PLINE_INFO)Info->item.lParam;
590  if(!lineinfo->name || !wcscmp(lineinfo->name, L""))
591  {
592  *Result = FALSE;
593  }
594  else
595  {
596  if(wcslen(Info->item.pszText) == 0)
597  {
598  WCHAR msg[128], caption[128];
599 
601  LoadStringW(hInst, IDS_ERR_RENVAL_CAPTION, caption, COUNT_OF(caption));
602  MessageBoxW(0, msg, caption, 0);
603  *Result = TRUE;
604  }
605  else
606  {
607  HKEY hKeyRoot;
608  LPCWSTR keyPath;
609  LONG lResult;
610 
611  keyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot);
612  lResult = RenameValue(hKeyRoot, keyPath, Info->item.pszText, lineinfo->name);
613  lineinfo->name = realloc(lineinfo->name, (wcslen(Info->item.pszText)+1)*sizeof(WCHAR));
614  if (lineinfo->name != NULL)
615  wcscpy(lineinfo->name, Info->item.pszText);
616 
617  *Result = TRUE;
618  return (lResult == ERROR_SUCCESS);
619  }
620  }
621  }
622  else
623  *Result = TRUE;
624 
625  return TRUE;
626  }
627  return FALSE;
628 }
#define realloc
Definition: debug_ros.c:6
#define TRUE
Definition: types.h:120
#define LVN_BEGINLABELEDIT
Definition: commctrl.h:3130
#define MAKEWPARAM(l, h)
Definition: winuser.h:3916
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:47
#define ERROR_SUCCESS
Definition: deptool.c:10
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
__wchar_t WCHAR
Definition: xmlstorage.h:180
HWND hTreeWnd
Definition: main.h:60
LONG RenameValue(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpDestValue, LPCWSTR lpSrcValue)
Definition: edit.c:1522
HWND hWnd
Definition: settings.c:17
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
static void OnGetDispInfo(NMLVDISPINFO *plvdi)
Definition: listview.c:312
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 TraceInfo Info
struct tagLINE_INFO * PLINE_INFO
long LONG
Definition: pedump.c:60
UINT msg
Definition: msvc.h:92
smooth NULL
Definition: ftsmooth.c:416
_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:83
#define NMLVDISPINFO
Definition: commctrl.h:3154
#define COUNT_OF(a)
Definition: main.h:33
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
#define NM_SETFOCUS
Definition: commctrl.h:135
#define IDS_ERR_RENVAL_TOEMPTY
Definition: resource.h:141
_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:140
static const WCHAR L[]
Definition: oid.c:1250
#define WM_COMMAND
Definition: winuser.h:1716
LPWSTR name
Definition: listview.c:34
#define LVN_GETDISPINFO
Definition: commctrl.h:3132
static INT g_iSortedColumn
Definition: listview.c:49
#define ID_EDIT_MODIFY
Definition: resource.h:64
#define NM_RETURN
Definition: commctrl.h:132
HWND hFrameWnd
Definition: main.c:30
_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:479
#define NM_DBLCLK
Definition: commctrl.h:131
struct tagNMLISTVIEW * LPNMLISTVIEW
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LVN_COLUMNCLICK
Definition: commctrl.h:3111
#define LVN_ENDLABELEDIT
Definition: commctrl.h:3131
LPARAM lParam
Definition: combotst.c:139
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
int nFocusPanel
Definition: main.h:64

Referenced by ChildWndProc().

◆ OnGetDispInfo()

static void OnGetDispInfo ( NMLVDISPINFO plvdi)
static

Definition at line 312 of file listview.c.

313 {
314  static WCHAR buffer[200];
315 
316  plvdi->item.pszText = NULL;
317  plvdi->item.cchTextMax = 0;
318 
319  switch (plvdi->item.iSubItem)
320  {
321  case 0:
323  plvdi->item.pszText = buffer;
324  break;
325  case 1:
326  switch (((LINE_INFO*)plvdi->item.lParam)->dwValType)
327  {
328  case REG_NONE:
329  plvdi->item.pszText = L"REG_NONE";
330  break;
331  case REG_SZ:
332  plvdi->item.pszText = L"REG_SZ";
333  break;
334  case REG_EXPAND_SZ:
335  plvdi->item.pszText = L"REG_EXPAND_SZ";
336  break;
337  case REG_BINARY:
338  plvdi->item.pszText = L"REG_BINARY";
339  break;
340  case REG_DWORD: /* REG_DWORD_LITTLE_ENDIAN */
341  plvdi->item.pszText = L"REG_DWORD";
342  break;
344  plvdi->item.pszText = L"REG_DWORD_BIG_ENDIAN";
345  break;
346  case REG_LINK:
347  plvdi->item.pszText = L"REG_LINK";
348  break;
349  case REG_MULTI_SZ:
350  plvdi->item.pszText = L"REG_MULTI_SZ";
351  break;
352  case REG_RESOURCE_LIST:
353  plvdi->item.pszText = L"REG_RESOURCE_LIST";
354  break;
356  plvdi->item.pszText = L"REG_FULL_RESOURCE_DESCRIPTOR";
357  break;
359  plvdi->item.pszText = L"REG_RESOURCE_REQUIREMENTS_LIST";
360  break;
361  case REG_QWORD: /* REG_QWORD_LITTLE_ENDIAN */
362  plvdi->item.pszText = L"REG_QWORD";
363  break;
364  default:
365  {
366  WCHAR buf2[200];
368  wsprintf(buffer, buf2, ((LINE_INFO*)plvdi->item.lParam)->dwValType);
369  plvdi->item.pszText = buffer;
370  break;
371  }
372  }
373  break;
374  case 3:
375  plvdi->item.pszText = L"";
376  break;
377  }
378 }
#define IDS_DEFAULT_VALUE_NAME
Definition: resource.h:128
#define REG_BINARY
Definition: nt_native.h:1496
__wchar_t WCHAR
Definition: xmlstorage.h:180
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:130
#define REG_MULTI_SZ
Definition: nt_native.h:1501
smooth NULL
Definition: ftsmooth.c:416
#define REG_RESOURCE_LIST
Definition: nt_native.h:1502
#define REG_FULL_RESOURCE_DESCRIPTOR
Definition: nt_native.h:1503
#define COUNT_OF(a)
Definition: main.h:33
#define REG_LINK
Definition: nt_native.h:1500
static const WCHAR L[]
Definition: oid.c:1250
#define REG_DWORD_BIG_ENDIAN
Definition: nt_native.h:1499
HINSTANCE hInst
Definition: dxdiag.c:13
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define REG_QWORD
Definition: sdbapi.c:540
#define REG_NONE
Definition: nt_native.h:1492
#define wsprintf
Definition: winuser.h:5731
#define REG_DWORD
Definition: sdbapi.c:539
#define REG_SZ
Definition: layer.c:22

Referenced by ListWndNotifyProc().

◆ RefreshListView()

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

Definition at line 670 of file listview.c.

671 {
672  DWORD max_sub_key_len;
673  DWORD max_val_name_len;
674  DWORD max_val_size;
675  DWORD val_count;
676  HKEY hNewKey;
677  LONG errCode;
678  INT i, c;
679  BOOL AddedDefault = FALSE;
680 
681  if (!hwndLV) return FALSE;
682 
683  (void)ListView_EditLabel(hwndLV, -1);
684 
685  SendMessageW(hwndLV, WM_SETREDRAW, FALSE, 0);
686  DestroyListView(hwndLV);
687 
688  (void)ListView_DeleteAllItems(hwndLV);
689 
690  if(!hKey) return FALSE;
691 
692  errCode = RegOpenKeyExW(hKey, keyPath, 0, KEY_READ, &hNewKey);
693  if (errCode != ERROR_SUCCESS) return FALSE;
694 
695  /* get size information and resize the buffers if necessary */
696  errCode = RegQueryInfoKeyW(hNewKey, NULL, NULL, NULL, NULL, &max_sub_key_len, NULL,
697  &val_count, &max_val_name_len, &max_val_size, NULL, NULL);
698 
699  if (errCode == ERROR_SUCCESS)
700  {
701  WCHAR* ValName = HeapAlloc(GetProcessHeap(), 0, ++max_val_name_len * sizeof(WCHAR));
702  DWORD dwValNameLen = max_val_name_len;
703  BYTE* ValBuf = HeapAlloc(GetProcessHeap(), 0, max_val_size + sizeof(WCHAR));
704  DWORD dwValSize = max_val_size;
705  DWORD dwIndex = 0L;
706  DWORD dwValType;
707  /* if (RegQueryValueExW(hNewKey, NULL, NULL, &dwValType, ValBuf, &dwValSize) == ERROR_SUCCESS) { */
708  /* AddEntryToList(hwndLV, L"(Default)", dwValType, ValBuf, dwValSize); */
709  /* } */
710  /* dwValSize = max_val_size; */
711  while (RegEnumValueW(hNewKey, dwIndex, ValName, &dwValNameLen, NULL, &dwValType, ValBuf, &dwValSize) == ERROR_SUCCESS)
712  {
713  /* Add a terminating 0 character. Usually this is only necessary for strings. */
714  ValBuf[dwValSize] = ValBuf[dwValSize + 1] = 0;
715 
716  AddEntryToList(hwndLV, ValName, dwValType, ValBuf, dwValSize, -1, TRUE);
717  dwValNameLen = max_val_name_len;
718  dwValSize = max_val_size;
719  dwValType = 0L;
720  ++dwIndex;
721  if(!wcscmp(ValName, L""))
722  {
723  AddedDefault = TRUE;
724  }
725  }
726  HeapFree(GetProcessHeap(), 0, ValBuf);
727  HeapFree(GetProcessHeap(), 0, ValName);
728  }
729  RegCloseKey(hNewKey);
730 
731  if(!AddedDefault)
732  {
733  AddEntryToList(hwndLV, L"", REG_SZ, NULL, 0, 0, FALSE);
734  }
735  c = ListView_GetItemCount(hwndLV);
736  for(i = 0; i < c; i++)
737  {
739  }
743  (void)ListView_Sort(hwndLV, g_iSortedColumn, -1);
744  SendMessageW(hwndLV, WM_SETREDRAW, TRUE, 0);
745 
746  return TRUE;
747 }
#define TRUE
Definition: types.h:120
void DestroyListView(HWND hwndLV)
Definition: listview.c:653
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:47
#define ERROR_SUCCESS
Definition: deptool.c:10
INT iListViewSelect
Definition: listview.c:29
#define KEY_READ
Definition: nt_native.h:1023
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WM_SETREDRAW
Definition: winuser.h:1598
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: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
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define ListView_SetItemState(hwndLV, i, data, mask)
Definition: commctrl.h:2645
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:2867
smooth NULL
Definition: ftsmooth.c:416
#define LVIS_SELECTED
Definition: commctrl.h:2291
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2279
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
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:3704
static const WCHAR L[]
Definition: oid.c:1250
unsigned char BYTE
Definition: mem.h:68
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:479
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define c
Definition: ke_i.h:80
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
#define HeapFree(x, y, z)
Definition: compat.h:394
#define LVIS_FOCUSED
Definition: commctrl.h:2290
#define ListView_EditLabel(hwndLV, i)
Definition: commctrl.h:2512
#define ListView_DeleteAllItems(hwnd)
Definition: commctrl.h:2386
#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: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
#define ListView_SetItemState(hwndLV, i, data, mask)
Definition: commctrl.h:2645
smooth NULL
Definition: ftsmooth.c:416
#define LVIS_SELECTED
Definition: commctrl.h:2291
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2279
LPCWSTR psz
Definition: commctrl.h:2429
const GLubyte * c
Definition: glext.h:8905
#define LVFI_STRING
Definition: commctrl.h:2409
#define ListView_FindItem(hwnd, iStart, plvfi)
Definition: commctrl.h:2442
#define c
Definition: ke_i.h:80
#define LVIS_FOCUSED
Definition: commctrl.h:2290

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] = { 200, 175, 400 }
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().