www.pudn.com > PGP 8.0.2 Source Code for Windows.rar > UConstantNamesDrvNT.cpp, change:2002-08-06,size:8479b


/*____________________________________________________________________________ 
		Copyright (C) 2002 PGP Corporation 
        All rights reserved. 
 
        $Id: UConstantNamesDrvNT.cpp,v 1.4 2002/08/06 20:09:32 dallen Exp $ 
____________________________________________________________________________*/ 
 
#include "pgpClassesConfig.h" 
 
#include <devioctl.h> 
#include <ntdddisk.h> 
 
#if	(_WIN32_WINNT >= 0x0500) 
#include <mountdev.h> 
#endif	// _WIN32_WINNT >= 0x5000 
 
#include "UConstantNamesDrvNT.h" 
 
_USING_PGP 
 
// Added by wjb for Windows XP.  
// These are selected snippets from the XP DDK 
#ifndef IOCTL_DISK_GET_LENGTH_INFO 
 
#define FTTYPE  ((ULONG)'f') 
#define IOCTL_VOLUME_BASE   ((ULONG) 'V') 
 
#define IOCTL_DISK_GET_LENGTH_INFO          CTL_CODE(IOCTL_DISK_BASE, 0x0017, METHOD_BUFFERED, FILE_READ_ACCESS) 
#define IOCTL_DISK_GET_PARTITION_INFO_EX    CTL_CODE(IOCTL_DISK_BASE, 0x0012, METHOD_BUFFERED, FILE_ANY_ACCESS) 
#define IOCTL_STORAGE_GET_HOTPLUG_INFO		CTL_CODE(IOCTL_STORAGE_BASE, 0x0305, METHOD_BUFFERED, FILE_ANY_ACCESS) 
#define FT_BALANCED_READ_MODE				CTL_CODE(FTTYPE, 6, METHOD_NEITHER,  FILE_ANY_ACCESS) 
#define IOCTL_VOLUME_GET_GPT_ATTRIBUTES		CTL_CODE(IOCTL_VOLUME_BASE, 14, METHOD_BUFFERED, FILE_ANY_ACCESS) 
#define IOCTL_VOLUME_ONLINE					CTL_CODE(IOCTL_VOLUME_BASE, 2, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) 
#define IOCTL_MOUNTDEV_QUERY_STABLE_GUID	CTL_CODE(MOUNTDEVCONTROLTYPE, 6, METHOD_BUFFERED, FILE_ANY_ACCESS) 
#define IOCTL_STORAGE_GET_DEVICE_NUMBER		CTL_CODE(IOCTL_STORAGE_BASE, 0x0420, METHOD_BUFFERED, FILE_ANY_ACCESS) 
 
#endif // IOCTL_DISK_GET_LENGTH_INFO 
// End wjb 
 
// Class UConstantNamesDrvNT variables 
 
const UConstantNamesDrvNT::ConstantName  
	UConstantNamesDrvNT::mIrpMajorFuncs[] = 
{ 
	{IRP_MJ_CREATE,						"IRP_MJ_CREATE"},  
	{IRP_MJ_CREATE_NAMED_PIPE,			"IRP_MJ_CREATE_NAMED_PIPE"},  
	{IRP_MJ_CLOSE,						"IRP_MJ_CLOSE"},  
	{IRP_MJ_READ,						"IRP_MJ_READ"},  
	{IRP_MJ_WRITE,						"IRP_MJ_WRITE"},  
	{IRP_MJ_QUERY_INFORMATION,			"IRP_MJ_QUERY_INFORMATION"},  
	{IRP_MJ_SET_INFORMATION,			"IRP_MJ_SET_INFORMATION"},  
	{IRP_MJ_QUERY_EA,					"IRP_MJ_QUERY_EA"},  
	{IRP_MJ_SET_EA,						"IRP_MJ_SET_EA"},  
	{IRP_MJ_FLUSH_BUFFERS,				"IRP_MJ_FLUSH_BUFFERS"},  
	{IRP_MJ_QUERY_VOLUME_INFORMATION,	"IRP_MJ_QUERY_VOLUME_INFORMATION"},  
	{IRP_MJ_SET_VOLUME_INFORMATION,		"IRP_MJ_SET_VOLUME_INFORMATION"},  
	{IRP_MJ_DIRECTORY_CONTROL,			"IRP_MJ_DIRECTORY_CONTROL"},  
	{IRP_MJ_FILE_SYSTEM_CONTROL,		"IRP_MJ_FILE_SYSTEM_CONTROL"},  
	{IRP_MJ_DEVICE_CONTROL,				"IRP_MJ_DEVICE_CONTROL"},  
	{IRP_MJ_INTERNAL_DEVICE_CONTROL,	"IRP_MJ_INTERNAL_DEVICE_CONTROL"},  
	{IRP_MJ_SHUTDOWN,					"IRP_MJ_SHUTDOWN"},  
	{IRP_MJ_LOCK_CONTROL,				"IRP_MJ_LOCK_CONTROL"},  
	{IRP_MJ_CLEANUP,					"IRP_MJ_CLEANUP"},  
	{IRP_MJ_CREATE_MAILSLOT,			"IRP_MJ_CREATE_MAILSLOT"},  
	{IRP_MJ_QUERY_SECURITY,				"IRP_MJ_QUERY_SECURITY"},  
	{IRP_MJ_SET_SECURITY,				"IRP_MJ_SET_SECURITY"},  
 
#if	(_WIN32_WINNT >= 0x0500) 
	{IRP_MJ_POWER,						"IRP_MJ_POWER"},  
	{IRP_MJ_SYSTEM_CONTROL,				"IRP_MJ_SYSTEM_CONTROL"},  
	{IRP_MJ_DEVICE_CHANGE,				"IRP_MJ_DEVICE_CHANGE"},  
	{IRP_MJ_QUERY_QUOTA,				"IRP_MJ_QUERY_QUOTA"},  
	{IRP_MJ_SET_QUOTA,					"IRP_MJ_SET_QUOTA"},  
	{IRP_MJ_PNP,						"IRP_MJ_PNP"} 
#endif	// _WIN32_WINNT >= 0x5000 
}; 
 
const UConstantNamesDrvNT::ConstantName  
	UConstantNamesDrvNT::mIoctlCodes[] = 
{ 
	{IOCTL_DISK_GET_DRIVE_GEOMETRY,		"IOCTL_DISK_GET_DRIVE_GEOMETRY"},  
	{IOCTL_DISK_GET_PARTITION_INFO,		"IOCTL_DISK_GET_PARTITION_INFO"},  
	{IOCTL_DISK_SET_PARTITION_INFO,		"IOCTL_DISK_SET_PARTITION_INFO"},  
	{IOCTL_DISK_GET_DRIVE_LAYOUT,		"IOCTL_DISK_GET_DRIVE_LAYOUT"},  
	{IOCTL_DISK_SET_DRIVE_LAYOUT,		"IOCTL_DISK_SET_DRIVE_LAYOUT"},  
	{IOCTL_DISK_VERIFY,					"IOCTL_DISK_VERIFY"},  
	{IOCTL_DISK_FORMAT_TRACKS,			"IOCTL_DISK_FORMAT_TRACKS"},  
	{IOCTL_DISK_REASSIGN_BLOCKS,		"IOCTL_DISK_REASSIGN_BLOCKS"},  
	{IOCTL_DISK_PERFORMANCE,			"IOCTL_DISK_PERFORMANCE"},  
	{IOCTL_DISK_IS_WRITABLE,			"IOCTL_DISK_IS_WRITABLE"},  
	{IOCTL_DISK_LOGGING,				"IOCTL_DISK_LOGGING"},  
	{IOCTL_DISK_FORMAT_TRACKS_EX,		"IOCTL_DISK_FORMAT_TRACKS_EX"},  
	{IOCTL_DISK_HISTOGRAM_STRUCTURE,	"IOCTL_DISK_HISTOGRAM_STRUCTURE"},  
	{IOCTL_DISK_HISTOGRAM_DATA,			"IOCTL_DISK_HISTOGRAM_DATA"},  
	{IOCTL_DISK_HISTOGRAM_RESET,		"IOCTL_DISK_HISTOGRAM_RESET"},  
	{IOCTL_DISK_REQUEST_STRUCTURE,		"IOCTL_DISK_REQUEST_STRUCTURE"},  
	{IOCTL_DISK_REQUEST_DATA,			"IOCTL_DISK_REQUEST_DATA"},  
	{IOCTL_DISK_CONTROLLER_NUMBER,		"IOCTL_DISK_CONTROLLER_NUMBER"},  
 
	{SMART_GET_VERSION,					"SMART_GET_VERSION"},  
	{SMART_SEND_DRIVE_COMMAND,			"SMART_SEND_DRIVE_COMMAND"},  
	{SMART_RCV_DRIVE_DATA,				"SMART_RCV_DRIVE_DATA"},  
 
#if	(_WIN32_WINNT >= 0x0500) 
 
// Added by wjb for Windows XP.  
	{IOCTL_DISK_GET_LENGTH_INFO,		"WINXP ****** IOCTL_DISK_GET_LENGTH_INFO (supported)"},  
	{IOCTL_DISK_GET_PARTITION_INFO_EX,	"WINXP ****** IOCTL_DISK_GET_PARTITION_INFO_EX"},  
	{IOCTL_STORAGE_GET_HOTPLUG_INFO,	"WINXP ****** IOCTL_STORAGE_GET_HOTPLUG_INFO"},  
	{IOCTL_STORAGE_GET_DEVICE_NUMBER,	"WINXP ****** IOCTL_STORAGE_GET_DEVICE_NUMBER"},  
	{FT_BALANCED_READ_MODE,				"WINXP ****** FT_BALANCED_READ_MODE"},  
	{IOCTL_VOLUME_GET_GPT_ATTRIBUTES,	"WINXP ****** IOCTL_VOLUME_GET_GPT_ATTRIBUTES"},  
	{IOCTL_VOLUME_ONLINE,				"WINXP ****** IOCTL_VOLUME_ONLINE"},  
	{IOCTL_MOUNTDEV_QUERY_STABLE_GUID,	"WINXP ****** IOCTL_MOUNTDEV_QUERY_STABLE_GUID"},  
// End wjb 
 
	{IOCTL_DISK_UPDATE_DRIVE_SIZE,		"IOCTL_DISK_UPDATE_DRIVE_SIZE"},  
	{IOCTL_DISK_GROW_PARTITION,			"IOCTL_DISK_GROW_PARTITION"},  
	{IOCTL_DISK_GET_CACHE_INFORMATION,	"IOCTL_DISK_GET_CACHE_INFORMATION"},  
	{IOCTL_DISK_SET_CACHE_INFORMATION,	"IOCTL_DISK_SET_CACHE_INFORMATION"},  
	{IOCTL_DISK_DELETE_DRIVE_LAYOUT,	"IOCTL_DISK_INTERNAL_SET_VERIFY"},  
	{IOCTL_DISK_FORMAT_DRIVE,			"IOCTL_DISK_FORMAT_DRIVE"},  
	{IOCTL_DISK_SENSE_DEVICE,			"IOCTL_DISK_SENSE_DEVICE"},  
 
	{IOCTL_DISK_INTERNAL_SET_VERIFY,	"IOCTL_DISK_INTERNAL_SET_VERIFY"},  
	{IOCTL_DISK_INTERNAL_CLEAR_VERIFY,	"IOCTL_DISK_INTERNAL_CLEAR_VERIFY"},  
	{IOCTL_DISK_INTERNAL_SET_NOTIFY,	"IOCTL_DISK_INTERNAL_SET_NOTIFY"},  
 
#endif	// _WIN32_WINNT >= 0x5000 
 
	{IOCTL_DISK_CHECK_VERIFY,			"IOCTL_DISK_CHECK_VERIFY"},  
	{IOCTL_DISK_MEDIA_REMOVAL,			"IOCTL_DISK_MEDIA_REMOVAL"},  
	{IOCTL_DISK_EJECT_MEDIA,			"IOCTL_DISK_EJECT_MEDIA"},  
	{IOCTL_DISK_LOAD_MEDIA,				"IOCTL_DISK_LOAD_MEDIA"},  
	{IOCTL_DISK_RESERVE,				"IOCTL_DISK_RESERVE"},  
	{IOCTL_DISK_RELEASE,				"IOCTL_DISK_RELEASE"},  
	{IOCTL_DISK_FIND_NEW_DEVICES,		"IOCTL_DISK_FIND_NEW_DEVICES"},  
	{IOCTL_DISK_GET_MEDIA_TYPES,		"IOCTL_DISK_GET_MEDIA_TYPES"},  
 
#if	(_WIN32_WINNT >= 0x0500) 
 
	{IOCTL_MOUNTDEV_QUERY_DEVICE_NAME, "IOCTL_MOUNTDEV_QUERY_DEVICE_NAME"},  
	{IOCTL_MOUNTDEV_QUERY_UNIQUE_ID,	"IOCTL_MOUNTDEV_QUERY_UNIQUE_ID"},  
 
	{IOCTL_MOUNTDEV_UNIQUE_ID_CHANGE_NOTIFY,  
		"IOCTL_MOUNTDEV_UNIQUE_ID_CHANGE_NOTIFY"},  
 
	{IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME,  
		"IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME"},  
 
	{IOCTL_MOUNTDEV_LINK_CREATED,		"IOCTL_MOUNTDEV_LINK_CREATED"},  
	{IOCTL_MOUNTDEV_LINK_DELETED,		"IOCTL_MOUNTDEV_LINK_DELETED"},  
 
#endif	// _WIN32_WINNT >= 0x5000 
 
	{IOCTL_DISK_GET_MEDIA_TYPES,		"IOCTL_DISK_GET_MEDIA_TYPES"},  
	{IOCTL_DISK_GET_MEDIA_TYPES,		"IOCTL_DISK_GET_MEDIA_TYPES"},  
	{IOCTL_DISK_GET_MEDIA_TYPES,		"IOCTL_DISK_GET_MEDIA_TYPES"},  
	{IOCTL_DISK_GET_MEDIA_TYPES,		"IOCTL_DISK_GET_MEDIA_TYPES"},  
	{IOCTL_DISK_GET_MEDIA_TYPES,		"IOCTL_DISK_GET_MEDIA_TYPES"},  
	{IOCTL_DISK_GET_MEDIA_TYPES,		"IOCTL_DISK_GET_MEDIA_TYPES"},  
 
	{IOCTL_STORAGE_CHECK_VERIFY,		"IOCTL_STORAGE_CHECK_VERIFY"},  
	{IOCTL_STORAGE_MEDIA_REMOVAL,		"IOCTL_STORAGE_MEDIA_REMOVAL"},  
	{IOCTL_STORAGE_EJECT_MEDIA,			"IOCTL_STORAGE_EJECT_MEDIA"},  
	{IOCTL_STORAGE_LOAD_MEDIA,			"IOCTL_STORAGE_LOAD_MEDIA"},  
	{IOCTL_STORAGE_RESERVE,				"IOCTL_STORAGE_RESERVE"},  
	{IOCTL_STORAGE_RELEASE,				"IOCTL_STORAGE_RELEASE"},  
	{IOCTL_STORAGE_FIND_NEW_DEVICES,	"IOCTL_STORAGE_FIND_NEW_DEVICES"},  
	{IOCTL_STORAGE_GET_MEDIA_TYPES,		"IOCTL_STORAGE_GET_MEDIA_TYPES"} 
}; 
 
 
// Class UConstantNamesDrvNT member functions 
 
const char *  
UConstantNamesDrvNT::NameIrpMajorFunction(PGPUInt32 irpMajorFunc) 
{ 
	return GetName(mIrpMajorFuncs,  
		sizeof(mIrpMajorFuncs) / sizeof(ConstantName), irpMajorFunc); 
} 
 
const char *  
UConstantNamesDrvNT::NameIoctlCode(PGPUInt32 ioctlCode) 
{ 
	return GetName(mIoctlCodes,  
		sizeof(mIoctlCodes) / sizeof(ConstantName), ioctlCode); 
}