r7029: Make array support in pidl similar to that in other IDL compilers. We should
[samba.git] / source / librpc / idl / netlogon.idl
index e0f38ac1122d7875f244d8c0face4aa50bd674d2..35666381d4bd2ca9b9b9b40d9548c028baad8111 100644 (file)
@@ -7,19 +7,29 @@
 #include "idl_types.h"
 
 [
-  uuid(12345678-1234-abcd-ef00-01234567cffb),
+  uuid("12345678-1234-abcd-ef00-01234567cffb"),
   version(1.0),
-  pointer_default(unique)
+  endpoint("ncacn_np:[\\pipe\\netlogon]","ncacn_ip_tcp:","ncalrpc:"),
+  pointer_default(unique),
+  pointer_default_top(unique),
+  depends(lsa,samr)
 ]
 
 interface netlogon
 {
+       declare bitmap samr_AcctFlags;
 
+       typedef [public] struct {
+               [value(strlen_m(r->string)*2)]  uint16 size;
+               [value(r->size)]                uint16 length;
+               unistr_noterm *string;
+       } netr_String;
+       
        /*****************/
        /* Function 0x00 */
 
        typedef struct {
-               unistr *effective_name;
+               unistr *account_name;
                uint32 priv;
                uint32 auth_flags;
                uint32 logon_count;
@@ -39,7 +49,7 @@ interface netlogon
 
        WERROR netr_LogonUasLogon(
                [in]   unistr *server_name,
-               [in]   unistr username,
+               [in]   unistr account_name,
                [in]   unistr workstation,
                [out]  netr_UasInfo *info
                );
@@ -55,7 +65,7 @@ interface netlogon
 
        WERROR netr_LogonUasLogoff(
                [in] unistr *server_name,
-               [in] unistr username,
+               [in] unistr account_name,
                [in] unistr workstation,
                [out] netr_UasLogoffInfo info
                );
@@ -64,336 +74,411 @@ interface netlogon
        /*****************/
        /* Function 0x02 */
 
+       /* in netr_AcctLockStr size seems to be be 24, and rrenard thinks 
+          that the structure of the bindata looks like this:
+
+               dlong  lockout_duration;
+               udlong reset_count;
+               uint32 bad_attempt_lockout;
+               uint32 dummy;   
+
+          but it doesn't look as though this structure is reflected at the
+          NDR level. Maybe it is left to the application to decode the bindata array.
+       */
        typedef struct {
                uint16 size;
                uint16 length;
-               unistr *string;
-       } netr_String;
+               [size_is(size/2),length_is(length/2)] uint16 *bindata;
+       } netr_AcctLockStr;
 
        typedef struct {
-               netr_String LogonDomainName;
-               uint32 ParameterControl;
-               HYPER_T LogonID;
-               netr_String username;
+               netr_String domain_name;
+               uint32      parameter_control;
+               uint32      logon_id_low;
+               uint32      logon_id_high;
+               netr_String account_name;
                netr_String workstation;
-       } LOGON_IDENTITY_INFO;
+       } netr_IdentityInfo;
 
        typedef struct {
-               uint8 password[16];
-       } LM_OWF_PASSWORD;
+               netr_IdentityInfo identity_info;
+               samr_Password lmpassword;
+               samr_Password ntpassword;
+       } netr_PasswordInfo;
 
-       typedef struct {
-               uint8 password[16];
-       } NT_OWF_PASSWORD;
+       typedef [flag(NDR_PAHEX)] struct {
+               uint16 length;
+               [value(r->length)] uint16 size;
+               [size_is(size),length_is(length)] uint8 *data;
+       } netr_ChallengeResponse;
 
-       typedef struct {
-               LOGON_IDENTITY_INFO identity_info;
-               LM_OWF_PASSWORD lmpassword;
-               NT_OWF_PASSWORD ntpassword;
-       } INTERACTIVE_INFO;
+       typedef [flag(NDR_PAHEX)] struct {
+               netr_IdentityInfo identity_info;
+               uint8 challenge[8];
+               netr_ChallengeResponse nt;
+               netr_ChallengeResponse lm;
+       } netr_NetworkInfo;
 
-       typedef struct {
-               uint8 chl[8];
-       } netr_Challenge;
+       typedef [switch_type(uint16)] union {
+               [case(1)] netr_PasswordInfo *password;
+               [case(2)] netr_NetworkInfo  *network;
+               [case(3)] netr_PasswordInfo *password;
+               [case(5)] netr_PasswordInfo *password;
+               [case(6)] netr_NetworkInfo  *network;
+       } netr_LogonLevel;
 
-       typedef struct {
-               LOGON_IDENTITY_INFO logon_info;
-               netr_Challenge chal;
-               unistr ntchallengeresponse;
-               unistr lmchallengeresponse;
-       } NETWORK_INFO;
+       typedef [public] struct {
+               uint32 rid;
+               uint32 attributes;
+       } netr_GroupMembership;
 
-       typedef struct {
-               LOGON_IDENTITY_INFO logon_info;
-               LM_OWF_PASSWORD lmpassword;
-               NT_OWF_PASSWORD ntpassword;
-       } SERVICE_INFO;
+       typedef [public,flag(NDR_PAHEX)] struct {
+               uint8 key[16];
+       } netr_UserSessionKey;
 
-       typedef union {
-               [case(1)] INTERACTIVE_INFO *iinfo;
-               [case(2)] NETWORK_INFO *ninfo;
-               [case(3)] SERVICE_INFO *sinfo;
-       } netr_LogonLevel;
+       typedef [public,flag(NDR_PAHEX)] struct {
+               uint8 key[8];
+       } netr_LMSessionKey;
 
-       typedef [flag(NDR_PAHEX)] struct {
-               uint8 cred[8];
-       } netr_Credential;
+       typedef struct {
+               NTTIME last_logon;
+               NTTIME last_logoff;
+               NTTIME acct_expiry;
+               NTTIME last_password_change;
+               NTTIME allow_password_change;
+               NTTIME force_password_change;
+               netr_String account_name;
+               netr_String full_name;
+               netr_String logon_script;
+               netr_String profile_path;
+               netr_String home_directory;
+               netr_String home_drive;
+               uint16 logon_count;
+               uint16 bad_password_count;
+               uint32 rid;
+               uint32 primary_gid;
+               samr_RidWithTypeArray groups;
+               uint32 user_flags;
+               netr_UserSessionKey key;
+               netr_String logon_server;
+               netr_String domain;
+               dom_sid2 *domain_sid;
+               netr_LMSessionKey LMSessKey;
+               samr_AcctFlags acct_flags;
+               uint32 unknown[7];
+       } netr_SamBaseInfo;
 
        typedef struct {
-               netr_Credential cred;
-               uint32 timestamp;
-       } netr_Authenticator;
+               netr_SamBaseInfo base;
+       } netr_SamInfo2;
 
        typedef struct {
-               uint32 user_id;
-               uint32 attributes;
-       } GROUP_MEMBERSHIP;
-
-       typedef struct {
-               uint8 user_session_key[16];
-       } USER_SESSION_KEY;
-
-       typedef struct {
-               NTTIME LogonTime;
-               NTTIME LogoffTime;
-               NTTIME KickOffTime;
-               NTTIME PasswdLastSet;
-               NTTIME PasswdCanChange;
-               NTTIME PasswdMustChange;
-               netr_String effectivename;
-               netr_String fullname;
-               netr_String logonscript;
-               netr_String profilepath;
-               netr_String homedirectory;
-               netr_String homedirectorydrive;
-               uint16 LogonCount;
-               uint16 BadPasswdCount;
-               uint32 userid;
-               uint32 primarygroup;
-               uint32 groupcount;
-               [size_is(groupcount)] GROUP_MEMBERSHIP *groupids;
-               uint32 userflags;
-               USER_SESSION_KEY key;
-               netr_String logonserver;
-               netr_String domainname;
-               dom_sid2 logondomainid;
-               uint32 expansionroom[10];
-       } VALIDATION_SAM_INFO;
-
-       typedef struct {
-               NTTIME LogonTime;
-               NTTIME LogoffTime;
-               NTTIME KickOffTime;
-               NTTIME PasswdLastSet;
-               NTTIME PasswdCanChange;
-               NTTIME PasswdMustChange;
-               netr_String effectivename;
-               netr_String fullname;
-               netr_String logonscript;
-               netr_String profilepath;
-               netr_String homedirectory;
-               netr_String homedirectorydrive;
-               uint16 LogonCount;
-               uint16 BadPasswdCount;
-               uint32 userid;
-               uint32 primarygroup;
-               uint32 groupcount;
-               GROUP_MEMBERSHIP *groupids;
-               uint32 userflags;
-               USER_SESSION_KEY key;
-               netr_String logonserver;
-               netr_String domainname;
-               dom_sid2 logondomainid;
-               uint32 expansionroom[10];
+               dom_sid2 *sid;
+               uint32 attribute;
+       } netr_SidAttr;
+
+       typedef [public] struct {
+               netr_SamBaseInfo base;
+               uint32 sidcount;
+               [size_is(sidcount)] netr_SidAttr *sids;
+       } netr_SamInfo3;
+
+       typedef struct {
+               netr_SamBaseInfo base;
                uint32 sidcount;
-               dom_sid2 sid;
-               uint32 sid_attribs;
-       } VALIDATION_SAM_INFO2;
+               [size_is(sidcount)] netr_SidAttr *sids;
+               netr_String forest;
+               netr_String principle;
+               uint32 unknown4[20];
+       } netr_SamInfo6;
 
        typedef struct {
                uint32 pac_size;
                [size_is(pac_size)] uint8 *pac;
-               netr_String logondomain;
-               netr_String logonserver;
-               netr_String principalname;
+               netr_String logon_domain;
+               netr_String logon_server;
+               netr_String principal_name;
                uint32 auth_size;
                [size_is(auth_size)] uint8 *auth;
-               USER_SESSION_KEY user_session_key;
+               netr_UserSessionKey user_session_key;
                uint32 expansionroom[10];
-               netr_String dummy1;
-               netr_String dummy2;
-               netr_String dummy3;
-               netr_String dummy4;
-       } VALIDATION_PAC_INFO;
+               netr_String unknown1;
+               netr_String unknown2;
+               netr_String unknown3;
+               netr_String unknown4;
+       } netr_PacInfo;
 
-       typedef union {
-               [case(2)] VALIDATION_SAM_INFO *sam;
-               [case(3)] VALIDATION_SAM_INFO2 *sam2;
-               [case(4)] VALIDATION_PAC_INFO *pac;
-               [case(5)] VALIDATION_PAC_INFO *pac2;
+       typedef [switch_type(uint16)] union {
+               [case(2)] netr_SamInfo2 *sam2;
+               [case(3)] netr_SamInfo3 *sam3;
+               [case(4)] netr_PacInfo  *pac;
+               [case(5)] netr_PacInfo  *pac;
+               [case(6)] netr_SamInfo6 *sam6;
        } netr_Validation;
 
-       WERROR netr_LogonSamLogon(
+       typedef [public, flag(NDR_PAHEX)] struct {
+               uint8 data[8];
+       } netr_Credential;
+
+       typedef [public] struct {
+               netr_Credential cred;
+               time_t timestamp;
+       } netr_Authenticator;
+
+       NTSTATUS netr_LogonSamLogon(
                [in] unistr *server_name,
                [in] unistr *workstation,
                [in] netr_Authenticator *credential,
-               [in][out] netr_Authenticator *authenticator,
+               [in][out] netr_Authenticator *return_authenticator,
                [in]  uint16 logon_level,
                [in]  [switch_is(logon_level)] netr_LogonLevel logon,
                [in]  uint16 validation_level,
                [out] [switch_is(validation_level)] netr_Validation validation,
-               [out] uint32 authoritative
+               [out] uint8 authoritative
                );
 
-       WERROR netr_LogonSamLogoff(
+
+       /*****************/
+       /* Function 0x03 */
+
+       NTSTATUS netr_LogonSamLogoff(
                [in] unistr *server_name,
                [in] unistr *computer_name,
-               [in] netr_Authenticator credential,
-               [in] netr_Authenticator return_authenticator,
+               [in]      netr_Authenticator *credential,
+               [in][out] netr_Authenticator *return_authenticator,
                [in] uint16 logon_level,
                [in] [switch_is(logon_level)] netr_LogonLevel logon
                );
+       
 
-       WERROR netr_ServerReqChallenge(
-               [in] unistr *server_name,
-               [in] unistr computer_name,
-               [in][out][ref] netr_Credential *credential
+
+       /*****************/
+       /* Function 0x04 */
+
+       NTSTATUS netr_ServerReqChallenge(
+               [in]         unistr *server_name,
+               [in]         unistr computer_name,
+               [in,out,ref] netr_Credential *credentials
                );
 
-       WERROR netr_ServerAuthenticate(
-               [in] unistr *server_name,
-               [in] unistr username,
-               [in] uint16 secure_challenge_type,
-               [in] unistr computer_name,
-               [in,out,ref] netr_Credential *client_challenge
+
+       /*****************/
+       /* Function 0x05 */
+
+       declare enum netr_SchannelType;
+
+       NTSTATUS netr_ServerAuthenticate(
+               [in]         unistr *server_name,
+               [in]         unistr account_name,
+               [in]         netr_SchannelType secure_channel_type,
+               [in]         unistr computer_name,
+               [in,out,ref] netr_Credential *credentials
                );
 
-#if 0
-       typedef struct {
-               uint8 encrypted_password[16];
-       } ENCRYPTED_LM_OWF_PASSWORD;
-       WERROR netr_ServerPasswordSet(
-               [in] unistr *server_name,
-               [in] unistr username,
-               [in] uint16 secure_challenge_type,
-               [in] unistr ComputerName,
-               [in][ref] AUTHENTICATOR credential,
-               [in][ref] LM_OWF_PASSWORD UasNewPassword,
-               [out][ref] AUTHENTICATOR return_authenticator
+
+       /*****************/
+       /* Function 0x06 */
+
+       NTSTATUS netr_ServerPasswordSet(
+               [in]  unistr *server_name,
+               [in]  unistr account_name,
+               [in]  netr_SchannelType secure_channel_type,
+               [in]  unistr computer_name,
+               [in]  netr_Authenticator credential,
+               [in]  samr_Password new_password,
+               [out] netr_Authenticator return_authenticator
                );
+
+
+       /*****************/
+       /* Function 0x07 */
+
+       /* SAM database types */
+       typedef [v1_enum] enum {
+               SAM_DATABASE_DOMAIN  = 0, /* Domain users and groups */
+               SAM_DATABASE_BUILTIN = 1, /* BUILTIN users and groups */
+               SAM_DATABASE_PRIVS   = 2 /* Privileges */
+       } netr_SamDatabaseID;
+
        typedef struct {
-               unistr *username;
-               netr_String dummy1;
-               netr_String dummy2;
-               netr_String dummy3;
-               netr_String dummy4;
-               uint32 dummy5;
-               uint32 dummy6;
-               uint32 dummy7;
-               uint32 dummy8;
-       } DELTA_DELETE_USER;
-       typedef struct {
-               bool SensitiveDataFlag;
+               unistr *account_name;
+               netr_String unknown1;
+               netr_String unknown2;
+               netr_String unknown3;
+               netr_String unknown4;
+               uint32 unknown5;
+               uint32 unknown6;
+               uint32 unknown7;
+               uint32 unknown8;
+       } netr_DELTA_DELETE_USER;
+
+       typedef struct {
+               uint16 length;
+               [value(r->length)] uint16 size;
+               uint32 flags;
+               samr_Password pwd;
+       } netr_USER_KEY16;
+
+       typedef struct {
+               uint16 nt_length;
+               uint16 nt_size;
+               uint32 nt_flags;
+               uint16 lm_length;
+               uint16 lm_size;
+               uint32 lm_flags;
+               uint8 nt_history[nt_length];
+               uint8 lm_history[lm_length];
+       } netr_PasswordHistory;
+
+       typedef struct {
+               netr_USER_KEY16 lmpassword;
+               netr_USER_KEY16 ntpassword;
+               netr_PasswordHistory lmhistory;
+       } netr_USER_KEYS2;
+
+       typedef struct {
+               netr_USER_KEYS2 keys2;
+       } netr_USER_KEY_UNION;
+
+       typedef [public] struct {
+               uint32 version;
+               netr_USER_KEY_UNION keys;
+       } netr_USER_KEYS;
+
+       typedef struct {
+               bool8  SensitiveDataFlag;
                uint32 DataLength;
-               [size_is(DataLength)] uint8 *SensitiveData;
-       } USER_PRIVATE_INFO;
-       typedef struct {
-               netr_String username;
-               netr_String FullName;
-               uint32 UserID;
-               uint32 PrimaryGroupID;
-               netr_String HomeDir;
-               netr_String HomeDirDrive;
-               netr_String LogonScript;
-               netr_String Comment;
+
+               /* netr_USER_KEYS encrypted with the session key */
+               [size_is(DataLength)][flag(NDR_PAHEX)] uint8 *SensitiveData;
+       } netr_USER_PRIVATE_INFO;
+
+       typedef struct {
+               netr_String account_name;
+               netr_String full_name;
+               uint32 rid;
+               uint32 primary_gid;
+               netr_String home_directory;
+               netr_String home_drive;
+               netr_String logon_script;
+               netr_String description;
                netr_String workstations;
-               NTTIME LastLogon;
-               NTTIME LastLogoff;
-               LOGON_HOURS logonhours;
-               uint16 BadPwCount;
-               uint16 LogonCount;
-               NTTIME PwLastSet;
-               NTTIME AccountExpires;
-               uint32 AccountControl;
-               LM_OWF_PASSWORD lmpw;
-               NT_OWF_PASSWORD ntpw;
-               bool NTPwPresent;
-               bool LMPwPresent;
-               bool PwExpired;
-               netr_String UserComment;
-               netr_String Parameters;
-               uint16 CountryCode;
-               uint16 CodePage;
-               USER_PRIVATE_INFO user_private_info;
+               NTTIME last_logon;
+               NTTIME last_logoff;
+               samr_LogonHours logon_hours;
+               uint16 bad_password_count;
+               uint16 logon_count;
+               NTTIME last_password_change;
+               NTTIME acct_expiry;
+               samr_AcctFlags acct_flags;
+               samr_Password lmpassword;
+               samr_Password ntpassword;
+               bool8 nt_password_present;
+               bool8 lm_password_present;
+               bool8 password_expired;
+               netr_String comment;
+               netr_String parameters;
+               uint16 country_code;
+               uint16 code_page;
+               netr_USER_PRIVATE_INFO user_private_info;
                uint32 SecurityInformation;
-               LSA_SECURITY_DESCRIPTOR sec_desc;
-               netr_String dummy1;
-               netr_String dummy2;
-               netr_String dummy3;
-               netr_String dummy4;
-               uint32 dummy5;
-               uint32 dummy6;
-               uint32 dummy7;
-               uint32 dummy8;
-       } DELTA_USER;
-       typedef struct {
-               netr_String DomainName;
-               netr_String OEMInfo;
-               NTTIME forcedlogoff;
-               uint16 minpasswdlen;
-               uint16 passwdhistorylen;
-               NTTIME pwd_must_change_time;
-               NTTIME pwd_can_change_time;
-               NTTIME domain_modify_time;
+               sec_desc_buf sdbuf;
+               netr_String profile_path;
+               netr_String unknown2;
+               netr_String unknown3;
+               netr_String unknown4;
+               uint32 unknown5;
+               uint32 unknown6;
+               uint32 unknown7;
+               uint32 unknown8;
+       } netr_DELTA_USER;
+
+       typedef struct {
+               netr_String domain_name;
+               netr_String comment;
+               NTTIME force_logoff_time;
+               uint16 min_password_length;
+               uint16 password_history_length;
+               /* yes, these are signed. They are in negative 100ns */
+               dlong  max_password_age;
+               dlong  min_password_age;
+               udlong sequence_num;
                NTTIME domain_create_time;
                uint32 SecurityInformation;
-               LSA_SECURITY_DESCRIPTOR sec_desc;
-               netr_String dummy1;
-               netr_String dummy2;
-               netr_String dummy3;
-               netr_String dummy4;
-               uint32 dummy5;
-               uint32 dummy6;
-               uint32 dummy7;
-               uint32 dummy8;
-       } DELTA_DOMAIN;
-       typedef struct {
-               netr_String groupname;
-               GROUP_MEMBERSHIP group_membership;
-               netr_String comment;
+               sec_desc_buf sdbuf;
+               netr_AcctLockStr account_lockout;
+               netr_String unknown2;
+               netr_String unknown3;
+               netr_String unknown4;
+               uint32 logon_to_chgpass;
+               uint32 unknown6;
+               uint32 unknown7;
+               uint32 unknown8;
+       } netr_DELTA_DOMAIN;
+
+       typedef struct {
+               netr_String group_name;
+               uint32 rid;
+               uint32 attributes;
+               netr_String description;
                uint32 SecurityInformation;
-               LSA_SECURITY_DESCRIPTOR sec_desc;
-               netr_String dummy1;
-               netr_String dummy2;
-               netr_String dummy3;
-               netr_String dummy4;
-               uint32 dummy5;
-               uint32 dummy6;
-               uint32 dummy7;
-               uint32 dummy8;
-       } DELTA_GROUP;
+               sec_desc_buf sdbuf;
+               netr_String unknown1;
+               netr_String unknown2;
+               netr_String unknown3;
+               netr_String unknown4;
+               uint32 unknown5;
+               uint32 unknown6;
+               uint32 unknown7;
+               uint32 unknown8;
+       } netr_DELTA_GROUP;
+
        typedef struct {
                netr_String OldName;
                netr_String NewName;
-               netr_String dummy1;
-               netr_String dummy2;
-               netr_String dummy3;
-               netr_String dummy4;
-               uint32 dummy5;
-               uint32 dummy6;
-               uint32 dummy7;
-               uint32 dummy8;
-       } DELTA_RENAME;
+               netr_String unknown1;
+               netr_String unknown2;
+               netr_String unknown3;
+               netr_String unknown4;
+               uint32 unknown5;
+               uint32 unknown6;
+               uint32 unknown7;
+               uint32 unknown8;
+       } netr_DELTA_RENAME;
+
        typedef struct {
                [size_is(num_rids)] uint32 *rids;
                [size_is(num_rids)] uint32 *attribs;
                uint32 num_rids;
-               uint32 dummy1;
-               uint32 dummy2;
-               uint32 dummy3;
-               uint32 dummy4;
-       } DELTA_GROUP_MEMBER;
+               uint32 unknown1;
+               uint32 unknown2;
+               uint32 unknown3;
+               uint32 unknown4;
+       } netr_DELTA_GROUP_MEMBER;
+
        typedef struct {
                netr_String alias_name;
                uint32 rid;
                uint32 SecurityInformation;
-               LSA_SECURITY_DESCRIPTOR sec_desc;
-               netr_String dummy1;
-               netr_String dummy2;
-               netr_String dummy3;
-               netr_String dummy4;
-               uint32 dummy5;
-               uint32 dummy6;
-               uint32 dummy7;
-               uint32 dummy8;
-       } DELTA_ALIAS;
-       typedef struct {
-                SID_ARRAY sids;
-               uint32 dummy1;
-               uint32 dummy2;
-               uint32 dummy3;
-               uint32 dummy4;
-       } DELTA_ALIAS_MEMBER;
+               sec_desc_buf sdbuf;
+               netr_String description;
+               netr_String unknown2;
+               netr_String unknown3;
+               netr_String unknown4;
+               uint32 unknown5;
+               uint32 unknown6;
+               uint32 unknown7;
+               uint32 unknown8;
+       } netr_DELTA_ALIAS;
+
+       typedef struct {
+               lsa_SidArray sids;
+               uint32 unknown1;
+               uint32 unknown2;
+               uint32 unknown3;
+               uint32 unknown4;
+       } netr_DELTA_ALIAS_MEMBER;
+
        typedef struct {
                uint32 pagedpoollimit;
                uint32 nonpagedpoollimit;
@@ -401,278 +486,692 @@ interface netlogon
                uint32 maximumworkingsetsize;
                uint32 pagefilelimit;
                NTTIME timelimit;
-       } QUOTA_LIMITS;
+       } netr_QUOTA_LIMITS;
+
        typedef struct {
                uint32 maxlogsize;
                NTTIME auditretentionperiod;
-               bool auditingmode;
+               bool8 auditingmode;
                uint32 maxauditeventcount;
-               [size_is(maxauditeventcount)] uint32 *eventauditoptions;
-               netr_String primarydomainname;
-                dom_sid2 *sid;
-               QUOTA_LIMITS quota_limits;
-               NTTIME db_modify_time;
+               [size_is(maxauditeventcount+1)] uint32 *eventauditoptions;
+               netr_String primary_domain_name;
+               dom_sid2 *sid;
+               netr_QUOTA_LIMITS quota_limits;
+               udlong sequence_num;
                NTTIME db_create_time;
                uint32 SecurityInformation;
-               LSA_SECURITY_DESCRIPTOR sec_desc;
-               netr_String dummy1;
-               netr_String dummy2;
-               netr_String dummy3;
-               netr_String dummy4;
-               uint32 dummy5;
-               uint32 dummy6;
-               uint32 dummy7;
-               uint32 dummy8;
-       } DELTA_POLICY;
-       typedef struct {
-               netr_String DomainName;
+               sec_desc_buf sdbuf;
+               netr_String unknown1;
+               netr_String unknown2;
+               netr_String unknown3;
+               netr_String unknown4;
+               uint32 unknown5;
+               uint32 unknown6;
+               uint32 unknown7;
+               uint32 unknown8;
+       } netr_DELTA_POLICY;
+
+       typedef struct {
+               netr_String domain_name;
                uint32 num_controllers;
                [size_is(num_controllers)] netr_String *controller_names;
                uint32 SecurityInformation;
-               LSA_SECURITY_DESCRIPTOR sec_desc;
-               netr_String dummy1;
-               netr_String dummy2;
-               netr_String dummy3;
-               netr_String dummy4;
-               uint32 dummy5;
-               uint32 dummy6;
-               uint32 dummy7;
-               uint32 dummy8;
-       } DELTA_TRUSTED_DOMAINS;
-       typedef struct {
-               uint32 privilegeentries;
-               uint32 provolegecontrol;
+               sec_desc_buf sdbuf;
+               netr_String unknown1;
+               netr_String unknown2;
+               netr_String unknown3;
+               netr_String unknown4;
+               uint32 posix_offset;
+               uint32 unknown6;
+               uint32 unknown7;
+               uint32 unknown8;
+       } netr_DELTA_TRUSTED_DOMAIN;
+
+       typedef struct {
+               uint16 unknown;
+       } netr_DELTA_DELETE_TRUST;
+
+       typedef struct {
+               uint32 privilege_entries;
+               uint32 privilege_control;
                [size_is(privilege_entries)] uint32 *privilege_attrib;
                [size_is(privilege_entries)] netr_String *privilege_name;
-               QUOTALIMITS quotalimits;
+               netr_QUOTA_LIMITS quotalimits;
+               uint32 system_flags;
                uint32 SecurityInformation;
-               LSA_SECURITY_DESCRIPTOR sec_desc;
-               netr_String dummy1;
-               netr_String dummy2;
-               netr_String dummy3;
-               netr_String dummy4;
-               uint32 dummy5;
-               uint32 dummy6;
-               uint32 dummy7;
-               uint32 dummy8;
-       } DELTA_ACCOUNTS;
+               sec_desc_buf sdbuf;
+               netr_String unknown1;
+               netr_String unknown2;
+               netr_String unknown3;
+               netr_String unknown4;
+               uint32 unknown5;
+               uint32 unknown6;
+               uint32 unknown7;
+               uint32 unknown8;
+       } netr_DELTA_ACCOUNT;
+
+       typedef struct {
+               uint16 unknown;
+       } netr_DELTA_DELETE_ACCOUNT;
+
+       typedef struct {
+               uint16 unknown;
+       } netr_DELTA_DELETE_SECRET;
+
        typedef struct {
                uint32 len;
                uint32 maxlen;
                [size_is(maxlen)][length_is(len)] uint8 *cipher_data;
-       } CIPHER_VALUE;
+       } netr_CIPHER_VALUE;
+
        typedef struct {
-               CIPHER_VALUE current_cipher;
+               netr_CIPHER_VALUE current_cipher;
                NTTIME current_cipher_set_time;
-               CIPHER_VALUE old_cipher;
+               netr_CIPHER_VALUE old_cipher;
                NTTIME old_cipher_set_time;
                uint32 SecurityInformation;
-               LSA_SECURITY_DESCRIPTOR sec_desc;
-               netr_String dummy1;
-               netr_String dummy2;
-               netr_String dummy3;
-               netr_String dummy4;
-               uint32 dummy5;
-               uint32 dummy6;
-               uint32 dummy7;
-               uint32 dummy8;
-       } DELTA_SECRET;
-       typedef struct {
-               uint32 low_value;
-               uint32 high_value;
-       } xxx;
-
-       typedef [switch_type(short)] union {
-               [case(1)] DELTA_DOMAIN *domain;
-               [case(2)] DELTA_GROUP *group;
-               [case(4)] DELTA_RENAME_GROUP *rename_group;
-               [case(5)] DELTA_USER *user;
-               [case(7)] DELTA_RENAME_USER *rename_user;
-               [case(8)] DELTA_GROUP_MEMBER *group_member;
-               [case(9)] DELTA_ALIAS *alias;
-               [case(11)] DELTA_RENAME_ALIAS *rename_alias;
-               [case(12)] DELTA_ALIAS_MEMBER *alias_member;
-               [case(13)] DELTA_POLICY *policy;
-               [case(14)] DELTA_TRUSTED_DOMAINS *trusted_domains;
-               [case(16)] DELTA_ACCOUNTS *accounts;
-               [case(18)] DELTA_SECRET *secret;
-               [case(20)] DELTA_DELETE_USER *delete_group;
-               [case(21)] DELTA_DELETE_USER *delete_user;
-               [case(22)] MODIFIED_COUNT *modified_count;
-       } DELTA_UNION;
-
-       typedef [switch_type(short)] union {
-               [case(1)] uint32 rid;
-               [case(2)] uint32 rid;
-               [case(3)] uint32 rid;
-               [case(4)] uint32 rid;
-               [case(5)] uint32 rid;
-               [case(6)] uint32 rid;
-               [case(7)] uint32 rid;
-               [case(8)] uint32 rid;
-               [case(9)] uint32 rid;
-               [case(10)] uint32 rid;
-               [case(11)] uint32 rid;
-               [case(12)] uint32 rid;
-               [case(13)]  dom_sid2 *sid;
-               [case(14)]  dom_sid2 *sid;
-               [case(15)]  dom_sid2 *sid;
-               [case(16)]  dom_sid2 *sid;
-               [case(17)]  dom_sid2 *sid;
-               [case(18)] unistr *Name ;
-               [case(19)] unistr *Name ;
-               [case(20)] uint32 rid;
-               [case(21)] uint32 rid;
-       } DELTA_ID_UNION;
-       typedef struct {
-               uint16 delta_type;
-               DELTA_ID_UNION delta_id_union;
-               DELTA_UNION delta_union;
-       } DELTA_ENUM;
+               sec_desc_buf sdbuf;
+               netr_String unknown1;
+               netr_String unknown2;
+               netr_String unknown3;
+               netr_String unknown4;
+               uint32 unknown5;
+               uint32 unknown6;
+               uint32 unknown7;
+               uint32 unknown8;
+       } netr_DELTA_SECRET;
+
+       typedef enum {
+               NETR_DELTA_DOMAIN           = 1,
+               NETR_DELTA_GROUP            = 2,
+               NETR_DELTA_DELETE_GROUP     = 3,
+               NETR_DELTA_RENAME_GROUP     = 4,
+               NETR_DELTA_USER             = 5,
+               NETR_DELTA_DELETE_USER      = 6,
+               NETR_DELTA_RENAME_USER      = 7,
+               NETR_DELTA_GROUP_MEMBER     = 8,
+               NETR_DELTA_ALIAS            = 9,
+               NETR_DELTA_DELETE_ALIAS     = 10,
+               NETR_DELTA_RENAME_ALIAS     = 11,
+               NETR_DELTA_ALIAS_MEMBER     = 12,
+               NETR_DELTA_POLICY           = 13,
+               NETR_DELTA_TRUSTED_DOMAIN   = 14,
+               NETR_DELTA_DELETE_TRUST     = 15,
+               NETR_DELTA_ACCOUNT          = 16,
+               NETR_DELTA_DELETE_ACCOUNT   = 17,
+               NETR_DELTA_SECRET           = 18,
+               NETR_DELTA_DELETE_SECRET    = 19,
+               NETR_DELTA_DELETE_GROUP2    = 20,
+               NETR_DELTA_DELETE_USER2     = 21,
+               NETR_DELTA_MODIFY_COUNT     = 22
+       } netr_DeltaEnum;
+
+       typedef [switch_type(netr_DeltaEnum)] union {
+               [case(NETR_DELTA_DOMAIN)]          netr_DELTA_DOMAIN          *domain;
+               [case(NETR_DELTA_GROUP)]           netr_DELTA_GROUP           *group;
+               [case(NETR_DELTA_DELETE_GROUP)]    ; /* rid only */
+               [case(NETR_DELTA_RENAME_GROUP)]    netr_DELTA_RENAME          *rename_group;
+               [case(NETR_DELTA_USER)]            netr_DELTA_USER            *user;
+               [case(NETR_DELTA_DELETE_USER)]     ; /* rid only */
+               [case(NETR_DELTA_RENAME_USER)]     netr_DELTA_RENAME          *rename_user;
+               [case(NETR_DELTA_GROUP_MEMBER)]    netr_DELTA_GROUP_MEMBER    *group_member;
+               [case(NETR_DELTA_ALIAS)]           netr_DELTA_ALIAS           *alias;
+               [case(NETR_DELTA_DELETE_ALIAS)]    ; /* rid only */
+               [case(NETR_DELTA_RENAME_ALIAS)]    netr_DELTA_RENAME          *rename_alias;
+               [case(NETR_DELTA_ALIAS_MEMBER)]    netr_DELTA_ALIAS_MEMBER    *alias_member;
+               [case(NETR_DELTA_POLICY)]          netr_DELTA_POLICY          *policy;
+               [case(NETR_DELTA_TRUSTED_DOMAIN)]  netr_DELTA_TRUSTED_DOMAIN   *trusted_domain;
+               [case(NETR_DELTA_DELETE_TRUST)]    netr_DELTA_DELETE_TRUST     delete_trust;
+               [case(NETR_DELTA_ACCOUNT)]         netr_DELTA_ACCOUNT         *account;
+               [case(NETR_DELTA_DELETE_ACCOUNT)]  netr_DELTA_DELETE_ACCOUNT   delete_account;
+               [case(NETR_DELTA_SECRET)]          netr_DELTA_SECRET          *secret;
+               [case(NETR_DELTA_DELETE_SECRET)]   netr_DELTA_DELETE_SECRET    delete_secret;
+               [case(NETR_DELTA_DELETE_GROUP2)]   netr_DELTA_DELETE_USER     *delete_group;
+               [case(NETR_DELTA_DELETE_USER2)]    netr_DELTA_DELETE_USER     *delete_user;
+               [case(NETR_DELTA_MODIFY_COUNT)]    udlong                     *modified_count;
+       } netr_DELTA_UNION;
+
+       typedef [switch_type(netr_DeltaEnum)] union {
+               [case(NETR_DELTA_DOMAIN)]          uint32 rid;
+               [case(NETR_DELTA_GROUP)]           uint32 rid;
+               [case(NETR_DELTA_DELETE_GROUP)]    uint32 rid;
+               [case(NETR_DELTA_RENAME_GROUP)]    uint32 rid;
+               [case(NETR_DELTA_USER)]            uint32 rid;
+               [case(NETR_DELTA_DELETE_USER)]     uint32 rid;
+               [case(NETR_DELTA_RENAME_USER)]     uint32 rid;
+               [case(NETR_DELTA_GROUP_MEMBER)]    uint32 rid;
+               [case(NETR_DELTA_ALIAS)]           uint32 rid;
+               [case(NETR_DELTA_DELETE_ALIAS)]    uint32 rid;
+               [case(NETR_DELTA_RENAME_ALIAS)]    uint32 rid;
+               [case(NETR_DELTA_ALIAS_MEMBER)]    uint32 rid;
+               [case(NETR_DELTA_POLICY)]          dom_sid2 *sid;
+               [case(NETR_DELTA_TRUSTED_DOMAIN)]  dom_sid2 *sid;
+               [case(NETR_DELTA_DELETE_TRUST)]    dom_sid2 *sid;
+               [case(NETR_DELTA_ACCOUNT)]         dom_sid2 *sid;
+               [case(NETR_DELTA_DELETE_ACCOUNT)]  dom_sid2 *sid;
+               [case(NETR_DELTA_SECRET)]          unistr *name;
+               [case(NETR_DELTA_DELETE_SECRET)]   unistr *name;
+               [case(NETR_DELTA_DELETE_GROUP2)]   uint32 rid;
+               [case(NETR_DELTA_DELETE_USER2)]    uint32 rid;
+               [case(NETR_DELTA_MODIFY_COUNT)]    ;
+       } netr_DELTA_ID_UNION;
+
+       typedef struct {
+               netr_DeltaEnum delta_type;
+               [switch_is(delta_type)] netr_DELTA_ID_UNION delta_id_union;
+               [switch_is(delta_type)] netr_DELTA_UNION delta_union;
+       } netr_DELTA_ENUM;
+
        typedef struct {
                uint32 num_deltas;
-               [size_is(num_deltas)] DELTA_ENUM *delta_enum;
-       } DELTA_ENUM_ARRAY;
-       WERROR netr_DatabaseDeltas(
-               [in][string][ref] wchar_t *logonserver, # REF!!!
-               [in][string][ref] wchar_t *computername,
-               [in][ref] AUTHENTICATOR credential,
-               [in][out][ref] AUTHENTICATOR return_authenticator,
-               [in] uint32 database_id,
-               [in][out][ref] MODIFIED_COUNT domain_modify_count,
-               [in] uint32 preferredmaximumlength,
-               [out] DELTA_ENUM_ARRAY *delta_enum_array
+               [size_is(num_deltas)] netr_DELTA_ENUM *delta_enum;
+       } netr_DELTA_ENUM_ARRAY;
+
+
+       NTSTATUS netr_DatabaseDeltas(
+               [in]      unistr logon_server,
+               [in]      unistr computername,
+               [in]      netr_Authenticator credential,
+               [in,out]  netr_Authenticator return_authenticator,
+               [in]      netr_SamDatabaseID database_id,
+               [in,out]  udlong sequence_num,
+               [in]      uint32 preferredmaximumlength,
+               [out]     netr_DELTA_ENUM_ARRAY *delta_enum_array
                );
-       WERROR netr_DatabaseSync(
-               [in][string][ref] wchar_t *logonserver, # REF!!!
-               [in][string][ref] wchar_t *computername,
-               [in][ref] AUTHENTICATOR credential,
-               [in][out][ref] AUTHENTICATOR return_authenticator,
-               [in] uint32 database_id,
-               [in][out][ref] uint32 sync_context,
-               [in] uint32 preferredmaximumlength,
-               [out] DELTA_ENUM_ARRAY *delta_enum_array
+
+
+       /*****************/
+       /* Function 0x08 */
+
+       NTSTATUS netr_DatabaseSync(
+               [in]     unistr logon_server,
+               [in]     unistr computername,
+               [in]     netr_Authenticator credential,
+               [in,out] netr_Authenticator return_authenticator,
+               [in]     netr_SamDatabaseID database_id,
+               [in,out] uint32 sync_context,
+               [in]     uint32 preferredmaximumlength,
+               [out]    netr_DELTA_ENUM_ARRAY *delta_enum_array
                );
-       typedef struct {
+
+
+       /*****************/
+       /* Function 0x09 */
+
+       /* w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this call */
+
+       typedef [flag(NDR_PAHEX)] struct {
                uint8 computer_name[16];
                uint32 timecreated;
                uint32 serial_number;
-       } UAS_INFO_0;
-       WERROR netr_AccountDeltas(
-               [in][string] wchar_t *logonserver,
-               [in][string][ref] wchar_t *computername,
-               [in][ref] AUTHENTICATOR credential,
-               [in][out][ref] AUTHENTICATOR return_authenticator,
-               [out][ref][size_is(count_returned)] uint8 *Buffer,
-               [out][ref] uint32 count_returned,
-               [out][ref] uint32 total_entries,
-               [in][out][ref] UAS_INFO_0 recordid,
-               [in][long] count,
-               [in][long] level,
-               [in][long] buffersize,
+       } netr_UAS_INFO_0;
+
+       typedef struct {
+               [flag(NDR_REMAINING)] DATA_BLOB blob;
+       } netr_AccountBuffer;
+
+       NTSTATUS netr_AccountDeltas(
+               [in]     unistr *logon_server,
+               [in]     unistr computername,
+               [in]     netr_Authenticator credential,
+               [in,out] netr_Authenticator return_authenticator,
+               [in]     netr_UAS_INFO_0 uas,
+               [in]     uint32 count,
+               [in]     uint32 level,
+               [in]     uint32 buffersize,
+               [out,subcontext(4)] netr_AccountBuffer buffer,
+               [out]    uint32 count_returned,
+               [out]    uint32 total_entries,
+               [out]    netr_UAS_INFO_0 recordid
                );
-       WERROR netr_AccountSync(
-               [in][string] wchar_t *logonserver,
-               [in][string][ref] wchar_t *computername,
-               [in][ref] AUTHENTICATOR credential,
-               [in][out][ref] AUTHENTICATOR return_authenticator,
-               [out][ref][size_is(count_returned)] uint8 *Buffer,
-               [out][ref] uint32 count_returned,
-               [out][ref] uint32 total_entries,
-               [out][ref] uint32 next_reference,
-               [in][long] reference,
-               [in][long] level,
-               [in][long] buffersize,
-               [in][out][ref] UAS_INFO_0 recordid,
+
+
+       /*****************/
+       /* Function 0x0A */
+
+       NTSTATUS netr_AccountSync(
+               [in]      unistr *logon_server,
+               [in]      unistr computername,
+               [in]      netr_Authenticator credential,
+               [in,out]  netr_Authenticator return_authenticator,
+               [in]      uint32 reference,
+               [in]      uint32 level,
+               [in]      uint32 buffersize,
+               [out,subcontext(4)] netr_AccountBuffer buffer,
+               [out]     uint32 count_returned,
+               [out]     uint32 total_entries,
+               [out]     uint32 next_reference,
+               [in,out]  netr_UAS_INFO_0 recordid
+               );
+
+
+       /*****************/
+       /* Function 0x0B */
+
+       NTSTATUS netr_GetDcName(
+               [in]  unistr logon_server,
+               [in]  unistr *domainname,
+               [out] unistr *dcname
                );
-       WERROR netr_GetDcName(
-               [in] unistr logon_server,
-               [in] unistr *domainname,
-               [out]unistr *dcname,
-               };
+
+       /*****************/
+       /* Function 0x0C */
+
        typedef struct {
                uint32 flags;
                uint32 pdc_connection_status;
-       } NETLOGON_INFO_1;
+       } netr_NETLOGON_INFO_1;
+
        typedef struct {
                uint32 flags;
                uint32 pdc_connection_status;
-               unistrtrusted_dc_name;
+               unistr trusted_dc_name;
                uint32 tc_connection_status;
-       } NETLOGON_INFO_2;
+       } netr_NETLOGON_INFO_2;
+
        typedef struct {
                uint32 flags;
                uint32 logon_attempts;
-               uint32 reserved;
-               uint32 reserved;
-               uint32 reserved;
-               uint32 reserved;
-               uint32 reserved;
-       } NETLOGON_INFO_3;
-       typedef [switch_type(long)] union {
-               [case(1)]  NETLOGON_INFO_1 *i1;
-               [case(2)]  NETLOGON_INFO_2 *i2;
-               [case(3)]  NETLOGON_INFO_3 *i3;
-       } CONTROL_QUERY_INFORMATION;
+               uint32 unknown1;
+               uint32 unknown2;
+               uint32 unknown3;
+               uint32 unknown4;
+               uint32 unknown5;
+       } netr_NETLOGON_INFO_3;
+
+       typedef union {
+               [case(1)]  netr_NETLOGON_INFO_1 *info1;
+               [case(2)]  netr_NETLOGON_INFO_2 *info2;
+               [case(3)]  netr_NETLOGON_INFO_3 *info3;
+       } netr_CONTROL_QUERY_INFORMATION;
+
+       /* function_code values */
+       typedef [v1_enum] enum {
+               NETLOGON_CONTROL_REDISCOVER       = 5,
+               NETLOGON_CONTROL_TC_QUERY         = 6,
+               NETLOGON_CONTROL_TRANSPORT_NOTIFY = 7,
+               NETLOGON_CONTROL_SET_DBFLAG       = 65534
+       } netr_LogonControlCode;
+
        WERROR netr_LogonControl(
-               [in][string] wchar_t *logonserver,
-               [in] uint32 function_code,
-               [in] uint32 level,
-               [out][ref] CONTROL_QUERY_INFORMATION
+               [in]   unistr *logon_server,
+               [in]   netr_LogonControlCode function_code,
+               [in]   uint32 level,
+               [out,switch_is(level)]  netr_CONTROL_QUERY_INFORMATION info
                );
+
+
+       /*****************/
+       /* Function 0x0D */
+
        WERROR netr_GetAnyDCName(
-               [in] unistr *logon_server,
-               [in] unistr *domainname,
-               [out]unistr *dcname,
-               };
-       typedef [switch_type(long)] union {
-               [case(5)] unistr *unknown;
-               [case(6)] unistr *unknown;
-               [case(0xfffe)] uint32 unknown;
-               [case(7)] unistry*unknown;
-       } CONTROL_DATA_INFORMATION;
+               [in]  unistr *logon_server,
+               [in]  unistr *domainname,
+               [out] unistr *dcname
+               );
+
+
+       /*****************/
+       /* Function 0x0E */
+
+       typedef union {
+               [case(NETLOGON_CONTROL_REDISCOVER)]        unistr *domain;
+               [case(NETLOGON_CONTROL_TC_QUERY)]          unistr *domain;
+               [case(NETLOGON_CONTROL_TRANSPORT_NOTIFY)]  unistr *domain;
+               [case(NETLOGON_CONTROL_SET_DBFLAG)]        uint32 debug_level;
+       } netr_CONTROL_DATA_INFORMATION;
+
        WERROR netr_LogonControl2(
-               [in][string] wchar_t *logonserver,
-               [in] uint32 function_code,
-               [in] uint32 level,
-               [in][ref] CONTROL_DATA_INFORMATION *data,
-               [out][ref] CONTROL_QUERY_INFORMATION *query
+               [in]    unistr *logon_server,
+               [in]    uint32 function_code,
+               [in]    uint32 level,
+               [in][switch_is(function_code)] netr_CONTROL_DATA_INFORMATION  data,
+               [out][switch_is(level)]        netr_CONTROL_QUERY_INFORMATION query
                );
-       WERROR netr_ServerAuthenticate2(
-               [in][string] wchar_t *logonserver,
-               [in] unistr username,
-               [in] uint16 secure_channel_type,
-               [in] unistr computername,
-               [in][ref] CREDENTIAL *client_chal,
-               [out][ref] CREDENTIAL *server_chal,
-               [in][out][ref] uint32 *negotiate_flags,
+
+
+       /* If this flag is not set, then the passwords and LM session keys are
+        * encrypted with DES calls.  (And the user session key is
+        * unencrypted) */ 
+       const int NETLOGON_NEG_ARCFOUR  = 0x00000004;
+       const int NETLOGON_NEG_128BIT   = 0x00004000;
+       const int NETLOGON_NEG_SCHANNEL = 0x40000000;
+
+       /*****************/
+       /* Function 0x0F */
+
+       NTSTATUS netr_ServerAuthenticate2(
+               [in]         unistr *server_name,
+               [in]         unistr account_name,
+               [in]         netr_SchannelType secure_channel_type,
+               [in]         unistr computer_name,
+               [in,out,ref] netr_Credential *credentials,
+               [in,out,ref] uint32 *negotiate_flags
                );
-       WERROR netr_DatabaseSync2(
-               [in][string][ref] wchar_t *logonserver, # REF!!!
-               [in][string][ref] wchar_t *computername,
-               [in][ref] AUTHENTICATOR credential,
-               [in][out][ref] AUTHENTICATOR return_authenticator,
-               [in] uint32 database_id,
-               [in] uint16 restart_state,
-               [in][out][ref] uint32 *sync_context,
-               [in] uint32 preferredmaximumlength,
-               [out] DELTA_ENUM_ARRAY *delta_enum_array
+
+
+       /*****************/
+       /* Function 0x10 */
+
+       NTSTATUS netr_DatabaseSync2(
+               [in]     unistr logon_server,
+               [in]     unistr computername,
+               [in]     netr_Authenticator credential,
+               [in,out] netr_Authenticator return_authenticator,
+               [in]     netr_SamDatabaseID database_id,
+               [in]     uint16 restart_state,
+               [in,out] uint32 sync_context,
+               [in]     uint32 preferredmaximumlength,
+               [out]    netr_DELTA_ENUM_ARRAY *delta_enum_array
                );
-       WERROR netr_DatabaseRedo(
-               [in][string][ref] wchar_t *logonserver, # REF!!!
-               [in][string][ref] wchar_t *computername,
-               [in][ref] AUTHENTICATOR credential,
-               [in][out][ref] AUTHENTICATOR return_authenticator,
-               [in][ref][size_is(change_log_entry_size)] uint8 *change_log_entry,
-               [in] uint32 change_log_entry_size,
-               [out] DELTA_ENUM_ARRAY *delta_enum_array
+
+
+       /*****************/
+       /* Function 0x11 */
+
+       /* i'm not at all sure how this call works */
+
+       NTSTATUS netr_DatabaseRedo(
+               [in]     unistr logon_server,
+               [in]     unistr computername,
+               [in]     netr_Authenticator credential,
+               [in,out] netr_Authenticator return_authenticator,
+               [in][size_is(change_log_entry_size)] uint8 *change_log_entry,
+               [in]     uint32 change_log_entry_size,
+               [out]    netr_DELTA_ENUM_ARRAY *delta_enum_array
                );
+
+
+       /*****************/
+       /* Function 0x12 */
+
        WERROR netr_LogonControl2Ex(
-               [in][string] wchar_t *logonserver,
-               [in] uint32 function_code,
-               [in] uint32 level,
-               [in][ref] CONTROL_DATA_INFORMATION *data,
-               [out][ref] CONTROL_QUERY_INFORMATION *query
+               [in]   unistr *logon_server,
+               [in]   uint32 function_code,
+               [in]   uint32 level,
+               [in][switch_is(function_code)] netr_CONTROL_DATA_INFORMATION  data,
+               [out][switch_is(level)]        netr_CONTROL_QUERY_INFORMATION query
+               );
+
+       /*****************/
+       /* Function 0x13 */
+       WERROR netr_NETRENUMERATETRUSTEDDOMAINS() ;
+
+       /*****************/
+       /* Function 0x14 */             
+       WERROR netr_DSRGETDCNAME() ;
+
+       /*****************/
+       /* Function 0x15 */
+       WERROR netr_NETRLOGONDUMMYROUTINE1();
+
+       /****************/
+       /* Function 0x16 */
+       WERROR netr_NETRLOGONSETSERVICEBITS();
+
+       /****************/
+       /* Function 0x17 */
+       WERROR netr_NETRLOGONGETTRUSTRID();
+
+       /****************/
+       /* Function 0x18 */
+       WERROR netr_NETRLOGONCOMPUTESERVERDIGEST();
+
+       /****************/
+       /* Function 0x19 */
+       WERROR netr_NETRLOGONCOMPUTECLIENTDIGEST();
+
+       /****************/
+       /* Function 0x1a */
+       NTSTATUS netr_ServerAuthenticate3(
+               [in]         unistr *server_name,
+               [in]         unistr account_name,
+               [in]         netr_SchannelType secure_channel_type,
+               [in]         unistr computer_name,
+               [in,out,ref] netr_Credential *credentials,
+               [in,out,ref] uint32 *negotiate_flags,
+               [out,ref]    uint32 *rid
+               );
+
+       /****************/
+       /* Function 0x1b */
+       WERROR netr_DSRGETDCNAMEX();
+
+       /****************/
+       /* Function 0x1c */
+       WERROR netr_DSRGETSITENAME();
+
+       /****************/
+       /* Function 0x1d */
+
+       typedef struct {
+               uint32 length;
+               [size_is(length)] uint8 *data;
+       } netr_Blob;
+
+       typedef [flag(NDR_PAHEX)] struct {
+               uint16 length;
+               uint16 size;
+               [size_is(size/2),length_is(length/2)] uint16 *data;
+       } netr_BinaryString;
+
+       typedef struct {
+               netr_Blob blob;
+               unistr *workstation_domain;
+               unistr *workstation_site;
+               unistr *unknown1;
+               unistr *unknown2;
+               unistr *unknown3;
+               unistr *unknown4;
+               netr_BinaryString blob2;
+               netr_String product;
+               netr_String unknown5;
+               netr_String unknown6;
+               uint32 unknown7[4];
+       } netr_DomainQuery1;
+
+       typedef union {
+               [case(1)] netr_DomainQuery1 *query1;
+               [case(2)] netr_DomainQuery1 *query1;
+       } netr_DomainQuery;
+
+       typedef struct {
+               netr_String domainname;
+               netr_String fulldomainname;
+               netr_String forest;
+               GUID        guid;
+               dom_sid2    *sid;
+               netr_BinaryString unknown1[4];
+               uint32      unknown[4];
+       } netr_DomainTrustInfo;
+
+       typedef struct {
+               netr_DomainTrustInfo domaininfo;
+               uint32 num_trusts;
+               [size_is(num_trusts)] netr_DomainTrustInfo *trusts;
+               uint32 unknown[14]; /* room for expansion? */
+       } netr_DomainInfo1;
+
+       typedef union {
+               [case(1)] netr_DomainInfo1 *info1;
+               [case(2)] netr_DomainInfo1 *info1;
+       } netr_DomainInfo;
+       
+       NTSTATUS netr_LogonGetDomainInfo(
+               [in]         unistr server_name,
+               [in]         unistr *computer_name,
+               [in,ref]     netr_Authenticator *credential,
+               [in,out,ref] netr_Authenticator *return_authenticator,
+               [in]         uint32 level,
+               [in,switch_is(level)] netr_DomainQuery query,
+               [out,switch_is(level)] netr_DomainInfo info
+               );
+
+       typedef [flag(NDR_PAHEX)] struct {
+               uint16 data[256];
+               uint32 length;
+       } netr_CryptPassword;
+
+       /*****************/
+       /* Function 0x1e */
+       NTSTATUS netr_ServerPasswordSet2(
+               [in]  unistr *server_name,
+               [in]  unistr account_name,
+               [in]  netr_SchannelType secure_channel_type,
+               [in]  unistr computer_name,
+               [in]  netr_Authenticator credential,
+               [in]  netr_CryptPassword new_password,
+               [out] netr_Authenticator return_authenticator
+               );
+
+       /****************/
+       /* Function 0x1f */
+       WERROR netr_NETRSERVERPASSWORDGET();
+
+       /****************/
+       /* Function 0x20 */
+       WERROR netr_NETRLOGONSENDTOSAM();
+
+       /****************/
+       /* Function 0x21 */
+       WERROR netr_DSRADDRESSTOSITENAMESW();
+
+       /****************/
+       /* Function 0x22 */
+       typedef struct {
+               unistr *dc_unc;
+               unistr *dc_address;
+               int32 dc_address_type;
+               GUID domain_guid;
+               unistr *domain_name;
+               unistr *forest_name;
+               uint32 dc_flags;
+               unistr *dc_site_name;
+               unistr *client_site_name;
+       } netr_DrsGetDCNameEx2Info;
+
+       WERROR netr_DrsGetDCNameEx2(
+               [in] unistr *server_unc,
+               [in] unistr *client_account,
+               [in] uint32 mask,
+               [in] unistr *domain_name,
+               [in] GUID *domain_guid,
+               [in] unistr *site_name,
+               [in] uint32 flags,
+               [out] netr_DrsGetDCNameEx2Info *info
+               );
+
+       /****************/
+       /* Function 0x23 */
+       WERROR netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN();
+
+       /****************/
+       /* Function 0x24 */
+       WERROR netr_NETRENUMERATETRUSTEDDOMAINSEX();
+
+       /****************/
+       /* Function 0x25 */
+       WERROR netr_DSRADDRESSTOSITENAMESEXW();
+
+       /****************/
+       /* Function 0x26 */
+       WERROR netr_DSRGETDCSITECOVERAGEW();
+
+       /****************/
+       /* Function 0x27 */
+       NTSTATUS netr_LogonSamLogonEx(
+               [in] unistr *server_name,
+               [in] unistr *workstation,
+               [in]  uint16 logon_level,
+               [in]  [switch_is(logon_level)] netr_LogonLevel logon,
+               [in]  uint16 validation_level,
+               [out] [switch_is(validation_level)] netr_Validation validation,
+               [out] uint8 authoritative,
+               [in,out] uint32 flags
+               );
+
+       /****************/
+       /* Function 0x28 */
+
+       typedef [bitmap32bit] bitmap {
+               NETR_TRUST_FLAG_IN_FOREST = 0x00000001,
+               NETR_TRUST_FLAG_OUTBOUND  = 0x00000002,
+               NETR_TRUST_FLAG_TREEROOT  = 0x00000004,
+               NETR_TRUST_FLAG_PRIMARY   = 0x00000008,
+               NETR_TRUST_FLAG_NATIVE    = 0x00000010,
+               NETR_TRUST_FLAG_INBOUND   = 0x00000020
+       } netr_TrustFlags;
+
+       typedef [v1_enum] enum {
+               NETR_TRUST_TYPE_DOWNLEVEL       = 1,
+               NETR_TRUST_TYPE_UPLEVEL         = 2,
+               NETR_TRUST_TYPE_MIT             = 3,
+               NETR_TRUST_TYPE_DCE             = 4
+       } netr_TrustType;
+
+       typedef [bitmap32bit] bitmap {
+               NETR_TRUST_ATTRIBUTE_NON_TRANSITIVE     = 0x00000001,
+               NETR_TRUST_ATTRIBUTE_UPLEVEL_ONLY       = 0x00000002,
+               NETR_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN = 0x00000004,
+               NETR_TRUST_ATTRIBUTE_FOREST_TRANSITIVE  = 0x00000008,
+               NETR_TRUST_ATTRIBUTE_CROSS_ORGANIZATION = 0x00000010,
+               NETR_TRUST_ATTRIBUTE_WITHIN_FOREST      = 0x00000020,
+               NETR_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL  = 0x00000040
+       } netr_TrustAttributes;
+
+       typedef struct {
+               unistr                  *netbios_name;
+               unistr                  *dns_name;
+               netr_TrustFlags         trust_flags;
+               uint32                  parent_index;
+               netr_TrustType          trust_type;
+               netr_TrustAttributes    trust_attributes;
+               dom_sid2                *sid;
+               GUID                    guid;
+       } netr_DomainTrust;
+
+       WERROR netr_DsrEnumerateDomainTrusts(
+               [in]                 unistr           *server_name,
+               [in]                 netr_TrustFlags  trust_flags,
+               [out]                uint32           count,
+               [out,size_is(count)] netr_DomainTrust *trusts
                );
-#endif 
+
+
+       /****************/
+       /* Function 0x29 */
+       WERROR netr_DSRDEREGISTERDNSHOSTRECORDS();
+
+       /****************/
+       /* Function 0x2a */
+       WERROR netr_NETRSERVERTRUSTPASSWORDSGET();
+
+       /****************/
+       /* Function 0x2b */
+       WERROR netr_DSRGETFORESTTRUSTINFORMATION();
+
+       /****************/
+       /* Function 0x2c */
+       WERROR netr_NETRGETFORESTTRUSTINFORMATION();
+
+       /****************/
+       /* Function 0x2d */
+
+       /* this is the ADS varient. I don't yet know what the "flags" are for */
+       NTSTATUS netr_LogonSamLogonWithFlags(
+               [in] unistr *server_name,
+               [in] unistr *workstation,
+               [in] netr_Authenticator *credential,
+               [in][out] netr_Authenticator *return_authenticator,
+               [in]  uint16 logon_level,
+               [in]  [switch_is(logon_level)] netr_LogonLevel logon,
+               [in]  uint16 validation_level,
+               [out] [switch_is(validation_level)] netr_Validation validation,
+               [out] uint8 authoritative,
+               [in,out] uint32 flags
+               );
+
+       /****************/
+       /* Function 0x2e */
+       WERROR netr_NETRSERVERGETTRUSTINFO();
 }