LookupAccountNameA stub improved
Wolfgang Schwotzer
wolfgang.schwotzer at gmx.net
Mon Sep 6 16:06:49 CDT 2004
Description: LookupAccountNameA stub always returns a valid SID
-------------- next part --------------
Index: dlls/advapi32/security.c
===================================================================
RCS file: /home/wine/wine/dlls/advapi32/security.c,v
retrieving revision 1.81
diff -u -r1.81 security.c
--- dlls/advapi32/security.c 26 Aug 2004 00:29:06 -0000 1.81
+++ dlls/advapi32/security.c 6 Sep 2004 21:12:36 -0000
@@ -1449,7 +1449,48 @@
OUT PSID_NAME_USE name_use )
{
FIXME("(%s,%s,%p,%p,%p,%p,%p), stub.\n",system,account,sid,cbSid,ReferencedDomainName,cbReferencedDomainName,name_use);
- return FALSE;
+ /* Default implementation: Always return a default SID */
+ SID_IDENTIFIER_AUTHORITY identifierAuthority = {SECURITY_NT_AUTHORITY};
+ BOOL ret;
+ PSID pSid;
+ static const char dm[] = "DOMAIN";
+
+ ret = AllocateAndInitializeSid(&identifierAuthority,
+ 2,
+ SECURITY_BUILTIN_DOMAIN_RID,
+ DOMAIN_ALIAS_RID_ADMINS,
+ 0, 0, 0, 0, 0, 0,
+ &pSid);
+
+ if (!ret)
+ return FALSE;
+ if(!RtlValidSid(pSid))
+ {
+ FreeSid(pSid);
+ return FALSE;
+ }
+
+ if (sid != NULL && (*cbSid >= GetLengthSid(pSid)))
+ CopySid(*cbSid, sid, pSid);
+ if (*cbSid < GetLengthSid(pSid))
+ {
+ SetLastError(ERROR_INSUFFICIENT_BUFFER);
+ ret = FALSE;
+ }
+ *cbSid = GetLengthSid(pSid);
+
+ if (ReferencedDomainName != NULL && (*cbReferencedDomainName > strlen(dm)))
+ strcpy(ReferencedDomainName, dm);
+ if (*cbReferencedDomainName <= strlen(dm))
+ {
+ SetLastError(ERROR_INSUFFICIENT_BUFFER);
+ ret = FALSE;
+ }
+ *cbReferencedDomainName = strlen(dm)+1;
+
+ FreeSid(pSid);
+
+ return ret;
}
/******************************************************************************
More information about the wine-patches
mailing list