⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vaporcd.h

📁 一个虚拟光驱程序(驱动程序和exe)-VaporCDSource141
💻 H
字号:
/*
    VaporCD CD-ROM Volume Emulation for Windows NT/2000
    Copyright (C) 2000  Brad Johnson

    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; either version 2 of the License, or
    (at your option) any later version.

    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., 675 Mass Ave, Cambridge, MA 02139, USA.

    http://vaporcd.sourceforge.net/

    Brad Johnson
    3305 2nd PL #222
    Lubbock, TX 79415
*/

/*++

Module Name:

    vaporcd.h

Abstract:

    This file includes data declarations for the VaporCD driver for NT.

Author:

    Brad Johnson Auguest 7th 1999

Environment:

    Kernel mode only.

Notes:

Revision History:


--*/

#include "vapver.h"

// Use this so that the file system driver does not mount so we can unload 
// the driver while testing

//#define FILE_DEVICE_VAPORCD FILE_DEVICE_UNKNOWN
#define FILE_DEVICE_VAPORCD FILE_DEVICE_CD_ROM

//#define VAPORCD_UNLOADABLE

#define FILE_FORMAT_VAPOR_CD 0
#define FILE_FORMAT_ISO      1

// this must stay 8 bit ascii
#define VAPORCD_FILE_TAG "VaporCD image file v1.0 Brad Johnson"

//
// Defining private IOCTLs and structures.
//

// this ioctl is not used
#define IOCTL_VAPORCD_GET_DUBUG_LOG CTL_CODE( \
	FILE_DEVICE_CD_ROM, \
	0x801, \
	METHOD_BUFFERED, \
	FILE_ANY_ACCESS )

#define IOCTL_VAPORCD_ADD_DEVICE CTL_CODE( \
	FILE_DEVICE_CD_ROM, \
	0x802, \
	METHOD_BUFFERED, \
	FILE_ANY_ACCESS )

#define IOCTL_VAPORCD_REMOVE_DEVICE CTL_CODE( \
	FILE_DEVICE_CD_ROM, \
	0x803, \
	METHOD_BUFFERED, \
	FILE_ANY_ACCESS )

// Previous version did not support this IOCTL
// V 1.31 was the last version that had no support for it.
#define IOCTL_VAPORCD_GET_VERSION CTL_CODE( \
	FILE_DEVICE_CD_ROM, \
	0x804, \
	METHOD_BUFFERED, \
	FILE_ANY_ACCESS )


typedef struct {     
	WCHAR     wcDriveLetter; 
	WCHAR     szFileName[500]; 
} VAPORCD_ADD_DEVICE;


typedef struct  _VAPORCD_EXTENSION {
    PDEVICE_OBJECT  DeviceObject;
//    PUCHAR          DiskImage;        // drive letter
    UNICODE_STRING  DataFileName;     // file and path name of the source volume
    UNICODE_STRING  Win32NameString;  // name so we can destroy the symbolic link
    ULONG           DataFormat;       // specifies either iso or vaporcd
}   RAMDISK_EXTENSION, *PVAPORCD_EXTENSION;

#define WIN32_PATH              L"\\DosDevices\\"

#if DBG
#define RAMDBUGCHECK            ((ULONG)0x80000000)
#define RAMDDIAG1               ((ULONG)0x00000001)
#define RAMDDIAG2               ((ULONG)0x00000002)
#define RAMDERRORS              ((ULONG)0x00000004)

#define VaporCDDump(LEVEL, STRING) \
        do { \
            if (VaporCDDebugLevel & LEVEL) { \
                DbgPrint STRING; \
            } \
            if (LEVEL == RAMDBUGCHECK) { \
                ASSERT(FALSE); \
            } \
        } while (0)
#else
#define VaporCDDump(LEVEL,STRING) do {NOTHING;} while (0)
#endif


int
sprintf(char *s, const char *format, ...);

//
// Device driver routine declarations.
//

NTSTATUS
DriverEntry(
    IN OUT PDRIVER_OBJECT   DriverObject,
    IN PUNICODE_STRING      RegistryPath
    );

NTSTATUS
VaporCDInitializeVolumes(
    IN PDRIVER_OBJECT       DriverObject,
    IN PUNICODE_STRING      ParamPath,
    IN PUNICODE_STRING      DriveLetterString,
    IN PUNICODE_STRING      ImagePathString, 
	IN BOOLEAN				bDoDiveceInitializing
	);

NTSTATUS
VaporCDCreateClose(
    IN PDEVICE_OBJECT       DeviceObject,
    IN PIRP                 Irp
    );

NTSTATUS
VaporCDDeviceControl(
    IN PDEVICE_OBJECT       DeviceObject,
    IN PIRP                 Irp
    );

NTSTATUS
VaporCDReadWrite(
    IN PDEVICE_OBJECT       DeviceObject,
    IN PIRP                 Irp
    );

VOID
VaporCDUnloadDriver(
    IN PDRIVER_OBJECT       DriverObject
    );


 
VOID VaporCDLogS(char * pMessage);
VOID VaporCDLogSL(char * pMessage,ULONG number);
VOID VaporCDLogWriteString(char * pMessage);
VOID VaporCDLogWriteULong(ULONG ulValue);
NTSTATUS VaporCDReadOffset(PLARGE_INTEGER offset,PVOID dest,ULONG length,
						   PUNICODE_STRING pFileName);





⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -