function ArrayOfIntegerToOleVariant(Arr: array of Integer): OleVariant;
var
i: Integer;
begin
Result := VarArrayCreate([Low(Arr), High(Arr)], varInteger);
for i := Low(Arr) to High(Arr) do
Result := Arr;
end;
function Buf2Ole(const Buf
Len: Integer): OleVariant;
var
p: PByte;
begin
result := vararraycreate([0, len-1], varByte);
p := Pbyte(vararraylock(result));
move(buf, p^, len);
vararrayunlock(result);
end;