ReactOS 0.4.16-dev-188-g678aa63
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 20 of file main.h.

◆ KEY_MAX_LEN

#define KEY_MAX_LEN   1024

Definition at line 29 of file main.h.

◆ LIST_WINDOW

#define LIST_WINDOW   2003

Definition at line 15 of file main.h.

◆ MAX_NEW_KEY_LEN

#define MAX_NEW_KEY_LEN   128

Definition at line 28 of file main.h.

◆ PM_HEXEDIT

#define PM_HEXEDIT   4

Definition at line 26 of file main.h.

◆ PM_MODIFYVALUE

#define PM_MODIFYVALUE   0

Definition at line 22 of file main.h.

◆ PM_NEW

#define PM_NEW   1

Definition at line 23 of file main.h.

◆ PM_ROOTITEM

#define PM_ROOTITEM   3

Definition at line 25 of file main.h.

◆ PM_TREECONTEXT

#define PM_TREECONTEXT   2

Definition at line 24 of file main.h.

◆ REG_FORMAT_4

#define REG_FORMAT_4   2

Definition at line 32 of file main.h.

◆ REG_FORMAT_5

#define REG_FORMAT_5   1

Definition at line 31 of file main.h.

◆ SPLIT_MIN

#define SPLIT_MIN   30

Definition at line 18 of file main.h.

◆ SPLIT_WIDTH

#define SPLIT_WIDTH   5

Definition at line 17 of file main.h.

◆ STATUS_WINDOW

#define STATUS_WINDOW   2001

Definition at line 13 of file main.h.

◆ TREE_WINDOW

#define TREE_WINDOW   2002

Definition at line 14 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 36 of file main.h.

37{
45};
@ OPTIONS_VIEW_DATA_ONLY
Definition: main.h:44
@ OPTIONS_DISPLAY_BINARY_DATA
Definition: main.h:42
@ OPTIONS_AUTO_REFRESH
Definition: main.h:38
@ OPTIONS_CONFIRM_ON_DELETE
Definition: main.h:40
@ OPTIONS_READ_ONLY_MODE
Definition: main.h:39
@ OPTIONS_VIEW_TREE_ONLY
Definition: main.h:43
@ OPTIONS_SAVE_ON_EXIT
Definition: main.h:41

Function Documentation

◆ ChildWndProc()

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

PURPOSE: Processes messages for the child windows.

WM_COMMAND - process the application menu WM_DESTROY - post a quit message and return

Definition at line 366 of file childwnd.c.

367{
368 BOOL Result;
369 RECT rc;
370
371 switch (message)
372 {
373 case WM_CREATE:
374 {
375 WNDPROC oldproc;
376 HFONT hFont;
378 DWORD style;
379 IAutoComplete *pAutoComplete;
380
381 /* Load "My Computer" string */
383
385 if (!g_pChildWnd) return 0;
386
388 g_pChildWnd->nSplitPos = 190;
390
394 hWnd, (HMENU)0, hInst, 0);
395
398 g_pChildWnd->hAddressBtnWnd = CreateWindowExW(0, L"Button", L"\x00BB", style,
400 hWnd, (HMENU)0, hInst, 0);
402 IMAGE_ICON, 12, 12, 0);
404
405 if (SUCCEEDED(CoCreateInstance(&CLSID_AutoComplete, NULL, CLSCTX_INPROC_SERVER, &IID_IAutoComplete, (void**)&pAutoComplete)))
406 {
407 IAutoComplete_Init(pAutoComplete, g_pChildWnd->hAddressBarWnd, (IUnknown*)&g_DummyEnumStrings, NULL, NULL);
408 IAutoComplete_Release(pAutoComplete);
409 }
410
411 GetClientRect(hWnd, &rc);
415
416 /* set the address bar and button font */
418 {
422 (WPARAM)hFont,
423 0);
426 (WPARAM)hFont,
427 0);
428 }
429 /* Subclass the AddressBar */
433 break;
434 }
435 case WM_COMMAND:
436 if(HIWORD(wParam) == BN_CLICKED)
437 {
439 }
440 break; //goto def;
441 case WM_SETCURSOR:
442 if (LOWORD(lParam) == HTCLIENT)
443 {
444 POINT pt;
448 {
450 return TRUE;
451 }
452 }
453 goto def;
454
455 case WM_DESTROY:
463 break;
464
465 case WM_LBUTTONDOWN:
466 {
467 INT x = (SHORT)LOWORD(lParam);
468 if (x >= g_pChildWnd->nSplitPos - SPLIT_WIDTH / 2 &&
469 x < g_pChildWnd->nSplitPos + SPLIT_WIDTH / 2 + 1)
470 {
473 last_split = x;
475 }
476 break;
477 }
478
479 case WM_LBUTTONUP:
480 case WM_RBUTTONDOWN:
481 if (GetCapture() == hWnd)
482 {
483 INT x = (SHORT)LOWORD(lParam);
486 }
487 break;
488
490 if (GetCapture() == hWnd && last_split >= 0)
492 break;
493
494 case WM_KEYDOWN:
495 if (wParam == VK_ESCAPE)
496 if (GetCapture() == hWnd)
497 {
498 RECT rt;
500 GetClientRect(hWnd, &rt);
501 ResizeWnd(rt.right, rt.bottom);
502 last_split = -1;
505 }
506 break;
507
508 case WM_MOUSEMOVE:
509 if (GetCapture() == hWnd)
510 {
511 INT x = (SHORT)LOWORD(lParam);
513 if (last_split != x)
514 {
516 last_split = x;
518 }
519 }
520 break;
521
522 case WM_SETFOCUS:
523 if (g_pChildWnd != NULL)
524 {
526 }
527 break;
528
529 case WM_NOTIFY:
530 if (g_pChildWnd == NULL) break;
531
532 if (((LPNMHDR)lParam)->idFrom == TREE_WINDOW)
533 {
535 {
536 goto def;
537 }
538
539 return Result;
540 }
541 else
542 {
543 if (((LPNMHDR)lParam)->idFrom == LIST_WINDOW)
544 {
546 {
547 goto def;
548 }
549
550 return Result;
551 }
552 else
553 {
554 goto def;
555 }
556 }
557 break;
558
559 case WM_CONTEXTMENU:
560 {
561 POINT pt;
563 {
564 int i, cnt;
565 BOOL IsDefault;
566 pt.x = (short) LOWORD(lParam);
567 pt.y = (short) HIWORD(lParam);
570 if (pt.x == -1 && pt.y == -1)
571 {
572 RECT rc;
573 if (i != -1)
574 {
575 rc.left = LVIR_BOUNDS;
577 pt.x = rc.left + 8;
578 pt.y = rc.top + 8;
579 }
580 else
581 pt.x = pt.y = 0;
583 }
584 if(i == -1)
585 {
587 }
588 else
589 {
592 IsDefault = IsDefaultValue(g_pChildWnd->hListWnd, i);
593 if(cnt == 1)
595 else
599
601 }
602 }
603 else if ((HWND)wParam == g_pChildWnd->hTreeWnd)
604 {
605 TVHITTESTINFO hti;
606 HMENU hContextMenu;
608 MENUITEMINFOW mii;
609 WCHAR resource[256];
610 WCHAR buffer[256];
611 LPWSTR s;
612 LPCWSTR keyPath;
613 HKEY hRootKey;
614 int iLastPos;
615 WORD wID;
616 BOOL isRoot;
617
618 pt.x = (short) LOWORD(lParam);
619 pt.y = (short) HIWORD(lParam);
620
621 if (pt.x == -1 && pt.y == -1)
622 {
623 RECT rc;
625 if (hti.hItem != NULL)
626 {
628 pt.x = rc.left + 8;
629 pt.y = rc.top + 8;
631 hti.flags = TVHT_ONITEM;
632 }
633 else
634 hti.flags = 0;
635 }
636 else
637 {
638 hti.pt.x = pt.x;
639 hti.pt.y = pt.y;
642 }
643
644 if (hti.flags & TVHT_ONITEM)
645 {
647
648 isRoot = (TreeView_GetParent(g_pChildWnd->hTreeWnd, hti.hItem) == NULL);
649 hContextMenu = GetSubMenu(hPopupMenus, isRoot ? PM_ROOTITEM : PM_TREECONTEXT);
650
651 memset(&item, 0, sizeof(item));
653 item.hItem = hti.hItem;
655
656 /* Set the Expand/Collapse menu item appropriately */
658 memset(&mii, 0, sizeof(mii));
659 mii.cbSize = sizeof(mii);
661 mii.fState = (item.cChildren > 0) ? MFS_DEFAULT : MFS_GRAYED;
663 mii.dwTypeData = (LPWSTR) buffer;
664 SetMenuItemInfo(hContextMenu, 0, TRUE, &mii);
665
666 if (isRoot == FALSE)
667 {
668 /* Remove any existing suggestions */
669 memset(&mii, 0, sizeof(mii));
670 mii.cbSize = sizeof(mii);
671 mii.fMask = MIIM_ID;
672 GetMenuItemInfo(hContextMenu, GetMenuItemCount(hContextMenu) - 1, TRUE, &mii);
673 if ((mii.wID >= ID_TREE_SUGGESTION_MIN) && (mii.wID <= ID_TREE_SUGGESTION_MAX))
674 {
675 do
676 {
677 iLastPos = GetMenuItemCount(hContextMenu) - 1;
678 GetMenuItemInfo(hContextMenu, iLastPos, TRUE, &mii);
679 RemoveMenu(hContextMenu, iLastPos, MF_BYPOSITION);
680 }
681 while((mii.wID >= ID_TREE_SUGGESTION_MIN) && (mii.wID <= ID_TREE_SUGGESTION_MAX));
682 }
683
684 /* Come up with suggestions */
685 keyPath = GetItemPath(g_pChildWnd->hTreeWnd, NULL, &hRootKey);
686 SuggestKeys(hRootKey, keyPath, Suggestions, ARRAY_SIZE(Suggestions));
687 if (Suggestions[0])
688 {
689 AppendMenu(hContextMenu, MF_SEPARATOR, 0, NULL);
690
692
693 s = Suggestions;
695 while(*s && (wID <= ID_TREE_SUGGESTION_MAX))
696 {
697 WCHAR *path = s, buf[MAX_PATH];
698 if (hRootKey == HKEY_CURRENT_USER || hRootKey == HKEY_LOCAL_MACHINE)
699 {
700 // Windows 10 only displays the root name
702 if (next > s)
703 lstrcpynW(path = buf, s, min(next - s, _countof(buf)));
704 }
706
707 memset(&mii, 0, sizeof(mii));
708 mii.cbSize = sizeof(mii);
709 mii.fMask = MIIM_STRING | MIIM_ID;
710 mii.wID = wID++;
711 mii.dwTypeData = buffer;
712 InsertMenuItem(hContextMenu, GetMenuItemCount(hContextMenu), TRUE, &mii);
713
714 s += wcslen(s) + 1;
715 }
716 }
717 }
718 TrackPopupMenu(hContextMenu, TPM_RIGHTBUTTON, pt.x, pt.y, 0, hFrameWnd, NULL);
719 }
720 }
721 break;
722 }
723
724 case WM_SIZE:
726 {
728 }
729 break;
730
731 default:
732def:
734 }
735 return 0;
736}
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:174
static int last_split
Definition: childwnd.c:14
static void draw_splitbar(HWND hWnd, int x)
Definition: childwnd.c:147
LRESULT CALLBACK AddressBarProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: childwnd.c:278
struct DummyEnumStrings g_DummyEnumStrings
ChildWnd * g_pChildWnd
Definition: childwnd.c:13
static INT ClampSplitBarX(HWND hWnd, INT x)
Definition: childwnd.c:88
WCHAR Suggestions[256]
Definition: childwnd.c:17
static void SuggestKeys(HKEY hRootKey, LPCWSTR pszKeyPath, LPWSTR pszSuggestions, size_t iSuggestionsLength)
Definition: childwnd.c:194
void ResizeWnd(int cx, int cy)
Definition: childwnd.c:95
BOOL IsDefaultValue(HWND hwndLV, int i)
Definition: listview.c:95
BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result)
Definition: listview.c:531
void DestroyListView(HWND hwndLV)
Definition: listview.c:641
HMENU hPopupMenus
Definition: main.c:25
HWND hFrameWnd
Definition: main.c:22
void DestroyMainMenu()
Definition: main.c:139
HFONT hFont
Definition: main.c:53
HWND CreateTreeView(HWND hwndParent, LPWSTR pHostName, HMENU id)
Definition: treeview.c:733
#define PM_TREECONTEXT
Definition: main.h:24
#define ARRAY_SIZE(A)
Definition: main.h:20
#define LIST_WINDOW
Definition: main.h:15
BOOL TreeWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result)
Definition: treeview.c:622
#define TREE_WINDOW
Definition: main.h:14
#define PM_NEW
Definition: main.h:23
LPCWSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY *phRootKey)
Definition: treeview.c:73
#define PM_ROOTITEM
Definition: main.h:25
#define PM_MODIFYVALUE
Definition: main.h:22
#define ID_TREE_SUGGESTION_MIN
Definition: resource.h:109
#define IDS_MY_COMPUTER
Definition: resource.h:82
#define IDS_COLLAPSE
Definition: resource.h:144
#define IDI_ARROW
Definition: resource.h:24
#define ID_EDIT_MODIFY
Definition: resource.h:48
#define ID_TREE_EXPANDBRANCH
Definition: resource.h:62
#define ID_TREE_COLLAPSEBRANCH
Definition: resource.h:63
#define IDS_GOTO_SUGGESTED_KEY
Definition: resource.h:147
#define ID_EDIT_MODIFY_BIN
Definition: resource.h:75
#define IDS_EXPAND
Definition: resource.h:143
#define ID_TREE_SUGGESTION_MAX
Definition: resource.h:110
#define ID_EDIT_RENAME
Definition: resource.h:44
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
#define lstrcpynW
Definition: compat.h:738
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
LPWSTR WINAPI PathFindNextComponentW(LPCWSTR lpszPath)
Definition: path.c:2579
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
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
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)
#define SUCCEEDED(hr)
Definition: intsafe.h:50
int _snwprintf(wchar_t *buffer, size_t count, const wchar_t *format,...)
static HICON
Definition: imagelist.c:80
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:3486
#define TVHT_ONITEM
Definition: commctrl.h:3532
#define LVNI_SELECTED
Definition: commctrl.h:2429
#define LVNI_FOCUSED
Definition: commctrl.h:2428
#define TreeView_GetParent(hwnd, hitem)
Definition: commctrl.h:3474
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2439
#define TreeView_GetSelection(hwnd)
Definition: commctrl.h:3478
#define TreeView_GetItem(hwnd, pitem)
Definition: commctrl.h:3495
#define TreeView_GetItemRect(hwnd, hitem, prc, code)
Definition: commctrl.h:3434
#define ListView_GetSelectedCount(hwndLV)
Definition: commctrl.h:2714
#define LVM_GETITEMRECT
Definition: commctrl.h:2482
#define TVIS_EXPANDED
Definition: commctrl.h:3289
#define TVIF_CHILDREN
Definition: commctrl.h:3277
#define TreeView_HitTest(hwnd, lpht)
Definition: commctrl.h:3518
#define TVIF_STATE
Definition: commctrl.h:3274
#define LVIR_BOUNDS
Definition: commctrl.h:2477
static unsigned __int64 next
Definition: rand_nt.c:6
#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
#define _countof(array)
Definition: sndvol32.h:70
Definition: main.h:48
int nSplitPos
Definition: main.h:56
WCHAR szPath[MAX_PATH]
Definition: main.h:58
HWND hAddressBtnWnd
Definition: main.h:53
int nFocusPanel
Definition: main.h:55
HICON hArrowIcon
Definition: main.h:54
HWND hTreeWnd
Definition: main.h:50
HWND hListWnd
Definition: main.h:51
HWND hAddressBarWnd
Definition: main.h:52
HWND hWnd
Definition: main.h:49
Definition: tftpd.h:60
LPWSTR dwTypeData
Definition: winuser.h:3272
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:3526
#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
int32_t INT
Definition: typedefs.h:58
#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)
#define DEFAULT_GUI_FONT
Definition: wingdi.h:909
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_CURRENT_USER
Definition: winreg.h:11
HWND WINAPI SetCapture(_In_ HWND hWnd)
#define MF_BYCOMMAND
Definition: winuser.h:202
#define MIIM_STRING
Definition: winuser.h:730
#define MIIM_ID
Definition: winuser.h:725
#define WM_KEYUP
Definition: winuser.h:1719
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:5743
#define WM_CAPTURECHANGED
Definition: winuser.h:1811
#define TPM_RIGHTBUTTON
Definition: winuser.h:2383
#define WM_CREATE
Definition: winuser.h:1611
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:1614
#define WM_COMMAND
Definition: winuser.h:1743
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:2255
#define IDC_ARROW
Definition: winuser.h:687
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2722
#define InsertMenuItem
Definition: winuser.h:5816
#define WM_SETFOCUS
Definition: winuser.h:1616
#define SetMenuItemInfo
Definition: winuser.h:5862
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define WM_MOUSEMOVE
Definition: winuser.h:1778
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define SIZE_MINIMIZED
Definition: winuser.h:2509
#define WM_LBUTTONDOWN
Definition: winuser.h:1779
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2157
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
#define MIIM_STATE
Definition: winuser.h:724
#define MFS_DEFAULT
Definition: winuser.h:751
#define BM_SETIMAGE
Definition: winuser.h:1925
#define WM_RBUTTONDOWN
Definition: winuser.h:1782
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define VK_RETURN
Definition: winuser.h:2204
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:754
#define MF_SEPARATOR
Definition: winuser.h:137
#define BS_FLAT
Definition: winuser.h:280
#define WM_SETFONT
Definition: winuser.h:1653
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:2478
#define BS_VCENTER
Definition: winuser.h:279
#define WM_LBUTTONUP
Definition: winuser.h:1780
#define CW_USEDEFAULT
Definition: winuser.h:225
#define WM_SETCURSOR
Definition: winuser.h:1639
#define BN_CLICKED
Definition: winuser.h:1928
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
#define WM_DESTROY
Definition: winuser.h:1612
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define WM_KEYDOWN
Definition: winuser.h:1718
#define BS_CENTER
Definition: winuser.h:260
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2909
#define IDC_SIZEWE
Definition: winuser.h:694
#define GetMenuItemInfo
Definition: winuser.h:5800
#define VK_ESCAPE
Definition: winuser.h:2217
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:2105
#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 885 of file framewnd.c.

886{
887 BOOL bClipboardOpened = FALSE;
889 WCHAR szBuffer[512];
890 HGLOBAL hGlobal;
891 LPWSTR s;
892 SIZE_T cbGlobal;
893
894 if (!OpenClipboard(hWnd))
895 goto done;
896 bClipboardOpened = TRUE;
897
898 if (!EmptyClipboard())
899 goto done;
900
901 if (!GetKeyName(szBuffer, ARRAY_SIZE(szBuffer), hRootKey, keyName))
902 goto done;
903
904 cbGlobal = (wcslen(szBuffer) + 1) * sizeof(WCHAR);
905 hGlobal = GlobalAlloc(GMEM_MOVEABLE, cbGlobal);
906 if (!hGlobal)
907 goto done;
908
909 s = GlobalLock(hGlobal);
910 StringCbCopyW(s, cbGlobal, szBuffer);
911 GlobalUnlock(hGlobal);
912
914 bSuccess = TRUE;
915
916done:
917 if (bClipboardOpened)
919 return bSuccess;
920}
#define CF_UNICODETEXT
Definition: constants.h:408
BOOL GetKeyName(LPWSTR pszDest, size_t iDestLength, HKEY hRootKey, LPCWSTR lpSubKey)
Definition: edit.c:2072
static BOOLEAN bSuccess
Definition: drive.cpp:477
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 618 of file listview.c.

619{
620 RECT rcClient;
621 HWND hwndLV;
622
623 /* Get the dimensions of the parent window's client area, and create the list view control. */
624 GetClientRect(hwndParent, &rcClient);
625 hwndLV = CreateWindowExW(WS_EX_CLIENTEDGE, WC_LISTVIEW, L"List View",
627 0, 0, rcClient.right, rcClient.bottom,
628 hwndParent, id, hInst, NULL);
629 if (!hwndLV) return NULL;
630
631 /* Initialize the image list, and add items to the control. */
632 if (!CreateListColumns(hwndLV, cx)) goto fail;
633 if (!InitListViewImageLists(hwndLV)) goto fail;
634
635 return hwndLV;
636fail:
637 DestroyWindow(hwndLV);
638 return NULL;
639}
static BOOL CreateListColumns(HWND hWndListView, INT cxTotal)
Definition: listview.c:246
static BOOL InitListViewImageLists(HWND hwndLV)
Definition: listview.c:268
static HWND hwndParent
Definition: cryptui.c:300
#define LVS_SHOWSELALWAYS
Definition: commctrl.h:2272
#define LVS_REPORT
Definition: commctrl.h:2267
_Out_opt_ int * cx
Definition: commctrl.h:585
#define WC_LISTVIEW
Definition: commctrl.h:2264
#define LVS_EDITLABELS
Definition: commctrl.h:2278
BOOL WINAPI DestroyWindow(_In_ HWND)

◆ CreateNewKey()

BOOL CreateNewKey ( HWND  hwndTV,
HTREEITEM  hItem 
)

Definition at line 563 of file treeview.c.

564{
565 WCHAR szNewKeyFormat[128];
566 WCHAR szNewKey[128];
567 LPCWSTR pszKeyPath;
568 int iIndex = 1;
569 LONG nResult;
570 HKEY hRootKey = NULL, hKey = NULL, hNewKey = NULL;
572 DWORD dwDisposition;
573 HTREEITEM hNewItem;
574
575 pszKeyPath = GetItemPath(hwndTV, hItem, &hRootKey);
576 if (!pszKeyPath)
577 return bSuccess;
578 if (pszKeyPath[0] == L'\0')
579 hKey = hRootKey;
580 else if (RegOpenKeyW(hRootKey, pszKeyPath, &hKey) != ERROR_SUCCESS)
581 goto done;
582
583 if (LoadStringW(hInst, IDS_NEW_KEY, szNewKeyFormat, ARRAY_SIZE(szNewKeyFormat)) <= 0)
584 goto done;
585
586 /* Need to create a new key with a unique name */
587 do
588 {
589 wsprintf(szNewKey, szNewKeyFormat, iIndex++);
590 nResult = RegCreateKeyExW(hKey, szNewKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hNewKey, &dwDisposition);
591 if (hNewKey && dwDisposition == REG_OPENED_EXISTING_KEY)
592 {
593 RegCloseKey(hNewKey);
594 hNewKey = NULL;
595 }
596 else if (!hNewKey)
597 {
598 InfoMessageBox(hFrameWnd, MB_OK | MB_ICONERROR, NULL, L"Cannot create new key!\n\nError Code: %d", nResult);
599 goto done;
600 }
601 }
602 while(!hNewKey);
603
604 /* Insert the new key */
605 hNewItem = InsertNode(hwndTV, hItem, szNewKey);
606 if (!hNewItem)
607 goto done;
608
609 /* The new key's name is probably not appropriate yet */
610 (void)TreeView_EditLabel(hwndTV, hNewItem);
611
612 bSuccess = TRUE;
613
614done:
615 if (hKey != hRootKey && hKey)
617 if (hNewKey)
618 RegCloseKey(hNewKey);
619 return bSuccess;
620}
int InfoMessageBox(HWND hWnd, UINT uType, LPCWSTR lpTitle, LPCWSTR lpMessage,...)
Definition: error.c:38
#define IDS_NEW_KEY
Definition: resource.h:145
LPCWSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY *phRootKey)
Definition: treeview.c:73
HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPWSTR name)
Definition: treeview.c:328
#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:3509
#define MB_ICONERROR
Definition: winuser.h:790
#define MB_OK
Definition: winuser.h:793
#define wsprintf
Definition: winuser.h:5877

Referenced by _CmdWndProc().

◆ CreateTreeView()

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

Definition at line 733 of file treeview.c.

734{
735 RECT rcClient;
736 HWND hwndTV;
737
738 /* Get the dimensions of the parent window's client area, and create the tree view control. */
739 GetClientRect(hwndParent, &rcClient);
742 0, 0, rcClient.right, rcClient.bottom,
743 hwndParent, id, hInst, NULL);
744 if (!hwndTV) return NULL;
745
746 /* Initialize the image list, and add items to the control. */
747 if (!InitTreeViewImageLists(hwndTV) || !InitTreeViewItems(hwndTV, pHostName))
748 {
749 DestroyWindow(hwndTV);
750 return NULL;
751 }
752 return hwndTV;
753}
static BOOL InitTreeViewImageLists(HWND hwndTV)
Definition: treeview.c:434
static BOOL InitTreeViewItems(HWND hwndTV, LPWSTR pHostName)
Definition: treeview.c:388
#define TVS_LINESATROOT
Definition: commctrl.h:3254
#define TVS_SHOWSELALWAYS
Definition: commctrl.h:3257
#define TVS_HASLINES
Definition: commctrl.h:3253
#define WC_TREEVIEW
Definition: commctrl.h:3250
#define TVS_HASBUTTONS
Definition: commctrl.h:3252
#define TVS_EDITLABELS
Definition: commctrl.h:3255

Referenced by ChildWndProc().

◆ delete_registry_key()

void delete_registry_key ( WCHAR reg_key_name)

Definition at line 1089 of file regproc.c.

1090{
1091 WCHAR *key_name = NULL;
1092 HKEY key_class;
1093
1094 if (!reg_key_name || !reg_key_name[0])
1095 return;
1096
1097 if (!(key_class = parse_key_name(reg_key_name, &key_name)))
1098 {
1099 if (key_name) *(key_name - 1) = 0;
1100#ifdef __REACTOS__
1102 return;
1103#else
1105#endif
1106 }
1107
1108 if (!key_name || !*key_name)
1109#ifdef __REACTOS__
1110 {
1111 output_message(STRING_DELETE_FAILED, reg_key_name);
1112 return;
1113 }
1114#else
1115 error_exit(STRING_DELETE_FAILED, reg_key_name);
1116#endif
1117
1118#ifdef __REACTOS__
1119 SHDeleteKey(key_class, key_name);
1120#else
1121 RegDeleteTreeW(key_class, key_name);
1122#endif
1123}
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:88
static HKEY parse_key_name(WCHAR *key_name, WCHAR **key_path)
Definition: regproc.c:394
#define STRING_DELETE_FAILED
Definition: resource.h:345
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 1938 of file edit.c.

1939{
1940 WCHAR msg[128], caption[128];
1941 BOOL result = FALSE;
1942 LONG lRet;
1943 HKEY hKey;
1944
1945 lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ|KEY_SET_VALUE, &hKey);
1946 if (lRet != ERROR_SUCCESS)
1947 {
1949 return FALSE;
1950 }
1951
1954
1956 goto done;
1957
1958 lRet = SHDeleteKey(hKeyRoot, keyPath);
1959 if (lRet != ERROR_SUCCESS)
1960 {
1961 error(hwnd, IDS_BAD_KEY, keyPath);
1962 goto done;
1963 }
1964 result = TRUE;
1965
1966done:
1968 return result;
1969}
#define msg(x)
Definition: auth_time.c:54
static void error_code_messagebox(HWND hwnd, DWORD error_code)
Definition: edit.c:54
#define IDS_QUERY_DELETE_KEY_ONE
Definition: resource.h:106
#define IDS_BAD_KEY
Definition: resource.h:95
#define IDS_QUERY_DELETE_KEY_CONFIRM
Definition: resource.h:108
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:820
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define MB_ICONQUESTION
Definition: winuser.h:792
#define IDYES
Definition: winuser.h:838

Referenced by _CmdWndProc(), and DECLARE_INTERFACE_().

◆ DeleteNode()

BOOL DeleteNode ( HWND  hwndTV,
HTREEITEM  hItem 
)

Definition at line 99 of file treeview.c.

100{
101 if (!hItem) hItem = TreeView_GetSelection(hwndTV);
102 if (!hItem) return FALSE;
103 return TreeView_DeleteItem(hwndTV, hItem);
104}
#define TreeView_DeleteItem(hwnd, hitem)
Definition: commctrl.h:3420

◆ DestroyListView()

void DestroyListView ( HWND  hwndLV)

Definition at line 641 of file listview.c.

642{
643 INT count, i;
645
647 for (i = 0; i < count; i++)
648 {
649 item.mask = LVIF_PARAM;
650 item.iItem = i;
651 (void)ListView_GetItem(hwndLV, &item);
652 free(((LINE_INFO*)item.lParam)->name);
653 HeapFree(GetProcessHeap(), 0, (void*)item.lParam);
654 }
655}
#define free
Definition: debug_ros.c:5
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2312
#define LVIF_PARAM
Definition: commctrl.h:2316
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2399

Referenced by ChildWndProc(), and RefreshListView().

◆ DestroyMainMenu()

void DestroyMainMenu ( void  )

Definition at line 139 of file main.c.

140{
142}
HMENU hMenuFrame
Definition: main.c:24
BOOL WINAPI DestroyMenu(_In_ HMENU)

Referenced by ChildWndProc().

◆ DestroyTreeView()

void DestroyTreeView ( HWND  hwndTV)

Definition at line 755 of file treeview.c.

756{
758
760
761 /* Destroy the image list associated with the tree view control */
764}
static LPWSTR pathBuffer
Definition: treeview.c:16
HIMAGELIST himl
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
#define TVSIL_NORMAL
Definition: commctrl.h:3448
#define TreeView_GetImageList(hwnd, iImage)
Definition: commctrl.h:3446

◆ error_exit()

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

Definition at line 88 of file regedit.c.

89{
90 WCHAR fmt[1536];
91 va_list va_args;
92
94 {
95#ifndef __REACTOS__
96 WINE_FIXME("LoadString failed with %lu\n", GetLastError());
97#endif
98 return;
99 }
100 va_start(va_args, id);
101 output_formatstring(fmt, va_args);
102 va_end(va_args);
103
104 exit(0); /* regedit.exe always terminates with error code zero */
105}
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:50
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 11 of file error.c.

12{
13 int iRet = 0;
14 LPWSTR lpMsgBuf = NULL;
15 DWORD Status = 0;
17
18 va_start(args, dwErrorCode);
19
21 NULL,
22 dwErrorCode,
24 (LPWSTR)&lpMsgBuf,
25 0,
26 &args);
27
28 va_end(args);
29
30 iRet = MessageBoxW(hWnd, (Status && lpMsgBuf ? lpMsgBuf : L"Error displaying error message."), lpTitle, MB_OK | MB_ICONERROR);
31
32 if (lpMsgBuf) LocalFree(lpMsgBuf);
33
34 /* Return the MessageBoxW information */
35 return iRet;
36}
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 1566 of file regproc.c.

1567{
1568 BOOL unicode = (format == REG_FORMAT_5);
1569
1570 if (path && *path)
1571 return export_key(file_name, path, unicode);
1572 else
1573 return export_all(file_name, path, unicode);
1574}
#define REG_FORMAT_5
Definition: main.h:31
static BOOL export_all(WCHAR *file_name, WCHAR *path, BOOL unicode)
Definition: regproc.c:1530
static BOOL export_key(WCHAR *file_name, WCHAR *path, BOOL unicode)
Definition: regproc.c:1501
static LPCWSTR file_name
Definition: protocol.c:147
Definition: format.c:58

Referenced by ExportRegistryFile(), and PerformRegAction().

◆ ExportRegistryFile()

BOOL ExportRegistryFile ( HWND  hWnd)

Definition at line 585 of file framewnd.c.

586{
587 BOOL bRet = FALSE;
589 WCHAR ExportKeyPath[_MAX_PATH] = {0};
590 WCHAR Caption[128], szTitle[512], szText[512];
591 HKEY hKeyRoot;
592 LPCWSTR pszKeyPath;
593
594 /* Figure out which key path we are exporting */
595 pszKeyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot);
596 GetKeyName(ExportKeyPath, ARRAY_SIZE(ExportKeyPath), hKeyRoot, pszKeyPath);
597
599 LoadStringW(hInst, IDS_EXPORT_REG_FILE, Caption, ARRAY_SIZE(Caption));
600 ofn.lpstrTitle = Caption;
601
602 /* Only set the path if a key (not the root node) is selected */
603 if (hKeyRoot != 0)
604 {
605 ofn.lCustData = (LPARAM) ExportKeyPath;
606 }
610 if (GetSaveFileName(&ofn))
611 {
612 switch (ofn.nFilterIndex)
613 {
614 case 2: /* Registry Hive Files */
615 {
616 LONG lResult;
617 HKEY hSubKey;
618
619 /* Open the subkey */
620 lResult = RegOpenKeyExW(hKeyRoot, pszKeyPath, 0, KEY_READ, &hSubKey);
621 if (lResult == ERROR_SUCCESS)
622 {
623 /* Enable the 'backup' privilege, save the hive then disable the privilege */
625 lResult = RegSaveKeyW(hSubKey, ofn.lpstrFile, NULL);
626 if (lResult == ERROR_ALREADY_EXISTS)
627 {
628 /*
629 * We are here, that means that we already said "yes" to the confirmation dialog.
630 * So we absolutely want to replace the hive file.
631 */
633 {
634 /* Try again */
635 lResult = RegSaveKeyW(hSubKey, ofn.lpstrFile, NULL);
636 }
637 }
639
640 if (lResult != ERROR_SUCCESS)
641 {
642 /*
643 * If we are here, it's because RegSaveKeyW has failed for any reason.
644 * The problem is that even if it has failed, it has created or
645 * replaced the exported hive file with a new empty file. We don't
646 * want to keep this file, so we delete it.
647 */
649 }
650
651 /* Close the subkey */
652 RegCloseKey(hSubKey);
653 }
654
655 /* Set the return value */
656 bRet = (lResult == ERROR_SUCCESS);
657
658 /* Display error, if any */
659 if (!bRet) ErrorMessageBox(hWnd, Caption, lResult);
660
661 break;
662 }
663
664 case 1: /* Windows Registry Editor Version 5.00 */
665 case 3: /* REGEDIT4 */
666 default: /* All files ==> use Windows Registry Editor Version 5.00 */
667 {
668 if (!export_registry_key(ofn.lpstrFile, ExportKeyPath,
670 : REG_FORMAT_5)))
671 {
672 /* Error creating the file */
674 LoadStringW(hInst, IDS_EXPORT_ERROR, szText, ARRAY_SIZE(szText));
676 bRet = FALSE;
677 }
678 else
679 {
680 bRet = TRUE;
681 }
682
683 break;
684 }
685
686 case 4: /* Text File */
687 {
688 bRet = txt_export_registry_key(ofn.lpstrFile, ExportKeyPath);
689 if (!bRet)
690 {
691 /* Error creating the file */
693 LoadStringW(hInst, IDS_EXPORT_ERROR, szText, ARRAY_SIZE(szText));
695 }
696 break;
697 }
698 }
699 }
700 else
701 {
703 }
704
705 return bRet;
706}
#define SE_BACKUP_NAME
#define IDS_APP_TITLE
Definition: resource.h:10
int ErrorMessageBox(HWND hWnd, LPCWSTR lpTitle, DWORD dwErrorCode,...)
Definition: error.c:11
static BOOL CheckCommDlgError(HWND hWnd)
Definition: framewnd.c:183
static BOOL InitOpenFileName(HWND hWnd, OPENFILENAME *pofn, BOOL bSave)
Definition: framewnd.c:249
static BOOL EnablePrivilege(LPCWSTR lpszPrivilegeName, LPCWSTR lpszSystemName, BOOL bEnablePrivilege)
Definition: framewnd.c:320
static UINT_PTR CALLBACK ExportRegistryFile_OFNHookProc(HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: framewnd.c:531
#define REG_FORMAT_4
Definition: main.h:32
BOOL export_registry_key(WCHAR *file_name, WCHAR *path, DWORD format)
Definition: regproc.c:1566
BOOL txt_export_registry_key(LPCWSTR file_name, LPCWSTR path)
Definition: txtproc.c:401
#define IDS_EXPORT_REG_FILE
Definition: resource.h:84
#define IDS_EXPORT_ERROR
Definition: resource.h:152
#define IDD_EXPORTRANGE
Definition: resource.h:29
#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 811 of file find.c.

812{
814 hWnd, FindDialogProc, 0) != 0)
815 {
817 }
818}
void FindNextMessageBox(HWND hWnd)
Definition: find.c:799
static INT_PTR CALLBACK FindDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: find.c:684
#define IDD_FIND
Definition: resource.h:35
#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 609 of file find.c.

610{
611 HKEY hKeyRoot;
612 LPCWSTR pszKeyPath;
613 BOOL fSuccess;
614 WCHAR szFullKey[512];
615 LPCWSTR pszValueName;
616 LPWSTR pszFoundSubKey, pszFoundValueName;
617
618 if (wcslen(s_szFindWhat) == 0)
619 {
621 return TRUE;
622 }
623
625
626 pszKeyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot);
627 if (pszKeyPath == NULL)
628 {
629 hKeyRoot = HKEY_CLASSES_ROOT;
630 pszKeyPath = s_empty;
631 }
632
633 /* Create abort find dialog */
637 {
640 }
641 s_bAbort = FALSE;
642
643 pszValueName = GetValueName(g_pChildWnd->hListWnd, -1);
644
649
650 fSuccess = RegFindWalk(&hKeyRoot, pszKeyPath, pszValueName,
651 &pszFoundSubKey, &pszFoundValueName);
652
657
659 {
662 }
663
664 if (fSuccess)
665 {
666 GetKeyName(szFullKey, ARRAY_SIZE(szFullKey), hKeyRoot, pszFoundSubKey);
667 SelectNode(g_pChildWnd->hTreeWnd, szFullKey);
668 free(pszFoundSubKey);
669
670 if (pszFoundValueName != NULL)
671 {
672 SetValueName(g_pChildWnd->hListWnd, pszFoundValueName);
673 free(pszFoundValueName);
675 }
676 else
677 {
679 }
680 }
681 return fSuccess || s_bAbort;
682}
VOID SetValueName(HWND hwndLV, LPCWSTR pszValueName)
Definition: listview.c:71
BOOL RegFindWalk(HKEY *phKey, LPCWSTR pszSubKey, LPCWSTR pszValueName, LPWSTR *ppszFoundSubKey, LPWSTR *ppszFoundValueName)
Definition: find.c:334
static BOOL s_bAbort
Definition: find.c:19
static HWND s_hwndAbortDialog
Definition: find.c:18
static const WCHAR s_empty[]
Definition: find.c:24
static INT_PTR CALLBACK AbortFindDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: find.c:581
void FindDialog(HWND hWnd)
Definition: find.c:811
static DWORD GetFindFlags(void)
Definition: find.c:534
static WCHAR s_szFindWhat[256]
Definition: find.c:15
static DWORD s_dwFlags
Definition: find.c:21
WCHAR * GetValueName(HWND hwndLV, int iStartAt)
Definition: listview.c:42
BOOL SelectNode(HWND hwndTV, LPCWSTR keyPath)
Definition: treeview.c:766
#define IDD_FINDING
Definition: resource.h:36
#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:4284
#define SW_SHOW
Definition: winuser.h:778

Referenced by FindNextMessageBox().

◆ FindNextMessageBox()

void FindNextMessageBox ( HWND  hWnd)

Definition at line 799 of file find.c.

800{
801 if (!FindNext(hWnd))
802 {
803 WCHAR msg[128], caption[128];
804
806 LoadStringW(hInst, IDS_APP_TITLE, caption, ARRAY_SIZE(caption));
808 }
809}
BOOL FindNext(HWND hWnd)
Definition: find.c:609
#define IDS_FINISHEDFIND
Definition: resource.h:154
#define MB_ICONINFORMATION
Definition: winuser.h:805

Referenced by _CmdWndProc(), and FindDialog().

◆ FrameWndProc()

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

PURPOSE: Processes messages for the main frame window

WM_COMMAND - process the application menu WM_DESTROY - post a quit message and return

Definition at line 1440 of file framewnd.c.

1441{
1442 RECT rc;
1443 switch (message)
1444 {
1445 case WM_CREATE:
1446 // For now, the Help dialog item is disabled because of lacking of HTML Help support
1448 GetClientRect(hWnd, &rc);
1450 rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
1451 hWnd, (HMENU)0, hInst, 0);
1452 break;
1453 case WM_COMMAND:
1456 break;
1457 case WM_ACTIVATE:
1460 break;
1461 case WM_SIZE:
1463 break;
1464 case WM_INITMENU:
1466 break;
1467 case WM_ENTERMENULOOP:
1469 break;
1470 case WM_EXITMENULOOP:
1472 break;
1473 case WM_MENUSELECT:
1475 break;
1476 case WM_SYSCOLORCHANGE:
1477 /* Forward WM_SYSCOLORCHANGE to common controls */
1480 break;
1481 case WM_DESTROY:
1482 WinHelpW(hWnd, L"regedit", HELP_QUIT, 0);
1483 SaveSettings();
1484 PostQuitMessage(0);
1485 default:
1487 }
1488 return 0;
1489}
void SaveSettings(void)
Definition: settings.c:115
static void resize_frame_client(HWND hWnd)
Definition: framewnd.c:42
static void OnEnterMenuLoop(HWND hWnd)
Definition: framewnd.c:109
static void OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
Definition: framewnd.c:129
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: framewnd.c:1127
static void OnExitMenuLoop(HWND hWnd)
Definition: framewnd.c:121
static void OnInitMenu(HWND hWnd)
Definition: framewnd.c:50
WCHAR szChildClass[MAX_LOADSTRING]
Definition: main.c:32
#define ID_HELP_HELPTOPICS
Definition: resource.h:60
#define HELP_QUIT
Definition: winuser.h:2417
BOOL WINAPI WinHelpW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_ UINT, _In_ ULONG_PTR)
#define WM_INITMENU
Definition: winuser.h:1748
#define WA_INACTIVE
Definition: winuser.h:2625
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1629
#define WM_ACTIVATE
Definition: winuser.h:1615
#define WM_ENTERMENULOOP
Definition: winuser.h:1807
#define WM_EXITMENULOOP
Definition: winuser.h:1808
#define WM_MENUSELECT
Definition: winuser.h:1750
HMENU WINAPI GetMenu(_In_ HWND)

◆ get_root_key_name()

LPCWSTR get_root_key_name ( HKEY  hRootKey)

Definition at line 76 of file childwnd.c.

77{
78 if (hRootKey == HKEY_CLASSES_ROOT) return L"HKEY_CLASSES_ROOT";
79 if (hRootKey == HKEY_CURRENT_USER) return L"HKEY_CURRENT_USER";
80 if (hRootKey == HKEY_LOCAL_MACHINE) return L"HKEY_LOCAL_MACHINE";
81 if (hRootKey == HKEY_USERS) return L"HKEY_USERS";
82 if (hRootKey == HKEY_CURRENT_CONFIG) return L"HKEY_CURRENT_CONFIG";
83 if (hRootKey == HKEY_DYN_DATA) return L"HKEY_DYN_DATA";
84
85 return L"UNKNOWN HKEY, PLEASE REPORT";
86}
#define HKEY_CURRENT_CONFIG
Definition: winreg.h:15
#define HKEY_DYN_DATA
Definition: winreg.h:16
#define HKEY_USERS
Definition: winreg.h:13

Referenced by SaveSettings(), and UpdateAddress().

◆ GetItemPath()

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

Definition at line 73 of file treeview.c.

74{
75 int pathLen = 0, maxLen;
76
77 *phRootKey = NULL;
78
79 if (!pathBuffer)
81 if (!pathBuffer)
82 return NULL;
83
85
86 maxLen = (int)HeapSize(GetProcessHeap(), 0, pathBuffer);
87
88 if (!hItem)
89 {
91 }
92 if (maxLen == -1 || !hItem || !get_item_path(hwndTV, hItem, phRootKey, &pathBuffer, &pathLen, &maxLen))
93 {
94 return NULL;
95 }
96 return pathBuffer;
97}
static BOOL get_item_path(HWND hwndTV, HTREEITEM hItem, HKEY *phKey, LPWSTR *pKeyPath, int *pPathLen, int *pMaxLen)
Definition: treeview.c:25
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(), GetItemFullPath(), 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 2072 of file edit.c.

2073{
2074 LPCWSTR pszRootKey;
2075
2076 if (hRootKey == HKEY_CLASSES_ROOT)
2077 pszRootKey = L"HKEY_CLASSES_ROOT";
2078 else if (hRootKey == HKEY_CURRENT_USER)
2079 pszRootKey = L"HKEY_CURRENT_USER";
2080 else if (hRootKey == HKEY_LOCAL_MACHINE)
2081 pszRootKey = L"HKEY_LOCAL_MACHINE";
2082 else if (hRootKey == HKEY_USERS)
2083 pszRootKey = L"HKEY_USERS";
2084 else if (hRootKey == HKEY_CURRENT_CONFIG)
2085 pszRootKey = L"HKEY_CURRENT_CONFIG";
2086 else if (hRootKey == HKEY_DYN_DATA)
2087 pszRootKey = L"HKEY_DYN_DATA";
2088 else
2089 return FALSE;
2090
2091 if (lpSubKey[0])
2092 _snwprintf(pszDest, iDestLength, L"%s\\%s", pszRootKey, lpSubKey);
2093 else
2094 _snwprintf(pszDest, iDestLength, L"%s", pszRootKey);
2095 return TRUE;
2096}

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

◆ GetMultiByteString()

char * GetMultiByteString ( const WCHAR strW)

Definition at line 73 of file regproc.c.

74{
75 if(strW)
76 {
77 char* strA;
78 int len = WideCharToMultiByte(CP_ACP, 0, strW, -1, NULL, 0, NULL, NULL);
79
80 strA = malloc(len);
82 return strA;
83 }
84 return NULL;
85}
#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 42 of file listview.c.

43{
44 int item;
45 LVITEMW LVItem;
46 PLINE_INFO lineinfo;
47
48 /*
49 if a new item is inserted, then no allocation,
50 otherwise the heap block will be lost!
51 */
52 item = ListView_GetNextItem(hwndLV, iStartAt, LVNI_SELECTED);
53 if (item == -1) return NULL;
54
55 /*
56 Should be always TRUE anyways
57 */
58 LVItem.iItem = item;
59 LVItem.iSubItem = 0;
60 LVItem.mask = LVIF_PARAM;
61 if (ListView_GetItem(hwndLV, &LVItem) == FALSE)
62 return NULL;
63
64 lineinfo = (PLINE_INFO)LVItem.lParam;
65 if (lineinfo == NULL)
66 return NULL;
67
68 return lineinfo->name;
69}
struct tagLINE_INFO * PLINE_INFO
if(dx< 0)
Definition: linetemp.h:194
LPWSTR name
Definition: listview.c:21
int iSubItem
Definition: commctrl.h:2367
UINT mask
Definition: commctrl.h:2365
LPARAM lParam
Definition: commctrl.h:2373

Referenced by _CmdWndProc(), and FindNext().

◆ import_registry_file()

BOOL import_registry_file ( FILE reg_file)

Definition at line 1041 of file regproc.c.

1042{
1043 BYTE s[2];
1044 struct parser parser;
1045 WCHAR *pos;
1046
1047 if (!reg_file || (fread(s, 2, 1, reg_file) != 1))
1048 return FALSE;
1049
1050 parser.is_unicode = (s[0] == 0xff && s[1] == 0xfe);
1052
1053 parser.file = reg_file;
1054 parser.two_wchars[0] = s[0];
1055 parser.two_wchars[1] = s[1];
1056 parser.reg_version = -1;
1057 parser.hkey = NULL;
1060 parser.parse_type = 0;
1061 parser.data_type = 0;
1062 parser.data = NULL;
1063 parser.data_size = 0;
1066
1068
1069 /* parser main loop */
1070 while (pos)
1072
1075
1077 close_key(&parser);
1078
1079 return TRUE;
1080}
static WCHAR * get_lineA(FILE *fp)
Definition: regproc.c:928
@ HEADER
Definition: regproc.c:111
@ REG_VERSION_INVALID
Definition: regproc.c:509
@ REG_VERSION_FUZZY
Definition: regproc.c:508
static WCHAR * get_lineW(FILE *fp)
Definition: regproc.c:986
static WCHAR *(* get_line)(FILE *)
Definition: regproc.c:106
static const parser_state_func parser_funcs[NB_PARSER_STATES]
Definition: regproc.c:169
_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 38 of file error.c.

39{
40 int iRet = 0;
41 LPWSTR lpMsgBuf = NULL;
43
44 va_start(args, lpMessage);
45
46 if (lpMessage)
47 {
48 SIZE_T strLen = _vscwprintf(lpMessage, args);
49
50 /* Create a buffer on the heap and zero it out (LPTR) */
51 lpMsgBuf = (LPWSTR)LocalAlloc(LPTR, (strLen + 1) * sizeof(WCHAR));
52 if (lpMsgBuf)
53 {
54 _vsnwprintf(lpMsgBuf, strLen, lpMessage, args);
55 }
56 }
57
58 va_end(args);
59
60 iRet = MessageBoxW(hWnd, (lpMessage && lpMsgBuf ? lpMsgBuf : L"Error displaying info message."), lpTitle, uType);
61
62 if (lpMsgBuf) LocalFree(lpMsgBuf);
63
64 /* Return the MessageBoxW information */
65 return iRet;
66}
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 328 of file treeview.c.

329{
331 HTREEITEM hNewItem = 0;
333
334 /* Default to the current selection */
335 if (!hItem)
336 {
338 if (!hItem)
339 return FALSE;
340 }
341
342 memset(&item, 0, sizeof(item));
343 item.hItem = hItem;
345 if (!TreeView_GetItem(hwndTV, &item))
346 return FALSE;
347
348 if (item.state & TVIS_EXPANDEDONCE)
349 {
350 hNewItem = AddEntryToTree(hwndTV, hItem, name, 0, 0);
352 }
353 else
354 {
356 item.hItem = hItem;
357 item.cChildren = 1;
358 if (!TreeView_SetItem(hwndTV, &item))
359 return FALSE;
360 }
361
363 if (!hNewItem)
364 {
365 for(hNewItem = TreeView_GetChild(hwndTV, hItem); hNewItem; hNewItem = TreeView_GetNextSibling(hwndTV, hNewItem))
366 {
367 item.mask = TVIF_HANDLE | TVIF_TEXT;
368 item.hItem = hNewItem;
369 item.pszText = buf;
370 item.cchTextMax = ARRAY_SIZE(buf);
371 if (!TreeView_GetItem(hwndTV, &item)) continue;
372 if (wcscmp(name, item.pszText) == 0) break;
373 }
374 }
375 if (hNewItem) (void)TreeView_SelectItem(hwndTV, hNewItem);
376
377 return hNewItem;
378}
#define MAX_NEW_KEY_LEN
Definition: main.h:28
static HTREEITEM AddEntryToTree(HWND hwndTV, HTREEITEM hParent, LPWSTR label, HKEY hKey, DWORD dwChildren)
Definition: treeview.c:107
#define TVIF_TEXT
Definition: commctrl.h:3271
#define TreeView_Expand(hwnd, hitem, code)
Definition: commctrl.h:3425
#define TreeView_GetChild(hwnd, hitem)
Definition: commctrl.h:3471
#define TVIS_EXPANDEDONCE
Definition: commctrl.h:3290
#define TVE_EXPAND
Definition: commctrl.h:3428
#define TVM_SORTCHILDREN
Definition: commctrl.h:3546
#define TVIF_HANDLE
Definition: commctrl.h:3275
#define TreeView_GetNextSibling(hwnd, hitem)
Definition: commctrl.h:3472
#define TreeView_SetItem(hwnd, pitem)
Definition: commctrl.h:3502
_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 95 of file listview.c.

96{
97 PLINE_INFO lineinfo;
99
100 Item.mask = LVIF_PARAM;
101 Item.iItem = i;
102 if(ListView_GetItem(hwndLV, &Item))
103 {
104 lineinfo = (PLINE_INFO)Item.lParam;
105 return lineinfo && (!lineinfo->name || !wcscmp(lineinfo->name, L""));
106 }
107 return FALSE;
108}
_In_ WDFCOLLECTION _In_ WDFOBJECT Item

Referenced by ChildWndProc().

◆ ListWndNotifyProc()

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

Definition at line 531 of file listview.c.

532{
534 int iSortingColumn;
536 *Result = TRUE;
537 switch (((LPNMHDR)lParam)->code)
538 {
539 case LVN_GETDISPINFO:
541 return TRUE;
542 case LVN_COLUMNCLICK:
543 iSortingColumn = ((LPNMLISTVIEW)lParam)->iSubItem;
544 (void)ListView_Sort(hWnd, iSortingColumn, g_iSortedColumn);
545 g_iSortedColumn = iSortingColumn;
546 return TRUE;
547 case NM_DBLCLK:
548 case NM_RETURN:
549 {
551 }
552 return TRUE;
553 case NM_SETFOCUS:
555 break;
558 if(Info)
559 {
560 PLINE_INFO lineinfo = (PLINE_INFO)Info->item.lParam;
561 if(!lineinfo->name || !wcscmp(lineinfo->name, L""))
562 {
563 *Result = TRUE;
564 }
565 else
566 {
567 *Result = FALSE;
568 }
569 }
570 else
571 *Result = TRUE;
572 return TRUE;
573 case LVN_ENDLABELEDIT:
575 if(Info && Info->item.pszText)
576 {
577 PLINE_INFO lineinfo = (PLINE_INFO)Info->item.lParam;
578 if(!lineinfo->name || !wcscmp(lineinfo->name, L""))
579 {
580 *Result = FALSE;
581 }
582 else
583 {
584 if(wcslen(Info->item.pszText) == 0)
585 {
586 WCHAR msg[128], caption[128];
587
590 MessageBoxW(0, msg, caption, 0);
591 *Result = TRUE;
592 }
593 else
594 {
595 HKEY hKeyRoot;
596 LPCWSTR keyPath;
597 LONG lResult;
598
599 keyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot);
600 lResult = RenameValue(hKeyRoot, keyPath, Info->item.pszText, lineinfo->name);
601 lineinfo->name = realloc(lineinfo->name, (wcslen(Info->item.pszText)+1)*sizeof(WCHAR));
602 if (lineinfo->name != NULL)
603 wcscpy(lineinfo->name, Info->item.pszText);
604
605 *Result = TRUE;
606 return (lResult == ERROR_SUCCESS);
607 }
608 }
609 }
610 else
611 *Result = TRUE;
612
613 return TRUE;
614 }
615 return FALSE;
616}
LONG RenameValue(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpDestValue, LPCWSTR lpSrcValue)
Definition: edit.c:2006
static void OnGetDispInfo(NMLVDISPINFO *plvdi)
Definition: listview.c:300
static INT g_iSortedColumn
Definition: listview.c:36
#define IDS_ERR_RENVAL_CAPTION
Definition: resource.h:91
#define IDS_ERR_RENVAL_TOEMPTY
Definition: resource.h:92
#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:3144
#define NM_DBLCLK
Definition: commctrl.h:131
#define LVN_GETDISPINFO
Definition: commctrl.h:3165
#define LVN_ENDLABELEDIT
Definition: commctrl.h:3164
#define NMLVDISPINFO
Definition: commctrl.h:3187
#define LVN_BEGINLABELEDIT
Definition: commctrl.h:3163
#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:4012

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:2438
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define BM_CLICK
Definition: winuser.h:1920
#define SendDlgItemMessage
Definition: winuser.h:5854
char TCHAR
Definition: xmlstorage.h:189

◆ ModifyValue()

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

Definition at line 1522 of file edit.c.

1523{
1524 DWORD type;
1525 LONG lRet;
1526 BOOL result = FALSE;
1527
1528 if (!hKey)
1529 return FALSE;
1530
1531 editValueName = valueName;
1532
1533 lRet = RegQueryValueExW(hKey, valueName, 0, &type, 0, &valueDataLen);
1534 if (lRet != ERROR_SUCCESS && (valueName == NULL || !valueName[0]))
1535 {
1536 lRet = ERROR_SUCCESS; /* Allow editing of (Default) values which don't exist */
1537 type = REG_SZ;
1538 valueDataLen = 0;
1541 }
1542
1543 if (lRet != ERROR_SUCCESS)
1544 {
1545 error(hwnd, IDS_BAD_VALUE, valueName);
1546 goto done;
1547 }
1548
1549 if (EditBin == FALSE && ((type == REG_SZ) || (type == REG_EXPAND_SZ)))
1550 {
1551 if (valueDataLen > 0)
1552 {
1554 {
1556 goto done;
1557 }
1558 lRet = RegQueryValueExW(hKey, valueName, 0, 0, (LPBYTE)stringValueData, &valueDataLen);
1559 if (lRet != ERROR_SUCCESS)
1560 {
1561 error(hwnd, IDS_BAD_VALUE, valueName);
1562 goto done;
1563 }
1564 }
1565 else
1566 {
1568 }
1569
1571 {
1572 if (stringValueData)
1573 {
1574 lRet = RegSetValueExW(hKey, valueName, 0, type, (LPBYTE)stringValueData, (DWORD)(wcslen(stringValueData) + 1) * sizeof(WCHAR));
1575 }
1576 else
1577 {
1578 lRet = RegSetValueExW(hKey, valueName, 0, type, NULL, 0);
1579 }
1580 if (lRet == ERROR_SUCCESS)
1581 result = TRUE;
1582 }
1583 }
1584 else if (EditBin == FALSE && type == REG_MULTI_SZ)
1585 {
1586 if (valueDataLen > 0)
1587 {
1588 size_t llen, listlen, nl_len;
1589 LPWSTR src, lines = NULL;
1590
1592 {
1594 goto done;
1595 }
1596 lRet = RegQueryValueExW(hKey, valueName, 0, 0, (LPBYTE)stringValueData, &valueDataLen);
1597 if (lRet != ERROR_SUCCESS)
1598 {
1599 error(hwnd, IDS_BAD_VALUE, valueName);
1600 goto done;
1601 }
1602
1603 /* convert \0 to \r\n */
1605 nl_len = wcslen(L"\r\n") * sizeof(WCHAR);
1606 listlen = sizeof(WCHAR);
1607 lines = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, listlen + sizeof(WCHAR));
1608 while(*src != L'\0')
1609 {
1610 llen = wcslen(src);
1611 if(llen == 0)
1612 break;
1613 listlen += (llen * sizeof(WCHAR)) + nl_len;
1615 wcscat(lines, src);
1616 wcscat(lines, L"\r\n");
1617 src += llen + 1;
1618 }
1621 }
1622 else
1623 {
1625 }
1626
1628 {
1629 if (stringValueData)
1630 {
1631 /* convert \r\n to \0 */
1632 BOOL EmptyLines = FALSE;
1633 LPWSTR src, lines, nl;
1634 size_t linechars, buflen, c_nl, dest;
1635
1637 buflen = sizeof(WCHAR);
1638 lines = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, buflen + sizeof(WCHAR));
1639 c_nl = wcslen(L"\r\n");
1640 dest = 0;
1641 while(*src != L'\0')
1642 {
1643 if((nl = wcsstr(src, L"\r\n")))
1644 {
1645 linechars = nl - src;
1646 if(nl == src)
1647 {
1648 EmptyLines = TRUE;
1649 src = nl + c_nl;
1650 continue;
1651 }
1652 }
1653 else
1654 {
1655 linechars = wcslen(src);
1656 }
1657 if(linechars > 0)
1658 {
1659 buflen += ((linechars + 1) * sizeof(WCHAR));
1661 memcpy((lines + dest), src, linechars * sizeof(WCHAR));
1662 dest += linechars;
1663 lines[dest++] = L'\0';
1664 }
1665 else
1666 {
1667 EmptyLines = TRUE;
1668 }
1669 src += linechars + (nl != NULL ? c_nl : 0);
1670 }
1671 lines[++dest] = L'\0';
1672
1673 if(EmptyLines)
1674 {
1676 }
1677
1678 lRet = RegSetValueExW(hKey, valueName, 0, type, (LPBYTE)lines, (DWORD)buflen);
1680 }
1681 else
1682 {
1683 lRet = RegSetValueExW(hKey, valueName, 0, type, NULL, 0);
1684 }
1685 if (lRet == ERROR_SUCCESS)
1686 result = TRUE;
1687 }
1688 }
1689 else if (EditBin == FALSE && type == REG_DWORD)
1690 {
1691 lRet = RegQueryValueExW(hKey, valueName, 0, 0, (LPBYTE)&dwordValueData, &valueDataLen);
1692 if (lRet != ERROR_SUCCESS)
1693 {
1694 error(hwnd, IDS_BAD_VALUE, valueName);
1695 goto done;
1696 }
1697
1699 {
1700 lRet = RegSetValueExW(hKey, valueName, 0, type, (LPBYTE)&dwordValueData, sizeof(DWORD));
1701 if (lRet == ERROR_SUCCESS)
1702 result = TRUE;
1703 }
1704 }
1705 else if (EditBin == FALSE && type == REG_RESOURCE_LIST)
1706 {
1707 if (valueDataLen > 0)
1708 {
1710 if (resourceValueData == NULL)
1711 {
1713 goto done;
1714 }
1715
1716 lRet = RegQueryValueExW(hKey, valueName, 0, 0, (LPBYTE)resourceValueData, &valueDataLen);
1717 if (lRet != ERROR_SUCCESS)
1718 {
1719 error(hwnd, IDS_BAD_VALUE, valueName);
1720 goto done;
1721 }
1722 }
1723 else
1724 {
1726 }
1727
1729 {
1730 }
1731 }
1732 else if (EditBin == FALSE && type == REG_FULL_RESOURCE_DESCRIPTOR)
1733 {
1734 if (valueDataLen > 0)
1735 {
1737 if (resourceValueData == NULL)
1738 {
1740 goto done;
1741 }
1742
1743 lRet = RegQueryValueExW(hKey, valueName, 0, 0, (LPBYTE)&resourceValueData->List[0], &valueDataLen);
1744 if (lRet != ERROR_SUCCESS)
1745 {
1746 error(hwnd, IDS_BAD_VALUE, valueName);
1747 goto done;
1748 }
1749
1752 }
1753 else
1754 {
1756 }
1757
1759 {
1760 }
1761 }
1762 else if (EditBin == FALSE && type == REG_RESOURCE_REQUIREMENTS_LIST)
1763 {
1764 if (valueDataLen > 0)
1765 {
1768 {
1770 goto done;
1771 }
1772
1773 lRet = RegQueryValueExW(hKey, valueName, 0, 0, (LPBYTE)requirementsValueData, &valueDataLen);
1774 if (lRet != ERROR_SUCCESS)
1775 {
1776 error(hwnd, IDS_BAD_VALUE, valueName);
1777 goto done;
1778 }
1779
1780 }
1781 else
1782 {
1784 }
1785
1787 {
1788 }
1789 }
1790 else if ((EditBin != FALSE) || (type == REG_NONE) || (type == REG_BINARY))
1791 {
1792 if(valueDataLen > 0)
1793 {
1795 {
1797 goto done;
1798 }
1799
1800 /* Use the unicode version, so editing strings in binary mode is correct */
1801 lRet = RegQueryValueExW(hKey, valueName,
1803 if (lRet != ERROR_SUCCESS)
1804 {
1806 error(hwnd, IDS_BAD_VALUE, valueName);
1807 goto done;
1808 }
1809 }
1810 else
1811 {
1813 }
1814
1816 {
1817 /* Use the unicode version, so editing strings in binary mode is correct */
1818 lRet = RegSetValueExW(hKey, valueName,
1820 if (lRet == ERROR_SUCCESS)
1821 result = TRUE;
1822 }
1823 if(binValueData != NULL)
1825 }
1826 else
1827 {
1829 }
1830
1831done:
1835
1836 if (stringValueData)
1839
1843
1844 return result;
1845}
#define IDS_BAD_VALUE
Definition: resource.h:11
static WCHAR * stringValueData
Definition: edit.c:21
static PCM_RESOURCE_LIST resourceValueData
Definition: edit.c:24
INT_PTR CALLBACK modify_string_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:85
static INT_PTR CALLBACK modify_requirements_list_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:1490
static DWORD valueDataLen
Definition: edit.c:26
static INT fullResourceIndex
Definition: edit.c:25
static INT_PTR CALLBACK modify_resource_list_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:1019
static DWORD dwordValueData
Definition: edit.c:23
static const WCHAR * editValueName
Definition: edit.c:20
static INT_PTR CALLBACK modify_resource_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:899
static PVOID binValueData
Definition: edit.c:22
INT_PTR CALLBACK modify_multi_string_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:153
static PIO_RESOURCE_REQUIREMENTS_LIST requirementsValueData
Definition: edit.c:27
INT_PTR CALLBACK modify_dword_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:260
INT_PTR CALLBACK modify_binary_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:373
#define IDD_EDIT_RESOURCE
Definition: resource.h:258
#define IDD_EDIT_MULTI_STRING
Definition: resource.h:235
#define IDS_TOO_BIG_VALUE
Definition: resource.h:74
#define IDD_EDIT_STRING
Definition: resource.h:227
#define IDD_EDIT_BIN_DATA
Definition: resource.h:236
#define IDD_EDIT_RESOURCE_LIST
Definition: resource.h:254
#define IDD_EDIT_REQUIREMENTS_LIST
Definition: resource.h:274
#define IDS_MULTI_SZ_EMPTY_STRING
Definition: resource.h:77
#define IDS_UNSUPPORTED_TYPE
Definition: resource.h:73
#define IDD_EDIT_DWORD
Definition: resource.h:231
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:4402
#define IDOK
Definition: winuser.h:833

Referenced by _CmdWndProc().

◆ OnTreeExpanding()

BOOL OnTreeExpanding ( HWND  hWnd,
NMTREEVIEW pnmtv 
)

Definition at line 496 of file treeview.c.

497{
498 DWORD dwCount, dwIndex, dwMaxSubKeyLen;
499 HKEY hRoot, hNewKey, hKey;
500 LPCWSTR keyPath;
501 LPWSTR Name;
502 LONG errCode;
503 HCURSOR hcursorOld;
504
505 static int expanding;
506 if (expanding) return FALSE;
507 if (pnmtv->itemNew.state & TVIS_EXPANDEDONCE )
508 {
509 return TRUE;
510 }
511 expanding = TRUE;
512 hcursorOld = SetCursor(LoadCursor(NULL, IDC_WAIT));
513 SendMessageW(hwndTV, WM_SETREDRAW, FALSE, 0);
514
515 keyPath = GetItemPath(hwndTV, pnmtv->itemNew.hItem, &hRoot);
516 if (!keyPath) goto done;
517
518 if (*keyPath)
519 {
520 errCode = RegOpenKeyExW(hRoot, keyPath, 0, KEY_READ, &hNewKey);
521 if (errCode != ERROR_SUCCESS) goto done;
522 }
523 else
524 {
525 hNewKey = hRoot;
526 }
527
528 errCode = RegQueryInfoKeyW(hNewKey, 0, 0, 0, &dwCount, &dwMaxSubKeyLen, 0, 0, 0, 0, 0, 0);
529 if (errCode != ERROR_SUCCESS) goto done;
530 dwMaxSubKeyLen++; /* account for the \0 terminator */
531 Name = HeapAlloc(GetProcessHeap(), 0, dwMaxSubKeyLen * sizeof(WCHAR));
532 if (!Name) goto done;
533
534 for (dwIndex = 0; dwIndex < dwCount; dwIndex++)
535 {
536 DWORD cName = dwMaxSubKeyLen, dwSubCount;
537
538 errCode = RegEnumKeyExW(hNewKey, dwIndex, Name, &cName, 0, 0, 0, 0);
539 if (errCode != ERROR_SUCCESS) continue;
540 errCode = RegOpenKeyExW(hNewKey, Name, 0, KEY_QUERY_VALUE, &hKey);
541 if (errCode == ERROR_SUCCESS)
542 {
543 errCode = RegQueryInfoKeyW(hKey, 0, 0, 0, &dwSubCount, 0, 0, 0, 0, 0, 0, 0);
545 }
546 if (errCode != ERROR_SUCCESS) dwSubCount = 0;
547 AddEntryToTree(hwndTV, pnmtv->itemNew.hItem, Name, NULL, dwSubCount);
548 }
549
550 SendMessageW(hwndTV, TVM_SORTCHILDREN, 0, (LPARAM)pnmtv->itemNew.hItem);
551
552 RegCloseKey(hNewKey);
554
555done:
556 SendMessageW(hwndTV, WM_SETREDRAW, TRUE, 0);
557 SetCursor(hcursorOld);
558 expanding = FALSE;
559
560 return TRUE;
561}
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:383
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
HICON HCURSOR
Definition: windef.h:299
#define LoadCursor
Definition: winuser.h:5824
#define IDC_WAIT
Definition: winuser.h:689
#define WM_SETREDRAW
Definition: winuser.h:1619

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

2039{
2040 LONG lResult;
2041 HKEY hSubKey = NULL;
2042 DWORD cbData, dwType;
2043
2044 if (lpSubKey)
2045 {
2046 lResult = RegOpenKeyW(hKey, lpSubKey, &hSubKey);
2047 if (lResult != ERROR_SUCCESS)
2048 goto done;
2049 hKey = hSubKey;
2050 }
2051
2052 cbData = (dwBufferLen - 1) * sizeof(*pszBuffer);
2053 lResult = RegQueryValueExW(hKey, lpValueName, NULL, &dwType, (LPBYTE)pszBuffer, &cbData);
2054 if (lResult != ERROR_SUCCESS)
2055 goto done;
2056 if (dwType != REG_SZ)
2057 {
2058 lResult = -1;
2059 goto done;
2060 }
2061
2062 pszBuffer[cbData / sizeof(*pszBuffer)] = L'\0';
2063
2064done:
2065 if (lResult != ERROR_SUCCESS)
2066 pszBuffer[0] = L'\0';
2067 if (hSubKey)
2068 RegCloseKey(hSubKey);
2069 return lResult;
2070}

◆ RefreshListView()

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

Definition at line 657 of file listview.c.

658{
659 DWORD max_sub_key_len;
660 DWORD max_val_name_len;
661 DWORD max_val_size;
662 DWORD val_count;
663 HKEY hNewKey;
664 LONG errCode;
665 INT i, c;
666 BOOL AddedDefault = FALSE;
667
668 if (!hwndLV) return FALSE;
669
670 (void)ListView_EditLabel(hwndLV, -1);
671
672 SendMessageW(hwndLV, WM_SETREDRAW, FALSE, 0);
673 DestroyListView(hwndLV);
674
676
677 if(!hKey) return FALSE;
678
679 errCode = RegOpenKeyExW(hKey, keyPath, 0, KEY_READ, &hNewKey);
680 if (errCode != ERROR_SUCCESS) return FALSE;
681
682 /* get size information and resize the buffers if necessary */
683 errCode = RegQueryInfoKeyW(hNewKey, NULL, NULL, NULL, NULL, &max_sub_key_len, NULL,
684 &val_count, &max_val_name_len, &max_val_size, NULL, NULL);
685
686 if (errCode == ERROR_SUCCESS)
687 {
688 WCHAR* ValName = HeapAlloc(GetProcessHeap(), 0, ++max_val_name_len * sizeof(WCHAR));
689 DWORD dwValNameLen = max_val_name_len;
690 BYTE* ValBuf = HeapAlloc(GetProcessHeap(), 0, max_val_size + sizeof(WCHAR));
691 DWORD dwValSize = max_val_size;
692 DWORD dwIndex = 0L;
693 DWORD dwValType;
694 /* if (RegQueryValueExW(hNewKey, NULL, NULL, &dwValType, ValBuf, &dwValSize) == ERROR_SUCCESS) { */
695 /* AddEntryToList(hwndLV, L"(Default)", dwValType, ValBuf, dwValSize); */
696 /* } */
697 /* dwValSize = max_val_size; */
698 while (RegEnumValueW(hNewKey, dwIndex, ValName, &dwValNameLen, NULL, &dwValType, ValBuf, &dwValSize) == ERROR_SUCCESS)
699 {
700 /* Add a terminating 0 character. Usually this is only necessary for strings. */
701 ValBuf[dwValSize] = ValBuf[dwValSize + 1] = 0;
702
703 AddEntryToList(hwndLV, ValName, dwValType, ValBuf, dwValSize, -1, TRUE);
704 dwValNameLen = max_val_name_len;
705 dwValSize = max_val_size;
706 dwValType = 0L;
707 ++dwIndex;
708 if(!wcscmp(ValName, L""))
709 {
710 AddedDefault = TRUE;
711 }
712 }
713 HeapFree(GetProcessHeap(), 0, ValBuf);
714 HeapFree(GetProcessHeap(), 0, ValName);
715 }
716 RegCloseKey(hNewKey);
717
718 if(!AddedDefault)
719 {
720 AddEntryToList(hwndLV, L"", REG_SZ, NULL, 0, 0, FALSE);
721 }
722 c = ListView_GetItemCount(hwndLV);
723 for(i = 0; i < c; i++)
724 {
726 }
727
728 if (bSelectNone)
729 iListViewSelect = -1;
733 (void)ListView_Sort(hwndLV, g_iSortedColumn, -1);
734 SendMessageW(hwndLV, WM_SETREDRAW, TRUE, 0);
735
736 return TRUE;
737}
INT iListViewSelect
Definition: listview.c:16
static void AddEntryToList(HWND hwndLV, LPWSTR Name, DWORD dwValType, void *ValBuf, DWORD dwCount, int Position, BOOL ValExists)
Definition: listview.c:113
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:2678
#define ListView_EditLabel(hwndLV, i)
Definition: commctrl.h:2545
#define LVIS_SELECTED
Definition: commctrl.h:2324
#define ListView_DeleteAllItems(hwnd)
Definition: commctrl.h:2419
#define LVIS_FOCUSED
Definition: commctrl.h:2323

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

◆ RefreshTreeItem()

BOOL RefreshTreeItem ( HWND  hwndTV,
HTREEITEM  hItem 
)

Definition at line 133 of file treeview.c.

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

Referenced by RefreshTreeItem(), and RefreshTreeView().

◆ RefreshTreeView()

BOOL RefreshTreeView ( HWND  hWndTV)

Definition at line 303 of file treeview.c.

304{
306 HTREEITEM hSelectedItem;
307 HCURSOR hcursorOld;
308
309 hSelectedItem = TreeView_GetSelection(hwndTV);
310 hcursorOld = SetCursor(LoadCursor(NULL, IDC_WAIT));
311 SendMessageW(hwndTV, WM_SETREDRAW, FALSE, 0);
312
313 hItem = TreeView_GetChild(hwndTV, TreeView_GetRoot(hwndTV));
314 while (hItem)
315 {
316 RefreshTreeItem(hwndTV, hItem);
318 }
319
320 SendMessageW(hwndTV, WM_SETREDRAW, TRUE, 0);
321 SetCursor(hcursorOld);
322
323 /* We reselect the currently selected node, this will prompt a refresh of the listview. */
324 (void)TreeView_SelectItem(hwndTV, hSelectedItem);
325 return TRUE;
326}
#define TreeView_GetRoot(hwnd)
Definition: commctrl.h:3480

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

◆ RegKeyEditPermissions()

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

Definition at line 793 of file security.c.

797{
798 BOOL Result = FALSE;
799 LPCWSTR lphKey = NULL;
800 LPWSTR lpKeyPath = NULL;
801 PCRegKeySecurity RegKeySecurity;
802 SI_OBJECT_INFO ObjectInfo;
803 size_t lnMachine = 0, lnKeyName = 0;
804
805 if (pfnEditSecurity == NULL)
806 {
807 return FALSE;
808 }
809
810 if (lpMachine != NULL)
811 lnMachine = wcslen(lpMachine);
812 if (lpKeyName != NULL)
813 lnKeyName = wcslen(lpKeyName);
814
815 /* build registry path */
816 if (lpMachine != NULL &&
817 (lpMachine[0] == L'\0' ||
818 (lpMachine[0] == L'.' && lpMachine[1] == L'.')))
819 {
820 lnMachine = 0;
821 }
822
823 if (hKey == HKEY_CLASSES_ROOT)
824 lphKey = L"CLASSES_ROOT";
825 else if (hKey == HKEY_CURRENT_USER)
826 lphKey = L"CURRENT_USER";
827 else if (hKey == HKEY_LOCAL_MACHINE)
828 lphKey = L"MACHINE";
829 else if (hKey == HKEY_USERS)
830 lphKey = L"USERS";
831 else if (hKey == HKEY_CURRENT_CONFIG)
832 lphKey = L"CONFIG";
833 else
834 goto Cleanup;
835
836 lpKeyPath = HeapAlloc(GetProcessHeap(),
837 0,
838 (2 + lnMachine + 1 + wcslen(lphKey) + 1 + lnKeyName) * sizeof(WCHAR));
839 if (lpKeyPath == NULL)
840 {
842 goto Cleanup;
843 }
844 lpKeyPath[0] = L'\0';
845
846 if (lnMachine != 0)
847 {
848 wcscat(lpKeyPath, L"\\\\");
849 wcscat(lpKeyPath, lpMachine);
850 wcscat(lpKeyPath, L"\\");
851 }
852
853 wcscat(lpKeyPath, lphKey);
854 if (lpKeyName != NULL && lpKeyName[0] != L'\0')
855 {
856 if (lpKeyName[0] != L'\\')
857 wcscat(lpKeyPath, L"\\");
858
859 wcscat(lpKeyPath, lpKeyName);
860 }
861
864 ObjectInfo.hInstance = hInst;
865 ObjectInfo.pszServerName = (LPWSTR)lpMachine;
866 ObjectInfo.pszObjectName = (LPWSTR)lpKeyName; /* FIXME */
867 ObjectInfo.pszPageTitle = (LPWSTR)lpKeyName; /* FIXME */
868
869 if (!(RegKeySecurity = CRegKeySecurity_fnConstructor(lpKeyPath,
870 hKey,
871 &ObjectInfo,
872 &Result)))
873 {
874 goto Cleanup;
875 }
876
877 /* display the security editor dialog */
878 pfnEditSecurity(hWndOwner, impl_to_interface(RegKeySecurity, ISecurityInformation));
879
880 /* dereference the interface, it should be destroyed here */
881 CRegKeySecurity_fnRelease(RegKeySecurity);
882
883Cleanup:
884 if (lpKeyPath != NULL)
885 HeapFree(GetProcessHeap(), 0, lpKeyPath);
886
887 return Result;
888}
#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:72
static PCRegKeySecurity CRegKeySecurity_fnConstructor(LPWSTR lpRegKey, HKEY hRootKey, SI_OBJECT_INFO *ObjectInfo, BOOL *Btn)
Definition: security.c:717
#define impl_to_interface(impl, iface)
Definition: security.c:63
static PEDITSECURITY pfnEditSecurity
Definition: security.c:761
#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 1971 of file edit.c.

1972{
1973 LPCWSTR s;
1974 LPWSTR lpNewSubKey = NULL;
1975 LONG Ret = 0;
1976 SIZE_T cbNewSubKey;
1977
1978 if (!lpSubKey)
1979 return Ret;
1980
1981 s = wcsrchr(lpSubKey, L'\\');
1982 if (s)
1983 {
1984 s++;
1985 cbNewSubKey = (s - lpSubKey + wcslen(lpNewName) + 1) * sizeof(WCHAR);
1986 lpNewSubKey = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, cbNewSubKey);
1987 if (lpNewSubKey != NULL)
1988 {
1989 StringCbCopyNW(lpNewSubKey, cbNewSubKey, lpSubKey, (s - lpSubKey) * sizeof(WCHAR));
1990 StringCbCatW(lpNewSubKey, cbNewSubKey, lpNewName);
1991 lpNewName = lpNewSubKey;
1992 }
1993 else
1995 }
1996
1997 Ret = MoveKey(hKey, lpNewName, hKey, lpSubKey);
1998
1999 if (lpNewSubKey)
2000 {
2001 HeapFree(GetProcessHeap(), 0, lpNewSubKey);
2002 }
2003 return Ret;
2004}
static LONG MoveKey(HKEY hDestKey, LPCWSTR lpDestSubKey, HKEY hSrcKey, LPCWSTR lpSrcSubKey)
Definition: edit.c:1918
#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 2006 of file edit.c.

2007{
2008 LONG lResult;
2009 HKEY hSubKey = NULL;
2010 DWORD dwType, cbData;
2011 BYTE data[512];
2012
2013 if (lpSubKey)
2014 {
2015 lResult = RegOpenKeyW(hKey, lpSubKey, &hSubKey);
2016 if (lResult != ERROR_SUCCESS)
2017 goto done;
2018 hKey = hSubKey;
2019 }
2020
2021 cbData = sizeof(data);
2022 lResult = RegQueryValueExW(hKey, lpSrcValue, NULL, &dwType, data, &cbData);
2023 if (lResult != ERROR_SUCCESS)
2024 goto done;
2025
2026 lResult = RegSetValueExW(hKey, lpDestValue, 0, dwType, data, cbData);
2027 if (lResult != ERROR_SUCCESS)
2028 goto done;
2029
2030 RegDeleteValue(hKey, lpSrcValue);
2031
2032done:
2033 if (hSubKey)
2034 RegCloseKey(hSubKey);
2035 return lResult;
2036}
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 95 of file childwnd.c.

96{
97 HDWP hdwp = BeginDeferWindowPos(4);
98 RECT rt, rs, rb;
99 const int nButtonWidth = 44;
100 const int nButtonHeight = 22;
101 int cyEdge = GetSystemMetrics(SM_CYEDGE);
103 SetRect(&rt, 0, 0, cx, cy);
104 cy = 0;
105 if (hStatusBar != NULL)
106 {
108 cy = rs.bottom - rs.top;
109 }
111
113
115 if (hdwp)
117 rt.left, rt.top,
118 rt.right - rt.left - nButtonWidth, nButtonHeight,
119 uFlags);
120 if (hdwp)
122 rt.right - nButtonWidth, rt.top,
123 nButtonWidth, nButtonHeight,
124 uFlags);
125 if (hdwp)
127 rt.left,
128 rt.top + nButtonHeight + cyEdge,
130 rt.bottom - rt.top - cy - 2 * cyEdge,
131 uFlags);
132 if (hdwp)
134 rt.left + cx,
135 rt.top + nButtonHeight + cyEdge,
136 rt.right - cx,
137 rt.bottom - rt.top - cy - 2 * cyEdge,
138 uFlags);
139 if (hdwp)
140 EndDeferWindowPos(hdwp);
141}
HWND hStatusBar
Definition: main.c:23
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:1245
#define SM_CYEDGE
Definition: winuser.h:1012
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:1250
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 766 of file treeview.c.

767{
769 HTREEITEM hChildItem;
770 WCHAR szPathPart[128];
771 WCHAR szBuffer[128];
772 LPCWSTR s;
773 TVITEMW tvi;
774
775 /* Load "My Computer" string... */
776 LoadStringW(hInst, IDS_MY_COMPUTER, szBuffer, ARRAY_SIZE(szBuffer));
777 StringCbCatW(szBuffer, sizeof(szBuffer), L"\\");
778
779 /* ... and remove it from the key path */
780 if (!_wcsnicmp(keyPath, szBuffer, wcslen(szBuffer)))
781 keyPath += wcslen(szBuffer);
782
783 /* Reinitialize szBuffer */
784 szBuffer[0] = L'\0';
785
786 hRoot = TreeView_GetRoot(hwndTV);
787 hItem = hRoot;
788
789 while(keyPath[0])
790 {
791 size_t copyLength;
792 s = wcschr(keyPath, L'\\');
793 if (s != NULL)
794 {
795 copyLength = (s - keyPath) * sizeof(WCHAR);
796 }
797 else
798 {
799 copyLength = sizeof(szPathPart);
800 }
801 StringCbCopyNW(szPathPart, sizeof(szPathPart), keyPath, copyLength);
802
803 /* Special case for root to expand root key abbreviations */
804 if (hItem == hRoot)
805 {
806 if (!_wcsicmp(szPathPart, L"HKCR"))
807 StringCbCopyW(szPathPart, sizeof(szPathPart), L"HKEY_CLASSES_ROOT");
808 else if (!_wcsicmp(szPathPart, L"HKCU"))
809 StringCbCopyW(szPathPart, sizeof(szPathPart), L"HKEY_CURRENT_USER");
810 else if (!_wcsicmp(szPathPart, L"HKLM"))
811 StringCbCopyW(szPathPart, sizeof(szPathPart), L"HKEY_LOCAL_MACHINE");
812 else if (!_wcsicmp(szPathPart, L"HKU"))
813 StringCbCopyW(szPathPart, sizeof(szPathPart), L"HKEY_USERS");
814 else if (!_wcsicmp(szPathPart, L"HKCC"))
815 StringCbCopyW(szPathPart, sizeof(szPathPart), L"HKEY_CURRENT_CONFIG");
816 else if (!_wcsicmp(szPathPart, L"HKDD"))
817 StringCbCopyW(szPathPart, sizeof(szPathPart), L"HKEY_DYN_DATA");
818 }
819
820 for (hChildItem = TreeView_GetChild(hwndTV, hItem); hChildItem;
821 hChildItem = TreeView_GetNextSibling(hwndTV, hChildItem))
822 {
823 memset(&tvi, 0, sizeof(tvi));
824 tvi.hItem = hChildItem;
826 tvi.pszText = szBuffer;
827 tvi.cchTextMax = ARRAY_SIZE(szBuffer);
828
829 (void)TreeView_GetItem(hwndTV, &tvi);
830
831 if (!_wcsicmp(szBuffer, szPathPart))
832 break;
833 }
834
835 if (!hChildItem)
836 return FALSE;
837
838 if (tvi.cChildren > 0)
839 {
840 if (!TreeView_Expand(hwndTV, hChildItem, TVE_EXPAND))
841 return FALSE;
842 }
843
844 keyPath = s ? s + 1 : L"";
845 hItem = hChildItem;
846 }
847
850
851 return TRUE;
852}
#define wcschr
Definition: compat.h:17
#define TreeView_EnsureVisible(hwnd, hitem)
Definition: commctrl.h:3550
_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 153 of file framewnd.c.

154{
155 RECT rc;
156 int nParts;
157 GetClientRect(hWnd, &rc);
158 nParts = rc.right;
159 /* nParts = -1;*/
160 if (bResize)
163}
#define SB_SETPARTS
Definition: commctrl.h:1959

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

◆ ShowAboutBox()

void ShowAboutBox ( HWND  hWnd)

Definition at line 12 of file about.c.

13{
14 WCHAR AppStr[255];
15 LoadStringW(hInst, IDS_APP_TITLE, AppStr, ARRAY_SIZE(AppStr));
17}
#define IDI_REGEDIT
Definition: resource.h:22
BOOL WINAPI ShellAboutW(HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff, HICON hIcon)
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2127

◆ StartKeyRename()

HWND StartKeyRename ( HWND  hwndTV)

Definition at line 380 of file treeview.c.

381{
383
384 if(!(hItem = TreeView_GetSelection(hwndTV))) return 0;
385 return TreeView_EditLabel(hwndTV, hItem);
386}

◆ TreeWndNotifyProc()

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

Definition at line 622 of file treeview.c.

623{
625 *Result = TRUE;
626
627 switch (((LPNMHDR)lParam)->code)
628 {
631 return TRUE;
632 case TVN_SELCHANGED:
633 {
634 NMTREEVIEW* pnmtv = (NMTREEVIEW*)lParam;
635 /* Get the parent of the current item */
636 HTREEITEM hParentItem = TreeView_GetParent(g_pChildWnd->hTreeWnd, pnmtv->itemNew.hItem);
637
638 UpdateAddress(pnmtv->itemNew.hItem, NULL, NULL, TRUE);
639
640 /* Disable the Permissions and new key menu items for 'My Computer' */
643
644 /*
645 * Disable Delete/Rename menu options for 'My Computer' (first item so doesn't have any parent)
646 * and HKEY_* keys (their parent is 'My Computer' and the previous remark applies).
647 */
648 if (!hParentItem || !TreeView_GetParent(g_pChildWnd->hTreeWnd, hParentItem))
649 {
654 }
655 else
656 {
661 }
662
663 return TRUE;
664 }
665 case NM_SETFOCUS:
667 break;
669 {
671 /* cancel label edit for rootkeys */
672 if (!TreeView_GetParent(g_pChildWnd->hTreeWnd, ptvdi->item.hItem) ||
674 {
675 *Result = TRUE;
676 }
677 else
678 {
679 *Result = FALSE;
680 }
681 return TRUE;
682 }
683 case TVN_ENDLABELEDIT:
684 {
685 LPCWSTR keyPath;
686 HKEY hRootKey;
687 HKEY hKey = NULL;
689 LONG nRenResult;
690 LONG lResult = TRUE;
691 WCHAR szBuffer[MAX_PATH];
692 WCHAR Caption[128];
693
694 if (ptvdi->item.pszText)
695 {
696 keyPath = GetItemPath(g_pChildWnd->hTreeWnd, TreeView_GetParent(g_pChildWnd->hTreeWnd, ptvdi->item.hItem), &hRootKey);
697 if (wcslen(keyPath))
698 _snwprintf(szBuffer, ARRAY_SIZE(szBuffer), L"%s\\%s", keyPath, ptvdi->item.pszText);
699 else
700 _snwprintf(szBuffer, ARRAY_SIZE(szBuffer), L"%s", ptvdi->item.pszText);
701 keyPath = GetItemPath(g_pChildWnd->hTreeWnd, ptvdi->item.hItem, &hRootKey);
702 if (RegOpenKeyExW(hRootKey, szBuffer, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
703 {
704 lResult = FALSE;
706 TreeView_EditLabel(g_pChildWnd->hTreeWnd, ptvdi->item.hItem);
707 }
708 else
709 {
710 nRenResult = RenameKey(hRootKey, keyPath, ptvdi->item.pszText);
711 if (nRenResult != ERROR_SUCCESS)
712 {
713 LoadStringW(hInst, IDS_ERROR, Caption, ARRAY_SIZE(Caption));
714 ErrorMessageBox(hWnd, Caption, nRenResult);
715 lResult = FALSE;
716 }
717 else
718 UpdateAddress(ptvdi->item.hItem, hRootKey, szBuffer, FALSE);
719 }
720 *Result = lResult;
721 }
722 return TRUE;
723 }
724 }
725 return FALSE;
726}
#define IDS_ERROR
Definition: resource.h:18
VOID UpdateAddress(HTREEITEM hItem, HKEY hRootKey, LPCWSTR pszPath, BOOL bSelectNone)
Definition: childwnd.c:300
LONG RenameKey(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpNewName)
Definition: edit.c:1971
#define ID_EDIT_DELETE
Definition: resource.h:43
#define ID_EDIT_NEW_KEY
Definition: resource.h:49
#define ID_TREE_RENAME
Definition: resource.h:105
#define ID_TREE_DELETE
Definition: resource.h:104
#define ID_EDIT_PERMISSIONS
Definition: resource.h:103
BOOL OnTreeExpanding(HWND hwndTV, NMTREEVIEW *pnmtv)
Definition: treeview.c:496
#define TVN_SELCHANGED
Definition: commctrl.h:3740
#define TVN_BEGINLABELEDIT
Definition: commctrl.h:3748
#define TVN_ENDLABELEDIT
Definition: commctrl.h:3749
#define NMTREEVIEW
Definition: commctrl.h:3647
#define TVN_ITEMEXPANDING
Definition: commctrl.h:3743
#define LPNMTVDISPINFO
Definition: commctrl.h:3681

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 300 of file childwnd.c.

301{
302 LPCWSTR keyPath, rootName;
303 LPWSTR fullPath;
304 DWORD cbFullPath;
305
306 /* Wipe the listview, the status bar and the address bar if the root key was selected */
308 {
312 return;
313 }
314
315 if (pszPath == NULL)
316 keyPath = GetItemPath(g_pChildWnd->hTreeWnd, hItem, &hRootKey);
317 else
318 keyPath = pszPath;
319
320 if (keyPath)
321 {
322 RefreshListView(g_pChildWnd->hListWnd, hRootKey, keyPath, bSelectNone);
323 rootName = get_root_key_name(hRootKey);
324 cbFullPath = (wcslen(rootName) + 1 + wcslen(keyPath) + 1) * sizeof(WCHAR);
325 fullPath = malloc(cbFullPath);
326 if (fullPath)
327 {
328 /* set (correct) the address bar text */
329 if (keyPath[0] != UNICODE_NULL)
330 StringCbPrintfW(fullPath, cbFullPath, L"%s%s%s", rootName,
331 ((keyPath[0] == L'\\') ? L"" : L"\\"), keyPath);
332 else
333 StringCbCopyW(fullPath, cbFullPath, rootName);
334
337 free(fullPath);
338
339 /* disable hive manipulation items temporarily (enable only if necessary) */
342 /* compare the strings to see if we should enable/disable the "Load Hive" menus accordingly */
343 if (_wcsicmp(rootName, L"HKEY_LOCAL_MACHINE") == 0 ||
344 _wcsicmp(rootName, L"HKEY_USERS") == 0)
345 {
346 /*
347 * enable the unload menu item if at the root, otherwise
348 * enable the load menu item if there is no slash in
349 * keyPath (ie. immediate child selected)
350 */
351 if (keyPath[0] == UNICODE_NULL)
353 else if (!wcschr(keyPath, L'\\'))
355 }
356 }
357 }
358}
LPCWSTR get_root_key_name(HKEY hRootKey)
Definition: childwnd.c:76
BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPCWSTR keyPath, BOOL bSelectNone)
Definition: listview.c:657
#define ID_REGISTRY_UNLOADHIVE
Definition: resource.h:65
#define ID_REGISTRY_LOADHIVE
Definition: resource.h:64
#define SB_SETTEXTW
Definition: commctrl.h:1947
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
#define WM_SETTEXT
Definition: winuser.h:1620

Referenced by TreeWndNotifyProc().

◆ UpdateStatusBar()

void UpdateStatusBar ( void  )

Definition at line 150 of file solitaire.cpp.

151{
152 TCHAR szStatusText[128];
153 TCHAR szTempText[64];
154
155 ZeroMemory(szStatusText, sizeof(szStatusText));
156
157 if (GetScoreMode() != SCORE_NONE)
158 {
159 _stprintf(szStatusText, szScore, lScore);
160 _tcscat(szStatusText, _T(" "));
161 }
162
164 {
165 _stprintf(szTempText, szTime, dwTime);
166 _tcscat(szStatusText, szTempText);
167 }
168
170}
#define _tcscat
Definition: tchar.h:622
#define _stprintf
Definition: utility.h:124
#define SBT_NOBORDERS
Definition: commctrl.h:1976
#define SB_SETTEXT
Definition: commctrl.h:1954
HWND hwndStatus
Definition: solitaire.cpp:14
DWORD dwOptions
Definition: solitaire.cpp:25
TCHAR szScore[64]
Definition: solitaire.cpp:19
DWORD dwTime
Definition: solitaire.cpp:27
TCHAR szTime[64]
Definition: solitaire.cpp:20
int GetScoreMode(void)
Definition: solitaire.cpp:130
long lScore
Definition: solitaire.cpp:31
#define SCORE_NONE
Definition: solitaire.h:44
#define OPTION_SHOW_TIME
Definition: solitaire.h:12
#define ZeroMemory
Definition: winbase.h:1712
#define SendMessage
Definition: winuser.h:5855
CHAR * LPTSTR
Definition: xmlstorage.h:192

Variable Documentation

◆ g_pChildWnd

◆ g_szGeneralRegKey

const WCHAR g_szGeneralRegKey[]
extern

Definition at line 16 of file settings.c.

Referenced by GetFindFlags(), LoadSettings(), SaveSettings(), and SetFindFlags().

◆ hFont

HFONT hFont
extern

Definition at line 53 of file main.c.

Referenced by _Success_(), add_ruler_units(), AddCharToSelection(), AddDialogControl(), BUTTON_CalcLabelRect(), C1_SetData(), CB_Paint(), check_height_font_enumproc(), ChildWndProc(), COMBO_Font(), COMCTL32_GetFontMetrics(), create_tabcontrol(), CreateConsoleFont2(), CreateConsoleFontEx(), CreateFontset(), CreateLayoutIcon(), CreateMonospaceFont(), CreateTitleFont(), CreateTrayIcon(), CUIFToolbarMenuButton::CUIFToolbarMenuButton(), D3DXCreateTextTest(), dialog_get_sans_serif_height(), DlgProc(), DoEntry(), DoTestEntry(), DrawCaptionTempA(), DrawCaptionTempW(), DrawProc(), DrawThemeTextEx(), DumpFont(), EditTypeDlg_OnDrawItem(), EMFDRV_CreateFontIndirect(), EMFDRV_SelectFont(), EnumEnhMetaFile(), EnumMetaFile(), FillFontStyleComboList(), fnIMLangFontLink2_ReleaseFont(), fnIMLangFontLink_ReleaseFont(), font_height(), FontSizeChange(), ftGdiGetGlyphOutline(), ftGdiGetTextCharsetInfo(), GB_Paint(), get_font_height(), GetButtonHeight(), GetFontMetrics(), GetPhysicalFontHeight(), CTipbarThread::GetTextSize(), GetThemeTextExtent(), GetThemeTextMetrics(), HEADER_CreateDragImage(), HEADER_Refresh(), HEADER_SetFont(), HEXEDIT_WM_SETFONT(), HOTKEY_SetFont(), InatCreateIconBySize(), InitFonts(), InitInstance(), InternalSelectEx(), IPADDRESS_Create(), LISTVIEW_Command(), LISTVIEW_GetItemMetrics(), LISTVIEW_GetStringWidthT(), LISTVIEW_SaveTextMetrics(), LISTVIEW_SetFont(), LISTVIEW_ShowFocusRect(), LoadIniFile(), LrgCellWndProc(), MainFrameBase::MainFrameBase(), MainWndProc(), ME_DebugWrite(), MENU_DrawPopupGlyph(), MFDRV_CreateFontIndirect(), MonSelChangeFont(), MonSelGetMonitorFont(), MonSelPaintMonitor(), MonthCalChangeFont(), MyDrawCaptionTemp(), MyDrawFrameCaption(), MyDrawFrameScroll(), MyEnumFontFamExProc(), NOTEPAD_LoadSettingsFromRegistry(), NT5_DrawLogoffCaptionText(), NtGdiGetCharABCWidthsW(), NtGdiGetCharWidthW(), NtGdiGetFontData(), NtGdiGetFontUnicodeRanges(), NtGdiGetGlyphIndicesW(), NtGdiGetOutlineTextMetricsInternalW(), NtGdiGetTextFaceW(), NtUserDrawCaptionTemp(), NtUserDrawMenuBarTemp(), OB_Paint(), OnMeasureItem(), OSK_ChooseFont(), PB_Paint(), PlotCharacter(), PROGRESS_SetFont(), RealizeFontInit(), RefreshFontPreview(), RetChangeControlFont(), RosImageProc(), CACListView::SetFont(), ATL::CWindow::SetFont(), SetLrgFont(), CUIFMenu::SetMenuFont(), SetMessageFont(), SetupControls(), SoftModalMessageBox(), START_TEST(), STATIC_PaintTextfn(), SYSLINK_SetFont(), T1_GetTextMetric(), T1_SetData(), TAB_DrawItemInterior(), TAB_SetItemBounds(), test_bitmap_font_glyph_index(), test_combo_setfont(), test_combo_setitemheight(), Test_CreateFontA(), Test_CreateFontIndirectA(), Test_CreateFontIndirectExA(), Test_CreateFontIndirectExW(), Test_CreateFontIndirectW(), test_DrawTextCalcRect(), test_emf_ExtTextOut_on_path(), test_ExtTextOut(), Test_Font(), Test_FontSelectionEntry(), Test_GdiGetCharDimensions(), Test_GetTextFaceAliasW(), test_height(), test_MessageBoxFontTest(), test_mf_SaveDC(), test_SaveDC(), test_setfont(), ThemeDrawCaptionText(), TOOLBAR_SetFont(), TOOLTIPS_SetFont(), TreeListEditLabel(), TreeListProc(), TREEVIEW_Command(), TREEVIEW_SetFont(), UB_Paint(), UITOOLS95_DFC_ButtonCheckRadio(), UITOOLS95_DrawFrameCaption(), UITOOLS95_DrawFrameMenu(), UITOOLS95_DrawFrameScroll(), UpdateFontPreview(), UserDrawCaption(), UserDrawCaptionText(), and WndProc().

◆ hFrameWnd

HWND hFrameWnd
extern

Definition at line 22 of file main.c.

◆ hInst

HINSTANCE hInst
extern

Definition at line 13 of file dxdiag.c.

◆ hMenuFrame

HMENU hMenuFrame
extern

Definition at line 24 of file main.c.

◆ hPopupMenus

HMENU hPopupMenus
extern

◆ hStatusBar

HWND hStatusBar
extern

Definition at line 23 of file main.c.

◆ Options

Definition at line 335 of file setupldr.c.

Referenced by if(), NtLdrUpdateLoadOptions(), and WdfRequestSend().

◆ reg_class_namesW

const WCHAR* reg_class_namesW[]
extern

Definition at line 12 of file main.c.

Referenced by export_all(), parse_key_name(), txt_export_all(), and txt_parse_key_name().

◆ szChildClass

WCHAR szChildClass[]
extern

Definition at line 32 of file main.c.

◆ szFrameClass

WCHAR szFrameClass[]
extern

Definition at line 31 of file main.c.

◆ szTitle

WCHAR szTitle[]
extern

Definition at line 35 of file magnifier.c.