Index: dll/ntdll/CMakeLists.txt
===================================================================
--- dll/ntdll/CMakeLists.txt	(revision 60556)
+++ dll/ntdll/CMakeLists.txt	(working copy)
@@ -52,6 +52,7 @@
                       rtl
                       ntdllsys
                       libcntpr
+                      uuid
                       ${PSEH_LIB})
 
 add_pch(ntdll include/ntdll.h)
Index: dll/ntdll/def/ntdll.spec
===================================================================
--- dll/ntdll/def/ntdll.spec	(revision 60556)
+++ dll/ntdll/def/ntdll.spec	(working copy)
@@ -405,7 +405,7 @@
 @ stdcall -arch=x86_64 RtlAddFunctionTable(ptr long long)
 ;@ stdcall RtlAddMandatoryAce(ptr long long long long ptr)
 @ stdcall RtlAddRefActivationContext(ptr)
-;@ stdcall RtlAddRefMemoryStream
+@ stdcall RtlAddRefMemoryStream(ptr)
 @ stdcall RtlAddVectoredContinueHandler(long ptr)
 @ stdcall RtlAddVectoredExceptionHandler(long ptr)
 ;@ stdcall RtlAddressInSectionTable
@@ -440,8 +440,8 @@
 @ stdcall RtlCheckRegistryKey(long ptr)
 @ stdcall RtlClearAllBits(ptr)
 @ stdcall RtlClearBits(ptr long long)
-;@ stdcall RtlCloneMemoryStream
-;@ stdcall RtlCommitMemoryStream
+@ stdcall RtlCloneMemoryStream(ptr ptr)
+@ stdcall RtlCommitMemoryStream(ptr long)
 @ stdcall RtlCompactHeap(long long)
 @ stdcall RtlCompareMemory(ptr ptr long)
 @ stdcall RtlCompareMemoryUlong(ptr long long)
@@ -464,8 +464,8 @@
 @ stdcall RtlCopyLuid(ptr ptr)
 @ stdcall RtlCopyLuidAndAttributesArray(long ptr ptr)
 ;@ stdcall RtlCopyMappedMemory
-;@ stdcall RtlCopyMemoryStreamTo
-;@ stdcall RtlCopyOutOfProcessMemoryStreamTo
+@ stdcall RtlCopyMemoryStreamTo(ptr ptr int64 ptr ptr)
+@ stdcall RtlCopyOutOfProcessMemoryStreamTo(ptr ptr int64 ptr ptr) RtlCopyMemoryStreamTo
 ;@ stdcall RtlCopyRangeList ; 5.0 and 5.1 only
 @ stdcall RtlCopySecurityDescriptor(ptr ptr)
 @ stdcall RtlCopySid(long ptr ptr)
@@ -571,7 +571,7 @@
 @ stdcall -arch=win32 -ret64 RtlExtendedMagicDivide(double double long)
 @ stdcall RtlFillMemory(ptr long long)
 @ stdcall RtlFillMemoryUlong(ptr long long)
-;@ stdcall RtlFinalReleaseOutOfProcessMemoryStream
+@ stdcall RtlFinalReleaseOutOfProcessMemoryStream(ptr)
 @ stdcall RtlFindActivationContextSectionGuid(long ptr long ptr ptr)
 @ stdcall RtlFindActivationContextSectionString(long ptr long ptr ptr)
 @ stdcall RtlFindCharInUnicodeString(long ptr ptr ptr)
@@ -658,9 +658,9 @@
 @ stdcall RtlInitAnsiString(ptr str)
 @ stdcall RtlInitAnsiStringEx(ptr str)
 @ stdcall RtlInitCodePageTable(ptr ptr)
-;@ stdcall RtlInitMemoryStream
+@ stdcall RtlInitMemoryStream(ptr)
 @ stdcall RtlInitNlsTables(ptr ptr ptr ptr)
-;@ stdcall RtlInitOutOfProcessMemoryStream
+@ stdcall RtlInitOutOfProcessMemoryStream(ptr)
 @ stdcall RtlInitString(ptr str)
 @ stdcall RtlInitUnicodeString(ptr wstr)
 @ stdcall RtlInitUnicodeStringEx(ptr wstr)
@@ -735,7 +735,7 @@
 @ stdcall RtlLocalTimeToSystemTime(ptr ptr)
 @ stdcall RtlLockBootStatusData(ptr)
 @ stdcall RtlLockHeap(long)
-;@ stdcall RtlLockMemoryStreamRegion
+@ stdcall RtlLockMemoryStreamRegion(ptr int64 int64 long)
 ;@ stdcall RtlLogStackBackTrace
 @ stdcall RtlLookupAtomInAtomTable(ptr wstr ptr)
 @ stdcall RtlLookupElementGenericTable(ptr ptr)
@@ -781,7 +781,7 @@
 @ stdcall RtlQueryInformationAcl(ptr ptr long long)
 @ stdcall RtlQueryInformationActivationContext(long long ptr long ptr long ptr)
 @ stdcall RtlQueryInformationActiveActivationContext(long ptr long ptr)
-;@ stdcall RtlQueryInterfaceMemoryStream
+@ stdcall RtlQueryInterfaceMemoryStream(ptr ptr ptr)
 ;@ stdcall RtlQueryProcessBackTraceInformation
 @ stdcall RtlQueryProcessDebugInformation(long long ptr)
 ;@ stdcall RtlQueryProcessHeapInformation
@@ -800,14 +800,14 @@
 @ stdcall RtlRandom(ptr)
 @ stdcall RtlRandomEx(ptr)
 @ stdcall RtlReAllocateHeap(long long ptr long)
-;@ stdcall RtlReadMemoryStream
-;@ stdcall RtlReadOutOfProcessMemoryStream
+@ stdcall RtlReadMemoryStream(ptr ptr long ptr)
+@ stdcall RtlReadOutOfProcessMemoryStream(ptr ptr long ptr)
 @ stdcall RtlRealPredecessor(ptr)
 @ stdcall RtlRealSuccessor(ptr)
 @ stdcall RtlRegisterSecureMemoryCacheCallback(ptr)
 @ stdcall RtlRegisterWait(ptr ptr ptr ptr long long)
 @ stdcall RtlReleaseActivationContext(ptr)
-;@ stdcall RtlReleaseMemoryStream
+@ stdcall RtlReleaseMemoryStream(ptr)
 @ stdcall RtlReleasePebLock()
 @ stdcall RtlReleasePrivilege(ptr)
 @ stdcall RtlReleaseRelativeName(ptr)
@@ -820,12 +820,12 @@
 @ stdcall RtlResetRtlTranslations(ptr)
 @ stdcall -arch=x86_64 RtlRestoreContext(ptr ptr)
 @ stdcall RtlRestoreLastWin32Error(long) RtlSetLastWin32Error
-;@ stdcall RtlRevertMemoryStream
+@ stdcall RtlRevertMemoryStream(ptr)
 @ stdcall RtlRunDecodeUnicodeString(long ptr)
 @ stdcall RtlRunEncodeUnicodeString(long ptr)
 @ stdcall RtlSecondsSince1970ToTime(long ptr)
 @ stdcall RtlSecondsSince1980ToTime(long ptr)
-;@ stdcall RtlSeekMemoryStream
+@ stdcall RtlSeekMemoryStream(ptr int64 long ptr)
 @ stdcall RtlSelfRelativeToAbsoluteSD2(ptr ptr)
 @ stdcall RtlSelfRelativeToAbsoluteSD(ptr ptr ptr ptr ptr ptr ptr ptr ptr ptr ptr)
 @ stdcall RtlSetAllBits(ptr)
@@ -844,7 +844,7 @@
 @ stdcall RtlSetIoCompletionCallback(long ptr long)
 @ stdcall RtlSetLastWin32Error(long)
 @ stdcall RtlSetLastWin32ErrorAndNtStatusFromNtStatus(long)
-;@ stdcall RtlSetMemoryStreamSize
+@ stdcall RtlSetMemoryStreamSize(ptr int64)
 @ stdcall RtlSetOwnerSecurityDescriptor(ptr ptr long)
 @ stdcall RtlSetProcessIsCritical(long ptr long)
 ;@ stdcall RtlSetProperties ; RtlSetProperties
@@ -869,7 +869,7 @@
 @ stdcall RtlSleepConditionVariableSRW(ptr ptr ptr long)
 @ stdcall RtlSplay(ptr)
 ;@ stdcall RtlStartRXact
-;@ stdcall RtlStatMemoryStream
+@ stdcall RtlStatMemoryStream(ptr ptr long)
 @ stdcall RtlStringFromGUID(ptr ptr)
 @ stdcall RtlSubAuthorityCountSid(ptr)
 @ stdcall RtlSubAuthoritySid(ptr long)
@@ -907,7 +907,7 @@
 @ stdcall RtlUniform(ptr)
 @ stdcall RtlUnlockBootStatusData(ptr)
 @ stdcall RtlUnlockHeap(long)
-;@ stdcall RtlUnlockMemoryStreamRegion
+@ stdcall RtlUnlockMemoryStreamRegion(ptr int64 int64 long)
 @ stdcall -register RtlUnwind(ptr ptr ptr ptr)
 @ stdcall -arch=x86_64 RtlUnwindEx(long long ptr long ptr)
 @ stdcall RtlUpcaseUnicodeChar(long)
@@ -938,7 +938,7 @@
 @ stdcall RtlWow64EnableFsRedirectionEx(long ptr)
 @ stdcall RtlWakeAllConditionVariable(ptr)
 @ stdcall RtlWakeConditionVariable(ptr)
-;@ stdcall RtlWriteMemoryStream
+@ stdcall RtlWriteMemoryStream(ptr ptr long ptr)
 @ stdcall RtlWriteRegistryValue(long ptr ptr long ptr long)
 @ stdcall RtlZeroHeap(ptr long)
 @ stdcall RtlZeroMemory(ptr long)
Index: include/ndk/rtlfuncs.h
===================================================================
--- include/ndk/rtlfuncs.h	(revision 60556)
+++ include/ndk/rtlfuncs.h	(working copy)
@@ -4152,6 +4152,142 @@
 );
 #endif
 
+//
+// MemoryStream functions
+//
+#ifdef NTOS_MODE_USER
+
+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_ struct IStream *This,
+    _In_ REFIID RequestedIid,
+    _Outptr_ PVOID *ResultObject);
+
+ULONG
+NTAPI
+RtlAddRefMemoryStream( 
+    _In_ struct IStream *This);
+
+ULONG
+NTAPI
+RtlReleaseMemoryStream( 
+    _In_ struct IStream *This);
+
+HRESULT
+NTAPI
+RtlReadMemoryStream( 
+    _In_ struct IStream *This,
+    _Out_writes_bytes_(Length) PVOID Buffer,
+    _In_ ULONG Length,
+    _Out_opt_ PULONG BytesRead);
+
+HRESULT
+NTAPI
+RtlReadOutOfProcessMemoryStream( 
+    _In_ struct IStream *This,
+    _Out_writes_bytes_(Length) PVOID Buffer,
+    _In_ ULONG Length,
+    _Out_opt_ PULONG BytesRead);
+
+HRESULT
+NTAPI
+RtlSeekMemoryStream( 
+    _In_ struct IStream *This,
+    _In_ LARGE_INTEGER RelativeOffset,
+    _In_ ULONG Origin,
+    _Out_opt_ PULARGE_INTEGER ResultOffset);
+
+HRESULT
+NTAPI
+RtlCopyMemoryStreamTo( 
+    _In_ struct IStream *This,
+    _In_ struct IStream *Target,
+    _In_ ULARGE_INTEGER Length,
+    _Out_opt_ PULARGE_INTEGER BytesRead,
+    _Out_opt_ PULARGE_INTEGER BytesWritten);
+
+HRESULT
+NTAPI
+RtlCopyOutOfProcessMemoryStreamTo( 
+    _In_ struct IStream *This,
+    _In_ struct IStream *Target,
+    _In_ ULARGE_INTEGER Length,
+    _Out_opt_ PULARGE_INTEGER BytesRead,
+    _Out_opt_ PULARGE_INTEGER BytesWritten);
+
+HRESULT
+NTAPI
+RtlStatMemoryStream( 
+    _In_ struct IStream *This,
+    _Out_ struct tagSTATSTG *Stats,
+    _In_ ULONG Flags);
+
+// Dummy functions
+HRESULT
+NTAPI
+RtlWriteMemoryStream( 
+    _In_ struct IStream *This,
+    _In_reads_bytes_(Length) CONST VOID *Buffer,
+    _In_ ULONG Length,
+    _Out_opt_ PULONG BytesWritten);
+
+HRESULT
+NTAPI
+RtlSetMemoryStreamSize( 
+    _In_ struct IStream *This,
+    _In_ ULARGE_INTEGER NewSize);
+
+HRESULT
+NTAPI
+RtlCommitMemoryStream( 
+    _In_ struct IStream *This,
+    _In_ ULONG CommitFlags);
+
+HRESULT
+NTAPI
+RtlRevertMemoryStream( 
+    _In_ struct IStream *This);
+
+HRESULT
+NTAPI
+RtlLockMemoryStreamRegion( 
+    _In_ struct IStream *This,
+    _In_ ULARGE_INTEGER Offset,
+    _In_ ULARGE_INTEGER Length,
+    _In_ ULONG LockType);
+
+HRESULT
+NTAPI
+RtlUnlockMemoryStreamRegion( 
+    _In_ struct IStream *This,
+    _In_ ULARGE_INTEGER Offset,
+    _In_ ULARGE_INTEGER Length,
+    _In_ ULONG LockType);
+
+HRESULT
+NTAPI
+RtlCloneMemoryStream( 
+    _In_ struct IStream *This,
+    _Outptr_ struct IStream **ResultStream);
+
+#endif // NTOS_MODE_USER
+
 #ifdef __cplusplus
 }
 #endif
Index: include/ndk/rtltypes.h
===================================================================
--- include/ndk/rtltypes.h	(revision 60556)
+++ include/ndk/rtltypes.h	(working copy)
@@ -1559,6 +1559,42 @@
 
 #endif /* !NTOS_MODE_USER */
 
+#ifdef NTOS_MODE_USER
+
+#ifndef CONST_VTBL
+#ifdef CONST_VTABLE
+#define CONST_VTBL const
+#else
+#define CONST_VTBL
+#endif
+#endif
+
+// forward declarations
+struct IStreamVtbl;
+struct IStream;
+struct tagSTATSTG;
+
+typedef struct _RTL_MEMORY_STREAM RTL_MEMORY_STREAM, *PRTL_MEMORY_STREAM;
+
+typedef VOID 
+(NTAPI *PRTL_MEMORY_STREAM_FINAL_COMMIT_ROUTINE)(
+    _In_ PRTL_MEMORY_STREAM stream
+);
+
+struct _RTL_MEMORY_STREAM
+{
+    CONST_VTBL struct IStreamVtbl *Vtbl;
+    LONG RefCount;
+    ULONG Unk1;
+    PVOID Current;
+    PVOID Start;
+    PVOID End;
+    PRTL_MEMORY_STREAM_FINAL_COMMIT_ROUTINE FinalRelease;
+    HANDLE ProcessHandle;
+};
+
+#endif /* NTOS_MODE_USER */
+
 #ifdef __cplusplus
 }
 #endif
Index: lib/rtl/CMakeLists.txt
===================================================================
--- lib/rtl/CMakeLists.txt	(revision 60556)
+++ lib/rtl/CMakeLists.txt	(working copy)
@@ -33,6 +33,7 @@
     heapuser.c
     image.c
     interlck.c
+    memstream.c
     message.c
     largeint.c
     luid.c
Index: lib/rtl/memstream.c
===================================================================
--- lib/rtl/memstream.c	(revision 0)
+++ lib/rtl/memstream.c	(working copy)
@@ -0,0 +1,472 @@
+/* COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS system libraries
+ * FILE:            lib/rtl/mem.c
+ * PURPOSE:         MemoryStream functions
+ * PROGRAMMER:      David Quintana (gigaherz@gmail.com)
+ */
+
+/* INCLUDES *****************************************************************/
+
+#define COBJMACROS
+#define CONST_VTABLE
+
+#include <rtl.h>
+
+#define NDEBUG
+#include <debug.h>
+
+/* VIRTUAL METHOD TABLES *****************************************************/
+
+CONST_VTBL struct IStreamVtbl RtlMemoryStreamVtbl =
+{
+    RtlQueryInterfaceMemoryStream,
+    RtlAddRefMemoryStream,
+    RtlReleaseMemoryStream,
+    RtlReadMemoryStream,
+    RtlWriteMemoryStream,
+    RtlSeekMemoryStream,
+    RtlSetMemoryStreamSize,
+    RtlCopyMemoryStreamTo,
+    RtlCommitMemoryStream,
+    RtlRevertMemoryStream,
+    RtlLockMemoryStreamRegion,
+    RtlUnlockMemoryStreamRegion,
+    RtlStatMemoryStream,
+    RtlCloneMemoryStream,
+};
+
+CONST_VTBL struct IStreamVtbl RtlOutOfProcessMemoryStreamVtbl =
+{
+    RtlQueryInterfaceMemoryStream,
+    RtlAddRefMemoryStream,
+    RtlReleaseMemoryStream,
+    RtlReadOutOfProcessMemoryStream,
+    RtlWriteMemoryStream,
+    RtlSeekMemoryStream,
+    RtlSetMemoryStreamSize,
+    RtlCopyMemoryStreamTo,
+    RtlCommitMemoryStream,
+    RtlRevertMemoryStream,
+    RtlLockMemoryStreamRegion,
+    RtlUnlockMemoryStreamRegion,
+    RtlStatMemoryStream,
+    RtlCloneMemoryStream,
+};
+
+/* FUNCTIONS *****************************************************************/
+
+
+/* Convert a IStream pointer safely to the RTL_MEMORY_STREAM struct */
+static PRTL_MEMORY_STREAM IStream_To_RTL_MEMORY_STREAM(
+    _In_ IStream * Interface)
+{
+    if (NULL == Interface)
+        return NULL;
+
+    return (PRTL_MEMORY_STREAM)((ULONG_PTR)Interface - FIELD_OFFSET(RTL_MEMORY_STREAM, Vtbl));
+}
+
+/*
+ * @implemented
+ */
+VOID
+NTAPI
+RtlInitMemoryStream(
+    _Out_ PRTL_MEMORY_STREAM Stream)
+{
+    RtlZeroMemory(Stream, sizeof(RTL_MEMORY_STREAM));
+    Stream->Vtbl = &RtlMemoryStreamVtbl;
+}
+
+/*
+ * @implemented
+ */
+VOID
+NTAPI
+RtlInitOutOfProcessMemoryStream(
+    _Out_ PRTL_MEMORY_STREAM Stream)
+{
+    RtlZeroMemory(Stream, sizeof(RTL_MEMORY_STREAM));
+    Stream->Vtbl = &RtlOutOfProcessMemoryStreamVtbl;
+    Stream->FinalRelease = RtlFinalReleaseOutOfProcessMemoryStream;
+}
+
+/*
+ * @unimplemented
+ */
+VOID
+NTAPI
+RtlFinalReleaseOutOfProcessMemoryStream(
+    _In_ PRTL_MEMORY_STREAM Stream)
+{
+    UNIMPLEMENTED;
+}
+
+/*
+ * @implemented
+ */
+HRESULT
+NTAPI
+RtlQueryInterfaceMemoryStream(
+    _In_ IStream *This,
+    _In_ REFIID RequestedIid,
+    _Outptr_ PVOID *ResultObject)
+{
+    if (IsEqualGUID(&IID_IUnknown, RequestedIid)
+     || IsEqualGUID(&IID_ISequentialStream, RequestedIid)
+     || IsEqualGUID(&IID_IStream, RequestedIid))
+    {
+        IStream_AddRef(This);
+        *ResultObject = This;
+        return S_OK;
+    }
+
+    *ResultObject = NULL;
+    return E_NOINTERFACE;
+}
+
+/*
+ * @implemented
+ */
+ULONG
+NTAPI
+RtlAddRefMemoryStream(
+    _In_ IStream *This)
+{
+    PRTL_MEMORY_STREAM Stream = IStream_To_RTL_MEMORY_STREAM(This);
+
+    return InterlockedIncrement(&Stream->RefCount);
+}
+
+/*
+ * @implemented
+ */
+ULONG
+NTAPI
+RtlReleaseMemoryStream(
+    _In_ IStream *This)
+{
+    PRTL_MEMORY_STREAM Stream = IStream_To_RTL_MEMORY_STREAM(This);
+
+    LONG Result = InterlockedDecrement(&Stream->RefCount);
+
+    if (Result == 0)
+    {
+        if (Stream->FinalRelease)
+            Stream->FinalRelease(Stream);
+    }
+
+    return Result;
+}
+
+/*
+ * @implemented
+ */
+HRESULT
+NTAPI
+RtlReadMemoryStream(
+    _In_ IStream *This,
+    _Out_writes_bytes_(Length) PVOID Buffer,
+    _In_ ULONG Length,
+    _Out_opt_ PULONG BytesRead)
+{
+    ULONG CopyLength;
+    PRTL_MEMORY_STREAM Stream = IStream_To_RTL_MEMORY_STREAM(This);
+    SIZE_T Available = (PUCHAR)Stream->End - (PUCHAR)Stream->Current;
+
+    if (BytesRead)
+        *BytesRead = 0;
+
+    if (!Length)
+        return S_OK;
+
+    CopyLength = min(Available, Length);
+
+    RtlMoveMemory(Buffer, Stream->Current, CopyLength);
+
+    Stream->Current = (PUCHAR)Stream->Current + CopyLength;
+
+    *BytesRead = CopyLength;
+
+    return S_OK;
+}
+
+/*
+ * @implemented
+ */
+HRESULT
+NTAPI
+RtlReadOutOfProcessMemoryStream(
+    _In_ IStream *This,
+    _Out_writes_bytes_(Length) PVOID Buffer,
+    _In_ ULONG Length,
+    _Out_opt_ PULONG BytesRead)
+{
+    HRESULT Result;
+    ULONG CopyLength;
+    PRTL_MEMORY_STREAM Stream = IStream_To_RTL_MEMORY_STREAM(This);
+    SIZE_T Available = (PUCHAR)Stream->End - (PUCHAR)Stream->Current;
+
+    if (BytesRead)
+        *BytesRead = 0;
+
+    if (!Length)
+        return S_OK;
+
+    CopyLength = min(Available, Length);
+
+    Result = NtReadVirtualMemory(Stream->ProcessHandle, Stream->Current, Buffer, CopyLength, BytesRead);
+
+    if (NT_SUCCESS(Result))
+        Stream->Current = (PUCHAR)Stream->Current + *BytesRead;
+
+    return HRESULT_FROM_WIN32(RtlNtStatusToDosError(Result));
+}
+
+/*
+ * @implemented
+ */
+HRESULT
+NTAPI
+RtlSeekMemoryStream(
+    _In_ IStream *This,
+    _In_ LARGE_INTEGER RelativeOffset,
+    _In_ ULONG Origin,
+    _Out_opt_ PULARGE_INTEGER ResultOffset)
+{
+    PVOID Result;
+    PRTL_MEMORY_STREAM Stream = IStream_To_RTL_MEMORY_STREAM(This);
+
+    switch (Origin)
+    {
+    case STREAM_SEEK_SET:
+        Result = (PUCHAR)Stream->Start + RelativeOffset.QuadPart;
+        break;
+
+    case STREAM_SEEK_CUR:
+        Result = (PUCHAR)Stream->Current + RelativeOffset.QuadPart;
+        break;
+
+    case STREAM_SEEK_END:
+        Result = (PUCHAR)Stream->End + RelativeOffset.QuadPart;
+        break;
+
+    default:
+        return E_INVALIDARG;
+    }
+
+    if (Result < Stream->Start || Result > Stream->End)
+        return STG_E_INVALIDPOINTER;
+
+    Stream->Current = (PVOID)(ULONG_PTR)Result;
+
+    if (ResultOffset)
+    {
+        ResultOffset->QuadPart = (PUCHAR)Stream->Current - (PUCHAR)Stream->Start;
+    }
+
+    return S_OK;
+}
+
+/*
+ * @implemented
+ */
+HRESULT
+NTAPI
+RtlCopyMemoryStreamTo(
+    _In_ IStream *This,
+    _In_ IStream *Target,
+    _In_ ULARGE_INTEGER Length,
+    _Out_opt_ PULARGE_INTEGER BytesRead,
+    _Out_opt_ PULARGE_INTEGER BytesWritten)
+{
+    char Buffer[1024];
+    ULONGLONG TotalSize;
+    HRESULT Result = S_OK;
+
+    if (BytesRead)
+        BytesRead->QuadPart = 0;
+    if (BytesWritten)
+        BytesWritten->QuadPart = 0;
+
+    if (!Target)
+        return S_OK;
+
+    if (!Length.QuadPart)
+        return S_OK;
+
+    /* Copy data */
+    TotalSize = Length.QuadPart;
+    while (TotalSize)
+    {
+        ULONG ulLeft, ulAmt;
+
+        ulLeft = TotalSize > sizeof(Buffer) ? sizeof(Buffer) : TotalSize;
+
+        /* Read */
+        Result = IStream_Read(This, Buffer, ulLeft, &ulAmt);
+        if (BytesRead)
+            BytesRead->QuadPart += ulAmt;
+        if (FAILED(Result) || ulAmt != ulLeft)
+            break;
+
+        /* Write */
+        Result = IStream_Write(Target, Buffer, ulLeft, &ulAmt);
+        if (BytesWritten)
+            BytesWritten->QuadPart += ulAmt;
+        if (FAILED(Result) || ulAmt != ulLeft)
+            break;
+
+        TotalSize -= ulLeft;
+    }
+    return Result;
+}
+
+/*
+ * @implemented
+ */
+HRESULT
+NTAPI
+RtlStatMemoryStream(
+    _In_ IStream *This,
+    _Out_ STATSTG *Stats,
+    _In_ ULONG Flags)
+{
+    PRTL_MEMORY_STREAM Stream = IStream_To_RTL_MEMORY_STREAM(This);
+
+    if (!Stats)
+        return STG_E_INVALIDPOINTER;
+
+    RtlZeroMemory(Stats, sizeof(STATSTG));
+    Stats->type = STGTY_STREAM;
+    Stats->cbSize.QuadPart = (PUCHAR)Stream->End - (PUCHAR)Stream->Start;
+
+    return S_OK;
+}
+
+/* DUMMY FUNCTIONS ***********************************************************
+ *
+ * The following functions return E_NOTIMPL in Windows Server 2003.
+ */
+
+/*
+ * @implemented
+ */
+HRESULT
+NTAPI
+RtlWriteMemoryStream(
+    _In_ IStream *This,
+    _In_reads_bytes_(Length) const VOID *Buffer,
+    _In_ ULONG Length,
+    _Out_opt_ PULONG BytesWritten)
+{
+    UNREFERENCED_PARAMETER(This);
+    UNREFERENCED_PARAMETER(Buffer);
+    UNREFERENCED_PARAMETER(Length);
+    UNREFERENCED_PARAMETER(BytesWritten);
+
+    // Dummy
+    return E_NOTIMPL;
+}
+
+/*
+ * @implemented
+ */
+HRESULT
+NTAPI
+RtlSetMemoryStreamSize(
+    _In_ IStream *This,
+    _In_ ULARGE_INTEGER NewSize)
+{
+    UNREFERENCED_PARAMETER(This);
+    UNREFERENCED_PARAMETER(NewSize);
+
+    // Dummy
+    return E_NOTIMPL;
+}
+
+/*
+ * @implemented
+ */
+HRESULT
+NTAPI
+RtlCommitMemoryStream(
+    _In_ IStream *This,
+    _In_ ULONG CommitFlags)
+{
+    UNREFERENCED_PARAMETER(This);
+    UNREFERENCED_PARAMETER(CommitFlags);
+
+    // Dummy
+    return E_NOTIMPL;
+}
+
+/*
+ * @implemented
+ */
+HRESULT
+NTAPI
+RtlRevertMemoryStream(
+    _In_ IStream *This)
+{
+    UNREFERENCED_PARAMETER(This);
+
+    // Dummy
+    return E_NOTIMPL;
+}
+
+/*
+ * @implemented
+ */
+HRESULT
+NTAPI
+RtlLockMemoryStreamRegion(
+    _In_ IStream *This,
+    _In_ ULARGE_INTEGER Offset,
+    _In_ ULARGE_INTEGER Length,
+    _In_ ULONG LockType)
+{
+    UNREFERENCED_PARAMETER(This);
+    UNREFERENCED_PARAMETER(Offset);
+    UNREFERENCED_PARAMETER(Length);
+    UNREFERENCED_PARAMETER(LockType);
+
+    // Dummy
+    return E_NOTIMPL;
+}
+
+/*
+ * @implemented
+ */
+HRESULT
+NTAPI
+RtlUnlockMemoryStreamRegion(
+    _In_ IStream *This,
+    _In_ ULARGE_INTEGER Offset,
+    _In_ ULARGE_INTEGER Length,
+    _In_ ULONG LockType)
+{
+    UNREFERENCED_PARAMETER(This);
+    UNREFERENCED_PARAMETER(Offset);
+    UNREFERENCED_PARAMETER(Length);
+    UNREFERENCED_PARAMETER(LockType);
+
+    // Dummy
+    return E_NOTIMPL;
+}
+
+/*
+ * @implemented
+ */
+HRESULT
+NTAPI
+RtlCloneMemoryStream(
+    _In_ IStream *This,
+    _Outptr_ IStream **ResultStream)
+{
+    UNREFERENCED_PARAMETER(This);
+    UNREFERENCED_PARAMETER(ResultStream);
+
+    // Dummy
+    return E_NOTIMPL;
+}
