While I did some experimenting with the proposals from Vitaliy Margolen to get an accepted patch for GetUserProfileDirectoryW, I found this behavior:
OpenProcessToken(hProcess,TOKEN_QUERY,&hToken); ... GetTokenInformation( hToken, TokenUser, ptiUser, cbti, &cbti ) ... LookupAccountSidW( NULL, ptiUser->User.Sid, lpUserName, lpchSize,lpDomain, &cbDomain, &snu );
In Windows XP SP3 the LookupAccountSidW fills lpUserName with the name of the current user (same as GetUserName)
Running this code in Wine results in the username: 'INTERACTIVE'.
Seems like the LookupAccountSidW does something not compatible with Windows. Im thinking about writing a test code, but simply checking if the above code returns the same as GetUserNameW seems not correct, if test code should run under a different account as the actual login user.
Is this a requirement for running the wine tests?
2009/3/10 Andreas Rosenberg andreas.rosenberg@apis.de:
While I did some experimenting with the proposals from Vitaliy Margolen to get an accepted patch for GetUserProfileDirectoryW, I found this behavior:
OpenProcessToken(hProcess,TOKEN_QUERY,&hToken); ... GetTokenInformation( hToken, TokenUser, ptiUser, cbti, &cbti ) ... LookupAccountSidW( NULL, ptiUser->User.Sid, lpUserName, lpchSize,lpDomain, &cbDomain, &snu );
In Windows XP SP3 the LookupAccountSidW fills lpUserName with the name of the current user (same as GetUserName)
Running this code in Wine results in the username: 'INTERACTIVE'.
See server/token.c:security_unix_uid_to_sid. This should return a SID with a pattern that LookupAccountSidW can recognise and then extract the uid and look it up and return the UNIX user name.
Seems like the LookupAccountSidW does something not compatible with Windows. Im thinking about writing a test code, but simply checking if the above code returns the same as GetUserNameW seems not correct, if test code should run under a different account as the actual login user.
Is this a requirement for running the wine tests?