http://bugs.winehq.org/show_bug.cgi?id=17109
Summary: LookupAccountName regression prevents Galactic Civilizations II to start Product: Wine Version: 1.1.13 Platform: All OS/Version: All Status: UNCONFIRMED Severity: normal Priority: P2 Component: advapi32 AssignedTo: wine-bugs@winehq.org ReportedBy: daniel.mantione@freepascal.org
Created an attachment (id=18949) --> (http://bugs.winehq.org/attachment.cgi?id=18949) Test program to reveal LookupAccountName regression
Galactic Civilization starts in Wine 1.0, but is unable to start in Wine 1.1. It considers itself unactivated and when trying to reactivate the game with a valid serial, it is unable to activate itself because it is unable to get a SID.
I investigated tis and it seems to be caused by a regression in LookupAccountName when used to query the local machine account. The result of LookupAccountName seems to be incorrect already in Wine 1.0, returning incorrect data, but the game does seem to be happy with the returned data.
Wine 1.1 lets the LookupAccountName call fail, and GalCiv2 is unhappy with the failure, refusing to start.
I have written a small program to demonstrate the program. You can find it attached, compile it with Free Pascal or Delphi.
The result of the test program on a real (Windows 2003) machine is: SCORPIO lookupaccountname succeeded SID type: SidTypeDomain
The result of the test program on Wine 1.0.1 is: commandchair lookupaccountname succeeded SID type:
The result of the test program on Wine 1.1.13 is: commandchair lookupaccountname failed: 1332
http://bugs.winehq.org/show_bug.cgi?id=17109
--- Comment #1 from Daniël Mantione daniel.mantione@freepascal.org 2009-01-24 05:20:16 --- Created an attachment (id=18950) --> (http://bugs.winehq.org/attachment.cgi?id=18950) Test program Windows 2003 output
Output of the test program on a Windows 2003 machine
http://bugs.winehq.org/show_bug.cgi?id=17109
--- Comment #2 from Daniël Mantione daniel.mantione@freepascal.org 2009-01-24 05:20:56 --- Created an attachment (id=18951) --> (http://bugs.winehq.org/attachment.cgi?id=18951) Test program Wine 1.0.1 output
Output of the test program on Wine 1.0.1
http://bugs.winehq.org/show_bug.cgi?id=17109
--- Comment #3 from Daniël Mantione daniel.mantione@freepascal.org 2009-01-24 05:21:33 --- Created an attachment (id=18952) --> (http://bugs.winehq.org/attachment.cgi?id=18952) Test program Wine 1.1.13 output
Output of the test program on Wine 1.1.13
http://bugs.winehq.org/show_bug.cgi?id=17109
--- Comment #4 from Juan Lang juan_lang@yahoo.com 2009-01-24 11:48:48 --- Created an attachment (id=18958) --> (http://bugs.winehq.org/attachment.cgi?id=18958) Test case in C
I'm attaching a C version of your testcase, as not everyone will be using Pascal.
Someone will no doubt ask for a regression test: http://wiki.winehq.org/RegressionTesting
LookupAccountName is a stub, so it's not a real surprise it fails. The code path you're running into is in dlls/advapi32/security.c, lines 2620-2626: ret = GetUserNameW(userName, &nameLen);
if (ret && strcmpW(lpAccountName, userName) != 0) { SetLastError(ERROR_NONE_MAPPED); ret = FALSE; }
That is, the account name you're looking up isn't the user name. Probably what you're doing is also valid: looking up the machine name should produce some SID as well. A test case demonstrating this on Windows would help.
As a workaround, you could change your machine name to match your username.
From reading dlls/kernel32/computername.c, you ought to be able to change the
registry value ComputerName in the key HKLM\Machine\System\CurrentControlSet\Control\ComputerName\ActiveComputerName to match your username.
http://bugs.winehq.org/show_bug.cgi?id=17109
Juan Lang juan_lang@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords| |regression, testcase
--- Comment #5 from Juan Lang juan_lang@yahoo.com 2009-01-24 12:17:34 --- (In reply to comment #4)
As a workaround, you could change your machine name to match your username. From reading dlls/kernel32/computername.c, you ought to be able to change the registry value ComputerName in the key HKLM\Machine\System\CurrentControlSet\Control\ComputerName\ActiveComputerName to match your username.
Sorry, my mistake. I should have said the value ComputerName in the key HKLM\Machine\System\CurrentControlSet\Control\ComputerName\ComputerName
Change that to match your username. You'll also have to add a string registry value UseDnsComputerName in the key HKCU\Software\Wine\Network and set its value to "0".
Or, change your Unix hostname to match your username.
Still, workaround or no, this appears to be a bug and should be fixed.
http://bugs.winehq.org/show_bug.cgi?id=17109
Vitaliy Margolen vitaliy@kievinfo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- OS/Version|All |other Platform|All |Other Summary|LookupAccountName regression|Galactic Civilizations II |prevents Galactic |does not start |Civilizations II to start |
http://bugs.winehq.org/show_bug.cgi?id=17109
--- Comment #6 from Daniël Mantione daniel.mantione@freepascal.org 2009-01-24 14:15:34 --- Thanks for feedback, You write you would like to see a testcase on Windows, however, I already did show the result of the test program on a real Windows. Would you like me to modify the the test program to show more information than it does now, or do you need something else?
http://bugs.winehq.org/show_bug.cgi?id=17109
--- Comment #7 from Austin English austinenglish@gmail.com 2009-01-24 16:54:23 --- (In reply to comment #6)
Thanks for feedback, You write you would like to see a testcase on Windows, however, I already did show the result of the test program on a real Windows. Would you like me to modify the the test program to show more information than it does now, or do you need something else?
Juan probably means a testcase in C to be included in wine's conformance tests (http://wiki.winehq.org/ConformanceTests)
http://bugs.winehq.org/show_bug.cgi?id=17109
--- Comment #8 from Juan Lang juan_lang@yahoo.com 2009-01-29 23:07:55 --- Created an attachment (id=19089) --> (http://bugs.winehq.org/attachment.cgi?id=19089) Test patch
Yes, like Austin said, I meant a conformance test. Something like the attached patch might do it, though I've yet to test it on Windows. Assuming it passes there, that makes fixing the bug rather easier, and helps prevent future regressions.
http://bugs.winehq.org/show_bug.cgi?id=17109
Juan Lang juan_lang@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |juan_lang@yahoo.com
--- Comment #9 from Juan Lang juan_lang@yahoo.com 2009-01-29 23:10:05 --- The test patch I attached could be better. There's the possibility that the SID returned for a computer account is a well-known, stable SID, and that our implementation of LookupAccountName should match.
http://bugs.winehq.org/show_bug.cgi?id=17109
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |austinenglish@gmail.com
http://bugs.winehq.org/show_bug.cgi?id=17109
--- Comment #10 from Austin English austinenglish@gmail.com 2009-01-30 14:55:02 --- (In reply to comment #9)
The test patch I attached could be better. There's the possibility that the SID returned for a computer account is a well-known, stable SID, and that our implementation of LookupAccountName should match.
Passes for me on 2K SP4 and XP SP3.
http://bugs.winehq.org/show_bug.cgi?id=17109
--- Comment #11 from Juan Lang juan_lang@yahoo.com 2009-01-30 17:26:01 --- (In reply to comment #10)
Passes for me on 2K SP4 and XP SP3.
That's funny, it actually fails for me here on XP SP3 :) Working on it.
http://bugs.winehq.org/show_bug.cgi?id=17109
--- Comment #12 from Austin English austinenglish@gmail.com 2009-01-30 17:33:41 --- (In reply to comment #11)
(In reply to comment #10)
Passes for me on 2K SP4 and XP SP3.
That's funny, it actually fails for me here on XP SP3 :) Working on it.
Probably the network setup. That computer is on a workgroup, not a domain, fwiw.
http://bugs.winehq.org/show_bug.cgi?id=17109
Juan Lang juan_lang@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #19089|0 |1 is obsolete| |
--- Comment #13 from Juan Lang juan_lang@yahoo.com 2009-01-30 19:56:57 --- Created an attachment (id=19109) --> (http://bugs.winehq.org/attachment.cgi?id=19109) Test patch
This one passes for me on XP SP3. Austin, does this pass for you? If not, would you mind letting me know the failure? Thanks.
http://bugs.winehq.org/show_bug.cgi?id=17109
--- Comment #14 from Kai Blin kai.blin@gmail.com 2009-01-31 00:06:48 --- (In reply to comment #13)
Created an attachment (id=19109)
--> (http://bugs.winehq.org/attachment.cgi?id=19109) [details]
Test patch
This one passes for me on XP SP3. Austin, does this pass for you? If not, would you mind letting me know the failure? Thanks.
Fails for me on my Win2k3 DC.
security.c:1863: Test failed: Expected ERROR_NONE_MAPPED, got 1788 security.c:1887: Test failed: LookupAccountNameA failed: 1788
http://bugs.winehq.org/show_bug.cgi?id=17109
--- Comment #15 from Kai Blin kai.blin@gmail.com 2009-01-31 00:18:56 --- (In reply to comment #14)
security.c:1863: Test failed: Expected ERROR_NONE_MAPPED, got 1788
On my WinXP SP2 domain client, I'm just getting the failure on line 1863, so LookupAccountName is working for that one.
I've got some AD trusts set up on that AD, and the other domain isn't running, which might cause these error codes. I'll remove the trusts and rety.
http://bugs.winehq.org/show_bug.cgi?id=17109
--- Comment #16 from Austin English austinenglish@gmail.com 2009-01-31 21:32:51 --- (In reply to comment #13)
Created an attachment (id=19109)
--> (http://bugs.winehq.org/attachment.cgi?id=19109) [details]
Test patch
This one passes for me on XP SP3. Austin, does this pass for you? If not, would you mind letting me know the failure? Thanks.
Fails for me on XP SP3 and 2K SP4.
security.c:1202: Test failed: GetTokenInformation failed with error 998 ... security.c:1240: S-1-5-5-0-37734, attr: 0xc0000007 LookupAccountSid failed with error 1332
I'll attach the full log.
http://bugs.winehq.org/show_bug.cgi?id=17109
--- Comment #17 from Austin English austinenglish@gmail.com 2009-01-31 21:33:26 --- Created an attachment (id=19138) --> (http://bugs.winehq.org/attachment.cgi?id=19138) test output on 2k
This is the 2k output. XP was similar, let me know if you need it.
http://bugs.winehq.org/show_bug.cgi?id=17109
--- Comment #18 from Juan Lang juan_lang@yahoo.com 2009-02-01 10:13:45 --- (In reply to comment #16)
security.c:1202: Test failed: GetTokenInformation failed with error 998 ... security.c:1240: S-1-5-5-0-37734, attr: 0xc0000007 LookupAccountSid failed with error 1332
Those are failures in existing tests, so I'm inclined to ignore them. Thanks. I'll adjust the test patch to address Kai's failures and submit it, along with a proposed fix.
http://bugs.winehq.org/show_bug.cgi?id=17109
Juan Lang juan_lang@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #19109|0 |1 is obsolete| |
--- Comment #19 from Juan Lang juan_lang@yahoo.com 2009-02-01 10:40:58 --- Created an attachment (id=19154) --> (http://bugs.winehq.org/attachment.cgi?id=19154) Test patch
Here's an updated one, that treats domain failures as a broken configuration. I'm not sure if the SID_NAME_USE is correct when the machine is a member of a domain, so I'd appreciate tests there.
http://bugs.winehq.org/show_bug.cgi?id=17109
--- Comment #20 from Juan Lang juan_lang@yahoo.com 2009-02-01 10:45:01 --- Created an attachment (id=19155) --> (http://bugs.winehq.org/attachment.cgi?id=19155) Patch
Here's a stab at fixing the bug. It applies on top of the test patch. It's sort of a hack, as it returns that the account whose name is the computer name is a SidTypeDomain, but it says the referenced domain is L"DOMAIN", rather than the machine name. Still, it might be sufficient to get GalCivII starting again.
http://bugs.winehq.org/show_bug.cgi?id=17109
--- Comment #21 from Austin English austinenglish@gmail.com 2009-02-01 14:41:31 --- (In reply to comment #18)
(In reply to comment #16)
security.c:1202: Test failed: GetTokenInformation failed with error 998 ... security.c:1240: S-1-5-5-0-37734, attr: 0xc0000007 LookupAccountSid failed with error 1332
Those are failures in existing tests, so I'm inclined to ignore them. Thanks. I'll adjust the test patch to address Kai's failures and submit it, along with a proposed fix.
Poo, you're right. It was late when I had tested.
http://bugs.winehq.org/show_bug.cgi?id=17109
--- Comment #22 from Daniël Mantione daniel.mantione@freepascal.org 2009-02-02 03:41:25 --- If I look at the patch the function will now always set peUse:=SidTypeDomain, regardless wether a username or computername is being looked up, whereas the old code returns SidTypeUser when a username is looked up.
I can during the next days wether Galciv2 starts with this patch applied.
http://bugs.winehq.org/show_bug.cgi?id=17109
--- Comment #23 from Juan Lang juan_lang@yahoo.com 2009-02-02 10:08:16 --- (In reply to comment #22)
If I look at the patch the function will now always set peUse:=SidTypeDomain, regardless wether a username or computername is being looked up
That isn't correct. If a username is being looked up, it'll return peUse=SidTypeUser. See the function LookupUserAccountName for the username case.
http://bugs.winehq.org/show_bug.cgi?id=17109
--- Comment #24 from Juan Lang juan_lang@yahoo.com 2009-02-04 15:24:49 --- Since it's been quiet around here, I've submitted the patches: http://www.winehq.org/pipermail/wine-patches/2009-February/068915.html http://www.winehq.org/pipermail/wine-patches/2009-February/068916.html
http://bugs.winehq.org/show_bug.cgi?id=17109
--- Comment #25 from Juan Lang juan_lang@yahoo.com 2009-02-05 09:39:19 --- The patches are in as of today's git. Would someone mind verifying whether it's indeed fixed?
http://bugs.winehq.org/show_bug.cgi?id=17109
--- Comment #26 from Daniël Mantione daniel.mantione@freepascal.org 2009-02-05 13:54:31 --- I can confirm the patch allows Galactic Civilizations II to start. The game refuses its activation information from Wine 1.0, however, after entering my e-mail address and serial number, the game manages to activate itself and starts. Well done!
Unfortunately, the game is still rather unstable and crashes when trying to set up a new game.
http://bugs.winehq.org/show_bug.cgi?id=17109
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC|austinenglish@gmail.com | Status|NEW |RESOLVED Resolution| |FIXED
--- Comment #27 from Austin English austinenglish@gmail.com 2009-02-05 14:05:04 --- (In reply to comment #26)
I can confirm the patch allows Galactic Civilizations II to start. The game refuses its activation information from Wine 1.0, however, after entering my e-mail address and serial number, the game manages to activate itself and starts. Well done!
Then this bug is fixed.
Unfortunately, the game is still rather unstable and crashes when trying to set up a new game.
File a new bug for that please.
http://bugs.winehq.org/show_bug.cgi?id=17109
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #28 from Alexandre Julliard julliard@winehq.org 2009-02-13 11:11:28 --- Closing bugs fixed in 1.1.15.