Commit 2daca626 authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

ntdll: Implement [Nt|Zw]QueryLicenseValue.

parent dc0f544d
......@@ -255,6 +255,7 @@
@ stub NtQueryIntervalProfile
@ stdcall NtQueryIoCompletion(long long ptr long ptr)
@ stdcall NtQueryKey (long long ptr long ptr)
@ stdcall NtQueryLicenseValue(ptr ptr ptr long ptr)
@ stdcall NtQueryMultipleValueKey(long ptr long ptr long ptr)
@ stdcall NtQueryMutant(long long ptr long ptr)
@ stdcall NtQueryObject(long long long long long)
......@@ -1134,6 +1135,7 @@
@ stub ZwQueryIntervalProfile
@ stdcall ZwQueryIoCompletion(long long ptr long ptr) NtQueryIoCompletion
@ stdcall ZwQueryKey(long long ptr long ptr) NtQueryKey
@ stdcall ZwQueryLicenseValue(ptr ptr ptr long ptr) NtQueryLicenseValue
@ stdcall ZwQueryMultipleValueKey(long ptr long ptr long ptr) NtQueryMultipleValueKey
@ stdcall ZwQueryMutant(long long ptr long ptr) NtQueryMutant
@ stdcall ZwQueryObject(long long long long long) NtQueryObject
......
......@@ -1401,3 +1401,67 @@ NTSTATUS WINAPI RtlWriteRegistryValue( ULONG RelativeTo, PCWSTR path, PCWSTR nam
return status;
}
/*************************************************************************
* NtQueryLicenseValue [NTDLL.@]
*
* NOTES
* On Windows all license properties are stored in a single key, but
* unless there is some app which explicitly depends on that, there is
* no good reason to reproduce that.
*/
NTSTATUS WINAPI NtQueryLicenseValue( const UNICODE_STRING *name, ULONG *result_type,
PVOID data, ULONG length, ULONG *result_len )
{
static const WCHAR LicenseInformationW[] = {'M','a','c','h','i','n','e','\\',
'S','o','f','t','w','a','r','e','\\',
'W','i','n','e','\\','L','i','c','e','n','s','e',
'I','n','f','o','r','m','a','t','i','o','n',0};
KEY_VALUE_PARTIAL_INFORMATION *info;
NTSTATUS status = STATUS_OBJECT_NAME_NOT_FOUND;
DWORD info_length, count;
OBJECT_ATTRIBUTES attr;
UNICODE_STRING keyW;
HANDLE hkey;
if (!name || !name->Buffer || !name->Length || !result_len)
return STATUS_INVALID_PARAMETER;
info_length = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data) + length;
info = RtlAllocateHeap( GetProcessHeap(), 0, info_length );
if (!info) return STATUS_NO_MEMORY;
attr.Length = sizeof(attr);
attr.RootDirectory = 0;
attr.ObjectName = &keyW;
attr.Attributes = 0;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
RtlInitUnicodeString( &keyW, LicenseInformationW );
/* @@ Wine registry key: HKLM\Software\Wine\LicenseInformation */
if (!NtOpenKey( &hkey, KEY_READ, &attr ))
{
status = NtQueryValueKey( hkey, name, KeyValuePartialInformation,
info, info_length, &count );
if (!status || status == STATUS_BUFFER_OVERFLOW)
{
if (result_type)
*result_type = info->Type;
*result_len = info->DataLength;
if (status == STATUS_BUFFER_OVERFLOW)
status = STATUS_BUFFER_TOO_SMALL;
else
memcpy( data, info->Data, info->DataLength );
}
NtClose( hkey );
}
if (status == STATUS_OBJECT_NAME_NOT_FOUND)
FIXME( "License key %s not found\n", debugstr_w(name->Buffer) );
RtlFreeHeap( GetProcessHeap(), 0, info );
return status;
}
......@@ -661,7 +661,7 @@ static void test_NtQueryLicenseKey(void)
if (!pNtQueryLicenseValue)
{
skip("NtQueryLicenseValue not found, skipping tests\n");
win_skip("NtQueryLicenseValue not found, skipping tests\n");
return;
}
......
......@@ -2189,6 +2189,7 @@ NTSYSAPI NTSTATUS WINAPI NtQuerySystemTime(PLARGE_INTEGER);
NTSYSAPI NTSTATUS WINAPI NtQueryTimer(HANDLE,TIMER_INFORMATION_CLASS,PVOID,ULONG,PULONG);
NTSYSAPI NTSTATUS WINAPI NtQueryTimerResolution(PULONG,PULONG,PULONG);
NTSYSAPI NTSTATUS WINAPI NtQueryValueKey(HANDLE,const UNICODE_STRING *,KEY_VALUE_INFORMATION_CLASS,void *,DWORD,DWORD *);
NTSYSAPI NTSTATUS WINAPI NtQueryLicenseValue(const UNICODE_STRING *,ULONG *,PVOID,ULONG,ULONG *);
NTSYSAPI NTSTATUS WINAPI NtQueryVirtualMemory(HANDLE,LPCVOID,MEMORY_INFORMATION_CLASS,PVOID,SIZE_T,SIZE_T*);
NTSYSAPI NTSTATUS WINAPI NtQueryVolumeInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,FS_INFORMATION_CLASS);
NTSYSAPI NTSTATUS WINAPI NtRaiseException(PEXCEPTION_RECORD,PCONTEXT,BOOL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment