slc: Implement SLGetWindowsInformationDWORD.

This commit is contained in:
Sebastian Lackner 2014-12-22 20:27:07 +01:00 committed by Alexandre Julliard
parent 2daca626d4
commit 7310078860
2 changed files with 22 additions and 8 deletions

View File

@ -19,8 +19,11 @@
#include <stdarg.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
#include "winbase.h"
#include "winternl.h"
#include "wine/debug.h"
#include "slpublic.h"
@ -37,9 +40,26 @@ HRESULT WINAPI SLGetWindowsInformation(LPCWSTR name, SLDATATYPE *type, UINT *val
HRESULT WINAPI SLGetWindowsInformationDWORD(LPCWSTR lpszValueName, LPDWORD pdwValue)
{
FIXME("(%s) stub\n", debugstr_w(lpszValueName) );
UNICODE_STRING nameW;
NTSTATUS status;
ULONG type, len;
return SL_E_RIGHT_NOT_GRANTED;
TRACE("(%s)\n", debugstr_w(lpszValueName) );
if (!lpszValueName || !pdwValue)
return E_INVALIDARG;
if (!lpszValueName[0])
return SL_E_RIGHT_NOT_GRANTED;
RtlInitUnicodeString( &nameW, lpszValueName );
status = NtQueryLicenseValue( &nameW, &type, pdwValue, sizeof(DWORD), &len );
if (status == STATUS_OBJECT_NAME_NOT_FOUND)
return SL_E_VALUE_NOT_FOUND;
if ((!status || status == STATUS_BUFFER_TOO_SMALL) && (type != REG_DWORD))
return SL_E_DATATYPE_MISMATCHED;
return status ? E_FAIL : S_OK;
}
/***********************************************************************

View File

@ -40,16 +40,13 @@ static void test_SLGetWindowsInformationDWORD(void)
HRESULT res;
res = SLGetWindowsInformationDWORD(NonexistentLicenseValueW, NULL);
todo_wine
ok(res == E_INVALIDARG, "expected E_INVALIDARG, got %08x\n", res);
res = SLGetWindowsInformationDWORD(NULL, &value);
todo_wine
ok(res == E_INVALIDARG, "expected E_INVALIDARG, got %08x\n", res);
value = 0xdeadbeef;
res = SLGetWindowsInformationDWORD(NonexistentLicenseValueW, &value);
todo_wine
ok(res == SL_E_VALUE_NOT_FOUND, "expected SL_E_VALUE_NOT_FOUND, got %08x\n", res);
ok(value == 0xdeadbeef, "expected value = 0xdeadbeef, got %u\n", value);
@ -61,15 +58,12 @@ static void test_SLGetWindowsInformationDWORD(void)
value = 0xdeadbeef;
res = SLGetWindowsInformationDWORD(KernelMUILanguageAllowedW, &value);
todo_wine
ok(res == SL_E_DATATYPE_MISMATCHED, "expected SL_E_DATATYPE_MISMATCHED, got %08x\n", res);
ok(value == 0xdeadbeef, "expected value = 0xdeadbeef, got %u\n", value);
value = 0xdeadbeef;
res = SLGetWindowsInformationDWORD(KernelMUINumberAllowedW, &value);
todo_wine
ok(res == S_OK, "expected S_OK, got %u\n", res);
todo_wine
ok(value != 0xdeadbeef, "expected value != 0xdeadbeef\n");
}