dlls/userenv: fixed stubs GetUserProfileDirectoryW/A (3rd try)

Nikolay Sivov bunglehead at gmail.com
Thu Mar 5 07:20:51 CST 2009


Andreas Rosenberg wrote:

Test looks better but:

   
+    r = OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY|TOKEN_DUPLICATE, &htoken);
+    expect(TRUE, r);
+    
+    r = GetUserProfileDirectoryW(htoken , NULL, NULL );
+    lastError = GetLastError();
+    expect(FALSE, r);
+    expect(lastError, ERROR_INVALID_PARAMETER);

Why don't you SetLastError to dummy value with deadbeef meaning or similar
before call you're testing?
    
+    sizePath = 0;
+    r = GetUserProfileDirectoryW(htoken , buffer, &sizePath );
+    lastError = GetLastError();
+    expect(FALSE,r);
+    expect(lastError, ERROR_INSUFFICIENT_BUFFER);
+    ok(sizePath > 0, "Expected (sizePath>0), got %d\n",sizePath );

The same.

+    sizeExpected = sizePath;
+    sizePath = sizeof(buffer);
+    SetLastError(0xDEADAFFE);
+    r = GetUserProfileDirectoryW(htoken , buffer, &sizePath );
+    lastError = GetLastError();
+    expect(TRUE, !!r);  /* upon sucess an int > 0 is returned - which may not be == TRUE */
+    expect(sizeExpected,lstrlenW(buffer)+1);
+    expect(r,lstrlenW(buffer));
+    expect(lastError,0xDEADAFFE);
+    CloseHandle(htoken);





More information about the wine-devel mailing list