crypt32: GetUserName sets last error to ERROR_INSUFFICIENT_BUFFER if the buffer is too small.
This commit is contained in:
parent
c0b7345e38
commit
0875abcce0
|
@ -722,8 +722,8 @@ BOOL load_encryption_key(HCRYPTPROV hProv, DWORD key_len, const DATA_BLOB *salt,
|
|||
/* This should be the "logon credentials" instead of username */
|
||||
dwError=GetLastError();
|
||||
dwUsernameLen = 0;
|
||||
if (!GetUserNameA(NULL,&dwUsernameLen) &&
|
||||
GetLastError()==ERROR_MORE_DATA && dwUsernameLen &&
|
||||
if (!GetUserNameA(NULL, &dwUsernameLen) &&
|
||||
GetLastError() == ERROR_INSUFFICIENT_BUFFER && dwUsernameLen &&
|
||||
(szUsername = CryptMemAlloc(dwUsernameLen)))
|
||||
{
|
||||
szUsername[0]='\0';
|
||||
|
|
Loading…
Reference in New Issue