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