ReactOS 0.4.15-dev-8116-gf69e256
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 void read_directory (int scan_flags=0)
 
virtual const voidget_next_path_component (const void *) const
 
virtual Entryfind_entry (const void *)
 
virtual bool get_path (PTSTR path, size_t path_count) const =0
 
virtual ShellPath create_absolute_pidl () const
 
virtual HRESULT GetUIObjectOf (HWND hWnd, REFIID riid, LPVOID *ppvOut)
 
virtual ShellFolder get_shell_folder () const
 
virtual BOOL launch_entry (HWND hwnd, UINT nCmdShow=SW_SHOWNORMAL)
 
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.

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}
r parent
Definition: btrfs.c:3010
#define _tcsdup
Definition: tchar.h:625
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define memset(x, y, z)
Definition: compat.h:39
void * _path
Definition: entries.h:143
WIN32_FIND_DATA _data
Definition: entries.h:100
HKEY _hKeyRoot
Definition: regfs.h:58
RegEntry()
Definition: regfs.h:35

◆ ~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
#define NULL
Definition: types.h:112

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{
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}
int tolower(int c)
Definition: utclib.c:902
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
GLfloat GLfloat p
Definition: glext.h:8902
uint32_t entry
Definition: isohybrid.c:63
#define TEXT(s)
Definition: k32.h:26
base of all file and directory entries
Definition: entries.h:83
Entry * _down
Definition: entries.h:93
Definition: name.c:39
const CHAR * LPCTSTR
Definition: xmlstorage.h:193

◆ 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}
GLdouble s
Definition: gl.h:2039

◆ 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
45 int plen = MAX_PATH - _tcslen(buffer);
46
47 HKEY hkey;
48
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;
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)) {
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 RegCloseKey(hKey)
Definition: registry.h:49
unsigned int idx
Definition: utils.c:41
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint level
Definition: gl.h:1546
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
GLenum pname
Definition: glext.h:5645
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define _tcscpy
Definition: tchar.h:623
#define _tcsncpy
Definition: tchar.h:1410
#define _tcscpy_s
Definition: tchar.h:624
#define REG_SZ
Definition: layer.c:22
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define _stprintf
Definition: utility.h:124
static UINT UINT last
Definition: font.c:45
#define REG_BINARY
Definition: nt_native.h:1496
struct _CONTEXT CONTEXT
#define REG_DWORD_BIG_ENDIAN
Definition: nt_native.h:1499
#define REG_RESOURCE_LIST
Definition: nt_native.h:1502
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define STANDARD_RIGHTS_READ
Definition: nt_native.h:65
#define REG_MULTI_SZ
Definition: nt_native.h:1501
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019
#define REG_RESOURCE_REQUIREMENTS_LIST
Definition: nt_native.h:1504
#define REG_LINK
Definition: nt_native.h:1500
#define REG_NONE
Definition: nt_native.h:1492
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define REG_FULL_RESOURCE_DESCRIPTOR
Definition: nt_native.h:1503
#define REG_QWORD
Definition: sdbapi.c:597
#define REG_DWORD
Definition: sdbapi.c:596
int _level
Definition: entries.h:98
bool _scanned
Definition: entries.h:97
Registry key entry.
Definition: regfs.h:44
Registry entry.
Definition: regfs.h:31
unsigned char * LPBYTE
Definition: typedefs.h:53
Definition: pdh_main.c:94
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
#define lstrcpy
Definition: winbase.h:3874
#define RegOpenKeyEx
Definition: winreg.h:520
#define RegQueryValueEx
Definition: winreg.h:524
#define RegEnumValue
Definition: winreg.h:511
#define RegEnumKeyEx
Definition: winreg.h:510
char TCHAR
Definition: xmlstorage.h:189
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define _tcslen
Definition: xmlstorage.h:198

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: