ReactOS  0.4.14-dev-606-g14ebc0b
childwnd.c File Reference
#include "regedit.h"
Include dependency graph for childwnd.c:

Go to the source code of this file.

Macros

#define MIN(a, b)   ((a < b) ? (a) : (b))
 

Functions

LPCWSTR get_root_key_name (HKEY hRootKey)
 
void ResizeWnd (int cx, int cy)
 
static void draw_splitbar (HWND hWnd, int x)
 
static void finish_splitbar (HWND hWnd, int x)
 
static BOOL ChildWnd_CmdWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 
static void SuggestKeys (HKEY hRootKey, LPCWSTR pszKeyPath, LPWSTR pszSuggestions, size_t iSuggestionsLength)
 
LRESULT CALLBACK AddressBarProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static VOID UpdateAddress (HTREEITEM hItem, HKEY hRootKey, LPCWSTR pszPath)
 
LRESULT CALLBACK ChildWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 

Variables

ChildWndg_pChildWnd
 
static int last_split
 
HBITMAP SizingPattern = 0
 
HBRUSH SizingBrush = 0
 
static WCHAR Suggestions [256]
 

Macro Definition Documentation

◆ MIN

#define MIN (   a,
  b 
)    ((a < b) ? (a) : (b))

Definition at line 225 of file childwnd.c.

Function Documentation

◆ AddressBarProc()

LRESULT CALLBACK AddressBarProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 298 of file childwnd.c.

299 {
300  WNDPROC oldwndproc;
301  static WCHAR s_szNode[256];
302  oldwndproc = (WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA);
303 
304  switch (uMsg)
305  {
306  case WM_KEYUP:
307  if (wParam == VK_RETURN)
308  {
309  GetWindowTextW(hwnd, s_szNode, COUNT_OF(s_szNode));
310  SelectNode(g_pChildWnd->hTreeWnd, s_szNode);
311  }
312  break;
313  default:
314  break;
315  }
316  return CallWindowProcW(oldwndproc, hwnd, uMsg, wParam, lParam);
317 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
ChildWnd * g_pChildWnd
Definition: childwnd.c:23
HWND hTreeWnd
Definition: main.h:60
#define VK_RETURN
Definition: winuser.h:2176
WPARAM wParam
Definition: combotst.c:138
#define GWLP_USERDATA
Definition: treelist.c:63
#define COUNT_OF(a)
Definition: main.h:33
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WM_KEYUP
Definition: winuser.h:1698
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2881
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1408
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL SelectNode(HWND hwndTV, LPCWSTR keyPath)
Definition: treeview.c:665
#define GetWindowLongPtr
Definition: treelist.c:73
LPARAM lParam
Definition: combotst.c:139

Referenced by ChildWndProc().

◆ ChildWnd_CmdWndProc()

static BOOL ChildWnd_CmdWndProc ( HWND  hWnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 140 of file childwnd.c.

141 {
142  HTREEITEM hSelection;
143  HKEY hRootKey;
144  LPCWSTR keyPath, s;
145  WORD wID = LOWORD(wParam);
146 
148 
149  switch (wID)
150  {
151  /* Parse the menu selections: */
152  case ID_REGISTRY_EXIT:
154  break;
155  case ID_VIEW_REFRESH:
156  /* TODO */
157  break;
160  break;
163  break;
164  case ID_TREE_RENAME:
167  break;
168  case ID_TREE_DELETE:
170  keyPath = GetItemPath(g_pChildWnd->hTreeWnd, hSelection, &hRootKey);
171 
172  if (keyPath == 0 || *keyPath == 0)
173  {
175  }
176  else if (DeleteKey(hWnd, hRootKey, keyPath))
178  break;
179  case ID_TREE_EXPORT:
181  break;
182  case ID_EDIT_FIND:
183  FindDialog(hWnd);
184  break;
185  case ID_EDIT_COPYKEYNAME:
187  keyPath = GetItemPath(g_pChildWnd->hTreeWnd, hSelection, &hRootKey);
188  CopyKeyName(hWnd, hRootKey, keyPath);
189  break;
190  case ID_EDIT_NEW_KEY:
192  break;
197  break;
198  case ID_SWITCH_PANELS:
201  break;
202  default:
203  if ((wID >= ID_TREE_SUGGESTION_MIN) && (wID <= ID_TREE_SUGGESTION_MAX))
204  {
205  s = Suggestions;
206  while(wID > ID_TREE_SUGGESTION_MIN)
207  {
208  if (*s)
209  s += wcslen(s) + 1;
210  wID--;
211  }
213  break;
214  }
215  return FALSE;
216  }
217  return TRUE;
218 }
#define MB_ICONHAND
Definition: winuser.h:782
#define ID_TREE_RENAME
Definition: resource.h:155
#define ID_SWITCH_PANELS
Definition: resource.h:152
Definition: tftpd.h:59
#define TRUE
Definition: types.h:120
#define ID_TREE_COLLAPSEBRANCH
Definition: resource.h:98
ChildWnd * g_pChildWnd
Definition: childwnd.c:23
BOOL ExportRegistryFile(HWND hWnd)
Definition: framewnd.c:586
#define ID_EDIT_COPYKEYNAME
Definition: resource.h:62
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define ID_TREE_EXPORT
Definition: resource.h:161
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define TreeView_EditLabel(hwnd, hitem)
Definition: commctrl.h:3500
HWND hTreeWnd
Definition: main.h:60
#define ID_EDIT_FIND
Definition: resource.h:63
HWND hListWnd
Definition: main.h:61
HWND hWnd
Definition: settings.c:17
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI DestroyWindow(_In_ HWND)
WPARAM wParam
Definition: combotst.c:138
#define ID_EDIT_NEW_BINARYVALUE
Definition: resource.h:68
#define ID_REGISTRY_EXIT
Definition: resource.h:54
#define ID_TREE_SUGGESTION_MIN
Definition: resource.h:159
BOOL CopyKeyName(HWND hWnd, HKEY hRootKey, LPCWSTR keyName)
Definition: framewnd.c:790
#define TVE_COLLAPSE
Definition: commctrl.h:3418
static WCHAR Suggestions[256]
Definition: childwnd.c:27
BOOL DeleteNode(HWND hwndTV, HTREEITEM hItem)
Definition: treeview.c:102
LPCWSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY *phRootKey)
Definition: treeview.c:83
#define ID_VIEW_REFRESH
Definition: resource.h:59
#define ID_TREE_SUGGESTION_MAX
Definition: resource.h:160
#define TreeView_GetSelection(hwnd)
Definition: commctrl.h:3469
unsigned short WORD
Definition: ntddk_ex.h:93
#define TVE_EXPAND
Definition: commctrl.h:3419
#define ID_EDIT_NEW_KEY
Definition: resource.h:66
GLdouble s
Definition: gl.h:2039
void FindDialog(HWND hWnd)
Definition: find.c:813
#define WM_COMMAND
Definition: winuser.h:1722
#define ID_EDIT_NEW_DWORDVALUE
Definition: resource.h:69
BOOL WINAPI MessageBeep(_In_ UINT)
HWND hFrameWnd
Definition: main.c:30
#define ID_EDIT_NEW_STRINGVALUE
Definition: resource.h:67
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath)
Definition: edit.c:1456
#define ID_TREE_EXPANDBRANCH
Definition: resource.h:96
BOOL CreateNewKey(HWND hwndTV, HTREEITEM hItem)
Definition: treeview.c:571
BOOL SelectNode(HWND hwndTV, LPCWSTR keyPath)
Definition: treeview.c:665
#define ID_TREE_DELETE
Definition: resource.h:154
#define TreeView_Expand(hwnd, hitem, code)
Definition: commctrl.h:3416
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
int nFocusPanel
Definition: main.h:65

Referenced by ChildWndProc().

◆ ChildWndProc()

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

Definition at line 385 of file childwnd.c.

386 {
387  BOOL Result;
388  RECT rc;
389 
390  switch (message)
391  {
392  case WM_CREATE:
393  {
394  WNDPROC oldproc;
395  HFONT hFont;
397  DWORD style;
398 
399  /* Load "My Computer" string */
401 
403  if (!g_pChildWnd) return 0;
404 
406  g_pChildWnd->nSplitPos = 190;
407  g_pChildWnd->hWnd = hWnd;
408 
412  hWnd, (HMENU)0, hInst, 0);
413 
416  g_pChildWnd->hAddressBtnWnd = CreateWindowExW(0, L"Button", L"\x00BB", style,
418  hWnd, (HMENU)0, hInst, 0);
420  IMAGE_ICON, 12, 12, 0);
422 
423  GetClientRect(hWnd, &rc);
427 
428  /* set the address bar and button font */
430  {
433  WM_SETFONT,
434  (WPARAM)hFont,
435  0);
437  WM_SETFONT,
438  (WPARAM)hFont,
439  0);
440  }
441  /* Subclass the AddressBar */
445  break;
446  }
447  case WM_COMMAND:
448  if(HIWORD(wParam) == BN_CLICKED)
449  {
451  }
452 
454  {
455  goto def;
456  }
457  break;
458  case WM_SETCURSOR:
459  if (LOWORD(lParam) == HTCLIENT)
460  {
461  POINT pt;
462  GetCursorPos(&pt);
465  {
467  return TRUE;
468  }
469  }
470  goto def;
471  case WM_DESTROY:
474  DestroyMainMenu();
477  g_pChildWnd = NULL;
478  PostQuitMessage(0);
479  break;
480  case WM_LBUTTONDOWN:
481  {
482  RECT rt;
483  int x = (short)LOWORD(lParam);
484  GetClientRect(hWnd, &rt);
486  {
489  SetCapture(hWnd);
490  }
491  break;
492  }
493 
494  case WM_LBUTTONUP:
495  case WM_RBUTTONDOWN:
496  if (GetCapture() == hWnd)
497  {
499  }
500  break;
501 
502  case WM_CAPTURECHANGED:
503  if (GetCapture()==hWnd && last_split>=0)
505  break;
506 
507  case WM_KEYDOWN:
508  if (wParam == VK_ESCAPE)
509  if (GetCapture() == hWnd)
510  {
511  RECT rt;
513  GetClientRect(hWnd, &rt);
514  ResizeWnd(rt.right, rt.bottom);
515  last_split = -1;
516  ReleaseCapture();
518  }
519  break;
520 
521  case WM_MOUSEMOVE:
522  if (GetCapture() == hWnd)
523  {
524  HDC hdc;
525  RECT rt;
526  HGDIOBJ OldObj;
527  int x = LOWORD(lParam);
528  if(!SizingPattern)
529  {
530  const DWORD Pattern[4] = {0x5555AAAA, 0x5555AAAA, 0x5555AAAA, 0x5555AAAA};
531  SizingPattern = CreateBitmap(8, 8, 1, 1, Pattern);
532  }
533  if(!SizingBrush)
534  {
536  }
537 
538  GetClientRect(hWnd, &rt);
539  x = (SHORT) min(max(x, SPLIT_MIN), rt.right - SPLIT_MIN);
540  if(last_split != x)
541  {
542  rt.left = last_split-SPLIT_WIDTH/2;
543  rt.right = last_split+SPLIT_WIDTH/2+1;
544  hdc = GetDC(hWnd);
545  OldObj = SelectObject(hdc, SizingBrush);
546  PatBlt(hdc, rt.left, rt.top, rt.right - rt.left, rt.bottom - rt.top, PATINVERT);
547  last_split = x;
548  rt.left = x-SPLIT_WIDTH/2;
549  rt.right = x+SPLIT_WIDTH/2+1;
550  PatBlt(hdc, rt.left, rt.top, rt.right - rt.left, rt.bottom - rt.top, PATINVERT);
551  SelectObject(hdc, OldObj);
552  ReleaseDC(hWnd, hdc);
553  }
554  }
555  break;
556 
557  case WM_SETFOCUS:
558  if (g_pChildWnd != NULL)
559  {
561  }
562  break;
563 
564  case WM_TIMER:
565  break;
566 
567  case WM_NOTIFY:
568  if ((int)wParam == TREE_WINDOW && g_pChildWnd != NULL)
569  {
570  switch (((LPNMHDR)lParam)->code)
571  {
572  case TVN_ITEMEXPANDING:
574  case TVN_SELCHANGED:
575  {
576  NMTREEVIEW* pnmtv = (NMTREEVIEW*)lParam;
577  /* Get the parent of the current item */
578  HTREEITEM hParentItem = TreeView_GetParent(g_pChildWnd->hTreeWnd, pnmtv->itemNew.hItem);
579 
580  UpdateAddress(pnmtv->itemNew.hItem, NULL, NULL);
581 
582  /*
583  * Disable Delete/Rename menu options for 'My Computer' (first item so doesn't have any parent)
584  * and HKEY_* keys (their parent is 'My Computer' and the previous remark applies).
585  */
586  if (!hParentItem || !TreeView_GetParent(g_pChildWnd->hTreeWnd, hParentItem))
587  {
592  }
593  else
594  {
599  }
600 
601  break;
602  }
603  case NM_SETFOCUS:
605  break;
606  case TVN_BEGINLABELEDIT:
607  {
608  LPNMTVDISPINFO ptvdi;
609  /* cancel label edit for rootkeys */
610  ptvdi = (LPNMTVDISPINFO) lParam;
611  if (!TreeView_GetParent(g_pChildWnd->hTreeWnd, ptvdi->item.hItem) ||
613  return TRUE;
614  break;
615  }
616  case TVN_ENDLABELEDIT:
617  {
618  LPCWSTR keyPath;
619  HKEY hRootKey;
620  HKEY hKey = NULL;
621  LPNMTVDISPINFO ptvdi;
622  LONG lResult = TRUE;
623  WCHAR szBuffer[MAX_PATH];
624 
625  ptvdi = (LPNMTVDISPINFO) lParam;
626  if (ptvdi->item.pszText)
627  {
628  keyPath = GetItemPath(g_pChildWnd->hTreeWnd, TreeView_GetParent(g_pChildWnd->hTreeWnd, ptvdi->item.hItem), &hRootKey);
629  _snwprintf(szBuffer, COUNT_OF(szBuffer), L"%s\\%s", keyPath, ptvdi->item.pszText);
630  keyPath = GetItemPath(g_pChildWnd->hTreeWnd, ptvdi->item.hItem, &hRootKey);
631  if (RegOpenKeyExW(hRootKey, szBuffer, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
632  {
633  lResult = FALSE;
634  RegCloseKey(hKey);
635  TreeView_EditLabel(g_pChildWnd->hTreeWnd, ptvdi->item.hItem);
636  }
637  else
638  {
639  if (RenameKey(hRootKey, keyPath, ptvdi->item.pszText) != ERROR_SUCCESS)
640  lResult = FALSE;
641  else
642  UpdateAddress(ptvdi->item.hItem, hRootKey, szBuffer);
643  }
644  return lResult;
645  }
646  }
647  default:
648  return 0;
649  }
650  }
651  else
652  {
653  if ((int)wParam == LIST_WINDOW && g_pChildWnd != NULL)
654  {
655  switch (((LPNMHDR)lParam)->code)
656  {
657  case NM_SETFOCUS:
659  break;
660  default:
662  {
663  goto def;
664  }
665  return Result;
666  break;
667  }
668  }
669  }
670  break;
671 
672  case WM_CONTEXTMENU:
673  {
674  POINT pt;
676  {
677  int i, cnt;
678  BOOL IsDefault;
679  pt.x = (short) LOWORD(lParam);
680  pt.y = (short) HIWORD(lParam);
683  if (pt.x == -1 && pt.y == -1)
684  {
685  RECT rc;
686  if (i != -1)
687  {
688  rc.left = LVIR_BOUNDS;
690  pt.x = rc.left + 8;
691  pt.y = rc.top + 8;
692  }
693  else
694  pt.x = pt.y = 0;
696  }
697  if(i == -1)
698  {
700  }
701  else
702  {
705  IsDefault = IsDefaultValue(g_pChildWnd->hListWnd, i);
706  if(cnt == 1)
708  else
712 
714  }
715  }
716  else if ((HWND)wParam == g_pChildWnd->hTreeWnd)
717  {
718  TVHITTESTINFO hti;
719  HMENU hContextMenu;
720  TVITEMW item;
721  MENUITEMINFOW mii;
722  WCHAR resource[256];
723  WCHAR buffer[256];
724  LPWSTR s;
725  LPCWSTR keyPath;
726  HKEY hRootKey;
727  int iLastPos;
728  WORD wID;
729 
730  pt.x = (short) LOWORD(lParam);
731  pt.y = (short) HIWORD(lParam);
732 
733  if (pt.x == -1 && pt.y == -1)
734  {
735  RECT rc;
737  if (hti.hItem != NULL)
738  {
740  pt.x = rc.left + 8;
741  pt.y = rc.top + 8;
743  hti.flags = TVHT_ONITEM;
744  }
745  else
746  hti.flags = 0;
747  }
748  else
749  {
750  hti.pt.x = pt.x;
751  hti.pt.y = pt.y;
754  }
755 
756  if (hti.flags & TVHT_ONITEM)
757  {
758  hContextMenu = GetSubMenu(hPopupMenus, PM_TREECONTEXT);
760 
761  memset(&item, 0, sizeof(item));
762  item.mask = TVIF_STATE | TVIF_CHILDREN;
763  item.hItem = hti.hItem;
765 
766  /* Set the Expand/Collapse menu item appropriately */
768  memset(&mii, 0, sizeof(mii));
769  mii.cbSize = sizeof(mii);
771  mii.fState = (item.cChildren > 0) ? MFS_DEFAULT : MFS_GRAYED;
773  mii.dwTypeData = (LPWSTR) buffer;
774  SetMenuItemInfo(hContextMenu, 0, TRUE, &mii);
775 
776  /* Remove any existing suggestions */
777  memset(&mii, 0, sizeof(mii));
778  mii.cbSize = sizeof(mii);
779  mii.fMask = MIIM_ID;
780  GetMenuItemInfo(hContextMenu, GetMenuItemCount(hContextMenu) - 1, TRUE, &mii);
781  if ((mii.wID >= ID_TREE_SUGGESTION_MIN) && (mii.wID <= ID_TREE_SUGGESTION_MAX))
782  {
783  do
784  {
785  iLastPos = GetMenuItemCount(hContextMenu) - 1;
786  GetMenuItemInfo(hContextMenu, iLastPos, TRUE, &mii);
787  RemoveMenu(hContextMenu, iLastPos, MF_BYPOSITION);
788  }
789  while((mii.wID >= ID_TREE_SUGGESTION_MIN) && (mii.wID <= ID_TREE_SUGGESTION_MAX));
790  }
791 
792  /* Come up with suggestions */
793  keyPath = GetItemPath(g_pChildWnd->hTreeWnd, NULL, &hRootKey);
794  SuggestKeys(hRootKey, keyPath, Suggestions, COUNT_OF(Suggestions));
795  if (Suggestions[0])
796  {
797  AppendMenu(hContextMenu, MF_SEPARATOR, 0, NULL);
798 
800 
801  s = Suggestions;
803  while(*s && (wID <= ID_TREE_SUGGESTION_MAX))
804  {
806 
807  memset(&mii, 0, sizeof(mii));
808  mii.cbSize = sizeof(mii);
809  mii.fMask = MIIM_STRING | MIIM_ID;
810  mii.wID = wID++;
811  mii.dwTypeData = buffer;
812  InsertMenuItem(hContextMenu, GetMenuItemCount(hContextMenu), TRUE, &mii);
813 
814  s += wcslen(s) + 1;
815  }
816  }
817  TrackPopupMenu(hContextMenu, TPM_RIGHTBUTTON, pt.x, pt.y, 0, g_pChildWnd->hWnd, NULL);
818  }
819  }
820  break;
821  }
822 
823  case WM_SIZE:
824  if (wParam != SIZE_MINIMIZED && g_pChildWnd != NULL)
825  {
827  }
828  /* fall through */
829  default:
830 def:
832  }
833  return 0;
834 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define IDC_SIZEWE
Definition: winuser.h:689
#define IDS_GOTO_SUGGESTED_KEY
Definition: resource.h:194
#define ID_TREE_RENAME
Definition: resource.h:155
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2430
#define max(a, b)
Definition: svc.c:63
Definition: tftpd.h:59
static HICON
Definition: imagelist.c:84
#define MF_DISABLED
Definition: winuser.h:130
#define TRUE
Definition: types.h:120
void DestroyListView(HWND hwndLV)
Definition: listview.c:653
#define IMAGE_ICON
Definition: winuser.h:212
#define ID_TREE_COLLAPSEBRANCH
Definition: resource.h:98
ChildWnd * g_pChildWnd
Definition: childwnd.c:23
#define TreeView_GetItemRect(hwnd, hitem, prc, code)
Definition: commctrl.h:3425
#define PATINVERT
Definition: wingdi.h:327
#define MF_BYCOMMAND
Definition: winuser.h:202
static void SuggestKeys(HKEY hRootKey, LPCWSTR pszKeyPath, LPWSTR pszSuggestions, size_t iSuggestionsLength)
Definition: childwnd.c:227
long y
Definition: polytest.cpp:48
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WM_CONTEXTMENU
Definition: richedit.h:64
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
LRESULT CALLBACK AddressBarProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: childwnd.c:298
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
long x
Definition: polytest.cpp:48
static void finish_splitbar(HWND hWnd, int x)
Definition: childwnd.c:120
HDC WINAPI GetDC(_In_opt_ HWND)
#define PM_MODIFYVALUE
Definition: main.h:35
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define KEY_READ
Definition: nt_native.h:1023
#define pt(x, y)
Definition: drawing.c:79
#define TreeView_EditLabel(hwnd, hitem)
Definition: commctrl.h:3500
HWND hTreeWnd
Definition: main.h:60
#define WM_CAPTURECHANGED
Definition: winuser.h:1790
HWND hListWnd
Definition: main.h:61
static HDC
Definition: imagelist.c:92
#define BS_DEFPUSHBUTTON
Definition: pedump.c:652
HWND hWnd
Definition: settings.c:17
LONG top
Definition: windef.h:307
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
GLuint buffer
Definition: glext.h:5915
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HWND WINAPI SetFocus(_In_opt_ HWND)
static BOOL ChildWnd_CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: childwnd.c:140
LPWSTR dwTypeData
Definition: winuser.h:3244
#define LVNI_SELECTED
Definition: commctrl.h:2420
UINT_PTR WPARAM
Definition: windef.h:207
#define WS_CHILD
Definition: pedump.c:617
LONG left
Definition: windef.h:306
#define MFS_DEFAULT
Definition: winuser.h:743
#define VK_ESCAPE
Definition: winuser.h:2189
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2635
#define BS_CENTER
Definition: winuser.h:260
LONG right
Definition: windef.h:308
#define BM_SETIMAGE
Definition: winuser.h:1904
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define VK_RETURN
Definition: winuser.h:2176
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
#define SPLIT_WIDTH
Definition: eventvwr.c:62
HFONT hFont
Definition: main.c:53
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LONG RenameKey(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpNewName)
Definition: edit.c:1489
HBITMAP SizingPattern
Definition: childwnd.c:25
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
int nSplitPos
Definition: main.h:66
#define TPM_RIGHTBUTTON
Definition: winuser.h:2355
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
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define ListView_GetSelectedCount(hwndLV)
Definition: commctrl.h:2705
#define TVN_ENDLABELEDIT
Definition: commctrl.h:3740
#define TVIF_CHILDREN
Definition: commctrl.h:3268
#define ID_TREE_SUGGESTION_MIN
Definition: resource.h:159
#define MIIM_STATE
Definition: winuser.h:716
unsigned int BOOL
Definition: ntddk_ex.h:94
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
long LONG
Definition: pedump.c:60
#define NMTREEVIEW
Definition: commctrl.h:3638
#define ID_EDIT_DELETE
Definition: resource.h:60
#define WM_SETCURSOR
Definition: winuser.h:1618
short SHORT
Definition: pedump.c:59
#define MF_BYPOSITION
Definition: winuser.h:203
BOOL IsDefaultValue(HWND hwndLV, int i)
Definition: listview.c:107
#define TVN_BEGINLABELEDIT
Definition: commctrl.h:3739
HWND WINAPI GetCapture(void)
Definition: message.c:2879
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define TREE_WINDOW
Definition: main.h:27
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
#define CW_USEDEFAULT
Definition: winuser.h:225
#define GWLP_USERDATA
Definition: treelist.c:63
static void draw_splitbar(HWND hWnd, int x)
Definition: childwnd.c:90
int _snwprintf(wchar_t *buffer, size_t count, const wchar_t *format,...)
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define WM_KEYDOWN
Definition: winuser.h:1697
#define MF_SEPARATOR
Definition: winuser.h:137
static WCHAR Suggestions[256]
Definition: childwnd.c:27
LONG_PTR LPARAM
Definition: windef.h:208
#define SPLIT_MIN
Definition: main.h:31
#define LVNI_FOCUSED
Definition: commctrl.h:2419
#define ID_EDIT_RENAME
Definition: resource.h:61
LPCWSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY *phRootKey)
Definition: treeview.c:83
#define WM_DESTROY
Definition: winuser.h:1591
HTREEITEM hItem
Definition: commctrl.h:3517
#define MIIM_ID
Definition: winuser.h:717
#define WM_RBUTTONDOWN
Definition: winuser.h:1761
#define GetMenuItemInfo
Definition: winuser.h:5763
HBRUSH WINAPI CreatePatternBrush(_In_ HBITMAP)
#define SetMenuItemInfo
Definition: winuser.h:5825
BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result)
Definition: listview.c:543
WCHAR szPath[MAX_PATH]
Definition: main.h:68
#define ID_TREE_SUGGESTION_MAX
Definition: resource.h:160
#define COUNT_OF(a)
Definition: main.h:33
static VOID DestroyTreeView(HWND hTreeView)
#define TreeView_GetSelection(hwnd)
Definition: commctrl.h:3469
#define AppendMenu
Definition: winuser.h:5706
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define TreeView_HitTest(hwnd, lpht)
Definition: commctrl.h:3509
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WM_SIZE
Definition: winuser.h:1593
static int last_split
Definition: childwnd.c:24
HMENU hPopupMenus
Definition: main.c:33
#define NM_SETFOCUS
Definition: commctrl.h:135
void DestroyMainMenu()
Definition: main.c:157
HWND hWnd
Definition: main.h:59
#define TVN_SELCHANGED
Definition: commctrl.h:3731
#define WM_TIMER
Definition: winuser.h:1724
#define MF_ENABLED
Definition: winuser.h:128
#define IDI_ARROW
Definition: resource.h:37
#define MAX_PATH
Definition: compat.h:26
#define PM_TREECONTEXT
Definition: main.h:37
#define WM_KEYUP
Definition: winuser.h:1698
unsigned short WORD
Definition: ntddk_ex.h:93
#define BN_CLICKED
Definition: winuser.h:1907
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDS_MY_COMPUTER
Definition: resource.h:132
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
#define SIZE_MINIMIZED
Definition: winuser.h:2481
HWND CreateTreeView(HWND hwndParent, LPWSTR pHostName, HMENU id)
Definition: treeview.c:634
HWND hAddressBtnWnd
Definition: main.h:63
#define DEFAULT_GUI_FONT
Definition: wingdi.h:908
HICON hArrowIcon
Definition: main.h:64
void ResizeWnd(int cx, int cy)
Definition: childwnd.c:41
static VOID UpdateAddress(HTREEITEM hItem, HKEY hRootKey, LPCWSTR pszPath)
Definition: childwnd.c:320
#define BS_ICON
Definition: winuser.h:264
static const WCHAR L[]
Definition: oid.c:1250
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
HDC hdc
Definition: main.c:9
#define MFS_GRAYED
Definition: winuser.h:746
GLdouble s
Definition: gl.h:2039
#define TreeView_GetParent(hwnd, hitem)
Definition: commctrl.h:3465
#define WS_TABSTOP
Definition: pedump.c:634
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define WM_COMMAND
Definition: winuser.h:1722
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define BS_VCENTER
Definition: winuser.h:279
#define LVM_GETITEMRECT
Definition: commctrl.h:2473
#define GWLP_WNDPROC
Definition: treelist.c:66
#define TVIS_EXPANDED
Definition: commctrl.h:3280
#define BS_FLAT
Definition: winuser.h:280
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2881
#define ID_EDIT_MODIFY
Definition: resource.h:65
#define MIIM_STRING
Definition: winuser.h:722
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND hFrameWnd
Definition: main.c:30
#define TVN_ITEMEXPANDING
Definition: commctrl.h:3734
HWND WINAPI SetCapture(_In_ HWND hWnd)
#define LVIR_BOUNDS
Definition: commctrl.h:2468
HINSTANCE hInst
Definition: dxdiag.c:13
HMENU hMenuFrame
Definition: main.c:32
static ATOM item
Definition: dde.c:856
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define TreeView_SelectItem(hwnd, hitem)
Definition: commctrl.h:3477
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_LBUTTONUP
Definition: winuser.h:1759
#define PM_NEW
Definition: main.h:36
#define ID_TREE_EXPANDBRANCH
Definition: resource.h:96
#define min(a, b)
Definition: monoChain.cc:55
#define WM_MOUSEMOVE
Definition: winuser.h:1757
BOOL CreateListView(PMAIN_WND_INFO Info)
Definition: listview.c:355
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
BOOL WINAPI SetMenuDefaultItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define WM_SETFONT
Definition: winuser.h:1632
#define LPNMTVDISPINFO
Definition: commctrl.h:3672
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define IDC_ARROW
Definition: winuser.h:682
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2888
HWND hAddressBarWnd
Definition: main.h:62
Definition: main.h:57
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_CREATE
Definition: winuser.h:1590
#define LIST_WINDOW
Definition: main.h:28
#define HIWORD(l)
Definition: typedefs.h:246
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
LONG bottom
Definition: windef.h:309
#define TVIF_STATE
Definition: commctrl.h:3265
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define GetWindowLongPtr
Definition: treelist.c:73
#define ID_TREE_DELETE
Definition: resource.h:154
#define WM_SETFOCUS
Definition: winuser.h:1595
#define MF_GRAYED
Definition: winuser.h:129
#define HTCLIENT
Definition: winuser.h:2450
WCHAR * LPWSTR
Definition: xmlstorage.h:184
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
#define IDS_COLLAPSE
Definition: resource.h:191
#define IDS_EXPAND
Definition: resource.h:190
#define TVHT_ONITEM
Definition: commctrl.h:3523
Arabic default style
Definition: afstyles.h:93
#define WS_VISIBLE
Definition: pedump.c:620
#define ID_EDIT_MODIFY_BIN
Definition: resource.h:125
#define memset(x, y, z)
Definition: compat.h:39
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
LPARAM lParam
Definition: combotst.c:139
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
BOOL OnTreeExpanding(HWND hWnd, NMTREEVIEW *pnmtv)
Definition: treeview.c:503
#define LOWORD(l)
Definition: pedump.c:82
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:402
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define TreeView_GetItem(hwnd, pitem)
Definition: commctrl.h:3486
#define WM_NOTIFY
Definition: richedit.h:61
#define InsertMenuItem
Definition: winuser.h:5779
int nFocusPanel
Definition: main.h:65
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
HBRUSH SizingBrush
Definition: childwnd.c:26

Referenced by InitInstance().

◆ draw_splitbar()

static void draw_splitbar ( HWND  hWnd,
int  x 
)
static

Definition at line 90 of file childwnd.c.

91 {
92  RECT rt;
93  HGDIOBJ OldObj;
94  HDC hdc = GetDC(hWnd);
95 
96  if(!SizingPattern)
97  {
98  const DWORD Pattern[4] = {0x5555AAAA, 0x5555AAAA, 0x5555AAAA, 0x5555AAAA};
99  SizingPattern = CreateBitmap(8, 8, 1, 1, Pattern);
100  }
101  if(!SizingBrush)
102  {
104  }
105  GetClientRect(hWnd, &rt);
106  rt.left = x - SPLIT_WIDTH/2;
107  rt.right = x + SPLIT_WIDTH/2+1;
108  OldObj = SelectObject(hdc, SizingBrush);
109  PatBlt(hdc, rt.left, rt.top, rt.right - rt.left, rt.bottom - rt.top, PATINVERT);
110  SelectObject(hdc, OldObj);
111  ReleaseDC(hWnd, hdc);
112 }
#define PATINVERT
Definition: wingdi.h:327
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
HWND hWnd
Definition: settings.c:17
LONG top
Definition: windef.h:307
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
#define SPLIT_WIDTH
Definition: eventvwr.c:62
HBITMAP SizingPattern
Definition: childwnd.c:25
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HBRUSH WINAPI CreatePatternBrush(_In_ HBITMAP)
unsigned long DWORD
Definition: ntddk_ex.h:95
HDC hdc
Definition: main.c:9
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
LONG bottom
Definition: windef.h:309
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
HBRUSH SizingBrush
Definition: childwnd.c:26

Referenced by ChildWndProc(), and finish_splitbar().

◆ finish_splitbar()

static void finish_splitbar ( HWND  hWnd,
int  x 
)
static

Definition at line 120 of file childwnd.c.

121 {
122  RECT rt;
123 
125  last_split = -1;
126  GetClientRect(hWnd, &rt);
128  ResizeWnd(rt.right, rt.bottom);
129  ReleaseCapture();
130 }
ChildWnd * g_pChildWnd
Definition: childwnd.c:23
HWND hWnd
Definition: settings.c:17
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG right
Definition: windef.h:308
int nSplitPos
Definition: main.h:66
static void draw_splitbar(HWND hWnd, int x)
Definition: childwnd.c:90
static int last_split
Definition: childwnd.c:24
void ResizeWnd(int cx, int cy)
Definition: childwnd.c:41
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2888
LONG bottom
Definition: windef.h:309

Referenced by ChildWndProc().

◆ get_root_key_name()

LPCWSTR get_root_key_name ( HKEY  hRootKey)

Definition at line 29 of file childwnd.c.

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

Referenced by SaveSettings(), and UpdateAddress().

◆ ResizeWnd()

void ResizeWnd ( int  cx,
int  cy 
)

Definition at line 41 of file childwnd.c.

42 {
43  HDWP hdwp = BeginDeferWindowPos(4);
44  RECT rt, rs, rb;
45  const int nButtonWidth = 44;
46  const int nButtonHeight = 22;
47  int cyEdge = GetSystemMetrics(SM_CYEDGE);
49  SetRect(&rt, 0, 0, cx, cy);
50  cy = 0;
51  if (hStatusBar != NULL)
52  {
54  cy = rs.bottom - rs.top;
55  }
58  if (hdwp)
60  rt.left, rt.top,
61  rt.right - rt.left - nButtonWidth, nButtonHeight,
62  uFlags);
63  if (hdwp)
65  rt.right - nButtonWidth, rt.top,
66  nButtonWidth, nButtonHeight,
67  uFlags);
68  if (hdwp)
69  hdwp = DeferWindowPos(hdwp, g_pChildWnd->hTreeWnd, NULL,
70  rt.left,
71  rt.top + nButtonHeight + cyEdge,
73  rt.bottom - rt.top - cy - 2 * cyEdge,
74  uFlags);
75  if (hdwp)
76  hdwp = DeferWindowPos(hdwp, g_pChildWnd->hListWnd, NULL,
77  rt.left + cx,
78  rt.top + nButtonHeight + cyEdge,
79  rt.right - cx,
80  rt.bottom - rt.top - cy - 2 * cyEdge,
81  uFlags);
82  if (hdwp)
83  EndDeferWindowPos(hdwp);
84 }
HDWP WINAPI BeginDeferWindowPos(_In_ int)
ChildWnd * g_pChildWnd
Definition: childwnd.c:23
HWND hTreeWnd
Definition: main.h:60
HWND hListWnd
Definition: main.h:61
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define SWP_NOZORDER
Definition: winuser.h:1232
UINT uFlags
Definition: api.c:59
LONG right
Definition: windef.h:308
#define SPLIT_WIDTH
Definition: eventvwr.c:62
int nSplitPos
Definition: main.h:66
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
smooth NULL
Definition: ftsmooth.c:416
#define SM_CYEDGE
Definition: winuser.h:999
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOACTIVATE
Definition: winuser.h:1227
int WINAPI GetSystemMetrics(_In_ int)
HWND hStatusBar
Definition: main.cpp:35
HWND hAddressBtnWnd
Definition: main.h:63
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
unsigned int UINT
Definition: ndis.h:50
_Out_opt_ int * cx
Definition: commctrl.h:581
HWND hAddressBarWnd
Definition: main.h:62
LONG bottom
Definition: windef.h:309
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)

Referenced by ChildWndProc(), and finish_splitbar().

◆ SuggestKeys()

static void SuggestKeys ( HKEY  hRootKey,
LPCWSTR  pszKeyPath,
LPWSTR  pszSuggestions,
size_t  iSuggestionsLength 
)
static

Definition at line 227 of file childwnd.c.

229 {
230  WCHAR szBuffer[256];
231  WCHAR szLastFound[256];
232  size_t i;
233  HKEY hOtherKey, hSubKey;
234  BOOL bFound;
235 
236  memset(pszSuggestions, 0, iSuggestionsLength * sizeof(*pszSuggestions));
237  iSuggestionsLength--;
238 
239  /* Are we a root key in HKEY_CLASSES_ROOT? */
240  if ((hRootKey == HKEY_CLASSES_ROOT) && pszKeyPath[0] && !wcschr(pszKeyPath, L'\\'))
241  {
242  do
243  {
244  bFound = FALSE;
245 
246  /* Check default key */
247  if (QueryStringValue(hRootKey, pszKeyPath, NULL,
248  szBuffer, COUNT_OF(szBuffer)) == ERROR_SUCCESS)
249  {
250  /* Sanity check this key; it cannot be empty, nor can it be a
251  * loop back */
252  if ((szBuffer[0] != L'\0') && _wcsicmp(szBuffer, pszKeyPath))
253  {
254  if (RegOpenKeyW(hRootKey, szBuffer, &hOtherKey) == ERROR_SUCCESS)
255  {
256  lstrcpynW(pszSuggestions, L"HKCR\\", (int) iSuggestionsLength);
257  i = wcslen(pszSuggestions);
258  pszSuggestions += i;
259  iSuggestionsLength -= i;
260 
261  lstrcpynW(pszSuggestions, szBuffer, (int) iSuggestionsLength);
262  i = MIN(wcslen(pszSuggestions) + 1, iSuggestionsLength);
263  pszSuggestions += i;
264  iSuggestionsLength -= i;
265  RegCloseKey(hOtherKey);
266 
267  bFound = TRUE;
268  wcscpy(szLastFound, szBuffer);
269  pszKeyPath = szLastFound;
270  }
271  }
272  }
273  }
274  while(bFound && (iSuggestionsLength > 0));
275 
276  /* Check CLSID key */
277  if (RegOpenKeyW(hRootKey, pszKeyPath, &hSubKey) == ERROR_SUCCESS)
278  {
279  if (QueryStringValue(hSubKey, L"CLSID", NULL, szBuffer,
280  COUNT_OF(szBuffer)) == ERROR_SUCCESS)
281  {
282  lstrcpynW(pszSuggestions, L"HKCR\\CLSID\\", (int)iSuggestionsLength);
283  i = wcslen(pszSuggestions);
284  pszSuggestions += i;
285  iSuggestionsLength -= i;
286 
287  lstrcpynW(pszSuggestions, szBuffer, (int)iSuggestionsLength);
288  i = MIN(wcslen(pszSuggestions) + 1, iSuggestionsLength);
289  pszSuggestions += i;
290  iSuggestionsLength -= i;
291  }
292  RegCloseKey(hSubKey);
293  }
294  }
295 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define lstrcpynW
Definition: compat.h:405
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
smooth NULL
Definition: ftsmooth.c:416
#define MIN(a, b)
Definition: childwnd.c:225
#define COUNT_OF(a)
Definition: main.h:33
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
__wchar_t WCHAR
Definition: xmlstorage.h:180
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
LONG QueryStringValue(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpValueName, LPTSTR pszBuffer, DWORD dwBufferLen)
Definition: settings.c:19
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define memset(x, y, z)
Definition: compat.h:39
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

Referenced by ChildWndProc().

◆ UpdateAddress()

static VOID UpdateAddress ( HTREEITEM  hItem,
HKEY  hRootKey,
LPCWSTR  pszPath 
)
static

Definition at line 320 of file childwnd.c.

321 {
322  LPCWSTR keyPath, rootName;
323  LPWSTR fullPath;
324 
325  /* Wipe the listview, the status bar and the address bar if the root key was selected */
327  {
331  return;
332  }
333 
334  if (pszPath == NULL)
335  keyPath = GetItemPath(g_pChildWnd->hTreeWnd, hItem, &hRootKey);
336  else
337  keyPath = pszPath;
338 
339  if (keyPath)
340  {
341  RefreshListView(g_pChildWnd->hListWnd, hRootKey, keyPath);
342  rootName = get_root_key_name(hRootKey);
343  fullPath = HeapAlloc(GetProcessHeap(), 0, (wcslen(rootName) + 1 + wcslen(keyPath) + 1) * sizeof(WCHAR));
344  if (fullPath)
345  {
346  /* set (correct) the address bar text */
347  if (keyPath[0] != L'\0')
348  swprintf(fullPath, L"%s\\%s", rootName, keyPath);
349  else
350  fullPath = wcscpy(fullPath, rootName);
351  SendMessageW(hStatusBar, SB_SETTEXTW, 0, (LPARAM)fullPath);
353  HeapFree(GetProcessHeap(), 0, fullPath);
354  /* disable hive manipulation items temporarily (enable only if necessary) */
357  /* compare the strings to see if we should enable/disable the "Load Hive" menus accordingly */
358  if (!(_wcsicmp(rootName, L"HKEY_LOCAL_MACHINE") &&
359  _wcsicmp(rootName, L"HKEY_USERS")))
360  {
361  /*
362  * enable the unload menu item if at the root, otherwise
363  * enable the load menu item if there is no slash in
364  * keyPath (ie. immediate child selected)
365  */
366  if(keyPath[0] == L'\0')
368  else if(!wcschr(keyPath, L'\\'))
370  }
371  }
372  }
373 }
ChildWnd * g_pChildWnd
Definition: childwnd.c:23
#define MF_BYCOMMAND
Definition: winuser.h:202
#define ID_REGISTRY_LOADHIVE
Definition: resource.h:107
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
HWND hTreeWnd
Definition: main.h:60
HWND hListWnd
Definition: main.h:61
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
LPCWSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY *phRootKey)
Definition: treeview.c:83
#define WM_SETTEXT
Definition: winuser.h:1599
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define ID_REGISTRY_UNLOADHIVE
Definition: resource.h:108
#define MF_ENABLED
Definition: winuser.h:128
#define swprintf(buf, format,...)
Definition: sprintf.c:56
HWND hStatusBar
Definition: main.cpp:35
#define SB_SETTEXTW
Definition: commctrl.h:1938
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPCWSTR keyPath)
Definition: listview.c:670
#define TreeView_GetParent(hwnd, hitem)
Definition: commctrl.h:3465
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
LPCWSTR get_root_key_name(HKEY hRootKey)
Definition: childwnd.c:29
HMENU hMenuFrame
Definition: main.c:32
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND hAddressBarWnd
Definition: main.h:62
#define MF_GRAYED
Definition: winuser.h:129
WCHAR * LPWSTR
Definition: xmlstorage.h:184
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:402
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define ListView_DeleteAllItems(hwnd)
Definition: commctrl.h:2410

Referenced by ChildWndProc().

Variable Documentation

◆ g_pChildWnd

◆ last_split

int last_split
static

Definition at line 24 of file childwnd.c.

Referenced by ChildWndProc(), and finish_splitbar().

◆ SizingBrush

HBRUSH SizingBrush = 0

Definition at line 26 of file childwnd.c.

Referenced by ChildWndProc(), and draw_splitbar().

◆ SizingPattern

HBITMAP SizingPattern = 0

Definition at line 25 of file childwnd.c.

Referenced by ChildWndProc(), and draw_splitbar().

◆ Suggestions

WCHAR Suggestions[256]
static

Definition at line 27 of file childwnd.c.

Referenced by ChildWnd_CmdWndProc(), and ChildWndProc().