function CTL(aDeviceType:DWORD;Functiona:dword;Method:dword;Access:dword):dword;
begin
Result := ((aDeviceType) shl 16) or ((Access) shl 14) or ((Functiona) shl 2) or (Method)
end;
function add(hDevice:HWND;a,b:Integer):DWORD;
var
port :array[0..1] of Integer;
bufret :Integer;
dwWrite : DWORD;
begin
port[0]:=a;
port[1]:=b;
DeviceIoControl(hDevice,CTL($22,$800,1,0),@port,8,@bufret,4,dwWrite,nil);
Result := bufret;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
hDevice : HWND;
begin
hDevice :=
CreateFile('\\.\DT', //\\??\\My_DriverLinkName
GENERIC_READ or GENERIC_WRITE,
0, // share mode none
nil, // no security
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
0); // no template