On Windows 2000 or NT, How do I get the owner of a directory. When I
use the the following sequence of functions, I get the owner of a
file. This does not work for directories. CreateFile returns an
invalid handle. Is there a special flag I need to use for
directories??

hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
dwRtnCode = GetSecurityInfo( hFile, SE_FILE_OBJECT,
OWNER_SECURITY_INFORMATION, &pSidOwner, NULL, NULL, NULL, NULL);
bRtnBool = LookupAccountSid(NULL, pSidOwner, OwnerName,
(LPDWORD)&BufSize, DomainName,(LPDWORD)&BufSize, );