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,126 @@
+/*
+ * PROJECT:         ReactOS api tests
+ * LICENSE:         GPLv2+ - See COPYING in the top level directory
+ * PURPOSE:         Test for the Rtl*MemoryStream* series of functions
+ * PROGRAMMER:      David Quintana <gigaherz@gmail.com>
+ */
+
+#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;
+
+    for (i = 0; i < sizeof(buffer2); i++)
+    {
+        buffer2[i] = i;
+    }
+
+    memset(&stream, 0x90, sizeof(stream));
+
+    RtlInitMemoryStream(&stream);
+
+    ok(stream.RefCount == 0, "RefCount has a wrong value: %d (expected %d).\n", stream.RefCount, 0);
+    
+    stream.Current = buffer2;
+    stream.Start = buffer2;
+    stream.End = buffer2 + sizeof(buffer2);
+
+    res = IStream_QueryInterface((struct IStream*)&stream, &IID_IStream, (void**)&istream);
+    
+    ok(res == 0, "QueryInterface to IStream returned wrong hResult: 0x%08x.\n", res);
+
+    ok(stream.RefCount == 1, "RefCount has a wrong value: %d (expected %d).\n", stream.RefCount, 1);
+    
+    
+    res = IStream_Stat(istream, &stat, STATFLAG_NONAME);
+
+    ok(res == 0, "Stat to IStream returned wrong hResult: 0x%08x.\n", res);
+
+    ok(stream.Current == buffer2,
+       "stream.Current points to the wrong address 0x%p (expected 0x%p)\n",
+       stream.Current, buffer2);
+    ok(stream.Start == buffer2, "stream.Start was changed unexpectedly\n");
+    ok(stream.End == buffer2 + sizeof(buffer2), "stream.End was changed unexpectedly\n");
+
+    ok(stat.cbSize.QuadPart == (stream.End - stream.Start),
+       "stat.cbSize has the wrong value %lld (expected %d)\n",
+       stat.cbSize.QuadPart, stream.End - stream.Start);
+
+    res = IStream_Read(istream, buffer, sizeof(buffer)-1, &written);
+    
+    ok(res == 0, "Read to IStream returned wrong hResult: 0x%08x.\n", res);
+    
+    if(res >= 0)
+    {
+        for (i = 0; i < written; i++)
+        {
+            ok(buffer[i] == i, "Buffer[%d] contains a wrong number %d (expected %d).\n", i, buffer[i], i);
+        }
+    }
+
+    ok(stream.Current == buffer2 + 79,
+       "stream.Current points to the wrong address 0x%p (expected 0x%p)\n",
+       stream.Current, buffer2);
+    ok(stream.Start == buffer2, "stream.Start was changed unexpectedly\n");
+    ok(stream.End == buffer2 + sizeof(buffer2), "stream.End was changed unexpectedly\n");
+
+    move.QuadPart = 40;
+
+    res = IStream_Seek(istream, move, STREAM_SEEK_SET, &size);
+    
+    ok(res == 0, "Seek to IStream returned wrong hResult: 0x%08x.\n", res);
+
+    ok(size.QuadPart == 40,
+       "Seek returned wrong offset %lld (expected %d)\n",
+       size.QuadPart, 40);
+
+    ok(stream.Current == buffer2 + 40,
+       "stream.Current points to the wrong address 0x%p (expected 0x%p)\n",
+       stream.Current, buffer2);
+    ok(stream.Start == buffer2, "stream.Start was changed unexpectedly\n");
+    ok(stream.End == buffer2 + sizeof(buffer2), "stream.End was changed unexpectedly\n");
+
+    res = IStream_Read(istream, buffer, sizeof(buffer)-1, &written);
+    
+    ok(res == 0, "Read to IStream returned wrong hResult: 0x%08x.\n", res);
+    
+    if(res >= 0)
+    {
+        for (i = 0; i < written; i++)
+        {
+            ok(buffer[i] == (i + 40), "Buffer[%d] contains a wrong number %d (expected %d).\n", i, buffer[i], i + 40);
+        }
+    }
+
+    ok(stream.Current == buffer2 + 40 + 79,
+       "stream.Current points to the wrong address 0x%p (expected 0x%p)\n",
+       stream.Current, buffer2);
+    ok(stream.Start == buffer2, "stream.Start was changed unexpectedly\n");
+    ok(stream.End == buffer2 + sizeof(buffer2), "stream.End was changed unexpectedly\n");
+
+    res = IStream_Release(istream);
+    
+    ok(res == 0, "Release to IStream returned wrong hResult: 0x%08x.\n", res);
+
+    ok(stream.RefCount == 0, "RefCount has a wrong value: %d (expected %d).\n", stream.RefCount, 0);
+}
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 }
