Module: wine Branch: master Commit: 731007886034dfd46dba3a006cd0c7790d091dd3 URL: http://source.winehq.org/git/wine.git/?a=commit;h=731007886034dfd46dba3a006c...
Author: Sebastian Lackner sebastian@fds-team.de Date: Mon Dec 22 20:27:07 2014 +0100
slc: Implement SLGetWindowsInformationDWORD.
---
dlls/slc/slc.c | 24 ++++++++++++++++++++++-- dlls/slc/tests/slc.c | 6 ------ 2 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/dlls/slc/slc.c b/dlls/slc/slc.c index 1b02c9b..a0d8999 100644 --- a/dlls/slc/slc.c +++ b/dlls/slc/slc.c @@ -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; }
/*********************************************************************** diff --git a/dlls/slc/tests/slc.c b/dlls/slc/tests/slc.c index 723cd4c..b9296b2 100644 --- a/dlls/slc/tests/slc.c +++ b/dlls/slc/tests/slc.c @@ -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"); }