diff options
Diffstat (limited to 'librpc/idl')
97 files changed, 36007 insertions, 0 deletions
diff --git a/librpc/idl/IDL_LICENSE.txt b/librpc/idl/IDL_LICENSE.txt new file mode 100644 index 0000000..a2d87ec --- /dev/null +++ b/librpc/idl/IDL_LICENSE.txt @@ -0,0 +1,85 @@ +The IDL files in this directory are made available by the Samba Team +under the following license: + + Permission to use, copy, modify, and distribute these interface + definitions for any purpose is hereby granted without fee. + + This work is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + +The following relates to IDL obtained from Open Specifications Documentation + + Intellectual Property Rights Notice for Open Specifications Documentation + + * Technical Documentation. Microsoft publishes Open Specifications + documentation (“this documentation”) for protocols, file formats, + data portability, computer languages, and standards + support. Additionally, overview documents cover inter-protocol + relationships and interactions. + + * Copyrights. This documentation is covered by Microsoft + copyrights. Regardless of any other terms that are contained in + the terms of use for the Microsoft website that hosts this + documentation, you can make copies of it in order to develop + implementations of the technologies that are described in this + documentation and can distribute portions of it in your + implementations that use these technologies or in your + documentation as necessary to properly document the + implementation. You can also distribute in your implementation, + with or without modification, any schemas, IDLs, or code samples + that are included in the documentation. This permission also + applies to any documents that are referenced in the Open + Specifications documentation. + + * No Trade Secrets. Microsoft does not claim any trade secret rights + in this documentation. + + * Patents. Microsoft has patents that might cover your + implementations of the technologies described in the Open + Specifications documentation. Neither this notice nor Microsoft's + delivery of this documentation grants any licenses under those + patents or any other Microsoft patents. However, a given Open + Specifications document might be covered by the Microsoft Open + Specifications Promise or the Microsoft Community Promise. If you + would prefer a written license, or if the technologies described + in this documentation are not covered by the Open Specifications + Promise or Community Promise, as applicable, patent licenses are + available by contacting iplg@microsoft.com. + + * License Programs. To see all of the protocols in scope under a + specific license program and the associated patents, visit the + Patent Map. + + * Trademarks. The names of companies and products contained in this + documentation might be covered by trademarks or similar + intellectual property rights. This notice does not grant any + licenses under those rights. For a list of Microsoft trademarks, + visit www.microsoft.com/trademarks. + + * Fictitious Names. The example companies, organizations, products, + domain names, email addresses, logos, people, places, and events + that are depicted in this documentation are fictitious. No + association with any real company, organization, product, domain + name, email address, logo, person, place, or event is intended or + should be inferred. + + Reservation of Rights. All other rights are reserved, and this notice + does not grant any rights other than as specifically described above, + whether by implication, estoppel, or otherwise. + + Tools. The Open Specifications documentation does not require the use + of Microsoft programming tools or programming environments in order + for you to develop an implementation. If you have access to Microsoft + programming tools and environments, you are free to take advantage of + them. Certain Open Specifications documents are intended for use in + conjunction with publicly available standards specifications and + network programming art and, as such, assume that the reader either + is familiar with the aforementioned material or has immediate access + to it. + + Support. For questions and support, please contact dochelp@microsoft.com + + + The above is the IPR notice from MS-KILE diff --git a/librpc/idl/ODJ.idl b/librpc/idl/ODJ.idl new file mode 100644 index 0000000..00c731b --- /dev/null +++ b/librpc/idl/ODJ.idl @@ -0,0 +1,268 @@ +/* + The MIT License (MIT) + Copyright (c) Microsoft Corporation + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and + associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial + portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT + NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + The Offline Domain Join IDL has been derived from : + + https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src/NetMgmt/odj-idl.md +*/ + +import "misc.idl", "lsa.idl", "netlogon.idl", "security.idl"; + +#include "idl_types.h" + +cpp_quote("#define OP_JP2_FLAG_PERSISTENTSITE 0x00000001") + +[ + uuid("11111111-3333-5555-7777-99999999"), + version(0.0), + pointer_default(unique), + helpstring("Offline Domain Join IDL"), + helper("../librpc/ndr/ndr_ODJ.h") +] +interface ODJ +{ + typedef struct { + uint32 cbBlob; + [size_is(cbBlob),flag(LIBNDR_PRINT_ARRAY_HEX)] uint8 *pBlob; + } OP_BLOB; + + /* Contains a serialized ODJ_WIN7_BLOB structure. */ + const string ODJ_GUID_JOIN_PROVIDER = "{631c7621-5289-4321-bc9e-80f843f868c3}"; + + /* Contains a serialized OP_JOIN_PROV2_PART structure. */ + const string ODJ_GUID_JOIN_PROVIDER2 = "{57BFC56B-52F9-480C-ADCB-91B3F8A82317}"; + + /* Contains a serialized OP_JOIN_PROV3_PART structure. */ + const string ODJ_GUID_JOIN_PROVIDER3 = "{FC0CCF25-7FFA-474A-8611-69FFE269645F}"; + + /* Contains a serialized OP_CERT_PART structure. */ + const string ODJ_GUID_CERT_PROVIDER = "{9c0971e9-832f-4873-8e87-ef1419d4781e}"; + + /* Contains a serialized OP_POLICY_PART structure. */ + const string ODJ_GUID_POLICY_PROVIDER = "{68fb602a-0c09-48ce-b75f-07b7bd58f7ec}"; + +#if 0 + typedef struct { + char Value[6]; + } SID_IDENTIFIER_AUTHORITY; + + typedef struct { + char Revision; + char SubAuthorityCount; + SID_IDENTIFIER_AUTHORITY IdentifierAuthority; + [size_is(SubAuthorityCount)] uint32 SubAuthority[*]; + } ODJ_SID; + + typedef struct { + USHORT Length; + USHORT MaximumLength; + [size_is(MaximumLength/2), length_is(Length/2)] PWSTR Buffer; + } ODJ_UNICODE_STRING; +#endif +#define ODJ_SID dom_sid2 +#define ODJ_UNICODE_STRING lsa_StringLarge + +#define ODJ_DECLARE_SERIALIZED_PTR(el_name) \ + typedef [public] struct { \ + el_name *p; \ + } el_name ##_ctr; \ + \ + typedef [public,gensize] struct { \ + [subcontext(0xFFFFFC01)] el_name ## _ctr s; \ + } el_name ## _serialized_ptr; + + typedef struct { + ODJ_UNICODE_STRING Name; + ODJ_UNICODE_STRING DnsDomainName; + ODJ_UNICODE_STRING DnsForestName; + GUID DomainGuid; + ODJ_SID *Sid; + } ODJ_POLICY_DNS_DOMAIN_INFO; + + typedef struct { + [string,charset(UTF16)] uint16 *lpDomain; + [string,charset(UTF16)] uint16 *lpMachineName; + [string,charset(UTF16)] [flag(NDR_SECRET)] uint16 *lpMachinePassword; + /* + * Not sure whether the following 4 bytes are padding or a + * pointer, at least it's value may not be 0 for Windows to accept our + * generated win7blobs - gd + */ +#if 0 + [flag(NDR_ALIGN8)] DATA_BLOB _pad; +#else + [value(0xffffffff)] uint32 _pad; +#endif + ODJ_POLICY_DNS_DOMAIN_INFO DnsDomainInfo; + netr_DsRGetDCNameInfo DcInfo; + DWORD Options; + } ODJ_WIN7BLOB; + + typedef ODJ_WIN7BLOB *PODJ_WIN7BLOB; + + typedef struct { + DWORD dwFlags; + [string,charset(UTF16)] uint16 *lpNetbiosName; + [string,charset(UTF16)] uint16 *lpSiteName; + [string,charset(UTF16)] uint16 *lpPrimaryDNSDomain; + DWORD dwReserved; + [string,charset(UTF16)] uint16 *lpReserved; + } OP_JOINPROV2_PART; + + typedef struct { + DWORD Rid; + [string,charset(UTF16)] uint16 *lpSid; + } OP_JOINPROV3_PART; + + typedef struct { + [string,charset(UTF16)] uint16 *pKeyPath; + [string,charset(UTF16)] uint16 *pValueName; + winreg_Type ulValueType; + uint32 cbValueData; + [size_is(cbValueData),flag(LIBNDR_PRINT_ARRAY_HEX)] uint8 *pValueData; + } OP_POLICY_ELEMENT; + + typedef struct { + [string,charset(UTF16)] uint16 *pSource; + uint32 ulRootKeyId; + uint32 cElements; + [size_is(cElements)] OP_POLICY_ELEMENT *pElements; + } OP_POLICY_ELEMENT_LIST; + + typedef struct { + uint32 cElementLists; + [size_is(cElementLists)] + OP_POLICY_ELEMENT_LIST *pElementLists; + OP_BLOB Extension; + } OP_POLICY_PART; + + typedef struct { + [string,charset(UTF16)] uint16 *pTemplateName; + uint32 ulPrivateKeyExportPolicy; + [string,charset(UTF16)] uint16 *pPolicyServerUrl; + uint32 ulPolicyServerUrlFlags; + [string,charset(UTF16)] uint16 *pPolicyServerId; + uint32 cbPfx; + [size_is(cbPfx)] uint8 *pPfx; + } OP_CERT_PFX_STORE; + + typedef struct { + uint32 StoreLocation; + [string,charset(UTF16)] uint16 *pStoreName; + uint32 cbSst; + [size_is(cbSst)] uint8 *pSst; + } OP_CERT_SST_STORE; + + typedef struct { + uint32 cPfxStores; + [size_is(cPfxStores)] OP_CERT_PFX_STORE *pPfxStores; + uint32 cSstStores; + [size_is(cSstStores)] OP_CERT_SST_STORE *pSstStores; + OP_BLOB Extension; + } OP_CERT_PART; + + ODJ_DECLARE_SERIALIZED_PTR(ODJ_WIN7BLOB) + ODJ_DECLARE_SERIALIZED_PTR(OP_JOINPROV2_PART) + ODJ_DECLARE_SERIALIZED_PTR(OP_JOINPROV3_PART) + ODJ_DECLARE_SERIALIZED_PTR(OP_POLICY_PART) + ODJ_DECLARE_SERIALIZED_PTR(OP_CERT_PART) + + typedef [public,nodiscriminant,gensize] union { + [case(1)] [subcontext(0xFFFFFC01)] ODJ_WIN7BLOB win7blob; + [case(2)] [subcontext(0xFFFFFC01)] OP_JOINPROV2_PART_ctr join_prov2; + [case(3)] [subcontext(0xFFFFFC01)] OP_JOINPROV3_PART_ctr join_prov3; + [case(4)] [subcontext(0xFFFFFC01)] OP_CERT_PART_ctr cert_part; + [case(5)] [subcontext(0xFFFFFC01)] OP_POLICY_PART_ctr policy_part; + [default]; + } OP_PACKAGE_PART_u; + + typedef [public,bitmap32bit] bitmap { + OPSPI_PACKAGE_PART_ESSENTIAL = 0x00000001 + } ODJ_PackageFlags; + + typedef struct { + GUID PartType; + uint32 ulFlags; +#if 1 + [value(ndr_size_OP_PACKAGE_PART_u(Part, odj_switch_level_from_guid(&PartType), 0))] uint32 part_len; + [subcontext(4),subcontext_size(part_len),switch_is(odj_switch_level_from_guid(&PartType))] OP_PACKAGE_PART_u *Part; +#else + OP_BLOB Part; +#endif + OP_BLOB Extension; + } OP_PACKAGE_PART; + + ODJ_DECLARE_SERIALIZED_PTR(OP_PACKAGE_PART) + + typedef struct { + uint32 cParts; + [size_is(cParts)] OP_PACKAGE_PART *pParts; + OP_BLOB Extension; + } OP_PACKAGE_PART_COLLECTION; + + ODJ_DECLARE_SERIALIZED_PTR(OP_PACKAGE_PART_COLLECTION) + + typedef struct { + [value(ndr_size_OP_PACKAGE_PART_COLLECTION_serialized_ptr(w, 0))] uint32 cbBlob; + [subcontext(4), subcontext_size(cbBlob)] OP_PACKAGE_PART_COLLECTION_serialized_ptr *w; + } OP_PACKAGE_PART_COLLECTION_blob; + + typedef struct { + GUID EncryptionType; + OP_BLOB EncryptionContext; +#if 1 + OP_PACKAGE_PART_COLLECTION_blob WrappedPartCollection; +#else + OP_BLOB WrappedPartCollection; +#endif + uint32 cbDecryptedPartCollection; + OP_BLOB Extension; + } OP_PACKAGE; + + ODJ_DECLARE_SERIALIZED_PTR(OP_PACKAGE) + + typedef [v1_enum,public] enum { + ODJ_WIN7_FORMAT = 0x00000001, /* blob is ODJ_WIN7BLOB */ + ODJ_WIN8_FORMAT = 0x00000002 /* blob is OP_PACKAGE */ + } ODJFormat; + + typedef [public,nodiscriminant,gensize] union { + [case(ODJ_WIN7_FORMAT)] [subcontext(0xFFFFFC01)] ODJ_WIN7BLOB odj_win7blob; + [case(ODJ_WIN8_FORMAT)] [subcontext(0xFFFFFC01)] OP_PACKAGE_ctr op_package; + [default] [subcontext(0xFFFFFC01)] [flag(LIBNDR_FLAG_REMAINING)] DATA_BLOB blob; + } ODJ_BLOB_u; + + typedef struct { + ODJFormat ulODJFormat; + [value(ndr_size_ODJ_BLOB_u(pBlob, ulODJFormat, 0))] uint32 cbBlob; +#if 1 + [switch_is(ulODJFormat), subcontext(4), subcontext_size(cbBlob)] ODJ_BLOB_u *pBlob; +#else + [size_is(cbBlob),flag(LIBNDR_PRINT_ARRAY_HEX)] uint8 *pBlob; +#endif + } ODJ_BLOB; + + typedef [public] struct { + [value(1)] uint32 ulVersion; + uint32 ulcBlobs; + [size_is(ulcBlobs)] ODJ_BLOB *pBlobs; + } ODJ_PROVISION_DATA; + + ODJ_DECLARE_SERIALIZED_PTR(ODJ_PROVISION_DATA) +} diff --git a/librpc/idl/atsvc.idl b/librpc/idl/atsvc.idl new file mode 100644 index 0000000..e72c211 --- /dev/null +++ b/librpc/idl/atsvc.idl @@ -0,0 +1,119 @@ +/* + atsvc interface definition +*/ + +[ uuid("1ff70682-0a51-30e8-076d-740be8cee98b"), + version(1.0), + pointer_default(unique), + helpstring("Microsoft AT-Scheduler Service"), + endpoint("ncacn_np:[\\pipe\\atsvc]", "ncalrpc:") +] interface atsvc +{ + typedef [bitmap32bit] bitmap { + First = 0x00000001, + Second = 0x00000002, + Third = 0x00000004, + Fourth = 0x00000008, + Fifth = 0x00000010, + Sixth = 0x00000020, + Seventh = 0x00000040, + Eight = 0x00000080, + Ninth = 0x00000100, + Tenth = 0x00000200, + Eleventh = 0x00000400, + Twelfth = 0x00000800, + Thitteenth = 0x00001000, + Fourteenth = 0x00002000, + Fifteenth = 0x00004000, + Sixteenth = 0x00008000, + Seventeenth = 0x00010000, + Eighteenth = 0x00020000, + Nineteenth = 0x00040000, + Twentyth = 0x00080000, + Twentyfirst = 0x00100000, + Twentysecond = 0x00200000, + Twentythird = 0x00400000, + Twentyfourth = 0x00800000, + Twentyfifth = 0x01000000, + Twentysixth = 0x02000000, + Twentyseventh = 0x04000000, + Twentyeighth = 0x08000000, + Twentyninth = 0x10000000, + Thirtieth = 0x20000000, + Thirtyfirst = 0x40000000 + } atsvc_DaysOfMonth; + + typedef [bitmap8bit] bitmap { + JOB_RUN_PERIODICALLY = 0x01, + JOB_EXEC_ERROR = 0x02, + JOB_RUNS_TODAY = 0x04, + JOB_ADD_CURRENT_DATE = 0x08, + JOB_NONINTERACTIVE = 0x10 + } atsvc_Flags; + + typedef [bitmap8bit] bitmap { + DAYSOFWEEK_MONDAY = 0x01, + DAYSOFWEEK_TUESDAY = 0x02, + DAYSOFWEEK_WEDNESDAY = 0x04, + DAYSOFWEEK_THURSDAY = 0x08, + DAYSOFWEEK_FRIDAY = 0x10, + DAYSOFWEEK_SATURDAY = 0x20, + DAYSOFWEEK_SUNDAY = 0x40 + } atsvc_DaysOfWeek; + + typedef struct { + uint32 job_time; + atsvc_DaysOfMonth days_of_month; + atsvc_DaysOfWeek days_of_week; + atsvc_Flags flags; + [string,charset(UTF16)] uint16 *command; + } atsvc_JobInfo; + + /******************/ + /* Function: 0x00 */ + [public] NTSTATUS atsvc_JobAdd( + [in,unique,string,charset(UTF16)] uint16 *servername, + [in] atsvc_JobInfo *job_info, + [out,ref] uint32 *job_id + ); + + /******************/ + /* Function: 0x01 */ + [public] NTSTATUS atsvc_JobDel( + [in,unique,string,charset(UTF16)] uint16 *servername, + [in] uint32 min_job_id, + [in] uint32 max_job_id + ); + + typedef struct { + uint32 job_id; + uint32 job_time; + atsvc_DaysOfMonth days_of_month; + atsvc_DaysOfWeek days_of_week; + atsvc_Flags flags; + [string,charset(UTF16)] uint16 *command; + } atsvc_JobEnumInfo; + + typedef struct { + uint32 entries_read; + [size_is(entries_read)] atsvc_JobEnumInfo *first_entry; + } atsvc_enum_ctr; + + /******************/ + /* Function: 0x02 */ + [public] NTSTATUS atsvc_JobEnum( + [in,unique,string,charset(UTF16)] uint16 *servername, + [in,out] atsvc_enum_ctr *ctr, + [in] uint32 preferred_max_len, + [out,ref] uint32 *total_entries, + [in,out,unique] uint32 *resume_handle + ); + + /******************/ + /* Function: 0x03 */ + [public] NTSTATUS atsvc_JobGetInfo( + [in,unique,string,charset(UTF16)] uint16 *servername, + [in] uint32 job_id, + [out] atsvc_JobInfo **job_info + ); +} diff --git a/librpc/idl/audiosrv.idl b/librpc/idl/audiosrv.idl new file mode 100644 index 0000000..1b05986 --- /dev/null +++ b/librpc/idl/audiosrv.idl @@ -0,0 +1,23 @@ +[ + uuid("0a74ef1c-41a4-4e06-83ae-dc74fb1cdd53"), + version(1.0), + pointer_default(unique), + helpstring("Audio Server") +] interface audiosrv +{ + [todo] void audiosrv_CreatezoneFactoriesList(); + [todo] void audiosrv_CreateGfxFactoriesList(); + [todo] void audiosrv_CreateGfxList(); + [todo] void audiosrv_RemoveGfx(); + [todo] void audiosrv_AddGfx(); + [todo] void audiosrv_ModifyGfx(); + [todo] void audiosrv_OpenGfx(); + [todo] void audiosrv_Logon(); + [todo] void audiosrv_Logoff(); + [todo] void audiosrv_RegisterSessionNotificationEvent(); + [todo] void audiosrv_UnregisterSessionNotificationEvent(); + [todo] void audiosrv_SessionConnectState(); + [todo] void audiosrv_DriverOpenDrvRegKey(); + [todo] void audiosrv_AdvisePreferredDeviceChange(); + [todo] void audiosrv_GetPnpInfo(); +} diff --git a/librpc/idl/auth.idl b/librpc/idl/auth.idl new file mode 100644 index 0000000..ab5675e --- /dev/null +++ b/librpc/idl/auth.idl @@ -0,0 +1,170 @@ +#include "idl_types.h" + +/* + Authentication IDL structures + + These are NOT public network structures, but it is helpful to define + these things in IDL. They may change without ABI breakage or + warning. + +*/ + +import "misc.idl", "security.idl", "lsa.idl", "krb5pac.idl"; +[ + pyhelper("librpc/ndr/py_auth.c"), + helper("../librpc/ndr/ndr_auth.h"), + helpstring("internal Samba authentication structures") +] + +interface auth +{ + typedef [public] enum { + SEC_AUTH_METHOD_UNAUTHENTICATED = 0, + SEC_AUTH_METHOD_NTLM = 1, + SEC_AUTH_METHOD_KERBEROS = 2 + } auth_method; + + /* This is the parts of the session_info that don't change + * during local privilege and group manipulations */ + typedef [public] struct { + [unique,charset(UTF8),string] char *account_name; + [unique,charset(UTF8),string] char *user_principal_name; + boolean8 user_principal_constructed; + [unique,charset(UTF8),string] char *domain_name; + [unique,charset(UTF8),string] char *dns_domain_name; + + [unique,charset(UTF8),string] char *full_name; + [unique,charset(UTF8),string] char *logon_script; + [unique,charset(UTF8),string] char *profile_path; + [unique,charset(UTF8),string] char *home_directory; + [unique,charset(UTF8),string] char *home_drive; + [unique,charset(UTF8),string] char *logon_server; + + NTTIME last_logon; + NTTIME last_logoff; + NTTIME acct_expiry; + NTTIME last_password_change; + NTTIME allow_password_change; + NTTIME force_password_change; + + uint16 logon_count; + uint16 bad_password_count; + + uint32 acct_flags; + + /* + * The NETLOGON_GUEST flag being set indicates the user is not + * authenticated. + */ + uint32 user_flags; + } auth_user_info; + + /* This information is preserved only to assist torture tests */ + typedef [public] struct { + /* Number SIDs from the DC netlogon validation info */ + uint32 num_dc_sids; + [size_is(num_dc_sids)] auth_SidAttr dc_sids[*]; + } auth_user_info_torture; + + typedef [public] struct { + [unique,charset(UTF8),string] char *unix_name; + + /* + * For performance reasons we keep an alpha_strcpy-sanitized version + * of the username around as long as the global variable current_user + * still exists. If we did not do keep this, we'd have to call + * alpha_strcpy whenever we do a become_user(), potentially on every + * smb request. See set_current_user_info in source3. + */ + [unique,charset(UTF8),string] char *sanitized_username; + } auth_user_info_unix; + + /* + * If the user was authenticated with a Kerberos ticket, this indicates + * the type of the ticket; TGT, or non-TGT (i.e. service ticket). If + * unset, the type is unknown. This indicator is useful for the KDC and + * the kpasswd service, which share the same account and keys. By + * ensuring it is provided with the appropriate ticket type, each service + * avoids accepting a ticket meant for the other. + * + * The heuristic used to determine the type is the presence or absence + * of a REQUESTER_SID buffer in the PAC; we use its presence to assume + * we have a TGT. This heuristic will fail for older Samba versions and + * Windows prior to Nov. 2021 updates, which lack support for this + * buffer. + */ + typedef enum { + TICKET_TYPE_UNKNOWN = 0, + TICKET_TYPE_TGT = 1, + TICKET_TYPE_NON_TGT = 2 + } ticket_type; + + /* + * Used to indicate whether or not to include or disregard resource + * groups when forming a SamInfo structure, user_info_dc structure, or + * PAC, and whether or not to compress them when forming a PAC. + * + * When producing a TGT, existing resource groups are always copied + * unmodified into the PAC. When producing a service ticket, existing + * resource groups and resource groups in other domains are always + * discarded. + */ + typedef enum { + AUTH_GROUP_INCLUSION_INVALID = 0, /* require invalid values to be handled. */ + AUTH_INCLUDE_RESOURCE_GROUPS = 2, + AUTH_INCLUDE_RESOURCE_GROUPS_COMPRESSED = 3, + AUTH_EXCLUDE_RESOURCE_GROUPS = 4 + } auth_group_inclusion; + + typedef [public] struct { + dom_sid sid; + security_GroupAttrs attrs; + } auth_SidAttr; + + /* This is the interim product of the auth subsystem, before + * privileges and local groups are handled */ + typedef [public] struct { + uint32 num_sids; + [size_is(num_sids)] auth_SidAttr sids[*]; + auth_user_info *info; + [noprint] DATA_BLOB user_session_key; + [noprint] DATA_BLOB lm_session_key; + ticket_type ticket_type; + } auth_user_info_dc; + + typedef [public] struct { + security_token *security_token; + security_unix_token *unix_token; + auth_user_info *info; + auth_user_info_unix *unix_info; + [value(NULL), ignore] auth_user_info_torture *torture; + + /* This is the final session key, as used by SMB signing, and + * (truncated to 16 bytes) encryption on the SAMR and LSA pipes + * when over ncacn_np. + * It is calculated by NTLMSSP from the session key in the info3, + * and is set from the Kerberos session key using + * krb5_auth_con_getremotesubkey(). + * + * Bottom line, it is not the same as the session keys in info3. + */ + + [noprint] DATA_BLOB session_key; + + [value(NULL), ignore] cli_credentials *credentials; + + /* + * It is really handy to have our authorization code log a + * token that can be used to tie later requests together. + * We generate this in auth_generate_session_info() + */ + GUID unique_session_token; + + ticket_type ticket_type; + } auth_session_info; + + typedef [public] struct { + auth_session_info *session_info; + [noprint] DATA_BLOB exported_gssapi_credentials; + } auth_session_info_transport; +} diff --git a/librpc/idl/backupkey.idl b/librpc/idl/backupkey.idl new file mode 100644 index 0000000..d235951 --- /dev/null +++ b/librpc/idl/backupkey.idl @@ -0,0 +1,153 @@ +#include "idl_types.h" + +import "misc.idl", "security.idl"; +[ + uuid("3dde7c30-165d-11d1-ab8f-00805f14db40"), + version(1.0), + endpoint("ncacn_np:[\\pipe\\protected_storage]", "ncacn_ip_tcp:"), + helpstring("Remote Backup Key Storage"), + helper("../librpc/ndr/ndr_backupkey.h"), + pointer_default(unique) +] +interface backupkey +{ + const string BACKUPKEY_RESTORE_GUID = "47270C64-2FC7-499B-AC5B-0E37CDCE899A"; + const string BACKUPKEY_RETRIEVE_BACKUP_KEY_GUID = "018FF48A-EABA-40C6-8F6D-72370240E967"; + + const string BACKUPKEY_RESTORE_GUID_WIN2K = "7FE94D50-178E-11D1-AB8F-00805F14DB40"; + const string BACKUPKEY_BACKUP_GUID = "7F752B10-178E-11D1-AB8F-00805F14DB40"; + + /* + * The magic values are really what they are there is no name it's just remarkable values + * that are here to check that what is transmitted or decoded is really what the client or + * the server expect. + */ + [public] typedef struct { + [value(0x00000002)] uint32 header1; + [value(0x00000494)] uint32 header2; + uint32 certificate_len; + [value(0x00000207)] uint32 magic1; + [value(0x0000A400)] uint32 magic2; + [value(0x32415352)] uint32 magic3; + [value(0x00000800)] uint32 magic4; + [subcontext(0),subcontext_size(4),flag(NDR_REMAINING)] DATA_BLOB public_exponent; + + [subcontext(0),subcontext_size(256),flag(NDR_REMAINING)] DATA_BLOB modulus; + [subcontext(0),subcontext_size(128),flag(NDR_REMAINING)] DATA_BLOB prime1; + [subcontext(0),subcontext_size(128),flag(NDR_REMAINING)] DATA_BLOB prime2; + [subcontext(0),subcontext_size(128),flag(NDR_REMAINING)] DATA_BLOB exponent1; + [subcontext(0),subcontext_size(128),flag(NDR_REMAINING)] DATA_BLOB exponent2; + [subcontext(0),subcontext_size(128),flag(NDR_REMAINING)] DATA_BLOB coefficient; + [subcontext(0),subcontext_size(256),flag(NDR_REMAINING)] DATA_BLOB private_exponent; + [subcontext(0),subcontext_size(certificate_len),flag(NDR_REMAINING)] DATA_BLOB cert; + } bkrp_exported_RSA_key_pair; + + [public] typedef struct { + [value(0x00000001)] uint32 magic; + uint8 key[256]; + } bkrp_dc_serverwrap_key; + + [public] typedef struct { + } bkrp_empty; + + [public,gensize] typedef struct { + uint32 version; + uint32 encrypted_secret_len; + uint32 access_check_len; + GUID guid; + uint8 encrypted_secret[encrypted_secret_len]; + uint8 access_check[access_check_len]; + } bkrp_client_side_wrapped; + + [public] typedef struct { + [value(0x00000000)] uint32 magic; + [subcontext(0),flag(NDR_REMAINING)] DATA_BLOB secret; + } bkrp_client_side_unwrapped; + + [public] typedef struct { + uint32 secret_len; + [value(0x00000020)] uint32 magic; + uint8 secret[secret_len]; + uint8 payload_key[32]; + } bkrp_encrypted_secret_v2; + + [public] typedef struct { + uint32 secret_len; + [value(0x00000030)] uint32 magic1; + [value(0x00006610)] uint32 magic2; + [value(0x0000800e)] uint32 magic3; + uint8 secret[secret_len]; + uint8 payload_key[48]; + } bkrp_encrypted_secret_v3; + + /* Due to alignment constraint we can generate the structure only via pidl*/ + [public, nopush, nopull] typedef struct { + [value(0x00000001)] uint32 magic; + uint32 nonce_len; + uint8 nonce[nonce_len]; + dom_sid sid; + uint8 hash[20]; + } bkrp_access_check_v2; + + /* Due to alignment constraint we can generate the structure only via pidl*/ + [public,nopush,nopull] typedef struct { + [value(0x00000001)] uint32 magic; + uint32 nonce_len; + uint8 nonce[nonce_len]; + dom_sid sid; + uint8 hash[64]; + } bkrp_access_check_v3; + + [public] typedef struct { + uint8 r3[32]; + uint8 mac[20]; + dom_sid sid; + [subcontext(0),flag(NDR_REMAINING)] DATA_BLOB secret_data; + } bkrp_rc4encryptedpayload; + + [public] typedef struct { + [value(0x00000001)] uint32 magic; + uint32 payload_length; + uint32 ciphertext_length; + GUID guid; + uint8 r2[68]; + uint8 rc4encryptedpayload[ciphertext_length]; + } bkrp_server_side_wrapped; + + [public] typedef struct { + [flag(NDR_REMAINING)] DATA_BLOB opaque; + } bkrp_opaque_blob; + + typedef enum { + BACKUPKEY_SERVER_WRAP_VERSION = 1, + BACKUPKEY_CLIENT_WRAP_VERSION2 = 2, + BACKUPKEY_CLIENT_WRAP_VERSION3 = 3 + } bkrp_versions; + + typedef enum { + BACKUPKEY_INVALID_GUID_INTEGER = 0xFFFF, + BACKUPKEY_RESTORE_GUID_INTEGER = 0x0000, + BACKUPKEY_RETRIEVE_BACKUP_KEY_GUID_INTEGER = 0x0001, + BACKUPKEY_RESTORE_GUID_WIN2K_INTEGER = 0x0002, + BACKUPKEY_BACKUP_GUID_INTEGER = 0x0003 + } bkrp_guid_to_integer; + + [public] typedef [nodiscriminant] union { + [case(BACKUPKEY_RESTORE_GUID_INTEGER)] bkrp_client_side_wrapped restore_req; + [case(BACKUPKEY_RETRIEVE_BACKUP_KEY_GUID_INTEGER)] bkrp_empty empty; + [case(BACKUPKEY_RESTORE_GUID_WIN2K_INTEGER)] bkrp_server_side_wrapped unsign_req; + [case(BACKUPKEY_BACKUP_GUID_INTEGER)] bkrp_opaque_blob sign_req; + } bkrp_data_in_blob; + + /******************/ + /* Function: 0x00 */ + + [public, noprint] WERROR bkrp_BackupKey ( + [in,ref] GUID *guidActionAgent, + [in,ref] [size_is(data_in_len)] uint8 *data_in, + [in] uint32 data_in_len, + [out,ref] [size_is(,*data_out_len)] uint8 **data_out, + [out,ref] uint32 *data_out_len, + [in] uint32 param + ); +} diff --git a/librpc/idl/bkupblobs.idl b/librpc/idl/bkupblobs.idl new file mode 100644 index 0000000..6e4dd98 --- /dev/null +++ b/librpc/idl/bkupblobs.idl @@ -0,0 +1,54 @@ +#include "idl_types.h" + +import "misc.idl"; +import "security.idl"; +import "fscc.idl"; +/* bkup blobs interface definition */ + + +[ + pointer_default(unique), + helpstring("bkup blobs") +] + + +interface bkupblobs +{ + typedef [v1_enum] enum { + STREAM_ID_DATA = 1, + STREAM_ID_EX_DATA = 2, + STREAM_ID_SECURITY_DATA = 3, + STREAM_ID_ALTERNATE_DATA = 4, + STREAM_ID_LINK = 5, + STREAM_ID_OBJECTID = 7, + STREAM_ID_REPARSE_DATA = 8, + STREAM_ID_SPARSE_BLOCK = 9, + STREAM_ID_TXFS_DATA = 10 + } bkup_StreamId; + + typedef [v1_enum] enum { + STREAM_ATTRIBUTE_NORMAL = 0, + STREAM_ATTRIBUTE_SECURITY = 2, + STREAM_ATTRIBUTE_SPARSE = 8 + } bkup_StreamAttribute; + + typedef [nodiscriminant] union { + [default] DATA_BLOB blob; + [flag(NDR_ALIGN2),case(STREAM_ID_SECURITY_DATA)] security_descriptor sd; + [case(STREAM_ID_OBJECTID)] fscc_FileObjectIdBuffer_2 object; + } bkup_StreamData; + + typedef [public] struct { + bkup_StreamId id; + bkup_StreamAttribute attribute; + hyper size; + uint32 stream_name_size; + [charset(UTF16),flag(STR_NOTERM)] uint16 stream_name[stream_name_size]; + [subcontext(0), subcontext_size(size), switch_is(id)] [flag(NDR_REMAINING)] bkup_StreamData data; + } bkup_Win32StreamId; + + typedef [nopush, nopull, flag(NDR_NOALIGN), public] struct { + uint32 num_stream; + bkup_Win32StreamId streams[num_stream]; + } bkup_NTBackupFile; +} diff --git a/librpc/idl/browser.idl b/librpc/idl/browser.idl new file mode 100644 index 0000000..94d4ce6 --- /dev/null +++ b/librpc/idl/browser.idl @@ -0,0 +1,86 @@ +import "srvsvc.idl"; + +[ + uuid("6bffd098-a112-3610-9833-012892020162"), + version(0.0), + helpstring("Browsing"), + pointer_default(unique), + endpoint("ncacn_np:[\\pipe\\browser]", "ncacn_ip_tcp:", "ncalrpc:") +] +interface browser +{ + /******************/ + /* Function 0x00 */ + [todo] void BrowserrServerEnum(); + + /******************/ + /* Function 0x01 */ + [todo] void BrowserrDebugCall(); + + /******************/ + /* Function 0x02 */ + + typedef struct { + uint32 entries_read; + [size_is(entries_read)] srvsvc_NetSrvInfo100 *entries; + } BrowserrSrvInfo100Ctr; + + typedef struct { + uint32 entries_read; + [size_is(entries_read)] srvsvc_NetSrvInfo101 *entries; + } BrowserrSrvInfo101Ctr; + + typedef [switch_type(uint32)] union { + [case(100)] BrowserrSrvInfo100Ctr *info100; + [case(101)] BrowserrSrvInfo101Ctr *info101; + [default] ; + } BrowserrSrvInfoUnion; + + typedef struct { + uint32 level; + [switch_is(level)] BrowserrSrvInfoUnion info; + } BrowserrSrvInfo; + + WERROR BrowserrQueryOtherDomains( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in,out,ref] BrowserrSrvInfo *info, + [out,ref] uint32 *total_entries + ); + + /******************/ + /* Function 0x03 */ + [todo] void BrowserrResetNetlogonState(); + + /******************/ + /* Function 0x04 */ + [todo] void BrowserrDebugTrace(); + + /******************/ + /* Function 0x05 */ + [todo] void BrowserrQueryStatistics(); + + /******************/ + /* Function 0x06 */ + [todo] void BrowserResetStatistics(); + + /******************/ + /* Function 0x07 */ + [todo] void NetrBrowserStatisticsClear(); + + /******************/ + /* Function 0x08 */ + [todo] void NetrBrowserStatisticsGet(); + + /******************/ + /* Function 0x09 */ + [todo] void BrowserrSetNetlogonState(); + + /******************/ + /* Function 0x0a */ + [todo] void BrowserrQueryEmulatedDomains(); + + /******************/ + /* Function 0x0b */ + [todo] void BrowserrServerEnumEx(); + +} diff --git a/librpc/idl/cab.idl b/librpc/idl/cab.idl new file mode 100644 index 0000000..d08b535 --- /dev/null +++ b/librpc/idl/cab.idl @@ -0,0 +1,130 @@ +#include "idl_types.h" + +import "misc.idl"; + +/* + IDL structures defining Cabinet files + + more info can be found at: + https://msdn.microsoft.com/en-us/library/bb267310.aspx#cabinet_format +*/ + +[ + pointer_default(unique), + helper("../librpc/ndr/ndr_cab.h"), + helpstring("Cabinet structure"), + uuid("12345678-0000-0000-0000-00000000") +] + interface cab +{ + + /* + * flags.cfhdrPREV_CABINET is set if this cabinet file is not the first in + * a set of cabinet files. When this bit is set, the szCabinetPrev and + * szDiskPrev fields are present in this CFHEADER. + * + * flags.cfhdrNEXT_CABINET is set if this cabinet file is not the last in a + * set of cabinet files. When this bit is set, the szCabinetNext and + * szDiskNext fields are present in this CFHEADER. + * + * flags.cfhdrRESERVE_PRESENT is set if this cabinet file contains any + * reserved fields. When this bit is set, the cbCFHeader, cbCFFolder, and + * cbCFData fields are present in this CFHEADER. + */ + + typedef [bitmap16bit] bitmap { + cfhdrPREV_CABINET = 0x0001, + cfhdrNEXT_CABINET = 0x0002, + cfhdrRESERVE_PRESENT = 0x0004 + } cf_flags; + + typedef [public,flag(NDR_PAHEX|NDR_LITTLE_ENDIAN|NDR_NOALIGN)] struct { + [charset(DOS),value("MSCF")] uint8 signature[4]; + [value(0)] uint32 reserved1; /* reserved */ + uint32 cbCabinet; /* size of this cabinet file in bytes */ + [value(0)] uint32 reserved2; /* reserved */ + [value(cFolders*8+36)] uint32 coffFiles; /* offset of the first CFFILE entry */ + [value(0)] uint32 reserved3; /* reserved */ + [value(3)] uint8 versionMinor; /* cabinet file format version, minor */ + [value(1)] uint8 versionMajor; /* cabinet file format version, major */ + uint16 cFolders; /* number of CFFOLDER entries in this cabinet */ + uint16 cFiles; /* number of CFFILE entries in this cabinet */ + cf_flags flags; /* cabinet file option indicators */ + uint16 setID; /* must be the same for all cabinets in a set */ + uint16 iCabinet; /* number of this cabinet file in a set */ +#if 0 + [range(0,60000)] uint16 cbCFHeader; /* (optional) size of per-cabinet reserved area */ + [range(0,255)] uint8 cbCFFolder; /* (optional) size of per-folder reserved area */ + [range(0,255)] uint8 cbCFData; /* (optional) size of per-datablock reserved area */ + uint8 abReserve[]; /* (optional) per-cabinet reserved area */ + uint8 szCabinetPrev[]; /* (optional) name of previous cabinet file */ + uint8 szDiskPrev[]; /* (optional) name of previous disk */ + uint8 szCabinetNext[]; /* (optional) name of next cabinet file */ + uint8 szDiskNext[]; /* (optional) name of next disk */ +#endif + } CFHEADER; + + typedef enum { + CF_COMPRESS_NONE = 0, + CF_COMPRESS_MSZIP = 1, + CF_COMPRESS_LZX = 4611 + } cf_compress_type; + + typedef [public,flag(NDR_PAHEX|NDR_LITTLE_ENDIAN|NDR_NOALIGN)] struct { + uint32 coffCabStart; /* offset of the first CFDATA block in this folder */ + uint16 cCFData; /* number of CFDATA blocks in this folder */ + cf_compress_type typeCompress; /* compression type indicator */ +#if 0 + uint8 abReserve[]; /* (optional) per-folder reserved area */ +#endif + } CFFOLDER; + + const int ifoldCONTINUED_FROM_PREV = 0xFFFD; + const int ifoldCONTINUED_TO_NEXT = 0xFFFE; + const int ifoldCONTINUED_PREV_AND_NEXT = 0xFFFF; + + typedef [bitmap16bit] bitmap { + _A_RDONLY = 0x01, /* file is read-only */ + _A_HIDDEN = 0x02, /* file is hidden */ + _A_SYSTEM = 0x04, /* file is a system file */ + _A_ARCH = 0x20, /* file modified since last backup */ + _A_EXEC = 0x40, /* run after extraction */ + _A_NAME_IS_UTF = 0x80 /* szName[] contains UTF */ + } cf_attributes; + + typedef [noprint,flag(NDR_NOALIGN)] struct { + uint16 date; + } cf_date; + + typedef [noprint,flag(NDR_NOALIGN)] struct { + uint16 time; + } cf_time; + + typedef [public,flag(NDR_PAHEX|NDR_LITTLE_ENDIAN|NDR_NOALIGN),gensize] struct { + uint32 cbFile; /* uncompressed size of this file in bytes */ + uint32 uoffFolderStart; /* uncompressed offset of this file in the folder */ + uint16 iFolder; /* index into the CFFOLDER area */ + cf_date date; /* date stamp for this file */ + cf_time time; /* time stamp for this file */ + cf_attributes attribs; /* attribute flags for this file */ + [flag(r->attribs & _A_NAME_IS_UTF ? STR_UTF8|STR_NULLTERM : STR_ASCII|STR_NULLTERM)] string szName; + } CFFILE; + + typedef [flag(NDR_PAHEX|NDR_LITTLE_ENDIAN|NDR_NOALIGN),nopull,nopush] struct { + uint32 csum; /* checksum of this CFDATA entry */ + uint16 cbData; /* number of compressed bytes in this block */ + uint16 cbUncomp; /* number of uncompressed bytes in this block */ +#if 0 + uint8 abReserve[]; /* (optional) per-datablock reserved area */ +#endif + DATA_BLOB ab; /* compressed data bytes */ + } CFDATA; + + typedef [nopush,nopull,public,flag(NDR_PAHEX|NDR_LITTLE_ENDIAN|NDR_NOALIGN)] struct { + CFHEADER cfheader; + CFFOLDER cffolders[cfheader.cFolders]; + CFFILE cffiles[cfheader.cFiles]; + [noprint,value(ndr_count_cfdata(r))] uint32 cfdata_count; + CFDATA cfdata[cfdata_count]; + } cab_file; +} diff --git a/librpc/idl/claims.idl b/librpc/idl/claims.idl new file mode 100644 index 0000000..618a620 --- /dev/null +++ b/librpc/idl/claims.idl @@ -0,0 +1,149 @@ +/* + claims + + claim: An assertion about a security principal + + From MS-ADTS: + + For ease of implementation, the full IDL for the data types used for + claims is provided + + The below was initially obtained from MS-ADTS which is + Copyright © 2022 Microsoft Corporation as permitted + by the Open Specifications terms reproduced in IDL_LICENCE.txt +*/ + +#include "idl_types.h" + +[ + uuid("bba9cb76-eb0c-462c-aa1b-5d8c34415701"), + version(1.0), + pointer_default(unique), + helpstring("Active Directory Claims"), + helper("../librpc/ndr/ndr_claims.h") +] +interface claims +{ +#define wchar_t uint16 +#define CLAIM_ID [string, charset(UTF16)] wchar_t * + + const int CLAIM_LOWER_COMPRESSION_THRESHOLD = 368; + const int CLAIM_UPPER_COMPRESSION_THRESHOLD = 384; + + typedef enum { + CLAIM_TYPE_INT64 = 1, + CLAIM_TYPE_UINT64 = 2, + CLAIM_TYPE_STRING = 3, + CLAIM_TYPE_BOOLEAN = 6 + } CLAIM_TYPE; + + typedef enum { + CLAIMS_SOURCE_TYPE_AD = 1, + CLAIMS_SOURCE_TYPE_CERTIFICATE = 2 + } CLAIMS_SOURCE_TYPE; + + typedef enum { + CLAIMS_COMPRESSION_FORMAT_NONE = 0, + CLAIMS_COMPRESSION_FORMAT_LZNT1 = 2, + CLAIMS_COMPRESSION_FORMAT_XPRESS = 3, + CLAIMS_COMPRESSION_FORMAT_XPRESS_HUFF = 4 + } CLAIMS_COMPRESSION_FORMAT; + + typedef struct { + [range(0, 10*1024*1024)] uint32 value_count; + [size_is(value_count)] int64 *values; + } CLAIM_INT64; + + typedef struct { + [range(0, 10*1024*1024)] uint32 value_count; + [size_is(value_count)] hyper *values; + } CLAIM_UINT64; + + typedef struct { + [range(0, 10*1024*1024)] uint32 value_count; + [size_is(value_count), string, charset(UTF16)] wchar_t **values; + } CLAIM_STRING; + + typedef [switch_type(CLAIM_TYPE),flag(NDR_ALIGN8)] union { + [case(CLAIM_TYPE_INT64)] CLAIM_INT64 claim_int64; + [case(CLAIM_TYPE_UINT64)] CLAIM_UINT64 claim_uint64; + [case(CLAIM_TYPE_STRING)] CLAIM_STRING claim_string; + [case(CLAIM_TYPE_BOOLEAN)] CLAIM_UINT64 claim_boolean; + [default]; + } CLAIM_ENTRY_VALUES; + + typedef struct { + CLAIM_ID id; + CLAIM_TYPE type; + [switch_is(type)] CLAIM_ENTRY_VALUES values; + } CLAIM_ENTRY; + + typedef struct { + CLAIMS_SOURCE_TYPE claims_source_type; + uint32 claims_count; + [size_is(claims_count)] CLAIM_ENTRY *claim_entries; + } CLAIMS_ARRAY; + + typedef struct { + CLAIMS_SET_METADATA *metadata; + } CLAIMS_SET_METADATA_CTR; + + typedef struct { + CLAIMS_SET *claims; + } CLAIMS_SET_CTR; + + /* Public structures. */ + + typedef [public] struct { + uint32 claims_array_count; + [size_is(claims_array_count)] CLAIMS_ARRAY *claims_arrays; + uint16 reserved_type; + uint32 reserved_field_size; + [size_is(reserved_field_size)] uint8 *reserved_field; + } CLAIMS_SET; + + typedef [public, gensize] struct { + [subcontext(0xFFFFFC01)] CLAIMS_SET_CTR claims; + } CLAIMS_SET_NDR; + + typedef [public] struct { + [subcontext(0xFFFFFC01)] CLAIMS_SET_METADATA_CTR claims; + } CLAIMS_SET_METADATA_NDR; + + typedef [public] struct { + [value(ndr_claims_compressed_size(claims_set, + r->compression_format, + ndr->flags))] uint32 claims_set_size; + [subcontext(4), + compression(ndr_claims_compression_alg(compression_format), + claims_set_size, + uncompressed_claims_set_size) + ] CLAIMS_SET_NDR *claims_set; + /* + * The second argument to + * ndr_claims_actual_wire_compression_alg() in the + * value() below should be + * uncompressed_claims_set_size but the value() + * handling isn't recursive (enough) so we have to + * specify that manually otherwise the + * compression_format in the above includes the struct + * member, not the value() + * + * The caller should set compression_format to + * CLAIMS_COMPRESSION_FORMAT_XPRESS_HUFF and this will + * be reset to CLAIMS_COMPRESSION_FORMAT_NONE if the + * buffer is not large enough to compress. + * + * Otherwise setting CLAIMS_COMPRESSION_FORMAT_NONE + * disabled compression entirely. + */ + [value(ndr_claims_actual_wire_compression_alg(r->compression_format, + ndr_size_CLAIMS_SET_NDR(claims_set, + ndr->flags)))] CLAIMS_COMPRESSION_FORMAT compression_format; + [value(ndr_size_CLAIMS_SET_NDR(claims_set, + ndr->flags))] uint32 uncompressed_claims_set_size; + uint16 reserved_type; + uint32 reserved_field_size; + [size_is(reserved_field_size)] uint8 *reserved_field; + } CLAIMS_SET_METADATA; +} diff --git a/librpc/idl/clusapi.idl b/librpc/idl/clusapi.idl new file mode 100644 index 0000000..7cc3f5f --- /dev/null +++ b/librpc/idl/clusapi.idl @@ -0,0 +1,2962 @@ +import "winreg.idl", "misc.idl"; + +#include "idl_types.h" + +[ + uuid("b97db8b2-4c63-11cf-bff6-08002be23f2f"), + version(3.0), + pointer_default(unique), + endpoint("ncacn_ip_tcp:"), + authservice("MSServerClusterMgmtAPI"), + helpstring("Failover Cluster Management API (clusapi)") +] +#define MAX_CLUSTER_CONTROL_CODE_BUFFER_SIZE 0x7FFFFFFF + interface clusapi +{ +#if 0 + /* + * pidl does not yet have a real [context_handle] implementation, so we + * just use some defines here. + */ + + typedef [context_handle] void *HCLUSTER_RPC; + typedef [context_handle] void *HNODE_RPC; + typedef [context_handle] void *HGROUP_RPC; + typedef [context_handle] void *HRES_RPC; + typedef [context_handle] void *HKEY_RPC; + typedef [context_handle] void *HNOTIFY_RPC; + typedef [context_handle] void *HNETWORK_RPC; + typedef [context_handle] void *HNETINTERFACE_RPC; + typedef [context_handle] void *HBATCH_PORT_RPC; +#else +#define HCLUSTER_RPC policy_handle +#define HNODE_RPC policy_handle +#define HGROUP_RPC policy_handle +#define HRES_RPC policy_handle +#define HKEY_RPC policy_handle +#define HNOTIFY_RPC policy_handle +#define HNETWORK_RPC policy_handle +#define HNETINTERFACE_RPC policy_handle +#define HBATCH_PORT_RPC policy_handle +#endif + + typedef struct { + [ size_is( cbInSecurityDescriptor ), length_is( cbOutSecurityDescriptor ) ] uint8 *lpSecurityDescriptor; + uint32 cbInSecurityDescriptor; + uint32 cbOutSecurityDescriptor; + } RPC_SECURITY_DESCRIPTOR; + + typedef struct { + uint32 nLength; + RPC_SECURITY_DESCRIPTOR RpcSecurityDescriptor; + long bInheritHandle; + } RPC_SECURITY_ATTRIBUTES; + + typedef struct { + [value(20)] uint32 dwSize; + uint32 dwClusterHighestVersion; + uint32 dwClusterLowestVersion; + uint32 dwFlags; + uint32 dwReserved; + } CLUSTER_OPERATIONAL_VERSION_INFO; + + typedef struct { + uint32 NodeId; + boolean8 SetAttempted; + uint32 ReturnStatus; + } IDL_CLUSTER_SET_PASSWORD_STATUS; + + typedef enum { + IDL_CLUSTER_SET_PASSWORD_IGNORE_DOWN_NODES = 1 + } IDL_CLUSTER_SET_PASSWORD_FLAGS; + + typedef struct { + uint32 dwVersion; + uint32 dwGroupType; + } CLUSTER_CREATE_GROUP_INFO_RPC; + + /*****************/ + /* Function 0x00 */ + +#if 0 + /* + * pidl cannot generate code for functions that return structures in + * IDL, therefore pretend the function is void and add the returned + * structure as an out parameter. This is what we do with pretty much + * all the Open calls right now in this interface - gd + */ + + HCLUSTER_RPC + clusapi_OpenCluster( + [ out ] WERROR *Status + ); +#else + void + clusapi_OpenCluster( + [ out ] WERROR *Status, + [ out ] HCLUSTER_RPC *Cluster + ); +#endif + + /*****************/ + /* Function 0x01 */ + + WERROR + clusapi_CloseCluster( + [ in, out ] HCLUSTER_RPC *Cluster + ); + + /*****************/ + /* Function 0x02 */ + + WERROR + clusapi_SetClusterName( + [ in, string ] [charset(UTF16)] uint16 *NewClusterName, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x03 */ + + WERROR + clusapi_GetClusterName( + [ out, string ] [charset(UTF16)] uint16 **ClusterName, + [ out, string ] [charset(UTF16)] uint16 **NodeName + ); + + /*****************/ + /* Function 0x04 */ + + WERROR + clusapi_GetClusterVersion( + [ out ] uint16 *lpwMajorVersion, + [ out ] uint16 *lpwMinorVersion, + [ out ] uint16 *lpwBuildNumber, + [ out, string ] [charset(UTF16)] uint16 **lpszVendorId, + [ out, string ] [charset(UTF16)] uint16 **lpszCSDVersion + ); + + /*****************/ + /* Function 0x05 */ + + WERROR + clusapi_GetQuorumResource( + [ out, string ] [charset(UTF16)] uint16 **lpszResourceName, + [ out, string ] [charset(UTF16)] uint16 **lpszDeviceName, + [ out ] uint32 *pdwMaxQuorumLogSize, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x06 */ + + WERROR + clusapi_SetQuorumResource( + [ in ] HRES_RPC hResource, + [ in, string ] [charset(UTF16)] uint16 *lpszDeviceName, + [ in ] uint32 dwMaxQuorumLogSize, + [ out ] WERROR *rpc_status + ); + + typedef [bitmap32bit] bitmap { + CLUSTER_ENUM_NODE = 0x00000001, + CLUSTER_ENUM_RESTYPE = 0x00000002, + CLUSTER_ENUM_RESOURCE = 0x00000004, + CLUSTER_ENUM_GROUP = 0x00000008, + CLUSTER_ENUM_NETWORK = 0x00000010, + CLUSTER_ENUM_NETINTERFACE = 0x00000020, + CLUSTER_ENUM_INTERNAL_NETWORK = 0x80000000, + CLUSTER_ENUM_SHARED_VOLUME_RESOURCE = 0x40000000 + } ClusterEnumType; + + typedef struct { + ClusterEnumType Type; + [string] [charset(UTF16)] uint16 *Name; + } ENUM_ENTRY; + + typedef struct { + uint32 EntryCount; + [size_is(EntryCount)] ENUM_ENTRY Entry[*]; + } ENUM_LIST; + + typedef struct { + [string] [charset(UTF16)] uint16 *Name; + [string] [charset(UTF16)] uint16 *Id; + uint32 dwState; + [string] [charset(UTF16)] uint16 *Owner; + uint32 dwFlags; + uint32 cbProperties; + [size_is(cbProperties)] uint8* Properties; + uint32 cbRoProperties; + [size_is(cbRoProperties)] uint8* RoProperties; + } GROUP_ENUM_ENTRY; + + typedef struct { + [string] [charset(UTF16)] uint16 *Name; + [string] [charset(UTF16)] uint16 *Id; + [string] [charset(UTF16)] uint16 *OwnerName; + [string] [charset(UTF16)] uint16 *OwnerId; + uint32 cbProperties; + [size_is(cbProperties)] uint8* Properties; + uint32 cbRoProperties; + [size_is(cbRoProperties)] uint8* RoProperties; + } RESOURCE_ENUM_ENTRY; + + typedef struct { + uint32 EntryCount; + [size_is(EntryCount)] GROUP_ENUM_ENTRY Entry[*]; + } GROUP_ENUM_LIST; + + typedef struct { + uint32 EntryCount; + [size_is(EntryCount)] RESOURCE_ENUM_ENTRY Entry[*]; + } RESOURCE_ENUM_LIST; + + /*****************/ + /* Function 0x07 */ + + WERROR + clusapi_CreateEnum( + [ in ] ClusterEnumType dwType, + [ out ] ENUM_LIST **ReturnEnum, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x08 */ + +#if 0 + HRES_RPC + clusapi_OpenResource( + [ in, string ] [charset(UTF16)] uint16 *lpszResourceName, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status + ); +#else + void + clusapi_OpenResource( + [ in, string ] [charset(UTF16)] uint16 *lpszResourceName, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status, + [ out ] HRES_RPC *hResource + ); +#endif + /*****************/ + /* Function 0x09 */ + + typedef [v1_enum] enum { + CLUSTER_RESOURCE_DEFAULT_MONITOR = 0x00000000, + CLUSTER_RESOURCE_SEPARATE_MONITOR = 0x00000001 + } clusapi_CreateResourceFlags; + +#if 0 + HRES_RPC + clusapi_CreateResource( + [ in ] HGROUP_RPC hGroup, + [ in, string ] [charset(UTF16)] uint16 *lpszResourceName, + [ in, string ] [charset(UTF16)] uint16 *lpszResourceType, + [ in ] clusapi_CreateResourceFlags dwFlags, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status + ); +#else + void + clusapi_CreateResource( + [ in ] HGROUP_RPC hGroup, + [ in, string ] [charset(UTF16)] uint16 *lpszResourceName, + [ in, string ] [charset(UTF16)] uint16 *lpszResourceType, + [ in ] clusapi_CreateResourceFlags dwFlags, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status, + [ out ] HRES_RPC *hResource + ); +#endif + /*****************/ + /* Function 0x0A */ + + WERROR + clusapi_DeleteResource( + [ in ] HRES_RPC hResource, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x0B */ + + WERROR + clusapi_CloseResource( + [ in, out ] HRES_RPC *Resource + ); + + /*****************/ + /* Function 0x0C */ + + typedef [v1_enum] enum { + ClusterResourceInitializing = 0x00000001, + ClusterResourceOnline = 0x00000002, + ClusterResourceOffline = 0x00000003, + ClusterResourceFailed = 0x00000004, + ClusterResourceOnlinePending = 0x00000081, + ClusterResourceOfflinePending = 0x00000082, + ClusterResourceStateUnknown = 0xFFFFFFFF + } clusapi_ClusterResourceState; + + WERROR + clusapi_GetResourceState( + [ in ] HRES_RPC hResource, + [ out ] clusapi_ClusterResourceState *State, + [ out, string ] [charset(UTF16)] uint16 **NodeName, + [ out, string ] [charset(UTF16)] uint16 **GroupName, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x0D */ + + WERROR + clusapi_SetResourceName( + [ in ] HRES_RPC hResource, + [ in, string ] [charset(UTF16)] uint16 *lpszResourceName, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x0E */ + + WERROR + clusapi_GetResourceId( + [ in ] HRES_RPC hResource, + [ out, string ] [charset(UTF16)] uint16 **pGuid, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x0F */ + + WERROR + clusapi_GetResourceType( + [ in ] HRES_RPC hResource, + [ out, string ] [charset(UTF16)] uint16 **lpszResourceType, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x10 */ + + WERROR + clusapi_FailResource( + [ in ] HRES_RPC hResource, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x11 */ + + WERROR + clusapi_OnlineResource( + [ in ] HRES_RPC hResource, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x12 */ + + WERROR + clusapi_OfflineResource( + [ in ] HRES_RPC hResource, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x13 */ + + WERROR + clusapi_AddResourceDependency( + [ in ] HRES_RPC hResource, + [ in ] HRES_RPC hDependsOn, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x14 */ + + WERROR + clusapi_RemoveResourceDependency( + [ in ] HRES_RPC hResource, + [ in ] HRES_RPC hDependsOn, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x15 */ + + WERROR + clusapi_CanResourceBeDependent( + [ in ] HRES_RPC hResource, + [ in ] HRES_RPC hResourceDependent, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x16 */ + + WERROR + clusapi_CreateResEnum( + [ in ] HRES_RPC hResource, + [ in ] uint32 dwType, + [ out ] ENUM_LIST **ReturnEnum, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x17 */ + + WERROR + clusapi_AddResourceNode( + [ in ] HRES_RPC hResource, + [ in ] HNODE_RPC hNode, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x18 */ + + WERROR + clusapi_RemoveResourceNode( + [ in ] HRES_RPC hResource, + [ in ] HNODE_RPC hNode, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x19 */ + + WERROR + clusapi_ChangeResourceGroup( + [ in ] HRES_RPC hResource, + [ in ] HGROUP_RPC hGroup, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x1A */ + + WERROR + clusapi_CreateResourceType( + [ in, string ] [charset(UTF16)] uint16 *lpszTypeName, + [ in, string ] [charset(UTF16)] uint16 *lpszDisplayName, + [ in, string ] [charset(UTF16)] uint16 *lpszDllName, + [ in ] uint32 dwLooksAlive, + [ in ] uint32 dwIsAlive, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x1B */ + + WERROR + clusapi_DeleteResourceType( + [ in, string ] [charset(UTF16)] uint16 *lpszTypeName, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x1C */ +#if 0 + HKEY_RPC + clusapi_GetRootKey( + [ in ] winreg_AccessMask samDesired, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status + ); +#else + void + clusapi_GetRootKey( + [ in ] winreg_AccessMask samDesired, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status, + [ out ] HKEY_RPC *phKey + ); +#endif + /*****************/ + /* Function 0x1D */ +#if 0 + HKEY_RPC + clusapi_CreateKey( + [ in ] HKEY_RPC hKey, + [ in, string ] [charset(UTF16)] uint16 *lpSubKey, + [ in ] uint32 dwOptions, + [ in ] winreg_AccessMask samDesired, + [ in, unique ] RPC_SECURITY_ATTRIBUTES *lpSecurityAttributes, + [ out ] uint32 *lpdwDisposition, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status + ); +#else + void + clusapi_CreateKey( + [ in ] HKEY_RPC hKey, + [ in, string ] [charset(UTF16)] uint16 *lpSubKey, + [ in ] uint32 dwOptions, + [ in ] winreg_AccessMask samDesired, + [ in, unique ] RPC_SECURITY_ATTRIBUTES *lpSecurityAttributes, + [ out ] uint32 *lpdwDisposition, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status, + [ out ] HKEY_RPC *phKey + ); +#endif + /*****************/ + /* Function 0x1E */ +#if 0 + HKEY_RPC + clusapi_OpenKey( + [ in ] HKEY_RPC hKey, + [ in, string ] [charset(UTF16)] uint16 *lpSubKey, + [ in ] winreg_AccessMask samDesired, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status + ); +#else + void + clusapi_OpenKey( + [ in ] HKEY_RPC hKey, + [ in, string ] [charset(UTF16)] uint16 *lpSubKey, + [ in ] winreg_AccessMask samDesired, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status, + [ out ] HKEY_RPC *phKey + ); +#endif + /*****************/ + /* Function 0x1F */ + + WERROR + clusapi_EnumKey( + [ in ] HKEY_RPC hKey, + [ in ] uint32 dwIndex, + [ out, string ] [charset(UTF16)] uint16 **KeyName, + [ out ] NTTIME *lpftLastWriteTime, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x20 */ + + WERROR + clusapi_SetValue( + [ in ] HKEY_RPC hKey, + [ in, string ] [charset(UTF16)] uint16 *lpValueName, + [ in ] winreg_Type dwType, + [ in, size_is(cbData) ] uint8 *lpData, + [ in ] uint32 cbData, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x21 */ + + WERROR + clusapi_DeleteValue( + [ in ] HKEY_RPC hKey, + [ in, string ] [charset(UTF16)] uint16 *lpValueName, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x22 */ + + WERROR + clusapi_QueryValue( + [ in ] HKEY_RPC hKey, + [ in, string ] [charset(UTF16)] uint16 *lpValueName, + [ out ] winreg_Type *lpValueType, + [ out, size_is(cbData) ] uint8 *lpData, + [ in ] uint32 cbData, + [ out ] uint32 *lpcbRequired, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x23 */ + + WERROR + clusapi_DeleteKey( + [ in ] HKEY_RPC hKey, + [ in, string ] [charset(UTF16)] uint16 *lpSubKey, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x24 */ + + WERROR + clusapi_EnumValue( + [ in ] HKEY_RPC hKey, + [ in ] uint32 dwIndex, + [ out, string ] [charset(UTF16)] uint16 **lpValueName, + [ out ] winreg_Type *lpType, + [ out, size_is(*lpcbData) ] uint8 *lpData, + [ in, out ] uint32 *lpcbData, + [ out ] uint32 *TotalSize, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x25 */ + + WERROR + clusapi_CloseKey( + [ in, out ] HKEY_RPC *pKey + ); + + /*****************/ + /* Function 0x26 */ + + WERROR + clusapi_QueryInfoKey( + [ in ] HKEY_RPC hKey, + [ out ] uint32 *lpcSubKeys, + [ out ] uint32 *lpcbMaxSubKeyLen, + [ out ] uint32 *lpcValues, + [ out ] uint32 *lpcbMaxValueNameLen, + [ out ] uint32 *lpcbMaxValueLen, + [ out ] uint32 *lpcbSecurityDescriptor, + [ out ] NTTIME *lpftLastWriteTime, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x27 */ + + WERROR + clusapi_SetKeySecurity( + [ in ] HKEY_RPC hKey, + [ in ] uint32 SecurityInformation, + [ in ] RPC_SECURITY_DESCRIPTOR *pRpcSecurityDescriptor, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x28 */ + + WERROR + clusapi_GetKeySecurity( + [ in ] HKEY_RPC hKey, + [ in ] uint32 SecurityInformation, + [ in, out ] RPC_SECURITY_DESCRIPTOR *pRpcSecurityDescriptor, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x29 */ +#if 0 + HGROUP_RPC + clusapi_OpenGroup( + [ in, string ] [charset(UTF16)] uint16 *lpszGroupName, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status + ); +#else + void + clusapi_OpenGroup( + [ in, string ] [charset(UTF16)] uint16 *lpszGroupName, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status, + [ out ] HGROUP_RPC *hGroup + ); +#endif + /*****************/ + /* Function 0x2A */ +#if 0 + HGROUP_RPC + clusapi_CreateGroup( + [ in, string ] [charset(UTF16)] uint16 *lpszGroupName, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status + ); +#else + void + clusapi_CreateGroup( + [ in, string ] [charset(UTF16)] uint16 *lpszGroupName, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status, + [ out ] HGROUP_RPC *hGroup + ); +#endif + /*****************/ + /* Function 0x2B */ + + WERROR + clusapi_DeleteGroup( + [ in ] HGROUP_RPC Group, + [ in ] boolean8 force, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x2C */ + + WERROR + clusapi_CloseGroup( + [ in, out ] HGROUP_RPC *Group + ); + + /*****************/ + /* Function 0x2D */ + + typedef [v1_enum] enum { + ClusterGroupOnline = 0x00000000, + ClusterGroupOffline = 0x00000001, + ClusterGroupFailed = 0x00000002, + ClusterGroupPartialOnline = 0x00000003, + ClusterGroupPending = 0x00000004, + ClusterGroupStateUnknown = 0xFFFFFFFF + } clusapi_ClusterGroupState; + + WERROR + clusapi_GetGroupState( + [ in ] HGROUP_RPC hGroup, + [ out ] clusapi_ClusterGroupState *State, + [ out, string ] [charset(UTF16)] uint16 **NodeName, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x2E */ + + WERROR + clusapi_SetGroupName( + [ in ] HGROUP_RPC hGroup, + [ in, string ] [charset(UTF16)] uint16 *lpszGroupName, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x2F */ + + WERROR + clusapi_GetGroupId( + [ in ] HGROUP_RPC hGroup, + [ out, string ] [charset(UTF16)] uint16 **pGuid, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x30 */ + + WERROR + clusapi_GetNodeId( + [ in ] HNODE_RPC hNode, + [ out, string ] [charset(UTF16)] uint16 **pGuid, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x31 */ + + WERROR + clusapi_OnlineGroup( + [ in ] HGROUP_RPC hGroup, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x32 */ + + WERROR + clusapi_OfflineGroup( + [ in ] HGROUP_RPC hGroup, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x33 */ + + WERROR + clusapi_MoveGroup( + [ in ] HGROUP_RPC hGroup, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x34 */ + + WERROR + clusapi_MoveGroupToNode( + [ in ] HGROUP_RPC hGroup, + [ in ] HNODE_RPC hNode, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x35 */ + + typedef [bitmap32bit] bitmap { + CLUSTER_GROUP_ENUM_CONTAINS = 0x00000001, + CLUSTER_GROUP_ENUM_NODES = 0x00000002 + } ClusterGroupEnumType; + + WERROR + clusapi_CreateGroupResourceEnum( + [ in ] HGROUP_RPC hGroup, + [ in ] ClusterGroupEnumType dwType, + [ out ] ENUM_LIST **ReturnEnum, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x36 */ + + WERROR + clusapi_SetGroupNodeList( + [ in ] HGROUP_RPC hGroup, + [ in, unique, size_is(cchListSize) ] uint16 *multiSzNodeList, + [ in ] uint32 cchListSize, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x37 */ +#if 0 + HNOTIFY_RPC + clusapi_CreateNotify( + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status + ); +#else + void + clusapi_CreateNotify( + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status, + [ out ] HNOTIFY_RPC *hNotify + ); +#endif + /*****************/ + /* Function 0x38 */ + + WERROR + clusapi_CloseNotify( + [ in, out ] HNOTIFY_RPC *Notify + ); + + /*****************/ + /* Function 0x39 */ + + WERROR + clusapi_AddNotifyCluster( + [ in ] HNOTIFY_RPC hNotify, + [ in ] HCLUSTER_RPC hCluster, + [ in ] uint32 dwFilter, + [ in ] uint32 dwNotifyKey, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x3A */ + + WERROR + clusapi_AddNotifyNode( + [ in ] HNOTIFY_RPC hNotify, + [ in ] HNODE_RPC hNode, + [ in ] uint32 dwFilter, + [ in ] uint32 dwNotifyKey, + [ out ] uint32 *dwStateSequence, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x3B */ + + WERROR + clusapi_AddNotifyGroup( + [ in ] HNOTIFY_RPC hNotify, + [ in ] HGROUP_RPC hGroup, + [ in ] uint32 dwFilter, + [ in ] uint32 dwNotifyKey, + [ out ] uint32 *dwStateSequence, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x3C */ + + WERROR + clusapi_AddNotifyResource( + [ in ] HNOTIFY_RPC hNotify, + [ in ] HRES_RPC hResource, + [ in ] uint32 dwFilter, + [ in ] uint32 dwNotifyKey, + [ out ] uint32 *dwStateSequence, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x3D */ + + WERROR + clusapi_AddNotifyKey( + [ in ] HNOTIFY_RPC hNotify, + [ in ] HKEY_RPC hKey, + [ in ] uint32 dwNotifyKey, + [ in ] uint32 Filter, + [ in ] boolean8 WatchSubTree, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x3E */ + + WERROR + clusapi_ReAddNotifyNode( + [ in ] HNOTIFY_RPC hNotify, + [ in ] HNODE_RPC hNode, + [ in ] uint32 dwFilter, + [ in ] uint32 dwNotifyKey, + [ in ] uint32 StateSequence, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x3F */ + + WERROR + clusapi_ReAddNotifyGroup( + [ in ] HNOTIFY_RPC hNotify, + [ in ] HGROUP_RPC hGroup, + [ in ] uint32 dwFilter, + [ in ] uint32 dwNotifyKey, + [ in ] uint32 StateSequence, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x40 */ + + WERROR + clusapi_ReAddNotifyResource( + [ in ] HNOTIFY_RPC hNotify, + [ in ] HRES_RPC hResource, + [ in ] uint32 dwFilter, + [ in ] uint32 dwNotifyKey, + [ in ] uint32 StateSequence, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x41 */ + + WERROR + clusapi_GetNotify( + [ in ] HNOTIFY_RPC hNotify, + [ out ] uint32 *dwNotifyKey, + [ out ] uint32 *dwFilter, + [ out ] uint32 *dwStateSequence, + [ out, string ] [charset(UTF16)] uint16 **Name, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x42 */ +#if 0 + HNODE_RPC + clusapi_OpenNode( + [ in, string ] [charset(UTF16)] uint16 *lpszNodeName, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status + ); +#else + void + clusapi_OpenNode( + [ in, string ] [charset(UTF16)] uint16 *lpszNodeName, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status, + [ out ] HNODE_RPC *hNode + ); +#endif + /*****************/ + /* Function 0x43 */ + + WERROR + clusapi_CloseNode( + [ in, out ] HNODE_RPC *Node + ); + + /*****************/ + /* Function 0x44 */ + + typedef [v1_enum] enum { + ClusterNodeUp = 0x00000000, + ClusterNodeDown = 0x00000001, + ClusterNodePaused = 0x00000002, + ClusterNodeJoining = 0x00000003, + ClusterNodeStateUnknown = 0xFFFFFFFF + } clusapi_ClusterNodeState; + + WERROR + clusapi_GetNodeState( + [ in ] HNODE_RPC hNode, + [ out ] clusapi_ClusterNodeState *State, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x45 */ + + WERROR + clusapi_PauseNode( + [ in ] HNODE_RPC hNode, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x46 */ + + WERROR + clusapi_ResumeNode( + [ in ] HNODE_RPC hNode, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x47 */ + + WERROR + clusapi_EvictNode( + [ in ] HNODE_RPC hNode, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x48 */ + + WERROR + clusapi_NodeResourceControl( + [ in ] HRES_RPC hResource, + [ in ] HNODE_RPC hNode, + [ in ] uint32 dwControlCode, + [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer, + [ in ] uint32 nInBufferSize, + [ out, size_is(nOutBufferSize), + length_is (*lpBytesReturned)] uint8 *lpOutBuffer, + [ in ] uint32 nOutBufferSize, + [ out ] uint32 *lpBytesReturned, + [ out ] uint32 *lpcbRequired, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x49 */ + + typedef [v1_enum] enum { + CLUS_RESCLASS_UNKNOWN = 0x00000000, + CLUS_RESCLASS_STORAGE = 0x00000001, + CLUS_RESCLASS_NETWORK = 0x00000002 + } clusapi_ResourceClass; + + typedef [public] struct { + clusapi_ResourceClass Class; + uint32 SubClass; + } CLUS_RESOURCE_CLASS_INFO; + + typedef [v1_enum] enum { + CLUSCTL_RESOURCE_UNKNOWN = 0x01000000, + CLUSCTL_RESOURCE_GET_CHARACTERISTICS = 0x01000005, + CLUSCTL_RESOURCE_GET_FLAGS = 0x01000009, + CLUSCTL_RESOURCE_GET_CLASS_INFO = 0x0100000D, + CLUSCTL_RESOURCE_GET_REQUIRED_DEPENDENCIES = 0x01000011, + CLUSCTL_RESOURCE_GET_NAME = 0x01000029, + CLUSCTL_RESOURCE_GET_RESOURCE_TYPE = 0x0100002D, + CLUSCTL_RESOURCE_GET_ID = 0x01000039, + CLUSCTL_RESOURCE_ENUM_COMMON_PROPERTIES = 0x01000051, + CLUSCTL_RESOURCE_GET_RO_COMMON_PROPERTIES = 0x01000055, + CLUSCTL_RESOURCE_GET_COMMON_PROPERTIES = 0x01000059, + CLUSCTL_RESOURCE_SET_COMMON_PROPERTIES = 0x0140005E, + CLUSCTL_RESOURCE_VALIDATE_COMMON_PROPERTIES = 0x01000061, + CLUSCTL_RESOURCE_GET_COMMON_PROPERTY_FMTS = 0x01000065, + CLUSCTL_RESOURCE_ENUM_PRIVATE_PROPERTIES = 0x01000079, + CLUSCTL_RESOURCE_GET_RO_PRIVATE_PROPERTIES = 0x0100007D, + CLUSCTL_RESOURCE_GET_PRIVATE_PROPERTIES = 0x01000081, + CLUSCTL_RESOURCE_SET_PRIVATE_PROPERTIES = 0x01400086, + CLUSCTL_RESOURCE_VALIDATE_PRIVATE_PROPERTIES = 0x01000089, + CLUSCTL_RESOURCE_GET_PRIVATE_PROPERTY_FMTS = 0x0100008D, + CLUSCTL_RESOURCE_ADD_REGISTRY_CHECKPOINT = 0x014000A2, + CLUSCTL_RESOURCE_DELETE_REGISTRY_CHECKPOINT = 0x014000A6, + CLUSCTL_RESOURCE_GET_REGISTRY_CHECKPOINTS = 0x010000A9, + CLUSCTL_RESOURCE_ADD_CRYPTO_CHECKPOINT = 0x014000AE, + CLUSCTL_RESOURCE_DELETE_CRYPTO_CHECKPOINT = 0x014000B2, + CLUSCTL_RESOURCE_GET_CRYPTO_CHECKPOINTS = 0x010000B5, + CLUSCTL_RESOURCE_UPGRADE_DLL = 0x014000BA, + CLUSCTL_RESOURCE_ADD_REGISTRY_CHECKPOINT_64BIT = 0x014000BE, + CLUSCTL_RESOURCE_ADD_REGISTRY_CHECKPOINT_32BIT = 0x014000C2, + CLUSCTL_RESOURCE_GET_NETWORK_NAME = 0x01000169, + CLUSCTL_RESOURCE_NETNAME_REGISTER_DNS_RECORDS = 0x01000172, + CLUSCTL_RESOURCE_GET_DNS_NAME = 0x01000175, + CLUSCTL_RESOURCE_NETNAME_SET_PWD_INFO = 0x0100017A, + CLUSCTL_RESOURCE_NETNAME_DELETE_CO = 0x0100017E, + CLUSCTL_RESOURCE_NETNAME_VALIDATE_VCO = 0x01000181, + CLUSCTL_RESOURCE_NETNAME_RESET_VCO = 0x01000185, + CLUSCTL_RESOURCE_NETNAME_CREDS_UPDATED = 0x01c0018a, + CLUSCTL_RESOURCE_STORAGE_GET_DISK_INFO = 0x01000191, + CLUSCTL_RESOURCE_STORAGE_IS_PATH_VALID = 0x01000199, + CLUSCTL_RESOURCE_IPADDRESS_RENEW_LEASE = 0x014001BE, + CLUSCTL_RESOURCE_IPADDRESS_RELEASE_LEASE = 0x014001C2, + CLUSCTL_RESOURCE_QUERY_MAINTENANCE_MODE = 0x010001E1, + CLUSCTL_RESOURCE_SET_MAINTENANCE_MODE = 0x014001E6, + CLUSCTL_RESOURCE_STORAGE_SET_DRIVELETTER = 0x014001EA, + CLUSCTL_RESOURCE_STORAGE_GET_DISK_INFO_EX = 0x010001F1, + CLUSCTL_RESOURCE_STORAGE_GET_DIRTY = 0x01000219, + CLUSCTL_RESOURCE_STORAGE_GET_MOUNTPOINTS = 0x01000211, + CLUSCTL_RESOURCE_STORAGE_GET_SHARED_VOLUME_INFO = 0x01000225, + CLUSCTL_RESOURCE_VM_START_MIGRATION = 0x01600004, + CLUSCTL_RESOURCE_VM_CANCEL_MIGRATION = 0x01600008, + CLUSCTL_RESOURCE_SET_CSV_MAINTENANCE_MODE = 0x01400296, + CLUSCTL_RESOURCE_ENABLE_SHARED_VOLUME_DIRECTIO = 0x0140028a, + CLUSCTL_RESOURCE_DISABLE_SHARED_VOLUME_DIRECTIO = 0x0140028e, + CLUSCTL_RESOURCE_SET_SHARED_VOLUME_BACKUP_MODE = 0x0140029a, + CLUSCTL_RESOURCE_GET_RELATED_RESOURCE_NAMES = 0x01001fad, + CLUSCTL_RESOURCE_POOL_GET_DRIVE_INFO = 0x010002b5, + CLUSCTL_RESOURCE_CLOUD_WITNESS_UPDATE_TOKEN = 0x014020e6, + CLUSCTL_RESOURCE_NETNAME_CHECK_OU_PERMISSIONS = 0x07002121, + CLUSCTL_RESOURCE_NETNAME_CHECK_AD_STATE = 0x07002125 + } clusapi_ResourceControlCode; + + WERROR + clusapi_ResourceControl( + [ in ] HRES_RPC hResource, + [ in ] clusapi_ResourceControlCode dwControlCode, + [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer, + [ in ] uint32 nInBufferSize, + [ out, size_is(nOutBufferSize), + length_is (*lpBytesReturned)] uint8 *lpOutBuffer, + [ in ] uint32 nOutBufferSize, + [ out ] uint32 *lpBytesReturned, + [ out ] uint32 *lpcbRequired, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x4A */ + + WERROR + clusapi_NodeResourceTypeControl( + [ in ] HCLUSTER_RPC hCluster, + [ in, string ] [charset(UTF16)] uint16 *lpszResourceTypeName, + [ in ] HNODE_RPC hNode, + [ in ] uint32 dwControlCode, + [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer, + [ in ] uint32 nInBufferSize, + [ out, size_is(nOutBufferSize), + length_is (*lpBytesReturned)] uint8 *lpOutBuffer, + [ in ] uint32 nOutBufferSize, + [ out ] uint32 *lpBytesReturned, + [ out ] uint32 *lpcbRequired, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x4B */ + + typedef [v1_enum] enum { + CLUSCTL_RESOURCE_TYPE_UNKNOWN = 0x02000000, + CLUSCTL_RESOURCE_TYPE_GET_CHARACTERISTICS = 0x02000005, + CLUSCTL_RESOURCE_TYPE_GET_FLAGS = 0x02000009, + CLUSCTL_RESOURCE_TYPE_GET_CLASS_INFO = 0x0200000D, + CLUSCTL_RESOURCE_TYPE_GET_REQUIRED_DEPENDENCIES = 0x02000011, + CLUSCTL_RESOURCE_TYPE_GET_ARB_TIMEOUT = 0x02000015, + CLUSCTL_RESOURCE_TYPE_ENUM_COMMON_PROPERTIES = 0x02000051, + CLUSCTL_RESOURCE_TYPE_GET_RO_COMMON_PROPERTIES = 0x02000055, + CLUSCTL_RESOURCE_TYPE_GET_COMMON_PROPERTIES = 0x02000059, + CLUSCTL_RESOURCE_TYPE_SET_COMMON_PROPERTIES = 0x0240005E, + CLUSCTL_RESOURCE_TYPE_VALIDATE_COMMON_PROPERTIES = 0x02000061, + CLUSCTL_RESOURCE_TYPE_GET_COMMON_PROPERTY_FMTS = 0x02000065, + CLUSCTL_RESOURCE_TYPE_GET_COMMON_RESOURCE_PROPERTY_FMTS = 0x02000069, + CLUSCTL_RESOURCE_TYPE_ENUM_PRIVATE_PROPERTIES = 0x02000079, + CLUSCTL_RESOURCE_TYPE_GET_RO_PRIVATE_PROPERTIES = 0x0200007D, + CLUSCTL_RESOURCE_TYPE_GET_PRIVATE_PROPERTIES = 0x02000081, + CLUSCTL_RESOURCE_TYPE_SET_PRIVATE_PROPERTIES = 0x02400086, + CLUSCTL_RESOURCE_TYPE_VALIDATE_PRIVATE_PROPERTIES = 0x02000089, + CLUSCTL_RESOURCE_TYPE_GET_PRIVATE_PROPERTY_FMTS = 0x0200008D, + CLUSCTL_RESOURCE_TYPE_GET_PRIVATE_RESOURCE_PROPERTY_FMTS= 0x02000091, + CLUSCTL_RESOURCE_TYPE_STORAGE_GET_AVAILABLE_DISKS = 0x02000195, + CLUSCTL_RESOURCE_TYPE_NETNAME_VALIDATE_NETNAME = 0x02000235, + CLUSCTL_RESOURCE_TYPE_VALIDATE_PATH = 0x02000231, + CLUSCTL_RESOURCE_TYPE_GEN_APP_VALIDATE_DIRECTORY = 0x02000239, + CLUSCTL_RESOURCE_TYPE_STORAGE_GET_DRIVELETTERS = 0x020001ED, + CLUSCTL_RESOURCE_TYPE_STORAGE_GET_AVAILABLE_DISKS_EX = 0x020001F5, + CLUSCTL_RESOURCE_TYPE_STORAGE_REMAP_DRIVELETTER = 0x02000201, + CLUSCTL_RESOURCE_TYPE_STORAGE_GET_DISKID = 0x02000205, + CLUSCTL_RESOURCE_TYPE_STORAGE_IS_CLUSTERABLE = 0x02000209, + CLUSCTL_RESOURCE_TYPE_STORAGE_RELEASE_OWNERSHIP = 0x0240020E, + CLUSCTL_RESOURCE_TYPE_STORAGE_IS_CSV_FILE = 0x1000229, + CLUSCTL_RESOURCE_TYPE_CLOUD_WITNESS_VALIDATE_CREDENTIALS= 0x020020e1, + CLUSCTL_RESOURCE_TYPE_REPLICATION_GET_ELIGIBLE_LOGDISKS = 0x02002149, + CLUSCTL_RESOURCE_TYPE_REPLICATION_GET_ELIGIBLE_TARGET_DATADISKS = 0x0200214D, + CLUSCTL_RESOURCE_TYPE_REPLICATION_GET_ELIGIBLE_SOURCE_DATADISKS = 0x02002151, + CLUSCTL_RESOURCE_TYPE_REPLICATION_GET_REPLICA_VOLUMES = 0x02002159, + CLUSCTL_RESOURCE_TYPE_REPLICATION_GET_LOG_VOLUME = 0x0200215D, + CLUSCTL_RESOURCE_TYPE_REPLICATION_GET_REPLICATED_DISKS = 0x02002155, + CLUSCTL_RESOURCE_TYPE_REPLICATION_GET_RESOURCE_GROUP = 0x02002161 + } clusapi_ResourceTypeControlCode; + + WERROR + clusapi_ResourceTypeControl( + [ in ] HCLUSTER_RPC hCluster, + [ in, string ] [charset(UTF16)] uint16 *lpszResourceTypeName, + [ in ] clusapi_ResourceTypeControlCode dwControlCode, + [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer, + [ in ] uint32 nInBufferSize, + [ out, size_is(nOutBufferSize), + length_is (*lpBytesReturned)] uint8 *lpOutBuffer, + [ in ] uint32 nOutBufferSize, + [ out ] uint32 *lpBytesReturned, + [ out ] uint32 *lpcbRequired, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x4C */ + + WERROR + clusapi_NodeGroupControl( + [ in ] HGROUP_RPC hGroup, + [ in ] HNODE_RPC hNode, + [ in ] uint32 dwControlCode, + [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer, + [ in ] uint32 nInBufferSize, + [ out, size_is(nOutBufferSize), + length_is (*lpBytesReturned)] uint8 *lpOutBuffer, + [ in ] uint32 nOutBufferSize, + [ out ] uint32 *lpBytesReturned, + [ out ] uint32 *lpcbRequired, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x4D */ + + typedef [v1_enum] enum { + CLUSCTL_GROUP_UNKNOWN = 0x03000000, + CLUSCTL_GROUP_GET_CHARACTERISTICS = 0x03000005, + CLUSCTL_GROUP_GET_FLAGS = 0x03000009, + CLUSCTL_GROUP_GET_NAME = 0x03000029, + CLUSCTL_GROUP_GET_ID = 0x03000039, + CLUSCTL_GROUP_ENUM_COMMON_PROPERTIES = 0x03000051, + CLUSCTL_GROUP_GET_RO_COMMON_PROPERTIES = 0x03000055, + CLUSCTL_GROUP_GET_COMMON_PROPERTIES = 0x03000059, + CLUSCTL_GROUP_SET_COMMON_PROPERTIES = 0x0340005E, + CLUSCTL_GROUP_VALIDATE_COMMON_PROPERTIES = 0x03000061, + CLUSCTL_GROUP_GET_COMMON_PROPERTY_FMTS = 0x03000065, + CLUSCTL_GROUP_ENUM_PRIVATE_PROPERTIES = 0x03000079, + CLUSCTL_GROUP_GET_RO_PRIVATE_PROPERTIES = 0x0300007D, + CLUSCTL_GROUP_GET_PRIVATE_PROPERTIES = 0x03000081, + CLUSCTL_GROUP_SET_PRIVATE_PROPERTIES = 0x03400086, + CLUSCTL_GROUP_VALIDATE_PRIVATE_PROPERTIES = 0x03000089 + } clusapi_GroupControlCode; + + WERROR + clusapi_GroupControl( + [ in ] HGROUP_RPC hGroup, + [ in ] clusapi_GroupControlCode dwControlCode, + [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer, + [ in ] uint32 nInBufferSize, + [ out, size_is(nOutBufferSize), + length_is (*lpBytesReturned)] uint8 *lpOutBuffer, + [ in ] uint32 nOutBufferSize, + [ out ] uint32 *lpBytesReturned, + [ out ] uint32 *lpcbRequired, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x4E */ + + WERROR + clusapi_NodeNodeControl( + [ in ] HNODE_RPC hNode, + [ in ] HNODE_RPC hHostNode, + [ in ] uint32 dwControlCode, + [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer, + [ in ] uint32 nInBufferSize, + [ out, size_is(nOutBufferSize), + length_is (*lpBytesReturned)] uint8 *lpOutBuffer, + [ in ] uint32 nOutBufferSize, + [ out ] uint32 *lpBytesReturned, + [ out ] uint32 *lpcbRequired, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x4F */ + + typedef [v1_enum] enum { + CLUSCTL_NODE_UNKNOWN = 0x04000000, + CLUSCTL_NODE_GET_CHARACTERISTICS = 0x04000005, + CLUSCTL_NODE_GET_FLAGS = 0x04000009, + CLUSCTL_NODE_GET_NAME = 0x04000029, + CLUSCTL_NODE_GET_ID = 0x04000039, + CLUSCTL_NODE_GET_CLUSTER_SERVICE_ACCOUNT_NAME = 0x04000041, + CLUSCTL_NODE_ENUM_COMMON_PROPERTIES = 0x04000051, + CLUSCTL_NODE_GET_RO_COMMON_PROPERTIES = 0x04000055, + CLUSCTL_NODE_GET_COMMON_PROPERTIES = 0x04000059, + CLUSCTL_NODE_SET_COMMON_PROPERTIES = 0x0440005E, + CLUSCTL_NODE_VALIDATE_COMMON_PROPERTIES = 0x04000061, + CLUSCTL_NODE_ENUM_PRIVATE_PROPERTIES = 0x04000079, + CLUSCTL_NODE_GET_RO_PRIVATE_PROPERTIES = 0x0400007D, + CLUSCTL_NODE_GET_PRIVATE_PROPERTIES = 0x04000081, + CLUSCTL_NODE_SET_PRIVATE_PROPERTIES = 0x04400086, + CLUSCTL_NODE_VALIDATE_PRIVATE_PROPERTIES = 0x04000089 + } clusapi_NodeControlCode; + + WERROR + clusapi_NodeControl( + [ in ] HNODE_RPC hNode, + [ in ] clusapi_NodeControlCode dwControlCode, + [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer, + [ in ] uint32 nInBufferSize, + [ out, size_is(nOutBufferSize), + length_is (*lpBytesReturned)] uint8 *lpOutBuffer, + [ in ] uint32 nOutBufferSize, + [ out ] uint32 *lpBytesReturned, + [ out ] uint32 *lpcbRequired, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x50 */ + + WERROR + Opnum80NotUsedOnWire(void); + + /*****************/ + /* Function 0x51 */ +#if 0 + HNETWORK_RPC + clusapi_OpenNetwork( + [ in, string ] [charset(UTF16)] uint16 *lpszNetworkName, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status + ); +#else + void + clusapi_OpenNetwork( + [ in, string ] [charset(UTF16)] uint16 *lpszNetworkName, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status, + [ out ] HNETWORK_RPC *hNetwork + ); +#endif + /*****************/ + /* Function 0x52 */ + + WERROR + clusapi_CloseNetwork( + [ in, out ] HNETWORK_RPC *Network + ); + + /*****************/ + /* Function 0x53 */ + + typedef [v1_enum] enum { + ClusterNetworkUnavailable = 0x00000000, + ClusterNetworkDown = 0x00000001, + ClusterNetworkPartitioned = 0x00000002, + ClusterNetworkUp = 0x00000003, + ClusterNetworkStateUnknown = 0xFFFFFFFF + } clusapi_ClusterNetworkState; + + WERROR + clusapi_GetNetworkState( + [ in ] HNETWORK_RPC hNetwork, + [ out ] clusapi_ClusterNetworkState *State, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x54 */ + + WERROR + clusapi_SetNetworkName( + [ in ] HNETWORK_RPC hNetwork, + [ in, string ] [charset(UTF16)] uint16 *lpszNetworkName, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x55 */ + + WERROR + clusapi_CreateNetworkEnum( + [ in ] HNETWORK_RPC hNetwork, + [ in ] uint32 dwType, + [ out ] ENUM_LIST **ReturnEnum, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x56 */ + + WERROR + clusapi_GetNetworkId( + [ in ] HNETWORK_RPC hNetwork, + [ out, string ] [charset(UTF16)] uint16 **pGuid, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x57 */ + + WERROR + clusapi_SetNetworkPriorityOrder( + [ in, range(0, 1000)] uint32 NetworkCount, + [ in, string, size_is(NetworkCount) ] [charset(UTF16)] uint16 NetworkIdList[*], + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x58 */ + + WERROR + clusapi_NodeNetworkControl( + [ in ] HNETWORK_RPC hNetwork, + [ in ] HNODE_RPC hNode, + [ in ] uint32 dwControlCode, + [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer, + [ in ] uint32 nInBufferSize, + [ out, size_is(nOutBufferSize), + length_is (*lpBytesReturned)] uint8 *lpOutBuffer, + [ in ] uint32 nOutBufferSize, + [ out ] uint32 *lpBytesReturned, + [ out ] uint32 *lpcbRequired, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x59 */ + + WERROR + clusapi_NetworkControl( + [ in ] HNETWORK_RPC hNetwork, + [ in ] uint32 dwControlCode, + [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer, + [ in ] uint32 nInBufferSize, + [ out, size_is(nOutBufferSize), + length_is (*lpBytesReturned)] uint8 *lpOutBuffer, + [ in ] uint32 nOutBufferSize, + [ out ] uint32 *lpBytesReturned, + [ out ] uint32 *lpcbRequired, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x5A */ + + WERROR + clusapi_AddNotifyNetwork( + [ in ] HNOTIFY_RPC hNotify, + [ in ] HNETWORK_RPC hNetwork, + [ in ] uint32 dwFilter, + [ in ] uint32 dwNotifyKey, + [ out ] uint32 *dwStateSequence, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x5B */ + + WERROR + clusapi_ReAddNotifyNetwork( + [ in ] HNOTIFY_RPC hNotify, + [ in ] HNETWORK_RPC hNetwork, + [ in ] uint32 dwFilter, + [ in ] uint32 dwNotifyKey, + [ in ] uint32 StateSequence, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x5C */ +#if 0 + HNETINTERFACE_RPC + clusapi_OpenNetInterface( + [ in, string ] [charset(UTF16)] uint16 *lpszNetInterfaceName, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status + ); +#else + void + clusapi_OpenNetInterface( + [ in, string ] [charset(UTF16)] uint16 *lpszNetInterfaceName, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status, + [ out ] HNETINTERFACE_RPC *hNetInterface + ); +#endif + /*****************/ + /* Function 0x5D */ + + WERROR + clusapi_CloseNetInterface( + [ in, out ] HNETINTERFACE_RPC *NetInterface + ); + + /*****************/ + /* Function 0x5E */ + + typedef [v1_enum] enum { + ClusterNetInterfaceFailed = 0x00000000, + ClusterNetInterfaceUnreachable = 0x00000001, + ClusterNetInterfaceUnavailable = 0x00000002, + ClusterNetInterfaceUp = 0x00000003, + ClusterNetInterfaceStateUnknown = 0xFFFFFFFF + } clusapi_ClusterNetInterfaceState; + + WERROR + clusapi_GetNetInterfaceState( + [ in ] HNETINTERFACE_RPC hNetInterface, + [ out ] clusapi_ClusterNetInterfaceState *State, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x5F */ + + WERROR + clusapi_GetNetInterface( + [ in, string ] [charset(UTF16)] uint16 *lpszNodeName, + [ in, string ] [charset(UTF16)] uint16 *lpszNetworkName, + [ out, string ] [charset(UTF16)] uint16 **lppszInterfaceName, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x60 */ + + WERROR + clusapi_GetNetInterfaceId( + [ in ] HNETINTERFACE_RPC hNetInterface, + [ out, string ] [charset(UTF16)] uint16 **pGuid, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x61 */ + + WERROR + clusapi_NodeNetInterfaceControl( + [ in ] HNETINTERFACE_RPC hNetInterface, + [ in ] HNODE_RPC hNode, + [ in ] uint32 dwControlCode, + [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer, + [ in ] uint32 nInBufferSize, + [ out, size_is(nOutBufferSize), + length_is (*lpBytesReturned)] uint8 *lpOutBuffer, + [ in ] uint32 nOutBufferSize, + [ out ] uint32 *lpBytesReturned, + [ out ] uint32 *lpcbRequired, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x62 */ + + WERROR + clusapi_NetInterfaceControl( + [ in ] HNETINTERFACE_RPC hNetInterface, + [ in ] uint32 dwControlCode, + [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer, + [ in ] uint32 nInBufferSize, + [ out, size_is(nOutBufferSize), + length_is (*lpBytesReturned)] uint8 *lpOutBuffer, + [ in ] uint32 nOutBufferSize, + [ out ] uint32 *lpBytesReturned, + [ out ] uint32 *lpcbRequired, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x63 */ + + WERROR + clusapi_AddNotifyNetInterface( + [ in ] HNOTIFY_RPC hNotify, + [ in ] HNETINTERFACE_RPC hNetInterface, + [ in ] uint32 dwFilter, + [ in ] uint32 dwNotifyKey, + [ out ] uint32 *dwStateSequence, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x64 */ + + WERROR + clusapi_ReAddNotifyNetInterface( + [ in ] HNOTIFY_RPC hNotify, + [ in ] HNETINTERFACE_RPC hNetInterface, + [ in ] uint32 dwFilter, + [ in ] uint32 dwNotifyKey, + [ in ] uint32 StateSequence, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x65 */ + + WERROR + clusapi_CreateNodeEnum( + [ in ] HNODE_RPC hNode, + [ in ] uint32 dwType, + [ out ] ENUM_LIST **ReturnEnum, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x66 */ + + WERROR + clusapi_GetClusterVersion2( + [ out ] uint16 *lpwMajorVersion, + [ out ] uint16 *lpwMinorVersion, + [ out ] uint16 *lpwBuildNumber, + [ out, string ] [charset(UTF16)] uint16 **lpszVendorId, + [ out, string ] [charset(UTF16)] uint16 **lpszCSDVersion, + [ out ] CLUSTER_OPERATIONAL_VERSION_INFO **ppClusterOpVerInfo, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x67 */ + + typedef [bitmap32bit] bitmap { + CLUSTER_RESOURCE_TYPE_ENUM_NODES = 0x00000001, + CLUSTER_RESOURCE_TYPE_ENUM_RESOURCES = 0x00000002 + } ClusterResTypeEnumType; + + WERROR + clusapi_CreateResTypeEnum( + [ in, string ] [charset(UTF16)] uint16 *lpszTypeName, + [ in ] ClusterResTypeEnumType dwType, + [ out ] ENUM_LIST **ReturnEnum, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x68 */ + + WERROR + clusapi_BackupClusterDatabase( + [ in, string ] [charset(UTF16)] uint16 *lpszPathName, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x69 */ + + WERROR + clusapi_NodeClusterControl( + [ in ] HCLUSTER_RPC hCluster, + [ in ] HNODE_RPC hHostNode, + [ in ] uint32 dwControlCode, + [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer, + [ in ] uint32 nInBufferSize, + [ out, size_is(nOutBufferSize), + length_is (*lpBytesReturned)] uint8 *lpOutBuffer, + [ in ] uint32 nOutBufferSize, + [ out ] uint32 *lpBytesReturned, + [ out ] uint32 *lpcbRequired, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x6A */ + + typedef [v1_enum] enum { + CLUSCTL_CLUSTER_UNKNOWN = 0x07000000, + CLUSCTL_CLUSTER_GET_FQDN = 0x0700003D, + CLUSCTL_CLUSTER_CHECK_VOTER_EVICT = 0x07000045, + CLUSCTL_CLUSTER_CHECK_VOTER_DOWN = 0x07000049, + CLUSCTL_CLUSTER_SHUTDOWN = 0x0700004D, + CLUSCTL_CLUSTER_ENUM_COMMON_PROPERTIES = 0x07000051, + CLUSCTL_CLUSTER_GET_RO_COMMON_PROPERTIES = 0x07000055, + CLUSCTL_CLUSTER_GET_COMMON_PROPERTIES = 0x07000059, + CLUSCTL_CLUSTER_SET_COMMON_PROPERTIES = 0x0740005E, + CLUSCTL_CLUSTER_VALIDATE_COMMON_PROPERTIES = 0x07000061, + CLUSCTL_CLUSTER_GET_COMMON_PROPERTY_FMTS = 0x07000065, + CLUSCTL_CLUSTER_ENUM_PRIVATE_PROPERTIES = 0x07000079, + CLUSCTL_CLUSTER_GET_RO_PRIVATE_PROPERTIES = 0x0700007D, + CLUSCTL_CLUSTER_GET_PRIVATE_PROPERTIES = 0x07000081, + CLUSCTL_CLUSTER_SET_PRIVATE_PROPERTIES = 0x07400086, + CLUSCTL_CLUSTER_VALIDATE_PRIVATE_PROPERTIES = 0x07000089, + CLUSCTL_CLUSTER_GET_SHARED_VOLUME_ID = 0x07000291, + CLUSCTL_CLUSTER_UPGRADE_CLUSTER_VERSION = 0x074000ce, + CLUSCTL_CLUSTER_CLEAR_UPGRADE_IN_PROGRESS = 0x074000d2, + CLUSCTL_CLUSTER_IS_READY_FOR_UPGRADE = 0x070000d5 + } clusapi_ClusterControlCode; + + typedef [v1_enum] enum { + CLUSPROP_SYNTAX_ENDMARK = 0x00000000, + CLUSPROP_SYNTAX_NAME = 0x00040003, + CLUSPROP_SYNTAX_RESCLASS = 0x00020002, + CLUSPROP_SYNTAX_LIST_VALUE_SZ = 0x00010003, + CLUSPROP_SYNTAX_LIST_VALUE_EXPAND_SZ = 0x00010004, + CLUSPROP_SYNTAX_LIST_VALUE_DWORD = 0x00010002, + CLUSPROP_SYNTAX_LIST_VALUE_BINARY = 0x00010001, + CLUSPROP_SYNTAX_LIST_VALUE_MULTI_SZ = 0x00010005, + CLUSPROP_SYNTAX_LIST_VALUE_LONG = 0x00010007, + CLUSPROP_SYNTAX_LIST_VALUE_EXPANDED_SZ = 0x00010008, + CLUSPROP_SYNTAX_LIST_VALUE_SECURITY_DESCRIPTOR = 0x00010009, + CLUSPROP_SYNTAX_LIST_VALUE_LARGE_INTEGER = 0x0001000a, + CLUSPROP_SYNTAX_LIST_VALUE_ULARGE_INTEGER = 0x00010006, + CLUSPROP_SYNTAX_LIST_VALUE_WORD = 0x0001000b, + CLUSPROP_SYNTAX_LIST_VALUE_FILETIME = 0x0001000c, + CLUSPROP_SYNTAX_DISK_SIGNATURE = 0x00050002, + CLUSPROP_SYNTAX_SCSI_ADDRESS = 0x00060002, + CLUSPROP_SYNTAX_DISK_NUMBER = 0x00070002, + CLUSPROP_SYNTAX_PARTITION_INFO = 0x00080001, + CLUSPROP_SYNTAX_DISK_SERIALNUMBER = 0x000a0003, + CLUSPROP_SYNTAX_DISK_GUID = 0x000b0003, + CLUSPROP_SYNTAX_DISK_SIZE = 0x000c0006, + CLUSPROP_SYNTAX_PARTITION_INFO_EX = 0x000d0001 + } CLUSTER_PROPERTY_SYNTAX; + + typedef struct { + CLUSTER_PROPERTY_SYNTAX Syntax; + uint32 Size; + [subcontext(0),subcontext_size(Size)] [flag(NDR_REMAINING)] DATA_BLOB Buffer; + [flag(NDR_ALIGN4)] DATA_BLOB Padding; + } clusapi_propertyValues; + + typedef struct { + [value(CLUSPROP_SYNTAX_NAME)] CLUSTER_PROPERTY_SYNTAX syntax_name; + [value(strlen_m_term(buffer)*2)] uint32 size; + nstring buffer; + [flag(NDR_ALIGN2)] DATA_BLOB padding; + clusapi_propertyValues PropertyValues; + [value(CLUSPROP_SYNTAX_ENDMARK)] CLUSTER_PROPERTY_SYNTAX end_mark; + } clusapi_propertyValue; + + typedef [public] struct { + uint32 propertyCount; + clusapi_propertyValue propertyValues[propertyCount]; + [value(CLUSPROP_SYNTAX_ENDMARK)] CLUSTER_PROPERTY_SYNTAX end_mark; + } clusapi_PROPERTY_LIST; + + WERROR + clusapi_ClusterControl( + [ in ] HCLUSTER_RPC hCluster, + [ in ] clusapi_ClusterControlCode dwControlCode, + [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer, + [ in ] uint32 nInBufferSize, + [ out, size_is(nOutBufferSize), + length_is (*lpBytesReturned)] uint8 *lpOutBuffer, + [ in ] uint32 nOutBufferSize, + [ out ] uint32 *lpBytesReturned, + [ out ] uint32 *lpcbRequired, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x6B */ + + WERROR + clusapi_UnblockGetNotifyCall( + [ in ] HNOTIFY_RPC hNotify + ); + + /*****************/ + /* Function 0x6C */ + + WERROR + clusapi_SetServiceAccountPassword( + [ in, string ] [charset(UTF16)] uint16 *lpszNewPassword, + [ in ] IDL_CLUSTER_SET_PASSWORD_FLAGS dwFlags, + [ out, size_is(ReturnStatusBufferSize), length_is(*SizeReturned) ] + IDL_CLUSTER_SET_PASSWORD_STATUS ReturnStatusBufferPtr[*], + [ in, range(0, (64 * 1024)) ] uint32 ReturnStatusBufferSize, + [ out ] uint32 *SizeReturned, + [ out ] uint32 *ExpectedBufferSize + ); + + /*****************/ + /* Function 0x6D */ + + WERROR + clusapi_SetResourceDependencyExpression( + [ in ] HRES_RPC hResource, + [ in, string, unique ] [charset(UTF16)] uint16 *lpszDependencyExpression, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x6E */ + + WERROR + clusapi_GetResourceDependencyExpression( + [ in ] HRES_RPC hResource, + [ out, string ] [charset(UTF16)] uint16 **lpszDependencyExpression, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x6F */ + + WERROR + Opnum111NotUsedOnWire(void); + + /*****************/ + /* Function 0x70 */ + + WERROR + clusapi_GetResourceNetworkName( + [ in ] HRES_RPC hResource, + [ out, string ] [charset(UTF16)] uint16 **lpszName, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x71 */ + + WERROR + clusapi_ExecuteBatch( + [ in ] HKEY_RPC hKey, + [ in ] uint32 cbData, + [ in, size_is(cbData)] uint8 *lpData, + [ out ] int *pdwFailedCommand, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x72 */ + + WERROR + clusapi_CreateBatchPort( + [ in ] HKEY_RPC hKey, + [ out ] HBATCH_PORT_RPC *phBatchPort, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x73 */ + + WERROR + clusapi_GetBatchNotification( + [ in ] HBATCH_PORT_RPC hBatchNotify, + [ out ] uint32 *cbData, + [ out, size_is(,*cbData) ] uint8 ** lpData + ); + + /*****************/ + /* Function 0x74 */ + + WERROR + clusapi_CloseBatchPort( + [ in, out ] HBATCH_PORT_RPC *phBatchPort + ); + + /*****************/ + /* Function 0x75 */ + + typedef [bitmap32bit] bitmap { + CLUSAPI_READ_ACCESS = 0x00000001, + CLUSAPI_CHANGE_ACCESS = 0x00000002, + CLUSAPI_GENERIC_READ = 0x80000000, + CLUSAPI_GENERIC_WRITE = 0x40000000, + CLUSAPI_GENERIC_EXECUTE = 0x20000000, + CLUSAPI_GENERIC_ALL = 0x10000000, + CLUSAPI_MAXIMUM_ALLOWED = 0x02000000 + } clusapi_DesiredAccessMask; + +#if 0 + HCLUSTER_RPC + clusapi_OpenClusterEx( + [ in ] clusapi_DesiredAccessMask dwDesiredAccess, + [ out ] uint32 *lpdwGrantedAccess, + [ out ] WERROR *Status + ); +#else + void + clusapi_OpenClusterEx( + [ in ] clusapi_DesiredAccessMask dwDesiredAccess, + [ out ] uint32 *lpdwGrantedAccess, + [ out ] WERROR *Status, + [ out ] HCLUSTER_RPC *hCluster + ); +#endif + + /*****************/ + /* Function 0x76 */ +#if 0 + HNODE_RPC + clusapi_OpenNodeEx( + [ in, string ] [charset(UTF16)] uint16 *lpszNodeName, + [ in ] clusapi_DesiredAccessMask dwDesiredAccess, + [ out ] uint32 *lpdwGrantedAccess, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status + ); +#else + void + clusapi_OpenNodeEx( + [ in, string ] [charset(UTF16)] uint16 *lpszNodeName, + [ in ] clusapi_DesiredAccessMask dwDesiredAccess, + [ out ] uint32 *lpdwGrantedAccess, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status, + [ out ] HNODE_RPC *hNode + ); +#endif + /*****************/ + /* Function 0x77 */ +#if 0 + HGROUP_RPC + clusapi_OpenGroupEx( + [ in, string ] [charset(UTF16)] uint16 *lpszGroupName, + [ in ] clusapi_DesiredAccessMask dwDesiredAccess, + [ out ] uint32 *lpdwGrantedAccess, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status + ); +#else + void + clusapi_OpenGroupEx( + [ in, string ] [charset(UTF16)] uint16 *lpszGroupName, + [ in ] clusapi_DesiredAccessMask dwDesiredAccess, + [ out ] uint32 *lpdwGrantedAccess, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status, + [ out ] HGROUP_RPC *hGroup + ); +#endif + /*****************/ + /* Function 0x78 */ +#if 0 + HRES_RPC + clusapi_OpenResourceEx( + [ in, string ] [charset(UTF16)] uint16 *lpszResourceName, + [ in ] clusapi_DesiredAccessMask dwDesiredAccess, + [ out ] uint32 *lpdwGrantedAccess, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status + ); +#else + void + clusapi_OpenResourceEx( + [ in, string ] [charset(UTF16)] uint16 *lpszResourceName, + [ in ] clusapi_DesiredAccessMask dwDesiredAccess, + [ out ] uint32 *lpdwGrantedAccess, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status, + [ out ] HRES_RPC *hResource + ); +#endif + /*****************/ + /* Function 0x79 */ +#if 0 + HNETWORK_RPC + clusapi_OpenNetworkEx( + [ in, string ] [charset(UTF16)] uint16 *lpszNetworkName, + [ in ] clusapi_DesiredAccessMask dwDesiredAccess, + [ out ] uint32 *lpdwGrantedAccess, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status + ); +#else + void + clusapi_OpenNetworkEx( + [ in, string ] [charset(UTF16)] uint16 *lpszNetworkName, + [ in ] clusapi_DesiredAccessMask dwDesiredAccess, + [ out ] uint32 *lpdwGrantedAccess, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status, + [ out ] HNETWORK_RPC *hNetwork + ); +#endif + /*****************/ + /* Function 0x7A */ +#if 0 + HNETINTERFACE_RPC + clusapi_OpenNetInterfaceEx( + [ in, string ] [charset(UTF16)] uint16 *lpszNetInterfaceName, + [ in ] clusapi_DesiredAccessMask dwDesiredAccess, + [ out ] uint32 *lpdwGrantedAccess, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status + ); +#else + void + clusapi_OpenNetInterfaceEx( + [ in, string ] [charset(UTF16)] uint16 *lpszNetInterfaceName, + [ in ] clusapi_DesiredAccessMask dwDesiredAccess, + [ out ] uint32 *lpdwGrantedAccess, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status, + [ out ] HNETINTERFACE_RPC *hNetInterface + ); +#endif + /*****************/ + /* Function 0x7B */ + + WERROR + clusapi_ChangeCsvState( + [ in ] HRES_RPC hResource, + [ in ] uint32 dwState, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x7C */ + + WERROR + clusapi_CreateNodeEnumEx( + [in] HNODE_RPC hNode, + [in] uint32 dwType, + [in] uint32 dwOptions, + [out] ENUM_LIST **ReturnIdEnum, + [out] ENUM_LIST **ReturnNameEnum, + [out] WERROR* rpc_status + ); + + /*****************/ + /* Function 0x7D */ + + WERROR + clusapi_CreateEnumEx( + [in] HCLUSTER_RPC hCluster, + [in] ClusterEnumType dwType, + [in] uint32 dwOptions, + [out] ENUM_LIST **ReturnIdEnum, + [out] ENUM_LIST **ReturnNameEnum, + [out] WERROR* rpc_status + ); + + /*****************/ + /* Function 0x7E */ + + WERROR + clusapi_PauseNodeEx( + [ in ] HNODE_RPC hNode, + [ in ] boolean8 bDrainNode, + [ in ] uint32 dwPauseFlags, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x7F */ + + WERROR + clusapi_PauseNodeWithDrainTarget( + [ in ] HNODE_RPC hNode, + [ in ] uint32 dwPauseFlags, + [ in ] HNODE_RPC hNodeDrainTarget, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x80 */ + + WERROR + clusapi_ResumeNodeEx( + [ in ] HNODE_RPC hNode, + [ in ] uint32 dwResumeFailbackType, + [ in ] uint32 dwResumeFlagsReserved, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x81 */ +#if 0 + HGROUP_RPC + clusapi_CreateGroupEx( + [ in, string ] [charset(UTF16)] uint16 *lpszGroupName, + [ in, unique ] CLUSTER_CREATE_GROUP_INFO_RPC *pGroupInfo, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status + ); +#else + void + clusapi_CreateGroupEx( + [ in, string ] [charset(UTF16)] uint16 *lpszGroupName, + [ in, unique ] CLUSTER_CREATE_GROUP_INFO_RPC *pGroupInfo, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status, + [ out ] HGROUP_RPC *hGroup + ); +#endif + /*****************/ + /* Function 0x82 */ + + WERROR + clusapi_OnlineGroupEx( + [ in ] HGROUP_RPC hGroup, + [ in ] uint32 dwOnlineFlags, + [ in, size_is(cbInBufferSize) ] uint8* lpInBuffer, + [ in ] uint32 cbInBufferSize, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x83 */ + + WERROR + clusapi_OfflineGroupEx( + [ in ] HGROUP_RPC hGroup, + [ in ] uint32 dwOfflineFlags, + [ in, size_is(cbInBufferSize) ] uint8* lpInBuffer, + [ in ] uint32 cbInBufferSize, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x84 */ + + WERROR + clusapi_MoveGroupEx( + [ in ] HGROUP_RPC hGroup, + [ in ] uint32 dwMoveFlags, + [ in, size_is(cbInBufferSize) ] uint8* lpInBuffer, + [ in ] uint32 cbInBufferSize, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x85 */ + + WERROR + clusapi_MoveGroupToNodeEx( + [ in ] HGROUP_RPC hGroup, + [ in ] HNODE_RPC hNode, + [ in ] uint32 dwMoveFlags, + [ in, size_is(cbInBufferSize) ] uint8* lpInBuffer, + [ in ] uint32 cbInBufferSize, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x86 */ + + WERROR + clusapi_CancelClusterGroupOperation( + [ in ] HGROUP_RPC hGroup, + [ in ] uint32 dwCancelFlags, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x87 */ + + WERROR + clusapi_OnlineResourceEx( + [ in ] HRES_RPC hResource, + [ in ] uint32 dwOnlineFlags, + [ in, size_is(cbInBufferSize) ] uint8* lpInBuffer, + [ in ] uint32 cbInBufferSize, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x88 */ + + WERROR + clusapi_OfflineResourceEx( + [ in ] HRES_RPC hResource, + [ in ] uint32 dwOfflineFlags, + [ in, size_is(cbInBufferSize) ] uint8* lpInBuffer, + [ in ] uint32 cbInBufferSize, + [ out ] WERROR *rpc_status + ); + +#define HGENERIC_RPC policy_handle +#if 0 + typedef [context_handle] void *HGENERIC_RPC; +#endif + + typedef struct { + uint32 dwObjectType; /* really of type CLUSTER_OBJECT_TYPE_RPC */ + hyper FilterFlags; + } NOTIFY_FILTER_AND_TYPE_RPC; + + typedef struct { + NOTIFY_FILTER_AND_TYPE_RPC FilterAndType; + [ size_is(dwBufferSize ) ] uint8* buffer; + uint32 dwBufferSize; + [string] [charset(UTF16)] uint16 *ObjectId; + [string] [charset(UTF16)] uint16 *ParentId; + [string] [charset(UTF16)] uint16 *Name; + [string] [charset(UTF16)] uint16 *Type; + } NOTIFICATION_DATA_RPC; + + typedef struct { + uint32 *dwNotifyKey; + NOTIFICATION_DATA_RPC NotificationData; + } NOTIFICATION_RPC; + + /*****************/ + /* Function 0x89 */ + + /* + * Notify interface V2 functions + */ +#if 0 + HNOTIFY_RPC + clusapi_CreateNotifyV2( + [ out ] WERROR *rpc_error, + [ out ] WERROR *rpc_status + ); +#else + void + clusapi_CreateNotifyV2( + [ out ] WERROR *rpc_error, + [ out ] WERROR *rpc_status, + [ out ] HNOTIFY_RPC *hNotify + ); + +#endif + /*****************/ + /* Function 0x8A */ + + WERROR + clusapi_AddNotifyV2( + [ in ] HNOTIFY_RPC hNotify, + [ in ] HGENERIC_RPC hObject, + [ in ] NOTIFY_FILTER_AND_TYPE_RPC filter, + [ in ] uint32 dwNotifyKey, + [ in ] uint32 dwVersion, + [ in ] boolean8 isTargetedAtObject, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x8B */ + + WERROR + clusapi_GetNotifyV2( + [ in ] HNOTIFY_RPC hNotify, + [ out, size_is(,*dwNumNotifications) ] NOTIFICATION_RPC **Notifications, + [ out ] uint32 *dwNumNotifications + ); + + /*****************/ + /* Function 0x8C */ + + WERROR + clusapi_QueryAllValues( + [ in ] HKEY_RPC hKey, + [ out ] uint32 *pcbData, + [ out, size_is(1, *pcbData) ] uint8 ** ppData, + [ out ] WERROR *rpc_status + ); + + typedef struct { + uint32 DiskIdType; + uint8 DiskIdBlob[16]; + } CLUSTER_DISKID; + + /*****************/ + /* Function 0x8D */ + + WERROR + clusapi_StmFindDisk( + [ in ] HCLUSTER_RPC hCluster, + [ in ] uint32 dwFlags, + [ in, out, unique ] CLUSTER_DISKID *pDiskId, + [ in, size_is(uniqueIdSize), unique ] uint8 *pUniqueId, + [ in ] uint32 uniqueIdSize, + [ out, ref, string ] [charset(UTF16)] uint16 **ppszDeviceName, + [ out ] WERROR *rpc_status + ); + + typedef struct{ + [string] [charset(UTF16)] uint16 *pszNodeName; + HRESULT ResultCode; + uint32 ResultSize; + [unique, size_is(ResultSize)] uint8 *pResultData; + } CLUSTER_MRR_NODE_RESPONSE; + + typedef struct { + uint32 NodeCount; + [size_is(NodeCount)] CLUSTER_MRR_NODE_RESPONSE *pNodes; + } CLUSTER_MRR_RESPONSE; + + /*****************/ + /* Function 0x8E */ + + WERROR + clusapi_ClusterMrr( + [ in ] HCLUSTER_RPC hCluster, + [ in ] boolean8 fExcludeSelf, + [ in ] hyper nodeSet, + [ in ] uint32 dwTimeout, + [ in ] uint32 dwComponent, + [ in ] uint32 dwControlCode, + [ in ] uint32 inSize, + [ in, unique, size_is(inSize) ] uint8 *pInData, + [ out, ref, size_is(1, 1) ] CLUSTER_MRR_RESPONSE **ppInfo, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x8F */ + + WERROR + clusapi_CreateGroupEnum( + [ in ] HCLUSTER_RPC hCluster, + [ in, unique, size_is(cbProperties)] uint8* pProperties, + [ in ] uint32 cbProperties, + [ in, unique, size_is(cbRoProperties)] uint8* pRoProperties, + [ in ] uint32 cbRoProperties, + [ out ] GROUP_ENUM_LIST **ppResultList, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x90 */ + + WERROR + clusapi_CreateResourceEnum( + [ in ] HCLUSTER_RPC hCluster, + [ in, unique, size_is(cbProperties)] uint8* pProperties, + [ in ] uint32 cbProperties, + [ in, unique, size_is(cbRoProperties)] uint8* pRoProperties, + [ in ] uint32 cbRoProperties, + [ out ] RESOURCE_ENUM_LIST **ppResultList, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x91 */ + + WERROR + clusapi_ExecuteReadBatch( + [ in ] HKEY_RPC hKey, + [ in ] uint32 cbInData, + [ in, size_is(cbInData)] uint8 *lpInData, + [ out ] uint32 *cbOutData, + [ out, size_is(,*cbOutData) ] uint8 ** lpOutData, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x92 */ + + WERROR + clusapi_RestartResource( + [ in ] HRES_RPC hResource, + [ in ] uint32 dwFlags, + [ out ] WERROR *rpc_status + ); + + typedef struct { + uint32 dwNotifyKey; + uint32 dwFilter; + [string] [charset(UTF16)] uint16 *Name; + } NOTIFICATION_DATA_ASYNC_RPC; + + /*****************/ + /* Function 0x93 */ + + WERROR + clusapi_GetNotifyAsync( + [ in ] HNOTIFY_RPC hNotify, + [ out, size_is(,*dwNumNotifications) ] NOTIFICATION_DATA_ASYNC_RPC **Notifications, + [ out ] uint32 *dwNumNotifications + ); + + typedef enum { + DiskIdSignature = 0x00000001, + DiskIdGuid = 0x00000002, + DiskIdUnKnown = 0x00001388 + } CLUSDSK_DISKID_ENUM; + +#if 0 + typedef struct { + CLUSDSK_DISKID_ENUM DiskIdType; + [switch_is(DiskIdType)] union { + [case(DiskIdSignature)] uint32 DiskSignature; + [case(DiskIdGuid)] GUID DiskGuid; + }; + } CLUSDSK_DISKID; +#endif + typedef enum { + CLUSPROP_TYPE_ENDMARK = 0x0000, + CLUSPROP_TYPE_LIST_VALUE = 0x0001, + CLUSPROP_TYPE_RESCLASS = 0x0002, + CLUSPROP_TYPE_NAME = 0x0004, + CLUSPROP_TYPE_SIGNATURE = 0x0005, + CLUSPROP_TYPE_SCSIADDRESS = 0x0006, + CLUSPROP_TYPE_DISK_NUMBER = 0x0007, + CLUSPROP_TYPE_PARTITION_INFO = 0x0008, + CLUSPROP_TYPE_DISK_SERIALNUMBER = 0x000a, + CLUSPROP_TYPE_DISK_GUID = 0x000b, + CLUSPROP_TYPE_DISK_SIZE = 0x000c, + CLUSPROP_TYPE_PARTITION_INFO_EX = 0x000d + } CLUSTER_PROPERTY_TYPE; + + typedef enum { + CLUSPROP_FORMAT_UNKNOWN = 0x0000, + CLUSPROP_FORMAT_BINARY = 0x0001, + CLUSPROP_FORMAT_DWORD = 0x0002, + CLUSPROP_FORMAT_SZ = 0x0003, + CLUSPROP_FORMAT_EXPAND_SZ = 0x0004, + CLUSPROP_FORMAT_MULTI_SZ = 0x0005, + CLUSPROP_FORMAT_ULARGE_INTEGER = 0x0006, + CLUSPROP_FORMAT_LONG = 0x0007, + CLUSPROP_FORMAT_EXPANDED_SZ = 0x0008, + CLUSPROP_FORMAT_SECURITY_DESCRIPTOR = 0x0009, + CLUSPROP_FORMAT_LARGE_INTEGER = 0x000a, + CLUSPROP_FORMAT_WORD = 0x000b, + CLUSPROP_FORMAT_FILETIME = 0x000c + } CLUSTER_PROPERTY_FORMAT; + + typedef enum { + CLUS_CHAR_UNKNOWN = 0x00000000, + CLUS_CHAR_QUORUM = 0x00000001, + CLUS_CHAR_DELETE_REQUIRES_ALL_NODES = 0x00000002, + CLUS_CHAR_LOCAL_QUORUM = 0x00000004, + CLUS_CHAR_BROADCAST_DELETE = 0x00000020, + CLUS_CHAR_SINGLE_CLUSTER_INSTANCE = 0x00000040, + CLUS_CHAR_SINGLE_GROUP_INSTANCE = 0x00000080, + CLUS_CHAR_COEXIST_IN_SHARED_VOLUME_GROUP = 0x00000100, + CLUS_CHAR_RESERVED1 = 0x00000200, + CLUS_CHAR_MONITOR_DETACH = 0x00000400, + CLUS_CHAR_RESERVED2 = 0x00000800, + CLUS_CHAR_RESERVED3 = 0x00001000, + CLUS_CHAR_RESERVED4 = 0x00002000 + } CLUS_CHARACTERISTICS; + + typedef enum { + CLUS_FLAG_CORE = 0x00000001 + } CLUS_FLAGS; + + typedef enum { + MaintenanceModeTypeDisableIsAliveCheck = 1, + MaintenanceModeTypeOfflineResource = 2, + MaintenanceModeTypeUnclusterResource = 3 + } MAINTENANCE_MODE_TYPE; + + typedef enum { + CLUSTER_CHANGE_NODE_STATE = 0x00000001, + CLUSTER_CHANGE_NODE_DELETED = 0x00000002, + CLUSTER_CHANGE_NODE_ADDED = 0x00000004, + CLUSTER_CHANGE_NODE_PROPERTY = 0x00000008, + CLUSTER_CHANGE_REGISTRY_NAME = 0x00000010, + CLUSTER_CHANGE_REGISTRY_ATTRIBUTES = 0x00000020, + CLUSTER_CHANGE_REGISTRY_VALUE = 0x00000040, + CLUSTER_CHANGE_REGISTRY_SUBTREE = 0x00000080, + CLUSTER_CHANGE_RESOURCE_STATE = 0x00000100, + CLUSTER_CHANGE_RESOURCE_DELETED = 0x00000200, + CLUSTER_CHANGE_RESOURCE_ADDED = 0x00000400, + CLUSTER_CHANGE_RESOURCE_PROPERTY = 0x00000800, + CLUSTER_CHANGE_GROUP_STATE = 0x00001000, + CLUSTER_CHANGE_GROUP_DELETED = 0x00002000, + CLUSTER_CHANGE_GROUP_ADDED = 0x00004000, + CLUSTER_CHANGE_GROUP_PROPERTY = 0x00008000, + CLUSTER_CHANGE_RESOURCE_TYPE_DELETED = 0x00010000, + CLUSTER_CHANGE_RESOURCE_TYPE_ADDED = 0x00020000, + CLUSTER_CHANGE_RESOURCE_TYPE_PROPERTY = 0x00040000, + CLUSTER_CHANGE_CLUSTER_RECONNECT = 0x00080000, + CLUSTER_CHANGE_NETWORK_STATE = 0x00100000, + CLUSTER_CHANGE_NETWORK_DELETED = 0x00200000, + CLUSTER_CHANGE_NETWORK_ADDED = 0x00400000, + CLUSTER_CHANGE_NETWORK_PROPERTY = 0x00800000, + CLUSTER_CHANGE_NETINTERFACE_STATE = 0x01000000, + CLUSTER_CHANGE_NETINTERFACE_DELETED = 0x02000000, + CLUSTER_CHANGE_NETINTERFACE_ADDED = 0x04000000, + CLUSTER_CHANGE_NETINTERFACE_PROPERTY = 0x08000000, + CLUSTER_CHANGE_QUORUM_STATE = 0x10000000, + CLUSTER_CHANGE_CLUSTER_STATE = 0x20000000, + CLUSTER_CHANGE_CLUSTER_PROPERTY = 0x40000000, + CLUSTER_CHANGE_HANDLE_CLOSE = 0x80000000 + } CLUSTER_CHANGE; + + typedef enum { + CLUSREG_SET_VALUE = 1, + CLUSREG_CREATE_KEY = 2, + CLUSREG_DELETE_KEY = 3, + CLUSREG_DELETE_VALUE = 4, + CLUSREG_VALUE_DELETED = 6, + CLUSREG_READ_KEY = 7, + CLUSREG_READ_VALUE = 8, + CLUSREG_READ_ERROR = 9 + } CLUSTER_REG_BATCH_COMMAND; +#if 0 + typedef enum { + IDL_CLUSTER_SET_PASSWORD_IGNORE_DOWN_NODES = 1 + } IDL_CLUSTER_SET_PASSWORD_FLAGS; +#endif + typedef enum { + CLUSTER_QUORUM_MAINTAINED = 0, + CLUSTER_QUORUM_LOST = 1 + } CLUSTER_QUORUM_VALUE; + + typedef enum { + CLUSTER_OBJECT_TYPE_CLUSTER = 0x00000001, + CLUSTER_OBJECT_TYPE_GROUP = 0x00000002, + CLUSTER_OBJECT_TYPE_RESOURCE = 0x00000003, + CLUSTER_OBJECT_TYPE_RESOURCE_TYPE = 0x00000004, + CLUSTER_OBJECT_TYPE_NETWORK_INTERFACE = 0x00000005, + CLUSTER_OBJECT_TYPE_NETWORK = 0x00000006, + CLUSTER_OBJECT_TYPE_NODE = 0x00000007, + CLUSTER_OBJECT_TYPE_REGISTRY = 0x00000008, + CLUSTER_OBJECT_TYPE_QUORUM = 0x00000009, + CLUSTER_OBJECT_TYPE_SHARED_VOLUME = 0x0000000a + } CLUSTER_OBJECT_TYPE; + + typedef enum { + CLUSTER_CHANGE_CLUSTER_RECONNECT_V2 = 0x00000001, + CLUSTER_CHANGE_CLUSTER_STATE_V2 = 0x00000002, + CLUSTER_CHANGE_CLUSTER_GROUP_ADDED_V2 = 0x00000004, + CLUSTER_CHANGE_CLUSTER_HANDLE_CLOSE_V2 = 0x00000008, + CLUSTER_CHANGE_CLUSTER_NETWORK_ADDED_V2 = 0x00000010, + CLUSTER_CHANGE_CLUSTER_NODE_ADDED_V2 = 0x00000020, + CLUSTER_CHANGE_CLUSTER_RESOURCE_TYPE_ADDED_V2 = 0x00000040, + CLUSTER_CHANGE_CLUSTER_COMMON_PROPERTY_V2 = 0x00000080, + CLUSTER_CHANGE_CLUSTER_PRIVATE_PROPERTY_V2 = 0x00000100, + CLUSTER_CHANGE_CLUSTER_LOST_NOTIFICATIONS_V2 = 0x00000200, + CLUSTER_CHANGE_CLUSTER_RENAME_V2 = 0x00000400 + } CLUSTER_CHANGE_CLUSTER_V2; + + typedef enum { + CLUSTER_CHANGE_GROUP_DELETED_V2 = 0x00000001, + CLUSTER_CHANGE_GROUP_COMMON_PROPERTY_V2 = 0x00000002, + CLUSTER_CHANGE_GROUP_PRIVATE_PROPERTY_V2 = 0x00000004, + CLUSTER_CHANGE_GROUP_STATE_V2 = 0x00000008, + CLUSTER_CHANGE_GROUP_OWNER_NODE_V2 = 0x00000010, + CLUSTER_CHANGE_GROUP_PREFERRED_OWNERS_V2 = 0x00000020, + CLUSTER_CHANGE_GROUP_RESOURCE_ADDED_V2 = 0x00000040, + CLUSTER_CHANGE_GROUP_RESOURCE_GAINED_V2 = 0x00000080, + CLUSTER_CHANGE_GROUP_RESOURCE_LOST_V2 = 0x00000100, + CLUSTER_CHANGE_GROUP_HANDLE_CLOSE_V2 = 0x00000200 + } CLUSTER_CHANGE_GROUP_V2; + + typedef enum { + CLUSTER_CHANGE_RESOURCE_COMMON_PROPERTY_V2 = 0x00000001, + CLUSTER_CHANGE_RESOURCE_PRIVATE_PROPERTY_V2 = 0x00000002, + CLUSTER_CHANGE_RESOURCE_STATE_V2 = 0x00000004, + CLUSTER_CHANGE_RESOURCE_OWNER_GROUP_V2 = 0x00000008, + CLUSTER_CHANGE_RESOURCE_DEPENDENCIES_V2 = 0x00000010, + CLUSTER_CHANGE_RESOURCE_DEPENDENTS_V2 = 0x00000020, + CLUSTER_CHANGE_RESOURCE_POSSIBLE_OWNERS_V2 = 0x00000040, + CLUSTER_CHANGE_RESOURCE_DELETED_V2 = 0x00000080, + CLUSTER_CHANGE_RESOURCE_DLL_UPGRADED_V2 = 0x00000100, + CLUSTER_CHANGE_RESOURCE_HANDLE_CLOSE_V2 = 0x00000200 + } CLUSTER_CHANGE_RESOURCE_V2; + + typedef enum { + CLUSTER_CHANGE_RESOURCE_TYPE_DELETED_V2 = 0x00000001, + CLUSTER_CHANGE_RESOURCE_TYPE_COMMON_PROPERTY_V2 = 0x00000002, + CLUSTER_CHANGE_RESOURCE_TYPE_PRIVATE_PROPERTY_V2 = 0x00000004, + CLUSTER_CHANGE_RESOURCE_TYPE_POSSIBLE_OWNERS_V2 = 0x00000008, + CLUSTER_CHANGE_RESOURCE_TYPE_DLL_UPGRADED_V2 = 0x00000010 + } CHANGE_RESOURCE_TYPE_V2; + + typedef enum { + CLUSTER_CHANGE_NETINTERFACE_DELETED_V2 = 0x00000001, + CLUSTER_CHANGE_NETINTERFACE_COMMON_PROPERTY_V2 = 0x00000002, + CLUSTER_CHANGE_NETINTERFACE_PRIVATE_PROPERTY_V2 = 0x00000004, + CLUSTER_CHANGE_NETINTERFACE_STATE_V2 = 0x00000008, + CLUSTER_CHANGE_NETINTERFACE_HANDLE_CLOSE_V2 = 0x00000010 + } CLUSTER_CHANGE_NETINTERFACE_V2; + + typedef enum { + CLUSTER_CHANGE_NETWORK_DELETED_V2 = 0x00000001, + CLUSTER_CHANGE_NETWORK_COMMON_PROPERTY_V2 = 0x00000002, + CLUSTER_CHANGE_NETWORK_PRIVATE_PROPERTY_V2 = 0x00000004, + CLUSTER_CHANGE_NETWORK_STATE_V2 = 0x00000008, + CLUSTER_CHANGE_NETWORK_HANDLE_CLOSE_V2 = 0x00000010 + } CLUSTER_CHANGE_NETWORK_V2; + + typedef enum { + CLUSTER_CHANGE_NODE_NETINTERFACE_ADDED_V2 = 0x00000001, + CLUSTER_CHANGE_NODE_DELETED_V2 = 0x00000002, + CLUSTER_CHANGE_NODE_COMMON_PROPERTY_V2 = 0x00000004, + CLUSTER_CHANGE_NODE_PRIVATE_PROPERTY_V2 = 0x00000008, + CLUSTER_CHANGE_NODE_STATE_V2 = 0x00000010, + CLUSTER_CHANGE_NODE_GROUP_GAINED_V2 = 0x00000020, + CLUSTER_CHANGE_NODE_GROUP_LOST_V2 = 0x00000040, + CLUSTER_CHANGE_NODE_HANDLE_CLOSE_V2 = 0x00000080 + } CLUSTER_CHANGE_NODE_V2; + + typedef enum { + CLUSTER_CHANGE_REGISTRY_ATTRIBUTES_V2 = 0x00000001, + CLUSTER_CHANGE_REGISTRY_NAME_V2 = 0x00000002, + CLUSTER_CHANGE_REGISTRY_SUBTREE_V2 = 0x00000004, + CLUSTER_CHANGE_REGISTRY_VALUE_V2 = 0x00000008, + CLUSTER_CHANGE_REGISTRY_HANDLE_CLOSE_V2 = 0x00000010 + } CLUSTER_CHANGE_REGISTRY_V2; + + typedef enum { + CLUSTER_CHANGE_QUORUM_STATE_V2 = 0x00000001 + } CLUSTER_CHANGE_QUORUM_V2; + + typedef enum { + CLUSTER_CHANGE_SHARED_VOLUME_STATE_V2 = 0x00000001 + } CLUSTER_CHANGE_SHARED_VOLUME_V2; +#if 0 + typedef enum { + DiskIdSignature = 0x00000001, + DiskIdGuid = 0x00000002, + DiskIdUnKnown = 0x00001388 + } CLUSDSK_DISKID_ENUM; +#endif + + /*****************/ + /* Function 0x94 */ + + WERROR + Opnum148NotUsedOnWire(void); + + /*****************/ + /* Function 0x95 */ + + WERROR + Opnum149otUsedOnWire(void); + + /*****************/ + /* Function 0x96 */ + + WERROR + Opnum150NotUsedOnWire(void); + + /*****************/ + /* Function 0x97 */ + + WERROR + Opnum151NotUsedOnWire(void); + + /*****************/ + /* Function 0x98 */ + + WERROR + Opnum152NotUsedOnWire(void); + + /*****************/ + /* Function 0x99 */ + + WERROR + Opnum153NotUsedOnWire(void); + + /*****************/ + /* Function 0x9A */ + + WERROR + Opnum154NotUsedOnWire(void); + + /*****************/ + /* Function 0x9B */ + + WERROR + clusapi_AddNotifyResourceTypeV2( + [ in ] HNOTIFY_RPC hNotify, + [ in ] hyper filter, + [ in ] uint32 dwNotifyKey, + [ in, string ] [charset(UTF16)] uint16 *resTypeName, + [ in ] uint32 dwVersion, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x9C */ + + WERROR + Opnum156NotUsedOnWire(void); + + /*****************/ + /* Function 0x9D */ + + WERROR + clusapi_ExecuteReadBatchEx( + [in] HKEY_RPC hKey, + [in] uint32 cbInData, + [in, size_is(cbInData)] uint8* lpInData, + [in] uint32 flags, + [out] uint32* cbOutData, + [out, size_is(,*cbOutData)] uint8** lpOutData, + [out] WERROR *rpc_status + ); + + /*****************/ + /* Function 0x9E */ + + WERROR + Opnum158NotUsedOnWire(void); + + /*****************/ + /* Function 0x9F */ + + WERROR + Opnum159NotUsedOnWire(void); + + /*****************/ + /* Function 0xA0 */ + + WERROR + Opnum160NotUsedOnWire(void); + + /*****************/ + /* Function 0xA1 */ + + WERROR + Opnum161NotUsedOnWire(void); + + /*****************/ + /* Function 0xA2 */ + + WERROR + Opnum162NotUsedOnWire(void); + + /*****************/ + /* Function 0xA3 */ + +#define HGROUPSET_RPC policy_handle +#if 0 + typedef [context_handle] void *HGROUPSET_RPC; +#endif +#if 0 + HGROUPSET_RPC + clusapi_CreateGroupSet ( + [ in, string ] [charset(UTF16)] uint16 *lpszGroupSetName, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status + ); +#else + void + clusapi_CreateGroupSet ( + [ in, string ] [charset(UTF16)] uint16 *lpszGroupSetName, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status, + [ out ] HGROUPSET_RPC *hGroupSet + ); +#endif + + /*****************/ + /* Function 0xA4 */ +#if 0 + HGROUPSET_RPC + clusapi_OpenGroupSet( + [ in, string ] [charset(UTF16)] uint16 *lpszGroupSetName, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status + ); +#else + void + clusapi_OpenGroupSet( + [ in, string ] [charset(UTF16)] uint16 *lpszGroupSetName, + [ out ] WERROR *Status, + [ out ] WERROR *rpc_status, + [ out ] HGROUPSET_RPC *hGroupSet + ); +#endif + + /*****************/ + /* Function 0xA5 */ + + WERROR + clusapi_CloseGroupSet( + [ in, out ] HGROUPSET_RPC *GroupSet + ); + + /*****************/ + /* Function 0xA6 */ + + WERROR + clusapi_DeleteGroupSet( + [ in ] HGROUPSET_RPC GroupSet, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0xA7 */ + + WERROR + clusapi_AddGroupToGroupSet( + [ in ] HGROUPSET_RPC GroupSet, + [ in ] HGROUP_RPC Group, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0xA8 */ + + WERROR + clusapi_RemoveGroupFromGroupSet( + [ in ] HGROUP_RPC Group, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0xA9 */ + + WERROR + clusapi_MoveGroupToGroupSet( + [ in ] HGROUPSET_RPC GroupSet, + [ in ] HGROUP_RPC Group, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0xAA */ + + WERROR + Opnum170NotUsedOnWire(void); + + /*****************/ + /* Function 0xAB */ + + WERROR + clusapi_AddGroupSetDependency( + [ in ] HGROUPSET_RPC DependentGroupSet, + [ in ] HGROUPSET_RPC ProviderGroupSet, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0xAC */ + + WERROR + clusapi_AddGroupToGroupSetDependency( + [ in ] HGROUP_RPC DependentGroup, + [ in ] HGROUPSET_RPC ProviderGroupSet, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0xAD */ + + typedef [v1_enum] enum { + CLUSCTL_GROUPSET_GET_ID = 0x08000039, + CLUSCTL_GROUPSET_GET_RO_COMMON_PROPERTIES = 0x08000055, + CLUSCTL_GROUPSET_GET_COMMON_PROPERTIES = 0x08000059, + CLUSCTL_GROUPSET_GET_GROUPS = 0x08002D71, + CLUSCTL_GROUPSET_GET_PROVIDER_GROUPS = 0x08002D75, + CLUSCTL_GROUPSET_GET_PROVIDER_GROUPSETS = 0x08002D79, + CLUSCTL_GROUPSET_SET_COMMON_PROPERTIES = 0x0840005E + } clusapi_GroupSetControlCode; + + WERROR + clusapi_NodeGroupSetControl( + [ in ] HGROUPSET_RPC hGroupSet, + [ in ] HNODE_RPC hNode, + [ in ] clusapi_GroupSetControlCode dwControlCode, + [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer, + [ in ] uint32 nInBufferSize, + [ out, size_is(nOutBufferSize), length_is (*lpBytesReturned)] uint8 *lpOutBuffer, + [ in, range(0, MAX_CLUSTER_CONTROL_CODE_BUFFER_SIZE)] uint32 nOutBufferSize, + [ out ] uint32 *lpBytesReturned, + [ out ] uint32 *lpcbRequired, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0xAE */ + + WERROR + clusapi_GroupSetControl( + [ in ] HGROUPSET_RPC hGroupSet, + [ in ] clusapi_GroupSetControlCode dwControlCode, + [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer, + [ in ] uint32 nInBufferSize, + [ out, size_is(nOutBufferSize), length_is (*lpBytesReturned)] uint8 *lpOutBuffer, + [ in, range(0, 0x7FFFFFFF)] uint32 nOutBufferSize, + [ out ] uint32 *lpBytesReturned, + [ out ] uint32 *lpcbRequired, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0xAF */ + + WERROR + clusapi_SetGroupDependencyExpression( + [ in ] HGROUP_RPC hGroup, + [ in, string ] [charset(UTF16)] uint16 *lpszDependencyExpression, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0xB0 */ + + WERROR + clusapi_RemoveClusterGroupDependency( + [ in ] HGROUP_RPC hGroup, + [ in ] HGROUP_RPC hDependsOn, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0xB1 */ + + WERROR + clusapi_SetGroupSetDependencyExpression( + [ in ] HGROUPSET_RPC hGroupSet, + [ in, string ] [charset(UTF16)] uint16 *lpszDependencyExpression, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0xB2 */ + + WERROR + clusapi_RemoveGroupSetDependency( + [ in ] HGROUPSET_RPC hGroupSet, + [ in ] HGROUPSET_RPC hDependsOn, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0xB3 */ + + WERROR + clusapi_RemoveClusterGroupToGroupSetDependency( + [ in ] HGROUP_RPC hGroup, + [ in ] HGROUPSET_RPC hDependsOn, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0xB4 */ + + WERROR + clusapi_CreateGroupSetEnum( + [ in ] HCLUSTER_RPC hCluster, + [ out ] ENUM_LIST **ReturnEnum, + [ out ] WERROR * rpc_status + ); + + /*****************/ + /* Function 0xB5 */ + + WERROR + clusapi_CreateNetInterfaceEnum( + [in] HCLUSTER_RPC hCluster, + [in, string] [charset(UTF16)] uint16 *lpszNodeName, + [in, string] [charset(UTF16)] uint16 *lpszNetworkName, + [out] ENUM_LIST **ReturnEnum, + [out] WERROR * rpc_status + ); + + /*****************/ + /* Function 0xB6 */ + + WERROR + clusapi_ChangeCsvStateEx( + [ in ] HRES_RPC hResource, + [ in ] uint32 dwState, + [ in, string ] [charset(UTF16)] uint16 *lpszVolumeName, + [ out ] WERROR *rpc_status + ); + + /*****************/ + /* Function 0xB7 */ + + WERROR + clusapi_AddGroupToGroupSetEx( + [ in ] HGROUPSET_RPC GroupSet, + [ in ] HGROUP_RPC Group, + [ in ] uint32 FaultDomain, + [ in ] uint32 UpdateDomain, + [ in ] boolean8 UseDomains, + [ in ] uint32 *Reserved, + [ out ] WERROR *rpc_status + ); +} diff --git a/librpc/idl/conditional_ace.idl b/librpc/idl/conditional_ace.idl new file mode 100644 index 0000000..8db0ed6 --- /dev/null +++ b/librpc/idl/conditional_ace.idl @@ -0,0 +1,458 @@ +#include "idl_types.h" + +/* + IDL structures and constants for conditional aces. +*/ + +import "security.idl"; + +interface conditional_ace +{ + /* + * Conditional ACEs have an expression at the end of the ACE. + * We know it is there because the ACE type has CALLBACK in + * its name, and we know how long it is because the size field + * in the ACE points somewhere beyond the otherwise accounted + * for objects: + * + * | type | flags | size | access_mask | trustee | | + * `---------------------------------->| + * + * If the first 4 bytes of the extra bit (called "coda" in our + * structs) are {'a', 'r', 't', 'x'}, the callback ACE is a + * conditional ACE. On Windows it is possible to register + * other kinds of callback ACEs with different magic strings + * that get handled by callback functions. There is little + * evidence of this ever happening, but that explains the + * name. + * + * After the "artx", a conditional ACE consists of a series of + * tokens that describe an expression tree in reverse Polish + * order. The expression can work with claim and SID values + * from the security token, comparing them to each other and + * to literal values. [MS-DTYP] is reasonably clear about how + * they work. + */ + + /* + * Token types from [MS-DTYP] 2.4.4.17 "Conditional ACEs". + */ + typedef [enum8bit] enum { + /* + * Microsoft counts padding zeroes as a kind of token. + * There should be up to three of these at the end, to + * round out the size to a multiple of four. + */ + CONDITIONAL_ACE_TOKEN_INVALID_OR_PADDING = 0x00, + + /* Literal tokens + * ============== + * + * Literal integers. These are *all* stored using 10 + * bytes: + * + * - 8 bytes for the value, limited to the correct range + * (e.g. -128 to 127 for INT8) + * - 1 byte for sign, probably just used for display + * - 1 byte for base, just used for display + * + * SDDL integers are all stored using 64 bits, but + * different token types can be used to pretend they + * have smaller width. In comparisons (which is all + * they can be used for) the type does not matter. The + * only special thing a non-64 bit literal can do is + * to cause a parsing error by being out of range (it + * is an open question as to how you would end up with + * short integers, let alone invalid ones, as the SDDL + * syntax does not have a way of specifying them). + */ + CONDITIONAL_ACE_TOKEN_INT8 = 0x01, + CONDITIONAL_ACE_TOKEN_INT16 = 0x02, + CONDITIONAL_ACE_TOKEN_INT32 = 0x03, + CONDITIONAL_ACE_TOKEN_INT64 = 0x04, + + /* + * Literal strings and structured types. + * + * These have an unsigned 32 bit byte length, followed + * by data. + * + * for unicode the data is UTF-16. + * octet strings are bytes. + * the composite type is a list type. + * the sid type has an ordinary binary sid after the length. + */ + CONDITIONAL_ACE_TOKEN_UNICODE = 0x10, + CONDITIONAL_ACE_TOKEN_OCTET_STRING = 0x18, + CONDITIONAL_ACE_TOKEN_COMPOSITE = 0x50, + CONDITIONAL_ACE_TOKEN_SID = 0x51, + + CONDITIONAL_ACE_LOCAL_ATTRIBUTE = 0xf8, + CONDITIONAL_ACE_USER_ATTRIBUTE = 0xf9, + CONDITIONAL_ACE_RESOURCE_ATTRIBUTE = 0xfa, + CONDITIONAL_ACE_DEVICE_ATTRIBUTE = 0xfb, + + /* + * Unary relational operator tokens + * ================================ + * + * For the membership ops, the operand can be a single + * SID or a composite list of SIDs. + * + * Member_Of: true if the security token user SIDs + * array contains all of the SIDs in the operand. + */ + CONDITIONAL_ACE_TOKEN_MEMBER_OF = 0x89, + /* + * Device_Member_Of: true if the security token device + * SIDs array contains all of the SIDs in the operand. + */ + CONDITIONAL_ACE_TOKEN_DEVICE_MEMBER_OF = 0x8a, + /* + * Member_Of_Any: true if the user SIDs array contains any of + * the SIDs in the operand. + */ + CONDITIONAL_ACE_TOKEN_MEMBER_OF_ANY = 0x8b, + /* + * Device_Member_Of_Any: true if the device SIDs array + * contains any of the SIDs in the operand. + */ + CONDITIONAL_ACE_TOKEN_DEVICE_MEMBER_OF_ANY = 0x8c, + + /* + * Logical inverses of the member-of crew. + */ + CONDITIONAL_ACE_TOKEN_NOT_MEMBER_OF = 0x90, + CONDITIONAL_ACE_TOKEN_NOT_DEVICE_MEMBER_OF = 0x91, + CONDITIONAL_ACE_TOKEN_NOT_MEMBER_OF_ANY = 0x92, + CONDITIONAL_ACE_TOKEN_NOT_DEVICE_MEMBER_OF_ANY = 0x93, + + /* + * Binary relational operators + * =========================== + * + * The left hand side argument (LHS) is an attribute. + * The RHS is an attribute or a value or composite + * list of values (depending on the operation). + * + * If the types mismatch, the result is UNKNOWN. + */ + CONDITIONAL_ACE_TOKEN_EQUAL = 0x80, /* == */ + CONDITIONAL_ACE_TOKEN_NOT_EQUAL = 0x81, /* != */ + CONDITIONAL_ACE_TOKEN_LESS_THAN = 0x82, /* < */ + CONDITIONAL_ACE_TOKEN_LESS_OR_EQUAL = 0x83, /* <= */ + CONDITIONAL_ACE_TOKEN_GREATER_THAN = 0x84, /* > */ + CONDITIONAL_ACE_TOKEN_GREATER_OR_EQUAL = 0x85, /* >= */ + + /* + * "contains" implies "all of", in contrast to the "any of" + * operators. + */ + CONDITIONAL_ACE_TOKEN_CONTAINS = 0x86, + CONDITIONAL_ACE_TOKEN_ANY_OF = 0x88, + CONDITIONAL_ACE_TOKEN_NOT_CONTAINS = 0x8e, + CONDITIONAL_ACE_TOKEN_NOT_ANY_OF = 0x8f, + + /* + * Unary logical operators + * ======================= + * + * The operand for the existence operators must be a + * local attribute or a resource attribute. + */ + CONDITIONAL_ACE_TOKEN_EXISTS = 0x87, /* Exists */ + CONDITIONAL_ACE_TOKEN_NOT_EXISTS = 0x8d, /* Not_Exists */ + /* NOT operator */ + CONDITIONAL_ACE_TOKEN_NOT = 0xa2, /* ! */ + + /* + * Binary logical operators + * ======================== + */ + CONDITIONAL_ACE_TOKEN_AND = 0xa0, /* && */ + CONDITIONAL_ACE_TOKEN_OR = 0xa1, /* || */ + + /* + * Samba specific pseudo-tokens + * ============================ + * + * In running the conditional ace we maintain a stack + * that is used as operands to the operators. Some of + * the values on the stack are literals found inline + * in the data, some are primitives resulting from + * attribute look-up operations, and some are logical + * results from comparison operations, which are in + * the ternary form just mentioned. [MS-DTYP] + * describes no token form for these ternary values, + * as they are not used on the wire (that is, you + * can't have a literal 'true' in a conditional ace). + * So we add a token representation for Boolean result + * types to use on the stack, using an available + * opcode. The result of a lookup can also be 'NULL', + * or an error, and we have opcodes for those too. + * + * These token types raise an error if they show up in + * a conditional ACE, just like any other unknown + * token type. They are for internal use only. + * + * In [MS-DTYP] these are called "Result Value". + */ + + CONDITIONAL_ACE_SAMBA_RESULT_BOOL = 0x0f, + CONDITIONAL_ACE_SAMBA_RESULT_NULL = 0x0e, + CONDITIONAL_ACE_SAMBA_RESULT_ERROR = 0x0d, + + /* + * Samba specific parentheses pseudo-tokens + * ======================================== + * + * These are useful for compiling SDDL, but will never show + * up in the compiled ACE or during evaluation. + */ + CONDITIONAL_ACE_SAMBA_SDDL_PAREN = 0x09, + CONDITIONAL_ACE_SAMBA_SDDL_PAREN_END = 0x08 + } token_type; + + /* + * Integer attributes. + * ================== + * + * Integers are stored with a base indicator and a sign + * indicator. + * + * Integer base is stored for display purposes. For example, + * the number 17 will be shown as "021" with option 1, "17" + * with 2, and "0x11" with 3. Comparisons are not affected. + */ + typedef [enum8bit] enum { + CONDITIONAL_ACE_INT_BASE_8 = 0x01, + CONDITIONAL_ACE_INT_BASE_10 = 0x02, + CONDITIONAL_ACE_INT_BASE_16 = 0x03 + } int_base; + + /* + * Integer sign, mostly for display purposes[1]. It seems + * negative numbers should be flagged here as negative (i.e. + * with 2), while positive numbers should be flagged with + * "none" (3), unless you want them to show up with a plus + * sign in SDDL. + * + * [1] it is possible this has some real significance, perhaps + * acting as an unsigned flag. TO BE DETERMINED. + */ + typedef [enum8bit] enum { + CONDITIONAL_ACE_INT_SIGN_POSITIVE = 0x01, + CONDITIONAL_ACE_INT_SIGN_NEGATIVE = 0x02, + CONDITIONAL_ACE_INT_SIGN_NONE = 0x03 + } int_sign; + + /* + * Ternary logical values + * + * Conditional ACEs use a ternary logic where values can be + * unknown as well as true or false. + * + * The "Bool" result token can take any of these three values. + * There is no literal Boolean value, but an integer of value + * 0 or 1 can be compared with a Boolean result. + */ + typedef enum { + ACE_CONDITION_FALSE = 0, + ACE_CONDITION_TRUE = 1, + ACE_CONDITION_UNKNOWN = -1 + } ternary_logic_value; + /* + * Sub-structures for struct ace_condition_token -> data, + * which vary according to the token->type. + */ + typedef [flag(NDR_NOALIGN)] struct { + int64 value; + } ace_condition_result; + + typedef [public] struct { + int64 value; + uint8 sign; + uint8 base; + } ace_condition_int; + + typedef [public] struct { + /* + * Zeroes are not allowed in the binary format (which + * is otherwise UTF-16), and if we did let them + * through we would end up with a truncated string. + */ + [flag(STR_SIZE4|STR_NOTERM|STR_BYTESIZE|STR_NO_EMBEDDED_NUL)] string value; + } ace_condition_unicode; + + typedef [public] struct { + [subcontext(4)] dom_sid sid; + } ace_condition_sid; + + /* + * The composite type has an array of sub-tokens, which can + * themselves be composites containing composites, though this + * is unlikely to be useful when dealing with claims. + * + * This structure is not representative of the wire format. + */ + typedef struct { + ace_condition_token *tokens; + uint32 n_members; + } ace_condition_composite; + + /* + * Operators have no data, but it is sometimes helpful for + * SDDL compilation messages to record the position in the + * string. + */ + typedef struct { + uint32 sddl_position; + } ace_condition_op; + + /* + * struct ace_condition_sddl_op is not as real token, but is + * used in compiling sddl. The idea is, for example, that if + * popping with a ')' doesn't match the right '(', the details + * of the '(' are there for the error message. + */ + typedef struct { + uint32 start; + uint32 position; + } ace_condition_sddl_op; + + + typedef [nodiscriminant] union { + [case(CONDITIONAL_ACE_TOKEN_SID)] ace_condition_sid sid; + [case(CONDITIONAL_ACE_TOKEN_COMPOSITE)]ace_condition_composite composite; + [case(CONDITIONAL_ACE_TOKEN_OCTET_STRING)] DATA_BLOB bytes; + [case(CONDITIONAL_ACE_TOKEN_UNICODE)]ace_condition_unicode unicode; + + [case(CONDITIONAL_ACE_LOCAL_ATTRIBUTE)]ace_condition_unicode local_attr; + [case(CONDITIONAL_ACE_USER_ATTRIBUTE)]ace_condition_unicode user_attr; + [case(CONDITIONAL_ACE_DEVICE_ATTRIBUTE)]ace_condition_unicode device_attr; + [case(CONDITIONAL_ACE_RESOURCE_ATTRIBUTE)]ace_condition_unicode resource_attr; + + [case(CONDITIONAL_ACE_TOKEN_INT64)]ace_condition_int int64; + [case(CONDITIONAL_ACE_TOKEN_INT32)]ace_condition_int int32; + [case(CONDITIONAL_ACE_TOKEN_INT16)]ace_condition_int int16; + [case(CONDITIONAL_ACE_TOKEN_INT8)]ace_condition_int int8; + [case(CONDITIONAL_ACE_SAMBA_SDDL_PAREN)]ace_condition_sddl_op sddl_op; + + [case(CONDITIONAL_ACE_SAMBA_RESULT_BOOL)]ace_condition_result result; + /* NULL and Error results are empty */ + [case(CONDITIONAL_ACE_SAMBA_RESULT_NULL)]ace_condition_result result_null; + [case(CONDITIONAL_ACE_SAMBA_RESULT_ERROR)]ace_condition_result result_error; + + /* operations */ + [case(CONDITIONAL_ACE_TOKEN_MEMBER_OF)]ace_condition_op member_of; + [case(CONDITIONAL_ACE_TOKEN_DEVICE_MEMBER_OF)]ace_condition_op device_member_of; + [case(CONDITIONAL_ACE_TOKEN_MEMBER_OF_ANY)]ace_condition_op member_of_any; + [case(CONDITIONAL_ACE_TOKEN_DEVICE_MEMBER_OF_ANY)]ace_condition_op device_member_of_any; + [case(CONDITIONAL_ACE_TOKEN_NOT_MEMBER_OF)]ace_condition_op not_member_of; + [case(CONDITIONAL_ACE_TOKEN_NOT_DEVICE_MEMBER_OF)]ace_condition_op not_device_member_of; + [case(CONDITIONAL_ACE_TOKEN_NOT_MEMBER_OF_ANY)]ace_condition_op not_member_of_any; + [case(CONDITIONAL_ACE_TOKEN_NOT_DEVICE_MEMBER_OF_ANY)]ace_condition_op not_device_member_of_any; + [case(CONDITIONAL_ACE_TOKEN_EQUAL)]ace_condition_op equal; + [case(CONDITIONAL_ACE_TOKEN_NOT_EQUAL)]ace_condition_op not_equal; + [case(CONDITIONAL_ACE_TOKEN_LESS_THAN)]ace_condition_op less_than; + [case(CONDITIONAL_ACE_TOKEN_LESS_OR_EQUAL)]ace_condition_op less_or_equal; + [case(CONDITIONAL_ACE_TOKEN_GREATER_THAN)]ace_condition_op greater_than; + [case(CONDITIONAL_ACE_TOKEN_GREATER_OR_EQUAL)]ace_condition_op greater_or_equal; + [case(CONDITIONAL_ACE_TOKEN_CONTAINS)]ace_condition_op contains; + [case(CONDITIONAL_ACE_TOKEN_ANY_OF)]ace_condition_op any_of; + [case(CONDITIONAL_ACE_TOKEN_NOT_CONTAINS)]ace_condition_op not_contains; + [case(CONDITIONAL_ACE_TOKEN_NOT_ANY_OF)]ace_condition_op not_any_of; + [case(CONDITIONAL_ACE_TOKEN_AND)]ace_condition_op and; + [case(CONDITIONAL_ACE_TOKEN_OR)]ace_condition_op or; + [case(CONDITIONAL_ACE_TOKEN_NOT)]ace_condition_op not; + [case(CONDITIONAL_ACE_TOKEN_EXISTS)]ace_condition_op exists; + [case(CONDITIONAL_ACE_TOKEN_NOT_EXISTS)]ace_condition_op not_exists; + + [default] ace_condition_op op; + } ace_condition_token_data; + + /* + * struct ace_condition_token is the fundamental building + * block of a conditional ACE expression. + */ + typedef [public] struct { + [switch_is(type)] ace_condition_token_data data; + uint32 flags; + token_type type; + } ace_condition_token; + + /* + * The expression as a whole is an just an array of tokens. + * + * But because we are always going to need a stack for + * evaluating the expression, we allocate that and keep it + * handy. + */ + typedef [public] struct { + ace_condition_token *tokens; + ace_condition_token *stack; + uint32 length; + } ace_condition_script; + + typedef enum { + ACE_CONDITION_FLAG_ALLOW_DEVICE = 0x01 + } ace_condition_flags; + + /* + * Flags for ace_condition_token.flags field. + * + * The following flags from security claims are used: + * + * CLAIM_SECURITY_ATTRIBUTE_NON_INHERITABLE = 1 + * CLAIM_SECURITY_ATTRIBUTE_VALUE_CASE_SENSITIVE = 2 + * + * CLAIM_SECURITY_ATTRIBUTE_UNIQUE_AND_SORTED = 1 << 30 + * + * The first two of these are used on the wire in + * CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 structures, while the + * latter is in an application specific range that is not + * seen on the wire. It is used to indicate that a composite + * token contains no duplicate values, which is supposed to + * be true for composite values from claims (including from + * resource attribute ACEs), but not literal composites. It's + * expensive to check, so this flag helps us avoid extra work + * can avoid doing it over and over if we remember. + * + * + * CONDITIONAL_ACE_FLAG_TOKEN_FROM_ATTR is set when a token + * value on the stack is set from an attribute lookup. + * + * This is necessary because for binary relational operators + * (MS-DTYP 2.4.4.17.6), the left-hand argument must be an + * attribute lookup, but by the time we have come to the + * operator that argument has been resolved into an ordinary + * token. So we set the flag so the operator can know. + */ + const uint32 CONDITIONAL_ACE_FLAG_TOKEN_FROM_ATTR = UINT32_C(1) << 31; + + /* + * The maximum size of the conditional ACE conditions in the + * binary form. There is an absolute limit of slightly less + * than 64k, as the security descriptor, the ACL, and the ace + * all have 16 bit length fields, and each adds some overhead. + * + * In practice, a couple of hundred bytes would do, and people + * making extremely large conditional expressions probably + * don't have good intentions. + */ + const int CONDITIONAL_ACE_MAX_LENGTH = 10000; + /* + * CONDITIONAL_ACE_MAX_TOKENS is another arbitrarily chosen + * number used to allocate token arrays and stacks. + * + * The relationship between the number of tokens and the byte + * length is variable, depending on the nature of the + * conditions. An operator token takes up one byte in the + * binary format (which CONDITIONAL_ACE_MAX_LENGTH above + * measures), an integer 10 bytes, and attributes and strings + * at least two bytes per character plus four for the length. + * SIDs are stored as struct dom_sid, around sixty-eight + * bytes, plus a four byte length field. + */ + const int CONDITIONAL_ACE_MAX_TOKENS = 2000; +} diff --git a/librpc/idl/dbgidl.idl b/librpc/idl/dbgidl.idl new file mode 100644 index 0000000..0712392 --- /dev/null +++ b/librpc/idl/dbgidl.idl @@ -0,0 +1,9 @@ +[ + uuid("1d55b526-c137-46c5-ab79-638f2a68e869"), + version(1.0), + pointer_default(unique), + helpstring("Remote IDL debugger") +] interface dbgidl +{ + void dummy_dbgidl(); +} diff --git a/librpc/idl/dcerpc.idl b/librpc/idl/dcerpc.idl new file mode 100644 index 0000000..414b896 --- /dev/null +++ b/librpc/idl/dcerpc.idl @@ -0,0 +1,662 @@ +#include "idl_types.h" + +/* + the base dcerpc packet definitions - not traditionally coded as IDL, + but given that pidl can handle it nicely it simplifies things a lot + to do it this way + + See [C706 - DCE 1.1: Remote Procedure Call] for the OpenGroup + DCERPC specification: + http://pubs.opengroup.org/onlinepubs/9629399/toc.htm + + See C706 - Chapter 12: RPC PDU Encodings for packet layouts: + http://www.opengroup.org/onlinepubs/9629399/chap12.htm + + See also [MS-RPCE] for the Microsoft + "Remote Procedure Call Protocol Extensions". + http://msdn.microsoft.com/en-us/library/cc243560.aspx + +*/ +import "misc.idl"; + +cpp_quote("extern const uint8_t DCERPC_SEC_VT_MAGIC[8];") + +[ + helper("../librpc/ndr/ndr_dcerpc.h") +] +interface dcerpc +{ + typedef struct { + uint16 context_id; + uint8 num_transfer_syntaxes; + ndr_syntax_id abstract_syntax; + ndr_syntax_id transfer_syntaxes[num_transfer_syntaxes]; + } dcerpc_ctx_list; + + typedef [public] struct { + uint16 max_xmit_frag; + uint16 max_recv_frag; + uint32 assoc_group_id; + uint8 num_contexts; + dcerpc_ctx_list ctx_list[num_contexts]; + [flag(NDR_REMAINING)] DATA_BLOB auth_info; + } dcerpc_bind; + + const uint8 DCERPC_REQUEST_LENGTH = 24; + + typedef struct { + } dcerpc_empty; + + typedef [nodiscriminant] union { + [default] GUID object; + [case(false)] dcerpc_empty empty; + } dcerpc_object; + + typedef struct { + uint32 alloc_hint; + uint16 context_id; + uint16 opnum; + /* + * NDR_DCERPC_REQUEST_OBJECT_PRESENT + * is defined differently for ndr_dcerpc.c and py_dcerpc.c + */ + [switch_is(NDR_DCERPC_REQUEST_OBJECT_PRESENT)] dcerpc_object object; + [flag(NDR_REMAINING)] DATA_BLOB stub_and_verifier; + } dcerpc_request; + + typedef [enum16bit] enum { + DCERPC_BIND_ACK_RESULT_ACCEPTANCE = 0, + DCERPC_BIND_ACK_RESULT_USER_REJECTION = 1, + DCERPC_BIND_ACK_RESULT_PROVIDER_REJECTION = 2, + DCERPC_BIND_ACK_RESULT_NEGOTIATE_ACK = 3 + } dcerpc_bind_ack_result; + + const int DCERPC_BIND_PROVIDER_REJECT = + DCERPC_BIND_ACK_RESULT_PROVIDER_REJECTION; + + typedef [enum16bit] enum { + DCERPC_BIND_ACK_REASON_NOT_SPECIFIED = 0, + DCERPC_BIND_ACK_REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED = 1, + DCERPC_BIND_ACK_REASON_TRANSFER_SYNTAXES_NOT_SUPPORTED = 2, + DCERPC_BIND_ACK_REASON_LOCAL_LIMIT_EXCEEDED = 3 + } dcerpc_bind_ack_reason_values; + + const int DCERPC_BIND_REASON_ASYNTAX = + DCERPC_BIND_ACK_REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED; + + typedef [bitmap16bit] bitmap { + DCERPC_BIND_TIME_SECURITY_CONTEXT_MULTIPLEXING = 0x0001, + DCERPC_BIND_TIME_KEEP_CONNECTION_ON_ORPHAN = 0x0002 + } dcerpc_bind_time_features; + + typedef [nodiscriminant] union { + [case(DCERPC_BIND_ACK_RESULT_NEGOTIATE_ACK)] + dcerpc_bind_time_features negotiate; + [default] dcerpc_bind_ack_reason_values value; + } dcerpc_bind_ack_reason; + + typedef struct { + dcerpc_bind_ack_result result; + [switch_is(result)] dcerpc_bind_ack_reason reason; + ndr_syntax_id syntax; + } dcerpc_ack_ctx; + + typedef struct { + uint16 max_xmit_frag; + uint16 max_recv_frag; + uint32 assoc_group_id; + [value(strlen_m_term_null(secondary_address))] uint16 secondary_address_size; + [charset(DOS)] uint8 secondary_address[secondary_address_size]; + [flag(NDR_ALIGN4)] DATA_BLOB _pad1; + uint8 num_results; + dcerpc_ack_ctx ctx_list[num_results]; + [flag(NDR_REMAINING)] DATA_BLOB auth_info; + } dcerpc_bind_ack; + + typedef [public,enum16bit] enum { + DCERPC_BIND_NAK_REASON_NOT_SPECIFIED = 0, + DCERPC_BIND_NAK_REASON_TEMPORARY_CONGESTION = 1, + DCERPC_BIND_NAK_REASON_LOCAL_LIMIT_EXCEEDED = 2, + DCERPC_BIND_NAK_REASON_PROTOCOL_VERSION_NOT_SUPPORTED = 4, + DCERPC_BIND_NAK_REASON_INVALID_AUTH_TYPE = 8, + DCERPC_BIND_NAK_REASON_INVALID_CHECKSUM = 9 + } dcerpc_bind_nak_reason; + + const int DECRPC_BIND_PROTOCOL_VERSION_NOT_SUPPORTED = + DCERPC_BIND_NAK_REASON_PROTOCOL_VERSION_NOT_SUPPORTED; + const int DCERPC_BIND_REASON_INVALID_AUTH_TYPE = + DCERPC_BIND_NAK_REASON_INVALID_AUTH_TYPE; + + typedef [public] struct { + uint8 rpc_vers; /* RPC version */ + uint8 rpc_vers_minor; /* Minor version */ + } dcerpc_bind_nak_version; + + typedef [public,nopull] struct { + dcerpc_bind_nak_reason reject_reason; + uint8 num_versions; + dcerpc_bind_nak_version versions[num_versions]; + [flag(NDR_REMAINING)] DATA_BLOB _pad; + } dcerpc_bind_nak; + + const uint8 DCERPC_RESPONSE_LENGTH = 24; + + typedef struct { + uint32 alloc_hint; + uint16 context_id; + uint8 cancel_count; + [value(0)] uint8 reserved; + [flag(NDR_REMAINING)] DATA_BLOB stub_and_verifier; + } dcerpc_response; + + typedef [v1_enum] enum { + DCERPC_NCA_S_COMM_FAILURE = 0x1C010001, + DCERPC_NCA_S_OP_RNG_ERROR = 0x1C010002, + DCERPC_NCA_S_UNKNOWN_IF = 0x1C010003, + DCERPC_NCA_S_WRONG_BOOT_TIME = 0x1C010006, + DCERPC_NCA_S_YOU_CRASHED = 0x1C010009, + DCERPC_NCA_S_PROTO_ERROR = 0x1C01000B, + DCERPC_NCA_S_OUT_ARGS_TOO_BIG = 0x1C010013, + DCERPC_NCA_S_SERVER_TOO_BUSY = 0x1C010014, + DCERPC_NCA_S_FAULT_STRING_TOO_LARGE = 0x1C010015, + DCERPC_NCA_S_UNSUPPORTED_TYPE = 0x1C010017, + DCERPC_NCA_S_FAULT_INT_DIV_BY_ZERO = 0x1C000001, + DCERPC_NCA_S_FAULT_ADDR_ERROR = 0x1C000002, + DCERPC_NCA_S_FAULT_FP_DIV_BY_ZERO = 0x1C000003, + DCERPC_NCA_S_FAULT_FP_UNDERFLOW = 0x1C000004, + DCERPC_NCA_S_FAULT_FP_OVERRFLOW = 0x1C000005, + DCERPC_NCA_S_FAULT_INVALID_TAG = 0x1C000006, + DCERPC_NCA_S_FAULT_INVALID_BOUND = 0x1C000007, + DCERPC_NCA_S_FAULT_RPC_VERSION_MISMATCH = 0x1C000008, + DCERPC_NCA_S_FAULT_UNSPEC_REJECT = 0x1C000009, + DCERPC_NCA_S_FAULT_BAD_ACTID = 0x1C00000A, + DCERPC_NCA_S_FAULT_WHO_ARE_YOU_FAILED = 0x1C00000B, + DCERPC_NCA_S_FAULT_MANAGER_NOT_ENTERED = 0x1C00000C, + DCERPC_NCA_S_FAULT_CANCEL = 0x1C00000D, + DCERPC_NCA_S_FAULT_ILL_INST = 0x1C00000E, + DCERPC_NCA_S_FAULT_FP_ERROR = 0x1C00000F, + DCERPC_NCA_S_FAULT_INT_OVERFLOW = 0x1C000010, + DCERPC_NCA_S_UNUSED_1C000011 = 0x1C000011, + DCERPC_NCA_S_FAULT_UNSPEC = 0x1C000012, + DCERPC_NCA_S_FAULT_REMOTE_COMM_FAILURE = 0x1C000013, + DCERPC_NCA_S_FAULT_PIPE_EMPTY = 0x1C000014, + DCERPC_NCA_S_FAULT_PIPE_CLOSED = 0x1C000015, + DCERPC_NCA_S_FAULT_PIPE_ORDER = 0x1C000016, + DCERPC_NCA_S_FAULT_PIPE_DISCIPLINE = 0x1C000017, + DCERPC_NCA_S_FAULT_PIPE_COMM_ERROR = 0x1C000018, + DCERPC_NCA_S_FAULT_PIPE_MEMORY = 0x1C000019, + DCERPC_NCA_S_FAULT_CONTEXT_MISMATCH = 0x1C00001A, + DCERPC_NCA_S_FAULT_REMOTE_NO_MEMORY = 0x1C00001B, + DCERPC_NCA_S_INVALID_PRES_CONTEXT_ID = 0x1C00001C, + DCERPC_NCA_S_UNSUPPORTED_AUTHN_LEVEL = 0x1C00001D, + DCERPC_NCA_S_UNUSED_1C00001E = 0x1C00001E, + DCERPC_NCA_S_INVALID_CHECKSUM = 0x1C00001F, + DCERPC_NCA_S_INVALID_CRC = 0x1C000020, + DCERPC_NCA_S_FAULT_USER_DEFINED = 0x1C000021, + DCERPC_NCA_S_FAULT_TX_OPEN_FAILED = 0x1C000022, + DCERPC_NCA_S_FAULT_CODESET_CONV_ERROR = 0x1C000023, + DCERPC_NCA_S_FAULT_OBJECT_NOT_FOUND = 0x1C000024, + DCERPC_NCA_S_FAULT_NO_CLIENT_STUB = 0x1C000025, + DCERPC_FAULT_ACCESS_DENIED = 0x00000005, + DCERPC_FAULT_SERVER_UNAVAILABLE = 0x000006ba, + DCERPC_FAULT_NO_CALL_ACTIVE = 0x000006bd, + DCERPC_FAULT_CANT_PERFORM = 0x000006d8, + DCERPC_FAULT_OUT_OF_RESOURCES = 0x000006d9, + DCERPC_FAULT_BAD_STUB_DATA = 0x000006f7, + DCERPC_FAULT_SEC_PKG_ERROR = 0x00000721 + } dcerpc_nca_status; + + const int DCERPC_FAULT_OP_RNG_ERROR = DCERPC_NCA_S_OP_RNG_ERROR; + const int DCERPC_FAULT_NDR = DCERPC_FAULT_BAD_STUB_DATA; + const int DCERPC_FAULT_INVALID_TAG = DCERPC_NCA_S_FAULT_INVALID_TAG; + const int DCERPC_FAULT_CONTEXT_MISMATCH = DCERPC_NCA_S_FAULT_CONTEXT_MISMATCH; + const int DCERPC_FAULT_OTHER = 0x00000001; + + /* we return this fault when we haven't yet run the test + to see what fault w2k3 returns in this case */ + const int DCERPC_FAULT_TODO = 0x00000042; + + typedef [bitmap8bit] bitmap { + DCERPC_FAULT_FLAG_EXTENDED_ERROR_INFORMATION = 0x01 + } dcerpc_fault_flags; + + typedef struct { + uint32 alloc_hint; + uint16 context_id; + uint8 cancel_count; + dcerpc_fault_flags flags; + dcerpc_nca_status status; + [value(0)] uint32 reserved; + [flag(NDR_REMAINING)] DATA_BLOB error_and_verifier; + } dcerpc_fault; + + const uint8 DCERPC_FAULT_LENGTH = 32; + + /* the auth types we know about */ + typedef [enum8bit] enum { + DCERPC_AUTH_TYPE_NONE = 0, + /* this seems to be not krb5! */ + DCERPC_AUTH_TYPE_KRB5_1 = 1, + DCERPC_AUTH_TYPE_SPNEGO = 9, + DCERPC_AUTH_TYPE_NTLMSSP = 10, + DCERPC_AUTH_TYPE_KRB5 = 16, + DCERPC_AUTH_TYPE_DPA = 17, + DCERPC_AUTH_TYPE_MSN = 18, + DCERPC_AUTH_TYPE_DIGEST = 21, + DCERPC_AUTH_TYPE_SCHANNEL = 68, + DCERPC_AUTH_TYPE_MSMQ = 100, + DCERPC_AUTH_TYPE_NCALRPC_AS_SYSTEM = 200 + } dcerpc_AuthType; + const char *AS_SYSTEM_MAGIC_PATH_TOKEN = "/root/ncalrpc_as_system"; + + typedef [enum8bit] enum { + DCERPC_AUTH_LEVEL_NONE = 1, + DCERPC_AUTH_LEVEL_CONNECT = 2, + DCERPC_AUTH_LEVEL_CALL = 3, + DCERPC_AUTH_LEVEL_PACKET = 4, + DCERPC_AUTH_LEVEL_INTEGRITY = 5, + DCERPC_AUTH_LEVEL_PRIVACY = 6 + } dcerpc_AuthLevel; + + typedef [public] struct { + dcerpc_AuthType auth_type; + dcerpc_AuthLevel auth_level; + uint8 auth_pad_length; + uint8 auth_reserved; + uint32 auth_context_id; + [flag(NDR_REMAINING)] DATA_BLOB credentials; + } dcerpc_auth; + + const uint8 DCERPC_AUTH_TRAILER_LENGTH = 8; + const uint8 DCERPC_AUTH_PAD_ALIGNMENT = 16; + + typedef [public] struct { + [value(0)] uint32 _pad; + [flag(NDR_REMAINING)] DATA_BLOB auth_info; + } dcerpc_auth3; + + typedef [public] struct { + [flag(NDR_REMAINING)] DATA_BLOB auth_info; + } dcerpc_orphaned; + + typedef [public] struct { + [flag(NDR_REMAINING)] DATA_BLOB auth_info; + } dcerpc_co_cancel; + + typedef [public] struct { + uint32 version; + uint32 id; + } dcerpc_cl_cancel; + + typedef [public] struct { + uint32 version; + uint32 id; + boolean32 server_is_accepting; + } dcerpc_cancel_ack; + + typedef [public] struct { + uint32 version; + uint8 _pad1; + uint16 window_size; + uint32 max_tdsu; + uint32 max_frag_size; + uint16 serial_no; + uint16 selack_size; + uint32 selack[selack_size]; + } dcerpc_fack; + + typedef [public] struct { + } dcerpc_ack; + + typedef [public] struct { + } dcerpc_ping; + + typedef [public] struct { + } dcerpc_shutdown; + + typedef [public] struct { + } dcerpc_working; + + /* RTS data structures */ + typedef [public] struct { + GUID Cookie; + } RTSCookie; + + typedef [v1_enum,public] enum { + RTS_IPV4 = 0, + RTS_IPV6 = 1 + } AddressType; + + typedef [nodiscriminant] union { + [case(RTS_IPV4)] ipv4address ClientAddressIPV4; + [case(RTS_IPV6)] ipv6address ClientAddressIPV6; + } ClientAddressType; + + typedef [public] struct { + AddressType AddressType; + [switch_is(AddressType)] ClientAddressType ClientAddress; + uint8 Padding[12]; + } ClientAddress; + + typedef [v1_enum, public] enum { + FDClient = 0, + FDInProxy = 1, + FDServer = 2, + FDOutProxy = 3 + } ForwardDestination; + + typedef [public] struct { + uint32 BytesReceived; + uint32 AvailableWindow; + RTSCookie ChannelCookie; + } FlowControlAcknowledgment; + + /* RTS commands */ + + /* RTS command: 0x0 */ + typedef [public] struct { + [range(0x2000,0x40000)] uint32 ReceiveWindowSize; + } dcerpc_rts_cmd_ReceiveWindowSize; + + /* RTS command: 0x1 */ + typedef [public] struct { + FlowControlAcknowledgment Ack; + } dcerpc_rts_cmd_FlowControlAck; + + /* RTS command: 0x2 */ + typedef [public] struct { + [range(0x1D4C0,0xDBBA00)] uint32 ConnectionTimeout; + } dcerpc_rts_cmd_ConnectionTimeout; + + /* RTS command: 0x3 */ + typedef [public] struct { + RTSCookie Cookie; + } dcerpc_rts_cmd_Cookie; + + /* RTS command: 0x4 */ + typedef [public] struct { + [range(0x20000,0x80000000)] uint32 ChannelLifetime; + } dcerpc_rts_cmd_ChannelLifetime; + + /* RTS command: 0x5 */ + typedef [public] struct { + uint32 ClientKeepalive; + } dcerpc_rts_cmd_ClientKeepalive; + + /* RTS command: 0x6 */ + typedef [public] struct { + uint32 Version; + } dcerpc_rts_cmd_Version; + + /* RTS command: 0x7 */ + typedef [public] struct { + } dcerpc_rts_cmd_Empty; + + /* RTS command: 0x8 */ + typedef [public] struct { + [range(0x0,0xFFFF)] uint32 ConformanceCount; + uint8 Padding[ConformanceCount]; + } dcerpc_rts_cmd_Padding; + + /* RTS command: 0x9 */ + typedef [public] struct { + } dcerpc_rts_cmd_NegativeANCE; + + /* RTS Command: 0xA */ + typedef [public] struct { + } dcerpc_rts_cmd_ANCE; + + /* RTS command: 0xB */ + typedef [public] struct { + ClientAddress ClientAddress; + } dcerpc_rts_cmd_ClientAddress; + + /* RTS command: 0xC */ + typedef [public] struct { + RTSCookie AssociationGroupId; + } dcerpc_rts_cmd_AssociationGroupId; + + /* RTS command: 0xD */ + typedef [public] struct { + ForwardDestination ForwardDestination; + } dcerpc_rts_cmd_Destination; + + /* RTS command: 0xE */ + typedef [public] struct { + uint32 PingTrafficSent; + } dcerpc_rts_cmd_PingTrafficSentNotify; + + typedef [nodiscriminant] union { + [case(0x0)] dcerpc_rts_cmd_ReceiveWindowSize ReceiveWindowSize; + [case(0x1)] dcerpc_rts_cmd_FlowControlAck FlowControlAck; + [case(0x2)] dcerpc_rts_cmd_ConnectionTimeout ConnectionTimeout; + [case(0x3)] dcerpc_rts_cmd_Cookie Cookie; + [case(0x4)] dcerpc_rts_cmd_ChannelLifetime ChannelLifetime; + [case(0x5)] dcerpc_rts_cmd_ClientKeepalive ClientKeepalive; + [case(0x6)] dcerpc_rts_cmd_Version Version; + [case(0x7)] dcerpc_rts_cmd_Empty Empty; + [case(0x8)] dcerpc_rts_cmd_Padding Padding; + [case(0x9)] dcerpc_rts_cmd_NegativeANCE NegativeANCE; + [case(0xA)] dcerpc_rts_cmd_ANCE ANCE; + [case(0xB)] dcerpc_rts_cmd_ClientAddress ClientAddress; + [case(0xC)] dcerpc_rts_cmd_AssociationGroupId AssociationGroupId; + [case(0xD)] dcerpc_rts_cmd_Destination Destination; + [case(0xE)] dcerpc_rts_cmd_PingTrafficSentNotify PingTrafficSentNotify; + } dcerpc_rts_cmds; + + typedef [public] struct { + uint32 CommandType; + [switch_is(CommandType)] dcerpc_rts_cmds Command; + } dcerpc_rts_cmd; + + /* The RTS flags */ + typedef [public, bitmap16bit] bitmap { + RTS_FLAG_NONE = 0x0000, + RTS_FLAG_PING = 0x0001, + RTS_FLAG_OTHER_CMD = 0x0002, + RTS_FLAG_RECYCLE_CHANNEL = 0x0004, + RTS_FLAG_IN_CHANNEL = 0x0008, + RTS_FLAG_OUT_CHANNEL = 0x0010, + RTS_FLAG_EOF = 0x0020, + RTS_FLAG_ECHO = 0x0040 + } dcerpc_rts_flags; + + typedef [public] struct { + dcerpc_rts_flags Flags; + uint16 NumberOfCommands; + dcerpc_rts_cmd Commands[NumberOfCommands]; + } dcerpc_rts; + + typedef [public,enum8bit] enum { + DCERPC_PKT_REQUEST = 0, /* Ordinary request. */ + DCERPC_PKT_PING = 1, /* Connectionless is server alive ? */ + DCERPC_PKT_RESPONSE = 2, /* Ordinary reply. */ + DCERPC_PKT_FAULT = 3, /* Fault in processing of call. */ + DCERPC_PKT_WORKING = 4, /* Connectionless reply to a ping when server busy. */ + DCERPC_PKT_NOCALL = 5, /* Connectionless reply to a ping when server has lost part of clients call. */ + DCERPC_PKT_REJECT = 6, /* Refuse a request with a code. */ + DCERPC_PKT_ACK = 7, /* Connectionless client to server code. */ + DCERPC_PKT_CL_CANCEL = 8, /* Connectionless cancel. */ + DCERPC_PKT_FACK = 9, /* Connectionless fragment ack. Both client and server send. */ + DCERPC_PKT_CANCEL_ACK = 10, /* Server ACK to client cancel request. */ + DCERPC_PKT_BIND = 11, /* Bind to interface. */ + DCERPC_PKT_BIND_ACK = 12, /* Server ack of bind. */ + DCERPC_PKT_BIND_NAK = 13, /* Server nack of bind. */ + DCERPC_PKT_ALTER = 14, /* Alter auth. */ + DCERPC_PKT_ALTER_RESP = 15, /* Reply to alter auth. */ + DCERPC_PKT_AUTH3 = 16, /* not the real name! this is undocumented! */ + DCERPC_PKT_SHUTDOWN = 17, /* Server to client request to shutdown. */ + DCERPC_PKT_CO_CANCEL = 18, /* Connection-oriented cancel request. */ + DCERPC_PKT_ORPHANED = 19, /* Client telling server it's aborting a partially sent request or telling server to stop sending replies. */ + DCERPC_PKT_RTS = 20 /* RTS packets used in ncacn_http */ + } dcerpc_pkt_type; + + typedef [public,nodiscriminant] union { + [case(DCERPC_PKT_REQUEST)] dcerpc_request request; + [case(DCERPC_PKT_PING)] dcerpc_ping ping; + [case(DCERPC_PKT_RESPONSE)] dcerpc_response response; + [case(DCERPC_PKT_FAULT)] dcerpc_fault fault; + [case(DCERPC_PKT_WORKING)] dcerpc_working working; + [case(DCERPC_PKT_NOCALL)] dcerpc_fack nocall; + [case(DCERPC_PKT_REJECT)] dcerpc_fault reject; + [case(DCERPC_PKT_ACK)] dcerpc_ack ack; + [case(DCERPC_PKT_CL_CANCEL)] dcerpc_cl_cancel cl_cancel; + [case(DCERPC_PKT_FACK)] dcerpc_fack fack; + [case(DCERPC_PKT_CANCEL_ACK)] dcerpc_cancel_ack cancel_ack; + [case(DCERPC_PKT_BIND)] dcerpc_bind bind; + [case(DCERPC_PKT_BIND_ACK)] dcerpc_bind_ack bind_ack; + [case(DCERPC_PKT_BIND_NAK)] dcerpc_bind_nak bind_nak; + [case(DCERPC_PKT_ALTER)] dcerpc_bind alter; + [case(DCERPC_PKT_ALTER_RESP)] dcerpc_bind_ack alter_resp; + [case(DCERPC_PKT_SHUTDOWN)] dcerpc_shutdown shutdown; + [case(DCERPC_PKT_CO_CANCEL)] dcerpc_co_cancel co_cancel; + [case(DCERPC_PKT_ORPHANED)] dcerpc_orphaned orphaned; + [case(DCERPC_PKT_AUTH3)] dcerpc_auth3 auth3; + [case(DCERPC_PKT_RTS)] dcerpc_rts rts; + } dcerpc_payload; + + /* pfc_flags values */ + typedef [public,bitmap8bit] bitmap { + DCERPC_PFC_FLAG_FIRST = 0x01, /* First fragment */ + DCERPC_PFC_FLAG_LAST = 0x02, /* Last fragment */ + DCERPC_PFC_FLAG_PENDING_CANCEL_OR_HDR_SIGNING = 0x04, /* depends on the pdu type */ + DCERPC_PFC_FLAG_CONC_MPX = 0x10, /* supports concurrent multiplexing of a single connection. */ + DCERPC_PFC_FLAG_DID_NOT_EXECUTE = 0x20, /* on a fault it means the server hasn't done anything */ + DCERPC_PFC_FLAG_MAYBE = 0x40, /* `maybe' call semantics requested */ + DCERPC_PFC_FLAG_OBJECT_UUID = 0x80 /* on valid guid is in the optional object field */ + } dcerpc_pfc_flags; + + /* Cancel was pending at sender */ + const int DCERPC_PFC_FLAG_PENDING_CANCEL = + DCERPC_PFC_FLAG_PENDING_CANCEL_OR_HDR_SIGNING; + const int DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN = + DCERPC_PFC_FLAG_PENDING_CANCEL_OR_HDR_SIGNING; + + /* these offsets are needed by the signing code */ + const uint8 DCERPC_PFC_OFFSET = 3; + const uint8 DCERPC_DREP_OFFSET = 4; + const uint8 DCERPC_FRAG_LEN_OFFSET = 8; + const uint32 DCERPC_FRAG_MAX_SIZE = 5840; + const uint8 DCERPC_AUTH_LEN_OFFSET = 10; + const uint8 DCERPC_NCACN_PAYLOAD_OFFSET = 16; + + /* + * See [MS-RPCE] 3.3.3.5.4 Maximum Server Input Data Size + * 4 MByte is the default limit of reassembled request payload + */ + const uint32 DCERPC_NCACN_REQUEST_DEFAULT_MAX_SIZE = 0x400000; + + /* + * See [MS-RPCE] 3.3.2.5.2 Handling Responses + * + * Indicates that Windows accepts up to 0x7FFFFFFF ~2 GByte + * + * talloc has a limit of 256 MByte, so we need to use something smaller. + * + * For now we try our luck with 240 MByte. + */ + const uint32 DCERPC_NCACN_RESPONSE_DEFAULT_MAX_SIZE = 0xf000000; /* 240 MByte */ + + /* little-endian flag */ + const uint8 DCERPC_DREP_LE = 0x10; + + typedef [public,nopush,nopull,noprint] struct { + uint8 rpc_vers; /* RPC version */ + uint8 rpc_vers_minor; /* Minor version */ + dcerpc_pkt_type ptype; /* Packet type */ + dcerpc_pfc_flags pfc_flags; /* Fragmentation flags */ + uint8 drep[4]; /* NDR data representation */ + uint16 frag_length; /* Total length of fragment */ + uint16 auth_length; /* authenticator length */ + uint32 call_id; /* Call identifier */ + [switch_is(ptype)] dcerpc_payload u; + } ncacn_packet; + + typedef [public] struct { + uint8 rpc_vers; /* RPC version (4) */ + uint8 ptype; + uint8 pfc_flags; + uint8 ncadg_flags; + uint8 drep[3]; + uint8 serial_high; + GUID object; + GUID iface; + GUID activity; + uint32 server_boot; /* Server boot time */ + uint32 iface_version; + uint32 seq_num; + uint16 opnum; + uint16 ihint; + uint16 ahint; + uint16 len; + uint16 fragnum; + uint8 auth_proto; + uint8 serial_low; + [switch_is(ptype)] dcerpc_payload u; + } ncadg_packet; + + typedef [bitmap16bit] bitmap { + DCERPC_SEC_VT_COMMAND_ENUM = 0x3FFF, + DCERPC_SEC_VT_COMMAND_END = 0x4000, + DCERPC_SEC_VT_MUST_PROCESS = 0x8000 + } dcerpc_sec_vt_command; + + typedef [enum16bit] enum { + DCERPC_SEC_VT_COMMAND_BITMASK1 = 0x0001, + DCERPC_SEC_VT_COMMAND_PCONTEXT = 0x0002, + DCERPC_SEC_VT_COMMAND_HEADER2 = 0x0003 + } dcerpc_sec_vt_command_enum; + + typedef [bitmap32bit] bitmap { + DCERPC_SEC_VT_CLIENT_SUPPORTS_HEADER_SIGNING = 0x00000001 + } dcerpc_sec_vt_bitmask1; + + typedef struct { + ndr_syntax_id abstract_syntax; + ndr_syntax_id transfer_syntax; + } dcerpc_sec_vt_pcontext; + + typedef struct { + dcerpc_pkt_type ptype; /* Packet type */ + [value(0)] uint8 reserved1; + [value(0)] uint16 reserved2; + uint8 drep[4]; /* NDR data representation */ + uint32 call_id; /* Call identifier */ + uint16 context_id; + uint16 opnum; + } dcerpc_sec_vt_header2; + + typedef [switch_type(dcerpc_sec_vt_command_enum),nodiscriminant] union { + [case(DCERPC_SEC_VT_COMMAND_BITMASK1)] dcerpc_sec_vt_bitmask1 bitmask1; + [case(DCERPC_SEC_VT_COMMAND_PCONTEXT)] dcerpc_sec_vt_pcontext pcontext; + [case(DCERPC_SEC_VT_COMMAND_HEADER2)] dcerpc_sec_vt_header2 header2; + [default,flag(NDR_REMAINING)] DATA_BLOB _unknown; + } dcerpc_sec_vt_union; + + typedef struct { + dcerpc_sec_vt_command command; + [switch_is(command & DCERPC_SEC_VT_COMMAND_ENUM)] + [subcontext(2),flag(NDR_SUBCONTEXT_NO_UNREAD_BYTES)] + dcerpc_sec_vt_union u; + } dcerpc_sec_vt; + + typedef [public,nopush,nopull] struct { + uint16 count; + } dcerpc_sec_vt_count; + + /* + * We assume that the whole verification trailer fits into + * the last 1024 bytes after the stub data. + * + * There're currently only 3 commands defined and each should + * only be used once. + */ + const uint16 DCERPC_SEC_VT_MAX_SIZE = 1024; + + typedef [public,flag(NDR_PAHEX)] struct { + [flag(NDR_ALIGN4)] DATA_BLOB _pad; + [value(DCERPC_SEC_VT_MAGIC)] uint8 magic[8]; + dcerpc_sec_vt_count count; + dcerpc_sec_vt commands[count.count]; + } dcerpc_sec_verification_trailer; +} diff --git a/librpc/idl/dcom.idl b/librpc/idl/dcom.idl new file mode 100644 index 0000000..5559811 --- /dev/null +++ b/librpc/idl/dcom.idl @@ -0,0 +1,314 @@ +/** + DCOM interfaces + http://www.ietf.org/internet-drafts/draft-brown-dcom-v1-spec-04.txt + */ + +import "misc.idl"; + +[ + uuid("18f70770-8e64-11cf-9af1-0020af6e72f4"), + pointer_default(unique), + version(0.0) +] interface dcom_Unknown +{ + void UseProtSeq(); + void GetCustomProtseqInfo(); + void UpdateResolverBindings(); +} + +[ + object, + uuid("00000000-0000-0000-C000-000000000046"), + pointer_default(unique), + helpstring("Base interface for all COM interfaces") +] +interface IUnknown +{ + /*****************/ + /* Function 0x00 */ + /* Returns the interface with the specified IID + if implemented by this object */ + [local] WERROR QueryInterface( + [in,unique] GUID *iid, + [out,iid_is(riid)] IUnknown **data + ); + + /*****************/ + /* Function 0x01 */ + [local] uint32 AddRef(); + + /*****************/ + /* Function 0x02 */ + [local] uint32 Release(); +} + + +[ + object, + uuid("00000001-0000-0000-C000-000000000046"), + pointer_default(unique) +] interface IClassFactory : IUnknown +{ + [local] WERROR CreateInstance( + [in,unique] MInterfacePointer *pUnknown, + [in,unique] GUID *iid, + [out, iid_is(riid),unique] MInterfacePointer **ppv + ); + + [call_as(CreateInstance)] WERROR RemoteCreateInstance(); + + /* Set lock to TRUE when you want to do a lock + and set it to FALSE when you want to unlock */ + [local] WERROR LockServer( + [in] uint8 lock + ); + + [call_as(LockServer)] WERROR RemoteLockServer(); +} + +/* The remote version of IUnknown. This interface exists on every */ +/* OXID (whether an OXID represents either a thread or a process is */ +/* implementation specific). It is used by clients to query for new */ +/* interfaces, get additional references (for marshaling), and release */ +/* outstanding references. */ +/* This interface is passed along during OXID resolution. */ +/* */ +[ + uuid("00000131-0000-0000-C000-000000000046"), + object, + pointer_default(unique), + helpstring("Remote version of IUnknown") +] +interface IRemUnknown : IUnknown +{ + typedef [public] struct + { + WERROR hResult; /* result of call */ + STDOBJREF std; /* data for returned interface */ + } + REMQIRESULT; + + [call_as(QueryInterface)] WERROR RemQueryInterface ( + [in,unique] GUID *ripid, /* interface to QI on */ + [in] uint32 cRefs, /* count of AddRefs requested */ + [in] uint16 cIids, /* count of IIDs that follow */ + [in, unique, size_is(cIids)] GUID *iids, /* IIDs to QI for */ + [out, size_is(cIids), unique] MInterfacePointer *ip + ); + + typedef struct + { + GUID ipid; /* ipid to AddRef/Release */ + uint32 cPublicRefs; + uint32 cPrivateRefs; + } REMINTERFACEREF; + + [call_as(AddRef)] WERROR RemAddRef ( + [in] uint16 cInterfaceRefs, + [in, size_is(cInterfaceRefs)] REMINTERFACEREF InterfaceRefs[], + [out, size_is(cInterfaceRefs), unique] WERROR *pResults + ); + + [call_as(Release)] WERROR RemRelease ( + [in] uint16 cInterfaceRefs, + [in, size_is(cInterfaceRefs)] REMINTERFACEREF InterfaceRefs[] + ); +} + +[ + uuid("00000140-0000-0000-c000-000000000046"), + object +] interface IClassActivator : IUnknown +{ + void GetClassObject( + [in] GUID clsid, + [in] uint32 context, + [in] uint32 locale, + [in] GUID iid, + [out, iid_is(iid)] MInterfacePointer *data + ); +} + +[ + uuid("00000136-0000-0000-c000-000000000046"), + pointer_default(unique), + object +] interface ISCMLocalActivator : IClassActivator +{ + WERROR ISCMLocalActivator_CreateInstance( ); +} + +[ + pointer_default(unique), + uuid("c6f3ee72-ce7e-11d1-b71e-00c04fc3111a") +] interface IMachineLocalActivator +{ + WERROR IMachineLocalActivator_foo(); +} + +[ + pointer_default(unique), + uuid("e60c73e6-88f9-11cf-9af1-0020af6e72f4") +] interface ILocalObjectExporter +{ + WERROR ILocalObjectExporter_Foo(); +} + +/* Looks like this is the equivalent of .NET's + System.Activator class */ +[ + uuid("000001a0-0000-0000-c000-000000000046"), + object +] + interface ISystemActivator : IClassActivator +{ + WERROR ISystemActivatorRemoteCreateInstance( + [in] hyper unknown1, /* OXID ? */ + [in] MInterfacePointer iface1, + [in] hyper unknown2, + [out] uint32 *unknown3, + [out] MInterfacePointer *iface2 + ); +} + + + +/* Derived from IRemUnknown, this interface supports Remote Query interface */ +/* for objects that supply additional data beyond the STDOBJREF in their */ +/* marshaled interface packets. */ +[ + object, + pointer_default(unique), + uuid("00000143-0000-0000-C000-000000000046") +] + +interface IRemUnknown2 : IRemUnknown +{ + [call_as(QueryInterface2)] WERROR RemQueryInterface2 ( + [in, unique] GUID *ripid, + [in] uint16 cIids, + [in, size_is(cIids), unique] GUID *iids, + [out, size_is(cIids), unique] WERROR *phr, + [out, size_is(cIids), unique] MInterfacePointer *ppMIF + ); +} + +[ + object, + pointer_default(unique), + uuid("00020400-0000-0000-C000-000000000046") +] interface IDispatch : IUnknown +{ + /*****************/ + /* Function 0x03 */ + WERROR GetTypeInfoCount( + [out, unique] uint16 *pctinfo + ); + + typedef struct { + } REF_ITypeInfo; + + /*****************/ + /* Function 0x04 */ + WERROR GetTypeInfo ( + [in] uint16 iTInfo, + [in] uint32 lcid, + [out, unique] REF_ITypeInfo *ppTInfo + ); + + /*****************/ + /* Function 0x05 */ + WERROR GetIDsOfNames( + [in, unique] GUID *riid, + /*FIXME[in,size_is(cNames)] OLESTR *rgszNames[], */ + [in] uint16 cNames, + [in] uint32 lcid, + [out,size_is(cNames), unique] uint32 *rgDispId + ); + + typedef struct { + uint16 vartype; + uint16 FIXME; + } VARIANT; + + typedef struct { + uint16 FIXME; + } DISPPARAMS; + + /* Exception ? */ + typedef struct { + uint16 FIXME; + } EXCEPINFO; + + /*****************/ + /* Function 0x06 */ + WERROR Invoke( + [in] uint32 dispIdMember, + [in, unique] GUID *riid, + [in] uint32 lcid, + [in] uint16 wFlags, + [out,in, unique] DISPPARAMS *pDispParams, + [out, unique] VARIANT *pVarResult, + [out, unique] EXCEPINFO *pExcepInfo, + [out, unique] uint16 *puArgErr + ); +} + +[ + object, + local, + uuid("00000003-0000-0000-C000-000000000046") +] interface IMarshal : IUnknown +{ + WERROR MarshalInterface(); + WERROR UnMarshalInterface(); +} + +[ + uuid("DA23F6DB-6F45-466C-9EED-0B65286F2D78"), + helpstring("ICoffeeMachine Interface"), + pointer_default(unique), + object +] interface ICoffeeMachine : IUnknown +{ + WERROR MakeCoffee([in,string,charset(UTF16)] uint16 *flavor); +} + +[ + uuid("db7c21f8-fe33-4c11-aea5-ceb56f076fbb"), + helpstring("coffeemachine class") +] coclass coffeemachine +{ + interface icoffeemachine; +} + +[ + object, + uuid("0000000C-0000-0000-C000-000000000046"), + helpstring("Stream") +] +interface IStream : IUnknown +{ + WERROR Read( + [out, size_is(num_requested), length_is(*num_read)] uint8 pv[], + [in] uint32 num_requested, + [in, unique] uint32 *num_readx, + [out] uint32 *num_read + ); + + WERROR Write( + [in,size_is(num_requested),unique] uint8 *data, + [in] uint32 num_requested, + [out] uint32 *num_written + ); +} + +[ + uuid("5e9ddec7-5767-11cf-beab-00aa006c3606"), + progid("Samba.Simple"), + helpstring("simple class"), + internal +] coclass simple +{ + interface IStream; +} diff --git a/librpc/idl/dfs.idl b/librpc/idl/dfs.idl new file mode 100644 index 0000000..1b145f3 --- /dev/null +++ b/librpc/idl/dfs.idl @@ -0,0 +1,419 @@ +/* + dfs interface definition +*/ + +import "misc.idl"; + +[ uuid("4fc742e0-4a10-11cf-8273-00aa004ae673"), + version(3.0), + pointer_default(unique), + helpstring("Settings for Microsoft Distributed File System"), + endpoint("ncacn_np:[\\pipe\\netdfs]", "ncacn_ip_tcp:", "ncalrpc:") +] interface netdfs +{ + /******************/ + /* Function: 0x00 */ + typedef [v1_enum] enum { + DFS_MANAGER_VERSION_NT4 = 1, + DFS_MANAGER_VERSION_W2K = 2, + DFS_MANAGER_VERSION_W2K3 = 4, + DFS_MANAGER_VERSION_W2K8 = 6 + } dfs_ManagerVersion; + + [public] void dfs_GetManagerVersion( + [out] dfs_ManagerVersion *version + ); + + + /******************/ + /* Function: 0x01 */ + WERROR dfs_Add ( + [in] [string,charset(UTF16)] uint16 *path, + [in] [string,charset(UTF16)] uint16 *server, + [in,unique] [string,charset(UTF16)] uint16 *share, + [in,unique] [string,charset(UTF16)] uint16 *comment, + [in] uint32 flags + ); + + /******************/ + /* Function: 0x02 */ + WERROR dfs_Remove ( + [in] [string,charset(UTF16)] uint16 *dfs_entry_path, + [in,unique] [string,charset(UTF16)] uint16 *servername, + [in,unique] [string,charset(UTF16)] uint16 *sharename + ); + + /******************/ + /* Function: 0x03 */ + + typedef struct { + } dfs_Info0; + + typedef struct { + [string,charset(UTF16)] uint16 *path; + } dfs_Info1; + + typedef [public,bitmap32bit] bitmap { + DFS_VOLUME_STATE_OK = 0x1, + DFS_VOLUME_STATE_INCONSISTENT = 0x2, + DFS_VOLUME_STATE_OFFLINE = 0x3, + DFS_VOLUME_STATE_ONLINE = 0x4, + DFS_VOLUME_STATE_STANDALONE = DFS_VOLUME_FLAVOR_STANDALONE, + DFS_VOLUME_STATE_AD_BLOB = DFS_VOLUME_FLAVOR_AD_BLOB + } dfs_VolumeState; + + typedef struct { + [string,charset(UTF16)] uint16 *path; + [string,charset(UTF16)] uint16 *comment; + dfs_VolumeState state; + uint32 num_stores; + } dfs_Info2; + + const int DFS_STORAGE_STATES = 0xf; + + /* yes, this is a bitmap */ + typedef [public,bitmap32bit] bitmap { + DFS_STORAGE_STATE_OFFLINE = 1, + DFS_STORAGE_STATE_ONLINE = 2, + DFS_STORAGE_STATE_ACTIVE = 4 + } dfs_StorageState; + + typedef struct { + dfs_StorageState state; + [string,charset(UTF16)] uint16 *server; + [string,charset(UTF16)] uint16 *share; + } dfs_StorageInfo; + + typedef struct { + [string,charset(UTF16)] uint16 *path; + [string,charset(UTF16)] uint16 *comment; + dfs_VolumeState state; + uint32 num_stores; + [size_is(num_stores)] dfs_StorageInfo *stores; + } dfs_Info3; + + typedef struct { + [string,charset(UTF16)] uint16 *path; + [string,charset(UTF16)] uint16 *comment; + dfs_VolumeState state; + uint32 timeout; + GUID guid; + uint32 num_stores; + [size_is(num_stores)] dfs_StorageInfo *stores; + } dfs_Info4; + + /* verified with dfsutil */ + typedef [public,bitmap32bit] bitmap { + DFS_PROPERTY_FLAG_INSITE_REFERRALS = 0x01, + DFS_PROPERTY_FLAG_ROOT_SCALABILITY = 0x02, + DFS_PROPERTY_FLAG_SITE_COSTING = 0x04, + DFS_PROPERTY_FLAG_TARGET_FAILBACK = 0x08, + DFS_PROPERTY_FLAG_CLUSTER_ENABLED = 0x10 /* untested */ + } dfs_PropertyFlags; + + typedef struct { + [string,charset(UTF16)] uint16 *path; + [string,charset(UTF16)] uint16 *comment; + dfs_VolumeState state; + uint32 timeout; + GUID guid; + dfs_PropertyFlags flags; + uint32 pktsize; + uint32 num_stores; + } dfs_Info5; + + typedef [v1_enum] enum { + DFS_INVALID_PRIORITY_CLASS = -1, + DFS_SITE_COST_NORMAL_PRIORITY_CLASS = 0, + DFS_GLOBAL_HIGH_PRIORITY_CLASS = 1, + DFS_SITE_COST_HIGH_PRIORITY_CLASS = 2, + DFS_SITE_COST_LOW_PRIORITY_CLASS = 3, + DFS_GLOBAL_LOW_PRIORITY_CLASS = 4 + } dfs_Target_PriorityClass; + + typedef struct { + dfs_Target_PriorityClass target_priority_class; + uint16 target_priority_rank; + uint16 reserved; + } dfs_Target_Priority; + + typedef struct { + dfs_StorageInfo info; + dfs_Target_Priority target_priority; + } dfs_StorageInfo2; + + typedef struct { + [string,charset(UTF16)] uint16 *entry_path; + [string,charset(UTF16)] uint16 *comment; + dfs_VolumeState state; + uint32 timeout; + GUID guid; + dfs_PropertyFlags flags; + uint32 pktsize; + uint16 num_stores; + [size_is(num_stores)] dfs_StorageInfo2 *stores; + } dfs_Info6; + + typedef struct { + GUID generation_guid; + } dfs_Info7; + + typedef struct { + [string,charset(UTF16)] uint16 *comment; + } dfs_Info100; + + typedef struct { + dfs_StorageState state; + } dfs_Info101; + + typedef struct { + uint32 timeout; + } dfs_Info102; + + typedef struct { + dfs_PropertyFlags flags; + } dfs_Info103; + + typedef struct { + dfs_Target_Priority priority; + } dfs_Info104; + + typedef struct { + [string,charset(UTF16)] uint16 *comment; + dfs_VolumeState state; + uint32 timeout; + uint32 property_flag_mask; + uint32 property_flags; + } dfs_Info105; + + typedef struct { + dfs_StorageState state; + dfs_Target_Priority priority; + } dfs_Info106; + + typedef struct { + [string,charset(UTF16)] uint16 *dom_root; + } dfs_Info200; + + typedef enum { + DFS_VOLUME_FLAVOR_STANDALONE = 0x100, + DFS_VOLUME_FLAVOR_AD_BLOB = 0x200 + } dfs_VolumeFlavor; + + typedef struct { + dfs_VolumeFlavor flavor; + [string,charset(UTF16)] uint16 *dom_root; + } dfs_Info300; + + typedef union { + [case(0)] dfs_Info0 *info0; + [case(1)] dfs_Info1 *info1; + [case(2)] dfs_Info2 *info2; + [case(3)] dfs_Info3 *info3; + [case(4)] dfs_Info4 *info4; + [case(5)] dfs_Info5 *info5; + [case(6)] dfs_Info6 *info6; + [case(7)] dfs_Info7 *info7; + [case(100)] dfs_Info100 *info100; + [case(101)] dfs_Info101 *info101; + [case(102)] dfs_Info102 *info102; + [case(103)] dfs_Info103 *info103; + [case(104)] dfs_Info104 *info104; + [case(105)] dfs_Info105 *info105; + [case(106)] dfs_Info106 *info106; + } dfs_Info; + + WERROR dfs_SetInfo ( + [in] [string,charset(UTF16)] uint16 dfs_entry_path[], + [in,unique] [string,charset(UTF16)] uint16 *servername, + [in,unique] [string,charset(UTF16)] uint16 *sharename, + [in] uint32 level, + [in,ref,switch_is(level)] dfs_Info *info + ); + + /******************/ + /* Function: 0x04 */ + WERROR dfs_GetInfo ( + [in] [string,charset(UTF16)] uint16 dfs_entry_path[], + [in,unique] [string,charset(UTF16)] uint16 *servername, + [in,unique] [string,charset(UTF16)] uint16 *sharename, + [in] uint32 level, + [out,switch_is(level)] dfs_Info *info + ); + + /******************/ + /* Function: 0x05 */ + + typedef struct { + uint32 count; + [size_is(count)] dfs_Info1 *s; + } dfs_EnumArray1; + + typedef struct { + uint32 count; + [size_is(count)] dfs_Info2 *s; + } dfs_EnumArray2; + + typedef struct { + uint32 count; + [size_is(count)] dfs_Info3 *s; + } dfs_EnumArray3; + + typedef struct { + uint32 count; + [size_is(count)] dfs_Info4 *s; + } dfs_EnumArray4; + + typedef struct { + uint32 count; + [size_is(count)] dfs_Info5 *s; + } dfs_EnumArray5; + + typedef struct { + uint32 count; + [size_is(count)] dfs_Info6 *s; + } dfs_EnumArray6; + + typedef struct { + uint32 count; + [size_is(count)] dfs_Info200 *s; + } dfs_EnumArray200; + + typedef struct { + uint32 count; + [size_is(count)] dfs_Info300 *s; + } dfs_EnumArray300; + + + typedef union { + [case(1)] dfs_EnumArray1 *info1; + [case(2)] dfs_EnumArray2 *info2; + [case(3)] dfs_EnumArray3 *info3; + [case(4)] dfs_EnumArray4 *info4; + [case(5)] dfs_EnumArray5 *info5; + [case(6)] dfs_EnumArray6 *info6; + [case(200)] dfs_EnumArray200 *info200; + [case(300)] dfs_EnumArray300 *info300; + } dfs_EnumInfo; + + typedef struct { + uint32 level; + [switch_is(level)] dfs_EnumInfo e; + } dfs_EnumStruct; + + WERROR dfs_Enum ( + [in] uint32 level, + [in] uint32 bufsize, + [in,out,unique] dfs_EnumStruct *info, + [in,out,unique] uint32 *total + ); + + /* Function 0x06 */ + [todo] WERROR dfs_Rename(); + + /* Function 0x07 */ + [todo] WERROR dfs_Move(); + + /* Function 0x08 */ + [todo] WERROR dfs_ManagerGetConfigInfo(); + + /* Function 0x09 */ + [todo] WERROR dfs_ManagerSendSiteInfo(); + + /* Function 0x0a */ + typedef struct { + uint32 unknown1; + [string,charset(UTF16)] uint16 *unknown2; + } dfs_UnknownStruct; + + WERROR dfs_AddFtRoot( + [in] [string,charset(UTF16)] uint16 servername[], + [in] [string,charset(UTF16)] uint16 dns_servername[], + [in] [string,charset(UTF16)] uint16 dfsname[], + [in] [string,charset(UTF16)] uint16 rootshare[], + [in] [string,charset(UTF16)] uint16 comment[], + [in] [string,charset(UTF16)] uint16 dfs_config_dn[], + [in] uint8 unknown1, + [in] uint32 flags, + [in,out,unique] dfs_UnknownStruct **unknown2 + ); + + /* Function 0x0b */ + WERROR dfs_RemoveFtRoot( + [in] [string,charset(UTF16)] uint16 servername[], + [in] [string,charset(UTF16)] uint16 dns_servername[], + [in] [string,charset(UTF16)] uint16 dfsname[], + [in] [string,charset(UTF16)] uint16 rootshare[], + [in] uint32 flags, + [in,out,unique] dfs_UnknownStruct **unknown + ); + + /* Function 0x0c */ + WERROR dfs_AddStdRoot( + [in] [string,charset(UTF16)] uint16 servername[], + [in] [string,charset(UTF16)] uint16 rootshare[], + [in] [string,charset(UTF16)] uint16 comment[], + [in] uint32 flags + ); + + /* Function 0x0d */ + WERROR dfs_RemoveStdRoot( + [in] [string,charset(UTF16)] uint16 servername[], + [in] [string,charset(UTF16)] uint16 rootshare[], + [in] uint32 flags + ); + + /* Function 0x0e */ + WERROR dfs_ManagerInitialize( + [in] [string,charset(UTF16)] uint16 *servername, + [in] uint32 flags + ); + + /* Function 0x0f */ + WERROR dfs_AddStdRootForced( + [in] [string,charset(UTF16)] uint16 servername[], + [in] [string,charset(UTF16)] uint16 rootshare[], + [in] [string,charset(UTF16)] uint16 comment[], + [in] [string,charset(UTF16)] uint16 store[] /* C:\\whatever */ + ); + + /* Function 0x10 */ + WERROR dfs_GetDcAddress( + [in] [string,charset(UTF16)] uint16 servername[], + [in,out,ref] [string,charset(UTF16)] uint16 **server_fullname, + [in,out,ref] boolean8 *is_root, + [in,out,ref] uint32 *ttl + ); + + /* Function 0x11 */ + WERROR dfs_SetDcAddress( + [in] [string,charset(UTF16)] uint16 servername[], + [in] [string,charset(UTF16)] uint16 server_fullname[], + [in] uint32 flags, + [in] uint32 ttl + ); + + /* Function 0x12 */ + WERROR dfs_FlushFtTable( + [in] [string,charset(UTF16)] uint16 servername[], + [in] [string,charset(UTF16)] uint16 rootshare[] + ); + + /* Function 0x13 */ + [todo] WERROR dfs_Add2(); + + /* Function 0x14 */ + [todo] WERROR dfs_Remove2(); + + /* Function 0x15 */ + [public] WERROR dfs_EnumEx( + [in] [string,charset(UTF16)] uint16 dfs_name[], + [in] uint32 level, + [in] uint32 bufsize, + [in,out,unique] dfs_EnumStruct *info, + [in,out,unique] uint32 *total + ); + + /* Function 0x16 */ + [todo] WERROR dfs_SetInfo2(); +} diff --git a/librpc/idl/dfsblobs.idl b/librpc/idl/dfsblobs.idl new file mode 100644 index 0000000..7b8795d --- /dev/null +++ b/librpc/idl/dfsblobs.idl @@ -0,0 +1,115 @@ +#include "idl_types.h" + +import "misc.idl"; +/* +dfs blobs interface definition +*/ + + +[ + pointer_default(unique), + helpstring("dfs referral blobs"), + uuid("12345778-1234-abcd-0001-00000003") +] + + +interface dfsblobs +{ + typedef [bitmap32bit] bitmap { + DFS_HEADER_FLAG_REFERAL_SVR = 0x00000001, + DFS_HEADER_FLAG_STORAGE_SVR = 0x00000002, + DFS_HEADER_FLAG_TARGET_BCK = 0x00000004 + } DFS_HEADER_FLAG; + + typedef [enum16bit] enum { + DFS_SERVER_NON_ROOT = 0x0000, + DFS_SERVER_ROOT = 0x0001 + } DFS_SERVER_TYPE; + + typedef [enum16bit] enum { + DFS_FLAG_REFERRAL_DOMAIN_RESP = 0x0002, + DFS_FLAG_REFERRAL_FIRST_TARGET_SET = 0x0004 + } DFS_FLAGS_REFERRAL; + + typedef struct { + uint16 size; + uint16 server_type; + uint16 entry_flags; + nstring *share_name; + } dfs_referral_v1; + + typedef struct { + uint16 size; + DFS_SERVER_TYPE server_type; + DFS_FLAGS_REFERRAL entry_flags; + uint32 proximity; + uint32 ttl; + [relative_short] nstring *DFS_path; + [relative_short] nstring *DFS_alt_path; + [relative_short] nstring *netw_address; + } dfs_referral_v2; + + typedef struct { + [relative_short] nstring *DFS_path; + [relative_short] nstring *DFS_alt_path; + [relative_short] nstring *netw_address; + } dfs_normal_referral; + + typedef struct { + [relative_short] nstring *special_name; + uint16 nb_expanded_names; + [relative_short,subcontext(0),flag(NDR_REMAINING|STR_NULLTERM)] string_array *expanded_names; + } dfs_domain_referral; + + typedef [nodiscriminant] union { + [case(0)] dfs_normal_referral r1; + [case(2)] dfs_domain_referral r2; + [default]; + } dfs_referral; + + typedef [nodiscriminant] union { + [case(16)] uint8 value[16]; + [default]; + } dfs_padding; + + typedef [flag(NDR_NOALIGN)] struct { + uint16 size; + DFS_SERVER_TYPE server_type; + DFS_FLAGS_REFERRAL entry_flags; + uint32 ttl; + [switch_is(entry_flags & DFS_FLAG_REFERRAL_DOMAIN_RESP)] dfs_referral referrals; + /* this is either 0 or 16 bytes */ + [switch_is(size - 18)] dfs_padding service_site_guid; + } dfs_referral_v3; + + typedef [nodiscriminant] union { + [case(1)] dfs_referral_v1 v1; + [case(2)] dfs_referral_v2 v2; + [case(3)] dfs_referral_v3 v3; + [case(4)] dfs_referral_v3 v4; + [default]; + } dfs_referral_version; + + typedef [flag(NDR_NOALIGN)] [relative_base] struct { + uint16 version; + [switch_is(version)] dfs_referral_version referral; + } dfs_referral_type; + + typedef [public] struct { + uint16 path_consumed; + uint16 nb_referrals; + DFS_HEADER_FLAG header_flags; + dfs_referral_type referral_entries[nb_referrals]; + } dfs_referral_resp; + + typedef [public] struct { + uint16 max_referral_level; + nstring servername; + } dfs_GetDFSReferral_in; + + [public] void dfs_GetDFSReferral( + [in] dfs_GetDFSReferral_in req, + [out,ref] dfs_referral_resp *resp + ); + +} diff --git a/librpc/idl/dns.idl b/librpc/idl/dns.idl new file mode 100644 index 0000000..ec8668a --- /dev/null +++ b/librpc/idl/dns.idl @@ -0,0 +1,282 @@ +#include "idl_types.h" + +/* + IDL structures for DNS operations + + DNS is not traditionally encoded using IDL/NDR. This is a bit of an + experiment, and I may well switch us back to a more traditional + encoding if it doesn't work out +*/ + +import "misc.idl", "dnsp.idl"; +[ + helper("librpc/ndr/ndr_dns.h"), + helpstring("DNS records"), + version(0.0), + uuid("a047c001-5f22-40b0-9d52-7042c43f711a") +] +interface dns +{ + const int DNS_SERVICE_PORT = 53; + const int DNS_MAX_LABELS = 127; + const int DNS_MAX_DOMAIN_LENGTH = 253; + const int DNS_MAX_LABEL_LENGTH = 63; + + typedef [public,bitmap16bit] bitmap { + DNS_RCODE = 0x001F, + DNS_FLAG_RECURSION_AVAIL = 0x0080, + DNS_FLAG_RECURSION_DESIRED = 0x0100, + DNS_FLAG_TRUNCATION = 0x0200, + DNS_FLAG_AUTHORITATIVE = 0x0400, + DNS_OPCODE = 0x7800, + DNS_FLAG_REPLY = 0x8000 + } dns_operation; + + /* the opcodes are in the operation field, masked with + DNS_OPCODE */ + typedef [public] enum { + DNS_OPCODE_QUERY = (0x0<<11), + DNS_OPCODE_IQUERY = (0x1<<11), + DNS_OPCODE_STATUS = (0x2<<11), + DNS_OPCODE_UPDATE = (0x5<<11), + DNS_OPCODE_RELEASE = (0x6<<11), + DNS_OPCODE_WACK = (0x7<<11), + DNS_OPCODE_REFRESH = (0x8<<11), + DNS_OPCODE_REFRESH2 = (0x9<<11), + DNS_OPCODE_MULTI_HOME_REG = (0xf<<11) + } dns_opcode; + + /* rcode values */ + typedef [public] enum { + DNS_RCODE_OK = 0x00, + DNS_RCODE_FORMERR = 0x01, + DNS_RCODE_SERVFAIL = 0x02, + DNS_RCODE_NXDOMAIN = 0x03, + DNS_RCODE_NOTIMP = 0x04, + DNS_RCODE_REFUSED = 0x05, + DNS_RCODE_YXDOMAIN = 0x06, + DNS_RCODE_YXRRSET = 0x07, + DNS_RCODE_NXRRSET = 0x08, + DNS_RCODE_NOTAUTH = 0x09, + DNS_RCODE_NOTZONE = 0x0A, + DNS_RCODE_BADSIG = 0x10, + DNS_RCODE_BADKEY = 0x11, + DNS_RCODE_BADTIME = 0x12, + DNS_RCODE_BADMODE = 0x13, + DNS_RCODE_BADNAME = 0x14, + DNS_RCODE_BADALG = 0x15 + } dns_rcode; + + typedef [public,enum16bit] enum { + DNS_QCLASS_IN = 0x0001, + DNS_QCLASS_NONE = 0x00FE, + DNS_QCLASS_ANY = 0x00FF + } dns_qclass; + + /* These vese values could have been merged with NBT_QTYPE values, but + DNS_QTYPE_SRV and NBT_QTYPE_STATUS have the same numeric value. */ + typedef [public,enum16bit] enum { + DNS_QTYPE_ZERO = 0x0000, + DNS_QTYPE_A = 0x0001, + DNS_QTYPE_NS = 0x0002, + DNS_QTYPE_MD = 0x0003, + DNS_QTYPE_MF = 0x0004, + DNS_QTYPE_CNAME = 0x0005, + DNS_QTYPE_SOA = 0x0006, + DNS_QTYPE_MB = 0x0007, + DNS_QTYPE_MG = 0x0008, + DNS_QTYPE_MR = 0x0009, + DNS_QTYPE_NULL = 0x000A, + DNS_QTYPE_WKS = 0x000B, + DNS_QTYPE_PTR = 0x000C, + DNS_QTYPE_HINFO = 0x000D, + DNS_QTYPE_MINFO = 0x000E, + DNS_QTYPE_MX = 0x000F, + DNS_QTYPE_TXT = 0x0010, + DNS_QTYPE_RP = 0x0011, + DNS_QTYPE_AFSDB = 0x0012, + DNS_QTYPE_X25 = 0x0013, + DNS_QTYPE_ISDN = 0x0014, + DNS_QTYPE_RT = 0x0015, + DNS_QTYPE_SIG = 0x0018, + DNS_QTYPE_KEY = 0x0019, + DNS_QTYPE_AAAA = 0x001C, + DNS_QTYPE_LOC = 0x001D, + DNS_QTYPE_NXT = 0x001E, + DNS_QTYPE_NETBIOS= 0x0020, + DNS_QTYPE_SRV = 0x0021, + DNS_QTYPE_ATMA = 0x0022, + DNS_QTYPE_NAPTR = 0x0023, + DNS_QTYPE_CERT = 0x0025, + DNS_QTYPE_DNAME = 0x0027, + DNS_QTYPE_OPT = 0x0029, + DNS_QTYPE_DS = 0x002B, + DNS_QTYPE_SSHFP = 0x002C, + DNS_QTYPE_IPSECKEY = 0x002D, + DNS_QTYPE_RRSIG = 0x002E, + DNS_QTYPE_NSEC = 0x002F, + DNS_QTYPE_DNSKEY = 0x0030, + DNS_QTYPE_DHCID = 0x0031, + DNS_QTYPE_NSEC3 = 0x0032, + DNS_QTYPE_NSEC3PARAM = 0x0033, + DNS_QTYPE_TLSA = 0x0034, + DNS_QTYPE_CDS = 0x003B, + DNS_QTYPE_CDNSKEY = 0x003C, + DNS_QTYPE_SVCB = 0x0040, + DNS_QTYPE_HTTPS = 0x0041, + DNS_QTYPE_TKEY = 0x00F9, + DNS_QTYPE_TSIG = 0x00FA, + DNS_QTYPE_IXFR = 0x00FB, + DNS_QTYPE_AXFR = 0x00FC, + DNS_QTYPE_MAILB = 0x00FD, + DNS_QTYPE_MAILA = 0x00FE, + DNS_QTYPE_ALL = 0x00FF, + DNS_QTYPE_URI = 0x0100, + DNS_QTYPE_CAA = 0x0101 + } dns_qtype; + + typedef [public,enum16bit] enum { + DNS_TKEY_MODE_NULL = 0x0000, + DNS_TKEY_MODE_SERVER = 0x0001, + DNS_TKEY_MODE_DH = 0x0002, + DNS_TKEY_MODE_GSSAPI = 0x0003, + DNS_TKEY_MODE_CLIENT = 0x0004, + DNS_TKEY_MODE_DELETE = 0x0005, + DNS_TKEY_MODE_LAST = 0xFFFF + } dns_tkey_mode; + + typedef [public] struct { + dns_string name; + dns_qtype question_type; + dns_qclass question_class; + } dns_name_question; + + typedef [public] struct { + uint16 length; + uint8 data[length]; + } dns_rdata_data; + + typedef struct { + dns_string mname; + dns_string rname; + uint32 serial; + uint32 refresh; + uint32 retry; + uint32 expire; + uint32 minimum; + } dns_soa_record; + + typedef [public] struct { + uint16 preference; + dns_string exchange; + } dns_mx_record; + + typedef [public,nopull] struct { + dnsp_string_list txt; + } dns_txt_record; + + typedef [public] struct { + dns_string mbox; + dns_string txt; + + } dns_rp_record; + + typedef [public] struct { + uint16 priority; + uint16 weight; + uint16 port; + dns_string target; + } dns_srv_record; + + typedef [public] struct { + uint16 option_code; + uint16 option_length; + uint8 option_data[option_length]; + } dns_opt_record; + + typedef [flag(NDR_NO_COMP),public] struct { + dns_string algorithm; + uint32 inception; + uint32 expiration; + dns_tkey_mode mode; + uint16 error; + uint16 key_size; + uint8 key_data[key_size]; + uint16 other_size; + uint8 other_data[other_size]; + } dns_tkey_record; + + typedef [flag(NDR_NO_COMP),public] struct { + dns_string algorithm_name; + uint16 time_prefix; /* 0 until February 2106*/ + uint32 time; + uint16 fudge; + uint16 mac_size; + uint8 mac[mac_size]; + uint16 original_id; + uint16 error; + uint16 other_size; + uint8 other_data[other_size]; + } dns_tsig_record; + + typedef [flag(NDR_NO_COMP|NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct { + dns_string name; + dns_qclass rr_class; + uint32 ttl; + dns_string algorithm_name; + uint16 time_prefix; /* 0 until February 2106*/ + uint32 time; + uint16 fudge; + uint16 error; + uint16 other_size; + uint8 other_data[other_size]; + } dns_fake_tsig_rec; + + typedef [nodiscriminant,public,flag(NDR_NOALIGN)] union { + [case(DNS_QTYPE_A)] ipv4address ipv4_record; + [case(DNS_QTYPE_NS)] dns_string ns_record; + [case(DNS_QTYPE_CNAME)] dns_string cname_record; + [case(DNS_QTYPE_SOA)] dns_soa_record soa_record; + [case(DNS_QTYPE_PTR)] dns_string ptr_record; + [case(DNS_QTYPE_HINFO)] dnsp_hinfo hinfo_record; + [case(DNS_QTYPE_MX)] dns_mx_record mx_record; + [case(DNS_QTYPE_TXT)] dns_txt_record txt_record; + [case(DNS_QTYPE_RP)] dns_rp_record rp_record; + [case(DNS_QTYPE_AAAA)] ipv6address ipv6_record; + [case(DNS_QTYPE_SRV)] dns_srv_record srv_record; + [case(DNS_QTYPE_OPT)] dns_opt_record opt_record; + [case(DNS_QTYPE_TSIG)] dns_tsig_record tsig_record; + [case(DNS_QTYPE_TKEY)] dns_tkey_record tkey_record; + [default]; + } dns_rdata; + + typedef [flag(LIBNDR_PRINT_ARRAY_HEX|NDR_NOALIGN),nopush,nopull] struct { + dns_string name; + dns_qtype rr_type; + dns_qclass rr_class; + uint32 ttl; + uint16 length; /* Should be set to either UINT16_MAX or 0 */ + [switch_is(rr_type)] dns_rdata rdata; + DATA_BLOB unexpected; + } dns_res_rec; + + typedef [flag(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct { + uint16 id; + dns_operation operation; + uint16 qdcount; + uint16 ancount; + uint16 nscount; + uint16 arcount; + dns_name_question questions[qdcount]; + dns_res_rec answers[ancount]; + dns_res_rec nsrecs[nscount]; + dns_res_rec additional[arcount]; + } dns_name_packet; + + /* + this is a convenience hook for ndrdump + */ + [nopython] void decode_dns_name_packet( + [in] dns_name_packet packet + ); +} diff --git a/librpc/idl/dnsp.idl b/librpc/idl/dnsp.idl new file mode 100644 index 0000000..0cb18bf --- /dev/null +++ b/librpc/idl/dnsp.idl @@ -0,0 +1,293 @@ +#include "idl_types.h" + +/* + IDL structures for DNSP structures + + See [MS-DNSP].pdf in MCPP for details +*/ + +import "misc.idl"; + +/* + note that this is not a real RPC interface. We are just using PIDL + to save us a lot of tedious hand parsing of the dnsRecord + attribute. The uuid is randomly generated. + */ +[ + uuid("bdd66e9e-d45f-4202-85c0-6132edc4f30a"), + version(0.0), + pointer_default(unique), + helper("../librpc/ndr/ndr_dnsp.h"), + helpstring("DNSP interfaces") +] + +interface dnsp +{ + typedef [enum16bit,public] enum { + DNS_TYPE_TOMBSTONE = 0x0, + DNS_TYPE_A = 0x1, + DNS_TYPE_NS = 0x2, + DNS_TYPE_MD = 0x3, + DNS_TYPE_MF = 0x4, + DNS_TYPE_CNAME = 0x5, + DNS_TYPE_SOA = 0x6, + DNS_TYPE_MB = 0x7, + DNS_TYPE_MG = 0x8, + DNS_TYPE_MR = 0x9, + DNS_TYPE_NULL = 0xA, + DNS_TYPE_WKS = 0xB, + DNS_TYPE_PTR = 0xC, + DNS_TYPE_HINFO = 0xD, + DNS_TYPE_MINFO = 0xE, + DNS_TYPE_MX = 0xF, + DNS_TYPE_TXT = 0x10, + DNS_TYPE_RP = 0x11, + DNS_TYPE_AFSDB = 0x12, + DNS_TYPE_X25 = 0x13, + DNS_TYPE_ISDN = 0x14, + DNS_TYPE_RT = 0x15, + DNS_TYPE_SIG = 0x18, + DNS_TYPE_KEY = 0x19, + DNS_TYPE_AAAA = 0x1C, + DNS_TYPE_LOC = 0x1D, + DNS_TYPE_NXT = 0x1E, + DNS_TYPE_SRV = 0x21, + DNS_TYPE_ATMA = 0x22, + DNS_TYPE_NAPTR = 0x23, + DNS_TYPE_CERT = 0x25, + DNS_TYPE_DNAME = 0x27, + DNS_TYPE_DS = 0x2B, + DNS_TYPE_SSHFP = 0x2C, + DNS_TYPE_IPSECKEY = 0x2D, + DNS_TYPE_RRSIG = 0x2E, + DNS_TYPE_NSEC = 0x2F, + DNS_TYPE_DNSKEY= 0x30, + DNS_TYPE_DHCID = 0x31, + DNS_TYPE_NSEC3 = 0x32, + DNS_TYPE_NSEC3PARAM = 0x33, + DNS_TYPE_TLSA = 0x34, + DNS_TYPE_CDS = 0x3B, + DNS_TYPE_CDNSKEY = 0x3C, + DNS_TYPE_SVCB = 0x40, + DNS_TYPE_HTTPS = 0x41, + DNS_TYPE_ALL = 0xFF, + DNS_TYPE_URI = 0x100, + DNS_TYPE_CAA = 0x101, + DNS_TYPE_WINS = 0xFF01, + DNS_TYPE_WINSR = 0xFF02 + } dns_record_type; + + typedef [bitmap32bit] bitmap { + DNS_RPC_FLAG_SUPPRESS_NOTIFY = 0x00010000, + DNS_RPC_FLAG_AGING_ON = 0x00020000, + DNS_RPC_FLAG_OPEN_ACL = 0x00040000, + DNS_RPC_FLAG_RECORD_WIRE_FORMAT = 0x00100000, + DNS_RPC_FLAG_SUPPRESS_RECORD_UPDATE_PTR = 0x00200000, + DNS_RPC_FLAG_NODE_COMPLETE = 0x00800000, + DNS_RPC_FLAG_NODE_STICKY = 0x01000000, + DNS_RPC_FLAG_RECORD_CREATE_PTR = 0x02000000, + DNS_RPC_FLAG_RECORD_TTL_CHANGE = 0x04000000, + DNS_RPC_FLAG_RECORD_DEFAULT_TTL = 0x08000000, + DNS_RPC_FLAG_ZONE_DELEGATION = 0x10000000, + DNS_RPC_FLAG_AUTH_ZONE_ROOT = 0x20000000, + DNS_RPC_FLAG_ZONE_ROOT = 0x40000000, + DNS_RPC_FLAG_CACHE_DATA = 0x80000000 + } + dns_rpc_node_flags; + + + typedef [enum8bit] enum { + DNS_RANK_NONE = 0x00, + DNS_RANK_CACHE_BIT = 0x01, + DNS_RANK_ROOT_HINT = 0x08, + DNS_RANK_OUTSIDE_GLUE = 0x20, + DNS_RANK_CACHE_NA_ADDITIONAL = 0x31, + DNS_RANK_CACHE_NA_AUTHORITY = 0x41, + DNS_RANK_CACHE_A_ADDITIONAL = 0x51, + DNS_RANK_CACHE_NA_ANSWER = 0x61, + DNS_RANK_CACHE_A_AUTHORITY = 0x71, + DNS_RANK_GLUE = 0x80, + DNS_RANK_NS_GLUE = 0x82, + DNS_RANK_CACHE_A_ANSWER = 0xc1, + DNS_RANK_ZONE = 0xf0 + } dns_record_rank; + + typedef [v1_enum] enum { + DNS_ZONE_TYPE_CACHE = 0x00, + DNS_ZONE_TYPE_PRIMARY = 0x01, + DNS_ZONE_TYPE_SECONDARY = 0x02, + DNS_ZONE_TYPE_STUB = 0x03, + DNS_ZONE_TYPE_FORWARDER = 0x04, + DNS_ZONE_TYPE_SECONDARY_CACHE = 0x05 + } dns_zone_type; + + typedef [public,enum8bit] enum { + DNS_ZONE_UPDATE_OFF = 0x00, + DNS_ZONE_UPDATE_UNSECURE = 0x01, + DNS_ZONE_UPDATE_SECURE = 0x02 + } dns_zone_update; + + typedef [v1_enum] enum { + DSPROPERTY_ZONE_EMPTY = 0x00, + DSPROPERTY_ZONE_TYPE = 0x01, + DSPROPERTY_ZONE_ALLOW_UPDATE = 0x02, + DSPROPERTY_ZONE_SECURE_TIME = 0x08, + DSPROPERTY_ZONE_NOREFRESH_INTERVAL = 0x10, + DSPROPERTY_ZONE_SCAVENGING_SERVERS = 0x11, + DSPROPERTY_ZONE_AGING_ENABLED_TIME = 0x12, + DSPROPERTY_ZONE_REFRESH_INTERVAL = 0x20, + DSPROPERTY_ZONE_AGING_STATE = 0x40, + DSPROPERTY_ZONE_DELETED_FROM_HOSTNAME = 0x80, + DSPROPERTY_ZONE_MASTER_SERVERS = 0x81, + DSPROPERTY_ZONE_AUTO_NS_SERVERS = 0x82, + DSPROPERTY_ZONE_DCPROMO_CONVERT = 0x83, + DSPROPERTY_ZONE_SCAVENGING_SERVERS_DA = 0x90, + DSPROPERTY_ZONE_MASTER_SERVERS_DA = 0x91, + DSPROPERTY_ZONE_NS_SERVERS_DA = 0x92, + DSPROPERTY_ZONE_NODE_DBFLAGS = 0x100 + + } dns_property_id; + + typedef [enum8bit] enum { + DCPROMO_CONVERT_NONE = 0x00, + DCPROMO_CONVERT_DOMAIN = 0x01, + DCPROMO_CONVERT_FOREST = 0x02 + } dns_dcpromo_flag; + + typedef [public] struct { + uint32 serial; + uint32 refresh; + uint32 retry; + uint32 expire; + uint32 minimum; + dnsp_name mname; + dnsp_name rname; + } dnsp_soa; + + typedef [public] struct { + uint16 wPriority; + dnsp_name nameTarget; + } dnsp_mx; + + typedef [public] struct { + dnsp_string cpu; + dnsp_string os; + } dnsp_hinfo; + + typedef [public] struct { + uint16 wPriority; + uint16 wWeight; + uint16 wPort; + dnsp_name nameTarget; + } dnsp_srv; + + typedef struct { + uint32 addrCount; + uint32 addrArray[addrCount]; + } dnsp_ip4_array; + + typedef struct { + uint16 family; + [flag(NDR_BIG_ENDIAN)] uint16 port; + [flag(NDR_BIG_ENDIAN)] ipv4address ipv4; + ipv6address ipv6; + uint8 pad[8]; + uint32 unused[8]; + } dnsp_dns_addr; + + typedef [public] struct { + uint32 MaxCount; + uint32 AddrCount; + uint32 Tag; + uint16 Family; + uint16 Reserved0; + uint32 Flags; + uint32 MatchFlag; + uint32 Reserved1; + uint32 Reserved2; + dnsp_dns_addr AddrArray[AddrCount]; + } dnsp_dns_addr_array; + + typedef [public,nopull,nopush,noprint,gensize] struct { + uint8 count; + dnsp_string str[count]; + } dnsp_string_list; + + typedef [nodiscriminant,gensize] union { + [case(DNS_TYPE_TOMBSTONE)] NTTIME EntombedTime; + [case(DNS_TYPE_A)] [flag(NDR_BIG_ENDIAN)] ipv4address ipv4; + [case(DNS_TYPE_NS)] dnsp_name ns; + [case(DNS_TYPE_CNAME)] dnsp_name cname; + [case(DNS_TYPE_SOA)] [flag(NDR_BIG_ENDIAN)] dnsp_soa soa; + [case(DNS_TYPE_MX)] [flag(NDR_BIG_ENDIAN)] dnsp_mx mx; + [case(DNS_TYPE_TXT)] dnsp_string_list txt; + [case(DNS_TYPE_PTR)] dnsp_name ptr; + [case(DNS_TYPE_HINFO)] dnsp_hinfo hinfo; + [case(DNS_TYPE_AAAA)] ipv6address ipv6; + [case(DNS_TYPE_SRV)] [flag(NDR_BIG_ENDIAN)] dnsp_srv srv; + [default] [flag(NDR_REMAINING)] DATA_BLOB data; + } dnsRecordData; + + /* this is the format for the dnsRecord attribute in the DNS + partitions in AD */ + typedef [public] struct { + [value(ndr_size_dnsRecordData(&data,wType,ndr->flags))] uint16 wDataLength; + dns_record_type wType; + [value(5)] uint8 version; + dns_record_rank rank; + uint16 flags; + uint32 dwSerial; + [flag(NDR_BIG_ENDIAN)] uint32 dwTtlSeconds; + uint32 dwReserved; + uint32 dwTimeStamp; + [switch_is(wType)] dnsRecordData data; + } dnsp_DnssrvRpcRecord; + + typedef [nodiscriminant,gensize] union { + [case(DSPROPERTY_ZONE_EMPTY)] ; + [case(DSPROPERTY_ZONE_TYPE)] dns_zone_type zone_type; + [case(DSPROPERTY_ZONE_ALLOW_UPDATE)] dns_zone_update allow_update_flag; + [case(DSPROPERTY_ZONE_SECURE_TIME)] NTTIME zone_secure_time; + [case(DSPROPERTY_ZONE_NOREFRESH_INTERVAL)] uint32 norefresh_hours; + [case(DSPROPERTY_ZONE_REFRESH_INTERVAL)] uint32 refresh_hours; + [case(DSPROPERTY_ZONE_AGING_STATE)] uint32 aging_enabled; + [case(DSPROPERTY_ZONE_SCAVENGING_SERVERS)] dnsp_ip4_array servers; + [case(DSPROPERTY_ZONE_AGING_ENABLED_TIME)] uint32 next_scavenging_cycle_hours; + [case(DSPROPERTY_ZONE_DELETED_FROM_HOSTNAME)] nstring deleted_by_hostname; + [case(DSPROPERTY_ZONE_MASTER_SERVERS)] dnsp_ip4_array master_servers; + [case(DSPROPERTY_ZONE_AUTO_NS_SERVERS)] dnsp_ip4_array ns_servers; + [case(DSPROPERTY_ZONE_DCPROMO_CONVERT)] dns_dcpromo_flag dcpromo_flag; + [case(DSPROPERTY_ZONE_SCAVENGING_SERVERS_DA)] dnsp_dns_addr_array s_ns_servers; + [case(DSPROPERTY_ZONE_MASTER_SERVERS_DA)] dnsp_dns_addr_array z_master_servers; + [case(DSPROPERTY_ZONE_NS_SERVERS_DA)] dnsp_dns_addr_array d_ns_servers; + [case(DSPROPERTY_ZONE_NODE_DBFLAGS)] dns_rpc_node_flags flags; + } dnsPropertyData; + + /* this is the format for the dnsProperty attribute in the DNS + partitions in AD */ + typedef [flag(NDR_NOALIGN),public] struct { + [value(ndr_size_dnsPropertyData(&data,id,ndr->flags))] uint32 wDataLength; + uint32 namelength; + [value(0)] uint32 flag; + [value(1)] uint32 version; + dns_property_id id; + [switch_is(id)] dnsPropertyData data; + uint32 name; + } dnsp_DnsProperty; + + /* + * this is the format for the dnsProperty attribute in the DNS + * partitions in AD when the wDataLength is 0. This is an + * invalid format seen from some Windows servers in the same + * domain. + */ + typedef [flag(NDR_NOALIGN),public] struct { + [range(0, 0), value(0)] uint32 wDataLength; + uint32 namelength; + [value(0)] uint32 flag; + [value(1)] uint32 version; + dns_property_id id; + [switch_is(DSPROPERTY_ZONE_EMPTY)] dnsPropertyData data; + uint32 name; + } dnsp_DnsProperty_short; +} diff --git a/librpc/idl/dnsserver.idl b/librpc/idl/dnsserver.idl new file mode 100644 index 0000000..a6c413a --- /dev/null +++ b/librpc/idl/dnsserver.idl @@ -0,0 +1,1529 @@ +#include "idl_types.h" +/* + dnsserver interface definition + for a protocol description see [MS-DNSP].pdf +*/ + +import "misc.idl", "dnsp.idl"; + +[ uuid("50abc2a4-574d-40b3-9d66-ee4fd5fba076"), + version(5.0), + pointer_default(unique), + endpoint("ncacn_ip_tcp:", "ncacn_np:[\\pipe\\dnsserver]"), + helper("../librpc/ndr/ndr_dnsserver.h"), + helpstring("DNS Management Server") +] interface dnsserver +{ + +#define wchar_t uint16 +#define BOOLEAN boolean8 +#define BOOL boolean32 +#define BYTE uint8 +#define UCHAR uint8 +#define CHAR char +#define PBYTE BYTE* +#define DWORD uint32 +#define PDWORD uint32 * + + /* */ + /* DNS RPC data types */ + /* */ + + typedef [v1_enum] enum { + DNS_RPC_USE_TCPIP = 0x00000001, + DNS_RPC_USE_NAMED_PIPE = 0x00000002, + DNS_RPC_USE_LPC = 0x00000004, + DNS_RPC_USE_ALL_PROTOCOLS = 0xFFFFFFFF + } + DNS_RPC_PROTOCOLS; + + typedef [v1_enum] enum { + DNS_CLIENT_VERSION_W2K = 0x00000000, + DNS_CLIENT_VERSION_DOTNET = 0x00060000, + DNS_CLIENT_VERSION_LONGHORN = 0x00070000 + } + DNS_RPC_CLIENT_VERSION; + + /* Return buffer */ + typedef struct { + DWORD dwLength; + [size_is(dwLength)] BYTE Buffer[]; + } DNS_RPC_BUFFER; + + /* String Array */ + typedef struct { + [range(0,10000)] DWORD dwCount; + [size_is(dwCount),string,charset(UTF8)] char * pszStrings[]; + } DNS_RPC_UTF8_STRING_LIST; + + /* Name and parameter value */ + typedef struct { + DWORD dwParam; + [string, charset(UTF8)] char * pszNodeName; + } + DNS_RPC_NAME_AND_PARAM; + + + /* */ + /* DNS Resource Record data types */ + /* */ + + /* DNS_RECORD_TYPE is defined in dnsp.idl as dns_record_type */ + /* DNS_RPC_NODE_FLAGS is defined in dnsp.idl as dns_rpc_node_flags */ + + typedef [public,gensize] struct { + [value(strlen(str))] uint8 len; + [charset(UNIX)] uint8 str[len]; + } + DNS_RPC_NAME; + + typedef struct { + uint16 wLength; + uint16 wRecordCount; + uint32 dwFlags; + uint32 dwChildCount; + DNS_RPC_NAME dnsNodeName; + } + DNS_RPC_NODE; + + typedef struct { + uint32 dwSerialNo; + uint32 dwRefresh; + uint32 dwRetry; + uint32 dwExpire; + uint32 dwMinimumTtl; + DNS_RPC_NAME NamePrimaryServer; + DNS_RPC_NAME ZoneAdministratorEmail; + } + DNS_RPC_RECORD_SOA; + + typedef struct { + uint16 wPreference; + DNS_RPC_NAME nameExchange; + } + DNS_RPC_RECORD_NAME_PREFERENCE; + + typedef [nopull,nopush] struct { + uint8 count; + DNS_RPC_NAME str[count]; + } + DNS_RPC_RECORD_STRING; + + typedef struct { + uint16 wPriority; + uint16 wWeight; + uint16 wPort; + DNS_RPC_NAME nameTarget; + } + DNS_RPC_RECORD_SRV; + + typedef [nodiscriminant,gensize,flag(NDR_NOALIGN)] union { + [case(DNS_TYPE_TOMBSTONE)] NTTIME EntombedTime; + [case(DNS_TYPE_A)] [flag(NDR_BIG_ENDIAN)] ipv4address ipv4; + [case(DNS_TYPE_NS)] DNS_RPC_NAME name; + [case(DNS_TYPE_MD)] DNS_RPC_NAME name; + [case(DNS_TYPE_MF)] DNS_RPC_NAME name; + [case(DNS_TYPE_CNAME)] DNS_RPC_NAME name; + [case(DNS_TYPE_SOA)] DNS_RPC_RECORD_SOA soa; + [case(DNS_TYPE_MB)] DNS_RPC_NAME name; + [case(DNS_TYPE_MG)] DNS_RPC_NAME name; + [case(DNS_TYPE_MR)] DNS_RPC_NAME name; + [case(DNS_TYPE_PTR)] DNS_RPC_NAME ptr; + [case(DNS_TYPE_HINFO)] DNS_RPC_NAME hinfo; + [case(DNS_TYPE_MX)] DNS_RPC_RECORD_NAME_PREFERENCE mx; + [case(DNS_TYPE_TXT)] DNS_RPC_RECORD_STRING txt; + [case(DNS_TYPE_AAAA)] ipv6address ipv6; + [case(DNS_TYPE_SRV)] DNS_RPC_RECORD_SRV srv; + [case(DNS_TYPE_DNAME)] DNS_RPC_NAME name; + } + DNS_RPC_RECORD_DATA; + + typedef [public] struct { + [value(ndr_size_DNS_RPC_RECORD_DATA(&data,wType,0))] uint16 wDataLength; + dns_record_type wType; + DWORD dwFlags; + DWORD dwSerial; + DWORD dwTtlSeconds; + DWORD dwTimeStamp; + DWORD dwReserved; + [subcontext(0),subcontext_size(wDataLength),switch_is(wType)] DNS_RPC_RECORD_DATA data; + } + DNS_RPC_RECORD; + + typedef struct { + [value(ndr_size_DNS_RPC_RECORD_DATA(&rec.data,rec.wType,0))] uint3264 wContextLength; + DNS_RPC_RECORD rec; + } + DNS_RPC_RECORD_BUF; + + + /* */ + /* DNS Address Information data types */ + /* */ + + typedef [v1_enum] enum { + DNS_IPVAL_DNS_SERVERS = 0x00, + DNS_IPVAL_DNS_ROOTHINTS = 0x01, + DNS_IPVAL_DNS_FORWARDERS = 0x02, + DNS_IPVAL_DNS_ZONE_MASTERS = 0x03, + DNS_IPVAL_DNS_DELEGATIONS = 0x04 + } + DNS_IPVAL_CONTEXT; + + typedef [v1_enum] enum { + ERROR_SUCCESS = 0x00, + DNS_IPVAL_INVALID_ADDR = 0x01, + DNS_IPVAL_UNREACHABLE = 0x02, + DNS_IPVAL_NO_RESPONSE = 0x03, + DNS_IPVAL_NOT_AUTH_FOR_ZONE = 0x04, + DNS_IPVAL_UNKNOWN_ERROR = 0xFF, + DNS_IPVAL_NO_TCP = 0x80000000 + } + DNS_IP_VALIDATE_RETURN_FLAGS; + + typedef struct { + DWORD AddrCount; + [size_is( AddrCount )] DWORD AddrArray[]; + } IP4_ARRAY; +#define PIP4_ARRAY IP4_ARRAY* + + typedef struct { + CHAR MaxSa[32]; + DWORD DnsAddrUserDword[8]; + } DNS_ADDR; + + typedef struct { + DWORD MaxCount; + DWORD AddrCount; + DWORD Tag; + WORD Family; + WORD WordReserved; + DWORD Flags; + DWORD MatchFlag; + DWORD Reserved1; + DWORD Reserved2; + [size_is( AddrCount )] DNS_ADDR AddrArray[]; + } DNS_ADDR_ARRAY; +#define PDNS_ADDR_ARRAY DNS_ADDR_ARRAY* + + typedef struct { + DWORD dwRpcStructureVersion; + DWORD dwReserved0; + DWORD dwContext; + DWORD dwReserved1; + [string, charset(UTF8)] char * pszContextName; + PDNS_ADDR_ARRAY aipValidateAddrs; + } + DNS_RPC_IP_VALIDATE; + + + /* */ + /* DNS Server data types */ + /* */ + + typedef [enum8bit] enum { + DNS_BOOT_METHOD_UNINITIALIZED = 0x00, + DNS_BOOT_METHOD_FILE = 0x01, + DNS_BOOT_METHOD_REGISTRY = 0x02, + DNS_BOOT_METHOD_DIRECTORY = 0x03 + } + DNS_BOOT_METHOD; + + typedef [v1_enum] enum { + DNS_ALLOW_RFC_NAMES_ONLY = 0x00, + DNS_ALLOW_NONRFC_NAMES = 0x01, + DNS_ALLOW_MULTIBYTE_NAMES = 0x02, + DNS_ALLOW_ALL_NAMES = 0x03 + } + DNS_NAME_CHECK_FLAG; + + typedef struct { + /* version */ + /* basic configuration flags */ + + DWORD dwVersion; + DNS_BOOT_METHOD fBootMethod; + BOOLEAN fAdminConfigured; + BOOLEAN fAllowUpdate; + BOOLEAN fDsAvailable; + + /* pointer section */ + + [string, charset(UTF8)] char * pszServerName; + + /* DS container */ + + [string, charset(UTF16)] wchar_t * pszDsContainer; + + /* IP interfaces */ + + PIP4_ARRAY aipServerAddrs; + PIP4_ARRAY aipListenAddrs; + + /* forwarders */ + + PIP4_ARRAY aipForwarders; + + /* future extensions */ + + PDWORD pExtension1; + PDWORD pExtension2; + PDWORD pExtension3; + PDWORD pExtension4; + PDWORD pExtension5; + + /* DWORD section */ + + /* logging */ + + DWORD dwLogLevel; + DWORD dwDebugLevel; + + /* configuration DWORDs */ + + DWORD dwForwardTimeout; + DWORD dwRpcProtocol; + DNS_NAME_CHECK_FLAG dwNameCheckFlag; + DWORD cAddressAnswerLimit; + DWORD dwRecursionRetry; + DWORD dwRecursionTimeout; + DWORD dwMaxCacheTtl; + DWORD dwDsPollingInterval; + + /* aging / scavenging */ + + DWORD dwScavengingInterval; + DWORD dwDefaultRefreshInterval; + DWORD dwDefaultNoRefreshInterval; + + DWORD dwReserveArray[10]; + + /* BYTE section */ + + /* configuration flags */ + + BOOLEAN fAutoReverseZones; + BOOLEAN fAutoCacheUpdate; + + /* recursion control */ + + BOOLEAN fRecurseAfterForwarding; + BOOLEAN fForwardDelegations; + BOOLEAN fNoRecursion; + BOOLEAN fSecureResponses; + + /* lookup control */ + + BOOLEAN fRoundRobin; + BOOLEAN fLocalNetPriority; + + /* BIND compatibility and mimicking */ + + BOOLEAN fBindSecondaries; + BOOLEAN fWriteAuthorityNs; + + /* Bells and whistles */ + + BOOLEAN fStrictFileParsing; + BOOLEAN fLooseWildcarding; + + /* aging / scavenging */ + + BOOLEAN fDefaultAgingState; + BOOLEAN fReserveArray[15]; + } + DNS_RPC_SERVER_INFO_W2K; + + typedef struct { + [string, charset(UTF8)] uint8 *extension; + } DNS_EXTENSION; + + typedef [public] struct { + DWORD dwRpcStructureVersion; + DWORD dwReserved0; + + /* basic configuration flags */ + + DWORD dwVersion; + DNS_BOOT_METHOD fBootMethod; + BOOLEAN fAdminConfigured; + BOOLEAN fAllowUpdate; + BOOLEAN fDsAvailable; + + /* pointer section */ + + [string, charset(UTF8)] char * pszServerName; + + /* DS container */ + + [string, charset(UTF16)] wchar_t * pszDsContainer; + + /* IP interfaces */ + + PIP4_ARRAY aipServerAddrs; + PIP4_ARRAY aipListenAddrs; + + /* forwarders */ + + PIP4_ARRAY aipForwarders; + + /* logging */ + + PIP4_ARRAY aipLogFilter; + [string, charset(UTF16)] wchar_t * pwszLogFilePath; + + /* Server domain/forest */ + + [string, charset(UTF8)] char * pszDomainName; /* UTF-8 FQDN */ + [string, charset(UTF8)] char * pszForestName; /* UTF-8 FQDN */ + + /* Built-in directory partitions */ + + [string, charset(UTF8)] char * pszDomainDirectoryPartition; /* UTF-8 FQDN */ + [string, charset(UTF8)] char * pszForestDirectoryPartition; /* UTF-8 FQDN */ + + /* future extensions */ + DNS_EXTENSION pExtensions[6]; + + /* DWORD section */ + + /* logging */ + + DWORD dwLogLevel; + DWORD dwDebugLevel; + + /* configuration DWORDs */ + + DWORD dwForwardTimeout; + DWORD dwRpcProtocol; + DNS_NAME_CHECK_FLAG dwNameCheckFlag; + DWORD cAddressAnswerLimit; + DWORD dwRecursionRetry; + DWORD dwRecursionTimeout; + DWORD dwMaxCacheTtl; + DWORD dwDsPollingInterval; + DWORD dwLocalNetPriorityNetMask; + + /* aging and scavenging */ + + DWORD dwScavengingInterval; + DWORD dwDefaultRefreshInterval; + DWORD dwDefaultNoRefreshInterval; + DWORD dwLastScavengeTime; + + /* more logging */ + + DWORD dwEventLogLevel; + DWORD dwLogFileMaxSize; + + /* Active Directory information */ + + DWORD dwDsForestVersion; + DWORD dwDsDomainVersion; + DWORD dwDsDsaVersion; + + DWORD dwReserveArray[ 4 ]; + + /* BYTE section */ + + /* configuration flags */ + + BOOLEAN fAutoReverseZones; + BOOLEAN fAutoCacheUpdate; + + /* recursion control */ + + BOOLEAN fRecurseAfterForwarding; + BOOLEAN fForwardDelegations; + BOOLEAN fNoRecursion; + BOOLEAN fSecureResponses; + + /* lookup control */ + + BOOLEAN fRoundRobin; + BOOLEAN fLocalNetPriority; + + /* BIND compatibility and mimicking */ + + BOOLEAN fBindSecondaries; + BOOLEAN fWriteAuthorityNs; + + /* Bells and whistles */ + + BOOLEAN fStrictFileParsing; + BOOLEAN fLooseWildcarding; + + /* aging \ scavenging */ + + BOOLEAN fDefaultAgingState; + + BOOLEAN fReserveArray[ 15 ]; + } + DNS_RPC_SERVER_INFO_DOTNET; + + typedef [public] struct { + DWORD dwRpcStructureVersion; + DWORD dwReserved0; + + /* basic configuration flags */ + + DWORD dwVersion; + DNS_BOOT_METHOD fBootMethod; + BOOLEAN fAdminConfigured; + BOOLEAN fAllowUpdate; + BOOLEAN fDsAvailable; + + /* pointer section */ + + [string, charset(UTF8)] char * pszServerName; + + /* DS container */ + + [string, charset(UTF16)] wchar_t * pszDsContainer; + + /* IP interfaces */ + + PDNS_ADDR_ARRAY aipServerAddrs; + PDNS_ADDR_ARRAY aipListenAddrs; + + /* forwarders */ + + PDNS_ADDR_ARRAY aipForwarders; + + /* logging */ + + PDNS_ADDR_ARRAY aipLogFilter; + [string, charset(UTF16)] wchar_t * pwszLogFilePath; + + /* Server domain/forest */ + + [string, charset(UTF8)] char * pszDomainName; /* UTF-8 FQDN */ + [string, charset(UTF8)] char * pszForestName; /* UTF-8 FQDN */ + + /* Built-in directory partitions */ + + [string, charset(UTF8)] char * pszDomainDirectoryPartition; /* UTF-8 FQDN */ + [string, charset(UTF8)] char * pszForestDirectoryPartition; /* UTF-8 FQDN */ + + /* future extensions */ + DNS_EXTENSION pExtensions[6]; + + /* DWORD section */ + + /* logging */ + + DWORD dwLogLevel; + DWORD dwDebugLevel; + + /* configuration DWORDs */ + + DWORD dwForwardTimeout; + DWORD dwRpcProtocol; + DNS_NAME_CHECK_FLAG dwNameCheckFlag; + DWORD cAddressAnswerLimit; + DWORD dwRecursionRetry; + DWORD dwRecursionTimeout; + DWORD dwMaxCacheTtl; + DWORD dwDsPollingInterval; + DWORD dwLocalNetPriorityNetMask; + + /* aging and scavenging */ + + DWORD dwScavengingInterval; + DWORD dwDefaultRefreshInterval; + DWORD dwDefaultNoRefreshInterval; + DWORD dwLastScavengeTime; + + /* more logging */ + + DWORD dwEventLogLevel; + DWORD dwLogFileMaxSize; + + /* Active Directory information */ + + DWORD dwDsForestVersion; + DWORD dwDsDomainVersion; + DWORD dwDsDsaVersion; + BOOLEAN fReadOnlyDC; + + DWORD dwReserveArray[ 3 ]; + + /* BYTE section */ + + /* configuration flags */ + + BOOLEAN fAutoReverseZones; + BOOLEAN fAutoCacheUpdate; + + /* recursion control */ + + BOOLEAN fRecurseAfterForwarding; + BOOLEAN fForwardDelegations; + BOOLEAN fNoRecursion; + BOOLEAN fSecureResponses; + + /* lookup control */ + + BOOLEAN fRoundRobin; + BOOLEAN fLocalNetPriority; + + /* BIND compatibility and mimicking */ + + BOOLEAN fBindSecondaries; + BOOLEAN fWriteAuthorityNs; + + /* Bells and whistles */ + + BOOLEAN fStrictFileParsing; + BOOLEAN fLooseWildcarding; + + /* aging \ scavenging */ + + BOOLEAN fDefaultAgingState; + + BOOLEAN fReserveArray[ 15 ]; + } + DNS_RPC_SERVER_INFO_LONGHORN; +#define DNS_RPC_SERVER_INFO DNS_RPC_SERVER_INFO_LONGHORN + + + /* */ + /* DNS Application directory partition data types */ + /* */ + + typedef [bitmap32bit] bitmap { + DNS_DP_AUTOCREATED = 0x00000001, + DNS_DP_LEGACY = 0x00000002, + DNS_DP_DOMAIN_DEFAULT = 0x00000004, + DNS_DP_FOREST_DEFAULT = 0x00000008, + DNS_DP_ENLISTED = 0x00000010, + DNS_DP_DELETED = 0x00000020 + } + DNS_RPC_DP_FLAGS; + + typedef struct { + [string, charset(UTF16)] wchar_t * pszReplicaDn; + } + DNS_RPC_DP_REPLICA; +#define PDNS_RPC_DP_REPLICA DNS_RPC_DP_REPLICA* + + typedef [v1_enum] enum { + DNS_DP_OKAY = 0x00, + DNS_DP_STATE_REPL_INCOMING = 0x01, + DNS_DP_STATE_REPL_OUTGOING = 0x02, + DNS_DP_STATE_UNKNOWN = 0x03 + } DNS_DP_STATE; + + typedef struct { + DWORD dwRpcStructureVersion; + DWORD dwReserved0; + + [string, charset(UTF8)] char * pszDpFqdn; + [string, charset(UTF16)] wchar_t * pszDpDn; + [string, charset(UTF16)] wchar_t * pszCrDn; + DWORD dwFlags; + DWORD dwZoneCount; + DNS_DP_STATE dwState; + + DWORD dwReserved[ 3 ]; + DNS_EXTENSION pwszReserved[ 3 ]; + [range(0,10000)] DWORD dwReplicaCount; + [size_is(dwReplicaCount)] PDNS_RPC_DP_REPLICA ReplicaArray[]; + } + DNS_RPC_DP_INFO; + + typedef struct { + DWORD dwRpcStructureVersion; + DWORD dwReserved0; + + [string, charset(UTF8)] char * pszDpFqdn; + DWORD dwFlags; + DWORD dwZoneCount; + } + DNS_RPC_DP_ENUM; +#define PDNS_RPC_DP_ENUM DNS_RPC_DP_ENUM* + + typedef struct { + DWORD dwRpcStructureVersion; + DWORD dwReserved0; + [range(0,5000)] DWORD dwDpCount; + [size_is(dwDpCount)] PDNS_RPC_DP_ENUM DpArray[]; + } + DNS_RPC_DP_LIST; + + typedef struct { + DWORD dwRpcStructureVersion; + DWORD dwReserved0; + [string, charset(UTF8)] char * pszDpFqdn; /* UTF8 */ + DWORD dwOperation; + } + DNS_RPC_ENLIST_DP; + + typedef struct { + DWORD dwRpcStructureVersion; + DWORD dwReserved0; + [string, charset(UTF8)] char * pszDestPartition; + } + DNS_RPC_ZONE_CHANGE_DP; + + + /* */ + /* DNS Zone data types */ + /* */ + + /* DNS_ZONE_TYPE defined in dnsp as dns_zone_type */ + + typedef [v1_enum] enum { + DNS_ZONE_SECSECURE_NO_SECURITY = 0x00, + DNS_ZONE_SECSECURE_NS_ONLY = 0x01, + DNS_ZONE_SECSECURE_LIST_ONLY = 0x02, + DNS_ZONE_SECSECURE_NO_XFER = 0x03 + } + DNS_ZONE_SECONDARY_SECURITY; + + typedef [v1_enum] enum { + DNS_ZONE_NOTIFY_OFF = 0x00, + DNS_ZONE_NOTIFY_ALL_SECONDARIES = 0x01, + DNS_ZONE_NOTIFY_LIST_ONLY = 0x02 + } + DNS_ZONE_NOTIFY_LEVEL; + + typedef [v1_enum] enum { + DNS_ZONE_REQUEST_PRIMARY = 0x00000001, + DNS_ZONE_REQUEST_SECONDARY = 0x00000002, + DNS_ZONE_REQUEST_CACHE = 0x00000004, + DNS_ZONE_REQUEST_AUTO = 0x00000008, + DNS_ZONE_REQUEST_FORWARD = 0x00000010, + DNS_ZONE_REQUEST_REVERSE = 0x00000020, + DNS_ZONE_REQUEST_FORWARDER = 0x00000040, + DNS_ZONE_REQUEST_STUB = 0x00000080, + DNS_ZONE_REQUEST_DS = 0x00000100, + DNS_ZONE_REQUEST_NON_DS = 0x00000200, + DNS_ZONE_REQUEST_DOMAIN_DP = 0x00000400, + DNS_ZONE_REQUEST_FOREST_DP = 0x00000800, + DNS_ZONE_REQUEST_CUSTOM_DP = 0x00001000, + DNS_ZONE_REQUEST_LEGACY_DP = 0x00002000 + } + DNS_ZONE_REQUEST_FILTERS; + + typedef [bitmap32bit] bitmap { + DNS_RPC_ZONE_PAUSED = 0x0001, + DNS_RPC_ZONE_SHUTDOWN = 0x0002, + DNS_RPC_ZONE_REVERSE = 0x0004, + DNS_RPC_ZONE_AUTOCREATED = 0x0008, + DNS_RPC_ZONE_DSINTEGRATED = 0x0010, + DNS_RPC_ZONE_AGING = 0x0020, + DNS_RPC_ZONE_UPDATE_UNSECURE = 0x0040, + DNS_RPC_ZONE_UPDATE_SECURE = 0x0080, + DNS_RPC_ZONE_READONLY = 0x0100 + } DNS_RPC_ZONE_FLAGS; + + typedef struct { + [string, charset(UTF16)] uint16 * pszZoneName; + DNS_RPC_ZONE_FLAGS Flags; + UCHAR ZoneType; + UCHAR Version; + } + DNS_RPC_ZONE_W2K; +#define PDNS_RPC_ZONE_W2K DNS_RPC_ZONE_W2K* + + typedef struct { + DWORD dwRpcStructureVersion; + DWORD dwReserved0; + [string, charset(UTF16)] wchar_t * pszZoneName; + DNS_RPC_ZONE_FLAGS Flags; + UCHAR ZoneType; + UCHAR Version; + DNS_RPC_DP_FLAGS dwDpFlags; + [string, charset(UTF8)] char * pszDpFqdn; + } + DNS_RPC_ZONE_DOTNET; +#define DNS_RPC_ZONE DNS_RPC_ZONE_DOTNET +#define PDNS_RPC_ZONE_DOTNET DNS_RPC_ZONE_DOTNET* + + /* Zone enumeration */ + typedef struct { + [range(0,500000)] DWORD dwZoneCount; + [size_is(dwZoneCount)] PDNS_RPC_ZONE_W2K ZoneArray[]; + } + DNS_RPC_ZONE_LIST_W2K; + + typedef struct { + DWORD dwRpcStructureVersion; + DWORD dwReserved0; + [range(0,500000)] DWORD dwZoneCount; + [size_is(dwZoneCount)] PDNS_RPC_ZONE_DOTNET ZoneArray[]; + } + DNS_RPC_ZONE_LIST_DOTNET; +#define DNS_RPC_ZONE_LIST DNS_RPC_ZONE_LIST_DOTNET + + /* Zone information */ + typedef struct { + [string, charset(UTF8)] char * pszZoneName; + DWORD dwZoneType; + BOOL fReverse; + dns_zone_update fAllowUpdate; + DWORD fPaused; + DWORD fShutdown; + DWORD fAutoCreated; + + /* Database info */ + DWORD fUseDatabase; + [string, charset(UTF8)] char * pszDataFile; + + /* Masters */ + PIP4_ARRAY aipMasters; + + /* Secondaries */ + DNS_ZONE_SECONDARY_SECURITY fSecureSecondaries; + DNS_ZONE_NOTIFY_LEVEL fNotifyLevel; + PIP4_ARRAY aipSecondaries; + PIP4_ARRAY aipNotify; + + /* WINS or NetBIOS lookup */ + BOOL fUseWins; + BOOL fUseNbstat; + + /* Aging */ + BOOL fAging; + DWORD dwNoRefreshInterval; + DWORD dwRefreshInterval; + DWORD dwAvailForScavengeTime; + PIP4_ARRAY aipScavengeServers; + + /* save some space, just in case */ + /* avoid versioning issues if possible */ + DWORD pvReserved1; + DWORD pvReserved2; + DWORD pvReserved3; + DWORD pvReserved4; + } + DNS_RPC_ZONE_INFO_W2K; + + typedef struct { + DWORD dwRpcStructureVersion; + DWORD dwReserved0; + + [string, charset(UTF8)] char * pszZoneName; + DWORD dwZoneType; + BOOL fReverse; + dns_zone_update fAllowUpdate; + DWORD fPaused; + DWORD fShutdown; + DWORD fAutoCreated; + + /* Database info */ + DWORD fUseDatabase; + [string, charset(UTF8)] char * pszDataFile; + + /* Masters */ + PIP4_ARRAY aipMasters; + + /* Secondaries */ + DNS_ZONE_SECONDARY_SECURITY fSecureSecondaries; + DNS_ZONE_NOTIFY_LEVEL fNotifyLevel; + PIP4_ARRAY aipSecondaries; + PIP4_ARRAY aipNotify; + + /* WINS or NetBIOS lookup */ + BOOL fUseWins; + BOOL fUseNbstat; + + /* Aging */ + BOOL fAging; + DWORD dwNoRefreshInterval; + DWORD dwRefreshInterval; + DWORD dwAvailForScavengeTime; + PIP4_ARRAY aipScavengeServers; + + /* Forwarder zones */ + DWORD dwForwarderTimeout; + DWORD fForwarderSlave; + + /* Stub zones */ + PIP4_ARRAY aipLocalMasters; + + /* Directory partition */ + DWORD dwDpFlags; + [string, charset(UTF8)] char * pszDpFqdn; + [string, charset(UTF16)] wchar_t * pwszZoneDn; + + /* Xfr time information */ + DWORD dwLastSuccessfulSoaCheck; + DWORD dwLastSuccessfulXfr; + + /* save some space, just in case */ + DWORD dwReserved1; + DWORD dwReserved2; + DWORD dwReserved3; + DWORD dwReserved4; + DWORD dwReserved5; + [string, charset(UTF8)] char * pReserved1; + [string, charset(UTF8)] char * pReserved2; + [string, charset(UTF8)] char * pReserved3; + [string, charset(UTF8)] char * pReserved4; + } + DNS_RPC_ZONE_INFO_DOTNET; + + typedef struct { + DWORD dwRpcStructureVersion; + DWORD dwReserved0; + + [string, charset(UTF8)] char * pszZoneName; + DWORD dwZoneType; + BOOL fReverse; + dns_zone_update fAllowUpdate; + DWORD fPaused; + DWORD fShutdown; + DWORD fAutoCreated; + + /* Database info */ + DWORD fUseDatabase; + [string, charset(UTF8)] char * pszDataFile; + + /* Masters */ + PDNS_ADDR_ARRAY aipMasters; + + /* Secondaries */ + DNS_ZONE_SECONDARY_SECURITY fSecureSecondaries; + DNS_ZONE_NOTIFY_LEVEL fNotifyLevel; + PDNS_ADDR_ARRAY aipSecondaries; + PDNS_ADDR_ARRAY aipNotify; + + /* WINS or NetBIOS lookup */ + BOOL fUseWins; + BOOL fUseNbstat; + + /* Aging */ + BOOL fAging; + DWORD dwNoRefreshInterval; + DWORD dwRefreshInterval; + DWORD dwAvailForScavengeTime; + PDNS_ADDR_ARRAY aipScavengeServers; + + /* Forwarder zones */ + DWORD dwForwarderTimeout; + DWORD fForwarderSlave; + + /* Stub zones */ + PDNS_ADDR_ARRAY aipLocalMasters; + + /* Directory partition */ + DWORD dwDpFlags; + [string, charset(UTF8)] char * pszDpFqdn; + [string, charset(UTF16)] wchar_t * pwszZoneDn; + /* Xfr time information */ + DWORD dwLastSuccessfulSoaCheck; + DWORD dwLastSuccessfulXfr; + + DWORD fQueuedForBackgroundLoad; + DWORD fBackgroundLoadInProgress; + BOOL fReadOnlyZone; + + /* Additional zone transfer information */ + DWORD dwLastXfrAttempt; + DWORD dwLastXfrResult; + } + DNS_RPC_ZONE_INFO_LONGHORN; +#define DNS_RPC_ZONE_INFO DNS_RPC_ZONE_INFO_LONGHORN + + /* Zone property data */ + typedef struct { + DNS_ZONE_SECONDARY_SECURITY fSecureSecondaries; + DNS_ZONE_NOTIFY_LEVEL fNotifyLevel; + PIP4_ARRAY aipSecondaries; + PIP4_ARRAY aipNotify; + } + DNS_RPC_ZONE_SECONDARIES_W2K; + + typedef struct { + DWORD dwRpcStructureVersion; + DWORD dwReserved0; + + DNS_ZONE_SECONDARY_SECURITY fSecureSecondaries; + DNS_ZONE_NOTIFY_LEVEL fNotifyLevel; + PIP4_ARRAY aipSecondaries; + PIP4_ARRAY aipNotify; + } + DNS_RPC_ZONE_SECONDARIES_DOTNET; + + typedef struct { + DWORD dwRpcStructureVersion; + DWORD dwReserved0; + + DNS_ZONE_SECONDARY_SECURITY fSecureSecondaries; + DNS_ZONE_NOTIFY_LEVEL fNotifyLevel; + PDNS_ADDR_ARRAY aipSecondaries; + PDNS_ADDR_ARRAY aipNotify; + } + DNS_RPC_ZONE_SECONDARIES_LONGHORN; +#define DNS_RPC_ZONE_SECONDARIES DNS_RPC_ZONE_SECONDARIES_LONGHORN + + /* Zone database */ + typedef struct { + DWORD fDsIntegrated; + [string, charset(UTF8)] char * pszFileName; + } + DNS_RPC_ZONE_DATABASE_W2K; + + typedef struct { + DWORD dwRpcStructureVersion; + DWORD dwReserved0; + + DWORD fDsIntegrated; + [string, charset(UTF8)] char * pszFileName; + } + DNS_RPC_ZONE_DATABASE_DOTNET; +#define DNS_RPC_ZONE_DATABASE DNS_RPC_ZONE_DATABASE_DOTNET + + /* Zone create data */ + typedef struct { + [string, charset(UTF8)] char * pszZoneName; + DWORD dwZoneType; + dns_zone_update fAllowUpdate; + BOOL fAging; + DWORD dwFlags; + + /* Database info */ + + [string, charset(UTF8)] char * pszDataFile; + DWORD fDsIntegrated; + DWORD fLoadExisting; + + /* Admin name (if auto-create SOA) */ + + [string, charset(UTF8)] char * pszAdmin; + + /* Masters (if secondary) */ + + PIP4_ARRAY aipMasters; + + /* Secondaries */ + + PIP4_ARRAY aipSecondaries; + DNS_ZONE_SECONDARY_SECURITY fSecureSecondaries; + DNS_ZONE_NOTIFY_LEVEL fNotifyLevel; + + /* Reserve some space to avoid versioning issues */ + + [string, charset(UTF8)] char * pvReserved1; + [string, charset(UTF8)] char * pvReserved2; + [string, charset(UTF8)] char * pvReserved3; + [string, charset(UTF8)] char * pvReserved4; + [string, charset(UTF8)] char * pvReserved5; + [string, charset(UTF8)] char * pvReserved6; + [string, charset(UTF8)] char * pvReserved7; + [string, charset(UTF8)] char * pvReserved8; + DWORD dwReserved1; + DWORD dwReserved2; + DWORD dwReserved3; + DWORD dwReserved4; + DWORD dwReserved5; + DWORD dwReserved6; + DWORD dwReserved7; + DWORD dwReserved8; + } + DNS_RPC_ZONE_CREATE_INFO_W2K; + + typedef struct { + DWORD dwRpcStructureVersion; + DWORD dwReserved0; + + [string, charset(UTF8)] char * pszZoneName; + DWORD dwZoneType; + dns_zone_update fAllowUpdate; + BOOL fAging; + DWORD dwFlags; + + /* Database info */ + + [string, charset(UTF8)] char * pszDataFile; + DWORD fDsIntegrated; + DWORD fLoadExisting; + + /* Admin name (if auto-create SOA) */ + + [string, charset(UTF8)] char * pszAdmin; + + /* Masters (if secondary) */ + + PIP4_ARRAY aipMasters; + + /* Secondaries */ + + PIP4_ARRAY aipSecondaries; + DNS_ZONE_SECONDARY_SECURITY fSecureSecondaries; + DNS_ZONE_NOTIFY_LEVEL fNotifyLevel; + + /* Forwarder zones */ + + DWORD dwTimeout; + DWORD fRecurseAfterForwarding; + + /* Directory partition */ + + DWORD dwDpFlags; /* specify built-in DP or */ + [string, charset(UTF8)] char * pszDpFqdn; /* UTF8 FQDN of partition */ + + DWORD dwReserved[ 32 ]; + } + DNS_RPC_ZONE_CREATE_INFO_DOTNET; + + typedef struct { + DWORD dwRpcStructureVersion; + DWORD dwReserved0; + + [string, charset(UTF8)] char * pszZoneName; + DWORD dwZoneType; + dns_zone_update fAllowUpdate; + BOOL fAging; + DWORD dwFlags; + + /* Database info */ + + [string, charset(UTF8)] char * pszDataFile; + DWORD fDsIntegrated; + DWORD fLoadExisting; + + /* Admin name (if auto-create SOA) */ + + [string, charset(UTF8)] char * pszAdmin; + + /* Masters (if secondary) */ + + PDNS_ADDR_ARRAY aipMasters; + + /* Secondaries */ + + PDNS_ADDR_ARRAY aipSecondaries; + DNS_ZONE_SECONDARY_SECURITY fSecureSecondaries; + DNS_ZONE_NOTIFY_LEVEL fNotifyLevel; + + /* Forwarder zones */ + + DWORD dwTimeout; + DWORD fRecurseAfterForwarding; + + /* Directory partition */ + + DWORD dwDpFlags; /* specify built-in DP or */ + [string, charset(UTF8)] char * pszDpFqdn; /* UTF8 FQDN of partition */ + + DWORD dwReserved[ 32 ]; + } + DNS_RPC_ZONE_CREATE_INFO_LONGHORN; +#define DNS_RPC_ZONE_CREATE_INFO DNS_RPC_ZONE_CREATE_INFO_LONGHORN + + /* Zone export */ + typedef struct { + DWORD dwRpcStructureVersion; + DWORD dwReserved0; + + [string, charset(UTF8)] char * pszZoneExportFile; + } + DNS_RPC_ZONE_EXPORT_INFO; + + typedef struct { + DWORD dwRpcStructureVersion; + DWORD dwReserved0; + + DWORD dwFilter; + [string, charset(UTF8)] char * pszPartitionFqdn; + [string, charset(UTF8)] char * pszQueryString; + + DNS_EXTENSION pszReserved[ 6 ]; + } + DNS_RPC_ENUM_ZONES_FILTER; + + /* Forwarders information */ + typedef struct { + DWORD fRecurseAfterForwarding; + DWORD dwForwardTimeout; + PIP4_ARRAY aipForwarders; + } + DNS_RPC_FORWARDERS_W2K; + + typedef struct { + DWORD dwRpcStructureVersion; + DWORD dwReserved0; + DWORD fRecurseAfterForwarding; + DWORD dwForwardTimeout; + PIP4_ARRAY aipForwarders; + } + DNS_RPC_FORWARDERS_DOTNET; + + typedef struct { + DWORD dwRpcStructureVersion; + DWORD dwReserved0; + DWORD fRecurseAfterForwarding; + DWORD dwForwardTimeout; + PDNS_ADDR_ARRAY aipForwarders; + } + DNS_RPC_FORWARDERS_LONGHORN; +#define DNS_RPC_FORWARDERS DNS_RPC_FORWARDERS_LONGHORN + + + /* */ + /* DNS autoconfig data types */ + /* */ + + typedef [v1_enum] enum { + DNS_RPC_AUTOCONFIG_INTERNAL_ROOTHINTS = 0x00000001, + DNS_RPC_AUTOCONFIG_INTERNAL_FORWARDERS = 0x00000002, + DNS_RPC_AUTOCONFIG_INTERNAL_ZONES = 0x00000004, + DNS_RPC_AUTOCONFIG_INTERNAL_SELFPOINT = 0x00000010, + DNS_RPC_AUTOCONFIG_INTERNAL_SELFPOINT_PREPEND = 0x00000020, + DNS_RPC_AUTOCONFIG_INTERNAL_SELFPOINT_APPEND = 0x00000040, + DNS_RPC_AUTOCONFIG_INTERNAL_RETURN_ERROR = 0x00008000, + DNS_RPC_AUTOCONFIG_ALL = 0xFFFFFFFF + } + DNS_RPC_AUTOCONFIG; + + typedef struct { + DWORD dwRpcStructureVersion; + DWORD dwReserved0; + DNS_RPC_AUTOCONFIG dwAutoConfigFlags; + DWORD dwReserved1; + [string, charset(UTF8)] char * pszNewDomainName; + } + DNS_RPC_AUTOCONFIGURE; + + + /* */ + /* DNS logging data types */ + /* */ + + typedef [bitmap32bit] bitmap { + DNS_EVENT_LOG_SUCCESS = 0x00000000, + DNS_EVENT_LOG_ERROR_TYPE = 0x00000001, + DNS_EVENT_LOG_WARNING_TYPE = 0x00000002, + DNS_EVENT_LOG_INFORMATION_TYPE = 0x00000004 + } + DNS_EVENT_LOG_TYPES; + + typedef [bitmap32bit] bitmap { + DNS_RPC_VIEW_AUTHORITY_DATA = 0x00000001, + DNS_RPC_VIEW_CACHE_DATA = 0x00000002, + DNS_RPC_VIEW_GLUE_DATA = 0x00000004, + DNS_RPC_VIEW_ROOT_HINT_DATA = 0x00000008, + DNS_RPC_VIEW_ADDITIONAL_DATA = 0x00000010, + DNS_RPC_VIEW_NO_CHILDREN = 0x00010000, + DNS_RPC_VIEW_ONLY_CHILDREN = 0x00020000 + } + DNS_SELECT_FLAGS; + + + /* */ + /* DNS statistics data types */ + /* */ + + typedef struct { + DWORD StatId; + WORD wLength; + BOOLEAN fClear; + UCHAR fReserved; + } + DNSSRV_STAT_HEADER; + + typedef struct { + DNSSRV_STAT_HEADER Header; + BYTE Buffer[1]; + } + DNSSRV_STAT; + + + /* */ + /* DNS Typid and Union of all RPC data types */ + /* */ + + typedef [v1_enum] enum { + DNSSRV_TYPEID_NULL = 0, + DNSSRV_TYPEID_DWORD = 1, + DNSSRV_TYPEID_LPSTR = 2, + DNSSRV_TYPEID_LPWSTR = 3, + DNSSRV_TYPEID_IPARRAY = 4, + DNSSRV_TYPEID_BUFFER = 5, + DNSSRV_TYPEID_SERVER_INFO_W2K = 6, + DNSSRV_TYPEID_STATS = 7, + DNSSRV_TYPEID_FORWARDERS_W2K = 8, + DNSSRV_TYPEID_ZONE_W2K = 9, + DNSSRV_TYPEID_ZONE_INFO_W2K = 10, + DNSSRV_TYPEID_ZONE_SECONDARIES_W2K = 11, + DNSSRV_TYPEID_ZONE_DATABASE_W2K = 12, + DNSSRV_TYPEID_ZONE_TYPE_RESET_W2K = 13, + DNSSRV_TYPEID_ZONE_CREATE_W2K = 14, + DNSSRV_TYPEID_NAME_AND_PARAM = 15, + DNSSRV_TYPEID_ZONE_LIST_W2K = 16, + DNSSRV_TYPEID_ZONE_RENAME = 17, + DNSSRV_TYPEID_ZONE_EXPORT = 18, + DNSSRV_TYPEID_SERVER_INFO_DOTNET = 19, + DNSSRV_TYPEID_FORWARDERS_DOTNET = 20, + DNSSRV_TYPEID_ZONE = 21, + DNSSRV_TYPEID_ZONE_INFO_DOTNET = 22, + DNSSRV_TYPEID_ZONE_SECONDARIES_DOTNET = 23, + DNSSRV_TYPEID_ZONE_DATABASE = 24, + DNSSRV_TYPEID_ZONE_TYPE_RESET_DOTNET = 25, + DNSSRV_TYPEID_ZONE_CREATE_DOTNET = 26, + DNSSRV_TYPEID_ZONE_LIST = 27, + DNSSRV_TYPEID_DP_ENUM = 28, + DNSSRV_TYPEID_DP_INFO = 29, + DNSSRV_TYPEID_DP_LIST = 30, + DNSSRV_TYPEID_ENLIST_DP = 31, + DNSSRV_TYPEID_ZONE_CHANGE_DP = 32, + DNSSRV_TYPEID_ENUM_ZONES_FILTER = 33, + DNSSRV_TYPEID_ADDRARRAY = 34, + DNSSRV_TYPEID_SERVER_INFO = 35, + DNSSRV_TYPEID_ZONE_INFO = 36, + DNSSRV_TYPEID_FORWARDERS = 37, + DNSSRV_TYPEID_ZONE_SECONDARIES = 38, + DNSSRV_TYPEID_ZONE_TYPE_RESET = 39, + DNSSRV_TYPEID_ZONE_CREATE = 40, + DNSSRV_TYPEID_IP_VALIDATE = 41, + DNSSRV_TYPEID_AUTOCONFIGURE = 42, + DNSSRV_TYPEID_UTF8_STRING_LIST = 43, + DNSSRV_TYPEID_UNICODE_STRING_LIST = 44 + } + DNS_RPC_TYPEID; + + typedef [switch_type(uint3264)] union { + [case(DNSSRV_TYPEID_NULL)] PBYTE Null; + + [case(DNSSRV_TYPEID_DWORD)] DWORD Dword; + + [case(DNSSRV_TYPEID_LPSTR)] [string, charset(UTF8)] char * String; + + [case(DNSSRV_TYPEID_LPWSTR)] [string, charset(UTF16)] wchar_t * WideString; + + [case(DNSSRV_TYPEID_IPARRAY)] IP4_ARRAY *IpArray; + + [case(DNSSRV_TYPEID_BUFFER)] + DNS_RPC_BUFFER *Buffer; + + [case(DNSSRV_TYPEID_SERVER_INFO_W2K)] + DNS_RPC_SERVER_INFO_W2K *ServerInfoW2K; + + [case(DNSSRV_TYPEID_STATS)] + DNSSRV_STAT *Stats; + + [case(DNSSRV_TYPEID_FORWARDERS_W2K)] + DNS_RPC_FORWARDERS_W2K *ForwardersW2K; + + [case(DNSSRV_TYPEID_ZONE_W2K)] + DNS_RPC_ZONE_W2K *ZoneW2K; + + [case(DNSSRV_TYPEID_ZONE_INFO_W2K)] + DNS_RPC_ZONE_INFO_W2K *ZoneInfoW2K; + + [case(DNSSRV_TYPEID_ZONE_SECONDARIES_W2K)] + DNS_RPC_ZONE_SECONDARIES_W2K *SecondariesW2K; + + [case(DNSSRV_TYPEID_ZONE_DATABASE_W2K)] + DNS_RPC_ZONE_DATABASE_W2K *DatabaseW2K; + + [case(DNSSRV_TYPEID_ZONE_CREATE_W2K)] + DNS_RPC_ZONE_CREATE_INFO_W2K *ZoneCreateW2K; + + [case(DNSSRV_TYPEID_NAME_AND_PARAM)] + DNS_RPC_NAME_AND_PARAM *NameAndParam; + + [case(DNSSRV_TYPEID_ZONE_LIST_W2K)] + DNS_RPC_ZONE_LIST_W2K *ZoneListW2K; + + [case(DNSSRV_TYPEID_SERVER_INFO_DOTNET)] + DNS_RPC_SERVER_INFO_DOTNET *ServerInfoDotNet; + + [case(DNSSRV_TYPEID_FORWARDERS_DOTNET)] + DNS_RPC_FORWARDERS_DOTNET *ForwardersDotNet; + + [case(DNSSRV_TYPEID_ZONE)] + DNS_RPC_ZONE *Zone; + + [case(DNSSRV_TYPEID_ZONE_INFO_DOTNET)] + DNS_RPC_ZONE_INFO_DOTNET *ZoneInfoDotNet; + + [case(DNSSRV_TYPEID_ZONE_SECONDARIES_DOTNET)] + DNS_RPC_ZONE_SECONDARIES_DOTNET *SecondariesDotNet; + + [case(DNSSRV_TYPEID_ZONE_DATABASE)] + DNS_RPC_ZONE_DATABASE *Database; + + [case(DNSSRV_TYPEID_ZONE_CREATE_DOTNET)] + DNS_RPC_ZONE_CREATE_INFO_DOTNET *ZoneCreateDotNet; + + [case(DNSSRV_TYPEID_ZONE_LIST)] + DNS_RPC_ZONE_LIST *ZoneList; + + [case(DNSSRV_TYPEID_ZONE_EXPORT)] + DNS_RPC_ZONE_EXPORT_INFO *ZoneExport; + + [case(DNSSRV_TYPEID_DP_INFO)] + DNS_RPC_DP_INFO *DirectoryPartition; + + [case(DNSSRV_TYPEID_DP_ENUM)] + DNS_RPC_DP_ENUM *DirectoryPartitionEnum; + + [case(DNSSRV_TYPEID_DP_LIST)] + DNS_RPC_DP_LIST *DirectoryPartitionList; + + [case(DNSSRV_TYPEID_ENLIST_DP)] + DNS_RPC_ENLIST_DP *EnlistDirectoryPartition; + + [case(DNSSRV_TYPEID_ZONE_CHANGE_DP)] + DNS_RPC_ZONE_CHANGE_DP *ZoneChangeDirectoryPartition; + + [case(DNSSRV_TYPEID_ENUM_ZONES_FILTER)] + DNS_RPC_ENUM_ZONES_FILTER *EnumZonesFilter; + + [case(DNSSRV_TYPEID_ADDRARRAY)] + DNS_ADDR_ARRAY *AddrArray; + + [case(DNSSRV_TYPEID_SERVER_INFO)] + DNS_RPC_SERVER_INFO *ServerInfo; + + [case(DNSSRV_TYPEID_ZONE_CREATE)] + DNS_RPC_ZONE_CREATE_INFO *ZoneCreate; + + [case(DNSSRV_TYPEID_FORWARDERS)] + DNS_RPC_FORWARDERS *Forwarders; + + [case(DNSSRV_TYPEID_ZONE_SECONDARIES)] + DNS_RPC_ZONE_SECONDARIES *Secondaries; + + [case(DNSSRV_TYPEID_IP_VALIDATE)] + DNS_RPC_IP_VALIDATE *IpValidate; + + [case(DNSSRV_TYPEID_ZONE_INFO)] + DNS_RPC_ZONE_INFO *ZoneInfo; + + [case(DNSSRV_TYPEID_AUTOCONFIGURE)] + DNS_RPC_AUTOCONFIGURE *AutoConfigure; + + [case(DNSSRV_TYPEID_UTF8_STRING_LIST)] + DNS_RPC_UTF8_STRING_LIST *Utf8StringList; + } DNSSRV_RPC_UNION; + + + /* */ + /* DNS RPC interface */ + /* */ + + typedef [public,gensize] struct { + [value((12+ndr_size_DNS_RPC_NAME(&dnsNodeName,0)+3) & ~3)] uint16 wLength; + uint16 wRecordCount; + uint32 dwFlags; + uint32 dwChildCount; + DNS_RPC_NAME dnsNodeName; + DNS_RPC_RECORD records[wRecordCount]; + } DNS_RPC_RECORDS; + + typedef [public,nopull,nopush,gensize] struct { + uint32 count; + DNS_RPC_RECORDS rec[count]; + } DNS_RPC_RECORDS_ARRAY; + + WERROR DnssrvOperation( + [in,unique,string,charset(UTF16)] uint16 *pwszServerName, + [in,unique,string,charset(UTF8)] uint8 *pszZone, + [in] DWORD dwContext, + [in,unique,string,charset(UTF8)] uint8 *pszOperation, + [in] DNS_RPC_TYPEID dwTypeId, + [in, switch_is(dwTypeId)] DNSSRV_RPC_UNION pData + ); + + WERROR DnssrvQuery( + [in,unique,string,charset(UTF16)] uint16 *pwszServerName, + [in,unique,string,charset(UTF8)] uint8 *pszZone, + [in,unique,string,charset(UTF8)] uint8 *pszOperation, + [out] DNS_RPC_TYPEID *pdwTypeId, + [out, switch_is(*pdwTypeId)] DNSSRV_RPC_UNION *ppData + ); + + WERROR DnssrvComplexOperation( + [in,unique,string,charset(UTF16)] uint16 *pwszServerName, + [in,unique,string,charset(UTF8)] uint8 *pszZone, + [in,unique,string,charset(UTF8)] uint8 *pszOperation, + [in] DNS_RPC_TYPEID dwTypeIn, + [in, switch_is(dwTypeIn)] DNSSRV_RPC_UNION pDataIn, + [out] DNS_RPC_TYPEID *pdwTypeOut, + [out, switch_is(*pdwTypeOut)] DNSSRV_RPC_UNION *ppDataOut + ); + + WERROR DnssrvEnumRecords( + [in,unique,string,charset(UTF16)] uint16 *pwszServerName, + [in,unique,string,charset(UTF8)] uint8 *pszZone, + [in,unique,string,charset(UTF8)] uint8 *pszNodeName, + [in,unique,string,charset(UTF8)] uint8 *pszStartChild, + [in] dns_record_type wRecordType, + [in] DNS_SELECT_FLAGS fSelectFlag, + [in,unique,string,charset(UTF8)] uint8 *pszFilterStart, + [in,unique,string,charset(UTF8)] uint8 *pszFilterStop, + [out] DWORD *pdwBufferLength, + [out,ref,subcontext(4),subcontext_size(*pdwBufferLength)] DNS_RPC_RECORDS_ARRAY **pBuffer + ); + + WERROR DnssrvUpdateRecord( + [in,unique,string,charset(UTF16)] uint16 *pwszServerName, + [in,unique,string,charset(UTF8)] uint8 *pszZone, + [in,unique,string,charset(UTF8)] uint8 *pszNodeName, + [in, unique] DNS_RPC_RECORD_BUF *pAddRecord, + [in, unique] DNS_RPC_RECORD_BUF *pDeleteRecord + ); + + WERROR DnssrvOperation2( + [in] DNS_RPC_CLIENT_VERSION dwClientVersion, + [in] uint32 dwSettingFlags, + [in,unique,string,charset(UTF16)] uint16 *pwszServerName, + [in,unique,string,charset(UTF8)] uint8 *pszZone, + [in] DWORD dwContext, + [in,unique,string,charset(UTF8)] uint8 *pszOperation, + [in] DNS_RPC_TYPEID dwTypeId, + [in, switch_is(dwTypeId)] DNSSRV_RPC_UNION pData + ); + + WERROR DnssrvQuery2( + [in] DNS_RPC_CLIENT_VERSION dwClientVersion, + [in] uint32 dwSettingFlags, + [in,unique,string,charset(UTF16)] uint16 *pwszServerName, + [in,unique,string,charset(UTF8)] uint8 *pszZone, + [in,unique,string,charset(UTF8)] uint8 *pszOperation, + [out] DNS_RPC_TYPEID *pdwTypeId, + [out, switch_is(*pdwTypeId)] DNSSRV_RPC_UNION *ppData + ); + + WERROR DnssrvComplexOperation2( + [in] DNS_RPC_CLIENT_VERSION dwClientVersion, + [in] uint32 dwSettingFlags, + [in,unique,string,charset(UTF16)] uint16 *pwszServerName, + [in,unique,string,charset(UTF8)] uint8 *pszZone, + [in,unique,string,charset(UTF8)] uint8 *pszOperation, + [in] DNS_RPC_TYPEID dwTypeIn, + [in, switch_is(dwTypeIn)] DNSSRV_RPC_UNION pDataIn, + [out] DNS_RPC_TYPEID *pdwTypeOut, + [out, switch_is(*pdwTypeOut)] DNSSRV_RPC_UNION *ppDataOut + ); + + WERROR DnssrvEnumRecords2( + [in] DNS_RPC_CLIENT_VERSION dwClientVersion, + [in] DWORD dwSettingFlags, + [in,unique,string,charset(UTF16)] uint16 *pwszServerName, + [in,unique,string,charset(UTF8)] uint8 *pszZone, + [in,unique,string,charset(UTF8)] uint8 *pszNodeName, + [in,unique,string,charset(UTF8)] uint8 *pszStartChild, + [in] dns_record_type wRecordType, + [in] DNS_SELECT_FLAGS fSelectFlag, + [in,unique,string,charset(UTF8)] uint8 *pszFilterStart, + [in,unique,string,charset(UTF8)] uint8 *pszFilterStop, + [out] uint32 *pdwBufferLength, + [out,ref,subcontext(4),subcontext_size(*pdwBufferLength)] DNS_RPC_RECORDS_ARRAY **pBuffer + ); + + WERROR DnssrvUpdateRecord2( + [in] DNS_RPC_CLIENT_VERSION dwClientVersion, + [in] uint32 dwSettingFlags, + [in,unique,string,charset(UTF16)] uint16 *pwszServerName, + [in,unique,string,charset(UTF8)] uint8 *pszZone, + [in,string,charset(UTF8)] uint8 *pszNodeName, + [in, unique] DNS_RPC_RECORD_BUF *pAddRecord, + [in, unique] DNS_RPC_RECORD_BUF *pDeleteRecord + ); +} diff --git a/librpc/idl/drsblobs.idl b/librpc/idl/drsblobs.idl new file mode 100644 index 0000000..9d49569 --- /dev/null +++ b/librpc/idl/drsblobs.idl @@ -0,0 +1,680 @@ +#include "idl_types.h" + +import "drsuapi.idl", "misc.idl", "samr.idl", "lsa.idl", "security.idl"; + +[ + uuid("12345778-1234-abcd-0001-00000001"), + version(0.0), + pointer_default(unique), + helper("../librpc/ndr/ndr_drsblobs.h"), + helpstring("Active Directory Replication LDAP Blobs") +] +interface drsblobs { + typedef bitmap drsuapi_DrsOptions drsuapi_DrsOptions; + typedef [v1_enum] enum drsuapi_DsAttributeId drsuapi_DsAttributeId; + typedef [v1_enum] enum lsa_TrustAuthType lsa_TrustAuthType; + /* + * replPropertyMetaData + * w2k uses version 1 + * w2k3 uses version 1 + * + * Also equivalent to + * MS-DRSR 4.1.10.2.22 PROPERTY_META_DATA + */ + typedef [public] struct { + drsuapi_DsAttributeId attid; + uint32 version; + NTTIME_1sec originating_change_time; + GUID originating_invocation_id; + hyper originating_usn; + hyper local_usn; + } replPropertyMetaData1; + + typedef struct { + uint32 count; + [value(0)] uint32 reserved; + replPropertyMetaData1 array[count]; + } replPropertyMetaDataCtr1; + + typedef [nodiscriminant] union { + [case(1)] replPropertyMetaDataCtr1 ctr1; + } replPropertyMetaDataCtr; + + typedef [public] struct { + uint32 version; + [value(0)] uint32 reserved; + [switch_is(version)] replPropertyMetaDataCtr ctr; + } replPropertyMetaDataBlob; + + /* + * replUpToDateVector + * w2k uses version 1 + * w2k3 uses version 2 + */ + typedef struct { + uint32 count; + [value(0)] uint32 reserved; + drsuapi_DsReplicaCursor cursors[count]; + } replUpToDateVectorCtr1; + + typedef struct { + uint32 count; + [value(0)] uint32 reserved; + drsuapi_DsReplicaCursor2 cursors[count]; + } replUpToDateVectorCtr2; + + typedef [nodiscriminant] union { + [case(1)] replUpToDateVectorCtr1 ctr1; + [case(2)] replUpToDateVectorCtr2 ctr2; + } replUpToDateVectorCtr; + + typedef [public] struct { + uint32 version; + [value(0)] uint32 reserved; + [switch_is(version)] replUpToDateVectorCtr ctr; + } replUpToDateVectorBlob; + + /* + * repsFrom/repsTo + * w2k uses version 1 + * w2k3 uses version 1 + * w2k8 uses version 2 + */ + typedef [public,gensize] struct { + [value(strlen(dns_name)+1)] uint32 __dns_name_size; + [charset(DOS)] uint8 dns_name[__dns_name_size]; + } repsFromTo1OtherInfo; + + typedef [public,gensize,flag(NDR_PAHEX)] struct { + /* this includes the 8 bytes of the repsFromToBlob header */ + [value(ndr_size_repsFromTo1(this, ndr->flags)+8)] uint32 blobsize; + uint32 consecutive_sync_failures; + NTTIME_1sec last_success; + NTTIME_1sec last_attempt; + WERROR result_last_attempt; + [relative] repsFromTo1OtherInfo *other_info; + [value(ndr_size_repsFromTo1OtherInfo(other_info, ndr->flags))] uint32 other_info_length; + drsuapi_DrsOptions replica_flags; + uint8 schedule[84]; + [value(0)] uint32 reserved; + drsuapi_DsReplicaHighWaterMark highwatermark; + GUID source_dsa_obj_guid; /* the 'objectGuid' field of the CN=NTDS Settings object */ + GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */ + GUID transport_guid; + } repsFromTo1; + + typedef [public,relative_base,gensize] struct { + [value(ndr_size_repsFromTo2OtherInfo(this,ndr->flags))] + uint32 __ndr_size; + [relative] nstring *dns_name1; + uint32 unknown1; + [relative] nstring *dns_name2; + hyper unknown2; + } repsFromTo2OtherInfo; + + typedef [public,gensize,flag(NDR_PAHEX)] struct { + /* this includes the 8 bytes of the repsFromToBlob header */ + [value(ndr_size_repsFromTo2(this, ndr->flags)+8)] uint32 blobsize; + uint32 consecutive_sync_failures; + NTTIME_1sec last_success; + NTTIME_1sec last_attempt; + WERROR result_last_attempt; + [relative] repsFromTo2OtherInfo *other_info; + [value(ndr_size_repsFromTo2OtherInfo(other_info, ndr->flags))] uint32 other_info_length; + drsuapi_DrsOptions replica_flags; + uint8 schedule[84]; + [value(0)] uint32 reserved; + drsuapi_DsReplicaHighWaterMark highwatermark; + GUID source_dsa_obj_guid; /* the 'objectGuid' field of the CN=NTDS Settings object */ + GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */ + GUID transport_guid; + hyper unknown1; + } repsFromTo2; + + typedef [nodiscriminant] union { + [case(1)] repsFromTo1 ctr1; + [case(2)] repsFromTo2 ctr2; + } repsFromTo; + + typedef [public] struct { + uint32 version; + [value(0)] uint32 reserved; + [switch_is(version)] repsFromTo ctr; + } repsFromToBlob; + + /* Replication schedule structures as defined in MS-ADTS 7.1.4.5 + * Appears as attribute of NTDSConnection object + */ + typedef [public] struct { + [value(0)] uint32 type; /* always 0 */ + uint32 offset; + } scheduleHeader; + + typedef [public] struct { + uint8 slots[168]; + } scheduleSlots; + + typedef [public] struct { + uint32 size; + [value(0)] uint32 bandwidth; /* ignored */ + uint32 numberOfSchedules; /* typically 1 */ + scheduleHeader headerArray[numberOfSchedules]; + scheduleSlots dataArray[numberOfSchedules]; + } schedule; + + /* + * partialAttributeSet + * w2k uses version 1 + * w2k3 uses version 1 + */ + typedef struct { + uint32 count; + drsuapi_DsAttributeId array[count]; + } partialAttributeSetCtr1; + + typedef [nodiscriminant] union { + [case(1)] partialAttributeSetCtr1 ctr1; + } partialAttributeSetCtr; + + typedef [public] struct { + uint32 version; + [value(0)] uint32 reserved; + [switch_is(version)] partialAttributeSetCtr ctr; + } partialAttributeSetBlob; + + /* + * schemaInfo attribute + * + * Used as an attribute on Schema. + * Also during replication as part of + * prefixMap to identify what revision + * of Schema source DC has + */ + typedef [public,flag(NDR_NOALIGN)] struct { + [value(0xFF)] uint8 marker; + [flag(NDR_BIG_ENDIAN)] uint32 revision; + GUID invocation_id; + } schemaInfoBlob; + + + /* + * MS w2k3 and w2k8 prefixMap format + * There is no version number. Format is: + * uint32 - number of entries in the map + * uint32 - total bytes that structure occupies + * ENTRIES: + * uint16 - prefix ID (OID's last sub-id encoded. see prefixMap) + * uint16 - number of bytes in prefix N + * uint8[N] - BER encoded prefix + */ + typedef [noprint,flag(NDR_NOALIGN)] struct { + uint16 entryID; + uint16 length; + uint8 binary_oid[length]; + } drsuapi_MSPrefixMap_Entry; + + typedef [public,gensize] struct { + uint32 num_entries; + [value(ndr_size_drsuapi_MSPrefixMap_Ctr(r, ndr->flags))] uint32 __ndr_size; + drsuapi_MSPrefixMap_Entry entries[num_entries]; + } drsuapi_MSPrefixMap_Ctr; + + /* + * prefixMap + * w2k unknown + * w2k3 unknown + * samba4 uses 0x44534442 'DSDB' + * + * as we windows don't return the prefixMap attribute when you ask for + * we don't know the format, but the attribute is not replicated + * so that we can choose our own format... + */ + typedef [v1_enum] enum { + PREFIX_MAP_VERSION_DSDB = 0x44534442 + } prefixMapVersion; + + typedef [nodiscriminant] union { + [case(PREFIX_MAP_VERSION_DSDB)] drsuapi_DsReplicaOIDMapping_Ctr dsdb; + } prefixMapCtr; + + typedef [public] struct { + prefixMapVersion version; + [value(0)] uint32 reserved; + [switch_is(version)] prefixMapCtr ctr; + } prefixMapBlob; + + /* + * the cookie for the LDAP dirsync control + */ + typedef [nodiscriminant,gensize] union { + [case(0)]; + [default] replUpToDateVectorBlob uptodateness_vector; + } ldapControlDirSyncExtra; + + typedef struct { + [value(3)] uint32 u1; + NTTIME time; + uint32 u2; + uint32 u3; + [value(ndr_size_ldapControlDirSyncExtra(&extra, extra.uptodateness_vector.version, 0))] + uint32 extra_length; + drsuapi_DsReplicaHighWaterMark highwatermark; + GUID guid1; + [switch_is(extra_length)] ldapControlDirSyncExtra extra; + } ldapControlDirSyncBlob; + + typedef [public,relative_base] struct { + [charset(DOS),value("MSDS")] uint8 msds[4]; + [subcontext(0)] ldapControlDirSyncBlob blob; + } ldapControlDirSyncCookie; + + typedef [public] struct { + [value(2*strlen_m(name))] uint16 name_len; + [value(strlen(data))] uint16 data_len; + uint16 reserved; /* 2 for 'Packages', 1 for 'Primary:*', but should be ignored */ + [charset(UTF16)] uint8 name[name_len]; + /* + * the data field contains data as HEX strings + * + * 'Packages': + * data contains the list of packages + * as non termiated UTF16 strings with + * a UTF16 NULL byte as separator + * + * 'Primary:Kerberos-Newer-Keys': + * ... + * + * 'Primary:Kerberos': + * ... + * + * 'Primary:WDigest': + * ... + * + * 'Primary:CLEARTEXT': + * data contains the cleartext password + * as UTF16 string encoded as HEX string + * + * 'Primary:userPassword': + * ... + * + * 'Primary:SambaGPG': + * ... + * + * 'Primary:NTLM-Strong-NTOWF': + * ... Not yet implemented. + * + */ + [charset(DOS)] uint8 data[data_len]; + } supplementalCredentialsPackage; + + /* this are 0x30 (48) whitespaces (0x20) */ + const string SUPPLEMENTAL_CREDENTIALS_PREFIX = " "; + + typedef [flag(NDR_PAHEX),public] enum { + SUPPLEMENTAL_CREDENTIALS_SIGNATURE = 0x0050 + } supplementalCredentialsSignature; + + typedef [gensize,nopush,nopull] struct { + [value(SUPPLEMENTAL_CREDENTIALS_PREFIX),charset(UTF16)] uint16 prefix[0x30]; + [value(SUPPLEMENTAL_CREDENTIALS_SIGNATURE)] supplementalCredentialsSignature signature; + uint16 num_packages; + supplementalCredentialsPackage packages[num_packages]; + } supplementalCredentialsSubBlob; + + typedef [public] struct { + [value(0)] uint32 unknown1; + [value(ndr_size_supplementalCredentialsSubBlob(&sub, ndr->flags))] uint32 __ndr_size; + [value(0)] uint32 unknown2; + [subcontext(0),subcontext_size(__ndr_size)] supplementalCredentialsSubBlob sub; + [value(0)] uint8 unknown3; + } supplementalCredentialsBlob; + + typedef [public] struct { + [flag(STR_NOTERM|NDR_REMAINING)] string_array names; + } package_PackagesBlob; + + typedef struct { + [value(2*strlen_m(string))] uint16 length; + [value(2*strlen_m(string))] uint16 size; + [relative,subcontext(0),subcontext_size(size),flag(STR_NOTERM|NDR_REMAINING)] string *string; + } package_PrimaryKerberosString; + + typedef struct { + [value(0)] uint16 reserved1; + [value(0)] uint16 reserved2; + [value(0)] uint32 reserved3; + uint32 keytype; + [value((value?value->length:0))] uint32 value_len; + [relative,subcontext(0),subcontext_size(value_len),flag(NDR_REMAINING)] DATA_BLOB *value; + } package_PrimaryKerberosKey3; + + typedef struct { + uint16 num_keys; + uint16 num_old_keys; + package_PrimaryKerberosString salt; + package_PrimaryKerberosKey3 keys[num_keys]; + package_PrimaryKerberosKey3 old_keys[num_old_keys]; + [value(0)] uint32 padding1; + [value(0)] uint32 padding2; + [value(0)] uint32 padding3; + [value(0)] uint32 padding4; + [value(0)] uint32 padding5; + } package_PrimaryKerberosCtr3; + + typedef struct { + [value(0)] uint16 reserved1; + [value(0)] uint16 reserved2; + [value(0)] uint32 reserved3; + uint32 iteration_count; + uint32 keytype; + [value((value?value->length:0))] uint32 value_len; + [relative,subcontext(0),subcontext_size(value_len),flag(NDR_REMAINING)] DATA_BLOB *value; + } package_PrimaryKerberosKey4; + + typedef struct { + uint16 num_keys; + [value(0)] uint16 num_service_keys; + uint16 num_old_keys; + uint16 num_older_keys; + package_PrimaryKerberosString salt; + uint32 default_iteration_count; + package_PrimaryKerberosKey4 keys[num_keys]; + package_PrimaryKerberosKey4 service_keys[num_service_keys]; + package_PrimaryKerberosKey4 old_keys[num_old_keys]; + package_PrimaryKerberosKey4 older_keys[num_older_keys]; + } package_PrimaryKerberosCtr4; + + typedef [nodiscriminant] union { + [case(3)] package_PrimaryKerberosCtr3 ctr3; + [case(4)] package_PrimaryKerberosCtr4 ctr4; + } package_PrimaryKerberosCtr; + + typedef [public] struct { + uint16 version; + [value(0)] uint16 flags; + [switch_is(version)] package_PrimaryKerberosCtr ctr; + } package_PrimaryKerberosBlob; + + typedef [public] struct { + [flag(NDR_REMAINING)] DATA_BLOB cleartext; + } package_PrimaryCLEARTEXTBlob; + + typedef [flag(NDR_PAHEX)] struct { + uint8 hash[16]; + } package_PrimaryWDigestHash; + + typedef [public] struct { + [value(0x31)] uint16 unknown1; + [value(0x01)] uint8 unknown2; + uint8 num_hashes; + [value(0)] uint32 unknown3; + [value(0)] udlong uuknown4; + package_PrimaryWDigestHash hashes[num_hashes]; + } package_PrimaryWDigestBlob; + + typedef [public] struct { + [flag(NDR_REMAINING)] DATA_BLOB gpg_blob; + } package_PrimarySambaGPGBlob; + + /* + * Password hashes stored in a scheme compatible with + * OpenLDAP's userPassword attribute. The Package is named + * Primary:userPassword each calculated hash, + * which is typically calculated via crypt(), the scheme is stored. + * The scheme name and the {scheme} format is re-used from OpenLDAP's + * use for userPassword to aid interopability when exported. + * + * The currently supported scheme so far is {CRYPT}, which may + * be specified multiple times if both CryptSHA256 ($5$) and + * CryptSHA512 ($6$) are in use. + * + * current_nt_hash is either the unicodePwd or the + * NTLM-Strong-NTOWF, to allow us to prove this password is + * a valid element. + */ + typedef struct { + [value(2*strlen_m(scheme))] uint16 scheme_len; + [charset(UTF16)] uint8 scheme[scheme_len]; + [value((value?value->length:0))] uint32 value_len; + [relative,subcontext(0),subcontext_size(value_len), + flag(NDR_REMAINING)] DATA_BLOB *value; + } package_PrimaryUserPasswordValue; + + typedef [public] struct { + samr_Password current_nt_hash; + uint16 num_hashes; + package_PrimaryUserPasswordValue hashes[num_hashes]; + } package_PrimaryUserPasswordBlob; + + typedef struct { + [value(0)] uint32 size; + } AuthInfoNone; + + typedef struct { + [value(16)] uint32 size; + samr_Password password; + } AuthInfoNT4Owf; + + /* + * the secret value is encoded as UTF16 if it's a string + * but depending the AuthType, it might also be krb5 trusts have random bytes here, so converting to UTF16 + * mayfail... + * + * TODO: We should try handle the case of a random buffer in all places + * we deal with cleartext passwords from windows + * + * so we don't use this: + * + * uint32 value_len; + * [charset(UTF16)] uint8 value[value_len]; + */ + + typedef struct { + uint32 size; + uint8 password[size]; + } AuthInfoClear; + + typedef struct { + [value(4)] uint32 size; + uint32 version; + } AuthInfoVersion; + + typedef [nodiscriminant] union { + [case(TRUST_AUTH_TYPE_NONE)] AuthInfoNone none; + [case(TRUST_AUTH_TYPE_NT4OWF)] AuthInfoNT4Owf nt4owf; + [case(TRUST_AUTH_TYPE_CLEAR)] AuthInfoClear clear; + [case(TRUST_AUTH_TYPE_VERSION)] AuthInfoVersion version; + } AuthInfo; + + typedef [public] struct { + NTTIME LastUpdateTime; + lsa_TrustAuthType AuthType; + [switch_is(AuthType)] AuthInfo AuthInfo; + [flag(NDR_ALIGN4)] DATA_BLOB _pad; + } AuthenticationInformation; + + /* count is not on the wire */ + typedef [public,nopull,nopush,gensize] struct { + uint32 count; + AuthenticationInformation array[count]; + } AuthenticationInformationArray; + + /* we cannot use [relative] pointers here because Windows expects the + * previous_offset to match the total size of the struct in case + * the previous array is empty, see MS-LSAD 2.2.7.16 - gd */ + typedef [public,gensize,nopush] struct { + uint32 count; + [value((count > 0) ? 12 : 0)] uint32 current_offset; + [value((count > 0) ? 12 + ndr_size_AuthenticationInformationArray(¤t, ndr->flags) : 0)] uint32 previous_offset; + [subcontext(0),subcontext_size((previous_offset)-(current_offset))] AuthenticationInformationArray current; + [subcontext(0)] [flag(NDR_REMAINING)] AuthenticationInformationArray previous; + } trustAuthInOutBlob; + + typedef [public,nopull] struct { + uint8 confounder[512]; + [subcontext(0),subcontext_size(outgoing_size)] trustAuthInOutBlob outgoing; + [subcontext(0),subcontext_size(incoming_size)] trustAuthInOutBlob incoming; + [value(ndr_size_trustAuthInOutBlob(&outgoing, ndr->flags))] uint32 outgoing_size; + [value(ndr_size_trustAuthInOutBlob(&incoming, ndr->flags))] uint32 incoming_size; + } trustDomainPasswords; + + typedef [public] struct { + uint32 marker; + DATA_BLOB data; + } DsCompressedChunk; + + typedef struct { + uint16 __size; + [size_is(__size),charset(DOS)] uint8 *string; + } ExtendedErrorAString; + + typedef struct { + uint16 __size; + [size_is(__size),charset(UTF16)] uint16 *string; + } ExtendedErrorUString; + + typedef struct { + uint16 length; + [size_is(length)] uint8 *data; + } ExtendedErrorBlob; + + typedef enum { + EXTENDED_ERROR_COMPUTER_NAME_PRESENT = 1, + EXTENDED_ERROR_COMPUTER_NAME_NOT_PRESENT= 2 + } ExtendedErrorComputerNamePresent; + + typedef [switch_type(ExtendedErrorComputerNamePresent)] union { + [case(EXTENDED_ERROR_COMPUTER_NAME_PRESENT)] ExtendedErrorUString name; + [case(EXTENDED_ERROR_COMPUTER_NAME_NOT_PRESENT)]; + } ExtendedErrorComputerNameU; + + typedef struct { + ExtendedErrorComputerNamePresent present; + [switch_is(present)] ExtendedErrorComputerNameU n; + } ExtendedErrorComputerName; + + typedef enum { + EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING = 1, + EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING = 2, + EXTENDED_ERROR_PARAM_TYPE_UINT32 = 3, + EXTENDED_ERROR_PARAM_TYPE_UINT16 = 4, + EXTENDED_ERROR_PARAM_TYPE_UINT64 = 5, + EXTENDED_ERROR_PARAM_TYPE_NONE = 6, + EXTENDED_ERROR_PARAM_TYPE_BLOB = 7 + } ExtendedErrorParamType; + + typedef [switch_type(ExtendedErrorParamType)] union { + [case(EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING)] ExtendedErrorAString a_string; + [case(EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING)] ExtendedErrorUString u_string; + [case(EXTENDED_ERROR_PARAM_TYPE_UINT32)] uint32 uint32; + [case(EXTENDED_ERROR_PARAM_TYPE_UINT16)] uint16 uint16; + [case(EXTENDED_ERROR_PARAM_TYPE_UINT64)] hyper uint64; + [case(EXTENDED_ERROR_PARAM_TYPE_NONE)]; + [case(EXTENDED_ERROR_PARAM_TYPE_BLOB)] ExtendedErrorBlob blob; + } ExtendedErrorParamU; + + typedef struct { + ExtendedErrorParamType type; + [switch_is(type)] ExtendedErrorParamU p; + } ExtendedErrorParam; + + typedef [public] struct { + [max_recursion(20000)] ExtendedErrorInfo *next; + ExtendedErrorComputerName computer_name; + hyper pid; + NTTIME time; + uint32 generating_component; + WERROR status; + uint16 detection_location; + uint16 flags; + uint16 num_params; + [size_is(num_params)] ExtendedErrorParam params[]; + } ExtendedErrorInfo; + + typedef struct { + [unique] ExtendedErrorInfo *info; + } ExtendedErrorInfoPtr; + + /* MS-ADTS 7.1.6.9.3 msDS-TrustForestTrustInfo Attribute */ + + typedef struct { + [value(strlen_m(string))] uint32 size; + [charset(UTF8)] uint8 string[size]; + } ForestTrustString; + + typedef [flag(NDR_NOALIGN)] struct { + [value(ndr_size_dom_sid0(&sid, ndr->flags))] uint32 sid_size; + [subcontext(0),subcontext_size(sid_size)] dom_sid sid; + ForestTrustString dns_name; + ForestTrustString netbios_name; + } ForestTrustDataDomainInfo; + + typedef [flag(NDR_NOALIGN)] struct { + uint32 size; + uint8 data[size]; + } ForestTrustDataBinaryData; + + typedef [nodiscriminant] union { + [case(FOREST_TRUST_TOP_LEVEL_NAME)] ForestTrustString name; + [case(FOREST_TRUST_TOP_LEVEL_NAME_EX)] ForestTrustString name; + [case(FOREST_TRUST_DOMAIN_INFO)] ForestTrustDataDomainInfo info; + [default] ForestTrustDataBinaryData data; + } ForestTrustData; + + /* same as lsa_ForestTrustRecordType, but only 8 bit */ + typedef [enum8bit] enum { + FOREST_TRUST_TOP_LEVEL_NAME = LSA_FOREST_TRUST_TOP_LEVEL_NAME, + FOREST_TRUST_TOP_LEVEL_NAME_EX = LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX, + FOREST_TRUST_DOMAIN_INFO = LSA_FOREST_TRUST_DOMAIN_INFO + } ForestTrustInfoRecordType; + + /* meaning of flags depends on record type and values are + the same as in lsa.idl, see collision record types */ + typedef [public,gensize,flag(NDR_NOALIGN)] struct { + lsa_ForestTrustRecordFlags flags; + NTTIME timestamp; + ForestTrustInfoRecordType type; + [switch_is(type)] ForestTrustData data; + } ForestTrustInfoRecord; + + typedef [flag(NDR_NOALIGN)] struct { + [value(ndr_size_ForestTrustInfoRecord(&record, ndr->flags))] uint32 record_size; + ForestTrustInfoRecord record; + } ForestTrustInfoRecordArmor; + + typedef [public,flag(NDR_NOALIGN)] struct { + uint32 version; + uint32 count; + ForestTrustInfoRecordArmor records[count]; + } ForestTrustInfo; + + typedef enum { + ENC_SECRET_AES_128_AEAD = 1 + } EncryptedSecretAlgorithm; + + const uint32 ENCRYPTED_SECRET_MAGIC_VALUE = 0xCA5CADED; + + typedef [public] struct { + DATA_BLOB cleartext; + } PlaintextSecret; + + /* The AEAD routines uses this as the additional authenticated data */ + typedef [public] struct { + uint32 magic; + uint32 version; + uint32 algorithm; + uint32 flags; + } EncryptedSecretHeader; + + typedef [public] struct { + /* + * The iv is before the header to ensure that the first bytes of + * the encrypted values are not predictable. + * We do this so that if the decryption gets disabled, we don't + * end up with predictable unicodePasswords. + */ + DATA_BLOB iv; + EncryptedSecretHeader header; + [flag(NDR_REMAINING)] DATA_BLOB encrypted; + } EncryptedSecret; +} diff --git a/librpc/idl/drsuapi.idl b/librpc/idl/drsuapi.idl new file mode 100644 index 0000000..99fbca6 --- /dev/null +++ b/librpc/idl/drsuapi.idl @@ -0,0 +1,1915 @@ +#include "idl_types.h" + +import "security.idl", "misc.idl", "lsa.idl", "samr.idl"; + +[ + uuid("e3514235-4b06-11d1-ab04-00c04fc2dcd2"), + version(4.0), + endpoint("ncacn_np:[\\pipe\\lsass]","ncacn_np:[\\pipe\\protected_storage]", "ncacn_ip_tcp:", "ncalrpc:"), + authservice("ldap"), + helpstring("Active Directory Replication"), + helper("../librpc/ndr/ndr_drsuapi.h"), + pointer_default(unique) +] +interface drsuapi +{ + typedef bitmap security_GroupAttrs security_GroupAttrs; + + /* see MS-DRSR section 5.39 */ + typedef [public,bitmap32bit] bitmap { + DRSUAPI_DRS_ASYNC_OP = 0x00000001, + DRSUAPI_DRS_GETCHG_CHECK = 0x00000002, + DRSUAPI_DRS_UPDATE_NOTIFICATION = 0x00000002, + DRSUAPI_DRS_ADD_REF = 0x00000004, + DRSUAPI_DRS_SYNC_ALL = 0x00000008, + DRSUAPI_DRS_DEL_REF = 0x00000008, + DRSUAPI_DRS_WRIT_REP = 0x00000010, + DRSUAPI_DRS_INIT_SYNC = 0x00000020, + DRSUAPI_DRS_PER_SYNC = 0x00000040, + DRSUAPI_DRS_MAIL_REP = 0x00000080, + DRSUAPI_DRS_ASYNC_REP = 0x00000100, + DRSUAPI_DRS_IGNORE_ERROR = 0x00000100, + DRSUAPI_DRS_TWOWAY_SYNC = 0x00000200, + DRSUAPI_DRS_CRITICAL_ONLY = 0x00000400, + DRSUAPI_DRS_GET_ANC = 0x00000800, + DRSUAPI_DRS_GET_NC_SIZE = 0x00001000, + DRSUAPI_DRS_LOCAL_ONLY = 0x00001000, + DRSUAPI_DRS_NONGC_RO_REP = 0x00002000, + DRSUAPI_DRS_SYNC_BYNAME = 0x00004000, + DRSUAPI_DRS_REF_OK = 0x00004000, + DRSUAPI_DRS_FULL_SYNC_NOW = 0x00008000, + DRSUAPI_DRS_NO_SOURCE = 0x00008000, + DRSUAPI_DRS_FULL_SYNC_IN_PROGRESS = 0x00010000, + DRSUAPI_DRS_FULL_SYNC_PACKET = 0x00020000, + DRSUAPI_DRS_SYNC_REQUEUE = 0x00040000, + DRSUAPI_DRS_SYNC_URGENT = 0x00080000, + DRSUAPI_DRS_REF_GCSPN = 0x00100000, + DRSUAPI_DRS_NO_DISCARD = 0x00100000, + DRSUAPI_DRS_NEVER_SYNCED = 0x00200000, + DRSUAPI_DRS_SPECIAL_SECRET_PROCESSING = 0x00400000, + DRSUAPI_DRS_INIT_SYNC_NOW = 0x00800000, + DRSUAPI_DRS_PREEMPTED = 0x01000000, + DRSUAPI_DRS_SYNC_FORCED = 0x02000000, + DRSUAPI_DRS_DISABLE_AUTO_SYNC = 0x04000000, + DRSUAPI_DRS_DISABLE_PERIODIC_SYNC = 0x08000000, + DRSUAPI_DRS_USE_COMPRESSION = 0x10000000, + DRSUAPI_DRS_NEVER_NOTIFY = 0x20000000, + DRSUAPI_DRS_SYNC_PAS = 0x40000000, + DRSUAPI_DRS_GET_ALL_GROUP_MEMBERSHIP = 0x80000000 + } drsuapi_DrsOptions; + + typedef [public,bitmap32bit] bitmap { + DRSUAPI_DRS_GET_TGT = 0x00000001 + } drsuapi_DrsMoreOptions; + + /* see DRS_MSG_REPMOD_V1 */ + typedef [public,bitmap32bit] bitmap { + DRSUAPI_DRS_UPDATE_FLAGS = 0x00000001, + DRSUAPI_DRS_UPDATE_ADDRESS = 0x00000002, + DRSUAPI_DRS_UPDATE_SCHEDULE = 0x00000004 + } drsuapi_DrsUpdate; + + /*****************/ + /* Function 0x00 drsuapi_DsBind() */ + + /* MS-DRSR 5.39 DRS_EXTENSIONS_INT */ + typedef [bitmap32bit] bitmap { + DRSUAPI_SUPPORTED_EXTENSION_BASE = 0x00000001, + DRSUAPI_SUPPORTED_EXTENSION_ASYNC_REPLICATION = 0x00000002, + DRSUAPI_SUPPORTED_EXTENSION_REMOVEAPI = 0x00000004, + DRSUAPI_SUPPORTED_EXTENSION_MOVEREQ_V2 = 0x00000008, + DRSUAPI_SUPPORTED_EXTENSION_GETCHG_COMPRESS = 0x00000010, + DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V1 = 0x00000020, + DRSUAPI_SUPPORTED_EXTENSION_RESTORE_USN_OPTIMIZATION = 0x00000040, + DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY = 0x00000080, + DRSUAPI_SUPPORTED_EXTENSION_KCC_EXECUTE = 0x00000100, + DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY_V2 = 0x00000200, + DRSUAPI_SUPPORTED_EXTENSION_LINKED_VALUE_REPLICATION = 0x00000400, + DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V2 = 0x00000800, + DRSUAPI_SUPPORTED_EXTENSION_INSTANCE_TYPE_NOT_REQ_ON_MOD= 0x00001000, + DRSUAPI_SUPPORTED_EXTENSION_CRYPTO_BIND = 0x00002000, + DRSUAPI_SUPPORTED_EXTENSION_GET_REPL_INFO = 0x00004000, + DRSUAPI_SUPPORTED_EXTENSION_STRONG_ENCRYPTION = 0x00008000, + DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V01 = 0x00010000, + DRSUAPI_SUPPORTED_EXTENSION_TRANSITIVE_MEMBERSHIP = 0x00020000, + DRSUAPI_SUPPORTED_EXTENSION_ADD_SID_HISTORY = 0x00040000, + DRSUAPI_SUPPORTED_EXTENSION_POST_BETA3 = 0x00080000, + DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V5 = 0x00100000, + DRSUAPI_SUPPORTED_EXTENSION_GET_MEMBERSHIPS2 = 0x00200000, + DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V6 = 0x00400000, + DRSUAPI_SUPPORTED_EXTENSION_NONDOMAIN_NCS = 0x00800000, + DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8 = 0x01000000, + DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V5 = 0x02000000, + DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V6 = 0x04000000, + /* + * the following 3 have the same value + * repadmin.exe /bind says that + */ + DRSUAPI_SUPPORTED_EXTENSION_ADDENTRYREPLY_V3 = 0x08000000, + DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V7 = 0x08000000, + DRSUAPI_SUPPORTED_EXTENSION_VERIFY_OBJECT = 0x08000000, + DRSUAPI_SUPPORTED_EXTENSION_XPRESS_COMPRESS = 0x10000000, + DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V10 = 0x20000000, + DRSUAPI_SUPPORTED_EXTENSION_RESERVED_PART2 = 0x40000000, + DRSUAPI_SUPPORTED_EXTENSION_RESERVED_PART3 = 0x80000000 + } drsuapi_SupportedExtensions; + + typedef [bitmap32bit] bitmap { + DRSUAPI_SUPPORTED_EXTENSION_ADAM = 0x00000001, + DRSUAPI_SUPPORTED_EXTENSION_LH_BETA2 = 0x00000002, + DRSUAPI_SUPPORTED_EXTENSION_RECYCLE_BIN = 0x00000004 + } drsuapi_SupportedExtensionsExt; + + /* this is used by w2k */ + typedef [public] struct { + drsuapi_SupportedExtensions supported_extensions; + GUID site_guid; + uint32 pid; + } drsuapi_DsBindInfo24; + + /* this is used by w2k3 */ + typedef [public] struct { + drsuapi_SupportedExtensions supported_extensions; + GUID site_guid; + uint32 pid; + uint32 repl_epoch; + } drsuapi_DsBindInfo28; + + typedef [public] struct { + drsuapi_SupportedExtensions supported_extensions; + GUID site_guid; + uint32 pid; + uint32 repl_epoch; + drsuapi_SupportedExtensionsExt supported_extensions_ext; + } drsuapi_DsBindInfo32; + + /* this is used by w2k8 */ + typedef [public] struct { + drsuapi_SupportedExtensions supported_extensions; + GUID site_guid; + uint32 pid; + uint32 repl_epoch; + drsuapi_SupportedExtensionsExt supported_extensions_ext; + GUID config_dn_guid; + } drsuapi_DsBindInfo48; + + /* this is used by w2k12 R2 [MS-DRSR] Section 5.39 */ + typedef [public] struct { + drsuapi_SupportedExtensions supported_extensions; + GUID site_guid; + uint32 pid; + uint32 repl_epoch; + drsuapi_SupportedExtensionsExt supported_extensions_ext; + GUID config_dn_guid; + drsuapi_SupportedExtensionsExt supported_capabilities_ext; + } drsuapi_DsBindInfo52; + + typedef [public] struct { + [flag(NDR_REMAINING)] DATA_BLOB info; + } drsuapi_DsBindInfoFallBack; + + typedef [nopull, nopush, noprint] [nodiscriminant] union { + [case(24)][subcontext(0), subcontext_size(24)] drsuapi_DsBindInfo24 info24; + [case(28)][subcontext(0), subcontext_size(28)] drsuapi_DsBindInfo28 info28; + [case(32)][subcontext(0), subcontext_size(32)] drsuapi_DsBindInfo32 info32; + [case(48)][subcontext(0), subcontext_size(48)] drsuapi_DsBindInfo48 info48; + [case(52)][subcontext(0), subcontext_size(52)] drsuapi_DsBindInfo52 info52; + /* + * The size for the default case is a bit arbitrary it in fact the value + * of the switch but we can't reference it. + * As we hand(un-)marshall this structure it has 0 impact and makes + * pidl happy for wireshark too + */ + [default][subcontext(0), subcontext_size(48)] drsuapi_DsBindInfoFallBack Fallback; + } drsuapi_DsBindInfo; + + /* the drsuapi_DsBindInfoCtr was this before + * typedef [flag(NDR_PAHEX)] struct { + * [range(1,10000)] uint32 length; + * [size_is(length)] uint8 data[]; + * } drsuapi_DsBindInfo; + * + * but we don't want the caller to manually decode this blob, + * so we're doing it here + */ + + /* + * MS-DRSR.pdf gives the following definition + typedef struct { + [range(1,10000)] DWORD cb; + [size_is(cb)] BYTE rgb[]; + } DRS_EXTENSIONS; + + But we use a subcontext which has a slightly different signification on how + data are laid out. + With the MS-DRSR definition we will have + size_is_cb cv rgb_array + with size_is_cb being a uint3264 and cv being a uint32 + + We used to have + typedef struct { + [range(1,10000)] uint32 length; + [switch_is(length)] drsuapi_DsBindInfo info; + } drsuapi_DsBindInfoCtr; + + typedef [nodiscriminant] union { + [case(24)][subcontext(4)] drsuapi_DsBindInfo24 info24; + [case(28)][subcontext(4)] drsuapi_DsBindInfo28 info28; + [case(48)][subcontext(4)] drsuapi_DsBindInfo48 info48; + [default][subcontext(4)] drsuapi_DsBindInfoFallBack FallBack; + } drsuapi_DsBindInfo; + + With this definition data is laid out this way: + length subcontext_size drsuapi_DsBindInfoxx + with length being a uint32 and subcontext_size being a uint3264 + + It has clearly an impact on the way things are aligned when using NDR64 + */ + typedef [flag(NDR_NOALIGN)] struct { + [range(1,10000)] uint3264 length; + [value(length)] uint32 __ndr_length; + [switch_is(length)] drsuapi_DsBindInfo info; + } drsuapi_DsBindInfoCtr; + + /* this is a magic guid you need to pass to DsBind to make drsuapi_DsWriteAccountSpn() work + * + * maybe the bind_guid could also be the invocation_id see drsuapi_DsReplicaConnection04 + */ + const char *DRSUAPI_DS_BIND_GUID = "e24d201a-4fd6-11d1-a3da-0000f875ae0d"; + /* + * this magic guid are needed to fetch the whole tree with drsuapi_DsGetNCChanges() + * as administrator and this values are also used in the destination_dsa_guid field + * of drsuapi_DsGetNCChangesReq5/8 and the source_dsa_guid is zero. + */ + const char *DRSUAPI_DS_BIND_GUID_W2K = "6abec3d1-3054-41c8-a362-5a0c5b7d5d71"; + const char *DRSUAPI_DS_BIND_GUID_W2K3 = "6afab99c-6e26-464a-975f-f58f105218bc"; + + [public] WERROR drsuapi_DsBind( + [in,unique] GUID *bind_guid, + [in,out,unique] drsuapi_DsBindInfoCtr *bind_info, + [out] policy_handle *bind_handle + ); + + /*****************/ + /* Function 0x01 */ + WERROR drsuapi_DsUnbind( + [in,out] policy_handle *bind_handle + ); + + /*****************/ + /* Function 0x02 */ + typedef [public,gensize] struct { + [value(ndr_size_drsuapi_DsReplicaObjectIdentifier(r, ndr->flags)-4)] uint32 __ndr_size; + [value(ndr_size_dom_sid28(&sid, ndr->flags))] uint32 __ndr_size_sid; + GUID guid; + dom_sid28 sid; + [value(strlen_m(dn))] uint32 __ndr_size_dn; + [charset(UTF16),size_is(__ndr_size_dn+1)] uint16 dn[]; + } drsuapi_DsReplicaObjectIdentifier; + + typedef struct { + [ref] drsuapi_DsReplicaObjectIdentifier *naming_context; + GUID source_dsa_guid; + [charset(DOS),string] char *source_dsa_dns; /* Source DSA dns_name in <guid>._msdcs.<domain_dns> form */ + drsuapi_DrsOptions options; + } drsuapi_DsReplicaSyncRequest1; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_DsReplicaSyncRequest1 req1; + } drsuapi_DsReplicaSyncRequest; + + WERROR drsuapi_DsReplicaSync( + [in] policy_handle *bind_handle, + [in] uint32 level, + [in,switch_is(level)] drsuapi_DsReplicaSyncRequest *req + ); + + /*****************/ + /* Function 0x03 */ + typedef [public] struct { + hyper tmp_highest_usn; /* updated after each object update */ + hyper reserved_usn; + hyper highest_usn; /* updated after a full replication cycle */ + } drsuapi_DsReplicaHighWaterMark; + + typedef [public] struct { + GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */ + hyper highest_usn; /* updated after a full replication cycle */ + } drsuapi_DsReplicaCursor; + + typedef struct { + [value(1)] uint32 version; + [value(0)] uint32 reserved1; + [range(0,0x100000)] uint32 count; + [value(0)] uint32 reserved2; + [size_is(count)] drsuapi_DsReplicaCursor cursors[]; + } drsuapi_DsReplicaCursorCtrEx; + + typedef [flag(NDR_PAHEX),v1_enum] enum { + DRSUAPI_EXOP_NONE = 0x00000000, + DRSUAPI_EXOP_FSMO_REQ_ROLE = 0x00000001, + DRSUAPI_EXOP_FSMO_RID_ALLOC = 0x00000002, + DRSUAPI_EXOP_FSMO_RID_REQ_ROLE = 0x00000003, + DRSUAPI_EXOP_FSMO_REQ_PDC = 0x00000004, + DRSUAPI_EXOP_FSMO_ABANDON_ROLE = 0x00000005, + DRSUAPI_EXOP_REPL_OBJ = 0x00000006, + DRSUAPI_EXOP_REPL_SECRET = 0x00000007 + } drsuapi_DsExtendedOperation; + + typedef [flag(NDR_PAHEX),v1_enum] enum { + DRSUAPI_EXOP_ERR_NONE = 0x00000000, + DRSUAPI_EXOP_ERR_SUCCESS = 0x00000001, + DRSUAPI_EXOP_ERR_UNKNOWN_OP = 0x00000002, + DRSUAPI_EXOP_ERR_FSMO_NOT_OWNER = 0x00000003, + DRSUAPI_EXOP_ERR_UPDATE_ERR = 0x00000004, + DRSUAPI_EXOP_ERR_EXCEPTION = 0x00000005, + DRSUAPI_EXOP_ERR_UNKNOWN_CALLER = 0x00000006, + DRSUAPI_EXOP_ERR_RID_ALLOC = 0x00000007, + DRSUAPI_EXOP_ERR_FSMO_OWNER_DELETED = 0x00000008, + DRSUAPI_EXOP_ERR_FMSO_PENDING_OP = 0x00000009, + DRSUAPI_EXOP_ERR_MISMATCH = 0x0000000A, + DRSUAPI_EXOP_ERR_COULDNT_CONTACT = 0x0000000B, + DRSUAPI_EXOP_ERR_FSMO_REFUSING_ROLES = 0x0000000C, + DRSUAPI_EXOP_ERR_DIR_ERROR = 0x0000000D, + DRSUAPI_EXOP_ERR_FSMO_MISSING_SETTINGS = 0x0000000E, + DRSUAPI_EXOP_ERR_ACCESS_DENIED = 0x0000000F, + DRSUAPI_EXOP_ERR_PARAM_ERROR = 0x00000010 + } drsuapi_DsExtendedError; + + typedef struct { + GUID destination_dsa_guid; + GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */ + [ref] drsuapi_DsReplicaObjectIdentifier *naming_context; + drsuapi_DsReplicaHighWaterMark highwatermark; + drsuapi_DsReplicaCursorCtrEx *uptodateness_vector; + drsuapi_DrsOptions replica_flags; + uint32 max_object_count; /* w2k3 uses min(133,max(100,max_object_count)) */ + uint32 max_ndr_size; /* w2k3 seems to ignore this */ + drsuapi_DsExtendedOperation extended_op; + hyper fsmo_info; + } drsuapi_DsGetNCChangesRequest5; + + /* + * In DRSUAPI all attributes with syntax 2.5.5.2 + * are identified by uint32 values + * + * the following table shows the mapping used between the two representations + * e.g. - objectClass 'nTDSDSA' has governsID: 1.2.840.113556.1.5.7000.47 + * and a UINT32-ID of '0x0017002F'. + * - so the OID 1.2.840.113556.1.5.7000.47 is split into a + * OID-prefix: 1.2.840.113556.1.5.7000 + * and a value: 47 => 0x2F + * - the mapping table gives a UINT32-prefix: 0x00170000 + * - and the UINT32-ID is 0x0017002F = 0x00170000 | 0x2F + * + * This prefix mapping table is replied in the drsuapi_DsReplicaOIDMapping_Ctr + * array. The following are the default mappings of w2k3 + * + * OID-prefix => UINT32-Id prefix + * + * 2.5.4.* => 0x00000000 (standard attributes RFC2256 core.schema) + * 2.5.6.* => 0x00010000 (standard object classes RFC2256 core.schema) + * 1.2.840.113556.1.2.* => 0x00020000 + * 1.2.840.113556.1.3.* => 0x00030000 + * 2.5.5.* => 0x00080000 (attributeSyntax OID's) + * 1.2.840.113556.1.4.* => 0x00090000 + * 1.2.840.113556.1.5.* => 0x000A0000 + * 2.16.840.1.113730.3.* => 0x00140000 + * 0.9.2342.19200300.100.1.* => 0x00150000 + * 2.16.840.1.113730.3.1.* => 0x00160000 + * 1.2.840.113556.1.5.7000.* => 0x00170000 + * 2.5.21.* => 0x00180000 (attrs for SubSchema) + * 2.5.18.* => 0x00190000 (createTimeStamp,modifyTimeStamp, SubSchema) + * 2.5.20.* => 0x001A0000 + * 1.3.6.1.4.1.1466.101.119.* => 0x001B0000 (dynamicObject, entryTTL) + * 2.16.840.1.113730.3.2.* => 0x001C0000 + * 1.3.6.1.4.1.250.1.* => 0x001D0000 + * 1.2.840.113549.1.9.* => 0x001E0000 (unstructuredAddress,unstructuredName) + * 0.9.2342.19200300.100.4.* => 0x001F0000 + * + * Here's a list of used 'attributeSyntax' OID's + * + * 2.5.5.1 => Object(DS-DN) string + * struct drsuapi_DsObjectIdentifier3 + * + * 2.5.5.2 => OID-string + * => all values are represented as uint32 values in drsuapi + * => governsID, attributeID and attributeSyntax returned as OID-Strings in LDAP + * => mayContain, mustContain and all other attributes with 2.5.5.2 syntax + * are returned as attribute names + * + * 2.5.5.4 => String(Teletex) case-insensitive string with teletex charset + * + * 2.5.5.5 => String(IA5) case-sensitive string + * + * 2.5.5.6 => String(Numeric) + * => eg. internationalISDNNumber + * + * 2.5.5.7 => Object(DN-Binary) B:<byte count>:<bytes>:<object DN> + * => e.g. wellKnownObjects + * + * 2.5.5.8 => BOOL + * + * 2.5.5.9 => int32 + * + * 2.5.5.10 => DATA_BLOB + * => struct GUID + * + * 2.5.5.11 => LDAP timestring + * => NTTIME_1sec + * + * 2.5.5.12 => String(Unicode) case-insensitive string + * => 'standard strings' + * + * 2.5.5.13 => Object(Presentation-Address) string + * => used in objectClass applicationEntity + * + * 2.5.5.14 => Object(DN-String) S:<char count>:<string>:<object DN> + * => not used + * + * 2.5.5.15 => ntSecurityDescriptor + * + * 2.5.5.16 => int64 + * + * 2.5.5.17 => dom_sid + */ + typedef [noprint] struct { + [range(0,10000)] uint32 length; + [size_is(length)] uint8 *binary_oid; /* partial-binary-OID encoded with asn1_write_partial_OID_String() */ + } drsuapi_DsReplicaOID; + + typedef struct { + uint32 id_prefix; + drsuapi_DsReplicaOID oid; + } drsuapi_DsReplicaOIDMapping; + + typedef [public] struct { + [range(0,0x100000)] uint32 num_mappings; + [size_is(num_mappings)] drsuapi_DsReplicaOIDMapping *mappings; + } drsuapi_DsReplicaOIDMapping_Ctr; + + typedef [flag(NDR_PAHEX),v1_enum] enum { + DRSUAPI_OBJECTCLASS_top = 0x00010000, + DRSUAPI_OBJECTCLASS_classSchema = 0x0003000d, + DRSUAPI_OBJECTCLASS_attributeSchema = 0x0003000e + } drsuapi_DsObjectClassId; + + typedef [flag(NDR_PAHEX),v1_enum,public] enum { + DRSUAPI_ATTID_objectClass = 0x00000000, + DRSUAPI_ATTID_cn = 0x00000003, + DRSUAPI_ATTID_ou = 0x0000000b, + DRSUAPI_ATTID_description = 0x0000000d, + DRSUAPI_ATTID_member = 0x0000001f, + DRSUAPI_ATTID_distinguishedName = 0x00000031, + DRSUAPI_ATTID_instanceType = 0x00020001, + DRSUAPI_ATTID_whenCreated = 0x00020002, + DRSUAPI_ATTID_possSuperiors = 0x00020008, + DRSUAPI_ATTID_displayName = 0x0002000d, + DRSUAPI_ATTID_hasMasterNCs = 0x0002000e, + DRSUAPI_ATTID_nCName = 0x00020010, + DRSUAPI_ATTID_subClassOf = 0x00020015, + DRSUAPI_ATTID_governsID = 0x00020016, + DRSUAPI_ATTID_mustContain = 0x00020018, + DRSUAPI_ATTID_mayContain = 0x00020019, + DRSUAPI_ATTID_rDNAttId = 0x0002001A, + DRSUAPI_ATTID_attributeID = 0x0002001e, + DRSUAPI_ATTID_attributeSyntax = 0x00020020, + DRSUAPI_ATTID_isSingleValued = 0x00020021, + DRSUAPI_ATTID_rangeLower = 0x00020022, + DRSUAPI_ATTID_rangeUpper = 0x00020023, + DRSUAPI_ATTID_dMDLocation = 0x00020024, + DRSUAPI_ATTID_isDeleted = 0x00020030, + DRSUAPI_ATTID_objectVersion = 0x0002004c, + DRSUAPI_ATTID_invocationId = 0x00020073, + DRSUAPI_ATTID_showInAdvancedViewOnly = 0x000200a9, + DRSUAPI_ATTID_adminDisplayName = 0x000200c2, + DRSUAPI_ATTID_adminDescription = 0x000200e2, + DRSUAPI_ATTID_oMSyntax = 0x000200e7, + DRSUAPI_ATTID_ntSecurityDescriptor = 0x00020119, + DRSUAPI_ATTID_searchFlags = 0x0002014e, + DRSUAPI_ATTID_auxiliaryClass = 0x0002015f, + DRSUAPI_ATTID_lDAPDisplayName = 0x000201cc, + DRSUAPI_ATTID_name = 0x00090001, + DRSUAPI_ATTID_objectGUID = 0x00090002, + DRSUAPI_ATTID_replPropertyMetaData = 0x00090003, + DRSUAPI_ATTID_userAccountControl = 0x00090008, + DRSUAPI_ATTID_badPwdCount = 0x0009000c, + DRSUAPI_ATTID_codePage = 0x00090010, + DRSUAPI_ATTID_countryCode = 0x00090019, + DRSUAPI_ATTID_currentValue = 0x0009001b, + DRSUAPI_ATTID_homeDirectory = 0x0009002c, + DRSUAPI_ATTID_homeDrive = 0x0009002d, + DRSUAPI_ATTID_lastLogoff = 0x00090033, + DRSUAPI_ATTID_lastLogon = 0x00090034, + DRSUAPI_ATTID_dBCSPwd = 0x00090037,/* lmPwdHash */ + DRSUAPI_ATTID_scriptPath = 0x0009003e, + DRSUAPI_ATTID_logonHours = 0x00090040, + DRSUAPI_ATTID_userWorkstations = 0x00090056, + DRSUAPI_ATTID_unicodePwd = 0x0009005a,/* ntPwdHash */ + DRSUAPI_ATTID_ntPwdHistory = 0x0009005e, + DRSUAPI_ATTID_pwdLastSet = 0x00090060, + DRSUAPI_ATTID_primaryGroupID = 0x00090062, + DRSUAPI_ATTID_priorValue = 0x00090064, + DRSUAPI_ATTID_supplementalCredentials = 0x0009007d, + DRSUAPI_ATTID_trustAuthIncoming = 0x00090081, + DRSUAPI_ATTID_trustDirection = 0x00090084, + DRSUAPI_ATTID_trustPartner = 0x00090085, + DRSUAPI_ATTID_trustPosixOffset = 0x00090086, + DRSUAPI_ATTID_trustAuthOutgoing = 0x00090087, + DRSUAPI_ATTID_trustType = 0x00090088, + DRSUAPI_ATTID_userParameters = 0x0009008a, + DRSUAPI_ATTID_profilePath = 0x0009008b, + DRSUAPI_ATTID_operatorCount = 0x00090090, + DRSUAPI_ATTID_objectSid = 0x00090092, + DRSUAPI_ATTID_schemaIDGUID = 0x00090094, + DRSUAPI_ATTID_adminCount = 0x00090096, + DRSUAPI_ATTID_comment = 0x0009009C,/* User-Comment */ + DRSUAPI_ATTID_accountExpires = 0x0009009f, + DRSUAPI_ATTID_lmPwdHistory = 0x000900a0, + DRSUAPI_ATTID_logonCount = 0x000900a9, + DRSUAPI_ATTID_systemPossSuperiors = 0x000900c3, + DRSUAPI_ATTID_systemMayContain = 0x000900c4, + DRSUAPI_ATTID_systemMustContain = 0x000900c5, + DRSUAPI_ATTID_systemAuxiliaryClass = 0x000900c6, + DRSUAPI_ATTID_sAMAccountName = 0x000900dd, + DRSUAPI_ATTID_sAMAccountType = 0x0009012e, + DRSUAPI_ATTID_options = 0x00090133, + DRSUAPI_ATTID_fSMORoleOwner = 0x00090171, + DRSUAPI_ATTID_systemFlags = 0x00090177, + DRSUAPI_ATTID_trustAttributes = 0x000901d6, + DRSUAPI_ATTID_trustParent = 0x000901d7, + DRSUAPI_ATTID_flatName = 0x000901ff, + DRSUAPI_ATTID_serverReference = 0x00090203, + DRSUAPI_ATTID_serverReferenceBL = 0x00090204, + DRSUAPI_ATTID_nonSecurityMember = 0x00090212, + DRSUAPI_ATTID_initialAuthIncoming = 0x0009021b, + DRSUAPI_ATTID_initialAuthOutgoing = 0x0009021c, + DRSUAPI_ATTID_wellKnownObjects = 0x0009026a, + DRSUAPI_ATTID_dNSHostName = 0x0009026b, + DRSUAPI_ATTID_isMemberOfPartialAttributeSet = 0x0009027f, + DRSUAPI_ATTID_managedBy = 0x0009028d, + DRSUAPI_ATTID_userPrincipalName = 0x00090290, + DRSUAPI_ATTID_groupType = 0x000902ee, + DRSUAPI_ATTID_servicePrincipalName = 0x00090303, + DRSUAPI_ATTID_lastKnownParent = 0x0009030d, + DRSUAPI_ATTID_objectCategory = 0x0009030e, + DRSUAPI_ATTID_gPLink = 0x0009037b, + DRSUAPI_ATTID_transportAddressAttribute = 0x0009037f, + DRSUAPI_ATTID_schemaInfo = 0x0009054e, + DRSUAPI_ATTID_msDS_Behavior_Version = 0x000905b3, + DRSUAPI_ATTID_msDS_TrustForestTrustInfo = 0x000906a6, + DRSUAPI_ATTID_msDS_KeyVersionNumber = 0x000906f6, + DRSUAPI_ATTID_msDS_NonMembers = 0x00090701, + DRSUAPI_ATTID_msDS_MembersForAzRole = 0x0009070e, + DRSUAPI_ATTID_msDS_HasDomainNCs = 0x0009071c, + DRSUAPI_ATTID_msDS_hasMasterNCs = 0x0009072c, + DRSUAPI_ATTID_msDS_NeverRevealGroup = 0x00090786, + DRSUAPI_ATTID_msDS_RevealOnDemandGroup = 0x00090788, + DRSUAPI_ATTID_msDS_SupportedEncryptionTypes = 0x000907ab, + DRSUAPI_ATTID_msDS_HostServiceAccount = 0x00090808, + DRSUAPI_ATTID_isRecycled = 0x0009080a, + + DRSUAPI_ATTID_INVALID = 0xFFFFFFFF + } drsuapi_DsAttributeId; + + typedef struct { + [value(1)] uint32 version; + [value(0)] uint32 reserved1; + [range(1,0x100000)] uint32 num_attids; + [size_is(num_attids)] drsuapi_DsAttributeId attids[]; + } drsuapi_DsPartialAttributeSet; + + typedef [public] struct { + GUID destination_dsa_guid; + GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */ + [ref] drsuapi_DsReplicaObjectIdentifier *naming_context; + drsuapi_DsReplicaHighWaterMark highwatermark; + drsuapi_DsReplicaCursorCtrEx *uptodateness_vector; + drsuapi_DrsOptions replica_flags; + uint32 max_object_count; /* w2k3 uses min(133,max(100,max_object_count)) */ + uint32 max_ndr_size; /* w2k3 seems to ignore this */ + drsuapi_DsExtendedOperation extended_op; + hyper fsmo_info; + drsuapi_DsPartialAttributeSet *partial_attribute_set; + drsuapi_DsPartialAttributeSet *partial_attribute_set_ex; + drsuapi_DsReplicaOIDMapping_Ctr mapping_ctr; + } drsuapi_DsGetNCChangesRequest8; + + typedef [public] struct { + GUID destination_dsa_guid; + GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */ + [ref] drsuapi_DsReplicaObjectIdentifier *naming_context; + drsuapi_DsReplicaHighWaterMark highwatermark; + drsuapi_DsReplicaCursorCtrEx *uptodateness_vector; + drsuapi_DrsOptions replica_flags; + uint32 max_object_count; /* w2k3 uses min(133,max(100,max_object_count)) */ + uint32 max_ndr_size; /* w2k3 seems to ignore this */ + drsuapi_DsExtendedOperation extended_op; + hyper fsmo_info; + drsuapi_DsPartialAttributeSet *partial_attribute_set; + drsuapi_DsPartialAttributeSet *partial_attribute_set_ex; + drsuapi_DsReplicaOIDMapping_Ctr mapping_ctr; + drsuapi_DrsMoreOptions more_flags; + } drsuapi_DsGetNCChangesRequest10; + + typedef [switch_type(uint32)] union { + [case(5)] drsuapi_DsGetNCChangesRequest5 req5; + [case(8)] drsuapi_DsGetNCChangesRequest8 req8; + [case(10)] drsuapi_DsGetNCChangesRequest10 req10; + } drsuapi_DsGetNCChangesRequest; + + typedef [public] struct { + GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */ + hyper highest_usn; /* updated after a full replication cycle */ + NTTIME last_sync_success; + } drsuapi_DsReplicaCursor2; + + typedef struct { + [value(2)] uint32 version; + [value(0)] uint32 reserved1; + [range(0,0x100000)] uint32 count; + [value(0)] uint32 reserved2; + [size_is(count)] drsuapi_DsReplicaCursor2 cursors[]; + } drsuapi_DsReplicaCursor2CtrEx; + + /* Generic DATA_BLOB values */ + typedef struct { + [range(0,26214400),value(ndr_size_DATA_BLOB(0,blob,0))] uint32 __ndr_size; + DATA_BLOB *blob; + } drsuapi_DsAttributeValue; + + typedef struct { + [range(0,10485760)] uint32 num_values; + [size_is(num_values)] drsuapi_DsAttributeValue *values; + } drsuapi_DsAttributeValueCtr; + + /* DN String values */ + typedef [public,gensize] struct { + [value(ndr_size_drsuapi_DsReplicaObjectIdentifier3(r, ndr->flags))] uint32 __ndr_size; + [value(ndr_size_dom_sid28(&sid,ndr->flags))] uint32 __ndr_size_sid; + GUID guid; + dom_sid28 sid; + [value(strlen_m(dn))] uint32 __ndr_size_dn; + [charset(UTF16)] uint16 dn[__ndr_size_dn+1]; + } drsuapi_DsReplicaObjectIdentifier3; + + typedef [public] struct { + [value(ndr_size_drsuapi_DsReplicaObjectIdentifier3Binary_without_Binary(r, ndr->flags))] uint32 __ndr_size; + [value(ndr_size_dom_sid28(&sid,ndr->flags))] uint32 __ndr_size_sid; + GUID guid; + dom_sid28 sid; + [value(strlen_m(dn))] uint32 __ndr_size_dn; + [charset(UTF16)] uint16 dn[__ndr_size_dn+1]; + [value(binary.length + 4)] uint32 __ndr_size_binary; + [flag(NDR_REMAINING)] DATA_BLOB binary; + } drsuapi_DsReplicaObjectIdentifier3Binary; + + typedef [public,noprint] struct { + drsuapi_DsAttributeId attid; + drsuapi_DsAttributeValueCtr value_ctr; + } drsuapi_DsReplicaAttribute; + + typedef struct { + [range(0,1048576)] uint32 num_attributes; + [size_is(num_attributes)] drsuapi_DsReplicaAttribute *attributes; + } drsuapi_DsReplicaAttributeCtr; + + typedef [public] bitmap { + DRSUAPI_DS_REPLICA_OBJECT_FROM_MASTER = 0x00000001, + DRSUAPI_DS_REPLICA_OBJECT_DYNAMIC = 0x00000002, + DRSUAPI_DS_REPLICA_OBJECT_REMOTE_MODIFY = 0x00010000 + } drsuapi_DsReplicaObjectFlags; + + typedef [public] struct { + drsuapi_DsReplicaObjectIdentifier *identifier; + drsuapi_DsReplicaObjectFlags flags; + drsuapi_DsReplicaAttributeCtr attribute_ctr; + } drsuapi_DsReplicaObject; + + typedef struct { + uint32 version; + NTTIME_1sec originating_change_time; + GUID originating_invocation_id; + hyper originating_usn; + } drsuapi_DsReplicaMetaData; + + typedef [public] struct { + [range(0,1048576)] uint32 count; + [size_is(count)] drsuapi_DsReplicaMetaData meta_data[]; + } drsuapi_DsReplicaMetaDataCtr; + + typedef [public,noprint] struct { + [max_recursion(20000)] + drsuapi_DsReplicaObjectListItemEx *next_object; + drsuapi_DsReplicaObject object; + boolean32 is_nc_prefix; + GUID *parent_object_guid; + drsuapi_DsReplicaMetaDataCtr *meta_data_ctr; + } drsuapi_DsReplicaObjectListItemEx; + + typedef [public,gensize] struct { + GUID source_dsa_guid; /* the 'objectGUID' field of the CN=NTDS Settings object */ + GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */ + drsuapi_DsReplicaObjectIdentifier *naming_context; + drsuapi_DsReplicaHighWaterMark old_highwatermark; + drsuapi_DsReplicaHighWaterMark new_highwatermark; + drsuapi_DsReplicaCursorCtrEx *uptodateness_vector; + drsuapi_DsReplicaOIDMapping_Ctr mapping_ctr; + drsuapi_DsExtendedError extended_ret; /* w2k sends the nc_object_count value here */ + uint32 object_count; + /* this +55 is sometimes +56, so I don't know where this comes from... --metze */ + [value(ndr_size_drsuapi_DsGetNCChangesCtr1(r,ndr->flags)+55)] uint32 __ndr_size; + drsuapi_DsReplicaObjectListItemEx *first_object; + boolean32 more_data; + } drsuapi_DsGetNCChangesCtr1; + + /* + * if the DRSUAPI_DS_LINKED_ATTRIBUTE_FLAG_ACTIVE flag + * isn't there it means the value is deleted + */ + typedef [public] bitmap { + DRSUAPI_DS_LINKED_ATTRIBUTE_FLAG_ACTIVE = 0x00000001 + } drsuapi_DsLinkedAttributeFlags; + + typedef [public] struct { + drsuapi_DsReplicaObjectIdentifier *identifier; + drsuapi_DsAttributeId attid; + drsuapi_DsAttributeValue value; + drsuapi_DsLinkedAttributeFlags flags; + NTTIME_1sec originating_add_time; + drsuapi_DsReplicaMetaData meta_data; + } drsuapi_DsReplicaLinkedAttribute; + + /* [MS-DRSR] section 4.1.10.2.11 DRS_MSG_GETCHGREPLY_V6 */ + typedef [public,gensize] struct { + GUID source_dsa_guid; /* the 'objectGUID' field of the CN=NTDS Settings object */ + GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */ + drsuapi_DsReplicaObjectIdentifier *naming_context; + drsuapi_DsReplicaHighWaterMark old_highwatermark; + drsuapi_DsReplicaHighWaterMark new_highwatermark; + drsuapi_DsReplicaCursor2CtrEx *uptodateness_vector; + drsuapi_DsReplicaOIDMapping_Ctr mapping_ctr; + drsuapi_DsExtendedError extended_ret; + uint32 object_count; + /* this +55 is sometimes +56, so I don't know where this comes from... --metze */ + [value(ndr_size_drsuapi_DsGetNCChangesCtr6(r,ndr->flags)+55)] uint32 __ndr_size; + drsuapi_DsReplicaObjectListItemEx *first_object; + boolean32 more_data; + uint32 nc_object_count; /* estimated amount of objects in the whole NC */ + uint32 nc_linked_attributes_count; /* estimated amount of linked values in the whole NC */ + [range(0,1048576)] uint32 linked_attributes_count; + [size_is(linked_attributes_count)] drsuapi_DsReplicaLinkedAttribute *linked_attributes; + WERROR drs_error; + } drsuapi_DsGetNCChangesCtr6; + + typedef [public] struct { + [subcontext(0xFFFFFC01)] drsuapi_DsGetNCChangesCtr1 ctr1; + } drsuapi_DsGetNCChangesCtr1TS; + + typedef [public] struct { + [subcontext(0xFFFFFC01)] drsuapi_DsGetNCChangesCtr6 ctr6; + } drsuapi_DsGetNCChangesCtr6TS; + + typedef [nopush] struct { + uint32 decompressed_length; + uint32 compressed_length; + [subcontext(4),subcontext_size(compressed_length), + compression(NDR_COMPRESSION_MSZIP,compressed_length,decompressed_length)] + drsuapi_DsGetNCChangesCtr1TS *ts; + } drsuapi_DsGetNCChangesMSZIPCtr1; + + typedef [nopush] struct { + uint32 decompressed_length; + uint32 compressed_length; + [subcontext(4),subcontext_size(compressed_length), + compression(NDR_COMPRESSION_MSZIP,compressed_length,decompressed_length)] + drsuapi_DsGetNCChangesCtr6TS *ts; + } drsuapi_DsGetNCChangesMSZIPCtr6; + + typedef [nopush] struct { + uint32 decompressed_length; + uint32 compressed_length; + [subcontext(4),subcontext_size(compressed_length), + compression(NDR_COMPRESSION_WIN2K3_LZ77_DIRECT2,compressed_length,decompressed_length)] + drsuapi_DsGetNCChangesCtr1TS *ts; + } drsuapi_DsGetNCChangesWIN2K3_LZ77_DIRECT2Ctr1; + + typedef [nopush] struct { + uint32 decompressed_length; + uint32 compressed_length; + [subcontext(4),subcontext_size(compressed_length), + compression(NDR_COMPRESSION_WIN2K3_LZ77_DIRECT2,compressed_length,decompressed_length)] + drsuapi_DsGetNCChangesCtr6TS *ts; + } drsuapi_DsGetNCChangesWIN2K3_LZ77_DIRECT2Ctr6; + + typedef [enum16bit] enum { + DRSUAPI_COMPRESSION_TYPE_MSZIP = 2, + DRSUAPI_COMPRESSION_TYPE_WIN2K3_LZ77_DIRECT2 = 3 /* CompressOrDecompressWin2k3 DRS_COMP_ALG_WIN2K3 */ + } drsuapi_DsGetNCChangesCompressionType; + + typedef [nodiscriminant,flag(NDR_PAHEX)] union { + [case(1|(DRSUAPI_COMPRESSION_TYPE_MSZIP<<16))] drsuapi_DsGetNCChangesMSZIPCtr1 mszip1; + [case(6|(DRSUAPI_COMPRESSION_TYPE_MSZIP<<16))] drsuapi_DsGetNCChangesMSZIPCtr6 mszip6; + [case(1|(DRSUAPI_COMPRESSION_TYPE_WIN2K3_LZ77_DIRECT2<<16))] drsuapi_DsGetNCChangesWIN2K3_LZ77_DIRECT2Ctr1 xpress1; + [case(6|(DRSUAPI_COMPRESSION_TYPE_WIN2K3_LZ77_DIRECT2<<16))] drsuapi_DsGetNCChangesWIN2K3_LZ77_DIRECT2Ctr6 xpress6; + } drsuapi_DsGetNCChangesCompressedCtr; + + typedef struct { + drsuapi_DsGetNCChangesMSZIPCtr1 mszip1; + } drsuapi_DsGetNCChangesCtr2; + + typedef struct { + [range(0,6)] uint32 level; + [range(2,3)] drsuapi_DsGetNCChangesCompressionType type; + [switch_is(level | (type<<16))] drsuapi_DsGetNCChangesCompressedCtr ctr; + } drsuapi_DsGetNCChangesCtr7; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_DsGetNCChangesCtr1 ctr1; + [case(2)] drsuapi_DsGetNCChangesCtr2 ctr2; + [case(6)] drsuapi_DsGetNCChangesCtr6 ctr6; + [case(7)] drsuapi_DsGetNCChangesCtr7 ctr7; + } drsuapi_DsGetNCChangesCtr; + + WERROR drsuapi_DsGetNCChanges( + [in] policy_handle *bind_handle, + [in] uint32 level, + [in,ref,switch_is(level)] drsuapi_DsGetNCChangesRequest *req, + [out,ref] uint32 *level_out, + [out,ref,switch_is(*level_out)] drsuapi_DsGetNCChangesCtr *ctr + ); + + /*****************/ + /* Function 0x04 */ + /* [MS-DRSR] 4.1.26 */ + + typedef struct { + [ref] drsuapi_DsReplicaObjectIdentifier *naming_context; + [ref,charset(DOS),string] uint8 *dest_dsa_dns_name; + GUID dest_dsa_guid; + drsuapi_DrsOptions options; + } drsuapi_DsReplicaUpdateRefsRequest1; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_DsReplicaUpdateRefsRequest1 req1; + } drsuapi_DsReplicaUpdateRefsRequest; + + WERROR drsuapi_DsReplicaUpdateRefs( + [in] policy_handle *bind_handle, + [in] uint32 level, + [in,switch_is(level)] drsuapi_DsReplicaUpdateRefsRequest req + ); + + /*****************/ + /* Function 0x05 */ + + typedef struct { + [ref] drsuapi_DsReplicaObjectIdentifier *naming_context; + [charset(UTF16),string] uint16 *source_dsa_address; + uint8 schedule[84]; + drsuapi_DrsOptions options; + } drsuapi_DsReplicaAddRequest1; + + typedef struct { + [ref] drsuapi_DsReplicaObjectIdentifier *naming_context; + drsuapi_DsReplicaObjectIdentifier *source_dsa_dn; + drsuapi_DsReplicaObjectIdentifier *transport_dn; + [charset(UTF16),string] uint16 *source_dsa_address; + uint8 schedule[84]; + drsuapi_DrsOptions options; + } drsuapi_DsReplicaAddRequest2; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_DsReplicaAddRequest1 req1; + [case(2)] drsuapi_DsReplicaAddRequest2 req2; + } drsuapi_DsReplicaAddRequest; + + WERROR drsuapi_DsReplicaAdd( + [in] policy_handle *bind_handle, + [in] uint32 level, + [in,switch_is(level)] drsuapi_DsReplicaAddRequest req + ); + + + /*****************/ + /* Function 0x06 */ + typedef struct { + [ref] drsuapi_DsReplicaObjectIdentifier *naming_context; + [charset(UTF8), string] uint8 *source_dsa_address; + drsuapi_DrsOptions options; + } drsuapi_DsReplicaDelRequest1; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_DsReplicaDelRequest1 req1; + } drsuapi_DsReplicaDelRequest; + + WERROR drsuapi_DsReplicaDel( + [in] policy_handle *bind_handle, + [in] uint32 level, + [in,switch_is(level)] drsuapi_DsReplicaDelRequest req + ); + + /*****************/ + /* Function 0x07 */ + + typedef struct { + [ref] drsuapi_DsReplicaObjectIdentifier *naming_context; + GUID source_dra; + [charset(UTF16),string] uint16 *source_dra_address; + uint8 schedule[84]; + drsuapi_DrsOptions replica_flags; + uint32 modify_fields; + drsuapi_DrsOptions options; + } drsuapi_DsReplicaModRequest1; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_DsReplicaModRequest1 req1; + } drsuapi_DsReplicaModRequest; + + WERROR drsuapi_DsReplicaMod( + [in] policy_handle *bind_handle, + [in] uint32 level, + [in,switch_is(level)] drsuapi_DsReplicaModRequest req + ); + + /*****************/ + /* Function 0x08 */ + [todo] WERROR DRSUAPI_VERIFY_NAMES(); + + /*****************/ + /* Function 0x09 */ + + /* how are type 4 and 7 different from 2 and 3 ? */ + typedef [v1_enum] enum { + DRSUAPI_DS_MEMBERSHIP_TYPE_UNIVERSAL_AND_DOMAIN_GROUPS = 1, + DRSUAPI_DS_MEMBERSHIP_TYPE_DOMAIN_LOCAL_GROUPS = 2, + DRSUAPI_DS_MEMBERSHIP_TYPE_DOMAIN_GROUPS = 3, + DRSUAPI_DS_MEMBERSHIP_TYPE_DOMAIN_LOCAL_GROUPS2 = 4, + DRSUAPI_DS_MEMBERSHIP_TYPE_UNIVERSAL_GROUPS = 5, + DRSUAPI_DS_MEMBERSHIP_TYPE_GROUPMEMBERS = 6, + DRSUAPI_DS_MEMBERSHIP_TYPE_DOMAIN_GROUPS2 = 7 + } drsuapi_DsMembershipType; + + typedef struct { + NTSTATUS status; + [range(0,10000)] uint32 num_memberships; + [range(0,10000)] uint32 num_sids; + [size_is(num_memberships)] drsuapi_DsReplicaObjectIdentifier **info_array; + [size_is(num_memberships)] security_GroupAttrs *group_attrs; + [size_is(num_sids)] dom_sid28 **sids; + } drsuapi_DsGetMembershipsCtr1; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_DsGetMembershipsCtr1 ctr1; + } drsuapi_DsGetMembershipsCtr; + + const int DRSUAPI_DS_MEMBERSHIP_FLAG_GROUP_ATTR = 0x1; + + typedef struct { + [range(1,10000)] uint32 count; + [size_is(count)] drsuapi_DsReplicaObjectIdentifier **info_array; + uint32 flags; + [range(1,7)] drsuapi_DsMembershipType type; + drsuapi_DsReplicaObjectIdentifier *domain; + } drsuapi_DsGetMembershipsRequest1; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_DsGetMembershipsRequest1 req1; + } drsuapi_DsGetMembershipsRequest; + + WERROR drsuapi_DsGetMemberships( + [in] policy_handle *bind_handle, + [in] uint32 level, + [in,ref] [switch_is(level)] drsuapi_DsGetMembershipsRequest *req, + [out,ref] uint32 *level_out, + [out,ref] [switch_is(*level_out)] drsuapi_DsGetMembershipsCtr *ctr + ); + + /*****************/ + /* Function 0x0a */ + [todo] WERROR DRSUAPI_INTER_DOMAIN_MOVE(); + + /*****************/ + /* Function 0x0b */ + typedef [bitmap32bit] bitmap { + DRSUAPI_NT4_CHANGELOG_GET_CHANGELOG = 0x00000001, + DRSUAPI_NT4_CHANGELOG_GET_SERIAL_NUMBERS = 0x00000002 + } drsuapi_DsGetNT4ChangeLogFlags; + + typedef struct { + drsuapi_DsGetNT4ChangeLogFlags flags; + uint32 preferred_maximum_length; + [range(0,0x00A00000)] uint32 restart_length; + [size_is(restart_length)] uint8 *restart_data; + } drsuapi_DsGetNT4ChangeLogRequest1; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_DsGetNT4ChangeLogRequest1 req1; + } drsuapi_DsGetNT4ChangeLogRequest; + + typedef struct { + [range(0,0x00A00000)] uint32 restart_length; + [range(0,0x00A00000)] uint32 log_length; + hyper sam_serial_number; + NTTIME sam_creation_time; + hyper builtin_serial_number; + NTTIME builtin_creation_time; + hyper lsa_serial_number; + NTTIME lsa_creation_time; + NTSTATUS status; + [size_is(restart_length)] uint8 *restart_data; + [size_is(log_length)] uint8 *log_data; + } drsuapi_DsGetNT4ChangeLogInfo1; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_DsGetNT4ChangeLogInfo1 info1; + } drsuapi_DsGetNT4ChangeLogInfo; + + WERROR drsuapi_DsGetNT4ChangeLog( + [in] policy_handle *bind_handle, + [in] uint32 level, + [in,ref] [switch_is(level)] drsuapi_DsGetNT4ChangeLogRequest *req, + [out,ref] uint32 *level_out, + [out,ref] [switch_is(*level_out)] drsuapi_DsGetNT4ChangeLogInfo *info + ); + + /*****************/ + /* Function 0x0c */ + typedef [v1_enum] enum { + DRSUAPI_DS_NAME_STATUS_OK = 0, + DRSUAPI_DS_NAME_STATUS_RESOLVE_ERROR = 1, + DRSUAPI_DS_NAME_STATUS_NOT_FOUND = 2, + DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE = 3, + DRSUAPI_DS_NAME_STATUS_NO_MAPPING = 4, + DRSUAPI_DS_NAME_STATUS_DOMAIN_ONLY = 5, + DRSUAPI_DS_NAME_STATUS_NO_SYNTACTICAL_MAPPING = 6, + DRSUAPI_DS_NAME_STATUS_TRUST_REFERRAL = 7 + } drsuapi_DsNameStatus; + + typedef [v1_enum] enum { + DRSUAPI_DS_NAME_FLAG_NO_FLAGS = 0x0, + DRSUAPI_DS_NAME_FLAG_SYNTACTICAL_ONLY = 0x1, + DRSUAPI_DS_NAME_FLAG_EVAL_AT_DC = 0x2, + DRSUAPI_DS_NAME_FLAG_GCVERIFY = 0x4, + DRSUAPI_DS_NAME_FLAG_TRUST_REFERRAL = 0x8 + } drsuapi_DsNameFlags; + + typedef [v1_enum] enum { + DRSUAPI_DS_NAME_FORMAT_UNKNOWN = 0x00000000, + DRSUAPI_DS_NAME_FORMAT_FQDN_1779 = 0x00000001, + DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT = 0x00000002, + DRSUAPI_DS_NAME_FORMAT_DISPLAY = 0x00000003, + DRSUAPI_DS_NAME_FORMAT_GUID = 0x00000006, + DRSUAPI_DS_NAME_FORMAT_CANONICAL = 0x00000007, + DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL = 0x00000008, + DRSUAPI_DS_NAME_FORMAT_CANONICAL_EX = 0x00000009, + DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL = 0x0000000A, + DRSUAPI_DS_NAME_FORMAT_SID_OR_SID_HISTORY = 0x0000000B, + DRSUAPI_DS_NAME_FORMAT_DNS_DOMAIN = 0x0000000C, + DRSUAPI_DS_NAME_FORMAT_UPN_AND_ALTSECID = 0xFFFFFFEF, + DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT_NAME_SANS_DOMAIN_EX = 0xFFFFFFF0, + DRSUAPI_DS_NAME_FORMAT_LIST_GLOBAL_CATALOG_SERVERS = 0xFFFFFFF1, + DRSUAPI_DS_NAME_FORMAT_UPN_FOR_LOGON = 0xFFFFFFF2, + DRSUAPI_DS_NAME_FORMAT_LIST_SERVERS_WITH_DCS_IN_SITE = 0xFFFFFFF3, + DRSUAPI_DS_NAME_FORMAT_STRING_SID_NAME = 0xFFFFFFF4, + DRSUAPI_DS_NAME_FORMAT_ALT_SECURITY_IDENTITIES_NAME = 0xFFFFFFF5, + DRSUAPI_DS_NAME_FORMAT_LIST_NCS = 0xFFFFFFF6, + DRSUAPI_DS_NAME_FORMAT_LIST_DOMAINS = 0xFFFFFFF7, + DRSUAPI_DS_NAME_FORMAT_MAP_SCHEMA_GUID = 0xFFFFFFF8, + DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT_NAME_SANS_DOMAIN = 0xFFFFFFF9, + DRSUAPI_DS_NAME_FORMAT_LIST_ROLES = 0xFFFFFFFA, + DRSUAPI_DS_NAME_FORMAT_LIST_INFO_FOR_SERVER = 0xFFFFFFFB, + DRSUAPI_DS_NAME_FORMAT_LIST_SERVERS_FOR_DOMAIN_IN_SITE = 0xFFFFFFFC, + DRSUAPI_DS_NAME_FORMAT_LIST_DOMAINS_IN_SITE = 0xFFFFFFFD, + DRSUAPI_DS_NAME_FORMAT_LIST_SERVERS_IN_SITE = 0xFFFFFFFE, + DRSUAPI_DS_NAME_FORMAT_LIST_SITES = 0xFFFFFFFF + } drsuapi_DsNameFormat; + + typedef struct { + [string,charset(UTF16)] uint16 *str; + } drsuapi_DsNameString; + + typedef struct { + uint32 codepage; /* 0x000004e4 - 1252 is german codepage*/ + uint32 language; /* 0x00000407 - german language ID*/ + drsuapi_DsNameFlags format_flags; + drsuapi_DsNameFormat format_offered; + drsuapi_DsNameFormat format_desired; + [range(1,10000)] uint32 count; + [size_is(count)] drsuapi_DsNameString *names; + } drsuapi_DsNameRequest1; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_DsNameRequest1 req1; + } drsuapi_DsNameRequest; + + typedef struct { + drsuapi_DsNameStatus status; + [charset(UTF16),string] uint16 *dns_domain_name; + [charset(UTF16),string] uint16 *result_name; + } drsuapi_DsNameInfo1; + + typedef struct { + uint32 count; + [size_is(count)] drsuapi_DsNameInfo1 *array; + } drsuapi_DsNameCtr1; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_DsNameCtr1 *ctr1; + } drsuapi_DsNameCtr; + + WERROR drsuapi_DsCrackNames( + [in] policy_handle *bind_handle, + [in] uint32 level, + [in,ref,switch_is(level)] drsuapi_DsNameRequest *req, + [out,ref] uint32 *level_out, + [out,ref,switch_is(*level_out)] drsuapi_DsNameCtr *ctr + ); + + /*****************/ + /* Function 0x0d */ + typedef [v1_enum] enum { + DRSUAPI_DS_SPN_OPERATION_ADD = 0, + DRSUAPI_DS_SPN_OPERATION_REPLACE= 1, + DRSUAPI_DS_SPN_OPERATION_DELETE = 2 + } drsuapi_DsSpnOperation; + + typedef struct { + drsuapi_DsSpnOperation operation; + uint32 unknown1; + [charset(UTF16),string] uint16 *object_dn; + [range(0,10000)] uint32 count; + [size_is(count)] drsuapi_DsNameString *spn_names; + } drsuapi_DsWriteAccountSpnRequest1; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_DsWriteAccountSpnRequest1 req1; + } drsuapi_DsWriteAccountSpnRequest; + + typedef struct { + WERROR status; + } drsuapi_DsWriteAccountSpnResult1; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_DsWriteAccountSpnResult1 res1; + } drsuapi_DsWriteAccountSpnResult; + + WERROR drsuapi_DsWriteAccountSpn( + [in] policy_handle *bind_handle, + [in] uint32 level, + [in,ref,switch_is(level)] drsuapi_DsWriteAccountSpnRequest *req, + [out,ref] uint32 *level_out, + [out,ref,switch_is(*level_out)] drsuapi_DsWriteAccountSpnResult *res + ); + + /*****************/ + /* Function 0x0e */ + typedef struct { + [charset(UTF16),string] uint16 *server_dn; + [charset(UTF16),string] uint16 *domain_dn; + boolean32 commit; + } drsuapi_DsRemoveDSServerRequest1; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_DsRemoveDSServerRequest1 req1; + } drsuapi_DsRemoveDSServerRequest; + + typedef struct { + boolean32 last_dc_in_domain; + } drsuapi_DsRemoveDSServerResult1; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_DsRemoveDSServerResult1 res1; + } drsuapi_DsRemoveDSServerResult; + + WERROR drsuapi_DsRemoveDSServer( + [in] policy_handle *bind_handle, + [in] uint32 level, + [in,ref,switch_is(level)] drsuapi_DsRemoveDSServerRequest *req, + [out,ref] uint32 *level_out, + [out,ref,switch_is(*level_out)] drsuapi_DsRemoveDSServerResult *res + ); + + /*****************/ + /* Function 0x0f */ + [todo] WERROR DRSUAPI_REMOVE_DS_DOMAIN(); + + /*****************/ + /* Function 0x10 */ + typedef [v1_enum] enum { + DRSUAPI_DC_INFO_CTR_1 = 1, + DRSUAPI_DC_INFO_CTR_2 = 2, + DRSUAPI_DC_INFO_CTR_3 = 3, + DRSUAPI_DC_CONNECTION_CTR_01 = 0xFFFFFFFF + } drsuapi_DsGetDCInfoCtrLevels; + + typedef struct { + [charset(UTF16),string] uint16 *domain_name; /* netbios or dns */ + drsuapi_DsGetDCInfoCtrLevels level; /* specifies the switch level for the request */ + } drsuapi_DsGetDCInfoRequest1; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_DsGetDCInfoRequest1 req1; + } drsuapi_DsGetDCInfoRequest; + + typedef struct { + [charset(UTF16),string] uint16 *netbios_name; + [charset(UTF16),string] uint16 *dns_name; + [charset(UTF16),string] uint16 *site_name; + [charset(UTF16),string] uint16 *computer_dn; + [charset(UTF16),string] uint16 *server_dn; + uint32 is_pdc; + uint32 is_enabled; + } drsuapi_DsGetDCInfo1; + + typedef struct { + [range(0,10000)] uint32 count; + [size_is(count)] drsuapi_DsGetDCInfo1 *array; + } drsuapi_DsGetDCInfoCtr1; + + typedef struct { + [charset(UTF16),string] uint16 *netbios_name; + [charset(UTF16),string] uint16 *dns_name; + [charset(UTF16),string] uint16 *site_name; + [charset(UTF16),string] uint16 *site_dn; + [charset(UTF16),string] uint16 *computer_dn; + [charset(UTF16),string] uint16 *server_dn; + [charset(UTF16),string] uint16 *ntds_dn; + uint32 is_pdc; + uint32 is_enabled; + uint32 is_gc; + GUID site_guid; + GUID computer_guid; + GUID server_guid; + GUID ntds_guid; + } drsuapi_DsGetDCInfo2; + + typedef struct { + [range(0,10000)] uint32 count; + [size_is(count)] drsuapi_DsGetDCInfo2 *array; + } drsuapi_DsGetDCInfoCtr2; + + typedef struct { + [charset(UTF16),string] uint16 *netbios_name; + [charset(UTF16),string] uint16 *dns_name; + [charset(UTF16),string] uint16 *site_name; + [charset(UTF16),string] uint16 *site_dn; + [charset(UTF16),string] uint16 *computer_dn; + [charset(UTF16),string] uint16 *server_dn; + [charset(UTF16),string] uint16 *ntds_dn; + uint32 is_pdc; + uint32 is_enabled; + uint32 is_gc; + uint32 is_rodc; + GUID site_guid; + GUID computer_guid; + GUID server_guid; + GUID ntds_guid; + } drsuapi_DsGetDCInfo3; + + typedef struct { + [range(0,10000)] uint32 count; + [size_is(count)] drsuapi_DsGetDCInfo3 *array; + } drsuapi_DsGetDCInfoCtr3; + + /* + * this represents an active connection to the + * Directory System Agent (DSA) + * this can be via LDAP or DRSUAPI + */ + typedef struct { + [flag(NDR_BIG_ENDIAN)] ipv4address client_ip_address; + uint32 unknown2; + uint32 connection_time; /* in seconds */ + uint32 unknown4; + uint32 unknown5; + uint32 unknown6; + /* + * client_account can be the following: + * "W2K3\Administrator" + * "Administrator@W2K3" + * "cn=Administrator,cn=Users,DC=w2k3,DC=vmnet1,DC=vm,DC=base" + * "" + * or NULL + */ + [charset(UTF16),string] uint16 *client_account; + } drsuapi_DsGetDCConnection01; + + typedef struct { + [range(0,10000)] uint32 count; + [size_is(count)] drsuapi_DsGetDCConnection01 *array; + } drsuapi_DsGetDCConnectionCtr01; + + typedef [switch_type(drsuapi_DsGetDCInfoCtrLevels)] union { + [case(DRSUAPI_DC_INFO_CTR_1)] drsuapi_DsGetDCInfoCtr1 ctr1; + [case(DRSUAPI_DC_INFO_CTR_2)] drsuapi_DsGetDCInfoCtr2 ctr2; + [case(DRSUAPI_DC_INFO_CTR_3)] drsuapi_DsGetDCInfoCtr3 ctr3; + [case(DRSUAPI_DC_CONNECTION_CTR_01)] drsuapi_DsGetDCConnectionCtr01 ctr01; + } drsuapi_DsGetDCInfoCtr; + + WERROR drsuapi_DsGetDomainControllerInfo( + [in] policy_handle *bind_handle, + [in] uint32 level, + [in,ref,switch_is(level)] drsuapi_DsGetDCInfoRequest *req, + [out,ref] drsuapi_DsGetDCInfoCtrLevels *level_out, + [out,ref,switch_is(*level_out)] drsuapi_DsGetDCInfoCtr *ctr + ); + + /*****************/ + /* Function 0x11 */ + typedef [public,noprint] struct { + [max_recursion(20000)] + drsuapi_DsReplicaObjectListItem *next_object; + drsuapi_DsReplicaObject object; + } drsuapi_DsReplicaObjectListItem; + + /* + * The DsAddEntry() call which creates a nTDSDSA object, + * also adds a servicePrincipalName in the following form + * to the computer account of the new domain controller + * referenced by the "serverReferenece" attribute. + * + * E3514235-4B06-11D1-AB04-00C04FC2DCD2/<new-ntdsdsa-object-guid-as-string>/<domain-dns-name> + * + * also note that the "serverReference" isn't added to the new object! + */ + const char *DRSUAPI_NTDSDSA_KRB5_SERVICE_GUID = "E3514235-4B06-11D1-AB04-00C04FC2DCD2"; + + /* Error codes to classify an error that occurs + * during a search for, or the update of, + * a directory object */ + typedef [v1_enum] enum { + DRSUAPI_DIRERR_OK = 0, + DRSUAPI_DIRERR_ATTRIBUTE = 1, + DRSUAPI_DIRERR_NAME = 2, + DRSUAPI_DIRERR_REFERRAL = 3, + DRSUAPI_DIRERR_SECURITY = 4, + DRSUAPI_DIRERR_SERVICE = 5, + DRSUAPI_DIRERR_UPDATE = 6, + DRSUAPI_DIRERR_SYSTEM = 7 + } drsuapi_DsAddEntry_DirErr; + + /* + * Ref: DRS_MSG_ADDENTRYREQ_V2, [MS-DRSR]: 4.1.1.1.3 + */ + typedef struct { + drsuapi_DsReplicaObjectListItem first_object; + } drsuapi_DsAddEntryRequest2; + + /* Buffer type is actually more + * like a semi Flags + * Ref: DRS_SecBuffer, [MS-DRSR]: 5.41 */ + typedef [v1_enum,noprint] enum { + DRSUAPI_SECBUFFER_EMPTY = 0x00000000, + DRSUAPI_SECBUFFER_DATA = 0x00000001, + DRSUAPI_SECBUFFER_TOKEN = 0x00000002, + DRSUAPI_SECBUFFER_PKG_PARAMS = 0x00000003, + DRSUAPI_SECBUFFER_MISSING = 0x00000004, + DRSUAPI_SECBUFFER_EXTRA = 0x00000005, + DRSUAPI_SECBUFFER_STREAM_TRAILER = 0x00000006, + DRSUAPI_SECBUFFER_STREAM_HEADER = 0x00000007, + DRSUAPI_SECBUFFER_READONLY = 0x80000000 + } drsuapi_SecBufferType; + + typedef struct { + [range(0,10000)] uint32 buf_size; + drsuapi_SecBufferType buf_type; + [size_is(buf_size)] uint8 *buffer; + } drsuapi_SecBuffer; + + typedef struct { + [value(0)] uint32 version; + [range(0,10000)] uint32 buff_count; + [size_is(buff_count)] drsuapi_SecBuffer *buffers; + } drsuapi_SecBufferDesc; + + /* + * Ref: DRS_MSG_ADDENTRYREQ_V3, [MS-DRSR]: 4.1.1.1.4 + */ + typedef struct { + drsuapi_DsReplicaObjectListItem first_object; + drsuapi_SecBufferDesc *client_creds; + } drsuapi_DsAddEntryRequest3; + + typedef [switch_type(uint32)] union { + [case(2)] drsuapi_DsAddEntryRequest2 req2; + [case(3)] drsuapi_DsAddEntryRequest3 req3; + } drsuapi_DsAddEntryRequest; + + /* Generic extended error info + * commonly used in most places + * where rich error info is returned */ + typedef struct { + uint32 dsid; /* implementation-specific diagnostic code */ + WERROR extended_err; /* 0, STATUS code, or Windows error code */ + uint32 extended_data; /* implementation-specific diagnostic code */ + uint16 problem; /* 0 or PROBLEM error code */ + } drsuapi_DsAddEntryErrorInfoX; + + /* Attribute errors + * Ref: ATRERR_DRS_WIRE_V1, [MS-DRSR]: 4.1.1.1.11 */ + typedef struct { + uint32 dsid; + WERROR extended_err; + uint32 extended_data; + uint16 problem; + drsuapi_DsAttributeId attid; + boolean32 is_val_returned; + drsuapi_DsAttributeValue attr_val; + } drsuapi_DsAddEntry_AttrErr_V1; + + typedef [noprint] struct { + [max_recursion(20000)] + drsuapi_DsAddEntry_AttrErrListItem_V1 *next; + drsuapi_DsAddEntry_AttrErr_V1 err_data; + } drsuapi_DsAddEntry_AttrErrListItem_V1; + + typedef struct { + drsuapi_DsReplicaObjectIdentifier *id; + uint32 count; + drsuapi_DsAddEntry_AttrErrListItem_V1 first; + } drsuapi_DsAddEntryErrorInfo_Attr_V1; + + /* Name resolution error + * Ref: NAMERR_DRS_WIRE_V1, [MS-DRSR]: 4.1.1.1.14 */ + typedef struct { + uint32 dsid; + WERROR extended_err; + uint32 extended_data; + uint16 problem; + drsuapi_DsReplicaObjectIdentifier *id_matched; /* The best match for the supplied object identity */ + } drsuapi_DsAddEntryErrorInfo_Name_V1; + + /* Referral error + * Ref: REFERR_DRS_WIRE_V1, [MS-DRSR]: 4.1.1.1.15 */ + typedef struct { + [value(83)] uint8 name_res; /* Must be 'S' */ + [value(0)] uint8 unused_pad; + [value(0)] uint16 next_rdn; + } drsuapi_NameResOp_V1; + + typedef [enum16bit] enum { + DRSUAPI_CH_REFTYPE_SUPERIOR = 0x0000, /* referral to a superior DC */ + DRSUAPI_CH_REFTYPE_SUBORDINATE = 0x0001, /* referral to a subordinate DC */ + DRSUAPI_CH_REFTYPE_NSSR = 0x0002, /* Not used */ + DRSUAPI_CH_REFTYPE_CROSS = 0x0003 /* A referral to an external crossRef object */ + } drsuapi_DsAddEntry_RefType; + + typedef [enum8bit] enum { + DRSUAPI_SE_CHOICE_BASE_ONLY = 0x00, + DRSUAPI_SE_CHOICE_IMMED_CHLDRN = 0x01, + DRSUAPI_SE_CHOICE_WHOLE_SUBTREE = 0x02 + } drsuapi_DsAddEntry_ChoiceType; + + /* list of network names of the DCs + * to which the referral is directed */ + typedef struct { + [max_recursion(1024)] drsuapi_DsaAddressListItem_V1 *next; + lsa_String *address; + } drsuapi_DsaAddressListItem_V1; + + typedef struct { + drsuapi_DsReplicaObjectIdentifier *id_target; /* object to which the referral is directed */ + drsuapi_NameResOp_V1 op_state; + [value(0)] uint16 rdn_alias; + [value(0)] uint16 rdn_internal; + drsuapi_DsAddEntry_RefType ref_type; + uint16 addr_list_count; + drsuapi_DsaAddressListItem_V1 *addr_list; + [max_recursion(20000)] + drsuapi_DsAddEntry_RefErrListItem_V1 *next; + boolean32 is_choice_set; + drsuapi_DsAddEntry_ChoiceType choice; + } drsuapi_DsAddEntry_RefErrListItem_V1; + + typedef struct { + uint32 dsid; + WERROR extended_err; + uint32 extended_data; + drsuapi_DsAddEntry_RefErrListItem_V1 refer; + } drsuapi_DsAddEntryErrorInfo_Referr_V1; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_DsAddEntryErrorInfo_Attr_V1 attr_err; + [case(2)] drsuapi_DsAddEntryErrorInfo_Name_V1 name_err; + [case(3)] drsuapi_DsAddEntryErrorInfo_Referr_V1 referral_err; + [case(4)] drsuapi_DsAddEntryErrorInfoX security_err; + [case(5)] drsuapi_DsAddEntryErrorInfoX service_err; + [case(6)] drsuapi_DsAddEntryErrorInfoX update_err; + [case(7)] drsuapi_DsAddEntryErrorInfoX system_err; + } drsuapi_DsAddEntryErrorInfo; + + typedef struct { + WERROR status; + drsuapi_DsAddEntry_DirErr dir_err; + [switch_is(dir_err)] drsuapi_DsAddEntryErrorInfo *info; + } drsuapi_DsAddEntry_ErrData_V1; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_DsAddEntry_ErrData_V1 v1; + } drsuapi_DsAddEntry_ErrData; + + typedef struct { + GUID guid; + dom_sid28 sid; + } drsuapi_DsReplicaObjectIdentifier2; + + typedef struct { + drsuapi_DsReplicaObjectIdentifier *id; + drsuapi_DsAddEntry_DirErr dir_err; + uint32 dsid; /* implementation-specific diagnostic code */ + WERROR extended_err; /* 0, STATUS code, or Windows error code */ + uint32 extended_data; /* implementation-specific diagnostic code */ + uint16 problem; /* 0 or PROBLEM error code */ + [range(0,10000)] uint32 count; + [size_is(count)] drsuapi_DsReplicaObjectIdentifier2 *objects; + } drsuapi_DsAddEntryCtr2; + + typedef struct { + drsuapi_DsReplicaObjectIdentifier *id; + uint32 err_ver; /* Must be 1 */ + [switch_is(err_ver)] drsuapi_DsAddEntry_ErrData *err_data; + [range(0,10000)] uint32 count; + [size_is(count)] drsuapi_DsReplicaObjectIdentifier2 *objects; + } drsuapi_DsAddEntryCtr3; + + typedef [switch_type(uint32)] union { + [case(2)] drsuapi_DsAddEntryCtr2 ctr2; + [case(3)] drsuapi_DsAddEntryCtr3 ctr3; + } drsuapi_DsAddEntryCtr; + + [public] WERROR drsuapi_DsAddEntry( + [in] policy_handle *bind_handle, + [in] uint32 level, + [in,ref,switch_is(level)] drsuapi_DsAddEntryRequest *req, + [out,ref] uint32 *level_out, + [out,ref,switch_is(*level_out)] drsuapi_DsAddEntryCtr *ctr + ); + + /*****************/ + /* Function 0x12 */ + typedef bitmap { + DRSUAPI_DS_EXECUTE_KCC_ASYNCHRONOUS_OPERATION = 0x00000001, + DRSUAPI_DS_EXECUTE_KCC_DAMPED = 0x00000002 + } drsuapi_DsExecuteKCCFlags; + + typedef struct { + uint32 taskID; + drsuapi_DsExecuteKCCFlags flags; + } drsuapi_DsExecuteKCC1; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_DsExecuteKCC1 ctr1; + } drsuapi_DsExecuteKCCRequest; + + WERROR drsuapi_DsExecuteKCC( + [in] policy_handle *bind_handle, + [in] uint32 level, + [in, ref, switch_is(level)] drsuapi_DsExecuteKCCRequest *req + ); + + /*****************/ + /* Function 0x13 */ + typedef [v1_enum] enum { + DRSUAPI_DS_REPLICA_GET_INFO = 1, + DRSUAPI_DS_REPLICA_GET_INFO2 = 2 + } drsuapi_DsReplicaGetInfoLevel; + + typedef [v1_enum] enum { + DRSUAPI_DS_REPLICA_INFO_NEIGHBORS = 0, + DRSUAPI_DS_REPLICA_INFO_CURSORS = 1, + DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA = 2, + DRSUAPI_DS_REPLICA_INFO_KCC_DSA_CONNECT_FAILURES = 3, + DRSUAPI_DS_REPLICA_INFO_KCC_DSA_LINK_FAILURES = 4, + DRSUAPI_DS_REPLICA_INFO_PENDING_OPS = 5, + DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA = 6, + DRSUAPI_DS_REPLICA_INFO_CURSORS2 = 7, + DRSUAPI_DS_REPLICA_INFO_CURSORS3 = 8, + DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2 = 9, + DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2 = 10, + DRSUAPI_DS_REPLICA_INFO_REPSTO = -2, + DRSUAPI_DS_REPLICA_INFO_CLIENT_CONTEXTS = -4, + DRSUAPI_DS_REPLICA_INFO_UPTODATE_VECTOR_V1 = -5, + DRSUAPI_DS_REPLICA_INFO_SERVER_OUTGOING_CALLS = -6 + } drsuapi_DsReplicaInfoType; + + typedef struct { + drsuapi_DsReplicaInfoType info_type; + [charset(UTF16),string] uint16 *object_dn; + GUID source_dsa_guid; + } drsuapi_DsReplicaGetInfoRequest1; + + typedef struct { + drsuapi_DsReplicaInfoType info_type; + [charset(UTF16),string] uint16 *object_dn; + GUID source_dsa_guid; + uint32 flags; + [charset(UTF16),string] uint16 *attribute_name; + [charset(UTF16),string] uint16 *value_dn_str; + uint32 enumeration_context; + } drsuapi_DsReplicaGetInfoRequest2; + + typedef [switch_type(drsuapi_DsReplicaGetInfoLevel)] union { + [case(DRSUAPI_DS_REPLICA_GET_INFO)] drsuapi_DsReplicaGetInfoRequest1 req1; + [case(DRSUAPI_DS_REPLICA_GET_INFO2)] drsuapi_DsReplicaGetInfoRequest2 req2; + } drsuapi_DsReplicaGetInfoRequest; + + typedef struct { + [charset(UTF16),string] uint16 *naming_context_dn; + [charset(UTF16),string] uint16 *source_dsa_obj_dn; + [charset(UTF16),string] uint16 *source_dsa_address; + [charset(UTF16),string] uint16 *transport_obj_dn; + drsuapi_DrsOptions replica_flags; + uint32 reserved; + GUID naming_context_obj_guid; + GUID source_dsa_obj_guid; + GUID source_dsa_invocation_id; + GUID transport_obj_guid; + hyper tmp_highest_usn; + hyper highest_usn; + NTTIME last_success; + NTTIME last_attempt; + WERROR result_last_attempt; + uint32 consecutive_sync_failures; + } drsuapi_DsReplicaNeighbour; + + typedef struct { + uint32 count; + uint32 reserved; + [size_is(count)] drsuapi_DsReplicaNeighbour array[]; + } drsuapi_DsReplicaNeighbourCtr; + + typedef struct { + uint32 count; + uint32 reserved; + [size_is(count)] drsuapi_DsReplicaCursor array[]; + } drsuapi_DsReplicaCursorCtr; + + typedef struct { + [charset(UTF16),string] uint16 *attribute_name; + uint32 version; + NTTIME originating_change_time; + GUID originating_invocation_id; + hyper originating_usn; + hyper local_usn; + } drsuapi_DsReplicaObjMetaData; + + typedef struct { + uint32 count; + uint32 reserved; + [size_is(count)] drsuapi_DsReplicaObjMetaData array[]; + } drsuapi_DsReplicaObjMetaDataCtr; + + typedef struct { + [charset(UTF16),string] uint16 *dsa_obj_dn; + GUID dsa_obj_guid; + NTTIME first_failure; + uint32 num_failures; + WERROR last_result; + } drsuapi_DsReplicaKccDsaFailure; + + typedef struct { + uint32 count; + uint32 reserved; + [size_is(count)] drsuapi_DsReplicaKccDsaFailure array[]; + } drsuapi_DsReplicaKccDsaFailuresCtr; + + typedef enum { + DRSUAPI_DS_REPLICA_OP_TYPE_SYNC = 0, + DRSUAPI_DS_REPLICA_OP_TYPE_ADD = 1, + DRSUAPI_DS_REPLICA_OP_TYPE_DELETE = 2, + DRSUAPI_DS_REPLICA_OP_TYPE_MODIFY = 3, + DRSUAPI_DS_REPLICA_OP_TYPE_UPDATE_REFS = 4 + } drsuapi_DsReplicaOpType; + + typedef struct { + NTTIME operation_start; + uint32 serial_num; /* unique till reboot */ + uint32 priority; + drsuapi_DsReplicaOpType operation_type; + drsuapi_DrsOptions options; + [charset(UTF16),string] uint16 *nc_dn; + [charset(UTF16),string] uint16 *remote_dsa_obj_dn; + [charset(UTF16),string] uint16 *remote_dsa_address; + GUID nc_obj_guid; + GUID remote_dsa_obj_guid; + } drsuapi_DsReplicaOp; + + typedef struct { + NTTIME time; + uint32 count; + [size_is(count)] drsuapi_DsReplicaOp array[]; + } drsuapi_DsReplicaOpCtr; + + typedef struct { + [charset(UTF16),string] uint16 *attribute_name; + [charset(UTF16),string] uint16 *object_dn; + [value(ndr_size_DATA_BLOB(0,binary,0))] uint32 __ndr_size_binary; + DATA_BLOB *binary; + NTTIME deleted; + NTTIME created; + uint32 version; + NTTIME originating_change_time; + GUID originating_invocation_id; + hyper originating_usn; + hyper local_usn; + } drsuapi_DsReplicaAttrValMetaData; + + typedef struct { + uint32 count; + uint32 enumeration_context; + [size_is(count)] drsuapi_DsReplicaAttrValMetaData array[]; + } drsuapi_DsReplicaAttrValMetaDataCtr; + + typedef struct { + uint32 count; + uint32 enumeration_context; + [size_is(count)] drsuapi_DsReplicaCursor2 array[]; + } drsuapi_DsReplicaCursor2Ctr; + + typedef struct { + GUID source_dsa_invocation_id; + hyper highest_usn; + NTTIME last_sync_success; + [charset(UTF16),string] uint16 *source_dsa_obj_dn; + } drsuapi_DsReplicaCursor3; + + typedef struct { + uint32 count; + uint32 enumeration_context; + [size_is(count)] drsuapi_DsReplicaCursor3 array[]; + } drsuapi_DsReplicaCursor3Ctr; + + typedef struct { + [charset(UTF16),string] uint16 *attribute_name; + uint32 version; + NTTIME originating_change_time; + GUID originating_invocation_id; + hyper originating_usn; + hyper local_usn; + [charset(UTF16),string] uint16 *originating_dsa_dn; + } drsuapi_DsReplicaObjMetaData2; + + typedef struct { + uint32 count; + uint32 enumeration_context; + [size_is(count)] drsuapi_DsReplicaObjMetaData2 array[]; + } drsuapi_DsReplicaObjMetaData2Ctr; + + typedef struct { + [charset(UTF16),string] uint16 *attribute_name; + [charset(UTF16),string] uint16 *object_dn; + [value(ndr_size_DATA_BLOB(0,binary,0))] uint32 __ndr_size_binary; + DATA_BLOB *binary; + NTTIME deleted; + NTTIME created; + uint32 version; + NTTIME originating_change_time; + GUID originating_invocation_id; + hyper originating_usn; + hyper local_usn; + [charset(UTF16),string] uint16 *originating_dsa_dn; + } drsuapi_DsReplicaAttrValMetaData2; + + typedef struct { + uint32 count; + uint32 enumeration_context; + [size_is(count)] drsuapi_DsReplicaAttrValMetaData2 array[]; + } drsuapi_DsReplicaAttrValMetaData2Ctr; + + typedef struct { + hyper u1; /* session number? */ + uint32 u2; + uint32 u3; + GUID bind_guid; + NTTIME_1sec bind_time; + [flag(NDR_BIG_ENDIAN)] ipv4address client_ip_address; + uint32 u5; /* this is the same value the client used as pid in the DsBindInfoX struct */ + } drsuapi_DsReplicaConnection04; + + typedef struct { + [range(0,10000)] uint32 count; + uint32 reserved; + [size_is(count)] drsuapi_DsReplicaConnection04 array[]; + } drsuapi_DsReplicaConnection04Ctr; + + typedef struct { + [charset(UTF16),string] uint16 *str1; + uint32 u1; + uint32 u2; + uint32 u3; + uint32 u4; + uint32 u5; + hyper u6; + uint32 u7; + } drsuapi_DsReplica06; + + typedef struct { + [range(0,256)] uint32 count; + uint32 reserved; + [size_is(count)] drsuapi_DsReplica06 array[]; + } drsuapi_DsReplica06Ctr; + + typedef [switch_type(drsuapi_DsReplicaInfoType)] union { + [case(DRSUAPI_DS_REPLICA_INFO_NEIGHBORS)] drsuapi_DsReplicaNeighbourCtr *neighbours; + [case(DRSUAPI_DS_REPLICA_INFO_CURSORS)] drsuapi_DsReplicaCursorCtr *cursors; + [case(DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA)] drsuapi_DsReplicaObjMetaDataCtr *objmetadata; + [case(DRSUAPI_DS_REPLICA_INFO_KCC_DSA_CONNECT_FAILURES)] drsuapi_DsReplicaKccDsaFailuresCtr *connectfailures; + [case(DRSUAPI_DS_REPLICA_INFO_KCC_DSA_LINK_FAILURES)] drsuapi_DsReplicaKccDsaFailuresCtr *linkfailures; + [case(DRSUAPI_DS_REPLICA_INFO_PENDING_OPS)] drsuapi_DsReplicaOpCtr *pendingops; + [case(DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA)] drsuapi_DsReplicaAttrValMetaDataCtr *attrvalmetadata; + [case(DRSUAPI_DS_REPLICA_INFO_CURSORS2)] drsuapi_DsReplicaCursor2Ctr *cursors2; + [case(DRSUAPI_DS_REPLICA_INFO_CURSORS3)] drsuapi_DsReplicaCursor3Ctr *cursors3; + [case(DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2)] drsuapi_DsReplicaObjMetaData2Ctr *objmetadata2; + [case(DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2)] drsuapi_DsReplicaAttrValMetaData2Ctr *attrvalmetadata2; + [case(DRSUAPI_DS_REPLICA_INFO_REPSTO)] drsuapi_DsReplicaNeighbourCtr *repsto; + [case(DRSUAPI_DS_REPLICA_INFO_CLIENT_CONTEXTS)] drsuapi_DsReplicaConnection04Ctr *clientctx; + [case(DRSUAPI_DS_REPLICA_INFO_UPTODATE_VECTOR_V1)] drsuapi_DsReplicaCursorCtrEx *udv1; + [case(DRSUAPI_DS_REPLICA_INFO_SERVER_OUTGOING_CALLS)] drsuapi_DsReplica06Ctr *srvoutgoingcalls; + } drsuapi_DsReplicaInfo; + + WERROR drsuapi_DsReplicaGetInfo( + [in] policy_handle *bind_handle, + [in] drsuapi_DsReplicaGetInfoLevel level, + [in,ref,switch_is(level)] drsuapi_DsReplicaGetInfoRequest *req, + [out,ref] drsuapi_DsReplicaInfoType *info_type, + [out,ref,switch_is(*info_type)] drsuapi_DsReplicaInfo *info + ); + + /*****************/ + /* Function 0x14 */ + [todo] WERROR DRSUAPI_ADD_SID_HISTORY(); + + /*****************/ + /* Function 0x15 */ + + typedef struct { + [range(0,10000)] uint32 num_entries; + [size_is(num_entries)] drsuapi_DsGetMembershipsCtr1 **ctrl_array; + } drsuapi_DsGetMemberships2Ctr1; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_DsGetMembershipsCtr1 ctr1; + } drsuapi_DsGetMemberships2Ctr; + + typedef struct { + [range(1,10000)] uint32 num_req; + [size_is(num_req)] drsuapi_DsGetMembershipsRequest1 **req_array; + } drsuapi_DsGetMemberships2Request1; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_DsGetMemberships2Request1 req1; + } drsuapi_DsGetMemberships2Request; + + WERROR drsuapi_DsGetMemberships2( + [in] policy_handle *bind_handle, + [in] uint32 level, + [in,ref] [switch_is(level)] drsuapi_DsGetMemberships2Request *req, + [out,ref] uint32 *level_out, + [out,ref] [switch_is(*level_out)] drsuapi_DsGetMemberships2Ctr *ctr + ); + + /*****************/ + /* Function 0x16 */ + [todo] WERROR DRSUAPI_REPLICA_VERIFY_OBJECTS(); + + /*****************/ + /* Function 0x17 */ + [todo] WERROR DRSUAPI_GET_OBJECT_EXISTENCE(); + + /*****************/ + /* Function 0x18 */ + typedef struct { + WERROR error_code; + uint32 site_cost; + } drsuapi_DsSiteCostInfo; + + typedef struct { + [range(0,10000)] uint32 num_info; + [size_is(num_info)] drsuapi_DsSiteCostInfo *info; + [value(0)] uint32 flags_reserved; + } drsuapi_QuerySitesByCostCtr1; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_QuerySitesByCostCtr1 ctr1; + } drsuapi_QuerySitesByCostCtr; + + typedef struct { + [charset(UTF16),string] uint16 *site_from; + [range(1,10000)] uint32 num_req; + [size_is(num_req)] [charset(UTF16),string] uint16 **site_to; + uint32 flags; + } drsuapi_QuerySitesByCostRequest1; + + typedef [switch_type(uint32)] union { + [case(1)] drsuapi_QuerySitesByCostRequest1 req1; + } drsuapi_QuerySitesByCostRequest; + + WERROR drsuapi_QuerySitesByCost( + [in] policy_handle *bind_handle, + [in] uint32 level, + [in,ref] [switch_is(level)] drsuapi_QuerySitesByCostRequest *req, + [out,ref] uint32 *level_out, + [out,ref] [switch_is(*level_out)] drsuapi_QuerySitesByCostCtr *ctr + ); +} diff --git a/librpc/idl/dsbackup.idl b/librpc/idl/dsbackup.idl new file mode 100644 index 0000000..72e8bf9 --- /dev/null +++ b/librpc/idl/dsbackup.idl @@ -0,0 +1,34 @@ +[ + uuid("ecec0d70-a603-11d0-96b1-00a0c91ece30"), + version(1.0), + pointer_default(unique), + helpstring("Backup support for Active Directory") +] interface ad_backup +{ + [todo] void HrRBackupPrepare(); + [todo] void HrRBackupEnd(); + [todo] void HrRBackupGetAttachmentInformation(); + [todo] void HrRBackupOpenFile(); + [todo] void HrRBackupRead(); + [todo] void HrRBackupClose(); + [todo] void HrRBackupGetBackupLogs(); + [todo] void HrRBackupTruncateLogs(); + [todo] void HrRBackupPing(); +} + +[ + uuid("16e0cf3a-a604-11d0-96b1-00a0c91ece30"), + version(1.0), + pointer_default(unique), + helpstring("Restoring Active Directory backups") +] interface ad_restore +{ + [todo] void HrRIsNTDSOnline(); + [todo] void HrRRestorePrepare(); + [todo] void HrRRestoreRegister(); + [todo] void HrRRestoreRegisterComplete(); + [todo] void HrRRestoreGetDatabaseLocations(); + [todo] void HrRRestoreEnd(); + [todo] void HrRRestoreSetCurrentLogNumber(); + [todo] void HrRRestoreCheckLogsForBackup(); +} diff --git a/librpc/idl/dssetup.idl b/librpc/idl/dssetup.idl new file mode 100644 index 0000000..14de9f7 --- /dev/null +++ b/librpc/idl/dssetup.idl @@ -0,0 +1,101 @@ +/* + dssetup interface definition +*/ + +import "misc.idl"; + +[ + uuid("3919286a-b10c-11d0-9ba8-00c04fd92ef5"), + version(0.0), + endpoint("ncacn_np:[\\pipe\\lsarpc]", "ncacn_np:[\\pipe\\lsass]", "ncacn_ip_tcp:", "ncalrpc:"), + pointer_default(unique), + helpstring("Active Directory Setup") +] interface dssetup +{ + /**********************************************/ + /* Function 0x00 */ + + typedef enum { + DS_ROLE_STANDALONE_WORKSTATION = 0, + DS_ROLE_MEMBER_WORKSTATION = 1, + DS_ROLE_STANDALONE_SERVER = 2, + DS_ROLE_MEMBER_SERVER = 3, + DS_ROLE_BACKUP_DC = 4, + DS_ROLE_PRIMARY_DC = 5 + } dssetup_DsRole; + + typedef [bitmap32bit] bitmap { + DS_ROLE_PRIMARY_DS_RUNNING = 0x00000001, + DS_ROLE_PRIMARY_DS_MIXED_MODE = 0x00000002, + DS_ROLE_UPGRADE_IN_PROGRESS = 0x00000004, + DS_ROLE_PRIMARY_DOMAIN_GUID_PRESENT = 0x01000000 + } dssetup_DsRoleFlags; + + typedef struct { + dssetup_DsRole role; + dssetup_DsRoleFlags flags; + [charset(UTF16),string] uint16 *domain; + [charset(UTF16),string] uint16 *dns_domain; + [charset(UTF16),string] uint16 *forest; + GUID domain_guid; + } dssetup_DsRolePrimaryDomInfoBasic; + + typedef [v1_enum] enum { + DS_ROLE_NOT_UPGRADING = 0, + DS_ROLE_UPGRADING = 1 + } dssetup_DsUpgrade; + + typedef enum { + DS_ROLE_PREVIOUS_UNKNOWN = 0, + DS_ROLE_PREVIOUS_PRIMARY = 1, + DS_ROLE_PREVIOUS_BACKUP = 2 + } dssetup_DsPrevious; + + typedef struct { + dssetup_DsUpgrade upgrading; + dssetup_DsPrevious previous_role; + } dssetup_DsRoleUpgradeStatus; + + typedef enum { + DS_ROLE_OP_IDLE = 0, + DS_ROLE_OP_ACTIVE = 1, + DS_ROLE_OP_NEEDS_REBOOT = 2 + } dssetup_DsRoleOp; + + typedef struct { + dssetup_DsRoleOp status; + } dssetup_DsRoleOpStatus; + + typedef enum { + DS_ROLE_BASIC_INFORMATION = 1, + DS_ROLE_UPGRADE_STATUS = 2, + DS_ROLE_OP_STATUS = 3 + } dssetup_DsRoleInfoLevel; + + typedef [switch_type(dssetup_DsRoleInfoLevel)] union { + [case(DS_ROLE_BASIC_INFORMATION)] dssetup_DsRolePrimaryDomInfoBasic basic; + [case(DS_ROLE_UPGRADE_STATUS)] dssetup_DsRoleUpgradeStatus upgrade; + [case(DS_ROLE_OP_STATUS)] dssetup_DsRoleOpStatus opstatus; + } dssetup_DsRoleInfo; + + WERROR dssetup_DsRoleGetPrimaryDomainInformation( + [in] dssetup_DsRoleInfoLevel level, + [out,switch_is(level),unique] dssetup_DsRoleInfo *info + ); + + /* + w2k3 has removed all the calls below from their implementation. + These stubs are left here only as a way of documenting the names + of the calls in case they ever turn up on the wire. + */ + [todo] WERROR dssetup_DsRoleDnsNameToFlatName(); + [todo] WERROR dssetup_DsRoleDcAsDc(); + [todo] WERROR dssetup_DsRoleDcAsReplica(); + [todo] WERROR dssetup_DsRoleDemoteDc(); + [todo] WERROR dssetup_DsRoleGetDcOperationProgress(); + [todo] WERROR dssetup_DsRoleGetDcOperationResults(); + [todo] WERROR dssetup_DsRoleCancel(); + [todo] WERROR dssetup_DsRoleServerSaveStateForUpgrade(); + [todo] WERROR dssetup_DsRoleUpgradeDownlevelServer(); + [todo] WERROR dssetup_DsRoleAbortDownlevelServerUpgrade(); +} diff --git a/librpc/idl/echo.idl b/librpc/idl/echo.idl new file mode 100644 index 0000000..bf1e318 --- /dev/null +++ b/librpc/idl/echo.idl @@ -0,0 +1,127 @@ + +[ + uuid("60a15ec5-4de8-11d7-a637-005056a20182"), + endpoint("ncacn_np:[\\pipe\\rpcecho]", "ncacn_ip_tcp:", "ncalrpc:"), + pointer_default(unique), + version(1.0), + helpstring("Simple echo pipe") +] +interface rpcecho +{ + /* Add one to an integer */ + void echo_AddOne( + [in] uint32 in_data, + [out] uint32 *out_data + ); + /* Echo an array of bytes back at the caller */ + void echo_EchoData( + [in] uint32 len, + [in] [size_is(len)] uint8 in_data[], + [out] [size_is(len)] uint8 out_data[] + ); + /* Sink data to the server */ + void echo_SinkData( + [in] uint32 len, + [in,size_is(len)] uint8 data[] + ); + /* Source data from server */ + void echo_SourceData( + [in] uint32 len, + [out,size_is(len)] uint8 data[] + ); + + /* test strings */ + void echo_TestCall ( + [in,string,charset(UTF16)] uint16 *s1, + [out,string,charset(UTF16)] uint16 **s2 + ); + + + /* test some alignment issues */ + typedef [public] struct { + uint8 v; + } echo_info1; + + typedef struct { + uint16 v; + } echo_info2; + + typedef struct { + uint32 v; + } echo_info3; + + struct echo_info4 { + hyper v; + }; + + typedef struct { + uint8 v1; + hyper v2; + } echo_info5; + + typedef struct { + uint8 v1; + echo_info1 info1; + } echo_info6; + + typedef struct { + uint8 v1; + struct echo_info4 info4; + } echo_info7; + + typedef [switch_type(uint16)] union { + [case(1)] echo_info1 info1; + [case(2)] echo_info2 info2; + [case(3)] echo_info3 info3; + [case(4)] struct echo_info4 info4; + [case(5)] echo_info5 info5; + [case(6)] echo_info6 info6; + [case(7)] echo_info7 info7; + } echo_Info; + + NTSTATUS echo_TestCall2 ( + [in] uint16 level, + [out,switch_is(level)] echo_Info *info + ); + + uint32 echo_TestSleep( + [in] uint32 seconds + ); + + typedef enum { + ECHO_ENUM1 = 1, + ECHO_ENUM2 = 2 + } echo_Enum1; + + typedef [v1_enum] enum { + ECHO_ENUM1_32 = 1, + ECHO_ENUM2_32 = 2 + } echo_Enum1_32; + + typedef struct { + echo_Enum1 e1; + echo_Enum1_32 e2; + } echo_Enum2; + + typedef [switch_type(uint16)] union { + [case(ECHO_ENUM1)] echo_Enum1 e1; + [case(ECHO_ENUM2)] echo_Enum2 e2; + } echo_Enum3; + + void echo_TestEnum( + [in,out,ref] echo_Enum1 *foo1, + [in,out,ref] echo_Enum2 *foo2, + [in,out,ref,switch_is(*foo1)] echo_Enum3 *foo3 + ); + + typedef struct { + uint32 x; + [size_is(x)] uint16 surrounding[*]; + } echo_Surrounding; + + void echo_TestSurrounding( + [in,out,ref] echo_Surrounding *data + ); + + uint16 echo_TestDoublePointer([in] uint16 ***data); +} diff --git a/librpc/idl/efs.idl b/librpc/idl/efs.idl new file mode 100644 index 0000000..4279b08 --- /dev/null +++ b/librpc/idl/efs.idl @@ -0,0 +1,108 @@ +/* + IDL definitions from original packet-dcerpc-efs.c + by Jean-Baptiste Marchand +*/ + +import "security.idl"; + +[ + uuid("c681d488-d850-11d0-8c52-00c04fd90f7e"), + version(1.0), + pointer_default(unique) +] interface efs +{ + +WERROR EfsRpcOpenFileRaw( + [out,ref] policy_handle *pvContext, + [in] [charset(UTF16),string] uint16 FileName[], + [in] uint32 Flags + ); + +[todo] WERROR EfsRpcReadFileRaw( + [in,ref] policy_handle *pvContext +/* incomplete */ +); + + +[todo] WERROR EfsRpcWriteFileRaw( + [in,ref] policy_handle *pvContext +/* incomplete */ +); + +void EfsRpcCloseRaw( + [in,out,ref] policy_handle *pvContext +); + +WERROR EfsRpcEncryptFileSrv( + [in] [charset(UTF16),string] uint16 Filename[] +); + +WERROR EfsRpcDecryptFileSrv( + [in] [charset(UTF16),string] uint16 FileName[], + [in] uint32 Reserved +); + +typedef struct { + uint32 cbData; + [size_is(cbData), unique] uint8 *pbData; +} EFS_HASH_BLOB; + +typedef struct { + uint32 cbTotalLength; + [unique] dom_sid *pUserSid; + [unique] EFS_HASH_BLOB *pHash; + [unique] [charset(UTF16),string] uint16 *lpDisplayInformation; +} ENCRYPTION_CERTIFICATE_HASH; + +typedef struct { + uint32 nCert_Hash; + /* this is a pointer to an array of pointers */ + [size_is(nCert_Hash)] ENCRYPTION_CERTIFICATE_HASH *pUsers[*]; +} ENCRYPTION_CERTIFICATE_HASH_LIST; + +WERROR EfsRpcQueryUsersOnFile( + [in] [charset(UTF16),string] uint16 FileName[], + [out,ref,unique] ENCRYPTION_CERTIFICATE_HASH_LIST **pUsers +); + +WERROR EfsRpcQueryRecoveryAgents( + [in] [charset(UTF16),string] uint16 FileName[], + [out,ref,unique] ENCRYPTION_CERTIFICATE_HASH_LIST **pRecoveryAgents +); + +[todo] WERROR EfsRpcRemoveUsersFromFile( + [in] [charset(UTF16),string] uint16 FileName[] + /* [in] ENCRYPTION_CERTIFICATE_LIST Hashes*/ +); + +[todo] WERROR EfsRpcAddUsersToFile( + [in] [charset(UTF16),string] uint16 FileName[] + /* [in] ENCRYPTION_CERTIFICATE_LIST Hashes*/ +); + +typedef struct { + uint32 dwCertEncodingType; + uint32 cbData; + [size_is(cbData)] [unique] uint8 *pbData; +} EFS_CERTIFICATE_BLOB; + +typedef struct { + uint32 TotalLength; + [unique] dom_sid *pUserSid; + [unique] EFS_CERTIFICATE_BLOB *pCertBlob; +} ENCRYPTION_CERTIFICATE; + +WERROR EfsRpcSetFileEncryptionKey( + [in] [unique] ENCRYPTION_CERTIFICATE *pEncryptionCertificate +); + +[todo] WERROR EfsRpcNotSupported( +); + +[todo] WERROR EfsRpcFileKeyInfo( +); + +[todo] WERROR EfsRpcDuplicateEncryptionInfoFile( +); + +} diff --git a/librpc/idl/epmapper.idl b/librpc/idl/epmapper.idl new file mode 100644 index 0000000..fd8eeb4 --- /dev/null +++ b/librpc/idl/epmapper.idl @@ -0,0 +1,328 @@ +#include "idl_types.h" + +/* + endpoint mapper interface + Related links: + http://www.opengroup.org/onlinepubs/9629399/apdxo.htm : The official IDL for this pipe + http://www.opengroup.org/onlinepubs/9629399/apdxl.htm : Details on towers +http://www.opengroup.org/onlinepubs/9629399/chap6.htm#tagcjh_11_02_03_01: binding strings + +*/ + +import "misc.idl"; + +[ + uuid("e1af8308-5d1f-11c9-91a4-08002b14a0fa"), + version(3.0), + endpoint("ncacn_np:[\\pipe\\epmapper]", "ncacn_ip_tcp:[135]", + "ncacn_http:[593]", "ncalrpc:[EPMAPPER]"), + helpstring("EndPoint Mapper"), + pointer_default(ptr) +] +interface epmapper +{ + + /* + note that the following IDL won't work in MIDL, and in fact + that the full towers/floors representation of epm cannot be + represented in MIDL at all. I decided to represent it using + the extended IDL syntax in pidl to make it easier to work + with. + */ + + const int EPMAPPER_STATUS_CANT_PERFORM_OP = 0x6d8; + const int EPMAPPER_STATUS_NO_MORE_ENTRIES = 0x16c9a0d6; + const int EPMAPPER_STATUS_NO_MEMORY = 0x16C9A012; + const int EPMAPPER_STATUS_OK = 0; + + typedef [enum8bit] enum { + + /* Level 4 and higher */ + EPM_PROTOCOL_DNET_NSP = 0x04, + EPM_PROTOCOL_OSI_TP4 = 0x05, + EPM_PROTOCOL_OSI_CLNS = 0x06, + EPM_PROTOCOL_TCP = 0x07, + EPM_PROTOCOL_UDP = 0x08, + EPM_PROTOCOL_IP = 0x09, + /* These 4 are protocol identifiers, always at level 3 or lower */ + EPM_PROTOCOL_NCADG = 0x0a, /* Connectionless RPC */ + EPM_PROTOCOL_NCACN = 0x0b, + EPM_PROTOCOL_NCALRPC = 0x0c, /* Local RPC */ + EPM_PROTOCOL_UUID = 0x0d, + EPM_PROTOCOL_IPX = 0x0e, + EPM_PROTOCOL_SMB = 0x0f, + EPM_PROTOCOL_NAMED_PIPE = 0x10, + EPM_PROTOCOL_NETBIOS = 0x11, + EPM_PROTOCOL_NETBEUI = 0x12, + EPM_PROTOCOL_SPX = 0x13, + EPM_PROTOCOL_NB_IPX = 0x14, /* NetBIOS over IPX */ + EPM_PROTOCOL_DSP = 0x16, /* AppleTalk Data Stream Protocol */ + EPM_PROTOCOL_DDP = 0x17, /* AppleTalk Data Datagram Protocol */ + EPM_PROTOCOL_APPLETALK = 0x18, /* AppleTalk */ + EPM_PROTOCOL_VINES_SPP = 0x1a, + EPM_PROTOCOL_VINES_IPC = 0x1b, /* Inter Process Communication */ + EPM_PROTOCOL_STREETTALK = 0x1c, /* Vines Streettalk */ + EPM_PROTOCOL_HTTP = 0x1f, + EPM_PROTOCOL_UNIX_DS = 0x20, /* Unix domain socket */ + EPM_PROTOCOL_NULL = 0x21 + } epm_protocol; + + typedef struct { + /*FIXME */ + } epm_rhs_dnet_nsp; + + typedef struct { + /*FIXME*/ + } epm_rhs_osi_tp4; + + typedef struct { + /*FIXME*/ + } epm_rhs_osi_clns; + + typedef struct { + uint16 port; + } epm_rhs_udp; + + typedef struct { + uint16 port; + } epm_rhs_tcp; + + typedef struct { + ipv4address ipaddr; + } epm_rhs_ip; + + typedef struct { + uint16 minor_version; + } epm_rhs_ncadg; + + typedef struct { + uint16 minor_version; + } epm_rhs_ncacn; + + typedef struct { + [flag(NDR_REMAINING)] DATA_BLOB unknown; + } epm_rhs_uuid; + + typedef struct { + /*FIXME */ + } epm_rhs_ipx; + + typedef struct { + astring unc; + } epm_rhs_smb; + + typedef struct { + astring path; + } epm_rhs_named_pipe; + + typedef struct { + astring name; + } epm_rhs_netbios; + + typedef struct { + } epm_rhs_netbeui; + + typedef struct { + } epm_rhs_spx; + + typedef struct { + } epm_rhs_nb_ipx; + + typedef struct { + uint16 port; + } epm_rhs_http; + + typedef struct { + astring path; + } epm_rhs_unix_ds; + + typedef struct { + } epm_rhs_null; + + typedef struct { + uint16 minor_version; + } epm_rhs_ncalrpc; + + typedef struct { + } epm_rhs_appletalk; + + typedef struct { + } epm_rhs_atalk_stream; + + typedef struct { + } epm_rhs_atalk_datagram; + + typedef struct { + uint16 port; + } epm_rhs_vines_spp; + + typedef struct { + uint16 port; + } epm_rhs_vines_ipc; + + typedef struct { + astring streettalk; + } epm_rhs_streettalk; + + typedef [flag(NDR_BIG_ENDIAN),nodiscriminant] union { + [case(EPM_PROTOCOL_DNET_NSP)] epm_rhs_dnet_nsp dnet_nsp; + [case(EPM_PROTOCOL_OSI_TP4)] epm_rhs_osi_tp4 osi_tp4; + [case(EPM_PROTOCOL_OSI_CLNS)] epm_rhs_osi_clns osi_clns; + [case(EPM_PROTOCOL_TCP)] epm_rhs_tcp tcp; + [case(EPM_PROTOCOL_UDP)] epm_rhs_udp udp; + [case(EPM_PROTOCOL_IP)] epm_rhs_ip ip; + [case(EPM_PROTOCOL_NCADG)] epm_rhs_ncadg ncadg; + [case(EPM_PROTOCOL_NCACN)] epm_rhs_ncacn ncacn; + [case(EPM_PROTOCOL_NCALRPC)] epm_rhs_ncalrpc ncalrpc; + [case(EPM_PROTOCOL_UUID)] epm_rhs_uuid uuid; + [case(EPM_PROTOCOL_IPX)] epm_rhs_ipx ipx; + [case(EPM_PROTOCOL_SMB)] epm_rhs_smb smb; + [case(EPM_PROTOCOL_NAMED_PIPE)] epm_rhs_named_pipe named_pipe; + [case(EPM_PROTOCOL_NETBIOS)] epm_rhs_netbios netbios; + [case(EPM_PROTOCOL_NETBEUI)] epm_rhs_netbeui netbeui; + [case(EPM_PROTOCOL_SPX)] epm_rhs_spx spx; + [case(EPM_PROTOCOL_NB_IPX)] epm_rhs_nb_ipx nb_ipx; + [case(EPM_PROTOCOL_DSP)] epm_rhs_atalk_stream atalk_stream; + [case(EPM_PROTOCOL_DDP)] epm_rhs_atalk_datagram atalk_datagram; + [case(EPM_PROTOCOL_APPLETALK)] epm_rhs_appletalk appletalk; + [case(EPM_PROTOCOL_VINES_SPP)] epm_rhs_vines_spp vines_spp; + [case(EPM_PROTOCOL_VINES_IPC)] epm_rhs_vines_ipc vines_ipc; + [case(EPM_PROTOCOL_STREETTALK)] epm_rhs_streettalk streettalk; + [case(EPM_PROTOCOL_HTTP)] epm_rhs_http http; + [case(EPM_PROTOCOL_UNIX_DS)] epm_rhs_unix_ds unix_ds; + [case(EPM_PROTOCOL_NULL)] epm_rhs_null null; + [default] [flag(NDR_REMAINING)] DATA_BLOB unknown; + } epm_rhs; + + typedef struct { + epm_protocol protocol; + [flag(NDR_REMAINING)] DATA_BLOB lhs_data; + } epm_lhs; + + typedef struct { + [subcontext(2)] epm_lhs lhs; + [subcontext(2),switch_is(lhs.protocol)] epm_rhs rhs; + } epm_floor; + + /* note that the NDR_NOALIGN flag is inherited by all nested + structures. All of the towers/floors stuff is + non-aligned. I wonder what sort of wicked substance these + guys were smoking? + */ + typedef [gensize,flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN)] struct { + uint16 num_floors; + epm_floor floors[num_floors]; + } epm_tower; + + typedef [public] struct { + [value(ndr_size_epm_tower(&tower, ndr->flags))] uint32 tower_length; + [subcontext(4)] epm_tower tower; + } epm_twr_t; + + typedef struct { + GUID object; + epm_twr_t *tower; + /* + * In theory this should be: + * [charset(DOS),string] uint8 annotation[64] + * But midl treats this as: + * [charset(DOS),string] uint8 annotation[] + * and pidl doesn't support this yet + */ + [value(0)] uint32 __annotation_offset; + [value(strlen(annotation)+1)] uint32 __annotation_length; + [charset(DOS)] uint8 annotation[__annotation_length]; + } epm_entry_t; + + typedef struct { + GUID uuid; + uint16 vers_major; + uint16 vers_minor; + } rpc_if_id_t; + + /**********************/ + /* Function 0x0 */ + error_status_t epm_Insert( + [in] uint32 num_ents, + [in,size_is(num_ents)] epm_entry_t entries[], + [in] uint32 replace + ); + + /**********************/ + /* Function 0x1 */ + error_status_t epm_Delete( + [in] uint32 num_ents, + [in, size_is(num_ents)] epm_entry_t entries[] + ); + + typedef [v1_enum] enum { + RPC_C_EP_ALL_ELTS = 0x00000000, + RPC_C_EP_MATCH_BY_IF = 0x00000001, + RPC_C_EP_MATCH_BY_OBJ = 0x00000002, + RPC_C_EP_MATCH_BY_BOTH = 0x00000003 + } epm_InquiryType; + + typedef [v1_enum] enum { + RPC_C_VERS_ALL = 0x00000000, + RPC_C_VERS_COMPATIBLE = 0x00000001, + RPC_C_VERS_EXACT = 0x00000002, + RPC_C_VERS_MAJOR_ONLY = 0x00000003, + RPC_C_VERS_UPTO = 0x00000004 + } epm_VersionOption; + + /**********************/ + /* Function 0x02 */ + error_status_t epm_Lookup( + [in] epm_InquiryType inquiry_type, + [in,ptr] GUID *object, + [in,ptr] rpc_if_id_t *interface_id, + [in] epm_VersionOption vers_option, + [in,out] policy_handle *entry_handle, + [in] uint32 max_ents, + [out] uint32 *num_ents, + [out, length_is(*num_ents), size_is(max_ents)] epm_entry_t entries[] + ); + + + /**********************/ + /* Function 0x03 */ + + typedef struct { + epm_twr_t *twr; + } epm_twr_p_t; + + [public] error_status_t epm_Map( + [in,ptr] GUID *object, + [in,ptr] epm_twr_t *map_tower, + [in,out] policy_handle *entry_handle, + [in] uint32 max_towers, + [out] uint32 *num_towers, + [out, length_is(*num_towers), size_is(max_towers)] epm_twr_p_t towers[] + ); + + + /**********************/ + /* Function 0x04 */ + error_status_t epm_LookupHandleFree( + [in,out] policy_handle *entry_handle + ); + + /**********************/ + /* Function 0x05 */ + error_status_t epm_InqObject( + [in] GUID *epm_object + ); + + + /**********************/ + /* Function 0x06 */ + error_status_t epm_MgmtDelete( + [in] uint32 object_speced, + [in,ptr] GUID *object, + [in,ptr] epm_twr_t *tower + ); + + /**********************/ + /* Function 0x07 */ + [todo] error_status_t epm_MapAuth(); +} diff --git a/librpc/idl/eventlog.idl b/librpc/idl/eventlog.idl new file mode 100644 index 0000000..e269467 --- /dev/null +++ b/librpc/idl/eventlog.idl @@ -0,0 +1,324 @@ +#include "idl_types.h" + +/* + eventlog interface definition +*/ + +import "lsa.idl", "security.idl"; + +[ uuid("82273fdc-e32a-18c3-3f78-827929dc23ea"), + version(0.0), + helpstring("Event Logger") +] interface eventlog +{ + typedef [bitmap32bit] bitmap { + EVENTLOG_SEQUENTIAL_READ = 0x0001, + EVENTLOG_SEEK_READ = 0x0002, + EVENTLOG_FORWARDS_READ = 0x0004, + EVENTLOG_BACKWARDS_READ = 0x0008 + } eventlogReadFlags; + + typedef [public] enum { + EVENTLOG_SUCCESS = 0x0000, + EVENTLOG_ERROR_TYPE = 0x0001, + EVENTLOG_WARNING_TYPE = 0x0002, + EVENTLOG_INFORMATION_TYPE = 0x0004, + EVENTLOG_AUDIT_SUCCESS = 0x0008, + EVENTLOG_AUDIT_FAILURE = 0x0010 + } eventlogEventTypes; + + typedef struct { + uint16 unknown0; + uint16 unknown1; + } eventlog_OpenUnknown0; + + /* compat structure for samba3 on-disc eventlog format, + this is *NOT* used on the wire. - gd */ + + typedef [flag(NDR_NOALIGN|NDR_PAHEX),public] struct { + uint32 size; + [charset(DOS),value("eLfL")] uint8 reserved[4]; + uint32 record_number; + time_t time_generated; + time_t time_written; + uint32 event_id; + eventlogEventTypes event_type; + [range(0,256)] uint16 num_of_strings; + uint16 event_category; + uint16 reserved_flags; + uint32 closing_record_number; + uint32 stringoffset; + [value(sid.length)] uint32 sid_length; + uint32 sid_offset; + [value(data.length)] uint32 data_length; + uint32 data_offset; + [value(2*strlen_m_term(source_name))] uint32 source_name_len; + nstring source_name; + [value(2*strlen_m_term(computer_name))] uint32 computer_name_len; + nstring computer_name; + uint32 sid_padding; + DATA_BLOB sid; + [value(2*ndr_size_string_array(strings, num_of_strings, STR_NULLTERM))] uint32 strings_len; + nstring strings[num_of_strings]; + DATA_BLOB data; + uint32 padding; + } eventlog_Record_tdb; + + typedef [v1_enum] enum { + ELF_LOGFILE_HEADER_DIRTY = 0x0001, + ELF_LOGFILE_HEADER_WRAP = 0x0002, + ELF_LOGFILE_LOGFULL_WRITTEN = 0x0004, + ELF_LOGFILE_ARCHIVE_SET = 0x0008 + } EVENTLOG_HEADER_FLAGS; + + typedef [public] struct { + [value(0x30)] uint32 HeaderSize; + [charset(DOS),value("LfLe")] uint8 Signature[4]; + [value(1)] uint32 MajorVersion; + [value(1)] uint32 MinorVersion; + uint32 StartOffset; + uint32 EndOffset; + uint32 CurrentRecordNumber; + uint32 OldestRecordNumber; + uint32 MaxSize; + EVENTLOG_HEADER_FLAGS Flags; + uint32 Retention; + [value(0x30)] uint32 EndHeaderSize; + } EVENTLOGHEADER; + + typedef [public,gensize] struct { + uint32 Length; + [charset(DOS),value("LfLe")] uint8 Reserved[4]; + uint32 RecordNumber; + time_t TimeGenerated; + time_t TimeWritten; + uint32 EventID; + eventlogEventTypes EventType; + uint16 NumStrings; + uint16 EventCategory; + uint16 ReservedFlags; + uint32 ClosingRecordNumber; + [value(56+2*(strlen_m_term(SourceName)+strlen_m_term(Computername))+UserSidLength)] uint32 StringOffset; + [value(ndr_size_dom_sid0(&UserSid, ndr->flags))] uint32 UserSidLength; + [value(56+2*(strlen_m_term(SourceName)+strlen_m_term(Computername)))] uint32 UserSidOffset; + uint32 DataLength; + [value(56+2*(strlen_m_term(SourceName)+strlen_m_term(Computername))+UserSidLength+(2*ndr_size_string_array(Strings, NumStrings, STR_NULLTERM)))] uint32 DataOffset; + nstring SourceName; + nstring Computername; + [flag(NDR_ALIGN4),subcontext(0),subcontext_size(UserSidLength)] dom_sid0 UserSid; + nstring Strings[NumStrings]; + [flag(NDR_PAHEX)] uint8 Data[DataLength]; + astring Pad; + [value(Length)] uint32 Length2; + } EVENTLOGRECORD; + + typedef [public] struct { + [value(0x28)] uint32 RecordSizeBeginning; + [value(0x11111111)] uint32 One; + [value(0x22222222)] uint32 Two; + [value(0x33333333)] uint32 Three; + [value(0x44444444)] uint32 Four; + uint32 BeginRecord; + uint32 EndRecord; + uint32 CurrentRecordNumber; + uint32 OldestRecordNumber; + [value(0x28)] uint32 RecordSizeEnd; + } EVENTLOGEOF; + + /* the following is true for a non-wrapped evt file (e.g. backups + * generated and viewed with eventvwr) */ + + typedef [public] struct { + EVENTLOGHEADER hdr; + EVENTLOGRECORD records[hdr.CurrentRecordNumber-hdr.OldestRecordNumber]; + EVENTLOGEOF eof; + } EVENTLOG_EVT_FILE; + + /******************/ + /* Function: 0x00 */ + NTSTATUS eventlog_ClearEventLogW( + [in] policy_handle *handle, + [in,unique] lsa_String *backupfile + ); + + /******************/ + /* Function: 0x01 */ + NTSTATUS eventlog_BackupEventLogW( + [in] policy_handle *handle, + [in,ref] lsa_String *backup_filename + ); + + /******************/ + /* Function: 0x02 */ + NTSTATUS eventlog_CloseEventLog( + [in,out] policy_handle *handle + ); + + /******************/ + /* Function: 0x03 */ + NTSTATUS eventlog_DeregisterEventSource( + [in,out] policy_handle *handle + ); + + /******************/ + /* Function: 0x04 */ + NTSTATUS eventlog_GetNumRecords( + [in] policy_handle *handle, + [out,ref] uint32 *number + ); + + /******************/ + /* Function: 0x05 */ + NTSTATUS eventlog_GetOldestRecord( + [in] policy_handle *handle, + [out,ref] uint32 *oldest_entry + ); + + /******************/ + /* Function: 0x06 */ + [todo] NTSTATUS eventlog_ChangeNotify(); + + /******************/ + /* Function: 0x07 */ + NTSTATUS eventlog_OpenEventLogW( + [in,unique] eventlog_OpenUnknown0 *unknown0, + [in,ref] lsa_String *logname, + [in,ref] lsa_String *servername, + [in] uint32 major_version, + [in] uint32 minor_version, + [out] policy_handle *handle + ); + + /******************/ + /* Function: 0x08 */ + NTSTATUS eventlog_RegisterEventSourceW( + [in,unique] eventlog_OpenUnknown0 *unknown0, + [in,ref] lsa_String *module_name, + [in,ref] lsa_String *reg_module_name, + [in] uint32 major_version, + [in] uint32 minor_version, + [out] policy_handle *log_handle + ); + + /******************/ + /* Function: 0x09 */ + NTSTATUS eventlog_OpenBackupEventLogW( + [in,unique] eventlog_OpenUnknown0 *unknown0, + [in,ref] lsa_String *backup_logname, + [in] uint32 major_version, + [in] uint32 minor_version, + [out] policy_handle *handle + ); + + /******************/ + /* Function: 0x0a */ + NTSTATUS eventlog_ReadEventLogW( + [in] policy_handle *handle, + [in] eventlogReadFlags flags, + [in] uint32 offset, + [in] [range(0,0x7FFFF)] uint32 number_of_bytes, + [out,ref,size_is(number_of_bytes)] uint8 *data, + [out,ref] uint32 *sent_size, + [out,ref] uint32 *real_size + ); + + /*****************/ + /* Function 0x0b */ + NTSTATUS eventlog_ReportEventW( + [in] policy_handle *handle, + [in] time_t timestamp, + [in] eventlogEventTypes event_type, + [in] uint16 event_category, + [in] uint32 event_id, + [in] [range(0,256)] uint16 num_of_strings, + [in] [range(0,0x3FFFF)] uint32 data_size, + [in,ref] lsa_String *servername, + [in,unique] dom_sid *user_sid, + [in,unique] [size_is(num_of_strings)] lsa_String **strings, + [in,unique] [size_is(data_size)] uint8 *data, + [in] uint16 flags, + [in,out,unique] uint32 *record_number, + [in,out,unique] time_t *time_written + ); + + /*****************/ + /* Function 0x0c */ + [todo] NTSTATUS eventlog_ClearEventLogA(); + + /******************/ + /* Function: 0x0d */ + [todo] NTSTATUS eventlog_BackupEventLogA(); + + /*****************/ + /* Function 0x0e */ + [todo] NTSTATUS eventlog_OpenEventLogA(); + + /*****************/ + /* Function 0x0f */ + [todo] NTSTATUS eventlog_RegisterEventSourceA(); + + /*****************/ + /* Function 0x10 */ + [todo] NTSTATUS eventlog_OpenBackupEventLogA(); + + /*****************/ + /* Function 0x11 */ + [todo] NTSTATUS eventlog_ReadEventLogA(); + + /*****************/ + /* Function 0x12 */ + [todo] NTSTATUS eventlog_ReportEventA(); + + /*****************/ + /* Function 0x13 */ + [todo] NTSTATUS eventlog_RegisterClusterSvc(); + + /*****************/ + /* Function 0x14 */ + [todo] NTSTATUS eventlog_DeregisterClusterSvc(); + + /*****************/ + /* Function 0x15 */ + [todo] NTSTATUS eventlog_WriteClusterEvents(); + + /*****************/ + /* Function 0x16 */ + + typedef [public] struct { + boolean32 full; + } EVENTLOG_FULL_INFORMATION; + + NTSTATUS eventlog_GetLogInformation( + [in] policy_handle *handle, + [in] uint32 level, + [out,ref] [size_is(buf_size)] uint8 *buffer, + [in] [range(0,1024)] uint32 buf_size, + [out,ref] uint32 *bytes_needed + ); + + /*****************/ + /* Function 0x17 */ + NTSTATUS eventlog_FlushEventLog( + [in] policy_handle *handle + ); + + /*****************/ + /* Function 0x18 */ + NTSTATUS eventlog_ReportEventAndSourceW( + [in] policy_handle *handle, + [in] time_t timestamp, + [in] eventlogEventTypes event_type, + [in] uint16 event_category, + [in] uint32 event_id, + [in,ref] lsa_String *sourcename, + [in] [range(0,256)] uint16 num_of_strings, + [in] [range(0,0x3FFFF)] uint32 data_size, + [in,ref] lsa_String *servername, + [in,unique] dom_sid *user_sid, + [in,unique] [size_is(num_of_strings)] lsa_String **strings, + [in,unique] [size_is(data_size)] uint8 *data, + [in] uint16 flags, + [in,out,unique] uint32 *record_number, + [in,out,unique] time_t *time_written + ); +} diff --git a/librpc/idl/eventlog6.idl b/librpc/idl/eventlog6.idl new file mode 100644 index 0000000..57216cd --- /dev/null +++ b/librpc/idl/eventlog6.idl @@ -0,0 +1,343 @@ +#include "idl_types.h" + + +import "misc.idl"; + +cpp_quote("#define MAX_RPC_GUID_ARRAY_COUNT (MAX_PAYLOAD / sizeof(struct GUID))") +cpp_quote("#define eventlog6_EvtRpcSubscribePull 0x10000000") +cpp_quote("#define eventlog6_EvtRpcVarFlagsModified 0x00000001") + +[ + uuid (f6beaff7-1e19-4fbb-9f8f-b89e2018337c), + version(1.0), + endpoint("ncacn_ip_tcp:"), + helpstring("Eventlog6"), + pointer_default(unique) +] +interface eventlog6 +{ + const int MAX_PAYLOAD = 2 * 1024 * 1024; + const int MAX_RPC_QUERY_LENGTH = MAX_PAYLOAD / sizeof(uint16_t); + const int MAX_RPC_CHANNEL_NAME_LENGTH = 512; + const int MAX_RPC_QUERY_CHANNEL_SIZE = 512; + const int MAX_RPC_EVENT_ID_SIZE = 256; + const int MAX_RPC_FILE_PATH_LENGTH = 32768; + const int MAX_RPC_CHANNEL_PATH_LENGTH = 32768; + const int MAX_RPC_BOOKMARK_LENGTH = MAX_PAYLOAD / sizeof(uint16_t); + const int MAX_RPC_PUBLISHER_ID_LENGTH = 2048; + const int MAX_RPC_PROPERTY_BUFFER_SIZE = MAX_PAYLOAD; + const int MAX_RPC_FILTER_LENGTH = MAX_RPC_QUERY_LENGTH; + const int MAX_RPC_RECORD_COUNT = 1024; + const int MAX_RPC_EVENT_SIZE = MAX_PAYLOAD; + const int MAX_RPC_BATCH_SIZE = MAX_PAYLOAD; + const int MAX_RPC_RENDERED_STRING_SIZE = MAX_PAYLOAD; + const int MAX_RPC_CHANNEL_COUNT = 8192; + const int MAX_RPC_PUBLISHER_COUNT = 8192; + const int MAX_RPC_EVENT_METADATA_COUNT = 256; + const int MAX_RPC_VARIANT_LIST_COUNT = 256; + const int MAX_RPC_BOOLEAN8_ARRAY_COUNT = MAX_PAYLOAD / sizeof(uint8_t); + const int MAX_RPC_UINT32_ARRAY_COUNT = MAX_PAYLOAD / sizeof(uint32_t); + const int MAX_RPC_UINT64_ARRAY_COUNT = MAX_PAYLOAD / sizeof(uint64_t); + const int MAX_RPC_STRING_ARRAY_COUNT = MAX_PAYLOAD / 512; + const int MAX_RPC_STRING_LENGTH = MAX_PAYLOAD / sizeof(uint16_t); + + typedef struct { + uint32 error; + uint32 sub_err; + uint32 sub_err_param; + } eventlog6_RpcInfo; + + typedef struct { + [range(0, MAX_RPC_BOOLEAN8_ARRAY_COUNT)] uint32 count; + [size_is(count)] boolean8* ptr; + } eventlog6_boolean8Array; + + typedef struct { + [range(0, MAX_RPC_UINT32_ARRAY_COUNT)] uint32 count; + [size_is(count)] uint32* ptr; + } eventlog6_UInt32Array; + + typedef struct { + [range(0, MAX_RPC_UINT64_ARRAY_COUNT)] uint32 count; + [size_is(count)] hyper* ptr; + } eventlog6_UInt64Array; + + typedef struct { + [range(0, MAX_RPC_STRING_ARRAY_COUNT)] uint32 count; + [size_is(count),charset(UTF16),string] uint16 **ptr; + } eventlog6_StringArray; + + typedef struct { + [range(0, MAX_RPC_GUID_ARRAY_COUNT)] uint32 count; + [size_is(count)] GUID* ptr; + } eventlog6_GuidArray; + + typedef [v1_enum] enum { + EvtRpcVarTypeNull = 0, + EvtRpcVarTypeboolean8 = 1, + EvtRpcVarTypeUInt32 = 2, + EvtRpcVarTypeUInt64 = 3, + EvtRpcVarTypeString = 4, + EvtRpcVarTypeGuid = 5, + EvtRpcVarTypeboolean8Array = 6, + EvtRpcVarTypeUInt32Array = 7, + EvtRpcVarTypeUInt64Array = 8, + EvtRpcVarTypeStringArray = 9, + EvtRpcVarTypeGuidArray = 10 + } eventlog6_EvtRpcVariantType; + + typedef [v1_enum] enum { + EvtRpcChannelPath = 0, + EvtRpcPublisherName = 1 + } eventlog6_EvtRpcAssertConfigFlags; + + typedef [switch_type(eventlog6_EvtRpcVariantType)] union { + [case(EvtRpcVarTypeNull)] int nullVal; + [case(EvtRpcVarTypeboolean8)] boolean8 boolean8Val; + [case(EvtRpcVarTypeUInt32)] uint32 uint32Val; + [case(EvtRpcVarTypeUInt64)] hyper uint64Val; + [case(EvtRpcVarTypeString)] [charset(UTF16),string] uint16 *stringVal; + [case(EvtRpcVarTypeGuid)] GUID *guidVal; + [case(EvtRpcVarTypeboolean8Array)] eventlog6_boolean8Array boolean8Array; + [case(EvtRpcVarTypeUInt32Array)] eventlog6_UInt32Array uint32Array; + [case(EvtRpcVarTypeUInt64Array)] eventlog6_UInt64Array uint64Array; + [case(EvtRpcVarTypeStringArray)] eventlog6_StringArray stringArray; + [case(EvtRpcVarTypeGuidArray)] eventlog6_GuidArray guidArray; + } eventlog6_EvtRpcVariantUnion; + + typedef struct { + eventlog6_EvtRpcVariantType type; + uint32 flags; + [in,ref,switch_is(type)] eventlog6_EvtRpcVariantUnion *var; + } eventlog6_EvtRpcVariant; + + typedef struct { + [range(0, MAX_RPC_VARIANT_LIST_COUNT)] uint32 count; + [size_is(count)] eventlog6_EvtRpcVariant* props; + } eventlog6_EvtRpcVariantList; + + typedef struct { + [charset(UTF16),string] uint16 *name; + uint32 status; + } eventlog6_EvtRpcQueryChannelInfo; + + WERROR eventlog6_EvtRpcRegisterRemoteSubscription( + [in, unique, range(0, MAX_RPC_CHANNEL_NAME_LENGTH),charset(UTF16),string] uint16 *channelPath, + [in, range(1, MAX_RPC_QUERY_LENGTH),charset(UTF16),string] uint16 *query, + [in, unique, range(0, MAX_RPC_BOOKMARK_LENGTH),charset(UTF16),string] uint16 *bookmarkXml, + [in] uint32 flags, + [out, ref] policy_handle *handle, + [out, ref] policy_handle *control, + [out, ref] uint32 *queryChannelInfoSize, + [out, size_is(,*queryChannelInfoSize), range(0, MAX_RPC_QUERY_CHANNEL_SIZE)] + eventlog6_EvtRpcQueryChannelInfo **queryChannelInfo, + [out, ref] eventlog6_RpcInfo *error); + + WERROR eventlog6_EvtRpcRemoteSubscriptionNextAsync( + [in, ref] policy_handle *handle, + [in] uint32 numRequestedRecords, + [in] uint32 flags, + [out, ref] uint32 *numActualRecords, + [out, size_is(,*numActualRecords), range(0, MAX_RPC_RECORD_COUNT)] + uint32 **eventDataIndices, + [out, size_is(,*numActualRecords), range(0, MAX_RPC_RECORD_COUNT)] + uint32 **eventDataSizes, + [out, ref] uint32* resultBufferSize, + [out, size_is(,*resultBufferSize), range(0, MAX_RPC_BATCH_SIZE)] + uint8 **resultBuffer); + + WERROR eventlog6_EvtRpcRemoteSubscriptionNext( + [in, ref] policy_handle *handle, + [in] uint32 numRequestedRecords, + [in] uint32 timeOut, + [in] uint32 flags, + [out, ref] uint32 *numActualRecords, + [out, size_is(,*numActualRecords), range(0, MAX_RPC_RECORD_COUNT)] + uint32 **eventDataIndices, + [out, size_is(,*numActualRecords), range(0, MAX_RPC_RECORD_COUNT)] + uint32 **eventDataSizes, + [out, ref] uint32 *resultBufferSize, + [out, size_is(,*resultBufferSize), range(0, MAX_RPC_BATCH_SIZE)] + uint8 **resultBuffer); + + WERROR eventlog6_EvtRpcRemoteSubscriptionWaitAsync( + [in, ref] policy_handle *handle); + + WERROR eventlog6_EvtRpcRegisterControllableOperation( + [out, ref] policy_handle *handle); + + WERROR eventlog6_EvtRpcRegisterLogQuery( + [in, unique, range(0, MAX_RPC_CHANNEL_PATH_LENGTH),charset(UTF16),string] uint16 *path, + [in, range(1, MAX_RPC_QUERY_LENGTH),charset(UTF16),string] uint16 *query, + [in] uint32 flags, + [out, ref] policy_handle *handle, + [out, ref] policy_handle *opControl, + [out, ref] uint32 *queryChannelInfoSize, + [out, size_is(,*queryChannelInfoSize), range(0, MAX_RPC_QUERY_CHANNEL_SIZE)] + eventlog6_EvtRpcQueryChannelInfo **queryChannelInfo, + [out, ref] eventlog6_RpcInfo *error); + + WERROR eventlog6_EvtRpcClearLog( + [in, ref] policy_handle *control, + [in, range(0, MAX_RPC_CHANNEL_NAME_LENGTH),charset(UTF16),string] uint16 *channelPath, + [in, unique, range(0, MAX_RPC_FILE_PATH_LENGTH),charset(UTF16),string] uint16 *backupPath, + [in] uint32 flags, + [out, ref] eventlog6_RpcInfo *error); + + WERROR eventlog6_EvtRpcExportLog( + [in, ref] policy_handle *control, + [in, unique, range(0, MAX_RPC_CHANNEL_NAME_LENGTH),charset(UTF16),string] uint16 *channelPath, + [in, range(1, MAX_RPC_QUERY_LENGTH),charset(UTF16),string] uint16 *query, + [in, range(1, MAX_RPC_FILE_PATH_LENGTH),charset(UTF16),string] uint16 *backupPath, + [in] uint32 flags, + [out, ref] eventlog6_RpcInfo *error); + + WERROR eventlog6_EvtRpcLocalizeExportLog( + [in, ref] policy_handle *control, + [in, range(1, MAX_RPC_FILE_PATH_LENGTH),charset(UTF16),string] uint16 *logFilePath, + [in] uint32 locale, + [in] uint32 flags, + [out, ref] eventlog6_RpcInfo *error); + + WERROR eventlog6_EvtRpcMessageRender( + [in, ref] policy_handle *pubCfgObj, + [in, range(1, MAX_RPC_EVENT_ID_SIZE)] uint32 sizeEventId, + [in, size_is(sizeEventId)] uint8 *eventId, + [in] uint32 messageId, + [in] eventlog6_EvtRpcVariantList *values, + [in] uint32 flags, + [in] uint32 maxSizeString, + [out, ref] uint32 *actualSizeString, + [out, ref] uint32 *neededSizeString, + [out, size_is(,*actualSizeString), range(0, MAX_RPC_RENDERED_STRING_SIZE)] + uint8 **string, + [out, ref] eventlog6_RpcInfo *error); + + WERROR eventlog6_EvtRpcMessageRenderDefault( + [in, range(1, MAX_RPC_EVENT_ID_SIZE)] uint32 sizeEventId, + [in, size_is(sizeEventId)] uint8 *eventId, + [in] uint32 messageId, + [in] eventlog6_EvtRpcVariantList *values, + [in] uint32 flags, + [in] uint32 maxSizeString, + [out, ref] uint32 *actualSizeString, + [out, ref] uint32 *neededSizeString, + [out, size_is(,*actualSizeString), range(0, MAX_RPC_RENDERED_STRING_SIZE)] + uint8 **string, + [out, ref] eventlog6_RpcInfo *error); + + WERROR eventlog6_EvtRpcQueryNext( + [in, ref] policy_handle *logQuery, + [in] uint32 numRequestedRecords, + [in] uint32 timeOutEnd, + [in] uint32 flags, + [out, ref] uint32 *numActualRecords, + [out, size_is(,*numActualRecords), range(0, MAX_RPC_RECORD_COUNT)] + uint32 **eventDataIndices, + [out, size_is(,*numActualRecords), range(0, MAX_RPC_RECORD_COUNT)] + uint32 **eventDataSizes, + [out, ref] uint32 *resultBufferSize, + [out, size_is(,*resultBufferSize), range(0, MAX_RPC_BATCH_SIZE)] + uint8 **resultBuffer); + + WERROR eventlog6_EvtRpcQuerySeek( + [in, ref] policy_handle *logQuery, + [in] hyper pos, + [in, unique, range(0, MAX_RPC_BOOKMARK_LENGTH),charset(UTF16),string] uint16 *bookmarkXml, + [in] uint32 timeOut, + [in] uint32 flags, + [out, ref] eventlog6_RpcInfo *error); + + WERROR eventlog6_EvtRpcClose( + [in, out, ref] policy_handle **handle); + + WERROR eventlog6_EvtRpcCancel( + [in, ref] policy_handle *handle); + + WERROR eventlog6_EvtRpcAssertConfig( + [in, range(1, MAX_RPC_CHANNEL_NAME_LENGTH),charset(UTF16),string] uint16 *path, + [in] uint32 flags); + + WERROR eventlog6_EvtRpcRetractConfig( + [in, range(1, MAX_RPC_CHANNEL_NAME_LENGTH),charset(UTF16),string] uint16 *path, + [in] uint32 flags ); + + WERROR eventlog6_EvtRpcOpenLogHandle( + [in, range(1, MAX_RPC_CHANNEL_NAME_LENGTH),charset(UTF16),string] uint16 *channel, + [in] uint32 flags, + [out, ref] policy_handle *handle, + [out, ref] eventlog6_RpcInfo *error); + + WERROR eventlog6_EvtRpcGetLogFileInfo( + [in, ref] policy_handle *logHandle, + [in] uint32 propertyId, + [in, range(0, MAX_RPC_PROPERTY_BUFFER_SIZE)] + uint32 propertyValueBufferSize, + [out, size_is(propertyValueBufferSize)] uint8 *propertyValueBuffer, + [out, ref] uint32 *propertyValueBufferLength); + + WERROR eventlog6_EvtRpcGetChannelList( + [in] uint32 flags, + [out, ref] uint32 *numChannelPaths, + [out, size_is(,*numChannelPaths), range(0, MAX_RPC_CHANNEL_COUNT),charset(UTF16),string] + uint16 ***channelPaths); + + WERROR eventlog6_EvtRpcGetChannelConfig( + [in, range(1, MAX_RPC_CHANNEL_NAME_LENGTH),charset(UTF16),string] uint16 *channelPath, + [in] uint32 flags, + [out, ref] eventlog6_EvtRpcVariantList* props); + + WERROR eventlog6_EvtRpcPutChannelConfig( + [in, range(1, MAX_RPC_CHANNEL_NAME_LENGTH),charset(UTF16),string] uint16 *channelPath, + [in] uint32 flags, + [in] eventlog6_EvtRpcVariantList* props, + [out, ref] eventlog6_RpcInfo *error); + + WERROR eventlog6_EvtRpcGetPublisherList( + [in] uint32 flags, + [out, ref] uint32 *numPublisherIds, + [out, size_is(,*numPublisherIds), range(0, MAX_RPC_PUBLISHER_COUNT),charset(UTF16),string] + uint16 ***publisherIds); + + WERROR eventlog6_EvtRpcGetPublisherListForChannel( + [in] uint16 *channelName, + [in] uint32 flags, + [out, ref] uint32* numPublisherIds, + [out, size_is(,*numPublisherIds), range(0, MAX_RPC_PUBLISHER_COUNT),charset(UTF16),string] + uint16 ***publisherIds); + + WERROR eventlog6_EvtRpcGetPublisherMetadata( + [in, unique, range(0, MAX_RPC_PUBLISHER_ID_LENGTH),charset(UTF16),string] uint16 *publisherId, + [in, unique, range(0, MAX_RPC_FILE_PATH_LENGTH),charset(UTF16),string] uint16 *logFilePath, + [in] uint32 locale, + [in] uint32 flags, + [out, ref] eventlog6_EvtRpcVariantList* pubMetadataProps, + [out, ref] policy_handle *pubMetadata); + + WERROR eventlog6_EvtRpcGetPublisherResourceMetadata( + [in, ref] policy_handle *handle, + [in] uint32 propertyId, + [in] uint32 flags, + [out, ref] eventlog6_EvtRpcVariantList *pubMetadataProps); + + WERROR eventlog6_EvtRpcGetEventMetadataEnum( + [in, ref] policy_handle *pubMetadata, + [in] uint32 flags, + [in, unique, range(0, MAX_RPC_FILTER_LENGTH),charset(UTF16),string] uint16 *reservedForFilter, + [out, ref] policy_handle *eventMetaDataEnum); + + WERROR eventlog6_EvtRpcGetNextEventMetadata( + [in, ref] policy_handle *eventMetaDataEnum, + [in] uint32 flags, + [in] uint32 numRequested, + [out, ref] uint32 *numReturned, + [out, size_is(,*numReturned), range(0, MAX_RPC_EVENT_METADATA_COUNT)] + eventlog6_EvtRpcVariantList **eventMetadataInstances); + + WERROR eventlog6_EvtRpcGetClassicLogDisplayName( + [in, range(1, MAX_RPC_CHANNEL_NAME_LENGTH),charset(UTF16),string] uint16 *logName, + [in] uint32 locale, + [in] uint32 flags, + [out] uint16 **displayName); +} + diff --git a/librpc/idl/file_id.idl b/librpc/idl/file_id.idl new file mode 100644 index 0000000..cd1febe --- /dev/null +++ b/librpc/idl/file_id.idl @@ -0,0 +1,14 @@ +[ + pointer_default(unique) +] +interface file_id +{ + typedef [public] struct { + /* we don't use SMB_DEV_T and SMB_INO_T as we want a fixed size here, + and we may be using file system specific code to fill in something + other than a dev_t for the device */ + udlong devid; + udlong inode; + udlong extid; /* Support systems that use an extended id (e.g. snapshots). */ + } file_id; +} diff --git a/librpc/idl/frsapi.idl b/librpc/idl/frsapi.idl new file mode 100644 index 0000000..ea7880c --- /dev/null +++ b/librpc/idl/frsapi.idl @@ -0,0 +1,128 @@ +#include "idl_types.h" + +import "misc.idl"; + +[ + uuid("d049b186-814f-11d1-9a3c-00c04fc9b232"), + version(1.1), + endpoint("ncacn_ip_tcp:", "ncalrpc:"), + helpstring("File Replication API"), + pointer_default(unique) +] +interface frsapi +{ + /****************/ + /* Function 0x00 */ + [todo] void FRSAPI_VERIFY_PROMOTION(); + + /****************/ + /* Function 0x01 */ + [todo] void FRSAPI_PROMOTION_STATUS(); + + /****************/ + /* Function 0x02 */ + [todo] void FRSAPI_START_DEMOTION(); + + /****************/ + /* Function 0x03 */ + [todo] void FRSAPI_COMMIT_DEMOTION(); + + /****************/ + /* Function 0x04 */ + + /* The DsPollingLongInterval and DsPollingShortInterval attributes + represent registry attributes below HKLM\System\CCS\Services\NtFrs */ + + WERROR frsapi_SetDsPollingIntervalW( + [in] uint32 CurrentInterval, + [in] uint32 DsPollingLongInterval, + [in] uint32 DsPollingShortInterval + ); + + /****************/ + /* Function 0x05 */ + WERROR frsapi_GetDsPollingIntervalW( + [out] uint32 *CurrentInterval, + [out] uint32 *DsPollingLongInterval, + [out] uint32 *DsPollingShortInterval + ); + + /****************/ + /* Function 0x06 */ + [todo] void FRSAPI_VERIFY_PROMOTION_W(); + + /****************/ + /* Function 0x07 */ + typedef [v1_enum] enum { + FRSAPI_INFO_VERSION = 0, + FRSAPI_INFO_SETS = 1, + FRSAPI_INFO_DS = 2, + FRSAPI_INFO_MEMORY = 3, + FRSAPI_INFO_IDTABLE = 4, + FRSAPI_INFO_OUTLOG = 5, + FRSAPI_INFO_INLOG = 6, + FRSAPI_INFO_THREADS = 7, + FRSAPI_INFO_STAGE = 8, + FRSAPI_INFO_CONFIGTABLE = 9 + } frsapi_InfoEnum; + + typedef struct { + uint32 length; + GUID guid; + uint32 length2; + uint32 unknown1; + frsapi_InfoEnum level; + uint32 query_counter; + uint32 unknown2; + uint32 offset; + uint32 blob_len; + /* [size_is(length-offset)] uint8 *data; */ + [subcontext_size(length-offset),subcontext(0),flag(NDR_REMAINING)] DATA_BLOB blob; + } frsapi_Info; + + WERROR frsapi_InfoW( + [in] [range(0,0x10000)] uint32 length, + /* [in,out] [size_is(length)] [unique] uint8 *data */ + [in,out,unique] frsapi_Info *info + + ); + + /****************/ + /* Function 0x08 */ + typedef [v1_enum] enum { + FRSAPI_REPLICA_SET_TYPE_0 = 0x00000000, + FRSAPI_REPLICA_SET_TYPE_DOMAIN = 0x00000002, + FRSAPI_REPLICA_SET_TYPE_DFS = 0x00000003 + } frsapi_ReplicaSetType; + + WERROR frsapi_IsPathReplicated( + [in,unique] [string,charset(UTF16)] uint16 *path, + [in] frsapi_ReplicaSetType replica_set_type, + [out] uint32 *replicated, + [out] uint32 *primary, + [out] uint32 *root, + [out] GUID *replica_set_guid + ); + + /****************/ + /* Function 0x09 */ + typedef [v1_enum] enum { + FRSAPI_WRITER_COMMAND_FREEZE = 0x00000001, + FRSAPI_WRITER_COMMAND_THAW = 0x00000002 + } frsapi_WriterCommandsValues; + + WERROR frsapi_WriterCommand( + [in] frsapi_WriterCommandsValues command + ); + + /****************/ + /* Function 0x0a */ + /* not supported before w2k3 sp2 */ + WERROR frsapi_ForceReplication( + [in,unique] GUID *replica_set_guid, + [in,unique] GUID *connection_guid, + [in,unique] [charset(UTF16),string] uint16 *replica_set_name, + [in,unique] [charset(UTF16),string] uint16 *partner_dns_name + ); + +} diff --git a/librpc/idl/frsrpc.idl b/librpc/idl/frsrpc.idl new file mode 100644 index 0000000..016095f --- /dev/null +++ b/librpc/idl/frsrpc.idl @@ -0,0 +1,458 @@ +#include "idl_types.h" + +import "misc.idl"; +import "fscc.idl"; +import "bkupblobs.idl"; + +[ + uuid("f5cc59b4-4264-101a-8c59-08002b2f8426"), + version(1.1), + endpoint("ncacn_ip_tcp:", "ncalrpc:"), + helpstring("File Replication Service"), + helper("../librpc/ndr/ndr_frsrpc.h"), + pointer_default(unique) +] +interface frsrpc +{ + + /*****************/ + /* Function 0x00 */ + + typedef struct { + [subcontext(4)] GUID guid; + [subcontext(4)] nstring name; + } frsrpc_CommPktChunkGuidName; + + typedef struct { + hyper vsn; + GUID guid; + } frsrpc_CommPktGSVN; + + typedef [bitmap32bit,flag(NDR_PAHEX)] bitmap { + FRSRPC_CO_FLAG_ABORT_CO = 0x00000001, + FRSRPC_CO_FLAG_VV_ACTIVATED = 0x00000002, + FRSRPC_CO_FLAG_CONTENT_CMD = 0x00000004, + FRSRPC_CO_FLAG_LOCATION_CMD = 0x00000008, + FRSRPC_CO_FLAG_ONLIST = 0x00000010, + FRSRPC_CO_FLAG_LOCALCO = 0x00000020, + FRSRPC_CO_FLAG_RETRY = 0x00000040, + FRSRPC_CO_FLAG_INST_INCOMPLETE = 0x00000080, + FRSRPC_CO_FLAG_OUT_OF_ORDER = 0x00000200, + FRSRPC_CO_FLAG_NEW_FILE = 0x00000400, + FRSRPC_CO_FLAG_CONTROL = 0x00001000, + FRSRPC_CO_FLAG_DIRECTED_CO = 0x00002000, + FRSRPC_CO_FLAG_VVJOIN_TO_ORIG = 0x00040000, + FRSRPC_CO_FLAG_SKIP_ORIG_REC_C = 0x00100000, + FRSRPC_CO_FLAG_MOVEIN_GEN = 0x00200000, + FRSRPC_CO_FLAG_MORPH_GEN_HEAD = 0x00400000, + FRSRPC_CO_FLAG_JUST_OID_RESET = 0x00800000, + FRSRPC_CO_FLAG_COMPRESSED_STAGE = 0x01000000, + FRSRPC_CO_FLAG_SKIP_VV_UPDATE = 0x02000000 + } frsrpc_CommPktCoCmdFlags; + + const uint32 FRSRPC_CO_IFLAG_NONE = 0x0000000; + + const string FRSRPC_COMPRESSION_GUID = "64d2f7d2-2695-436d-8830-8d3c58701e15"; + + + typedef [bitmap32bit,flag(NDR_PAHEX)] bitmap { + FRSRPC_CO_IFLAG_VVRETIRE_EXEC = 0x00000001, + FRSRPC_CO_IFLAG_CO_ABORT = 0x00000002, + FRSRPC_CO_IFLAG_DIR_ENUM_PENDING= 0x00000004 + } frsrpc_CommPktCoCmdIFlags; + + typedef [v1_enum,flag(NDR_PAHEX)] enum { + FRSRPC_CO_STATUS_CO_ENTERED_LOG = 0x00000000, + FRSRPC_CO_STATUS_ALLOC_STAGING_LOCAL_CO = 0x00000001, + FRSRPC_CO_STATUS_LOCAL_CO_STAGING_STARTED = 0x00000002, + FRSRPC_CO_STATUS_LOCAL_CO_STAGING_COMPLETED = 0x00000003, + FRSRPC_CO_STATUS_WAIT_RETRY_LOCAL_CO_STAGING = 0x00000004, + FRSRPC_CO_STATUS_ALLOC_STAGING_REMOTE_CO = 0x00000005, + FRSRPC_CO_STATUS_REMOTE_CO_STAGING_STARTED = 0x00000006, + FRSRPC_CO_STATUS_REMOTE_CO_STAGING_COMPLETED = 0x00000007, + FRSRPC_CO_STATUS_WAIT_RETRY_REMOTE_CO_STAGING = 0x00000008, + FRSRPC_CO_STATUS_FILE_INSTALL_REQUESTED = 0x00000009, + FRSRPC_CO_STATUS_FILE_INSTALL_STARTED = 0x0000000A, + FRSRPC_CO_STATUS_FILE_INSTALL_COMPLETED = 0x0000000B, + FRSRPC_CO_STATUS_FILE_INSTALL_WAIT_RETRY = 0x0000000C, + FRSRPC_CO_STATUS_FILE_INSTALL_RETRYING = 0x0000000D, + FRSRPC_CO_STATUS_FILE_INSTALL_RENAME_RETRYING = 0x0000000E, + FRSRPC_CO_STATUS_FILE_INSTALL_DELETE_RETRYING = 0x0000000F, + FRSRPC_CO_STATUS_CO_RECYCLED_FOR_ENUM = 0x00000013, + FRSRPC_CO_STATUS_REQUEST_OUTBOUND_PROPAGATION = 0x00000014, + FRSRPC_CO_STATUS_REQUEST_ACCEPTED_OUTBOUND_LOG = 0x00000015, + FRSRPC_CO_STATUS_DB_STATE_UPDATE_STARTED = 0x00000016, + FRSRPC_CO_STATUS_DB_STATE_UPDATE_COMPLETED = 0x00000017, + FRSRPC_CO_STATUS_CO_ABORTED = 0x00000018 + } frsrpc_CommPktCoCmdStatus; + + typedef [bitmap32bit,flag(NDR_PAHEX)] bitmap { + FRSRPC_CONTENT_REASON_DATA_OVERWRITE = 0x00000001, + FRSRPC_CONTENT_REASON_DATA_EXTEND = 0x00000002, + FRSRPC_CONTENT_REASON_DATA_TRUNCATION = 0x00000004, + FRSRPC_CONTENT_REASON_NAMED_DATA_OVERWRITE = 0x00000010, + FRSRPC_CONTENT_REASON_NAMED_DATA_EXTEND = 0x00000020, + FRSRPC_CONTENT_REASON_NAMED_DATA_TRUNCATION = 0x00000040, + FRSRPC_CONTENT_REASON_FILE_CREATE = 0x00000100, + FRSRPC_CONTENT_REASON_FILE_DELETE = 0x00000200, + FRSRPC_CONTENT_REASON_EA_CHANGE = 0x00000400, + FRSRPC_CONTENT_REASON_SECURITY_CHANGE = 0x00000800, + FRSRPC_CONTENT_REASON_OLD_NAME = 0x00001000, + FRSRPC_CONTENT_REASON_NEW_NAME = 0x00002000, + FRSRPC_CONTENT_REASON_BASIC_INFO_CHANGE = 0x00004000, + FRSRPC_CONTENT_REASON_COMPRESSION_CHANGE = 0x00020000 + } frsrpc_CommPktCoCmdContentCmd; + + typedef [v1_enum,flag(NDR_PAHEX)] enum { + FRSRPC_CO_LOCATION_FILE_CREATE = 0x00000000, + FRSRPC_CO_LOCATION_DIR_CREATE = 0x00000000 | 0x00000001, + FRSRPC_CO_LOCATION_FILE_DELETE = 0x00000002, + FRSRPC_CO_LOCATION_DIR_DELETE = 0x00000002 | 0x00000001, + FRSRPC_CO_LOCATION_FILE_MOVEIN = 0x00000004, + FRSRPC_CO_LOCATION_DIR_MOVEIN = 0x00000004 | 0x00000001, + FRSRPC_CO_LOCATION_FILE_MOVEIN2 = 0x00000006, + FRSRPC_CO_LOCATION_DIR_MOVEIN2 = 0x00000006 | 0x00000001, + FRSRPC_CO_LOCATION_FILE_MOVEOUT = 0x00000008, + FRSRPC_CO_LOCATION_DIR_MOVEOUT = 0x00000008 | 0x00000001, + FRSRPC_CO_LOCATION_FILE_MOVERS = 0x0000000a, + FRSRPC_CO_LOCATION_DIR_MOVERS = 0x0000000a | 0x00000001, + FRSRPC_CO_LOCATION_FILE_MOVEDIR = 0x0000000c, + FRSRPC_CO_LOCATION_DIR_MOVEDIR = 0x0000000c | 0x00000001, + FRSRPC_CO_LOCATION_FILE_NO_CMD = 0x0000000e, + FRSRPC_CO_LOCATION_DIR_NO_CMD = 0x0000000e | 0x00000001 + } frsrpc_CommPktCoCmdLocationCmd; + + [public] typedef struct { + uint32 sequence_number; + frsrpc_CommPktCoCmdFlags flags; + frsrpc_CommPktCoCmdIFlags iflags; + frsrpc_CommPktCoCmdStatus status; + frsrpc_CommPktCoCmdContentCmd content_cmd; + frsrpc_CommPktCoCmdLocationCmd location_cmd; + uint32 file_attributes; + uint32 file_version_number; + uint32 partern_ack_sequence_number; + [value(0)] uint32 not_used; + hyper file_size; + hyper file_offset; + hyper frs_vsn; + hyper file_usn; + hyper jrnl_usn; + hyper jrnl_first_usn; + uint32 original_replica_num; + uint32 new_replica_num; + GUID change_order_guid; + GUID originator_guid; + GUID file_guid; + GUID old_parent_guid; + GUID new_parent_guid; + GUID connection_guid; + hyper ack_version; + [value(0)] hyper spare2ul1; + [value(0)] hyper spare1guid_p1; + [value(0)] hyper spare1guid_p2; + [value(0)] hyper spare2guid_p1; + [value(0)] hyper spare3guid_p2; + [value(0)] uint32 spare1wcs; + [value(0)] uint32 spare2wcs; + [value(0)] uint32 extension; + [value(0)] uint32 spare2bin; + NTTIME event_time; + [value(2*strlen_m(file_name))] uint16 file_name_length; +#define FRSRPC_MAX_PATH 260 + [charset(UTF16)] uint16 file_name[FRSRPC_MAX_PATH+1]; + [value(0)] uint8 padding1; + [value(0)] uint8 padding2; + [value(0)] uint8 padding3; + [value(0)] uint8 padding4; + } frsrpc_CommPktChangeOrderCommand; + + typedef [v1_enum,flag(NDR_PAHEX)] enum { + FRSRPC_DATA_EXTENSION_TERMINATOR = 0x00000000, + FRSRPC_DATA_EXTENSION_MD5_CHECKSUM = 0x00000001, + FRSRPC_DATA_EXTENSION_RETRY_TIMEOUT = 0x00000002 + } frsrpc_CommPktDataExtensionType; + + typedef [flag(NDR_PAHEX)] struct { + [value(0x00000018)] uint32 prefix_size; + [value(FRSRPC_DATA_EXTENSION_MD5_CHECKSUM)] + frsrpc_CommPktDataExtensionType prefix_type; + uint8 data[16]; + } frsrpc_CommPktDataExtensionChecksum; + + typedef struct { + [value(0x00000018)] uint32 prefix_size; + [value(FRSRPC_DATA_EXTENSION_RETRY_TIMEOUT)] + frsrpc_CommPktDataExtensionType prefix_type; + uint32 count; + [value(0)] uint32 not_used; + NTTIME first_try_time; + } frsrpc_CommPktDataExtensionRetryTimeout; + + typedef [flag(NDR_PAHEX)] enum { + FRSRPC_CO_RECORD_EXTENSION_VERSION_WIN2K = 0x0000, + FRSRPC_CO_RECORD_EXTENSION_VERSION_1 = 0x0001 + } frsrpc_CommPktCoRecordExtensionMajor; + + typedef struct { + [value(0x00000028)] uint32 field_size; + [value(FRSRPC_CO_RECORD_EXTENSION_VERSION_WIN2K)] + frsrpc_CommPktCoRecordExtensionMajor major; + [value(0x0001)] uint16 offset_count; + [value(0x00000010)] uint32 offset; + [value(0)] uint32 offset_last; + frsrpc_CommPktDataExtensionChecksum data_checksum; + } frsrpc_CommPktCoRecordExtensionWin2k; + + typedef struct { + [value(0x00000048)] uint32 field_size; + frsrpc_CommPktCoRecordExtensionMajor major; + [value(0x0002)] uint16 offset_count; + [value(0x00000018)] uint32 offset0; + [value(0x00000030)] uint32 offset1; + [value(0)] uint32 offset_last; + [value(0)] uint32 not_used; + frsrpc_CommPktDataExtensionChecksum data_checksum; + frsrpc_CommPktDataExtensionRetryTimeout data_retry_timeout; + } frsrpc_CommPktChangeOrderRecordExtension; + + typedef [v1_enum,flag(NDR_PAHEX)] enum { + FRSRPC_COMMAND_REMOTE_CO = 0x00000218, + FRSRPC_COMMAND_RECEIVING_STATE = 0x00000238, + FRSRPC_COMMAND_REMOTE_CO_DONE = 0x00000250, + FRSRPC_COMMAND_ABORT_FETCH = 0x00000246, + FRSRPC_COMMAND_RETRY_FETCH = 0x00000244, + FRSRPC_COMMAND_NEED_JOIN = 0x00000121, + FRSRPC_COMMAND_START_JOIN = 0x00000122, + FRSRPC_COMMAND_JOINING = 0x00000130, + FRSRPC_COMMAND_JOINED = 0x00000128, + FRSRPC_COMMAND_UNJOIN_REMOTE = 0x00000148, + FRSRPC_COMMAND_VVJOIN_DONE = 0x00000136, + FRSRPC_COMMAND_SEND_STAGE = 0x00000228 + } frsrpc_CommPktCommand; + + typedef [flag(NDR_PAHEX)] enum { + FRSRPC_COMM_PKT_CHUNK_BOP = 0x0001, + FRSRPC_COMM_PKT_CHUNK_COMMAND = 0x0002, + FRSRPC_COMM_PKT_CHUNK_TO = 0x0003, + FRSRPC_COMM_PKT_CHUNK_FROM = 0x0004, + FRSRPC_COMM_PKT_CHUNK_REPLICA = 0x0005, + FRSRPC_COMM_PKT_CHUNK_CONNECTION = 0x0008, + FRSRPC_COMM_PKT_CHUNK_JOIN_GUID = 0x0006, + FRSRPC_COMM_PKT_CHUNK_LAST_JOIN_TIME = 0x0012, + + FRSRPC_COMM_PKT_CHUNK_VVECTOR = 0x0007, + FRSRPC_COMM_PKT_CHUNK_JOIN_TIME = 0x0011, + FRSRPC_COMM_PKT_CHUNK_REPLICA_VERSION_GUID = 0x0014, + FRSRPC_COMM_PKT_CHUNK_COMPRESSION_GUID = 0x0018, + + FRSRPC_COMM_PKT_CHUNK_BLOCK = 0x0009, + FRSRPC_COMM_PKT_CHUNK_BLOCK_SIZE = 0x000A, + FRSRPC_COMM_PKT_CHUNK_FILE_SIZE = 0x000B, + FRSRPC_COMM_PKT_CHUNK_FILE_OFFSET = 0x000C, + FRSRPC_COMM_PKT_CHUNK_GVSN = 0x000E, + FRSRPC_COMM_PKT_CHUNK_CO_GUID = 0x000F, + FRSRPC_COMM_PKT_CHUNK_CO_SEQUENCE_NUMBER = 0x0010, + + FRSRPC_COMM_PKT_CHUNK_REMOTE_CO = 0x000D, + FRSRPC_COMM_PKT_CHUNK_CO_EXT_WIN2K = 0x0016, + FRSRPC_COMM_PKT_CHUNK_CO_EXTENTION_2 = 0x0017, + + FRSRPC_COMM_PKT_CHUNK_EOP = 0x0013 + } frsrpc_CommPktChunkType; + + typedef [nodiscriminant] union { + [default,flag(NDR_REMAINING)] DATA_BLOB blob; + [case(FRSRPC_COMM_PKT_CHUNK_BOP)] + [value(0)] uint32 bop; + [case(FRSRPC_COMM_PKT_CHUNK_COMMAND)] + frsrpc_CommPktCommand command; + [case(FRSRPC_COMM_PKT_CHUNK_TO)] + frsrpc_CommPktChunkGuidName to; + [case(FRSRPC_COMM_PKT_CHUNK_FROM)] + frsrpc_CommPktChunkGuidName from; + [case(FRSRPC_COMM_PKT_CHUNK_REPLICA)] + frsrpc_CommPktChunkGuidName replica; + [case(FRSRPC_COMM_PKT_CHUNK_CONNECTION)] + frsrpc_CommPktChunkGuidName connection; + [case(FRSRPC_COMM_PKT_CHUNK_JOIN_GUID)][subcontext(4)] + GUID join_guid; + [case(FRSRPC_COMM_PKT_CHUNK_LAST_JOIN_TIME)] + NTTIME last_join_time; + [case(FRSRPC_COMM_PKT_CHUNK_VVECTOR)][subcontext(4)] + frsrpc_CommPktGSVN vvector; + [case(FRSRPC_COMM_PKT_CHUNK_JOIN_TIME)][subcontext(4)] + NTTIME join_time; + [case(FRSRPC_COMM_PKT_CHUNK_REPLICA_VERSION_GUID)][subcontext(4)] + GUID replica_version_guid; + [case(FRSRPC_COMM_PKT_CHUNK_COMPRESSION_GUID)] + GUID compression_guid; + [case(FRSRPC_COMM_PKT_CHUNK_BLOCK)] + DATA_BLOB block; + [case(FRSRPC_COMM_PKT_CHUNK_BLOCK_SIZE)] + hyper block_size; + [case(FRSRPC_COMM_PKT_CHUNK_FILE_SIZE)] + hyper file_size; + [case(FRSRPC_COMM_PKT_CHUNK_FILE_OFFSET)] + hyper file_offset; + [case(FRSRPC_COMM_PKT_CHUNK_GVSN)][subcontext(4)] + frsrpc_CommPktGSVN gvsn; + [case(FRSRPC_COMM_PKT_CHUNK_CO_GUID)][subcontext(4)] + GUID co_guid; + [case(FRSRPC_COMM_PKT_CHUNK_CO_SEQUENCE_NUMBER)] + uint32 co_sequence_number; + [case(FRSRPC_COMM_PKT_CHUNK_REMOTE_CO)][subcontext(4)] + frsrpc_CommPktChangeOrderCommand remote_co; + [case(FRSRPC_COMM_PKT_CHUNK_CO_EXT_WIN2K)][subcontext(4)] + frsrpc_CommPktCoRecordExtensionWin2k co_ext_win2k; + [case(FRSRPC_COMM_PKT_CHUNK_CO_EXTENTION_2)] + frsrpc_CommPktChangeOrderRecordExtension co_extension2; + [case(FRSRPC_COMM_PKT_CHUNK_EOP)] + [value(0xFFFFFFFF)] uint32 bopend; + } frsrpc_CommPktChunkData; + + typedef [public,flag(NDR_NOALIGN)] struct { + frsrpc_CommPktChunkType type; + [subcontext(4),switch_is(type)] frsrpc_CommPktChunkData data; + } frsrpc_CommPktChunk; + + typedef [nopull,nopush,flag(NDR_NOALIGN)] struct { + uint32 num_chunks; /* this doesn't appear on the wire */ + frsrpc_CommPktChunk chunks[num_chunks]; + } frsrpc_CommPktChunkCtr; + + typedef [v1_enum] enum { + FRSRPC_COMM_PKT_MAJOR_0 = 0x00000000 + } frsrpc_CommPktMajor; + + typedef [v1_enum] enum { + FRSRPC_COMM_PKT_MINOR_0 = 0x00000000, + FRSRPC_COMM_PKT_MINOR_1 = 0x00000001, + FRSRPC_COMM_PKT_MINOR_2 = 0x00000002, + FRSRPC_COMM_PKT_MINOR_3 = 0x00000003, + FRSRPC_COMM_PKT_MINOR_4 = 0x00000004, + FRSRPC_COMM_PKT_MINOR_5 = 0x00000005, + FRSRPC_COMM_PKT_MINOR_6 = 0x00000006, + FRSRPC_COMM_PKT_MINOR_7 = 0x00000007, + FRSRPC_COMM_PKT_MINOR_8 = 0x00000008, + FRSRPC_COMM_PKT_MINOR_9 = 0x00000009 + } frsrpc_CommPktMinor; + + [public] typedef struct { + frsrpc_CommPktMajor major; + frsrpc_CommPktMinor minor; + [value(1)] uint32 cs_id; + [value(pkt_len+12)] uint32 memory_len; + [value(ndr_size_frsrpc_CommPktChunkCtr(r->ctr, + ndr->flags))] + [range(0, 262144)] + uint32 pkt_len; + [value(0)] uint32 upk_len; + [subcontext(4),subcontext_size(pkt_len)] + frsrpc_CommPktChunkCtr *ctr; + [value(0)] uint3264 data_name; + [value(0)] uint3264 data_handle; + } frsrpc_FrsSendCommPktReq; + + WERROR frsrpc_FrsSendCommPkt( + [in] frsrpc_FrsSendCommPktReq req + ); + + /*****************/ + /* Function 0x01 */ + /* this function always return WERR_CALL_NOT_IMPLEMENTED */ + WERROR frsrpc_FrsVerifyPromotionParent( + [in,unique,string,charset(UTF16)] uint16 *parent_account, + [in,unique,string,charset(UTF16)] uint16 *parent_password, + [in,unique,string,charset(UTF16)] uint16 *replica_set_name, + [in,unique,string,charset(UTF16)] uint16 *replica_set_type, + [in] frsrpc_PartnerAuthLevel partner_auth_level, + [in] uint32 __ndr_guid_size + ); + + /*****************/ + /* Function 0x02 */ + typedef [v1_enum,flag(NDR_PAHEX)] enum { + FRSRPC_PARENT_AUTH_LEVEL_ENCRYPTED_KERBEROS = 0x00000000, + FRSRPC_PARENT_AUTH_LEVEL_NO_AUTHENTICATION = 0x00000001 + } frsrpc_PartnerAuthLevel; + + WERROR frsrpc_FrsStartPromotionParent( + [in,unique,string,charset(UTF16)] uint16 *parent_account, + [in,unique,string,charset(UTF16)] uint16 *parent_password, + [in,unique,string,charset(UTF16)] uint16 *replica_set_name, + [in,unique,string,charset(UTF16)] uint16 *replica_set_type, + [in,unique,string,charset(UTF16)] uint16 *connection_name, + [in,unique,string,charset(UTF16)] uint16 *partner_name, + [in,unique,string,charset(UTF16)] uint16 *partner_princ_name, + [in] frsrpc_PartnerAuthLevel partner_auth_level, + [in,value(16),range(16,16)] uint32 __ndr_guid_size, + [in,unique,subcontext(4),subcontext_size(16)] + GUID *connection_guid, + [in,unique,subcontext(4),subcontext_size(16)] + GUID *partner_guid, + [in,out,unique,subcontext(4),subcontext_size(16)] + GUID *parent_guid + ); + + typedef [public,flag(NDR_NOALIGN)] struct { + uint32 major; + uint32 minor; + uint32 dataHigh; + uint32 dataLow; + uint16 compression; + uint8 unused[6]; + fscc_FileNetworkOpenInformation attributes; + frsrpc_CommPktChangeOrderCommand command; + fscc_FileObjectIdBuffer_2 fileObjId; + frsrpc_CommPktCoRecordExtensionWin2k cocExt; + GUID compressionGuid; + uint32 encDataHigh; + uint32 encDataLow; + hyper dataSize; + uint32 reparseDataPresent; + uint32 reparseDataHigh; + uint32 reparseDataLow; + uint32 padding2; + } frsrpc_StageHeader; + + /*****************/ + /* Function 0x03 */ + WERROR frsrpc_FrsNOP(); + + /* + *For Op from 4 to 10 Microsoft use + *the notation OpnumxxNotUsedOnWire + *where xx is the number of the OP. + *They are only declared in the IDL of MS-FRS1.pdf. + *Not in the core of the document. + */ + + /*****************/ + /* Function 0x04 */ + /*[todo] void FRSRPC_BACKUP_COMPLETE();*/ + + /*****************/ + /* Function 0x05 */ + /*[todo] void FRSRPC_BACKUP_COMPLETE_5();*/ + + /*****************/ + /* Function 0x06 */ + /*[todo] void FRSRPC_BACKUP_COMPLETE_6();*/ + + /*****************/ + /* Function 0x07 */ + /*[todo] void FRSRPC_BACKUP_COMPLETE_7();*/ + + /*****************/ + /* Function 0x08 */ + /*[todo] void FRSRPC_BACKUP_COMPLETE_8();*/ + + /*****************/ + /* Function 0x09 */ + /*[todo] void FRSRPC_BACKUP_COMPLETE_9();*/ + + /*****************/ + /* Function 0x0a */ + /*[todo] void FRSRPC_VERIFY_PROMOTION_PARENT_EX();*/ +} diff --git a/librpc/idl/frstrans.idl b/librpc/idl/frstrans.idl new file mode 100644 index 0000000..ed5b105 --- /dev/null +++ b/librpc/idl/frstrans.idl @@ -0,0 +1,295 @@ +#include "idl_types.h" + +import "misc.idl"; + +[ + uuid("897e2e5f-93f3-4376-9c9c-fd2277495c27"), + version(1.0), + endpoint("ncacn_ip_tcp:", "ncalrpc:"), + helpstring("File Replication Service DFS-R"), + pointer_default(unique) +] +interface frstrans +{ + /*****************/ + /* Function 0x00 */ + WERROR frstrans_CheckConnectivity( + [in] GUID replica_set_guid, + [in] GUID connection_guid + ); + + /*****************/ + /* Function 0x01 */ + typedef [v1_enum,flag(NDR_PAHEX)] enum { + FRSTRANS_PROTOCOL_VERSION_W2K3R2 = 0x00050000, + FRSTRANS_PROTOCOL_VERSION_LONGHORN_SERVER = 0x00050002 + } frstrans_ProtocolVersion; + + typedef [bitmap32bit] bitmap { + FRSTRANS_TRANSPORT_SUPPORTS_RDC_SIMILARITY = 0x00000001 + } frstrans_TransportFlags; + + WERROR frstrans_EstablishConnection( + [in] GUID replica_set_guid, + [in] GUID connection_guid, + [in] frstrans_ProtocolVersion downstream_protocol_version, + [in] frstrans_TransportFlags downstream_flags, + [out,ref] frstrans_ProtocolVersion *upstream_protocol_version, + [out,ref] frstrans_TransportFlags *upstream_flags + ); + + /*****************/ + /* Function 0x02 */ + WERROR frstrans_EstablishSession( + [in] GUID connection_guid, + [in] GUID content_set_guid + ); + + /*****************/ + /* Function 0x03 */ + typedef enum { + FRSTRANS_UPDATE_REQUEST_ALL = 0x0000, + FRSTRANS_UPDATE_REQUEST_TOMBSTONES = 0x0001, + FRSTRANS_UPDATE_REQUEST_LIVE = 0x0002 + } frstrans_UpdateRequestType; + + typedef enum { + FRSTRANS_UPDATE_STATUS_DONE = 0x0002, + FRSTRANS_UPDATE_STATUS_MORE = 0x0003 + } frstrans_UpdateStatus; + + typedef [public] struct { + GUID db_guid; + hyper low; + hyper high; + } frstrans_VersionVector; + + typedef [flag(NDR_PAHEX)] struct { + boolean32 present; + boolean32 name_conflict; + uint32 attributes; + NTTIME fence; + NTTIME clock; + NTTIME create_time; + GUID content_set_guid; + uint8 sha1_hash[20]; + uint8 rdc_similarity[16]; + GUID uid_db_guid; + hyper uid_version; + GUID gsvn_db_guid; + hyper gsvn_version; + GUID parent_db_guid; + hyper parent_version; + [string,charset(UTF16)] uint16 name[261]; + uint32 flags; + } frstrans_Update; + + WERROR frstrans_RequestUpdates( + [in] GUID connection_guid, + [in] GUID content_set_guid, + [in,range(0,256)] uint32 credits_available, + [in,range(0,1)] boolean32 hash_requested, + [in,range(0,2)] + frstrans_UpdateRequestType update_request_type, + [in] uint32 version_vector_diff_count, + [in,size_is(version_vector_diff_count)] + frstrans_VersionVector *version_vector_diff, + [out,ref,size_is(credits_available),length_is(*update_count)] + frstrans_Update *frs_update, + [out,ref] uint32 *update_count, + [out,ref] frstrans_UpdateStatus *update_status, + [out,ref] GUID *gvsn_db_guid, + [out,ref] hyper *gvsn_version + ); + + /*****************/ + /* Function 0x04 */ + typedef enum { + FRSTRANS_VERSION_REQUEST_NORNAL_SYNC = 0x0000, + FRSTRANS_VERSION_REQUEST_SLOW_SYNC = 0x0001, + FRSTRANS_VERSION_REQUEST_SLAVE_SYNC = 0x0002 + } frstrans_VersionRequestType; + + typedef enum { + FRSTRANS_VERSION_CHANGE_NOTIFY = 0x0000, + FRSTRANS_VERSION_CHANGE_ALL = 0x0002 + } frstrans_VersionChangeType; + + WERROR frstrans_RequestVersionVector( + [in] uint32 sequence_number, + [in] GUID connection_guid, + [in] GUID content_set_guid, + [in,range(0,2)] frstrans_VersionRequestType request_type, + [in,range(0,2)] frstrans_VersionChangeType change_type, + [in] hyper vv_generation + ); + + /*****************/ + /* Function 0x05 */ + typedef struct { + GUID machine_guid; + uint32 year; + uint32 month; + uint32 day_of_week; + uint32 day; + uint32 hour; + uint32 minute; + uint32 second; + uint32 milli_seconds; + } frstrans_EpoqueVector; + + typedef struct { + hyper vv_generation; + uint32 version_vector_count; + [size_is(version_vector_count)] + frstrans_VersionVector *version_vector; + uint32 epoque_vector_count; + [size_is(epoque_vector_count)] + frstrans_EpoqueVector *epoque_vector; + } frstrans_AsyncVersionVectorResponse; + + typedef struct { + uint32 sequence_number; + WERROR status; + frstrans_AsyncVersionVectorResponse response; + } frstrans_AsyncResponseContext; + + WERROR frstrans_AsyncPoll( + [in] GUID connection_guid, + [out,ref] frstrans_AsyncResponseContext *response + ); + + /*****************/ + /* Function 0x06 */ + [todo] void FRSTRANS_REQUEST_RECORDS(); + + /*****************/ + /* Function 0x07 */ + [todo] void FRSTRANS_UPDATE_CANCEL(); + + /*****************/ + /* Function 0x08 */ + [todo] void FRSTRANS_RAW_GET_FILE_DATA(); + + /*****************/ + /* Function 0x09 */ + [todo] void FRSTRANS_RDC_GET_SIGNATURES(); + + /*****************/ + /* Function 0x0a */ + [todo] void FRSTRANS_RDC_PUSH_SOURCE_NEEDS(); + + /*****************/ + /* Function 0x0b */ + [todo] void FRSTRANS_RDC_GET_FILE_DATA(); + + /*****************/ + /* Function 0x0c */ + WERROR frstrans_RdcClose( + [in,out,ref] policy_handle *server_context + ); + + /*****************/ + /* Function 0x0d */ + typedef enum { + FRSTRANS_STAGING_POLICY_SERVER_DEFAULTY = 0x0000, + FRSTRANS_STAGING_POLICY_STATGING_REQUIRED = 0x0001, + FRSTRANS_STAGING_POLICY_RESTATGING_REQUIRED = 0x0002 + } frstrans_RequestedStagingPolicy; + + typedef enum { + FRSTRANS_RDC_FILTER_GENERIC = 0x0000, + FRSTRANS_RDC_FILTER_MAX = 0x0001, + FRSTRANS_RDC_FILTER_POINT = 0x0002, + FRSTRANS_RDC_MAX_ALGORITHM = 0x0003 + } frstrans_RdcChunckerAlgorithm; + + typedef struct { + frstrans_RdcChunckerAlgorithm chunker_type; + uint8 chunker_parameters[64]; + } frstrans_RdcParameterGeneric; + + typedef struct { + [range(128,1024*16)] uint16 min_horizon_size; + [range(2,96)] uint16 max_window_size; + } frstrans_RdcParameterFilterMax; + + typedef struct { + uint16 min_chunk_size; + uint16 max_chunk_size; + } frstrans_RdcParameterFilterPoint; + + typedef [switch_type(frstrans_RdcChunckerAlgorithm)] union { + [case(FRSTRANS_RDC_FILTER_GENERIC)] + frstrans_RdcParameterGeneric filter_generic; + [case(FRSTRANS_RDC_FILTER_MAX)] + frstrans_RdcParameterFilterMax filter_max; + [case(FRSTRANS_RDC_FILTER_POINT)] + frstrans_RdcParameterFilterPoint filter_point; + } frstrans_RdcParameterUnion; + + typedef struct { + frstrans_RdcChunckerAlgorithm rdc_chunker_algorithm; + [switch_is(rdc_chunker_algorithm)] frstrans_RdcParameterUnion u; + } frstrans_RdcParameters; + + typedef enum { + FRSTRANS_RDC_VERSION = 0x0001 + } frstrans_RdcVersion; + + typedef enum { + FRSTRANS_RDC_VERSION_COMPATIBLE = 0x0001 + } frstrans_RdcVersionCompatible; + + typedef enum { + FRSTRANS_RDC_UNCOMPRESSED = 0x0000, + FRSTRANS_RDC_XPRESS = 0x0001 + } frstrans_RdcCompressionAlgorithm; + + typedef struct { + hyper on_disk_file_size; + hyper file_size_estimate; + frstrans_RdcVersion rdc_version; + frstrans_RdcVersionCompatible rdc_minimum_compatible_version; + [range(0,8)] uint8 rdc_signature_levels; + frstrans_RdcCompressionAlgorithm compression_algorithm; + [size_is(rdc_signature_levels)] + frstrans_RdcParameters rdc_filter_parameters[*]; + } frstrans_RdcFileInfo; + + WERROR frstrans_InitializeFileTransferAsync( + [in] GUID connection_guid, + [in,out,ref] frstrans_Update *frs_update, + [in,range(0,1)] boolean32 rdc_desired, + [in,out,ref] frstrans_RequestedStagingPolicy *staging_policy, + [out,ref] policy_handle *server_context, + [out,ref] frstrans_RdcFileInfo **rdc_file_info, + [out,ref,size_is(buffer_size),length_is(*size_read)] + uint8 *data_buffer, + [in,range(0,262144)] uint32 buffer_size, + [out,ref] uint32 *size_read, + [out,ref] boolean32 *is_end_of_file + ); + + /*****************/ + /* Function 0x0e */ + [todo] void FRSTRANS_OPNUM_0E_NOT_USED_ON_THE_WIRE(); + + /* The following functions are new in Windows 2008 */ + + /*****************/ + /* Function 0x0f */ + typedef [flag(NDR_PAHEX)] pipe uint8 frstrans_BytePipe; + + WERROR frstrans_RawGetFileDataAsync( + [in,ref] policy_handle *server_context, + [out,ref] frstrans_BytePipe *byte_pipe + ); + + /*****************/ + /* Function 0x10 */ + WERROR frstrans_RdcGetFileDataAsync( + [in,ref] policy_handle *server_context, + [out,ref] frstrans_BytePipe *byte_pipe + ); +} diff --git a/librpc/idl/fscc.idl b/librpc/idl/fscc.idl new file mode 100644 index 0000000..9947dcc --- /dev/null +++ b/librpc/idl/fscc.idl @@ -0,0 +1,47 @@ +#include "idl_types.h" + +import "misc.idl"; +/* fscc structures */ + +[ + pointer_default(unique), + helpstring("fscc structures") +] + + +interface fscc +{ + typedef [public] struct { + GUID id; + GUID birthVolumeId; + GUID initialObjectId; + GUID domainId; + } fscc_FileObjectIdBuffer_2; + + typedef [bitmap32bit,flag(NDR_PAHEX)] bitmap{ + FSCC_FILE_ATTRIBUTE_READONLY = 0x00000001, + FSCC_FILE_ATTRIBUTE_HIDDEN = 0x00000002, + FSCC_FILE_ATTRIBUTE_SYSTEM = 0x00000004, + FSCC_FILE_ATTRIBUTE_NORMAL = 0x00000008, + FSCC_FILE_ATTRIBUTE_DIRECTORY = 0x00000010, + FSCC_FILE_ATTRIBUTE_ARCHIVE = 0x00000020, + FSCC_FILE_ATTRIBUTE_TEMPORARY = 0x00000100, + FSCC_FILE_ATTRIBUTE_SPARSE_FILE = 0x00000200, + FSCC_FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400, + FSCC_FILE_ATTRIBUTE_COMPRESSED = 0x00000800, + FSCC_FILE_ATTRIBUTE_OFFLINE = 0x00001000, + FSCC_FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 0x00002000, + FSCC_FILE_ATTRIBUTE_ENCRYPTED = 0x00004000 + } fscc_FileAttributes; + + typedef [public] struct { + hyper creationTime; + hyper lastAccessTime; + hyper lastWriteTime; + hyper changeTime; + hyper allocSize; + hyper endOfFile; + fscc_FileAttributes fileAttribute; + uint32 reserved; + } fscc_FileNetworkOpenInformation; +} diff --git a/librpc/idl/fsrvp.idl b/librpc/idl/fsrvp.idl new file mode 100644 index 0000000..6158f43 --- /dev/null +++ b/librpc/idl/fsrvp.idl @@ -0,0 +1,107 @@ +#include "idl_types.h" + +/* + * File Server Remote VSS Protocol Definitions + */ + +import "misc.idl"; + +[ uuid("a8e0653c-2744-4389-a61d-7373df8b2292"), + version(1.0), + endpoint("ncacn_np:[\\pipe\\FssagentRpc]"), + helpstring("File Server Remote VSS Protocol"), + pointer_default(unique) +] interface FileServerVssAgent +{ + const uint32 FSRVP_E_BAD_STATE = 0x80042301; + const uint32 FSRVP_E_SHADOW_COPY_SET_IN_PROGRESS = 0x80042316; + const uint32 FSRVP_E_NOT_SUPPORTED = 0x8004230C; + const uint32 FSRVP_E_WAIT_TIMEOUT = 0x00000102; + const uint32 FSRVP_E_WAIT_FAILED = 0xFFFFFFFF; + const uint32 FSRVP_E_OBJECT_ALREADY_EXISTS = 0x8004230D; + const uint32 FSRVP_E_OBJECT_NOT_FOUND = 0x80042308; + const uint32 FSRVP_E_UNSUPPORTED_CONTEXT = 0x8004231B; + const uint32 FSRVP_E_BAD_ID = 0x80042302; /* wire, not documented */ + const uint32 FSRVP_E_SHADOWCOPYSET_ID_MISMATCH = 0x80042501; + typedef struct { + GUID ShadowCopySetId; + GUID ShadowCopyId; + [string,charset(UTF16)] uint16 *ShareNameUNC; + [string,charset(UTF16)] uint16 *ShadowCopyShareName; + NTTIME tstamp; + } fssagent_share_mapping_1; + + typedef union { + [case(1)] fssagent_share_mapping_1 *ShareMapping1; + [default]; + } fssagent_share_mapping; + + const uint32 FSRVP_RPC_VERSION_1 = 0x00000001; + DWORD fss_GetSupportedVersion( + [out] uint32 *MinVersion, + [out] uint32 *MaxVersion); + + const uint32 ATTR_PERSISTENT = 0x00000001; + const uint32 ATTR_NO_AUTO_RECOVERY = 0x00000002; + const uint32 ATTR_NO_AUTO_RELEASE = 0x00000008; + const uint32 ATTR_NO_WRITERS = 0x00000010; + const uint32 ATTR_FILE_SHARE = 0x04000000; + const uint32 ATTR_AUTO_RECOVERY = 0x00400000; + + const uint32 FSRVP_CTX_BACKUP = 0x00000000; + const uint32 FSRVP_CTX_FILE_SHARE_BACKUP = 0x00000010; + const uint32 FSRVP_CTX_NAS_ROLLBACK = 0x00000019; + const uint32 FSRVP_CTX_APP_ROLLBACK = 0x00000009; + DWORD fss_SetContext( + [in] uint32 Context); + + DWORD fss_StartShadowCopySet( + [in] GUID ClientShadowCopySetId, + [out] GUID *pShadowCopySetId); + + DWORD fss_AddToShadowCopySet( + [in] GUID ClientShadowCopyId, + [in] GUID ShadowCopySetId, + [in] [string,charset(UTF16)] uint16 *ShareName, + [out] GUID *pShadowCopyId); + + DWORD fss_CommitShadowCopySet( + [in] GUID ShadowCopySetId, + [in] uint32 TimeOutInMilliseconds); + + DWORD fss_ExposeShadowCopySet( + [in] GUID ShadowCopySetId, + [in] uint32 TimeOutInMilliseconds); + + DWORD fss_RecoveryCompleteShadowCopySet( + [in] GUID ShadowCopySetId); + + DWORD fss_AbortShadowCopySet( + [in] GUID ShadowCopySetId); + + DWORD fss_IsPathSupported( + [in] [string,charset(UTF16)] uint16 *ShareName, + [out] boolean32 *SupportedByThisProvider, + [out] [string,charset(UTF16)] uint16 **OwnerMachineName); + + DWORD fss_IsPathShadowCopied( + [in] [string,charset(UTF16)] uint16 *ShareName, + [out] boolean32 *ShadowCopyPresent, + [out] int32 *ShadowCopyCompatibility); + + DWORD fss_GetShareMapping( + [in] GUID ShadowCopyId, + [in] GUID ShadowCopySetId, + [in] [string,charset(UTF16)] uint16 *ShareName, + [in] uint32 Level, + [out,switch_is(Level)] fssagent_share_mapping *ShareMapping); + + DWORD fss_DeleteShareMapping( + [in] GUID ShadowCopySetId, + [in] GUID ShadowCopyId, + [in] [string,charset(UTF16)] uint16 *ShareName); + + DWORD fss_PrepareShadowCopySet( + [in] GUID ShadowCopySetId, + [in] uint32 TimeOutInMilliseconds); +} diff --git a/librpc/idl/fsrvp_state.idl b/librpc/idl/fsrvp_state.idl new file mode 100644 index 0000000..9fcec12 --- /dev/null +++ b/librpc/idl/fsrvp_state.idl @@ -0,0 +1,36 @@ +#include "idl_types.h" +[ + pointer_default(unique) +] +interface fsrvp_state +{ + /* database format version, NOT the FSRVP protocol version */ + const uint32 FSRVP_STATE_DB_VERSION = 1; + + /* + * These data structures describe the FSRVP server on-disk format. Any + * changes should result in a new DB version number, and corresponding + * upgrade function. + */ + typedef [public] struct { + [flag(STR_UTF8|STR_NULLTERM)] string share_name; + [flag(STR_UTF8|STR_NULLTERM)] string sc_share_name; + [flag(STR_UTF8|STR_NULLTERM)] string sc_share_comment; + boolean32 is_exposed; + } fsrvp_state_smap; + + typedef [public] struct { + [flag(STR_UTF8|STR_NULLTERM)] string id_str; + [flag(STR_UTF8|STR_NULLTERM)] string volume_name; + [flag(STR_UTF8|STR_NULLTERM)] string sc_path; + time_t create_ts; + int smaps_count; + } fsrvp_state_sc; + + typedef [public] struct { + [flag(STR_UTF8|STR_NULLTERM)] string id_str; + int state; + int context; + int scs_count; + } fsrvp_state_sc_set; +} diff --git a/librpc/idl/gkdi.idl b/librpc/idl/gkdi.idl new file mode 100644 index 0000000..233a7a0 --- /dev/null +++ b/librpc/idl/gkdi.idl @@ -0,0 +1,125 @@ +/* + * Type definitions for Group Key Distribution Service + * + * The below was initially obtained from MS-GKDI which is copyright © 2021 + * Microsoft Corporation as permitted by the Open Specifications terms + * reproduced in IDL_LICENCE.txt. + * + * Only GetKey() was provided as IDL. The definitions of GroupKeyEnvelope, + * KdfParameters, and FfcDhParameters were derived from structure diagrams. + * KeyEnvelope was undocumented. + */ + +#include "idl_types.h" + +import "misc.idl"; + +[ + uuid("b9785960-524f-11df-8b6d-83dcded72085"), + endpoint("ncacn_np:[\\pipe\\lsass]", "ncacn_ip_tcp:", "ncalrpc:"), + version(1.0), + pointer_default(unique), + helpstring("Active Directory Group Key Distribution Service") +] +interface gkdi +{ + /* Public structures. */ + + typedef [bitmap32bit] bitmap { + ENVELOPE_FLAG_TRANSPORTING_PUBLIC_KEY = 0x00000001, + ENVELOPE_FLAG_KEY_MAY_ENCRYPT_NEW_DATA = 0x00000002 + } EnvelopeFlags; + + /* + * This is an undocumented type. It is similar to GroupKeyEnvelope, but + * with some fields omitted. + */ + typedef [public] struct { + uint32 version; + [value(0x4b53444b), range(0x4b53444b, 0x4b53444b)] uint32 magic; /* ‘KDSK’ */ + EnvelopeFlags flags; + uint32 l0_index; + [range(0, 31)] uint32 l1_index; + [range(0, 31)] uint32 l2_index; + GUID root_key_id; + uint32 additional_info_len; + [value(2 * ndr_charset_length(domain_name, CH_UTF16))] uint32 domain_name_len; + [value(2 * ndr_charset_length(forest_name, CH_UTF16))] uint32 forest_name_len; + /* + * https://lists.samba.org/archive/cifs-protocol/2023-December/004170.html + * This is the public key blob of an ephemeral public key used in secret + * agreement, or a random number used in deriving a symmetric key. + */ + [flag(NDR_SECRET)] uint8 additional_info[additional_info_len]; + nstring domain_name; /* DNS name of the domain which generated the key. */ + nstring forest_name; /* DNS name of the forest which generated the key. */ + } KeyEnvelope; + + typedef [public] struct { + uint32 version; /* The version (msKds-Version) of the root key ADM element. */ + [value(0x4b53444b), range(0x4b53444b, 0x4b53444b)] uint32 magic; /* ‘KDSK’ */ + EnvelopeFlags flags; + uint32 l0_index; + [range(0, 31)] uint32 l1_index; + [range(0, 31)] uint32 l2_index; + GUID root_key_id; + [value(2 * ndr_charset_length(kdf_algorithm, CH_UTF16))] uint32 kdf_algorithm_len; + uint32 kdf_parameters_len; + [value(2 * ndr_charset_length(secret_agreement_algorithm, CH_UTF16))] uint32 secret_agreement_algorithm_len; + uint32 secret_agreement_parameters_len; + uint32 private_key_len; + uint32 public_key_len; + uint32 l1_key_len; + uint32 l2_key_len; + [value(2 * ndr_charset_length(domain_name, CH_UTF16))] uint32 domain_name_len; + [value(2 * ndr_charset_length(forest_name, CH_UTF16))] uint32 forest_name_len; + nstring kdf_algorithm; + uint8 kdf_parameters[kdf_parameters_len]; + nstring secret_agreement_algorithm; + uint8 secret_agreement_parameters[secret_agreement_parameters_len]; + nstring domain_name; /* DNS name of the domain which generated the key. */ + nstring forest_name; /* DNS name of the forest which generated the key. */ + [flag(NDR_SECRET)] uint8 l1_key[l1_key_len]; + [flag(NDR_SECRET)] uint8 l2_key[l2_key_len]; + } GroupKeyEnvelope; + + typedef [public] struct { + [value(0)] uint32 padding_0; + [value(1)] uint32 padding_1; + [value(2 * ndr_charset_length(hash_algorithm, CH_UTF16))] uint32 hash_algorithm_len; + [value(0)] uint32 padding_2; + nstring hash_algorithm; + } KdfParameters; + + typedef [public] struct { + /* + * Twelve bytes account for the length, magic number, and key + * length; the remaining bytes cover the two arrays of + * ‘key_length’ bytes each. + */ + [value(12 + 2 * key_length)] uint32 length; + [value(0x4d504844), range(0x4d504844, 0x4d504844)] uint32 magic; /* ‘DHPM’ */ + uint32 key_length; + uint8 field_order[key_length]; + uint8 generator[key_length]; + } FfcDhParameters; + + typedef [public] struct { + GUID guid; + int32 l0_idx; + int32 l1_idx; + int32 l2_idx; + [flag(NDR_REMAINING)] DATA_BLOB target_security_descriptor; + } GkdiDerivationCtx; + + HRESULT gkdi_GetKey( + [in] uint32 target_sd_len, + [in] [size_is(target_sd_len)] [ref] char *target_sd, + [in] [unique] GUID* root_key_id, + [in] int32 l0_key_id, + [in] int32 l1_key_id, + [in] int32 l2_key_id, + [out] uint32 *out_len, + [out] [size_is(,*out_len)] uint8** out + ); +} diff --git a/librpc/idl/gmsa.idl b/librpc/idl/gmsa.idl new file mode 100644 index 0000000..bad9030 --- /dev/null +++ b/librpc/idl/gmsa.idl @@ -0,0 +1,44 @@ +/* + * Type definitions for Group Managed Service Accounts + * + * Derived from [MS-ADTS] 2.2.19 MSDS-MANAGEDPASSWORD_BLOB. + */ + +#include "idl_types.h" + +[ + uuid("e43b8cf6-1ead-11ee-aed1-e3597136ce70"), + version(0.0), + pointer_default(unique), + helpstring("Active Directory Group Managed Service Accounts") +] +interface gmsa +{ + /* Public structures. */ + + typedef [gensize] struct { + [relative_short] secret_u16string *current; + [relative_short] secret_u16string *previous; + /* + * MS-ADTS states that these fields must be placed on a 64‐bit + * boundary, but samples obtained from Windows are found not to + * be so. In practice, they’re offset by two bytes. That’s why + * we need NOALIGN. + */ + [relative_short, flag(NDR_NOALIGN)] hyper *query_interval; + [relative_short, flag(NDR_NOALIGN)] hyper *unchanged_interval; + } MANAGEDPASSWORD_BLOB_PASSWORDS; + + typedef [public] struct { + [value(1)] uint16 version; + [value(0)] uint16 reserved; + /* + * The size of the entire blob. 8 bytes account for the + * ‘version’ field, the ‘reserved’ field, and the ‘length’ field + * itself. + */ + [value(8 + ndr_size_MANAGEDPASSWORD_BLOB_PASSWORDS(&passwords, + ndr->flags))] uint32 length; + MANAGEDPASSWORD_BLOB_PASSWORDS passwords; + } MANAGEDPASSWORD_BLOB; +} diff --git a/librpc/idl/idl_types.h b/librpc/idl/idl_types.h new file mode 100644 index 0000000..4f0e69b --- /dev/null +++ b/librpc/idl/idl_types.h @@ -0,0 +1,70 @@ +#define STR_ASCII LIBNDR_FLAG_STR_ASCII +#define STR_LEN4 LIBNDR_FLAG_STR_LEN4 +#define STR_SIZE4 LIBNDR_FLAG_STR_SIZE4 +#define STR_SIZE2 LIBNDR_FLAG_STR_SIZE2 +#define STR_NOTERM LIBNDR_FLAG_STR_NOTERM +#define STR_NULLTERM LIBNDR_FLAG_STR_NULLTERM +#define STR_BYTESIZE LIBNDR_FLAG_STR_BYTESIZE +#define STR_NO_EMBEDDED_NUL LIBNDR_FLAG_STR_NO_EMBEDDED_NUL +#define STR_CONFORMANT LIBNDR_FLAG_STR_CONFORMANT +#define STR_CHARLEN LIBNDR_FLAG_STR_CHARLEN +#define STR_UTF8 LIBNDR_FLAG_STR_UTF8 +#define STR_RAW8 LIBNDR_FLAG_STR_RAW8 + +/* + a null terminated UCS2 string +*/ +#define nstring [flag(STR_NULLTERM|NDR_ALIGN2)] string + +/* + a null terminated ascii string +*/ +#define astring [flag(STR_ASCII|STR_NULLTERM)] string + +/* + a null terminated UTF8 string +*/ +#define utf8string [flag(STR_UTF8|STR_NULLTERM)] string + +/* + a null terminated "raw" string (null terminated byte sequence) +*/ +#define raw8string [flag(STR_RAW8|STR_NULLTERM)] string + +/* + a secret null terminated UTF‐16 string (null terminated word sequence) +*/ +#define secret_u16string [flag(NDR_SECRET|STR_NULLTERM)] u16string + +/* + a null terminated UCS2 string +*/ +#define nstring_array [flag(STR_NULLTERM|NDR_ALIGN2)] string_array + +#define NDR_NOALIGN LIBNDR_FLAG_NOALIGN +#define NDR_REMAINING LIBNDR_FLAG_REMAINING +#define NDR_ALIGN2 LIBNDR_FLAG_ALIGN2 +#define NDR_ALIGN4 LIBNDR_FLAG_ALIGN4 +#define NDR_ALIGN8 LIBNDR_FLAG_ALIGN8 +#define NDR_NO_COMP LIBNDR_FLAG_NO_COMPRESSION + +/* this flag is used to force a section of IDL as little endian. It is + needed for the epmapper IDL, which is defined as always being LE */ +#define NDR_LITTLE_ENDIAN LIBNDR_FLAG_LITTLE_ENDIAN +#define NDR_BIG_ENDIAN LIBNDR_FLAG_BIGENDIAN + +/* + this is used to control formatting of uint8 arrays +*/ +#define NDR_PAHEX LIBNDR_PRINT_ARRAY_HEX + +/* + * Mark an element as SECRET, it won't be printed by + * via ndr_print* unless NDR_PRINT_SECRETS is specified. + */ +#define NDR_SECRET LIBNDR_FLAG_IS_SECRET + +#define NDR_RELATIVE_REVERSE LIBNDR_FLAG_RELATIVE_REVERSE +#define NDR_NO_RELATIVE_REVERSE LIBNDR_FLAG_NO_RELATIVE_REVERSE + +#define NDR_SUBCONTEXT_NO_UNREAD_BYTES LIBNDR_FLAG_SUBCONTEXT_NO_UNREAD_BYTES diff --git a/librpc/idl/idmap.idl b/librpc/idl/idmap.idl new file mode 100644 index 0000000..e58e392 --- /dev/null +++ b/librpc/idl/idmap.idl @@ -0,0 +1,53 @@ +#include "idl_types.h" + +import "security.idl"; + +[ + pointer_default(unique) +] +interface idmap +{ + typedef [public] enum { + ID_TYPE_NOT_SPECIFIED, + ID_TYPE_UID, + ID_TYPE_GID, + ID_TYPE_BOTH, + /* + * This are internal between winbindd + * parent and child. + * + * It means the idmap backend/child requires a valid type_hint + * for wbint_Sids2UnixIDs(): + * + * - ID_TYPE_UID or ID_TYPE_GID means the user/group exists + * - ID_TYPE_BOTH means that only the domain exist + */ + ID_TYPE_WB_REQUIRE_TYPE + } id_type; + + typedef [public] struct { + uint32 id; + id_type type; + } unixid; + + typedef [public] enum { + ID_UNKNOWN, + ID_MAPPED, + ID_UNMAPPED, + ID_EXPIRED, + /* + * This means the idmap backend requires a valid type_hint + * in order to map a sid to a unix id. + * + * - ID_TYPE_UID or ID_TYPE_GID means the user/group exists + * - ID_TYPE_BOTH means that only the domain exist + */ + ID_REQUIRE_TYPE + } id_mapping; + + typedef [public] struct { + dom_sid *sid; + unixid xid; + id_mapping status; + } id_map; +} diff --git a/librpc/idl/initshutdown.idl b/librpc/idl/initshutdown.idl new file mode 100644 index 0000000..63cf62b --- /dev/null +++ b/librpc/idl/initshutdown.idl @@ -0,0 +1,91 @@ +#include "idl_types.h" + +/* + initshutdown interface definition +*/ + +import "lsa.idl"; + +[ + uuid("894de0c0-0d55-11d3-a322-00c04fa321a1"), + version(1.0), + endpoint("ncacn_np:[\\pipe\\InitShutdown]"), + pointer_default(unique), + helpstring("Init shutdown service") +] interface initshutdown +{ + typedef [v1_enum] enum { + SHTDN_REASON_MAJOR_OTHER = 0x00000000, + SHTDN_REASON_MAJOR_HARDWARE = 0x00010000, + SHTDN_REASON_MAJOR_OPERATINGSYSTEM = 0x00020000, + SHTDN_REASON_MAJOR_SOFTWARE = 0x00030000, + SHTDN_REASON_MAJOR_APPLICATION = 0x00040000, + SHTDN_REASON_MAJOR_SYSTEM = 0x00050000, + SHTDN_REASON_MAJOR_POWER = 0x00060000, + SHTDN_REASON_MAJOR_LEGACY_API = 0x00070000 + } initshutdown_ReasonMajor; + + typedef [v1_enum] enum { + SHTDN_REASON_MINOR_OTHER = 0x00000000, + SHTDN_REASON_MINOR_MAINTENANCE = 0x00000001, + SHTDN_REASON_MINOR_INSTALLATION = 0x00000002, + SHTDN_REASON_MINOR_UPGRADE = 0x00000003, + SHTDN_REASON_MINOR_RECONFIG = 0x00000004, + SHTDN_REASON_MINOR_HUNG = 0x00000005, + SHTDN_REASON_MINOR_UNSTABLE = 0x00000006, + SHTDN_REASON_MINOR_DISK = 0x00000007, + SHTDN_REASON_MINOR_PROCESSOR = 0x00000008, + SHTDN_REASON_MINOR_NETWORKCARD = 0x00000009, + SHTDN_REASON_MINOR_POWER_SUPPLY = 0x0000000a, + SHTDN_REASON_MINOR_CORDUNPLUGGED = 0x0000000b, + SHTDN_REASON_MINOR_ENVIRONMENT = 0x0000000c, + SHTDN_REASON_MINOR_HARDWARE_DRIVER = 0x0000000d, + SHTDN_REASON_MINOR_OTHERDRIVER = 0x0000000e, + SHTDN_REASON_MINOR_BLUESCREEN = 0x0000000f, + SHTDN_REASON_MINOR_SERVICEPACK = 0x00000010, + SHTDN_REASON_MINOR_HOTFIX = 0x00000011, + SHTDN_REASON_MINOR_SECURITYFIX = 0x00000012, + SHTDN_REASON_MINOR_SECURITY = 0x00000013, + SHTDN_REASON_MINOR_NETWORK_CONNECTIVITY = 0x00000014, + SHTDN_REASON_MINOR_WMI = 0x00000015, + SHTDN_REASON_MINOR_SERVICEPACK_UNINSTALL= 0x00000016, + SHTDN_REASON_MINOR_HOTFIX_UNINSTALL = 0x00000017, + SHTDN_REASON_MINOR_SECURITYFIX_UNINSTALL= 0x00000018, + SHTDN_REASON_MINOR_MMC = 0x00000019, + SHTDN_REASON_MINOR_TERMSRV = 0x00000020 + } initshutdown_ReasonMinor; + + typedef [bitmap32bit] bitmap { + SHTDN_REASON_FLAG_USER_DEFINED = 0x40000000, + SHTDN_REASON_FLAG_PLANNED = 0x80000000 + } initshutdown_ReasonFlags; + + WERROR initshutdown_Init( + [in,unique] uint16 *hostname, + /* + * Note: lsa_String and winreg_String both result + * in WERR_INVALID_PARAMETER + */ + [in,unique] lsa_StringLarge *message, + [in] uint32 timeout, + [in] uint8 force_apps, + [in] uint8 do_reboot + ); + + WERROR initshutdown_Abort( + [in,unique] uint16 *server + ); + + WERROR initshutdown_InitEx( + [in,unique] uint16 *hostname, + /* + * Note: lsa_String and winreg_String both result + * in WERR_INVALID_PARAMETER + */ + [in,unique] lsa_StringLarge *message, + [in] uint32 timeout, + [in] uint8 force_apps, + [in] uint8 do_reboot, + [in] uint32 reason + ); +} diff --git a/librpc/idl/ioctl.idl b/librpc/idl/ioctl.idl new file mode 100644 index 0000000..7b8b1b8 --- /dev/null +++ b/librpc/idl/ioctl.idl @@ -0,0 +1,242 @@ +#include "idl_types.h" +[ + pointer_default(unique) +] +interface copychunk +{ + typedef [public] struct { + uint8 resume_key[24]; + uint32 context_len; + /* <56> Windows sends 4 bytes of zero for the context field. */ + uint8 context[4]; + } req_resume_key_rsp; + + const uint32 COPYCHUNK_MAX_CHUNKS = 256; /* 2k8r2 & win8 = 256 */ + const uint32 COPYCHUNK_MAX_CHUNK_LEN = 1048576; /* 2k8r2 & win8 = 1048576 */ + const uint32 COPYCHUNK_MAX_TOTAL_LEN = 16777216; /* 2k8r2 & win8 = 16777216 */ + + typedef struct { + hyper source_off; + hyper target_off; + uint32 length; + uint32 reserved; + } srv_copychunk; + + typedef [public] struct { + uint8 source_key[24]; + uint32 chunk_count; + uint32 reserved; + srv_copychunk chunks[chunk_count]; + } srv_copychunk_copy; + + typedef [public] struct { + uint32 chunks_written; + uint32 chunk_bytes_written; + uint32 total_bytes_written; + } srv_copychunk_rsp; + + typedef [public] struct { + uint32 version; + uint32 size; + uint32 maximum_token_lifetime; + uint32 default_token_lifetime; + hyper maximum_xfer_size; + hyper optimal_xfer_count; + uint32 maximum_data_descriptors; + uint32 maximum_xfer_length_per_descriptor; + uint32 optimal_xfer_length_per_descriptor; + uint16 optimal_xfer_length_granularity; + uint8 reserved[2]; + } device_copy_offload_descriptor; + + const uint32 STORAGE_OFFLOAD_TOKEN_TYPE_ZERO_DATA = 0xffff0001; + + typedef [public] struct { + uint32 token_type; + uint8 reserved[2]; + uint16 token_id_len; + uint8 token[token_id_len]; + } storage_offload_token; + + typedef [public] struct { + uint32 size; + uint32 flags; + uint32 token_time_to_live; + uint32 reserved; + hyper file_offset; + hyper length; + } fsctl_offload_read_input; + + typedef [public,bitmap32bit] bitmap { + OFFLOAD_READ_FLAG_FILE_TOO_SMALL = 0x01, + OFFLOAD_READ_FLAG_ALL_ZERO_BEYOND_RANGE = 0x02, + OFFLOAD_READ_FLAG_CANNOT_OFFLOAD_BEYOND_RANGE = 0x04 + } offload_flags; + + typedef [public] struct { + uint32 size; + offload_flags flags; + hyper xfer_length; + storage_offload_token token; + } fsctl_offload_read_output; + + typedef [public] struct { + uint32 size; + offload_flags flags; + hyper file_offset; + hyper copy_length; + hyper xfer_offset; + storage_offload_token token; + } fsctl_offload_write_input; + + typedef [public] struct { + uint32 size; + uint32 flags; + hyper length_written; + } fsctl_offload_write_output; + + typedef [public] struct { + uint8 source_fid[16]; + hyper source_off; + hyper target_off; + hyper byte_count; + } fsctl_dup_extents_to_file; +} + +interface compression +{ + const uint16 COMPRESSION_FORMAT_NONE = 0x0000; + const uint16 COMPRESSION_FORMAT_DEFAULT = 0x0001; + const uint16 COMPRESSION_FORMAT_LZNT1 = 0x0002; + + typedef [public] struct { + uint16 format; + } compression_state; +} + +interface netinterface +{ + typedef [bitmap32bit] bitmap { + FSCTL_NET_IFACE_NONE_CAPABLE = 0x00000000, + FSCTL_NET_IFACE_RSS_CAPABLE = 0x00000001, + FSCTL_NET_IFACE_RDMA_CAPABLE = 0x00000002 + } fsctl_net_iface_capability; + + typedef [enum16bit] enum { + FSCTL_NET_IFACE_AF_INET = 0x0002, + FSCTL_NET_IFACE_AF_INET6 = 0x0017 + } fsctl_sockaddr_af; + + typedef [flag(NDR_NOALIGN)] struct { + [value(0)] uint16 port; + [flag(NDR_BIG_ENDIAN)] ipv4address ipv4; + [value(0)] hyper reserved; + } fsctl_sockaddr_in; + + typedef [flag(NDR_NOALIGN)] struct { + [value(0)] uint16 port; + [value(0)] uint32 flowinfo; + [flag(NDR_BIG_ENDIAN)] ipv6address ipv6; + [value(0)] uint32 scopeid; + } fsctl_sockaddr_in6; + + typedef [nodiscriminant,flag(NDR_NOALIGN)] union { + [case (FSCTL_NET_IFACE_AF_INET)] fsctl_sockaddr_in saddr_in; + [case (FSCTL_NET_IFACE_AF_INET6)] fsctl_sockaddr_in6 saddr_in6; + } fsctl_sockaddr_union; + + typedef [flag(NDR_NOALIGN)] struct { + fsctl_sockaddr_af family; + [subcontext(0),subcontext_size(126),switch_is(family)] fsctl_sockaddr_union saddr; + } fsctl_sockaddr_storage; + + typedef [public,relative_base,noprint] struct { + [relative,max_recursion(20000)] fsctl_net_iface_info *next; + uint32 ifindex; + fsctl_net_iface_capability capability; + [value(0)] uint32 reserved; + hyper linkspeed; + fsctl_sockaddr_storage sockaddr; + } fsctl_net_iface_info; +} + +interface sparse +{ + /* MS-FSCC 2.3.33 FSCTL_QUERY_ALLOCATED_RANGES Request */ + typedef [public] struct { + hyper file_off; + hyper len; + } file_alloced_range_buf; + + typedef [public] struct { + file_alloced_range_buf buf; + } fsctl_query_alloced_ranges_req; + + /* + * 2.3.34 FSCTL_QUERY_ALLOCATED_RANGES Reply + * ... + * The number of FILE_ALLOCATED_RANGE_BUFFER elements returned is + * computed by dividing the size of the returned output buffer (from + * either SMB or SMB2, the lower-layer protocol that carries the FSCTL) + * by the size of the FILE_ALLOCATED_RANGE_BUFFER element. + * + * This logic can't (currently) be represented in pidl, so just use a + * blob. Perhaps in future we'll support: + * [flag(NDR_REMAINING)] file_alloced_range_buf array[]; + */ + typedef [public] struct { + [flag(NDR_REMAINING)] DATA_BLOB far_buf_array; + } fsctl_query_alloced_ranges_rsp; + + /* 2.3.65 FSCTL_SET_ZERO_DATA Request */ + typedef [public] struct { + hyper file_off; + hyper beyond_final_zero; + } file_zero_data_info; + + typedef [public] struct { + file_zero_data_info info; + } fsctl_set_zero_data_req; +} + +interface resiliency +{ + /* 2.2.31.3 NETWORK_RESILIENCY_REQUEST */ + typedef [public] struct { + uint32 timeout; + uint32 reserved; + } network_resiliency_request; +} + +interface trim +{ + /* MS-FSCC 2.3.73.1 FILE_LEVEL_TRIM_RANGE */ + typedef [public] struct { + hyper off; + hyper len; + } file_level_trim_range; + + /* MS-FSCC 2.3.73 FSCTL_FILE_LEVEL_TRIM Request */ + typedef [public] struct { + uint32 key; + uint32 num_ranges; + file_level_trim_range ranges[num_ranges]; + } fsctl_file_level_trim_req; + + /* MS-FSCC 2.3.74 FSCTL_FILE_LEVEL_TRIM Reply */ + typedef [public] struct { + uint32 num_ranges_processed; + } fsctl_file_level_trim_rsp; +} + +interface fsctl +{ + /* MS-FSCC 2.3.31 FSCTL_PIPE_WAIT */ + typedef [public] struct { + hyper timeout; + [value(2*strlen_m(pipe_name))] uint32 pipe_name_len; + uint8 timeout_specified; + uint8 padding; + [charset(UTF16)] uint8 pipe_name[pipe_name_len]; + } fsctl_pipe_wait; +} diff --git a/librpc/idl/keysvc.idl b/librpc/idl/keysvc.idl new file mode 100644 index 0000000..9d05f7d --- /dev/null +++ b/librpc/idl/keysvc.idl @@ -0,0 +1,16 @@ +/* + cryptographic key services interface +*/ + + +/* Also seen as: 0d72a7d4-6148-11d1-b4aa-00c04fb66ea0 */ +[ + uuid("8d0ffe72-d252-11d0-bf8f-00c04fd9126b"), + pointer_default(unique), + version(1.0), + helpstring("Cryptographic Key Services") +] +interface keysvc +{ + WERROR keysvc_Unknown0(); +} diff --git a/librpc/idl/krb5ccache.idl b/librpc/idl/krb5ccache.idl new file mode 100644 index 0000000..1f0cfa7 --- /dev/null +++ b/librpc/idl/krb5ccache.idl @@ -0,0 +1,115 @@ +/* + krb5 credentials cache (version 3 or 4) + specification: https://web.mit.edu/kerberos/krb5-devel/doc/formats/ccache_file_format.html +*/ + +#include "idl_types.h" + +[ + uuid("1702b695-99ca-4f32-93e4-1e1c4d5ddb53"), + version(0.0), + pointer_default(unique), + helpstring("KRB5 credentials cache") +] +interface krb5ccache +{ + typedef struct { + uint32 name_type; + uint32 component_count; + [flag(STR_SIZE4|STR_NOTERM|STR_UTF8)] string realm; + [flag(STR_SIZE4|STR_NOTERM|STR_UTF8)] string components[component_count]; + } PRINCIPAL; + + typedef struct { + uint16 enctype; + DATA_BLOB data; + } KEYBLOCK; + + typedef struct { + uint16 addrtype; + DATA_BLOB data; + } ADDRESS; + + typedef struct { + uint32 count; + ADDRESS data[count]; + } ADDRESSES; + + typedef struct { + uint16 ad_type; + DATA_BLOB data; + } AUTHDATUM; + + typedef struct { + uint32 count; + AUTHDATUM data[count]; + } AUTHDATA; + + typedef struct { + PRINCIPAL client; + PRINCIPAL server; + KEYBLOCK keyblock; + uint32 authtime; + uint32 starttime; + uint32 endtime; + uint32 renew_till; + uint8 is_skey; + uint32 ticket_flags; + ADDRESSES addresses; + AUTHDATA authdata; + DATA_BLOB ticket; + DATA_BLOB second_ticket; + } CREDENTIAL; + + typedef struct { + [value(0)] int32 kdc_sec_offset; + [value(0)] int32 kdc_usec_offset; + } DELTATIME_TAG; + + typedef [nodiscriminant] union { + [case(1)] DELTATIME_TAG deltatime_tag; + } FIELD; + + typedef struct { + [value(1)] uint16 tag; + [subcontext(2),switch_is(tag)] FIELD field; + } V4TAG; + + typedef struct { + V4TAG tag; + /* + * We should allow for more than one tag to be properly parsed, but that + * would require manual parsing. + */ + [flag(NDR_REMAINING)] DATA_BLOB further_tags; + } V4TAGS; + + typedef struct { + [subcontext(2)] V4TAGS v4tags; + } V4HEADER; + + typedef [nodiscriminant] union { + /* + * We don't attempt to support file format versions 1 and 2 as they + * assume native CPU byte order, which makes no sense in PIDL. + */ + [case(3)] ; + [case(4)] V4HEADER v4header; + } OPTIONAL_HEADER; + + /* Public structures. */ + + typedef [flag(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct { + [value(5)] uint8 pvno; + [value(4)] uint8 version; + [switch_is(version)] OPTIONAL_HEADER optional_header; + PRINCIPAL principal; + CREDENTIAL cred; + [flag(NDR_REMAINING)] DATA_BLOB further_creds; + } CCACHE; + + typedef [flag(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct { + CREDENTIAL cred; + [flag(NDR_REMAINING)] DATA_BLOB further_creds; + } MULTIPLE_CREDENTIALS; +} diff --git a/librpc/idl/krb5pac.idl b/librpc/idl/krb5pac.idl new file mode 100644 index 0000000..77189bb --- /dev/null +++ b/librpc/idl/krb5pac.idl @@ -0,0 +1,264 @@ +/* + krb5 PAC + + Portions obtained from MS-KILE which is Copyright © 2021 Microsoft + Corporation as permitted by the Open Specifications terms + reproduced in IDL_LICENCE.txt + +*/ + +#include "idl_types.h" + +import "security.idl", "lsa.idl", "netlogon.idl", "samr.idl"; + +[ + uuid("12345778-1234-abcd-0000-00000000"), + version(0.0), + pointer_default(unique), + helpstring("Active Directory KRB5 PAC"), + helper("../librpc/ndr/ndr_krb5pac.h") +] +interface krb5pac +{ + typedef struct { + NTTIME logon_time; + [value(2*strlen_m(account_name))] uint16 size; + [charset(UTF16)] uint8 account_name[size]; + } PAC_LOGON_NAME; + + typedef [public,flag(NDR_PAHEX)] struct { + uint32 type; + [flag(NDR_REMAINING)] DATA_BLOB signature; + } PAC_SIGNATURE_DATA; + + typedef struct { + dom_sid2 *domain_sid; + samr_RidWithAttributeArray groups; + } PAC_DOMAIN_GROUP_MEMBERSHIP; + + typedef struct { + netr_SamInfo3 info3; + /* + * On ndr_push: + * Pointers values of info3.sids[*].sid + * should be allocated before the following ones? + * (just the 0x30 0x00 0x02 0x00 value). + */ + PAC_DOMAIN_GROUP_MEMBERSHIP resource_groups; + } PAC_LOGON_INFO; + + typedef [bitmap32bit] bitmap { + PAC_CREDENTIAL_NTLM_HAS_LM_HASH = 0x00000001, + PAC_CREDENTIAL_NTLM_HAS_NT_HASH = 0x00000002 + } PAC_CREDENTIAL_NTLM_FLAGS; + + typedef [public] struct { + [value(0)] uint32 version; + PAC_CREDENTIAL_NTLM_FLAGS flags; + [noprint] samr_Password lm_password; + [noprint] samr_Password nt_password; + } PAC_CREDENTIAL_NTLM_SECPKG; + + typedef [public] struct { + lsa_String package_name; + uint32 credential_size; + [size_is(credential_size), noprint] uint8 *credential; + } PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG; + + typedef [public] struct { + uint32 credential_count; + [size_is(credential_count)] PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG credentials[*]; + } PAC_CREDENTIAL_DATA; + + typedef [public] struct { + PAC_CREDENTIAL_DATA *data; + } PAC_CREDENTIAL_DATA_CTR; + + typedef [public] struct { + [subcontext(0xFFFFFC01)] PAC_CREDENTIAL_DATA_CTR ctr; + } PAC_CREDENTIAL_DATA_NDR; + + typedef [public] struct { + [value(0)] uint32 version; + uint32 encryption_type; + [flag(NDR_REMAINING)] DATA_BLOB encrypted_data; + } PAC_CREDENTIAL_INFO; + + typedef struct { + lsa_String proxy_target; + uint32 num_transited_services; + [size_is(num_transited_services)] lsa_String *transited_services; + } PAC_CONSTRAINED_DELEGATION; + + typedef [bitmap32bit] bitmap { + PAC_UPN_DNS_FLAG_CONSTRUCTED = 0x00000001, + PAC_UPN_DNS_FLAG_HAS_SAM_NAME_AND_SID = 0x00000002 + } PAC_UPN_DNS_FLAGS; + + typedef struct { + [value(2*strlen_m(samaccountname))] uint16 samaccountname_size; + [relative_short,subcontext(0),subcontext_size(samaccountname_size),flag(NDR_ALIGN8|STR_NOTERM|NDR_REMAINING)] string *samaccountname; + [value(ndr_size_dom_sid(objectsid, ndr->flags))] uint16 objectsid_size; + [relative_short,subcontext(0),subcontext_size(objectsid_size)] dom_sid *objectsid; + } PAC_UPN_DNS_INFO_SAM_NAME_AND_SID; + + typedef [nodiscriminant] union { + [case(PAC_UPN_DNS_FLAG_HAS_SAM_NAME_AND_SID)] PAC_UPN_DNS_INFO_SAM_NAME_AND_SID sam_name_and_sid; + [default]; + } PAC_UPN_DNS_INFO_EX; + + typedef struct { + [value(2*strlen_m(upn_name))] uint16 upn_name_size; + [relative_short,subcontext(0),subcontext_size(upn_name_size),flag(NDR_ALIGN8|STR_NOTERM|NDR_REMAINING)] string *upn_name; + [value(2*strlen_m(dns_domain_name))] uint16 dns_domain_name_size; + [relative_short,subcontext(0),subcontext_size(dns_domain_name_size),flag(NDR_ALIGN8|STR_NOTERM|NDR_REMAINING)] string *dns_domain_name; + PAC_UPN_DNS_FLAGS flags; + [switch_is(flags & PAC_UPN_DNS_FLAG_HAS_SAM_NAME_AND_SID)] PAC_UPN_DNS_INFO_EX ex; + } PAC_UPN_DNS_INFO; + + typedef [bitmap32bit] bitmap { + PAC_ATTRIBUTE_FLAG_PAC_WAS_REQUESTED = 0x00000001, + PAC_ATTRIBUTE_FLAG_PAC_WAS_GIVEN_IMPLICITLY = 0x00000002 + } PAC_ATTRIBUTE_INFO_FLAGS; + + typedef struct { + uint32 flags_length; /* length in bits */ + PAC_ATTRIBUTE_INFO_FLAGS flags; + } PAC_ATTRIBUTES_INFO; + + typedef struct { + dom_sid sid; + } PAC_REQUESTER_SID; + + typedef [public] struct { + PAC_LOGON_INFO *info; + } PAC_LOGON_INFO_CTR; + + typedef [public] struct { + PAC_CONSTRAINED_DELEGATION *info; + } PAC_CONSTRAINED_DELEGATION_CTR; + + typedef struct { + uint32 rid; + uint32 primary_gid; + dom_sid2 *domain_sid; + samr_RidWithAttributeArray groups; + uint32 sid_count; + [size_is(sid_count)] netr_SidAttr *sids; + uint32 domain_group_count; + [size_is(domain_group_count)] PAC_DOMAIN_GROUP_MEMBERSHIP *domain_groups; + } PAC_DEVICE_INFO; + + typedef struct { + PAC_DEVICE_INFO *info; + } PAC_DEVICE_INFO_CTR; + + typedef [public,v1_enum] enum { + PAC_TYPE_LOGON_INFO = 1, + PAC_TYPE_CREDENTIAL_INFO = 2, + PAC_TYPE_SRV_CHECKSUM = 6, + PAC_TYPE_KDC_CHECKSUM = 7, + PAC_TYPE_LOGON_NAME = 10, + PAC_TYPE_CONSTRAINED_DELEGATION = 11, + PAC_TYPE_UPN_DNS_INFO = 12, + PAC_TYPE_CLIENT_CLAIMS_INFO = 13, + PAC_TYPE_DEVICE_INFO = 14, + PAC_TYPE_DEVICE_CLAIMS_INFO = 15, + PAC_TYPE_TICKET_CHECKSUM = 16, + PAC_TYPE_ATTRIBUTES_INFO = 17, + PAC_TYPE_REQUESTER_SID = 18, + PAC_TYPE_FULL_CHECKSUM = 19 + /* + * Note! when adding new types, adjust the value of PAC_TYPE_END + * to equal one more than the highest supported type. + */ + } PAC_TYPE; + + const uint32 PAC_TYPE_BEGIN = 1; + const uint32 PAC_TYPE_END = 20; + const uint32 PAC_TYPE_COUNT = PAC_TYPE_END - PAC_TYPE_BEGIN; + + typedef struct { + [flag(NDR_REMAINING)] DATA_BLOB remaining; + } DATA_BLOB_REM; + + typedef [public,nodiscriminant,gensize] union { + [case(PAC_TYPE_LOGON_INFO)][subcontext(0xFFFFFC01)] PAC_LOGON_INFO_CTR logon_info; + [case(PAC_TYPE_CREDENTIAL_INFO)] PAC_CREDENTIAL_INFO credential_info; + [case(PAC_TYPE_SRV_CHECKSUM)] PAC_SIGNATURE_DATA srv_cksum; + [case(PAC_TYPE_KDC_CHECKSUM)] PAC_SIGNATURE_DATA kdc_cksum; + [case(PAC_TYPE_LOGON_NAME)] PAC_LOGON_NAME logon_name; + [case(PAC_TYPE_CONSTRAINED_DELEGATION)][subcontext(0xFFFFFC01)] + PAC_CONSTRAINED_DELEGATION_CTR constrained_delegation; + [case(PAC_TYPE_UPN_DNS_INFO)] PAC_UPN_DNS_INFO upn_dns_info; + [case(PAC_TYPE_TICKET_CHECKSUM)] PAC_SIGNATURE_DATA ticket_checksum; + [case(PAC_TYPE_ATTRIBUTES_INFO)] PAC_ATTRIBUTES_INFO attributes_info; + [case(PAC_TYPE_REQUESTER_SID)] PAC_REQUESTER_SID requester_sid; + /* + * [subcontext(0)] and DATA_BLOB_REM is used as in + * PAC_TYPE_CLIENT_CLAIMS_INFO + * PAC_TYPE_DEVICE_CLAIMS_INFO as Windows will + * sometimes send an empty buffer (presumably to avoid + * the overhead of the header around the claims) if + * there are no claims to send + */ + [case(PAC_TYPE_CLIENT_CLAIMS_INFO)][subcontext(0)] DATA_BLOB_REM client_claims_info; + [case(PAC_TYPE_DEVICE_INFO)][subcontext(0xFFFFFC01)] PAC_DEVICE_INFO_CTR device_info; + [case(PAC_TYPE_DEVICE_CLAIMS_INFO)][subcontext(0)] DATA_BLOB_REM device_claims_info; + [case(PAC_TYPE_FULL_CHECKSUM)] PAC_SIGNATURE_DATA full_checksum; + /* when new PAC info types are added they are supposed to be done + in such a way that they are backwards compatible with existing + servers. This makes it safe to just use a [default] for + unknown types, which lets us ignore the data */ + [default] [subcontext(0)] DATA_BLOB_REM unknown; + } PAC_INFO; + + typedef [public,nopush,nopull] struct { + PAC_TYPE type; + [value(_ndr_size_PAC_INFO(info, type, LIBNDR_FLAG_ALIGN8))] uint32 _ndr_size; + /* + * We need to have two subcontexts to get the padding right, + * the outer subcontext uses NDR_ROUND(_ndr_size, 8), while + * the inner subcontext only uses _ndr_size. + * + * We do that in non-generated push/pull functions. + */ + [relative,switch_is(type),subcontext(0),subcontext_size(NDR_ROUND(_ndr_size,8)),flag(NDR_ALIGN8)] PAC_INFO *info; + [value(0)] uint32 _pad; /* Top half of a 64 bit pointer? */ + } PAC_BUFFER; + + typedef [public] struct { + uint32 num_buffers; + uint32 version; + PAC_BUFFER buffers[num_buffers]; + } PAC_DATA; + + typedef [public] struct { + PAC_TYPE type; + uint32 ndr_size; + [relative,subcontext(0),subcontext_size(NDR_ROUND(ndr_size,8)),flag(NDR_ALIGN8)] DATA_BLOB_REM *info; + [value(0)] uint32 _pad; /* Top half of a 64 bit pointer? */ + } PAC_BUFFER_RAW; + + typedef [public] struct { + uint32 num_buffers; + uint32 version; + PAC_BUFFER_RAW buffers[num_buffers]; + } PAC_DATA_RAW; + + const int NETLOGON_GENERIC_KRB5_PAC_VALIDATE = 3; + + typedef [public] struct { + [value(NETLOGON_GENERIC_KRB5_PAC_VALIDATE)] uint32 MessageType; + uint32 ChecksumLength; + int32 SignatureType; + uint32 SignatureLength; + [flag(NDR_REMAINING)] DATA_BLOB ChecksumAndSignature; + } PAC_Validate; + + /* used for samba3 netsamlogon cache */ + typedef [public] struct { + time_t timestamp; + netr_SamInfo3 info3; + } netsamlogoncache_entry; +} diff --git a/librpc/idl/lsa.idl b/librpc/idl/lsa.idl new file mode 100644 index 0000000..ede27c9 --- /dev/null +++ b/librpc/idl/lsa.idl @@ -0,0 +1,1669 @@ +#include "idl_types.h" + +/* + lsa interface definition +*/ + +import "misc.idl", "security.idl"; + +[ uuid("12345778-1234-abcd-ef00-0123456789ab"), + version(0.0), + endpoint("ncacn_np:[\\pipe\\lsarpc]","ncacn_np:[\\pipe\\lsass]", "ncacn_ip_tcp:", "ncalrpc:"), + pyhelper("librpc/ndr/py_lsa.c"), + pointer_default(unique), + helpstring("Local Security Authority") +] interface lsarpc +{ + typedef bitmap security_secinfo security_secinfo; + typedef bitmap kerb_EncTypes kerb_EncTypes; + + typedef [public] struct { + [value(2*strlen_m(string))] uint16 length; + [value(2*strlen_m(string))] uint16 size; + [charset(UTF16),size_is(size/2),length_is(length/2)] uint16 *string; + } lsa_String; + + typedef [public] struct { + [value(2*strlen_m(string))] uint16 length; + [value(2*strlen_m_term(string))] uint16 size; + [charset(UTF16),size_is(size/2),length_is(length/2)] uint16 *string; + } lsa_StringLarge; + + typedef [public] struct { + uint32 count; + [size_is(count)] lsa_String *names; + } lsa_Strings; + + typedef [public] struct { + [value(strlen_m(string))] uint16 length; + [value(strlen_m(string))] uint16 size; + [charset(DOS),size_is(size),length_is(length)] uint8 *string; + } lsa_AsciiString; + + typedef [public] struct { + [value(strlen_m(string))] uint16 length; + [value(strlen_m_term(string))] uint16 size; + [charset(DOS),size_is(size),length_is(length)] uint8 *string; + } lsa_AsciiStringLarge; + + typedef [public] struct { + uint16 length; + uint16 size; + [size_is(size/2),length_is(length/2)] uint16 *array; + } lsa_BinaryString; + + /******************/ + /* Function: 0x00 */ + NTSTATUS lsa_Close ( + [in,out] policy_handle *handle + ); + + + /******************/ + /* Function: 0x01 */ + [public] NTSTATUS lsa_Delete ( + [in] policy_handle *handle + ); + + + /******************/ + /* Function: 0x02 */ + typedef struct { + uint32 low; + uint32 high; + } lsa_LUID; + + typedef struct { + lsa_StringLarge name; + lsa_LUID luid; + } lsa_PrivEntry; + + typedef struct { + uint32 count; + [size_is(count)] lsa_PrivEntry *privs; + } lsa_PrivArray; + + [public] NTSTATUS lsa_EnumPrivs ( + [in] policy_handle *handle, + [in,out,ref] uint32 *resume_handle, + [out,ref] lsa_PrivArray *privs, + [in] uint32 max_count + ); + + /******************/ + /* Function: 0x03 */ + NTSTATUS lsa_QuerySecurity ( + [in] policy_handle *handle, + [in] security_secinfo sec_info, + [out,ref] sec_desc_buf **sdbuf + ); + + /******************/ + /* Function: 0x04 */ + NTSTATUS lsa_SetSecObj( + [in] policy_handle *handle, + [in] security_secinfo sec_info, + [in,ref] sec_desc_buf *sdbuf + ); + + /******************/ + /* Function: 0x05 */ + [todo] NTSTATUS lsa_ChangePassword (); + + + /******************/ + /* Function: 0x06 */ + + typedef enum { + LSA_SECURITY_ANONYMOUS = 0, + LSA_SECURITY_IDENTIFICATION = 1, + LSA_SECURITY_IMPERSONATION = 2, + LSA_SECURITY_DELEGATION = 3 + } lsa_SecurityImpersonationLevel; + + typedef struct { + uint3264 len; /* ignored */ + lsa_SecurityImpersonationLevel impersonation_level; + uint8 context_mode; + uint8 effective_only; + } lsa_QosInfo; + + typedef struct { + uint3264 len; /* ignored */ + uint8 *root_dir; + [string,charset(UTF16)] uint16 *object_name; + uint32 attributes; + security_descriptor *sec_desc; + lsa_QosInfo *sec_qos; + } lsa_ObjectAttribute; + + typedef [public,bitmap32bit] bitmap { + LSA_POLICY_VIEW_LOCAL_INFORMATION = 0x00000001, + LSA_POLICY_VIEW_AUDIT_INFORMATION = 0x00000002, + LSA_POLICY_GET_PRIVATE_INFORMATION = 0x00000004, + LSA_POLICY_TRUST_ADMIN = 0x00000008, + LSA_POLICY_CREATE_ACCOUNT = 0x00000010, + LSA_POLICY_CREATE_SECRET = 0x00000020, + LSA_POLICY_CREATE_PRIVILEGE = 0x00000040, + LSA_POLICY_SET_DEFAULT_QUOTA_LIMITS = 0x00000080, + LSA_POLICY_SET_AUDIT_REQUIREMENTS = 0x00000100, + LSA_POLICY_AUDIT_LOG_ADMIN = 0x00000200, + LSA_POLICY_SERVER_ADMIN = 0x00000400, + LSA_POLICY_LOOKUP_NAMES = 0x00000800, + LSA_POLICY_NOTIFICATION = 0x00001000 + } lsa_PolicyAccessMask; + + const int LSA_POLICY_ALL_ACCESS = + (STANDARD_RIGHTS_REQUIRED_ACCESS | + LSA_POLICY_VIEW_LOCAL_INFORMATION | + LSA_POLICY_VIEW_AUDIT_INFORMATION | + LSA_POLICY_GET_PRIVATE_INFORMATION | + LSA_POLICY_TRUST_ADMIN | + LSA_POLICY_CREATE_ACCOUNT | + LSA_POLICY_CREATE_SECRET | + LSA_POLICY_CREATE_PRIVILEGE | + LSA_POLICY_SET_DEFAULT_QUOTA_LIMITS | + LSA_POLICY_SET_AUDIT_REQUIREMENTS | + LSA_POLICY_AUDIT_LOG_ADMIN | + LSA_POLICY_SERVER_ADMIN | + LSA_POLICY_LOOKUP_NAMES | + LSA_POLICY_NOTIFICATION); + + const int LSA_POLICY_READ = + (STANDARD_RIGHTS_READ_ACCESS | + LSA_POLICY_VIEW_LOCAL_INFORMATION | + LSA_POLICY_VIEW_AUDIT_INFORMATION | + LSA_POLICY_GET_PRIVATE_INFORMATION); + + const int LSA_POLICY_WRITE = + (STANDARD_RIGHTS_READ_ACCESS | + LSA_POLICY_TRUST_ADMIN | + LSA_POLICY_CREATE_ACCOUNT | + LSA_POLICY_CREATE_SECRET | + LSA_POLICY_CREATE_PRIVILEGE | + LSA_POLICY_SET_DEFAULT_QUOTA_LIMITS | + LSA_POLICY_SET_AUDIT_REQUIREMENTS | + LSA_POLICY_AUDIT_LOG_ADMIN | + LSA_POLICY_SERVER_ADMIN); + + const int LSA_POLICY_EXECUTE = + (STANDARD_RIGHTS_EXECUTE_ACCESS | + LSA_POLICY_VIEW_LOCAL_INFORMATION | + LSA_POLICY_LOOKUP_NAMES); + + typedef [public,bitmap32bit] bitmap { + LSA_ACCOUNT_VIEW = 0x00000001, + LSA_ACCOUNT_ADJUST_PRIVILEGES = 0x00000002, + LSA_ACCOUNT_ADJUST_QUOTAS = 0x00000004, + LSA_ACCOUNT_ADJUST_SYSTEM_ACCESS = 0x00000008 + } lsa_AccountAccessMask; + + const int LSA_ACCOUNT_ALL_ACCESS = + (STANDARD_RIGHTS_REQUIRED_ACCESS | + LSA_ACCOUNT_VIEW | + LSA_ACCOUNT_ADJUST_PRIVILEGES | + LSA_ACCOUNT_ADJUST_QUOTAS | + LSA_ACCOUNT_ADJUST_SYSTEM_ACCESS); + + const int LSA_ACCOUNT_READ = + (STANDARD_RIGHTS_READ_ACCESS | + LSA_ACCOUNT_VIEW); + + const int LSA_ACCOUNT_WRITE = + (STANDARD_RIGHTS_READ_ACCESS | + LSA_ACCOUNT_ADJUST_PRIVILEGES | + LSA_ACCOUNT_ADJUST_QUOTAS | + LSA_ACCOUNT_ADJUST_SYSTEM_ACCESS); + + const int LSA_ACCOUNT_EXECUTE = + (STANDARD_RIGHTS_EXECUTE_ACCESS); + + typedef [public,bitmap32bit] bitmap { + LSA_SECRET_SET_VALUE = 0x00000001, + LSA_SECRET_QUERY_VALUE = 0x00000002 + } lsa_SecretAccessMask; + + const int LSA_SECRET_ALL_ACCESS = + (LSA_SECRET_QUERY_VALUE | + LSA_SECRET_SET_VALUE | + SEC_STD_DELETE | + STANDARD_RIGHTS_READ_ACCESS | + SEC_STD_WRITE_DAC | + SEC_STD_WRITE_OWNER); /* 0x000F0003 */ + + const int LSA_SECRET_READ = + (LSA_SECRET_QUERY_VALUE | + STANDARD_RIGHTS_READ_ACCESS); /* 0x00020002 */ + + const int LSA_SECRET_WRITE = + (LSA_SECRET_SET_VALUE | + STANDARD_RIGHTS_READ_ACCESS); /* 0x00020001 */ + + const int LSA_SECRET_EXECUTE = + (STANDARD_RIGHTS_READ_ACCESS); /* 0x00020000 */ + + typedef [public,bitmap32bit] bitmap { + LSA_TRUSTED_QUERY_DOMAIN_NAME = 0x00000001, + LSA_TRUSTED_QUERY_CONTROLLERS = 0x00000002, + LSA_TRUSTED_SET_CONTROLLERS = 0x00000004, + LSA_TRUSTED_QUERY_POSIX = 0x00000008, + LSA_TRUSTED_SET_POSIX = 0x00000010, + LSA_TRUSTED_SET_AUTH = 0x00000020, + LSA_TRUSTED_QUERY_AUTH = 0x00000040 + } lsa_TrustedAccessMask; + + const int LSA_TRUSTED_DOMAIN_ALL_ACCESS = + (LSA_TRUSTED_QUERY_DOMAIN_NAME | + LSA_TRUSTED_QUERY_CONTROLLERS | + LSA_TRUSTED_SET_CONTROLLERS | + LSA_TRUSTED_QUERY_POSIX | + LSA_TRUSTED_SET_POSIX | + LSA_TRUSTED_SET_AUTH | + LSA_TRUSTED_QUERY_AUTH | + SEC_STD_DELETE | + STANDARD_RIGHTS_READ_ACCESS | + SEC_STD_WRITE_DAC | + SEC_STD_WRITE_OWNER); /* 0x000F007F */ + + const int LSA_TRUSTED_DOMAIN_READ = + (LSA_TRUSTED_QUERY_DOMAIN_NAME | + STANDARD_RIGHTS_READ_ACCESS); /* 0x00020001 */ + + const int LSA_TRUSTED_DOMAIN_WRITE = + (LSA_TRUSTED_SET_CONTROLLERS | + LSA_TRUSTED_SET_POSIX | + LSA_TRUSTED_SET_AUTH | + STANDARD_RIGHTS_READ_ACCESS); /* 0x00020034 */ + + const int LSA_TRUSTED_DOMAIN_EXECUTE = + (LSA_TRUSTED_QUERY_DOMAIN_NAME | + LSA_TRUSTED_QUERY_POSIX | + STANDARD_RIGHTS_READ_ACCESS); /* 0x0002000C */ + + + /* notice the screwup with the system_name - that's why MS created + OpenPolicy2 */ + [public] NTSTATUS lsa_OpenPolicy ( + [in,unique] uint16 *system_name, + [in] lsa_ObjectAttribute *attr, + [in] lsa_PolicyAccessMask access_mask, + [out] policy_handle *handle + ); + + + + /******************/ + /* Function: 0x07 */ + + typedef struct { + uint32 percent_full; + uint32 maximum_log_size; + hyper retention_time; + uint8 shutdown_in_progress; + hyper time_to_shutdown; + uint32 next_audit_record; + } lsa_AuditLogInfo; + + typedef [v1_enum] enum { + LSA_AUDIT_POLICY_NONE=0, + LSA_AUDIT_POLICY_SUCCESS=1, + LSA_AUDIT_POLICY_FAILURE=2, + LSA_AUDIT_POLICY_ALL=(LSA_AUDIT_POLICY_SUCCESS|LSA_AUDIT_POLICY_FAILURE), + LSA_AUDIT_POLICY_CLEAR=4 + } lsa_PolicyAuditPolicy; + + typedef enum { + LSA_AUDIT_CATEGORY_SYSTEM = 0, + LSA_AUDIT_CATEGORY_LOGON = 1, + LSA_AUDIT_CATEGORY_FILE_AND_OBJECT_ACCESS = 2, + LSA_AUDIT_CATEGORY_USE_OF_USER_RIGHTS = 3, + LSA_AUDIT_CATEGORY_PROCCESS_TRACKING = 4, + LSA_AUDIT_CATEGORY_SECURITY_POLICY_CHANGES = 5, + LSA_AUDIT_CATEGORY_ACCOUNT_MANAGEMENT = 6, + LSA_AUDIT_CATEGORY_DIRECTORY_SERVICE_ACCESS = 7, /* only in win2k/2k3 */ + LSA_AUDIT_CATEGORY_ACCOUNT_LOGON = 8 /* only in win2k/2k3 */ + } lsa_PolicyAuditEventType; + + typedef struct { + uint32 auditing_mode; + [size_is(count)] lsa_PolicyAuditPolicy *settings; + uint32 count; + } lsa_AuditEventsInfo; + + typedef struct { + lsa_StringLarge name; + dom_sid2 *sid; + } lsa_DomainInfo; + + typedef struct { + lsa_String name; + } lsa_PDAccountInfo; + + typedef [v1_enum] enum { + LSA_ROLE_BACKUP=2, + LSA_ROLE_PRIMARY=3 + } lsa_Role; + + typedef struct { + lsa_Role role; + } lsa_ServerRole; + + typedef struct { + lsa_String source; + lsa_String account; + } lsa_ReplicaSourceInfo; + + typedef struct { + uint32 paged_pool; + uint32 non_paged_pool; + uint32 min_wss; + uint32 max_wss; + uint32 pagefile; + hyper unknown; + } lsa_DefaultQuotaInfo; + + typedef struct { + hyper modified_id; + NTTIME_hyper db_create_time; + } lsa_ModificationInfo; + + typedef struct { + uint8 shutdown_on_full; + } lsa_AuditFullSetInfo; + + typedef struct { + uint8 shutdown_on_full; + uint8 log_is_full; + } lsa_AuditFullQueryInfo; + + typedef [public] struct { + /* it's important that we use the lsa_StringLarge here, + * because otherwise windows clients result with such dns hostnames + * e.g. w2k3-client.samba4.samba.orgsamba4.samba.org + * where it should be + * w2k3-client.samba4.samba.org + */ + lsa_StringLarge name; + lsa_StringLarge dns_domain; + lsa_StringLarge dns_forest; + GUID domain_guid; + dom_sid2 *sid; + } lsa_DnsDomainInfo; + + typedef enum { + LSA_POLICY_INFO_AUDIT_LOG=1, + LSA_POLICY_INFO_AUDIT_EVENTS=2, + LSA_POLICY_INFO_DOMAIN=3, + LSA_POLICY_INFO_PD=4, + LSA_POLICY_INFO_ACCOUNT_DOMAIN=5, + LSA_POLICY_INFO_ROLE=6, + LSA_POLICY_INFO_REPLICA=7, + LSA_POLICY_INFO_QUOTA=8, + LSA_POLICY_INFO_MOD=9, + LSA_POLICY_INFO_AUDIT_FULL_SET=10, + LSA_POLICY_INFO_AUDIT_FULL_QUERY=11, + LSA_POLICY_INFO_DNS=12, + LSA_POLICY_INFO_DNS_INT=13, + LSA_POLICY_INFO_L_ACCOUNT_DOMAIN=14 + } lsa_PolicyInfo; + + typedef [switch_type(uint16)] union { + [case(LSA_POLICY_INFO_AUDIT_LOG)] lsa_AuditLogInfo audit_log; + [case(LSA_POLICY_INFO_AUDIT_EVENTS)] lsa_AuditEventsInfo audit_events; + [case(LSA_POLICY_INFO_DOMAIN)] lsa_DomainInfo domain; + [case(LSA_POLICY_INFO_PD)] lsa_PDAccountInfo pd; + [case(LSA_POLICY_INFO_ACCOUNT_DOMAIN)] lsa_DomainInfo account_domain; + [case(LSA_POLICY_INFO_ROLE)] lsa_ServerRole role; + [case(LSA_POLICY_INFO_REPLICA)] lsa_ReplicaSourceInfo replica; + [case(LSA_POLICY_INFO_QUOTA)] lsa_DefaultQuotaInfo quota; + [case(LSA_POLICY_INFO_MOD)] lsa_ModificationInfo mod; + [case(LSA_POLICY_INFO_AUDIT_FULL_SET)] lsa_AuditFullSetInfo auditfullset; + [case(LSA_POLICY_INFO_AUDIT_FULL_QUERY)] lsa_AuditFullQueryInfo auditfullquery; + [case(LSA_POLICY_INFO_DNS)] lsa_DnsDomainInfo dns; + [case(LSA_POLICY_INFO_DNS_INT)] lsa_DnsDomainInfo dns_int; + [case(LSA_POLICY_INFO_L_ACCOUNT_DOMAIN)] lsa_DomainInfo l_account_domain; + } lsa_PolicyInformation; + + NTSTATUS lsa_QueryInfoPolicy( + [in] policy_handle *handle, + [in] lsa_PolicyInfo level, + [out,ref,switch_is(level)] lsa_PolicyInformation **info + ); + + /******************/ + /* Function: 0x08 */ + NTSTATUS lsa_SetInfoPolicy ( + [in] policy_handle *handle, + [in] lsa_PolicyInfo level, + [in,switch_is(level)] lsa_PolicyInformation *info + ); + + /******************/ + /* Function: 0x09 */ + [todo] NTSTATUS lsa_ClearAuditLog (); + + /******************/ + /* Function: 0x0a */ + [public] NTSTATUS lsa_CreateAccount ( + [in] policy_handle *handle, + [in,ref] dom_sid2 *sid, + [in] lsa_AccountAccessMask access_mask, + [out] policy_handle *acct_handle + ); + + /******************/ + /* NOTE: This only returns accounts that have at least + one privilege set + */ + /* Function: 0x0b */ + typedef struct { + dom_sid2 *sid; + } lsa_SidPtr; + + typedef [public] struct { + [range(0,20480)] uint32 num_sids; + [size_is(num_sids)] lsa_SidPtr *sids; + } lsa_SidArray; + + [public] NTSTATUS lsa_EnumAccounts( + [in] policy_handle *handle, + [in,out,ref] uint32 *resume_handle, + [out,ref] lsa_SidArray *sids, + [in,range(0,8192)] uint32 num_entries + ); + + /*************************************************/ + /* Function: 0x0c */ + + [public] NTSTATUS lsa_CreateTrustedDomain( + [in] policy_handle *policy_handle, + [in] lsa_DomainInfo *info, + [in] lsa_TrustedAccessMask access_mask, + [out] policy_handle *trustdom_handle + ); + + + /******************/ + /* Function: 0x0d */ + + /* w2k3 treats max_size as max_domains*60 */ + const int LSA_ENUM_TRUST_DOMAIN_MULTIPLIER = 60; + + typedef struct { + uint32 count; + [size_is(count)] lsa_DomainInfo *domains; + } lsa_DomainList; + + NTSTATUS lsa_EnumTrustDom( + [in] policy_handle *handle, + [in,out,ref] uint32 *resume_handle, + [out,ref] lsa_DomainList *domains, + [in] uint32 max_size + ); + + + /******************/ + /* Function: 0x0e */ + typedef [public] enum { + SID_NAME_USE_NONE = 0,/* NOTUSED */ + SID_NAME_USER = 1, /* user */ + SID_NAME_DOM_GRP = 2, /* domain group */ + SID_NAME_DOMAIN = 3, /* domain: don't know what this is */ + SID_NAME_ALIAS = 4, /* local group */ + SID_NAME_WKN_GRP = 5, /* well-known group */ + SID_NAME_DELETED = 6, /* deleted account: needed for c2 rating */ + SID_NAME_INVALID = 7, /* invalid account */ + SID_NAME_UNKNOWN = 8, /* oops. */ + SID_NAME_COMPUTER = 9, /* machine */ + SID_NAME_LABEL = 10 /* Mandatory Label */ + } lsa_SidType; + + typedef struct { + lsa_SidType sid_type; + uint32 rid; + uint32 sid_index; + } lsa_TranslatedSid; + + typedef struct { + [range(0,1000)] uint32 count; + [size_is(count)] lsa_TranslatedSid *sids; + } lsa_TransSidArray; + + const int LSA_REF_DOMAIN_LIST_MULTIPLIER = 32; + typedef [public] struct { + [range(0,1000)] uint32 count; + [size_is(count)] lsa_DomainInfo *domains; + uint32 max_size; + } lsa_RefDomainList; + + /* Level 1: Ask everywhere + * Level 2: Ask domain and trusted domains, no builtin and wkn + * Level 3: Only ask domain + * Level 4: W2k3ad: Only ask AD trusts + * Level 5: Only ask transitive forest trusts + * Level 6: Like 4 + */ + + typedef [public] enum { + LSA_LOOKUP_NAMES_ALL = 1, + LSA_LOOKUP_NAMES_DOMAINS_ONLY = 2, + LSA_LOOKUP_NAMES_PRIMARY_DOMAIN_ONLY = 3, + LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY = 4, + LSA_LOOKUP_NAMES_FOREST_TRUSTS_ONLY = 5, + LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2 = 6, + LSA_LOOKUP_NAMES_RODC_REFERRAL_TO_FULL_DC = 7 + } lsa_LookupNamesLevel; + + [public] NTSTATUS lsa_LookupNames ( + [in] policy_handle *handle, + [in,range(0,1000)] uint32 num_names, + [in,size_is(num_names)] lsa_String names[], + [out,ref] lsa_RefDomainList **domains, + [in,out,ref] lsa_TransSidArray *sids, + [in] lsa_LookupNamesLevel level, + [in,out,ref] uint32 *count + ); + + + /******************/ + /* Function: 0x0f */ + + typedef struct { + lsa_SidType sid_type; + lsa_String name; + uint32 sid_index; + } lsa_TranslatedName; + + typedef [public] struct { + [range(0,20480)] uint32 count; + [size_is(count)] lsa_TranslatedName *names; + } lsa_TransNameArray; + + [public] NTSTATUS lsa_LookupSids( + [in] policy_handle *handle, + [in,ref] lsa_SidArray *sids, + [out,ref] lsa_RefDomainList **domains, + [in,out,ref] lsa_TransNameArray *names, + [in] lsa_LookupNamesLevel level, + [in,out,ref] uint32 *count + ); + + + /* Function: 0x10 */ + [public] NTSTATUS lsa_CreateSecret( + [in] policy_handle *handle, + [in] lsa_String name, + [in] lsa_SecretAccessMask access_mask, + [out] policy_handle *sec_handle + ); + + + /*****************************************/ + /* Function: 0x11 */ + NTSTATUS lsa_OpenAccount( + [in] policy_handle *handle, + [in,ref] dom_sid2 *sid, + [in] lsa_AccountAccessMask access_mask, + [out] policy_handle *acct_handle + ); + + + /****************************************/ + /* Function: 0x12 */ + + typedef struct { + lsa_LUID luid; + uint32 attribute; + } lsa_LUIDAttribute; + + typedef struct { + [range(0,1000)] uint32 count; + uint32 unknown; + [size_is(count)] lsa_LUIDAttribute set[*]; + } lsa_PrivilegeSet; + + NTSTATUS lsa_EnumPrivsAccount( + [in] policy_handle *handle, + [out,ref] lsa_PrivilegeSet **privs + ); + + + /****************************************/ + /* Function: 0x13 */ + NTSTATUS lsa_AddPrivilegesToAccount( + [in] policy_handle *handle, + [in,ref] lsa_PrivilegeSet *privs + ); + + + /****************************************/ + /* Function: 0x14 */ + NTSTATUS lsa_RemovePrivilegesFromAccount( + [in] policy_handle *handle, + [in] uint8 remove_all, + [in,unique] lsa_PrivilegeSet *privs + ); + + /* Function: 0x15 */ + [todo] NTSTATUS lsa_GetQuotasForAccount(); + + /* Function: 0x16 */ + [todo] NTSTATUS lsa_SetQuotasForAccount(); + + /* Function: 0x17 */ + NTSTATUS lsa_GetSystemAccessAccount( + [in] policy_handle *handle, + [out,ref] lsa_AccountAccessMask *access_mask + ); + + /* Function: 0x18 */ + NTSTATUS lsa_SetSystemAccessAccount( + [in] policy_handle *handle, + [in] lsa_AccountAccessMask access_mask + ); + + /* Function: 0x19 */ + NTSTATUS lsa_OpenTrustedDomain( + [in] policy_handle *handle, + [in] dom_sid2 *sid, + [in] lsa_TrustedAccessMask access_mask, + [out] policy_handle *trustdom_handle + ); + + typedef [flag(NDR_PAHEX)] struct { + uint3264 length; + uint3264 size; + [size_is(size),length_is(length)] uint8 *data; + } lsa_DATA_BUF; + + typedef [flag(NDR_PAHEX)] struct { + [range(0,65536)] uint32 size; + [size_is(size)] uint8 *data; + } lsa_DATA_BUF2; + + typedef enum { + LSA_TRUSTED_DOMAIN_INFO_NAME = 1, + LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS = 2, + LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET = 3, + LSA_TRUSTED_DOMAIN_INFO_PASSWORD = 4, + LSA_TRUSTED_DOMAIN_INFO_BASIC = 5, + LSA_TRUSTED_DOMAIN_INFO_INFO_EX = 6, + LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO = 7, + LSA_TRUSTED_DOMAIN_INFO_FULL_INFO = 8, + LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL = 9, + LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL = 10, + LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL = 11, + LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL = 12, + LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRYPTION_TYPES = 13, + LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL_AES= 14, + LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL_AES= 15 + } lsa_TrustDomInfoEnum; + + typedef [public,bitmap32bit] bitmap { + LSA_TRUST_DIRECTION_INBOUND = 0x00000001, + LSA_TRUST_DIRECTION_OUTBOUND = 0x00000002 + } lsa_TrustDirection; + + typedef [public,v1_enum] enum { + LSA_TRUST_TYPE_DOWNLEVEL = 0x00000001, + LSA_TRUST_TYPE_UPLEVEL = 0x00000002, + LSA_TRUST_TYPE_MIT = 0x00000003, + LSA_TRUST_TYPE_DCE = 0x00000004 + } lsa_TrustType; + + typedef [public,bitmap32bit] bitmap { + LSA_TRUST_ATTRIBUTE_NON_TRANSITIVE = 0x00000001, + LSA_TRUST_ATTRIBUTE_UPLEVEL_ONLY = 0x00000002, + LSA_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN = 0x00000004, + LSA_TRUST_ATTRIBUTE_FOREST_TRANSITIVE = 0x00000008, + LSA_TRUST_ATTRIBUTE_CROSS_ORGANIZATION = 0x00000010, + LSA_TRUST_ATTRIBUTE_WITHIN_FOREST = 0x00000020, + LSA_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL = 0x00000040, + LSA_TRUST_ATTRIBUTE_USES_RC4_ENCRYPTION = 0x00000080, + LSA_TRUST_ATTRIBUTE_CROSS_ORGANIZATION_NO_TGT_DELEGATION = 0x00000200, + LSA_TRUST_ATTRIBUTE_PIM_TRUST = 0x00000400, + LSA_TRUST_ATTRIBUTE_CROSS_ORGANIZATION_ENABLE_TGT_DELEGATION = 0x00000800 + } lsa_TrustAttributes; + + typedef struct { + lsa_StringLarge netbios_name; + } lsa_TrustDomainInfoName; + + + typedef struct { + uint32 entries; + [size_is(entries)] lsa_StringLarge *netbios_names; + } lsa_TrustDomainInfoControllers; + + typedef struct { + uint32 posix_offset; + } lsa_TrustDomainInfoPosixOffset; + + typedef struct { + lsa_DATA_BUF *password; + lsa_DATA_BUF *old_password; + } lsa_TrustDomainInfoPassword; + + typedef struct { + lsa_String netbios_name; + dom_sid2 *sid; + } lsa_TrustDomainInfoBasic; + + typedef [public] struct { + lsa_StringLarge domain_name; + lsa_StringLarge netbios_name; + dom_sid2 *sid; + lsa_TrustDirection trust_direction; + lsa_TrustType trust_type; + lsa_TrustAttributes trust_attributes; + } lsa_TrustDomainInfoInfoEx; + + typedef [public,v1_enum] enum { + TRUST_AUTH_TYPE_NONE = 0, + TRUST_AUTH_TYPE_NT4OWF = 1, + TRUST_AUTH_TYPE_CLEAR = 2, + TRUST_AUTH_TYPE_VERSION = 3 + } lsa_TrustAuthType; + + typedef struct { + NTTIME_hyper last_update_time; + lsa_TrustAuthType AuthType; + lsa_DATA_BUF2 data; + } lsa_TrustDomainInfoBuffer; + + typedef [public] struct { + uint32 incoming_count; + lsa_TrustDomainInfoBuffer *incoming_current_auth_info; + lsa_TrustDomainInfoBuffer *incoming_previous_auth_info; + uint32 outgoing_count; + lsa_TrustDomainInfoBuffer *outgoing_current_auth_info; + lsa_TrustDomainInfoBuffer *outgoing_previous_auth_info; + } lsa_TrustDomainInfoAuthInfo; + + typedef struct { + lsa_TrustDomainInfoInfoEx info_ex; + lsa_TrustDomainInfoPosixOffset posix_offset; + lsa_TrustDomainInfoAuthInfo auth_info; + } lsa_TrustDomainInfoFullInfo; + + typedef struct { + lsa_DATA_BUF2 auth_blob; + } lsa_TrustDomainInfoAuthInfoInternal; + + typedef struct { + lsa_TrustDomainInfoInfoEx info_ex; + lsa_TrustDomainInfoPosixOffset posix_offset; + lsa_TrustDomainInfoAuthInfoInternal auth_info; + } lsa_TrustDomainInfoFullInfoInternal; + + typedef struct { + uint8 auth_data[64]; + uint8 salt[16]; + lsa_DATA_BUF2 cipher; + } lsa_TrustDomainInfoAuthInfoInternalAES; + + typedef struct { + lsa_TrustDomainInfoInfoEx info_ex; + lsa_TrustDomainInfoPosixOffset posix_offset; + lsa_TrustDomainInfoAuthInfoInternalAES auth_info; + } lsa_TrustDomainInfoFullInfoInternalAES; + + typedef struct { + lsa_TrustDomainInfoInfoEx info_ex; + uint32 forest_trust_length; + [size_is(forest_trust_length)] uint8 *forest_trust_data; + } lsa_TrustDomainInfoInfoEx2Internal; + + typedef struct { + lsa_TrustDomainInfoInfoEx2Internal info; + lsa_TrustDomainInfoPosixOffset posix_offset; + lsa_TrustDomainInfoAuthInfo auth_info; + } lsa_TrustDomainInfoFullInfo2Internal; + + typedef struct { + kerb_EncTypes enc_types; + } lsa_TrustDomainInfoSupportedEncTypes; + + typedef [switch_type(lsa_TrustDomInfoEnum)] union { + [case(LSA_TRUSTED_DOMAIN_INFO_NAME)] + lsa_TrustDomainInfoName name; + [case(LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS)] + lsa_TrustDomainInfoControllers controllers; + [case(LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET)] + lsa_TrustDomainInfoPosixOffset posix_offset; + [case(LSA_TRUSTED_DOMAIN_INFO_PASSWORD)] + lsa_TrustDomainInfoPassword password; + [case(LSA_TRUSTED_DOMAIN_INFO_BASIC)] + lsa_TrustDomainInfoBasic info_basic; + [case(LSA_TRUSTED_DOMAIN_INFO_INFO_EX)] + lsa_TrustDomainInfoInfoEx info_ex; + [case(LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO)] + lsa_TrustDomainInfoAuthInfo auth_info; + [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO)] + lsa_TrustDomainInfoFullInfo full_info; + [case(LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL)] + lsa_TrustDomainInfoAuthInfoInternal auth_info_internal; + [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL)] + lsa_TrustDomainInfoFullInfoInternal full_info_internal; + [case(LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL)] + lsa_TrustDomainInfoInfoEx2Internal info_ex2_internal; + [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL)] + lsa_TrustDomainInfoFullInfo2Internal full_info2_internal; + [case(LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRYPTION_TYPES)] + lsa_TrustDomainInfoSupportedEncTypes enc_types; + [case(LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL_AES)] + lsa_TrustDomainInfoAuthInfoInternalAES auth_info_internal_aes; + [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL_AES)] + lsa_TrustDomainInfoFullInfoInternalAES full_info_internal_aes; + } lsa_TrustedDomainInfo; + + /* Function: 0x1a */ + NTSTATUS lsa_QueryTrustedDomainInfo( + [in] policy_handle *trustdom_handle, + [in] lsa_TrustDomInfoEnum level, + [out,switch_is(level),ref] lsa_TrustedDomainInfo **info + ); + + /* Function: 0x1b */ + NTSTATUS lsa_SetInformationTrustedDomain( + [in] policy_handle *trustdom_handle, + [in] lsa_TrustDomInfoEnum level, + [in,switch_is(level)] lsa_TrustedDomainInfo *info + ); + + /* Function: 0x1c */ + [public] NTSTATUS lsa_OpenSecret( + [in] policy_handle *handle, + [in] lsa_String name, + [in] lsa_SecretAccessMask access_mask, + [out] policy_handle *sec_handle + ); + + /* Function: 0x1d */ + + [public] NTSTATUS lsa_SetSecret( + [in] policy_handle *sec_handle, + [in,unique] lsa_DATA_BUF *new_val, + [in,unique] lsa_DATA_BUF *old_val + ); + + typedef struct { + lsa_DATA_BUF *buf; + } lsa_DATA_BUF_PTR; + + /* Function: 0x1e */ + [public] NTSTATUS lsa_QuerySecret ( + [in] policy_handle *sec_handle, + [in,out,unique] lsa_DATA_BUF_PTR *new_val, + [in,out,unique] NTTIME_hyper *new_mtime, + [in,out,unique] lsa_DATA_BUF_PTR *old_val, + [in,out,unique] NTTIME_hyper *old_mtime + ); + + /* Function: 0x1f */ + NTSTATUS lsa_LookupPrivValue( + [in] policy_handle *handle, + [in,ref] lsa_String *name, + [out,ref] lsa_LUID *luid + ); + + + /* Function: 0x20 */ + NTSTATUS lsa_LookupPrivName( + [in] policy_handle *handle, + [in,ref] lsa_LUID *luid, + [out,ref] lsa_StringLarge **name + ); + + + /*******************/ + /* Function: 0x21 */ + NTSTATUS lsa_LookupPrivDisplayName( + [in] policy_handle *handle, + [in,ref] lsa_String *name, + [in] uint16 language_id, + [in] uint16 language_id_sys, + [out,ref] lsa_StringLarge **disp_name, + /* see http://www.microsoft.com/globaldev/nlsweb/ for + language definitions */ + [out,ref] uint16 *returned_language_id + ); + + /*******************/ + /* Function: 0x22 */ + NTSTATUS lsa_DeleteObject ( + [in,out] policy_handle *handle + ); + + /*******************/ + /* Function: 0x23 */ + NTSTATUS lsa_EnumAccountsWithUserRight ( + [in] policy_handle *handle, + [in,unique] lsa_String *name, + [out] lsa_SidArray *sids + ); + + /* Function: 0x24 */ + typedef struct { + [string,charset(UTF16)] uint16 *name; + } lsa_RightAttribute; + + typedef struct { + [range(0,256)] uint32 count; + [size_is(count)] lsa_StringLarge *names; + } lsa_RightSet; + + NTSTATUS lsa_EnumAccountRights ( + [in] policy_handle *handle, + [in,ref] dom_sid2 *sid, + [out,ref] lsa_RightSet *rights + ); + + + /**********************/ + /* Function: 0x25 */ + NTSTATUS lsa_AddAccountRights ( + [in] policy_handle *handle, + [in,ref] dom_sid2 *sid, + [in,ref] lsa_RightSet *rights + ); + + /**********************/ + /* Function: 0x26 */ + NTSTATUS lsa_RemoveAccountRights ( + [in] policy_handle *handle, + [in,ref] dom_sid2 *sid, + [in] uint8 remove_all, + [in,ref] lsa_RightSet *rights + ); + + /* Function: 0x27 */ + NTSTATUS lsa_QueryTrustedDomainInfoBySid( + [in] policy_handle *handle, + [in,ref] dom_sid2 *dom_sid, + [in] lsa_TrustDomInfoEnum level, + [out,switch_is(level),ref] lsa_TrustedDomainInfo **info + ); + + /* Function: 0x28 */ + NTSTATUS lsa_SetTrustedDomainInfo( + [in] policy_handle *handle, + [in] dom_sid2 *dom_sid, + [in] lsa_TrustDomInfoEnum level, + [in,switch_is(level)] lsa_TrustedDomainInfo *info + ); + + /* Function: 0x29 */ + NTSTATUS lsa_DeleteTrustedDomain( + [in] policy_handle *handle, + [in] dom_sid2 *dom_sid + ); + + /* Function: 0x2a */ + NTSTATUS lsa_StorePrivateData( + [in] policy_handle *handle, + [in,ref] lsa_String *name, + [in,unique] lsa_DATA_BUF *val + ); + + /* Function: 0x2b */ + NTSTATUS lsa_RetrievePrivateData( + [in] policy_handle *handle, + [in,ref] lsa_String *name, + [in,out,ref] lsa_DATA_BUF **val + ); + + /**********************/ + /* Function: 0x2c */ + [public] NTSTATUS lsa_OpenPolicy2 ( + [in,unique] [string,charset(UTF16)] uint16 *system_name, + [in] lsa_ObjectAttribute *attr, + [in] lsa_PolicyAccessMask access_mask, + [out] policy_handle *handle + ); + + /**********************/ + /* Function: 0x2d */ + NTSTATUS lsa_GetUserName( + [in,unique] [string,charset(UTF16)] uint16 *system_name, + [in,out,ref] lsa_String **account_name, + [in,out,unique] lsa_String **authority_name + ); + + /**********************/ + /* Function: 0x2e */ + + NTSTATUS lsa_QueryInfoPolicy2( + [in] policy_handle *handle, + [in] lsa_PolicyInfo level, + [out,ref,switch_is(level)] lsa_PolicyInformation **info + ); + + /* Function 0x2f */ + NTSTATUS lsa_SetInfoPolicy2( + [in] policy_handle *handle, + [in] lsa_PolicyInfo level, + [in,switch_is(level)] lsa_PolicyInformation *info + ); + + /**********************/ + /* Function 0x30 */ + NTSTATUS lsa_QueryTrustedDomainInfoByName( + [in] policy_handle *handle, + [in,ref] lsa_String *trusted_domain, + [in] lsa_TrustDomInfoEnum level, + [out,ref,switch_is(level)] lsa_TrustedDomainInfo **info + ); + + /**********************/ + /* Function 0x31 */ + [public] NTSTATUS lsa_SetTrustedDomainInfoByName( + [in] policy_handle *handle, + [in,ref] lsa_String *trusted_domain, + [in] lsa_TrustDomInfoEnum level, + [in,ref,switch_is(level)] lsa_TrustedDomainInfo *info + ); + + /* Function 0x32 */ + + /* w2k3 treats max_size as max_domains*82 */ + const int LSA_ENUM_TRUST_DOMAIN_EX_MULTIPLIER = 82; + + typedef struct { + uint32 count; + [size_is(count)] lsa_TrustDomainInfoInfoEx *domains; + } lsa_DomainListEx; + + NTSTATUS lsa_EnumTrustedDomainsEx ( + [in] policy_handle *handle, + [in,out] uint32 *resume_handle, + [out] lsa_DomainListEx *domains, + [in] uint32 max_size + ); + + /* Function 0x33 */ + NTSTATUS lsa_CreateTrustedDomainEx( + [in] policy_handle *policy_handle, + [in] lsa_TrustDomainInfoInfoEx *info, + [in] lsa_TrustDomainInfoAuthInfo *auth_info, + [in] lsa_TrustedAccessMask access_mask, + [out] policy_handle *trustdom_handle + ); + + + /* Function 0x34 */ + NTSTATUS lsa_CloseTrustedDomainEx( + [in,out] policy_handle *handle + ); + + /* Function 0x35 */ + typedef struct { + uint32 quality_of_service; + } lsa_DomainInfoQoS; + + typedef [bitmap32bit] bitmap { + LSA_POLICY_KERBEROS_VALIDATE_CLIENT = 0x00000080 + } lsa_krbAuthenticationOptions; + + /* w2k3 returns either 0x000bbbd000000000 or 0x000a48e800000000 + for reserved - gd */ + typedef struct { + lsa_krbAuthenticationOptions authentication_options; + hyper service_tkt_lifetime; + hyper user_tkt_lifetime; + hyper user_tkt_renewaltime; + hyper clock_skew; + hyper reserved; + } lsa_DomainInfoKerberos; + + typedef struct { + uint32 blob_size; + [size_is(blob_size)] uint8 *efs_blob; + } lsa_DomainInfoEfs; + + typedef enum { + LSA_DOMAIN_INFO_POLICY_QOS=1, + LSA_DOMAIN_INFO_POLICY_EFS=2, + LSA_DOMAIN_INFO_POLICY_KERBEROS=3 + } lsa_DomainInfoEnum; + + typedef [switch_type(lsa_DomainInfoEnum)] union { + [case(LSA_DOMAIN_INFO_POLICY_QOS)] lsa_DomainInfoQoS qos_info; + [case(LSA_DOMAIN_INFO_POLICY_EFS)] lsa_DomainInfoEfs efs_info; + [case(LSA_DOMAIN_INFO_POLICY_KERBEROS)] lsa_DomainInfoKerberos kerberos_info; + } lsa_DomainInformationPolicy; + + NTSTATUS lsa_QueryDomainInformationPolicy( + [in] policy_handle *handle, + [in] lsa_DomainInfoEnum level, + [out,ref,switch_is(level)] lsa_DomainInformationPolicy **info + ); + + /* Function 0x36 */ + NTSTATUS lsa_SetDomainInformationPolicy( + [in] policy_handle *handle, + [in] lsa_DomainInfoEnum level, + [in,unique,switch_is(level)] lsa_DomainInformationPolicy *info + ); + + /**********************/ + /* Function 0x37 */ + NTSTATUS lsa_OpenTrustedDomainByName( + [in] policy_handle *handle, + [in] lsa_String name, + [in] lsa_TrustedAccessMask access_mask, + [out] policy_handle *trustdom_handle + ); + + /* Function 0x38 */ + [todo] NTSTATUS lsa_TestCall(); + + /**********************/ + /* Function 0x39 */ + + typedef struct { + lsa_SidType sid_type; + lsa_String name; + uint32 sid_index; + uint32 unknown; + } lsa_TranslatedName2; + + typedef struct { + [range(0,1000)] uint32 count; + [size_is(count)] lsa_TranslatedName2 *names; + } lsa_TransNameArray2; + + typedef [v1_enum] enum { + LSA_LOOKUP_OPTION_SEARCH_ISOLATED_NAMES = 0x00000000, + LSA_LOOKUP_OPTION_SEARCH_ISOLATED_NAMES_LOCAL = 0x80000000 + } lsa_LookupOptions; + + typedef [v1_enum] enum { + LSA_CLIENT_REVISION_1 = 0x00000001, + LSA_CLIENT_REVISION_2 = 0x00000002 + } lsa_ClientRevision; + + [public] NTSTATUS lsa_LookupSids2( + [in] policy_handle *handle, + [in,ref] lsa_SidArray *sids, + [out,ref] lsa_RefDomainList **domains, + [in,out,ref] lsa_TransNameArray2 *names, + [in] lsa_LookupNamesLevel level, + [in,out,ref] uint32 *count, + [in] lsa_LookupOptions lookup_options, + [in] lsa_ClientRevision client_revision + ); + + /**********************/ + /* Function 0x3a */ + + typedef struct { + lsa_SidType sid_type; + uint32 rid; + uint32 sid_index; + uint32 unknown; + } lsa_TranslatedSid2; + + typedef struct { + [range(0,1000)] uint32 count; + [size_is(count)] lsa_TranslatedSid2 *sids; + } lsa_TransSidArray2; + + [public] NTSTATUS lsa_LookupNames2 ( + [in] policy_handle *handle, + [in,range(0,1000)] uint32 num_names, + [in,size_is(num_names)] lsa_String names[], + [out,ref] lsa_RefDomainList **domains, + [in,out,ref] lsa_TransSidArray2 *sids, + [in] lsa_LookupNamesLevel level, + [in,out,ref] uint32 *count, + [in] lsa_LookupOptions lookup_options, + [in] lsa_ClientRevision client_revision + ); + + /* Function 0x3b */ + NTSTATUS lsa_CreateTrustedDomainEx2( + [in] policy_handle *policy_handle, + [in] lsa_TrustDomainInfoInfoEx *info, + [in] lsa_TrustDomainInfoAuthInfoInternal *auth_info_internal, + [in] lsa_TrustedAccessMask access_mask, + [out] policy_handle *trustdom_handle + ); + + /* Function 0x3c */ + [todo] NTSTATUS lsa_CREDRWRITE(); + + /* Function 0x3d */ + [todo] NTSTATUS lsa_CREDRREAD(); + + /* Function 0x3e */ + [todo] NTSTATUS lsa_CREDRENUMERATE(); + + /* Function 0x3f */ + [todo] NTSTATUS lsa_CREDRWRITEDOMAINCREDENTIALS(); + + /* Function 0x40 */ + [todo] NTSTATUS lsa_CREDRREADDOMAINCREDENTIALS(); + + /* Function 0x41 */ + [todo] NTSTATUS lsa_CREDRDELETE(); + + /* Function 0x42 */ + [todo] NTSTATUS lsa_CREDRGETTARGETINFO(); + + /* Function 0x43 */ + [todo] NTSTATUS lsa_CREDRPROFILELOADED(); + + /**********************/ + /* Function 0x44 */ + typedef struct { + lsa_SidType sid_type; + dom_sid2 *sid; + uint32 sid_index; + uint32 flags; + } lsa_TranslatedSid3; + + typedef struct { + [range(0,1000)] uint32 count; + [size_is(count)] lsa_TranslatedSid3 *sids; + } lsa_TransSidArray3; + + [public] NTSTATUS lsa_LookupNames3 ( + [in] policy_handle *handle, + [in,range(0,1000)] uint32 num_names, + [in,size_is(num_names)] lsa_String names[], + [out,ref] lsa_RefDomainList **domains, + [in,out,ref] lsa_TransSidArray3 *sids, + [in] lsa_LookupNamesLevel level, + [in,out,ref] uint32 *count, + [in] lsa_LookupOptions lookup_options, + [in] lsa_ClientRevision client_revision + ); + + /* Function 0x45 */ + [todo] NTSTATUS lsa_CREDRGETSESSIONTYPES(); + + /* Function 0x46 */ + [todo] NTSTATUS lsa_LSARREGISTERAUDITEVENT(); + + /* Function 0x47 */ + [todo] NTSTATUS lsa_LSARGENAUDITEVENT(); + + /* Function 0x48 */ + [todo] NTSTATUS lsa_LSARUNREGISTERAUDITEVENT(); + + /* Function 0x49 */ + typedef [bitmap32bit,public] bitmap { + /* these apply to LSA_FOREST_TRUST_TOP_LEVEL_NAME */ + LSA_TLN_DISABLED_NEW = 0x00000001, + LSA_TLN_DISABLED_ADMIN = 0x00000002, + LSA_TLN_DISABLED_CONFLICT = 0x00000004, + + /* these apply to LSA_FOREST_TRUST_DOMAIN_INFO */ + LSA_SID_DISABLED_ADMIN = 0x00000001, + LSA_SID_DISABLED_CONFLICT = 0x00000002, + LSA_NB_DISABLED_ADMIN = 0x00000004, + LSA_NB_DISABLED_CONFLICT = 0x00000008 + } lsa_ForestTrustRecordFlags; + + const uint32 LSA_TLN_DISABLED_MASK = ( + LSA_TLN_DISABLED_NEW | + LSA_TLN_DISABLED_ADMIN | + LSA_TLN_DISABLED_CONFLICT); + const uint32 LSA_SID_DISABLED_MASK = ( + LSA_SID_DISABLED_ADMIN | + LSA_SID_DISABLED_CONFLICT); + const uint32 LSA_NB_DISABLED_MASK = ( + LSA_NB_DISABLED_ADMIN | + LSA_NB_DISABLED_CONFLICT); + + typedef enum { + LSA_FOREST_TRUST_TOP_LEVEL_NAME = 0, + LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX = 1, + LSA_FOREST_TRUST_DOMAIN_INFO = 2, + LSA_FOREST_TRUST_BINARY_DATA = 3, + LSA_FOREST_TRUST_SCANNER_INFO = 4 + } lsa_ForestTrustRecordType; + const uint32 LSA_FOREST_TRUST_RECORD_TYPE_LAST = + LSA_FOREST_TRUST_BINARY_DATA; + const uint32 LSA_FOREST_TRUST_RECORD2_TYPE_LAST = + LSA_FOREST_TRUST_SCANNER_INFO; + + typedef struct { + [range(0,131072)] uint3264 length; + [size_is(length)] uint8 *data; + } lsa_ForestTrustBinaryData; + + typedef struct { + dom_sid2 *domain_sid; + lsa_StringLarge dns_domain_name; + lsa_StringLarge netbios_domain_name; + } lsa_ForestTrustDomainInfo; + + typedef [switch_type(lsa_ForestTrustRecordType)] union { + [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME)] lsa_StringLarge top_level_name; + [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX)] lsa_StringLarge top_level_name_ex; + [case(LSA_FOREST_TRUST_DOMAIN_INFO)] lsa_ForestTrustDomainInfo domain_info; + [default] lsa_ForestTrustBinaryData data; + } lsa_ForestTrustData; + + typedef struct { + lsa_ForestTrustRecordFlags flags; + lsa_ForestTrustRecordType type; + NTTIME_hyper time; + [switch_is(type)] lsa_ForestTrustData forest_trust_data; + } lsa_ForestTrustRecord; + + typedef [public] struct { + [range(0,4000)] uint32 count; + [size_is(count)] lsa_ForestTrustRecord **entries; + } lsa_ForestTrustInformation; + + [public] NTSTATUS lsa_lsaRQueryForestTrustInformation( + [in] policy_handle *handle, + [in,ref] lsa_String *trusted_domain_name, + [in] lsa_ForestTrustRecordType highest_record_type, + [out,ref] lsa_ForestTrustInformation **forest_trust_info + ); + + /***************** + * Function 0x4a */ + + typedef [v1_enum] enum { + LSA_FOREST_TRUST_COLLISION_TDO = 0, + LSA_FOREST_TRUST_COLLISION_XREF = 1, + LSA_FOREST_TRUST_COLLISION_OTHER = 2 + } lsa_ForestTrustCollisionRecordType; + + typedef [public] struct { + uint32 index; + lsa_ForestTrustCollisionRecordType type; + lsa_ForestTrustRecordFlags flags; + lsa_String name; + } lsa_ForestTrustCollisionRecord; + + typedef [public] struct { + uint32 count; + [size_is(count)] lsa_ForestTrustCollisionRecord **entries; + } lsa_ForestTrustCollisionInfo; + + [public] NTSTATUS lsa_lsaRSetForestTrustInformation( + [in] policy_handle *handle, + [in,ref] lsa_StringLarge *trusted_domain_name, + [in] lsa_ForestTrustRecordType highest_record_type, + [in,ref] lsa_ForestTrustInformation *forest_trust_info, + [in] boolean8 check_only, + [out,ref] lsa_ForestTrustCollisionInfo **collision_info + ); + + /* Function 0x4b */ + [todo] NTSTATUS lsa_CREDRRENAME(); + + /*****************/ + /* Function 0x4c */ + + [public] NTSTATUS lsa_LookupSids3( + [in,ref] lsa_SidArray *sids, + [out,ref] lsa_RefDomainList **domains, + [in,out,ref] lsa_TransNameArray2 *names, + [in] lsa_LookupNamesLevel level, + [in,out,ref] uint32 *count, + [in] lsa_LookupOptions lookup_options, + [in] lsa_ClientRevision client_revision + ); + + const int LSA_CLIENT_REVISION_NO_DNS = 0x00000001; + const int LSA_CLIENT_REVISION_DNS = 0x00000002; + + const int LSA_LOOKUP_OPTIONS_NO_ISOLATED = 0x80000000; + + /* Function 0x4d */ + NTSTATUS lsa_LookupNames4( + [in,range(0,1000)] uint32 num_names, + [in,size_is(num_names)] lsa_String names[], + [out,ref] lsa_RefDomainList **domains, + [in,out,ref] lsa_TransSidArray3 *sids, + [in] lsa_LookupNamesLevel level, + [in,out,ref] uint32 *count, + [in] lsa_LookupOptions lookup_options, + [in] lsa_ClientRevision client_revision + ); + + /* Function 0x4e */ + [todo] NTSTATUS lsa_LSAROPENPOLICYSCE(); + + /* Function 0x4f */ + [todo] NTSTATUS lsa_LSARADTREGISTERSECURITYEVENTSOURCE(); + + /* Function 0x50 */ + [todo] NTSTATUS lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(); + + /* Function 0x51 */ + [todo] NTSTATUS lsa_LSARADTREPORTSECURITYEVENT(); + + /* Function 0x52 (82) */ + [todo] void lsa_Opnum82NotUsedOnWire(void); + + /* Function 0x53 (83) */ + [todo] void lsa_Opnum83NotUsedOnWire(void); + + /* Function 0x54 (84) */ + [todo] void lsa_Opnum84NotUsedOnWire(void); + + /* Function 0x55 (85) */ + [todo] void lsa_Opnum85NotUsedOnWire(void); + + /* Function 0x56 (86) */ + [todo] void lsa_Opnum86NotUsedOnWire(void); + + /* Function 0x57 (87) */ + [todo] void lsa_Opnum87NotUsedOnWire(void); + + /* Function 0x58 (88) */ + [todo] void lsa_Opnum88NotUsedOnWire(void); + + /* Function 0x59 (89) */ + [todo] void lsa_Opnum89NotUsedOnWire(void); + + /* Function 0x5A (90) */ + [todo] void lsa_Opnum90NotUsedOnWire(void); + + /* Function 0x5B (91) */ + [todo] void lsa_Opnum91NotUsedOnWire(void); + + /* Function 0x5C (92) */ + [todo] void lsa_Opnum92NotUsedOnWire(void); + + /* Function 0x5D (93) */ + [todo] void lsa_Opnum93NotUsedOnWire(void); + + /* Function 0x5E (94) */ + [todo] void lsa_Opnum94NotUsedOnWire(void); + + /* Function 0x5F (95) */ + [todo] void lsa_Opnum95NotUsedOnWire(void); + + /* Function 0x60 (96) */ + [todo] void lsa_Opnum96NotUsedOnWire(void); + + /* Function 0x61 (97) */ + [todo] void lsa_Opnum97NotUsedOnWire(void); + + /* Function 0x62 (98) */ + [todo] void lsa_Opnum98NotUsedOnWire(void); + + /* Function 0x63 (99) */ + [todo] void lsa_Opnum99NotUsedOnWire(void); + + /* Function 0x64 (100) */ + [todo] void lsa_Opnum100NotUsedOnWire(void); + + /* Function 0x65 (101) */ + [todo] void lsa_Opnum101NotUsedOnWire(void); + + /* Function 0x66 (102) */ + [todo] void lsa_Opnum102NotUsedOnWire(void); + + /* Function 0x67 (103) */ + [todo] void lsa_Opnum103NotUsedOnWire(void); + + /* Function 0x68 (104) */ + [todo] void lsa_Opnum104NotUsedOnWire(void); + + /* Function 0x69 (105) */ + [todo] void lsa_Opnum105NotUsedOnWire(void); + + /* Function 0x6A (106) */ + [todo] void lsa_Opnum106NotUsedOnWire(void); + + /* Function 0x6B (107) */ + [todo] void lsa_Opnum107NotUsedOnWire(void); + + /* Function 0x6C (108) */ + [todo] void lsa_Opnum108NotUsedOnWire(void); + + /* Function 0x6D (109) */ + [todo] void lsa_Opnum109NotUsedOnWire(void); + + /* Function 0x6E (110) */ + [todo] void lsa_Opnum110NotUsedOnWire(void); + + /* Function 0x6F (111) */ + [todo] void lsa_Opnum111NotUsedOnWire(void); + + /* Function 0x70 (112) */ + [todo] void lsa_Opnum112NotUsedOnWire(void); + + /* Function 0x71 (113) */ + [todo] void lsa_Opnum113NotUsedOnWire(void); + + /* Function 0x72 (114) */ + [todo] void lsa_Opnum114NotUsedOnWire(void); + + /* Function 0x73 (115) */ + [todo] void lsa_Opnum115NotUsedOnWire(void); + + /* Function 0x74 (116) */ + [todo] void lsa_Opnum116NotUsedOnWire(void); + + /* Function 0x75 (117) */ + [todo] void lsa_Opnum117NotUsedOnWire(void); + + /* Function 0x76 (118) */ + [todo] void lsa_Opnum118NotUsedOnWire(void); + + /* Function 0x77 (119) */ + [todo] void lsa_Opnum119NotUsedOnWire(void); + + /* Function 0x78 (120) */ + [todo] void lsa_Opnum120NotUsedOnWire(void); + + /* Function 0x79 (121) */ + [todo] void lsa_Opnum121NotUsedOnWire(void); + + /* Function 0x7A (122) */ + [todo] void lsa_Opnum122NotUsedOnWire(void); + + /* Function 0x7B (123) */ + [todo] void lsa_Opnum123NotUsedOnWire(void); + + /* Function 0x7C (124) */ + [todo] void lsa_Opnum124NotUsedOnWire(void); + + /* Function 0x7D (125) */ + [todo] void lsa_Opnum125NotUsedOnWire(void); + + /* Function 0x7E (126) */ + [todo] void lsa_Opnum126NotUsedOnWire(void); + + /* Function 0x7F (127) */ + [todo] void lsa_Opnum127NotUsedOnWire(void); + + /* Function 0x80 (128) */ + [todo] void lsa_Opnum128NotUsedOnWire(void); + + /***********************/ + /* Function 0x81 (129) */ + + NTSTATUS lsa_CreateTrustedDomainEx3( + [in] policy_handle *policy_handle, + [in] lsa_TrustDomainInfoInfoEx *info, + [in] lsa_TrustDomainInfoAuthInfoInternalAES *auth_info_internal, + [in] lsa_TrustedAccessMask access_mask, + [out] policy_handle *trustdom_handle + ); + + /***********************/ + /* Function 0x82 (130) */ + + typedef [bitmap32bit] bitmap { + LSA_FEATURE_TDO_AUTH_INFO_AES_CIPHER = 0x00000001 + } lsa_RevisionSupportedFeature; + + typedef struct { + uint32 revision; + lsa_RevisionSupportedFeature supported_features; + } lsa_revision_info1; + + typedef [switch_type(uint32)] union { + [case(1)] lsa_revision_info1 info1; + } lsa_revision_info; + + [public] NTSTATUS lsa_OpenPolicy3 ( + [in,unique] [string,charset(UTF16)] uint16 *system_name, + [in] lsa_ObjectAttribute *attr, + [in] lsa_PolicyAccessMask access_mask, + [in] uint32 in_version, + [in,ref][switch_is(in_version)] lsa_revision_info *in_revision_info, + [out,ref] uint32 *out_version, + [out,ref][switch_is(*out_version)] lsa_revision_info *out_revision_info, + [out,ref] policy_handle *handle + ); + + /* Function 0x83 (131) */ + [todo] void lsa_Opnum131NotUsedOnWire(void); + + /***********************/ + /* Function 0x84 (132) */ + typedef [switch_type(lsa_ForestTrustRecordType)] union { + [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME)] lsa_StringLarge top_level_name; + [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX)] lsa_StringLarge top_level_name_ex; + [case(LSA_FOREST_TRUST_DOMAIN_INFO)] lsa_ForestTrustDomainInfo domain_info; + [case(LSA_FOREST_TRUST_BINARY_DATA)] lsa_ForestTrustBinaryData data; + /* + * lsa_ForestTrustScannerInfo would have the same + * definition as lsa_ForestTrustDomainInfo + */ + [case(LSA_FOREST_TRUST_SCANNER_INFO)] lsa_ForestTrustDomainInfo scanner_info; + } lsa_ForestTrustData2; + + typedef struct { + lsa_ForestTrustRecordFlags flags; + lsa_ForestTrustRecordType type; + NTTIME_hyper time; + [switch_is(type)] lsa_ForestTrustData2 forest_trust_data; + } lsa_ForestTrustRecord2; + + typedef [public] struct { + [range(0,4000)] uint32 count; + [size_is(count)] lsa_ForestTrustRecord2 **entries; + } lsa_ForestTrustInformation2; + + [public] NTSTATUS lsa_lsaRQueryForestTrustInformation2( + [in] policy_handle *handle, + [in,ref] lsa_String *trusted_domain_name, + [in] lsa_ForestTrustRecordType highest_record_type, + [out,ref] lsa_ForestTrustInformation2 **forest_trust_info + ); + + /***********************/ + /* Function 0x85 (133) */ + [public] NTSTATUS lsa_lsaRSetForestTrustInformation2( + [in] policy_handle *handle, + [in,ref] lsa_StringLarge *trusted_domain_name, + [in] lsa_ForestTrustRecordType highest_record_type, + [in,ref] lsa_ForestTrustInformation2 *forest_trust_info, + [in] boolean8 check_only, + [out,ref] lsa_ForestTrustCollisionInfo **collision_info + ); +} diff --git a/librpc/idl/mdssvc.idl b/librpc/idl/mdssvc.idl new file mode 100644 index 0000000..b774747 --- /dev/null +++ b/librpc/idl/mdssvc.idl @@ -0,0 +1,68 @@ +import "misc.idl"; +[ + uuid("885d85fb-c754-4062-a0e7-6872ce0064f4"), + endpoint("ncacn_np:[\\pipe\\mdssvc]", "ncalrpc:"), + version(2.0), + helpstring("Spotlight metadata search service") +] +interface mdssvc +{ + void mdssvc_open( + [in,out,ref] uint32 *device_id, + [in,out,ref] uint32 *unkn2, /* always 0x17 ? */ + [in,out,ref] uint32 *unkn3, /* always 0 ? */ + [in][string,charset(UTF8),size_is(1025)] uint8 share_mount_path[], + [in][string,charset(UTF8),size_is(1025)] uint8 share_name[], + [out,string,charset(UTF8),size_is(1025)] uint8 share_path[], + [out,ref] policy_handle *handle + ); + + void mdssvc_unknown1( + [in] policy_handle *handle, + [in] uint32 unkn1, /* always 0, some status ? */ + [in] uint32 device_id, + [in] uint32 unkn3, /* = mdssvc_open.unkn2 ? */ + [in] uint32 unkn4, /* always 0, some status ? */ + [in] uint32 uid, + [in] uint32 gid, + [out,ref] uint32 *status, + [out,ref] uint32 *flags, /* always 0x6b000001 ? */ + [out,ref] uint32 *unkn7 /* always 0 ? */ + ); + + typedef [public] struct { + uint32 length; + uint32 size; + [size_is(size),length_is(length)] uint8 *spotlight_blob; + } mdssvc_blob; + + void mdssvc_cmd( + [in] policy_handle *handle, + [in] uint32 unkn1, /* always 0, status ? */ + [in] uint32 device_id, + [in] uint32 unkn3, /* = mdssvc_open.unkn2 ? */ + [in] uint32 next_fragment, /* Set to 1 to request next fragment*/ + [in] uint32 flags, /* always 0x6b000001 ? */ + [in] mdssvc_blob request_blob, + [in] uint32 unkn5, /* always 0 ? */ + [in] uint32 max_fragment_size1, + [in] uint32 unkn6, /* always 1 ? */ + /* always max_fragment_size1 = max_fragment_size2 ? */ + [in] uint32 max_fragment_size2, + [in] uint32 unkn7, /* always 0 ? */ + [in] uint32 unkn8, /* always 0 ? */ + [out,ref] uint32 *fragment, + [out,ref] mdssvc_blob *response_blob, + [out,ref] uint32 *unkn9 /* always 0 ? */ + ); + + void mdssvc_close( + [in] policy_handle *in_handle, + [in] uint32 unkn1, /* always 0, some status ? */ + [in] uint32 device_id, + [in] uint32 unkn2, /* = mdssvc_open.unkn2 ? */ + [in] uint32 unkn3, /* always 0, some status ? */ + [out,ref] policy_handle *out_handle, + [out,ref] uint32 *status + ); +} diff --git a/librpc/idl/messaging.idl b/librpc/idl/messaging.idl new file mode 100644 index 0000000..df579cf --- /dev/null +++ b/librpc/idl/messaging.idl @@ -0,0 +1,206 @@ +#include "idl_types.h" + +import "server_id.idl"; + +/* + IDL structures for messaging code +*/ + +[ + pointer_default(unique) +] +interface messaging +{ + const int MSG_TYPE_MASK = 0xFFFF; + + typedef [v1_enum,public] enum { + + /* general messages */ + MSG_DEBUG = 0x0001, + MSG_PING = 0x0002, + MSG_PONG = 0x0003, + MSG_PROFILE = 0x0004, + MSG_REQ_DEBUGLEVEL = 0x0005, + MSG_DEBUGLEVEL = 0x0006, + MSG_REQ_PROFILELEVEL = 0x0007, + MSG_PROFILELEVEL = 0x0008, + MSG_REQ_POOL_USAGE = 0x0009, + MSG_POOL_USAGE = 0x000A, + + /* If dmalloc is included, set a steady-state mark */ + MSG_REQ_DMALLOC_MARK = 0x000B, + + /* If dmalloc is included, dump to the dmalloc log a description of + * what has changed since the last MARK */ + MSG_REQ_DMALLOC_LOG_CHANGED = 0x000C, + MSG_SHUTDOWN = 0x000D, + + /* ID_CACHE_FLUSH = 0x000E, obsoleted */ + ID_CACHE_DELETE = 0x000F, + ID_CACHE_KILL = 0x0010, + + /* Changes to smb.conf are really of general interest */ + MSG_SMB_CONF_UPDATED = 0x0021, + MSG_RELOAD_TLS_CERTIFICATES = 0x0022, + + MSG_PREFORK_CHILD_EVENT = 0x0031, + MSG_PREFORK_PARENT_EVENT = 0x0032, + + MSG_REQ_RINGBUF_LOG = 0x0033, + MSG_RINGBUF_LOG = 0x0034, + + MSG_DAEMON_READY_FD = 0x0035, + + /* nmbd messages */ + MSG_FORCE_ELECTION = 0x0101, + MSG_WINS_NEW_ENTRY = 0x0102, + MSG_SEND_PACKET = 0x0103, + + /* printing messages */ + /* MSG_PRINTER_NOTIFY = 0x2001, Obsoleted */ + MSG_PRINTER_NOTIFY2 = 0x0202, + MSG_PRINTER_DRVUPGRADE = 0x0203, + MSG_PRINTERDATA_INIT_RESET = 0x0204, + MSG_PRINTER_UPDATE = 0x0205, + MSG_PRINTER_MOD = 0x0206, + MSG_PRINTER_PCAP = 0x0207, + + /* smbd messages */ + /* MSG_SMB_CONF_UPDATED = 0x0301, Obsoleted */ + MSG_SMB_FORCE_TDIS = 0x0302, + /* MSG_SMB_SAM_SYNC = 0x0303, Obsoleted */ + /* MSG_SMB_SAM_REPL = 0x0304, Obsoleted */ + /* MSG_SMB_UNLOCK = 0x0305, Obsoleted */ + MSG_SMB_BREAK_REQUEST = 0x0306, + /* MSG_SMB_BREAK_RESPONSE = 0x0307, Obsoleted */ + /* MSG_SMB_ASYNC_LEVEL2_BREAK = 0x0308, Obsoleted */ + /* MSG_SMB_OPEN_RETRY = 0x0309, Obsoleted */ + MSG_SMB_KERNEL_BREAK = 0x030A, + MSG_SMB_FILE_RENAME = 0x030B, + MSG_SMB_INJECT_FAULT = 0x030C, + MSG_SMB_BLOCKING_LOCK_CANCEL = 0x030D, + MSG_SMB_NOTIFY = 0x030E, + /* MSG_SMB_STAT_CACHE_DELETE = 0x030F, Obsoleted */ + + /* Samba4 compatibility */ + MSG_PVFS_NOTIFY = 0x0310, + + /* cluster reconfigure events */ + /* MSG_SMB_BRL_VALIDATE = 0x0311, Oboleted */ + + /*Close a specific file given a share entry. */ + MSG_SMB_CLOSE_FILE = 0x0313, + + /* Trigger a notify cleanup run */ + MSG_SMB_NOTIFY_CLEANUP = 0x0314, + MSG_SMB_SCAVENGER = 0x0315, + + /* shutdown connection for given client */ + MSG_SMB_KILL_CLIENT_IP = 0x0316, + + /* Tell number of child processes */ + MSG_SMB_TELL_NUM_CHILDREN = 0x0317, + MSG_SMB_NUM_CHILDREN = 0x0318, + + /* Cancel a notify, directory got deleted */ + MSG_SMB_NOTIFY_CANCEL_DELETED = 0x0319, + + /* notifyd messages */ + MSG_SMB_NOTIFY_REC_CHANGE = 0x031A, + MSG_SMB_NOTIFY_TRIGGER = 0x031B, + MSG_SMB_NOTIFY_GET_DB = 0x031C, + MSG_SMB_NOTIFY_DB = 0x031D, + MSG_SMB_NOTIFY_REC_CHANGES = 0x031E, + MSG_SMB_NOTIFY_STARTED = 0x031F, + MSG_SMB_SLEEP = 0x0320, + + /* smbd message */ + MSG_SMB_FORCE_TDIS_DENIED = 0x0321, + + /* winbind messages */ + MSG_WINBIND_FINISHED = 0x0401, + MSG_WINBIND_FORGET_STATE = 0x0402, + MSG_WINBIND_ONLINE = 0x0403, + MSG_WINBIND_OFFLINE = 0x0404, + MSG_WINBIND_ONLINESTATUS = 0x0405, + + MSG_WINBIND_VALIDATE_CACHE = 0x0408, + MSG_WINBIND_DUMP_DOMAIN_LIST = 0x0409, + MSG_WINBIND_IP_DROPPED = 0x040A, + MSG_WINBIND_DOMAIN_ONLINE = 0x040B, + MSG_WINBIND_DOMAIN_OFFLINE = 0x040C, + MSG_WINBIND_RELOAD_TRUSTED_DOMAINS = 0x040D, + MSG_WINBIND_DISCONNECT_DC = 0x040E, + + /* event messages */ + /* MSG_DUMP_EVENT_LIST = 0x0500, Obsoleted */ + + /* smbXsrv messages */ + MSG_SMBXSRV_SESSION_CLOSE = 0x0600, + MSG_SMBXSRV_CONNECTION_PASS = 0x0601, + MSG_SMBXSRV_CONNECTION_PASSED = 0x0602, + MSG_SMBXSRV_CONNECTION_DROP = 0x0603, + + /* rpcd_witness messages */ + MSG_RPCD_WITNESS_REGISTRATION_UPDATE = 0x0680, + + /* source4 and NTVFS smb server messages */ + MSG_BRL_RETRY = 0x0700, + MSG_PVFS_RETRY_OPEN = 0x0701, + MSG_IRPC = 0x0702, + MSG_NTVFS_OPLOCK_BREAK = 0x0703, + MSG_DREPL_ALLOCATE_RID = 0x0704, + + /* + * Audit, Authentication and Authorisation event + * messages + */ + MSG_AUTH_LOG = 0x0800, + MSG_DSDB_LOG = 0x0801, + MSG_DSDB_PWD_LOG = 0x0802, + MSG_GROUP_LOG = 0x0803, + + /* dbwrap messages 4001-4999 (0x0FA0 - 0x1387) */ + /* MSG_DBWRAP_TDB2_CHANGES = 4001, */ + /* MSG_DBWRAP_G_LOCK_RETRY = 4002, */ + MSG_DBWRAP_MODIFIED = 4003, + + MSG_RPC_HOST_NEW_CLIENT = 4004, + MSG_RPC_WORKER_STATUS = 4005, + MSG_RPC_DUMP_STATUS = 4006, + + /* + * source4 allows new messages to be registered at + * runtime (currently used in python bindings and in + * smbtorture). Temporary messaging endpoints are + * allocated above this line + */ + MSG_TMP_BASE = 0xF000 + } messaging_type; + + /* messaging struct sent across the sockets and stored in the tdb */ + + typedef [public] struct { + [skip] messaging_rec *prev; + [skip] messaging_rec *next; + uint32 msg_version; + messaging_type msg_type; + server_id dest; + server_id src; + DATA_BLOB buf; + uint8 num_fds; + dlong fds[num_fds]; + } messaging_rec; + + typedef [public] struct { + hyper rec_index; + uint32 num_recs; + messaging_rec *recs[num_recs]; + } messaging_reclog; + + /* This allows this well known service name to be referenced in python and C */ + const string AUTH_EVENT_NAME = "auth_event"; + const string DSDB_EVENT_NAME = "dsdb_event"; + const string DSDB_PWD_EVENT_NAME = "dsdb_password_event"; + const string DSDB_GROUP_EVENT_NAME = "dsdb_group_event"; +} diff --git a/librpc/idl/mgmt.idl b/librpc/idl/mgmt.idl new file mode 100644 index 0000000..376fa6d --- /dev/null +++ b/librpc/idl/mgmt.idl @@ -0,0 +1,75 @@ +/* + dcerpc remote management interface +*/ + +import "misc.idl"; + +[ + uuid("afa8bd80-7d8a-11c9-bef4-08002b102989"), + version(1.0), + pointer_default(unique), + helpstring("DCE/RPC Remote Management") +] +interface mgmt +{ + typedef struct { + ndr_syntax_id *id; + } ndr_syntax_id_p; + + typedef struct { + uint32 count; + [size_is(count)] ndr_syntax_id_p if_id[*]; + } rpc_if_id_vector_t; + + + /***********************/ + /* Function 0x00 */ + WERROR mgmt_inq_if_ids ( + [out] rpc_if_id_vector_t **if_id_vector + ); + + + + /***********************/ + /* Function 0x01 */ + + + /* these are the array indexes in the statistics array */ + const int MGMT_STATS_CALLS_IN = 0; + const int MGMT_STATS_CALLS_OUT = 1; + const int MGMT_STATS_PKTS_IN = 2; + const int MGMT_STATS_PKTS_OUT = 3; + const int MGMT_STATS_ARRAY_MAX_SIZE = 4; + + typedef struct { + uint32 count; + [size_is(count)] uint32 statistics[*]; + } mgmt_statistics; + + WERROR mgmt_inq_stats ( + [in] uint32 max_count, + [in] uint32 unknown, + [out,ref] mgmt_statistics *statistics + ); + + + /***********************/ + /* Function 0x02 */ + boolean32 mgmt_is_server_listening ( + [out,ref] error_status_t *status + ); + + + /***********************/ + /* Function 0x03 */ + WERROR mgmt_stop_server_listening (); + + + /***********************/ + /* Function 0x04 */ + WERROR mgmt_inq_princ_name ( + [in] uint32 authn_proto, + [in] uint32 princ_name_size, + [out] [string,size_is(princ_name_size),charset(DOS)] uint8 princ_name[] + ); +} diff --git a/librpc/idl/misc.idl b/librpc/idl/misc.idl new file mode 100644 index 0000000..a705b53 --- /dev/null +++ b/librpc/idl/misc.idl @@ -0,0 +1,149 @@ +#include "idl_types.h" + +/* + miscellaneous IDL structures +*/ + + +[ + pyhelper("librpc/ndr/py_misc.c"), + pointer_default(unique) +] +interface misc +{ + /* + * While structures are not normally known by their order, + * please keep this as the first struct, we use this for a + * test of 'ndrdump misc 0 struct' (this helps debug failures + * from our NDR fuzzing tool, which doesn't use string names) + */ + typedef [public,noprint,gensize] struct { + uint32 time_low; + uint16 time_mid; + uint16 time_hi_and_version; + uint8 clock_seq[2]; + uint8 node[6]; + } GUID; + + typedef [public] struct { + GUID uuid; + /* The major version is encoded in the 16 least significant bits, + the minor in the 16 most significant bits. + http://www.opengroup.org/onlinepubs/9629399/chap12.htm */ + uint32 if_version; + } ndr_syntax_id; + + typedef [public] struct { + uint32 handle_type; + GUID uuid; + } policy_handle; + + /* secure channel types */ + /* Only SEC_CHAN_WKSTA can forward requests to other domains. */ + + typedef [public] enum { + SEC_CHAN_NULL = 0, + SEC_CHAN_LOCAL = 1, + SEC_CHAN_WKSTA = 2, + SEC_CHAN_DNS_DOMAIN = 3, + SEC_CHAN_DOMAIN = 4, + SEC_CHAN_LANMAN = 5, + SEC_CHAN_BDC = 6, + SEC_CHAN_RODC = 7 + } netr_SchannelType; + + typedef [public] struct { + NTSTATUS ntstatus; + uint32 unknown1; + uint32 unknown2; /* 0x00000001 */ + } KRB5_EDATA_NTSTATUS; + + typedef [public,v1_enum] enum { + REG_NONE = 0, + REG_SZ = 1, + REG_EXPAND_SZ = 2, + REG_BINARY = 3, + REG_DWORD = 4, + REG_DWORD_BIG_ENDIAN = 5, + REG_LINK = 6, + REG_MULTI_SZ = 7, + REG_RESOURCE_LIST = 8, + REG_FULL_RESOURCE_DESCRIPTOR = 9, + REG_RESOURCE_REQUIREMENTS_LIST = 10, + REG_QWORD = 11 + } winreg_Type; + + typedef [nodiscriminant,public,flag(NDR_LITTLE_ENDIAN)] union { + [case(REG_NONE)]; + [case(REG_SZ)] nstring string; + [case(REG_EXPAND_SZ)] nstring string; + [case(REG_BINARY),flag(NDR_REMAINING)] DATA_BLOB binary; + [case(REG_DWORD)] uint32 value; + [case(REG_DWORD_BIG_ENDIAN),flag(NDR_BIG_ENDIAN)] uint32 value; + [case(REG_MULTI_SZ)] nstring_array string_array; + [case(REG_QWORD)] hyper qword; + [default,flag(NDR_REMAINING)] DATA_BLOB data; + } winreg_Data; + + /* + * We duplicate the above winreg_Data for usage in the GPO python + * parsers which cannot handle nstring_array. This should be only + * temporary, until we can get PIDL to generate the correct bindings. + */ + typedef [nodiscriminant,public,flag(NDR_LITTLE_ENDIAN),gensize] union { + [case(REG_NONE)]; + [case(REG_SZ)] nstring string; + [case(REG_EXPAND_SZ)] nstring string; + [case(REG_BINARY),flag(NDR_REMAINING)] DATA_BLOB binary; + [case(REG_DWORD)] uint32 value; + [case(REG_DWORD_BIG_ENDIAN),flag(NDR_BIG_ENDIAN)] uint32 value; + /* + * There are no python handlers for nstring_array. + * Prefer a fallback to DATA_BLOB instead. + * + * [case(REG_MULTI_SZ)] nstring_array string_array; + */ + [case(REG_QWORD)] hyper qword; + [default,flag(NDR_REMAINING)] DATA_BLOB data; + } winreg_Data_GPO; + + /* SAM database types */ + typedef [public,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 [public,bitmap32bit] bitmap { + SV_TYPE_WORKSTATION = 0x00000001, + SV_TYPE_SERVER = 0x00000002, + SV_TYPE_SQLSERVER = 0x00000004, + SV_TYPE_DOMAIN_CTRL = 0x00000008, + SV_TYPE_DOMAIN_BAKCTRL = 0x00000010, + SV_TYPE_TIME_SOURCE = 0x00000020, + SV_TYPE_AFP = 0x00000040, + SV_TYPE_NOVELL = 0x00000080, + + SV_TYPE_DOMAIN_MEMBER = 0x00000100, + SV_TYPE_PRINTQ_SERVER = 0x00000200, + SV_TYPE_DIALIN_SERVER = 0x00000400, + SV_TYPE_SERVER_UNIX = 0x00000800, + SV_TYPE_NT = 0x00001000, + SV_TYPE_WFW = 0x00002000, + SV_TYPE_SERVER_MFPN = 0x00004000, + SV_TYPE_SERVER_NT = 0x00008000, + SV_TYPE_POTENTIAL_BROWSER = 0x00010000, + SV_TYPE_BACKUP_BROWSER = 0x00020000, + SV_TYPE_MASTER_BROWSER = 0x00040000, + SV_TYPE_DOMAIN_MASTER = 0x00080000, + SV_TYPE_SERVER_OSF = 0x00100000, + SV_TYPE_SERVER_VMS = 0x00200000, + SV_TYPE_WIN95_PLUS = 0x00400000, + SV_TYPE_DFS_SERVER = 0x00800000, + SV_TYPE_ALTERNATE_XPORT = 0x20000000, + SV_TYPE_LOCAL_LIST_ONLY = 0x40000000, + SV_TYPE_DOMAIN_ENUM = 0x80000000 + } svcctl_ServerType; + + const uint32 SV_TYPE_ALL = 0xFFFFFFFF; +} diff --git a/librpc/idl/msgsvc.idl b/librpc/idl/msgsvc.idl new file mode 100644 index 0000000..d196daf --- /dev/null +++ b/librpc/idl/msgsvc.idl @@ -0,0 +1,22 @@ +/* Works over UDP */ + +[ + uuid("17fdd703-1827-4e34-79d4-24a55c53bb37"), + version(1.0), + pointer_default(unique), + helpstring("Messaging Service") +] interface msgsvc +{ + [todo] void NetrMessageNameAdd(); + [todo] void NetrMessageNameEnum(); + [todo] void NetrMessageNameGetInfo(); + [todo] void NetrMessageNameDel(); +} + +[ + uuid("5a7b91f8-ff00-11d0-a9b2-00c04fb6e6fc"), + version(1.0) +] interface msgsvcsend +{ + [todo] void NetrSendMessage(); +} diff --git a/librpc/idl/named_pipe_auth.idl b/librpc/idl/named_pipe_auth.idl new file mode 100644 index 0000000..807a312 --- /dev/null +++ b/librpc/idl/named_pipe_auth.idl @@ -0,0 +1,58 @@ +#include "idl_types.h" +/* + miscellaneous IDL structures +*/ + +import "netlogon.idl", "security.idl", "auth.idl"; + +[ + pointer_default(unique) +] +interface named_pipe_auth +{ + const char *NAMED_PIPE_AUTH_MAGIC = "NPAM"; + + typedef [public] struct { + uint8 transport; + [charset(UTF8),string] uint8 *remote_client_name; + [charset(DOS),string] uint8 *remote_client_addr; + uint16 remote_client_port; + [charset(UTF8),string] uint8 *local_server_name; + [charset(DOS),string] uint8 *local_server_addr; + uint16 local_server_port; + auth_session_info_transport *session_info; + } named_pipe_auth_req_info8; + + typedef [switch_type(uint32)] union { + [case(8)] named_pipe_auth_req_info8 info8; + } named_pipe_auth_req_info; + + typedef [public,gensize] struct { + [flag(NDR_BIG_ENDIAN), + value(ndr_size_named_pipe_auth_req(r,ndr->flags)-4)] + uint32 length; + [charset(DOS),value(NAMED_PIPE_AUTH_MAGIC)] uint8 magic[4]; + uint32 level; + [switch_is(level)] named_pipe_auth_req_info info; + } named_pipe_auth_req; + + typedef struct { + uint16 file_type; + uint16 device_state; + hyper allocation_size; + } named_pipe_auth_rep_info8; + + typedef [switch_type(uint32)] union { + [case(8)] named_pipe_auth_rep_info8 info8; + } named_pipe_auth_rep_info; + + typedef [public,gensize] struct { + [flag(NDR_BIG_ENDIAN), + value(ndr_size_named_pipe_auth_rep(r,ndr->flags)-4)] + uint32 length; + [charset(DOS),value(NAMED_PIPE_AUTH_MAGIC)] uint8 magic[4]; + uint32 level; + [switch_is(level)] named_pipe_auth_rep_info info; + NTSTATUS status; + } named_pipe_auth_rep; +} diff --git a/librpc/idl/nbt.idl b/librpc/idl/nbt.idl new file mode 100644 index 0000000..46be2ea --- /dev/null +++ b/librpc/idl/nbt.idl @@ -0,0 +1,689 @@ +#include "idl_types.h" + +/* + IDL structures for NBT operations + + NBT is not traditionally encoded using IDL/NDR. This is a bit of an + experiment, and I may well switch us back to a more traditional + encoding if it doesn't work out +*/ + +import "misc.idl", "security.idl"; +[ + helper("../librpc/ndr/ndr_nbt.h"), + helpstring("NBT messages"), + uuid("6def41b6-86e4-4c32-997c-ed33af7bcd8e") +] +interface nbt +{ + const int NBT_NAME_SERVICE_PORT = 137; + const int NBT_DGRAM_SERVICE_PORT = 138; + + typedef [bitmap16bit] bitmap { + NBT_RCODE = 0x000F, + NBT_FLAG_BROADCAST = 0x0010, + NBT_FLAG_RECURSION_AVAIL = 0x0080, + NBT_FLAG_RECURSION_DESIRED = 0x0100, + NBT_FLAG_TRUNCATION = 0x0200, + NBT_FLAG_AUTHORITATIVE = 0x0400, + NBT_OPCODE = 0x7800, + NBT_FLAG_REPLY = 0x8000 + } nbt_operation; + + /* the opcodes are in the operation field, masked with + NBT_OPCODE */ + typedef enum { + NBT_OPCODE_QUERY = (0x0<<11), + NBT_OPCODE_REGISTER = (0x5<<11), + NBT_OPCODE_RELEASE = (0x6<<11), + NBT_OPCODE_WACK = (0x7<<11), + NBT_OPCODE_REFRESH = (0x8<<11), + NBT_OPCODE_REFRESH2 = (0x9<<11), + NBT_OPCODE_MULTI_HOME_REG = (0xf<<11) + } nbt_opcode; + + /* rcode values */ + typedef enum { + NBT_RCODE_OK = 0x0, + NBT_RCODE_FMT = 0x1, + NBT_RCODE_SVR = 0x2, + NBT_RCODE_NAM = 0x3, + NBT_RCODE_IMP = 0x4, + NBT_RCODE_RFS = 0x5, + NBT_RCODE_ACT = 0x6, + NBT_RCODE_CFT = 0x7 + } nbt_rcode; + + /* we support any 8bit name type, but by defining the common + ones here we get better debug displays */ + typedef [enum8bit] enum { + NBT_NAME_CLIENT = 0x00, + NBT_NAME_MS = 0x01, + NBT_NAME_USER = 0x03, + NBT_NAME_SERVER = 0x20, + NBT_NAME_PDC = 0x1B, + NBT_NAME_LOGON = 0x1C, + NBT_NAME_MASTER = 0x1D, + NBT_NAME_BROWSER = 0x1E + } nbt_name_type; + + /* the ndr parser for nbt_name is separately defined in + nbtname.c (along with the parsers for nbt_string) */ + typedef [public,nopull,nopush] struct { + string name; + string scope; + nbt_name_type type; + } nbt_name; + + typedef [public,enum16bit] enum { + NBT_QCLASS_IP = 0x01 + } nbt_qclass; + + typedef [public,enum16bit,nopush] enum { + NBT_QTYPE_ADDRESS = 0x0001, + NBT_QTYPE_NAMESERVICE = 0x0002, + NBT_QTYPE_NULL = 0x000A, + NBT_QTYPE_NETBIOS = 0x0020, + NBT_QTYPE_STATUS = 0x0021, + /* + * Indicates that this is a WACK packet. As long as the size of + * ‘int’ is larger than 16 bits, this value cannot appear on the + * wire. We’ll encode it instead as NBT_QTYPE_NETBIOS. + */ + NBT_QTYPE_WACK = -1 + } nbt_qtype; + + typedef struct { + nbt_name name; + nbt_qtype question_type; + nbt_qclass question_class; + } nbt_name_question; + + /* these are the possible values of the NBT_NM_OWNER_TYPE + field */ + typedef enum { + NBT_NODE_B = 0x0000, + NBT_NODE_P = 0x2000, + NBT_NODE_M = 0x4000, + NBT_NODE_H = 0x6000 + } nbt_node_type; + + typedef [bitmap16bit] bitmap { + NBT_NM_PERMANENT = 0x0200, + NBT_NM_ACTIVE = 0x0400, + NBT_NM_CONFLICT = 0x0800, + NBT_NM_DEREGISTER = 0x1000, + NBT_NM_OWNER_TYPE = 0x6000, + NBT_NM_GROUP = 0x8000 + } nb_flags; + + typedef struct { + nb_flags nb_flags; + ipv4address ipaddr; + } nbt_rdata_address; + + typedef struct { + uint16 length; + nbt_rdata_address addresses[length/6]; + } nbt_rdata_netbios; + + typedef struct { + uint8 unit_id[6]; + uint8 jumpers; + uint8 test_result; + uint16 version_number; + uint16 period_of_statistics; + uint16 number_of_crcs; + uint16 number_alignment_errors; + uint16 number_of_collisions; + uint16 number_send_aborts; + uint32 number_good_sends; + uint32 number_good_receives; + uint16 number_retransmits; + uint16 number_no_resource_conditions; + uint16 number_free_command_blocks; + uint16 total_number_command_blocks; + uint16 max_total_number_command_blocks; + uint16 number_pending_sessions; + uint16 max_number_pending_sessions; + uint16 max_total_sessions_possible; + uint16 session_data_packet_size; + } nbt_statistics; + + typedef struct { + [charset(DOS)] uint8 name[15]; + nbt_name_type type; + nb_flags nb_flags; + } nbt_status_name; + + typedef struct { + [value(num_names * 18 + 47)] uint16 length; + uint8 num_names; + nbt_status_name names[num_names]; + nbt_statistics statistics; + } nbt_rdata_status; + + typedef struct { + uint16 length; + uint8 data[length]; + } nbt_rdata_data; + + typedef [nodiscriminant,public] union { + [case(NBT_QTYPE_NETBIOS)] nbt_rdata_netbios netbios; + [case(NBT_QTYPE_STATUS)] nbt_rdata_status status; + [default] nbt_rdata_data data; + } nbt_rdata; + + typedef [flag(LIBNDR_PRINT_ARRAY_HEX)] struct { + nbt_name name; + nbt_qtype rr_type; + nbt_qclass rr_class; + uint32 ttl; + [switch_is(rr_type)] nbt_rdata rdata; + } nbt_res_rec; + + typedef [flag(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct { + uint16 name_trn_id; + nbt_operation operation; + uint16 qdcount; + uint16 ancount; + uint16 nscount; + uint16 arcount; + nbt_name_question questions[qdcount]; + nbt_res_rec answers[ancount]; + nbt_res_rec nsrecs[nscount]; + nbt_res_rec additional[arcount]; + [flag(NDR_REMAINING)] DATA_BLOB padding; + } nbt_name_packet; + + + /* + NBT DGRAM packets (UDP/138) + */ + + typedef [enum8bit] enum { + DGRAM_DIRECT_UNIQUE = 0x10, + DGRAM_DIRECT_GROUP = 0x11, + DGRAM_BCAST = 0x12, + DGRAM_ERROR = 0x13, + DGRAM_QUERY = 0x14, + DGRAM_QUERY_POSITIVE = 0x15, + DGRAM_QUERY_NEGATIVE = 0x16 + } dgram_msg_type; + + typedef [bitmap8bit] bitmap { + DGRAM_FLAG_MORE = 0x01, + DGRAM_FLAG_FIRST = 0x02, + DGRAM_FLAG_NODE_TYPE = 0x0C + } dgram_flags; + + typedef [enum8bit] enum { + DGRAM_NODE_B = 0x00, + DGRAM_NODE_P = 0x04, + DGRAM_NODE_M = 0x08, + DGRAM_NODE_NBDD = 0x0C + } dgram_node_type; + + /* a dgram_message is the main dgram body in general use */ + + /* the most common datagram type is a SMB_TRANSACTION + operation, where a SMB packet is used in the data section + of a dgram_message to hold a trans request, which in turn + holds a small command structure. It's a very strange beast + indeed. To make the code cleaner we define a basic SMB + packet in IDL here. This is not a general purpose SMB + packet, and won't be used in the core SMB client/server + code, but it does make working with these types of dgrams + easier */ + + const string NBT_MAILSLOT_NETLOGON = "\\MAILSLOT\\NET\\NETLOGON"; + const string NBT_MAILSLOT_NTLOGON = "\\MAILSLOT\\NET\\NTLOGON"; + const string NBT_MAILSLOT_GETDC = "\\MAILSLOT\\NET\\GETDC"; + const string NBT_MAILSLOT_BROWSE = "\\MAILSLOT\\BROWSE"; + + typedef [enum8bit] enum { + SMB_TRANSACTION = 0x25 + } smb_command; + + typedef struct { + [range(17,17),value(17)] uint8 wct; + uint16 total_param_count; + uint16 total_data_count; + uint16 max_param_count; + uint16 max_data_count; + uint8 max_setup_count; + uint8 pad; + uint16 trans_flags; + uint32 timeout; + uint16 reserved; + uint16 param_count; + uint16 param_offset; + uint16 data_count; + uint16 data_offset; + [range(3,3),value(3)] uint8 setup_count; + uint8 pad2; + uint16 opcode; + uint16 priority; + uint16 _class; + [value(strlen(mailslot_name)+1+data.length)] + uint16 byte_count; + astring mailslot_name; + [flag(NDR_REMAINING)] DATA_BLOB data; + } smb_trans_body; + + typedef [nodiscriminant] union { + [case(SMB_TRANSACTION)] smb_trans_body trans; + } smb_body; + + + typedef [flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN|NDR_PAHEX),public] struct { + smb_command smb_command; + uint8 err_class; + uint8 pad; + uint16 err_code; + uint8 flags; + uint16 flags2; + uint16 pid_high; + uint8 signature[8]; + uint16 reserved; + uint16 tid; + uint16 pid; + uint16 vuid; + uint16 mid; + [switch_is(smb_command)] smb_body body; + } dgram_smb_packet; + + const uint32 DGRAM_SMB = 0xff534d42; /* 0xffSMB */ + + typedef [nodiscriminant] union { + [case(DGRAM_SMB)] dgram_smb_packet smb; + } dgram_message_body; + + typedef struct { + uint16 length; + uint16 offset; + nbt_name source_name; + nbt_name dest_name; + uint32 dgram_body_type; + [switch_is(dgram_body_type)] dgram_message_body body; + } dgram_message; + + typedef [enum8bit] enum { + DGRAM_ERROR_NAME_NOT_PRESENT = 0x82, + DGRAM_ERROR_INVALID_SOURCE = 0x83, + DGRAM_ERROR_INVALID_DEST = 0x84 + } dgram_err_code; + + typedef [nodiscriminant] union { + [case(DGRAM_DIRECT_UNIQUE)] dgram_message msg; + [case(DGRAM_DIRECT_GROUP)] dgram_message msg; + [case(DGRAM_BCAST)] dgram_message msg; + [case(DGRAM_ERROR)] dgram_err_code error; + [case(DGRAM_QUERY)] nbt_name dest_name; + [case(DGRAM_QUERY_POSITIVE)] nbt_name dest_name; + [case(DGRAM_QUERY_NEGATIVE)] nbt_name dest_name; + } dgram_data; + + typedef [flag(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct { + dgram_msg_type msg_type; + dgram_flags flags; + uint16 dgram_id; + ipv4address src_addr; + uint16 src_port; + [switch_is(msg_type)] dgram_data data; + } nbt_dgram_packet; + + + /****************************************** + * \MAILSLOT\NET\NETLOGON mailslot requests + * and + * \MAILSLOT\NET\NTLOGON mailslot requests + */ + + typedef [public,gensize] struct { + uint32 sockaddr_family; + [flag(NDR_BIG_ENDIAN)] ipv4address pdc_ip; + [flag(NDR_REMAINING)] DATA_BLOB remaining; + } nbt_sockaddr; + + typedef [bitmap32bit,public] bitmap { + NBT_SERVER_PDC = 0x00000001, + NBT_SERVER_GC = 0x00000004, + NBT_SERVER_LDAP = 0x00000008, + NBT_SERVER_DS = 0x00000010, + NBT_SERVER_KDC = 0x00000020, + NBT_SERVER_TIMESERV = 0x00000040, + NBT_SERVER_CLOSEST = 0x00000080, + NBT_SERVER_WRITABLE = 0x00000100, + NBT_SERVER_GOOD_TIMESERV = 0x00000200, + NBT_SERVER_NDNC = 0x00000400, + NBT_SERVER_SELECT_SECRET_DOMAIN_6 = 0x00000800, /* 2008 / RODC */ + NBT_SERVER_FULL_SECRET_DOMAIN_6 = 0x00001000, /* 2008 */ + NBT_SERVER_ADS_WEB_SERVICE = 0x00002000, + NBT_SERVER_DS_8 = 0x00004000, /* 2012 */ + NBT_SERVER_DS_9 = 0x00008000, /* 2012R2 */ + NBT_SERVER_DS_10 = 0x00010000, /* 2016 */ + NBT_SERVER_HAS_DNS_NAME = 0x20000000, + NBT_SERVER_IS_DEFAULT_NC = 0x40000000, + NBT_SERVER_FOREST_ROOT = 0x80000000 + } nbt_server_type; + + typedef [bitmap32bit,public] bitmap { + NETLOGON_NT_VERSION_1 = 0x00000001, + NETLOGON_NT_VERSION_5 = 0x00000002, + NETLOGON_NT_VERSION_5EX = 0x00000004, + NETLOGON_NT_VERSION_5EX_WITH_IP = 0x00000008, + NETLOGON_NT_VERSION_WITH_CLOSEST_SITE = 0x00000010, + NETLOGON_NT_VERSION_AVOID_NT4EMUL = 0x01000000, + NETLOGON_NT_VERSION_PDC = 0x10000000, + NETLOGON_NT_VERSION_IP = 0x20000000, + NETLOGON_NT_VERSION_LOCAL = 0x40000000, + NETLOGON_NT_VERSION_GC = 0x80000000 + } netlogon_nt_version_flags; + + typedef [enum16bit,public] enum { + LOGON_REQUEST = 0, + LOGON_RESPONSE2 = 6, + LOGON_PRIMARY_QUERY = 7, /* Was also NETLOGON_QUERY_FOR_PDC */ + NETLOGON_ANNOUNCE_UAS = 10, + NETLOGON_RESPONSE_FROM_PDC = 12, + LOGON_SAM_LOGON_REQUEST = 18, /* Was also NETLOGON_QUERY_FOR_PDC2, NTLOGON_SAM_LOGON */ + LOGON_SAM_LOGON_RESPONSE = 19, /* Was also NTLOGON_SAM_LOGON_REPLY */ + LOGON_SAM_LOGON_PAUSE_RESPONSE = 20, + LOGON_SAM_LOGON_USER_UNKNOWN = 21, /* Was also NTLOGON_SAM_LOGON_REPLY15 */ + LOGON_SAM_LOGON_RESPONSE_EX = 23, /* was NETLOGON_RESPONSE_FROM_PDC2 */ + LOGON_SAM_LOGON_PAUSE_RESPONSE_EX = 24, + LOGON_SAM_LOGON_USER_UNKNOWN_EX = 25 /* was NETLOGON_RESPONSE_FROM_PDC_USER */ + } netlogon_command; + + /* query to dc hand marshaled, as it has 'optional' + * parts */ + typedef [nopull,nopush] struct { + uint16 request_count; + nstring computer_name; + nstring user_name; + astring mailslot_name; + uint32 acct_control; + /* samr_AcctFlags acct_control; */ + [value(ndr_size_dom_sid0(&sid, ndr->flags))] uint32 sid_size; + /* The manual alignment is required because this + * structure is marked flag(NDR_NOALIGN) via the + * nbt_netlogon_packet below. + * + * However, both MUST only be present if sid_size > 0 + */ + [flag(NDR_ALIGN4)] DATA_BLOB _pad; + [subcontext(0),subcontext_size(sid_size)] dom_sid0 sid; + netlogon_nt_version_flags nt_version; + uint16 lmnt_token; + uint16 lm20_token; + } NETLOGON_SAM_LOGON_REQUEST; + + typedef struct { + astring computer_name; + astring user_name; + astring mailslot_name; + uint8 request_count; + uint16 lmnt_token; + uint16 lm20_token; + } NETLOGON_LOGON_REQUEST; + + typedef [flag(NDR_NOALIGN),public] struct { + netlogon_command command; + nstring pdc_name; + nstring user_name; + nstring domain_name; + netlogon_nt_version_flags nt_version; + uint16 lmnt_token; + uint16 lm20_token; + } NETLOGON_SAM_LOGON_RESPONSE_NT40; + + typedef [flag(NDR_NOALIGN),public] struct { + netlogon_command command; + nstring pdc_name; + nstring user_name; + nstring domain_name; + GUID domain_uuid; + GUID zero_uuid; + nbt_string forest; + nbt_string dns_domain; + nbt_string pdc_dns_name; + ipv4address pdc_ip; + nbt_server_type server_type; + netlogon_nt_version_flags nt_version; + uint16 lmnt_token; + uint16 lm20_token; + } NETLOGON_SAM_LOGON_RESPONSE; + + /* response from pdc hand marshaled (we have an additional + * function that uses this structure), as it has 'optional' + * parts */ + typedef [flag(NDR_NOALIGN),public] struct { + netlogon_command command; + uint16 sbz; /* From the docs */ + nbt_server_type server_type; + GUID domain_uuid; + nbt_string forest; + nbt_string dns_domain; + nbt_string pdc_dns_name; + nbt_string domain_name; + nbt_string pdc_name; + nbt_string user_name; + nbt_string server_site; + nbt_string client_site; + + /* Optional on NETLOGON_NT_VERSION_5EX_WITH_IP */ + [value(ndr_size_nbt_sockaddr(&sockaddr, ndr->flags))] uint8 sockaddr_size; + [subcontext(0),subcontext_size(sockaddr_size)] nbt_sockaddr sockaddr; + + /* Optional on NETLOGON_NT_VERSION_WITH_CLOSEST_SITE */ + nbt_string next_closest_site; + + netlogon_nt_version_flags nt_version; + uint16 lmnt_token; + uint16 lm20_token; + } NETLOGON_SAM_LOGON_RESPONSE_EX; + + typedef [nopush,nopull] union { + [case(NETLOGON_NT_VERSION_1)] NETLOGON_SAM_LOGON_RESPONSE_NT40 nt4; + [case(NETLOGON_NT_VERSION_5)] NETLOGON_SAM_LOGON_RESPONSE nt5; + [case(NETLOGON_NT_VERSION_5EX)] NETLOGON_SAM_LOGON_RESPONSE_EX nt5_ex; + } netlogon_samlogon_response_union; + + typedef [nopush,nopull,noprint,public] struct { + uint32 ntver; + [switch_is(ntver)] netlogon_samlogon_response_union data; + } netlogon_samlogon_response; + + /* query for pdc request */ + typedef struct { + astring computer_name; + astring mailslot_name; + [flag(NDR_ALIGN2)] DATA_BLOB _pad; + nstring unicode_name; + netlogon_nt_version_flags nt_version; + uint16 lmnt_token; + uint16 lm20_token; + } nbt_netlogon_query_for_pdc; + + /* response from pdc */ + typedef [public] struct { + netlogon_command command; + astring pdc_name; + [flag(NDR_ALIGN2)] DATA_BLOB _pad; + nstring unicode_pdc_name; + nstring domain_name; + netlogon_nt_version_flags nt_version; + uint16 lmnt_token; + uint16 lm20_token; + } nbt_netlogon_response_from_pdc; + + typedef [flag(NDR_NOALIGN),public] struct { + netlogon_command command; + astring pdc_name; + uint16 lm20_token; + } nbt_netlogon_response2; + + /* used to announce SAM changes - MS-NRPC 2.2.1.5.1 */ + typedef struct { + netr_SamDatabaseID db_index; + hyper serial; + NTTIME timestamp; + } nbt_db_change_info; + + typedef struct { + uint32 serial_lo; + time_t timestamp; + uint32 pulse; + uint32 random; + astring pdc_name; + astring domain; + [flag(NDR_ALIGN2)] DATA_BLOB _pad; + nstring unicode_pdc_name; + nstring unicode_domain; + uint32 db_count; + nbt_db_change_info dbchange[db_count]; + [value(ndr_size_dom_sid0(&sid, ndr->flags))] uint32 sid_size; + [subcontext(0),subcontext_size(sid_size)] dom_sid0 sid; + uint32 message_format_version; + uint32 message_token; + } NETLOGON_DB_CHANGE; + + typedef [nodiscriminant] union { + [case(LOGON_REQUEST)] NETLOGON_LOGON_REQUEST logon0; + [case(LOGON_SAM_LOGON_REQUEST)] NETLOGON_SAM_LOGON_REQUEST logon; + [case(LOGON_PRIMARY_QUERY)] nbt_netlogon_query_for_pdc pdc; + [case(NETLOGON_ANNOUNCE_UAS)] NETLOGON_DB_CHANGE uas; + } nbt_netlogon_request; + +#if 0 + /* These responses are all handled manually, as they cannot be encoded in IDL fully + + See push_nbt_netlogon_response() + */ + [case(NETLOGON_RESPONSE_FROM_PDC)] nbt_netlogon_response_from_pdc response; + [case(NETLOGON_RESPONSE_FROM_PDC_USER)] nbt_netlogon_response_from_pdc2 response2; + + [case(LOGON_SAM_LOGON_PAUSE_RESPONSE)] NETLOGON_SAM_LOGON_RESPONSE reply; + [case(LOGON_SAM_LOGON_RESPONSE)] NETLOGON_SAM_LOGON_RESPONSE reply; + [case(LOGON_SAM_LOGON_USER_UNKNOWN)] NETLOGON_SAM_LOGON_RESPONSE reply; + [case(LOGON_SAM_LOGON_RESPONSE_EX)] NETLOGON_SAM_LOGON_RESPONSE_EX reply_ex; + [case(LOGON_SAM_LOGON_PAUSE_RESPONSE_EX)] NETLOGON_SAM_LOGON_RESPONSE_EX reply_ex; + [case(LOGON_SAM_LOGON_USER_UNKNOWN_EX)] NETLOGON_SAM_LOGON_RESPONSE_EX reply_ex; +#endif + + typedef [flag(NDR_NOALIGN),public] struct { + netlogon_command command; + [switch_is(command)] nbt_netlogon_request req; + } nbt_netlogon_packet; + + /********************************************************/ + /* \MAILSLOT\BROWSE mailslot requests */ + /* for details see http://ubiqx.org/cifs/Browsing.html */ + /********************************************************/ + typedef bitmap svcctl_ServerType svcctl_ServerType; + + typedef [enum8bit] enum { + HostAnnouncement = 1, + AnnouncementRequest = 2, + Election = 8, + GetBackupListReq = 9, + GetBackupListResp = 10, + BecomeBackup = 11, + DomainAnnouncement = 12, + MasterAnnouncement = 13, + ResetBrowserState = 14, + LocalMasterAnnouncement = 15 + } nbt_browse_opcode; + + typedef struct { + uint8 UpdateCount; + uint32 Periodicity; + [charset(DOS)] uint8 ServerName[16]; + uint8 OSMajor; + uint8 OSMinor; + svcctl_ServerType ServerType; + uint8 BroMajorVer; + uint8 BroMinorVer; + uint16 Signature; + astring Comment; + } nbt_browse_host_announcement; + + typedef struct { + uint8 Unused; + astring ResponseName; + } nbt_browse_announcement_request; + + typedef struct { + uint8 Version; + uint32 Criteria; + uint32 UpTime; /* In milliseconds */ + uint32 Reserved; /* Must be zero */ + astring ServerName; + } nbt_browse_election_request; + + typedef struct { + uint8 ReqCount; + uint32 Token; + } nbt_browse_backup_list_request; + + typedef struct { + uint8 BackupCount; + uint32 Token; + nbt_name BackupServerList[BackupCount];/* TODO: this is wrong */ + } nbt_browse_backup_list_response; + + typedef struct { + astring BrowserName; + } nbt_browse_become_backup; + + typedef struct { + uint8 UpdateCount; + uint32 Periodicity; + [charset(DOS)] uint8 ServerName[16]; + uint8 OSMajor; + uint8 OSMinor; + svcctl_ServerType ServerType; + uint32 MysteriousField; + astring Comment; + } nbt_browse_domain_announcement; + + typedef struct { + astring ServerName; + } nbt_browse_master_announcement; + + typedef struct { + uint8 Command; + } nbt_browse_reset_state; + + typedef struct { + uint8 UpdateCount; + uint32 Periodicity; + [charset(DOS)] uint8 ServerName[16]; + uint8 OSMajor; + uint8 OSMinor; + svcctl_ServerType ServerType; + uint8 BroMajorVer; + uint8 BroMinorVer; + uint16 Signature; + astring Comment; + } nbt_browse_local_master_announcement; + + typedef [nodiscriminant] union { + [case(HostAnnouncement)] nbt_browse_host_announcement host_annoucement; + [case(AnnouncementRequest)] nbt_browse_announcement_request announcement_request; + [case(Election)] nbt_browse_election_request election_request; + [case(GetBackupListReq)] nbt_browse_backup_list_request backup_list_request; + [case(GetBackupListResp)] nbt_browse_backup_list_response backup_list_response; + [case(BecomeBackup)] nbt_browse_become_backup become_backup; + [case(DomainAnnouncement)] nbt_browse_domain_announcement domain_announcement; + [case(MasterAnnouncement)] nbt_browse_master_announcement master_announcement; + [case(ResetBrowserState)] nbt_browse_reset_state reset_browser_state; + [case(LocalMasterAnnouncement)] nbt_browse_local_master_announcement local_master_announcement; + } nbt_browse_payload; + + typedef [public,flag(NDR_NOALIGN)] struct { + nbt_browse_opcode opcode; + [switch_is(opcode)] nbt_browse_payload payload; + } nbt_browse_packet; +} diff --git a/librpc/idl/negoex.idl b/librpc/idl/negoex.idl new file mode 100644 index 0000000..eb3511d --- /dev/null +++ b/librpc/idl/negoex.idl @@ -0,0 +1,152 @@ +#include "idl_types.h" + +/* + NEGOEX interface definition + See http://ietfreport.isoc.org/all-ids/draft-zhu-negoex-04.txt +*/ + +import "misc.idl"; + +[ + uuid("fcc30ddc-98d0-11e5-8a56-83e9a6706f2f"), + helper("../librpc/ndr/ndr_negoex.h"), + helpstring("NEGOEX messages") +] +interface negoex +{ + typedef [nopush,nopull,noprint] struct { +#if 0 + [relative,size_is(length)] uint8 *data; + uint32 length; +#else + DATA_BLOB blob; + /* + * internal helper variable */ + uint32 _length; + /* + * the dummy pointer is needed in order to let the + * callers use NDR_BUFFERS + */ + [relative] uint8 *_dummy; +#endif + } negoex_BYTE_VECTOR; + + typedef [public] struct { + GUID guid; + } negoex_AUTH_SCHEME; + + typedef [nopush,nopull] struct { + [relative,size_is(count)] negoex_AUTH_SCHEME *array; + uint32 count; + } negoex_AUTH_SCHEME_VECTOR; + + typedef [v1_enum] enum { + NEGOEX_EXTENSION_TYPE_TODO = 0 /* TODO */ + } negoex_ExtensionTypes; + + typedef [public] struct { + negoex_ExtensionTypes type; + negoex_BYTE_VECTOR value; + } negoex_EXTENSION; + + typedef [nopush,nopull] struct { + [relative,size_is(count)] negoex_EXTENSION *array; + uint32 count; + } negoex_EXTENSION_VECTOR; + + typedef [v1_enum] enum { + NEGOEX_CHECKSUM_SCHEME_RFC3961 = 1 + } negoex_ChecksumSchemes; + + typedef struct { + [value(20)] uint32 header_length; + negoex_ChecksumSchemes scheme; + uint32 type; + negoex_BYTE_VECTOR value; + } negoex_CHECKSUM; + + typedef [v1_enum] enum { + NEGOEX_ALERT_VERIFY_NO_KEY = 1 + } negoex_AlertReason; + + typedef [public] struct { + [value(4)] uint32 header_length; /* TODO: is 4 correct? */ + negoex_AlertReason reason; + } negoex_ALERT_PULSE; + + typedef [v1_enum] enum { + NEGOEX_ALERT_TYPE_PULSE = 1 + } negoex_AlertTypes; + + typedef [public] struct { + negoex_AlertTypes type; + negoex_BYTE_VECTOR value; + } negoex_ALERT; + + typedef [nopush,nopull] struct { + [relative,size_is(count)] negoex_ALERT *array; + uint32 count; + } negoex_ALERT_VECTOR; + + typedef [public,v1_enum] enum { + NEGOEX_MESSAGE_TYPE_INITIATOR_NEGO = 0, + NEGOEX_MESSAGE_TYPE_ACCEPTOR_NEGO = 1, + NEGOEX_MESSAGE_TYPE_INITIATOR_META_DATA = 2, + NEGOEX_MESSAGE_TYPE_ACCEPTOR_META_DATA = 3, + NEGOEX_MESSAGE_TYPE_CHALLENGE = 4, + NEGOEX_MESSAGE_TYPE_AP_REQUEST = 5, + NEGOEX_MESSAGE_TYPE_VERIFY = 6, + NEGOEX_MESSAGE_TYPE_ALERT = 7 + } negoex_MESSAGE_TYPE; + + const uint32 NEGOEX_PROTOCOL_VERSION_0 = 0; + + typedef [flag(NDR_PAHEX)] struct { + [flag(NDR_PAHEX)] uint8 random[32]; + [value(NEGOEX_PROTOCOL_VERSION_0)] udlong protocol_version; + negoex_AUTH_SCHEME_VECTOR auth_schemes; + negoex_EXTENSION_VECTOR extensions; + } negoex_NEGO_PAYLOAD; + + typedef struct { + negoex_AUTH_SCHEME auth_scheme; + negoex_BYTE_VECTOR exchange; + } negoex_EXCHANGE_PAYLOAD; + + typedef struct { + negoex_AUTH_SCHEME auth_scheme; + negoex_CHECKSUM checksum; + } negoex_VERIFY_PAYLOAD; + + typedef struct { + negoex_AUTH_SCHEME auth_scheme; + NTSTATUS status; + negoex_ALERT_VECTOR alerts; + } negoex_ALERT_PAYLOAD; + + typedef [public,nodiscriminant] union { + [case(NEGOEX_MESSAGE_TYPE_INITIATOR_NEGO)] negoex_NEGO_PAYLOAD nego; + [case(NEGOEX_MESSAGE_TYPE_ACCEPTOR_NEGO)] negoex_NEGO_PAYLOAD nego; + [case(NEGOEX_MESSAGE_TYPE_INITIATOR_META_DATA)] negoex_EXCHANGE_PAYLOAD exchange; + [case(NEGOEX_MESSAGE_TYPE_ACCEPTOR_META_DATA)] negoex_EXCHANGE_PAYLOAD exchange; + [case(NEGOEX_MESSAGE_TYPE_CHALLENGE)] negoex_EXCHANGE_PAYLOAD exchange; + [case(NEGOEX_MESSAGE_TYPE_AP_REQUEST)] negoex_EXCHANGE_PAYLOAD exchange; + [case(NEGOEX_MESSAGE_TYPE_VERIFY)] negoex_VERIFY_PAYLOAD verify; + [case(NEGOEX_MESSAGE_TYPE_ALERT)] negoex_ALERT_PAYLOAD alert; + } negoex_PAYLOAD; + + typedef [public,relative_base,gensize,nopull] struct { + [charset(DOS),value("NEGOEXTS")] uint8 signature[8]; + negoex_MESSAGE_TYPE type; + uint32 sequence_number; + [value(ndr_negoex_MESSAGE_header_length(r))] uint32 header_length; + [value(ndr_size_negoex_MESSAGE(r, ndr->flags))] uint32 message_length; + GUID conversation_id; + [switch_is(type)] negoex_PAYLOAD p; + } negoex_MESSAGE; + + typedef [public,nopush,nopull,flag(NDR_NOALIGN)] struct { + uint32 count; + negoex_MESSAGE messages[count]; + } negoex_MESSAGE_ARRAY; +} diff --git a/librpc/idl/netlogon.idl b/librpc/idl/netlogon.idl new file mode 100644 index 0000000..383c7b5 --- /dev/null +++ b/librpc/idl/netlogon.idl @@ -0,0 +1,1888 @@ +/* + netlogon interface + much of this was derived from the ethereal sources - thanks to everyone + who contributed! +*/ + +import "misc.idl", "lsa.idl", "samr.idl", "security.idl", "nbt.idl"; + +#include "idl_types.h" + +cpp_quote("#define netr_DeltaEnum8Bit netr_DeltaEnum") +cpp_quote("#define netr_SamDatabaseID8Bit netr_SamDatabaseID") + +cpp_quote("#define ENC_CRC32 KERB_ENCTYPE_DES_CBC_CRC") +cpp_quote("#define ENC_RSA_MD5 KERB_ENCTYPE_DES_CBC_MD5") +cpp_quote("#define ENC_RC4_HMAC_MD5 KERB_ENCTYPE_RC4_HMAC_MD5") +cpp_quote("#define ENC_HMAC_SHA1_96_AES128 KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96") +cpp_quote("#define ENC_HMAC_SHA1_96_AES256 KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96") +cpp_quote("#define ENC_HMAC_SHA1_96_AES256_SK KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96_SK") +cpp_quote("#define ENC_FAST_SUPPORTED KERB_ENCTYPE_FAST_SUPPORTED") +cpp_quote("#define ENC_COMPOUND_IDENTITY_SUPPORTED KERB_ENCTYPE_COMPOUND_IDENTITY_SUPPORTED") +cpp_quote("#define ENC_CLAIMS_SUPPORTED KERB_ENCTYPE_CLAIMS_SUPPORTED") +cpp_quote("#define ENC_RESOURCE_SID_COMPRESSION_DISABLED KERB_ENCTYPE_RESOURCE_SID_COMPRESSION_DISABLED") +cpp_quote("#define NETLOGON_SERVER_PIPE_STATE_MAGIC 0x4f555358") + +cpp_quote("#define DS_SERVER_PDC NBT_SERVER_PDC") +cpp_quote("#define DS_SERVER_GC NBT_SERVER_GC") +cpp_quote("#define DS_SERVER_LDAP NBT_SERVER_LDAP") +cpp_quote("#define DS_SERVER_DS NBT_SERVER_DS") +cpp_quote("#define DS_SERVER_KDC NBT_SERVER_KDC") +cpp_quote("#define DS_SERVER_TIMESERV NBT_SERVER_TIMESERV") +cpp_quote("#define DS_SERVER_CLOSEST NBT_SERVER_CLOSEST") +cpp_quote("#define DS_SERVER_WRITABLE NBT_SERVER_WRITABLE") +cpp_quote("#define DS_SERVER_GOOD_TIMESERV NBT_SERVER_GOOD_TIMESERV") +cpp_quote("#define DS_SERVER_NDNC NBT_SERVER_NDNC") +cpp_quote("#define DS_SERVER_SELECT_SECRET_DOMAIN_6 NBT_SERVER_SELECT_SECRET_DOMAIN_6 /* 2008 / RODC */") +cpp_quote("#define DS_SERVER_FULL_SECRET_DOMAIN_6 NBT_SERVER_FULL_SECRET_DOMAIN_6 /* 2008 */") +cpp_quote("#define DS_SERVER_WEBSERV NBT_SERVER_ADS_WEB_SERVICE") +cpp_quote("#define DS_SERVER_DS_8 NBT_SERVER_DS_8 /* 2012 */") +cpp_quote("#define DS_SERVER_DS_9 NBT_SERVER_DS_9 /* 2012R2 */") +cpp_quote("#define DS_SERVER_DS_10 NBT_SERVER_DS_10 /* 2016 */") +cpp_quote("#define DS_DNS_CONTROLLER NBT_SERVER_HAS_DNS_NAME") +cpp_quote("#define DS_DNS_DOMAIN NBT_SERVER_IS_DEFAULT_NC") +cpp_quote("#define DS_DNS_FOREST_ROOT NBT_SERVER_FOREST_ROOT") + +[ + uuid("12345678-1234-abcd-ef00-01234567cffb"), + version(1.0), + endpoint("ncacn_np:[\\pipe\\netlogon]","ncacn_ip_tcp:","ncalrpc:"), + helper("../librpc/ndr/ndr_netlogon.h"), + ms_union, + pointer_default(unique) +] + +interface netlogon +{ + typedef bitmap samr_AcctFlags samr_AcctFlags; + typedef bitmap security_GroupAttrs security_GroupAttrs; + typedef enum netr_DeltaEnum8Bit netr_DeltaEnum8Bit; + typedef enum netr_SamDatabaseID8Bit netr_SamDatabaseID8Bit; + + /*****************/ + /* Function 0x00 */ + + typedef struct { + [string,charset(UTF16)] uint16 *account_name; + uint32 priv; + uint32 auth_flags; + uint32 logon_count; + uint32 bad_pw_count; + time_t last_logon; + time_t last_logoff; + time_t logoff_time; + time_t kickoff_time; + uint32 password_age; + time_t pw_can_change; + time_t pw_must_change; + [string,charset(UTF16)] uint16 *computer; + [string,charset(UTF16)] uint16 *domain; + [string,charset(UTF16)] uint16 *script_path; + uint32 unknown; + } netr_UasInfo; + + WERROR netr_LogonUasLogon( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in] [string,charset(UTF16)] uint16 *account_name, + [in] [string,charset(UTF16)] uint16 *workstation, + [out,ref] netr_UasInfo **info + ); + + + /*****************/ + /* Function 0x01 */ + + typedef struct { + uint32 duration; + uint16 logon_count; + } netr_UasLogoffInfo; + + WERROR netr_LogonUasLogoff( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in] [string,charset(UTF16)] uint16 *account_name, + [in] [string,charset(UTF16)] uint16 *workstation, + [out,ref] netr_UasLogoffInfo *info + ); + + + /*****************/ + /* 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 [public] struct { + dlong lockout_duration; + udlong reset_count; + uint32 bad_attempt_lockout; + uint32 dummy; + } netr_AcctLockStr; + + /* - MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT + * sets the NETLOGON_SERVER_TRUST_ACCOUNT user_flag + * - MSV1_0_UPDATE_LOGON_STATISTICS + * sets the logon time on network logon + * - MSV1_0_RETURN_USER_PARAMETERS + * sets the user parameters in the driveletter + * - MSV1_0_RETURN_PROFILE_PATH + * returns the profilepath in the driveletter and + * sets LOGON_PROFILE_PATH_RETURNED user_flag + */ + + typedef [public,bitmap32bit] bitmap { + MSV1_0_CLEARTEXT_PASSWORD_ALLOWED = 0x00000002, + MSV1_0_UPDATE_LOGON_STATISTICS = 0x00000004, + MSV1_0_RETURN_USER_PARAMETERS = 0x00000008, + MSV1_0_DONT_TRY_GUEST_ACCOUNT = 0x00000010, + MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT = 0x00000020, + MSV1_0_RETURN_PASSWORD_EXPIRY = 0x00000040, + MSV1_0_USE_CLIENT_CHALLENGE = 0x00000080, + MSV1_0_TRY_GUEST_ACCOUNT_ONLY = 0x00000100, + MSV1_0_RETURN_PROFILE_PATH = 0x00000200, + MSV1_0_TRY_SPECIFIED_DOMAIN_ONLY = 0x00000400, + MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT = 0x00000800, + MSV1_0_DISABLE_PERSONAL_FALLBACK = 0x00001000, + MSV1_0_ALLOW_FORCE_GUEST = 0x00002000, + MSV1_0_CLEARTEXT_PASSWORD_SUPPLIED = 0x00004000, + MSV1_0_USE_DOMAIN_FOR_ROUTING_ONLY = 0x00008000, + MSV1_0_ALLOW_MSVCHAPV2 = 0x00010000, + MSV1_0_S4U2SELF = 0x00020000, + MSV1_0_CHECK_LOGONHOURS_FOR_S4U = 0x00040000, + MSV1_0_SUBAUTHENTICATION_DLL_EX = 0x00100000 + } netr_LogonParameterControl; + + /* Summary of the of the Query and Response from Microsoft on + * the usage of logon_id in netr_IdendityInfo + * + * [REG:119013019612095] [MS-NRPC]: NETLOGON_LOGON_IDENTITY_INFO: Does + * the Reserved field have LogonId meaning? + * + * Questions: + * In NetrLogonSamLogonEx does the Reserved field + * (of NETLOGON_LOGON_IDENTITY_INFO) have LogonId meaning? + * + * What is a valid LogonID, and does have any audit usage? + * + * Samba is sending a constant "deadbeef" in hex and would like to + * understand any usage of this field. + * + * Response: + * The NRPC spec is accurate in defining the field as Reserved, and + * without protocol significance. In the header file in our source + * code, it is defined as LogonId and commented as such, but it’s + * effectively not used. This is probably why the API structure has + * that field name. It may have been intended as such but it’s not + * used. + * + * Samba now sends a random value in this field. + */ + typedef struct { + lsa_String domain_name; + netr_LogonParameterControl parameter_control; /* see MSV1_0_* */ + udlong logon_id; + lsa_String account_name; + lsa_String workstation; + } netr_IdentityInfo; + + typedef struct { + netr_IdentityInfo identity_info; + samr_Password lmpassword; + samr_Password ntpassword; + } netr_PasswordInfo; + + typedef [flag(NDR_PAHEX)] struct { + uint16 length; + [value(length)] uint16 size; + [size_is(length),length_is(length)] uint8 *data; + } netr_ChallengeResponse; + + typedef [flag(NDR_PAHEX)] struct { + netr_IdentityInfo identity_info; + uint8 challenge[8]; + netr_ChallengeResponse nt; + netr_ChallengeResponse lm; + } netr_NetworkInfo; + + typedef [flag(NDR_PAHEX)] struct { + netr_IdentityInfo identity_info; + lsa_String package_name; + uint32 length; + [size_is(length)] uint8 *data; + } netr_GenericInfo; + + typedef [public] enum { + NetlogonInteractiveInformation = 1, + NetlogonNetworkInformation = 2, + NetlogonServiceInformation = 3, + NetlogonGenericInformation = 4, + NetlogonInteractiveTransitiveInformation = 5, + NetlogonNetworkTransitiveInformation = 6, + NetlogonServiceTransitiveInformation = 7 + } netr_LogonInfoClass; + + typedef [public,switch_type(netr_LogonInfoClass)] union { + [case(NetlogonInteractiveInformation)] netr_PasswordInfo *password; + [case(NetlogonNetworkInformation)] netr_NetworkInfo *network; + [case(NetlogonServiceInformation)] netr_PasswordInfo *password; + [case(NetlogonGenericInformation)] netr_GenericInfo *generic; + [case(NetlogonInteractiveTransitiveInformation)] netr_PasswordInfo *password; + [case(NetlogonNetworkTransitiveInformation)] netr_NetworkInfo *network; + [case(NetlogonServiceTransitiveInformation)] netr_PasswordInfo *password; + [default]; + } netr_LogonLevel; + + typedef [public,flag(NDR_PAHEX)] struct { + uint8 key[16]; + } netr_UserSessionKey; + + typedef [public,flag(NDR_PAHEX)] struct { + uint8 key[8]; + } netr_LMSessionKey; + + /* Flags for user_flags below */ + typedef [public,bitmap32bit] bitmap { + NETLOGON_GUEST = 0x00000001, + NETLOGON_NOENCRYPTION = 0x00000002, + NETLOGON_CACHED_ACCOUNT = 0x00000004, + NETLOGON_USED_LM_PASSWORD = 0x00000008, + NETLOGON_EXTRA_SIDS = 0x00000020, + NETLOGON_SUBAUTH_SESSION_KEY = 0x00000040, + NETLOGON_SERVER_TRUST_ACCOUNT = 0x00000080, + NETLOGON_NTLMV2_ENABLED = 0x00000100, + NETLOGON_RESOURCE_GROUPS = 0x00000200, + NETLOGON_PROFILE_PATH_RETURNED = 0x00000400, + NETLOGON_GRACE_LOGON = 0x01000000 + } netr_UserFlags; + + typedef struct { + NTTIME logon_time; + NTTIME logoff_time; + NTTIME kickoff_time; + NTTIME last_password_change; + NTTIME allow_password_change; + NTTIME force_password_change; + lsa_String account_name; + lsa_String full_name; + lsa_String logon_script; + lsa_String profile_path; + lsa_String home_directory; + lsa_String home_drive; + uint16 logon_count; + uint16 bad_password_count; + uint32 rid; + uint32 primary_gid; + samr_RidWithAttributeArray groups; + netr_UserFlags user_flags; + [flag(NDR_SECRET)] netr_UserSessionKey key; + lsa_StringLarge logon_server; + lsa_StringLarge logon_domain; + dom_sid2 *domain_sid; + [flag(NDR_SECRET)] netr_LMSessionKey LMSessKey; + samr_AcctFlags acct_flags; + uint32 sub_auth_status; + NTTIME last_successful_logon; + NTTIME last_failed_logon; + uint32 failed_logon_count; + uint32 reserved; + } netr_SamBaseInfo; + + typedef struct { + netr_SamBaseInfo base; + } netr_SamInfo2; + + typedef [public] struct { + dom_sid2 *sid; + security_GroupAttrs attributes; + } 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; + [size_is(sidcount)] netr_SidAttr *sids; + /* + * On ndr_push: + * Should pointer values be allocated + * of sids[*].sid before the following ones? + * + * That's at least the case for + * PAC_LOGON_INFO. + */ + lsa_String dns_domainname; + lsa_String principal_name; + uint32 unknown4[20]; + } netr_SamInfo6; + + typedef struct { + uint32 pac_size; + [size_is(pac_size)] uint8 *pac; + lsa_String logon_domain; + lsa_String logon_server; + lsa_String principal_name; + uint32 auth_size; + [size_is(auth_size)] uint8 *auth; + netr_UserSessionKey user_session_key; + uint32 expansionroom[10]; + lsa_String unknown1; + lsa_String unknown2; + lsa_String unknown3; + lsa_String unknown4; + } netr_PacInfo; + + typedef [flag(NDR_PAHEX)] struct { + uint32 length; + [size_is(length)] uint8 *data; + } netr_GenericInfo2; + + typedef enum { + NetlogonValidationUasInfo = 1, + NetlogonValidationSamInfo = 2, + NetlogonValidationSamInfo2 = 3, + NetlogonValidationGenericInfo2 = 5, + NetlogonValidationSamInfo4 = 6 + } netr_ValidationInfoClass; + + typedef [public,switch_type(uint16)] union { + [case(NetlogonValidationSamInfo)] netr_SamInfo2 *sam2; + [case(NetlogonValidationSamInfo2)] netr_SamInfo3 *sam3; + [case(4)] netr_PacInfo *pac; + [case(NetlogonValidationGenericInfo2)] netr_GenericInfo2 *generic; + [case(NetlogonValidationSamInfo4)] netr_SamInfo6 *sam6; + [default]; + } netr_Validation; + + typedef [public, flag(NDR_PAHEX)] struct { + uint8 data[8]; + } netr_Credential; + + typedef [public] struct { + netr_Credential client_challenge; + netr_Credential server_challenge; + } netlogon_server_pipe_state; + + typedef [public] struct { + netr_Credential cred; + time_t timestamp; + } netr_Authenticator; + + [public] NTSTATUS netr_LogonSamLogon( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,unique] [string,charset(UTF16)] uint16 *computer_name, + [in,unique] netr_Authenticator *credential, + [in,out,unique] netr_Authenticator *return_authenticator, + [in] netr_LogonInfoClass logon_level, + [in,ref] [switch_is(logon_level)] netr_LogonLevel *logon, + [in] uint16 validation_level, + [out,ref] [switch_is(validation_level)] netr_Validation *validation, + [out,ref] uint8 *authoritative + ); + + + /*****************/ + /* Function 0x03 */ + + NTSTATUS netr_LogonSamLogoff( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,unique] [string,charset(UTF16)] uint16 *computer_name, + [in,unique] netr_Authenticator *credential, + [in,out,unique] netr_Authenticator *return_authenticator, + [in] netr_LogonInfoClass logon_level, + [in] [switch_is(logon_level)] netr_LogonLevel logon + ); + + + + /*****************/ + /* Function 0x04 */ + + [public] NTSTATUS netr_ServerReqChallenge( + [in,unique,string,charset(UTF16)] uint16 *server_name, + [in,string,charset(UTF16)] uint16 *computer_name, + [in,ref] netr_Credential *credentials, + [out,ref] netr_Credential *return_credentials + ); + + + /*****************/ + /* Function 0x05 */ + + typedef enum netr_SchannelType netr_SchannelType; + + NTSTATUS netr_ServerAuthenticate( + [in,unique,string,charset(UTF16)] uint16 *server_name, + [in,string,charset(UTF16)] uint16 *account_name, + [in] netr_SchannelType secure_channel_type, + [in,string,charset(UTF16)] uint16 *computer_name, + [in,ref] netr_Credential *credentials, + [out,ref] netr_Credential *return_credentials + ); + + + /*****************/ + /* Function 0x06 */ + + NTSTATUS netr_ServerPasswordSet( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in] [string,charset(UTF16)] uint16 *account_name, + [in] netr_SchannelType secure_channel_type, + [in] [string,charset(UTF16)] uint16 *computer_name, + [in,ref] netr_Authenticator *credential, + [out,ref] netr_Authenticator *return_authenticator, + [in,ref] samr_Password *new_password + ); + + + /*****************/ + /* Function 0x07 */ + + typedef enum netr_SamDatabaseID netr_SamDatabaseID; + + typedef struct { + [string,charset(UTF16)] uint16 *account_name; + lsa_String unknown1; + lsa_String unknown2; + lsa_String unknown3; + lsa_String unknown4; + uint32 unknown5; + uint32 unknown6; + uint32 unknown7; + uint32 unknown8; + } netr_DELTA_DELETE_USER; + + typedef struct { + uint16 length; + [value(length)] uint16 size; + uint32 flags; + samr_Password pwd; + } netr_USER_KEY16; + + typedef struct { + uint16 nt_length; + [value(nt_length)] uint16 nt_size; + uint32 nt_flags; + uint16 lm_length; + [value(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 history; + } netr_USER_KEYS2; + + typedef struct { /* TODO: make this a union! */ + netr_USER_KEYS2 keys2; + } netr_USER_KEY_UNION; + + typedef [public] struct { + uint32 version; + netr_USER_KEY_UNION keys; + } netr_USER_KEYS; + + typedef struct { + boolean8 SensitiveDataFlag; + uint32 DataLength; + + /* netr_USER_KEYS encrypted with the session key */ + [size_is(DataLength)][flag(NDR_PAHEX)] uint8 *SensitiveData; + } netr_USER_PRIVATE_INFO; + + typedef struct { + lsa_String account_name; + lsa_String full_name; + uint32 rid; + uint32 primary_gid; + lsa_String home_directory; + lsa_String home_drive; + lsa_String logon_script; + lsa_String description; + lsa_String workstations; + 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; + boolean8 nt_password_present; + boolean8 lm_password_present; + boolean8 password_expired; + lsa_String comment; + lsa_BinaryString parameters; + uint16 country_code; + uint16 code_page; + netr_USER_PRIVATE_INFO user_private_info; + uint32 SecurityInformation; + sec_desc_buf sdbuf; + lsa_String profile_path; + lsa_String unknown2; + lsa_String unknown3; + lsa_String unknown4; + uint32 unknown5; + uint32 unknown6; + uint32 unknown7; + uint32 unknown8; + } netr_DELTA_USER; + + typedef struct { + lsa_String domain_name; + lsa_String oem_information; /* comment */ + dlong 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; + sec_desc_buf sdbuf; + lsa_BinaryString account_lockout; + lsa_String unknown2; + lsa_String unknown3; + lsa_String unknown4; + uint32 logon_to_chgpass; + uint32 unknown6; + uint32 unknown7; + uint32 unknown8; + } netr_DELTA_DOMAIN; + + typedef struct { + lsa_String group_name; + uint32 rid; + uint32 attributes; + lsa_String description; + uint32 SecurityInformation; + sec_desc_buf sdbuf; + lsa_String unknown1; + lsa_String unknown2; + lsa_String unknown3; + lsa_String unknown4; + uint32 unknown5; + uint32 unknown6; + uint32 unknown7; + uint32 unknown8; + } netr_DELTA_GROUP; + + typedef struct { + lsa_String OldName; + lsa_String NewName; + lsa_String unknown1; + lsa_String unknown2; + lsa_String unknown3; + lsa_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 unknown1; + uint32 unknown2; + uint32 unknown3; + uint32 unknown4; + } netr_DELTA_GROUP_MEMBER; + + typedef struct { + lsa_String alias_name; + uint32 rid; + uint32 SecurityInformation; + sec_desc_buf sdbuf; + lsa_String description; + lsa_String unknown2; + lsa_String unknown3; + lsa_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; + uint32 minimumworkingsetsize; + uint32 maximumworkingsetsize; + uint32 pagefilelimit; + NTTIME timelimit; + } netr_QUOTA_LIMITS; + + typedef struct { + uint32 maxlogsize; + NTTIME auditretentionperiod; + boolean8 auditingmode; + uint32 maxauditeventcount; + [size_is(maxauditeventcount+1)] uint32 *eventauditoptions; + lsa_String primary_domain_name; + dom_sid2 *sid; + netr_QUOTA_LIMITS quota_limits; + udlong sequence_num; + NTTIME db_create_time; + uint32 SecurityInformation; + sec_desc_buf sdbuf; + lsa_String unknown1; + lsa_String unknown2; + lsa_String unknown3; + lsa_String unknown4; + uint32 unknown5; + uint32 unknown6; + uint32 unknown7; + uint32 unknown8; + } netr_DELTA_POLICY; + + typedef struct { + lsa_String domain_name; + uint32 num_controllers; + [size_is(num_controllers)] lsa_String *controller_names; + uint32 SecurityInformation; + sec_desc_buf sdbuf; + lsa_String unknown1; + lsa_String unknown2; + lsa_String unknown3; + lsa_String unknown4; + uint32 posix_offset; + uint32 unknown6; + uint32 unknown7; + uint32 unknown8; + } netr_DELTA_TRUSTED_DOMAIN; + + typedef struct { + uint32 privilege_entries; + uint32 privilege_control; + [size_is(privilege_entries)] uint32 *privilege_attrib; + [size_is(privilege_entries)] lsa_String *privilege_name; + netr_QUOTA_LIMITS quotalimits; + uint32 system_flags; + uint32 SecurityInformation; + sec_desc_buf sdbuf; + lsa_String unknown1; + lsa_String unknown2; + lsa_String unknown3; + lsa_String unknown4; + uint32 unknown5; + uint32 unknown6; + uint32 unknown7; + uint32 unknown8; + } netr_DELTA_ACCOUNT; + + typedef struct { + uint32 len; + uint32 maxlen; + [size_is(maxlen)][length_is(len)] uint8 *cipher_data; + } netr_CIPHER_VALUE; + + typedef struct { + netr_CIPHER_VALUE current_cipher; + NTTIME current_cipher_set_time; + netr_CIPHER_VALUE old_cipher; + NTTIME old_cipher_set_time; + uint32 SecurityInformation; + sec_desc_buf sdbuf; + lsa_String unknown1; + lsa_String unknown2; + lsa_String unknown3; + lsa_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)] ; /* sid only */ + [case(NETR_DELTA_ACCOUNT)] netr_DELTA_ACCOUNT *account; + [case(NETR_DELTA_DELETE_ACCOUNT)] ; /* sid only */ + [case(NETR_DELTA_SECRET)] netr_DELTA_SECRET *secret; + [case(NETR_DELTA_DELETE_SECRET)] ; /* name only */ + [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; + [default]; + } 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)] [string,charset(UTF16)] uint16 *name; + [case(NETR_DELTA_DELETE_SECRET)] [string,charset(UTF16)] uint16 *name; + [case(NETR_DELTA_DELETE_GROUP2)] uint32 rid; + [case(NETR_DELTA_DELETE_USER2)] uint32 rid; + [case(NETR_DELTA_MODIFY_COUNT)] ; + [default]; + } 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)] netr_DELTA_ENUM *delta_enum; + } netr_DELTA_ENUM_ARRAY; + + NTSTATUS netr_DatabaseDeltas( + [in] [string,charset(UTF16)] uint16 *logon_server, + [in] [string,charset(UTF16)] uint16 *computername, + [in,ref] netr_Authenticator *credential, + [in,out,ref] netr_Authenticator *return_authenticator, + [in] netr_SamDatabaseID database_id, + [in,out,ref] udlong *sequence_num, + [out,ref] netr_DELTA_ENUM_ARRAY **delta_enum_array, + [in] uint32 preferredmaximumlength + ); + + + /*****************/ + /* Function 0x08 */ + + NTSTATUS netr_DatabaseSync( + [in] [string,charset(UTF16)] uint16 *logon_server, + [in] [string,charset(UTF16)] uint16 *computername, + [in,ref] netr_Authenticator *credential, + [in,out,ref] netr_Authenticator *return_authenticator, + [in] netr_SamDatabaseID database_id, + [in,out,ref] uint32 *sync_context, + [out,ref] netr_DELTA_ENUM_ARRAY **delta_enum_array, + [in] uint32 preferredmaximumlength + ); + + + /*****************/ + /* 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; + } netr_UAS_INFO_0; + + typedef struct { + [flag(NDR_REMAINING)] DATA_BLOB blob; + } netr_AccountBuffer; + + NTSTATUS netr_AccountDeltas( + [in,unique] [string,charset(UTF16)] uint16 *logon_server, + [in] [string,charset(UTF16)] uint16 *computername, + [in] netr_Authenticator credential, + [in,out,ref] netr_Authenticator *return_authenticator, + [in] netr_UAS_INFO_0 uas, + [in] uint32 count, + [in] uint32 level, + [in] uint32 buffersize, + [out,ref,subcontext(4)] netr_AccountBuffer *buffer, + [out,ref] uint32 *count_returned, + [out,ref] uint32 *total_entries, + [out,ref] netr_UAS_INFO_0 *recordid + ); + + + /*****************/ + /* Function 0x0A */ + + NTSTATUS netr_AccountSync( + [in,unique] [string,charset(UTF16)] uint16 *logon_server, + [in] [string,charset(UTF16)] uint16 *computername, + [in] netr_Authenticator credential, + [in,out,ref] netr_Authenticator *return_authenticator, + [in] uint32 reference, + [in] uint32 level, + [in] uint32 buffersize, + [out,ref,subcontext(4)] netr_AccountBuffer *buffer, + [out,ref] uint32 *count_returned, + [out,ref] uint32 *total_entries, + [out,ref] uint32 *next_reference, + [in,out,ref] netr_UAS_INFO_0 *recordid + ); + + + /*****************/ + /* Function 0x0B */ + + WERROR netr_GetDcName( + [in] [string,charset(UTF16)] uint16 *logon_server, + [in,unique] [string,charset(UTF16)] uint16 *domainname, + [out,ref] [string,charset(UTF16)] uint16 **dcname + ); + + /*****************/ + /* Function 0x0C */ + + typedef [bitmap32bit] bitmap { + NETLOGON_REPLICATION_NEEDED = 0x00000001, + NETLOGON_REPLICATION_IN_PROGRESS = 0x00000002, + NETLOGON_FULL_SYNC_REPLICATION = 0x00000004, + NETLOGON_REDO_NEEDED = 0x00000008, + NETLOGON_HAS_IP = 0x00000010, + NETLOGON_HAS_TIMESERV = 0x00000020, + NETLOGON_DNS_UPDATE_FAILURE = 0x00000040, + NETLOGON_VERIFY_STATUS_RETURNED = 0x00000080 + } netr_InfoFlags; + + typedef struct { + netr_InfoFlags flags; + WERROR pdc_connection_status; + } netr_NETLOGON_INFO_1; + + typedef struct { + netr_InfoFlags flags; + WERROR pdc_connection_status; + [string,charset(UTF16)] uint16 *trusted_dc_name; + WERROR tc_connection_status; + } netr_NETLOGON_INFO_2; + + typedef struct { + netr_InfoFlags flags; + uint32 logon_attempts; + uint32 unknown1; + uint32 unknown2; + uint32 unknown3; + uint32 unknown4; + uint32 unknown5; + } netr_NETLOGON_INFO_3; + + typedef struct { + [string,charset(UTF16)] uint16 *trusted_dc_name; + [string,charset(UTF16)] uint16 *trusted_domain_name; + } netr_NETLOGON_INFO_4; + + typedef [public] union { + [case(1)] netr_NETLOGON_INFO_1 *info1; + [case(2)] netr_NETLOGON_INFO_2 *info2; + [case(3)] netr_NETLOGON_INFO_3 *info3; + [case(4)] netr_NETLOGON_INFO_4 *info4; + [default] ; + } netr_CONTROL_QUERY_INFORMATION; + + /* function_code values */ + typedef [v1_enum,public] enum { + NETLOGON_CONTROL_QUERY = 0x00000001, + NETLOGON_CONTROL_REPLICATE = 0x00000002, + NETLOGON_CONTROL_SYNCHRONIZE = 0x00000003, + NETLOGON_CONTROL_PDC_REPLICATE = 0x00000004, + NETLOGON_CONTROL_REDISCOVER = 0x00000005, + NETLOGON_CONTROL_TC_QUERY = 0x00000006, + NETLOGON_CONTROL_TRANSPORT_NOTIFY = 0x00000007, + NETLOGON_CONTROL_FIND_USER = 0x00000008, + NETLOGON_CONTROL_CHANGE_PASSWORD = 0x00000009, + NETLOGON_CONTROL_TC_VERIFY = 0x0000000A, + NETLOGON_CONTROL_FORCE_DNS_REG = 0x0000000B, + NETLOGON_CONTROL_QUERY_DNS_REG = 0x0000000C, + NETLOGON_CONTROL_BACKUP_CHANGE_LOG = 0x0000FFFC, + NETLOGON_CONTROL_TRUNCATE_LOG = 0x0000FFFD, + NETLOGON_CONTROL_SET_DBFLAG = 0x0000FFFE, + NETLOGON_CONTROL_BREAKPOINT = 0x0000FFFF + } netr_LogonControlCode; + + WERROR netr_LogonControl( + [in,unique] [string,charset(UTF16)] uint16 *logon_server, + [in] netr_LogonControlCode function_code, + [in] uint32 level, + [out,ref,switch_is(level)] netr_CONTROL_QUERY_INFORMATION *query + ); + + + /*****************/ + /* Function 0x0D */ + + WERROR netr_GetAnyDCName( + [in,unique] [string,charset(UTF16)] uint16 *logon_server, + [in,unique] [string,charset(UTF16)] uint16 *domainname, + [out,ref] [string,charset(UTF16)] uint16 **dcname + ); + + + /*****************/ + /* Function 0x0E */ + + typedef [public,switch_type(netr_LogonControlCode)] union { + [case(NETLOGON_CONTROL_REDISCOVER)] [string,charset(UTF16)] uint16 *domain; + [case(NETLOGON_CONTROL_TC_QUERY)] [string,charset(UTF16)] uint16 *domain; + [case(NETLOGON_CONTROL_TRANSPORT_NOTIFY)] [string,charset(UTF16)] uint16 *domain; + [case(NETLOGON_CONTROL_CHANGE_PASSWORD)] [string,charset(UTF16)] uint16 *domain; + [case(NETLOGON_CONTROL_TC_VERIFY)] [string,charset(UTF16)] uint16 *domain; + [case(NETLOGON_CONTROL_FIND_USER)] [string,charset(UTF16)] uint16 *user; + [case(NETLOGON_CONTROL_SET_DBFLAG)] uint32 debug_level; + [default] ; + } netr_CONTROL_DATA_INFORMATION; + + WERROR netr_LogonControl2( + [in,unique] [string,charset(UTF16)] uint16 *logon_server, + [in] netr_LogonControlCode function_code, + [in] uint32 level, + [in,ref][switch_is(function_code)] netr_CONTROL_DATA_INFORMATION *data, + [out,ref][switch_is(level)] netr_CONTROL_QUERY_INFORMATION *query + ); + + + /* If NETLOGON_NEG_ARCFOUR flag is not set, then the passwords and LM + * session keys are encrypted with DES calls. (And the user session key + * is unencrypted) */ + + /*****************/ + /* Function 0x0F */ + + typedef [public,bitmap32bit] bitmap { + NETLOGON_NEG_ACCOUNT_LOCKOUT = 0x00000001, + NETLOGON_NEG_PERSISTENT_SAMREPL = 0x00000002, + NETLOGON_NEG_ARCFOUR = 0x00000004, + NETLOGON_NEG_PROMOTION_COUNT = 0x00000008, + NETLOGON_NEG_CHANGELOG_BDC = 0x00000010, + NETLOGON_NEG_FULL_SYNC_REPL = 0x00000020, + NETLOGON_NEG_MULTIPLE_SIDS = 0x00000040, + NETLOGON_NEG_REDO = 0x00000080, + NETLOGON_NEG_PASSWORD_CHANGE_REFUSAL = 0x00000100, + NETLOGON_NEG_SEND_PASSWORD_INFO_PDC = 0x00000200, + NETLOGON_NEG_GENERIC_PASSTHROUGH = 0x00000400, + NETLOGON_NEG_CONCURRENT_RPC = 0x00000800, + NETLOGON_NEG_AVOID_ACCOUNT_DB_REPL = 0x00001000, + NETLOGON_NEG_AVOID_SECURITYAUTH_DB_REPL = 0x00002000, + NETLOGON_NEG_STRONG_KEYS = 0x00004000, + NETLOGON_NEG_TRANSITIVE_TRUSTS = 0x00008000, + NETLOGON_NEG_DNS_DOMAIN_TRUSTS = 0x00010000, + NETLOGON_NEG_PASSWORD_SET2 = 0x00020000, + NETLOGON_NEG_GETDOMAININFO = 0x00040000, + NETLOGON_NEG_CROSS_FOREST_TRUSTS = 0x00080000, + NETLOGON_NEG_NEUTRALIZE_NT4_EMULATION = 0x00100000, + NETLOGON_NEG_RODC_PASSTHROUGH = 0x00200000, + NETLOGON_NEG_SUPPORTS_AES_SHA2 = 0x00400000, + NETLOGON_NEG_SUPPORTS_AES = 0x01000000, + NETLOGON_NEG_AUTHENTICATED_RPC_LSASS = 0x20000000, + NETLOGON_NEG_AUTHENTICATED_RPC = 0x40000000 + } netr_NegotiateFlags; + + const uint32 NETLOGON_NEG_128BIT = NETLOGON_NEG_STRONG_KEYS; + const uint32 NETLOGON_NEG_SCHANNEL = NETLOGON_NEG_AUTHENTICATED_RPC; + + NTSTATUS netr_ServerAuthenticate2( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in] [string,charset(UTF16)] uint16 *account_name, + [in] netr_SchannelType secure_channel_type, + [in] [string,charset(UTF16)] uint16 *computer_name, + [in,ref] netr_Credential *credentials, + [out,ref] netr_Credential *return_credentials, + [in,out,ref] netr_NegotiateFlags *negotiate_flags + ); + + + /*****************/ + /* Function 0x10 */ + + typedef enum { + SYNCSTATE_NORMAL_STATE = 0, + SYNCSTATE_DOMAIN_STATE = 1, + SYNCSTATE_GROUP_STATE = 2, + SYNCSTATE_UAS_BUILT_IN_GROUP_STATE = 3, + SYNCSTATE_USER_STATE = 4, + SYNCSTATE_GROUP_MEMBER_STATE = 5, + SYNCSTATE_ALIAS_STATE = 6, + SYNCSTATE_ALIAS_MEMBER_STATE = 7, + SYNCSTATE_SAM_DONE_STATE = 8 + } SyncStateEnum; + + NTSTATUS netr_DatabaseSync2( + [in] [string,charset(UTF16)] uint16 *logon_server, + [in] [string,charset(UTF16)] uint16 *computername, + [in,ref] netr_Authenticator *credential, + [in,out,ref] netr_Authenticator *return_authenticator, + [in] netr_SamDatabaseID database_id, + [in] SyncStateEnum restart_state, + [in,out,ref] uint32 *sync_context, + [out,ref] netr_DELTA_ENUM_ARRAY **delta_enum_array, + [in] uint32 preferredmaximumlength + ); + + + /*****************/ + /* Function 0x11 */ + + /* i'm not at all sure how this call works */ + + typedef [bitmap16bit] bitmap { + NETR_CHANGELOG_IMMEDIATE_REPL_REQUIRED = 0x0001, + NETR_CHANGELOG_CHANGED_PASSWORD = 0x0002, + NETR_CHANGELOG_SID_INCLUDED = 0x0004, + NETR_CHANGELOG_NAME_INCLUDED = 0x0008, + NETR_CHANGELOG_FIRST_PROMOTION_OBJ = 0x0010 + } netr_ChangeLogFlags; + + typedef [nodiscriminant] union { + [case(NETR_CHANGELOG_SID_INCLUDED)] dom_sid object_sid; + [case(NETR_CHANGELOG_NAME_INCLUDED)] nstring object_name; + [default]; + } netr_ChangeLogObject; + + typedef [public,gensize] struct { + uint32 serial_number1; + uint32 serial_number2; + uint32 object_rid; + netr_ChangeLogFlags flags; + netr_SamDatabaseID8Bit db_index; + netr_DeltaEnum8Bit delta_type; + [switch_is(flags & (NETR_CHANGELOG_SID_INCLUDED|NETR_CHANGELOG_NAME_INCLUDED))] netr_ChangeLogObject object; + } netr_ChangeLogEntry; + + NTSTATUS netr_DatabaseRedo( + [in] [string,charset(UTF16)] uint16 *logon_server, + [in] [string,charset(UTF16)] uint16 *computername, + [in] netr_Authenticator *credential, + [in,out,ref] netr_Authenticator *return_authenticator, + /* + * we cannot use subcontext_size() here, as + * change_log_entry_size is encoded after the subcontext + */ + [in] [subcontext(4)/*,subcontext_size(change_log_entry_size)*/] + netr_ChangeLogEntry change_log_entry, + [in] [value(ndr_size_netr_ChangeLogEntry(&change_log_entry, + ndr->flags))] + uint32 change_log_entry_size, + [out,ref] netr_DELTA_ENUM_ARRAY **delta_enum_array + ); + + + /*****************/ + /* Function 0x12 */ + + WERROR netr_LogonControl2Ex( + [in,unique] [string,charset(UTF16)] uint16 *logon_server, + [in] netr_LogonControlCode function_code, + [in] uint32 level, + [in,ref][switch_is(function_code)] netr_CONTROL_DATA_INFORMATION *data, + [out,ref][switch_is(level)] netr_CONTROL_QUERY_INFORMATION *query + ); + + /*****************/ + /* Function 0x13 */ + typedef struct { + uint32 length; + [size_is(length)] uint8 *data; + } netr_Blob; + + NTSTATUS netr_NetrEnumerateTrustedDomains( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [out,ref] netr_Blob *trusted_domains_blob + ); + + /*****************/ + /* Function 0x14 */ + + /* one unknown bit still: DS_IP_VERSION_AGNOSTIC - gd*/ + + const int DSGETDC_VALID_FLAGS = (DS_FORCE_REDISCOVERY | + DS_DIRECTORY_SERVICE_REQUIRED | + DS_DIRECTORY_SERVICE_PREFERRED | + DS_GC_SERVER_REQUIRED | + DS_PDC_REQUIRED | + DS_BACKGROUND_ONLY | + DS_IP_REQUIRED | + DS_KDC_REQUIRED | + DS_TIMESERV_REQUIRED | + DS_WRITABLE_REQUIRED | + DS_GOOD_TIMESERV_PREFERRED | + DS_AVOID_SELF | + DS_ONLY_LDAP_NEEDED | + DS_IS_FLAT_NAME | + DS_IS_DNS_NAME | + DS_TRY_NEXTCLOSEST_SITE | + DS_DIRECTORY_SERVICE_6_REQUIRED | + DS_WEB_SERVICE_REQUIRED | + DS_DIRECTORY_SERVICE_8_REQUIRED | + DS_DIRECTORY_SERVICE_9_REQUIRED | + DS_DIRECTORY_SERVICE_10_REQUIRED | + DS_RETURN_FLAT_NAME | + DS_RETURN_DNS_NAME); + + typedef [bitmap32bit] bitmap { + DS_FORCE_REDISCOVERY = 0x00000001, + DS_DIRECTORY_SERVICE_REQUIRED = 0x00000010, + DS_DIRECTORY_SERVICE_PREFERRED = 0x00000020, + DS_GC_SERVER_REQUIRED = 0x00000040, + DS_PDC_REQUIRED = 0x00000080, + DS_BACKGROUND_ONLY = 0x00000100, + DS_IP_REQUIRED = 0x00000200, + DS_KDC_REQUIRED = 0x00000400, + DS_TIMESERV_REQUIRED = 0x00000800, + DS_WRITABLE_REQUIRED = 0x00001000, + DS_GOOD_TIMESERV_PREFERRED = 0x00002000, + DS_AVOID_SELF = 0x00004000, + DS_ONLY_LDAP_NEEDED = 0x00008000, + DS_IS_FLAT_NAME = 0x00010000, + DS_IS_DNS_NAME = 0x00020000, + DS_TRY_NEXTCLOSEST_SITE = 0x00040000, + DS_DIRECTORY_SERVICE_6_REQUIRED = 0x00080000, /* 2008 */ + DS_WEB_SERVICE_REQUIRED = 0x00100000, + DS_DIRECTORY_SERVICE_8_REQUIRED = 0x00200000, /* 2012 */ + DS_DIRECTORY_SERVICE_9_REQUIRED = 0x00400000, /* 2012R2 */ + DS_DIRECTORY_SERVICE_10_REQUIRED= 0x00800000, /* 2016 */ + DS_RETURN_DNS_NAME = 0x40000000, + DS_RETURN_FLAT_NAME = 0x80000000 + } netr_DsRGetDCName_flags; + + typedef [v1_enum] enum { + DS_ADDRESS_TYPE_INET = 1, + DS_ADDRESS_TYPE_NETBIOS = 2 + } netr_DsRGetDCNameInfo_AddressType; + + typedef [public] struct { + [string,charset(UTF16)] uint16 *dc_unc; + [string,charset(UTF16)] uint16 *dc_address; + netr_DsRGetDCNameInfo_AddressType dc_address_type; + GUID domain_guid; + [string,charset(UTF16)] uint16 *domain_name; + [string,charset(UTF16)] uint16 *forest_name; + nbt_server_type dc_flags; + [string,charset(UTF16)] uint16 *dc_site_name; + [string,charset(UTF16)] uint16 *client_site_name; + } netr_DsRGetDCNameInfo; + + WERROR netr_DsRGetDCName( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in,unique] [string,charset(UTF16)] uint16 *domain_name, + [in,unique] GUID *domain_guid, + [in,unique] GUID *site_guid, + [in] netr_DsRGetDCName_flags flags, + [out,ref] netr_DsRGetDCNameInfo **info + ); + + /*****************/ + /* Function 0x15 */ + typedef [switch_type(uint32)] union { + [case(1)] netr_NegotiateFlags server_capabilities; + [case(2)] netr_NegotiateFlags server_capabilities; + } netr_Capabilities; + + NTSTATUS netr_LogonGetCapabilities( + [in] [string,charset(UTF16)] uint16 *server_name, + [in,unique] [string,charset(UTF16)] uint16 *computer_name, + [in,ref] netr_Authenticator *credential, + [in,out,ref] netr_Authenticator *return_authenticator, + [in] uint32 query_level, + [out,ref,switch_is(query_level)] netr_Capabilities *capabilities + ); + + /****************/ + /* Function 0x16 */ + [todo] WERROR netr_NETRLOGONSETSERVICEBITS(); + + /****************/ + /* Function 0x17 */ + WERROR netr_LogonGetTrustRid( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,unique] [string,charset(UTF16)] uint16 *domain_name, + [out,ref] uint32 *rid + ); + + /****************/ + /* Function 0x18 */ + [todo] WERROR netr_NETRLOGONCOMPUTESERVERDIGEST(); + + /****************/ + /* Function 0x19 */ + [todo] WERROR netr_NETRLOGONCOMPUTECLIENTDIGEST(); + + /****************/ + /* Function 0x1a */ + [public] NTSTATUS netr_ServerAuthenticate3( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in] [string,charset(UTF16)] uint16 *account_name, + [in] netr_SchannelType secure_channel_type, + [in] [string,charset(UTF16)] uint16 *computer_name, + [in,ref] netr_Credential *credentials, + [out,ref] netr_Credential *return_credentials, + [in,out,ref] netr_NegotiateFlags *negotiate_flags, + [out,ref] uint32 *rid + ); + + /****************/ + /* Function 0x1b */ + + WERROR netr_DsRGetDCNameEx( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in,unique] [string,charset(UTF16)] uint16 *domain_name, + [in,unique] GUID *domain_guid, + [in,unique] [string,charset(UTF16)] uint16 *site_name, + [in] netr_DsRGetDCName_flags flags, + [out,ref] netr_DsRGetDCNameInfo **info + ); + + + /****************/ + /* Function 0x1c */ + WERROR netr_DsRGetSiteName( + [in,unique] [string,charset(UTF16)] uint16 *computer_name, + [out,ref] [string,charset(UTF16)] uint16 **site + ); + + /****************/ + /* Function 0x1d */ + typedef [public,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_TRUST_FLAG_MIT_KRB5 = 0x00000080, + NETR_TRUST_FLAG_AES = 0x00000100 + } netr_TrustFlags; + + typedef [bitmap32bit] bitmap { + NETR_WS_FLAG_HANDLES_INBOUND_TRUSTS = 0x00000001, + NETR_WS_FLAG_HANDLES_SPN_UPDATE = 0x00000002 + } netr_WorkstationFlags; + + typedef [bitmap16bit] bitmap { + NETR_VER_SUITE_BACKOFFICE = 0x0004, + NETR_VER_SUITE_BLADE = 0x0400, + NETR_VER_SUITE_COMPUTE_SERVER = 0x4000, + NETR_VER_SUITE_DATACENTER = 0x0080, + NETR_VER_SUITE_ENTERPRISE = 0x0002, + NETR_VER_SUITE_EMBEDDEDNT = 0x0040, + NETR_VER_SUITE_PERSONAL = 0x0200, + NETR_VER_SUITE_SINGLEUSERTS = 0x0100, + NETR_VER_SUITE_SMALLBUSINESS = 0x0001, + NETR_VER_SUITE_SMALLBUSINESS_RESTRICTED = 0x0020, + NETR_VER_SUITE_STORAGE_SERVER = 0x2000, + NETR_VER_SUITE_TERMINAL = 0x0010, + NETR_VER_SUITE_WH_SERVER = 0x8000 + } netr_SuiteMask; + + typedef [bitmap8bit] bitmap { + NETR_VER_NT_DOMAIN_CONTROLLER = 0x02, + NETR_VER_NT_SERVER = 0x03, + NETR_VER_NT_WORKSTATION = 0x01 + } netr_ProductType; + + typedef struct { + uint32 policy_size; + [size_is(policy_size)] uint8 *policy; + } netr_LsaPolicyInformation; + + typedef struct { + [value(284)] uint32 OSVersionInfoSize; + /* + * [MS-NRPC] 2.2.1.3.15 NL_OSVERSIONINFO_V1 + * + * 4 The operating system is Windows NT 4.0. + * 5 The operating system is + * Windows 2000, + * Windows XP, + * Windows Server 2003, or + * Windows Server 2003 R2 operating system. + * 6 The operating system is + * Windows Vista, Windows Server 2008, + * Windows 7, Windows Server 2008 R2, + * Windows 8, Windows Server 2012, + * Windows 8.1, or Windows Server 2012 R2. + * 10 The operating system is + * Windows 10 and later. + */ + uint32 MajorVersion; + /* + * [MS-NRPC] 2.2.1.3.15 NL_OSVERSIONINFO_V1 + * + * 0 The operating system is + * Windows NT 4.0, Windows 2000, + * Windows Vista, Windows Server 2008, + * Windows 10, Windows Server 2016, and later. + * 1 The operating system is + * Windows XP, Windows 7, or Windows Server 2008 R2. + * 2 The operating system is + * Windows XP Professional x64 Edition operating system, + * Windows Server 2003, Windows Server 2003 R2, + * Windows 8, or Windows Server 2012. + * 3 The operating system is + * Windows 8.1 or Windows Server 2012 R2. + * + * I guess this results in: + * + * Windows Server 2022 => 10.0 (20348) + * Windows Server 2019 => 10.0 + * Windows Server operating system => 10.0 + * Windows 10 and Windows Server 2016 => 10.0 (14393) + * Windows 8.1 and Windows Server 2012 R2 => 6.3 (9600) + * Windows 8 and Windows Server 2012 => 6.2 + * Windows 7 and Windows Server 2008 R2 => 6.1 (7600) + * Windows Vista and Windows Server 2008 => 6.0 + * Windows XP operating system Service Pack 1 (SP1) => 5.2 + * Windows XP and Windows Server 2003 => 5.1 + * Windows 2000 => 5.0 + * Windows NT 4.0 => 4.0 + */ + uint32 MinorVersion; + /* + * From [MS-RPRN] 7 Appendix B: Product Behavior: + * + * Windows Server 2019 >= 17633 + * Windows Server operating system >= 16299 + * Windows 10 and Windows Server 2016 >= 10586 + * Windows 8.1 and Windows Server 2012 R2 >= 9431 + * Windows 8 and Windows Server 2012 >= 9200 + * Windows 7 and Windows Server 2008 R2 >= 7007 + * Windows Vista operating system with Service Pack 1 (SP1) and + * Windows Server 2008 >= 6001 + * Windows Vista and Windows Server 2008 >= 6000 + * Windows XP operating system Service Pack 1 (SP1) >= 2196 + * Windows XP and Windows Server 2003 >= 2196 + * Windows 2000 >= 1382 + * Windows NT 4.0 >= 1381 + * + * From testing: + * Windows Server 2022 => 10.0 (20348) + */ + uint32 BuildNumber; + uint32 PlatformId; + [subcontext(0),subcontext_size(256)] nstring CSDVersion; + uint16 ServicePackMajor; + uint16 ServicePackMinor; + netr_SuiteMask SuiteMask; + netr_ProductType ProductType; + uint8 Reserved; + } netr_OsVersionInfoEx; + + typedef struct { + /* these first 3 values come from the fact windows + actually encodes this structure as a UNICODE_STRING + - see MS-NRPC section 2.2.1.3.9 */ + /* 142 * 2 = 284 (length of structure "netr_OsVersionInfoEx") */ + [value(142)] uint3264 length; + [value(0)] uint3264 dummy; + [value(142)] uint3264 size; + [subcontext(0),subcontext_size(size*2)] + netr_OsVersionInfoEx os; + } netr_OsVersion; + + typedef struct { + /* value is 284 when info != os, otherwise 0 (for length and + size) */ + [value(os == NULL ? 0 : 284)] uint16 length; + [value(os == NULL ? 0 : 284)] uint16 size; + netr_OsVersion *os; + } netr_OsVersionContainer; + + typedef struct { + netr_LsaPolicyInformation lsa_policy; + [string,charset(UTF16)] uint16 *dns_hostname; + [string,charset(UTF16)] uint16 *sitename; + [string,charset(UTF16)] uint16 *dummy1; + [string,charset(UTF16)] uint16 *dummy2; + [string,charset(UTF16)] uint16 *dummy3; + [string,charset(UTF16)] uint16 *dummy4; + netr_OsVersionContainer os_version; + lsa_String os_name; + lsa_String dummy_string3; + lsa_String dummy_string4; + netr_WorkstationFlags workstation_flags; + kerb_EncTypes supported_enc_types; + uint32 dummy_long3; + uint32 dummy_long4; + } netr_WorkstationInformation; + + typedef union { + [case(1)] netr_WorkstationInformation *workstation_info; + [case(2)] netr_WorkstationInformation *lsa_policy_info; + } netr_WorkstationInfo; + + typedef struct { + netr_TrustFlags flags; + uint32 parent_index; + lsa_TrustType trust_type; + lsa_TrustAttributes trust_attributes; + } netr_trust_extension_info; + + typedef struct { + /* these first 3 values come from the fact windows + actually encodes this structure as a UNICODE_STRING + - see MS-NRPC section 2.2.1.3.9 */ + [value(8)] uint3264 length; + [value(0)] uint3264 dummy; + [value(8)] uint3264 size; + [subcontext(0),subcontext_size(size*2)] + netr_trust_extension_info info; + } netr_trust_extension; + + typedef struct { + /* value is 16 when info != NULL, otherwise 0 */ + [value(info == NULL ? 0 : 16)] uint16 length; + [value(info == NULL ? 0 : 16)] uint16 size; + netr_trust_extension *info; + } netr_trust_extension_container; + + typedef struct { + lsa_StringLarge domainname; + lsa_StringLarge dns_domainname; + lsa_StringLarge dns_forestname; + GUID domain_guid; + dom_sid2 *domain_sid; + netr_trust_extension_container trust_extension; + lsa_StringLarge dummy_string2; + lsa_StringLarge dummy_string3; + lsa_StringLarge dummy_string4; + uint32 dummy_long1; + uint32 dummy_long2; + uint32 dummy_long3; + uint32 dummy_long4; + } netr_OneDomainInfo; + + typedef struct { + netr_OneDomainInfo primary_domain; + uint32 trusted_domain_count; + [size_is(trusted_domain_count)] netr_OneDomainInfo *trusted_domains; + netr_LsaPolicyInformation lsa_policy; + lsa_StringLarge dns_hostname; + lsa_StringLarge dummy_string2; + lsa_StringLarge dummy_string3; + lsa_StringLarge dummy_string4; + netr_WorkstationFlags workstation_flags; + kerb_EncTypes supported_enc_types; + uint32 dummy_long3; + uint32 dummy_long4; + } netr_DomainInformation; + + typedef union { + [case(1)] netr_DomainInformation *domain_info; + [case(2)] netr_LsaPolicyInformation *lsa_policy_info; + } netr_DomainInfo; + + [public] NTSTATUS netr_LogonGetDomainInfo( + [in] [string,charset(UTF16)] uint16 *server_name, + [in,unique] [string,charset(UTF16)] uint16 *computer_name, + [in,ref] netr_Authenticator *credential, + [in,out,ref] netr_Authenticator *return_authenticator, + [in] uint32 level, + [in,ref,switch_is(level)] netr_WorkstationInfo *query, + [out,ref,switch_is(level)] netr_DomainInfo *info + ); + + /*****************/ + /* Function 0x1e */ + + /* [MS-NRPC] 2.2.1.3.8 NL_PASSWORD_VERSION */ + + /* someone's birthday ? */ + const int NETLOGON_PASSWORD_VERSION_NUMBER_PRESENT = 0x02231968; + + typedef struct { + uint32 ReservedField; + uint32 PasswordVersionNumber; + uint32 PasswordVersionPresent; + } NL_PASSWORD_VERSION; + + typedef [flag(NDR_PAHEX)] struct { + uint8 data[512]; + uint32 length; + } netr_CryptPassword; + + NTSTATUS netr_ServerPasswordSet2( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in] [string,charset(UTF16)] uint16 *account_name, + [in] netr_SchannelType secure_channel_type, + [in] [string,charset(UTF16)] uint16 *computer_name, + [in,ref] netr_Authenticator *credential, + [out,ref] netr_Authenticator *return_authenticator, + [in,ref] netr_CryptPassword *new_password + ); + + /****************/ + /* Function 0x1f */ + NTSTATUS netr_ServerPasswordGet( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in] [string,charset(UTF16)] uint16 *account_name, + [in] netr_SchannelType secure_channel_type, + [in] [string,charset(UTF16)] uint16 *computer_name, + [in,ref] netr_Authenticator *credential, + [out,ref] netr_Authenticator *return_authenticator, + [out,ref] samr_Password *password + ); + + typedef [public] enum { + SendToSamUpdatePassword = 0, + SendToSamResetBadPasswordCount = 1, + SendToSamUpdatePasswordForward = 2, + SendToSamUpdateLastLogonTimestamp = 3, + SendToSamResetSmartCardPassword = 4 + } netr_SendToSamType; + + typedef struct { + GUID guid; + } netr_SendToSamResetBadPasswordCount; + + typedef [nodiscriminant, public,switch_type(netr_SendToSamType)] union { + /* TODO Implement other SendToSam message types + * [case(SendToSamUpdatePassword)] netr_SendToSamUpdatePassword ...; */ + [case(SendToSamResetBadPasswordCount)] netr_SendToSamResetBadPasswordCount reset_bad_password; + /* + * [case(SendToSamUpdatePasswordForward)] netrSendToSamUpdatePasswordForward ...; + * [case(SendToSamUpdateLastLogonTimestamp)] netrSendToSamUpdateLastLogonTimestamp ...; + * [case(SendToSamResetSmartCardPassword)] netrSendToSamResetSmartCardPassword ...; + */ + [default]; + } netr_SendToSamMessage; + + typedef [public] struct { + netr_SendToSamType message_type; + uint32 message_size; + [switch_is(message_type), subcontext(0), subcontext_size(message_size)] netr_SendToSamMessage message; + } netr_SendToSamBase; + + /****************/ + /* Function 0x20 */ + NTSTATUS netr_NetrLogonSendToSam( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in] [string,charset(UTF16)] uint16 *computer_name, + [in,ref] netr_Authenticator *credential, + [out,ref] netr_Authenticator *return_authenticator, + [in,ref] [size_is(buffer_len)] uint8 *opaque_buffer, + [in] uint32 buffer_len + ); + + /****************/ + /* Function 0x21 */ + typedef struct { + uint32 count; + [size_is(count)] lsa_String *sitename; + } netr_DsRAddressToSitenamesWCtr; + + typedef struct { + [size_is(size)] uint8 *buffer; + uint32 size; + } netr_DsRAddress; + + WERROR netr_DsRAddressToSitenamesW( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in] [range(0,32000)] uint32 count, + [in] [size_is(count)] [ref] netr_DsRAddress *addresses, + [out] [ref] netr_DsRAddressToSitenamesWCtr **ctr + ); + + /****************/ + /* Function 0x22 */ + WERROR netr_DsRGetDCNameEx2( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in,unique] [string,charset(UTF16)] uint16 *client_account, + [in] samr_AcctFlags mask, + [in,unique] [string,charset(UTF16)] uint16 *domain_name, + [in,unique] GUID *domain_guid, + [in,unique] [string,charset(UTF16)] uint16 *site_name, + [in] netr_DsRGetDCName_flags flags, + [out,ref] netr_DsRGetDCNameInfo **info + ); + + /****************/ + /* Function 0x23 */ + [todo] WERROR netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(); + + /****************/ + /* Function 0x24 */ + + typedef [public] struct { + [string,charset(UTF16)] uint16 *netbios_name; + [string,charset(UTF16)] uint16 *dns_name; + netr_TrustFlags trust_flags; + uint32 parent_index; + lsa_TrustType trust_type; + lsa_TrustAttributes trust_attributes; + dom_sid2 *sid; + GUID guid; + } netr_DomainTrust; + + typedef [public] struct { + uint32 count; + [size_is(count)] netr_DomainTrust *array; + } netr_DomainTrustList; + + WERROR netr_NetrEnumerateTrustedDomainsEx( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [out,ref] netr_DomainTrustList *dom_trust_list + ); + + /****************/ + /* Function 0x25 */ + typedef struct { + uint32 count; + [size_is(count)] lsa_String *sitename; + [size_is(count)] lsa_String *subnetname; + } netr_DsRAddressToSitenamesExWCtr; + + WERROR netr_DsRAddressToSitenamesExW( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in] [range(0,32000)] uint32 count, + [in] [size_is(count)] [ref] netr_DsRAddress *addresses, + [out] [ref] netr_DsRAddressToSitenamesExWCtr **ctr + ); + + /****************/ + /* Function 0x26 */ + + typedef struct { + uint32 num_sites; + [size_is(num_sites)] [unique] lsa_String *sites; + } DcSitesCtr; + + WERROR netr_DsrGetDcSiteCoverageW( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [out,ref] DcSitesCtr **ctr + ); + + /****************/ + /* Function 0x27 */ + typedef [public,bitmap32bit] bitmap { + /* Request MUST be passed to the domain controller at the root of the forest. */ + NETLOGON_SAMLOGON_FLAG_PASS_TO_FOREST_ROOT = 0x00000001, + /* Request MUST be passed to the DC at the end of the first hop over a cross-forest trust. */ + NETLOGON_SAMLOGON_FLAG_PASS_CROSS_FOREST_HOP = 0x00000002, + /* Request was passed by an RODC to a DC in a different domain. */ + NETLOGON_SAMLOGON_FLAG_RODC_TO_OTHER_DOMAIN = 0x00000004, + /* Request is an NTLM authentication package request passed by an RODC. */ + NETLOGON_SAMLOGON_FLAG_RODC_NTLM_REQUEST = 0x00000008 + } netr_LogonSamLogon_flags; + + NTSTATUS netr_LogonSamLogonEx( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,unique] [string,charset(UTF16)] uint16 *computer_name, + [in] netr_LogonInfoClass logon_level, + [in,ref] [switch_is(logon_level)] netr_LogonLevel *logon, + [in] uint16 validation_level, + [out,ref] [switch_is(validation_level)] netr_Validation *validation, + [out,ref] uint8 *authoritative, + [in,out,ref] netr_LogonSamLogon_flags *flags + ); + + /****************/ + /* Function 0x28 */ + + WERROR netr_DsrEnumerateDomainTrusts( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in] netr_TrustFlags trust_flags, + [out,ref] netr_DomainTrustList *trusts + ); + + + /****************/ + /* Function 0x29 */ + WERROR netr_DsrDeregisterDNSHostRecords( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,unique] [string,charset(UTF16)] uint16 *domain, + [in,unique] GUID *domain_guid, + [in,unique] GUID *dsa_guid, + [in,ref] [string,charset(UTF16)] uint16 *dns_host + ); + + /****************/ + /* Function 0x2a */ + NTSTATUS netr_ServerTrustPasswordsGet( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in] [string,charset(UTF16)] uint16 *account_name, + [in] netr_SchannelType secure_channel_type, + [in] [string,charset(UTF16)] uint16 *computer_name, + [in,ref] netr_Authenticator *credential, + [out,ref] netr_Authenticator *return_authenticator, + [out,ref] samr_Password *new_owf_password, + [out,ref] samr_Password *old_owf_password + ); + + /****************/ + /* Function 0x2b */ + + const int DS_GFTI_UPDATE_TDO = 0x1; + + WERROR netr_DsRGetForestTrustInformation( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,unique] [string,charset(UTF16)] uint16 *trusted_domain_name, + [in] uint32 flags, + [out,ref] lsa_ForestTrustInformation **forest_trust_info + ); + + /****************/ + /* Function 0x2c */ + NTSTATUS netr_GetForestTrustInformation( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,ref] [string,charset(UTF16)] uint16 *computer_name, + [in,ref] netr_Authenticator *credential, + [out,ref] netr_Authenticator *return_authenticator, + [in] uint32 flags, + [out,ref] lsa_ForestTrustInformation **forest_trust_info + ); + + /****************/ + /* Function 0x2d */ + + /* this is the ADS variant. I don't yet know what the "flags" are for */ + NTSTATUS netr_LogonSamLogonWithFlags( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,unique] [string,charset(UTF16)] uint16 *computer_name, + [in,unique] netr_Authenticator *credential, + [in,out,unique] netr_Authenticator *return_authenticator, + [in] netr_LogonInfoClass logon_level, + [in,ref] [switch_is(logon_level)] netr_LogonLevel *logon, + [in] uint16 validation_level, + [out,ref] [switch_is(validation_level)] netr_Validation *validation, + [out,ref] uint8 *authoritative, + [in,out,ref] netr_LogonSamLogon_flags *flags + ); + + /****************/ + /* Function 0x2e */ + + typedef struct { + uint32 count; + [size_is(count)] uint32 *data; + uint32 entry_count; + [size_is(count)] lsa_String *entries; + } netr_TrustInfo; + + NTSTATUS netr_ServerGetTrustInfo( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,ref] [string,charset(UTF16)] uint16 *account_name, + [in] netr_SchannelType secure_channel_type, + [in,ref] [string,charset(UTF16)] uint16 *computer_name, + [in,ref] netr_Authenticator *credential, + [out,ref] netr_Authenticator *return_authenticator, + [out,ref] samr_Password *new_owf_password, + [out,ref] samr_Password *old_owf_password, + [out,ref] netr_TrustInfo **trust_info + ); + + /****************/ + /* Function 0x2f */ + + NTSTATUS netr_Unused47(void); + + + /****************/ + /* Function 0x30 */ + + typedef enum { + NlDnsLdapAtSite = 22, + NlDnsGcAtSite = 25, + NlDnsDsaCname = 28, + NlDnsKdcAtSite = 30, + NlDnsDcAtSite = 32, + NlDnsRfc1510KdcAtSite = 34, + NlDnsGenericGcAtSite = 36 + } netr_DnsType; + + typedef enum { + NlDnsInfoTypeNone = 0, + NlDnsDomainName = 1, + NlDnsDomainNameAlias = 2, + NlDnsForestName = 3, + NlDnsForestNameAlias = 4, + NlDnsNdncDomainName = 5, + NlDnsRecordName = 6 + } netr_DnsDomainInfoType; + + typedef struct { + netr_DnsType type; + [string,charset(UTF16)] uint16 *dns_domain_info; + netr_DnsDomainInfoType dns_domain_info_type; + uint32 priority; + uint32 weight; + uint32 port; + boolean32 dns_register; + uint32 status; + } NL_DNS_NAME_INFO; + + typedef [public] struct { + uint32 count; + [size_is(count)] NL_DNS_NAME_INFO *names; + } NL_DNS_NAME_INFO_ARRAY; + + NTSTATUS netr_DsrUpdateReadOnlyServerDnsRecords( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,ref] [string,charset(UTF16)] uint16 *computer_name, + [in, ref] netr_Authenticator *credential, + [out,ref] netr_Authenticator *return_authenticator, + [in,unique] [string,charset(UTF16)] uint16 *site_name, + [in] uint32 dns_ttl, + [in,out,ref] NL_DNS_NAME_INFO_ARRAY *dns_names + ); +} diff --git a/librpc/idl/nfs4acl.idl b/librpc/idl/nfs4acl.idl new file mode 100644 index 0000000..10a60ed --- /dev/null +++ b/librpc/idl/nfs4acl.idl @@ -0,0 +1,51 @@ +#include "idl_types.h" + +/* + NFS4 ACL format on disk + see http://www.suse.de/~agruen/nfs4acl/ +*/ + +import "misc.idl", "security.idl"; + +[ + version(1.0), + pointer_default(unique) +] +interface nfs4acl_interface +{ + const char *NFS4ACL_NDR_XATTR_NAME = "security.nfs4acl_ndr"; + + const char *NFS4ACL_XATTR_OWNER_WHO = "OWNER@"; + const char *NFS4ACL_XATTR_GROUP_WHO = "GROUP@"; + const char *NFS4ACL_XATTR_EVERYONE_WHO = "EVERYONE@"; + + const uint8 ACL4_XATTR_VERSION_40 = 0x00; + const uint8 ACL4_XATTR_VERSION_41 = 0x01; + const uint8 ACL4_XATTR_VERSION_DEFAULT = ACL4_XATTR_VERSION_41; + + const uint8 ACL4_AUTO_INHERIT = 0x01; + const uint8 ACL4_PROTECTED = 0x02; + const uint8 ACL4_DEFAULTED = 0x04; + const uint8 ACL4_WRITE_THROUGH = 0x40; + + /* these structures use the same bit values and other constants as + in security.idl */ + typedef [flag(NDR_BIG_ENDIAN)] struct { + uint16 e_type; + uint16 e_flags; + uint32 e_mask; + uint32 e_id; + utf8string e_who; + [flag(NDR_ALIGN4)] DATA_BLOB _pad; + } nfs4ace; + + typedef [public,flag(NDR_BIG_ENDIAN)] struct { + uint8 a_version; + uint8 a_flags; + uint16 a_count; + uint32 a_owner_mask; + uint32 a_group_mask; + uint32 a_other_mask; + nfs4ace ace[a_count]; + } nfs4acl; +} diff --git a/librpc/idl/notify.idl b/librpc/idl/notify.idl new file mode 100644 index 0000000..5f83f4f --- /dev/null +++ b/librpc/idl/notify.idl @@ -0,0 +1,94 @@ +#include "idl_types.h" + +import "file_id.idl", "server_id.idl"; + +/* + IDL structures for notify change code + + this defines the structures used in the notify database code, and + the change notify buffers +*/ + +[ + pointer_default(unique) +] +interface notify +{ + + /* structure used in the notify database */ + typedef [public] struct { + server_id server; + uint32 filter; /* filter to apply in this directory */ + uint32 subdir_filter; /* filter to apply in child directories */ + uint32 dir_fd; /* fd of open directory */ + file_id dir_id; /* file_id of open directory */ + utf8string path; + uint32 path_len; /* saves some computation on search */ + pointer private_data; + } notify_entry; + + typedef [public] struct { + uint32 num_entries; + notify_entry entries[num_entries]; + } notify_entry_array; + + typedef [public] struct { + server_id server; + uint32 filter; /* filter to apply in this directory */ + uint32 subdir_filter; /* filter to apply in child directories */ + pointer private_data; + } notify_db_entry; + + /* + to allow for efficient search for matching entries, we + divide them by the directory depth, with a separate array + per depth. The entries within each depth are sorted by path, + allowing for a bisection search. + + The max_mask and max_mask_subdir at each depth is the + bitwise or of the filters and subdir filters for all entries + at that depth. This allows a depth to be quickly skipped if + no entries will match the target filter + */ + typedef struct { + uint32 max_mask; + uint32 max_mask_subdir; + uint32 num_entries; + notify_entry entries[num_entries]; + } notify_depth; + + typedef [public] struct { + uint32 num_depths; + notify_depth depth[num_depths]; + } notify_array; + + /* structure sent between servers in notify messages */ + typedef [public] struct { + uint32 action; + utf8string dir; + utf8string path; + pointer private_data; + } notify_event; + + typedef [v1_enum] enum { + FILE_ACTION_ADDED = 0x00000001, + FILE_ACTION_REMOVED = 0x00000002, + FILE_ACTION_MODIFIED = 0x00000003, + FILE_ACTION_RENAMED_OLD_NAME = 0x00000004, + FILE_ACTION_RENAMED_NEW_NAME = 0x00000005, + FILE_ACTION_ADDED_STREAM = 0x00000006, + FILE_ACTION_REMOVED_STREAM = 0x00000007, + FILE_ACTION_MODIFIED_STREAM = 0x00000008 + } FILE_NOTIFY_ACTION; + + /* structure sent at the CIFS layer */ + /* Align on 4-byte boundary according to MS-CIFS 2.2.7.4.2 */ + typedef [public,gensize,flag(NDR_ALIGN4)] struct { + uint32 NextEntryOffset; + FILE_NOTIFY_ACTION Action; + [value(strlen_m(FileName1)*2)] uint32 FileNameLength; + [charset(UTF16),flag(STR_NOTERM)] + uint16 FileName1[strlen_m(FileName1)]; + DATA_BLOB _pad; + } FILE_NOTIFY_INFORMATION; +} diff --git a/librpc/idl/ntlmssp.idl b/librpc/idl/ntlmssp.idl new file mode 100644 index 0000000..0b4a7ac --- /dev/null +++ b/librpc/idl/ntlmssp.idl @@ -0,0 +1,307 @@ +#include "idl_types.h" + +import "security.idl"; + +/* + ntlmssp interface definition +*/ + +[ + pointer_default(unique), + helper("../librpc/ndr/ndr_ntlmssp.h"), + helpstring("NTLM messages"), + uuid("6e746c6d-7373-700a-0000-00000000") +] +interface ntlmssp +{ + typedef [v1_enum] enum { + NtLmNegotiate = 0x00000001, + NtLmChallenge = 0x00000002, + NtLmAuthenticate = 0x00000003 + } ntlmssp_MessageType; + + /* [MS-NLMP] 2.2.2.5 NEGOTIATE */ + + typedef [bitmap32bit] bitmap { + NTLMSSP_NEGOTIATE_UNICODE = 0x00000001, + NTLMSSP_NEGOTIATE_OEM = 0x00000002, /* NTLM_NEGOTIATE_OEM in MS-NLMP */ + NTLMSSP_REQUEST_TARGET = 0x00000004, + NTLMSSP_NEGOTIATE_SIGN = 0x00000010, /* Message integrity */ + NTLMSSP_NEGOTIATE_SEAL = 0x00000020, /* Message confidentiality */ + NTLMSSP_NEGOTIATE_DATAGRAM = 0x00000040, + NTLMSSP_NEGOTIATE_LM_KEY = 0x00000080, + NTLMSSP_NEGOTIATE_NETWARE = 0x00000100, /* not mentioned in MS-NLMP */ + NTLMSSP_NEGOTIATE_NTLM = 0x00000200, + NTLMSSP_NEGOTIATE_NT_ONLY = 0x00000400, + NTLMSSP_ANONYMOUS = 0x00000800, /* no symbol name in MS-NLMP */ + NTLMSSP_NEGOTIATE_OEM_DOMAIN_SUPPLIED = 0x00001000, + NTLMSSP_NEGOTIATE_OEM_WORKSTATION_SUPPLIED = 0x00002000, + NTLMSSP_NEGOTIATE_THIS_IS_LOCAL_CALL = 0x00004000, /* not mentioned in MS-NLMP */ + NTLMSSP_NEGOTIATE_ALWAYS_SIGN = 0x00008000, + NTLMSSP_TARGET_TYPE_DOMAIN = 0x00010000, + NTLMSSP_TARGET_TYPE_SERVER = 0x00020000, + NTLMSSP_TARGET_TYPE_SHARE = 0x00040000, + NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY = 0x00080000, + NTLMSSP_NEGOTIATE_IDENTIFY = 0x00100000, + NTLMSSP_REQUEST_NON_NT_SESSION_KEY = 0x00400000, + NTLMSSP_NEGOTIATE_TARGET_INFO = 0x00800000, + NTLMSSP_NEGOTIATE_VERSION = 0x02000000, + NTLMSSP_NEGOTIATE_128 = 0x20000000, /* 128-bit encryption */ + NTLMSSP_NEGOTIATE_KEY_EXCH = 0x40000000, + NTLMSSP_NEGOTIATE_56 = 0x80000000 + } NEGOTIATE; + + /* convenience mapping */ + const int NTLMSSP_NEGOTIATE_NTLM2 = NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY; + + /* + NTLMSSP_WINDOWS_MAJOR_VERSION_5: Windows XP SP2 and Server 2003 + NTLMSSP_WINDOWS_MAJOR_VERSION_6: Windows Vista, Server 2008, 7, Server 2008 R2, 8, Server 2012, 8.1, Server 2012 R2 + NTLMSSP_WINDOWS_MAJOR_VERSION_10: Windows 10, Windows Server 2016 Technical Preview + */ + + typedef [enum8bit] enum { + NTLMSSP_WINDOWS_MAJOR_VERSION_5 = 0x05, + NTLMSSP_WINDOWS_MAJOR_VERSION_6 = 0x06, + NTLMSSP_WINDOWS_MAJOR_VERSION_10 = 0x0A + } ntlmssp_WindowsMajorVersion; + + /* + NTLMSSP_WINDOWS_MINOR_VERSION_0: Windows Vista, 10, Server 2016 Technical Preview + NTLMSSP_WINDOWS_MINOR_VERSION_1: Windows XP SP2, 7, Server 2008 R2 + NTLMSSP_WINDOWS_MINOR_VERSION_2: Windows Server 2003, 8, Server 2012 + NTLMSSP_WINDOWS_MINOR_VERSION_3: Windows 8.1, Server 2012 R2 + */ + + typedef [enum8bit] enum { + NTLMSSP_WINDOWS_MINOR_VERSION_0 = 0x00, + NTLMSSP_WINDOWS_MINOR_VERSION_1 = 0x01, + NTLMSSP_WINDOWS_MINOR_VERSION_2 = 0x02, + NTLMSSP_WINDOWS_MINOR_VERSION_3 = 0x03 + } ntlmssp_WindowsMinorVersion; + + /* + NTLMSSP_REVISION_W2K3_RC1: + NTLMSSP_REVISION_W2K3: Windows XP SP2, Server 2003, Vista, Server 2008, 7, Server 2008 R2 + */ + + typedef [enum8bit] enum { + NTLMSSP_REVISION_W2K3_RC1 = 0x0A, + NTLMSSP_REVISION_W2K3 = 0x0F + } ntlmssp_NTLMRevisionCurrent; + + /* [MS-NLMP] 2.2.2.10 VERSION */ + + typedef [public] struct { + ntlmssp_WindowsMajorVersion ProductMajorVersion; + ntlmssp_WindowsMinorVersion ProductMinorVersion; + uint16 ProductBuild; + uint8 Reserved[3]; + ntlmssp_NTLMRevisionCurrent NTLMRevisionCurrent; + } ntlmssp_VERSION; + + typedef [noprint,nodiscriminant] union { + [case(NTLMSSP_NEGOTIATE_VERSION)] ntlmssp_VERSION version; + [default]; + } ntlmssp_Version; + + /* [MS-NLMP] 2.2.1.1 NEGOTIATE_MESSAGE */ + + typedef [public] struct { + [charset(DOS),value("NTLMSSP")] uint8 Signature[8]; + [value(NtLmNegotiate)] ntlmssp_MessageType MessageType; + NEGOTIATE NegotiateFlags; + [value(DomainName ? strlen(DomainName) : 0)] uint16 DomainNameLen; + [value(DomainNameLen)] uint16 DomainNameMaxLen; + [relative] [subcontext(0),subcontext_size(DomainNameLen)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_OEM))] string *DomainName; + [value(Workstation ? strlen(Workstation) : 0)] uint16 WorkstationLen; + [value(WorkstationLen)] uint16 WorkstationMaxLen; + [relative] [subcontext(0),subcontext_size(WorkstationLen)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_OEM))] string *Workstation; + [switch_is(NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION)] ntlmssp_Version Version; + } NEGOTIATE_MESSAGE; + + typedef enum { + MsvAvEOL = 0, + MsvAvNbComputerName = 1, + MsvAvNbDomainName = 2, + MsvAvDnsComputerName = 3, + MsvAvDnsDomainName = 4, + MsvAvDnsTreeName = 5, + MsvAvFlags = 6, + MsvAvTimestamp = 7, + MsvAvSingleHost = 8, + MsvAvTargetName = 9, + MsvChannelBindings = 10 + } ntlmssp_AvId; + + /* [MS-NLMP] 2.2.2.2 SingleHostData */ + + typedef [flag(NDR_PAHEX)] struct { + [value(8+ndr_size_LSAP_TOKEN_INFO_INTEGRITY(&r->token_info, 0)+r->remaining.length)] uint32 Size; + [value(0)] uint32 Z4; + LSAP_TOKEN_INFO_INTEGRITY token_info; + [flag(NDR_REMAINING)] DATA_BLOB remaining; + } ntlmssp_SingleHostData; + + typedef [bitmap32bit] bitmap { + NTLMSSP_AVFLAG_CONSTRAINTED_ACCOUNT = 0x00000001, + NTLMSSP_AVFLAG_MIC_IN_AUTHENTICATE_MESSAGE = 0x00000002, + NTLMSSP_AVFLAG_TARGET_SPN_FROM_UNTRUSTED_SOURCE = 0x00000004 + } ntlmssp_AvFlags; + + typedef [gensize,nodiscriminant,flag(NDR_NOALIGN)] union { + [case(MsvAvEOL)] ; + [case(MsvAvNbComputerName)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE))] string AvNbComputerName; + [case(MsvAvNbDomainName)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE))] string AvNbDomainName; + [case(MsvAvDnsComputerName)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE))] string AvDnsComputerName; + [case(MsvAvDnsDomainName)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE))] string AvDnsDomainName; + [case(MsvAvDnsTreeName)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE))] string AvDnsTreeName; + [case(MsvAvFlags)] ntlmssp_AvFlags AvFlags; + [case(MsvAvTimestamp)] NTTIME AvTimestamp; + [case(MsvAvSingleHost)] ntlmssp_SingleHostData AvSingleHost; + [case(MsvAvTargetName)] [flag(ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE))] string AvTargetName; + [case(MsvChannelBindings)] uint8 ChannelBindings[16]; + [default] [flag(NDR_REMAINING)] DATA_BLOB blob; + } ntlmssp_AvValue; + + /* [MS-NLMP] 2.2.2.1 AV_PAIR */ + + typedef [public,flag(NDR_NOALIGN)] struct { + ntlmssp_AvId AvId; + [value(ndr_size_ntlmssp_AvValue(&r->Value, r->AvId, 0))] uint16 AvLen; + [subcontext(0),subcontext_size(AvLen),switch_is(AvId)] ntlmssp_AvValue Value; + } AV_PAIR; + + typedef [public,gensize,nopush,nopull,flag(NDR_NOALIGN)] struct { + uint32 count; + AV_PAIR pair[count]; + } AV_PAIR_LIST; + + /* [MS-NLMP] 2.2.1.2 CHALLENGE_MESSAGE */ + + typedef [public,flag(NDR_PAHEX)] struct { + [charset(DOS),value("NTLMSSP")] uint8 Signature[8]; + [value(NtLmChallenge)] ntlmssp_MessageType MessageType; + [value(ndr_ntlmssp_string_length(NegotiateFlags, TargetName))] uint16 TargetNameLen; + [value(TargetNameLen)] uint16 TargetNameMaxLen; + [relative] [subcontext(0),subcontext_size(TargetNameLen)] [flag(ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags))] string *TargetName; + NEGOTIATE NegotiateFlags; + uint8 ServerChallenge[8]; + uint8 Reserved[8]; + [value(ndr_size_AV_PAIR_LIST(TargetInfo, ndr->flags))] uint16 TargetInfoLen; + [value(TargetInfoLen)] uint16 TargetInfoMaxLen; + [relative] [subcontext(0),subcontext_size(TargetInfoLen)] AV_PAIR_LIST *TargetInfo; + [switch_is(NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION)] ntlmssp_Version Version; + } CHALLENGE_MESSAGE; + + /* [MS-NLMP] 2.2.2.3 LM_RESPONSE */ + + typedef [public,flag(NDR_PAHEX)] struct { + uint8 Response[24]; + } LM_RESPONSE; + + /* [MS-NLMP] 2.2.2.4 LMv2_RESPONSE */ + + typedef [public,flag(NDR_PAHEX)] struct { + uint8 Response[16]; + uint8 ChallengeFromClient[8]; + } LMv2_RESPONSE; + + typedef [nodiscriminant] union { + [case(24)] LM_RESPONSE v1; + [default]; + } ntlmssp_LM_RESPONSE_with_len; + + /* [MS-NLMP] 2.2.2.6 NTLM_RESPONSE */ + + typedef [public,flag(NDR_PAHEX)] struct { + uint8 Response[24]; + } NTLM_RESPONSE; + + /* [MS-NLMP] 2.2.2.7 NTLMv2_CLIENT_CHALLENGE */ + + typedef [flag(NDR_PAHEX)] struct { + [value(1)] uint8 RespType; + [value(1)] uint8 HiRespType; + uint16 Reserved1; + uint32 Reserved2; + NTTIME TimeStamp; + uint8 ChallengeFromClient[8]; + uint32 Reserved3; + [subcontext(0)] [flag(NDR_REMAINING)] AV_PAIR_LIST AvPairs; + } NTLMv2_CLIENT_CHALLENGE; + + /* [MS-NLMP] 2.2.2.8 NTLMv2_RESPONSE */ + + typedef [public,flag(NDR_PAHEX)] struct { + uint8 Response[16]; + NTLMv2_CLIENT_CHALLENGE Challenge; + } NTLMv2_RESPONSE; + + typedef [public,nodiscriminant] union { + [case(0)] ; + [case(0x18)] NTLM_RESPONSE v1; + [default] NTLMv2_RESPONSE v2; + } ntlmssp_NTLM_RESPONSE_with_len; + + const int NTLMSSP_MIC_OFFSET = 72; + const int NTLMSSP_MIC_SIZE = 16; + + typedef [flag(NDR_PAHEX)] struct { + uint8 MIC[NTLMSSP_MIC_SIZE]; + } ntlmssp_MIC; + + /* [MS-NLMP] 2.2.1.3 AUTHENTICATE_MESSAGE */ + + typedef [public,flag(NDR_REMAINING)] struct { + [charset(DOS),value("NTLMSSP")] uint8 Signature[8]; + [value(NtLmAuthenticate)] ntlmssp_MessageType MessageType; + uint16 LmChallengeResponseLen; + [value(LmChallengeResponseLen)] uint16 LmChallengeResponseMaxLen; + [relative] [subcontext(0),subcontext_size(LmChallengeResponseLen),switch_is(LmChallengeResponseLen)] ntlmssp_LM_RESPONSE_with_len *LmChallengeResponse; + uint16 NtChallengeResponseLen; + [value(NtChallengeResponseLen)] uint16 NtChallengeResponseMaxLen; + [relative] [subcontext(0),subcontext_size(NtChallengeResponseMaxLen),switch_is(NtChallengeResponseLen)] ntlmssp_NTLM_RESPONSE_with_len *NtChallengeResponse; + [value(ndr_ntlmssp_string_length(NegotiateFlags, DomainName))] uint16 DomainNameLen; + [value(DomainNameLen)] uint16 DomainNameMaxLen; + [relative] [subcontext(0),subcontext_size(DomainNameLen)] [flag(ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags))] string *DomainName; + [value(ndr_ntlmssp_string_length(NegotiateFlags, UserName))] uint16 UserNameLen; + [value(UserNameLen)] uint16 UserNameMaxLen; + [relative] [subcontext(0),subcontext_size(UserNameLen)] [flag(ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags))] string *UserName; + [value(ndr_ntlmssp_string_length(NegotiateFlags, Workstation))] uint16 WorkstationLen; + [value(WorkstationLen)] uint16 WorkstationMaxLen; + [relative] [subcontext(0),subcontext_size(WorkstationLen)] [flag(ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags))] string *Workstation; + [value(EncryptedRandomSessionKey == NULL ? 0 : EncryptedRandomSessionKey->length)] uint16 EncryptedRandomSessionKeyLen; + [value(EncryptedRandomSessionKeyLen)] uint16 EncryptedRandomSessionKeyMaxLen; + [relative] [subcontext(0),subcontext_size(EncryptedRandomSessionKeyLen)] DATA_BLOB *EncryptedRandomSessionKey; + NEGOTIATE NegotiateFlags; + [switch_is(NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION)] ntlmssp_Version Version; + /* MIC (Message Integrity) is only included when the client has + * sent a timestamp Av struct in the CHALLENGE_MESSAGE AvPair */ + /* [flag(NDR_REMAINING)] ntlmssp_MIC mic; */ + } AUTHENTICATE_MESSAGE; + + /* NTLMSSP signature version */ + const int NTLMSSP_SIGN_VERSION = 0x01; + + /* NTLMSSP signature size */ + const int NTLMSSP_SIG_SIZE = 16; + + /* [MS-NLMP] 2.2.2.9.1 NTLMSSP_MESSAGE_SIGNATURE */ + + typedef [public] struct { + [value(NTLMSSP_SIGN_VERSION)] uint32 Version; + uint32 RandomPad; + uint32 Checksum; + uint32 SeqNum; + } NTLMSSP_MESSAGE_SIGNATURE; + + /* [MS-NLMP] 2.2.2.9.2 NTLMSSP_MESSAGE_SIGNATURE for Extended Session Security */ + + typedef [public,flag(NDR_PAHEX)] struct { + [value(NTLMSSP_SIGN_VERSION)] uint32 Version; + uint8 Checksum[8]; + uint32 SeqNum; + } NTLMSSP_MESSAGE_SIGNATURE_NTLMv2; + +} diff --git a/librpc/idl/ntprinting.idl b/librpc/idl/ntprinting.idl new file mode 100644 index 0000000..0f82a16 --- /dev/null +++ b/librpc/idl/ntprinting.idl @@ -0,0 +1,156 @@ +#include "idl_types.h" + +/* + old s3 spoolss tdb on-disc interface definitions +*/ + +[ + pointer_default(unique), + helpstring("s3 printing tdb formats"), + uuid("a025d3cb-c605-40d6-86e1-4cff18e7dd94"), + helper("../librpc/ndr/ndr_ntprinting.h") +] +interface ntprinting +{ + /* Samba 3 tdb storage format: forms + * "dddddddd" */ + + typedef [flag(NDR_NOALIGN),public] struct { + uint32 position; + uint32 flag; + uint32 width; + uint32 length; + uint32 left; + uint32 top; + uint32 right; + uint32 bottom; + } ntprinting_form; + + /* + * First the string flags and then the Samba 3 tdb storage + * format: drivers + * "dffffffff" followed by a remaining buffer of "f" array */ + + typedef [flag(NDR_NOALIGN),public] struct { + [skip_noinit] libndr_flags string_flags; + + uint32 version; + [flag(ndr_ntprinting_string_flags(r->string_flags))] string name; + [flag(ndr_ntprinting_string_flags(r->string_flags))] string environment; + [flag(ndr_ntprinting_string_flags(r->string_flags))] string driverpath; + [flag(ndr_ntprinting_string_flags(r->string_flags))] string datafile; + [flag(ndr_ntprinting_string_flags(r->string_flags))] string configfile; + [flag(ndr_ntprinting_string_flags(r->string_flags))] string helpfile; + [flag(ndr_ntprinting_string_flags(r->string_flags))] string monitorname; + [flag(ndr_ntprinting_string_flags(r->string_flags))] string defaultdatatype; + [flag((ndr_ntprinting_string_flags(r->string_flags)&~STR_NULLTERM)|STR_NOTERM|NDR_REMAINING)] string_array dependent_files; + } ntprinting_driver; + + /* Samba 3 tdb storage format: devicemode + * "p" ptr to devicemode + * "ffwwwwwwwwwwwwwwwwwwdddddddddddddd" + * "p" ptr to devicemode private data + * "B" private data blob */ + + typedef [flag(NDR_NOALIGN),public] struct { + [skip_noinit] libndr_flags string_flags; + + /* uint32 devicemode_ptr; */ + [flag(ndr_ntprinting_string_flags(r->string_flags))] string devicename; + [flag(ndr_ntprinting_string_flags(r->string_flags))] string formname; + uint16 specversion; + uint16 driverversion; + uint16 size; + uint16 driverextra; + uint16 orientation; + uint16 papersize; + uint16 paperlength; + uint16 paperwidth; + uint16 scale; + uint16 copies; + uint16 defaultsource; + uint16 printquality; + uint16 color; + uint16 duplex; + uint16 yresolution; + uint16 ttoption; + uint16 collate; + uint16 logpixels; + uint32 fields; + uint32 bitsperpel; + uint32 pelswidth; + uint32 pelsheight; + uint32 displayflags; + uint32 displayfrequency; + uint32 icmmethod; + uint32 icmintent; + uint32 mediatype; + uint32 dithertype; + uint32 reserved1; + uint32 reserved2; + uint32 panningwidth; + uint32 panningheight; + DATA_BLOB *nt_dev_private; + } ntprinting_devicemode; + + /* + * First the string flags and then the Samba 3 tdb storage + * format: printer_data + * "p" ptr to printer_data + * "fdB" */ + + typedef [flag(NDR_NOALIGN),public] struct { + [skip_noinit] libndr_flags string_flags; + + uint32 ptr; + [flag(ndr_ntprinting_string_flags(r->string_flags))] string name; + uint32 type; + DATA_BLOB data; + } ntprinting_printer_data; + + /* + * First the string flags and then the Samba 3 tdb storage + * format: printer_info + * "dddddddddddfffffPfffff" + */ + + typedef [flag(NDR_NOALIGN),public] struct { + [skip_noinit] libndr_flags string_flags; + + uint32 attributes; + uint32 priority; + uint32 default_priority; + uint32 starttime; + uint32 untiltime; + uint32 status; + uint32 cjobs; + uint32 averageppm; + uint32 changeid; + uint32 c_setprinter; + uint32 setuptime; + [flag(ndr_ntprinting_string_flags(r->string_flags))] string servername; + [flag(ndr_ntprinting_string_flags(r->string_flags))] string printername; + [flag(ndr_ntprinting_string_flags(r->string_flags))] string sharename; + [flag(ndr_ntprinting_string_flags(r->string_flags))] string portname; + [flag(ndr_ntprinting_string_flags(r->string_flags))] string drivername; + [flag(ndr_ntprinting_string_flags(r->string_flags))] string comment; + [flag(ndr_ntprinting_string_flags(r->string_flags))] string location; + [flag(ndr_ntprinting_string_flags(r->string_flags))] string sepfile; + [flag(ndr_ntprinting_string_flags(r->string_flags))] string printprocessor; + [flag(ndr_ntprinting_string_flags(r->string_flags))] string datatype; + [flag(ndr_ntprinting_string_flags(r->string_flags))] string parameters; + } ntprinting_printer_info; + + /* Abstract Samba 3 printer + * printer_info + * followed by ntprinting_devicemode + * followed by remaining buffer of ntprinting_printer_data array */ + + typedef [flag(NDR_NOALIGN),public,nopull] struct { + ntprinting_printer_info info; + ntprinting_devicemode *devmode; + uint32 count; + ntprinting_printer_data printer_data[count]; + } ntprinting_printer; + +} diff --git a/librpc/idl/ntsvcs.idl b/librpc/idl/ntsvcs.idl new file mode 100644 index 0000000..91a85b9 --- /dev/null +++ b/librpc/idl/ntsvcs.idl @@ -0,0 +1,399 @@ +/* + plug and play services +*/ + +import "misc.idl"; + +[ + uuid("8d9f4e40-a03d-11ce-8f69-08003e30051b"), + version(1.0), + endpoint("ncacn_np:[\\pipe\\ntsvcs]","ncacn_np:[\\pipe\\plugplay]"), + helpstring("Plug and Play services") +] +interface ntsvcs +{ + /******************/ + /* Function: 0x00 */ + + [todo] WERROR PNP_Disconnect(); + + /******************/ + /* Function: 0x01 */ + + [todo] WERROR PNP_Connect(); + + /******************/ + /* Function: 0x02 */ + + WERROR PNP_GetVersion( + [out,ref] uint16 *version + ); + + /******************/ + /* Function: 0x03 */ + + [todo] WERROR PNP_GetGlobalState(); + + /******************/ + /* Function: 0x04 */ + + [todo] WERROR PNP_InitDetection(); + + /******************/ + /* Function: 0x05 */ + + [todo] WERROR PNP_ReportLogOn(); + + /******************/ + /* Function: 0x06 */ + + WERROR PNP_ValidateDeviceInstance( + [in,ref] [string,charset(UTF16)] uint16 *devicepath, + [in] uint32 flags + ); + + /******************/ + /* Function: 0x07 */ + + [todo] WERROR PNP_GetRootDeviceInstance(); + + /******************/ + /* Function: 0x08 */ + + [todo] WERROR PNP_GetRelatedDeviceInstance(); + + /******************/ + /* Function: 0x09 */ + + [todo] WERROR PNP_EnumerateSubKeys(); + + /******************/ + /* Function: 0x0a */ + + const int CM_GETIDLIST_FILTER_NONE = 0x00000000; + + typedef [bitmap32bit] bitmap { + CM_GETIDLIST_FILTER_ENUMERATOR = 0x00000001, + CM_GETIDLIST_FILTER_SERVICE = 0x00000002, + CM_GETIDLIST_FILTER_EJECTRELATIONS = 0x00000004, + CM_GETIDLIST_FILTER_REMOVALRELATIONS = 0x00000008, + CM_GETIDLIST_FILTER_POWERRELATIONS = 0x00000010, + CM_GETIDLIST_FILTER_BUSRELATIONS = 0x00000020, + CM_GETIDLIST_DONOTGENERATE = 0x10000040, + CM_GETIDLIST_FILTER_TRANSPORTRELATIONS = 0x00000080, + CM_GETIDLIST_FILTER_PRESENT = 0x00000100, + CM_GETIDLIST_FILTER_CLASS = 0x00000200 + } PNP_GetIdListFlags; + + WERROR PNP_GetDeviceList( + [in,unique] [string,charset(UTF16)] uint16 *filter, + [out,ref] [size_is(*length),length_is(*length)] uint16 *buffer, + [in,out,ref] uint32 *length, + [in] PNP_GetIdListFlags flags + ); + + /******************/ + /* Function: 0x0b */ + + WERROR PNP_GetDeviceListSize( + [in,unique] [string,charset(UTF16)] uint16 *devicename, + [out,ref] uint32 *size, + [in] PNP_GetIdListFlags flags + ); + + /******************/ + /* Function: 0x0c */ + + [todo] WERROR PNP_GetDepth(); + + /******************/ + /* Function: 0x0d */ + + const int DEV_REGPROP_DESC = 1; + + WERROR PNP_GetDeviceRegProp( + [in,ref] [string,charset(UTF16)] uint16 *devicepath, + [in] uint32 property, + [in,out,ref] winreg_Type *reg_data_type, + [out,ref] [size_is(*buffer_size)] [length_is(*buffer_size)] uint8 *buffer, + [in,out,ref] uint32 *buffer_size, + [in,out,ref] uint32 *needed, + [in] uint32 flags + ); + + /******************/ + /* Function: 0x0e */ + + [todo] WERROR PNP_SetDeviceRegProp(); + + /******************/ + /* Function: 0x0f */ + + [todo] WERROR PNP_GetClassInstance(); + + /******************/ + /* Function: 0x10 */ + + [todo] WERROR PNP_CreateKey(); + + /******************/ + /* Function: 0x11 */ + + [todo] WERROR PNP_DeleteRegistryKey(); + + /******************/ + /* Function: 0x12 */ + + [todo] WERROR PNP_GetClassCount(); + + /******************/ + /* Function: 0x13 */ + + [todo] WERROR PNP_GetClassName(); + + /******************/ + /* Function: 0x14 */ + + [todo] WERROR PNP_DeleteClassKey(); + + /******************/ + /* Function: 0x15 */ + + [todo] WERROR PNP_GetInterfaceDeviceAlias(); + + /******************/ + /* Function: 0x16 */ + + [todo] WERROR PNP_GetInterfaceDeviceList(); + + /******************/ + /* Function: 0x17 */ + + [todo] WERROR PNP_GetInterfaceDeviceListSize(); + + /******************/ + /* Function: 0x18 */ + + [todo] WERROR PNP_RegisterDeviceClassAssociation(); + + /******************/ + /* Function: 0x19 */ + + [todo] WERROR PNP_UnregisterDeviceClassAssociation(); + + /******************/ + /* Function: 0x1a */ + + [todo] WERROR PNP_GetClassRegProp(); + + /******************/ + /* Function: 0x1b */ + + [todo] WERROR PNP_SetClassRegProp(); + + /******************/ + /* Function: 0x1c */ + + [todo] WERROR PNP_CreateDevInst(); + + /******************/ + /* Function: 0x1d */ + + [todo] WERROR PNP_DeviceInstanceAction(); + + /******************/ + /* Function: 0x1e */ + + [todo] WERROR PNP_GetDeviceStatus(); + + /******************/ + /* Function: 0x1f */ + + [todo] WERROR PNP_SetDeviceProblem(); + + /******************/ + /* Function: 0x20 */ + + [todo] WERROR PNP_DisableDevInst(); + + /******************/ + /* Function: 0x21 */ + + [todo] WERROR PNP_UninstallDevInst(); + + /******************/ + /* Function: 0x22 */ + + [todo] WERROR PNP_AddID(); + + /******************/ + /* Function: 0x23 */ + + [todo] WERROR PNP_RegisterDriver(); + + /******************/ + /* Function: 0x24 */ + + [todo] WERROR PNP_QueryRemove(); + + /******************/ + /* Function: 0x25 */ + + [todo] WERROR PNP_RequestDeviceEject(); + + /******************/ + /* Function: 0x26 */ + + [todo] WERROR PNP_IsDockStationPresent(); + + /******************/ + /* Function: 0x27 */ + + [todo] WERROR PNP_RequestEjectPC(); + + /******************/ + /* Function: 0x28 */ + + WERROR PNP_HwProfFlags( + [in] uint32 action, + [in,ref] [string,charset(UTF16)] uint16 *devicepath, + [in] uint32 config, + [in,out,ref] uint32 *profile_flags, + [in,out,unique] uint16 *veto_type, + [in,unique] [string,charset(UTF16)] uint16 *unknown5, + [out,unique] [string,charset(UTF16)] uint16 **unknown5a, + [in] uint32 name_length, + [in] uint32 flags + ); + + /******************/ + /* Function: 0x29 */ + + typedef struct { + uint32 profile_handle; + uint16 friendly_name[80]; + uint32 flags; + } PNP_HwProfInfo; + + WERROR PNP_GetHwProfInfo( + [in] uint32 idx, + [in,out,ref] PNP_HwProfInfo *info, + [in] uint32 size, + [in] uint32 flags + ); + + /******************/ + /* Function: 0x2a */ + + [todo] WERROR PNP_AddEmptyLogConf(); + + /******************/ + /* Function: 0x2b */ + + [todo] WERROR PNP_FreeLogConf(); + + /******************/ + /* Function: 0x2c */ + + [todo] WERROR PNP_GetFirstLogConf(); + + /******************/ + /* Function: 0x2d */ + + [todo] WERROR PNP_GetNextLogConf(); + + /******************/ + /* Function: 0x2e */ + + [todo] WERROR PNP_GetLogConfPriority(); + + /******************/ + /* Function: 0x2f */ + + [todo] WERROR PNP_AddResDes(); + + /******************/ + /* Function: 0x30 */ + + [todo] WERROR PNP_FreeResDes(); + + /******************/ + /* Function: 0x31 */ + + [todo] WERROR PNP_GetNextResDes(); + + /******************/ + /* Function: 0x32 */ + + [todo] WERROR PNP_GetResDesData(); + + /******************/ + /* Function: 0x33 */ + + [todo] WERROR PNP_GetResDesDataSize(); + + /******************/ + /* Function: 0x34 */ + + [todo] WERROR PNP_ModifyResDes(); + + /******************/ + /* Function: 0x35 */ + + [todo] WERROR PNP_DetectResourceLimit(); + + /******************/ + /* Function: 0x36 */ + + [todo] WERROR PNP_QueryResConfList(); + + /******************/ + /* Function: 0x37 */ + + [todo] WERROR PNP_SetHwProf(); + + /******************/ + /* Function: 0x38 */ + + [todo] WERROR PNP_QueryArbitratorFreeData(); + + /******************/ + /* Function: 0x39 */ + + [todo] WERROR PNP_QueryArbitratorFreeSize(); + + /******************/ + /* Function: 0x3a */ + + [todo] WERROR PNP_RunDetection(); + + /******************/ + /* Function: 0x3b */ + + [todo] WERROR PNP_RegisterNotification(); + + /******************/ + /* Function: 0x3c */ + + [todo] WERROR PNP_UnregisterNotification(); + + /******************/ + /* Function: 0x3d */ + + [todo] WERROR PNP_GetCustomDevProp(); + + /******************/ + /* Function: 0x3e */ + + [todo] WERROR PNP_GetVersionInternal(); + + /******************/ + /* Function: 0x3f */ + + [todo] WERROR PNP_GetBlockedDriverInfo(); + + /******************/ + /* Function: 0x40 */ + + [todo] WERROR PNP_GetServerSideDeviceInstallFlags(); +} diff --git a/librpc/idl/orpc.idl b/librpc/idl/orpc.idl new file mode 100644 index 0000000..34a35e2 --- /dev/null +++ b/librpc/idl/orpc.idl @@ -0,0 +1,230 @@ +#include "idl_types.h" + +/** + DCOM interfaces + http://www.ietf.org/internet-drafts/draft-brown-dcom-v1-spec-04.txt + */ + +import "misc.idl"; + +[ + pointer_default(unique) +] +interface ObjectRpcBaseTypes +{ + /* COM_MINOR_VERSION = 1 (NT4.0, SP1, SP2, DCOM95). */ + /* - Initial Release */ + /* - Must be used when talking to downlevel machines, including */ + /* on Remote Activation calls. */ + /* COM_MINOR_VERSION = 2 (NT4.0 SP3 and beyond). */ + /* - Added ResolveOxid2 to IObjectExporter to retrieve the */ + /* COM version number of the server. Passed to the NDR engine */ + /* to fix fatal endian-ness flaw in the way OLEAUTOMATION marshals */ + /* BSTRS. Previous way used trailing padding, which is not NDR */ + /* compatible. See Bug# 69189. */ + /* COM_MINOR_VERSION = 3 (NT4.0 SP4 and DCOM95 builds 1018 and beyond) */ + /* - OLEAUT32 added two new types to the SAFEARRAY, but SAFEARRAY */ + /* previously included the "default" keyword, which prevented */ + /* downlevel NDR engines from correctly handling any extensions. */ + /* Machines with version >=5.3 don't use "default" and will */ + /* gracefully handle future extensions to SAFEARRAY. */ + /* old constants (for convenience) */ + + /* current version */ + const uint16 COM_MAJOR_VERSION = 5; + const uint16 COM_MINOR_VERSION = 1; + + /* Body Extensions */ + const string dcom_ext_debugging = "f1f19680-4d2a-11ce-a66a-0020af6e72f4"; + const string dcom_ext_extended_error = "f1f19681-4d2a-11ce-a66a-0020af6e72f4"; + + /* Component Object Model version number */ + + + typedef [public] struct + { + uint16 MajorVersion; /* Major version number */ + uint16 MinorVersion; /* Minor version number */ + } COMVERSION; + + /* enumeration of additional information present in the call packet. */ + typedef bitmap { + ORPCF_NULL = 0x00, /* no additional info in packet */ + ORPCF_LOCAL = 0x01, /* call is local to this machine */ + ORPCF_RESERVED1 = 0x02, /* reserved for local use */ + ORPCF_RESERVED2 = 0x04, /* reserved for local use */ + ORPCF_RESERVED3 = 0x08, /* reserved for local use */ + ORPCF_RESERVED4 = 0x10 /* reserved for local use */ + } ORPC_FLAGS; + + /* Extension to implicit parameters. */ + typedef [public] struct + { + GUID id; /* Extension identifier. */ + uint32 size; /* Extension size. */ + [size_is(((size+7)&~7))] uint8 data[]; /* Extension data. */ + } ORPC_EXTENT; + + + /* Array of extensions. */ + typedef struct + { + uint32 size; /* Num extents. */ + uint32 reserved; /* Must be zero. */ + [size_is(((size+1)&~1))] ORPC_EXTENT **extent; /* extents */ + } ORPC_EXTENT_ARRAY; + + + /* implicit 'this' pointer which is the first [in] parameter on */ + /* every ORPC call. */ + typedef [public] struct + { + COMVERSION version; /* COM version number */ + uint32 flags; /* ORPCF flags for presence of other data */ + uint32 reserved1; /* set to zero */ + GUID cid; /* causality id of caller */ + /* Extensions. */ + [unique] ORPC_EXTENT_ARRAY *extensions; + } ORPCTHIS; + + + /* implicit 'that' pointer which is the first [out] parameter on */ + /* every ORPC call. */ + typedef [public] struct + { + uint32 flags; /* ORPCF flags for presence of other data */ + /* Extensions. */ + [unique] ORPC_EXTENT_ARRAY *extensions; + } ORPCTHAT; + + + /* DUALSTRINGARRAYS are the return type for arrays of network addresses, */ + /* arrays of endpoints and arrays of both used in many ORPC interfaces */ + typedef [public,flag(NDR_NOALIGN)] struct + { + uint16 wTowerId; /* Cannot be zero. */ + nstring NetworkAddr; + } STRINGBINDING; + + typedef [public,nopush,nopull,noprint] struct + { + STRINGBINDING **stringbindings; + } STRINGARRAY; + + typedef [public,nopush,nopull,noprint] struct + { + STRINGBINDING **stringbindings; + SECURITYBINDING **securitybindings; + } DUALSTRINGARRAY; + + const uint16 COM_C_AUTHZ_NONE = 0xffff; + typedef [public,flag(NDR_NOALIGN)] struct + { + uint16 wAuthnSvc; /* Cannot be zero. */ + uint16 wAuthzSvc; + nstring PrincName; + } SECURITYBINDING; + + /* signature value for OBJREF (object reference, actually the */ + /* marshaled form of a COM interface). + * MEOW apparently stands for "Microsoft Extended Object Wireformat" + */ + const uint32 OBJREF_SIGNATURE = 0x574f454d; /* 'MEOW' */ + + /* flag values for OBJREF */ + typedef enum { + OBJREF_NULL = 0x0, /* NULL pointer */ + OBJREF_STANDARD = 0x1, /* standard marshaled objref */ + OBJREF_HANDLER = 0x2, /* handler marshaled objref */ + OBJREF_CUSTOM = 0x4 /* custom marshaled objref */ + } OBJREF_FLAGS; + + /* Flag values for a STDOBJREF (standard part of an OBJREF). */ + /* SORF_OXRES1 - SORF_OXRES8 are reserved for the object exporters */ + /* use only, object importers must ignore them and must not enforce MBZ. */ + typedef bitmap { + SORF_NULL = 0x0000, /* convenient for initializing SORF */ + SORF_OXRES1 = 0x0001, /* reserved for exporter */ + SORF_OXRES2 = 0x0020, /* reserved for exporter */ + SORF_OXRES3 = 0x0040, /* reserved for exporter */ + SORF_OXRES4 = 0x0080, /* reserved for exporter */ + SORF_OXRES5 = 0x0100, /* reserved for exporter */ + SORF_OXRES6 = 0x0200, /* reserved for exporter */ + SORF_OXRES7 = 0x0400, /* reserved for exporter */ + SORF_OXRES8 = 0x0800, /* reserved for exporter */ + SORF_NOPING = 0x1000 /* Pinging is not required */ + } STDOBJREF_FLAGS; + + /* standard object reference */ + typedef [public] struct + { + uint32 flags; /* STDOBJREF flags (see above) */ + uint32 cPublicRefs; /* count of references passed */ + hyper oxid; /* oxid of server with this oid */ + hyper oid; /* oid of object with this ipid */ + GUID ipid; /* ipid of interface pointer to this object */ + } STDOBJREF; + + typedef struct + { + STDOBJREF std; /* standard objref */ + STRINGARRAY saResAddr; /* resolver address */ + } u_standard; + + typedef struct + { + STDOBJREF std; /* standard objref */ + GUID clsid; /* Clsid of handler code */ + STRINGARRAY saResAddr; /* resolver address */ + } u_handler; + + typedef struct + { + GUID clsid; /* Clsid of unmarshaling code */ + uint32 cbExtension; /* size of extension data */ + uint32 size; /* size of data that follows */ + uint8 pData[size]; /* extension + class specific data */ + } u_custom; + + typedef struct + { + } u_null; + + typedef [nodiscriminant] union + { + [case(OBJREF_NULL)] u_null u_null; + [case(OBJREF_STANDARD)] u_standard u_standard; + [case(OBJREF_HANDLER)] u_handler u_handler; + [case(OBJREF_CUSTOM)] u_custom u_custom; + } OBJREF_Types; + + /* OBJREF is the format of a marshaled interface pointer. */ + typedef [public,flag(NDR_LITTLE_ENDIAN)] struct + { + uint32 signature; + uint32 flags; /* OBJREF flags (see above) */ + GUID iid; /* interface identifier */ + [switch_is(flags), switch_type(uint32)] OBJREF_Types u_objref; + } OBJREF; + + /* wire representation of a marshalled interface pointer */ + typedef [public] struct + { + uint32 size; + [subcontext(4)] OBJREF obj; + } MInterfacePointer; + + typedef [v1_enum,public] enum + { + COM_OK = 0x00000000, + COM_OUTOFMEMORY = 0x80000002, + COM_INVALIDARG = 0x80000003, + COM_NOINTERFACE = 0x80000004, + COM_ACCESSDENIED = 0x80070005, + COM_INVALID_OXID = 0x80070776, + COM_INVALID_OID = 0x80070777, + COM_INVALID_SET = 0x80070778, + COM_UNEXPECTED = 0x8000FFFF, + COM_CLSNOTFOUND = 0x80040154 + } COMRESULT; +} diff --git a/librpc/idl/oxidresolver.idl b/librpc/idl/oxidresolver.idl new file mode 100644 index 0000000..9700a1b --- /dev/null +++ b/librpc/idl/oxidresolver.idl @@ -0,0 +1,96 @@ +/** + DCOM interfaces + http://www.grimes.demon.co.uk/DCOM/DCOMSpec.htm + */ + +/* + The OXID Resolver can turn a OXID (Object Exporter ID) into a + RPC binding string that can be used to contact an object + + (used by DCOM) + */ + +import "misc.idl", "orpc.idl"; + +[ + uuid("99fcfec4-5260-101b-bbcb-00aa0021347a"), + helpstring("Object Exporter ID Resolver"), + endpoint("ncacn_np:[\\pipe\\epmapper]", "ncacn_ip_tcp:[135]", "ncalrpc:"), + pointer_default(unique) +] +interface IOXIDResolver +{ +#define OXID hyper +#define SETID hyper +#define IPID GUID +#define OID GUID + + /* Method to get the protocol sequences, string bindings */ + /* and machine id for an object server given its OXID. */ + + [idempotent] WERROR ResolveOxid ( + [in] OXID pOxid, + [in] uint16 cRequestedProtseqs, + [in, size_is(cRequestedProtseqs)] uint16 arRequestedProtseqs[], + [out] DUALSTRINGARRAY **ppdsaOxidBindings, + [out,ref] IPID *pipidRemUnknown, + [out,ref] uint32 *pAuthnHint + ); + + /* Simple ping is used to ping a Set. Client machines use this */ + /* to inform the object exporter that it is still using the */ + /* members of the set. */ + /* Returns S_TRUE if the SetId is known by the object exporter, */ + /* S_FALSE if not. */ + [idempotent] WERROR SimplePing ( + [in] SETID *SetId /* Must not be zero */ + ); + + /* Complex ping is used to create sets of OIDs to ping. The */ + /* whole set can subsequently be pinged using SimplePing, */ + /* thus reducing network traffic. */ + [idempotent] WERROR ComplexPing ( + [in,out,ref] SETID *SetId, /* In of 0 on first call for new set. */ + [in] uint16 SequenceNum, + [in] uint16 cAddToSet, + [in] uint16 cDelFromSet, + /* add these OIDs to the set */ + [in, size_is(cAddToSet)] OID AddToSet[], + /*remove these OIDs from the set */ + [in, size_is(cDelFromSet)] OID DelFromSet[], + [out,ref] uint16 *PingBackoffFactor/* 2^factor = multiplier */ + ); + + /* In some cases the client maybe unsure that a particular */ + /* binding will reach the server. (For example, when the oxid */ + /* bindings have more than one TCP/IP binding) This call */ + /* can be used to validate the binding */ + /* from the client. */ + [idempotent] WERROR ServerAlive (); + + /* Method to get the protocol sequences, string bindings, */ + /* RemoteUnknown IPID and COM version for an object server */ + /* given its OXID. Supported by DCOM */ + /* version 5.2 and above. Looks like that means + * Windows 2003/XP and above */ + [idempotent] WERROR ResolveOxid2 ( + [in] OXID pOxid, + [in] uint16 cRequestedProtseqs, + [in, size_is(cRequestedProtseqs)] uint16 arRequestedProtseqs[], + [out] DUALSTRINGARRAY **pdsaOxidBindings, + [out,ref] IPID *ipidRemUnknown, + [out,ref] uint32 *AuthnHint, + [out,ref] COMVERSION *ComVersion + ); + + typedef struct { + COMVERSION version; + uint32 unknown1; + } COMINFO; + + [idempotent] WERROR ServerAlive2 ( + [out,ref] COMINFO *info, + [out,ref] DUALSTRINGARRAY **dualstring, + [out,ref] uint8 *pReserved + ); +} diff --git a/librpc/idl/policyagent.idl b/librpc/idl/policyagent.idl new file mode 100644 index 0000000..ab137fa --- /dev/null +++ b/librpc/idl/policyagent.idl @@ -0,0 +1,13 @@ + +/* IPSec policy agent (Win2k) */ +[ + uuid("d335b8f6-cb31-11d0-b0f9-006097ba4e54"), + version(1.5), + pointer_default(unique), + helpstring("IPSec Policy Agent") +] interface policyagent +{ + /*****************/ + /* Function 0x00 */ + [todo] WERROR policyagent_Dummy(); +} diff --git a/librpc/idl/preg.idl b/librpc/idl/preg.idl new file mode 100644 index 0000000..c3adb50 --- /dev/null +++ b/librpc/idl/preg.idl @@ -0,0 +1,44 @@ +#include "idl_types.h" + +import "misc.idl"; + +/* + IDL structures defining PReg files + + more info can be found at: + http://msdn2.microsoft.com/en-us/library/aa374407.aspx +*/ + +[ + pointer_default(unique), + helper("../librpc/ndr/ndr_preg.h"), + helpstring("PReg structure"), + uuid("67655250-0000-0000-0000-00000000") +] + interface preg +{ + typedef [public,flag(NDR_PAHEX)] struct { + [charset(DOS),value("["),noprint] uint8 _opening_bracket[2]; + nstring keyname; + [charset(DOS),value(";"),noprint] uint8 _sep1[2]; + nstring valuename; + [charset(DOS),value(";"),noprint] uint8 _sep2[2]; + winreg_Type type; + [charset(DOS),value(";"),noprint] uint8 _sep3[2]; + [value(ndr_size_winreg_Data_GPO(&data,type,ndr->flags))] uint32 size; + [charset(DOS),value(";"),noprint] uint8 _sep4[2]; + [subcontext(0),subcontext_size(size),flag(NDR_REMAINING), switch_is(type)] winreg_Data_GPO data; + [charset(DOS),value("]"),noprint] uint8 _closing_bracket[2]; + } preg_entry; + + typedef [public] struct { + [charset(DOS),value("PReg")] uint8 signature[4]; + [value(1)] uint32 version; + } preg_header; + + typedef [public,flag(NDR_NOALIGN),nopush,nopull] struct { + preg_header header; + uint32 num_entries; + preg_entry entries[num_entries]; + } preg_file; +} diff --git a/librpc/idl/printcap.idl b/librpc/idl/printcap.idl new file mode 100644 index 0000000..d9c34f3 --- /dev/null +++ b/librpc/idl/printcap.idl @@ -0,0 +1,18 @@ +#include "idl_types.h" +[ + pointer_default(unique) +] +interface printcap +{ + typedef struct { + [charset(UTF8),string] uint8 *name; + [charset(UTF8),string] uint8 *info; + [charset(UTF8),string] uint8 *location; + } pcap_printer; + + typedef [public] struct { + NTSTATUS status; + uint32 count; + [size_is(count)] pcap_printer printers[]; + } pcap_data; +} diff --git a/librpc/idl/quota.idl b/librpc/idl/quota.idl new file mode 100644 index 0000000..8d713c8 --- /dev/null +++ b/librpc/idl/quota.idl @@ -0,0 +1,54 @@ +#include "idl_types.h" + +import "security.idl"; + +[ + pointer_default(unique) +] + +interface file_quota { + + /* MS-FSCC 2.4.33.1 */ + typedef [public] struct { + uint32 next_entry_offset; + uint32 sid_length; + dom_sid sid; + } file_get_quota_info; + + /* MS-FSCC 2.4.33 */ + typedef [public] struct { + uint32 next_entry_offset; + uint32 sid_length; + hyper change_time; + hyper quota_used; + hyper quota_threshold; + hyper quota_limit; + dom_sid sid; + } file_quota_information; +} + +interface smb2_query_quota +{ + /* MS-SMB2 2.2.37.1 */ + typedef [public] struct { + uint8 return_single; + uint8 restart_scan; + uint16 reserved; + uint32 sid_list_length; + uint32 start_sid_length; + uint32 start_sid_offset; + } smb2_query_quota_info; +} + +interface smb1_nt_transact_query_quota +{ + /* MS-SMB 2.2.7.5.1 */ + typedef [public] struct { + uint16 fid; + uint8 return_single_entry; + uint8 restart_scan; + uint32 sid_list_length; + uint32 start_sid_length; + uint32 start_sid_offset; + } nttrans_query_quota_params; +} diff --git a/librpc/idl/rap.idl b/librpc/idl/rap.idl new file mode 100644 index 0000000..780951c --- /dev/null +++ b/librpc/idl/rap.idl @@ -0,0 +1,1076 @@ +#include "idl_types.h" + +/* + rap interface definition +*/ + +[ + pointer_default(unique), + helper("../librpc/ndr/ndr_rap.h") +] +interface rap +{ + typedef [public,noprint] enum { + NERR_Success = 0 + } rap_status; + + const int RAP_WshareEnum = 0; + const int RAP_WshareGetInfo = 1; + const int RAP_WshareSetInfo = 2; + const int RAP_WshareAdd = 3; + const int RAP_WshareDel = 4; + const int RAP_NetShareCheck = 5; + const int RAP_WsessionEnum = 6; + const int RAP_WsessionGetInfo = 7; + const int RAP_WsessionDel = 8; + const int RAP_WconnectionEnum = 9; + const int RAP_WfileEnum = 10; + const int RAP_WfileGetInfo = 11; + const int RAP_WfileClose = 12; + const int RAP_WserverGetInfo = 13; + const int RAP_WserverSetInfo = 14; + const int RAP_WserverDiskEnum = 15; + const int RAP_WserverAdminCommand = 16; + const int RAP_NetAuditOpen = 17; + const int RAP_WauditClear = 18; + const int RAP_NetErrorLogOpen = 19; + const int RAP_WerrorLogClear = 20; + const int RAP_NetCharDevEnum = 21; + const int RAP_NetCharDevGetInfo = 22; + const int RAP_WCharDevControl = 23; + const int RAP_NetCharDevQEnum = 24; + const int RAP_NetCharDevQGetInfo = 25; + const int RAP_WCharDevQSetInfo = 26; + const int RAP_WCharDevQPurge = 27; + const int RAP_WCharDevQPurgeSelf = 28; + const int RAP_WMessageNameEnum = 29; + const int RAP_WMessageNameGetInfo = 30; + const int RAP_WMessageNameAdd = 31; + const int RAP_WMessageNameDel = 32; + const int RAP_WMessageNameFwd = 33; + const int RAP_WMessageNameUnFwd = 34; + const int RAP_WMessageBufferSend = 35; + const int RAP_WMessageFileSend = 36; + const int RAP_WMessageLogFileSet = 37; + const int RAP_WMessageLogFileGet = 38; + const int RAP_WServiceEnum = 39; + const int RAP_WServiceInstall = 40; + const int RAP_WServiceControl = 41; + const int RAP_WAccessEnum = 42; + const int RAP_WAccessGetInfo = 43; + const int RAP_WAccessSetInfo = 44; + const int RAP_WAccessAdd = 45; + const int RAP_WAccessDel = 46; + const int RAP_WGroupEnum = 47; + const int RAP_WGroupAdd = 48; + const int RAP_WGroupDel = 49; + const int RAP_WGroupAddUser = 50; + const int RAP_WGroupDelUser = 51; + const int RAP_WGroupGetUsers = 52; + const int RAP_WUserEnum = 53; + const int RAP_WUserAdd = 54; + const int RAP_WUserDel = 55; + const int RAP_WUserGetInfo = 56; + const int RAP_WUserSetInfo = 57; + const int RAP_WUserPasswordSet = 58; + const int RAP_WUserGetGroups = 59; + const int RAP_WWkstaSetUID = 62; + const int RAP_WWkstaGetInfo = 63; + const int RAP_WWkstaSetInfo = 64; + const int RAP_WUseEnum = 65; + const int RAP_WUseAdd = 66; + const int RAP_WUseDel = 67; + const int RAP_WUseGetInfo = 68; + const int RAP_WPrintQEnum = 69; + const int RAP_WPrintQGetInfo = 70; + const int RAP_WPrintQSetInfo = 71; + const int RAP_WPrintQAdd = 72; + const int RAP_WPrintQDel = 73; + const int RAP_WPrintQPause = 74; + const int RAP_WPrintQContinue = 75; + const int RAP_WPrintJobEnum = 76; + const int RAP_WPrintJobGetInfo = 77; + const int RAP_WPrintJobSetInfo_OLD = 78; + const int RAP_WPrintJobDel = 81; + const int RAP_WPrintJobPause = 82; + const int RAP_WPrintJobContinue = 83; + const int RAP_WPrintDestEnum = 84; + const int RAP_WPrintDestGetInfo = 85; + const int RAP_WPrintDestControl = 86; + const int RAP_WProfileSave = 87; + const int RAP_WProfileLoad = 88; + const int RAP_WStatisticsGet = 89; + const int RAP_WStatisticsClear = 90; + const int RAP_NetRemoteTOD = 91; + const int RAP_WNetBiosEnum = 92; + const int RAP_WNetBiosGetInfo = 93; + const int RAP_NetServerEnum = 94; + const int RAP_I_NetServerEnum = 95; + const int RAP_WServiceGetInfo = 96; + const int RAP_WPrintQPurge = 103; + const int RAP_NetServerEnum2 = 104; + const int RAP_WAccessGetUserPerms = 105; + const int RAP_WGroupGetInfo = 106; + const int RAP_WGroupSetInfo = 107; + const int RAP_WGroupSetUsers = 108; + const int RAP_WUserSetGroups = 109; + const int RAP_WUserModalsGet = 110; + const int RAP_WUserModalsSet = 111; + const int RAP_WFileEnum2 = 112; + const int RAP_WUserAdd2 = 113; + const int RAP_WUserSetInfo2 = 114; + const int RAP_WUserPasswordSet2 = 115; + const int RAP_I_NetServerEnum2 = 116; + const int RAP_WConfigGet2 = 117; + const int RAP_WConfigGetAll2 = 118; + const int RAP_WGetDCName = 119; + const int RAP_NetHandleGetInfo = 120; + const int RAP_NetHandleSetInfo = 121; + const int RAP_WStatisticsGet2 = 122; + const int RAP_WBuildGetInfo = 123; + const int RAP_WFileGetInfo2 = 124; + const int RAP_WFileClose2 = 125; + const int RAP_WNetServerReqChallenge = 126; + const int RAP_WNetServerAuthenticate = 127; + const int RAP_WNetServerPasswordSet = 128; + const int RAP_WNetAccountDeltas = 129; + const int RAP_WNetAccountSync = 130; + const int RAP_WUserEnum2 = 131; + const int RAP_WWkstaUserLogon = 132; + const int RAP_WWkstaUserLogoff = 133; + const int RAP_WLogonEnum = 134; + const int RAP_WErrorLogRead = 135; + const int RAP_NetPathType = 136; + const int RAP_NetPathCanonicalize = 137; + const int RAP_NetPathCompare = 138; + const int RAP_NetNameValidate = 139; + const int RAP_NetNameCanonicalize = 140; + const int RAP_NetNameCompare = 141; + const int RAP_WAuditRead = 142; + const int RAP_WPrintDestAdd = 143; + const int RAP_WPrintDestSetInfo = 144; + const int RAP_WPrintDestDel = 145; + const int RAP_WUserValidate2 = 146; + const int RAP_WPrintJobSetInfo = 147; + const int RAP_TI_NetServerDiskEnum = 148; + const int RAP_TI_NetServerDiskGetInfo = 149; + const int RAP_TI_FTVerifyMirror = 150; + const int RAP_TI_FTAbortVerify = 151; + const int RAP_TI_FTGetInfo = 152; + const int RAP_TI_FTSetInfo = 153; + const int RAP_TI_FTLockDisk = 154; + const int RAP_TI_FTFixError = 155; + const int RAP_TI_FTAbortFix = 156; + const int RAP_TI_FTDiagnoseError = 157; + const int RAP_TI_FTGetDriveStats = 158; + const int RAP_TI_FTErrorGetInfo = 160; + const int RAP_NetAccessCheck = 163; + const int RAP_NetAlertRaise = 164; + const int RAP_NetAlertStart = 165; + const int RAP_NetAlertStop = 166; + const int RAP_NetAuditWrite = 167; + const int RAP_NetIRemoteAPI = 168; + const int RAP_NetServiceStatus = 169; + const int RAP_NetServerRegister = 170; + const int RAP_NetServerDeregister = 171; + const int RAP_NetSessionEntryMake = 172; + const int RAP_NetSessionEntryClear = 173; + const int RAP_NetSessionEntryGetInfo = 174; + const int RAP_NetSessionEntrySetInfo = 175; + const int RAP_NetConnectionEntryMake = 176; + const int RAP_NetConnectionEntryClear = 177; + const int RAP_NetConnectionEntrySetInfo = 178; + const int RAP_NetConnectionEntryGetInfo = 179; + const int RAP_NetFileEntryMake = 180; + const int RAP_NetFileEntryClear = 181; + const int RAP_NetFileEntrySetInfo = 182; + const int RAP_NetFileEntryGetInfo = 183; + const int RAP_AltSrvMessageBufferSend = 184; + const int RAP_AltSrvMessageFileSend = 185; + const int RAP_wI_NetRplWkstaEnum = 186; + const int RAP_wI_NetRplWkstaGetInfo = 187; + const int RAP_wI_NetRplWkstaSetInfo = 188; + const int RAP_wI_NetRplWkstaAdd = 189; + const int RAP_wI_NetRplWkstaDel = 190; + const int RAP_wI_NetRplProfileEnum = 191; + const int RAP_wI_NetRplProfileGetInfo = 192; + const int RAP_wI_NetRplProfileSetInfo = 193; + const int RAP_wI_NetRplProfileAdd = 194; + const int RAP_wI_NetRplProfileDel = 195; + const int RAP_wI_NetRplProfileClone = 196; + const int RAP_wI_NetRplBaseProfileEnum = 197; + const int RAP_WIServerSetInfo = 201; + const int RAP_WPrintDriverEnum = 205; + const int RAP_WPrintQProcessorEnum = 206; + const int RAP_WPrintPortEnum = 207; + const int RAP_WNetWriteUpdateLog = 208; + const int RAP_WNetAccountUpdate = 209; + const int RAP_WNetAccountConfirmUpdate = 210; + const int RAP_WConfigSet = 211; + const int RAP_WAccountsReplicate = 212; + const int RAP_SamOEMChgPasswordUser2_P = 214; + const int RAP_NetServerEnum3 = 215; + const int RAP_WprintDriverGetInfo = 250; + const int RAP_WprintDriverSetInfo = 251; + const int RAP_WaliasAdd = 252; + const int RAP_WaliasDel = 253; + const int RAP_WaliasGetInfo = 254; + const int RAP_WaliasSetInfo = 255; + const int RAP_WaliasEnum = 256; + const int RAP_WuserGetLogonAsn = 257; + const int RAP_WuserSetLogonAsn = 258; + const int RAP_WuserGetAppSel = 259; + const int RAP_WuserSetAppSel = 260; + const int RAP_WappAdd = 261; + const int RAP_WappDel = 262; + const int RAP_WappGetInfo = 263; + const int RAP_WappSetInfo = 264; + const int RAP_WappEnum = 265; + const int RAP_WUserDCDBInit = 266; + const int RAP_WDASDAdd = 267; + const int RAP_WDASDDel = 268; + const int RAP_WDASDGetInfo = 269; + const int RAP_WDASDSetInfo = 270; + const int RAP_WDASDEnum = 271; + const int RAP_WDASDCheck = 272; + const int RAP_WDASDCtl = 273; + const int RAP_WuserRemoteLogonCheck = 274; + const int RAP_WUserPasswordSet3 = 275; + const int RAP_WCreateRIPLMachine = 276; + const int RAP_WDeleteRIPLMachine = 277; + const int RAP_WGetRIPLMachineInfo = 278; + const int RAP_WSetRIPLMachineInfo = 279; + const int RAP_WEnumRIPLMachine = 280; + const int RAP_I_ShareAdd = 281; + const int RAP_AliasEnum = 282; + const int RAP_WaccessApply = 283; + const int RAP_WPrt16Query = 284; + const int RAP_WPrt16Set = 285; + const int RAP_WUserDel100 = 286; + const int RAP_WUserRemoteLogonCheck2 = 287; + const int RAP_WRemoteTODSet = 294; + const int RAP_WprintJobMoveAll = 295; + const int RAP_W16AppParmAdd = 296; + const int RAP_W16AppParmDel = 297; + const int RAP_W16AppParmGet = 298; + const int RAP_W16AppParmSet = 299; + const int RAP_W16RIPLMachineCreate = 300; + const int RAP_W16RIPLMachineGetInfo = 301; + const int RAP_W16RIPLMachineSetInfo = 302; + const int RAP_W16RIPLMachineEnum = 303; + const int RAP_W16RIPLMachineListParmEnum = 304; + const int RAP_W16RIPLMachClassGetInfo = 305; + const int RAP_W16RIPLMachClassEnum = 306; + const int RAP_W16RIPLMachClassCreate = 307; + const int RAP_W16RIPLMachClassSetInfo = 308; + const int RAP_W16RIPLMachClassDelete = 309; + const int RAP_W16RIPLMachClassLPEnum = 310; + const int RAP_W16RIPLMachineDelete = 311; + const int RAP_W16WSLevelGetInfo = 312; + const int RAP_WserverNameAdd = 313; + const int RAP_WserverNameDel = 314; + const int RAP_WserverNameEnum = 315; + const int RAP_I_WDASDEnum = 316; + const int RAP_WDASDEnumTerminate = 317; + const int RAP_WDASDSetInfo2 = 318; + const int MAX_API = 318; + + /* sizes of fixed-length fields, including null terminator */ + const int RAP_GROUPNAME_LEN = 21; + const int RAP_USERNAME_LEN = 21; + const int RAP_SHARENAME_LEN = 13; + const int RAP_UPASSWD_LEN = 16; /* user password */ + const int RAP_SPASSWD_LEN = 9; /* share password */ + const int RAP_MACHNAME_LEN = 16; + const int RAP_SRVCNAME_LEN = 16; + const int RAP_SRVCCMNT_LEN = 64; + const int RAP_DATATYPE_LEN = 10; + + typedef struct { + uint8 group_name[21]; + char reserved1; + astring *comment; + } rap_group_info_1; + + typedef struct { + uint8 user_name[21]; + char reserved1; + uint8 passwrd[16]; + uint32 pwage; + uint16 priv; + astring *home_dir; + astring *comment; + uint16 userflags; + astring *logon_script; + } rap_user_info_1; + + typedef struct { + uint8 service_name[16]; + uint16 status; + uint32 installcode; + uint16 process_num; + astring *comment; + } rap_service_info_2; + + typedef struct { + uint8 share_name[13]; + } rap_share_info_0; + + typedef struct { + uint8 share_name[13]; + char reserved1; + uint16 share_type; + astring *comment; + } rap_share_info_1; + + typedef struct { + uint8 share_name[13]; + char reserved1; + uint16 share_type; + astring *comment; + uint16 perms; + uint16 maximum_users; + uint16 active_users; + astring *path; + uint8 password[9]; + char reserved2; + } rap_share_info_2; + + typedef [nodiscriminant] union { + [case(0)] rap_share_info_0 info0; + [case(1)] rap_share_info_1 info1; + [case(2)] rap_share_info_2 info2; + } rap_share_info; + + [public] void rap_NetShareEnum( + [in] uint16 level, + [in] uint16 bufsize, + [out] rap_status status, + [out] uint16 convert, + [out] uint16 count, + [out] uint16 available, + [out,switch_is(level)] rap_share_info *info + ); + + /* not documented in MS-RAP */ + [public] void rap_NetShareAdd( + [in] uint16 level, + [in] uint16 bufsize, + [in,switch_is(level)] rap_share_info info, + [out] rap_status status, + [out] uint16 convert + ); + + typedef struct { + uint8 name[16]; + } rap_server_info_0; + + typedef struct { + uint8 name[16]; + uint8 version_major; + uint8 version_minor; + uint32 servertype; + astring *comment; + } rap_server_info_1; + + typedef [nodiscriminant] union { + [case(0)] rap_server_info_0 info0; + [case(1)] rap_server_info_1 info1; + } rap_server_info; + + [public] void rap_NetServerEnum2( + [in] uint16 level, + [in] uint16 bufsize, + [in] uint32 servertype, + [in] astring *domain, + [out] rap_status status, + [out] uint16 convert, + [out] uint16 count, + [out] uint16 available, + [out,switch_is(level)] rap_server_info info[count] + ); + + [public] void rap_WserverGetInfo( + [in] uint16 level, + [in] uint16 bufsize, + [out] rap_status status, + [out] uint16 convert, + [out] uint16 available, + [out,switch_is(level)] rap_server_info info + ); + + typedef [public] enum { + PRJ_QS_QUEUED = 0x0000, + PRJ_QS_PAUSED = 0x0001, + PRJ_QS_SPOOLING = 0x0002, + PRJ_QS_PRINTING = 0x0003, + PRJ_QS_ERROR = 0x0010 + } rap_PrintJStatusCode; + + typedef struct { + uint16 JobID; + } rap_PrintJobInfo0; + + typedef struct { + uint16 JobID; + [charset(DOS)] uint8 UserName[21]; + uint8 Pad; + [charset(DOS)] uint8 NotifyName[16]; + [charset(DOS)] uint8 DataType[10]; + [relative_short] astring *PrintParameterString; + uint16 PrintParameterStringHigh; + uint16 JobPosition; + rap_PrintJStatusCode JobStatus; + [relative_short] astring *JobStatusString; + uint16 JobStatusStringHigh; + time_t TimeSubmitted; + uint32 JobSize; + [relative_short] astring *JobCommentString; + uint16 JobCommentStringHigh; + } rap_PrintJobInfo1; + + typedef struct { + uint16 JobID; + uint16 Priority; + [relative_short] astring *UserName; + uint16 UserNameHigh; + uint16 JobPosition; + rap_PrintJStatusCode JobStatus; + time_t TimeSubmitted; + uint32 JobSize; + [relative_short] astring *JobCommentString; + uint16 JobCommentStringHigh; + [relative_short] astring *DocumentName; + uint16 DocumentNameHigh; + } rap_PrintJobInfo2; + + typedef struct { + uint16 JobID; + uint16 Priority; + [relative_short] astring *UserName; + uint16 UserNameHigh; + uint16 JobPosition; + rap_PrintJStatusCode JobStatus; + time_t TimeSubmitted; + uint32 JobSize; + [relative_short] astring *JobCommentString; + uint16 JobCommentStringHigh; + [relative_short] astring *DocumentName; + uint16 DocumentNameHigh; + [relative_short] astring *NotifyName; + uint16 NotifyNameHigh; + [relative_short] astring *DataType; + uint16 DataTypeHigh; + [relative_short] astring *PrintParameterString; + uint16 PrintParameterStringHigh; + [relative_short] astring *StatusString; + uint16 StatusStringHigh; + [relative_short] astring *QueueName; + uint16 QueueNameHigh; + [relative_short] astring *PrintProcessorName; + uint16 PrintProcessorNameHigh; + [relative_short] astring *PrintProcessorParams; + uint16 PrintProcessorParamsHigh; + [relative_short] astring *DriverName; + uint16 DriverNameHigh; + [relative_short] astring *DriverDataOffset; + uint16 DriverDataOffsetHigh; + [relative_short] astring *PrinterNameOffset; + uint16 PrinterNameOffsetHigh; + } rap_PrintJobInfo3; + + typedef [public,nodiscriminant] union { + [case(0)] rap_PrintJobInfo0 info0; + [case(1)] rap_PrintJobInfo1 info1; + [case(2)] rap_PrintJobInfo2 info2; + [case(3)] rap_PrintJobInfo3 info3; + } rap_printj_info; + + typedef [public] enum { + PRQ_ACTIVE = 0x0000, + PRQ_PAUSE = 0x0001, + PRQ_ERROR = 0x0002, + PRQ_PENDING = 0x0003 + } rap_PrintQStatusCode; + + typedef struct { + [charset(DOS)] uint8 PrintQName[13]; + } rap_PrintQueue0; + + typedef struct { + [charset(DOS)] uint8 PrintQName[13]; + uint8 Pad1; + uint16 Priority; + uint16 StartTime; + uint16 UntilTime; + [relative_short] astring *SeparatorPageFilename; + uint16 SeparatorPageFilenameHigh; + [relative_short] astring *PrintProcessorDllName; + uint16 PrintProcessorDllNameHigh; + [relative_short] astring *PrintDestinationsName; + uint16 PrintDestinationsNameHigh; + [relative_short] astring *PrintParameterString; + uint16 PrintParameterStringHigh; + [relative_short] astring *CommentString; + uint16 CommentStringHigh; + rap_PrintQStatusCode PrintQStatus; + uint16 PrintJobCount; + } rap_PrintQueue1; + + typedef struct { + rap_PrintQueue1 queue; + rap_PrintJobInfo1 job[queue.PrintJobCount]; + } rap_PrintQueue2; + + typedef [public] struct { + [relative_short] astring *PrintQueueName; + uint16 PrintQueueNameHigh; + uint16 Priority; + uint16 StartTime; + uint16 UntilTime; + uint16 Pad; + [relative_short] astring *SeparatorPageFilename; + uint16 SeparatorPageFilenameHigh; + [relative_short] astring *PrintProcessorDllName; + uint16 PrintProcessorDllNameHigh; + [relative_short] astring *PrintParameterString; + uint16 PrintParameterStringHigh; + [relative_short] astring *CommentString; + uint16 CommentStringHigh; + rap_PrintQStatusCode PrintQStatus; + uint16 PrintJobCount; + [relative_short] astring *Printers; + uint16 PrintersHigh; + [relative_short] astring *DriverName; + uint16 DriverNameHigh; + [relative_short] astring *PrintDriverData; + uint16 PrintDriverDataHigh; + } rap_PrintQueue3; + + typedef struct { + rap_PrintQueue3 queue; + rap_PrintJobInfo2 job[queue.PrintJobCount]; + } rap_PrintQueue4; + + typedef struct { + [relative_short] astring *PrintQueueName; + uint16 PrintQueueNameHigh; + } rap_PrintQueue5; + + typedef [public,nodiscriminant] union { + [case(0)] rap_PrintQueue0 info0; + [case(1)] rap_PrintQueue1 info1; + [case(2)] rap_PrintQueue2 info2; + [case(3)] rap_PrintQueue3 info3; + [case(4)] rap_PrintQueue4 info4; + [case(5)] rap_PrintQueue5 info5; + } rap_printq_info; + + [public] void rap_NetPrintQEnum( + [in] uint16 level, + [in] uint16 bufsize, + [out] rap_status status, + [out] uint16 convert, + [out] uint16 count, + [out] uint16 available, + [out,switch_is(level)] rap_printq_info info[count] + ); + + [public] void rap_NetPrintQGetInfo( + [in] astring PrintQueueName, + [in] uint16 level, + [in] uint16 bufsize, + [out] rap_status status, + [out] uint16 convert, + [out] uint16 available, + [out,switch_is(level)] rap_printq_info info + ); + + [public] void rap_NetPrintJobPause( + [in] uint16 JobID, + [out] rap_status status, + [out] uint16 convert + ); + + [public] void rap_NetPrintJobContinue( + [in] uint16 JobID, + [out] rap_status status, + [out] uint16 convert + ); + + [public] void rap_NetPrintJobDelete( + [in] uint16 JobID, + [out] rap_status status, + [out] uint16 convert + ); + + /* not documented in MS-RAP */ + [public] void rap_NetPrintQueuePause( + [in] astring PrintQueueName, + [out] rap_status status, + [out] uint16 convert + ); + + /* not documented in MS-RAP */ + [public] void rap_NetPrintQueueResume( + [in] astring PrintQueueName, + [out] rap_status status, + [out] uint16 convert + ); + + /* not documented in MS-RAP */ + [public] void rap_NetPrintQueuePurge( + [in] astring PrintQueueName, + [out] rap_status status, + [out] uint16 convert + ); + + /* not documented in MS-RAP */ + [public] void rap_NetPrintJobEnum( + [in] astring PrintQueueName, + [in] uint16 level, + [in] uint16 bufsize, + [out] rap_status status, + [out] uint16 convert, + [out] uint16 count, + [out] uint16 available, + [out,switch_is(level)] rap_printj_info info[count] + ); + + [public] void rap_NetPrintJobGetInfo( + [in] uint16 JobID, + [in] uint16 level, + [in] uint16 bufsize, + [out] rap_status status, + [out] uint16 convert, + [out] uint16 available, + [out,switch_is(level)] rap_printj_info info + ); + + typedef enum { + RAP_PARAM_JOBNUM = 0x0001, + RAP_PARAM_USERNAME = 0x0002, + RAP_PARAM_NOTIFYNAME = 0x0003, + RAP_PARAM_DATATYPE = 0x0004, + RAP_PARAM_PARAMETERS_STRING = 0x0005, + RAP_PARAM_JOBPOSITION = 0x0006, + RAP_PARAM_JOBSTATUS = 0x0007, + RAP_PARAM_JOBSTATUSSTR = 0x0008, + RAP_PARAM_TIMESUBMITTED = 0x0009, + RAP_PARAM_JOBSIZE = 0x000a, + RAP_PARAM_JOBCOMMENT = 0x000b + } rap_JobInfoParamNum; + + typedef [nodiscriminant] union { + [case (RAP_PARAM_JOBNUM)] uint16 value; + [case (RAP_PARAM_USERNAME)] astring string; + [case (RAP_PARAM_NOTIFYNAME)] astring string; + [case (RAP_PARAM_DATATYPE)] astring string; + [case (RAP_PARAM_PARAMETERS_STRING)] astring string; + [case (RAP_PARAM_JOBPOSITION)] uint16 value; + [case (RAP_PARAM_JOBSTATUS)] uint16 value; + [case (RAP_PARAM_JOBSTATUSSTR)] astring string; + [case (RAP_PARAM_TIMESUBMITTED)] uint32 value4; + [case (RAP_PARAM_JOBSIZE)] uint32 value4; + [case (RAP_PARAM_JOBCOMMENT)] astring string; + } rap_JobInfoParam; + + [public] void rap_NetPrintJobSetInfo( + [in] uint16 JobID, + [in] uint16 level, + [in] uint16 bufsize, + [in] rap_JobInfoParamNum ParamNum, + [in,switch_is(ParamNum)] rap_JobInfoParam Param, + [out] rap_status status, + [out] uint16 convert + ); + + /* all not documented in MS-RAP */ + + typedef struct { + [charset(DOS)] uint8 PrintDestName[9]; + } rap_PrintDest0; + + typedef struct { + [charset(DOS)] uint8 PrintDestName[9]; + [charset(DOS)] uint8 UserName[21]; + uint16 JobId; + uint16 Status; + [relative_short] astring *StatusStringName; + uint16 PrintQueueNameHigh; + uint16 Time; + } rap_PrintDest1; + + typedef struct { + [relative_short] astring *PrinterName; + uint16 PrinterNameHigh; + } rap_PrintDest2; + + typedef struct { + [relative_short] astring *PrinterName; + uint16 PrinterNameHigh; + [relative_short] astring *UserName; + uint16 UserNameHigh; + [relative_short] astring *LogAddr; + uint16 LogAddrHigh; + uint16 JobId; + uint16 Status; + [relative_short] astring *StatusStringName; + uint16 PrintQueueNameHigh; + [relative_short] astring *Comment; + uint16 CommentHigh; + [relative_short] astring *Drivers; + uint16 DriversHigh; + uint16 Time; + uint16 Pad1; + } rap_PrintDest3; + + typedef [public,nodiscriminant] union { + [case(0)] rap_PrintDest0 info0; + [case(1)] rap_PrintDest1 info1; + [case(2)] rap_PrintDest2 info2; + [case(3)] rap_PrintDest3 info3; + } rap_printdest_info; + + /* not documented in MS-RAP */ + [public] void rap_NetPrintDestEnum( + [in] uint16 level, + [in] uint16 bufsize, + [out] rap_status status, + [out] uint16 convert, + [out] uint16 count, + [out] uint16 available, + [out,switch_is(level)] rap_printdest_info info[count] + ); + + /* not documented in MS-RAP */ + [public] void rap_NetPrintDestGetInfo( + [in] astring PrintDestName, + [in] uint16 level, + [in] uint16 bufsize, + [out] rap_status status, + [out] uint16 convert, + [out] uint16 available, + [out,switch_is(level)] rap_printdest_info info + ); + + [public] void rap_NetUserPasswordSet2( + [in] astring UserName, + [in] uint8 OldPassword[16], + [in] uint8 NewPassword[16], + [in] uint16 EncryptedPassword, + [in] uint16 RealPasswordLength, + [out] rap_status status, + [out] uint16 convert + ); + + /* not documented in MS-RAP */ + [public] void rap_NetOEMChangePassword( + [in] astring UserName, + [in] uint8 crypt_password[516], + [in] uint8 password_hash[16], + [out] rap_status status, + [out] uint16 convert + ); + + typedef struct { + [charset(DOS)] uint8 Name[21]; + } rap_NetUserInfo0; + + typedef [public] enum { + USER_PRIV_GUEST = 0, + USER_PRIV_USER = 1, + USER_PRIV_ADMIN = 2 + } rap_UserPriv; + + typedef struct { + [charset(DOS)] uint8 Name[21]; + uint8 Pad; + uint8 Password[16]; + time_t PasswordAge; + rap_UserPriv Priv; + [relative_short] astring *HomeDir; + uint16 HomeDirHigh; + [relative_short] astring *Comment; + uint16 CommentHigh; + uint16 Flags; /* FIXME */ + [relative_short] astring *ScriptPath; + uint16 ScriptPathHigh; + } rap_NetUserInfo1; + + typedef [public,v1_enum] enum { + AF_OP_PRINT = 0, + AF_OP_COMM = 1, + AF_OP_SERVER = 2, + AF_OP_ACCOUNTS = 3 + } rap_AuthFlags; + + typedef [public] struct { + uint8 LogonHours[21]; + } rap_LogonHours; + + typedef struct { + [charset(DOS)] uint8 Name[21]; + uint8 Pad; + uint8 Password[16]; + time_t PasswordAge; + rap_UserPriv Priv; + [relative_short] astring *HomeDir; + uint16 HomeDirHigh; + [relative_short] astring *Comment; + uint16 CommentHigh; + uint16 Flags; /* FIXME */ + [relative_short] astring *ScriptPath; + uint16 ScriptPathHigh; + rap_AuthFlags AuthFlags; + [relative_short] astring *FullName; + uint16 FullNameHigh; + [relative_short] astring *UsrComment; + uint16 UsrCommentHigh; + [relative_short] astring *pParms; + uint16 pParmsHigh; + [relative_short] astring *WorkStations; + uint16 WorkStationsHigh; + time_t LastLogon; + time_t LastLogOff; + time_t AcctExpires; + uint32 MaxStorage; + uint16 UnitsPerWeek; + [relative_short] rap_LogonHours *LogonHours; + uint16 LogonHoursHigh; + uint16 BadPwCount; + uint16 NumLogons; + [relative_short] astring *LogonServer; + uint16 LogonServerHigh; + uint16 CountryCode; + uint16 CodePage; + } rap_NetUserInfo2; + + typedef struct { + [charset(DOS)] uint8 Name[21]; + uint8 Pad; + [relative_short] astring *Comment; + uint16 CommentHigh; + [relative_short] astring *UsrComment; + uint16 UsrCommentHigh; + [relative_short] astring *FullName; + uint16 FullNameHigh; + } rap_NetUserInfo10; + + typedef struct { + [charset(DOS)] uint8 Name[21]; + uint8 Pad; + [relative_short] astring *Comment; + uint16 CommentHigh; + [relative_short] astring *UsrComment; + uint16 UsrCommentHigh; + [relative_short] astring *FullName; + uint16 FullNameHigh; + rap_UserPriv Priv; + rap_AuthFlags AuthFlags; + time_t PasswordAge; + [relative_short] astring *HomeDir; + uint16 HomeDirHigh; + [relative_short] astring *Parms; + uint16 ParmsHigh; + time_t LastLogon; + time_t LastLogOff; + uint16 BadPWCount; + uint16 NumLogons; + [relative_short] astring *LogonServer; + uint16 LogonServerHigh; + uint16 CountryCode; + [relative_short] astring *WorkStations; + uint16 WorkStationsHigh; + uint32 MaxStorage; + uint16 UnitsPerWeek; + [relative_short] rap_LogonHours *LogonHours; + uint16 LogonHoursHigh; + uint16 CodePage; + } rap_NetUserInfo11; + + typedef [public,nodiscriminant] union { + [case(0)] rap_NetUserInfo0 info0; + [case(1)] rap_NetUserInfo1 info1; + [case(2)] rap_NetUserInfo2 info2; + [case(10)] rap_NetUserInfo10 info10; + [case(11)] rap_NetUserInfo11 info11; + } rap_netuser_info; + + [public] void rap_NetUserGetInfo( + [in] astring UserName, + [in] uint16 level, + [in] uint16 bufsize, + [out] rap_status status, + [out] uint16 convert, + [out] uint16 available, + [out,switch_is(level)] rap_netuser_info info + ); + + typedef struct { + [relative_short] astring *ComputerName; + uint16 ComputerNameHigh; + [relative_short] astring *UserName; + uint16 UserNameHigh; + uint16 num_conns; + uint16 num_opens; + uint16 num_users; + uint32 sess_time; + uint32 idle_time; + uint32 user_flags; + [relative_short] astring *CliTypeName; + uint16 CliTypeNameHigh; + } rap_session_info_2; + + typedef [public,nodiscriminant] union { + [case(2)] rap_session_info_2 info2; + } rap_session_info; + + /* not documented in MS-RAP */ + [public] void rap_NetSessionEnum( + [in] uint16 level, + [in] uint16 bufsize, + [out] rap_status status, + [out] uint16 convert, + [out] uint16 count, + [out] uint16 available, + [out,switch_is(level)] rap_session_info info[count] + ); + + /* not documented in MS-RAP */ + [public] void rap_NetSessionGetInfo( + [in] astring SessionName, + [in] uint16 level, + [in] uint16 bufsize, + [out] rap_status status, + [out] uint16 convert, + [out] uint16 available, + [out,switch_is(level)] rap_session_info info + ); + + /* not documented in MS-RAP */ + [public] void rap_NetUserAdd( + [in] uint16 level, + [in] uint16 bufsize, + [in] uint16 pwdlength, + [in] uint16 unknown, + [in,switch_is(level)] rap_netuser_info info, + [out] rap_status status, + [out] uint16 convert + ); + + /* not documented in MS-RAP */ + [public] void rap_NetUserDelete( + [in] astring UserName, + [out] rap_status status, + [out] uint16 convert + ); + + typedef [public] struct { + uint32 TimeSinceJan11970; + uint32 TimeSinceBoot; + uint8 Hours; + uint8 Minutes; + uint8 Seconds; + uint8 Hundreds; + uint16 TimeZone; + uint16 ClockFrequency; + uint8 Day; + uint8 Month; + uint16 Year; + uint8 Weekday; + } rap_TimeOfDayInfo; + + [public] void rap_NetRemoteTOD( + [in] uint16 bufsize, + [out] rap_status status, + [out] uint16 convert, + [out] rap_TimeOfDayInfo tod + ); + + /* Parameter description strings for RAP calls */ + /* Names are defined name for RAP call with _REQ */ + /* appended to end. */ + + const string RAP_WFileEnum2_REQ = "zzWrLehb8g8"; + const string RAP_WFileGetInfo2_REQ = "DWrLh"; + const string RAP_WFileClose2_REQ = "D"; + + const string RAP_NetGroupEnum_REQ = "WrLeh"; + const string RAP_NetGroupAdd_REQ = "WsT"; + const string RAP_NetGroupDel_REQ = "z"; + const string RAP_NetGroupAddUser_REQ = "zz"; + const string RAP_NetGroupDelUser_REQ = "zz"; + const string RAP_NetGroupGetUsers_REQ = "zWrLeh"; + const string RAP_NetGroupSetUsers_REQ = "zWsTW"; + + const string RAP_NetUserAdd2_REQ = "WsTWW"; + const string RAP_NetUserEnum_REQ = "WrLeh"; + const string RAP_NetUserEnum2_REQ = "WrLDieh"; + const string RAP_NetUserGetGroups_REQ = "zWrLeh"; + const string RAP_NetUserSetGroups_REQ = "zWsTW"; + const string RAP_NetUserPasswordSet_REQ = "zb16b16w"; + const string RAP_NetUserPasswordSet2_REQ = "zb16b16WW"; + const string RAP_SAMOEMChgPasswordUser2_REQ = "B516B16"; + const string RAP_NetUserValidate2_REQ = "Wb62WWrLhWW"; + + const string RAP_NetServerEnum2_REQ = "WrLehDz"; + const string RAP_WserverGetInfo_REQ = "WrLh"; + const string RAP_NetWkstatGetInfo = "WrLh"; + + const string RAP_WShareAdd_REQ = "WsT"; + const string RAP_WShareEnum_REQ = "WrLeh"; + const string RAP_WShareDel_REQ = "zW"; + const string RAP_WWkstaGetInfo_REQ = "WrLh"; + + const string RAP_NetPrintQEnum_REQ = "WrLeh"; + const string RAP_NetPrintQGetInfo_REQ = "zWrLh"; + + const string RAP_NetServerAdminCommand_REQ = "zhrLeh"; + const string RAP_NetServiceEnum_REQ = "WrLeh"; + const string RAP_NetServiceControl_REQ = "zWWrL"; + const string RAP_NetServiceInstall_REQ = "zF88sg88T"; + const string RAP_NetServiceGetInfo_REQ = "zWrLh"; + const string RAP_NetSessionEnum_REQ = "WrLeh"; + const string RAP_NetSessionGetInfo_REQ = "zWrLh"; + const string RAP_NetSessionDel_REQ = "zW"; + + const string RAP_NetConnectionEnum_REQ = "zWrLeh"; + + const string RAP_NetWkstaUserLogoff_REQ = "zzWb38WrLh"; + + /* Description strings for returned data in RAP calls */ + /* I use all caps here in part to avoid accidental */ + /* name collisions */ + + const string RAP_FILE_INFO_L2 = "D"; + const string RAP_FILE_INFO_L3 = "DWWzz"; + const string RAP_GROUP_INFO_L0 = "B21"; + const string RAP_GROUP_INFO_L1 = "B21Bz"; + const string RAP_GROUP_USERS_INFO_0 = "B21"; + const string RAP_GROUP_USERS_INFO_1 = "B21BN"; + + const string RAP_USER_INFO_L0 = "B21"; + const string RAP_USER_INFO_L1 = "B21BB16DWzzWz"; + + const string RAP_SERVER_INFO_L0 = "B16"; + const string RAP_SERVER_INFO_L1 = "B16BBDz"; + const string RAP_SERVER_INFO_L2 = "B16BBDzDDDWWzWWWWWWWB21BzWWWWWWWWWWWWWWWWWWWWWWz"; + const string RAP_SERVER_INFO_L3 = "B16BBDzDDDWWzWWWWWWWB21BzWWWWWWWWWWWWWWWWWWWWWWzDWz"; + const string RAP_SERVICE_INFO_L0 = "B16"; + const string RAP_SERVICE_INFO_L2 = "B16WDWB64"; + const string RAP_SHARE_INFO_L0 = "B13"; + const string RAP_SHARE_INFO_L1 = "B13BWz"; + const string RAP_SHARE_INFO_L2 = "B13BWzWWWzB9B"; + + const string RAP_PRINTQ_INFO_L2 = "B13BWWWzzzzzWN"; + const string RAP_SMB_PRINT_JOB_L1 = "WB21BB16B10zWWzDDz"; + + const string RAP_SESSION_INFO_L2 = "zzWWWDDDz"; + const string RAP_CONNECTION_INFO_L1 = "WWWWDzz"; + + const string RAP_USER_LOGOFF_INFO_L1 = "WDW"; + + const string RAP_WKSTA_INFO_L1 = "WDzzzzBBDWDWWWWWWWWWWWWWWWWWWWzzWzzW"; + const string RAP_WKSTA_INFO_L10 = "zzzBBzz"; +}; diff --git a/librpc/idl/remact.idl b/librpc/idl/remact.idl new file mode 100644 index 0000000..77134e7 --- /dev/null +++ b/librpc/idl/remact.idl @@ -0,0 +1,46 @@ +/** + DCOM interfaces + http://www.grimes.demon.co.uk/DCOM/DCOMSpec.htm + */ + +import "misc.idl", "orpc.idl"; + +[ + uuid("4d9f4ab8-7d1c-11cf-861e-0020af6e7c57"), + pointer_default(unique), + endpoint("ncalrpc:", "ncacn_ip_tcp:[135]", "ncacn_np:[\\pipe\\epmapper]") +] +interface IRemoteActivation +{ + typedef [v1_enum] enum { + RPC_C_IMP_LEVEL_DEFAULT = 0, + RPC_C_IMP_LEVEL_ANONYMOUS = 1, + RPC_C_IMP_LEVEL_IDENTIFY = 2, + RPC_C_IMP_LEVEL_IMPERSONATE = 3, + RPC_C_IMP_LEVEL_DELEGATE = 4 + } imp_levels; + + const uint32 MODE_GET_CLASS_OBJECT = 0xffffffff; + + WERROR RemoteActivation ( + [in] ORPCTHIS this_object, + [out,ref] ORPCTHAT *that, + [in] GUID Clsid, + [in] [unique,string,charset(UTF16)] uint16 *pwszObjectName, + [in] [unique] MInterfacePointer *pObjectStorage, + [in] imp_levels ClientImpLevel, + [in] uint32 Mode, + [in,range(1,32768)] uint32 Interfaces, + [in,unique,size_is(Interfaces)] GUID *pIIDs, + [in] uint16 num_protseqs, + [in, size_is(num_protseqs)] uint16 protseq[*], + [out,ref] hyper *pOxid, + [out,ref] DUALSTRINGARRAY **pdsaOxidBindings, + [out,ref] GUID *ipidRemUnknown, + [out,ref] uint32 *AuthnHint, + [out,ref] COMVERSION *ServerVersion, + [out,ref] HRESULT *hr, + [out,size_is(Interfaces)] MInterfacePointer **ifaces, + [out,size_is(Interfaces)] HRESULT results[] + ); +} diff --git a/librpc/idl/rot.idl b/librpc/idl/rot.idl new file mode 100644 index 0000000..7239111 --- /dev/null +++ b/librpc/idl/rot.idl @@ -0,0 +1,44 @@ +import "orpc.idl"; + +[ + uuid("b9e79e60-3d52-11ce-aaa1-00006901293f"), + version(0.2), + pointer_default(unique), + endpoint("ncacn_np:[\\pipe\\epmapper]", "ncacn_ip_tcp:[135]", + "ncalrpc:[EPMAPPER]") +] interface rot +{ + WERROR rot_add ( + [in] uint32 flags, + [in] MInterfacePointer *unk, + [in] MInterfacePointer *moniker, + [out] uint32 *rotid + ); + + WERROR rot_remove ( + [in] uint32 rotid + ); + + WERROR rot_is_listed ( + [in] MInterfacePointer *moniker + ); + + WERROR rot_get_interface_pointer ( + [in] MInterfacePointer *moniker, + [out] MInterfacePointer *ip + ); + + WERROR rot_set_modification_time ( + [in] uint32 rotid, + [in] NTTIME *t + ); + + WERROR rot_get_modification_time ( + [in] MInterfacePointer *moniker, + [out] NTTIME *t + ); + + WERROR rot_enum ( + [out] MInterfacePointer *EnumMoniker + ); +} diff --git a/librpc/idl/samr.idl b/librpc/idl/samr.idl new file mode 100644 index 0000000..5da0fd7 --- /dev/null +++ b/librpc/idl/samr.idl @@ -0,0 +1,1665 @@ +#include "idl_types.h" + +/* + samr interface definition +*/ +import "misc.idl", "lsa.idl", "security.idl"; + +/* + Thanks to Todd Sabin for some information from his samr.idl in acltools +*/ + +[ uuid("12345778-1234-abcd-ef00-0123456789ac"), + version(1.0), + endpoint("ncacn_np:[\\pipe\\samr]","ncacn_ip_tcp:", "ncalrpc:"), + pointer_default(unique) +] interface samr +{ + typedef bitmap security_secinfo security_secinfo; + typedef bitmap security_GroupAttrs security_GroupAttrs; + + /* account control (acct_flags) bits */ + typedef [public,bitmap32bit] bitmap { + ACB_DISABLED = 0x00000001, /* 1 = User account disabled */ + ACB_HOMDIRREQ = 0x00000002, /* 1 = Home directory required */ + ACB_PWNOTREQ = 0x00000004, /* 1 = User password not required */ + ACB_TEMPDUP = 0x00000008, /* 1 = Temporary duplicate account */ + ACB_NORMAL = 0x00000010, /* 1 = Normal user account */ + ACB_MNS = 0x00000020, /* 1 = MNS logon user account */ + ACB_DOMTRUST = 0x00000040, /* 1 = Interdomain trust account */ + ACB_WSTRUST = 0x00000080, /* 1 = Workstation trust account */ + ACB_SVRTRUST = 0x00000100, /* 1 = Server trust account */ + ACB_PWNOEXP = 0x00000200, /* 1 = User password does not expire */ + ACB_AUTOLOCK = 0x00000400, /* 1 = Account auto locked */ + ACB_ENC_TXT_PWD_ALLOWED = 0x00000800, /* 1 = Encrypted text password is allowed */ + ACB_SMARTCARD_REQUIRED = 0x00001000, /* 1 = Smart Card required */ + ACB_TRUSTED_FOR_DELEGATION = 0x00002000, /* 1 = Trusted for Delegation */ + ACB_NOT_DELEGATED = 0x00004000, /* 1 = Not delegated */ + ACB_USE_DES_KEY_ONLY = 0x00008000, /* 1 = Use DES key only */ + ACB_DONT_REQUIRE_PREAUTH = 0x00010000, /* 1 = Preauth not required */ + ACB_PW_EXPIRED = 0x00020000, /* 1 = Password Expired */ + ACB_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION = 0x00040000, + ACB_NO_AUTH_DATA_REQD = 0x00080000, /* 1 = No authorization data required */ + ACB_PARTIAL_SECRETS_ACCOUNT = 0x00100000, + ACB_USE_AES_KEYS = 0x00200000 + } samr_AcctFlags; + + /* SAM server specific access rights */ + + typedef [bitmap32bit] bitmap { + SAMR_ACCESS_CONNECT_TO_SERVER = 0x00000001, + SAMR_ACCESS_SHUTDOWN_SERVER = 0x00000002, + SAMR_ACCESS_INITIALIZE_SERVER = 0x00000004, + SAMR_ACCESS_CREATE_DOMAIN = 0x00000008, + SAMR_ACCESS_ENUM_DOMAINS = 0x00000010, + SAMR_ACCESS_LOOKUP_DOMAIN = 0x00000020 + } samr_ConnectAccessMask; + + const int SAMR_ACCESS_ALL_ACCESS = 0x0000003F; + + const int GENERIC_RIGHTS_SAM_ALL_ACCESS = + (STANDARD_RIGHTS_REQUIRED_ACCESS | + SAMR_ACCESS_ALL_ACCESS); + + const int GENERIC_RIGHTS_SAM_READ = + (STANDARD_RIGHTS_READ_ACCESS | + SAMR_ACCESS_ENUM_DOMAINS); + + const int GENERIC_RIGHTS_SAM_WRITE = + (STANDARD_RIGHTS_WRITE_ACCESS | + SAMR_ACCESS_CREATE_DOMAIN | + SAMR_ACCESS_INITIALIZE_SERVER | + SAMR_ACCESS_SHUTDOWN_SERVER); + + const int GENERIC_RIGHTS_SAM_EXECUTE = + (STANDARD_RIGHTS_EXECUTE_ACCESS | + SAMR_ACCESS_LOOKUP_DOMAIN | + SAMR_ACCESS_CONNECT_TO_SERVER); + + /* User Object specific access rights */ + + typedef [bitmap32bit] bitmap { + SAMR_USER_ACCESS_GET_NAME_ETC = 0x00000001, + SAMR_USER_ACCESS_GET_LOCALE = 0x00000002, + SAMR_USER_ACCESS_SET_LOC_COM = 0x00000004, + SAMR_USER_ACCESS_GET_LOGONINFO = 0x00000008, + SAMR_USER_ACCESS_GET_ATTRIBUTES = 0x00000010, + SAMR_USER_ACCESS_SET_ATTRIBUTES = 0x00000020, + SAMR_USER_ACCESS_CHANGE_PASSWORD = 0x00000040, + SAMR_USER_ACCESS_SET_PASSWORD = 0x00000080, + SAMR_USER_ACCESS_GET_GROUPS = 0x00000100, + SAMR_USER_ACCESS_GET_GROUP_MEMBERSHIP = 0x00000200, + SAMR_USER_ACCESS_CHANGE_GROUP_MEMBERSHIP = 0x00000400 + } samr_UserAccessMask; + + const int SAMR_USER_ACCESS_ALL_ACCESS = 0x000007FF; + + const int GENERIC_RIGHTS_USER_ALL_ACCESS = + (STANDARD_RIGHTS_REQUIRED_ACCESS | + SAMR_USER_ACCESS_ALL_ACCESS); /* 0x000f07ff */ + + const int GENERIC_RIGHTS_USER_READ = + (STANDARD_RIGHTS_READ_ACCESS | + SAMR_USER_ACCESS_GET_GROUP_MEMBERSHIP | + SAMR_USER_ACCESS_GET_GROUPS | + SAMR_USER_ACCESS_GET_ATTRIBUTES | + SAMR_USER_ACCESS_GET_LOGONINFO | + SAMR_USER_ACCESS_GET_LOCALE); /* 0x0002031a */ + + const int GENERIC_RIGHTS_USER_WRITE = + (STANDARD_RIGHTS_WRITE_ACCESS | + SAMR_USER_ACCESS_CHANGE_PASSWORD | + SAMR_USER_ACCESS_SET_LOC_COM | + SAMR_USER_ACCESS_SET_ATTRIBUTES | + SAMR_USER_ACCESS_SET_PASSWORD | + SAMR_USER_ACCESS_CHANGE_GROUP_MEMBERSHIP); /* 0x000204e4 */ + + const int GENERIC_RIGHTS_USER_EXECUTE = + (STANDARD_RIGHTS_EXECUTE_ACCESS | + SAMR_USER_ACCESS_CHANGE_PASSWORD | + SAMR_USER_ACCESS_GET_NAME_ETC); /* 0x00020041 */ + + /* Domain Object specific access rights */ + + typedef [bitmap32bit] bitmap { + SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1 = 0x00000001, + SAMR_DOMAIN_ACCESS_SET_INFO_1 = 0x00000002, + SAMR_DOMAIN_ACCESS_LOOKUP_INFO_2 = 0x00000004, + SAMR_DOMAIN_ACCESS_SET_INFO_2 = 0x00000008, + SAMR_DOMAIN_ACCESS_CREATE_USER = 0x00000010, + SAMR_DOMAIN_ACCESS_CREATE_GROUP = 0x00000020, + SAMR_DOMAIN_ACCESS_CREATE_ALIAS = 0x00000040, + SAMR_DOMAIN_ACCESS_LOOKUP_ALIAS = 0x00000080, + SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS = 0x00000100, + SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT = 0x00000200, + SAMR_DOMAIN_ACCESS_SET_INFO_3 = 0x00000400 + } samr_DomainAccessMask; + + const int SAMR_DOMAIN_ACCESS_ALL_ACCESS = 0x000007FF; + + const int GENERIC_RIGHTS_DOMAIN_ALL_ACCESS = + (STANDARD_RIGHTS_REQUIRED_ACCESS | + SAMR_DOMAIN_ACCESS_ALL_ACCESS); + + const int GENERIC_RIGHTS_DOMAIN_READ = + (STANDARD_RIGHTS_READ_ACCESS | + SAMR_DOMAIN_ACCESS_LOOKUP_ALIAS | + SAMR_DOMAIN_ACCESS_LOOKUP_INFO_2); + + const int GENERIC_RIGHTS_DOMAIN_WRITE = + (STANDARD_RIGHTS_WRITE_ACCESS | + SAMR_DOMAIN_ACCESS_SET_INFO_3 | + SAMR_DOMAIN_ACCESS_CREATE_ALIAS | + SAMR_DOMAIN_ACCESS_CREATE_GROUP | + SAMR_DOMAIN_ACCESS_CREATE_USER | + SAMR_DOMAIN_ACCESS_SET_INFO_2 | + SAMR_DOMAIN_ACCESS_SET_INFO_1); + + const int GENERIC_RIGHTS_DOMAIN_EXECUTE = + (STANDARD_RIGHTS_EXECUTE_ACCESS | + SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT | + SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS | + SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1); + + /* Group Object specific access rights */ + + typedef [bitmap32bit] bitmap { + SAMR_GROUP_ACCESS_LOOKUP_INFO = 0x00000001, + SAMR_GROUP_ACCESS_SET_INFO = 0x00000002, + SAMR_GROUP_ACCESS_ADD_MEMBER = 0x00000004, + SAMR_GROUP_ACCESS_REMOVE_MEMBER = 0x00000008, + SAMR_GROUP_ACCESS_GET_MEMBERS = 0x00000010 + } samr_GroupAccessMask; + + const int SAMR_GROUP_ACCESS_ALL_ACCESS = 0x0000001F; + + const int GENERIC_RIGHTS_GROUP_ALL_ACCESS = + (STANDARD_RIGHTS_REQUIRED_ACCESS | + SAMR_GROUP_ACCESS_ALL_ACCESS); /* 0x000f001f */ + + const int GENERIC_RIGHTS_GROUP_READ = + (STANDARD_RIGHTS_READ_ACCESS | + SAMR_GROUP_ACCESS_GET_MEMBERS); /* 0x00020010 */ + + const int GENERIC_RIGHTS_GROUP_WRITE = + (STANDARD_RIGHTS_WRITE_ACCESS | + SAMR_GROUP_ACCESS_REMOVE_MEMBER | + SAMR_GROUP_ACCESS_ADD_MEMBER | + SAMR_GROUP_ACCESS_SET_INFO); /* 0x0002000e */ + + const int GENERIC_RIGHTS_GROUP_EXECUTE = + (STANDARD_RIGHTS_EXECUTE_ACCESS | + SAMR_GROUP_ACCESS_LOOKUP_INFO); /* 0x00020001 */ + + /* Alias Object specific access rights */ + + typedef [bitmap32bit] bitmap { + SAMR_ALIAS_ACCESS_ADD_MEMBER = 0x00000001, + SAMR_ALIAS_ACCESS_REMOVE_MEMBER = 0x00000002, + SAMR_ALIAS_ACCESS_GET_MEMBERS = 0x00000004, + SAMR_ALIAS_ACCESS_LOOKUP_INFO = 0x00000008, + SAMR_ALIAS_ACCESS_SET_INFO = 0x00000010 + } samr_AliasAccessMask; + + const int SAMR_ALIAS_ACCESS_ALL_ACCESS = 0x0000001F; + + const int GENERIC_RIGHTS_ALIAS_ALL_ACCESS = + (STANDARD_RIGHTS_REQUIRED_ACCESS | + SAMR_ALIAS_ACCESS_ALL_ACCESS); /* 0x000f001f */ + + const int GENERIC_RIGHTS_ALIAS_READ = + (STANDARD_RIGHTS_READ_ACCESS | + SAMR_ALIAS_ACCESS_GET_MEMBERS); /* 0x00020004 */ + + const int GENERIC_RIGHTS_ALIAS_WRITE = + (STANDARD_RIGHTS_WRITE_ACCESS | + SAMR_ALIAS_ACCESS_REMOVE_MEMBER | + SAMR_ALIAS_ACCESS_ADD_MEMBER | + SAMR_ALIAS_ACCESS_SET_INFO); /* 0x00020013 */ + + const int GENERIC_RIGHTS_ALIAS_EXECUTE = + (STANDARD_RIGHTS_EXECUTE_ACCESS | + SAMR_ALIAS_ACCESS_LOOKUP_INFO); /* 0x00020008 */ + + /******************/ + /* Function: 0x00 */ + NTSTATUS samr_Connect ( + /* notice the lack of [string] */ + [in,unique] uint16 *system_name, + [in] samr_ConnectAccessMask access_mask, + [out,ref] policy_handle *connect_handle + ); + + + /******************/ + /* Function: 0x01 */ + [public] NTSTATUS samr_Close ( + [in,out,ref] policy_handle *handle + ); + + /******************/ + /* Function: 0x02 */ + + NTSTATUS samr_SetSecurity ( + [in,ref] policy_handle *handle, + [in] security_secinfo sec_info, + [in,ref] sec_desc_buf *sdbuf + ); + + /******************/ + /* Function: 0x03 */ + + NTSTATUS samr_QuerySecurity ( + [in,ref] policy_handle *handle, + [in] security_secinfo sec_info, + [out,ref] sec_desc_buf **sdbuf + ); + + /******************/ + /* Function: 0x04 */ + + /* + shutdown the SAM - once you call this the SAM will be dead + */ + NTSTATUS samr_Shutdown ( + [in,ref] policy_handle *connect_handle + ); + + /******************/ + /* Function: 0x05 */ + NTSTATUS samr_LookupDomain ( + [in,ref] policy_handle *connect_handle, + [in,ref] lsa_String *domain_name, + [out,ref] dom_sid2 **sid + ); + + + /******************/ + /* Function: 0x06 */ + + typedef struct { + uint32 idx; + lsa_String name; + } samr_SamEntry; + + typedef struct { + uint32 count; + [size_is(count)] samr_SamEntry *entries; + } samr_SamArray; + + NTSTATUS samr_EnumDomains ( + [in,ref] policy_handle *connect_handle, + [in,out,ref] uint32 *resume_handle, + [out,ref] samr_SamArray **sam, + [in] uint32 buf_size, + [out,ref] uint32 *num_entries + ); + + + /************************/ + /* Function 0x07 */ + [public] NTSTATUS samr_OpenDomain( + [in,ref] policy_handle *connect_handle, + [in] samr_DomainAccessMask access_mask, + [in,ref] dom_sid2 *sid, + [out,ref] policy_handle *domain_handle + ); + + /************************/ + /* Function 0x08 */ + + typedef enum { + DomainPasswordInformation = 1, + DomainGeneralInformation = 2, + DomainLogoffInformation = 3, + DomainOemInformation = 4, + DomainNameInformation = 5, + DomainReplicationInformation = 6, + DomainServerRoleInformation = 7, + DomainModifiedInformation = 8, + DomainStateInformation = 9, + DomainUasInformation = 10, + DomainGeneralInformation2 = 11, + DomainLockoutInformation = 12, + DomainModifiedInformation2 = 13 + } samr_DomainInfoClass; + + /* server roles */ + typedef [v1_enum] enum { + SAMR_ROLE_STANDALONE = 0, + SAMR_ROLE_DOMAIN_MEMBER = 1, + SAMR_ROLE_DOMAIN_BDC = 2, + SAMR_ROLE_DOMAIN_PDC = 3 + } samr_Role; + + /* password properties flags */ + typedef [public,bitmap32bit] bitmap { + DOMAIN_PASSWORD_COMPLEX = 0x00000001, + DOMAIN_PASSWORD_NO_ANON_CHANGE = 0x00000002, + DOMAIN_PASSWORD_NO_CLEAR_CHANGE = 0x00000004, + DOMAIN_PASSWORD_LOCKOUT_ADMINS = 0x00000008, + DOMAIN_PASSWORD_STORE_CLEARTEXT = 0x00000010, + DOMAIN_REFUSE_PASSWORD_CHANGE = 0x00000020 + } samr_PasswordProperties; + + typedef [v1_enum] enum { + DOMAIN_SERVER_ENABLED = 1, + DOMAIN_SERVER_DISABLED = 2 + } samr_DomainServerState; + + typedef [public] struct { + uint16 min_password_length; + uint16 password_history_length; + samr_PasswordProperties password_properties; + /* yes, these are signed. They are in negative 100ns */ + dlong max_password_age; + dlong min_password_age; + } samr_DomInfo1; + + typedef struct { + NTTIME force_logoff_time; + lsa_String oem_information; /* comment */ + lsa_String domain_name; + lsa_String primary; /* PDC name if this is a BDC */ + udlong sequence_num; + samr_DomainServerState domain_server_state; + samr_Role role; + uint32 unknown3; + uint32 num_users; + uint32 num_groups; + uint32 num_aliases; + } samr_DomGeneralInformation; + + typedef struct { + NTTIME force_logoff_time; + } samr_DomInfo3; + + typedef struct { + lsa_String oem_information; /* comment */ + } samr_DomOEMInformation; + + typedef struct { + lsa_String domain_name; + } samr_DomInfo5; + + typedef struct { + lsa_String primary; + } samr_DomInfo6; + + typedef struct { + samr_Role role; + } samr_DomInfo7; + + typedef struct { + hyper sequence_num; + NTTIME domain_create_time; + } samr_DomInfo8; + + typedef struct { + samr_DomainServerState domain_server_state; + } samr_DomInfo9; + + typedef struct { + samr_DomGeneralInformation general; + hyper lockout_duration; + hyper lockout_window; + uint16 lockout_threshold; + } samr_DomGeneralInformation2; + + typedef struct { + hyper lockout_duration; + hyper lockout_window; + uint16 lockout_threshold; + } samr_DomInfo12; + + typedef struct { + hyper sequence_num; + NTTIME domain_create_time; + hyper modified_count_at_last_promotion; + } samr_DomInfo13; + + typedef [switch_type(uint16)] union { + [case(1)] samr_DomInfo1 info1; + [case(2)] samr_DomGeneralInformation general; + [case(3)] samr_DomInfo3 info3; + [case(4)] samr_DomOEMInformation oem; + [case(5)] samr_DomInfo5 info5; + [case(6)] samr_DomInfo6 info6; + [case(7)] samr_DomInfo7 info7; + [case(8)] samr_DomInfo8 info8; + [case(9)] samr_DomInfo9 info9; + [case(11)] samr_DomGeneralInformation2 general2; + [case(12)] samr_DomInfo12 info12; + [case(13)] samr_DomInfo13 info13; + } samr_DomainInfo; + + NTSTATUS samr_QueryDomainInfo( + [in,ref] policy_handle *domain_handle, + [in] samr_DomainInfoClass level, + [out,ref,switch_is(level)] samr_DomainInfo **info + ); + + /************************/ + /* Function 0x09 */ + /* + only levels 1, 3, 4, 6, 7, 9, 12 are valid for this + call in w2k3 + */ + NTSTATUS samr_SetDomainInfo( + [in,ref] policy_handle *domain_handle, + [in] samr_DomainInfoClass level, + [in,switch_is(level),ref] samr_DomainInfo *info + ); + + + /************************/ + /* Function 0x0a */ + NTSTATUS samr_CreateDomainGroup( + [in,ref] policy_handle *domain_handle, + [in,ref] lsa_String *name, + [in] samr_GroupAccessMask access_mask, + [out,ref] policy_handle *group_handle, + [out,ref] uint32 *rid + ); + + + /************************/ + /* Function 0x0b */ + NTSTATUS samr_EnumDomainGroups( + [in] policy_handle *domain_handle, + [in,out,ref] uint32 *resume_handle, + [out,ref] samr_SamArray **sam, + [in] uint32 max_size, + [out,ref] uint32 *num_entries + ); + + /************************/ + /* Function 0x0c */ + NTSTATUS samr_CreateUser( + [in,ref] policy_handle *domain_handle, + [in,ref] lsa_String *account_name, + [in] samr_UserAccessMask access_mask, + [out,ref] policy_handle *user_handle, + [out,ref] uint32 *rid + ); + + /************************/ + /* Function 0x0d */ + + + /* w2k3 treats max_size as max_users*54 and sets the + resume_handle as the rid of the last user sent + */ + const int SAMR_ENUM_USERS_MULTIPLIER = 54; + + NTSTATUS samr_EnumDomainUsers( + [in] policy_handle *domain_handle, + [in,out,ref] uint32 *resume_handle, + [in] samr_AcctFlags acct_flags, + [out,ref] samr_SamArray **sam, + [in] uint32 max_size, + [out,ref] uint32 *num_entries + ); + + /************************/ + /* Function 0x0e */ + NTSTATUS samr_CreateDomAlias( + [in,ref] policy_handle *domain_handle, + [in,ref] lsa_String *alias_name, + [in] samr_AliasAccessMask access_mask, + [out,ref] policy_handle *alias_handle, + [out,ref] uint32 *rid + ); + + /************************/ + /* Function 0x0f */ + NTSTATUS samr_EnumDomainAliases( + [in] policy_handle *domain_handle, + [in,out,ref] uint32 *resume_handle, + [out,ref] samr_SamArray **sam, + [in] uint32 max_size, + [out,ref] uint32 *num_entries + ); + + /************************/ + /* Function 0x10 */ + + typedef struct { + [range(0,1024)] uint32 count; + [size_is(count)] uint32 *ids; + } samr_Ids; + + NTSTATUS samr_GetAliasMembership( + [in,ref] policy_handle *domain_handle, + [in,ref] lsa_SidArray *sids, + [out,ref] samr_Ids *rids + ); + + /************************/ + /* Function 0x11 */ + + [public] NTSTATUS samr_LookupNames( + [in,ref] policy_handle *domain_handle, + [in,range(0,1000)] uint32 num_names, + [in,size_is(1000),length_is(num_names)] lsa_String names[], + [out,ref] samr_Ids *rids, + [out,ref] samr_Ids *types + ); + + + /************************/ + /* Function 0x12 */ + NTSTATUS samr_LookupRids( + [in,ref] policy_handle *domain_handle, + [in,range(0,1000)] uint32 num_rids, + [in,size_is(1000),length_is(num_rids)] uint32 rids[], + [out,ref] lsa_Strings *names, + [out,ref] samr_Ids *types + ); + + /************************/ + /* Function 0x13 */ + NTSTATUS samr_OpenGroup( + [in,ref] policy_handle *domain_handle, + [in] samr_GroupAccessMask access_mask, + [in] uint32 rid, + [out,ref] policy_handle *group_handle + ); + + /************************/ + /* Function 0x14 */ + + typedef struct { + lsa_String name; + security_GroupAttrs attributes; + uint32 num_members; + lsa_String description; + } samr_GroupInfoAll; + + typedef struct { + security_GroupAttrs attributes; + } samr_GroupInfoAttributes; + + typedef struct { + lsa_String description; + } samr_GroupInfoDescription; + + typedef enum { + GROUPINFOALL = 1, + GROUPINFONAME = 2, + GROUPINFOATTRIBUTES = 3, + GROUPINFODESCRIPTION = 4, + GROUPINFOALL2 = 5 + } samr_GroupInfoEnum; + + typedef [switch_type(samr_GroupInfoEnum)] union { + [case(GROUPINFOALL)] samr_GroupInfoAll all; + [case(GROUPINFONAME)] lsa_String name; + [case(GROUPINFOATTRIBUTES)] samr_GroupInfoAttributes attributes; + [case(GROUPINFODESCRIPTION)] lsa_String description; + [case(GROUPINFOALL2)] samr_GroupInfoAll all2; + } samr_GroupInfo; + + NTSTATUS samr_QueryGroupInfo( + [in,ref] policy_handle *group_handle, + [in] samr_GroupInfoEnum level, + [out,ref,switch_is(level)] samr_GroupInfo **info + ); + + /************************/ + /* Function 0x15 */ + NTSTATUS samr_SetGroupInfo( + [in,ref] policy_handle *group_handle, + [in] samr_GroupInfoEnum level, + [in,switch_is(level),ref] samr_GroupInfo *info + ); + + /************************/ + /* Function 0x16 */ + NTSTATUS samr_AddGroupMember( + [in,ref] policy_handle *group_handle, + [in] uint32 rid, + [in] uint32 flags + ); + + /************************/ + /* Function 0x17 */ + NTSTATUS samr_DeleteDomainGroup( + [in,out,ref] policy_handle *group_handle + ); + + /************************/ + /* Function 0x18 */ + NTSTATUS samr_DeleteGroupMember( + [in,ref] policy_handle *group_handle, + [in] uint32 rid + ); + + + /************************/ + /* Function 0x19 */ + typedef struct { + uint32 count; + [size_is(count)] uint32 *rids; + [size_is(count)] security_GroupAttrs *attributes; + } samr_RidAttrArray; + + NTSTATUS samr_QueryGroupMember( + [in,ref] policy_handle *group_handle, + [out,ref] samr_RidAttrArray **rids + ); + + + /************************/ + /* Function 0x1a */ + + /* + win2003 seems to accept any data at all for the two integers + below, and doesn't seem to do anything with them that I can + see. Weird. I really expected the first integer to be a rid + and the second to be the attributes for that rid member. + */ + NTSTATUS samr_SetMemberAttributesOfGroup( + [in,ref] policy_handle *group_handle, + [in] uint32 unknown1, + [in] uint32 unknown2 + ); + + + /************************/ + /* Function 0x1b */ + NTSTATUS samr_OpenAlias ( + [in,ref] policy_handle *domain_handle, + [in] samr_AliasAccessMask access_mask, + [in] uint32 rid, + [out,ref] policy_handle *alias_handle + ); + + + /************************/ + /* Function 0x1c */ + + typedef struct { + lsa_String name; + uint32 num_members; + lsa_String description; + } samr_AliasInfoAll; + + typedef enum { + ALIASINFOALL = 1, + ALIASINFONAME = 2, + ALIASINFODESCRIPTION = 3 + } samr_AliasInfoEnum; + + typedef [switch_type(samr_AliasInfoEnum)] union { + [case(ALIASINFOALL)] samr_AliasInfoAll all; + [case(ALIASINFONAME)] lsa_String name; + [case(ALIASINFODESCRIPTION)] lsa_String description; + } samr_AliasInfo; + + NTSTATUS samr_QueryAliasInfo( + [in,ref] policy_handle *alias_handle, + [in] samr_AliasInfoEnum level, + [out,ref,switch_is(level)] samr_AliasInfo **info + ); + + /************************/ + /* Function 0x1d */ + NTSTATUS samr_SetAliasInfo( + [in,ref] policy_handle *alias_handle, + [in] samr_AliasInfoEnum level, + [in,switch_is(level),ref] samr_AliasInfo *info + ); + + /************************/ + /* Function 0x1e */ + NTSTATUS samr_DeleteDomAlias( + [in,out,ref] policy_handle *alias_handle + ); + + /************************/ + /* Function 0x1f */ + NTSTATUS samr_AddAliasMember( + [in,ref] policy_handle *alias_handle, + [in,ref] dom_sid2 *sid + ); + + /************************/ + /* Function 0x20 */ + NTSTATUS samr_DeleteAliasMember( + [in,ref] policy_handle *alias_handle, + [in,ref] dom_sid2 *sid + ); + + /************************/ + /* Function 0x21 */ + NTSTATUS samr_GetMembersInAlias( + [in,ref] policy_handle *alias_handle, + [out,ref] lsa_SidArray *sids + ); + + /************************/ + /* Function 0x22 */ + [public] NTSTATUS samr_OpenUser( + [in,ref] policy_handle *domain_handle, + [in] samr_UserAccessMask access_mask, + [in] uint32 rid, + [out,ref] policy_handle *user_handle + ); + + /************************/ + /* Function 0x23 */ + NTSTATUS samr_DeleteUser( + [in,out,ref] policy_handle *user_handle + ); + + /************************/ + /* Function 0x24 */ + + typedef enum { + UserGeneralInformation = 1, + UserPreferencesInformation = 2, + UserLogonInformation = 3, + UserLogonHoursInformation = 4, + UserAccountInformation = 5, + UserNameInformation = 6, + UserAccountNameInformation = 7, + UserFullNameInformation = 8, + UserPrimaryGroupInformation = 9, + UserHomeInformation = 10, + UserScriptInformation = 11, + UserProfileInformation = 12, + UserAdminCommentInformation = 13, + UserWorkStationsInformation = 14, + UserControlInformation = 16, + UserExpiresInformation = 17, + UserInternal1Information = 18, + UserParametersInformation = 20, + UserAllInformation = 21, + UserInternal4Information = 23, + UserInternal5Information = 24, + UserInternal4InformationNew = 25, + UserInternal5InformationNew = 26, + UserInternal7InformationNew = 31, + UserInternal8InformationNew = 32 + } samr_UserInfoLevel; + + typedef struct { + lsa_String account_name; + lsa_String full_name; + uint32 primary_gid; + lsa_String description; + lsa_String comment; + } samr_UserInfo1; + + typedef struct { + lsa_String comment; + lsa_String reserved; /* settable, but doesn't stick. probably obsolete */ + uint16 country_code; + uint16 code_page; + } samr_UserInfo2; + + /* this is also used in samr and netlogon */ + typedef [public, flag(NDR_PAHEX)] struct { + uint16 units_per_week; + [size_is(1260), length_is(units_per_week/8)] uint8 *bits; + } samr_LogonHours; + + typedef struct { + lsa_String account_name; + lsa_String full_name; + uint32 rid; + uint32 primary_gid; + lsa_String home_directory; + lsa_String home_drive; + lsa_String logon_script; + lsa_String profile_path; + lsa_String workstations; + NTTIME last_logon; + NTTIME last_logoff; + NTTIME last_password_change; + NTTIME allow_password_change; + NTTIME force_password_change; + samr_LogonHours logon_hours; + uint16 bad_password_count; + uint16 logon_count; + samr_AcctFlags acct_flags; + } samr_UserInfo3; + + typedef struct { + samr_LogonHours logon_hours; + } samr_UserInfo4; + + typedef struct { + lsa_String account_name; + lsa_String full_name; + uint32 rid; + uint32 primary_gid; + lsa_String home_directory; + lsa_String home_drive; + lsa_String logon_script; + lsa_String profile_path; + lsa_String description; + lsa_String workstations; + 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_UserInfo5; + + typedef struct { + lsa_String account_name; + lsa_String full_name; + } samr_UserInfo6; + + typedef struct { + lsa_String account_name; + } samr_UserInfo7; + + typedef struct { + lsa_String full_name; + } samr_UserInfo8; + + typedef struct { + uint32 primary_gid; + } samr_UserInfo9; + + typedef struct { + lsa_String home_directory; + lsa_String home_drive; + } samr_UserInfo10; + + typedef struct { + lsa_String logon_script; + } samr_UserInfo11; + + typedef struct { + lsa_String profile_path; + } samr_UserInfo12; + + typedef struct { + lsa_String description; + } samr_UserInfo13; + + typedef struct { + lsa_String workstations; + } samr_UserInfo14; + + typedef struct { + samr_AcctFlags acct_flags; + } samr_UserInfo16; + + typedef struct { + NTTIME acct_expiry; + } samr_UserInfo17; + + typedef [public, flag(NDR_PAHEX)] struct { + uint8 hash[16]; + } samr_Password; + + typedef struct { + samr_Password nt_pwd; + samr_Password lm_pwd; + boolean8 nt_pwd_active; + boolean8 lm_pwd_active; + uint8 password_expired; + } samr_UserInfo18; + + typedef struct { + lsa_BinaryString parameters; + } samr_UserInfo20; + + /* this defines the bits used for fields_present in info21 */ + typedef [bitmap32bit] bitmap { + SAMR_FIELD_ACCOUNT_NAME = 0x00000001, + SAMR_FIELD_FULL_NAME = 0x00000002, + SAMR_FIELD_RID = 0x00000004, + SAMR_FIELD_PRIMARY_GID = 0x00000008, + SAMR_FIELD_DESCRIPTION = 0x00000010, + SAMR_FIELD_COMMENT = 0x00000020, + SAMR_FIELD_HOME_DIRECTORY = 0x00000040, + SAMR_FIELD_HOME_DRIVE = 0x00000080, + SAMR_FIELD_LOGON_SCRIPT = 0x00000100, + SAMR_FIELD_PROFILE_PATH = 0x00000200, + SAMR_FIELD_WORKSTATIONS = 0x00000400, + SAMR_FIELD_LAST_LOGON = 0x00000800, + SAMR_FIELD_LAST_LOGOFF = 0x00001000, + SAMR_FIELD_LOGON_HOURS = 0x00002000, + SAMR_FIELD_BAD_PWD_COUNT = 0x00004000, + SAMR_FIELD_NUM_LOGONS = 0x00008000, + SAMR_FIELD_ALLOW_PWD_CHANGE = 0x00010000, + SAMR_FIELD_FORCE_PWD_CHANGE = 0x00020000, + SAMR_FIELD_LAST_PWD_CHANGE = 0x00040000, + SAMR_FIELD_ACCT_EXPIRY = 0x00080000, + SAMR_FIELD_ACCT_FLAGS = 0x00100000, + SAMR_FIELD_PARAMETERS = 0x00200000, + SAMR_FIELD_COUNTRY_CODE = 0x00400000, + SAMR_FIELD_CODE_PAGE = 0x00800000, + SAMR_FIELD_NT_PASSWORD_PRESENT = 0x01000000, /* either of these */ + SAMR_FIELD_LM_PASSWORD_PRESENT = 0x02000000, /* two bits seems to work */ + SAMR_FIELD_PRIVATE_DATA = 0x04000000, + SAMR_FIELD_EXPIRED_FLAG = 0x08000000, + SAMR_FIELD_SEC_DESC = 0x10000000, + SAMR_FIELD_OWF_PWD = 0x20000000 + } samr_FieldsPresent; + + /* used for 'password_expired' in samr_UserInfo21 */ + const int PASS_MUST_CHANGE_AT_NEXT_LOGON = 0x01; + const int PASS_DONT_CHANGE_AT_NEXT_LOGON = 0x00; + + typedef struct { + NTTIME last_logon; + NTTIME last_logoff; + NTTIME last_password_change; + NTTIME acct_expiry; + NTTIME allow_password_change; + NTTIME force_password_change; + lsa_String account_name; + lsa_String full_name; + lsa_String home_directory; + lsa_String home_drive; + lsa_String logon_script; + lsa_String profile_path; + lsa_String description; + lsa_String workstations; + lsa_String comment; + lsa_BinaryString parameters; + lsa_BinaryString lm_owf_password; + lsa_BinaryString nt_owf_password; + lsa_String private_data; + uint32 buf_count; + [size_is(buf_count)] uint8 *buffer; + uint32 rid; + uint32 primary_gid; + samr_AcctFlags acct_flags; + samr_FieldsPresent fields_present; + samr_LogonHours logon_hours; + uint16 bad_password_count; + uint16 logon_count; + uint16 country_code; + uint16 code_page; + uint8 lm_password_set; + uint8 nt_password_set; + uint8 password_expired; + uint8 private_data_sensitive; + } samr_UserInfo21; + + typedef [public, flag(NDR_PAHEX)] struct { + uint8 data[516]; + } samr_CryptPassword; + + typedef struct { + samr_UserInfo21 info; + samr_CryptPassword password; + } samr_UserInfo23; + + typedef struct { + samr_CryptPassword password; + uint8 password_expired; + } samr_UserInfo24; + + typedef [flag(NDR_PAHEX)] struct { + uint8 data[532]; + } samr_CryptPasswordEx; + + typedef struct { + samr_UserInfo21 info; + samr_CryptPasswordEx password; + } samr_UserInfo25; + + typedef struct { + samr_CryptPasswordEx password; + uint8 password_expired; + } samr_UserInfo26; + + typedef struct { + uint8 auth_data[64]; + uint8 salt[16]; + uint32 cipher_len; + [size_is(cipher_len)] uint8 *cipher; + hyper PBKDF2Iterations; + } samr_EncryptedPasswordAES; + + typedef struct { + samr_EncryptedPasswordAES password; + uint8 password_expired; + } samr_UserInfo31; + + typedef struct { + samr_UserInfo21 info; + samr_EncryptedPasswordAES password; + } samr_UserInfo32; + + typedef [switch_type(uint16)] union { + [case(1)] samr_UserInfo1 info1; + [case(2)] samr_UserInfo2 info2; + [case(3)] samr_UserInfo3 info3; + [case(4)] samr_UserInfo4 info4; + [case(5)] samr_UserInfo5 info5; + [case(6)] samr_UserInfo6 info6; + [case(7)] samr_UserInfo7 info7; + [case(8)] samr_UserInfo8 info8; + [case(9)] samr_UserInfo9 info9; + [case(10)] samr_UserInfo10 info10; + [case(11)] samr_UserInfo11 info11; + [case(12)] samr_UserInfo12 info12; + [case(13)] samr_UserInfo13 info13; + [case(14)] samr_UserInfo14 info14; + [case(16)] samr_UserInfo16 info16; + [case(17)] samr_UserInfo17 info17; + [case(18)] samr_UserInfo18 info18; + [case(20)] samr_UserInfo20 info20; + [case(21)] samr_UserInfo21 info21; + [case(23)] samr_UserInfo23 info23; + [case(24)] samr_UserInfo24 info24; + [case(25)] samr_UserInfo25 info25; + [case(26)] samr_UserInfo26 info26; + [case(31)] samr_UserInfo31 info31; + [case(32)] samr_UserInfo32 info32; + } samr_UserInfo; + + [public] NTSTATUS samr_QueryUserInfo( + [in,ref] policy_handle *user_handle, + [in] samr_UserInfoLevel level, + [out,ref,switch_is(level)] samr_UserInfo **info + ); + + + /************************/ + /* Function 0x25 */ + [public] NTSTATUS samr_SetUserInfo( + [in,ref] policy_handle *user_handle, + [in] samr_UserInfoLevel level, + [in,ref,switch_is(level)] samr_UserInfo *info + ); + + /************************/ + /* Function 0x26 */ + /* + this is a password change interface that doesn't give + the server the plaintext password. Deprecated. + */ + NTSTATUS samr_ChangePasswordUser( + [in,ref] policy_handle *user_handle, + [in] boolean8 lm_present, + [in,unique] samr_Password *old_lm_crypted, + [in,unique] samr_Password *new_lm_crypted, + [in] boolean8 nt_present, + [in,unique] samr_Password *old_nt_crypted, + [in,unique] samr_Password *new_nt_crypted, + [in] boolean8 cross1_present, + [in,unique] samr_Password *nt_cross, + [in] boolean8 cross2_present, + [in,unique] samr_Password *lm_cross + ); + + /************************/ + /* Function 0x27 */ + + typedef [public] struct { + uint32 rid; + security_GroupAttrs attributes; + } samr_RidWithAttribute; + + typedef [public] struct { + uint32 count; + [size_is(count)] samr_RidWithAttribute *rids; + } samr_RidWithAttributeArray; + + NTSTATUS samr_GetGroupsForUser( + [in,ref] policy_handle *user_handle, + [out,ref] samr_RidWithAttributeArray **rids + ); + + /************************/ + /* Function 0x28 */ + + typedef struct { + uint32 idx; + uint32 rid; + samr_AcctFlags acct_flags; + lsa_String account_name; + lsa_String description; + lsa_String full_name; + } samr_DispEntryGeneral; + + typedef struct { + uint32 count; + [size_is(count)] samr_DispEntryGeneral *entries; + } samr_DispInfoGeneral; + + typedef struct { + uint32 idx; + uint32 rid; + samr_AcctFlags acct_flags; + lsa_String account_name; + lsa_String description; + } samr_DispEntryFull; + + typedef struct { + uint32 count; + [size_is(count)] samr_DispEntryFull *entries; + } samr_DispInfoFull; + + typedef struct { + uint32 idx; + uint32 rid; + security_GroupAttrs acct_flags; + lsa_String account_name; + lsa_String description; + } samr_DispEntryFullGroup; + + typedef struct { + uint32 count; + [size_is(count)] samr_DispEntryFullGroup *entries; + } samr_DispInfoFullGroups; + + typedef struct { + uint32 idx; + lsa_AsciiStringLarge account_name; + } samr_DispEntryAscii; + + typedef struct { + uint32 count; + [size_is(count)] samr_DispEntryAscii *entries; + } samr_DispInfoAscii; + + typedef [switch_type(uint16)] union { + [case(1)] samr_DispInfoGeneral info1;/* users */ + [case(2)] samr_DispInfoFull info2; /* trust accounts? */ + [case(3)] samr_DispInfoFullGroups info3; /* groups */ + [case(4)] samr_DispInfoAscii info4; /* users */ + [case(5)] samr_DispInfoAscii info5; /* groups */ + } samr_DispInfo; + + NTSTATUS samr_QueryDisplayInfo( + [in,ref] policy_handle *domain_handle, + [in] uint16 level, + [in] uint32 start_idx, + [in] uint32 max_entries, + [in] uint32 buf_size, + [out,ref] uint32 *total_size, + [out,ref] uint32 *returned_size, + [out,ref,switch_is(level)] samr_DispInfo *info + ); + + + /************************/ + /* Function 0x29 */ + + /* + this seems to be an alphabetic search function. The returned index + is the index for samr_QueryDisplayInfo needed to get names occurring + after the specified name. The supplied name does not need to exist + in the database (for example you can supply just a first letter for + searching starting at that letter) + + The level corresponds to the samr_QueryDisplayInfo level + */ + NTSTATUS samr_GetDisplayEnumerationIndex( + [in,ref] policy_handle *domain_handle, + [in] uint16 level, + [in,ref] lsa_String *name, + [out,ref] uint32 *idx + ); + + + + /************************/ + /* Function 0x2a */ + + /* + w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this + */ + NTSTATUS samr_TestPrivateFunctionsDomain( + [in,ref] policy_handle *domain_handle + ); + + + /************************/ + /* Function 0x2b */ + + /* + w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this + */ + NTSTATUS samr_TestPrivateFunctionsUser( + [in,ref] policy_handle *user_handle + ); + + + /************************/ + /* Function 0x2c */ + + typedef struct { + uint16 min_password_length; + samr_PasswordProperties password_properties; + } samr_PwInfo; + + [public] NTSTATUS samr_GetUserPwInfo( + [in,ref] policy_handle *user_handle, + [out,ref] samr_PwInfo *info + ); + + /************************/ + /* Function 0x2d */ + NTSTATUS samr_RemoveMemberFromForeignDomain( + [in,ref] policy_handle *domain_handle, + [in,ref] dom_sid2 *sid + ); + + /************************/ + /* Function 0x2e */ + + /* + how is this different from QueryDomainInfo ?? + */ + NTSTATUS samr_QueryDomainInfo2( + [in,ref] policy_handle *domain_handle, + [in] samr_DomainInfoClass level, + [out,ref,switch_is(level)] samr_DomainInfo **info + ); + + /************************/ + /* Function 0x2f */ + + /* + how is this different from QueryUserInfo ?? + */ + NTSTATUS samr_QueryUserInfo2( + [in,ref] policy_handle *user_handle, + [in] samr_UserInfoLevel level, + [out,ref,switch_is(level)] samr_UserInfo **info + ); + + /************************/ + /* Function 0x30 */ + + /* + how is this different from QueryDisplayInfo?? + */ + NTSTATUS samr_QueryDisplayInfo2( + [in,ref] policy_handle *domain_handle, + [in] uint16 level, + [in] uint32 start_idx, + [in] uint32 max_entries, + [in] uint32 buf_size, + [out,ref] uint32 *total_size, + [out,ref] uint32 *returned_size, + [out,ref,switch_is(level)] samr_DispInfo *info + ); + + /************************/ + /* Function 0x31 */ + + /* + how is this different from GetDisplayEnumerationIndex ?? + */ + NTSTATUS samr_GetDisplayEnumerationIndex2( + [in,ref] policy_handle *domain_handle, + [in] uint16 level, + [in,ref] lsa_String *name, + [out,ref] uint32 *idx + ); + + + /************************/ + /* Function 0x32 */ + NTSTATUS samr_CreateUser2( + [in,ref] policy_handle *domain_handle, + [in,ref] lsa_String *account_name, + [in] samr_AcctFlags acct_flags, + [in] samr_UserAccessMask access_mask, + [out,ref] policy_handle *user_handle, + [out,ref] uint32 *access_granted, + [out,ref] uint32 *rid + ); + + + /************************/ + /* Function 0x33 */ + + /* + another duplicate. There must be a reason .... + */ + NTSTATUS samr_QueryDisplayInfo3( + [in,ref] policy_handle *domain_handle, + [in] uint16 level, + [in] uint32 start_idx, + [in] uint32 max_entries, + [in] uint32 buf_size, + [out,ref] uint32 *total_size, + [out,ref] uint32 *returned_size, + [out,ref,switch_is(level)] samr_DispInfo *info + ); + + /************************/ + /* Function 0x34 */ + NTSTATUS samr_AddMultipleMembersToAlias( + [in,ref] policy_handle *alias_handle, + [in,ref] lsa_SidArray *sids + ); + + /************************/ + /* Function 0x35 */ + NTSTATUS samr_RemoveMultipleMembersFromAlias( + [in,ref] policy_handle *alias_handle, + [in,ref] lsa_SidArray *sids + ); + + /************************/ + /* Function 0x36 */ + + NTSTATUS samr_OemChangePasswordUser2( + [in,unique] lsa_AsciiString *server, + [in,ref] lsa_AsciiString *account, + [in,unique] samr_CryptPassword *password, + [in,unique] samr_Password *hash + ); + + /************************/ + /* Function 0x37 */ + NTSTATUS samr_ChangePasswordUser2( + [in,unique] lsa_String *server, + [in,ref] lsa_String *account, + [in,unique] samr_CryptPassword *nt_password, + [in,unique] samr_Password *nt_verifier, + [in] boolean8 lm_change, + [in,unique] samr_CryptPassword *lm_password, + [in,unique] samr_Password *lm_verifier + ); + + /************************/ + /* Function 0x38 */ + NTSTATUS samr_GetDomPwInfo( + [in,unique] lsa_String *domain_name, + [out,ref] samr_PwInfo *info + ); + + /************************/ + /* Function 0x39 */ + NTSTATUS samr_Connect2( + [in,unique,string,charset(UTF16)] uint16 *system_name, + [in] samr_ConnectAccessMask access_mask, + [out,ref] policy_handle *connect_handle + ); + + /************************/ + /* Function 0x3a */ + /* + seems to be an exact alias for samr_SetUserInfo() + */ + [public] NTSTATUS samr_SetUserInfo2( + [in,ref] policy_handle *user_handle, + [in] samr_UserInfoLevel level, + [in,ref,switch_is(level)] samr_UserInfo *info + ); + + /************************/ + /* Function 0x3b */ + /* + this one is mysterious. I have a few guesses, but nothing working yet + */ + NTSTATUS samr_SetBootKeyInformation( + [in,ref] policy_handle *connect_handle, + [in] uint32 unknown1, + [in] uint32 unknown2, + [in] uint32 unknown3 + ); + + /************************/ + /* Function 0x3c */ + NTSTATUS samr_GetBootKeyInformation( + [in,ref] policy_handle *domain_handle, + [out,ref] uint32 *unknown + ); + + /************************/ + /* Function 0x3d */ + NTSTATUS samr_Connect3( + [in,unique,string,charset(UTF16)] uint16 *system_name, + /* this unknown value seems to be completely ignored by w2k3 */ + [in] uint32 unknown, + [in] samr_ConnectAccessMask access_mask, + [out,ref] policy_handle *connect_handle + ); + + /************************/ + /* Function 0x3e */ + + typedef [v1_enum] enum { + SAMR_CONNECT_PRE_W2K = 1, + SAMR_CONNECT_W2K = 2, + SAMR_CONNECT_AFTER_W2K = 3 + } samr_ConnectVersion; + + NTSTATUS samr_Connect4( + [in,unique,string,charset(UTF16)] uint16 *system_name, + [in] samr_ConnectVersion client_version, + [in] samr_ConnectAccessMask access_mask, + [out,ref] policy_handle *connect_handle + ); + + /************************/ + /* Function 0x3f */ + + typedef [public,v1_enum] enum { + SAM_PWD_CHANGE_NO_ERROR = 0, + SAM_PWD_CHANGE_PASSWORD_TOO_SHORT = 1, + SAM_PWD_CHANGE_PWD_IN_HISTORY = 2, + SAM_PWD_CHANGE_USERNAME_IN_PASSWORD = 3, + SAM_PWD_CHANGE_FULLNAME_IN_PASSWORD = 4, + SAM_PWD_CHANGE_NOT_COMPLEX = 5, + SAM_PWD_CHANGE_MACHINE_NOT_DEFAULT = 6, + SAM_PWD_CHANGE_FAILED_BY_FILTER = 7, + SAM_PWD_CHANGE_PASSWORD_TOO_LONG = 8 + } samPwdChangeReason; + + typedef struct { + samPwdChangeReason extendedFailureReason; + lsa_String filterModuleName; + } userPwdChangeFailureInformation; + + [public] NTSTATUS samr_ChangePasswordUser3( + [in,unique] lsa_String *server, + [in,ref] lsa_String *account, + [in,unique] samr_CryptPassword *nt_password, + [in,unique] samr_Password *nt_verifier, + [in] boolean8 lm_change, + [in,unique] samr_CryptPassword *lm_password, + [in,unique] samr_Password *lm_verifier, + [in,unique] samr_CryptPassword *password3, + [out,ref] samr_DomInfo1 **dominfo, + [out,ref] userPwdChangeFailureInformation **reject + ); + + /************************/ + /* Function 0x40 */ + + typedef [v1_enum] enum { + SAMR_CONNECT_FEATURE_RID_ONLY = 0x00000001, + SAMR_CONNECT_FEATURE_RESRVED1 = 0x00000002, + SAMR_CONNECT_FEATURE_RESRVED2 = 0x00000004, + SAMR_CONNECT_FEATURE_USE_AES = 0x00000010 + } samr_SupportedFeatures; + + typedef struct { + samr_ConnectVersion client_version; /* w2k3 gives 3 */ + samr_SupportedFeatures supported_features; + } samr_ConnectInfo1; + + typedef union { + [case(1)] samr_ConnectInfo1 info1; + } samr_ConnectInfo; + + [public] NTSTATUS samr_Connect5( + [in,unique,string,charset(UTF16)] uint16 *system_name, + [in] samr_ConnectAccessMask access_mask, + [in] uint32 level_in, + [in,ref,switch_is(level_in)] samr_ConnectInfo *info_in, + [out,ref] uint32 *level_out, + [out,ref,switch_is(*level_out)] samr_ConnectInfo *info_out, + [out,ref] policy_handle *connect_handle + ); + + /************************/ + /* Function 0x41 */ + NTSTATUS samr_RidToSid( + [in,ref] policy_handle *domain_handle, + [in] uint32 rid, + [out,ref] dom_sid2 **sid + ); + + /************************/ + /* Function 0x42 */ + + /* + this should set the DSRM password for the server, which is used + when booting into Directory Services Recovery Mode on a DC. Win2003 + gives me NT_STATUS_NOT_SUPPORTED + */ + + NTSTATUS samr_SetDsrmPassword( + [in,unique] lsa_String *name, + [in] uint32 unknown, + [in,unique] samr_Password *hash + ); + + + /************************/ + /* Function 0x43 */ + /************************/ + typedef [bitmap32bit] bitmap { + SAMR_VALIDATE_FIELD_PASSWORD_LAST_SET = 0x00000001, + SAMR_VALIDATE_FIELD_BAD_PASSWORD_TIME = 0x00000002, + SAMR_VALIDATE_FIELD_LOCKOUT_TIME = 0x00000004, + SAMR_VALIDATE_FIELD_BAD_PASSWORD_COUNT = 0x00000008, + SAMR_VALIDATE_FIELD_PASSWORD_HISTORY_LENGTH = 0x00000010, + SAMR_VALIDATE_FIELD_PASSWORD_HISTORY = 0x00000020 + } samr_ValidateFieldsPresent; + + typedef enum { + NetValidateAuthentication = 1, + NetValidatePasswordChange= 2, + NetValidatePasswordReset = 3 + } samr_ValidatePasswordLevel; + + /* NetApi maps samr_ValidationStatus errors to WERRORs. Haven't + * identified the mapping of + * - NERR_PasswordFilterError + * - NERR_PasswordExpired and + * - NERR_PasswordCantChange + * yet - Guenther + */ + + typedef enum { + SAMR_VALIDATION_STATUS_SUCCESS = 0, + SAMR_VALIDATION_STATUS_PASSWORD_MUST_CHANGE = 1, + SAMR_VALIDATION_STATUS_ACCOUNT_LOCKED_OUT = 2, + SAMR_VALIDATION_STATUS_PASSWORD_EXPIRED = 3, + SAMR_VALIDATION_STATUS_BAD_PASSWORD = 4, + SAMR_VALIDATION_STATUS_PWD_HISTORY_CONFLICT = 5, + SAMR_VALIDATION_STATUS_PWD_TOO_SHORT = 6, + SAMR_VALIDATION_STATUS_PWD_TOO_LONG = 7, + SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH = 8, + SAMR_VALIDATION_STATUS_PASSWORD_TOO_RECENT = 9, + SAMR_VALIDATION_STATUS_PASSWORD_FILTER_ERROR = 10 + } samr_ValidationStatus; + + typedef struct { + uint32 length; + [size_is(length)] uint8 *data; + } samr_ValidationBlob; + + typedef struct { + samr_ValidateFieldsPresent fields_present; + NTTIME_hyper last_password_change; + NTTIME_hyper bad_password_time; + NTTIME_hyper lockout_time; + uint32 bad_pwd_count; + uint32 pwd_history_len; + [size_is(pwd_history_len)] samr_ValidationBlob *pwd_history; + } samr_ValidatePasswordInfo; + + typedef struct { + samr_ValidatePasswordInfo info; + samr_ValidationStatus status; + } samr_ValidatePasswordRepCtr; + + typedef [switch_type(uint16)] union { + [case(1)] samr_ValidatePasswordRepCtr ctr1; + [case(2)] samr_ValidatePasswordRepCtr ctr2; + [case(3)] samr_ValidatePasswordRepCtr ctr3; + } samr_ValidatePasswordRep; + + typedef struct { + samr_ValidatePasswordInfo info; + lsa_StringLarge password; + lsa_StringLarge account; + samr_ValidationBlob hash; + boolean8 pwd_must_change_at_next_logon; + boolean8 clear_lockout; + } samr_ValidatePasswordReq3; + + typedef struct { + samr_ValidatePasswordInfo info; + lsa_StringLarge password; + lsa_StringLarge account; + samr_ValidationBlob hash; + boolean8 password_matched; + } samr_ValidatePasswordReq2; + + typedef struct { + samr_ValidatePasswordInfo info; + boolean8 password_matched; + } samr_ValidatePasswordReq1; + + typedef [switch_type(uint16)] union { + [case(1)] samr_ValidatePasswordReq1 req1; + [case(2)] samr_ValidatePasswordReq2 req2; + [case(3)] samr_ValidatePasswordReq3 req3; + } samr_ValidatePasswordReq; + + NTSTATUS samr_ValidatePassword( + [in] samr_ValidatePasswordLevel level, + [in,switch_is(level)] samr_ValidatePasswordReq *req, + [out,ref,switch_is(level)] samr_ValidatePasswordRep **rep + ); + + /************************/ + /* Function 0x44 */ + /************************/ + [todo] void samr_Opnum68NotUsedOnWire(void); + + /************************/ + /* Function 0x45 */ + /************************/ + [todo] void samr_Opnum69NotUsedOnWire(void); + + /************************/ + /* Function 0x46 */ + /************************/ + [todo] void samr_Opnum70NotUsedOnWire(void); + + /************************/ + /* Function 0x47 */ + /************************/ + [todo] void samr_Opnum71NotUsedOnWire(void); + + /************************/ + /* Function 0x48 */ + /************************/ + [todo] void samr_Opnum72NotUsedOnWire(void); + + /************************/ + /* Function 0x49 */ + /************************/ + [public] NTSTATUS samr_ChangePasswordUser4( + [in,unique] lsa_String *server, + [in,ref] lsa_String *account, + [in,ref] samr_EncryptedPasswordAES *password + ); +} diff --git a/librpc/idl/scerpc.idl b/librpc/idl/scerpc.idl new file mode 100644 index 0000000..2c3c4f8 --- /dev/null +++ b/librpc/idl/scerpc.idl @@ -0,0 +1,18 @@ +/* + security configuration editor interface definitions +*/ + +[ + uuid("93149ca2-973b-11d1-8c39-00c04fb984f9"), + version(0.0), + pointer_default(unique), + helpstring("Security Configuration Editor") +] +interface scerpc +{ + + /*****************/ + /* Function 0x00 */ + WERROR scerpc_Unknown0(); +} + diff --git a/librpc/idl/schannel.idl b/librpc/idl/schannel.idl new file mode 100644 index 0000000..3bc8a92 --- /dev/null +++ b/librpc/idl/schannel.idl @@ -0,0 +1,113 @@ +#include "idl_types.h" + +/* + schannel structures +*/ + +import "netlogon.idl", "nbt.idl", "misc.idl", "security.idl"; + +[ + pointer_default(unique), + helper("../librpc/ndr/ndr_schannel.h", "../librpc/ndr/ndr_nbt.h") +] +interface schannel +{ + /* this structure is used internally in the NETLOGON server */ + + typedef [public,flag(NDR_PAHEX)] struct { + netr_NegotiateFlags negotiate_flags; + uint8 session_key[16]; + uint32 sequence; + netr_Credential seed; + netr_Credential client; + netr_Credential server; + netr_SchannelType secure_channel_type; + [string,charset(UTF8)] uint8 computer_name[]; + [string,charset(UTF8)] uint8 account_name[]; + dom_sid *sid; + } netlogon_creds_CredentialState; + + /* This is used in the schannel_store.tdb */ + typedef [public] struct { + [string,charset(UTF16)] uint16 *computer_name; + netr_Credential server_challenge; + netr_Credential client_challenge; + } netlogon_cache_entry; + + /* MS-NRPC 2.2.1.3.1 NL_AUTH_MESSAGE */ + + typedef [v1_enum] enum { + NL_NEGOTIATE_REQUEST = 0x00000000, + NL_NEGOTIATE_RESPONSE = 0x00000001 + } NL_AUTH_MESSAGE_TYPE; + + typedef [bitmap32bit] bitmap { + NL_FLAG_OEM_NETBIOS_DOMAIN_NAME = 0x00000001, + NL_FLAG_OEM_NETBIOS_COMPUTER_NAME = 0x00000002, + NL_FLAG_UTF8_DNS_DOMAIN_NAME = 0x00000004, + NL_FLAG_UTF8_DNS_HOST_NAME = 0x00000008, + NL_FLAG_UTF8_NETBIOS_COMPUTER_NAME = 0x00000010 + } NL_AUTH_MESSAGE_FLAGS; + + typedef [public,nodiscriminant,noprint] union { + [case (NL_FLAG_OEM_NETBIOS_DOMAIN_NAME)] astring a; + [case (NL_FLAG_OEM_NETBIOS_COMPUTER_NAME)] astring a; + [case (NL_FLAG_UTF8_DNS_DOMAIN_NAME)] nbt_string u; + [case (NL_FLAG_UTF8_DNS_HOST_NAME)] nbt_string u; + [case (NL_FLAG_UTF8_NETBIOS_COMPUTER_NAME)] nbt_string u; + [default] ; + } NL_AUTH_MESSAGE_BUFFER; + + typedef [public,nodiscriminant,noprint] union { + [case (NL_NEGOTIATE_RESPONSE)] uint32 dummy; + [default] ; + } NL_AUTH_MESSAGE_BUFFER_REPLY; + + typedef [public,flag(NDR_PAHEX)] struct { + NL_AUTH_MESSAGE_TYPE MessageType; + NL_AUTH_MESSAGE_FLAGS Flags; + [switch_is(Flags & NL_FLAG_OEM_NETBIOS_DOMAIN_NAME)] NL_AUTH_MESSAGE_BUFFER oem_netbios_domain; + [switch_is(Flags & NL_FLAG_OEM_NETBIOS_COMPUTER_NAME)] NL_AUTH_MESSAGE_BUFFER oem_netbios_computer; + [switch_is(Flags & NL_FLAG_UTF8_DNS_DOMAIN_NAME)] NL_AUTH_MESSAGE_BUFFER utf8_dns_domain; + [switch_is(Flags & NL_FLAG_UTF8_DNS_HOST_NAME)] NL_AUTH_MESSAGE_BUFFER utf8_dns_host; + [switch_is(Flags & NL_FLAG_UTF8_NETBIOS_COMPUTER_NAME)] NL_AUTH_MESSAGE_BUFFER utf8_netbios_computer; + [switch_is(MessageType & NL_NEGOTIATE_RESPONSE)] NL_AUTH_MESSAGE_BUFFER_REPLY Buffer; + } NL_AUTH_MESSAGE; + + /* MS-NRPC 2.2.1.3.2 NL_AUTH_SIGNATURE */ + + typedef enum { + NL_SIGN_HMAC_SHA256 = 0x0013, + NL_SIGN_HMAC_MD5 = 0x0077 + } NL_SIGNATURE_ALGORITHM; + + typedef enum { + NL_SEAL_AES128 = 0x001A, + NL_SEAL_RC4 = 0x007A, + NL_SEAL_NONE = 0xFFFF + } NL_SEAL_ALGORITHM; + + typedef [public,flag(NDR_PAHEX)] struct { + [value(NL_SIGN_HMAC_MD5)] NL_SIGNATURE_ALGORITHM SignatureAlgorithm; + NL_SEAL_ALGORITHM SealAlgorithm; + uint16 Pad; + uint16 Flags; + uint8 SequenceNumber[8]; + uint8 Checksum[8]; + uint8 Confounder[8]; + } NL_AUTH_SIGNATURE; + + const int NL_AUTH_SIGNATURE_SIZE = 0x20; + + /* MS-NRPC 2.2.1.3.3 NL_AUTH_SHA2_SIGNATURE */ + + typedef [public,flag(NDR_PAHEX)] struct { + [value(NL_SIGN_HMAC_SHA256)] NL_SIGNATURE_ALGORITHM SignatureAlgorithm; + NL_SEAL_ALGORITHM SealAlgorithm; + uint16 Pad; + uint16 Flags; + uint8 SequenceNumber[8]; + uint8 Checksum[32]; + uint8 Confounder[8]; + } NL_AUTH_SHA2_SIGNATURE; +} diff --git a/librpc/idl/security.cnf b/librpc/idl/security.cnf new file mode 100644 index 0000000..37da8c7 --- /dev/null +++ b/librpc/idl/security.cnf @@ -0,0 +1 @@ +NOEMIT diff --git a/librpc/idl/security.idl b/librpc/idl/security.idl new file mode 100644 index 0000000..8783b67 --- /dev/null +++ b/librpc/idl/security.idl @@ -0,0 +1,972 @@ +#include "idl_types.h" + +/* + security IDL structures +*/ + +import "misc.idl"; + +/* + use the same structure for dom_sid2 as dom_sid. A dom_sid2 is really + just a dom sid, but with the sub_auths represented as a conformant + array. As with all in-structure conformant arrays, the array length + is placed before the start of the structure. That's what gives rise + to the extra num_auths element. We don't want the Samba code to + have to bother with such esoteric NDR details, so its easier to just + define it as a dom_sid and use pidl magic to make it all work. It + just means you need to mark a sid as a "dom_sid2" in the IDL when you + know it is of the conformant array variety +*/ +cpp_quote("#define dom_sid2 dom_sid") + +/* same struct as dom_sid but inside a 28 bytes fixed buffer in NDR */ +cpp_quote("#define dom_sid28 dom_sid") + +/* same struct as dom_sid but in a variable byte buffer, which is maybe empty in NDR */ +cpp_quote("#define dom_sid0 dom_sid") + +[ + /* + * cbf7d408-2d6c-11e2-ae5b-0b5692790e18 just to make ndrdump happy + */ + uuid("cbf7d408-2d6c-11e2-ae5b-0b5692790e18"), + version(0.0), + helper("../libcli/security/security.h"), + pyhelper("librpc/ndr/py_security.c"), + pointer_default(unique) +] +interface security +{ + + typedef bitmap lsa_SystemAccessModeFlags lsa_SystemAccessModeFlags; + + typedef [public,gensize,noprint,nosize,nopull,nopush] struct { + uint8 sid_rev_num; /**< SID revision number */ + [range(0,15)] int8 num_auths; /**< Number of sub-authorities */ + uint8 id_auth[6]; /**< Identifier Authority */ + uint32 sub_auths[15]; + } dom_sid; + /* + access masks are divided up like this: + 0xabccdddd + where + a = generic rights bits SEC_GENERIC_ + b = flags SEC_FLAG_ + c = standard rights bits SEC_STD_ + d = object type specific bits SEC_{FILE,DIR,REG,xxx}_ + + common combinations of bits are prefixed with SEC_RIGHTS_ + */ + const int SEC_MASK_GENERIC = 0xF0000000; + const int SEC_MASK_FLAGS = 0x0F000000; + const int SEC_MASK_STANDARD = 0x00FF0000; + const int SEC_MASK_SPECIFIC = 0x0000FFFF; + + /* generic bits */ + const int SEC_GENERIC_ALL = 0x10000000; + const int SEC_GENERIC_EXECUTE = 0x20000000; + const int SEC_GENERIC_WRITE = 0x40000000; + const int SEC_GENERIC_READ = 0x80000000; + + /* flag bits */ + const int SEC_FLAG_SYSTEM_SECURITY = 0x01000000; + const int SEC_FLAG_MAXIMUM_ALLOWED = 0x02000000; + + /* standard bits */ + const int SEC_STD_DELETE = 0x00010000; + const int SEC_STD_READ_CONTROL = 0x00020000; + const int SEC_STD_WRITE_DAC = 0x00040000; + const int SEC_STD_WRITE_OWNER = 0x00080000; + const int SEC_STD_SYNCHRONIZE = 0x00100000; + const int SEC_STD_REQUIRED = 0x000F0000; + const int SEC_STD_ALL = 0x001F0000; + + /* file specific bits */ + const int SEC_FILE_READ_DATA = 0x00000001; + const int SEC_FILE_WRITE_DATA = 0x00000002; + const int SEC_FILE_APPEND_DATA = 0x00000004; + const int SEC_FILE_READ_EA = 0x00000008; + const int SEC_FILE_WRITE_EA = 0x00000010; + const int SEC_FILE_EXECUTE = 0x00000020; + const int SEC_FILE_READ_ATTRIBUTE = 0x00000080; + const int SEC_FILE_WRITE_ATTRIBUTE = 0x00000100; + const int SEC_FILE_ALL = 0x000001ff; + + /* directory specific bits */ + const int SEC_DIR_LIST = 0x00000001; + const int SEC_DIR_ADD_FILE = 0x00000002; + const int SEC_DIR_ADD_SUBDIR = 0x00000004; + const int SEC_DIR_READ_EA = 0x00000008; + const int SEC_DIR_WRITE_EA = 0x00000010; + const int SEC_DIR_TRAVERSE = 0x00000020; + const int SEC_DIR_DELETE_CHILD = 0x00000040; + const int SEC_DIR_READ_ATTRIBUTE = 0x00000080; + const int SEC_DIR_WRITE_ATTRIBUTE = 0x00000100; + + /* registry entry specific bits */ + const int SEC_REG_QUERY_VALUE = 0x00000001; + const int SEC_REG_SET_VALUE = 0x00000002; + const int SEC_REG_CREATE_SUBKEY = 0x00000004; + const int SEC_REG_ENUM_SUBKEYS = 0x00000008; + const int SEC_REG_NOTIFY = 0x00000010; + const int SEC_REG_CREATE_LINK = 0x00000020; + + /* ldap specific access bits */ + const int SEC_ADS_CREATE_CHILD = 0x00000001; + const int SEC_ADS_DELETE_CHILD = 0x00000002; + const int SEC_ADS_LIST = 0x00000004; + const int SEC_ADS_SELF_WRITE = 0x00000008; + const int SEC_ADS_READ_PROP = 0x00000010; + const int SEC_ADS_WRITE_PROP = 0x00000020; + const int SEC_ADS_DELETE_TREE = 0x00000040; + const int SEC_ADS_LIST_OBJECT = 0x00000080; + const int SEC_ADS_CONTROL_ACCESS = 0x00000100; + + /* invalid bits */ + const int SEC_MASK_INVALID = 0x0ce0fe00; + + /* generic->specific mappings for files */ + const int SEC_RIGHTS_FILE_READ = SEC_STD_READ_CONTROL | + SEC_STD_SYNCHRONIZE | + SEC_FILE_READ_DATA | + SEC_FILE_READ_ATTRIBUTE | + SEC_FILE_READ_EA; + + const int SEC_RIGHTS_FILE_WRITE = SEC_STD_READ_CONTROL | + SEC_STD_SYNCHRONIZE | + SEC_FILE_WRITE_DATA | + SEC_FILE_WRITE_ATTRIBUTE | + SEC_FILE_WRITE_EA | + SEC_FILE_APPEND_DATA; + + const int SEC_RIGHTS_FILE_EXECUTE = SEC_STD_SYNCHRONIZE | + SEC_STD_READ_CONTROL | + SEC_FILE_READ_ATTRIBUTE | + SEC_FILE_EXECUTE; + + const int SEC_RIGHTS_FILE_ALL = SEC_STD_ALL | SEC_FILE_ALL; + + /* generic->specific mappings for directories (same as files) */ + const int SEC_RIGHTS_DIR_READ = SEC_RIGHTS_FILE_READ; + const int SEC_RIGHTS_DIR_WRITE = SEC_RIGHTS_FILE_WRITE; + const int SEC_RIGHTS_DIR_EXECUTE = SEC_RIGHTS_FILE_EXECUTE; + const int SEC_RIGHTS_DIR_ALL = SEC_RIGHTS_FILE_ALL; + + /* rights granted by some specific privileges */ + const int SEC_RIGHTS_PRIV_BACKUP = SEC_STD_READ_CONTROL | + SEC_FLAG_SYSTEM_SECURITY | + SEC_RIGHTS_FILE_READ | + SEC_DIR_TRAVERSE; + + const int SEC_RIGHTS_PRIV_RESTORE = SEC_STD_WRITE_DAC | + SEC_STD_WRITE_OWNER | + SEC_FLAG_SYSTEM_SECURITY | + SEC_RIGHTS_FILE_WRITE | + SEC_DIR_ADD_FILE | + SEC_DIR_ADD_SUBDIR | + SEC_STD_DELETE; + + /* combinations of standard masks. */ + const int STANDARD_RIGHTS_ALL_ACCESS = SEC_STD_ALL; /* 0x001f0000 */ + const int STANDARD_RIGHTS_MODIFY_ACCESS = SEC_STD_READ_CONTROL; /* 0x00020000 */ + const int STANDARD_RIGHTS_EXECUTE_ACCESS = SEC_STD_READ_CONTROL; /* 0x00020000 */ + const int STANDARD_RIGHTS_READ_ACCESS = SEC_STD_READ_CONTROL; /* 0x00020000 */ + const int STANDARD_RIGHTS_WRITE_ACCESS = + (SEC_STD_WRITE_OWNER | + SEC_STD_WRITE_DAC | + SEC_STD_DELETE); /* 0x000d0000 */ + const int STANDARD_RIGHTS_REQUIRED_ACCESS = + (SEC_STD_DELETE | + SEC_STD_READ_CONTROL | + SEC_STD_WRITE_DAC | + SEC_STD_WRITE_OWNER); /* 0x000f0000 */ + + /* generic->specific mappings for Directory Service objects */ + /* directory specific part of GENERIC_ALL */ + const int SEC_ADS_GENERIC_ALL_DS = + (SEC_STD_DELETE | + SEC_STD_WRITE_DAC | + SEC_STD_WRITE_OWNER | + SEC_ADS_CREATE_CHILD | + SEC_ADS_DELETE_CHILD | + SEC_ADS_DELETE_TREE | + SEC_ADS_CONTROL_ACCESS); + const int SEC_ADS_GENERIC_EXECUTE = SEC_STD_READ_CONTROL | SEC_ADS_LIST; + const int SEC_ADS_GENERIC_WRITE = + (SEC_STD_READ_CONTROL | + SEC_ADS_SELF_WRITE | + SEC_ADS_WRITE_PROP); + const int SEC_ADS_GENERIC_READ = + (SEC_STD_READ_CONTROL | + SEC_ADS_LIST | + SEC_ADS_READ_PROP | + SEC_ADS_LIST_OBJECT); + const int SEC_ADS_GENERIC_ALL = + (SEC_ADS_GENERIC_EXECUTE | + SEC_ADS_GENERIC_WRITE | + SEC_ADS_GENERIC_READ | + SEC_ADS_GENERIC_ALL_DS); + + /* + * Rights implicitly granted to a user who is an owner of the security + * descriptor being processed. + */ + typedef enum { + IMPLICIT_OWNER_READ_CONTROL_RIGHTS, + IMPLICIT_OWNER_READ_CONTROL_AND_WRITE_DAC_RIGHTS + } implicit_owner_rights; + + /***************************************************************/ + /* WELL KNOWN SIDS */ + + /* a NULL sid */ + const string SID_NULL = "S-1-0-0"; + + /* the world domain */ + const string NAME_WORLD = "WORLD"; + + const string SID_WORLD_DOMAIN = "S-1-1"; + const string SID_WORLD = "S-1-1-0"; + + /* SECURITY_CREATOR_SID_AUTHORITY */ + const string SID_CREATOR_OWNER_DOMAIN = "S-1-3"; + const string SID_CREATOR_OWNER = "S-1-3-0"; + const string SID_CREATOR_GROUP = "S-1-3-1"; + const string SID_OWNER_RIGHTS = "S-1-3-4"; + + /* SECURITY_NT_AUTHORITY */ + const string NAME_NT_AUTHORITY = "NT AUTHORITY"; + + const string SID_NT_AUTHORITY = "S-1-5"; + const string SID_NT_DIALUP = "S-1-5-1"; + const string SID_NT_NETWORK = "S-1-5-2"; + const string SID_NT_BATCH = "S-1-5-3"; + const string SID_NT_INTERACTIVE = "S-1-5-4"; + const string SID_NT_SERVICE = "S-1-5-6"; + const string SID_NT_ANONYMOUS = "S-1-5-7"; + const string SID_NT_PROXY = "S-1-5-8"; + const string SID_NT_ENTERPRISE_DCS = "S-1-5-9"; + const string SID_NT_SELF = "S-1-5-10"; + const string SID_NT_AUTHENTICATED_USERS = "S-1-5-11"; + const string SID_NT_RESTRICTED = "S-1-5-12"; + const string SID_NT_TERMINAL_SERVER_USERS = "S-1-5-13"; + const string SID_NT_REMOTE_INTERACTIVE = "S-1-5-14"; + const string SID_NT_THIS_ORGANISATION = "S-1-5-15"; + const string SID_NT_IUSR = "S-1-5-17"; + const string SID_NT_SYSTEM = "S-1-5-18"; + const string SID_NT_LOCAL_SERVICE = "S-1-5-19"; + const string SID_NT_NETWORK_SERVICE = "S-1-5-20"; + const string SID_NT_DIGEST_AUTHENTICATION = "S-1-5-64-21"; + const string SID_NT_NTLM_AUTHENTICATION = "S-1-5-64-10"; + const string SID_NT_SCHANNEL_AUTHENTICATION = "S-1-5-64-14"; + const string SID_NT_OTHER_ORGANISATION = "S-1-5-1000"; + + /* SECURITY_BUILTIN_DOMAIN_RID */ + const string NAME_BUILTIN = "BUILTIN"; + + const string SID_BUILTIN = "S-1-5-32"; + const string SID_BUILTIN_ADMINISTRATORS = "S-1-5-32-544"; + const string SID_BUILTIN_USERS = "S-1-5-32-545"; + const string SID_BUILTIN_GUESTS = "S-1-5-32-546"; + const string SID_BUILTIN_POWER_USERS = "S-1-5-32-547"; + const string SID_BUILTIN_ACCOUNT_OPERATORS = "S-1-5-32-548"; + const string SID_BUILTIN_SERVER_OPERATORS = "S-1-5-32-549"; + const string SID_BUILTIN_PRINT_OPERATORS = "S-1-5-32-550"; + const string SID_BUILTIN_BACKUP_OPERATORS = "S-1-5-32-551"; + const string SID_BUILTIN_REPLICATOR = "S-1-5-32-552"; + const string SID_BUILTIN_RAS_SERVERS = "S-1-5-32-553"; + const string SID_BUILTIN_PREW2K = "S-1-5-32-554"; + const string SID_BUILTIN_REMOTE_DESKTOP_USERS = "S-1-5-32-555"; + const string SID_BUILTIN_NETWORK_CONF_OPERATORS = "S-1-5-32-556"; + const string SID_BUILTIN_INCOMING_FOREST_TRUST = "S-1-5-32-557"; + const string SID_BUILTIN_PERFMON_USERS = "S-1-5-32-558"; + const string SID_BUILTIN_PERFLOG_USERS = "S-1-5-32-559"; + const string SID_BUILTIN_AUTH_ACCESS = "S-1-5-32-560"; + const string SID_BUILTIN_TS_LICENSE_SERVERS = "S-1-5-32-561"; + const string SID_BUILTIN_DISTRIBUTED_COM_USERS = "S-1-5-32-562"; + const string SID_BUILTIN_IUSERS = "S-1-5-32-568"; + const string SID_BUILTIN_CRYPTO_OPERATORS = "S-1-5-32-569"; + const string SID_BUILTIN_EVENT_LOG_READERS = "S-1-5-32-573"; + const string SID_BUILTIN_CERT_SERV_DCOM_ACCESS = "S-1-5-32-574"; + const string SID_BUILTIN_RDS_REMOTE_ACCESS_SERVERS = "S-1-5-32-575"; + const string SID_BUILTIN_RDS_ENDPOINT_SERVERS = "S-1-5-32-576"; + const string SID_BUILTIN_RDS_MANAGEMENT_SERVERS = "S-1-5-32-577"; + const string SID_BUILTIN_HYPER_V_ADMINS = "S-1-5-32-578"; + const string SID_BUILTIN_ACCESS_CONTROL_ASSISTANCE_OPS = "S-1-5-32-579"; + const string SID_BUILTIN_REMOTE_MANAGEMENT_USERS = "S-1-5-32-580"; + const string SID_BUILTIN_SYSTEM_MANAGED_ACCOUNTS_GRP = "S-1-5-32-581"; + const string SID_BUILTIN_STORAGE_REPLICA_ADMINISTRATORS = "S-1-5-32-582"; + + const string SID_SECURITY_RESTRICTED_CODE = "S-1-5-33"; + + /* UID/GID mapping Samba style */ + const string SID_SAMBA_UNIX_USER_OWNER = "S-1-22-1"; + const string SID_SAMBA_UNIX_GROUP_OWNER = "S-1-22-2"; + + /* SECURITY_NT_SERVICE */ + const string NAME_NT_SERVICE = "NT SERVICE"; + + const string SID_NT_NT_SERVICE = "S-1-5-80"; + const string SID_NT_TRUSTED_INSTALLER = + "S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464"; + + /* + * This is added during the AS-REQ/AS-REP exchange after + * pre-authentication was successful. + */ + const string SID_AUTHENTICATION_AUTHORITY_ASSERTED_IDENTITY = "S-1-18-1"; + /* + * This is added during S4U2Self PAC creation. + * + * It won't replace a possible + * SID_AUTHENTICATION_AUTHORITY_ASSERTED_IDENTITY + * during S4U2Proxy. + */ + const string SID_SERVICE_ASSERTED_IDENTITY = "S-1-18-2"; + + const string SID_COMPOUNDED_AUTHENTICATION = "S-1-5-21-0-0-0-496"; + const string SID_CLAIMS_VALID = "S-1-5-21-0-0-0-497"; + + const string SID_USER_MODE_DRIVERS = "S-1-5-84-0-0-0-0-0"; + + const string SID_SECURITY_BUILTIN_PACKAGE_ANY_PACKAGE = "S-1-15-2-1"; + + const string SID_SECURITY_MANDATORY_LOW = "S-1-16-4096"; + const string SID_SECURITY_MANDATORY_MEDIUM = "S-1-16-8192"; + const string SID_SECURITY_MANDATORY_MEDIUM_PLUS = "S-1-16-8448"; + const string SID_SECURITY_MANDATORY_HIGH = "S-1-16-12288"; + const string SID_SECURITY_MANDATORY_SYSTEM = "S-1-16-16384"; + + /* + * http://technet.microsoft.com/en-us/library/hh509017(v=ws.10).aspx + */ + const string SID_NT_NFS_SUBSYSTEM = "S-1-5-88"; + const string SID_NT_NFS_USER = "S-1-5-88-1"; + const string SID_NT_NFS_GROUP = "S-1-5-88-2"; + const string SID_NT_NFS_MASK = "S-1-5-88-3"; + const string SID_NT_NFS_OTHERS = "S-1-5-88-4"; + + /* well-known domain RIDs */ + const int DOMAIN_RID_LOGON = 9; + const int DOMAIN_RID_ENTERPRISE_READONLY_DCS = 498; + const int DOMAIN_RID_ADMINISTRATOR = 500; + const int DOMAIN_RID_GUEST = 501; + const int DOMAIN_RID_KRBTGT = 502; + const int DOMAIN_RID_ADMINS = 512; + const int DOMAIN_RID_USERS = 513; + const int DOMAIN_RID_GUESTS = 514; + const int DOMAIN_RID_DOMAIN_MEMBERS = 515; + const int DOMAIN_RID_DCS = 516; + const int DOMAIN_RID_CERT_ADMINS = 517; + const int DOMAIN_RID_SCHEMA_ADMINS = 518; + const int DOMAIN_RID_ENTERPRISE_ADMINS = 519; + const int DOMAIN_RID_POLICY_ADMINS = 520; + const int DOMAIN_RID_READONLY_DCS = 521; + const int DOMAIN_RID_CLONEABLE_CONTROLLERS = 522; + const int DOMAIN_RID_PROTECTED_USERS = 525; + const int DOMAIN_RID_KEY_ADMINS = 526; + const int DOMAIN_RID_ENTERPRISE_KEY_ADMINS = 527; + const int DOMAIN_RID_RAS_SERVERS = 553; + const int DOMAIN_RID_RODC_ALLOW = 571; + const int DOMAIN_RID_RODC_DENY = 572; + + /* well-known builtin RIDs */ + const int BUILTIN_RID_ADMINISTRATORS = 544; + const int BUILTIN_RID_USERS = 545; + const int BUILTIN_RID_GUESTS = 546; + const int BUILTIN_RID_POWER_USERS = 547; + const int BUILTIN_RID_ACCOUNT_OPERATORS = 548; + const int BUILTIN_RID_SERVER_OPERATORS = 549; + const int BUILTIN_RID_PRINT_OPERATORS = 550; + const int BUILTIN_RID_BACKUP_OPERATORS = 551; + const int BUILTIN_RID_REPLICATOR = 552; + const int BUILTIN_RID_RAS_SERVERS = 553; + const int BUILTIN_RID_PRE_2K_ACCESS = 554; + const int BUILTIN_RID_REMOTE_DESKTOP_USERS = 555; + const int BUILTIN_RID_NETWORK_CONF_OPERATORS = 556; + const int BUILTIN_RID_INCOMING_FOREST_TRUST = 557; + const int BUILTIN_RID_PERFMON_USERS = 558; + const int BUILTIN_RID_PERFLOG_USERS = 559; + const int BUILTIN_RID_AUTH_ACCESS = 560; + const int BUILTIN_RID_TS_LICENSE_SERVERS = 561; + const int BUILTIN_RID_DISTRIBUTED_COM_USERS = 562; + const int BUILTIN_RID_IUSERS = 568; + const int BUILTIN_RID_CRYPTO_OPERATORS = 569; + const int BUILTIN_RID_EVENT_LOG_READERS = 573; + const int BUILTIN_RID_CERT_SERV_DCOM_ACCESS = 574; + const int BUILTIN_RID_RDS_REMOTE_ACCESS_SERVERS = 575; + const int BUILTIN_RID_RDS_ENDPOINT_SERVERS = 576; + const int BUILTIN_RID_RDS_MANAGEMENT_SERVERS = 577; + const int BUILTIN_RID_HYPER_V_ADMINS = 578; + const int BUILTIN_RID_ACCESS_CONTROL_ASSISTANCE_OPS = 579; + const int BUILTIN_RID_REMOTE_MANAGEMENT_USERS = 580; + +/******************************************************************** + This is a list of privileges reported by a WIndows 2008 R2 DC + just for reference purposes (and I know the LUID is not guaranteed + across reboots): + +0x00000002 SeCreateTokenPrivilege "Create a token object" +0x00000003 SeAssignPrimaryTokenPrivilege "Replace a process level token" +0x00000004 SeLockMemoryPrivilege "Lock pages in memory" +0x00000005 SeIncreaseQuotaPrivilege "Adjust memory quotas for a process" +0x00000006 SeMachineAccountPrivilege "Add workstations to domain" +0x00000007 SeTcbPrivilege "Act as part of the operating system" +0x00000008 SeSecurityPrivilege "Manage auditing and security log" +0x00000009 SeTakeOwnershipPrivilege "Take ownership of files or other objects" +0x0000000a SeLoadDriverPrivilege "Load and unload device drivers" +0x0000000b SeSystemProfilePrivilege "Profile system performance" +0x0000000c SeSystemtimePrivilege "Change the system time" +0x0000000d SeProfileSingleProcessPrivilege "Profile single process" +0x0000000e SeIncreaseBasePriorityPrivilege "Increase scheduling priority" +0x0000000f SeCreatePagefilePrivilege "Create a pagefile" +0x00000010 SeCreatePermanentPrivilege "Create permanent shared objects" +0x00000011 SeBackupPrivilege "Back up files and directories" +0x00000012 SeRestorePrivilege "Restore files and directories" +0x00000013 SeShutdownPrivilege "Shut down the system" +0x00000014 SeDebugPrivilege "Debug programs" +0x00000015 SeAuditPrivilege "Generate security audits" +0x00000016 SeSystemEnvironmentPrivilege "Modify firmware environment values" +0x00000017 SeChangeNotifyPrivilege "Bypass traverse checking" +0x00000018 SeRemoteShutdownPrivilege "Force shutdown from a remote system" +0x00000019 SeUndockPrivilege "Remove computer from docking station" +0x0000001a SeSyncAgentPrivilege "Synchronize directory service data" +0x0000001b SeEnableDelegationPrivilege "Enable computer and user accounts to be trusted for delegation" +0x0000001c SeManageVolumePrivilege "Perform volume maintenance tasks" +0x0000001d SeImpersonatePrivilege "Impersonate a client after authentication" +0x0000001e SeCreateGlobalPrivilege "Create global objects" +0x0000001f SeTrustedCredManAccessPrivilege "Access Credential Manager as a trusted caller" +0x00000020 SeRelabelPrivilege "Modify an object label" +0x00000021 SeIncreaseWorkingSetPrivilege "Increase a process working set" +0x00000022 SeTimeZonePrivilege "Change the time zone" +0x00000023 SeCreateSymbolicLinkPrivilege "Create symbolic links" + + ********************************************************************/ + + /* LUID values for privileges known about by Samba (bottom 32 bits of enum, top bits are 0) */ + + /* we have to define the LUID here due to a horrible check by printmig.exe + that requires the SeBackupPrivilege match what is in Windows. So match + those that we implement and start Samba privileges at 0x1001 */ + + typedef enum { + SEC_PRIV_INVALID = 0x0, + SEC_PRIV_INCREASE_QUOTA = 0x5, + SEC_PRIV_MACHINE_ACCOUNT = 0x6, + SEC_PRIV_SECURITY = 0x8, + SEC_PRIV_TAKE_OWNERSHIP = 0x09, + SEC_PRIV_LOAD_DRIVER = 0x0a, + SEC_PRIV_SYSTEM_PROFILE = 0x0b, + SEC_PRIV_SYSTEMTIME = 0x0c, + SEC_PRIV_PROFILE_SINGLE_PROCESS = 0x0d, + SEC_PRIV_INCREASE_BASE_PRIORITY = 0x0e, + SEC_PRIV_CREATE_PAGEFILE = 0x0f, + SEC_PRIV_BACKUP = 0x11, + SEC_PRIV_RESTORE = 0x12, + SEC_PRIV_SHUTDOWN = 0x13, + SEC_PRIV_DEBUG = 0x14, + SEC_PRIV_SYSTEM_ENVIRONMENT = 0x16, + SEC_PRIV_CHANGE_NOTIFY = 0x17, + SEC_PRIV_REMOTE_SHUTDOWN = 0x18, + SEC_PRIV_UNDOCK = 0x19, + SEC_PRIV_ENABLE_DELEGATION = 0x1b, + SEC_PRIV_MANAGE_VOLUME = 0x1c, + SEC_PRIV_IMPERSONATE = 0x1d, + SEC_PRIV_CREATE_GLOBAL = 0x1e, + /* Samba-specific privs */ + SEC_PRIV_PRINT_OPERATOR = 0x1001, + SEC_PRIV_ADD_USERS = 0x1002, + SEC_PRIV_DISK_OPERATOR = 0x1003 + } sec_privilege; + + + /* Bitmap of privilege values for internal use only. We need + * our own bitmap here as privileges.tdb records these values + * as a bitmap (privileges.ldb uses the string forms). + */ + typedef [bitmap64bit] bitmap { + SEC_PRIV_MACHINE_ACCOUNT_BIT = 0x00000010, + + /* Samba-specific privs */ + SEC_PRIV_PRINT_OPERATOR_BIT = 0x00000020, + SEC_PRIV_ADD_USERS_BIT = 0x00000040, + SEC_PRIV_DISK_OPERATOR_BIT = 0x00000080, + + SEC_PRIV_REMOTE_SHUTDOWN_BIT = 0x00000100, + SEC_PRIV_BACKUP_BIT = 0x00000200, + SEC_PRIV_RESTORE_BIT = 0x00000400, + SEC_PRIV_TAKE_OWNERSHIP_BIT = 0x00000800, + /* End of privileges implemented before merge to common code */ + + SEC_PRIV_INCREASE_QUOTA_BIT = 0x00001000, + SEC_PRIV_SECURITY_BIT = 0x00002000, + SEC_PRIV_LOAD_DRIVER_BIT = 0x00004000, + SEC_PRIV_SYSTEM_PROFILE_BIT = 0x00008000, + SEC_PRIV_SYSTEMTIME_BIT = 0x00010000, + SEC_PRIV_PROFILE_SINGLE_PROCESS_BIT = 0x00020000, + SEC_PRIV_INCREASE_BASE_PRIORITY_BIT = 0x00040000, + SEC_PRIV_CREATE_PAGEFILE_BIT = 0x00080000, + SEC_PRIV_SHUTDOWN_BIT = 0x00100000, + SEC_PRIV_DEBUG_BIT = 0x00200000, + SEC_PRIV_SYSTEM_ENVIRONMENT_BIT = 0x00400000, + SEC_PRIV_CHANGE_NOTIFY_BIT = 0x00800000, + SEC_PRIV_UNDOCK_BIT = 0x01000000, + SEC_PRIV_ENABLE_DELEGATION_BIT = 0x02000000, + SEC_PRIV_MANAGE_VOLUME_BIT = 0x04000000, + SEC_PRIV_IMPERSONATE_BIT = 0x08000000, + SEC_PRIV_CREATE_GLOBAL_BIT = 0x10000000 + } se_privilege; + + typedef [bitmap32bit] bitmap { + LSA_POLICY_MODE_INTERACTIVE = 0x00000001, + LSA_POLICY_MODE_NETWORK = 0x00000002, + LSA_POLICY_MODE_BATCH = 0x00000004, + LSA_POLICY_MODE_SERVICE = 0x00000010, + LSA_POLICY_MODE_PROXY = 0x00000020, + LSA_POLICY_MODE_DENY_INTERACTIVE = 0x00000040, + LSA_POLICY_MODE_DENY_NETWORK = 0x00000080, + LSA_POLICY_MODE_DENY_BATCH = 0x00000100, + LSA_POLICY_MODE_DENY_SERVICE = 0x00000200, + LSA_POLICY_MODE_REMOTE_INTERACTIVE = 0x00000400, + LSA_POLICY_MODE_DENY_REMOTE_INTERACTIVE = 0x00000800, + LSA_POLICY_MODE_ALL = 0x00000FF7, + LSA_POLICY_MODE_ALL_NT4 = 0x00000037 + } lsa_SystemAccessModeFlags; + + typedef [public,bitmap8bit] bitmap { + SEC_ACE_FLAG_OBJECT_INHERIT = 0x01, + SEC_ACE_FLAG_CONTAINER_INHERIT = 0x02, + SEC_ACE_FLAG_NO_PROPAGATE_INHERIT = 0x04, + SEC_ACE_FLAG_INHERIT_ONLY = 0x08, + SEC_ACE_FLAG_INHERITED_ACE = 0x10, + SEC_ACE_FLAG_VALID_INHERIT = 0x0f, + SEC_ACE_FLAG_SUCCESSFUL_ACCESS = 0x40, + SEC_ACE_FLAG_FAILED_ACCESS = 0x80 + } security_ace_flags; + + typedef [public,enum8bit] enum { + /* + * The following entries tagged *reserved* have been + * named and allocated by Microsoft but apparently not + * implemented (MS-DTYP 2.4.4.1). + * + * The entries marked *unused* are more or less + * completely ignored by Samba. + */ + SEC_ACE_TYPE_ACCESS_ALLOWED = 0, + SEC_ACE_TYPE_ACCESS_DENIED = 1, + SEC_ACE_TYPE_SYSTEM_AUDIT = 2, + SEC_ACE_TYPE_SYSTEM_ALARM = 3, /* reserved */ + SEC_ACE_TYPE_ALLOWED_COMPOUND = 4, /* reserved */ + SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT = 5, + SEC_ACE_TYPE_ACCESS_DENIED_OBJECT = 6, + SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT = 7, + SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT = 8, /* reserved */ + SEC_ACE_TYPE_ACCESS_ALLOWED_CALLBACK = 9, + SEC_ACE_TYPE_ACCESS_DENIED_CALLBACK = 10, + SEC_ACE_TYPE_ACCESS_ALLOWED_CALLBACK_OBJECT = 11, + SEC_ACE_TYPE_ACCESS_DENIED_CALLBACK_OBJECT = 12, + SEC_ACE_TYPE_SYSTEM_AUDIT_CALLBACK = 13, + SEC_ACE_TYPE_SYSTEM_ALARM_CALLBACK = 14, /* reserved */ + SEC_ACE_TYPE_SYSTEM_AUDIT_CALLBACK_OBJECT = 15, + SEC_ACE_TYPE_SYSTEM_ALARM_CALLBACK_OBJECT = 16, /* reserved */ + SEC_ACE_TYPE_SYSTEM_MANDATORY_LABEL = 17, /*unused */ + SEC_ACE_TYPE_SYSTEM_RESOURCE_ATTRIBUTE = 18, + SEC_ACE_TYPE_SYSTEM_SCOPED_POLICY_ID = 19 /* unused */ + } security_ace_type; + + typedef [bitmap32bit] bitmap { + SEC_ACE_OBJECT_TYPE_PRESENT = 0x00000001, + SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT = 0x00000002 + } security_ace_object_flags; + + typedef [nodiscriminant] union { + /* this is the 'schemaIDGUID' attribute of the attribute object in the schema naming context */ + [case(SEC_ACE_OBJECT_TYPE_PRESENT)] GUID type; + [default]; + } security_ace_object_type; + + typedef [nodiscriminant] union { + /* this is the 'schemaIDGUID' attribute of the objectclass object in the schema naming context + * (of the parent container) + */ + [case(SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT)] GUID inherited_type; + [default]; + } security_ace_object_inherited_type; + + typedef struct { + security_ace_object_flags flags; + [switch_is(flags & SEC_ACE_OBJECT_TYPE_PRESENT)] security_ace_object_type type; + [switch_is(flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT)] security_ace_object_inherited_type inherited_type; + } security_ace_object; + + + + /* + * flags that might occur in + * CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1.flags. + * + * Not all of them do anything. Conditional ACEs also use some + * of these flags. + */ + typedef [bitmap32bit] bitmap { + CLAIM_SECURITY_ATTRIBUTE_NON_INHERITABLE = 1, + CLAIM_SECURITY_ATTRIBUTE_VALUE_CASE_SENSITIVE = 2, + CLAIM_SECURITY_ATTRIBUTE_USE_FOR_DENY_ONLY = 4, /*reserved*/ + CLAIM_SECURITY_ATTRIBUTE_DISABLED_BY_DEFAULT = 8, + CLAIM_SECURITY_ATTRIBUTE_DISABLED = 0x10, /*reserved*/ + CLAIM_SECURITY_ATTRIBUTE_MANDATORY = 0x20, + + /* + * These next two are curiously defined in [MS-DTYP] 2.4.10.1: + * + * > Flags: The upper two bytes of this DWORD are available for + * > application-specific data. The two lowest-order bits in the + * > lower of these two bytes are reserved. These two bytes + * > MAY contain only one of the following values in those two + * > bits: + * > + * > FCI_CLAIM_SECURITY_ATTRIBUTE_MANUAL 0x0001 + * > FCI_CLAIM_SECURITY_ATTRIBUTE_POLICY_DERIVED 0x0002 + * + * That is saying these mutually exclusive flags have offset + * values that are measured from the middle of flags field. We + * instead measure from the start. + */ + CLAIM_SECURITY_ATTRIBUTE_MANUAL = 1 << 16, + CLAIM_SECURITY_ATTRIBUTE_POLICY_DERIVED = 1 << 17, + + /* + * As the quote from [MS-DTYP] 2.4.10.1 above says, + * the upper 14 bits are for application-specific + * data. In Samba's case, we have one application + * specific flag to help us remember when we have + * sorted a claim and checked that it contains no + * duplicate values. We need to check this, and the + * check can be expensive, so it helps to remember. + * Having the values sorted is useful for comparisons + * in conditional ACEs. + * + * We can't just sort every claim_v1 we see, because + * resource attribute ACEs in SACLs contain them and + * are not meant to be evaluated prematurely (i.e. you + * can parse and reserialise a SACL even if it + * contains an ACE that would cause an error when used + * as a claim). + * + * In the case of string claims, evaluating uniqueness + * depends on the _CASE_SENSITIVE flag. + */ + CLAIM_SECURITY_ATTRIBUTE_UNIQUE_AND_SORTED = 1 << 30, + /* + * Conditional ACEs use some of the above flags in + * combination with an internal one defined in + * conditional_ace.idl. + * This next definition is warning us in case a clash + * develops (which seems very unlikely). + */ + CLAIM_SECURITY_ATTRIBUTE_RESERVED_FOR_SAMBA = 1UL << 31 + } claim_flags; + + /* + * These claim types for v1 claims mirror those of on-the-wire + * PAC claims, but not conditional ace literal token types. + */ + typedef [public] enum { + CLAIM_SECURITY_ATTRIBUTE_TYPE_INT64 = 0x0001, + CLAIM_SECURITY_ATTRIBUTE_TYPE_UINT64 = 0x0002, + CLAIM_SECURITY_ATTRIBUTE_TYPE_STRING = 0x0003, + CLAIM_SECURITY_ATTRIBUTE_TYPE_SID = 0x0005, + CLAIM_SECURITY_ATTRIBUTE_TYPE_BOOLEAN = 0x0006, + CLAIM_SECURITY_ATTRIBUTE_TYPE_OCTET_STRING = 0x0010 + } security_claim_value_type; + + typedef [nodiscriminant,flag(NDR_NOALIGN)] union { + [case(CLAIM_SECURITY_ATTRIBUTE_TYPE_INT64),relative] int64 *int_value; + [case(CLAIM_SECURITY_ATTRIBUTE_TYPE_UINT64),relative] hyper *uint_value; + [case(CLAIM_SECURITY_ATTRIBUTE_TYPE_STRING),relative] nstring *string_value; + [case(CLAIM_SECURITY_ATTRIBUTE_TYPE_SID),relative] DATA_BLOB *sid_value; + [case(CLAIM_SECURITY_ATTRIBUTE_TYPE_OCTET_STRING),relative] DATA_BLOB *octet_value; + [case(CLAIM_SECURITY_ATTRIBUTE_TYPE_BOOLEAN),relative] hyper *uint_value; + } claim_values; + + typedef [public,gensize] struct { + [relative] nstring *name; + uint16 value_type; + uint32 flags; + uint32 value_count; + [switch_is(value_type)] claim_values values[value_count]; + } CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1; + + typedef [public,nodiscriminant] union { + [default] security_ace_object object; + [case(false)]; + } security_ace_object_ctr; + + typedef [public,nodiscriminant,gensize] union { + [case(SEC_ACE_TYPE_ACCESS_ALLOWED_CALLBACK)] [flag(NDR_REMAINING)] DATA_BLOB conditions; + [case(SEC_ACE_TYPE_ACCESS_DENIED_CALLBACK)] [flag(NDR_REMAINING)] DATA_BLOB conditions; + [case(SEC_ACE_TYPE_ACCESS_ALLOWED_CALLBACK_OBJECT)] [flag(NDR_REMAINING)] DATA_BLOB conditions; + [case(SEC_ACE_TYPE_ACCESS_DENIED_CALLBACK_OBJECT)] [flag(NDR_REMAINING)] DATA_BLOB conditions; + [case(SEC_ACE_TYPE_SYSTEM_AUDIT_CALLBACK)] [flag(NDR_REMAINING)] DATA_BLOB conditions; + [case(SEC_ACE_TYPE_SYSTEM_AUDIT_CALLBACK_OBJECT)] [flag(NDR_REMAINING)] DATA_BLOB conditions; + + [case(SEC_ACE_TYPE_SYSTEM_RESOURCE_ATTRIBUTE)] CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 claim; + [default][flag(NDR_REMAINING)] DATA_BLOB ignored; + } security_ace_coda; + + typedef [public,gensize,nosize,nopush,nopull] struct { + security_ace_type type; /* SEC_ACE_TYPE_* */ + security_ace_flags flags; /* SEC_ACE_FLAG_* */ + [value(ndr_size_security_ace(r,ndr->flags))] uint16 size; + uint32 access_mask; + [switch_is(sec_ace_object(type))] security_ace_object_ctr object; + dom_sid trustee; + [switch_is(type), subcontext(0), subcontext_size(ndr_subcontext_size_of_ace_coda(r, size, ndr->flags))] security_ace_coda coda; + } security_ace; + + typedef enum { + SECURITY_ACL_REVISION_NT4 = 2, + SECURITY_ACL_REVISION_ADS = 4 + } security_acl_revision; + + const uint NT4_ACL_REVISION = SECURITY_ACL_REVISION_NT4; + + typedef [public,gensize,nosize] struct { + security_acl_revision revision; + [value(ndr_size_security_acl(r,ndr->flags))] uint16 size; + [range(0,2000)] uint32 num_aces; + security_ace aces[num_aces]; + } security_acl; + + /* default revision for new ACLs */ + typedef [public,enum8bit] enum { + SECURITY_DESCRIPTOR_REVISION_1 = 1 + } security_descriptor_revision; + + const int SD_REVISION = SECURITY_DESCRIPTOR_REVISION_1; + + /* security_descriptor->type bits */ + typedef [public,bitmap16bit] bitmap { + SEC_DESC_OWNER_DEFAULTED = 0x0001, + SEC_DESC_GROUP_DEFAULTED = 0x0002, + SEC_DESC_DACL_PRESENT = 0x0004, + SEC_DESC_DACL_DEFAULTED = 0x0008, + SEC_DESC_SACL_PRESENT = 0x0010, + SEC_DESC_SACL_DEFAULTED = 0x0020, + SEC_DESC_DACL_TRUSTED = 0x0040, + SEC_DESC_SERVER_SECURITY = 0x0080, + SEC_DESC_DACL_AUTO_INHERIT_REQ = 0x0100, + SEC_DESC_SACL_AUTO_INHERIT_REQ = 0x0200, + SEC_DESC_DACL_AUTO_INHERITED = 0x0400, + SEC_DESC_SACL_AUTO_INHERITED = 0x0800, + SEC_DESC_DACL_PROTECTED = 0x1000, + SEC_DESC_SACL_PROTECTED = 0x2000, + SEC_DESC_RM_CONTROL_VALID = 0x4000, + SEC_DESC_SELF_RELATIVE = 0x8000 + } security_descriptor_type; + + typedef [gensize,nosize,public,flag(NDR_LITTLE_ENDIAN)] struct { + security_descriptor_revision revision; + security_descriptor_type type; /* SEC_DESC_xxxx flags */ + [relative] dom_sid *owner_sid; + [relative] dom_sid *group_sid; + [relative] security_acl *sacl; /* system ACL */ + [relative] security_acl *dacl; /* user (discretionary) ACL */ + } security_descriptor; + + typedef [public] struct { + [range(0,0x40000),value(ndr_size_security_descriptor(sd,ndr->flags))] uint32 sd_size; + [subcontext(4)] security_descriptor *sd; + } sec_desc_buf; + + /* Group attributes, used to be samr_GroupAttrs */ + typedef [public,bitmap32bit] bitmap { + SE_GROUP_MANDATORY = 0x00000001, + SE_GROUP_ENABLED_BY_DEFAULT = 0x00000002, + SE_GROUP_ENABLED = 0x00000004, + SE_GROUP_OWNER = 0x00000008, + SE_GROUP_USE_FOR_DENY_ONLY = 0x00000010, + SE_GROUP_INTEGRITY = 0x00000020, + SE_GROUP_INTEGRITY_ENABLED = 0x00000040, + SE_GROUP_RESOURCE = 0x20000000, + SE_GROUP_LOGON_ID = 0xC0000000 + } security_GroupAttrs; + + const uint32 SE_GROUP_DEFAULT_FLAGS = + SE_GROUP_MANDATORY | + SE_GROUP_ENABLED_BY_DEFAULT | + SE_GROUP_ENABLED; + + /* + * Should claims be evaluated on this token? + * + * 0 is invalid to catch a zeroed token + */ + typedef enum { + CLAIMS_EVALUATION_INVALID_STATE=0, + CLAIMS_EVALUATION_NEVER = 1, + CLAIMS_EVALUATION_ALWAYS = 2 + } claims_evaluation_control; + + /* + * This is linearised to pass authentication over the NP proxy + * from smbd to RPC servers, but is not in public network protocols + */ + typedef [public] struct { + uint32 num_sids; + [size_is(num_sids)] dom_sid sids[*]; + se_privilege privilege_mask; + lsa_SystemAccessModeFlags rights_mask; + uint32 num_local_claims; + uint32 num_user_claims; + uint32 num_device_claims; + uint32 num_device_sids; + [size_is(num_local_claims)] CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 local_claims[*]; + [size_is(num_user_claims)] CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 user_claims[*]; + [size_is(num_device_claims)] CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 device_claims[*]; + [size_is(num_device_sids)] dom_sid device_sids[*]; + + /* + * This allows us to disable claims evaluation on a + * per-token basis, allowing library code to remain + * distinct from configuration by passing this in as a + * flag here + */ + claims_evaluation_control evaluate_claims; + } security_token; + + typedef [public] struct { + security_token token; + security_descriptor sd; + uint32 access_desired; + } security_token_descriptor_fuzzing_pair; + + /* This is not yet sent over the network, but is simply defined in IDL */ + typedef [public] struct { + uid_t uid; + gid_t gid; + uint32 ngroups; + [size_is(ngroups)] gid_t groups[*]; + } security_unix_token; + + /* bits that determine which parts of a security descriptor + are being queried/set */ + typedef [public,bitmap32bit] bitmap { + SECINFO_OWNER = 0x00000001, + SECINFO_GROUP = 0x00000002, + SECINFO_DACL = 0x00000004, + SECINFO_SACL = 0x00000008, + SECINFO_LABEL = 0x00000010, + SECINFO_ATTRIBUTE = 0x00000020, + SECINFO_SCOPE = 0x00000040, + SECINFO_BACKUP = 0x00010000, + SECINFO_UNPROTECTED_SACL = 0x10000000, + SECINFO_UNPROTECTED_DACL = 0x20000000, + SECINFO_PROTECTED_SACL = 0x40000000, + SECINFO_PROTECTED_DACL = 0x80000000 + } security_secinfo; + + /* + * a SMB server should only support the following flags + * and ignore all others. + * + * See AdditionalInformation in [MS-SMB2] 2.2.37 SMB2 QUERY_INFO Request + * and 2.2.39 SMB2 SET_INFO Request. + */ + const int SMB_SUPPORTED_SECINFO_FLAGS = ( + SECINFO_OWNER | + SECINFO_GROUP | + SECINFO_DACL | + SECINFO_SACL | + SECINFO_LABEL | + SECINFO_ATTRIBUTE | + SECINFO_SCOPE | + SECINFO_BACKUP | + 0); + + /* + * See [MS-KILE] 2.2.5 LSAP_TOKEN_INFO_INTEGRITY + */ + typedef [public,gensize,flag(NDR_PAHEX)] struct { + uint32 Flags; + uint32 TokenIL; + uint8 MachineId[32]; + } LSAP_TOKEN_INFO_INTEGRITY; + + /* + * See [MS-KILE] 2.2.6 Supported Encryption Types Bit Flags + */ + typedef [public,bitmap32bit] bitmap { + KERB_ENCTYPE_DES_CBC_CRC = 0x00000001, + KERB_ENCTYPE_DES_CBC_MD5 = 0x00000002, + KERB_ENCTYPE_RC4_HMAC_MD5 = 0x00000004, + KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96 = 0x00000008, + KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96 = 0x00000010, + KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96_SK = 0x00000020, + KERB_ENCTYPE_FAST_SUPPORTED = 0x00010000, + KERB_ENCTYPE_COMPOUND_IDENTITY_SUPPORTED = 0x00020000, + KERB_ENCTYPE_CLAIMS_SUPPORTED = 0x00040000, + KERB_ENCTYPE_RESOURCE_SID_COMPRESSION_DISABLED = 0x00080000 + } kerb_EncTypes; + + typedef [public,bitmap32bit] bitmap { + SEC_DACL_AUTO_INHERIT = 0x00000001, + SEC_SACL_AUTO_INHERIT = 0x00000002, + SEC_DEFAULT_DESCRIPTOR = 0x00000004, + SEC_OWNER_FROM_PARENT = 0x00000008, + SEC_GROUP_FROM_PARENT = 0x00000010 + } security_autoinherit; + + /***************************************************************/ + /* Extended right guids */ + + const string GUID_DRS_ALLOCATE_RIDS = "1abd7cf8-0a99-11d1-adbb-00c04fd8d5cd"; + const string GUID_DRS_CHANGE_DOMAIN_MASTER = "014bf69c-7b3b-11d1-85f6-08002be74fab"; + const string GUID_DRS_CHANGE_INFR_MASTER = "cc17b1fb-33d9-11d2-97d4-00c04fd8d5cd"; + const string GUID_DRS_CHANGE_PDC = "bae50096-4752-11d1-9052-00c04fc2d4cf"; + const string GUID_DRS_CHANGE_RID_MASTER = "d58d5f36-0a98-11d1-adbb-00c04fd8d5cd"; + const string GUID_DRS_CHANGE_SCHEMA_MASTER = "e12b56b6-0a95-11d1-adbb-00c04fd8d5cd"; + const string GUID_DRS_GET_CHANGES = "1131f6aa-9c07-11d1-f79f-00c04fc2dcd2"; + const string GUID_DRS_REPL_SYNCRONIZE = "1131f6ab-9c07-11d1-f79f-00c04fc2dcd2"; + const string GUID_DRS_MANAGE_TOPOLOGY = "1131f6ac-9c07-11d1-f79f-00c04fc2dcd2"; + const string GUID_DRS_GET_ALL_CHANGES = "1131f6ad-9c07-11d1-f79f-00c04fc2dcd2"; + const string GUID_DRS_RO_REPL_SECRET_SYNC = "1131f6ae-9c07-11d1-f79f-00c04fc2dcd2"; + const string GUID_DRS_GET_FILTERED_ATTRIBUTES = "89e95b76-444d-4c62-991a-0facbeda640c"; + const string GUID_DRS_MONITOR_TOPOLOGY = "f98340fb-7c5b-4cdb-a00b-2ebdfa115a96"; + const string GUID_DRS_USER_CHANGE_PASSWORD = "ab721a53-1e2f-11d0-9819-00aa0040529b"; + const string GUID_DRS_FORCE_CHANGE_PASSWORD = "00299570-246d-11d0-a768-00aa006e0529"; + const string GUID_DRS_UPDATE_PASSWORD_NOT_REQUIRED_BIT + = "280f369c-67c7-438e-ae98-1d46f3c6f541"; + const string GUID_DRS_UNEXPIRE_PASSWORD = "ccc2dc7d-a6ad-4a7a-8846-c04e3cc53501"; + const string GUID_DRS_ENABLE_PER_USER_REVERSIBLY_ENCRYPTED_PASSWORD + = "05c74c5e-4deb-43b4-bd9f-86664c2a7fd5"; + const string GUID_DRS_DS_INSTALL_REPLICA = "9923a32a-3607-11d2-b9be-0000f87a36b2"; + const string GUID_DRS_REANIMATE_TOMBSTONE = "45ec5156-db7e-47bb-b53f-dbeb2d03c40f"; + const string GUID_DRS_ALLOWED_TO_AUTHENTICATE = "68b1d179-0d15-4D4F-ab71-46152e79a7bc"; + + /***************************************************************/ + /* validated writes guids */ + const string GUID_DRS_VALIDATE_SPN = "f3a64788-5306-11d1-a9c5-0000f80367c1"; + const string GUID_DRS_SELF_MEMBERSHIP = "bf9679c0-0de6-11d0-a285-00aa003049e2"; + const string GUID_DRS_DNS_HOST_NAME = "72e39547-7b18-11d1-adef-00c04fd8d5cd"; + const string GUID_DRS_ADD_DNS_HOST_NAME = "80863791-dbe9-4eb8-837e-7f0ab55d9ac7"; + const string GUID_DRS_BEHAVIOR_VERSION = "d31a8757-2447-4545-8081-3bb610cacbf2"; + + /* A type to describe the mapping of generic access rights to object + specific access rights. */ + + typedef struct { + uint32 generic_read; + uint32 generic_write; + uint32 generic_execute; + uint32 generic_all; + } generic_mapping; + + typedef struct { + uint32 std_read; + uint32 std_write; + uint32 std_execute; + uint32 std_all; + } standard_mapping; +} diff --git a/librpc/idl/server_id.idl b/librpc/idl/server_id.idl new file mode 100644 index 0000000..8ebffc5 --- /dev/null +++ b/librpc/idl/server_id.idl @@ -0,0 +1,36 @@ +[ + pointer_default(unique) +] +interface server_id +{ + + /* + * Virtual Node Numbers are identifying a node within a cluster. + * Ctdbd sets this, we retrieve our vnn from it. + */ + + const uint32 NONCLUSTER_VNN = 0xFFFFFFFF; + + /** Don't verify this unique id */ + const hyper SERVERID_UNIQUE_ID_NOT_TO_VERIFY = 0xFFFFFFFFFFFFFFFFULL; + + /* used to look like the following, note that unique_id was not + * marshalled at all... + + struct server_id { + pid_t pid; + #ifdef CLUSTER_SUPPORT + uint32 vnn; + #endif + uint64_t unique_id; + }; + + */ + + typedef [public] struct { + hyper pid; + uint32 task_id; + uint32 vnn; + hyper unique_id; + } server_id; +} diff --git a/librpc/idl/smb2_lease_struct.idl b/librpc/idl/smb2_lease_struct.idl new file mode 100644 index 0000000..5ccd8a3 --- /dev/null +++ b/librpc/idl/smb2_lease_struct.idl @@ -0,0 +1,34 @@ +#include "idl_types.h" + +/* + miscellaneous IDL structures +*/ + +[ + pointer_default(unique) +] +interface smb2_lease_struct +{ + /* + * SMB2 lease structure (per MS-SMB2 2.2.13) + */ + typedef [public] struct { + hyper data[2]; + } smb2_lease_key; + + typedef [public,bitmap32bit] bitmap { + SMB2_LEASE_READ = 0x01, + SMB2_LEASE_HANDLE = 0x02, + SMB2_LEASE_WRITE = 0x04 + } smb2_lease_state; + + typedef [public] struct { + smb2_lease_key lease_key; + smb2_lease_state lease_state; + uint32 lease_flags; + hyper lease_duration; /* should be 0 */ + smb2_lease_key parent_lease_key; + uint16 lease_version; + uint16 lease_epoch; + } smb2_lease; +};
\ No newline at end of file diff --git a/librpc/idl/smb3posix.idl b/librpc/idl/smb3posix.idl new file mode 100644 index 0000000..e759229 --- /dev/null +++ b/librpc/idl/smb3posix.idl @@ -0,0 +1,36 @@ +#include "idl_types.h" + +/* + IDL for smb311 unix structures +*/ + +import "security.idl"; + +[ + version(0.0), + pointer_default(unique) +] +interface smb3posix +{ + typedef [public,flag(NDR_NOALIGN)] struct { + uint32 nlinks; + uint32 reparse_tag; + uint32 posix_perms; + dom_sid owner; + dom_sid group; + } smb3_posix_cc_info; + + typedef [public,flag(NDR_NOALIGN)] struct { + NTTIME creation_time; + NTTIME last_access_time; + NTTIME last_write_time; + NTTIME change_time; + hyper end_of_file; + hyper allocation_size; + uint32 file_attributes; + hyper inode; + uint32 device; + uint32 reserved; + smb3_posix_cc_info cc; + } smb3_file_posix_information; +} diff --git a/librpc/idl/smb_acl.idl b/librpc/idl/smb_acl.idl new file mode 100644 index 0000000..a1532ac --- /dev/null +++ b/librpc/idl/smb_acl.idl @@ -0,0 +1,96 @@ +/* + Unix SMB/CIFS implementation. + Portable SMB ACL interface + Copyright (C) Jeremy Allison 2000 + Copyright (C) Andrew Bartlett 2012 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + + +/* + * Allow the smb_acl interface to be pushed into an NDR blob and + * read/written in python. + * + * The exact layout of these structures is CRITICAL, as a SHA-256 hash is + * taken over these after they are pushed as NDR blobs, and stored in an + * xattr for ACL verification. + */ +[ + pointer_default(unique) +] +interface smb_acl +{ + + const int SMB_ACL_READ = 4; + const int SMB_ACL_WRITE = 2; + const int SMB_ACL_EXECUTE = 1; + + /* Types of ACLs. */ + typedef enum { + SMB_ACL_TAG_INVALID = 0, + SMB_ACL_USER = 1, + SMB_ACL_USER_OBJ = 2, + SMB_ACL_GROUP = 3, + SMB_ACL_GROUP_OBJ = 4, + SMB_ACL_OTHER = 5, + SMB_ACL_MASK = 6 + } smb_acl_tag_t; + + typedef struct { + uid_t uid; + } smb_acl_user; + + typedef struct { + gid_t gid; + } smb_acl_group; + + typedef [switch_type(uint16)] union { + [case (SMB_ACL_USER)] smb_acl_user user; + [case (SMB_ACL_USER_OBJ)]; + [case (SMB_ACL_GROUP)] smb_acl_group group; + [case (SMB_ACL_GROUP_OBJ)]; + [case (SMB_ACL_OTHER)]; + [case (SMB_ACL_MASK)]; + } smb_acl_entry_info; + + typedef struct { + smb_acl_tag_t a_type; + [switch_is(a_type)] smb_acl_entry_info info; + mode_t a_perm; + } smb_acl_entry; + + [public] typedef struct { + int count; + [value(0)] int next; + [size_is(count)] smb_acl_entry acl[*]; + } smb_acl_t; + + const int SMB_ACL_FIRST_ENTRY = 0; + const int SMB_ACL_NEXT_ENTRY = 1; + + const int SMB_ACL_TYPE_ACCESS = 0; + const int SMB_ACL_TYPE_DEFAULT = 1; + + /* A wrapper of all the information required to reproduce an + * ACL, so we can hash it for the acl_xattr and acl_tdb + * modules */ + [public] typedef struct { + smb_acl_t *access_acl; + smb_acl_t *default_acl; /* NULL on files */ + uid_t owner; + gid_t group; + mode_t mode; + } smb_acl_wrapper; +} diff --git a/librpc/idl/spoolss.idl b/librpc/idl/spoolss.idl new file mode 100644 index 0000000..8160587 --- /dev/null +++ b/librpc/idl/spoolss.idl @@ -0,0 +1,3566 @@ +#include "idl_types.h" + +/* + spoolss interface definitions +*/ +import "misc.idl", "security.idl", "winreg.idl"; + + +cpp_quote("#define spoolss_security_descriptor security_descriptor") + +[ uuid("12345678-1234-abcd-ef00-0123456789ab"), + version(1.0), + endpoint("ncacn_np:[\\pipe\\spoolss]", "ncalrpc:"), + pointer_default(unique), + helpstring("Spooler SubSystem"), + helper("../librpc/ndr/ndr_spoolss_buf.h") +] interface spoolss +{ + typedef [v1_enum] enum winreg_Type winreg_Type; + typedef [gensize,noprint] struct { + uint16 year; + uint16 month; + uint16 day_of_week; + uint16 day; + uint16 hour; + uint16 minute; + uint16 second; + uint16 millisecond; + } spoolss_Time; + + typedef [public] struct { + [value(ndr_size_spoolss_Time(time, ndr->flags))] uint32 size; + [unique] spoolss_Time *time; + } spoolss_TimeCtr; + + typedef enum { + PROCESSOR_ARCHITECTURE_INTEL = 0x0000, + PROCESSOR_ARCHITECTURE_MIPS = 0x0001, + PROCESSOR_ARCHITECTURE_ALPHA = 0x0002, + PROCESSOR_ARCHITECTURE_PPC = 0x0003, + PROCESSOR_ARCHITECTURE_SHX = 0x0004, + PROCESSOR_ARCHITECTURE_ARM = 0x0005, + PROCESSOR_ARCHITECTURE_IA64 = 0x0006, + PROCESSOR_ARCHITECTURE_ALPHA64 = 0x0007, + PROCESSOR_ARCHITECTURE_MSIL = 0x0008, + PROCESSOR_ARCHITECTURE_AMD64 = 0x0009, + PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 = 0x000A, /* 10 */ + PROCESSOR_ARCHITECTURE_NEUTRAL = 0x000B, /* 11 */ + PROCESSOR_ARCHITECTURE_ARM64 = 0x000C, /* 12 */ + PROCESSOR_ARCHITECTURE_ARM32_ON_WIN64 = 0x000D, /* 13 */ + PROCESSOR_ARCHITECTURE_IA32_ON_ARM64 = 0x000E, /* 14 */ + PROCESSOR_ARCHITECTURE_UNKNOWN = 0xFFFF + } spoolss_ProcessorArchitecture; + + typedef [v1_enum] enum { + PROCESSOR_INTEL_386 = 0x00000182, /* 386 */ + PROCESSOR_INTEL_486 = 0x000001E6, /* 486 */ + PROCESSOR_INTEL_PENTIUM = 0x0000024A, /* 586 */ + PROCESSOR_INTEL_860 = 0x0000035C, /* 860 */ + PROCESSOR_INTEL_IA64 = 0x00000898, /* 2200 */ + PROCESSOR_AMD_X8664 = 0x000021D8, /* 8664 */ + PROCESSOR_MIPS_R2000 = 0x000007D0, /* 2000 */ + PROCESSOR_MIPS_R3000 = 0x00000BB8, /* 3000 */ + PROCESSOR_ALPHA_21064 = 0x00005248, /* 21064 */ + PROCESSOR_PPC_601 = 0x00000259, /* 601 */ + PROCESSOR_PPC_603 = 0x0000025B, /* 603 */ + PROCESSOR_PPC_604 = 0x0000025C, /* 604 */ + PROCESSOR_PPC_620 = 0x0000026C, /* 620 */ + PROCESSOR_HITACHI_SH3 = 0x00002713, /* 10003 */ + PROCESSOR_HITACHI_SH3E = 0x00002714, /* 10004 */ + PROCESSOR_HITACHI_SH4 = 0x00002715, /* 10005 */ + PROCESSOR_MOTOROLA_821 = 0x00000335, /* 821 */ + PROCESSOR_STRONGARM = 0x00000A11, /* 2577 */ + PROCESSOR_ARM720 = 0x00000720, /* 1824 */ + PROCESSOR_ARM820 = 0x00000820, /* 2080 */ + PROCESSOR_ARM920 = 0x00000920, /* 2336 */ + PROCESSOR_ARM_7TDMI = 0x00011171, /* 70001 */ + PROCESSOR_OPTIL = 0x0000494F /* 18767 */ + } spoolss_ProcessorType; + + typedef [v1_enum] enum { + /* Windows 95, Windows 98, Windows Me, Windows NT4 */ + SPOOLSS_MAJOR_VERSION_NT4_95_98_ME = 0x00000004, + /* Windows 2000, Windows 2003, Windows XP */ + SPOOLSS_MAJOR_VERSION_2000_2003_XP = 0x00000005, + /* Windows Vista, Windows 2008 */ + SPOOLSS_MAJOR_VERSION_2008_VISTA = 0x00000006 + } spoolss_MajorVersion; + + typedef [v1_enum] enum { + /* Windows 2008, Windows Vista, Windows 2000, Windows NT4, Windows 95 */ + SPOOLSS_MINOR_VERSION_0 = 0x00000000, + /* Windows XP */ + SPOOLSS_MINOR_VERSION_XP = 0x00000001, + /* Windows 2003, Windows XP x64 */ + SPOOLSS_MINOR_VERSION_2003_XP64 = 0x00000002, + /* Windows 98 */ + SPOOLSS_MINOR_VERSION_98 = 0x0000000a, + /* Windows Me */ + SPOOLSS_MINOR_VERSION_ME = 0x0000005a + } spoolss_MinorVersion; + + const int PRINTER_STATUS_OK = 0x00000000; + + typedef [public] bitmap { + PRINTER_STATUS_PAUSED = 0x00000001, + PRINTER_STATUS_ERROR = 0x00000002, + PRINTER_STATUS_PENDING_DELETION = 0x00000004, + PRINTER_STATUS_PAPER_JAM = 0x00000008, + PRINTER_STATUS_PAPER_OUT = 0x00000010, + PRINTER_STATUS_MANUAL_FEED = 0x00000020, + PRINTER_STATUS_PAPER_PROBLEM = 0x00000040, + PRINTER_STATUS_OFFLINE = 0x00000080, + PRINTER_STATUS_IO_ACTIVE = 0x00000100, + PRINTER_STATUS_BUSY = 0x00000200, + PRINTER_STATUS_PRINTING = 0x00000400, + PRINTER_STATUS_OUTPUT_BIN_FULL = 0x00000800, + PRINTER_STATUS_NOT_AVAILABLE = 0x00001000, + PRINTER_STATUS_WAITING = 0x00002000, + PRINTER_STATUS_PROCESSING = 0x00004000, + PRINTER_STATUS_INITIALIZING = 0x00008000, + PRINTER_STATUS_WARMING_UP = 0x00010000, + PRINTER_STATUS_TONER_LOW = 0x00020000, + PRINTER_STATUS_NO_TONER = 0x00040000, + PRINTER_STATUS_PAGE_PUNT = 0x00080000, + PRINTER_STATUS_USER_INTERVENTION= 0x00100000, + PRINTER_STATUS_OUT_OF_MEMORY = 0x00200000, + PRINTER_STATUS_DOOR_OPEN = 0x00400000, + PRINTER_STATUS_SERVER_UNKNOWN = 0x00800000, + PRINTER_STATUS_POWER_SAVE = 0x01000000 + } spoolss_PrinterStatus; + + /* JOB status codes. */ + + const int JOB_STATUS_QUEUED = 0x0000; + + typedef [bitmap32bit] bitmap { + JOB_STATUS_PAUSED = 0x00000001, + JOB_STATUS_ERROR = 0x00000002, + JOB_STATUS_DELETING = 0x00000004, + JOB_STATUS_SPOOLING = 0x00000008, + JOB_STATUS_PRINTING = 0x00000010, + JOB_STATUS_OFFLINE = 0x00000020, + JOB_STATUS_PAPEROUT = 0x00000040, + JOB_STATUS_PRINTED = 0x00000080, + JOB_STATUS_DELETED = 0x00000100, + JOB_STATUS_BLOCKED_DEVQ = 0x00000200, + JOB_STATUS_USER_INTERVENTION = 0x00000400, + JOB_STATUS_RESTART = 0x00000800, + JOB_STATUS_COMPLETE = 0x00001000 + } spoolss_JobStatus; + + typedef [v1_enum] enum { + SPOOLSS_DEBUGGING_BUILD = 0x00000000, + SPOOLSS_RELEASE_BUILD = 0x00000001 + } spoolss_Build; + + typedef [public,gensize] struct { + [relative] nstring *printername; + [relative] nstring *servername; + uint32 cjobs; + uint32 total_jobs; + uint32 total_bytes; + spoolss_Time time; + uint32 global_counter; + uint32 total_pages; + uint32 version; + spoolss_Build free_build; + uint32 spooling; + uint32 max_spooling; + uint32 session_counter; + uint32 num_error_out_of_paper; + uint32 num_error_not_ready; + spoolss_JobStatus job_error; + uint32 number_of_processors; + spoolss_ProcessorType processor_type; + uint32 high_part_total_bytes; + uint32 change_id; + WERROR last_error; + spoolss_PrinterStatus status; + uint32 enumerate_network_printers; + uint32 c_setprinter; + spoolss_ProcessorArchitecture processor_architecture; + uint16 processor_level; + uint32 ref_ic; + uint32 reserved2; + uint32 reserved3; + } spoolss_PrinterInfo0; + + /* Device Mode Extra Data */ + + typedef [v1_enum] enum { + SPOOLSS_DM_SIGNATURE_UNIDRVEXTRA = 0x554e4944, /* 0x44494e55 */ + SPOOLSS_DM_SIGNATURE_JTEXP = 0x4a544d53, /* 0x534d544a */ + SPOOLSS_DM_SIGNATURE_PSEXTRA = 0x50524956 /* 0x56495250 */ + } spoolss_DM_Signature; + + typedef [v1_enum] enum { + SPOOLSS_DM_LAYOUT_NUP_DISABLED = 0x00000000, + SPOOLSS_DM_LAYOUT_NUP_2 = 0x00000001, + SPOOLSS_DM_LAYOUT_NUP_4 = 0x00000002, + SPOOLSS_DM_LAYOUT_NUP_6 = 0x00000003, + SPOOLSS_DM_LAYOUT_NUP_9 = 0x00000004, + SPOOLSS_DM_LAYOUT_NUP_16 = 0x00000005, + SPOOLSS_DM_LAYOUT_BOOKLET = 0x00000006 + } spoolss_DM_Layout; + + typedef [v1_enum] enum { + SPOOLSS_DM_NUP_DIRECTION_L2R_T2B = 0x00000001, + SPOOLSS_DM_NUP_DIRECTION_T2B_L2R = 0x00000002, + SPOOLSS_DM_NUP_DIRECTION_R2L_T2B = 0x00000004, + SPOOLSS_DM_NUP_DIRECTION_T2B_R2L = 0x00000008 + } spoolss_DM_NupDirection; + + typedef [v1_enum] enum { + SPOOLSS_DM_NUP_BORDER_PRINT = 0x00000000, + SPOOLSS_DM_NUP_BORDER_NONE = 0x00000001 + } spoolss_DM_NupBorderFlags; + + typedef [v1_enum] enum { + SPOOLSS_DM_BOOKLET_LEFT_FLIP = 0x00000000, + SPOOLSS_DM_BOOKLET_RIGHT_FLIP = 0x00000001 + } spoolss_DM_BookletFlags; + + /* Device Mode Extra Data: PostScript */ + + /* NT 3.51 */ + + typedef [bitmap32bit] bitmap { + SPOOLSS_DM_PS_FLAGS_DRV_ERROR_HANDLER = 0x00000002, + SPOOLSS_DM_PS_FLAGS_PRINT_MIRROR = 0x00000004, + SPOOLSS_DM_PS_FLAGS_PRINT_NEGATIVE = 0x00000010, + SPOOLSS_DM_PS_FLAGS_COMPRESS_BITMAP = 0x00000040, + SPOOLSS_DM_PS_FLAGS_ROTATE_180 = 0x00000200, + SPOOLSS_DM_PS_FLAGS_GDI_METAFILE_SPOOL = 0x00002000 + } spoolss_DMPS_Flags; + + typedef struct { + [value(SPOOLSS_DM_SIGNATURE_PSEXTRA)] spoolss_DM_Signature dwSignature; + spoolss_DMPS_Flags dwFlags; + uint32 wchEPSFile[12]; + [value(24)] uint16 caSize; + uint16 caFlags; + uint16 caIlluminantIndex; + uint16 caRedGamma; + uint16 caGreenGamma; + uint16 caBlueGamma; + uint16 caReferenceBlack; + uint16 caReferenceWhite; + uint16 caContrast; + uint16 caBrightness; + uint16 caColorfulness; + uint16 caRedGreenTint; + } spoolss_PSDRVEXTRA351; + + /* NT 4.0 */ + + typedef struct { + [value(SPOOLSS_DM_SIGNATURE_PSEXTRA)] spoolss_DM_Signature dwSignature; + spoolss_DMPS_Flags dwFlags; + uint32 wchEPSFile[12]; + [value(24)] uint16 caSize; + uint16 caFlags; + uint16 caIlluminantIndex; + uint16 caRedGamma; + uint16 caGreenGamma; + uint16 caBlueGamma; + uint16 caReferenceBlack; + uint16 caReferenceWhite; + uint16 caContrast; + uint16 caBrightness; + uint16 caColorfulness; + uint16 caRedGreenTint; + uint16 wChecksum; + uint16 wOptions; + uint32 aubOptions[8]; + } spoolss_PSDRVEXTRA400; + + /* 2000 & XP */ + + typedef [v1_enum] enum { + SPOOLSS_DM_PS_OPTIMIZE_SPEED = 0x00000000, + SPOOLSS_DM_PS_OPTIMIZE_PORTABILITY = 0x00000001, + SPOOLSS_DM_PS_OPTIMIZE_EPS = 0x00000002, + SPOOLSS_DM_PS_OPTIMIZE_ARCHIVAL = 0x00000003 + } spoolss_DMPS_Dialect; + + typedef [v1_enum] enum { + SPOOLSS_DM_PS_TTDLFMT_DEFAULT = 0x00000000, + SPOOLSS_DM_PS_TTDLFMT_TYPE_1 = 0x00000001, + SPOOLSS_DM_PS_TTDLFMT_TYPE_3 = 0x00000002, + SPOOLSS_DM_PS_TTDLFMT_TYPE_42 = 0x00000003 + } spoolss_DMPS_TTDLFmt; + + typedef [v1_enum] enum { + SPOOLSS_DM_PS_PSLEVEL_1 = 0x00000001, + SPOOLSS_DM_PS_PSLEVEL_2 = 0x00000002, + SPOOLSS_DM_PS_PSLEVEL_3 = 0x00000003 + } spoolss_DMPS_PSLevel; + + typedef enum { + SPOOLSS_DM_PS_FEED_DIRECTION_LONG_EDGE_FIRST = 0x0000, + SPOOLSS_DM_PS_FEED_DIRECTION_SHORT_EDGE_FIRST = 0x0001, + SPOOLSS_DM_PS_FEED_DIRECTION_LONG_EDGE_FIRST_UPSIDEDOWN = 0x0002, + SPOOLSS_DM_PS_FEED_DIRECTION_SHORT_EDGE_FIRST_UPSIDEDOWN= 0x0003 + } spoolss_DMPS_FeedDirection; + + typedef struct { + [value(SPOOLSS_DM_SIGNATURE_PSEXTRA)] spoolss_DM_Signature dwSignature; + spoolss_DMPS_Flags dwFlags; + uint32 wchEPSFile[12]; + [value(24)] uint16 caSize; + uint16 caFlags; + uint16 caIlluminantIndex; + uint16 caRedGamma; + uint16 caGreenGamma; + uint16 caBlueGamma; + uint16 caReferenceBlack; + uint16 caReferenceWhite; + uint16 caContrast; + uint16 caBrightness; + uint16 caColorfulness; + uint16 caRedGreenTint; + uint16 wReserved1; + uint16 wSize; + uint32 fxScrFreq; + uint32 fxScrAngle; + spoolss_DMPS_Dialect iDialect; + spoolss_DMPS_TTDLFmt iTTDLFmt; + boolean32 bReversePrint; + spoolss_DM_Layout iLayout; + spoolss_DMPS_PSLevel iPSLevel; + uint32 dwReserved2; + uint16 wOEMExtra; + [value(0x0010)] uint16 wVer; + uint32 dwX; + uint32 dwY; + uint32 dwWidthOffset; + uint32 dwHeightOffset; + spoolss_DMPS_FeedDirection wFeedDirection; + uint16 wCutSheet; + uint32 dwReserved3[4]; + uint32 dwChecksum32; + uint32 dwOptions; + uint32 aOptions[128]; + } spoolss_PSDRVEXTRA500; + + /* Vista, 2008, 7 */ + + typedef struct { + [value(SPOOLSS_DM_SIGNATURE_PSEXTRA)] spoolss_DM_Signature dwSignature; + spoolss_DMPS_Flags dwFlags; + uint32 wchEPSFile[12]; + [value(24)] uint16 caSize; + uint16 caFlags; + uint16 caIlluminantIndex; + uint16 caRedGamma; + uint16 caGreenGamma; + uint16 caBlueGamma; + uint16 caReferenceBlack; + uint16 caReferenceWhite; + uint16 caContrast; + uint16 caBrightness; + uint16 caColorfulness; + uint16 caRedGreenTint; + uint16 wCoreJTExpSize; + [value(ndr_size_spoolss_PSDRVEXTRA(r, ndr->flags) + wCoreJTExpSize)] uint16 wCoreFullSize; + uint32 fxScrFreq; + uint32 fxScrAngle; + spoolss_DMPS_Dialect iDialect; + spoolss_DMPS_TTDLFmt iTTDLFmt; + boolean32 bReversePrint; + spoolss_DM_Layout iLayout; + spoolss_DMPS_PSLevel iPSLevel; + uint32 dwReserved2; + uint16 wOEMExtra; + [value(0x0010)] uint16 wVer; + uint32 dwX; + uint32 dwY; + uint32 dwWidthOffset; + uint32 dwHeightOffset; + spoolss_DMPS_FeedDirection wFeedDirection; + uint16 wCutSheet; + uint32 dwReserved3[4]; + uint32 dwChecksum32; + uint32 dwOptions; + uint32 aOptions[128]; + spoolss_DM_NupDirection dwNupDirection; + spoolss_DM_NupBorderFlags dwNupBorderFlags; + spoolss_DM_BookletFlags dwBookletFlags; + uint32 dwPadding; + } spoolss_PSDRVEXTRA; + + /* Device Mode Extra Data: UniDriver */ + + /* NT 3.5, NT 4.0 */ + + typedef struct { + uint16 wReserved[56]; + } spoolss_UNIDRVEXTRA3_4; + + /* 2000, XP */ + + typedef [v1_enum] enum { + SPOOLSS_DM_UNI_QUALITY_BEST = 0x00000000, + SPOOLSS_DM_UNI_QUALITY_MEDIUM = 0x00000001, + SPOOLSS_DM_UNI_QUALITY_DRAFT = 0x00000002 + } spoolss_DMUNI_Quality; + + typedef [bitmap32bit] bitmap { + SPOOLSS_DM_UNI_FLAGS_PRINT_TEXT_AS_GRAPHICS = 0x00000002, + SPOOLSS_DM_UNI_FLAGS_AVOID_EMFSPOOL = 0x00000010, + SPOOLSS_DM_UNI_FLAGS_CUSTOM_HALFTONING = 0x00000080 + } spoolss_DMUNI_Flags; + + typedef struct { + [value(SPOOLSS_DM_SIGNATURE_UNIDRVEXTRA)] spoolss_DM_Signature dwSignature; + [value(0x0022)] uint16 wVer; + uint16 sPadding; + uint16 wSize; + uint16 wOEMExtra; + uint32 dwChecksum32; + spoolss_DMUNI_Flags dwFlags; + boolean32 bReversePrint; + spoolss_DM_Layout iLayout; + spoolss_DMUNI_Quality iQuality; + uint16 wReserved[6]; + uint32 dwOptions; + uint32 aOptions[128]; + } spoolss_UNIDRVEXTRA500; + + /* Vista, 2008, 7 */ + + typedef [public,gensize] struct { + [value(SPOOLSS_DM_SIGNATURE_UNIDRVEXTRA)] spoolss_DM_Signature dwSignature; + [value(0x0022)] uint16 wVer; + uint16 wCoreJTExpSize; + [value(ndr_size_spoolss_UNIDRVEXTRA(r, ndr->flags) + wCoreJTExpSize)] uint16 wCoreFullSize; + uint16 wOEMExtra; + uint32 dwChecksum32; + spoolss_DMUNI_Flags dwFlags; + boolean32 bReversePrint; + spoolss_DM_Layout iLayout; + spoolss_DMUNI_Quality iQuality; + uint16 wReserved[6]; + uint32 dwOptions; + uint32 aOptions[128]; + spoolss_DM_NupDirection dwNupDirection; + spoolss_DM_NupBorderFlags dwNupBorderFlags; + spoolss_DM_BookletFlags dwBookletFlags; + } spoolss_UNIDRVEXTRA; + + /* Device Mode Extra Data: JTEXP */ + + typedef struct { + uint32 dwSize; + [value(SPOOLSS_DM_SIGNATURE_JTEXP)] spoolss_DM_Signature dwSignature; + [value(0)] uint32 dwVersion; + [value(16)] uint16 wJTHdrSize; + uint16 wCoreMFOSize; /* must be sizeof the two following elements, must be dwSize - 16*/ + nstring ModelName; + [flag(STR_UTF8|STR_NULLTERM|NDR_REMAINING)] string_array FeatureOptionPairs; + } spoolss_JTEXP; + + /* Device Mode Extra Data: OEM_DMEXTRA */ + + typedef struct { + uint32 dwSize; + spoolss_DM_Signature dwSignature; + uint32 dwVersion; + [flag(NDR_REMAINING)] DATA_BLOB Data; + } spoolss_OEM_DMEXTRA; + + typedef [nodiscriminant] union { + [case(0x0350)] spoolss_PSDRVEXTRA351 psdrvextra351; + [case(0x0400)] spoolss_PSDRVEXTRA400 psdrvextra400; + [case(0x0501)] spoolss_PSDRVEXTRA500 psdrvextra500; + [case(0x0600)] spoolss_PSDRVEXTRA psdrvextra; + [default] [flag(NDR_REMAINING)] DATA_BLOB psblob; + } spoolss_DeviceModeExtraDataPostScript; + + typedef [nodiscriminant] union { + [case(0x0301)] spoolss_UNIDRVEXTRA3_4 unidrvextra3_4; + [case(0x0500)] spoolss_UNIDRVEXTRA500 unidrvextra500; + [case(0x0600)] spoolss_UNIDRVEXTRA unidrvextra; + [default] [flag(NDR_REMAINING)] DATA_BLOB uniblob; + } spoolss_DeviceModeExtraDataUniDriver; + + typedef [bitmap32bit] bitmap { + DEVMODE_ORIENTATION = 0x00000001, + DEVMODE_PAPERSIZE = 0x00000002, + DEVMODE_PAPERLENGTH = 0x00000004, + DEVMODE_PAPERWIDTH = 0x00000008, + DEVMODE_SCALE = 0x00000010, + DEVMODE_POSITION = 0x00000020, + DEVMODE_NUP = 0x00000040, + DEVMODE_COPIES = 0x00000100, + DEVMODE_DEFAULTSOURCE = 0x00000200, + DEVMODE_PRINTQUALITY = 0x00000400, + DEVMODE_COLOR = 0x00000800, + DEVMODE_DUPLEX = 0x00001000, + DEVMODE_YRESOLUTION = 0x00002000, + DEVMODE_TTOPTION = 0x00004000, + DEVMODE_COLLATE = 0x00008000, + DEVMODE_FORMNAME = 0x00010000, + DEVMODE_LOGPIXELS = 0x00020000, + DEVMODE_BITSPERPEL = 0x00040000, + DEVMODE_PELSWIDTH = 0x00080000, + DEVMODE_PELSHEIGHT = 0x00100000, + DEVMODE_DISPLAYFLAGS = 0x00200000, + DEVMODE_DISPLAYFREQUENCY = 0x00400000, + DEVMODE_ICMMETHOD = 0x00800000, + DEVMODE_ICMINTENT = 0x01000000, + DEVMODE_MEDIATYPE = 0x02000000, + DEVMODE_DITHERTYPE = 0x04000000, + DEVMODE_PANNINGWIDTH = 0x08000000, + DEVMODE_PANNINGHEIGHT = 0x10000000 + } spoolss_DeviceModeFields; + + typedef [enum16bit] enum { + DMSPEC_NT3 = 0x320, + DMSPEC_WIN95_98_ME = 0x400, + DMSPEC_NT4_AND_ABOVE = 0x401 + } spoolss_DeviceModeSpecVersion; + + typedef [enum16bit] enum { + DMORIENT_PORTRAIT = 0x0001, + DMORIENT_LANDSCAPE = 0x0002 + } spoolss_DeviceModeOrientation; + + typedef [enum16bit] enum { + DMPAPER_LETTER = 0x0001, /* Letter, 8 1/2 x 11 inches */ + DMPAPER_LETTERSMALL = 0x0002, /* Letter Small, 8 1/2 x 11 inches */ + DMPAPER_TABLOID = 0x0003, /* Tabloid, 11 x 17 inches */ + DMPAPER_LEDGER = 0x0004, /* Ledger, 17 x 11 inches */ + DMPAPER_LEGAL = 0x0005, /* Legal, 8 1/2 x 14 inches */ + DMPAPER_STATEMENT = 0x0006, /* Statement, 5 1/2 x 8 1/2 inches */ + DMPAPER_EXECUTIVE = 0x0007, /* Executive, 7 1/4 x 10 1/2 inches */ + DMPAPER_A3 = 0x0008, /* A3 sheet, 297 x 420 millimeters */ + DMPAPER_A4 = 0x0009, /* A4 sheet, 210 x 297 millimeters */ + DMPAPER_A4SMALL = 0x000A, /* A4 small sheet, 210 x 297 millimeters */ + DMPAPER_A5 = 0x000B, /* A5 sheet, 148 x 210 millimeters */ + DMPAPER_B4 = 0x000C, /* B4 sheet, 250 x 354 millimeters */ + DMPAPER_B5 = 0x000D, /* B5 sheet, 182 x 257-millimeter paper */ + DMPAPER_FOLIO = 0x000E, /* Folio, 8 1/2 x 13-inch paper */ + DMPAPER_QUARTO = 0x000F, /* Quarto, 215 x 275 millimeter paper */ + DMPAPER_10X14 = 0x0010, /* 10 x 14-inch sheet */ + DMPAPER_11X17 = 0x0011, /* 11 x 17-inch sheet */ + DMPAPER_NOTE = 0x0012, /* Note, 8 1/2 x 11-inches */ + DMPAPER_ENV_9 = 0x0013, /* #9 Envelope, 3 7/8 x 8 7/8 inches */ + DMPAPER_ENV_10 = 0x0014, /* #10 Envelope, 4 1/8 x 9 1/2 inches */ + DMPAPER_ENV_11 = 0x0015, /* #11 Envelope, 4 1/2 x 10 3/8 inches */ + DMPAPER_ENV_12 = 0x0016, /* #12 Envelope, 4 3/4 x 11 inches */ + DMPAPER_ENV_14 = 0x0017, /* #14 Envelope, 5 x 11 1/2 inches */ + DMPAPER_CSHEET = 0x0018, /* C Sheet, 17 x 22 inches */ + DMPAPER_DSHEET = 0x0019, /* D Sheet, 22 x 34 inches */ + DMPAPER_ESHEET = 0x001A, /* E Sheet, 34 x 44 inches */ + DMPAPER_ENV_DL = 0x001B, /* DL Envelope, 110 x 220 millimeters */ + DMPAPER_ENV_C5 = 0x001C, /* C5 Envelope, 162 x 229 millimeters */ + DMPAPER_ENV_C3 = 0x001D, /* C3 Envelope, 324 x 458 millimeters */ + DMPAPER_ENV_C4 = 0x001E, /* C4 Envelope, 229 x 324 millimeters */ + DMPAPER_ENV_C6 = 0x001F, /* C6 Envelope, 114 x 162 millimeters */ + DMPAPER_ENV_C65 = 0x0020, /* C65 Envelope, 114 x 229 millimeters */ + DMPAPER_ENV_B4 = 0x0021, /* B4 Envelope, 250 x 353 millimeters */ + DMPAPER_ENV_B5 = 0x0022, /* B5 Envelope, 176 x 250 millimeters */ + DMPAPER_ENV_B6 = 0x0023, /* B6 Envelope, 176 x 125 millimeters */ + DMPAPER_ENV_ITALY = 0x0024, /* Italy Envelope, 110 x 230 millimeters */ + DMPAPER_ENV_MONARCH = 0x0025, /* Monarch Envelope, 3 7/8 x 7 1/2 inches */ + DMPAPER_ENV_PERSONAL = 0x0026, /* 6 3/4 Envelope, 3 5/8 x 6 1/2 inches */ + DMPAPER_FANFOLD_US = 0x0027, /* US Std Fanfold, 14 7/8 x 11 inches */ + DMPAPER_FANFOLD_STD_GERMAN = 0x0028, /* German Std Fanfold, 8 1/2 x 12 inches */ + DMPAPER_FANFOLD_LGL_GERMAN = 0x0029, /* German Legal Fanfold, 8 x 13 inches */ + DMPAPER_DBL_JAPANESE_POSTCARD = 0x0045, /* Double Japanese Postcard, 200 x 148 millimeters */ + DMPAPER_A6 = 0x0046, /* A6 sheet, 105 x 148 millimeters */ + DMPAPER_JENV_KAKU2 = 0x0047, /* Japanese Envelope Kaku #2 */ + DMPAPER_JENV_KAKU3 = 0x0048, /* Japanese Envelope Kaku #3 */ + DMPAPER_JENV_CHOU3 = 0x0049, /* Japanese Envelope Chou #3 */ + DMPAPER_JENV_CHOU4 = 0x004A, /* Japanese Envelope Chou #4 */ + DMPAPER_LETTER_ROTATED = 0x004B, /* Letter Rotated, 11 by 8 1/2 inches */ + DMPAPER_A3_ROTATED = 0x004C, /* A3 rotated sheet, 420 x 297 millimeters */ + DMPAPER_A4_ROTATED = 0x004D, /* A4 rotated sheet, 297 x 210 millimeters */ + DMPAPER_A5_ROTATED = 0x004E, /* A5 rotated sheet, 210 x 148 millimeters */ + DMPAPER_B4_JIS_ROTATED = 0x004F, /* B4 (JIS) rotated sheet, 364 x 257 millimeters */ + DMPAPER_B5_JIS_ROTATED = 0x0050, /* B5 (JIS) rotated sheet, 257 x 182 millimeters */ + DMPAPER_JAPANESE_POSTCARD_ROTATED = 0x0051, /* Japanese Postcard Rotated, 148 x 100 millimeters */ + DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED = 0x0052, /* Double Japanese Postcard Rotated, 148 x 200 millimeters */ + DMPAPER_A6_ROTATED = 0x0053, /* A6 rotated sheet, 148 x 105 millimeters */ + DMPAPER_JENV_KAKU2_ROTATED = 0x0054, /* Japanese Envelope Kaku #2 Rotated */ + DMPAPER_JENV_KAKU3_ROTATED = 0x0055, /* Japanese Envelope Kaku #3 Rotated */ + DMPAPER_JENV_CHOU3_ROTATED = 0x0056, /* Japanese Envelope Chou #3 Rotated */ + DMPAPER_JENV_CHOU4_ROTATED = 0x0057, /* Japanese Envelope Chou #4 Rotated */ + DMPAPER_B6_JIS = 0x0058, /* B6 (JIS) sheet, 128 x 182 millimeters */ + DMPAPER_B6_JIS_ROTATED = 0x0059, /* B6 (JIS) rotated sheet, 182 x 128 millimeters */ + DMPAPER_12X11 = 0x005A, /* 12 x 11-inch sheet */ + DMPAPER_JENV_YOU4 = 0x005B, /* Japanese Envelope You #4 */ + DMPAPER_JENV_YOU4_ROTATED = 0x005C, /* Japanese Envelope You #4 */ + DMPAPER_P16K = 0x005D, /* PRC 16K, 146 x 215 millimeters */ + DMPAPER_P32K = 0x005E, /* PRC 32K, 97 x 151 millimeters */ + DMPAPER_P32KBIG = 0x005F, /* PRC 32K(Big) 97 x 151 millimeters */ + DMPAPER_PENV_1 = 0x0060, /* PRC Envelope #1, 102 by 165 millimeters */ + DMPAPER_PENV_2 = 0x0061, /* PRC Envelope #2, 102 x 176 millimeters */ + DMPAPER_PENV_3 = 0x0062, /* PRC Envelope #3, 125 x 176 millimeters */ + DMPAPER_PENV_4 = 0x0063, /* PRC Envelope #4, 110 x 208 millimeters */ + DMPAPER_PENV_5 = 0x0064, /* PRC Envelope #5, 110 x 220 millimeters */ + DMPAPER_PENV_6 = 0x0065, /* PRC Envelope #6, 120 x 230 millimeters */ + DMPAPER_PENV_7 = 0x0066, /* PRC Envelope #7, 160 x 230 millimeters */ + DMPAPER_PENV_8 = 0x0067, /* PRC Envelope #8, 120 x 309 millimeters */ + DMPAPER_PENV_9 = 0x0068, /* PRC Envelope #9, 229 x 324 millimeters */ + DMPAPER_PENV_10 = 0x0069, /* PRC Envelope #10, 324 x 458 millimeters */ + DMPAPER_P16K_ROTATED = 0x006A, /* PRC 16K Rotated, 215 x 146 millimeters */ + DMPAPER_P32K_ROTATED = 0x006B, /* PRC 32K Rotated, 151 x 97 millimeters */ + DMPAPER_P32KBIG_ROTATED = 0x006C, /* PRC 32K(Big) Rotated, 151 x 97 millimeters */ + DMPAPER_PENV_1_ROTATED = 0x006D, /* PRC Envelope #1 Rotated, 165 x 102 millimeters */ + DMPAPER_PENV_2_ROTATED = 0x006E, /* PRC Envelope #2 Rotated, 176 x 102 millimeters */ + DMPAPER_PENV_3_ROTATED = 0x006F, /* PRC Envelope #3 Rotated, 176 x 125 millimeters */ + DMPAPER_PENV_4_ROTATED = 0x0070, /* PRC Envelope #4 Rotated, 208 x 110 millimeters */ + DMPAPER_PENV_5_ROTATED = 0x0071, /* PRC Envelope #5 Rotated, 220 x 110 millimeters */ + DMPAPER_PENV_6_ROTATED = 0x0072, /* PRC Envelope #6 Rotated, 230 x 120 millimeters */ + DMPAPER_PENV_7_ROTATED = 0x0073, /* PRC Envelope #7 Rotated, 230 x 160 millimeters */ + DMPAPER_PENV_8_ROTATED = 0x0074, /* PRC Envelope #8 Rotated, 309 x 120 millimeters */ + DMPAPER_PENV_9_ROTATED = 0x0075, /* PRC Envelope #9 Rotated, 324 x 229 millimeters */ + DMPAPER_PENV_10_ROTATED = 0x0076 /* PRC Envelope #10 Rotated, 458 x 324 millimeters */ + } spoolss_DeviceModePaperSize; + + typedef [enum16bit] enum { + DMBIN_UPPER = 0x0001, + DMBIN_LOWER = 0x0002, + DMBIN_MIDDLE = 0x0003, + DMBIN_MANUAL = 0x0004, + DMBIN_ENVELOPE = 0x0005, + DMBIN_ENVMANUAL = 0x0006, + DMBIN_AUTO = 0x0007, + DMBIN_TRACTOR = 0x0008, + DMBIN_SMALLFMT = 0x0009, + DMBIN_LARGEFMT = 0x000a, + DMBIN_LARGECAPACITY = 0x000b, + DMBIN_CASSETTE = 0x000e, + DMBIN_FORMSOURCE = 0x000f + } spoolss_DeviceModeDefaultSource; + + typedef [enum16bit] enum { + DMRES_HIGH = 0xfffc, + DMRES_MEDIUM = 0xfffd, + DMRES_LOW = 0xfffe, + DMRES_DRAFT = 0xffff + } spoolss_DeviceModePrintQuality; + + typedef [enum16bit] enum { + DMRES_MONOCHROME = 0x0001, + DMRES_COLOR = 0x0002 + } spoolss_DeviceModeColor; + + typedef [enum16bit] enum { + DMDUP_SIMPLEX = 0x0001, + DMDUP_VERTICAL = 0x0002, + DMDUP_HORIZONTAL = 0x0003 + } spoolss_DeviceModeDuplex; + + typedef [enum16bit] enum { + DMTT_BITMAP = 0x0001, + DMTT_DOWNLOAD = 0x0002, + DMTT_SUBDEV = 0x0003, + DMTT_DOWNLOAD_OUTLINE = 0x0004 + } spoolss_DeviceModeTTOption; + + typedef [enum16bit] enum { + DMCOLLATE_FALSE = 0x0000, + DMCOLLATE_TRUE = 0x0001 + } spoolss_DeviceModeCollate; + + typedef [v1_enum] enum { + DMNUP_SYSTEM = 0x00000001, + DMNUP_ONEUP = 0x00000002 + } spoolss_DeviceModeNUp; + + typedef [v1_enum] enum { + DMICMMETHOD_NONE = 0x00000001, + DMICMMETHOD_SYSTEM = 0x00000002, + DMICMMETHOD_DRIVER = 0x00000003, + DMICMMETHOD_DEVICE = 0x00000004 + } spoolss_DeviceModeICMMethod; + + typedef [v1_enum] enum { + DMICM_SATURATE = 0x00000001, + DMICM_CONTRAST = 0x00000002, + DMICM_COLORIMETRIC = 0x00000003, + DMICM_ABS_COLORIMETRIC = 0x00000004 + } spoolss_DeviceModeICMIntent; + + typedef [v1_enum] enum { + DMMEDIA_STANDARD = 0x00000001, + DMMEDIA_TRANSPARENCY = 0x00000002, + DMMEDIA_GLOSSY = 0x00000003 + } spoolss_DeviceModeMediaType; + + typedef [v1_enum] enum { + DMDITHER_NONE = 0x00000001, + DMDITHER_COARSE = 0x00000002, + DMDITHER_FINE = 0x00000003, + DMDITHER_LINEART = 0x00000004, + DMDITHER_ERRORDIFFUSION = 0x00000005, + DMDITHER_RESERVED6 = 0x00000006, + DMDITHER_RESERVED7 = 0x00000007, + DMDITHER_RESERVED8 = 0x00000008, + DMDITHER_RESERVED9 = 0x00000009, + DMDITHER_GRAYSCALE = 0x0000000A + } spoolss_DeviceModeDitherType; + + const int MAXDEVICENAME = 32; + + typedef [public,gensize] struct { + [charset(UTF16),to_null] uint16 devicename[MAXDEVICENAME]; + spoolss_DeviceModeSpecVersion specversion; + uint16 driverversion; + uint16 size; + [value(r->driverextra_data.length)] uint16 __driverextra_length; + spoolss_DeviceModeFields fields; + spoolss_DeviceModeOrientation orientation; + spoolss_DeviceModePaperSize papersize; + uint16 paperlength; + uint16 paperwidth; + uint16 scale; + uint16 copies; + spoolss_DeviceModeDefaultSource defaultsource; + spoolss_DeviceModePrintQuality printquality; + spoolss_DeviceModeColor color; + spoolss_DeviceModeDuplex duplex; + uint16 yresolution; + spoolss_DeviceModeTTOption ttoption; + spoolss_DeviceModeCollate collate; + [charset(UTF16),to_null] uint16 formname[MAXDEVICENAME]; + uint16 logpixels; /* reserved */ + uint32 bitsperpel; /* reserved */ + uint32 pelswidth; /* reserved */ + uint32 pelsheight; /* reserved */ + spoolss_DeviceModeNUp displayflags; + uint32 displayfrequency; /* reserved */ + spoolss_DeviceModeICMMethod icmmethod; + spoolss_DeviceModeICMIntent icmintent; + spoolss_DeviceModeMediaType mediatype; + spoolss_DeviceModeDitherType dithertype; + uint32 reserved1; + uint32 reserved2; + uint32 panningwidth; /* reserved */ + uint32 panningheight; /* reserved */ + [subcontext_size(__driverextra_length),subcontext(0),flag(NDR_REMAINING)] DATA_BLOB driverextra_data; + } spoolss_DeviceMode; + + typedef [public] bitmap { + PRINTER_ENUM_DEFAULT = 0x00000001, + PRINTER_ENUM_LOCAL = 0x00000002, + PRINTER_ENUM_CONNECTIONS = 0x00000004, + PRINTER_ENUM_FAVORITE = 0x00000004, + PRINTER_ENUM_NAME = 0x00000008, + PRINTER_ENUM_REMOTE = 0x00000010, + PRINTER_ENUM_SHARED = 0x00000020, + PRINTER_ENUM_NETWORK = 0x00000040, + PRINTER_ENUM_EXPAND = 0x00004000, + PRINTER_ENUM_CONTAINER = 0x00008000, + PRINTER_ENUM_ICON1 = 0x00010000, + PRINTER_ENUM_ICON2 = 0x00020000, + PRINTER_ENUM_ICON3 = 0x00040000, + PRINTER_ENUM_ICON4 = 0x00080000, + PRINTER_ENUM_ICON5 = 0x00100000, + PRINTER_ENUM_ICON6 = 0x00200000, + PRINTER_ENUM_ICON7 = 0x00400000, + PRINTER_ENUM_ICON8 = 0x00800000, + PRINTER_ENUM_HIDE = 0x01000000 + } spoolss_EnumPrinterFlags; + + const int PRINTER_ENUM_ICONMASK = (PRINTER_ENUM_ICON1 | + PRINTER_ENUM_ICON2 | + PRINTER_ENUM_ICON3 | + PRINTER_ENUM_ICON4 | + PRINTER_ENUM_ICON5 | + PRINTER_ENUM_ICON6 | + PRINTER_ENUM_ICON7 | + PRINTER_ENUM_ICON8); /* 0x00ff0000 */ + + typedef [public] bitmap { + PRINTER_ATTRIBUTE_QUEUED = 0x00000001, + PRINTER_ATTRIBUTE_DIRECT = 0x00000002, + PRINTER_ATTRIBUTE_DEFAULT = 0x00000004, + PRINTER_ATTRIBUTE_SHARED = 0x00000008, + PRINTER_ATTRIBUTE_NETWORK = 0x00000010, + PRINTER_ATTRIBUTE_HIDDEN = 0x00000020, + PRINTER_ATTRIBUTE_LOCAL = 0x00000040, + PRINTER_ATTRIBUTE_ENABLE_DEVQ = 0x00000080, + PRINTER_ATTRIBUTE_KEEPPRINTEDJOBS = 0x00000100, + PRINTER_ATTRIBUTE_DO_COMPLETE_FIRST = 0x00000200, + PRINTER_ATTRIBUTE_WORK_OFFLINE = 0x00000400, + PRINTER_ATTRIBUTE_ENABLE_BIDI = 0x00000800, + PRINTER_ATTRIBUTE_RAW_ONLY = 0x00001000, + PRINTER_ATTRIBUTE_PUBLISHED = 0x00002000, + PRINTER_ATTRIBUTE_FAX = 0x00004000, + PRINTER_ATTRIBUTE_TS = 0x00008000 + } spoolss_PrinterAttributes; + + typedef [public,gensize] struct { + spoolss_EnumPrinterFlags flags; + [relative] nstring *description; + [relative] nstring *name; + [relative] nstring *comment; + } spoolss_PrinterInfo1; + + typedef [public,gensize,nopush] struct { + [relative] nstring *servername; + [relative] nstring *printername; + [relative] nstring *sharename; + [relative] nstring *portname; + [relative] nstring *drivername; + [relative] nstring *comment; + [relative] nstring *location; + [relative,subcontext(0),flag(NDR_ALIGN4)] spoolss_DeviceMode *devmode; + [relative] nstring *sepfile; + [relative] nstring *printprocessor; + [relative] nstring *datatype; + [relative] nstring *parameters; + [relative,subcontext(0),flag(NDR_ALIGN4)] spoolss_security_descriptor *secdesc; + spoolss_PrinterAttributes attributes; + [range(0,99)] uint32 priority; + uint32 defaultpriority; + uint32 starttime; + uint32 untiltime; + spoolss_PrinterStatus status; + uint32 cjobs; + uint32 averageppm; + } spoolss_PrinterInfo2; + + typedef [public,gensize] struct { + [relative,subcontext(0),flag(NDR_ALIGN4)] spoolss_security_descriptor *secdesc; + } spoolss_PrinterInfo3; + + typedef [public,gensize] struct { + [relative] nstring *printername; + [relative] nstring *servername; + spoolss_PrinterAttributes attributes; + } spoolss_PrinterInfo4; + + typedef [public,gensize] struct { + [relative] nstring *printername; + [relative] nstring *portname; + spoolss_PrinterAttributes attributes; + uint32 device_not_selected_timeout; + uint32 transmission_retry_timeout; + } spoolss_PrinterInfo5; + + typedef [public,gensize] struct { + spoolss_PrinterStatus status; + } spoolss_PrinterInfo6; + + typedef bitmap { + DSPRINT_PUBLISH = 0x00000001, + DSPRINT_UPDATE = 0x00000002, + DSPRINT_UNPUBLISH = 0x00000004, + DSPRINT_REPUBLISH = 0x00000008, + DSPRINT_PENDING = 0x80000000 + } spoolss_DsPrintAction; + + typedef [public,gensize] struct { + [relative] nstring *guid; /* text form of printer guid */ + spoolss_DsPrintAction action; + } spoolss_PrinterInfo7; + + typedef struct { + [relative,subcontext(0),flag(NDR_ALIGN4)] spoolss_DeviceMode *devmode; + } spoolss_DeviceModeInfo; + + typedef [nodiscriminant,relative_base,public,gensize,flag(NDR_RELATIVE_REVERSE)] union { + [case(0)] spoolss_PrinterInfo0 info0; + [case(1)] spoolss_PrinterInfo1 info1; + [case(2)] spoolss_PrinterInfo2 info2; + [case(3)] spoolss_PrinterInfo3 info3; + [case(4)] spoolss_PrinterInfo4 info4; + [case(5)] spoolss_PrinterInfo5 info5; + [case(6)] spoolss_PrinterInfo6 info6; + [case(7)] spoolss_PrinterInfo7 info7; + [case(8)] spoolss_DeviceModeInfo info8; + [case(9)] spoolss_DeviceModeInfo info9; + [default]; + } spoolss_PrinterInfo; + + /******************/ + /* Function: 0x00 */ + /* we are using this as internal parsing code */ + [public,noopnum,noprint] WERROR _spoolss_EnumPrinters( + [in] spoolss_EnumPrinterFlags flags, + [in,unique] [string,charset(UTF16)] uint16 *server, + [in] uint32 level, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [out,unique] DATA_BLOB *info, + [out,ref] uint32 *needed, + [out,ref] uint32 *count + ); + [public,noopnum,noprint] void __spoolss_EnumPrinters( + [in] uint32 level, + [in] uint32 count, + [out,switch_is(level)] spoolss_PrinterInfo info[count] + ); + [nopull,nopush] WERROR spoolss_EnumPrinters( + [in] spoolss_EnumPrinterFlags flags, + [in,unique] [string,charset(UTF16)] uint16 *server, + [in] uint32 level, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + /* what we have here is a subcontext containing an array of no discriminant unions + * and the array has no size in front + */ + [out,ref] uint32 *count, + [out,ref,switch_is(level),size_is(,*count)] spoolss_PrinterInfo **info, + [out,ref] uint32 *needed + ); + + /******************/ + /* Function: 0x01 */ + typedef [public] struct { + [value(_ndr_size_spoolss_DeviceMode(devmode, ndr->flags))] uint32 _ndr_size; + [subcontext(4),subcontext_size(_ndr_size)] spoolss_DeviceMode *devmode; + } spoolss_DevmodeContainer; + + [public] WERROR spoolss_OpenPrinter( + [in,unique] [string,charset(UTF16)] uint16 *printername, + [in,unique] [string,charset(UTF16)] uint16 *datatype, + [in] spoolss_DevmodeContainer devmode_ctr, + [in] spoolss_AccessRights access_mask, + [out,ref] policy_handle *handle + ); + + /******************/ + /* Function: 0x02 */ + + typedef [public,gensize] struct { + uint32 job_id; + [relative] nstring *printer_name; + [relative] nstring *server_name; + [relative] nstring *user_name; + [relative] nstring *document_name; + [relative] nstring *data_type; + [relative] nstring *text_status; + spoolss_JobStatus status; + [range(0,99)] uint32 priority; + uint32 position; + uint32 total_pages; + uint32 pages_printed; + spoolss_Time submitted; + } spoolss_JobInfo1; + + typedef [public,gensize] struct { + uint32 job_id; + [relative] nstring *printer_name; + [relative] nstring *server_name; + [relative] nstring *user_name; + [relative] nstring *document_name; + [relative] nstring *notify_name; + [relative] nstring *data_type; + [relative] nstring *print_processor; + [relative] nstring *parameters; + [relative] nstring *driver_name; + [relative,subcontext(0),flag(NDR_ALIGN4)] spoolss_DeviceMode *devmode; + [relative] nstring *text_status; + [relative,subcontext(0),flag(NDR_ALIGN4)] spoolss_security_descriptor *secdesc; + spoolss_JobStatus status; + [range(0,99)] uint32 priority; + uint32 position; + uint32 start_time; + uint32 until_time; + uint32 total_pages; + uint32 size; + spoolss_Time submitted; + uint32 time; + uint32 pages_printed; + } spoolss_JobInfo2; + + typedef [public,gensize] struct { + uint32 job_id; + uint32 next_job_id; + uint32 reserved; + } spoolss_JobInfo3; + + typedef [public,gensize] struct { + uint32 job_id; + [relative] nstring *printer_name; + [relative] nstring *server_name; + [relative] nstring *user_name; + [relative] nstring *document_name; + [relative] nstring *notify_name; + [relative] nstring *data_type; + [relative] nstring *print_processor; + [relative] nstring *parameters; + [relative] nstring *driver_name; + [relative,subcontext(0),flag(NDR_ALIGN4)] spoolss_DeviceMode *devmode; + [relative] nstring *text_status; + [relative,subcontext(0),flag(NDR_ALIGN4)] spoolss_security_descriptor *secdesc; + spoolss_JobStatus status; + [range(0,99)] uint32 priority; + uint32 position; + uint32 start_time; + uint32 until_time; + uint32 total_pages; + uint32 size; + spoolss_Time submitted; + uint32 time; + uint32 pages_printed; + uint32 size_high; + } spoolss_JobInfo4; + + typedef [nodiscriminant,relative_base,public,gensize,flag(NDR_RELATIVE_REVERSE)] union { + [case(1)] spoolss_JobInfo1 info1; + [case(2)] spoolss_JobInfo2 info2; + [case(3)] spoolss_JobInfo3 info3; + [case(4)] spoolss_JobInfo4 info4; + [default]; + } spoolss_JobInfo; + + typedef struct { + uint32 job_id; + [string,charset(UTF16)] uint16 *printer_name; + [string,charset(UTF16)] uint16 *server_name; + [string,charset(UTF16)] uint16 *user_name; + [string,charset(UTF16)] uint16 *document_name; + [string,charset(UTF16)] uint16 *data_type; + [string,charset(UTF16)] uint16 *text_status; + spoolss_JobStatus status; + [range(0,99)] uint32 priority; + uint32 position; + uint32 total_pages; + uint32 pages_printed; + spoolss_Time submitted; + } spoolss_SetJobInfo1; + + typedef struct { + uint32 job_id; + [string,charset(UTF16)] uint16 *printer_name; + [string,charset(UTF16)] uint16 *server_name; + [string,charset(UTF16)] uint16 *user_name; + [string,charset(UTF16)] uint16 *document_name; + [string,charset(UTF16)] uint16 *notify_name; + [string,charset(UTF16)] uint16 *data_type; + [string,charset(UTF16)] uint16 *print_processor; + [string,charset(UTF16)] uint16 *parameters; + [string,charset(UTF16)] uint16 *driver_name; + uint3264 _devmode_ptr; /* ULONG_PTR */ + [string,charset(UTF16)] uint16 *text_status; + uint3264 _secdesc_ptr; /* ULONG_PTR */ + spoolss_JobStatus status; + [range(0,99)] uint32 priority; + uint32 position; + uint32 start_time; + uint32 until_time; + uint32 total_pages; + uint32 size; + spoolss_Time submitted; + uint32 time; + uint32 pages_printed; + } spoolss_SetJobInfo2; + + typedef struct { + uint32 job_id; + [string,charset(UTF16)] uint16 *printer_name; + [string,charset(UTF16)] uint16 *server_name; + [string,charset(UTF16)] uint16 *user_name; + [string,charset(UTF16)] uint16 *document_name; + [string,charset(UTF16)] uint16 *notify_name; + [string,charset(UTF16)] uint16 *data_type; + [string,charset(UTF16)] uint16 *print_processor; + [string,charset(UTF16)] uint16 *parameters; + [string,charset(UTF16)] uint16 *driver_name; + uint3264 _devmode_ptr; /* ULONG_PTR */ + [string,charset(UTF16)] uint16 *text_status; + uint3264 _secdesc_ptr; /* ULONG_PTR */ + spoolss_JobStatus status; + [range(0,99)] uint32 priority; + uint32 position; + uint32 start_time; + uint32 until_time; + uint32 total_pages; + uint32 size; + spoolss_Time submitted; + uint32 time; + uint32 pages_printed; + uint32 size_high; + } spoolss_SetJobInfo4; + + typedef [ms_union,public] union { + [case(1)] spoolss_SetJobInfo1 *info1; + [case(2)] spoolss_SetJobInfo2 *info2; + [case(3)] spoolss_JobInfo3 *info3; + [case(4)] spoolss_SetJobInfo4 *info4; + [default]; + } spoolss_SetJobInfo; + + typedef [public] struct { + uint32 level; + [switch_is(level)] spoolss_SetJobInfo info; + } spoolss_JobInfoContainer; + + typedef [v1_enum] enum { + SPOOLSS_JOB_CONTROL_NOOP = 0, + SPOOLSS_JOB_CONTROL_PAUSE = 1, + SPOOLSS_JOB_CONTROL_RESUME = 2, + SPOOLSS_JOB_CONTROL_CANCEL = 3, + SPOOLSS_JOB_CONTROL_RESTART = 4, + SPOOLSS_JOB_CONTROL_DELETE = 5, + SPOOLSS_JOB_CONTROL_SEND_TO_PRINTER = 6, + SPOOLSS_JOB_CONTROL_LAST_PAGE_EJECTED = 7, + SPOOLSS_JOB_CONTROL_RETAIN = 8, + SPOOLSS_JOB_CONTROL_RELEASE = 9 + } spoolss_JobControl; + + WERROR spoolss_SetJob( + [in,ref] policy_handle *handle, + [in] uint32 job_id, + [in,unique] spoolss_JobInfoContainer *ctr, + [in] spoolss_JobControl command + ); + + /******************/ + /* Function: 0x03 */ + WERROR spoolss_GetJob( + [in,ref] policy_handle *handle, + [in] uint32 job_id, + [in] uint32 level, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_JobInfo *info, + [out,ref] uint32 *needed + ); + + /******************/ + /* Function: 0x04 */ + [public,noopnum,noprint] WERROR _spoolss_EnumJobs( + [in,ref] policy_handle *handle, + [in] uint32 firstjob, + [in] uint32 numjobs, + [in] uint32 level, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [out,unique] DATA_BLOB *info, + [out,ref] uint32 *needed, + [out,ref] uint32 *count + ); + [public,noopnum,noprint] void __spoolss_EnumJobs( + [in] uint32 level, + [in] uint32 count, + [out,switch_is(level)] spoolss_JobInfo info[count] + ); + [nopull,nopush] WERROR spoolss_EnumJobs( + [in,ref] policy_handle *handle, + [in] uint32 firstjob, + [in] uint32 numjobs, + [in] uint32 level, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [out,ref] uint32 *count, + [out,ref,switch_is(level),size_is(,*count)] spoolss_JobInfo **info, + [out,ref] uint32 *needed + ); + + /******************/ + /* Function: 0x05 */ + WERROR spoolss_AddPrinter( + [in,unique] [string,charset(UTF16)] uint16 *server, + [in,ref] spoolss_SetPrinterInfoCtr *info_ctr, + [in,ref] spoolss_DevmodeContainer *devmode_ctr, + [in,ref] sec_desc_buf *secdesc_ctr, + [out,ref] policy_handle *handle + ); + + /******************/ + /* Function: 0x06 */ + WERROR spoolss_DeletePrinter( + [in] policy_handle *handle + ); + + /******************/ + /* Function: 0x07 */ + typedef [v1_enum] enum { + SPOOLSS_PRINTER_CONTROL_UNPAUSE = 0, + SPOOLSS_PRINTER_CONTROL_PAUSE = 1, + SPOOLSS_PRINTER_CONTROL_RESUME = 2, + SPOOLSS_PRINTER_CONTROL_PURGE = 3, + SPOOLSS_PRINTER_CONTROL_SET_STATUS = 4 + } spoolss_PrinterControl; + + typedef struct { + [string,charset(UTF16)] uint16 *servername; + [string,charset(UTF16)] uint16 *printername; + uint32 cjobs; + uint32 total_jobs; + uint32 total_bytes; + spoolss_Time time; + uint32 global_counter; + uint32 total_pages; + uint32 version; + spoolss_Build free_build; + uint32 spooling; + uint32 max_spooling; + uint32 session_counter; + uint32 num_error_out_of_paper; + uint32 num_error_not_ready; + spoolss_JobStatus job_error; + uint32 number_of_processors; + spoolss_ProcessorType processor_type; + uint32 high_part_total_bytes; + uint32 change_id; + WERROR last_error; + spoolss_PrinterStatus status; + uint32 enumerate_network_printers; + uint32 c_setprinter; + spoolss_ProcessorArchitecture processor_architecture; + uint16 processor_level; + uint32 ref_ic; + uint32 reserved2; + uint32 reserved3; + } spoolss_SetPrinterInfo0; + + typedef struct { + spoolss_PrinterAttributes flags; + [string,charset(UTF16)] uint16 *description; + [string,charset(UTF16)] uint16 *name; + [string,charset(UTF16)] uint16 *comment; + } spoolss_SetPrinterInfo1; + + typedef struct { + [string,charset(UTF16)] uint16 *servername; + [string,charset(UTF16)] uint16 *printername; + [string,charset(UTF16)] uint16 *sharename; + [string,charset(UTF16)] uint16 *portname; + [string,charset(UTF16)] uint16 *drivername; + [string,charset(UTF16)] uint16 *comment; + [string,charset(UTF16)] uint16 *location; + uint3264 devmode_ptr; /* ULONG_PTR */ + [string,charset(UTF16)] uint16 *sepfile; + [string,charset(UTF16)] uint16 *printprocessor; + [string,charset(UTF16)] uint16 *datatype; + [string,charset(UTF16)] uint16 *parameters; + uint3264 secdesc_ptr; /* ULONG_PTR */ + spoolss_PrinterAttributes attributes; + [range(0,99)] uint32 priority; + uint32 defaultpriority; + uint32 starttime; + uint32 untiltime; + spoolss_PrinterStatus status; + uint32 cjobs; + uint32 averageppm; + } spoolss_SetPrinterInfo2; + + typedef struct { + uint3264 sec_desc_ptr; /* ULONG_PTR */ + } spoolss_SetPrinterInfo3; + + typedef struct { + [string,charset(UTF16)] uint16 *printername; + [string,charset(UTF16)] uint16 *servername; + spoolss_PrinterAttributes attributes; + } spoolss_SetPrinterInfo4; + + typedef struct { + [string,charset(UTF16)] uint16 *printername; + [string,charset(UTF16)] uint16 *portname; + spoolss_PrinterAttributes attributes; + uint32 device_not_selected_timeout; + uint32 transmission_retry_timeout; + } spoolss_SetPrinterInfo5; + + typedef struct { + spoolss_PrinterStatus status; + } spoolss_SetPrinterInfo6; + + typedef struct { + [string,charset(UTF16)] uint16 *guid; /* text form of printer guid */ + spoolss_DsPrintAction action; + } spoolss_SetPrinterInfo7; + + typedef struct { + uint3264 devmode_ptr; /* ULONG_PTR */ + } spoolss_SetPrinterInfo8; + + typedef struct { + uint3264 devmode_ptr; /* ULONG_PTR */ + } spoolss_SetPrinterInfo9; + + typedef [ms_union,switch_type(uint32)] union { + [case(0)] spoolss_SetPrinterInfo0 *info0; + [case(1)] spoolss_SetPrinterInfo1 *info1; + [case(2)] spoolss_SetPrinterInfo2 *info2; + [case(3)] spoolss_SetPrinterInfo3 *info3; + [case(4)] spoolss_SetPrinterInfo4 *info4; + [case(5)] spoolss_SetPrinterInfo5 *info5; + [case(6)] spoolss_SetPrinterInfo6 *info6; + [case(7)] spoolss_SetPrinterInfo7 *info7; + [case(8)] spoolss_SetPrinterInfo8 *info8; + [case(9)] spoolss_SetPrinterInfo9 *info9; + [default]; + } spoolss_SetPrinterInfo; + + typedef [public] struct { + uint32 level; + [switch_is(level)] spoolss_SetPrinterInfo info; + } spoolss_SetPrinterInfoCtr; + + [public] WERROR spoolss_SetPrinter( + [in,ref] policy_handle *handle, + [in,ref] spoolss_SetPrinterInfoCtr *info_ctr, + [in,ref] spoolss_DevmodeContainer *devmode_ctr, + [in,ref] sec_desc_buf *secdesc_ctr, + [in] spoolss_PrinterControl command + ); + + /******************/ + /* Function: 0x08 */ + [public] WERROR spoolss_GetPrinter( + [in,ref] policy_handle *handle, + [in] uint32 level, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_PrinterInfo *info, + [out,ref] uint32 *needed + ); + + /******************/ + /* Function: 0x09 */ + + typedef [public] struct { + [value((ndr_size_spoolss_StringArray(r, ndr->flags)-4)/2)] uint32 _ndr_size; + /*[subcontext(0),subcontext_size(_ndr_size*2)]*/ nstring_array string; + } spoolss_StringArray; + + typedef struct { + [string,charset(UTF16)] uint16 *driver_name; + } spoolss_AddDriverInfo1; + + typedef [v1_enum,public] enum { + SPOOLSS_DRIVER_VERSION_9X = 0, + SPOOLSS_DRIVER_VERSION_NT35 = 1, + SPOOLSS_DRIVER_VERSION_NT4 = 2, + SPOOLSS_DRIVER_VERSION_200X = 3, + SPOOLSS_DRIVER_VERSION_2012 = 4 + } spoolss_DriverOSVersion; + + typedef struct { + spoolss_DriverOSVersion version; + [string,charset(UTF16)] uint16 *driver_name; + [string,charset(UTF16)] uint16 *architecture; + [string,charset(UTF16)] uint16 *driver_path; + [string,charset(UTF16)] uint16 *data_file; + [string,charset(UTF16)] uint16 *config_file; + } spoolss_AddDriverInfo2; + + typedef struct { + spoolss_DriverOSVersion version; + [string,charset(UTF16)] uint16 *driver_name; + [string,charset(UTF16)] uint16 *architecture; + [string,charset(UTF16)] uint16 *driver_path; + [string,charset(UTF16)] uint16 *data_file; + [string,charset(UTF16)] uint16 *config_file; + [string,charset(UTF16)] uint16 *help_file; + [string,charset(UTF16)] uint16 *monitor_name; + [string,charset(UTF16)] uint16 *default_datatype; + [value(((ndr_size_spoolss_StringArray(dependent_files, ndr->flags)-4)/2))] uint32 _ndr_size_dependent_files; + spoolss_StringArray *dependent_files; + } spoolss_AddDriverInfo3; + + typedef struct { + spoolss_DriverOSVersion version; + [string,charset(UTF16)] uint16 *driver_name; + [string,charset(UTF16)] uint16 *architecture; + [string,charset(UTF16)] uint16 *driver_path; + [string,charset(UTF16)] uint16 *data_file; + [string,charset(UTF16)] uint16 *config_file; + [string,charset(UTF16)] uint16 *help_file; + [string,charset(UTF16)] uint16 *monitor_name; + [string,charset(UTF16)] uint16 *default_datatype; + [value(((ndr_size_spoolss_StringArray(dependent_files, ndr->flags)-4)/2))] uint32 _ndr_size_dependent_files; + spoolss_StringArray *dependent_files; + [value(((ndr_size_spoolss_StringArray(previous_names, ndr->flags)-4)/2))] uint32 _ndr_size_previous_names; + spoolss_StringArray *previous_names; + } spoolss_AddDriverInfo4; + + typedef [bitmap32bit] bitmap { + PRINTER_DRIVER_PACKAGE_AWARE = 0x00000001, + PRINTER_DRIVER_XPS = 0x00000002, + PRINTER_DRIVER_SANDBOX_ENABLED = 0x00000004, + PRINTER_DRIVER_CLASS = 0x00000008, + PRINTER_DRIVER_DERIVED = 0x00000010, + PRINTER_DRIVER_NOT_SHAREABLE = 0x00000020, + PRINTER_DRIVER_CATEGORY_FAX = 0x00000040, + PRINTER_DRIVER_CATEGORY_FILE = 0x00000080, + PRINTER_DRIVER_CATEGORY_VIRTUAL = 0x00000100, + PRINTER_DRIVER_CATEGORY_SERVICE = 0x00000200, + PRINTER_DRIVER_SOFT_RESET_REQUIRED = 0x00000400, + PRINTER_DRIVER_CATEGORY_3D = 0x00001000 + } spoolss_DriverAttributes; + + typedef struct { + spoolss_DriverOSVersion version; + [string,charset(UTF16)] uint16 *driver_name; + [string,charset(UTF16)] uint16 *architecture; + [string,charset(UTF16)] uint16 *driver_path; + [string,charset(UTF16)] uint16 *data_file; + [string,charset(UTF16)] uint16 *config_file; + spoolss_DriverAttributes driver_attributes; + uint32 config_version; + uint32 driver_version; + } spoolss_AddDriverInfo5; + + typedef struct { + spoolss_DriverOSVersion version; + [string,charset(UTF16)] uint16 *driver_name; + [string,charset(UTF16)] uint16 *architecture; + [string,charset(UTF16)] uint16 *driver_path; + [string,charset(UTF16)] uint16 *data_file; + [string,charset(UTF16)] uint16 *config_file; + [string,charset(UTF16)] uint16 *help_file; + [string,charset(UTF16)] uint16 *monitor_name; + [string,charset(UTF16)] uint16 *default_datatype; + [value(((ndr_size_spoolss_StringArray(dependent_files, ndr->flags)-4)/2))] uint32 _ndr_size_dependent_files; + spoolss_StringArray *dependent_files; + [value(((ndr_size_spoolss_StringArray(previous_names, ndr->flags)-4)/2))] uint32 _ndr_size_previous_names; + spoolss_StringArray *previous_names; + NTTIME driver_date; + hyper driver_version; + [string,charset(UTF16)] uint16 *manufacturer_name; + [string,charset(UTF16)] uint16 *manufacturer_url; + [string,charset(UTF16)] uint16 *hardware_id; + [string,charset(UTF16)] uint16 *provider; + } spoolss_AddDriverInfo6; + + typedef struct { + spoolss_DriverOSVersion version; + [string,charset(UTF16)] uint16 *driver_name; + [string,charset(UTF16)] uint16 *architecture; + [string,charset(UTF16)] uint16 *driver_path; + [string,charset(UTF16)] uint16 *data_file; + [string,charset(UTF16)] uint16 *config_file; + [string,charset(UTF16)] uint16 *help_file; + [string,charset(UTF16)] uint16 *monitor_name; + [string,charset(UTF16)] uint16 *default_datatype; + [value(((ndr_size_spoolss_StringArray(dependent_files, ndr->flags)-4)/2))] uint32 _ndr_size_dependent_files; + spoolss_StringArray *dependent_files; + [value(((ndr_size_spoolss_StringArray(previous_names, ndr->flags)-4)/2))] uint32 _ndr_size_previous_names; + spoolss_StringArray *previous_names; + NTTIME driver_date; + hyper driver_version; + [string,charset(UTF16)] uint16 *manufacturer_name; + [string,charset(UTF16)] uint16 *manufacturer_url; + [string,charset(UTF16)] uint16 *hardware_id; + [string,charset(UTF16)] uint16 *provider; + [string,charset(UTF16)] uint16 *print_processor; + [string,charset(UTF16)] uint16 *vendor_setup; + [value(((ndr_size_spoolss_StringArray(color_profiles, ndr->flags)-4)/2))] uint32 _ndr_size_color_profiles; + spoolss_StringArray *color_profiles; + [string,charset(UTF16)] uint16 *inf_path; + spoolss_DriverAttributes printer_driver_attributes; + [value(((ndr_size_spoolss_StringArray(core_driver_dependencies, ndr->flags)-4)/2))] uint32 _ndr_size_core_driver_dependencies; + spoolss_StringArray *core_driver_dependencies; + NTTIME min_inbox_driver_ver_date; + hyper min_inbox_driver_ver_version; + } spoolss_AddDriverInfo8; + + typedef [ms_union,switch_type(uint32)] union { + [case(1)] spoolss_AddDriverInfo1 *info1; + [case(2)] spoolss_AddDriverInfo2 *info2; + [case(3)] spoolss_AddDriverInfo3 *info3; + [case(4)] spoolss_AddDriverInfo4 *info4; + [case(6)] spoolss_AddDriverInfo6 *info6; + [case(8)] spoolss_AddDriverInfo8 *info8; + } spoolss_AddDriverInfo; + + typedef [public] struct { + uint32 level; + [switch_is(level)] spoolss_AddDriverInfo info; + } spoolss_AddDriverInfoCtr; + + WERROR spoolss_AddPrinterDriver( + [in,unique] [string,charset(UTF16)] uint16 *servername, + [in,ref] spoolss_AddDriverInfoCtr *info_ctr + ); + + typedef [public,gensize] struct { + [relative] nstring *driver_name; + } spoolss_DriverInfo1; + + typedef [public,gensize] struct { + spoolss_DriverOSVersion version; + [relative] nstring *driver_name; + [relative] nstring *architecture; + [relative] nstring *driver_path; + [relative] nstring *data_file; + [relative] nstring *config_file; + } spoolss_DriverInfo2; + + typedef [public,gensize] struct { + spoolss_DriverOSVersion version; + [relative] nstring *driver_name; + [relative] nstring *architecture; + [relative] nstring *driver_path; + [relative] nstring *data_file; + [relative] nstring *config_file; + [relative] nstring *help_file; + [relative] nstring_array *dependent_files; + [relative] nstring *monitor_name; + [relative] nstring *default_datatype; + } spoolss_DriverInfo3; + + typedef [public,gensize] struct { + spoolss_DriverOSVersion version; + [relative] nstring *driver_name; + [relative] nstring *architecture; + [relative] nstring *driver_path; + [relative] nstring *data_file; + [relative] nstring *config_file; + [relative] nstring *help_file; + [relative] nstring_array *dependent_files; + [relative] nstring *monitor_name; + [relative] nstring *default_datatype; + [relative] nstring_array *previous_names; + } spoolss_DriverInfo4; + + typedef [public,gensize] struct { + spoolss_DriverOSVersion version; + [relative] nstring *driver_name; + [relative] nstring *architecture; + [relative] nstring *driver_path; + [relative] nstring *data_file; + [relative] nstring *config_file; + spoolss_DriverAttributes driver_attributes; + uint32 config_version; + uint32 driver_version; + } spoolss_DriverInfo5; + + typedef [public,gensize] struct { + spoolss_DriverOSVersion version; + [relative] nstring *driver_name; + [relative] nstring *architecture; + [relative] nstring *driver_path; + [relative] nstring *data_file; + [relative] nstring *config_file; + [relative] nstring *help_file; + [relative] nstring_array *dependent_files; + [relative] nstring *monitor_name; + [relative] nstring *default_datatype; + [relative] nstring_array *previous_names; + NTTIME driver_date; + hyper driver_version; + [relative] nstring *manufacturer_name; + [relative] nstring *manufacturer_url; + [relative] nstring *hardware_id; + [relative] nstring *provider; + } spoolss_DriverInfo6; + + typedef [public,gensize] struct { + uint32 size; + spoolss_DriverOSVersion version; + [relative] nstring *driver_name; + [relative] nstring *inf_name; + [relative] nstring *install_source_root; + } spoolss_DriverInfo7; + + typedef [public,gensize] struct { + spoolss_DriverOSVersion version; + [relative] nstring *driver_name; + [relative] nstring *architecture; + [relative] nstring *driver_path; + [relative] nstring *data_file; + [relative] nstring *config_file; + [relative] nstring *help_file; + [relative] nstring_array *dependent_files; + [relative] nstring *monitor_name; + [relative] nstring *default_datatype; + [relative] nstring_array *previous_names; + NTTIME driver_date; + hyper driver_version; + [relative] nstring *manufacturer_name; + [relative] nstring *manufacturer_url; + [relative] nstring *hardware_id; + [relative] nstring *provider; + [relative] nstring *print_processor; + [relative] nstring *vendor_setup; + [relative] nstring_array *color_profiles; + [relative] nstring *inf_path; + spoolss_DriverAttributes printer_driver_attributes; + [relative] nstring_array *core_driver_dependencies; + NTTIME min_inbox_driver_ver_date; + hyper min_inbox_driver_ver_version; + } spoolss_DriverInfo8; + + typedef [v1_enum] enum { + SPOOLSS_DRIVER_FILE_TYPE_RENDERING = 0x00000000, + SPOOLSS_DRIVER_FILE_TYPE_CONFIGURATION = 0x00000001, + SPOOLSS_DRIVER_FILE_TYPE_DATA = 0x00000002, + SPOOLSS_DRIVER_FILE_TYPE_HELP = 0x00000003, + SPOOLSS_DRIVER_FILE_TYPE_OTHER = 0x00000004 + } spoolss_DriverFileType; + + typedef [public] struct { + [relative] nstring *file_name; + spoolss_DriverFileType file_type; + uint32 file_version; + } spoolss_DriverFileInfo; + + typedef [public,gensize,nopush,nopull] struct { + spoolss_DriverOSVersion version; + [relative] nstring *driver_name; + [relative] nstring *architecture; + [relative,size_is(file_count),flag(NDR_ALIGN4)] spoolss_DriverFileInfo *file_info; + uint32 file_count; + [relative] nstring *monitor_name; + [relative] nstring *default_datatype; + [relative] nstring_array *previous_names; + NTTIME driver_date; + hyper driver_version; + [relative] nstring *manufacturer_name; + [relative] nstring *manufacturer_url; + [relative] nstring *hardware_id; + [relative] nstring *provider; + } spoolss_DriverInfo101; + + typedef [nodiscriminant,relative_base,public,gensize,flag(NDR_RELATIVE_REVERSE)] union { + [case(1)] spoolss_DriverInfo1 info1; + [case(2)] spoolss_DriverInfo2 info2; + [case(3)] spoolss_DriverInfo3 info3; + [case(4)] spoolss_DriverInfo4 info4; + [case(5)] spoolss_DriverInfo5 info5; + [case(6)] spoolss_DriverInfo6 info6; + [case(7)] spoolss_DriverInfo7 info7; + [case(8)] spoolss_DriverInfo8 info8; + [case(101)] spoolss_DriverInfo101 info101; + [default]; + } spoolss_DriverInfo; + + /******************/ + /* Function: 0x0a */ + [public,noopnum,noprint] WERROR _spoolss_EnumPrinterDrivers( + [in,unique] [string,charset(UTF16)] uint16 *server, + [in,unique] [string,charset(UTF16)] uint16 *environment, + [in] uint32 level, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [out,unique] DATA_BLOB *info, + [out,ref] uint32 *needed, + [out,ref] uint32 *count + ); + [public,noopnum,noprint] void __spoolss_EnumPrinterDrivers( + [in] uint32 level, + [in] uint32 count, + [out,switch_is(level)] spoolss_DriverInfo info[count] + ); + [nopull,nopush] WERROR spoolss_EnumPrinterDrivers( + [in,unique] [string,charset(UTF16)] uint16 *server, + [in,unique] [string,charset(UTF16)] uint16 *environment, + [in] uint32 level, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [out,ref] uint32 *count, + [out,ref,switch_is(level),size_is(,*count)] spoolss_DriverInfo **info, + [out,ref] uint32 *needed + ); + + /******************/ + /* Function: 0x0b */ + WERROR spoolss_GetPrinterDriver( + [in,ref] policy_handle *handle, + [in,unique] [string,charset(UTF16)] uint16 *architecture, + [in] uint32 level, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_DriverInfo *info, + [out,ref] uint32 *needed + ); + + /******************/ + /* Function: 0x0c */ + typedef [public,gensize] struct { + nstring directory_name; + } spoolss_DriverDirectoryInfo1; + + /* NOTE: It seems that w2k3 completely ignores the level + in its server code + */ + typedef [nodiscriminant,relative_base,public,gensize,flag(NDR_RELATIVE_REVERSE)] union { + [case(1)] spoolss_DriverDirectoryInfo1 info1; + [default] spoolss_DriverDirectoryInfo1 info1; + } spoolss_DriverDirectoryInfo; + + [public] WERROR spoolss_GetPrinterDriverDirectory( + [in,unique] [string,charset(UTF16)] uint16 *server, + [in,unique] [string,charset(UTF16)] uint16 *environment, + [in] uint32 level, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_DriverDirectoryInfo *info, + [out,ref] uint32 *needed + ); + + /******************/ + /* Function: 0x0d */ + WERROR spoolss_DeletePrinterDriver( + [in,unique] [string,charset(UTF16)] uint16 *server, + [in] [string,charset(UTF16)] uint16 architecture[], + [in] [string,charset(UTF16)] uint16 driver[] + ); + + /******************/ + /* Function: 0x0e */ + WERROR spoolss_AddPrintProcessor( + [in,unique] [string,charset(UTF16)] uint16 *server, + [in] [string,charset(UTF16)] uint16 architecture[], + [in] [string,charset(UTF16)] uint16 path_name[], + [in] [string,charset(UTF16)] uint16 print_processor_name[] + ); + + /******************/ + /* Function: 0x0f */ + typedef [public,gensize] struct { + [relative] nstring *print_processor_name; + } spoolss_PrintProcessorInfo1; + + typedef [nodiscriminant,relative_base,public,flag(NDR_RELATIVE_REVERSE)] union { + [case(1)] spoolss_PrintProcessorInfo1 info1; + [default]; + } spoolss_PrintProcessorInfo; + + [public,noopnum,noprint] WERROR _spoolss_EnumPrintProcessors( + [in,unique] [string,charset(UTF16)] uint16 *servername, + [in,unique] [string,charset(UTF16)] uint16 *environment, + [in] uint32 level, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [out,unique] DATA_BLOB *info, + [out,ref] uint32 *needed, + [out,ref] uint32 *count + ); + [public,noopnum,noprint] void __spoolss_EnumPrintProcessors( + [in] uint32 level, + [in] uint32 count, + [out,switch_is(level)] spoolss_PrintProcessorInfo info[count] + ); + [nopull,nopush] WERROR spoolss_EnumPrintProcessors( + [in,unique] [string,charset(UTF16)] uint16 *servername, + [in,unique] [string,charset(UTF16)] uint16 *environment, + [in] uint32 level, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [out,ref] uint32 *count, + [out,ref,switch_is(level),size_is(,*count)] spoolss_PrintProcessorInfo **info, + [out,ref] uint32 *needed + ); + + /******************/ + /* Function: 0x10 */ + typedef [public,gensize] struct { + nstring directory_name; + } spoolss_PrintProcessorDirectoryInfo1; + + typedef [nodiscriminant,relative_base,public,gensize,flag(NDR_RELATIVE_REVERSE)] union { + [case(1)] spoolss_PrintProcessorDirectoryInfo1 info1; + [default] spoolss_PrintProcessorDirectoryInfo1 info1; + } spoolss_PrintProcessorDirectoryInfo; + + WERROR spoolss_GetPrintProcessorDirectory( + [in,unique] [string,charset(UTF16)] uint16 *server, + [in,unique] [string,charset(UTF16)] uint16 *environment, + [in] uint32 level, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_PrintProcessorDirectoryInfo *info, + [out,ref] uint32 *needed + ); + + /******************/ + /* Function: 0x11 */ + typedef struct { + [string,charset(UTF16)] uint16 *document_name; + [string,charset(UTF16)] uint16 *output_file; + [string,charset(UTF16)] uint16 *datatype; + } spoolss_DocumentInfo1; + + typedef [ms_union,switch_type(uint32)] union { + [case(1)] spoolss_DocumentInfo1 *info1; + [case(2)]; /* TODO */ + [case(3)]; /* TODO */ + [default]; + } spoolss_DocumentInfo; + + typedef [public] struct { + uint32 level; + [switch_is(level)] spoolss_DocumentInfo info; + } spoolss_DocumentInfoCtr; + + WERROR spoolss_StartDocPrinter( + [in,ref] policy_handle *handle, + [in,ref] spoolss_DocumentInfoCtr *info_ctr, + [out,ref] uint32 *job_id + ); + + /******************/ + /* Function: 0x12 */ + WERROR spoolss_StartPagePrinter( + [in,ref] policy_handle *handle + ); + + /******************/ + /* Function: 0x13 */ + WERROR spoolss_WritePrinter( + [in,ref] policy_handle *handle, + [in] DATA_BLOB data, + [in,value(r->in.data.length)] uint32 _data_size, + [out,ref] uint32 *num_written + ); + + /******************/ + /* Function: 0x14 */ + WERROR spoolss_EndPagePrinter( + [in,ref] policy_handle *handle + ); + + /******************/ + /* Function: 0x15 */ + WERROR spoolss_AbortPrinter( + [in,ref] policy_handle *handle + ); + + /******************/ + /* Function: 0x16 */ + WERROR spoolss_ReadPrinter( + [in,ref] policy_handle *handle, + [out,ref] [size_is(data_size)] uint8 *data, + [in] uint32 data_size, + [out,ref] uint32 *_data_size + ); + + /******************/ + /* Function: 0x17 */ + WERROR spoolss_EndDocPrinter( + [in,ref] policy_handle *handle + ); + + /******************/ + /* Function: 0x18 */ + WERROR spoolss_AddJob( + [in,ref] policy_handle *handle, + [in] uint32 level, + [in,out,unique] [size_is(offered)] uint8 *buffer, + [in] uint32 offered, + [out,ref] uint32 *needed + ); + + /******************/ + /* Function: 0x19 */ + WERROR spoolss_ScheduleJob( + [in,ref] policy_handle *handle, + [in] uint32 jobid + ); + + /******************/ + /* Function: 0x1a */ + + const string SPL_ARCH_WIN40 = "WIN40"; + const string SPL_ARCH_W32X86 = "W32X86"; + const string SPL_ARCH_W32MIPS = "W32MIPS"; + const string SPL_ARCH_W32ALPHA = "W32ALPHA"; + const string SPL_ARCH_W32PPC = "W32PPC"; + const string SPL_ARCH_IA64 = "IA64"; + const string SPL_ARCH_X64 = "x64"; + const string SPL_ARCH_ARM = "ARM"; + const string SPL_ARCH_ARM64 = "ARM64"; + + const string SPOOLSS_ARCHITECTURE_ALL = "All"; + const string SPOOLSS_ARCHITECTURE_ALL_CLUSTER = "AllCluster"; + const string SPOOLSS_ARCHITECTURE_NT_X86 = "Windows NT x86"; + const string SPOOLSS_ARCHITECTURE_IA_64 = "Windows IA64"; + const string SPOOLSS_ARCHITECTURE_x64 = "Windows x64"; + const string SPOOLSS_ARCHITECTURE_4_0 = "Windows 4.0"; + const string SPOOLSS_ARCHITECTURE_W32MIPS = "Windows NT R4000"; + const string SPOOLSS_ARCHITECTURE_W32PPC = "Windows NT PowerPC"; + const string SPOOLSS_ARCHITECTURE_W32ALPHA = "Windows NT Alpha AXP"; + const string SPOOLSS_ARCHITECTURE_ARM = "Windows ARM"; + const string SPOOLSS_ARCHITECTURE_ARM64 = "Windows ARM64"; + const string SPOOLSS_DEFAULT_SERVER_PATH = "C:\\WINDOWS\\system32\\spool"; + + typedef [public,gensize] struct { + [value(ndr_size_spoolss_OSVersion(r,ndr->flags))] uint32 _ndr_size; + uint32 major; + uint32 minor; + uint32 build; + [value(2)] uint32 platform_id; + [subcontext(0),subcontext_size(256)] nstring extra_string; + } spoolss_OSVersion; + + typedef [public,gensize] struct { + [value(ndr_size_spoolss_OSVersionEx(r,ndr->flags))] uint32 _ndr_size; + uint32 major; + uint32 minor; + uint32 build; + [value(2)] uint32 platform_id; + [subcontext(0),subcontext_size(256)] nstring extra_string; + uint16 service_pack_major; + uint16 service_pack_minor; + uint16 suite_mask; + uint8 product_type; + uint8 reserved; + } spoolss_OSVersionEx; + + typedef [nodiscriminant,public] union { + [case(REG_NONE)]; + [case(REG_SZ)] nstring string; + [case(REG_BINARY),flag(NDR_REMAINING)] DATA_BLOB binary; + [case(REG_DWORD)] uint32 value; + [case(REG_MULTI_SZ)] nstring_array string_array; + [default,flag(NDR_REMAINING)] DATA_BLOB data; + } spoolss_PrinterData; + + /* predefined registry key names for printer data */ + + const string SPOOL_PRINTERDATA_KEY = "PrinterDriverData"; + const string SPOOL_DSSPOOLER_KEY = "DsSpooler"; + const string SPOOL_DSDRIVER_KEY = "DsDriver"; + const string SPOOL_DSUSER_KEY = "DsUser"; + const string SPOOL_PNPDATA_KEY = "PnPData"; + const string SPOOL_OID_KEY = "OID"; + + /* predefined value names for printer data */ + + const string SPOOL_REG_ASSETNUMBER = "assetNumber"; + const string SPOOL_REG_BYTESPERMINUTE = "bytesPerMinute"; + const string SPOOL_REG_DEFAULTPRIORITY = "defaultPriority"; + const string SPOOL_REG_DESCRIPTION = "description"; + const string SPOOL_REG_DRIVERNAME = "driverName"; + const string SPOOL_REG_DRIVERVERSION = "driverVersion"; + const string SPOOL_REG_FLAGS = "flags"; + const string SPOOL_REG_LOCATION = "location"; + const string SPOOL_REG_OPERATINGSYSTEM = "operatingSystem"; + const string SPOOL_REG_OPERATINGSYSTEMHOTFIX = "operatingSystemHotfix"; + const string SPOOL_REG_OPERATINGSYSTEMSERVICEPACK = "operatingSystemServicePack"; + const string SPOOL_REG_OPERATINGSYSTEMVERSION = "operatingSystemVersion"; + const string SPOOL_REG_PORTNAME = "portName"; + const string SPOOL_REG_PRINTATTRIBUTES = "printAttributes"; + const string SPOOL_REG_PRINTBINNAMES = "printBinNames"; + const string SPOOL_REG_PRINTCOLLATE = "printCollate"; + const string SPOOL_REG_PRINTCOLOR = "printColor"; + const string SPOOL_REG_PRINTDUPLEXSUPPORTED = "printDuplexSupported"; + const string SPOOL_REG_PRINTENDTIME = "printEndTime"; + const string SPOOL_REG_PRINTERNAME = "printerName"; + const string SPOOL_REG_PRINTFORMNAME = "printFormName"; + const string SPOOL_REG_PRINTKEEPPRINTEDJOBS = "printKeepPrintedJobs"; + const string SPOOL_REG_PRINTLANGUAGE = "printLanguage"; + const string SPOOL_REG_PRINTMACADDRESS = "printMACAddress"; + const string SPOOL_REG_PRINTMAXCOPIES = "printMaxCopies"; + const string SPOOL_REG_PRINTMAXRESOLUTIONSUPPORTED = "printMaxResolutionSupported"; + const string SPOOL_REG_PRINTMAXXEXTENT = "printMaxXExtent"; + const string SPOOL_REG_PRINTMAXYEXTENT = "printMaxYExtent"; + const string SPOOL_REG_PRINTMEDIAREADY = "printMediaReady"; + const string SPOOL_REG_PRINTMEDIASUPPORTED = "printMediaSupported"; + const string SPOOL_REG_PRINTMEMORY = "printMemory"; + const string SPOOL_REG_PRINTMINXEXTENT = "printMinXExtent"; + const string SPOOL_REG_PRINTMINYEXTENT = "printMinYExtent"; + const string SPOOL_REG_PRINTNETWORKADDRESS = "printNetworkAddress"; + const string SPOOL_REG_PRINTNOTIFY = "printNotify"; + const string SPOOL_REG_PRINTNUMBERUP = "printNumberUp"; + const string SPOOL_REG_PRINTORIENTATIONSSUPPORTED = "printOrientationsSupported"; + const string SPOOL_REG_PRINTOWNER = "printOwner"; + const string SPOOL_REG_PRINTPAGESPERMINUTE = "printPagesPerMinute"; + const string SPOOL_REG_PRINTRATE = "printRate"; + const string SPOOL_REG_PRINTRATEUNIT = "printRateUnit"; + const string SPOOL_REG_PRINTSEPARATORFILE = "printSeparatorFile"; + const string SPOOL_REG_PRINTSHARENAME = "printShareName"; + const string SPOOL_REG_PRINTSPOOLING = "printSpooling"; + const string SPOOL_REGVAL_PRINTWHILESPOOLING = "PrintWhileSpooling"; + const string SPOOL_REGVAL_PRINTAFTERSPOOLED = "PrintAfterSpooled"; + const string SPOOL_REGVAL_PRINTDIRECT = "PrintDirect"; + const string SPOOL_REG_PRINTSTAPLINGSUPPORTED = "printStaplingSupported"; + const string SPOOL_REG_PRINTSTARTTIME = "printStartTime"; + const string SPOOL_REG_PRINTSTATUS = "printStatus"; + const string SPOOL_REG_PRIORITY = "priority"; + const string SPOOL_REG_SERVERNAME = "serverName"; + const string SPOOL_REG_SHORTSERVERNAME = "shortServerName"; + const string SPOOL_REG_UNCNAME = "uNCName"; + const string SPOOL_REG_URL = "url"; + const string SPOOL_REG_VERSIONNUMBER = "versionNumber"; + + [public] WERROR spoolss_GetPrinterData( + [in,ref] policy_handle *handle, + [in] [string,charset(UTF16)] uint16 value_name[], + [out,ref] winreg_Type *type, + [out,ref,size_is(offered)] uint8 *data, + [in] uint32 offered, + [out,ref] uint32 *needed + ); + + /******************/ + /* Function: 0x1b */ + WERROR spoolss_SetPrinterData( + [in,ref] policy_handle *handle, + [in] [string,charset(UTF16)] uint16 value_name[], + [in] winreg_Type type, + [in,ref] [size_is(offered)] uint8 *data, + [in] uint32 offered + ); + + /******************/ + /* Function: 0x1c */ + [todo] WERROR spoolss_WaitForPrinterChange( + ); + + /******************/ + /* Function: 0x1d */ + [public] WERROR spoolss_ClosePrinter( + [in,out,ref] policy_handle *handle + ); + + /******************/ + /* Function: 0x1e */ + typedef [v1_enum] enum { + SPOOLSS_FORM_USER = 0, + SPOOLSS_FORM_BUILTIN = 1, + SPOOLSS_FORM_PRINTER = 2 + } spoolss_FormFlags; + + typedef struct { + uint32 width; + uint32 height; + } spoolss_FormSize; + + typedef struct { + uint32 left; + uint32 top; + uint32 right; + uint32 bottom; + } spoolss_FormArea; + + typedef [public,gensize] struct { + spoolss_FormFlags flags; + [relative] nstring *form_name; + spoolss_FormSize size; + spoolss_FormArea area; + } spoolss_FormInfo1; + + typedef [bitmap32bit] bitmap { + SPOOLSS_FORM_STRING_TYPE_NONE = 0x00000001, + SPOOLSS_FORM_STRING_TYPE_MUI_DLL = 0x00000002, + SPOOLSS_FORM_STRING_TYPE_LANG_PAIR = 0x00000004 + } spoolss_FormStringType; + + typedef [public,gensize] struct { + spoolss_FormFlags flags; + [relative] nstring *form_name; + spoolss_FormSize size; + spoolss_FormArea area; + [relative] astring *keyword; + spoolss_FormStringType string_type; + [relative] nstring *mui_dll; + uint32 ressource_id; + [relative] nstring *display_name; + uint16 lang_id; + uint16 unused; + } spoolss_FormInfo2; + + typedef [nodiscriminant,relative_base,public,gensize,flag(NDR_RELATIVE_REVERSE)] union { + [case(1)] spoolss_FormInfo1 info1; + [case(2)] spoolss_FormInfo2 info2; + [default]; + } spoolss_FormInfo; + + typedef struct { + spoolss_FormFlags flags; + [string,charset(UTF16)] uint16 *form_name; + spoolss_FormSize size; + spoolss_FormArea area; + } spoolss_AddFormInfo1; + + typedef struct { + spoolss_FormFlags flags; + [string,charset(UTF16)] uint16 *form_name; + spoolss_FormSize size; + spoolss_FormArea area; + [string,charset(DOS)] uint8 *keyword; + spoolss_FormStringType string_type; + [string,charset(UTF16)] uint16 *mui_dll; + uint32 ressource_id; + [string,charset(UTF16)] uint16 *display_name; + uint32 lang_id; + } spoolss_AddFormInfo2; + + typedef [ms_union,switch_type(uint32)] union { + [case(1)] spoolss_AddFormInfo1 *info1; + [case(2)] spoolss_AddFormInfo2 *info2; + } spoolss_AddFormInfo; + + typedef [public] struct { + uint32 level; + [switch_is(level)] spoolss_AddFormInfo info; + } spoolss_AddFormInfoCtr; + + WERROR spoolss_AddForm( + [in,ref] policy_handle *handle, + [in,ref] spoolss_AddFormInfoCtr *info_ctr + ); + + /******************/ + /* Function: 0x1f */ + WERROR spoolss_DeleteForm( + [in,ref] policy_handle *handle, + [in] [string,charset(UTF16)] uint16 form_name[] + ); + + /******************/ + /* Function: 0x20 */ + WERROR spoolss_GetForm( + [in,ref] policy_handle *handle, + [in] [string,charset(UTF16)] uint16 form_name[], + [in] uint32 level, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_FormInfo *info, + [out,ref] uint32 *needed + ); + + /******************/ + /* Function: 0x21 */ + WERROR spoolss_SetForm( + [in,ref] policy_handle *handle, + [in] [string,charset(UTF16)] uint16 form_name[], + [in,ref] spoolss_AddFormInfoCtr *info_ctr + ); + + /******************/ + /* Function: 0x22 */ + [public,noopnum,noprint] WERROR _spoolss_EnumForms( + [in,ref] policy_handle *handle, + [in] uint32 level, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [out,unique] DATA_BLOB *info, + [out,ref] uint32 *needed, + [out,ref] uint32 *count + ); + [public,noopnum,noprint] void __spoolss_EnumForms( + [in] uint32 level, + [in] uint32 count, + [out,switch_is(level)] spoolss_FormInfo info[count] + ); + [nopull,nopush] WERROR spoolss_EnumForms( + [in,ref] policy_handle *handle, + [in] uint32 level, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [out,ref] uint32 *count, + [out,ref,switch_is(level),size_is(,*count)] spoolss_FormInfo **info, + [out,ref] uint32 *needed + ); + + /* + * Special strings for the OpenPrinter() call. See the MSDN DDK + * docs on the XcvDataPort() for more details. + */ + + const string SPL_LOCAL_PORT = "Local Port"; + const string SPL_TCPIP_PORT = "Standard TCP/IP Port"; + const string SPL_XCV_MONITOR_LOCALMON = ",XcvMonitor Local Port"; + const string SPL_XCV_MONITOR_TCPMON = ",XcvMonitor Standard TCP/IP Port"; + + typedef [public,gensize] struct { + [relative] nstring *port_name; + } spoolss_PortInfo1; + + typedef bitmap { + SPOOLSS_PORT_TYPE_WRITE = 0x00000001, + SPOOLSS_PORT_TYPE_READ = 0x00000002, + SPOOLSS_PORT_TYPE_REDIRECTED = 0x00000004, + SPOOLSS_PORT_TYPE_NET_ATTACHED = 0x00000008 + } spoolss_PortType; + + typedef [public,gensize] struct { + [relative] nstring *port_name; + [relative] nstring *monitor_name; + [relative] nstring *description; + spoolss_PortType port_type; + uint32 reserved; + } spoolss_PortInfo2; + + typedef [v1_enum] enum { + PORT_STATUS_CLEAR = 0x00000000, + PORT_STATUS_OFFLINE = 0x00000001, + PORT_STATUS_PAPER_JAM = 0x00000002, + PORT_STATUS_PAPER_OUT = 0x00000003, + PORT_STATUS_OUTPUT_BIN_FULL = 0x00000004, + PORT_STATUS_PAPER_PROBLEM = 0x00000005, + PORT_STATUS_NO_TONER = 0x00000006, + PORT_STATUS_DOOR_OPEN = 0x00000007, + PORT_STATUS_USER_INTERVENTION = 0x00000008, + PORT_STATUS_OUT_OF_MEMORY = 0x00000009, + PORT_STATUS_TONER_LOW = 0x0000000A, + PORT_STATUS_WARMING_UP = 0x0000000B, + PORT_STATUS_POWER_SAVE = 0x0000000C + } spoolss_PortStatus; + + typedef [v1_enum] enum { + PORT_STATUS_TYPE_ERROR = 0x00000001, + PORT_STATUS_TYPE_WARNING = 0x00000002, + PORT_STATUS_TYPE_INFO = 0x00000003 + } spoolss_PortSeverity; + + typedef [public,gensize] struct { + spoolss_PortStatus status; + [relative] nstring *status_string; + spoolss_PortSeverity severity; + } spoolss_PortInfo3; + + typedef [public,gensize] struct { + [relative] nstring *port_name; + DATA_BLOB monitor_data; /* relative ?? */ + } spoolss_PortInfoFF; + + typedef [nodiscriminant,relative_base,public,flag(NDR_RELATIVE_REVERSE)] union { + [case(1)] spoolss_PortInfo1 info1; + [case(2)] spoolss_PortInfo2 info2; + [case(3)] spoolss_PortInfo3 info3; + [case(0xff)] spoolss_PortInfoFF infoFF; + [default]; + } spoolss_PortInfo; + + /******************/ + /* Function: 0x23 */ + [public,noopnum,noprint] WERROR _spoolss_EnumPorts( + [in,unique] [string,charset(UTF16)] uint16 *servername, + [in] uint32 level, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [out,unique] DATA_BLOB *info, + [out,ref] uint32 *needed, + [out,ref] uint32 *count + ); + [public,noopnum,noprint] void __spoolss_EnumPorts( + [in] uint32 level, + [in] uint32 count, + [out,switch_is(level)] spoolss_PortInfo info[count] + ); + [nopull,nopush] WERROR spoolss_EnumPorts( + [in,unique] [string,charset(UTF16)] uint16 *servername, + [in] uint32 level, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [out,ref] uint32 *count, + [out,ref,switch_is(level),size_is(,*count)] spoolss_PortInfo **info, + [out,ref] uint32 *needed + ); + + /******************/ + /* Function: 0x24 */ + typedef [public,gensize] struct { + [relative] nstring *monitor_name; + } spoolss_MonitorInfo1; + + typedef [public,gensize] struct { + [relative] nstring *monitor_name; + [relative] nstring *environment; + [relative] nstring *dll_name; + } spoolss_MonitorInfo2; + + typedef [nodiscriminant,relative_base,public,flag(NDR_RELATIVE_REVERSE)] union { + [case(1)] spoolss_MonitorInfo1 info1; + [case(2)] spoolss_MonitorInfo2 info2; + [default]; + } spoolss_MonitorInfo; + + [public,noopnum,noprint] WERROR _spoolss_EnumMonitors( + [in,unique] [string,charset(UTF16)] uint16 *servername, + [in] uint32 level, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [out,unique] DATA_BLOB *info, + [out,ref] uint32 *needed, + [out,ref] uint32 *count + ); + [public,noopnum,noprint] void __spoolss_EnumMonitors( + [in] uint32 level, + [in] uint32 count, + [out,switch_is(level)] spoolss_MonitorInfo info[count] + ); + [nopull,nopush] WERROR spoolss_EnumMonitors( + [in,unique] [string,charset(UTF16)] uint16 *servername, + [in] uint32 level, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [out,ref] uint32 *count, + [out,ref,switch_is(level),size_is(,*count)] spoolss_MonitorInfo **info, + [out,ref] uint32 *needed + ); + + /******************/ + /* Function: 0x25 */ + + typedef [public,gensize] struct { + [string,charset(UTF16)] uint16 *port_name; + } spoolss_SetPortInfo1; + + typedef [public,gensize] struct { + [string,charset(UTF16)] uint16 *port_name; + [string,charset(UTF16)] uint16 *monitor_name; + [string,charset(UTF16)] uint16 *description; + spoolss_PortType port_type; + uint32 reserved; + } spoolss_SetPortInfo2; + + typedef [public,gensize] struct { + spoolss_PortStatus status; + [string,charset(UTF16)] uint16 *status_string; + spoolss_PortSeverity severity; + } spoolss_SetPortInfo3; + + typedef [public,gensize] struct { + [string,charset(UTF16)] uint16 *port_name; + DATA_BLOB monitor_data; /* relative ?? */ + } spoolss_SetPortInfoFF; + + typedef [ms_union,switch_type(uint32)] union { + [case(1)] spoolss_SetPortInfo1 *info1; + [case(2)] spoolss_SetPortInfo2 *info2; + [case(3)] spoolss_SetPortInfo3 *info3; + [case(0xff)] spoolss_SetPortInfoFF *infoFF; + } spoolss_SetPortInfo; + + typedef [public] struct { + uint32 level; + [switch_is(level)] spoolss_SetPrinterInfo info; + } spoolss_SetPortInfoContainer; + + WERROR spoolss_AddPort( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in] uint32 unknown, + [in] [string,charset(UTF16)] uint16 monitor_name[] + ); + + /******************/ + /* Function: 0x26 */ + [todo] WERROR spoolss_ConfigurePort( + ); + + /******************/ + /* Function: 0x27 */ + WERROR spoolss_DeletePort( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in] uint3264 ptr, /* ULONG_PTR */ + [in,ref] [string,charset(UTF16)] uint16 *port_name + ); + + /******************/ + /* Function: 0x28 */ + WERROR spoolss_CreatePrinterIC( + [in,ref] policy_handle *handle, + [out,ref] policy_handle *gdi_handle, + [in,ref] spoolss_DevmodeContainer *devmode_ctr + ); + + /******************/ + /* Function: 0x29 */ + + typedef struct { + uint32 Checksum; + uint32 Index; + } UNIVERSAL_FONT_ID; + + typedef [public] struct { + uint32 count; + UNIVERSAL_FONT_ID fonts[count]; + } UNIVERSAL_FONT_ID_ctr; + + WERROR spoolss_PlayGDIScriptOnPrinterIC( + [in,ref] policy_handle *gdi_handle, + [in,ref] [size_is(cIn)] uint8 *pIn, + [in] uint32 cIn, + [out,ref] [size_is(cOut)] uint8 *pOut, + [in] uint32 cOut, + [in] uint32 ul + ); + + /******************/ + /* Function: 0x2a */ + WERROR spoolss_DeletePrinterIC( + [in,out,ref] policy_handle *gdi_handle + ); + + /******************/ + /* Function: 0x2b */ + [todo] WERROR spoolss_AddPrinterConnection( + ); + + /******************/ + /* Function: 0x2c */ + [todo] WERROR spoolss_DeletePrinterConnection( + ); + + /******************/ + /* Function: 0x2d */ + [todo] WERROR spoolss_PrinterMessageBox( + /* Marked as obsolete in MSDN. "Not necessary and has + no effect". */ + ); + + /******************/ + /* Function: 0x2e */ + + typedef struct { + [string,charset(UTF16)] uint16 *monitor_name; + } spoolss_AddMonitorInfo1; + + typedef struct { + [string,charset(UTF16)] uint16 *monitor_name; + [string,charset(UTF16)] uint16 *environment; + [string,charset(UTF16)] uint16 *dll_name; + } spoolss_AddMonitorInfo2; + + typedef [ms_union,switch_type(uint32)] union { + [case(1)] spoolss_AddMonitorInfo1 *info1; + [case(2)] spoolss_AddMonitorInfo2 *info2; + } spoolss_AddMonitorInfo; + + typedef [public] struct { + uint32 level; + [switch_is(level)] spoolss_MonitorInfo info; + } spoolss_MonitorContainer; + + [todo] WERROR spoolss_AddMonitor( + ); + + /******************/ + /* Function: 0x2f */ + [todo] WERROR spoolss_DeleteMonitor( + ); + + /******************/ + /* Function: 0x30 */ + WERROR spoolss_DeletePrintProcessor( + [in,unique] [string,charset(UTF16)] uint16 *server, + [in,unique] [string,charset(UTF16)] uint16 *architecture, + [in] [string,charset(UTF16)] uint16 print_processor_name[] + ); + + /******************/ + /* Function: 0x31 */ + [todo] WERROR spoolss_AddPrintProvidor( + ); + + /******************/ + /* Function: 0x32 */ + [todo] WERROR spoolss_DeletePrintProvidor( + ); + + /******************/ + /* Function: 0x33 */ + + typedef [public,gensize] struct { + [relative] nstring *name_array; + } spoolss_PrintProcDataTypesInfo1; + + typedef [nodiscriminant,relative_base,public,flag(NDR_RELATIVE_REVERSE)] union { + [case(1)] spoolss_PrintProcDataTypesInfo1 info1; + [default]; + } spoolss_PrintProcDataTypesInfo; + + [public,noopnum,noprint] WERROR _spoolss_EnumPrintProcessorDataTypes( + [in,unique] [string,charset(UTF16)] uint16 *servername, + [in,unique] [string,charset(UTF16)] uint16 *print_processor_name, + [in] uint32 level, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [out,unique] DATA_BLOB *info, + [out,ref] uint32 *needed, + [out,ref] uint32 *count + ); + [public,noopnum,noprint] void __spoolss_EnumPrintProcessorDataTypes( + [in] uint32 level, + [in] uint32 count, + [out,switch_is(level)] spoolss_PrintProcDataTypesInfo info[count] + ); + [nopull,nopush] WERROR spoolss_EnumPrintProcessorDataTypes( + [in,unique] [string,charset(UTF16)] uint16 *servername, + [in,unique] [string,charset(UTF16)] uint16 *print_processor_name, + [in] uint32 level, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [out,ref] uint32 *count, + [out,ref,switch_is(level),size_is(,*count)] spoolss_PrintProcDataTypesInfo **info, + [out,ref] uint32 *needed + ); + + /******************/ + /* Function: 0x34 */ + WERROR spoolss_ResetPrinter( + [in,ref] policy_handle *handle, + [in,unique] [string,charset(UTF16)] uint16 *data_type, + [in,ref] spoolss_DevmodeContainer *devmode_ctr + ); + + /******************/ + /* Function: 0x35 */ + [public] WERROR spoolss_GetPrinterDriver2( + [in,ref] policy_handle *handle, + [in,unique] [string,charset(UTF16)] uint16 *architecture, + [in] uint32 level, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [in] uint32 client_major_version, + [in] uint32 client_minor_version, + [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_DriverInfo *info, + [out,ref] uint32 *needed, + [out,ref] uint32 *server_major_version, + [out,ref] uint32 *server_minor_version + ); + + /******************/ + /* Function: 0x36 */ + [todo] WERROR spoolss_FindFirstPrinterChangeNotification( + ); + + /******************/ + /* Function: 0x37 */ + [todo] WERROR spoolss_FindNextPrinterChangeNotification( + ); + + /******************/ + /* Function: 0x38 */ + [public] WERROR spoolss_FindClosePrinterNotify( + [in,ref] policy_handle *handle + ); + + /******************/ + /* Function: 0x39 */ + [todo] WERROR spoolss_RouterFindFirstPrinterChangeNotificationOld( + ); + + /******************/ + /* Function: 0x3a */ + [public] WERROR spoolss_ReplyOpenPrinter( + [in,string,charset(UTF16)] uint16 server_name[], + [in] uint32 printer_local, + [in] winreg_Type type, + [in,range(0,512)] uint32 bufsize, + [in,unique,size_is(bufsize)] uint8 *buffer, + [out,ref] policy_handle *handle + ); + + /******************/ + /* Function: 0x3b */ + + typedef [bitmap32bit] bitmap { + PRINTER_CHANGE_ADD_PRINTER = 0x00000001, + PRINTER_CHANGE_SET_PRINTER = 0x00000002, + PRINTER_CHANGE_DELETE_PRINTER = 0x00000004, + PRINTER_CHANGE_FAILED_CONNECTION_PRINTER = 0x00000008, + PRINTER_CHANGE_ADD_JOB = 0x00000100, + PRINTER_CHANGE_SET_JOB = 0x00000200, + PRINTER_CHANGE_DELETE_JOB = 0x00000400, + PRINTER_CHANGE_WRITE_JOB = 0x00000800, + PRINTER_CHANGE_ADD_FORM = 0x00010000, + PRINTER_CHANGE_SET_FORM = 0x00020000, + PRINTER_CHANGE_DELETE_FORM = 0x00040000, + PRINTER_CHANGE_ADD_PORT = 0x00100000, + PRINTER_CHANGE_CONFIGURE_PORT = 0x00200000, + PRINTER_CHANGE_DELETE_PORT = 0x00400000, + PRINTER_CHANGE_ADD_PRINT_PROCESSOR = 0x01000000, + PRINTER_CHANGE_DELETE_PRINT_PROCESSOR = 0x04000000, + PRINTER_CHANGE_SERVER = 0x08000000, + PRINTER_CHANGE_ADD_PRINTER_DRIVER = 0x10000000, + PRINTER_CHANGE_SET_PRINTER_DRIVER = 0x20000000, + PRINTER_CHANGE_DELETE_PRINTER_DRIVER = 0x40000000, + PRINTER_CHANGE_TIMEOUT = 0x80000000 + } spoolss_PrinterChangeFlags; + + const int PRINTER_CHANGE_PRINTER = 0x000000FF; + + const int PRINTER_CHANGE_JOB = 0x0000FF00; + + const int PRINTER_CHANGE_FORM = (PRINTER_CHANGE_ADD_FORM | + PRINTER_CHANGE_SET_FORM | + PRINTER_CHANGE_DELETE_FORM); /* 0x00070000 */ + + const int PRINTER_CHANGE_PORT = (PRINTER_CHANGE_ADD_PORT | + PRINTER_CHANGE_CONFIGURE_PORT | + PRINTER_CHANGE_DELETE_PORT); /* 0x00700000 */ + + const int PRINTER_CHANGE_PRINT_PROCESSOR = 0x07000000; + + const int PRINTER_CHANGE_PRINTER_DRIVER = (PRINTER_CHANGE_ADD_PRINTER_DRIVER | + PRINTER_CHANGE_SET_PRINTER_DRIVER | + PRINTER_CHANGE_DELETE_PRINTER_DRIVER); /* 0x70000000 */ + + const int PRINTER_CHANGE_ALL = (PRINTER_CHANGE_PRINTER | + PRINTER_CHANGE_JOB | + PRINTER_CHANGE_FORM | + PRINTER_CHANGE_PORT | + PRINTER_CHANGE_PRINT_PROCESSOR | + PRINTER_CHANGE_PRINTER_DRIVER); /* 0x7777FFFF */ + WERROR spoolss_RouterReplyPrinter( + [in,ref] policy_handle *handle, + [in] spoolss_PrinterChangeFlags flags, + [in,range(0,512)] uint32 bufsize, + [in,unique,size_is(bufsize)] uint8 *buffer + ); + + /******************/ + /* Function: 0x3c */ + [public] WERROR spoolss_ReplyClosePrinter( + [in,out,ref] policy_handle *handle + ); + + /******************/ + /* Function: 0x3d */ + + typedef [public] struct { + uint32 monitor_data_size; + [size_is(monitor_data_size),unique] uint8 *monitor_data; + } spoolss_PortVarContainer; + + WERROR spoolss_AddPortEx( + [in,unique] [string,charset(UTF16)] uint16 *servername, + [in,ref] spoolss_SetPortInfoContainer *port_ctr, + [in,ref] spoolss_PortVarContainer *port_var_ctr, + [in,unique] [string,charset(UTF16)] uint16 *monitor_name + ); + + /******************/ + /* Function: 0x3e */ + [todo] WERROR spoolss_RouterFindFirstPrinterChangeNotification( + ); + + /******************/ + /* Function: 0x3f */ + [todo] WERROR spoolss_SpoolerInit( + ); + + /******************/ + /* Function: 0x40 */ + [todo] WERROR spoolss_ResetPrinterEx( + ); + + typedef [enum16bit,public] enum { + JOB_NOTIFY_FIELD_PRINTER_NAME = 0x00, + JOB_NOTIFY_FIELD_MACHINE_NAME = 0x01, + JOB_NOTIFY_FIELD_PORT_NAME = 0x02, + JOB_NOTIFY_FIELD_USER_NAME = 0x03, + JOB_NOTIFY_FIELD_NOTIFY_NAME = 0x04, + JOB_NOTIFY_FIELD_DATATYPE = 0x05, + JOB_NOTIFY_FIELD_PRINT_PROCESSOR = 0x06, + JOB_NOTIFY_FIELD_PARAMETERS = 0x07, + JOB_NOTIFY_FIELD_DRIVER_NAME = 0x08, + JOB_NOTIFY_FIELD_DEVMODE = 0x09, + JOB_NOTIFY_FIELD_STATUS = 0x0a, + JOB_NOTIFY_FIELD_STATUS_STRING = 0x0b, + JOB_NOTIFY_FIELD_SECURITY_DESCRIPTOR = 0x0c, + JOB_NOTIFY_FIELD_DOCUMENT = 0x0d, + JOB_NOTIFY_FIELD_PRIORITY = 0x0e, + JOB_NOTIFY_FIELD_POSITION = 0x0f, + JOB_NOTIFY_FIELD_SUBMITTED = 0x10, + JOB_NOTIFY_FIELD_START_TIME = 0x11, + JOB_NOTIFY_FIELD_UNTIL_TIME = 0x12, + JOB_NOTIFY_FIELD_TIME = 0x13, + JOB_NOTIFY_FIELD_TOTAL_PAGES = 0x14, + JOB_NOTIFY_FIELD_PAGES_PRINTED = 0x15, + JOB_NOTIFY_FIELD_TOTAL_BYTES = 0x16, + JOB_NOTIFY_FIELD_BYTES_PRINTED = 0x17 + } spoolss_JobNotifyField; + + typedef [enum16bit,public] enum { + PRINTER_NOTIFY_FIELD_SERVER_NAME = 0x00, + PRINTER_NOTIFY_FIELD_PRINTER_NAME = 0x01, + PRINTER_NOTIFY_FIELD_SHARE_NAME = 0x02, + PRINTER_NOTIFY_FIELD_PORT_NAME = 0x03, + PRINTER_NOTIFY_FIELD_DRIVER_NAME = 0x04, + PRINTER_NOTIFY_FIELD_COMMENT = 0x05, + PRINTER_NOTIFY_FIELD_LOCATION = 0x06, + PRINTER_NOTIFY_FIELD_DEVMODE = 0x07, + PRINTER_NOTIFY_FIELD_SEPFILE = 0x08, + PRINTER_NOTIFY_FIELD_PRINT_PROCESSOR = 0x09, + PRINTER_NOTIFY_FIELD_PARAMETERS = 0x0a, + PRINTER_NOTIFY_FIELD_DATATYPE = 0x0b, + PRINTER_NOTIFY_FIELD_SECURITY_DESCRIPTOR = 0x0c, + PRINTER_NOTIFY_FIELD_ATTRIBUTES = 0x0d, + PRINTER_NOTIFY_FIELD_PRIORITY = 0x0e, + PRINTER_NOTIFY_FIELD_DEFAULT_PRIORITY = 0x0f, + PRINTER_NOTIFY_FIELD_START_TIME = 0x10, + PRINTER_NOTIFY_FIELD_UNTIL_TIME = 0x11, + PRINTER_NOTIFY_FIELD_STATUS = 0x12, + PRINTER_NOTIFY_FIELD_STATUS_STRING = 0x13, + PRINTER_NOTIFY_FIELD_CJOBS = 0x14, + PRINTER_NOTIFY_FIELD_AVERAGE_PPM = 0x15, + PRINTER_NOTIFY_FIELD_TOTAL_PAGES = 0x16, + PRINTER_NOTIFY_FIELD_PAGES_PRINTED = 0x17, + PRINTER_NOTIFY_FIELD_TOTAL_BYTES = 0x18, + PRINTER_NOTIFY_FIELD_BYTES_PRINTED = 0x19, + PRINTER_NOTIFY_FIELD_OBJECT_GUID = 0x1a, + PRINTER_NOTIFY_FIELD_FRIENDLY_NAME = 0x1b + } spoolss_PrintNotifyField; + + typedef [enum16bit] enum { + PRINTER_NOTIFY_TYPE = 0x00, + JOB_NOTIFY_TYPE = 0x01 + } spoolss_NotifyType; + + typedef [nodiscriminant,noprint] union { + [case(PRINTER_NOTIFY_TYPE)] uint16 field; + [case(JOB_NOTIFY_TYPE)] uint16 field; + [default] uint16 field; + } spoolss_Field; + + /******************/ + /* Function: 0x41 */ + typedef struct { + spoolss_NotifyType type; + uint16 u1; + uint32 u2; + uint32 u3; + uint32 count; + [size_is(count),switch_is(type)] spoolss_Field *fields; + } spoolss_NotifyOptionType; + + typedef [bitmap32bit] bitmap { + PRINTER_NOTIFY_OPTIONS_REFRESH = 0x00000001 + } spoolssNotifyOptionFlags; + + typedef [public] struct { + [value(2)] uint32 version; + spoolssNotifyOptionFlags flags; + uint32 count; + [size_is(count)] spoolss_NotifyOptionType *types; + } spoolss_NotifyOption; + + [public] WERROR spoolss_RemoteFindFirstPrinterChangeNotifyEx( + [in,ref] policy_handle *handle, + [in] spoolss_PrinterChangeFlags flags, + [in] uint32 options, + [in,unique] [string,charset(UTF16)] uint16 *local_machine, + [in] uint32 printer_local, + [in,unique] spoolss_NotifyOption *notify_options + ); + + /******************/ + /* Function: 0x42 */ + + typedef struct { + uint32 size; + [size_is(size/2),unique,charset(UTF16)] uint16 *string; + } spoolss_NotifyString; + + typedef [v1_enum] enum { + NOTIFY_TABLE_DWORD = 0x0001, + NOTIFY_TABLE_STRING = 0x0002, + NOTIFY_TABLE_DEVMODE = 0x0003, + NOTIFY_TABLE_TIME = 0x0004, + NOTIFY_TABLE_SECURITYDESCRIPTOR = 0x0005 + } spoolss_NotifyTable; + + typedef [ms_union, switch_type(uint32)] union { + [case(1)] uint32 integer[2]; + [case(2)] spoolss_NotifyString string; + [case(3)] spoolss_DevmodeContainer devmode; + [case(4)] spoolss_TimeCtr time; + [case(5)] sec_desc_buf sd; + } spoolss_NotifyData; + + typedef struct { + spoolss_NotifyType type; + [switch_is(type)] spoolss_Field field; + spoolss_NotifyTable variable_type; + uint32 job_id; + [switch_is(variable_type)] spoolss_NotifyData data; + } spoolss_Notify; + + typedef [public] struct { + [value(2)] uint32 version; + uint32 flags; + uint32 count; + [size_is(count)] spoolss_Notify notifies[]; + } spoolss_NotifyInfo; + + typedef [ms_union,switch_type(uint32)] union { + [case(0)] spoolss_NotifyInfo *info0; + } spoolss_ReplyPrinterInfo; + + typedef [bitmap32bit] bitmap { + PRINTER_NOTIFY_INFO_DISCARDED = 0x00000001, + PRINTER_NOTIFY_INFO_DISCARDNOTED = 0x00010000, + PRINTER_NOTIFY_INFO_COLOR_MISMATCH = 0x00080000 + } spoolss_PrinterNotifyFlags; + + WERROR spoolss_RouterReplyPrinterEx( + [in,ref] policy_handle *handle, + [in] uint32 color, + [in] spoolss_PrinterChangeFlags flags, + [out,ref] spoolss_PrinterNotifyFlags *reply_result, + [in] uint32 reply_type, + [in,switch_is(reply_type)] spoolss_ReplyPrinterInfo info + ); + + /******************/ + /* Function: 0x43 */ + [public] WERROR spoolss_RouterRefreshPrinterChangeNotify( + [in,ref] policy_handle *handle, + [in] uint32 change_low, + [in,unique] spoolss_NotifyOption *options, + [out,ref] spoolss_NotifyInfo **info + ); + + /******************/ + /* Function: 0x44 */ + [todo] WERROR spoolss_44( + ); + + typedef struct { + uint32 size; + [string,charset(UTF16)] uint16 *client; + [string,charset(UTF16)] uint16 *user; + uint32 build; + spoolss_MajorVersion major; + spoolss_MinorVersion minor; + spoolss_ProcessorArchitecture processor; + } spoolss_UserLevel1; + + typedef struct { + uint32 not_used; + } spoolss_UserLevel2; + + typedef struct { + uint32 size; + uint32 flags; + uint32 size2; + [string,charset(UTF16)] uint16 *client; + [string,charset(UTF16)] uint16 *user; + uint32 build; + spoolss_MajorVersion major; + spoolss_MinorVersion minor; + spoolss_ProcessorArchitecture processor; + udlong reserved; + } spoolss_UserLevel3; + + typedef [ms_union,switch_type(uint32)] union { + [case(1)] spoolss_UserLevel1 *level1; + [case(2)] spoolss_UserLevel2 *level2; + [case(3)] spoolss_UserLevel3 *level3; + } spoolss_UserLevel; + + typedef [public] struct { + uint32 level; + [switch_is(level)] spoolss_UserLevel user_info; + } spoolss_UserLevelCtr; + + typedef bitmap { + SERVER_ACCESS_ADMINISTER = 0x00000001, + SERVER_ACCESS_ENUMERATE = 0x00000002, + PRINTER_ACCESS_ADMINISTER = 0x00000004, + PRINTER_ACCESS_USE = 0x00000008, + JOB_ACCESS_ADMINISTER = 0x00000010, + JOB_ACCESS_READ = 0x00000020 + } spoolss_AccessRights; + + /* Access rights for print servers */ + const int SERVER_ALL_ACCESS = SEC_STD_REQUIRED | + SERVER_ACCESS_ADMINISTER | + SERVER_ACCESS_ENUMERATE; + + const int SERVER_READ = SEC_STD_READ_CONTROL | + SERVER_ACCESS_ENUMERATE; + + const int SERVER_WRITE = STANDARD_RIGHTS_WRITE_ACCESS | + SERVER_ACCESS_ADMINISTER | + SERVER_ACCESS_ENUMERATE; + + const int SERVER_EXECUTE = SEC_STD_READ_CONTROL | + SERVER_ACCESS_ENUMERATE; + + /* Access rights for printers */ + const int PRINTER_ALL_ACCESS = SEC_STD_REQUIRED | + PRINTER_ACCESS_ADMINISTER | + PRINTER_ACCESS_USE; + + const int PRINTER_READ = SEC_STD_READ_CONTROL | + PRINTER_ACCESS_USE; + + const int PRINTER_WRITE = STANDARD_RIGHTS_WRITE_ACCESS | + PRINTER_ACCESS_USE; + + const int PRINTER_EXECUTE = SEC_STD_READ_CONTROL | + PRINTER_ACCESS_USE; + + /* Access rights for jobs */ + const int JOB_ALL_ACCESS = SEC_STD_REQUIRED | + JOB_ACCESS_ADMINISTER; + + const int JOB_READ = SEC_STD_READ_CONTROL | + JOB_ACCESS_ADMINISTER; + + const int JOB_WRITE = STANDARD_RIGHTS_WRITE_ACCESS | + JOB_ACCESS_ADMINISTER; + + const int JOB_EXECUTE = SEC_STD_READ_CONTROL | + JOB_ACCESS_ADMINISTER; + + /* ACE masks for various print permissions */ + const int PRINTER_ACE_FULL_CONTROL = SEC_GENERIC_ALL | + PRINTER_ALL_ACCESS; + + const int PRINTER_ACE_MANAGE_DOCUMENTS = SEC_GENERIC_ALL | + SEC_STD_READ_CONTROL; + + const int PRINTER_ACE_PRINT = SEC_GENERIC_EXECUTE | + SEC_STD_READ_CONTROL | + PRINTER_ACCESS_USE; + + /******************/ + /* Function: 0x45 */ + [public] WERROR spoolss_OpenPrinterEx( + [in,unique] [string,charset(UTF16)] uint16 *printername, + [in,unique] [string,charset(UTF16)] uint16 *datatype, + [in] spoolss_DevmodeContainer devmode_ctr, + [in] spoolss_AccessRights access_mask, + [in] spoolss_UserLevelCtr userlevel_ctr, + [out,ref] policy_handle *handle + ); + + /******************/ + /* Function: 0x46 */ + WERROR spoolss_AddPrinterEx( + [in,unique] [string,charset(UTF16)] uint16 *server, + [in,ref] spoolss_SetPrinterInfoCtr *info_ctr, + [in,ref] spoolss_DevmodeContainer *devmode_ctr, + [in,ref] sec_desc_buf *secdesc_ctr, + [in,ref] spoolss_UserLevelCtr *userlevel_ctr, + [out,ref] policy_handle *handle + ); + + /******************/ + /* Function: 0x47 */ + WERROR spoolss_SetPort( + [in,unique] [string,charset(UTF16)] uint16 *servername, + [in,unique] [string,charset(UTF16)] uint16 *port_name, + [in,ref] spoolss_SetPortInfoContainer *port_ctr + ); + + /******************/ + /* Function: 0x48 */ + WERROR spoolss_EnumPrinterData( + [in,ref] policy_handle *handle, + [in] uint32 enum_index, + [out,size_is(value_offered/2),charset(UTF16)] uint16 value_name[], + [in] uint32 value_offered, + [out,ref] uint32 *value_needed, + [out,ref] winreg_Type *type, + [out,ref,size_is(data_offered),flag(LIBNDR_PRINT_ARRAY_HEX)] uint8 *data, + [in] uint32 data_offered, + [out,ref] uint32 *data_needed + ); + + /******************/ + /* Function: 0x49 */ + WERROR spoolss_DeletePrinterData( + [in,ref] policy_handle *handle, + [in] [string,charset(UTF16)] uint16 value_name[] + ); + + /******************/ + /* Function: 0x4a */ + [todo] WERROR spoolss_4a( + ); + + /******************/ + /* Function: 0x4b */ + [todo] WERROR spoolss_4b( + ); + + /******************/ + /* Function: 0x4c */ + [todo] WERROR spoolss_4c( + ); + + /******************/ + /* Function: 0x4d */ + WERROR spoolss_SetPrinterDataEx( + [in,ref] policy_handle *handle, + [in] [string,charset(UTF16)] uint16 key_name[], + [in] [string,charset(UTF16)] uint16 value_name[], + [in] winreg_Type type, + [in,ref] [size_is(offered)] uint8 *data, + [in] uint32 offered + ); + + /******************/ + /* Function: 0x4e */ + WERROR spoolss_GetPrinterDataEx( + [in,ref] policy_handle *handle, + [in] [string,charset(UTF16)] uint16 key_name[], + [in] [string,charset(UTF16)] uint16 value_name[], + [out,ref] winreg_Type *type, + [out,ref,size_is(offered)] uint8 *data, + [in] uint32 offered, + [out,ref] uint32 *needed + ); + + /******************/ + /* Function: 0x4f */ + + typedef [relative_base,public,gensize] struct { + [relative] nstring *value_name; + [value(2*strlen_m_term(value_name))] uint32 value_name_len; + winreg_Type type; + [relative,subcontext(0),subcontext_size(data_length),flag(NDR_REMAINING|ndr_spoolss_PrinterEnumValues_align(r->type))] DATA_BLOB *data; + [value(data ? data->length : 0)] uint32 data_length; + } spoolss_PrinterEnumValues; + + [public,noopnum,noprint] WERROR _spoolss_EnumPrinterDataEx( + [in,ref] policy_handle *handle, + [in] [string,charset(UTF16)] uint16 key_name[], + [out] DATA_BLOB info, + [in] uint32 offered, + [out,ref] uint32 *needed, + [out,ref] uint32 *count + ); + [public,noopnum,noprint] void __spoolss_EnumPrinterDataEx( + [in] uint32 count, + [out] spoolss_PrinterEnumValues info[count] + ); + [nopull,nopush] WERROR spoolss_EnumPrinterDataEx( + [in,ref] policy_handle *handle, + [in] [string,charset(UTF16)] uint16 key_name[], + [in] uint32 offered, + [out,ref] uint32 *count, + [out,ref,size_is(,*count)] spoolss_PrinterEnumValues **info, + [out,ref] uint32 *needed + ); + + typedef [nodiscriminant] union { + [case(0)]; + [case(1)]; + [default] nstring_array string_array; + } spoolss_KeyNames; + + /******************/ + /* Function: 0x50 */ + [public] WERROR spoolss_EnumPrinterKey( + [in, ref] policy_handle *handle, + [in] [string,charset(UTF16)] uint16 key_name[], + [out,ref] uint32 *_ndr_size, + [out,ref,subcontext(0),subcontext_size(*_ndr_size*2),switch_is(*_ndr_size)] spoolss_KeyNames *key_buffer, + [in] uint32 offered, + [out,ref] uint32 *needed + ); + + /******************/ + /* Function: 0x51 */ + WERROR spoolss_DeletePrinterDataEx( + [in,ref] policy_handle *handle, + [in] [string,charset(UTF16)] uint16 key_name[], + [in] [string,charset(UTF16)] uint16 value_name[] + ); + + /******************/ + /* Function: 0x52 */ + WERROR spoolss_DeletePrinterKey( + [in,ref] policy_handle *handle, + [in] [string,charset(UTF16)] uint16 key_name[] + ); + + /******************/ + /* Function: 0x53 */ + [todo] WERROR spoolss_53( + ); + + /******************/ + /* Function: 0x54 */ + typedef [public,bitmap32bit] bitmap { + DPD_DELETE_UNUSED_FILES = 0x00000001, + DPD_DELETE_SPECIFIC_VERSION = 0x00000002, + DPD_DELETE_ALL_FILES = 0x00000004 + } spoolss_DeleteDriverFlags; + + WERROR spoolss_DeletePrinterDriverEx( + [in,unique] [string,charset(UTF16)] uint16 *server, + [in] [string,charset(UTF16)] uint16 architecture[], + [in] [string,charset(UTF16)] uint16 driver[], + [in] spoolss_DeleteDriverFlags delete_flags, + [in] uint32 version + ); + + /******************/ + /* Function: 0x55 */ + WERROR spoolss_AddPerMachineConnection( + [in,unique] [string,charset(UTF16)] uint16 *server, + [in,ref] [string,charset(UTF16)] uint16 *printername, + [in,ref] [string,charset(UTF16)] uint16 *printserver, + [in,ref] [string,charset(UTF16)] uint16 *provider + ); + + /******************/ + /* Function: 0x56 */ + WERROR spoolss_DeletePerMachineConnection( + [in,unique] [string,charset(UTF16)] uint16 *server, + [in,ref] [string,charset(UTF16)] uint16 *printername + ); + + /******************/ + /* Function: 0x57 */ + [public,noopnum,noprint] WERROR _spoolss_EnumPerMachineConnections( + [in,unique] [string,charset(UTF16)] uint16 *server, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [out,unique] DATA_BLOB *info, + [out,ref] uint32 *needed, + [out,ref] uint32 *count + ); + [public,noopnum,noprint] void __spoolss_EnumPerMachineConnections( + [in] uint32 count, + [out] spoolss_PrinterInfo4 info[count] + ); + [nopull,nopush] WERROR spoolss_EnumPerMachineConnections( + [in,unique] [string,charset(UTF16)] uint16 *server, + [in,unique] DATA_BLOB *buffer, + [in] uint32 offered, + [out,ref] uint32 *count, + [out,ref,size_is(,*count)] spoolss_PrinterInfo4 **info, + [out,ref] uint32 *needed + ); + + /******************/ + /* Function: 0x58 */ + + typedef [v1_enum] enum { + PROTOCOL_RAWTCP_TYPE = 1, + PROTOCOL_LPR_TYPE = 2 + } spoolss_PortProtocol; + + typedef [public,gensize] struct { + [charset(UTF16)] uint16 portname[64]; + [value(0x00000001)] uint32 version; + spoolss_PortProtocol protocol; + [value(ndr_size_spoolss_PortData1(r, ndr->flags))] uint32 size; + uint32 reserved; + [charset(UTF16)] uint16 hostaddress[49]; + [charset(UTF16)] uint16 snmpcommunity[33]; + uint32 dblspool; + [charset(UTF16)] uint16 queue[33]; + [charset(UTF16)] uint16 ip_address[16]; /* s3 had 17 */ + [charset(UTF16)] uint16 hardware_address[13]; + [charset(UTF16)] uint16 device_type[257]; + uint32 port_number; + boolean32 snmp_enabled; + uint32 snmp_dev_index; + } spoolss_PortData1; + + typedef [public,gensize] struct { + [charset(UTF16)] uint16 portname[64]; + [value(0x00000002)] uint32 version; + spoolss_PortProtocol protocol; + [value(ndr_size_spoolss_PortData2(r, ndr->flags))] uint32 size; + uint32 reserved; + [charset(UTF16)] uint16 hostaddress[128]; + [charset(UTF16)] uint16 snmpcommunity[33]; + uint32 dblspool; + [charset(UTF16)] uint16 queue[33]; + [charset(UTF16)] uint16 device_type[257]; + uint32 port_number; + boolean32 snmp_enabled; + uint32 snmp_dev_index; + uint32 port_monitor_mib_index; + } spoolss_PortData2; + + typedef [public] struct { + nstring dll_name; + } spoolss_MonitorUi; + + WERROR spoolss_XcvData( + [in,ref] policy_handle *handle, + [in] [string,charset(UTF16)] uint16 function_name[], + [in] DATA_BLOB in_data, + [in,value(r->in.in_data.length)] uint32 _in_data_length, + [out,ref] [size_is(out_data_size)] uint8 *out_data, + [in] uint32 out_data_size, + [out,ref] uint32 *needed, + [in,out,ref] uint32 *status_code + ); + + /******************/ + /* Function: 0x59 */ + + typedef [bitmap32bit] bitmap { + APD_STRICT_UPGRADE = 0x00000001, + APD_STRICT_DOWNGRADE = 0x00000002, + APD_COPY_ALL_FILES = 0x00000004, + APD_COPY_NEW_FILES = 0x00000008, + APD_COPY_FROM_DIRECTORY = 0x00000010, + APD_DONT_COPY_FILES_TO_CLUSTER = 0x00001000, + APD_COPY_TO_ALL_SPOOLERS = 0x00002000, + APD_RETURN_BLOCKING_STATUS_CODE = 0x00010000 + } spoolss_AddPrinterDriverExFlags; + + [public] WERROR spoolss_AddPrinterDriverEx( + [in,unique] [string,charset(UTF16)] uint16 *servername, + [in,ref] spoolss_AddDriverInfoCtr *info_ctr, + [in] spoolss_AddPrinterDriverExFlags flags + ); + + /******************/ + /* Function: 0x5a */ + [todo] WERROR spoolss_5a( + ); + + /******************/ + /* Function: 0x5b */ + [todo] WERROR spoolss_5b( + ); + + /******************/ + /* Function: 0x5c */ + [todo] WERROR spoolss_5c( + ); + + /******************/ + /* Function: 0x5d */ + [todo] WERROR spoolss_5d( + ); + + /******************/ + /* Function: 0x5e */ + [todo] WERROR spoolss_5e( + ); + + /******************/ + /* Function: 0x5f */ + [todo] WERROR spoolss_5f( + ); + + /******************/ + /* Function: 0x60 */ + [todo] WERROR spoolss_60( + ); + + /******************/ + /* Function: 0x61 */ + + const string BIDI_ACTION_ENUM_SCHEMA = "EnumSchema"; + const string BIDI_ACTION_GET = "Get"; + const string BIDI_ACTION_SET = "Set"; + const string BIDI_ACTION_GET_ALL = "GetAll"; + + typedef enum { + BIDI_NULL = 0x00000000, + BIDI_INT = 0x00000001, + BIDI_FLOAT = 0x00000002, + BIDI_BOOL = 0x00000003, + BIDI_STRING = 0x00000004, + BIDI_TEXT = 0x00000005, + BIDI_ENUM = 0x00000006, + BIDI_BLOB = 0x00000007 + } BIDI_TYPE; + + typedef struct { + uint32 cbBuf; + [size_is(cbBuf), unique] uint8 *pszString; + } RPC_BINARY_CONTAINER; + + typedef [ms_union,switch_type(uint32)] union { + [case(BIDI_NULL)] uint32 bData; + [case(BIDI_BOOL)] uint32 bData; + [case(BIDI_INT)] uint32 iData; + [case(BIDI_STRING)] [unique] [string,charset(UTF16)] uint16 *sData; + [case(BIDI_TEXT)] [unique] [string,charset(UTF16)] uint16 *sData; + [case(BIDI_ENUM)] [unique] [string,charset(UTF16)] uint16 *sData; + /*[case(BIDI_FLOAT)] float fData;*/ + [case(BIDI_BLOB)] RPC_BINARY_CONTAINER biData; + } RPC_BIDI_DATA_u; + + typedef struct { + uint32 dwBidiType; + [switch_is(dwBidiType)] RPC_BIDI_DATA_u u; + } RPC_BIDI_DATA; + + typedef struct { + uint32 dwReqNumber; + [unique] [string,charset(UTF16)] uint16 *pSchema; + RPC_BIDI_DATA data; + } RPC_BIDI_REQUEST_DATA; + + typedef [public] struct { + [value(1)] uint32 Version; + uint32 Flags; + uint32 Count; + [size_is(Count), unique] RPC_BIDI_REQUEST_DATA *aData[]; + } RPC_BIDI_REQUEST_CONTAINER; + + typedef struct { + uint32 dwResult; + uint32 dwReqNumber; + [unique] [string,charset(UTF16)] uint16 *pSchema; + RPC_BIDI_DATA data; + } RPC_BIDI_RESPONSE_DATA; + + typedef [public] struct { + [value(1)] uint32 Version; + uint32 Flags; + uint32 Count; + [size_is(Count), unique] RPC_BIDI_RESPONSE_DATA *aData[]; + } RPC_BIDI_RESPONSE_CONTAINER; + + WERROR spoolss_SendRecvBidiData( + [in] policy_handle hPrinter, + [in,unique] [string,charset(UTF16)] uint16 *pAction, + [in] RPC_BIDI_REQUEST_CONTAINER *pReqData, + [out] RPC_BIDI_RESPONSE_CONTAINER **ppRespData + ); + + /******************/ + /* Function: 0x62 */ + [todo] WERROR spoolss_62( + ); + + /******************/ + /* Function: 0x63 */ + [todo] WERROR spoolss_63( + ); + + /******************/ + /* Function: 0x64 */ + [todo] WERROR spoolss_64( + ); + + /******************/ + /* Function: 0x65 */ + [todo] WERROR spoolss_65( + ); + + /******************/ + /* Function: 0x66 */ + + const string SPOOLSS_CORE_PRINT_PACKAGE_FILES_UNIDRV = "{D20EA372-DD35-4950-9ED8-A6335AFE79F0}"; + const string SPOOLSS_CORE_PRINT_PACKAGE_FILES_PSCRIPT = "{D20EA372-DD35-4950-9ED8-A6335AFE79F1}"; + const string SPOOLSS_CORE_PRINT_PACKAGE_FILES_PCLXL = "{D20EA372-DD35-4950-9ED8-A6335AFE79F2}"; + const string SPOOLSS_CORE_PRINT_PACKAGE_FILES_PLOTTER = "{D20EA372-DD35-4950-9ED8-A6335AFE79F4}"; + const string SPOOLSS_CORE_PRINT_PACKAGE_FILES_XPSDRV = "{D20EA372-DD35-4950-9ED8-A6335AFE79F5}"; + + typedef [public] struct { + GUID core_driver_guid; + NTTIME driver_date; + hyper driver_version; + [charset(UTF16),to_null] uint16 szPackageID[260]; + } spoolss_CorePrinterDriver; + + [public] HRESULT spoolss_GetCorePrinterDrivers( + [in,unique] [string,charset(UTF16)] uint16 *servername, + [in,ref] [string,charset(UTF16)] uint16 *architecture, + [in] uint32 core_driver_size, + [in,size_is(core_driver_size)] uint16 *core_driver_dependencies, + [in] uint32 core_printer_driver_count, + [out,size_is(core_printer_driver_count)] spoolss_CorePrinterDriver *core_printer_drivers + ); + + /******************/ + /* Function: 0x67 */ + [todo] WERROR spoolss_67( + ); + + /******************/ + /* Function: 0x68 */ + HRESULT spoolss_GetPrinterDriverPackagePath( + [in,unique] [string,charset(UTF16)] uint16 *servername, + [in,ref] [string,charset(UTF16)] uint16 *architecture, + [in,unique] [string,charset(UTF16)] uint16 *language, + [in,ref] [string,charset(UTF16)] uint16 *package_id, + [in,out,unique,size_is(driver_package_cab_size)] [charset(UTF16)] uint16 *driver_package_cab, + [in] uint32 driver_package_cab_size, + [out,ref] uint32 *required + ); + + /******************/ + /* Function: 0x69 */ + [todo] WERROR spoolss_69( + ); + + /******************/ + /* Function: 0x6a */ + [todo] WERROR spoolss_6a( + ); + + /******************/ + /* Function: 0x6b */ + [todo] WERROR spoolss_6b( + ); + + /******************/ + /* Function: 0x6c */ + [todo] WERROR spoolss_6c( + ); + + /******************/ + /* Function: 0x6d */ + [todo] WERROR spoolss_6d( + ); + + /******************/ + /* Function: 0x6e */ + + const string SPLFILE_CONTENT_TYPE_PROP_NAME = "Spool File Contents"; + const string SPLFILE_CONTENT_TYPE_XPS_MS = "TYPE_XPS_MS"; + const string SPLFILE_CONTENT_TYPE_XPS_OPEN = "TYPE_XPS_OPEN"; + const string SPLFILE_CONTENT_TYPE_PDL_POSTSCRIPT = "TYPE_PDL_POSTSCRIPT"; + const string SPLFILE_CONTENT_TYPE_PDL_UNKNOWN = "TYPE_PDL_UNKNOWN"; + + typedef enum { + kRpcPropertyTypeString = 1, + kRpcPropertyTypeInt32 = 2, + kRpcPropertyTypeInt64 = 3, + kRpcPropertyTypeByte = 4, + kRpcPropertyTypeBuffer = 5 + } spoolss_EPrintPropertyType; + + typedef struct { + uint32 cbBuf; + [size_is(cbBuf)] uint8 *pBuf; + } propertyBlob; + + typedef [ms_union,switch_type(spoolss_EPrintPropertyType)] union { + [case(kRpcPropertyTypeString)] [string,charset(UTF16)] uint16 *propertyString; + [case(kRpcPropertyTypeInt32)] uint32 propertyInt32; + [case(kRpcPropertyTypeInt64)] hyper propertyInt64; + [case(kRpcPropertyTypeByte)] uint8 propertyByte; + [case(kRpcPropertyTypeBuffer)] propertyBlob propertyBlob; + } spoolss_PrintPropertyValueUnion; + + typedef [public] struct { + spoolss_EPrintPropertyType ePropertyType; + [switch_is(ePropertyType)] spoolss_PrintPropertyValueUnion value; + } spoolss_PrintPropertyValue; + + typedef [public] struct { + [string,charset(UTF16)] uint16 *propertyName; + spoolss_PrintPropertyValue propertyValue; + } spoolss_PrintNamedProperty; + + WERROR spoolss_GetJobNamedPropertyValue( + [in,ref] policy_handle *hPrinter, + [in] uint32 JobId, + [in] [string,charset(UTF16)] uint16 *pszName, + [out,ref] spoolss_PrintPropertyValue *pValue + ); + + /******************/ + /* Function: 0x6f */ + [public] WERROR spoolss_SetJobNamedProperty( + [in,ref] policy_handle *hPrinter, + [in] uint32 JobId, + [in,ref] spoolss_PrintNamedProperty *pProperty + ); + + /******************/ + /* Function: 0x70 */ + WERROR spoolss_DeleteJobNamedProperty( + [in,ref] policy_handle *hPrinter, + [in] uint32 JobId, + [in] [string,charset(UTF16)] uint16 *pszName + ); + + /******************/ + /* Function: 0x71 */ + WERROR spoolss_EnumJobNamedProperties( + [in,ref] policy_handle *hPrinter, + [in] uint32 JobId, + [out,ref] uint32 *pcProperties, + [out,ref,size_is(,*pcProperties)] spoolss_PrintNamedProperty **ppProperties + ); + + /******************/ + /* Function: 0x72 */ + [todo] WERROR spoolss_72( + ); + + /******************/ + /* Function: 0x73 */ + [todo] WERROR spoolss_73( + ); + + /******************/ + /* Function: 0x71 */ + typedef enum { + kInvalidJobState = 0, + kLogJobPrinted = 1, + kLogJobRendered = 2, + kLogJobError = 3, + kLogJobPipelineError = 4, + kLogOfflineFileFull = 5 + } EBranchOfficeJobEventType; + + typedef struct { + DWORD Status; + [string,charset(UTF16)] uint16 *pDocumentName; + [string,charset(UTF16)] uint16 *pUserName; + [string,charset(UTF16)] uint16 *pMachineName; + [string,charset(UTF16)] uint16 *pPrinterName; + [string,charset(UTF16)] uint16 *pPortName; + hyper Size; + DWORD TotalPages; + } spoolss_BranchOfficeJobDataPrinted; + + typedef struct { + hyper Size; + DWORD ICMMethod; + short Color; + short PrintQuality; + short YResolution; + short Copies; + short TTOption; + } spoolss_BranchOfficeJobDataRendered; + + typedef struct { + WERROR LastError; + [string,charset(UTF16)] uint16 *pDocumentName; + [string,charset(UTF16)] uint16 *pUserName; + [string,charset(UTF16)] uint16 *pPrinterName; + [string,charset(UTF16)] uint16 *pDataType; + hyper TotalSize; + hyper PrintedSize; + DWORD TotalPages; + DWORD PrintedPages; + [string,charset(UTF16)] uint16 *pMachineName; + [string,charset(UTF16)] uint16 *pJobError; + [string,charset(UTF16)] uint16 *pErrorDescription; + } spoolss_BranchOfficeJobDataError; + + typedef struct { + [string,charset(UTF16)] uint16 *pDocumentName; + [string,charset(UTF16)] uint16 *pPrinterName; + [string,charset(UTF16)] uint16 *pExtraErrorInfo; + } spoolss_BranchOfficeJobDataPipelineFailed; + + typedef struct { + [string,charset(UTF16)] uint16 *pMachineName; + } spoolss_BranchOfficeLogOfflineFileFull; + + typedef [ms_union,switch_type(EBranchOfficeJobEventType)] union { + [case(kLogJobPrinted)] + spoolss_BranchOfficeJobDataPrinted LogJobPrinted; + [case(kLogJobRendered)] + spoolss_BranchOfficeJobDataRendered LogJobRendered; + [case(kLogJobError)] + spoolss_BranchOfficeJobDataError LogJobError; + [case(kLogJobPipelineError)] + spoolss_BranchOfficeJobDataPipelineFailed LogPipelineFailed; + [case(kLogOfflineFileFull)] + spoolss_BranchOfficeLogOfflineFileFull LogOfflineFileFull; + } spoolss_BranchOfficeJobInfo; + + typedef struct { + EBranchOfficeJobEventType eEventType; + DWORD JobId; + [switch_is(eEventType)] spoolss_BranchOfficeJobInfo JobInfo; + } spoolss_BranchOfficeJobData; + + typedef [public] struct { + DWORD cJobDataEntries; + [size_is(cJobDataEntries)] spoolss_BranchOfficeJobData JobData[]; + } spoolss_BranchOfficeJobDataContainer; + + WERROR spoolss_LogJobInfoForBranchOffice( + [in,ref] policy_handle *hPrinter, + [in,ref] spoolss_BranchOfficeJobDataContainer *pBranchOfficeJobDataContainer + ); + +} diff --git a/librpc/idl/srvsvc.idl b/librpc/idl/srvsvc.idl new file mode 100644 index 0000000..db804e5 --- /dev/null +++ b/librpc/idl/srvsvc.idl @@ -0,0 +1,1569 @@ +#include "idl_types.h" + +/* + srvsvc interface definitions +*/ +import "misc.idl", "security.idl", "svcctl.idl"; + +[ uuid("4b324fc8-1670-01d3-1278-5a47bf6ee188"), + version(3.0), + endpoint("ncacn_np:[\\pipe\\srvsvc]", "ncacn_ip_tcp:", "ncalrpc:"), + pointer_default(unique), + helpstring("Server Service") +] interface srvsvc +{ + typedef bitmap svcctl_ServerType svcctl_ServerType; + typedef bitmap security_secinfo security_secinfo; + +/**************************/ +/* srvsvc_NetCharDev */ +/**************************/ + typedef struct { + [string,charset(UTF16)] uint16 *device; + } srvsvc_NetCharDevInfo0; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetCharDevInfo0 *array; + } srvsvc_NetCharDevCtr0; + + typedef struct { + [string,charset(UTF16)] uint16 *device; + uint32 status; + [string,charset(UTF16)] uint16 *user; + uint32 time; + } srvsvc_NetCharDevInfo1; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetCharDevInfo1 *array; + } srvsvc_NetCharDevCtr1; + + typedef union { + [case(0)] srvsvc_NetCharDevInfo0 *info0; + [case(1)] srvsvc_NetCharDevInfo1 *info1; + [default] ; + } srvsvc_NetCharDevInfo; + + typedef union { + [case(0)] srvsvc_NetCharDevCtr0 *ctr0; + [case(1)] srvsvc_NetCharDevCtr1 *ctr1; + [default] ; + } srvsvc_NetCharDevCtr; + + typedef struct { + uint32 level; + [switch_is(level)] srvsvc_NetCharDevCtr ctr; + } srvsvc_NetCharDevInfoCtr; + + /******************/ + /* Function: 0x00 */ + WERROR srvsvc_NetCharDevEnum( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in,out,ref] srvsvc_NetCharDevInfoCtr *info_ctr, + [in] uint32 max_buffer, + [out,ref] uint32 *totalentries, + [in,out,unique] uint32 *resume_handle + ); + + /******************/ + /* Function: 0x01 */ + WERROR srvsvc_NetCharDevGetInfo( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] [string,charset(UTF16)] uint16 device_name[], + [in] uint32 level, + [out,ref,switch_is(level)] srvsvc_NetCharDevInfo *info + ); + + /******************/ + /* Function: 0x02 */ + WERROR srvsvc_NetCharDevControl( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] [string,charset(UTF16)] uint16 device_name[], + [in] uint32 opcode + ); + +/**************************/ +/* srvsvc_NetCharDevQ */ +/**************************/ + typedef struct { + [string,charset(UTF16)] uint16 *device; + } srvsvc_NetCharDevQInfo0; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetCharDevQInfo0 *array; + } srvsvc_NetCharDevQCtr0; + + typedef struct { + [string,charset(UTF16)] uint16 *device; + uint32 priority; + [string,charset(UTF16)] uint16 *devices; + uint32 users; + uint32 num_ahead; + } srvsvc_NetCharDevQInfo1; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetCharDevQInfo1 *array; + } srvsvc_NetCharDevQCtr1; + + typedef union { + [case(0)] srvsvc_NetCharDevQInfo0 *info0; + [case(1)] srvsvc_NetCharDevQInfo1 *info1; + [default] ; + } srvsvc_NetCharDevQInfo; + + typedef union { + [case(0)] srvsvc_NetCharDevQCtr0 *ctr0; + [case(1)] srvsvc_NetCharDevQCtr1 *ctr1; + [default] ; + } srvsvc_NetCharDevQCtr; + + typedef struct { + uint32 level; + [switch_is(level)] srvsvc_NetCharDevQCtr ctr; + } srvsvc_NetCharDevQInfoCtr; + + /******************/ + /* Function: 0x03 */ + WERROR srvsvc_NetCharDevQEnum( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in,unique] [string,charset(UTF16)] uint16 *user, + [in,out,ref] srvsvc_NetCharDevQInfoCtr *info_ctr, + [in] uint32 max_buffer, + [out,ref] uint32 *totalentries, + [in,out,unique] uint32 *resume_handle + ); + + /******************/ + /* Function: 0x04 */ + WERROR srvsvc_NetCharDevQGetInfo( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] [string,charset(UTF16)] uint16 queue_name[], + [in] [string,charset(UTF16)] uint16 user[], + [in] uint32 level, + [out,switch_is(level),ref] srvsvc_NetCharDevQInfo *info + ); + + /******************/ + /* Function: 0x05 */ + WERROR srvsvc_NetCharDevQSetInfo( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] [string,charset(UTF16)] uint16 queue_name[], + [in] uint32 level, + [in,switch_is(level)] srvsvc_NetCharDevQInfo info, + [in,out,unique] uint32 *parm_error + ); + + /******************/ + /* Function: 0x06 */ + WERROR srvsvc_NetCharDevQPurge( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] [string,charset(UTF16)] uint16 queue_name[] + ); + + /******************/ + /* Function: 0x07 */ + WERROR srvsvc_NetCharDevQPurgeSelf( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] [string,charset(UTF16)] uint16 queue_name[], + [in] [string,charset(UTF16)] uint16 computer_name[] + ); + +/**************************/ +/* srvsvc_NetConn */ +/**************************/ + typedef struct { + uint32 conn_id; + } srvsvc_NetConnInfo0; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetConnInfo0 *array; + } srvsvc_NetConnCtr0; + + typedef struct { + uint32 conn_id; + uint32 conn_type; + uint32 num_open; + uint32 num_users; + uint32 conn_time; + [string,charset(UTF16)] uint16 *user; + [string,charset(UTF16)] uint16 *share; + } srvsvc_NetConnInfo1; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetConnInfo1 *array; + } srvsvc_NetConnCtr1; + + typedef union { + [case(0)] srvsvc_NetConnCtr0 *ctr0; + [case(1)] srvsvc_NetConnCtr1 *ctr1; + [default] ; + } srvsvc_NetConnCtr; + + typedef struct { + uint32 level; + [switch_is(level)] srvsvc_NetConnCtr ctr; + } srvsvc_NetConnInfoCtr; + + /******************/ + /* Function: 0x08 */ + WERROR srvsvc_NetConnEnum( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in,unique] [string,charset(UTF16)] uint16 *path, + [in,out,ref] srvsvc_NetConnInfoCtr *info_ctr, + [in] uint32 max_buffer, + [out,ref] uint32 *totalentries, + [in,out,unique] uint32 *resume_handle + ); + +/**************************/ +/* srvsvc_NetFile */ +/**************************/ + typedef struct { + uint32 fid; + } srvsvc_NetFileInfo2; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetFileInfo2 *array; + } srvsvc_NetFileCtr2; + + typedef struct { + uint32 fid; + uint32 permissions; + uint32 num_locks; + [string,charset(UTF16)] uint16 *path; + [string,charset(UTF16)] uint16 *user; + } srvsvc_NetFileInfo3; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetFileInfo3 *array; + } srvsvc_NetFileCtr3; + + typedef union { + [case(2)] srvsvc_NetFileInfo2 *info2; + [case(3)] srvsvc_NetFileInfo3 *info3; + [default] ; + } srvsvc_NetFileInfo; + + typedef union { + [case(2)] srvsvc_NetFileCtr2 *ctr2; + [case(3)] srvsvc_NetFileCtr3 *ctr3; + [default] ; + } srvsvc_NetFileCtr; + + typedef struct { + uint32 level; + [switch_is(level)] srvsvc_NetFileCtr ctr; + } srvsvc_NetFileInfoCtr; + + /******************/ + /* Function: 0x09 */ + WERROR srvsvc_NetFileEnum( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in,unique] [string,charset(UTF16)] uint16 *path, + [in,unique] [string,charset(UTF16)] uint16 *user, + [in,out,ref] srvsvc_NetFileInfoCtr *info_ctr, + [in] uint32 max_buffer, + [out,ref] uint32 *totalentries, + [in,out,unique] uint32 *resume_handle + ); + + /******************/ + /* Function: 0x0a */ + WERROR srvsvc_NetFileGetInfo( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] uint32 fid, + [in] uint32 level, + [out,switch_is(level),ref] srvsvc_NetFileInfo *info + ); + + /******************/ + /* Function: 0x0b */ + WERROR srvsvc_NetFileClose( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] uint32 fid + ); + +/**************************/ +/* srvsvc_NetSess */ +/**************************/ + typedef struct { + [string,charset(UTF16)] uint16 *client; + } srvsvc_NetSessInfo0; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetSessInfo0 *array; + } srvsvc_NetSessCtr0; + + typedef struct { + [string,charset(UTF16)] uint16 *client; + [string,charset(UTF16)] uint16 *user; + uint32 num_open; + uint32 time; + uint32 idle_time; + uint32 user_flags; + } srvsvc_NetSessInfo1; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetSessInfo1 *array; + } srvsvc_NetSessCtr1; + + typedef struct { + [string,charset(UTF16)] uint16 *client; + [string,charset(UTF16)] uint16 *user; + uint32 num_open; + uint32 time; + uint32 idle_time; + uint32 user_flags; + [string,charset(UTF16)] uint16 *client_type; + } srvsvc_NetSessInfo2; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetSessInfo2 *array; + } srvsvc_NetSessCtr2; + + typedef struct { + [string,charset(UTF16)] uint16 *client; + [string,charset(UTF16)] uint16 *user; + uint32 time; + uint32 idle_time; + } srvsvc_NetSessInfo10; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetSessInfo10 *array; + } srvsvc_NetSessCtr10; + + typedef struct { + [string,charset(UTF16)] uint16 *client; + [string,charset(UTF16)] uint16 *user; + uint32 num_open; + uint32 time; + uint32 idle_time; + uint32 user_flags; + [string,charset(UTF16)] uint16 *client_type; + [string,charset(UTF16)] uint16 *transport; + } srvsvc_NetSessInfo502; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetSessInfo502 *array; + } srvsvc_NetSessCtr502; + + typedef union { + [case(0)] srvsvc_NetSessCtr0 *ctr0; + [case(1)] srvsvc_NetSessCtr1 *ctr1; + [case(2)] srvsvc_NetSessCtr2 *ctr2; + [case(10)] srvsvc_NetSessCtr10 *ctr10; + [case(502)] srvsvc_NetSessCtr502 *ctr502; + [default] ; + } srvsvc_NetSessCtr; + + /******************/ + /* Function: 0x0c */ + + typedef struct { + uint32 level; + [switch_is(level)] srvsvc_NetSessCtr ctr; + } srvsvc_NetSessInfoCtr; + + WERROR srvsvc_NetSessEnum( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in,unique] [string,charset(UTF16)] uint16 *client, + [in,unique] [string,charset(UTF16)] uint16 *user, + [in,out,ref] srvsvc_NetSessInfoCtr *info_ctr, + [in] uint32 max_buffer, + [out,ref] uint32 *totalentries, + [in,out,unique] uint32 *resume_handle + ); + + /******************/ + /* Function: 0x0d */ + WERROR srvsvc_NetSessDel( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in,unique] [string,charset(UTF16)] uint16 *client, + [in,unique] [string,charset(UTF16)] uint16 *user + ); + +/**************************/ +/* srvsvc_NetShare */ +/**************************/ + + /* share types */ + const uint32 STYPE_TEMPORARY = 0x40000000; /* share is a temporary one */ + const uint32 STYPE_HIDDEN = 0x80000000; /* share is a hidden one */ + + typedef [v1_enum, flag(NDR_PAHEX)] enum { + STYPE_DISKTREE = 0, + STYPE_DISKTREE_TEMPORARY = STYPE_DISKTREE|STYPE_TEMPORARY, + STYPE_DISKTREE_HIDDEN = STYPE_DISKTREE|STYPE_HIDDEN, + STYPE_PRINTQ = 1, + STYPE_PRINTQ_TEMPORARY = STYPE_PRINTQ|STYPE_TEMPORARY, + STYPE_PRINTQ_HIDDEN = STYPE_PRINTQ|STYPE_HIDDEN, + STYPE_DEVICE = 2, /* Serial device */ + STYPE_DEVICE_TEMPORARY = STYPE_DEVICE|STYPE_TEMPORARY, + STYPE_DEVICE_HIDDEN = STYPE_DEVICE|STYPE_HIDDEN, + STYPE_IPC = 3, /* Interprocess communication (IPC) */ + STYPE_IPC_TEMPORARY = STYPE_IPC|STYPE_TEMPORARY, + STYPE_IPC_HIDDEN = STYPE_IPC|STYPE_HIDDEN, + STYPE_CLUSTER_FS = 0x02000000, /* A cluster share */ + STYPE_CLUSTER_FS_TEMPORARY = STYPE_CLUSTER_FS|STYPE_TEMPORARY, + STYPE_CLUSTER_FS_HIDDEN = STYPE_CLUSTER_FS|STYPE_HIDDEN, + STYPE_CLUSTER_SOFS = 0x04000000, /* A Scale-Out cluster share */ + STYPE_CLUSTER_SOFS_TEMPORARY = STYPE_CLUSTER_SOFS|STYPE_TEMPORARY, + STYPE_CLUSTER_SOFS_HIDDEN = STYPE_CLUSTER_SOFS|STYPE_HIDDEN, + STYPE_CLUSTER_DFS = 0x08000000, /* A DFS share in a cluster */ + STYPE_CLUSTER_DFS_TEMPORARY = STYPE_CLUSTER_DFS|STYPE_TEMPORARY, + STYPE_CLUSTER_DFS_HIDDEN = STYPE_CLUSTER_DFS|STYPE_HIDDEN + } srvsvc_ShareType; + + typedef struct { + [string,charset(UTF16)] uint16 *name; + } srvsvc_NetShareInfo0; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetShareInfo0 *array; + } srvsvc_NetShareCtr0; + + typedef struct { + [string,charset(UTF16)] uint16 *name; + srvsvc_ShareType type; + [string,charset(UTF16)] uint16 *comment; + } srvsvc_NetShareInfo1; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetShareInfo1 *array; + } srvsvc_NetShareCtr1; + + typedef struct { + [string,charset(UTF16)] uint16 *name; + srvsvc_ShareType type; + [string,charset(UTF16)] uint16 *comment; + uint32 permissions; + uint32 max_users; + uint32 current_users; + [string,charset(UTF16)] uint16 *path; + [string,charset(UTF16)] uint16 *password; + } srvsvc_NetShareInfo2; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetShareInfo2 *array; + } srvsvc_NetShareCtr2; + + typedef struct { + [string,charset(UTF16)] uint16 *name; + srvsvc_ShareType type; + [string,charset(UTF16)] uint16 *comment; + uint32 csc_policy; + } srvsvc_NetShareInfo501; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetShareInfo501 *array; + } srvsvc_NetShareCtr501; + + typedef struct { + [string,charset(UTF16)] uint16 *name; + srvsvc_ShareType type; + [string,charset(UTF16)] uint16 *comment; + uint32 permissions; + uint32 max_users; + uint32 current_users; + [string,charset(UTF16)] uint16 *path; + [string,charset(UTF16)] uint16 *password; + sec_desc_buf sd_buf; + } srvsvc_NetShareInfo502; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetShareInfo502 *array; + } srvsvc_NetShareCtr502; + + typedef struct { + [string,charset(UTF16)] uint16 *comment; + } srvsvc_NetShareInfo1004; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetShareInfo1004 *array; + } srvsvc_NetShareCtr1004; + + const uint32 SHARE_1005_CSC_CACHE_MANUAL_REINT = 0x00000000; + + typedef bitmap { + SHARE_1005_IN_DFS = 0x00000001, + SHARE_1005_DFS_ROOT = 0x00000002, + SHARE_1005_CSC_CACHE_AUTO_REINT = 0x00000010, + SHARE_1005_CSC_CACHE_VDO = 0x00000020, + SHARE_1005_CSC_CACHE_NONE = 0x00000030, + SHARE_1005_RESTRICT_EXCLUSIVE_OPENS = 0x00000100, + SHARE_1005_FORCE_SHARED_DELETE = 0x00000200, + SHARE_1005_ALLOW_NAMESPACE_CACHING = 0x00000400, + SHARE_1005_ACCESS_BASED_DIRECTORY_ENUM = 0x00000800, + SHARE_1005_FORCE_LEVELII_OPLOCK = 0x00001000, + SHARE_1005_ENABLE_HASH = 0x00002000, + SHARE_1005_ENABLE_CA = 0x00004000, + SHARE_1005_ENCRYPT_DATA = 0x00008000 + } NetShareInfo1005Flags; + + const uint32 SHARE_1005_CSC_POLICY_MASK = 0x00000030; + const uint32 SHARE_1005_CSC_POLICY_SHIFT = 4; + + typedef struct { + NetShareInfo1005Flags dfs_flags; + } srvsvc_NetShareInfo1005; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetShareInfo1005 *array; + } srvsvc_NetShareCtr1005; + + typedef struct { + uint32 max_users; + } srvsvc_NetShareInfo1006; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetShareInfo1006 *array; + } srvsvc_NetShareCtr1006; + + typedef struct { + uint32 flags; + [string,charset(UTF16)] uint16 *alternate_directory_name; + } srvsvc_NetShareInfo1007; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetShareInfo1007 *array; + } srvsvc_NetShareCtr1007; + + typedef struct { + uint32 count; + [size_is(count)] sec_desc_buf *array; + } srvsvc_NetShareCtr1501; + + typedef union { + [case(0)] srvsvc_NetShareInfo0 *info0; + [case(1)] srvsvc_NetShareInfo1 *info1; + [case(2)] srvsvc_NetShareInfo2 *info2; + [case(501)] srvsvc_NetShareInfo501 *info501; + [case(502)] srvsvc_NetShareInfo502 *info502; + [case(1004)] srvsvc_NetShareInfo1004 *info1004; + [case(1005)] srvsvc_NetShareInfo1005 *info1005; + [case(1006)] srvsvc_NetShareInfo1006 *info1006; + [case(1007)] srvsvc_NetShareInfo1007 *info1007; + [case(1501)] sec_desc_buf *info1501; + [default] ; + } srvsvc_NetShareInfo; + + typedef union { + [case(0)] srvsvc_NetShareCtr0 *ctr0; + [case(1)] srvsvc_NetShareCtr1 *ctr1; + [case(2)] srvsvc_NetShareCtr2 *ctr2; + [case(501)] srvsvc_NetShareCtr501 *ctr501; + [case(502)] srvsvc_NetShareCtr502 *ctr502; + [case(1004)] srvsvc_NetShareCtr1004 *ctr1004; + [case(1005)] srvsvc_NetShareCtr1005 *ctr1005; + [case(1006)] srvsvc_NetShareCtr1006 *ctr1006; + [case(1007)] srvsvc_NetShareCtr1007 *ctr1007; + [case(1501)] srvsvc_NetShareCtr1501 *ctr1501; + [default] ; + } srvsvc_NetShareCtr; + + typedef struct { + uint32 level; + [switch_is(level)] srvsvc_NetShareCtr ctr; + } srvsvc_NetShareInfoCtr; + + /******************/ + /* Function: 0x0e */ + WERROR srvsvc_NetShareAdd( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] uint32 level, + [in,ref,switch_is(level)] srvsvc_NetShareInfo *info, + [in,out,unique] uint32 *parm_error + ); + + /******************/ + /* Function: 0x0f */ + WERROR srvsvc_NetShareEnumAll ( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in,out,ref] srvsvc_NetShareInfoCtr *info_ctr, + [in] uint32 max_buffer, + [out,ref] uint32 *totalentries, + [in,out,unique] uint32 *resume_handle + ); + + /******************/ + /* Function: 0x10 */ + WERROR srvsvc_NetShareGetInfo( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] [string,charset(UTF16)] uint16 share_name[], + [in] uint32 level, + [out,ref,switch_is(level)] srvsvc_NetShareInfo *info + ); + + /******************/ + /* Function: 0x11 */ + WERROR srvsvc_NetShareSetInfo( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] [string,charset(UTF16)] uint16 share_name[], + [in] uint32 level, + [in,ref,switch_is(level)] srvsvc_NetShareInfo *info, + [in,out,unique] uint32 *parm_error + ); + + /******************/ + /* Function: 0x12 */ + WERROR srvsvc_NetShareDel( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] [string,charset(UTF16)] uint16 share_name[], + [in] uint32 reserved + ); + + /******************/ + /* Function: 0x13 */ + WERROR srvsvc_NetShareDelSticky( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] [string,charset(UTF16)] uint16 share_name[], + [in] uint32 reserved + ); + + /******************/ + /* Function: 0x14 */ + WERROR srvsvc_NetShareCheck( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] [string,charset(UTF16)] uint16 device_name[], + [out,ref] srvsvc_ShareType *type + ); + +/**************************/ +/* srvsvc_NetSrv */ +/**************************/ + typedef [public,v1_enum] enum { + PLATFORM_ID_DOS = 300, + PLATFORM_ID_OS2 = 400, + PLATFORM_ID_NT = 500, + PLATFORM_ID_OSF = 600, + PLATFORM_ID_VMS = 700 + } srvsvc_PlatformId; + + typedef [public] struct { + srvsvc_PlatformId platform_id; + [string,charset(UTF16)] uint16 *server_name; + } srvsvc_NetSrvInfo100; + + typedef [public] struct { + srvsvc_PlatformId platform_id; + [string,charset(UTF16)] uint16 *server_name; + uint32 version_major; + uint32 version_minor; + svcctl_ServerType server_type; + [string,charset(UTF16)] uint16 *comment; + } srvsvc_NetSrvInfo101; + + typedef struct { + srvsvc_PlatformId platform_id; + [string,charset(UTF16)] uint16 *server_name; + uint32 version_major; + uint32 version_minor; + svcctl_ServerType server_type; + [string,charset(UTF16)] uint16 *comment; + uint32 users; + uint32 disc; + uint32 hidden; + uint32 announce; + uint32 anndelta; + uint32 licenses; + [string,charset(UTF16)] uint16 *userpath; + } srvsvc_NetSrvInfo102; + + typedef struct { + uint32 ulist_mtime; + uint32 glist_mtime; + uint32 alist_mtime; + [string,charset(UTF16)] uint16 *alerts; + uint32 security; + uint32 numadmin; + uint32 lanmask; + [string,charset(UTF16)] uint16 *guestaccount; + uint32 chdevs; + uint32 chdevqs; + uint32 chdevjobs; + uint32 connections; + uint32 shares; + uint32 openfiles; + uint32 sessopen; + uint32 sesssvc; + uint32 sessreqs; + uint32 opensearch; + uint32 activelocks; + uint32 numreqbufs; + uint32 sizereqbufs; + uint32 numbigbufs; + uint32 numfiletasks; + uint32 alertsched; + uint32 erroralert; + uint32 logonalert; + uint32 accessalert; + uint32 diskalert; + uint32 netioalert; + uint32 maxaudits; + [string,charset(UTF16)] uint16 *srvheuristics; + } srvsvc_NetSrvInfo402; + + typedef struct { + uint32 ulist_mtime; + uint32 glist_mtime; + uint32 alist_mtime; + [string,charset(UTF16)] uint16 *alerts; + uint32 security; + uint32 numadmin; + uint32 lanmask; + [string,charset(UTF16)] uint16 *guestaccount; + uint32 chdevs; + uint32 chdevqs; + uint32 chdevjobs; + uint32 connections; + uint32 shares; + uint32 openfiles; + uint32 sessopen; + uint32 sesssvc; + uint32 sessreqs; + uint32 opensearch; + uint32 activelocks; + uint32 numreqbufs; + uint32 sizereqbufs; + uint32 numbigbufs; + uint32 numfiletasks; + uint32 alertsched; + uint32 erroralert; + uint32 logonalert; + uint32 accessalert; + uint32 diskalert; + uint32 netioalert; + uint32 maxaudits; + [string,charset(UTF16)] uint16 *srvheuristics; + uint32 auditedevents; + uint32 auditprofile; + [string,charset(UTF16)] uint16 *autopath; + } srvsvc_NetSrvInfo403; + + typedef struct { + uint32 sessopen; + uint32 sesssvc; + uint32 opensearch; + uint32 sizereqbufs; + uint32 initworkitems; + uint32 maxworkitems; + uint32 rawworkitems; + uint32 irpstacksize; + uint32 maxrawbuflen; + uint32 sessusers; + uint32 sessconns; + uint32 maxpagedmemoryusage; + uint32 maxnonpagedmemoryusage; + uint32 enablesoftcompat; + uint32 enableforcedlogoff; + uint32 timesource; + uint32 acceptdownlevelapis; + uint32 lmannounce; + } srvsvc_NetSrvInfo502; + + typedef struct{ + uint32 sessopen; + uint32 sesssvc; + uint32 opensearch; + uint32 sizereqbufs; + uint32 initworkitems; + uint32 maxworkitems; + uint32 rawworkitems; + uint32 irpstacksize; + uint32 maxrawbuflen; + uint32 sessusers; + uint32 sessconns; + uint32 maxpagedmemoryusage; + uint32 maxnonpagedmemoryusage; + uint32 enablesoftcompat; + uint32 enableforcedlogoff; + uint32 timesource; + uint32 acceptdownlevelapis; + uint32 lmannounce; + [string,charset(UTF16)] uint16 *domain; + uint32 maxcopyreadlen; + uint32 maxcopywritelen; + uint32 minkeepsearch; + uint32 maxkeepsearch; + uint32 minkeepcomplsearch; + uint32 maxkeepcomplsearch; + uint32 threadcountadd; + uint32 numlockthreads; + uint32 scavtimeout; + uint32 minrcvqueue; + uint32 minfreeworkitems; + uint32 xactmemsize; + uint32 threadpriority; + uint32 maxmpxct; + uint32 oplockbreakwait; + uint32 oplockbreakresponsewait; + uint32 enableoplocks; + uint32 enableoplockforceclose; + uint32 enablefcbopens; + uint32 enableraw; + uint32 enablesharednetdrives; + uint32 minfreeconnections; + uint32 maxfreeconnections; + } srvsvc_NetSrvInfo503; + + typedef struct{ + uint32 sessopen; + uint32 sesssvc; + uint32 opensearch; + uint32 sizereqbufs; + uint32 initworkitems; + uint32 maxworkitems; + uint32 rawworkitems; + uint32 irpstacksize; + uint32 maxrawbuflen; + uint32 sessusers; + uint32 sessconns; + uint32 maxpagedmemoryusage; + uint32 maxnonpagedmemoryusage; + uint32 enablesoftcompat; + uint32 enableforcedlogoff; + uint32 timesource; + uint32 acceptdownlevelapis; + uint32 lmannounce; + [string,charset(UTF16)] uint16 *domain; + uint32 maxcopyreadlen; + uint32 maxcopywritelen; + uint32 minkeepsearch; + uint32 minkeepcomplsearch; + uint32 maxkeepcomplsearch; + uint32 threadcountadd; + uint32 numlockthreads; + uint32 scavtimeout; + uint32 minrcvqueue; + uint32 minfreeworkitems; + uint32 xactmemsize; + uint32 threadpriority; + uint32 maxmpxct; + uint32 oplockbreakwait; + uint32 oplockbreakresponsewait; + uint32 enableoplocks; + uint32 enableoplockforceclose; + uint32 enablefcbopens; + uint32 enableraw; + uint32 enablesharednetdrives; + uint32 minfreeconnections; + uint32 maxfreeconnections; + uint32 initsesstable; + uint32 initconntable; + uint32 initfiletable; + uint32 initsearchtable; + uint32 alertsched; + uint32 errortreshold; + uint32 networkerrortreshold; + uint32 diskspacetreshold; + uint32 reserved; + uint32 maxlinkdelay; + uint32 minlinkthroughput; + uint32 linkinfovalidtime; + uint32 scavqosinfoupdatetime; + uint32 maxworkitemidletime; + } srvsvc_NetSrvInfo599; + + typedef struct{ + [string,charset(UTF16)] uint16 *comment; + } srvsvc_NetSrvInfo1005; + + typedef struct{ + uint32 disc; + } srvsvc_NetSrvInfo1010; + + typedef struct{ + uint32 hidden; + } srvsvc_NetSrvInfo1016; + + typedef struct{ + uint32 announce; + } srvsvc_NetSrvInfo1017; + + typedef struct{ + uint32 anndelta; + } srvsvc_NetSrvInfo1018; + + typedef struct{ + uint32 users; + } srvsvc_NetSrvInfo1107; + + typedef struct{ + uint32 sessopens; + } srvsvc_NetSrvInfo1501; + + typedef struct{ + uint32 sessvcs; + } srvsvc_NetSrvInfo1502; + + typedef struct{ + uint32 opensearch; + } srvsvc_NetSrvInfo1503; + + typedef struct{ + uint32 maxworkitems; + } srvsvc_NetSrvInfo1506; + + typedef struct{ + uint32 maxrawbuflen; + } srvsvc_NetSrvInfo1509; + + typedef struct{ + uint32 sessusers; + } srvsvc_NetSrvInfo1510; + + typedef struct{ + uint32 sesscons; + } srvsvc_NetSrvInfo1511; + + typedef struct{ + uint32 maxnonpagedmemoryusage; + } srvsvc_NetSrvInfo1512; + + typedef struct{ + uint32 maxpagedmemoryusage; + } srvsvc_NetSrvInfo1513; + + typedef struct{ + uint32 enablesoftcompat; + } srvsvc_NetSrvInfo1514; + + typedef struct{ + uint32 enableforcedlogoff; + } srvsvc_NetSrvInfo1515; + + typedef struct{ + uint32 timesource; + } srvsvc_NetSrvInfo1516; + + typedef struct{ + uint32 lmannounce; + } srvsvc_NetSrvInfo1518; + + typedef struct{ + uint32 maxcopyreadlen; + } srvsvc_NetSrvInfo1520; + + typedef struct{ + uint32 maxcopywritelen; + } srvsvc_NetSrvInfo1521; + + typedef struct{ + uint32 minkeepsearch; + } srvsvc_NetSrvInfo1522; + + typedef struct{ + uint32 maxkeepsearch; + } srvsvc_NetSrvInfo1523; + + typedef struct{ + uint32 minkeepcomplsearch; + } srvsvc_NetSrvInfo1524; + + typedef struct{ + uint32 maxkeepcomplsearch; + } srvsvc_NetSrvInfo1525; + + typedef struct{ + uint32 scavtimeout; + } srvsvc_NetSrvInfo1528; + + typedef struct{ + uint32 minrcvqueue; + } srvsvc_NetSrvInfo1529; + + typedef struct{ + uint32 minfreeworkitems; + } srvsvc_NetSrvInfo1530; + + typedef struct{ + uint32 maxmpxct; + } srvsvc_NetSrvInfo1533; + + typedef struct{ + uint32 oplockbreakwait; + } srvsvc_NetSrvInfo1534; + + typedef struct{ + uint32 oplockbreakresponsewait; + } srvsvc_NetSrvInfo1535; + + typedef struct{ + uint32 enableoplocks; + } srvsvc_NetSrvInfo1536; + + typedef struct{ + uint32 enableoplockforceclose; + } srvsvc_NetSrvInfo1537; + + typedef struct{ + uint32 enablefcbopens; + } srvsvc_NetSrvInfo1538; + + typedef struct{ + uint32 enableraw; + } srvsvc_NetSrvInfo1539; + + typedef struct{ + uint32 enablesharednetdrives; + } srvsvc_NetSrvInfo1540; + + typedef struct{ + uint32 minfreeconnections; + } srvsvc_NetSrvInfo1541; + + typedef struct{ + uint32 maxfreeconnections; + } srvsvc_NetSrvInfo1542; + + typedef struct{ + uint32 initsesstable; + } srvsvc_NetSrvInfo1543; + + typedef struct{ + uint32 initconntable; + } srvsvc_NetSrvInfo1544; + + typedef struct{ + uint32 initfiletable; + } srvsvc_NetSrvInfo1545; + + typedef struct{ + uint32 initsearchtable; + } srvsvc_NetSrvInfo1546; + + typedef struct{ + uint32 alertsched; + } srvsvc_NetSrvInfo1547; + + typedef struct{ + uint32 errortreshold; + } srvsvc_NetSrvInfo1548; + + typedef struct{ + uint32 networkerrortreshold; + } srvsvc_NetSrvInfo1549; + + typedef struct{ + uint32 diskspacetreshold; + } srvsvc_NetSrvInfo1550; + + typedef struct{ + uint32 maxlinkdelay; + } srvsvc_NetSrvInfo1552; + + typedef struct{ + uint32 minlinkthroughput; + } srvsvc_NetSrvInfo1553; + + typedef struct{ + uint32 linkinfovalidtime; + } srvsvc_NetSrvInfo1554; + + typedef struct{ + uint32 scavqosinfoupdatetime; + } srvsvc_NetSrvInfo1555; + + typedef struct{ + uint32 maxworkitemidletime; + } srvsvc_NetSrvInfo1556; + + + typedef union{ + [case(100)] srvsvc_NetSrvInfo100 *info100; + [case(101)] srvsvc_NetSrvInfo101 *info101; + [case(102)] srvsvc_NetSrvInfo102 *info102; + [case(402)] srvsvc_NetSrvInfo402 *info402; + [case(403)] srvsvc_NetSrvInfo403 *info403; + [case(502)] srvsvc_NetSrvInfo502 *info502; + [case(503)] srvsvc_NetSrvInfo503 *info503; + [case(599)] srvsvc_NetSrvInfo599 *info599; + [case(1005)] srvsvc_NetSrvInfo1005 *info1005; + [case(1010)] srvsvc_NetSrvInfo1010 *info1010; + [case(1016)] srvsvc_NetSrvInfo1016 *info1016; + [case(1017)] srvsvc_NetSrvInfo1017 *info1017; + [case(1018)] srvsvc_NetSrvInfo1018 *info1018; + [case(1107)] srvsvc_NetSrvInfo1107 *info1107; + [case(1501)] srvsvc_NetSrvInfo1501 *info1501; + [case(1502)] srvsvc_NetSrvInfo1502 *info1502; + [case(1503)] srvsvc_NetSrvInfo1503 *info1503; + [case(1506)] srvsvc_NetSrvInfo1506 *info1506; + [case(1509)] srvsvc_NetSrvInfo1509 *info1509; + [case(1510)] srvsvc_NetSrvInfo1510 *info1510; + [case(1511)] srvsvc_NetSrvInfo1511 *info1511; + [case(1512)] srvsvc_NetSrvInfo1512 *info1512; + [case(1513)] srvsvc_NetSrvInfo1513 *info1513; + [case(1514)] srvsvc_NetSrvInfo1514 *info1514; + [case(1515)] srvsvc_NetSrvInfo1515 *info1515; + [case(1516)] srvsvc_NetSrvInfo1516 *info1516; + [case(1518)] srvsvc_NetSrvInfo1518 *info1518; + [case(1520)] srvsvc_NetSrvInfo1520 *info1520; + [case(1521)] srvsvc_NetSrvInfo1521 *info1521; + [case(1522)] srvsvc_NetSrvInfo1522 *info1522; + [case(1523)] srvsvc_NetSrvInfo1523 *info1523; + [case(1524)] srvsvc_NetSrvInfo1524 *info1524; + [case(1525)] srvsvc_NetSrvInfo1525 *info1525; + [case(1528)] srvsvc_NetSrvInfo1528 *info1528; + [case(1529)] srvsvc_NetSrvInfo1529 *info1529; + [case(1530)] srvsvc_NetSrvInfo1530 *info1530; + [case(1533)] srvsvc_NetSrvInfo1533 *info1533; + [case(1534)] srvsvc_NetSrvInfo1534 *info1534; + [case(1535)] srvsvc_NetSrvInfo1535 *info1535; + [case(1536)] srvsvc_NetSrvInfo1536 *info1536; + [case(1537)] srvsvc_NetSrvInfo1537 *info1537; + [case(1538)] srvsvc_NetSrvInfo1538 *info1538; + [case(1539)] srvsvc_NetSrvInfo1539 *info1539; + [case(1540)] srvsvc_NetSrvInfo1540 *info1540; + [case(1541)] srvsvc_NetSrvInfo1541 *info1541; + [case(1542)] srvsvc_NetSrvInfo1542 *info1542; + [case(1543)] srvsvc_NetSrvInfo1543 *info1543; + [case(1544)] srvsvc_NetSrvInfo1544 *info1544; + [case(1545)] srvsvc_NetSrvInfo1545 *info1545; + [case(1546)] srvsvc_NetSrvInfo1546 *info1546; + [case(1547)] srvsvc_NetSrvInfo1547 *info1547; + [case(1548)] srvsvc_NetSrvInfo1548 *info1548; + [case(1549)] srvsvc_NetSrvInfo1549 *info1549; + [case(1550)] srvsvc_NetSrvInfo1550 *info1550; + [case(1552)] srvsvc_NetSrvInfo1552 *info1552; + [case(1553)] srvsvc_NetSrvInfo1553 *info1553; + [case(1554)] srvsvc_NetSrvInfo1554 *info1554; + [case(1555)] srvsvc_NetSrvInfo1555 *info1555; + [case(1556)] srvsvc_NetSrvInfo1556 *info1556; + [default]; + } srvsvc_NetSrvInfo; + + /******************/ + /* Function: 0x15 */ + WERROR srvsvc_NetSrvGetInfo( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] uint32 level, + [out,ref,switch_is(level)] srvsvc_NetSrvInfo *info + ); + + /******************/ + /* Function: 0x16 */ + WERROR srvsvc_NetSrvSetInfo( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] uint32 level, + [in,ref,switch_is(level)] srvsvc_NetSrvInfo *info, + [in,out,unique] uint32 *parm_error + ); + +/**************************/ +/* srvsvc_NetDisk */ +/**************************/ + typedef struct { + /* + * In theory this should be: + * [charset(UTF16),string] uint16 annotation[3] + * But midl treats this as: + * [charset(UTF16),string] uint16 annotation[] + * and pidl doesn't support this yet + */ + [value(0)] uint32 __disk_offset; + [value(strlen(disk)+1)] uint32 __disk_length; + [charset(UTF16)] uint16 disk[__disk_length]; + } srvsvc_NetDiskInfo0; + + typedef struct { + uint32 count; + [size_is(count), length_is(count)] srvsvc_NetDiskInfo0 *disks; + } srvsvc_NetDiskInfo; + + /******************/ + /* Function: 0x17 */ + WERROR srvsvc_NetDiskEnum( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] uint32 level, + [in,out,ref] srvsvc_NetDiskInfo *info, + [in] uint32 maxlen, + [out,ref] uint32 *totalentries, + [in,out,unique] uint32 *resume_handle + ); + +/**************************/ +/* srvsvc_NetStatistics */ +/**************************/ + typedef struct { + uint32 start; + uint32 fopens; + uint32 devopens; + uint32 jobsqueued; + uint32 sopens; + uint32 stimeouts; + uint32 serrorout; + uint32 pwerrors; + uint32 permerrors; + uint32 syserrors; + uint32 bytessent_low; + uint32 bytessent_high; + uint32 bytesrcvd_low; + uint32 bytesrcvd_high; + uint32 avresponse; + uint32 reqbufneed; + uint32 bigbufneed; + } srvsvc_Statistics; + + /******************/ + /* Function: 0x18 */ + WERROR srvsvc_NetServerStatisticsGet( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in,unique] [string,charset(UTF16)] uint16 *service, + [in] uint32 level, + [in] uint32 options, + [out,ref] srvsvc_Statistics **stats + ); + +/**************************/ +/* srvsvc_NetTransport */ +/**************************/ + typedef struct { + uint32 vcs; + [string,charset(UTF16)] uint16 *name; + [size_is(addr_len)] uint8 *addr; + uint32 addr_len; + [string,charset(UTF16)] uint16 *net_addr; + } srvsvc_NetTransportInfo0; + + /******************/ + /* Function: 0x19 */ + WERROR srvsvc_NetTransportAdd( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] uint32 level, + [in,switch_is(level)] srvsvc_NetTransportInfo info + ); + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetTransportInfo0 *array; + } srvsvc_NetTransportCtr0; + + typedef struct { + uint32 vcs; + [string,charset(UTF16)] uint16 *name; + [size_is(addr_len)] uint8 *addr; + uint32 addr_len; + [string,charset(UTF16)] uint16 *net_addr; + [string,charset(UTF16)] uint16 *domain; + } srvsvc_NetTransportInfo1; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetTransportInfo1 *array; + } srvsvc_NetTransportCtr1; + + typedef struct { + uint32 vcs; + [string,charset(UTF16)] uint16 *name; + [size_is(addr_len)] uint8 *addr; + uint32 addr_len; + [string,charset(UTF16)] uint16 *net_addr; + [string,charset(UTF16)] uint16 *domain; + uint32 unknown; + } srvsvc_NetTransportInfo2; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetTransportInfo2 *array; + } srvsvc_NetTransportCtr2; + + typedef struct { + uint32 vcs; + [string,charset(UTF16)] uint16 *name; + [size_is(addr_len)] uint8 *addr; + uint32 addr_len; + [string,charset(UTF16)] uint16 *net_addr; + [string,charset(UTF16)] uint16 *domain; + uint32 unknown1; + uint32 unknown2; + uint8 unknown3[256]; + } srvsvc_NetTransportInfo3; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetTransportInfo3 *array; + } srvsvc_NetTransportCtr3; + + typedef union { + [case(0)] srvsvc_NetTransportCtr0 *ctr0; + [case(1)] srvsvc_NetTransportCtr1 *ctr1; + [case(2)] srvsvc_NetTransportCtr2 *ctr2; + [case(3)] srvsvc_NetTransportCtr3 *ctr3; + [default]; + } srvsvc_NetTransportCtr; + + typedef struct { + uint32 level; + [switch_is(level)] srvsvc_NetTransportCtr ctr; + } srvsvc_NetTransportInfoCtr; + + /******************/ + /* Function: 0x1a */ + WERROR srvsvc_NetTransportEnum( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in,out,ref] srvsvc_NetTransportInfoCtr *transports, + [in] uint32 max_buffer, + [out,ref] uint32 *totalentries, + [in,out,unique] uint32 *resume_handle + ); + + /******************/ + /* Function: 0x1b */ + WERROR srvsvc_NetTransportDel( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] uint32 level, + [in] srvsvc_NetTransportInfo0 *info0 + ); + +/**************************/ +/* srvsvc_NetRemoteTOD */ +/**************************/ + typedef struct { + uint32 elapsed; /* time(NULL) */ + uint32 msecs; /* milliseconds till system reboot (uptime) */ + uint32 hours; + uint32 mins; + uint32 secs; + uint32 hunds; + int32 timezone; /* in minutes */ + uint32 tinterval; /* clock tick interval in 0.0001 second units; 310 on windows */ + uint32 day; + uint32 month; + uint32 year; + uint32 weekday; + } srvsvc_NetRemoteTODInfo; + + /******************/ + /* Function: 0x1c */ + WERROR srvsvc_NetRemoteTOD( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [out,ref] srvsvc_NetRemoteTODInfo **info + ); + +/**************************/ +/* srvsvc_NetServiceBits */ +/**************************/ + /******************/ + /* Function: 0x1d */ + WERROR srvsvc_NetSetServiceBits( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in,unique] [string,charset(UTF16)] uint16 *transport, + [in] uint32 servicebits, + [in] uint32 updateimmediately + ); + +/**************************/ +/* srvsvc_NetPath */ +/**************************/ + /******************/ + /* Function: 0x1e */ + WERROR srvsvc_NetPathType( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] [string,charset(UTF16)] uint16 path[], + [in] uint32 pathflags, + [out,ref] uint32 *pathtype + ); + + /******************/ + /* Function: 0x1f */ + WERROR srvsvc_NetPathCanonicalize( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] [string,charset(UTF16)] uint16 path[], + [out] [size_is(maxbuf)] uint8 can_path[], + [in] uint32 maxbuf, + [in] [string,charset(UTF16)] uint16 prefix[], + [in,out,ref] uint32 *pathtype, + [in] uint32 pathflags + ); + + /******************/ + /* Function: 0x20 */ + WERROR srvsvc_NetPathCompare( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] [string,charset(UTF16)] uint16 path1[], + [in] [string,charset(UTF16)] uint16 path2[], + [in] uint32 pathtype, + [in] uint32 pathflags + ); + +/**************************/ +/* srvsvc_NetName */ +/**************************/ + /******************/ + /* Function: 0x21 */ + WERROR srvsvc_NetNameValidate( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] [string,charset(UTF16)] uint16 name[], + [in] uint32 name_type, + [in] uint32 flags + ); + + /******************/ + /* Function: 0x22 */ + [todo] WERROR srvsvc_NETRPRNAMECANONICALIZE( + ); + + /******************/ + /* Function: 0x23 */ + WERROR srvsvc_NetPRNameCompare( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] [string,charset(UTF16)] uint16 name1[], + [in] [string,charset(UTF16)] uint16 name2[], + [in] uint32 name_type, + [in] uint32 flags + ); + +/**************************/ +/* srvsvc_NetShare ... */ +/**************************/ + /******************/ + /* Function: 0x24 */ + /* Note, there must be some way to return entries read vs + total entries ... */ + WERROR srvsvc_NetShareEnum( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in,out,ref] srvsvc_NetShareInfoCtr *info_ctr, + [in] uint32 max_buffer, + [out,ref] uint32 *totalentries, + [in,out,unique] uint32 *resume_handle + ); + + /******************/ + /* Function: 0x25 */ + WERROR srvsvc_NetShareDelStart( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] [string,charset(UTF16)] uint16 share[], + [in] uint32 reserved, + [out,unique] policy_handle *hnd + ); + + /******************/ + /* Function: 0x26 */ + WERROR srvsvc_NetShareDelCommit( + [in, out,unique] policy_handle *hnd + ); + + /******************/ + /* Function: 0x27 */ + WERROR srvsvc_NetGetFileSecurity( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in,unique] [string,charset(UTF16)] uint16 *share, + [in] [string,charset(UTF16)] uint16 file[], + [in] security_secinfo securityinformation, + [out,ref] sec_desc_buf **sd_buf + ); + + /******************/ + /* Function: 0x28 */ + WERROR srvsvc_NetSetFileSecurity( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in,unique] [string,charset(UTF16)] uint16 *share, + [in] [string,charset(UTF16)] uint16 file[], + [in] security_secinfo securityinformation, + [in,ref] sec_desc_buf *sd_buf + ); + + + + typedef [switch_type(uint32)] union { + [case(0)] srvsvc_NetTransportInfo0 info0; + [case(1)] srvsvc_NetTransportInfo1 info1; + [case(2)] srvsvc_NetTransportInfo2 info2; + [case(3)] srvsvc_NetTransportInfo3 info3; + } srvsvc_NetTransportInfo; + + /******************/ + /* Function: 0x29 */ + WERROR srvsvc_NetServerTransportAddEx( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in] uint32 level, + [in,switch_is(level)] srvsvc_NetTransportInfo info + ); + + /******************/ + /* Function: 0x2a */ + WERROR srvsvc_NetServerSetServiceBitsEx( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in,unique] [string,charset(UTF16)] uint16 *emulated_server_unc, + [in,unique] [string,charset(UTF16)] uint16 *transport, + [in] uint32 servicebitsofinterest, + [in] uint32 servicebits, + [in] uint32 updateimmediately + ); + + /******************/ + /* Function: 0x2b */ + [todo] WERROR srvsvc_NETRDFSGETVERSION( + ); + + /******************/ + /* Function: 0x2c */ + [todo] WERROR srvsvc_NETRDFSCREATELOCALPARTITION( + ); + + /******************/ + /* Function: 0x2d */ + [todo] WERROR srvsvc_NETRDFSDELETELOCALPARTITION( + ); + + /******************/ + /* Function: 0x2e */ + [todo] WERROR srvsvc_NETRDFSSETLOCALVOLUMESTATE( + ); + + /******************/ + /* Function: 0x2f */ + [todo] WERROR srvsvc_NETRDFSSETSERVERINFO( + ); + + /******************/ + /* Function: 0x30 */ + [todo] WERROR srvsvc_NETRDFSCREATEEXITPOINT( + ); + + /******************/ + /* Function: 0x31 */ + [todo] WERROR srvsvc_NETRDFSDELETEEXITPOINT( + ); + + /******************/ + /* Function: 0x32 */ + [todo] WERROR srvsvc_NETRDFSMODIFYPREFIX( + ); + + /******************/ + /* Function: 0x33 */ + [todo] WERROR srvsvc_NETRDFSFIXLOCALVOLUME( + ); + + /******************/ + /* Function: 0x34 */ + [todo] WERROR srvsvc_NETRDFSMANAGERREPORTSITEINFO( + ); + + /******************/ + /* Function: 0x35 */ + [todo] WERROR srvsvc_NETRSERVERTRANSPORTDELEX( + ); +} diff --git a/librpc/idl/svcctl.idl b/librpc/idl/svcctl.idl new file mode 100644 index 0000000..c8db99b --- /dev/null +++ b/librpc/idl/svcctl.idl @@ -0,0 +1,1040 @@ +#include "idl_types.h" + +/* + svcctl interface definitions + + The below was initially obtained from MS-SCMR which is + Copyright © 2022 Microsoft Corporation as permitted + by the Open Specifications terms reproduced in IDL_LICENCE.txt +*/ + +import "misc.idl", "security.idl"; +[ uuid("367abb81-9844-35f1-ad32-98f038001003"), + version(2.0), + pointer_default(unique), + ms_union, + endpoint("ncacn_np:[\\pipe\\svcctl]", "ncalrpc:"), + helper("../librpc/ndr/ndr_svcctl.h"), + helpstring("Service Control") +] interface svcctl +{ + const int MAX_SERVICE_NAME_LENGTH = 256; + const short SC_MAX_DEPEND_SIZE = 4 * 1024; + const short SC_MAX_NAME_LENGTH = MAX_SERVICE_NAME_LENGTH + 1; + const short SC_MAX_PATH_LENGTH = 32 * 1024; + const short SC_MAX_PWD_SIZE = 514; + const short SC_MAX_COMPUTER_NAME_LENGTH = 1024; + const short SC_MAX_ACCOUNT_NAME_LENGTH = 2 * 1024; + const short SC_MAX_COMMENT_LENGTH = 128; + const short SC_MAX_ARGUMENT_LENGTH = 1024; + const short SC_MAX_ARGUMENTS = 1024; + +#define BOUNDED_DWORD_4K [range(0, 1024 * 4)] uint32 +#define BOUNDED_DWORD_8K [range(0, 1024 * 8)] uint32 +#define BOUNDED_DWORD_256K [range(0, 1024 * 256)] uint32 + +#if 0 + /* + * pidl does not yet have a real [context_handle] implementation, so we + * just use some defines here. + */ + + typedef [context_handle] void *SC_RPC_HANDLE; + typedef [context_handle] void *SC_NOTIFY_RPC_HANDLE; +#else +#define SC_RPC_HANDLE policy_handle +#define SC_NOTIFY_RPC_HANDLE policy_handle +#define handle_t policy_handle +#endif + typedef struct { + uint32 is_locked; + [string,charset(UTF16)] uint16 *lock_owner; + uint32 lock_duration; + } SERVICE_LOCK_STATUS; + + typedef [v1_enum] enum { + SVCCTL_STATE_UNKNOWN = 0x00000000, /* only used internally to smbd */ + SVCCTL_STOPPED = 0x00000001, + SVCCTL_START_PENDING = 0x00000002, + SVCCTL_STOP_PENDING = 0x00000003, + SVCCTL_RUNNING = 0x00000004, + SVCCTL_CONTINUE_PENDING = 0x00000005, + SVCCTL_PAUSE_PENDING = 0x00000006, + SVCCTL_PAUSED = 0x00000007 + } svcctl_ServiceStatus; + + const int SVCCTL_ACCEPT_NONE = 0x00000000; + + typedef [bitmap32bit] bitmap { + SVCCTL_ACCEPT_STOP = 0x00000001, + SVCCTL_ACCEPT_PAUSE_CONTINUE = 0x00000002, + SVCCTL_ACCEPT_SHUTDOWN = 0x00000004, + SVCCTL_ACCEPT_PARAMCHANGE = 0x00000008, + SVCCTL_ACCEPT_NETBINDCHANGE = 0x00000010, + SVCCTL_ACCEPT_HARDWAREPROFILECHANGE = 0x00000020, + SVCCTL_ACCEPT_POWEREVENT = 0x00000040 + } svcctl_ControlsAccepted; + + typedef struct { + uint32 type; + svcctl_ServiceStatus state; + svcctl_ControlsAccepted controls_accepted; + WERROR win32_exit_code; + uint32 service_exit_code; + uint32 check_point; + uint32 wait_hint; + } SERVICE_STATUS; + + typedef [public] struct { + SERVICE_STATUS status; + uint32 process_id; + uint32 service_flags; + } SERVICE_STATUS_PROCESS; + + typedef [public,gensize] struct { + [relative] nstring *service_name; + [relative] nstring *display_name; + SERVICE_STATUS status; + } ENUM_SERVICE_STATUSW; + + typedef [public,gensize] struct { + [relative] astring *service_name; + [relative] astring *display_name; + SERVICE_STATUS status; + } ENUM_SERVICE_STATUSA; + + const int SERVICE_TYPE_KERNEL_DRIVER = 0x01; + const int SERVICE_TYPE_FS_DRIVER = 0x02; + const int SERVICE_TYPE_ADAPTER = 0x04; + const int SERVICE_TYPE_RECOGNIZER_DRIVER = 0x08; + const int SERVICE_TYPE_DRIVER=SERVICE_TYPE_KERNEL_DRIVER|SERVICE_TYPE_FS_DRIVER|SERVICE_TYPE_RECOGNIZER_DRIVER; + const int SERVICE_TYPE_WIN32_OWN_PROCESS = 0x10; + const int SERVICE_TYPE_WIN32_SHARE_PROCESS = 0x20; + const int SERVICE_TYPE_WIN32=SERVICE_TYPE_WIN32_OWN_PROCESS|SERVICE_TYPE_WIN32_SHARE_PROCESS; + const int SERVICE_TYPE_INTERACTIVE_PROCESS = 0x100; + + /*****************/ + /* Function 0x00 */ + WERROR svcctl_CloseServiceHandle( + [in,out,ref] policy_handle *handle + ); + + /*****************/ + /* Function 0x01 */ + + /* Service Controls */ + + typedef [v1_enum] enum { + SVCCTL_CONTROL_STOP = 0x00000001, + SVCCTL_CONTROL_PAUSE = 0x00000002, + SVCCTL_CONTROL_CONTINUE = 0x00000003, + SVCCTL_CONTROL_INTERROGATE = 0x00000004, + SVCCTL_CONTROL_SHUTDOWN = 0x00000005, + SVCCTL_CONTROL_PARAMCHANGE = 0x00000006, + SVCCTL_CONTROL_NETBINDADD = 0x00000007, + SVCCTL_CONTROL_NETBINDREMOVE = 0x00000008, + SVCCTL_CONTROL_NETBINDENABLE = 0x00000009, + SVCCTL_CONTROL_NETBINDDISABLE = 0x0000000A + } SERVICE_CONTROL; + + WERROR svcctl_ControlService( + [in,ref] policy_handle *handle, + [in] SERVICE_CONTROL control, + [out,ref] SERVICE_STATUS *service_status + ); + + /*****************/ + /* Function 0x02 */ + WERROR svcctl_DeleteService( + [in,ref] policy_handle *handle + ); + + /*****************/ + /* Function 0x03 */ + + WERROR svcctl_LockServiceDatabase( + [in,ref] policy_handle *handle, + [out,ref] policy_handle *lock + ); + + /*****************/ + /* Function 0x04 */ + WERROR svcctl_QueryServiceObjectSecurity( + [in] policy_handle *handle, + [in] security_secinfo security_flags, + [out,ref,size_is(offered)] uint8 *buffer, + [in,range(0,0x40000)] uint32 offered, + [out,ref,range(0,0x40000)] uint32 *needed + ); + + /*****************/ + /* Function 0x05 */ + WERROR svcctl_SetServiceObjectSecurity( + [in] policy_handle *handle, + [in] security_secinfo security_flags, + [in,ref,size_is(offered)] uint8 *buffer, + [in] uint32 offered + ); + + /*****************/ + /* Function 0x06 */ + WERROR svcctl_QueryServiceStatus( + [in,ref] policy_handle *handle, + [out,ref] SERVICE_STATUS *service_status + ); + + /*****************/ + /* Function 0x07 */ + [todo] WERROR svcctl_SetServiceStatus( + ); + + /*****************/ + /* Function 0x08 */ + WERROR svcctl_UnlockServiceDatabase( + [in,out,ref] policy_handle *lock + ); + + /*****************/ + /* Function 0x09 */ + [todo] WERROR svcctl_NotifyBootConfigStatus( + ); + + /*****************/ + /* Function 0x0a */ + WERROR svcctl_SCSetServiceBitsW( + [in,ref] policy_handle *handle, + [in] uint32 bits, + [in] boolean32 bitson, + [in] boolean32 immediate + ); + + /*****************/ + /* Function 0x0b */ + + typedef [v1_enum] enum { + SVCCTL_SVC_ERROR_IGNORE = 0x00000000, + SVCCTL_SVC_ERROR_NORMAL = 0x00000001, + SVCCTL_SVC_ERROR_CRITICAL = 0x00000002, + SVCCTL_SVC_ERROR_SEVERE = 0x00000003 + } svcctl_ErrorControl; + + typedef [v1_enum] enum { + SVCCTL_BOOT_START = 0x00000000, + SVCCTL_SYSTEM_START = 0x00000001, + SVCCTL_AUTO_START = 0x00000002, + SVCCTL_DEMAND_START = 0x00000003, + SVCCTL_DISABLED = 0x00000004 + } svcctl_StartType; + + [public] WERROR svcctl_ChangeServiceConfigW( + [in,ref] policy_handle *handle, + [in] uint32 type, + [in] svcctl_StartType start_type, + [in] svcctl_ErrorControl error_control, + [in,unique] [string,charset(UTF16)] uint16 *binary_path, + [in,unique] [string,charset(UTF16)] uint16 *load_order_group, + [in,out,unique] uint32 *tag_id, + [in,unique,size_is(dwDependSize)] [string,charset(UTF16)] uint16 *dependencies, + [in,range(0, SC_MAX_DEPEND_SIZE)] uint32 dwDependSize, + [in,unique,range(0, SC_MAX_ACCOUNT_NAME_LENGTH)] [string,charset(UTF16)] uint16 *service_start_name, + [in,unique,size_is(dwPwSize)] [string,charset(UTF16)] uint16 *password, + [in,range(0, SC_MAX_PWD_SIZE)] uint32 dwPwSize, + [in,unique,range(0, SC_MAX_NAME_LENGTH)] [string,charset(UTF16)] uint16 *display_name + ); + + /*****************/ + /* Function 0x0c */ + WERROR svcctl_CreateServiceW( + [in,ref] policy_handle *scmanager_handle, + [in] [string,charset(UTF16)] uint16 ServiceName[], + [in,unique] [string,charset(UTF16)] uint16 *DisplayName, + [in] uint32 desired_access, + [in] uint32 type, + [in] svcctl_StartType start_type, + [in] svcctl_ErrorControl error_control, + [in] [string,charset(UTF16)] uint16 binary_path[], + [in,unique] [string,charset(UTF16)] uint16 *LoadOrderGroupKey, + [in,out,unique] uint32 *TagId, + [in,unique,size_is(dependencies_size)] uint8 *dependencies, + [in] uint32 dependencies_size, + [in,unique] [string,charset(UTF16)] uint16 *service_start_name, + [in,unique,size_is(password_size)] uint8 *password, + [in] uint32 password_size, + [out,ref] policy_handle *handle + ); + + /*****************/ + /* Function 0x0d */ + WERROR svcctl_EnumDependentServicesW( + [in,ref] policy_handle *service, + [in] svcctl_ServiceState state, + [out,ref,size_is(offered)] uint8 *service_status, + [in,range(0,0x40000)] uint32 offered, + [out,ref,range(0,0x40000)] uint32 *needed, + [out,ref,range(0,0x40000)] uint32 *services_returned + ); + + /*****************/ + /* Function 0x0e */ + + typedef [v1_enum] enum { + SERVICE_STATE_ACTIVE = 0x00000001, + SERVICE_STATE_INACTIVE = 0x00000002, + SERVICE_STATE_ALL = ( SERVICE_STATE_ACTIVE | SERVICE_STATE_INACTIVE ) + } svcctl_ServiceState; + + WERROR svcctl_EnumServicesStatusW( + [in,ref] policy_handle *handle, + [in] uint32 type, + [in] svcctl_ServiceState state, + [out,ref,size_is(offered)] uint8 *service, + [in] [range(0,0x40000)] uint32 offered, + [out,ref] [range(0,0x40000)] uint32 *needed, + [out,ref] [range(0,0x40000)] uint32 *services_returned, + [in,out,unique] uint32 *resume_handle + ); + + /*****************/ + /* Function 0x0f */ + + /* Service Control Manager Bits */ + + typedef [bitmap32bit] bitmap { + SC_RIGHT_MGR_CONNECT = 0x0001, + SC_RIGHT_MGR_CREATE_SERVICE = 0x0002, + SC_RIGHT_MGR_ENUMERATE_SERVICE = 0x0004, + SC_RIGHT_MGR_LOCK = 0x0008, + SC_RIGHT_MGR_QUERY_LOCK_STATUS = 0x0010, + SC_RIGHT_MGR_MODIFY_BOOT_CONFIG = 0x0020 + } svcctl_MgrAccessMask; + + const int SC_MANAGER_READ_ACCESS = + (SEC_STD_READ_CONTROL | + SC_RIGHT_MGR_CONNECT | + SC_RIGHT_MGR_ENUMERATE_SERVICE | + SC_RIGHT_MGR_QUERY_LOCK_STATUS); + + const int SC_MANAGER_EXECUTE_ACCESS = SC_MANAGER_READ_ACCESS; + + const int SC_MANAGER_WRITE_ACCESS = + (SEC_STD_REQUIRED | + SC_MANAGER_READ_ACCESS | + SC_RIGHT_MGR_CREATE_SERVICE | + SC_RIGHT_MGR_LOCK | + SC_RIGHT_MGR_MODIFY_BOOT_CONFIG); + + const int SC_MANAGER_ALL_ACCESS = SC_MANAGER_WRITE_ACCESS; + + WERROR svcctl_OpenSCManagerW( + [in,unique] [string,charset(UTF16)] uint16 *MachineName, + [in,unique] [string,charset(UTF16)] uint16 *DatabaseName, + [in] svcctl_MgrAccessMask access_mask, + [out,ref] policy_handle *handle + ); + + /*****************/ + /* Function 0x10 */ + + /* Service Object Bits */ + + typedef [bitmap32bit] bitmap { + SC_RIGHT_SVC_QUERY_CONFIG = 0x0001, + SC_RIGHT_SVC_CHANGE_CONFIG = 0x0002, + SC_RIGHT_SVC_QUERY_STATUS = 0x0004, + SC_RIGHT_SVC_ENUMERATE_DEPENDENTS = 0x0008, + SC_RIGHT_SVC_START = 0x0010, + SC_RIGHT_SVC_STOP = 0x0020, + SC_RIGHT_SVC_PAUSE_CONTINUE = 0x0040, + SC_RIGHT_SVC_INTERROGATE = 0x0080, + SC_RIGHT_SVC_USER_DEFINED_CONTROL = 0x0100 + } svcctl_ServiceAccessMask; + + const int SERVICE_READ_ACCESS = + (SEC_STD_READ_CONTROL | + SC_RIGHT_SVC_ENUMERATE_DEPENDENTS | + SC_RIGHT_SVC_INTERROGATE | + SC_RIGHT_SVC_QUERY_CONFIG | + SC_RIGHT_SVC_QUERY_STATUS | + SC_RIGHT_SVC_USER_DEFINED_CONTROL); + + const int SERVICE_EXECUTE_ACCESS = + (SERVICE_READ_ACCESS | + SC_RIGHT_SVC_START | + SC_RIGHT_SVC_STOP | + SC_RIGHT_SVC_PAUSE_CONTINUE); + + const int SERVICE_WRITE_ACCESS = + (SEC_STD_REQUIRED | + SERVICE_READ_ACCESS | + SERVICE_EXECUTE_ACCESS | + SC_RIGHT_SVC_CHANGE_CONFIG); + + const int SERVICE_ALL_ACCESS = SERVICE_WRITE_ACCESS; + + WERROR svcctl_OpenServiceW( + [in,ref] policy_handle *scmanager_handle, + [in] [string,charset(UTF16)] uint16 ServiceName[], + [in] svcctl_ServiceAccessMask access_mask, + [out,ref] policy_handle *handle + ); + + /*****************/ + /* Function 0x11 */ + + typedef [public,gensize] struct { + uint32 service_type; + svcctl_StartType start_type; + svcctl_ErrorControl error_control; + [string,charset(UTF16)] [range(0,8192)] uint16 *executablepath; + [string,charset(UTF16)] [range(0,8192)] uint16 *loadordergroup; + uint32 tag_id; + [string,charset(UTF16)] [range(0,8192)] uint16 *dependencies; + [string,charset(UTF16)] [range(0,8192)] uint16 *startname; + [string,charset(UTF16)] [range(0,8192)] uint16 *displayname; + } QUERY_SERVICE_CONFIG; + + WERROR svcctl_QueryServiceConfigW( + [in,ref] policy_handle *handle, + [out] QUERY_SERVICE_CONFIG *query, + [in] [range(0,8192)] uint32 offered, + [out,ref] [range(0,8192)] uint32 *needed + ); + + /*****************/ + /* Function 0x12 */ + WERROR svcctl_QueryServiceLockStatusW( + [in,ref] policy_handle *handle, + [in] uint32 offered, + [out,ref] SERVICE_LOCK_STATUS *lock_status, + [out,ref] uint32 *needed + ); + + /*****************/ + /* Function 0x13 */ + + const int SC_MAX_ARGUMENT_LENGTH = 1024; + const int SC_MAX_ARGUMENTS = 1024; + + typedef struct { + [string,charset(UTF16),range(0,SC_MAX_ARGUMENT_LENGTH)] uint16 *string; + } svcctl_ArgumentString; + + WERROR svcctl_StartServiceW( + [in,ref] policy_handle *handle, + [in,range(0,SC_MAX_ARGUMENTS)] uint32 NumArgs, + [in,unique,size_is(NumArgs)] svcctl_ArgumentString *Arguments + ); + + /*****************/ + /* Function 0x14 */ + WERROR svcctl_GetServiceDisplayNameW( + [in,ref] policy_handle *handle, + [in,unique] [string,charset(UTF16)] uint16 *service_name, + [out,ref] [string,charset(UTF16)] uint16 **display_name, + [in,out,unique] uint32 *display_name_length + ); + + /*****************/ + /* Function 0x15 */ + WERROR svcctl_GetServiceKeyNameW( + [in,ref] policy_handle *handle, + [in,unique] [string,charset(UTF16)] uint16 *service_name, + [out,ref] [string,charset(UTF16)] uint16 **key_name, + [in,out,unique] uint32 *display_name_length + ); + + /*****************/ + /* Function 0x16 */ + WERROR svcctl_SCSetServiceBitsA( + [in,ref] policy_handle *handle, + [in] uint32 bits, + [in] boolean32 bitson, + [in] boolean32 immediate + ); + + /*****************/ + /* Function 0x17 */ + WERROR svcctl_ChangeServiceConfigA( + [in,ref] policy_handle *handle, + [in] uint32 type, + [in] svcctl_StartType start_type, + [in] svcctl_ErrorControl error_control, + [in,unique] [string,charset(UTF16)] uint16 *binary_path, + [in,unique] [string,charset(UTF16)] uint16 *load_order_group, + [out,ref] uint32 *tag_id, + [in,unique] [string,charset(UTF16)] uint16 *dependencies, + [in,unique] [string,charset(UTF16)] uint16 *service_start_name, + [in,unique] [string,charset(UTF16)] uint16 *password, + [in,unique] [string,charset(UTF16)] uint16 *display_name + ); + + /*****************/ + /* Function 0x18 */ + WERROR svcctl_CreateServiceA( + [in,ref] policy_handle *handle, + [in,unique] [string,charset(UTF16)] uint16 *ServiceName, + [in,unique] [string,charset(UTF16)] uint16 *DisplayName, + [in] uint32 desired_access, + [in] uint32 type, + [in] svcctl_StartType start_type, + [in] svcctl_ErrorControl error_control, + [in,unique] [string,charset(UTF16)] uint16 *binary_path, + [in,unique] [string,charset(UTF16)] uint16 *LoadOrderGroupKey, + [out,unique] uint32 *TagId, + [in,unique] [string,charset(UTF16)] uint16 *dependencies, + [in,unique] [string,charset(UTF16)] uint16 *service_start_name, + [in,unique] [string,charset(UTF16)] uint16 *password + ); + + /*****************/ + /* Function 0x19 */ + WERROR svcctl_EnumDependentServicesA( + [in,ref] policy_handle *service, + [in] svcctl_ServiceState state, + [out,unique] ENUM_SERVICE_STATUSA *service_status, + [in] uint32 offered, + [out,ref] uint32 *needed, + [out,ref] uint32 *services_returned + ); + + /*****************/ + /* Function 0x1a */ + WERROR svcctl_EnumServicesStatusA( + [in,ref] policy_handle *handle, + [in] uint32 type, + [in] svcctl_ServiceState state, + [in] uint32 offered, + [out,size_is(offered)] uint8 service[*], + [out,ref] uint32 *needed, + [out,ref] uint32 *services_returned, + [in,out,unique] uint32 *resume_handle + ); + + /*****************/ + /* Function 0x1b */ + WERROR svcctl_OpenSCManagerA( + [in,unique] [string,charset(UTF16)] uint16 *MachineName, + [in,unique] [string,charset(UTF16)] uint16 *DatabaseName, + [in] uint32 access_mask, + [out,ref] policy_handle *handle + ); + + /*****************/ + /* Function 0x1c */ + WERROR svcctl_OpenServiceA( + [in,ref] policy_handle *scmanager_handle, + [in,unique] [string,charset(UTF16)] uint16 *ServiceName, + [in] uint32 access_mask, + [out,ref] policy_handle *handle + ); + + /*****************/ + /* Function 0x1d */ + WERROR svcctl_QueryServiceConfigA( + [in,ref] policy_handle *handle, + [out] uint8 query[offered], /*QUERYU_SERVICE_CONFIG */ + [in] uint32 offered, + [out,ref] uint32 *needed + ); + + /*****************/ + /* Function 0x1e */ + WERROR svcctl_QueryServiceLockStatusA( + [in,ref] policy_handle *handle, + [in] uint32 offered, + [out,ref] SERVICE_LOCK_STATUS *lock_status, + [out,ref] uint32 *needed + ); + + /*****************/ + /* Function 0x1f */ + WERROR svcctl_StartServiceA( + [in,ref] policy_handle *handle, + [in] uint32 NumArgs, + [in,unique/*FIXME:,length_is(NumArgs)*/] [string,charset(UTF16)] uint16 *Arguments + ); + + /*****************/ + /* Function 0x20 */ + WERROR svcctl_GetServiceDisplayNameA( + [in,ref] policy_handle *handle, + [in,unique] [string,charset(UTF16)] uint16 *service_name, + [out,ref] [string,charset(UTF16)] uint16 **display_name, + [in,out,unique] uint32 *display_name_length + ); + + /*****************/ + /* Function 0x21 */ + WERROR svcctl_GetServiceKeyNameA( + [in,ref] policy_handle *handle, + [in,unique] [string,charset(UTF16)] uint16 *service_name, + [out,ref] [string,charset(UTF16)] uint16 **key_name, + [in,out,unique] uint32 *display_name_length + ); + + /*****************/ + /* Function 0x22 */ + [todo] WERROR svcctl_GetCurrentGroupeStateW( + ); + + /*****************/ + /* Function 0x23 */ + [todo] WERROR svcctl_EnumServiceGroupW( + ); + + /*****************/ + /* Function 0x24 */ + WERROR svcctl_ChangeServiceConfig2A( + [in,ref] policy_handle *handle, + [in] uint32 info_level, + [in,unique] uint8 *info + ); + + /*****************/ + /* Function 0x25 */ + WERROR svcctl_ChangeServiceConfig2W( + [in,ref] policy_handle *handle, + [in] uint32 info_level, + [in,unique] uint8 *info + ); + + /*****************/ + /* Function 0x26 */ + + typedef [v1_enum] enum { + SERVICE_CONFIG_DESCRIPTION = 0x00000001, + SERVICE_CONFIG_FAILURE_ACTIONS = 0x00000002 + } svcctl_ConfigLevel; + + typedef [gensize,public] struct { + [relative] nstring *description; + } SERVICE_DESCRIPTION; + + typedef [v1_enum] enum { + SC_ACTION_NONE = 0, + SC_ACTION_RESTART = 1, + SC_ACTION_REBOOT = 2, + SC_ACTION_RUN_COMMAND = 3 + } SC_ACTION_TYPE; + + typedef struct { + SC_ACTION_TYPE type; + uint32 delay; + } SC_ACTION; + + typedef [public,gensize] struct { + uint32 reset_period; + [relative] nstring *rebootmsg; + [relative] nstring *command; + [range(0,1024)] uint32 num_actions; + [relative] [size_is(num_actions)] SC_ACTION *actions; + } SERVICE_FAILURE_ACTIONSW; + + WERROR svcctl_QueryServiceConfig2A( + [in,ref] policy_handle *handle, + [in] svcctl_ConfigLevel info_level, + [out] uint8 buffer[offered], + [in] uint32 offered, + [out,ref] uint32 *needed + ); + + /*****************/ + /* Function 0x27 */ + WERROR svcctl_QueryServiceConfig2W( + [in,ref] policy_handle *handle, + [in] svcctl_ConfigLevel info_level, + [out,ref,size_is(offered)] uint8 *buffer, + [in] [range(0,8192)] uint32 offered, + [out,ref] [range(0,8192)] uint32 *needed + ); + + /*****************/ + /* Function 0x28 */ + + typedef [v1_enum] enum { + SVC_STATUS_PROCESS_INFO = 0x00000000 + } svcctl_StatusLevel; + + WERROR svcctl_QueryServiceStatusEx( + [in,ref] policy_handle *handle, + [in] svcctl_StatusLevel info_level, + [out,ref,size_is(offered)] uint8 *buffer, + [in] [range(0,8192)] uint32 offered, + [out,ref] [range(0,8192)] uint32 *needed + ); + + /*****************/ + /* Function 0x29 */ + WERROR svcctl_EnumServicesStatusExA( + [in,ref] policy_handle *scmanager, + [in] uint32 info_level, + [in] uint32 type, + [in] svcctl_ServiceState state, + [out] uint8 services[offered], + [in] uint32 offered, + [out,ref] uint32 *needed, + [out,ref] uint32 *service_returned, + [in,out,unique] uint32 *resume_handle, + [out,ref] [string,charset(UTF16)] uint16 **group_name + ); + + /*****************/ + /* Function 0x2a */ + WERROR svcctl_EnumServicesStatusExW( + [in,ref] policy_handle *scmanager, + [in] uint32 info_level, + [in] uint32 type, + [in] svcctl_ServiceState state, + [out,ref,size_is(offered)] uint8 *services, + [in] [range(0,0x40000)] uint32 offered, + [out,ref] [range(0,0x40000)] uint32 *needed, + [out,ref] [range(0,0x40000)] uint32 *service_returned, + [in,out,unique] [range(0,0x40000)] uint32 *resume_handle, + [in,unique] [string,charset(UTF16)] uint16 *group_name + ); + + /*****************/ + /* Function 0x2b */ + [todo] WERROR svcctl_SCSendTSMessage( + ); + + /*****************/ + /* Function 0x2c */ + WERROR svcctl_CreateServiceWOW64A( + [in] SC_RPC_HANDLE hSCManager, + [in,string,range(0, SC_MAX_NAME_LENGTH),charset(DOS)] char *lpServiceName, + [in,string,unique,range(0, SC_MAX_NAME_LENGTH),charset(DOS)] char *lpDisplayName, + [in] uint32 dwDesiredAccess, + [in] uint32 dwServiceType, + [in] uint32 dwStartType, + [in] uint32 dwErrorControl, + [in,string, range(0, SC_MAX_PATH_LENGTH),charset(DOS)] char *lpBinaryPathName, + [in,string,unique,range(0, SC_MAX_NAME_LENGTH),charset(DOS)] char *lpLoadOrderGroup, + [in,out,unique] uint32 *lpdwTagId, + [in,unique,size_is(dwDependSize)] uint8 *lpDependencies, + [in, range (0, SC_MAX_DEPEND_SIZE)] uint32 dwDependSize, + [in,string,unique,range(0, SC_MAX_ACCOUNT_NAME_LENGTH),charset(DOS)] char *lpServiceStartName, + [in,unique,size_is(dwPwSize)] uint8 *lpPassword, + [in, range(0, SC_MAX_PWD_SIZE)] uint32 dwPwSize, + [out] SC_RPC_HANDLE *lpServiceHandle + ); + + /*****************/ + /* Function 0x2d */ + WERROR svcctl_CreateServiceWOW64W( + [in] SC_RPC_HANDLE hSCManager, + [in,string,range(0, SC_MAX_NAME_LENGTH),charset(UTF16)] uint16 *lpServiceName, + [in,string,unique,range(0, SC_MAX_NAME_LENGTH),charset(UTF16)] uint16 *lpDisplayName, + [in] uint32 dwDesiredAccess, + [in] uint32 dwServiceType, + [in] uint32 dwStartType, + [in] uint32 dwErrorControl, + [in,string,range(0, SC_MAX_PATH_LENGTH),charset(UTF16)] uint16 *lpBinaryPathName, + [in,string,unique,range(0, SC_MAX_NAME_LENGTH),charset(UTF16)] uint16 *lpLoadOrderGroup, + [in,out,unique] uint32 *lpdwTagId, + [in,unique,size_is(dwDependSize)] uint8 *lpDependencies, + [in, range (0, SC_MAX_DEPEND_SIZE)] uint32 dwDependSize, + [in,string,unique,range(0, SC_MAX_ACCOUNT_NAME_LENGTH),charset(UTF16)] uint16 *lpServiceStartName, + [in,unique,size_is(dwPwSize)] uint8 *lpPassword, + [in, range(0, SC_MAX_PWD_SIZE)] uint32 dwPwSize, + [out] SC_RPC_HANDLE *lpServiceHandle + ); + + /*****************/ + /* Function 0x2e */ + void Opnum46NotUsedOnWire(void); + + /*****************/ + /* Function 0x2f */ + + typedef struct { + hyper ullThreadId; + uint32 dwNotifyMask; + char CallbackAddressArray[16]; + char CallbackParamAddressArray[16]; + SERVICE_STATUS_PROCESS ServiceStatus; + uint32 dwNotificationStatus; + uint32 dwSequence; + } SERVICE_NOTIFY_STATUS_CHANGE_PARAMS_1; + + typedef struct { + hyper ullThreadId; + uint32 dwNotifyMask; + char CallbackAddressArray[16]; + char CallbackParamAddressArray[16]; + SERVICE_STATUS_PROCESS ServiceStatus; + uint32 dwNotificationStatus; + uint32 dwSequence; + uint32 dwNotificationTriggered; + [string, range(0, 64*1024), charset(UTF16)] uint16 *pszServiceNames; + } SERVICE_NOTIFY_STATUS_CHANGE_PARAMS_2; + + typedef SERVICE_NOTIFY_STATUS_CHANGE_PARAMS_2 + SERVICE_NOTIFY_STATUS_CHANGE_PARAMS; + + typedef [switch_type(uint32)] union { + [case(1)] SERVICE_NOTIFY_STATUS_CHANGE_PARAMS_1 *pStatusChangeParam1; + [case(2)] SERVICE_NOTIFY_STATUS_CHANGE_PARAMS_2 *pStatusChangeParams; + } SC_RPC_NOTIFY_PARAMS_u; + + typedef struct { + uint32 dwInfoLevel; + [switch_is(dwInfoLevel)] SC_RPC_NOTIFY_PARAMS_u u; + } SC_RPC_NOTIFY_PARAMS; + + typedef struct { + BOUNDED_DWORD_4K cElements; + [size_is(cElements)] SC_RPC_NOTIFY_PARAMS NotifyParamsArray[*]; + } SC_RPC_NOTIFY_PARAMS_LIST; + + WERROR svcctl_NotifyServiceStatusChange( + [in] SC_RPC_HANDLE hService, + [in] SC_RPC_NOTIFY_PARAMS NotifyParams, + [in] GUID *pClientProcessGuid, + [out] GUID *pSCMProcessGuid, + [out] boolean32 *pfCreateRemoteQueue, + [out] SC_NOTIFY_RPC_HANDLE *phNotify + ); + + /*****************/ + /* Function 0x30 */ + WERROR svcctl_GetNotifyResults( + [in] SC_NOTIFY_RPC_HANDLE hNotify, + [out,ref] SC_RPC_NOTIFY_PARAMS_LIST *ppNotifyParams + ); + + /*****************/ + /* Function 0x31 */ + WERROR svcctl_CloseNotifyHandle( + [in, out] SC_NOTIFY_RPC_HANDLE *phNotify, + [out] boolean32 *pfApcFired + ); + + /*****************/ + /* Function 0x32 */ + + typedef [v1_enum] enum { + SERVICE_STOP_UNPLANNED = 0x10000000, + SERVICE_STOP_CUSTOM = 0x20000000, + SERVICE_STOP_PLANNED = 0x40000000 + } svcctl_ServiceStopReasonMain; + + typedef [v1_enum] enum { + SERVICE_STOP_REASON_MAJOR_OTHER = 0x00010000, + SERVICE_STOP_REASON_MAJOR_HARDWARE = 0x00020000, + SERVICE_STOP_REASON_MAJOR_OPERATINGSYSTEM = 0x00030000, + SERVICE_STOP_REASON_MAJOR_SOFTWARE = 0x00040000, + SERVICE_STOP_REASON_MAJOR_APPLICATION = 0x00050000, + SERVICE_STOP_REASON_MAJOR_NONE = 0x00060000 + } svcctl_ServiceStopReasonMajor; + + typedef [v1_enum] enum { + SERVICE_STOP_REASON_MINOR_OTHER = 0x00000001, + SERVICE_STOP_REASON_MINOR_MAINTENANCE = 0x00000002, + SERVICE_STOP_REASON_MINOR_INSTALLATION = 0x00000003, + SERVICE_STOP_REASON_MINOR_UPGRADE = 0x00000004, + SERVICE_STOP_REASON_MINOR_RECONFIG = 0x00000005, + SERVICE_STOP_REASON_MINOR_HUNG = 0x00000006, + SERVICE_STOP_REASON_MINOR_UNSTABLE = 0x00000007, + SERVICE_STOP_REASON_MINOR_DISK = 0x00000008, + SERVICE_STOP_REASON_MINOR_NETWORKCARD = 0x00000009, + SERVICE_STOP_REASON_MINOR_ENVIRONMENT = 0x0000000a, + SERVICE_STOP_REASON_MINOR_HARDWARE_DRIVER = 0x0000000b, + SERVICE_STOP_REASON_MINOR_OTHERDRIVER = 0x0000000c, + SERVICE_STOP_REASON_MINOR_SERVICEPACK = 0x0000000d, + SERVICE_STOP_REASON_MINOR_SOFTWARE_UPDATE = 0x0000000e, + SERVICE_STOP_REASON_MINOR_SECURITYFIX = 0x0000000f, + SERVICE_STOP_REASON_MINOR_SECURITY = 0x00000010, + SERVICE_STOP_REASON_MINOR_NETWORK_CONNECTIVITY = 0x00000011, + SERVICE_STOP_REASON_MINOR_WMI = 0x00000012, + SERVICE_STOP_REASON_MINOR_SERVICEPACK_UNINSTALL = 0x00000013, + SERVICE_STOP_REASON_MINOR_SOFTWARE_UPDATE_UNINSTALL = 0x00000014, + SERVICE_STOP_REASON_MINOR_SECURITYFIX_UNINSTALL = 0x00000015, + SERVICE_STOP_REASON_MINOR_MMC = 0x00000016, + SERVICE_STOP_REASON_MINOR_NONE = 0x00000017 + } svcctl_ServiceStopReasonMinor; + + typedef struct { + uint32 dwReason; + [string,range(0, SC_MAX_COMMENT_LENGTH),charset(DOS)] char *szComment; + } SERVICE_CONTROL_STATUS_REASON_IN_PARAMSA; + + typedef struct { + SERVICE_STATUS_PROCESS ServiceStatus; + } SERVICE_CONTROL_STATUS_REASON_OUT_PARAMS; + + typedef [switch_type(uint32)] union { + [case(1)] SERVICE_CONTROL_STATUS_REASON_IN_PARAMSA *psrInParams; + } SC_RPC_SERVICE_CONTROL_IN_PARAMSA; + + typedef [switch_type(uint32)] union { + [case(1)] SERVICE_CONTROL_STATUS_REASON_OUT_PARAMS *psrOutParams; + } SC_RPC_SERVICE_CONTROL_OUT_PARAMSA; + + WERROR svcctl_ControlServiceExA ( + [in] SC_RPC_HANDLE hService, + [in] SERVICE_CONTROL dwControl, + [in] uint32 dwInfoLevel, + [in, switch_is(dwInfoLevel)] SC_RPC_SERVICE_CONTROL_IN_PARAMSA *pControlInParams, + [out, switch_is(dwInfoLevel)] SC_RPC_SERVICE_CONTROL_OUT_PARAMSA *pControlOutParams + ); + + /*****************/ + /* Function 0x33 */ + + typedef struct { + uint32 dwReason; + [string,range(0, SC_MAX_COMMENT_LENGTH),charset(UTF16)] uint16 *pszComment; + } SERVICE_CONTROL_STATUS_REASON_IN_PARAMSW; + + typedef [switch_type(uint32)] union { + [case(1)] SERVICE_CONTROL_STATUS_REASON_IN_PARAMSW *psrInParams; + } SC_RPC_SERVICE_CONTROL_IN_PARAMSW; + + typedef [switch_type(uint32)] union { + [case(1)] SERVICE_CONTROL_STATUS_REASON_OUT_PARAMS *psrOutParams; + } SC_RPC_SERVICE_CONTROL_OUT_PARAMSW; + + WERROR svcctl_ControlServiceExW ( + [in] SC_RPC_HANDLE hService, + [in] SERVICE_CONTROL dwControl, + [in] uint32 dwInfoLevel, + [in, ref, switch_is(dwInfoLevel)] SC_RPC_SERVICE_CONTROL_IN_PARAMSW *pControlInParams, + [out,ref, switch_is(dwInfoLevel)] SC_RPC_SERVICE_CONTROL_OUT_PARAMSW *pControlOutParams + ); + + /*****************/ + /* Function 0x34 */ + void Opnum52NotUsedOnWire(void); + + /*****************/ + /* Function 0x35 */ + void Opnum53NotUsedOnWire(void); + + /*****************/ + /* Function 0x36 */ + void Opnum54NotUsedOnWire(void); + + /*****************/ + /* Function 0x37 */ + void Opnum55NotUsedOnWire(void); + + /*****************/ + /* Function 0x38 */ + + typedef struct { + [string,range(0, 8 * 1024), charset(UTF16)] uint16 *lpDescription; + } SERVICE_DESCRIPTIONW; + + typedef struct { + boolean32 fDelayedAutostart; + } SERVICE_DELAYED_AUTO_START_INFO; + + typedef struct { + boolean32 fFailureActionsOnNonCrashFailures; + } SERVICE_FAILURE_ACTIONS_FLAG; + + typedef struct { + uint32 dwServiceSidType; + } SERVICE_SID_INFO; + + typedef struct { + [range(0, 1024 * 4)] uint32 cbRequiredPrivileges; + [size_is(cbRequiredPrivileges)] uint8 *pRequiredPrivileges; + } SERVICE_RPC_REQUIRED_PRIVILEGES_INFO; + + typedef struct { + uint32 dwPreshutdownTimeout; + } SERVICE_PRESHUTDOWN_INFO; + + typedef struct { + uint32 dwDataType; + [range(0, 1024)] uint32 cbData; + [size_is(cbData)] uint8 *pData; + } SERVICE_TRIGGER_SPECIFIC_DATA_ITEM; + + typedef struct { + uint32 dwTriggerType; + uint32 dwAction; + GUID *pTriggerSubtype; + [range(0, 64)] uint32 cDataItems; + [size_is(cDataItems)] SERVICE_TRIGGER_SPECIFIC_DATA_ITEM *pDataItems; + } SERVICE_TRIGGER; + + typedef struct { + [range(0, 64)] uint32 cTriggers; + [size_is(cTriggers)] SERVICE_TRIGGER *pTriggers; + uint8 *pReserved; + } SERVICE_TRIGGER_INFO; + + typedef struct { + uint16 usPreferredNode; + boolean32 fDelete; + } SERVICE_PREFERRED_NODE_INFO; + + typedef [switch_type(uint32)] union { + [case(1)] SERVICE_DESCRIPTIONW *psd; + [case(2)] SERVICE_FAILURE_ACTIONSW *psfa; + [case(3)] SERVICE_DELAYED_AUTO_START_INFO *psda; + [case(4)] SERVICE_FAILURE_ACTIONS_FLAG *psfaf; + [case(5)] SERVICE_SID_INFO *pssid; + [case(6)] SERVICE_RPC_REQUIRED_PRIVILEGES_INFO *psrp; + [case(7)] SERVICE_PRESHUTDOWN_INFO *psps; + [case(8)] SERVICE_TRIGGER_INFO *psti; + [case(9)] SERVICE_PREFERRED_NODE_INFO *pspn; + } SC_RPC_CONFIG_INFOW_u; + + typedef struct { + uint32 dwInfoLevel; + [switch_is(dwInfoLevel)] SC_RPC_CONFIG_INFOW_u u; + } SC_RPC_CONFIG_INFOW; + + WERROR svcctl_QueryServiceConfigEx ( + [in] SC_RPC_HANDLE hService, + [in] uint32 dwInfoLevel, + [out,ref] SC_RPC_CONFIG_INFOW *pInfo + ); + + /*****************/ + /* Function 0x39 */ + void Opnum57NotUsedOnWire(void); + + /*****************/ + /* Function 0x3a */ + void Opnum58NotUsedOnWire(void); + + /*****************/ + /* Function 0x3b */ + void Opnum59NotUsedOnWire(void); + + /*****************/ + /* Function 0x3c */ + WERROR svcctl_CreateWowService( + [in] SC_RPC_HANDLE hSCManager, + [in,string,range(0, SC_MAX_NAME_LENGTH),charset(UTF16)] uint16 *lpServiceName, + [in,string,unique,range(0, SC_MAX_NAME_LENGTH),charset(UTF16)] uint16 *lpDisplayName, + [in] uint32 dwDesiredAccess, + [in] uint32 dwServiceType, + [in] uint32 dwStartType, + [in] uint32 dwErrorControl, + [in,string,range(0, SC_MAX_PATH_LENGTH),charset(UTF16)] uint16 *lpBinaryPathName, + [in,string,unique,range(0, SC_MAX_NAME_LENGTH),charset(UTF16)] uint16 *lpLoadOrderGroup, + [in,out,unique] uint32 *lpdwTagId, + [in,unique,size_is(dwDependSize)] uint8 *lpDependencies, + [in, range (0, SC_MAX_DEPEND_SIZE)] uint32 dwDependSize, + [in,string,unique,range(0, SC_MAX_ACCOUNT_NAME_LENGTH),charset(UTF16)] uint16 *lpServiceStartName, + [in,unique,size_is(dwPwSize)] uint8 *lpPassword, + [in, range(0, SC_MAX_PWD_SIZE)] uint32 dwPwSize, + [in] uint16 dwServiceWowType, + [out,ref] SC_RPC_HANDLE *lpServiceHandle + ); + + /*****************/ + /* Function 0x3d */ + WERROR svcctl_OpenSCManager2( + [in] handle_t BindingHandle, + [in,string,unique,range(0, SC_MAX_NAME_LENGTH),charset(UTF16)] uint16 *DatabaseName, + [in] uint32 DesiredAccess, + [out,ref] SC_RPC_HANDLE *ScmHandle + ); +} diff --git a/librpc/idl/trkwks.idl b/librpc/idl/trkwks.idl new file mode 100644 index 0000000..7f11af1 --- /dev/null +++ b/librpc/idl/trkwks.idl @@ -0,0 +1,17 @@ +/* + distributed key tracking services +*/ + +[ + uuid("300f3532-38cc-11d0-a3f0-0020af6b0add"), + version(1.2), + pointer_default(unique), + helpstring("Distributed Key Tracking Service") +] +interface trkwks +{ + + /*****************/ + /* Function 0x00 */ + WERROR trkwks_Unknown0(); +} diff --git a/librpc/idl/unixinfo.idl b/librpc/idl/unixinfo.idl new file mode 100644 index 0000000..6929e86 --- /dev/null +++ b/librpc/idl/unixinfo.idl @@ -0,0 +1,56 @@ +#include "idl_types.h" +/* + Unixinfo interface definition +*/ + +import "security.idl"; + +[ uuid("9c54e310-a955-4885-bd31-78787147dfa6"), + version(0.0), + endpoint("ncacn_np:[\\pipe\\unixinfo]", "ncacn_ip_tcp:", "ncalrpc:"), + pointer_default(unique), + helpstring("Unixinfo specific stuff") +] interface unixinfo +{ + /******************/ + /* Function: 0x00 */ + NTSTATUS unixinfo_SidToUid ( + [in] dom_sid sid, + [out] hyper *uid + ); + + /******************/ + /* Function: 0x01 */ + NTSTATUS unixinfo_UidToSid ( + [in] hyper uid, + [out] dom_sid *sid + ); + + /******************/ + /* Function: 0x02 */ + NTSTATUS unixinfo_SidToGid ( + [in] dom_sid sid, + [out] hyper *gid + ); + + /******************/ + /* Function: 0x03 */ + NTSTATUS unixinfo_GidToSid ( + [in] hyper gid, + [out] dom_sid *sid + ); + + typedef struct { + NTSTATUS status; + [charset(UTF8),string] uint8 homedir[]; + [charset(UTF8),string] uint8 shell[]; + } unixinfo_GetPWUidInfo; + + /******************/ + /* Function: 0x04 */ + NTSTATUS unixinfo_GetPWUid ( + [in,out,ref,range(0,1023)] uint32 *count, + [in,size_is(*count)] hyper uids[], + [out,size_is(*count)] unixinfo_GetPWUidInfo infos[*] + ); +} diff --git a/librpc/idl/w32time.idl b/librpc/idl/w32time.idl new file mode 100644 index 0000000..4839899 --- /dev/null +++ b/librpc/idl/w32time.idl @@ -0,0 +1,21 @@ +/* + w32time interface definitions +*/ + +[ + uuid("8fb6d884-2388-11d0-8c35-00c04fda2795"), + endpoint("ncacn_np:[\\pipe\\srvsvc]","ncacn_np:[\\pipe\\atsvc]","ncacn_np:[\\pipe\\browser]","ncacn_np:[\\pipe\\keysvc]","ncacn_np:[\\pipe\\wkssvc]"), + version(4.1), + pointer_default(unique), + helpstring("Win32 Time Server") +] +interface w32time +{ + + /*****************/ + /* Function 0x00 */ + [todo] WERROR w32time_SyncTime(); + + [todo] WERROR w32time_GetNetLogonServiceBits(); + [todo] WERROR w32time_QueryProviderStatus(); +} diff --git a/librpc/idl/winbind.idl b/librpc/idl/winbind.idl new file mode 100644 index 0000000..50e3688 --- /dev/null +++ b/librpc/idl/winbind.idl @@ -0,0 +1,323 @@ +#include "idl_types.h" +import "lsa.idl", "netlogon.idl", "samr.idl", "misc.idl", "security.idl", "idmap.idl"; + +[ + uuid("bf09192c-ed60-4928-9dff-d0d7bcb03ed8"), + endpoint("ncalrpc:"), + pointer_default(unique), + version(1.0), + helpstring("winbind parent-child protocol"), + no_srv_register +] +interface winbind +{ + /* Private methods */ + + NTSTATUS wbint_Ping( + [in] uint32 in_data, + [out] uint32 *out_data + ); + + NTSTATUS wbint_LookupSid( + [in] dom_sid *sid, + [out] lsa_SidType *type, + [out,string,charset(UTF8)] char **domain, + [out,string,charset(UTF8)] char **name + ); + + NTSTATUS wbint_LookupSids( + [in] lsa_SidArray *sids, + [out,ref] lsa_RefDomainList *domains, + [out,ref] lsa_TransNameArray *names + ); + + NTSTATUS wbint_LookupName( + [in,string,charset(UTF8)] char *domain, + [in,string,charset(UTF8)] char *name, + [in] uint32 flags, + [out] lsa_SidType *type, + [out] dom_sid *sid + ); + + typedef struct { + id_type type_hint; + uint32 domain_index; + uint32 rid; + unixid xid; + } wbint_TransID; + + typedef struct { + uint32 num_ids; + [size_is(num_ids)] wbint_TransID ids[]; + } wbint_TransIDArray; + + NTSTATUS wbint_Sids2UnixIDs( + [in] lsa_RefDomainList *domains, + [in,out] wbint_TransIDArray *ids + ); + + NTSTATUS wbint_UnixIDs2Sids( + [in,string,charset(UTF8)] char *domain_name, + [in] dom_sid domain_sid, + [in] uint32 num_ids, + [in,out] unixid xids[num_ids], + [out] dom_sid sids[num_ids] + ); + + NTSTATUS wbint_AllocateUid( + [out] hyper *uid + ); + + NTSTATUS wbint_AllocateGid( + [out] hyper *gid + ); + + typedef [public] struct { + [string,charset(UTF8)] char *domain_name; + [string,charset(UTF8)] char *acct_name; + [string,charset(UTF8)] char *full_name; + [string,charset(UTF8)] char *homedir; + [string,charset(UTF8)] char *shell; + hyper uid; + hyper primary_gid; + [string,charset(UTF8)] char *primary_group_name; + dom_sid user_sid; + dom_sid group_sid; + } wbint_userinfo; + + NTSTATUS wbint_GetNssInfo( + [in,out] wbint_userinfo *info + ); + + typedef [public] struct { + uint32 num_sids; + [size_is(num_sids)] dom_sid sids[]; + } wbint_SidArray; + + typedef [public] struct { + uint32 num_rids; + [size_is(num_rids)] uint32 rids[]; + } wbint_RidArray; + + NTSTATUS wbint_LookupUserAliases( + [in] wbint_SidArray *sids, + [out] wbint_RidArray *rids + ); + + NTSTATUS wbint_LookupUserGroups( + [in] dom_sid *sid, + [out] wbint_SidArray *sids + ); + + NTSTATUS wbint_QuerySequenceNumber( + [out] uint32 *sequence + ); + + typedef [public] struct { + dom_sid sid; + lsa_SidType type; + [string,charset(UTF8)] char *name; + } wbint_Principal; + + typedef [public] struct { + uint32 num_principals; + [size_is(num_principals)] wbint_Principal principals[]; + } wbint_Principals; + + NTSTATUS wbint_LookupGroupMembers( + [in] dom_sid *sid, + [in] lsa_SidType type, + [out] wbint_Principals *members + ); + + NTSTATUS wbint_LookupAliasMembers( + [in] dom_sid *sid, + [in] lsa_SidType type, + [out] wbint_SidArray *sids + ); + + typedef [public] struct { + uint32 num_userinfos; + [size_is(num_userinfos)] wbint_userinfo userinfos[]; + } wbint_userinfos; + + NTSTATUS wbint_QueryGroupList( + [out] wbint_Principals *groups + ); + + NTSTATUS wbint_QueryUserRidList( + [out] wbint_RidArray *rids + ); + + NTSTATUS wbint_DsGetDcName( + [in,string,charset(UTF8)] char *domain_name, + [in,unique] GUID *domain_guid, + [in,string,unique,charset(UTF8)] char *site_name, + [in] uint32 flags, + [out] netr_DsRGetDCNameInfo **dc_info + ); + + NTSTATUS wbint_LookupRids( + [in] dom_sid *domain_sid, + [in] wbint_RidArray *rids, + [out,string,charset(UTF8)] char **domain_name, + [out] wbint_Principals *names + ); + + NTSTATUS wbint_CheckMachineAccount( + ); + + NTSTATUS wbint_ChangeMachineAccount( + [in,unique,string,charset(UTF8)] char *dcname + ); + + NTSTATUS wbint_PingDc( + [out,string,charset(UTF8)] char **dcname + ); + + NTSTATUS wbint_ListTrustedDomains( + [in,string,charset(UTF8)] char *client_name, + [in] hyper client_pid, + [out,ref] netr_DomainTrustList *domains + ); + + typedef [public] struct { + uint16 level; + [switch_is(level)] netr_Validation *validation; + [string,charset(UTF8)] char *krb5ccname; + } wbint_Validation; + + typedef [public] struct { + [string,charset(UTF8)] char *username; + [string,charset(UTF8),flag(NDR_SECRET)] char *password; + [string,charset(UTF8)] char *krb5_cc_type; + hyper uid; + } wbint_AuthUserInfo; + + NTSTATUS wbint_PamAuth( + [in,string,charset(UTF8)] char *client_name, + [in] hyper client_pid, + [in] uint32 flags, + [in] wbint_AuthUserInfo *info, + [in] wbint_SidArray *require_membership_of_sid, + [out,ref] wbint_Validation *validation + ); + + typedef [public] struct { + uint16 level; + [switch_is(level)] netr_Validation *validation; + } wbint_PamAuthCrapValidation; + + NTSTATUS wbint_PamAuthCrap( + [in,string,charset(UTF8)] char *client_name, + [in] hyper client_pid, + [in] uint32 flags, + [in, string,charset(UTF8)] char *user, + [in, string,charset(UTF8)] char *domain, + [in, string,charset(UTF8)] char *workstation, + [in,flag(NDR_SECRET)] DATA_BLOB lm_resp, + [in,flag(NDR_SECRET)] DATA_BLOB nt_resp, + [in,flag(NDR_SECRET)] DATA_BLOB chal, + [in] uint32 logon_parameters, + [in] wbint_SidArray *require_membership_of_sid, + [out,ref] uint8 *authoritative, + [out,ref] wbint_PamAuthCrapValidation *validation + ); + + NTSTATUS wbint_PamLogOff( + [in,string,charset(UTF8)] char *client_name, + [in] hyper client_pid, + [in] uint32 flags, + [in,string,charset(UTF8)] char *user, + [in,string,charset(UTF8)] char *krb5ccname, + [in] hyper uid + ); + + NTSTATUS wbint_PamAuthCrapChangePassword( + [in,string,charset(UTF8)] char *client_name, + [in] hyper client_pid, + [in,string,charset(UTF8)] char *user, + [in,string,charset(UTF8)] char *domain, + [in,flag(NDR_SECRET)] DATA_BLOB new_nt_pswd, + [in,flag(NDR_SECRET)] DATA_BLOB old_nt_hash_enc, + [in,flag(NDR_SECRET)] DATA_BLOB new_lm_pswd, + [in,flag(NDR_SECRET)] DATA_BLOB old_lm_hash_enc + ); + + NTSTATUS wbint_PamAuthChangePassword( + [in,string,charset(UTF8)] char *client_name, + [in] hyper client_pid, + [in] uint32 flags, + [in,string,charset(UTF8)] char *user, + [in,string,charset(UTF8),flag(NDR_SECRET)] char *old_password, + [in,string,charset(UTF8),flag(NDR_SECRET)] char *new_password, + [out,ref] samr_DomInfo1 **dominfo, + [out,ref] samPwdChangeReason *reject_reason + ); + + typedef [enum16bit] enum { + WB_DOMINFO_DOMAIN_UNKNOWN = 0x0000, + WB_DOMINFO_DOMAIN_NATIVE = 0x0001, + WB_DOMINFO_DOMAIN_AD = 0x0002, + WB_DOMINFO_DOMAIN_PRIMARY = 0x0004, + WB_DOMINFO_DOMAIN_OFFLINE = 0x0008 + } DomainInfoFlags; + + NTSTATUS wbint_InitConnection( + [in,string,charset(UTF8)] char *dcname, + [out,string,charset(UTF8)] char **name, + [out,string,charset(UTF8)] char **alt_name, + [out,ref] dom_sid *sid, + [out,ref] DomainInfoFlags *flags + ); + + /* Public methods available via IRPC */ + + typedef [switch_type(uint16)] union netr_LogonLevel netr_LogonLevel; + typedef [switch_type(uint16)] union netr_Validation netr_Validation; + + /* + * do a netr_LogonSamLogon() against the right DC + */ + NTSTATUS winbind_SamLogon( + [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 + ); + + NTSTATUS winbind_DsrUpdateReadOnlyServerDnsRecords( + [in,unique] [string,charset(UTF16)] uint16 *site_name, + [in] uint32 dns_ttl, + [in,out,ref] NL_DNS_NAME_INFO_ARRAY *dns_names + ); + + /* + * do a netr_LogonControl2Ex() against the right DC + */ + typedef [v1_enum] enum netr_LogonControlCode netr_LogonControlCode; + typedef [switch_type(netr_LogonControlCode)] union netr_CONTROL_DATA_INFORMATION netr_CONTROL_DATA_INFORMATION; + typedef [switch_type(uint32)] union netr_CONTROL_QUERY_INFORMATION netr_CONTROL_QUERY_INFORMATION; + + WERROR winbind_LogonControl( + [in] netr_LogonControlCode function_code, + [in] uint32 level, + [in,ref][switch_is(function_code)] netr_CONTROL_DATA_INFORMATION *data, + [out,ref][switch_is(level)] netr_CONTROL_QUERY_INFORMATION *query + ); + + /* + * do a netr_GetForestTrustInformation() against the right DC + */ + WERROR winbind_GetForestTrustInformation( + [in,unique] [string,charset(UTF16)] uint16 *trusted_domain_name, + [in] uint32 flags, + [out,ref] lsa_ForestTrustInformation **forest_trust_info + ); + + NTSTATUS winbind_SendToSam( + [in] netr_SendToSamBase message + ); + +} diff --git a/librpc/idl/windows_event_ids.idl b/librpc/idl/windows_event_ids.idl new file mode 100644 index 0000000..f482800 --- /dev/null +++ b/librpc/idl/windows_event_ids.idl @@ -0,0 +1,52 @@ +/* + IDL constants for windows event codes. +*/ + +[ + pointer_default(unique) +] +interface windows_events +{ + + typedef [v1_enum,public] enum { + EVT_ID_NONE = 0, + EVT_ID_SUCCESSFUL_LOGON = 4624, + EVT_ID_UNSUCCESSFUL_LOGON = 4625, + EVT_ID_PASSWORD_CHANGE = 4723, + EVT_ID_PASSWORD_RESET = 4724, + EVT_ID_USER_ADDED_TO_GLOBAL_SEC_GROUP = 4728, + EVT_ID_USER_REMOVED_FROM_GLOBAL_SEC_GROUP = 4729, + EVT_ID_USER_ADDED_TO_LOCAL_SEC_GROUP = 4732, + EVT_ID_USER_REMOVED_FROM_LOCAL_SEC_GROUP = 4733, + EVT_ID_USER_ADDED_TO_LOCAL_GROUP = 4746, + EVT_ID_USER_REMOVED_FROM_LOCAL_GROUP = 4747, + EVT_ID_USER_ADDED_TO_GLOBAL_GROUP = 4751, + EVT_ID_USER_REMOVED_FROM_GLOBAL_GROUP = 4752, + EVT_ID_USER_ADDED_TO_UNIVERSAL_SEC_GROUP = 4756, + EVT_ID_USER_REMOVED_FROM_UNIVERSAL_SEC_GROUP = 4757, + EVT_ID_USER_ADDED_TO_UNIVERSAL_GROUP = 4761, + EVT_ID_USER_REMOVED_FROM_UNIVERSAL_GROUP = 4762 + } event_id_type; + + /* See https://learn.microsoft.com/en-us/windows-server/security/credentials-protection-and-management/authentication-policies-and-authentication-policy-silos#BKMK_ErrorandEvents */ + typedef [v1_enum,public] enum { + AUTH_EVT_ID_NONE = 0, + AUTH_EVT_ID_NTLM_DEVICE_RESTRICTION = 101, + AUTH_EVT_ID_KERBEROS_DEVICE_RESTRICTION = 105, + AUTH_EVT_ID_KERBEROS_DEVICE_RESTRICTION_AUDIT = 305, + AUTH_EVT_ID_KERBEROS_SERVER_RESTRICTION = 106, + AUTH_EVT_ID_KERBEROS_SERVER_RESTRICTION_AUDIT = 306 + } auth_event_id_type; + + typedef [v1_enum,public] enum { + EVT_LOGON_INTERACTIVE = 2, + EVT_LOGON_NETWORK = 3, + EVT_LOGON_BATCH = 4, + EVT_LOGON_SERVICE = 5, + EVT_LOGON_UNLOCK = 7, + EVT_LOGON_NETWORK_CLEAR_TEXT = 8, + EVT_LOGON_NEW_CREDENTIALS = 9, + EVT_LOGON_REMOTE_INTERACTIVE = 10, + EVT_LOGON_CACHED_INTERACTIVE = 11 + } event_logon_type; +} diff --git a/librpc/idl/winreg.cnf b/librpc/idl/winreg.cnf new file mode 100644 index 0000000..e5a146c --- /dev/null +++ b/librpc/idl/winreg.cnf @@ -0,0 +1,52 @@ +IMPORT security_secinfo offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, hf_winreg_winreg_GetKeySecurity_sec_info, NULL); + +HF_FIELD hf_winreg_access_required "Access Required" "winreg.access_required" FT_UINT32 BASE_HEX NULL 0 "" "" "" + +HF_RENAME hf_winreg_winreg_OpenHKCR_access_required hf_winreg_access_required +HF_RENAME hf_winreg_winreg_OpenHKLM_access_required hf_winreg_access_required +HF_RENAME hf_winreg_winreg_OpenHKU_access_required hf_winreg_access_required +HF_RENAME hf_winreg_winreg_CreateKey_access_required hf_winreg_access_required +HF_RENAME hf_winreg_winreg_OpenHKCC_access_required hf_winreg_access_required +HF_RENAME hf_winreg_winreg_OpenHKDD_access_required hf_winreg_access_required +HF_RENAME hf_winreg_winreg_OpenHKPT_access_required hf_winreg_access_required +HF_RENAME hf_winreg_winreg_OpenHKPN_access_required hf_winreg_access_required + +HF_FIELD hf_winreg_system_name "System Name" "winreg.system_name" FT_UINT16 BASE_DEC NULL 0 "" "" "" + +HF_RENAME hf_winreg_winreg_OpenHKCR_system_name hf_winreg_system_name +HF_RENAME hf_winreg_winreg_OpenHKCU_system_name hf_winreg_system_name +HF_RENAME hf_winreg_winreg_OpenHKLM_system_name hf_winreg_system_name +HF_RENAME hf_winreg_winreg_OpenHKPD_system_name hf_winreg_system_name +HF_RENAME hf_winreg_winreg_OpenHKU_system_name hf_winreg_system_name +HF_RENAME hf_winreg_winreg_OpenHKCC_system_name hf_winreg_system_name +HF_RENAME hf_winreg_winreg_OpenHKDD_system_name hf_winreg_system_name +HF_RENAME hf_winreg_winreg_OpenHKPT_system_name hf_winreg_system_name +HF_RENAME hf_winreg_winreg_OpenHKPN_system_name hf_winreg_system_name + +HF_FIELD hf_winreg_handle "Handle" "winreg.handle" FT_BYTES BASE_NONE NULL 0 "" "" "" + +HF_RENAME hf_winreg_winreg_OpenHKCR_handle hf_winreg_handle +HF_RENAME hf_winreg_winreg_OpenHKCU_handle hf_winreg_handle +HF_RENAME hf_winreg_winreg_OpenHKLM_handle hf_winreg_handle +HF_RENAME hf_winreg_winreg_OpenHKPD_handle hf_winreg_handle +HF_RENAME hf_winreg_winreg_OpenHKU_handle hf_winreg_handle +HF_RENAME hf_winreg_winreg_CloseKey_handle hf_winreg_handle +HF_RENAME hf_winreg_winreg_CreateKey_handle hf_winreg_handle +HF_RENAME hf_winreg_winreg_DeleteKey_handle hf_winreg_handle +HF_RENAME hf_winreg_winreg_DeleteValue_handle hf_winreg_handle +HF_RENAME hf_winreg_winreg_EnumKey_handle hf_winreg_handle +HF_RENAME hf_winreg_winreg_EnumValue_handle hf_winreg_handle +HF_RENAME hf_winreg_winreg_FlushKey_handle hf_winreg_handle +HF_RENAME hf_winreg_winreg_GetKeySecurity_handle hf_winreg_handle +HF_RENAME hf_winreg_winreg_LoadKey_handle hf_winreg_handle +HF_RENAME hf_winreg_winreg_NotifyChangeKeyValue_handle hf_winreg_handle +HF_RENAME hf_winreg_winreg_OpenKey_handle hf_winreg_handle +HF_RENAME hf_winreg_winreg_QueryInfoKey_handle hf_winreg_handle +HF_RENAME hf_winreg_winreg_QueryValue_handle hf_winreg_handle +HF_RENAME hf_winreg_winreg_SetKeySecurity_handle hf_winreg_handle +HF_RENAME hf_winreg_winreg_SetValue_handle hf_winreg_handle +HF_RENAME hf_winreg_winreg_GetVersion_handle hf_winreg_handle +HF_RENAME hf_winreg_winreg_OpenHKCC_handle hf_winreg_handle +HF_RENAME hf_winreg_winreg_OpenHKDD_handle hf_winreg_handle +HF_RENAME hf_winreg_winreg_OpenHKPT_handle hf_winreg_handle +HF_RENAME hf_winreg_winreg_OpenHKPN_handle hf_winreg_handle diff --git a/librpc/idl/winreg.idl b/librpc/idl/winreg.idl new file mode 100644 index 0000000..edbcc30 --- /dev/null +++ b/librpc/idl/winreg.idl @@ -0,0 +1,459 @@ +/* + winreg interface definition +*/ + +import "lsa.idl", "security.idl", "misc.idl"; + +[ + uuid("338cd001-2244-31f1-aaaa-900038001003"), + version(1.0), + endpoint("ncacn_np:[\\pipe\\winreg]","ncacn_ip_tcp:","ncalrpc:"), + pointer_default(unique), + helpstring("Remote Registry Service") +] interface winreg +{ + typedef bitmap security_secinfo security_secinfo; + + /* + * Access Bits for registry ACLS + */ + + typedef [public,bitmap32bit] bitmap { + KEY_QUERY_VALUE = 0x00001, + KEY_SET_VALUE = 0x00002, + KEY_CREATE_SUB_KEY = 0x00004, + KEY_ENUMERATE_SUB_KEYS = 0x00008, + KEY_NOTIFY = 0x00010, + KEY_CREATE_LINK = 0x00020, + KEY_WOW64_64KEY = 0x00100, + KEY_WOW64_32KEY = 0x00200 + } winreg_AccessMask; + + const int REG_KEY_READ = ( STANDARD_RIGHTS_READ_ACCESS | + KEY_QUERY_VALUE | + KEY_ENUMERATE_SUB_KEYS | + KEY_NOTIFY); + + const int REG_KEY_EXECUTE = REG_KEY_READ; + + const int REG_KEY_WRITE = ( STANDARD_RIGHTS_WRITE_ACCESS | + KEY_SET_VALUE | + KEY_CREATE_SUB_KEY); + + const int REG_KEY_ALL = ( STANDARD_RIGHTS_REQUIRED_ACCESS | + REG_KEY_READ | + REG_KEY_WRITE | + KEY_CREATE_LINK); + + typedef [public] struct { + [value(strlen_m_term(name)*2)] uint16 name_len; + [value(strlen_m_term(name)*2)] uint16 name_size; + [string,charset(UTF16)] uint16 *name; + } winreg_String; + + /******************/ + /* Function: 0x00 */ + WERROR winreg_OpenHKCR( + [in,unique] uint16 *system_name, + [in] winreg_AccessMask access_mask, + [out,ref] policy_handle *handle + ); + + /******************/ + /* Function: 0x01 */ + WERROR winreg_OpenHKCU( + [in,unique] uint16 *system_name, + [in] winreg_AccessMask access_mask, + [out,ref] policy_handle *handle + ); + + /******************/ + /* Function: 0x02 */ + [public] WERROR winreg_OpenHKLM( + [in,unique] uint16 *system_name, + [in] winreg_AccessMask access_mask, + [out,ref] policy_handle *handle + ); + + /******************/ + /* Function: 0x03 */ + WERROR winreg_OpenHKPD( + [in,unique] uint16 *system_name, + [in] winreg_AccessMask access_mask, + [out,ref] policy_handle *handle + ); + + /******************/ + /* Function: 0x04 */ + WERROR winreg_OpenHKU( + [in,unique] uint16 *system_name, + [in] winreg_AccessMask access_mask, + [out,ref] policy_handle *handle + ); + + /******************/ + /* Function: 0x05 */ + [public] WERROR winreg_CloseKey( + [in,out,ref] policy_handle *handle + ); + + /******************/ + /* Function: 0x06 */ + + typedef struct { + [size_is(size),length_is(len)] uint8 *data; + uint32 size; + uint32 len; + } KeySecurityData; + + typedef struct { + uint32 length; + KeySecurityData sd; + boolean8 inherit; + } winreg_SecBuf; + + const int REG_OPTION_NON_VOLATILE = 0x00000000; + + typedef [bitmap32bit] bitmap { + REG_OPTION_VOLATILE = 0x00000001, + REG_OPTION_CREATE_LINK = 0x00000002, + REG_OPTION_BACKUP_RESTORE = 0x00000004, + REG_OPTION_OPEN_LINK = 0x00000008 + } winreg_KeyOptions; + + typedef [v1_enum] enum { + REG_ACTION_NONE = 0, /* used by caller */ + REG_CREATED_NEW_KEY = 1, + REG_OPENED_EXISTING_KEY = 2 + } winreg_CreateAction; + + [public] WERROR winreg_CreateKey( + [in,ref] policy_handle *handle, + [in] winreg_String name, + [in] winreg_String keyclass, + [in] winreg_KeyOptions options, + [in] winreg_AccessMask access_mask, + [in,unique] winreg_SecBuf *secdesc, + [out,ref] policy_handle *new_handle, + [in,out,unique] winreg_CreateAction *action_taken + ); + + /******************/ + /* Function: 0x07 */ + [public] WERROR winreg_DeleteKey( + [in,ref] policy_handle *handle, + [in] winreg_String key + ); + + /******************/ + /* Function: 0x08 */ + WERROR winreg_DeleteValue( + [in,ref] policy_handle *handle, + [in] winreg_String value + ); + + typedef struct { + [value(strlen_m_term_null(name)*2)] uint16 length; + /* size cannot be auto-set by value() as it is the + amount of space the server is allowed to use for this + string in the reply, not its current size */ + uint16 size; + [size_is(size/2),length_is(length/2),charset(UTF16)] uint16 *name; + } winreg_StringBuf; + + /******************/ + /* Function: 0x09 */ + [public] WERROR winreg_EnumKey( + [in,ref] policy_handle *handle, + [in] uint32 enum_index, + [in,out,ref] winreg_StringBuf *name, + [in,out,unique] winreg_StringBuf *keyclass, + [in,out,unique] NTTIME *last_changed_time + ); + + typedef struct { + [value(strlen_m_term(name)*2)] uint16 length; + /* size cannot be auto-set by value() as it is the + amount of space the server is allowed to use for this + string in the reply, not its current size */ + uint16 size; + [size_is(size/2),length_is(length/2),charset(UTF16)] uint16 *name; + } winreg_ValNameBuf; + + /******************/ + /* Function: 0x0a */ + + [public] WERROR winreg_EnumValue( + [in,ref] policy_handle *handle, + [in] uint32 enum_index, + [in,out,ref] winreg_ValNameBuf *name, + [in,out,unique] winreg_Type *type, + [in,out,unique,size_is(size ? *size : 0),length_is(length ? *length : 0),range(0,0x4000000)] uint8 *value, + [in,out,unique] uint32 *size, + [in,out,unique] uint32 *length + ); + + /******************/ + /* Function: 0x0b */ + [public] WERROR winreg_FlushKey( + [in,ref] policy_handle *handle + ); + + /******************/ + /* Function: 0x0c */ + [public] WERROR winreg_GetKeySecurity( + [in,ref] policy_handle *handle, + [in] security_secinfo sec_info, + [in,out,ref] KeySecurityData *sd + ); + + /******************/ + /* Function: 0x0d */ + WERROR winreg_LoadKey( + [in,ref] policy_handle *handle, + [in,unique] winreg_String *keyname, + [in,unique] winreg_String *filename + ); + + /******************/ + /* Function: 0x0e */ + typedef [public,bitmap32bit] bitmap { + REG_NOTIFY_CHANGE_NAME = 0x00000001, + REG_NOTIFY_CHANGE_ATTRIBUTES = 0x00000002, + REG_NOTIFY_CHANGE_LAST_SET = 0x00000004, + REG_NOTIFY_CHANGE_SECURITY = 0x00000008 + } winreg_NotifyChangeType; + + [public] WERROR winreg_NotifyChangeKeyValue( + [in,ref] policy_handle *handle, + [in] boolean8 watch_subtree, + [in] winreg_NotifyChangeType notify_filter, + [in] uint32 unknown, + [in] winreg_String string1, + [in] winreg_String string2, + [in] uint32 unknown2 + ); + + /******************/ + /* Function: 0x0f */ + [public] WERROR winreg_OpenKey( + [in,ref] policy_handle *parent_handle, + [in] winreg_String keyname, + [in] winreg_KeyOptions options, + [in] winreg_AccessMask access_mask, + [out,ref] policy_handle *handle + ); + + /******************/ + /* Function: 0x10 */ + [public] WERROR winreg_QueryInfoKey( + [in,ref] policy_handle *handle, + [in,out,ref] winreg_String *classname, + [out,ref] uint32 *num_subkeys, + [out,ref] uint32 *max_subkeylen, + [out,ref] uint32 *max_classlen, + [out,ref] uint32 *num_values, + [out,ref] uint32 *max_valnamelen, + [out,ref] uint32 *max_valbufsize, + [out,ref] uint32 *secdescsize, + [out,ref] NTTIME *last_changed_time + ); + + /******************/ + /* Function: 0x11 */ + [public] WERROR winreg_QueryValue( + [in,ref] policy_handle *handle, + [in,ref] winreg_String *value_name, + [in,out,unique] winreg_Type *type, + [in,out,unique,size_is(data_size ? *data_size : 0),length_is(data_length ? *data_length : 0),range(0,0x4000000)] uint8 *data, + [in,out,unique] uint32 *data_size, + [in,out,unique] uint32 *data_length + ); + + /******************/ + /* Function: 0x12 */ + WERROR winreg_ReplaceKey( + [in,ref] policy_handle *handle, + [in,ref] winreg_String *subkey, + [in,ref] winreg_String *new_file, + [in,ref] winreg_String *old_file + ); + + /******************/ + /* Function: 0x13 */ + + typedef [public,bitmap32bit] bitmap { + REG_WHOLE_HIVE_VOLATILE = 0x00000001, + REG_REFRESH_HIVE = 0x00000002, + REG_NO_LAZY_FLUSH = 0x00000004, + REG_FORCE_RESTORE = 0x00000008 + } winreg_RestoreKeyFlags; + + WERROR winreg_RestoreKey( + [in,ref] policy_handle *handle, + [in,ref] winreg_String *filename, + [in] winreg_RestoreKeyFlags flags + ); + + /******************/ + /* Function: 0x14 */ + + typedef struct { + uint32 data_size; + KeySecurityData sec_data; + uint8 inherit; + } KeySecurityAttribute; + + WERROR winreg_SaveKey( + [in,ref] policy_handle *handle, + [in,ref] winreg_String *filename, + [in,unique] KeySecurityAttribute *sec_attrib + ); + + /******************/ + /* Function: 0x15 */ + WERROR winreg_SetKeySecurity( + [in,ref] policy_handle *handle, + [in] security_secinfo sec_info, + [in,ref] KeySecurityData *sd + ); + + /******************/ + /* Function: 0x16 */ + WERROR winreg_SetValue( + [in,ref] policy_handle *handle, + [in] winreg_String name, + [in] winreg_Type type, + [in,size_is(size),ref] uint8 *data, + [in] uint32 size + ); + + /******************/ + /* Function: 0x17 */ + WERROR winreg_UnLoadKey( + [in,ref] policy_handle *handle, + [in,ref] winreg_String *subkey + ); + + /******************/ + /* Function: 0x18 */ + WERROR winreg_InitiateSystemShutdown( + [in,unique] uint16 *hostname, + /* + * Note: lsa_String and winreg_String both result + * in WERR_INVALID_PARAMETER + */ + [in,unique] lsa_StringLarge *message, + [in] uint32 timeout, + [in] uint8 force_apps, + [in] uint8 do_reboot + ); + + /******************/ + /* Function: 0x19 */ + WERROR winreg_AbortSystemShutdown( + [in,unique] uint16 *server + ); + + /******************/ + /* Function: 0x1a */ + [public] WERROR winreg_GetVersion( + [in,ref] policy_handle *handle, + [out,ref] uint32 *version + ); + + /******************/ + /* Function: 0x1b */ + WERROR winreg_OpenHKCC( + [in,unique] uint16 *system_name, + [in] winreg_AccessMask access_mask, + [out,ref] policy_handle *handle + ); + + /******************/ + /* Function: 0x1c */ + WERROR winreg_OpenHKDD( + [in,unique] uint16 *system_name, + [in] winreg_AccessMask access_mask, + [out,ref] policy_handle *handle + ); + + typedef struct { + winreg_ValNameBuf *ve_valuename; + uint32 ve_valuelen; + uint32 ve_valueptr; + winreg_Type ve_type; + } QueryMultipleValue; + + /******************/ + /* Function: 0x1d */ + [public] WERROR winreg_QueryMultipleValues( + [in,ref] policy_handle *key_handle, + [in,ref,size_is(num_values),length_is(num_values)] QueryMultipleValue *values_in, + [out,ref,size_is(num_values),length_is(num_values)] QueryMultipleValue *values_out, + [in] uint32 num_values, + [in,out,unique,size_is(*buffer_size),length_is(*buffer_size)] uint8 *buffer, + [in,out,ref] uint32 *buffer_size + ); + + /******************/ + /* Function: 0x1e */ + WERROR winreg_InitiateSystemShutdownEx( + [in,unique] uint16 *hostname, + /* + * Note: lsa_String and winreg_String both result + * in WERR_INVALID_PARAMETER + */ + [in,unique] lsa_StringLarge *message, + [in] uint32 timeout, + [in] uint8 force_apps, + [in] uint8 do_reboot, + [in] uint32 reason + ); + + /******************/ + /* Function: 0x1f */ + WERROR winreg_SaveKeyEx( + [in,ref] policy_handle *handle, + [in,ref] winreg_String *filename, + [in,unique] KeySecurityAttribute *sec_attrib, + [in] uint32 flags + ); + + /******************/ + /* Function: 0x20 */ + WERROR winreg_OpenHKPT( + [in,unique] uint16 *system_name, + [in] winreg_AccessMask access_mask, + [out,ref] policy_handle *handle + ); + + /******************/ + /* Function: 0x21 */ + WERROR winreg_OpenHKPN( + [in,unique] uint16 *system_name, + [in] winreg_AccessMask access_mask, + [out,ref] policy_handle *handle + ); + + /******************/ + /* Function: 0x22 */ + [public] WERROR winreg_QueryMultipleValues2( + [in,ref] policy_handle *key_handle, + [in,ref,size_is(num_values),length_is(num_values)] QueryMultipleValue *values_in, + [out,ref,size_is(num_values),length_is(num_values)] QueryMultipleValue *values_out, + [in] uint32 num_values, + [in,out,unique,size_is(*offered),length_is(*offered)] uint8 *buffer, + [in,ref] uint32 *offered, + [out,ref] uint32 *needed + ); + + /******************/ + /* Function: 0x23 */ + WERROR winreg_DeleteKeyEx( + [in,ref] policy_handle *handle, + [in,ref] winreg_String *key, + [in] winreg_AccessMask access_mask, + [in] uint32 reserved + ); +} diff --git a/librpc/idl/winspool.idl b/librpc/idl/winspool.idl new file mode 100644 index 0000000..5497a67 --- /dev/null +++ b/librpc/idl/winspool.idl @@ -0,0 +1,878 @@ +#include "idl_types.h" + +/* + * IRemoteWinspool interface definitions + * + * This IDL defines the "Print System Asynchronous Remote Protocol" MS-PAR + * interface. + * + * Currently only eight functions in this interface have no matching functions + * in the "spoolss" interface. All other functions have a 1-to-1 match but + * different opcodes than the spoolss interface. + * + * Every request on this interface requires a object uuid of + * "9940CA8E-512F-4C58-88A9-61098D6896BD" to be sent along with the DCE/RPC + * header. + * + * On Windows, this interface uses [ncacn_ip_tcp] transport and requires + * DCERPC_AUTH_TYPE_SPNEGO and at least DCERPC_AUTH_LEVEL_PACKET authentication. + * + * + */ + +import "misc.idl", "security.idl", "winreg.idl", "spoolss.idl"; + +[ + uuid("76f03f96-cdfd-44fc-a22c-64950A001209"), + version(1.0), + endpoint("ncacn_ip_tcp:"), + pointer_default(unique), + helpstring("IRemoteWinspool SubSystem") +] + interface iremotewinspool +{ +#if 0 + /* + * pidl does not yet have a real [context_handle] implementation, so we + * just use some defines here. + */ + + typedef [context_handle] void *GDI_HANDLE; + typedef [context_handle] void *PRINTER_HANDLE; + typedef [context_handle] void *RMTNTFY_HANDLE; +#else +#define GDI_HANDLE policy_handle +#define PRINTER_HANDLE policy_handle +#define RMTNTFY_HANDLE policy_handle +#endif + + const string IREMOTEWINSPOOL_OBJECT_GUID = "9940CA8E-512F-4C58-88A9-61098D6896BD"; + + /******************/ + /* Function: 0x00 */ + + typedef struct { + spoolss_NotifyInfo *pInfo; + } winspool_NOTIFY_REPLY_CONTAINER; + + typedef struct { + spoolss_NotifyOption *pOptions; + } winspool_NOTIFY_OPTIONS_CONTAINER; + + [public] WERROR winspool_AsyncOpenPrinter( + [in,unique] [string,charset(UTF16)] uint16 *pPrinterName, + [out] PRINTER_HANDLE *pHandle, + [in,unique] [string,charset(UTF16)] uint16 *pDatatype, + [in] spoolss_DevmodeContainer *pDevModeContainer, + [in] uint32 AccessRequired, + [in] spoolss_UserLevelCtr *pClientInfo + ); + + /******************/ + /* Function: 0x01 */ + + WERROR winspool_AsyncAddPrinter( + [in,unique] [string,charset(UTF16)] uint16 *pName, + [in] spoolss_SetPrinterInfoCtr *pPrinterContainer, + [in] spoolss_DevmodeContainer *pDevModeContainer, + [in] sec_desc_buf *pSecurityContainer, + [in] spoolss_UserLevelCtr *pClientInfo, + [out] PRINTER_HANDLE *pHandle + ); + + /******************/ + /* Function: 0x02 */ + + WERROR winspool_AsyncSetJob( + [in] PRINTER_HANDLE hPrinter, + [in] uint32 JobId, + [in, unique] spoolss_JobInfoContainer *pJobContainer, + [in] uint32 Command + ); + + /******************/ + /* Function: 0x03 */ + + WERROR winspool_AsyncGetJob( + [in] PRINTER_HANDLE hPrinter, + [in] uint32 JobId, + [in] uint32 Level, + [in, out, unique, size_is(cbBuf)] uint8 *pJob, + [in] uint32 cbBuf, + [out] uint32 *pcbNeeded + ); + + /******************/ + /* Function: 0x04 */ + + WERROR winspool_AsyncEnumJobs( + [in] PRINTER_HANDLE hPrinter, + [in] uint32 FirstJob, + [in] uint32 NoJobs, + [in] uint32 Level, + [in, out, unique, size_is(cbBuf)] uint8 *pJob, + [in] uint32 cbBuf, + [out] uint32 *pcbNeeded, + [out] uint32 *pcReturned + ); + + /******************/ + /* Function: 0x05 */ + + WERROR winspool_AsyncAddJob( + [in] PRINTER_HANDLE hPrinter, + [in] uint32 Level, + [in, out, unique, size_is(cbBuf)] uint8 *pAddJob, + [in] uint32 cbBuf, + [out] uint32 *pcbNeeded + ); + + /******************/ + /* Function: 0x06 */ + + WERROR winspool_AsyncScheduleJob( + [in] PRINTER_HANDLE hPrinter, + [in] uint32 JobId + ); + + /******************/ + /* Function: 0x07 */ + + WERROR winspool_AsyncDeletePrinter( + [in] PRINTER_HANDLE hPrinter + ); + + /******************/ + /* Function: 0x08 */ + + [public] WERROR winspool_AsyncSetPrinter( + [in] PRINTER_HANDLE hPrinter, + [in] spoolss_SetPrinterInfoCtr *pPrinterContainer, + [in] spoolss_DevmodeContainer *pDevModeContainer, + [in] sec_desc_buf *pSecurityContainer, + [in] uint32 Command + ); + + /******************/ + /* Function: 0x09 */ + + [public] WERROR winspool_AsyncGetPrinter( + [in] PRINTER_HANDLE hPrinter, + [in] uint32 Level, + [in, out, unique, size_is(cbBuf)] uint8 *pPrinter, + [in] uint32 cbBuf, + [out] uint32 *pcbNeeded + ); + + /******************/ + /* Function: 0x0a */ + + WERROR winspool_AsyncStartDocPrinter( + [in] PRINTER_HANDLE hPrinter, + [in] spoolss_DocumentInfoCtr *pDocInfoContainer, + [out] uint32 *pJobId + ); + + /******************/ + /* Function: 0x0b */ + + WERROR winspool_AsyncStartPagePrinter( + [in] PRINTER_HANDLE hPrinter + ); + + /******************/ + /* Function: 0x0c */ + + WERROR winspool_AsyncWritePrinter( + [in] PRINTER_HANDLE hPrinter, + [in, size_is(cbBuf)] uint8 *pBuf, + [in] uint32 cbBuf, + [out] uint32 *pcWritten + ); + + /******************/ + /* Function: 0x0d */ + + WERROR winspool_AsyncEndPagePrinter( + [in] PRINTER_HANDLE hPrinter + ); + + /******************/ + /* Function: 0x0e */ + + WERROR winspool_AsyncEndDocPrinter( + [in] PRINTER_HANDLE hPrinter + ); + + /******************/ + /* Function: 0x0f */ + + WERROR winspool_AsyncAbortPrinter( + [in] PRINTER_HANDLE hPrinter + ); + + /******************/ + /* Function: 0x10 */ + + [public] WERROR winspool_AsyncGetPrinterData( + [in] PRINTER_HANDLE hPrinter, + [in] [string,charset(UTF16)] uint16 *pValueName, + [out] uint32 *pType, + [out, size_is(nSize)] uint8 *pData, + [in] uint32 nSize, + [out] uint32 *pcbNeeded + ); + + /******************/ + /* Function: 0x11 */ + + WERROR winspool_AsyncGetPrinterDataEx( + [in] PRINTER_HANDLE hPrinter, + [in] [string,charset(UTF16)] uint16 *pKeyName, + [in] [string,charset(UTF16)] uint16 *pValueName, + [out] uint32 *pType, + [out, size_is(nSize)] uint8 *pData, + [in] uint32 nSize, + [out] uint32 *pcbNeeded + ); + + /******************/ + /* Function: 0x12 */ + + WERROR winspool_AsyncSetPrinterData( + [in] PRINTER_HANDLE hPrinter, + [in] [string,charset(UTF16)] uint16 *pValueName, + [in] uint32 Type, + [in, size_is(cbData)] uint8 *pData, + [in] uint32 cbData + ); + + /******************/ + /* Function: 0x13 */ + + WERROR winspool_AsyncSetPrinterDataEx( + [in] PRINTER_HANDLE hPrinter, + [in] [string,charset(UTF16)] uint16 *pKeyName, + [in] [string,charset(UTF16)] uint16 *pValueName, + [in] uint32 Type, + [in, size_is(cbData)] uint8 *pData, + [in] uint32 cbData + ); + + /******************/ + /* Function: 0x14 */ + + [public] WERROR winspool_AsyncClosePrinter( + [in, out] PRINTER_HANDLE *phPrinter + ); + + /******************/ + /* Function: 0x15 */ + + WERROR winspool_AsyncAddForm( + [in] PRINTER_HANDLE hPrinter, + [in] spoolss_AddFormInfoCtr *pFormInfoContainer + ); + + /******************/ + /* Function: 0x16 */ + + WERROR winspool_AsyncDeleteForm( + [in] PRINTER_HANDLE hPrinter, + [in] [string,charset(UTF16)] uint16 *pFormName + ); + + /******************/ + /* Function: 0x17 */ + + WERROR winspool_AsyncGetForm( + [in] PRINTER_HANDLE hPrinter, + [in] [string,charset(UTF16)] uint16 *pFormName, + [in] uint32 Level, + [in, out, unique, size_is(cbBuf)] uint8 *pForm, + [in] uint32 cbBuf, + [out] uint32 *pcbNeeded + ); + + /******************/ + /* Function: 0x18 */ + + WERROR winspool_AsyncSetForm( + [in] PRINTER_HANDLE hPrinter, + [in] [string,charset(UTF16)] uint16 *pFormName, + [in] spoolss_AddFormInfoCtr *pFormInfoContainer + ); + + /******************/ + /* Function: 0x19 */ + + [public] WERROR winspool_AsyncEnumForms( + [in] PRINTER_HANDLE hPrinter, + [in] uint32 Level, + [in, out, unique, size_is(cbBuf)] uint8 *pForm, + [in] uint32 cbBuf, + [out] uint32 *pcbNeeded, + [out] uint32 *pcReturned + ); + + /******************/ + /* Function: 0x1a */ + + [public] WERROR winspool_AsyncGetPrinterDriver( + [in] PRINTER_HANDLE hPrinter, + [in,unique] [string,charset(UTF16)] uint16 *pEnvironment, + [in] uint32 Level, + [in, out, unique, size_is(cbBuf)] uint8 *pDriver, + [in] uint32 cbBuf, + [out] uint32 *pcbNeeded, + [in] uint32 dwClientMajorVersion, + [in] uint32 dwClientMinorVersion, + [out] uint32 *pdwServerMaxVersion, + [out] uint32 *pdwServerMinVersion + ); + + /******************/ + /* Function: 0x1b */ + + WERROR winspool_AsyncEnumPrinterData( + [in] PRINTER_HANDLE hPrinter, + [in] uint32 dwIndex, + [out, size_is(cbValueName/2)] uint16 *pValueName, + [in] uint32 cbValueName, + [out] uint32 *pcbValueName, + [out] uint32 *pType, + [out, size_is(cbData)] uint8 *pData, + [in] uint32 cbData, + [out] uint32 *pcbData + ); + + /******************/ + /* Function: 0x1c */ + + [public] WERROR winspool_AsyncEnumPrinterDataEx( + [in] PRINTER_HANDLE hPrinter, + [in] [string,charset(UTF16)] uint16 *pKeyName, + [out, size_is(cbEnumValues)] uint8 *pEnumValues, + [in] uint32 cbEnumValues, + [out] uint32 *pcbEnumValues, + [out] uint32 *pnEnumValues + ); + + /******************/ + /* Function: 0x1d */ + + [public] WERROR winspool_AsyncEnumPrinterKey( + [in] PRINTER_HANDLE hPrinter, + [in] [string,charset(UTF16)] uint16 *pKeyName, + [out, size_is(cbSubkey/2)] uint16 *pSubkey, + [in] uint32 cbSubkey, + [out] uint32 *pcbSubkey + ); + + /******************/ + /* Function: 0x1e */ + + WERROR winspool_AsyncDeletePrinterData( + [in] PRINTER_HANDLE hPrinter, + [in] [string,charset(UTF16)] uint16 *pValueName + ); + + /******************/ + /* Function: 0x1f */ + + WERROR winspool_AsyncDeletePrinterDataEx( + [in] PRINTER_HANDLE hPrinter, + [in] [string,charset(UTF16)] uint16 *pKeyName, + [in] [string,charset(UTF16)] uint16 *pValueName + ); + + /******************/ + /* Function: 0x20 */ + + WERROR winspool_AsyncDeletePrinterKey( + [in] PRINTER_HANDLE hPrinter, + [in] [string,charset(UTF16)] uint16 *pKeyName + ); + + /******************/ + /* Function: 0x21 */ + + WERROR winspool_AsyncXcvData( + [in] PRINTER_HANDLE hXcv, + [in] [string,charset(UTF16)] uint16 *pszDataName, + [in, size_is(cbInputData)] uint8 *pInputData, + [in] uint32 cbInputData, + [out, size_is(cbOutputData)] uint8 *pOutputData, + [in] uint32 cbOutputData, + [out] uint32 *pcbOutputNeeded, + [in, out] uint32 *pdwStatus + ); + + /******************/ + /* Function: 0x22 */ + + WERROR winspool_AsyncSendRecvBidiData ( + [in] PRINTER_HANDLE hPrinter, + [in,unique] [string,charset(UTF16)] uint16 *pAction, + [in] RPC_BIDI_REQUEST_CONTAINER* pReqData, + [out] RPC_BIDI_RESPONSE_CONTAINER** ppRespData + ); + + /******************/ + /* Function: 0x23 */ + + WERROR winspool_AsyncCreatePrinterIC( + [in] PRINTER_HANDLE hPrinter, + [out] GDI_HANDLE *pHandle, + [in] spoolss_DevmodeContainer *pDevModeContainer + ); + + /******************/ + /* Function: 0x24 */ + + WERROR winspool_AsyncPlayGdiScriptOnPrinterIC( + [in] GDI_HANDLE hPrinterIC, + [in, size_is(cIn)] uint8 *pIn, + [in] uint32 cIn, + [out, size_is(cOut)] uint8 *pOut, + [in] uint32 cOut, + [in] uint32 ul + ); + + /******************/ + /* Function: 0x25 */ + + WERROR winspool_AsyncDeletePrinterIC( + [in, out] GDI_HANDLE *phPrinterIC + ); + + /******************/ + /* Function: 0x26 */ + + WERROR winspool_AsyncEnumPrinters( + [in] uint32 Flags, + [in,unique] [string,charset(UTF16)] uint16 *pName, + [in] uint32 Level, + [in, out, unique, size_is(cbBuf)] uint8 *pPrinterEnum, + [in] uint32 cbBuf, + [out] uint32 *pcbNeeded, + [out] uint32 *pcReturned + ); + + /******************/ + /* Function: 0x27 */ + + [public] WERROR winspool_AsyncAddPrinterDriver( + [in,unique] [string,charset(UTF16)] uint16 *pName, + [in] spoolss_AddDriverInfoCtr *pDriverContainer, + [in] uint32 dwFileCopyFlags + ); + + /******************/ + /* Function: 0x28 */ + + WERROR winspool_AsyncEnumPrinterDrivers( + [in,unique] [string,charset(UTF16)] uint16 *pName, + [in,unique] [string,charset(UTF16)] uint16 *pEnvironment, + [in] uint32 Level, + [in, out, unique, size_is(cbBuf)] uint8 *pDrivers, + [in] uint32 cbBuf, + [out] uint32 *pcbNeeded, + [out] uint32 *pcReturned + ); + + /******************/ + /* Function: 0x29 */ + + [public] WERROR winspool_AsyncGetPrinterDriverDirectory( + [in,unique] [string,charset(UTF16)] uint16 *pName, + [in,unique] [string,charset(UTF16)] uint16 *pEnvironment, + [in] uint32 Level, + [in, out, unique, size_is(cbBuf)] uint8 *pDriverDirectory, + [in] uint32 cbBuf, + [out] uint32 *pcbNeeded + ); + + /******************/ + /* Function: 0x2a */ + + WERROR winspool_AsyncDeletePrinterDriver( + [in,unique] [string,charset(UTF16)] uint16 *pName, + [in] [string,charset(UTF16)] uint16 *pEnvironment, + [in] [string,charset(UTF16)] uint16 *pDriverName + ); + + /******************/ + /* Function: 0x2b */ + + WERROR winspool_AsyncDeletePrinterDriverEx( + [in,unique] [string,charset(UTF16)] uint16 *pName, + [in] [string,charset(UTF16)] uint16 *pEnvironment, + [in] [string,charset(UTF16)] uint16 *pDriverName, + [in] uint32 dwDeleteFlag, + [in] uint32 dwVersionNum + ); + + /******************/ + /* Function: 0x2c */ + + WERROR winspool_AsyncAddPrintProcessor( + [in,unique] [string,charset(UTF16)] uint16 *pName, + [in] [string,charset(UTF16)] uint16 *pEnvironment, + [in] [string,charset(UTF16)] uint16 *pPathName, + [in] [string,charset(UTF16)] uint16 *pPrintProcessorName + ); + + /******************/ + /* Function: 0x2d */ + + WERROR winspool_AsyncEnumPrintProcessors( + [in,unique] [string,charset(UTF16)] uint16 *pName, + [in,unique] [string,charset(UTF16)] uint16 *pEnvironment, + [in] uint32 Level, + [in, out, unique, size_is(cbBuf)] uint8 *pPrintProcessorInfo, + [in] uint32 cbBuf, + [out] uint32 *pcbNeeded, + [out] uint32 *pcReturned + ); + + /******************/ + /* Function: 0x2e */ + + WERROR winspool_AsyncGetPrintProcessorDirectory( + [in,unique] [string,charset(UTF16)] uint16 *pName, + [in,unique] [string,charset(UTF16)] uint16 *pEnvironment, + [in] uint32 Level, + [in, out, unique, size_is(cbBuf)] uint8 *pPrintProcessorDirectory, + [in] uint32 cbBuf, + [out] uint32 *pcbNeeded + ); + + /******************/ + /* Function: 0x2f */ + + WERROR winspool_AsyncEnumPorts( + [in,unique] [string,charset(UTF16)] uint16 *pName, + [in] uint32 Level, + [in, out, unique, size_is(cbBuf)] uint8 *pPort, + [in] uint32 cbBuf, + [out] uint32 *pcbNeeded, + [out] uint32 *pcReturned + ); + + /******************/ + /* Function: 0x30 */ + + WERROR winspool_AsyncEnumMonitors( + [in,unique] [string,charset(UTF16)] uint16 *pName, + [in] uint32 Level, + [in, out, unique, size_is(cbBuf)] uint8 *pMonitor, + [in] uint32 cbBuf, + [out] uint32 *pcbNeeded, + [out] uint32 *pcReturned + ); + + /******************/ + /* Function: 0x31 */ + + WERROR winspool_AsyncAddPort( + [in,unique] [string,charset(UTF16)] uint16 *pName, + [in] spoolss_SetPortInfoContainer *pPortContainer, + [in] spoolss_PortVarContainer *pPortVarContainer, + [in] [string,charset(UTF16)] uint16 *pMonitorName + ); + + /******************/ + /* Function: 0x32 */ + + WERROR winspool_AsyncSetPort( + [in,unique] [string,charset(UTF16)] uint16 *pName, + [in,unique] [string,charset(UTF16)] uint16 *pPortName, + [in] spoolss_SetPortInfoContainer *pPortContainer + ); + + /******************/ + /* Function: 0x33 */ + + WERROR winspool_AsyncAddMonitor( + [in,unique] [string,charset(UTF16)] uint16 *Name, + [in] spoolss_MonitorContainer *pMonitorContainer + ); + + /******************/ + /* Function: 0x34 */ + + WERROR winspool_AsyncDeleteMonitor( + [in,unique] [string,charset(UTF16)] uint16 *Name, + [in,unique] [string,charset(UTF16)] uint16 *pEnvironment, + [in] [string,charset(UTF16)] uint16 *pMonitorName + ); + + /******************/ + /* Function: 0x35 */ + + WERROR winspool_AsyncDeletePrintProcessor( + [in,unique] [string,charset(UTF16)] uint16 *Name, + [in,unique] [string,charset(UTF16)] uint16 *pEnvironment, + [in] [string,charset(UTF16)] uint16 *pPrintProcessorName + ); + + /******************/ + /* Function: 0x36 */ + + WERROR winspool_AsyncEnumPrintProcessorDatatypes( + [in,unique] [string,charset(UTF16)] uint16 *pName, + [in,unique] [string,charset(UTF16)] uint16 *pPrintProcessorName, + [in] uint32 Level, + [in, out, unique, size_is(cbBuf)] uint8 *pDatatypes, + [in] uint32 cbBuf, + [out] uint32 *pcbNeeded, + [out] uint32 *pcReturned + ); + + /******************/ + /* Function: 0x37 */ + + WERROR winspool_AsyncAddPerMachineConnection( + [in,unique] [string,charset(UTF16)] uint16 *pServer, + [in] [string,charset(UTF16)] uint16 *pPrinterName, + [in] [string,charset(UTF16)] uint16 *pPrintServer, + [in] [string,charset(UTF16)] uint16 *pProvider + ); + + /******************/ + /* Function: 0x38 */ + + WERROR winspool_AsyncDeletePerMachineConnection( + [in,unique] [string,charset(UTF16)] uint16 *pServer, + [in] [string,charset(UTF16)] uint16 *pPrinterName + ); + + /******************/ + /* Function: 0x39 */ + + WERROR winspool_AsyncEnumPerMachineConnections( + [in,unique] [string,charset(UTF16)] uint16 *pServer, + [in, out, unique, size_is(cbBuf)] uint8 *pPrinterEnum, + [in] uint32 cbBuf, + [out] uint32 *pcbNeeded, + [out] uint32 *pcReturned + ); + + /******************/ + /* Function: 0x3a */ + + typedef enum { + winspool_PropertyTypeString = 1, + winspool_PropertyTypeInt32 = 2, + winspool_PropertyTypeInt64 = 3, + winspool_PropertyTypeByte = 4, + winspool_PropertyTypeTime = 5, + winspool_PropertyTypeDevMode = 6, + winspool_PropertyTypeSD = 7, + winspool_PropertyTypeNotificationReply = 8, + winspool_PropertyTypeNotificationOptions = 9 + } winspool_PrintPropertyType; + + typedef [ms_union,switch_type(winspool_PrintPropertyType)] union { + [case(winspool_PropertyTypeString)] [string,charset(UTF16)] uint16 *propertyString; + [case(winspool_PropertyTypeInt32)] uint32 propertyInt32; + [case(winspool_PropertyTypeInt64)] hyper propertyInt64; + [case(winspool_PropertyTypeByte)] uint8 propertyByte; + [case(winspool_PropertyTypeTime)] spoolss_TimeCtr propertyTimeContainer; + [case(winspool_PropertyTypeDevMode)] spoolss_DevmodeContainer propertyDevModeContainer; + [case(winspool_PropertyTypeSD)] sec_desc_buf propertySDContainer; + [case(winspool_PropertyTypeNotificationReply)] winspool_NOTIFY_REPLY_CONTAINER propertyReplyContainer; + [case(winspool_PropertyTypeNotificationOptions)] winspool_NOTIFY_OPTIONS_CONTAINER propertyOptionsContainer; + } winspool_PrintPropertyValueUnion; + + typedef struct { + winspool_PrintPropertyType PropertyType; + [switch_is(PropertyType)] winspool_PrintPropertyValueUnion value; + } winspool_PrintPropertyValue; + + typedef struct { + [string,charset(UTF16)] uint16 *propertyName; + winspool_PrintPropertyValue propertyValue; + } winspool_PrintNamedProperty; + + typedef struct { + [range(0,50)] uint32 numberOfProperties; + [size_is(numberOfProperties), unique] winspool_PrintNamedProperty *propertiesCollection; + } winspool_PrintPropertiesCollection; + + [public] HRESULT winspool_SyncRegisterForRemoteNotifications( + [in] PRINTER_HANDLE hPrinter, + [in] winspool_PrintPropertiesCollection *pNotifyFilter, + [out] RMTNTFY_HANDLE *phRpcHandle + ); + + /******************/ + /* Function: 0x3b */ + + HRESULT winspool_SyncUnRegisterForRemoteNotifications( + [in, out] RMTNTFY_HANDLE *phRpcHandle + ); + + /******************/ + /* Function: 0x3c */ + + HRESULT winspool_SyncRefreshRemoteNotifications( + [in] RMTNTFY_HANDLE hRpcHandle, + [in] winspool_PrintPropertiesCollection *pNotifyFilter, + [out] winspool_PrintPropertiesCollection **ppNotifyData + ); + + /******************/ + /* Function: 0x3d */ + + HRESULT winspool_AsyncGetRemoteNotifications( + [in] RMTNTFY_HANDLE hRpcHandle, + [out] winspool_PrintPropertiesCollection **ppNotifyData + ); + + /******************/ + /* Function: 0x3e */ + + typedef [bitmap32bit] bitmap { + IPDFP_FLAG_NONE = 0x00000000, + IPDFP_COPY_ALL_FILES = 0x00000001 + } winspool_InstallPrinterDriverFromPackageFlags; + + HRESULT winspool_AsyncInstallPrinterDriverFromPackage( + [in,unique] [string,charset(UTF16)] uint16 *pszServer, + [in,unique] [string,charset(UTF16)] uint16 *pszInfPath, + [in] [string,charset(UTF16)] uint16 *pszDriverName, + [in] [string,charset(UTF16)] uint16 *pszEnvironment, + [in] winspool_InstallPrinterDriverFromPackageFlags dwFlags + ); + + /******************/ + /* Function: 0x3f */ + + typedef [bitmap32bit] bitmap { + UPDP_FLAG_NONE = 0x00000000, + UPDP_UPLOAD_ALWAYS = 0x00000002, + UPDP_CHECK_DRIVERSTORE = 0x00000004 + } winspool_UploadPrinterDriverPackageFlags; + + HRESULT winspool_AsyncUploadPrinterDriverPackage( + [in,unique] [string,charset(UTF16)] uint16 *pszServer, + [in] [string,charset(UTF16)] uint16 *pszInfPath, + [in] [string,charset(UTF16)] uint16 *pszEnvironment, + [in] winspool_UploadPrinterDriverPackageFlags dwFlags, + [in, out, unique, size_is(*pcchDestInfPath)] [charset(UTF16)] uint16 *pszDestInfPath, + [in, out] uint32 *pcchDestInfPath + ); + + /******************/ + /* Function: 0x40 */ + + [public] HRESULT winspool_AsyncGetCorePrinterDrivers( + [in,unique] [string,charset(UTF16)] uint16 *pszServer, + [in] [string,charset(UTF16)] uint16 *pszEnvironment, + [in] uint32 cchCoreDrivers, + [in, size_is(cchCoreDrivers)] uint16 *pszzCoreDriverDependencies, + [in] uint32 cCorePrinterDrivers, + [out, size_is(cCorePrinterDrivers)] spoolss_CorePrinterDriver *pCorePrinterDrivers + ); + + /******************/ + /* Function: 0x41 */ + + HRESULT winspool_AsyncCorePrinterDriverInstalled( + [in,unique] [string,charset(UTF16)] uint16 *pszServer, + [in] [string,charset(UTF16)] uint16 *pszEnvironment, + [in] GUID CoreDriverGUID, + [in] NTTIME ftDriverDate, + [in] hyper dwlDriverVersion, + [out] int *pbDriverInstalled + ); + + /******************/ + /* Function: 0x42 */ + + HRESULT winspool_AsyncGetPrinterDriverPackagePath( + [in,unique] [string,charset(UTF16)] uint16 *pszServer, + [in] [string,charset(UTF16)] uint16 *pszEnvironment, + [in,unique] [string,charset(UTF16)] uint16 *pszLanguage, + [in] [string,charset(UTF16)] uint16 *pszPackageID, + [in, out, unique, size_is(cchDriverPackageCab)] uint16 *pszDriverPackageCab, + [in] uint32 cchDriverPackageCab, + [out] uint32 *pcchRequiredSize + ); + + /******************/ + /* Function: 0x43 */ + + HRESULT winspool_AsyncDeletePrinterDriverPackage( + [in,unique] [string,charset(UTF16)] uint16 *pszServer, + [in] [string,charset(UTF16)] uint16 *pszInfPath, + [in] [string,charset(UTF16)] uint16 *pszEnvironment + ); + + /******************/ + /* Function: 0x44 */ + + WERROR winspool_AsyncReadPrinter( + [in] PRINTER_HANDLE hPrinter, + [out, size_is(cbBuf)] uint8 *pBuf, + [in] uint32 cbBuf, + [out] uint32 *pcNoBytesRead + ); + + /******************/ + /* Function: 0x45 */ + + WERROR winspool_AsyncResetPrinter( + [in] PRINTER_HANDLE hPrinter, + [in,unique] [string,charset(UTF16)] uint16 *pDatatype, + [in] spoolss_DevmodeContainer *pDevModeContainer + ); + + /******************/ + /* Function: 0x46 */ + + WERROR winspool_AsyncGetJobNamedPropertyValue( + [in] PRINTER_HANDLE hPrinter, + [in] uint32 JobId, + [in] [string,charset(UTF16)] uint16 *pszName, + [out] spoolss_PrintPropertyValue *pValue + ); + + /******************/ + /* Function: 0x47 */ + + [public] WERROR winspool_AsyncSetJobNamedProperty( + [in] PRINTER_HANDLE hPrinter, + [in] uint32 JobId, + [in] spoolss_PrintNamedProperty *pProperty + ); + + /******************/ + /* Function: 0x48 */ + + WERROR winspool_AsyncDeleteJobNamedProperty( + [in] PRINTER_HANDLE hPrinter, + [in] uint32 JobId, + [in] [string,charset(UTF16)] uint16 *pszName + ); + + /******************/ + /* Function: 0x49 */ + + WERROR winspool_AsyncEnumJobNamedProperties( + [in] PRINTER_HANDLE hPrinter, + [in] uint32 JobId, + [out] uint32 *pcProperties, + [out, size_is(,*pcProperties)] spoolss_PrintNamedProperty **ppProperties + ); + + /******************/ + /* Function: 0x4a */ + + WERROR winspool_AsyncLogJobInfoForBranchOffice( + [in] PRINTER_HANDLE hPrinter, + [in,ref] spoolss_BranchOfficeJobDataContainer *pBranchOfficeJobDataContainer + ); +} diff --git a/librpc/idl/winstation.idl b/librpc/idl/winstation.idl new file mode 100644 index 0000000..fb02fa7 --- /dev/null +++ b/librpc/idl/winstation.idl @@ -0,0 +1,13 @@ +/* + winstation interface definition +*/ + +#include "idl_types.h" + +[ uuid("5ca4a760-ebb1-11cf-8611-00a0245420ed"), + version(1.0), + helpstring("Terminal Services remote management") +] interface winstation +{ + void winstation_foo(); +} diff --git a/librpc/idl/witness.idl b/librpc/idl/witness.idl new file mode 100644 index 0000000..dc3af4a --- /dev/null +++ b/librpc/idl/witness.idl @@ -0,0 +1,153 @@ +#include "idl_types.h" + +import "misc.idl"; + +[ + uuid("ccd8c074-d0e5-4a40-92b4-d074faa6ba28"), + version(1.1), + pointer_default(unique), + helpstring("SMB Witness Service"), + helper("../librpc/ndr/ndr_witness.h"), + endpoint("ncacn_ip_tcp:"), + authservice("cifs") +] +interface witness +{ + typedef [flag(NDR_PAHEX),v1_enum,public] enum { + WITNESS_V1 = 0x00010001, + WITNESS_V2 = 0x00020000, + WITNESS_UNSPECIFIED_VERSION = 0xFFFFFFFF + } witness_version; + + /*****************/ + /* Function 0x00 */ + + typedef [flag(NDR_PAHEX),enum16bit] enum { + WITNESS_STATE_UNKNOWN = 0x00, + WITNESS_STATE_AVAILABLE = 0x01, + WITNESS_STATE_UNAVAILABLE = 0xff + } witness_interfaceInfo_state; + + typedef [bitmap32bit] bitmap { + WITNESS_INFO_IPv4_VALID = 0x01, + WITNESS_INFO_IPv6_VALID = 0x02, + WITNESS_INFO_WITNESS_IF = 0x04 + } witness_interfaceInfo_flags; + + typedef struct { + [charset(UTF16),to_null] uint16 group_name[260]; + witness_version version; + witness_interfaceInfo_state state; + [flag(NDR_BIG_ENDIAN)] ipv4address ipv4; + [flag(NDR_BIG_ENDIAN)] ipv6address ipv6; + witness_interfaceInfo_flags flags; + } witness_interfaceInfo; + + typedef [public] struct { + uint32 num_interfaces; + [size_is(num_interfaces)] witness_interfaceInfo *interfaces; + } witness_interfaceList; + + [public] WERROR witness_GetInterfaceList( + [out] witness_interfaceList **interface_list + ); + + /*****************/ + /* Function 0x01 */ + + [public] WERROR witness_Register( + [out,ref] policy_handle *context_handle, + [in] witness_version version, + [in,unique,string,charset(UTF16)] uint16 *net_name, + [in,unique,string,charset(UTF16)] uint16 *ip_address, + [in,unique,string,charset(UTF16)] uint16 *client_computer_name + ); + + /*****************/ + /* Function 0x02 */ + + [public] WERROR witness_UnRegister( + [in] policy_handle context_handle + ); + + /*****************/ + /* Function 0x03 */ + + typedef [v1_enum,public] enum { + WITNESS_NOTIFY_RESOURCE_CHANGE = 1, + WITNESS_NOTIFY_CLIENT_MOVE = 2, + WITNESS_NOTIFY_SHARE_MOVE = 3, + WITNESS_NOTIFY_IP_CHANGE = 4 + } witness_notifyResponse_type; + + typedef [flag(NDR_PAHEX),v1_enum] enum { + WITNESS_RESOURCE_STATE_UNKNOWN = 0x00, + WITNESS_RESOURCE_STATE_AVAILABLE = 0x01, + WITNESS_RESOURCE_STATE_UNAVAILABLE = 0xff + } witness_ResourceChange_type; + + typedef [flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN),gensize,public] struct { + [value(ndr_size_witness_ResourceChange(r,ndr->flags))] uint32 length; + witness_ResourceChange_type type; + nstring name; + } witness_ResourceChange; + + typedef [bitmap32bit] bitmap { + WITNESS_IPADDR_V4 = 0x01, + WITNESS_IPADDR_V6 = 0x02, + WITNESS_IPADDR_ONLINE = 0x08, + WITNESS_IPADDR_OFFLINE = 0x10 + } witness_IPaddrInfo_flags; + + typedef [flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN)] struct { + witness_IPaddrInfo_flags flags; + [flag(NDR_BIG_ENDIAN)] ipv4address ipv4; + [flag(NDR_BIG_ENDIAN)] ipv6address ipv6; + } witness_IPaddrInfo; + + typedef [public,flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN),gensize] struct { + [value(ndr_size_witness_IPaddrInfoList(r, ndr->flags))] uint32 length; + [value(0)] uint32 reserved; + uint32 num; + witness_IPaddrInfo addr[num]; + } witness_IPaddrInfoList; + + typedef [public,switch_type(witness_notifyResponse_type),nodiscriminant, flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN)] union { + [case(WITNESS_NOTIFY_RESOURCE_CHANGE)] witness_ResourceChange resource_change; + [case(WITNESS_NOTIFY_CLIENT_MOVE)] witness_IPaddrInfoList client_move; + [case(WITNESS_NOTIFY_SHARE_MOVE)] witness_IPaddrInfoList share_move; + [case(WITNESS_NOTIFY_IP_CHANGE)] witness_IPaddrInfoList ip_change; + [default,flag(NDR_REMAINING)] DATA_BLOB data; + } witness_notifyResponse_message; + + typedef [flag(NDR_PAHEX),gensize,public,nopush,nopull] struct { + witness_notifyResponse_type type; + [value(ndr_size_witness_notifyResponse(r, ndr->flags)-20)] uint32 length; + uint32 num; + [subcontext(4), subcontext_size(length), flag(NDR_REMAINING), switch_is(type), size_is(num)] witness_notifyResponse_message *messages; + } witness_notifyResponse; + + [public] WERROR witness_AsyncNotify( + [in] policy_handle context_handle, + [out] witness_notifyResponse **response + ); + + /*****************/ + /* Function 0x04 */ + + typedef [bitmap32bit,public] bitmap { + WITNESS_REGISTER_NONE = 0x00, + WITNESS_REGISTER_IP_NOTIFICATION = 0x01 + } witness_RegisterEx_flags; + + WERROR witness_RegisterEx( + [out,ref] policy_handle *context_handle, + [in] witness_version version, + [in,unique,string,charset(UTF16)] uint16 *net_name, + [in,unique,string,charset(UTF16)] uint16 *share_name, + [in,unique,string,charset(UTF16)] uint16 *ip_address, + [in,unique,string,charset(UTF16)] uint16 *client_computer_name, + [in] witness_RegisterEx_flags flags, + [in] uint32 timeout + ); +} diff --git a/librpc/idl/wkssvc.idl b/librpc/idl/wkssvc.idl new file mode 100644 index 0000000..9e92ed7 --- /dev/null +++ b/librpc/idl/wkssvc.idl @@ -0,0 +1,796 @@ +#include "idl_types.h" + +/* + wkssvc interface definitions +*/ + +import "srvsvc.idl", "lsa.idl"; + +[ uuid("6bffd098-a112-3610-9833-46c3f87e345a"), + version(1.0), + pointer_default(unique), + helpstring("Workstation Service"), + endpoint("ncacn_np:[\\pipe\\wkssvc]","ncacn_ip_tcp:","ncalrpc:") +] interface wkssvc +{ + typedef [v1_enum] enum srvsvc_PlatformId srvsvc_PlatformId; + +#define BOOL uint32 + + /******************/ + /* Function: 0x00 */ + + typedef struct { + srvsvc_PlatformId platform_id; + [string,charset(UTF16)] uint16 *server_name; + [string,charset(UTF16)] uint16 *domain_name; + uint32 version_major; + uint32 version_minor; + } wkssvc_NetWkstaInfo100; + + typedef struct { + srvsvc_PlatformId platform_id; + [string,charset(UTF16)] uint16 *server_name; + [string,charset(UTF16)] uint16 *domain_name; + uint32 version_major; + uint32 version_minor; + [string,charset(UTF16)] uint16 *lan_root; + } wkssvc_NetWkstaInfo101; + + typedef struct { + srvsvc_PlatformId platform_id; + [string,charset(UTF16)] uint16 *server_name; + [string,charset(UTF16)] uint16 *domain_name; + uint32 version_major; + uint32 version_minor; + [string,charset(UTF16)] uint16 *lan_root; + uint32 logged_on_users; + } wkssvc_NetWkstaInfo102; + + /* FIXME: 302, 402 */ + + typedef struct { + uint32 char_wait; + uint32 collection_time; + uint32 maximum_collection_count; + uint32 keep_connection; + uint32 max_commands; + uint32 session_timeout; + uint32 size_char_buf; + uint32 max_threads; + uint32 lock_quota; + uint32 lock_increment; + uint32 lock_maximum; + uint32 pipe_increment; + uint32 pipe_maximum; + uint32 cache_file_timeout; + uint32 dormant_file_limit; + uint32 read_ahead_throughput; + uint32 num_mailslot_buffers; + uint32 num_srv_announce_buffers; + uint32 max_illegal_dgram_events; + uint32 dgram_event_reset_freq; + BOOL log_election_packets; + BOOL use_opportunistic_locking; + BOOL use_unlock_behind; + BOOL use_close_behind; + BOOL buf_named_pipes; + BOOL use_lock_read_unlock; + BOOL utilize_nt_caching; + BOOL use_raw_read; + BOOL use_raw_write; + BOOL use_write_raw_data; + BOOL use_encryption; + BOOL buf_files_deny_write; + BOOL buf_read_only_files; + BOOL force_core_create_mode; + BOOL use_512_byte_max_transfer; + } wkssvc_NetWkstaInfo502; + + typedef struct { + uint32 char_wait; + } wkssvc_NetWkstaInfo1010; + + typedef struct { + uint32 collection_time; + } wkssvc_NetWkstaInfo1011; + + typedef struct { + uint32 maximum_collection_count; + } wkssvc_NetWkstaInfo1012; + + typedef struct { + uint32 keep_connection; + } wkssvc_NetWkstaInfo1013; + + typedef struct { + uint32 session_timeout; + } wkssvc_NetWkstaInfo1018; + + typedef struct { + uint32 size_char_buf; + } wkssvc_NetWkstaInfo1023; + + typedef struct { + uint32 errorlog_sz; + } wkssvc_NetWkstaInfo1027; + + /* downlevel */ + typedef struct { + uint32 print_buf_time; + } wkssvc_NetWkstaInfo1028; + + /* downlevel */ + typedef struct { + uint32 wrk_heuristics; + } wkssvc_NetWkstaInfo1032; + + typedef struct { + uint32 max_threads; + } wkssvc_NetWkstaInfo1033; + + typedef struct { + uint32 lock_quota; + } wkssvc_NetWkstaInfo1041; + + typedef struct { + uint32 lock_increment; + } wkssvc_NetWkstaInfo1042; + + typedef struct { + uint32 lock_maximum; + } wkssvc_NetWkstaInfo1043; + + typedef struct { + uint32 pipe_increment; + } wkssvc_NetWkstaInfo1044; + + typedef struct { + uint32 pipe_maximum; + } wkssvc_NetWkstaInfo1045; + + typedef struct { + uint32 dormant_file_limit; + } wkssvc_NetWkstaInfo1046; + + typedef struct { + uint32 cache_file_timeout; + } wkssvc_NetWkstaInfo1047; + + typedef struct { + uint32 use_opportunistic_locking; + } wkssvc_NetWkstaInfo1048; + + typedef struct { + uint32 use_unlock_behind; + } wkssvc_NetWkstaInfo1049; + + typedef struct { + uint32 use_close_behind; + } wkssvc_NetWkstaInfo1050; + + typedef struct { + uint32 buf_named_pipes; + } wkssvc_NetWkstaInfo1051; + + typedef struct { + uint32 use_lock_read_unlock; + } wkssvc_NetWkstaInfo1052; + + typedef struct { + uint32 utilize_nt_caching; + } wkssvc_NetWkstaInfo1053; + + typedef struct { + uint32 use_raw_read; + } wkssvc_NetWkstaInfo1054; + + typedef struct { + uint32 use_raw_write; + } wkssvc_NetWkstaInfo1055; + + typedef struct { + uint32 use_write_raw_data; + } wkssvc_NetWkstaInfo1056; + + typedef struct { + uint32 use_encryption; + } wkssvc_NetWkstaInfo1057; + + typedef struct { + uint32 buf_files_deny_write; + } wkssvc_NetWkstaInfo1058; + + typedef struct { + uint32 buf_read_only_files; + } wkssvc_NetWkstaInfo1059; + + typedef struct { + uint32 force_core_create_mode; + } wkssvc_NetWkstaInfo1060; + + typedef struct { + uint32 use_512_byte_max_transfer; + } wkssvc_NetWkstaInfo1061; + + typedef struct { + uint32 read_ahead_throughput; + } wkssvc_NetWkstaInfo1062; + + typedef union { + [case(100)] wkssvc_NetWkstaInfo100 *info100; + [case(101)] wkssvc_NetWkstaInfo101 *info101; + [case(102)] wkssvc_NetWkstaInfo102 *info102; + [case(502)] wkssvc_NetWkstaInfo502 *info502; + [case(1010)] wkssvc_NetWkstaInfo1010 *info1010; + [case(1011)] wkssvc_NetWkstaInfo1011 *info1011; + [case(1012)] wkssvc_NetWkstaInfo1012 *info1012; + [case(1013)] wkssvc_NetWkstaInfo1013 *info1013; + [case(1018)] wkssvc_NetWkstaInfo1018 *info1018; + [case(1023)] wkssvc_NetWkstaInfo1023 *info1023; + [case(1027)] wkssvc_NetWkstaInfo1027 *info1027; + [case(1028)] wkssvc_NetWkstaInfo1028 *info1028; + [case(1032)] wkssvc_NetWkstaInfo1032 *info1032; + [case(1033)] wkssvc_NetWkstaInfo1033 *info1033; + [case(1041)] wkssvc_NetWkstaInfo1041 *info1041; + [case(1042)] wkssvc_NetWkstaInfo1042 *info1042; + [case(1043)] wkssvc_NetWkstaInfo1043 *info1043; + [case(1044)] wkssvc_NetWkstaInfo1044 *info1044; + [case(1045)] wkssvc_NetWkstaInfo1045 *info1045; + [case(1046)] wkssvc_NetWkstaInfo1046 *info1046; + [case(1047)] wkssvc_NetWkstaInfo1047 *info1047; + [case(1048)] wkssvc_NetWkstaInfo1048 *info1048; + [case(1049)] wkssvc_NetWkstaInfo1049 *info1049; + [case(1050)] wkssvc_NetWkstaInfo1050 *info1050; + [case(1051)] wkssvc_NetWkstaInfo1051 *info1051; + [case(1052)] wkssvc_NetWkstaInfo1052 *info1052; + [case(1053)] wkssvc_NetWkstaInfo1053 *info1053; + [case(1054)] wkssvc_NetWkstaInfo1054 *info1054; + [case(1055)] wkssvc_NetWkstaInfo1055 *info1055; + [case(1056)] wkssvc_NetWkstaInfo1056 *info1056; + [case(1057)] wkssvc_NetWkstaInfo1057 *info1057; + [case(1058)] wkssvc_NetWkstaInfo1058 *info1058; + [case(1059)] wkssvc_NetWkstaInfo1059 *info1059; + [case(1060)] wkssvc_NetWkstaInfo1060 *info1060; + [case(1061)] wkssvc_NetWkstaInfo1061 *info1061; + [case(1062)] wkssvc_NetWkstaInfo1062 *info1062; + [default] ; + } wkssvc_NetWkstaInfo; + + WERROR wkssvc_NetWkstaGetInfo( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in] uint32 level, + [out,switch_is(level),ref] wkssvc_NetWkstaInfo *info + ); + + + /******************/ + /* Function: 0x01 */ + WERROR wkssvc_NetWkstaSetInfo( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in] uint32 level, + [in,switch_is(level),ref] wkssvc_NetWkstaInfo *info, + [in,out,ref] uint32 *parm_error + ); + + + /*****************************/ + /* Function 0x02 */ + typedef struct { + [string,charset(UTF16)] uint16 *user_name; + } wkssvc_NetrWkstaUserInfo0; + + typedef struct { + uint32 entries_read; + [size_is(entries_read)] wkssvc_NetrWkstaUserInfo0 *user0; + } wkssvc_NetWkstaEnumUsersCtr0; + + typedef struct { + [string,charset(UTF16)] uint16 *user_name; + [string,charset(UTF16)] uint16 *logon_domain; + [string,charset(UTF16)] uint16 *other_domains; + [string,charset(UTF16)] uint16 *logon_server; + } wkssvc_NetrWkstaUserInfo1; + + typedef struct { + uint32 entries_read; + [size_is(entries_read)] wkssvc_NetrWkstaUserInfo1 *user1; + } wkssvc_NetWkstaEnumUsersCtr1; + + typedef [switch_type(uint32)] union { + [case(0)] wkssvc_NetWkstaEnumUsersCtr0 *user0; + [case(1)] wkssvc_NetWkstaEnumUsersCtr1 *user1; + } wkssvc_NetWkstaEnumUsersCtr; + + typedef struct { + uint32 level; + [switch_is(level)] wkssvc_NetWkstaEnumUsersCtr ctr; + } wkssvc_NetWkstaEnumUsersInfo; + + WERROR wkssvc_NetWkstaEnumUsers( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,out,ref] wkssvc_NetWkstaEnumUsersInfo *info, + [in] uint32 prefmaxlen, + [out,ref] uint32 *entries_read, + [in,out,unique] uint32 *resume_handle + ); + + /*****************************/ + /* Function 0x03 */ + typedef struct { + [string,charset(UTF16)] uint16 *other_domains; + } wkssvc_NetrWkstaUserInfo1101; + + typedef [switch_type(uint32)] union { + [case(0)] wkssvc_NetrWkstaUserInfo0 *info0; + [case(1)] wkssvc_NetrWkstaUserInfo1 *info1; + [case(1101)] wkssvc_NetrWkstaUserInfo1101 *info1101; + } wkssvc_NetrWkstaUserInfo; + + WERROR wkssvc_NetrWkstaUserGetInfo( + [in,unique] [string,charset(UTF16)] uint16 *unknown, + [in] uint32 level, + [out,ref] [switch_is(level)] wkssvc_NetrWkstaUserInfo *info + ); + + /*****************************/ + /* Function 0x04 */ + WERROR wkssvc_NetrWkstaUserSetInfo( + [in,unique] [string,charset(UTF16)] uint16 *unknown, + [in] uint32 level, + [in,ref] [switch_is(level)] wkssvc_NetrWkstaUserInfo *info, + [in,out,unique] uint32 *parm_err + ); + + /*****************************/ + /* Function 0x05 */ + + typedef struct { + uint32 quality_of_service; + uint32 vc_count; + [string,charset(UTF16)] uint16 *name; + [string,charset(UTF16)] uint16 *address; + uint32 wan_link; + } wkssvc_NetWkstaTransportInfo0; + + typedef struct { + uint32 count; + [size_is(count)] wkssvc_NetWkstaTransportInfo0 *array; + } wkssvc_NetWkstaTransportCtr0; + + typedef union { + [case(0)] wkssvc_NetWkstaTransportCtr0 *ctr0; + } wkssvc_NetWkstaTransportCtr; + + typedef struct { + uint32 level; + [switch_is(level)] wkssvc_NetWkstaTransportCtr ctr; + } wkssvc_NetWkstaTransportInfo; + + WERROR wkssvc_NetWkstaTransportEnum ( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,out,ref] wkssvc_NetWkstaTransportInfo *info, + [in] uint32 max_buffer, + [out,ref] uint32 *total_entries, + [in,out,unique] uint32 *resume_handle + ); + + /*****************************/ + /* Function 0x06 */ + /* only supported on NT */ + WERROR wkssvc_NetrWkstaTransportAdd( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in] uint32 level, /* must be 0 */ + [in,ref] wkssvc_NetWkstaTransportInfo0 *info0, + [in,out,unique] uint32 *parm_err + ); + + /*****************************/ + /* Function 0x07 */ + /* only supported on NT */ + WERROR wkssvc_NetrWkstaTransportDel( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,unique] [string,charset(UTF16)] uint16 *transport_name, + [in] uint32 unknown3 + ); + + /*****************************/ + /* Function 0x08 */ + typedef struct { + [string,charset(UTF16)] uint16 *unknown1; + [string,charset(UTF16)] uint16 *unknown2; + } wkssvc_NetrUseInfo3; + + typedef struct { + [string,charset(UTF16)] uint16 *local; + [string,charset(UTF16)] uint16 *remote; + [string,charset(UTF16)] uint16 *password; + uint32 status; + uint32 asg_type; + uint32 ref_count; + uint32 use_count; + [string,charset(UTF16)] uint16 *user_name; + [string,charset(UTF16)] uint16 *domain_name; + } wkssvc_NetrUseInfo2; + + typedef struct { + [string,charset(UTF16)] uint16 *local; + [string,charset(UTF16)] uint16 *remote; + [string,charset(UTF16)] uint16 *password; + uint32 status; + uint32 asg_type; + uint32 ref_count; + uint32 use_count; + } wkssvc_NetrUseInfo1; + + typedef struct { + [string,charset(UTF16)] uint16 *local; + [string,charset(UTF16)] uint16 *remote; + } wkssvc_NetrUseInfo0; + + typedef [switch_type(uint32)] union { + [case(0)] wkssvc_NetrUseInfo0 *info0; + [case(1)] wkssvc_NetrUseInfo1 *info1; + [case(2)] wkssvc_NetrUseInfo2 *info2; + [case(3)] wkssvc_NetrUseInfo3 *info3; + } wkssvc_NetrUseGetInfoCtr; + + WERROR wkssvc_NetrUseAdd( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in] uint32 level, + [in,ref] [switch_is(level)] wkssvc_NetrUseGetInfoCtr *ctr, + [in,out,unique] uint32 *parm_err + ); + + /*****************************/ + /* Function 0x09 */ + WERROR wkssvc_NetrUseGetInfo( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,ref] [string,charset(UTF16)] uint16 *use_name, + [in] uint32 level, + [out,ref] [switch_is(level)] wkssvc_NetrUseGetInfoCtr *ctr + ); + + /*****************************/ + /* Function 0x0a */ + WERROR wkssvc_NetrUseDel( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,ref] [string,charset(UTF16)] uint16 *use_name, + [in] uint32 force_cond + ); + + /*****************************/ + /* Function 0x0b */ + typedef struct { + uint32 count; + [size_is(count)] wkssvc_NetrUseInfo2 *array; + } wkssvc_NetrUseEnumCtr2; + + typedef struct { + uint32 count; + [size_is(count)] wkssvc_NetrUseInfo1 *array; + } wkssvc_NetrUseEnumCtr1; + + typedef struct { + uint32 count; + [size_is(count)] wkssvc_NetrUseInfo0 *array; + } wkssvc_NetrUseEnumCtr0; + + typedef [switch_type(uint32)] union { + [case(0)] wkssvc_NetrUseEnumCtr0 *ctr0; + [case(1)] wkssvc_NetrUseEnumCtr1 *ctr1; + [case(2)] wkssvc_NetrUseEnumCtr2 *ctr2; + } wkssvc_NetrUseEnumCtr; + + typedef struct { + uint32 level; + [switch_is(level)] wkssvc_NetrUseEnumCtr ctr; + } wkssvc_NetrUseEnumInfo; + + WERROR wkssvc_NetrUseEnum( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,out,ref] wkssvc_NetrUseEnumInfo *info, + [in] uint32 prefmaxlen, + [out,ref] uint32 *entries_read, + [in,out,unique] uint32 *resume_handle + ); + + /*****************************/ + /* Function 0x0c */ + WERROR wkssvc_NetrMessageBufferSend( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,ref] [string,charset(UTF16)] uint16 *message_name, + [in,unique] [string,charset(UTF16)] uint16 *message_sender_name, + [in,ref] [size_is(message_size)] uint8 *message_buffer, + [in] uint32 message_size + ); + + /*****************************/ + /* Function 0x0d */ + typedef struct { + hyper unknown1; + hyper unknown2; + hyper unknown3; + hyper unknown4; + hyper unknown5; + hyper unknown6; + hyper unknown7; + hyper unknown8; + hyper unknown9; + hyper unknown10; + hyper unknown11; + hyper unknown12; + hyper unknown13; + uint32 unknown14; + uint32 unknown15; + uint32 unknown16; + uint32 unknown17; + uint32 unknown18; + uint32 unknown19; + uint32 unknown20; + uint32 unknown21; + uint32 unknown22; + uint32 unknown23; + uint32 unknown24; + uint32 unknown25; + uint32 unknown26; + uint32 unknown27; + uint32 unknown28; + uint32 unknown29; + uint32 unknown30; + uint32 unknown31; + uint32 unknown32; + uint32 unknown33; + uint32 unknown34; + uint32 unknown35; + uint32 unknown36; + uint32 unknown37; + uint32 unknown38; + uint32 unknown39; + uint32 unknown40; + } wkssvc_NetrWorkstationStatistics; + + WERROR wkssvc_NetrWorkstationStatisticsGet( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,unique] [string,charset(UTF16)] uint16 *unknown2, + [in] uint32 unknown3, + [in] uint32 unknown4, + [out,ref] wkssvc_NetrWorkstationStatistics **info + ); + + /*****************************/ + /* Function 0x0e */ + WERROR wkssvc_NetrLogonDomainNameAdd( + [in,ref] [string,charset(UTF16)] uint16 *domain_name + ); + + /*****************************/ + /* Function 0x0f */ + WERROR wkssvc_NetrLogonDomainNameDel( + [in,ref] [string,charset(UTF16)] uint16 *domain_name + ); + + /*****************************/ + /* Function 0x10 */ + WERROR wkssvc_NetrJoinDomain( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,ref] [string,charset(UTF16)] uint16 *domain_name, + [in,unique] [string,charset(UTF16)] uint16 *account_ou, + [in,unique] [string,charset(UTF16)] uint16 *Account, + [in,unique] [string,charset(UTF16)] uint16 *password, + [in] wkssvc_joinflags join_flags + ); + + /*****************************/ + /* Function 0x11 */ + WERROR wkssvc_NetrUnjoinDomain( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,unique] [string,charset(UTF16)] uint16 *Account, + [in,unique] [string,charset(UTF16)] uint16 *password, + [in] wkssvc_joinflags unjoin_flags + ); + + /*****************************/ + /* Function 0x12 */ + typedef [bitmap32bit] bitmap { + /* TRUE: create the account in the domain */ + WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE = 0x00000002 + } wkssvc_renameflags; + + WERROR wkssvc_NetrRenameMachineInDomain( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,unique] [string,charset(UTF16)] uint16 *NewMachineName, + [in,unique] [string,charset(UTF16)] uint16 *Account, + [in,unique] [string,charset(UTF16)] uint16 *password, + [in] wkssvc_renameflags RenameOptions + ); + + /*****************************/ + /* Function 0x13 */ + typedef enum { + NetSetupUnknown = 0, + NetSetupMachine = 1, + NetSetupWorkgroup = 2, + NetSetupDomain = 3, + NetSetupNonExistentDomain = 4, + NetSetupDnsMachine = 5 + } wkssvc_NetValidateNameType; + + WERROR wkssvc_NetrValidateName( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,ref] [string,charset(UTF16)] uint16 *name, + [in,unique] [string,charset(UTF16)] uint16 *Account, + [in,unique] [string,charset(UTF16)] uint16 *Password, + [in] wkssvc_NetValidateNameType name_type + ); + + /*****************************/ + /* Function 0x14 */ + typedef enum { + NET_SETUP_UNKNOWN_STATUS = 0, + NET_SETUP_UNJOINED = 1, + NET_SETUP_WORKGROUP_NAME = 2, + NET_SETUP_DOMAIN_NAME = 3 + } wkssvc_NetJoinStatus; + + WERROR wkssvc_NetrGetJoinInformation( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,out,ref] [string,charset(UTF16)] uint16 **name_buffer, + [out,ref] wkssvc_NetJoinStatus *name_type + ); + + /*****************************/ + /* Function 0x15 */ + WERROR wkssvc_NetrGetJoinableOus( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,ref] [string,charset(UTF16)] uint16 *domain_name, + [in,unique] [string,charset(UTF16)] uint16 *Account, + [in,unique] [string,charset(UTF16)] uint16 *unknown, + [in,out,ref] uint32 *num_ous, + /* + * this is a [ref] pointer to a [unique] pointer to an + * array of [unique] pointers to a string array + */ + [out,ref] [size_is(,*num_ous)] [string,charset(UTF16)] uint16 ***ous + ); + + typedef [flag(NDR_PAHEX)] struct { + uint8 data[524]; + } wkssvc_PasswordBuffer; + + typedef [bitmap32bit] bitmap { + WKSSVC_JOIN_FLAGS_IGNORE_UNSUPPORTED_FLAGS = 0x10000000, + WKSSVC_JOIN_FLAGS_JOIN_WITH_NEW_NAME = 0x00000400, + WKSSVC_JOIN_FLAGS_JOIN_DC_ACCOUNT = 0x00000200, + /* TRUE: defer setting the SPN and dNSHostName until a rename operation */ + WKSSVC_JOIN_FLAGS_DEFER_SPN = 0x00000100, + + /* TRUE: set the machine password to the provided one after the join completes */ + WKSSVC_JOIN_FLAGS_MACHINE_PWD_PASSED = 0x00000080, + + /* TRUE: perform an unsecured join */ + WKSSVC_JOIN_FLAGS_JOIN_UNSECURE = 0x00000040, + + /* TRUE: allow the join to complete even if the account already exists */ + WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED = 0x00000020, + + /* TRUE: this join is part of a w9x upgrade */ + WKSSVC_JOIN_FLAGS_WIN9X_UPGRADE = 0x00000010, + + /* TRUE: delete the account when the domain is left */ + WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE = 0x00000004, + + /* TRUE: create the account in the domain */ + WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE = 0x00000002, + + /* TRUE: join domain FALSE: join workgroup */ + WKSSVC_JOIN_FLAGS_JOIN_TYPE = 0x00000001 + + } wkssvc_joinflags; + + /*****************************/ + /* Function 0x16 */ + WERROR wkssvc_NetrJoinDomain2 ( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,ref] [string,charset(UTF16)] uint16 *domain_name, + [in,unique] [string,charset(UTF16)] uint16 *account_ou, + [in,unique] [string,charset(UTF16)] uint16 *admin_account, + [in,unique] wkssvc_PasswordBuffer *encrypted_password, + [in] wkssvc_joinflags join_flags + ); + + /*****************************/ + /* Function 0x17 */ + WERROR wkssvc_NetrUnjoinDomain2 ( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,unique] [string,charset(UTF16)] uint16 *account, + [in,unique] wkssvc_PasswordBuffer *encrypted_password, + [in] wkssvc_joinflags unjoin_flags + ); + + /*****************************/ + /* Function 0x18 */ + WERROR wkssvc_NetrRenameMachineInDomain2( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,unique] [string,charset(UTF16)] uint16 *NewMachineName, + [in,unique] [string,charset(UTF16)] uint16 *Account, + [in,unique] wkssvc_PasswordBuffer *EncryptedPassword, + [in] wkssvc_renameflags RenameOptions + ); + + /*****************************/ + /* Function 0x19 */ + WERROR wkssvc_NetrValidateName2( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,ref] [string,charset(UTF16)] uint16 *name, + [in,unique] [string,charset(UTF16)] uint16 *Account, + [in,unique] wkssvc_PasswordBuffer *EncryptedPassword, + [in] wkssvc_NetValidateNameType name_type + ); + + /*****************************/ + /* Function 0x1a */ + WERROR wkssvc_NetrGetJoinableOus2( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,ref] [string,charset(UTF16)] uint16 *domain_name, + [in,unique] [string,charset(UTF16)] uint16 *Account, + [in,unique] wkssvc_PasswordBuffer *EncryptedPassword, + [in,out,ref] uint32 *num_ous, + /* + * this is a [ref] pointer to a [unique] pointer to an + * array of [unique] pointers to a string array + */ + [out,ref] [size_is(,*num_ous)] [string,charset(UTF16)] uint16 ***ous + ); + + /*****************************/ + /* Function 0x1b */ + WERROR wkssvc_NetrAddAlternateComputerName( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,unique] [string,charset(UTF16)] uint16 *NewAlternateMachineName, + [in,unique] [string,charset(UTF16)] uint16 *Account, + [in,unique] wkssvc_PasswordBuffer *EncryptedPassword, + [in] uint32 Reserved + ); + + /*****************************/ + /* Function 0x1c */ + WERROR wkssvc_NetrRemoveAlternateComputerName( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,unique] [string,charset(UTF16)] uint16 *AlternateMachineNameToRemove, + [in,unique] [string,charset(UTF16)] uint16 *Account, + [in,unique] wkssvc_PasswordBuffer *EncryptedPassword, + [in] uint32 Reserved + ); + + /*****************************/ + /* Function 0x1d */ + WERROR wkssvc_NetrSetPrimaryComputername( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in,unique] [string,charset(UTF16)] uint16 *primary_name, + [in,unique] [string,charset(UTF16)] uint16 *Account, + [in,unique] wkssvc_PasswordBuffer *EncryptedPassword, + [in] uint32 Reserved + ); + + /*****************************/ + /* Function 0x1e */ + typedef enum { + NetPrimaryComputerName = 0, + NetAlternateComputerNames = 1, + NetAllComputerNames = 2, + NetComputerNameTypeMax = 3 + } wkssvc_ComputerNameType; + + typedef struct { + uint32 count; + [size_is(count)] lsa_String *computer_name; + } wkssvc_ComputerNamesCtr; + + WERROR wkssvc_NetrEnumerateComputerNames( + [in,unique] [string,charset(UTF16)] uint16 *server_name, + [in] wkssvc_ComputerNameType name_type, + [in] uint32 Reserved, + [out,ref] wkssvc_ComputerNamesCtr **ctr + ); +} diff --git a/librpc/idl/wscript_build b/librpc/idl/wscript_build new file mode 100644 index 0000000..f3781fa --- /dev/null +++ b/librpc/idl/wscript_build @@ -0,0 +1,164 @@ +#!/usr/bin/env python + +bld.SAMBA_PIDL_LIST('PIDL', + '''drsuapi.idl epmapper.idl + eventlog.idl + browser.idl dssetup.idl frsapi.idl + spoolss.idl + dnsserver.idl + samr.idl srvsvc.idl winreg.idl + mgmt.idl netlogon.idl + svcctl.idl wkssvc.idl eventlog6.idl backupkey.idl + witness.idl clusapi.idl + mdssvc.idl''', + options='--header --ndr-parser --server-compat --server --client --python', + output_dir='../gen_ndr') + +# The interface names here are not the same as the IDL name, so the +# auto-generation of the fuzzer fails to link +bld.SAMBA_PIDL_LIST('PIDL', + '''echo.idl + fsrvp.idl + lsa.idl + winspool.idl''', + options='--header --ndr-parser --server-compat --server --client --python', + output_dir='../gen_ndr', + generate_fuzzers=False) + +# Services that we only have a client for +bld.SAMBA_PIDL_LIST('PIDL', + '''atsvc.idl gkdi.idl''', + options='--header --ndr-parser --client --python', + output_dir='../gen_ndr') + +# Services that we only have a server in the source3 style +bld.SAMBA_PIDL_LIST('PIDL', + '''initshutdown.idl ntsvcs.idl''', + options='--header --ndr-parser --client --python --server-compat', + output_dir='../gen_ndr') + +# The interface names here are not the same as the IDL name, so the +# auto-generation of the fuzzer fails to link +bld.SAMBA_PIDL_LIST('PIDL', + '''dfs.idl''', + options='--header --ndr-parser --client --python --server-compat', + output_dir='../gen_ndr', + generate_fuzzers=False) + +# Services that we only have a server in the source4 style. + +bld.SAMBA_PIDL_LIST('PIDL', + '''unixinfo.idl''', + options='--header --ndr-parser --client --python --server', + output_dir='../gen_ndr') + +# DCE/RPC protocols which Samba does not implement a client or server +# for. We don't generate a fuzzer for these as they are unreachable +# +# Do not include IDL with public structures in this list as we want to +# fuzz those + +bld.SAMBA_PIDL_LIST('PIDL', + ''' + audiosrv.idl + dbgidl.idl + dsbackup.idl + efs.idl + frstrans.idl + frsrpc.idl + keysvc.idl + msgsvc.idl + orpc.idl + policyagent.idl + rot.idl + scerpc.idl + trkwks.idl + w32time.idl + winstation.idl + wzcsvc.idl + ''', + options='--header --ndr-parser', + generate_fuzzers=False, + output_dir='../gen_ndr') + +# Non-DCE/RPC protocols encoded in IDL for Samba or helper IDLs for +# DCE/RPC protocols (eg defining constants or structures but not +# functions) +bld.SAMBA_PIDL_LIST('PIDL', + ''' + bkupblobs.idl + cab.idl + file_id.idl + fscc.idl + fsrvp_state.idl + named_pipe_auth.idl + negoex.idl + notify.idl + ntprinting.idl + ODJ.idl + printcap.idl + rap.idl + schannel.idl + smb2_lease_struct.idl + ''', + options='--header --ndr-parser', + output_dir='../gen_ndr') + +# The interface names here are not the same as the IDL name, so the +# auto-generation of the fuzzer fails to link + +bld.SAMBA_PIDL_LIST('PIDL', + ''' + ioctl.idl + nfs4acl.idl + quota.idl + wsp_data.idl + wsp.idl + ''', + options='--header --ndr-parser', + output_dir='../gen_ndr', + generate_fuzzers=False) + +# Non-DCE/RPC protocols with Python bindings +# (for structures or constants) + +bld.SAMBA_PIDL_LIST('PIDL', + ''' + auth.idl + claims.idl + dcerpc.idl + dfsblobs.idl + dns.idl + dnsp.idl + drsblobs.idl + gmsa.idl + idmap.idl + krb5pac.idl + krb5ccache.idl + messaging.idl + misc.idl + nbt.idl + ntlmssp.idl + preg.idl + security.idl + server_id.idl + smb_acl.idl + xattr.idl + smb3posix.idl + ''', + options='--header --ndr-parser --python', + output_dir='../gen_ndr') + +bld.SAMBA_PIDL_LIST('PIDL', + ''' + windows_event_ids.idl + conditional_ace.idl + ''', + options='--header --ndr-parser --python', + output_dir='../gen_ndr', + generate_tables=False) + +bld.SAMBA_PIDL_LIST('PIDL', + 'winbind.idl', + options='--header --ndr-parser --server-compat --client --python', + output_dir='../gen_ndr') diff --git a/librpc/idl/wsp.idl b/librpc/idl/wsp.idl new file mode 100644 index 0000000..4ae81d7 --- /dev/null +++ b/librpc/idl/wsp.idl @@ -0,0 +1,1345 @@ +#include "idl_types.h" +import "wsp_data.idl"; +import "misc.idl"; + +[ + version(1.0), + endpoint("ncacn_np:[\\pipe\\MsFteWds]"), + helpstring("Windows Search WSP Protocol"), + helper("../librpc/wsp/wsp_helper.h"), + pointer_default(unique) +] + +interface msftewds +{ + typedef [public] struct { + /* + * hack to allow wsp_cbasestoragevariant to be used before + * it is defined + */ + wsp_cbasestoragevariant variant[SINGLE_ITEM]; + } vt_variant_wrap; + + /* MS-WSP 2.2.1.1.1.1 DECIMAL */ + typedef [public] struct { + uint32 hi32; + uint32 mid32; + uint32 lo32; + } vt_decimal; + + /* MS-WSP 2.2.1.1.1.2 VT_VECTOR (VT_DECIMAL) */ + typedef [public] struct { + uint32 vvector_elements; + vt_decimal vvector_data[vvector_elements]; + } vt_decimal_vec; + + /* + * variant elements in a vector (and presumably safearray also) + * must be aligned to 4-byte boundary, think this is automatic for + * elements which are structures + */ + + /* MS-WSP see vValue details in 2.2.1.1 (VT_BSTR) */ + typedef [public] struct { + [value(strlen_m_term(value)*2)] uint32 nbytes; + [flag(STR_NULLTERM)] string value; + } vt_bstr; + + /* MS-WSP 2.2.1.1.1.2 VT_VECTOR (VT_BSTR) */ + typedef [public] struct { + uint32 vvector_elements; + vt_bstr vvector_data[vvector_elements]; + } vt_bstr_vec; + + /* MS-WSP see vValue details in 2.2.1.1 (VT_LPWSTR) */ + typedef [public] struct { + [value(strlen_m_term(value))] uint32 nbytes; + [flag(STR_NULLTERM)] string value; + } vt_lpwstr; + + /* MS-WSP 2.2.1.1.1.2 VT_VECTOR (VT_LPWSTR) */ + typedef [public] struct { + uint32 vvector_elements; + vt_lpwstr vvector_data[vvector_elements]; + } vt_lpwstr_vec; + + /* MS-WSP see vValue details in 2.2.1.1 (VT_COMPRESSED_LPWSTR) */ + typedef [public] struct { + uint32 cclen; + uint8 bytes[cclen]; + } vt_compressed_lpwstr; + + /* MS-WSP 2.2.1.1.1.2 VT_VECTOR (VT_COMPRESSED_LPWSTR) */ + typedef [public] struct { + uint32 vvector_elements; + vt_compressed_lpwstr vvector_data[vvector_elements]; + } vt_compressed_lpwstr_vec; + + + /* MS-WSP 2.2.1.1.1.2 VT_VECTOR (VT_I1) */ + typedef [public] struct { + uint32 vvector_elements; + int8 vvector_data[vvector_elements]; + } vt_i1_vec; + + /* MS-WSP 2.2.1.1.1.2 VT_VECTOR (VT_UI1) */ + typedef [public] struct { + uint32 vvector_elements; + uint8 vvector_data[vvector_elements]; + } vt_ui1_vec; + + /* MS-WSP 2.2.1.1.1.2 VT_VECTOR (VT_I2) */ + typedef [public] struct { + uint32 vvector_elements; + int16 vvector_data[vvector_elements]; + } vt_i2_vec; + + /* MS-WSP 2.2.1.1.1.2 VT_VECTOR (VT_UI2) */ + typedef [public] struct { + uint32 vvector_elements; + uint16 vvector_data[vvector_elements]; + } vt_ui2_vec; + + /* MS-WSP 2.2.1.1.1.2 VT_VECTOR (VT_I4) */ + typedef [public] struct { + uint32 vvector_elements; + int32 vvector_data[vvector_elements]; + } vt_i4_vec; + + /* MS-WSP 2.2.1.1.1.2 VT_VECTOR (VT_UI4) */ + typedef [public] struct { + uint32 vvector_elements; + uint32 vvector_data[vvector_elements]; + } vt_ui4_vec; + + /* MS-WSP 2.2.1.1.1.2 VT_VECTOR (VT_I8) */ + typedef [public] struct { + uint32 vvector_elements; + dlong vvector_data[vvector_elements]; + } vt_dlong_vec; + + /* MS-WSP 2.2.1.1.1.2 VT_VECTOR (VT_UI8) */ + typedef [public] struct { + uint32 vvector_elements; + udlong vvector_data[vvector_elements]; + } vt_udlong_vec; + + /* MS-WSP 2.2.1.1.1.2 VT_VECTOR (VT_CLSID) */ + typedef [public] struct { + uint32 vvector_elements; + GUID vvector_data[vvector_elements]; + } vt_clsid_vec; + + /* MS-WSP 2.2.1.1.1.2 VT_VECTOR (VT_VARIANT) wrapped version */ + typedef [public] struct { + uint32 vvector_elements; + vt_variant_wrap vvector_data[vvector_elements]; + } vt_variant_wrap_vec; + +/* + * would be great if there some way to specify the above like below + * instead of having a vector + * for each element type e.g. see vt_lpwstr_vec, vt_bstr_vec & vt_i4_vec? + * typedef [public] struct { + * uint32 num; + * variant_types vec[num]; + *} vt_vector; + */ + + /* MS-WSP 2.2.1.1.1.4 SAFEARRAYBOUND */ + typedef [public] struct { + uint32 celements; + uint32 ilbound; + } safearraybound; + + /* MS-WSP 2.2.1.1.1.4 SAFEARRAY (VT_I4) */ + typedef [public] struct { + uint16 cdims; + uint16 ffeatures; + uint32 cbelements; + safearraybound rgsabound[cdims]; + int32 vdata[calc_array_size(rgsabound, cdims)]; + } vt_i4_safe_array; + + /* MS-WSP 2.2.1.1.1.4 SAFEARRAY (VT_UI4) */ + typedef [public] struct { + uint16 cdims; + uint16 ffeatures; + uint32 cbelements; + safearraybound rgsabound[cdims]; + uint32 vdata[calc_array_size(rgsabound, cdims)]; + } vt_ui4_safe_array; + + /* MS-WSP 2.2.1.1.1.4 SAFEARRAY (VT_BSTR) */ + typedef [public] struct { + uint16 cdims; + uint16 ffeatures; + uint32 cbelements; + safearraybound rgsabound[cdims]; + vt_bstr vdata[calc_array_size(rgsabound, cdims)]; + } vt_bstr_safe_array; + + + /* MS-WSP 2.2.1.1.1.4 SAFEARRAY (VT_I1) */ + typedef [public] struct { + uint16 cdims; + uint16 ffeatures; + uint32 cbelements; + safearraybound rgsabound[cdims]; + int8 vdata[calc_array_size(rgsabound, cdims)]; + } vt_i1_safe_array; + + /* MS-WSP 2.2.1.1.1.4 SAFEARRAY (VT_UI1) */ + typedef [public] struct { + uint16 cdims; + uint16 ffeatures; + uint32 cbelements; + safearraybound rgsabound[cdims]; + uint8 vdata[calc_array_size(rgsabound, cdims)]; + } vt_ui1_safe_array; + + + /* MS-WSP 2.2.1.1.1.4 SAFEARRAY (VT_I2) */ + typedef [public] struct { + uint16 cdims; + uint16 ffeatures; + uint32 cbelements; + safearraybound rgsabound[cdims]; + int16 vdata[calc_array_size(rgsabound, cdims)]; + } vt_i2_safe_array; + + + /* MS-WSP 2.2.1.1.1.4 SAFEARRAY (VT_UI2) */ + typedef [public] struct { + uint16 cdims; + uint16 ffeatures; + uint32 cbelements; + safearraybound rgsabound[cdims]; + uint16 vdata[calc_array_size(rgsabound, cdims)]; + } vt_ui2_safe_array; + + /* MS-WSP 2.2.1.1.1.4 SAFEARRAY (VT_I8) */ + typedef [public] struct { + uint16 cdims; + uint16 ffeatures; + uint32 cbelements; + safearraybound rgsabound[cdims]; + dlong vdata[calc_array_size(rgsabound, cdims)]; + } vt_dlong_safe_array; + + /* MS-WSP 2.2.1.1.1.4 SAFEARRAY (VT_VARIANT) */ + typedef [public] struct { + uint16 cdims; + uint16 ffeatures; + uint32 cbelements; + safearraybound rgsabound[cdims]; + vt_variant_wrap vdata[calc_array_size(rgsabound, cdims)]; + } vt_variant_wrap_safearray; + + typedef [public,nodiscriminant,switch_type(uint16)] union { + [case(VT_I1)] int8 vt_i1; + [case(VT_I1 | VT_ARRAY)] vt_i1_safe_array vt_i1_array; + [case(VT_I1 | VT_VECTOR)] vt_i1_vec vt_i1_vec; + + [case(VT_UI1)] uint8 vt_ui1; + [case(VT_UI1 | VT_ARRAY)] vt_ui1_safe_array vt_ui1_array; + [case(VT_UI1 | VT_VECTOR)] vt_ui1_vec vt_ui1_vec; + + [case(VT_I2)] int16 vt_i2; + [case(VT_I2 | VT_ARRAY)] vt_i2_safe_array vt_i2_array; + [case(VT_I2 | VT_VECTOR)] vt_i2_vec vt_i2_vec; + + [case(VT_UI2)] uint16 vt_ui2; + [case(VT_UI2 | VT_ARRAY)] vt_ui2_safe_array vt_ui2_array; + [case(VT_UI2 | VT_VECTOR)] vt_ui2_vec vt_ui2_vec; + + [case(VT_BOOL)] uint16 vt_bool; + [case(VT_BOOL | VT_ARRAY)] vt_ui2_safe_array vt_bool_array; + [case(VT_BOOL | VT_VECTOR)] vt_ui2_vec vt_bool_vec; + + [case(VT_I4)] int32 vt_i4; + [case(VT_I4 | VT_VECTOR)] vt_i4_vec vt_i4_vec; + [case(VT_I4 | VT_ARRAY)] vt_i4_safe_array vt_i4_array; + + [case(VT_UI4)] uint32 vt_ui4; + [case(VT_UI4 | VT_VECTOR)] vt_ui4_vec vt_ui4_vec; + [case(VT_UI4 | VT_ARRAY)] vt_ui4_safe_array vt_ui4_array; + + [case(VT_R4)] uint32 vt_r4; + [case(VT_R4 | VT_VECTOR)] vt_i4_vec vt_r4_vec; + [case(VT_R4 | VT_ARRAY)] vt_i4_safe_array vt_r4_array; + + [case(VT_INT)] int32 vt_int; + [case(VT_INT | VT_ARRAY)] vt_i4_safe_array vt_int_array; + + [case(VT_UINT)] uint32 vt_uint; + [case(VT_UINT | VT_ARRAY)] vt_ui4_safe_array vt_uint_array; + + [case(VT_ERROR)] uint32 vt_error; + [case(VT_ERROR | VT_VECTOR)] vt_ui4_vec vt_error_vec; + [case(VT_ERROR | VT_ARRAY)] vt_ui4_safe_array vt_error_array; + + [case(VT_I8)] dlong vt_i8; + [case(VT_I8 | VT_VECTOR)] vt_dlong_vec vt_i8_vec; + + [case(VT_UI8)] udlong vt_ui8; + [case(VT_UI8 | VT_VECTOR)] vt_udlong_vec vt_ui8_vec; + + [case(VT_R8)] dlong vt_r8; + [case(VT_R8 | VT_VECTOR)] vt_dlong_vec vt_r8_vec; + [case(VT_R8 | VT_ARRAY)] vt_dlong_safe_array vt_r8_array; + + [case(VT_CY)] dlong vt_cy; + [case(VT_CY | VT_VECTOR)] vt_dlong_vec vt_cy_vec; + [case(VT_CY | VT_ARRAY)] vt_dlong_safe_array vt_cy_array; + + [case(VT_DATE)] dlong vt_date; + [case(VT_DATE | VT_VECTOR)] vt_dlong_vec vt_date_vec; + [case(VT_DATE| VT_ARRAY)] vt_dlong_safe_array vt_date_array; + + [case(VT_FILETIME)] udlong vt_filetime; + [case(VT_FILETIME | VT_VECTOR)] vt_udlong_vec vt_filetime_vec; + + [case(VT_BSTR)] vt_bstr vt_bstr; + [case(VT_BSTR | VT_VECTOR)] vt_bstr_vec vt_bstr_v; + [case(VT_BSTR | VT_ARRAY)] vt_bstr_safe_array vt_bstr_array; + + [case(VT_LPWSTR)] vt_lpwstr vt_lpwstr; + [case(VT_LPWSTR | VT_VECTOR)] vt_lpwstr_vec vt_lpwstr_v; + + [case(VT_COMPRESSED_LPWSTR)] vt_compressed_lpwstr vt_compressed_lpwstr; + [case(VT_COMPRESSED_LPWSTR | VT_VECTOR)] vt_compressed_lpwstr_vec vt_compresseed_lpwstr_v; + + [case(VT_DECIMAL)] vt_decimal vt_decimal; + [case(VT_DECIMAL | VT_VECTOR)] vt_decimal_vec vt_decimal_v; + + [case(VT_CLSID)] GUID vt_clid; + [case(VT_CLSID | VT_VECTOR)] vt_clsid_vec vt_clsid_v; + + [case(VT_BLOB)] DATA_BLOB vt_blob; + [case(VT_BLOB_OBJECT)] DATA_BLOB vt_blob_object; + + [case(VT_NULL)]; + [case(VT_EMPTY)]; + [case(VT_VARIANT)] vt_variant_wrap vt_variant_wrap; + + [case(VT_VARIANT | VT_VECTOR)] vt_variant_wrap_vec vt_variant_wrap_vec; + [case(VT_VARIANT | VT_ARRAY)] vt_variant_wrap_safearray vt_variant_wrap_array; + } variant_types; + + /* + * MS-WSP 2.2.1.1 CBaseStorageVariant + */ + typedef [public] struct { + uint16 vtype; + uint8 vdata1; + uint8 vdata2; + [max_recursion(102), switch_is(vtype)] variant_types vvalue; + } wsp_cbasestoragevariant; + + typedef [public, nodiscriminant, switch_type(uint32)] union { + [case(DBKIND_GUID_NAME)] string vstring; + [default]; + } wsp_cdbcolid_opt_name; + + /* MS-WSP 2.2.1.29 CDbColId */ + typedef [public] struct { + uint32 ekind; + [flag(NDR_ALIGN8)] DATA_BLOB _pad1; + GUID guid; + uint32 uiid; + [switch_is(ekind)] wsp_cdbcolid_opt_name vstring; + } wsp_cdbcolid; + + + /* MS-WSP 2.2.2 Message Headers */ + typedef [public] struct { + uint32 msg; + uint32 status; + uint32 checksum; + uint32 ulreserved2; + } wsp_header; + + /* MS-WSP 2.2.1.30 CDbProp */ + typedef [public,flag(NDR_ALIGN4)] struct { + uint32 dbpropid; + uint32 dbpropoptions; + uint32 dbpropstatus; + wsp_cdbcolid colid; + wsp_cbasestoragevariant vvalue; + } wsp_cdbprop; + + /* MS-WSP 2.2.1.31 CDbPropSet */ + typedef [flag(NDR_NOALIGN),public] struct { + GUID guidpropertyset; + [flag(NDR_ALIGN4)] DATA_BLOB _pad1; + uint32 cproperties; + wsp_cdbprop aprops[cproperties]; + } wsp_cdbpropset; + + /* MS-WSP 2.2.1.10 CSort */ + typedef [public] struct { + uint32 pidcolimn; + uint32 dworder; + uint32 dwindividual; + uint32 locale; + } wsp_csort; + + /* MS-WSP 2.2.1.42 CSortSet */ + typedef [public] struct { + uint32 count; + wsp_csort sortarray[count]; + } wsp_csortset; + + /* + * cPropSets, PropterySet1 & PropertySet2 (parts of CPMConnectIn) + */ + typedef [public] struct { + uint32 cpropsets; + wsp_cdbpropset propertyset1; + wsp_cdbpropset propertyset2; + } connectin_propsets; + + /* + * cExtPropSet, aPropertySets (parts of CPMConnectIn) + */ + typedef [public] struct { + uint32 cextpropset; + wsp_cdbpropset apropertysets[cextpropset]; + } connectin_extpropsets; + + /* MS-WSP 2.2.3.2 CPMConnectIn */ + typedef [public] struct { + uint32 iclientversion; + uint32 fclientisremote; + uint32 cbblob1; + uint32 paddingcbblob2; + uint32 cbblob2; + uint8 padding[12]; + [flag(STR_NULLTERM)] string machinename; + [flag(STR_NULLTERM)] string username; + [flag(NDR_ALIGN8)] DATA_BLOB _pad1; + uint8 propsets[cbblob1]; + [flag(NDR_ALIGN8)] DATA_BLOB _pad2; + uint8 extpropsets[cbblob2]; + } wsp_cpmconnectin; + + typedef [public] struct { + uint32 reserved; + uint32 dwwinvermajor; + uint32 dwwinverminor; + uint32 dwnlsvermajor; + uint32 dwnlsverminor; + } version_info; + + typedef [public, nodiscriminant, switch_type(uint32)] union { + [case(WINDOWS_7)] version_info version_info; + [case(WINDOWS_2008)] version_info version_info; + [default] uint32 reserved[4]; + } version_dependant; + + /* MS-WSP 2.2.3.3 CPMConnectOut */ + typedef [public] struct { + uint32 server_version; + [switch_is(server_version)] version_dependant version_dependant; + } wsp_cpmconnectout; + + /* MS-WSP 2.2.1.18 CColumnSet */ + typedef [public] struct { + uint32 count; + uint32 indexes[count]; + } wsp_ccolumnset; + + + /* MS-WSP 2.2.1.6 CNodeRestriction */ + typedef [public] struct { + uint32 cnode; + [max_recursion(100)] wsp_crestriction panode[cnode]; + } wsp_cnoderestriction; + + typedef [public] struct { + uint32 len; + [charset(UTF16)] uint8 vstring[len*2]; + } wsp_len_string_pair; + + typedef [public, nodiscriminant, switch_type(uint32)] union { + [case(PRSPEC_LPWSTR)] wsp_len_string_pair propname; + [case(PRSPEC_PROPID)] uint32 prspec; + } wsp_propname_or_propid; + + typedef [public] struct { + uint32 cclabel; + [charset(UTF16)] uint8 vstring[cclabel*2]; + } wsp_labeldata; + + typedef [public, nodiscriminant, switch_type(uint8)] union { + [case(0)]; + [case(1)] wsp_labeldata data; + } opt_labeldata; + + /* MS-WSP 2.2.1.23 RANGEBOUNDARY */ + typedef [public] struct { + uint32 ultype; + wsp_cbasestoragevariant prval; + uint8 labelpresent; + [switch_is(labelpresent)] opt_labeldata opt_data; + } wsp_rangeboundary; + + /* MS-WSP 2.2.1.22 CRangeCategSpec */ + typedef [public] struct { + uint32 lcid; + uint32 crange; + wsp_rangeboundary arangebegin[crange + 1]; + } wsp_crangecategspec; + + typedef [public, nodiscriminant, switch_type(uint32)] union { + [case(0)]; + [default] wsp_crangecategspec crangecategspec; + } opt_crangecatespec; + + /* MS-WSP 2.2.1.21 CCategSpec */ + typedef [public] struct { + uint32 ulcategtype; + wsp_csort sortkey; + [switch_is(ulcategtype)] opt_crangecatespec opt; + } wsp_ccategspec; + + typedef [public] struct { + uint32 ulmaxnumtoret; + uint32 idrepresentitive; + } wsp_repofdata; + + typedef [public,nodiscriminant,switch_type(uint8)] union { + [case(DBAGGTTYPE_FIRST)] uint32 firstmaxnumret; + [case(DBAGGTTYPE_BYFREQ)] uint32 firstbyfreq; + [case(DBAGGTTYPE_REPRESENTATIVEOF)] wsp_repofdata repofdata; + [default]; + } opt_type_data; + + /* MS-WSP 2.2.1.25 CAggregSpec */ + typedef [public] struct { + uint8 type; + [flag(NDR_ALIGN4)] DATA_BLOB _pad1; + uint32 ccalias; + [charset(UTF16)] uint8 alias[ccalias*2]; + uint32 idcolumn; + [switch_is(type)] opt_type_data opt_data; + } wsp_caggregspec; + + /* MS-WSP 2.2.1.24 CAggregSet */ + typedef [public] struct { + uint32 ccount; + wsp_caggregspec aggregspecs[ccount]; + } wsp_caggregset; + + /* MS-WSP 2.2.1.27 CAggregSortKey */ + typedef [public] struct { + uint32 order; + wsp_caggregspec columnspec; + } wsp_caggregsortkey; + + /* MS-WSP 2.2.1.26 CSortAggregSet */ + typedef [public] struct { + uint32 ccount; + wsp_caggregsortkey sortkeys[ccount]; + } wsp_csortaggregset; + + typedef [public, nodiscriminant, switch_type(uint8)] union { + /* + * if type == GroupIdValue then wsp_cbasestoragevariant + * ingroupid is present + */ + [case(0x03)] wsp_cbasestoragevariant ingroupid; + [default]; + } wsp_opt_ingroupid; + + typedef [public] struct { + uint8 type; + [flag(NDR_ALIGN4)] DATA_BLOB _pad1; + [switch_is(type)] wsp_opt_ingroupid opt_groupid; + wsp_csortset sortaggregset; + } wsp_cingroupsortaggregset; + + /* MS-WSP 2.2.1.28 CInGroupSortAggregSets */ + typedef [public] struct { + uint32 ccount; + wsp_cingroupsortaggregset sortsets[ccount]; + } wsp_cingroupsortaggregsets; + + /* MS-WSP 2.2.1.20 CCategorizationSpec */ + typedef [public] struct { + wsp_ccolumnset cscolumns; + wsp_ccategspec spec; + wsp_caggregset aggregset; + wsp_csortaggregset sortaggregset; + wsp_cingroupsortaggregsets ingroupsortaggset; + uint32 cmaxresults; + } wsp_ccategorizationspec; + + /* MS-WSP 2.2.1.19 CCategorizationSet */ + typedef [public] struct { + uint32 size; + wsp_ccategorizationspec categories[size]; + } wsp_ccategorizationset; + + /* MS-WSP 2.2.1.2 CFullPropSpec */ + typedef [flag(NDR_NOALIGN),public] struct { + [flag(NDR_ALIGN8)] DATA_BLOB _pad1; + GUID guidpropset; + uint32 ulkind; + [switch_is(ulkind)] wsp_propname_or_propid name_or_id; + } wsp_cfullpropspec; + + /* MS-WSP 2.2.1.3 CContentRestriction */ + typedef [public] struct { + wsp_cfullpropspec property; + [flag(NDR_ALIGN4)] DATA_BLOB _pad1; + uint32 cc; + [charset(UTF16)] uint8 pwcsphrase[cc*2]; + [flag(NDR_ALIGN4)] DATA_BLOB _pad2; + uint32 lcid; + uint32 ulgeneratemethod; + } wsp_ccontentrestriction; + + /* MS-WSP 2.2.1.7 CPropertyRestriction */ + typedef [public] struct { + uint32 relop; + wsp_cfullpropspec property; + wsp_cbasestoragevariant prval; + [flag(NDR_ALIGN4)] DATA_BLOB _pad1; + uint32 lcid; + } wsp_cpropertyrestriction; + + /* MS-WSP 2.2.1.5 CNatLanguageRestriction */ + typedef [public] struct { + wsp_cfullpropspec property; + [flag(NDR_ALIGN4)] DATA_BLOB _pad1; + uint32 cc; + [charset(UTF16)] uint8 pwcsphrase[cc*2]; + [flag(NDR_ALIGN4)] DATA_BLOB _pad2; + uint32 lcid; + } wsp_cnatlanguagerestriction; + + typedef [public] struct { + wsp_crestriction restriction[SINGLE_ITEM]; + } wsp_wrap_crestriction; + + + /* MS-WSP 2.2.1.12 CCoercionRestriction*/ + typedef [public] struct { + /* no IEEE 754 implementation for float ?? */ + /* float ffvalue; */ + uint32 ffvalue; + wsp_crestriction childres[SINGLE_ITEM]; + } wsp_ccoercionrestriction; + + /* MS-WSP 2.2.1.11 CVectorRestriction */ + typedef [public] struct { + uint32 pres; + [flag(NDR_ALIGN4)] DATA_BLOB padding; + uint32 uirankmethod; + } wsp_cvectorrestriction; + + /* MS-WSP 2.2.1.9 CScopeRestriction */ + typedef [public] struct { + uint32 cclowerpath; + [charset(UTF16)] uint8 lowerpath[cclowerpath*2]; + [flag(NDR_ALIGN4)] DATA_BLOB padding; + uint32 length; + uint32 frecursive; + uint32 fvirtual; + } wsp_cscoperestriction; + + /* MS-WSP 2.2.1.8 CReuseWhere */ + typedef [public] struct { + uint32 whereid; + } wsp_creusewhere; + + /* MS-WSP 2.2.1.4 CInternalPropertyRestriction */ + typedef [public] struct { + uint32 relop; + uint32 pid; + wsp_cbasestoragevariant prval; + uint32 lcid; + uint8 restrictionpresent; + wsp_crestriction nextrestriction[SINGLE_ITEM]; + } wsp_cinternalpropertyrestriction; + + + /* MS-WSP 2.2.1.14 CProbRestriction */ + typedef [public] struct { + wsp_cfullpropspec property; + uint32 fik1; + uint32 fik2; + uint32 fik3; + uint32 flb; + uint32 cfeedbackdoc; + uint32 probquerypid; + } wsp_cprobrestriction; + + /* MS-WSP 2.2.1.15 CFeedbackRestriction */ + typedef [public] struct { + uint32 feedbackdoc; + wsp_cfullpropspec property; + } wsp_cfeedbackrestriction; + + /* MS-WSP 2.2.1.13 CRelDocRestriction */ + typedef [public] struct { + wsp_cbasestoragevariant vdocument; + } wsp_creldocrestriction; + + typedef [public,nodiscriminant,switch_type(uint32)] union { + [case(RTNONE)]; + [case(RTNOT)] wsp_wrap_crestriction restriction; + [case(RTAND)] wsp_cnoderestriction cnoderestriction; + [case(RTOR)] wsp_cnoderestriction orcnoderestriction; + [case(RTCONTENT)] wsp_ccontentrestriction ccontentrestriction; + [case(RTPROPERTY)] wsp_cpropertyrestriction cpropertyrestriction; + [case(RTPROXIMITY)] wsp_cnoderestriction proximityrestriction; + [case(RTVECTOR)] wsp_cvectorrestriction vectorrestriction; + [case(RTNATLANGUAGE)] wsp_cnatlanguagerestriction cnatlanguagerestriction; + [case(RTSCOPE)] wsp_cscoperestriction scoperestriction; + [case(RTREUSEWHERE)] wsp_creusewhere reusewhere; + [case(RTINTERNALPROP)] wsp_cinternalpropertyrestriction internalpropertyrestriction; + [case(RTPHRASE)] wsp_cnoderestriction phraserestriction; + [case(RTCOERCE_ABSOLUTE)] wsp_ccoercionrestriction ccoercionrestriction_abs; + [case(RTCOERCE_ADD)] wsp_ccoercionrestriction ccoercionrestriction_add; + [case(RTCOERCE_MULTIPLY)] wsp_ccoercionrestriction ccoercionrestriction_mul; + [case(RTPROB)] wsp_cprobrestriction probrestriction; + [case(RTFEEDBACK)] wsp_cfeedbackrestriction feedbackrestriction; + [case(RTRELDOC)] wsp_creldocrestriction reldocrestriction; + + } wsp_crestrictions; + + + /* MS-WSP 2.2.1.17 CRestriction */ + typedef [public] struct { + uint32 ultype; + uint32 weight; + [switch_is(ultype)] wsp_crestrictions restriction; + } wsp_crestriction; + + /* MS-WSP 2.2.1.16 CRestrictionArray */ + typedef [flag(NDR_NOALIGN),public] struct { + uint8 count; + uint8 ispresent; + [flag(NDR_ALIGN4)] DATA_BLOB _pad1; + wsp_crestriction restrictions[count]; + } wsp_crestrictionarray; + + /* MS-WSP 2.2.1.40 CRowsetProperties */ + typedef [public] struct { + uint32 ubooleanoptions; + uint32 ulmaxopenrows; + uint32 ulmemoryusage; + uint32 cmaxresults; + uint32 ccmdtimeout; + } wsp_crowsetproperties; + + /* MS-WSP 2.2.1.32 CPidMapper */ + typedef [public] struct { + uint32 count; + [flag(NDR_ALIGN4)] DATA_BLOB _pad2; + wsp_cfullpropspec apropspec[count]; + } wsp_cpidmapper; + + /* MS-WSP 2.2.1.35 SProperty */ + typedef [public] struct { + uint32 pid; + uint32 weight; + } wsp_sproperty; + + /* MS-WSP 2.2.1.34 CColumnGroup */ + typedef [public] struct { + uint32 count; + uint32 grouppid; + wsp_sproperty props[count]; + } wsp_ccolumngroup; + + /* MS-WSP 2.2.1.33 CColumnGroupArray */ + typedef [public] struct { + uint32 count; + wsp_ccolumngroup agrouparray[count]; + } wsp_ccolumngrouparray; + + typedef [public,nodiscriminant,switch_type(uint8)] union { + [case(0)]; + [default] wsp_cingroupsortaggregsets groupsortaggregsets; + }opt_wsp_cingroupsortaggregsets; + + typedef [public,nodiscriminant,switch_type(uint8)] union { + [case(0)]; + [default] wsp_crestrictionarray restrictionarray; + }opt_wsp_crestrictionarray; + + typedef [public,nodiscriminant,switch_type(uint8)] union { + [case(0)]; + [default] wsp_ccolumnset columnset; + }opt_wsp_ccolumnset; + + typedef [public,nodiscriminant,switch_type(uint8)] union { + [case(0)]; + [default] wsp_ccategorizationset ccategorizationset; + }opt_wsp_ccategorizationset; + + typedef [public] struct { + uint32 size; + uint8 ccolumnsetpresent; + /* padding is not needed here (and below) + * as structures are default aligned to 4 byte + * boundaries. + * commented out valued left for documentation + * and to match the actual structure definition + */ + /*[flag(NDR_ALIGN4)] DATA_BLOB paddingCColumnSetPresent;*/ + [switch_is(ccolumnsetpresent)] opt_wsp_ccolumnset columnset; + uint8 crestrictionpresent; + [switch_is(crestrictionpresent)] opt_wsp_crestrictionarray restrictionarray; + uint8 csortsetpresent; + /*[flag(NDR_ALIGN4)] DATA_BLOB paddingCSortSetPresent;*/ + [switch_is(csortsetpresent)] opt_wsp_cingroupsortaggregsets sortset; + uint8 ccategorizationsetpresent; + /*[flag(NDR_ALIGN4)] DATA_BLOB paddingCCategorizationSetPresent;*/ + [switch_is(ccategorizationsetpresent)] opt_wsp_ccategorizationset ccategorizationset; + wsp_crowsetproperties rowsetproperties; + wsp_cpidmapper pidmapper; + wsp_ccolumngrouparray grouparray; + uint32 lcid; + } wsp_cpmcreatequeryin; + + /* MS-WSP 2.2.3.5 CPMCreateQueryOut */ + typedef [public] struct { + uint32 ftruesequential; + uint32 fWorkIdUnique; + /* + * uint32 acursors[SIZE]; + * + * after fWorkIdUnique is an array of uint32 cursors, + * actually there is always at least 1 item in the array, + * SIZE is determined by the optional ccategorizationset field in + * the request + */ + } wsp_cpmcreatequeryout; + + typedef [public, nodiscriminant, switch_type(uint8)] union { + [case(1)] uint8 value; + [case(0)]; + } aggregatetype; + + typedef [public, nodiscriminant, switch_type(uint8)] union { + [case(1)] uint16 value; + [case(0)]; + } valueoffset; + + typedef [public, nodiscriminant, switch_type(uint8)] union { + [case(1)] uint16 value; + [case(0)]; + } valuesize; + + typedef [public, nodiscriminant, switch_type(uint8)] union { + [case(1)] uint16 value; + [case(0)]; + } lengthoffset; + + typedef [public, nodiscriminant, switch_type(uint8)] union { + [case(1)] uint16 value; + [case(0)]; + } statusoffset; + + /* MS-WSP 2.2.1.43 CTableColumn */ + typedef [public] struct { + wsp_cfullpropspec propspec; + uint32 vtype; + uint8 aggregateused; + [switch_is(aggregateused)] aggregatetype aggregatetype; + uint8 valueused; + [switch_is(valueused)] valueoffset valueoffset; /* auto aligned to 2 byte boundary */ + [switch_is(valueused)] valuesize valuesize; /* auto aligned to 2 byte boundary */ + uint8 statusused; + [switch_is(statusused)] statusoffset statusoffset; /* auto aligned to 2 byte boundary */ + uint8 lengthused; + [switch_is(lengthused)] lengthoffset lengthoffset; /* auto aligned to 2 byte boundary */ + } wsp_ctablecolumn; + + /* + * struct below is included for completeness but + * isn't currently referenced. + * MS-WSP 2.2.1.45 CCompletionCategSpec + */ + typedef [public] struct { + uint32 type; + uint32 lcid; + uint32 ccomplstrings; + wsp_serializedpropertyvalue apszcomplstrings[ccomplstrings]; + uint32 ccomplpids; + uint32 acomplpids[ccomplpids]; + } wsp_ccompletioncategspec; + + /* MS-WSP 2.2.3.10 CPMSetBindingsIn */ + typedef [public] struct { + uint32 hcursor; + uint32 brow; + uint32 bbindingdesc; + uint32 dummy; + uint32 ccolumns; + wsp_ctablecolumn acolumns[ccolumns]; + } wsp_cpmsetbindingsin; + + /* MS-WSP 2.2.1.39 CRowSeekNext */ + typedef [public] struct { + uint32 cskip; + } wsp_crowseeknext; + + /* MS-WSP 2.2.1.36 CRowSeekAt */ + typedef [public] struct { + uint32 bmkoffset; + uint32 cskip; + uint32 hregion; + } wsp_crowseekat; + + /* MS-WSP 2.2.1.37 CRowSeekAtRatio */ + typedef [public] struct { + uint32 ulnumerator; + uint32 uldenominator; + uint32 hregion; + } wsp_crowseekatratio; + + /* MS-WSP 2.2.1.38 CRowSeekByBookmark */ + typedef [public] struct { + uint32 cbookmarks; + uint32 abookmarks[cbookmarks]; + uint32 maxret; + uint32 ascret[maxret]; + } wsp_crowseekbybookmark; + + typedef [public,nodiscriminant,switch_type(uint32)] union { + [case(EROWSEEKNONE)]; + [case(EROWSEEKNEXT)] wsp_crowseeknext crowseeknext; + [case(EROWSEEKAT)] wsp_crowseekat crowseekat; + [case(EROWSEEKATRATIO)] wsp_crowseekatratio crowseekatratio; + [case(EROWSEEKBYBOOKMARK)] wsp_crowseekbybookmark crowseekbybookmark; + } wsp_seekdescription; + + /* MS-WSP 2.2.3.11 CPMGetRowsIn */ + typedef [public] struct { + uint32 hcursor; + uint32 crowstotransfer; + uint32 cbrowWidth; + uint32 cbseek; + uint32 cbreserved; + uint32 cbreadbuffer; + uint32 ulclientbase; + uint32 fbwdfetch; + uint32 etype; + uint32 chapt; + [switch_is(etype)] wsp_seekdescription seekdescription; + } wsp_cpmgetrowsin; + + /* MS-WSP 2.2.1.42 */ + typedef [public] struct { + uint16 vtype; + uint16 reserved1; + uint32 reserved2; + /* followed by offset either 4 or 8 byte count (if VT_VECTOR) */ + /* followed by offset either 4 or 8 byte offset (if variable size value)*/ + /* followed by fixed value (if fixed size value) */ + } wsp_ctablevariant; + + /* MS-WSP 2.2.3.12 CPMGetRowsOut */ + typedef [public] struct { + uint32 rowsreturned; + uint32 etype; + uint32 chapt; + [switch_is(etype)] wsp_seekdescription seekdescription; + /* + * following rows data is not defined here, size is unknown + * in the context of this structure but is the size of + * breadbuffer defined in cpmgetrowsin. + */ + } wsp_cpmgetrowsout; + + /* MS-WSP 2.2.3.24 CPMFreeCursorIn */ + typedef [public] struct { + uint32 hcursor; + } wsp_cpmfreecursorin; + + /* MS-WSP 2.2.3.25 CPMFreeCursorOut */ + typedef [public] struct { + uint32 ccursorsremaining; + } wsp_cpmfreecursorout; + + /* MS-WSP 2.2.3.6 CPMGetQueryStatusIn */ + typedef [public] struct { + uint32 hcursor; + } wsp_cpmgetquerystatusin; + + /* MS-WSP 2.2.3.7 CPMGetQueryStatusOut */ + typedef [public] struct { + uint32 qstatus; + } wsp_cpmgetquerystatusout; + + /* MS-WSP 2.2.3.8 CPMGetQueryStatusExIn */ + typedef [public] struct { + uint32 hcursor; + uint32 bmk; + } wsp_cpmgetquerystatusexin; + + /* MS-WSP 2.2.3.9 CPMGetQueryStatusExOut */ + typedef [public] struct { + uint32 qstatus; + uint32 cfiltereddocuments; + uint32 cdocumentstofilter; + uint32 dwratiofinisheddenominator; + uint32 dwratiofinishednumerator; + uint32 irowbmk; + uint32 crowstotal; + uint32 maxrank; + uint32 resultsfound; + uint32 whereid; + } wsp_cpmgetquerystatusexout; + + /* MS-WSP 2.2.3.23 CPMRestartPositionIn */ + typedef [public] struct { + uint32 hcursor; + uint32 chapter; + } wsp_cpmrestartpositionin; + + /* MS-WSP 2.2.3.13 CPMRatioFinishedIn */ + typedef [public] struct { + uint32 hcursor; + uint32 fquick; + } wsp_cpmratiofinishedin; + + /* MS-WSP 2.2.3.14 CPMRatioFinishedOut */ + typedef [public] struct { + uint32 ulnumerator; + uint32 uldenominator; + uint32 crows; + uint32 fnewrows; + } wsp_cpmratiofinishedout; + + /* MS-WSP 2.2.3.15 CPMRatioFinishedOut */ + typedef [public] struct { + uint32 wid; + uint32 cbsofar; + uint32 cbpropspec; + uint32 cbchunk; + wsp_cfullpropspec propspec; + } wsp_cpmfetchvaluein; + + typedef [public] struct { + uint16 cdims; + safearraybound rgsabound[cdims]; + int8 vdata[calc_array_size(rgsabound, cdims)]; + } vt_i1_safe2_array; + + typedef [public] struct { + uint16 cdims; + safearraybound rgsabound[cdims]; + uint8 vdata[calc_array_size(rgsabound, cdims)]; + } vt_ui1_safe2_array; + + typedef [public] struct { + uint16 cdims; + safearraybound rgsabound[cdims]; + int16 vdata[calc_array_size(rgsabound, cdims)]; + } vt_i2_safe2_array; + + typedef [public] struct { + uint16 cdims; + safearraybound rgsabound[cdims]; + uint16 vdata[calc_array_size(rgsabound, cdims)]; + } vt_ui2_safe2_array; + + typedef [public] struct { + uint16 cdims; + safearraybound rgsabound[cdims]; + int32 vdata[calc_array_size(rgsabound, cdims)]; + } vt_i4_safe2_array; + + typedef [public] struct { + uint16 cdims; + safearraybound rgsabound[cdims]; + uint32 vdata[calc_array_size(rgsabound, cdims)]; + } vt_ui4_safe2_array; + + typedef [public] struct { + uint16 cdims; + safearraybound rgsabound[cdims]; + dlong vdata[calc_array_size(rgsabound, cdims)]; + } vt_dlong_safe2_array; + + typedef [public] struct { + uint16 cdims; + safearraybound rgsabound[cdims]; + vt_bstr vdata[calc_array_size(rgsabound, cdims)]; + } vt_bstr_safe2_array; + + typedef [public] struct { + uint16 cdims; + safearraybound rgsabound[cdims]; + vt_variant_wrap vdata[calc_array_size(rgsabound, cdims)]; + } vt_variant_wrap_safearray2; + + typedef [public,nodiscriminant,switch_type(uint32)] union { + [case(VT_I1)] int8 vt_i1; + [case(VT_I1 | VT_ARRAY)] vt_i1_safe2_array vt_i1_array; + [case(VT_I1 | VT_VECTOR)] vt_i1_vec vt_i1_vec; + + [case(VT_UI1)] uint8 vt_ui1; + [case(VT_UI1 | VT_ARRAY)] vt_ui1_safe2_array vt_ui1_array; + [case(VT_UI1 | VT_VECTOR)] vt_ui1_vec vt_ui1_vec; + + [case(VT_I2)] int16 vt_i2; + [case(VT_I2 | VT_ARRAY)] vt_i2_safe2_array vt_i2_array; + [case(VT_I2 | VT_VECTOR)] vt_i2_vec vt_i2_vec; + + [case(VT_UI2)] uint16 vt_ui2; + [case(VT_UI2 | VT_ARRAY)] vt_ui2_safe2_array vt_ui2_array; + [case(VT_UI2 | VT_VECTOR)] vt_ui2_vec vt_ui2_vec; + + [case(VT_BOOL)] uint16 vt_bool; + [case(VT_BOOL | VT_ARRAY)] vt_ui2_safe2_array vt_bool_array; + [case(VT_BOOL | VT_VECTOR)] vt_ui2_vec vt_bool_vec; + + [case(VT_I4)] int32 vt_i4; + [case(VT_I4 | VT_VECTOR)] vt_i4_vec vt_i4_vec; + [case(VT_I4 | VT_ARRAY)] vt_i4_safe2_array vt_i4_array; + + [case(VT_UI4)] uint32 vt_ui4; + [case(VT_UI4 | VT_VECTOR)] vt_ui4_vec vt_ui4_vec; + [case(VT_UI4 | VT_ARRAY)] vt_ui4_safe2_array vt_ui4_array; + + [case(VT_R4)] uint32 vt_r4; + [case(VT_R4 | VT_VECTOR)] vt_i4_vec vt_r4_vec; + [case(VT_R4 | VT_ARRAY)] vt_i4_safe2_array vt_r4_array; + + [case(VT_INT)] int32 vt_int; + [case(VT_INT | VT_ARRAY)] vt_i4_safe2_array vt_int_array; + + [case(VT_UINT)] uint32 vt_uint; + [case(VT_UINT | VT_ARRAY)] vt_ui4_safe2_array vt_uint_array; + + [case(VT_ERROR)] uint32 vt_error; + [case(VT_ERROR | VT_VECTOR)] vt_ui4_vec vt_error_vec; + [case(VT_ERROR | VT_ARRAY)] vt_ui4_safe2_array vt_error_array; + + [case(VT_I8)] dlong vt_i8; + [case(VT_I8 | VT_VECTOR)] vt_dlong_vec vt_i8_vec; + + [case(VT_UI8)] udlong vt_ui8; + [case(VT_UI8 | VT_VECTOR)] vt_udlong_vec vt_ui8_vec; + + [case(VT_R8)] dlong vt_r8; + [case(VT_R8 | VT_VECTOR)] vt_dlong_vec vt_r8_vec; + [case(VT_R8 | VT_ARRAY)] vt_dlong_safe2_array vt_r8_array; + + [case(VT_CY)] dlong vt_cy; + [case(VT_CY | VT_VECTOR)] vt_dlong_vec vt_cy_vec; + [case(VT_CY | VT_ARRAY)] vt_dlong_safe2_array vt_cy_array; + + [case(VT_DATE)] dlong vt_date; + [case(VT_DATE | VT_VECTOR)] vt_dlong_vec vt_date_vec; + [case(VT_DATE| VT_ARRAY)] vt_dlong_safe2_array vt_date_array; + + [case(VT_FILETIME)] udlong vt_filetime; + [case(VT_FILETIME | VT_VECTOR)] vt_udlong_vec vt_filetime_vec; + + [case(VT_BSTR)] vt_bstr vt_bstr; + [case(VT_BSTR | VT_VECTOR)] vt_bstr_vec vt_bstr_v; + [case(VT_BSTR | VT_ARRAY)] vt_bstr_safe2_array vt_bstr_array; + + [case(VT_LPWSTR)] vt_lpwstr vt_lpwstr; + [case(VT_LPWSTR | VT_VECTOR)] vt_lpwstr_vec vt_lpwstr_v; + + [case(VT_COMPRESSED_LPWSTR)] vt_compressed_lpwstr vt_compressed_lpwstr; + [case(VT_COMPRESSED_LPWSTR | VT_VECTOR)] vt_compressed_lpwstr_vec vt_compresseed_lpwstr_v; + + [case(VT_DECIMAL)] vt_decimal vt_decimal; + [case(VT_DECIMAL | VT_VECTOR)] vt_decimal_vec vt_decimal_v; + + [case(VT_CLSID)] GUID vt_clid; + [case(VT_CLSID | VT_VECTOR)] vt_clsid_vec vt_clsid_v; + + [case(VT_BLOB)] DATA_BLOB vt_blob; + [case(VT_BLOB_OBJECT)] DATA_BLOB vt_blob_object; + + [case(VT_NULL)]; + [case(VT_EMPTY)]; + + [case(VT_VARIANT)] vt_variant_wrap vt_variant_wrap; + [case(VT_VARIANT | VT_VECTOR)] vt_variant_wrap_vec vt_variant_wrap_vec; + [case(VT_VARIANT | VT_ARRAY)] vt_variant_wrap_safearray2 vt_variant_wrap_array; + } serialised_types; + + /* MS-WSP 2.2.1.44 SERIALIZEDPROPERTYVALUE */ + typedef [public] struct { + uint32 dwtype; + [switch_is(dwtype)] serialised_types rgb; + } wsp_serializedpropertyvalue; + + /* MS-WSP 2.2.3.16 CPMFetchValueOut */ + typedef [public] struct { + uint32 cbvalue; + uint32 fmoreexists; + uint32 fvalueexists; + /* + * very nearly the same as wsp_cbasestoragevariant, only + * different in how array types are represented, also only + * a portion of the value (serializedpropertyvalue) is here + * + * Additionally if the property doesn't exist (e.g. + * fvalueexists == 0) cbvalue can still have value + * so we can't define the 'vvalue' element below + * + * uint8 value[cbvalue]; + */ + } wsp_cpmfetchvalueout; + + /* MS-WSP 2.2.3.31 CPMSetScopePrioritizationIn */ + typedef [public] struct { + uint32 priority; + uint32 eventfrequency; + } wsp_cpmsetscopeprioritizationin; + + /* MS-WSP 2.2.3.18 CPMSendNotifyOut */ + typedef [public] struct { + uint32 watchnotify; + } wsp_cpmsendnotifyout; + + /* MS-WSP 2.2.3.30 CPMGetRowsetNotifyOut */ + typedef [public] struct { + uint32 wid; + uint8 eventinfo; + uint8 rowitemstate; + uint8 changeditemstate; + uint8 rowsetevent; + dlong rowseteventdata1; + dlong rowseteventdata2; + } wsp_cpmgetrowsetnotifyout; + + /* MS-WSP 2.2.3.34 CPMGetScopeStatisticsOut */ + typedef [public] struct { + uint32 dwindexeditems; + uint32 dwoutstandingadds; + uint32 dwoustandingmodifies; + } wsp_cpmgetscopestatisticsout; + + /* MS-WSP 2.2.3.19 CPMGetApproximatePositionIn */ + typedef [public] struct { + uint32 hcursor; + uint32 chapt; + uint32 bmk; + } wsp_cpmgetapproximatepositionin; + + /* MS-WSP 2.2.3.20 CPMGetApproximatePositionOut */ + typedef [public] struct { + uint32 numerator; + uint32 denominator; + } wsp_cpmgetapproximatepositionout; + + /* MS-WSP 2.2.3.21 CPMCompareBmkIn */ + typedef [public] struct { + uint32 hcursor; + uint32 chapt; + uint32 bmkfirst; + uint32 bmksecond; + } wsp_cpmcomparebmkin; + + /* MS-WSP 2.2.3.22 CPMCompareBmkOut */ + typedef [public] struct { + uint32 dwcomparison; + } wsp_cpmcomparebmkout; + + /* MS-WSP 2.2.3.1 CPMCiStateInOut */ + typedef [public] struct { + uint32 cbstruct; + uint32 cwordlist; + uint32 cpersistentindex; + uint32 cqueries; + uint32 cdocuments; + uint32 cfreshtest; + uint32 dwmergeprogress; + uint32 estate; + uint32 cfiltereddocuments; + uint32 ctotaldocuments; + uint32 cpendingscans; + uint32 dwindexsize; + uint32 cuniquekeys; + uint32 csecqdocuments; + uint32 dwpropcachesize; + } wsp_cpmcistateinout; + + /* MS-WSP 2.2.3.27 CPMFindIndicesIn */ + typedef [public] struct { + uint32 cwids; + uint32 cdepthprev; + uint32 pwids[cwids]; + uint32 prgirowprev[cdepthprev]; + } wsp_findindicesin; + + /* MS-WSP 2.2.3.28 CPMFindIndicesOut */ + typedef [public] struct { + uint32 cdepthnext; + uint32 prgirownext[cdepthnext]; + } wsp_findindicesout; + + typedef [public] struct { + uint32 hcursor; + uint32 chapt; + } wsp_cpmsresetstartpos; + + typedef [public, nodiscriminant, switch_type(uint32)] union { + [case(CPMCONNECT)] wsp_cpmconnectin cpmconnect; + [case(CPMCREATEQUERY)] wsp_cpmcreatequeryin cpmcreatequery; + [case(CPMFREECURSOR)] wsp_cpmfreecursorin cpmfreecursor; + [case(CPMGETROWS)] wsp_cpmgetrowsin cpmgetrows; + [case(CPMSETBINDINGSIN)] wsp_cpmsetbindingsin cpmsetbindings; + [case(CPMRESTARTPOSITIONIN)] wsp_cpmsresetstartpos cpmresetstartpos; + [case(CPMGETQUERYSTATUS)] wsp_cpmgetquerystatusin cpmgetquerystatus; + [case(CPMGETQUERYSTATUSEX)] wsp_cpmgetquerystatusexin cpmgetquerystatusex; + [case(CPMSETSCOPEPRIORITIZATION)] wsp_cpmsetscopeprioritizationin cpmsetscopeprioritizationin; + [case(CPMGETNOTIFY)]; /*header only*/ + [case(CPMGETROWSETNOTIFY)]; /*header only*/ + [case(CPMDISCONNECT)]; /*header only*/ + [case(CPMGETSCOPESTATISTICS)]; /*header only*/ + [case(CPMGETAPPROXIMATEPOSITION)] wsp_cpmgetapproximatepositionin getapproximateposition; + [case(CPMCOMPAREBMK)] wsp_cpmcomparebmkin cpmcomparebmk; + [case(CPMCISTATEOUT)] wsp_cpmcistateinout wsp_cpmcistate; + [case(CPMFINDINDICES)] wsp_findindicesin wsp_findindices; + [case(CPMRATIOFINISHED)] wsp_cpmratiofinishedin wsp_cpmratiofinished; + [case(CPMFETCHVALUE)] wsp_cpmfetchvaluein cpmfetchvalue; + } req_message; + + typedef [public, nodiscriminant, switch_type(uint32)] union { + [case(CPMCONNECT)] wsp_cpmconnectout cpmconnect; + [case(CPMCREATEQUERY)] wsp_cpmcreatequeryout cpmcreatequery; + [case(CPMFREECURSOR)] wsp_cpmfreecursorout cpmfreecursor; + [case(CPMGETROWS)] wsp_cpmgetrowsout cpmgetrows; + [case(CPMSETBINDINGSIN)]; /* just has header */ + [case(CPMRESTARTPOSITIONIN)]; /* just has header */ + [case(CPMGETQUERYSTATUS)] wsp_cpmgetquerystatusout cpmgetquerystatus; + [case(CPMSENDNOTIFYOUT)] wsp_cpmsendnotifyout cpmsendnotifyoutcpmgetquerystatus; + [case(CPMGETQUERYSTATUSEX)] wsp_cpmgetquerystatusexout cpmgetquerystatusex; + [case(CPMSETSCOPEPRIORITIZATION)]; /* just had header */ + [case(CPMGETROWSETNOTIFY)] wsp_cpmgetrowsetnotifyout cpmgetrowsetnotifyout; + [case(CPMGETAPPROXIMATEPOSITION)] wsp_cpmgetapproximatepositionout getapproximateposition; + [case(CPMCOMPAREBMK)] wsp_cpmcomparebmkout cpmcomparebmk; + [case(CPMCISTATEOUT)] wsp_cpmcistateinout wsp_cpmcistate; + [case(CPMFINDINDICES)] wsp_findindicesout wsp_findindices; + [case(CPMGETSCOPESTATISTICS)] wsp_cpmgetscopestatisticsout cpmgetscopestatistics; + [case(CPMRATIOFINISHED)] wsp_cpmratiofinishedout wsp_cpmratiofinished; + [case(CPMFETCHVALUE)] wsp_cpmfetchvalueout cpmfetchvalue; + } resp_message; + + typedef [public] struct { + wsp_header header; + [switch_is(header.msg)] req_message message; + } wsp_request; + + typedef [public] struct { + wsp_header header; + [switch_is(header.msg)] resp_message message; + } wsp_response; +}; + diff --git a/librpc/idl/wsp_data.idl b/librpc/idl/wsp_data.idl new file mode 100644 index 0000000..fde754a --- /dev/null +++ b/librpc/idl/wsp_data.idl @@ -0,0 +1,313 @@ +#include "idl_types.h" +[ + pointer_default(unique) +] + +interface constants +{ + /* + * Use en-us as default locale + * see MS-LCID 'Section 2.2 LCID Structure; + * for details of this and other language id(s) + */ + const uint32_t WSP_DEFAULT_LCID = 0x00000409; + /* + * Max size of rows buffer in getrowsout response + * see MS-WSP 2.2.3.11 + */ + const uint32_t MAX_ROW_BUFF_SIZE = 0x0004000; + + /* values for guidPropertySet */ + const char* DBPROPSET_FSCIFRMWRK_EXT = "A9BD1526-6A80-11D0-8C9D-0020AF1D740E"; + const char* DBPROPSET_QUERYEXT = "A7AC77ED-F8D7-11CE-A798-0020F8008025"; + const char* DBPROPSET_CIFRMWRKCORE_EXT = "AFAFACA5-B5D1-11D0-8C62-00C04FC2DB8D"; + const char* DBPROPSET_MSIDXS_ROWSETEXT = "AA6EE6B0-E828-11D0-B23E-00AA0047FC01"; + + /* Chapter and bookmark handle well known values */ + const uint32_t DB_NULL_HCHAPTER = 0x00000000; + const uint32_t DBBMK_FIRST = 0xFFFFFFFC; + const uint32_t DBBMK_LAST = 0xFFFFFFFD; + /* properties of DBPROPSET_FSCIFRMWRK_EXT propertyset */ + const uint32_t DBPROP_CI_CATALOG_NAME = 0x00000002; + const uint32_t DBPROP_CI_INCLUDE_SCOPES = 0x00000003; + const uint32_t DBPROP_CI_SCOPE_FLAGS = 0x00000004; + const uint32_t DBPROP_CI_QUERY_TYPE = 0x00000007; + const uint32_t DBPROP_GENERICOPTIONS_STRING = 0x00000006; + const uint32_t DBPROP_USECONTENTINDEX = 0x00000002; + const uint32_t DBPROP_IGNORENOISEONLYCLAUSES = 0x00000005; + const uint32_t DBPROP_DEFERCATALOGVERIFICATION = 0x00000008; + const uint32_t DBPROP_IGNORESBRI = 0x0000000E; + const uint32_t DBPROP_GENERATEPARSETREE = 0x0000000A; + const uint32_t DBPROP_FREETEXTANYTERM = 0x0000000C; + const uint32_t DBPROP_FREETEXTUSESTEMMING = 0x0000000D; + + /* properties of DBPROPSET_QUERYEXT propertyset */ + const uint32_t DBPROP_DEFERNONINDEXEDTRIMMING = 0x00000003; + const uint32_t DBPROP_USEEXTENDEDDBTYPES = 0x00000004; + const uint32_t DBPROP_FIRSTROWS = 0x00000007; + const uint32_t DBPROP_ENABLEROWSETEVENTS = 0x00000010; + + /* properties of DBPROPSET_MSIDXS_ROWSETEXT */ + + const uint32_t MSIDXSPROP_ROWSETQUERYSTATUS = 0x02; + const uint32_t MSIDXSPROP_COMMAND_LOCALE_STRING = 0x03; + const uint32_t MSIDXSPROP_QUERY_RESTRICTION = 0x04; + const uint32_t MSIDXSPROP_PARSE_TREE = 0x05; + const uint32_t MSIDXSPROP_MAX_RANK = 0x06; + const uint32_t MSIDXSPROP_RESULTS_FOUND = 0x07; + + /* flags of DBPROP_CI_SCOPE_FLAGS property */ + const uint32_t QUERY_DEEP = 0x01; + const uint32_t QUERY_VIRTUAL_PATH = 0x02; + + /* query type for BPROP_CI_QUERY_TYPE property */ + const uint32_t CINORMAL = 0x00000000; + + /* properties of DBPROPSET_CIFRMWRKCORE_EXT propertyset */ + + const uint32_t DBPROP_MACHINE = 0x00000002; + const uint32_t DBPROP_CLIENT_CLSID = 0x00000003; + + /* + * STAT bit constants + */ + + /* The asynchronous query is still running. */ + const uint32_t STAT_BUSY = 0x00000000; + /* The query is in an error state. */ + const uint32_t STAT_ERROR = 0x00000001; + /* The query is complete and rows can be requested. */ + const uint32_t STAT_DONE = 0x00000002; + /* The query is comp*/ + const uint32_t STAT_REFRESH = 0x00000003; + /* + * Noise words were replaced by wildcard characters in the + * content query. + */ + const uint32_t STAT_NOISE_WORDS = 0x00000010; + /* + * The results of the query might be incorrect because the + * query involved modified but unindexed files. + */ + const uint32_t STAT_CONTENT_OUT_OF_DATE = 0x00000020; + /* + * The content query was too complex to complete or + * required enumeration instead of use of the content index. + */ + const uint32_t STAT_CONTENT_QUERY_INCOMPLETE = 0x00000080; + /* + * The results of the query might be incorrect because the + * query execution reached the maximum allowable time. + */ + const uint32_t STAT_TIME_LIMIT_EXCEEDED = 0x00000100; + + /* + * a const to force an inline array to be evaluated at runtime to + * to get around an incomplete type error + */ + const uint32 SINGLE_ITEM = 1; + + /* WSP message types */ + + /* CPMConnectIn or CPMConnectOut */ + const uint32 CPMCONNECT = 0x000000C8; + /* CPMDisconnect */ + const uint32 CPMDISCONNECT = 0x000000C9; + /* CPMCreateQueryIn or CPMCreateQueryOut */ + const uint32 CPMCREATEQUERY = 0x000000CA; + /* CPMFreeCursorIn or CPMFreeCursorOut */ + const uint32 CPMFREECURSOR = 0x000000CB; + /* CPMGetRowsIn or CPMGetRowsOut */ + const uint32 CPMGETROWS = 0x000000CC; + /* CPMRatioFinishedIn or CPMRatioFinishedOut */ + const uint32 CPMRATIOFINISHED = 0x000000CD; + /* CPMCompareBmkIn or CPMCompareBmkOut */ + const uint32 CPMCOMPAREBMK = 0x000000CE; + /* CPMGetApproximatePositionIn or CPMGetApproximatePositionOut */ + const uint32 CPMGETAPPROXIMATEPOSITION = 0x000000CF; + /* CPMSetBindingsIn */ + const uint32 CPMSETBINDINGSIN = 0x000000D0; + /* CPMGetNotify */ + const uint32 CPMGETNOTIFY = 0x000000D1; + /* CPMSendNotifyOut */ + const uint32 CPMSENDNOTIFYOUT = 0x000000D2; + /* CPMGetQueryStatusIn or CPMGetQueryStatusOut */ + const uint32 CPMGETQUERYSTATUS = 0x000000D7; + /* CPMCiStateInOut */ + const uint32 CPMCISTATEOUT = 0x000000D9; + /* CPMFetchValueIn or CPMFetchValueOut */ + const uint32 CPMFETCHVALUE = 0x000000E4; + /* CPMGetQueryStatusExIn or CPMGetQueryStatusExOut */ + const uint32 CPMGETQUERYSTATUSEX = 0x000000E7; + /* CPMRestartPositionIn */ + const uint32 CPMRESTARTPOSITIONIN = 0x000000E8; + /* CPMSetCatStateIn (not supported) */ + const uint32 CPMSETCATSTATEIN = 0x000000EC; + /* CPMGetRowsetNotifyIn or CPMGetRowsetNotifyOut */ + const uint32 CPMGETROWSETNOTIFY = 0x000000F1; + /* CPMFindIndicesIn, or CPMFindIndicesOut */ + const uint32 CPMFINDINDICES = 0x000000F2; + /* CPMSetScopePrioritizationIn or CPMSetScopePrioritizationOut */ + const uint32 CPMSETSCOPEPRIORITIZATION = 0x000000F3; + /* CPMGetScopeStatisticsIn or CPMGetScopeStatisticsOut */ + const uint32 CPMGETSCOPESTATISTICS = 0x000000F4; + + const uint32 DBKIND_GUID_NAME = 0x00000000; + const uint32 DBKIND_GUID_PROPID = 0x00000001; + const uint32 PRSPEC_LPWSTR = 0x00000000; + const uint32 PRSPEC_PROPID = 0x00000001; + /* type constants for variant types */ + + const uint32 VT_EMPTY = 0x0000; + const uint32 VT_NULL = 0x0001; + const uint32 VT_I2 = 0x0002; + const uint32 VT_I4 = 0x0003; + const uint32 VT_R4 = 0x0004; + const uint32 VT_R8 = 0x0005; + const uint32 VT_CY = 0x0006; + const uint32 VT_DATE = 0x0007; + const uint32 VT_BSTR = 0x0008; + const uint32 VT_I1 = 0x0010; + const uint32 VT_UI1 = 0x0011; + const uint32 VT_UI2 = 0x0012; + const uint32 VT_UI4 = 0x0013; + const uint32 VT_I8 = 0x0014; + const uint32 VT_UI8 = 0x0015; + const uint32 VT_INT = 0x0016; + const uint32 VT_UINT = 0x0017; + const uint32 VT_ERROR = 0x000A; + const uint32 VT_BOOL = 0x000B; + const uint32 VT_VARIANT = 0x000C; + const uint32 VT_DECIMAL = 0x000E; + const uint32 VT_FILETIME = 0x0040; + const uint32 VT_BLOB = 0x0041; + const uint32 VT_BLOB_OBJECT = 0x0046; + const uint32 VT_CLSID = 0x0048; + const uint32 VT_LPSTR = 0x001E; + const uint32 VT_LPWSTR = 0x001F; + const uint32 VT_COMPRESSED_LPWSTR = 0x0023; + const uint32 VT_VECTOR = 0x1000; + const uint32 VT_ARRAY = 0x2000; + + /* restriction types */ + const uint32 RTNONE = 0x00000000; + const uint32 RTAND = 0x00000001; + const uint32 RTOR = 0x00000002; + const uint32 RTNOT = 0x00000003; + const uint32 RTCONTENT = 0x00000004; + const uint32 RTPROPERTY = 0x00000005; + const uint32 RTPROXIMITY = 0x00000006; + const uint32 RTVECTOR = 0x00000007; + const uint32 RTNATLANGUAGE = 0x00000008; + const uint32 RTSCOPE = 0x00000009; + const uint32 RTREUSEWHERE = 0x00000011; + const uint32 RTINTERNALPROP = 0x00FFFFFA; + const uint32 RTPHRASE = 0x00FFFFFD; + const uint32 RTCOERCE_ADD = 0x0000000A; + const uint32 RTCOERCE_MULTIPLY = 0x0000000B; + const uint32 RTCOERCE_ABSOLUTE = 0x0000000C; + const uint32 RTPROB = 0x0000000D; + const uint32 RTFEEDBACK = 0x0000000E; + const uint32 RTRELDOC = 0x0000000F; + + + /* Row seek types */ + const uint32 EROWSEEKNONE = 0x00000000; + const uint32 EROWSEEKNEXT = 0x00000001; + const uint32 EROWSEEKAT = 0x00000002; + const uint32 EROWSEEKATRATIO = 0x00000003; + const uint32 EROWSEEKBYBOOKMARK = 0x00000004; + + const uint32 WINDOWS_7 = 0x00000700; + const uint32 WINDOWS_2008 = 0x00010700; + + /* Relops */ + const uint32 PRLT = 0x00000000; + const uint32 PRLE = 0x00000001; + const uint32 PRGT = 0x00000002; + const uint32 PRGE = 0x00000003; + const uint32 PREQ = 0x00000004; + const uint32 PRNE = 0x00000005; + const uint32 PRRE = 0x00000006; + const uint32 PRALLBITS = 0x00000007; + const uint32 PRSOMEBITS = 0x00000008; + const uint32 PRALL = 0x00000100; + const uint32 PRANY = 0x00000200; + + const uint32 PROPAGATE_NONE = 0; + const uint32 PROPAGATE_ADD = 1; + const uint32 PROPAGATE_DELETE = 2; + const uint32 PROPAGATE_MODIFY = 3; + const uint32 PROPAGATE_ROWSET = 4; + + const uint32 ROWSETEVENT_ITEMSTATE_NOTINROWSET = 0; + const uint32 ROWSETEVENT_ITEMSTATE_INROWSET = 1; + const uint32 ROWSETEVENT_ITEMSTATE_UNKNOWN = 2; + + const uint32 ROWSETEVENT_TYPE_DATAEXPIRED = 0; + const uint32 ROWSETEVENT_TYPE_FOREGROUNDLOST = 1; + const uint32 ROWSETEVENT_TYPE_SCOPESTATISTICS = 2; + + const uint32 DBCOMPARE_LT = 0x00000000; + const uint32 DBCOMPARE_EQ = 0x00000001; + const uint32 DBCOMPARE_GT = 0x00000002; + const uint32 DBCOMPARE_NE = 0x00000003; + const uint32 DBCOMPARE_NOTCOMPARABLE = 0x00000004; + + const uint32 VECTOR_RANK_MIN = 0x00000000; + const uint32 VECTOR_RANK_MAX = 0x00000001; + const uint32 VECTOR_RANK_INNER = 0x00000002; + const uint32 VECTOR_RANK_DICE = 0x00000003; + const uint32 VECTOR_RANK_JACCARD = 0x00000004; + + const uint32 DBAGGTTYPE_BYNONE = 0x00000000; + const uint32 DBAGGTTYPE_SUM = 0x00000001; + const uint32 DBAGGTTYPE_MAX = 0x00000002; + const uint32 DBAGGTTYPE_MIN = 0x00000003; + const uint32 DBAGGTTYPE_AVG = 0x00000004; + const uint32 DBAGGTTYPE_COUNT = 0x00000005; + const uint32 DBAGGTTYPE_CHILDCOUNT = 0x00000006; + const uint32 DBAGGTTYPE_BYFREQ = 0x00000007; + const uint32 DBAGGTTYPE_FIRST = 0x00000008; + const uint32 DBAGGTTYPE_DATERANGE = 0x00000009; + const uint32 DBAGGTTYPE_REPRESENTATIVEOF= 0x0000000a; + const uint32 DBAGGTTYPE_EDITDISTANCE = 0x0000000b; + + const uint32 ESEQUENTIAL = 0x00000001; + const uint32 ELOCATEABLE = 0x00000003; + const uint32 ESCROLLABLE = 0x00000007; + const uint32 EASYNCHRONOUS = 0x00000008; + const uint32 EFIRSTROWS = 0x00000080; + const uint32 EHOLDROWS = 0x00000200; + const uint32 ECHAPTERED = 0x00000800; + const uint32 EUSECI = 0x00001000; + const uint32 EDEFERTRIMMING = 0x00002000; + const uint32 ENABLEROWSETEVENTS = 0x00800000; + const uint32 EDONOTCOMPUTEEXPENSIVEPROPS = 0x00400000; + + const uint32 CI_STATE_SHADOW_MERGE = 0x00000001; + const uint32 CI_STATE_MASTER_MERGE = 0x00000002; + const uint32 CI_STATE_ANNEALING_MERGE = 0x00000008; + const uint32 CI_STATE_SCANNING = 0x00000010; + const uint32 CI_STATE_LOW_MEMORY = 0x00000080; + const uint32 CI_STATE_HIGH_IO = 0x00000100; + const uint32 CI_STATE_MASTER_MERGE_PAUSED = 0x00000200; + const uint32 CI_STATE_READ_ONLY = 0x00000400; + const uint32 CI_STATE_BATTERY_POWER = 0x00000800; + const uint32 CI_STATE_USER_ACTIVE = 0x00001000; + const uint32 CI_STATE_LOW_DISK = 0x00010000; + const uint32 CI_STATE_HIGH_CPU = 0x00020000; + + const uint32 STORESTATUSOK = 0x00000000; + const uint32 STORESTATUSDEFERRED = 0x00000001; + const uint32 STORESTATUSNULL = 0x00000002; + + const uint32 DB_S_ENDOFROWSET = 0x00040EC6; + + const uint32 XOR_CONST = 0x59533959; + const uint32 E_UNEXPECTED = 0x8000FFFF; + const uint32 WIN_UPDATE_ERR = 0x80070003; + + const uint32 QUERY_SORTASCEND = 0x00000000; + const uint32 QUERY_DESCEND = 0x00000001; +} diff --git a/librpc/idl/wzcsvc.idl b/librpc/idl/wzcsvc.idl new file mode 100644 index 0000000..b403c07 --- /dev/null +++ b/librpc/idl/wzcsvc.idl @@ -0,0 +1,31 @@ +/* + wireless configuration service +*/ + +[ + uuid("621dff68-3c39-4c6c-aae3-e68e2c6503ad"), + version(1.0), + helpstring("Wireless Configuration Service") +] +interface wzcsvc +{ + + void wzcsvc_EnumInterfaces(); + void wzcsvc_QueryInterface(); + void wzcsvc_SetInterface(); + void wzcsvc_RefreshInterface(); + void wzcsvc_QueryContext(); + void wzcsvc_SetContext(); + void wzcsvc_EapolUIResponse(); + void wzcsvc_EapolGetCustomAuthData(); + void wzcsvc_EapolSetCustomAuthData(); + void wzcsvc_EapolGetInterfaceParams(); + void wzcsvc_EapolSetInterfaceParams(); + void wzcsvc_EapolReAuthenticateInterface(); + void wzcsvc_EapolQueryInterfaceState(); + void wzcsvc_OpenWZCDbLogSession(); + void wzcsvc_CloseWZCDbLogSession(); + void wzcsvc_EnumWZCDbLogRecords(); + void wzcsvc_FlushWZCdbLog(); + void wzcsvc_GetWZCDbLogRecord(); +} diff --git a/librpc/idl/xattr.idl b/librpc/idl/xattr.idl new file mode 100644 index 0000000..e2f7cb4 --- /dev/null +++ b/librpc/idl/xattr.idl @@ -0,0 +1,239 @@ +#include "idl_types.h" + +/* + IDL structures for xattr file attributes + + this has nothing to do with RPC, we are just using our NDR/IDL + infrastructure as a convenient way to store linearised information + about a file in a architecture independent manner +*/ + +import "security.idl"; + +[ + version(0.0), + helper("../librpc/ndr/ndr_xattr.h"), + pyhelper("librpc/ndr/py_xattr.c"), + pointer_default(unique) +] +interface xattr +{ + const char *XATTR_DOSATTRIB_NAME = "user.DosAttrib"; + const char *XATTR_DOSATTRIB_NAME_S3 = "user.DOSATTRIB"; + const int XATTR_DOSATTRIB_ESTIMATED_SIZE = 64; + + /* we store basic dos attributes in a DosAttrib xattr. By + using a union we can cope with new version of this + structure more easily */ + + /* + * the FFFF level is never really used, + * it's used to pass the information from + * the old hex string attrib information + * we have a handwritten parser which converts + * the hex string to the xattr_DosInfoFFFFCompat structure + */ + + typedef struct { + uint32 attrib; + } xattr_DosInfoFFFFCompat; + + typedef struct { + uint32 attrib; + uint32 ea_size; + udlong size; + udlong alloc_size; + NTTIME create_time; + NTTIME change_time; + } xattr_DosInfo1; + +/* + We use xattrDosInfo1 again when we store values. + Because the sticky write time is now stored in the opendb + and xattr_DosInfo2Old is only present to parse existing + values from disk. + + const int XATTR_ATTRIB_FLAG_STICKY_WRITE_TIME = 0x1; +*/ + typedef struct { + uint32 flags; + uint32 attrib; + uint32 ea_size; + udlong size; + udlong alloc_size; + NTTIME create_time; + NTTIME change_time; + NTTIME write_time; /* only used when sticky write time is set */ + utf8string name; + } xattr_DosInfo2Old; + + typedef [bitmap32bit] bitmap { + XATTR_DOSINFO_ATTRIB = 0x00000001, + XATTR_DOSINFO_EA_SIZE = 0x00000002, + XATTR_DOSINFO_SIZE = 0x00000004, + XATTR_DOSINFO_ALLOC_SIZE = 0x00000008, + XATTR_DOSINFO_CREATE_TIME = 0x00000010, + XATTR_DOSINFO_CHANGE_TIME = 0x00000020, + XATTR_DOSINFO_ITIME = 0x00000040 + } xattr_DosInfoValidFlags; + + typedef struct { + xattr_DosInfoValidFlags valid_flags; + uint32 attrib; + uint32 ea_size; + udlong size; + udlong alloc_size; + NTTIME create_time; + NTTIME change_time; + } xattr_DosInfo3; + + typedef struct { + xattr_DosInfoValidFlags valid_flags; + uint32 attrib; + NTTIME itime; + NTTIME create_time; + } xattr_DosInfo4; + + typedef struct { + xattr_DosInfoValidFlags valid_flags; + uint32 attrib; + NTTIME create_time; + } xattr_DosInfo5; + + typedef [public,switch_type(uint16)] union { + [case(0xFFFF)] xattr_DosInfoFFFFCompat compatinfoFFFF; + [case(1)] xattr_DosInfo1 info1; + [case(2)] xattr_DosInfo2Old oldinfo2; + [case(3)] xattr_DosInfo3 info3; + [case(4)] xattr_DosInfo4 info4; + [case(5)] xattr_DosInfo5 info5; + } xattr_DosInfo; + + typedef [public] struct { + uint16 version; + [switch_is(version)] xattr_DosInfo info; + } xattr_DosAttrib; + + typedef [public,nopush,nopull,noprint] struct { + astring attrib_hex; + uint16 version; + [switch_is(version)] xattr_DosInfo info; + } xattr_DOSATTRIB; + + /* we store DOS style extended attributes in a DosEAs xattr */ + const char *XATTR_DOSEAS_NAME = "user.DosEAs"; + + typedef struct { + utf8string name; + DATA_BLOB value; + } xattr_EA; + + typedef [public] struct { + uint16 num_eas; + [size_is(num_eas)] xattr_EA *eas; + } xattr_DosEAs; + + /* Slightly different version, used by the vfs_xattr_tdb module */ + typedef [public] struct { + uint32 num_eas; + xattr_EA eas[num_eas]; + } tdb_xattrs; + + /* we store stream information in this xattr structure. Then + the streams themselves are stored in + user.DosStream.STREAMNAME or in external files, according + to the flags */ + const char *XATTR_DOSSTREAMS_NAME = "user.DosStreams"; + + const int XATTR_STREAM_FLAG_INTERNAL = 0x00000001; + + /* stream data is stored in attributes with the given prefix */ + const char *XATTR_DOSSTREAM_PREFIX = "user.DosStream."; + + const int XATTR_MAX_STREAM_SIZE = 0x4000; + const int XATTR_MAX_STREAM_SIZE_TDB = 0x100000; + + typedef struct { + uint32 flags; + udlong size; + udlong alloc_size; + utf8string name; + } xattr_DosStream; + + typedef [public] struct { + uint32 num_streams; + [size_is(num_streams)] xattr_DosStream *streams; + } xattr_DosStreams; + + + /* we store the NT ACL a NTACL xattr. It is versioned so we + can later add other acl attribs (such as posix acl mapping) + + we put this xattr in the security namespace to ensure that + only trusted users can write to the ACL + + stored in "security.NTACL" + + Version 1. raw SD stored as Samba4 does it. + Version 2. raw SD + last changed hash so we + can discard if this doesn't match the underlying ACL hash. + */ + + const char *XATTR_NTACL_NAME = "security.NTACL"; + + const int XATTR_SD_HASH_SIZE = 64; + const int XATTR_SD_HASH_TYPE_NONE = 0x0; + const int XATTR_SD_HASH_TYPE_SHA256 = 0x1; + + typedef [public] struct { + security_descriptor *sd; + uint8 hash[16]; + } security_descriptor_hash_v2; /* Hash never used in this version. */ + + typedef [public] struct { + security_descriptor *sd; + uint16 hash_type; + uint8 hash[64]; /* 64 bytes hash. */ + } security_descriptor_hash_v3; + + typedef [public] struct { + security_descriptor *sd; + uint16 hash_type; + uint8 hash[64]; /* 64 bytes hash. */ + utf8string description; /* description of what created + * this hash (to allow + * forensics later, if we have + * a bug in one codepath */ + /* + * "time" is always set to 0. Left here to avoid + * bumping the union versions. Remove in case a v5 is + * necessary. + */ + NTTIME time; + uint8 sys_acl_hash[64]; /* 64 bytes hash. */ + } security_descriptor_hash_v4; + + typedef [switch_type(uint16)] union { + [case(1)] security_descriptor *sd; + [case(2)] security_descriptor_hash_v2 *sd_hs2; + [case(3)] security_descriptor_hash_v3 *sd_hs3; + [case(4)] security_descriptor_hash_v4 *sd_hs4; + } xattr_NTACL_Info; + + typedef [public] struct { + uint16 version; + [switch_is(version)] xattr_NTACL_Info info; + } xattr_NTACL; + + /* + * A wrapper of the common information required to be in the + * hash of the ACL, for the acl_xattr and acl_tdb modules. + */ + [public] typedef struct { + DATA_BLOB acl_as_blob; + uid_t owner; + gid_t group; + mode_t mode; + } xattr_sys_acl_hash_wrapper; + +} |