mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[ADVAPI32] Don't treat a structure pointer as a string pointer (#5478)
Add a string pointer local variable, assign it and operate on it. This should eliminate an exception and make LsapIsLocalComputer() function operate correctly. CORE-18996
This commit is contained in:
parent
4511e62b10
commit
dcaf5686ce
1 changed files with 5 additions and 3 deletions
|
@ -23,15 +23,17 @@ LsapIsLocalComputer(PLSA_UNICODE_STRING ServerName)
|
|||
DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
|
||||
BOOL Result;
|
||||
LPWSTR buf;
|
||||
PCWSTR pSrvName;
|
||||
|
||||
if (ServerName == NULL || ServerName->Length == 0 || ServerName->Buffer == NULL)
|
||||
return TRUE;
|
||||
|
||||
pSrvName = ServerName->Buffer;
|
||||
buf = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR));
|
||||
Result = GetComputerNameW(buf, &dwSize);
|
||||
if (Result && (ServerName->Buffer[0] == '\\') && (ServerName->Buffer[1] == '\\'))
|
||||
ServerName += 2;
|
||||
Result = Result && !lstrcmpW(ServerName->Buffer, buf);
|
||||
if (Result && (pSrvName[0] == L'\\') && (pSrvName[1] == L'\\'))
|
||||
pSrvName += 2;
|
||||
Result = Result && !lstrcmpW(pSrvName, buf);
|
||||
HeapFree(GetProcessHeap(), 0, buf);
|
||||
|
||||
return Result;
|
||||
|
|
Loading…
Reference in a new issue