LookupAccountNameW() returns correct domain name length for not-so-well-known SIDs

Paul Bryan Roberts pbronline-wine at yahoo.co.uk
Fri Sep 26 05:52:09 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 is the THIRD 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 was nasty.

This patch should have been done as two but whichever came first would 
have introduced regression.

These routines will return:
    - either the domain name and its length (not including the null 
    - or the length, including the null terminator (so the caller can 
allocate enough memory to try again).

In this patch, LookupAccountNameW() returns the correct domain name 
length for not-so-well-known-SIDs and LookupAccountNameA() is changed so 
as to convert domain names from W to A correctly.  This corrects two 
units tests.

It also corrects two units tests for the well-known-SID case but this is 
misleading.  The code for well-known-SIDs isn't there and is technically 
even more broken than before.  This is addressed in the next patch.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0006-LookupAccountNameW-returns-correct-domainname-length.txt
Url: http://www.winehq.org/pipermail/wine-patches/attachments/20080926/910cecf2/attachment.txt 

More information about the wine-patches mailing list