mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 16:23:01 +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;
|
DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
|
||||||
BOOL Result;
|
BOOL Result;
|
||||||
LPWSTR buf;
|
LPWSTR buf;
|
||||||
|
PCWSTR pSrvName;
|
||||||
|
|
||||||
if (ServerName == NULL || ServerName->Length == 0 || ServerName->Buffer == NULL)
|
if (ServerName == NULL || ServerName->Length == 0 || ServerName->Buffer == NULL)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
pSrvName = ServerName->Buffer;
|
||||||
buf = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR));
|
buf = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR));
|
||||||
Result = GetComputerNameW(buf, &dwSize);
|
Result = GetComputerNameW(buf, &dwSize);
|
||||||
if (Result && (ServerName->Buffer[0] == '\\') && (ServerName->Buffer[1] == '\\'))
|
if (Result && (pSrvName[0] == L'\\') && (pSrvName[1] == L'\\'))
|
||||||
ServerName += 2;
|
pSrvName += 2;
|
||||||
Result = Result && !lstrcmpW(ServerName->Buffer, buf);
|
Result = Result && !lstrcmpW(pSrvName, buf);
|
||||||
HeapFree(GetProcessHeap(), 0, buf);
|
HeapFree(GetProcessHeap(), 0, buf);
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue