Eric Pouech : advapi32: Fixed a couple items from previous patch (
spotted by G Pfeifer).
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Oct 23 06:12:26 CDT 2006
Module: wine
Branch: master
Commit: 5425cb35edc741e58279a88db4931db5b95d8fda
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5425cb35edc741e58279a88db4931db5b95d8fda
Author: Eric Pouech <eric.pouech at wanadoo.fr>
Date: Sat Oct 21 13:18:29 2006 +0200
advapi32: Fixed a couple items from previous patch (spotted by G Pfeifer).
---
dlls/advapi32/lsa.c | 19 +++++++++----------
1 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/dlls/advapi32/lsa.c b/dlls/advapi32/lsa.c
index 8c58334..2e1a04d 100644
--- a/dlls/advapi32/lsa.c
+++ b/dlls/advapi32/lsa.c
@@ -59,9 +59,8 @@ static void dumpLsaAttributes(PLSA_OBJEC
static void* ADVAPI_GetDomainName(unsigned sz, unsigned ofs)
{
HKEY key;
- BOOL useDefault = TRUE;
LONG ret;
- BYTE* ptr;
+ BYTE* ptr = NULL;
UNICODE_STRING* ustr;
static const WCHAR wVNETSUP[] = {
@@ -84,26 +83,26 @@ static void* ADVAPI_GetDomainName(unsign
ustr = (UNICODE_STRING*)(ptr + ofs);
ustr->MaximumLength = size;
ustr->Buffer = (WCHAR*)(ptr + sz);
- if ((ret = RegQueryValueExW(key, wg, NULL, NULL,
- (LPBYTE)ustr->Buffer, &size)) == ERROR_SUCCESS)
+ ret = RegQueryValueExW(key, wg, NULL, NULL, (LPBYTE)ustr->Buffer, &size);
+ if (ret != ERROR_SUCCESS)
{
- ustr->Length = (USHORT)(size - sizeof(WCHAR));
- useDefault = FALSE;
- }
- else
HeapFree(GetProcessHeap(), 0, ptr);
+ ptr = NULL;
+ }
+ else ustr->Length = size - sizeof(WCHAR);
}
RegCloseKey(key);
}
- if (useDefault)
+ if (!ptr)
{
static const WCHAR wDomain[] = {'D','O','M','A','I','N','\0'};
ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sz + sizeof(wDomain));
+ if (!ptr) return NULL;
ustr = (UNICODE_STRING*)(ptr + ofs);
ustr->MaximumLength = sizeof(wDomain);
ustr->Buffer = (WCHAR*)(ptr + sz);
- ustr->Length = (USHORT)(sizeof(wDomain) - sizeof(WCHAR));
+ ustr->Length = sizeof(wDomain) - sizeof(WCHAR);
memcpy(ustr->Buffer, wDomain, sizeof(wDomain));
}
return ptr;
More information about the wine-cvs
mailing list