Regfs BETA v0.2007.040
Copyright (c) 2007 Christopher Smith

mailto:csmith32@gmail.com
Questions, comments, constructive criticism welcome.

http://czwsoft.dyndns.org/

NOTE: REGFS is a beta kernel driver. It may have bugs capable of crashing and/or damaging your computer. Use at your own risk. Use in a VM is recommended.

Licence:
--------
This program is licened under the GNU General Public Licence, which
should be included in the package as COPYING. See the file for
further details.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.

This program 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 General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

Purpose:
--------
The registry interface is very similar to the filesystem interface in that they are both hierarchical databases that have data-less nodes (keys/directories) and data leaves (key values/files). Unforutnately, the registry is accessed through an entirely different API than files are, which can be a pain in portable software, especially those designed to edit and transfer configuration, expecting the data to be stored in files (like it is on most other OSes).

Regfs provides a filesystem interface to the registry, allowing programs that aren't aware of the registry to access it anyway. Regfs is NOT designed to be a general-purpose filesystem, as there are important features that cannot be implemented (without modifying the Windows NT kernel that is). Instead, it should be used to access and store basic configuration information in a unified place for all apps-- even those that don't normally use the registry.

Using the binary:
-----------------
The current build has been tested on XP SP2 and Server 2003 SP1.

To install, you must install regfs as a driver service. Copy regfs.sys into %WINDIR%\System32\Drivers. At a command prompt, type:

sc create type= kernel start= demand

To start, type:

sc start regfs

There is now a drive letter (R:) mapped to \REGISTRY (you may need to restart Explorer for it to notice)

When all handles open on regfs are closed, you can stop the driver with

sc stop regfs

To uninstall, delete regfs.sys and execute

sc delete regfs

Building the source:
--------------------
Regfs requires an NT installable filesystem build envrionment. You can use either Microsoft's official IFSKit build environment or Microsoft's free DDK plus the GPL'd ntifs.h by Bo Brantn included with the regfs source. If you want to use the official IFSKit's headers, rename/remove the included ntifs.h so build will search in the IFS include directory for ntifs.h. In either case, Regfs should be able to detect which files you are using.

Regfs can optionally use a few features only included in newer versions of the NT kernel, including faster mutexes (XP and 2003) and per-stream filter contexts (XP+). There are four build directories corresponding to four different kernel versions, NT35, NT50, NT51, and NT52. Most of the differences are minor (except possibly per-stream filter contexts), and each target is forwards-compatible so the NT35 target is what's distributed in binary form.

Regfs requires at least a XP build environment, even for previous kernel version targets. The NT52 build target is currently broken.

With at least an XP DDK build environment set, change to the source directory and type "build nt35" (or replace nt35 with the version of your test OS.)

Known issues:
-------------
I've been trying to fix the bugs I find, but there are still some that I haven't been able (or had time) to fix (yet).

-Type/echo and redrection in cmd.exe doesn't work
-Win32.RenameFile returns spurious errors, cmd.exe can't rename files
-FCBTable may be using case-insensitive strings (it shouldn't be)
-robocopy.exe sometimes reports corrupted directories
-Platforms prior to 2000 haven't been tested and probably don't work
-There may yet issues with regfs not verifying user mode inputs correctly. One specific case is handling of odd-length UNICODE_STRINGs

Systemic errors that may be unfixable or require ugly hacks to fix:
-The backslash is the ONLY reserved character in key/value names under regfs. Win32 doesn't handle many of NTFS's reserved characters very well.
-Win32 converts any number of contiguous forward slashes into a single backslash during an open operation. Any key/value names that contain forward slashes will be listed but unopenable.
-In the registry, every key value has a type. There is no good analog to this in fileystem standard use (see planned improvements), although regfs does expose them through extended attributes.
-The registry has no file locking, so regfs has no file locking.
-Change notification is not supported.

Planned improvements:
---------------------
-Create a system where a value's type is exposed through a file extension. The main problem is dealing with name collisions.