Index: apitests/ntdll/CMakeLists.txt
===================================================================
--- apitests/ntdll/CMakeLists.txt	(revision 60442)
+++ apitests/ntdll/CMakeLists.txt	(working copy)
@@ -21,6 +21,7 @@
     RtlGetLengthWithoutTrailingPathSeperators.c
     RtlGetLongestNtPathLength.c
     RtlInitializeBitMap.c
+    RtlMemoryStream.c
     SystemInfo.c
     Timer.c
     testlist.c)
@@ -30,7 +31,7 @@
 endif()
 
 add_executable(ntdll_apitest ${SOURCE} ${ntdll_apitest_asm})
-target_link_libraries(ntdll_apitest wine ${PSEH_LIB})
+target_link_libraries(ntdll_apitest wine uuid ${PSEH_LIB})
 set_module_type(ntdll_apitest win32cui)
 add_importlibs(ntdll_apitest msvcrt advapi32 kernel32 ntdll)
 
Index: apitests/ntdll/RtlMemoryStream.c
===================================================================
--- apitests/ntdll/RtlMemoryStream.c	(revision 0)
+++ apitests/ntdll/RtlMemoryStream.c	(working copy)
@@ -0,0 +1,140 @@
+
+#define COBJMACROS
+
+#include <apitest.h>
+#include <ndk/rtlfuncs.h>
+#include <ole2.h>
+#include <WTypes.h>
+#include <stdio.h>
+
+START_TEST(RtlMemoryStream)
+{
+    LARGE_INTEGER move;
+    ULARGE_INTEGER size;
+    HRESULT res;
+    int i;
+
+    RTL_MEMORY_STREAM stream;
+
+    IStream * istream;
+
+    BYTE buffer[80];
+    BYTE buffer2[180];
+    DWORD written;
+
+    STATSTG stat;
+
+    memset(&stream, 0x90, sizeof(stream));
+
+    RtlInitMemoryStream(&stream);
+
+    printf("Vtbl Read: 0x%08p\n", stream.lpVtbl->Read);
+    printf("Vtbl Seek: 0x%08p\n", stream.lpVtbl->Seek);
+    printf("Vtbl CopyTo: 0x%08p\n", stream.lpVtbl->CopyTo);
+    printf("Vtbl Stat: 0x%08p\n", stream.lpVtbl->Stat);
+
+    for (i = 0; i < sizeof(buffer2); i++)
+    {
+        buffer2[i] = i;
+    }
+
+    stream.Offset = buffer2;
+    stream.Start = 0;
+    stream.Size = sizeof(buffer2);
+    stream.Unk2 = 0;
+    stream.Unk3 = 0;
+
+    printf("Size %d\n", stream.Size);
+    printf("Start %d\n", stream.Start);
+    printf("Buffer %p\n", stream.Offset);
+
+    if (FAILED(res = IStream_QueryInterface((struct IStream*)&stream, &IID_IStream, (void**)&istream)))
+    {
+        printf("QueryInterface to IStream failed with 0x%08x.\n", res);
+    }
+    else if (res != 0)
+    {
+        printf("QueryInterface to IStream returned %d.\n", res);
+    }
+    
+    if (FAILED(res = IStream_Stat(istream, &stat, STATFLAG_NONAME)))
+    {
+        printf("Stat to IStream failed with 0x%08x.\n", res);
+    }
+    else if (res != 0)
+    {
+        printf("Stat to IStream returned %d.\n", res);
+    }
+    
+    printf("Size %d\n", stream.Size);
+    printf("Start %d\n", stream.Start);
+    printf("Buffer %p\n", stream.Offset);
+    printf("cbSize %d\n", stat.cbSize);
+
+    if (FAILED(res = IStream_Read(istream, buffer, sizeof(buffer)-1, &written)))
+    {
+        printf("Read to IStream failed with 0x%08x.\n", res);
+    }
+    else
+    {
+        printf("Read to IStream returned %d (%d read).\n", res, written);
+
+        printf("Buffer: ");
+        for (i = 0; i < written; i++)
+        {
+            printf("%02x ", buffer[i]);
+        }
+        printf("\n");
+    }
+
+    printf("Size %d\n", stream.Size);
+    printf("Start %d\n", stream.Start);
+    printf("Buffer %p\n", stream.Offset);
+
+    move.QuadPart = 0;
+
+    if (FAILED(res = IStream_Seek(istream, move, STREAM_SEEK_CUR, &size)))
+    {
+        printf("Read to IStream failed with 0x%08x.\n", res);
+    }
+    else
+    {
+        printf("Read to IStream returned %d (offset %d).\n", res, size.LowPart);
+    }
+
+    printf("Size %d\n", stream.Size);
+    printf("Start %d\n", stream.Start);
+    printf("Buffer %p\n", stream.Offset);
+
+    if (FAILED(res = IStream_Read(istream, buffer, sizeof(buffer) -1, &written)))
+    {
+        printf("Read to IStream failed with 0x%08x.\n", res);
+    }
+    else
+    {
+        printf("Read to IStream returned %d (%d read).\n", res, written);
+
+        printf("Buffer: ");
+        for (i = 0; i < written; i++)
+        {
+            printf("%02x ", buffer[i]);
+        }
+        printf("\n");
+    }
+
+    printf("Size %d\n", stream.Size);
+    printf("Start %d\n", stream.Start);
+    printf("Buffer %p\n", stream.Offset);
+
+    if (FAILED(res = IStream_Release(istream)))
+    {
+        printf("Release to IStream failed with 0x%08x.\n", res);
+    }
+    else if (res != 0)
+    {
+        printf("Release to IStream returned %d.\n", res);
+    }
+
+    printf("RefCount %p\n", stream.RefCount);
+}
+
Index: apitests/ntdll/testlist.c
===================================================================
--- apitests/ntdll/testlist.c	(revision 60442)
+++ apitests/ntdll/testlist.c	(working copy)
@@ -25,6 +25,7 @@
 extern void func_RtlGetLengthWithoutTrailingPathSeperators(void);
 extern void func_RtlGetLongestNtPathLength(void);
 extern void func_RtlInitializeBitMap(void);
+extern void func_RtlMemoryStream(void);
 extern void func_TimerResolution(void);
 
 const struct test winetest_testlist[] =
@@ -51,6 +52,7 @@
     { "RtlGetLengthWithoutTrailingPathSeperators", func_RtlGetLengthWithoutTrailingPathSeperators },
     { "RtlGetLongestNtPathLength",      func_RtlGetLongestNtPathLength },
     { "RtlInitializeBitMap",            func_RtlInitializeBitMap },
+    { "RtlMemoryStream",                func_RtlMemoryStream },
     { "TimerResolution",                func_TimerResolution },
 
     { 0, 0 }
