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

Alexandre Julliard julliard at winehq.org
Wed Jun 1 12:11:09 CDT 2011


Module: wine
Branch: master
Commit: 0875abcce03d1b7d8f0b4a07473b29d847a123f3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0875abcce03d1b7d8f0b4a07473b29d847a123f3

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Wed Jun  1 14:47:43 2011 +0200

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

---

 dlls/crypt32/protectdata.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/crypt32/protectdata.c b/dlls/crypt32/protectdata.c
index a7351bb..20e11f4 100644
--- a/dlls/crypt32/protectdata.c
+++ b/dlls/crypt32/protectdata.c
@@ -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';




More information about the wine-cvs mailing list