Author: janderwald
Date: Mon Jan 19 09:55:47 2009
New Revision: 38940
URL:
http://svn.reactos.org/svn/reactos?rev=38940&view=rev
Log:
- Experimental implementation of KsiCreateObjectType
Modified:
trunk/reactos/dll/directx/ksuser/ksuser.c
trunk/reactos/dll/directx/ksuser/ksuser.h
Modified: trunk/reactos/dll/directx/ksuser/ksuser.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ksuser/ksuser.…
==============================================================================
--- trunk/reactos/dll/directx/ksuser/ksuser.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/ksuser/ksuser.c [iso-8859-1] Mon Jan 19 09:55:47 2009
@@ -34,8 +34,39 @@
ACCESS_MASK DesiredAccess,
PHANDLE phHandle)
{
- UNIMPLEMENTED
- return 0;
+ NTSTATUS Status;
+ ULONG Length;
+ ULONG TotalSize;
+ LPWSTR pStr;
+ UNICODE_STRING ObjectName;
+ OBJECT_ATTRIBUTES ObjectAttributes;
+ IO_STATUS_BLOCK IoStatusBlock;
+
+ Length = wcslen(IID);
+
+ TotalSize = (Length * sizeof(WCHAR)) + BufferSize + 2 * sizeof(WCHAR);
+
+ pStr = HeapAlloc(GetProcessHeap(), 0, TotalSize);
+ if (!pStr)
+ return STATUS_INSUFFICIENT_RESOURCES;
+
+ wcscpy(pStr, (LPWSTR)IID);
+ pStr[Length] = L'\\';
+ memcpy(&pStr[Length+1], Buffer, BufferSize);
+ pStr[Length+1+BufferSize] = L'\0';
+
+ RtlInitUnicodeString(&ObjectName, pStr);
+
+ InitializeObjectAttributes(&ObjectAttributes, &ObjectName,
OBJ_CASE_INSENSITIVE, hHandle, NULL);
+
+ Status = NtCreateFile(phHandle, DesiredAccess, &ObjectAttributes,
&IoStatusBlock, NULL, FILE_ATTRIBUTE_NORMAL, 0, 1, 0, NULL, 0);
+ HeapFree(GetProcessHeap(), 0, pStr);
+ if (!NT_SUCCESS(Status))
+ {
+ *phHandle = INVALID_HANDLE_VALUE;
+ Status = RtlNtStatusToDosError(Status);
+ }
+ return Status;
}
/*++
Modified: trunk/reactos/dll/directx/ksuser/ksuser.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ksuser/ksuser.…
==============================================================================
--- trunk/reactos/dll/directx/ksuser/ksuser.h [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/ksuser/ksuser.h [iso-8859-1] Mon Jan 19 09:55:47 2009
@@ -1,5 +1,22 @@
+#ifndef KSUSER_H__
+#define KSUSER_H__
+
#define _KSDDK_
+
+#define WIN32_NO_STATUS
#include <windows.h>
-typedef LONG NTSTATUS;
+#include <ndk/ntndk.h>
+
+
#include <ks.h>
#include <reactos/helper.h>
+
+LPVOID
+__stdcall
+HeapAlloc(
+ HANDLE hHeap,
+ DWORD dwFlags,
+ DWORD dwBytes
+);
+
+#endif