Example #1
0
        public override void WriteBody(NdrBinaryStream stream)
        {
            stream.WriteFiletime(LogonTime);
            stream.WriteFiletime(LogoffTime);
            stream.WriteFiletime(KickOffTime);
            stream.WriteFiletime(PwdLastChangeTime);
            stream.WriteFiletime(PwdCanChangeTime);
            stream.WriteFiletime(PwdMustChangeTime);

            stream.WriteRPCUnicodeString(UserName);
            stream.WriteRPCUnicodeString(UserDisplayName);
            stream.WriteRPCUnicodeString(LogonScript);
            stream.WriteRPCUnicodeString(ProfilePath);
            stream.WriteRPCUnicodeString(HomeDirectory);
            stream.WriteRPCUnicodeString(HomeDrive);

            stream.WriteShort((short)LogonCount);
            stream.WriteShort((short)BadPasswordCount);

            stream.WriteRid(UserSid);
            stream.WriteRid(GroupSid);

            WriteSidArray(stream, GroupSids);

            if (ExtraSids != null)
            {
                UserFlags |= UserFlags.LOGON_EXTRA_SIDS;
            }

            if (ResourceGroups != null)
            {
                UserFlags |= UserFlags.LOGON_RESOURCE_GROUPS;
            }

            stream.WriteUnsignedInt((int)UserFlags);

            stream.WriteBytes(new byte[16]);

            stream.WriteRPCUnicodeString(ServerName);
            stream.WriteRPCUnicodeString(DomainName);

            stream.WriteSid(DomainSid, "DomainSid");

            stream.WriteBytes(new byte[8]);

            stream.WriteUnsignedInt((int)UserAccountControl);
            stream.WriteUnsignedInt(SubAuthStatus);

            stream.WriteFiletime(LastSuccessfulILogon);
            stream.WriteFiletime(LastFailedILogon);
            stream.WriteUnsignedInt(FailedILogonCount);

            // reserved3
            stream.WriteUnsignedInt(0);

            WriteExtraSids(stream, ExtraSids);

            stream.WriteSid(ResourceDomainSid, "ResourceDomainSid");

            WriteSidArray(stream, ResourceGroups);

            // write GroupSids
            // write DomainSid
            // write ExtraSids
            // write ResourceDomainSid
            // write ResourceGroups
        }