ReactOS  0.4.12-dev-75-g00dd17e
RegDirectory Struct Reference

Registry key entry. More...

#include <regfs.h>

Inheritance diagram for RegDirectory:
Collaboration diagram for RegDirectory:

Public Member Functions

 RegDirectory (Entry *parent, LPCTSTR path, HKEY hKeyRoot)
 
 ~RegDirectory ()
 
virtual void read_directory (int scan_flags=0)
 
virtual const voidget_next_path_component (const void *) const
 
virtual Entryfind_entry (const void *)
 
- Public Member Functions inherited from RegEntry
 RegEntry (Entry *parent)
 
- Public Member Functions inherited from Entry
virtual ~Entry ()
 
void free_subentries ()
 
void read_directory_base (SORT_ORDER sortOrder=SORT_NAME, int scan_flags=0)
 
Entryread_tree (const void *path, SORT_ORDER sortOrder=SORT_NAME, int scan_flags=0)
 
void sort_directory (SORT_ORDER sortOrder)
 
void smart_scan (SORT_ORDER sortOrder=SORT_NAME, int scan_flags=0)
 
int extract_icon (ICONCACHE_FLAGS flags=ICF_NORMAL)
 
int safe_extract_icon (ICONCACHE_FLAGS flags=ICF_NORMAL)
 
virtual ShellPath create_absolute_pidl () const
 
virtual HRESULT GetUIObjectOf (HWND hWnd, REFIID riid, LPVOID *ppvOut)
 
virtual ShellFolder get_shell_folder () const
 
virtual HRESULT do_context_menu (HWND hwnd, const POINT &pos, CtxMenuInterfaces &cm_ifs)
 

Protected Attributes

HKEY _hKeyRoot
 
- Protected Attributes inherited from Directory
void_path
 

Additional Inherited Members

- Public Attributes inherited from Entry
Entry_next
 
Entry_down
 
Entry_up
 
bool _expanded
 
bool _scanned
 
int _level
 
WIN32_FIND_DATA _data
 
SFGAOF _shell_attribs
 
LPTSTR _display_name
 
LPTSTR _type_name
 
LPTSTR _content
 
ENTRY_TYPE _etype
 
int _icon_id
 
BY_HANDLE_FILE_INFORMATION _bhfi
 
bool _bhfi_valid
 
- Protected Member Functions inherited from RegEntry
 RegEntry ()
 
virtual bool get_path (PTSTR path, size_t path_count) const
 
virtual BOOL launch_entry (HWND hwnd, UINT nCmdShow)
 
- Protected Member Functions inherited from Entry
 Entry (ENTRY_TYPE etype)
 
 Entry (Entry *parent, ENTRY_TYPE etype)
 
 Entry (const Entry &)
 
bool get_path_base (PTSTR path, size_t path_count, ENTRY_TYPE etype) const
 
- Protected Member Functions inherited from Directory
 Directory ()
 
virtual ~Directory ()
 

Detailed Description

Registry key entry.

Definition at line 43 of file regfs.h.

Constructor & Destructor Documentation

◆ RegDirectory()

RegDirectory::RegDirectory ( Entry parent,
LPCTSTR  path,
HKEY  hKeyRoot 
)

Definition at line 238 of file regfs.cpp.

Referenced by read_directory(), and RegistryRoot::read_directory().

239  : RegEntry(parent),
240  _hKeyRoot(hKeyRoot)
241 {
242  _path = _tcsdup(path);
243 
244  memset(&_data, 0, sizeof(WIN32_FIND_DATA));
245  _data.dwFileAttributes |= FILE_ATTRIBUTE_DIRECTORY;
246 }
WIN32_FIND_DATA _data
Definition: entries.h:100
HKEY _hKeyRoot
Definition: regfs.h:58
#define _tcsdup
Definition: tchar.h:625
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
void * _path
Definition: entries.h:143
Definition: services.c:325
RegEntry()
Definition: regfs.h:35
#define memset(x, y, z)
Definition: compat.h:39

◆ ~RegDirectory()

RegDirectory::~RegDirectory ( )
inline

Definition at line 47 of file regfs.h.

48  {
49  free(_path);
50  _path = NULL;
51  }
#define free
Definition: debug_ros.c:5
smooth NULL
Definition: ftsmooth.c:416
void * _path
Definition: entries.h:143

Member Function Documentation

◆ find_entry()

Entry * RegDirectory::find_entry ( const void p)
virtual

Reimplemented from Entry.

Definition at line 200 of file regfs.cpp.

201 {
202  LPCTSTR name = (LPCTSTR)p;
203 
204  for(Entry*entry=_down; entry; entry=entry->_next) {
205  LPCTSTR p = name;
206  LPCTSTR q = entry->_data.cFileName;
207 
208  do {
209  if (!*p || *p==TEXT('\\') || *p==TEXT('/'))
210  return entry;
211  } while(tolower(*p++) == tolower(*q++));
212 
213  p = name;
214  q = entry->_data.cAlternateFileName;
215 
216  do {
217  if (!*p || *p==TEXT('\\') || *p==TEXT('/'))
218  return entry;
219  } while(tolower(*p++) == tolower(*q++));
220  }
221 
222  return NULL;
223 }
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
uint8_t entry
Definition: isohybrid.c:63
smooth NULL
Definition: ftsmooth.c:416
Entry * _down
Definition: entries.h:93
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
#define TEXT(s)
Definition: k32.h:26
Definition: name.c:36
int tolower(int c)
Definition: utclib.c:902
base of all file and directory entries
Definition: entries.h:82
GLuint const GLchar * name
Definition: glext.h:6031

◆ get_next_path_component()

const void * RegDirectory::get_next_path_component ( const void p) const
virtual

Reimplemented from Entry.

Definition at line 183 of file regfs.cpp.

184 {
185  LPCTSTR s = (LPCTSTR) p;
186 
187  while(*s && *s!=TEXT('\\'))
188  ++s;
189 
190  while(*s==TEXT('\\'))
191  ++s;
192 
193  if (!*s)
194  return NULL;
195 
196  return s;
197 }
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
smooth NULL
Definition: ftsmooth.c:416
GLdouble s
Definition: gl.h:2039
#define TEXT(s)
Definition: k32.h:26

◆ read_directory()

void RegDirectory::read_directory ( int  scan_flags = 0)
virtual
Todo:
This can also be done in the RegEnumValue() call if we dynamically adjust the return buffer size.

Reimplemented from Entry.

Definition at line 34 of file regfs.cpp.

35 {
36  CONTEXT("RegDirectory::read_directory()");
37 
38  Entry* first_entry = NULL;
39  int level = _level + 1;
40 
42 
43  _tcscpy(buffer, (LPCTSTR)_path);
44  LPTSTR pname = buffer + _tcslen(buffer);
45  int plen = MAX_PATH - _tcslen(buffer);
46 
47  HKEY hkey;
48 
49  if (!RegOpenKeyEx(_hKeyRoot, *buffer=='\\'?buffer+1:buffer, 0, STANDARD_RIGHTS_READ|KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS, &hkey)) {
50  if (pname[-1] != '\\')
51  *pname++ = '\\', plen--;
52 
53  TCHAR name[MAX_PATH], class_name[MAX_PATH];
54  WIN32_FIND_DATA w32fd;
55  Entry* last = NULL;
56  RegEntry* entry;
57 
58  for(int idx=0; ; ++idx) {
59  memset(&w32fd, 0, sizeof(WIN32_FIND_DATA));
60 
61  DWORD name_len = MAX_PATH;
62  DWORD class_len = MAX_PATH;
63 
64  if (RegEnumKeyEx(hkey, idx, name, &name_len, 0, class_name, &class_len, &w32fd.ftLastWriteTime))
65  break;
66 
67  w32fd.dwFileAttributes |= FILE_ATTRIBUTE_DIRECTORY;
68  _tcsncpy(w32fd.cFileName, name, name_len);
69 
70  _tcscpy_s(pname, plen, name);
71  entry = new RegDirectory(this, buffer, _hKeyRoot);
72 
73  memcpy(&entry->_data, &w32fd, sizeof(WIN32_FIND_DATA));
74 
75  if (class_len)
76  entry->_type_name = _tcsdup(String(class_name, class_len));
77 
78  if (!first_entry)
79  first_entry = entry;
80 
81  if (last)
82  last->_next = entry;
83 
84  entry->_level = level;
85 
86  last = entry;
87  }
88 /*
89  TCHAR value[MAX_PATH];
90  LONG value_len = sizeof(value);
91 
92  if (!RegQueryValue(hkey, NULL, value, &value_len) && value_len>1) {
93  memset(&w32fd, 0, sizeof(WIN32_FIND_DATA));
94 
95  lstrcpy(w32fd.cFileName, TEXT("(Default)"));
96 
97  entry = new RegEntry(this);
98 
99  memcpy(&entry->_data, &w32fd, sizeof(WIN32_FIND_DATA));
100 
101  entry->_content = _tcsdup(value);
102 
103  if (!first_entry)
104  first_entry = entry;
105 
106  if (last)
107  last->_next = entry;
108 
109  entry->_level = level;
110 
111  last = entry;
112  }
113 */
114  DWORD type;
115  for(int idx=0; ; ++idx) {
116  DWORD name_len = MAX_PATH;
117 
118  if (RegEnumValue(hkey, idx, name, &name_len, 0, &type, NULL, NULL))
119  break;
120 
121  memset(&w32fd, 0, sizeof(WIN32_FIND_DATA));
122 
123  if (name[0])
124  lstrcpy(w32fd.cFileName, name);
125  else
126  lstrcpy(w32fd.cFileName, TEXT("(Default)"));
127 
128  entry = new RegEntry(this);
129 
130  memcpy(&entry->_data, &w32fd, sizeof(WIN32_FIND_DATA));
131 
132  switch(type) {
133  case REG_NONE: entry->_type_name = _tcsdup(TEXT("REG_NONE")); break;
134  case REG_SZ: entry->_type_name = _tcsdup(TEXT("REG_SZ")); break;
135  case REG_EXPAND_SZ: entry->_type_name = _tcsdup(TEXT("REG_EXPAND_SZ")); break;
136  case REG_BINARY: entry->_type_name = _tcsdup(TEXT("REG_BINARY")); break;
137  case REG_DWORD: entry->_type_name = _tcsdup(TEXT("REG_DWORD")); break;
138  case REG_DWORD_BIG_ENDIAN: entry->_type_name = _tcsdup(TEXT("REG_DWORD_BIG_ENDIAN")); break;
139  case REG_LINK: entry->_type_name = _tcsdup(TEXT("REG_LINK")); break;
140  case REG_MULTI_SZ: entry->_type_name = _tcsdup(TEXT("REG_MULTI_SZ")); break;
141  case REG_RESOURCE_LIST: entry->_type_name = _tcsdup(TEXT("REG_RESOURCE_LIST")); break;
142  case REG_FULL_RESOURCE_DESCRIPTOR: entry->_type_name = _tcsdup(TEXT("REG_FULL_RESOURCE_DESCRIPTOR")); break;
143  case REG_RESOURCE_REQUIREMENTS_LIST: entry->_type_name = _tcsdup(TEXT("REG_RESOURCE_REQUIREMENTS_LIST"));break;
144  case REG_QWORD: entry->_type_name = _tcsdup(TEXT("REG_QWORD")); break;
145  }
146 
149  DWORD value_len = sizeof(value);
150 
151  if (!RegQueryValueEx(hkey, name, NULL, NULL, (LPBYTE)value, &value_len)) {
152  if (type==REG_SZ || type==REG_EXPAND_SZ || type==REG_LINK)
153  entry->_content = _tcsdup(value);
154  else if (type == REG_DWORD) {
155  TCHAR b[32];
156  _stprintf(b, TEXT("%ld"), *(DWORD*)&value);
157  entry->_content = _tcsdup(b);
158  }
159  }
160 
161  if (!first_entry)
162  first_entry = entry;
163 
164  if (last)
165  last->_next = entry;
166 
167  entry->_level = level;
168 
169  last = entry;
170  }
171 
172  if (last)
173  last->_next = NULL;
174 
175  RegCloseKey(hkey);
176  }
177 
178  _down = first_entry;
179  _scanned = true;
180 }
#define RegQueryValueEx
Definition: winreg.h:524
Entry * _next
Definition: entries.h:92
GLint level
Definition: gl.h:1546
struct _CONTEXT CONTEXT
Definition: get.c:139
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
RegDirectory(Entry *parent, LPCTSTR path, HKEY hKeyRoot)
Definition: regfs.cpp:238
WIN32_FIND_DATA _data
Definition: entries.h:100
HKEY _hKeyRoot
Definition: regfs.h:58
#define REG_BINARY
Definition: nt_native.h:1496
POINT last
Definition: font.c:46
uint8_t entry
Definition: isohybrid.c:63
_TCHAR * _tcsncpy(_TCHAR *dst, const _TCHAR *src, size_t n)
Definition: tcsncpy.h:9
#define _tcscpy_s
Definition: tchar.h:624
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
Definition: tcscpy.h:8
GLuint buffer
Definition: glext.h:5915
#define _tcsdup
Definition: tchar.h:625
static WCHAR String[]
Definition: stringtable.c:55
#define REG_RESOURCE_REQUIREMENTS_LIST
Definition: nt_native.h:1504
CHAR * LPTSTR
Definition: xmlstorage.h:192
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
#define REG_MULTI_SZ
Definition: nt_native.h:1501
unsigned int idx
Definition: utils.c:41
LPTSTR _content
Definition: entries.h:105
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
smooth NULL
Definition: ftsmooth.c:416
#define REG_RESOURCE_LIST
Definition: nt_native.h:1502
#define REG_FULL_RESOURCE_DESCRIPTOR
Definition: nt_native.h:1503
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
char TCHAR
Definition: xmlstorage.h:189
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define REG_LINK
Definition: nt_native.h:1500
Registry entry.
Definition: regfs.h:30
Entry * _down
Definition: entries.h:93
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define STANDARD_RIGHTS_READ
Definition: nt_native.h:65
#define RegEnumKeyEx
Definition: winreg.h:510
int _level
Definition: entries.h:98
GLsizei const GLfloat * value
Definition: glext.h:6069
#define REG_DWORD_BIG_ENDIAN
Definition: nt_native.h:1499
#define _stprintf
Definition: utility.h:124
LPTSTR _type_name
Definition: entries.h:104
#define RegOpenKeyEx
Definition: winreg.h:520
#define TEXT(s)
Definition: k32.h:26
void * _path
Definition: entries.h:143
#define lstrcpy
Definition: winbase.h:3688
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
bool _scanned
Definition: entries.h:97
Definition: name.c:36
RegEntry()
Definition: regfs.h:35
#define REG_QWORD
Definition: sdbapi.c:540
LONG RegEnumValue(HKEY Key, ULONG Index, PWCHAR ValueName, ULONG *NameSize, ULONG *Type, PUCHAR Data, ULONG *DataSize)
#define REG_NONE
Definition: nt_native.h:1492
#define memset(x, y, z)
Definition: compat.h:39
#define REG_DWORD
Definition: sdbapi.c:539
base of all file and directory entries
Definition: entries.h:82
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019
#define REG_SZ
Definition: layer.c:22

Member Data Documentation

◆ _hKeyRoot

HKEY RegDirectory::_hKeyRoot
protected

Definition at line 58 of file regfs.h.

Referenced by read_directory().


The documentation for this struct was generated from the following files: