No subject


Thu Feb 24 14:23:06 CST 2011


dlls/advapi32/advapi.c starting at line 92


if (len > *lpSize)
{
         SetLastError(ERROR_MORE_DATA);
        *lpSize = len;
        return FALSE;
}


It seems the actual Window's implementation of GetUserNameW sets the last error
to  122 not 234 which maps to ERROR_INSUFFICIENT_BUFFER and not ERROR_MORE_DATA
when the buffer size to write the username to is too small.

This bug prevents the username from being properly read in all version of of
Kindle for PC when run under wine.  The Kindle for PC code allocates a buffer
of 1 wchar and then calls GetUserNameW and upon error checks for the 122 error
code (insufficient buffer) and if needed doubles the buffer size in question
and tries again.  It does not understand the 234 error code at all and so will
error out unable to read the user's username. 

The K4PC code luckily ignores the improper last error code value and simply
replaces the username with the string "AlternateUserName" so the
KindleForPC.exe will actually still work under wine even though this bug
exists.  The problem is that this bug actually changes how the DRM is created
on the ebook as the Kindle DRM is tied to both the user's username and the
volume serial number, making it impossible to post-process any ebook under
wine.

Please fix this routine (and GetUserNameA which uses it) to use the last error
code set to ERROR_INSUFFICIENT_BUFFER when the buffer size is too small to
match what the Window's code does in this case.

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list