ReactOS  0.4.15-dev-5462-g4d0d22a
main.h File Reference
#include "resource.h"
Include dependency graph for main.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ChildWnd
 

Macros

#define STATUS_WINDOW   2001
 
#define TREE_WINDOW   2002
 
#define LIST_WINDOW   2003
 
#define SPLIT_WIDTH   5
 
#define SPLIT_MIN   30
 
#define ARRAY_SIZE(A)   (sizeof(A)/sizeof(*A))
 
#define PM_MODIFYVALUE   0
 
#define PM_NEW   1
 
#define PM_TREECONTEXT   2
 
#define PM_ROOTITEM   3
 
#define PM_HEXEDIT   4
 
#define MAX_NEW_KEY_LEN   128
 
#define KEY_MAX_LEN   1024
 
#define REG_FORMAT_5   1
 
#define REG_FORMAT_4   2
 

Enumerations

enum  OPTION_FLAGS {
  OPTIONS_AUTO_REFRESH = 0x01, OPTIONS_READ_ONLY_MODE = 0x02, OPTIONS_CONFIRM_ON_DELETE = 0x04, OPTIONS_SAVE_ON_EXIT = 0x08,
  OPTIONS_DISPLAY_BINARY_DATA = 0x10, OPTIONS_VIEW_TREE_ONLY = 0x20, OPTIONS_VIEW_DATA_ONLY = 0x40
}
 

Functions

void ShowAboutBox (HWND hWnd)
 
LRESULT CALLBACK ChildWndProc (HWND, UINT, WPARAM, LPARAM)
 
void ResizeWnd (int cx, int cy)
 
LPCWSTR get_root_key_name (HKEY hRootKey)
 
VOID UpdateAddress (HTREEITEM hItem, HKEY hRootKey, LPCWSTR pszPath)
 
BOOL ModifyValue (HWND hwnd, HKEY hKey, LPCWSTR valueName, BOOL EditBin)
 
BOOL DeleteKey (HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath)
 
LONG RenameKey (HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpNewName)
 
LONG RenameValue (HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpDestValue, LPCWSTR lpSrcValue)
 
LONG QueryStringValue (HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpValueName, LPWSTR pszBuffer, DWORD dwBufferLen)
 
BOOL GetKeyName (LPWSTR pszDest, size_t iDestLength, HKEY hRootKey, LPCWSTR lpSubKey)
 
int ErrorMessageBox (HWND hWnd, LPCWSTR lpTitle, DWORD dwErrorCode,...)
 
int InfoMessageBox (HWND hWnd, UINT uType, LPCWSTR lpTitle, LPCWSTR lpMessage,...)
 
void FindDialog (HWND hWnd)
 
BOOL FindNext (HWND hWnd)
 
void FindNextMessageBox (HWND hWnd)
 
LRESULT CALLBACK FrameWndProc (HWND, UINT, WPARAM, LPARAM)
 
void SetupStatusBar (HWND hWnd, BOOL bResize)
 
void UpdateStatusBar (void)
 
BOOL CopyKeyName (HWND hWnd, HKEY hRootKey, LPCWSTR keyName)
 
BOOL ExportRegistryFile (HWND hWnd)
 
HWND CreateListView (HWND hwndParent, HMENU id, INT cx)
 
BOOL RefreshListView (HWND hwndLV, HKEY hKey, LPCWSTR keyPath)
 
WCHARGetValueName (HWND hwndLV, int iStartAt)
 
BOOL ListWndNotifyProc (HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result)
 
BOOL TreeWndNotifyProc (HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result)
 
BOOL IsDefaultValue (HWND hwndLV, int i)
 
void WINAPIV output_message (unsigned int id,...)
 
void WINAPIV error_exit (unsigned int id,...)
 
charGetMultiByteString (const WCHAR *strW)
 
BOOL import_registry_file (FILE *reg_file)
 
void delete_registry_key (WCHAR *reg_key_name)
 
BOOL export_registry_key (WCHAR *file_name, WCHAR *path, DWORD format)
 
BOOL RegKeyEditPermissions (HWND hWndOwner, HKEY hKey, LPCWSTR lpMachine, LPCWSTR lpKeyName)
 
void LoadSettings (void)
 
void SaveSettings (void)
 
HWND CreateTreeView (HWND hwndParent, LPWSTR pHostName, HMENU id)
 
BOOL RefreshTreeView (HWND hWndTV)
 
BOOL RefreshTreeItem (HWND hwndTV, HTREEITEM hItem)
 
BOOL OnTreeExpanding (HWND hWnd, NMTREEVIEW *pnmtv)
 
LPCWSTR GetItemPath (HWND hwndTV, HTREEITEM hItem, HKEY *phRootKey)
 
BOOL DeleteNode (HWND hwndTV, HTREEITEM hItem)
 
HTREEITEM InsertNode (HWND hwndTV, HTREEITEM hItem, LPWSTR name)
 
HWND StartKeyRename (HWND hwndTV)
 
BOOL CreateNewKey (HWND hwndTV, HTREEITEM hItem)
 
BOOL SelectNode (HWND hwndTV, LPCWSTR keyPath)
 
void DestroyTreeView (HWND hwndTV)
 
void DestroyListView (HWND hwndLV)
 
void DestroyMainMenu (void)
 

Variables

ChildWndg_pChildWnd
 
HINSTANCE hInst
 
HWND hFrameWnd
 
HMENU hMenuFrame
 
HWND hStatusBar
 
HMENU hPopupMenus
 
HFONT hFont
 
enum OPTION_FLAGS Options
 
WCHAR szTitle []
 
WCHAR szFrameClass []
 
WCHAR szChildClass []
 
const WCHAR g_szGeneralRegKey []
 
const WCHARreg_class_namesW []
 

Macro Definition Documentation

◆ ARRAY_SIZE

#define ARRAY_SIZE (   A)    (sizeof(A)/sizeof(*A))

Definition at line 33 of file main.h.

◆ KEY_MAX_LEN

#define KEY_MAX_LEN   1024

Definition at line 42 of file main.h.

◆ LIST_WINDOW

#define LIST_WINDOW   2003

Definition at line 28 of file main.h.

◆ MAX_NEW_KEY_LEN

#define MAX_NEW_KEY_LEN   128

Definition at line 41 of file main.h.

◆ PM_HEXEDIT

#define PM_HEXEDIT   4

Definition at line 39 of file main.h.

◆ PM_MODIFYVALUE

#define PM_MODIFYVALUE   0

Definition at line 35 of file main.h.

◆ PM_NEW

#define PM_NEW   1

Definition at line 36 of file main.h.

◆ PM_ROOTITEM

#define PM_ROOTITEM   3

Definition at line 38 of file main.h.

◆ PM_TREECONTEXT

#define PM_TREECONTEXT   2

Definition at line 37 of file main.h.

◆ REG_FORMAT_4

#define REG_FORMAT_4   2

Definition at line 45 of file main.h.

◆ REG_FORMAT_5

#define REG_FORMAT_5   1

Definition at line 44 of file main.h.

◆ SPLIT_MIN

#define SPLIT_MIN   30

Definition at line 31 of file main.h.

◆ SPLIT_WIDTH

#define SPLIT_WIDTH   5

Definition at line 30 of file main.h.

◆ STATUS_WINDOW

#define STATUS_WINDOW   2001

Definition at line 26 of file main.h.

◆ TREE_WINDOW

#define TREE_WINDOW   2002

Definition at line 27 of file main.h.

Enumeration Type Documentation

◆ OPTION_FLAGS

Enumerator
OPTIONS_AUTO_REFRESH 
OPTIONS_READ_ONLY_MODE 
OPTIONS_CONFIRM_ON_DELETE 
OPTIONS_SAVE_ON_EXIT 
OPTIONS_DISPLAY_BINARY_DATA 
OPTIONS_VIEW_TREE_ONLY 
OPTIONS_VIEW_DATA_ONLY 

Definition at line 49 of file main.h.

Function Documentation

◆ ChildWndProc()

LRESULT CALLBACK ChildWndProc ( HWND  ,
UINT  ,
WPARAM  ,
LPARAM   
)

Definition at line 301 of file childwnd.c.

302 {
303  BOOL Result;
304  RECT rc;
305 
306  switch (message)
307  {
308  case WM_CREATE:
309  {
310  WNDPROC oldproc;
311  HFONT hFont;
313  DWORD style;
314 
315  /* Load "My Computer" string */
317 
319  if (!g_pChildWnd) return 0;
320 
322  g_pChildWnd->nSplitPos = 190;
323  g_pChildWnd->hWnd = hWnd;
324 
328  hWnd, (HMENU)0, hInst, 0);
329 
332  g_pChildWnd->hAddressBtnWnd = CreateWindowExW(0, L"Button", L"\x00BB", style,
334  hWnd, (HMENU)0, hInst, 0);
336  IMAGE_ICON, 12, 12, 0);
338 
339  GetClientRect(hWnd, &rc);
343 
344  /* set the address bar and button font */
346  {
349  WM_SETFONT,
350  (WPARAM)hFont,
351  0);
353  WM_SETFONT,
354  (WPARAM)hFont,
355  0);
356  }
357  /* Subclass the AddressBar */
361  break;
362  }
363  case WM_COMMAND:
364  if(HIWORD(wParam) == BN_CLICKED)
365  {
367  }
368  break; //goto def;
369  case WM_SETCURSOR:
370  if (LOWORD(lParam) == HTCLIENT)
371  {
372  POINT pt;
373  GetCursorPos(&pt);
376  {
378  return TRUE;
379  }
380  }
381  goto def;
382  case WM_DESTROY:
385  DestroyMainMenu();
387  free(g_pChildWnd);
388  g_pChildWnd = NULL;
389  PostQuitMessage(0);
390  break;
391  case WM_LBUTTONDOWN:
392  {
393  RECT rt;
394  int x = (short)LOWORD(lParam);
395  GetClientRect(hWnd, &rt);
397  {
400  SetCapture(hWnd);
401  }
402  break;
403  }
404 
405  case WM_LBUTTONUP:
406  case WM_RBUTTONDOWN:
407  if (GetCapture() == hWnd)
408  {
410  }
411  break;
412 
413  case WM_CAPTURECHANGED:
414  if (GetCapture()==hWnd && last_split>=0)
416  break;
417 
418  case WM_KEYDOWN:
419  if (wParam == VK_ESCAPE)
420  if (GetCapture() == hWnd)
421  {
422  RECT rt;
424  GetClientRect(hWnd, &rt);
425  ResizeWnd(rt.right, rt.bottom);
426  last_split = -1;
427  ReleaseCapture();
429  }
430  break;
431 
432  case WM_MOUSEMOVE:
433  if (GetCapture() == hWnd)
434  {
435  HDC hdc;
436  RECT rt;
437  HGDIOBJ OldObj;
438  int x = LOWORD(lParam);
439  if(!SizingPattern)
440  {
441  const DWORD Pattern[4] = {0x5555AAAA, 0x5555AAAA, 0x5555AAAA, 0x5555AAAA};
442  SizingPattern = CreateBitmap(8, 8, 1, 1, Pattern);
443  }
444  if(!SizingBrush)
445  {
447  }
448 
449  GetClientRect(hWnd, &rt);
450  x = (SHORT) min(max(x, SPLIT_MIN), rt.right - SPLIT_MIN);
451  if(last_split != x)
452  {
453  rt.left = last_split-SPLIT_WIDTH/2;
454  rt.right = last_split+SPLIT_WIDTH/2+1;
455  hdc = GetDC(hWnd);
456  OldObj = SelectObject(hdc, SizingBrush);
457  PatBlt(hdc, rt.left, rt.top, rt.right - rt.left, rt.bottom - rt.top, PATINVERT);
458  last_split = x;
459  rt.left = x-SPLIT_WIDTH/2;
460  rt.right = x+SPLIT_WIDTH/2+1;
461  PatBlt(hdc, rt.left, rt.top, rt.right - rt.left, rt.bottom - rt.top, PATINVERT);
462  SelectObject(hdc, OldObj);
463  ReleaseDC(hWnd, hdc);
464  }
465  }
466  break;
467 
468  case WM_SETFOCUS:
469  if (g_pChildWnd != NULL)
470  {
472  }
473  break;
474 
475  case WM_TIMER:
476  break;
477 
478  case WM_NOTIFY:
479  if (g_pChildWnd == NULL) break;
480 
481  if (((LPNMHDR)lParam)->idFrom == TREE_WINDOW)
482  {
484  {
485  goto def;
486  }
487 
488  return Result;
489  }
490  else
491  {
492  if (((LPNMHDR)lParam)->idFrom == LIST_WINDOW)
493  {
495  {
496  goto def;
497  }
498 
499  return Result;
500  }
501  else
502  {
503  goto def;
504  }
505  }
506  break;
507 
508  case WM_CONTEXTMENU:
509  {
510  POINT pt;
512  {
513  int i, cnt;
514  BOOL IsDefault;
515  pt.x = (short) LOWORD(lParam);
516  pt.y = (short) HIWORD(lParam);
519  if (pt.x == -1 && pt.y == -1)
520  {
521  RECT rc;
522  if (i != -1)
523  {
524  rc.left = LVIR_BOUNDS;
526  pt.x = rc.left + 8;
527  pt.y = rc.top + 8;
528  }
529  else
530  pt.x = pt.y = 0;
532  }
533  if(i == -1)
534  {
536  }
537  else
538  {
541  IsDefault = IsDefaultValue(g_pChildWnd->hListWnd, i);
542  if(cnt == 1)
544  else
548 
550  }
551  }
552  else if ((HWND)wParam == g_pChildWnd->hTreeWnd)
553  {
554  TVHITTESTINFO hti;
555  HMENU hContextMenu;
556  TVITEMW item;
557  MENUITEMINFOW mii;
558  WCHAR resource[256];
559  WCHAR buffer[256];
560  LPWSTR s;
561  LPCWSTR keyPath;
562  HKEY hRootKey;
563  int iLastPos;
564  WORD wID;
565  BOOL isRoot;
566 
567  pt.x = (short) LOWORD(lParam);
568  pt.y = (short) HIWORD(lParam);
569 
570  if (pt.x == -1 && pt.y == -1)
571  {
572  RECT rc;
574  if (hti.hItem != NULL)
575  {
577  pt.x = rc.left + 8;
578  pt.y = rc.top + 8;
580  hti.flags = TVHT_ONITEM;
581  }
582  else
583  hti.flags = 0;
584  }
585  else
586  {
587  hti.pt.x = pt.x;
588  hti.pt.y = pt.y;
591  }
592 
593  if (hti.flags & TVHT_ONITEM)
594  {
596 
597  isRoot = (TreeView_GetParent(g_pChildWnd->hTreeWnd, hti.hItem) == NULL);
598  hContextMenu = GetSubMenu(hPopupMenus, isRoot ? PM_ROOTITEM : PM_TREECONTEXT);
599 
600  memset(&item, 0, sizeof(item));
601  item.mask = TVIF_STATE | TVIF_CHILDREN;
602  item.hItem = hti.hItem;
604 
605  /* Set the Expand/Collapse menu item appropriately */
607  memset(&mii, 0, sizeof(mii));
608  mii.cbSize = sizeof(mii);
610  mii.fState = (item.cChildren > 0) ? MFS_DEFAULT : MFS_GRAYED;
612  mii.dwTypeData = (LPWSTR) buffer;
613  SetMenuItemInfo(hContextMenu, 0, TRUE, &mii);
614 
615  if (isRoot == FALSE)
616  {
617  /* Remove any existing suggestions */
618  memset(&mii, 0, sizeof(mii));
619  mii.cbSize = sizeof(mii);
620  mii.fMask = MIIM_ID;
621  GetMenuItemInfo(hContextMenu, GetMenuItemCount(hContextMenu) - 1, TRUE, &mii);
622  if ((mii.wID >= ID_TREE_SUGGESTION_MIN) && (mii.wID <= ID_TREE_SUGGESTION_MAX))
623  {
624  do
625  {
626  iLastPos = GetMenuItemCount(hContextMenu) - 1;
627  GetMenuItemInfo(hContextMenu, iLastPos, TRUE, &mii);
628  RemoveMenu(hContextMenu, iLastPos, MF_BYPOSITION);
629  }
630  while((mii.wID >= ID_TREE_SUGGESTION_MIN) && (mii.wID <= ID_TREE_SUGGESTION_MAX));
631  }
632 
633  /* Come up with suggestions */
634  keyPath = GetItemPath(g_pChildWnd->hTreeWnd, NULL, &hRootKey);
635  SuggestKeys(hRootKey, keyPath, Suggestions, ARRAY_SIZE(Suggestions));
636  if (Suggestions[0])
637  {
638  AppendMenu(hContextMenu, MF_SEPARATOR, 0, NULL);
639 
641 
642  s = Suggestions;
644  while(*s && (wID <= ID_TREE_SUGGESTION_MAX))
645  {
647 
648  memset(&mii, 0, sizeof(mii));
649  mii.cbSize = sizeof(mii);
650  mii.fMask = MIIM_STRING | MIIM_ID;
651  mii.wID = wID++;
652  mii.dwTypeData = buffer;
653  InsertMenuItem(hContextMenu, GetMenuItemCount(hContextMenu), TRUE, &mii);
654 
655  s += wcslen(s) + 1;
656  }
657  }
658  }
659  TrackPopupMenu(hContextMenu, TPM_RIGHTBUTTON, pt.x, pt.y, 0, hFrameWnd/*g_pChildWnd->hWnd*/, NULL);
660  }
661  }
662  break;
663  }
664 
665  case WM_SIZE:
666  if (wParam != SIZE_MINIMIZED && g_pChildWnd != NULL)
667  {
669  }
670  /* fall through */
671  default:
672 def:
674  }
675  return 0;
676 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define IDC_SIZEWE
Definition: winuser.h:689
#define IDS_GOTO_SUGGESTED_KEY
Definition: resource.h:192
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2434
#define max(a, b)
Definition: svc.c:63
#define PM_ROOTITEM
Definition: main.h:38
Definition: tftpd.h:59
static HICON
Definition: imagelist.c:84
#define MF_DISABLED
Definition: winuser.h:130
void DestroyListView(HWND hwndLV)
Definition: listview.c:654
#define IMAGE_ICON
Definition: winuser.h:212
#define ID_TREE_COLLAPSEBRANCH
Definition: resource.h:95
ChildWnd * g_pChildWnd
Definition: childwnd.c:23
#define TreeView_GetItemRect(hwnd, hitem, prc, code)
Definition: commctrl.h:3429
#define PATINVERT
Definition: wingdi.h:328
#define MF_BYCOMMAND
Definition: winuser.h:202
static void SuggestKeys(HKEY hRootKey, LPCWSTR pszKeyPath, LPWSTR pszSuggestions, size_t iSuggestionsLength)
Definition: childwnd.c:139
long y
Definition: polytest.cpp:48
#define WM_CONTEXTMENU
Definition: richedit.h:64
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
#define WM_LBUTTONDOWN
Definition: winuser.h:1766
LRESULT CALLBACK AddressBarProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: childwnd.c:210
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
long x
Definition: polytest.cpp:48
static void finish_splitbar(HWND hWnd, int x)
Definition: childwnd.c:120
BOOL TreeWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result)
Definition: treeview.c:630
HDC WINAPI GetDC(_In_opt_ HWND)
#define PM_MODIFYVALUE
Definition: main.h:35
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define TRUE
Definition: types.h:120
#define pt(x, y)
Definition: drawing.c:79
#define free
Definition: debug_ros.c:5
HWND hTreeWnd
Definition: main.h:63
#define WM_CAPTURECHANGED
Definition: winuser.h:1798
HWND hListWnd
Definition: main.h:64
static HDC
Definition: imagelist.c:92
#define BS_DEFPUSHBUTTON
Definition: pedump.c:652
HWND hWnd
Definition: settings.c:17
LONG top
Definition: windef.h:307
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
GLuint buffer
Definition: glext.h:5915
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HWND WINAPI SetFocus(_In_opt_ HWND)
LPWSTR dwTypeData
Definition: winuser.h:3259
#define LVNI_SELECTED
Definition: commctrl.h:2424
UINT_PTR WPARAM
Definition: windef.h:207
#define WS_CHILD
Definition: pedump.c:617
LONG left
Definition: windef.h:306
#define MFS_DEFAULT
Definition: winuser.h:743
#define VK_ESCAPE
Definition: winuser.h:2204
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2639
#define BS_CENTER
Definition: winuser.h:260
LONG right
Definition: windef.h:308
#define BM_SETIMAGE
Definition: winuser.h:1912
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define VK_RETURN
Definition: winuser.h:2191
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
#define SPLIT_WIDTH
Definition: eventvwr.c:45
HFONT hFont
Definition: main.c:53
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HBITMAP SizingPattern
Definition: childwnd.c:25
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
int nSplitPos
Definition: main.h:69
#define TPM_RIGHTBUTTON
Definition: winuser.h:2370
#define L(x)
Definition: ntvdm.h:50
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define ListView_GetSelectedCount(hwndLV)
Definition: commctrl.h:2709
#define TVIF_CHILDREN
Definition: commctrl.h:3272
#define FALSE
Definition: types.h:117
#define ID_TREE_SUGGESTION_MIN
Definition: resource.h:156
#define MIIM_STATE
Definition: winuser.h:716
unsigned int BOOL
Definition: ntddk_ex.h:94
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
#define WM_SETCURSOR
Definition: winuser.h:1626
short SHORT
Definition: pedump.c:59
#define MF_BYPOSITION
Definition: winuser.h:203
BOOL IsDefaultValue(HWND hwndLV, int i)
Definition: listview.c:107
HWND WINAPI GetCapture(void)
Definition: message.c:2881
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define TREE_WINDOW
Definition: main.h:27
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
#define CW_USEDEFAULT
Definition: winuser.h:225
#define GWLP_USERDATA
Definition: treelist.c:63
static void draw_splitbar(HWND hWnd, int x)
Definition: childwnd.c:90
int _snwprintf(wchar_t *buffer, size_t count, const wchar_t *format,...)
_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
#define WM_KEYDOWN
Definition: winuser.h:1705
#define MF_SEPARATOR
Definition: winuser.h:137
WCHAR Suggestions[256]
Definition: childwnd.c:27
LONG_PTR LPARAM
Definition: windef.h:208
#define SPLIT_MIN
Definition: main.h:31
#define LVNI_FOCUSED
Definition: commctrl.h:2423
#define ID_EDIT_RENAME
Definition: resource.h:58
LPCWSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY *phRootKey)
Definition: treeview.c:88
#define WM_DESTROY
Definition: winuser.h:1599
HTREEITEM hItem
Definition: commctrl.h:3521
#define MIIM_ID
Definition: winuser.h:717
#define WM_RBUTTONDOWN
Definition: winuser.h:1769
#define GetMenuItemInfo
Definition: winuser.h:5778
HBRUSH WINAPI CreatePatternBrush(_In_ HBITMAP)
#define SetMenuItemInfo
Definition: winuser.h:5840
BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result)
Definition: listview.c:544
WCHAR szPath[MAX_PATH]
Definition: main.h:71
#define ID_TREE_SUGGESTION_MAX
Definition: resource.h:157
static VOID DestroyTreeView(HWND hTreeView)
#define TreeView_GetSelection(hwnd)
Definition: commctrl.h:3473
#define AppendMenu
Definition: winuser.h:5721
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define TreeView_HitTest(hwnd, lpht)
Definition: commctrl.h:3513
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WM_SIZE
Definition: winuser.h:1601
static int last_split
Definition: childwnd.c:24
HMENU hPopupMenus
Definition: main.c:38
void DestroyMainMenu()
Definition: main.c:164
HWND hWnd
Definition: main.h:62
#define WM_TIMER
Definition: winuser.h:1732
#define MF_ENABLED
Definition: winuser.h:128
#define IDI_ARROW
Definition: resource.h:37
#define MAX_PATH
Definition: compat.h:34
#define PM_TREECONTEXT
Definition: main.h:37
#define WM_KEYUP
Definition: winuser.h:1706
unsigned short WORD
Definition: ntddk_ex.h:93
#define BN_CLICKED
Definition: winuser.h:1915
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDS_MY_COMPUTER
Definition: resource.h:129
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
#define SIZE_MINIMIZED
Definition: winuser.h:2496
HWND CreateTreeView(HWND hwndParent, LPWSTR pHostName, HMENU id)
Definition: treeview.c:740
HWND hAddressBtnWnd
Definition: main.h:66
#define DEFAULT_GUI_FONT
Definition: wingdi.h:909
HICON hArrowIcon
Definition: main.h:67
void ResizeWnd(int cx, int cy)
Definition: childwnd.c:41
#define BS_ICON
Definition: winuser.h:264
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)
HDC hdc
Definition: main.c:9
#define MFS_GRAYED
Definition: winuser.h:746
GLdouble s
Definition: gl.h:2039
#define TreeView_GetParent(hwnd, hitem)
Definition: commctrl.h:3469
#define WS_TABSTOP
Definition: pedump.c:634
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define WM_COMMAND
Definition: winuser.h:1730
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define BS_VCENTER
Definition: winuser.h:279
#define LVM_GETITEMRECT
Definition: commctrl.h:2477
#define GWLP_WNDPROC
Definition: treelist.c:66
#define TVIS_EXPANDED
Definition: commctrl.h:3284
#define BS_FLAT
Definition: winuser.h:280
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2896
#define ID_EDIT_MODIFY
Definition: resource.h:62
#define MIIM_STRING
Definition: winuser.h:722
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND hFrameWnd
Definition: main.c:35
HWND WINAPI SetCapture(_In_ HWND hWnd)
#define LVIR_BOUNDS
Definition: commctrl.h:2472
HINSTANCE hInst
Definition: dxdiag.c:13
static ATOM item
Definition: dde.c:856
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
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
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define ARRAY_SIZE(a)
Definition: main.h:24
#define TreeView_SelectItem(hwnd, hitem)
Definition: commctrl.h:3481
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_LBUTTONUP
Definition: winuser.h:1767
#define PM_NEW
Definition: main.h:36
#define ID_TREE_EXPANDBRANCH
Definition: resource.h:93
#define min(a, b)
Definition: monoChain.cc:55
#define WM_MOUSEMOVE
Definition: winuser.h:1765
#define NULL
Definition: types.h:112
BOOL CreateListView(PMAIN_WND_INFO Info)
Definition: listview.c:355
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
BOOL WINAPI SetMenuDefaultItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define WM_SETFONT
Definition: winuser.h:1640
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define IDC_ARROW
Definition: winuser.h:682
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
HWND hAddressBarWnd
Definition: main.h:65
Definition: main.h:60
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_CREATE
Definition: winuser.h:1598
#define LIST_WINDOW
Definition: main.h:28
#define HIWORD(l)
Definition: typedefs.h:247
LONG bottom
Definition: windef.h:309
#define TVIF_STATE
Definition: commctrl.h:3269
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define GetWindowLongPtr
Definition: treelist.c:73
#define WM_SETFOCUS
Definition: winuser.h:1603
#define MF_GRAYED
Definition: winuser.h:129
#define HTCLIENT
Definition: winuser.h:2465
WCHAR * LPWSTR
Definition: xmlstorage.h:184
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
#define IDS_COLLAPSE
Definition: resource.h:189
#define IDS_EXPAND
Definition: resource.h:188
#define TVHT_ONITEM
Definition: commctrl.h:3527
Arabic default style
Definition: afstyles.h:93
#define WS_VISIBLE
Definition: pedump.c:620
#define ID_EDIT_MODIFY_BIN
Definition: resource.h:122
#define memset(x, y, z)
Definition: compat.h:39
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
LPARAM lParam
Definition: combotst.c:139
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
#define LOWORD(l)
Definition: pedump.c:82
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define TreeView_GetItem(hwnd, pitem)
Definition: commctrl.h:3490
#define WM_NOTIFY
Definition: richedit.h:61
#define InsertMenuItem
Definition: winuser.h:5794
int nFocusPanel
Definition: main.h:68
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
HBRUSH SizingBrush
Definition: childwnd.c:26

◆ CopyKeyName()

BOOL CopyKeyName ( HWND  hWnd,
HKEY  hRootKey,
LPCWSTR  keyName 
)

Definition at line 784 of file framewnd.c.

785 {
786  BOOL bClipboardOpened = FALSE;
787  BOOL bSuccess = FALSE;
788  WCHAR szBuffer[512];
789  HGLOBAL hGlobal;
790  LPWSTR s;
791 
792  if (!OpenClipboard(hWnd))
793  goto done;
794  bClipboardOpened = TRUE;
795 
796  if (!EmptyClipboard())
797  goto done;
798 
799  if (!GetKeyName(szBuffer, ARRAY_SIZE(szBuffer), hRootKey, keyName))
800  goto done;
801 
802  hGlobal = GlobalAlloc(GMEM_MOVEABLE, (wcslen(szBuffer) + 1) * sizeof(WCHAR));
803  if (!hGlobal)
804  goto done;
805 
806  s = GlobalLock(hGlobal);
807  wcscpy(s, szBuffer);
808  GlobalUnlock(hGlobal);
809 
811  bSuccess = TRUE;
812 
813 done:
814  if (bClipboardOpened)
815  CloseClipboard();
816  return bSuccess;
817 }
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
HANDLE WINAPI SetClipboardData(_In_ UINT, _In_opt_ HANDLE)
static BOOLEAN bSuccess
Definition: drive.cpp:433
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CF_UNICODETEXT
Definition: constants.h:408
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
GLdouble s
Definition: gl.h:2039
#define ARRAY_SIZE(a)
Definition: main.h:24
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
BOOL WINAPI OpenClipboard(_In_opt_ HWND)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define GMEM_MOVEABLE
Definition: winbase.h:294
BOOL GetKeyName(LPWSTR pszDest, size_t iDestLength, HKEY hRootKey, LPCWSTR lpSubKey)
Definition: edit.c:1588

Referenced by _CmdWndProc().

◆ 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

◆ CreateNewKey()

BOOL CreateNewKey ( HWND  hwndTV,
HTREEITEM  hItem 
)

Definition at line 573 of file treeview.c.

574 {
575  WCHAR szNewKeyFormat[128];
576  WCHAR szNewKey[128];
577  LPCWSTR pszKeyPath;
578  int iIndex = 1;
579  LONG nResult;
580  HKEY hRootKey = NULL, hKey = NULL, hNewKey = NULL;
581  BOOL bSuccess = FALSE;
582  DWORD dwDisposition;
583  HTREEITEM hNewItem;
584 
585  pszKeyPath = GetItemPath(hwndTV, hItem, &hRootKey);
586  if (pszKeyPath[0] == L'\0')
587  hKey = hRootKey;
588  else if (RegOpenKeyW(hRootKey, pszKeyPath, &hKey) != ERROR_SUCCESS)
589  goto done;
590 
591  if (LoadStringW(hInst, IDS_NEW_KEY, szNewKeyFormat, ARRAY_SIZE(szNewKeyFormat)) <= 0)
592  goto done;
593 
594  /* Need to create a new key with a unique name */
595  do
596  {
597  wsprintf(szNewKey, szNewKeyFormat, iIndex++);
598  nResult = RegCreateKeyExW(hKey, szNewKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hNewKey, &dwDisposition);
599  if (hNewKey && dwDisposition == REG_OPENED_EXISTING_KEY)
600  {
601  RegCloseKey(hNewKey);
602  hNewKey = NULL;
603  }
604  else if (!hNewKey)
605  {
606  InfoMessageBox(hFrameWnd, MB_OK | MB_ICONERROR, NULL, L"Cannot create new key!\n\nError Code: %d", nResult);
607  goto done;
608  }
609  }
610  while(!hNewKey);
611 
612  /* Insert the new key */
613  hNewItem = InsertNode(hwndTV, hItem, szNewKey);
614  if (!hNewItem)
615  goto done;
616 
617  /* The new key's name is probably not appropriate yet */
618  (void)TreeView_EditLabel(hwndTV, hNewItem);
619 
620  bSuccess = TRUE;
621 
622 done:
623  if (hKey != hRootKey && hKey)
624  RegCloseKey(hKey);
625  if (hNewKey)
626  RegCloseKey(hNewKey);
627  return bSuccess;
628 }
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 TreeView_EditLabel(hwnd, hitem)
Definition: commctrl.h:3504
int InfoMessageBox(HWND hWnd, UINT uType, LPCWSTR lpTitle, LPCWSTR lpMessage,...)
Definition: error.c:51
#define REG_OPENED_EXISTING_KEY
Definition: nt_native.h:1085
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
static BOOLEAN bSuccess
Definition: drive.cpp:433
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
#define IDS_NEW_KEY
Definition: resource.h:190
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPWSTR name)
Definition: treeview.c:336
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3291
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_WRITE
Definition: nt_native.h:1031
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define MB_ICONERROR
Definition: winuser.h:781
LPCWSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY *phRootKey)
Definition: treeview.c:88
HWND hFrameWnd
Definition: main.c:35
HINSTANCE hInst
Definition: dxdiag.c:13
FxAutoRegKey hKey
#define ARRAY_SIZE(a)
Definition: main.h:24
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
#define wsprintf
Definition: winuser.h:5855
#define RegCloseKey(hKey)
Definition: registry.h:47

Referenced by _CmdWndProc().

◆ CreateTreeView()

HWND CreateTreeView ( HWND  hwndParent,
LPWSTR  pHostName,
HMENU  id 
)

Definition at line 740 of file treeview.c.

741 {
742  RECT rcClient;
743  HWND hwndTV;
744 
745  /* Get the dimensions of the parent window's client area, and create the tree view control. */
746  GetClientRect(hwndParent, &rcClient);
749  0, 0, rcClient.right, rcClient.bottom,
750  hwndParent, id, hInst, NULL);
751  if (!hwndTV) return NULL;
752 
753  /* Initialize the image list, and add items to the control. */
754  if (!InitTreeViewImageLists(hwndTV) || !InitTreeViewItems(hwndTV, pHostName))
755  {
756  DestroyWindow(hwndTV);
757  return NULL;
758  }
759  return hwndTV;
760 }
static BOOL InitTreeViewItems(HWND hwndTV, LPWSTR pHostName)
Definition: treeview.c:396
#define TVS_LINESATROOT
Definition: commctrl.h:3249
#define WS_CHILD
Definition: pedump.c:617
LONG right
Definition: windef.h:308
BOOL WINAPI DestroyWindow(_In_ HWND)
#define TVS_HASBUTTONS
Definition: commctrl.h:3247
static HWND hwndParent
Definition: cryptui.c:300
#define WC_TREEVIEW
Definition: commctrl.h:3245
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)
static BOOL InitTreeViewImageLists(HWND hwndTV)
Definition: treeview.c:443
HINSTANCE hInst
Definition: dxdiag.c:13
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define NULL
Definition: types.h:112
#define TVS_SHOWSELALWAYS
Definition: commctrl.h:3252
#define TVS_HASLINES
Definition: commctrl.h:3248
LONG bottom
Definition: windef.h:309
#define WS_VISIBLE
Definition: pedump.c:620
#define TVS_EDITLABELS
Definition: commctrl.h:3250

Referenced by ChildWndProc().

◆ delete_registry_key()

void delete_registry_key ( WCHAR reg_key_name)

Definition at line 1097 of file regproc.c.

1098 {
1099  WCHAR *key_name = NULL;
1100  HKEY key_class;
1101 
1102  if (!reg_key_name || !reg_key_name[0])
1103  return;
1104 
1105  if (!(key_class = parse_key_name(reg_key_name, &key_name)))
1106  {
1107  if (key_name) *(key_name - 1) = 0;
1108  error_exit(STRING_INVALID_SYSTEM_KEY, reg_key_name);
1109  }
1110 
1111  if (!key_name || !*key_name)
1112  error_exit(STRING_DELETE_FAILED, reg_key_name);
1113 
1114 #ifdef __REACTOS__
1115  SHDeleteKey(key_class, key_name);
1116 #else
1117  RegDeleteTreeW(key_class, key_name);
1118 #endif
1119 }
#define STRING_INVALID_SYSTEM_KEY
Definition: resource.h:54
#define STRING_DELETE_FAILED
Definition: resource.h:323
static HKEY parse_key_name(WCHAR *key_name, WCHAR **key_path)
Definition: regproc.c:402
__wchar_t WCHAR
Definition: xmlstorage.h:180
void WINAPIV error_exit(unsigned int id,...)
Definition: regedit.c:103
LSTATUS WINAPI RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey)
Definition: reg.c:1746
#define NULL
Definition: types.h:112
#define SHDeleteKey
Definition: shlwapi.h:44

Referenced by delete_key_state(), and PerformRegAction().

◆ DeleteKey()

BOOL DeleteKey ( HWND  hwnd,
HKEY  hKeyRoot,
LPCWSTR  keyPath 
)

Definition at line 1456 of file edit.c.

1457 {
1458  WCHAR msg[128], caption[128];
1459  BOOL result = FALSE;
1460  LONG lRet;
1461  HKEY hKey;
1462 
1463  lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ|KEY_SET_VALUE, &hKey);
1464  if (lRet != ERROR_SUCCESS)
1465  {
1466  error_code_messagebox(hwnd, lRet);
1467  return FALSE;
1468  }
1469 
1472 
1474  goto done;
1475 
1476  lRet = SHDeleteKey(hKeyRoot, keyPath);
1477  if (lRet != ERROR_SUCCESS)
1478  {
1479  error(hwnd, IDS_BAD_KEY, keyPath);
1480  goto done;
1481  }
1482  result = TRUE;
1483 
1484 done:
1485  RegCloseKey(hKey);
1486  return result;
1487 }
void error(HWND hwnd, INT resId,...)
Definition: edit.c:42
ChildWnd * g_pChildWnd
Definition: childwnd.c:23
#define IDS_BAD_KEY
Definition: resource.h:142
#define ERROR_SUCCESS
Definition: deptool.c:10
#define IDYES
Definition: winuser.h:829
#define KEY_SET_VALUE
Definition: nt_native.h:1017
GLuint64EXT * result
Definition: glext.h:11304
char caption[64]
Definition: dialog.c:2334
#define KEY_READ
Definition: nt_native.h:1023
#define TRUE
Definition: types.h:120
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)
#define FALSE
Definition: types.h:117
#define MB_YESNO
Definition: winuser.h:811
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
static void error_code_messagebox(HWND hwnd, DWORD error_code)
Definition: edit.c:65
#define MB_ICONQUESTION
Definition: winuser.h:783
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDS_QUERY_DELETE_KEY_CONFIRM
Definition: resource.h:155
HWND hWnd
Definition: main.h:62
#define IDS_QUERY_DELETE_KEY_ONE
Definition: resource.h:153
HINSTANCE hInst
Definition: dxdiag.c:13
FxAutoRegKey hKey
#define ARRAY_SIZE(a)
Definition: main.h:24
#define SHDeleteKey
Definition: shlwapi.h:44
#define msg(x)
Definition: auth_time.c:54
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define RegCloseKey(hKey)
Definition: registry.h:47

Referenced by _CmdWndProc(), and DECLARE_INTERFACE_().

◆ DeleteNode()

BOOL DeleteNode ( HWND  hwndTV,
HTREEITEM  hItem 
)

Definition at line 107 of file treeview.c.

108 {
109  if (!hItem) hItem = TreeView_GetSelection(hwndTV);
110  if (!hItem) return FALSE;
111  return TreeView_DeleteItem(hwndTV, hItem);
112 }
#define FALSE
Definition: types.h:117
#define TreeView_DeleteItem(hwnd, hitem)
Definition: commctrl.h:3415
#define TreeView_GetSelection(hwnd)
Definition: commctrl.h:3473

◆ 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().

◆ DestroyMainMenu()

void DestroyMainMenu ( void  )

Definition at line 164 of file main.c.

165 {
167 }
BOOL WINAPI DestroyMenu(_In_ HMENU)
HMENU hMenuFrame
Definition: main.c:37

Referenced by ChildWndProc().

◆ DestroyTreeView()

void DestroyTreeView ( HWND  hwndTV)

Definition at line 762 of file treeview.c.

763 {
765 
767 
768  /* Destroy the image list associated with the tree view control */
771 }
static LPWSTR pathBuffer
Definition: treeview.c:31
HIMAGELIST himl
#define TreeView_GetImageList(hwnd, iImage)
Definition: commctrl.h:3441
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
#define GetProcessHeap()
Definition: compat.h:736
#define TVSIL_NORMAL
Definition: commctrl.h:3443
#define HeapFree(x, y, z)
Definition: compat.h:735

◆ error_exit()

void WINAPIV error_exit ( unsigned int  id,
  ... 
)

Definition at line 103 of file regedit.c.

104 {
105  WCHAR fmt[1536];
106  va_list va_args;
107 
109  {
110 #ifndef __REACTOS__
111  WINE_FIXME("LoadString failed with %lu\n", GetLastError());
112 #endif
113  return;
114  }
115  va_start(va_args, id);
116  output_formatstring(fmt, va_args);
117  va_end(va_args);
118 
119  exit(0); /* regedit.exe always terminates with error code zero */
120 }
static void output_formatstring(const WCHAR *fmt, va_list va_args)
Definition: regedit.c:65
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
__wchar_t WCHAR
Definition: xmlstorage.h:180
va_start(ap, x)
#define ARRAY_SIZE(a)
Definition: main.h:24
#define NULL
Definition: types.h:112
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
void exit(int exitcode)
Definition: _exit.c:33
Definition: dsound.c:943
#define WINE_FIXME
Definition: debug.h:366

Referenced by delete_registry_key(), PerformRegAction(), ProcessCmdLine(), and REGPROC_open_export_file().

◆ ErrorMessageBox()

int ErrorMessageBox ( HWND  hWnd,
LPCWSTR  lpTitle,
DWORD  dwErrorCode,
  ... 
)

Definition at line 24 of file error.c.

25 {
26  int iRet = 0;
27  LPWSTR lpMsgBuf = NULL;
28  DWORD Status = 0;
29  va_list args;
30 
31  va_start(args, dwErrorCode);
32 
34  NULL,
35  dwErrorCode,
37  (LPWSTR)&lpMsgBuf,
38  0,
39  &args);
40 
41  va_end(args);
42 
43  iRet = MessageBoxW(hWnd, (Status && lpMsgBuf ? lpMsgBuf : L"Error displaying error message."), lpTitle, MB_OK | MB_ICONERROR);
44 
45  if (lpMsgBuf) LocalFree(lpMsgBuf);
46 
47  /* Return the MessageBoxW information */
48  return iRet;
49 }
#define args
Definition: format.c:66
#define LANG_NEUTRAL
Definition: nls.h:22
#define SUBLANG_DEFAULT
Definition: nls.h:168
HWND hWnd
Definition: settings.c:17
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
Definition: match.c:390
#define L(x)
Definition: ntvdm.h:50
#define va_end(ap)
Definition: acmsvcex.h:90
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:419
char * va_list
Definition: acmsvcex.h:78
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:423
Status
Definition: gdiplustypes.h:24
unsigned long DWORD
Definition: ntddk_ex.h:95
va_start(ap, x)
#define MB_ICONERROR
Definition: winuser.h:781
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
TCHAR lpTitle[80]
Definition: ctm.c:69
#define MAKELANGID(p, s)
Definition: nls.h:15
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by error_code_messagebox(), ExportRegistryFile(), ImportRegistryFile(), LoadHive(), TreeWndNotifyProc(), and UnloadHive().

◆ export_registry_key()

BOOL export_registry_key ( WCHAR file_name,
WCHAR path,
DWORD  format 
)

Definition at line 1548 of file regproc.c.

1549 {
1550  BOOL unicode = (format == REG_FORMAT_5);
1551 
1552  if (path && *path)
1553  return export_key(file_name, path, unicode);
1554  else
1555  return export_all(file_name, path, unicode);
1556 }
static BOOL export_key(WCHAR *file_name, WCHAR *path, BOOL unicode)
Definition: regproc.c:1490
static BOOL export_all(WCHAR *file_name, WCHAR *path, BOOL unicode)
Definition: regproc.c:1516
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
unsigned int BOOL
Definition: ntddk_ex.h:94
static LPCWSTR file_name
Definition: protocol.c:147
#define REG_FORMAT_5
Definition: main.h:44

Referenced by ExportRegistryFile(), and PerformRegAction().

◆ ExportRegistryFile()

BOOL ExportRegistryFile ( HWND  hWnd)

Definition at line 580 of file framewnd.c.

581 {
582  BOOL bRet = FALSE;
584  WCHAR ExportKeyPath[_MAX_PATH] = {0};
585  WCHAR Caption[128], szTitle[512], szText[512];
586  HKEY hKeyRoot;
587  LPCWSTR pszKeyPath;
588 
589  /* Figure out which key path we are exporting */
590  pszKeyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot);
591  GetKeyName(ExportKeyPath, ARRAY_SIZE(ExportKeyPath), hKeyRoot, pszKeyPath);
592 
594  LoadStringW(hInst, IDS_EXPORT_REG_FILE, Caption, ARRAY_SIZE(Caption));
595  ofn.lpstrTitle = Caption;
596 
597  /* Only set the path if a key (not the root node) is selected */
598  if (hKeyRoot != 0)
599  {
600  ofn.lCustData = (LPARAM) ExportKeyPath;
601  }
605  if (GetSaveFileName(&ofn))
606  {
607  switch (ofn.nFilterIndex)
608  {
609  case 2: /* Registry Hive Files */
610  {
611  LONG lResult;
612  HKEY hSubKey;
613 
614  /* Open the subkey */
615  lResult = RegOpenKeyExW(hKeyRoot, pszKeyPath, 0, KEY_READ, &hSubKey);
616  if (lResult == ERROR_SUCCESS)
617  {
618  /* Enable the 'backup' privilege, save the hive then disable the privilege */
620  lResult = RegSaveKeyW(hSubKey, ofn.lpstrFile, NULL);
621  if (lResult == ERROR_ALREADY_EXISTS)
622  {
623  /*
624  * We are here, that means that we already said "yes" to the confirmation dialog.
625  * So we absolutely want to replace the hive file.
626  */
628  {
629  /* Try again */
630  lResult = RegSaveKeyW(hSubKey, ofn.lpstrFile, NULL);
631  }
632  }
634 
635  if (lResult != ERROR_SUCCESS)
636  {
637  /*
638  * If we are here, it's because RegSaveKeyW has failed for any reason.
639  * The problem is that even if it has failed, it has created or
640  * replaced the exported hive file with a new empty file. We don't
641  * want to keep this file, so we delete it.
642  */
644  }
645 
646  /* Close the subkey */
647  RegCloseKey(hSubKey);
648  }
649 
650  /* Set the return value */
651  bRet = (lResult == ERROR_SUCCESS);
652 
653  /* Display error, if any */
654  if (!bRet) ErrorMessageBox(hWnd, Caption, lResult);
655 
656  break;
657  }
658 
659  case 1: /* Windows Registry Editor Version 5.00 */
660  case 3: /* REGEDIT4 */
661  default: /* All files ==> use Windows Registry Editor Version 5.00 */
662  {
663  if (!export_registry_key(ofn.lpstrFile, ExportKeyPath,
665  : REG_FORMAT_5)))
666  {
667  /* Error creating the file */
669  LoadStringW(hInst, IDS_EXPORT_ERROR, szText, ARRAY_SIZE(szText));
671  bRet = FALSE;
672  }
673  else
674  {
675  bRet = TRUE;
676  }
677 
678  break;
679  }
680  }
681  }
682  else
683  {
685  }
686 
687  return bRet;
688 }
#define REG_FORMAT_4
Definition: main.h:45
#define OFN_EXPLORER
Definition: commdlg.h:104
int ErrorMessageBox(HWND hWnd, LPCWSTR lpTitle, DWORD dwErrorCode,...)
Definition: error.c:24
ChildWnd * g_pChildWnd
Definition: childwnd.c:23
#define ERROR_SUCCESS
Definition: deptool.c:10
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
LPARAM lCustData
Definition: commdlg.h:346
#define KEY_READ
Definition: nt_native.h:1023
#define TRUE
Definition: types.h:120
#define SE_BACKUP_NAME
HWND hTreeWnd
Definition: main.h:63
HWND hWnd
Definition: settings.c:17
OPENFILENAME ofn
Definition: main.cpp:37
int InfoMessageBox(HWND hWnd, UINT uType, LPCWSTR lpTitle, LPCWSTR lpMessage,...)
Definition: error.c:51
LPCSTR lpTemplateName
Definition: commdlg.h:348
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define GetSaveFileName
Definition: commdlg.h:666
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:347
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define IDS_EXPORT_REG_FILE
Definition: resource.h:131
#define _MAX_PATH
Definition: utility.h:77
#define OFN_ENABLEHOOK
Definition: commdlg.h:99
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
#define OFN_ENABLETEMPLATE
Definition: commdlg.h:102
static UINT_PTR CALLBACK ExportRegistryFile_OFNHookProc(HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: framewnd.c:526
static BOOL EnablePrivilege(LPCWSTR lpszPrivilegeName, LPCWSTR lpszSystemName, BOOL bEnablePrivilege)
Definition: framewnd.c:315
LONG_PTR LPARAM
Definition: windef.h:208
#define IDD_EXPORTRANGE
Definition: resource.h:42
LPCWSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY *phRootKey)
Definition: treeview.c:88
LONG WINAPI RegSaveKeyW(HKEY hKey, LPCWSTR lpFile, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: reg.c:4634
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL export_registry_key(WCHAR *file_name, WCHAR *path, DWORD format)
Definition: regproc.c:1548
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
static BOOL CheckCommDlgError(HWND hWnd)
Definition: framewnd.c:191
#define MB_ICONERROR
Definition: winuser.h:781
HINSTANCE hInst
Definition: dxdiag.c:13
LPSTR lpstrFile
Definition: commdlg.h:336
#define ARRAY_SIZE(a)
Definition: main.h:24
#define OFN_OVERWRITEPROMPT
Definition: commdlg.h:116
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
#define IDS_APP_TITLE
Definition: resource.h:10
LPCSTR lpstrTitle
Definition: commdlg.h:341
#define IDS_EXPORT_ERROR
Definition: resource.h:197
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
DWORD nFilterIndex
Definition: commdlg.h:335
static BOOL InitOpenFileName(HWND hWnd, OPENFILENAME *pofn)
Definition: framewnd.c:258
#define RegCloseKey(hKey)
Definition: registry.h:47
#define REG_FORMAT_5
Definition: main.h:44
DWORD Flags
Definition: commdlg.h:342
BOOL GetKeyName(LPWSTR pszDest, size_t iDestLength, HKEY hRootKey, LPCWSTR lpSubKey)
Definition: edit.c:1588

Referenced by _CmdWndProc().

◆ FindDialog()

void FindDialog ( HWND  hWnd)

Definition at line 834 of file find.c.

835 {
837  hWnd, FindDialogProc, 0) != 0)
838  {
840  }
841 }
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
HWND hWnd
Definition: settings.c:17
void FindNextMessageBox(HWND hWnd)
Definition: find.c:822
#define IDD_FIND
Definition: resource.h:48
static INT_PTR CALLBACK FindDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: find.c:707
#define GetModuleHandle
Definition: winbase.h:3698
#define NULL
Definition: types.h:112
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by _CmdWndProc(), and FindNext().

◆ FindNext()

BOOL FindNext ( HWND  hWnd)

Definition at line 632 of file find.c.

633 {
634  HKEY hKeyRoot;
635  LPCWSTR pszKeyPath;
636  BOOL fSuccess;
637  WCHAR szFullKey[512];
638  LPCWSTR pszValueName;
639  LPWSTR pszFoundSubKey, pszFoundValueName;
640 
641  if (wcslen(s_szFindWhat) == 0)
642  {
643  FindDialog(hWnd);
644  return TRUE;
645  }
646 
648 
649  pszKeyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot);
650  if (pszKeyPath == NULL)
651  {
652  hKeyRoot = HKEY_CLASSES_ROOT;
653  pszKeyPath = s_empty;
654  }
655 
656  /* Create abort find dialog */
659  if (s_hwndAbortDialog)
660  {
663  }
664  s_bAbort = FALSE;
665 
666  pszValueName = GetValueName(g_pChildWnd->hListWnd, -1);
667 
672 
673  fSuccess = RegFindWalk(&hKeyRoot, pszKeyPath, pszValueName,
674  &pszFoundSubKey, &pszFoundValueName);
675 
680 
681  if (s_hwndAbortDialog)
682  {
685  }
686 
687  if (fSuccess)
688  {
689  GetKeyName(szFullKey, ARRAY_SIZE(szFullKey), hKeyRoot, pszFoundSubKey);
690  SelectNode(g_pChildWnd->hTreeWnd, szFullKey);
691  free(pszFoundSubKey);
692 
693  if (pszFoundValueName != NULL)
694  {
695  SetValueName(g_pChildWnd->hListWnd, pszFoundValueName);
696  free(pszFoundValueName);
698  }
699  else
700  {
702  }
703  }
704  return fSuccess || s_bAbort;
705 }
ChildWnd * g_pChildWnd
Definition: childwnd.c:23
static WCHAR s_szFindWhat[256]
Definition: find.c:27
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define TRUE
Definition: types.h:120
static HWND s_hwndAbortDialog
Definition: find.c:30
#define free
Definition: debug_ros.c:5
HWND hTreeWnd
Definition: main.h:63
HWND hListWnd
Definition: main.h:64
BOOL WINAPI UpdateWindow(_In_ HWND)
HWND hWnd
Definition: settings.c:17
#define IDD_FINDING
Definition: resource.h:49
WCHAR * GetValueName(HWND hwndLV, int iStartAt)
Definition: listview.c:55
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI DestroyWindow(_In_ HWND)
#define FALSE
Definition: types.h:117
static const WCHAR s_empty[]
Definition: find.c:36
VOID SetValueName(HWND hwndLV, LPCWSTR pszValueName)
Definition: listview.c:84
unsigned int BOOL
Definition: ntddk_ex.h:94
static DWORD GetFindFlags(void)
Definition: find.c:557
LPCWSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY *phRootKey)
Definition: treeview.c:88
#define SW_SHOW
Definition: winuser.h:769
static DWORD s_dwFlags
Definition: find.c:33
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CreateDialogW(h, n, w, f)
Definition: winuser.h:4271
static BOOL s_bAbort
Definition: find.c:31
void FindDialog(HWND hWnd)
Definition: find.c:834
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HWND hFrameWnd
Definition: main.c:35
#define GetModuleHandle
Definition: winbase.h:3698
#define ARRAY_SIZE(a)
Definition: main.h:24
BOOL RegFindWalk(HKEY *phKey, LPCWSTR pszSubKey, LPCWSTR pszValueName, LPWSTR *ppszFoundSubKey, LPWSTR *ppszFoundValueName)
Definition: find.c:356
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
HWND hAddressBarWnd
Definition: main.h:65
BOOL SelectNode(HWND hwndTV, LPCWSTR keyPath)
Definition: treeview.c:773
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static INT_PTR CALLBACK AbortFindDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: find.c:604
BOOL GetKeyName(LPWSTR pszDest, size_t iDestLength, HKEY hRootKey, LPCWSTR lpSubKey)
Definition: edit.c:1588

Referenced by FindNextMessageBox().

◆ FindNextMessageBox()

void FindNextMessageBox ( HWND  hWnd)

Definition at line 822 of file find.c.

823 {
824  if (!FindNext(hWnd))
825  {
826  WCHAR msg[128], caption[128];
827 
831  }
832 }
char caption[64]
Definition: dialog.c:2334
HWND hWnd
Definition: settings.c:17
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
BOOL FindNext(HWND hWnd)
Definition: find.c:632
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MB_ICONINFORMATION
Definition: winuser.h:796
#define IDS_FINISHEDFIND
Definition: resource.h:199
HINSTANCE hInst
Definition: dxdiag.c:13
#define ARRAY_SIZE(a)
Definition: main.h:24
#define IDS_APP_TITLE
Definition: resource.h:10
#define msg(x)
Definition: auth_time.c:54

Referenced by _CmdWndProc(), and FindDialog().

◆ FrameWndProc()

LRESULT CALLBACK FrameWndProc ( HWND  ,
UINT  ,
WPARAM  ,
LPARAM   
)

Definition at line 1352 of file framewnd.c.

1353 {
1354  RECT rc;
1355  switch (message)
1356  {
1357  case WM_CREATE:
1358  // For now, the Help dialog item is disabled because of lacking of HTML Help support
1360  GetClientRect(hWnd, &rc);
1362  rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
1363  hWnd, (HMENU)0, hInst, 0);
1364  break;
1365  case WM_COMMAND:
1368  break;
1369  case WM_ACTIVATE:
1370  if (LOWORD(hWnd) && g_pChildWnd)
1372  break;
1373  case WM_SIZE:
1375  break;
1376  case WM_TIMER:
1377  break;
1378  case WM_INITMENU:
1379  OnInitMenu(hWnd);
1380  break;
1381  case WM_ENTERMENULOOP:
1383  break;
1384  case WM_EXITMENULOOP:
1386  break;
1387  case WM_MENUSELECT:
1389  break;
1390  case WM_SYSCOLORCHANGE:
1391  /* Forward WM_SYSCOLORCHANGE to common controls */
1394  break;
1395  case WM_DESTROY:
1396  WinHelpW(hWnd, L"regedit", HELP_QUIT, 0);
1397  SaveSettings();
1398  PostQuitMessage(0);
1399  default:
1401  }
1402  return 0;
1403 }
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1616
Definition: tftpd.h:59
ChildWnd * g_pChildWnd
Definition: childwnd.c:23
#define MF_BYCOMMAND
Definition: winuser.h:202
static void OnExitMenuLoop(HWND hWnd)
Definition: framewnd.c:129
static void resize_frame_client(HWND hWnd)
Definition: framewnd.c:55
#define HELP_QUIT
Definition: winuser.h:2404
HWND hTreeWnd
Definition: main.h:63
HWND hListWnd
Definition: main.h:64
HWND hWnd
Definition: settings.c:17
LONG top
Definition: windef.h:307
static void OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
Definition: framewnd.c:137
HWND WINAPI SetFocus(_In_opt_ HWND)
#define WS_CHILD
Definition: pedump.c:617
LONG left
Definition: windef.h:306
#define ID_HELP_HELPTOPICS
Definition: resource.h:74
LONG right
Definition: windef.h:308
WPARAM wParam
Definition: combotst.c:138
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
void SaveSettings(void)
Definition: settings.c:115
#define L(x)
Definition: ntvdm.h:50
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define WM_ENTERMENULOOP
Definition: winuser.h:1794
#define WM_MENUSELECT
Definition: winuser.h:1737
#define WM_EXITMENULOOP
Definition: winuser.h:1795
#define WM_DESTROY
Definition: winuser.h:1599
static void OnEnterMenuLoop(HWND hWnd)
Definition: framewnd.c:117
#define WM_SIZE
Definition: winuser.h:1601
HWND hWnd
Definition: main.h:62
#define WM_TIMER
Definition: winuser.h:1732
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: framewnd.c:1023
static void OnInitMenu(HWND hWnd)
Definition: framewnd.c:65
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)
WCHAR szChildClass[MAX_LOADSTRING]
Definition: main.c:45
#define WM_COMMAND
Definition: winuser.h:1730
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HINSTANCE hInst
Definition: dxdiag.c:13
#define WM_INITMENU
Definition: winuser.h:1735
#define WM_ACTIVATE
Definition: winuser.h:1602
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
BOOL WINAPI WinHelpW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_ UINT, _In_ ULONG_PTR)
#define WM_CREATE
Definition: winuser.h:1598
#define HIWORD(l)
Definition: typedefs.h:247
LONG bottom
Definition: windef.h:309
#define MF_GRAYED
Definition: winuser.h:129
#define WS_VISIBLE
Definition: pedump.c:620
HMENU WINAPI GetMenu(_In_ HWND)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)

◆ get_root_key_name()

LPCWSTR get_root_key_name ( HKEY  hRootKey)

Definition at line 29 of file childwnd.c.

30 {
31  if (hRootKey == HKEY_CLASSES_ROOT) return L"HKEY_CLASSES_ROOT";
32  if (hRootKey == HKEY_CURRENT_USER) return L"HKEY_CURRENT_USER";
33  if (hRootKey == HKEY_LOCAL_MACHINE) return L"HKEY_LOCAL_MACHINE";
34  if (hRootKey == HKEY_USERS) return L"HKEY_USERS";
35  if (hRootKey == HKEY_CURRENT_CONFIG) return L"HKEY_CURRENT_CONFIG";
36  if (hRootKey == HKEY_DYN_DATA) return L"HKEY_DYN_DATA";
37 
38  return L"UNKNOWN HKEY, PLEASE REPORT";
39 }
#define HKEY_USERS
Definition: winreg.h:13
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define HKEY_DYN_DATA
Definition: winreg.h:16
#define HKEY_CURRENT_CONFIG
Definition: winreg.h:15
#define L(x)
Definition: ntvdm.h:50
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by SaveSettings(), and UpdateAddress().

◆ GetItemPath()

LPCWSTR GetItemPath ( HWND  hwndTV,
HTREEITEM  hItem,
HKEY phRootKey 
)

Definition at line 88 of file treeview.c.

89 {
90  int pathLen = 0, maxLen;
91 
92  *phRootKey = NULL;
93  if (!pathBuffer) pathBuffer = HeapAlloc(GetProcessHeap(), 0, 1024);
94  if (!pathBuffer) return NULL;
95  *pathBuffer = 0;
96  maxLen = (int) HeapSize(GetProcessHeap(), 0, pathBuffer);
97  if (maxLen == -1) return NULL;
98  if (!hItem) hItem = TreeView_GetSelection(hwndTV);
99  if (!hItem) return NULL;
100  if (!get_item_path(hwndTV, hItem, phRootKey, &pathBuffer, &pathLen, &maxLen))
101  {
102  return NULL;
103  }
104  return pathBuffer;
105 }
static LPWSTR pathBuffer
Definition: treeview.c:31
SIZE_T WINAPI HeapSize(HANDLE, DWORD, LPCVOID)
static BOOL get_item_path(HWND hwndTV, HTREEITEM hItem, HKEY *phKey, LPWSTR *pKeyPath, int *pPathLen, int *pMaxLen)
Definition: treeview.c:40
#define TreeView_GetSelection(hwnd)
Definition: commctrl.h:3473
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define NULL
Definition: types.h:112
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by _CmdWndProc(), ChildWndProc(), CreateNewKey(), ExportRegistryFile(), FindNext(), ImportRegistryFile(), ListWndNotifyProc(), LoadHive(), OnTreeExpanding(), RefreshTreeItem(), SaveSettings(), TreeWndNotifyProc(), UnloadHive(), UpdateAddress(), and UpdateStatusBar().

◆ GetKeyName()

BOOL GetKeyName ( LPWSTR  pszDest,
size_t  iDestLength,
HKEY  hRootKey,
LPCWSTR  lpSubKey 
)

Definition at line 1588 of file edit.c.

1589 {
1590  LPCWSTR pszRootKey;
1591 
1592  if (hRootKey == HKEY_CLASSES_ROOT)
1593  pszRootKey = L"HKEY_CLASSES_ROOT";
1594  else if (hRootKey == HKEY_CURRENT_USER)
1595  pszRootKey = L"HKEY_CURRENT_USER";
1596  else if (hRootKey == HKEY_LOCAL_MACHINE)
1597  pszRootKey = L"HKEY_LOCAL_MACHINE";
1598  else if (hRootKey == HKEY_USERS)
1599  pszRootKey = L"HKEY_USERS";
1600  else if (hRootKey == HKEY_CURRENT_CONFIG)
1601  pszRootKey = L"HKEY_CURRENT_CONFIG";
1602  else if (hRootKey == HKEY_DYN_DATA)
1603  pszRootKey = L"HKEY_DYN_DATA";
1604  else
1605  return FALSE;
1606 
1607  if (lpSubKey[0])
1608  _snwprintf(pszDest, iDestLength, L"%s\\%s", pszRootKey, lpSubKey);
1609  else
1610  _snwprintf(pszDest, iDestLength, L"%s", pszRootKey);
1611  return TRUE;
1612 }
#define HKEY_USERS
Definition: winreg.h:13
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define TRUE
Definition: types.h:120
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define HKEY_DYN_DATA
Definition: winreg.h:16
#define HKEY_CURRENT_CONFIG
Definition: winreg.h:15
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
int _snwprintf(wchar_t *buffer, size_t count, const wchar_t *format,...)
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by CopyKeyName(), ExportRegistryFile(), FindNext(), and ScControl().

◆ GetMultiByteString()

char* GetMultiByteString ( const WCHAR strW)

Definition at line 86 of file regproc.c.

87 {
88  if(strW)
89  {
90  char* strA;
91  int len = WideCharToMultiByte(CP_ACP, 0, strW, -1, NULL, 0, NULL, NULL);
92 
93  strA = malloc(len);
95  return strA;
96  }
97  return NULL;
98 }
char strA[12]
Definition: clipboard.c:2028
#define WideCharToMultiByte
Definition: compat.h:111
#define CP_ACP
Definition: compat.h:109
WCHAR strW[12]
Definition: clipboard.c:2029
GLenum GLsizei len
Definition: glext.h:6722
#define NULL
Definition: types.h:112
#define malloc
Definition: debug_ros.c:4

Referenced by REGPROC_write_line().

◆ 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().

◆ import_registry_file()

BOOL import_registry_file ( FILE reg_file)

Definition at line 1049 of file regproc.c.

1050 {
1051  BYTE s[2];
1052  struct parser parser;
1053  WCHAR *pos;
1054 
1055  if (!reg_file || (fread(s, 2, 1, reg_file) != 1))
1056  return FALSE;
1057 
1058  parser.is_unicode = (s[0] == 0xff && s[1] == 0xfe);
1060 
1061  parser.file = reg_file;
1062  parser.two_wchars[0] = s[0];
1063  parser.two_wchars[1] = s[1];
1064  parser.reg_version = -1;
1065  parser.hkey = NULL;
1066  parser.key_name = NULL;
1068  parser.parse_type = 0;
1069  parser.data_type = 0;
1070  parser.data = NULL;
1071  parser.data_size = 0;
1073  parser.state = HEADER;
1074 
1075  pos = parser.two_wchars;
1076 
1077  /* parser main loop */
1078  while (pos)
1080 
1083 
1085  close_key(&parser);
1086 
1087  return TRUE;
1088 }
static const parser_state_func parser_funcs[NB_PARSER_STATES]
Definition: regproc.c:182
BOOL is_unicode
Definition: import.c:84
static void close_key(struct parser *parser)
Definition: regproc.c:428
#define TRUE
Definition: types.h:120
#define free
Definition: debug_ros.c:5
enum parser_state state
Definition: import.c:95
static WCHAR *(* get_line)(FILE *)
Definition: regproc.c:119
BOOL backslash
Definition: import.c:94
DWORD parse_type
Definition: import.c:90
_Check_return_opt_ _CRTIMP size_t __cdecl fread(_Out_writes_bytes_(_ElementSize *_Count) void *_DstBuf, _In_ size_t _ElementSize, _In_ size_t _Count, _Inout_ FILE *_File)
#define FALSE
Definition: types.h:117
short int reg_version
Definition: import.c:85
WCHAR * key_name
Definition: import.c:88
__wchar_t WCHAR
Definition: xmlstorage.h:180
FILE * file
Definition: import.c:82
HKEY hkey
Definition: import.c:87
GLdouble s
Definition: gl.h:2039
unsigned char BYTE
Definition: xxhash.c:193
WCHAR * value_name
Definition: import.c:89
#define NULL
Definition: types.h:112
void * data
Definition: import.c:92
WCHAR two_wchars[2]
Definition: import.c:83
Definition: import.c:80
DWORD data_type
Definition: import.c:91
static WCHAR * get_lineA(FILE *fp)
Definition: regproc.c:936
static WCHAR * get_lineW(FILE *fp)
Definition: regproc.c:994
DWORD data_size
Definition: import.c:93

Referenced by ImportRegistryFile(), and PerformRegAction().

◆ InfoMessageBox()

int InfoMessageBox ( HWND  hWnd,
UINT  uType,
LPCWSTR  lpTitle,
LPCWSTR  lpMessage,
  ... 
)

Definition at line 51 of file error.c.

52 {
53  int iRet = 0;
54  LPWSTR lpMsgBuf = NULL;
55  va_list args;
56 
57  va_start(args, lpMessage);
58 
59  if (lpMessage)
60  {
61  SIZE_T strLen = _vscwprintf(lpMessage, args);
62 
63  /* Create a buffer on the heap and zero it out (LPTR) */
64  lpMsgBuf = (LPWSTR)LocalAlloc(LPTR, (strLen + 1) * sizeof(WCHAR));
65  if (lpMsgBuf)
66  {
67  _vsnwprintf(lpMsgBuf, strLen, lpMessage, args);
68  }
69  }
70 
71  va_end(args);
72 
73  iRet = MessageBoxW(hWnd, (lpMessage && lpMsgBuf ? lpMsgBuf : L"Error displaying info message."), lpTitle, uType);
74 
75  if (lpMsgBuf) LocalFree(lpMsgBuf);
76 
77  /* Return the MessageBoxW information */
78  return iRet;
79 }
#define args
Definition: format.c:66
HWND hWnd
Definition: settings.c:17
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
Definition: match.c:390
#define L(x)
Definition: ntvdm.h:50
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
__wchar_t WCHAR
Definition: xmlstorage.h:180
va_start(ap, x)
ULONG_PTR SIZE_T
Definition: typedefs.h:80
_Check_return_ _CRTIMP int __cdecl _vscwprintf(_In_z_ _Printf_format_string_ const wchar_t *_Format, va_list _ArgList)
_CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest, size_t _Count, const wchar_t *_Format, va_list _Args)
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define NULL
Definition: types.h:112
TCHAR lpTitle[80]
Definition: ctm.c:69
#define LPTR
Definition: winbase.h:381
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by CreateNewKey(), ExportRegistryFile(), and ImportRegistryFile().

◆ InsertNode()

HTREEITEM InsertNode ( HWND  hwndTV,
HTREEITEM  hItem,
LPWSTR  name 
)

Definition at line 336 of file treeview.c.

337 {
339  HTREEITEM hNewItem = 0;
340  TVITEMEXW item;
341 
342  /* Default to the current selection */
343  if (!hItem)
344  {
345  hItem = TreeView_GetSelection(hwndTV);
346  if (!hItem)
347  return FALSE;
348  }
349 
350  memset(&item, 0, sizeof(item));
351  item.hItem = hItem;
353  if (!TreeView_GetItem(hwndTV, &item))
354  return FALSE;
355 
356  if ((item.state & TVIS_EXPANDEDONCE) && (item.cChildren > 0))
357  {
358  hNewItem = AddEntryToTree(hwndTV, hItem, name, 0, 0);
359  SendMessageW(hwndTV, TVM_SORTCHILDREN, 0, (LPARAM) hItem);
360  }
361  else
362  {
363  item.mask = TVIF_CHILDREN | TVIF_HANDLE;
364  item.hItem = hItem;
365  item.cChildren = 1;
366  if (!TreeView_SetItem(hwndTV, &item))
367  return FALSE;
368  }
369 
371  if (!hNewItem)
372  {
373  for(hNewItem = TreeView_GetChild(hwndTV, hItem); hNewItem; hNewItem = TreeView_GetNextSibling(hwndTV, hNewItem))
374  {
375  item.mask = TVIF_HANDLE | TVIF_TEXT;
376  item.hItem = hNewItem;
377  item.pszText = buf;
378  item.cchTextMax = ARRAY_SIZE(buf);
379  if (!TreeView_GetItem(hwndTV, &item)) continue;
380  if (wcscmp(name, item.pszText) == 0) break;
381  }
382  }
383  if (hNewItem) (void)TreeView_SelectItem(hwndTV, hNewItem);
384 
385  return hNewItem;
386 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define TVM_SORTCHILDREN
Definition: commctrl.h:3541
#define TreeView_GetChild(hwnd, hitem)
Definition: commctrl.h:3466
#define TVIS_EXPANDEDONCE
Definition: commctrl.h:3285
#define TreeView_GetNextSibling(hwnd, hitem)
Definition: commctrl.h:3467
static HTREEITEM AddEntryToTree(HWND hwndTV, HTREEITEM hParent, LPWSTR label, HKEY hKey, DWORD dwChildren)
Definition: treeview.c:115
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define TVIF_CHILDREN
Definition: commctrl.h:3272
#define FALSE
Definition: types.h:117
HTREEITEM hItem
Definition: treelist.h:37
LONG_PTR LPARAM
Definition: windef.h:208
#define TreeView_GetSelection(hwnd)
Definition: commctrl.h:3473
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define TVE_EXPAND
Definition: commctrl.h:3423
#define TVIF_HANDLE
Definition: commctrl.h:3270
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
static ATOM item
Definition: dde.c:856
#define TVIF_TEXT
Definition: commctrl.h:3266
#define ARRAY_SIZE(a)
Definition: main.h:24
#define TreeView_SelectItem(hwnd, hitem)
Definition: commctrl.h:3481
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TreeView_SetItem(hwnd, pitem)
Definition: commctrl.h:3497
Definition: name.c:38
#define TVIF_STATE
Definition: commctrl.h:3269
#define TreeView_Expand(hwnd, hitem, code)
Definition: commctrl.h:3420
#define memset(x, y, z)
Definition: compat.h:39
#define TreeView_GetItem(hwnd, pitem)
Definition: commctrl.h:3490
#define MAX_NEW_KEY_LEN
Definition: main.h:41

Referenced by CreateNewKey().

◆ 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().

◆ 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().

◆ LoadSettings()

void LoadSettings ( void  )

Definition at line 53 of file settings.c.

54 {
55  HKEY hKey = NULL;
56  int iItemIndex = -1;
57 
59  {
60  TCHAR szBuffer[MAX_PATH];
61  DWORD dwAdvancedChecked;
62  DWORD type, size = sizeof(dwAdvancedChecked);
63  LSTATUS lstatus;
64 
65  /* Restore last selected font */
66  if (QueryStringValue(HKEY_CURRENT_USER, g_szGeneralRegKey, _T("Font"), szBuffer, (sizeof(szBuffer)/sizeof(szBuffer[0]))) == ERROR_SUCCESS)
67  {
68  //Get combobox handle
70 
71  //Search for match and return index if match found
72  iItemIndex = ComboBox_FindStringExact(hWnd, -1, szBuffer);
73  if(iItemIndex != CB_ERR)
74  {
75  ComboBox_SetCurSel(hWnd, iItemIndex);
77  }
78  }
79 
80  /* Restore last selected character set */
81  if (QueryStringValue(HKEY_CURRENT_USER, g_szGeneralRegKey, _T("CodePage"), szBuffer, (sizeof(szBuffer)/sizeof(szBuffer[0]))) == ERROR_SUCCESS)
82  {
83  //Get combobox handle
85 
86  iItemIndex = ComboBox_FindStringExact(hWnd, -1, szBuffer);
87  if(iItemIndex != CB_ERR)
88  {
89  ComboBox_SetCurSel(hWnd, iItemIndex);
90  }
91  }
92 
93  lstatus = RegQueryValueEx(hKey, _T("Advanced"), NULL, &type, (LPBYTE)&dwAdvancedChecked, &size);
94  if (lstatus == ERROR_SUCCESS && type == REG_DWORD && dwAdvancedChecked != FALSE)
95  {
97  }
98 
100  }
101  else
102  {
103  /* Default font seems to be Arial */
105 
106  iItemIndex = ComboBox_FindStringExact(hWnd, -1, _T("Arial"));
107  if(iItemIndex != CB_ERR)
108  {
109  ComboBox_SetCurSel(hWnd, iItemIndex);
111  }
112  }
113 }
#define RegQueryValueEx
Definition: winreg.h:524
#define ERROR_SUCCESS
Definition: deptool.c:10
#define IDC_CHECK_ADVANCED
Definition: resource.h:26
#define KEY_READ
Definition: nt_native.h:1023
#define HKEY_CURRENT_USER
Definition: winreg.h:11
HWND hWnd
Definition: settings.c:17
#define SendDlgItemMessage
Definition: winuser.h:5832
#define IDC_COMBO_CHARSET
Definition: resource.h:21
#define ComboBox_FindStringExact(hwndCtl, indexStart, lpszFind)
Definition: windowsx.h:47
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
const TCHAR g_szGeneralRegKey[]
Definition: settings.c:16
#define CB_ERR
Definition: winuser.h:2425
#define MF_CHECKED
Definition: winuser.h:132
char TCHAR
Definition: xmlstorage.h:189
#define BM_CLICK
Definition: winuser.h:1907
#define _T(x)
Definition: vfdio.h:22
GLsizeiptr size
Definition: glext.h:5919
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
#define ComboBox_SetCurSel(hwndCtl, index)
Definition: windowsx.h:66
#define IDC_FONTCOMBO
Definition: resource.h:12
VOID ChangeMapFont(HWND hDlg)
Definition: charmap.c:161
LONG QueryStringValue(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpValueName, LPTSTR pszBuffer, DWORD dwBufferLen)
Definition: settings.c:19
#define RegOpenKeyEx
Definition: winreg.h:520
FxAutoRegKey hKey
#define NULL
Definition: types.h:112
HWND hCharmapDlg
Definition: charmap.c:21
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define REG_DWORD
Definition: sdbapi.c:596
#define RegCloseKey(hKey)
Definition: registry.h:47

◆ ModifyValue()

BOOL ModifyValue ( HWND  hwnd,
HKEY  hKey,
LPCWSTR  valueName,
BOOL  EditBin 
)

Definition at line 1072 of file edit.c.

1073 {
1074  DWORD type;
1075  LONG lRet;
1076  BOOL result = FALSE;
1077 
1078  if (!hKey)
1079  return FALSE;
1080 
1081  editValueName = valueName;
1082 
1083  lRet = RegQueryValueExW(hKey, valueName, 0, &type, 0, &valueDataLen);
1084  if (lRet != ERROR_SUCCESS && (valueName == NULL || !valueName[0]))
1085  {
1086  lRet = ERROR_SUCCESS; /* Allow editing of (Default) values which don't exist */
1087  type = REG_SZ;
1088  valueDataLen = 0;
1090  binValueData = NULL;
1091  }
1092 
1093  if (lRet != ERROR_SUCCESS)
1094  {
1095  error(hwnd, IDS_BAD_VALUE, valueName);
1096  goto done;
1097  }
1098 
1099  if (EditBin == FALSE && ((type == REG_SZ) || (type == REG_EXPAND_SZ)))
1100  {
1101  if (valueDataLen > 0)
1102  {
1104  {
1106  goto done;
1107  }
1108  lRet = RegQueryValueExW(hKey, valueName, 0, 0, (LPBYTE)stringValueData, &valueDataLen);
1109  if (lRet != ERROR_SUCCESS)
1110  {
1111  error(hwnd, IDS_BAD_VALUE, valueName);
1112  goto done;
1113  }
1114  }
1115  else
1116  {
1118  }
1119 
1121  {
1122  if (stringValueData)
1123  {
1124  lRet = RegSetValueExW(hKey, valueName, 0, type, (LPBYTE)stringValueData, (DWORD) (wcslen(stringValueData) + 1) * sizeof(WCHAR));
1125  }
1126  else
1127  {
1128  lRet = RegSetValueExW(hKey, valueName, 0, type, NULL, 0);
1129  }
1130  if (lRet == ERROR_SUCCESS)
1131  result = TRUE;
1132  }
1133  }
1134  else if (EditBin == FALSE && type == REG_MULTI_SZ)
1135  {
1136  if (valueDataLen > 0)
1137  {
1138  size_t llen, listlen, nl_len;
1139  LPWSTR src, lines = NULL;
1140 
1142  {
1144  goto done;
1145  }
1146  lRet = RegQueryValueExW(hKey, valueName, 0, 0, (LPBYTE)stringValueData, &valueDataLen);
1147  if (lRet != ERROR_SUCCESS)
1148  {
1149  error(hwnd, IDS_BAD_VALUE, valueName);
1150  goto done;
1151  }
1152 
1153  /* convert \0 to \r\n */
1154  src = stringValueData;
1155  nl_len = wcslen(L"\r\n") * sizeof(WCHAR);
1156  listlen = sizeof(WCHAR);
1157  lines = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, listlen + sizeof(WCHAR));
1158  while(*src != L'\0')
1159  {
1160  llen = wcslen(src);
1161  if(llen == 0)
1162  break;
1163  listlen += (llen * sizeof(WCHAR)) + nl_len;
1165  wcscat(lines, src);
1166  wcscat(lines, L"\r\n");
1167  src += llen + 1;
1168  }
1171  }
1172  else
1173  {
1175  }
1176 
1178  {
1179  if (stringValueData)
1180  {
1181  /* convert \r\n to \0 */
1182  BOOL EmptyLines = FALSE;
1183  LPWSTR src, lines, nl;
1184  size_t linechars, buflen, c_nl, dest;
1185 
1186  src = stringValueData;
1187  buflen = sizeof(WCHAR);
1188  lines = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, buflen + sizeof(WCHAR));
1189  c_nl = wcslen(L"\r\n");
1190  dest = 0;
1191  while(*src != L'\0')
1192  {
1193  if((nl = wcsstr(src, L"\r\n")))
1194  {
1195  linechars = nl - src;
1196  if(nl == src)
1197  {
1198  EmptyLines = TRUE;
1199  src = nl + c_nl;
1200  continue;
1201  }
1202  }
1203  else
1204  {
1205  linechars = wcslen(src);
1206  }
1207  if(linechars > 0)
1208  {
1209  buflen += ((linechars + 1) * sizeof(WCHAR));
1211  memcpy((lines + dest), src, linechars * sizeof(WCHAR));
1212  dest += linechars;
1213  lines[dest++] = L'\0';
1214  }
1215  else
1216  {
1217  EmptyLines = TRUE;
1218  }
1219  src += linechars + (nl != NULL ? c_nl : 0);
1220  }
1221  lines[++dest] = L'\0';
1222 
1223  if(EmptyLines)
1224  {
1226  }
1227 
1228  lRet = RegSetValueExW(hKey, valueName, 0, type, (LPBYTE)lines, (DWORD) buflen);
1229  HeapFree(GetProcessHeap(), 0, lines);
1230  }
1231  else
1232  {
1233  lRet = RegSetValueExW(hKey, valueName, 0, type, NULL, 0);
1234  }
1235  if (lRet == ERROR_SUCCESS)
1236  result = TRUE;
1237  }
1238  }
1239  else if (EditBin == FALSE && type == REG_DWORD)
1240  {
1241  lRet = RegQueryValueExW(hKey, valueName, 0, 0, (LPBYTE)&dwordValueData, &valueDataLen);
1242  if (lRet != ERROR_SUCCESS)
1243  {
1244  error(hwnd, IDS_BAD_VALUE, valueName);
1245  goto done;
1246  }
1247 
1249  {
1250  lRet = RegSetValueExW(hKey, valueName, 0, type, (LPBYTE)&dwordValueData, sizeof(DWORD));
1251  if (lRet == ERROR_SUCCESS)
1252  result = TRUE;
1253  }
1254  }
1255  else if (EditBin == FALSE && type == REG_RESOURCE_LIST)
1256  {
1257  if (valueDataLen > 0)
1258  {
1260  if (resourceValueData == NULL)
1261  {
1263  goto done;
1264  }
1265 
1266  lRet = RegQueryValueExW(hKey, valueName, 0, 0, (LPBYTE)resourceValueData, &valueDataLen);
1267  if (lRet != ERROR_SUCCESS)
1268  {
1269  error(hwnd, IDS_BAD_VALUE, valueName);
1270  goto done;
1271  }
1272  }
1273  else
1274  {
1276  }
1277 
1279  {
1280  }
1281  }
1282  else if (EditBin == FALSE && type == REG_FULL_RESOURCE_DESCRIPTOR)
1283  {
1284  if (valueDataLen > 0)
1285  {
1287  if (resourceValueData == NULL)
1288  {
1290  goto done;
1291  }
1292 
1293  lRet = RegQueryValueExW(hKey, valueName, 0, 0, (LPBYTE)&resourceValueData->List[0], &valueDataLen);
1294  if (lRet != ERROR_SUCCESS)
1295  {
1296  error(hwnd, IDS_BAD_VALUE, valueName);
1297  goto done;
1298  }
1299 
1300  resourceValueData->Count = 1;
1301  fullResourceIndex = 0;
1302  }
1303  else
1304  {
1306  }
1307 
1309  {
1310  }
1311  }
1312  else if ((EditBin != FALSE) || (type == REG_NONE) || (type == REG_BINARY))
1313  {
1314  if(valueDataLen > 0)
1315  {
1317  {
1319  goto done;
1320  }
1321 
1322  /* Use the unicode version, so editing strings in binary mode is correct */
1323  lRet = RegQueryValueExW(hKey, valueName,
1324  0, 0, (LPBYTE)binValueData, &valueDataLen);
1325  if (lRet != ERROR_SUCCESS)
1326  {
1328  error(hwnd, IDS_BAD_VALUE, valueName);
1329  goto done;
1330  }
1331  }
1332  else
1333  {
1334  binValueData = NULL;
1335  }
1336 
1338  {
1339  /* Use the unicode version, so editing strings in binary mode is correct */
1340  lRet = RegSetValueExW(hKey, valueName,
1342  if (lRet == ERROR_SUCCESS)
1343  result = TRUE;
1344  }
1345  if(binValueData != NULL)
1347  }
1348  else
1349  {
1351  }
1352 
1353 done:
1354  if (resourceValueData)
1357 
1358  if (stringValueData)
1361 
1362  return result;
1363 }
static INT_PTR CALLBACK modify_resource_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:918
void error(HWND hwnd, INT resId,...)
Definition: edit.c:42
#define IDOK
Definition: winuser.h:824
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint64EXT * result
Definition: glext.h:11304
#define IDD_EDIT_BIN_DATA
Definition: resource.h:256
CM_FULL_RESOURCE_DESCRIPTOR List[1]
Definition: hwresource.cpp:165
#define REG_BINARY
Definition: nt_native.h:1496
#define TRUE
Definition: types.h:120
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
#define IDD_EDIT_RESOURCE
Definition: resource.h:278
static INT fullResourceIndex
Definition: edit.c:38
#define IDD_EDIT_STRING
Definition: resource.h:247
INT_PTR CALLBACK modify_multi_string_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:165
static const WCHAR * editValueName
Definition: edit.c:33
static DWORD valueDataLen
Definition: edit.c:39
static PVOID binValueData
Definition: edit.c:35
static INT_PTR CALLBACK modify_resource_list_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:1039
#define L(x)
Definition: ntvdm.h:50
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define IDS_MULTI_SZ_EMPTY_STRING
Definition: resource.h:124
#define REG_MULTI_SZ
Definition: nt_native.h:1501
#define IDD_EDIT_RESOURCE_LIST
Definition: resource.h:274
#define REG_RESOURCE_LIST
Definition: nt_native.h:1502
#define REG_FULL_RESOURCE_DESCRIPTOR
Definition: nt_native.h:1503
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4389
static PCM_RESOURCE_LIST resourceValueData
Definition: edit.c:37
eMaj lines
Definition: tritemp.h:206
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4899
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4120
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDS_TOO_BIG_VALUE
Definition: resource.h:121
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDS_BAD_VALUE
Definition: resource.h:11
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum src
Definition: glext.h:6340
INT_PTR CALLBACK modify_string_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:96
INT_PTR CALLBACK modify_binary_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:388
#define IDD_EDIT_MULTI_STRING
Definition: resource.h:255
FxAutoRegKey hKey
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define HeapReAlloc
Definition: compat.h:734
_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
static WCHAR * stringValueData
Definition: edit.c:34
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define IDS_UNSUPPORTED_TYPE
Definition: resource.h:120
unsigned int ULONG
Definition: retypes.h:1
INT_PTR CALLBACK modify_dword_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:274
static char * dest
Definition: rtl.c:135
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define REG_NONE
Definition: nt_native.h:1492
void warning(HWND hwnd, INT resId,...)
Definition: edit.c:73
WCHAR * LPWSTR
Definition: xmlstorage.h:184
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define IDD_EDIT_DWORD
Definition: resource.h:251
#define REG_DWORD
Definition: sdbapi.c:596
#define HeapFree(x, y, z)
Definition: compat.h:735
static DWORD dwordValueData
Definition: edit.c:36
#define REG_SZ
Definition: layer.c:22

Referenced by _CmdWndProc().

◆ OnTreeExpanding()

BOOL OnTreeExpanding ( HWND  hWnd,
NMTREEVIEW pnmtv 
)

Definition at line 505 of file treeview.c.

506 {
507  DWORD dwCount, dwIndex, dwMaxSubKeyLen;
508  HKEY hRoot, hNewKey, hKey;
509  LPCWSTR keyPath;
510  LPWSTR Name;
511  LONG errCode;
512  HCURSOR hcursorOld;
513 
514  static int expanding;
515  if (expanding) return FALSE;
516  if (pnmtv->itemNew.state & TVIS_EXPANDEDONCE )
517  {
518  return TRUE;
519  }
520  expanding = TRUE;
521  hcursorOld = SetCursor(LoadCursor(NULL, IDC_WAIT));
522  SendMessageW(hwndTV, WM_SETREDRAW, FALSE, 0);
523 
524  keyPath = GetItemPath(hwndTV, pnmtv->itemNew.hItem, &hRoot);
525  if (!keyPath) goto done;
526 
527  if (*keyPath)
528  {
529  errCode = RegOpenKeyExW(hRoot, keyPath, 0, KEY_READ, &hNewKey);
530  if (errCode != ERROR_SUCCESS) goto done;
531  }
532  else
533  {
534  hNewKey = hRoot;
535  }
536 
537  errCode = RegQueryInfoKeyW(hNewKey, 0, 0, 0, &dwCount, &dwMaxSubKeyLen, 0, 0, 0, 0, 0, 0);
538  if (errCode != ERROR_SUCCESS) goto done;
539  dwMaxSubKeyLen++; /* account for the \0 terminator */
540  Name = HeapAlloc(GetProcessHeap(), 0, dwMaxSubKeyLen * sizeof(WCHAR));
541  if (!Name) goto done;
542 
543  for (dwIndex = 0; dwIndex < dwCount; dwIndex++)
544  {
545  DWORD cName = dwMaxSubKeyLen, dwSubCount;
546 
547  errCode = RegEnumKeyExW(hNewKey, dwIndex, Name, &cName, 0, 0, 0, 0);
548  if (errCode != ERROR_SUCCESS) continue;
549  errCode = RegOpenKeyExW(hNewKey, Name, 0, KEY_QUERY_VALUE, &hKey);
550  if (errCode == ERROR_SUCCESS)
551  {
552  errCode = RegQueryInfoKeyW(hKey, 0, 0, 0, &dwSubCount, 0, 0, 0, 0, 0, 0, 0);
553  RegCloseKey(hKey);
554  }
555  if (errCode != ERROR_SUCCESS) dwSubCount = 0;
556  AddEntryToTree(hwndTV, pnmtv->itemNew.hItem, Name, NULL, dwSubCount);
557  }
558 
559  SendMessageW(hwndTV, TVM_SORTCHILDREN, 0, (LPARAM)pnmtv->itemNew.hItem);
560 
561  RegCloseKey(hNewKey);
563 
564 done:
565  SendMessageW(hwndTV, WM_SETREDRAW, TRUE, 0);
566  SetCursor(hcursorOld);
567  expanding = FALSE;
568 
569  return TRUE;
570 }
#define ERROR_SUCCESS
Definition: deptool.c:10
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define TVM_SORTCHILDREN
Definition: commctrl.h:3541
#define KEY_READ
Definition: nt_native.h:1023
#define TRUE
Definition: types.h:120
#define WM_SETREDRAW
Definition: winuser.h:1606
#define TVIS_EXPANDEDONCE
Definition: commctrl.h:3285
HICON HCURSOR
Definition: windef.h:299
static HTREEITEM AddEntryToTree(HWND hwndTV, HTREEITEM hParent, LPWSTR label, HKEY hKey, DWORD dwChildren)
Definition: treeview.c:115
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
static HTREEITEM hRoot
Definition: treeview.c:381
struct NameRec_ * Name
Definition: cdprocs.h:459
#define IDC_WAIT
Definition: winuser.h:684
LONG_PTR LPARAM
Definition: windef.h:208
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
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
#define LoadCursor
Definition: winuser.h:5802
LPCWSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY *phRootKey)
Definition: treeview.c:88
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
FxAutoRegKey hKey
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2527
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:735
#define RegCloseKey(hKey)
Definition: registry.h:47

Referenced by TreeWndNotifyProc().

◆ output_message()

void WINAPIV output_message ( unsigned int  id,
  ... 
)

Definition at line 92 of file reg.c.

93 {
94  WCHAR *fmt = NULL;
95  int len;
96  va_list va_args;
97 
98  if (!(len = LoadStringW(GetModuleHandleW(NULL), id, (WCHAR *)&fmt, 0)))
99  {
100  WINE_FIXME("LoadString failed with %d\n", GetLastError());
101  return;
102  }
103 
104  len++;
105  fmt = malloc(len * sizeof(WCHAR));
106  if (!fmt) return;
107 
109 
110  va_start(va_args, id);
111  output_formatstring(fmt, va_args);
112  va_end(va_args);
113 
114  free(fmt);
115 }
#define free
Definition: debug_ros.c:5
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define va_end(ap)
Definition: acmsvcex.h:90
static void output_formatstring(const WCHAR *fmt, va_list va_args)
Definition: reg.c:76
char * va_list
Definition: acmsvcex.h:78
__wchar_t WCHAR
Definition: xmlstorage.h:180
va_start(ap, x)
GLenum GLsizei len
Definition: glext.h:6722
#define NULL
Definition: types.h:112
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define malloc
Definition: debug_ros.c:4
Definition: dsound.c:943
#define WINE_FIXME
Definition: debug.h:366

Referenced by ask_confirm(), ask_overwrite_value(), export_key(), get_file_handle(), get_regdata(), key_name_state(), open_export_key(), output_error(), parse_registry_key(), parse_win31_line_state(), PerformRegAction(), ProcessCmdLine(), query_value(), reg_add(), reg_copy(), reg_delete(), reg_export(), reg_import(), reg_query(), REGPROC_unescape_string(), run_add(), run_delete(), run_query(), sane_path(), unescape_string(), unknown_data_state(), and wmain().

◆ QueryStringValue()

LONG QueryStringValue ( HKEY  hKey,
LPCWSTR  lpSubKey,
LPCWSTR  lpValueName,
LPWSTR  pszBuffer,
DWORD  dwBufferLen 
)

Definition at line 1554 of file edit.c.

1555 {
1556  LONG lResult;
1557  HKEY hSubKey = NULL;
1558  DWORD cbData, dwType;
1559 
1560  if (lpSubKey)
1561  {
1562  lResult = RegOpenKeyW(hKey, lpSubKey, &hSubKey);
1563  if (lResult != ERROR_SUCCESS)
1564  goto done;
1565  hKey = hSubKey;
1566  }
1567 
1568  cbData = (dwBufferLen - 1) * sizeof(*pszBuffer);
1569  lResult = RegQueryValueExW(hKey, lpValueName, NULL, &dwType, (LPBYTE) pszBuffer, &cbData);
1570  if (lResult != ERROR_SUCCESS)
1571  goto done;
1572  if (dwType != REG_SZ)
1573  {
1574  lResult = -1;
1575  goto done;
1576  }
1577 
1578  pszBuffer[cbData / sizeof(*pszBuffer)] = L'\0';
1579 
1580 done:
1581  if (lResult != ERROR_SUCCESS)
1582  pszBuffer[0] = L'\0';
1583  if (hSubKey)
1584  RegCloseKey(hSubKey);
1585  return lResult;
1586 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define L(x)
Definition: ntvdm.h:50
unsigned char * LPBYTE
Definition: typedefs.h:53
long LONG
Definition: pedump.c:60
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3291
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4120
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
#define NULL
Definition: types.h:112
#define RegCloseKey(hKey)
Definition: registry.h:47
#define REG_SZ
Definition: layer.c:22

◆ 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().

◆ RefreshTreeItem()

BOOL RefreshTreeItem ( HWND  hwndTV,
HTREEITEM  hItem 
)

Definition at line 141 of file treeview.c.

142 {
143  HKEY hRoot, hKey, hSubKey;
144  HTREEITEM childItem;
145  LPCWSTR KeyPath;
146  DWORD dwCount, dwIndex, dwMaxSubKeyLen;
147  LPWSTR Name = NULL;
148  TVITEMW tvItem;
149  LPWSTR pszNodes = NULL;
150  BOOL bSuccess = FALSE;
151  LPWSTR s;
152  BOOL bAddedAny;
153 
154  KeyPath = GetItemPath(hwndTV, hItem, &hRoot);
155 
156  if (*KeyPath)
157  {
158  if (RegOpenKeyExW(hRoot, KeyPath, 0, KEY_READ, &hKey) != ERROR_SUCCESS)
159  {
160  goto done;
161  }
162  }
163  else
164  {
165  hKey = hRoot;
166  }
167 
168  if (RegQueryInfoKeyW(hKey, 0, 0, 0, &dwCount, &dwMaxSubKeyLen, 0, 0, 0, 0, 0, 0) != ERROR_SUCCESS)
169  {
170  goto done;
171  }
172 
173  /* Set the number of children again */
174  tvItem.mask = TVIF_CHILDREN;
175  tvItem.hItem = hItem;
176  tvItem.cChildren = dwCount;
177  if (!TreeView_SetItem(hwndTV, &tvItem))
178  {
179  goto done;
180  }
181 
182  /* We don't have to bother with the rest if it's not expanded. */
183  if (TreeView_GetItemState(hwndTV, hItem, TVIS_EXPANDED) == 0)
184  {
185  RegCloseKey(hKey);
186  bSuccess = TRUE;
187  goto done;
188  }
189 
190  dwMaxSubKeyLen++; /* account for the \0 terminator */
191  if (!(Name = HeapAlloc(GetProcessHeap(), 0, dwMaxSubKeyLen * sizeof(WCHAR))))
192  {
193  goto done;
194  }
195  tvItem.cchTextMax = dwMaxSubKeyLen;
196  /*if (!(tvItem.pszText = HeapAlloc(GetProcessHeap(), 0, dwMaxSubKeyLen * sizeof(WCHAR)))) {
197  goto done;
198  }*/
199 
200  /* Get all of the tree node siblings in one contiguous block of memory */
201  {
202  DWORD dwPhysicalSize = 0;
203  DWORD dwActualSize = 0;
204  DWORD dwNewPhysicalSize;
205  LPWSTR pszNewNodes;
206  DWORD dwStep = 10000;
207 
208  for (childItem = TreeView_GetChild(hwndTV, hItem); childItem;
209  childItem = TreeView_GetNextSibling(hwndTV, childItem))
210  {
211 
212  if (dwActualSize + dwMaxSubKeyLen + 1 > dwPhysicalSize)
213  {
214  dwNewPhysicalSize = dwActualSize + dwMaxSubKeyLen + 1 + dwStep;
215 
216  if (pszNodes)
217  pszNewNodes = (LPWSTR) HeapReAlloc(GetProcessHeap(), 0, pszNodes, dwNewPhysicalSize * sizeof(WCHAR));
218  else
219  pszNewNodes = (LPWSTR) HeapAlloc(GetProcessHeap(), 0, dwNewPhysicalSize * sizeof(WCHAR));
220  if (!pszNewNodes)
221  goto done;
222 
223  dwPhysicalSize = dwNewPhysicalSize;
224  pszNodes = pszNewNodes;
225  }
226 
227  tvItem.mask = TVIF_TEXT;
228  tvItem.hItem = childItem;
229  tvItem.pszText = &pszNodes[dwActualSize];
230  tvItem.cchTextMax = dwPhysicalSize - dwActualSize;
231  if (!TreeView_GetItem(hwndTV, &tvItem))
232  goto done;
233 
234  dwActualSize += (DWORD) wcslen(&pszNodes[dwActualSize]) + 1;
235  }
236 
237  if (pszNodes)
238  pszNodes[dwActualSize] = L'\0';
239  }
240 
241  /* Now go through all the children in the tree, and check if any have to be removed. */
242  childItem = TreeView_GetChild(hwndTV, hItem);
243  while (childItem)
244  {
245  HTREEITEM nextItem = TreeView_GetNextSibling(hwndTV, childItem);
246  if (RefreshTreeItem(hwndTV, childItem) == FALSE)
247  {
248  (void)TreeView_DeleteItem(hwndTV, childItem);
249  }
250  childItem = nextItem;
251  }
252 
253  /* Now go through all the children in the registry, and check if any have to be added. */
254  bAddedAny = FALSE;
255  for (dwIndex = 0; dwIndex < dwCount; dwIndex++)
256  {
257  DWORD cName = dwMaxSubKeyLen, dwSubCount;
258  BOOL found;
259 
260  found = FALSE;
261  if (RegEnumKeyExW(hKey, dwIndex, Name, &cName, 0, 0, 0, NULL) != ERROR_SUCCESS)
262  {
263  continue;
264  }
265 
266  /* Check if the node is already in there. */
267  if (pszNodes)
268  {
269  for (s = pszNodes; *s; s += wcslen(s) + 1)
270  {
271  if (!wcscmp(s, Name))
272  {
273  found = TRUE;
274  break;
275  }
276  }
277  }
278 
279  if (found == FALSE)
280  {
281  /* Find the number of children of the node. */
282  dwSubCount = 0;
283  if (RegOpenKeyExW(hKey, Name, 0, KEY_QUERY_VALUE, &hSubKey) == ERROR_SUCCESS)
284  {
285  if (RegQueryInfoKeyW(hSubKey, 0, 0, 0, &dwSubCount, 0, 0, 0, 0, 0, 0, 0) != ERROR_SUCCESS)
286  {
287  dwSubCount = 0;
288  }
289  RegCloseKey(hSubKey);
290  }
291 
292  AddEntryToTree(hwndTV, hItem, Name, NULL, dwSubCount);
293  bAddedAny = TRUE;
294  }
295  }
296  RegCloseKey(hKey);
297 
298  if (bAddedAny)
299  SendMessageW(hwndTV, TVM_SORTCHILDREN, 0, (LPARAM) hItem);
300 
301  bSuccess = TRUE;
302 
303 done:
304  if (pszNodes)
305  HeapFree(GetProcessHeap(), 0, pszNodes);
306  if (Name)
308  return bSuccess;
309 }
int cchTextMax
Definition: commctrl.h:3321
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 TVM_SORTCHILDREN
Definition: commctrl.h:3541
#define KEY_READ
Definition: nt_native.h:1023
#define TRUE
Definition: types.h:120
#define TreeView_GetChild(hwnd, hitem)
Definition: commctrl.h:3466
#define TreeView_GetNextSibling(hwnd, hitem)
Definition: commctrl.h:3467
UINT mask
Definition: commctrl.h:3316
LPWSTR pszText
Definition: commctrl.h:3320
#define DWORD
Definition: nt_native.h:44
static BOOLEAN bSuccess
Definition: drive.cpp:433
static HTREEITEM AddEntryToTree(HWND hwndTV, HTREEITEM hParent, LPWSTR label, HKEY hKey, DWORD dwChildren)
Definition: treeview.c:115
#define L(x)
Definition: ntvdm.h:50
#define TVIF_CHILDREN
Definition: commctrl.h:3272
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static HTREEITEM hRoot
Definition: treeview.c:381
HTREEITEM hItem
Definition: treelist.h:37
LONG_PTR LPARAM
Definition: windef.h:208
int cChildren
Definition: commctrl.h:3324
#define TreeView_DeleteItem(hwnd, hitem)
Definition: commctrl.h:3415
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define TreeView_GetItemState(hwndTV, hti, mask)
Definition: commctrl.h:3595
BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
Definition: treeview.c:141