📄 hid.pas
字号:
//
// Return Value:
// TRUE if successful
// FALSE otherwise -- Use GetLastError() to get extended error information
function HidD_GetNumInputBuffers(HidDeviceObject: THandle;
var NumBufs: Integer): LongBool; stdcall;
// Routine Description:
// This function sets the number of input buffers used by the specified
// file handle to the Hid device. Each file object has a number of buffers
// associated with it to queue reports read from the device but which have
// not yet been read by the user-mode app with a handle to that device.
//
// Arguments:
// HidDeviceObject A handle to a Hid Device Object.
//
// NumberBuffers New number of buffers to use for this file handle to
// the Hid device
//
// Return Value:
// TRUE if successful
// FALSE otherwise -- Use GetLastError() to get extended error information
function HidD_SetNumInputBuffers(HidDeviceObject: THandle;
NumBufs: Integer): LongBool; stdcall;
// Routine Description:
// Given a handle to a valid Hid Class Device Object, retrieve the preparsed
// data for the device. This routine will allocate the appropriately
// sized buffer to hold this preparsed data. It is up to client to call
// HidD_FreePreparsedData to free the memory allocated to this structure when
// it is no longer needed.
//
// Arguments:
// HidDeviceObject A handle to a Hid Device that the client obtains using
// a call to CreateFile on a valid Hid device string name.
// The string name can be obtained using standard PnP calls.
//
// PreparsedData An opaque data structure used by other functions in this
// library to retrieve information about a given device.
//
// Return Value:
// TRUE if successful.
// FALSE otherwise -- Use GetLastError() to get extended error information
function HidD_GetAttributes(HidDeviceObject: THandle;
var HidAttrs: THIDDAttributes): LongBool; stdcall;
// Routine Description:
// This function retrieves the manufacturer string from the specified
// Hid device.
//
// Arguments:
// HidDeviceObject A handle to a Hid Device Object.
//
// Buffer Buffer which on return will contain the manufacturer
// string returned from the device. This string is a
// wide-character string
//
// BufferLength Length of Buffer (in bytes)
//
// Return Value:
// TRUE if successful
// FALSE otherwise -- Use GetLastError() to get extended error information
function HidD_GetManufacturerString(HidDeviceObject: THandle;
Buffer: PWideChar; BufferLength: Integer): LongBool; stdcall;
// Routine Description:
// This function retrieves the product string from the specified
// Hid device.
//
// Arguments:
// HidDeviceObject A handle to a Hid Device Object.
//
// Buffer Buffer which on return will contain the product
// string returned from the device. This string is a
// wide-character string
//
// BufferLength Length of Buffer (in bytes)
//
// Return Value:
// TRUE if successful
// FALSE otherwise -- Use GetLastError() to get extended error information
function HidD_GetProductString(HidDeviceObject: THandle;
Buffer: PWideChar; BufferLength: Integer): LongBool; stdcall;
// Routine Description:
// This function retrieves the serial number string from the specified
// Hid device.
//
// Arguments:
// HidDeviceObject A handle to a Hid Device Object.
//
// Buffer Buffer which on return will contain the serial number
// string returned from the device. This string is a
// wide-character string
//
// BufferLength Length of Buffer (in bytes)
//
// Return Value:
// TRUE if successful
// FALSE otherwise -- Use GetLastError() to get extended error information
function HidD_GetSerialNumberString(HidDeviceObject: THandle;
Buffer: PWideChar; BufferLength: Integer): LongBool; stdcall;
// Routine Description:
// This function retrieves the raw physical descriptor for the specified
// Hid device.
//
// Arguments:
// HidDeviceObject A handle to a Hid Device Object.
//
// Buffer Buffer which on return will contain the physical
// descriptor if one exists for the specified device
// handle
//
// BufferLength Length of buffer (in bytes)
//
// Return Value:
// TRUE if successful
// FALSE otherwise -- Use GetLastError() to get extended error information
function HidD_GetPhysicalDescriptor(HidDeviceObject: THandle;
var Buffer; BufferLength: Integer): LongBool; stdcall;
// Routine Description:
// This function retrieves a string from the specified Hid device that is
// specified with a certain string index.
//
// Arguments:
// HidDeviceObject A handle to a Hid Device Object.
//
// StringIndex Index of the string to retrieve
//
// Buffer Buffer which on return will contain the product
// string returned from the device. This string is a
// wide-character string
//
// BufferLength Length of Buffer (in bytes)
//
// Return Value:
// TRUE if successful
// FALSE otherwise -- Use GetLastError() to get extended error information
function HidD_GetIndexedString(HidDeviceObject: THandle;
Index: Integer; Buffer: PWideChar; BufferLength: Integer): LongBool; stdcall;
// Routine Description:
// Returns a list of capabilities of a given hid device as described by its
// preparsed data.
//
// Arguments:
// PreparsedData The preparsed data returned from HIDCLASS.
// Capabilities a HIDP_CAPS structure
//
// Return Value:
// - HIDP_STATUS_SUCCESS
// - HIDP_STATUS_INVALID_PREPARSED_DATA
{$IFDEF WINXP}
// (rom) new XP functions
function HidD_GetInputReport(HidDeviceObject: THandle;
Buffer: Pointer; BufferLength: ULONG): LongBool; stdcall;
function HidD_SetOutputReport(HidDeviceObject: THandle;
Buffer: Pointer; BufferLength: ULONG): LongBool; stdcall;
{$ENDIF WINXP}
function HidP_GetCaps(PreparsedData: PHIDPPreparsedData;
var Capabilities: THIDPCaps): NTSTATUS; stdcall;
// Routine Description:
// Return a list of PHIDP_LINK_COLLECTION_NODEs used to describe the link
// collection tree of this hid device. See the above description of
// struct _HIDP_LINK_COLLECTION_NODE.
//
// Arguments:
// LinkCollectionNodes - a caller allocated array into which
// HidP_GetLinkCollectionNodes will store the information
//
// LinkCollectionNodesLength - the caller sets this value to the length of the
// the array in terms of number of elements.
// HidP_GetLinkCollectionNodes sets this value to the actual
// number of elements set. The total number of nodes required to
// describe this HID device can be found in the
// NumberLinkCollectionNodes field in the HIDP_CAPS structure.
function HidP_GetLinkCollectionNodes(LinkCollectionNodes: PHIDPLinkCollectionNode;
var LinkCollectionNodesLength: ULONG; PreparsedData: PHIDPPreparsedData): NTSTATUS; stdcall;
function HidP_GetSpecificButtonCaps(ReportType: THIDPReportType;
UsagePage: TUsage; LinkCollection: Word; Usage: TUsage; ButtonCaps: PHIDPButtonCaps;
var ButtonCapsLength: Word; PreparsedData: PHIDPPreparsedData): NTSTATUS; stdcall;
function HidP_GetSpecificValueCaps(ReportType: THIDPReportType; UsagePage: TUsage;
LinkCollection: Word; Usage: TUsage; ValueCaps: PHIDPValueCaps;
var ValueCapsLength: Word; PreparsedData: PHIDPPreparsedData): NTSTATUS; stdcall;
// Routine Description:
//
// Please Note: For obvious reasons HidP_SetData and HidP_GetData will not
// access UsageValueArrays.
//
// Parameters:
// ReportType One of HidP_Input, HidP_Output, or HidP_Feature.
//
// DataList Array of HIDP_DATA structures that will receive the data
// values that are set in the given report
//
// DataLength As input, length in array elements of DataList. As output,
// contains the number of data elements that were successfully
// set by HidP_GetData. The maximum size necessary for DataList
// can be determined by calling HidP_MaxDataListLength
//
// PreparasedData Preparsed data structure returned by HIDCLASS
//
// Report Buffer which to set the data into.
//
// ReportLength Length of Report...Report should be at least as long as the
// value indicated in the HIDP_CAPS structure for the device and
// the corresponding ReportType
//
// Return Value
// HidP_GetData returns the following error codes.
//
// - HIDP_STATUS_SUCCESS -- upon successful retrieval of all data
// from the report packet.
// - HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid.
// - HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
// - HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not equal
// to the length specified in HIDP_CAPS
// structure for the given ReportType
// - HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device
// for the given ReportType
// - HIDP_STATUS_BUFFER_TOO_SMALL -- if there are not enough array entries in
// DataList to store all the indice values
// in the given report. DataLength will
// contain the number of array entries
// required to hold all data
function HidP_GetData(ReportType: THIDPReportType; DataList: PHIDPData;
var DataLength: ULONG; PreparsedData: PHIDPPreparsedData;
var Report; ReportLength: ULONG): NTSTATUS; stdcall;
// Routine Description:
//
// Please Note: Since usage value arrays deal with multiple fields for
// for one usage value, they cannot be used with HidP_SetData
// and HidP_GetData. In this case,
// HIDP_STATUS_IS_USAGE_VALUE_ARRAY will be returned.
//
// Parameters:
//
// ReportType One of HidP_Input, HidP_Output, or HidP_Feature.
//
// DataList Array of HIDP_DATA structures that contains the data values
// that are to be set into the given report
//
// DataLength As input, length in array elements of DataList. As output,
// contains the number of data elements set on successful
// completion or an index into the DataList array to identify
// the faulting HIDP_DATA value if an error code is returned.
//
// PreparasedData Preparsed data structure returned by HIDCLASS
//
// Report Buffer which to set the data into.
//
// ReportLength Length of Report...Report should be at least as long as the
// value indicated in the HIDP_CAPS structure for the device and
// the corresponding ReportType
//
// Return Value
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -