Вверх ↑
Ответов: 233
Рейтинг: 12
#1: 2021-09-30 14:53:58 ЛС | профиль | цитата
Помогите пожалуйста с InlineCode или направьте в нужное русло... бьюсь уже 3 дня


Add(InlineCode,16713883,581,203)
{
WorkPoints=#29:DoWork=Проверить скорость USB|
EventPoints=#26:EndWork=Результат проверки|
Code=#15:unit HiAsmUnit;|0:|9:interface|0:|29:uses kol,Share,Debug,Windows;|0:|4:type|32: USB_DEVICE_SPEED=(UsbLowSpeed,|33: UsbFullSpeed,|33: UsbHighSpeed,|35: UsbSuperSpeed);|0:|44: USB_CONNECTION_STATUS=(NoDeviceConnected,|41: DeviceConnected,|49: DeviceFailedEnumeration,|46: DeviceGeneralFailure,|49: DeviceCausedOvercurrent,|46: DeviceNotEnoughPower,|50: DeviceNotEnoughBandwidth,|50: DeviceHubNestedTooDeeply,|43: DeviceInLegacyHub,|43: DeviceEnumerating,|38: DeviceReset);|0:|40: SP_DEVICE_INTERFACE_DATA=packed record|53: cbSize: dword;|53: InterfaceClassGuid: TGUID;|53: Flags: dword;|55: Reserved: pointer;|31: end;|2: |54: PSP_DEVICE_INTERFACE_DATA=^SP_DEVICE_INTERFACE_DATA;|0:|49: SP_DEVICE_INTERFACE_DETAIL_DATA_W=packed record|54: cbSize: dword;|72: DevicePath: array[0..0] of WideChar;|40: end;|0:|72: PSP_DEVICE_INTERFACE_DETAIL_DATA_W=^SP_DEVICE_INTERFACE_DETAIL_DATA_W;|2: |31: SP_DEVINFO_DATA=packed record|35: cbSize: dword;|35: ClassGuid: TGUID;|35: DevInst: dword;|37: Reserved: pointer;|22: end;|0:|36: PSP_DEVINFO_DATA=^SP_DEVINFO_DATA;|0:|37: USB_DEVICE_DESCRIPTOR=packed record|49: bLength: byte;|49: bDescriptorType: byte;|49: bcdUSB: word;|49: bDeviceClass: byte;|49: bDeviceSubClass: byte;|49: bDeviceProtocol: byte;|49: bMaxPacketSize0: byte;|49: idVendor: word;|49: idProduct: word;|49: bcdDevice: word;|49: iManufacturer: byte;|49: iProduct: byte;|49: iSerialNumber: byte;|49: bNumConfigurations: byte;|28: end;|0:|39: USB_ENDPOINT_DESCRIPTOR=packed record|49: bLength: byte;|49: bDescriptorType: byte;|49: bEndpointAddress: byte;|49: bmAttributes: byte;|49: wMaxPacketSize: word;|49: bInterval: byte;|30: end;|0:|29: USB_PIPE_INFO=packed record|60: EndpointDescriptor: USB_ENDPOINT_DESCRIPTOR;|45: ScheduleOffset: Cardinal;|20: end;|0:|50: USB_NODE_CONNECTION_INFORMATION_EX=packed record|73: ConnectionIndex: Cardinal;|86: DeviceDescriptor: USB_DEVICE_DESCRIPTOR;|69: CurrentConfigurationValue: byte;|69: Speed: byte;|72: DeviceIsHub: boolean;|69: DeviceAddress: word;|73: NumberOfOpenPipes: Cardinal;|86: ConnectionStatus: USB_CONNECTION_STATUS;|93: PipeList: array[0..0] of USB_PIPE_INFO;|41: end;|0:|38: USB_DESCRIPTOR_REQUEST=packed record|51: ConnectionIndex: Cardinal;|47: bmRequest: byte;|47: bRequest: byte;|47: wValue: word;|47: wIndex: word;|47: wLength: word;|47: length: byte;|47: DescriptorType: byte;|69: Data: array[0..2047] of WideChar;|29: end;|0:|5:const|18: DIGCF_PRESENT=2;|27: DIGCF_DEVICEINTERFACE=16;|78: GUID_DEVINTERFACE_USB_HUB: TGUID = '{F18A0E88-C30C-11D0-8815-00A0C906BED8}';|22: FILE_DEVICE_USB=$22;|20: FILE_ANY_ACCESS=0;|46: USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION=260;|45: USB_GET_NODE_CONNECTION_INFORMATION_EX=274;|20: METHOD_BUFFERED=0;|31: USB_STRING_DESCRIPTOR_TYPE=3;|160: IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX=(FILE_DEVICE_USB shl 16)+(FILE_ANY_ACCESS shl 14)+(USB_GET_NODE_CONNECTION_INFORMATION_EX shl 2)+METHOD_BUFFERED;|162: IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION=(FILE_DEVICE_USB shl 16)+(FILE_ANY_ACCESS shl 14)+(USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION shl 2)+METHOD_BUFFERED;|0:|4:type|28: THiAsmClass = class(TDebug)|0:|10: private|28: |9: public|3: |21: EndWork:THI_Event;|0:|49: procedure DoWork(var _Data:TData; Index:word);|0:|5: end;|0:|315: function SetupDiGetDeviceInterfaceDetailW(DeviceInfoSet: LongInt; DeviceInterfaceData: PSP_DEVICE_INTERFACE_DATA; DeviceInterfaceDetailData: PSP_DEVICE_INTERFACE_DETAIL_DATA_W; DeviceInterfaceDetailDataSize: dword; RequiredSize: Pdword; DeviceInfoData: PSP_DEVINFO_DATA): LongBool;stdcall;external 'setupapi.dll';|149: function SetupDiGetClassDevsW(ClassGuid: PGUID; Enumerator: PWideChar; hwndParent: LongInt; Flags: dword): LongInt;stdcall;external 'setupapi.dll';|234: function SetupDiEnumDeviceInterfaces(DeviceInfoSet: LongInt; DeviceInfoData: PSP_DEVINFO_DATA; InterfaceClassGuid: PGUID; MemberIndex: dword; DeviceInterfaceData: PSP_DEVICE_INTERFACE_DATA): LongBool;stdcall;external 'setupapi.dll';|0:|0:|14:implementation|0:|29:procedure THiAsmClass.DoWork;|0:|3:var|36: len: Cardinal;|35: DevInfoSet,i,j,f,stdout: LongInt;|95: DevInterface: SP_DEVICE_INTERFACE_DATA=(cbSize: sizeof(SP_DEVICE_INTERFACE_DATA));|54: DevIntDetail: array[0..2047] of WideChar;|62: ConInfo: USB_NODE_CONNECTION_INFORMATION_EX;|95: Request: USB_DESCRIPTOR_REQUEST=(wIndex: 1033;wLength: sizeof(Request.Data));|0:|5:begin|43: stdout:=GetStdHandle( STD_OUTPUT_HANDLE);|103: DevInfoSet:=SetupDiGetClassDevsW(@GUID_DEVINTERFACE_USB_HUB,0,0,DIGCF_PRESENT+DIGCF_DEVICEINTERFACE);|7: i:=0;|95: while SetupDiEnumDeviceInterfaces(DevInfoSet,0,@GUID_DEVINTERFACE_USB_HUB,i,@DevInterface) do|7: begin|70: pdword(@DevIntDetail)^:=sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W);|103: SetupDiGetDeviceInterfaceDetailW(DevInfoSet,@DevInterface,@DevIntDetail,sizeof(DevIntDetail),@f,0);|117: f:=CreateFileW(@DevIntDetail[2],GENERIC_WRITE+GENERIC_READ,FILE_SHARE_WRITE+FILE_SHARE_READ,0,OPEN_EXISTING,0,0);|31: ConInfo.ConnectionIndex:=1;|132: while DeviceIoControl(f,IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX,@ConInfo,sizeof(ConInfo),@ConInfo,sizeof(ConInfo),len,0) do|9: begin|48: if ConInfo.DeviceDescriptor.bLength=0 then|14: break;|54: if ConInfo.ConnectionStatus=DeviceConnected then|11: begin|57: Request.ConnectionIndex:=ConInfo.ConnectionIndex;|98: Request.wValue:=(USB_STRING_DESCRIPTOR_TYPE shl 8)+ConInfo.DeviceDescriptor.iManufacturer;|129: DeviceIoControl(f,IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION,@Request,sizeof(Request),@Request,sizeof(Request),len,0);|73: WriteConsoleW(stdout,@Request.Data,Request.Length shr 1-1,len,0);|19: write(' ');|93: Request.wValue:=(USB_STRING_DESCRIPTOR_TYPE shl 8)+ConInfo.DeviceDescriptor.iProduct;|129: DeviceIoControl(f,IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION,@Request,sizeof(Request),@Request,sizeof(Request),len,0);|74: WriteConsoleW(stdout,@Request.Data,Request.Length shr 1-1,len,0);|19: write(' ');|98: Request.wValue:=(USB_STRING_DESCRIPTOR_TYPE shl 8)+ConInfo.DeviceDescriptor.iSerialNumber;|129: DeviceIoControl(f,IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION,@Request,sizeof(Request),@Request,sizeof(Request),len,0);|74: WriteConsoleW(stdout,@Request.Data,Request.Length shr 1-1,len,0);|75: writeln(' ',GetEnumName(TypeInfo(USB_DEVICE_SPEED),ConInfo.Speed));|10: end;|35: inc(ConInfo.ConnectionIndex);|8: end;|19: CloseHandle(f);|11: inc(i);|6: end;|9: readln;|4:end;|0:|4:end.|
}

Как победить ошибки:

D:\HiAsm 4\Elements\delphi\code\hiInlineCode_5CA79D0.pas(143) Error: Cannot initialize local variables
D:\HiAsm 4\Elements\delphi\code\hiInlineCode_5CA79D0.pas(146) Error: Cannot initialize local variables
D:\HiAsm 4\Elements\delphi\code\hiInlineCode_5CA79D0.pas(176) Error: Undeclared identifier: 'GetEnumName'
карма: 2

0