LookupAccountNameW() null account name handled

Paul Bryan Roberts pbronline-wine at yahoo.co.uk
Fri Sep 26 05:54:42 CDT 2008


LookupAccountNameW() has a stubbed but non-empty, incomplete, buggy 
implementation.  It fails a number of unit tests but Wine code relies on 
this.

This is the SIXTH of a series of NINE patches that provide what may be a 
reasonable first pass implementation of LookupAccountNameA() and 
LookupAccountNameW() that:

    - works for well known SIDs
    - works for 'first user account'
    - adds handling of 'first user account' to LookupAccountSid
    - passes existing units tests for LookupAccountName
    - corrects knock-on regression failures in the advapit32/security.c 
unit tests (there may be others elsewhere)
    - allows progress towards the resolution of Bug 14334

This patch handles a NULL account name by looking up the well-known-SID 
name BUILTIN.

It means two more unit tests pass.

Why use this well-known-SID ?  Well, it was the only well-known-SID that 
fixes both unit test failures.  I guess that a more correct 
implementation would have to understand locales and introduce hundreds 
of new unit tests I'm not qualified to provide.

This patch also amends the handling of well-know-SIDs.  The original 
implementation assumed (and my original patch hacked) 
CreateWellKnownSid() to return the required SID size when the value 
supplied was insufficient.  This CreateWellKnownSid() does not do (I 
tried on native Windows) so this patch amends LookupAccountNameW() to 
work out the require SID size itself.

I guess this should have been two patches (or I should have 
retrospectively changed the earlier patch) and have introduced new unit 
tests.  Will do better next time.

This amendment is not my usual robust code and is amended again in the 
final patch in the series.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0009-LookupAccountNameW-null-account-name-handled.txt
Url: http://www.winehq.org/pipermail/wine-patches/attachments/20080926/2db7b785/attachment.txt 


More information about the wine-patches mailing list