Function TDMUSB.GetPipeInfo(strDriver: String;pi :USBDInterfaceInformationType):integer;
//其中
{
USBDInterfaceInformationType=record
iLength :Integer;
bInterfaceNumber : Byte;
bAlternateSetting : Byte;
bClass : Byte;
bSubClass : Byte;
bProtocol : Byte;
bReserved : Byte;
lInterfaceHandle : Longint;
lNumberOfPipes :Longint;
Pipes:array[0..15] of USBDPipeInformationType;
End;
}
var
hDriverHandle : Longint;
lBytesReturned :Longint;
pb:pinteger;
begin
Result:=0;
hDriverHandle := OpenDriver(strDriver);//取得端口句柄 If hDriverHandle > 0 Then
begin
pb:=@lBytesReturned;
if DeviceIoControl(hDriverHandle,
IOCTL_Ezusb_GET_PIPE_INFO,
@pi,
sizeof(pi),
@pi,
sizeof(pi),
pb,//在此处出错代码为:
//Types of actual and formal var parameters must bi identical
nil) then Result:=1
else Result:=0;
CloseHandle (hDriverHandle);//关闭
End;
End;其中:
IOCTL_Ezusb_GET_PIPE_INFO=$220000 + METHOD_BUFFERED + (Ezusb_IOCTL_INDEX + 0) * 4;
METHOD_BUFFERED = 0;
Ezusb_IOCTL_INDEX = $800;谁能帮我改错:Up者有分
//其中
{
USBDInterfaceInformationType=record
iLength :Integer;
bInterfaceNumber : Byte;
bAlternateSetting : Byte;
bClass : Byte;
bSubClass : Byte;
bProtocol : Byte;
bReserved : Byte;
lInterfaceHandle : Longint;
lNumberOfPipes :Longint;
Pipes:array[0..15] of USBDPipeInformationType;
End;
}
var
hDriverHandle : Longint;
lBytesReturned :Longint;
pb:pinteger;
begin
Result:=0;
hDriverHandle := OpenDriver(strDriver);//取得端口句柄 If hDriverHandle > 0 Then
begin
pb:=@lBytesReturned;
if DeviceIoControl(hDriverHandle,
IOCTL_Ezusb_GET_PIPE_INFO,
@pi,
sizeof(pi),
@pi,
sizeof(pi),
pb,//在此处出错代码为:
//Types of actual and formal var parameters must bi identical
nil) then Result:=1
else Result:=0;
CloseHandle (hDriverHandle);//关闭
End;
End;其中:
IOCTL_Ezusb_GET_PIPE_INFO=$220000 + METHOD_BUFFERED + (Ezusb_IOCTL_INDEX + 0) * 4;
METHOD_BUFFERED = 0;
Ezusb_IOCTL_INDEX = $800;谁能帮我改错:Up者有分
begin
pb:=@lBytesReturned;
if DeviceIoControl(hDriverHandle,
IOCTL_Ezusb_GET_PIPE_INFO,
@pi,
sizeof(pi),
@pi,
sizeof(pi),
@lBytesReturned,//pb改成这个看看。
nil) then Result:=1
else Result:=0;
CloseHandle (hDriverHandle);//关闭
End;
End;