Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
d336f1fe
Commit
d336f1fe
authored
Dec 22, 2014
by
Sebastian Lackner
Committed by
Alexandre Julliard
Mar 03, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll/tests: Add tests for NtQueryLicenseKey.
parent
72a41c50
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
180 additions
and
0 deletions
+180
-0
reg.c
dlls/ntdll/tests/reg.c
+180
-0
No files found.
dlls/ntdll/tests/reg.c
View file @
d336f1fe
...
...
@@ -130,6 +130,7 @@ static NTSTATUS (WINAPI * pNtCreateKey)( PHANDLE retkey, ACCESS_MASK access, con
ULONG
TitleIndex
,
const
UNICODE_STRING
*
class
,
ULONG
options
,
PULONG
dispos
);
static
NTSTATUS
(
WINAPI
*
pNtQueryKey
)(
HANDLE
,
KEY_INFORMATION_CLASS
,
PVOID
,
ULONG
,
PULONG
);
static
NTSTATUS
(
WINAPI
*
pNtQueryLicenseValue
)(
const
UNICODE_STRING
*
,
ULONG
*
,
PVOID
,
ULONG
,
ULONG
*
);
static
NTSTATUS
(
WINAPI
*
pNtQueryValueKey
)(
HANDLE
,
const
UNICODE_STRING
*
,
KEY_VALUE_INFORMATION_CLASS
,
void
*
,
DWORD
,
DWORD
*
);
static
NTSTATUS
(
WINAPI
*
pNtSetValueKey
)(
HANDLE
,
const
PUNICODE_STRING
,
ULONG
,
ULONG
,
const
void
*
,
ULONG
);
...
...
@@ -191,6 +192,10 @@ static BOOL InitFunctionPtrs(void)
NTDLL_GET_PROC
(
RtlZeroMemory
)
NTDLL_GET_PROC
(
RtlpNtQueryValueKey
)
NTDLL_GET_PROC
(
RtlOpenCurrentUser
)
/* optional functions */
pNtQueryLicenseValue
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtQueryLicenseValue"
);
return
TRUE
;
}
#undef NTDLL_GET_PROC
...
...
@@ -645,6 +650,180 @@ static void test_NtDeleteKey(void)
ok
(
status
==
STATUS_SUCCESS
,
"NtDeleteKey Failed: 0x%08x
\n
"
,
status
);
}
static
void
test_NtQueryLicenseKey
(
void
)
{
static
const
WCHAR
emptyW
[]
=
{
'E'
,
'M'
,
'P'
,
'T'
,
'Y'
,
0
};
UNICODE_STRING
name
;
WORD
buffer
[
32
];
NTSTATUS
status
;
ULONG
type
,
len
;
DWORD
value
;
if
(
!
pNtQueryLicenseValue
)
{
skip
(
"NtQueryLicenseValue not found, skipping tests
\n
"
);
return
;
}
type
=
0xdead
;
len
=
0xbeef
;
memset
(
&
name
,
0
,
sizeof
(
name
));
status
=
pNtQueryLicenseValue
(
&
name
,
&
type
,
buffer
,
sizeof
(
buffer
),
&
len
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"NtQueryLicenseValue returned %08x, expected STATUS_INVALID_PARAMETER
\n
"
,
status
);
ok
(
type
==
0xdead
,
"expected unmodified value for type, got %u
\n
"
,
type
);
ok
(
len
==
0xbeef
,
"expected unmodified value for len, got %u
\n
"
,
len
);
/* test with empty key */
pRtlCreateUnicodeStringFromAsciiz
(
&
name
,
""
);
type
=
0xdead
;
len
=
0xbeef
;
status
=
pNtQueryLicenseValue
(
NULL
,
&
type
,
buffer
,
sizeof
(
buffer
),
&
len
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"NtQueryLicenseValue returned %08x, expected STATUS_INVALID_PARAMETER
\n
"
,
status
);
ok
(
type
==
0xdead
,
"expected unmodified value for type, got %u
\n
"
,
type
);
ok
(
len
==
0xbeef
,
"expected unmodified value for len, got %u
\n
"
,
len
);
type
=
0xdead
;
status
=
pNtQueryLicenseValue
(
&
name
,
&
type
,
buffer
,
sizeof
(
buffer
),
NULL
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"NtQueryLicenseValue returned %08x, expected STATUS_INVALID_PARAMETER
\n
"
,
status
);
ok
(
type
==
0xdead
,
"expected unmodified value for type, got %u
\n
"
,
type
);
len
=
0xbeef
;
status
=
pNtQueryLicenseValue
(
&
name
,
NULL
,
buffer
,
sizeof
(
buffer
),
&
len
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"NtQueryLicenseValue returned %08x, expected STATUS_INVALID_PARAMETER
\n
"
,
status
);
ok
(
len
==
0xbeef
,
"expected unmodified value for len, got %u
\n
"
,
len
);
type
=
0xdead
;
len
=
0xbeef
;
status
=
pNtQueryLicenseValue
(
&
name
,
&
type
,
buffer
,
sizeof
(
buffer
),
&
len
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"NtQueryLicenseValue returned %08x, expected STATUS_INVALID_PARAMETER
\n
"
,
status
);
ok
(
type
==
0xdead
,
"expected unmodified value for type, got %u
\n
"
,
type
);
ok
(
len
==
0xbeef
,
"expected unmodified value for len, got %u
\n
"
,
len
);
pRtlFreeUnicodeString
(
&
name
);
/* test with nonexistent licence key */
pRtlCreateUnicodeStringFromAsciiz
(
&
name
,
"Nonexistent-License-Value"
);
type
=
0xdead
;
len
=
0xbeef
;
status
=
pNtQueryLicenseValue
(
NULL
,
&
type
,
buffer
,
sizeof
(
buffer
),
&
len
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"NtQueryLicenseValue returned %08x, expected STATUS_INVALID_PARAMETER
\n
"
,
status
);
ok
(
type
==
0xdead
,
"expected unmodified value for type, got %u
\n
"
,
type
);
ok
(
len
==
0xbeef
,
"expected unmodified value for len, got %u
\n
"
,
len
);
type
=
0xdead
;
status
=
pNtQueryLicenseValue
(
&
name
,
&
type
,
buffer
,
sizeof
(
buffer
),
NULL
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"NtQueryLicenseValue returned %08x, expected STATUS_INVALID_PARAMETER
\n
"
,
status
);
ok
(
type
==
0xdead
,
"expected unmodified value for type, got %u
\n
"
,
type
);
len
=
0xbeef
;
status
=
pNtQueryLicenseValue
(
&
name
,
NULL
,
buffer
,
sizeof
(
buffer
),
&
len
);
ok
(
status
==
STATUS_OBJECT_NAME_NOT_FOUND
,
"NtQueryLicenseValue returned %08x, expected STATUS_OBJECT_NAME_NOT_FOUND
\n
"
,
status
);
ok
(
len
==
0xbeef
,
"expected unmodified value for len, got %u
\n
"
,
len
);
type
=
0xdead
;
len
=
0xbeef
;
status
=
pNtQueryLicenseValue
(
&
name
,
&
type
,
buffer
,
sizeof
(
buffer
),
&
len
);
ok
(
status
==
STATUS_OBJECT_NAME_NOT_FOUND
,
"NtQueryLicenseValue unexpected suceeded
\n
"
);
ok
(
type
==
0xdead
,
"expected unmodified value for type, got %u
\n
"
,
type
);
ok
(
len
==
0xbeef
,
"expected unmodified value for len, got %u
\n
"
,
len
);
pRtlFreeUnicodeString
(
&
name
);
/* test with REG_SZ license key */
pRtlCreateUnicodeStringFromAsciiz
(
&
name
,
"Kernel-MUI-Language-Allowed"
);
type
=
0xdead
;
len
=
0xbeef
;
status
=
pNtQueryLicenseValue
(
NULL
,
&
type
,
buffer
,
sizeof
(
buffer
),
&
len
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"NtQueryLicenseValue returned %08x, expected STATUS_INVALID_PARAMETER
\n
"
,
status
);
ok
(
type
==
0xdead
,
"expected unmodified value for type, got %u
\n
"
,
type
);
ok
(
len
==
0xbeef
,
"expected unmodified value for len, got %u
\n
"
,
len
);
type
=
0xdead
;
status
=
pNtQueryLicenseValue
(
&
name
,
&
type
,
buffer
,
sizeof
(
buffer
),
NULL
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"NtQueryLicenseValue returned %08x, expected STATUS_INVALID_PARAMETER
\n
"
,
status
);
ok
(
type
==
0xdead
,
"expected unmodified value for type, got %u
\n
"
,
type
);
type
=
0xdead
;
len
=
0
;
status
=
pNtQueryLicenseValue
(
&
name
,
&
type
,
buffer
,
0
,
&
len
);
ok
(
status
==
STATUS_BUFFER_TOO_SMALL
,
"NtQueryLicenseValue returned %08x, expected STATUS_BUFFER_TOO_SMALL
\n
"
,
status
);
ok
(
type
==
REG_SZ
,
"expected type = REG_SZ, got %u
\n
"
,
type
);
ok
(
len
==
sizeof
(
emptyW
),
"expected len = %u, got %u
\n
"
,
(
DWORD
)
sizeof
(
emptyW
),
len
);
len
=
0
;
status
=
pNtQueryLicenseValue
(
&
name
,
NULL
,
buffer
,
0
,
&
len
);
ok
(
status
==
STATUS_BUFFER_TOO_SMALL
,
"NtQueryLicenseValue returned %08x, expected STATUS_BUFFER_TOO_SMALL
\n
"
,
status
);
ok
(
len
==
sizeof
(
emptyW
),
"expected len = %u, got %u
\n
"
,
(
DWORD
)
sizeof
(
emptyW
),
len
);
type
=
0xdead
;
len
=
0
;
memset
(
buffer
,
0x11
,
sizeof
(
buffer
));
status
=
pNtQueryLicenseValue
(
&
name
,
&
type
,
buffer
,
sizeof
(
buffer
),
&
len
);
ok
(
status
==
STATUS_SUCCESS
,
"NtQueryLicenseValue returned %08x, expected STATUS_SUCCESS
\n
"
,
status
);
ok
(
type
==
REG_SZ
,
"expected type = REG_SZ, got %u
\n
"
,
type
);
ok
(
len
==
sizeof
(
emptyW
),
"expected len = %u, got %u
\n
"
,
(
DWORD
)
sizeof
(
emptyW
),
len
);
ok
(
!
memcmp
(
buffer
,
emptyW
,
sizeof
(
emptyW
)),
"unexpected buffer content
\n
"
);
type
=
0xdead
;
len
=
0
;
memset
(
buffer
,
0x11
,
sizeof
(
buffer
));
status
=
pNtQueryLicenseValue
(
&
name
,
&
type
,
buffer
,
2
,
&
len
);
ok
(
status
==
STATUS_BUFFER_TOO_SMALL
,
"NtQueryLicenseValue returned %08x, expected STATUS_BUFFER_TOO_SMALL
\n
"
,
status
);
ok
(
type
==
REG_SZ
,
"expected type REG_SZ, got %u
\n
"
,
type
);
ok
(
len
==
sizeof
(
emptyW
),
"expected len = %u, got %u
\n
"
,
(
DWORD
)
sizeof
(
emptyW
),
len
);
ok
(
buffer
[
0
]
==
0x1111
,
"expected buffer[0] = 0x1111, got %u
\n
"
,
buffer
[
0
]);
pRtlFreeUnicodeString
(
&
name
);
/* test with REG_DWORD license key */
pRtlCreateUnicodeStringFromAsciiz
(
&
name
,
"Kernel-MUI-Number-Allowed"
);
type
=
0xdead
;
len
=
0xbeef
;
status
=
pNtQueryLicenseValue
(
NULL
,
&
type
,
&
value
,
sizeof
(
value
),
&
len
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"NtQueryLicenseValue returned %08x, expected STATUS_INVALID_PARAMETER
\n
"
,
status
);
ok
(
type
==
0xdead
,
"expected unmodified value for type, got %u
\n
"
,
type
);
ok
(
len
==
0xbeef
,
"expected unmodified value for len, got %u
\n
"
,
len
);
type
=
0xdead
;
status
=
pNtQueryLicenseValue
(
&
name
,
&
type
,
&
value
,
sizeof
(
value
),
NULL
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"NtQueryLicenseValue returned %08x, expected STATUS_INVALID_PARAMETER
\n
"
,
status
);
ok
(
type
==
0xdead
,
"expected unmodified value for type, got %u
\n
"
,
type
);
type
=
0xdead
;
len
=
0
;
status
=
pNtQueryLicenseValue
(
&
name
,
&
type
,
&
value
,
0
,
&
len
);
ok
(
status
==
STATUS_BUFFER_TOO_SMALL
,
"NtQueryLicenseValue returned %08x, expected STATUS_BUFFER_TOO_SMALL
\n
"
,
status
);
ok
(
type
==
REG_DWORD
,
"expected type = REG_DWORD, got %u
\n
"
,
type
);
ok
(
len
==
sizeof
(
value
),
"expected len = %u, got %u
\n
"
,
(
DWORD
)
sizeof
(
value
),
len
);
len
=
0
;
status
=
pNtQueryLicenseValue
(
&
name
,
NULL
,
&
value
,
0
,
&
len
);
ok
(
status
==
STATUS_BUFFER_TOO_SMALL
,
"NtQueryLicenseValue returned %08x, expected STATUS_BUFFER_TOO_SMALL
\n
"
,
status
);
ok
(
len
==
sizeof
(
value
),
"expected len = %u, got %u
\n
"
,
(
DWORD
)
sizeof
(
value
),
len
);
type
=
0xdead
;
len
=
0
;
value
=
0xdeadbeef
;
status
=
pNtQueryLicenseValue
(
&
name
,
&
type
,
&
value
,
sizeof
(
value
),
&
len
);
ok
(
status
==
STATUS_SUCCESS
,
"NtQueryLicenseValue returned %08x, expected STATUS_SUCCESS
\n
"
,
status
);
ok
(
type
==
REG_DWORD
,
"expected type = REG_DWORD, got %u
\n
"
,
type
);
ok
(
len
==
sizeof
(
value
),
"expected len = %u, got %u
\n
"
,
(
DWORD
)
sizeof
(
value
),
len
);
ok
(
value
!=
0xdeadbeef
,
"expected value != 0xdeadbeef
\n
"
);
type
=
0xdead
;
len
=
0
;
status
=
pNtQueryLicenseValue
(
&
name
,
&
type
,
&
value
,
2
,
&
len
);
ok
(
status
==
STATUS_BUFFER_TOO_SMALL
,
"NtQueryLicenseValue returned %08x, expected STATUS_BUFFER_TOO_SMALL
\n
"
,
status
);
ok
(
type
==
REG_DWORD
,
"expected type REG_DWORD, got %u
\n
"
,
type
);
ok
(
len
==
sizeof
(
value
),
"expected len = %u, got %u
\n
"
,
(
DWORD
)
sizeof
(
value
),
len
);
pRtlFreeUnicodeString
(
&
name
);
}
static
void
test_RtlpNtQueryValueKey
(
void
)
{
NTSTATUS
status
;
...
...
@@ -1346,6 +1525,7 @@ START_TEST(reg)
test_RtlpNtQueryValueKey
();
test_NtFlushKey
();
test_NtQueryKey
();
test_NtQueryLicenseKey
();
test_NtQueryValueKey
();
test_long_value_name
();
test_NtDeleteKey
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment