included Registry as virtual file system
authorMartin Fuchs <fuchs.martin@gmail.com>
Sat, 31 Jan 2004 19:31:51 +0000 (19:31 +0000)
committerMartin Fuchs <fuchs.martin@gmail.com>
Sat, 31 Jan 2004 19:31:51 +0000 (19:31 +0000)
svn path=/trunk/; revision=7943

19 files changed:
reactos/subsys/system/explorer/Jamfile
reactos/subsys/system/explorer/Makefile
reactos/subsys/system/explorer/Makefile.MinGW
reactos/subsys/system/explorer/Makefile.Wine
reactos/subsys/system/explorer/doc/changes.txt
reactos/subsys/system/explorer/explorer.dsp
reactos/subsys/system/explorer/explorer_intres.h
reactos/subsys/system/explorer/shell/entries.cpp
reactos/subsys/system/explorer/shell/entries.h
reactos/subsys/system/explorer/shell/filechild.cpp
reactos/subsys/system/explorer/shell/filechild.h
reactos/subsys/system/explorer/shell/mainframe.cpp
reactos/subsys/system/explorer/shell/mainframe.h
reactos/subsys/system/explorer/shell/ntobjfs.cpp
reactos/subsys/system/explorer/shell/ntobjfs.h
reactos/subsys/system/explorer/shell/regfs.cpp [new file with mode: 0644]
reactos/subsys/system/explorer/shell/regfs.h [new file with mode: 0644]
reactos/subsys/system/explorer/shell/winfs.cpp
reactos/subsys/system/explorer/shell/winfs.h

index 96593ab..1899540 100644 (file)
@@ -22,6 +22,7 @@ exe explorer :
        shell/unixfs.cpp
        shell/winfs.cpp
        shell/ntobjfs.cpp
+       shell/regfs.cpp
        shell/startup.c
        taskbar/desktopbar.cpp
        taskbar/quicklaunch.cpp
index 8291b8e..21d1a9d 100644 (file)
@@ -81,6 +81,7 @@ OBJECTS = \
        unixfs.o \
        shellfs.o \
        ntobjfs.o \
+       regfs.o \
        mainframe.o \
        filechild.o \
        pane.o \
index 9391b78..b0d61af 100644 (file)
@@ -55,6 +55,7 @@ OBJECTS = \
        unixfs.o \
        shellfs.o \
        ntobjfs.o \
+       regfs.o \
        mainframe.o \
        filechild.o \
        pane.o \
index 4f33401..6a73833 100644 (file)
@@ -30,6 +30,7 @@ CPP_SRCS = \
        shell/pane.cpp \
        shell/shellbrowser.cpp \
        shell/ntobjfs.cpp \
+       shell/regfs.cpp \
        taskbar/desktopbar.cpp \
        taskbar/taskbar.cpp \
        taskbar/startmenu.cpp \
index 32b4544..9c1aae5 100644 (file)
@@ -58,3 +58,4 @@ If you search for more information, look into the CVS repository.
 14.01.2004     m. fuchs        automatically adjusted size of notification area and quicklaunch bar in desktop bar
 18.01.2004     m. fuchs        explorer/desktop settings property sheet
 31.01.2004     m. fuchs        included NT Object namespace as virtual file system
+31.01.2004     m. fuchs        included Registry as virtual file system
index a95d315..b50ba70 100644 (file)
@@ -760,6 +760,14 @@ SOURCE=.\shell\pane.h
 # End Source File
 # Begin Source File
 
+SOURCE=.\shell\regfs.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\shell\regfs.h
+# End Source File
+# Begin Source File
+
 SOURCE=.\shell\shellbrowser.cpp
 # End Source File
 # Begin Source File
index 3d870f5..0d70dc0 100644 (file)
 #define ID_DRIVE_SHELL_NS               0x9001
 #define ID_DRIVE_UNIX_FS                0x9002
 #define ID_DRIVE_NTOBJ_NS               0x9003
-#define ID_DRIVE_FIRST                  0x9004
+#define ID_DRIVE_REGISTRY               0x9004
+#define ID_DRIVE_FIRST                  0x9005
 #define ID_ABOUT_WINDOWS                40002
 #define ID_ABOUT_EXPLORER               40003
 #define ID_DESKTOPBAR_SETTINGS          40005
index 1e2a208..6f69794 100644 (file)
@@ -463,3 +463,20 @@ void Entry::free_subentries()
                } while(next);
        }
 }
+
+
+const void* Directory::get_next_path_component(const void* p)
+{
+       LPCTSTR s = (LPCTSTR) p;
+
+       while(*s && *s!=TEXT('\\') && *s!=TEXT('/'))
+               ++s;
+
+       while(*s==TEXT('\\') || *s==TEXT('/'))
+               ++s;
+
+       if (!*s)
+               return NULL;
+
+       return s;
+}
index a5b2d60..aeab336 100644 (file)
@@ -32,7 +32,8 @@ enum ENTRY_TYPE {
        ET_UNIX,
 #endif
        ET_SHELL,
-       ET_NTOBJS
+       ET_NTOBJS,
+       ET_REGISTRY
 };
 
 enum SORT_ORDER {
@@ -105,6 +106,9 @@ protected:
        Directory() : _path(NULL) {}
        virtual ~Directory() {}
 
+        // default implementation like that of Windows file systems
+       virtual const void* get_next_path_component(const void*);
+
        void*   _path;
 };
 
index 33e914f..fc2b173 100644 (file)
@@ -31,6 +31,7 @@
 #include "../explorer.h"
 #include "../globals.h"
 #include "ntobjfs.h"
+#include "regfs.h"
 
 #include "../explorer_intres.h"
 
@@ -74,6 +75,13 @@ NtObjChildWndInfo::NtObjChildWndInfo(LPCTSTR path)
 }
 
 
+RegistryChildWndInfo::RegistryChildWndInfo(LPCTSTR path)
+ :     FileChildWndInfo(path)
+{
+       _etype = ET_REGISTRY;
+}
+
+
 FileChildWindow::FileChildWindow(HWND hwnd, const FileChildWndInfo& info)
  :     ChildWindow(hwnd)
 {
@@ -123,6 +131,18 @@ FileChildWindow::FileChildWindow(HWND hwnd, const FileChildWndInfo& info)
                _root._entry = new NtObjDirectory(_root._path);
                entry = _root._entry->read_tree(info._path, SORT_NAME/*_sortOrder*/);
        }
+       else if (info._etype == ET_REGISTRY)
+       {
+               _root._drive_type = DRIVE_UNKNOWN;
+
+               _tsplitpath(info._path, drv, NULL, NULL, NULL);
+               lstrcat(drv, TEXT("\\"));
+               lstrcpy(_root._volname, TEXT("Registry"));
+               lstrcpy(_root._fs, TEXT("Registry"));
+               lstrcpy(_root._path, drv);
+               _root._entry = new RegistryRoot();
+               entry = _root._entry->read_tree(info._path, SORT_NAME/*_sortOrder*/);
+       }
        else //if (info._etype == ET_WINDOWS)
        {
                _root._drive_type = GetDriveType(info._path);
index a719a42..1b50eaa 100644 (file)
@@ -53,6 +53,12 @@ struct NtObjChildWndInfo : public FileChildWndInfo
        NtObjChildWndInfo(LPCTSTR path);
 };
 
+ /// information structure for creation of FileChildWindow for the Registry
+struct RegistryChildWndInfo : public FileChildWndInfo
+{
+       RegistryChildWndInfo(LPCTSTR path);
+};
+
 
  /// MDI child window displaying file lists
 struct FileChildWindow : public ChildWindow
index 2c8e7ee..2954e58 100644 (file)
@@ -124,6 +124,13 @@ MainFrame::MainFrame(HWND hwnd)
                ++drivebarBtn.iString;
        }
 
+        // insert Registry button
+       SendMessage(_hdrivebar, TB_ADDSTRING, 0, (LPARAM)TEXT("Registry\0"));
+
+       drivebarBtn.idCommand = ID_DRIVE_REGISTRY;
+       SendMessage(_hdrivebar, TB_INSERTBUTTON, btn++, (LPARAM)&drivebarBtn);
+       ++drivebarBtn.iString;
+
         // register windows drive root strings
        SendMessage(_hdrivebar, TB_ADDSTRING, 0, (LPARAM)_drives);
 
@@ -495,7 +502,7 @@ int MainFrame::Command(int id, int code)
                TCHAR path[MAX_PATH];
                FileChildWindow* child;
 
-               if (activate_fs_window(TEXT("unixfs")))
+               if (activate_child_window(TEXT("unixfs")))
                        break;
 
                getcwd(path, MAX_PATH);
@@ -510,7 +517,7 @@ int MainFrame::Command(int id, int code)
          case ID_DRIVE_SHELL_NS: {
                TCHAR path[MAX_PATH];
 
-               if (activate_fs_window(TEXT("Shell")))
+               if (activate_child_window(TEXT("Shell")))
                        break;
 
                GetCurrentDirectory(MAX_PATH, path);
@@ -523,7 +530,7 @@ int MainFrame::Command(int id, int code)
                break;}
 
          case ID_DRIVE_NTOBJ_NS: {
-               if (activate_fs_window(TEXT("NTOBJ")))
+               if (activate_child_window(TEXT("NTOBJ")))
                        break;
 
 #ifndef _NO_MDI
@@ -533,10 +540,21 @@ int MainFrame::Command(int id, int code)
 #endif
          break;}
 
+         case ID_DRIVE_REGISTRY: {
+               if (activate_child_window(TEXT("Registry")))
+                       break;
+
+#ifndef _NO_MDI
+               FileChildWindow::create(_hmdiclient, RegistryChildWndInfo(TEXT("\\")));
+#else
+               ///@todo SDI implementation
+#endif
+         break;}
+
          case ID_DRIVE_DESKTOP: {
                TCHAR path[MAX_PATH];
 
-               if (activate_fs_window(TEXT("Desktop")))
+               if (activate_child_window(TEXT("Desktop")))
                        break;
 
                GetCurrentDirectory(MAX_PATH, path);
@@ -753,7 +771,7 @@ bool MainFrame::activate_drive_window(LPCTSTR path)
        return false;
 }
 
-bool MainFrame::activate_fs_window(LPCTSTR filesys)
+bool MainFrame::activate_child_window(LPCTSTR filesys)
 {
        HWND child_wnd;
 
index 21bee0a..f8ef668 100644 (file)
@@ -68,7 +68,7 @@ protected:
 
        void    toggle_child(HWND hwnd, UINT cmd, HWND hchild);
        bool    activate_drive_window(LPCTSTR path);
-       bool    activate_fs_window(LPCTSTR filesys);
+       bool    activate_child_window(LPCTSTR filesys);
 
        void    resize_frame_rect(PRECT prect);
        void    resize_frame(int cx, int cy);
index 34ea5e8..e1f104b 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "entries.h"
 #include "ntobjfs.h"
+#include "regfs.h"
 
 
 #define        CONSTRUCT_NTDLLFCT(x) x(TEXT("NTDLL"), #x)
@@ -222,7 +223,7 @@ void NtObjDirectory::read_directory(int scan_flags)
                if (!(*g_NTDLL->NtQueryDirectoryObject)(dir_handle, info, 0x800, TRUE, TRUE, &idx1, &idx2)) {
                        WIN32_FIND_DATA w32fd;
                        Entry* last = NULL;
-                       NtObjEntry* entry;
+                       Entry* entry;
 
                        do {
                                memset(&w32fd, 0, sizeof(WIN32_FIND_DATA));
@@ -269,43 +270,11 @@ void NtObjDirectory::read_directory(int scan_flags)
                                else if (type == KEY_OBJECT) {
                                        w32fd.dwFileAttributes |= FILE_ATTRIBUTE_DIRECTORY;
 
-                                       entry = new NtObjDirectory(this, buffer);
-
-#if 0 ///@todo mount registry hives
-                                       *pnext = entry = new RegRootEntry(tlvctrlr, HKEY_CURRENT_USER);
-                                       *entry->pparent() = this;
-
-                                       pnext = entry->pnext();
-                                       *pnext = entry = new RegRootEntry(tlvctrlr, HKEY_LOCAL_MACHINE);
-                                       *entry->pparent() = this;
-
-                                       pnext = entry->pnext();
-                                       *pnext = entry = new RegRootEntry(tlvctrlr, HKEY_CLASSES_ROOT);
-                                       *entry->pparent() = this;
-
-                                       pnext = entry->pnext();
-                                       *pnext = entry = new RegRootEntry(tlvctrlr, HKEY_USERS);
-                                       *entry->pparent() = this;
-                                       /*
-                                       pnext = entry->pnext();
-                                       *pnext = entry = new RegRootEntry(tlvctrlr, HKEY_PERFORMANCE_DATA);
-                                       *entry->pparent() = this;
-                                       */
-                                       pnext = entry->pnext();
-                                       *pnext = entry = new RegRootEntry(tlvctrlr, HKEY_CURRENT_CONFIG);
-                                       *entry->pparent() = this;
-                                       /*
-                                       pnext = entry->pnext();
-                                       *pnext = entry = new RegRootEntry(tlvctrlr, HKEY_DYN_DATA);
-                                       *entry->pparent() = this;
-                                       */
-#endif
+                                       entry = new RegistryRoot(this, buffer);
                                }
                                else
                                        entry = new NtObjEntry(this, type);
 
-                               entry->_bhfi_valid = false;
-
                                HANDLE handle;
 
 #ifdef UNICODE
@@ -403,23 +372,6 @@ void NtObjDirectory::read_directory(int scan_flags)
 }
 
 
-const void* NtObjDirectory::get_next_path_component(const void* p)
-{
-       LPCTSTR s = (LPCTSTR) p;
-
-       while(*s && *s!=TEXT('\\') && *s!=TEXT('/'))
-               ++s;
-
-       while(*s==TEXT('\\') || *s==TEXT('/'))
-               ++s;
-
-       if (!*s)
-               return NULL;
-
-       return s;
-}
-
-
 Entry* NtObjDirectory::find_entry(const void* p)
 {
        LPCTSTR name = (LPCTSTR)p;
@@ -490,10 +442,7 @@ bool NtObjEntry::get_path(PTSTR path) const
                        memcpy(path+1, name, l*sizeof(TCHAR));
                        len += l+1;
 
-                       if (entry->_up && !(entry->_up->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))     // a NTFS stream?
-                               path[0] = TEXT(':');
-                       else
-                               path[0] = TEXT('\\');
+                       path[0] = TEXT('\\');
                }
 
                entry = entry->_up;
index 43d2334..2738d2b 100644 (file)
@@ -124,6 +124,5 @@ struct NtObjDirectory : public NtObjEntry, public Directory
        }
 
        virtual void read_directory(int scan_flags=SCAN_ALL);
-       virtual const void* get_next_path_component(const void*);
        virtual Entry* find_entry(const void*);
 };
diff --git a/reactos/subsys/system/explorer/shell/regfs.cpp b/reactos/subsys/system/explorer/shell/regfs.cpp
new file mode 100644 (file)
index 0000000..3ca1ce6
--- /dev/null
@@ -0,0 +1,300 @@
+/*
+ * Copyright 2003 Martin Fuchs
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+ //
+ // Explorer clone
+ //
+ // ntobjfs.cpp
+ //
+ // Martin Fuchs, 31.01.2004
+ //
+
+
+#include "../utility/utility.h"
+#include "../utility/shellclasses.h"
+
+#include "entries.h"
+#include "regfs.h"
+
+
+void RegDirectory::read_directory(int scan_flags)
+{
+       CONTEXT("RegDirectory::read_directory()");
+
+       Entry* first_entry = NULL;
+       int level = _level + 1;
+
+       TCHAR buffer[MAX_PATH];
+
+       _tcscpy(buffer, (LPCTSTR)_path);
+       LPTSTR p = buffer + _tcslen(buffer);
+
+       HKEY hKey;
+
+       if (!RegOpenKeyEx(_hKeyRoot, *buffer=='\\'?buffer+1:buffer, 0, STANDARD_RIGHTS_READ|KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS, &hKey)) {
+               if (p[-1] != '\\')
+                       *p++ = '\\';
+
+               TCHAR name[MAX_PATH], class_name[MAX_PATH];
+               WIN32_FIND_DATA w32fd;
+               Entry* last = NULL;
+               RegEntry* entry;
+
+               for(int idx=0; ; ++idx) {
+                       memset(&w32fd, 0, sizeof(WIN32_FIND_DATA));
+
+                       DWORD name_len = MAX_PATH;
+                       DWORD class_len = MAX_PATH;
+
+                       if (RegEnumKeyEx(hKey, idx, name, &name_len, 0, class_name, &class_len, &w32fd.ftLastWriteTime))
+                               break;
+
+                       w32fd.dwFileAttributes |= FILE_ATTRIBUTE_DIRECTORY;
+
+                       _tcscpy(p, name);
+                       ///@todo class_name -> _entry->_class_name
+
+                       lstrcpy(w32fd.cFileName, p);
+
+                       entry = new RegDirectory(this, buffer, _hKeyRoot);
+
+                       memcpy(&entry->_data, &w32fd, sizeof(WIN32_FIND_DATA));
+
+                       if (!first_entry)
+                               first_entry = entry;
+
+                       if (last)
+                               last->_next = entry;
+
+                       entry->_down = NULL;
+                       entry->_expanded = false;
+                       entry->_scanned = false;
+                       entry->_level = level;
+
+                       last = entry;
+               }
+
+               DWORD type;
+               for(int idx=0; ; ++idx) {
+                       DWORD name_len = MAX_PATH;
+
+                       if (RegEnumValue(hKey, idx, name, &name_len, 0, &type, NULL, NULL))
+                               break;
+
+                       memset(&w32fd, 0, sizeof(WIN32_FIND_DATA));
+
+                       _tcscpy(p, name);
+                       ///@todo type -> _entry->_class_name
+
+                       lstrcpy(w32fd.cFileName, p);
+
+                       entry = new RegEntry(this);
+
+                       memcpy(&entry->_data, &w32fd, sizeof(WIN32_FIND_DATA));
+
+                       if (!first_entry)
+                               first_entry = entry;
+
+                       if (last)
+                               last->_next = entry;
+
+                       entry->_down = NULL;
+                       entry->_expanded = false;
+                       entry->_scanned = false;
+                       entry->_level = level;
+
+                       last = entry;
+               }
+
+               if (last)
+                       last->_next = NULL;
+
+               RegCloseKey(hKey);
+       }
+
+       _down = first_entry;
+       _scanned = true;
+}
+
+
+Entry* RegDirectory::find_entry(const void* p)
+{
+       LPCTSTR name = (LPCTSTR)p;
+
+       for(Entry*entry=_down; entry; entry=entry->_next) {
+               LPCTSTR p = name;
+               LPCTSTR q = entry->_data.cFileName;
+
+               do {
+                       if (!*p || *p==TEXT('\\') || *p==TEXT('/'))
+                               return entry;
+               } while(tolower(*p++) == tolower(*q++));
+
+               p = name;
+               q = entry->_data.cAlternateFileName;
+
+               do {
+                       if (!*p || *p==TEXT('\\') || *p==TEXT('/'))
+                               return entry;
+               } while(tolower(*p++) == tolower(*q++));
+       }
+
+       return NULL;
+}
+
+
+ // get full path of specified registry entry
+bool RegEntry::get_path(PTSTR path) const
+{
+       int level = 0;
+       int len = 0;
+       int l = 0;
+       LPCTSTR name = NULL;
+       TCHAR buffer[MAX_PATH];
+
+       const Entry* entry;
+       for(entry=this; entry; level++) {
+               l = 0;
+
+               if (entry->_etype == ET_REGISTRY) {
+                       name = entry->_data.cFileName;
+
+                       for(LPCTSTR s=name; *s && *s!=TEXT('/') && *s!=TEXT('\\'); s++)
+                               ++l;
+
+                       if (!entry->_up)
+                               break;
+               } else {
+                       if (entry->get_path(buffer)) {
+                               l = _tcslen(buffer);
+                               name = buffer;
+
+                               /* special handling of drive names */
+                               if (l>0 && buffer[l-1]=='\\' && path[0]=='\\')
+                                       --l;
+
+                               memmove(path+l, path, len*sizeof(TCHAR));
+                               memcpy(path, name, l*sizeof(TCHAR));
+                               len += l;
+                       }
+
+                       entry = NULL;
+                       break;
+               }
+
+               if (l > 0) {
+                       memmove(path+l+1, path, len*sizeof(TCHAR));
+                       memcpy(path+1, name, l*sizeof(TCHAR));
+                       len += l+1;
+
+                       path[0] = TEXT('\\');
+               }
+
+               entry = entry->_up;
+       }
+
+       if (entry) {
+               memmove(path+l, path, len*sizeof(TCHAR));
+               memcpy(path, name, l*sizeof(TCHAR));
+               len += l;
+       }
+
+       if (!level)
+               path[len++] = TEXT('\\');
+
+       path[len] = TEXT('\0');
+
+       return true;
+}
+
+BOOL RegEntry::launch_entry(HWND hwnd, UINT nCmdShow)
+{
+       return FALSE;
+}
+
+
+RegDirectory::RegDirectory(Entry* parent, LPCTSTR path, HKEY hKeyRoot)
+ :     RegEntry(parent),
+       _hKeyRoot(hKeyRoot)
+{
+       _path = _tcsdup(path);
+
+       memset(&_data, 0, sizeof(WIN32_FIND_DATA));
+       _data.dwFileAttributes |= FILE_ATTRIBUTE_DIRECTORY;
+}
+
+
+void RegistryRoot::read_directory(int scan_flags)
+{
+       Entry *entry, *last;
+       int level = _level + 1;
+
+       _data.dwFileAttributes |= FILE_ATTRIBUTE_DIRECTORY;
+
+       entry = new RegDirectory(this, TEXT("\\"), HKEY_CURRENT_USER);
+       _tcscpy(entry->_data.cFileName, TEXT("HKEY_CURRENT_USER"));
+       entry->_level = level;
+
+       _down = entry;
+       last = entry;
+
+       entry = new RegDirectory(this, TEXT("\\"), HKEY_LOCAL_MACHINE);
+       _tcscpy(entry->_data.cFileName, TEXT("HKEY_LOCAL_MACHINE"));
+       entry->_level = level;
+
+       last->_next = entry;
+       last = entry;
+
+       entry = new RegDirectory(this, TEXT("\\"), HKEY_CLASSES_ROOT);
+       _tcscpy(entry->_data.cFileName, TEXT("HKEY_CLASSES_ROOT"));
+       entry->_level = level;
+
+       last->_next = entry;
+       last = entry;
+
+       entry = new RegDirectory(this, TEXT("\\"), HKEY_USERS);
+       _tcscpy(entry->_data.cFileName, TEXT("HKEY_USERS"));
+       entry->_level = level;
+
+       last->_next = entry;
+       last = entry;
+/*
+       entry = new RegDirectory(this, TEXT("\\"), HKEY_PERFORMANCE_DATA);
+       _tcscpy(entry->_data.cFileName, TEXT("HKEY_PERFORMANCE_DATA"));
+       entry->_level = level;
+
+       last->_next = entry;
+       last = entry;
+*/
+       entry = new RegDirectory(this, TEXT("\\"), HKEY_CURRENT_CONFIG);
+       _tcscpy(entry->_data.cFileName, TEXT("HKEY_CURRENT_CONFIG"));
+       entry->_level = level;
+
+       last->_next = entry;
+       last = entry;
+/*
+       entry = new RegDirectory(this, TEXT("\\"), HKEY_DYN_DATA);
+       _tcscpy(entry->_data.cFileName, TEXT("HKEY_DYN_DATA"));
+       entry->_level = level;
+
+       last->_next = entry;
+       last = entry;
+*/
+       last->_next = NULL;
+}
diff --git a/reactos/subsys/system/explorer/shell/regfs.h b/reactos/subsys/system/explorer/shell/regfs.h
new file mode 100644 (file)
index 0000000..0cafd7d
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2003 Martin Fuchs
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+ //
+ // Explorer clone
+ //
+ // regfs.h
+ //
+ // Martin Fuchs, 31.01.2004
+ //
+
+
+ /// Registry entry
+struct RegEntry : public Entry
+{
+       RegEntry(Entry* parent) : Entry(parent, ET_REGISTRY) {}
+
+protected:
+       RegEntry() : Entry(ET_REGISTRY) {}
+
+       virtual bool get_path(PTSTR path) const;
+       virtual BOOL launch_entry(HWND hwnd, UINT nCmdShow);
+};
+
+
+ /// Registry key entry
+struct RegDirectory : public RegEntry, public Directory
+{
+       RegDirectory(Entry* parent, LPCTSTR path, HKEY hKeyRoot);
+
+       ~RegDirectory()
+       {
+               free(_path);
+               _path = NULL;
+       }
+
+       virtual void read_directory(int scan_flags=SCAN_ALL);
+       virtual Entry* find_entry(const void*);
+
+protected:
+       HKEY    _hKeyRoot;
+};
+
+
+ /// Registry key entry
+struct RegistryRoot : public RegEntry, public Directory
+{
+       RegistryRoot()
+       {
+       }
+
+       RegistryRoot(Entry* parent, LPCTSTR path)
+        :      RegEntry(parent)
+       {
+               _path = _tcsdup(path);
+       }
+
+       ~RegistryRoot()
+       {
+               free(_path);
+               _path = NULL;
+       }
+
+       virtual void read_directory(int scan_flags=SCAN_ALL);
+};
index e0a36d8..0a5bcb4 100644 (file)
@@ -80,7 +80,6 @@ int ScanNTFSStreams(Entry* entry, HANDLE hFile)
                                stream_entry->_expanded = false;
                                stream_entry->_scanned = false;
                                stream_entry->_level = entry->_level + 1;
-                               stream_entry->_bhfi_valid = false;
 
                                *pnext = stream_entry;
                                pnext = &stream_entry->_next;
@@ -159,7 +158,6 @@ void WinDirectory::read_directory(int scan_flags)
                        entry->_expanded = false;
                        entry->_scanned = false;
                        entry->_level = level;
-                       entry->_bhfi_valid = false;
 
                        if (scan_flags & SCAN_DO_ACCESS) {
                                HANDLE hFile = CreateFile(buffer, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
@@ -189,23 +187,6 @@ void WinDirectory::read_directory(int scan_flags)
 }
 
 
-const void* WinDirectory::get_next_path_component(const void* p)
-{
-       LPCTSTR s = (LPCTSTR) p;
-
-       while(*s && *s!=TEXT('\\') && *s!=TEXT('/'))
-               ++s;
-
-       while(*s==TEXT('\\') || *s==TEXT('/'))
-               ++s;
-
-       if (!*s)
-               return NULL;
-
-       return s;
-}
-
-
 Entry* WinDirectory::find_entry(const void* p)
 {
        LPCTSTR name = (LPCTSTR)p;
index 97e3326..8e371e8 100644 (file)
@@ -60,7 +60,6 @@ struct WinDirectory : public WinEntry, public Directory
        }
 
        virtual void read_directory(int scan_flags=SCAN_ALL);
-       virtual const void* get_next_path_component(const void*);
        virtual Entry* find_entry(const void*);
 };