📄 ramdisk.h
字号:
//=============================================================================
//
// Compuware Corporation
// NuMega Lab
// 9 Townsend West
// Nashua, NH 03060 USA
//
// Copyright (c) 1998 Compuware Corporation. All Rights Reserved.
// Unpublished - rights reserved under the Copyright laws of the
// United States.
//
//=============================================================================
// RAMDISK.H - include file for the Registry File System driver
// Copyright (c) 1996 Compuware Corporation
#include <vtoolsc.h>
#include <ddb.h>
/////////////////////////////////////////////////////////////////////
// Constants
// Constants required by the VtoolsD framework
#define RAMDISK_Major 1
#define RAMDISK_Minor 0
#define RAMDISK_DeviceID UNDEFINED_DEVICE_ID
#define RAMDISK_Init_Order UNDEFINED_INIT_ORDER
// Constants for the Device Registration Packet
#define RAMDISK_NAME "RAMDISK "
#define RAMDISK_REV 1
#define RAMDISK_FEATURE 0
#define RAMDISK_IFR 0
#define DISKSIZE 3*1024*1024
// Size of the buffer used to read in value data
#define READBUFSIZE 512
// Macro to define the byte offset from the start of an IOP to the
// start of the embedded IOR. Assumes no IOP extension.
//#define IORDELTA ((ULONG)(&((IOP*)0)->IOP_ior))
// Special value to denote the real root of the Registry, i.e., the
// implied root below the six predefined roots.
//#define REGISTRY_ROOT 0xffffffff
/*
// Macros for debugging
#ifdef DEBUG
// Display the string s and variable t
#define fsdtrace(s, t) dprintf("%s: pir=%x\n", s, t)
// Force a heap walk (use in conjunction with .m? command in debugger)
#define ForceHeapWalk(s) free(malloc(1));dprintf(s);DebugBreak()
#else // non-debug versions are empty
#define fsdtrace(s, t)
#define ForceHeapWalk(s)
#endif
*/
/////////////////////////////////////////////////////////////////////
// Types
typedef struct tagBPB
{ // BIOS parameter block
WORD secsize; // 00 sector size
BYTE clustsize; // 02 cluster size (in sectors)
WORD numrsv; // 03 # reserved sectors
BYTE numfat; // 05 # FATs
WORD numfiles; // 06 # entries in root directory
WORD numsectors; // 08 # sectors on disk
BYTE media; // 0A media descriptor
WORD fatsectors; // 0B # sectors in each FAT
} BPB, *PBPB; // BIOS parameter block [0D]
typedef struct tagPARTITION
{ // partition record
BYTE indicator; // 00 boot indicator (80 = active partition)
BYTE starthead; // 01 start head
BYTE startsec; // 02 bits 0-5: start sector, bits 6-7: bits 8-9 of start track
BYTE starttrack; // 03 bits 0-7 of start track
BYTE parttype; // 04 partition type
BYTE endhead; // 05 end head
BYTE endsec; // 06 end sector
BYTE endtrack; // 07 end track
DWORD bias; // 08 sector bias to start of partition
DWORD partsize; // 0C partition size in sectors
} PARTITION, *PPARTITION;
typedef struct tagBOOTSECT
{ // boot sector
BYTE jmpinst[3]; // 00 JMP to boot code
char vendid[8]; // 03 vendor id
struct tagBPB; // 0B bios parameter block
WORD tracksectors; // 18 # sectors per track
WORD numtracks; // 1A # heads (tracks)
DWORD numhidden; // 1C # hidden sectors
DWORD totsectors; // 20 # sectors if disk > 32 MB
BYTE drive; // 24 physical drive #
BYTE rsv1; // 25 reserved
BYTE xboot; // 26 extended boot signature (29h)
DWORD volid; // 27 volume ID
char label[11]; // 2B volume label
char fattype[8]; // 36 FAT12 or FAT16 plus 3 spaces
BYTE junk[384]; // 3E other stuff, including bootstrap loader
PARTITION part[4]; // 1BE partition table
WORD signature; // 1FE signature (0xAA55)
} BOOTSECT, *PBOOTSECT; // boot sector [200]
/*
//the structure of the direct_entry.
typedef struct _DIR_ENTRY
{
UCHAR deName[8]; // File Name
UCHAR deExtension[3]; // File Extension
UCHAR deAttributes; // File Attributes
UCHAR deReserved; // Reserved
USHORT deTime; // File Time
USHORT deDate; // File Date
USHORT deStartCluster; // First Cluster of file
ULONG deFileSize; // File Length
}DIR_ENTRY, *PDIR_ENTRY;
*/
/*
// Declare the device parameters structure. This is defined by DOS,
// and used for IOCTL calls.
typedef struct tagDeviceParams
{
BYTE dpSpecFunc;
BYTE dpDevType;
WORD dpDevAttr;
WORD dpCylinders;
BYTE dpMediaType;
WORD dpBytesPerSector;
BYTE dpSectorsPerCluster;
WORD dpReservedSectors;
BYTE dpFATs;
WORD dpRootDirectoryEntries;
WORD dpSectors;
BYTE dpMedia;
WORD dpSectorsPerFAT;
WORD dpSectorsPerTrack;
WORD dpHeads;
DWORD dpHiddenSectors;
DWORD dpHugeSectors;
} DEVICEPARAMS, *PDEVICEPARAMS;
*/
/*
// Declare the media ID structure. This is defined by DOS, and used
// for IOCTL calls.
typedef struct tagMediaID
{
WORD midInfoLevel;
DWORD midSerialNum;
CHAR midVolLable[11];
CHAR midFileSysType[8];
} MEDIAID, *PMEDIAID;
*/
/*
// RAMDISK private handle structure for FindFirst/FindNext operations
typedef struct _findcontext
{
ULONG fc_sig; // must be SIGFIND
HKEY fc_hkey; // registry key
HKEY fc_index; // subkey index
PWORD fc_match; // meta match specification
BOOL fc_bKeysDone; // TRUE if all keys enumerated
} FINDCONTEXT, *PFINDCONTEXT;
*/
/*
// RAMDISK private handle structure for Open File operations
typedef struct _regfsdhandle
{
ULONG h_sig; // must be SIGFILE
HKEY h_key; // registry KEY
PCHAR h_value; // value name
ULONG h_size; // value size
ULONG h_pos; // current position
} RAMDISKHANDLE, *PRAMDISKHANDLE;
*/
/*
typedef struct _USBDDB
{
IOSDDB Ddb;
// DWORD Signature;
// DWORD Fdo;
DWORD Flags;
// DWORD Dcb1;
// DWORD Dcb2;
// BYTE Cdb[12];
// IOPACKET IoPacket;
}USBDDB, *PUSBDDB;
*/
/*
// Structure used by debug routines to associate strings to constants
typedef struct _name_assoc
{
BYTE _func;
const char* _name;
} NAMETABLE;
*/
/////////////////////////////////////////////////////////////////////
// Function prototypes
//INT RegMountVolume(pioreq pir);
VOID __cdecl RAMDISK_RequestHandler(IOP* pIop);
VOID SetupDCB(DCB* pDcb);
//BYTE AssociateDriveLetter(DCB_COMMON* pDcb);
/////////////////////////////////////////////////////////////////////
// Global data
// Assigned drive letter designator (0=A)
//extern BYTE Drive;
// Pointer the drive's physical DCB
//extern DCB* pDcbOfThisDevice;
// Array of names of the six predefined Registry root keys
//extern PCHAR PredefinedRegKeyStrings[NPREDEFKEYS];
// Array of values of the six predefined Registry root keys
//extern INT PredefinedRegKeyValues[NPREDEFKEYS];
// The volume handle passed to the mount routine
//extern VRP* VolumeHandle;
// The driver's IOS linkage block
extern ILB RAMDISK_Ilb;
extern char base[DISKSIZE];
extern IOSDDB* pDDB;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -