Author: jgardou
Date: Mon Sep 29 13:35:59 2014
New Revision: 64393
URL:
http://svn.reactos.org/svn/reactos?rev=64393&view=rev
Log:
[ADVAPI32_APITEST]
- Add a few tests regarding HKEY_CLASSES_ROOT special keys.
Added:
trunk/rostests/apitests/advapi32/HKEY_CLASSES_ROOT.c (with props)
Modified:
trunk/rostests/apitests/advapi32/CMakeLists.txt
trunk/rostests/apitests/advapi32/testlist.c
Modified: trunk/rostests/apitests/advapi32/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/CMakeLi…
==============================================================================
--- trunk/rostests/apitests/advapi32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/apitests/advapi32/CMakeLists.txt [iso-8859-1] Mon Sep 29 13:35:59 2014
@@ -1,6 +1,7 @@
list(APPEND SOURCE
CreateService.c
+ HKEY_CLASSES_ROOT.c
LockDatabase.c
QueryServiceConfig2.c
RtlEncryptMemory.c
Added: trunk/rostests/apitests/advapi32/HKEY_CLASSES_ROOT.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/HKEY_CL…
==============================================================================
--- trunk/rostests/apitests/advapi32/HKEY_CLASSES_ROOT.c (added)
+++ trunk/rostests/apitests/advapi32/HKEY_CLASSES_ROOT.c [iso-8859-1] Mon Sep 29 13:35:59
2014
@@ -0,0 +1,83 @@
+/*
+ * PROJECT: ReactOS api tests
+ * LICENSE: GPLv2+ - See COPYING in the top level directory
+ * PURPOSE: Test for CreateService
+ * PROGRAMMER: Thomas Faber <thomas.faber(a)reactos.org>
+ */
+
+#include <apitest.h>
+
+#define WIN32_NO_STATUS
+#include <winreg.h>
+#include <ndk/rtlfuncs.h>
+#include <ndk/cmfuncs.h>
+#include <ndk/cmtypes.h>
+
+#define IS_HKCR(hk) ((UINT_PTR)hk > 0 && ((UINT_PTR)hk & 3) == 2)
+
+static
+void
+Test_KeyInformation(void)
+{
+ HKEY KeyHandle;
+ DWORD ErrorCode;
+ NTSTATUS Status;
+ UNICODE_STRING KeyName =
RTL_CONSTANT_STRING(L"\\Registry\\Machine\\Software\\Classes\\CLSID");
+ UNICODE_STRING InfoName;
+ CHAR Buffer[FIELD_OFFSET(KEY_NAME_INFORMATION, Name[512])];
+ PKEY_NAME_INFORMATION NameInfo = (PKEY_NAME_INFORMATION)Buffer;
+ ULONG ResultLength;
+
+
+ ErrorCode = RegOpenKeyExW(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_READ,
&KeyHandle);
+ ok_dec(ErrorCode, ERROR_SUCCESS);
+ ok(IS_HKCR(KeyHandle), "\n");
+
+ Status = NtQueryKey(KeyHandle, KeyNameInformation, NameInfo, sizeof(Buffer),
&ResultLength);
+ ok_ntstatus(Status, STATUS_SUCCESS);
+ RtlInitUnicodeString(&InfoName, NameInfo->Name);
+ InfoName.Length = NameInfo->NameLength;
+ ok(RtlCompareUnicodeString(&KeyName, &InfoName, TRUE) == 0,
"%.*S\n", InfoName.Length, InfoName.Buffer);
+
+ RegCloseKey(KeyHandle);
+}
+
+static
+void
+Test_DuplicateHandle(void)
+{
+ HKEY KeyHandle, DupHandle;
+ DWORD ErrorCode;
+ BOOL Duplicated;
+ NTSTATUS Status;
+ UNICODE_STRING KeyName =
RTL_CONSTANT_STRING(L"\\Registry\\Machine\\Software\\Classes\\CLSID");
+ UNICODE_STRING InfoName;
+ CHAR Buffer[FIELD_OFFSET(KEY_NAME_INFORMATION, Name[512])];
+ PKEY_NAME_INFORMATION NameInfo = (PKEY_NAME_INFORMATION)Buffer;
+ ULONG ResultLength;
+
+
+ ErrorCode = RegOpenKeyExW(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_READ,
&KeyHandle);
+ ok_dec(ErrorCode, ERROR_SUCCESS);
+ ok(IS_HKCR(KeyHandle), "\n");
+
+ Duplicated = DuplicateHandle(GetCurrentProcess(), KeyHandle, GetCurrentProcess(),
(PHANDLE)&DupHandle, 0, 0, DUPLICATE_SAME_ACCESS);
+ ok(Duplicated, "\n");
+ ok(DupHandle != NULL, "\n");
+ ok(!IS_HKCR(DupHandle), "\n");
+
+ Status = NtQueryKey(DupHandle, KeyNameInformation, NameInfo, sizeof(Buffer),
&ResultLength);
+ ok_ntstatus(Status, STATUS_SUCCESS);
+ RtlInitUnicodeString(&InfoName, NameInfo->Name);
+ InfoName.Length = NameInfo->NameLength;
+ ok(RtlCompareUnicodeString(&KeyName, &InfoName, TRUE) == 0, "%S\n",
NameInfo->Name);
+
+ RegCloseKey(KeyHandle);
+ RegCloseKey(DupHandle);
+}
+
+START_TEST(HKEY_CLASSES_ROOT)
+{
+ Test_KeyInformation();
+ Test_DuplicateHandle();
+}
Propchange: trunk/rostests/apitests/advapi32/HKEY_CLASSES_ROOT.c
------------------------------------------------------------------------------
charset = UTF-8
Propchange: trunk/rostests/apitests/advapi32/HKEY_CLASSES_ROOT.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/rostests/apitests/advapi32/HKEY_CLASSES_ROOT.c
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: trunk/rostests/apitests/advapi32/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/testlis…
==============================================================================
--- trunk/rostests/apitests/advapi32/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/advapi32/testlist.c [iso-8859-1] Mon Sep 29 13:35:59 2014
@@ -4,6 +4,7 @@
#include <apitest.h>
extern void func_CreateService(void);
+extern void func_HKEY_CLASSES_ROOT(void);
extern void func_LockDatabase(void);
extern void func_QueryServiceConfig2(void);
extern void func_RtlEncryptMemory(void);
@@ -12,6 +13,7 @@
const struct test winetest_testlist[] =
{
{ "CreateService", func_CreateService },
+ { "HKEY_CLASSES_ROOT", func_HKEY_CLASSES_ROOT },
{ "LockDatabase" , func_LockDatabase },
{ "QueryServiceConfig2", func_QueryServiceConfig2 },
{ "RtlEncryptMemory", func_RtlEncryptMemory },