ReactOS  0.4.12-dev-18-gf469aca
find.c File Reference
#include "regedit.h"
Include dependency graph for find.c:

Go to the source code of this file.

Macros

#define RSF_WHOLESTRING   0x00000001
 
#define RSF_LOOKATKEYS   0x00000002
 
#define RSF_LOOKATVALUES   0x00000004
 
#define RSF_LOOKATDATA   0x00000008
 
#define RSF_MATCHCASE   0x00010000
 

Functions

VOID SetValueName (HWND hwndLV, LPCWSTR pszValueName)
 
BOOL DoEvents (VOID)
 
static LPWSTR lstrstri (LPCWSTR psz1, LPCWSTR psz2)
 
static BOOL CompareName (LPCWSTR pszName1, LPCWSTR pszName2)
 
static BOOL CompareData (DWORD dwType, LPCWSTR psz1, LPCWSTR psz2)
 
int compare (const void *x, const void *y)
 
BOOL RegFindRecurse (HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValueName, LPWSTR *ppszFoundSubKey, LPWSTR *ppszFoundValueName)
 
BOOL RegFindWalk (HKEY *phKey, LPCWSTR pszSubKey, LPCWSTR pszValueName, LPWSTR *ppszFoundSubKey, LPWSTR *ppszFoundValueName)
 
static DWORD GetFindFlags (void)
 
static void SetFindFlags (DWORD dwFlags)
 
static INT_PTR CALLBACK AbortFindDialogProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL FindNext (HWND hWnd)
 
static INT_PTR CALLBACK FindDialogProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
void FindDialog (HWND hWnd)
 

Variables

static WCHAR s_szFindWhat [256]
 
static const WCHAR s_szFindFlags [] = L"FindFlags"
 
static const WCHAR s_szFindFlagsR [] = L"FindFlagsReactOS"
 
static HWND s_hwndAbortDialog
 
static BOOL s_bAbort
 
static DWORD s_dwFlags
 
static WCHAR s_szName [MAX_PATH]
 
static DWORD s_cbName
 
static const WCHAR s_empty [] = L""
 
static const WCHAR s_backslash [] = L"\\"
 

Macro Definition Documentation

◆ RSF_LOOKATDATA

#define RSF_LOOKATDATA   0x00000008

Definition at line 24 of file find.c.

Referenced by FindDialogProc(), GetFindFlags(), and RegFindRecurse().

◆ RSF_LOOKATKEYS

#define RSF_LOOKATKEYS   0x00000002

Definition at line 22 of file find.c.

Referenced by FindDialogProc(), GetFindFlags(), RegFindRecurse(), and RegFindWalk().

◆ RSF_LOOKATVALUES

#define RSF_LOOKATVALUES   0x00000004

Definition at line 23 of file find.c.

Referenced by FindDialogProc(), GetFindFlags(), and RegFindRecurse().

◆ RSF_MATCHCASE

#define RSF_MATCHCASE   0x00010000

Definition at line 25 of file find.c.

Referenced by CompareData(), CompareName(), and FindDialogProc().

◆ RSF_WHOLESTRING

#define RSF_WHOLESTRING   0x00000001

Definition at line 21 of file find.c.

Referenced by CompareData(), CompareName(), and FindDialogProc().

Function Documentation

◆ AbortFindDialogProc()

static INT_PTR CALLBACK AbortFindDialogProc ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 603 of file find.c.

Referenced by FindNext().

604 {
607 
608  switch(uMsg)
609  {
610  case WM_CLOSE:
611  s_bAbort = TRUE;
612  break;
613 
614  case WM_COMMAND:
615  switch(HIWORD(wParam))
616  {
617  case BN_CLICKED:
618  switch(LOWORD(wParam))
619  {
620  case IDCANCEL:
621  s_bAbort = TRUE;
622  break;
623  }
624  break;
625  }
626  break;
627  }
628  return 0;
629 }
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
WPARAM wParam
Definition: combotst.c:138
#define WM_CLOSE
Definition: winuser.h:1603
#define BN_CLICKED
Definition: winuser.h:1886
static BOOL s_bAbort
Definition: find.c:31
#define WM_COMMAND
Definition: winuser.h:1716
#define HIWORD(l)
Definition: typedefs.h:246
#define IDCANCEL
Definition: winuser.h:825
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

◆ compare()

int compare ( const void x,
const void y 
)

Definition at line 128 of file find.c.

129 {
130  const LPCWSTR *a = (const LPCWSTR *)x;
131  const LPCWSTR *b = (const LPCWSTR *)y;
132  return _wcsicmp(*a, *b);
133 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

◆ CompareData()

static BOOL CompareData ( DWORD  dwType,
LPCWSTR  psz1,
LPCWSTR  psz2 
)
static

Definition at line 91 of file find.c.

Referenced by RegFindRecurse().

95 {
96  INT i, cch1 = wcslen(psz1), cch2 = wcslen(psz2);
97  if (dwType == REG_SZ || dwType == REG_EXPAND_SZ)
98  {
100  {
101  if (s_dwFlags & RSF_MATCHCASE)
102  return 2 == CompareStringW(LOCALE_SYSTEM_DEFAULT, 0,
103  psz1, cch1, psz2, cch2);
104  else
106  NORM_IGNORECASE, psz1, cch1, psz2, cch2);
107  }
108 
109  for(i = 0; i <= cch1 - cch2; i++)
110  {
111  if (s_dwFlags & RSF_MATCHCASE)
112  {
114  psz1 + i, cch2, psz2, cch2))
115  return TRUE;
116  }
117  else
118  {
120  NORM_IGNORECASE, psz1 + i, cch2, psz2, cch2))
121  return TRUE;
122  }
123  }
124  }
125  return FALSE;
126 }
#define TRUE
Definition: types.h:120
#define RSF_WHOLESTRING
Definition: find.c:21
#define NORM_IGNORECASE
Definition: winnls.h:173
int32_t INT
Definition: typedefs.h:56
GLenum GLclampf GLint i
Definition: glfuncs.h:14
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
Definition: lang.c:1899
static DWORD s_dwFlags
Definition: find.c:33
#define RSF_MATCHCASE
Definition: find.c:25
#define LOCALE_SYSTEM_DEFAULT
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define REG_SZ
Definition: layer.c:22

◆ CompareName()

static BOOL CompareName ( LPCWSTR  pszName1,
LPCWSTR  pszName2 
)
static

Definition at line 72 of file find.c.

Referenced by CRegistryFolder::CompareIDs(), CNtObjectFolder::CompareIDs(), LdrGetDllHandleEx(), RegFindRecurse(), and RegFindWalk().

73 {
75  {
77  return wcscmp(pszName1, pszName2) == 0;
78  else
79  return _wcsicmp(pszName1, pszName2) == 0;
80  }
81  else
82  {
84  return wcsstr(pszName1, pszName2) != NULL;
85  else
86  return lstrstri(pszName1, pszName2) != NULL;
87  }
88 }
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
#define RSF_WHOLESTRING
Definition: find.c:21
smooth NULL
Definition: ftsmooth.c:416
static LPWSTR lstrstri(LPCWSTR psz1, LPCWSTR psz2)
Definition: find.c:57
static DWORD s_dwFlags
Definition: find.c:33
#define RSF_MATCHCASE
Definition: find.c:25
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

◆ DoEvents()

BOOL DoEvents ( VOID  )

Definition at line 41 of file find.c.

Referenced by RegFindRecurse(), and RegFindWalk().

42 {
43  MSG msg;
44  if (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
45  {
46  if (msg.message == WM_QUIT)
47  s_bAbort = TRUE;
49  {
50  TranslateMessage(&msg);
51  DispatchMessageW(&msg);
52  }
53  }
54  return s_bAbort;
55 }
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define TRUE
Definition: types.h:120
static HWND s_hwndAbortDialog
Definition: find.c:30
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define WM_QUIT
Definition: winuser.h:1605
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
smooth NULL
Definition: ftsmooth.c:416
static BOOL s_bAbort
Definition: find.c:31
#define msg(x)
Definition: auth_time.c:54
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define PM_REMOVE
Definition: winuser.h:1182
BOOL WINAPI IsDialogMessageW(_In_ HWND, _In_ LPMSG)

◆ FindDialog()

void FindDialog ( HWND  hWnd)

Definition at line 813 of file find.c.

Referenced by _CmdWndProc(), ChildWnd_CmdWndProc(), and FindNext().

814 {
816  hWnd, FindDialogProc, 0) != 0)
817  {
818  if (!FindNext(hWnd))
819  {
820  WCHAR msg[128], caption[128];
821 
823  LoadStringW(hInst, IDS_APP_TITLE, caption, COUNT_OF(caption));
824  MessageBoxW(0, msg, caption, MB_ICONINFORMATION);
825  }
826  }
827 }
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL FindNext(HWND hWnd)
Definition: find.c:631
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
UINT msg
Definition: msvc.h:92
smooth NULL
Definition: ftsmooth.c:416
#define COUNT_OF(a)
Definition: main.h:33
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
#define IDD_FIND
Definition: resource.h:50
static INT_PTR CALLBACK FindDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: find.c:698
#define MB_ICONINFORMATION
Definition: winuser.h:796
#define IDS_FINISHEDFIND
Definition: resource.h:200
HINSTANCE hInst
Definition: dxdiag.c:13
#define GetModuleHandle
Definition: winbase.h:3641
#define IDS_APP_TITLE
Definition: resource.h:10
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

◆ FindDialogProc()

static INT_PTR CALLBACK FindDialogProc ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 698 of file find.c.

Referenced by FindDialog().

699 {
700  INT_PTR iResult = 0;
701  HWND hControl;
702  LONG lStyle;
703  DWORD dwFlags;
704  static WCHAR s_szSavedFindValue[256];
705 
706  switch(uMsg)
707  {
708  case WM_INITDIALOG:
709  dwFlags = GetFindFlags();
710 
711  hControl = GetDlgItem(hDlg, IDC_LOOKAT_KEYS);
712  if (hControl)
713  SendMessageW(hControl, BM_SETCHECK, (dwFlags & RSF_LOOKATKEYS) ? TRUE : FALSE, 0);
714 
715  hControl = GetDlgItem(hDlg, IDC_LOOKAT_VALUES);
716  if (hControl)
717  SendMessageW(hControl, BM_SETCHECK, (dwFlags & RSF_LOOKATVALUES) ? TRUE : FALSE, 0);
718 
719  hControl = GetDlgItem(hDlg, IDC_LOOKAT_DATA);
720  if (hControl)
721  SendMessageW(hControl, BM_SETCHECK, (dwFlags & RSF_LOOKATDATA) ? TRUE : FALSE, 0);
722 
723  /* Match whole string */
724  hControl = GetDlgItem(hDlg, IDC_MATCHSTRING);
725  if (hControl)
726  SendMessageW(hControl, BM_SETCHECK, (dwFlags & RSF_WHOLESTRING) ? TRUE : FALSE, 0);
727 
728  /* Case sensitivity */
729  hControl = GetDlgItem(hDlg, IDC_MATCHCASE);
730  if (hControl)
731  SendMessageW(hControl, BM_SETCHECK, (dwFlags & RSF_MATCHCASE) ? TRUE : FALSE, 0);
732 
733  hControl = GetDlgItem(hDlg, IDC_FINDWHAT);
734  if (hControl)
735  {
736  SetWindowTextW(hControl, s_szSavedFindValue);
737  SetFocus(hControl);
738  SendMessageW(hControl, EM_SETSEL, 0, -1);
739  }
740  break;
741 
742  case WM_CLOSE:
743  EndDialog(hDlg, 0);
744  break;
745 
746  case WM_COMMAND:
747  switch(HIWORD(wParam))
748  {
749  case BN_CLICKED:
750  switch(LOWORD(wParam))
751  {
752  case IDOK:
753  dwFlags = 0;
754 
755  hControl = GetDlgItem(hDlg, IDC_LOOKAT_KEYS);
756  if (hControl && (SendMessageW(hControl, BM_GETCHECK, 0, 0) == BST_CHECKED))
757  dwFlags |= RSF_LOOKATKEYS;
758 
759  hControl = GetDlgItem(hDlg, IDC_LOOKAT_VALUES);
760  if (hControl && (SendMessageW(hControl, BM_GETCHECK, 0, 0) == BST_CHECKED))
761  dwFlags |= RSF_LOOKATVALUES;
762 
763  hControl = GetDlgItem(hDlg, IDC_LOOKAT_DATA);
764  if (hControl && (SendMessageW(hControl, BM_GETCHECK, 0, 0) == BST_CHECKED))
765  dwFlags |= RSF_LOOKATDATA;
766 
767  hControl = GetDlgItem(hDlg, IDC_MATCHSTRING);
768  if (hControl && (SendMessageW(hControl, BM_GETCHECK, 0, 0) == BST_CHECKED))
769  dwFlags |= RSF_WHOLESTRING;
770 
771  hControl = GetDlgItem(hDlg, IDC_MATCHCASE);
772  if (hControl && (SendMessageW(hControl, BM_GETCHECK, 0, 0) == BST_CHECKED))
773  dwFlags |= RSF_MATCHCASE;
774 
775  SetFindFlags(dwFlags);
776 
777  hControl = GetDlgItem(hDlg, IDC_FINDWHAT);
778  if (hControl)
780  EndDialog(hDlg, 1);
781  break;
782 
783  case IDCANCEL:
784  EndDialog(hDlg, 0);
785  break;
786  }
787  break;
788 
789  case EN_CHANGE:
790  switch(LOWORD(wParam))
791  {
792  case IDC_FINDWHAT:
793  GetWindowTextW((HWND) lParam, s_szSavedFindValue, COUNT_OF(s_szSavedFindValue));
794  hControl = GetDlgItem(hDlg, IDOK);
795  if (hControl)
796  {
797  lStyle = GetWindowLongPtr(hControl, GWL_STYLE);
798  if (s_szSavedFindValue[0])
799  lStyle &= ~WS_DISABLED;
800  else
801  lStyle |= WS_DISABLED;
802  SetWindowLongPtr(hControl, GWL_STYLE, lStyle);
803  RedrawWindow(hControl, NULL, NULL, RDW_INVALIDATE);
804  }
805  break;
806  }
807  }
808  break;
809  }
810  return iResult;
811 }
#define WS_DISABLED
Definition: pedump.c:621
#define IDC_LOOKAT_KEYS
Definition: resource.h:269
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
static WCHAR s_szFindWhat[256]
Definition: find.c:27
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define RSF_LOOKATKEYS
Definition: find.c:22
#define RSF_WHOLESTRING
Definition: find.c:21
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define IDC_MATCHSTRING
Definition: resource.h:272
int32_t INT_PTR
Definition: typedefs.h:62
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define RSF_LOOKATDATA
Definition: find.c:24
long LONG
Definition: pedump.c:60
static DWORD GetFindFlags(void)
Definition: find.c:556
smooth NULL
Definition: ftsmooth.c:416
#define BM_GETCHECK
Definition: winuser.h:1879
#define IDC_LOOKAT_VALUES
Definition: resource.h:270
#define BM_SETCHECK
Definition: winuser.h:1882
#define COUNT_OF(a)
Definition: main.h:33
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_CLOSE
Definition: winuser.h:1603
#define RSF_MATCHCASE
Definition: find.c:25
#define EM_SETSEL
Definition: winuser.h:1979
#define BN_CLICKED
Definition: winuser.h:1886
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
static void SetFindFlags(DWORD dwFlags)
Definition: find.c:585
#define WM_COMMAND
Definition: winuser.h:1716
#define GWL_STYLE
Definition: winuser.h:846
#define RSF_LOOKATVALUES
Definition: find.c:23
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1378
#define IDC_FINDWHAT
Definition: resource.h:268
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDC_MATCHCASE
Definition: resource.h:273
#define BST_CHECKED
Definition: winuser.h:197
#define HIWORD(l)
Definition: typedefs.h:246
#define GetWindowLongPtr
Definition: treelist.c:73
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define IDC_LOOKAT_DATA
Definition: resource.h:271
#define RDW_INVALIDATE
Definition: winuser.h:1200
#define EN_CHANGE
Definition: winuser.h:1983

◆ FindNext()

BOOL FindNext ( HWND  hWnd)

Definition at line 631 of file find.c.

Referenced by _CmdWndProc(), and FindDialog().

632 {
633  HKEY hKeyRoot;
634  LPCWSTR pszKeyPath;
635  BOOL fSuccess;
636  WCHAR szFullKey[512];
637  LPCWSTR pszValueName;
638  LPWSTR pszFoundSubKey, pszFoundValueName;
639 
640  if (wcslen(s_szFindWhat) == 0)
641  {
642  FindDialog(hWnd);
643  return TRUE;
644  }
645 
647 
648  pszKeyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot);
649  if (pszKeyPath == NULL)
650  {
651  hKeyRoot = HKEY_CLASSES_ROOT;
652  pszKeyPath = s_empty;
653  }
654 
655  /* Create abort find dialog */
658  if (s_hwndAbortDialog)
659  {
662  }
663  s_bAbort = FALSE;
664 
665  pszValueName = GetValueName(g_pChildWnd->hListWnd, -1);
666 
671 
672  fSuccess = RegFindWalk(&hKeyRoot, pszKeyPath, pszValueName,
673  &pszFoundSubKey, &pszFoundValueName);
674 
679 
680  if (s_hwndAbortDialog)
681  {
684  }
685 
686  if (fSuccess)
687  {
688  GetKeyName(szFullKey, COUNT_OF(szFullKey), hKeyRoot, pszFoundSubKey);
689  SelectNode(g_pChildWnd->hTreeWnd, szFullKey);
690  SetValueName(g_pChildWnd->hListWnd, pszFoundValueName);
691  free(pszFoundSubKey);
692  free(pszFoundValueName);
694  }
695  return fSuccess || s_bAbort;
696 }
#define TRUE
Definition: types.h:120
ChildWnd * g_pChildWnd
Definition: childwnd.c:23
static WCHAR s_szFindWhat[256]
Definition: find.c:27
__wchar_t WCHAR
Definition: xmlstorage.h:180
static HWND s_hwndAbortDialog
Definition: find.c:30
#define free
Definition: debug_ros.c:5
HWND hTreeWnd
Definition: main.h:60
HWND hListWnd
Definition: main.h:61
BOOL WINAPI UpdateWindow(_In_ HWND)
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define IDD_FINDING
Definition: resource.h:51
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI DestroyWindow(_In_ HWND)
static const WCHAR s_empty[]
Definition: find.c:36
VOID SetValueName(HWND hwndLV, LPCWSTR pszValueName)
Definition: listview.c:84
LPCWSTR GetValueName(HWND hwndLV, int iStartAt)
Definition: listview.c:55
static DWORD GetFindFlags(void)
Definition: find.c:556
smooth NULL
Definition: ftsmooth.c:416
LPCWSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY *phRootKey)
Definition: treeview.c:83
#define SW_SHOW
Definition: winuser.h:769
static DWORD s_dwFlags
Definition: find.c:33
#define COUNT_OF(a)
Definition: main.h:33
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CreateDialogW(h, n, w, f)
Definition: winuser.h:4150
static BOOL s_bAbort
Definition: find.c:31
void FindDialog(HWND hWnd)
Definition: find.c:813
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HWND hFrameWnd
Definition: main.c:30
#define GetModuleHandle
Definition: winbase.h:3641
BOOL RegFindWalk(HKEY *phKey, LPCWSTR pszSubKey, LPCWSTR pszValueName, LPWSTR *ppszFoundSubKey, LPWSTR *ppszFoundValueName)
Definition: find.c:356
HWND hAddressBarWnd
Definition: main.h:62
BOOL SelectNode(HWND hwndTV, LPCWSTR keyPath)
Definition: treeview.c:665
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
WCHAR * LPWSTR
Definition: xmlstorage.h:184
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
static INT_PTR CALLBACK AbortFindDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: find.c:603
BOOL GetKeyName(LPWSTR pszDest, size_t iDestLength, HKEY hRootKey, LPCWSTR lpSubKey)
Definition: edit.c:1588

◆ GetFindFlags()

static DWORD GetFindFlags ( void  )
static

Definition at line 556 of file find.c.

Referenced by FindDialogProc(), and FindNext().

557 {
558  HKEY hKey;
559  DWORD dwType, dwValue, cbData;
561 
563  {
564  /* Retrieve flags from registry key */
565  cbData = sizeof(dwValue);
566  if (RegQueryValueExW(hKey, s_szFindFlags, NULL, &dwType, (LPBYTE) &dwValue, &cbData) == ERROR_SUCCESS)
567  {
568  if (dwType == REG_DWORD)
569  dwFlags = (dwFlags & ~0x0000FFFF) | ((dwValue & 0x0000FFFF) << 0);
570  }
571 
572  /* Retrieve ReactOS Regedit specific flags from registry key */
573  cbData = sizeof(dwValue);
574  if (RegQueryValueExW(hKey, s_szFindFlagsR, NULL, &dwType, (LPBYTE) &dwValue, &cbData) == ERROR_SUCCESS)
575  {
576  if (dwType == REG_DWORD)
577  dwFlags = (dwFlags & ~0xFFFF0000) | ((dwValue & 0x0000FFFF) << 16);
578  }
579 
580  RegCloseKey(hKey);
581  }
582  return dwFlags;
583 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define RSF_LOOKATKEYS
Definition: find.c:22
#define HKEY_CURRENT_USER
Definition: winreg.h:11
static const WCHAR s_szFindFlagsR[]
Definition: find.c:29
#define RSF_LOOKATDATA
Definition: find.c:24
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3311
const TCHAR g_szGeneralRegKey[]
Definition: settings.c:16
smooth NULL
Definition: ftsmooth.c:416
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
static const WCHAR s_szFindFlags[]
Definition: find.c:28
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define RSF_LOOKATVALUES
Definition: find.c:23
#define REG_DWORD
Definition: sdbapi.c:539

◆ lstrstri()

static LPWSTR lstrstri ( LPCWSTR  psz1,
LPCWSTR  psz2 
)
static

Definition at line 57 of file find.c.

Referenced by CompareName().

58 {
59  INT i, cch1, cch2;
60 
61  cch1 = wcslen(psz1);
62  cch2 = wcslen(psz2);
63  for(i = 0; i <= cch1 - cch2; i++)
64  {
66  psz1 + i, cch2, psz2, cch2) == 2)
67  return (LPWSTR) (psz1 + i);
68  }
69  return NULL;
70 }
#define NORM_IGNORECASE
Definition: winnls.h:173
int32_t INT
Definition: typedefs.h:56
GLenum GLclampf GLint i
Definition: glfuncs.h:14
smooth NULL
Definition: ftsmooth.c:416
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
Definition: lang.c:1899
#define LOCALE_SYSTEM_DEFAULT
WCHAR * LPWSTR
Definition: xmlstorage.h:184
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

◆ RegFindRecurse()

BOOL RegFindRecurse ( HKEY  hKey,
LPCWSTR  pszSubKey,
LPCWSTR  pszValueName,
LPWSTR ppszFoundSubKey,
LPWSTR ppszFoundValueName 
)

Definition at line 135 of file find.c.

Referenced by RegFindWalk().

141 {
142  HKEY hSubKey;
143  LONG lResult;
144  WCHAR szSubKey[MAX_PATH];
145  DWORD i, c, cb, type;
146  BOOL fPast = FALSE;
147  LPWSTR *ppszNames = NULL;
148  LPBYTE pb = NULL;
149 
150  if (DoEvents())
151  return FALSE;
152 
153  if(wcslen(pszSubKey) >= _countof(szSubKey))
154  return FALSE;
155 
156  wcscpy(szSubKey, pszSubKey);
157  hSubKey = NULL;
158 
159  lResult = RegOpenKeyExW(hKey, szSubKey, 0, KEY_ALL_ACCESS, &hSubKey);
160  if (lResult != ERROR_SUCCESS)
161  return FALSE;
162 
163  if (pszValueName == NULL)
164  pszValueName = s_empty;
165 
166  lResult = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL, NULL, NULL,
167  &c, NULL, NULL, NULL, NULL);
168  if (lResult != ERROR_SUCCESS)
169  goto err;
170  ppszNames = (LPWSTR *) malloc(c * sizeof(LPWSTR));
171  if (ppszNames == NULL)
172  goto err;
173  ZeroMemory(ppszNames, c * sizeof(LPWSTR));
174 
175  for(i = 0; i < c; i++)
176  {
177  if (DoEvents())
178  goto err;
179 
180  s_cbName = MAX_PATH * sizeof(WCHAR);
181  lResult = RegEnumValueW(hSubKey, i, s_szName, &s_cbName, NULL, NULL,
182  NULL, &cb);
183  if (lResult == ERROR_NO_MORE_ITEMS)
184  {
185  c = i;
186  break;
187  }
188  if (lResult != ERROR_SUCCESS)
189  goto err;
190  if (s_cbName >= MAX_PATH * sizeof(WCHAR))
191  continue;
192 
193  ppszNames[i] = _wcsdup(s_szName);
194  }
195 
196  qsort(ppszNames, c, sizeof(LPWSTR), compare);
197 
198  for(i = 0; i < c; i++)
199  {
200  if (DoEvents())
201  goto err;
202 
203  if (!fPast && _wcsicmp(ppszNames[i], pszValueName) == 0)
204  {
205  fPast = TRUE;
206  continue;
207  }
208  if (!fPast)
209  continue;
210 
211  if ((s_dwFlags & RSF_LOOKATVALUES) &&
212  CompareName(ppszNames[i], s_szFindWhat))
213  {
214  *ppszFoundSubKey = _wcsdup(szSubKey);
215  if (ppszNames[i][0] == 0)
216  *ppszFoundValueName = NULL;
217  else
218  *ppszFoundValueName = _wcsdup(ppszNames[i]);
219  goto success;
220  }
221 
222  lResult = RegQueryValueExW(hSubKey, ppszNames[i], NULL, &type,
223  NULL, &cb);
224  if (lResult != ERROR_SUCCESS)
225  goto err;
226  pb = malloc(cb);
227  if (pb == NULL)
228  goto err;
229  lResult = RegQueryValueExW(hSubKey, ppszNames[i], NULL, &type,
230  pb, &cb);
231  if (lResult != ERROR_SUCCESS)
232  goto err;
233 
234  if ((s_dwFlags & RSF_LOOKATDATA) &&
235  CompareData(type, (LPWSTR) pb, s_szFindWhat))
236  {
237  *ppszFoundSubKey = _wcsdup(szSubKey);
238  if (ppszNames[i][0] == 0)
239  *ppszFoundValueName = NULL;
240  else
241  *ppszFoundValueName = _wcsdup(ppszNames[i]);
242  goto success;
243  }
244  free(pb);
245  pb = NULL;
246  }
247 
248  if (ppszNames != NULL)
249  {
250  for(i = 0; i < c; i++)
251  free(ppszNames[i]);
252  free(ppszNames);
253  }
254  ppszNames = NULL;
255 
256  lResult = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, &c, NULL, NULL,
257  NULL, NULL, NULL, NULL, NULL);
258  if (lResult != ERROR_SUCCESS)
259  goto err;
260  ppszNames = (LPWSTR *) malloc(c * sizeof(LPWSTR));
261  if (ppszNames == NULL)
262  goto err;
263  ZeroMemory(ppszNames, c * sizeof(LPWSTR));
264 
265  for(i = 0; i < c; i++)
266  {
267  if (DoEvents())
268  goto err;
269 
270  s_cbName = MAX_PATH * sizeof(WCHAR);
271  lResult = RegEnumKeyExW(hSubKey, i, s_szName, &s_cbName, NULL, NULL,
272  NULL, NULL);
273  if (lResult == ERROR_NO_MORE_ITEMS)
274  {
275  c = i;
276  break;
277  }
278  if (lResult != ERROR_SUCCESS)
279  goto err;
280  if (s_cbName >= MAX_PATH * sizeof(WCHAR))
281  continue;
282 
283  ppszNames[i] = _wcsdup(s_szName);
284  }
285 
286  qsort(ppszNames, c, sizeof(LPWSTR), compare);
287 
288  for(i = 0; i < c; i++)
289  {
290  if (DoEvents())
291  goto err;
292 
293  if ((s_dwFlags & RSF_LOOKATKEYS) &&
294  CompareName(ppszNames[i], s_szFindWhat))
295  {
296  *ppszFoundSubKey = malloc(
297  (wcslen(szSubKey) + wcslen(ppszNames[i]) + 2) *
298  sizeof(WCHAR));
299  if (*ppszFoundSubKey == NULL)
300  goto err;
301  if (szSubKey[0])
302  {
303  wcscpy(*ppszFoundSubKey, szSubKey);
304  wcscat(*ppszFoundSubKey, s_backslash);
305  }
306  else
307  **ppszFoundSubKey = 0;
308  wcscat(*ppszFoundSubKey, ppszNames[i]);
309  *ppszFoundValueName = NULL;
310  goto success;
311  }
312 
313  if (RegFindRecurse(hSubKey, ppszNames[i], NULL, ppszFoundSubKey,
314  ppszFoundValueName))
315  {
316  LPWSTR psz = *ppszFoundSubKey;
317  *ppszFoundSubKey = malloc(
318  (wcslen(szSubKey) + wcslen(psz) + 2) * sizeof(WCHAR));
319  if (*ppszFoundSubKey == NULL)
320  goto err;
321  if (szSubKey[0])
322  {
323  wcscpy(*ppszFoundSubKey, szSubKey);
324  wcscat(*ppszFoundSubKey, s_backslash);
325  }
326  else
327  **ppszFoundSubKey = 0;
328  wcscat(*ppszFoundSubKey, psz);
329  free(psz);
330  goto success;
331  }
332  }
333 
334 err:
335  if (ppszNames != NULL)
336  {
337  for(i = 0; i < c; i++)
338  free(ppszNames[i]);
339  free(ppszNames);
340  }
341  free(pb);
342  RegCloseKey(hSubKey);
343  return FALSE;
344 
345 success:
346  if (ppszNames != NULL)
347  {
348  for(i = 0; i < c; i++)
349  free(ppszNames[i]);
350  free(ppszNames);
351  }
352  RegCloseKey(hSubKey);
353  return TRUE;
354 }
Definition: bug.cpp:7
#define TRUE
Definition: types.h:120
static WCHAR s_szFindWhat[256]
Definition: find.c:27
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define RSF_LOOKATKEYS
Definition: find.c:22
#define _countof(array)
Definition: fontsub.cpp:30
#define free
Definition: debug_ros.c:5
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define ZeroMemory
Definition: winbase.h:1635
#define WCHAR
Definition: msvc.h:43
static BOOL CompareData(DWORD dwType, LPCWSTR psz1, LPCWSTR psz2)
Definition: find.c:91
#define RSF_LOOKATDATA
Definition: find.c:24
BOOL RegFindRecurse(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValueName, LPWSTR *ppszFoundSubKey, LPWSTR *ppszFoundValueName)
Definition: find.c:135
GLenum GLclampf GLint i
Definition: glfuncs.h:14
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
static const WCHAR s_empty[]
Definition: find.c:36
long LONG
Definition: pedump.c:60
void __cdecl qsort(_Inout_updates_bytes_(_NumOfElements *_SizeOfElements) void *_Base, _In_ size_t _NumOfElements, _In_ size_t _SizeOfElements, _In_ int(__cdecl *_PtFuncCompare)(const void *, const void *))
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2867
smooth NULL
Definition: ftsmooth.c:416
static DWORD s_dwFlags
Definition: find.c:33
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define success(from, fromstr, to, tostr)
static DWORD cb
Definition: integrity.c:41
static BOOL CompareName(LPCWSTR pszName1, LPCWSTR pszName2)
Definition: find.c:72
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3704
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
BOOL DoEvents(VOID)
Definition: find.c:41
#define err(...)
#define RSF_LOOKATVALUES
Definition: find.c:23
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
static WCHAR s_szName[MAX_PATH]
Definition: find.c:34
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR s_backslash[]
Definition: find.c:37
static DWORD s_cbName
Definition: find.c:35
#define c
Definition: ke_i.h:80
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
#define malloc
Definition: debug_ros.c:4
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:2541
WCHAR * LPWSTR
Definition: xmlstorage.h:184
_Check_return_ _CRTIMP wchar_t *__cdecl _wcsdup(_In_z_ const wchar_t *_Str)
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)

◆ RegFindWalk()

BOOL RegFindWalk ( HKEY phKey,
LPCWSTR  pszSubKey,
LPCWSTR  pszValueName,
LPWSTR ppszFoundSubKey,
LPWSTR ppszFoundValueName 
)

Definition at line 356 of file find.c.

Referenced by FindNext().

362 {
363  LONG lResult;
364  DWORD i, c;
365  HKEY hBaseKey, hSubKey;
366  WCHAR szKeyName[MAX_PATH];
367  WCHAR szSubKey[MAX_PATH];
368  LPWSTR pch;
369  BOOL fPast;
370  LPWSTR *ppszNames = NULL;
371 
372  hBaseKey = *phKey;
373  if (RegFindRecurse(hBaseKey, pszSubKey, pszValueName, ppszFoundSubKey,
374  ppszFoundValueName))
375  return TRUE;
376 
377  if (wcslen(pszSubKey) >= MAX_PATH)
378  return FALSE;
379 
380  wcscpy(szSubKey, pszSubKey);
381  while(szSubKey[0] != 0)
382  {
383  if (DoEvents())
384  return FALSE;
385 
386  pch = wcsrchr(szSubKey, L'\\');
387  if (pch == NULL)
388  {
389  wcscpy(szKeyName, szSubKey);
390  szSubKey[0] = 0;
391  hSubKey = hBaseKey;
392  }
393  else
394  {
395  lstrcpynW(szKeyName, pch + 1, MAX_PATH);
396  *pch = 0;
397  lResult = RegOpenKeyExW(hBaseKey, szSubKey, 0, KEY_ALL_ACCESS,
398  &hSubKey);
399  if (lResult != ERROR_SUCCESS)
400  return FALSE;
401  }
402 
403  lResult = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, &c, NULL, NULL,
404  NULL, NULL, NULL, NULL, NULL);
405  if (lResult != ERROR_SUCCESS)
406  goto err;
407 
408  ppszNames = (LPWSTR *) malloc(c * sizeof(LPWSTR));
409  if (ppszNames == NULL)
410  goto err;
411  ZeroMemory(ppszNames, c * sizeof(LPWSTR));
412 
413  for(i = 0; i < c; i++)
414  {
415  if (DoEvents())
416  goto err;
417 
418  s_cbName = MAX_PATH * sizeof(WCHAR);
419  lResult = RegEnumKeyExW(hSubKey, i, s_szName, &s_cbName,
420  NULL, NULL, NULL, NULL);
421  if (lResult == ERROR_NO_MORE_ITEMS)
422  {
423  c = i;
424  break;
425  }
426  if (lResult != ERROR_SUCCESS)
427  break;
428  ppszNames[i] = _wcsdup(s_szName);
429  }
430 
431  qsort(ppszNames, c, sizeof(LPWSTR), compare);
432 
433  fPast = FALSE;
434  for(i = 0; i < c; i++)
435  {
436  if (DoEvents())
437  goto err;
438 
439  if (!fPast && _wcsicmp(ppszNames[i], szKeyName) == 0)
440  {
441  fPast = TRUE;
442  continue;
443  }
444  if (!fPast)
445  continue;
446 
447  if ((s_dwFlags & RSF_LOOKATKEYS) &&
448  CompareName(ppszNames[i], s_szFindWhat))
449  {
450  *ppszFoundSubKey = malloc(
451  (wcslen(szSubKey) + wcslen(ppszNames[i]) + 2) *
452  sizeof(WCHAR));
453  if (*ppszFoundSubKey == NULL)
454  goto err;
455  if (szSubKey[0])
456  {
457  wcscpy(*ppszFoundSubKey, szSubKey);
458  wcscat(*ppszFoundSubKey, s_backslash);
459  }
460  else
461  **ppszFoundSubKey = 0;
462  wcscat(*ppszFoundSubKey, ppszNames[i]);
463  *ppszFoundValueName = NULL;
464  goto success;
465  }
466 
467  if (RegFindRecurse(hSubKey, ppszNames[i], NULL,
468  ppszFoundSubKey, ppszFoundValueName))
469  {
470  LPWSTR psz = *ppszFoundSubKey;
471  *ppszFoundSubKey = malloc(
472  (wcslen(szSubKey) + wcslen(psz) + 2) *
473  sizeof(WCHAR));
474  if (*ppszFoundSubKey == NULL)
475  goto err;
476  if (szSubKey[0])
477  {
478  wcscpy(*ppszFoundSubKey, szSubKey);
479  wcscat(*ppszFoundSubKey, s_backslash);
480  }
481  else
482  **ppszFoundSubKey = 0;
483  wcscat(*ppszFoundSubKey, psz);
484  free(psz);
485  goto success;
486  }
487  }
488  if (ppszNames != NULL)
489  {
490  for(i = 0; i < c; i++)
491  free(ppszNames[i]);
492  free(ppszNames);
493  }
494  ppszNames = NULL;
495 
496  if (hBaseKey != hSubKey)
497  RegCloseKey(hSubKey);
498  }
499 
500  if (*phKey == HKEY_CLASSES_ROOT)
501  {
502  *phKey = HKEY_CURRENT_USER;
503  if (RegFindRecurse(*phKey, s_empty, NULL, ppszFoundSubKey,
504  ppszFoundValueName))
505  return TRUE;
506  }
507 
508  if (*phKey == HKEY_CURRENT_USER)
509  {
510  *phKey = HKEY_LOCAL_MACHINE;
511  if (RegFindRecurse(*phKey, s_empty, NULL, ppszFoundSubKey,
512  ppszFoundValueName))
513  goto success;
514  }
515 
516  if (*phKey == HKEY_LOCAL_MACHINE)
517  {
518  *phKey = HKEY_USERS;
519  if (RegFindRecurse(*phKey, s_empty, NULL, ppszFoundSubKey,
520  ppszFoundValueName))
521  goto success;
522  }
523 
524  if (*phKey == HKEY_USERS)
525  {
526  *phKey = HKEY_CURRENT_CONFIG;
527  if (RegFindRecurse(*phKey, s_empty, NULL, ppszFoundSubKey,
528  ppszFoundValueName))
529  goto success;
530  }
531 
532 err:
533  if (ppszNames != NULL)
534  {
535  for(i = 0; i < c; i++)
536  free(ppszNames[i]);
537  free(ppszNames);
538  }
539  if (hBaseKey != hSubKey)
540  RegCloseKey(hSubKey);
541  return FALSE;
542 
543 success:
544  if (ppszNames != NULL)
545  {
546  for(i = 0; i < c; i++)
547  free(ppszNames[i]);
548  free(ppszNames);
549  }
550  if (hBaseKey != hSubKey)
551  RegCloseKey(hSubKey);
552  return TRUE;
553 }
#define HKEY_USERS
Definition: winreg.h:13
Definition: bug.cpp:7
#define TRUE
Definition: types.h:120
static WCHAR s_szFindWhat[256]
Definition: find.c:27
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define RSF_LOOKATKEYS
Definition: find.c:22
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define free
Definition: debug_ros.c:5
#define ZeroMemory
Definition: winbase.h:1635
#define HKEY_CURRENT_CONFIG
Definition: winreg.h:15
#define WCHAR
Definition: msvc.h:43
#define lstrcpynW
Definition: compat.h:397
BOOL RegFindRecurse(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValueName, LPWSTR *ppszFoundSubKey, LPWSTR *ppszFoundValueName)
Definition: find.c:135
GLenum GLclampf GLint i
Definition: glfuncs.h:14
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
static const WCHAR s_empty[]
Definition: find.c:36
long LONG
Definition: pedump.c:60
void __cdecl qsort(_Inout_updates_bytes_(_NumOfElements *_SizeOfElements) void *_Base, _In_ size_t _NumOfElements, _In_ size_t _SizeOfElements, _In_ int(__cdecl *_PtFuncCompare)(const void *, const void *))
smooth NULL
Definition: ftsmooth.c:416
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(_In_z_ const wchar_t *_Str, _In_ wchar_t _Ch)
static DWORD s_dwFlags
Definition: find.c:33
unsigned int BOOL
Definition: ntddk_ex.h:94
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define success(from, fromstr, to, tostr)
static BOOL CompareName(LPCWSTR pszName1, LPCWSTR pszName2)
Definition: find.c:72
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3704
_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:1087
BOOL DoEvents(VOID)
Definition: find.c:41
#define err(...)
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
static WCHAR s_szName[MAX_PATH]
Definition: find.c:34
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR s_backslash[]
Definition: find.c:37
static DWORD s_cbName
Definition: find.c:35
#define c
Definition: ke_i.h:80
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
#define malloc
Definition: debug_ros.c:4
WCHAR * pch
Definition: msvc.h:81
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
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:2541
WCHAR * LPWSTR
Definition: xmlstorage.h:184
_Check_return_ _CRTIMP wchar_t *__cdecl _wcsdup(_In_z_ const wchar_t *_Str)
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)
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

◆ SetFindFlags()

static void SetFindFlags ( DWORD  dwFlags)
static

Definition at line 585 of file find.c.

Referenced by FindDialogProc().

586 {
587  HKEY hKey;
588  DWORD dwDisposition;
589  DWORD dwData;
590 
592  {
593  dwData = (dwFlags >> 0) & 0x0000FFFF;
594  RegSetValueExW(hKey, s_szFindFlags, 0, REG_DWORD, (const BYTE *) &dwData, sizeof(dwData));
595 
596  dwData = (dwFlags >> 16) & 0x0000FFFF;
597  RegSetValueExW(hKey, s_szFindFlagsR, 0, REG_DWORD, (const BYTE *) &dwData, sizeof(dwData));
598 
599  RegCloseKey(hKey);
600  }
601 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define HKEY_CURRENT_USER
Definition: winreg.h:11
static const WCHAR s_szFindFlagsR[]
Definition: find.c:29
static HANDLE ULONG_PTR dwData
Definition: file.c:35
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:1094
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
const TCHAR g_szGeneralRegKey[]
Definition: settings.c:16
smooth NULL
Definition: ftsmooth.c:416
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
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:4917
static const WCHAR s_szFindFlags[]
Definition: find.c:28
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
unsigned char BYTE
Definition: ntddk_ex.h:96
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define REG_DWORD
Definition: sdbapi.c:539

◆ SetValueName()

VOID SetValueName ( HWND  hwndLV,
LPCWSTR  pszValueName 
)

Definition at line 84 of file listview.c.

Referenced by FindNext().

85 {
86  INT i, c;
87  LVFINDINFOW fi;
88 
89  c = ListView_GetItemCount(hwndLV);
90  for(i = 0; i < c; i++)
91  {
93  }
94  if (pszValueName == NULL)
95  i = 0;
96  else
97  {
98  fi.flags = LVFI_STRING;
99  fi.psz = pszValueName;
100  i = ListView_FindItem(hwndLV, -1, &fi);
101  }
104  iListViewSelect = i;
105 }
INT iListViewSelect
Definition: listview.c:29
int32_t INT
Definition: typedefs.h:56
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define ListView_SetItemState(hwndLV, i, data, mask)
Definition: commctrl.h:2643
smooth NULL
Definition: ftsmooth.c:416
#define LVIS_SELECTED
Definition: commctrl.h:2289
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2277
LPCWSTR psz
Definition: commctrl.h:2427
#define LVFI_STRING
Definition: commctrl.h:2407
#define ListView_FindItem(hwnd, iStart, plvfi)
Definition: commctrl.h:2440
#define c
Definition: ke_i.h:80
#define LVIS_FOCUSED
Definition: commctrl.h:2288

Variable Documentation

◆ s_bAbort

BOOL s_bAbort
static

Definition at line 31 of file find.c.

Referenced by AbortFindDialogProc(), DoEvents(), and FindNext().

◆ s_backslash

const WCHAR s_backslash[] = L"\\"
static

Definition at line 37 of file find.c.

Referenced by RegFindRecurse(), and RegFindWalk().

◆ s_cbName

DWORD s_cbName
static

Definition at line 35 of file find.c.

Referenced by RegFindRecurse(), and RegFindWalk().

◆ s_dwFlags

DWORD s_dwFlags
static

Definition at line 33 of file find.c.

Referenced by CompareData(), CompareName(), FindNext(), RegFindRecurse(), and RegFindWalk().

◆ s_empty

const WCHAR s_empty[] = L""
static

Definition at line 36 of file find.c.

Referenced by FindNext(), RegFindRecurse(), and RegFindWalk().

◆ s_hwndAbortDialog

HWND s_hwndAbortDialog
static

Definition at line 30 of file find.c.

◆ s_szFindFlags

const WCHAR s_szFindFlags[] = L"FindFlags"
static

Definition at line 28 of file find.c.

Referenced by GetFindFlags(), and SetFindFlags().

◆ s_szFindFlagsR

const WCHAR s_szFindFlagsR[] = L"FindFlagsReactOS"
static

Definition at line 29 of file find.c.

Referenced by GetFindFlags(), and SetFindFlags().

◆ s_szFindWhat

WCHAR s_szFindWhat[256]
static

Definition at line 27 of file find.c.

Referenced by FindDialogProc(), FindNext(), RegFindRecurse(), and RegFindWalk().

◆ s_szName

WCHAR s_szName[MAX_PATH]
static

Definition at line 34 of file find.c.

Referenced by RegFindRecurse(), and RegFindWalk().