Ну я конечно не "куль хацкер" ;) И в случае системных библиотек так запаришься... Уверен, есть средства для автоматизации этого дела.
Вот, что пришлось мне изобразить (рыба): (в общем случае можно на параметры забить, только имена...) <c>
library usbdemon;
uses
SysUtils,
Classes,
Windows;
//{$R *.RES}
Type FT_Result = Integer;
const
FT_DLL_Name = 'usbdemon1.dll';
var r: integer;
function FT_Close(ftHandle:Dword) : FT_Result ; stdcall ; External FT_DLL_Name name 'FT_Close';
function FT_Read(ftHandle:Dword; FTInBuf : Pointer; BufferSize : LongInt; ResultPtr : Pointer ) : FT_Result ; stdcall ; External FT_DLL_Name name 'FT_Read';
function FT_Write(ftHandle:Dword; FTOutBuf : Pointer; BufferSize : LongInt; ResultPtr : Pointer ) : FT_Result ; stdcall ; External FT_DLL_Name name 'FT_Write';
function FT_SetBaudRate(ftHandle:Dword;BaudRate:DWord) : FT_Result ; stdcall ; External FT_DLL_Name name 'FT_SetBaudRate';
function FT_SetDataCharacteristics(ftHandle:Dword;WordLength,StopBits,Parity:Byte) : FT_Result ; stdcall ; External FT_DLL_Name name 'FT_SetDataCharacteristics';
function FT_SetFlowControl(ftHandle:Dword;FlowControl:Word;XonChar,XoffChar:Byte) : FT_Result ; stdcall ; External FT_DLL_Name name 'FT_SetFlowControl';
function FT_ResetDevice(ftHandle:Dword) : FT_Result ; stdcall ; External FT_DLL_Name name 'FT_ResetDevice';
function FT_SetDtr(ftHandle:Dword) : FT_Result ; stdcall ; External FT_DLL_Name name 'FT_SetDtr';
function FT_ClrDtr(ftHandle:Dword) : FT_Result ; stdcall ; External FT_DLL_Name name 'FT_ClrDtr';
function FT_SetRts(ftHandle:Dword) : FT_Result ; stdcall ; External FT_DLL_Name name 'FT_SetRts';
function FT_ClrRts(ftHandle:Dword) : FT_Result ; stdcall ; External FT_DLL_Name name 'FT_ClrRts';
function FT_GetModemStatus(ftHandle:Dword;ModemStatus:Pointer) : FT_Result ; stdcall ; External FT_DLL_Name name 'FT_GetModemStatus';
function FT_SetChars(ftHandle:Dword;EventChar,EventCharEnabled,ErrorChar,ErrorCharEnabled : Byte) : FT_Result ; stdcall ; External FT_DLL_Name name 'FT_SetChars';
function FT_Purge(ftHandle:Dword;Mask:Dword) : FT_Result ; stdcall ; External FT_DLL_Name name 'FT_Purge';
function FT_SetTimeouts(ftHandle:Dword;ReadTimeout,WriteTimeout:Dword) : FT_Result ; stdcall ; External FT_DLL_Name name 'FT_SetTimeouts';
function FT_GetQueueStatus(ftHandle:Dword;RxBytes:Pointer) : FT_Result ; stdcall ; External FT_DLL_Name name 'FT_GetQueueStatus';
function FT_GetNumDevices(pvArg1:Pointer;pvArg2:Pointer;dwFlags:Dword) : FT_Result ; stdcall ; External FT_DLL_Name name 'FT_ListDevices';
function FT_ListDevices(pvArg1:Dword;pvArg2:Pointer;dwFlags:Dword) : FT_Result ; stdcall ; External FT_DLL_Name name 'FT_ListDevices';
function FT_Open(PVDevice:Integer; ftHandle:Pointer ) : FT_Result ; stdcall ; External FT_DLL_Name name 'FT_Open';
function FT_OpenEx(pvArg1:Pointer;dwFlags:Dword;ftHandle:Pointer) : FT_Result ; stdcall ; External FT_DLL_Name name 'FT_OpenEx';
function FT_SetLatencyTimer(ftHandle:Dword;ucLatency : Byte) : FT_Result ; stdcall ; External FT_DLL_Name name 'FT_SetLatencyTimer';
function FT_GetLatencyTimer(ftHandle:Dword;pucLatency : Pointer) : FT_Result ; stdcall ; External FT_DLL_Name name 'FT_GetLatencyTimer';
function FT_SetBitMode(ftHandle:Dword;ucMask,ucEnable : Byte) : FT_Result ; stdcall ; External FT_DLL_Name name 'FT_SetBitMode';
function FT_GetBitMode(ftHandle:Dword;pucMode : Pointer) : FT_Result ; stdcall ; External FT_DLL_Name name 'FT_GetBitMode';
function FT_SetUSBParameters(ftHandle:Dword;InSize,OutSize : Dword) : FT_Result ; stdcall ; External FT_DLL_Name name 'FT_SetUSBParameters';
function FT_EE_Read(ftHandle:DWord;pEEData : Pointer) : FT_Result; stdcall ; External FT_DLL_Name name 'FT_EE_Read';
function FT_EE_Program(ftHandle : DWord;pEEData : Pointer) : FT_Result; stdcall ; External FT_DLL_Name name 'FT_EE_Program';
function FT_EE_UASize(ftHandle : DWord;pUASize : Pointer) : FT_Result; stdcall ; External FT_DLL_Name name 'FT_EE_UASize';
function FT_EE_UAWrite(ftHandle : DWord;pUCHAR:Pointer;DLen:DWord) : FT_Result; stdcall ; External FT_DLL_Name name 'FT_EE_UAWrite';
function FT_EE_UARead(ftHandle : DWord;pData:Pointer;DLen:DWord;BytesRead:Pointer) : FT_Result; stdcall ; External FT_DLL_Name name 'FT_EE_UARead';
//function FT_ListDevices(pvArg1:Dword;pvArg2:Pointer;dwFlags:Dword) : FT_Result ;
//begin
// r:= FT_ListDevices1(pvArg1,pvArg2,dwFlags);
// FT_ListDevices:=r;
//end;
exports
FT_Close,
FT_Read,
FT_Write,
FT_SetBaudRate,
FT_SetDataCharacteristics,
FT_SetFlowControl,
FT_ResetDevice,
FT_SetDtr,
FT_ClrDtr,
FT_SetRts,
FT_ClrRts,
FT_GetModemStatus,
FT_SetChars,
FT_Purge,
FT_SetTimeouts,
FT_GetQueueStatus,
FT_GetNumDevices,
FT_ListDevices,
FT_Open,
FT_OpenEx,
FT_SetLatencyTimer,
FT_GetLatencyTimer,
FT_SetBitMode,
FT_GetBitMode,
FT_SetUSBParameters,
FT_EE_Read,
FT_EE_Program,
FT_EE_UASize,
FT_EE_UAWrite,
FT_EE_UARead;
begin
end.
</c>