Commit 0875abcc authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

crypt32: GetUserName sets last error to ERROR_INSUFFICIENT_BUFFER if the buffer is too small.

parent c0b7345e
......@@ -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';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment