ReactOS  0.4.14-dev-552-g2fad488
memstream.c File Reference
#include <rtl.h>
#include <debug.h>
Include dependency graph for memstream.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static PRTL_MEMORY_STREAM IStream_To_RTL_MEMORY_STREAM (_In_ IStream *Interface)
 
VOID NTAPI RtlInitMemoryStream (_Out_ PRTL_MEMORY_STREAM Stream)
 
VOID NTAPI RtlInitOutOfProcessMemoryStream (_Out_ PRTL_MEMORY_STREAM Stream)
 
VOID NTAPI RtlFinalReleaseOutOfProcessMemoryStream (_In_ PRTL_MEMORY_STREAM Stream)
 
HRESULT NTAPI RtlQueryInterfaceMemoryStream (_In_ IStream *This, _In_ REFIID RequestedIid, _Outptr_ PVOID *ResultObject)
 
ULONG NTAPI RtlAddRefMemoryStream (_In_ IStream *This)
 
ULONG NTAPI RtlReleaseMemoryStream (_In_ IStream *This)
 
HRESULT NTAPI RtlReadMemoryStream (_In_ IStream *This, _Out_writes_bytes_(Length) PVOID Buffer, _In_ ULONG Length, _Out_opt_ PULONG BytesRead)
 
HRESULT NTAPI RtlReadOutOfProcessMemoryStream (_In_ IStream *This, _Out_writes_bytes_(Length) PVOID Buffer, _In_ ULONG Length, _Out_opt_ PULONG BytesRead)
 
HRESULT NTAPI RtlSeekMemoryStream (_In_ IStream *This, _In_ LARGE_INTEGER RelativeOffset, _In_ ULONG Origin, _Out_opt_ PULARGE_INTEGER ResultOffset)
 
HRESULT NTAPI RtlCopyMemoryStreamTo (_In_ IStream *This, _In_ IStream *Target, _In_ ULARGE_INTEGER Length, _Out_opt_ PULARGE_INTEGER BytesRead, _Out_opt_ PULARGE_INTEGER BytesWritten)
 
HRESULT NTAPI RtlStatMemoryStream (_In_ IStream *This, _Out_ STATSTG *Stats, _In_ ULONG Flags)
 
HRESULT NTAPI RtlWriteMemoryStream (_In_ IStream *This, _In_reads_bytes_(Length) CONST VOID *Buffer, _In_ ULONG Length, _Out_opt_ PULONG BytesWritten)
 
HRESULT NTAPI RtlSetMemoryStreamSize (_In_ IStream *This, _In_ ULARGE_INTEGER NewSize)
 
HRESULT NTAPI RtlCommitMemoryStream (_In_ IStream *This, _In_ ULONG CommitFlags)
 
HRESULT NTAPI RtlRevertMemoryStream (_In_ IStream *This)
 
HRESULT NTAPI RtlLockMemoryStreamRegion (_In_ IStream *This, _In_ ULARGE_INTEGER Offset, _In_ ULARGE_INTEGER Length, _In_ ULONG LockType)
 
HRESULT NTAPI RtlUnlockMemoryStreamRegion (_In_ IStream *This, _In_ ULARGE_INTEGER Offset, _In_ ULARGE_INTEGER Length, _In_ ULONG LockType)
 
HRESULT NTAPI RtlCloneMemoryStream (_In_ IStream *This, _Outptr_ IStream **ResultStream)
 
NTSTATUS NTAPI RtlCopyMappedMemory (_Out_writes_bytes_all_(Size) PVOID Destination, _In_reads_bytes_(Size) const VOID *Source, _In_ SIZE_T Size)
 

Variables

const struct IStreamVtbl RtlMemoryStreamVtbl
 
const struct IStreamVtbl RtlOutOfProcessMemoryStreamVtbl
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file memstream.c.

Function Documentation

◆ IStream_To_RTL_MEMORY_STREAM()

static PRTL_MEMORY_STREAM IStream_To_RTL_MEMORY_STREAM ( _In_ IStream Interface)
static

Definition at line 58 of file memstream.c.

60 {
61  if (Interface == NULL)
62  return NULL;
63 
64  return CONTAINING_RECORD(Interface, RTL_MEMORY_STREAM, Vtbl);
65 }
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:359

Referenced by RtlAddRefMemoryStream(), RtlReadMemoryStream(), RtlReadOutOfProcessMemoryStream(), RtlReleaseMemoryStream(), RtlSeekMemoryStream(), and RtlStatMemoryStream().

◆ RtlAddRefMemoryStream()

ULONG NTAPI RtlAddRefMemoryStream ( _In_ IStream This)

Definition at line 131 of file memstream.c.

133 {
134  PRTL_MEMORY_STREAM Stream = IStream_To_RTL_MEMORY_STREAM(This);
135 
136  return InterlockedIncrement(&Stream->RefCount);
137 }
static PRTL_MEMORY_STREAM IStream_To_RTL_MEMORY_STREAM(_In_ IStream *Interface)
Definition: memstream.c:58
#define InterlockedIncrement
Definition: armddk.h:53
_Inout_opt_ PUNICODE_STRING _Inout_opt_ PUNICODE_STRING Stream
Definition: fltkernel.h:1092

◆ RtlCloneMemoryStream()

HRESULT NTAPI RtlCloneMemoryStream ( _In_ IStream This,
_Outptr_ IStream **  ResultStream 
)

Definition at line 464 of file memstream.c.

467 {
469  UNREFERENCED_PARAMETER(ResultStream);
470 
471  return E_NOTIMPL;
472 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ RtlCommitMemoryStream()

HRESULT NTAPI RtlCommitMemoryStream ( _In_ IStream This,
_In_ ULONG  CommitFlags 
)

Definition at line 398 of file memstream.c.

401 {
403  UNREFERENCED_PARAMETER(CommitFlags);
404 
405  return E_NOTIMPL;
406 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ RtlCopyMappedMemory()

NTSTATUS NTAPI RtlCopyMappedMemory ( _Out_writes_bytes_all_(Size) PVOID  Destination,
_In_reads_bytes_(Size) const VOID Source,
_In_ SIZE_T  Size 
)

Definition at line 479 of file memstream.c.

483 {
485  _SEH2_TRY
486  {
488  }
492  {
494  }
495  _SEH2_END;
496  return Status;
497 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
LONG NTSTATUS
Definition: precomp.h:26
_SEH2_TRY
Definition: create.c:4250
#define EXCEPTION_CONTINUE_SEARCH
Definition: excpt.h:86
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:2891
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4424
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define STATUS_IN_PAGE_ERROR
Definition: ntstatus.h:229
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ RtlCopyMemoryStreamTo()

HRESULT NTAPI RtlCopyMemoryStreamTo ( _In_ IStream This,
_In_ IStream Target,
_In_ ULARGE_INTEGER  Length,
_Out_opt_ PULARGE_INTEGER  BytesRead,
_Out_opt_ PULARGE_INTEGER  BytesWritten 
)

Definition at line 282 of file memstream.c.

288 {
289  CHAR Buffer[1024];
290  ULONGLONG TotalSize;
291  ULONG Left, Amount;
292  HRESULT Result;
293 
294  if (BytesRead)
295  BytesRead->QuadPart = 0;
296  if (BytesWritten)
297  BytesWritten->QuadPart = 0;
298 
299  if (!Target)
300  return S_OK;
301 
302  if (!Length.QuadPart)
303  return S_OK;
304 
305  /* Copy data */
306  TotalSize = Length.QuadPart;
307  while (TotalSize)
308  {
309  Left = (ULONG)min(TotalSize, sizeof(Buffer));
310 
311  /* Read */
312  Result = IStream_Read(This, Buffer, Left, &Amount);
313  if (BytesRead)
315  if (FAILED(Result) || Amount == 0)
316  break;
317 
318  Left = Amount;
319 
320  /* Write */
321  Result = IStream_Write(Target, Buffer, Left, &Amount);
322  if (BytesWritten)
324  if (FAILED(Result) || Amount != Left)
325  break;
326 
327  TotalSize -= Left;
328  }
329  return Result;
330 }
_Must_inspect_result_ _In_ LONGLONG _In_ LONGLONG Amount
Definition: fsrtlfuncs.h:550
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesWritten
Definition: fltkernel.h:1293
char CHAR
Definition: xmlstorage.h:175
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
Definition: bufpool.h:45
LONG HRESULT
Definition: typedefs.h:77
uint64_t ULONGLONG
Definition: typedefs.h:65
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
_Must_inspect_result_ typedef _In_ ULONG _In_ BOOLEAN Target
Definition: iotypes.h:1068
#define S_OK
Definition: intsafe.h:59
#define min(a, b)
Definition: monoChain.cc:55
unsigned int ULONG
Definition: retypes.h:1
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesRead
Definition: fltkernel.h:1255
LONGLONG QuadPart
Definition: typedefs.h:112

◆ RtlFinalReleaseOutOfProcessMemoryStream()

VOID NTAPI RtlFinalReleaseOutOfProcessMemoryStream ( _In_ PRTL_MEMORY_STREAM  Stream)

Definition at line 97 of file memstream.c.

99 {
101 }
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by CustomFinalReleaseOutOfProcessMemoryStream(), RtlInitOutOfProcessMemoryStream(), and test_OutOfProcess().

◆ RtlInitMemoryStream()

VOID NTAPI RtlInitMemoryStream ( _Out_ PRTL_MEMORY_STREAM  Stream)

Definition at line 72 of file memstream.c.

74 {
75  RtlZeroMemory(Stream, sizeof(RTL_MEMORY_STREAM));
76  Stream->Vtbl = &RtlMemoryStreamVtbl;
77 }
const struct IStreamVtbl RtlMemoryStreamVtbl
Definition: memstream.c:18
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
_Inout_opt_ PUNICODE_STRING _Inout_opt_ PUNICODE_STRING Stream
Definition: fltkernel.h:1092

Referenced by test_InProcess().

◆ RtlInitOutOfProcessMemoryStream()

VOID NTAPI RtlInitOutOfProcessMemoryStream ( _Out_ PRTL_MEMORY_STREAM  Stream)

Definition at line 84 of file memstream.c.

86 {
87  RtlZeroMemory(Stream, sizeof(RTL_MEMORY_STREAM));
90 }
const struct IStreamVtbl RtlOutOfProcessMemoryStreamVtbl
Definition: memstream.c:36
VOID NTAPI RtlFinalReleaseOutOfProcessMemoryStream(_In_ PRTL_MEMORY_STREAM Stream)
Definition: memstream.c:97
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
_Inout_opt_ PUNICODE_STRING _Inout_opt_ PUNICODE_STRING Stream
Definition: fltkernel.h:1092

Referenced by test_OutOfProcess().

◆ RtlLockMemoryStreamRegion()

HRESULT NTAPI RtlLockMemoryStreamRegion ( _In_ IStream This,
_In_ ULARGE_INTEGER  Offset,
_In_ ULARGE_INTEGER  Length,
_In_ ULONG  LockType 
)

Definition at line 426 of file memstream.c.

431 {
435  UNREFERENCED_PARAMETER(LockType);
436 
437  return E_NOTIMPL;
438 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ RtlQueryInterfaceMemoryStream()

HRESULT NTAPI RtlQueryInterfaceMemoryStream ( _In_ IStream This,
_In_ REFIID  RequestedIid,
_Outptr_ PVOID ResultObject 
)

Definition at line 108 of file memstream.c.

112 {
113  if (IsEqualGUID(RequestedIid, &IID_IUnknown) ||
114  IsEqualGUID(RequestedIid, &IID_ISequentialStream) ||
115  IsEqualGUID(RequestedIid, &IID_IStream))
116  {
117  IStream_AddRef(This);
118  *ResultObject = This;
119  return S_OK;
120  }
121 
122  *ResultObject = NULL;
123  return E_NOINTERFACE;
124 }
#define E_NOINTERFACE
Definition: winerror.h:2364
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ RtlReadMemoryStream()

HRESULT NTAPI RtlReadMemoryStream ( _In_ IStream This,
_Out_writes_bytes_(Length) PVOID  Buffer,
_In_ ULONG  Length,
_Out_opt_ PULONG  BytesRead 
)

Definition at line 166 of file memstream.c.

171 {
172  ULONG CopyLength;
173  PRTL_MEMORY_STREAM Stream = IStream_To_RTL_MEMORY_STREAM(This);
174  SIZE_T Available = (PUCHAR)Stream->End - (PUCHAR)Stream->Current;
175 
176  if (BytesRead)
177  *BytesRead = 0;
178 
179  if (!Length)
180  return S_OK;
181 
182  CopyLength = min(Available, Length);
183 
184  RtlMoveMemory(Buffer, Stream->Current, CopyLength);
185 
186  Stream->Current = (PUCHAR)Stream->Current + CopyLength;
187 
188  *BytesRead = CopyLength;
189 
190  return S_OK;
191 }
static PRTL_MEMORY_STREAM IStream_To_RTL_MEMORY_STREAM(_In_ IStream *Interface)
Definition: memstream.c:58
unsigned char * PUCHAR
Definition: retypes.h:3
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
Definition: bufpool.h:45
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define S_OK
Definition: intsafe.h:59
#define min(a, b)
Definition: monoChain.cc:55
unsigned int ULONG
Definition: retypes.h:1
_Inout_opt_ PUNICODE_STRING _Inout_opt_ PUNICODE_STRING Stream
Definition: fltkernel.h:1092
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesRead
Definition: fltkernel.h:1255

◆ RtlReadOutOfProcessMemoryStream()

HRESULT NTAPI RtlReadOutOfProcessMemoryStream ( _In_ IStream This,
_Out_writes_bytes_(Length) PVOID  Buffer,
_In_ ULONG  Length,
_Out_opt_ PULONG  BytesRead 
)

Definition at line 198 of file memstream.c.

203 {
205  ULONG CopyLength;
206  PRTL_MEMORY_STREAM Stream = IStream_To_RTL_MEMORY_STREAM(This);
207  SIZE_T Available = (PUCHAR)Stream->End - (PUCHAR)Stream->Current;
208  SIZE_T LocalBytesRead = 0;
209 
210  if (BytesRead)
211  *BytesRead = 0;
212 
213  if (!Length)
214  return S_OK;
215 
216  CopyLength = min(Available, Length);
217 
218  Status = NtReadVirtualMemory(Stream->ProcessHandle,
219  Stream->Current,
220  Buffer,
221  CopyLength,
222  &LocalBytesRead);
223 
224  if (NT_SUCCESS(Status))
225  {
226  Stream->Current = (PUCHAR)Stream->Current + LocalBytesRead;
227  if (BytesRead)
228  *BytesRead = (ULONG)LocalBytesRead;
229  }
230 
232 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
static PRTL_MEMORY_STREAM IStream_To_RTL_MEMORY_STREAM(_In_ IStream *Interface)
Definition: memstream.c:58
unsigned char * PUCHAR
Definition: retypes.h:3
LONG NTSTATUS
Definition: precomp.h:26
Definition: bufpool.h:45
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSTATUS NTAPI NtReadVirtualMemory(IN HANDLE ProcessHandle, IN PVOID BaseAddress, OUT PVOID Buffer, IN SIZE_T NumberOfBytesToRead, OUT PSIZE_T NumberOfBytesRead OPTIONAL)
Definition: virtual.c:2691
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define S_OK
Definition: intsafe.h:59
#define min(a, b)
Definition: monoChain.cc:55
unsigned int ULONG
Definition: retypes.h:1
_Inout_opt_ PUNICODE_STRING _Inout_opt_ PUNICODE_STRING Stream
Definition: fltkernel.h:1092
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesRead
Definition: fltkernel.h:1255

◆ RtlReleaseMemoryStream()

ULONG NTAPI RtlReleaseMemoryStream ( _In_ IStream This)

Definition at line 144 of file memstream.c.

146 {
147  PRTL_MEMORY_STREAM Stream = IStream_To_RTL_MEMORY_STREAM(This);
148  LONG Result;
149 
150  Result = InterlockedDecrement(&Stream->RefCount);
151 
152  if (Result == 0)
153  {
154  if (Stream->FinalRelease)
155  Stream->FinalRelease(Stream);
156  }
157 
158  return Result;
159 }
static PRTL_MEMORY_STREAM IStream_To_RTL_MEMORY_STREAM(_In_ IStream *Interface)
Definition: memstream.c:58
long LONG
Definition: pedump.c:60
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define InterlockedDecrement
Definition: armddk.h:52
_Inout_opt_ PUNICODE_STRING _Inout_opt_ PUNICODE_STRING Stream
Definition: fltkernel.h:1092

◆ RtlRevertMemoryStream()

HRESULT NTAPI RtlRevertMemoryStream ( _In_ IStream This)

Definition at line 413 of file memstream.c.

415 {
417 
418  return E_NOTIMPL;
419 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ RtlSeekMemoryStream()

HRESULT NTAPI RtlSeekMemoryStream ( _In_ IStream This,
_In_ LARGE_INTEGER  RelativeOffset,
_In_ ULONG  Origin,
_Out_opt_ PULARGE_INTEGER  ResultOffset 
)

Definition at line 239 of file memstream.c.

244 {
245  PVOID NewPosition;
246  PRTL_MEMORY_STREAM Stream = IStream_To_RTL_MEMORY_STREAM(This);
247 
248  switch (Origin)
249  {
250  case STREAM_SEEK_SET:
251  NewPosition = (PUCHAR)Stream->Start + RelativeOffset.QuadPart;
252  break;
253 
254  case STREAM_SEEK_CUR:
255  NewPosition = (PUCHAR)Stream->Current + RelativeOffset.QuadPart;
256  break;
257 
258  case STREAM_SEEK_END:
259  NewPosition = (PUCHAR)Stream->End - RelativeOffset.QuadPart;
260  break;
261 
262  default:
263  return E_INVALIDARG;
264  }
265 
266  if (NewPosition < Stream->Start || NewPosition > Stream->End)
267  return STG_E_INVALIDPOINTER;
268 
269  Stream->Current = NewPosition;
270 
271  if (ResultOffset)
272  ResultOffset->QuadPart = (PUCHAR)Stream->Current - (PUCHAR)Stream->Start;
273 
274  return S_OK;
275 }
static PRTL_MEMORY_STREAM IStream_To_RTL_MEMORY_STREAM(_In_ IStream *Interface)
Definition: memstream.c:58
#define STG_E_INVALIDPOINTER
Definition: winerror.h:2571
unsigned char * PUCHAR
Definition: retypes.h:3
#define E_INVALIDARG
Definition: ddrawi.h:101
Definition: partlist.h:33
#define S_OK
Definition: intsafe.h:59
_Inout_opt_ PUNICODE_STRING _Inout_opt_ PUNICODE_STRING Stream
Definition: fltkernel.h:1092

◆ RtlSetMemoryStreamSize()

HRESULT NTAPI RtlSetMemoryStreamSize ( _In_ IStream This,
_In_ ULARGE_INTEGER  NewSize 
)

Definition at line 383 of file memstream.c.

386 {
389 
390  return E_NOTIMPL;
391 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
_Must_inspect_result_ _In_ USHORT NewSize
Definition: fltkernel.h:975
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ RtlStatMemoryStream()

HRESULT NTAPI RtlStatMemoryStream ( _In_ IStream This,
_Out_ STATSTG *  Stats,
_In_ ULONG  Flags 
)

Definition at line 337 of file memstream.c.

341 {
342  PRTL_MEMORY_STREAM Stream = IStream_To_RTL_MEMORY_STREAM(This);
343 
344  if (!Stats)
345  return STG_E_INVALIDPOINTER;
346 
347  RtlZeroMemory(Stats, sizeof(STATSTG));
348  Stats->type = STGTY_STREAM;
349  Stats->cbSize.QuadPart = (PUCHAR)Stream->End - (PUCHAR)Stream->Start;
350 
351  return S_OK;
352 }
static PRTL_MEMORY_STREAM IStream_To_RTL_MEMORY_STREAM(_In_ IStream *Interface)
Definition: memstream.c:58
#define STG_E_INVALIDPOINTER
Definition: winerror.h:2571
unsigned char * PUCHAR
Definition: retypes.h:3
#define S_OK
Definition: intsafe.h:59
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
_Inout_opt_ PUNICODE_STRING _Inout_opt_ PUNICODE_STRING Stream
Definition: fltkernel.h:1092

◆ RtlUnlockMemoryStreamRegion()

HRESULT NTAPI RtlUnlockMemoryStreamRegion ( _In_ IStream This,
_In_ ULARGE_INTEGER  Offset,
_In_ ULARGE_INTEGER  Length,
_In_ ULONG  LockType 
)

Definition at line 445 of file memstream.c.

450 {
454  UNREFERENCED_PARAMETER(LockType);
455 
456  return E_NOTIMPL;
457 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ RtlWriteMemoryStream()

HRESULT NTAPI RtlWriteMemoryStream ( _In_ IStream This,
_In_reads_bytes_(Length) CONST VOID Buffer,
_In_ ULONG  Length,
_Out_opt_ PULONG  BytesWritten 
)

Definition at line 364 of file memstream.c.

369 {
374 
375  return E_NOTIMPL;
376 }
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesWritten
Definition: fltkernel.h:1293
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
Definition: bufpool.h:45
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99

Variable Documentation

◆ RtlMemoryStreamVtbl

const struct IStreamVtbl RtlMemoryStreamVtbl
Initial value:
=
{
}
HRESULT NTAPI RtlUnlockMemoryStreamRegion(_In_ IStream *This, _In_ ULARGE_INTEGER Offset, _In_ ULARGE_INTEGER Length, _In_ ULONG LockType)
Definition: memstream.c:445
HRESULT NTAPI RtlCopyMemoryStreamTo(_In_ IStream *This, _In_ IStream *Target, _In_ ULARGE_INTEGER Length, _Out_opt_ PULARGE_INTEGER BytesRead, _Out_opt_ PULARGE_INTEGER BytesWritten)
Definition: memstream.c:282
HRESULT NTAPI RtlQueryInterfaceMemoryStream(_In_ IStream *This, _In_ REFIID RequestedIid, _Outptr_ PVOID *ResultObject)
Definition: memstream.c:108
HRESULT NTAPI RtlStatMemoryStream(_In_ IStream *This, _Out_ STATSTG *Stats, _In_ ULONG Flags)
Definition: memstream.c:337
HRESULT NTAPI RtlSetMemoryStreamSize(_In_ IStream *This, _In_ ULARGE_INTEGER NewSize)
Definition: memstream.c:383
ULONG NTAPI RtlAddRefMemoryStream(_In_ IStream *This)
Definition: memstream.c:131
HRESULT NTAPI RtlCloneMemoryStream(_In_ IStream *This, _Outptr_ IStream **ResultStream)
Definition: memstream.c:464
HRESULT NTAPI RtlRevertMemoryStream(_In_ IStream *This)
Definition: memstream.c:413
HRESULT NTAPI RtlLockMemoryStreamRegion(_In_ IStream *This, _In_ ULARGE_INTEGER Offset, _In_ ULARGE_INTEGER Length, _In_ ULONG LockType)
Definition: memstream.c:426
HRESULT NTAPI RtlReadMemoryStream(_In_ IStream *This, _Out_writes_bytes_(Length) PVOID Buffer, _In_ ULONG Length, _Out_opt_ PULONG BytesRead)
Definition: memstream.c:166
HRESULT NTAPI RtlCommitMemoryStream(_In_ IStream *This, _In_ ULONG CommitFlags)
Definition: memstream.c:398
ULONG NTAPI RtlReleaseMemoryStream(_In_ IStream *This)
Definition: memstream.c:144
HRESULT NTAPI RtlWriteMemoryStream(_In_ IStream *This, _In_reads_bytes_(Length) CONST VOID *Buffer, _In_ ULONG Length, _Out_opt_ PULONG BytesWritten)
Definition: memstream.c:364
HRESULT NTAPI RtlSeekMemoryStream(_In_ IStream *This, _In_ LARGE_INTEGER RelativeOffset, _In_ ULONG Origin, _Out_opt_ PULARGE_INTEGER ResultOffset)
Definition: memstream.c:239

Definition at line 18 of file memstream.c.

Referenced by RtlInitMemoryStream().

◆ RtlOutOfProcessMemoryStreamVtbl

const struct IStreamVtbl RtlOutOfProcessMemoryStreamVtbl
Initial value:
=
{
}
HRESULT NTAPI RtlUnlockMemoryStreamRegion(_In_ IStream *This, _In_ ULARGE_INTEGER Offset, _In_ ULARGE_INTEGER Length, _In_ ULONG LockType)
Definition: memstream.c:445
HRESULT NTAPI RtlCopyMemoryStreamTo(_In_ IStream *This, _In_ IStream *Target, _In_ ULARGE_INTEGER Length, _Out_opt_ PULARGE_INTEGER BytesRead, _Out_opt_ PULARGE_INTEGER BytesWritten)
Definition: memstream.c:282
HRESULT NTAPI RtlQueryInterfaceMemoryStream(_In_ IStream *This, _In_ REFIID RequestedIid, _Outptr_ PVOID *ResultObject)
Definition: memstream.c:108
HRESULT NTAPI RtlStatMemoryStream(_In_ IStream *This, _Out_ STATSTG *Stats, _In_ ULONG Flags)
Definition: memstream.c:337
HRESULT NTAPI RtlSetMemoryStreamSize(_In_ IStream *This, _In_ ULARGE_INTEGER NewSize)
Definition: memstream.c:383
ULONG NTAPI RtlAddRefMemoryStream(_In_ IStream *This)
Definition: memstream.c:131
HRESULT NTAPI RtlCloneMemoryStream(_In_ IStream *This, _Outptr_ IStream **ResultStream)
Definition: memstream.c:464
HRESULT NTAPI RtlReadOutOfProcessMemoryStream(_In_ IStream *This, _Out_writes_bytes_(Length) PVOID Buffer, _In_ ULONG Length, _Out_opt_ PULONG BytesRead)
Definition: memstream.c:198
HRESULT NTAPI RtlRevertMemoryStream(_In_ IStream *This)
Definition: memstream.c:413
HRESULT NTAPI RtlLockMemoryStreamRegion(_In_ IStream *This, _In_ ULARGE_INTEGER Offset, _In_ ULARGE_INTEGER Length, _In_ ULONG LockType)
Definition: memstream.c:426
HRESULT NTAPI RtlCommitMemoryStream(_In_ IStream *This, _In_ ULONG CommitFlags)
Definition: memstream.c:398
ULONG NTAPI RtlReleaseMemoryStream(_In_ IStream *This)
Definition: memstream.c:144
HRESULT NTAPI RtlWriteMemoryStream(_In_ IStream *This, _In_reads_bytes_(Length) CONST VOID *Buffer, _In_ ULONG Length, _Out_opt_ PULONG BytesWritten)
Definition: memstream.c:364
HRESULT NTAPI RtlSeekMemoryStream(_In_ IStream *This, _In_ LARGE_INTEGER RelativeOffset, _In_ ULONG Origin, _Out_opt_ PULARGE_INTEGER ResultOffset)
Definition: memstream.c:239

Definition at line 36 of file memstream.c.

Referenced by RtlInitOutOfProcessMemoryStream().