📄 usb_dll.h
字号:
// USB_DLL.h : USB_DLL DLL 的主头文件
//
#pragma once
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // 主符号
typedef enum _PNP_VETO_TYPE {
PNP_VetoTypeUnknown, // Name is unspecified
PNP_VetoLegacyDevice, // Name is an Instance Path
PNP_VetoPendingClose, // Name is an Instance Path
PNP_VetoWindowsApp, // Name is a Module
PNP_VetoWindowsService, // Name is a Service
PNP_VetoOutstandingOpen, // Name is an Instance Path
PNP_VetoDevice, // Name is an Instance Path
PNP_VetoDriver, // Name is a Driver Service Name
PNP_VetoIllegalDeviceRequest, // Name is an Instance Path
PNP_VetoInsufficientPower, // Name is unspecified
PNP_VetoNonDisableable, // Name is an Instance Path
PNP_VetoLegacyDriver, // Name is a Service
PNP_VetoInsufficientRights // Name is unspecified
} PNP_VETO_TYPE, *PPNP_VETO_TYPE;
#define DN_DISABLEABLE (0x00002000) // Can be rebalanced
#define DN_REMOVABLE (0x00004000) // Can be removed
/////////////////////////////////////////////////////////////////////////////////////
// WinAPI 获取USB硬盘的信息
//
/////////////////////////////////////////////////////////////////////////////////////
#include <dbt.h> // For DeviceChange.
#include <winioctl.h> // For DeviceIOCtl.
#define MAX_LOADSTRING 100
// Add fro USB Task.
// USB letters' container
TCHAR szMoveDiskName[33];
TCHAR szDrvName[33];
BOOL bInitUSBs;
// Drive type names
#define DRVUNKNOWN 0
#define DRVFIXED 1
#define DRVREMOTE 2
#define DRVRAM 3
#define DRVCD 4
#define DRVREMOVE 5
// IOCTL control code
#define IOCTL_STORAGE_QUERY_PROPERTY CTL_CODE(IOCTL_STORAGE_BASE, 0x0500, METHOD_BUFFERED, FILE_ANY_ACCESS)
//// The following structures all can find at MSDN.
// enumeration type specifies the various types of storage buses
// retrieve the storage device descriptor data for a device.
typedef struct _STORAGE_DEVICE_DESCRIPTOR {
ULONG Version;
ULONG Size;
UCHAR DeviceType;
UCHAR DeviceTypeModifier;
BOOLEAN RemovableMedia;
BOOLEAN CommandQueueing;
ULONG VendorIdOffset;
ULONG ProductIdOffset;
ULONG ProductRevisionOffset;
ULONG SerialNumberOffset;
STORAGE_BUS_TYPE BusType;
ULONG RawPropertiesLength;
UCHAR RawDeviceProperties[1];
} STORAGE_DEVICE_DESCRIPTOR, *PSTORAGE_DEVICE_DESCRIPTOR;
// retrieve the properties of a storage device or adapter.
typedef enum _STORAGE_QUERY_TYPE {
PropertyStandardQuery = 0,
PropertyExistsQuery,
PropertyMaskQuery,
PropertyQueryMaxDefined
} STORAGE_QUERY_TYPE, *PSTORAGE_QUERY_TYPE;
// retrieve the properties of a storage device or adapter.
typedef enum _STORAGE_PROPERTY_ID {
StorageDeviceProperty = 0,
StorageAdapterProperty,
StorageDeviceIdProperty
} STORAGE_PROPERTY_ID, *PSTORAGE_PROPERTY_ID;
// retrieve the properties of a storage device or adapter.
typedef struct _STORAGE_PROPERTY_QUERY {
STORAGE_PROPERTY_ID PropertyId;
STORAGE_QUERY_TYPE QueryType;
UCHAR AdditionalParameters[1];
} STORAGE_PROPERTY_QUERY, *PSTORAGE_PROPERTY_QUERY;
////////////////////////////////////////////////////////////////////////////////////
// CUSB_DLLApp
// 有关此类实现的信息,请参阅 USB_DLL.cpp
//
BOOL GetDiskGeometry(HANDLE hDisk, PDISK_GEOMETRY lpGeometry);
bool LowLevelFormatTracks(HANDLE hDisk, PDISK_GEOMETRY lpGeometry, DWORD dwStartCylinder, DWORD dwCylinderNumber);
class CUSB_DLLApp : public CWinApp
{
public:
CUSB_DLLApp();
/*__declspec(dllexport) BOOL DelDriA(DWORD tt);
BOOL FindDriv(DWORD *p);
__declspec(dllexport) BOOL GetDriv(DWORD *k[]);*/
// 重写
public:
virtual BOOL InitInstance();
DECLARE_MESSAGE_MAP()
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -