mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 17:59:09 +02:00
+ basic TStreamAdapter implementation
git-svn-id: trunk@7815 -
This commit is contained in:
parent
504d845e86
commit
0caa70a8b3
@ -1521,7 +1521,7 @@ TYPE
|
|||||||
|
|
||||||
// Forward interfaces.
|
// Forward interfaces.
|
||||||
|
|
||||||
IStream = Interface;
|
IStream = Types.IStream;
|
||||||
IMoniker = Interface;
|
IMoniker = Interface;
|
||||||
IEnumMoniker = Interface;
|
IEnumMoniker = Interface;
|
||||||
IEnumString = Interface;
|
IEnumString = Interface;
|
||||||
@ -1745,13 +1745,15 @@ TYPE
|
|||||||
Function Clone(Out penum:IEnumString):HResult;StdCall;
|
Function Clone(Out penum:IEnumString):HResult;StdCall;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
ISequentialStream = interface(IUnknown)
|
ISequentialStream = Types.ISequentialStream;
|
||||||
|
{interface(IUnknown)
|
||||||
['{0c733a30-2a1c-11ce-ade5-00aa0044773d}']
|
['{0c733a30-2a1c-11ce-ade5-00aa0044773d}']
|
||||||
function Read(pv : Pointer;cb : ULONG;pcbRead : PULONG) : HRESULT;stdcall;
|
function Read(pv : Pointer;cb : ULONG;pcbRead : PULONG) : HRESULT;stdcall;
|
||||||
function Write(pv : Pointer;cb : ULONG;pcbWritten : PULONG): HRESULT;stdcall;
|
function Write(pv : Pointer;cb : ULONG;pcbWritten : PULONG): HRESULT;stdcall;
|
||||||
end;
|
end;
|
||||||
|
}
|
||||||
|
|
||||||
IStream = interface(ISequentialStream)
|
{ defined above by pulling it in from types IStream = interface(ISequentialStream)
|
||||||
['{0000000C-0000-0000-C000-000000000046}']
|
['{0000000C-0000-0000-C000-000000000046}']
|
||||||
function Seek(dlibMove : LargeInt; dwOrigin: Longint;
|
function Seek(dlibMove : LargeInt; dwOrigin: Longint;
|
||||||
out libNewPosition : LargeInt): HResult; stdcall;
|
out libNewPosition : LargeInt): HResult; stdcall;
|
||||||
@ -1767,7 +1769,7 @@ TYPE
|
|||||||
Function Stat(out statstg : TStatStg; grfStatFlag: Longint): HRESULT;stdcall;
|
Function Stat(out statstg : TStatStg; grfStatFlag: Longint): HRESULT;stdcall;
|
||||||
function Clone(out stm : IStream) : HRESULT; stdcall;
|
function Clone(out stm : IStream) : HRESULT; stdcall;
|
||||||
end;
|
end;
|
||||||
|
}
|
||||||
IEnumSTATSTG = Interface (IUnknown)
|
IEnumSTATSTG = Interface (IUnknown)
|
||||||
['{0000000d-0000-0000-C000-000000000046}']
|
['{0000000d-0000-0000-C000-000000000046}']
|
||||||
Function Next (Celt:ULong;Out xcelt;pceltfetched : PUlong):HResult; StdCall;
|
Function Next (Celt:ULong;Out xcelt;pceltfetched : PUlong):HResult; StdCall;
|
||||||
|
@ -785,3 +785,86 @@ begin
|
|||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{****************************************************************************}
|
||||||
|
{* TStreamAdapter *}
|
||||||
|
{****************************************************************************}
|
||||||
|
constructor TStreamAdapter.Create(Stream: TStream; Ownership: TStreamOwnership = soReference);
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
FStream:=Stream;
|
||||||
|
FOwnership:=Ownership;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
destructor TStreamAdapter.Destroy;
|
||||||
|
begin
|
||||||
|
if StreamOwnership=soOwned then
|
||||||
|
FreeAndNil(FStream);
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TStreamAdapter.Read(pv: Pointer; cb: DWORD; pcbRead: PDWORD): HResult; stdcall;
|
||||||
|
begin
|
||||||
|
runerror(217);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TStreamAdapter.Write(pv: Pointer; cb: DWORD; pcbWritten: PDWORD): HResult; stdcall;
|
||||||
|
begin
|
||||||
|
runerror(217);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TStreamAdapter.Seek(dlibMove: Largeint; dwOrigin: Longint; out libNewPosition: Largeint): HResult; stdcall;
|
||||||
|
begin
|
||||||
|
runerror(217);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TStreamAdapter.SetSize(libNewSize: Largeint): HResult; stdcall;
|
||||||
|
begin
|
||||||
|
runerror(217);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TStreamAdapter.CopyTo(stm: IStream; cb: Largeint; out cbRead: Largeint; out cbWritten: Largeint): HResult; stdcall;
|
||||||
|
begin
|
||||||
|
runerror(217);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TStreamAdapter.Commit(grfCommitFlags: Longint): HResult; stdcall;
|
||||||
|
begin
|
||||||
|
runerror(217);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TStreamAdapter.Revert: HResult; stdcall;
|
||||||
|
begin
|
||||||
|
runerror(217);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TStreamAdapter.LockRegion(libOffset: Largeint; cb: Largeint; dwLockType: Longint): HResult; stdcall;
|
||||||
|
begin
|
||||||
|
runerror(217);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TStreamAdapter.UnlockRegion(libOffset: Largeint; cb: Largeint; dwLockType: Longint): HResult; stdcall;
|
||||||
|
begin
|
||||||
|
runerror(217);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TStreamAdapter.Stat(out statstg: TStatStg; grfStatFlag: Longint): HResult; stdcall;
|
||||||
|
begin
|
||||||
|
runerror(217);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TStreamAdapter.Clone(out stm: IStream): HResult; stdcall;
|
||||||
|
begin
|
||||||
|
runerror(217);
|
||||||
|
end;
|
||||||
|
@ -216,6 +216,9 @@ type
|
|||||||
FILETIME = _FILETIME;
|
FILETIME = _FILETIME;
|
||||||
PFileTime = ^TFileTime;
|
PFileTime = ^TFileTime;
|
||||||
|
|
||||||
|
{$endif Windows}
|
||||||
|
|
||||||
|
type
|
||||||
tagSTATSTG =
|
tagSTATSTG =
|
||||||
{$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}
|
{$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}
|
||||||
packed
|
packed
|
||||||
@ -237,6 +240,7 @@ type
|
|||||||
STATSTG = TStatStg;
|
STATSTG = TStatStg;
|
||||||
PStatStg = ^TStatStg;
|
PStatStg = ^TStatStg;
|
||||||
|
|
||||||
|
{ classes depends on these interfaces, we can't use the activex unit in classes though }
|
||||||
IClassFactory = Interface(IUnknown) ['{00000001-0000-0000-C000-000000000046}']
|
IClassFactory = Interface(IUnknown) ['{00000001-0000-0000-C000-000000000046}']
|
||||||
Function CreateInstance(Const unkOuter : IUnknown;Const riid : TGUID;Out vObject) : HResult;StdCall;
|
Function CreateInstance(Const unkOuter : IUnknown;Const riid : TGUID;Out vObject) : HResult;StdCall;
|
||||||
Function LockServer(fLock : LongBool) : HResult;StdCall;
|
Function LockServer(fLock : LongBool) : HResult;StdCall;
|
||||||
@ -248,7 +252,6 @@ type
|
|||||||
function Write(pv : Pointer;cb : DWORD;pcbWritten : PDWORD): HRESULT;stdcall;
|
function Write(pv : Pointer;cb : DWORD;pcbWritten : PDWORD): HRESULT;stdcall;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
IStream = interface(ISequentialStream) ['{0000000C-0000-0000-C000-000000000046}']
|
IStream = interface(ISequentialStream) ['{0000000C-0000-0000-C000-000000000046}']
|
||||||
function Seek(dlibMove : LargeInt; dwOrigin : Longint;
|
function Seek(dlibMove : LargeInt; dwOrigin : Longint;
|
||||||
out libNewPosition : LargeInt) : HResult;stdcall;
|
out libNewPosition : LargeInt) : HResult;stdcall;
|
||||||
@ -264,7 +267,6 @@ type
|
|||||||
Function Stat(out statstg : TStatStg;grfStatFlag : Longint) : HRESULT;stdcall;
|
Function Stat(out statstg : TStatStg;grfStatFlag : Longint) : HRESULT;stdcall;
|
||||||
function Clone(out stm : IStream) : HRESULT;stdcall;
|
function Clone(out stm : IStream) : HRESULT;stdcall;
|
||||||
end;
|
end;
|
||||||
{$endif Windows}
|
|
||||||
|
|
||||||
function EqualRect(const r1,r2 : TRect) : Boolean;
|
function EqualRect(const r1,r2 : TRect) : Boolean;
|
||||||
function Rect(Left,Top,Right,Bottom : Integer) : TRect;
|
function Rect(Left,Top,Right,Bottom : Integer) : TRect;
|
||||||
|
Loading…
Reference in New Issue
Block a user