advapi32: Fixed a couple items from previous patch (spotted by G Pfeifer).
This commit is contained in:
parent
ec087dac4f
commit
5425cb35ed
|
@ -59,9 +59,8 @@ static void dumpLsaAttributes(PLSA_OBJECT_ATTRIBUTES oa)
|
||||||
static void* ADVAPI_GetDomainName(unsigned sz, unsigned ofs)
|
static void* ADVAPI_GetDomainName(unsigned sz, unsigned ofs)
|
||||||
{
|
{
|
||||||
HKEY key;
|
HKEY key;
|
||||||
BOOL useDefault = TRUE;
|
|
||||||
LONG ret;
|
LONG ret;
|
||||||
BYTE* ptr;
|
BYTE* ptr = NULL;
|
||||||
UNICODE_STRING* ustr;
|
UNICODE_STRING* ustr;
|
||||||
|
|
||||||
static const WCHAR wVNETSUP[] = {
|
static const WCHAR wVNETSUP[] = {
|
||||||
|
@ -84,26 +83,26 @@ static void* ADVAPI_GetDomainName(unsigned sz, unsigned ofs)
|
||||||
ustr = (UNICODE_STRING*)(ptr + ofs);
|
ustr = (UNICODE_STRING*)(ptr + ofs);
|
||||||
ustr->MaximumLength = size;
|
ustr->MaximumLength = size;
|
||||||
ustr->Buffer = (WCHAR*)(ptr + sz);
|
ustr->Buffer = (WCHAR*)(ptr + sz);
|
||||||
if ((ret = RegQueryValueExW(key, wg, NULL, NULL,
|
ret = RegQueryValueExW(key, wg, NULL, NULL, (LPBYTE)ustr->Buffer, &size);
|
||||||
(LPBYTE)ustr->Buffer, &size)) == ERROR_SUCCESS)
|
if (ret != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ustr->Length = (USHORT)(size - sizeof(WCHAR));
|
|
||||||
useDefault = FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
HeapFree(GetProcessHeap(), 0, ptr);
|
HeapFree(GetProcessHeap(), 0, ptr);
|
||||||
|
ptr = NULL;
|
||||||
|
}
|
||||||
|
else ustr->Length = size - sizeof(WCHAR);
|
||||||
}
|
}
|
||||||
RegCloseKey(key);
|
RegCloseKey(key);
|
||||||
}
|
}
|
||||||
if (useDefault)
|
if (!ptr)
|
||||||
{
|
{
|
||||||
static const WCHAR wDomain[] = {'D','O','M','A','I','N','\0'};
|
static const WCHAR wDomain[] = {'D','O','M','A','I','N','\0'};
|
||||||
ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||||
sz + sizeof(wDomain));
|
sz + sizeof(wDomain));
|
||||||
|
if (!ptr) return NULL;
|
||||||
ustr = (UNICODE_STRING*)(ptr + ofs);
|
ustr = (UNICODE_STRING*)(ptr + ofs);
|
||||||
ustr->MaximumLength = sizeof(wDomain);
|
ustr->MaximumLength = sizeof(wDomain);
|
||||||
ustr->Buffer = (WCHAR*)(ptr + sz);
|
ustr->Buffer = (WCHAR*)(ptr + sz);
|
||||||
ustr->Length = (USHORT)(sizeof(wDomain) - sizeof(WCHAR));
|
ustr->Length = sizeof(wDomain) - sizeof(WCHAR);
|
||||||
memcpy(ustr->Buffer, wDomain, sizeof(wDomain));
|
memcpy(ustr->Buffer, wDomain, sizeof(wDomain));
|
||||||
}
|
}
|
||||||
return ptr;
|
return ptr;
|
||||||
|
|
Loading…
Reference in New Issue