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.