ReactOS 0.4.15-dev-7887-g64a59a1
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 bSelectNone)
 
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, BOOL bSelectNone)
 
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)
 
BOOL txt_export_registry_key (LPCWSTR file_name, LPCWSTR path)
 

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.

50{
58};
@ OPTIONS_VIEW_DATA_ONLY
Definition: main.h:57
@ OPTIONS_DISPLAY_BINARY_DATA
Definition: main.h:55
@ OPTIONS_AUTO_REFRESH
Definition: main.h:51
@ OPTIONS_CONFIRM_ON_DELETE
Definition: main.h:53
@ OPTIONS_READ_ONLY_MODE
Definition: main.h:52
@ OPTIONS_VIEW_TREE_ONLY
Definition: main.h:56
@ OPTIONS_SAVE_ON_EXIT
Definition: main.h:54

Function Documentation

◆ ChildWndProc()

LRESULT CALLBACK ChildWndProc ( HWND  hWnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 302 of file childwnd.c.

303{
304 BOOL Result;
305 RECT rc;
306
307 switch (message)
308 {
309 case WM_CREATE:
310 {
311 WNDPROC oldproc;
312 HFONT hFont;
314 DWORD style;
315
316 /* Load "My Computer" string */
318
320 if (!g_pChildWnd) return 0;
321
323 g_pChildWnd->nSplitPos = 190;
325
329 hWnd, (HMENU)0, hInst, 0);
330
333 g_pChildWnd->hAddressBtnWnd = CreateWindowExW(0, L"Button", L"\x00BB", style,
335 hWnd, (HMENU)0, hInst, 0);
337 IMAGE_ICON, 12, 12, 0);
339
340 GetClientRect(hWnd, &rc);
344
345 /* set the address bar and button font */
347 {
351 (WPARAM)hFont,
352 0);
355 (WPARAM)hFont,
356 0);
357 }
358 /* Subclass the AddressBar */
362 break;
363 }
364 case WM_COMMAND:
365 if(HIWORD(wParam) == BN_CLICKED)
366 {
368 }
369 break; //goto def;
370 case WM_SETCURSOR:
371 if (LOWORD(lParam) == HTCLIENT)
372 {
373 POINT pt;
377 {
379 return TRUE;
380 }
381 }
382 goto def;
383 case WM_DESTROY:
391 break;
392 case WM_LBUTTONDOWN:
393 {
394 RECT rt;
395 int x = (short)LOWORD(lParam);
396 GetClientRect(hWnd, &rt);
398 {
402 }
403 break;
404 }
405
406 case WM_LBUTTONUP:
407 case WM_RBUTTONDOWN:
408 if (GetCapture() == hWnd)
409 {
411 }
412 break;
413
415 if (GetCapture()==hWnd && last_split>=0)
417 break;
418
419 case WM_KEYDOWN:
420 if (wParam == VK_ESCAPE)
421 if (GetCapture() == hWnd)
422 {
423 RECT rt;
425 GetClientRect(hWnd, &rt);
426 ResizeWnd(rt.right, rt.bottom);
427 last_split = -1;
430 }
431 break;
432
433 case WM_MOUSEMOVE:
434 if (GetCapture() == hWnd)
435 {
436 HDC hdc;
437 RECT rt;
438 HGDIOBJ OldObj;
439 int x = LOWORD(lParam);
440 if(!SizingPattern)
441 {
442 const DWORD Pattern[4] = {0x5555AAAA, 0x5555AAAA, 0x5555AAAA, 0x5555AAAA};
443 SizingPattern = CreateBitmap(8, 8, 1, 1, Pattern);
444 }
445 if(!SizingBrush)
446 {
448 }
449
450 GetClientRect(hWnd, &rt);
451 x = (SHORT) min(max(x, SPLIT_MIN), rt.right - SPLIT_MIN);
452 if(last_split != x)
453 {
456 hdc = GetDC(hWnd);
457 OldObj = SelectObject(hdc, SizingBrush);
458 PatBlt(hdc, rt.left, rt.top, rt.right - rt.left, rt.bottom - rt.top, PATINVERT);
459 last_split = x;
460 rt.left = x-SPLIT_WIDTH/2;
461 rt.right = x+SPLIT_WIDTH/2+1;
462 PatBlt(hdc, rt.left, rt.top, rt.right - rt.left, rt.bottom - rt.top, PATINVERT);
463 SelectObject(hdc, OldObj);
465 }
466 }
467 break;
468
469 case WM_SETFOCUS:
470 if (g_pChildWnd != NULL)
471 {
473 }
474 break;
475
476 case WM_TIMER:
477 break;
478
479 case WM_NOTIFY:
480 if (g_pChildWnd == NULL) break;
481
482 if (((LPNMHDR)lParam)->idFrom == TREE_WINDOW)
483 {
485 {
486 goto def;
487 }
488
489 return Result;
490 }
491 else
492 {
493 if (((LPNMHDR)lParam)->idFrom == LIST_WINDOW)
494 {
496 {
497 goto def;
498 }
499
500 return Result;
501 }
502 else
503 {
504 goto def;
505 }
506 }
507 break;
508
509 case WM_CONTEXTMENU:
510 {
511 POINT pt;
513 {
514 int i, cnt;
515 BOOL IsDefault;
516 pt.x = (short) LOWORD(lParam);
517 pt.y = (short) HIWORD(lParam);
520 if (pt.x == -1 && pt.y == -1)
521 {
522 RECT rc;
523 if (i != -1)
524 {
525 rc.left = LVIR_BOUNDS;
527 pt.x = rc.left + 8;
528 pt.y = rc.top + 8;
529 }
530 else
531 pt.x = pt.y = 0;
533 }
534 if(i == -1)
535 {
537 }
538 else
539 {
542 IsDefault = IsDefaultValue(g_pChildWnd->hListWnd, i);
543 if(cnt == 1)
545 else
549
551 }
552 }
553 else if ((HWND)wParam == g_pChildWnd->hTreeWnd)
554 {
555 TVHITTESTINFO hti;
556 HMENU hContextMenu;
558 MENUITEMINFOW mii;
559 WCHAR resource[256];
560 WCHAR buffer[256];
561 LPWSTR s;
562 LPCWSTR keyPath;
563 HKEY hRootKey;
564 int iLastPos;
565 WORD wID;
566 BOOL isRoot;
567
568 pt.x = (short) LOWORD(lParam);
569 pt.y = (short) HIWORD(lParam);
570
571 if (pt.x == -1 && pt.y == -1)
572 {
573 RECT rc;
575 if (hti.hItem != NULL)
576 {
578 pt.x = rc.left + 8;
579 pt.y = rc.top + 8;
581 hti.flags = TVHT_ONITEM;
582 }
583 else
584 hti.flags = 0;
585 }
586 else
587 {
588 hti.pt.x = pt.x;
589 hti.pt.y = pt.y;
592 }
593
594 if (hti.flags & TVHT_ONITEM)
595 {
597
598 isRoot = (TreeView_GetParent(g_pChildWnd->hTreeWnd, hti.hItem) == NULL);
599 hContextMenu = GetSubMenu(hPopupMenus, isRoot ? PM_ROOTITEM : PM_TREECONTEXT);
600
601 memset(&item, 0, sizeof(item));
603 item.hItem = hti.hItem;
605
606 /* Set the Expand/Collapse menu item appropriately */
608 memset(&mii, 0, sizeof(mii));
609 mii.cbSize = sizeof(mii);
611 mii.fState = (item.cChildren > 0) ? MFS_DEFAULT : MFS_GRAYED;
613 mii.dwTypeData = (LPWSTR) buffer;
614 SetMenuItemInfo(hContextMenu, 0, TRUE, &mii);
615
616 if (isRoot == FALSE)
617 {
618 /* Remove any existing suggestions */
619 memset(&mii, 0, sizeof(mii));
620 mii.cbSize = sizeof(mii);
621 mii.fMask = MIIM_ID;
622 GetMenuItemInfo(hContextMenu, GetMenuItemCount(hContextMenu) - 1, TRUE, &mii);
623 if ((mii.wID >= ID_TREE_SUGGESTION_MIN) && (mii.wID <= ID_TREE_SUGGESTION_MAX))
624 {
625 do
626 {
627 iLastPos = GetMenuItemCount(hContextMenu) - 1;
628 GetMenuItemInfo(hContextMenu, iLastPos, TRUE, &mii);
629 RemoveMenu(hContextMenu, iLastPos, MF_BYPOSITION);
630 }
631 while((mii.wID >= ID_TREE_SUGGESTION_MIN) && (mii.wID <= ID_TREE_SUGGESTION_MAX));
632 }
633
634 /* Come up with suggestions */
635 keyPath = GetItemPath(g_pChildWnd->hTreeWnd, NULL, &hRootKey);
636 SuggestKeys(hRootKey, keyPath, Suggestions, ARRAY_SIZE(Suggestions));
637 if (Suggestions[0])
638 {
639 AppendMenu(hContextMenu, MF_SEPARATOR, 0, NULL);
640
642
643 s = Suggestions;
645 while(*s && (wID <= ID_TREE_SUGGESTION_MAX))
646 {
648
649 memset(&mii, 0, sizeof(mii));
650 mii.cbSize = sizeof(mii);
651 mii.fMask = MIIM_STRING | MIIM_ID;
652 mii.wID = wID++;
653 mii.dwTypeData = buffer;
654 InsertMenuItem(hContextMenu, GetMenuItemCount(hContextMenu), TRUE, &mii);
655
656 s += wcslen(s) + 1;
657 }
658 }
659 }
660 TrackPopupMenu(hContextMenu, TPM_RIGHTBUTTON, pt.x, pt.y, 0, hFrameWnd, NULL);
661 }
662 }
663 break;
664 }
665
666 case WM_SIZE:
668 {
670 }
671 /* fall through */
672 default:
673def:
675 }
676 return 0;
677}
Arabic default style
Definition: afstyles.h:94
HWND hWnd
Definition: settings.c:17
BOOL CreateListView(PMAIN_WND_INFO Info)
Definition: listview.c:355
static void finish_splitbar(HWND hWnd, int x)
Definition: childwnd.c:120
static int last_split
Definition: childwnd.c:24
static void draw_splitbar(HWND hWnd, int x)
Definition: childwnd.c:90
LRESULT CALLBACK AddressBarProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: childwnd.c:210
HBRUSH SizingBrush
Definition: childwnd.c:26
ChildWnd * g_pChildWnd
Definition: childwnd.c:23
HBITMAP SizingPattern
Definition: childwnd.c:25
WCHAR Suggestions[256]
Definition: childwnd.c:27
static void SuggestKeys(HKEY hRootKey, LPCWSTR pszKeyPath, LPWSTR pszSuggestions, size_t iSuggestionsLength)
Definition: childwnd.c:139
void ResizeWnd(int cx, int cy)
Definition: childwnd.c:41
BOOL IsDefaultValue(HWND hwndLV, int i)
Definition: listview.c:108
BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result)
Definition: listview.c:545
void DestroyListView(HWND hwndLV)
Definition: listview.c:655
HMENU hPopupMenus
Definition: main.c:38
HWND hFrameWnd
Definition: main.c:35
void DestroyMainMenu()
Definition: main.c:164
HFONT hFont
Definition: main.c:53
HWND CreateTreeView(HWND hwndParent, LPWSTR pHostName, HMENU id)
Definition: treeview.c:752
#define PM_TREECONTEXT
Definition: main.h:37
#define ARRAY_SIZE(A)
Definition: main.h:33
#define LIST_WINDOW
Definition: main.h:28
#define SPLIT_MIN
Definition: main.h:31
BOOL TreeWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result)
Definition: treeview.c:641
#define TREE_WINDOW
Definition: main.h:27
#define PM_NEW
Definition: main.h:36
LPCWSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY *phRootKey)
Definition: treeview.c:88
#define PM_ROOTITEM
Definition: main.h:38
#define PM_MODIFYVALUE
Definition: main.h:35
#define ID_TREE_SUGGESTION_MIN
Definition: resource.h:156
#define IDS_MY_COMPUTER
Definition: resource.h:129
#define IDS_COLLAPSE
Definition: resource.h:191
#define IDI_ARROW
Definition: resource.h:37
#define ID_EDIT_MODIFY
Definition: resource.h:62
#define ID_TREE_EXPANDBRANCH
Definition: resource.h:93
#define ID_TREE_COLLAPSEBRANCH
Definition: resource.h:95
#define IDS_GOTO_SUGGESTED_KEY
Definition: resource.h:194
#define ID_EDIT_MODIFY_BIN
Definition: resource.h:122
#define IDS_EXPAND
Definition: resource.h:190
#define ID_TREE_SUGGESTION_MAX
Definition: resource.h:157
#define ID_EDIT_RENAME
Definition: resource.h:58
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
#define pt(x, y)
Definition: drawing.c:79
HINSTANCE hInst
Definition: dxdiag.c:13
#define SPLIT_WIDTH
Definition: eventvwr.c:45
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLdouble s
Definition: gl.h:2039
GLuint buffer
Definition: glext.h:5915
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
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
int _snwprintf(wchar_t *buffer, size_t count, const wchar_t *format,...)
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
static HICON
Definition: imagelist.c:84
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
static ATOM item
Definition: dde.c:856
#define min(a, b)
Definition: monoChain.cc:55
#define L(x)
Definition: ntvdm.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define WS_CHILD
Definition: pedump.c:617
#define WS_TABSTOP
Definition: pedump.c:634
#define WS_VISIBLE
Definition: pedump.c:620
short SHORT
Definition: pedump.c:59
#define BS_DEFPUSHBUTTON
Definition: pedump.c:652
static VOID DestroyTreeView(HWND hTreeView)
#define TreeView_SelectItem(hwnd, hitem)
Definition: commctrl.h:3481
#define TVHT_ONITEM
Definition: commctrl.h:3527
#define LVNI_SELECTED
Definition: commctrl.h:2424
#define LVNI_FOCUSED
Definition: commctrl.h:2423
#define TreeView_GetParent(hwnd, hitem)
Definition: commctrl.h:3469
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2434
#define TreeView_GetSelection(hwnd)
Definition: commctrl.h:3473
#define TreeView_GetItem(hwnd, pitem)
Definition: commctrl.h:3490
#define TreeView_GetItemRect(hwnd, hitem, prc, code)
Definition: commctrl.h:3429
#define ListView_GetSelectedCount(hwndLV)
Definition: commctrl.h:2709
#define LVM_GETITEMRECT
Definition: commctrl.h:2477
#define TVIS_EXPANDED
Definition: commctrl.h:3284
#define TVIF_CHILDREN
Definition: commctrl.h:3272
#define TreeView_HitTest(hwnd, lpht)
Definition: commctrl.h:3513
#define TVIF_STATE
Definition: commctrl.h:3269
#define LVIR_BOUNDS
Definition: commctrl.h:2472
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define WM_NOTIFY
Definition: richedit.h:61
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
#define memset(x, y, z)
Definition: compat.h:39
Definition: main.h:61
int nSplitPos
Definition: main.h:69
WCHAR szPath[MAX_PATH]
Definition: main.h:71
HWND hAddressBtnWnd
Definition: main.h:66
int nFocusPanel
Definition: main.h:68
HICON hArrowIcon
Definition: main.h:67
HWND hTreeWnd
Definition: main.h:63
HWND hListWnd
Definition: main.h:64
HWND hAddressBarWnd
Definition: main.h:65
HWND hWnd
Definition: main.h:62
Definition: tftpd.h:60
LPWSTR dwTypeData
Definition: winuser.h:3269
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
HTREEITEM hItem
Definition: commctrl.h:3521
#define max(a, b)
Definition: svc.c:63
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
#define GWLP_WNDPROC
Definition: treelist.c:66
#define GWLP_USERDATA
Definition: treelist.c:63
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define HIWORD(l)
Definition: typedefs.h:247
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
HGDIOBJ WINAPI GetStockObject(_In_ int)
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
#define PATINVERT
Definition: wingdi.h:328
#define DEFAULT_GUI_FONT
Definition: wingdi.h:909
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
HBRUSH WINAPI CreatePatternBrush(_In_ HBITMAP)
HWND WINAPI SetCapture(_In_ HWND hWnd)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define MF_BYCOMMAND
Definition: winuser.h:202
#define MIIM_STRING
Definition: winuser.h:727
#define MIIM_ID
Definition: winuser.h:722
#define WM_KEYUP
Definition: winuser.h:1716
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
BOOL WINAPI SetMenuDefaultItem(_In_ HMENU, _In_ UINT, _In_ UINT)
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IMAGE_ICON
Definition: winuser.h:212
#define AppendMenu
Definition: winuser.h:5731
#define WM_CAPTURECHANGED
Definition: winuser.h:1808
#define TPM_RIGHTBUTTON
Definition: winuser.h:2380
#define WM_CREATE
Definition: winuser.h:1608
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define BS_ICON
Definition: winuser.h:264
#define WM_SIZE
Definition: winuser.h:1611
#define WM_COMMAND
Definition: winuser.h:1740
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2203
#define IDC_ARROW
Definition: winuser.h:687
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2670
#define InsertMenuItem
Definition: winuser.h:5804
#define WM_SETFOCUS
Definition: winuser.h:1613
#define SetMenuItemInfo
Definition: winuser.h:5850
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define WM_MOUSEMOVE
Definition: winuser.h:1775
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define SIZE_MINIMIZED
Definition: winuser.h:2506
#define WM_LBUTTONDOWN
Definition: winuser.h:1776
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2105
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
#define MIIM_STATE
Definition: winuser.h:721
#define MFS_DEFAULT
Definition: winuser.h:748
#define BM_SETIMAGE
Definition: winuser.h:1922
#define WM_RBUTTONDOWN
Definition: winuser.h:1779
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define VK_RETURN
Definition: winuser.h:2201
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define MF_ENABLED
Definition: winuser.h:128
#define MFS_GRAYED
Definition: winuser.h:751
#define MF_SEPARATOR
Definition: winuser.h:137
#define BS_FLAT
Definition: winuser.h:280
#define WM_SETFONT
Definition: winuser.h:1650
#define WM_TIMER
Definition: winuser.h:1742
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 MF_BYPOSITION
Definition: winuser.h:203
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
#define HTCLIENT
Definition: winuser.h:2475
#define BS_VCENTER
Definition: winuser.h:279
HDC WINAPI GetDC(_In_opt_ HWND)
#define WM_LBUTTONUP
Definition: winuser.h:1777
#define CW_USEDEFAULT
Definition: winuser.h:225
#define WM_SETCURSOR
Definition: winuser.h:1636
#define BN_CLICKED
Definition: winuser.h:1925
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
#define WM_DESTROY
Definition: winuser.h:1609
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define WM_KEYDOWN
Definition: winuser.h:1715
#define BS_CENTER
Definition: winuser.h:260
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2906
#define IDC_SIZEWE
Definition: winuser.h:694
#define GetMenuItemInfo
Definition: winuser.h:5788
#define VK_ESCAPE
Definition: winuser.h:2214
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2053
#define MF_GRAYED
Definition: winuser.h:129
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
#define MF_DISABLED
Definition: winuser.h:130
_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:409
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

◆ CopyKeyName()

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

Definition at line 810 of file framewnd.c.

811{
812 BOOL bClipboardOpened = FALSE;
814 WCHAR szBuffer[512];
815 HGLOBAL hGlobal;
816 LPWSTR s;
817 SIZE_T cbGlobal;
818
819 if (!OpenClipboard(hWnd))
820 goto done;
821 bClipboardOpened = TRUE;
822
823 if (!EmptyClipboard())
824 goto done;
825
826 if (!GetKeyName(szBuffer, ARRAY_SIZE(szBuffer), hRootKey, keyName))
827 goto done;
828
829 cbGlobal = (wcslen(szBuffer) + 1) * sizeof(WCHAR);
830 hGlobal = GlobalAlloc(GMEM_MOVEABLE, cbGlobal);
831 if (!hGlobal)
832 goto done;
833
834 s = GlobalLock(hGlobal);
835 StringCbCopyW(s, cbGlobal, szBuffer);
836 GlobalUnlock(hGlobal);
837
839 bSuccess = TRUE;
840
841done:
842 if (bClipboardOpened)
844 return bSuccess;
845}
#define CF_UNICODETEXT
Definition: constants.h:408
BOOL GetKeyName(LPWSTR pszDest, size_t iDestLength, HKEY hRootKey, LPCWSTR lpSubKey)
Definition: edit.c:2206
static BOOLEAN bSuccess
Definition: drive.cpp:433
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define GMEM_MOVEABLE
Definition: winbase.h:294
HANDLE WINAPI SetClipboardData(_In_ UINT, _In_opt_ HANDLE)
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
BOOL WINAPI OpenClipboard(_In_opt_ HWND)
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190

Referenced by _CmdWndProc().

◆ CreateListView()

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

Definition at line 632 of file listview.c.

633{
634 RECT rcClient;
635 HWND hwndLV;
636
637 /* Get the dimensions of the parent window's client area, and create the list view control. */
638 GetClientRect(hwndParent, &rcClient);
639 hwndLV = CreateWindowExW(WS_EX_CLIENTEDGE, WC_LISTVIEW, L"List View",
641 0, 0, rcClient.right, rcClient.bottom,
642 hwndParent, id, hInst, NULL);
643 if (!hwndLV) return NULL;
644
645 /* Initialize the image list, and add items to the control. */
646 if (!CreateListColumns(hwndLV, cx)) goto fail;
647 if (!InitListViewImageLists(hwndLV)) goto fail;
648
649 return hwndLV;
650fail:
651 DestroyWindow(hwndLV);
652 return NULL;
653}
static BOOL CreateListColumns(HWND hWndListView, INT cxTotal)
Definition: listview.c:260
static BOOL InitListViewImageLists(HWND hwndLV)
Definition: listview.c:282
static HWND hwndParent
Definition: cryptui.c:300
#define LVS_SHOWSELALWAYS
Definition: commctrl.h:2267
#define LVS_REPORT
Definition: commctrl.h:2262
_Out_opt_ int * cx
Definition: commctrl.h:585
#define WC_LISTVIEW
Definition: commctrl.h:2259
#define LVS_EDITLABELS
Definition: commctrl.h:2273
BOOL WINAPI DestroyWindow(_In_ HWND)

◆ CreateNewKey()

BOOL CreateNewKey ( HWND  hwndTV,
HTREEITEM  hItem 
)

Definition at line 584 of file treeview.c.

585{
586 WCHAR szNewKeyFormat[128];
587 WCHAR szNewKey[128];
588 LPCWSTR pszKeyPath;
589 int iIndex = 1;
590 LONG nResult;
591 HKEY hRootKey = NULL, hKey = NULL, hNewKey = NULL;
593 DWORD dwDisposition;
594 HTREEITEM hNewItem;
595
596 pszKeyPath = GetItemPath(hwndTV, hItem, &hRootKey);
597 if (pszKeyPath[0] == L'\0')
598 hKey = hRootKey;
599 else if (RegOpenKeyW(hRootKey, pszKeyPath, &hKey) != ERROR_SUCCESS)
600 goto done;
601
602 if (LoadStringW(hInst, IDS_NEW_KEY, szNewKeyFormat, ARRAY_SIZE(szNewKeyFormat)) <= 0)
603 goto done;
604
605 /* Need to create a new key with a unique name */
606 do
607 {
608 wsprintf(szNewKey, szNewKeyFormat, iIndex++);
609 nResult = RegCreateKeyExW(hKey, szNewKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hNewKey, &dwDisposition);
610 if (hNewKey && dwDisposition == REG_OPENED_EXISTING_KEY)
611 {
612 RegCloseKey(hNewKey);
613 hNewKey = NULL;
614 }
615 else if (!hNewKey)
616 {
617 InfoMessageBox(hFrameWnd, MB_OK | MB_ICONERROR, NULL, L"Cannot create new key!\n\nError Code: %d", nResult);
618 goto done;
619 }
620 }
621 while(!hNewKey);
622
623 /* Insert the new key */
624 hNewItem = InsertNode(hwndTV, hItem, szNewKey);
625 if (!hNewItem)
626 goto done;
627
628 /* The new key's name is probably not appropriate yet */
629 (void)TreeView_EditLabel(hwndTV, hNewItem);
630
631 bSuccess = TRUE;
632
633done:
634 if (hKey != hRootKey && hKey)
636 if (hNewKey)
637 RegCloseKey(hNewKey);
638 return bSuccess;
639}
int InfoMessageBox(HWND hWnd, UINT uType, LPCWSTR lpTitle, LPCWSTR lpMessage,...)
Definition: error.c:51
#define IDS_NEW_KEY
Definition: resource.h:192
LPCWSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY *phRootKey)
Definition: treeview.c:88
HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPWSTR name)
Definition: treeview.c:347
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
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:1096
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3268
FxAutoRegKey hKey
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_WRITE
Definition: nt_native.h:1031
#define REG_OPENED_EXISTING_KEY
Definition: nt_native.h:1085
long LONG
Definition: pedump.c:60
#define TreeView_EditLabel(hwnd, hitem)
Definition: commctrl.h:3504
#define MB_ICONERROR
Definition: winuser.h:787
#define MB_OK
Definition: winuser.h:790
#define wsprintf
Definition: winuser.h:5865

Referenced by _CmdWndProc().

◆ CreateTreeView()

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

Definition at line 752 of file treeview.c.

753{
754 RECT rcClient;
755 HWND hwndTV;
756
757 /* Get the dimensions of the parent window's client area, and create the tree view control. */
758 GetClientRect(hwndParent, &rcClient);
761 0, 0, rcClient.right, rcClient.bottom,
762 hwndParent, id, hInst, NULL);
763 if (!hwndTV) return NULL;
764
765 /* Initialize the image list, and add items to the control. */
766 if (!InitTreeViewImageLists(hwndTV) || !InitTreeViewItems(hwndTV, pHostName))
767 {
768 DestroyWindow(hwndTV);
769 return NULL;
770 }
771 return hwndTV;
772}
static BOOL InitTreeViewImageLists(HWND hwndTV)
Definition: treeview.c:454
static BOOL InitTreeViewItems(HWND hwndTV, LPWSTR pHostName)
Definition: treeview.c:407
#define TVS_LINESATROOT
Definition: commctrl.h:3249
#define TVS_SHOWSELALWAYS
Definition: commctrl.h:3252
#define TVS_HASLINES
Definition: commctrl.h:3248
#define WC_TREEVIEW
Definition: commctrl.h:3245
#define TVS_HASBUTTONS
Definition: commctrl.h:3247
#define TVS_EDITLABELS
Definition: commctrl.h:3250

Referenced by ChildWndProc().

◆ delete_registry_key()

void delete_registry_key ( WCHAR reg_key_name)

Definition at line 1102 of file regproc.c.

1103{
1104 WCHAR *key_name = NULL;
1105 HKEY key_class;
1106
1107 if (!reg_key_name || !reg_key_name[0])
1108 return;
1109
1110 if (!(key_class = parse_key_name(reg_key_name, &key_name)))
1111 {
1112 if (key_name) *(key_name - 1) = 0;
1113#ifdef __REACTOS__
1115 return;
1116#else
1118#endif
1119 }
1120
1121 if (!key_name || !*key_name)
1122#ifdef __REACTOS__
1123 {
1124 output_message(STRING_DELETE_FAILED, reg_key_name);
1125 return;
1126 }
1127#else
1128 error_exit(STRING_DELETE_FAILED, reg_key_name);
1129#endif
1130
1131#ifdef __REACTOS__
1132 SHDeleteKey(key_class, key_name);
1133#else
1134 RegDeleteTreeW(key_class, key_name);
1135#endif
1136}
void WINAPIV output_message(unsigned int id,...)
Definition: reg.c:92
#define STRING_INVALID_SYSTEM_KEY
Definition: resource.h:54
void WINAPIV error_exit(unsigned int id,...)
Definition: regedit.c:101
static HKEY parse_key_name(WCHAR *key_name, WCHAR **key_path)
Definition: regproc.c:407
#define STRING_DELETE_FAILED
Definition: resource.h:393
LSTATUS WINAPI RegDeleteTreeW(_In_ HKEY, _In_opt_ LPCWSTR)
#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 2072 of file edit.c.

2073{
2074 WCHAR msg[128], caption[128];
2075 BOOL result = FALSE;
2076 LONG lRet;
2077 HKEY hKey;
2078
2079 lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ|KEY_SET_VALUE, &hKey);
2080 if (lRet != ERROR_SUCCESS)
2081 {
2083 return FALSE;
2084 }
2085
2088
2090 goto done;
2091
2092 lRet = SHDeleteKey(hKeyRoot, keyPath);
2093 if (lRet != ERROR_SUCCESS)
2094 {
2095 error(hwnd, IDS_BAD_KEY, keyPath);
2096 goto done;
2097 }
2098 result = TRUE;
2099
2100done:
2102 return result;
2103}
#define msg(x)
Definition: auth_time.c:54
static void error_code_messagebox(HWND hwnd, DWORD error_code)
Definition: edit.c:179
#define IDS_QUERY_DELETE_KEY_ONE
Definition: resource.h:153
#define IDS_BAD_KEY
Definition: resource.h:142
#define IDS_QUERY_DELETE_KEY_CONFIRM
Definition: resource.h:155
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
GLuint64EXT * result
Definition: glext.h:11304
#define error(str)
Definition: mkdosfs.c:1605
#define KEY_READ
Definition: nt_native.h:1023
#define KEY_SET_VALUE
Definition: nt_native.h:1017
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define MB_YESNO
Definition: winuser.h:817
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define MB_ICONQUESTION
Definition: winuser.h:789
#define IDYES
Definition: winuser.h:835

Referenced by _CmdWndProc(), and DECLARE_INTERFACE_().

◆ DeleteNode()

BOOL DeleteNode ( HWND  hwndTV,
HTREEITEM  hItem 
)

Definition at line 118 of file treeview.c.

119{
120 if (!hItem) hItem = TreeView_GetSelection(hwndTV);
121 if (!hItem) return FALSE;
122 return TreeView_DeleteItem(hwndTV, hItem);
123}
#define TreeView_DeleteItem(hwnd, hitem)
Definition: commctrl.h:3415

◆ DestroyListView()

void DestroyListView ( HWND  hwndLV)

Definition at line 655 of file listview.c.

656{
657 INT count, i;
659
661 for (i = 0; i < count; i++)
662 {
663 item.mask = LVIF_PARAM;
664 item.iItem = i;
665 (void)ListView_GetItem(hwndLV, &item);
666 free(((LINE_INFO*)item.lParam)->name);
667 HeapFree(GetProcessHeap(), 0, (void*)item.lParam);
668 }
669
670}
#define free
Definition: debug_ros.c:5
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2307
#define LVIF_PARAM
Definition: commctrl.h:2311
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2394
int32_t INT
Definition: typedefs.h:58

Referenced by ChildWndProc(), and RefreshListView().

◆ DestroyMainMenu()

void DestroyMainMenu ( void  )

Definition at line 164 of file main.c.

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

Referenced by ChildWndProc().

◆ DestroyTreeView()

void DestroyTreeView ( HWND  hwndTV)

Definition at line 774 of file treeview.c.

775{
777
779
780 /* Destroy the image list associated with the tree view control */
783}
static LPWSTR pathBuffer
Definition: treeview.c:31
HIMAGELIST himl
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
#define TVSIL_NORMAL
Definition: commctrl.h:3443
#define TreeView_GetImageList(hwnd, iImage)
Definition: commctrl.h:3441

◆ error_exit()

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

Definition at line 101 of file regedit.c.

102{
103 WCHAR fmt[1536];
104 va_list va_args;
105
107 {
108#ifndef __REACTOS__
109 WINE_FIXME("LoadString failed with %lu\n", GetLastError());
110#endif
111 return;
112 }
113 va_start(va_args, id);
114 output_formatstring(fmt, va_args);
115 va_end(va_args);
116
117 exit(0); /* regedit.exe always terminates with error code zero */
118}
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
static void output_formatstring(const WCHAR *fmt, va_list va_args)
Definition: regedit.c:63
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define WINE_FIXME
Definition: debug.h:366
#define exit(n)
Definition: config.h:202
Definition: dsound.c:943
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

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;
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}
TCHAR lpTitle[80]
Definition: ctm.c:69
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
Status
Definition: gdiplustypes.h:25
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define LANG_NEUTRAL
Definition: nls.h:22
#define MAKELANGID(p, s)
Definition: nls.h:15
#define SUBLANG_DEFAULT
Definition: nls.h:168
#define args
Definition: format.c:66
Definition: match.c:390
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:423
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:419

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 1579 of file regproc.c.

1580{
1581 BOOL unicode = (format == REG_FORMAT_5);
1582
1583 if (path && *path)
1584 return export_key(file_name, path, unicode);
1585 else
1586 return export_all(file_name, path, unicode);
1587}
#define REG_FORMAT_5
Definition: main.h:44
static BOOL export_all(WCHAR *file_name, WCHAR *path, BOOL unicode)
Definition: regproc.c:1543
static BOOL export_key(WCHAR *file_name, WCHAR *path, BOOL unicode)
Definition: regproc.c:1514
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
static LPCWSTR file_name
Definition: protocol.c:147

Referenced by ExportRegistryFile(), and PerformRegAction().

◆ ExportRegistryFile()

BOOL ExportRegistryFile ( HWND  hWnd)

Definition at line 593 of file framewnd.c.

594{
595 BOOL bRet = FALSE;
597 WCHAR ExportKeyPath[_MAX_PATH] = {0};
598 WCHAR Caption[128], szTitle[512], szText[512];
599 HKEY hKeyRoot;
600 LPCWSTR pszKeyPath;
601
602 /* Figure out which key path we are exporting */
603 pszKeyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot);
604 GetKeyName(ExportKeyPath, ARRAY_SIZE(ExportKeyPath), hKeyRoot, pszKeyPath);
605
607 LoadStringW(hInst, IDS_EXPORT_REG_FILE, Caption, ARRAY_SIZE(Caption));
608 ofn.lpstrTitle = Caption;
609
610 /* Only set the path if a key (not the root node) is selected */
611 if (hKeyRoot != 0)
612 {
613 ofn.lCustData = (LPARAM) ExportKeyPath;
614 }
618 if (GetSaveFileName(&ofn))
619 {
620 switch (ofn.nFilterIndex)
621 {
622 case 2: /* Registry Hive Files */
623 {
624 LONG lResult;
625 HKEY hSubKey;
626
627 /* Open the subkey */
628 lResult = RegOpenKeyExW(hKeyRoot, pszKeyPath, 0, KEY_READ, &hSubKey);
629 if (lResult == ERROR_SUCCESS)
630 {
631 /* Enable the 'backup' privilege, save the hive then disable the privilege */
633 lResult = RegSaveKeyW(hSubKey, ofn.lpstrFile, NULL);
634 if (lResult == ERROR_ALREADY_EXISTS)
635 {
636 /*
637 * We are here, that means that we already said "yes" to the confirmation dialog.
638 * So we absolutely want to replace the hive file.
639 */
641 {
642 /* Try again */
643 lResult = RegSaveKeyW(hSubKey, ofn.lpstrFile, NULL);
644 }
645 }
647
648 if (lResult != ERROR_SUCCESS)
649 {
650 /*
651 * If we are here, it's because RegSaveKeyW has failed for any reason.
652 * The problem is that even if it has failed, it has created or
653 * replaced the exported hive file with a new empty file. We don't
654 * want to keep this file, so we delete it.
655 */
657 }
658
659 /* Close the subkey */
660 RegCloseKey(hSubKey);
661 }
662
663 /* Set the return value */
664 bRet = (lResult == ERROR_SUCCESS);
665
666 /* Display error, if any */
667 if (!bRet) ErrorMessageBox(hWnd, Caption, lResult);
668
669 break;
670 }
671
672 case 1: /* Windows Registry Editor Version 5.00 */
673 case 3: /* REGEDIT4 */
674 default: /* All files ==> use Windows Registry Editor Version 5.00 */
675 {
676 if (!export_registry_key(ofn.lpstrFile, ExportKeyPath,
678 : REG_FORMAT_5)))
679 {
680 /* Error creating the file */
682 LoadStringW(hInst, IDS_EXPORT_ERROR, szText, ARRAY_SIZE(szText));
684 bRet = FALSE;
685 }
686 else
687 {
688 bRet = TRUE;
689 }
690
691 break;
692 }
693
694 case 4: /* Text File */
695 {
696 bRet = txt_export_registry_key(ofn.lpstrFile, ExportKeyPath);
697 if (!bRet)
698 {
699 /* Error creating the file */
701 LoadStringW(hInst, IDS_EXPORT_ERROR, szText, ARRAY_SIZE(szText));
703 }
704 break;
705 }
706 }
707 }
708 else
709 {
711 }
712
713 return bRet;
714}
#define SE_BACKUP_NAME
#define IDS_APP_TITLE
Definition: resource.h:10
int ErrorMessageBox(HWND hWnd, LPCWSTR lpTitle, DWORD dwErrorCode,...)
Definition: error.c:24
static BOOL CheckCommDlgError(HWND hWnd)
Definition: framewnd.c:191
static BOOL InitOpenFileName(HWND hWnd, OPENFILENAME *pofn, BOOL bSave)
Definition: framewnd.c:257
static BOOL EnablePrivilege(LPCWSTR lpszPrivilegeName, LPCWSTR lpszSystemName, BOOL bEnablePrivilege)
Definition: framewnd.c:328
static UINT_PTR CALLBACK ExportRegistryFile_OFNHookProc(HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: framewnd.c:539
#define REG_FORMAT_4
Definition: main.h:45
BOOL export_registry_key(WCHAR *file_name, WCHAR *path, DWORD format)
Definition: regproc.c:1579
BOOL txt_export_registry_key(LPCWSTR file_name, LPCWSTR path)
Definition: txtproc.c:401
#define IDS_EXPORT_REG_FILE
Definition: resource.h:131
#define IDS_EXPORT_ERROR
Definition: resource.h:199
#define IDD_EXPORTRANGE
Definition: resource.h:42
#define GetSaveFileName
Definition: commdlg.h:666
#define OFN_ENABLEHOOK
Definition: commdlg.h:99
#define OFN_ENABLETEMPLATE
Definition: commdlg.h:102
LONG WINAPI RegSaveKeyW(HKEY hKey, LPCWSTR lpFile, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: reg.c:4617
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
#define _MAX_PATH
Definition: utility.h:77
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
OPENFILENAME ofn
Definition: sndrec32.cpp:56
LPARAM lCustData
Definition: commdlg.h:346
LPCSTR lpTemplateName
Definition: commdlg.h:348
DWORD nFilterIndex
Definition: commdlg.h:335
LPCSTR lpstrTitle
Definition: commdlg.h:341
LPSTR lpstrFile
Definition: commdlg.h:336
DWORD Flags
Definition: commdlg.h:342
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:347

Referenced by _CmdWndProc().

◆ FindDialog()

void FindDialog ( HWND  hWnd)

Definition at line 824 of file find.c.

825{
827 hWnd, FindDialogProc, 0) != 0)
828 {
830 }
831}
void FindNextMessageBox(HWND hWnd)
Definition: find.c:812
static INT_PTR CALLBACK FindDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: find.c:697
#define IDD_FIND
Definition: resource.h:48
#define GetModuleHandle
Definition: winbase.h:3827
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by _CmdWndProc(), and FindNext().

◆ FindNext()

BOOL FindNext ( HWND  hWnd)

Definition at line 622 of file find.c.

623{
624 HKEY hKeyRoot;
625 LPCWSTR pszKeyPath;
626 BOOL fSuccess;
627 WCHAR szFullKey[512];
628 LPCWSTR pszValueName;
629 LPWSTR pszFoundSubKey, pszFoundValueName;
630
631 if (wcslen(s_szFindWhat) == 0)
632 {
634 return TRUE;
635 }
636
638
639 pszKeyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot);
640 if (pszKeyPath == NULL)
641 {
642 hKeyRoot = HKEY_CLASSES_ROOT;
643 pszKeyPath = s_empty;
644 }
645
646 /* Create abort find dialog */
650 {
653 }
654 s_bAbort = FALSE;
655
656 pszValueName = GetValueName(g_pChildWnd->hListWnd, -1);
657
662
663 fSuccess = RegFindWalk(&hKeyRoot, pszKeyPath, pszValueName,
664 &pszFoundSubKey, &pszFoundValueName);
665
670
672 {
675 }
676
677 if (fSuccess)
678 {
679 GetKeyName(szFullKey, ARRAY_SIZE(szFullKey), hKeyRoot, pszFoundSubKey);
680 SelectNode(g_pChildWnd->hTreeWnd, szFullKey);
681 free(pszFoundSubKey);
682
683 if (pszFoundValueName != NULL)
684 {
685 SetValueName(g_pChildWnd->hListWnd, pszFoundValueName);
686 free(pszFoundValueName);
688 }
689 else
690 {
692 }
693 }
694 return fSuccess || s_bAbort;
695}
VOID SetValueName(HWND hwndLV, LPCWSTR pszValueName)
Definition: listview.c:84
BOOL RegFindWalk(HKEY *phKey, LPCWSTR pszSubKey, LPCWSTR pszValueName, LPWSTR *ppszFoundSubKey, LPWSTR *ppszFoundValueName)
Definition: find.c:346
static BOOL s_bAbort
Definition: find.c:31
static HWND s_hwndAbortDialog
Definition: find.c:30
static const WCHAR s_empty[]
Definition: find.c:36
static INT_PTR CALLBACK AbortFindDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: find.c:594
void FindDialog(HWND hWnd)
Definition: find.c:824
static DWORD GetFindFlags(void)
Definition: find.c:547
static WCHAR s_szFindWhat[256]
Definition: find.c:27
static DWORD s_dwFlags
Definition: find.c:33
WCHAR * GetValueName(HWND hwndLV, int iStartAt)
Definition: listview.c:55
BOOL SelectNode(HWND hwndTV, LPCWSTR keyPath)
Definition: treeview.c:785
#define IDD_FINDING
Definition: resource.h:49
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI UpdateWindow(_In_ HWND)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define CreateDialogW(h, n, w, f)
Definition: winuser.h:4281
#define SW_SHOW
Definition: winuser.h:775

Referenced by FindNextMessageBox().

◆ FindNextMessageBox()

void FindNextMessageBox ( HWND  hWnd)

Definition at line 812 of file find.c.

813{
814 if (!FindNext(hWnd))
815 {
816 WCHAR msg[128], caption[128];
817
819 LoadStringW(hInst, IDS_APP_TITLE, caption, ARRAY_SIZE(caption));
821 }
822}
BOOL FindNext(HWND hWnd)
Definition: find.c:622
#define IDS_FINISHEDFIND
Definition: resource.h:201
#define MB_ICONINFORMATION
Definition: winuser.h:802

Referenced by _CmdWndProc(), and FindDialog().

◆ FrameWndProc()

LRESULT CALLBACK FrameWndProc ( HWND  hWnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1385 of file framewnd.c.

1386{
1387 RECT rc;
1388 switch (message)
1389 {
1390 case WM_CREATE:
1391 // For now, the Help dialog item is disabled because of lacking of HTML Help support
1393 GetClientRect(hWnd, &rc);
1395 rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
1396 hWnd, (HMENU)0, hInst, 0);
1397 break;
1398 case WM_COMMAND:
1401 break;
1402 case WM_ACTIVATE:
1403 if (LOWORD(hWnd) && g_pChildWnd)
1405 break;
1406 case WM_SIZE:
1408 break;
1409 case WM_TIMER:
1410 break;
1411 case WM_INITMENU:
1413 break;
1414 case WM_ENTERMENULOOP:
1416 break;
1417 case WM_EXITMENULOOP:
1419 break;
1420 case WM_MENUSELECT:
1422 break;
1423 case WM_SYSCOLORCHANGE:
1424 /* Forward WM_SYSCOLORCHANGE to common controls */
1427 break;
1428 case WM_DESTROY:
1429 WinHelpW(hWnd, L"regedit", HELP_QUIT, 0);
1430 SaveSettings();
1431 PostQuitMessage(0);
1432 default:
1434 }
1435 return 0;
1436}
void SaveSettings(void)
Definition: settings.c:115
static void resize_frame_client(HWND hWnd)
Definition: framewnd.c:55
static void OnEnterMenuLoop(HWND hWnd)
Definition: framewnd.c:117
static void OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
Definition: framewnd.c:137
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: framewnd.c:1056
static void OnExitMenuLoop(HWND hWnd)
Definition: framewnd.c:129
static void OnInitMenu(HWND hWnd)
Definition: framewnd.c:65
WCHAR szChildClass[MAX_LOADSTRING]
Definition: main.c:45
#define ID_HELP_HELPTOPICS
Definition: resource.h:74
#define HELP_QUIT
Definition: winuser.h:2414
BOOL WINAPI WinHelpW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_ UINT, _In_ ULONG_PTR)
#define WM_INITMENU
Definition: winuser.h:1745
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1626
#define WM_ACTIVATE
Definition: winuser.h:1612
#define WM_ENTERMENULOOP
Definition: winuser.h:1804
#define WM_EXITMENULOOP
Definition: winuser.h:1805
#define WM_MENUSELECT
Definition: winuser.h:1747
HMENU WINAPI GetMenu(_In_ HWND)

◆ 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_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_CURRENT_CONFIG
Definition: winreg.h:15
#define HKEY_DYN_DATA
Definition: winreg.h:16
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define HKEY_USERS
Definition: winreg.h:13

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
94 if (!pathBuffer)
95 {
97 }
98 if (!pathBuffer)
99 {
100 return NULL;
101 }
102
104
105 maxLen = (int) HeapSize(GetProcessHeap(), 0, pathBuffer);
106
107 if (!hItem)
108 {
110 }
111 if (maxLen == -1 || !hItem || !get_item_path(hwndTV, hItem, phRootKey, &pathBuffer, &pathLen, &maxLen))
112 {
113 return NULL;
114 }
115 return pathBuffer;
116}
static BOOL get_item_path(HWND hwndTV, HTREEITEM hItem, HKEY *phKey, LPWSTR *pKeyPath, int *pPathLen, int *pMaxLen)
Definition: treeview.c:40
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define UNICODE_NULL
SIZE_T WINAPI HeapSize(HANDLE, DWORD, LPCVOID)

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 2206 of file edit.c.

2207{
2208 LPCWSTR pszRootKey;
2209
2210 if (hRootKey == HKEY_CLASSES_ROOT)
2211 pszRootKey = L"HKEY_CLASSES_ROOT";
2212 else if (hRootKey == HKEY_CURRENT_USER)
2213 pszRootKey = L"HKEY_CURRENT_USER";
2214 else if (hRootKey == HKEY_LOCAL_MACHINE)
2215 pszRootKey = L"HKEY_LOCAL_MACHINE";
2216 else if (hRootKey == HKEY_USERS)
2217 pszRootKey = L"HKEY_USERS";
2218 else if (hRootKey == HKEY_CURRENT_CONFIG)
2219 pszRootKey = L"HKEY_CURRENT_CONFIG";
2220 else if (hRootKey == HKEY_DYN_DATA)
2221 pszRootKey = L"HKEY_DYN_DATA";
2222 else
2223 return FALSE;
2224
2225 if (lpSubKey[0])
2226 _snwprintf(pszDest, iDestLength, L"%s\\%s", pszRootKey, lpSubKey);
2227 else
2228 _snwprintf(pszDest, iDestLength, L"%s", pszRootKey);
2229 return TRUE;
2230}

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}
#define malloc
Definition: debug_ros.c:4
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
GLenum GLsizei len
Definition: glext.h:6722
WCHAR strW[12]
Definition: clipboard.c:2029
char strA[12]
Definition: clipboard.c:2028

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}
struct tagLINE_INFO * PLINE_INFO
if(dx< 0)
Definition: linetemp.h:194
LPWSTR name
Definition: listview.c:34
int iSubItem
Definition: commctrl.h:2362
UINT mask
Definition: commctrl.h:2360
LPARAM lParam
Definition: commctrl.h:2368

Referenced by _CmdWndProc(), and FindNext().

◆ import_registry_file()

BOOL import_registry_file ( FILE reg_file)

Definition at line 1054 of file regproc.c.

1055{
1056 BYTE s[2];
1057 struct parser parser;
1058 WCHAR *pos;
1059
1060 if (!reg_file || (fread(s, 2, 1, reg_file) != 1))
1061 return FALSE;
1062
1063 parser.is_unicode = (s[0] == 0xff && s[1] == 0xfe);
1065
1066 parser.file = reg_file;
1067 parser.two_wchars[0] = s[0];
1068 parser.two_wchars[1] = s[1];
1069 parser.reg_version = -1;
1070 parser.hkey = NULL;
1073 parser.parse_type = 0;
1074 parser.data_type = 0;
1075 parser.data = NULL;
1076 parser.data_size = 0;
1079
1081
1082 /* parser main loop */
1083 while (pos)
1085
1088
1090 close_key(&parser);
1091
1092 return TRUE;
1093}
static WCHAR * get_lineA(FILE *fp)
Definition: regproc.c:941
@ HEADER
Definition: regproc.c:124
@ REG_VERSION_INVALID
Definition: regproc.c:522
@ REG_VERSION_FUZZY
Definition: regproc.c:521
static WCHAR * get_lineW(FILE *fp)
Definition: regproc.c:999
static WCHAR *(* get_line)(FILE *)
Definition: regproc.c:119
static const parser_state_func parser_funcs[NB_PARSER_STATES]
Definition: regproc.c:182
_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 close_key(k)
Definition: reg_test.h:52
Definition: import.c:81
BOOL is_unicode
Definition: import.c:84
BOOL backslash
Definition: import.c:94
enum parser_state state
Definition: import.c:95
WCHAR * value_name
Definition: import.c:89
WCHAR two_wchars[2]
Definition: import.c:83
short int reg_version
Definition: import.c:85
DWORD data_size
Definition: import.c:93
void * data
Definition: import.c:92
HKEY hkey
Definition: import.c:87
DWORD data_type
Definition: import.c:91
DWORD parse_type
Definition: import.c:90
WCHAR * key_name
Definition: import.c:88
FILE * file
Definition: import.c:82
unsigned char BYTE
Definition: xxhash.c:193

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;
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}
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
_CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest, size_t _Count, const wchar_t *_Format, va_list _Args)
_Check_return_ _CRTIMP int __cdecl _vscwprintf(_In_z_ _Printf_format_string_ const wchar_t *_Format, va_list _ArgList)
#define LPTR
Definition: winbase.h:381

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

◆ InsertNode()

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

Definition at line 347 of file treeview.c.

348{
350 HTREEITEM hNewItem = 0;
352
353 /* Default to the current selection */
354 if (!hItem)
355 {
357 if (!hItem)
358 return FALSE;
359 }
360
361 memset(&item, 0, sizeof(item));
362 item.hItem = hItem;
364 if (!TreeView_GetItem(hwndTV, &item))
365 return FALSE;
366
367 if (item.state & TVIS_EXPANDEDONCE)
368 {
369 hNewItem = AddEntryToTree(hwndTV, hItem, name, 0, 0);
371 }
372 else
373 {
375 item.hItem = hItem;
376 item.cChildren = 1;
377 if (!TreeView_SetItem(hwndTV, &item))
378 return FALSE;
379 }
380
382 if (!hNewItem)
383 {
384 for(hNewItem = TreeView_GetChild(hwndTV, hItem); hNewItem; hNewItem = TreeView_GetNextSibling(hwndTV, hNewItem))
385 {
386 item.mask = TVIF_HANDLE | TVIF_TEXT;
387 item.hItem = hNewItem;
388 item.pszText = buf;
389 item.cchTextMax = ARRAY_SIZE(buf);
390 if (!TreeView_GetItem(hwndTV, &item)) continue;
391 if (wcscmp(name, item.pszText) == 0) break;
392 }
393 }
394 if (hNewItem) (void)TreeView_SelectItem(hwndTV, hNewItem);
395
396 return hNewItem;
397}
#define MAX_NEW_KEY_LEN
Definition: main.h:41
static HTREEITEM AddEntryToTree(HWND hwndTV, HTREEITEM hParent, LPWSTR label, HKEY hKey, DWORD dwChildren)
Definition: treeview.c:126
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define TVIF_TEXT
Definition: commctrl.h:3266
#define TreeView_Expand(hwnd, hitem, code)
Definition: commctrl.h:3420
#define TreeView_GetChild(hwnd, hitem)
Definition: commctrl.h:3466
#define TVIS_EXPANDEDONCE
Definition: commctrl.h:3285
#define TVE_EXPAND
Definition: commctrl.h:3423
#define TVM_SORTCHILDREN
Definition: commctrl.h:3541
#define TVIF_HANDLE
Definition: commctrl.h:3270
#define TreeView_GetNextSibling(hwnd, hitem)
Definition: commctrl.h:3467
#define TreeView_SetItem(hwnd, pitem)
Definition: commctrl.h:3497
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
Definition: name.c:39
HTREEITEM hItem
Definition: treelist.h:37

Referenced by CreateNewKey().

◆ IsDefaultValue()

BOOL IsDefaultValue ( HWND  hwndLV,
int  i 
)

Definition at line 108 of file listview.c.

109{
110 PLINE_INFO lineinfo;
112
113 Item.mask = LVIF_PARAM;
114 Item.iItem = i;
115 if(ListView_GetItem(hwndLV, &Item))
116 {
117 lineinfo = (PLINE_INFO)Item.lParam;
118 return lineinfo && (!lineinfo->name || !wcscmp(lineinfo->name, L""));
119 }
120 return FALSE;
121}
_In_ WDFCOLLECTION _In_ WDFOBJECT Item

Referenced by ChildWndProc().

◆ ListWndNotifyProc()

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

Definition at line 545 of file listview.c.

546{
548 int iSortingColumn;
550 *Result = TRUE;
551 switch (((LPNMHDR)lParam)->code)
552 {
553 case LVN_GETDISPINFO:
555 return TRUE;
556 case LVN_COLUMNCLICK:
557 iSortingColumn = ((LPNMLISTVIEW)lParam)->iSubItem;
558 (void)ListView_Sort(hWnd, iSortingColumn, g_iSortedColumn);
559 g_iSortedColumn = iSortingColumn;
560 return TRUE;
561 case NM_DBLCLK:
562 case NM_RETURN:
563 {
565 }
566 return TRUE;
567 case NM_SETFOCUS:
569 break;
572 if(Info)
573 {
574 PLINE_INFO lineinfo = (PLINE_INFO)Info->item.lParam;
575 if(!lineinfo->name || !wcscmp(lineinfo->name, L""))
576 {
577 *Result = TRUE;
578 }
579 else
580 {
581 *Result = FALSE;
582 }
583 }
584 else
585 *Result = TRUE;
586 return TRUE;
587 case LVN_ENDLABELEDIT:
589 if(Info && Info->item.pszText)
590 {
591 PLINE_INFO lineinfo = (PLINE_INFO)Info->item.lParam;
592 if(!lineinfo->name || !wcscmp(lineinfo->name, L""))
593 {
594 *Result = FALSE;
595 }
596 else
597 {
598 if(wcslen(Info->item.pszText) == 0)
599 {
600 WCHAR msg[128], caption[128];
601
604 MessageBoxW(0, msg, caption, 0);
605 *Result = TRUE;
606 }
607 else
608 {
609 HKEY hKeyRoot;
610 LPCWSTR keyPath;
611 LONG lResult;
612
613 keyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot);
614 lResult = RenameValue(hKeyRoot, keyPath, Info->item.pszText, lineinfo->name);
615 lineinfo->name = realloc(lineinfo->name, (wcslen(Info->item.pszText)+1)*sizeof(WCHAR));
616 if (lineinfo->name != NULL)
617 wcscpy(lineinfo->name, Info->item.pszText);
618
619 *Result = TRUE;
620 return (lResult == ERROR_SUCCESS);
621 }
622 }
623 }
624 else
625 *Result = TRUE;
626
627 return TRUE;
628 }
629 return FALSE;
630}
LONG RenameValue(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpDestValue, LPCWSTR lpSrcValue)
Definition: edit.c:2140
static void OnGetDispInfo(NMLVDISPINFO *plvdi)
Definition: listview.c:314
static INT g_iSortedColumn
Definition: listview.c:49
#define IDS_ERR_RENVAL_CAPTION
Definition: resource.h:138
#define IDS_ERR_RENVAL_TOEMPTY
Definition: resource.h:139
#define realloc
Definition: debug_ros.c:6
#define ListView_Sort(hListView, iSortingColumn)
Definition: listview.h:32
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define LVN_COLUMNCLICK
Definition: commctrl.h:3139
#define NM_DBLCLK
Definition: commctrl.h:131
#define LVN_GETDISPINFO
Definition: commctrl.h:3160
#define LVN_ENDLABELEDIT
Definition: commctrl.h:3159
#define NMLVDISPINFO
Definition: commctrl.h:3182
#define LVN_BEGINLABELEDIT
Definition: commctrl.h:3158
#define NM_RETURN
Definition: commctrl.h:132
struct tagNMLISTVIEW * LPNMLISTVIEW
#define NM_SETFOCUS
Definition: commctrl.h:135
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
Definition: inflate.c:139
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
#define MAKEWPARAM(l, h)
Definition: winuser.h:4009

Referenced by ChildWndProc().

◆ LoadSettings()

void LoadSettings ( void  Dlg)

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 IDC_FONTCOMBO
Definition: resource.h:12
#define IDC_CHECK_ADVANCED
Definition: resource.h:26
#define IDC_COMBO_CHARSET
Definition: resource.h:21
LONG QueryStringValue(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpValueName, LPTSTR pszBuffer, DWORD dwBufferLen)
Definition: settings.c:19
const TCHAR g_szGeneralRegKey[]
Definition: settings.c:16
HWND hCharmapDlg
Definition: charmap.c:21
VOID ChangeMapFont(HWND hDlg)
Definition: charmap.c:161
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
#define REG_DWORD
Definition: sdbapi.c:596
unsigned char * LPBYTE
Definition: typedefs.h:53
#define _T(x)
Definition: vfdio.h:22
#define ComboBox_SetCurSel(hwndCtl, index)
Definition: windowsx.h:66
#define ComboBox_FindStringExact(hwndCtl, indexStart, lpszFind)
Definition: windowsx.h:47
#define RegOpenKeyEx
Definition: winreg.h:520
#define RegQueryValueEx
Definition: winreg.h:524
#define CB_ERR
Definition: winuser.h:2435
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define BM_CLICK
Definition: winuser.h:1917
#define SendDlgItemMessage
Definition: winuser.h:5842
char TCHAR
Definition: xmlstorage.h:189

◆ ModifyValue()

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

Definition at line 1656 of file edit.c.

1657{
1658 DWORD type;
1659 LONG lRet;
1660 BOOL result = FALSE;
1661
1662 if (!hKey)
1663 return FALSE;
1664
1665 editValueName = valueName;
1666
1667 lRet = RegQueryValueExW(hKey, valueName, 0, &type, 0, &valueDataLen);
1668 if (lRet != ERROR_SUCCESS && (valueName == NULL || !valueName[0]))
1669 {
1670 lRet = ERROR_SUCCESS; /* Allow editing of (Default) values which don't exist */
1671 type = REG_SZ;
1672 valueDataLen = 0;
1675 }
1676
1677 if (lRet != ERROR_SUCCESS)
1678 {
1679 error(hwnd, IDS_BAD_VALUE, valueName);
1680 goto done;
1681 }
1682
1683 if (EditBin == FALSE && ((type == REG_SZ) || (type == REG_EXPAND_SZ)))
1684 {
1685 if (valueDataLen > 0)
1686 {
1688 {
1690 goto done;
1691 }
1692 lRet = RegQueryValueExW(hKey, valueName, 0, 0, (LPBYTE)stringValueData, &valueDataLen);
1693 if (lRet != ERROR_SUCCESS)
1694 {
1695 error(hwnd, IDS_BAD_VALUE, valueName);
1696 goto done;
1697 }
1698 }
1699 else
1700 {
1702 }
1703
1705 {
1706 if (stringValueData)
1707 {
1708 lRet = RegSetValueExW(hKey, valueName, 0, type, (LPBYTE)stringValueData, (DWORD) (wcslen(stringValueData) + 1) * sizeof(WCHAR));
1709 }
1710 else
1711 {
1712 lRet = RegSetValueExW(hKey, valueName, 0, type, NULL, 0);
1713 }
1714 if (lRet == ERROR_SUCCESS)
1715 result = TRUE;
1716 }
1717 }
1718 else if (EditBin == FALSE && type == REG_MULTI_SZ)
1719 {
1720 if (valueDataLen > 0)
1721 {
1722 size_t llen, listlen, nl_len;
1723 LPWSTR src, lines = NULL;
1724
1726 {
1728 goto done;
1729 }
1730 lRet = RegQueryValueExW(hKey, valueName, 0, 0, (LPBYTE)stringValueData, &valueDataLen);
1731 if (lRet != ERROR_SUCCESS)
1732 {
1733 error(hwnd, IDS_BAD_VALUE, valueName);
1734 goto done;
1735 }
1736
1737 /* convert \0 to \r\n */
1739 nl_len = wcslen(L"\r\n") * sizeof(WCHAR);
1740 listlen = sizeof(WCHAR);
1741 lines = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, listlen + sizeof(WCHAR));
1742 while(*src != L'\0')
1743 {
1744 llen = wcslen(src);
1745 if(llen == 0)
1746 break;
1747 listlen += (llen * sizeof(WCHAR)) + nl_len;
1749 wcscat(lines, src);
1750 wcscat(lines, L"\r\n");
1751 src += llen + 1;
1752 }
1755 }
1756 else
1757 {
1759 }
1760
1762 {
1763 if (stringValueData)
1764 {
1765 /* convert \r\n to \0 */
1766 BOOL EmptyLines = FALSE;
1767 LPWSTR src, lines, nl;
1768 size_t linechars, buflen, c_nl, dest;
1769
1771 buflen = sizeof(WCHAR);
1772 lines = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, buflen + sizeof(WCHAR));
1773 c_nl = wcslen(L"\r\n");
1774 dest = 0;
1775 while(*src != L'\0')
1776 {
1777 if((nl = wcsstr(src, L"\r\n")))
1778 {
1779 linechars = nl - src;
1780 if(nl == src)
1781 {
1782 EmptyLines = TRUE;
1783 src = nl + c_nl;
1784 continue;
1785 }
1786 }
1787 else
1788 {
1789 linechars = wcslen(src);
1790 }
1791 if(linechars > 0)
1792 {
1793 buflen += ((linechars + 1) * sizeof(WCHAR));
1795 memcpy((lines + dest), src, linechars * sizeof(WCHAR));
1796 dest += linechars;
1797 lines[dest++] = L'\0';
1798 }
1799 else
1800 {
1801 EmptyLines = TRUE;
1802 }
1803 src += linechars + (nl != NULL ? c_nl : 0);
1804 }
1805 lines[++dest] = L'\0';
1806
1807 if(EmptyLines)
1808 {
1810 }
1811
1812 lRet = RegSetValueExW(hKey, valueName, 0, type, (LPBYTE)lines, (DWORD) buflen);
1814 }
1815 else
1816 {
1817 lRet = RegSetValueExW(hKey, valueName, 0, type, NULL, 0);
1818 }
1819 if (lRet == ERROR_SUCCESS)
1820 result = TRUE;
1821 }
1822 }
1823 else if (EditBin == FALSE && type == REG_DWORD)
1824 {
1825 lRet = RegQueryValueExW(hKey, valueName, 0, 0, (LPBYTE)&dwordValueData, &valueDataLen);
1826 if (lRet != ERROR_SUCCESS)
1827 {
1828 error(hwnd, IDS_BAD_VALUE, valueName);
1829 goto done;
1830 }
1831
1833 {
1834 lRet = RegSetValueExW(hKey, valueName, 0, type, (LPBYTE)&dwordValueData, sizeof(DWORD));
1835 if (lRet == ERROR_SUCCESS)
1836 result = TRUE;
1837 }
1838 }
1839 else if (EditBin == FALSE && type == REG_RESOURCE_LIST)
1840 {
1841 if (valueDataLen > 0)
1842 {
1844 if (resourceValueData == NULL)
1845 {
1847 goto done;
1848 }
1849
1850 lRet = RegQueryValueExW(hKey, valueName, 0, 0, (LPBYTE)resourceValueData, &valueDataLen);
1851 if (lRet != ERROR_SUCCESS)
1852 {
1853 error(hwnd, IDS_BAD_VALUE, valueName);
1854 goto done;
1855 }
1856 }
1857 else
1858 {
1860 }
1861
1863 {
1864 }
1865 }
1866 else if (EditBin == FALSE && type == REG_FULL_RESOURCE_DESCRIPTOR)
1867 {
1868 if (valueDataLen > 0)
1869 {
1871 if (resourceValueData == NULL)
1872 {
1874 goto done;
1875 }
1876
1877 lRet = RegQueryValueExW(hKey, valueName, 0, 0, (LPBYTE)&resourceValueData->List[0], &valueDataLen);
1878 if (lRet != ERROR_SUCCESS)
1879 {
1880 error(hwnd, IDS_BAD_VALUE, valueName);
1881 goto done;
1882 }
1883
1886 }
1887 else
1888 {
1890 }
1891
1893 {
1894 }
1895 }
1896 else if (EditBin == FALSE && type == REG_RESOURCE_REQUIREMENTS_LIST)
1897 {
1898 if (valueDataLen > 0)
1899 {
1902 {
1904 goto done;
1905 }
1906
1907 lRet = RegQueryValueExW(hKey, valueName, 0, 0, (LPBYTE)requirementsValueData, &valueDataLen);
1908 if (lRet != ERROR_SUCCESS)
1909 {
1910 error(hwnd, IDS_BAD_VALUE, valueName);
1911 goto done;
1912 }
1913
1914 }
1915 else
1916 {
1918 }
1919
1921 {
1922 }
1923 }
1924 else if ((EditBin != FALSE) || (type == REG_NONE) || (type == REG_BINARY))
1925 {
1926 if(valueDataLen > 0)
1927 {
1929 {
1931 goto done;
1932 }
1933
1934 /* Use the unicode version, so editing strings in binary mode is correct */
1935 lRet = RegQueryValueExW(hKey, valueName,
1937 if (lRet != ERROR_SUCCESS)
1938 {
1940 error(hwnd, IDS_BAD_VALUE, valueName);
1941 goto done;
1942 }
1943 }
1944 else
1945 {
1947 }
1948
1950 {
1951 /* Use the unicode version, so editing strings in binary mode is correct */
1952 lRet = RegSetValueExW(hKey, valueName,
1954 if (lRet == ERROR_SUCCESS)
1955 result = TRUE;
1956 }
1957 if(binValueData != NULL)
1959 }
1960 else
1961 {
1963 }
1964
1965done:
1969
1970 if (stringValueData)
1973
1977
1978 return result;
1979}
#define IDS_BAD_VALUE
Definition: resource.h:11
static WCHAR * stringValueData
Definition: edit.c:146
static PCM_RESOURCE_LIST resourceValueData
Definition: edit.c:149
INT_PTR CALLBACK modify_string_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:210
static INT_PTR CALLBACK modify_requirements_list_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:1624
static DWORD valueDataLen
Definition: edit.c:151
static INT fullResourceIndex
Definition: edit.c:150
static INT_PTR CALLBACK modify_resource_list_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:1153
static DWORD dwordValueData
Definition: edit.c:148
static const WCHAR * editValueName
Definition: edit.c:145
static INT_PTR CALLBACK modify_resource_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:1032
static PVOID binValueData
Definition: edit.c:147
INT_PTR CALLBACK modify_multi_string_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:279
static PIO_RESOURCE_REQUIREMENTS_LIST requirementsValueData
Definition: edit.c:152
INT_PTR CALLBACK modify_dword_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:388
INT_PTR CALLBACK modify_binary_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:502
#define IDD_EDIT_RESOURCE
Definition: resource.h:306
#define IDD_EDIT_MULTI_STRING
Definition: resource.h:283
#define IDS_TOO_BIG_VALUE
Definition: resource.h:121
#define IDD_EDIT_STRING
Definition: resource.h:275
#define IDD_EDIT_BIN_DATA
Definition: resource.h:284
#define IDD_EDIT_RESOURCE_LIST
Definition: resource.h:302
#define IDD_EDIT_REQUIREMENTS_LIST
Definition: resource.h:322
#define IDS_MULTI_SZ_EMPTY_STRING
Definition: resource.h:124
#define IDS_UNSUPPORTED_TYPE
Definition: resource.h:120
#define IDD_EDIT_DWORD
Definition: resource.h:279
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:4882
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
#define HeapReAlloc
Definition: compat.h:734
GLenum src
Definition: glext.h:6340
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
#define REG_SZ
Definition: layer.c:22
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static char * dest
Definition: rtl.c:135
#define REG_BINARY
Definition: nt_native.h:1496
#define REG_RESOURCE_LIST
Definition: nt_native.h:1502
#define REG_MULTI_SZ
Definition: nt_native.h:1501
#define REG_RESOURCE_REQUIREMENTS_LIST
Definition: nt_native.h:1504
#define REG_NONE
Definition: nt_native.h:1492
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define REG_FULL_RESOURCE_DESCRIPTOR
Definition: nt_native.h:1503
_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 warning(s)
Definition: debug.h:83
CM_FULL_RESOURCE_DESCRIPTOR List[1]
Definition: hwresource.cpp:165
eMaj lines
Definition: tritemp.h:206
uint32_t ULONG
Definition: typedefs.h:59
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4399
#define IDOK
Definition: winuser.h:830

Referenced by _CmdWndProc().

◆ OnTreeExpanding()

BOOL OnTreeExpanding ( HWND  hWnd,
NMTREEVIEW pnmtv 
)

Definition at line 516 of file treeview.c.

517{
518 DWORD dwCount, dwIndex, dwMaxSubKeyLen;
519 HKEY hRoot, hNewKey, hKey;
520 LPCWSTR keyPath;
521 LPWSTR Name;
522 LONG errCode;
523 HCURSOR hcursorOld;
524
525 static int expanding;
526 if (expanding) return FALSE;
527 if (pnmtv->itemNew.state & TVIS_EXPANDEDONCE )
528 {
529 return TRUE;
530 }
531 expanding = TRUE;
532 hcursorOld = SetCursor(LoadCursor(NULL, IDC_WAIT));
533 SendMessageW(hwndTV, WM_SETREDRAW, FALSE, 0);
534
535 keyPath = GetItemPath(hwndTV, pnmtv->itemNew.hItem, &hRoot);
536 if (!keyPath) goto done;
537
538 if (*keyPath)
539 {
540 errCode = RegOpenKeyExW(hRoot, keyPath, 0, KEY_READ, &hNewKey);
541 if (errCode != ERROR_SUCCESS) goto done;
542 }
543 else
544 {
545 hNewKey = hRoot;
546 }
547
548 errCode = RegQueryInfoKeyW(hNewKey, 0, 0, 0, &dwCount, &dwMaxSubKeyLen, 0, 0, 0, 0, 0, 0);
549 if (errCode != ERROR_SUCCESS) goto done;
550 dwMaxSubKeyLen++; /* account for the \0 terminator */
551 Name = HeapAlloc(GetProcessHeap(), 0, dwMaxSubKeyLen * sizeof(WCHAR));
552 if (!Name) goto done;
553
554 for (dwIndex = 0; dwIndex < dwCount; dwIndex++)
555 {
556 DWORD cName = dwMaxSubKeyLen, dwSubCount;
557
558 errCode = RegEnumKeyExW(hNewKey, dwIndex, Name, &cName, 0, 0, 0, 0);
559 if (errCode != ERROR_SUCCESS) continue;
560 errCode = RegOpenKeyExW(hNewKey, Name, 0, KEY_QUERY_VALUE, &hKey);
561 if (errCode == ERROR_SUCCESS)
562 {
563 errCode = RegQueryInfoKeyW(hKey, 0, 0, 0, &dwSubCount, 0, 0, 0, 0, 0, 0, 0);
565 }
566 if (errCode != ERROR_SUCCESS) dwSubCount = 0;
567 AddEntryToTree(hwndTV, pnmtv->itemNew.hItem, Name, NULL, dwSubCount);
568 }
569
570 SendMessageW(hwndTV, TVM_SORTCHILDREN, 0, (LPARAM)pnmtv->itemNew.hItem);
571
572 RegCloseKey(hNewKey);
574
575done:
576 SendMessageW(hwndTV, WM_SETREDRAW, TRUE, 0);
577 SetCursor(hcursorOld);
578 expanding = FALSE;
579
580 return TRUE;
581}
struct NameRec_ * Name
Definition: cdprocs.h:460
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:2504
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:3662
static HTREEITEM hRoot
Definition: treeview.c:381
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
HICON HCURSOR
Definition: windef.h:299
#define LoadCursor
Definition: winuser.h:5812
#define IDC_WAIT
Definition: winuser.h:689
#define WM_SETREDRAW
Definition: winuser.h:1616

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}
static void output_formatstring(const WCHAR *fmt, va_list va_args)
Definition: reg.c:76

Referenced by ask_confirm(), ask_overwrite_value(), delete_registry_key(), 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_open_export_file(), 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 2172 of file edit.c.

2173{
2174 LONG lResult;
2175 HKEY hSubKey = NULL;
2176 DWORD cbData, dwType;
2177
2178 if (lpSubKey)
2179 {
2180 lResult = RegOpenKeyW(hKey, lpSubKey, &hSubKey);
2181 if (lResult != ERROR_SUCCESS)
2182 goto done;
2183 hKey = hSubKey;
2184 }
2185
2186 cbData = (dwBufferLen - 1) * sizeof(*pszBuffer);
2187 lResult = RegQueryValueExW(hKey, lpValueName, NULL, &dwType, (LPBYTE) pszBuffer, &cbData);
2188 if (lResult != ERROR_SUCCESS)
2189 goto done;
2190 if (dwType != REG_SZ)
2191 {
2192 lResult = -1;
2193 goto done;
2194 }
2195
2196 pszBuffer[cbData / sizeof(*pszBuffer)] = L'\0';
2197
2198done:
2199 if (lResult != ERROR_SUCCESS)
2200 pszBuffer[0] = L'\0';
2201 if (hSubKey)
2202 RegCloseKey(hSubKey);
2203 return lResult;
2204}

◆ RefreshListView()

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

Definition at line 672 of file listview.c.

673{
674 DWORD max_sub_key_len;
675 DWORD max_val_name_len;
676 DWORD max_val_size;
677 DWORD val_count;
678 HKEY hNewKey;
679 LONG errCode;
680 INT i, c;
681 BOOL AddedDefault = FALSE;
682
683 if (!hwndLV) return FALSE;
684
685 (void)ListView_EditLabel(hwndLV, -1);
686
687 SendMessageW(hwndLV, WM_SETREDRAW, FALSE, 0);
688 DestroyListView(hwndLV);
689
691
692 if(!hKey) return FALSE;
693
694 errCode = RegOpenKeyExW(hKey, keyPath, 0, KEY_READ, &hNewKey);
695 if (errCode != ERROR_SUCCESS) return FALSE;
696
697 /* get size information and resize the buffers if necessary */
698 errCode = RegQueryInfoKeyW(hNewKey, NULL, NULL, NULL, NULL, &max_sub_key_len, NULL,
699 &val_count, &max_val_name_len, &max_val_size, NULL, NULL);
700
701 if (errCode == ERROR_SUCCESS)
702 {
703 WCHAR* ValName = HeapAlloc(GetProcessHeap(), 0, ++max_val_name_len * sizeof(WCHAR));
704 DWORD dwValNameLen = max_val_name_len;
705 BYTE* ValBuf = HeapAlloc(GetProcessHeap(), 0, max_val_size + sizeof(WCHAR));
706 DWORD dwValSize = max_val_size;
707 DWORD dwIndex = 0L;
708 DWORD dwValType;
709 /* if (RegQueryValueExW(hNewKey, NULL, NULL, &dwValType, ValBuf, &dwValSize) == ERROR_SUCCESS) { */
710 /* AddEntryToList(hwndLV, L"(Default)", dwValType, ValBuf, dwValSize); */
711 /* } */
712 /* dwValSize = max_val_size; */
713 while (RegEnumValueW(hNewKey, dwIndex, ValName, &dwValNameLen, NULL, &dwValType, ValBuf, &dwValSize) == ERROR_SUCCESS)
714 {
715 /* Add a terminating 0 character. Usually this is only necessary for strings. */
716 ValBuf[dwValSize] = ValBuf[dwValSize + 1] = 0;
717
718 AddEntryToList(hwndLV, ValName, dwValType, ValBuf, dwValSize, -1, TRUE);
719 dwValNameLen = max_val_name_len;
720 dwValSize = max_val_size;
721 dwValType = 0L;
722 ++dwIndex;
723 if(!wcscmp(ValName, L""))
724 {
725 AddedDefault = TRUE;
726 }
727 }
728 HeapFree(GetProcessHeap(), 0, ValBuf);
729 HeapFree(GetProcessHeap(), 0, ValName);
730 }
731 RegCloseKey(hNewKey);
732
733 if(!AddedDefault)
734 {
735 AddEntryToList(hwndLV, L"", REG_SZ, NULL, 0, 0, FALSE);
736 }
737 c = ListView_GetItemCount(hwndLV);
738 for(i = 0; i < c; i++)
739 {
741 }
742
743 if (bSelectNone)
744 iListViewSelect = -1;
748 (void)ListView_Sort(hwndLV, g_iSortedColumn, -1);
749 SendMessageW(hwndLV, WM_SETREDRAW, TRUE, 0);
750
751 return TRUE;
752}
INT iListViewSelect
Definition: listview.c:29
static void AddEntryToList(HWND hwndLV, LPWSTR Name, DWORD dwValType, void *ValBuf, DWORD dwCount, int Position, BOOL ValExists)
Definition: listview.c:126
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:2830
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
#define ListView_SetItemState(hwndLV, i, data, mask)
Definition: commctrl.h:2673
#define ListView_EditLabel(hwndLV, i)
Definition: commctrl.h:2540
#define LVIS_SELECTED
Definition: commctrl.h:2319
#define ListView_DeleteAllItems(hwnd)
Definition: commctrl.h:2414
#define LVIS_FOCUSED
Definition: commctrl.h:2318

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

◆ RefreshTreeItem()

BOOL RefreshTreeItem ( HWND  hwndTV,
HTREEITEM  hItem 
)

Definition at line 152 of file treeview.c.

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

Referenced by RefreshTreeItem(), and RefreshTreeView().

◆ RefreshTreeView()

BOOL RefreshTreeView ( HWND  hWndTV)

Definition at line 322 of file treeview.c.

323{
325 HTREEITEM hSelectedItem;
326 HCURSOR hcursorOld;
327
328 hSelectedItem = TreeView_GetSelection(hwndTV);
329 hcursorOld = SetCursor(LoadCursor(NULL, IDC_WAIT));
330 SendMessageW(hwndTV, WM_SETREDRAW, FALSE, 0);
331
332 hItem = TreeView_GetChild(hwndTV, TreeView_GetRoot(hwndTV));
333 while (hItem)
334 {
335 RefreshTreeItem(hwndTV, hItem);
337 }
338
339 SendMessageW(hwndTV, WM_SETREDRAW, TRUE, 0);
340 SetCursor(hcursorOld);
341
342 /* We reselect the currently selected node, this will prompt a refresh of the listview. */
343 (void)TreeView_SelectItem(hwndTV, hSelectedItem);
344 return TRUE;
345}
#define TreeView_GetRoot(hwnd)
Definition: commctrl.h:3475

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

◆ RegKeyEditPermissions()

BOOL RegKeyEditPermissions ( HWND  hWndOwner,
HKEY  hKey,
LPCWSTR  lpMachine,
LPCWSTR  lpKeyName 
)

Definition at line 838 of file security.c.

842{
843 BOOL Result = FALSE;
844 LPCWSTR lphKey = NULL;
845 LPWSTR lpKeyPath = NULL;
846 PCRegKeySecurity RegKeySecurity;
847 SI_OBJECT_INFO ObjectInfo;
848 size_t lnMachine = 0, lnKeyName = 0;
849
850 if (pfnEditSecurity == NULL)
851 {
852 return FALSE;
853 }
854
855 if (lpMachine != NULL)
856 lnMachine = wcslen(lpMachine);
857 if (lpKeyName != NULL)
858 lnKeyName = wcslen(lpKeyName);
859
860 /* build registry path */
861 if (lpMachine != NULL &&
862 (lpMachine[0] == L'\0' ||
863 (lpMachine[0] == L'.' && lpMachine[1] == L'.')))
864 {
865 lnMachine = 0;
866 }
867
868 if (hKey == HKEY_CLASSES_ROOT)
869 lphKey = L"CLASSES_ROOT";
870 else if (hKey == HKEY_CURRENT_USER)
871 lphKey = L"CURRENT_USER";
872 else if (hKey == HKEY_LOCAL_MACHINE)
873 lphKey = L"MACHINE";
874 else if (hKey == HKEY_USERS)
875 lphKey = L"USERS";
876 else if (hKey == HKEY_CURRENT_CONFIG)
877 lphKey = L"CONFIG";
878 else
879 goto Cleanup;
880
881 lpKeyPath = HeapAlloc(GetProcessHeap(),
882 0,
883 (2 + lnMachine + 1 + wcslen(lphKey) + 1 + lnKeyName) * sizeof(WCHAR));
884 if (lpKeyPath == NULL)
885 {
887 goto Cleanup;
888 }
889 lpKeyPath[0] = L'\0';
890
891 if (lnMachine != 0)
892 {
893 wcscat(lpKeyPath,
894 L"\\\\");
895 wcscat(lpKeyPath,
896 lpMachine);
897 wcscat(lpKeyPath,
898 L"\\");
899 }
900
901 wcscat(lpKeyPath,
902 lphKey);
903 if (lpKeyName != NULL && lpKeyName[0] != L'\0')
904 {
905 if (lpKeyName[0] != L'\\')
906 {
907 wcscat(lpKeyPath,
908 L"\\");
909 }
910
911 wcscat(lpKeyPath,
912 lpKeyName);
913 }
914
917 ObjectInfo.hInstance = hInst;
918 ObjectInfo.pszServerName = (LPWSTR)lpMachine;
919 ObjectInfo.pszObjectName = (LPWSTR)lpKeyName; /* FIXME */
920 ObjectInfo.pszPageTitle = (LPWSTR)lpKeyName; /* FIXME */
921
922 if (!(RegKeySecurity = CRegKeySecurity_fnConstructor(lpKeyPath,
923 hKey,
924 &ObjectInfo,
925 &Result)))
926 {
927 goto Cleanup;
928 }
929
930 /* display the security editor dialog */
931 pfnEditSecurity(hWndOwner,
932 impl_to_interface(RegKeySecurity,
933 ISecurityInformation));
934
935 /* dereference the interface, it should be destroyed here */
936 CRegKeySecurity_fnRelease(RegKeySecurity);
937
938Cleanup:
939 if (lpKeyPath != NULL)
940 {
942 0,
943 lpKeyPath);
944 }
945
946 return Result;
947}
#define SI_CONTAINER
Definition: accctrl.h:116
#define SI_RESET_DACL_TREE
Definition: accctrl.h:127
#define SI_OWNER_RECURSE
Definition: accctrl.h:122
#define SI_EDIT_ALL
Definition: accctrl.h:136
#define SI_EDIT_PERMS
Definition: accctrl.h:113
#define SI_EDIT_EFFECTIVE
Definition: accctrl.h:130
#define SI_RESET_SACL_TREE
Definition: accctrl.h:128
#define SI_ADVANCED
Definition: accctrl.h:118
static __inline ULONG CRegKeySecurity_fnRelease(PCRegKeySecurity obj)
Definition: security.c:85
static PCRegKeySecurity CRegKeySecurity_fnConstructor(LPWSTR lpRegKey, HKEY hRootKey, SI_OBJECT_INFO *ObjectInfo, BOOL *Btn)
Definition: security.c:762
#define impl_to_interface(impl, iface)
Definition: security.c:76
static PEDITSECURITY pfnEditSecurity
Definition: security.c:806
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define SetLastError(x)
Definition: compat.h:752
static const WCHAR Cleanup[]
Definition: register.c:80
LPWSTR pszObjectName
Definition: accctrl.h:391
LPWSTR pszPageTitle
Definition: accctrl.h:392
DWORD dwFlags
Definition: accctrl.h:388
HINSTANCE hInstance
Definition: accctrl.h:389
LPWSTR pszServerName
Definition: accctrl.h:390

Referenced by _CmdWndProc().

◆ RenameKey()

LONG RenameKey ( HKEY  hKey,
LPCWSTR  lpSubKey,
LPCWSTR  lpNewName 
)

Definition at line 2105 of file edit.c.

2106{
2107 LPCWSTR s;
2108 LPWSTR lpNewSubKey = NULL;
2109 LONG Ret = 0;
2110 SIZE_T cbNewSubKey;
2111
2112 if (!lpSubKey)
2113 return Ret;
2114
2115 s = wcsrchr(lpSubKey, L'\\');
2116 if (s)
2117 {
2118 s++;
2119 cbNewSubKey = (s - lpSubKey + wcslen(lpNewName) + 1) * sizeof(WCHAR);
2120 lpNewSubKey = (LPWSTR) HeapAlloc(GetProcessHeap(), 0, cbNewSubKey);
2121 if (lpNewSubKey != NULL)
2122 {
2123 StringCbCopyNW(lpNewSubKey, cbNewSubKey, lpSubKey, (s - lpSubKey) * sizeof(WCHAR));
2124 StringCbCatW(lpNewSubKey, cbNewSubKey, lpNewName);
2125 lpNewName = lpNewSubKey;
2126 }
2127 else
2129 }
2130
2131 Ret = MoveKey(hKey, lpNewName, hKey, lpSubKey);
2132
2133 if (lpNewSubKey)
2134 {
2135 HeapFree(GetProcessHeap(), 0, lpNewSubKey);
2136 }
2137 return Ret;
2138}
static LONG MoveKey(HKEY hDestKey, LPCWSTR lpDestSubKey, HKEY hSrcKey, LPCWSTR lpSrcSubKey)
Definition: edit.c:2052
#define wcsrchr
Definition: compat.h:16
STRSAFEAPI StringCbCopyNW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc, size_t cbToCopy)
Definition: strsafe.h:255
STRSAFEAPI StringCbCatW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:342

Referenced by TreeWndNotifyProc().

◆ RenameValue()

LONG RenameValue ( HKEY  hKey,
LPCWSTR  lpSubKey,
LPCWSTR  lpDestValue,
LPCWSTR  lpSrcValue 
)

Definition at line 2140 of file edit.c.

2141{
2142 LONG lResult;
2143 HKEY hSubKey = NULL;
2144 DWORD dwType, cbData;
2145 BYTE data[512];
2146
2147 if (lpSubKey)
2148 {
2149 lResult = RegOpenKeyW(hKey, lpSubKey, &hSubKey);
2150 if (lResult != ERROR_SUCCESS)
2151 goto done;
2152 hKey = hSubKey;
2153 }
2154
2155 cbData = sizeof(data);
2156 lResult = RegQueryValueExW(hKey, lpSrcValue, NULL, &dwType, data, &cbData);
2157 if (lResult != ERROR_SUCCESS)
2158 goto done;
2159
2160 lResult = RegSetValueExW(hKey, lpDestValue, 0, dwType, data, cbData);
2161 if (lResult != ERROR_SUCCESS)
2162 goto done;
2163
2164 RegDeleteValue(hKey, lpSrcValue);
2165
2166done:
2167 if (hSubKey)
2168 RegCloseKey(hSubKey);
2169 return lResult;
2170}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define RegDeleteValue
Definition: winreg.h:508

Referenced by ListWndNotifyProc().

◆ ResizeWnd()

void ResizeWnd ( int  cx,
int  cy 
)

Definition at line 41 of file childwnd.c.

42{
43 HDWP hdwp = BeginDeferWindowPos(4);
44 RECT rt, rs, rb;
45 const int nButtonWidth = 44;
46 const int nButtonHeight = 22;
47 int cyEdge = GetSystemMetrics(SM_CYEDGE);
49 SetRect(&rt, 0, 0, cx, cy);
50 cy = 0;
51 if (hStatusBar != NULL)
52 {
54 cy = rs.bottom - rs.top;
55 }
58 if (hdwp)
60 rt.left, rt.top,
61 rt.right - rt.left - nButtonWidth, nButtonHeight,
62 uFlags);
63 if (hdwp)
65 rt.right - nButtonWidth, rt.top,
66 nButtonWidth, nButtonHeight,
67 uFlags);
68 if (hdwp)
70 rt.left,
71 rt.top + nButtonHeight + cyEdge,
73 rt.bottom - rt.top - cy - 2 * cyEdge,
74 uFlags);
75 if (hdwp)
77 rt.left + cx,
78 rt.top + nButtonHeight + cyEdge,
79 rt.right - cx,
80 rt.bottom - rt.top - cy - 2 * cyEdge,
81 uFlags);
82 if (hdwp)
84}
HWND hStatusBar
Definition: main.c:36
UINT uFlags
Definition: api.c:59
unsigned int UINT
Definition: ndis.h:50
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
#define SWP_NOACTIVATE
Definition: winuser.h:1242
#define SM_CYEDGE
Definition: winuser.h:1009
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOZORDER
Definition: winuser.h:1247
int WINAPI GetSystemMetrics(_In_ int)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
HDWP WINAPI BeginDeferWindowPos(_In_ int)

Referenced by ChildWndProc(), and finish_splitbar().

◆ SaveSettings()

void SaveSettings ( void  Dlg)

Definition at line 115 of file settings.c.

116{
117 HKEY hKey = NULL;
118
120 {
121 TCHAR szBuffer[MAX_PATH];
122
124 ComboBox_GetText(hWnd, szBuffer, MAX_PATH);
125
126 if(*szBuffer != '\0')
127 RegSetValueEx(hKey, _T("Font"), 0, REG_SZ, (LPBYTE) szBuffer, (DWORD) MAX_PATH);
128
130 ComboBox_GetText(hWnd, szBuffer, MAX_PATH);
131
132 if(*szBuffer != '\0')
133 RegSetValueEx(hKey, _T("CodePage"), 0, REG_SZ, (LPBYTE) szBuffer, (DWORD) MAX_PATH);
134
135 RegSetValueEx(hKey, _T("Advanced"), 0, REG_DWORD, (LPBYTE)&Settings.IsAdvancedView, (DWORD) sizeof(DWORD));
136
138 }
139}
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_POWER_POLICY_IDLE_SETTINGS Settings
Definition: wdfdevice.h:2595
#define ComboBox_GetText(hwndCtl, lpch, cchMax)
Definition: windowsx.h:58
#define RegSetValueEx
Definition: winreg.h:533
#define RegCreateKeyEx
Definition: winreg.h:501

◆ SelectNode()

BOOL SelectNode ( HWND  hwndTV,
LPCWSTR  keyPath 
)

Definition at line 785 of file treeview.c.

786{
788 HTREEITEM hChildItem;
789 WCHAR szPathPart[128];
790 WCHAR szBuffer[128];
791 LPCWSTR s;
792 TVITEMW tvi;
793
794 /* Load "My Computer" string... */
795 LoadStringW(hInst, IDS_MY_COMPUTER, szBuffer, ARRAY_SIZE(szBuffer));
796 StringCbCatW(szBuffer, sizeof(szBuffer), L"\\");
797
798 /* ... and remove it from the key path */
799 if (!_wcsnicmp(keyPath, szBuffer, wcslen(szBuffer)))
800 keyPath += wcslen(szBuffer);
801
802 /* Reinitialize szBuffer */
803 szBuffer[0] = L'\0';
804
805 hRoot = TreeView_GetRoot(hwndTV);
806 hItem = hRoot;
807
808 while(keyPath[0])
809 {
810 size_t copyLength;
811 s = wcschr(keyPath, L'\\');
812 if (s != NULL)
813 {
814 copyLength = (s - keyPath) * sizeof(WCHAR);
815 }
816 else
817 {
818 copyLength = sizeof(szPathPart);
819 }
820 StringCbCopyNW(szPathPart, sizeof(szPathPart), keyPath, copyLength);
821
822 /* Special case for root to expand root key abbreviations */
823 if (hItem == hRoot)
824 {
825 if (!_wcsicmp(szPathPart, L"HKCR"))
826 StringCbCopyW(szPathPart, sizeof(szPathPart), L"HKEY_CLASSES_ROOT");
827 else if (!_wcsicmp(szPathPart, L"HKCU"))
828 StringCbCopyW(szPathPart, sizeof(szPathPart), L"HKEY_CURRENT_USER");
829 else if (!_wcsicmp(szPathPart, L"HKLM"))
830 StringCbCopyW(szPathPart, sizeof(szPathPart), L"HKEY_LOCAL_MACHINE");
831 else if (!_wcsicmp(szPathPart, L"HKU"))
832 StringCbCopyW(szPathPart, sizeof(szPathPart), L"HKEY_USERS");
833 else if (!_wcsicmp(szPathPart, L"HKCC"))
834 StringCbCopyW(szPathPart, sizeof(szPathPart), L"HKEY_CURRENT_CONFIG");
835 else if (!_wcsicmp(szPathPart, L"HKDD"))
836 StringCbCopyW(szPathPart, sizeof(szPathPart), L"HKEY_DYN_DATA");
837 }
838
839 for (hChildItem = TreeView_GetChild(hwndTV, hItem); hChildItem;
840 hChildItem = TreeView_GetNextSibling(hwndTV, hChildItem))
841 {
842 memset(&tvi, 0, sizeof(tvi));
843 tvi.hItem = hChildItem;
845 tvi.pszText = szBuffer;
846 tvi.cchTextMax = ARRAY_SIZE(szBuffer);
847
848 (void)TreeView_GetItem(hwndTV, &tvi);
849
850 if (!_wcsicmp(szBuffer, szPathPart))
851 break;
852 }
853
854 if (!hChildItem)
855 return FALSE;
856
857 if (tvi.cChildren > 0)
858 {
859 if (!TreeView_Expand(hwndTV, hChildItem, TVE_EXPAND))
860 return FALSE;
861 }
862
863 keyPath = s ? s + 1 : L"";
864 hItem = hChildItem;
865 }
866
869
870 return TRUE;
871}
#define wcschr
Definition: compat.h:17
#define TreeView_EnsureVisible(hwnd, hitem)
Definition: commctrl.h:3545
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)

Referenced by _CmdWndProc(), AddressBarProc(), ChooseFavorite(), FindNext(), and LoadSettings().

◆ SetupStatusBar()

void SetupStatusBar ( HWND  hWnd,
BOOL  bResize 
)

Definition at line 161 of file framewnd.c.

162{
163 RECT rc;
164 int nParts;
165 GetClientRect(hWnd, &rc);
166 nParts = rc.right;
167 /* nParts = -1;*/
168 if (bResize)
171}
#define SB_SETPARTS
Definition: commctrl.h:1954

Referenced by InitInstance(), OnExitMenuLoop(), and resize_frame_rect().

◆ ShowAboutBox()

void ShowAboutBox ( HWND  hWnd)

Definition at line 25 of file about.c.

26{
27 WCHAR AppStr[255];
28 LoadStringW(hInst, IDS_APP_TITLE, AppStr, ARRAY_SIZE(AppStr));
30}
#define IDI_REGEDIT
Definition: resource.h:35
BOOL WINAPI ShellAboutW(HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff, HICON hIcon)
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2075

◆ StartKeyRename()

HWND StartKeyRename ( HWND  hwndTV)

Definition at line 399 of file treeview.c.

400{
402
403 if(!(hItem = TreeView_GetSelection(hwndTV))) return 0;
404 return TreeView_EditLabel(hwndTV, hItem);
405}

◆ TreeWndNotifyProc()

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

Definition at line 641 of file treeview.c.

642{
644 *Result = TRUE;
645
646 switch (((LPNMHDR)lParam)->code)
647 {
650 return TRUE;
651 case TVN_SELCHANGED:
652 {
653 NMTREEVIEW* pnmtv = (NMTREEVIEW*)lParam;
654 /* Get the parent of the current item */
655 HTREEITEM hParentItem = TreeView_GetParent(g_pChildWnd->hTreeWnd, pnmtv->itemNew.hItem);
656
657 UpdateAddress(pnmtv->itemNew.hItem, NULL, NULL, TRUE);
658
659 /* Disable the Permissions and new key menu items for 'My Computer' */
662
663 /*
664 * Disable Delete/Rename menu options for 'My Computer' (first item so doesn't have any parent)
665 * and HKEY_* keys (their parent is 'My Computer' and the previous remark applies).
666 */
667 if (!hParentItem || !TreeView_GetParent(g_pChildWnd->hTreeWnd, hParentItem))
668 {
673 }
674 else
675 {
680 }
681
682 return TRUE;
683 }
684 case NM_SETFOCUS:
686 break;
688 {
690 /* cancel label edit for rootkeys */
691 if (!TreeView_GetParent(g_pChildWnd->hTreeWnd, ptvdi->item.hItem) ||
693 {
694 *Result = TRUE;
695 }
696 else
697 {
698 *Result = FALSE;
699 }
700 return TRUE;
701 }
702 case TVN_ENDLABELEDIT:
703 {
704 LPCWSTR keyPath;
705 HKEY hRootKey;
706 HKEY hKey = NULL;
708 LONG nRenResult;
709 LONG lResult = TRUE;
710 WCHAR szBuffer[MAX_PATH];
711 WCHAR Caption[128];
712
713 if (ptvdi->item.pszText)
714 {
715 keyPath = GetItemPath(g_pChildWnd->hTreeWnd, TreeView_GetParent(g_pChildWnd->hTreeWnd, ptvdi->item.hItem), &hRootKey);
716 if (wcslen(keyPath))
717 _snwprintf(szBuffer, ARRAY_SIZE(szBuffer), L"%s\\%s", keyPath, ptvdi->item.pszText);
718 else
719 _snwprintf(szBuffer, ARRAY_SIZE(szBuffer), L"%s", ptvdi->item.pszText);
720 keyPath = GetItemPath(g_pChildWnd->hTreeWnd, ptvdi->item.hItem, &hRootKey);
721 if (RegOpenKeyExW(hRootKey, szBuffer, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
722 {
723 lResult = FALSE;
725 TreeView_EditLabel(g_pChildWnd->hTreeWnd, ptvdi->item.hItem);
726 }
727 else
728 {
729 nRenResult = RenameKey(hRootKey, keyPath, ptvdi->item.pszText);
730 if (nRenResult != ERROR_SUCCESS)
731 {
732 LoadStringW(hInst, IDS_ERROR, Caption, ARRAY_SIZE(Caption));
733 ErrorMessageBox(hWnd, Caption, nRenResult);
734 lResult = FALSE;
735 }
736 else
737 UpdateAddress(ptvdi->item.hItem, hRootKey, szBuffer, FALSE);
738 }
739 *Result = lResult;
740 }
741 return TRUE;
742 }
743 }
744 return FALSE;
745}
#define IDS_ERROR
Definition: resource.h:18
VOID UpdateAddress(HTREEITEM hItem, HKEY hRootKey, LPCWSTR pszPath, BOOL bSelectNone)
Definition: childwnd.c:232
LONG RenameKey(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpNewName)
Definition: edit.c:2105
#define ID_EDIT_DELETE
Definition: resource.h:57
#define ID_EDIT_NEW_KEY
Definition: resource.h:63
#define ID_TREE_RENAME
Definition: resource.h:152
#define ID_TREE_DELETE
Definition: resource.h:151
#define ID_EDIT_PERMISSIONS
Definition: resource.h:150
BOOL OnTreeExpanding(HWND hwndTV, NMTREEVIEW *pnmtv)
Definition: treeview.c:516
#define TVN_SELCHANGED
Definition: commctrl.h:3735
#define TVN_BEGINLABELEDIT
Definition: commctrl.h:3743
#define TVN_ENDLABELEDIT
Definition: commctrl.h:3744
#define NMTREEVIEW
Definition: commctrl.h:3642
#define TVN_ITEMEXPANDING
Definition: commctrl.h:3738
#define LPNMTVDISPINFO
Definition: commctrl.h:3676

Referenced by ChildWndProc().

◆ txt_export_registry_key()

BOOL txt_export_registry_key ( LPCWSTR  file_name,
LPCWSTR  path 
)

Definition at line 401 of file txtproc.c.

402{
403 if (path && *path)
405 else
407}
static BOOL txt_export_key(LPCWSTR file_name, LPCWSTR path)
Definition: txtproc.c:340
static BOOL txt_export_all(LPCWSTR file_name, LPCWSTR path)
Definition: txtproc.c:367

Referenced by ExportRegistryFile().

◆ UpdateAddress()

VOID UpdateAddress ( HTREEITEM  hItem,
HKEY  hRootKey,
LPCWSTR  pszPath,
BOOL  bSelectNone 
)

Definition at line 232 of file childwnd.c.

233{
234 LPCWSTR keyPath, rootName;
235 LPWSTR fullPath;
236 DWORD cbFullPath;
237
238 /* Wipe the listview, the status bar and the address bar if the root key was selected */
240 {
244 return;
245 }
246
247 if (pszPath == NULL)
248 keyPath = GetItemPath(g_pChildWnd->hTreeWnd, hItem, &hRootKey);
249 else
250 keyPath = pszPath;
251
252 if (keyPath)
253 {
254 RefreshListView(g_pChildWnd->hListWnd, hRootKey, keyPath, bSelectNone);
255 rootName = get_root_key_name(hRootKey);
256 cbFullPath = (wcslen(rootName) + 1 + wcslen(keyPath) + 1) * sizeof(WCHAR);
257 fullPath = malloc(cbFullPath);
258 if (fullPath)
259 {
260 /* set (correct) the address bar text */
261 if (keyPath[0] != UNICODE_NULL)
262 StringCbPrintfW(fullPath, cbFullPath, L"%s%s%s", rootName,
263 ((keyPath[0] == L'\\') ? L"" : L"\\"), keyPath);
264 else
265 StringCbCopyW(fullPath, cbFullPath, rootName);
266
269 free(fullPath);
270
271