summaryrefslogtreecommitdiffstats
path: root/private/inc
diff options
context:
space:
mode:
authorAdam <you@example.com>2020-05-17 05:51:50 +0200
committerAdam <you@example.com>2020-05-17 05:51:50 +0200
commite611b132f9b8abe35b362e5870b74bce94a1e58e (patch)
treea5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/inc
downloadNT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip
Diffstat (limited to 'private/inc')
-rw-r--r--private/inc/acd.h156
-rw-r--r--private/inc/afd.h547
-rw-r--r--private/inc/alertmsg.h401
-rw-r--r--private/inc/align.h147
-rw-r--r--private/inc/arpinfo.h49
-rw-r--r--private/inc/byteordr.hxx179
-rw-r--r--private/inc/crypt.h605
-rw-r--r--private/inc/cs4231.h118
-rw-r--r--private/inc/debugfmt.h76
-rw-r--r--private/inc/dfsfsctl.h359
-rw-r--r--private/inc/dhcpapi.h978
-rw-r--r--private/inc/dhcpcapi.h145
-rw-r--r--private/inc/dlcio.h805
-rw-r--r--private/inc/dnsapi.h1227
-rw-r--r--private/inc/error.h464
-rw-r--r--private/inc/fmifs.h403
-rw-r--r--private/inc/hostannc.h374
-rw-r--r--private/inc/icmp.h135
-rw-r--r--private/inc/icmpif.h36
-rw-r--r--private/inc/ipinfo.h151
-rw-r--r--private/inc/ipxfwd.h253
-rw-r--r--private/inc/ipxtfflt.h227
-rw-r--r--private/inc/isltrack.h80
-rw-r--r--private/inc/isnkrnl.h528
-rw-r--r--private/inc/jet.h2395
-rw-r--r--private/inc/jet500.h1807
-rw-r--r--private/inc/llinfo.h90
-rw-r--r--private/inc/logonmsv.h473
-rw-r--r--private/inc/lsaicli.h315
-rw-r--r--private/inc/lsaimp.h27
-rw-r--r--private/inc/lsaisrv.h228
-rw-r--r--private/inc/lsass.h51
-rw-r--r--private/inc/mmcommon.h39
-rw-r--r--private/inc/mpr.h512
-rw-r--r--private/inc/msgtext.h134
-rw-r--r--private/inc/mvaudio.h140
-rw-r--r--private/inc/nb30p.h70
-rw-r--r--private/inc/nbtioctl.h347
-rw-r--r--private/inc/netlogon.h361
-rw-r--r--private/inc/nettypes.h81
-rw-r--r--private/inc/nlrepl.h61
-rw-r--r--private/inc/ntddip.h162
-rw-r--r--private/inc/ntddtcp.h156
-rw-r--r--private/inc/ntddtel.h42
-rw-r--r--private/inc/ntddvdm.h44
-rw-r--r--private/inc/ntrmlsa.h233
-rw-r--r--private/inc/ntrpcp.h132
-rw-r--r--private/inc/ntsamp.h221
-rw-r--r--private/inc/ntspider.h90
-rw-r--r--private/inc/ntstapi.h82
-rw-r--r--private/inc/ofslib.h81
-rw-r--r--private/inc/olechar.h80
-rw-r--r--private/inc/packoff.h34
-rw-r--r--private/inc/packon.h32
-rw-r--r--private/inc/prefix.h63
-rw-r--r--private/inc/propmac.hxx479
-rw-r--r--private/inc/protocol.h180
-rw-r--r--private/inc/rnraddrs.h56
-rw-r--r--private/inc/samimp.h12
-rw-r--r--private/inc/samisrv.h234
-rw-r--r--private/inc/samsrv.h70
-rw-r--r--private/inc/scmso.h29
-rw-r--r--private/inc/seopaque.h191
-rw-r--r--private/inc/seposix.h97
-rw-r--r--private/inc/sertlp.h300
-rw-r--r--private/inc/smb.h3711
-rw-r--r--private/inc/smbgtpt.h915
-rw-r--r--private/inc/smbipx.h64
-rw-r--r--private/inc/smbmacro.h240
-rw-r--r--private/inc/smbtrace.h107
-rw-r--r--private/inc/smbtrans.h976
-rw-r--r--private/inc/smbtrsup.h230
-rw-r--r--private/inc/smbtypes.h371
-rw-r--r--private/inc/sndblst.h150
-rw-r--r--private/inc/sockets/arpa/bootp.h74
-rw-r--r--private/inc/sockets/arpa/ftp.h109
-rw-r--r--private/inc/sockets/arpa/inet.h91
-rw-r--r--private/inc/sockets/arpa/nameser.h298
-rw-r--r--private/inc/sockets/arpa/telnet.h148
-rw-r--r--private/inc/sockets/netdb.h209
-rw-r--r--private/inc/sockets/netinet/in.h433
-rw-r--r--private/inc/sockets/resolv.h156
-rw-r--r--private/inc/sockets/sock_err.h159
-rw-r--r--private/inc/sockets/sys/psxsock.h222
-rw-r--r--private/inc/sockets/sys/socket.h158
-rw-r--r--private/inc/sockets/sys/winsock.h216
-rw-r--r--private/inc/soundcfg.h127
-rw-r--r--private/inc/soundsys.h111
-rw-r--r--private/inc/srvann.h110
-rw-r--r--private/inc/srvfsctl.h629
-rw-r--r--private/inc/status.h219
-rw-r--r--private/inc/svcs.h207
-rw-r--r--private/inc/synth.h72
-rw-r--r--private/inc/sys/poll.h75
-rw-r--r--private/inc/sys/snet/adp_ctrl.h20
-rw-r--r--private/inc/sys/snet/arp_ctrl.h153
-rw-r--r--private/inc/sys/snet/bsd_type.h89
-rw-r--r--private/inc/sys/snet/dl_ctrl.h131
-rw-r--r--private/inc/sys/snet/eth_prot.h253
-rw-r--r--private/inc/sys/snet/inet_var.h485
-rw-r--r--private/inc/sys/snet/ip_ctrl.h253
-rw-r--r--private/inc/sys/snet/ip_proto.h317
-rw-r--r--private/inc/sys/snet/ipdl_pro.h93
-rw-r--r--private/inc/sys/snet/ll_ctrl.h91
-rw-r--r--private/inc/sys/snet/ll_proto.h105
-rw-r--r--private/inc/sys/snet/nbdebug.h41
-rw-r--r--private/inc/sys/snet/nbt_ctrl.h193
-rw-r--r--private/inc/sys/snet/nbt_stat.h129
-rw-r--r--private/inc/sys/snet/nbtuser.h43
-rw-r--r--private/inc/sys/snet/net_stat.h159
-rw-r--r--private/inc/sys/snet/s_socket.h105
-rw-r--r--private/inc/sys/snet/snmp.h132
-rw-r--r--private/inc/sys/snet/stcp_opt.h87
-rw-r--r--private/inc/sys/snet/tcp_ctrl.h78
-rw-r--r--private/inc/sys/snet/tftp.h203
-rw-r--r--private/inc/sys/snet/timer.h41
-rw-r--r--private/inc/sys/snet/udp_ctrl.h77
-rw-r--r--private/inc/sys/snet/uint.h63
-rw-r--r--private/inc/sys/stropts.h236
-rw-r--r--private/inc/sys/uio.h84
-rw-r--r--private/inc/tcpinfo.h186
-rw-r--r--private/inc/tcpsvcs.h87
-rw-r--r--private/inc/tdi.h937
-rw-r--r--private/inc/tdiinfo.h140
-rw-r--r--private/inc/tdikrnl.h1023
-rw-r--r--private/inc/tdistat.h101
-rw-r--r--private/inc/tstr.h299
-rw-r--r--private/inc/uiexport.h138
-rw-r--r--private/inc/unimdmp.h47
-rw-r--r--private/inc/vdm.h354
-rw-r--r--private/inc/wanpub.h627
-rw-r--r--private/inc/winsintf.h981
-rw-r--r--private/inc/wsahelp.h451
-rw-r--r--private/inc/wsasetup.h92
-rw-r--r--private/inc/xactsrv.h44
-rw-r--r--private/inc/xactsrv2.h158
136 files changed, 38587 insertions, 0 deletions
diff --git a/private/inc/acd.h b/private/inc/acd.h
new file mode 100644
index 000000000..edc82813f
--- /dev/null
+++ b/private/inc/acd.h
@@ -0,0 +1,156 @@
+/*++
+
+Copyright (c) 1995 Microsoft Corporation
+
+Module Name:
+
+ rasacd.h
+
+Abstract:
+
+ This header file defines constants and types for accessing the NT
+ Automatic Connection Driver (rasacd.sys).
+
+Author:
+
+ Anthony Discolo (adiscolo) 18-Apr-1995
+
+Revision History:
+
+--*/
+
+#ifndef _RASACD_
+#define _RASACD_
+
+//
+// Device Name - this string is the name of the device. It is the name
+// that should be passed to NtCreateFile when accessing the device.
+//
+#define ACD_DEVICE_NAME L"\\Device\\RasAcd"
+
+//
+// Address type.
+//
+typedef enum {
+ ACD_ADDR_IP, // IP address (128.95.1.4)
+ ACD_ADDR_IPX, // IPX node address ()
+ ACD_ADDR_NB, // NETBIOS name ("server")
+ ACD_ADDR_INET, // Internet hostname ("ftp.microsoft.com")
+ ACD_ADDR_MAX
+} ACD_ADDR_TYPE;
+
+//
+// Generic network address string.
+//
+#define ACD_ADDR_NB_LEN 16 // nb30.h/NCBNAMSZ
+#define ACD_ADDR_IPX_LEN 6 // wsipx.h
+#define ACD_ADDR_INET_LEN 1024 // wininet.h/INTERNET_MAX_PATH_LENGTH
+
+typedef struct _ACD_ADDR {
+ ACD_ADDR_TYPE fType;
+ union {
+ ULONG ulIpaddr; // IP address
+ UCHAR cNode[ACD_ADDR_IPX_LEN]; // IPX address
+ UCHAR cNetbios[ACD_ADDR_NB_LEN]; // NetBios server
+ UCHAR szInet[ACD_ADDR_INET_LEN]; // Internet address
+ };
+} ACD_ADDR, *PACD_ADDR;
+
+//
+// Adapter information.
+//
+// Each transport passes up some identifier
+// of which adapter over which a successful
+// connection was made.
+//
+typedef enum {
+ ACD_ADAPTER_LANA,
+ ACD_ADAPTER_IP,
+ ACD_ADAPTER_NAME,
+ ACD_ADAPTER_MAC
+} ACD_ADAPTER_TYPE;
+
+#define ACD_ADAPTER_NAME_LEN 32
+
+typedef struct _ACD_ADAPTER {
+ enum ACD_ADAPTER_TYPE fType;
+ union {
+ UCHAR bLana; // NetBios LANA
+ ULONG ulIpaddr; // IP address
+ WCHAR szName[ACD_ADAPTER_NAME_LEN]; // for example, "NdisWan4"
+ UCHAR cMac[6]; // IPX mac address
+ };
+} ACD_ADAPTER, *PACD_ADAPTER;
+
+//
+// Connection notification structure.
+//
+// The automatic connection system service
+// posts one of these to the automatic connection
+// driver. The request will be completed and
+// this structure filled in by the driver when a
+// new RAS connection is to be made.
+//
+#define ACD_NOTIFICATION_SUCCESS 0x00000001 // successful connection
+
+typedef struct _ACD_NOTIFICATION {
+ ACD_ADDR addr; // address of connection attempt
+ ULONG ulFlags; // ACD_NOTIFICATION_* flags above
+ ACD_ADAPTER adapter; // adapter identifier
+} ACD_NOTIFICATION, *PACD_NOTIFICATION;
+
+typedef struct _ACD_STATUS {
+ BOOLEAN fSuccess; // success or failure
+ ACD_ADDR addr; // address of connection attempt
+} ACD_STATUS, *PACD_STATUS;
+
+//
+//
+// IOCTL code definitions
+//
+#define FILE_DEVICE_ACD 0x000000f1
+#define _ACD_CTL_CODE(function, method, access) \
+ CTL_CODE(FILE_DEVICE_ACD, function, method, access)
+
+//
+// Set the notification mode for the driver.
+//
+#define IOCTL_ACD_RESET \
+ _ACD_CTL_CODE(0, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+//
+// Set the notification mode for the driver.
+//
+#define IOCTL_ACD_ENABLE \
+ _ACD_CTL_CODE(1, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+//
+// Wait for a connection request notification
+// from the automatic connection driver.
+//
+#define IOCTL_ACD_NOTIFICATION \
+ _ACD_CTL_CODE(2, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+//
+// Inform the automatic connection driver that
+// the connection attempt is progressing.
+//
+#define IOCTL_ACD_KEEPALIVE \
+ _ACD_CTL_CODE(3, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+//
+// Inform the automatic connection driver of
+// the final status of the connection attempt.
+//
+#define IOCTL_ACD_COMPLETION \
+ _ACD_CTL_CODE(4, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+//
+// Generate an automatic connection attempt
+// from user space.
+//
+#define IOCTL_ACD_CONNECT_ADDRESS \
+ _ACD_CTL_CODE(5, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#endif // ifndef _RASACD_
+
diff --git a/private/inc/afd.h b/private/inc/afd.h
new file mode 100644
index 000000000..2838e4595
--- /dev/null
+++ b/private/inc/afd.h
@@ -0,0 +1,547 @@
+/*++
+
+Copyright (c) 1992 Microsoft Corporation
+
+Module Name:
+
+ Afd.h
+
+Abstract:
+
+ Contains structures and declarations for AFD. AFD stands for the
+ Ancillary Function Driver. This driver enhances the functionality
+ of TDI so that it is a sufficiently rich interface to support
+ user-mode sockets and XTI DLLs.
+
+Author:
+
+ David Treadwell (davidtr) 20-Feb-1992
+
+Revision History:
+
+--*/
+
+#ifndef _AFD_
+#define _AFD_
+
+//
+// If WINSOCK2.H has not been included, then just embed the definition
+// of the WSABUF and QOS structures here. This makes building AFD.SYS
+// much easier.
+//
+
+#ifndef _WINSOCK2API_
+typedef struct _WSABUF {
+ ULONG len;
+ PCHAR buf;
+} WSABUF, *LPWSABUF;
+
+typedef enum
+{
+ BestEffortService,
+ ControlledLoadService,
+ PredictiveService,
+ GuaranteedDelayService,
+ GuaranteedService
+} GUARANTEE;
+
+typedef long int32;
+
+typedef struct _flowspec
+{
+ int32 TokenRate; /* In Bytes/sec */
+ int32 TokenBucketSize; /* In Bytes */
+ int32 PeakBandwidth; /* In Bytes/sec */
+ int32 Latency; /* In microseconds */
+ int32 DelayVariation; /* In microseconds */
+ GUARANTEE LevelOfGuarantee; /* Guaranteed, Predictive */
+ /* or Best Effort */
+ int32 CostOfCall; /* Reserved for future use, */
+ /* must be set to 0 now */
+ int32 NetworkAvailability; /* read-only: */
+ /* 1 if accessible, */
+ /* 0 if not */
+} FLOWSPEC, *LPFLOWSPEC;
+
+typedef struct _QualityOfService
+{
+ FLOWSPEC SendingFlowspec; /* the flow spec for data sending */
+ FLOWSPEC ReceivingFlowspec; /* the flow spec for data receiving */
+ WSABUF ProviderSpecific; /* additional provider specific stuff */
+} QOS, *LPQOS;
+#endif
+
+#define AFD_DEVICE_NAME L"\\Device\\Afd"
+
+//
+// Structures used on NtCreateFile() for AFD.
+//
+
+typedef enum _AFD_ENDPOINT_TYPE {
+ AfdEndpointTypeStream,
+ AfdEndpointTypeDatagram,
+ AfdEndpointTypeRaw,
+ AfdEndpointTypeSequencedPacket,
+ AfdEndpointTypeReliableMessage,
+ AfdEndpointTypeUnknown
+} AFD_ENDPOINT_TYPE, *PAFD_ENDPOINT_TYPE;
+
+#define MIN_AFD_ENDPOINT_TYPE AfdEndpointTypeStream
+#define MAX_AFD_ENDPOINT_TYPE AfdEndpointTypeUnknown
+
+typedef struct _AFD_OPEN_PACKET {
+ AFD_ENDPOINT_TYPE EndpointType;
+ LONG GroupID;
+ ULONG TransportDeviceNameLength;
+ WCHAR TransportDeviceName[1];
+} AFD_OPEN_PACKET, *PAFD_OPEN_PACKET;
+
+// *** the XX is to ensure natural alignment of the open packet part
+// of the EA buffer
+
+#define AfdOpenPacket "AfdOpenPacketXX"
+#define AFD_OPEN_PACKET_NAME_LENGTH (sizeof(AfdOpenPacket) - 1)
+
+//
+// The input structure for IOCTL_AFD_START_LISTEN.
+//
+
+typedef struct _AFD_LISTEN_INFO {
+ ULONG MaximumConnectionQueue;
+} AFD_LISTEN_INFO, *PAFD_LISTEN_INFO;
+
+//
+// The output structure for IOCTL_AFD_WAIT_FOR_LISTEN.
+//
+
+typedef struct _AFD_LISTEN_RESPONSE_INFO {
+ ULONG Sequence;
+ TRANSPORT_ADDRESS RemoteAddress;
+} AFD_LISTEN_RESPONSE_INFO, *PAFD_LISTEN_RESPONSE_INFO;
+
+//
+// The input structure for IOCTL_AFD_ACCEPT.
+//
+
+typedef struct _AFD_ACCEPT_INFO {
+ ULONG Sequence;
+ HANDLE AcceptHandle;
+} AFD_ACCEPT_INFO, *PAFD_ACCEPT_INFO;
+
+typedef struct _AFD_SUPER_ACCEPT_INFO {
+ HANDLE AcceptHandle;
+ PVOID AcceptEndpoint;
+ PVOID AcceptFileObject;
+ ULONG ReceiveDataLength;
+ ULONG LocalAddressLength;
+ ULONG RemoteAddressLength;
+ AFD_LISTEN_RESPONSE_INFO ListenResponseInfo;
+} AFD_SUPER_ACCEPT_INFO, *PAFD_SUPER_ACCEPT_INFO;
+
+//
+// The input structure for IOCTL_AFD_DEFER_ACCEPT.
+//
+
+typedef struct _AFD_DEFER_ACCEPT_INFO {
+ ULONG Sequence;
+ BOOLEAN Reject;
+} AFD_DEFER_ACCEPT_INFO, *PAFD_DEFER_ACCEPT_INFO;
+
+//
+// Flags and input structure for IOCTL_AFD_PARTIAL_DISCONNECT.
+//
+
+#define AFD_PARTIAL_DISCONNECT_SEND 0x01
+#define AFD_PARTIAL_DISCONNECT_RECEIVE 0x02
+#define AFD_ABORTIVE_DISCONNECT 0x4
+#define AFD_UNCONNECT_DATAGRAM 0x08
+
+typedef struct _AFD_PARTIAL_DISCONNECT_INFO {
+ ULONG DisconnectMode;
+ LARGE_INTEGER Timeout;
+} AFD_PARTIAL_DISCONNECT_INFO, *PAFD_PARTIAL_DISCONNECT_INFO;
+
+//
+// Structures for IOCTL_AFD_POLL.
+//
+
+typedef struct _AFD_POLL_HANDLE_INFO {
+ HANDLE Handle;
+ ULONG PollEvents;
+ NTSTATUS Status;
+} AFD_POLL_HANDLE_INFO, *PAFD_POLL_HANDLE_INFO;
+
+typedef struct _AFD_POLL_INFO {
+ LARGE_INTEGER Timeout;
+ ULONG NumberOfHandles;
+ BOOLEAN Unique;
+ AFD_POLL_HANDLE_INFO Handles[1];
+} AFD_POLL_INFO, *PAFD_POLL_INFO;
+
+#define AFD_POLL_RECEIVE_BIT 0
+#define AFD_POLL_RECEIVE (1 << AFD_POLL_RECEIVE_BIT)
+#define AFD_POLL_RECEIVE_EXPEDITED_BIT 1
+#define AFD_POLL_RECEIVE_EXPEDITED (1 << AFD_POLL_RECEIVE_EXPEDITED_BIT)
+#define AFD_POLL_SEND_BIT 2
+#define AFD_POLL_SEND (1 << AFD_POLL_SEND_BIT)
+#define AFD_POLL_DISCONNECT_BIT 3
+#define AFD_POLL_DISCONNECT (1 << AFD_POLL_DISCONNECT_BIT)
+#define AFD_POLL_ABORT_BIT 4
+#define AFD_POLL_ABORT (1 << AFD_POLL_ABORT_BIT)
+#define AFD_POLL_LOCAL_CLOSE_BIT 5
+#define AFD_POLL_LOCAL_CLOSE (1 << AFD_POLL_LOCAL_CLOSE_BIT)
+#define AFD_POLL_CONNECT_BIT 6
+#define AFD_POLL_CONNECT (1 << AFD_POLL_CONNECT_BIT)
+#define AFD_POLL_ACCEPT_BIT 7
+#define AFD_POLL_ACCEPT (1 << AFD_POLL_ACCEPT_BIT)
+#define AFD_POLL_CONNECT_FAIL_BIT 8
+#define AFD_POLL_CONNECT_FAIL (1 << AFD_POLL_CONNECT_FAIL_BIT)
+#define AFD_POLL_QOS_BIT 9
+#define AFD_POLL_QOS (1 << AFD_POLL_QOS_BIT)
+#define AFD_POLL_GROUP_QOS_BIT 10
+#define AFD_POLL_GROUP_QOS (1 << AFD_POLL_GROUP_QOS_BIT)
+
+#define AFD_NUM_POLL_EVENTS 11
+#define AFD_POLL_ALL ((1 << AFD_NUM_POLL_EVENTS) - 1)
+
+//
+// Structure for querying receive information.
+//
+
+typedef struct _AFD_RECEIVE_INFORMATION {
+ ULONG BytesAvailable;
+ ULONG ExpeditedBytesAvailable;
+} AFD_RECEIVE_INFORMATION, *PAFD_RECEIVE_INFORMATION;
+
+//
+// Structure for quering the TDI handles for an AFD endpoint.
+//
+
+#define AFD_QUERY_ADDRESS_HANDLE 1
+#define AFD_QUERY_CONNECTION_HANDLE 2
+
+typedef struct _AFD_HANDLE_INFO {
+ HANDLE TdiAddressHandle;
+ HANDLE TdiConnectionHandle;
+} AFD_HANDLE_INFO, *PAFD_HANDLE_INFO;
+
+//
+// Structure and manifests for setting information in AFD.
+//
+
+typedef struct _AFD_INFORMATION {
+ ULONG InformationType;
+ union {
+ BOOLEAN Boolean;
+ ULONG Ulong;
+ LARGE_INTEGER LargeInteger;
+ } Information;
+} AFD_INFORMATION, *PAFD_INFORMATION;
+
+#define AFD_INLINE_MODE 0x01
+#define AFD_NONBLOCKING_MODE 0x02
+#define AFD_MAX_SEND_SIZE 0x03
+#define AFD_SENDS_PENDING 0x04
+#define AFD_MAX_PATH_SEND_SIZE 0x05
+#define AFD_RECEIVE_WINDOW_SIZE 0x06
+#define AFD_SEND_WINDOW_SIZE 0x07
+#define AFD_CONNECT_TIME 0x08
+#define AFD_CIRCULAR_QUEUEING 0x09
+#define AFD_GROUP_ID_AND_TYPE 0x0A
+
+//
+// Structure for the transmit file IOCTL.
+//
+
+typedef struct _AFD_TRANSMIT_FILE_INFO {
+ LARGE_INTEGER Offset;
+ LARGE_INTEGER WriteLength;
+ ULONG SendPacketLength;
+ HANDLE FileHandle;
+ PVOID Head;
+ ULONG HeadLength;
+ PVOID Tail;
+ ULONG TailLength;
+ ULONG Flags;
+} AFD_TRANSMIT_FILE_INFO, *PAFD_TRANSMIT_FILE_INFO;
+
+//
+// Flags for the TransmitFile API.
+//
+
+#define AFD_TF_DISCONNECT 0x01
+#define AFD_TF_REUSE_SOCKET 0x02
+#define AFD_TF_WRITE_BEHIND 0x04
+
+#ifdef NT351
+//
+// Structure for queuing user-mode APCs.
+//
+
+typedef struct _AFD_QUEUE_APC_INFO {
+ HANDLE Thread;
+ PVOID ApcRoutine;
+ PVOID ApcContext;
+ PVOID SystemArgument1;
+ PVOID SystemArgument2;
+} AFD_QUEUE_APC_INFO, *PAFD_QUEUE_APC_INFO;
+#endif // NT351
+
+//
+// Flag definitions for the AfdFlags field in the AFD_SEND_INFO,
+// AFD_SEND_DATAGRAM_INFO, AFD_RECV_INFO, and AFD_RECV_DATAGRAM_INFO
+// structures.
+//
+
+#define AFD_NO_FAST_IO 0x0001 // Always fail Fast IO on this request.
+#define AFD_OVERLAPPED 0x0002 // Overlapped operation.
+
+//
+// Structure for connected sends.
+//
+
+typedef struct _AFD_SEND_INFO {
+ LPWSABUF BufferArray;
+ ULONG BufferCount;
+ ULONG AfdFlags;
+ ULONG TdiFlags;
+} AFD_SEND_INFO, *PAFD_SEND_INFO;
+
+//
+// Structure for unconnected datagram sends.
+//
+
+typedef struct _AFD_SEND_DATAGRAM_INFO {
+ LPWSABUF BufferArray;
+ ULONG BufferCount;
+ ULONG AfdFlags;
+ TDI_REQUEST_SEND_DATAGRAM TdiRequest;
+ TDI_CONNECTION_INFORMATION TdiConnInfo;
+} AFD_SEND_DATAGRAM_INFO, *PAFD_SEND_DATAGRAM_INFO;
+
+//
+// Structure for connected recvs.
+//
+
+typedef struct _AFD_RECV_INFO {
+ LPWSABUF BufferArray;
+ ULONG BufferCount;
+ ULONG AfdFlags;
+ ULONG TdiFlags;
+} AFD_RECV_INFO, *PAFD_RECV_INFO;
+
+//
+// Structure for receiving datagrams on unconnected sockets.
+//
+
+typedef struct _AFD_RECV_DATAGRAM_INFO {
+ LPWSABUF BufferArray;
+ ULONG BufferCount;
+ ULONG AfdFlags;
+ ULONG TdiFlags;
+ PVOID Address;
+ PULONG AddressLength;
+} AFD_RECV_DATAGRAM_INFO, *PAFD_RECV_DATAGRAM_INFO;
+
+#define AFD_MAX_TDI_FAST_ADDRESS 32
+
+//
+// Structure for event select.
+//
+
+typedef struct _AFD_EVENT_SELECT_INFO {
+ HANDLE Event;
+ ULONG PollEvents;
+} AFD_EVENT_SELECT_INFO, *PAFD_EVENT_SELECT_INFO;
+
+//
+// Structure for enum network events.
+//
+
+typedef struct _AFD_ENUM_NETWORK_EVENTS_INFO {
+ HANDLE Event;
+ ULONG PollEvents;
+ NTSTATUS EventStatus[AFD_NUM_POLL_EVENTS];
+} AFD_ENUM_NETWORK_EVENTS_INFO, *PAFD_ENUM_NETWORK_EVENTS_INFO;
+
+//
+// Structures for QOS and grouping.
+//
+
+typedef struct _AFD_QOS_INFO {
+ QOS Qos;
+ BOOLEAN GroupQos;
+} AFD_QOS_INFO, *PAFD_QOS_INFO;
+
+//
+// Group membership type.
+//
+
+typedef enum _AFD_GROUP_TYPE {
+ GroupTypeNeither = 0,
+ GroupTypeConstrained = SG_CONSTRAINED_GROUP,
+ GroupTypeUnconstrained = SG_UNCONSTRAINED_GROUP
+} AFD_GROUP_TYPE, *PAFD_GROUP_TYPE;
+
+//
+// Note that, for totally slimy reasons, the following
+// structure must be exactly eight bytes long (the size
+// of a LARGE_INTEGER). See msafd\socket.c and afd\misc.c
+// for the gory details.
+//
+
+typedef struct _AFD_GROUP_INFO {
+ LONG GroupID;
+ AFD_GROUP_TYPE GroupType;
+} AFD_GROUP_INFO, *PAFD_GROUP_INFO;
+
+//
+// Structure for validating group membership.
+//
+
+typedef struct _AFD_VALIDATE_GROUP_INFO {
+ LONG GroupID;
+ TRANSPORT_ADDRESS RemoteAddress;
+} AFD_VALIDATE_GROUP_INFO, *PAFD_VALIDATE_GROUP_INFO;
+
+//
+// Structure for querying connect data on an unaccepted connection.
+//
+
+typedef struct _AFD_UNACCEPTED_CONNECT_DATA_INFO {
+ ULONG Sequence;
+ ULONG ConnectDataLength;
+ BOOLEAN LengthOnly;
+
+} AFD_UNACCEPTED_CONNECT_DATA_INFO, *PAFD_UNACCEPTED_CONNECT_DATA_INFO;
+
+//
+// AFD IOCTL code definitions.
+//
+// N.B. To ensure the efficient of the code generated by AFD's
+// IOCTL dispatcher, these IOCTL codes should be contiguous
+// (no gaps).
+//
+// N.B. If new IOCTLs are added here, update the lookup table in
+// ntos\afd\dispatch.c!
+//
+
+#define FSCTL_AFD_BASE FILE_DEVICE_NETWORK
+#define _AFD_CONTROL_CODE(request,method) \
+ ((FSCTL_AFD_BASE)<<12 | (request<<2) | method)
+#define _AFD_REQUEST(ioctl) \
+ ((((ULONG)(ioctl)) >> 2) & 0x03FF)
+#define _AFD_BASE(ioctl) \
+ ((((ULONG)(ioctl)) >> 12) & 0xFFFFF)
+
+#define AFD_BIND 0
+#define AFD_CONNECT 1
+#define AFD_START_LISTEN 2
+#define AFD_WAIT_FOR_LISTEN 3
+#define AFD_ACCEPT 4
+#define AFD_RECEIVE 5
+#define AFD_RECEIVE_DATAGRAM 6
+#define AFD_SEND 7
+#define AFD_SEND_DATAGRAM 8
+#define AFD_POLL 9
+#define AFD_PARTIAL_DISCONNECT 10
+
+#define AFD_GET_ADDRESS 11
+#define AFD_QUERY_RECEIVE_INFO 12
+#define AFD_QUERY_HANDLES 13
+#define AFD_SET_INFORMATION 14
+#define AFD_GET_CONTEXT_LENGTH 15
+#define AFD_GET_CONTEXT 16
+#define AFD_SET_CONTEXT 17
+
+#define AFD_SET_CONNECT_DATA 18
+#define AFD_SET_CONNECT_OPTIONS 19
+#define AFD_SET_DISCONNECT_DATA 20
+#define AFD_SET_DISCONNECT_OPTIONS 21
+
+#define AFD_GET_CONNECT_DATA 22
+#define AFD_GET_CONNECT_OPTIONS 23
+#define AFD_GET_DISCONNECT_DATA 24
+#define AFD_GET_DISCONNECT_OPTIONS 25
+
+#define AFD_SIZE_CONNECT_DATA 26
+#define AFD_SIZE_CONNECT_OPTIONS 27
+#define AFD_SIZE_DISCONNECT_DATA 28
+#define AFD_SIZE_DISCONNECT_OPTIONS 29
+
+#define AFD_GET_INFORMATION 30
+#define AFD_TRANSMIT_FILE 31
+#define AFD_SUPER_ACCEPT 32
+
+#define AFD_EVENT_SELECT 33
+#define AFD_ENUM_NETWORK_EVENTS 34
+
+#define AFD_DEFER_ACCEPT 35
+#define AFD_WAIT_FOR_LISTEN_LIFO 36
+#define AFD_SET_QOS 37
+#define AFD_GET_QOS 38
+#define AFD_NO_OPERATION 39
+#define AFD_VALIDATE_GROUP 40
+#define AFD_GET_UNACCEPTED_CONNECT_DATA 41
+
+#ifdef NT351
+#define AFD_QUEUE_APC 42
+#endif // NT351
+
+
+#define IOCTL_AFD_BIND _AFD_CONTROL_CODE( AFD_BIND, METHOD_BUFFERED )
+#define IOCTL_AFD_CONNECT _AFD_CONTROL_CODE( AFD_CONNECT, METHOD_BUFFERED )
+#define IOCTL_AFD_START_LISTEN _AFD_CONTROL_CODE( AFD_START_LISTEN, METHOD_BUFFERED )
+#define IOCTL_AFD_WAIT_FOR_LISTEN _AFD_CONTROL_CODE( AFD_WAIT_FOR_LISTEN, METHOD_BUFFERED )
+#define IOCTL_AFD_ACCEPT _AFD_CONTROL_CODE( AFD_ACCEPT, METHOD_BUFFERED )
+#define IOCTL_AFD_RECEIVE _AFD_CONTROL_CODE( AFD_RECEIVE, METHOD_NEITHER )
+#define IOCTL_AFD_RECEIVE_DATAGRAM _AFD_CONTROL_CODE( AFD_RECEIVE_DATAGRAM, METHOD_NEITHER )
+#define IOCTL_AFD_SEND _AFD_CONTROL_CODE( AFD_SEND, METHOD_NEITHER )
+#define IOCTL_AFD_SEND_DATAGRAM _AFD_CONTROL_CODE( AFD_SEND_DATAGRAM, METHOD_NEITHER )
+#define IOCTL_AFD_POLL _AFD_CONTROL_CODE( AFD_POLL, METHOD_BUFFERED )
+#define IOCTL_AFD_PARTIAL_DISCONNECT _AFD_CONTROL_CODE( AFD_PARTIAL_DISCONNECT, METHOD_BUFFERED )
+
+#define IOCTL_AFD_GET_ADDRESS _AFD_CONTROL_CODE( AFD_GET_ADDRESS, METHOD_OUT_DIRECT )
+#define IOCTL_AFD_QUERY_RECEIVE_INFO _AFD_CONTROL_CODE( AFD_QUERY_RECEIVE_INFO, METHOD_BUFFERED )
+#define IOCTL_AFD_QUERY_HANDLES _AFD_CONTROL_CODE( AFD_QUERY_HANDLES, METHOD_BUFFERED )
+#define IOCTL_AFD_SET_INFORMATION _AFD_CONTROL_CODE( AFD_SET_INFORMATION, METHOD_BUFFERED )
+#define IOCTL_AFD_GET_CONTEXT_LENGTH _AFD_CONTROL_CODE( AFD_GET_CONTEXT_LENGTH, METHOD_BUFFERED )
+#define IOCTL_AFD_GET_CONTEXT _AFD_CONTROL_CODE( AFD_GET_CONTEXT, METHOD_BUFFERED )
+#define IOCTL_AFD_SET_CONTEXT _AFD_CONTROL_CODE( AFD_SET_CONTEXT, METHOD_BUFFERED )
+
+#define IOCTL_AFD_SET_CONNECT_DATA _AFD_CONTROL_CODE( AFD_SET_CONNECT_DATA, METHOD_BUFFERED )
+#define IOCTL_AFD_SET_CONNECT_OPTIONS _AFD_CONTROL_CODE( AFD_SET_CONNECT_OPTIONS, METHOD_BUFFERED )
+#define IOCTL_AFD_SET_DISCONNECT_DATA _AFD_CONTROL_CODE( AFD_SET_DISCONNECT_DATA, METHOD_BUFFERED )
+#define IOCTL_AFD_SET_DISCONNECT_OPTIONS _AFD_CONTROL_CODE( AFD_SET_DISCONNECT_OPTIONS, METHOD_BUFFERED )
+
+#define IOCTL_AFD_GET_CONNECT_DATA _AFD_CONTROL_CODE( AFD_GET_CONNECT_DATA, METHOD_BUFFERED )
+#define IOCTL_AFD_GET_CONNECT_OPTIONS _AFD_CONTROL_CODE( AFD_GET_CONNECT_OPTIONS, METHOD_BUFFERED )
+#define IOCTL_AFD_GET_DISCONNECT_DATA _AFD_CONTROL_CODE( AFD_GET_DISCONNECT_DATA, METHOD_BUFFERED )
+#define IOCTL_AFD_GET_DISCONNECT_OPTIONS _AFD_CONTROL_CODE( AFD_GET_DISCONNECT_OPTIONS, METHOD_BUFFERED )
+
+#define IOCTL_AFD_SIZE_CONNECT_DATA _AFD_CONTROL_CODE( AFD_SIZE_CONNECT_DATA, METHOD_BUFFERED )
+#define IOCTL_AFD_SIZE_CONNECT_OPTIONS _AFD_CONTROL_CODE( AFD_SIZE_CONNECT_OPTIONS, METHOD_BUFFERED )
+#define IOCTL_AFD_SIZE_DISCONNECT_DATA _AFD_CONTROL_CODE( AFD_SIZE_DISCONNECT_DATA, METHOD_BUFFERED )
+#define IOCTL_AFD_SIZE_DISCONNECT_OPTIONS _AFD_CONTROL_CODE( AFD_SIZE_DISCONNECT_OPTIONS, METHOD_BUFFERED )
+
+#define IOCTL_AFD_GET_INFORMATION _AFD_CONTROL_CODE( AFD_GET_INFORMATION, METHOD_BUFFERED )
+#define IOCTL_AFD_TRANSMIT_FILE _AFD_CONTROL_CODE( AFD_TRANSMIT_FILE, METHOD_NEITHER )
+#define IOCTL_AFD_SUPER_ACCEPT _AFD_CONTROL_CODE( AFD_SUPER_ACCEPT, METHOD_OUT_DIRECT )
+
+#define IOCTL_AFD_EVENT_SELECT _AFD_CONTROL_CODE( AFD_EVENT_SELECT, METHOD_BUFFERED )
+#define IOCTL_AFD_ENUM_NETWORK_EVENTS _AFD_CONTROL_CODE( AFD_ENUM_NETWORK_EVENTS, METHOD_BUFFERED )
+
+#define IOCTL_AFD_DEFER_ACCEPT _AFD_CONTROL_CODE( AFD_DEFER_ACCEPT, METHOD_BUFFERED )
+#define IOCTL_AFD_WAIT_FOR_LISTEN_LIFO _AFD_CONTROL_CODE( AFD_WAIT_FOR_LISTEN_LIFO, METHOD_BUFFERED )
+#define IOCTL_AFD_SET_QOS _AFD_CONTROL_CODE( AFD_SET_QOS, METHOD_BUFFERED )
+#define IOCTL_AFD_GET_QOS _AFD_CONTROL_CODE( AFD_GET_QOS, METHOD_BUFFERED )
+#define IOCTL_AFD_NO_OPERATION _AFD_CONTROL_CODE( AFD_NO_OPERATION, METHOD_NEITHER )
+#define IOCTL_AFD_VALIDATE_GROUP _AFD_CONTROL_CODE( AFD_VALIDATE_GROUP, METHOD_BUFFERED )
+#define IOCTL_AFD_GET_UNACCEPTED_CONNECT_DATA _AFD_CONTROL_CODE( AFD_GET_UNACCEPTED_CONNECT_DATA, METHOD_BUFFERED )
+
+#ifdef NT351
+#define IOCTL_AFD_QUEUE_APC _AFD_CONTROL_CODE( AFD_QUEUE_APC, METHOD_BUFFERED )
+#endif // NT351
+
+#endif // ndef _AFD_
+
diff --git a/private/inc/alertmsg.h b/private/inc/alertmsg.h
new file mode 100644
index 000000000..bb7fd926a
--- /dev/null
+++ b/private/inc/alertmsg.h
@@ -0,0 +1,401 @@
+/*++ BUILD Version: 0001 // Increment this if a change has global effects
+
+Copyright (c) 1991-1993 Microsoft Corporation
+
+Module Name:
+
+ alertmsg.h
+
+
+Abstract:
+
+ This file contains the number and text of alert messages.
+
+Author:
+
+ Ported LAN Manager 2.0
+
+[Environment:]
+
+ User Mode - Win32
+
+[Notes:]
+
+ This file is included by lmalert.h
+
+Revision History:
+
+ 22-July-1991 ritaw
+ Converted to NT style.
+--*/
+
+#ifndef _ALERTMSG_
+#define _ALERTMSG_
+
+
+//
+// ALERT_BASE is the base of alert log codes.
+//
+
+#define ALERT_BASE 3000
+
+// Entries between 3000-3050 are full. So, we created ALERT2_BASE
+// for future expansion.
+//
+
+
+#define ALERT_Disk_Full (ALERT_BASE + 0)
+ /*
+ * Drive %1 is nearly full. %2 bytes are available.
+ * Please warn users and delete unneeded files.
+ */
+
+#define ALERT_ErrorLog (ALERT_BASE + 1)
+ /*
+ * %1 errors were logged in the last %2 minutes.
+ * Please review the server's error log.
+ */
+
+#define ALERT_NetIO (ALERT_BASE + 2)
+ /*
+ * %1 network errors occurred in the last %2 minutes.
+ * Please review the server's error log. The server and/or
+ * network hardware may need service.
+ */
+
+#define ALERT_Logon (ALERT_BASE + 3)
+ /*
+ * There were %1 bad password attempts in the last %2 minutes.
+ * Please review the server's audit trail.
+ */
+
+#define ALERT_Access (ALERT_BASE + 4)
+ /*
+ * There were %1 access-denied errors in the last %2 minutes.
+ * Please review the server's audit trail.
+ */
+
+#define ALERT_ErrorLogFull (ALERT_BASE + 6)
+ /*
+ * The error log is full. No errors will be logged until
+ * the file is cleared or the limit is raised.
+ */
+
+#define ALERT_ErrorLogFull_W (ALERT_BASE + 7)
+ /*
+ * The error log is 80% full.
+ */
+
+#define ALERT_AuditLogFull (ALERT_BASE + 8)
+ /*
+ * The audit log is full. No audit entries will be logged
+ * until the file is cleared or the limit is raised.
+ */
+
+#define ALERT_AuditLogFull_W (ALERT_BASE + 9)
+ /*
+ * The audit log is 80% full.
+ */
+
+#define ALERT_CloseBehindError (ALERT_BASE + 10)
+ /*
+ * An error occurred closing file %1.
+ * Please check the file to make sure it is not corrupted.
+ */
+
+#define ALERT_AdminClose (ALERT_BASE + 11)
+ /*
+ * The administrator has closed %1.
+ */
+
+#define ALERT_AccessShareSec (ALERT_BASE + 12)
+ /*
+ * There were %1 access-denied errors in the last %2 minutes.
+ */
+
+#define ALERT_PowerOut (ALERT_BASE + 20)
+ /*
+ * A power failure was detected at %1. The server has been paused.
+ */
+
+#define ALERT_PowerBack (ALERT_BASE + 21)
+ /*
+ * Power has been restored at %1. The server is no longer paused.
+ */
+
+#define ALERT_PowerShutdown (ALERT_BASE + 22)
+ /*
+ * The UPS service is starting shut down at %1 due to low battery.
+ */
+
+#define ALERT_CmdFileConfig (ALERT_BASE + 23)
+ /*
+ * There is a problem with a configuration of user specified
+ * shut down command file. The UPS service started anyway.
+ */
+
+#define ALERT_HotFix (ALERT_BASE + 25)
+ /*
+ * A defective sector on drive %1 has been replaced (hotfixed).
+ * No data was lost. You should run CHKDSK soon to restore full
+ * performance and replenish the volume's spare sector pool.
+ *
+ * The hotfix occurred while processing a remote request.
+ */
+
+#define ALERT_HardErr_Server (ALERT_BASE + 26)
+ /*
+ * A disk error occurred on the HPFS volume in drive %1.
+ * The error occurred while processing a remote request.
+ */
+
+#define ALERT_LocalSecFail1 (ALERT_BASE + 27)
+ /*
+ * The user accounts database (NET.ACC) is corrupted. The local security
+ * system is replacing the corrupted NET.ACC with the backup
+ * made on %1 at %2.
+ * Any updates made to the database after this time are lost.
+ *
+ */
+
+#define ALERT_LocalSecFail2 (ALERT_BASE + 28)
+ /*
+ * The user accounts database (NET.ACC) is missing. The local
+ * security system is restoring the backup database
+ * made on %1 at %2.
+ * Any updates made to the database after this time are lost.
+ *
+ */
+
+#define ALERT_LocalSecFail3 (ALERT_BASE + 29)
+ /*
+ * Local security could not be started because the user accounts database
+ * (NET.ACC) was missing or corrupted, and no usable backup
+ * database was present.
+ *
+ * THE SYSTEM IS NOT SECURE.
+ *
+ */
+
+
+#define ALERT_ReplCannotMasterDir (ALERT_BASE + 30)
+ /*
+ *The server cannot export directory %1, to client %2.
+ * It is exported from another server.
+ */
+
+#define ALERT_ReplUpdateError (ALERT_BASE + 31)
+ /*
+ * The replication server could not update directory %2 from the source
+ * on %3 due to error %1.
+ */
+
+#define ALERT_ReplLostMaster (ALERT_BASE + 32)
+ /*
+ * Master %1 did not send an update notice for directory %2 at the expected
+ * time.
+ */
+
+#define ALERT_AcctLimitExceeded (ALERT_BASE + 33)
+ /*
+ * User %1 has exceeded account limitation %2 on server %3.
+ */
+
+#define ALERT_NetlogonFailedPrimary (ALERT_BASE + 34)
+ /*
+ * The primary domain controller for domain %1 failed.
+ */
+
+#define ALERT_NetlogonAuthDCFail (ALERT_BASE + 35)
+ /*
+ * Failed to authenticate with %2, a Windows NT Domain Controller for
+ * domain %1.
+ */
+
+#define ALERT_ReplLogonFailed (ALERT_BASE + 36)
+ /*
+ * The replicator attempted to log on at %2 as %1 and failed.
+ */
+
+#define ALERT_Logon_Limit (ALERT_BASE + 37)
+ /* @I *LOGON HOURS %0 */
+
+#define ALERT_ReplAccessDenied (ALERT_BASE + 38)
+ /*
+ * Replicator could not access %2
+ * on %3 due to system error %1.
+ */
+
+#define ALERT_ReplMaxFiles (ALERT_BASE + 39)
+ /*
+ * Replicator limit for files in a directory has been exceeded.
+ */
+
+#define ALERT_ReplMaxTreeDepth (ALERT_BASE + 40)
+ /*
+ * Replicator limit for tree depth has been exceeded.
+ */
+
+#define ALERT_ReplUserCurDir (ALERT_BASE + 41)
+ /*
+ * The replicator cannot update directory %1. It has tree integrity
+ * and is the current directory for some process.
+ */
+
+#define ALERT_ReplNetErr (ALERT_BASE + 42)
+ /*
+ * Network error %1 occurred.
+ */
+
+#define ALERT_ReplSysErr (ALERT_BASE + 45)
+ /*
+ * System error %1 occurred.
+ */
+
+#define ALERT_ReplUserLoged (ALERT_BASE + 46)
+ /*
+ * Cannot log on. User is currently logged on and argument TRYUSER
+ * is set to NO.
+ */
+
+#define ALERT_ReplBadImport (ALERT_BASE + 47)
+ /*
+ * IMPORT path %1 cannot be found.
+ */
+
+#define ALERT_ReplBadExport (ALERT_BASE + 48)
+ /*
+ * EXPORT path %1 cannot be found.
+ */
+
+#define ALERT_ReplDataChanged (ALERT_BASE + 49)
+ /*
+ * Replicated data has changed in directory %1.
+ */
+
+#define ALERT_ReplSignalFileErr (ALERT_BASE + 50)
+ /*
+ * Replicator failed to update signal file in directory %2 due to
+ * %1 system error.
+ */
+
+//
+// IMPORTANT - (ALERT_BASE + 50) is equal to SERVICE_BASE.
+// Do not add any errors beyond this point!!!
+//
+//
+
+#define ALERT2_BASE 5500
+
+#define ALERT_UpdateLogWarn (ALERT2_BASE + 0)
+ /*
+ * The update log on %1 is over 80% capacity. The primary
+ * domain controller %2 is not retrieving the updates.
+ */
+
+#define ALERT_UpdateLogFull (ALERT2_BASE + 1)
+ /*
+ * The update log on %1 is full, and no further updates
+ * can be added until the primary domain controller %2
+ * retrieves the updates.
+ */
+
+
+#define ALERT_NetlogonTimeDifference (ALERT2_BASE + 2)
+ /*
+ * The time difference with the primary domain controller %1
+ * exceeds the maximum allowed skew of %2 seconds.
+ */
+
+#define ALERT_AccountLockout (ALERT2_BASE + 3)
+ /*
+ * The account of user %1 has been locked out on %2
+ * due to %3 bad password attempts.
+ */
+
+#define ALERT_ELF_LogFileNotOpened (ALERT2_BASE + 4)
+ /*
+ * The %1 log file cannot be opened.
+ */
+
+#define ALERT_ELF_LogFileCorrupt (ALERT2_BASE + 5)
+ /*
+ * The %1 log file is corrupted and will be cleared.
+ */
+
+#define ALERT_ELF_DefaultLogCorrupt (ALERT2_BASE + 6)
+ /*
+ * The Application log file could not be opened. %1 will be used as the
+ * default log file.
+ */
+
+#define ALERT_ELF_LogOverflow (ALERT2_BASE + 7)
+ /*
+ * The %1 log file is full.
+ */
+
+#define ALERT_NetlogonFullSync (ALERT2_BASE + 8)
+ /*
+ * The security database full synchronization has been initiated by the server %1.
+ */
+
+#define ALERT_SC_IsLastKnownGood (ALERT2_BASE + 9)
+ /*
+ * Windows NT could not be started as configured.
+ * A previous working configuration was used instead.
+ */
+
+#define ALERT_UnhandledException (ALERT2_BASE + 10)
+ /*
+ * The exception 0x%1 occurred in the application %2 at location 0x%3.
+ */
+
+#define ALERT_NetLogonMismatchSIDInMsg (ALERT2_BASE + 11)
+ /*
+ * The servers %1 and %3 both claim to be an NT Domain Controller for
+ * the %2 domain. One of the servers should be removed from the
+ * domain because the servers have different security identifiers
+ * (SID).
+ */
+
+
+#define ALERT_NetLogonDuplicatePDC (ALERT2_BASE + 12)
+ /*
+ * The server %1 and %2 both claim to be the primary domain
+ * controller for the %3 domain. One of the servers should be
+ * demoted or removed from the domain.
+ */
+
+#define ALERT_NetLogonUntrustedClient (ALERT2_BASE + 13)
+ /*
+ * The computer %1 tried to connect to the server %2 using
+ * the trust relationship established by the %3 domain. However, the
+ * computer lost the correct security identifier (SID)
+ * when the domain was reconfigured. Reestablish the trust
+ * relationship.
+ */
+
+#define ALERT_BugCheck (ALERT2_BASE + 14)
+ /*
+ * The computer has rebooted from a bugcheck. The bugcheck was:
+ * %1.
+ * %2
+ * A full dump was not saved.
+ */
+
+#define ALERT_BugCheckSaved (ALERT2_BASE + 15)
+ /*
+ * The computer has rebooted from a bugcheck. The bugcheck was:
+ * %1.
+ * %2
+ * A dump was saved in: %3.
+ */
+
+#define ALERT_NetLogonSidConflict (ALERT2_BASE + 16)
+ /*
+ * The computer or domain %1 trusts domain %2. (This may be an indirect
+ * trust.) However, %1 and %2 have the same machine security identifier
+ * (SID). NT should be re-installed on either %1 or %2.
+ */
+
+#endif // ifdef _ALERTMSG_
diff --git a/private/inc/align.h b/private/inc/align.h
new file mode 100644
index 000000000..3a320acf7
--- /dev/null
+++ b/private/inc/align.h
@@ -0,0 +1,147 @@
+/*++
+
+Copyright (c) 1988-1992 Microsoft Corporation
+
+Module Name:
+
+ Align.h
+
+Abstract:
+
+ BUGBUG
+
+Author:
+
+ John Rogers (JohnRo) 15-May-1991
+
+Environment:
+
+ This code assumes that sizeof(DWORD) >= sizeof(LPVOID).
+
+Revision History:
+
+ 15-May-1991 JohnRo
+ Created align.h for NT/LAN from OS/2 1.2 HPFS pbmacros.h.
+ 19-Jun-1991 JohnRo
+ Make sure pointer-to-wider-then-byte doesn't get messed up.
+ 10-Jul-1991 JohnRo
+ Added ALIGN_BYTE and ALIGN_CHAR for completeness.
+ 21-Aug-1991 CliffV
+ Fix ROUND_DOWN_* to include ~
+ 03-Dec-1991 JohnRo
+ Worst-case on MIPS is 8-byte alignment.
+ Added COUNT_IS_ALIGNED() and POINTER_IS_ALIGNED() macros.
+ 26-Jun-1992 JohnRo
+ RAID 9933: ALIGN_WORST should be 8 for x86 builds.
+
+--*/
+
+#ifndef _ALIGN_
+#define _ALIGN_
+
+
+// BOOL
+// COUNT_IS_ALIGNED(
+// IN DWORD Count,
+// IN DWORD Pow2 // undefined if this isn't a power of 2.
+// );
+//
+#define COUNT_IS_ALIGNED(Count,Pow2) \
+ ( ( ( (Count) & (((Pow2)-1)) ) == 0) ? TRUE : FALSE )
+
+// BOOL
+// POINTER_IS_ALIGNED(
+// IN LPVOID Ptr,
+// IN DWORD Pow2 // undefined if this isn't a power of 2.
+// );
+//
+#define POINTER_IS_ALIGNED(Ptr,Pow2) \
+ ( ( ( ((DWORD)(Ptr)) & (((Pow2)-1)) ) == 0) ? TRUE : FALSE )
+
+
+#define ROUND_DOWN_COUNT(Count,Pow2) \
+ ( (Count) & (~((Pow2)-1)) )
+
+#define ROUND_DOWN_POINTER(Ptr,Pow2) \
+ ( (LPVOID) ROUND_DOWN_COUNT( ((DWORD)(Ptr)), (Pow2) ) )
+
+
+// If Count is not already aligned, then
+// round Count up to an even multiple of "Pow2". "Pow2" must be a power of 2.
+//
+// DWORD
+// ROUND_UP_COUNT(
+// IN DWORD Count,
+// IN DWORD Pow2
+// );
+#define ROUND_UP_COUNT(Count,Pow2) \
+ ( ((Count)+(Pow2)-1) & (~((Pow2)-1)) )
+
+// LPVOID
+// ROUND_UP_POINTER(
+// IN LPVOID Ptr,
+// IN DWORD Pow2
+// );
+
+// If Ptr is not already aligned, then round it up until it is.
+#define ROUND_UP_POINTER(Ptr,Pow2) \
+ ( (LPVOID) ( (((DWORD)(Ptr))+(Pow2)-1) & (~((Pow2)-1)) ) )
+
+
+// Usage: myPtr = ROUND_UP_POINTER(unalignedPtr, ALIGN_DWORD);
+
+
+#if defined(_X86_)
+
+#define ALIGN_BYTE 1
+#define ALIGN_CHAR 1
+#define ALIGN_DESC_CHAR sizeof(DESC_CHAR)
+#define ALIGN_DWORD 4
+#define ALIGN_LONG 4
+#define ALIGN_LPBYTE 4
+#define ALIGN_LPDWORD 4
+#define ALIGN_LPSTR 4
+#define ALIGN_LPTSTR 4
+#define ALIGN_LPVOID 4
+#define ALIGN_LPWORD 4
+#define ALIGN_TCHAR sizeof(TCHAR)
+#define ALIGN_WCHAR sizeof(WCHAR)
+#define ALIGN_WORD 2
+#define ALIGN_QUAD 8
+
+#define ALIGN_WORST 8
+
+#elif defined(_MIPS_) || defined(_ALPHA_) || defined(_PPC_)
+
+#define ALIGN_BYTE 1
+#define ALIGN_CHAR 1
+#define ALIGN_DESC_CHAR sizeof(DESC_CHAR)
+#define ALIGN_DWORD 4
+#define ALIGN_LONG 4
+#define ALIGN_LPBYTE 4
+#define ALIGN_LPDWORD 4
+#define ALIGN_LPSTR 4
+#define ALIGN_LPTSTR 4
+#define ALIGN_LPVOID 4
+#define ALIGN_LPWORD 4
+#define ALIGN_TCHAR sizeof(TCHAR)
+#define ALIGN_WCHAR sizeof(WCHAR)
+#define ALIGN_WORD 2
+#define ALIGN_QUAD 8
+
+//
+// Worst-case alignment on MIPS is 8 bytes (for double). Specify this here,
+// in case our allocator is used for structures containing this. (That is,
+// even though NT/LAN doesn't need this for our data structures, let's be
+// permissive.) The alignment requirements apply to Alpha.
+//
+#define ALIGN_WORST 8
+
+#else // none of the above
+
+#error "Unknown alignment requirements for align.h"
+
+#endif // none of the above
+
+
+#endif // _ALIGN_
diff --git a/private/inc/arpinfo.h b/private/inc/arpinfo.h
new file mode 100644
index 000000000..fdd1ceb35
--- /dev/null
+++ b/private/inc/arpinfo.h
@@ -0,0 +1,49 @@
+/********************************************************************/
+/** Microsoft LAN Manager **/
+/** Copyright(c) Microsoft Corp., 1990-1992 **/
+/********************************************************************/
+/* :ts=4 */
+
+//** ARPINFO.H - Information definitions for features specific to ARP.
+//
+// This file contains all of the definitions for ARP information that is
+// not part of the standard MIB (i.e. ProxyARP). The objects defines in
+// this file are all in the INFO_CLASS_IMPLEMENTATION class.
+
+
+#ifndef ARPINFO_INCLUDED
+#define ARPINFO_INCLUDED
+
+
+#ifndef CTE_TYPEDEFS_DEFINED
+#define CTE_TYPEDEFS_DEFINED
+
+typedef unsigned long ulong;
+typedef unsigned short ushort;
+typedef unsigned char uchar;
+typedef unsigned int uint;
+
+#endif // CTE_TYPEDEFS_DEFINED
+
+
+//* Structure of a proxy ARP entry.
+
+typedef struct ProxyArpEntry {
+ ulong pae_status; // Status of the entry.
+ ulong pae_addr; // Proxy arp address.
+ ulong pae_mask; // Mask to use for this address.
+} ProxyArpEntry;
+
+#define PAE_STATUS_VALID 1 // The P-ARP entry is valid.
+#define PAE_STATUS_INVALID 2 // The P-ARP entry is invalid.
+
+
+#define AT_ARP_PARP_COUNT_ID 1 // ID to use for finding the
+ // number of proxy ARP entries
+ // available.
+#define AT_ARP_PARP_ENTRY_ID 0x101 // ID to use for querying/setting
+ // proxy ARP entries.
+#endif // ARPINFO_INCLUDED
+
+
+
diff --git a/private/inc/byteordr.hxx b/private/inc/byteordr.hxx
new file mode 100644
index 000000000..009f56c5e
--- /dev/null
+++ b/private/inc/byteordr.hxx
@@ -0,0 +1,179 @@
+//+--------------------------------------------------------------
+//
+// Microsoft Windows
+// Copyright (C) Microsoft Corporation, 1992 - 1996.
+//
+// File: byteordr.hxx
+//
+// Contents: Byte swapping functions.
+// These functions can swap all of the base types,
+// and some special cases. There is always an
+// overloaded version which accepts a pointer to the
+// data, and performs a swap in place. Where possible,
+// there is also an overload which returns the swapped
+// value without modifying the input.
+//
+//---------------------------------------------------------------
+
+#ifndef __BYTEORDER_HXX_
+#define __BYTEORDER_HXX_
+
+#include <limits.h>
+
+//
+// BYTE Byte-Swap
+//
+
+// These exist so that you can call ByteSwap(OLECHAR) without
+// knowning if OLECHAR is a CHAR or a WCHAR.
+
+inline BYTE ByteSwap( BYTE b )
+{
+ return(b);
+}
+
+inline VOID ByteSwap( BYTE *pb )
+{
+ *pb = ByteSwap(*pb);
+}
+
+//
+// WORD Byte-Swap
+//
+
+#ifndef LOBYTE
+
+# define LOBYTE(a) (unsigned char)((a) & ((unsigned)~0 >> sizeof(BYTE)*8 ))
+# define HIBYTE(a) (unsigned char)((unsigned)(a) >> sizeof(BYTE)*8 )
+
+# define LOWORD(a) (WORD)( (a) & ( (WORD)~0 >> sizeof(WORD)*8 ))
+# define HIWORD(a) (WORD)( (WORD)(a) >> sizeof(WORD)*8 )
+
+# define LODWORD(a) (DWORD)( (a) & ( (DWORD)~0 >> sizeof(DWORD)*8 ))
+# define HIDWORD(a) (DWORD)( (DWORD)(a) >> sizeof(DWORD)*8 )
+
+#endif // #ifndef LOBYTE
+
+inline WORD ByteSwap( WORD w )
+{
+ return( (USHORT) ( (LOBYTE(w) << 8 )
+ |
+ HIBYTE(w)) );
+}
+
+inline VOID ByteSwap( WORD *pw )
+{
+ *pw = ByteSwap(*pw);
+}
+
+//
+// DWORD Byte-Swap
+//
+
+#define BYTE_MASK_A_C_ 0xff00ff00
+#define BYTE_MASK__B_D 0x00ff00ff
+#define BYTE_MASK_AB__ 0xffff0000
+#define BYTE_MASK___CD 0x0000ffff
+
+inline DWORD ByteSwap( DWORD dwOriginal )
+{
+ ULONG dwSwapped;
+
+ // ABCD => BADC
+
+ dwSwapped = (( (dwOriginal) & BYTE_MASK_A_C_ ) >> 8 )
+ |
+ (( (dwOriginal) & BYTE_MASK__B_D ) << 8 );
+
+ // BADC => DCBA
+
+ dwSwapped = (( dwSwapped & BYTE_MASK_AB__ ) >> 16 )
+ |
+ (( dwSwapped & BYTE_MASK___CD ) << 16 );
+
+ return( dwSwapped );
+}
+
+inline VOID ByteSwap( DWORD *pdw )
+{
+ *pdw = ByteSwap(*pdw);
+}
+
+
+//
+// LONGLONG Byte-Swap
+//
+
+#define BYTE_MASK_A_C_E_G_ 0xff00ff00ff00ff00
+#define BYTE_MASK__B_D_F_H 0x00ff00ff00ff00ff
+#define BYTE_MASK_AB__EF__ 0xffff0000ffff0000
+#define BYTE_MASK___CD__GH 0x0000ffff0000ffff
+#define BYTE_MASK_ABCD____ 0xffffffff00000000
+#define BYTE_MASK_____EFGH 0x00000000ffffffff
+
+inline LONGLONG ByteSwap( LONGLONG llOriginal )
+{
+ LONGLONG llSwapped;
+
+#ifdef _MAC
+
+ *((DWORD*) &llSwapped) = *((DWORD*) &llOriginal + 1);
+ *((DWORD*) &llSwapped + 1) = *((DWORD*) &llOriginal);
+
+ ByteSwap( (DWORD*) &llSwapped );
+ ByteSwap( (DWORD*) &llSwapped + 1 );
+
+#else
+
+ // ABCDEFGH => BADCFEHG
+
+ llSwapped = (( (llOriginal) & BYTE_MASK_A_C_E_G_ ) >> 8 )
+ |
+ (( (llOriginal) & BYTE_MASK__B_D_F_H ) << 8 );
+
+ // BADCFEHG => DCBAHGFE
+
+ llSwapped = (( llSwapped & BYTE_MASK_AB__EF__ ) >> 16 )
+ |
+ (( llSwapped & BYTE_MASK___CD__GH ) << 16 );
+
+ // DCBAHGFE => HGFEDCBA
+
+ llSwapped = (( llSwapped & BYTE_MASK_ABCD____ ) >> 32 )
+ |
+ (( llSwapped & BYTE_MASK_____EFGH ) << 32 );
+
+#endif
+
+ return( llSwapped );
+}
+
+inline VOID ByteSwap( LONGLONG *pll )
+{
+ *pll = ByteSwap( *pll );
+}
+
+//
+// GUID Byte-swap
+//
+
+inline VOID ByteSwap( GUID *pguid)
+{
+ ByteSwap(&pguid->Data1);
+ ByteSwap(&pguid->Data2);
+ ByteSwap(&pguid->Data3);
+}
+
+//
+// FILETIME Byte-Swap
+//
+
+inline VOID ByteSwap(FILETIME *pfileTime)
+{
+ ByteSwap(&pfileTime->dwLowDateTime);
+ ByteSwap(&pfileTime->dwHighDateTime);
+}
+
+
+#endif // !__BYTEORDER_HXX_
+
diff --git a/private/inc/crypt.h b/private/inc/crypt.h
new file mode 100644
index 000000000..db0995f7b
--- /dev/null
+++ b/private/inc/crypt.h
@@ -0,0 +1,605 @@
+/*++ BUILD Version: 0001 // Increment this if a change has global effects
+
+Copyright (c) 1989 Microsoft Corporation
+
+Module Name:
+
+ crypt.h
+
+Abstract:
+
+ This module contains the public data structures and API definitions
+ needed to utilize the encryption library
+
+
+Author:
+
+ David Chalmers (Davidc) 21-October-1991
+
+Revision History:
+
+--*/
+
+#ifndef _NTCRYPT_
+#define _NTCRYPT_
+
+#ifndef MIDL_PASS // Don't confuse MIDL
+
+#ifndef RPC_NO_WINDOWS_H // Don't let rpc.h include windows.h
+#define RPC_NO_WINDOWS_H
+#endif // RPC_NO_WINDOWS_H
+
+#include <rpc.h>
+#endif // MIDL_PASS
+
+
+/////////////////////////////////////////////////////////////////////////
+// //
+// Core encryption types //
+// //
+/////////////////////////////////////////////////////////////////////////
+
+// begin_ntsubauth
+
+#define CLEAR_BLOCK_LENGTH 8
+
+typedef struct _CLEAR_BLOCK {
+ CHAR data[CLEAR_BLOCK_LENGTH];
+} CLEAR_BLOCK;
+typedef CLEAR_BLOCK * PCLEAR_BLOCK;
+
+#define CYPHER_BLOCK_LENGTH 8
+
+typedef struct _CYPHER_BLOCK {
+ CHAR data[CYPHER_BLOCK_LENGTH];
+} CYPHER_BLOCK;
+typedef CYPHER_BLOCK * PCYPHER_BLOCK;
+// end_ntsubauth
+
+#define BLOCK_KEY_LENGTH 7
+
+typedef struct _BLOCK_KEY {
+ CHAR data[BLOCK_KEY_LENGTH];
+} BLOCK_KEY;
+typedef BLOCK_KEY * PBLOCK_KEY;
+
+
+
+
+/////////////////////////////////////////////////////////////////////////
+// //
+// Arbitrary length data encryption types //
+// //
+/////////////////////////////////////////////////////////////////////////
+
+typedef struct _CRYPT_BUFFER {
+ ULONG Length; // Number of valid bytes in buffer
+ ULONG MaximumLength; // Number of bytes pointed to by Buffer
+ PVOID Buffer;
+} CRYPT_BUFFER;
+typedef CRYPT_BUFFER * PCRYPT_BUFFER;
+
+typedef CRYPT_BUFFER CLEAR_DATA;
+typedef CLEAR_DATA * PCLEAR_DATA;
+
+typedef CRYPT_BUFFER DATA_KEY;
+typedef DATA_KEY * PDATA_KEY;
+
+typedef CRYPT_BUFFER CYPHER_DATA;
+typedef CYPHER_DATA * PCYPHER_DATA;
+
+
+
+/////////////////////////////////////////////////////////////////////////
+// //
+// Lan Manager data types //
+// //
+/////////////////////////////////////////////////////////////////////////
+
+
+//
+// Define a LanManager compatible password
+//
+// A LanManager password is a null-terminated ansi string consisting of a
+// maximum of 14 characters (not including terminator)
+//
+
+typedef CHAR * PLM_PASSWORD;
+
+
+
+//
+// Define the result of the 'One Way Function' (OWF) on a LM password
+//
+
+#define LM_OWF_PASSWORD_LENGTH (CYPHER_BLOCK_LENGTH * 2)
+
+// begin_ntsubauth
+typedef struct _LM_OWF_PASSWORD {
+ CYPHER_BLOCK data[2];
+} LM_OWF_PASSWORD;
+typedef LM_OWF_PASSWORD * PLM_OWF_PASSWORD;
+// end_ntsubauth
+
+
+
+//
+// Define the challenge sent by the Lanman server during logon
+//
+
+#define LM_CHALLENGE_LENGTH CLEAR_BLOCK_LENGTH
+
+// begin_ntsubauth
+typedef CLEAR_BLOCK LM_CHALLENGE;
+typedef LM_CHALLENGE * PLM_CHALLENGE;
+// end_ntsubauth
+
+
+
+//
+// Define the response sent by redirector in response to challenge from server
+//
+
+#define LM_RESPONSE_LENGTH (CYPHER_BLOCK_LENGTH * 3)
+
+typedef struct _LM_RESPONSE {
+ CYPHER_BLOCK data[3];
+} LM_RESPONSE;
+typedef LM_RESPONSE * PLM_RESPONSE;
+
+
+
+//
+// Define the result of the reversible encryption of an OWF'ed password.
+//
+
+#define ENCRYPTED_LM_OWF_PASSWORD_LENGTH (CYPHER_BLOCK_LENGTH * 2)
+
+typedef struct _ENCRYPTED_LM_OWF_PASSWORD {
+ CYPHER_BLOCK data[2];
+} ENCRYPTED_LM_OWF_PASSWORD;
+typedef ENCRYPTED_LM_OWF_PASSWORD * PENCRYPTED_LM_OWF_PASSWORD;
+
+
+
+//
+// Define the session key maintained by the redirector and server
+//
+
+#define LM_SESSION_KEY_LENGTH LM_CHALLENGE_LENGTH
+
+typedef LM_CHALLENGE LM_SESSION_KEY;
+typedef LM_SESSION_KEY * PLM_SESSION_KEY;
+
+
+
+//
+// Define the index type used to encrypt OWF Passwords
+//
+
+typedef LONG CRYPT_INDEX;
+typedef CRYPT_INDEX * PCRYPT_INDEX;
+
+
+
+/////////////////////////////////////////////////////////////////////////
+// //
+// 'NT' encryption types that are used to duplicate existing LM //
+// functionality with improved algorithms. //
+// //
+/////////////////////////////////////////////////////////////////////////
+
+
+typedef UNICODE_STRING NT_PASSWORD;
+typedef NT_PASSWORD * PNT_PASSWORD;
+
+
+#define NT_OWF_PASSWORD_LENGTH LM_OWF_PASSWORD_LENGTH
+
+// begin_ntsubauth
+typedef LM_OWF_PASSWORD NT_OWF_PASSWORD;
+typedef NT_OWF_PASSWORD * PNT_OWF_PASSWORD;
+// end_ntsubauth
+
+
+#define NT_CHALLENGE_LENGTH LM_CHALLENGE_LENGTH
+
+// begin_ntsubauth
+typedef LM_CHALLENGE NT_CHALLENGE;
+typedef NT_CHALLENGE * PNT_CHALLENGE;
+// end_ntsubauth
+
+
+#define NT_RESPONSE_LENGTH LM_RESPONSE_LENGTH
+
+typedef LM_RESPONSE NT_RESPONSE;
+typedef NT_RESPONSE * PNT_RESPONSE;
+
+
+#define ENCRYPTED_NT_OWF_PASSWORD_LENGTH ENCRYPTED_LM_OWF_PASSWORD_LENGTH
+
+typedef ENCRYPTED_LM_OWF_PASSWORD ENCRYPTED_NT_OWF_PASSWORD;
+typedef ENCRYPTED_NT_OWF_PASSWORD * PENCRYPTED_NT_OWF_PASSWORD;
+
+
+#define NT_SESSION_KEY_LENGTH LM_SESSION_KEY_LENGTH
+
+typedef LM_SESSION_KEY NT_SESSION_KEY;
+typedef NT_SESSION_KEY * PNT_SESSION_KEY;
+
+
+
+/////////////////////////////////////////////////////////////////////////
+// //
+// 'NT' encryption types for new functionality not present in LM //
+// //
+/////////////////////////////////////////////////////////////////////////
+
+
+//
+// The user session key is similar to the LM and NT session key except it
+// is different for each user on the system. This allows it to be used
+// for secure user communication with a server.
+//
+#define USER_SESSION_KEY_LENGTH (CYPHER_BLOCK_LENGTH * 2)
+
+typedef struct _USER_SESSION_KEY {
+ CYPHER_BLOCK data[2];
+} USER_SESSION_KEY;
+typedef USER_SESSION_KEY * PUSER_SESSION_KEY;
+
+
+
+////////////////////////////////////////////////////////////////////////////
+// //
+// Encryption library API macros //
+// //
+// To conceal the purpose of these functions to someone dumping out the //
+// encryption dll they have been purposefully given unhelpful names. //
+// Each has an associated macro that should be used by system components //
+// to access these routines in a readable way. //
+// //
+////////////////////////////////////////////////////////////////////////////
+
+#define RtlEncryptBlock SystemFunction001
+#define RtlDecryptBlock SystemFunction002
+#define RtlEncryptStdBlock SystemFunction003
+#define RtlEncryptData SystemFunction004
+#define RtlDecryptData SystemFunction005
+#define RtlCalculateLmOwfPassword SystemFunction006
+#define RtlCalculateNtOwfPassword SystemFunction007
+#define RtlCalculateLmResponse SystemFunction008
+#define RtlCalculateNtResponse SystemFunction009
+#define RtlCalculateUserSessionKeyLm SystemFunction010
+#define RtlCalculateUserSessionKeyNt SystemFunction011
+#define RtlEncryptLmOwfPwdWithLmOwfPwd SystemFunction012
+#define RtlDecryptLmOwfPwdWithLmOwfPwd SystemFunction013
+#define RtlEncryptNtOwfPwdWithNtOwfPwd SystemFunction014
+#define RtlDecryptNtOwfPwdWithNtOwfPwd SystemFunction015
+#define RtlEncryptLmOwfPwdWithLmSesKey SystemFunction016
+#define RtlDecryptLmOwfPwdWithLmSesKey SystemFunction017
+#define RtlEncryptNtOwfPwdWithNtSesKey SystemFunction018
+#define RtlDecryptNtOwfPwdWithNtSesKey SystemFunction019
+#define RtlEncryptLmOwfPwdWithUserKey SystemFunction020
+#define RtlDecryptLmOwfPwdWithUserKey SystemFunction021
+#define RtlEncryptNtOwfPwdWithUserKey SystemFunction022
+#define RtlDecryptNtOwfPwdWithUserKey SystemFunction023
+#define RtlEncryptLmOwfPwdWithIndex SystemFunction024
+#define RtlDecryptLmOwfPwdWithIndex SystemFunction025
+#define RtlEncryptNtOwfPwdWithIndex SystemFunction026
+#define RtlDecryptNtOwfPwdWithIndex SystemFunction027
+#define RtlGetUserSessionKeyClient SystemFunction028
+#define RtlGetUserSessionKeyServer SystemFunction029
+#define RtlEqualLmOwfPassword SystemFunction030
+#define RtlEqualNtOwfPassword SystemFunction031
+#define RtlEncryptData2 SystemFunction032
+#define RtlDecryptData2 SystemFunction033
+
+
+////////////////////////////////////////////////////////////////////////////
+// //
+// Encryption library API function prototypes //
+// //
+////////////////////////////////////////////////////////////////////////////
+
+
+//
+// Core block encryption functions
+//
+
+NTSTATUS
+RtlEncryptBlock(
+ IN PCLEAR_BLOCK ClearBlock,
+ IN PBLOCK_KEY BlockKey,
+ OUT PCYPHER_BLOCK CypherBlock
+ );
+
+NTSTATUS
+RtlDecryptBlock(
+ IN PCYPHER_BLOCK CypherBlock,
+ IN PBLOCK_KEY BlockKey,
+ OUT PCLEAR_BLOCK ClearBlock
+ );
+
+NTSTATUS
+RtlEncryptStdBlock(
+ IN PBLOCK_KEY BlockKey,
+ OUT PCYPHER_BLOCK CypherBlock
+ );
+
+//
+// Arbitrary length data encryption functions
+//
+
+NTSTATUS
+RtlEncryptData(
+ IN PCLEAR_DATA ClearData,
+ IN PDATA_KEY DataKey,
+ OUT PCYPHER_DATA CypherData
+ );
+
+NTSTATUS
+RtlDecryptData(
+ IN PCYPHER_DATA CypherData,
+ IN PDATA_KEY DataKey,
+ OUT PCLEAR_DATA ClearData
+ );
+
+//
+// Faster arbitrary length data encryption functions (using RC4)
+//
+
+NTSTATUS
+RtlEncryptData2(
+ IN OUT PCRYPT_BUFFER pData,
+ IN PDATA_KEY pKey
+ );
+
+NTSTATUS
+RtlDecryptData2(
+ IN OUT PCRYPT_BUFFER pData,
+ IN PDATA_KEY pKey
+ );
+
+//
+// Password hashing functions (One Way Function)
+//
+
+NTSTATUS
+RtlCalculateLmOwfPassword(
+ IN PLM_PASSWORD LmPassword,
+ OUT PLM_OWF_PASSWORD LmOwfPassword
+ );
+
+NTSTATUS
+RtlCalculateNtOwfPassword(
+ IN PNT_PASSWORD NtPassword,
+ OUT PNT_OWF_PASSWORD NtOwfPassword
+ );
+
+
+
+//
+// OWF password comparison functions
+//
+
+BOOLEAN
+RtlEqualLmOwfPassword(
+ IN PLM_OWF_PASSWORD LmOwfPassword1,
+ IN PLM_OWF_PASSWORD LmOwfPassword2
+ );
+
+BOOLEAN
+RtlEqualNtOwfPassword(
+ IN PNT_OWF_PASSWORD NtOwfPassword1,
+ IN PNT_OWF_PASSWORD NtOwfPassword2
+ );
+
+
+
+//
+// Functions for calculating response to server challenge
+//
+
+NTSTATUS
+RtlCalculateLmResponse(
+ IN PLM_CHALLENGE LmChallenge,
+ IN PLM_OWF_PASSWORD LmOwfPassword,
+ OUT PLM_RESPONSE LmResponse
+ );
+
+
+NTSTATUS
+RtlCalculateNtResponse(
+ IN PNT_CHALLENGE NtChallenge,
+ IN PNT_OWF_PASSWORD NtOwfPassword,
+ OUT PNT_RESPONSE NtResponse
+ );
+
+
+
+
+//
+// Functions for calculating User Session Key.
+//
+
+//
+// Calculate a User Session Key from LM data
+//
+NTSTATUS
+RtlCalculateUserSessionKeyLm(
+ IN PLM_RESPONSE LmResponse,
+ IN PLM_OWF_PASSWORD LmOwfPassword,
+ OUT PUSER_SESSION_KEY UserSessionKey
+ );
+
+//
+// Calculate a User Session Key from NT data
+//
+NTSTATUS
+RtlCalculateUserSessionKeyNt(
+ IN PNT_RESPONSE NtResponse,
+ IN PNT_OWF_PASSWORD NtOwfPassword,
+ OUT PUSER_SESSION_KEY UserSessionKey
+ );
+
+
+
+
+
+//
+// OwfPassword encryption functions
+//
+
+
+//
+// Encrypt OwfPassword using OwfPassword as the key
+//
+NTSTATUS
+RtlEncryptLmOwfPwdWithLmOwfPwd(
+ IN PLM_OWF_PASSWORD DataLmOwfPassword,
+ IN PLM_OWF_PASSWORD KeyLmOwfPassword,
+ OUT PENCRYPTED_LM_OWF_PASSWORD EncryptedLmOwfPassword
+ );
+
+NTSTATUS
+RtlDecryptLmOwfPwdWithLmOwfPwd(
+ IN PENCRYPTED_LM_OWF_PASSWORD EncryptedLmOwfPassword,
+ IN PLM_OWF_PASSWORD KeyLmOwfPassword,
+ OUT PLM_OWF_PASSWORD DataLmOwfPassword
+ );
+
+
+NTSTATUS
+RtlEncryptNtOwfPwdWithNtOwfPwd(
+ IN PNT_OWF_PASSWORD DataNtOwfPassword,
+ IN PNT_OWF_PASSWORD KeyNtOwfPassword,
+ OUT PENCRYPTED_NT_OWF_PASSWORD EncryptedNtOwfPassword
+ );
+
+NTSTATUS
+RtlDecryptNtOwfPwdWithNtOwfPwd(
+ IN PENCRYPTED_NT_OWF_PASSWORD EncryptedNtOwfPassword,
+ IN PNT_OWF_PASSWORD KeyNtOwfPassword,
+ OUT PNT_OWF_PASSWORD DataNtOwfPassword
+ );
+
+
+//
+// Encrypt OwfPassword using SessionKey as the key
+//
+NTSTATUS
+RtlEncryptLmOwfPwdWithLmSesKey(
+ IN PLM_OWF_PASSWORD LmOwfPassword,
+ IN PLM_SESSION_KEY LmSessionKey,
+ OUT PENCRYPTED_LM_OWF_PASSWORD EncryptedLmOwfPassword
+ );
+
+NTSTATUS
+RtlDecryptLmOwfPwdWithLmSesKey(
+ IN PENCRYPTED_LM_OWF_PASSWORD EncryptedLmOwfPassword,
+ IN PLM_SESSION_KEY LmSessionKey,
+ OUT PLM_OWF_PASSWORD LmOwfPassword
+ );
+
+
+NTSTATUS
+RtlEncryptNtOwfPwdWithNtSesKey(
+ IN PNT_OWF_PASSWORD NtOwfPassword,
+ IN PNT_SESSION_KEY NtSessionKey,
+ OUT PENCRYPTED_NT_OWF_PASSWORD EncryptedNtOwfPassword
+ );
+
+NTSTATUS
+RtlDecryptNtOwfPwdWithNtSesKey(
+ IN PENCRYPTED_NT_OWF_PASSWORD EncryptedNtOwfPassword,
+ IN PNT_SESSION_KEY NtSessionKey,
+ OUT PNT_OWF_PASSWORD NtOwfPassword
+ );
+
+
+//
+// Encrypt OwfPassword using UserSessionKey as the key
+//
+NTSTATUS
+RtlEncryptLmOwfPwdWithUserKey(
+ IN PLM_OWF_PASSWORD LmOwfPassword,
+ IN PUSER_SESSION_KEY UserSessionKey,
+ OUT PENCRYPTED_LM_OWF_PASSWORD EncryptedLmOwfPassword
+ );
+
+NTSTATUS
+RtlDecryptLmOwfPwdWithUserKey(
+ IN PENCRYPTED_LM_OWF_PASSWORD EncryptedLmOwfPassword,
+ IN PUSER_SESSION_KEY UserSessionKey,
+ OUT PLM_OWF_PASSWORD LmOwfPassword
+ );
+
+NTSTATUS
+RtlEncryptNtOwfPwdWithUserKey(
+ IN PNT_OWF_PASSWORD NtOwfPassword,
+ IN PUSER_SESSION_KEY UserSessionKey,
+ OUT PENCRYPTED_NT_OWF_PASSWORD EncryptedNtOwfPassword
+ );
+
+NTSTATUS
+RtlDecryptNtOwfPwdWithUserKey(
+ IN PENCRYPTED_NT_OWF_PASSWORD EncryptedNtOwfPassword,
+ IN PUSER_SESSION_KEY UserSessionKey,
+ OUT PNT_OWF_PASSWORD NtOwfPassword
+ );
+
+
+//
+// Encrypt OwfPassword using an index as the key
+//
+NTSTATUS
+RtlEncryptLmOwfPwdWithIndex(
+ IN PLM_OWF_PASSWORD LmOwfPassword,
+ IN PCRYPT_INDEX Index,
+ OUT PENCRYPTED_LM_OWF_PASSWORD EncryptedLmOwfPassword
+ );
+
+NTSTATUS
+RtlDecryptLmOwfPwdWithIndex(
+ IN PENCRYPTED_LM_OWF_PASSWORD EncryptedLmOwfPassword,
+ IN PCRYPT_INDEX Index,
+ OUT PLM_OWF_PASSWORD LmOwfPassword
+ );
+
+
+NTSTATUS
+RtlEncryptNtOwfPwdWithIndex(
+ IN PNT_OWF_PASSWORD NtOwfPassword,
+ IN PCRYPT_INDEX Index,
+ OUT PENCRYPTED_NT_OWF_PASSWORD EncryptedNtOwfPassword
+ );
+
+NTSTATUS
+RtlDecryptNtOwfPwdWithIndex(
+ IN PENCRYPTED_NT_OWF_PASSWORD EncryptedNtOwfPassword,
+ IN PCRYPT_INDEX Index,
+ OUT PNT_OWF_PASSWORD NtOwfPassword
+ );
+
+
+//
+// Get the user session key for an RPC connection
+//
+
+#ifndef MIDL_PASS // Don't confuse MIDL
+NTSTATUS
+RtlGetUserSessionKeyClient(
+ IN PVOID RpcContextHandle OPTIONAL,
+ OUT PUSER_SESSION_KEY UserSessionKey
+ );
+
+NTSTATUS
+RtlGetUserSessionKeyServer(
+ IN PVOID RpcContextHandle OPTIONAL,
+ OUT PUSER_SESSION_KEY UserSessionKey
+ );
+#endif // MIDL_PASS
+
+#endif // _NTCRYPT_
+
diff --git a/private/inc/cs4231.h b/private/inc/cs4231.h
new file mode 100644
index 000000000..b53ac1615
--- /dev/null
+++ b/private/inc/cs4231.h
@@ -0,0 +1,118 @@
+/*++ BUILD Version: 0001 // Increment this if a change has global effects
+
+
+Copyright (c) 1992 Microsoft Corporation
+
+Module Name:
+
+ cs4231.h
+
+Abstract:
+
+ This include file defines constants and types for
+ the on board sound codec chip.
+
+ This header file is shared between the low level driver and the
+ kernel driver.
+
+Author:
+
+ Robin Speed (RobinSp) 20-Oct-92
+
+Revision History:
+
+ Chris Karamatas (ckaramatas@ibm.vnet.com) 8-Aug-94 : Values corresponding
+ to plannar audio
+
+--*/
+
+#ifndef _CS4231_
+#define _CS4231_
+
+#define VALID_IO_PORTS {0x830, 0xFFFF}
+#define VALID_INTERRUPTS {10, 0xFFFF}
+#define VALID_DMA_CHANNELS {6, 7, 0xFFFF}
+
+#define SOUND_DEF_DMACHANNEL 6 // DMA channel no; was 7
+#define SOUND_DEF_INT 10
+#define SOUND_DEF_PORT 0x830
+
+#define SOUND_REG_SINGLEMODEDMA L"Single Mode DMA"
+
+#define SOUNDSYS_BUFFERSIZE 0x4000 // DMA buffer size - 16K
+
+/*
+** CAPS strings
+*/
+
+#define STR_DRIVERWAVEIN L"Windows Sound System Record"
+#define STR_DRIVERWAVEOUT L"Windows Sound System Playback"
+#define STR_DRIVERMIDIOUT L"Windows Sound System MIDI"
+#define STR_DRIVERMIC L"Windows Sound System Mic"
+#define STR_DRIVERLINEIN L"Windows Sound System Line In"
+#define STR_DRIVERMASTERVOLUME L"Windows Sound System Master"
+
+
+#define IDS_WAVEOUT_PNAME 101
+#define IDS_WAVEIN_PNAME 102
+#define IDS_MIDIOUT_PNAME 103
+#define IDS_AUX_PNAME 104
+
+#define IDS_DESTLINEOUT_SHORT_NAME 110
+#define IDS_DESTLINEOUT_LONG_NAME 111
+#define IDS_DESTWAVEIN_SHORT_NAME 112
+#define IDS_DESTWAVEIN_LONG_NAME 113
+#define IDS_DESTVOICEIN_SHORT_NAME 114
+#define IDS_DESTVOICEIN_LONG_NAME 115
+
+#define IDS_SRCAUX1_SHORT_NAME 120
+#define IDS_SRCAUX1_LONG_NAME 121
+#define IDS_SRCWAVEOUT_SHORT_NAME 122
+#define IDS_SRCWAVEOUT_LONG_NAME 123
+#define IDS_SRCMIDIOUT_SHORT_NAME 124
+#define IDS_SRCMIDIOUT_LONG_NAME 125
+#define IDS_SRCMIC_SHORT_NAME 126
+#define IDS_SRCMIC_LONG_NAME 127
+
+#define IDS_CONTROL_VOLLINEOUT_SHORT_NAME 130
+#define IDS_CONTROL_VOLLINEOUT_LONG_NAME 131
+#define IDS_CONTROL_MUTELINEOUT_SHORT_NAME 132
+#define IDS_CONTROL_MUTELINEOUT_LONG_NAME 133
+#define IDS_CONTROL_MUXWAVEIN_SHORT_NAME 134
+#define IDS_CONTROL_MUXWAVEIN_LONG_NAME 135
+#define IDS_CONTROL_MUXVOICEIN_SHORT_NAME 136
+#define IDS_CONTROL_MUXVOICEIN_LONG_NAME 137
+#define IDS_CONTROL_VOLLINEOUTAUX1_SHORT_NAME 138
+#define IDS_CONTROL_VOLLINEOUTAUX1_LONG_NAME 139
+#define IDS_CONTROL_MUTELINEOUTAUX1_SHORT_NAME 140
+#define IDS_CONTROL_MUTELINEOUTAUX1_LONG_NAME 141
+#define IDS_CONTROL_VOLLINEOUTWAVEOUT_SHORT_NAME 142
+#define IDS_CONTROL_VOLLINEOUTWAVEOUT_LONG_NAME 143
+#define IDS_CONTROL_MUTELINEOUTWAVEOUT_SHORT_NAME 144
+#define IDS_CONTROL_MUTELINEOUTWAVEOUT_LONG_NAME 145
+#define IDS_CONTROL_PEAKLINEOUTWAVEOUT_SHORT_NAME 146
+#define IDS_CONTROL_PEAKLINEOUTWAVEOUT_LONG_NAME 147
+#define IDS_CONTROL_VOLLINEOUTMIDIOUT_SHORT_NAME 148
+#define IDS_CONTROL_VOLLINEOUTMIDIOUT_LONG_NAME 149
+#define IDS_CONTROL_MUTELINEOUTMIDIOUT_SHORT_NAME 150
+#define IDS_CONTROL_MUTELINEOUTMIDIOUT_LONG_NAME 151
+#define IDS_CONTROL_VOLWAVEINAUX1_SHORT_NAME 152
+#define IDS_CONTROL_VOLWAVEINAUX1_LONG_NAME 153
+#define IDS_CONTROL_PEAKWAVEINAUX1_SHORT_NAME 154
+#define IDS_CONTROL_PEAKWAVEINUAX1_LONG_NAME 155
+#define IDS_CONTROL_VOLWAVEINMIC_SHORT_NAME 156
+#define IDS_CONTROL_VOLWAVEINMIC_LONG_NAME 157
+#define IDS_CONTROL_PEAKWAVEINMIC_SHORT_NAME 158
+#define IDS_CONTROL_PEAKWAVEINMIC_LONG_NAME 159
+#define IDS_CONTROL_VOLVOICEINAUX1_SHORT_NAME 160
+#define IDS_CONTROL_VOLVOICEINAUX1_LONG_NAME 161
+#define IDS_CONTROL_PEAKVOICEINAUX1_SHORT_NAME 162
+#define IDS_CONTROL_PEAKVOICEINUAX1_LONG_NAME 163
+#define IDS_CONTROL_VOLVOICEINMIC_SHORT_NAME 164
+#define IDS_CONTROL_VOLVOICEINMIC_LONG_NAME 165
+#define IDS_CONTROL_PEAKVOICEINMIC_SHORT_NAME 166
+#define IDS_CONTROL_PEAKVOICEINMIC_LONG_NAME 167
+
+#define SR_STR_DRIVER_MIXER 180
+
+#endif _CS4231_
diff --git a/private/inc/debugfmt.h b/private/inc/debugfmt.h
new file mode 100644
index 000000000..5c76d3a4a
--- /dev/null
+++ b/private/inc/debugfmt.h
@@ -0,0 +1,76 @@
+/*++
+
+Copyright (c) 1991-92 Microsoft Corporation
+
+Module Name:
+
+ DebugFmt.h
+
+Abstract:
+
+ This header file declares equates for debug print format strings.
+
+Author:
+
+ John Rogers (JohnRo) 11-Mar-1991
+
+Environment:
+
+ ifdef'ed for NT, any ANSI C environment, or none of the above (which
+ implies nondebug). The interface is portable (Win/32).
+ Requires ANSI C extensions: slash-slash comments, long external names.
+
+Revision History:
+
+ 11-Mar-1991 JohnRo
+ Created NetDebug.h.
+ 15-Apr-1992 JohnRo
+ Extracted format equates into DebugFmt.h.
+
+--*/
+
+
+#ifndef _DEBUGFMT_
+#define _DEBUGFMT_
+
+
+//
+// printf-style format strings for some possibly nonportable stuff...
+// These are passed to NetpDbgPrint(); use with other routines at your
+// own risk.
+//
+// Note also that FORMAT_LPVOID is preferable to FORMAT_POINTER, as
+// different kinds of pointers can be different sizes. FORMAT_POINTER
+// will be deleted eventually.
+//
+
+//#define FORMAT_API_STATUS "%lu"
+#define FORMAT_CHAR "%c"
+//#define FORMAT_LPDEBUG_STRING "%s"
+#define FORMAT_DWORD "%lu"
+#define FORMAT_HEX_DWORD "0x%08lX"
+#define FORMAT_HEX_WORD "0x%04X"
+#define FORMAT_HEX_ULONG "0x%08lX"
+#define FORMAT_LONG "%ld"
+#define FORMAT_LPSTR "%s"
+#define FORMAT_LPVOID "0x%08lX"
+#define FORMAT_LPWSTR "%ws"
+//#define FORMAT_POINTER "0x%08lX"
+#define FORMAT_RPC_STATUS "0x%08lX"
+#define FORMAT_ULONG "%lu"
+#define FORMAT_WCHAR "%wc"
+#define FORMAT_WORD_ONLY "%u"
+
+#ifndef UNICODE
+#define FORMAT_TCHAR FORMAT_CHAR
+#define FORMAT_LPTSTR FORMAT_LPSTR
+#else // UNICODE
+#define FORMAT_TCHAR FORMAT_WCHAR
+#define FORMAT_LPTSTR FORMAT_LPWSTR
+#endif // UNICODE
+
+#define FORMAT_NTSTATUS "0x%08lX"
+
+
+
+#endif // ndef _DEBUGFMT_
diff --git a/private/inc/dfsfsctl.h b/private/inc/dfsfsctl.h
new file mode 100644
index 000000000..05ddcecd9
--- /dev/null
+++ b/private/inc/dfsfsctl.h
@@ -0,0 +1,359 @@
+//+----------------------------------------------------------------------------
+//
+// Copyright (C) 1996, Microsoft Corporation
+//
+// File: dfsfsctl.h
+//
+// Contents: The FsControl codes, data structures, and names needed for
+// communication between user-level code and the Dfs kernel
+// driver.
+//
+// Classes: None
+//
+// Functions:
+//
+//-----------------------------------------------------------------------------
+
+#ifndef _DFSFSCTL_
+#define _DFSFSCTL_
+//
+// Distributed file service file control code and structure declarations
+//
+
+//
+// The name of the Dfs driver file system device for server and client
+//
+#define DFS_DRIVER_NAME L"\\Dfs"
+#define DFS_SERVER_NAME L"\\DfsServer"
+
+//
+// The name of the NT object directory under which Dfs creates its own
+// devices.
+//
+
+#define DD_DFS_DEVICE_DIRECTORY L"\\Device\\WinDfs"
+
+//
+// The canonical device Dfs creates for fielding file open requests.
+//
+
+#define DD_DFS_DEVICE_NAME L"Root"
+
+//
+// BUGBUG - The following need to be in devioctl.h
+
+#define FILE_DEVICE_DFS_FILE_SYSTEM 0x00000030
+#define FILE_DEVICE_DFS_VOLUME 0x00000031
+
+#define DFS_OPEN_CONTEXT 0xFF444653
+#define DFS_DOWNLEVEL_OPEN_CONTEXT 0x11444653
+
+// END BUGBUG
+
+//
+// NtDeviceIoControlFile IoControlCode values for this device.
+//
+// Warning: Remember that the low two bits of the code specify how the
+// buffers are passed to the driver!
+//
+
+#define FSCTL_DFS_BASE FILE_DEVICE_DFS
+
+//
+// DFS FSCTL operations. When a passed-in buffer contains pointers, and the caller
+// is not KernelMode, the passed-in pointer value is set relative to the beginning of
+// the buffer. They must be adjusted before use. If the caller mode was KernelMode,
+// pointers should be used as is.
+//
+//
+
+//
+// These are the fsctl codes used by the srvsvc to implement the I_NetDfsXXX
+// calls.
+//
+
+#define FSCTL_DFS_CREATE_LOCAL_PARTITION CTL_CODE(FSCTL_DFS_BASE, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_DELETE_LOCAL_PARTITION CTL_CODE(FSCTL_DFS_BASE, 9, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_SET_LOCAL_VOLUME_STATE CTL_CODE(FSCTL_DFS_BASE, 10, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_SET_SERVER_INFO CTL_CODE(FSCTL_DFS_BASE, 24, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_CREATE_EXIT_POINT CTL_CODE(FSCTL_DFS_BASE, 29, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_DELETE_EXIT_POINT CTL_CODE(FSCTL_DFS_BASE, 30, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_MODIFY_PREFIX CTL_CODE(FSCTL_DFS_BASE, 38, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_FIX_LOCAL_VOLUME CTL_CODE(FSCTL_DFS_BASE, 39, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+//
+// These are the fsctl codes used by the SMB server to support shares in the
+// Dfs
+//
+
+#define FSCTL_DFS_TRANSLATE_PATH CTL_CODE(FSCTL_DFS_BASE, 100, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_GET_REFERRALS CTL_CODE(FSCTL_DFS_BASE, 101, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_REPORT_INCONSISTENCY CTL_CODE(FSCTL_DFS_BASE, 102, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_IS_SHARE_IN_DFS CTL_CODE(FSCTL_DFS_BASE, 103, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_IS_ROOT CTL_CODE(FSCTL_DFS_BASE, 104, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_GET_VERSION CTL_CODE(FSCTL_DFS_BASE, 105, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+//
+// These are the fsctl codes supported by the Dfs client to identify quickly
+// whether paths are in the Dfs or not.
+//
+
+#define FSCTL_DFS_IS_VALID_PREFIX CTL_CODE(FSCTL_DFS_BASE, 106, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_IS_VALID_LOGICAL_ROOT CTL_CODE(FSCTL_DFS_BASE, 107, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+//
+// These are the fsctl codes used by the Dfs Manager / Dfs Service to
+// manipulate the Dfs.
+//
+
+#define FSCTL_DFS_STOP_DFS CTL_CODE(FSCTL_DFS_BASE, 3, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_START_DFS CTL_CODE(FSCTL_DFS_BASE, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_INIT_LOCAL_PARTITIONS CTL_CODE(FSCTL_DFS_BASE, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_SET_SERVICE_STATE CTL_CODE(FSCTL_DFS_BASE, 11, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_DC_SET_VOLUME_STATE CTL_CODE(FSCTL_DFS_BASE, 12, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_IS_CHILDNAME_LEGAL CTL_CODE(FSCTL_DFS_BASE, 15, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_PKT_CREATE_ENTRY CTL_CODE(FSCTL_DFS_BASE, 16, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_PKT_CREATE_SUBORDINATE_ENTRY CTL_CODE(FSCTL_DFS_BASE, 17, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_CHECK_STGID_IN_USE CTL_CODE(FSCTL_DFS_BASE, 18, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_PKT_SET_RELATION_INFO CTL_CODE(FSCTL_DFS_BASE, 22, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_GET_SERVER_INFO CTL_CODE(FSCTL_DFS_BASE, 23, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_PKT_DESTROY_ENTRY CTL_CODE(FSCTL_DFS_BASE, 26, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_PKT_GET_RELATION_INFO CTL_CODE(FSCTL_DFS_BASE, 27, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_CHECK_REMOTE_PARTITION CTL_CODE(FSCTL_DFS_BASE, 34, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_VERIFY_REMOTE_VOLUME_KNOWLEDGE CTL_CODE(FSCTL_DFS_BASE, 35, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_VERIFY_LOCAL_VOLUME_KNOWLEDGE CTL_CODE(FSCTL_DFS_BASE, 36, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_PRUNE_LOCAL_PARTITION CTL_CODE(FSCTL_DFS_BASE, 37, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+//
+// These are the fsctl codes used by the Dfs WNet provider to support the
+// WNet APIs for Dfs
+//
+
+#define FSCTL_DFS_DEFINE_LOGICAL_ROOT CTL_CODE(FSCTL_DFS_BASE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_DELETE_LOGICAL_ROOT CTL_CODE(FSCTL_DFS_BASE, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_GET_LOGICAL_ROOT_PREFIX CTL_CODE(FSCTL_DFS_BASE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_GET_CONNECTED_RESOURCES CTL_CODE(FSCTL_DFS_BASE, 47, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_GET_SERVER_NAME CTL_CODE(FSCTL_DFS_BASE, 48, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_DEFINE_ROOT_CREDENTIALS CTL_CODE(FSCTL_DFS_BASE, 49, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+//
+// These are fsctl codes used by the Dfs Perfmon DLL
+//
+
+#define FSCTL_DFS_READ_METERS CTL_CODE(FSCTL_DFS_BASE, 50, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+//
+// These are fsctls useful for testing Dfs
+//
+
+#define FSCTL_DFS_SHUFFLE_ENTRY CTL_CODE(FSCTL_DFS_BASE, 51, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_GET_FIRST_SVC CTL_CODE(FSCTL_DFS_BASE, 52, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_GET_NEXT_SVC CTL_CODE(FSCTL_DFS_BASE, 53, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_GET_ENTRY_TYPE CTL_CODE(FSCTL_DFS_BASE, 54, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+//
+// These are the fsctl codes that might be useful in the future.
+//
+
+#define FSCTL_DFS_NAME_RESOLVE CTL_CODE(FSCTL_DFS_BASE, 25, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DFS_SET_DOMAIN_GLUON CTL_CODE(FSCTL_DFS_BASE, 20, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+
+#ifdef MIDL_PASS
+#define DFSMIDLSTRING [string] LPWSTR
+#define DFSSIZEIS [size_is(Count)]
+#else
+#define DFSMIDLSTRING LPWSTR
+#define DFSSIZEIS
+#endif
+
+typedef struct {
+ GUID Uid;
+ DFSMIDLSTRING Prefix;
+} NET_DFS_ENTRY_ID, *LPNET_DFS_ENTRY_ID;
+
+typedef struct {
+ ULONG Count;
+ DFSSIZEIS LPNET_DFS_ENTRY_ID Buffer;
+} NET_DFS_ENTRY_ID_CONTAINER, *LPNET_DFS_ENTRY_ID_CONTAINER;
+
+
+// FSCTL_DFS_CREATE_LOCAL_PARTITION Input Buffer:
+typedef struct {
+ LPWSTR ShareName;
+ LPWSTR SharePath;
+ GUID EntryUid;
+ LPWSTR EntryPrefix;
+ LPWSTR ShortName;
+ LPNET_DFS_ENTRY_ID_CONTAINER RelationInfo;
+ BOOLEAN Force;
+} *PDFS_CREATE_LOCAL_PARTITION_ARG;
+
+
+// FSCTL_DFS_DELETE_LOCAL_PARTITION Input Buffer:
+typedef struct {
+ GUID Uid;
+ LPWSTR Prefix;
+} *PDFS_DELETE_LOCAL_PARTITION_ARG;
+
+
+// FSCTL_DFS_SET_LOCAL_VOLUME_STATE Input Buffer
+typedef struct {
+ GUID Uid;
+ LPWSTR Prefix;
+ ULONG State;
+} *PDFS_SET_LOCAL_VOLUME_STATE_ARG;
+
+// FSCTL_DFS_SET_SERVER_INFO Input Buffer
+typedef struct {
+ GUID Uid;
+ LPWSTR Prefix;
+} *PDFS_SET_SERVER_INFO_ARG;
+
+
+// FSCTL_DFS_CREATE_EXIT_POINT Input Buffer
+typedef struct {
+ GUID Uid;
+ LPWSTR Prefix;
+ ULONG Type;
+} *PDFS_CREATE_EXIT_POINT_ARG;
+
+
+// FSCTL_DFS_DELETE_EXIT_POINT Input Buffer
+typedef struct {
+ GUID Uid;
+ LPWSTR Prefix;
+ ULONG Type;
+} *PDFS_DELETE_EXIT_POINT_ARG;
+
+
+// FSCTL_DFS_MODIFY_PREFIX Input Buffer
+typedef struct {
+ GUID Uid;
+ LPWSTR Prefix;
+} *PDFS_MODIFY_PREFIX_ARG;
+
+
+// FSCTL_DFS_FIX_LOCAL_VOLUME Input Buffer
+typedef struct {
+ LPWSTR VolumeName;
+ ULONG EntryType;
+ ULONG ServiceType;
+ LPWSTR StgId;
+ GUID EntryUid;
+ LPWSTR EntryPrefix;
+ LPWSTR ShortPrefix;
+ LPNET_DFS_ENTRY_ID_CONTAINER RelationInfo;
+ ULONG CreateDisposition;
+} *PDFS_FIX_LOCAL_VOLUME_ARG;
+
+
+// FSCTL_DFS_TRANSLATE_PATH Input Buffer
+typedef struct {
+ ULONG Flags;
+ UNICODE_STRING SubDirectory;
+ UNICODE_STRING ParentPathName;
+ UNICODE_STRING DfsPathName;
+} DFS_TRANSLATE_PATH_ARG, *PDFS_TRANSLATE_PATH_ARG;
+
+#define DFS_TRANSLATE_STRIP_LAST_COMPONENT 1
+
+
+// FSCTL_DFS_GET_REFERRALS Input Buffer
+typedef struct {
+ UNICODE_STRING DfsPathName;
+ ULONG MaxReferralLevel;
+} DFS_GET_REFERRALS_INPUT_ARG, *PDFS_GET_REFERRALS_INPUT_ARG;
+
+// FSCTL_DFS_GET_REFERRALS Output Buffer
+// IoStatus.Information contains the amount of data returned
+//
+// The format of the Output Buffer is simply that of RESP_GET_DFS_REFERRAL,
+// described in smbtrans.h
+//
+
+// FSCTL_DFS_REPORT_INCONSISTENCY Input Buffer
+typedef struct {
+ UNICODE_STRING DfsPathName; // DFS path having inconsistency
+ PCHAR Ref; // Actually, pointer to a DFS_REFERRAL_V1
+} DFS_REPORT_INCONSISTENCY_ARG, *PDFS_REPORT_INCONSISTENCY_ARG;
+
+// FSCTL_DFS_IS_SHARE_IN_DFS Input Buffer
+typedef struct {
+ union {
+ USHORT ServerType; // 0 == Don't know, 1 == SMB, 2 == Netware
+ USHORT ShareType; // On return, 0x1 == share is root of a Dfs
+ }; // 0x2 == share is participating in Dfs
+ UNICODE_STRING ShareName; // Name of share
+ UNICODE_STRING SharePath; // Path of the share
+} DFS_IS_SHARE_IN_DFS_ARG, *PDFS_IS_SHARE_IN_DFS_ARG;
+
+#define DFS_SHARE_TYPE_ROOT 0x1
+#define DFS_SHARE_TYPE_DFS_VOLUME 0x2
+
+//
+//FSCTL_DFS_GET_VERSION Input Buffer:
+// This fsctl returns the version number of the Dfs driver installed on the
+// machine.
+typedef struct {
+ ULONG Version;
+} DFS_GET_VERSION_ARG, *PDFS_GET_VERSION_ARG;
+
+
+// Standardized provider IDs as given in eProviderId
+
+#define PROV_ID_LOCAL_FS 0x101 // generic local file system
+#define PROV_ID_DFS_RDR 0x201 // The standard Cairo redirector
+#define PROV_ID_LM_RDR 0x202 // The usual LanMan (downlevel) redir
+
+// Provider capabilities as given in fRefCapability and fProvCapability
+#define PROV_DFS_RDR 2 // accepts NtCreateFile with EA Principal
+#define PROV_STRIP_PREFIX 4 // strip file name prefix before redispatching
+#define PROV_UNAVAILABLE 8 // provider unavailable - try to reattach.
+
+//[ dfs_define_logical_root
+//
+// Control structure for FSCTL_DFS_DEFINE_LOGICAL_ROOT
+
+#define MAX_LOGICAL_ROOT_NAME 16
+
+typedef struct _FILE_DFS_DEF_LOGICAL_ROOT_BUFFER {
+ BOOLEAN fForce;
+ WCHAR LogicalRoot[MAX_LOGICAL_ROOT_NAME];
+ WCHAR RootPrefix[1];
+} FILE_DFS_DEF_ROOT_BUFFER, *PFILE_DFS_DEF_ROOT_BUFFER;
+
+//]
+
+//[ dfs_define_root_credentials
+//
+// Control structure for FSCTL_DFS_DEFINE_ROOT_CREDENTIALS. All the strings
+// appear in Buffer in the same order as the length fields. The strings
+// are not NULL terminated. The length values are in bytes.
+//
+
+typedef struct _FILE_DFS_DEF_ROOT_CREDENTIALS {
+ USHORT Flags;
+ USHORT DomainNameLen;
+ USHORT UserNameLen;
+ USHORT PasswordLen;
+ USHORT ServerNameLen;
+ USHORT ShareNameLen;
+ USHORT RootPrefixLen;
+ WCHAR LogicalRoot[MAX_LOGICAL_ROOT_NAME];
+ WCHAR Buffer[1];
+} FILE_DFS_DEF_ROOT_CREDENTIALS, *PFILE_DFS_DEF_ROOT_CREDENTIALS;
+
+#define DFS_DEFERRED_CONNECTION 1
+#define DFS_USE_NULL_PASSWORD 2
+
+//]
+
+//----------------------------------------------------------------------------
+//
+// Everything below here is to support the old Dfs design.
+//
+
+#define EA_NAME_OPENIFJP ".OpenIfJP"
+
+#endif
diff --git a/private/inc/dhcpapi.h b/private/inc/dhcpapi.h
new file mode 100644
index 000000000..93f325fc8
--- /dev/null
+++ b/private/inc/dhcpapi.h
@@ -0,0 +1,978 @@
+/*++
+
+Copyright (c) 1993 Microsoft Corporation
+
+Module Name:
+
+ dhcpapi.h
+
+Abstract:
+
+ This file contains the DHCP APIs proto-type and description. Also
+ contains the data structures used by the DHCP APIs.
+
+Author:
+
+ Madan Appiah (madana) 12-Aug-1993
+
+Environment:
+
+ User Mode - Win32 - MIDL
+
+Revision History:
+
+ Cheng Yang (t-cheny) 18-Jun-1996 superscope
+
+--*/
+
+#ifndef _DHCPAPI_
+#define _DHCPAPI_
+
+#if defined(MIDL_PASS)
+#define LPWSTR [string] wchar_t *
+#endif
+
+//
+// DHCP data structures.
+//
+
+#ifndef _DHCP_
+
+//
+// the follwing typedef's are defined in dhcp.h also.
+//
+
+typedef DWORD DHCP_IP_ADDRESS, *PDHCP_IP_ADDRESS, *LPDHCP_IP_ADDRESS;
+typedef DWORD DHCP_OPTION_ID;
+
+typedef struct _DATE_TIME {
+ DWORD dwLowDateTime;
+ DWORD dwHighDateTime;
+} DATE_TIME, *LPDATE_TIME;
+
+#define DHCP_DATE_TIME_ZERO_HIGH 0
+#define DHCP_DATE_TIME_ZERO_LOW 0
+
+#define DHCP_DATE_TIME_INFINIT_HIGH 0x7FFFFFFF
+#define DHCP_DATE_TIME_INFINIT_LOW 0xFFFFFFFF
+
+#endif
+
+#ifdef __cplusplus
+#define DHCP_CONST const
+#else
+#define DHCP_CONST
+#endif // __cplusplus
+
+#if (_MSC_VER >= 800)
+#define DHCP_API_FUNCTION __stdcall
+#else
+#define DHCP_API_FUNCTION
+#endif
+
+//
+// RPC security.
+//
+
+#define DHCP_SERVER_SECURITY L"DhcpServerApp"
+#define DHCP_SERVER_SECURITY_AUTH_ID 10
+#define DHCP_NAMED_PIPE L"\\PIPE\\DHCPSERVER"
+#define DHCP_SERVER_PORT L""
+#define DHCP_LPC_EP L"DHCPSERVERLPC"
+
+#define DHCP_SERVER_USE_RPC_OVER_TCPIP 0x1
+#define DHCP_SERVER_USE_RPC_OVER_NP 0x2
+#define DHCP_SERVER_USE_RPC_OVER_LPC 0x4
+
+#define DHCP_SERVER_USE_RPC_OVER_ALL \
+ DHCP_SERVER_USE_RPC_OVER_TCPIP | \
+ DHCP_SERVER_USE_RPC_OVER_NP | \
+ DHCP_SERVER_USE_RPC_OVER_LPC
+
+typedef DWORD DHCP_IP_MASK;
+typedef DWORD DHCP_RESUME_HANDLE;
+
+typedef struct _DHCP_IP_RANGE {
+ DHCP_IP_ADDRESS StartAddress;
+ DHCP_IP_ADDRESS EndAddress;
+} DHCP_IP_RANGE, *LPDHCP_IP_RANGE;
+
+typedef struct _DHCP_BINARY_DATA {
+ DWORD DataLength;
+
+#if defined(MIDL_PASS)
+ [size_is(DataLength)]
+#endif // MIDL_PASS
+ BYTE *Data;
+
+} DHCP_BINARY_DATA, *LPDHCP_BINARY_DATA;
+
+typedef DHCP_BINARY_DATA DHCP_CLIENT_UID;
+
+typedef struct _DHCP_HOST_INFO {
+ DHCP_IP_ADDRESS IpAddress; // minimum information always available
+ LPWSTR NetBiosName; // optional information
+ LPWSTR HostName; // optional information
+} DHCP_HOST_INFO, *LPDHCP_HOST_INFO;
+
+//
+// Flag type that is used to delete DHCP objects.
+//
+
+typedef enum _DHCP_FORCE_FLAG {
+ DhcpFullForce,
+ DhcpNoForce
+} DHCP_FORCE_FLAG, *LPDHCP_FORCE_FLAG;
+
+//
+// DWORD_DWORD - subtitute for LARGE_INTEGER
+//
+
+typedef struct _DWORD_DWORD {
+ DWORD DWord1;
+ DWORD DWord2;
+} DWORD_DWORD, *LPDWORD_DWORD;
+
+//
+// Subnet State.
+//
+// Currently a Subnet scope can be Enabled or Disabled.
+//
+// If the state is Enabled State,
+// The server distributes address to the client, extends leases and
+// accepts releases.
+//
+// If the state is Disabled State,
+// The server does not distribute address to any new client, and does
+// extent (and sends NACK) old leases, but the servers accepts lease
+// releases.
+//
+// The idea behind this subnet state is, when the admin wants to stop
+// serving a subnet, he moves the state from Enbaled to Disabled so
+// that the clients from the subnets smoothly move to another servers
+// serving that subnet. When all or most of the clients move to
+// another server, the admin can delete the subnet without any force
+// if no client left in that subnet, otherwise the admin should use
+// full force to delete the subnet.
+//
+
+typedef enum _DHCP_SUBNET_STATE {
+ DhcpSubnetEnabled,
+ DhcpSubnetDisabled
+} DHCP_SUBNET_STATE, *LPDHCP_SUBNET_STATE;
+
+//
+// Subnet related data structures.
+//
+
+typedef struct _DHCP_SUBNET_INFO {
+ DHCP_IP_ADDRESS SubnetAddress;
+ DHCP_IP_MASK SubnetMask;
+ LPWSTR SubnetName;
+ LPWSTR SubnetComment;
+ DHCP_HOST_INFO PrimaryHost;
+ DHCP_SUBNET_STATE SubnetState;
+} DHCP_SUBNET_INFO, *LPDHCP_SUBNET_INFO;
+
+typedef struct _DHCP_IP_ARRAY {
+ DWORD NumElements;
+#if defined(MIDL_PASS)
+ [size_is(NumElements)]
+#endif // MIDL_PASS
+ LPDHCP_IP_ADDRESS Elements; //array
+} DHCP_IP_ARRAY, *LPDHCP_IP_ARRAY;
+
+typedef struct _DHCP_IP_CLUSTER {
+ DHCP_IP_ADDRESS ClusterAddress; // First IP address of the cluster.
+ DWORD ClusterMask; // Cluster usage mask, 0xFFFFFFFF
+ // indicates the cluster is fully used.
+} DHCP_IP_CLUSTER, *LPDHCP_IP_CLUSTER;
+
+typedef struct _DHCP_IP_RESERVATION {
+ DHCP_IP_ADDRESS ReservedIpAddress;
+ DHCP_CLIENT_UID *ReservedForClient;
+} DHCP_IP_RESERVATION, *LPDHCP_IP_RESERVATION;
+
+typedef enum _DHCP_SUBNET_ELEMENT_TYPE {
+ DhcpIpRanges,
+ DhcpSecondaryHosts,
+ DhcpReservedIps,
+ DhcpExcludedIpRanges,
+ DhcpIpUsedClusters // read only
+} DHCP_SUBNET_ELEMENT_TYPE, *LPDHCP_SUBNET_ELEMENT_TYPE;
+
+typedef struct _DHCP_SUBNET_ELEMENT_DATA {
+ DHCP_SUBNET_ELEMENT_TYPE ElementType;
+#if defined(MIDL_PASS)
+ [switch_is(ElementType), switch_type(DHCP_SUBNET_ELEMENT_TYPE)]
+ union _DHCP_SUBNET_ELEMENT_UNION {
+ [case(DhcpIpRanges)] DHCP_IP_RANGE *IpRange;
+ [case(DhcpSecondaryHosts)] DHCP_HOST_INFO *SecondaryHost;
+ [case(DhcpReservedIps)] DHCP_IP_RESERVATION *ReservedIp;
+ [case(DhcpExcludedIpRanges)] DHCP_IP_RANGE *ExcludeIpRange;
+ [case(DhcpIpUsedClusters)] DHCP_IP_CLUSTER *IpUsedCluster;
+ [default] ;
+ } Element;
+#else
+ union _DHCP_SUBNET_ELEMENT_UNION {
+ DHCP_IP_RANGE *IpRange;
+ DHCP_HOST_INFO *SecondaryHost;
+ DHCP_IP_RESERVATION *ReservedIp;
+ DHCP_IP_RANGE *ExcludeIpRange;
+ DHCP_IP_CLUSTER *IpUsedCluster;
+ } Element;
+#endif // MIDL_PASS
+} DHCP_SUBNET_ELEMENT_DATA, *LPDHCP_SUBNET_ELEMENT_DATA;
+
+#if !defined(MIDL_PASS)
+typedef union _DHCP_SUBNET_ELEMENT_UNION
+ DHCP_SUBNET_ELEMENT_UNION, *LPDHCP_SUBNET_ELEMENT_UNION;
+#endif
+
+typedef struct _DHCP_SUBNET_ELEMENT_INFO_ARRAY {
+ DWORD NumElements;
+#if defined(MIDL_PASS)
+ [size_is(NumElements)]
+#endif // MIDL_PASS
+ LPDHCP_SUBNET_ELEMENT_DATA Elements; //array
+} DHCP_SUBNET_ELEMENT_INFO_ARRAY, *LPDHCP_SUBNET_ELEMENT_INFO_ARRAY;
+
+//
+// DHCP Options related data structures.
+//
+
+typedef enum _DHCP_OPTION_DATA_TYPE {
+ DhcpByteOption,
+ DhcpWordOption,
+ DhcpDWordOption,
+ DhcpDWordDWordOption,
+ DhcpIpAddressOption,
+ DhcpStringDataOption,
+ DhcpBinaryDataOption,
+ DhcpEncapsulatedDataOption
+} DHCP_OPTION_DATA_TYPE, *LPDHCP_OPTION_DATA_TYPE;
+
+
+typedef struct _DHCP_OPTION_DATA_ELEMENT {
+ DHCP_OPTION_DATA_TYPE OptionType;
+#if defined(MIDL_PASS)
+ [switch_is(OptionType), switch_type(DHCP_OPTION_DATA_TYPE)]
+ union _DHCP_OPTION_ELEMENT_UNION {
+ [case(DhcpByteOption)] BYTE ByteOption;
+ [case(DhcpWordOption)] WORD WordOption;
+ [case(DhcpDWordOption)] DWORD DWordOption;
+ [case(DhcpDWordDWordOption)] DWORD_DWORD DWordDWordOption;
+ [case(DhcpIpAddressOption)] DHCP_IP_ADDRESS IpAddressOption;
+ [case(DhcpStringDataOption)] LPWSTR StringDataOption;
+ [case(DhcpBinaryDataOption)] DHCP_BINARY_DATA BinaryDataOption;
+ [case(DhcpEncapsulatedDataOption)] DHCP_BINARY_DATA EncapsulatedDataOption;
+ [default] ;
+ } Element;
+#else
+ union _DHCP_OPTION_ELEMENT_UNION {
+ BYTE ByteOption;
+ WORD WordOption;
+ DWORD DWordOption;
+ DWORD_DWORD DWordDWordOption;
+ DHCP_IP_ADDRESS IpAddressOption;
+ LPWSTR StringDataOption;
+ DHCP_BINARY_DATA BinaryDataOption;
+ DHCP_BINARY_DATA EncapsulatedDataOption;
+ // for vendor specific information option.
+ } Element;
+#endif // MIDL_PASS
+} DHCP_OPTION_DATA_ELEMENT, *LPDHCP_OPTION_DATA_ELEMENT;
+
+#if !defined(MIDL_PASS)
+typedef union _DHCP_OPTION_ELEMENT_UNION
+ DHCP_OPTION_ELEMENT_UNION, *LPDHCP_OPTION_ELEMENT_UNION;
+#endif
+
+typedef struct _DHCP_OPTION_DATA {
+ DWORD NumElements; // number of option elements in the pointed array
+#if defined(MIDL_PASS)
+ [size_is(NumElements)]
+#endif // MIDL_PASS
+ LPDHCP_OPTION_DATA_ELEMENT Elements; //array
+} DHCP_OPTION_DATA, *LPDHCP_OPTION_DATA;
+
+typedef enum _DHCP_OPTION_TYPE {
+ DhcpUnaryElementTypeOption,
+ DhcpArrayTypeOption
+} DHCP_OPTION_TYPE, *LPDHCP_OPTION_TYPE;
+
+typedef struct _DHCP_OPTION {
+ DHCP_OPTION_ID OptionID;
+ LPWSTR OptionName;
+ LPWSTR OptionComment;
+ DHCP_OPTION_DATA DefaultValue;
+ DHCP_OPTION_TYPE OptionType;
+} DHCP_OPTION, *LPDHCP_OPTION;
+
+typedef struct _DHCP_OPTION_ARRAY {
+ DWORD NumElements; // number of options in the pointed array
+#if defined(MIDL_PASS)
+ [size_is(NumElements)]
+#endif // MIDL_PASS
+ LPDHCP_OPTION Options; // array
+} DHCP_OPTION_ARRAY, *LPDHCP_OPTION_ARRAY;
+
+typedef struct _DHCP_OPTION_VALUE {
+ DHCP_OPTION_ID OptionID;
+ DHCP_OPTION_DATA Value;
+} DHCP_OPTION_VALUE, *LPDHCP_OPTION_VALUE;
+
+typedef struct _DHCP_OPTION_VALUE_ARRAY {
+ DWORD NumElements; // number of options in the pointed array
+#if defined(MIDL_PASS)
+ [size_is(NumElements)]
+#endif // MIDL_PASS
+ LPDHCP_OPTION_VALUE Values; // array
+} DHCP_OPTION_VALUE_ARRAY, *LPDHCP_OPTION_VALUE_ARRAY;
+
+typedef enum _DHCP_OPTION_SCOPE_TYPE {
+ DhcpDefaultOptions,
+ DhcpGlobalOptions,
+ DhcpSubnetOptions,
+ DhcpReservedOptions
+} DHCP_OPTION_SCOPE_TYPE, *LPDHCP_OPTION_SCOPE_TYPE;
+
+typedef struct _DHCP_RESERVED_SCOPE {
+ DHCP_IP_ADDRESS ReservedIpAddress;
+ DHCP_IP_ADDRESS ReservedIpSubnetAddress;
+} DHCP_RESERVED_SCOPE, *LPDHCP_RESERVED_SCOPE;
+
+typedef struct _DHCP_OPTION_SCOPE_INFO {
+ DHCP_OPTION_SCOPE_TYPE ScopeType;
+#if defined(MIDL_PASS)
+ [switch_is(ScopeType), switch_type(DHCP_OPTION_SCOPE_TYPE)]
+ union _DHCP_OPTION_SCOPE_UNION {
+ [case(DhcpDefaultOptions)] ; // PVOID DefaultScopeInfo;
+ [case(DhcpGlobalOptions)] ; // PVOID GlobalScopeInfo;
+ [case(DhcpSubnetOptions)] DHCP_IP_ADDRESS SubnetScopeInfo;
+ [case(DhcpReservedOptions)] DHCP_RESERVED_SCOPE ReservedScopeInfo;
+ [default] ;
+ } ScopeInfo;
+#else
+ union _DHCP_OPTION_SCOPE_UNION {
+ PVOID DefaultScopeInfo; // must be NULL
+ PVOID GlobalScopeInfo; // must be NULL
+ DHCP_IP_ADDRESS SubnetScopeInfo;
+ DHCP_RESERVED_SCOPE ReservedScopeInfo;
+ } ScopeInfo;
+#endif // MIDL_PASS
+} DHCP_OPTION_SCOPE_INFO, *LPDHCP_OPTION_SCOPE_INFO;
+
+#if !defined(MIDL_PASS)
+typedef union _DHCP_OPTION_SCOPE_UNION
+ DHCP_OPTION_SCOPE_UNION, *LPDHCP_OPTION_SCOPE_UNION;
+#endif
+
+typedef struct _DHCP_OPTION_LIST {
+ DWORD NumOptions;
+#if defined(MIDL_PASS)
+ [size_is(NumOptions)]
+#endif // MIDL_PASS
+ DHCP_OPTION_VALUE *Options; // array
+} DHCP_OPTION_LIST, *LPDHCP_OPTION_LIST;
+
+//
+// DHCP Client information data structures
+//
+
+typedef struct _DHCP_CLIENT_INFO {
+ DHCP_IP_ADDRESS ClientIpAddress; // currently assigned IP address.
+ DHCP_IP_MASK SubnetMask;
+ DHCP_CLIENT_UID ClientHardwareAddress;
+ LPWSTR ClientName; // optional.
+ LPWSTR ClientComment;
+ DATE_TIME ClientLeaseExpires; // UTC time in FILE_TIME format.
+ DHCP_HOST_INFO OwnerHost; // host that distributed this IP address.
+} DHCP_CLIENT_INFO, *LPDHCP_CLIENT_INFO;
+
+typedef struct _DHCP_CLIENT_INFO_ARRAY {
+ DWORD NumElements;
+#if defined(MIDL_PASS)
+ [size_is(NumElements)]
+#endif // MIDL_PASS
+ LPDHCP_CLIENT_INFO *Clients; // array of pointers
+} DHCP_CLIENT_INFO_ARRAY, *LPDHCP_CLIENT_INFO_ARRAY;
+
+typedef enum _DHCP_CLIENT_SEARCH_TYPE {
+ DhcpClientIpAddress,
+ DhcpClientHardwareAddress,
+ DhcpClientName
+} DHCP_SEARCH_INFO_TYPE, *LPDHCP_SEARCH_INFO_TYPE;
+
+typedef struct _DHCP_CLIENT_SEARCH_INFO {
+ DHCP_SEARCH_INFO_TYPE SearchType;
+#if defined(MIDL_PASS)
+ [switch_is(SearchType), switch_type(DHCP_SEARCH_INFO_TYPE)]
+ union _DHCP_CLIENT_SEARCH_UNION {
+ [case(DhcpClientIpAddress)] DHCP_IP_ADDRESS ClientIpAddress;
+ [case(DhcpClientHardwareAddress)] DHCP_CLIENT_UID ClientHardwareAddress;
+ [case(DhcpClientName)] LPWSTR ClientName;
+ [default] ;
+ } SearchInfo;
+#else
+ union _DHCP_CLIENT_SEARCH_UNION {
+ DHCP_IP_ADDRESS ClientIpAddress;
+ DHCP_CLIENT_UID ClientHardwareAddress;
+ LPWSTR ClientName;
+ } SearchInfo;
+#endif // MIDL_PASS
+} DHCP_SEARCH_INFO, *LPDHCP_SEARCH_INFO;
+
+
+#if !defined(MIDL_PASS)
+typedef union _DHCP_CLIENT_SEARCH_UNION
+ DHCP_CLIENT_SEARCH_UNION, *LPDHCP_CLIENT_SEARCH_UNION;
+#endif // MIDL_PASS
+
+//
+// Mib Info structures.
+//
+
+typedef struct _SCOPE_MIB_INFO {
+ DHCP_IP_ADDRESS Subnet;
+ DWORD NumAddressesInuse;
+ DWORD NumAddressesFree;
+ DWORD NumPendingOffers;
+} SCOPE_MIB_INFO, *LPSCOPE_MIB_INFO;
+
+typedef struct _DHCP_MIB_INFO {
+ DWORD Discovers;
+ DWORD Offers;
+ DWORD Requests;
+ DWORD Acks;
+ DWORD Naks;
+ DWORD Declines;
+ DWORD Releases;
+ DATE_TIME ServerStartTime;
+ DWORD Scopes;
+#if defined(MIDL_PASS)
+ [size_is(Scopes)]
+#endif // MIDL_PASS
+ LPSCOPE_MIB_INFO ScopeInfo; // array.
+} DHCP_MIB_INFO, *LPDHCP_MIB_INFO;
+
+#define Set_APIProtocolSupport 0x00000001
+#define Set_DatabaseName 0x00000002
+#define Set_DatabasePath 0x00000004
+#define Set_BackupPath 0x00000008
+#define Set_BackupInterval 0x00000010
+#define Set_DatabaseLoggingFlag 0x00000020
+#define Set_RestoreFlag 0x00000040
+#define Set_DatabaseCleanupInterval 0x00000080
+#define Set_DebugFlag 0x00000100
+#define Set_PingRetries 0x00000200
+#define Set_BootFileTable 0x00000400
+#define Set_AuditLogState 0x00000800
+
+typedef struct _DHCP_SERVER_CONFIG_INFO {
+ DWORD APIProtocolSupport; // bit map of the protocols supported.
+ LPWSTR DatabaseName; // JET database name.
+ LPWSTR DatabasePath; // JET database path.
+ LPWSTR BackupPath; // Backup path.
+ DWORD BackupInterval; // Backup interval in mins.
+ DWORD DatabaseLoggingFlag; // Boolean database logging flag.
+ DWORD RestoreFlag; // Boolean database restore flag.
+ DWORD DatabaseCleanupInterval; // Database Cleanup Interval in mins.
+ DWORD DebugFlag; // Bit map of server debug flags.
+} DHCP_SERVER_CONFIG_INFO, *LPDHCP_SERVER_CONFIG_INFO;
+
+typedef enum _DHCP_SCAN_FLAG {
+ DhcpRegistryFix,
+ DhcpDatabaseFix
+} DHCP_SCAN_FLAG, *LPDHCP_SCAN_FLAG;
+
+typedef struct _DHCP_SCAN_ITEM {
+ DHCP_IP_ADDRESS IpAddress;
+ DHCP_SCAN_FLAG ScanFlag;
+} DHCP_SCAN_ITEM, *LPDHCP_SCAN_ITEM;
+
+typedef struct _DHCP_SCAN_LIST {
+ DWORD NumScanItems;
+#if defined(MIDL_PASS)
+ [size_is(NumScanItems)]
+#endif // MIDL_PASS
+ DHCP_SCAN_ITEM *ScanItems; // array
+} DHCP_SCAN_LIST, *LPDHCP_SCAN_LIST;
+
+//
+// API proto types
+//
+
+//
+// Subnet APIs
+//
+
+DWORD DHCP_API_FUNCTION
+DhcpCreateSubnet(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_IP_ADDRESS SubnetAddress,
+ DHCP_CONST DHCP_SUBNET_INFO * SubnetInfo
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpSetSubnetInfo(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_IP_ADDRESS SubnetAddress,
+ DHCP_CONST DHCP_SUBNET_INFO * SubnetInfo
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpGetSubnetInfo(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_IP_ADDRESS SubnetAddress,
+ LPDHCP_SUBNET_INFO * SubnetInfo
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpEnumSubnets(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_RESUME_HANDLE *ResumeHandle,
+ DWORD PreferredMaximum,
+ LPDHCP_IP_ARRAY *EnumInfo,
+ DWORD *ElementsRead,
+ DWORD *ElementsTotal
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpAddSubnetElement(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_IP_ADDRESS SubnetAddress,
+ DHCP_CONST DHCP_SUBNET_ELEMENT_DATA * AddElementInfo
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpEnumSubnetElements(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_IP_ADDRESS SubnetAddress,
+ DHCP_SUBNET_ELEMENT_TYPE EnumElementType,
+ DHCP_RESUME_HANDLE *ResumeHandle,
+ DWORD PreferredMaximum,
+ LPDHCP_SUBNET_ELEMENT_INFO_ARRAY *EnumElementInfo,
+ DWORD *ElementsRead,
+ DWORD *ElementsTotal
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpRemoveSubnetElement(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_IP_ADDRESS SubnetAddress,
+ DHCP_CONST DHCP_SUBNET_ELEMENT_DATA * RemoveElementInfo,
+ DHCP_FORCE_FLAG ForceFlag
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpDeleteSubnet(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_IP_ADDRESS SubnetAddress,
+ DHCP_FORCE_FLAG ForceFlag
+ );
+
+//
+// Option APIs
+//
+
+DWORD DHCP_API_FUNCTION
+DhcpCreateOption(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_OPTION_ID OptionID,
+ DHCP_CONST DHCP_OPTION * OptionInfo
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpSetOptionInfo(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_OPTION_ID OptionID,
+ DHCP_CONST DHCP_OPTION * OptionInfo
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpGetOptionInfo(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_OPTION_ID OptionID,
+ LPDHCP_OPTION *OptionInfo
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpEnumOptions(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_RESUME_HANDLE *ResumeHandle,
+ DWORD PreferredMaximum,
+ LPDHCP_OPTION_ARRAY *Options,
+ DWORD *OptionsRead,
+ DWORD *OptionsTotal
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpRemoveOption(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_OPTION_ID OptionID
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpSetOptionValue(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_OPTION_ID OptionID,
+ DHCP_CONST DHCP_OPTION_SCOPE_INFO * ScopeInfo,
+ DHCP_CONST DHCP_OPTION_DATA * OptionValue
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpSetOptionValues(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_CONST DHCP_OPTION_SCOPE_INFO * ScopeInfo,
+ DHCP_CONST DHCP_OPTION_VALUE_ARRAY * OptionValues
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpGetOptionValue(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_OPTION_ID OptionID,
+ DHCP_CONST DHCP_OPTION_SCOPE_INFO *ScopeInfo,
+ LPDHCP_OPTION_VALUE *OptionValue
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpEnumOptionValues(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_CONST DHCP_OPTION_SCOPE_INFO *ScopeInfo,
+ DHCP_RESUME_HANDLE *ResumeHandle,
+ DWORD PreferredMaximum,
+ LPDHCP_OPTION_VALUE_ARRAY *OptionValues,
+ DWORD *OptionsRead,
+ DWORD *OptionsTotal
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpRemoveOptionValue(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_OPTION_ID OptionID,
+ DHCP_CONST DHCP_OPTION_SCOPE_INFO * ScopeInfo
+ );
+
+//
+// Client APIs
+//
+
+DWORD DHCP_API_FUNCTION
+DhcpCreateClientInfo(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_CONST DHCP_CLIENT_INFO *ClientInfo
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpSetClientInfo(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_CONST DHCP_CLIENT_INFO *ClientInfo
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpGetClientInfo(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_CONST DHCP_SEARCH_INFO *SearchInfo,
+ LPDHCP_CLIENT_INFO *ClientInfo
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpDeleteClientInfo(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_CONST DHCP_SEARCH_INFO *ClientInfo
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpEnumSubnetClients(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_IP_ADDRESS SubnetAddress,
+ DHCP_RESUME_HANDLE *ResumeHandle,
+ DWORD PreferredMaximum,
+ LPDHCP_CLIENT_INFO_ARRAY *ClientInfo,
+ DWORD *ClientsRead,
+ DWORD *ClientsTotal
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpGetClientOptions(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_IP_ADDRESS ClientIpAddress,
+ DHCP_IP_MASK ClientSubnetMask,
+ LPDHCP_OPTION_LIST *ClientOptions
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpGetMibInfo(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ LPDHCP_MIB_INFO *MibInfo
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpServerSetConfig(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DWORD FieldsToSet,
+ LPDHCP_SERVER_CONFIG_INFO ConfigInfo
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpServerGetConfig(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ LPDHCP_SERVER_CONFIG_INFO *ConfigInfo
+ );
+
+
+DWORD DHCP_API_FUNCTION
+DhcpScanDatabase(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_IP_ADDRESS SubnetAddress,
+ DWORD FixFlag,
+ LPDHCP_SCAN_LIST *ScanList
+ );
+
+VOID DHCP_API_FUNCTION
+DhcpRpcFreeMemory(
+ PVOID BufferPointer
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpGetVersion(
+ LPWSTR ServerIpAddress,
+ LPDWORD MajorVersion,
+ LPDWORD MinorVersion
+ );
+
+//
+// new structures for NT4SP1
+//
+
+typedef struct _DHCP_IP_RESERVATION_V4 {
+ DHCP_IP_ADDRESS ReservedIpAddress;
+ DHCP_CLIENT_UID *ReservedForClient;
+ BYTE bAllowedClientTypes;
+} DHCP_IP_RESERVATION_V4, *LPDHCP_IP_RESERVATION_V4;
+
+typedef struct _DHCP_SUBNET_ELEMENT_DATA_V4 {
+ DHCP_SUBNET_ELEMENT_TYPE ElementType;
+#if defined(MIDL_PASS)
+ [switch_is(ElementType), switch_type(DHCP_SUBNET_ELEMENT_TYPE)]
+ union _DHCP_SUBNET_ELEMENT_UNION_V4 {
+ [case(DhcpIpRanges)] DHCP_IP_RANGE *IpRange;
+ [case(DhcpSecondaryHosts)] DHCP_HOST_INFO *SecondaryHost;
+ [case(DhcpReservedIps)] DHCP_IP_RESERVATION_V4 *ReservedIp;
+ [case(DhcpExcludedIpRanges)] DHCP_IP_RANGE *ExcludeIpRange;
+ [case(DhcpIpUsedClusters)] DHCP_IP_CLUSTER *IpUsedCluster;
+ [default] ;
+ } Element;
+#else
+ union _DHCP_SUBNET_ELEMENT_UNION_V4 {
+ DHCP_IP_RANGE *IpRange;
+ DHCP_HOST_INFO *SecondaryHost;
+ DHCP_IP_RESERVATION_V4 *ReservedIp;
+ DHCP_IP_RANGE *ExcludeIpRange;
+ DHCP_IP_CLUSTER *IpUsedCluster;
+ } Element;
+#endif // MIDL_PASS
+} DHCP_SUBNET_ELEMENT_DATA_V4, *LPDHCP_SUBNET_ELEMENT_DATA_V4;
+
+#if !defined(MIDL_PASS)
+typedef union _DHCP_SUBNET_ELEMENT_UNION_V4
+ DHCP_SUBNET_ELEMENT_UNION_V4, *LPDHCP_SUBNET_ELEMENT_UNION_V4;
+#endif
+
+typedef struct _DHCP_SUBNET_ELEMENT_INFO_ARRAY_V4 {
+ DWORD NumElements;
+#if defined(MIDL_PASS)
+ [size_is(NumElements)]
+#endif // MIDL_PASS
+ LPDHCP_SUBNET_ELEMENT_DATA_V4 Elements; //array
+} DHCP_SUBNET_ELEMENT_INFO_ARRAY_V4, *LPDHCP_SUBNET_ELEMENT_INFO_ARRAY_V4;
+
+
+// DHCP_CLIENT_INFO:bClientType
+
+#define CLIENT_TYPE_UNSPECIFIED 0x0 // for backward compatibility
+#define CLIENT_TYPE_DHCP 0x1
+#define CLIENT_TYPE_BOOTP 0x2
+#define CLIENT_TYPE_BOTH ( CLIENT_TYPE_DHCP | CLIENT_TYPE_BOOTP )
+#define CLIENT_TYPE_NONE 0x64
+#define BOOT_FILE_STRING_DELIMITER ','
+#define BOOT_FILE_STRING_DELIMITER_W L','
+
+
+typedef struct _DHCP_CLIENT_INFO_V4 {
+ DHCP_IP_ADDRESS ClientIpAddress; // currently assigned IP address.
+ DHCP_IP_MASK SubnetMask;
+ DHCP_CLIENT_UID ClientHardwareAddress;
+ LPWSTR ClientName; // optional.
+ LPWSTR ClientComment;
+ DATE_TIME ClientLeaseExpires; // UTC time in FILE_TIME format.
+ DHCP_HOST_INFO OwnerHost; // host that distributed this IP address.
+ //
+ // new fields for NT4SP1
+ //
+
+ BYTE bClientType; // CLIENT_TYPE_DHCP | CLIENT_TYPE_BOOTP |
+ // CLIENT_TYPE_NONE
+} DHCP_CLIENT_INFO_V4, *LPDHCP_CLIENT_INFO_V4;
+
+typedef struct _DHCP_CLIENT_INFO_ARRAY_V4 {
+ DWORD NumElements;
+#if defined(MIDL_PASS)
+ [size_is(NumElements)]
+#endif // MIDL_PASS
+ LPDHCP_CLIENT_INFO_V4 *Clients; // array of pointers
+} DHCP_CLIENT_INFO_ARRAY_V4, *LPDHCP_CLIENT_INFO_ARRAY_V4;
+
+
+typedef struct _DHCP_SERVER_CONFIG_INFO_V4 {
+ DWORD APIProtocolSupport; // bit map of the protocols supported.
+ LPWSTR DatabaseName; // JET database name.
+ LPWSTR DatabasePath; // JET database path.
+ LPWSTR BackupPath; // Backup path.
+ DWORD BackupInterval; // Backup interval in mins.
+ DWORD DatabaseLoggingFlag; // Boolean database logging flag.
+ DWORD RestoreFlag; // Boolean database restore flag.
+ DWORD DatabaseCleanupInterval; // Database Cleanup Interval in mins.
+ DWORD DebugFlag; // Bit map of server debug flags.
+
+ // new fields for NT4 SP1
+
+ DWORD dwPingRetries; // valid range: 0-5 inclusive
+ DWORD cbBootTableString;
+#if defined( MIDL_PASS )
+ [ size_is( cbBootTableString ) ]
+#endif
+ WCHAR *wszBootTableString;
+ BOOL fAuditLog; // TRUE to enable audit log
+
+} DHCP_SERVER_CONFIG_INFO_V4, *LPDHCP_SERVER_CONFIG_INFO_V4;
+
+
+//
+// superscope info structure (added by t-cheny)
+//
+
+typedef struct _DHCP_SUPER_SCOPE_TABLE_ENTRY {
+ DHCP_IP_ADDRESS SubnetAddress; // subnet address
+ DWORD SuperScopeNumber; // super scope group number
+ DWORD NextInSuperScope; // index of the next subnet in the superscope
+ LPWSTR SuperScopeName; // super scope name
+ // NULL indicates no superscope membership.
+} DHCP_SUPER_SCOPE_TABLE_ENTRY, *LPDHCP_SUPER_SCOPE_TABLE_ENTRY;
+
+
+typedef struct _DHCP_SUPER_SCOPE_TABLE
+{
+ DWORD cEntries;
+#if defined( MIDL_PASS )
+ [ size_is( cEntries ) ]
+#endif;
+ DHCP_SUPER_SCOPE_TABLE_ENTRY *pEntries;
+} DHCP_SUPER_SCOPE_TABLE, *LPDHCP_SUPER_SCOPE_TABLE;
+
+//
+// NT4SP1 RPC interface
+//
+
+DWORD DHCP_API_FUNCTION
+DhcpAddSubnetElementV4(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_IP_ADDRESS SubnetAddress,
+ DHCP_CONST DHCP_SUBNET_ELEMENT_DATA_V4 * AddElementInfo
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpEnumSubnetElementsV4(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_IP_ADDRESS SubnetAddress,
+ DHCP_SUBNET_ELEMENT_TYPE EnumElementType,
+ DHCP_RESUME_HANDLE *ResumeHandle,
+ DWORD PreferredMaximum,
+ LPDHCP_SUBNET_ELEMENT_INFO_ARRAY_V4 *EnumElementInfo,
+ DWORD *ElementsRead,
+ DWORD *ElementsTotal
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpRemoveSubnetElementV4(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_IP_ADDRESS SubnetAddress,
+ DHCP_CONST DHCP_SUBNET_ELEMENT_DATA_V4 * RemoveElementInfo,
+ DHCP_FORCE_FLAG ForceFlag
+ );
+
+
+ DWORD DHCP_API_FUNCTION
+DhcpCreateClientInfoV4(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_CONST DHCP_CLIENT_INFO_V4 *ClientInfo
+ );
+
+
+DWORD DHCP_API_FUNCTION
+DhcpSetClientInfoV4(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_CONST DHCP_CLIENT_INFO_V4 *ClientInfo
+ );
+
+
+DWORD DHCP_API_FUNCTION
+DhcpGetClientInfoV4(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_CONST DHCP_SEARCH_INFO *SearchInfo,
+ LPDHCP_CLIENT_INFO_V4 *ClientInfo
+ );
+
+
+DWORD DHCP_API_FUNCTION
+DhcpEnumSubnetClientsV4(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_IP_ADDRESS SubnetAddress,
+ DHCP_RESUME_HANDLE *ResumeHandle,
+ DWORD PreferredMaximum,
+ LPDHCP_CLIENT_INFO_ARRAY_V4 *ClientInfo,
+ DWORD *ClientsRead,
+ DWORD *ClientsTotal
+ );
+
+
+DWORD DHCP_API_FUNCTION
+DhcpServerSetConfigV4(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DWORD FieldsToSet,
+ LPDHCP_SERVER_CONFIG_INFO_V4 ConfigInfo
+ );
+
+DWORD DHCP_API_FUNCTION
+DhcpServerGetConfigV4(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ LPDHCP_SERVER_CONFIG_INFO_V4 *ConfigInfo
+ );
+
+
+DWORD
+DhcpSetSuperScopeV4(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_CONST DHCP_IP_ADDRESS SubnetAddress,
+ DHCP_CONST LPWSTR SuperScopeName,
+ DHCP_CONST BOOL ChangeExisting
+ );
+
+DWORD
+DhcpDeleteSuperScopeV4(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ DHCP_CONST LPWSTR SuperScopeName
+ );
+
+DWORD
+DhcpGetSuperScopeInfoV4(
+ DHCP_CONST WCHAR *ServerIpAddress,
+ LPDHCP_SUPER_SCOPE_TABLE *SuperScopeTable
+ );
+
+
+
+
+#endif // _DHCPAPI_
+
diff --git a/private/inc/dhcpcapi.h b/private/inc/dhcpcapi.h
new file mode 100644
index 000000000..3efbd4285
--- /dev/null
+++ b/private/inc/dhcpcapi.h
@@ -0,0 +1,145 @@
+/*++
+
+Copyright (c) 1992 Microsoft Corporation
+
+Module Name:
+
+ dhcpcapi.h
+
+Abstract:
+
+ This file contains function proto types for the DHCP CONFIG API
+ functions.
+
+Author:
+
+ Madan Appiah (madana) Dec-22-1993
+
+Environment:
+
+ User Mode - Win32
+
+Revision History:
+
+
+--*/
+
+#ifndef _DHCPCAPI_
+#define _DHCPCAPI_
+
+typedef enum _SERVICE_ENABLE {
+ IgnoreFlag,
+ DhcpEnable,
+ DhcpDisable
+} SERVICE_ENABLE, *LPSERVICE_ENABLE;
+
+DWORD
+APIENTRY
+DhcpAcquireParameters(
+ LPWSTR AdapterName
+ );
+
+DWORD
+APIENTRY
+DhcpReleaseParameters(
+ LPWSTR AdapterName
+ );
+
+DWORD
+APIENTRY
+DhcpEnableDynamicConfig(
+ LPWSTR AdapterName
+ );
+
+DWORD
+APIENTRY
+DhcpDisableDynamicConfig(
+ LPWSTR AdapterName
+ );
+
+DWORD
+APIENTRY
+DhcpNotifyConfigChange(
+ LPWSTR ServerName,
+ LPWSTR AdapterName,
+ BOOL IsNewIpAddress,
+ DWORD IpIndex,
+ DWORD IpAddress,
+ DWORD SubnetMask,
+ SERVICE_ENABLE DhcpServiceEnabled
+ );
+
+DWORD
+DhcpQueryHWInfo(
+ DWORD IpInterfaceContext,
+ DWORD *pIpInterfaceInstance,
+ LPBYTE HardwareAddressType,
+ LPBYTE *HardwareAddress,
+ LPDWORD HardwareAddressLength
+ );
+
+//
+// IP address lease apis for RAS .
+//
+
+
+
+typedef struct _DHCP_CLIENT_UID {
+ LPBYTE ClientUID;
+ DWORD ClientUIDLength;
+} DHCP_CLIENT_UID, *LPDHCP_CLIENT_UID;
+
+typedef struct _DHCP_LEASE_INFO {
+ DHCP_CLIENT_UID ClientUID;
+ DWORD IpAddress;
+ DWORD SubnetMask;
+ DWORD DhcpServerAddress;
+ DWORD Lease;
+ long LeaseObtained;
+ long T1Time;
+ long T2Time;
+ long LeaseExpires;
+} DHCP_LEASE_INFO, *LPDHCP_LEASE_INFO;
+
+typedef struct _DHCP_OPTION_DATA {
+ DWORD OptionID;
+ DWORD OptionLen;
+ LPBYTE Option;
+} DHCP_OPTION_DATA, *LPDHCP_OPTION_DATA;
+
+typedef struct _DHCP_OPTION_INFO {
+ DWORD NumOptions;
+ LPDHCP_OPTION_DATA OptionDataArray;
+} DHCP_OPTION_INFO, *LPDHCP_OPTION_INFO;
+
+
+typedef struct _DHCP_OPTION_LIST {
+ DWORD NumOptions;
+ LPWORD OptionIDArray;
+} DHCP_OPTION_LIST, *LPDHCP_OPTION_LIST;
+
+DWORD
+DhcpLeaseIpAddress(
+ DWORD AdapterIpAddress,
+ LPDHCP_CLIENT_UID ClientUID,
+ DWORD DesiredIpAddress,
+ LPDHCP_OPTION_LIST OptionList,
+ LPDHCP_LEASE_INFO *LeaseInfo,
+ LPDHCP_OPTION_INFO *OptionInfo
+ );
+
+DWORD
+DhcpRenewIpAddressLease(
+ DWORD AdapterIpAddress,
+ LPDHCP_LEASE_INFO ClientLeaseInfo,
+ LPDHCP_OPTION_LIST OptionList,
+ LPDHCP_OPTION_INFO *OptionInfo
+ );
+
+DWORD
+DhcpReleaseIpAddressLease(
+ DWORD AdapterIpAddress,
+ LPDHCP_LEASE_INFO ClientLeaseInfo
+ );
+
+#endif
diff --git a/private/inc/dlcio.h b/private/inc/dlcio.h
new file mode 100644
index 000000000..79a709ca3
--- /dev/null
+++ b/private/inc/dlcio.h
@@ -0,0 +1,805 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+ (c) 1991 Nokia Data Systems AB
+
+Module Name:
+
+ ntccbs.h
+
+Abstract:
+
+ This file defines the internal DLC API data structures used by
+ Windows/NT DLC. Most parameter structures are copied directly,
+ but here are also defined some new structures for internal use.
+
+Author:
+
+ Antti Saarenheimo [o-anttis] 6-JUNE-1991
+
+Revision History:
+
+--*/
+
+/*
+ The commands in alphanumeric order (just saved here)
+
+LLC_BUFFER_CREATE 0x0025
+LLC_BUFFER_FREE 0x0027
+LLC_BUFFER_GET 0x0026
+LLC_DIR_CLOSE_ADAPTER 0x0004
+LLC_DIR_CLOSE_DIRECT 0x0034
+LLC_DIR_INITIALIZE 0x0020
+LLC_DIR_INTERRUPT 0x0000
+LLC_DIR_OPEN_ADAPTER 0x0003
+LLC_DIR_OPEN_DIRECT 0x0035
+LLC_DIR_READ_LOG 0x0008
+LLC_DIR_SET_EXCEPTION_FLAGS 0x002D
+LLC_DIR_SET_FUNCTIONAL_ADDRESS 0x0007
+LLC_DIR_SET_GROUP_ADDRESS 0x0006
+LLC_DIR_STATUS 0x0021
+LLC_DIR_TIMER_CANCEL 0x0023
+LLC_DIR_TIMER_CANCEL_GROUP 0x002C
+LLC_DIR_TIMER_SET 0x0022
+LLC_DLC_CLOSE_SAP 0x0016
+LLC_DLC_CLOSE_STATION 0x001A
+LLC_DLC_CONNECT_STATION 0x001B
+LLC_DLC_FLOW_CONTROL 0x001D
+LLC_DLC_MODIFY 0x001C
+LLC_DLC_OPEN_SAP 0x0015
+LLC_DLC_OPEN_STATION 0x0019
+LLC_DLC_REALLOCATE_STATIONS 0x0017
+LLC_DLC_RESET 0x0014
+LLC_DLC_SET_THRESHOLD 0x0033
+LLC_DLC_STATISTICS 0x001E
+LLC_READ 0x0031
+LLC_READ_CANCEL 0x0032
+LLC_RECEIVE 0x0028
+LLC_RECEIVE_CANCEL 0x0029
+LLC_RECEIVE_MODIFY 0x002A
+LLC_TRANSMIT_DIR_FRAME 0x000A
+LLC_TRANSMIT_FRAMES 0x0009
+LLC_TRANSMIT_I_FRAME 0x000B
+LLC_TRANSMIT_TEST_CMD 0x0011
+LLC_TRANSMIT_UI_FRAME 0x000D
+LLC_TRANSMIT_XID_CMD 0x000E
+LLC_TRANSMIT_XID_RESP_FINAL 0x000F
+LLC_TRANSMIT_XID_RESP_NOT_FINAL 0x0010
+
+*/
+
+//
+// Change this version number whenever the driver-acslan api has
+// been changed or both modules must be changed.
+//
+#define NT_DLC_IOCTL_VERSION 1
+
+//
+// Defines the maximum number of buffer segments used in a transmit.
+// Max IBM token-ring frame may consist about 72 buffers ((18 * 4) * 256),
+// if the application uses 256 bytes as its buffer size.
+//
+#define MAX_TRANSMIT_SEGMENTS 128 // takes about 1 kB in stack!!!
+
+//
+// We use three different CCB structures: the first one is needed
+// to allocate space for whole ccb, if READ and RECEIVE parameter table
+// is catenated to CCB structure (=> we have only one output buffer).
+// The second input CCB buffer is used with the commands having no
+// input parameters except those in CCB parameter table field
+// (all close commands, DirTimerSet).
+// The last buffer is always returned by asynchronous dlc commands.
+//
+typedef struct _NT_DLC_CCB {
+ IN UCHAR uchAdapterNumber; // Adapter 0 or 1
+ IN UCHAR uchDlcCommand; // DLC command
+ OUT UCHAR uchDlcStatus; // DLC command completion code
+ OUT UCHAR uchInformation; // # successful transmits
+ IN PVOID pCcbAddress;
+ IN ULONG CommandCompletionFlag;
+ union {
+ IN PLLC_PARMS pParameterTable; // pointer to the parameter table
+ IN PVOID pMdl;
+ struct {
+ IN USHORT usStationId; // Station id
+ IN USHORT usParameter; // optional parameter
+ } dlc;
+ struct {
+ IN USHORT usParameter0; // first optional parameter
+ IN USHORT usParameter1; // second optional parameter
+ } dir;
+ IN UCHAR auchBuffer[4]; // group/functional address
+ IN ULONG ulParameter;
+ } u;
+ ULONG Reserved1;
+ ULONG Reserved2;
+
+// (I am still thinking about this):
+//
+// The multiple frame transmit should return the number a successfully
+// sent frames or otherwise it's not useable for higher protocols.
+// We should actually free the transmit buffers only as far as the
+// transmits succeeds. The buffers should not be released after the
+// first error, because then the data would be lost for ever. The only thing
+// the user need to know is how many sequestial frames were sent successfully.
+// The number is also the index of the first failed frame, when one
+// of the frames fails. The frames are not necessary completed in
+// same order, because the error may happed in DlcTransmit, LlcSendX or
+// asynchronoulsy (eg. link lost) => we need the index of the first
+// failing frame. The frame must not be released, if its index is higher
+// than that of the first failed frame. A new error (async) be overwrite
+// an earlier (sync) error having higher sequency number.
+// Initially the number of successful frames is -1 and each frame of
+// the multiple send needs a sequency number. The last frame copies
+// own sequency number (added by one) to the CCB.
+//
+// ULONG cSuccessfulTransmits; // REMOVE Reserved2!!!!!
+//
+} NT_DLC_CCB, *PNT_DLC_CCB;
+
+typedef struct _NT_DLC_CCB_INPUT {
+ IN UCHAR uchAdapterNumber; // Adapter 0 or 1
+ IN UCHAR uchDlcCommand; // DLC command
+ OUT UCHAR uchDlcStatus; // DLC command completion code
+ UCHAR uchReserved1; // reserved for DLC DLL
+ OUT PVOID pCcbAddress; //
+ IN ULONG CommandCompletionFlag;
+ union {
+ IN OUT PLLC_PARMS pParameterTable; // pointer to the parameter table
+ struct {
+ IN USHORT usStationId; // Station id
+ IN USHORT usParameter; // optional parameter
+ } dlc;
+ struct {
+ IN USHORT usParameter0; // first optional parameter
+ IN USHORT usParameter1; // second optional parameter
+ } dir;
+ IN UCHAR auchBuffer[4]; // group/functional address
+ IN ULONG ulParameter;
+ } u;
+} NT_DLC_CCB_INPUT, *PNT_DLC_CCB_INPUT;
+
+typedef struct _NT_DLC_CCB_OUTPUT {
+ IN UCHAR uchAdapterNumber; // Adapter 0 or 1
+ IN UCHAR uchDlcCommand; // DLC command
+ OUT UCHAR uchDlcStatus; // DLC command completion code
+ UCHAR uchReserved1; // reserved for DLC DLL
+ OUT PVOID pCcbAddress; //
+} NT_DLC_CCB_OUTPUT, *PNT_DLC_CCB_OUTPUT;
+
+typedef struct _NT_DLC_TRANSMIT2_CCB_OUTPUT {
+ IN UCHAR uchAdapterNumber; // Adapter 0 or 1
+ IN UCHAR uchDlcCommand; // DLC command
+ OUT UCHAR uchDlcStatus; // DLC command completion code
+ UCHAR uchReserved1; // reserved for DLC DLL
+ OUT PVOID pCcbAddress; //
+} NT_DLC_TRANSMIT2_CCB_OUTPUT, *PNT_DLC_CCB_TRANSMIT2_OUTPUT;
+
+//
+// BUFFER.FREE
+//
+// DlcCommand = 0x27
+//
+// Internal NT DLC API data structure.
+//
+typedef struct _NT_DLC_BUFFER_FREE_PARMS {
+ IN USHORT Reserved1;
+ OUT USHORT cBuffersLeft;
+ IN USHORT BufferCount;
+ IN USHORT Reserved2;
+ IN LLC_TRANSMIT_DESCRIPTOR DlcBuffer[1];
+} NT_DLC_BUFFER_FREE_PARMS, *PNT_DLC_BUFFER_FREE_PARMS;
+
+typedef struct _NT_DLC_BUFFER_FREE_ALLOCATION {
+ IN USHORT Reserved1;
+ OUT USHORT cBuffersLeft;
+ IN USHORT BufferCount;
+ IN USHORT Reserved2;
+ IN LLC_TRANSMIT_DESCRIPTOR DlcBuffer[MAX_TRANSMIT_SEGMENTS];
+} NT_DLC_BUFFER_FREE_ALLOCATION, *PNT_DLC_BUFFER_FREE_ALLOCATION;
+
+typedef struct _NT_DLC_BUFFER_FREE_OUTPUT {
+ IN USHORT Reserved2;
+ OUT USHORT cBuffersLeft;
+} NT_DLC_BUFFER_FREE_OUTPUT, *PNT_DLC_BUFFER_FREE_OUTPUT;
+
+//
+// DLC_CONNECT_STATION
+//
+// DlcCommand = 0x1b
+// (copied by DLC API)
+//
+#define DLC_MAX_ROUTING_INFOMATION 18
+typedef struct _NT_DLC_CONNECT_STATION_PARMS {
+ IN LLC_CCB Ccb;
+ IN USHORT Reserved;
+ IN USHORT StationId;
+ IN UCHAR aRoutingInformation[DLC_MAX_ROUTING_INFOMATION];
+ IN USHORT RoutingInformationLength;
+} NT_DLC_CONNECT_STATION_PARMS, *PNT_DLC_CONNECT_STATION_PARMS;
+
+//
+// DLC_FLOW_CONTROL
+//
+// DlcCommand = 0x1d
+// (copied by DLC API)
+//
+#define LLC_VALID_FLOW_CONTROL_BITS 0xc0
+
+//
+// This is special DOS DLC extensions to generate
+// dlc local busy (dos dlc buffer) indication from
+// dos dlc support dll.
+//
+#define LLC_SET_LOCAL_BUSY_BUFFER 0x20
+#define LLC_DOS_DLC_FLOW_CONTROL 0x1f
+
+typedef struct _NT_DLC_FLOW_CONTROL_PARMS {
+ IN USHORT StationId;
+ IN UCHAR FlowControlOption;
+ IN UCHAR Reserved;
+} NT_DLC_FLOW_CONTROL_PARMS, *PNT_DLC_FLOW_CONTROL_PARMS;
+
+//
+// DLC_SET_INFORMATION
+//
+// This command is used to set the parameters of a link
+// station or a sap. A null field in the station id struct
+// defines a
+//
+// DlcCommand = 0x1c
+//
+
+//
+// Info classes for datalink Set/Query Information
+//
+enum _DLC_INFO_CLASS_TYPES {
+ DLC_INFO_CLASS_STATISTICS, // get
+ DLC_INFO_CLASS_STATISTICS_RESET, // get and reset
+ DLC_INFO_CLASS_DLC_TIMERS, // get/set
+ DLC_INFO_CLASS_DIR_ADAPTER, // get
+ DLC_INFO_CLASS_DLC_ADAPTER, // get
+ DLC_INFO_CLASS_PERMANENT_ADDRESS, // get
+ DLC_INFO_CLASS_LINK_STATION, // set
+ DLC_INFO_CLASS_DIRECT_INFO, // set
+ DLC_INFO_CLASS_GROUP, // set
+ DLC_INFO_CLASS_RESET_FUNCTIONAL, // set
+ DLC_INFO_CLASS_SET_GROUP, // set / get
+ DLC_INFO_CLASS_SET_FUNCTIONAL, // set / get
+ DLC_INFO_CLASS_ADAPTER_LOG, // get
+ DLC_INFO_CLASS_SET_MULTICAST // set
+};
+#define DLC_MAX_GROUPS 127 // max for group saps
+
+typedef struct _LinkStationInfoSet {
+ IN UCHAR TimerT1;
+ IN UCHAR TimerT2;
+ IN UCHAR TimerTi;
+ IN UCHAR MaxOut;
+ IN UCHAR MaxIn;
+ IN UCHAR MaxOutIncrement;
+ IN UCHAR MaxRetryCount;
+ IN UCHAR TokenRingAccessPriority;
+ IN USHORT MaxInformationField;
+} DLC_LINK_PARAMETERS, * PDLC_LINK_PARAMETERS;
+
+typedef struct _LLC_TICKS {
+ UCHAR T1TickOne; // default short delay for response timer
+ UCHAR T2TickOne; // default short delay for ack delay timer
+ UCHAR TiTickOne; // default short delay for inactivity timer
+ UCHAR T1TickTwo; // default short delay for response timer
+ UCHAR T2TickTwo; // default short delay for ack delay timer
+ UCHAR TiTickTwo; // default short delay for inactivity timer
+} LLC_TICKS, *PLLC_TICKS;
+
+typedef union _TR_BROADCAST_ADDRESS
+{
+ ULONG ulAddress;
+ UCHAR auchAddress[4];
+} TR_BROADCAST_ADDRESS, *PTR_BROADCAST_ADDRESS;
+
+typedef struct _NT_DLC_SET_INFORMATION_PARMS {
+ struct _DlcSetInfoHeader {
+ IN USHORT StationId;
+ IN USHORT InfoClass;
+ } Header;
+ union {
+ // InfoClass = DLC_INFO_CLASS_LINK_STATION
+ DLC_LINK_PARAMETERS LinkStation;
+
+ // InfoClass = DLC_INFO_CLASS_GROUP
+ struct _DlcSapInfoSet {
+ IN UCHAR GroupCount;
+ IN UCHAR GroupList[DLC_MAX_GROUPS];
+ } Sap;
+
+ // InfoClass = DLC_INFO_CLASS_DIRECT_STATION
+ struct _DlcDirectStationInfoSet {
+ IN ULONG FrameMask;
+ } Direct;
+
+ // InfoClass = DLC_INFO_CLASS_DLC_TIMERS
+ LLC_TICKS TimerParameters;
+
+ // InfoClass = DLC_INFO_CLASS_SET_FUNCTIONAL
+ // InfoClass = DLC_INFO_CLASS_RESET_FUNCTIONAL
+ // InfoClass = DLC_INFO_CLASS_SET_GROUP
+ UCHAR Buffer[1];
+
+ // InfoClass = DLC_INFO_CLASS_SET_MULTICAST
+ UCHAR auchMulticastAddress[6];
+
+ TR_BROADCAST_ADDRESS Broadcast;
+ } Info;
+} NT_DLC_SET_INFORMATION_PARMS, *PNT_DLC_SET_INFORMATION_PARMS;
+
+typedef struct _DlcAdapterInfoGet {
+ OUT UCHAR MaxSap;
+ OUT UCHAR OpenSaps;
+ OUT UCHAR MaxStations;
+ OUT UCHAR OpenStations;
+ OUT UCHAR AvailStations;
+} LLC_ADAPTER_DLC_INFO, *PLLC_ADAPTER_DLC_INFO;
+
+//
+// This structure is tailored for DLC DirOpenAdapter and DirStatus
+// functions.
+//
+typedef struct _LLC_ADAPTER_INFO {
+ UCHAR auchNodeAddress[6];
+ UCHAR auchGroupAddress[4];
+ UCHAR auchFunctionalAddress[4];
+ USHORT usAdapterType; // (struct may not be dword align!)
+ USHORT usReserved;
+ USHORT usMaxFrameSize;
+ ULONG ulLinkSpeed;
+} LLC_ADAPTER_INFO, *PLLC_ADAPTER_INFO;
+
+//
+// DLC_QUERY_INFOMATION
+//
+// This command is used to set the parameters of a link
+// station or a sap. A null field in the station id struct
+// defines a
+//
+// DlcCommand =
+//
+
+typedef union _NT_DLC_QUERY_INFORMATION_OUTPUT {
+// (Query dlc parameters not used by DLC)
+// // InfoClass = DLC_INFO_CLASS_STATION_INFO for link station
+// DLC_LINK_PARAMETERS Link;
+// // InfoClass = DLC_INFO_CLASS_DIRECT_INFO for direct station
+// struct _DlcDirectStationInfoGet {
+// OUT ULONG FrameMask;
+// } Direct;
+
+ // InfoClass = DLC_INFO_CLASS_DIR_ADAPTER;
+ LLC_ADAPTER_INFO DirAdapter;
+
+ // InfoClass = DLC_INFO_CLASS_SAP
+ struct _DlcSapInfoGet {
+ OUT USHORT MaxInformationField;
+ OUT UCHAR MaxMembers;
+ OUT UCHAR GroupCount;
+ OUT UCHAR GroupList[DLC_MAX_GROUPS];
+ } Sap;
+
+ // InfoClass = DLC_INFO_CLASS_LINK_STATION
+ struct _DlcLinkInfoGet {
+ OUT USHORT MaxInformationField;
+ } Link;
+
+ // InfoClass = DLC_INFO_CLASS_DLC_ADAPTER
+ LLC_ADAPTER_DLC_INFO DlcAdapter;
+
+// struct _DlcInfoSetBroadcast Broadcast;
+
+ // InfoClass = DLC_INFO_CLASS_DLC_TIMERS
+ LLC_TICKS TimerParameters;
+
+ // InfoClass = DLC_INFO_CLASS_ADAPTER_LOG
+ LLC_ADAPTER_LOG AdapterLog;
+
+ // InfoClass = DLC_INFO_CLASS_SET_FUNCTIONAL
+ // InfoClass = DLC_INFO_CLASS_RESET_FUNCTIONAL
+ // InfoClass = DLC_INFO_CLASS_SET_GROUP
+ UCHAR Buffer[1];
+} NT_DLC_QUERY_INFORMATION_OUTPUT, *PNT_DLC_QUERY_INFORMATION_OUTPUT;
+
+typedef struct _NT_DLC_QUERY_INFORMATION_INPUT {
+ IN USHORT StationId;
+ IN USHORT InfoClass;
+} NT_DLC_QUERY_INFORMATION_INPUT, *PNT_DLC_QUERY_INFORMATION_INPUT;
+
+typedef union _NT_DLC_QUERY_INFORMATION_PARMS {
+ NT_DLC_QUERY_INFORMATION_INPUT Header;
+ NT_DLC_QUERY_INFORMATION_OUTPUT Info;
+} NT_DLC_QUERY_INFORMATION_PARMS, *PNT_DLC_QUERY_INFORMATION_PARMS;
+
+//
+// DLC_OPEN_SAP
+//
+// DlcCommand = 0x15
+//
+typedef struct _NT_DLC_OPEN_SAP_PARMS {
+ OUT USHORT StationId; // SAP or link station id
+ IN USHORT UserStatusValue;
+ IN DLC_LINK_PARAMETERS LinkParameters;
+ IN UCHAR SapValue;
+ IN UCHAR OptionsPriority;
+ IN UCHAR StationCount;
+ IN UCHAR Reserved1[7];
+ IN ULONG DlcStatusFlag;
+ IN UCHAR Reserved2[8];
+ OUT UCHAR AvailableStations; // == StationCount
+} NT_DLC_OPEN_SAP_PARMS, *PNT_DLC_OPEN_SAP_PARMS;
+
+//
+// NT_DLC_OPEN_STATION
+//
+// DlcCommand = 0x19
+//
+//
+typedef struct _NT_DLC_OPEN_STATION_PARMS {
+ IN OUT USHORT LinkStationId;
+ IN DLC_LINK_PARAMETERS LinkParameters;
+ IN UCHAR aRemoteNodeAddress[6];
+ IN UCHAR RemoteSap;
+} NT_DLC_OPEN_STATION_PARMS, *PNT_DLC_OPEN_STATION_PARMS;
+
+//
+// NT_DLC_SET_TRESHOLD
+//
+// DlcCommand = 0x33
+//
+//typedef struct _NT_DLC_SET_TRESHOLD_PARMS {
+// IN USHORT StationId;
+// IN USHORT Reserved;
+// IN ULONG BufferTresholdSize;
+// IN PVOID AlertEvent;
+//} NT_DLC_SET_TRESHOLD_PARMS, *PNT_DLC_SET_TRESHOLD_PARMS;
+
+//
+// DIR_OPEN_ADAPTER
+//
+// DlcCommand = 0x03
+//
+// OUT: Info.ulParameter = BringUpDiagnostics;
+//
+#ifndef MAX_PATH // I don't want to include whole windows because of this
+#define MAX_PATH 260
+#endif
+typedef struct _NT_DIR_OPEN_ADAPTER_PARMS {
+ OUT LLC_ADAPTER_OPEN_PARMS Adapter;
+ IN PVOID pSecurityDescriptor;
+ IN PVOID hBufferPoolHandle;
+ IN LLC_ETHERNET_TYPE LlcEthernetType;
+ IN ULONG NtDlcIoctlVersion;
+ IN LLC_TICKS LlcTicks;
+ IN UCHAR AdapterNumber;
+ IN UCHAR uchReserved;
+ IN UNICODE_STRING NdisDeviceName;
+ IN WCHAR Buffer[ MAX_PATH ];
+} NT_DIR_OPEN_ADAPTER_PARMS, *PNT_DIR_OPEN_ADAPTER_PARMS;
+
+//
+// READ_CANCEL (DlcCommand = 0x32)
+// DIR_TIMER_CANCEL (DlcCommand = 0x23)
+//
+typedef struct _NT_DLC_CANCEL_COMMAND_PARMS {
+ IN PVOID CcbAddress;
+} NT_DLC_CANCEL_COMMAND_PARMS, *PNT_DLC_CANCEL_COMMAND_PARMS;
+
+//
+// RECEIVE_CANCEL
+//
+// DlcCommand = 0x29
+//
+typedef struct _NT_DLC_RECEIVE_CANCEL_PARMS {
+ PVOID pCcb;
+} NT_DLC_RECEIVE_CANCEL_PARMS, *PNT_DLC_RECEIVE_CANCEL_PARMS;
+
+typedef struct _NT_DLC_COMMAND_CANCEL_PARMS {
+ PVOID pCcb;
+} NT_DLC_COMMAND_CANCEL_PARMS, *PNT_DLC_COMMAND_CANCEL_PARMS;
+
+//
+// TRANSMIT_DIR_FRAME
+// TRANSMIT_I_FRAME
+// TRANSMIT_TEST_CMD
+// TRANSMIT_UI_FRAME
+// TRANSMIT_XID_CMD
+// TRANSMIT_XID_RESP_FINAL
+// TRANSMIT_XID_RESP_NOT_FINAL
+//
+typedef struct _NT_DLC_TRANSMIT_PARMS {
+ IN USHORT StationId;
+ IN USHORT FrameType; // DLC frame or ethernet protocol
+ IN UCHAR RemoteSap OPTIONAL; // used only for DLC types
+ IN UCHAR XmitReadOption;
+ OUT UCHAR FrameStatus; // not returned by I or new xmit
+ IN UCHAR Reserved;
+ IN ULONG XmitBufferCount;
+ IN LLC_TRANSMIT_DESCRIPTOR XmitBuffer[1];
+} NT_DLC_TRANSMIT_PARMS, *PNT_DLC_TRANSMIT_PARMS;
+
+typedef struct _NT_DLC_TRANSMIT_ALLOCATION {
+ IN USHORT StationId;
+ IN USHORT FrameType;
+ IN UCHAR RemoteSap;
+ IN UCHAR XmitReadOption;
+ OUT UCHAR FrameStatus;
+ IN UCHAR Reserved;
+ IN ULONG XmitBufferCount;
+ IN LLC_TRANSMIT_DESCRIPTOR XmitBuffer[MAX_TRANSMIT_SEGMENTS];
+} NT_DLC_TRANSMIT_ALLOCATION;
+
+typedef struct _NT_DLC_TRANSMIT_OUTPUT {
+ OUT UCHAR FrameStatus;
+} NT_DLC_TRANSMIT_OUTPUT, *PNT_DLC_TRANSMIT_OUTPUT;
+
+enum _XMIT_READ_OPTION {
+ DLC_CHAIN_XMIT_IN_LINK = 0,
+ DLC_DO_NOT_CHAIN_XMIT = 1,
+ DLC_CHAIN_XMIT_IN_SAP = 2
+};
+
+//
+// COMPLETE_COMMAND
+//
+// DlcCommand = 0x??
+//
+// The command is used to complete all synchronous commands.
+// The DLC API library calls the DLC device driver again with
+// these parameters, when a synchronous DLC command with
+// COMMAND_COMPLETION_FLAG has completed.
+// The command completes immediately, but the orginal CCB pointer
+// and command completion flag are queued to the even queue
+// or completed immediately with a READ command.
+// The asynchronous commands are queued immediately when they
+// completes, but their
+//
+typedef struct _NT_DLC_COMPLETE_COMMAND_PARMS {
+ IN PVOID pCcbPointer;
+ IN ULONG CommandCompletionFlag;
+ IN USHORT StationId;
+ IN USHORT Reserved;
+} NT_DLC_COMPLETE_COMMAND_PARMS, *PNT_DLC_COMPLETE_COMMAND_PARMS;
+
+
+//
+// There is a small READ_INPUT parameter structure, because we
+// do not want to copy all output parameters in every read request.
+//
+//
+typedef struct _NT_DLC_READ_INPUT {
+ IN USHORT StationId;
+ IN UCHAR OptionIndicator;
+ IN UCHAR EventSet;
+ IN PVOID CommandCompletionCcbLink;
+} NT_DLC_READ_INPUT, * PNT_DLC_READ_INPUT;
+
+//
+// This buffer is copied back to user memory, when read parameter table
+// is separate from CCB- table.
+//
+typedef LLC_READ_PARMS LLC_READ_OUTPUT_PARMS, *PLLC_READ_OUTPUT_PARMS;
+
+//typedef struct _LLC_READ_OUTPUT_PARMS {
+// IN USHORT usStationId;
+// IN UCHAR uchOptionIndicator;
+// IN UCHAR uchEventSet;
+// OUT UCHAR uchEvent;
+// OUT UCHAR uchCriticalSubset;
+// OUT ULONG ulNotificationFlag;
+// union {
+// struct {
+// OUT USHORT usCcbCount;
+// OUT PLLC_CCB pCcbCompletionList;
+// OUT USHORT usBufferCount;
+// OUT PLLC_BUFFER pFirstBuffer;
+// OUT USHORT usReceivedFrameCount;
+// OUT PLLC_BUFFER pReceivedFrame;
+// OUT USHORT usEventErrorCode;
+// OUT USHORT usEventErrorData[3];
+// } Event;
+// struct {
+// OUT USHORT usStationId;
+// OUT USHORT usDlcStatusCode;
+// OUT UCHAR uchFrmrData[5];
+// OUT UCHAR uchAccessPritority;
+// OUT UCHAR uchRemoteNodeAddress[6];
+// OUT UCHAR uchRemoteSap;
+// OUT UCHAR uchReserved;
+// OUT USHORT usUserStatusValue;
+// } Status;
+// } Type;
+//} LLC_READ_OUTPUT_PARMS, *PLLC_READ_OUTPUT_PARMS;
+
+typedef struct _NT_DLC_READ_PARMS {
+ IN USHORT StationId;
+ IN UCHAR OptionIndicator;
+ IN UCHAR EventSet;
+ OUT UCHAR Event;
+ OUT UCHAR CriticalSubset;
+ OUT ULONG NotificationFlag;
+ union {
+ struct {
+ OUT USHORT CcbCount;
+ OUT PVOID pCcbCompletionList;
+ OUT USHORT BufferCount;
+ OUT PLLC_BUFFER pFirstBuffer;
+ OUT USHORT ReceivedFrameCount;
+ OUT PLLC_BUFFER pReceivedFrame;
+ OUT USHORT EventErrorCode;
+ OUT USHORT EventErrorData[3];
+ } Event;
+ struct {
+ OUT USHORT StationId;
+ OUT USHORT DlcStatusCode;
+ OUT UCHAR FrmrData[5];
+ OUT UCHAR AccessPritority;
+ OUT UCHAR RemoteNodeAddress[6];
+ OUT UCHAR RemoteSap;
+ OUT UCHAR Reserved;
+ OUT USHORT UserStatusValue;
+ } Status;
+ } u;
+} NT_DLC_READ_PARMS, *PNT_DLC_READ_PARMS;
+
+typedef struct _LLC_IOCTL_BUFFERS {
+ USHORT InputBufferSize;
+ USHORT OutputBufferSize;
+} LLC_IOCTL_BUFFERS, *PLLC_IOCTL_BUFFERS;
+
+//
+// This table is used by dlc driver and dlcapi dll modules.
+// In the application level debug version of dlc we link all modules
+// together and this table must be defined only once.
+//
+#ifdef INCLUDE_IO_BUFFER_SIZE_TABLE
+
+LLC_IOCTL_BUFFERS aDlcIoBuffers[IOCTL_DLC_LAST_COMMAND] =
+{
+ {sizeof(NT_DLC_READ_PARMS) + sizeof( NT_DLC_CCB ),
+ sizeof( NT_DLC_CCB_OUTPUT )},
+ {sizeof(LLC_RECEIVE_PARMS) + sizeof( NT_DLC_CCB ),
+ sizeof( NT_DLC_CCB_OUTPUT )},
+ {sizeof(NT_DLC_TRANSMIT_PARMS) + sizeof( NT_DLC_CCB ),
+ sizeof( NT_DLC_CCB_OUTPUT )},
+ {sizeof(NT_DLC_BUFFER_FREE_PARMS),
+ sizeof(NT_DLC_BUFFER_FREE_OUTPUT)},
+ {sizeof(LLC_BUFFER_GET_PARMS),
+ sizeof(LLC_BUFFER_GET_PARMS)},
+ {sizeof(LLC_BUFFER_CREATE_PARMS),
+ sizeof(PVOID)},
+// DirInitialize included in DirClose
+// {sizeof( NT_DLC_CCB_INPUT ),
+// sizeof( NT_DLC_CCB_OUTPUT )}, // DIR.INITIALIZE
+ {sizeof(LLC_DIR_SET_EFLAG_PARMS),
+ 0},
+ {sizeof( NT_DLC_CCB_INPUT ),
+ sizeof( NT_DLC_CCB_OUTPUT )}, // DLC.CLOSE.STATION
+ {sizeof(NT_DLC_CONNECT_STATION_PARMS) + sizeof( NT_DLC_CCB ),
+ sizeof( NT_DLC_CCB_OUTPUT )},
+ {sizeof(NT_DLC_FLOW_CONTROL_PARMS),
+ 0},
+ {sizeof(NT_DLC_OPEN_STATION_PARMS),
+ sizeof( USHORT )},
+ {sizeof( NT_DLC_CCB_INPUT ),
+ sizeof( NT_DLC_CCB_OUTPUT )}, // DLC.RESET
+ {sizeof(NT_DLC_COMMAND_CANCEL_PARMS),
+ 0}, // READ.CANCEL
+ {sizeof(NT_DLC_RECEIVE_CANCEL_PARMS),
+ 0},
+ {sizeof(NT_DLC_QUERY_INFORMATION_INPUT),
+ 0},
+ {sizeof( struct _DlcSetInfoHeader ),
+ 0},
+ {sizeof(NT_DLC_COMMAND_CANCEL_PARMS), // TIMER.CANCEL
+ 0},
+ {sizeof( NT_DLC_CCB_INPUT ), // TIMER.CANCEL.GROUP
+ sizeof( NT_DLC_CCB_OUTPUT )},
+ {sizeof( NT_DLC_CCB_INPUT ), // DIR.TIMER.SET
+ sizeof( NT_DLC_CCB_OUTPUT )},
+ {sizeof(NT_DLC_OPEN_SAP_PARMS),
+ sizeof(NT_DLC_OPEN_SAP_PARMS)},
+ {sizeof( NT_DLC_CCB_INPUT ),
+ sizeof( NT_DLC_CCB_OUTPUT )}, // DLC.CLOSE.SAP
+ {sizeof(LLC_DIR_OPEN_DIRECT_PARMS),
+ 0},
+ {sizeof( NT_DLC_CCB_INPUT ), // DIR.CLOSE.DIRECT
+ sizeof( NT_DLC_CCB_OUTPUT )},
+ {sizeof(NT_DIR_OPEN_ADAPTER_PARMS), // DIR.OPEN.ADAPTER
+ sizeof( LLC_ADAPTER_OPEN_PARMS )},
+ {sizeof( NT_DLC_CCB_INPUT ), // DIR.CLOSE.ADAPTER
+ sizeof( NT_DLC_CCB_OUTPUT )},
+ {sizeof( LLC_DLC_REALLOCATE_PARMS ), // DLC.REALLOCATE
+ sizeof( LLC_DLC_REALLOCATE_PARMS )},
+ {sizeof( NT_DLC_READ_INPUT) + sizeof( LLC_CCB ), // READ2
+ sizeof( NT_DLC_READ_PARMS) + sizeof( LLC_CCB )},
+ {sizeof( LLC_RECEIVE_PARMS) + sizeof( LLC_CCB ), // RECEIVE2
+ sizeof( NT_DLC_CCB_OUTPUT )},
+ {sizeof( NT_DLC_TRANSMIT_PARMS ) + sizeof( LLC_CCB ), // TRANSMIT2
+ sizeof( NT_DLC_CCB_OUTPUT )},
+ {sizeof( NT_DLC_COMPLETE_COMMAND_PARMS ), // DLC.COMPLETE.COMMAND
+ 0},
+// {sizeof( LLC_TRACE_INITIALIZE_PARMS ) + sizeof( LLC_CCB ),
+// 0},
+// {0, 0}
+// {sizeof( NT_NDIS_REQUEST_PARMS ),
+// sizeof( NT_NDIS_REQUEST_PARMS )}
+};
+#else
+
+extern LLC_IOCTL_BUFFERS aDlcIoBuffers[];
+
+#endif
+
+//
+// All NT DLC API parameters in one structure
+//
+typedef union _NT_DLC_PARMS {
+ NT_DLC_BUFFER_FREE_ALLOCATION BufferFree;
+ LLC_BUFFER_GET_PARMS BufferGet;
+ LLC_BUFFER_CREATE_PARMS BufferCreate;
+ NT_DLC_FLOW_CONTROL_PARMS DlcFlowControl;
+ NT_DLC_OPEN_STATION_PARMS DlcOpenStation;
+ NT_DLC_SET_INFORMATION_PARMS DlcSetInformation;
+ NT_DLC_QUERY_INFORMATION_PARMS DlcGetInformation;
+ NT_DLC_OPEN_SAP_PARMS DlcOpenSap;
+ LLC_DIR_SET_EFLAG_PARMS DirSetExceptionFlags;
+ NT_DLC_CANCEL_COMMAND_PARMS DlcCancelCommand;
+ NT_DLC_RECEIVE_CANCEL_PARMS ReceiveCancel;
+ USHORT StationId;
+ NT_DLC_COMPLETE_COMMAND_PARMS CompleteCommand;
+ LLC_DLC_REALLOCATE_PARMS DlcReallocate;
+ LLC_DIR_OPEN_DIRECT_PARMS DirOpenDirect;
+ NT_DIR_OPEN_ADAPTER_PARMS DirOpenAdapter;
+// NT_NDIS_REQUEST_PARMS NdisRequest;
+ LLC_DLC_STATISTICS_PARMS DlcStatistics;
+ LLC_ADAPTER_DLC_INFO DlcAdapter;
+ WCHAR UnicodePath[MAX_PATH];
+
+ //
+ // At least DirTimerCancelGroup:
+ //
+ NT_DLC_CCB_INPUT InputCcb;
+
+ //
+ // Asynchronous parameters
+ //
+ //close sap/link/direct,reset, DirTimerSet;
+ struct _ASYNC_DLC_PARMS {
+ NT_DLC_CCB Ccb;
+ union {
+ UCHAR ByteBuffer[512];
+ NT_DLC_CONNECT_STATION_PARMS DlcConnectStation;
+ NT_DLC_READ_INPUT ReadInput;
+ NT_DLC_READ_PARMS Read;
+ LLC_RECEIVE_PARMS Receive;
+ NT_DLC_TRANSMIT_ALLOCATION Transmit;
+// NT_NDIS_REQUEST_PARMS NdisRequest;
+ LLC_TRACE_INITIALIZE_PARMS TraceInitialize;
+ } Parms;
+ } Async;
+} NT_DLC_PARMS, *PNT_DLC_PARMS;
+
+LLC_STATUS
+DlcCallDriver(
+ IN UINT AdapterNumber,
+ IN UINT IoctlCommand,
+ IN PVOID pInputBuffer,
+ IN UINT InputBufferLength,
+ OUT PVOID pOutputBuffer,
+ IN UINT OutputBufferLength
+ );
+LLC_STATUS
+NtAcsLan(
+ IN PLLC_CCB pCCB,
+ IN PVOID pOrginalCcbAddress,
+ OUT PLLC_CCB pOutputCcb,
+ IN HANDLE EventHandle OPTIONAL
+ );
+
diff --git a/private/inc/dnsapi.h b/private/inc/dnsapi.h
new file mode 100644
index 000000000..da3df1a8c
--- /dev/null
+++ b/private/inc/dnsapi.h
@@ -0,0 +1,1227 @@
+/*++
+
+Copyright (c) 1995 Microsoft Corporation
+
+Module Name:
+
+ dnsapi.h
+
+Abstract:
+
+ Domain Name System (DNS) Server
+
+ DNS Server API to support admin clients.
+
+Author:
+
+ Jim Gilroy (jamesg) September 23, 1995
+
+Revision History:
+
+ Dan Morin (t-danmo) 28-Nov-95 Changed LPSTR to LPCSTR on most APIs
+
+--*/
+
+
+#ifndef _DNSAPI_INCLUDED_
+#define _DNSAPI_INCLUDED_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif // _cplusplus
+
+
+//
+// Use stdcall for our API conventions
+//
+// Explicitly state this as C++ compiler will otherwise
+// assume cdecl.
+//
+
+#define DNS_API_FUNCTION __stdcall
+
+
+//
+// Basic DNS definitions
+//
+
+#define DNS_MAX_NAME_LENGTH (255)
+
+
+//
+// RPC interface
+//
+
+#define DNS_INTERFACE_NAME "DNSSERVER"
+
+//
+// RPC security
+//
+
+#define DNS_RPC_SECURITY "DnsServerApp"
+#define DNS_RPC_SECURITY_AUTH_ID 10
+
+//
+// RPC transports
+//
+
+#define DNS_RPC_NAMED_PIPE "\\PIPE\\DNSSERVER"
+#define DNS_RPC_SERVER_PORT ""
+#define DNS_RPC_LPC_EP "DNSSERVERLPC"
+
+#define DNS_RPC_USE_TCPIP 0x1
+#define DNS_RPC_USE_NAMED_PIPE 0x2
+#define DNS_RPC_USE_LPC 0x4
+#define DNS_RPC_USE_ALL_PROTOCOLS 0xffffffff
+
+
+//
+// DNS public types
+//
+
+typedef LONG DNS_STATUS, *PDNS_STATUS;
+typedef DWORD DNS_HANDLE, *PDNS_HANDLE;
+typedef DWORD DNS_APIOP;
+typedef DWORD IP_ADDRESS, *PIP_ADDRESS;
+
+//
+// IP Address Array type
+//
+
+#if defined(MIDL_PASS)
+
+#define LPSTR [string] char *
+#define LPCSTR [string] const char *
+
+typedef struct _IP_ARRAY
+{
+ DWORD cAddrCount;
+ [size_is( cAddrCount )] IP_ADDRESS aipAddrs[];
+}
+IP_ARRAY, *PIP_ARRAY;
+
+#else
+
+typedef struct _IP_ARRAY
+{
+ DWORD cAddrCount;
+ IP_ADDRESS aipAddrs[];
+}
+IP_ARRAY, *PIP_ARRAY;
+
+#endif
+
+//
+// DNS API Errors
+//
+
+#define DNS_ERROR_MASK 0xcc000000
+#define DNS_ERROR_SERVER_FAILURE 0xcc000001
+#define DNS_ERROR_NOT_YET_IMPLEMENTED 0xcc000002
+#define DNS_ERROR_OLD_API 0xcc000003
+
+#define DNS_ERROR_NAME_DOES_NOT_EXIST 0xcc000010
+#define DNS_ERROR_INVALID_NAME 0xcc000011
+#define DNS_ERROR_INVALID_IP_ADDRESS 0xcc000012
+#define DNS_ERROR_INVALID_DATA 0xcc000013
+
+
+//
+// Packet format
+//
+
+#define DNS_INFO_NO_RECORDS 0x4c000030
+#define DNS_INFO_NAME_ERROR 0x4c000031
+#define DNS_ERROR_RCODE 0xcc000032
+#define DNS_ERROR_MESSAGE_FORMAT 0xcc000033
+#define DNS_ERROR_MESSAGE_HEADER_FORMAT 0xcc000034
+
+
+//
+// Zone errors
+//
+
+#define DNS_ERROR_ZONE_DOES_NOT_EXIST 0xcc000101
+#define DNS_ERROR_NO_ZONE_INFO 0xcc000102
+#define DNS_ERROR_INVALID_ZONE_OPERATION 0xcc000103
+#define DNS_ERROR_ZONE_CONFIGURATION_ERROR 0xcc000104
+#define DNS_ERROR_ZONE_HAS_NO_SOA_RECORD 0xcc000105
+#define DNS_ERROR_ZONE_HAS_NO_NS_RECORDS 0xcc000106
+#define DNS_ERROR_ZONE_LOCKED 0xcc000107
+
+#define DNS_ERROR_ZONE_CREATION_FAILED 0xcc000110
+#define DNS_ERROR_ZONE_ALREADY_EXISTS 0xcc000111
+#define DNS_ERROR_AUTOZONE_ALREADY_EXISTS 0xcc000112
+#define DNS_ERROR_INVALID_ZONE_TYPE 0xcc000113
+#define DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP 0xcc000114
+
+#define DNS_ERROR_ZONE_NOT_SECONDARY 0xcc000120
+#define DNS_ERROR_NEED_SECONDARY_ADDRESSES 0xcc000121
+#define DNS_ERROR_WINS_INIT_FAILED 0xcc000122
+#define DNS_ERROR_NEED_WINS_SERVERS 0xcc000123
+#define DNS_ERROR_NBSTAT_INIT_FAILED 0xcc000124
+#define DNS_ERROR_SOA_DELETE_INVALID 0xcc000125
+
+//
+// Datafile errors
+//
+
+#define DNS_ERROR_PRIMARY_REQUIRES_DATAFILE 0xcc000201
+#define DNS_ERROR_INVALID_DATAFILE_NAME 0xcc000202
+#define DNS_ERROR_DATAFILE_OPEN_FAILURE 0xcc000203
+#define DNS_ERROR_FILE_WRITEBACK_FAILED 0xcc000204
+#define DNS_ERROR_DATAFILE_PARSING 0xcc000205
+
+
+//
+// Database errors
+//
+
+#define DNS_ERROR_RECORD_DOES_NOT_EXIST 0xcc000300
+#define DNS_ERROR_RECORD_FORMAT 0xcc000301
+#define DNS_ERROR_NODE_CREATION_FAILED 0xcc000302
+#define DNS_ERROR_UNKNOWN_RECORD_TYPE 0xcc000303
+#define DNS_ERROR_RECORD_TIMED_OUT 0xcc000304
+
+#define DNS_ERROR_NAME_NOT_IN_ZONE 0xcc000305
+#define DNS_ERROR_CNAME_LOOP 0xcc000306
+#define DNS_ERROR_NODE_IS_CNAME 0xcc000307
+#define DNS_ERROR_CNAME_COLLISION 0xcc000308
+#define DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT 0xcc000309
+#define DNS_ERROR_RECORD_ALREADY_EXISTS 0xcc000310
+#define DNS_ERROR_SECONDARY_DATA 0xcc000311
+#define DNS_ERROR_NO_CREATE_CACHE_DATA 0xcc000312
+
+#define DNS_WARNING_PTR_CREATE_FAILED 0x8c000332
+#define DNS_WARNING_DOMAIN_UNDELETED 0x8c000333
+
+//
+// Operation errors
+//
+
+#define DNS_INFO_AXFR_COMPLETE 0x4c000403
+#define DNS_ERROR_AXFR 0xcc000404
+#define DNS_INFO_ADDED_LOCAL_WINS 0x4c000405
+
+
+
+
+//
+// DNS Server information
+//
+
+typedef struct _DNS_SERVER_INFO
+{
+ DWORD dwVersion;
+ LPSTR pszServerName;
+
+ // boot
+
+ DWORD fBootRegistry;
+
+ // IP interfaces
+
+ PIP_ARRAY aipServerAddrs;
+ PIP_ARRAY aipListenAddrs;
+
+ // recursion lookup timeout
+
+ DWORD dwRecursionTimeout;
+
+ // forwarders
+
+ PIP_ARRAY aipForwarders;
+ DWORD dwForwardTimeout;
+ DWORD fSlave;
+
+ // save some space, just in case
+
+ DWORD pvReserved1;
+ DWORD pvReserved2;
+ DWORD pvReserved3;
+}
+DNS_SERVER_INFO, *PDNS_SERVER_INFO;
+
+
+
+//
+// Server configuration API
+//
+
+DNS_STATUS
+DNS_API_FUNCTION
+DnsGetServerInfo(
+ IN LPCSTR pszServer,
+ OUT PDNS_SERVER_INFO * ppServerInfo
+ );
+
+VOID
+DNS_API_FUNCTION
+DnsFreeServerInfo(
+ IN OUT PDNS_SERVER_INFO pServerInfo
+ );
+
+DNS_STATUS
+DNS_API_FUNCTION
+DnsResetBootMethod(
+ IN LPCSTR pszServer,
+ IN DWORD fBootRegistry
+ );
+
+DNS_STATUS
+DNS_API_FUNCTION
+DnsResetServerListenAddresses(
+ IN LPCSTR pszServer,
+ IN DWORD cListenAddrs,
+ IN PIP_ADDRESS aipListenAddrs
+ );
+
+DNS_STATUS
+DNS_API_FUNCTION
+DnsResetForwarders(
+ IN LPCSTR pszServer,
+ IN DWORD cForwarders,
+ IN PIP_ADDRESS aipForwarders,
+ IN DWORD dwForwardTimeout,
+ IN DWORD fSlave
+ );
+
+
+//
+// DNS server statistics
+//
+
+typedef struct _DNS_SYSTEMTIME
+{
+ WORD wYear;
+ WORD wMonth;
+ WORD wDayOfWeek;
+ WORD wDay;
+ WORD wHour;
+ WORD wMinute;
+ WORD wSecond;
+ WORD wMilliseconds;
+}
+DNS_SYSTEMTIME;
+
+typedef struct _DNS_STATISTICS
+{
+ //
+ // Queries and responses
+ //
+
+ DWORD UdpQueries;
+ DWORD UdpResponses;
+ DWORD UdpQueriesSent;
+ DWORD UdpResponsesReceived;
+
+ DWORD TcpClientConnections;
+ DWORD TcpQueries;
+ DWORD TcpResponses;
+ DWORD TcpQueriesSent;
+ DWORD TcpResponsesReceived;
+
+ //
+ // Recursion
+ //
+
+ DWORD RecurseLookups;
+ DWORD RecurseResponses;
+
+ DWORD RecursePasses;
+ DWORD RecurseQuestions;
+ DWORD RecurseForwards;
+ DWORD RecurseTimeouts;
+ DWORD RecurseFailures;
+ DWORD RecursePartialFailures;
+
+ DWORD RecurseRootQuery;
+ DWORD RecurseRootResponse;
+ DWORD RecurseTcpTry;
+ DWORD RecurseTcpQuery;
+ DWORD RecurseTcpResponse;
+
+ // Recursion Packets
+
+ DWORD RecursePacketUsed;
+ DWORD RecursePacketReturn;
+
+ //
+ // WINS lookup
+ //
+
+ DWORD WinsLookups;
+ DWORD WinsResponses;
+ DWORD WinsReverseLookups;
+ DWORD WinsReverseResponses;
+
+ // Zone transfer secondary
+
+ DWORD SecSoaQueries;
+ DWORD SecSoaResponses;
+ DWORD SecNotifyReceived;
+ DWORD SecAxfrRequested;
+ DWORD SecAxfrRejected;
+ DWORD SecAxfrFailed;
+ DWORD SecAxfrSuccessful;
+
+ // Zone transfer master
+
+ DWORD MasterNotifySent;
+ DWORD MasterAxfrReceived;
+ DWORD MasterAxfrInvalid;
+ DWORD MasterAxfrRefused;
+ DWORD MasterAxfrDenied;
+ DWORD MasterAxfrFailed;
+ DWORD MasterAxfrSuccessful;
+
+ //
+ // Database
+ //
+
+ DWORD DatabaseMemory;
+
+ //
+ // Nodes
+ //
+
+ DWORD NodeAlloc;
+ DWORD NodeFree;
+ DWORD NodeNetAllocs;
+ DWORD NodeMemory;
+
+ DWORD NodeInUse;
+ DWORD NodeUsed;
+ DWORD NodeReturn;
+
+ DWORD NodeStdAlloc;
+ DWORD NodeStdUsed;
+ DWORD NodeStdReturn;
+ DWORD NodeInFreeList;
+
+ //
+ // Resource Records
+ //
+
+ DWORD RecordAlloc;
+ DWORD RecordFree;
+ DWORD RecordNetAllocs;
+ DWORD RecordMemory;
+
+ DWORD RecordInUse;
+ DWORD RecordUsed;
+ DWORD RecordReturn;
+
+ DWORD RecordStdAlloc;
+ DWORD RecordStdUsed;
+ DWORD RecordStdReturn;
+ DWORD RecordInFreeList;
+
+ //
+ // RR caching
+ //
+
+ DWORD CacheRRTotal;
+ DWORD CacheRRCurrent;
+ DWORD CacheRRTimeouts;
+
+ //
+ // Packet memory
+ //
+
+ // UDP Packets
+
+ DWORD UdpAlloc;
+ DWORD UdpFree;
+ DWORD UdpNetAllocs;
+ DWORD UdpMemory;
+
+ DWORD UdpUsed;
+ DWORD UdpReturn;
+ DWORD UdpResponseReturn;
+ DWORD UdpQueryReturn;
+ DWORD UdpInUse;
+ DWORD UdpInFreeList;
+
+ // TCP Packets
+
+ DWORD TcpAlloc;
+ DWORD TcpRealloc;
+ DWORD TcpFree;
+ DWORD TcpNetAllocs;
+ DWORD TcpMemory;
+
+ //
+ // Nbstat Memory
+ //
+
+ DWORD NbstatAlloc;
+ DWORD NbstatFree;
+ DWORD NbstatNetAllocs;
+ DWORD NbstatMemory;
+
+ DWORD NbstatUsed;
+ DWORD NbstatReturn;
+ DWORD NbstatInUse;
+ DWORD NbstatInFreeList;
+
+ //
+ // stats since when
+ //
+
+ DWORD ServerStartTimeSeconds;
+ DWORD LastClearTimeSeconds;
+ DWORD SecondsSinceServerStart;
+ DWORD SecondsSinceLastClear;
+
+ DNS_SYSTEMTIME ServerStartTime;
+ DNS_SYSTEMTIME LastClearTime;
+
+}
+DNS_STATISTICS, *PDNS_STATISTICS;
+
+//
+// cover old stat fields
+//
+
+#define dwCurrentStartTime CurrentStartTime
+#define dwUdpQueries UdpQueries
+#define dwUdpResponses UdpResponses
+#define dwTcpClientConnections TcpClientConnections
+#define dwTcpQueries TcpQueries
+#define dwTcpResponses TcpResponses
+#define dwRecursiveLookups RecurseLookups
+#define dwRecursiveResponses RecurseResponses
+#define dwWinsForwardLookups WinsLookups
+#define dwWinsForwardResponses WinsResponses
+#define dwWinsReverseLookups WinsReverseLookups
+#define dwWinsReverseResponses WinsReverseResponses
+#define TimeOfLastClear LastClearTime
+
+
+
+//
+// Statistics API
+//
+
+DNS_STATUS
+DNS_API_FUNCTION
+DnsGetStatistics(
+ IN LPCSTR pszServer,
+ OUT PDNS_STATISTICS * ppStatistics
+ );
+
+VOID
+DNS_API_FUNCTION
+DnsFreeStatistics(
+ IN OUT PDNS_STATISTICS pStatistics
+ );
+
+DNS_STATUS
+DNS_API_FUNCTION
+DnsClearStatistics(
+ IN LPCSTR pszServer
+ );
+
+
+
+//
+// DNS Zone information
+//
+
+#define DNS_ZONE_TYPE_CACHE (0)
+#define DNS_ZONE_TYPE_PRIMARY (1)
+#define DNS_ZONE_TYPE_SECONDARY (2)
+
+typedef struct _DNS_ZONE_INFO
+{
+ DNS_HANDLE hZone;
+ LPSTR pszZoneName;
+ DWORD dwZoneType;
+ DWORD fReverse;
+ DWORD fPaused;
+ DWORD fShutdown;
+ DWORD fAutoCreated;
+
+ // Database info
+
+ DWORD fUseDatabase;
+ LPSTR pszDataFile;
+
+ // Masters
+
+ PIP_ARRAY aipMasters;
+
+ // Secondaries
+
+ PIP_ARRAY aipSecondaries;
+ DWORD fSecureSecondaries;
+
+ // WINS or Nbstat lookup
+
+ DWORD fUseWins;
+ DWORD fUseNbstat;
+
+ // save some space, just inase
+ // avoid versioning issues if possible
+
+ DWORD pvReserved1;
+ DWORD pvReserved2;
+ DWORD pvReserved3;
+ DWORD pvReserved4;
+ DWORD pvReserved5;
+ DWORD pvReserved6;
+ DWORD pvReserved7;
+ DWORD pvReserved8;
+ DWORD pvReserved9;
+}
+DNS_ZONE_INFO, *PDNS_ZONE_INFO;
+
+
+
+//
+// Zone configuration API
+//
+
+DNS_STATUS
+DNS_API_FUNCTION
+DnsEnumZoneHandles(
+ IN LPCSTR pszServer,
+ OUT PDWORD pZoneCount,
+ IN DWORD dwArrayLength,
+ OUT DNS_HANDLE ahZones[]
+ );
+
+DNS_STATUS
+DNS_API_FUNCTION
+DnsGetZoneInfo(
+ IN LPCSTR pszServer,
+ IN DNS_HANDLE hZone,
+ OUT PDNS_ZONE_INFO * ppZoneInfo
+ );
+
+VOID
+DNS_API_FUNCTION
+DnsFreeZoneInfo(
+ IN OUT PDNS_ZONE_INFO pZoneInfo
+ );
+
+DNS_STATUS
+DNS_API_FUNCTION
+DnsEnumZoneInfo(
+ IN LPCSTR pszServer,
+ OUT PDWORD pdwZoneCount,
+ IN DWORD dwArrayLength,
+ OUT PDNS_ZONE_INFO apZones[]
+ );
+
+DNS_STATUS
+DNS_API_FUNCTION
+DnsResetZoneType(
+ IN LPCSTR pszServer,
+ IN DNS_HANDLE hZone,
+ IN DWORD dwZoneType,
+ IN DWORD cMasters,
+ IN PIP_ADDRESS aipMasters
+ );
+
+DNS_STATUS
+DNS_API_FUNCTION
+DnsResetZoneDatabase(
+ IN LPCSTR pszServer,
+ IN DNS_HANDLE hZone,
+ IN DWORD fUseDatabase,
+ IN LPCSTR pszDataFile
+ );
+
+DNS_STATUS
+DNS_API_FUNCTION
+DnsResetZoneMasters(
+ IN LPCSTR pszServer,
+ IN DNS_HANDLE hZone,
+ IN DWORD cMasters,
+ IN PIP_ADDRESS aipMasters
+ );
+
+DNS_STATUS
+DNS_API_FUNCTION
+DnsResetZoneSecondaries(
+ IN LPCSTR pszServer,
+ IN DNS_HANDLE hZone,
+ IN DWORD fSecureSecondaries,
+ IN DWORD cSecondaries,
+ IN PIP_ADDRESS aipSecondaries
+ );
+
+
+//
+// Zone management
+//
+
+DNS_STATUS
+DNS_API_FUNCTION
+DnsCreateZone(
+ IN LPCSTR pszServer,
+ OUT PDNS_HANDLE phZone,
+ IN LPCSTR pszZoneName,
+ IN DWORD dwZoneType,
+ IN LPCSTR pszAdminEmailName,
+ IN DWORD cMasters,
+ IN PIP_ADDRESS aipMasters,
+ IN DWORD dwUseDatabase,
+ IN LPCSTR pszDataFile
+ );
+
+DNS_STATUS
+DNS_API_FUNCTION
+DnsDelegateSubZone(
+ IN LPCSTR pszServer,
+ IN DNS_HANDLE hZone,
+ IN LPCSTR pszSubZone,
+ IN LPCSTR pszNewServer,
+ IN IP_ADDRESS ipNewServerAddr
+ );
+
+DNS_STATUS
+DNS_API_FUNCTION
+DnsIncrementZoneVersion(
+ IN LPCSTR pszServer,
+ IN DNS_HANDLE hZone
+ );
+
+DNS_STATUS
+DNS_API_FUNCTION
+DnsDeleteZone(
+ IN LPCSTR pszServer,
+ IN DNS_HANDLE hZone
+ );
+
+DNS_STATUS
+DNS_API_FUNCTION
+DnsPauseZone(
+ IN LPCSTR pszServer,
+ IN DNS_HANDLE hZone
+ );
+
+DNS_STATUS
+DNS_API_FUNCTION
+DnsResumeZone(
+ IN LPCSTR pszServer,
+ IN DNS_HANDLE hZone
+ );
+
+
+
+//
+// DNS Resource Records
+//
+
+// RFC 1034/1035
+#define DNS_TYPE_A 0x0001 // 1
+#define DNS_TYPE_NS 0x0002 // 2
+#define DNS_TYPE_MD 0x0003 // 3
+#define DNS_TYPE_MF 0x0004 // 4
+#define DNS_TYPE_CNAME 0x0005 // 5
+#define DNS_TYPE_SOA 0x0006 // 6
+#define DNS_TYPE_MB 0x0007 // 7
+#define DNS_TYPE_MG 0x0008 // 8
+#define DNS_TYPE_MR 0x0009 // 9
+#define DNS_TYPE_NULL 0x000a // 10
+#define DNS_TYPE_WKS 0x000b // 11
+#define DNS_TYPE_PTR 0x000c // 12
+#define DNS_TYPE_HINFO 0x000d // 13
+#define DNS_TYPE_MINFO 0x000e // 14
+#define DNS_TYPE_MX 0x000f // 15
+#define DNS_TYPE_TEXT 0x0010 // 16
+
+// RFC 1183
+#define DNS_TYPE_RP 0x0011 // 17
+#define DNS_TYPE_AFSDB 0x0012 // 18
+#define DNS_TYPE_X25 0x0013 // 19
+#define DNS_TYPE_ISDN 0x0014 // 20
+#define DNS_TYPE_RT 0x0015 // 21
+
+// RFC 1348
+#define DNS_TYPE_NSAP 0x0016 // 22
+#define DNS_TYPE_NSAPPTR 0x0017 // 23
+
+// DNS security draft dnssec-secext
+#define DNS_TYPE_SIG 0x0018 // 24
+#define DNS_TYPE_KEY 0x0019 // 25
+
+// RFC 1664 (X.400 mail)
+#define DNS_TYPE_PX 0x001a // 26
+
+//
+#define DNS_TYPE_GPOS 0x001b // 27
+
+// RFC 1886 (IPng Address)
+#define DNS_TYPE_AAAA 0x001c // 28
+
+//
+// Query only types (1035, IXFR draft)
+//
+#define DNS_TYPE_IXFR 0x00fb // 251
+#define DNS_TYPE_AXFR 0x00fc // 252
+#define DNS_TYPE_MAILB 0x00fd // 253
+#define DNS_TYPE_MAILA 0x00fe // 254
+#define DNS_TYPE_ALL 0x00ff // 255
+
+//
+// Temp Microsoft types -- use until get IANA approval for real type
+//
+#define DNS_TYPE_WINS 0xff01 // 64K - 255
+#define DNS_TYPE_NBSTAT 0xff02 // 64K - 254
+
+
+
+//
+// Node name structure for DNS names on the wire
+//
+
+typedef struct _DnsRpcName
+{
+ UCHAR cchNameLength;
+ CHAR achName[];
+}
+DNS_RPC_NAME, *PDNS_RPC_NAME, DNS_STRING, *PDNS_STRING;
+
+
+//
+// Node flags
+//
+
+#define DNS_RPC_NODE_FLAG_COMPLETE 0x80000000
+#define DNS_RPC_NODE_FLAG_STICKY 0x01000000
+
+
+//
+// DNS node structure for on the wire
+//
+
+typedef struct _DnsRpcNode
+{
+ WORD wLength;
+ WORD wRecordCount;
+ DWORD dwFlags;
+ DWORD dwChildCount;
+ DNS_RPC_NAME dnsNodeName;
+}
+DNS_RPC_NODE, *PDNS_RPC_NODE;
+
+#define SIZEOF_DNS_RPC_NODE_HEADER (3*sizeof(DWORD))
+
+
+//
+// Resource Record Flags
+//
+
+#define DNS_RPC_RECORD_FLAG_CACHE_DATA 0x80000000
+#define DNS_RPC_RECORD_FLAG_ZONE_ROOT 0x40000000
+#define DNS_RPC_RECORD_FLAG_AUTH_ZONE_ROOT 0x20000000
+
+#define DNS_RPC_RECORD_FLAG_DEFAULT_TTL 0x08000000
+#define DNS_RPC_RECORD_FLAG_TTL_CHANGE 0x04000000
+#define DNS_RPC_RECORD_FLAG_CREATE_PTR 0x02000000
+#define DNS_RPC_RECORD_FLAG_LOCAL_TYPE 0x01000000
+
+
+//
+// Resource record structure for passing records on the wire
+//
+// For efficiency, all these fields are aligned.
+// When buffered for transmission, all RR should start on DWORD
+// aligned boundary.
+//
+
+typedef struct _DnsRpcRecord
+{
+ WORD wRecordLength;
+ WORD wType;
+ WORD wClass;
+ WORD wDataLength;
+
+ DNS_HANDLE hRecord;
+ DWORD dwFlags;
+ DWORD dwTtlSeconds;
+
+ union
+ {
+ struct
+ {
+ IP_ADDRESS ipAddress;
+ }
+ A;
+
+ struct
+ {
+ DWORD dwSerialNo;
+ DWORD dwRefresh;
+ DWORD dwRetry;
+ DWORD dwExpire;
+ DWORD dwMinimumTtl;
+ DNS_RPC_NAME namePrimaryServer;
+
+ // responsible party follows in buffer
+ }
+ SOA, Soa;
+
+ struct
+ {
+ DNS_RPC_NAME nameNode;
+ }
+ PTR, Ptr,
+ NS, Ns,
+ CNAME, Cname,
+ MB, Mb,
+ MD, Md,
+ MF, Mf,
+ MG, Mg,
+ MR, Mr;
+
+ struct
+ {
+ DNS_RPC_NAME nameMailBox;
+
+ // errors to mailbox follows in buffer
+ }
+ MINFO, Minfo,
+ RP, Rp;
+
+ struct
+ {
+ WORD wPreference;
+ DNS_RPC_NAME nameExchange;
+ }
+ MX, Mx,
+ AFSDB, Afsdb,
+ RT, Rt;
+
+ struct
+ {
+ DNS_STRING stringData;
+
+ // one or more strings may follow
+ }
+ AAAA,
+ HINFO, Hinfo,
+ ISDN, Isdn,
+ TXT, Txt,
+ X25;
+
+ struct
+ {
+ BYTE bData[];
+ }
+ Null;
+
+ struct
+ {
+ IP_ADDRESS ipAddress;
+ UCHAR chProtocol;
+ BYTE bBitMask[1];
+ }
+ WKS, Wks;
+
+ //
+ // MS types
+ //
+
+ struct
+ {
+ DWORD dwMappingFlag;
+ DWORD dwLookupTimeout;
+ DWORD dwCacheTimeout;
+ DWORD cWinsServerCount;
+ IP_ADDRESS aipWinsServers[];
+ }
+ WINS, Wins;
+
+ struct
+ {
+ DWORD dwMappingFlag;
+ DWORD dwLookupTimeout;
+ DWORD dwCacheTimeout;
+ DNS_RPC_NAME nameResultDomain;
+ }
+ NBSTAT, Nbstat;
+
+ } Data;
+}
+DNS_RPC_RECORD, *PDNS_RPC_RECORD;
+
+
+#define SIZEOF_DNS_RPC_RECORD_HEADER \
+ (4*sizeof(WORD) + 2*sizeof(DWORD) + sizeof(DNS_HANDLE))
+
+#if 0
+#define SIZEOF_DNS_RPC_RECORD_FIXED_FIELD2 \
+ (sizeof(DNS_RPC_RECORD) - sizeof(struct _DnsRpcRecord.Data))
+
+#define SIZEOF_DNS_RPC_RECORD_FIXED_FIELD3 \
+ (sizeof(DNS_RPC_RECORD) - sizeof(DNS_RPC_RECORD.Data))
+#endif
+
+
+//
+// WINS + NBSTAT params
+// - flags
+// - default lookup timeout
+// - default cache timeout
+//
+
+#define DNS_WINS_FLAG_SCOPE (0x80000000)
+#define DNS_WINS_FLAG_LOCAL (0x00010000)
+
+#define DNS_WINS_DEFAULT_LOOKUP_TIMEOUT (5) // 5 secs
+#define DNS_WINS_DEFAULT_CACHE_TIMEOUT (600) // 10 minutes
+
+
+//
+// Helpful record macros
+// - no side effects in arguments
+//
+
+#define DNS_GET_NEXT_NAME(pname) \
+ (PDNS_RPC_NAME) (pname->achName + pname->cchNameLength)
+
+#define DNS_IS_NAME_IN_RECORD(pRecord, pname) \
+ ( (PCHAR)pRecord + pRecord->wRecordLength \
+ >= \
+ pname->achName + pname->cchNameLength )
+
+//
+// Note, for simplicity/efficiency ALL structures are DWORD aligned in
+// buffers on the wire.
+//
+// This macro returns DWORD aligned ptr at given ptr our next DWORD
+// aligned postion. Set ptr immediately after record or name structure
+// and this will return starting position of next structure.
+//
+
+#define DNS_NEXT_DWORD_PTR(ptr) ((PBYTE) ((DWORD)((PBYTE)ptr + 3) & ~(DWORD)3))
+
+#define DNS_IS_DWORD_ALIGNED(p) ( !((DWORD)(p) & (DWORD)3) )
+
+
+
+
+//
+// Record viewing API
+//
+
+DNS_STATUS
+DNS_API_FUNCTION
+DnsEnumNodeRecords(
+ IN LPCSTR pszServer,
+ IN LPCSTR pszNodeName,
+ IN WORD wRecordType,
+ IN DWORD fNoCacheData,
+ IN OUT PDWORD pdwBufferLength,
+ OUT BYTE abBuffer[]
+ );
+
+DNS_STATUS
+DNS_API_FUNCTION
+DnsEnumChildNodesAndRecords(
+ IN LPCSTR pszServer,
+ IN LPCSTR pszNodeName,
+ IN LPCSTR pszStartChild,
+ IN WORD wRecordType,
+ IN DWORD fNoCacheData,
+ IN OUT PDWORD pdwBufferLength,
+ OUT BYTE abBuffer[]
+ );
+
+DNS_STATUS
+DNS_API_FUNCTION
+R_DnsGetZoneWinsInfo(
+ IN LPCSTR Server,
+ IN DNS_HANDLE hZone,
+ OUT PDWORD pfUsingWins,
+ IN OUT PDWORD pdwBufferLength,
+ OUT BYTE abBuffer[]
+ );
+
+PCHAR
+DNS_API_FUNCTION
+DnsRecordTypeStringForType(
+ IN WORD wType
+ );
+
+//
+// Record management API
+//
+
+DNS_STATUS
+DNS_API_FUNCTION
+DnsUpdateRecord(
+ IN LPCSTR pszServer,
+ IN DNS_HANDLE hZone,
+ IN LPCSTR pszNodeName,
+ IN OUT PDNS_HANDLE hRecord,
+ IN DWORD dwDataLength,
+ IN BYTE abData[]
+ );
+
+DNS_STATUS
+DNS_API_FUNCTION
+DnsDeleteRecord(
+ IN LPCSTR pszServer,
+ IN LPCSTR pszNodeName,
+ IN DNS_HANDLE hRecord
+ );
+
+DNS_STATUS
+DNS_API_FUNCTION
+DnsDeleteName(
+ IN LPCSTR pszServer,
+ IN LPCSTR pszNodeName,
+ IN DWORD fDeleteSubtree
+ );
+
+DNS_STATUS
+DNS_API_FUNCTION
+R_DnsUpdateWinsRecord(
+ IN LPCSTR Server,
+ IN DNS_HANDLE hZone,
+ IN DWORD dwDataLength,
+ IN BYTE abData[]
+ );
+
+
+//
+// Debug printing utils
+//
+
+VOID
+DNS_API_FUNCTION
+DnsInitializeDebug(
+ IN BOOL fFromConsole
+ );
+
+#if 0
+VOID
+DNS_API_FUNCTION
+DnsPrintf(
+ IN CHAR *Format,
+ ...
+ );
+
+VOID
+DNS_API_FUNCTION
+DnsEndDebug(
+ VOID
+ );
+
+//
+// Server info printing
+//
+
+VOID
+DNS_API_FUNCTION
+DnsPrintServerInfo(
+ IN VOID PrintRoutine( CHAR * Format, ... ),
+ IN LPSTR pszHeader,
+ IN PDNS_SERVER_INFO pServerInfo
+ );
+
+VOID
+DNS_API_FUNCTION
+DnsPrintStatistics(
+ IN VOID PrintRoutine( CHAR * Format, ... ),
+ IN LPSTR pszHeader,
+ IN PDNS_STATISTICS pStatistics
+ );
+
+//
+// Zone info printing
+//
+
+VOID
+DNS_API_FUNCTION
+DnsPrintZoneHandleList(
+ IN VOID PrintRoutine( CHAR * Format, ... ),
+ IN LPSTR pszHeader,
+ IN DWORD dwZoneCount,
+ IN DNS_HANDLE ahZones[]
+ );
+
+VOID
+DNS_API_FUNCTION
+DnsPrintZoneInfo(
+ IN VOID PrintRoutine( CHAR * Format, ... ),
+ IN LPSTR pszHeader,
+ IN PDNS_ZONE_INFO pZoneInfo
+ );
+
+VOID
+DNS_API_FUNCTION
+DnsPrintZoneInfoList(
+ IN VOID PrintRoutine( CHAR * Format, ... ),
+ IN LPSTR pszHeader,
+ IN DWORD dwZoneCount,
+ IN PDNS_ZONE_INFO apZoneInfo[]
+ );
+
+//
+// Node and record buffer printing
+//
+
+VOID
+DNS_API_FUNCTION
+DnsPrintName(
+ IN VOID PrintRoutine( CHAR * Format, ... ),
+ IN LPSTR pszHeader,
+ IN PDNS_RPC_NAME pName,
+ IN LPSTR pszTrailer
+ );
+
+VOID
+DNS_API_FUNCTION
+DnsPrintNode(
+ IN VOID PrintRoutine( CHAR * Format, ... ),
+ IN LPSTR pszHeader,
+ IN PDNS_RPC_NODE pNode
+ );
+
+VOID
+DNS_API_FUNCTION
+DnsPrintRecord(
+ IN VOID PrintRoutine( CHAR * Format, ... ),
+ IN LPSTR pszHeader,
+ IN PDNS_RPC_RECORD pRecord
+ );
+
+VOID
+DNS_API_FUNCTION
+DnsPrintRecordsInBuffer(
+ IN VOID PrintRoutine( CHAR * Format, ... ),
+ IN LPSTR pszHeader,
+ IN DWORD dwBufferLength,
+ IN BYTE abBuffer[]
+ );
+
+//
+// General print utility
+//
+
+VOID
+DNS_API_FUNCTION
+DnsPrintIpAddressArray(
+ IN VOID PrintRoutine( CHAR * Format, ... ),
+ IN LPSTR pszHeader,
+ IN LPSTR pszName,
+ IN DWORD dwIpAddrCount,
+ IN PIP_ADDRESS pIpAddrs
+ );
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+#endif // _DNSAPI_INCLUDED_
+
diff --git a/private/inc/error.h b/private/inc/error.h
new file mode 100644
index 000000000..b4bad3374
--- /dev/null
+++ b/private/inc/error.h
@@ -0,0 +1,464 @@
+/*static char *SCCSID = "@(#)error.h 12.18 88/12/02";*/
+/* WARNING If modifying this file, may have to also modify files: */
+/* src\inc\errtab.inc */
+/* src\dos\error.inc */
+/* XENIX calls all return error codes through AX. If an error occurred then */
+/* the carry bit will be set and the error code is in AX. If no error occurred */
+/* then the carry bit is reset and AX contains returned info. */
+/* */
+/* Since the set of error codes is being extended as we extend the operating */
+/* system, we have provided a means for applications to ask the system for a */
+/* recommended course of action when they receive an error. */
+/* */
+/* The GetExtendedError system call returns a universal error, an error */
+/* location and a recommended course of action. The universal error code is */
+/* a symptom of the error REGARDLESS of the context in which GetExtendedError */
+/* is issued. */
+/* */
+
+/* */
+/* These are the 2.0 error codes */
+/* */
+#define NO_ERROR 0
+#define ERROR_INVALID_FUNCTION 1
+#define ERROR_FILE_NOT_FOUND 2
+#define ERROR_PATH_NOT_FOUND 3
+#define ERROR_TOO_MANY_OPEN_FILES 4
+#define ERROR_ACCESS_DENIED 5
+#define ERROR_INVALID_HANDLE 6
+#define ERROR_ARENA_TRASHED 7
+#define ERROR_NOT_ENOUGH_MEMORY 8
+#define ERROR_INVALID_BLOCK 9
+#define ERROR_BAD_ENVIRONMENT 10
+#define ERROR_BAD_FORMAT 11
+#define ERROR_INVALID_ACCESS 12
+#define ERROR_INVALID_DATA 13
+/***** reserved EQU 14 ; ***** */
+#define ERROR_INVALID_DRIVE 15
+#define ERROR_CURRENT_DIRECTORY 16
+#define ERROR_NOT_SAME_DEVICE 17
+#define ERROR_NO_MORE_FILES 18
+/* */
+/* These are the universal int 24 mappings for the old INT 24 set of errors */
+/* */
+#define ERROR_WRITE_PROTECT 19
+#define ERROR_BAD_UNIT 20
+#define ERROR_NOT_READY 21
+#define ERROR_BAD_COMMAND 22
+#define ERROR_CRC 23
+#define ERROR_BAD_LENGTH 24
+#define ERROR_SEEK 25
+#define ERROR_NOT_DOS_DISK 26
+#define ERROR_SECTOR_NOT_FOUND 27
+#define ERROR_OUT_OF_PAPER 28
+#define ERROR_WRITE_FAULT 29
+#define ERROR_READ_FAULT 30
+#define ERROR_GEN_FAILURE 31
+/* */
+/* These are the new 3.0 error codes reported through INT 24 */
+/* */
+#define ERROR_SHARING_VIOLATION 32
+#define ERROR_LOCK_VIOLATION 33
+#define ERROR_WRONG_DISK 34
+#define ERROR_FCB_UNAVAILABLE 35
+#define ERROR_SHARING_BUFFER_EXCEEDED 36
+/* */
+/* New OEM network-related errors are 50-79 */
+/* */
+#define ERROR_NOT_SUPPORTED 50
+#define ERROR_REM_NOT_LIST 51 /* Remote computer not listening */
+#define ERROR_DUP_NAME 52 /* Duplicate name on network */
+#define ERROR_BAD_NETPATH 53 /* Network path not found */
+#define ERROR_NETWORK_BUSY 54 /* Network busy */
+#define ERROR_DEV_NOT_EXIST 55 /* Network device no longer exists */
+#define ERROR_TOO_MANY_CMDS 56 /* Net BIOS command limit exceeded */
+#define ERROR_ADAP_HDW_ERR 57 /* Network adapter hardware error */
+#define ERROR_BAD_NET_RESP 58 /* Incorrect response from network */
+#define ERROR_UNEXP_NET_ERR 59 /* Unexpected network error */
+#define ERROR_BAD_REM_ADAP 60 /* Incompatible remote adapter */
+#define ERROR_PRINTQ_FULL 61 /* Print queue full */
+#define ERROR_NO_SPOOL_SPACE 62 /* Not enough space for print file */
+#define ERROR_PRINT_CANCELLED 63 /* Print file was cancelled */
+#define ERROR_NETNAME_DELETED 64 /* Network name was deleted */
+#define ERROR_NETWORK_ACCESS_DENIED 65 /* Access denied */
+#define ERROR_BAD_DEV_TYPE 66 /* Network device type incorrect */
+#define ERROR_BAD_NET_NAME 67 /* Network name not found */
+#define ERROR_TOO_MANY_NAMES 68 /* Network name limit exceeded */
+#define ERROR_TOO_MANY_SESS 69 /* Net BIOS session limit exceeded */
+#define ERROR_SHARING_PAUSED 70 /* Sharing temporarily paused */
+#define ERROR_REQ_NOT_ACCEP 71 /* Network request not accepted */
+#define ERROR_REDIR_PAUSED 72 /* Print or disk redirection is paused */
+/* */
+/* End of INT 24 reportable errors */
+/* */
+#define ERROR_FILE_EXISTS 80
+#define ERROR_DUP_FCB 81 /* ***** */
+#define ERROR_CANNOT_MAKE 82
+#define ERROR_FAIL_I24 83
+/* */
+/* New 3.0 network related error codes */
+/* */
+#define ERROR_OUT_OF_STRUCTURES 84
+#define ERROR_ALREADY_ASSIGNED 85
+#define ERROR_INVALID_PASSWORD 86
+#define ERROR_INVALID_PARAMETER 87
+#define ERROR_NET_WRITE_FAULT 88
+/* */
+/* New error codes for 4.0 */
+/* */
+#define ERROR_NO_PROC_SLOTS 89 /* no process slots available */
+#define ERROR_NOT_FROZEN 90
+#define ERR_TSTOVFL 91 /* timer service table overflow */
+#define ERR_TSTDUP 92 /* timer service table duplicate */
+#define ERROR_NO_ITEMS 93 /* There were no items to operate upon */
+#define ERROR_INTERRUPT 95 /* interrupted system call */
+
+#define ERROR_TOO_MANY_SEMAPHORES 100
+#define ERROR_EXCL_SEM_ALREADY_OWNED 101
+#define ERROR_SEM_IS_SET 102
+#define ERROR_TOO_MANY_SEM_REQUESTS 103
+#define ERROR_INVALID_AT_INTERRUPT_TIME 104
+
+#define ERROR_SEM_OWNER_DIED 105 /* waitsem found owner died */
+#define ERROR_SEM_USER_LIMIT 106 /* too many procs have this sem */
+#define ERROR_DISK_CHANGE 107 /* insert disk b into drive a */
+#define ERROR_DRIVE_LOCKED 108 /* drive locked by another process */
+#define ERROR_BROKEN_PIPE 109 /* write on pipe with no reader */
+/* */
+/* New error codes for 5.0 */
+/* */
+#define ERROR_OPEN_FAILED 110 /* open/created failed due to */
+ /* explicit fail command */
+#define ERROR_BUFFER_OVERFLOW 111 /* buffer passed to system call */
+ /* is too small to hold return */
+ /* data. */
+#define ERROR_DISK_FULL 112 /* not enough space on the disk */
+ /* (DOSNEWSIZE/w_NewSize) */
+#define ERROR_NO_MORE_SEARCH_HANDLES 113 /* can't allocate another search */
+ /* structure and handle. */
+ /* (DOSFINDFIRST/w_FindFirst) */
+#define ERROR_INVALID_TARGET_HANDLE 114 /* Target handle in DOSDUPHANDLE */
+ /* is invalid */
+#define ERROR_PROTECTION_VIOLATION 115 /* Bad user virtual address */
+#define ERROR_VIOKBD_REQUEST 116
+#define ERROR_INVALID_CATEGORY 117 /* Category for DEVIOCTL in not */
+ /* defined */
+#define ERROR_INVALID_VERIFY_SWITCH 118 /* invalid value passed for */
+ /* verify flag */
+#define ERROR_BAD_DRIVER_LEVEL 119 /* DosDevIOCTL looks for a level */
+ /* four driver. If the driver */
+ /* is not level four we return */
+ /* this code */
+#define ERROR_CALL_NOT_IMPLEMENTED 120 /* returned from stub api calls. */
+ /* This call will disappear when */
+ /* all the api's are implemented. */
+#define ERROR_SEM_TIMEOUT 121 /* Time out happened from the */
+ /* semaphore api functions. */
+#define ERROR_INSUFFICIENT_BUFFER 122 /* Some call require the */
+ /* application to pass in a buffer */
+ /* filled with data. This error is */
+ /* returned if the data buffer is too */
+ /* small. For example: DosSetFileInfo */
+ /* requires 4 bytes of data. If a */
+ /* two byte buffer is passed in then */
+ /* this error is returned. */
+ /* error_buffer_overflow is used when */
+ /* the output buffer in not big enough. */
+#define ERROR_INVALID_NAME 123 /* illegal character or malformed */
+ /* file system name */
+#define ERROR_INVALID_LEVEL 124 /* unimplemented level for info */
+ /* retrieval or setting */
+#define ERROR_NO_VOLUME_LABEL 125 /* no volume label found with */
+ /* DosQFSInfo command */
+/* NOTE: DosQFSInfo no longer returns the above error; it is still here for */
+/* api\d_qfsinf.asm. */
+
+#define ERROR_MOD_NOT_FOUND 126 /* w_getprocaddr,w_getmodhandle */
+#define ERROR_PROC_NOT_FOUND 127 /* w_getprocaddr */
+
+#define ERROR_WAIT_NO_CHILDREN 128 /* CWait finds to children */
+
+#define ERROR_CHILD_NOT_COMPLETE 129 /* CWait children not dead yet */
+
+/*This is a temporary fix for the 4-19-86 build this should be changed when */
+/* we get the file from MS */
+#define ERROR_DIRECT_ACCESS_HANDLE 130 /* handle operation is invalid */
+ /* for direct disk access */
+ /* handles */
+#define ERROR_NEGATIVE_SEEK 131 /* application tried to seek */
+ /* with negitive offset */
+#define ERROR_SEEK_ON_DEVICE 132 /* application tried to seek */
+ /* on device or pipe */
+/* */
+/* The following are errors generated by the join and subst workers */
+/* */
+#define ERROR_IS_JOIN_TARGET 133
+#define ERROR_IS_JOINED 134
+#define ERROR_IS_SUBSTED 135
+#define ERROR_NOT_JOINED 136
+#define ERROR_NOT_SUBSTED 137
+#define ERROR_JOIN_TO_JOIN 138
+#define ERROR_SUBST_TO_SUBST 139
+#define ERROR_JOIN_TO_SUBST 140
+#define ERROR_SUBST_TO_JOIN 141
+#define ERROR_BUSY_DRIVE 142
+#define ERROR_SAME_DRIVE 143
+#define ERROR_DIR_NOT_ROOT 144
+#define ERROR_DIR_NOT_EMPTY 145
+#define ERROR_IS_SUBST_PATH 146
+#define ERROR_IS_JOIN_PATH 147
+#define ERROR_PATH_BUSY 148
+#define ERROR_IS_SUBST_TARGET 149
+#define ERROR_SYSTEM_TRACE 150 /* system trace error */
+#define ERROR_INVALID_EVENT_COUNT 151 /* DosMuxSemWait errors */
+#define ERROR_TOO_MANY_MUXWAITERS 152
+#define ERROR_INVALID_LIST_FORMAT 153
+#define ERROR_LABEL_TOO_LONG 154
+#define ERROR_TOO_MANY_TCBS 155
+#define ERROR_SIGNAL_REFUSED 156
+#define ERROR_DISCARDED 157
+#define ERROR_NOT_LOCKED 158
+#define ERROR_BAD_THREADID_ADDR 159
+#define ERROR_BAD_ARGUMENTS 160
+#define ERROR_BAD_PATHNAME 161
+#define ERROR_SIGNAL_PENDING 162
+#define ERROR_UNCERTAIN_MEDIA 163
+#define ERROR_MAX_THRDS_REACHED 164
+#define ERROR_MONITORS_NOT_SUPPORTED 165
+#define ERROR_UNC_DRIVER_NOT_INSTALLED 166
+
+/* The following error codes refer to errors demand loading segments */
+
+#define ERROR_LOCK_FAILED 167
+#define ERROR_SWAPIO_FAILED 168
+#define ERROR_SWAPIN_FAILED 169
+#define ERROR_BUSY 170
+
+#define ERROR_INVALID_SEGMENT_NUMBER 180
+#define ERROR_INVALID_CALLGATE 181
+#define ERROR_INVALID_ORDINAL 182
+#define ERROR_ALREADY_EXISTS 183
+#define ERROR_NO_CHILD_PROCESS 184
+#define ERROR_CHILD_ALIVE_NOWAIT 185
+#define ERROR_INVALID_FLAG_NUMBER 186
+#define ERROR_SEM_NOT_FOUND 187
+
+/* following error codes have added to make the loader error
+ messages distinct
+*/
+
+#define ERROR_INVALID_STARTING_CODESEG 188
+#define ERROR_INVALID_STACKSEG 189
+#define ERROR_INVALID_MODULETYPE 190
+#define ERROR_INVALID_EXE_SIGNATURE 191
+#define ERROR_EXE_MARKED_INVALID 192
+#define ERROR_BAD_EXE_FORMAT 193
+#define ERROR_ITERATED_DATA_EXCEEDS_64k 194
+#define ERROR_INVALID_MINALLOCSIZE 195
+#define ERROR_DYNLINK_FROM_INVALID_RING 196
+#define ERROR_IOPL_NOT_ENABLED 197
+#define ERROR_INVALID_SEGDPL 198
+#define ERROR_AUTODATASEG_EXCEEDS_64k 199
+#define ERROR_RING2SEG_MUST_BE_MOVABLE 200
+#define ERROR_RELOC_CHAIN_XEEDS_SEGLIM 201
+#define ERROR_INFLOOP_IN_RELOC_CHAIN 202
+
+#define ERROR_ENVVAR_NOT_FOUND 203
+#define ERROR_NOT_CURRENT_CTRY 204
+#define ERROR_NO_SIGNAL_SENT 205
+#define ERROR_FILENAME_EXCED_RANGE 206 /* if filename > 8.3 */
+#define ERROR_RING2_STACK_IN_USE 207 /* for FAPI */
+#define ERROR_META_EXPANSION_TOO_LONG 208 /* if "*a" > 8.3 */
+#define ERROR_INVALID_SIGNAL_NUMBER 209
+#define ERROR_THREAD_1_INACTIVE 210
+#define ERROR_INFO_NOT_AVAIL 211 /* PTM 5550 */
+#define ERROR_LOCKED 212
+#define ERROR_BAD_DYNALINK 213 /* PTM 5760 */
+#define ERROR_TOO_MANY_MODULES 214
+#define ERROR_NESTING_NOT_ALLOWED 215
+
+#define ERROR_CANNOT_SHRINK 216 /* attempt made to shrink
+ ring 2 stack */
+#define ERROR_ZOMBIE_PROCESS 217
+#define ERROR_STACK_IN_HIGH_MEMORY 218
+#define ERROR_INVALID_EXITROUTINE_RING 219 /* 1.1 DCR 87 */
+#define ERROR_GETBUF_FAILED 220
+#define ERROR_FLUSHBUF_FAILED 221
+#define ERROR_TRANSFER_TOO_LONG 222
+#define ERROR_NO_CHILDREN 228
+#define ERROR_INVALID_SCREEN_GROUP 229
+
+/*
+ * Error codes 230 - 249 are reserved for MS Networks
+ */
+#define ERROR_BAD_PIPE 230 /* Non-existant pipe or bad operation */
+#define ERROR_PIPE_BUSY 231 /* Pipe is busy */
+#define ERROR_NO_DATA 232 /* No data on non-blocking read */
+#define ERROR_PIPE_NOT_CONNECTED 233 /* Pipe was disconnected by server */
+#define ERROR_MORE_DATA 234 /* More data is available */
+
+#define ERROR_VC_DISCONNECTED 240 /* Session was dropped due to errors */
+
+/* The following added to Dos_Rename */
+
+#define ERROR_CIRCULARITY_REQUESTED 250 /* When renaming a dir */
+ /* which would cause a */
+ /* circularity */
+#define ERROR_DIRECTORY_IN_CDS 251 /* When renameing a dir */
+ /* which is "in use" */
+
+/* The following error code is 1.2 FileSystem for FSDs */
+
+#define ERROR_INVALID_FSD_NAME 252 /* when trying to access */
+ /* nonexistent FSD */
+#define ERROR_INVALID_PATH 253 /* bad pseudo device */
+
+/* Error codes for extended attribute support */
+
+#define ERROR_INVALID_EA_NAME 254 /* Illegal chars in name */
+#define ERROR_EA_LIST_INCONSISTENT 255 /* Size or some field bad */
+#define ERROR_EA_LIST_TOO_LONG 256 /* FEAlist > 64K-1 bytes */
+
+/* Error code for FSH_WILDMATCH */
+
+#define ERROR_NO_META_MATCH 257 /* string doesn't match expression */
+
+#define ERROR_FINDNOTIFY_TIMEOUT 258 /* FindNotify request
+ timeout */
+#define ERROR_NO_MORE_ITEMS 259 /* QFSAttach ordinal query */
+
+#define ERROR_SEARCH_STRUC_REUSED 260 /* 3xbox findfirst/next
+ search structure reused */
+
+/* Error code for FSH_FINDCHAR */
+
+#define ERROR_CHAR_NOT_FOUND 261 /* can't find char */
+
+#define ERROR_TOO_MUCH_STACK 262 /* Stack request exceeds
+ sys limit */
+
+#define ERROR_INVALID_ATTR 263 /* invalid FS_ATTRIBUTE */
+
+#define ERROR_INVALID_STARTING_RING 264 /* 1.2 DCR 116 */
+#define ERROR_INVALID_DLL_INIT_RING 265 /* 1.2 DCR 116 */
+
+#define ERROR_CANNOT_COPY 266 /* doscopy */
+#define ERROR_DIRECTORY 267 /* doscopy */
+
+#define ERROR_OPLOCKED_FILE 268 /* oplock */
+#define ERROR_OPLOCK_THREAD_EXISTS 269 /* oplock */
+#define ERROR_VOLUME_CHANGED 270 /* MSG%none */
+#define ERROR_FINDNOTIFY_HANDLE_IN_USE 271 /* MSG%none */
+#define ERROR_FINDNOTIFY_HANDLE_CLOSED 272 /* MSG%none */
+#define ERROR_NOTIFY_OBJECT_REMOVED 273 /* MSG%none */
+#define ERROR_ALREADY_SHUTDOWN 274 /* MSG%none */
+#define ERROR_EAS_DIDNT_FIT 275 /* MSG%none */
+#define ERROR_EA_FILE_CORRUPT 276 /* MSG%ERROR_EAS_CORRUPT */
+#define ERROR_EA_TABLE_FULL 277 /* MSG%EA_TABLE_FULL */
+#define ERROR_INVALID_EA_HANDLE 278 /* MSG%INVALID_EA_HANDLE */
+#define ERROR_NO_CLUSTER 279 /* MSG%NO_CLUSTER */
+#define ERROR_CREATE_EA_FILE 280 /* MSG%ERROR_CREATE_EA_FILE */
+#define ERROR_CANNOT_OPEN_EA_FILE 281 /* MSG%CANNOT_OPEN_FILE */
+#define ERROR_EAS_NOT_SUPPORTED 282 /* MSG%EAS_NOT_SUPPORTED */
+#define ERROR_NEED_EAS_FOUND 283 /* MSG%NEED_EAS_FOUND */
+#define ERROR_DUPLICATE_HANDLE 284 /* MSG%EAS_DISCARDED */
+#define ERROR_DUPLICATE_NAME 285 /* MSG%none */
+#define ERROR_EMPTY_MUXWAIT 286 /* MSG%none */
+#define ERROR_MUTEX_OWNED 287 /* MSG%none */
+#define ERROR_NOT_OWNER 288 /* MSG%none */
+#define ERROR_PARAM_TOO_SMALL 289 /* MSG%none */
+#define ERROR_TOO_MANY_HANDLES 290 /* MSG%none */
+#define ERROR_TOO_MANY_OPENS 291 /* MSG%none */
+#define ERROR_WRONG_TYPE 292 /* MSG%none */
+#define ERROR_UNUSED_CODE 293 /* MSG%none */
+#define ERROR_THREAD_NOT_TERMINATED 294 /* MSG%none */
+#define ERROR_INIT_ROUTINE_FAILED 295 /* MSG%none */
+#define ERROR_MODULE_IN_USE 296 /* MSG%none */
+#define ERROR_NOT_ENOUGH_WATCHPOINTS 297 /* MSG%none */
+#define ERROR_TOO_MANY_POSTS 298 /* MSG%none */
+#define ERROR_ALREADY_POSTED 299 /* MSG%none */
+#define ERROR_ALREADY_RESET 300 /* MSG%none */
+#define ERROR_SEM_BUSY 301 /* MSG%none */
+
+/* REMINDER: don't forget to update error.inc, */
+/* oso001.txt and basemid.inc */
+
+
+#define ERROR_USER_DEFINED_BASE 0xFF00
+
+#define ERROR_I24_WRITE_PROTECT 0
+#define ERROR_I24_BAD_UNIT 1
+#define ERROR_I24_NOT_READY 2
+#define ERROR_I24_BAD_COMMAND 3
+#define ERROR_I24_CRC 4
+#define ERROR_I24_BAD_LENGTH 5
+#define ERROR_I24_SEEK 6
+#define ERROR_I24_NOT_DOS_DISK 7
+#define ERROR_I24_SECTOR_NOT_FOUND 8
+#define ERROR_I24_OUT_OF_PAPER 9
+#define ERROR_I24_WRITE_FAULT 0x0A
+#define ERROR_I24_READ_FAULT 0x0B
+#define ERROR_I24_GEN_FAILURE 0x0C
+#define ERROR_I24_DISK_CHANGE 0x0D
+#define ERROR_I24_WRONG_DISK 0x0F
+#define ERROR_I24_UNCERTAIN_MEDIA 0x10
+#define ERROR_I24_CHAR_CALL_INTERRUPTED 0x11
+#define ERROR_I24_NO_MONITOR_SUPPORT 0x12
+#define ERROR_I24_INVALID_PARAMETER 0x13
+
+#define ALLOWED_FAIL 0x0001
+#define ALLOWED_ABORT 0x0002
+#define ALLOWED_RETRY 0x0004
+#define ALLOWED_IGNORE 0x0008
+#define ALLOWED_DETACHED 0x8000
+
+#define I24_OPERATION 0x1
+#define I24_AREA 0x6
+ /* 01 if FAT */
+ /* 10 if root DIR */
+ /* 11 if DATA */
+#define I24_CLASS 0x80
+
+
+/* Values for error CLASS */
+
+#define ERRCLASS_OUTRES 1 /* Out of Resource */
+#define ERRCLASS_TEMPSIT 2 /* Temporary Situation */
+#define ERRCLASS_AUTH 3 /* Permission problem */
+#define ERRCLASS_INTRN 4 /* Internal System Error */
+#define ERRCLASS_HRDFAIL 5 /* Hardware Failure */
+#define ERRCLASS_SYSFAIL 6 /* System Failure */
+#define ERRCLASS_APPERR 7 /* Application Error */
+#define ERRCLASS_NOTFND 8 /* Not Found */
+#define ERRCLASS_BADFMT 9 /* Bad Format */
+#define ERRCLASS_LOCKED 10 /* Locked */
+#define ERRCLASS_MEDIA 11 /* Media Failure */
+#define ERRCLASS_ALREADY 12 /* Collision with Existing Item */
+#define ERRCLASS_UNK 13 /* Unknown/other */
+#define ERRCLASS_CANT 14
+#define ERRCLASS_TIME 15
+
+/* Values for error ACTION */
+
+#define ERRACT_RETRY 1 /* Retry */
+#define ERRACT_DLYRET 2 /* Delay Retry, retry after pause */
+#define ERRACT_USER 3 /* Ask user to regive info */
+#define ERRACT_ABORT 4 /* abort with clean up */
+#define ERRACT_PANIC 5 /* abort immediately */
+#define ERRACT_IGNORE 6 /* ignore */
+#define ERRACT_INTRET 7 /* Retry after User Intervention */
+
+/* Values for error LOCUS */
+
+#define ERRLOC_UNK 1 /* No appropriate value */
+#define ERRLOC_DISK 2 /* Random Access Mass Storage */
+#define ERRLOC_NET 3 /* Network */
+#define ERRLOC_SERDEV 4 /* Serial Device */
+#define ERRLOC_MEM 5 /* Memory */
+
+/* Abnormal termination codes */
+
+#define TC_NORMAL 0
+#define TC_HARDERR 1
+#define TC_GP_TRAP 2
+#define TC_SIGNAL 3
diff --git a/private/inc/fmifs.h b/private/inc/fmifs.h
new file mode 100644
index 000000000..296268f0e
--- /dev/null
+++ b/private/inc/fmifs.h
@@ -0,0 +1,403 @@
+/*++
+
+Copyright (c) 1992 Microsoft Corporation
+
+Module Name:
+
+ fmifs.h
+
+Abstract:
+
+ This header file contains the specification of the interface
+ between the file manager and fmifs.dll for the purposes of
+ accomplishing IFS functions.
+
+Author:
+
+ Norbert P. Kusters (norbertk) 6-Mar-92
+
+--*/
+
+#if !defined( _FMIFS_DEFN_ )
+
+#define _FMIFS_DEFN_
+
+
+//
+// These are the defines for 'PacketType'.
+//
+
+typedef enum _FMIFS_PACKET_TYPE {
+ FmIfsPercentCompleted,
+ FmIfsFormatReport,
+ FmIfsInsertDisk,
+ FmIfsIncompatibleFileSystem,
+ FmIfsFormattingDestination,
+ FmIfsIncompatibleMedia,
+ FmIfsAccessDenied,
+ FmIfsMediaWriteProtected,
+ FmIfsCantLock,
+ FmIfsCantQuickFormat,
+ FmIfsIoError,
+ FmIfsFinished,
+ FmIfsBadLabel,
+#if defined( DBLSPACE_ENABLED )
+ FmIfsDblspaceCreateFailed,
+ FmIfsDblspaceMountFailed,
+ FmIfsDblspaceDriveLetterFailed,
+ FmIfsDblspaceCreated,
+ FmIfsDblspaceMounted,
+#endif // DBLSPACE_ENABLED
+ FmIfsCheckOnReboot,
+ FmIfsTextMessage,
+ FmIfsHiddenStatus
+} FMIFS_PACKET_TYPE, *PFMIFS_PACKET_TYPE;
+
+typedef struct _FMIFS_PERCENT_COMPLETE_INFORMATION {
+ ULONG PercentCompleted;
+} FMIFS_PERCENT_COMPLETE_INFORMATION, *PFMIFS_PERCENT_COMPLETE_INFORMATION;
+
+typedef struct _FMIFS_FORMAT_REPORT_INFORMATION {
+ ULONG KiloBytesTotalDiskSpace;
+ ULONG KiloBytesAvailable;
+} FMIFS_FORMAT_REPORT_INFORMATION, *PFMIFS_FORMAT_REPORT_INFORMATION;
+
+// The packet for FmIfsDblspaceCreated is a Unicode string
+// giving the name of the Compressed Volume File; it is not
+// necessarily zero-terminated.
+//
+
+#define DISK_TYPE_GENERIC 0
+#define DISK_TYPE_SOURCE 1
+#define DISK_TYPE_TARGET 2
+#define DISK_TYPE_SOURCE_AND_TARGET 3
+
+typedef struct _FMIFS_INSERT_DISK_INFORMATION {
+ ULONG DiskType;
+} FMIFS_INSERT_DISK_INFORMATION, *PFMIFS_INSERT_DISK_INFORMATION;
+
+typedef struct _FMIFS_IO_ERROR_INFORMATION {
+ ULONG DiskType;
+ ULONG Head;
+ ULONG Track;
+} FMIFS_IO_ERROR_INFORMATION, *PFMIFS_IO_ERROR_INFORMATION;
+
+typedef struct _FMIFS_FINISHED_INFORMATION {
+ BOOLEAN Success;
+} FMIFS_FINISHED_INFORMATION, *PFMIFS_FINISHED_INFORMATION;
+
+typedef struct _FMIFS_CHECKONREBOOT_INFORMATION {
+ OUT BOOLEAN QueryResult; // TRUE for "yes", FALSE for "no"
+} FMIFS_CHECKONREBOOT_INFORMATION, *PFMIFS_CHECKONREBOOT_INFORMATION;
+
+typedef enum _TEXT_MESSAGE_TYPE {
+ MESSAGE_TYPE_PROGRESS,
+ MESSAGE_TYPE_RESULTS,
+ MESSAGE_TYPE_FINAL
+} TEXT_MESSAGE_TYPE, *PTEXT_MESSAGE_TYPE;
+
+typedef struct _FMIFS_TEXT_MESSAGE {
+ IN TEXT_MESSAGE_TYPE MessageType;
+ IN PSTR Message;
+} FMIFS_TEXT_MESSAGE, *PFMIFS_TEXT_MESSAGE;
+
+
+
+
+//
+// This is a list of supported floppy media types for format.
+//
+
+typedef enum _FMIFS_MEDIA_TYPE {
+ FmMediaUnknown,
+ FmMediaF5_160_512, // 5.25", 160KB, 512 bytes/sector
+ FmMediaF5_180_512, // 5.25", 180KB, 512 bytes/sector
+ FmMediaF5_320_512, // 5.25", 320KB, 512 bytes/sector
+ FmMediaF5_320_1024, // 5.25", 320KB, 1024 bytes/sector
+ FmMediaF5_360_512, // 5.25", 360KB, 512 bytes/sector
+ FmMediaF3_720_512, // 3.5", 720KB, 512 bytes/sector
+ FmMediaF5_1Pt2_512, // 5.25", 1.2MB, 512 bytes/sector
+ FmMediaF3_1Pt44_512, // 3.5", 1.44MB, 512 bytes/sector
+ FmMediaF3_2Pt88_512, // 3.5", 2.88MB, 512 bytes/sector
+ FmMediaF3_20Pt8_512, // 3.5", 20.8MB, 512 bytes/sector
+ FmMediaRemovable, // Removable media other than floppy
+ FmMediaFixed
+} FMIFS_MEDIA_TYPE, *PFMIFS_MEDIA_TYPE;
+
+
+//
+// Function types/interfaces.
+//
+
+typedef BOOLEAN
+(*FMIFS_CALLBACK)(
+ IN FMIFS_PACKET_TYPE PacketType,
+ IN ULONG PacketLength,
+ IN PVOID PacketData
+ );
+
+typedef
+VOID
+(*PFMIFS_FORMAT_ROUTINE)(
+ IN PWSTR DriveName,
+ IN FMIFS_MEDIA_TYPE MediaType,
+ IN PWSTR FileSystemName,
+ IN PWSTR Label,
+ IN BOOLEAN Quick,
+ IN FMIFS_CALLBACK Callback
+ );
+
+typedef
+VOID
+(*PFMIFS_FORMATEX_ROUTINE)(
+ IN PWSTR DriveName,
+ IN FMIFS_MEDIA_TYPE MediaType,
+ IN PWSTR FileSystemName,
+ IN PWSTR Label,
+ IN BOOLEAN Quick,
+ IN ULONG ClusterSize,
+ IN FMIFS_CALLBACK Callback
+ );
+
+typedef
+BOOLEAN
+(*PFMIFS_ENABLECOMP_ROUTINE)(
+ IN PWSTR DriveName,
+ IN USHORT CompressionFormat
+ );
+
+
+typedef
+VOID
+(*PFMIFS_CHKDSK_ROUTINE)(
+ IN PWSTR DriveName,
+ IN PWSTR FileSystemName,
+ IN BOOLEAN Fix,
+ IN BOOLEAN Verbose,
+ IN BOOLEAN OnlyIfDirty,
+ IN BOOLEAN Recover,
+ IN PWSTR PathToCheck,
+ IN BOOLEAN Extend,
+ IN FMIFS_CALLBACK Callback
+ );
+
+typedef
+VOID
+(*PFMIFS_EXTEND_ROUTINE)(
+ IN PWSTR DriveName,
+ IN BOOLEAN Verify,
+ IN FMIFS_CALLBACK Callback
+ );
+
+
+typedef
+VOID
+(*PFMIFS_DISKCOPY_ROUTINE)(
+ IN PWSTR SourceDrive,
+ IN PWSTR DestDrive,
+ IN BOOLEAN Verify,
+ IN FMIFS_CALLBACK Callback
+ );
+
+typedef
+BOOLEAN
+(*PFMIFS_SETLABEL_ROUTINE)(
+ IN PWSTR DriveName,
+ IN PWSTR Label
+ );
+
+typedef
+BOOLEAN
+(*PFMIFS_QSUPMEDIA_ROUTINE)(
+ IN PWSTR DriveName,
+ OUT PFMIFS_MEDIA_TYPE MediaTypeArray OPTIONAL,
+ IN ULONG NumberOfArrayEntries,
+ OUT PULONG NumberOfMediaTypes
+ );
+
+
+typedef
+VOID
+(*PFMIFS_DOUBLESPACE_CREATE_ROUTINE)(
+ IN PWSTR HostDriveName,
+ IN ULONG Size,
+ IN PWSTR Label,
+ IN PWSTR NewDriveName,
+ IN FMIFS_CALLBACK Callback
+ );
+
+#if defined( DBLSPACE_ENABLED )
+typedef
+VOID
+(*PFMIFS_DOUBLESPACE_DELETE_ROUTINE)(
+ IN PWSTR DblspaceDriveName,
+ IN FMIFS_CALLBACK Callback
+ );
+
+typedef
+VOID
+(*PFMIFS_DOUBLESPACE_MOUNT_ROUTINE)(
+ IN PWSTR HostDriveName,
+ IN PWSTR CvfName,
+ IN PWSTR NewDriveName,
+ IN FMIFS_CALLBACK Callback
+ );
+
+typedef
+VOID
+(*PFMIFS_DOUBLESPACE_DISMOUNT_ROUTINE)(
+ IN PWSTR DblspaceDriveName,
+ IN FMIFS_CALLBACK Callback
+ );
+
+typedef
+BOOLEAN
+(*PFMIFS_DOUBLESPACE_QUERY_INFO_ROUTINE)(
+ IN PWSTR DosDriveName,
+ OUT PBOOLEAN IsRemovable,
+ OUT PBOOLEAN IsFloppy,
+ OUT PBOOLEAN IsCompressed,
+ OUT PBOOLEAN Error,
+ OUT PWSTR NtDriveName,
+ IN ULONG MaxNtDriveNameLength,
+ OUT PWSTR CvfFileName,
+ IN ULONG MaxCvfFileNameLength,
+ OUT PWSTR HostDriveName,
+ IN ULONG MaxHostDriveNameLength
+ );
+
+typedef
+BOOLEAN
+(*PFMIFS_DOUBLESPACE_SET_AUTMOUNT_ROUTINE)(
+ IN BOOLEAN EnableAutomount
+ );
+
+#endif // DBLSPACE_ENABLED
+
+
+VOID
+Format(
+ IN PWSTR DriveName,
+ IN FMIFS_MEDIA_TYPE MediaType,
+ IN PWSTR FileSystemName,
+ IN PWSTR Label,
+ IN BOOLEAN Quick,
+ IN FMIFS_CALLBACK Callback
+ );
+
+VOID
+FormatEx(
+ IN PWSTR DriveName,
+ IN FMIFS_MEDIA_TYPE MediaType,
+ IN PWSTR FileSystemName,
+ IN PWSTR Label,
+ IN BOOLEAN Quick,
+ IN ULONG ClusterSize,
+ IN FMIFS_CALLBACK Callback
+ );
+
+BOOLEAN
+EnableVolumeCompression(
+ IN PWSTR DriveName,
+ IN USHORT CompressionFormat
+ );
+
+VOID
+Chkdsk(
+ IN PWSTR DriveName,
+ IN PWSTR FileSystemName,
+ IN BOOLEAN Fix,
+ IN BOOLEAN Verbose,
+ IN BOOLEAN OnlyIfDirty,
+ IN BOOLEAN Recover,
+ IN PWSTR PathToCheck,
+ IN BOOLEAN Extend,
+ IN FMIFS_CALLBACK Callback
+ );
+
+VOID
+Extend(
+ IN PWSTR DriveName,
+ IN BOOLEAN Verify,
+ IN FMIFS_CALLBACK Callback
+ );
+
+VOID
+DiskCopy(
+ IN PWSTR SourceDrive,
+ IN PWSTR DestDrive,
+ IN BOOLEAN Verify,
+ IN FMIFS_CALLBACK Callback
+ );
+
+BOOLEAN
+SetLabel(
+ IN PWSTR DriveName,
+ IN PWSTR Label
+ );
+
+BOOLEAN
+QuerySupportedMedia(
+ IN PWSTR DriveName,
+ OUT PFMIFS_MEDIA_TYPE MediaTypeArray OPTIONAL,
+ IN ULONG NumberOfArrayEntries,
+ OUT PULONG NumberOfMediaTypes
+ );
+
+VOID
+DoubleSpaceCreate(
+ IN PWSTR HostDriveName,
+ IN ULONG Size,
+ IN PWSTR Label,
+ IN PWSTR NewDriveName,
+ IN FMIFS_CALLBACK Callback
+ );
+
+#if defined( DBLSPACE_ENABLED )
+
+VOID
+DoubleSpaceDelete(
+ IN PWSTR DblspaceDriveName,
+ IN FMIFS_CALLBACK Callback
+ );
+
+VOID
+DoubleSpaceMount(
+ IN PWSTR HostDriveName,
+ IN PWSTR CvfName,
+ IN PWSTR NewDriveName,
+ IN FMIFS_CALLBACK Callback
+ );
+
+VOID
+DoubleSpaceDismount(
+ IN PWSTR DblspaceDriveName,
+ IN FMIFS_CALLBACK Callback
+ );
+
+// Miscellaneous prototypes:
+//
+BOOLEAN
+FmifsQueryDriveInformation(
+ IN PWSTR DosDriveName,
+ OUT PBOOLEAN IsRemovable,
+ OUT PBOOLEAN IsFloppy,
+ OUT PBOOLEAN IsCompressed,
+ OUT PBOOLEAN Error,
+ OUT PWSTR NtDriveName,
+ IN ULONG MaxNtDriveNameLength,
+ OUT PWSTR CvfFileName,
+ IN ULONG MaxCvfFileNameLength,
+ OUT PWSTR HostDriveName,
+ IN ULONG MaxHostDriveNameLength
+ );
+
+BOOLEAN
+FmifsSetAutomount(
+ IN BOOLEAN EnableAutomount
+ );
+
+#endif
+
+
+#endif // _FMIFS_DEFN_
diff --git a/private/inc/hostannc.h b/private/inc/hostannc.h
new file mode 100644
index 000000000..91e5cda89
--- /dev/null
+++ b/private/inc/hostannc.h
@@ -0,0 +1,374 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ hostannc.h
+
+Abstract:
+
+ This module defines the data structures related to host announcements.
+
+Author:
+
+ Larry Osterman (LarryO) 22-Oct-1990
+
+Revision History:
+
+ 22-Oct-1991 LarryO
+
+ Created
+
+--*/
+
+#ifndef _HOSTANNC_
+#define _HOSTANNC_
+
+
+typedef enum _MailslotType {
+ MailslotTransaction = -2,
+ OtherTransaction = -1,
+ Illegal = 0,
+ HostAnnouncement = 1,
+ AnnouncementRequest = 2,
+ InterrogateInfoRequest = 3,
+ RelogonRequest = 4,
+ Election = 8,
+ GetBackupListReq = 9,
+ GetBackupListResp = 10,
+ BecomeBackupServer = 11,
+ WkGroupAnnouncement = 12,
+ MasterAnnouncement = 13,
+ ResetBrowserState = 14,
+ LocalMasterAnnouncement = 15,
+ MaximumMailslotType
+} MAILSLOTTYPE, *PMAILSLOTTYPE;
+
+#define WORKSTATION_SIGNATURE '\0'
+#define SERVER_SIGNATURE ' '
+#define PRIMARY_DOMAIN_SIGNATURE '\0'
+#define PRIMARY_CONTROLLER_SIGNATURE '\x1B'
+#define DOMAIN_CONTROLLER_SIGNATURE '\x1C'
+#define MASTER_BROWSER_SIGNATURE '\x1D'
+#define BROWSER_ELECTION_SIGNATURE '\x1E'
+#define DOMAIN_ANNOUNCEMENT_NAME "\x01\x02__MSBROWSE__\x02\x01"
+//
+// The following values should be the minimum and maximum of the
+// mailslot transaction opcodes defined above.
+//
+
+#define MIN_TRANSACT_MS_OPCODE MailslotTransaction
+#define MAX_TRANSACT_MS_OPCODE RelogonRequest
+
+//
+// Common name for reserved, `internal' transactions
+//
+
+#define MAILSLOT_LANMAN_NAME SMB_MAILSLOT_PREFIX "\\LANMAN"
+#define MAILSLOT_BROWSER_NAME SMB_MAILSLOT_PREFIX "\\BROWSE"
+#define ANNOUNCEMENT_MAILSLOT_NAME "\\\\*" ITRANS_MS_NAME
+
+
+#include <packon.h>
+ //
+// Each visible server on the net periodically emits a host announcement.
+// This is a SMB TRANSACTION REQUEST on a reserved, "internal" name.
+//
+
+//
+// There are two versions of each of these structures defined. The first,
+// is the actual "meat" of the structure, the second includes the announcement
+// type.
+//
+
+//
+// Lan Manager announcement message. This is used for opcodes:
+//
+// HostAnnouncement to \MAILSLOT\LANMAN on the LANMAN domain name.
+//
+
+typedef struct _HOST_ANNOUNCE_PACKET_1 {
+ UCHAR CompatibilityPad;
+ ULONG Type;
+ UCHAR VersionMajor; /* version of LM running on host */
+ UCHAR VersionMinor; /* " " " " " " " */
+ USHORT Periodicity; /* announcement cycle in secs */
+ CHAR NameComment[LM20_CNLEN+1+LM20_MAXCOMMENTSZ+1];
+} HOST_ANNOUNCE_PACKET_1, *PHOST_ANNOUNCE_PACKET_1;
+
+typedef struct _HOST_ANNOUNCE_PACKET {
+ UCHAR AnnounceType;
+ HOST_ANNOUNCE_PACKET_1 HostAnnouncement;
+} HOST_ANNOUNCE_PACKET, *PHOST_ANNOUNCE_PACKET;
+
+//
+// General announcement message. This is used for opcodes:
+//
+// HostAnnouncement, WkGroupAnnouncement, and LocalMasterAnnouncement
+//
+
+typedef struct _BROWSE_ANNOUNCE_PACKET_1 {
+ UCHAR UpdateCount; // Inc'ed when announce data changed.
+ ULONG Periodicity; // announcement cycle in milliseconds
+
+ UCHAR ServerName[LM20_CNLEN+1];
+ UCHAR VersionMajor;
+ UCHAR VersionMinor; /* " " " " " " " */
+ ULONG Type; // Server type.
+ CHAR *CommentPointer;
+ CHAR Comment[LM20_MAXCOMMENTSZ+1];
+} BROWSE_ANNOUNCE_PACKET_1, *PBROWSE_ANNOUNCE_PACKET_1;
+
+typedef struct _BROWSE_ANNOUNCE_PACKET {
+ UCHAR BrowseType;
+ BROWSE_ANNOUNCE_PACKET_1 BrowseAnnouncement;
+} BROWSE_ANNOUNCE_PACKET, *PBROWSE_ANNOUNCE_PACKET;
+//
+// The request announcement packet is sent by clients to request that
+// remote servers announce themselves.
+//
+
+typedef struct _REQUEST_ANNOUNCE_PACKET_1 { // Contents of request announcement
+ UCHAR Flags; // Unused Flags
+ CHAR Reply[LM20_CNLEN+1];
+} REQUEST_ANNOUNCE_PACKET_1, *PREQUEST_ANNOUNCE_PACKET_1;
+
+typedef struct _REQUEST_ANNOUNCE_PACKET { /* Request announcement struct */
+ UCHAR Type;
+ REQUEST_ANNOUNCE_PACKET_1 RequestAnnouncement;
+} REQUEST_ANNOUNCE_PACKET, *PREQUEST_ANNOUNCE_PACKET;
+
+#define HOST_ANNC_NAME(xx) ((xx)->NameComment)
+#define HOST_ANNC_COMMENT(xx) ((xx)->NameComment + (strlen(HOST_ANNC_NAME(xx))+1))
+
+#define BROWSE_ANNC_NAME(xx) ((xx)->ServerName)
+#define BROWSE_ANNC_COMMENT(xx) ((xx)->Comment)
+
+ //
+// Definitions for Windows Browser
+//
+
+//
+// Request to retrieve a backup server list.
+//
+
+typedef struct _BACKUP_LIST_REQUEST_1 {
+ UCHAR RequestedCount;
+ ULONG Token;
+} BACKUP_LIST_REQUEST_1, *PBACKUP_LIST_REQUEST_1;
+
+
+typedef struct _BACKUP_LIST_REQUEST {
+ UCHAR Type;
+ BACKUP_LIST_REQUEST_1 BackupListRequest;
+} BACKUP_LIST_REQUEST, *PBACKUP_LIST_REQUEST;
+
+//
+// Response containing a backup server list.
+//
+
+typedef struct _BACKUP_LIST_RESPONSE_1 {
+ UCHAR BackupServerCount;
+ ULONG Token;
+ UCHAR BackupServerList[1];
+} BACKUP_LIST_RESPONSE_1, *PBACKUP_LIST_RESPONSE_1;
+
+typedef struct _BACKUP_LIST_RESPONSE {
+ UCHAR Type;
+ BACKUP_LIST_RESPONSE_1 BackupListResponse;
+} BACKUP_LIST_RESPONSE, *PBACKUP_LIST_RESPONSE;
+
+
+//
+// Message indicating that a potential browser server should become a backup
+// server.
+//
+
+typedef struct _BECOME_BACKUP_1 {
+ UCHAR BrowserToPromote[1];
+} BECOME_BACKUP_1, *PBECOME_BACKUP_1;
+
+typedef struct _BECOME_BACKUP {
+ UCHAR Type;
+ BECOME_BACKUP_1 BecomeBackup;
+} BECOME_BACKUP, *PBECOME_BACKUP;
+
+
+//
+// Sent during the election process.
+//
+
+typedef struct _REQUEST_ELECTION_1 {
+ UCHAR Version;
+ ULONG Criteria;
+ ULONG TimeUp;
+ ULONG MustBeZero;
+ UCHAR ServerName[1];
+} REQUEST_ELECTION_1, *PREQUEST_ELECTION_1;
+
+typedef struct _REQUEST_ELECTION {
+ UCHAR Type;
+ REQUEST_ELECTION_1 ElectionRequest;
+} REQUEST_ELECTION, *PREQUEST_ELECTION;
+
+#define ELECTION_CR_OSTYPE 0xFF000000L // Native OS running on server
+#define ELECTION_CR_OSWFW 0x01000000L // Windows for workgroups server
+#define ELECTION_CR_WIN_NT 0x10000000L // Windows/NT Server
+#define ELECTION_CR_LM_NT 0x20000000L // Lan Manager for Windows/NT
+
+#define ELECTION_CR_REVISION 0x00FFFF00L // Browser software revision
+#define ELECTION_MAKE_REV(major, minor) (((major)&0xffL)<<16|((minor)&0xFFL)<<8)
+
+#define ELECTION_CR_DESIRE 0x000000FFL // Desirability of becoming master.
+
+//
+// Election desirability within criteria.
+//
+// Most important is a running PDC, next is a configured domain master.
+//
+// After that come running masters, then configured backups, then existing
+// running backups.
+//
+// Machines running WINS client are important because they are more capable
+// of connecting to a PDC who's address was configured via DHCP.
+//
+
+#define ELECTION_DESIRE_AM_BACKUP 0x00000001L // Currently is backup
+#define ELECTION_DESIRE_AM_CFG_BKP 0x00000002L // Always want to be
+ // master - set if backup &&
+ // MaintainServerList==YES
+#define ELECTION_DESIRE_AM_MASTER 0x00000004L // Currently is master
+#define ELECTION_DESIRE_AM_DOMMSTR 0x00000008L // Configured as domain master
+
+#define ELECTION_DESIRE_WINS_CLIENT 0x00000020L // Transport running WINS client
+
+#define ELECTION_DESIRE_AM_PDC 0x00000080L // Machine is a lanman NT server.
+
+//
+// "Tickle" packet - sent to change state of browser.
+//
+
+typedef struct _RESET_STATE_1 {
+ UCHAR Options;
+} RESET_STATE_1, *PRESET_STATE_1;
+
+typedef struct _RESET_STATE {
+ UCHAR Type;
+ RESET_STATE_1 ResetStateRequest;
+} RESET_STATE, *PRESET_STATE;
+
+#define RESET_STATE_STOP_MASTER 0x01 // Stop being master
+#define RESET_STATE_CLEAR_ALL 0x02 // Clear all browser state.
+#define RESET_STATE_STOP 0x04 // Stop the browser service.
+
+//
+// Master Announcement - Send from master to domain master.
+//
+
+typedef struct _MASTER_ANNOUNCEMENT_1 {
+ UCHAR MasterName[1];
+} MASTER_ANNOUNCEMENT_1, *PMASTER_ANNOUNCEMENT_1;
+
+typedef struct _MASTER_ANNOUNCEMENT {
+ UCHAR Type;
+ MASTER_ANNOUNCEMENT_1 MasterAnnouncement;
+} MASTER_ANNOUNCEMENT, *PMASTER_ANNOUNCEMENT;
+
+
+ //
+// Definitions for Workstation interrogation and revalidation transactions
+//
+
+typedef struct _WKSTA_INFO_INTERROGATE_PACKET {
+ UCHAR CompatibilityPad;
+ ULONG Delay ; // Number of milliseconds to wait before replying
+ CHAR ReturnMailslot[1] ; // Mailslot to reply to.
+} WKSTA_INFO_INTERROGATE_PACKET, *PWKSTA_INFO_INTERROGATE_PACKET;
+
+typedef struct _WKSTA_INFO_RESPONSE_PACKET {
+ UCHAR CompatibilityPad;
+ UCHAR VersionMajor;
+ UCHAR VersionMinor;
+ USHORT OsVersion ;
+ CHAR ComputerName[1] ; // var-length ASCIIZ string */
+#if 0
+//
+// The following two ASCIIZ strings are not defined in the structure
+// but are concatenated to the end of the structure.
+//
+ CHAR UserName[] ;
+ CHAR LogonDomain[] ;
+#endif
+} WKSTA_INFO_RESPONSE_PACKET, *PWKSTA_INFO_RESPONSE_PACKET;
+
+typedef struct _WKSTA_RELOGON_REQUEST_PACKET {
+ UCHAR CompatibilityPad;
+ ULONG Delay ;
+ ULONG Flags ;
+ CHAR ReturnMailslot[1] ; // var-length ASCIIZ string
+#if 0
+//
+// The following ASCIIZ string is not defined in the structure
+// but is concatenated to the end of the structure.
+//
+
+ CHAR DC_Name[] ;
+#endif
+} WKSTA_RELOGON_REQUEST_PACKET, *PWKSTA_RELOGON_REQUEST_PACKET;
+
+//
+// Values for <wkrrq_flags> field */
+//
+
+#define WKRRQ_FLAG_LOGON_SERVER 0x1 // I'm your official logon server;
+ // do a relogon to me.
+ //
+
+typedef struct _WKSTA_RELOGON_RESPONSE_PACKET {
+ UCHAR CompatibilityPad;
+ USHORT Status ;
+ CHAR ComputerName[1] ; // var-length ASCIIZ string
+} WKSTA_RELOGON_RESPONSE_PACKET, *PWKSTA_RELOGON_RESPONSE_PACKET;
+
+
+//
+// Values for <wkrrs_status> field
+//
+
+#define WKRRS_STATUS_SUCCEEDED 0 // Operation succeeded
+#define WKRRS_STATUS_DENIED 1 // Operation denied to caller
+#define WKRRS_STATUS_FAILED 2 // Operation tried but failed
+
+#define EXCESS_NAME_LEN (sizeof(ITRANS_MS_NAME) - \
+ FIELD_OFFSET(SMB_TRANSACTION_MAILSLOT, Buffer) )
+
+//
+// This structure defines all of the types of requests that appear in messages
+// to the internal mailslot.
+//
+
+typedef struct _INTERNAL_TRANSACTION {
+ UCHAR Type; // Type of request.
+ union {
+ HOST_ANNOUNCE_PACKET_1 Announcement ;
+ BROWSE_ANNOUNCE_PACKET_1 BrowseAnnouncement ;
+ REQUEST_ANNOUNCE_PACKET_1 RequestAnnounce ;
+ BACKUP_LIST_RESPONSE_1 GetBackupListResp ;
+ BACKUP_LIST_REQUEST_1 GetBackupListRequest ;
+ BECOME_BACKUP_1 BecomeBackup ;
+ REQUEST_ELECTION_1 RequestElection ;
+ MASTER_ANNOUNCEMENT_1 MasterAnnouncement ;
+ RESET_STATE_1 ResetState ;
+
+ WKSTA_INFO_INTERROGATE_PACKET InterrogateRequest ;
+ WKSTA_INFO_RESPONSE_PACKET InterrogateResponse ;
+ WKSTA_RELOGON_REQUEST_PACKET RelogonRequest ;
+ WKSTA_RELOGON_RESPONSE_PACKET RelogonResponse ;
+ } Union;
+} INTERNAL_TRANSACTION, *PINTERNAL_TRANSACTION ;
+
+#include <packoff.h>
+
+#endif // _HOSTANNC_
+
diff --git a/private/inc/icmp.h b/private/inc/icmp.h
new file mode 100644
index 000000000..92fbb8450
--- /dev/null
+++ b/private/inc/icmp.h
@@ -0,0 +1,135 @@
+
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ icmp.h
+
+Abstract:
+
+ This module declares the ICMP APIs that are provided for use
+ primarily by the NT tcp/ip utilities.
+
+Author:
+
+ John Ballard (jballard) April 1, 1993
+
+Revision History:
+
+
+
+--*/
+
+#ifndef _ICMP_
+#define _ICMP_
+
+
+#if (_MSC_VER >= 800)
+#define STRMAPI __stdcall
+#else
+#define _cdecl
+#define STRMAPI
+#endif
+
+/*
+ *
+ * register_icmp returns a handle to an open stream to icmp or
+ * ICMP_ERROR if an error occurs.
+ *
+ */
+
+extern HANDLE STRMAPI register_icmp(void);
+
+#define ICMP_ERROR ((HANDLE) -3)
+
+/*
+ *
+ * If an error occurs a GetLastError() will return the reason for the error.
+ *
+ */
+
+#define ICMP_OPEN_ERROR 1
+#define ICMP_PUTMSG_ERROR 2
+#define ICMP_GETMSG_ERROR 3
+#define ICMP_IN_USE 4
+#define ICMP_INVALID_PROT 5
+
+/*
+ *
+ * do_echo_req generates an icmp echo request packet
+ *
+ * parameters are:
+ *
+ * fd - handle of stream to icmp (returned by register_icmp call)
+ * addr - ip address of host to ping in form returned by inet_addr()
+ * data - buffer containing data for ping packet
+ * datalen - length of data buffer
+ * optptr - buffer containing ip options to use for this packet
+ * optlen - option buffer length
+ * df - don't fragment flag
+ * ttl - time to live value
+ * tos - type of service value
+ * preced - precedence value
+ *
+ * returns:
+ *
+ * 0 if no error occured or
+ * standard unix error values ENOMEM, ERANGE, etc.
+ *
+ */
+
+extern int STRMAPI
+do_echo_req( HANDLE fd, long addr, char * data, int datalen,
+ char *optptr, int optlen, int df, int ttl, int tos, int preced);
+
+
+/*
+ *
+ * do_echo_rep receives the reply to an icmp echo request packet
+ *
+ * parameters are:
+ *
+ * fd - handle of stream to icmp (returned by register_icmp call)
+ * rdata - buffer containing data for ping packet
+ * rdatalen - length of data buffer
+ * rtype - type of packet returned (see
+ * rttl - time to live value
+ * rtos - type of service value
+ * rpreced - precedence value
+ * rdf - don't fragment flag
+ * roptptr - buffer containing ip options to use for this packet
+ * roptlen - option buffer length
+ *
+ * returns:
+ *
+ * 0 if no error occured. rtype will indicate type of packet received.
+ * -1 if error occured. GetLastError() will indicate actual error.
+ * -3 if invalid msg returned. GetLastError() will indicate type.
+ *
+ */
+
+extern int STRMAPI
+do_echo_rep( HANDLE fd, char *rdata, int rdatalen, int *rtype,
+ int *rttl, int *rtos, int *rpreced, int *rdf,
+ char *roptptr, int *roptlen);
+
+
+/*
+ * If -1 return then GetLastError returns the following.
+ */
+
+#define POLL_TIMEOUT 0
+#define POLL_FAILED 1
+
+/*
+ * Values returned by do_echo_rep in rtype
+ */
+
+#define ECHO_REPLY 0 /* echo reply */
+#define DEST_UNR 3 /* destination unreachable: */
+#define TIME_EXCEEDED 11 /* time exceeded: */
+#define PARAMETER_ERROR 12 /* parameter problem */
+
+#endif
diff --git a/private/inc/icmpif.h b/private/inc/icmpif.h
new file mode 100644
index 000000000..5938cba58
--- /dev/null
+++ b/private/inc/icmpif.h
@@ -0,0 +1,36 @@
+/********************************************************************/
+/** Microsoft LAN Manager **/
+/** Copyright(c) Microsoft Corp., 1990-1992 **/
+/********************************************************************/
+/* :ts=4 */
+
+//** ICMPIF.H - ICMP echo private kernel/user request interface
+//
+
+#ifndef ICMPIF_INCLUDED
+#define ICMPIF_INCLUDED
+
+
+//
+// Common ICMP request structure
+//
+typedef struct icmp_echo_request {
+ unsigned long Address; // Destination address
+ unsigned long Timeout; // Request timeout
+ unsigned short DataOffset; // Echo data
+ unsigned short DataSize; // Echo data size
+ unsigned char OptionsValid; // nonzero if options data is valid.
+ unsigned char Ttl; // IP header Time To Live
+ unsigned char Tos; // IP header Type of Service
+ unsigned char Flags; // IP header flags
+ unsigned short OptionsOffset; // IP options data
+ unsigned char OptionsSize; // IP options data size
+ unsigned char Padding; // 32-bit alignment padding
+} ICMP_ECHO_REQUEST, *PICMP_ECHO_REQUEST;
+
+
+//
+// The reply structure is defined in ipexport.h
+//
+
+#endif // ICMPIF_INCLUDED
diff --git a/private/inc/ipinfo.h b/private/inc/ipinfo.h
new file mode 100644
index 000000000..7889a01d1
--- /dev/null
+++ b/private/inc/ipinfo.h
@@ -0,0 +1,151 @@
+/********************************************************************/
+/** Microsoft LAN Manager **/
+/** Copyright(c) Microsoft Corp., 1990-1992 **/
+/********************************************************************/
+/* :ts=4 */
+
+//** IPINFO.H - IP SNMP information definitions..
+//
+// This file contains all of the definitions for IP that are
+// related to SNMP information gathering.
+
+#ifndef IPINFO_INCLUDED
+#define IPINFO_INCLUDED
+
+
+#ifndef CTE_TYPEDEFS_DEFINED
+#define CTE_TYPEDEFS_DEFINED
+
+typedef unsigned long ulong;
+typedef unsigned short ushort;
+typedef unsigned char uchar;
+typedef unsigned int uint;
+
+#endif // CTE_TYPEDEFS_DEFINED
+
+
+typedef struct IPSNMPInfo {
+ ulong ipsi_forwarding;
+ ulong ipsi_defaultttl;
+ ulong ipsi_inreceives;
+ ulong ipsi_inhdrerrors;
+ ulong ipsi_inaddrerrors;
+ ulong ipsi_forwdatagrams;
+ ulong ipsi_inunknownprotos;
+ ulong ipsi_indiscards;
+ ulong ipsi_indelivers;
+ ulong ipsi_outrequests;
+ ulong ipsi_routingdiscards;
+ ulong ipsi_outdiscards;
+ ulong ipsi_outnoroutes;
+ ulong ipsi_reasmtimeout;
+ ulong ipsi_reasmreqds;
+ ulong ipsi_reasmoks;
+ ulong ipsi_reasmfails;
+ ulong ipsi_fragoks;
+ ulong ipsi_fragfails;
+ ulong ipsi_fragcreates;
+ ulong ipsi_numif;
+ ulong ipsi_numaddr;
+ ulong ipsi_numroutes;
+} IPSNMPInfo;
+
+typedef struct ICMPStats {
+ ulong icmps_msgs;
+ ulong icmps_errors;
+ ulong icmps_destunreachs;
+ ulong icmps_timeexcds;
+ ulong icmps_parmprobs;
+ ulong icmps_srcquenchs;
+ ulong icmps_redirects;
+ ulong icmps_echos;
+ ulong icmps_echoreps;
+ ulong icmps_timestamps;
+ ulong icmps_timestampreps;
+ ulong icmps_addrmasks;
+ ulong icmps_addrmaskreps;
+} ICMPStats;
+
+typedef struct ICMPSNMPInfo {
+ ICMPStats icsi_instats;
+ ICMPStats icsi_outstats;
+} ICMPSNMPInfo;
+
+#define IP_FORWARDING 1
+#define IP_NOT_FORWARDING 2
+
+typedef struct IPAddrEntry {
+ ulong iae_addr;
+ ulong iae_index;
+ ulong iae_mask;
+ ulong iae_bcastaddr;
+ ulong iae_reasmsize;
+ ushort iae_context;
+ ushort iae_pad;
+} IPAddrEntry;
+
+typedef struct IPRouteEntry {
+ ulong ire_dest;
+ ulong ire_index;
+ ulong ire_metric1;
+ ulong ire_metric2;
+ ulong ire_metric3;
+ ulong ire_metric4;
+ ulong ire_nexthop;
+ ulong ire_type;
+ ulong ire_proto;
+ ulong ire_age;
+ ulong ire_mask;
+ ulong ire_metric5;
+ void *ire_context;
+} IPRouteEntry;
+
+typedef struct AddrXlatInfo {
+ ulong axi_count;
+ ulong axi_index;
+} AddrXlatInfo;
+
+#define IRE_TYPE_OTHER 1
+#define IRE_TYPE_INVALID 2
+#define IRE_TYPE_DIRECT 3
+#define IRE_TYPE_INDIRECT 4
+
+#define IRE_PROTO_OTHER 1
+#define IRE_PROTO_LOCAL 2
+#define IRE_PROTO_NETMGMT 3
+#define IRE_PROTO_ICMP 4
+#define IRE_PROTO_EGP 5
+#define IRE_PROTO_GGP 6
+#define IRE_PROTO_HELLO 7
+#define IRE_PROTO_RIP 8
+#define IRE_PROTO_IS_IS 9
+#define IRE_PROTO_ES_IS 10
+#define IRE_PROTO_CISCO 11
+#define IRE_PROTO_BBN 12
+#define IRE_PROTO_OSPF 13
+#define IRE_PROTO_BGP 14
+
+#define IRE_METRIC_UNUSED 0xffffffff
+
+#define IP_MIB_STATS_ID 1
+#define ICMP_MIB_STATS_ID 1
+
+#define AT_MIB_ADDRXLAT_INFO_ID 1
+#define AT_MIB_ADDRXLAT_ENTRY_ID 0x101
+
+#define IP_MIB_RTTABLE_ENTRY_ID 0x101
+#define IP_MIB_ADDRTABLE_ENTRY_ID 0x102
+
+#define IP_INTFC_FLAG_P2P 1
+
+typedef struct IPInterfaceInfo {
+ ulong iii_flags;
+ ulong iii_mtu;
+ ulong iii_speed;
+ ulong iii_addrlength;
+ uchar iii_addr[1];
+} IPInterfaceInfo;
+
+#define IP_INTFC_INFO_ID 0x103
+
+#endif // IPINFO_INCLUDED
diff --git a/private/inc/ipxfwd.h b/private/inc/ipxfwd.h
new file mode 100644
index 000000000..a7fa1c523
--- /dev/null
+++ b/private/inc/ipxfwd.h
@@ -0,0 +1,253 @@
+/*++
+
+Copyright (c) 1995 Microsoft Corporation
+
+Module Name:
+
+ private\inc\ipxfwd.h
+
+Abstract:
+ Router Manager Interface to IPX Forwarder Driver
+
+
+Author:
+
+ Vadim Eydelman
+
+Revision History:
+
+--*/
+
+#ifndef _IPXFWD_
+#define _IPXFWD_
+
+#define FWD_INTERNAL_INTERFACE_INDEX 0
+
+// Forwarder interface statistic structure
+typedef struct _FWD_IF_STATS {
+ ULONG OperationalState; // Real state of the interface
+#define FWD_OPER_STATE_UP 0
+#define FWD_OPER_STATE_DOWN 1
+#define FWD_OPER_STATE_SLEEPING 2
+ ULONG MaxPacketSize; // Maximum packet size allowed on the intf
+ ULONG InHdrErrors; // Num. of packets received with header errors
+ ULONG InFiltered; // Num. of received packets that were filtered out
+ ULONG InNoRoutes; // Num, of received packets with unknonw dest.
+ ULONG InDiscards; // Num. of received packets discarded for other reasons
+ ULONG InDelivers; // Num. of received packets delivered to dest
+ ULONG OutFiltered; // Num. of sent packets fitered out
+ ULONG OutDiscards; // Num. of sent packets discarded for other reasons
+ ULONG OutDelivers; // Num. of sent packets delivered to dest
+ ULONG NetbiosReceived; // Num. of received Netbios packets
+ ULONG NetbiosSent; // Num. of sent Netbios packets
+ } FWD_IF_STATS, *PFWD_IF_STATS;
+
+
+typedef struct _FWD_ADAPTER_BINDING_INFO {
+ ULONG AdapterIndex;
+ ULONG Network;
+ UCHAR LocalNode[6];
+ UCHAR RemoteNode[6];
+ ULONG MaxPacketSize;
+ ULONG LinkSpeed;
+ } FWD_ADAPTER_BINDING_INFO, *PFWD_ADAPTER_BINDING_INFO;
+
+typedef struct FWD_NB_NAME {
+ UCHAR Name[16];
+} FWD_NB_NAME, *PFWD_NB_NAME;
+
+typedef struct _FWD_PERFORMANCE {
+ LONGLONG TotalPacketProcessingTime;
+ LONGLONG TotalNbPacketProcessingTime;
+ LONGLONG MaxPacketProcessingTime;
+ LONGLONG MaxNbPacketProcessingTime;
+ LONG PacketCounter;
+ LONG NbPacketCounter;
+} FWD_PERFORMANCE, *PFWD_PERFORMANCE;
+
+typedef struct _FWD_DIAL_REQUEST {
+ ULONG IfIndex;
+ UCHAR Packet[30];
+} FWD_DIAL_REQUEST, *PFWD_DIAL_REQUEST;
+
+#define IPXFWD_NAME L"\\Device\\NwLnkFwd"
+
+//
+// Define the various device type values. Note that values used by Microsoft
+// Corporation are in the range 0-32767, and 32768-65535 are reserved for use
+// by customers.
+//
+
+#define FILE_DEVICE_IPXFWD FILE_DEVICE_NETWORK
+
+
+
+//
+// Macro definition for defining IOCTL and FSCTL function control codes. Note
+// that function codes 0-2047 are reserved for Microsoft Corporation, and
+// 2048-4095 are reserved for customers.
+//
+
+#define IPXFWD_IOCTL_INDEX (ULONG)0x00000800
+
+//
+// Define our own private IOCTLs
+//
+
+// Adds interface to the forwarder table, FWD_IF_SET_PARAMS should be passed in
+// the input buffer
+#define IOCTL_FWD_CREATE_INTERFACE \
+ CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+1,METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+// Deletes interface from the forwarder table, Interface index should be passed in
+// the input buffer
+#define IOCTL_FWD_DELETE_INTERFACE \
+ CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+2,METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+// Sets interface parameters, FWD_IF_SET_PARAMS should be passed in
+// the input buffer
+#define IOCTL_FWD_SET_INTERFACE \
+ CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+3,METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+// Gets interface parameters, FWD_IF_GET_PARAMS will be returned in
+// the input buffer
+#define IOCTL_FWD_GET_INTERFACE \
+ CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+4,METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+// Binds interface to physical adapter, FWD_IF_BIND_PARAMS should be passed in
+// the input buffer
+#define IOCTL_FWD_BIND_INTERFACE \
+ CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+5,METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+// Unbinds interface from the adapter, Interface index should be passed in
+// the input buffer
+#define IOCTL_FWD_UNBIND_INTERFACE \
+ CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+6,METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+// Disables forwarder operations in the interface, Interface index should be
+// passed in the input buffer
+#define IOCTL_FWD_DISABLE_INTERFACE \
+ CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+7,METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+// Enables forwarder operations in the interface, Interface index should be
+// passed in the input buffer
+#define IOCTL_FWD_ENABLE_INTERFACE \
+ CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+8,METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+// Sets netbios names in to resolve netbios broadcasts to this interface,
+// Interface index should be passed in the input buffer,
+// FWD_NB_NAMES_PARAMS structure should be passed in the output buffer
+#define IOCTL_FWD_SET_NB_NAMES \
+ CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+9,METHOD_IN_DIRECT,FILE_ANY_ACCESS)
+
+// Resets netbios names on the interface (deletes all of them).
+// Interface index should be passed in the input buffer,
+#define IOCTL_FWD_RESET_NB_NAMES \
+ CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+9,METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+// Sets netbios names in to resolve netbios broadcasts to this interface,
+// Interface index should be passed in the input buffer,
+// FWD_NB_NAMES_PARAMS structure will be returned in the output buffer
+#define IOCTL_FWD_GET_NB_NAMES \
+ CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+10,METHOD_OUT_DIRECT,FILE_ANY_ACCESS)
+
+// Adds/deletes/updates routes in forwarder table, array of FWD_ROUTE_SET_PARAMS
+// should be passed in the input buffer. Returns number of processed routes in the
+// ioStatus.Information field
+#define IOCTL_FWD_SET_ROUTES \
+ CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+11,METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+// Returns forwarder dial requests, FWD_DIAL_REQUEST_PARAMS structure
+// for interfaces for which connection should be established returned
+// in the output buffer (number of bytest returned is placed in the
+// Information field of IO_STATUS block)
+#define IOCTL_FWD_GET_DIAL_REQUEST \
+ CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+12,METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+// Informs forwarder that its connection request could not be satisfied,
+// Interface index should be passed in the input buffer
+#define IOCTL_FWD_DIAL_REQUEST_FAILED \
+ CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+13,METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+// Initializes and start forwarder
+// FWD_START_PARAMS structure should be passed in the input buffer
+#define IOCTL_FWD_START \
+ CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+14,METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+#define IOCTL_FWD_GET_PERF_COUNTERS \
+ CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+15,METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+// Structure passed with IOCTL_FWD_CREATE_INTERFACE call
+typedef struct _FWD_IF_CREATE_PARAMS {
+ ULONG Index; // Interface index
+ BOOLEAN NetbiosAccept; // Whether to accept nb packets
+ UCHAR NetbiosDeliver; // NB deliver mode
+// Forwarder netbios broadcast delivery options
+#define FWD_NB_DONT_DELIVER 0
+#define FWD_NB_DELIVER_STATIC 1
+#define FWD_NB_DELIVER_IF_UP 2
+#define FWD_NB_DELIVER_ALL 3
+ UCHAR InterfaceType; // Interface type
+// Forwarder interface types
+#define FWD_IF_PERMANENT 0
+#define FWD_IF_DEMAND_DIAL 1
+#define FWD_IF_LOCAL_WORKSTATION 2
+#define FWD_IF_REMOTE_WORKSTATION 3
+} FWD_IF_CREATE_PARAMS, *PFWD_IF_CREATE_PARAMS;
+
+// Structure passed with IOCTL_FWD_SET_INTERFACE call
+typedef struct _FWD_IF_SET_PARAMS {
+ ULONG Index; // Interface index
+ BOOLEAN NetbiosAccept; // Whether to accept nb packets
+ UCHAR NetbiosDeliver; // NB deliver mode
+} FWD_IF_SET_PARAMS, *PFWD_IF_SET_PARAMS;
+
+// Structure returned in IOCTL_FWD_GET_INTERFACE call
+typedef struct _FWD_IF_GET_PARAMS {
+ FWD_IF_STATS Stats; // Interface statistics
+ BOOLEAN NetbiosAccept; // Whether to accept nb packets
+ UCHAR NetbiosDeliver; // NB deliver mode
+} FWD_IF_GET_PARAMS, *PFWD_IF_GET_PARAMS;
+
+// Structure returned in IOCTL_FWD_BIND_INTERFACE call
+typedef struct _FWD_IF_BIND_PARAMS {
+ ULONG Index; // Interface index
+ FWD_ADAPTER_BINDING_INFO Info; // Interface binding information
+} FWD_IF_BIND_PARAMS, *PFWD_IF_BIND_PARAMS;
+
+// Structure passed with IOCTL_FWD_SET_ROUTES call
+typedef struct _FWD_ROUTE_SET_PARAMS {
+ ULONG Network; // Route's destination network
+ UCHAR NextHopAddress[6]; // Node address of the next hop
+ // router if network is not
+ // connected directly
+ USHORT TickCount;
+ USHORT HopCount;
+ ULONG InterfaceIndex; // Interface to use to route to
+ // the dest network
+ ULONG Action; // Action to take with the route:
+#define FWD_ADD_ROUTE 0 // route should be added to the table
+#define FWD_DELETE_ROUTE 1 // route should be deleted from the table
+#define FWD_UPDATE_ROUTE 2 // route should be updated
+} FWD_ROUTE_SET_PARAMS, *PFWD_ROUTE_SET_PARAMS;
+
+typedef struct _FWD_START_PARAMS {
+ ULONG RouteHashTableSize; // Size of route hash table
+ BOOLEAN ThisMachineOnly; // allow access to this machine only
+ // for dialin clients
+#define FWD_SMALL_ROUTE_HASH_SIZE 31
+#define FWD_MEDIUM_ROUTE_HASH_SIZE 257
+#define FWD_LARGE_ROUTE_HASH_SIZE 1027
+} FWD_START_PARAMS, *PFWD_START_PARAMS;
+
+typedef struct _FWD_NB_NAMES_PARAMS {
+ ULONG TotalCount;
+ FWD_NB_NAME Names[1];
+} FWD_NB_NAMES_PARAMS, *PFWD_NB_NAMES_PARAMS;
+
+typedef struct _FWD_PERFORMANCE FWD_PERFORMANCE_PARAMS, *PFWD_PERFORMANCE_PARAMS;
+
+
+
+#endif
+
diff --git a/private/inc/ipxtfflt.h b/private/inc/ipxtfflt.h
new file mode 100644
index 000000000..313e67a7a
--- /dev/null
+++ b/private/inc/ipxtfflt.h
@@ -0,0 +1,227 @@
+/*++
+
+Copyright (c) 1995 Microsoft Corporation
+
+Module Name:
+
+ private\inc\ipxtfflt.h
+
+Abstract:
+ Interface with ipx filter driver
+ Filter structure definitions
+
+Author:
+
+ Vadim Eydelman
+
+Revision History:
+
+--*/
+
+#ifndef _IPXTFFLT_
+#define _IPXTFFLT_
+
+//*** IPX Traffic Filters ***
+
+typedef struct _IPX_TRAFFIC_FILTER_GLOBAL_INFO {
+ ULONG FilterAction; // Action if there is a match with
+ // any filter on the interface
+ } IPX_TRAFFIC_FILTER_GLOBAL_INFO, *PIPX_TRAFFIC_FILTER_GLOBAL_INFO;
+
+// FilterAction
+
+#define IPX_TRAFFIC_FILTER_ACTION_PERMIT 1
+#define IPX_TRAFFIC_FILTER_ACTION_DENY 2
+
+
+// general traffic filter info structure
+
+typedef struct _IPX_TRAFFIC_FILTER_INFO {
+
+ ULONG FilterDefinition;
+ UCHAR DestinationNetwork[4];
+ UCHAR DestinationNetworkMask[4];
+ UCHAR DestinationNode[6];
+ UCHAR DestinationSocket[2];
+ UCHAR SourceNetwork[4];
+ UCHAR SourceNetworkMask[4];
+ UCHAR SourceNode[6];
+ UCHAR SourceSocket[2];
+ UCHAR PacketType;
+ } IPX_TRAFFIC_FILTER_INFO, *PIPX_TRAFFIC_FILTER_INFO;
+
+// FilterDefinition - Flags to specify relevant IPX address fields to filter on
+
+#define IPX_TRAFFIC_FILTER_ON_SRCNET 0x00000001
+#define IPX_TRAFFIC_FILTER_ON_SRCNODE 0x00000002
+#define IPX_TRAFFIC_FILTER_ON_SRCSOCKET 0x00000004
+
+#define IPX_TRAFFIC_FILTER_ON_DSTNET 0x00000010
+#define IPX_TRAFFIC_FILTER_ON_DSTNODE 0x00000020
+#define IPX_TRAFFIC_FILTER_ON_DSTSOCKET 0x00000040
+
+#define IPX_TRAFFIC_FILTER_ON_PKTTYPE 0x00000100
+#define IPX_TRAFFIC_FILTER_LOG_MATCHES 0x80000000
+
+ // Filter driver exported device object name
+#define IPXFLT_NAME L"\\Device\\NwLnkFlt"
+ // Networks device (implies certain admin access privilegies)
+#define FILE_DEVICE_IPXFLT FILE_DEVICE_NETWORK
+
+
+ // All our IOCLTS are custom (private to this driver only)
+#define IPXFWD_IOCTL_INDEX (ULONG)0x00000800
+
+
+// Starts the driver
+// Parameters:
+// IN InputBuffer - NULL
+// IN InputBufferSize - 0
+// IN OutputBuffer - NULL
+// IN OutputBufferSize - 0
+// Returns:
+// Status:
+// STATUS_SUCCESS - driver was started ok
+// STATUS_INVALID_PARAMETER - invalid input parameter
+// STATUS_INSUFFICIENT_RESOURCES - not enough resources to allocate
+// all internal structures
+#define IOCTL_FLT_START \
+ CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+0,METHOD_IN_DIRECT,FILE_ANY_ACCESS)
+
+// Sets input filters on interface
+// Parameters:
+// IN InputBuffer - FLT_IF_SET_PARAMS
+// IN InputBufferSize - sizeof (FLT_IF_SET_PARAMS)
+// IN OutputBuffer - array of TRAFFIC_FILTER_INFO blocks
+// IN OutputBufferSize - size of the OutputBuffer
+// Returns:
+// Status:
+// STATUS_SUCCESS - filters were set ok
+// STATUS_INVALID_PARAMETER - invalid input parameter
+// STATUS_INSUFFICIENT_RESOURCES - not enough memory to allocate
+// filter description block
+#define IOCTL_FLT_IF_SET_IN_FILTERS \
+ CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+1,METHOD_IN_DIRECT,FILE_ANY_ACCESS)
+
+// Sets output filters on interface
+// Parameters:
+// IN InputBuffer - FLT_IF_SET_PARAMS
+// IN InputBufferSize - sizeof (FLT_IF_SET_PARAMS)
+// IN OutputBuffer - array of TRAFFIC_FILTER_INFO blocks
+// IN OutputBufferSize - size of the OutputBuffer
+// Returns:
+// Status:
+// STATUS_SUCCESS - filters were set ok
+// STATUS_INVALID_PARAMETER - invalid input parameter
+// STATUS_INSUFFICIENT_RESOURCES - not enough memory to allocate
+// filter description block
+#define IOCTL_FLT_IF_SET_OUT_FILTERS \
+ CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+2,METHOD_IN_DIRECT,FILE_ANY_ACCESS)
+
+
+// Resets (deletes) all input filters on interface
+// Parameters:
+// IN InputBuffer - interface index
+// IN InputBufferSize - sizeof (ULONG)
+// IN OutputBuffer - NULL
+// IN OutputBufferSize - 0
+// Returns:
+// Status:
+// STATUS_SUCCESS - filters were reset ok
+// STATUS_INVALID_PARAMETER - invalid input parameter
+#define IOCTL_FLT_IF_RESET_IN_FILTERS \
+ CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+3,METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+// Resets (deletes) all output filters on interface
+// Parameters:
+// IN InputBuffer - interface index
+// IN InputBufferSize - sizeof (ULONG)
+// IN OutputBuffer - NULL
+// IN OutputBufferSize - 0
+// Returns:
+// Status:
+// STATUS_SUCCESS - filters were reset ok
+// STATUS_INVALID_PARAMETER - invalid input parameter
+#define IOCTL_FLT_IF_RESET_OUT_FILTERS \
+ CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+4,METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+// Returns input filters on interface
+// Parameters:
+// IN InputBuffer - interface index
+// IN InputBufferSize - sizeof (ULONG)
+// OUT OutputBuffer - buffer to receive FLT_IF_GET_PARAMS followed
+// by the TRAFFIC_FILTER_INFO array
+// IN OutputBufferSize - at least sizeof (FLT_IF_GET_PARAMS)
+// Returns:
+// Status:
+// STATUS_SUCCESS - all filters on interface were returned in
+// the output buffer
+// STATUS_BUFFER_OVERFLOW - out but buffer is too small to return
+// all the filters, only those that fit were
+// placed in the buffer
+// STATUS_INVALID_PARAMETER - invalid input parameter
+// Information:
+// Total number of bytes placed in the output buffer
+#define IOCTL_FLT_IF_GET_IN_FILTERS \
+ CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+5,METHOD_OUT_DIRECT,FILE_ANY_ACCESS)
+
+// Returns input filters on interface
+// Parameters:
+// IN InputBuffer - interface index
+// IN InputBufferSize - sizeof (ULONG)
+// OUT OutputBuffer - buffer to receive FLT_IF_GET_PARAMS followed
+// by the TRAFFIC_FILTER_INFO array
+// IN OutputBufferSize - at least sizeof (FLT_IF_GET_PARAMS)
+// Returns:
+// Status:
+// STATUS_SUCCESS - all filters on interface were returned in
+// the output buffer
+// STATUS_BUFFER_OVERFLOW - out but buffer is too small to return
+// all the filters, only those that fit were
+// placed in the buffer
+// STATUS_INVALID_PARAMETER - invalid input parameter
+// Information:
+// Total number of bytes placed in the output buffer
+#define IOCTL_FLT_IF_GET_OUT_FILTERS \
+ CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+6,METHOD_OUT_DIRECT,FILE_ANY_ACCESS)
+
+// Returns logged packets
+// Parameters:
+// IN InputBuffer - NULL
+// IN InputBufferSize - 0
+// OUT OutputBuffer - buffer to receive logged packets
+// IN OutputBufferSize - at least sizeof (FLT_PACKET_LOG)
+// Returns:
+// Status:
+// STATUS_SUCCESS - all filters on interface were returned in
+// the output buffer
+// STATUS_INVALID_PARAMETER - invalid input parameter
+// Information:
+// Total number of bytes placed in the output buffer
+#define IOCTL_FLT_GET_LOGGED_PACKETS \
+ CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+7,METHOD_OUT_DIRECT,FILE_ANY_ACCESS)
+
+typedef struct _FLT_IF_SET_PARAMS {
+ ULONG InterfaceIndex; // Index of the interface
+ ULONG FilterAction; // Filter action
+ ULONG FilterSize; // sizeof (IPX_TRAFFIC_FILTER_INFO)
+} FLT_IF_SET_PARAMS, *PFLT_IF_SET_PARAMS;
+
+typedef struct _FLT_IF_GET_PARAMS {
+ ULONG FilterAction; // Filter action
+ ULONG FilterSize; // sizeof (IPX_TRAFFIC_FILTER_INFO)
+ ULONG TotalSize; // Total size of filter description
+ // array
+} FLT_IF_GET_PARAMS, *PFLT_IF_GET_PARAMS;
+
+typedef struct _FLT_PACKET_LOG {
+ ULONG SrcIfIdx; // Index of source if (-1 - unknown)
+ ULONG DstIfIdx; // Index of dest if (-1 - unknown)
+ USHORT DataSize; // Total size of the data (at least 30)
+ USHORT SeqNum; // Sequence number to account for
+ // packets lost to lack of buffer space
+ UCHAR Header[30]; // IPX packet header followed by the
+ // data if any
+} FLT_PACKET_LOG, *PFLT_PACKET_LOG;
+
+#endif
diff --git a/private/inc/isltrack.h b/private/inc/isltrack.h
new file mode 100644
index 000000000..6b971868b
--- /dev/null
+++ b/private/inc/isltrack.h
@@ -0,0 +1,80 @@
+
+#ifndef _ISLTRACK_H_
+#define _ISLTRACK_H_
+
+#if defined(ENABLE_TRACK)
+
+//===========================================================================
+//
+// Interface: IShellLinkTracker
+//
+// The IShellLinkTracker interface is used to access the ShellLink's
+// CTracker object. For example, Monikers call this interface to set
+// the creation flags in the CTracker.
+//
+//
+// [Member functions]
+//
+// Initialize
+// This function is called to set the Creation Flags on
+// a ShellLinkTracker object
+//
+// Parameters: [DWORD] dwCreationFlags
+//
+// GetTrackFlags
+// This function is used to get the creation flags (known externally
+// as "track flags").
+//
+// Parameters: [DWORD *] pdwTrackFlags
+//
+// Resolve
+// This function resolves the shell link, searching for the
+// link if necessary.
+//
+// Parameters: [HWND] hwnd
+// - The window of the caller (can be GetDesktopWindow()).
+// [DWORD] fFlags
+// - Flags to control the Resolve, from the SLR_ enumeration.
+// [DWORD] dwRestricted
+// - Track Flags to be OR-ed with the ShellLink object's
+// internal Track Flags (a.k.a. Creation Flags).
+// [DWORD] dwTickCountDeadline
+// - The maximum amount of time, in milliseconds, for
+// which a search should execute (if a search is necessary).
+//
+//
+//===========================================================================
+
+#undef INTERFACE
+#define INTERFACE IShellLinkTracker
+
+DECLARE_INTERFACE_(IShellLinkTracker, IUnknown)
+{
+ // *** IUnknown methods ***
+ STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
+ STDMETHOD_(ULONG,AddRef) (THIS) PURE;
+ STDMETHOD_(ULONG,Release) (THIS) PURE;
+
+
+ // *** IShellLinkTracker methods ***
+ STDMETHOD(Initialize)(THIS_
+ DWORD dwTrackFlags) PURE;
+ STDMETHOD(GetTrackFlags)(THIS_
+ DWORD * pdwTrackFlags) PURE;
+ STDMETHOD(Resolve)(THIS_
+ HWND hwnd,
+ DWORD fFlags,
+ DWORD dwRestriction,
+ DWORD dwTickCountDeadline,
+ DWORD dwReserved ) PURE;
+
+
+};
+
+
+typedef IShellLinkTracker * LPSHELLLINKTRACKER;
+
+DEFINE_GUID(IID_IShellLinkTracker, 0x5E35D200L, 0xF3BB, 0x11CE, 0x9B, 0xDB, 0x00, 0xAA, 0x00, 0x4C, 0xD0, 0x1A);
+
+#endif // _CAIRO_
+#endif // _ISLTRACK_H_
diff --git a/private/inc/isnkrnl.h b/private/inc/isnkrnl.h
new file mode 100644
index 000000000..13baef8e7
--- /dev/null
+++ b/private/inc/isnkrnl.h
@@ -0,0 +1,528 @@
+/*++
+
+Copyright (c) 1993 Microsoft Corporation
+
+Module Name:
+
+ isnkrnl.h
+
+Abstract:
+
+ This header file contains interface definitions for NT clients
+ of the ISN IPX/SPX/Netbios stack.
+
+Author:
+
+ Adam Barr (adamba) 10 November 1993
+
+Revision History:
+
+--*/
+
+
+
+#include <packon.h>
+
+//
+// Defines a local target. The NicId is assigned by IPX
+// for each adapter or WAN line it is bound to. The MacAddress
+// is generally the address of the remote machine or the
+// router that is used to get to the remote machine.
+//
+//
+
+//
+// [SanjayAn] Changed LocalTarget to include a NicHandle
+//
+
+#ifdef _PNP_POWER
+
+typedef struct _NIC_HANDLE {
+ USHORT NicId;
+
+#ifdef _PNP_LATER
+ ULONG Version;
+ CSHORT Signature;
+#endif _PNP_LATER
+
+} NIC_HANDLE, *PNIC_HANDLE;
+
+
+typedef struct _IPX_LOCAL_TARGET {
+ union {
+ USHORT NicId;
+ NIC_HANDLE NicHandle;
+ };
+ UCHAR MacAddress[6];
+} IPX_LOCAL_TARGET, *PIPX_LOCAL_TARGET;
+
+#else
+
+typedef USHORT NIC_HANDLE;
+typedef PUSHORT PNIC_HANDLE;
+
+typedef struct _IPX_LOCAL_TARGET {
+ USHORT NicId;
+ UCHAR MacAddress[6];
+} IPX_LOCAL_TARGET, *PIPX_LOCAL_TARGET;
+
+#endif _PNP_POWER
+
+//
+// Definition of the options on a TDI datagram. These
+// can be passed in as the Options field of a send
+// datagram. It is indicated as the Options on a receive
+// datagram, and will be copied into the Options field
+// of a posted receive datagram if there is room.
+//
+// The complete structure does not need to be passed.
+// Only the packet type can be passed, or nothing.
+//
+
+typedef struct _IPX_DATAGRAM_OPTIONS {
+ UCHAR PacketType;
+ UCHAR Reserved;
+ IPX_LOCAL_TARGET LocalTarget;
+} IPX_DATAGRAM_OPTIONS, *PIPX_DATAGRAM_OPTIONS;
+
+
+//
+// The extended address that some addresses want. If
+// the proper ioctl is set (MIPX_SENDADDROPT) then
+// this structure is passed as the remote address on
+// send datagrams...
+//
+
+typedef struct _IPX_ADDRESS_EXTENDED {
+ TA_IPX_ADDRESS IpxAddress;
+ UCHAR PacketType;
+} IPX_ADDRESS_EXTENDED, *PIPX_ADDRESS_EXTENDED;
+
+//
+// ...and this structure is passed on receive indications.
+// The values for Flags are defined right after it.
+// By using the MIPX_SETRCVFLAGS ioctl you can also
+// enable this format for receive addresses without
+// changing what is passed on sends.
+//
+
+typedef struct _IPX_ADDRESS_EXTENDED_FLAGS {
+ TA_IPX_ADDRESS IpxAddress;
+ UCHAR PacketType;
+ UCHAR Flags;
+} IPX_ADDRESS_EXTENDED_FLAGS, *PIPX_ADDRESS_EXTENDED_FLAGS;
+
+//
+// Just appends Nic to the above structure.
+//
+typedef struct _IPX_ADDRESS_EXTENDED_FLAGS2 {
+ TA_IPX_ADDRESS IpxAddress;
+ UCHAR PacketType;
+ UCHAR Flags;
+ ULONG Nic;
+} IPX_ADDRESS_EXTENDED_FLAGS2, *PIPX_ADDRESS_EXTENDED_FLAGS2;
+
+#define IPX_EXTENDED_FLAG_BROADCAST 0x01 // the frame was sent as a broadcast
+#define IPX_EXTENDED_FLAG_LOCAL 0x02 // the frame was sent from this machine
+
+
+
+//
+// The various states of the NICs (LAN/WAN)
+//
+#define NIC_CREATED 1
+#define NIC_DELETED 2
+#define NIC_CONNECTED 3
+#define NIC_DISCONNECTED 4
+#define NIC_LINE_DOWN 5
+#define NIC_LINE_UP 6
+#define NIC_CONFIGURED 7
+
+//
+// BUGBUG - Move the isnipx.h definitions over here
+//
+// Frame types. For now these mirror those in isnipx.h.
+//
+#define MISN_FRAME_TYPE_ETHERNET_II 0
+#define MISN_FRAME_TYPE_802_3 1
+#define MISN_FRAME_TYPE_802_2 2
+#define MISN_FRAME_TYPE_SNAP 3
+#define MISN_FRAME_TYPE_ARCNET 4 // we ignore this
+#define MISN_FRAME_TYPE_MAX 4 // of the four standard ones
+
+#define ISN_FRAME_TYPE_AUTO 0xff
+
+#include <packoff.h>
+
+//***NIC Info ***
+
+
+//
+// For now, we assume that there will not be more than 256 bindings.
+// This is a big enough number for most cases that we will encounter now
+// or the foreseeable future. We allocate an array of ULONGS of the above
+// dimension. This array stores in its first n elements pointers to the
+// bindings created for the various LAN and WAN adapters.
+//
+#define IPX_MAXIMUM_BINDINGS 256
+
+
+//
+// This is the interface that the Router process in address space uses
+// to open an address end point. Only one point can currently be opened.
+// The ea buffer should have the end point information in exactly the same
+// format as is used for TdiTransportAddress endpoint.
+//
+#define ROUTER_INTERFACE "RouterInterface"
+#define ROUTER_INTERFACE_LENGTH (sizeof("RouterInterface") - 1)
+
+//
+// Max. no. of ports that the Router can open
+//
+#define IPX_RT_MAX_ADDRESSES 16
+//
+// IPX_NIC_INFO. One or more such structures can be retrieved by a user
+// app through the MIPX_GETNEWNICS ioctl.
+//
+
+typedef struct _IPX_NIC_INFO {
+
+ ULONG InterfaceIndex; // relevant only for demand dial WAN interfaces
+ ULONG NetworkAddress; //network number
+ UCHAR LocalNodeAddress[6]; //nic address
+ UCHAR RemoteNodeAddress[6]; //remote nic address (only for WAN)
+ ULONG LinkSpeed; //speed of link
+ ULONG PacketType; //packet type 802.3 or whatever
+ ULONG MaxPacketSize; //Max. pkt size allowed on the link
+ ULONG NdisMediumType; //Medium type
+ ULONG NdisMediumSubtype; //
+ USHORT NicId; //Nic Id.
+ BOOLEAN Status;
+ ULONG ConnectionId; // used to match TimeSinceLastActivity IOCtls
+ ULONG IpxwanConfigRequired; // 1 - IPXWAN Required
+ } IPX_NIC_INFO, *PIPX_NIC_INFO;
+
+//
+// structure to be passed in the input buffer for the MIPX_GETNEWNICS IOCTL
+//
+typedef struct _IPX_NICS {
+ ULONG NoOfNics;
+ ULONG TotalNoOfNics;
+ ULONG fAllNicsDesired; //indicates that the client wants
+ //ipx to start afresh
+ UCHAR Data[1]; //memory holding an array of IPX_NIC_INFO
+ //structures starts here
+ } IPX_NICS, *PIPX_NICS;
+
+//
+// Enhanced OPTIONS structure for use with the MIPX_GETNEWNICS ioctl
+//
+typedef struct _IPX_DATAGRAM_OPTIONS2 {
+ IPX_DATAGRAM_OPTIONS DgrmOptions;
+ TDI_ADDRESS_IPX RemoteAddress;
+ ULONG LengthOfExtraOpInfo; //set it to the size of the extra
+ //option info.
+ char Data[1]; //for future extensibility
+} IPX_DATAGRAM_OPTIONS2, *PIPX_DATAGRAM_OPTIONS2;
+
+//
+// Invalid NicId passed down only once so IPX can map the ConnectionId
+// to a NicId, which is used later.
+//
+#define INVALID_NICID 0xffffffff
+
+//
+// Structure to be passed with the MIPX_QUERY_WAN_INACTIVITY IOCTL
+//
+typedef struct _IPX_QUERY_WAN_INACTIVITY {
+ ULONG ConnectionId;
+ USHORT NicId; // if equals INVALID_NICID, AdapterIndex is filled in
+ // adapter index; should change to NicHandle [ZZ]
+ ULONG WanInactivityCounter; // filled in on return
+} IPX_QUERY_WAN_INACTIVITY, *PIPX_QUERY_WAN_INACTIVITY;
+
+//
+// Structure to be passed with the MIPX_IPXWAN_CONFIG_DONE IOCTL
+//
+typedef struct _IPXWAN_CONFIG_DONE {
+ USHORT NicId; // adapter index; should change to NicHandle [ZZ]
+ ULONG Network;
+ UCHAR LocalNode[6];
+ UCHAR RemoteNode[6];
+} IPXWAN_CONFIG_DONE, *PIPXWAN_CONFIG_DONE;
+
+//
+// Definitions for TDI_ACTION calls supported by ISN.
+// In general the structure defined is passed in the
+// OutputBuffer (which becomes the MDL chain when
+// the transport receives it) and is used for input
+// and output as specified.
+//
+
+//
+// This is the TransportId to use in the action header
+// (it is the string "MISN").
+//
+
+#define ISN_ACTION_TRANSPORT_ID (('N' << 24) | ('S' << 16) | ('I' << 8) | ('M'))
+
+
+//
+// Get local target is used to force a re-RIP and also
+// obtain the local target information if desired. The
+// IpxAddress is passed on input and the LocalTarget
+// is returned on output. The structure defined here
+// goes in the Data section of an NWLINK_ACTION
+// structure with the Option set to MIPX_LOCALTARGET.
+//
+
+typedef struct _ISN_ACTION_GET_LOCAL_TARGET {
+ TDI_ADDRESS_IPX IpxAddress;
+ IPX_LOCAL_TARGET LocalTarget;
+} ISN_ACTION_GET_LOCAL_TARGET, *PISN_ACTION_GET_LOCAL_TARGET;
+
+
+//
+// Get network information is used to return information
+// about the path to a network. The information may not
+// be accurate since it only reflects what IPX knows
+// about the first hop to the remote. Network is an
+// input and LinkSpeed (in bytes per second) and
+// MaximumPacketSize (not including the IPX header)
+// are returned. The structure defined here goes
+// in the Data section of an NWLINK_ACTION structure
+// with the Options set to MIPX_NETWORKINFO.
+//
+
+typedef struct _ISN_ACTION_GET_NETWORK_INFO {
+ ULONG Network;
+ ULONG LinkSpeed;
+ ULONG MaximumPacketSize;
+} ISN_ACTION_GET_NETWORK_INFO, *PISN_ACTION_GET_NETWORK_INFO;
+
+
+
+//
+// This is the structure that the streams IPX transport used
+// for its action requests. Because of the way in which nwlink
+// was implemented, when passing this structure in a TDI_ACTION
+// it should be specified as the InputBuffer, not the output
+// buffer.
+//
+// In the action header, the TransportId is "MIPX" and the
+// ActionCode is 0. DatagramOption is TRUE for IPX ioctls
+// and FALSE for SPX. The BufferLength includes the length
+// of everything after it, which is sizeof(ULONG) for Option
+// plus whatever Data is present. Option is one of the
+// ioctl codes defined after the structure; in most cases
+// Data is not needed.
+//
+
+typedef struct _NWLINK_ACTION {
+ TDI_ACTION_HEADER Header;
+ UCHAR OptionType;
+ ULONG BufferLength;
+ ULONG Option;
+ CHAR Data[1];
+} NWLINK_ACTION, *PNWLINK_ACTION;
+
+//
+// Defines the values for OptionType (note that for
+// NWLINK this is a BOOLEAN DatagramOption, so we
+// define these to match, adding the control channel
+// one for ISN only).
+//
+
+#define NWLINK_OPTION_CONNECTION 0 // action is on a connection
+#define NWLINK_OPTION_ADDRESS 1 // action is on an address
+#define NWLINK_OPTION_CONTROL 2 // action is on the control channel,
+ // may also be submitted on an
+ // open connection or address object
+
+
+
+//
+// The following IOCTLs are taken from nwlink; the only
+// ones added for ISN are the ones in the 200 range.
+//
+
+
+/** Ioctls for IPX - (X) = User callable **/
+
+/**
+ ioctls will values 100 - 150 were added for the NT port.
+**/
+
+#define I_MIPX (('I' << 24) | ('D' << 16) | ('P' << 8))
+#define MIPX_SETNODEADDR (I_MIPX | 0) /* Set the node address */
+#define MIPX_SETNETNUM (I_MIPX | 1) /* Set the network number */
+#define MIPX_SETPTYPE (I_MIPX | 2) /* (X) Set the packet type */
+#define MIPX_SENTTYPE (I_MIPX | 3) /* (X) Set the xport type */
+#define MIPX_SETPKTSIZE (I_MIPX | 4) /* Set the packet size */
+#define MIPX_SETSAP (I_MIPX | 5) /* Set the sap/type field */
+#define MIPX_SENDOPTS (I_MIPX | 6) /* (X) Send options on recv */
+#define MIPX_NOSENDOPTS (I_MIPX | 7) /* (X) Don't send options on recv */
+#define MIPX_SENDSRC (I_MIPX | 8) /* (X) Send source address up */
+#define MIPX_NOSENDSRC (I_MIPX | 9) /* (X) Don't Send source address up */
+#define MIPX_CONVBCAST (I_MIPX | 10) /* Convert TKR bcast to func addr */
+#define MIPX_NOCONVBCAST (I_MIPX | 11) /* Don't cnvrt TKR bcast to funcaddr */
+#define MIPX_SETCARDTYPE (I_MIPX | 12) /* Set 802.3 or ETH type */
+#define MIPX_STARGROUP (I_MIPX | 13) /* This is stargroup */
+#define MIPX_SWAPLENGTH (I_MIPX | 14) /* Set flag for swapping 802.3 length */
+#define MIPX_SENDDEST (I_MIPX | 15) /* (X) Send dest. address up */
+#define MIPX_NOSENDDEST (I_MIPX | 16) /* (X) Don't send dest. address up */
+#define MIPX_SENDFDEST (I_MIPX | 17) /* (X) Send final dest. address up */
+#define MIPX_NOSENDFDEST (I_MIPX | 18) /* (X) Don't send final dest. up */
+
+/** Added for NT port **/
+
+#define MIPX_SETVERSION (I_MIPX | 100) /* Set card version */
+#define MIPX_GETSTATUS (I_MIPX | 101)
+#define MIPX_SENDADDROPT (I_MIPX | 102) /* (X) Send ptype w/addr on recv */
+#define MIPX_NOSENDADDROPT (I_MIPX | 103) /* (X) Stop sending ptype on recv */
+#define MIPX_CHECKSUM (I_MIPX | 104) /* Enable/Disable checksum */
+#define MIPX_GETPKTSIZE (I_MIPX | 105) /* Get max packet size */
+#define MIPX_SENDHEADER (I_MIPX | 106) /* Send header with data */
+#define MIPX_NOSENDHEADER (I_MIPX | 107) /* Don't send header with data */
+#define MIPX_SETCURCARD (I_MIPX | 108) /* Set current card for IOCTLs */
+#define MIPX_SETMACTYPE (I_MIPX | 109) /* Set the Cards MAC type */
+#define MIPX_DOSROUTE (I_MIPX | 110) /* Do source routing on this card*/
+#define MIPX_NOSROUTE (I_MIPX | 111) /* Don't source routine the card*/
+#define MIPX_SETRIPRETRY (I_MIPX | 112) /* Set RIP retry count */
+#define MIPX_SETRIPTO (I_MIPX | 113) /* Set RIP timeout */
+#define MIPX_SETTKRSAP (I_MIPX | 114) /* Set the token ring SAP */
+#define MIPX_SETUSELLC (I_MIPX | 115) /* Put LLC hdr on packets */
+#define MIPX_SETUSESNAP (I_MIPX | 116) /* Put SNAP hdr on packets */
+#define MIPX_8023LEN (I_MIPX | 117) /* 1=make even, 0=dont make even*/
+#define MIPX_SENDPTYPE (I_MIPX | 118) /* Send ptype in options on recv*/
+#define MIPX_NOSENDPTYPE (I_MIPX | 119) /* Don't send ptype in options */
+#define MIPX_FILTERPTYPE (I_MIPX | 120) /* Filter on recv ptype */
+#define MIPX_NOFILTERPTYPE (I_MIPX | 121) /* Don't Filter on recv ptype */
+#define MIPX_SETSENDPTYPE (I_MIPX | 122) /* Set pkt type to send with */
+#define MIPX_GETCARDINFO (I_MIPX | 123) /* Get info on a card */
+#define MIPX_SENDCARDNUM (I_MIPX | 124) /* Send card num up in options */
+#define MIPX_NOSENDCARDNUM (I_MIPX | 125) /* Dont send card num in options*/
+#define MIPX_SETROUTER (I_MIPX | 126) /* Set router enabled flag */
+#define MIPX_SETRIPAGE (I_MIPX | 127) /* Set RIP age timeout */
+#define MIPX_SETRIPUSAGE (I_MIPX | 128) /* Set RIP usage timeout */
+#define MIPX_SETSROUTEUSAGE (I_MIPX| 129) /* Set the SROUTE usage timeout */
+#define MIPX_SETINTNET (I_MIPX | 130) /* Set internal network number */
+#define MIPX_NOVIRTADDR (I_MIPX | 131) /* Turn off virtual net num */
+#define MIPX_VIRTADDR (I_MIPX | 132) /* Turn on virtual net num */
+#define MIPX_GETNETINFO (I_MIPX | 135) /* Get info on a network num */
+#define MIPX_SETDELAYTIME (I_MIPX | 136) /* Set cards delay time */
+#define MIPX_SETROUTEADV (I_MIPX | 137) /* Route advertise timeout */
+#define MIPX_SETSOCKETS (I_MIPX | 138) /* Set default sockets */
+#define MIPX_SETLINKSPEED (I_MIPX | 139) /* Set the link speed for a card*/
+#define MIPX_SETWANFLAG (I_MIPX | 140)
+#define MIPX_GETCARDCHANGES (I_MIPX | 141) /* Wait for card changes */
+#define MIPX_GETMAXADAPTERS (I_MIPX | 142)
+#define MIPX_REUSEADDRESS (I_MIPX | 143)
+#define MIPX_RERIPNETNUM (I_MIPX | 144) /* ReRip a network */
+#define MIPX_GETNETINFO_NR (I_MIPX | 145) /* Get info on a net num - NO RIP */
+
+#define MIPX_SETNIC (I_MIPX | 146)
+#define MIPX_NOSETNIC (I_MIPX | 147)
+
+/** For Source Routing Support **/
+
+#define MIPX_SRCLEAR (I_MIPX | 200) /* Clear the source routing table*/
+#define MIPX_SRDEF (I_MIPX | 201) /* 0=Single Rte, 1=All Routes */
+#define MIPX_SRBCAST (I_MIPX | 202) /* 0=Single Rte, 1=All Routes */
+#define MIPX_SRMULTI (I_MIPX | 203) /* 0=Single Rte, 1=All Routes */
+#define MIPX_SRREMOVE (I_MIPX | 204) /* Remove a node from the table */
+#define MIPX_SRLIST (I_MIPX | 205) /* Get the source routing table */
+#define MIPX_SRGETPARMS (I_MIPX | 206) /* Get source routing parms */
+
+#define MIPX_SETSHOULDPUT (I_MIPX | 210) /* Turn on should put call */
+#define MIPX_DELSHOULDPUT (I_MIPX | 211) /* Turn off should put call */
+#define MIPX_GETSHOULDPUT (I_MIPX | 212) /* Get ptr to mipx_shouldput */
+
+/** Added for ISN **/
+
+#define MIPX_RCVBCAST (I_MIPX | 300) /* (X) Enable broadcast reception */
+#define MIPX_NORCVBCAST (I_MIPX | 301) /* (X) Disable broadcast reception */
+#define MIPX_ADAPTERNUM (I_MIPX | 302) /* Get maximum adapter number */
+#define MIPX_NOTIFYCARDINFO (I_MIPX | 303) /* Pend until card info changes */
+#define MIPX_LOCALTARGET (I_MIPX | 304) /* Get local target for address */
+#define MIPX_NETWORKINFO (I_MIPX | 305) /* Return info about remote net */
+#define MIPX_ZEROSOCKET (I_MIPX | 306) /* Use 0 as source socket on sends */
+#define MIPX_SETRCVFLAGS (I_MIPX | 307) /* Turn on flags in receive addr */
+#define MIPX_NORCVFLAGS (I_MIPX | 308) /* Turn off flags in receive addr */
+#define MIPX_CONFIG (I_MIPX | 309) /* used by IPXROUTE for config info */
+#define MIPX_LINECHANGE (I_MIPX | 310) /* queued until WAN line goes up/down */
+#define MIPX_GETCARDINFO2 (I_MIPX | 311) /* Get info, return real send size for token-ring */
+#define MIPX_ADAPTERNUM2 (I_MIPX | 312) /* Max. number including duplicates */
+
+
+//
+// Used by a user mode process to get nic info defined by the IPX_NIC_INFO
+// structure.
+//
+// NOTE NOTE NOTE
+//
+// This is supposed to be used only by the FWRDR process and nobody else.
+// If some other app. uses it, the FWRDR will be affected
+//
+//
+#define MIPX_GETNEWNICINFO (I_MIPX | 313) /*Get any new NIC info that might
+ *be there*/
+
+//
+// IOCTL to be used if the interface is ROUTER_INTERFACE
+//
+#define MIPX_SEND_DATAGRAM _TDI_CONTROL_CODE((I_MIPX | 314), METHOD_IN_DIRECT) // send dgram
+#define MIPX_RCV_DATAGRAM _TDI_CONTROL_CODE((I_MIPX | 315), METHOD_OUT_DIRECT) // send dgram
+
+#define MIPX_RT_CREATE (I_MIPX | 316)
+#define MIPX_IPXWAN_CONFIG_DONE (I_MIPX | 317)
+#define MIPX_QUERY_WAN_INACTIVITY (I_MIPX | 318)
+
+/** Ioctls for SPX **/
+
+#define I_MSPX (('S' << 24) | ('P' << 16) | ('P' << 8))
+#define MSPX_SETADDR (I_MSPX | 0) /* Set the network address */
+#define MSPX_SETPKTSIZE (I_MSPX | 1) /* Set the packet size per card */
+#define MSPX_SETDATASTREAM (I_MSPX | 2) /* Set datastream type */
+
+/** Added for NT port **/
+
+#define MSPX_SETASLISTEN (I_MSPX | 100) /* Set as a listen socket */
+#define MSPX_GETSTATUS (I_MSPX | 101) /* Get running status */
+#define MSPX_GETQUEUEPTR (I_MSPX | 102) /* Get ptr to the streams queue */
+#define MSPX_SETDATAACK (I_MSPX | 103) /* Set DATA ACK option */
+#define MSPX_NODATAACK (I_MSPX | 104) /* Turn off DATA ACK option */
+#define MSPX_SETMAXPKTSOCK (I_MSPX | 105) /* Set the packet size per socket */
+#define MSPX_SETWINDOWCARD (I_MSPX | 106) /* Set window size for card */
+#define MSPX_SETWINDOWSOCK (I_MSPX | 107) /* Set window size for 1 socket */
+#define MSPX_SENDHEADER (I_MSPX | 108) /* Send header with data */
+#define MSPX_NOSENDHEADER (I_MSPX | 109) /* Don't send header with data */
+#define MSPX_GETPKTSIZE (I_MSPX | 110) /* Get the packet size per card */
+#define MSPX_SETCONNCNT (I_MSPX | 111) /* Set the conn req count */
+#define MSPX_SETCONNTO (I_MSPX | 112) /* Set the conn req timeout */
+#define MSPX_SETALIVECNT (I_MSPX | 113) /* Set the keepalive count */
+#define MSPX_SETALIVETO (I_MSPX | 114) /* Set the keepalive timeout */
+#define MSPX_SETALWAYSEOM (I_MSPX | 115) /* Turn on always EOM flag */
+#define MSPX_NOALWAYSEOM (I_MSPX | 116) /* Turn off always EOM flag */
+#define MSPX_GETSTATS (I_MSPX | 119) /* Get connection stats */
+#define MSPX_NOACKWAIT (I_MSPX | 120) /* Disable piggyback wait */
+#define MSPX_ACKWAIT (I_MSPX | 121) /* Enable pback wait (default) */
+
+//
+// Taken out of isn\inc\bind.h
+//
+typedef struct _IPXCP_CONFIGURATION {
+ USHORT Version;
+ USHORT Length;
+ UCHAR Network[4];
+ UCHAR LocalNode[6];
+ UCHAR RemoteNode[6];
+ ULONG ConnectionClient; // 0 - Server, 1 - Client
+ ULONG InterfaceIndex;
+ ULONG ConnectionId; // used to match TimeSinceLastActivity IOCtls
+ ULONG IpxwanConfigRequired; // 1 - IPXWAN Required
+} IPXCP_CONFIGURATION, *PIPXCP_CONFIGURATION;
+
+#define IPXWAN_SOCKET (USHORT)0x490
+
+
diff --git a/private/inc/jet.h b/private/inc/jet.h
new file mode 100644
index 000000000..019d29f2e
--- /dev/null
+++ b/private/inc/jet.h
@@ -0,0 +1,2395 @@
+/***********************************************************************
+* Microsoft Jet
+*
+* Microsoft Confidential. Copyright 1991-1993 Microsoft Corporation.
+*
+* Component:
+*
+* File: jet.h
+*
+* File Comments:
+*
+* Public header file with JET API definition.
+*
+* Revision History:
+*
+* [0] 04-Jan-92 richards Added this header
+*
+***********************************************************************/
+
+//
+// This __JET500 essentially creates two version of this file in this
+// same file. All the jet500 stuff is in __JET500 macro
+//
+#if __JET500
+#include "jet500.h"
+//
+// End of 500 series jet.h
+#else
+//
+// Original jet.h starts here. i.e jet.h of 200 series db.
+//
+
+#if !defined(_JET_INCLUDED)
+#define _JET_INCLUDED
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(4)
+
+#if defined(_M_ALPHA) /* 0:32 Flat Model (Alpha AXP) */
+
+#define _far
+#define JET_API __stdcall
+#define JET_NODSAPI __stdcall
+
+#elif defined(M_MRX000) /* 0:32 Flat Model (MIPS Rx000) */
+
+#define _far
+#define JET_API __stdcall
+#define JET_NODSAPI __stdcall
+
+#else /* 0:32 flat model (Intel 32-bit ) */
+
+#define _far
+#define JET_API __stdcall /* CONSIDER: Switch to __stdcall */
+#define JET_NODSAPI __stdcall /* CONSIDER: Switch to __stdcall */
+
+#endif
+
+typedef long JET_ERR;
+
+typedef unsigned long JET_INSTANCE; /* Instance Identifier */
+typedef unsigned long JET_SESID; /* Session Identifier */
+typedef unsigned long JET_TABLEID; /* Table Identifier */
+typedef unsigned long JET_COLUMNID; /* Column Identifier */
+
+typedef unsigned long JET_DBID; /* Database Identifier */
+typedef unsigned long JET_OBJTYP; /* Object Type */
+typedef unsigned long JET_COLTYP; /* Column Type */
+typedef unsigned long JET_GRBIT; /* Group of Bits */
+typedef unsigned long JET_ACM; /* Access Mask */
+typedef unsigned long JET_RNT; /* Repair Notification Type */
+
+typedef unsigned long JET_SNP; /* Status Notification Process */
+typedef unsigned long JET_SNT; /* Status Notification Type */
+typedef unsigned long JET_SNC; /* Status Notification Code */
+
+typedef double JET_DATESERIAL; /* JET_coltypDateTime format */
+
+#if defined(_M_ALPHA) /* 0:32 Flat Model (Intel 80x86) */
+
+typedef JET_ERR (__stdcall *JET_PFNSTATUS)(JET_SESID sesid, JET_SNP snp, JET_SNT snt, void _far *pv);
+
+#elif defined(M_MRX000) /* 0:32 Flat Model (MIPS Rx000) */
+
+typedef JET_ERR (__stdcall *JET_PFNSTATUS)(JET_SESID sesid, JET_SNP snp, JET_SNT snt, void _far *pv);
+
+#else /* 0:32 flat model (Alpha AXP ) */
+
+typedef JET_ERR (__stdcall *JET_PFNSTATUS)(JET_SESID sesid, JET_SNP snp, JET_SNT snt, void _far *pv);
+
+#endif
+
+
+ /* Session information bits */
+
+#define JET_bitCIMCommitted 0x00000001
+#define JET_bitCIMDirty 0x00000002
+#define JET_bitAggregateTransaction 0x00000008
+
+ /* JetGetLastErrorInfo structure */
+
+typedef struct
+ {
+ unsigned long cbStruct; /* Size of this structure */
+ JET_ERR err; /* Extended error code (if any) */
+ unsigned long ul1; /* First general purpose integer */
+ unsigned long ul2; /* Second general purpose integer */
+ unsigned long ul3; /* Third general purpose integer */
+ } JET_EXTERR;
+
+ /* Status Notification Structures */
+
+typedef struct /* Status Notification Progress */
+ {
+ unsigned long cbStruct; /* Size of this structure */
+ unsigned long cunitDone; /* Number of units of work completed */
+ unsigned long cunitTotal; /* Total number of units of work */
+ } JET_SNPROG;
+
+ /* ErrCount Notification Structures */
+
+typedef struct /* Status Notification Progress */
+ {
+ unsigned long cbStruct; /* Size of this structure */
+ unsigned long cRecUniqueKeyViolation;
+ unsigned long cRecTypeConversionFail;
+ unsigned long cRecRecordLocked;
+ unsigned long cRecTotal; /* Total number of units of work */
+ } JET_SNERRCNT;
+
+
+typedef struct /* Status Notification Message */
+ {
+ unsigned long cbStruct; /* Size of this structure */
+ JET_SNC snc; /* Status Notification Code */
+ unsigned long ul; /* Numeric identifier */
+ char sz[256]; /* Identifier */
+ } JET_SNMSG;
+
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_OBJTYP objtyp;
+ JET_DATESERIAL dtCreate;
+ JET_DATESERIAL dtUpdate;
+ JET_GRBIT grbit;
+ unsigned long flags;
+ unsigned long cRecord;
+ unsigned long cPage;
+ } JET_OBJECTINFO;
+
+typedef struct
+ {
+ unsigned int dbid;
+ char szDatabaseName[256];
+ char szNewDatabaseName[256];
+ } JET_RSTMAP; /* restore map */
+
+ /* The following flags appear in the grbit field above */
+
+#define JET_bitTableInfoUpdatable 0x00000001
+#define JET_bitTableInfoBookmark 0x00000002
+#define JET_bitTableInfoRollback 0x00000004
+#define JET_bitTableInfoRestartable 0x00000008
+#define JET_bitTableInfoNoInserts 0x00000010
+
+ /* The following flags occur in the flags field above */
+
+#define JET_bitSaveUIDnPWD 0x20000000 /* this bit is only */
+ /* appropriate for rmt links */
+#define JET_bitObjectExclusive 0x40000000 /* Open link exclusively */
+#define JET_bitObjectSystem 0x80000000
+
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_TABLEID tableid;
+ unsigned long cRecord;
+ JET_COLUMNID columnidcontainername;
+ JET_COLUMNID columnidobjectname;
+ JET_COLUMNID columnidobjtyp;
+ JET_COLUMNID columniddtCreate;
+ JET_COLUMNID columniddtUpdate;
+ JET_COLUMNID columnidgrbit;
+ JET_COLUMNID columnidflags;
+ JET_COLUMNID columnidcRecord; /* Level 2 info */
+ JET_COLUMNID columnidcPage; /* Level 2 info */
+ } JET_OBJECTLIST;
+
+#define cObjectInfoCols 9 /* CONSIDER: Internal */
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_TABLEID tableid;
+ unsigned long cRecord;
+ JET_COLUMNID columnidSid;
+ JET_COLUMNID columnidACM;
+ JET_COLUMNID columnidgrbit; /* grbit from JetSetAccess */
+ } JET_OBJECTACMLIST;
+
+#define cObjectAcmCols 3 /* CONSIDER: Internal */
+
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_TABLEID tableid;
+ unsigned long cRecord;
+ JET_COLUMNID columnidPresentationOrder;
+ JET_COLUMNID columnidcolumnname;
+ JET_COLUMNID columnidcolumnid;
+ JET_COLUMNID columnidcoltyp;
+ JET_COLUMNID columnidCountry;
+ JET_COLUMNID columnidLangid;
+ JET_COLUMNID columnidCp;
+ JET_COLUMNID columnidCollate;
+ JET_COLUMNID columnidcbMax;
+ JET_COLUMNID columnidgrbit;
+ JET_COLUMNID columnidDefault;
+ JET_COLUMNID columnidBaseTableName;
+ JET_COLUMNID columnidBaseColumnName;
+ JET_COLUMNID columnidDefinitionName;
+ } JET_COLUMNLIST;
+
+#define cColumnInfoCols 14 /* CONSIDER: Internal */
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_COLUMNID columnid;
+ JET_COLTYP coltyp;
+ unsigned short wCountry;
+ unsigned short langid;
+ unsigned short cp;
+ unsigned short wCollate; /* Must be 0 */
+ unsigned long cbMax;
+ JET_GRBIT grbit;
+ } JET_COLUMNDEF;
+
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_COLUMNID columnid;
+ JET_COLTYP coltyp;
+ unsigned short wCountry;
+ unsigned short langid;
+ unsigned short cp;
+ unsigned short wFiller; /* Must be 0 */
+ unsigned long cbMax;
+ JET_GRBIT grbit;
+ char szBaseTableName[256]; /* CONSIDER: Too large? */
+ char szBaseColumnName[256]; /* CONSIDER: Too large? */
+ } JET_COLUMNBASE;
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_TABLEID tableid;
+ unsigned long cRecord;
+ JET_COLUMNID columnidindexname;
+ JET_COLUMNID columnidgrbitIndex;
+ JET_COLUMNID columnidcKey;
+ JET_COLUMNID columnidcEntry;
+ JET_COLUMNID columnidcPage;
+ JET_COLUMNID columnidcColumn;
+ JET_COLUMNID columnidiColumn;
+ JET_COLUMNID columnidcolumnid;
+ JET_COLUMNID columnidcoltyp;
+ JET_COLUMNID columnidCountry;
+ JET_COLUMNID columnidLangid;
+ JET_COLUMNID columnidCp;
+ JET_COLUMNID columnidCollate;
+ JET_COLUMNID columnidgrbitColumn;
+ JET_COLUMNID columnidcolumnname;
+ } JET_INDEXLIST;
+
+#define cIndexInfoCols 15 /* CONSIDER: Internal */
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_TABLEID tableid;
+ unsigned long cRecord;
+ JET_COLUMNID columnidReferenceName;
+ JET_COLUMNID columnidgrbit;
+ JET_COLUMNID columnidcColumn;
+ JET_COLUMNID columnidiColumn;
+ JET_COLUMNID columnidReferencingTableName;
+ JET_COLUMNID columnidReferencingColumnName;
+ JET_COLUMNID columnidReferencedTableName;
+ JET_COLUMNID columnidReferencedColumnName;
+ } JET_RELATIONSHIPLIST;
+
+/* for backward compatibility */
+typedef JET_RELATIONSHIPLIST JET_REFERENCELIST;
+
+#define cReferenceInfoCols 8 /* CONSIDER: Internal */
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ unsigned long ibLongValue;
+ unsigned long itagSequence;
+ JET_COLUMNID columnidNextTagged;
+ } JET_RETINFO;
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ unsigned long ibLongValue;
+ unsigned long itagSequence;
+ } JET_SETINFO;
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ unsigned long centriesLT;
+ unsigned long centriesInRange;
+ unsigned long centriesTotal;
+ } JET_RECPOS;
+
+typedef struct
+ {
+ unsigned long cDiscont;
+ unsigned long cUnfixedMessyPage;
+ unsigned long centriesLT;
+ unsigned long centriesTotal;
+ } PERS_OLCSTAT;
+
+typedef struct
+ {
+ unsigned long cDiscont;
+ unsigned long cUnfixedMessyPage;
+ unsigned long centriesLT;
+ unsigned long centriesTotal;
+ unsigned long cpgCompactFreed;
+ } JET_OLCSTAT;
+
+typedef struct
+ {
+ unsigned long ctableid;
+ JET_TABLEID rgtableid[1];
+ } JET_MGBLIST;
+
+/*** Property Manager Structure ***/
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_TABLEID tableid;
+ JET_COLUMNID columnidColumnName;
+ JET_COLUMNID columnidPropertyName;
+ JET_COLUMNID columnidGrbit;
+ JET_COLUMNID columnidPropertyValue;
+ JET_COLUMNID columnidColtyp;
+ } JET_PROPERTYLIST;
+
+
+/************************************************************************/
+/************************* JET CONSTANTS ************************/
+/************************************************************************/
+
+#define JET_tableidNil ((JET_TABLEID) 0xFFFFFFFF)
+
+#define JET_sesidNil ((JET_SESID) 0xFFFFFFFF)
+
+ /* Max size of a bookmark */
+
+#define JET_cbBookmarkMost 256
+
+ /* Max length of a object/column/index/property name */
+
+#define JET_cbNameMost 64
+
+ /* Max length of a "name.name.name..." construct */
+
+#define JET_cbFullNameMost 255
+
+ /* Max size of non-long-value column data */
+
+#define JET_cbColumnMost 255
+
+ /* Max size of a sort/index key */
+
+#define JET_cbKeyMost 255
+
+ /* Max number of components in a sort/index key */
+
+#define JET_ccolKeyMost 10
+
+ /* Max number of columns in a table/query */
+
+#define JET_ccolTableMost 255
+
+ /* Max Length of a property in the property manager */
+#define JET_cbPropertyMost 2048
+
+ /* Largest initial substring of a long value used in an expression */
+
+#define JET_cbExprLVMost 0x8000L /*** 32 K ***/
+
+ /* Max size of returned (from SQLDriverConnect) conn string */
+
+#define JET_cbConnectMost 255
+
+ /* Max number of levels in an MGB */
+
+#define JET_wGroupLevelMax 12
+
+ /* Size restrictions for Pins */
+#define JET_cchPINMax 20
+#define JET_cchPINMin 4
+
+
+ /* System parameter codes for JetSetSystemParameter */
+
+#define JET_paramSysDbPath 0 /* Path to the system database */
+#define JET_paramTempPath 1 /* Path to the temporary file directory */
+#define JET_paramPfnStatus 2 /* Status callback function */
+#define JET_paramPfnError 3 /* Error callback function */
+#define JET_paramHwndODBC 4 /* Window handle for ODBC use */
+#define JET_paramIniPath 5 /* Path to the ini file */
+#define JET_paramPageTimeout 6 /* Red ISAM page timeout value */
+#define JET_paramODBCQueryTimeout 7 /* ODBC async query timeout value */
+#define JET_paramMaxBuffers 8 /* Bytes to use for page buffers */
+#define JET_paramMaxSessions 9 /* Maximum number of sessions */
+#define JET_paramMaxOpenTables 10 /* Maximum number of open tables */
+#define JET_paramMaxVerPages 11 /* Maximum number of modified pages */
+#define JET_paramMaxCursors 12 /* Maximum number of open cursors */
+#define JET_paramLogFilePath 13 /* Path to the log file directory */
+#define JET_paramMaxOpenTableIndexes 14 /* Maximum open table indexes */
+#define JET_paramMaxTemporaryTables 15 /* Maximum concurrent JetCreateIndex */
+#define JET_paramLogBuffers 16 /* Maximum log buffers */
+#define JET_paramLogFileSectors 17 /* Maximum log sectors per log file */
+#define JET_paramLogFlushThreshold 18 /* Log buffer flush threshold */
+#define JET_paramBfThrshldLowPrcnt 19 /* Low threshold ( % ) for buffers */
+#define JET_paramBfThrshldHighPrcnt 20 /* High threshold ( % ) for buffers */
+#define JET_paramWaitLogFlush 21 /* msec for waiting log flush */
+#define JET_paramLogFlushPeriod 22 /* msec for waiting log flush */
+#define JET_paramLogCheckpointPeriod 23 /* msec for waiting log flush */
+#define JET_paramLogWaitingUserMax 24 /* Maximum # user waiting log flush */
+#define JET_paramODBCLoginTimeout 25 /* ODBC connection attempt timeout value */
+#define JET_paramExprObject 26 /* Expression Evaluation callback */
+#define JET_paramGetTypeComp 27 /* Expression Evaluation callback */
+#define JET_paramHostVersion 28 /* Host Version callback */
+#define JET_paramSQLTraceMode 29 /* Enable/disable SQL tracing */
+#define JET_paramRecovery 30 /* Switch for log on/off */
+#define JET_paramRestorePath 31 /* Path to restoring directory */
+#define JET_paramTransactionLevel 32 /* Transaction level of session */
+#define JET_paramSessionInfo 33 /* Session info */
+#define JET_paramPageFragment 34 /* Largest page extent considered fragment */
+#define JET_paramJetInternal 35 /* Whether internal to JET; if set, allows ISAM to do things which are prevented in general */
+#define JET_paramMaxOpenDatabases 36 /* Maximum number of open databases */
+#define JET_paramOnLineCompact 37 /* Options for compact pages on-line */
+#define JET_paramFullQJet 38 /* Allow full QJet functionality */
+#define JET_paramRmtXactIsolation 39 /* Do not share connections with other sessions */
+#define JET_paramBufLRUKCorrInterval 40
+#define JET_paramBufBatchIOMax 41
+#define JET_paramPageReadAheadMax 42
+#define JET_paramAsynchIOMax 43
+
+#define JET_paramAssertAction 44 /* debug only determines action on assert */
+
+#define JET_paramEventSource 45 /* NT event log */
+#define JET_paramEventId 46 /* NT event id */
+#define JET_paramEventCategory 47 /* NT event category */
+
+
+ /* Flags for JetIdle */
+
+#define JET_bitIdleRemoveReadLocks 0x00000001
+#define JET_bitIdleFlushBuffers 0x00000002
+#define JET_bitIdleCompact 0x00000004
+
+ /* Flags for JetEndSession */
+
+#define JET_bitForceSessionClosed 0x00000001
+
+ /* Flags for JetOpenDatabase */
+
+#define JET_bitDbReadOnly 0x00000001
+#define JET_bitDbExclusive 0x00000002 /* multiple opens allowed */
+#define JET_bitDbRemoteSilent 0x00000004
+#define JET_bitDbSingleExclusive 0x00000008 /* opened exactly once */
+
+ /* Flags for JetCloseDatabase */
+
+#define JET_bitDbForceClose 0x00000001
+
+ /* Flags for JetCreateDatabase */
+
+#define JET_bitDbEncrypt 0x00000001
+#define JET_bitDbVersion10 0x00000002
+#define JET_bitDbVersion1x 0x00000004
+#define JET_bitDbRecoveryOff 0x00000008 /* disable logging/recovery */
+#define JET_bitDbNoLogging 0x00000010 /* no logging */
+#define JET_bitDbCompleteConnstr 0x00000020
+
+ /* Flags for JetBackup */
+
+#define JET_bitBackupIncremental 0x00000001
+#define JET_bitKeepOldLogs 0x00000002
+#define JET_bitOverwriteExisting 0x00000004
+
+ /* Database types */
+
+#define JET_dbidNil ((JET_DBID) 0xFFFFFFFF)
+#define JET_dbidNoValid ((JET_DBID) 0xFFFFFFFE) /* used as a flag to indicate that there is no valid dbid */
+
+ /* Flags for JetCreateLink */
+
+/* Can use JET_bitObjectExclusive to cause linked to database to be opened */
+/* exclusively. */
+
+ /* Flags for JetAddColumn, JetGetColumnInfo, JetOpenTempTable */
+
+#define JET_bitColumnFixed 0x00000001
+#define JET_bitColumnTagged 0x00000002
+#define JET_bitColumnNotNULL 0x00000004
+#define JET_bitColumnVersion 0x00000008
+#define JET_bitColumnAutoincrement 0x00000010
+#define JET_bitColumnUpdatable 0x00000020 /* JetGetColumnInfo only */
+#define JET_bitColumnTTKey 0x00000040 /* JetOpenTempTable only */
+#define JET_bitColumnTTDescending 0x00000080 /* JetOpenTempTable only */
+#define JET_bitColumnNotLast 0x00000100 /* Installable ISAM option */
+#define JET_bitColumnRmtGraphic 0x00000200 /* JetGetColumnInfo */
+#define JET_bitColumnMultiValued 0x00000400
+
+ /* Flags for JetMakeKey */
+
+#define JET_bitNewKey 0x00000001
+#define JET_bitStrLimit 0x00000002
+#define JET_bitSubStrLimit 0x00000004
+#define JET_bitNormalizedKey 0x00000008
+#define JET_bitKeyDataZeroLength 0x00000010
+
+#ifdef DBCS /* johnta: LIKE "ABC" not converted to ="ABC" for Japanese */
+#define JET_bitLikeExtra1 0x00000020
+#endif /* DBCS */
+
+ /* Flags for ErrDispSetIndexRange */
+
+#define JET_bitRangeInclusive 0x00000001 /* CONSIDER: Internal */
+#define JET_bitRangeUpperLimit 0x00000002 /* CONSIDER: Internal */
+
+ /* Constants for JetMove */
+
+#define JET_MoveFirst (0x80000000)
+#define JET_MovePrevious (-1)
+#define JET_MoveNext (+1)
+#define JET_MoveLast (0x7fffffff)
+
+ /* Flags for JetMove */
+
+#define JET_bitMoveKeyNE 0x00000001
+#define JET_bitMoveCheckTS 0x00000002
+#define JET_bitMoveInPage 0x00000004
+
+ /* Flags for JetSeek */
+
+#define JET_bitSeekEQ 0x00000001
+#define JET_bitSeekLT 0x00000002
+#define JET_bitSeekLE 0x00000004
+#define JET_bitSeekGE 0x00000008
+#define JET_bitSeekGT 0x00000010
+#define JET_bitSetIndexRange 0x00000020
+
+ /* Flags for JetFastFind */
+
+#define JET_bitFFindBackwards 0x00000001
+#define JET_bitFFindFromCursor 0x00000004
+
+ /* Flags for JetCreateIndex */
+
+#define JET_bitIndexUnique 0x00000001
+#define JET_bitIndexPrimary 0x00000002
+#define JET_bitIndexDisallowNull 0x00000004
+#define JET_bitIndexIgnoreNull 0x00000008
+#define JET_bitIndexClustered 0x00000010
+#define JET_bitIndexIgnoreAnyNull 0x00000020
+#define JET_bitIndexReference 0x80000000 /* IndexInfo only */
+
+ /* Flags for index key definition */
+
+#define JET_bitKeyAscending 0x00000000
+#define JET_bitKeyDescending 0x00000001
+
+
+ /* Flags for JetCreateRelationship */
+
+#define JET_bitRelationUnique 0x00000001
+#define JET_bitRelationDontEnforce 0x00000002
+#define JET_bitRelationInherited 0x00000004
+#define JET_bitRelationTestLegal 0x00000008 /* don't create relationship */
+
+#define JET_bitRelationshipMatchMask 0x000000F0
+#define JET_bitRelationMatchDefault 0x00000000
+#define JET_bitRelationMatchFull 0x00000010
+
+#define JET_bitRelationUpdateActionMask 0x00000F00
+#define JET_bitRelationUpdateDisallow 0x00000000
+#define JET_bitRelationUpdateCascade 0x00000100
+#define JET_bitRelationUpdateSetNull 0x00000200
+#define JET_bitRelationUpdateSetDefault 0x00000300
+
+#define JET_bitRelationDeleteActionMask 0x0000F000
+#define JET_bitRelationDeleteDisallow 0x00000000
+#define JET_bitRelationDeleteCascade 0x00001000
+#define JET_bitRelationDeleteSetNull 0x00002000
+#define JET_bitRelationDeleteSetDefault 0x00003000
+
+#define JET_bitRelationUserMask 0xFF000000 /* non-enforced values */
+#define JET_bitRelationJoinMask 0x03000000
+#define JET_bitRelationInner 0x00000000
+#define JET_bitRelationLeft 0x01000000
+#define JET_bitRelationRight 0x02000000
+
+
+ /* Flags for JetCreateReference/JetCreateRelationship */
+ /* NOTE: use the bitRelationship flags instead! */
+
+#define JET_ReferenceUnique JET_bitRelationUnique
+#define JET_ReferenceDontEnforce JET_bitRelationDontEnforce
+#define JET_ReferenceMatchTypeMask JET_bitRelationMatchMask
+#define JET_ReferenceMatchDefault JET_bitRelationMatchDefault
+#define JET_ReferenceMatchFull JET_bitRelationMatchFull
+#define JET_ReferenceUpdateActionMask JET_bitRelationUpdateActionMask
+#define JET_ReferenceUpdateDisallow JET_bitRelationUpdateDisallow
+#define JET_ReferenceUpdateCascade JET_bitRelationUpdateCascade
+#define JET_ReferenceUpdateSetNull JET_bitRelationUpdateSetNull
+#define JET_ReferenceUpdateSetDefault JET_bitRelationUpdateSetDefault
+#define JET_ReferenceDeleteActionMask JET_bitRelationDeleteActionMask
+#define JET_ReferenceDeleteDisallow JET_bitRelationDeleteDisallow
+#define JET_ReferenceDeleteCascade JET_bitRelationDeleteCascade
+#define JET_ReferenceDeleteSetNull JET_bitRelationDeleteSetNull
+#define JET_ReferenceDeleteSetDefault JET_bitRelationDeleteSetDefault
+
+
+ /* Flags for JetOpenTable */
+
+#define JET_bitTableDenyWrite 0x00000001
+#define JET_bitTableDenyRead 0x00000002
+#define JET_bitTableReadOnly 0x00000004
+#define JET_bitTableAppendOnly 0x00000008
+#define JET_bitTableUpdatable 0x00000010
+#define JET_bitTableScrollable 0x00000020
+#define JET_bitTableFixedSet 0x00000040 /* Fixed working set */
+#define JET_bitTableInconsistent 0x00000080
+#define JET_bitTableBulk 0x00000100
+#define JET_bitTableUsePrimaryIndex 0x00000200 /* Use with FixedSet */
+#define JET_bitTableSampleData 0x00000400
+#define JET_bitTableQuickBrowse 0x00000800 /* Bias optimizer toward index usage */
+#define JET_bitTableDDL 0x00001000 /* similar to JET_bitTableBulk, for DDL */
+#define JET_bitTablePassThrough 0x00002000 /* Remote DBs Only */
+#define JET_bitTableRowReturning 0x00004000
+
+ /* Flags for JetSetQoSql/JetRetrieveQoSql */
+#define JET_bitSqlPassThrough 0x00000001 /* Pass through Query returning records */
+#define JET_bitSqlSPTBulkOp 0x00000002 /* SPT query returning no table */
+
+ /* Flags for JetOpenVtQbe */
+
+#define JET_bitQBEAddBrackets 0x00000001
+#define JET_bitQBERemoveEquals 0x00000002
+
+ /* Flags for JetOpenTempTable and ErrIsamOpenTempTable */
+
+#define JET_bitTTIndexed 0x00000001 /* Allow seek */
+#define JET_bitTTUnique 0x00000002 /* Remove duplicates */
+#define JET_bitTTUpdatable 0x00000004 /* Allow updates */
+#define JET_bitTTScrollable 0x00000008 /* Allow backwards scrolling */
+
+ /* Flags for JetSetColumn */
+
+#define JET_bitSetAppendLV 0x00000001
+#define JET_bitSetValidate 0x00000002
+#define JET_bitSetOverwriteLV 0x00000004
+#define JET_bitSetSizeLV 0x00000008
+#define JET_bitSetValidateColumn 0x00000010
+#define JET_bitSetZeroLength 0x00000020
+
+ /* Set column parameter structure for JetSetColumns */
+
+typedef struct {
+ JET_COLUMNID columnid;
+ const void _far *pvData;
+ unsigned long cbData;
+ JET_GRBIT grbit;
+ unsigned long ibLongValue;
+ unsigned long itagSequence;
+ JET_ERR err;
+} JET_SETCOLUMN;
+
+ /* Options for JetPrepareUpdate */
+
+#define JET_prepInsert 0
+#define JET_prepInsertBeforeCurrent 1
+#define JET_prepReplace 2
+#define JET_prepCancel 3
+#define JET_prepReplaceNoLock 4
+#define JET_prepInsertCopy 5
+
+ /* Flags for JetRetrieveColumn */
+
+#define JET_bitRetrieveCopy 0x00000001
+#define JET_bitRetrieveFromIndex 0x00000002
+#define JET_bitRetrieveCase 0x00000004
+#define JET_bitRetrieveTag 0x00000008
+#define JET_bitRetrieveRecord 0x80000000
+#define JET_bitRetrieveFDB 0x40000000
+#define JET_bitRetrieveBookmarks 0x20000000
+
+ /* Retrieve column parameter structure for JetRetrieveColumns */
+
+typedef struct {
+ JET_COLUMNID columnid;
+ void _far *pvData;
+ unsigned long cbData;
+ unsigned long cbActual;
+ JET_GRBIT grbit;
+ unsigned long ibLongValue;
+ unsigned long itagSequence;
+ JET_COLUMNID columnidNextTagged;
+ JET_ERR err;
+} JET_RETRIEVECOLUMN;
+
+ /* Flags for JetFillFatCursor */
+
+#define JET_bitFCFillRange 0x00000001
+#define JET_bitFCRefreshRange 0x00000002
+#define JET_bitFCFillMemos 0x00000004
+
+ /* Flags for JetCommitTransaction */
+
+#define JET_bitCommitFlush 0x00000001
+
+ /* Flags for JetRollback */
+
+#define JET_bitRollbackAll 0x00000001
+
+ /* Flags for JetSetAccess and JetGetAccess */
+
+#define JET_bitACEInheritable 0x00000001
+
+ /* Flags for JetCreateSystemDatabase */
+
+#define JET_bitSysDbOverwrite 0x00000001
+
+ /* Flags for Jet Property Management */
+#define JET_bitPropDDL 0x00000001 /* also used for setting */
+#define JET_bitPropInherited 0x00000002 /* not used for setting */
+
+ /* JPM Flags that are only used for setting properties */
+#define JET_bitPropReplaceOnly 0x00000010
+#define JET_bitPropInsertOnly 0x00000020
+#define JET_bitPropDeleteOnly 0x00000040
+
+ /* InfoLevels for Jet Property Management */
+#define JET_PropertyValue 0
+#define JET_PropertyCount 1
+#define JET_PropertySingleCollection 2
+#define JET_PropertyAllCollections 3
+
+ /* Collate values for JetGetColumnInfo and JetGetIndexInfo */
+
+#define JET_sortBinary 0x0000
+#define JET_sortEFGPI 0x0100
+#define JET_sortSNIFD 0x0101
+#define JET_sortSpanish 0x0102
+#define JET_sortDutch 0x0103
+#define JET_sortSweFin 0x0104
+#define JET_sortNorDan 0x0105
+#define JET_sortIcelandic 0x0106
+#define JET_sortCyrillic 0x0107
+#define JET_sortCzech 0x0108
+#define JET_sortHungarian 0x0109
+#define JET_sortPolish 0x010A
+#define JET_sortArabic 0x010B
+#define JET_sortHebrew 0x010C
+#define JET_sortMax 0x010C /* Max for nonDBCS sort orders */
+
+#ifdef DBCS /* johnta: Add the new Japanese sorting order */
+#define JET_sortJapanese 0x010D
+#endif /* DBCS */
+
+#define JET_sortUnknown 0xFFFF
+
+ /* Paradox ISAM specific collate values */
+
+#define JET_sortPdxIntl 0x1000
+#define JET_sortPdxSwedFin 0x1001
+#define JET_sortPdxNorDan 0x1002
+
+ /* Info parameter for JetGetDatabaseInfo */
+
+#define JET_DbInfoFilename 0
+#define JET_DbInfoConnect 1
+#define JET_DbInfoCountry 2
+#define JET_DbInfoLangid 3
+#define JET_DbInfoCp 4
+#define JET_DbInfoCollate 5
+#define JET_DbInfoOptions 6
+#define JET_DbInfoTransactions 7
+#define JET_DbInfoVersion 8
+#define JET_DbInfoIsam 9
+
+ /* Database versions returned by JetGetDatabaseInfo */
+
+#define JET_DbVersion10 0x00010000
+#define JET_DbVersion11 0x00010001
+#define JET_DbVersion20 0x00020000
+
+
+ /* Isam specific info returned by JetGetDatabaseInfo */
+
+#define JET_IsamInvalid 0
+#define JET_IsamBuiltinRed 1
+#define JET_IsamBuiltinBlue 2
+
+#define JET_IsamInstRed 21
+#define JET_IsamInstBlue 22
+#define JET_IsamInstFox 23
+#define JET_IsamInstParadox 24
+#define JET_IsamInstDbase 25
+#define JET_IsamInstBtrieve 26
+
+#define JET_IsamBuilinMost JET_BuiltinBlue
+#define JET_IsamInstMin JET_IsamInstRed
+#define JET_IsamInstMost JET_IsamInstBtrieve
+
+ /* Link specific info for link identification */
+#define JET_bitLinkInvalid 0x00000000
+#define JET_bitLinkRemote 0x00100000
+#define JET_bitLinkBuiltinRed 0x00200000
+#define JET_bitLinkBuiltinBlue 0x00300000
+#define JET_bitLinkInstRed 0x00400000
+#define JET_bitLinkInstBlue 0x00500000
+#define JET_bitLinkInstFox 0x00600000
+#define JET_bitLinkInstParadox 0x00700000
+#define JET_bitLinkInstDbase 0x00800000
+#define JET_bitLinkInstBtrieve 0x00900000
+
+#define JET_bitFourByteBookmark 0x00000001
+#define JET_bitContiguousBookmarks 0x00000002
+
+ /* Column data types */
+
+ /* the column types are represented with 4 bits */
+ /* make sure the choices below fit! */
+ /* NOTE: all comb of the 4 bits are now used! */
+ /* CONSIDER: to allow more datatypes, either */
+ /* CONSIDER: JET_coltypDatabase and JET_coltypTableid must */
+ /* CONSIDER: change or the 4 bit dependancy must be removed */
+
+#define JET_coltypNil 0
+#define JET_coltypBit 1 /* True or False, Never NULL */
+#define JET_coltypUnsignedByte 2 /* 1-byte integer, unsigned */
+#define JET_coltypShort 3 /* 2-byte integer, signed */
+#define JET_coltypLong 4 /* 4-byte integer, signed */
+#define JET_coltypCurrency 5 /* 8 byte integer, signed */
+#define JET_coltypIEEESingle 6 /* 4-byte IEEE single precision */
+#define JET_coltypIEEEDouble 7 /* 8-byte IEEE double precision */
+#define JET_coltypDateTime 8 /* Integral date, fractional time */
+#define JET_coltypBinary 9 /* Binary data, < 255 bytes */
+#define JET_coltypText 10 /* ANSI text, case insensitive, < 255 bytes */
+#define JET_coltypLongBinary 11 /* Binary data, long value */
+#define JET_coltypLongText 12 /* ANSI text, long value */
+
+ /* The following are additional types used for query parameters */
+ /* NOTE: Code depends on these being contiguous with the normal coltyps */
+ /* CONSIDER: Remove the above dependency on contiguous coltyps in QJET */
+
+#define JET_coltypDatabase 13 /* Database name parameter */
+#define JET_coltypTableid 14 /* Tableid parameter */
+
+#define JET_coltypOLE 15 /* OLE blob */
+
+#define JET_coltypMax 16 /* the number of column types */
+ /* used for validity tests and */
+ /* array declarations. */
+
+ /* Info levels for JetGetObjectInfo */
+
+#define JET_ObjInfo 0U
+#define JET_ObjInfoListNoStats 1U
+#define JET_ObjInfoList 2U
+#define JET_ObjInfoSysTabCursor 3U
+#define JET_ObjInfoListACM 4U /* Blocked by JetGetObjectInfo */
+#define JET_ObjInfoNoStats 5U
+#define JET_ObjInfoSysTabReadOnly 6U
+#define JET_ObjInfoRulesLoaded 7U
+#define JET_ObjInfoMax 8U
+
+ /* Info levels for JetGetTableInfo */
+
+#define JET_TblInfo 0U
+#define JET_TblInfoName 1U
+#define JET_TblInfoDbid 2U
+#define JET_TblInfoMostMany 3U
+#define JET_TblInfoRvt 4U
+#define JET_TblInfoOLC 5U
+#define JET_TblInfoResetOLC 6U
+#define JET_TblInfoSpaceUsage 7U
+#define JET_TblInfoDumpTable 8U
+
+ /* Info levels for JetGetIndexInfo and JetGetTableIndexInfo */
+
+#define JET_IdxInfo 0U
+#define JET_IdxInfoList 1U
+#define JET_IdxInfoSysTabCursor 2U
+#define JET_IdxInfoOLC 3U
+#define JET_IdxInfoResetOLC 4U
+
+ /* Info levels for JetGetReferenceInfo and JetGetTableReferenceInfo */
+
+#define JET_ReferenceInfo 0U
+#define JET_ReferenceInfoReferencing 1U
+#define JET_ReferenceInfoReferenced 2U
+#define JET_ReferenceInfoAll 3U
+#define JET_ReferenceInfoCursor 4U
+
+ /* Info levels for JetGetColumnInfo and JetGetTableColumnInfo */
+
+#define JET_ColInfo 0U
+#define JET_ColInfoList 1U
+
+ /* CONSIDER: Info level 2 is valid */
+
+#define JET_ColInfoSysTabCursor 3U
+#define JET_ColInfoBase 4U
+
+
+ /* Attribute types for query definitions */
+
+#define JET_qoaBeginDef 0
+#define JET_qoaOperation 1
+#define JET_qoaParameter 2
+#define JET_qoaOptions 3
+#define JET_qoaDatabase 4
+#define JET_qoaInputTable 5
+#define JET_qoaOutput 6
+#define JET_qoaJoin 7
+#define JET_qoaRestriction 8
+#define JET_qoaGroup 9
+#define JET_qoaGroupRstr 10
+#define JET_qoaOrdering 11
+#define JET_qoaEndDef 255
+#define JET_qoaValidLeast JET_qoaOperation
+#define JET_qoaValidMost JET_qoaOrdering
+
+
+ /* Query object options */
+
+#define JET_bitFqoOutputAllCols 0x0001
+#define JET_bitFqoRemoveDups 0x0002
+#define JET_bitFqoOwnerAccess 0x0004
+#define JET_bitFqoDistinctRow 0x0008
+#define JET_bitFqoTop 0x0010
+#define JET_bitFqoPercent 0x0020
+#define JET_bitFqoCorresponding 0x0040 /* JET_qopSetOperation */
+
+ /* Query object join type */
+
+#define JET_fjoinInner 1
+#define JET_fjoinLeftOuter 2
+#define JET_fjoinRightOuter 3
+
+ /* Query object operations */
+
+#define JET_qopSelect 1
+#define JET_qopSelectInto 2
+#define JET_qopInsertSelection 3
+#define JET_qopUpdate 4
+#define JET_qopDelete 5
+#define JET_qopTransform 6
+#define JET_qopDDL 7
+#define JET_qopSqlPassThrough 8
+#define JET_qopSetOperation 9
+#define JET_qopSPTBulk 10
+
+#define JET_bitqopSelect 0x0000
+#define JET_bitqopTransform 0x0010
+#define JET_bitqopDelete 0x0020
+#define JET_bitqopUpdate 0x0030
+#define JET_bitqopInsertSelection 0x0040
+#define JET_bitqopSelectInto 0x0050
+#define JET_bitqopDDL 0x0060
+#define JET_bitqopSqlPassThrough 0x0070
+#define JET_bitqopSetOperation 0x0080
+#define JET_bitqopSPTBulk 0x0090
+
+ /* Engine Object Types */
+
+#define JET_objtypNil 0
+#define JET_objtypTable 1
+#define JET_objtypDb 2
+#define JET_objtypContainer 3
+#define JET_objtypSQLLink 4
+#define JET_objtypQuery 5
+#define JET_objtypLink 6
+#define JET_objtypTemplate 7
+#define JET_objtypRelationship 8
+
+ /* All types less than JET_objtypClientMin are reserved by JET */
+
+#define JET_objtypClientMin 0x8000
+
+ /* Security Constant Values */
+
+#define JET_cchUserNameMax 20
+#define JET_cchPasswordMax 14
+
+ /* Security Access Masks */
+
+#define JET_acmNoAccess 0x00000000L
+#define JET_acmFullAccess 0x000FFFFFL
+
+#define JET_acmSpecificMask 0x0000FFFFL
+#define JET_acmSpecific_1 0x00000001L
+#define JET_acmSpecific_2 0x00000002L
+#define JET_acmSpecific_3 0x00000004L
+#define JET_acmSpecific_4 0x00000008L
+#define JET_acmSpecific_5 0x00000010L
+#define JET_acmSpecific_6 0x00000020L
+#define JET_acmSpecific_7 0x00000040L
+#define JET_acmSpecific_8 0x00000080L
+#define JET_acmSpecific_9 0x00000100L
+#define JET_acmSpecific_10 0x00000200L
+#define JET_acmSpecific_11 0x00000400L
+#define JET_acmSpecific_12 0x00000800L
+#define JET_acmSpecific_13 0x00001000L
+#define JET_acmSpecific_14 0x00002000L
+#define JET_acmSpecific_15 0x00004000L
+#define JET_acmSpecific_16 0x00008000L
+
+#define JET_acmStandardMask 0x00FF0000L
+#define JET_acmDelete 0x00010000L
+#define JET_acmReadControl 0x00020000L
+#define JET_acmWriteDac 0x00040000L
+#define JET_acmWriteOwner 0x00080000L
+
+#define JET_acmTblCreate (JET_acmSpecific_1)
+#define JET_acmTblAccessRcols (JET_acmSpecific_2)
+#define JET_acmTblReadDef (JET_acmSpecific_3)
+#define JET_acmTblWriteDef (JET_acmSpecific_4)
+#define JET_acmTblRetrieveData (JET_acmSpecific_5)
+#define JET_acmTblInsertData (JET_acmSpecific_6)
+#define JET_acmTblReplaceData (JET_acmSpecific_7)
+#define JET_acmTblDeleteData (JET_acmSpecific_8)
+
+#define JET_acmDbCreate (JET_acmSpecific_1)
+#define JET_acmDbOpen (JET_acmSpecific_2)
+
+ /* Compact Options */
+
+#define JET_bitCompactEncrypt 0x00000001 /* Dest is encrypted */
+#define JET_bitCompactDecrypt 0x00000002 /* Dest is not encrypted */
+#define JET_bitCompactDontCopyLocale 0x00000004 /* Don't copy locale from source to dest */
+#define JET_bitCompactVersion10 0x00000008 /* Destination is version 1.0 format */
+#define JET_bitCompactVersion1x 0x00000010 /* Destination is version 1.x format */
+
+ /* On-line Compact Options */
+
+#define JET_bitCompactOn 0x00000001 /* enable on-line compaction */
+
+ /* Repair Notification Types */
+
+#define JET_rntSelfContained 0 /* CONSIDER: These are SNCs */
+#define JET_rntDeletedIndex 1
+#define JET_rntDeletedRec 2
+#define JET_rntDeletedLv 3
+#define JET_rntTruncated 4
+
+ /* Status Notification Processes */
+
+#define JET_snpIndex 0
+#define JET_snpQuery 1
+#define JET_snpRepair 2
+#define JET_snpImex 3
+#define JET_snpCompact 4
+#define JET_snpFastFind 5
+#define JET_snpODBCNotReady 6
+#define JET_snpQuerySort 7
+#define JET_snpRestore 8
+
+ /* Status Notification Types */
+
+#define JET_sntProgress 0 /* callback for progress */
+#define JET_sntMessage 1
+#define JET_sntBulkRecords 2 /* callback for # rec for bulk op */
+#define JET_sntFail 3 /* callback for failure during progress */
+#define JET_sntErrCount 4 /* callback for err count */
+#define JET_sntBegin 5 /* callback for beginning of operation */
+#define JET_sntComplete 6 /* callback for completion of operation */
+#define JET_sntCantRollback 7 /* callback for no rollback */
+#define JET_sntRestoreMap 8 /* callback for restore map */
+
+ /* Message codes for JET_snpCompact */
+
+#define JET_sncCopyObject 0 /* Starting to copy object */
+#define JET_sncCopyFailed 1 /* Copy of this object failed */
+#define JET_sncYield 2 /* Client can yield/check for user interrupt */
+#define JET_sncTransactionFull 3 /* Client can yield/check for user interrupt */
+#define JET_sncAboutToWrap 4 /* Find find is about to wrap */
+
+ /* Message codes for JET_snpODBCNotReady */
+#define JET_sncODBCNotReady 0 /* Waiting for results from ODBC */
+
+
+ /* Constants for the [ODBC] section of JET.INI */
+
+#define JET_SQLTraceCanonical 0x0001 /* Output ODBC Generic SQL */
+
+ /* Constants for the [Debug] section of JET.INI */
+
+ /* APITrace */
+
+#define JET_APITraceEnter 0x0001
+#define JET_APITraceExit 0x0002
+#define JET_APITraceExitError 0x0004
+#define JET_APIBreakOnError 0x0008
+#define JET_APITraceCount 0x0010
+#define JET_APITraceNoIdle 0x0020
+#define JET_APITraceParameters 0x0040
+
+ /* IdleTrace */
+
+#define JET_IdleTraceCursor 0x0001
+#define JET_IdleTraceBuffer 0x0002
+#define JET_IdleTraceFlush 0x0004
+
+ /* AssertAction */
+
+#define JET_AssertExit 0x0000 /* Exit the application */
+#define JET_AssertBreak 0x0001 /* Break to debugger */
+#define JET_AssertMsgBox 0x0002 /* Display message box */
+#define JET_AssertStop 0x0004 /* Alert and stop */
+
+ /* IOTrace */
+
+#define JET_IOTraceAlloc 0x0001 /* DB Page Allocation */
+#define JET_IOTraceFree 0x0002 /* DB Page Free */
+#define JET_IOTraceRead 0x0004 /* DB Page Read */
+#define JET_IOTraceWrite 0x0008 /* DB Page Write */
+#define JET_IOTraceError 0x0010 /* DB Page I/O Error */
+
+ /* MemTrace */
+
+#define JET_MemTraceAlloc 0x0001 /* Memory allocation */
+#define JET_MemTraceRealloc 0x0002 /* Memory reallocation */
+#define JET_MemTraceFree 0x0004 /* Memory free */
+
+ /* RmtTrace */
+
+#define JET_RmtTraceError 0x0001 /* Remote server error message */
+#define JET_RmtTraceSql 0x0002 /* Remote SQL Prepares & Exec's */
+#define JET_RmtTraceAPI 0x0004 /* Remote ODBC API calls */
+#define JET_RmtTraceODBC 0x0008
+#define JET_RmtSyncODBC 0x0010 /* Turn on ODBC Sync mode */
+
+/**********************************************************************/
+/*********************** ERROR CODES **************************/
+/**********************************************************************/
+
+/* SUCCESS */
+
+#define JET_errSuccess 0 /* Successful Operation */
+
+/* ERRORS */
+
+#define JET_wrnNyi -1 /* Function Not Yet Implemented */
+
+/* SYSTEM errors
+/**/
+#define JET_errRfsFailure -100 /* JET_errRfsFailure */
+#define JET_errRfsNotArmed -101 /* JET_errRfsFailure */
+#define JET_errFileClose -102 /* Could not close DOS file */
+#define JET_errNoMoreThreads -103 /* Could not start thread */
+#define JET_errNoComputerName -104 /* fail to get computername */
+#define JET_errTooManyIO -105 /* System busy due to too many IOs */
+
+/* BUFFER MANAGER errors
+/**/
+#define wrnBFNotSynchronous 200 /* Buffer page evicted */
+#define wrnBFPageNotFound 201 /* Page not found */
+#define errBFInUse -202 /* Cannot abandon buffer */
+
+/* DIRECTORY MANAGER errors
+/**/
+#define errPMOutOfPageSpace -300 /* Out of page space */
+#define errPMItagTooBig -301 /* Itag too big */
+#define errPMRecDeleted -302 /* Record deleted */
+#define errPMTagsUsedUp -303 /* Tags used up */
+#define wrnBMConflict 304 /* conflict in BM Clean up */
+#define errDIRNoShortCircuit -305 /* No Short Circuit Avail */
+#define errDIRCannotSplit -306 /* Cannot horizontally split FDP */
+#define errDIRTop -307 /* Cannot go up */
+#define errDIRFDP 308 /* On an FDP Node */
+#define errDIRNotSynchronous -309 /* May have left critical section */
+#define wrnDIREmptyPage 310 /* Moved through empty page */
+#define errSPConflict -311 /* Device extent being extended */
+#define wrnNDFoundLess 312 /* Found Less */
+#define wrnNDFoundGreater 313 /* Found Greater */
+#define errNDOutSonRange -314 /* Son out of range */
+#define errNDOutItemRange -315 /* Item out of range */
+#define errNDGreaterThanAllItems -316 /* Greater than all items */
+#define errNDLastItemNode -317 /* Last node of item list */
+#define errNDFirstItemNode -318 /* First node of item list */
+#define wrnNDDuplicateItem 319 /* Duplicated Item */
+#define errNDNoItem -320 /* Item not there */
+#define JET_wrnRemainingVersions 321 /* Some versions couldn't be cleaned */
+#define JET_wrnPreviousVersion 322 /* Version already existed */
+#define JET_errPageBoundary -323 /* Reached Page Boundary */
+#define JET_errKeyBoundary -324 /* Reached Key Boundary */
+#define errDIRInPageFather -325 /* sridFather in page to free
+
+/* RECORD MANAGER errors
+/**/
+#define wrnFLDKeyTooBig 400 /* Key too big (truncated it) */
+#define errFLDTooManySegments -401 /* Too many key segments */
+#define wrnFLDNullKey 402 /* Key is entirely NULL */
+#define wrnFLDOutOfKeys 403 /* No more keys to extract */
+#define wrnFLDNullSeg 404 /* Null segment in key */
+#define wrnRECLongField 405 /* Separated long field */
+#define JET_wrnRecordFoundGreater JET_wrnSeekNotEqual
+#define JET_wrnRecordFoundLess JET_wrnSeekNotEqual
+#define JET_errColumnIllegalNull JET_errNullInvalid
+
+/* LOGGING/RECOVERY errors
+/**/
+#define JET_errRestoreFailed -500 /* Restore failed */
+#define JET_errLogFileCorrupt -501 /* Log file is corrupt */
+#define errLGNoMoreRecords -502 /* Last log record read */
+#define JET_errNoBackupDirectory -503 /* No backup directory given */
+#define JET_errBackupDirectoryNotEmpty -504 /* The backup directory is not emtpy */
+#define JET_errBackupInProgress -505 /* Backup is active already */
+#define JET_errFailRestoreDatabase -506 /* Fail to restore (copy) database */
+#define JET_errNoDatabasesForRestore -507 /* No databases for restor found */
+#define JET_errMissingLogFile -508 /* jet.log for restore is missing */
+#define JET_errMissingPreviousLogFile -509 /* Missing the log file for check point */
+#define JET_errLogWriteFail -510 /* Fail when writing to log file */
+#define JET_errLogNotContigous -511 /* Fail to incremental backup for non-contiguous generation number */
+#define JET_errFailToMakeTempDirectory -512 /* Fail to make a temp directory */
+#define JET_errFailToCleanTempDirectory -513 /* Fail to clean up temp directory */
+#define JET_errBadLogVersion -514 /* Version of log file is not compatible with Jet version */
+#define JET_errBadNextLogVersion -515 /* Version of next log file is not compatible with current one */
+#define JET_errLoggingDisabled -516 /* Log is not active */
+#define JET_errLogBufferTooSmall -517 /* Log buffer is too small for recovery */
+#define errLGNotSynchronous -518 /* retry to LGLogRec */
+
+#define JET_errFeatureNotAvailable -1001 /* API not supported */
+#define JET_errInvalidName -1002 /* Invalid name */
+#define JET_errInvalidParameter -1003 /* Invalid API parameter */
+#define JET_wrnColumnNull 1004 /* Column is NULL-valued */
+#define JET_errReferenceNotFound -1005 /* No such reference */
+#define JET_wrnBufferTruncated 1006 /* Buf too short, data truncated */
+#define JET_wrnDatabaseAttached 1007 /* Database is already attached */
+#define JET_wrnOnEndPoint 1008 /* On end point */
+#define JET_wrnSortOverflow 1009 /* Sort does not fit in memory */
+#define JET_errInvalidDatabaseId -1010 /* Invalid database id */
+#define JET_errOutOfMemory -1011 /* Out of Memory */
+#define JET_errCantAllocatePage -1012 /* Couldn't allocate a page */
+#define JET_errNoMoreCursors -1013 /* Max # of cursors allocated */
+#define JET_errOutOfBuffers -1014 /* JET_errOutOfBuffers */
+#define JET_errTooManyIndexes -1015 /* Too many indexes */
+#define JET_errTooManyKeys -1016 /* Too many columns in an index */
+#define JET_errRecordDeleted -1017 /* Record has been deleted */
+#define JET_errReadVerifyFailure -1018 /* Read verification error */
+#define JET_errFilesysVersion -1019 /* Obsolete database format */
+#define JET_errNoMoreFiles -1020 /* No more file handles */
+#define JET_errDiskNotReady -1021 /* Disk not ready */
+#define JET_errDiskIO -1022 /* JET_errDiskIO */
+#define JET_errInvalidPath -1023 /* JET_errInvalidPath */
+#define JET_errFileShareViolation -1024 /* JET_errFileShareViolation */
+#define JET_errFileLockViolation -1025 /* JET_errFileLockViolation */
+#define JET_errRecordTooBig -1026 /* JET_errRecordTooBig */
+#define JET_errTooManyOpenDatabases -1027 /* Database limit reached */
+#define JET_errInvalidDatabase -1028 /* This isn't a database */
+#define JET_errNotInitialized -1029 /* JetInit not yet called */
+#define JET_errAlreadyInitialized -1030 /* JetInit already called */
+#define JET_errFileLockingUnavailable -1031 /* JET_errFileLockingUnavailable */
+#define JET_errFileAccessDenied -1032 /* JET_errFileAccessDenied */
+#define JET_errSharingBufferExceeded -1033 /* OS sharing buffer exceeded */
+#define JET_errQueryNotSupported -1034 /* Query support unavailable */
+#define JET_errSQLLinkNotSupported -1035 /* SQL Link support unavailable */
+#define JET_errTaskLimitExceeded -1036 /* Too many client tasks */
+#define JET_errUnsupportedOSVersion -1037 /* Unsupported OS version */
+#define JET_errBufferTooSmall -1038 /* Buffer is too small */
+#define JET_wrnSeekNotEqual 1039 /* SeekLE or SeekGE didn't find exact match */
+#define JET_errTooManyColumns -1040 /* Too many columns defined */
+#define JET_errTooManyFixedColumns -1041 /* Too many fixed columns defined */
+#define JET_errTooManyVariableColumns -1042 /* Too many variable columns defined */
+#define JET_errContainerNotEmpty -1043 /* Container is not empty */
+#define JET_errInvalidFilename -1044 /* Filename is invalid */
+#define JET_errInvalidBookmark -1045 /* Invalid bookmark */
+#define JET_errColumnInUse -1046 /* Column used in an index */
+#define JET_errInvalidBufferSize -1047 /* Data buffer doesn't match column size */
+#define JET_errColumnNotUpdatable -1048 /* Can't set column value */
+#define JET_wrnCommitNotFlushed 1049 /* Commit did not flush to disk */
+#define JET_errAbortSalvage -1050 /* Forced Salvager abort */
+#define JET_errIndexInUse -1051 /* Index is in use */
+#define JET_errLinkNotSupported -1052 /* Link support unavailable */
+#define JET_errNullKeyDisallowed -1053 /* Null keys are disallowed on index */
+#define JET_errNotInTransaction -1054 /* JET_errNotInTransaction */
+#define JET_wrnNoErrorInfo 1055 /* No extended error information */
+#define JET_errInstallableIsamNotFound -1056 /* Installable ISAM not found */
+#define JET_errOperationCancelled -1057 /* Operation canceled by client */
+#define JET_wrnNoIdleActivity 1058 /* No idle activity occured */
+#define JET_errTooManyActiveUsers -1059 /* Too many active database users */
+#define JET_errInvalidAppend -1060 /* Cannot append long value */
+#define JET_errInvalidCountry -1061 /* Invalid or unknown country code */
+#define JET_errInvalidLanguageId -1062 /* Invalid or unknown language id */
+#define JET_errInvalidCodePage -1063 /* Invalid or unknown code page */
+#define JET_errCantBuildKey -1064 /* Can't build key for this sort order. */
+#define JET_errIllegalReentrancy -1065 /* Re-entrancy on same cursor family */
+#define JET_errIllegalRelationship -1066 /* Can't create relationship */
+#define JET_wrnNoWriteLock 1067 /* No write lock at transaction level 0 */
+#define JET_errDBVerFeatureNotAvailable -1067 /* API not supported using old database format*/
+
+#define JET_errCantBegin -1101 /* Cannot BeginSession */
+#define JET_errWriteConflict -1102 /* Write lock failed due to outstanding write lock */
+#define JET_errTransTooDeep -1103 /* Xactions nested too deeply */
+#define JET_errInvalidSesid -1104 /* Invalid session handle */
+#define JET_errReadConflict -1105 /* Commit lock failed due to outstanding read lock */
+#define JET_errCommitConflict -1106 /* Read lock failed due to outstanding commit lock */
+#define JET_errSessionWriteConflict -1107 /* Another session has private version of page */
+#define JET_errInTransaction -1108 /* Operation not allowed within a transaction */
+
+#define JET_errDatabaseDuplicate -1201 /* Database already exists */
+#define JET_errDatabaseInUse -1202 /* Database in use */
+#define JET_errDatabaseNotFound -1203 /* No such database */
+#define JET_errDatabaseInvalidName -1204 /* Invalid database name */
+#define JET_errDatabaseInvalidPages -1205 /* Invalid number of pages */
+#define JET_errDatabaseCorrupted -1206 /* non-db file or corrupted db */
+#define JET_errDatabaseLocked -1207 /* Database exclusively locked */
+#define JET_wrnDatabaseEncrypted 1208 /* Database is encrypted */
+
+#define JET_wrnTableEmpty 1301 /* Open an empty table */
+#define JET_errTableLocked -1302 /* Table is exclusively locked */
+#define JET_errTableDuplicate -1303 /* Table already exists */
+#define JET_errTableInUse -1304 /* Table is in use, cannot lock */
+#define JET_errObjectNotFound -1305 /* No such table or object */
+#define JET_errCannotRename -1306 /* Cannot rename temporary file */
+#define JET_errDensityInvalid -1307 /* Bad file/index density */
+#define JET_errTableNotEmpty -1308 /* Cannot define clustered index */
+#define JET_errTableNotLocked -1309 /* No DDLs w/o exclusive lock */
+#define JET_errInvalidTableId -1310 /* Invalid table id */
+#define JET_errTooManyOpenTables -1311 /* Cannot open any more tables */
+#define JET_errIllegalOperation -1312 /* Oper. not supported on table */
+#define JET_wrnExecSegReleased 1313 /* Query Execution segment is released */
+#define JET_errObjectDuplicate -1314 /* Table or object name in use */
+#define JET_errRulesLoaded -1315 /* Rules loaded, can't define more */
+#define JET_errInvalidObject -1316 /* object is invalid for operation */
+
+#define JET_errIndexCantBuild -1401 /* Cannot build clustered index */
+#define JET_errIndexHasPrimary -1402 /* Primary index already defined */
+#define JET_errIndexDuplicate -1403 /* Index is already defined */
+#define JET_errIndexNotFound -1404 /* No such index */
+#define JET_errIndexMustStay -1405 /* Cannot delete clustered index */
+#define JET_errIndexInvalidDef -1406 /* Illegal index definition */
+#define JET_errSelfReference -1407 /* Referencing/Referenced index is the same */
+#define JET_errIndexHasClustered -1408 /* Clustered index already defined */
+
+#define JET_errColumnLong -1501 /* column value is long */
+#define JET_errColumnNoChunk -1502 /* no such chunk in field */
+#define JET_errColumnDoesNotFit -1503 /* Field will not fit in record */
+#define JET_errNullInvalid -1504 /* Null not valid */
+#define JET_errColumnIndexed -1505 /* Column indexed, cannot delete */
+#define JET_errColumnTooBig -1506 /* Field length is > maximum */
+#define JET_errColumnNotFound -1507 /* No such column */
+#define JET_errColumnDuplicate -1508 /* Field is already defined */
+#define JET_errTaggedDefault -1509 /* No defaults on tagged fields */
+#define JET_errColumn2ndSysMaint -1510 /* Second autoinc or version column */
+#define JET_errInvalidColumnType -1511 /* Invalid column data type */
+#define JET_wrnColumnMaxTruncated 1512 /* Max length too big, truncated */
+#define JET_errColumnCannotIndex -1513 /* Cannot index Bit,LongText,LongBinary */
+#define JET_errTaggedNotNULL -1514 /* No non-NULL tagged fields */
+#define JET_errNoCurrentIndex -1515 /* Invalid w/o a current index */
+#define JET_errKeyIsMade -1516 /* The key is completely made */
+#define JET_errBadColumnId -1517 /* Column Id Incorrect */
+#define JET_errBadItagSequence -1518 /* Bad itagSequence for tagged column */
+#define JET_errColumnInRelationship -1519 /* Cannot delete, column participates in relationship */
+#define JET_wrnCopyLongValue 1520 /* Single instance column bursted */
+#define JET_errCannotBeTagged -1521 /* AutoIncrement and Version cannot be tagged */
+
+#define JET_errRecordNotFound -1601 /* The key was not found */
+#define JET_errRecordNoCopy -1602 /* No working buffer */
+#define JET_errNoCurrentRecord -1603 /* Currency not on a record */
+#define JET_errRecordClusteredChanged -1604 /* Primary key may not change */
+#define JET_errKeyDuplicate -1605 /* Illegal duplicate key */
+#define JET_errCannotInsertBefore -1606 /* Cannot insert before current */
+#define JET_errAlreadyPrepared -1607 /* Already copy/clear current */
+#define JET_errKeyNotMade -1608 /* No call to JetMakeKey */
+#define JET_errUpdateNotPrepared -1609 /* No call to JetPrepareUpdate */
+#define JET_wrnDataHasChanged 1610 /* Data has changed */
+#define JET_errDataHasChanged -1611 /* Data has changed; operation aborted */
+#define JET_errIntegrityViolationMaster -1612 /* References to key exist */
+#define JET_errIntegrityViolationSlave -1613 /* No referenced key exists */
+#define JET_wrnMuchDataChanged 1614 /* Repaint whole datasheet */
+#define JET_errIncorrectJoinKey -1615 /* Master key does not match lookup key */
+#define JET_wrnKeyChanged 1618 /* Moved to new key */
+#define JET_wrnSyncedToDelRec 1699 /* CONSIDER: QJET INTERNAL */
+#define JET_errRedoPrepUpdate 1698 /* CONSIDER: QJET INTERNAL(jpbulk.c)*/
+
+#define JET_errTooManySorts -1701 /* Too many sort processes */
+#define JET_errInvalidOnSort -1702 /* Invalid operation on Sort */
+
+#define JET_errConfigOpenError -1801 /* Config. file can't be opened */
+#define JET_errSysDatabaseOpenError -1802 /* System db could not be opened */
+#define JET_errTempFileOpenError -1803 /* Temp file could not be opened */
+#define JET_errDatabaseOpenError -1804 /* Database file can't be opened */
+#define JET_errTooManyAttachedDatabases -1805 /* Too many open databases */
+#define JET_errDatabaseCloseError -1806 /* Db file could not be closed */
+#define JET_errTooManyOpenFiles -1807 /* Too many files open */
+#define JET_errDiskFull -1808 /* No space left on disk */
+#define JET_errPermissionDenied -1809 /* Permission denied */
+#define JET_errSortFileOpenError -1810 /* Could not open sort file */
+#define JET_errFileNotFound -1811 /* File not found */
+#define JET_errTempDiskFull -1812 /* No space left on disk */
+#define JET_wrnFileOpenReadOnly 1813 /* Database file is read only */
+
+#define JET_errAfterInitialization -1850 /* Cannot Restore after init. */
+#define JET_errSeriesTooLong -1851 /* New log generation id too big */
+#define JET_errLogCorrupted -1852 /* Logs could not be interpreted */
+
+#define JET_errCannotOpenSystemDb -1901 /* failed sysdb on beginsession */
+#define JET_errInvalidLogon -1902 /* invalid logon at beginsession */
+#define JET_errInvalidAccountName -1903 /* invalid account name */
+#define JET_errInvalidSid -1904 /* invalid SID */
+#define JET_errInvalidPassword -1905 /* invalid password */
+#define JET_errInvalidOperation -1906 /* invalid operation */
+#define JET_errAccessDenied -1907 /* access denied */
+#define JET_errNoMSysAccounts -1908 /* Can't open MSysAccounts */
+#define JET_errNoMSysGroups -1909 /* Can't open MSysGroups */
+#define JET_errInvalidPin -1910 /* invalid pin */
+
+#define JET_errRmtSqlError -2001 /* RMT: ODBC call failed */
+#define JET_errRmtMissingOdbcDll -2006 /* RMT: Can't load ODBC DLL */
+#define JET_errRmtInsertFailed -2007 /* RMT: Insert statement failed */
+#define JET_errRmtDeleteFailed -2008 /* RMT: Delete statement failed */
+#define JET_errRmtUpdateFailed -2009 /* RMT: Update statement failed */
+#define JET_errRmtColDataTruncated -2010 /* RMT: data truncated */
+#define JET_errRmtTypeIncompat -2011 /* RMT: Can't create JET type on server */
+#define JET_errRmtCreateTableFailed -2012 /* RMT: Create table stmt failed */
+#define JET_errRmtNotSupported -2014 /* RMT: Function not legal for rdb */
+#define JET_errRmtValueOutOfRange -2020 /* RMT: Data value out of range */
+#define JET_errRmtStillExec -2021 /* RMT INTERNAL: SQL_STILL_EXECUTING */
+#define JET_errRmtQueryTimeout -2022 /* RMT: Server Not Responding */
+#define JET_wrnRmtNeedLvData 2023 /* RMT: Internal only - need Lv data */
+#define JET_wrnFatCursorUseless 2024 /* Fat cursor has no effect ***/
+#define JET_errRmtWrongSPVer -2025 /* RMT: INTERNAL: wrong SProc ver ***/
+#define JET_errRmtLinkOutOfSync -2026 /* RMT: the def for the rmt tbl has changed */
+#define JET_errRmtDenyWriteIsInvalid -2027 /* RMT: Can't open DenyWrite */
+#define JET_errRmtDriverCantConv -2029 /* RMT: INTERNAL: driver cannot convert */
+#define JET_errRmtTableAmbiguous -2030 /* RMT: Table ambiguous: must specifier owner */
+#define JET_errRmtBogusConnStr -2031 /* RMT: SPT: Bad connect string */
+
+#define JET_errQueryInvalidAttribute -3001 /* Invalid query attribute */
+#define JET_errQueryOnlyOneRow -3002 /* Only 1 such row allowed */
+#define JET_errQueryIncompleteRow -3003 /* Missing value in row */
+#define JET_errQueryInvalidFlag -3004 /* Invalid value in Flag field */
+#define JET_errQueryCycle -3005 /* Cycle in query definition */
+#define JET_errQueryInvalidJoinTable -3006 /* Invalid table in join */
+#define JET_errQueryAmbigRef -3007 /* Ambiguous column reference */
+#define JET_errQueryUnboundRef -3008 /* Cannot bind name */
+#define JET_errQueryParmRedef -3009 /* Parm redefined with different type */
+#define JET_errQueryMissingParms -3010 /* Too few parameters supplied */
+#define JET_errQueryInvalidOutput -3011 /* Invalid query output */
+#define JET_errQueryInvalidHaving -3012 /* HAVING clause without aggregation */
+#define JET_errQueryDuplicateAlias -3013 /* Duplicate output alias */
+#define JET_errQueryInvalidMGBInput -3014 /* Cannot input from MGB */
+#define JET_errQueryInvalidOrder -3015 /* Invalid ORDER BY expression */
+#define JET_errQueryTooManyLevels -3016 /* Too many levels on MGB */
+#define JET_errQueryMissingLevel -3017 /* Missing intermediate MGB level */
+#define JET_errQueryIllegalAggregate -3018 /* Aggregates not allowed */
+#define JET_errQueryDuplicateOutput -3019 /* Duplicate destination output */
+#define JET_errQueryIsBulkOp -3020 /* Grbit should be set for Bulk Operation */
+#define JET_errQueryIsNotBulkOp -3021 /* Query is not a Bulk Operation */
+#define JET_errQueryIllegalOuterJoin -3022 /* No inconsistent updates on outer joins */
+#define JET_errQueryNullRequired -3023 /* Column must be NULL */
+#define JET_errQueryNoOutputs -3024 /* Query must have an output */
+#define JET_errQueryNoInputTables -3025 /* Query must have an input */
+#define JET_wrnQueryNonUpdatableRvt 3026 /* Query is not updatable (but IS RVT) */
+#define JET_errQueryInvalidAlias -3027 /* Bogus character in alias name */
+#define JET_errQueryInvalidBulkInput -3028 /* Cannot input from bulk operation */
+#define JET_errQueryNotDirectChild -3029 /* T.* must use direct child */
+#define JET_errQueryExprEvaluation -3030 /* Expression evaluation error */
+#define JET_errQueryIsNotRowReturning -3031 /* Query does not return rows */
+#define JET_wrnQueryNonRvt 3032 /* Can't create RVT, query is static */
+#define JET_errQueryParmTypeMismatch -3033 /* Wrong parameter type given */
+#define JET_errQueryChanging -3034 /* Query Objects are being updated */
+#define JET_errQueryNotUpdatable -3035 /* Operation must use an updatable query */
+#define JET_errQueryMissingColumnName -3036 /* Missing destination column */
+#define JET_errQueryTableDuplicate -3037 /* Repeated table name in FROM list */
+#define JET_errQueryIsMGB -3038 /* Query is an MGB */
+#define JET_errQueryInsIntoBulkMGB -3039 /* Cannot insert into Bulk/MGB */
+#define JET_errQueryDistinctNotAllowed -3040 /* DISTINCT not allowed for MGB */
+#define JET_errQueryDistinctRowNotAllow -3041 /* DISTINCTROW not allowed for MGB */
+#define JET_errQueryNoDbForParmDestTbl -3045 /* Dest DB for VT parm not allowed */
+#define JET_errQueryDuplicatedFixedSet -3047 /* Duplicated Fixed Value */
+#define JET_errQueryNoDeleteTables -3048 /* Must specify tables to delete from */
+#define JET_errQueryCannotDelete -3049 /* Cannot delete from specified tables */
+#define JET_errQueryTooManyGroupExprs -3050 /* Too many GROUP BY expressions */
+#define JET_errQueryTooManyOrderExprs -3051 /* Too many ORDER BY expressions */
+#define JET_errQueryTooManyDistExprs -3052 /* Too many DISTINCT output expressions */
+#define JET_errQueryBadValueList -3053 /* Malformed value list in Transform */
+#define JET_errConnStrTooLong -3054 /* Connect string too long */
+#define JET_errQueryInvalidParm -3055 /* Invalid Parmeter Name (>64 char) */
+#define JET_errQueryContainsDbParm -3056 /* Can't get parameters with Db Parm */
+#define JET_errQueryBadUpwardRefed -3057 /* Illegally Upward ref'ed */
+#define JET_errQueryAmbiguousJoins -3058 /* Joins in a QO are ambiguous */
+#define JET_errQueryIsNotDDL -3059 /* Not a DDL Operation */
+#define JET_errNoDbInConnStr -3060 /* No database in connect string */
+#define JET_wrnQueryIsNotRowReturning 3061 /* Not row returning */
+#define JET_errTooManyFindSessions -3062 /* RVT already has a find session open */
+#define JET_errSingleValueExpected -3063 /* At most one record with one column can be returned from a scalar subquery */
+#define JET_errColumnCountMismatch -3064 /* Union Query: number of columns in children dont match */
+#define JET_errQueryTopNotAllowed -3065 /* Top not allowed for MGB */
+#define JET_errQueryIsDDL -3066 /* Must set JET_bitTableDDL */
+#define JET_errQueryIsCorrupt -3067 /* Query is Corrupt */
+#define JET_errQuerySPTBulkSucceeded -3068 /* INTERNAL only */
+#define JET_errSPTReturnedNoRecords -3069 /* SPT marked as RowReturning did not return a table */
+
+#define JET_errExprSyntax -3100 /* Syntax error in expression */
+#define JET_errExprIllegalType -3101 /* Illegal type in expression */
+#define JET_errExprUnknownFunction -3102 /* Unknown function in expression */
+
+#define JET_errSQLSyntax -3500 /* Bogus SQL statement type */
+#define JET_errSQLParameterSyntax -3501 /* Parameter clause syntax error */
+#define JET_errSQLInsertSyntax -3502 /* INSERT clause syntax error */
+#define JET_errSQLUpdateSyntax -3503 /* UPDATE clause syntax error */
+#define JET_errSQLSelectSyntax -3504 /* SELECT clause syntax error */
+#define JET_errSQLDeleteSyntax -3505 /* Expected 'FROM' after 'DELETE' */
+#define JET_errSQLFromSyntax -3506 /* FROM clause syntax error */
+#define JET_errSQLGroupBySyntax -3507 /* GROUP BY clause syntax error */
+#define JET_errSQLOrderBySyntax -3508 /* ORDER BY clause syntax error */
+#define JET_errSQLLevelSyntax -3509 /* LEVEL syntax error */
+#define JET_errSQLJoinSyntax -3510 /* JOIN syntax error */
+#define JET_errSQLTransformSyntax -3511 /* TRANSFORM syntax error */
+#define JET_errSQLHavingSyntax -3512 /* HAVING clause syntax error */
+#define JET_errSQLWhereSyntax -3513 /* WHERE clause syntax error */
+#define JET_errSQLProcedureSyntax -3514 /* Expected query name after 'PROCEDURE' */
+#define JET_errSQLNotEnoughBuf -3515 /* Buffer too small for SQL string */
+#define JET_errSQLMissingSemicolon -3516 /* Missing ; at end of SQL statement */
+#define JET_errSQLTooManyTokens -3517 /* Characters after end of SQL statement */
+#define JET_errSQLOwnerAccessSyntax -3518 /* OWNERACCESS OPTION syntax error */
+
+#define JET_errV11NotSupported -3519 /* not supported in V11 */
+#define JET_errV10Format -3520 /* can be present in V10 format only */
+#define JET_errSQLUnionSyntax -3521 /* UNION query syntax error */
+#define JET_errSqlPassThrough -3523 /* Pass Through query Disallowed */
+#define JET_wrnSqlPassThrough 3524 /* Pass Through query involved */
+
+#define JET_errDDLConstraintSyntax -3550 /* constraint syntax error */
+#define JET_errDDLCreateTableSyntax -3551 /* create table syntax error */
+#define JET_errDDLCreateIndexSyntax -3552 /* create index syntax error */
+#define JET_errDDLColumnDefSyntax -3553 /* column def syntax error */
+#define JET_errDDLAlterTableSyntax -3554 /* alter table syntax error */
+#define JET_errDDLDropIndexSyntax -3555 /* drop index syntax error */
+#define JET_errDDLDropSyntax -3556 /* drop view/procedure syntax error */
+#define JET_errDDLCreateViewSyntax -3557 /* create view syntax error */
+
+#define JET_errNoSuchProperty -3600 /* Property was not found */
+#define JET_errPropertyTooLarge -3601 /* Small Property larger than 2K */
+#define JET_errJPMInvalidForV1x -3602 /* No JPM for V1.x databases */
+#define JET_errPropertyExists -3603 /* Property already exists */
+#define JET_errInvalidDelete -3604 /* DeleteOnly called with non-zero cbData */
+
+#define JET_wrnFindWrapped 3700 /* Cursor wrapped during fast find */
+
+#define JET_errTLVNativeUserTablesOnly -3700 /* TLVs can only be placed on native user tables/columns */
+#define JET_errTLVNoNull -3701 /* This field cannot be null */
+#define JET_errTLVNoBlank -3702 /* This column cannot be blank */
+#define JET_errTLVRuleViolation -3703 /* This validation rule must be met */
+#define JET_errTLVInvalidColumn -3704 /* This TLV property cannot be placed on this column */
+#define JET_errTLVExprEvaluation -3705 /* Expression evaluation error */
+#define JET_errTLVExprUnknownFunc -3706 /* Unknown function in TLV expression */
+#define JET_errTLVExprSyntax -3707 /* Syntax error in TLV expression */
+
+ /* CONSIDER: Remove the following error. */
+
+#define JET_errGeneral -5001 /* I-ISAM: assert failure */
+#define JET_errRecordLocked -5002 /* I-ISAM: record locked */
+#define JET_wrnColumnDataTruncated 5003 /* I-ISAM: data truncated */
+#define JET_errTableNotOpen -5004 /* I-ISAM: table is not open */
+#define JET_errDecryptFail -5005 /* I-ISAM: incorrect password */
+#define JET_wrnCurrencyLost 5007 /* I-ISAM: currency lost - must first/last */
+#define JET_errDateOutOfRange -5008 /* I-ISAM: invalid date */
+#define JET_wrnOptionsIgnored 5011 /* I-ISAM: options were ignored */
+#define JET_errTableNotComplete -5012 /* I-ISAM: incomplete table definition */
+#define JET_errIllegalNetworkOption -5013 /* I-ISAM: illegal network option */
+#define JET_errIllegalTimeoutOption -5014 /* I-ISAM: illegal timeout option */
+#define JET_errNotExternalFormat -5015 /* I-ISAM: invalid file format */
+#define JET_errUnexpectedEngineReturn -5016 /* I-ISAM: unexpected engine error code */
+#define JET_errNumericFieldOverflow -5017 /* I-ISAM: can't convert to native type */
+
+#define JET_errIndexHasNoPrimary -5020 /* Paradox: no primary index */
+#define JET_errTableSortOrderMismatch -5021 /* Paradox: sort order mismatch */
+#define JET_errNoConfigParameters -5023 /* Paradox: net path or user name missing */
+#define JET_errCantAccessParadoxNetDir -5024 /* Paradox: bad Paradox net path */
+#define JET_errObsoleteLockFile -5025 /* Paradox: obsolete lock file */
+#define JET_errIllegalCollatingSequence -5026 /* Paradox: invalid sort sequence */
+#define JET_errWrongCollatingSequence -5027 /* Paradox: wrong sort sequence */
+#define JET_errCantUseUnkeyedTable -5028 /* Paradox: can't open unkeyed table */
+
+#define JET_errINFFileError -5101 /* dBase: invalid .INF file */
+#define JET_errCantMakeINFFile -5102 /* dBase: can't open .INF file */
+#define JET_wrnCantMaintainIndex 5103 /* dBase: unmaintainable index */
+#define JET_errMissingMemoFile -5104 /* dBase: missing memo file */
+#define JET_errIllegalCenturyOption -5105 /* dBase: Illegal century option */
+#define JET_errIllegalDeletedOption -5106 /* dBase: Illegal deleted option */
+#define JET_errIllegalStatsOption -5107 /* dBase: Illegal statistics option */
+#define JET_errIllegalDateOption -5108 /* dBase: Illegal date option */
+#define JET_errIllegalMarkOption -5109 /* dBase: Illegal mark option */
+#define JET_wrnDuplicateIndexes 5110 /* dBase: duplicate indexes in INF file */
+#define JET_errINFIndexNotFound -5111 /* dBase: missing index in INF file */
+#define JET_errWrongMemoFileType -5112 /* dBase: wrong memo file type */
+#define JET_errIllegalExactOption -5113 /* dBase: Illegal exact option */
+
+#define JET_errTooManyLongFields -5200 /* Btrieve: more than one memo field */
+#define JET_errCantStartBtrieve -5201 /* Btrieve: wbtrcall.dll missing */
+#define JET_errBadConfigParameters -5202 /* Btrieve: win.ini [btrieve] options wrong */
+#define JET_errIndexesChanged -5203 /* Btrieve: need to GetIndexInfo */
+#define JET_errNonModifiableKey -5204 /* Btrieve: can't modify record column */
+#define JET_errOutOfBVResources -5205 /* Btrieve: out of resources */
+#define JET_errBtrieveDeadlock -5206 /* Btrieve: locking deadlock */
+#define JET_errBtrieveFailure -5207 /* Btrieve: Btrieve DLL failure */
+#define JET_errBtrieveDDCorrupted -5208 /* Btrieve: data dictionary corrupted */
+#define JET_errBtrieveTooManyTasks -5209 /* Btrieve: too many tasks */
+#define JET_errIllegalIndexDDFOption -5210 /* Btrieve: Illegal IndexDDF option */
+#define JET_errIllegalDataCodePage -5211 /* Btrieve: Illeagl DataCodePage option */
+#define JET_errXtrieveEnvironmentError -5212 /* Btrieve: Xtrieve INI options bad */
+#define JET_errMissingDDFFile -5213 /* Btrieve: Missing field.ddf */
+#define JET_errIlleaglIndexNumberOption -5214 /* Btrieve: Illeagl IndexRenumber option */
+
+ /* Extended error codes must be in the following range. */
+ /* Major error codes may not be in this range. */
+
+#define JET_errMinorLeast -8000
+#define JET_errMinorMost -8999
+
+#define JET_errFindExprSyntax -8001 /* Syntax error in FastFind expression */
+#define JET_errQbeExprSyntax -8002 /* Syntax error in QBE expression */
+#define JET_errInputTableNotFound -8003 /* Non-existant object in FROM list */
+#define JET_errQueryExprSyntax -8004 /* Syntax error in some query expression */
+#define JET_errQodefExprSyntax -8005 /* Syntax error in expression column */
+#define JET_errExpAliasAfterAS -8006 /* Expected alias after 'AS' in FROM list */
+#define JET_errExpBYAfterGROUP -8007 /* Expected 'BY' after 'GROUP' */
+#define JET_errExpBYAfterORDER -8008 /* Expected 'BY' after 'ORDER' */
+#define JET_errExpClsParenAfterColList -8009 /* Expected ')' after column list */
+#define JET_errExpColNameAfterPIVOT -8010 /* Expected column name after 'PIVOT' */
+#define JET_errExpDatabaseAfterIN -8011 /* Expected database name after 'IN' */
+#define JET_errExpDatatypeAfterParmName -8012 /* Expected datatype after parameter name */
+#define JET_errExpEqualAfterUpdColName -8013 /* Expected '=' after update column name */
+#define JET_errExpExprAfterON -8014 /* Expected join expression after 'ON' */
+#define JET_errExpExprAfterTRANSFORM -8015 /* Expected expression after 'TRANSFORM' */
+#define JET_errExpExprAfterWHERE -8016 /* Expected expression after 'WHERE' */
+#define JET_errExpGroupClauseInXform -8017 /* Transform expects GROUP BY clause */
+#define JET_errExpGroupingExpr -8018 /* Expected grouping expression */
+#define JET_errExpHavingExpr -8019 /* Expected HAVING expression */
+#define JET_errExpINTOAfterINSERT -8020 /* Expected 'INTO' after 'INSERT' */
+#define JET_errExpJOINAfterJoinType -8021 /* Expected 'JOIN' after INNER/LEFT/RIGHT */
+#define JET_errExpLEVELAfterSelectList -8022 /* Expected LEVEL after select list */
+#define JET_errExpNumberAfterLEVEL -8023 /* Expected number after 'LEVEL' */
+#define JET_errExpONAfterRightTable -8024 /* Expected 'ON' after right join table */
+#define JET_errExpOrderExpr -8025 /* Expected ordering expression */
+#define JET_errExpOutputAliasAfterAS -8026 /* Expected output alias after 'AS' */
+#define JET_errExpOutputExpr -8027 /* Expected output expression */
+#define JET_errExpPIVOTAfterSelectStmt -8028 /* Expected 'PIVOT' after SELECT statement */
+#define JET_errExpRightJoinTable -8029 /* Expected right join table after 'JOIN' */
+#define JET_errExpSELECTAfterInsClause -8030 /* Expected 'SELECT' after INSERT clause */
+#define JET_errExpSELECTAfterXformExpr -8031 /* Expected 'SELECT' after Transform fact */
+#define JET_errExpSETAfterTableName -8032 /* Expected 'SET' after table name */
+#define JET_errExpSemiAfterLevelNumber -8033 /* Expected ';' after level number */
+#define JET_errExpSemiAfterParmList -8034 /* Expected ';' after parmeter list */
+#define JET_errExpSemiAfterPivotClause -8035 /* Expected ';' after PIVOT clause */
+#define JET_errExpSemiAtEndOfSQL -8036 /* Expected ';' at end of SQL statement */
+#define JET_errExpTableName -8037 /* Expected table name */
+#define JET_errExpTableNameAfterINTO -8038 /* Expected table name after 'INTO' */
+#define JET_errExpUpdExprAfterEqual -8039 /* Expected update expression after '=' */
+#define JET_errExpUpdateColName -8040 /* Expected update column name */
+#define JET_errInvTokenAfterFromList -8041 /* Bogus token after FROM list */
+#define JET_errInvTokenAfterGroupList -8042 /* Bogus token after GROUP BY list */
+#define JET_errInvTokenAfterHavingCls -8043 /* Bogus token after HAVING clause */
+#define JET_errInvTokenAfterOrderClause -8044 /* Bogus token after ORDER BY clause */
+#define JET_errInvTokenAfterSelectCls -8045 /* Bogus token after SELECT clause */
+#define JET_errInvTokenAfterWhereClause -8046 /* Bogus token after WHERE clause */
+#define JET_errLevelNumberTooBig -8047 /* Number after 'LEVEL' too big */
+#define JET_errLevelOnNonMGB -8048 /* LEVEL allowed only in MGB */
+#define JET_errIllegalDetailReference -8049 /* Not group key or agg, but not MGB detail */
+#define JET_errAggOverMixedLevels -8050 /* Agg. arg. uses outputs from > 1 level */
+#define JET_errAggregatingHigherLevel -8051 /* Agg. over output of same/higher level */
+#define JET_errNullInJoinKey -8052 /* Cannot set column in join key to NULL */
+#define JET_errValueBreaksJoin -8053 /* Join is broken by column value(s) */
+#define JET_errInsertIntoUnknownColumn -8054 /* INSERT INTO unknown column name */
+#define JET_errNoSelectIntoColumnName -8055 /* No dest. col. name in SELECT INTO stmt */
+#define JET_errNoInsertColumnName -8056 /* No dest. col. name in INSERT stmt */
+#define JET_errColumnNotInJoinTable -8057 /* Join expr refers to non-join table */
+#define JET_errAggregateInJoin -8058 /* Aggregate in JOIN clause */
+#define JET_errAggregateInWhere -8059 /* Aggregate in WHERE clause */
+#define JET_errAggregateInOrderBy -8060 /* Aggregate in ORDER BY clause */
+#define JET_errAggregateInGroupBy -8061 /* Aggregate in GROUP BY clause */
+#define JET_errAggregateInArgument -8062 /* Aggregate in argument expression */
+#define JET_errHavingOnTransform -8063 /* HAVING clause on TRANSFORM query */
+#define JET_errHavingWithoutGrouping -8064 /* HAVING clause w/o grouping/aggregation */
+#define JET_errHavingOnMGB -8065 /* HAVING clause on MGB query */
+#define JET_errOutputAliasCycle -8066 /* Cycle in SELECT list (via aliases) */
+#define JET_errDotStarWithGrouping -8067 /* 'T.*' with grouping, but not MGB level 0 */
+#define JET_errStarWithGrouping -8068 /* '*' with grouping, but not MGB detail */
+#define JET_errQueryTreeCycle -8069 /* Cycle in tree of query objects */
+#define JET_errTableRepeatInFromList -8072 /* Table appears twice in FROM list */
+#define JET_errTooManyXformLevels -8073 /* Level > 2 in TRANSFORM query */
+#define JET_errTooManyMGBLevels -8074 /* Too many levels in MGB */
+#define JET_errNoUpdateColumnName -8075 /* No dest. column name in UPDATE stmt */
+#define JET_errJoinTableNotInput -8076 /* Join table not in FROM list */
+#define JET_errUnaliasedSelfJoin -8077 /* Join tables have same name */
+#define JET_errOutputLevelTooBig -8078 /* Output w/ level > 1+max group level */
+#define JET_errOrderVsGroup -8079 /* ORDER BY conflicts with GROUP BY */
+#define JET_errOrderVsDistinct -8080 /* ORDER BY conflicts with DISTINCT */
+#define JET_errExpLeftParenthesis -8082 /* Expected '(' */
+#define JET_errExpRightParenthesis -8083 /* Expected ')' */
+#define JET_errEvalEBESErr -8084 /* EB/ES error evaluating expression */
+#define JET_errQueryExpCloseQuote -8085 /* Unmatched quote for database name */
+#define JET_errQueryParmNotDatabase -8086 /* Parameter type should be database */
+#define JET_errQueryParmNotTableid -8087 /* Parameter type should be tableid */
+#define JET_errExpIdentifierM -8088 /* Expected identifier */
+#define JET_errExpQueryName -8089 /* Expected query name after PROCEDURE */
+#define JET_errExprUnknownFunctionM -8090 /* Unknown function in expression */
+#define JET_errQueryAmbigRefM -8091 /* Ambiguous column reference */
+#define JET_errQueryBadBracketing -8092 /* Bad bracketing of identifier */
+#define JET_errQueryBadQodefName -8093 /* Invalid name in QODEF row */
+#define JET_errQueryBulkColNotUpd -8094 /* Column not updatable (bulk op) */
+#define JET_errQueryDistinctNotAllowedM -8095 /* DISTINCT not allowed for MGB */
+#define JET_errQueryDuplicateAliasM -8096 /* Duplicate output alias */
+#define JET_errQueryDuplicateOutputM -8097 /* Duplicate destination output */
+#define JET_errQueryDuplicatedFixedSetM -8098 /* Duplicated Fixed Value */
+#define JET_errQueryIllegalOuterJoinM -8099 /* No inconsistent updates on outer joins */
+#define JET_errQueryIncompleteRowM -8100 /* Missing value in row */
+#define JET_errQueryInvalidAttributeM -8101 /* Invalid query attribute */
+#define JET_errQueryInvalidBulkInputM -8102 /* Cannot input from bulk operation */
+#define JET_errQueryInvalidFlagM -8103 /* Invalid value in Flag field */
+#define JET_errQueryInvalidMGBInputM -8104 /* Cannot input from MGB */
+#define JET_errQueryLVInAggregate -8105 /* Illegal long value in aggregate */
+#define JET_errQueryLVInDistinct -8106 /* Illegal long value in DISTINCT */
+#define JET_errQueryLVInGroupBy -8107 /* Illegal long value in GROUP BY */
+#define JET_errQueryLVInHaving -8108 /* Illegal long value in HAVING */
+#define JET_errQueryLVInJoin -8109 /* Illegal long value in JOIN */
+#define JET_errQueryLVInOrderBy -8110 /* Illegal long value in ORDER BY */
+#define JET_errQueryMissingLevelM -8111 /* Missing intermediate MGB level */
+#define JET_errQueryMissingParmsM -8112 /* Too few parameters supplied */
+#define JET_errQueryNoDbForParmDestTblM -8113 /* Dest DB for VT parm not allowed */
+#define JET_errQueryNoDeletePerm -8114 /* No delete permission on table/query */
+#define JET_errQueryNoInputTablesM -8115 /* Query must have an input */
+#define JET_errQueryNoInsertPerm -8116 /* No insert permission on table/query */
+#define JET_errQueryNoOutputsM -8117 /* Query must have an output */
+#define JET_errQueryNoReadDefPerm -8118 /* No permission to read query definition */
+#define JET_errQueryNoReadPerm -8119 /* No read permission on table/query */
+#define JET_errQueryNoReplacePerm -8120 /* No replace permission on table/query */
+#define JET_errQueryNoTblCrtPerm -8121 /* No CreateTable permission (bulk op) */
+#define JET_errQueryNotDirectChildM -8122 /* T.* must use direct child */
+#define JET_errQueryNullRequiredM -8123 /* Column must be NULL */
+#define JET_errQueryOnlyOneRowM -8124 /* Only 1 such row allowed */
+#define JET_errQueryOutputColNotUpd -8125 /* Query output column not updatable */
+#define JET_errQueryParmRedefM -8126 /* Parm redefined with different type */
+#define JET_errQueryParmTypeMismatchM -8127 /* Wrong parameter type given */
+#define JET_errQueryUnboundRefM -8128 /* Cannot bind name */
+#define JET_errRmtConnectFailedM -8129 /* RMT: Connection attempt failed */
+#define JET_errRmtDeleteFailedM -8130 /* RMT: Delete statement failed */
+#define JET_errRmtInsertFailedM -8131 /* RMT: Insert statement failed */
+#define JET_errRmtMissingOdbcDllM -8132 /* RMT: Can't load ODBC DLL */
+#define JET_errRmtSqlErrorM -8133 /* RMT: ODBC call failed */
+#define JET_errRmtUpdateFailedM -8134 /* RMT: Update statement failed */
+#define JET_errSQLDeleteSyntaxM -8135 /* Expected 'FROM' after 'DELETE' */
+#define JET_errSQLSyntaxM -8136 /* Bogus SQL statement type */
+#define JET_errSQLTooManyTokensM -8137 /* Characters after end of SQL statement */
+#define JET_errStarNotAtLevel0 -8138 /* '*' illegal above level 0 */
+#define JET_errQueryParmTypeNotAllowed -8139 /* Parameter type not allowed for expression */
+#define JET_errQueryTooManyDestColumn -8142 /* Too many destination column sepcified */
+#define JET_errSQLNoInsertColumnName -8143 /* No dest. col. name in INSERT stmt */
+#define JET_errRmtLinkNotFound -8144 /* RMT: link not found */
+#define JET_errRmtTooManyColumns -8145 /* RMT: Too many columns on Select Into */
+#define JET_errWriteConflictM -8146 /* Write lock failed due to outstanding write lock */
+#define JET_errReadConflictM -8147 /* Commit lock failed due to outstanding read lock */
+#define JET_errCommitConflictM -8148 /* Read lock failed due to outstanding commit lock */
+#define JET_errTableLockedM -8149 /* Table is exclusively locked */
+#define JET_errTableInUseM -8150 /* Table is in use, cannot lock */
+#define JET_errQueryTooManyXvtColumn -8151 /* Too many cross table column headers */
+#define JET_errOutputTableNotFound -8152 /* Non-existent table in Insert Into */
+#define JET_errTableLockedQM -8153 /* Table is exclusively locked */
+#define JET_errTableInUseQM -8154 /* Table is in use, cannot lock */
+#define JET_errTableLockedMUQM -8155 /* Table is exclusively locked */
+#define JET_errTableInUseMUQM -8156 /* Table is in use, cannot lock */
+#define JET_errQueryInvalidParmM -8157 /* Invalid Parmeter Name (>64 char) */
+#define JET_errFileNotFoundM -8158 /* File not found */
+#define JET_errFileShareViolationM -8159 /* File sharing violation */
+#define JET_errFileAccessDeniedM -8160 /* Access denied */
+#define JET_errInvalidPathM -8161 /* Invalid Path */
+#define JET_errTableDuplicateM -8162 /* Table already exists */
+#define JET_errQueryBadUpwardRefedM -8163 /* Illegally Upward ref'ed */
+#define JET_errIntegrityViolMasterM -8164 /* References to key exist */
+#define JET_errIntegrityViolSlaveM -8165 /* No referenced key exists */
+#define JET_errSQLUnexpectedWithM -8166 /* Unexpected 'with' in this place */
+#define JET_errSQLOwnerAccessM -8167 /* Owner Access Option is defined Twice */
+#define JET_errSQLOwnerAccessSyntaxM -8168 /* Owner Access Option Syntax Error */
+#define JET_errSQLOwnerAccessDef -8169 /* Owner Access Option is defined more than once */
+#define JET_errAccessDeniedM -8170 /* Generic Access Denied */
+#define JET_errUnexpectedEngineReturnM -8171 /* I-ISAM: unexpected engine error code */
+#define JET_errQueryTopNotAllowedM -8172 /* Top not allowed for MGB */
+#define JET_errInvTokenAfterTableCls -8173 /* Bogus token after table clause */
+#define JET_errInvTokenAfterRParen -8174 /* Unexpected tokens after a closing paren */
+#define JET_errQueryBadValueListM -8175 /* Malformed value list in Transform */
+#define JET_errQueryIsCorruptM -8176 /* Query is Corrupt */
+#define JET_errInvalidTopArgumentM -8177 /* Select Top argument is invalid */
+#define JET_errQueryIsSnapshot -8178 /* Query is a snapshot */
+#define JET_errQueryExprOutput -8179 /* Output is a calculated column */
+#define JET_errQueryTableRO -8180 /* Column comes from read-only table */
+#define JET_errQueryRowDeleted -8181 /* Column comes from deleted row */
+#define JET_errQueryRowLocked -8182 /* Column comes from locked row */
+#define JET_errQueryFixupChanged -8183 /* Would row-fixup away from pending changes */
+#define JET_errQueryCantFillIn -8184 /* Fill-in-the-blank only on most-many */
+#define JET_errQueryWouldOrphan -8185 /* Would orphan joined records */
+#define JET_errIncorrectJoinKeyM -8186 /* Must match join key in lookup table */
+#define JET_errQueryLVInSubqueryM -8187 /* Illegal long value in subquery */
+#define JET_errInvalidDatabaseM -8188 /* Unrecognized database format */
+#define JET_errOrderVsUnion -8189 /* You can only order by an outputted column in a union */
+#define JET_errTLVCouldNotBindRef -8190 /* Unknown token in TLV expression */
+#define JET_errCouldNotBindRef -8191 /* Unknown token in FastFind expression */
+#define JET_errQueryPKeyNotOutput -8192 /* Primary key not output */
+#define JET_errQueryJKeyNotOutput -8193 /* Join key not output */
+#define JET_errExclusiveDBConflict -8194 /* Conflict with exclusive user */
+#define JET_errQueryNoJoinedRecord -8195 /* No F.I.T.B. insert if no joined record */
+#define JET_errQueryLVInSetOp -8196 /* Illegal long value in set operation */
+#define JET_errTLVExprUnknownFunctionM -8197 /* Unknown function in TLV expression */
+#define JET_errInvalidNameM -8198 /* Invalid name */
+
+#define JET_errDDLExpColName -8200 /* expect column name */
+#define JET_errDDLExpLP -8201 /* expect '(' */
+#define JET_errDDLExpRP -8202 /* expect ')' */
+#define JET_errDDLExpIndex -8203 /* expect INDEX */
+#define JET_errDDLExpIndexName -8204 /* expect index name */
+#define JET_errDDLExpOn -8205 /* expect ON */
+#define JET_errDDLExpKey -8206 /* expect KEY */
+#define JET_errDDLExpReferences -8207 /* expect REFERENCES */
+#define JET_errDDLExpTableName -8208 /* expect table name */
+#define JET_errDDLExpFullOrPartial -8209 /* expect FULL or PARTIAL */
+#define JET_errDDLExpCascadeOrSet -8210 /* expect CASCADE or SET */
+#define JET_errDDLExpNull -8211 /* expect NULL */
+#define JET_errDDLExpUpdateOrDelete -8212 /* expect UPDATE or DELETE */
+#define JET_errDDLExpConstraintName -8213 /* expect constraint name */
+#define JET_errDDLExpForeign -8214 /* expect FOREIGN */
+#define JET_errDDLExpDatatype -8215 /* expect data type */
+#define JET_errDDLExpIndexOpt -8216 /* expect index options */
+#define JET_errDDLExpWith -8217 /* expect WITH */
+#define JET_errDDLExpTable -8218 /* expect TABLE */
+#define JET_errDDLExpEos -8219 /* expect End Of String */
+#define JET_errDDLExpAddOrDrop -8220 /* expect ADD or Drop */
+#define JET_errDDLCreateView -8221 /* Create view not supported */
+#define JET_errDDLCreateProc -8222 /* Create proc not supported */
+#define JET_errDDLExpObjectName -8223 /* expect object name */
+#define JET_errDDLExpColumn -8224 /* expect COLUMN */
+
+#define JET_errV11TableNameNotInScope -8250 /* referenced table not in join clause */
+#define JET_errV11OnlyTwoTables -8251 /* exactly two tables should be referenced in join */
+#define JET_errV11OneSided -8252 /* all tables come from one side of input */
+#define JET_errV11Ambiguous -8253 /* Join clause is ambiguous when stored in V1 format */
+
+#define JET_errTLVExprSyntaxM -8260 /* Syntax error in TLV expression */
+#define JET_errTLVNoNullM -8261 /* This field cannot be null */
+#define JET_errTLVNoBlankM -8262 /* This column cannot be blank */
+#define JET_errTLVRuleViolationM -8263 /* This validation rule must be met */
+#define JET_errDDLCreateViewSyntaxM -8264 /* create view syntax error */
+
+/***********************
+ The following error code ranges are reserved for external use.
+ As is true for Jet error codes, these ranges cover the negative
+ as well as positive form of the numbers in the range.
+
+ 30000 through 30999 for use by Vt Object as defined in jeteb.h
+ 32000 through 32767 for use by Import/Export as defined in jetutil.h
+
+ ***********************/
+
+
+
+/**********************************************************************/
+/*********************** PROTOTYPES **************************/
+/**********************************************************************/
+
+#if !defined(_JET_NOPROTOTYPES)
+
+/****************************************************************************
+
+ ISAM API
+
+*****************************************************************************/
+
+JET_ERR JET_API JetInit(JET_INSTANCE _far *pinstance);
+
+JET_ERR JET_API JetTerm(JET_INSTANCE instance);
+
+JET_ERR JET_API JetSetSystemParameter(JET_INSTANCE _far *pinstance, JET_SESID sesid, unsigned long paramid,
+ unsigned long lParam, const char _far *sz);
+
+JET_ERR JET_API JetGetSystemParameter(JET_INSTANCE instance, JET_SESID sesid, unsigned long paramid,
+ unsigned long _far *plParam, char _far *sz, unsigned long cbMax);
+
+JET_ERR JET_API JetGetLastErrorInfo(JET_SESID sesid,
+ JET_EXTERR _far *pexterr, unsigned long cbexterrMax,
+ char _far *sz1, unsigned long cch1Max,
+ char _far *sz2, unsigned long cch2Max,
+ char _far *sz3, unsigned long cch3Max,
+ unsigned long _far *pcch3Actual);
+
+JET_ERR JET_API JetBeginSession(JET_INSTANCE instance, JET_SESID _far *psesid,
+ const char _far *szUserName, const char _far *szPassword);
+
+JET_ERR JET_API JetDupSession(JET_SESID sesid, JET_SESID _far *psesid);
+
+JET_ERR JET_API JetEndSession(JET_SESID sesid, JET_GRBIT grbit);
+
+JET_ERR JET_API JetGetVersion(JET_SESID sesid, unsigned long _far *pwVersion);
+
+JET_ERR JET_API JetIdle(JET_SESID sesid, JET_GRBIT grbit);
+
+JET_ERR JET_API JetCapability(JET_SESID sesid, JET_DBID dbid,
+ unsigned long lArea, unsigned long lFunction, JET_GRBIT _far *pgrbit);
+
+JET_ERR JET_API JetCreateDatabase(JET_SESID sesid,
+ const char _far *szFilename, const char _far *szConnect,
+ JET_DBID _far *pdbid, JET_GRBIT grbit);
+
+JET_ERR JET_API JetAttachDatabase(JET_SESID sesid, const char _far *szFilename, JET_GRBIT grbit );
+
+JET_ERR JET_API JetDetachDatabase(JET_SESID sesid, const char _far *szFilename);
+
+JET_ERR JET_API JetCreateTable(JET_SESID sesid, JET_DBID dbid,
+ const char _far *szTableName, unsigned long lPages, unsigned long lDensity,
+ JET_TABLEID _far *ptableid);
+
+JET_ERR JET_API JetRenameTable(JET_SESID sesid, JET_DBID dbid,
+ const char _far *szTableName, const char _far *szTableNew);
+
+JET_ERR JET_API JetDeleteTable(JET_SESID sesid, JET_DBID dbid,
+ const char _far *szTableName);
+
+JET_ERR JET_API JetGetTableColumnInfo(JET_SESID sesid, JET_TABLEID tableid,
+ const char _far *szColumnName, void _far *pvResult, unsigned long cbMax,
+ unsigned long InfoLevel);
+
+JET_ERR JET_API JetGetColumnInfo(JET_SESID sesid, JET_DBID dbid,
+ const char _far *szTableName, const char _far *szColumnName,
+ void _far *pvResult, unsigned long cbMax, unsigned long InfoLevel);
+
+JET_ERR JET_API JetAddColumn(JET_SESID sesid, JET_TABLEID tableid,
+ const char _far *szColumn, const JET_COLUMNDEF _far *pcolumndef,
+ const void _far *pvDefault, unsigned long cbDefault,
+ JET_COLUMNID _far *pcolumnid);
+
+JET_ERR JET_API JetRenameColumn(JET_SESID sesid, JET_TABLEID tableid,
+ const char _far *szColumn, const char _far *szColumnNew);
+
+JET_ERR JET_API JetDeleteColumn(JET_SESID sesid, JET_TABLEID tableid,
+ const char _far *szColumn);
+
+JET_ERR JET_API JetGetTableIndexInfo(JET_SESID sesid, JET_TABLEID tableid,
+ const char _far *szIndexName, void _far *pvResult, unsigned long cbResult,
+ unsigned long InfoLevel);
+
+JET_ERR JET_API JetGetTableReferenceInfo(JET_SESID sesid, JET_TABLEID tableid,
+ const char _far *szReferenceName, void _far *pvResult,
+ unsigned long cbResult, unsigned long InfoLevel);
+
+JET_ERR JET_API JetGetTableInfo(JET_SESID sesid, JET_TABLEID tableid,
+ void _far *pvResult, unsigned long cbMax, unsigned long InfoLevel);
+
+JET_ERR JET_API JetGetIndexInfo(JET_SESID sesid, JET_DBID dbid,
+ const char _far *szTableName, const char _far *szIndexName,
+ void _far *pvResult, unsigned long cbResult, unsigned long InfoLevel);
+
+JET_ERR JET_API JetGetReferenceInfo(JET_SESID sesid, JET_DBID dbid,
+ const char _far *szTableName, const char _far *szReference,
+ void _far *pvResult, unsigned long cbResult, unsigned long InfoLevel);
+
+JET_ERR JET_API JetCreateIndex(JET_SESID sesid, JET_TABLEID tableid,
+ const char _far *szIndexName, JET_GRBIT grbit,
+ const char _far *szKey, unsigned long cbKey, unsigned long lDensity);
+
+JET_ERR JET_API JetRenameIndex(JET_SESID sesid, JET_TABLEID tableid,
+ const char _far *szIndex, const char _far *szIndexNew);
+
+JET_ERR JET_API JetDeleteIndex(JET_SESID sesid, JET_TABLEID tableid,
+ const char _far *szIndexName);
+
+JET_ERR JET_API JetCreateReference(JET_SESID sesid, JET_TABLEID tableid,
+ const char _far *szReferenceName, const char _far *szColumns,
+ const char _far *szReferencedTable,
+ const char _far *szReferencedColumns, JET_GRBIT grbit);
+
+JET_ERR JET_API JetRenameReference(JET_SESID sesid, JET_TABLEID tableid,
+ const char _far *szReference, const char _far *szReferenceNew);
+
+JET_ERR JET_API JetDeleteReference(JET_SESID sesid, JET_TABLEID tableid,
+ const char _far *szReferenceName);
+
+JET_ERR JET_API JetGetObjectInfo(JET_SESID sesid, JET_DBID dbid,
+ JET_OBJTYP objtyp, const char _far *szContainerName,
+ const char _far *szObjectName, void _far *pvResult, unsigned long cbMax,
+ unsigned long InfoLevel);
+
+JET_ERR JET_API JetCreateObject(JET_SESID sesid, JET_DBID dbid,
+ const char _far *szContainerName, const char _far *szObjectName,
+ JET_OBJTYP objtyp);
+
+JET_ERR JET_API JetDeleteObject(JET_SESID sesid, JET_DBID dbid,
+ const char _far *szContainerName, const char _far *szObjectName);
+
+JET_ERR JET_API JetRenameObject(JET_SESID sesid, JET_DBID dbid,
+ const char _far *szContainerName, const char _far *szObjectName,
+ const char _far *szObjectNew);
+
+JET_ERR JET_API JetBeginTransaction(JET_SESID sesid);
+
+JET_ERR JET_API JetCommitTransaction(JET_SESID sesid, JET_GRBIT grbit);
+
+JET_ERR JET_API JetRollback(JET_SESID sesid, JET_GRBIT grbit);
+
+JET_ERR JET_API JetUpdateUserFunctions(JET_SESID sesid);
+
+JET_ERR JET_API JetGetDatabaseInfo(JET_SESID sesid, JET_DBID dbid,
+ void _far *pvResult, unsigned long cbMax, unsigned long InfoLevel);
+
+JET_ERR JET_API JetCloseDatabase(JET_SESID sesid, JET_DBID dbid,
+ JET_GRBIT grbit);
+
+JET_ERR JET_API JetCloseTable(JET_SESID sesid, JET_TABLEID tableid);
+
+JET_ERR JET_API JetOpenDatabase(JET_SESID sesid, const char _far *szFilename,
+ const char _far *szConnect, JET_DBID _far *pdbid, JET_GRBIT grbit);
+
+JET_ERR JET_API JetOpenTable(JET_SESID sesid, JET_DBID dbid,
+ const char _far *szTableName, const void _far *pvParameters,
+ unsigned long cbParameters, JET_GRBIT grbit, JET_TABLEID _far *ptableid);
+
+JET_ERR JET_API JetDelete(JET_SESID sesid, JET_TABLEID tableid);
+
+JET_ERR JET_API JetUpdate(JET_SESID sesid, JET_TABLEID tableid,
+ void _far *pvBookmark, unsigned long cbBookmark,
+ unsigned long _far *pcbActual);
+
+JET_ERR JET_API JetRetrieveColumn(JET_SESID sesid, JET_TABLEID tableid,
+ JET_COLUMNID columnid, void _far *pvData, unsigned long cbData,
+ unsigned long _far *pcbActual, JET_GRBIT grbit, JET_RETINFO _far *pretinfo);
+
+JET_ERR JET_API JetRetrieveColumns( JET_SESID sesid, JET_TABLEID tableid,
+ JET_RETRIEVECOLUMN *pretrievecolumn, unsigned long cretrievecolumn );
+
+JET_ERR JET_API JetSetColumn(JET_SESID sesid, JET_TABLEID tableid,
+ JET_COLUMNID columnid, const void _far *pvData, unsigned long cbData,
+ JET_GRBIT grbit, JET_SETINFO _far *psetinfo);
+
+JET_ERR JET_API JetSetColumns(JET_SESID sesid, JET_TABLEID tableid,
+ JET_SETCOLUMN *psetcolumn, unsigned long csetcolumn );
+
+JET_ERR JET_API JetPrepareUpdate(JET_SESID sesid, JET_TABLEID tableid,
+ unsigned long prep);
+
+JET_ERR JET_API JetGetRecordPosition(JET_SESID sesid, JET_TABLEID tableid,
+ JET_RECPOS _far *precpos, unsigned long cbRecpos);
+
+JET_ERR JET_API JetGotoPosition(JET_SESID sesid, JET_TABLEID tableid,
+ JET_RECPOS *precpos );
+
+JET_ERR JET_API JetGetCursorInfo(JET_SESID sesid, JET_TABLEID tableid,
+ void _far *pvResult, unsigned long cbMax, unsigned long InfoLevel);
+
+JET_ERR JET_API JetDupCursor(JET_SESID sesid, JET_TABLEID tableid,
+ JET_TABLEID _far *ptableid, JET_GRBIT grbit);
+
+JET_ERR JET_API JetGetCurrentIndex(JET_SESID sesid, JET_TABLEID tableid,
+ char _far *szIndexName, unsigned long cchIndexName);
+
+JET_ERR JET_API JetSetCurrentIndex(JET_SESID sesid, JET_TABLEID tableid,
+ const char _far *szIndexName);
+
+JET_ERR JET_API JetMove(JET_SESID sesid, JET_TABLEID tableid,
+ long cRow, JET_GRBIT grbit);
+
+JET_ERR JET_API JetMakeKey(JET_SESID sesid, JET_TABLEID tableid,
+ const void _far *pvData, unsigned long cbData, JET_GRBIT grbit);
+
+JET_ERR JET_API JetSeek(JET_SESID sesid, JET_TABLEID tableid,
+ JET_GRBIT grbit);
+
+JET_ERR JET_API JetFastFind(JET_SESID sesid, JET_DBID dbid,
+ JET_TABLEID tableid, const char _far *szExpr, JET_GRBIT grbit,
+ signed long _far *pcrow);
+
+JET_ERR JET_API JetFastFindBegin(JET_SESID sesid, JET_DBID dbid,
+ JET_TABLEID tableid, const char _far *szExpr, JET_GRBIT grbit);
+
+JET_ERR JET_API JetFastFindEnd(JET_SESID sesid, JET_TABLEID tableid);
+
+JET_ERR JET_API JetGetBookmark(JET_SESID sesid, JET_TABLEID tableid,
+ void _far *pvBookmark, unsigned long cbMax,
+ unsigned long _far *pcbActual);
+
+JET_ERR JET_API JetRefreshLink(JET_SESID sesid, JET_DBID dbid,
+ const char _far *szLinkName, const char _far *szConnect,
+ const char _far *szDatabase);
+
+#ifdef _MSC_VER /* CONSIDER: CSL doesn't like this */
+
+JET_ERR JET_API JetRepairDatabase(JET_SESID sesid, const char _far *lszDbFile,
+ JET_PFNSTATUS pfnstatus);
+
+#endif /* _MSC_VER */
+
+JET_ERR JET_API JetCompact(JET_SESID sesid, const char _far *szDatabaseSrc,
+ const char _far *szConnectSrc, const char _far *szDatabaseDest,
+ const char _far *szConnectDest, JET_PFNSTATUS pfnStatus,
+ JET_GRBIT grbit);
+
+JET_ERR JET_API JetGotoBookmark(JET_SESID sesid, JET_TABLEID tableid,
+ void _far *pvBookmark, unsigned long cbBookmark);
+
+JET_ERR JET_API JetComputeStats(JET_SESID sesid, JET_TABLEID tableid);
+
+JET_ERR JET_API JetCreateRelationship(JET_SESID sesid,JET_DBID dbidIn,
+ const char _far *szRelationshipName, const char _far *szObjectName,
+ const char _far *szColumns, const char _far *szReferencedObject,
+ const char _far *szReferncedColumns, char _far *szLongName,
+ unsigned long cbMax, unsigned long _far *pcbActual, JET_GRBIT grbit);
+
+JET_ERR JET_API JetDeleteRelationship(JET_SESID sesid, JET_DBID dbidIn,
+ const char _far *szName);
+
+JET_ERR JET_API JetGetRelationshipInfo(JET_SESID sesid, JET_DBID dbid,
+ const char _far *szTableName, const char _far *szRelationship,
+ void _far *pvResult, unsigned long cbResult);
+
+/*****************************************************************************
+
+ SEC API
+
+*****************************************************************************/
+
+JET_ERR JET_API JetGetSidFromName(JET_SESID sesid, const char _far *szName,
+ void _far *pvSid, unsigned long cbMax, unsigned long _far *pcbActual,
+ long _far *pfGroup);
+
+JET_ERR JET_API JetGetNameFromSid(JET_SESID sesid,
+ const void _far *pvSid, unsigned long cbSid,
+ char _far *szName, unsigned long cchName, long _far *pfGroup);
+
+JET_ERR JET_API JetCreateUser(JET_SESID sesid, const char _far *szUser,
+ const char _far *szPassword, const char _far *szPin);
+
+JET_ERR JET_API JetChangeUserPassword(JET_SESID sesid,
+ const char _far *szUser, const char _far *szOldPassword,
+ const char _far *szNewPassword);
+
+JET_ERR JET_API JetDeleteUser(JET_SESID sesid, const char _far *szUser);
+
+JET_ERR JET_API JetCreateGroup(JET_SESID sesid, const char _far *szGroup,
+ const char _far *szPin);
+
+JET_ERR JET_API JetAddMember(JET_SESID sesid,
+ const char _far *szGroup, const char _far *szUser);
+
+JET_ERR JET_API JetRemoveMember(JET_SESID sesid,
+ const char _far *szGroup, const char _far *szUser);
+
+JET_ERR JET_API JetDeleteGroup(JET_SESID sesid, const char _far *szGroup);
+
+JET_ERR JET_API JetSetAccess(JET_SESID sesid, JET_DBID dbid,
+ const char _far *szContainerName, const char _far *szObjectName,
+ const char _far *szName, JET_ACM acm, JET_GRBIT grbit);
+
+JET_ERR JET_API JetGetAccess(JET_SESID sesid, JET_DBID dbid,
+ const char _far *szContainerName, const char _far *szObjectName,
+ const char _far *szName, long fIndividual,
+ JET_ACM _far *pacm, JET_GRBIT _far *pgrbit);
+
+JET_ERR JET_API JetValidateAccess(JET_SESID sesid, JET_DBID dbid,
+ const char _far *szContainerName, const char _far *szObjectName,
+ JET_ACM acmRequired);
+
+JET_ERR JET_API JetSetOwner(JET_SESID sesid, JET_DBID dbid,
+ const char _far *szContainerName, const char _far *szObjectName,
+ const char _far *szName);
+
+JET_ERR JET_API JetGetOwner(JET_SESID sesid, JET_DBID dbid,
+ const char _far *szContainerName, const char _far *szObjectName,
+ char _far *szName, unsigned long cchMax);
+
+/*****************************************************************************
+
+ Property Management API
+
+*****************************************************************************/
+JET_ERR JET_API JetSetProperty(JET_SESID sesid, JET_DBID dbid,
+ const char _far *szContainerName, const char _far *szObjectName,
+ const char _far *szSubObjectName, const char _far *szPropertyName,
+ void _far *pvData, unsigned long cbData, JET_COLTYP coltyp,
+ JET_GRBIT grbit);
+
+JET_ERR JET_API JetRetrieveProperty(JET_SESID sesid, JET_DBID dbid,
+ const char _far *szContainerName, const char _far *szObjectName,
+ const char _far *szSubObjectName, const char _far *szPropertyName,
+ void _far *pvData, unsigned long cbData, unsigned long _far *pcbActual,
+ JET_COLTYP _far *pcoltyp, JET_GRBIT grbit, unsigned long InfoLevel);
+
+JET_ERR JET_API JetSetTableProperty(JET_SESID sesid, JET_TABLEID tableid,
+ const char _far *szSubObjectName, const char _far *szPropertyName,
+ void _far *pvData, unsigned long cbData, JET_COLTYP coltyp,
+ JET_GRBIT grbit);
+
+JET_ERR JET_API JetRetrieveTableProperty(JET_SESID sesid, JET_TABLEID tableid,
+ const char _far *szSubObjectName, const char _far *szPropertyName,
+ void _far *pvData, unsigned long cbData, unsigned long _far *pcbActual,
+ JET_COLTYP _far *pcoltyp, JET_GRBIT grbit, unsigned long InfoLevel);
+
+/*****************************************************************************
+
+ LINK API
+
+*****************************************************************************/
+
+JET_ERR JET_API JetCreateLink(JET_SESID sesid, JET_DBID dbid,
+ const char _far *szLink, JET_DBID dbidFrom, const char _far *szFrom,
+ JET_GRBIT grbit);
+
+JET_ERR JET_API JetExecuteSql(JET_SESID sesid, JET_DBID dbid,
+ const char _far *szSql);
+
+/***************************************************************************
+
+ Query API
+
+*****************************************************************************/
+
+JET_ERR JET_API JetOpenVtQbe(JET_SESID sesid, const char _far *szExpn,
+ long _far *plCols, JET_TABLEID _far *ptableid, JET_GRBIT grbit);
+
+JET_ERR JET_API JetCreateQuery(JET_SESID sesid, JET_DBID dbid,
+ const char _far *szQuery, JET_TABLEID _far *ptableid);
+
+JET_ERR JET_API JetOpenQueryDef(JET_SESID sesid, JET_DBID dbid,
+ const char _far *szQuery, JET_TABLEID _far *ptableid);
+
+/* CONSIDER: Is rgchSql a zero-terminated string? Maybe it should be for
+ * consistency.
+ */
+
+JET_ERR JET_API JetSetQoSql(JET_SESID sesid, JET_TABLEID tableid,
+ char _far *rgchSql, unsigned long cchSql, const char _far *szConnect,
+ JET_GRBIT grbit);
+
+JET_ERR JET_API JetRetrieveQoSql(JET_SESID sesid, JET_TABLEID tableid,
+ char _far *rgchSql, unsigned long cchMax,
+ unsigned long _far *pcchActual, void _far *pvConnect,
+ unsigned long cbConnectMax, unsigned long _far *pcbConnectActual,
+ JET_GRBIT _far *pgrbit);
+
+JET_ERR JET_API JetCopyQuery(JET_SESID sesid, JET_TABLEID tableidSrc,
+ JET_DBID dbidDest, const char _far *szQueryDest,
+ JET_TABLEID _far *ptableidDest);
+
+JET_ERR JET_API JetOpenSVT(JET_SESID sesid, JET_DBID dbid,
+ const char _far *szQuery, const void _far *pvParameters,
+ unsigned long cbParameters, unsigned long crowSample, JET_GRBIT grbit,
+ void _far *pmgblist, unsigned long cbMax, unsigned long _far *pcbActual);
+
+JET_ERR JET_API JetGetQueryParameterInfo(JET_SESID sesid, JET_DBID dbid,
+ const char _far *szQuery, void _far *pvResult, unsigned long cbMax,
+ unsigned long _far *pcbActual);
+
+JET_ERR JET_API JetRestartQuery(JET_SESID sesid, JET_TABLEID tableid,
+ const void _far *pvParameters, unsigned long cbParameters);
+
+JET_ERR JET_API JetSetFatCursor(JET_SESID sesid, JET_TABLEID tableid,
+ void _far *pvBookmark, unsigned long cbBookmark, unsigned long crowSize);
+
+JET_ERR JET_API JetFillFatCursor(JET_SESID sesid, JET_TABLEID tableid,
+ void _far *pvBookmark, unsigned long cbBookmark, unsigned long crow,
+ unsigned long _far *pcrow, JET_GRBIT grbit);
+
+JET_ERR JET_API JetExecuteTempQuery(JET_SESID sesid, JET_DBID dbid,
+ JET_TABLEID tableid, const void _far *pvParameters,
+ unsigned long cbParameters, JET_GRBIT grbit, JET_TABLEID _far *ptableid);
+
+JET_ERR JET_API JetExecuteTempSVT(JET_SESID sesid, JET_DBID dbid,
+ JET_TABLEID tableid, const void _far *pvParameters,
+ unsigned long cbParameters, unsigned long crowSample, JET_GRBIT grbit,
+ void _far *pmgblist, unsigned long cbMax, unsigned long _far *pcbActual);
+
+JET_ERR JET_API JetGetTempQueryColumnInfo(JET_SESID sesid, JET_DBID dbid,
+ JET_TABLEID tableid, const char _far *szColumnName,
+ void _far *pvResult, unsigned long cbMax, unsigned long InfoLevel);
+
+JET_ERR JET_API JetGetTempQueryParameterInfo(JET_SESID sesid, JET_DBID dbid,
+ JET_TABLEID tableid, void _far *pvResult, unsigned long cbMax,
+ unsigned long _far *pcbActual);
+
+JET_ERR JET_API JetValidateData(JET_SESID sesid, JET_TABLEID tableidBase,
+ JET_TABLEID _far *ptableid );
+
+/***************************************************************************
+
+ API for Installable ISAMs
+
+****************************************************************************/
+
+typedef unsigned long JET_VSESID; /* Received from dispatcher */
+
+struct tagVDBFNDEF;
+
+typedef unsigned long JET_VDBID; /* Received from dispatcher */
+
+JET_ERR JET_API JetAllocateDbid(JET_SESID sesid, JET_DBID _far *pdbid, JET_VDBID vdbid, const struct tagVDBFNDEF _far *pvdbfndef, JET_VSESID vsesid);
+
+JET_ERR JET_API JetUpdateDbid(JET_SESID sesid, JET_DBID dbid, JET_VDBID vdbid, const struct tagVDBFNDEF _far *pvdbfndef);
+
+JET_ERR JET_API JetReleaseDbid(JET_SESID sesid, JET_DBID dbid);
+
+struct tagVTFNDEF;
+
+typedef unsigned long JET_VTID; /* Received from dispatcher */
+
+JET_ERR JET_API JetAllocateTableid(JET_SESID sesid, JET_TABLEID _far *ptableid, JET_VTID vtid, const struct tagVTFNDEF _far *pvtfndef, JET_VSESID vsesid);
+
+JET_ERR JET_API JetUpdateTableid(JET_SESID sesid, JET_TABLEID tableid, JET_VTID vtid, const struct tagVTFNDEF _far *pvtfndef);
+
+JET_ERR JET_API JetReleaseTableid(JET_SESID sesid, JET_TABLEID tableid);
+
+JET_ERR JET_API JetOpenTempTable(JET_SESID sesid,
+ const JET_COLUMNDEF _far *prgcolumndef, unsigned long ccolumn,
+ JET_GRBIT grbit, JET_TABLEID _far *ptableid,
+ JET_COLUMNID _far *prgcolumnid);
+
+
+/***************************************************************************
+
+ MISC JET API
+
+****************************************************************************/
+
+JET_ERR JET_API JetStringCompare(char _far *pb1, unsigned long cb1,
+ char _far *pb2, unsigned long cb2, unsigned long sort,
+ long _far *plResult);
+
+/***************************************************************************
+
+ ADDITIONAL JET BLUE API
+
+****************************************************************************/
+JET_ERR JET_API JetBackup( const char _far *szBackupPath, JET_GRBIT grbit );
+JET_ERR JET_API JetRestore(const char _far *sz, int crstmap, JET_RSTMAP *rgrstmap, JET_PFNSTATUS pfn );
+JET_ERR JET_API JetSetIndexRange(JET_SESID sesid,
+ JET_TABLEID tableidSrc, JET_GRBIT grbit);
+JET_ERR JET_API JetIndexRecordCount(JET_SESID sesid,
+ JET_TABLEID tableid, unsigned long _far *pcrec, unsigned long crecMax );
+JET_ERR JET_API JetRetrieveKey(JET_SESID sesid,
+ JET_TABLEID tableid, void _far *pvData, unsigned long cbMax,
+ unsigned long _far *pcbActual, JET_GRBIT grbit );
+
+#ifdef JETSER
+JET_ERR JET_API JetGetChecksum( JET_SESID sesid,
+ JET_TABLEID tableid, unsigned long _far *pulChecksum );
+JET_ERR JET_API JetGetObjidFromName(JET_SESID sesid,
+ JET_DBID dbid, const char _far *szContainerName,
+ const char _far *szObjectName,
+ unsigned long _far *pulObjectId );
+#endif
+
+#endif /* _JET_NOPROTOTYPES */
+
+#undef _far
+
+#pragma pack()
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _JET_INCLUDED */
+
+#endif __JET500
diff --git a/private/inc/jet500.h b/private/inc/jet500.h
new file mode 100644
index 000000000..e1faac33b
--- /dev/null
+++ b/private/inc/jet500.h
@@ -0,0 +1,1807 @@
+#if !defined(_JET_INCLUDED)
+#define _JET_INCLUDED
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(_M_ALPHA)
+#pragma pack(8)
+#else
+#pragma pack(4)
+#endif
+
+#define JET_API __stdcall
+#define JET_NODSAPI __stdcall
+
+typedef long JET_ERR;
+
+typedef unsigned long JET_INSTANCE; /* Instance Identifier */
+typedef unsigned long JET_SESID; /* Session Identifier */
+typedef unsigned long JET_TABLEID; /* Table Identifier */
+typedef unsigned long JET_COLUMNID; /* Column Identifier */
+
+typedef unsigned long JET_DBID; /* Database Identifier */
+typedef unsigned long JET_OBJTYP; /* Object Type */
+typedef unsigned long JET_COLTYP; /* Column Type */
+typedef unsigned long JET_GRBIT; /* Group of Bits */
+typedef unsigned long JET_ACM; /* Access Mask */
+typedef unsigned long JET_RNT; /* Repair Notification Type */
+
+typedef unsigned long JET_SNP; /* Status Notification Process */
+typedef unsigned long JET_SNT; /* Status Notification Type */
+typedef unsigned long JET_SNC; /* Status Notification Code */
+typedef double JET_DATESERIAL; /* JET_coltypDateTime format */
+typedef unsigned long JET_HANDLE; /* backup file handle */
+
+typedef JET_ERR (__stdcall *JET_PFNSTATUS)(JET_SESID sesid, JET_SNP snp, JET_SNT snt, void *pv);
+
+typedef struct tagCONVERT
+ {
+ char *szOldDll;
+ char *szOldSysDb;
+ unsigned long fDbAttached; // Return value indicating if Db was attached
+ } JET_CONVERT;
+
+
+typedef enum
+ {
+ opDBUTILConsistency,
+ opDBUTILDumpData,
+ opDBUTILDumpMetaData,
+ opDBUTILDumpSpace,
+ opDBUTILSetHeaderState,
+ opDBUTILDumpHeader,
+ opDBUTILDumpLogfile,
+ opDBUTILDumpCheckpoint
+ } DBUTIL_OP;
+
+typedef struct tagDBUTIL
+ {
+ unsigned long cbStruct;
+ char *szDatabase;
+ char *szTable;
+ char *szIndex;
+ DBUTIL_OP op;
+ JET_GRBIT grbitOptions;
+ } JET_DBUTIL;
+
+#define JET_bitDBUtilOptionAllNodes 0x00000001
+#define JET_bitDBUtilOptionKeyStats 0x00000002
+#define JET_bitDBUtilOptionPageDump 0x00000004
+#define JET_bitDBUtilOptionDumpVerbose 0x10000000 // DEBUG only
+#define JET_bitDBUtilOptionCheckBTree 0x20000000 // DEBUG only
+
+
+ /* Session information bits */
+
+#define JET_bitCIMCommitted 0x00000001
+#define JET_bitCIMDirty 0x00000002
+#define JET_bitAggregateTransaction 0x00000008
+
+ /* JetGetLastErrorInfo structure */
+
+typedef struct
+ {
+ unsigned long cbStruct; /* Size of this structure */
+ JET_ERR err; /* Extended error code (if any) */
+ unsigned long ul1; /* First general purpose integer */
+ unsigned long ul2; /* Second general purpose integer */
+ unsigned long ul3; /* Third general purpose integer */
+ } JET_EXTERR;
+
+ /* Status Notification Structures */
+
+typedef struct /* Status Notification Progress */
+ {
+ unsigned long cbStruct; /* Size of this structure */
+ unsigned long cunitDone; /* Number of units of work completed */
+ unsigned long cunitTotal; /* Total number of units of work */
+ } JET_SNPROG;
+
+ /* ErrCount Notification Structures */
+
+typedef struct /* Status Notification Progress */
+ {
+ unsigned long cbStruct; /* Size of this structure */
+ unsigned long cRecUniqueKeyViolation;
+ unsigned long cRecTypeConversionFail;
+ unsigned long cRecRecordLocked;
+ unsigned long cRecTotal; /* Total number of units of work */
+ } JET_SNERRCNT;
+
+
+typedef struct /* Status Notification Message */
+ {
+ unsigned long cbStruct; /* Size of this structure */
+ JET_SNC snc; /* Status Notification Code */
+ unsigned long ul; /* Numeric identifier */
+ char sz[256]; /* Identifier */
+ } JET_SNMSG;
+
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_OBJTYP objtyp;
+ JET_DATESERIAL dtCreate;
+ JET_DATESERIAL dtUpdate;
+ JET_GRBIT grbit;
+ unsigned long flags;
+ unsigned long cRecord;
+ unsigned long cPage;
+ } JET_OBJECTINFO;
+
+
+/* required for Exchange to make RSTMAP RPC capable
+/**/
+#ifdef MIDL_PASS
+#define RPC_STRING [string]
+#else
+#define RPC_STRING
+typedef unsigned short WCHAR;
+#endif
+
+typedef struct
+ {
+ RPC_STRING char *szDatabaseName;
+ RPC_STRING char *szNewDatabaseName;
+ } JET_RSTMAP; /* restore map */
+
+/* required for Exchange unicode support
+/**/
+#define UNICODE_RSTMAP
+
+typedef struct tagJET_RSTMAPW {
+ RPC_STRING WCHAR *wszDatabaseName;
+
+ RPC_STRING WCHAR *wszNewDatabaseName;
+ } JET_RSTMAPW, *PJET_RSTMAPW;
+
+ /* The following flags appear in the grbit field above */
+
+#define JET_bitTableInfoUpdatable 0x00000001
+#define JET_bitTableInfoBookmark 0x00000002
+#define JET_bitTableInfoRollback 0x00000004
+#define JET_bitTableInfoRestartable 0x00000008
+#define JET_bitTableInfoNoInserts 0x00000010
+
+ /* The following flags occur in the flags field above */
+
+#define JET_bitSaveUIDnPWD 0x20000000 /* this bit is only */
+ /* appropriate for rmt links */
+#define JET_bitObjectExclusive 0x40000000 /* Open link exclusively */
+#define JET_bitObjectSystem 0x80000000
+
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_TABLEID tableid;
+ unsigned long cRecord;
+ JET_COLUMNID columnidcontainername;
+ JET_COLUMNID columnidobjectname;
+ JET_COLUMNID columnidobjtyp;
+ JET_COLUMNID columniddtCreate;
+ JET_COLUMNID columniddtUpdate;
+ JET_COLUMNID columnidgrbit;
+ JET_COLUMNID columnidflags;
+ JET_COLUMNID columnidcRecord; /* Level 2 info */
+ JET_COLUMNID columnidcPage; /* Level 2 info */
+ } JET_OBJECTLIST;
+
+#define cObjectInfoCols 9
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_TABLEID tableid;
+ unsigned long cRecord;
+ JET_COLUMNID columnidSid;
+ JET_COLUMNID columnidACM;
+ JET_COLUMNID columnidgrbit; /* grbit from JetSetAccess */
+ } JET_OBJECTACMLIST;
+
+#define cObjectAcmCols 3
+
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_TABLEID tableid;
+ unsigned long cRecord;
+ JET_COLUMNID columnidPresentationOrder;
+ JET_COLUMNID columnidcolumnname;
+ JET_COLUMNID columnidcolumnid;
+ JET_COLUMNID columnidcoltyp;
+ JET_COLUMNID columnidCountry;
+ JET_COLUMNID columnidLangid;
+ JET_COLUMNID columnidCp;
+ JET_COLUMNID columnidCollate;
+ JET_COLUMNID columnidcbMax;
+ JET_COLUMNID columnidgrbit;
+ JET_COLUMNID columnidDefault;
+ JET_COLUMNID columnidBaseTableName;
+ JET_COLUMNID columnidBaseColumnName;
+ JET_COLUMNID columnidDefinitionName;
+ } JET_COLUMNLIST;
+
+#define cColumnInfoCols 14
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_COLUMNID columnid;
+ JET_COLTYP coltyp;
+ unsigned short wCountry;
+ unsigned short langid;
+ unsigned short cp;
+ unsigned short wCollate; /* Must be 0 */
+ unsigned long cbMax;
+ JET_GRBIT grbit;
+ } JET_COLUMNDEF;
+
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_COLUMNID columnid;
+ JET_COLTYP coltyp;
+ unsigned short wCountry;
+ unsigned short langid;
+ unsigned short cp;
+ unsigned short wFiller; /* Must be 0 */
+ unsigned long cbMax;
+ JET_GRBIT grbit;
+ char szBaseTableName[256];
+ char szBaseColumnName[256];
+ } JET_COLUMNBASE;
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_TABLEID tableid;
+ unsigned long cRecord;
+ JET_COLUMNID columnidindexname;
+ JET_COLUMNID columnidgrbitIndex;
+ JET_COLUMNID columnidcKey;
+ JET_COLUMNID columnidcEntry;
+ JET_COLUMNID columnidcPage;
+ JET_COLUMNID columnidcColumn;
+ JET_COLUMNID columnidiColumn;
+ JET_COLUMNID columnidcolumnid;
+ JET_COLUMNID columnidcoltyp;
+ JET_COLUMNID columnidCountry;
+ JET_COLUMNID columnidLangid;
+ JET_COLUMNID columnidCp;
+ JET_COLUMNID columnidCollate;
+ JET_COLUMNID columnidgrbitColumn;
+ JET_COLUMNID columnidcolumnname;
+ } JET_INDEXLIST;
+
+
+
+typedef struct tag_JET_COLUMNCREATE
+ {
+ unsigned long cbStruct; // size of this structure (for future expansion)
+ char *szColumnName; // column name
+ JET_COLTYP coltyp; // column type
+ unsigned long cbMax; // the maximum length of this column (only relevant for binary and text columns)
+ JET_GRBIT grbit; // column options
+ void *pvDefault; // default value (NULL if none)
+ unsigned long cbDefault; // length of default value
+ unsigned long cp; // code page (for text columns only)
+ JET_COLUMNID columnid; // returned column id
+ JET_ERR err; // returned error code
+ } JET_COLUMNCREATE;
+
+
+typedef struct tagJET_INDEXCREATE
+ {
+ unsigned long cbStruct; // size of this structure (for future expansion)
+ char *szIndexName; // index name
+ char *szKey; // index key
+ unsigned long cbKey; // length of key
+ JET_GRBIT grbit; // index options
+ unsigned long ulDensity; // index density
+ JET_ERR err; // returned error code
+ } JET_INDEXCREATE;
+
+
+typedef struct tagJET_TABLECREATE
+ {
+ unsigned long cbStruct; // size of this structure (for future expansion)
+ char *szTableName; // name of table to create.
+ unsigned long ulPages; // initial pages to allocate for table.
+ unsigned long ulDensity; // table density.
+ JET_COLUMNCREATE *rgcolumncreate; // array of column creation info
+ unsigned long cColumns; // number of columns to create
+ JET_INDEXCREATE *rgindexcreate; // array of index creation info
+ unsigned long cIndexes; // number of indexes to create
+ JET_GRBIT grbit; // Abort column/index creation on error?
+ JET_TABLEID tableid; // returned tableid.
+ unsigned long cCreated; // count of objects created (columns+table+indexes).
+ } JET_TABLECREATE;
+
+
+#define cIndexInfoCols 15
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_TABLEID tableid;
+ unsigned long cRecord;
+ JET_COLUMNID columnidReferenceName;
+ JET_COLUMNID columnidgrbit;
+ JET_COLUMNID columnidcColumn;
+ JET_COLUMNID columnidiColumn;
+ JET_COLUMNID columnidReferencingTableName;
+ JET_COLUMNID columnidReferencingColumnName;
+ JET_COLUMNID columnidReferencedTableName;
+ JET_COLUMNID columnidReferencedColumnName;
+ } JET_RELATIONSHIPLIST;
+
+/* for backward compatibility */
+typedef JET_RELATIONSHIPLIST JET_REFERENCELIST;
+
+#define cReferenceInfoCols 8
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ unsigned long ibLongValue;
+ unsigned long itagSequence;
+ JET_COLUMNID columnidNextTagged;
+ } JET_RETINFO;
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ unsigned long ibLongValue;
+ unsigned long itagSequence;
+ } JET_SETINFO;
+
+typedef struct
+ {
+ unsigned long cbStruct;
+ unsigned long centriesLT;
+ unsigned long centriesInRange;
+ unsigned long centriesTotal;
+ } JET_RECPOS;
+
+typedef struct
+ {
+ unsigned long cDiscont;
+ unsigned long cUnfixedMessyPage;
+ unsigned long centriesLT;
+ unsigned long centriesTotal;
+ unsigned long cpgCompactFreed;
+ } JET_OLCSTAT;
+
+typedef struct
+ {
+ unsigned long ctableid;
+ JET_TABLEID rgtableid[1];
+ } JET_MGBLIST;
+
+/*** Property Manager Structure ***/
+typedef struct
+ {
+ unsigned long cbStruct;
+ JET_TABLEID tableid;
+ JET_COLUMNID columnidColumnName;
+ JET_COLUMNID columnidPropertyName;
+ JET_COLUMNID columnidGrbit;
+ JET_COLUMNID columnidPropertyValue;
+ JET_COLUMNID columnidColtyp;
+ } JET_PROPERTYLIST;
+
+
+/************************************************************************/
+/************************* JET CONSTANTS ************************/
+/************************************************************************/
+
+#define JET_tableidNil ((JET_TABLEID) 0xFFFFFFFF)
+
+#define JET_sesidNil ((JET_SESID) 0xFFFFFFFF)
+
+ /* Max size of a bookmark */
+
+#define JET_cbBookmarkMost 4
+
+ /* Max length of a object/column/index/property name */
+
+#define JET_cbNameMost 64
+
+ /* Max length of a "name.name.name..." construct */
+
+#define JET_cbFullNameMost 255
+
+ /* Max size of long-value column chunk */
+
+#define JET_cbColumnLVChunkMost 4035
+
+ /* Max size of non-long-value column data */
+
+#define JET_cbColumnMost 255
+
+ /* Max size of a sort/index key */
+
+#define JET_cbKeyMost 255
+
+ /* Max number of components in a sort/index key */
+
+#define JET_ccolKeyMost 12
+
+ /* Max number of columns in a table/query */
+
+#define JET_ccolTableMost 255
+
+ /* Max Length of a property in the property manager */
+#define JET_cbPropertyMost 2048
+
+ /* Largest initial substring of a long value used in an expression */
+
+#define JET_cbExprLVMost 0x8000L /*** 32 K ***/
+
+ /* Max size of returned (from SQLDriverConnect) conn string */
+
+#define JET_cbConnectMost 255
+
+ /* Max number of levels in an MGB */
+
+#define JET_wGroupLevelMax 12
+
+ /* Size restrictions for Pins */
+#define JET_cchPINMax 20
+#define JET_cchPINMin 4
+
+ /* System parameter codes for JetSetSystemParameter */
+
+/* not supported */
+#define JET_paramPfnStatus 2 /* Status callback function */
+#define JET_paramPfnError 3 /* Error callback function */
+#define JET_paramHwndODBC 4 /* Window handle for ODBC use */
+#define JET_paramIniPath 5 /* Path to the ini file */
+#define JET_paramPageTimeout 6 /* Red ISAM page timeout value */
+#define JET_paramODBCQueryTimeout 7 /* ODBC async query timeout value */
+#define JET_paramODBCLoginTimeout 25 /* ODBC connection attempt timeout value */
+#define JET_paramExprObject 26 /* Expression Evaluation callback */
+#define JET_paramGetTypeComp 27 /* Expression Evaluation callback */
+#define JET_paramHostVersion 28 /* Host Version callback */
+#define JET_paramSQLTraceMode 29 /* Enable/disable SQL tracing */
+#define JET_paramEventId 46 /* NT event id */
+#define JET_paramEventCategory 47 /* NT event category */
+#define JET_paramRmtXactIsolation 39 /* Do not share connections with other sessions */
+#define JET_paramJetInternal 35 /* Whether internal to JET; if set, allows ISAM to do things which are prevented in general */
+#define JET_paramFullQJet 38 /* Allow full QJet functionality */
+
+#define JET_paramLogFlushThreshold 18 /* log buffer flush threshold in 512 bytes [10] */
+#define JET_paramLogFlushPeriod 22 /* log flush period in miliseconds [45] */
+
+#define JET_paramOnLineCompact 37 /* Options for compact pages on-line */
+#define JET_paramRecovery 30 /* Switch for log on/off */
+
+/* debug only not supported */
+#define JET_paramTransactionLevel 32 /* Transaction level of session */
+#define JET_paramAssertAction 44 /* debug only determines action on assert */
+#define JET_paramPrintFunction 49 /* debug only. synched print function */
+#define JET_paramRFS2IOsPermitted 54 /* # IOs permitted to succeed (-1 = all) */
+#define JET_paramRFS2AllocsPermitted 55 /* # allocs permitted to success (-1 = all) */
+
+/* fully supported parameters */
+/* Note that one page = 4kBytes.
+/**/
+#define JET_paramSysDbPath 0 /* path to the system database (defunct) ["<base name>.<base ext>"] */
+#define JET_paramSystemPath 0 /* path to check point file ["."] */
+#define JET_paramTempPath 1 /* path to the temporary database ["."] */
+#define JET_paramMaxBuffers 8 /* maximum page cache size in pages [512] */
+#define JET_paramMaxSessions 9 /* maximum number of sessions [128] */
+#define JET_paramMaxOpenTables 10 /* maximum number of open tables [300] */
+#define JET_paramPreferredMaxOpenTables 59 /* prefered maximum number of open tables [300] */
+#define JET_paramMaxVerPages 11 /* maximum version store size in 16KB buckets [64] */
+#define JET_paramMaxCursors 12 /* maximum number of open cursors [1024] */
+#define JET_paramLogFilePath 13 /* path to the log file directory ["."] */
+#define JET_paramMaxOpenTableIndexes 14 /* maximum open table indexes [300] */
+#define JET_paramMaxTemporaryTables 15 /* maximum concurrent JetCreateIndex [20] */
+#define JET_paramLogBuffers 16 /* maximum log buffers in 512 bytes [21] */
+#define JET_paramLogFileSize 17 /* maximum log file size in kBytes [5120] */
+#define JET_paramBfThrshldLowPrcnt 19 /* low percentage clean buffer flush start [20] */
+#define JET_paramBfThrshldHighPrcnt 20 /* high percentage clean buffer flush stop [80] */
+#define JET_paramWaitLogFlush 21 /* log flush wait time in milliseconds [15] */
+#define JET_paramLogCheckpointPeriod 23 /* checkpoint period in 512 bytes [1024] */
+#define JET_paramLogWaitingUserMax 24 /* maximum sessions waiting log flush [3] */
+#define JET_paramSessionInfo 33 /* per session information [0] */
+#define JET_paramPageFragment 34 /* maximum disk extent considered fragment in pages [8] */
+#define JET_paramMaxOpenDatabases 36 /* maximum number of open databases [100] */
+#define JET_paramBufBatchIOMax 41 /* maximum batch IO in pages [64] */
+#define JET_paramPageReadAheadMax 42 /* maximum read-ahead IO in pages [20] */
+#define JET_paramAsynchIOMax 43 /* maximum asynchronous IO in pages [64] */
+#define JET_paramEventSource 45 /* language independant process descriptor string [""] */
+#define JET_paramDbExtensionSize 48 /* database extension size in pages [16] */
+#define JET_paramCommitDefault 50 /* default grbit for JetCommitTransaction [0] */
+#define JET_paramBufLogGenAgeThreshold 51 /* age threshold in log files [2] */
+#define JET_paramCircularLog 52 /* boolean flag for circular logging [0] */
+#define JET_paramPageTempDBMin 53 /* minimum size temporary database in pages [0] */
+#define JET_paramBaseName 56 /* base name for all DBMS object names ["edb"] */
+#define JET_paramBaseExtension 57 /* base extension for all DBMS object names ["edb"] */
+#define JET_paramTableClassName 58 /* table stats class name (class #, string) */
+
+ /* Flags for JetTerm2 */
+
+#define JET_bitTermComplete 0x00000001
+#define JET_bitTermAbrupt 0x00000002
+
+ /* Flags for JetIdle */
+
+#define JET_bitIdleRemoveReadLocks 0x00000001
+#define JET_bitIdleFlushBuffers 0x00000002
+#define JET_bitIdleCompact 0x00000004
+#define JET_bitIdleStatus 0x80000000
+
+ /* Flags for JetEndSession */
+
+#define JET_bitForceSessionClosed 0x00000001
+
+ /* Flags for JetOpenDatabase */
+
+#define JET_bitDbReadOnly 0x00000001
+#define JET_bitDbExclusive 0x00000002 /* multiple opens allowed */
+#define JET_bitDbRemoteSilent 0x00000004
+#define JET_bitDbSingleExclusive 0x00000008 /* opened exactly once */
+
+ /* Flags for JetCloseDatabase */
+
+#define JET_bitDbForceClose 0x00000001
+
+ /* Flags for JetCreateDatabase */
+
+#define JET_bitDbVersion10 0x00000002 /* INTERNAL USE ONLY */
+#define JET_bitDbVersion1x 0x00000004
+#define JET_bitDbRecoveryOff 0x00000008 /* disable logging/recovery for this database */
+#define JET_bitDbNoLogging JET_bitDbRecoveryOff
+#define JET_bitDbCompleteConnstr 0x00000020
+#define JET_bitDbVersioningOff 0x00000040
+
+ /* Flags for JetBackup */
+
+#define JET_bitBackupIncremental 0x00000001
+#define JET_bitKeepOldLogs 0x00000002
+#define JET_bitBackupAtomic 0x00000004
+
+ /* Database types */
+
+#define JET_dbidNil ((JET_DBID) 0xFFFFFFFF)
+#define JET_dbidNoValid ((JET_DBID) 0xFFFFFFFE) /* used as a flag to indicate that there is no valid dbid */
+
+ /* Flags for JetCreateLink */
+
+/* Can use JET_bitObjectExclusive to cause linked to database to be opened */
+/* exclusively. */
+
+
+
+ /* Flags for JetCreateTableColumnIndex */
+#define JET_bitTableCreateCheckColumnNames 0x00000001 /* Ensures that each column
+ /* specified in the JET_COLUMNCREATE
+ /* array has a unique name
+ /* (for performance reasons,
+ /* the default is to NOT perform
+ /* this check and rely on the
+ /* function caller to ensure
+ /* column name uniqueness).
+ /**/
+#define JET_bitTableCreateCompaction 0x40000000 /* Internal grbit used when
+ /* creating a table during
+ /* off-line compact.
+ /**/
+#define JET_bitTableCreateSystemTable 0x80000000 /* Internal grbit used when
+ /* creating system tables.
+ /**/
+
+
+ /* Flags for JetAddColumn, JetGetColumnInfo, JetOpenTempTable */
+
+#define JET_bitColumnFixed 0x00000001
+#define JET_bitColumnTagged 0x00000002
+#define JET_bitColumnNotNULL 0x00000004
+#define JET_bitColumnVersion 0x00000008
+#define JET_bitColumnAutoincrement 0x00000010
+#define JET_bitColumnUpdatable 0x00000020 /* JetGetColumnInfo only */
+#define JET_bitColumnTTKey 0x00000040 /* JetOpenTempTable only */
+#define JET_bitColumnTTDescending 0x00000080 /* JetOpenTempTable only */
+#define JET_bitColumnNotLast 0x00000100 /* Installable ISAM option */
+#define JET_bitColumnRmtGraphic 0x00000200 /* JetGetColumnInfo */
+#define JET_bitColumnMultiValued 0x00000400
+#define JET_bitColumnColumnGUID 0x00000800
+#define JET_bitColumnMostMany 0x00001000
+#define JET_bitColumnPreventDelete 0x00002000
+
+ /* Flags for JetSetCurrentIndex */
+
+#define JET_bitMoveFirst 0x00000000
+#define JET_bitMoveBeforeFirst 0x00000001
+#define JET_bitNoMove 0x00000002
+
+ /* Flags for JetMakeKey */
+
+#define JET_bitNewKey 0x00000001
+#define JET_bitStrLimit 0x00000002
+#define JET_bitSubStrLimit 0x00000004
+#define JET_bitNormalizedKey 0x00000008
+#define JET_bitKeyDataZeroLength 0x00000010
+
+#ifdef DBCS /* johnta: LIKE "ABC" not converted to ="ABC" for Japanese */
+#define JET_bitLikeExtra1 0x00000020
+#endif /* DBCS */
+
+ /* Flags for ErrDispSetIndexRange */
+
+#define JET_bitRangeInclusive 0x00000001
+#define JET_bitRangeUpperLimit 0x00000002
+#define JET_bitRangeInstantDuration 0x00000004
+#define JET_bitRangeRemove 0x00000008
+
+ /* Constants for JetMove */
+
+#define JET_MoveFirst (0x80000000)
+#define JET_MovePrevious (-1)
+#define JET_MoveNext (+1)
+#define JET_MoveLast (0x7fffffff)
+
+ /* Flags for JetMove */
+
+#define JET_bitMoveKeyNE 0x00000001
+#define JET_bitMoveCheckTS 0x00000002
+#define JET_bitMoveInPage 0x00000004
+
+ /* Flags for JetSeek */
+
+#define JET_bitSeekEQ 0x00000001
+#define JET_bitSeekLT 0x00000002
+#define JET_bitSeekLE 0x00000004
+#define JET_bitSeekGE 0x00000008
+#define JET_bitSeekGT 0x00000010
+#define JET_bitSetIndexRange 0x00000020
+
+ /* Flags for JetFastFind */
+
+#define JET_bitFFindBackwards 0x00000001
+#define JET_bitFFindFromCursor 0x00000004
+
+ /* Flags for JetCreateIndex */
+
+#define JET_bitIndexUnique 0x00000001
+#define JET_bitIndexPrimary 0x00000002
+#define JET_bitIndexDisallowNull 0x00000004
+#define JET_bitIndexIgnoreNull 0x00000008
+#define JET_bitIndexClustered 0x00000010
+#define JET_bitIndexIgnoreAnyNull 0x00000020
+#define JET_bitIndexIgnoreFirstNull 0x00000040
+#define JET_bitIndexLazyFlush 0x00000080
+#define JET_bitIndexEmptyTable 0x40000000 // Internal use only
+#define JET_bitIndexReference 0x80000000 /* IndexInfo only */
+
+ /* Flags for index key definition */
+
+#define JET_bitKeyAscending 0x00000000
+#define JET_bitKeyDescending 0x00000001
+
+
+ /* Flags for JetCreateRelationship */
+
+#define JET_bitRelationUnique 0x00000001
+#define JET_bitRelationDontEnforce 0x00000002
+#define JET_bitRelationInherited 0x00000004
+#define JET_bitRelationTestLegal 0x00000008 /* don't create relationship */
+
+#define JET_bitRelationshipMatchMask 0x000000F0
+#define JET_bitRelationMatchDefault 0x00000000
+#define JET_bitRelationMatchFull 0x00000010
+
+#define JET_bitRelationUpdateActionMask 0x00000F00
+#define JET_bitRelationUpdateDisallow 0x00000000
+#define JET_bitRelationUpdateCascade 0x00000100
+#define JET_bitRelationUpdateSetNull 0x00000200
+#define JET_bitRelationUpdateSetDefault 0x00000300
+
+#define JET_bitRelationDeleteActionMask 0x0000F000
+#define JET_bitRelationDeleteDisallow 0x00000000
+#define JET_bitRelationDeleteCascade 0x00001000
+#define JET_bitRelationDeleteSetNull 0x00002000
+#define JET_bitRelationDeleteSetDefault 0x00003000
+
+#define JET_bitRelationUserMask 0xFF000000 /* non-enforced values */
+#define JET_bitRelationJoinMask 0x03000000
+#define JET_bitRelationInner 0x00000000
+#define JET_bitRelationLeft 0x01000000
+#define JET_bitRelationRight 0x02000000
+
+
+ /* Flags for JetCreateReference/JetCreateRelationship */
+ /* NOTE: use the bitRelationship flags instead! */
+
+#define JET_ReferenceUnique JET_bitRelationUnique
+#define JET_ReferenceDontEnforce JET_bitRelationDontEnforce
+#define JET_ReferenceMatchTypeMask JET_bitRelationMatchMask
+#define JET_ReferenceMatchDefault JET_bitRelationMatchDefault
+#define JET_ReferenceMatchFull JET_bitRelationMatchFull
+#define JET_ReferenceUpdateActionMask JET_bitRelationUpdateActionMask
+#define JET_ReferenceUpdateDisallow JET_bitRelationUpdateDisallow
+#define JET_ReferenceUpdateCascade JET_bitRelationUpdateCascade
+#define JET_ReferenceUpdateSetNull JET_bitRelationUpdateSetNull
+#define JET_ReferenceUpdateSetDefault JET_bitRelationUpdateSetDefault
+#define JET_ReferenceDeleteActionMask JET_bitRelationDeleteActionMask
+#define JET_ReferenceDeleteDisallow JET_bitRelationDeleteDisallow
+#define JET_ReferenceDeleteCascade JET_bitRelationDeleteCascade
+#define JET_ReferenceDeleteSetNull JET_bitRelationDeleteSetNull
+#define JET_ReferenceDeleteSetDefault JET_bitRelationDeleteSetDefault
+
+
+ /* Flags for JetOpenTable */
+
+#define JET_bitTableDenyWrite 0x00000001
+#define JET_bitTableDenyRead 0x00000002
+#define JET_bitTableReadOnly 0x00000004
+#define JET_bitTableAppendOnly 0x00000008
+#define JET_bitTableUpdatable 0x00000010
+#define JET_bitTableScrollable 0x00000020
+#define JET_bitTableFixedSet 0x00000040 /* Fixed working set */
+#define JET_bitTableInconsistent 0x00000080
+#define JET_bitTableBulk 0x00000100
+#define JET_bitTableUsePrimaryIndex 0x00000200 /* Use with FixedSet */
+#define JET_bitTableSampleData 0x00000400
+#define JET_bitTableQuickBrowse 0x00000800 /* Bias optimizer toward index usage */
+#define JET_bitTableDDL 0x00001000 /* similar to JET_bitTableBulk, for DDL */
+#define JET_bitTablePassThrough 0x00002000 /* Remote DBs Only */
+#define JET_bitTableRowReturning 0x00004000
+#define JET_bitTableSequential 0x00008000 /* Intend to access table sequentially */
+
+#define JET_bitTableClassMask 0x000F0000 /* table stats class mask */
+#define JET_bitTableClassNone 0x00000000 /* table belongs to no stats class (default) */
+#define JET_bitTableClass1 0x00010000 /* table belongs to stats class 1 */
+#define JET_bitTableClass2 0x00020000 /* table belongs to stats class 2 */
+#define JET_bitTableClass3 0x00030000 /* table belongs to stats class 3 */
+#define JET_bitTableClass4 0x00040000 /* table belongs to stats class 4 */
+#define JET_bitTableClass5 0x00050000 /* table belongs to stats class 5 */
+#define JET_bitTableClass6 0x00060000 /* table belongs to stats class 6 */
+#define JET_bitTableClass7 0x00070000 /* table belongs to stats class 7 */
+#define JET_bitTableClass8 0x00080000 /* table belongs to stats class 8 */
+#define JET_bitTableClass9 0x00090000 /* table belongs to stats class 9 */
+#define JET_bitTableClass10 0x000A0000 /* table belongs to stats class 10 */
+#define JET_bitTableClass11 0x000B0000 /* table belongs to stats class 11 */
+#define JET_bitTableClass12 0x000C0000 /* table belongs to stats class 12 */
+#define JET_bitTableClass13 0x000D0000 /* table belongs to stats class 13 */
+#define JET_bitTableClass14 0x000E0000 /* table belongs to stats class 14 */
+#define JET_bitTableClass15 0x000F0000 /* table belongs to stats class 15 */
+
+ /* Flags for JetSetQoSql/JetRetrieveQoSql */
+#define JET_bitSqlPassThrough 0x00000001 /* Pass through Query returning records */
+#define JET_bitSqlSPTBulkOp 0x00000002 /* SPT query returning no table */
+
+ /* Flags for JetOpenVtQbe */
+
+#define JET_bitQBEAddBrackets 0x00000001
+#define JET_bitQBERemoveEquals 0x00000002
+
+ /* Flags for JetOpenTempTable and ErrIsamOpenTempTable */
+
+#define JET_bitTTIndexed 0x00000001 /* Allow seek */
+#define JET_bitTTUnique 0x00000002 /* Remove duplicates */
+#define JET_bitTTUpdatable 0x00000004 /* Allow updates */
+#define JET_bitTTScrollable 0x00000008 /* Allow backwards scrolling */
+
+ /* Flags for JetSetColumn */
+
+#define JET_bitSetAppendLV 0x00000001
+#define JET_bitSetValidate 0x00000002
+#define JET_bitSetOverwriteLV 0x00000004 /* overwrite JET_coltypLong* byte range */
+#define JET_bitSetSizeLV 0x00000008 /* set JET_coltypLong* size */
+#define JET_bitSetValidateColumn 0x00000010
+#define JET_bitSetZeroLength 0x00000020
+#define JET_bitSetSeparateLV 0x00000040 /* force LV separation */
+#define JET_bitSetNoVersion 0x00000080 /* INTERNAL USE ONLY */
+
+ /* Set column parameter structure for JetSetColumns */
+
+typedef struct {
+ JET_COLUMNID columnid;
+ const void *pvData;
+ unsigned long cbData;
+ JET_GRBIT grbit;
+ unsigned long ibLongValue;
+ unsigned long itagSequence;
+ JET_ERR err;
+} JET_SETCOLUMN;
+
+ /* Options for JetPrepareUpdate */
+
+#define JET_prepInsert 0
+#define JET_prepInsertBeforeCurrent 1
+#define JET_prepReplace 2
+#define JET_prepCancel 3
+#define JET_prepReplaceNoLock 4
+#define JET_prepInsertCopy 5
+
+ /* Flags for JetRetrieveColumn */
+
+#define JET_bitRetrieveCopy 0x00000001
+#define JET_bitRetrieveFromIndex 0x00000002
+#define JET_bitRetrieveCase 0x00000004
+#define JET_bitRetrieveTag 0x00000008
+#define JET_bitRetrieveNull 0x00000010 /* for columnid 0 only */
+#define JET_bitRetrieveIgnoreDefault 0x00000020 /* for columnid 0 only */
+#define JET_bitRetrieveLongId 0x00000040
+#define JET_bitRetrieveRecord 0x80000000
+#define JET_bitRetrieveFDB 0x40000000
+#define JET_bitRetrieveBookmarks 0x20000000
+
+ /* Retrieve column parameter structure for JetRetrieveColumns */
+
+typedef struct {
+ JET_COLUMNID columnid;
+ void *pvData;
+ unsigned long cbData;
+ unsigned long cbActual;
+ JET_GRBIT grbit;
+ unsigned long ibLongValue;
+ unsigned long itagSequence;
+ JET_COLUMNID columnidNextTagged;
+ JET_ERR err;
+} JET_RETRIEVECOLUMN;
+
+ /* Flags for JetFillFatCursor */
+
+#define JET_bitFCFillRange 0x00000001
+#define JET_bitFCRefreshRange 0x00000002
+#define JET_bitFCFillMemos 0x00000004
+
+ /* Flags for JetCommitTransaction */
+
+#define JET_bitCommitFlush 0x00000001 /* commit and flush page buffers. */
+#define JET_bitCommitLazyFlush 0x00000004 /* lazy flush log buffers. */
+#define JET_bitWaitLastLevel0Commit 0x00000010 /* wait for last level 0 commit record flushed */
+
+ /* Flags for JetRollback */
+
+#define JET_bitRollbackAll 0x00000001
+
+ /* Flags for JetSetAccess and JetGetAccess */
+
+#define JET_bitACEInheritable 0x00000001
+
+ /* Flags for JetCreateSystemDatabase */
+
+#define JET_bitSysDbOverwrite 0x00000001
+
+ /* Flags for Jet Property Management */
+#define JET_bitPropDDL 0x00000001 /* also used for setting */
+#define JET_bitPropInherited 0x00000002 /* not used for setting */
+
+ /* JPM Flags that are only used for setting properties */
+#define JET_bitPropReplaceOnly 0x00000010
+#define JET_bitPropInsertOnly 0x00000020
+#define JET_bitPropDeleteOnly 0x00000040
+
+ /* InfoLevels for Jet Property Management */
+#define JET_PropertyValue 0
+#define JET_PropertyCount 1
+#define JET_PropertySingleCollection 2
+#define JET_PropertyAllCollections 3
+
+ /* Collate values for JetGetColumnInfo and JetGetIndexInfo */
+
+#define JET_sortBinary 0x0000
+#define JET_sortEFGPI 0x0100
+#define JET_sortSNIFD 0x0101
+#define JET_sortSpanish 0x0102
+#define JET_sortDutch 0x0103
+#define JET_sortSweFin 0x0104
+#define JET_sortNorDan 0x0105
+#define JET_sortIcelandic 0x0106
+#define JET_sortCyrillic 0x0107
+#define JET_sortCzech 0x0108
+#define JET_sortHungarian 0x0109
+#define JET_sortPolish 0x010A
+#define JET_sortArabic 0x010B
+#define JET_sortHebrew 0x010C
+#define JET_sortMax 0x010C /* Max for nonDBCS sort orders */
+
+#ifdef DBCS /* johnta: Add the new Japanese sorting order */
+#define JET_sortJapanese 0x010D
+#endif /* DBCS */
+
+#define JET_sortUnknown 0xFFFF
+
+ /* Paradox ISAM specific collate values */
+
+#define JET_sortPdxIntl 0x1000
+#define JET_sortPdxSwedFin 0x1001
+#define JET_sortPdxNorDan 0x1002
+
+ /* Info parameter for JetGetDatabaseInfo */
+
+#define JET_DbInfoFilename 0
+#define JET_DbInfoConnect 1
+#define JET_DbInfoCountry 2
+#define JET_DbInfoLangid 3
+#define JET_DbInfoCp 4
+#define JET_DbInfoCollate 5
+#define JET_DbInfoOptions 6
+#define JET_DbInfoTransactions 7
+#define JET_DbInfoVersion 8
+#define JET_DbInfoIsam 9
+#define JET_DbInfoFilesize 10
+#define JET_DbInfoSpaceOwned 11
+#define JET_DbInfoSpaceAvailable 12
+
+ /* Database versions returned by JetGetDatabaseInfo */
+
+#define JET_DbVersion10 0x00010000
+#define JET_DbVersion11 0x00010001
+#define JET_DbVersion20 0x00020000
+
+
+ /* Isam specific info returned by JetGetDatabaseInfo */
+
+#define JET_IsamInvalid 0
+#define JET_IsamBuiltinRed 1
+#define JET_IsamBuiltinBlue 2
+
+#define JET_IsamInstRed 21
+#define JET_IsamInstBlue 22
+#define JET_IsamInstFox 23
+#define JET_IsamInstParadox 24
+#define JET_IsamInstDbase 25
+#define JET_IsamInstBtrieve 26
+
+#define JET_IsamBuilinMost JET_BuiltinBlue
+#define JET_IsamInstMin JET_IsamInstRed
+#define JET_IsamInstMost JET_IsamInstBtrieve
+
+ /* Link specific info for link identification */
+#define JET_bitLinkInvalid 0x00000000
+#define JET_bitLinkRemote 0x00100000
+#define JET_bitLinkBuiltinRed 0x00200000
+#define JET_bitLinkBuiltinBlue 0x00300000
+#define JET_bitLinkInstRed 0x00400000
+#define JET_bitLinkInstBlue 0x00500000
+#define JET_bitLinkInstFox 0x00600000
+#define JET_bitLinkInstParadox 0x00700000
+#define JET_bitLinkInstDbase 0x00800000
+#define JET_bitLinkInstBtrieve 0x00900000
+
+#define JET_bitFourByteBookmark 0x00000001
+#define JET_bitContiguousBookmarks 0x00000002
+
+ /* Column data types */
+
+#define JET_coltypNil 0
+#define JET_coltypBit 1 /* True or False, Never NULL */
+#define JET_coltypUnsignedByte 2 /* 1-byte integer, unsigned */
+#define JET_coltypShort 3 /* 2-byte integer, signed */
+#define JET_coltypLong 4 /* 4-byte integer, signed */
+#define JET_coltypCurrency 5 /* 8 byte integer, signed */
+#define JET_coltypIEEESingle 6 /* 4-byte IEEE single precision */
+#define JET_coltypIEEEDouble 7 /* 8-byte IEEE double precision */
+#define JET_coltypDateTime 8 /* Integral date, fractional time */
+#define JET_coltypBinary 9 /* Binary data, < 255 bytes */
+#define JET_coltypText 10 /* ANSI text, case insensitive, < 255 bytes */
+#define JET_coltypLongBinary 11 /* Binary data, long value */
+#define JET_coltypLongText 12 /* ANSI text, long value */
+#define JET_coltypDatabase 13 /* Database name parameter */
+#define JET_coltypTableid 14 /* Tableid parameter */
+#define JET_coltypOLE 15 /* OLE blob */
+#define JET_coltypGUID 15
+#define JET_coltypMax 16 /* the number of column types */
+ /* used for validity tests and */
+ /* array declarations. */
+
+ /* Info levels for JetGetObjectInfo */
+
+#define JET_ObjInfo 0U
+#define JET_ObjInfoListNoStats 1U
+#define JET_ObjInfoList 2U
+#define JET_ObjInfoSysTabCursor 3U
+#define JET_ObjInfoListACM 4U /* Blocked by JetGetObjectInfo */
+#define JET_ObjInfoNoStats 5U
+#define JET_ObjInfoSysTabReadOnly 6U
+#define JET_ObjInfoRulesLoaded 7U
+#define JET_ObjInfoMax 8U
+
+ /* Info levels for JetGetTableInfo */
+
+#define JET_TblInfo 0U
+#define JET_TblInfoName 1U
+#define JET_TblInfoDbid 2U
+#define JET_TblInfoMostMany 3U
+#define JET_TblInfoRvt 4U
+#define JET_TblInfoOLC 5U
+#define JET_TblInfoResetOLC 6U
+#define JET_TblInfoSpaceUsage 7U
+#define JET_TblInfoDumpTable 8U
+#define JET_TblInfoSpaceAlloc 9U
+#define JET_TblInfoSpaceOwned 10U // OwnExt
+#define JET_TblInfoSpaceAvailable 11U // AvailExt
+
+ /* Info levels for JetGetIndexInfo and JetGetTableIndexInfo */
+
+#define JET_IdxInfo 0U
+#define JET_IdxInfoList 1U
+#define JET_IdxInfoSysTabCursor 2U
+#define JET_IdxInfoOLC 3U
+#define JET_IdxInfoResetOLC 4U
+#define JET_IdxInfoSpaceAlloc 5U
+#define JET_IdxInfoLangid 6U
+#define JET_IdxInfoCount 7U
+
+ /* Info levels for JetGetReferenceInfo and JetGetTableReferenceInfo */
+
+#define JET_ReferenceInfo 0U
+#define JET_ReferenceInfoReferencing 1U
+#define JET_ReferenceInfoReferenced 2U
+#define JET_ReferenceInfoAll 3U
+#define JET_ReferenceInfoCursor 4U
+
+ /* Info levels for JetGetColumnInfo and JetGetTableColumnInfo */
+
+#define JET_ColInfo 0U
+#define JET_ColInfoList 1U
+ /* CONSIDER: Info level 2 is valid */
+#define JET_ColInfoSysTabCursor 3U
+#define JET_ColInfoBase 4U
+#define JET_ColInfoListCompact 5U
+
+
+ /* Attribute types for query definitions */
+
+#define JET_qoaBeginDef 0
+#define JET_qoaOperation 1
+#define JET_qoaParameter 2
+#define JET_qoaOptions 3
+#define JET_qoaDatabase 4
+#define JET_qoaInputTable 5
+#define JET_qoaOutput 6
+#define JET_qoaJoin 7
+#define JET_qoaRestriction 8
+#define JET_qoaGroup 9
+#define JET_qoaGroupRstr 10
+#define JET_qoaOrdering 11
+#define JET_qoaEndDef 255
+#define JET_qoaValidLeast JET_qoaOperation
+#define JET_qoaValidMost JET_qoaOrdering
+
+
+ /* Query object options */
+
+#define JET_bitFqoOutputAllCols 0x0001
+#define JET_bitFqoRemoveDups 0x0002
+#define JET_bitFqoOwnerAccess 0x0004
+#define JET_bitFqoDistinctRow 0x0008
+#define JET_bitFqoTop 0x0010
+#define JET_bitFqoPercent 0x0020
+#define JET_bitFqoCorresponding 0x0040 /* JET_qopSetOperation */
+
+ /* Query object join type */
+
+#define JET_fjoinInner 1
+#define JET_fjoinLeftOuter 2
+#define JET_fjoinRightOuter 3
+
+ /* Query object operations */
+
+#define JET_qopSelect 1
+#define JET_qopSelectInto 2
+#define JET_qopInsertSelection 3
+#define JET_qopUpdate 4
+#define JET_qopDelete 5
+#define JET_qopTransform 6
+#define JET_qopDDL 7
+#define JET_qopSqlPassThrough 8
+#define JET_qopSetOperation 9
+#define JET_qopSPTBulk 10
+
+#define JET_bitqopSelect 0x0000
+#define JET_bitqopTransform 0x0010
+#define JET_bitqopDelete 0x0020
+#define JET_bitqopUpdate 0x0030
+#define JET_bitqopInsertSelection 0x0040
+#define JET_bitqopSelectInto 0x0050
+#define JET_bitqopDDL 0x0060
+#define JET_bitqopSqlPassThrough 0x0070
+#define JET_bitqopSetOperation 0x0080
+#define JET_bitqopSPTBulk 0x0090
+
+ /* Engine Object Types */
+
+#define JET_objtypNil 0
+#define JET_objtypTable 1
+#define JET_objtypDb 2
+#define JET_objtypContainer 3
+#define JET_objtypSQLLink 4
+#define JET_objtypQuery 5
+#define JET_objtypLink 6
+#define JET_objtypTemplate 7
+#define JET_objtypRelationship 8
+
+ /* All types less than JET_objtypClientMin are reserved by JET */
+
+#define JET_objtypClientMin 0x8000
+
+ /* Security Constant Values */
+
+#define JET_cchUserNameMax 20
+#define JET_cchPasswordMax 14
+
+ /* Security Access Masks */
+
+#define JET_acmNoAccess 0x00000000L
+#define JET_acmFullAccess 0x000FFFFFL
+
+#define JET_acmSpecificMask 0x0000FFFFL
+#define JET_acmSpecific_1 0x00000001L
+#define JET_acmSpecific_2 0x00000002L
+#define JET_acmSpecific_3 0x00000004L
+#define JET_acmSpecific_4 0x00000008L
+#define JET_acmSpecific_5 0x00000010L
+#define JET_acmSpecific_6 0x00000020L
+#define JET_acmSpecific_7 0x00000040L
+#define JET_acmSpecific_8 0x00000080L
+#define JET_acmSpecific_9 0x00000100L
+#define JET_acmSpecific_10 0x00000200L
+#define JET_acmSpecific_11 0x00000400L
+#define JET_acmSpecific_12 0x00000800L
+#define JET_acmSpecific_13 0x00001000L
+#define JET_acmSpecific_14 0x00002000L
+#define JET_acmSpecific_15 0x00004000L
+#define JET_acmSpecific_16 0x00008000L
+
+#define JET_acmStandardMask 0x00FF0000L
+#define JET_acmDelete 0x00010000L
+#define JET_acmReadControl 0x00020000L
+#define JET_acmWriteDac 0x00040000L
+#define JET_acmWriteOwner 0x00080000L
+
+#define JET_acmTblCreate (JET_acmSpecific_1)
+#define JET_acmTblAccessRcols (JET_acmSpecific_2)
+#define JET_acmTblReadDef (JET_acmSpecific_3)
+#define JET_acmTblWriteDef (JET_acmSpecific_4)
+#define JET_acmTblRetrieveData (JET_acmSpecific_5)
+#define JET_acmTblInsertData (JET_acmSpecific_6)
+#define JET_acmTblReplaceData (JET_acmSpecific_7)
+#define JET_acmTblDeleteData (JET_acmSpecific_8)
+
+#define JET_acmDbCreate (JET_acmSpecific_1)
+#define JET_acmDbOpen (JET_acmSpecific_2)
+
+ /* Compact Options */
+
+#define JET_bitCompactDontCopyLocale 0x00000004 /* Don't copy locale from source to dest */
+#define JET_bitCompactVersion10 0x00000008 /* Destination is version 1.0 format */
+#define JET_bitCompactVersion1x 0x00000010 /* Destination is version 1.x format */
+#define JET_bitCompactStats 0x00000020 /* Dump off-line compaction stats (only when progress meter also specified) */
+
+ /* On-line Compact Options */
+
+#define JET_bitCompactOn 0x00000001 /* enable on-line compaction */
+
+ /* Repair Notification Types */
+
+#define JET_rntSelfContained 0
+#define JET_rntDeletedIndex 1
+#define JET_rntDeletedRec 2
+#define JET_rntDeletedLv 3
+#define JET_rntTruncated 4
+
+ /* Status Notification Processes */
+
+#define JET_snpIndex 0
+#define JET_snpQuery 1
+#define JET_snpRepair 2
+#define JET_snpImex 3
+#define JET_snpCompact 4
+#define JET_snpFastFind 5
+#define JET_snpODBCNotReady 6
+#define JET_snpQuerySort 7
+#define JET_snpRestore 8
+#define JET_snpBackup 9
+#define JET_snpUpgrade 10
+
+ /* Status Notification Types */
+
+#define JET_sntProgress 0 /* callback for progress */
+#define JET_sntMessage 1
+#define JET_sntBulkRecords 2 /* callback for # rec for bulk op */
+#define JET_sntFail 3 /* callback for failure during progress */
+#define JET_sntErrCount 4 /* callback for err count */
+#define JET_sntBegin 5 /* callback for beginning of operation */
+#define JET_sntComplete 6 /* callback for completion of operation */
+#define JET_sntCantRollback 7 /* callback for no rollback */
+#define JET_sntRestoreMap 8 /* callback for restore map */
+
+ /* Message codes for JET_snpCompact */
+
+#define JET_sncCopyObject 0 /* Starting to copy object */
+#define JET_sncCopyFailed 1 /* Copy of this object failed */
+#define JET_sncYield 2 /* Client can yield/check for user interrupt */
+#define JET_sncTransactionFull 3 /* Client can yield/check for user interrupt */
+#define JET_sncAboutToWrap 4 /* Find find is about to wrap */
+
+ /* Message codes for JET_snpODBCNotReady */
+
+#define JET_sncODBCNotReady 0 /* Waiting for results from ODBC */
+
+
+ /* Constants for the [ODBC] section of JET.INI */
+
+#define JET_SQLTraceCanonical 0x0001 /* Output ODBC Generic SQL */
+
+ /* Constants for the [Debug] section of JET.INI */
+
+ /* APITrace */
+
+#define JET_APITraceEnter 0x0001
+#define JET_APITraceExit 0x0002
+#define JET_APITraceExitError 0x0004
+#define JET_APIBreakOnError 0x0008
+#define JET_APITraceCount 0x0010
+#define JET_APITraceNoIdle 0x0020
+#define JET_APITraceParameters 0x0040
+
+ /* IdleTrace */
+
+#define JET_IdleTraceCursor 0x0001
+#define JET_IdleTraceBuffer 0x0002
+#define JET_IdleTraceFlush 0x0004
+
+ /* AssertAction */
+
+#define JET_AssertExit 0x0000 /* Exit the application */
+#define JET_AssertBreak 0x0001 /* Break to debugger */
+#define JET_AssertMsgBox 0x0002 /* Display message box */
+#define JET_AssertStop 0x0004 /* Alert and stop */
+
+ /* IOTrace */
+
+#define JET_IOTraceAlloc 0x0001 /* DB Page Allocation */
+#define JET_IOTraceFree 0x0002 /* DB Page Free */
+#define JET_IOTraceRead 0x0004 /* DB Page Read */
+#define JET_IOTraceWrite 0x0008 /* DB Page Write */
+#define JET_IOTraceError 0x0010 /* DB Page I/O Error */
+
+ /* MemTrace */
+
+#define JET_MemTraceAlloc 0x0001 /* Memory allocation */
+#define JET_MemTraceRealloc 0x0002 /* Memory reallocation */
+#define JET_MemTraceFree 0x0004 /* Memory free */
+
+ /* RmtTrace */
+
+#define JET_RmtTraceError 0x0001 /* Remote server error message */
+#define JET_RmtTraceSql 0x0002 /* Remote SQL Prepares & Exec's */
+#define JET_RmtTraceAPI 0x0004 /* Remote ODBC API calls */
+#define JET_RmtTraceODBC 0x0008
+#define JET_RmtSyncODBC 0x0010 /* Turn on ODBC Sync mode */
+
+/**********************************************************************/
+/*********************** ERROR CODES **************************/
+/**********************************************************************/
+
+/* SUCCESS */
+
+#define JET_errSuccess 0 /* Successful Operation */
+
+/* ERRORS */
+
+#define JET_wrnNyi -1 /* Function Not Yet Implemented */
+
+/* SYSTEM errors
+/**/
+#define JET_errRfsFailure -100 /* JET_errRfsFailure */
+#define JET_errRfsNotArmed -101 /* JET_errRfsFailure */
+#define JET_errFileClose -102 /* Could not close DOS file */
+#define JET_errOutOfThreads -103 /* Could not start thread */
+#define JET_errTooManyIO -105 /* System busy due to too many IOs */
+#define JET_errDatabase200Format -106 /* 200 format database */
+#define JET_errDatabase400Format -107 /* 400 format database */
+
+/* BUFFER MANAGER errors
+/**/
+#define wrnBFNotSynchronous 200 /* Buffer page evicted */
+#define wrnBFPageNotFound 201 /* Page not found */
+#define errBFInUse -202 /* Cannot abandon buffer */
+#define wrnBFNewIO 203 /* Buffer access caused a new IO (cache miss) */
+#define wrnBFCacheMiss 204 /* Buffer access was a cache miss but didn't cause a new IO */
+#define wrnBFNoBufAvailable 205 /* Need to allocate new buffer for read (used in Async IO ) */
+
+/* DIRECTORY MANAGER errors
+/**/
+#define errPMOutOfPageSpace -300 /* Out of page space */
+#define errPMItagTooBig -301 /* Itag too big */
+#define errPMRecDeleted -302 /* Record deleted */
+#define errPMTagsUsedUp -303 /* Tags used up */
+#define wrnBMConflict 304 /* conflict in BM Clean up */
+#define errDIRNoShortCircuit -305 /* No Short Circuit Avail */
+#define errDIRCannotSplit -306 /* Cannot horizontally split FDP */
+#define errDIRTop -307 /* Cannot go up */
+#define errDIRFDP 308 /* On an FDP Node */
+#define errDIRNotSynchronous -309 /* May have left critical section */
+#define wrnDIREmptyPage 310 /* Moved through empty page */
+#define errSPConflict -311 /* Device extent being extended */
+#define wrnNDFoundLess 312 /* Found Less */
+#define wrnNDFoundGreater 313 /* Found Greater */
+#define errNDOutSonRange -314 /* Son out of range */
+#define errNDOutItemRange -315 /* Item out of range */
+#define errNDGreaterThanAllItems -316 /* Greater than all items */
+#define errNDLastItemNode -317 /* Last node of item list */
+#define errNDFirstItemNode -318 /* First node of item list */
+#define wrnNDDuplicateItem 319 /* Duplicated Item */
+#define errNDNoItem -320 /* Item not there */
+#define JET_wrnRemainingVersions 321 /* Some versions couldn't be cleaned */
+#define JET_wrnPreviousVersion 322 /* Version already existed */
+#define JET_errPageBoundary -323 /* Reached Page Boundary */
+#define JET_errKeyBoundary -324 /* Reached Key Boundary */
+#define errDIRInPageFather -325 /* sridFather in page to free */
+#define errBMMaxKeyInPage -326 /* used by OLC to avoid cleanup of parent pages */
+#define JET_errBadPageLink -327 /* next/previous page link page does not point back to source */
+#define JET_errBadBookmark -328 /* bookmark has no corresponding address in database */
+#define wrnBMCleanNullOp 329 /* BMClean returns this on encountering a page
+ /* deleted MaxKeyInPage [but there was no conflict]
+
+/* RECORD MANAGER errors
+/**/
+#define wrnFLDKeyTooBig 400 /* Key too big (truncated it) */
+#define errFLDTooManySegments -401 /* Too many key segments */
+#define wrnFLDNullKey 402 /* Key is entirely NULL */
+#define wrnFLDOutOfKeys 403 /* No more keys to extract */
+#define wrnFLDNullSeg 404 /* Null segment in key */
+#define wrnRECLongField 405 /* Separated long value */
+#define JET_wrnSeparateLongValue 406 /* Separated long value */
+#define JET_wrnRecordFoundGreater JET_wrnSeekNotEqual
+#define JET_wrnRecordFoundLess JET_wrnSeekNotEqual
+#define JET_errColumnIllegalNull JET_errNullInvalid
+#define wrnFLDNullFirstSeg 407 /* Null first segment in key */
+#define JET_errKeyTooBig -408 /* Key with column truncation still truncated */
+
+/* LOGGING/RECOVERY errors
+/**/
+#define JET_errInvalidLoggedOperation -500 /* Logged operation cannot be redone */
+#define JET_errLogFileCorrupt -501 /* Log file is corrupt */
+#define errLGNoMoreRecords -502 /* Last log record read */
+#define JET_errNoBackupDirectory -503 /* No backup directory given */
+#define JET_errBackupDirectoryNotEmpty -504 /* The backup directory is not emtpy */
+#define JET_errBackupInProgress -505 /* Backup is active already */
+#define JET_errMissingPreviousLogFile -509 /* Missing the log file for check point */
+#define JET_errLogWriteFail -510 /* Fail when writing to log file */
+#define JET_errBadLogVersion -514 /* Version of log file is not compatible with Jet version */
+#define JET_errInvalidLogSequence -515 /* Timestamp in next log does not match expected */
+#define JET_errLoggingDisabled -516 /* Log is not active */
+#define JET_errLogBufferTooSmall -517 /* Log buffer is too small for recovery */
+#define errLGNotSynchronous -518 /* retry to LGLogRec */
+#define JET_errLogSequenceEnd -519 /* Exceed maximum log file number */
+#define JET_errNoBackup -520 /* No backup in progress */
+#define JET_errInvalidBackupSequence -521 /* Backup call out of sequence */
+#define JET_errBackupNotAllowedYet -523 /* Can not do backup now */
+#define JET_errDeleteBackupFileFail -524 /* Could not delete backup file */
+#define JET_errMakeBackupDirectoryFail -525 /* Could not make backup temp directory */
+#define JET_errInvalidBackup -526 /* Cannot incremental backup when circular logging enabled */
+#define JET_errRecoveredWithErrors -527 /* For repair, restored with errors */
+#define JET_errMissingLogFile -528 /* current log file missing */
+#define JET_errLogDiskFull -529 /* log disk full */
+#define JET_errBadLogSignature -530 /* bad signature for a log file */
+#define JET_errBadDbSignature -531 /* bad signature for a db file */
+#define JET_errBadCheckpointSignature -532 /* bad signature for a checkpoint file */
+#define JET_errCheckpointCorrupt -533 /* checkpoint file not found or corrupt */
+#define JET_errMissingPatchPage -534 /* patch file page not found during recovery */
+
+
+#define JET_errDatabaseInconsistent -550 /* database is in inconsistent state */
+#define JET_errConsistentTimeMismatch -551 /* database last consistent time unmatched */
+#define JET_errDatabasePatchFileMismatch -552 /* patch file is not generated from this backup */
+#define JET_errEndingRestoreLogTooLow -553 /* the starting log number too low for the restore */
+#define JET_errStartingRestoreLogTooHigh -554 /* the starting log number too high for the restore */
+#define JET_errGivenLogFileHasBadSignature -555 /* Restore log file has bad signature */
+#define JET_errGivenLogFileIsNotContiguous -556 /* Restore log file is not contiguous */
+#define JET_errMissingRestoreLogFiles -557 /* Some restore log files are missing */
+#define JET_wrnExistingLogFileHasBadSignature 558 /* Existing log file has bad signature */
+#define JET_wrnExistingLogFileIsNotContiguous 559 /* Existing log file is not contiguous */
+#define JET_errMissingFullBackup -560 /* The database miss a previous full backup befor incremental backup */
+#define JET_errBadBackupDatabaseSize -561 /* The backup database size is not in 4k */
+#define JET_errDatabaseAlreadyUpgraded -562 /* Attempted to upgrade a database that is already current */
+
+#define JET_errTermInProgress -1000 /* Termination in progress */
+#define JET_errFeatureNotAvailable -1001 /* API not supported */
+#define JET_errInvalidName -1002 /* Invalid name */
+#define JET_errInvalidParameter -1003 /* Invalid API parameter */
+#define JET_wrnColumnNull 1004 /* Column is NULL-valued */
+#define JET_wrnBufferTruncated 1006 /* Buffer too small for data */
+#define JET_wrnDatabaseAttached 1007 /* Database is already attached */
+#define JET_errDatabaseFileReadOnly -1008 /* Attach a readonly database file for read/write operations */
+#define JET_wrnSortOverflow 1009 /* Sort does not fit in memory */
+#define JET_errInvalidDatabaseId -1010 /* Invalid database id */
+#define JET_errOutOfMemory -1011 /* Out of Memory */
+#define JET_errOutOfDatabaseSpace -1012 /* Maximum database size reached */
+#define JET_errOutOfCursors -1013 /* Out of table cursors */
+#define JET_errOutOfBuffers -1014 /* Out of database page buffers */
+#define JET_errTooManyIndexes -1015 /* Too many indexes */
+#define JET_errTooManyKeys -1016 /* Too many columns in an index */
+#define JET_errRecordDeleted -1017 /* Record has been deleted */
+#define JET_errReadVerifyFailure -1018 /* Read verification error */
+#define JET_errOutOfFileHandles -1020 /* Out of file handles */
+#define JET_errDiskIO -1022 /* Disk IO error */
+#define JET_errInvalidPath -1023 /* Invalid file path */
+#define JET_errRecordTooBig -1026 /* Record larger than maximum size */
+#define JET_errTooManyOpenDatabases -1027 /* Too many open databases */
+#define JET_errInvalidDatabase -1028 /* Not a database file */
+#define JET_errNotInitialized -1029 /* JetInit not yet called */
+#define JET_errAlreadyInitialized -1030 /* JetInit already called */
+#define JET_errFileAccessDenied -1032 /* Cannot access file */
+#define JET_errQueryNotSupported -1034 /* Query support unavailable */
+#define JET_errSQLLinkNotSupported -1035 /* SQL Link support unavailable */
+#define JET_errBufferTooSmall -1038 /* Buffer is too small */
+#define JET_wrnSeekNotEqual 1039 /* SeekLE or SeekGE didn't find exact match */
+#define JET_errTooManyColumns -1040 /* Too many columns defined */
+#define JET_errContainerNotEmpty -1043 /* Container is not empty */
+#define JET_errInvalidFilename -1044 /* Filename is invalid */
+#define JET_errInvalidBookmark -1045 /* Invalid bookmark */
+#define JET_errColumnInUse -1046 /* Column used in an index */
+#define JET_errInvalidBufferSize -1047 /* Data buffer doesn't match column size */
+#define JET_errColumnNotUpdatable -1048 /* Cannot set column value */
+#define JET_errIndexInUse -1051 /* Index is in use */
+#define JET_errLinkNotSupported -1052 /* Link support unavailable */
+#define JET_errNullKeyDisallowed -1053 /* Null keys are disallowed on index */
+#define JET_errNotInTransaction -1054 /* Operation must be within a transaction */
+#define JET_wrnNoErrorInfo 1055 /* No extended error information */
+#define JET_wrnNoIdleActivity 1058 /* No idle activity occured */
+#define JET_errTooManyActiveUsers -1059 /* Too many active database users */
+#define JET_errInvalidAppend -1060 /* Cannot append long value */
+#define JET_errInvalidCountry -1061 /* Invalid or unknown country code */
+#define JET_errInvalidLanguageId -1062 /* Invalid or unknown language id */
+#define JET_errInvalidCodePage -1063 /* Invalid or unknown code page */
+#define JET_wrnNoWriteLock 1067 /* No write lock at transaction level 0 */
+#define JET_wrnColumnSetNull 1068 /* Column set to NULL-value */
+#define JET_errVersionStoreOutOfMemory -1069 /* lMaxVerPages exceeded (XJET only) */
+#define JET_errCurrencyStackOutOfMemory -1070 /* lCSRPerfFUCB * lMaxCursors exceeded (XJET only) */
+#define JET_errOutOfSessions -1101 /* Out of sessions */
+#define JET_errWriteConflict -1102 /* Write lock failed due to outstanding write lock */
+#define JET_errTransTooDeep -1103 /* Xactions nested too deeply */
+#define JET_errInvalidSesid -1104 /* Invalid session handle */
+#define JET_errSessionWriteConflict -1107 /* Another session has private version of page */
+#define JET_errInTransaction -1108 /* Operation not allowed within a transaction */
+#define JET_errDatabaseDuplicate -1201 /* Database already exists */
+#define JET_errDatabaseInUse -1202 /* Database in use */
+#define JET_errDatabaseNotFound -1203 /* No such database */
+#define JET_errDatabaseInvalidName -1204 /* Invalid database name */
+#define JET_errDatabaseInvalidPages -1205 /* Invalid number of pages */
+#define JET_errDatabaseCorrupted -1206 /* non-db file or corrupted db */
+#define JET_errDatabaseLocked -1207 /* Database exclusively locked */
+#define JET_errCannotDisableVersioning -1208 /* Cannot disable versioning for this database */
+#define JET_wrnTableEmpty 1301 /* Open an empty table */
+#define JET_errTableLocked -1302 /* Table is exclusively locked */
+#define JET_errTableDuplicate -1303 /* Table already exists */
+#define JET_errTableInUse -1304 /* Table is in use, cannot lock */
+#define JET_errObjectNotFound -1305 /* No such table or object */
+#define JET_errDensityInvalid -1307 /* Bad file/index density */
+#define JET_errTableNotEmpty -1308 /* Cannot define clustered index */
+#define JET_errInvalidTableId -1310 /* Invalid table id */
+#define JET_errTooManyOpenTables -1311 /* Cannot open any more tables */
+#define JET_errIllegalOperation -1312 /* Oper. not supported on table */
+#define JET_errObjectDuplicate -1314 /* Table or object name in use */
+#define JET_errInvalidObject -1316 /* object is invalid for operation */
+#define JET_errIndexCantBuild -1401 /* Cannot build clustered index */
+#define JET_errIndexHasPrimary -1402 /* Primary index already defined */
+#define JET_errIndexDuplicate -1403 /* Index is already defined */
+#define JET_errIndexNotFound -1404 /* No such index */
+#define JET_errIndexMustStay -1405 /* Cannot delete clustered index */
+#define JET_errIndexInvalidDef -1406 /* Illegal index definition */
+#define JET_errIndexHasClustered -1408 /* Clustered index already defined */
+#define JET_errInvalidCreateIndex -1409 /* Invali create index description */
+#define JET_errTooManyOpenIndexes -1410 /* Out of index description blocks */
+#define JET_errColumnLong -1501 /* Column value is long */
+#define JET_errColumnNoChunk -1502 /* no such chunk in long value */
+#define JET_errColumnDoesNotFit -1503 /* Field will not fit in record */
+#define JET_errNullInvalid -1504 /* Null not valid */
+#define JET_errColumnIndexed -1505 /* Column indexed, cannot delete */
+#define JET_errColumnTooBig -1506 /* Field length is > maximum */
+#define JET_errColumnNotFound -1507 /* No such column */
+#define JET_errColumnDuplicate -1508 /* Field is already defined */
+#define JET_errColumn2ndSysMaint -1510 /* Second autoinc or version column */
+#define JET_errInvalidColumnType -1511 /* Invalid column data type */
+#define JET_wrnColumnMaxTruncated 1512 /* Max length too big, truncated */
+#define JET_errColumnCannotIndex -1513 /* Cannot index Bit,LongText,LongBinary */
+#define JET_errTaggedNotNULL -1514 /* No non-NULL tagged columns */
+#define JET_errNoCurrentIndex -1515 /* Invalid w/o a current index */
+#define JET_errKeyIsMade -1516 /* The key is completely made */
+#define JET_errBadColumnId -1517 /* Column Id Incorrect */
+#define JET_errBadItagSequence -1518 /* Bad itagSequence for tagged column */
+#define JET_errColumnInRelationship -1519 /* Cannot delete, column participates in relationship */
+#define JET_wrnCopyLongValue 1520 /* Single instance column bursted */
+#define JET_errCannotBeTagged -1521 /* AutoIncrement and Version cannot be tagged */
+#define JET_errRecordNotFound -1601 /* The key was not found */
+#define JET_errRecordNoCopy -1602 /* No working buffer */
+#define JET_errNoCurrentRecord -1603 /* Currency not on a record */
+#define JET_errRecordClusteredChanged -1604 /* Clustered key may not change */
+#define JET_errKeyDuplicate -1605 /* Illegal duplicate key */
+#define JET_errAlreadyPrepared -1607 /* Already copy/clear current */
+#define JET_errKeyNotMade -1608 /* No call to JetMakeKey */
+#define JET_errUpdateNotPrepared -1609 /* No call to JetPrepareUpdate */
+#define JET_wrnDataHasChanged 1610 /* Data has changed */
+#define JET_errDataHasChanged -1611 /* Data has changed, operation aborted */
+#define JET_wrnKeyChanged 1618 /* Moved to new key */
+#define JET_errTooManySorts -1701 /* Too many sort processes */
+#define JET_errInvalidOnSort -1702 /* Invalid operation on Sort */
+#define JET_errTempFileOpenError -1803 /* Temp file could not be opened */
+#define JET_errTooManyAttachedDatabases -1805 /* Too many open databases */
+#define JET_errDiskFull -1808 /* No space left on disk */
+#define JET_errPermissionDenied -1809 /* Permission denied */
+#define JET_errFileNotFound -1811 /* File not found */
+#define JET_wrnFileOpenReadOnly 1813 /* Database file is read only */
+#define JET_errAfterInitialization -1850 /* Cannot Restore after init. */
+#define JET_errLogCorrupted -1852 /* Logs could not be interpreted */
+#define JET_errInvalidOperation -1906 /* invalid operation */
+#define JET_errAccessDenied -1907 /* access denied */
+#define JET_wrnIdleFull 1908 /* ilde registry full */
+
+
+/**********************************************************************/
+/*********************** PROTOTYPES **************************/
+/**********************************************************************/
+
+#if !defined(_JET_NOPROTOTYPES)
+
+JET_ERR JET_API JetInit(JET_INSTANCE *pinstance);
+
+JET_ERR JET_API JetTerm(JET_INSTANCE instance);
+
+JET_ERR JET_API JetTerm2( JET_INSTANCE instance, JET_GRBIT grbit );
+
+JET_ERR JET_API JetSetSystemParameter(JET_INSTANCE *pinstance, JET_SESID sesid, unsigned long paramid,
+ unsigned long lParam, const char *sz);
+
+JET_ERR JET_API JetGetSystemParameter(JET_INSTANCE instance, JET_SESID sesid, unsigned long paramid,
+ unsigned long *plParam, char *sz, unsigned long cbMax);
+
+#define ctAccessPage 1
+#define ctLatchConflict 2
+#define ctSplitRetry 3
+#define ctNeighborPageScanned 4
+#define ctSplits 5
+JET_ERR JET_API JetResetCounter( JET_SESID sesid, long CounterType );
+JET_ERR JET_API JetGetCounter( JET_SESID sesid, long CounterType, long *plValue );
+
+JET_ERR JET_API JetBeginSession(JET_INSTANCE instance, JET_SESID *psesid,
+ const char *szUserName, const char *szPassword);
+
+JET_ERR JET_API JetDupSession(JET_SESID sesid, JET_SESID *psesid);
+
+JET_ERR JET_API JetEndSession(JET_SESID sesid, JET_GRBIT grbit);
+
+JET_ERR JET_API JetGetVersion(JET_SESID sesid, unsigned long *pwVersion);
+
+JET_ERR JET_API JetIdle(JET_SESID sesid, JET_GRBIT grbit);
+
+JET_ERR JET_API JetCreateDatabase(JET_SESID sesid,
+ const char *szFilename, const char *szConnect,
+ JET_DBID *pdbid, JET_GRBIT grbit);
+
+JET_ERR JET_API JetAttachDatabase(JET_SESID sesid, const char *szFilename, JET_GRBIT grbit );
+
+JET_ERR JET_API JetDetachDatabase(JET_SESID sesid, const char *szFilename);
+
+JET_ERR JET_API JetCreateTable(JET_SESID sesid, JET_DBID dbid,
+ const char *szTableName, unsigned long lPages, unsigned long lDensity,
+ JET_TABLEID *ptableid);
+
+JET_ERR JET_API JetCreateTableColumnIndex( JET_SESID sesid, JET_DBID dbid,
+ JET_TABLECREATE *ptablecreate );
+
+JET_ERR JET_API JetDeleteTable(JET_SESID sesid, JET_DBID dbid,
+ const char *szTableName);
+
+JET_ERR JET_API JetGetTableColumnInfo(JET_SESID sesid, JET_TABLEID tableid,
+ const char *szColumnName, void *pvResult, unsigned long cbMax,
+ unsigned long InfoLevel);
+
+JET_ERR JET_API JetGetColumnInfo(JET_SESID sesid, JET_DBID dbid,
+ const char *szTableName, const char *szColumnName,
+ void *pvResult, unsigned long cbMax, unsigned long InfoLevel);
+
+JET_ERR JET_API JetAddColumn(JET_SESID sesid, JET_TABLEID tableid,
+ const char *szColumn, const JET_COLUMNDEF *pcolumndef,
+ const void *pvDefault, unsigned long cbDefault,
+ JET_COLUMNID *pcolumnid);
+
+JET_ERR JET_API JetDeleteColumn(JET_SESID sesid, JET_TABLEID tableid,
+ const char *szColumn);
+
+JET_ERR JET_API JetGetTableIndexInfo(JET_SESID sesid, JET_TABLEID tableid,
+ const char *szIndexName, void *pvResult, unsigned long cbResult,
+ unsigned long InfoLevel);
+
+JET_ERR JET_API JetGetTableInfo(JET_SESID sesid, JET_TABLEID tableid,
+ void *pvResult, unsigned long cbMax, unsigned long InfoLevel);
+
+JET_ERR JET_API JetGetIndexInfo(JET_SESID sesid, JET_DBID dbid,
+ const char *szTableName, const char *szIndexName,
+ void *pvResult, unsigned long cbResult, unsigned long InfoLevel);
+
+JET_ERR JET_API JetCreateIndex(JET_SESID sesid, JET_TABLEID tableid,
+ const char *szIndexName, JET_GRBIT grbit,
+ const char *szKey, unsigned long cbKey, unsigned long lDensity);
+
+JET_ERR JET_API JetDeleteIndex(JET_SESID sesid, JET_TABLEID tableid,
+ const char *szIndexName);
+
+JET_ERR JET_API JetGetObjectInfo(JET_SESID sesid, JET_DBID dbid,
+ JET_OBJTYP objtyp, const char *szContainerName,
+ const char *szObjectName, void *pvResult, unsigned long cbMax,
+ unsigned long InfoLevel);
+
+JET_ERR JET_API JetBeginTransaction(JET_SESID sesid);
+
+JET_ERR JET_API JetCommitTransaction(JET_SESID sesid, JET_GRBIT grbit);
+
+JET_ERR JET_API JetRollback(JET_SESID sesid, JET_GRBIT grbit);
+
+JET_ERR JET_API JetGetDatabaseInfo(JET_SESID sesid, JET_DBID dbid,
+ void *pvResult, unsigned long cbMax, unsigned long InfoLevel);
+
+JET_ERR JET_API JetCloseDatabase(JET_SESID sesid, JET_DBID dbid,
+ JET_GRBIT grbit);
+
+JET_ERR JET_API JetCloseTable(JET_SESID sesid, JET_TABLEID tableid);
+
+JET_ERR JET_API JetOpenDatabase(JET_SESID sesid, const char *szFilename,
+ const char *szConnect, JET_DBID *pdbid, JET_GRBIT grbit);
+
+JET_ERR JET_API JetOpenTable(JET_SESID sesid, JET_DBID dbid,
+ const char *szTableName, const void *pvParameters,
+ unsigned long cbParameters, JET_GRBIT grbit, JET_TABLEID *ptableid);
+
+JET_ERR JET_API JetDelete(JET_SESID sesid, JET_TABLEID tableid);
+
+JET_ERR JET_API JetUpdate(JET_SESID sesid, JET_TABLEID tableid,
+ void *pvBookmark, unsigned long cbBookmark,
+ unsigned long *pcbActual);
+
+JET_ERR JET_API JetRetrieveColumn(JET_SESID sesid, JET_TABLEID tableid,
+ JET_COLUMNID columnid, void *pvData, unsigned long cbData,
+ unsigned long *pcbActual, JET_GRBIT grbit, JET_RETINFO *pretinfo);
+
+JET_ERR JET_API JetRetrieveColumns( JET_SESID sesid, JET_TABLEID tableid,
+ JET_RETRIEVECOLUMN *pretrievecolumn, unsigned long cretrievecolumn );
+
+JET_ERR JET_API JetSetColumn(JET_SESID sesid, JET_TABLEID tableid,
+ JET_COLUMNID columnid, const void *pvData, unsigned long cbData,
+ JET_GRBIT grbit, JET_SETINFO *psetinfo);
+
+JET_ERR JET_API JetSetColumns(JET_SESID sesid, JET_TABLEID tableid,
+ JET_SETCOLUMN *psetcolumn, unsigned long csetcolumn );
+
+JET_ERR JET_API JetPrepareUpdate(JET_SESID sesid, JET_TABLEID tableid,
+ unsigned long prep);
+
+JET_ERR JET_API JetGetRecordPosition(JET_SESID sesid, JET_TABLEID tableid,
+ JET_RECPOS *precpos, unsigned long cbRecpos);
+
+JET_ERR JET_API JetGotoPosition(JET_SESID sesid, JET_TABLEID tableid,
+ JET_RECPOS *precpos );
+
+JET_ERR JET_API JetGetCursorInfo(JET_SESID sesid, JET_TABLEID tableid,
+ void *pvResult, unsigned long cbMax, unsigned long InfoLevel);
+
+JET_ERR JET_API JetDupCursor(JET_SESID sesid, JET_TABLEID tableid,
+ JET_TABLEID *ptableid, JET_GRBIT grbit);
+
+JET_ERR JET_API JetGetCurrentIndex(JET_SESID sesid, JET_TABLEID tableid,
+ char *szIndexName, unsigned long cchIndexName);
+
+JET_ERR JET_API JetSetCurrentIndex(JET_SESID sesid, JET_TABLEID tableid,
+ const char *szIndexName);
+
+JET_ERR JET_API JetSetCurrentIndex2(JET_SESID sesid, JET_TABLEID tableid,
+ const char *szIndexName, JET_GRBIT grbit );
+
+JET_ERR JET_API JetMove(JET_SESID sesid, JET_TABLEID tableid,
+ long cRow, JET_GRBIT grbit);
+
+JET_ERR JET_API JetMakeKey(JET_SESID sesid, JET_TABLEID tableid,
+ const void *pvData, unsigned long cbData, JET_GRBIT grbit);
+
+JET_ERR JET_API JetSeek(JET_SESID sesid, JET_TABLEID tableid,
+ JET_GRBIT grbit);
+
+JET_ERR JET_API JetGetBookmark(JET_SESID sesid, JET_TABLEID tableid,
+ void *pvBookmark, unsigned long cbMax,
+ unsigned long *pcbActual);
+
+JET_ERR JET_API JetCompact(JET_SESID sesid, const char *szDatabaseSrc,
+ const char *szDatabaseDest, JET_PFNSTATUS pfnStatus, JET_CONVERT *pconvert,
+ JET_GRBIT grbit);
+
+JET_ERR JET_API JetDBUtilities( JET_DBUTIL *pdbutil );
+
+JET_ERR JET_API JetGotoBookmark(JET_SESID sesid, JET_TABLEID tableid,
+ void *pvBookmark, unsigned long cbBookmark);
+
+JET_ERR JET_API JetComputeStats(JET_SESID sesid, JET_TABLEID tableid);
+
+typedef unsigned long JET_VSESID; /* Received from dispatcher */
+
+struct tagVDBFNDEF;
+
+typedef unsigned long JET_VDBID; /* Received from dispatcher */
+
+struct tagVTFNDEF;
+
+typedef unsigned long JET_VTID; /* Received from dispatcher */
+
+JET_ERR JET_API JetOpenTempTable(JET_SESID sesid,
+ const JET_COLUMNDEF *prgcolumndef, unsigned long ccolumn,
+ JET_GRBIT grbit, JET_TABLEID *ptableid,
+ JET_COLUMNID *prgcolumnid);
+
+JET_ERR JET_API JetOpenTempTable2( JET_SESID sesid,
+ const JET_COLUMNDEF *prgcolumndef,
+ unsigned long ccolumn,
+ unsigned long langid,
+ JET_GRBIT grbit,
+ JET_TABLEID *ptableid,
+ JET_COLUMNID *prgcolumnid );
+
+JET_ERR JET_API JetBackup( const char *szBackupPath, JET_GRBIT grbit, JET_PFNSTATUS pfnStatus );
+
+JET_ERR JET_API JetRestore(const char *sz, JET_PFNSTATUS pfn );
+JET_ERR JET_API JetRestore2(const char *sz, const char *szDest, JET_PFNSTATUS pfn );
+
+JET_ERR JET_API JetSetIndexRange(JET_SESID sesid,
+ JET_TABLEID tableidSrc, JET_GRBIT grbit);
+
+JET_ERR JET_API JetIndexRecordCount(JET_SESID sesid,
+ JET_TABLEID tableid, unsigned long *pcrec, unsigned long crecMax );
+
+JET_ERR JET_API JetRetrieveKey(JET_SESID sesid,
+ JET_TABLEID tableid, void *pvData, unsigned long cbMax,
+ unsigned long *pcbActual, JET_GRBIT grbit );
+
+JET_ERR JET_API JetBeginExternalBackup( JET_GRBIT grbit );
+
+JET_ERR JET_API JetGetAttachInfo( void *pv,
+ unsigned long cbMax,
+ unsigned long *pcbActual );
+
+JET_ERR JET_API JetOpenFile( const char *szFileName,
+ JET_HANDLE *phfFile,
+ unsigned long *pulFileSizeLow,
+ unsigned long *pulFileSizeHigh );
+
+JET_ERR JET_API JetReadFile( JET_HANDLE hfFile,
+ void *pv,
+ unsigned long cb,
+ unsigned long *pcb );
+
+JET_ERR JET_API JetCloseFile( JET_HANDLE hfFile );
+
+JET_ERR JET_API JetGetLogInfo( void *pv,
+ unsigned long cbMax,
+ unsigned long *pcbActual );
+
+JET_ERR JET_API JetTruncateLog( void );
+
+JET_ERR JET_API JetEndExternalBackup( void );
+
+JET_ERR JET_API JetExternalRestore( char *szCheckpointFilePath, char *szLogPath, JET_RSTMAP *rgstmap, long crstfilemap, char *szBackupLogPath, long genLow, long genHigh, JET_PFNSTATUS pfn );
+
+#endif /* _JET_NOPROTOTYPES */
+
+#pragma pack()
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _JET_INCLUDED */
+
+
+
+
diff --git a/private/inc/llinfo.h b/private/inc/llinfo.h
new file mode 100644
index 000000000..7f9822db9
--- /dev/null
+++ b/private/inc/llinfo.h
@@ -0,0 +1,90 @@
+/********************************************************************/
+/** Microsoft LAN Manager **/
+/** Copyright(c) Microsoft Corp., 1990-1992 **/
+/********************************************************************/
+/* :ts=4 */
+
+//** LLINFO.H - Lower layer SNMP information definitions.
+//
+// This file contains all of the definitions for SNMP information collected
+// by layers below IP.
+
+#ifndef LLINFO_INCLUDED
+#define LLINFO_INCLUDED
+
+
+#ifndef CTE_TYPEDEFS_DEFINED
+#define CTE_TYPEDEFS_DEFINED
+
+typedef unsigned long ulong;
+typedef unsigned short ushort;
+typedef unsigned char uchar;
+typedef unsigned int uint;
+
+#endif // CTE_TYPEDEFS_DEFINED
+
+
+#define IF_MIB_STATS_ID 1
+
+#define MAX_PHYSADDR_SIZE 8
+
+typedef struct IPNetToMediaEntry {
+ ulong inme_index;
+ ulong inme_physaddrlen;
+ uchar inme_physaddr[MAX_PHYSADDR_SIZE];
+ ulong inme_addr;
+ ulong inme_type;
+} IPNetToMediaEntry;
+
+#define INME_TYPE_OTHER 1
+#define INME_TYPE_INVALID 2
+#define INME_TYPE_DYNAMIC 3
+#define INME_TYPE_STATIC 4
+
+#define MAX_IFDESCR_LEN 256
+
+#define IFE_FIXED_SIZE offsetof(struct IFEntry, if_descr)
+
+typedef struct IFEntry {
+ ulong if_index;
+ ulong if_type;
+ ulong if_mtu;
+ ulong if_speed;
+ ulong if_physaddrlen;
+ uchar if_physaddr[MAX_PHYSADDR_SIZE];
+ ulong if_adminstatus;
+ ulong if_operstatus;
+ ulong if_lastchange;
+ ulong if_inoctets;
+ ulong if_inucastpkts;
+ ulong if_innucastpkts;
+ ulong if_indiscards;
+ ulong if_inerrors;
+ ulong if_inunknownprotos;
+ ulong if_outoctets;
+ ulong if_outucastpkts;
+ ulong if_outnucastpkts;
+ ulong if_outdiscards;
+ ulong if_outerrors;
+ ulong if_outqlen;
+ ulong if_descrlen;
+ uchar if_descr[1];
+} IFEntry;
+
+#define IF_TYPE_OTHER 1
+#define IF_TYPE_ETHERNET 6
+#define IF_TYPE_TOKENRING 9
+#define IF_TYPE_FDDI 15
+#define IF_TYPE_PPP 23
+#define IF_TYPE_LOOPBACK 24
+#define IF_TYPE_SLIP 28
+
+#define IF_STATUS_UP 1
+#define IF_STATUS_DOWN 2
+#define IF_STATUS_TESTING 3
+
+
+#endif // LLINFO_INCLUDED
+
+
+
diff --git a/private/inc/logonmsv.h b/private/inc/logonmsv.h
new file mode 100644
index 000000000..d23adab82
--- /dev/null
+++ b/private/inc/logonmsv.h
@@ -0,0 +1,473 @@
+/*++
+
+Copyright (c) 1987-1991 Microsoft Corporation
+
+Module Name:
+
+ logonmsv.h
+
+Abstract:
+
+ Definition of API's to the Netlogon service which are callable
+ by the MSV1_0 authentication package.
+
+Author:
+
+ Cliff Van Dyke (cliffv) 23-Jun-1991
+
+Environment:
+
+ User mode only.
+ Contains NT-specific code.
+ Requires ANSI C extensions: slash-slash comments, long external names.
+
+Revision History:
+
+--*/
+
+#ifndef __LOGONMSV_H__
+#define __LOGONMSV_H__
+#include <lsass.h> // OLD_LARGE_INTEGER
+
+//
+// Name of secret in LSA secret storage where account passwords are kept.
+//
+
+#define SSI_SECRET_PREFIX L"$"
+#define SSI_SECRET_PREFIX_LENGTH 1
+#define SSI_SECRET_POSTFIX L"MACHINE.ACC"
+#define SSI_SECRET_NAME L"$MACHINE.ACC"
+
+//
+// Name of the event used to synchronize between the security process and
+// the service controller.
+//
+
+#define SECURITY_SERVICES_STARTED L"SECURITY_SERVICES_STARTED"
+
+
+//
+// The structures supporting remote logon APIs
+//
+
+typedef CYPHER_BLOCK NETLOGON_CREDENTIAL, *PNETLOGON_CREDENTIAL ;
+
+typedef struct _NETLOGON_AUTHENTICATOR {
+ NETLOGON_CREDENTIAL Credential;
+ DWORD timestamp;
+} NETLOGON_AUTHENTICATOR, *PNETLOGON_AUTHENTICATOR ;
+
+typedef struct _NETLOGON_SESSION_KEY {
+ BYTE Key[CRYPT_TXT_LEN * 2];
+} NETLOGON_SESSION_KEY, *PNETLOGON_SESSION_KEY;
+
+typedef enum _NETLOGON_SECURE_CHANNEL_TYPE {
+ NullSecureChannel = 0,
+ MsvApSecureChannel,
+ WorkstationSecureChannel,
+ Beta2ServerSecureChannel, // NOT USED (since before NT 1.0 shipped)
+ TrustedDomainSecureChannel,
+ UasServerSecureChannel,
+ ServerSecureChannel
+} NETLOGON_SECURE_CHANNEL_TYPE;
+
+
+//
+// Input information to NetLogonSamLogon.
+//
+// begin_ntsubauth
+
+typedef enum _NETLOGON_LOGON_INFO_CLASS {
+ NetlogonInteractiveInformation = 1,
+ NetlogonNetworkInformation,
+ NetlogonServiceInformation
+} NETLOGON_LOGON_INFO_CLASS;
+
+#pragma pack(4)
+typedef struct _NETLOGON_LOGON_IDENTITY_INFO {
+ UNICODE_STRING LogonDomainName;
+ ULONG ParameterControl;
+ OLD_LARGE_INTEGER LogonId;
+ UNICODE_STRING UserName;
+ UNICODE_STRING Workstation;
+} NETLOGON_LOGON_IDENTITY_INFO,
+ *PNETLOGON_LOGON_IDENTITY_INFO;
+#pragma pack()
+
+#pragma pack(4)
+typedef struct _NETLOGON_INTERACTIVE_INFO {
+ NETLOGON_LOGON_IDENTITY_INFO Identity;
+ LM_OWF_PASSWORD LmOwfPassword;
+ NT_OWF_PASSWORD NtOwfPassword;
+} NETLOGON_INTERACTIVE_INFO,
+ *PNETLOGON_INTERACTIVE_INFO;
+#pragma pack()
+
+#pragma pack(4)
+typedef struct _NETLOGON_SERVICE_INFO {
+ NETLOGON_LOGON_IDENTITY_INFO Identity;
+ LM_OWF_PASSWORD LmOwfPassword;
+ NT_OWF_PASSWORD NtOwfPassword;
+} NETLOGON_SERVICE_INFO, *PNETLOGON_SERVICE_INFO;
+#pragma pack()
+
+#pragma pack(4)
+typedef struct _NETLOGON_NETWORK_INFO {
+ NETLOGON_LOGON_IDENTITY_INFO Identity;
+ LM_CHALLENGE LmChallenge;
+ STRING NtChallengeResponse;
+ STRING LmChallengeResponse;
+} NETLOGON_NETWORK_INFO, *PNETLOGON_NETWORK_INFO;
+#pragma pack()
+// end_ntsubauth
+
+//
+// Structure to pass a SID_AND_ATTRIBUTES over the network.
+//
+
+typedef struct _NETLOGON_SID_AND_ATTRIBUTES {
+#if defined(MIDL_PASS) || defined(RPC_SERVER)
+ PISID Sid;
+#else
+ PSID Sid;
+#endif
+ ULONG Attributes;
+} NETLOGON_SID_AND_ATTRIBUTES, *PNETLOGON_SID_AND_ATTRIBUTES;
+
+//
+// Values of ParameterControl
+//
+// (Obsolete: Use the ParameterControl values from ntmsv1_0.h)
+
+#define CLEARTEXT_PASSWORD_ALLOWED 0x02 // Challenge response fields may
+ // actually be clear text passwords.
+
+
+//
+// Output information to NetLogonSamLogon.
+//
+
+typedef enum _NETLOGON_VALIDATION_INFO_CLASS {
+ NetlogonValidationUasInfo = 1,
+ NetlogonValidationSamInfo,
+ NetlogonValidationSamInfo2,
+ NetlogonValidationPacInfo,
+ NetlogonValidationPacInfo2
+} NETLOGON_VALIDATION_INFO_CLASS;
+
+#pragma pack(4)
+typedef struct _NETLOGON_VALIDATION_SAM_INFO {
+ //
+ // Information retrieved from SAM.
+ //
+ OLD_LARGE_INTEGER LogonTime; // 0 for Network logon
+ OLD_LARGE_INTEGER LogoffTime;
+ OLD_LARGE_INTEGER KickOffTime;
+ OLD_LARGE_INTEGER PasswordLastSet; // 0 for Network logon
+ OLD_LARGE_INTEGER PasswordCanChange; // 0 for Network logon
+ OLD_LARGE_INTEGER PasswordMustChange; // 0 for Network logon
+ UNICODE_STRING EffectiveName; // 0 for Network logon
+ UNICODE_STRING FullName; // 0 for Network logon
+ UNICODE_STRING LogonScript; // 0 for Network logon
+ UNICODE_STRING ProfilePath; // 0 for Network logon
+ UNICODE_STRING HomeDirectory; // 0 for Network logon
+ UNICODE_STRING HomeDirectoryDrive; // 0 for Network logon
+ USHORT LogonCount; // 0 for Network logon
+ USHORT BadPasswordCount; // 0 for Network logon
+ ULONG UserId;
+ ULONG PrimaryGroupId;
+ ULONG GroupCount;
+#ifdef MIDL_PASS
+ [size_is(GroupCount)]
+#endif // MIDL_PASS
+ PGROUP_MEMBERSHIP GroupIds;
+
+ //
+ // Information supplied by the MSV AP/Netlogon service.
+ //
+ ULONG UserFlags;
+ USER_SESSION_KEY UserSessionKey;
+ UNICODE_STRING LogonServer;
+ UNICODE_STRING LogonDomainName;
+#if defined(MIDL_PASS) || defined(RPC_SERVER)
+ PISID LogonDomainId;
+#else
+ PSID LogonDomainId;
+#endif
+ //
+ // The First two longwords (8 bytes) of ExpansionRoom are reserved for the
+ // LanManSession Key.
+ //
+#define SAMINFO_LM_SESSION_KEY 0
+#define SAMINFO_LM_SESSION_KEY_EXT 1
+#define SAMINFO_LM_SESSION_KEY_SIZE (2*sizeof(ULONG))
+
+ ULONG ExpansionRoom[10]; // Put new fields here
+} NETLOGON_VALIDATION_SAM_INFO, *PNETLOGON_VALIDATION_SAM_INFO ;
+
+//
+// New output information for NetLogonSamLogon. This structure is identical
+// to the above structure with some new fields added at the end.
+//
+
+
+typedef struct _NETLOGON_VALIDATION_SAM_INFO2 {
+ //
+ // Information retrieved from SAM.
+ //
+ OLD_LARGE_INTEGER LogonTime; // 0 for Network logon
+ OLD_LARGE_INTEGER LogoffTime;
+ OLD_LARGE_INTEGER KickOffTime;
+ OLD_LARGE_INTEGER PasswordLastSet; // 0 for Network logon
+ OLD_LARGE_INTEGER PasswordCanChange; // 0 for Network logon
+ OLD_LARGE_INTEGER PasswordMustChange; // 0 for Network logon
+ UNICODE_STRING EffectiveName; // 0 for Network logon
+ UNICODE_STRING FullName; // 0 for Network logon
+ UNICODE_STRING LogonScript; // 0 for Network logon
+ UNICODE_STRING ProfilePath; // 0 for Network logon
+ UNICODE_STRING HomeDirectory; // 0 for Network logon
+ UNICODE_STRING HomeDirectoryDrive; // 0 for Network logon
+ USHORT LogonCount; // 0 for Network logon
+ USHORT BadPasswordCount; // 0 for Network logon
+ ULONG UserId;
+ ULONG PrimaryGroupId;
+ ULONG GroupCount;
+#ifdef MIDL_PASS
+ [size_is(GroupCount)]
+#endif // MIDL_PASS
+ PGROUP_MEMBERSHIP GroupIds;
+
+ //
+ // Information supplied by the MSV AP/Netlogon service.
+ //
+ ULONG UserFlags;
+ USER_SESSION_KEY UserSessionKey;
+ UNICODE_STRING LogonServer;
+ UNICODE_STRING LogonDomainName;
+#if defined(MIDL_PASS) || defined(RPC_SERVER)
+ PISID LogonDomainId;
+#else
+ PSID LogonDomainId;
+#endif
+ //
+ // The First two longwords (8 bytes) of ExpansionRoom are reserved for the
+ // LanManSession Key.
+ //
+#define SAMINFO_LM_SESSION_KEY 0
+#define SAMINFO_LM_SESSION_KEY_EXT 1
+#define SAMINFO_LM_SESSION_KEY_SIZE (2*sizeof(ULONG))
+
+ ULONG ExpansionRoom[10]; // Put new fields here
+
+ //
+ // The new fields in this structure are a count and a pointer to
+ // an array of SIDs and attributes.
+ //
+
+ ULONG SidCount;
+
+#ifdef MIDL_PASS
+ [size_is(SidCount)]
+#endif // MIDL_PASS
+ PNETLOGON_SID_AND_ATTRIBUTES ExtraSids;
+
+} NETLOGON_VALIDATION_SAM_INFO2, *PNETLOGON_VALIDATION_SAM_INFO2 ;
+
+
+//
+// PAC info level
+//
+
+typedef struct _NETLOGON_VALIDATION_PAC_INFO {
+ ULONG cbPacSize;
+#ifdef MIDL_PASS
+ [size_is(cbPacSize),unique]
+#endif //MIDL_PASS
+ PUCHAR pbPacData;
+ UNICODE_STRING LogonDomain;
+ UNICODE_STRING LogonServer;
+ UNICODE_STRING PrincipalName;
+ ULONG cbAuthData;
+#ifdef MIDL_PASS
+ [size_is(cbAuthData),unique]
+#endif //MIDL_PASS
+ PUCHAR pbAuthData;
+ USER_SESSION_KEY UserSessionKey;
+
+ ULONG ExpansionRoom[10]; // First two are the LanmanSessionKey
+ UNICODE_STRING DummyString1; // Not used yet
+ UNICODE_STRING DummyString2; // Not used yet
+ UNICODE_STRING DummyString3; // Not used yet
+ UNICODE_STRING DummyString4; // Not used yet
+
+} NETLOGON_VALIDATION_PAC_INFO, *PNETLOGON_VALIDATION_PAC_INFO;
+
+#pragma pack()
+
+//
+// Status codes that indicate the password is bad and the call should
+// be passed through to the PDC of the domain.
+//
+
+#define BAD_PASSWORD( _x ) \
+ ((_x) == STATUS_WRONG_PASSWORD || \
+ (_x) == STATUS_PASSWORD_EXPIRED || \
+ (_x) == STATUS_PASSWORD_MUST_CHANGE || \
+ (_x) == STATUS_ACCOUNT_LOCKED_OUT )
+
+//
+// The actual logon and logoff routines.
+//
+
+// The following 2 procedure definitions must match
+NTSTATUS
+I_NetLogonSamLogon(
+ IN LPWSTR LogonServer OPTIONAL,
+ IN LPWSTR ComputerName OPTIONAL,
+ IN PNETLOGON_AUTHENTICATOR Authenticator OPTIONAL,
+ OUT PNETLOGON_AUTHENTICATOR ReturnAuthenticator OPTIONAL,
+ IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
+ IN LPBYTE LogonInformation,
+ IN NETLOGON_VALIDATION_INFO_CLASS ValidationLevel,
+ OUT LPBYTE * ValidationInformation,
+ OUT PBOOLEAN Authoritative
+ );
+
+typedef NTSTATUS
+(*PNETLOGON_SAM_LOGON_PROCEDURE)(
+ IN LPWSTR LogonServer OPTIONAL,
+ IN LPWSTR ComputerName OPTIONAL,
+ IN PNETLOGON_AUTHENTICATOR Authenticator OPTIONAL,
+ OUT PNETLOGON_AUTHENTICATOR ReturnAuthenticator OPTIONAL,
+ IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
+ IN LPBYTE LogonInformation,
+ IN NETLOGON_VALIDATION_INFO_CLASS ValidationLevel,
+ OUT LPBYTE * ValidationInformation,
+ OUT PBOOLEAN Authoritative
+ );
+
+
+// The following 2 procedure definitions must match
+NTSTATUS
+I_NetLogonSamLogoff (
+ IN LPWSTR LogonServer OPTIONAL,
+ IN LPWSTR ComputerName OPTIONAL,
+ IN PNETLOGON_AUTHENTICATOR Authenticator OPTIONAL,
+ OUT PNETLOGON_AUTHENTICATOR ReturnAuthenticator OPTIONAL,
+ IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
+ IN LPBYTE LogonInformation
+);
+
+typedef NTSTATUS
+(*PNETLOGON_SAM_LOGOFF_PROCEDURE) (
+ IN LPWSTR LogonServer OPTIONAL,
+ IN LPWSTR ComputerName OPTIONAL,
+ IN PNETLOGON_AUTHENTICATOR Authenticator OPTIONAL,
+ OUT PNETLOGON_AUTHENTICATOR ReturnAuthenticator OPTIONAL,
+ IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
+ IN LPBYTE LogonInformation
+);
+
+//
+// Actual logon/logoff routines for Cairo
+//
+
+NET_API_STATUS
+NetlogonInitialize(
+ PVOID Context
+ );
+
+NTSTATUS
+NetlogonSamLogon (
+ IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
+ IN LPBYTE LogonInformation,
+ IN NETLOGON_VALIDATION_INFO_CLASS ValidationLevel,
+ OUT LPBYTE *ValidationInformation,
+ OUT PBOOLEAN Authoritative
+ );
+
+//
+// Routine to get a list of NT DC's in the specified domain.
+//
+NET_API_STATUS NET_API_FUNCTION
+I_NetGetDCList (
+ IN LPTSTR ServerName OPTIONAL,
+ IN LPTSTR TrustedDomainName,
+ OUT PULONG DCCount,
+ OUT PUNICODE_STRING * DCNames
+ );
+
+//
+// Validation routine which lives in msv1_0.dll
+//
+NTSTATUS
+MsvSamValidate (
+ IN SAM_HANDLE DomainHandle,
+ IN BOOLEAN UasCompatibilityRequired,
+ IN NETLOGON_SECURE_CHANNEL_TYPE SecureChannelType,
+ IN PUNICODE_STRING LogonServer,
+ IN PUNICODE_STRING LogonDomainName,
+ IN PSID LogonDomainId,
+ IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
+ IN PVOID LogonInformation,
+ IN NETLOGON_VALIDATION_INFO_CLASS ValidationLevel,
+ OUT PVOID * ValidationInformation,
+ OUT PBOOLEAN Authoritative,
+ OUT PBOOLEAN BadPasswordCountZeroed,
+ IN DWORD AccountsToTry
+);
+
+//
+// Routine to get running number of logon attempts which lives in msv1_0.dll
+//
+ULONG
+MsvGetLogonAttemptCount (
+ VOID
+);
+
+// Values for AccountsToTry
+#define MSVSAM_SPECIFIED 0x01 // Try specified account
+#define MSVSAM_GUEST 0x02 // Try guest account
+
+NTSTATUS
+MsvSamLogoff (
+ IN SAM_HANDLE DomainHandle,
+ IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
+ IN PVOID LogonInformation
+);
+
+// begin_ntsubauth
+
+// Values for Flags
+#define MSV1_0_PASSTHRU 0x01
+#define MSV1_0_GUEST_LOGON 0x02
+
+NTSTATUS NTAPI
+Msv1_0SubAuthenticationRoutine(
+ IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
+ IN PVOID LogonInformation,
+ IN ULONG Flags,
+ IN PUSER_ALL_INFORMATION UserAll,
+ OUT PULONG WhichFields,
+ OUT PULONG UserFlags,
+ OUT PBOOLEAN Authoritative,
+ OUT PLARGE_INTEGER LogoffTime,
+ OUT PLARGE_INTEGER KickoffTime
+);
+
+NTSTATUS NTAPI
+Msv1_0SubAuthenticationFilter(
+ IN NETLOGON_LOGON_INFO_CLASS LogonLevel,
+ IN PVOID LogonInformation,
+ IN ULONG Flags,
+ IN PUSER_ALL_INFORMATION UserAll,
+ OUT PULONG WhichFields,
+ OUT PULONG UserFlags,
+ OUT PBOOLEAN Authoritative,
+ OUT PLARGE_INTEGER LogoffTime,
+ OUT PLARGE_INTEGER KickoffTime
+);
+
+// end_ntsubauth
+
+#endif // __LOGONMSV_H__
diff --git a/private/inc/lsaicli.h b/private/inc/lsaicli.h
new file mode 100644
index 000000000..7dc0bc073
--- /dev/null
+++ b/private/inc/lsaicli.h
@@ -0,0 +1,315 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ lsaicli.h
+
+Abstract:
+
+ Local Security Authority - Definitions for internal LSA Clients.
+
+ NOTE: This file is included via lsaclip.h or lsasrvp.h. It should
+ not be included directly.
+
+ This module contains definitions used only when callouts are made
+ from one LSA to another, i.e. where the server side of one LSA
+ communicates with the client side of another LSA.
+
+Author:
+
+ Scott Birrell (ScottBi) April 9, 1992
+
+Environment:
+
+Revision History:
+
+--*/
+
+#ifndef _LSAICLI_
+#define _LSAICLI_
+
+
+//
+// The following datatype specifies the Call Level for Sid and Name
+// Lookup operations.
+//
+
+typedef enum _LSAP_LOOKUP_LEVEL {
+
+ LsapLookupWksta = 1,
+ LsapLookupPDC,
+ LsapLookupTDL
+
+} LSAP_LOOKUP_LEVEL, *PLSAP_LOOKUP_LEVEL;
+
+//
+// where the entries have the following meaning:
+//
+// LsapLookupWksta - First Level Lookup performed on a workstation
+// normally configured for Windows-Nt. The lookup searches the
+// Well-Known Sids/Names, and the Built-in Domain and Account Domain
+// in the local SAM Database. If not all Sids or Names are
+// identified, performs a "handoff" of a Second level Lookup to the
+// LSA running on a Controller for the workstation's Primary Domain
+// (if any).
+//
+// LsapLookupPDC - Second Level Lookup performed on a Primary Domain
+// Controller. The lookup searches the Account Domain of the
+// SAM Database on the controller. If not all Sids or Names are
+// found, the Trusted Domain List (TDL) is obtained from the
+// LSA's Policy Database and Third Level lookups are performed
+// via "handoff" to each Trusted Domain in the List.
+//
+// LsapLookupTDL - Third Level Lookup performed on a controller
+// for a Trusted Domain. The lookup searches the Account Domain of
+// the SAM Database on the controller only.
+//
+
+
+NTSTATUS
+LsaICLookupNames(
+ IN LSA_HANDLE PolicyHandle,
+ IN ULONG Count,
+ IN PUNICODE_STRING Names,
+ OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains,
+ OUT PLSA_TRANSLATED_SID *Sids,
+ IN LSAP_LOOKUP_LEVEL LookupLevel,
+ IN OUT PULONG MappedCount
+ );
+
+/*++
+
+Routine Description:
+
+ This function is the internal client side version of the LsaLookupNames
+ API. It is called both from the client side (as an internal routine)
+ and the server side of the LSA. The function is identical to the
+ LsaLookupNames API except that there is an additional parameter, the
+ LookupLevel parameter.
+
+ The LsaLookupNames API attempts to translate names of domains, users,
+ groups or aliases to Sids. The caller must have POLICY_LOOKUP_NAMES
+ access to the Policy object.
+
+ Names may be either isolated (e.g. JohnH) or composite names containing
+ both the domain name and account name. Composite names must include a
+ backslash character separating the domain name from the account name
+ (e.g. Acctg\JohnH). An isolated name may be either an account name
+ (user, group, or alias) or a domain name.
+
+ Translation of isolated names introduces the possibility of name
+ collisions (since the same name may be used in multiple domains). An
+ isolated name will be translated using the following algorithm:
+
+ If the name is a well-known name (e.g. Local or Interactive), then the
+ corresponding well-known Sid is returned.
+
+ If the name is the Built-in Domain's name, then that domain's Sid
+ will be returned.
+
+ If the name is the Account Domain's name, then that domain's Sid
+ will be returned.
+
+ If the name is the Primary Domain's name, then that domain's Sid will
+ be returned.
+
+ If the name is a user, group, or alias in the Built-in Domain, then the
+ Sid of that account is returned.
+
+ If the name is a user, group, or alias in the Primary Domain, then the
+ Sid of that account is returned.
+
+ Otherwise, the name is not translated.
+
+ NOTE: Proxy, Machine, and Trust user accounts are not referenced
+ for name translation. Only normal user accounts are used for ID
+ translation. If translation of other account types is needed, then
+ SAM services should be used directly.
+
+Arguments:
+
+ This function is the LSA server RPC worker routine for the
+ LsaLookupNamesInLsa API.
+
+ PolicyHandle - Handle from an LsaOpenPolicy call.
+
+ Count - Specifies the number of names to be translated.
+
+ Names - Pointer to an array of Count Unicode String structures
+ specifying the names to be looked up and mapped to Sids.
+ The strings may be names of User, Group or Alias accounts or
+ domains.
+
+ ReferencedDomains - receives a pointer to a structure describing the
+ domains used for the translation. The entries in this structure
+ are referenced by the structure returned via the Sids parameter.
+ Unlike the Sids parameter, which contains an array entry for
+ each translated name, this structure will only contain one
+ component for each domain utilized in the translation.
+
+ When this information is no longer needed, it must be released
+ by passing the returned pointer to LsaFreeMemory().
+
+ Sids - Receives a pointer to an array of records describing each
+ translated Sid. The nth entry in this array provides a translation
+ for (the nth element in the Names parameter.
+
+ When this information is no longer needed, it must be released
+ by passing the returned pointer to LsaFreeMemory().
+
+ LookupLevel - Specifies the Level of Lookup to be performed on this
+ machine. Values of this field are are follows:
+
+ LsapLookupWksta - First Level Lookup performed on a workstation
+ normally configured for Windows-Nt. The lookup searches the
+ Well-Known Sids/Names, and the Built-in Domain and Account Domain
+ in the local SAM Database. If not all Sids or Names are
+ identified, performs a "handoff" of a Second level Lookup to the
+ LSA running on a Controller for the workstation's Primary Domain
+ (if any).
+
+ LsapLookupPDC - Second Level Lookup performed on a Primary Domain
+ Controller. The lookup searches the Account Domain of the
+ SAM Database on the controller. If not all Sids or Names are
+ found, the Trusted Domain List (TDL) is obtained from the
+ LSA's Policy Database and Third Level lookups are performed
+ via "handoff" to each Trusted Domain in the List.
+
+ LsapLookupTDL - Third Level Lookup performed on a controller
+ for a Trusted Domain. The lookup searches the Account Domain of
+ the SAM Database on the controller only.
+
+Return Values:
+
+ NTSTATUS - Standard Nt Result Code
+
+ STATUS_ACCESS_DENIED - Caller does not have the appropriate access
+ to complete the operation.
+
+ STATUS_SOME_NOT_MAPPED - Some or all of the names provided could
+ not be mapped. This is an informational status only.
+
+ STATUS_INSUFFICIENT_RESOURCES - Insufficient system resources
+ to complete the call.
+--*/
+
+
+
+NTSTATUS
+LsaICLookupSids(
+ IN LSA_HANDLE PolicyHandle,
+ IN ULONG Count,
+ IN PSID *Sids,
+ OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains,
+ OUT PLSA_TRANSLATED_NAME *Names,
+ IN LSAP_LOOKUP_LEVEL LookupLevel,
+ IN OUT PULONG MappedCount
+ );
+
+/*++
+
+Routine Description:
+
+ WARNING! THIS FUNCTION IS NOT COMPLETELY IMPLEMENTED. ONLY SIDS
+ MAPPABLE AT THE LOCAL SYSTEM WILL BE TRANSLATED.
+
+ The LsaLookupSids API attempts to find names corresponding to Sids.
+ If a name can not be mapped to a Sid, the Sid is converted to character
+ form. The caller must have POLICY_LOOKUP_NAMES access to the Policy
+ object.
+
+ WARNING: This routine allocates memory for its output. The caller is
+ responsible for freeing this memory after use. See description of the
+ Names parameter.
+
+Arguments:
+
+ PolicyHandle - Handle from an LsaOpenPolicy call.
+
+ Count - Specifies the number of Sids to be translated.
+
+ Sids - Pointer to an array of Count pointers to Sids to be mapped
+ to names. The Sids may be well_known SIDs, SIDs of User accounts
+ Group Accounts, Alias accounts, or Domains.
+
+ ReferencedDomains - Receives a pointer to a structure describing the
+ domains used for the translation. The entries in this structure
+ are referenced by the strutcure returned via the Names parameter.
+ Unlike the Names paraemeter, which contains an array entry
+ for (each translated name, this strutcure will only contain
+ component for each domain utilized in the translation.
+
+ When this information is no longer needed, it must be released
+ by passing the returned pointer to LsaFreeMemory().
+
+ Names - Receives a pointer to array records describing each translated
+ name. The nth entry in this array provides a translation for
+ the nth entry in the Sids parameter.
+
+ All of the retruned names will be isolated names or NULL strings
+ (domain names are returned as NULL strings). If the caller needs
+ composite names, they can be generated by prepending the
+ isolated name with the domain name and a backslash. For example,
+ if (the name Sally is returned, and it is from the domain Manufact,
+ then the composite name would be "Manufact" + "\" + "Sally" or
+ "Manufact\Sally".
+
+ When this information is no longer needed, it must be released
+ by passing the returned pointer to LsaFreeMemory().
+
+ If a Sid is not translatable, then the following will occur:
+
+ 1) If the SID's domain is known, then a reference domain record
+ will be generated with the domain's name. In this case, the
+ name returned via the Names parameter is a Unicode representation
+ of the relative ID of the account, such as "(314)" or the null
+ string, if the Sid is that of a domain. So, you might end up
+ with a resultant name of "Manufact\(314) for the example with
+ Sally above, if Sally's relative id is 314.
+
+ 2) If not even the SID's domain could be located, then a full
+ Unicode representation of the SID is generated and no domain
+ record is referenced. In this case, the returned string might
+ be something like: "(S-1-672194-21-314)".
+
+ When this information is no longer needed, it must be released
+ by passing the returned pointer to LsaFreeMemory().
+
+ LookupLevel - Specifies the Level of Lookup to be performed on this
+ machine. Values of this field are are follows:
+
+ LsapLookupWksta - First Level Lookup performed on a workstation
+ normally configured for Windows-Nt. The lookup searches the
+ Well-Known Sids/Names, and the Built-in Domain and Account Domain
+ in the local SAM Database. If not all Sids or Names are
+ identified, performs a "handoff" of a Second level Lookup to the
+ LSA running on a Controller for the workstation's Primary Domain
+ (if any).
+
+ LsapLookupPDC - Second Level Lookup performed on a Primary Domain
+ Controller. The lookup searches the Account Domain of the
+ SAM Database on the controller. If not all Sids or Names are
+ found, the Trusted Domain List (TDL) is obtained from the
+ LSA's Policy Database and Third Level lookups are performed
+ via "handoff" to each Trusted Domain in the List.
+
+ LsapLookupTDL - Third Level Lookup performed on a controller
+ for a Trusted Domain. The lookup searches the Account Domain of
+ the SAM Database on the controller only.
+
+Return Values:
+
+ NTSTATUS - Standard Nt Result Code
+
+ STATUS_ACCESS_DENIED - Caller does not have the appropriate access
+ to complete the operation.
+
+ STATUS_SOME_NOT_MAPPED - Some or all of the names provided could not be
+ mapped. This is a warning only.
+
+ Rest TBS
+--*/
+
+#endif // _LSAICLI_
diff --git a/private/inc/lsaimp.h b/private/inc/lsaimp.h
new file mode 100644
index 000000000..3b70486b7
--- /dev/null
+++ b/private/inc/lsaimp.h
@@ -0,0 +1,27 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ lsaimp.h
+
+Abstract:
+
+ Local Security Authority Protected Subsystem - Private Includes
+
+Author:
+
+ Scott Birrell (ScottBi) April 24, 1991
+
+Environment:
+
+Revision History:
+
+--*/
+
+#include <nt.h>
+#include <ntlsa.h>
+#include <windef.h>
+#include <lsass.h>
+#include <lsaicli.h>
diff --git a/private/inc/lsaisrv.h b/private/inc/lsaisrv.h
new file mode 100644
index 000000000..0c2a348e2
--- /dev/null
+++ b/private/inc/lsaisrv.h
@@ -0,0 +1,228 @@
+/*++ BUILD Version: 0001 // Increment this if a change has global effects
+
+Copyright (c) 1992 Microsoft Corporation
+
+Module Name:
+
+ lsaisrv.h
+
+Abstract:
+
+ This file contains interfaces to internal routines in the Lsa
+ Server that provide additional functionality not contained in
+ the Lsar routines. These routines are only used by LSA clients which
+ live in the same process as the LSA server.
+
+
+Author:
+
+ Scott Birrell (ScottBi) April 8, 1992
+
+Environment:
+
+ User Mode - Win32
+
+Revision History:
+
+
+--*/
+
+#ifndef _LSAISRV_
+#define _LSAISRV_
+
+
+
+//
+// Caller's of the health check routine
+//
+
+#define LsaIHealthLsaInitialized (1)
+#define LsaIHealthSamJustLocked (2)
+#define LsaIHealthSamAboutToFree (3)
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// The following prototypes are usable throughout the process that the //
+// LSA server resides in. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+VOID
+LsaIHealthCheck(
+ IN ULONG CallerId
+ );
+
+NTSTATUS
+LsaIOpenPolicyTrusted(
+ OUT PLSAPR_HANDLE PolicyHandle
+ );
+
+NTSTATUS
+LsaIQueryInformationPolicyTrusted(
+ IN POLICY_INFORMATION_CLASS InformationClass,
+ OUT PLSAPR_POLICY_INFORMATION *Buffer
+ );
+
+NTSTATUS
+LsaIGetSerialNumberPolicy(
+ IN LSAPR_HANDLE PolicyHandle,
+ OUT PLARGE_INTEGER ModifiedCount,
+ OUT PLARGE_INTEGER CreationTime
+ );
+
+NTSTATUS
+LsaISetSerialNumberPolicy(
+ IN LSAPR_HANDLE PolicyHandle,
+ IN PLARGE_INTEGER ModifiedCount,
+ IN PLARGE_INTEGER CreationTime,
+ IN BOOLEAN StartOfFullSync
+ );
+
+NTSTATUS
+LsaIGetSerialNumberPolicy2(
+ IN LSAPR_HANDLE PolicyHandle,
+ OUT PLARGE_INTEGER ModifiedCount,
+ OUT PLARGE_INTEGER ModifiedCountAtLastPromotion,
+ OUT PLARGE_INTEGER CreationTime
+ );
+
+NTSTATUS
+LsaISetSerialNumberPolicy2(
+ IN LSAPR_HANDLE PolicyHandle,
+ IN PLARGE_INTEGER ModifiedCount,
+ IN PLARGE_INTEGER ModifiedCountAtLastPromotion OPTIONAL,
+ IN PLARGE_INTEGER CreationTime,
+ IN BOOLEAN StartOfFullSync
+ );
+
+NTSTATUS
+LsaIGetPrivateData(
+ IN LSAPR_HANDLE PolicyHandle,
+ OUT PULONG DataLength,
+ OUT PVOID *Data
+ );
+
+NTSTATUS
+LsaISetPrivateData(
+ IN LSAPR_HANDLE PolicyHandle,
+ IN ULONG DataLength,
+ IN PVOID Data
+ );
+
+NTSTATUS
+LsaIEnumerateSecrets(
+ IN LSAPR_HANDLE PolicyHandle,
+ IN OUT PLSA_ENUMERATION_HANDLE EnumerationContext,
+ OUT PVOID *Buffer,
+ IN ULONG PreferedMaximumLength,
+ OUT PULONG CountReturned
+ );
+
+NTSTATUS
+LsaISetTimesSecret(
+ IN LSAPR_HANDLE SecretHandle,
+ IN PLARGE_INTEGER CurrentValueSetTime,
+ IN PLARGE_INTEGER OldValueSetTime
+ );
+
+BOOLEAN
+LsaISetupWasRun(
+ );
+
+VOID
+LsaIFree_LSAPR_ACCOUNT_ENUM_BUFFER (
+ IN PLSAPR_ACCOUNT_ENUM_BUFFER EnumerationBuffer
+ );
+
+VOID
+LsaIFree_LSAPR_TRANSLATED_SIDS (
+ IN PLSAPR_TRANSLATED_SIDS TranslatedSids
+ );
+
+VOID
+LsaIFree_LSAPR_TRANSLATED_NAMES (
+ IN PLSAPR_TRANSLATED_NAMES TranslatedNames
+ );
+
+VOID
+LsaIFree_LSAPR_POLICY_INFORMATION (
+ IN POLICY_INFORMATION_CLASS InformationClass,
+ IN PLSAPR_POLICY_INFORMATION PolicyInformation
+ );
+
+VOID
+LsaIFree_LSAPR_TRUSTED_DOMAIN_INFO (
+ IN TRUSTED_INFORMATION_CLASS InformationClass,
+ IN PLSAPR_TRUSTED_DOMAIN_INFO TrustedDomainInformation
+ );
+
+VOID
+LsaIFree_LSAPR_REFERENCED_DOMAIN_LIST (
+ IN PLSAPR_REFERENCED_DOMAIN_LIST ReferencedDomains
+ );
+
+VOID
+LsaIFree_LSAPR_TRUSTED_ENUM_BUFFER (
+ IN PLSAPR_TRUSTED_ENUM_BUFFER EnumerationBuffer
+ );
+
+VOID
+LsaIFree_LSAPR_TRUST_INFORMATION (
+ IN PLSAPR_TRUST_INFORMATION TrustInformation
+ );
+
+VOID
+LsaIFree_LSAP_SECRET_ENUM_BUFFER (
+ IN PVOID Buffer,
+ IN ULONG Count
+ );
+
+VOID
+LsaIFree_LSAPR_PRIVILEGE_ENUM_BUFFER (
+ PLSAPR_PRIVILEGE_ENUM_BUFFER EnumerationBuffer
+ );
+
+VOID
+LsaIFree_LSAPR_SR_SECURITY_DESCRIPTOR (
+ IN PLSAPR_SR_SECURITY_DESCRIPTOR SecurityDescriptor
+ );
+
+VOID
+LsaIFree_LSAP_PRIVATE_DATA (
+ IN PVOID Data
+ );
+
+VOID
+LsaIFree_LSAPR_UNICODE_STRING (
+ IN PLSAPR_UNICODE_STRING UnicodeName
+ );
+
+VOID
+LsaIFree_LSAPR_PRIVILEGE_SET (
+ IN PLSAPR_PRIVILEGE_SET PrivilegeSet
+ );
+
+VOID
+LsaIFree_LSAPR_CR_CIPHER_VALUE (
+ IN PLSAPR_CR_CIPHER_VALUE CipherValue
+ );
+
+NTSTATUS
+LsaIAuditSamEvent(
+ IN NTSTATUS Status,
+ IN ULONG AuditId,
+ IN PSID DomainSid,
+ IN PULONG MemberRid OPTIONAL,
+ IN PSID MemberSid OPTIONAL,
+ IN PUNICODE_STRING AccountName OPTIONAL,
+ IN PUNICODE_STRING DomainName,
+ IN PULONG AccountRid OPTIONAL,
+ IN PPRIVILEGE_SET Privileges OPTIONAL
+ );
+
+VOID
+LsaIAuditNotifyPackageLoad(
+ PUNICODE_STRING PackageFileName
+ );
+
+#endif // _LSAISRV_
diff --git a/private/inc/lsass.h b/private/inc/lsass.h
new file mode 100644
index 000000000..ba5d85a8d
--- /dev/null
+++ b/private/inc/lsass.h
@@ -0,0 +1,51 @@
+/*++
+
+Copyright (c) 1987-1991 Microsoft Corporation
+
+Module Name:
+
+ lsass.h
+
+Abstract:
+
+ This is a common header file for all codes that go in lsass.exe (ie
+ in security process).
+
+Author:
+
+ Madan Appiah (madana) 23-Mar-1993
+
+Environment:
+
+ User mode only.
+ Contains NT-specific code.
+ Requires ANSI C extensions: slash-slash comments, long external names.
+
+Revision History:
+
+--*/
+
+#ifndef _LSASS_
+#define _LSASS_
+
+//
+// DON'T USE the following LARGE_INTEGER definitions. These definitions
+// are used only by few old RPC code for compatibilty reason.
+//
+
+typedef struct _OLD_LARGE_INTEGER {
+ ULONG LowPart;
+ LONG HighPart;
+} OLD_LARGE_INTEGER, *POLD_LARGE_INTEGER;
+
+#define OLD_TO_NEW_LARGE_INTEGER(Old, New) { \
+ (New).LowPart = (Old).LowPart; \
+ (New).HighPart = (Old).HighPart; \
+ }
+
+#define NEW_TO_OLD_LARGE_INTEGER(New, Old) { \
+ (Old).LowPart = (New).LowPart; \
+ (Old).HighPart = (New).HighPart; \
+ }
+
+#endif // _LSASS
diff --git a/private/inc/mmcommon.h b/private/inc/mmcommon.h
new file mode 100644
index 000000000..5aa295dc9
--- /dev/null
+++ b/private/inc/mmcommon.h
@@ -0,0 +1,39 @@
+/***************************************************************************
+ * mmcommon.h
+ *
+ * Copyright (c) Microsoft Corporation 1996. All rights reserved
+ *
+ * private include file for definitions common to the NT project
+ *
+ * History
+ *
+ * 16 Feb 96 - NoelC created
+ *
+ ***************************************************************************/
+
+/***************************************************************************
+
+
+ Common definitions needed for wx86
+
+
+ ***************************************************************************/
+
+#define WOD_MESSAGE "wodMessage"
+#define WID_MESSAGE "widMessage"
+#define MOD_MESSAGE "modMessage"
+#define MID_MESSAGE "midMessage"
+#define AUX_MESSAGE "auxMessage"
+
+
+#define MMDRVI_TYPE 0x000F /* low 4 bits give driver type */
+#define MMDRVI_WAVEIN 0x0001
+#define MMDRVI_WAVEOUT 0x0002
+#define MMDRVI_MIDIIN 0x0003
+#define MMDRVI_MIDIOUT 0x0004
+#define MMDRVI_AUX 0x0005
+#define MMDRVI_MIDISTRM 0x0006
+
+#define MMDRVI_MAPPER 0x8000 /* install this driver as the mapper */
+#define MMDRVI_HDRV 0x4000 /* hDriver is a installable driver */
+#define MMDRVI_REMOVE 0x2000 /* remove the driver */
diff --git a/private/inc/mpr.h b/private/inc/mpr.h
new file mode 100644
index 000000000..1f123e067
--- /dev/null
+++ b/private/inc/mpr.h
@@ -0,0 +1,512 @@
+/*++
+
+Copyright (c) 1991-1993 Microsoft Corporation
+
+Module Name:
+
+ mpr.h
+
+Abstract:
+
+ Standard MPR Header File for NT-WIN32
+
+Author:
+
+ John Ludeman (Johnl) 10-Dec-1991
+
+Environment:
+
+ User Mode -Win32
+
+Notes:
+
+ This is a private header file specific to the multiple provider and
+ the windows shell.
+
+Revision History:
+
+ 10-Dec-1991 Johnl
+ Created
+
+ 13-Jan-1992 Johnl
+ Moved return codes specific to WNetRestoreConnection from winnet32.h
+ to here.
+
+ 24-Jan-1992 Johnl
+ Added additional APIs for support of Filemanager's toolbar
+
+ 19-Mar-1992 JohnL
+ Added WNetNukeConnections
+
+ 12-May-1992 Johnl
+ Removed "I_" from I_WNetConnect/DisconnectDialog,
+ Added WNNC_DLG_Disconnect and WNNC_DLG_Connect manifests
+
+ 05-Aug-1992 AlbertT
+ Added extra BOOL bFlushCache to WNetGetDirectoryType{A,W}
+
+ 26-Aug-1992 Johnl
+ Renamed WNetNukeConnections to WNetClearConnections
+
+ Nov-5-1992 CongpaY
+ Add structures _CONNECT_INFO, PARAMETERS, ERRORDLGPARAMETERS
+ and functions DoPassordDialog, DoProfileErrorDialog
+ and ShowReconnectDialog. They are used by restoring connection.
+
+ 07-Nov-1992 ChuckC
+ Added WNetDisconnectDialog2 and WNetConnectionDialog2 for help
+ support.
+
+ 12-Nov-1992 Yi-HsinS
+ Added WNetBrowsePrinterDialog, WNetBrowseDialog
+
+ 20-Dec-1992 Yi-HsinS
+ Added WNetGetFormatNameProc
+
+ 29-Dec-1992 Johnl
+ Added WNetGetConnection2
+
+ 07-Jan-1993 Danl
+ Added Credential Management API
+
+ 29-Jun-1994 JonN
+ Added parameter to DoProfileErrorDialog
+
+ 23-Mar-1995 AnirudhS
+ Added WNFMT_* manifests
+
+ 12-Jul-1995 Anirudhs
+ Removed things defined in winnetwk.h and winnetp.h
+
+--*/
+#include <lmcons.h>
+#ifndef _MPR_H_INCLUDED
+#define _MPR_H_INCLUDED
+
+//For restoring connection stuff. Add by congpay.
+// const used by connect.c
+#define SHOW_CONNECTION (WM_USER+200)
+#define DO_PASSWORD_DIALOG (WM_USER + 201)
+#define DO_ERROR_DIALOG (WM_USER + 202)
+
+// types used by connect.c
+
+typedef struct _CONNECTION_INFO *LPCONNECTION_INFO;
+
+// The following two structures are used by two threads in mpr.dll and
+// mprui.dll to share data.
+
+typedef struct _PARAMETERS {
+ HWND hDlg;
+ HANDLE hDlgCreated; //Initialized in WNetRestoreConnection
+ HANDLE hDlgFailed; //Initialized in WNetRestoreConnection
+ HANDLE hDonePassword; //Initialized in WNetRestoreConnection
+ TCHAR * pchResource; //ShowReconnectDialog, DoRestoreConnection
+ TCHAR * pchUserName; //For DoPasswordDialog
+ TCHAR passwordBuffer[UNLEN+1]; //Used by WNetRestoreThisConnection
+ BOOL fSuccess; //For the DoPasswordDialog
+ BOOL fDidCancel; //For the DoPasswordDialog
+ BOOL fDownLevel; //FALSE if error==ERROR_LOGON_FAILURE
+ BOOL fTerminateThread; //TRUE if we want the second thread to be end
+ DWORD status; //return value from DoRestoreConnection
+ DWORD numSubKeys; //Initialized in WNetRestoreConnection
+ DWORD RegMaxWait;
+ LPCONNECTION_INFO ConnectArray; //Initialized in WNetRestoreConnection
+ }PARAMETERS;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//function load from mprui.dll.
+
+DWORD DoPasswordDialog(
+ HWND hwndOwner,
+ TCHAR * pchResource,
+ TCHAR * pchUserName,
+ TCHAR * pchPasswordReturnBuffer,
+ DWORD cbPasswordReturnBuffer, // bytes!
+ BOOL * pfDidCancel,
+ BOOL fDownLevel
+ );
+
+DWORD DoProfileErrorDialog(
+ HWND hwndOwner,
+ const TCHAR * pchDevice,
+ const TCHAR * pchResource,
+ const TCHAR * pchProvider,
+ DWORD dwError,
+ BOOL fAllowCancel, // ask whether to stop reconnecting devices
+ // this time?
+ BOOL * pfDidCancel, // stop reconnecting devices this time?
+ // active iff fAllowCancel
+ BOOL * pfDisconnect, // do not reconnect this device in future?
+ BOOL * pfHideErrors // stop displaying error dialogs this time?
+ // active iff fAllowCancel
+ );
+
+DWORD ShowReconnectDialog (
+ HWND hwndParent,
+ PARAMETERS * Params);
+
+//
+// Return codes from WNetRestoreConnection
+//
+#define WN_CONTINUE 0x00000BB9
+
+DWORD APIENTRY
+RestoreConnectionA0(
+ HWND hWnd,
+ LPSTR lpDevice
+ );
+
+DWORD APIENTRY
+WNetClearConnections(
+ HWND hWnd
+ ) ;
+
+//
+// Authentication Provider (Credential Management) Functions
+//
+
+DWORD APIENTRY
+WNetLogonNotify(
+ LPCWSTR lpPrimaryAuthenticator,
+ PLUID lpLogonId,
+ LPCWSTR lpAuthentInfoType,
+ LPVOID lpAuthentInfo,
+ LPCWSTR lpPreviousAuthentInfoType,
+ LPVOID lpPreviousAuthentInfo,
+ LPWSTR lpStationName,
+ LPVOID StationHandle,
+ LPWSTR *lpLogonScripts
+ );
+
+DWORD APIENTRY
+WNetPasswordChangeNotify(
+ LPCWSTR lpPrimaryAuthenticator,
+ LPCWSTR lpAuthentInfoType,
+ LPVOID lpAuthentInfo,
+ LPCWSTR lpPreviousAuthentInfoType,
+ LPVOID lpPreviousAuthentInfo,
+ LPWSTR lpStationName,
+ LPVOID StationHandle,
+ DWORD dwChangeInfo
+ );
+
+//
+// Directory functions
+//
+DWORD
+WNetGetDirectoryTypeA (
+ LPSTR lpName,
+ LPDWORD lpType,
+ BOOL bFlushCache
+ );
+
+DWORD
+WNetGetDirectoryTypeW (
+ LPTSTR lpName,
+ LPINT lpType,
+ BOOL bFlushCache
+ );
+
+#ifdef UNICODE
+#define WNetGetDirectoryType WNetGetDirectoryTypeW
+#else
+#define WNetGetDirectoryType WNetGetDirectoryTypeA
+#endif // UNICODE
+
+
+DWORD
+WNetDirectoryNotifyA (
+ HWND hwnd,
+ LPSTR lpDir,
+ DWORD dwOper
+ );
+
+DWORD
+WNetDirectoryNotifyW (
+ HWND hwnd,
+ LPTSTR lpDir,
+ DWORD dwOper
+ );
+
+#ifdef UNICODE
+#define WNetDirectoryNotify WNetDirectoryNotifyW
+#else
+#define WNetDirectoryNotify WNetDirectoryNotifyA
+#endif // UNICODE
+
+
+DWORD
+WNetPropertyDialogA (
+ HWND hwndParent,
+ DWORD iButton,
+ DWORD nPropSel,
+ LPSTR lpszName,
+ DWORD nType
+ );
+
+DWORD
+WNetPropertyDialogW (
+ HWND hwndParent,
+ DWORD iButton,
+ DWORD nPropSel,
+ LPTSTR lpszName,
+ DWORD nType
+ );
+
+#ifdef UNICODE
+#define WNetPropertyDialog WNetPropertyDialogW
+#else
+#define WNetPropertyDialog WNetPropertyDialogA
+#endif // UNICODE
+
+
+DWORD
+WNetGetPropertyTextA (
+ DWORD iButton,
+ DWORD nPropSel,
+ LPSTR lpszName,
+ LPSTR lpszButtonName,
+ DWORD nButtonNameLength,
+ DWORD nType
+ );
+
+DWORD
+WNetGetPropertyTextW (
+ DWORD iButton,
+ DWORD nPropSel,
+ LPTSTR lpszName,
+ LPTSTR lpszButtonName,
+ DWORD nButtonNameLength,
+ DWORD nType
+ );
+
+#ifdef UNICODE
+#define WNetGetPropertyText WNetGetPropertyTextW
+#else
+#define WNetGetPropertyText WNetGetPropertyTextA
+#endif // UNICODE
+
+typedef struct _WNET_CONNECTINFOA
+{
+ LPSTR lpRemoteName ;
+ LPSTR lpProvider ;
+} WNET_CONNECTIONINFOA, *LPWNET_CONNECTIONINFOA ;
+
+typedef struct _WNET_CONNECTINFOW
+{
+ LPWSTR lpRemoteName ;
+ LPWSTR lpProvider ;
+} WNET_CONNECTIONINFOW, *LPWNET_CONNECTIONINFOW ;
+
+#ifdef UNICODE
+#define WNET_CONNECTIONINFO WNET_CONNECTIONINFOW
+#define LPWNET_CONNECTIONINFO LPWNET_CONNECTIONINFOW
+#else
+#define WNET_CONNECTIONINFO WNET_CONNECTIONINFOA
+#define LPWNET_CONNECTIONINFO LPWNET_CONNECTIONINFOA
+#endif // UNICODE
+
+//
+// Used in conjunction with WNET_CONNECTIONINFO, gets the net provider name
+// in addition to the remote name for this connection.
+//
+DWORD
+WNetGetConnection2A(
+ LPSTR lpLocalName,
+ LPVOID lpBuffer, // Contains WNET_CONNECTIONINFOA struct
+ LPDWORD lpBufferSize // In bytes!
+ ) ;
+
+DWORD
+WNetGetConnection2W(
+ LPWSTR lpLocalName,
+ LPVOID lpBuffer, // Contains WNET_CONNECTIONINFOW struct
+ LPDWORD lpBufferSize // In bytes!
+ ) ;
+
+#ifdef UNICODE
+#define WNetGetConnection2 WNetGetConnection2W
+#else
+#define WNetGetConnection2 WNetGetConnection2A
+#endif // UNICODE
+
+//
+// Versions of the dialog with the ability to supply help.
+// These are not in Win32 because we do not want to force
+// nor encourage apps to have to document the way these
+// dialogs work, since they are liable to change.
+//
+DWORD WNetConnectionDialog2 (
+ HWND hwndParent,
+ DWORD dwType,
+ WCHAR *lpHelpFile,
+ DWORD nHelpContext
+ );
+
+DWORD WNetDisconnectDialog2 (
+ HWND hwndParent,
+ DWORD dwType,
+ WCHAR *lpHelpFile,
+ DWORD nHelpContext
+ );
+
+
+//
+// Browse dialog
+//
+
+// Type of the callback routine used by the browse dialog to validate
+// the path input by the user
+typedef BOOL (*PFUNC_VALIDATION_CALLBACK)( LPWSTR pszName );
+
+// WNetBrowseDialog and WNetBrowsePrinterDialog
+// NOTE: WNetBrowsePrintDialog =
+// WNetBrowseDialog with dwType RESOURCETYPE_PRINT
+//
+/*******************************************************************
+
+ NAME: WNetBrowseDialog, WNetBrowsePrinterDialog
+
+ SYNOPSIS: Presents a dialog to the user from which the user can
+ browse the network for disk or print shares.
+
+ ENTRY: hwndParent - Parent window handle
+ dwType - ( Only in WNetBrowseDialog )
+ RESOURCETYPE_DISK or RESOURCETYPE_PRINT
+ lpszName - The path name typed by the user. It will be
+ undefined if the user hits the CANCEL button.
+ cchBufSize - The buffer size of the lpszName in characters
+ lpszHelpFile- The helpfile to use when the user hits F1.
+ nHelpContext- The helpcontext to use for the helpfile above
+ pfuncValidation - Callback method to validate the path typed
+ by the user. If NULL, no validation will
+ be done.
+
+ RETURNS: WN_CANCEL when the user cancels the dialog. NO_ERROR
+ on success, standard ERROR_* error code otherwise
+
+ NOTES: This is a UNICODE only API.
+
+ HISTORY:
+ Yi-HsinS 22-Nov-1992 Created
+
+********************************************************************/
+
+DWORD WNetBrowseDialog(
+ HWND hwndParent,
+ DWORD dwType,
+ WCHAR *lpszName,
+ DWORD cchBufSize,
+ WCHAR *lpszHelpFile,
+ DWORD nHelpContext,
+ PFUNC_VALIDATION_CALLBACK pfuncValidation );
+
+DWORD WNetBrowsePrinterDialog(
+ HWND hwndParent,
+ WCHAR *lpszName,
+ DWORD cchBufSize,
+ WCHAR *lpszHelpFile,
+ DWORD nHelpContext,
+ PFUNC_VALIDATION_CALLBACK pfuncValidation );
+
+//
+// stuff in user, not driver, for shell apps ;Internal
+//
+DWORD APIENTRY WNetErrorText(DWORD,LPTSTR,DWORD); // ;Internal
+
+//
+// used by MPRUI.DLL to determine if a provider supports
+// NpSearchDialog() and obtain to a pointer to it.
+//
+FARPROC WNetGetSearchDialog(LPWSTR lpProvider) ;
+
+//
+// used by MPRUI.DLL to determine if a provider supports
+// NPFormatNetworkName() and obtain a pointer to it.
+//
+FARPROC WNetGetFormatNameProc(LPWSTR lpProvider) ;
+
+//
+// used by MPRUI.DLL to determine if a provider supports
+// WNNC_ENUM_GLOBAL
+//
+BOOL WNetSupportGlobalEnum(LPWSTR lpProvider) ;
+
+//
+// used by ACLEDIT.DLL to get provider-specific permission editor
+//
+
+DWORD WNetFMXGetPermCaps( LPWSTR lpDriveName ) ;
+DWORD WNetFMXEditPerm( LPWSTR lpDriveName, HWND hwndFMX, DWORD nDialogType );
+DWORD WNetFMXGetPermHelp( LPWSTR lpDriveName,
+ DWORD nDialogType,
+ BOOL fDirectory,
+ LPVOID lpFileNameBuffer,
+ LPDWORD lpBufferSize,
+ LPDWORD lpnHelpContext );
+
+//
+// sections and keys used for persistent connections
+//
+
+#define WNNC_DLG_DISCONNECT 0x0008
+#define WNNC_DLG_CONNECT 0x0004
+
+#ifdef UNICODE
+
+#define MPR_MRU_FILE_SECTION L"NET_Files"
+#define MPR_MRU_PRINT_SECTION L"NET_Printers"
+#define MPR_MRU_ORDER_KEY L"Order"
+
+#define MPR_NETWORK_SECTION L"Network"
+#define MPR_SAVECONNECTION_KEY L"SaveConnections"
+#define MPR_RESTORECONNECTION_KEY L"RestoreConnections"
+#define MPR_EXPANDLOGONDOMAIN_KEY L"ExpandLogonDomain"
+
+#define MPR_YES_VALUE L"yes"
+#define MPR_NO_VALUE L"no"
+
+#else
+
+#define MPR_MRU_FILE_SECTION "NET_Files"
+#define MPR_MRU_PRINT_SECTION "NET_Printers"
+#define MPR_MRU_ORDER_KEY "Order"
+
+#define MPR_NETWORK_SECTION "Network"
+#define MPR_SAVECONNECTION_KEY "SaveConnections"
+#define MPR_RESTORECONNECTION_KEY "RestoreConnections"
+#define MPR_EXPANDLOGONDOMAIN_KEY "ExpandLogonDomain"
+
+#define MPR_YES_VALUE "yes"
+#define MPR_NO_VALUE "no"
+
+#endif // UNICODE
+
+
+//
+// Internal NP interface used to help the NTLM provider remember
+// whether a persistent connection is a DFS connection or not
+//
+
+DWORD APIENTRY
+NPGetReconnectFlags (
+ IN LPWSTR lpLocalName,
+ OUT LPBYTE lpPersistFlags
+ );
+typedef DWORD (*PF_NPGetReconnectFlags) (
+ LPWSTR lpLocalName,
+ LPBYTE lpPersistFlags
+ );
+
+// This macro operates on the dwFlags parameter of NPAddConnection3
+#define CONNECT_PROVIDER_FLAGS(dwFlags) ((BYTE) (((dwFlags) & 0xFF000000) >> 24))
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _MPR_H_INCLUDED
diff --git a/private/inc/msgtext.h b/private/inc/msgtext.h
new file mode 100644
index 000000000..24c3792e6
--- /dev/null
+++ b/private/inc/msgtext.h
@@ -0,0 +1,134 @@
+/*++ BUILD Version: 0001 // Increment this if a change has global effects
+
+Copyright (c) 1987-1991 Microsoft Corporation
+
+Module Name:
+
+ apperr.h
+
+Abstract:
+
+ This file contains the number and text of miscellaneous error
+ messages.
+
+Author:
+
+ Cliff Van Dyke (CliffV) 4-Nov-1991
+
+Environment:
+
+ User Mode - Win32
+ Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
+ Requires ANSI C extensions: slash-slash comments.
+
+--*/
+
+
+#define MTXT_BASE 3300
+
+
+/**INTERNAL_ONLY**/
+
+/*** WARNING *** WARNING *** WARNING ****
+ * *
+ * The redirector has hardcoded in its *
+ * makefile some message numbers used *
+ * at startup. If you change MTXT_BASE *
+ * or any of the redirs message numbers *
+ * you must also fix the redir makefile *
+ * where it generates netwksta.pro *
+ * *
+ ****************************************/
+
+/************* WARNING ***************
+ * See the comment in netcons.h for *
+ * info on the allocation of errors *
+ *************************************/
+
+/**END_INTERNAL**/
+
+/* Share remarks, must be <= MAXCOMMENTSZ bytes.
+ */
+
+#define MTXT_IPC_SHARE_REMARK MTXT_BASE+1 /* @I Remote IPC %0 */
+#define MTXT_ADMIN_SHARE_REMARK MTXT_BASE+2 /* @I Remote Admin %0 */
+#define MTXT_LOGON_SRV_SHARE_REMARK MTXT_BASE+3 /* @I Logon server share %0 */
+
+
+#define MTXT_WKSTA_ERR_POPUP_HDR MTXT_BASE+4 /* @I A network error occurred. %0 */
+
+/* NetWksta installation messages.
+ */
+
+#define MTXT_MemAllocMsg (MTXT_BASE+100) /* There is not enough memory to start the Workstation service. */
+#define MTXT_IniFilRdErr (MTXT_BASE+101) /* An error occurred when reading the NETWORKS entry in the LANMAN.INI file. */
+#define MTXT_BadArgMsg (MTXT_BASE+102) /* This is an invalid argument: %1. */
+#define MTXT_BadNetEntHdr (MTXT_BASE+103) /* @W The %1 NETWORKS entry in the LANMAN.INI file has a
+ * syntax error and will be ignored.
+ */
+#define MTXT_MultNetsMsg (MTXT_BASE+104) /* There are too many NETWORKS entries in the LANMAN.INI file. */
+/* UNUSED (MTXT_BASE+105) */
+#define MTXT_BadBiosMsg (MTXT_BASE+106) /* @W An error occurred when opening network
+ * device driver %1 = %2.
+ */
+#define MTXT_BadLinkMsg (MTXT_BASE+107) /* @W Device driver %1 sent a bad BiosLinkage response.*/
+#define MTXT_BadVerMsg (MTXT_BASE+108) /* The program cannot be used with this operating system. */
+#define MTXT_RdrInstMsg (MTXT_BASE+109) /* The redirector is already installed. */
+#define MTXT_Version (MTXT_BASE+110) /* @I Installing NETWKSTA.SYS Version %1.%2.%3 (%4)
+ *
+ */
+#define MTXT_RdrInstlErr (MTXT_BASE+111) /* There was an error installing NETWKSTA.SYS.
+ *
+ * Press ENTER to continue.
+ */
+#define MTXT_BadResolver (MTXT_BASE+112) /* Resolver linkage problem. */
+
+/*
+ * Forced Logoff error messages
+ */
+
+#define MTXT_Expiration_Warning (MTXT_BASE + 113) /* @I
+ * Your logon time at %1 ends at %2.
+ * Please clean up and log off.
+ */
+
+#define MTXT_Logoff_Warning (MTXT_BASE + 114) /* @I
+ *
+ * You will be automatically disconnected at %1.
+ */
+
+#define MTXT_Expiration_Message (MTXT_BASE + 115) /* @I
+ * Your logon time at %1 has ended.
+ */
+
+#define MTXT_Past_Expiration_Message (MTXT_BASE + 116) /* @I
+ * Your logon time at %1 ended at %2.
+ */
+
+#define MTXT_Immediate_Kickoff_Warning (MTXT_BASE + 117) /* @I
+ * WARNING: You have until %1 to logoff. If you
+ * have not logged off at this time, your session will be
+ * disconnected, and any open files or devices you
+ * have open may lose data.
+ */
+
+#define MTXT_Kickoff_Warning (MTXT_BASE + 118) /* @I
+ * WARNING: You must log off at %1 now. You have
+ * two minutes to log off, or you will be disconnected.
+ */
+
+#define MTXT_Kickoff_File_Warning (MTXT_BASE + 119) /* @I
+ *
+ * You have open files or devices, and a forced
+ * disconnection may cause you to lose data.
+ */
+
+/* Servers default share remark */
+
+#define MTXT_Svr_Default_Share_Remark (MTXT_BASE + 120) /* @I
+ *Default Share for Internal Use %0*/
+
+/* Messenger Service Message Box Title */
+#define MTXT_MsgsvcTitle (MTXT_BASE + 121) /* @I
+ *Messenger Service %0*/
+
diff --git a/private/inc/mvaudio.h b/private/inc/mvaudio.h
new file mode 100644
index 000000000..5a149b0a8
--- /dev/null
+++ b/private/inc/mvaudio.h
@@ -0,0 +1,140 @@
+/*++ BUILD Version: 0001 // Increment this if a change has global effects
+
+
+Copyright (c) 1992 Microsoft Corporation
+
+Module Name:
+
+ mvaudio.h
+
+Abstract:
+
+ This include file defines constants and types for
+ the Media Vision pro audio spectrum sound card.
+
+ This header file is shared between the low level driver and the
+ kernel driver.
+
+Author:
+
+ Robin Speed (RobinSp)
+
+Revision History:
+
+--*/
+
+//
+// DriverEntry() error codes for the Registry
+// These are set in MVAUDIO.SYS
+//
+#define DRIVER_LOAD_OK 0x0000L
+#define ERROR_LOAD_FAIL 0x0001L
+#define ERROR_RESOURCE_CONFLICT 0x0002L
+#define ERROR_NO_HW_FOUND 0x0004L
+#define ERROR_INT_CONFLICT 0x0008L
+#define ERROR_DMA_CONFLICT 0x0010L
+
+//
+// Registry Strings
+// The other strings are located in SOUNDCFG.H in SOUNDLIB\INC
+//
+#define REG_VALUENAME_DRIVER_STATUS (L"DriverStatus")
+#define SOUND_REG_FM_CLK_OVRID (L"FMClockOverride")
+#define SOUND_REG_ALLOWMICLINEINTOLINEOUT (L"AllowMicOrLineInToLineOut")
+
+//
+// Defaults
+//
+#define DEFAULT_DMA_CHANNEL 5
+#define DEFAULT_IRQ_CHANNEL 10
+
+
+#define IDS_WAVEOUT_PNAME 101
+#define IDS_WAVEIN_PNAME 102
+#define IDS_MIDIOUT_PNAME 103
+#define IDS_MIDIIN_PNAME 104
+#define IDS_AUX_PNAME 105
+#define IDS_SYNTH_PNAME 106
+#define IDS_MIXER_PNAME 107
+
+#define IDS_SRCMIDIOUT_SHORT_NAME 109
+#define IDS_SRCMIXER_SHORT_NAME 110
+#define IDS_SRCAUX1_SHORT_NAME 111
+#define IDS_SRCINTERNALCD_SHORT_NAME 112
+#define IDS_SRCMICOUT_SHORT_NAME 113
+#define IDS_SRCWAVEOUT_SHORT_NAME 114
+#define IDS_SRCAUX2_SHORT_NAME 115
+#define IDS_SRCPCSPEAKER_SHORT_NAME 116
+
+#define IDS_DESTLINEOUT_SHORT_NAME 117
+#define IDS_DESTWAVEIN_SHORT_NAME 118
+#define IDS_DESTVOICEIN_SHORT_NAME 119
+
+
+#define IDS_CONTROL_VOLLINEOUTMIDIOUT_SHORT_NAME 120
+#define IDS_CONTROL_VOLLINEOUTMIXER_SHORT_NAME 121
+#define IDS_CONTROL_VOLLINEOUTAUX1_SHORT_NAME 123
+#define IDS_CONTROL_VOLLINEOUTINTERNAL_SHORT_NAME 124
+#define IDS_CONTROL_VOLLINEOUTMIC_SHORT_NAME 125
+#define IDS_CONTROL_VOLLINEOUTWAVEOUT_SHORT_NAME 126
+#define IDS_CONTROL_VOLLINEOUTPCSPEAKER_SHORT_NAME 127
+#define IDS_CONTROL_VOLLINEOUTAUX2_SHORT_NAME 200
+#define IDS_CONTROL_VOLLINEOUT_SHORT_NAME 128
+#define IDS_CONTROL_VOLWAVEINMIDIOUT_SHORT_NAME 129
+#define IDS_CONTROL_VOLWAVEINAUX1_SHORT_NAME 130
+#define IDS_CONTROL_VOLWAVEININTERNAL_SHORT_NAME 131
+#define IDS_CONTROL_VOLWAVEINMIC_SHORT_NAME 132
+#define IDS_CONTROL_VOLWAVEINPCSPEAKER_SHORT_NAME 133
+#define IDS_CONTROL_VOLWAVEINAUX2_SHORT_NAME 201
+#define IDS_CONTROL_VOLRECORD_SHORT_NAME 134
+#define IDS_CONTROL_MUTELINEOUT_SHORT_NAME 135
+#define IDS_CONTROL_METERRECORD_SHORT_NAME 136
+#define IDS_CONTROL_MUXLINEOUT_SHORT_NAME 137
+#define IDS_CONTROL_MUXWAVEIN_SHORT_NAME 138
+#define IDS_CONTROL_VOICEINMUX_SHORT_NAME 139
+#define IDS_CONTROL_VOLBASS_SHORT_NAME 140
+#define IDS_CONTROL_VOLTREBLE_SHORT_NAME 141
+#define IDS_CONTROL_VOLVOICEINAUX1_SHORT_NAME 142
+#define IDS_CONTROL_VOLVOICEINMIC_SHORT_NAME 143
+#define IDS_CONTROL_VOLLOUDNESS_SHORT_NAME 144
+#define IDS_CONTROL_VOLSTEREOENH_SHORT_NAME 145
+
+#define IDS_SRCMIDIOUT_LONG_NAME 146
+#define IDS_SRCMIXER_LONG_NAME 147
+#define IDS_SRCAUX1_LONG_NAME 148
+#define IDS_SRCINTERNALCD_LONG_NAME 149
+#define IDS_SRCMICOUT_LONG_NAME 150
+#define IDS_SRCWAVEOUT_LONG_NAME 151
+#define IDS_SRCAUX2_LONG_NAME 152
+#define IDS_SRCPCSPEAKER_LONG_NAME 153
+
+#define IDS_DESTLINEOUT_LONG_NAME 154
+#define IDS_DESTWAVEIN_LONG_NAME 155
+#define IDS_DESTVOICEIN_LONG_NAME 156
+#define IDS_CONTROL_VOLLINEOUTMIDIOUT_LONG_NAME 157
+#define IDS_CONTROL_VOLLINEOUTMIXER_LONG_NAME 158
+#define IDS_CONTROL_VOLLINEOUTAUX1_LONG_NAME 159
+#define IDS_CONTROL_VOLLINEOUTINTERNAL_LONG_NAME 160
+#define IDS_CONTROL_VOLLINEOUTMIC_LONG_NAME 161
+#define IDS_CONTROL_VOLLINEOUTWAVEOUT_LONG_NAME 162
+#define IDS_CONTROL_VOLLINEOUTPCSPEAKER_LONG_NAME 163
+#define IDS_CONTROL_VOLLINEOUTAUX2_LONG_NAME 203
+#define IDS_CONTROL_VOLLINEOUT_LONG_NAME 164
+#define IDS_CONTROL_VOLWAVEINMIDIOUT_LONG_NAME 165
+#define IDS_CONTROL_VOLWAVEINAUX1_LONG_NAME 166
+#define IDS_CONTROL_VOLWAVEININTERNAL_LONG_NAME 167
+#define IDS_CONTROL_VOLWAVEINMIC_LONG_NAME 168
+#define IDS_CONTROL_VOLWAVEINPCSPEAKER_LONG_NAME 169
+#define IDS_CONTROL_VOLWAVEINAUX2_LONG_NAME 204
+#define IDS_CONTROL_VOLRECORD_LONG_NAME 170
+#define IDS_CONTROL_MUTELINEOUT_LONG_NAME 171
+#define IDS_CONTROL_METERRECORD_LONG_NAME 172
+#define IDS_CONTROL_MUXLINEOUT_LONG_NAME 173
+#define IDS_CONTROL_MUXWAVEIN_LONG_NAME 174
+#define IDS_CONTROL_VOICEINMUX_LONG_NAME 175
+#define IDS_CONTROL_VOLBASS_LONG_NAME 176
+#define IDS_CONTROL_VOLTREBLE_LONG_NAME 177
+#define IDS_CONTROL_VOLVOICEINAUX1_LONG_NAME 178
+#define IDS_CONTROL_VOLVOICEINMIC_LONG_NAME 179
+#define IDS_CONTROL_VOLLOUDNESS_LONG_NAME 180
+#define IDS_CONTROL_VOLSTEREOENH_LONG_NAME 181
diff --git a/private/inc/nb30p.h b/private/inc/nb30p.h
new file mode 100644
index 000000000..5a47d4f1a
--- /dev/null
+++ b/private/inc/nb30p.h
@@ -0,0 +1,70 @@
+
+/*++
+
+Copyright (c) 1989 Microsoft Corporation
+
+Module Name:
+
+ nb30p.h
+
+Abstract:
+
+ Private include file for the NB (NetBIOS) component of the NTOS project.
+
+Author:
+
+ Colin Watson (ColinW) 09-Dec-1991
+
+Revision History:
+
+--*/
+
+
+#ifndef _NB30P_
+#define _NB30P_
+
+#define NB_DEVICE_NAME L"\\Device\\Netbios" // name of our driver.
+#define NB_REGISTRY_STRING L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\Netbios"
+//
+// private IOCTLs used by the Netbios routine in the dll to communicate with
+// \Device\Netbios
+//
+
+#define IOCTL_NB_BASE FILE_DEVICE_TRANSPORT
+
+#define _NB_CONTROL_CODE(request,method) \
+ CTL_CODE(IOCTL_NB_BASE, request, method, FILE_ANY_ACCESS)
+
+#define IOCTL_NB_NCB _NB_CONTROL_CODE(20,METHOD_NEITHER)
+
+//
+// MessageId: STATUS_HANGUP_REQUIRED
+//
+// MessageText:
+//
+// Warning error for the Netbios driver to the Netbios dll. When receiving this
+// status on an NCB completion, the dll will hangup the connection causing the
+// connection block to be deleted. This status will never be returned to a user
+// application.
+//
+#define STATUS_HANGUP_REQUIRED ((NTSTATUS)0x80010001L)
+
+//
+// Private extension for XNS to support vtp.exe
+//
+
+#define NCALLNIU 0x74 /* UB special */
+
+//
+// Private extension to support AsyBEUI
+//
+
+#define NCBQUICKADDNAME 0x75
+#define NCBQUICKADDGRNAME 0x76
+
+// Values for transport_id in ACTION_HEADER
+
+#define MS_ABF "MABF"
+#define MS_XNS "MXNS"
+
+#endif // _NB30P_
diff --git a/private/inc/nbtioctl.h b/private/inc/nbtioctl.h
new file mode 100644
index 000000000..6ceaca286
--- /dev/null
+++ b/private/inc/nbtioctl.h
@@ -0,0 +1,347 @@
+/*++ BUILD Version: 0001 // Increment this if a change has global effects
+
+Copyright (c) 1991-1993 Microsoft Corporation
+
+Module Name:
+
+ nbtioctl.h
+
+Abstract:
+
+ This header file defines constants for issuing IOCTLS to Netbt
+
+
+Author:
+
+ JSTEW November 16, 1993
+
+Revision History:
+
+--*/
+
+#include <tdi.h>
+
+#ifndef _NBTIOCTL_
+#define _NBTIOCTL_
+
+#define NETBIOS_NAMESIZE 16
+#define MAX_IPADDRS_PER_HOST 10
+//
+// Netbt supports this number of adapters
+//
+#ifndef VXD
+#define NBT_MAXIMUM_BINDINGS 64 // we allow up to 64 net cards in NT
+#else
+#define NBT_MAXIMUM_BINDINGS 32 // we allow up to 32 net cards in VXD
+#endif
+
+//
+// This structure is passed down to netbt on a IOCTL_NETBT_ADAPTER_STATUS
+// call. If the Ipaddress is set to anything other than zero netbt will
+// assume it is an ip address and use it rather than try a name resolution
+// on the netbios name passed in.
+//
+typedef struct
+{
+ ULONG IpAddress;
+ TA_NETBIOS_ADDRESS NetbiosAddress;
+
+} tIPANDNAMEINFO;
+
+//
+// Adapter Status response buffer format for a query of the remote hash
+// table. It is the same as the adapter status format except it includes
+// the ip address of each name too. This is used in NBtQueryAdapterStatus
+// when responding to nbtstat queries.
+//
+typedef struct
+{
+ UCHAR name[NETBIOS_NAMESIZE];
+ UCHAR name_num;
+ UCHAR name_flags;
+ UCHAR padding;
+ ULONG IpAddress; // ip address of remote host
+ ULONG Ttl; // remaining time in cache
+} tREMOTE_CACHE;
+
+// We log the how names are registered and queried
+//
+#define NAME_QUERY_SUCCESS 0
+#define NAME_REGISTRATION_SUCCESS 1
+#define NAME_QUERY_FAILURE 2
+#define SIZE_RESOLVD_BY_BCAST_CACHE 8
+
+typedef struct
+{
+ UCHAR Name[NETBIOS_NAMESIZE];
+} tNAME;
+typedef struct
+{
+ ULONG Stats[4];
+ ULONG Index;
+ tNAME NamesReslvdByBcast[SIZE_RESOLVD_BY_BCAST_CACHE];
+
+} tNAMESTATS_INFO;
+
+
+typedef struct
+{
+ USHORT LanaNumber;
+ ULONG IpAddress;
+ ULONG NameServerAddress; // primary WINS server
+ ULONG BackupServer; // backup WINS server
+ ULONG lDnsServerAddress; // primary DNS server
+ ULONG lDnsBackupServer; // backup DNS server
+} tIPCONFIG_PER_LANA;
+
+//
+// structure returned when ipconfig queries vnbt for parameters being used
+//
+typedef struct
+{
+ USHORT NumLanas;
+ tIPCONFIG_PER_LANA LanaInfo[8];
+ USHORT NodeType;
+ USHORT ScopeLength;
+ CHAR szScope[1];
+} tIPCONFIG_INFO;
+
+//
+// These two structures are used to return the connection list to
+// NbtStat
+//
+typedef struct
+{
+ ULONG State;
+ ULONG SrcIpAddr;
+ CHAR LocalName[NETBIOS_NAMESIZE];
+ CHAR RemoteName[NETBIOS_NAMESIZE];
+#ifndef VXD
+ LARGE_INTEGER BytesRcvd;
+ LARGE_INTEGER BytesSent;
+#else
+ ULONG BytesRcvd;
+ ULONG BytesSent;
+#endif
+ UCHAR Originator; // True if originated on this node
+
+} tCONNECTIONS;
+
+typedef struct
+{
+ ULONG ConnectionCount;
+ tCONNECTIONS ConnList[1];
+} tCONNECTION_LIST;
+
+
+typedef struct
+{
+ ULONG IpAddress;
+ ULONG Resolved;
+ UCHAR Name[16];
+
+} tIPADDR_BUFFER;
+
+// this is the format of the buffer passed to Netbt when it either posts
+// a buffer for subsequent DNS name resolutions, or it replies to a name
+// resolution request. For a posted buffer, Name starts with a null, otherwise
+// name is the name that was resolved. Resolved is set to true if the name
+// resolved.
+//
+typedef struct
+{
+ ULONG IpAddrsList[MAX_IPADDRS_PER_HOST+1];
+ ULONG Resolved;
+ UCHAR pName[261]; // the destination name
+ ULONG NameLen; // how big is the name
+
+} tIPADDR_BUFFER_DNS;
+
+//
+// this is the format of the buffer passed to Nbt by DHCP when DHCP
+// changes the Ip Address
+//
+typedef struct
+{
+ ULONG IpAddress;
+ ULONG SubnetMask;
+
+} tNEW_IP_ADDRESS;
+
+//
+// this is the format of the buffer passed to Nbt by the RDR when
+// it wants to know the Wins IP addresses for a given network adapter
+// card.
+//
+typedef struct
+{
+ ULONG PrimaryWinsServer;
+ ULONG BackupWinsServer;
+
+} tWINS_ADDRESSES;
+
+//
+// This structure is returned by Nbt when a TdiQueryInformation()
+// call asks for TDI_QUERY_ADDRESS_INFO on a connection. This is
+// the same as a TRANSPORT_ADDRESS struct from "tdi.h" containing
+// two address, a NetBIOS address followed by an IP address.
+//
+
+typedef struct _NBT_ADDRESS_PAIR {
+ LONG TAAddressCount; // this will always == 2
+
+ struct {
+ USHORT AddressLength; // length in bytes of this address == 18
+ USHORT AddressType; // this will == TDI_ADDRESS_TYPE_NETBIOS
+ TDI_ADDRESS_NETBIOS Address;
+ } AddressNetBIOS;
+
+ struct {
+ USHORT AddressLength; // length in bytes of this address == 14
+ USHORT AddressType; // this will == TDI_ADDRESS_TYPE_IP
+ TDI_ADDRESS_IP Address;
+ } AddressIP;
+
+} NBT_ADDRESS_PAIR, *PNBT_ADDRESS_PAIR;
+
+typedef struct _NBT_ADDRESS_PAIR_INFO {
+ ULONG ActivityCount; // outstanding open file objects/this address.
+ NBT_ADDRESS_PAIR AddressPair; // the actual address & its components.
+} NBT_ADDRESS_PAIR_INFO, *PNBT_ADDRESS_PAIR_INFO;
+
+
+#define WINS_INTERFACE_NAME "WinsInterface"
+//
+// This is the format of the remote address structure on the front of
+// datagram rcvs passed up to WINS
+//
+typedef struct
+{
+ SHORT Family;
+ USHORT Port;
+ ULONG IpAddress;
+ ULONG LengthOfBuffer;
+
+} tREM_ADDRESS;
+
+//
+// Wins and Netbt share the transaction id space, where WINS uses the lower
+// half
+//
+#define WINS_MAXIMUM_TRANSACTION_ID 0x7FFF
+
+// this is equivalent to AF_INET - WINS depends on this to determine kind of
+// address the source node has.
+//
+#define NBT_UNIX 1
+#define NBT_INET 2
+#define WINS_EXPORT TEXT("Export")
+#define NETBT_LINKAGE_KEY TEXT("system\\currentcontrolset\\services\\netbt\\linkage")
+
+#ifndef VXD
+
+// defines for NT
+
+//
+// NtDeviceIoControlFile IoControlCode values for this device.
+//
+#define _NETBT_CTRL_CODE(function, method, access) \
+ CTL_CODE(FILE_DEVICE_TRANSPORT, function, method, access)
+
+
+#define IOCTL_NETBT_PURGE_CACHE _NETBT_CTRL_CODE( 30, METHOD_BUFFERED, \
+ FILE_ANY_ACCESS)
+#define IOCTL_NETBT_GET_BCAST_NAMES _NETBT_CTRL_CODE( 31, METHOD_OUT_DIRECT,\
+ FILE_ANY_ACCESS)
+#define IOCTL_NETBT_GET_CONNECTIONS _NETBT_CTRL_CODE( 32, METHOD_OUT_DIRECT, \
+ FILE_ANY_ACCESS)
+#define IOCTL_NETBT_GET_REMOTE_NAMES _NETBT_CTRL_CODE( 33, METHOD_OUT_DIRECT, \
+ FILE_ANY_ACCESS)
+#define IOCTL_NETBT_REREAD_REGISTRY _NETBT_CTRL_CODE( 34, METHOD_BUFFERED, \
+ FILE_ANY_ACCESS)
+#define IOCTL_NETBT_NEW_IPADDRESS _NETBT_CTRL_CODE( 35, METHOD_BUFFERED, \
+ FILE_ANY_ACCESS)
+#define IOCTL_NETBT_DNS_NAME_RESOLVE _NETBT_CTRL_CODE( 36, METHOD_OUT_DIRECT,\
+ FILE_ANY_ACCESS)
+#define IOCTL_NETBT_FIND_NAME _NETBT_CTRL_CODE( 37, METHOD_OUT_DIRECT, \
+ FILE_ANY_ACCESS)
+#define IOCTL_NETBT_GET_WINS_ADDR _NETBT_CTRL_CODE( 38, METHOD_OUT_DIRECT, \
+ FILE_ANY_ACCESS)
+#define IOCTL_NETBT_WINS_SEND _NETBT_CTRL_CODE( 39, METHOD_OUT_DIRECT, \
+ FILE_ANY_ACCESS)
+#define IOCTL_NETBT_WINS_RCV _NETBT_CTRL_CODE( 40, METHOD_OUT_DIRECT, \
+ FILE_ANY_ACCESS)
+#define IOCTL_NETBT_GET_IP_ADDRS _NETBT_CTRL_CODE( 41, METHOD_OUT_DIRECT, \
+ FILE_ANY_ACCESS)
+#define IOCTL_NETBT_GET_IP_SUBNET _NETBT_CTRL_CODE( 42, METHOD_OUT_DIRECT, \
+ FILE_ANY_ACCESS)
+#define IOCTL_NETBT_ADAPTER_STATUS _NETBT_CTRL_CODE( 43, METHOD_OUT_DIRECT, \
+ FILE_ANY_ACCESS)
+#define IOCTL_NETBT_CHECK_IP_ADDR _NETBT_CTRL_CODE( 44, METHOD_OUT_DIRECT, \
+ FILE_ANY_ACCESS)
+#define IOCTL_NETBT_ADD_INTERFACE _NETBT_CTRL_CODE( 45, METHOD_BUFFERED,\
+ FILE_ANY_ACCESS)
+#define IOCTL_NETBT_DELETE_INTERFACE _NETBT_CTRL_CODE( 46, METHOD_BUFFERED,\
+ FILE_ANY_ACCESS)
+#define IOCTL_NETBT_QUERY_INTERFACE_INSTANCE _NETBT_CTRL_CODE( 47, METHOD_BUFFERED,\
+ FILE_ANY_ACCESS)
+#define IOCTL_NETBT_SET_WINS_ADDRESS _NETBT_CTRL_CODE( 48, METHOD_BUFFERED,\
+ FILE_ANY_ACCESS)
+#define IOCTL_NETBT_ENABLE_EXTENDED_ADDR _NETBT_CTRL_CODE( 49, METHOD_BUFFERED,\
+ FILE_ANY_ACCESS)
+#define IOCTL_NETBT_DISABLE_EXTENDED_ADDR _NETBT_CTRL_CODE( 50, METHOD_BUFFERED,\
+ FILE_ANY_ACCESS)
+
+//
+// This ioctl should be last since Driver.c uses this to decide the range of
+// ioctls to pass to DispatchIoctls
+//
+#define IOCTL_NETBT_LAST_IOCTL _NETBT_CTRL_CODE( 51, METHOD_OUT_DIRECT, \
+ FILE_ANY_ACCESS)
+
+//
+// Used in IOCTL_NETBT_ADD_INTERFACE and IOCTL_NETBT_DELETE_INTERFACE
+//
+typedef struct _netbt_add_del_if {
+ NTSTATUS Status;
+ ULONG InstanceNumber; // instance number of this device
+ ULONG Length; // length of the buffer
+ WCHAR IfName[1]; // actual data
+} NETBT_ADD_DEL_IF, *PNETBT_ADD_DEL_IF;
+
+//
+// Used in IOCTL_NETBT_SET_WINS_ADDRESS
+//
+typedef struct _netbt_set_wins_addr {
+ ULONG PrimaryWinsAddr;
+ ULONG SecondaryWinsAddr;
+ NTSTATUS Status;
+} NETBT_SET_WINS_ADDR, *PNETBT_SET_WINS_ADDR;
+
+#else
+
+// defines for VXD
+
+#define IOCTL_NETBT_PURGE_CACHE 101
+#define IOCTL_NETBT_GET_BCAST_NAMES 102
+#define IOCTL_NETBT_GET_CONNECTIONS 103
+#define IOCTL_NETBT_GET_LOCAL_NAMES 104
+#define IOCTL_NETBT_GET_REMOTE_NAMES 105
+#define IOCTL_NETBT_REREAD_REGISTRY 106
+#define IOCTL_NETBT_NEW_IPADDRESS 107
+#define IOCTL_NETBT_DNS_NAME_RESOLVE 108
+#define IOCTL_NETBT_FIND_NAME 109
+#define IOCTL_NETBT_GET_WINS_ADDR 110
+#define IOCTL_NETBT_WINS_SEND 111
+#define IOCTL_NETBT_WINS_RCV 112
+#define IOCTL_NETBT_GET_IP_ADDRS 113
+#define IOCTL_NETBT_GET_IP_SUBNET 114
+#define IOCTL_NETBT_ADAPTER_STATUS 115
+#define IOCTL_NETBT_IPCONFIG_INFO 116
+#define IOCTL_NETBT_LAST_IOCTL 200
+
+#endif // ifndef VXD
+
+#endif // ifndef _NBTIOCTL_
+
+
diff --git a/private/inc/netlogon.h b/private/inc/netlogon.h
new file mode 100644
index 000000000..b4ece8db6
--- /dev/null
+++ b/private/inc/netlogon.h
@@ -0,0 +1,361 @@
+/*++
+
+Copyright (c) 1987-1991 Microsoft Corporation
+
+Module Name:
+
+ netlogon.h
+
+Abstract:
+
+ Definition of mailslot messages and Internal APIs to the Netlogon service.
+
+ This file is shared by the Netlogon service, the Workstation service,
+ the XACT server, and the MSV1_0 authentication package.
+
+Author:
+
+ Cliff Van Dyke (cliffv) 16-May-1991
+
+Environment:
+
+ User mode only.
+ Contains NT-specific code.
+ Requires ANSI C extensions: slash-slash comments, long external names.
+
+Revision History:
+
+ 16-May-1991 (cliffv)
+ Ported from LanMan 2.1.
+
+ 02-Jan-1992 (madana)
+ added support for builtin/multidomain replication.
+
+--*/
+
+#include <smbtypes.h> // need by smbgtpt.h
+#include <smbgtpt.h> // SmbPutUlong
+
+//
+// define version bit
+//
+// All netlogon messages that are compatible to NT VERSION 1 will
+// have the following bit set in the version field of the message
+// otherwise the message will not be processed by this version
+// of software. In addition to this the message should carry NT
+// token in it.
+//
+
+#define NETLOGON_NT_VERSION_1 0x00000001
+
+//
+// Name of the mailslot the Netlogon service listens to.
+//
+
+#define NETLOGON_LM_MAILSLOT_W L"\\MAILSLOT\\NET\\NETLOGON"
+#define NETLOGON_LM_MAILSLOT_A "\\MAILSLOT\\NET\\NETLOGON"
+#define NETLOGON_LM_MAILSLOT_LEN 22 // Length in characters (w/o NULL)
+
+#define NETLOGON_NT_MAILSLOT_W L"\\MAILSLOT\\NET\\NTLOGON"
+#define NETLOGON_NT_MAILSLOT_A "\\MAILSLOT\\NET\\NTLOGON"
+#define NETLOGON_NT_MAILSLOT_LEN 21 // Length in characters (w/o NULL)
+
+//
+// Opcodes for netlogon mailslot data
+//
+
+#define LOGON_REQUEST 0 // LM1.0/2.0 LOGON Request from client
+#define LOGON_RESPONSE 1 // LM1.0 Response to LOGON_REQUEST
+#define LOGON_CENTRAL_QUERY 2 // LM1.0 QUERY for centralized init
+#define LOGON_DISTRIB_QUERY 3 // LM1.0 QUERY for non-centralized init
+#define LOGON_CENTRAL_RESPONSE 4 // LM1.0 response to LOGON_CENTRAL_QUERY
+#define LOGON_DISTRIB_RESPONSE 5 // LM1.0 resp to LOGON_DISTRIB_QUERY
+#define LOGON_RESPONSE2 6 // LM2.0 Response to LOGON_REQUEST
+#define LOGON_PRIMARY_QUERY 7 // QUERY for Primary DC
+#define LOGON_START_PRIMARY 8 // announce startup of Primary DC
+#define LOGON_FAIL_PRIMARY 9 // announce failed Primary DC
+#define LOGON_UAS_CHANGE 10 // announce change to UAS or SAM
+#define LOGON_NO_USER 11 // announce no user on machine
+#define LOGON_PRIMARY_RESPONSE 12 // response to LOGON_PRIMARY_QUERY
+#define LOGON_RELOGON_RESPONSE 13 // LM1.0/2.0 resp to relogn request
+#define LOGON_WKSTINFO_RESPONSE 14 // LM1.0/2.0 resp to interrogate request
+#define LOGON_PAUSE_RESPONSE 15 // LM2.0 resp when NETLOGON is paused
+#define LOGON_USER_UNKNOWN 16 // LM2.0 response when user is unknown
+#define LOGON_UPDATE_ACCOUNT 17 // LM2.1 announce account updates
+
+#define LOGON_SAM_LOGON_REQUEST 18 // SAM LOGON request from client
+#define LOGON_SAM_LOGON_RESPONSE 19 // SAM Response to SAM logon request
+#define LOGON_SAM_PAUSE_RESPONSE 20 // SAM response when NETLOGON is paused
+#define LOGON_SAM_USER_UNKNOWN 21 // SAM response when user is unknown
+
+#define LOGON_SAM_WKSTINFO_RESPONSE 22 // SAM response to interrogate request
+
+//
+// These structures are defined for their maximum case. In many instances,
+// the strings are packed immediately following one another. In that case
+// the comments below indicate that the offset of certain fields should
+// not be used.
+//
+
+//
+// NETLOGON_LOGON_QUERY:
+//
+// This structure is used for the following Opcodes:
+// LOGON_PRIMARY_QUERY, (all LanMan versions)
+// LOGON_CENTRAL_QUERY, (LM 1.0 only)
+// LOGON_CENTRAL_RESPONSE, (LM 1.0 only)
+// LOGON_DISTRIB_QUERY, (LM 1.0 only)
+// LOGON_DISTRIB_RESPONSE. (LM 1.0 only)
+//
+//
+
+typedef struct _NETLOGON_LOGON_QUERY {
+ USHORT Opcode;
+ CHAR ComputerName[LM20_CNLEN+1]; // This field is always ASCII.
+
+ CHAR MailslotName[LM20_PATHLEN]; // Do not use offset of this field
+
+ //
+ // This field is always ASCII.
+ //
+
+ CHAR Pad; // Possible pad to WCHAR boundary
+ WCHAR UnicodeComputerName[CNLEN+1]; // Do not use offset of this field
+
+ //
+ // This field is only present if
+ // this is a LOGON_PRIMARY_QUERY
+ // from an NT system.
+ //
+
+ _ULONG (NtVersion); // Do not use offset of this field
+ _USHORT (LmNtToken); // Do not use offset of this field
+ _USHORT (Lm20Token); // Do not use offset of this field
+} NETLOGON_LOGON_QUERY, * PNETLOGON_LOGON_QUERY;
+
+
+
+//
+// NETLOGON_LOGON_REQUEST
+//
+// This structure is used for the following Opcodes:
+// LOGON_REQUEST (LM 1.0 and LM 2.0 Only)
+//
+
+typedef struct _NETLOGON_LOGON_REQUEST {
+ USHORT Opcode;
+ CHAR ComputerName[LM20_CNLEN+1];
+ CHAR UserName[LM20_UNLEN+1]; // Do not use offset of this field
+
+ CHAR MailslotName[LM20_PATHLEN+1]; // Do not use offset of this field
+
+ //
+ // This field is always ASCII.
+ //
+
+ _USHORT (RequestCount); // Do not use offset of this field
+ _USHORT (Lm20Token); // Do not use offset of this field
+} NETLOGON_LOGON_REQUEST, * PNETLOGON_LOGON_REQUEST;
+
+
+
+//
+// NETLOGON_LOGON_RESPONSE:
+//
+// This structure is used for the following Opcodes:
+// LOGON_RESPONSE (To LM 1.0 clients only).
+//
+
+typedef struct _NETLOGON_LOGON_RESPONSE {
+ USHORT Opcode;
+ CHAR UseName[2 + LM20_CNLEN + 1 + LM20_NNLEN +1];
+ CHAR ScriptName[(2*LM20_PATHLEN) + LM20_UNLEN + LM20_CNLEN + LM20_NNLEN + 8]; // Do not use offset of this field
+} NETLOGON_LOGON_RESPONSE, *PNETLOGON_LOGON_RESPONSE;
+
+
+//
+// NETLOGON_PRIMARY
+//
+// This structure is used for the following Opcodes:
+// LOGON_START_PRIMARY
+// LOGON_PRIMARY_RESPONSE
+//
+
+typedef struct _NETLOGON_PRIMARY {
+ USHORT Opcode;
+ CHAR PrimaryDCName[LM20_CNLEN + 1]; // This field is always ASCII.
+
+ //
+ // The following fields are only present if this message is from
+ // an NT system.
+ //
+
+ CHAR Pad; // Possible pad to WCHAR boundary
+ WCHAR UnicodePrimaryDCName[CNLEN+1]; // Do not use offset of this field
+ WCHAR UnicodeDomainName[DNLEN+1]; // Do not use offset of this field
+
+ _ULONG (NtVersion); // Do not use offset of this field
+ _USHORT (LmNtToken); // Do not use offset of this field
+ _USHORT (Lm20Token); // Do not use offset of this field
+} NETLOGON_PRIMARY, * PNETLOGON_PRIMARY;
+
+
+//
+// NETLOGON_FAIL_PRIMARY
+//
+// This structure is used for the following Opcodes:
+// LOGON_FAIL_PRIMARY (All LanMan versions)
+//
+
+typedef struct _NETLOGON_FAIL_PRIMARY {
+ USHORT Opcode;
+
+ _ULONG (NtVersion); // Do not use offset of this field
+ _USHORT (LmNtToken); // Do not use offset of this field
+ _USHORT (Lm20Token); // Do not use offset of this field
+} NETLOGON_FAIL_PRIMARY, *PNETLOGON_FAIL_PRIMARY;
+
+
+//
+// NETLOGON_LOGON_RESPONSE2
+//
+// This structure is used for the following Opcodes:
+// LOGON_RESPONSE2 (LM 2.0 only)
+// LOGON_USER_UNKNOWN (LM 2.0 only)
+// LOGON_PAUSE_RESPONSE (LM 2.0 only)
+//
+
+typedef struct _NETLOGON_LOGON_RESPONSE2 {
+ USHORT Opcode;
+ CHAR LogonServer[LM20_UNCLEN+1];
+ _USHORT (Lm20Token); // Do not use offset of this field
+} NETLOGON_LOGON_RESPONSE2, *PNETLOGON_LOGON_RESPONSE2;
+
+
+//
+// The following structures are densely packed to be compatible with LM2.0.
+// Poorly aligned fields should only be accessed using the SmbPut and SmbGet
+// family of macros.
+//
+
+//
+// Force misalignment of the following structures
+//
+
+#ifndef NO_PACKING
+#include <packon.h>
+#endif // ndef NO_PACKING
+
+//
+// NETLOGON_UAS_CHANGE
+//
+// This structure is used for the following Opcodes:
+// LOGON_UAS_CHANGE
+//
+
+//
+// DB_CHANGE_INFO structure contains per database change info.
+//
+
+typedef struct _DB_CHANGE_INFO {
+ DWORD DBIndex;
+ LARGE_INTEGER LargeSerialNumber;
+ LARGE_INTEGER NtDateAndTime;
+} DB_CHANGE_INFO, *PDB_CHANGE_INFO;
+
+
+//
+// NETLOGON_DB_STRUCTURE contains common change info for all databases and
+// array of per database change info. First half of this structure is
+// identical to downlevel NETLOGON_UAS_CHANGE message and contains SAM
+// database change info.
+//
+
+typedef struct _NETLOGON_DB_CHANGE {
+ USHORT Opcode;
+ _ULONG (LowSerialNumber);
+ _ULONG (DateAndTime);
+ _ULONG (Pulse);
+ _ULONG (Random);
+ CHAR PrimaryDCName[LM20_CNLEN + 1];
+ CHAR DomainName[LM20_DNLEN + 1]; // Do not use offset of this field
+
+ //
+ // The following fields are only present if this message is from
+ // an NT system.
+ //
+
+ CHAR Pad; // Possible pad to WCHAR boundary
+ WCHAR UnicodePrimaryDCName[CNLEN+1]; // Do not use offset of this field
+ WCHAR UnicodeDomainName[DNLEN+1]; // Do not use offset of this field
+ DWORD DBCount; // Do not use offset of this field
+ DB_CHANGE_INFO DBChangeInfo[1]; // Do not use offset of this field
+ DWORD DomainSidSize; // Do not use offset of this field
+ CHAR DomainSid[1]; // Do not use offset of this field
+ _ULONG (NtVersion); // Do not use offset of this field
+ _USHORT (LmNtToken); // Do not use offset of this field
+ _USHORT (Lm20Token); // Do not use offset of this field
+} NETLOGON_DB_CHANGE, *PNETLOGON_DB_CHANGE;
+
+
+
+//
+// Turn structure packing back off
+//
+
+#ifndef NO_PACKING
+#include <packoff.h>
+#endif // ndef NO_PACKING
+
+
+
+//
+// NETLOGON_SAM_LOGON_REQUEST
+//
+// This structure is used for the following Opcodes:
+// LOGON_SAM_LOGON_REQUEST (SAM Only)
+//
+// This message exceeds the maximum size for broadcast mailslot messages. In
+// practice, this will only be a problem if the UnicodeUserName is over 100
+// characters long.
+//
+
+typedef struct _NETLOGON_SAM_LOGON_REQUEST {
+ USHORT Opcode;
+ USHORT RequestCount;
+
+ WCHAR UnicodeComputerName[CNLEN+1];
+ WCHAR UnicodeUserName[UNLEN+1]; // Do not use offset of this field
+
+ CHAR MailslotName[LM20_PATHLEN+1]; // Do not use offset of this field
+ // This field is always ASCII.
+ _ULONG (AllowableAccountControlBits); // Do not use offset of this field
+ DWORD DomainSidSize; // Do not use offset of this field
+ CHAR DomainSid[1]; // Do not use offset of this field
+ _ULONG (NtVersion); // Do not use offset of this field
+ _USHORT (LmNtToken); // Do not use offset of this field
+
+ _USHORT (Lm20Token); // Do not use offset of this field
+} NETLOGON_SAM_LOGON_REQUEST, * PNETLOGON_SAM_LOGON_REQUEST;
+
+
+
+//
+// NETLOGON_SAM_LOGON_RESPONSE
+//
+// This structure is used for the following Opcodes:
+// LOGON_SAM_LOGON_RESPONSE (SAM only)
+// LOGON_SAM_USER_UNKNOWN (SAM only)
+// LOGON_SAM_PAUSE_RESPONSE (SAM only)
+//
+
+typedef struct _NETLOGON_SAM_LOGON_RESPONSE {
+ USHORT Opcode;
+ WCHAR UnicodeLogonServer[UNCLEN+1];
+ WCHAR UnicodeUserName[UNLEN+1]; // Do not use offset of this field
+ WCHAR UnicodeDomainName[DNLEN+1]; // Do not use offset of this field
+
+ _ULONG (NtVersion); // Do not use offset of this field
+ _USHORT (LmNtToken); // Do not use offset of this field
+ _USHORT (Lm20Token); // Do not use offset of this field
+} NETLOGON_SAM_LOGON_RESPONSE, *PNETLOGON_SAM_LOGON_RESPONSE;
diff --git a/private/inc/nettypes.h b/private/inc/nettypes.h
new file mode 100644
index 000000000..590d79582
--- /dev/null
+++ b/private/inc/nettypes.h
@@ -0,0 +1,81 @@
+/*++
+
+Copyright (c) 1989 Microsoft Corporation
+
+Module Name:
+
+ nettypes.h
+
+Abstract:
+
+ This header file contains type definitions for the NT TDI, NDI,
+ DDI, and PDI interfaces which are not specific to a single interface.
+
+Author:
+
+ Steve Jones (stevej) 26-Oct-1989
+
+Revision History:
+
+--*/
+
+#ifndef _NETTYPES_
+#define _NETTYPES_
+
+//
+// The following basic type is used to provide extensibility in request
+// and response packets. The OFFSET type is used to contain a value which
+// is interpreted as a relative address consisting of a number of bytes
+// from the beginning of the immediate parent structure.
+//
+
+typedef ULONG OFFSET;
+
+//
+// The following basic type is used throughout all the layers to pass a
+// string through an I/O interface which does not allow embedded pointers.
+// To allocate a FLAT_STRING, one must make room for the correct number of
+// buffer bytes in the allocation.
+//
+
+typedef struct _FLAT_STRING {
+ SHORT MaximumLength; // total size of string buffer.
+ SHORT Length; // number of bytes represented in string.
+ char Buffer [1]; // the buffer itself follows this struct.
+} FLAT_STRING, *PFLAT_STRING;
+
+//
+// Basic type used to represent a network name, typically as a component of
+// a transport address structure through the TDI. This type is also passed
+// through the NDI interface. This type is declared as a structure so that
+// it can be extended easily without modifying applications, even though it
+// currently only has one element.
+//
+//
+
+typedef struct _NETWORK_NAME {
+ FLAT_STRING Name; // network name in FLAT_STRING format.
+} NETWORK_NAME, *PNETWORK_NAME;
+
+//
+// Basic type used to represent an address at the hardware level of the
+// network. Hardware addresses are abstract types which are mapped to
+// adapter addresses by the physical provider. See the Physical Driver
+// Interface specification for details on how this is accomplished.
+//
+
+#define HARDWARE_ADDRESS_LENGTH 6 // number of octets in a hardware address.
+
+typedef struct _HARDWARE_ADDRESS {
+ UCHAR Address [HARDWARE_ADDRESS_LENGTH];
+} HARDWARE_ADDRESS, *PHARDWARE_ADDRESS;
+
+//
+// Network management variable types used by all interface levels.
+//
+
+#define NETMAN_VARTYPE_ULONG 0 // type is a ULONG.
+#define NETMAN_VARTYPE_HARDWARE_ADDRESS 1 // type is a HARDWARE_ADDRESS.
+#define NETMAN_VARTYPE_STRING 2 // type is a FLAT_STRING.
+
+#endif // _NETTYPES_
diff --git a/private/inc/nlrepl.h b/private/inc/nlrepl.h
new file mode 100644
index 000000000..fa1e49ec6
--- /dev/null
+++ b/private/inc/nlrepl.h
@@ -0,0 +1,61 @@
+/*++
+Copyright (c) 1987-1991 Microsoft Corporation
+
+Module Name:
+
+ nlrepl.h
+
+Abstract:
+
+ Prototypes of the database replication functions called either from
+ LSA OR SAM.
+
+Author:
+
+ Madan Appiah
+
+Environment:
+
+ User mode only.
+ Contains NT-specific code.
+ Requires ANSI C extensions: slash-slash comments, long external names.
+
+Revision History:
+
+ 14-Apr-1992 (madana)
+ Created.
+
+--*/
+
+NTSTATUS
+I_NetNotifyDelta (
+ IN SECURITY_DB_TYPE DbType,
+ IN LARGE_INTEGER ModificationCount,
+ IN SECURITY_DB_DELTA_TYPE DeltaType,
+ IN SECURITY_DB_OBJECT_TYPE ObjectType,
+ IN ULONG ObjectRid,
+ IN PSID ObjectSid,
+ IN PUNICODE_STRING ObjectName,
+ IN DWORD ReplicationImmediately,
+ IN PSAM_DELTA_DATA DeltaData
+ );
+
+NTSTATUS
+I_NetNotifyRole(
+ IN POLICY_LSA_SERVER_ROLE Role
+ );
+
+NTSTATUS
+I_NetNotifyMachineAccount (
+ IN ULONG ObjectRid,
+ IN PSID DomainSid,
+ IN ULONG OldUserAccountControl,
+ IN ULONG NewUserAccountControl,
+ IN PUNICODE_STRING ObjectName
+ );
+
+NTSTATUS
+I_NetGetAnyDCName (
+ IN PUNICODE_STRING DomainName,
+ OUT PUNICODE_STRING Buffer
+ );
diff --git a/private/inc/ntddip.h b/private/inc/ntddip.h
new file mode 100644
index 000000000..e7e7890f5
--- /dev/null
+++ b/private/inc/ntddip.h
@@ -0,0 +1,162 @@
+/*++ BUILD Version: 0001 // Increment this if a change has global effects
+
+Copyright (c) 1991-1993 Microsoft Corporation
+
+Module Name:
+
+ ntddip.h
+
+Abstract:
+
+ This header file defines constants and types for accessing the NT
+ IP driver.
+
+Author:
+
+ Mike Massa (mikemas) August 13, 1993
+
+Revision History:
+
+--*/
+
+#ifndef _NTDDIP_
+#define _NTDDIP_
+
+//
+// Device Name - this string is the name of the device. It is the name
+// that should be passed to NtOpenFile when accessing the device.
+//
+#define DD_IP_DEVICE_NAME L"\\Device\\Ip"
+
+
+//
+// Structures used in IOCTLs.
+//
+typedef struct set_ip_address_request {
+ unsigned short Context; // Context value for the target NTE
+ unsigned long Address; // IP address to set, or zero to clear
+ unsigned long SubnetMask; // Subnet mask to set
+} IP_SET_ADDRESS_REQUEST, *PIP_SET_ADDRESS_REQUEST;
+
+typedef struct set_dhcp_interface_request {
+ unsigned long Context; // Context value identifying the NTE
+ // Valid contexts are 16 bit quantities.
+} IP_SET_DHCP_INTERFACE_REQUEST, *PIP_SET_DHCP_INTERFACE_REQUEST;
+
+typedef struct add_ip_nte_request {
+ unsigned short InterfaceContext; // Context value for the IP interface
+ // to which to add the NTE
+ unsigned long Address; // IP address to set, or zero to clear
+ unsigned long SubnetMask; // Subnet mask to set
+} IP_ADD_NTE_REQUEST, *PIP_ADD_NTE_REQUEST;
+
+typedef struct add_ip_nte_response {
+ unsigned short Context; // Context value for the new NTE
+ unsigned long Instance; // Instance ID for the new NTE
+} IP_ADD_NTE_RESPONSE, *PIP_ADD_NTE_RESPONSE;
+
+typedef struct delete_ip_nte_request {
+ unsigned short Context; // Context value for the NTE
+} IP_DELETE_NTE_REQUEST, *PIP_DELETE_NTE_REQUEST;
+
+typedef struct get_ip_nte_info_request {
+ unsigned short Context; // Context value for the NTE
+} IP_GET_NTE_INFO_REQUEST, *PIP_GET_NTE_INFO_REQUEST;
+
+typedef struct get_ip_nte_info_response {
+ unsigned long Instance; // Instance ID for the NTE
+ unsigned long Address;
+ unsigned long SubnetMask;
+ unsigned long Flags;
+} IP_GET_NTE_INFO_RESPONSE, *PIP_GET_NTE_INFO_RESPONSE;
+
+//
+// NTE Flags
+//
+#define IP_NTE_DYNAMIC 0x00000010
+
+
+//
+// IP IOCTL code definitions
+//
+
+#define FSCTL_IP_BASE FILE_DEVICE_NETWORK
+
+#define _IP_CTL_CODE(function, method, access) \
+ CTL_CODE(FSCTL_IP_BASE, function, method, access)
+
+//
+// This IOCTL is used to send an ICMP Echo request. It is synchronous and
+// returns any replies received.
+//
+#define IOCTL_ICMP_ECHO_REQUEST \
+ _IP_CTL_CODE(0, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+//
+// This IOCTL is used to set the IP address for an interface. It is meant to
+// be issued by a DHCP client. Setting the address to 0 deletes the current
+// address and disables the interface. It may only be issued by a process
+// with Administrator privilege.
+//
+#define IOCTL_IP_SET_ADDRESS \
+ _IP_CTL_CODE(1, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+//
+// This IOCTL is used to specify on which uninitialized interface a DHCP
+// client intends to send its requests. The Interface Context parameter is
+// a 16-bit quantity. The IOCTL takes a 32-bit Context as its argument. This
+// IOCTL with a Context value of 0xFFFFFFFF must be issued to disable special
+// processing in IP when a DHCP client is finished initializing interfaces.
+// This IOCTL may only be issued by a process with Administrator privilege.
+//
+#define IOCTL_IP_SET_DHCP_INTERFACE \
+ _IP_CTL_CODE(2, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+
+//
+// This ioctl may only be issued by a process with Administrator privilege.
+//
+#define IOCTL_IP_SET_IF_CONTEXT \
+ _IP_CTL_CODE(3, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+//
+// This ioctl may only be issued by a process with Administrator privilege.
+//
+#define IOCTL_IP_SET_FILTER_POINTER \
+ _IP_CTL_CODE(4, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+//
+// This ioctl may only be issued by a process with Administrator privilege.
+//
+#define IOCTL_IP_SET_MAP_ROUTE_POINTER \
+ _IP_CTL_CODE(5, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+//
+// This ioctl may only be issued by a process with Administrator privilege.
+//
+#define IOCTL_IP_GET_PNP_ARP_POINTERS \
+ _IP_CTL_CODE(6, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+//
+// This ioctl creates a new, dynamic NTE. It may only be issued by a process
+// with Administrator privilege.
+//
+#define IOCTL_IP_ADD_NTE \
+ _IP_CTL_CODE(7, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+//
+// This ioctl deletes a dynamic NTE. It may only be issued by a process with
+// Administrator privilege.
+//
+#define IOCTL_IP_DELETE_NTE \
+ _IP_CTL_CODE(8, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+//
+// This ioctl gathers information about an NTE. It requires no special
+// privilege.
+//
+#define IOCTL_IP_GET_NTE_INFO \
+ _IP_CTL_CODE(9, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+
+#endif // ifndef _NTDDIP_
diff --git a/private/inc/ntddtcp.h b/private/inc/ntddtcp.h
new file mode 100644
index 000000000..2b5849609
--- /dev/null
+++ b/private/inc/ntddtcp.h
@@ -0,0 +1,156 @@
+
+/*++ BUILD Version: 0001 // Increment this if a change has global effects
+
+Copyright (c) 1991-1993 Microsoft Corporation
+
+Module Name:
+
+ ntddtcp.h
+
+Abstract:
+
+ This header file defines constants and types for accessing the NT
+ TCP driver.
+
+Author:
+
+ Mike Massa (mikemas) August 13, 1993
+
+Revision History:
+
+--*/
+
+#ifndef _NTDDTCP_
+#define _NTDDTCP_
+
+//
+// Device Name - this string is the name of the device. It is the name
+// that should be passed to NtCreateFile when accessing the device.
+//
+#define DD_TCP_DEVICE_NAME L"\\Device\\Tcp"
+#define DD_UDP_DEVICE_NAME L"\\Device\\Udp"
+#define DD_RAW_IP_DEVICE_NAME L"\\Device\\RawIp"
+
+
+//
+// Security Filter Support
+//
+// Security filters provide a mechanism by which the transport protocol
+// traffic accepted on IP interfaces may be controlled. Security filtering
+// is globally enabled or disabled for all IP interfaces and transports.
+// If filtering is enabled, incoming traffic is filtered based on registered
+// {interface, protocol, transport value} tuples. The tuples specify
+// permissible traffic. All other values will be rejected. For UDP datagrams
+// and TCP connections, the transport value is the port number. For RawIP
+// datagrams, the transport value is the IP protocol number. An entry exists
+// in the filter database for all active interfaces and protocols in the
+// system.
+//
+// The following ioctls may be used to access the security filter
+// database. The ioctls may be issued on any TCP/IP device object. All of them
+// require Administrator privilege. These ioctls do not update the registry
+// parameters used to initialize security filtering when an interface is
+// installed.
+//
+// The TCP_QUERY_SECURITY_FILTER_STATUS ioctl returns the current status of
+// security filtering - enabled or disabled.
+//
+// The TCP_SET_SECURITY_FILTER_STATUS ioctl modifies the status of security
+// filtering. Changing the filtering status does not change the contents of
+// the filter database.
+//
+// The following ioctls manipulate the filter database. They operate the same
+// whether security filtering is enabled or disabled. If filtering is disabled,
+// any changes will take effect only when filtering is enabled.
+//
+// The TCP_ADD_SECURITY_FILTER ioctl registers an {Interface, Protocol, Value}
+// tuple. The TCP_DELETE_SECURITY_FILTER ioctl deregisters an
+// {Interface, Protocol, Value} tuple. The TCP_ENUMERATE_SECURITY_FILTER ioctl
+// returns the list of {Interface, Protocol, Value} filters currently
+// registered.
+//
+// Each of these ioctls takes an {Interface, Protocol, Value} tuple as an input
+// parameter. Zero is a wildcard value. If the Interface or Protocol elements
+// are zero, the operation applies to all interfaces or protocols, as
+// appropriate. The meaning of a zero Value element depends on the ioctl.
+// For an ADD, a zero Value causes all values to be permissible. For a DELETE,
+// a zero Value causes all all values to be rejected. In both cases, any
+// previously registered values are purged from the database. For an
+// ENUMERATE, a zero Value just causes all registered values to be enumerated,
+// as opposed to a specific value.
+//
+// For all ioctls, a return code of STATUS_INVALID_ADDRESS indicates that
+// the IP address submitted in the input buffer does not correspond to
+// an interface which exists in the system. A code of
+// STATUS_INVALID_PARAMETER possibly indicates that the Protocol number
+// submitted in the input buffer does not correspond to a transport protocol
+// available in the system.
+//
+
+//
+// Structures used in Security Filter IOCTLs.
+//
+
+//
+// Structure contained in the input buffer of
+// TCP_SET_SECURITY_FILTER_STATUS ioctls and the output buffer of
+// TCP_QUERY_SECURITY_FILTER_STATUS ioctls.
+//
+struct tcp_security_filter_status {
+ ULONG FilteringEnabled; // FALSE if filtering is (to be) disabled.
+}; // Any other value indicates that filtering
+ // is (to be) enabled.
+
+typedef struct tcp_security_filter_status
+ TCP_SECURITY_FILTER_STATUS,
+ *PTCP_SECURITY_FILTER_STATUS;
+
+
+//
+// The TCPSecurityFilterEntry structure, defined in tcpinfo.h, is contained in
+// the input buffer of TCP_[ADD|DELETE|ENUMERATE]_SECURITY_FILTER ioctls.
+//
+
+//
+// The TCPSecurityFilterEnum structure, defined in tcpinfo.h, is contained
+// in the output buffer of TCP_ENUMERATE_SECURITY_FILTER ioctls. The output
+// buffer passed in the ioctl must be large enough to contain at least this
+// structure or the call will fail. The structure is followed immediately in
+// the buffer by an array of zero or more TCPSecurityFilterEntry structures.
+// The number of TCPSecurityFilterEntry structures is specified by the
+// tfe_entries_returned field of the TCPSecurityFilterEnum.
+//
+
+//
+// TCP/UDP/RawIP IOCTL code definitions
+//
+
+#define FSCTL_TCP_BASE FILE_DEVICE_NETWORK
+
+#define _TCP_CTL_CODE(function, method, access) \
+ CTL_CODE(FSCTL_TCP_BASE, function, method, access)
+
+#define IOCTL_TCP_QUERY_INFORMATION_EX \
+ _TCP_CTL_CODE(0, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+#define IOCTL_TCP_SET_INFORMATION_EX \
+ _TCP_CTL_CODE(1, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+#define IOCTL_TCP_QUERY_SECURITY_FILTER_STATUS \
+ _TCP_CTL_CODE(2, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+#define IOCTL_TCP_SET_SECURITY_FILTER_STATUS \
+ _TCP_CTL_CODE(3, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+#define IOCTL_TCP_ADD_SECURITY_FILTER \
+ _TCP_CTL_CODE(4, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+#define IOCTL_TCP_DELETE_SECURITY_FILTER \
+ _TCP_CTL_CODE(5, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+#define IOCTL_TCP_ENUMERATE_SECURITY_FILTER \
+ _TCP_CTL_CODE(6, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+
+#endif // ifndef _NTDDTCP_
+
diff --git a/private/inc/ntddtel.h b/private/inc/ntddtel.h
new file mode 100644
index 000000000..a7479e49c
--- /dev/null
+++ b/private/inc/ntddtel.h
@@ -0,0 +1,42 @@
+/*++
+
+Copyright (c) 1992 Microsoft Corporation
+
+Module Name:
+
+ ntddtel.h
+
+Abstract:
+
+ This is the include file that defines all constants and types for
+ internal device control of telnet driver.
+
+Author:
+
+ Vladimir Z. Vulovic 14-July-1992
+
+Revision History:
+
+--*/
+
+
+// The first server side handle overlays the meaning of ioctls. This
+// approach is needed since serial driver does not export an ioctl such as
+// IOCTL_SERIAL_GENERIC. We are allowed to use this approach since the
+// meaning of server side operations is defined only by an internal agreement
+// between the telnet service & the telnet driver.
+
+typedef struct _TELNET_IOCTL_INPUT_DATA {
+ ULONG Version;
+ ULONG Action;
+} TELNET_IOCTL_INPUT_DATA, *PTELNET_IOCTL_INPUT_DATA;
+
+
+// TELNET_VERSION_1 is for internal IOCTLs suppored in the first NT release
+// of telnet driver (end of 1992)
+
+#define TELNET_VERSION_1 0
+
+#define IOCTL_TELNET_PAUSE 0
+#define IOCTL_TELNET_CONTINUE 1
+
diff --git a/private/inc/ntddvdm.h b/private/inc/ntddvdm.h
new file mode 100644
index 000000000..ef1885b39
--- /dev/null
+++ b/private/inc/ntddvdm.h
@@ -0,0 +1,44 @@
+/*++ BUILD Version: 0001 // Increment this if a change has global effects
+
+Copyright (c) 1990-1996 Microsoft Corporation
+
+Module Name:
+
+ ntddvdm.h
+
+Abstract:
+
+ This is the include file that defines all constants and types for
+ accessing the NTVDM kernel mode virtual devices.
+
+Author:
+
+ William Hsieh (williamh) 31-May-1996
+
+Revision History:
+
+--*/
+
+//
+// NtDeviceIoControlFile IoControlCode values for this device.
+//
+// Warning: Remember that the low two bits of the code specify how the
+// buffers are passed to the driver!
+//
+//
+#define IOCTL_VDM_BASE FILE_DEVICE_VDM
+
+//
+// 32 VDDs. Each VDD has possible 127 private ioctl code
+// These values are based on the fact that there are 12 bits reserved
+// for function id in each IOCTL code.
+//
+#define IOCTL_VDM_GROUP_MASK 0xF80
+#define IOCTL_VDM_GROUP_SIZE 127
+
+#define IOCTL_VDM_PARALLEL_GROUP 0
+
+#define IOCTL_VDM_PARALLEL_BASE IOCTL_VDM_BASE + IOCTL_VDM_PARALLEL_GROUP * IOCTL_VDM_GROUP_SIZE
+#define IOCTL_VDM_PAR_WRITE_DATA_PORT CTL_CODE(IOCTL_VDM_PARALLEL_BASE, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_VDM_PAR_WRITE_CONTROL_PORT CTL_CODE(IOCTL_VDM_PARALLEL_BASE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_VDM_PAR_READ_STATUS_PORT CTL_CODE(IOCTL_VDM_PARALLEL_BASE, 3, METHOD_BUFFERED, FILE_ANY_ACCESS)
diff --git a/private/inc/ntrmlsa.h b/private/inc/ntrmlsa.h
new file mode 100644
index 000000000..0e11c2771
--- /dev/null
+++ b/private/inc/ntrmlsa.h
@@ -0,0 +1,233 @@
+
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ ntrmlsa.h
+
+Abstract:
+
+ Local Security Authority - Reference Monitor Communication Types
+
+Author:
+
+ Scott Birrell (ScottBi) March 18, 1991
+
+Environment:
+
+Revision History:
+
+--*/
+
+
+#include <ntlsa.h>
+
+#ifndef _NTRMLSA_
+#define _NTRMLSA_
+
+
+//
+// Memory type. This defines the type of memory used for a record
+// passed between the RM and LSA.
+//
+// SepRmLsaPortMemory - Memory allocated via RtlAllocateHeap()
+// from the shared memory section associated with the
+// Lsa command Port.
+//
+// SepRmLsaVirtualMemory - Memory allocated via ZwAllocateVirtualMemory()
+//
+// SepRmLsaUnreadableMemory - Memory not readable by the LSA. This
+// memory must be copied to another format
+// before passage over the link.
+//
+// SepRmLsaLPCBufferMemory - Memory contained within the LPC buffer
+// itself
+//
+
+
+
+typedef enum _SEP_RM_LSA_MEMORY_TYPE {
+
+ SepRmNoMemory = 0,
+ SepRmImmediateMemory,
+ SepRmLsaCommandPortSharedMemory,
+ SepRmLsaCustomSharedMemory,
+ SepRmPagedPoolMemory,
+ SepRmUnspecifiedMemory
+
+} SEP_RM_LSA_MEMORY_TYPE, *PSEP_RM_LSA_MEMORY_TYPE;
+
+//
+// Reference Monitor Command Message Structure. This structure is used
+// by the Local Security Authority to send commands to the Reference Monitor
+// via the Reference Monitor Server Command LPC Port.
+//
+
+#define RmMinimumCommand RmAuditSetCommand
+#define RmMaximumCommand RmDeleteLogonSession
+
+//
+// Keep this in sync with SEP_RM_COMMAND_WORKER in se\rmmain.c
+//
+
+typedef enum _RM_COMMAND_NUMBER {
+
+ RmDummyCommand = 0,
+ RmAuditSetCommand,
+ RmSendCommandToLsaCommand,
+ RmComponentTestCommand,
+ RmCreateLogonSession,
+ RmDeleteLogonSession
+
+} RM_COMMAND_NUMBER;
+
+#define RM_MAXIMUM_COMMAND_PARAM_SIZE \
+ ((ULONG) PORT_MAXIMUM_MESSAGE_LENGTH - sizeof(PORT_MESSAGE) - \
+ sizeof(RM_COMMAND_NUMBER))
+
+typedef struct _RM_COMMAND_MESSAGE {
+
+ PORT_MESSAGE MessageHeader;
+ RM_COMMAND_NUMBER CommandNumber;
+ UCHAR CommandParams[RM_MAXIMUM_COMMAND_PARAM_SIZE];
+
+} RM_COMMAND_MESSAGE, *PRM_COMMAND_MESSAGE;
+
+//
+// Reference Monitor Command Reply Message Structure.
+//
+
+#define RM_MAXIMUM_REPLY_BUFFER_SIZE \
+ ((ULONG) PORT_MAXIMUM_MESSAGE_LENGTH - sizeof(PORT_MESSAGE) - \
+ sizeof(RM_COMMAND_NUMBER))
+
+
+typedef struct _RM_REPLY_MESSAGE {
+
+ PORT_MESSAGE MessageHeader;
+ NTSTATUS ReturnedStatus;
+ UCHAR ReplyBuffer[RM_MAXIMUM_REPLY_BUFFER_SIZE];
+
+} RM_REPLY_MESSAGE, *PRM_REPLY_MESSAGE;
+
+#define RM_COMMAND_MESSAGE_HEADER_SIZE \
+ (sizeof(PORT_MESSAGE) + sizeof(NTSTATUS) + sizeof(RM_COMMAND_NUMBER))
+
+//
+// Local Security Authority Command Message Structure. This structure is
+// used by the Reference Monitor to send commands to the Local Security
+// Authority via the LSA Server Command LPC Port.
+//
+
+#define LsapMinimumCommand LsapWriteAuditMessageCommand
+#define LsapMaximumCommand LsapLogonSessionDeletedCommand
+
+typedef enum _LSA_COMMAND_NUMBER {
+ LsapDummyCommand = 0,
+ LsapWriteAuditMessageCommand,
+ LsapComponentTestCommand,
+ LsapLogonSessionDeletedCommand
+} LSA_COMMAND_NUMBER;
+
+#define LSA_MAXIMUM_COMMAND_PARAM_SIZE \
+ ((ULONG) PORT_MAXIMUM_MESSAGE_LENGTH - sizeof(PORT_MESSAGE) - \
+ sizeof(LSA_COMMAND_NUMBER) - sizeof(SEP_RM_LSA_MEMORY_TYPE))
+
+typedef struct _LSA_COMMAND_MESSAGE {
+ PORT_MESSAGE MessageHeader;
+ LSA_COMMAND_NUMBER CommandNumber;
+ SEP_RM_LSA_MEMORY_TYPE CommandParamsMemoryType;
+ UCHAR CommandParams[LSA_MAXIMUM_COMMAND_PARAM_SIZE];
+} LSA_COMMAND_MESSAGE, *PLSA_COMMAND_MESSAGE;
+
+//
+// LSA Command Reply Message Structure.
+//
+
+#define LSA_MAXIMUM_REPLY_BUFFER_SIZE \
+ ((ULONG) PORT_MAXIMUM_MESSAGE_LENGTH - sizeof(PORT_MESSAGE) - \
+ sizeof(LSA_COMMAND_NUMBER))
+
+typedef struct _LSA_REPLY_MESSAGE {
+ PORT_MESSAGE MessageHeader;
+ NTSTATUS ReturnedStatus;
+ UCHAR ReplyBuffer[LSA_MAXIMUM_REPLY_BUFFER_SIZE];
+} LSA_REPLY_MESSAGE, *PLSA_REPLY_MESSAGE;
+
+//
+// Command Parameter format for the special RmSendCommandToLsaCommand
+//
+
+typedef struct _RM_SEND_COMMAND_TO_LSA_PARAMS {
+ LSA_COMMAND_NUMBER LsaCommandNumber;
+ ULONG LsaCommandParamsLength;
+ UCHAR LsaCommandParams[LSA_MAXIMUM_COMMAND_PARAM_SIZE];
+} RM_SEND_COMMAND_TO_LSA_PARAMS, *PRM_SEND_COMMAND_TO_LSA_PARAMS;
+
+//
+// Command Values for the LSA and RM Component Test Commands
+//
+
+#define LSA_CT_COMMAND_PARAM_VALUE 0x00823543
+#define RM_CT_COMMAND_PARAM_VALUE 0x33554432
+
+
+//
+// Audit Record Pointer Field Type
+//
+
+typedef enum _SE_ADT_POINTER_FIELD_TYPE {
+
+ NullFieldType,
+ UnicodeStringType,
+ SidType,
+ PrivilegeSetType,
+ MiscFieldType
+
+} SE_ADT_POINTER_FIELD_TYPE, *PSE_ADT_POINTER_FIELD_TYPE;
+
+
+//
+// Hardwired Audit Event Type counts
+//
+
+#define AuditEventMinType (AuditCategorySystem)
+#define AuditEventMaxType (AuditCategoryAccountManagement)
+
+#define POLICY_AUDIT_EVENT_TYPE_COUNT \
+ ((ULONG) AuditEventMaxType - AuditEventMinType + 1)
+
+#define LSARM_AUDIT_EVENT_OPTIONS_SIZE \
+ (((ULONG)(POLICY_AUDIT_EVENT_TYPE_COUNT) * sizeof (POLICY_AUDIT_EVENT_OPTIONS)))
+
+//
+// Self-Relative form of POLICY_AUDIT_EVENTS_INFO
+//
+
+typedef struct _LSARM_POLICY_AUDIT_EVENTS_INFO {
+
+ BOOLEAN AuditingMode;
+ POLICY_AUDIT_EVENT_OPTIONS EventAuditingOptions[POLICY_AUDIT_EVENT_TYPE_COUNT];
+ ULONG MaximumAuditEventCount;
+
+} LSARM_POLICY_AUDIT_EVENTS_INFO, *PLSARM_POLICY_AUDIT_EVENTS_INFO;
+
+//
+// The following symbol defines the value containing whether or not we're supposed
+// to crash when an audit fails. It is used in the se and lsasrv directories.
+//
+
+#define CRASH_ON_AUDIT_FAIL_VALUE L"CrashOnAuditFail"
+
+//
+// These are the possible values for the CrashOnAuditFail flag.
+//
+
+#define LSAP_CRASH_ON_AUDIT_FAIL 1
+#define LSAP_ALLOW_ADIMIN_LOGONS_ONLY 2
+
+
+
+#endif // _NTRMLSA_
diff --git a/private/inc/ntrpcp.h b/private/inc/ntrpcp.h
new file mode 100644
index 000000000..97e9a258a
--- /dev/null
+++ b/private/inc/ntrpcp.h
@@ -0,0 +1,132 @@
+/*++
+
+Copyright (c) 1990,91 Microsoft Corporation
+
+Module Name:
+
+ ntrpcp.h
+
+Abstract:
+
+ This file contains prototypes for commonly used RPC functionality.
+ This includes: bind/unbind functions, MIDL user alloc/free functions,
+ and server start/stop functions.
+
+Author:
+
+ Dan Lafferty danl 06-Feb-1991
+
+Environment:
+
+ User Mode - Win32
+
+Revision History:
+
+ 06-Feb-1991 danl
+ Created
+
+ 26-Apr-1991 JohnRo
+ Added IN and OUT keywords to MIDL functions. Commented-out
+ (nonstandard) identifier on endif. Deleted tabs.
+
+ 03-July-1991 JimK
+ Commonly used aspects copied from LM specific file.
+
+--*/
+#ifndef _NTRPCP_
+#define _NTRPCP_
+
+#include <nt.h>
+#include <ntrtl.h> // needed for nturtl.h
+#include <nturtl.h>
+#include <windows.h> // win32 typedefs
+#include <rpc.h>
+
+//
+// DEFINES
+//
+
+
+
+//
+// Function Prototypes - routines called by MIDL-generated code:
+//
+
+void *
+MIDL_user_allocate(
+ IN unsigned int NumBytes
+ );
+
+void
+MIDL_user_free(
+ IN void *MemPointer
+ );
+
+//
+// Function Prototypes - routines to go along with the above, but aren't
+// needed by MIDL or any other non-network software.
+//
+
+void *
+MIDL_user_reallocate(
+ IN void * OldPointer OPTIONAL,
+ IN unsigned long NewByteCount
+ );
+
+unsigned long
+MIDL_user_size(
+ IN void * Pointer
+ );
+
+//
+// client side functions
+//
+
+
+NTSTATUS
+RpcpBindRpc(
+ IN LPWSTR servername,
+ IN LPWSTR servicename,
+ IN LPWSTR networkoptions,
+ OUT RPC_BINDING_HANDLE * pBindingHandle
+ );
+
+NTSTATUS
+RpcpUnbindRpc(
+ IN RPC_BINDING_HANDLE BindingHandle
+ );
+
+
+
+//
+// server side functions
+//
+
+DWORD
+RpcpInitRpcServer(
+ VOID
+ );
+
+NTSTATUS
+RpcpAddInterface(
+ IN LPWSTR InterfaceName,
+ IN RPC_IF_HANDLE InterfaceSpecification
+ );
+
+NTSTATUS
+RpcpStartRpcServer(
+ IN LPWSTR InterfaceName,
+ IN RPC_IF_HANDLE InterfaceSpecification
+ );
+
+NTSTATUS
+RpcpDeleteInterface(
+ IN RPC_IF_HANDLE InterfaceSpecification
+ );
+
+NTSTATUS
+RpcpStopRpcServer(
+ IN RPC_IF_HANDLE InterfaceSpecification
+ );
+
+#endif // _NTRPCP_
diff --git a/private/inc/ntsamp.h b/private/inc/ntsamp.h
new file mode 100644
index 000000000..f33c17781
--- /dev/null
+++ b/private/inc/ntsamp.h
@@ -0,0 +1,221 @@
+/*++
+
+Copyright (c) 1992 Microsoft Corporation
+
+Module Name:
+
+ ntsamp.h
+
+Abstract:
+
+ This file contains structures that would normally be part of ntsam.h
+ but are intended for system use only.
+
+Author:
+
+ David Chalmers (Davidc) 27-Mar-1992
+
+Environment:
+
+ User Mode - Win32
+
+Revision History:
+
+
+--*/
+
+
+#ifndef _NTSAMPRIVATE_
+#define _NTSAMPRIVATE_
+
+
+
+#include <crypt.h>
+#include <lsass.h>
+
+
+
+
+//
+// Structures usable in SetUserInformation and QueryUserInformation API calls
+// by trusted clients only
+//
+
+
+typedef struct _USER_INTERNAL1_INFORMATION {
+ NT_OWF_PASSWORD NtOwfPassword;
+ LM_OWF_PASSWORD LmOwfPassword;
+ BOOLEAN NtPasswordPresent;
+ BOOLEAN LmPasswordPresent;
+ BOOLEAN PasswordExpired; // A 'write-only' flag
+} USER_INTERNAL1_INFORMATION, *PUSER_INTERNAL1_INFORMATION;
+
+
+typedef struct _USER_INTERNAL2_INFORMATION {
+ ULONG StatisticsToApply;
+ OLD_LARGE_INTEGER LastLogon;
+ OLD_LARGE_INTEGER LastLogoff;
+ USHORT BadPasswordCount;
+ USHORT LogonCount;
+} USER_INTERNAL2_INFORMATION;
+
+
+//
+//
+//
+// The following flags may be used in the StatisticsToApply field.
+//
+// USER_LOGON_STAT_LAST_LOGOFF - Replace the LastLogoff time in the
+// user record.
+//
+// USER_LOGON_STATUS_LAST_LOGON - Replace the LastLogon time in the
+// user record.
+//
+// USER_LOGON_STATUS_BAD_PWD_COUNT - Replace the BadPasswordCount
+// field in the user record.
+//
+// USER_LOGON_STATUS_LOGON_COUNT - Replace the LogonCount field in the
+// user record.
+//
+// USER_LOGON_SUCCESSFUL_LOGON - Change user field values to indicate
+// that a successful logon has occured.
+//
+// USER_LOGON_SUCCESSFUL_LOGOFF - Change user field values to indicate
+// that a successful logoff has occured.
+//
+// USER_LOGON_BAD_PASSWORD - Change user field values to indicate that
+// an attempt was made to logon to the account with a bad password.
+//
+//
+// NOTE:
+// USER_LOGON_BAD_PASSWORD
+// USER_LOGON_INTER_SUCCESS_LOGON
+// USER_LOGON_INTER_SUCCESS_LOGOFF
+// USER_LOGON_NET_SUCCESS_LOGON
+// USER_LOGON_NET_SUCCESS_LOGOFF
+//
+// may not be used in conjunction with ANY other flags (including
+// each other). That is, when one of these flags is used, there
+// may be NO other flags set in StatisticsToApply.
+//
+
+#define USER_LOGON_STAT_LAST_LOGOFF (0x00000001L)
+#define USER_LOGON_STAT_LAST_LOGON (0x00000002L)
+#define USER_LOGON_STAT_BAD_PWD_COUNT (0x00000004L)
+#define USER_LOGON_STAT_LOGON_COUNT (0x00000008L)
+
+#define USER_LOGON_BAD_PASSWORD (0x08000000L)
+#define USER_LOGON_INTER_SUCCESS_LOGON (0x1000000L)
+#define USER_LOGON_INTER_SUCCESS_LOGOFF (0x20000000L)
+#define USER_LOGON_NET_SUCCESS_LOGON (0x40000000L)
+#define USER_LOGON_NET_SUCCESS_LOGOFF (0x80000000L)
+
+
+typedef struct _USER_INTERNAL3_INFORMATION {
+ USER_ALL_INFORMATION I1;
+ LARGE_INTEGER LastBadPasswordTime;
+} USER_INTERNAL3_INFORMATION, *PUSER_INTERNAL3_INFORMATION;
+
+
+//
+// The following is for SamrGetUserDomainPasswordInformation(), which is
+// only used in wrappers.c.
+//
+
+typedef struct _USER_DOMAIN_PASSWORD_INFORMATION {
+ USHORT MinPasswordLength;
+ ULONG PasswordProperties;
+} USER_DOMAIN_PASSWORD_INFORMATION, *PUSER_DOMAIN_PASSWORD_INFORMATION;
+
+
+//
+// This flag may be or'd with the length field of SAMP_USER_PASSWORD to
+// indicate that the password is not case sensitive.
+//
+
+#define SAM_PASSWORD_CASE_INSENSITIVE 0x80000000
+
+//
+// Structure to pass an encrypted password over the wire. The Length is the
+// length of the password, which should be placed at the end of the buffer.
+// The size of the buffer (256) should be kept in sync with
+// SAM_MAX_PASSWORD_LENGTH, which is defined in ntsam.h. Unfortunately,
+// MIDL does not let #define'd constants be imported, so we have to
+// use 256 instead of the constant here.
+//
+
+typedef struct _SAMPR_USER_PASSWORD {
+ WCHAR Buffer[SAM_MAX_PASSWORD_LENGTH];
+ ULONG Length;
+} SAMPR_USER_PASSWORD, *PSAMPR_USER_PASSWORD;
+
+//
+// Buffer - contains random fill with the password filling up the end
+// of the buffer (the last Length bytes).
+// Length - Length, in bytes, of the buffer.
+//
+
+//
+// This is the encrypted version of the above structure, and is passed
+// on the wire.
+//
+
+typedef struct _SAMPR_ENCRYPTED_USER_PASSWORD {
+ UCHAR Buffer[ (SAM_MAX_PASSWORD_LENGTH * 2) + 4 ];
+} SAMPR_ENCRYPTED_USER_PASSWORD, *PSAMPR_ENCRYPTED_USER_PASSWORD;
+
+
+//
+// ChangePassword API for One-Way-Function-aware clients
+//
+
+NTSTATUS
+SamiChangePasswordUser(
+ IN SAM_HANDLE UserHandle,
+ IN BOOLEAN LmOldPresent,
+ IN PLM_OWF_PASSWORD LmOldOwfPassword,
+ IN PLM_OWF_PASSWORD LmNewOwfPassword,
+ IN BOOLEAN NtPresent,
+ IN PNT_OWF_PASSWORD NtOldOwfPassword,
+ IN PNT_OWF_PASSWORD NtNewOwfPassword
+ );
+
+
+NTSTATUS
+SamiLmChangePasswordUser(
+ IN SAM_HANDLE UserHandle,
+ IN PENCRYPTED_LM_OWF_PASSWORD LmOldEncryptedWithLmNew,
+ IN PENCRYPTED_LM_OWF_PASSWORD LmNewEncryptedWithLmOld
+ );
+
+NTSTATUS
+SamiEncryptPasswords(
+ IN PUNICODE_STRING OldPassword,
+ IN PUNICODE_STRING NewPassword,
+ OUT PSAMPR_ENCRYPTED_USER_PASSWORD NewEncryptedWithOldNt,
+ OUT PENCRYPTED_NT_OWF_PASSWORD OldNtOwfEncryptedWithNewNt,
+ OUT PBOOLEAN LmPresent,
+ OUT PSAMPR_ENCRYPTED_USER_PASSWORD NewEncryptedWithOldLm,
+ OUT PENCRYPTED_NT_OWF_PASSWORD OldLmOwfEncryptedWithNewNt
+);
+
+NTSTATUS
+SamiChangePasswordUser2(
+ PUNICODE_STRING ServerName,
+ PUNICODE_STRING UserName,
+ PSAMPR_ENCRYPTED_USER_PASSWORD NewPasswordEncryptedWithOldNt,
+ PENCRYPTED_NT_OWF_PASSWORD OldNtOwfPasswordEncryptedWithNewNt,
+ BOOLEAN LmPresent,
+ PSAMPR_ENCRYPTED_USER_PASSWORD NewPasswordEncryptedWithOldLm,
+ PENCRYPTED_LM_OWF_PASSWORD OldLmOwfPasswordEncryptedWithNewLmOrNt
+ );
+
+NTSTATUS
+SamiOemChangePasswordUser2(
+ PSTRING ServerName,
+ PSTRING UserName,
+ PSAMPR_ENCRYPTED_USER_PASSWORD NewPasswordEncryptedWithOldLm,
+ PENCRYPTED_LM_OWF_PASSWORD OldLmOwfPasswordEncryptedWithNewLm
+ );
+
+#endif // _NTSAMPRIVATE_
diff --git a/private/inc/ntspider.h b/private/inc/ntspider.h
new file mode 100644
index 000000000..9e93b49ec
--- /dev/null
+++ b/private/inc/ntspider.h
@@ -0,0 +1,90 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ ntspider.h
+
+Abstract:
+
+ This module contains the declarations and definitions to compile
+ SpiderStreams and SpiderTCP sources for NT.
+
+ This must be the first file included in any source that includes a
+ Spider header file !!
+
+
+Author:
+
+ Eric Chin (ericc) July 18, 1991
+
+Revision History:
+
+--*/
+
+/*
+ * Since several variants of SpiderStreams and SpiderTCP can be built from
+ * one source base, there are many "#ifdef" directives sprinkled throughout
+ * Spider's code. This affects structure definitions, function arguments, ....
+ *
+ * For NT, we build one variant of Spider's products. To ensure that every
+ * Spider header is preprocessed identically and correctly every time, the
+ * options were:
+ *
+ * a) preprocess the Spider sources for NT, and check them in,
+ * b) add the definitions to CFLAGS in each and every directory's makefile,
+ * c) add the definitions to the environment variable, C_DEFINES,
+ * d) slip the macro definitions into <sys/stream.h>, or some such
+ * ubiquitous file,
+ * e) collect all the macro definitions in one header file, and modify
+ * every kernel-level Spider source to include it,
+ *
+ * This file implements option (e). The goal is to migrate to option (a).
+ *
+ */
+#ifndef _NTSPIDER_
+#define _NTSPIDER_
+
+//
+// temporary hack because CRT dev_t is a short
+//
+
+#define _DEV_T_DEFINED
+typedef unsigned long _dev_t; // for stat.h compatibility with types.h
+typedef unsigned long dev_t;
+
+
+/*
+ * Definitions for Conditional Compilation
+ */
+#define ALIGNDATA 1 /* align fields before use */
+#define DL_VERSION 2 /* sndis version */
+#define GENERICE 1 /* generic ethernet interface */
+#define IPOPTS 1 /* ip options */
+#define MP 1 /* build for multiprocessors */
+#define NETSTAT 1 /* netstat support */
+#define SINGLE_MALLOC 1 /* ExAllocatePool() only once */
+#define SNMP 1 /* snmp support */
+#define SNMP_STATS 1 /* snmp support */
+#define TCPOPT 1 /* tcp options */
+#define BUFFER_DATA 1 /* buffer data in nbt on sends */
+#define NO_LOCK_STATS 1 /* don't lock MIB statistics */
+#define OLD_RTX 1 /* use old TCP rtx code */
+
+//#define BSD4_3_KEEPALIVE 1 /* Berkeley style tcp keepalives */
+//#define ROUTED 1 /* routing information protocol */
+//#define NOTRAILER 1 /* BUGBUG: this is temporary !! */
+//#define HOSTREQ 1 /* rfc 1122, 1123 compliance */
+
+
+/*
+ * Do not define the following manifest constants unless you absolutely
+ * know the consequences !!
+ */
+//#define ARPRTASK 1 /* use arp's service procedures */
+//#define MULTIH 1 /* multiple ip nets per interface */
+//#define NO_TLI 1 /* no TLI/XTI interface */
+//#define TYPE_HACK 1 /* put bogus packets on the wire */
+
+#endif /* _NTSPIDER_ */
diff --git a/private/inc/ntstapi.h b/private/inc/ntstapi.h
new file mode 100644
index 000000000..f524cc795
--- /dev/null
+++ b/private/inc/ntstapi.h
@@ -0,0 +1,82 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ ntstapi.h
+
+Abstract:
+
+ This module declares the STREAMS APIs that are provided for use
+ primarily by the NT tcp/ip socket library.
+
+Author:
+
+ Eric Chin (ericc) July 26, 1991
+
+Revision History:
+
+ mikemas 01-02-92 Deleted poll definition. Mips complained because
+ of def in winsock.h
+
+ jballard 07-14-94 Added STRMAPI types. This should fix problems
+ building outside of the MS build environment.
+
+
+--*/
+
+#ifndef _NTSTAPI_
+#define _NTSTAPI_
+
+#ifndef STRMAPI
+
+#if (_MSC_VER >= 800)
+#define STRMAPI __stdcall
+#else
+#define STRMAPI
+#endif
+
+#endif
+
+
+//
+// s_close() is not provided. Use the open and close primitives that are
+// appropriate to your subsystem.
+//
+
+int
+STRMAPI
+getmsg(
+ IN HANDLE fd,
+ IN OUT struct strbuf *ctrlptr OPTIONAL,
+ IN OUT struct strbuf *dataptr OPTIONAL,
+ IN OUT int *flagsp
+ );
+
+int
+STRMAPI
+putmsg(
+ IN HANDLE fd,
+ IN struct strbuf *ctrlptr OPTIONAL,
+ IN struct strbuf *dataptr OPTIONAL,
+ IN int flags
+ );
+
+int
+STRMAPI
+s_ioctl(
+ IN HANDLE fd,
+ IN int cmd,
+ IN OUT void *arg OPTIONAL
+ );
+
+HANDLE
+STRMAPI
+s_open(
+ IN char *path,
+ IN int oflag,
+ IN int ignored
+ );
+
+#endif /* _NTSTAPI_ */
diff --git a/private/inc/ofslib.h b/private/inc/ofslib.h
new file mode 100644
index 000000000..d6f62f6b4
--- /dev/null
+++ b/private/inc/ofslib.h
@@ -0,0 +1,81 @@
+//+---------------------------------------------------------------------------
+//
+// Microsoft Windows
+// Copyright (C) Microsoft Corporation, 1992 - 1995.
+//
+// File: OfsLib.H
+//
+// Contents: Open support
+//
+// History: 20-Oct-95 VicH Created.
+//
+//----------------------------------------------------------------------------
+
+#ifndef __OFSLIB_H__
+#define __OFSLIB_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct DRTIMPORTENTRY
+{
+ char *pszFunc;
+ FARPROC *ppfn;
+};
+
+struct DRTIMPORTMODULE
+{
+ WCHAR *pwszModule;
+ HANDLE hDll;
+ struct DRTIMPORTENTRY *adie;
+ ULONG cdie;
+};
+
+BOOLEAN InitModule(struct DRTIMPORTMODULE *pdim);
+
+NTSTATUS
+OpenObject(
+ IN WCHAR const *pwszFile,
+ IN HANDLE hstgParent,
+ IN ULONG CreateOptions,
+ IN ULONG DesiredAccess,
+ IN ULONG ShareAccess,
+ IN ULONG CreateDisposition,
+ OUT HANDLE *ph);
+
+NTSTATUS
+CreatePropertySet(
+ IN HANDLE hstg,
+ IN GUID const *pguid,
+ IN USHORT Flags,
+ IN NTMEMORYALLOCATOR pma, // caller's memory allocator
+ OPTIONAL OUT HANDLE *phstgps,
+ OUT HANDLE *phstm,
+ OUT NTMAPPEDSTREAM *pms,
+ OUT NTPROP *pnp);
+
+VOID
+ClosePropertySet(
+ OPTIONAL IN HANDLE *phstgps,
+ IN HANDLE hstm,
+ IN NTPROP ms,
+ IN NTPROP np);
+
+
+VOID SetProgramName(char *pszProg);
+
+VOID SetVerbose(BOOLEAN fVerbose);
+
+VOID SetUnicode(BOOLEAN fUnicode);
+
+VOID SetDefaultPropSetAccess(ULONG DesiredAccess);
+
+VOID SetUnicodeCallouts(VOID);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __OFSLIB_H__
diff --git a/private/inc/olechar.h b/private/inc/olechar.h
new file mode 100644
index 000000000..2dbde5b21
--- /dev/null
+++ b/private/inc/olechar.h
@@ -0,0 +1,80 @@
+
+//+======================================================
+//
+// File: olechar.h
+//
+// Purpose: Provide wrappers for string-related
+// functions so that the Ansi or Unicode function
+// is called, whichever is appropriate for the
+// current OLECHAR definition.
+//
+// This file is similar to "tchar.h", except
+// that it covers OLECHARs rather than TCHARs.
+//
+// History:
+// 08-Nov-96 MikeHill Added ULTOO
+//
+//+======================================================
+
+
+#ifndef _OLECHAR_H_
+#define _OLECHAR_H_
+
+//#include <objbase.h>
+
+#ifdef OLE2ANSI
+
+# ifdef _MAC
+# define ocslen strlen
+# define ocscpy strcpy
+# define ocscmp strcmp
+# define ocscat strcat
+# define ocschr strchr
+# define soprintf sprintf
+# define oprintf printf
+# define ocsnicmp _strnicmp
+# else
+# define ocslen lstrlenA
+# define ocscpy lstrcpyA
+# define ocscmp lpstrcmpA
+# define ocscat lpstrcatA
+# define ocschr strchr
+# define soprintf sprintf
+# define oprintf printf
+# define ocsnicmp _strnicmp
+# endif
+
+ // "Unsigned Long to OLESTR"
+# define ULTOO(value,string,radix) _ultoa( (value), (string), (radix) )
+
+#else // !OLE2ANSI
+
+ // BUGBUG: In the #else below, restore wcslen to
+ // lstrlenW when property code is moved from NTDLL
+ // to OLE32.
+# ifdef IPROPERTY_DLL
+# define ocslen wcslen //lstrlenW
+# define ocscpy wcscpy
+# define ocscmp wcscmp
+# define ocscat wcscat
+# define ocschr wcschr
+# define soprintf swprintf
+# define oprintf wprintf
+# define ocsnicmp _wcsnicmp
+# else
+# define ocslen wcslen //lstrlenW
+# define ocscpy lstrcpyW
+# define ocscmp lstrcmpW
+# define ocscat lstrcatW
+# define ocschr wcschr
+# define soprintf swprintf
+# define oprintf wprintf
+# define ocsnicmp _wcsnicmp
+# endif
+
+ // "Unsigned Long to OLESTR"
+# define ULTOO(value,string,radix) _ultow( (value), (string), (radix) )
+
+#endif // !OLE2ANSI
+
+#endif // !_OLECHAR_H_
diff --git a/private/inc/packoff.h b/private/inc/packoff.h
new file mode 100644
index 000000000..0e0e2f4b2
--- /dev/null
+++ b/private/inc/packoff.h
@@ -0,0 +1,34 @@
+/*++
+
+Copyright (c) 1990,91 Microsoft Corporation
+
+Module Name:
+
+ packoff.h
+
+Abstract:
+
+ This file turns packing of structures off. (That is, it enables
+ automatic alignment of structure fields.) An include file is needed
+ because various compilers do this in different ways.
+
+ packoff.h is the complement to packon.h. An inclusion of packoff.h
+ MUST ALWAYS be preceded by an inclusion of packon.h, in one-to-one
+ correspondence.
+
+Author:
+
+ Chuck Lenzmeier (chuckl) 4-Mar-1990
+
+Revision History:
+
+ 15-Apr-1991 JohnRo
+ Created lint-able variant.
+--*/
+
+#if ! (defined(lint) || defined(_lint))
+#if ( _MSC_VER >= 800 )
+#pragma warning(disable:4103)
+#endif
+#pragma pack()
+#endif // ! (defined(lint) || defined(_lint))
diff --git a/private/inc/packon.h b/private/inc/packon.h
new file mode 100644
index 000000000..e42281399
--- /dev/null
+++ b/private/inc/packon.h
@@ -0,0 +1,32 @@
+/*++
+
+Copyright (c) 1990,91 Microsoft Corporation
+
+Module Name:
+
+ packon.h
+
+Abstract:
+
+ This file turns packing of structures on. (That is, it disables
+ automatic alignment of structure fields.) An include file is needed
+ because various compilers do this in different ways.
+
+ The file packoff.h is the complement to this file.
+
+Author:
+
+ Chuck Lenzmeier (chuckl) 4-Mar-1990
+
+Revision History:
+
+ 15-Apr-1991 JohnRo
+ Created lint-able variant.
+--*/
+
+#if ! (defined(lint) || defined(_lint))
+#if ( _MSC_VER >= 800 )
+#pragma warning(disable:4103)
+#endif
+#pragma pack(1) // x86, MS compiler; MIPS, MIPS compiler
+#endif // ! (defined(lint) || defined(_lint))
diff --git a/private/inc/prefix.h b/private/inc/prefix.h
new file mode 100644
index 000000000..e9b94b896
--- /dev/null
+++ b/private/inc/prefix.h
@@ -0,0 +1,63 @@
+/*++
+
+Copyright (c) 1992 Microsoft Corporation
+
+Module Name:
+
+ Prefix.h
+
+Abstract:
+
+ This header file declares equates for debug print "prefix" strings.
+ For the moment, these are of the form:
+
+ #define PREFIX_NETLIB "NETLIB: "
+
+ These are collected into a header file in case someone decides to
+ change the look of these strings, or internationalize them, or
+ whatever.
+
+Author:
+
+ John Rogers (JohnRo) 08-May-1992
+
+Environment:
+
+ Portable to just about any computer I ever saw. --JR
+
+Revision History:
+
+ 08-May-1992 JohnRo
+ Created.
+ 27-May-1992 JohnRo
+ Added PREFIX_SC and PREFIX_SC_CLIENT for service controller.
+ Added PREFIX_PORTUAS for PortUAS utility (run during setup).
+ 07-Aug-1992 JohnRo
+ RAID 1895: Net APIs and svc should use OEM char set (not ANSI).
+ (Added PREFIX_XACTSRV as part of support for that.)
+ 16-Aug-1992 JohnRo
+ RAID 2920: Support UTC timezone in net code.
+
+--*/
+
+
+#ifndef _PREFIX_
+#define _PREFIX_
+
+
+#define PREFIX_NETAPI "NETAPI32: "
+#define PREFIX_NETLIB "NETLIB: "
+#define PREFIX_NETLOGON "NETLOGON: "
+#define PREFIX_NETRAP "NETRAP: "
+#define PREFIX_PORTUAS "PORTUAS: "
+#define PREFIX_REPL "REPL: "
+#define PREFIX_REPL_CLIENT "REPL-CLIENT: "
+#define PREFIX_REPL_MASTER "REPL-MASTER: "
+#define PREFIX_SC "SC: "
+#define PREFIX_SC_CLIENT "SC-CLIENT: "
+#define PREFIX_WKSTA "WKSTA: "
+#define PREFIX_XACTSRV "XACTSRV: "
+
+
+
+#endif // ndef _PREFIX_
diff --git a/private/inc/propmac.hxx b/private/inc/propmac.hxx
new file mode 100644
index 000000000..30facf4a9
--- /dev/null
+++ b/private/inc/propmac.hxx
@@ -0,0 +1,479 @@
+//+--------------------------------------------------------------------------
+//
+// Microsoft Windows
+// Copyright (C) Microsoft Corporation, 1993
+//
+// File: propmac.hxx
+//
+// Contents: various macros used in property set code
+//
+// History:
+// 2/22/96 MikeHill - Protect from multiple inclusions.
+// - Made Add2Ptr()'s parms const.
+// - Copied DwordRemain to this file.
+// 2/29/96 MikeHill Removed IsDwordAligned.
+// 11/8/96 MikeHill Corrected new/delete implementation.
+//
+//---------------------------------------------------------------------------
+
+#ifndef _PROPMAC_HXX_
+#define _PROPMAC_HXX_
+
+#include <ByteOrdr.hxx>
+
+//
+// As part of moving away from using the C runtime library wherever possible,
+// use Win32 wide-character functions when they're available.
+//
+
+#ifdef _CHICAGO_
+
+# define Prop_wcslen lstrlenW
+# define Prop_wcsnicmp _wcsnicmp
+# define Prop_wcscmp wcscmp
+# define Prop_wcscpy lstrcpyW
+
+#else
+
+# define Prop_wcslen wcslen
+# define Prop_wcsnicmp _wcsnicmp
+# define Prop_wcscmp wcscmp
+# define Prop_wcscpy wcscpy
+
+#endif // _CHICAGO_
+
+#ifdef OLE2ANSI
+# define Prop_ocslen strlen
+#else
+# define Prop_ocslen Prop_wcslen
+#endif
+
+#ifdef _CAIRO_
+extern "C" NTSTATUS
+SynchronousNtFsControlFile(
+ IN HANDLE h,
+ OUT IO_STATUS_BLOCK *pisb,
+ IN ULONG FsControlCode,
+ IN VOID *pvIn OPTIONAL,
+ IN ULONG cbIn,
+ OUT VOID *pvOut OPTIONAL,
+ IN ULONG cbOut);
+#endif
+
+
+//+---------------------------------------------------------------------------
+// Function: Add2Ptr
+//
+// Synopsis: Add an unscaled increment to a ptr regardless of type.
+//
+// Arguments: [pv] -- Initial ptr.
+// [cb] -- Increment
+//
+// Returns: Incremented ptr.
+//
+//----------------------------------------------------------------------------
+
+inline VOID *
+Add2Ptr(VOID const *pv, ULONG cb)
+{
+ return((BYTE *) pv + cb);
+}
+
+
+//+---------------------------------------------------------------------------
+// Function: Add2ConstPtr
+//
+// Synopsis: Add an unscaled increment to a ptr regardless of type.
+//
+// Arguments: [pv] -- Initial ptr.
+// [cb] -- Increment
+//
+// Returns: Incremented ptr.
+//
+//----------------------------------------------------------------------------
+
+inline
+const VOID *
+Add2ConstPtr(const VOID *pv, ULONG cb)
+{
+ return((const BYTE *) pv + cb);
+}
+
+
+//+--------------------------------------------------------------------------
+// Function: CopyFileTime, private
+//
+// Synopsis: Copy LARGE_INTEGER time to FILETIME structure
+//
+// Arguments: [pft] -- pointer to FILETIME
+// [pli] -- pointer to LARGE_INTEGER
+//
+// Returns: Nothing
+//---------------------------------------------------------------------------
+
+__inline VOID
+CopyFileTime(OUT FILETIME *pft, IN LARGE_INTEGER *pli)
+{
+ pft->dwLowDateTime = pli->LowPart;
+ pft->dwHighDateTime = pli->HighPart;
+}
+
+
+//+--------------------------------------------------------------------------
+// Function: ZeroFileTime, private
+//
+// Synopsis: Zero FILETIME structure
+//
+// Arguments: [pft] -- pointer to FILETIME
+//
+// Returns: Nothing
+//---------------------------------------------------------------------------
+
+__inline VOID
+ZeroFileTime(OUT FILETIME *pft)
+{
+ pft->dwLowDateTime = pft->dwHighDateTime = 0;
+}
+
+
+#define DwordAlign(n) (((n) + sizeof(ULONG) - 1) & ~(sizeof(ULONG) - 1))
+#define DwordRemain(cb) ((sizeof(ULONG) - ((cb) % sizeof(ULONG))) % sizeof(ULONG))
+
+#define QuadAlign(n) (((n) + sizeof(LONGLONG) - 1) & ~(sizeof(LONGLONG) - 1))
+
+// stuff to make Nashville properties build
+#include <propapi.h>
+
+#if DBG
+extern "C" LONG ExceptionFilter(struct _EXCEPTION_POINTERS *pep);
+#else // DBG
+#define ExceptionFilter(pep) EXCEPTION_EXECUTE_HANDLER
+#endif // DBG
+
+extern "C" UNICODECALLOUTS UnicodeCallouts;
+
+
+// The CMemSerStream and CDeMemSerStream have different requirements for
+// handling buffer overflow conditions. In the case of the driver this
+// is indicative of a corrupted stream and we would like to raise an
+// exception. On the other hand in Query implementation we deal with
+// streams whose sizes are precomputed in the user mode. Therefore we
+// do not wish to incur any additional penalty in handling such situations.
+// In debug builds this condition is asserted while in retail builds it is
+// ignored. The CMemSerStream and CMemDeSerStream implementation are
+// implemented using a macro HANDLE_OVERFLOW(fOverflow) which take the
+// appropriate action.
+
+#define HANDLE_OVERFLOW(fOverflow) \
+ if (fOverflow) { \
+ PropRaiseException(STATUS_BUFFER_OVERFLOW); \
+ }
+
+
+//
+// Declare or Define the new/delete operators. In NTDLL, the declaration
+// is provided by ntpropb.cxx and uses the Rtl heap. In OLE32, the
+// declaration is provided by ole32\com\util\w32new.cxx and uses the IMalloc
+// heap. In IProp.DLL, the declaration is provided here (as an inline).
+//
+
+#ifdef IPROPERTY_DLL
+
+ inline void* _CRTAPI1
+ operator new(size_t cb)
+ {
+ return( CoTaskMemAlloc(cb) );
+ }
+
+ inline void _CRTAPI1
+ operator delete(void *pv)
+ {
+ CoTaskMemFree( pv );
+ }
+
+#else // #ifdef IPROPERTY_DLL
+
+ void* _CRTAPI1 operator new(size_t cb);
+ void _CRTAPI1 operator delete(void *pv);
+
+#endif // #ifdef IPROPERTY_DLL ... #else
+
+
+
+#define newk(Tag, pCounter) new
+
+#if DBG
+extern "C" ULONG DebugLevel;
+extern "C" ULONG DebugIndent;
+
+#define DEBTRACE_ERROR (ULONG) 0x00000001
+#define DEBTRACE_WARN (ULONG) 0x00000002
+#define DEBTRACE_CREATESTREAM (ULONG) 0x00000004
+#define DEBTRACE_NTPROP (ULONG) 0x00000008
+#define DEBTRACE_MAPSTM (ULONG) 0x00000010
+#define DEBTRACE_PROPERTY (ULONG) 0x00000020
+#define DEBTRACE_SUMCAT (ULONG) 0x00000040
+#define DEBTRACE_PROPVALIDATE (ULONG) 0x00010000 // awfully noisy
+#define DEBTRACE_PROPPATCH (ULONG) 0x00020000 // awfully noisy
+
+#ifndef WINNT
+// in Nashville this is defined in ole32\stg\props\utils.cxx
+extern ULONG DbgPrint(PCHAR Format, ...);
+#endif
+
+#define DebugTrace(indent, flag, args) \
+ if ((flag) == 0 || (DebugLevel & (flag))) \
+ { \
+ DebugIndent += (ULONG) (indent); \
+ DbgPrint("NTDLL: %*s", DebugIndent, ""); \
+ DbgPrint args; \
+ } \
+ else
+
+class CDebugTrace {
+public:
+ inline CDebugTrace(CHAR *psz);
+ inline ~CDebugTrace();
+private:
+ CHAR const *const _psz;
+};
+
+inline CDebugTrace::CDebugTrace(CHAR *psz): _psz(psz)
+{
+ DebugTrace(+1, 0, ("Entering -- %s\n", _psz));
+}
+
+inline CDebugTrace::~CDebugTrace()
+{
+ DebugTrace(-1, 0, ("Exiting -- %s\n", _psz));
+}
+
+#define DEBUG_TRACE(ProcName) CDebugTrace _trace_(#ProcName);
+#else
+#define DebugTrace(indent, flag, args)
+#define DEBUG_TRACE(ProcName)
+#endif
+
+
+// Macro to create the OSVersion field of the property
+// set header.
+
+#define MAKEPSVER(oskind, major, minor) \
+ (((oskind) << 16) | ((minor) << 8) | (major))
+
+
+
+//+-----------------------------------------------------------------------
+//+-----------------------------------------------------------------------
+//
+// Byte-swapping functions
+//
+//+-----------------------------------------------------------------------
+//+-----------------------------------------------------------------------
+
+// FmtID Byte-Swapped Comparisson. I.e, does rfmtid1 equal
+// a byte-swapped rfmtid2?
+
+inline BOOL IsEqualFMTIDByteSwap( REFFMTID rfmtid1, REFFMTID rfmtid2 )
+{
+
+ return( rfmtid1.Data1 == ByteSwap(rfmtid2.Data1)
+ &&
+ rfmtid1.Data2 == ByteSwap(rfmtid2.Data2)
+ &&
+ rfmtid1.Data3 == ByteSwap(rfmtid2.Data3)
+ &&
+ !memcmp(&rfmtid1.Data4, &rfmtid2.Data4, sizeof(rfmtid1.Data4))
+ );
+}
+
+
+// This define is for a special-case value of cbByteSwap in
+// PBSBuffer
+
+#define CBBYTESWAP_UID ((ULONG) -1)
+
+// The following byte-swapping functions mostly forward the call
+// to the ByteSwap overloads when compiled in a big-endian
+// system, and NOOP when compiled in a little-endian
+// system (because property sets are always little-endian).
+
+#ifdef BIGENDIAN
+
+// This is a big-endian build, property byte-swapping is enabled.
+
+// -----------
+// Swap a Byte
+// -----------
+
+// This exists primarily so that PropByteSwap(OLECHAR) will work
+// whether OLECHAR is Unicode or Ansi.
+
+inline BYTE PropByteSwap( UCHAR uc )
+{
+ return ByteSwap( (BYTE) uc );
+}
+inline VOID PropByteSwap( UCHAR *puc)
+{
+ ByteSwap( (BYTE*) puc );
+}
+inline char PropByteSwap( CHAR c )
+{
+ return (CHAR) ByteSwap( (BYTE) c );
+}
+inline VOID PropByteSwap( CHAR *pc )
+{
+ ByteSwap( (BYTE*) pc );
+}
+
+// -----------
+// Swap a Word
+// -----------
+
+inline WORD PropByteSwap( WORD w )
+{
+ return ByteSwap(w);
+}
+inline VOID PropByteSwap( WORD *pw )
+{
+ ByteSwap(pw);
+}
+inline SHORT PropByteSwap( SHORT s )
+{
+ PROPASSERT( sizeof(WORD) == sizeof(SHORT) );
+ return ByteSwap( (WORD) s );
+}
+inline VOID PropByteSwap( SHORT *ps )
+{
+ PROPASSERT( sizeof(WORD) == sizeof(SHORT) );
+ ByteSwap( (WORD*) ps );
+}
+
+// ------------
+// Swap a DWORD
+// ------------
+
+inline DWORD PropByteSwap( DWORD dw )
+{
+ return ByteSwap(dw);
+}
+inline VOID PropByteSwap( DWORD *pdw )
+{
+ ByteSwap(pdw);
+}
+inline LONG PropByteSwap( LONG l )
+{
+ PROPASSERT( sizeof(DWORD) == sizeof(LONG) );
+ return ByteSwap( (DWORD) l );
+}
+inline VOID PropByteSwap( LONG *pl )
+{
+ PROPASSERT( sizeof(DWORD) == sizeof(LONG) );
+ ByteSwap( (DWORD*) pl );
+}
+
+// -------------------------
+// Swap a LONGLONG (64 bits)
+// -------------------------
+
+// This routine byte-swaps the LONGLONG's DWORDs independently;
+// because in the property code, we might swap a
+// LONGLONG within a property set, which is only
+// 32 bit aligned.
+
+inline VOID PropByteSwap( LONGLONG *pll )
+{
+ DWORD dwFirst, dwSecond;
+ PROPASSERT( sizeof(LONGLONG) == 2 * sizeof(DWORD) );
+
+ // Get this LONGLONG's two DWORDs
+ dwFirst = *(DWORD*) pll;
+ dwSecond = *( (DWORD*) pll + 1 );
+
+ // Swap each of the DWORDs
+ ByteSwap( &dwFirst );
+ ByteSwap( &dwSecond );
+
+ // Put the DWORDs back into the LONGLONG, but with
+ // their order swapped (second the first).
+
+ *(DWORD*) pll = dwSecond;
+ *( (DWORD*) pll + 1 ) = dwFirst;
+}
+inline LONGLONG PropByteSwap( LONGLONG ll )
+{
+ PropByteSwap( &ll );
+ return( ll );
+}
+
+// -----------
+// Swap a GUID
+// -----------
+
+inline VOID PropByteSwap( GUID *pguid )
+{
+ ByteSwap(pguid);
+ return;
+}
+
+
+#else // Little Endian
+
+// This is a little-endian build, property byte-swapping is disabled.
+
+
+inline BYTE PropByteSwap( BYTE b )
+{
+ return (b);
+}
+inline VOID PropByteSwap( BYTE *pb )
+{
+}
+
+
+inline WORD PropByteSwap( WORD w )
+{
+ return (w);
+}
+inline VOID PropByteSwap( WORD *pw )
+{
+}
+inline SHORT PropByteSwap( SHORT s )
+{
+ return (s);
+}
+inline VOID PropByteSwap( SHORT *ps )
+{
+}
+
+inline DWORD PropByteSwap( DWORD dw )
+{
+ return (dw);
+}
+inline VOID PropByteSwap( DWORD *pdw )
+{
+}
+inline LONG PropByteSwap( LONG l )
+{
+ return (l);
+}
+inline VOID PropByteSwap( LONG *pl )
+{
+}
+
+inline LONGLONG PropByteSwap( LONGLONG ll )
+{
+ return(ll);
+}
+inline VOID PropByteSwap( LONGLONG *pll )
+{
+}
+
+inline VOID PropByteSwap( GUID *pguid )
+{
+}
+
+
+#endif // #ifdef BIGENDIAN ... #else
+
+#endif // _PROPMAC_HXX_
diff --git a/private/inc/protocol.h b/private/inc/protocol.h
new file mode 100644
index 000000000..38a822a77
--- /dev/null
+++ b/private/inc/protocol.h
@@ -0,0 +1,180 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ protocol.h
+
+Abstract:
+
+ This file defines the protocol specific constants for NT Lanman
+
+
+Author:
+
+ Larry Osterman (larryo) 5-Apr-1991
+
+Revision History:
+
+ 5-Apr-1991 LarryO
+
+ Created from LANMAN 1.2 protocol header.
+
+--*/
+
+
+#ifndef _PROTOCOL_
+#define _PROCOTOL_
+
+//
+//
+// Define protocol names
+//
+//
+
+
+//
+// PCNET1 is the original SMB protocol (CORE).
+//
+
+#define PCNET1 "PC NETWORK PROGRAM 1.0"
+
+//
+// Some versions of the original MSNET defined this as an alternate
+// to the core protocol name
+//
+
+#define PCLAN1 "PCLAN1.0"
+
+//
+// This is used for the MS-NET 1.03 product. It defines Lock&Read,
+// Write&Unlock, and a special version of raw read and raw write.
+//
+#define MSNET103 "MICROSOFT NETWORKS 1.03"
+
+//
+// This is the DOS Lanman 1.0 specific protocol. It is equivilant
+// to the LANMAN 1.0 protocol, except the server is required to
+// map errors from the OS/2 error to an appropriate DOS error.
+//
+#define MSNET30 "MICROSOFT NETWORKS 3.0"
+
+//
+// This is the first version of the full LANMAN 1.0 protocol, defined in
+// the SMB FILE SHARING PROTOCOL EXTENSIONS VERSION 2.0 document.
+//
+
+#define LANMAN10 "LANMAN1.0"
+
+//
+// This is the first version of the full LANMAN 2.0 protocol, defined in
+// the SMB FILE SHARING PROTOCOL EXTENSIONS VERSION 3.0 document. Note
+// that the name is an interim protocol definition. This is for
+// interoperability with IBM LAN SERVER 1.2
+//
+
+#define LANMAN12 "LM1.2X002"
+
+//
+// This is the dos equivilant of the LANMAN12 protocol. It is identical
+// to the LANMAN12 protocol, but the server will perform error mapping
+// to appropriate DOS errors.
+//
+#define DOSLANMAN12 "DOS LM1.2X002" /* DOS equivalant of above. Final
+ * string will be "DOS LANMAN2.0" */
+
+//
+// Strings for LANMAN 2.1.
+//
+#define LANMAN21 "LANMAN2.1"
+#define DOSLANMAN21 "DOS LANMAN2.1"
+
+//
+// !!! Do not set to final protcol string until the spec
+// is cast in stone.
+//
+// The SMB protocol designed for NT. This has special SMBs
+// which duplicate the NT semantics.
+//
+#define NTLANMAN "NT LM 0.12"
+
+//
+// The Cairo dialect
+//
+//
+#define CAIROX "Cairo 0.xa"
+
+
+//
+// The XENIXCORE dialect is a bit special. It is identical to core,
+// except user passwords are not to be uppercased before being shipped
+// to the server
+//
+#define XENIXCORE "XENIX CORE"
+
+
+//
+// Windows for Workgroups V1.0
+//
+#define WFW10 "Windows for Workgroups 3.1a"
+
+
+#define PCNET1_SZ 22
+#define PCLAN1_SZ 8
+
+#define MSNET103_SZ 23
+#define MSNET30_SZ 22
+
+#define LANMAN10_SZ 9
+#define LANMAN12_SZ 9
+
+#define DOSLANMAN12_SZ 13
+
+
+
+/*
+ * Defines and data for Negotiate Protocol
+ */
+#define PC1 0
+#define PC2 1
+#define LM1 2
+#define MS30 3
+#define MS103 4
+#define LM12 5
+#define DOSLM12 6
+
+
+/* Protocol indexes definition. */
+#define PCLAN 1 /* PC Lan 1.0 & MS Lan 1.03 */
+#define MSNT30 2 /* MS Net 3.0 redirector */
+#define DOSLM20 3 /* Dos LAN Manager 2.0 */
+#define LANMAN 4 /* Lanman redirector */
+#define LANMAN20 5 /* Lan Manager 2.0 */
+
+//
+// Protocol specific path constraints.
+//
+
+#define MAXIMUM_PATHLEN_LANMAN12 260
+#define MAXIMUM_PATHLEN_CORE 128
+
+#define MAXIMUM_COMPONENT_LANMAN12 254
+#define MAXIMUM_COMPONENT_CORE 8+1+3 // 8.3 filenames.
+
+
+/*NOINC*/
+/* CLTYPE_BASE should specify the name the first string in the file
+ apperr2.h. NUM_CLTYPES should be equal to the index of the last
+ protocol just as is the case with the above definitions. Also,
+ this part should be ifdef'd so that only the files that also include
+ the apperr2.h header will have it defined. */
+
+#ifdef APE2_CLIENT_DOWNLEVEL
+
+#define CLTYPE_BASE APE2_CLIENT_DOWNLEVEL
+#define NUM_CLTYPES LANMAN20
+
+#endif
+
+#endif // _PROTOCOL_
diff --git a/private/inc/rnraddrs.h b/private/inc/rnraddrs.h
new file mode 100644
index 000000000..7cb760031
--- /dev/null
+++ b/private/inc/rnraddrs.h
@@ -0,0 +1,56 @@
+/***********************************************************************
+* Microsoft RnR Transport location definitions
+*
+* Microsoft Confidential. Copyright 1991-1994 Microsoft Corporation.
+*
+* Component:
+*
+* File: rnraddrs.h
+*
+*
+* Revision History:
+*
+* 26-10-94 Created Arnoldm
+*
+***********************************************************************/
+
+#ifndef __RNRADDRS_H__
+#define __RNRADDRS_H__
+
+//
+// Define the IP multicast address and TTL values
+//
+
+#define IP_S_MEMBERSHIP "224.0.1.24" // the address
+
+//
+// Macro to render the string form into an inet_addr form
+//
+
+#define INET_ADDR_MEMBERSHIP (inet_addr(IP_S_MEMBERSHIP))
+
+//
+// The port we use for locating naming information
+//
+
+#define IPMEMBERWKP 445
+
+//
+// TTL definitions used for locating names
+//
+
+#define TTL_SUBNET_ONLY 1 // no routing
+#define TTL_REASONABLE_REACH 2 // across one router
+#define TTL_MAX_REACH 6 // Default max diameter. This may
+ // be overriden via the Registry.
+
+#define TIMEOUT_MAX_MAX 15000 // max wait time for responses. As with
+ // TTL_MAX_REACH, the registry can supply
+ // a different value
+
+//
+// Definitions for IPX SAP IDs
+//
+
+#define RNRCLASSSAPTYPE 0x64F // official SAP ID
+#endif
diff --git a/private/inc/samimp.h b/private/inc/samimp.h
new file mode 100644
index 000000000..7f9dde1ae
--- /dev/null
+++ b/private/inc/samimp.h
@@ -0,0 +1,12 @@
+
+#include <nt.h>
+//#include <ntrpcnew.h>
+#include <lsass.h>
+#include <ntsam.h>
+#include <ntsamp.h>
+
+
+#ifdef MIDL_PASS
+// put any typedef redefinitions in here...
+#endif
+
diff --git a/private/inc/samisrv.h b/private/inc/samisrv.h
new file mode 100644
index 000000000..572805708
--- /dev/null
+++ b/private/inc/samisrv.h
@@ -0,0 +1,234 @@
+/*++
+
+Copyright (c) 1992 Microsoft Corporation
+
+Module Name:
+
+ samisrv.h
+
+Abstract:
+
+ This file contain private routines for use by Trusted SAM clients
+ which live in the same process as the SAM server.
+
+ Included in these routines are services for freeing buffers returned
+ by RPC server stub routines (SamrXxx() routines).
+
+Author:
+
+ Cliff Van Dyke (CliffV) 26-Feb-1992
+
+Environment:
+
+ User Mode - Win32
+
+Revision History:
+
+
+--*/
+
+#ifndef _SAMISRV_
+#define _SAMISRV_
+
+/////////////////////////////////////////////////////////////////////////////
+// //
+// Data types used by SAM and Netlogon for database replication //
+// //
+/////////////////////////////////////////////////////////////////////////////
+
+typedef enum _SECURITY_DB_TYPE {
+ SecurityDbSam = 1,
+ SecurityDbLsa
+} SECURITY_DB_TYPE, *PSECURITY_DB_TYPE;
+
+//
+// These structures are used to get and set private data. Note that
+// DataType must be the first field of every such structure.
+//
+
+typedef enum _SAMI_PRIVATE_DATA_TYPE {
+ SamPrivateDataNextRid = 1,
+ SamPrivateDataPassword
+} SAMI_PRIVATE_DATA_TYPE, *PSAMI_PRIVATE_DATA_TYPE;
+
+
+typedef struct _SAMI_PRIVATE_DATA_NEXTRID_TYPE {
+ SAMI_PRIVATE_DATA_TYPE DataType;
+ ULONG NextRid;
+} SAMI_PRIVATE_DATA_NEXTRID_TYPE, *PSAMI_PRIVATE_DATA_NEXTRID_TYPE;
+
+typedef struct _SAMI_PRIVATE_DATA_PASSWORD_TYPE {
+ SAMI_PRIVATE_DATA_TYPE DataType;
+ UNICODE_STRING CaseInsensitiveDbcs;
+ ENCRYPTED_LM_OWF_PASSWORD CaseInsensitiveDbcsBuffer;
+ UNICODE_STRING CaseSensitiveUnicode;
+ ENCRYPTED_NT_OWF_PASSWORD CaseSensitiveUnicodeBuffer;
+ UNICODE_STRING LmPasswordHistory;
+ UNICODE_STRING NtPasswordHistory;
+} SAMI_PRIVATE_DATA_PASSWORD_TYPE, *PSAMI_PRIVATE_DATA_PASSWORD_TYPE;
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// The following prototypes are usable throughout the process that SAM //
+// resides in. This may include calls by LAN Manager code that is not //
+// part of SAM but is in the same process as SAM. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+NTSTATUS
+SamIConnect(
+ IN PSAMPR_SERVER_NAME ServerName,
+ OUT SAMPR_HANDLE *ServerHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN BOOLEAN TrustedClient
+ );
+
+NTSTATUS
+SamIAccountRestrictions(
+ IN SAM_HANDLE UserHandle,
+ IN PUNICODE_STRING LogonWorkstation,
+ IN PUNICODE_STRING Workstations,
+ IN PLOGON_HOURS LogonHours,
+ OUT PLARGE_INTEGER LogoffTime,
+ OUT PLARGE_INTEGER KickoffTime
+ );
+
+NTSTATUS
+SamICreateAccountByRid(
+ IN SAMPR_HANDLE DomainHandle,
+ IN SAM_ACCOUNT_TYPE AccountType,
+ IN ULONG RelativeId,
+ IN PRPC_UNICODE_STRING AccountName,
+ IN ACCESS_MASK DesiredAccess,
+ OUT SAMPR_HANDLE *AccountHandle,
+ OUT ULONG *ConflictingAccountRid
+ );
+
+NTSTATUS
+SamIGetSerialNumberDomain(
+ IN SAMPR_HANDLE DomainHandle,
+ OUT PLARGE_INTEGER ModifiedCount,
+ OUT PLARGE_INTEGER CreationTime
+ );
+
+NTSTATUS
+SamISetSerialNumberDomain(
+ IN SAMPR_HANDLE DomainHandle,
+ IN PLARGE_INTEGER ModifiedCount,
+ IN PLARGE_INTEGER CreationTime,
+ IN BOOLEAN StartOfFullSync
+ );
+
+NTSTATUS
+SamIGetPrivateData(
+ IN SAMPR_HANDLE SamHandle,
+ IN PSAMI_PRIVATE_DATA_TYPE PrivateDataType,
+ OUT PBOOLEAN SensitiveData,
+ OUT PULONG DataLength,
+ OUT PVOID *Data
+ );
+
+NTSTATUS
+SamISetPrivateData(
+ IN SAMPR_HANDLE SamHandle,
+ IN ULONG DataLength,
+ IN PVOID Data
+ );
+
+NTSTATUS
+SamISetAuditingInformation(
+ IN PPOLICY_AUDIT_EVENTS_INFO PolicyAuditEventsInfo
+ );
+
+NTSTATUS
+SamINotifyDelta (
+ IN SAMPR_HANDLE DomainHandle,
+ IN SECURITY_DB_DELTA_TYPE DeltaType,
+ IN SECURITY_DB_OBJECT_TYPE ObjectType,
+ IN ULONG ObjectRid,
+ IN PUNICODE_STRING ObjectName,
+ IN ULONG ReplicateImmediately,
+ IN PSAM_DELTA_DATA DeltaData OPTIONAL
+ );
+
+NTSTATUS
+SamIEnumerateAccountRids(
+ IN SAMPR_HANDLE DomainHandle,
+ IN ULONG AccountTypesMask,
+ IN ULONG StartingRid,
+ IN ULONG PreferedMaximumLength,
+ OUT PULONG ReturnCount,
+ OUT PULONG *AccountRids
+ );
+
+
+
+VOID
+SamIFree_SAMPR_SR_SECURITY_DESCRIPTOR (
+ PSAMPR_SR_SECURITY_DESCRIPTOR Source
+ );
+
+VOID
+SamIFree_SAMPR_DOMAIN_INFO_BUFFER (
+ PSAMPR_DOMAIN_INFO_BUFFER Source,
+ DOMAIN_INFORMATION_CLASS Branch
+ );
+
+VOID
+SamIFree_SAMPR_ENUMERATION_BUFFER (
+ PSAMPR_ENUMERATION_BUFFER Source
+ );
+
+VOID
+SamIFree_SAMPR_PSID_ARRAY (
+ PSAMPR_PSID_ARRAY Source
+ );
+
+VOID
+SamIFree_SAMPR_ULONG_ARRAY (
+ PSAMPR_ULONG_ARRAY Source
+ );
+
+VOID
+SamIFree_SAMPR_RETURNED_USTRING_ARRAY (
+ PSAMPR_RETURNED_USTRING_ARRAY Source
+ );
+
+VOID
+SamIFree_SAMPR_GROUP_INFO_BUFFER (
+ PSAMPR_GROUP_INFO_BUFFER Source,
+ GROUP_INFORMATION_CLASS Branch
+ );
+
+VOID
+SamIFree_SAMPR_ALIAS_INFO_BUFFER (
+ PSAMPR_ALIAS_INFO_BUFFER Source,
+ ALIAS_INFORMATION_CLASS Branch
+ );
+
+VOID
+SamIFree_SAMPR_GET_MEMBERS_BUFFER (
+ PSAMPR_GET_MEMBERS_BUFFER Source
+ );
+
+VOID
+SamIFree_SAMPR_USER_INFO_BUFFER (
+ PSAMPR_USER_INFO_BUFFER Source,
+ USER_INFORMATION_CLASS Branch
+ );
+
+VOID
+SamIFree_SAMPR_GET_GROUPS_BUFFER (
+ PSAMPR_GET_GROUPS_BUFFER Source
+ );
+
+VOID
+SamIFree_SAMPR_DISPLAY_INFO_BUFFER (
+ PSAMPR_DISPLAY_INFO_BUFFER Source,
+ DOMAIN_DISPLAY_INFORMATION Branch
+ );
+
+
+#endif // _SAMISRV_
diff --git a/private/inc/samsrv.h b/private/inc/samsrv.h
new file mode 100644
index 000000000..22bd23198
--- /dev/null
+++ b/private/inc/samsrv.h
@@ -0,0 +1,70 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ samsrv.h
+
+Abstract:
+
+ This file contains SAM server definitions that are used both
+ internally within the SAM server and by other components
+ in the security server.
+
+
+ NOTE: NetLogon calls SAM's RPC server stubs directly.
+ The interface definitions for those routines are
+ defined in MIDL generated include files.
+
+
+Author:
+
+ Jim Kelly (JimK) 1-Feb-199
+
+Environment:
+
+ User Mode - Win32
+
+Revision History:
+
+
+--*/
+
+#ifndef _SAMSRV_
+#define _SAMSRV_
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// Includes //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+#include <nt.h>
+#include <ntsam.h>
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// The following prototypes are usable throughout the process that SAM //
+// resides in. This may include calls by LAN Manager code that is not //
+// part of SAM but is in the same process as SAM. //
+// //
+// Many private services, defined in samisrv.h, are also available //
+// to NetLogon through a special arrangement. //
+// //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+
+NTSTATUS
+SamIInitialize( VOID );
+
+
+
+
+#endif // _SAMSRV_
diff --git a/private/inc/scmso.h b/private/inc/scmso.h
new file mode 100644
index 000000000..a2de1cf8d
--- /dev/null
+++ b/private/inc/scmso.h
@@ -0,0 +1,29 @@
+//+-------------------------------------------------------------------------
+//
+// Microsoft Windows
+// Copyright (C) Microsoft Corporation, 1992 - 1992.
+//
+// File: ScmSo.H
+//
+// Contents: For Service Control Manager to Create the Cairo Service
+// Objects. In DSOBJS.DLL.
+//
+// History: 15-Jun-95 RajNath Created
+//
+//--------------------------------------------------------------------------
+#define DS_LIB_NAME TEXT("DSSRV.Dll")
+#define SO_CALL_BACK "ScmCallSvcObject"
+
+//
+// dwCallTypes
+//
+#define SO_CREATE 1
+#define SO_DELETE 2
+#define SO_MODIFY 3
+
+typedef HRESULT(*SOCALLBACK)(DWORD dwCallType, LPWSTR pszSvcName,LPWSTR pszSvcDisplayName);
+
+
+
+
+
diff --git a/private/inc/seopaque.h b/private/inc/seopaque.h
new file mode 100644
index 000000000..b42828f54
--- /dev/null
+++ b/private/inc/seopaque.h
@@ -0,0 +1,191 @@
+/*++ BUILD Version: 0002 // Increment this if a change has global effects
+
+Copyright (c) 1989 Microsoft Corporation
+
+Module Name:
+
+ seopaque.h
+
+Abstract:
+
+ This module contains definitions of opaque Security data structures.
+
+ These structures are available to user and kernel security routines
+ only.
+
+ This file is not included by including "ntos.h".
+
+Author:
+
+ Jim Kelly (Jimk) 23-Mar-1990
+
+Revision History:
+
+--*/
+
+#ifndef _SEOPAQUE_
+#define _SEOPAQUE_
+
+///////////////////////////////////////////////////////////////////////////
+// //
+// Private Structures //
+// //
+///////////////////////////////////////////////////////////////////////////
+
+//
+// Generic ACE structures, to be used for casting ACE's of known types
+//
+
+typedef struct _KNOWN_ACE {
+ ACE_HEADER Header;
+ ACCESS_MASK Mask;
+ ULONG SidStart;
+} KNOWN_ACE, *PKNOWN_ACE;
+
+typedef struct _KNOWN_COMPOUND_ACE {
+ ACE_HEADER Header;
+ ACCESS_MASK Mask;
+ USHORT CompoundAceType;
+ USHORT Reserved;
+ ULONG SidStart;
+} KNOWN_COMPOUND_ACE, *PKNOWN_COMPOUND_ACE;
+
+//typedef struct _KNOWN_IMPERSONATION_ACE {
+// ACE_HEADER Header;
+// ACCESS_MASK Mask;
+// USHORT DataType;
+// USHORT Argument;
+// ULONG Operands;
+//} KNOWN_IMPERSONATION_ACE, *PKNOWN_IMPERSONATION_ACE;
+
+
+
+///////////////////////////////////////////////////////////////////////////
+// //
+// Miscellaneous support macros //
+// //
+///////////////////////////////////////////////////////////////////////////
+
+//
+// Given a pointer return its word aligned equivalent value
+//
+
+#define WordAlign(Ptr) ( \
+ (PVOID)((((ULONG)(Ptr)) + 1) & 0xfffffffe) \
+ )
+
+//
+// Given a pointer return its longword aligned equivalent value
+//
+
+#define LongAlign(Ptr) ( \
+ (PVOID)((((ULONG)(Ptr)) + 3) & 0xfffffffc) \
+ )
+
+//
+// Given a pointer return its quadword aligned equivalent value
+//
+
+#define QuadAlign(Ptr) ( \
+ (PVOID)((((ULONG)(Ptr)) + 7) & 0xfffffff8) \
+ )
+
+//
+// This macro returns TRUE if a flag in a set of flags is on and FALSE
+// otherwise
+//
+
+#define FlagOn(Flags,SingleFlag) ( \
+ ((Flags) & (SingleFlag)) != 0 ? TRUE : FALSE \
+ )
+
+//
+// This macro clears a single flag in a set of flags
+//
+
+#define ClearFlag(Flags,SingleFlag) { \
+ (Flags) &= ~(SingleFlag); \
+ }
+
+//
+// Get a pointer to the first ace in an acl
+//
+
+#define FirstAce(Acl) ((PVOID)((PUCHAR)(Acl) + sizeof(ACL)))
+
+//
+// Get a pointer to the following ace
+//
+
+#define NextAce(Ace) ((PVOID)((PUCHAR)(Ace) + ((PACE_HEADER)(Ace))->AceSize))
+
+//
+// Determine if an ace is a standard ace
+//
+
+#define IsCompoundAceType(Ace) ( \
+ (((PACE_HEADER)(Ace))->AceType == ACCESS_ALLOWED_COMPOUND_ACE_TYPE))
+
+//
+// A "known" ACE is one of the types that existed before the introduction of
+// compound ACEs. While the name is no longer as accurate as it used to be,
+// it's convenient.
+//
+
+#define IsKnownAceType(Ace) ( \
+ (((PACE_HEADER)(Ace))->AceType == ACCESS_ALLOWED_ACE_TYPE) || \
+ (((PACE_HEADER)(Ace))->AceType == ACCESS_DENIED_ACE_TYPE) || \
+ (((PACE_HEADER)(Ace))->AceType == SYSTEM_AUDIT_ACE_TYPE) || \
+ (((PACE_HEADER)(Ace))->AceType == SYSTEM_ALARM_ACE_TYPE) \
+ )
+
+//
+// Update this macro as new MS-Defined ACE types are added.
+//
+
+#define IsMSAceType(Ace) ( \
+ (((PACE_HEADER)(Ace))->AceType == ACCESS_ALLOWED_ACE_TYPE) || \
+ (((PACE_HEADER)(Ace))->AceType == ACCESS_DENIED_ACE_TYPE) || \
+ (((PACE_HEADER)(Ace))->AceType == SYSTEM_AUDIT_ACE_TYPE) || \
+ (((PACE_HEADER)(Ace))->AceType == SYSTEM_ALARM_ACE_TYPE) || \
+ (((PACE_HEADER)(Ace))->AceType == ACCESS_ALLOWED_COMPOUND_ACE_TYPE) \
+ )
+
+//
+// Update this macro as new ACL revisions are defined.
+//
+
+#define ValidAclRevision(Acl) ((Acl)->AclRevision == ACL_REVISION2 || (Acl)->AclRevision == ACL_REVISION3)
+
+//
+// Macro to determine if an ace is to be inherited by a subdirectory
+//
+
+#define ContainerInherit(Ace) ( \
+ FlagOn((Ace)->AceFlags, CONTAINER_INHERIT_ACE) \
+ )
+
+//
+// Macro to determine if an ace is to be proprogate to a subdirectory.
+// It will if it is inheritable by either a container or non-container
+// and is not explicitly marked for no-propagation.
+//
+
+#define Propagate(Ace) ( \
+ !FlagOn((Ace)->AceFlags, NO_PROPAGATE_INHERIT_ACE) && \
+ (FlagOn(( Ace )->AceFlags, OBJECT_INHERIT_ACE) || \
+ FlagOn(( Ace )->AceFlags, CONTAINER_INHERIT_ACE) ) \
+ )
+
+//
+// Macro to determine if an ACE is to be inherited by a sub-object
+//
+
+#define ObjectInherit(Ace) ( \
+ FlagOn(( Ace )->AceFlags, OBJECT_INHERIT_ACE) \
+ )
+
+
+
+
+#endif // _SEOPAQUE_
diff --git a/private/inc/seposix.h b/private/inc/seposix.h
new file mode 100644
index 000000000..cd6aac85f
--- /dev/null
+++ b/private/inc/seposix.h
@@ -0,0 +1,97 @@
+/*++ BUILD Version: 0001 // Increment this if a change has global effects
+
+Copyright (c) 1992 Microsoft Corporation
+
+Module Name:
+
+ seposix.h
+
+Abstract:
+
+ This file contains security related definitions that are private to
+ subsystems, such as Posix Id to Sid mappings
+
+Author:
+
+ Scott Birrell (ScottBi) April 13, 1993
+
+Environment:
+
+ User Mode - Win32
+
+Revision History:
+
+
+--*/
+
+#ifndef _SEPOSIX_
+#define _SEPOSIX_
+
+//
+// Posix Id definitions
+//
+// IMPORTANT NOTE:
+//
+// The Posix Id's for well known Sids and accounts in the local machine's
+// BUILTIN in and Accounts have values not exceeding 0x3ffff. This is
+// to allow storage of these Posix Ids in cpio archive file format.
+// This format restricts the size of the values to fit within 6 octal
+// digits, making 0x3ffff the highest possible value supportable.
+//
+
+//
+// Posix Id's for universal well known Sids
+//
+
+#define SE_NULL_POSIX_ID ((ULONG) 0x00010000)
+#define SE_WORLD_POSIX_ID ((ULONG) 0x00010100)
+#define SE_LOCAL_POSIX_ID ((ULONG) 0x00010200)
+#define SE_CREATOR_OWNER_POSIX_ID ((ULONG) 0x00010300)
+#define SE_CREATOR_GROUP_POSIX_ID ((ULONG) 0x00010301)
+#define SE_NON_UNIQUE_POSIX_ID ((ULONG) 0x00010400)
+
+//
+// Posix Id's for Nt well known Sids
+//
+
+#define SE_AUTHORITY_POSIX_ID ((ULONG) 0x00010500)
+#define SE_DIALUP_POSIX_ID ((ULONG) 0x00010501)
+#define SE_NETWORK_POSIX_ID ((ULONG) 0x00010502)
+#define SE_BATCH_POSIX_ID ((ULONG) 0x00010503)
+#define SE_INTERACTIVE_POSIX_ID ((ULONG) 0x00010504)
+#define SE_DEFAULT_LOGON_POSIX_ID ((ULONG) 0x00010505)
+#define SE_SERVICE_POSIX_ID ((ULONG) 0x00010506)
+
+//
+// Posix Offsets for Built In Domain, Account Domain and Primary Domain
+//
+// NOTE: The Posix Id of an account in one of these domains is given
+// by the formula:
+//
+// Posix Id = Domain Posix Offset + Relative Id
+//
+// where 'Relative Id' is the lowest sub authority in the account's
+// Sid
+//
+
+#define SE_NULL_POSIX_OFFSET ((ULONG) 0x00000000)
+#define SE_BUILT_IN_DOMAIN_POSIX_OFFSET ((ULONG) 0x00020000)
+#define SE_ACCOUNT_DOMAIN_POSIX_OFFSET ((ULONG) 0x00030000)
+
+//
+// NOTE: The following is valid for workstations that have joined a
+// domain only.
+//
+
+#define SE_PRIMARY_DOMAIN_POSIX_OFFSET ((ULONG) 0x00100000)
+
+//
+// Seed and increment for Trusted Domain Posix Offsets
+//
+
+#define SE_INITIAL_TRUSTED_DOMAIN_POSIX_OFFSET ((ULONG) 0x00200000)
+#define SE_TRUSTED_DOMAIN_POSIX_OFFSET_INCR ((ULONG) 0x00100000)
+#define SE_MAX_TRUSTED_DOMAIN_POSIX_OFFSET ((ULONG) 0xfff00000)
+
+#endif // _SEPOSIX_
+
diff --git a/private/inc/sertlp.h b/private/inc/sertlp.h
new file mode 100644
index 000000000..5df45890f
--- /dev/null
+++ b/private/inc/sertlp.h
@@ -0,0 +1,300 @@
+/*++
+
+Copyright (c) 1989 Microsoft Corporation
+
+Module Name:
+
+ sertlp.h
+
+Abstract:
+
+ Include file for NT runtime routines that are callable by both
+ kernel mode code in the executive and user mode code in various
+ NT subsystems, but which are private interfaces.
+
+ The routines in this file should not be used outside of the security
+ related rtl files.
+
+Author:
+
+ Robert P. Reichel (robertre) 6-12-91
+
+Environment:
+
+ These routines are statically linked in the caller's executable and
+ are callable in either kernel mode or user mode.
+
+Revision History:
+
+--*/
+
+#ifndef _SERTLP_
+#define _SERTLP_
+
+#include "nt.h"
+#include "zwapi.h"
+#include "ntrtl.h"
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// Local Macros //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef LongAlign
+#define LongAlign(Ptr) ( \
+ (PVOID)((((ULONG)(Ptr)) + 3) & 0xfffffffc) \
+ )
+#endif
+
+
+
+
+//
+// Macros for calculating the address of the components of a security
+// descriptor. This will calculate the address of the field regardless
+// of whether the security descriptor is absolute or self-relative form.
+// A null value indicates the specified field is not present in the
+// security descriptor.
+//
+
+//
+// NOTE: Similar copies of these macros appear in sep.h.
+// Be sure to propagate bug fixes and changes.
+//
+
+#define RtlpOwnerAddrSecurityDescriptor( SD ) \
+ ( ((SD)->Owner == NULL) ? (PSID)NULL : \
+ ( ((SD)->Control & SE_SELF_RELATIVE) ? \
+ (PSID)RtlOffsetToPointer((SD), (SD)->Owner) : \
+ (PSID)((SD)->Owner) \
+ ) \
+ )
+
+#define RtlpGroupAddrSecurityDescriptor( SD ) \
+ ( ((SD)->Group == NULL) ? (PSID)NULL : \
+ ( ((SD)->Control & SE_SELF_RELATIVE) ? \
+ (PSID)RtlOffsetToPointer((SD), (SD)->Group) : \
+ (PSID)((SD)->Group) \
+ ) \
+ )
+
+#define RtlpSaclAddrSecurityDescriptor( SD ) \
+ ( (!((SD)->Control & SE_SACL_PRESENT) || ((SD)->Sacl == NULL) ) ? \
+ (PACL)NULL : \
+ ( ((SD)->Control & SE_SELF_RELATIVE) ? \
+ (PACL)RtlOffsetToPointer((SD), (SD)->Sacl) : \
+ (PACL)((SD)->Sacl) \
+ ) \
+ )
+
+#define RtlpDaclAddrSecurityDescriptor( SD ) \
+ ( (!((SD)->Control & SE_DACL_PRESENT) || ((SD)->Dacl == NULL) ) ? \
+ (PACL)NULL : \
+ ( ((SD)->Control & SE_SELF_RELATIVE) ? \
+ (PACL)RtlOffsetToPointer((SD), (SD)->Dacl) : \
+ (PACL)((SD)->Dacl) \
+ ) \
+ )
+
+
+
+
+//
+// Macro to determine if the given ID has the owner attribute set,
+// which means that it may be assignable as an owner
+//
+
+#define RtlpIdAssignableAsOwner( G ) \
+ ( ((G).Attributes & SE_GROUP_OWNER) != 0 )
+
+//
+// Macro to copy the state of the passed bits from the old security
+// descriptor (OldSD) into the Control field of the new one (NewSD)
+//
+
+#define RtlpPropagateControlBits( NewSD, OldSD, Bits ) \
+ ( NewSD )->Control |= \
+ ( \
+ ( OldSD )->Control & ( Bits ) \
+ )
+
+
+//
+// Macro to query whether or not the passed set of bits are ALL on
+// or not (ie, returns FALSE if some are on and not others)
+//
+
+#define RtlpAreControlBitsSet( SD, Bits ) \
+ (BOOLEAN) \
+ ( \
+ (( SD )->Control & ( Bits )) == ( Bits ) \
+ )
+
+//
+// Macro to set the passed control bits in the given Security Descriptor
+//
+
+#define RtlpSetControlBits( SD, Bits ) \
+ ( \
+ ( SD )->Control |= ( Bits ) \
+ )
+
+//
+// Macro to clear the passed control bits in the given Security Descriptor
+//
+
+#define RtlpClearControlBits( SD, Bits ) \
+ ( \
+ ( SD )->Control &= ~( Bits ) \
+ )
+
+
+
+
+////////////////////////////////////////////////////////////////////////////////
+// //
+// Prototypes for local procedures //
+// //
+////////////////////////////////////////////////////////////////////////////////
+
+
+BOOLEAN
+RtlpContainsCreatorOwnerSid(
+ PKNOWN_ACE Ace
+ );
+
+BOOLEAN
+RtlpContainsCreatorGroupSid(
+ PKNOWN_ACE Ace
+ );
+
+
+VOID
+RtlpApplyAclToObject (
+ IN PACL Acl,
+ IN PGENERIC_MAPPING GenericMapping
+ );
+
+NTSTATUS
+RtlpInheritAcl (
+ IN PACL Acl,
+ IN BOOLEAN IsDirectoryObject,
+ IN PSID OwnerSid,
+ IN PSID GroupSid,
+ IN PSID ServerOwnerSid OPTIONAL,
+ IN PSID ServerGroupSid OPTIONAL,
+ IN PGENERIC_MAPPING GenericMapping,
+ OUT PACL *NewAcl
+ );
+
+NTSTATUS
+RtlpLengthInheritAcl(
+ IN PACL Acl,
+ IN BOOLEAN IsDirectoryObject,
+ IN PSID OwnerSid,
+ IN PSID GroupSid,
+ IN PSID ServerSid OPTIONAL,
+ IN PSID ClientSid OPTIONAL,
+ IN PGENERIC_MAPPING GenericMapping,
+ OUT PULONG NewAclLength
+ );
+
+NTSTATUS
+RtlpGenerateInheritAcl(
+ IN PACL Acl,
+ IN BOOLEAN IsDirectoryObject,
+ IN PSID OwnerSid,
+ IN PSID GroupSid,
+ IN PSID ServerSid OPTIONAL,
+ IN PSID ClientSid OPTIONAL,
+ IN PGENERIC_MAPPING GenericMapping,
+ OUT PACL NewAcl
+ );
+
+NTSTATUS
+RtlpLengthInheritedAce (
+ IN PACE_HEADER Ace,
+ IN BOOLEAN IsDirectoryObject,
+ IN PSID OwnerSid,
+ IN PSID GroupSid,
+ IN PSID ServerSid,
+ IN PSID ClientSid,
+ IN PGENERIC_MAPPING GenericMapping,
+ IN PULONG NewAceLength
+ );
+
+NTSTATUS
+RtlpGenerateInheritedAce (
+ IN PACE_HEADER OldAce,
+ IN BOOLEAN IsDirectoryObject,
+ IN PSID OwnerSid,
+ IN PSID GroupSid,
+ IN PSID ServerSid OPTIONAL,
+ IN PSID ClientSid OPTIONAL,
+ IN PGENERIC_MAPPING GenericMapping,
+ OUT PACL NewAcl
+ );
+
+
+NTSTATUS
+RtlpInitializeAllowedAce(
+ IN PACCESS_ALLOWED_ACE AllowedAce,
+ IN USHORT AceSize,
+ IN UCHAR InheritFlags,
+ IN UCHAR AceFlags,
+ IN ACCESS_MASK Mask,
+ IN PSID AllowedSid
+ );
+
+NTSTATUS
+RtlpInitializeDeniedAce(
+ IN PACCESS_DENIED_ACE DeniedAce,
+ IN USHORT AceSize,
+ IN UCHAR InheritFlags,
+ IN UCHAR AceFlags,
+ IN ACCESS_MASK Mask,
+ IN PSID DeniedSid
+ );
+
+NTSTATUS
+RtlpInitializeAuditAce(
+ IN PACCESS_ALLOWED_ACE AuditAce,
+ IN USHORT AceSize,
+ IN UCHAR InheritFlags,
+ IN UCHAR AceFlags,
+ IN ACCESS_MASK Mask,
+ IN PSID AuditSid
+ );
+
+BOOLEAN
+RtlpValidOwnerSubjectContext(
+ IN HANDLE Token,
+ IN PSID Owner,
+ IN BOOLEAN ServerObject,
+ OUT PNTSTATUS ReturnStatus
+ );
+
+VOID
+RtlpQuerySecurityDescriptor(
+ IN PISECURITY_DESCRIPTOR SecurityDescriptor,
+ OUT PSID *Owner,
+ OUT PULONG OwnerSize,
+ OUT PSID *PrimaryGroup,
+ OUT PULONG PrimaryGroupSize,
+ OUT PACL *Dacl,
+ OUT PULONG DaclSize,
+ OUT PACL *Sacl,
+ OUT PULONG SaclSize
+ );
+
+
+NTSTATUS
+RtlpFreeVM(
+ IN PVOID *Base
+ );
+
+
+#endif // _SERTLP_
diff --git a/private/inc/smb.h b/private/inc/smb.h
new file mode 100644
index 000000000..b909dcb38
--- /dev/null
+++ b/private/inc/smb.h
@@ -0,0 +1,3711 @@
+/*++
+
+Copyright (c) 1989-1993 Microsoft Corporation
+
+Module Name:
+
+ smb.h
+
+Abstract:
+
+ This file contains request and response structure definitions
+ for the specific parameters of each SMB command, as well as codes
+ for SMB commands and errors.
+
+Author:
+
+ David R. Treadwell (davidtr) 27-Sept-1989 (from LanMan 1.2 code)
+
+Revision History:
+
+--*/
+
+#ifndef _SMB_
+#define _SMB_
+
+//#include <nt.h>
+
+//#include <smbtypes.h>
+
+
+/*
+
+Inclusion of SMB request/response structures in this file is
+conditionalized in the following way:
+
+ If INCLUDE_SMB_ALL is defined, all of the structures are defined.
+
+ Otherwise, the following names, if defined, cause inclusion of the
+ corresponding SMB categories:
+
+ INCLUDE_SMB_ADMIN Administrative requests:
+ PROCESS_EXIT
+ NEGOTIATE
+ SESSION_SETUP_ANDX
+ LOGOFF_ANDX
+
+ INCLUDE_SMB_TREE Tree connect requests:
+ TREE_CONNECT
+ TREE_DISCONNECT
+ TREE_CONNECT_ANDX
+
+ INCLUDE_SMB_DIRECTORY Directory-related requests:
+ CREATE_DIRECTORY
+ DELETE_DIRECTORY
+ CHECK_DIRECTORY
+
+ INCLUDE_SMB_OPEN_CLOSE File open and close requests:
+ OPEN
+ CREATE
+ CLOSE
+ CREATE_TEMPORARY
+ CREATE_NEW
+ OPEN_ANDX
+ CLOSE_AND_TREE_DISC
+
+ INCLUDE_SMB_READ_WRITE Read and write requests:
+ READ
+ WRITE
+ SEEK
+ LOCK_AND_READ
+ WRITE_AND_UNLOCK
+ WRITE_AND_CLOSE
+ READ_ANDX
+ WRITE_ANDX
+
+
+ INCLUDE_SMB_FILE_CONTROL File control requests:
+ FLUSH
+ DELETE
+ RENAME
+ COPY
+ MOVE
+
+ INCLUDE_SMB_QUERY_SET File query/set requests:
+ QUERY_INFORMATION
+ SET_INFORMATION
+ QUERY_INFORMATION2
+ SET_INFORMATION2
+ QUERY_PATH_INFORMATION
+ SET_PATH_INFORMATION
+ QUERY_FILE_INFORMATION
+ SET_FILE_INFORMATION
+
+ INCLUDE_SMB_LOCK Lock requests (not LOCK_AND_READ)
+ LOCK_BYTE_RANGE
+ UNLOCK_BYTE_RANGE
+ LOCKING_ANDX
+
+ INCLUDE_SMB_RAW Raw read/write requests:
+ READ_RAW
+ WRITE_RAW
+
+ INCLUDE_SMB_MPX Multiplexed requests:
+ READ_MPX
+ WRITE_MPX
+
+ INCLUDE_SMB_SEARCH Search requests:
+ FIND_CLOSE2
+ FIND_NOTIFY_CLOSE
+ SEARCH
+ FIND
+ FIND_UNIQUE
+ FIND_CLOSE
+
+ INCLUDE_SMB_TRANSACTION Transaction and IOCTL requests:
+ TRANSACTION
+ IOCTL
+ TRANSACTION2
+ NTTRANSACTION
+
+ INCLUDE_SMB_PRINT Printer requests:
+ OPEN_PRINT_FILE
+ WRITE_PRINT_FILE
+ CLOSE_PRINT_FILE
+ GET_PRINT_QUEUE
+
+ INCLUDE_SMB_MESSAGE Message requests:
+ SEND_MESSAGE
+ SEND_BROADCAST_MESSAGE
+ FORWARD_USER_NAME
+ CANCEL_FORWARD
+ GET_MACHINE_NAME
+ SEND_START_MB_MESSAGE
+ SEND_END_MB_MESSAGE
+ SEND_TEXT_MB_MESSAGE
+
+ INCLUDE_SMB_MISC Miscellaneous requests:
+ QUERY_INFORMATION_SRV
+ ECHO
+ QUERY_INFORMATION_DISK
+
+ INCLUDE_SMB_BULK
+ READ_BULK
+ WRITE_BULK
+
+*/
+
+#ifdef INCLUDE_SMB_ALL
+
+#define INCLUDE_SMB_ADMIN
+#define INCLUDE_SMB_TREE
+#define INCLUDE_SMB_DIRECTORY
+#define INCLUDE_SMB_OPEN_CLOSE
+#define INCLUDE_SMB_FILE_CONTROL
+#define INCLUDE_SMB_READ_WRITE
+#define INCLUDE_SMB_LOCK
+#define INCLUDE_SMB_RAW
+#define INCLUDE_SMB_MPX
+#define INCLUDE_SMB_QUERY_SET
+#define INCLUDE_SMB_SEARCH
+#define INCLUDE_SMB_TRANSACTION
+#define INCLUDE_SMB_PRINT
+#define INCLUDE_SMB_MESSAGE
+#define INCLUDE_SMB_MISC
+#define INCLUDE_SMB_BULK
+
+#endif // def INCLUDE_SMB_ALL
+
+
+//
+// Force misalignment of the following structures
+//
+
+#ifndef NO_PACKING
+#include <packon.h>
+#endif // ndef NO_PACKING
+
+//
+// SMB servers listen on two NETBIOS addresses to facilitate connections. The
+// first one is a name formulated from the computer name by padding it with
+// a number of blanks ( upto NETBIOS_NAME_LEN ). This name is registered and
+// resolved using the NETBIOS name registration/resolution mechanism. They also
+// register under a second name *SMBSERVER which is not a valuid netbios name
+// but provides a name which can be used in NETBT session setup. This eliminates
+// the need for querying the remote adapter status to obtain the name.
+//
+
+#define SMBSERVER_LOCAL_ENDPOINT_NAME "*SMBSERVER "
+
+//
+// SMB Command code definitions:
+//
+
+// *** Start of SMB commands
+#define SMB_COM_CREATE_DIRECTORY (UCHAR)0x00
+#define SMB_COM_DELETE_DIRECTORY (UCHAR)0x01
+#define SMB_COM_OPEN (UCHAR)0x02
+#define SMB_COM_CREATE (UCHAR)0x03
+#define SMB_COM_CLOSE (UCHAR)0x04
+#define SMB_COM_FLUSH (UCHAR)0x05
+#define SMB_COM_DELETE (UCHAR)0x06
+#define SMB_COM_RENAME (UCHAR)0x07
+#define SMB_COM_QUERY_INFORMATION (UCHAR)0x08
+#define SMB_COM_SET_INFORMATION (UCHAR)0x09
+#define SMB_COM_READ (UCHAR)0x0A
+#define SMB_COM_WRITE (UCHAR)0x0B
+#define SMB_COM_LOCK_BYTE_RANGE (UCHAR)0x0C
+#define SMB_COM_UNLOCK_BYTE_RANGE (UCHAR)0x0D
+#define SMB_COM_CREATE_TEMPORARY (UCHAR)0x0E
+#define SMB_COM_CREATE_NEW (UCHAR)0x0F
+#define SMB_COM_CHECK_DIRECTORY (UCHAR)0x10
+#define SMB_COM_PROCESS_EXIT (UCHAR)0x11
+#define SMB_COM_SEEK (UCHAR)0x12
+#define SMB_COM_LOCK_AND_READ (UCHAR)0x13
+#define SMB_COM_WRITE_AND_UNLOCK (UCHAR)0x14
+#define SMB_COM_READ_RAW (UCHAR)0x1A
+#define SMB_COM_READ_MPX (UCHAR)0x1B
+#define SMB_COM_READ_MPX_SECONDARY (UCHAR)0x1C // server to redir only
+#define SMB_COM_WRITE_RAW (UCHAR)0x1D
+#define SMB_COM_WRITE_MPX (UCHAR)0x1E
+#define SMB_COM_WRITE_MPX_SECONDARY (UCHAR)0x1F
+#define SMB_COM_WRITE_COMPLETE (UCHAR)0x20 // server to redir only
+#define SMB_COM_QUERY_INFORMATION_SRV (UCHAR)0x21
+#define SMB_COM_SET_INFORMATION2 (UCHAR)0x22
+#define SMB_COM_QUERY_INFORMATION2 (UCHAR)0x23
+#define SMB_COM_LOCKING_ANDX (UCHAR)0x24
+#define SMB_COM_TRANSACTION (UCHAR)0x25
+#define SMB_COM_TRANSACTION_SECONDARY (UCHAR)0x26
+#define SMB_COM_IOCTL (UCHAR)0x27
+#define SMB_COM_IOCTL_SECONDARY (UCHAR)0x28
+#define SMB_COM_COPY (UCHAR)0x29
+#define SMB_COM_MOVE (UCHAR)0x2A
+#define SMB_COM_ECHO (UCHAR)0x2B
+#define SMB_COM_WRITE_AND_CLOSE (UCHAR)0x2C
+#define SMB_COM_OPEN_ANDX (UCHAR)0x2D
+#define SMB_COM_READ_ANDX (UCHAR)0x2E
+#define SMB_COM_WRITE_ANDX (UCHAR)0x2F
+#define SMB_COM_CLOSE_AND_TREE_DISC (UCHAR)0x31
+#define SMB_COM_TRANSACTION2 (UCHAR)0x32
+#define SMB_COM_TRANSACTION2_SECONDARY (UCHAR)0x33
+#define SMB_COM_FIND_CLOSE2 (UCHAR)0x34
+#define SMB_COM_FIND_NOTIFY_CLOSE (UCHAR)0x35
+#define SMB_COM_TREE_CONNECT (UCHAR)0x70
+#define SMB_COM_TREE_DISCONNECT (UCHAR)0x71
+#define SMB_COM_NEGOTIATE (UCHAR)0x72
+#define SMB_COM_SESSION_SETUP_ANDX (UCHAR)0x73
+#define SMB_COM_LOGOFF_ANDX (UCHAR)0x74
+#define SMB_COM_TREE_CONNECT_ANDX (UCHAR)0x75
+#define SMB_COM_QUERY_INFORMATION_DISK (UCHAR)0x80
+#define SMB_COM_SEARCH (UCHAR)0x81
+#define SMB_COM_FIND (UCHAR)0x82
+#define SMB_COM_FIND_UNIQUE (UCHAR)0x83
+#define SMB_COM_FIND_CLOSE (UCHAR)0x84
+#define SMB_COM_NT_TRANSACT (UCHAR)0xA0
+#define SMB_COM_NT_TRANSACT_SECONDARY (UCHAR)0xA1
+#define SMB_COM_NT_CREATE_ANDX (UCHAR)0xA2
+#define SMB_COM_NT_CANCEL (UCHAR)0xA4
+#define SMB_COM_NT_RENAME (UCHAR)0xA5
+#define SMB_COM_OPEN_PRINT_FILE (UCHAR)0xC0
+#define SMB_COM_WRITE_PRINT_FILE (UCHAR)0xC1
+#define SMB_COM_CLOSE_PRINT_FILE (UCHAR)0xC2
+#define SMB_COM_GET_PRINT_QUEUE (UCHAR)0xC3
+#define SMB_COM_SEND_MESSAGE (UCHAR)0xD0
+#define SMB_COM_SEND_BROADCAST_MESSAGE (UCHAR)0xD1
+#define SMB_COM_FORWARD_USER_NAME (UCHAR)0xD2
+#define SMB_COM_CANCEL_FORWARD (UCHAR)0xD3
+#define SMB_COM_GET_MACHINE_NAME (UCHAR)0xD4
+#define SMB_COM_SEND_START_MB_MESSAGE (UCHAR)0xD5
+#define SMB_COM_SEND_END_MB_MESSAGE (UCHAR)0xD6
+#define SMB_COM_SEND_TEXT_MB_MESSAGE (UCHAR)0xD7
+#define SMB_COM_READ_BULK (UCHAR)0xD8
+#define SMB_COM_WRITE_BULK (UCHAR)0xD9
+#define SMB_COM_WRITE_BULK_DATA (UCHAR)0xDA
+// *** End of SMB commands
+
+#define SMB_COM_NO_ANDX_COMMAND (UCHAR)0xFF
+
+
+//
+// Header for SMBs, see #4 page 10
+//
+// *** Note that we do NOT define PSMB_HEADER as SMB_UNALIGNED! This is
+// done on the assumption that the SMB header, at least, will always
+// be properly aligned. If you need to access an unaligned header,
+// declare the pointer as SMB_UNALIGNED *SMB_HEADER.
+//
+
+typedef struct _SMB_HEADER {
+ UCHAR Protocol[4]; // Contains 0xFF,'SMB'
+ UCHAR Command; // Command code
+ UCHAR ErrorClass; // Error class
+ UCHAR Reserved; // Reserved for future use
+ _USHORT( Error ); // Error code
+ UCHAR Flags; // Flags
+ _USHORT( Flags2 ); // More flags
+ union {
+ _USHORT( Reserved2 )[6]; // Reserved for future use
+ struct {
+ _USHORT( PidHigh ); // High part of PID (NT Create And X)
+ _ULONG( Key ); // Encryption key (IPX)
+ _USHORT( Sid ); // Session ID (IPX)
+ _USHORT( SequenceNumber ); // Sequence number (IPX)
+ _USHORT( Gid ); // Group ID (unused?)
+ } ;
+ } ;
+ _USHORT( Tid ); // Authenticated user/group
+ _USHORT( Pid ); // Caller's process id
+ _USHORT( Uid ); // Unauthenticated user id
+ _USHORT( Mid ); // multiplex id
+#ifdef NO_PACKING // ***
+ _USHORT( Kludge ); // *** make sure parameter structs
+#endif // *** are longword aligned
+} SMB_HEADER;
+typedef SMB_HEADER *PSMB_HEADER;
+
+typedef struct _NT_SMB_HEADER {
+ UCHAR Protocol[4]; // Contains 0xFF,'SMB'
+ UCHAR Command; // Command code
+ union {
+ struct {
+ UCHAR ErrorClass; // Error class
+ UCHAR Reserved; // Reserved for future use
+ _USHORT( Error ); // Error code
+ } DosError;
+ ULONG NtStatus; // NT-style 32-bit error code
+ } Status;
+ UCHAR Flags; // Flags
+ _USHORT( Flags2 ); // More flags
+ union {
+ _USHORT( Reserved2 )[6]; // Reserved for future use
+ struct {
+ _USHORT( PidHigh ); // High part of PID (NT Create And X)
+ _ULONG( Key ); // Encryption key (IPX)
+ _USHORT( Sid ); // Session ID (IPX)
+ _USHORT( SequenceNumber ); // Sequence number (IPX)
+ _USHORT( Gid ); // Group ID (unused?)
+ } ;
+ } ;
+ _USHORT( Tid ); // Authenticated user/group
+ _USHORT( Pid ); // Caller's process id
+ _USHORT( Uid ); // Unauthenticated user id
+ _USHORT( Mid ); // multiplex id
+#ifdef NO_PACKING // ***
+ _USHORT( Kludge ); // *** make sure parameter structs
+#endif // *** are longword aligned
+} NT_SMB_HEADER;
+typedef NT_SMB_HEADER *PNT_SMB_HEADER;
+
+//
+// The SMB header, protocol field, as a long.
+//
+
+#define SMB_HEADER_PROTOCOL (0xFF + ('S' << 8) + ('M' << 16) + ('B' << 24))
+
+//
+// Minimum parameter structure that can be returned. Used in returning
+// error SMBs.
+//
+// *** Note that this structure does NOT have a Buffer field!
+//
+
+typedef struct _SMB_PARAMS {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of bytes that follow; min = 0
+} SMB_PARAMS;
+typedef SMB_PARAMS SMB_UNALIGNED *PSMB_PARAMS;
+
+//
+// Generic header for AndX commands.
+//
+
+typedef struct _GENERIC_ANDX {
+ UCHAR WordCount; // Count of parameter words
+ UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
+ UCHAR AndXReserved; // Reserved
+ _USHORT( AndXOffset ); // Offset (from SMB header start)
+} GENERIC_ANDX;
+typedef GENERIC_ANDX SMB_UNALIGNED *PGENERIC_ANDX;
+
+//
+// Structure used for bulk data messages.
+//
+
+typedef struct _BULK_DATA_MESSAGE {
+ _ULONG( Bid );
+ _ULONG( Data1Length );
+ _ULONG( Data1MessageOffset );
+ _ULONG( Data1BlockOffset );
+ _ULONG( Data2Length );
+ _ULONG( Data2MessageOffset );
+ _ULONG( Data2BlockOffset );
+} BULK_DATA_MESSAGE;
+typedef BULK_DATA_MESSAGE *PBULK_DATA_MESSAGE;
+
+
+#ifdef INCLUDE_SMB_MESSAGE
+
+//
+// Cancel Forward SMB, see #1 page 35
+// Function is SrvSmbCancelForward()
+// SMB_COM_CANCEL_FORWARD 0xD3
+//
+
+typedef struct _REQ_CANCEL_FORWARD {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes; min = 2
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR BufferFormat; // 0x04 -- ASCII
+ //UCHAR ForwardedName[]; // Forwarded name
+} REQ_CANCEL_FORWARD;
+typedef REQ_CANCEL_FORWARD SMB_UNALIGNED *PREQ_CANCEL_FORWARD;
+
+typedef struct _RESP_CANCEL_FORWARD {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_CANCEL_FORWARD;
+typedef RESP_CANCEL_FORWARD SMB_UNALIGNED *PRESP_CANCEL_FORWARD;
+
+#endif // def INCLUDE_SMB_MESSAGE
+
+#ifdef INCLUDE_SMB_DIRECTORY
+
+//
+// Check Directory SMB, see #1 page 23
+// Function is SrvSmbCheckDirectory()
+// SMB_COM_CHECK_DIRECTORY 0x10
+//
+
+typedef struct _REQ_CHECK_DIRECTORY {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes; min = 2
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR BufferFormat; // 0x04 -- ASCII
+ //UCHAR DirectoryPath[]; // Directory path
+} REQ_CHECK_DIRECTORY;
+typedef REQ_CHECK_DIRECTORY SMB_UNALIGNED *PREQ_CHECK_DIRECTORY;
+
+typedef struct _RESP_CHECK_DIRECTORY {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_CHECK_DIRECTORY;
+typedef RESP_CHECK_DIRECTORY SMB_UNALIGNED *PRESP_CHECK_DIRECTORY;
+
+#endif // def INCLUDE_SMB_DIRECTORY
+
+#ifdef INCLUDE_SMB_OPEN_CLOSE
+
+//
+// Close SMB, see #1 page 10
+// Function is SrvSmbClose()
+// SMB_COM_CLOSE 0x04
+//
+
+typedef struct _REQ_CLOSE {
+ UCHAR WordCount; // Count of parameter words = 3
+ _USHORT( Fid ); // File handle
+ _ULONG( LastWriteTimeInSeconds ); // Time of last write, low and high
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} REQ_CLOSE;
+typedef REQ_CLOSE SMB_UNALIGNED *PREQ_CLOSE;
+
+typedef struct _RESP_CLOSE {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_CLOSE;
+typedef RESP_CLOSE SMB_UNALIGNED *PRESP_CLOSE;
+
+#endif // def INCLUDE_SMB_OPEN_CLOSE
+
+#ifdef INCLUDE_SMB_OPEN_CLOSE
+
+//
+// Close and Tree Disconnect SMB, see #? page ??
+// Function is SrvSmbCloseAndTreeDisc
+// SMB_COM_CLOSE_AND_TREE_DISC 0x31
+//
+
+typedef struct _REQ_CLOSE_AND_TREE_DISC {
+ UCHAR WordCount; // Count of parameter words
+ _USHORT( Fid ); // File handle
+ _ULONG( LastWriteTimeInSeconds );
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} REQ_CLOSE_AND_TREE_DISC;
+typedef REQ_CLOSE_AND_TREE_DISC SMB_UNALIGNED *PREQ_CLOSE_AND_TREE_DISC;
+
+typedef struct _RESP_CLOSE_AND_TREE_DISC {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_CLOSE_AND_TREE_DISC;
+typedef RESP_CLOSE_AND_TREE_DISC SMB_UNALIGNED *PRESP_CLOSE_AND_TREE_DISC;
+
+#endif // def INCLUDE_SMB_OPEN_CLOSE
+
+#ifdef INCLUDE_SMB_PRINT
+
+//
+// Close Print Spool File SMB, see #1 page 29
+// Function is SrvSmbClosePrintSpoolFile()
+// SMB_COM_CLOSE_PRINT_FILE 0xC2
+//
+
+typedef struct _REQ_CLOSE_PRINT_FILE {
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( Fid ); // File handle
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} REQ_CLOSE_PRINT_FILE;
+typedef REQ_CLOSE_PRINT_FILE SMB_UNALIGNED *PREQ_CLOSE_PRINT_FILE;
+
+typedef struct _RESP_CLOSE_PRINT_FILE {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_CLOSE_PRINT_FILE;
+typedef RESP_CLOSE_PRINT_FILE SMB_UNALIGNED *PRESP_CLOSE_PRINT_FILE;
+
+#endif // def INCLUDE_SMB_PRINT
+
+#ifdef INCLUDE_SMB_FILE_CONTROL
+
+//
+// Copy SMB, see #2 page 23
+// Function is SrvSmbCopy()
+// SMB_COM_COPY 0x29
+//
+
+typedef struct _REQ_COPY {
+ UCHAR WordCount; // Count of parameter words = 3
+ _USHORT( Tid2 ); // Second (target) path TID
+ _USHORT( OpenFunction ); // What to do if target file exists
+ _USHORT( Flags ); // Flags to control copy operation:
+ // bit 0 - target must be a file
+ // bit 1 - target must ba a dir.
+ // bit 2 - copy target mode:
+ // 0 = binary, 1 = ASCII
+ // bit 3 - copy source mode:
+ // 0 = binary, 1 = ASCII
+ // bit 4 - verify all writes
+ // bit 5 - tree copy
+ _USHORT( ByteCount ); // Count of data bytes; min = 2
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR SourceFileName[]; // pathname of source file
+ //UCHAR TargetFileName[]; // pathname of target file
+} REQ_COPY;
+typedef REQ_COPY SMB_UNALIGNED *PREQ_COPY;
+
+typedef struct _RESP_COPY {
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( Count ); // Number of files copied
+ _USHORT( ByteCount ); // Count of data bytes; min = 0
+ UCHAR Buffer[1]; // ASCIIZ pathname of file with error
+} RESP_COPY;
+typedef RESP_COPY SMB_UNALIGNED *PRESP_COPY;
+
+#endif // def INCLUDE_SMB_FILE_CONTROL
+
+#ifdef INCLUDE_SMB_OPEN_CLOSE
+
+//
+// Create SMB, see #1 page 9
+// Create New SMB, see #1 page 23
+// Function is SrvSmbCreate()
+// SMB_COM_CREATE 0x03
+// SMB_COM_CREATE_NEW 0x0F
+//
+
+typedef struct _REQ_CREATE {
+ UCHAR WordCount; // Count of parameter words = 3
+ _USHORT( FileAttributes ); // New file attributes
+ _ULONG( CreationTimeInSeconds ); // Creation time
+ _USHORT( ByteCount ); // Count of data bytes; min = 2
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR BufferFormat; // 0x04 -- ASCII
+ //UCHAR FileName[]; // File name
+} REQ_CREATE;
+typedef REQ_CREATE SMB_UNALIGNED *PREQ_CREATE;
+
+typedef struct _RESP_CREATE {
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( Fid ); // File handle
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_CREATE;
+typedef RESP_CREATE SMB_UNALIGNED *PRESP_CREATE;
+
+#endif // def INCLUDE_SMB_OPEN_CLOSE
+
+#ifdef INCLUDE_SMB_DIRECTORY
+
+//
+// Create Directory SMB, see #1 page 14
+// Function is SrvSmbCreateDirectory
+// SMB_COM_CREATE_DIRECTORY 0x00
+//
+
+typedef struct _REQ_CREATE_DIRECTORY {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes; min = 2
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR BufferFormat; // 0x04 -- ASCII
+ //UCHAR DirectoryName[]; // Directory name
+} REQ_CREATE_DIRECTORY;
+typedef REQ_CREATE_DIRECTORY SMB_UNALIGNED *PREQ_CREATE_DIRECTORY;
+
+typedef struct _RESP_CREATE_DIRECTORY {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_CREATE_DIRECTORY;
+typedef RESP_CREATE_DIRECTORY SMB_UNALIGNED *PRESP_CREATE_DIRECTORY;
+
+#endif // def INCLUDE_SMB_DIRECTORY
+
+#ifdef INCLUDE_SMB_OPEN_CLOSE
+
+//
+// Create Temporary SMB, see #1 page 21
+// Function is SrvSmbCreateTemporary()
+// SMB_COM_CREATE_TEMPORARY 0x0E
+//
+
+typedef struct _REQ_CREATE_TEMPORARY {
+ UCHAR WordCount; // Count of parameter words = 3
+ _USHORT( FileAttributes );
+ _ULONG( CreationTimeInSeconds );
+ _USHORT( ByteCount ); // Count of data bytes; min = 2
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR BufferFormat; // 0x04 -- ASCII
+ //UCHAR DirectoryName[]; // Directory name
+} REQ_CREATE_TEMPORARY;
+typedef REQ_CREATE_TEMPORARY SMB_UNALIGNED *PREQ_CREATE_TEMPORARY;
+
+typedef struct _RESP_CREATE_TEMPORARY {
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( Fid ); // File handle
+ _USHORT( ByteCount ); // Count of data bytes; min = 2
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR BufferFormat; // 0x04 -- ASCII
+ //UCHAR FileName[]; // File name
+} RESP_CREATE_TEMPORARY;
+typedef RESP_CREATE_TEMPORARY SMB_UNALIGNED *PRESP_CREATE_TEMPORARY;
+
+#endif // def INCLUDE_SMB_OPEN_CLOSE
+
+#ifdef INCLUDE_SMB_FILE_CONTROL
+
+//
+// Delete SMB, see #1 page 16
+// Function is SrvSmbDelete()
+// SMB_COM_DELETE 0x06
+//
+
+typedef struct _REQ_DELETE {
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( SearchAttributes );
+ _USHORT( ByteCount ); // Count of data bytes; min = 2
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR BufferFormat; // 0x04 -- ASCII
+ //UCHAR FileName[]; // File name
+} REQ_DELETE;
+typedef REQ_DELETE SMB_UNALIGNED *PREQ_DELETE;
+
+typedef struct _RESP_DELETE {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_DELETE;
+typedef RESP_DELETE SMB_UNALIGNED *PRESP_DELETE;
+
+#endif // def INCLUDE_SMB_FILE_CONTROL
+
+#ifdef INCLUDE_SMB_DIRECTORY
+
+//
+// Delete Directory SMB, see #1 page 15
+// Function is SrvSmbDeleteDirectory()
+// SMB_COM_DELETE_DIRECTORY 0x01
+//
+
+typedef struct _REQ_DELETE_DIRECTORY {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes; min = 2
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR BufferFormat; // 0x04 -- ASCII
+ //UCHAR DirectoryName[]; // Directory name
+} REQ_DELETE_DIRECTORY;
+typedef REQ_DELETE_DIRECTORY SMB_UNALIGNED *PREQ_DELETE_DIRECTORY;
+
+typedef struct _RESP_DELETE_DIRECTORY {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_DELETE_DIRECTORY;
+typedef RESP_DELETE_DIRECTORY SMB_UNALIGNED *PRESP_DELETE_DIRECTORY;
+
+#endif // def INCLUDE_SMB_DIRECTORY
+
+#ifdef INCLUDE_SMB_MISC
+
+//
+// Echo SMB, see #2 page 25
+// Function is SrvSmbEcho()
+// SMB_COM_ECHO 0x2B
+//
+
+typedef struct _REQ_ECHO {
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( EchoCount ); // Number of times to echo data back
+ _USHORT( ByteCount ); // Count of data bytes; min = 4
+ UCHAR Buffer[1]; // Data to echo
+} REQ_ECHO;
+typedef REQ_ECHO SMB_UNALIGNED *PREQ_ECHO;
+
+typedef struct _RESP_ECHO {
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( SequenceNumber ); // Sequence number of this echo
+ _USHORT( ByteCount ); // Count of data bytes; min = 4
+ UCHAR Buffer[1]; // Echoed data
+} RESP_ECHO;
+typedef RESP_ECHO SMB_UNALIGNED *PRESP_ECHO;
+
+#endif // def INCLUDE_SMB_MISC
+
+#ifdef INCLUDE_SMB_SEARCH
+
+//
+// Find Close2 SMB, see #3 page 54
+// Function is SrvFindClose2()
+// SMB_COM_FIND_CLOSE2 0x34
+//
+
+typedef struct _REQ_FIND_CLOSE2 {
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( Sid ); // Find handle
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} REQ_FIND_CLOSE2;
+typedef REQ_FIND_CLOSE2 SMB_UNALIGNED *PREQ_FIND_CLOSE2;
+
+typedef struct _RESP_FIND_CLOSE2 {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_FIND_CLOSE2;
+typedef RESP_FIND_CLOSE2 SMB_UNALIGNED *PRESP_FIND_CLOSE2;
+
+#endif // def INCLUDE_SMB_SEARCH
+
+#ifdef INCLUDE_SMB_SEARCH
+
+//
+// Find Notify Close SMB, see #3 page 53
+// Function is SrvSmbFindNotifyClose()
+// SMB_COM_FIND_NOTIFY_CLOSE 0x35
+//
+
+typedef struct _REQ_FIND_NOTIFY_CLOSE {
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( Handle ); // Find notify handle
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} REQ_FIND_NOTIFY_CLOSE;
+typedef REQ_FIND_NOTIFY_CLOSE SMB_UNALIGNED *PREQ_FIND_NOTIFY_CLOSE;
+
+typedef struct _RESP_FIND_NOTIFY_CLOSE {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_FIND_NOTIFY_CLOSE;
+typedef RESP_FIND_NOTIFY_CLOSE SMB_UNALIGNED *PRESP_FIND_NOTIFY_CLOSE;
+
+#endif // def INCLUDE_SMB_SEARCH
+
+#ifdef INCLUDE_SMB_FILE_CONTROL
+
+//
+// Flush SMB, see #1 page 11
+// Function is SrvSmbFlush()
+// SMB_COM_FLUSH 0x05
+//
+
+typedef struct _REQ_FLUSH {
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( Fid ); // File handle
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} REQ_FLUSH;
+typedef REQ_FLUSH SMB_UNALIGNED *PREQ_FLUSH;
+
+typedef struct _RESP_FLUSH {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_FLUSH;
+typedef RESP_FLUSH SMB_UNALIGNED *PRESP_FLUSH;
+
+#endif // def INCLUDE_SMB_FILE_CONTROL
+
+#ifdef INCLUDE_SMB_MESSAGE
+
+//
+// Forward User Name SMB, see #1 page 34
+// Function is SrvSmbForwardUserName()
+// SMB_COM_FORWARD_USER_NAME 0xD2
+//
+
+typedef struct _REQ_FORWARD_USER_NAME {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes; min = 2
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR BufferFormat; // 0x04 -- ASCII
+ //UCHAR ForwardedName[]; // Forwarded name
+} REQ_FORWARD_USER_NAME;
+typedef REQ_FORWARD_USER_NAME SMB_UNALIGNED *PREQ_FORWARD_USER_NAME;
+
+typedef struct _RESP_FORWARD_USER_NAME {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_FORWARD_USER_NAME;
+typedef RESP_FORWARD_USER_NAME SMB_UNALIGNED *PRESP_FORWARD_USER_NAME;
+
+#endif // def INCLUDE_SMB_MESSAGE
+
+#ifdef INCLUDE_SMB_MESSAGE
+
+//
+// Get Machine Name SMB, see #1 page 35
+// Function is SrvSmbGetMachineName()
+// SMB_COM_GET_MACHINE_NAME 0xD4
+//
+
+typedef struct _REQ_GET_MACHINE_NAME {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} REQ_GET_MACHINE_NAME;
+typedef REQ_GET_MACHINE_NAME SMB_UNALIGNED *PREQ_GET_MACHINE_NAME;
+
+typedef struct _RESP_GET_MACHINE_NAME {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes; min = 2
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR BufferFormat; // 0x04 -- ASCII
+ //UCHAR MachineName[]; // Machine name
+} RESP_GET_MACHINE_NAME;
+typedef RESP_GET_MACHINE_NAME SMB_UNALIGNED *PRESP_GET_MACHINE_NAME;
+
+#endif // def INCLUDE_SMB_MESSAGE
+
+#ifdef INCLUDE_SMB_PRINT
+
+//
+// Get Print Queue SMB, see #1 page 29
+// Function is SrvSmbGetPrintQueue()
+// SMB_COM_GET_PRINT_QUEUE 0xC3
+//
+
+typedef struct _REQ_GET_PRINT_QUEUE {
+ UCHAR WordCount; // Count of parameter words = 2
+ _USHORT( MaxCount ); // Max number of entries to return
+ _USHORT( StartIndex ); // First queue entry to return
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} REQ_GET_PRINT_QUEUE;
+typedef REQ_GET_PRINT_QUEUE SMB_UNALIGNED *PREQ_GET_PRINT_QUEUE;
+
+typedef struct _RESP_GET_PRINT_QUEUE {
+ UCHAR WordCount; // Count of parameter words = 2
+ _USHORT( Count ); // Number of entries returned
+ _USHORT( RestartIndex ); // Index of entry after last returned
+ _USHORT( ByteCount ); // Count of data bytes; min = 3
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR BufferFormat; // 0x01 -- Data block
+ //USHORT DataLength; // Length of data
+ //UCHAR Data[]; // Queue elements
+} RESP_GET_PRINT_QUEUE;
+typedef RESP_GET_PRINT_QUEUE SMB_UNALIGNED *PRESP_GET_PRINT_QUEUE;
+
+#endif // def INCLUDE_SMB_PRINT
+
+#ifdef INCLUDE_SMB_TRANSACTION
+
+//
+// Ioctl SMB, see #2 page 39
+// Function is SrvSmbIoctl()
+// SMB_COM_IOCTL 0x27
+// SMB_COM_IOCTL_SECONDARY 0x28
+//
+
+typedef struct _REQ_IOCTL {
+ UCHAR WordCount; // Count of parameter words = 14
+ _USHORT( Fid ); // File handle
+ _USHORT( Category ); // Device category
+ _USHORT( Function ); // Device function
+ _USHORT( TotalParameterCount ); // Total parameter bytes being sent
+ _USHORT( TotalDataCount ); // Total data bytes being sent
+ _USHORT( MaxParameterCount ); // Max parameter bytes to return
+ _USHORT( MaxDataCount ); // Max data bytes to return
+ _ULONG( Timeout );
+ _USHORT( Reserved );
+ _USHORT( ParameterCount ); // Parameter bytes sent this buffer
+ _USHORT( ParameterOffset ); // Offset (from header start) to params
+ _USHORT( DataCount ); // Data bytes sent this buffer
+ _USHORT( DataOffset ); // Offset (from header start) to data
+ _USHORT( ByteCount ); // Count of data bytes
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR Pad[]; // Pad to SHORT or LONG
+ //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount)
+ //UCHAR Pad1[]; // Pad to SHORT or LONG
+ //UCHAR Data[]; // Data bytes (# = DataCount)
+} REQ_IOCTL;
+typedef REQ_IOCTL SMB_UNALIGNED *PREQ_IOCTL;
+
+typedef struct _RESP_IOCTL_INTERIM {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_IOCTL_INTERIM;
+typedef RESP_IOCTL_INTERIM SMB_UNALIGNED *PRESP_IOCTL_INTERIM;
+
+typedef struct _REQ_IOCTL_SECONDARY {
+ UCHAR WordCount; // Count of parameter words = 8
+ _USHORT( TotalParameterCount ); // Total parameter bytes being sent
+ _USHORT( TotalDataCount ); // Total data bytes being sent
+ _USHORT( ParameterCount ); // Parameter bytes sent this buffer
+ _USHORT( ParameterOffset ); // Offset (from header start) to params
+ _USHORT( ParameterDisplacement ); // Displacement of these param bytes
+ _USHORT( DataCount ); // Data bytes sent this buffer
+ _USHORT( DataOffset ); // Offset (from header start) to data
+ _USHORT( DataDisplacement ); // Displacement of these data bytes
+ _USHORT( ByteCount ); // Count of data bytes
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR Pad[]; // Pad to SHORT or LONG
+ //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount)
+ //UCHAR Pad1[]; // Pad to SHORT or LONG
+ //UCHAR Data[]; // Data bytes (# = DataCount)
+} REQ_IOCTL_SECONDARY;
+typedef REQ_IOCTL_SECONDARY SMB_UNALIGNED *PREQ_IOCTL_SECONDARY;
+
+typedef struct _RESP_IOCTL {
+ UCHAR WordCount; // Count of parameter words = 8
+ _USHORT( TotalParameterCount ); // Total parameter bytes being sent
+ _USHORT( TotalDataCount ); // Total data bytes being sent
+ _USHORT( ParameterCount ); // Parameter bytes sent this buffer
+ _USHORT( ParameterOffset ); // Offset (from header start) to params
+ _USHORT( ParameterDisplacement ); // Displacement of these param bytes
+ _USHORT( DataCount ); // Data bytes sent this buffer
+ _USHORT( DataOffset ); // Offset (from header start) to data
+ _USHORT( DataDisplacement ); // Displacement of these data bytes
+ _USHORT( ByteCount ); // Count of data bytes
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR Pad[]; // Pad to SHORT or LONG
+ //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount)
+ //UCHAR Pad1[]; // Pad to SHORT or LONG
+ //UCHAR Data[]; // Data bytes (# = DataCount)
+} RESP_IOCTL;
+typedef RESP_IOCTL SMB_UNALIGNED *PRESP_IOCTL;
+
+#endif // def INCLUDE_SMB_TRANSACTION
+
+#ifdef INCLUDE_SMB_LOCK
+
+//
+// Lock Byte Range SMB, see #1 page 20
+// Function is SrvSmbLockByteRange()
+// SMB_COM_LOCK_BYTE_RANGE 0x0C
+//
+
+typedef struct _REQ_LOCK_BYTE_RANGE {
+ UCHAR WordCount; // Count of parameter words = 5
+ _USHORT( Fid ); // File handle
+ _ULONG( Count ); // Count of bytes to lock
+ _ULONG( Offset ); // Offset from start of file
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} REQ_LOCK_BYTE_RANGE;
+typedef REQ_LOCK_BYTE_RANGE SMB_UNALIGNED *PREQ_LOCK_BYTE_RANGE;
+
+typedef struct _RESP_LOCK_BYTE_RANGE {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_LOCK_BYTE_RANGE;
+typedef RESP_LOCK_BYTE_RANGE SMB_UNALIGNED *PRESP_LOCK_BYTE_RANGE;
+
+#endif // def INCLUDE_SMB_LOCK
+
+#ifdef INCLUDE_SMB_LOCK
+
+//
+// Locking and X SMB, see #2 page 46
+// Function is SrvLockingAndX()
+// SMB_COM_LOCKING_ANDX 0x24
+//
+
+typedef struct _REQ_LOCKING_ANDX {
+ UCHAR WordCount; // Count of parameter words = 8
+ UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
+ UCHAR AndXReserved; // Reserved (must be 0)
+ _USHORT( AndXOffset ); // Offset to next command WordCount
+ _USHORT( Fid ); // File handle
+
+ //
+ // When NT protocol is not negotiated the OplockLevel field is
+ // omitted, and LockType field is a full word. Since the upper
+ // bits of LockType are never used, this definition works for
+ // all protocols.
+ //
+
+ UCHAR( LockType ); // Locking mode:
+ // bit 0: 0 = lock out all access
+ // 1 = read OK while locked
+ // bit 1: 1 = 1 user total file unlock
+ UCHAR( OplockLevel ); // The new oplock level
+ _ULONG( Timeout );
+ _USHORT( NumberOfUnlocks ); // Num. unlock range structs following
+ _USHORT( NumberOfLocks ); // Num. lock range structs following
+ _USHORT( ByteCount ); // Count of data bytes
+ UCHAR Buffer[1]; // Buffer containing:
+ //LOCKING_ANDX_RANGE Unlocks[]; // Unlock ranges
+ //LOCKING_ANDX_RANGE Locks[]; // Lock ranges
+} REQ_LOCKING_ANDX;
+typedef REQ_LOCKING_ANDX SMB_UNALIGNED *PREQ_LOCKING_ANDX;
+
+#define LOCKING_ANDX_SHARED_LOCK 0x01
+#define LOCKING_ANDX_OPLOCK_RELEASE 0x02
+#define LOCKING_ANDX_CHANGE_LOCKTYPE 0x04
+#define LOCKING_ANDX_CANCEL_LOCK 0x08
+#define LOCKING_ANDX_LARGE_FILES 0x10
+
+#define OPLOCK_BROKEN_TO_NONE 0
+#define OPLOCK_BROKEN_TO_II 1
+
+typedef struct _LOCKING_ANDX_RANGE {
+ _USHORT( Pid ); // PID of process "owning" lock
+ _ULONG( Offset ); // Ofset to bytes to [un]lock
+ _ULONG( Length ); // Number of bytes to [un]lock
+} LOCKING_ANDX_RANGE;
+typedef LOCKING_ANDX_RANGE SMB_UNALIGNED *PLOCKING_ANDX_RANGE;
+
+typedef struct _NT_LOCKING_ANDX_RANGE {
+ _USHORT( Pid ); // PID of process "owning" lock
+ _USHORT( Pad ); // Pad to DWORD align (mbz)
+ _ULONG( OffsetHigh ); // Ofset to bytes to [un]lock (high)
+ _ULONG( OffsetLow ); // Ofset to bytes to [un]lock (low)
+ _ULONG( LengthHigh ); // Number of bytes to [un]lock (high)
+ _ULONG( LengthLow ); // Number of bytes to [un]lock (low)
+} NTLOCKING_ANDX_RANGE;
+typedef NTLOCKING_ANDX_RANGE SMB_UNALIGNED *PNTLOCKING_ANDX_RANGE;
+ //
+typedef struct _RESP_LOCKING_ANDX {
+ UCHAR WordCount; // Count of parameter words = 2
+ UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
+ UCHAR AndXReserved; // Reserved (must be 0)
+ _USHORT( AndXOffset ); // Offset to next command WordCount
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_LOCKING_ANDX;
+typedef RESP_LOCKING_ANDX SMB_UNALIGNED *PRESP_LOCKING_ANDX;
+
+#define LOCK_BROKEN_SIZE 51 // # of bytes in lock broken notify
+
+#endif // def INCLUDE_SMB_LOCK
+
+#ifdef INCLUDE_SMB_ADMIN
+
+//
+// Logoff and X SMB, see #3, page 55
+// SMB_COM_LOGOFF_ANDX 0x74
+//
+
+typedef struct _REQ_LOGOFF_ANDX {
+ UCHAR WordCount; // Count of parameter words = 2
+ UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
+ UCHAR AndXReserved; // Reserved (must be 0)
+ _USHORT( AndXOffset ); // Offset to next command WordCount
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} REQ_LOGOFF_ANDX;
+typedef REQ_LOGOFF_ANDX SMB_UNALIGNED *PREQ_LOGOFF_ANDX;
+
+typedef struct _RESP_LOGOFF_ANDX {
+ UCHAR WordCount; // Count of parameter words = 2
+ UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
+ UCHAR AndXReserved; // Reserved (must be 0)
+ _USHORT( AndXOffset ); // Offset to next command WordCount
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_LOGOFF_ANDX;
+typedef RESP_LOGOFF_ANDX SMB_UNALIGNED *PRESP_LOGOFF_ANDX;
+
+#endif // def INCLUDE_SMB_ADMIN
+
+#ifdef INCLUDE_SMB_FILE_CONTROL
+
+//
+// Move SMB, see #2 page 49
+// Funcion is SrvSmbMove()
+// SMB_COM_MOVE 0x2A
+//
+
+typedef struct _REQ_MOVE {
+ UCHAR WordCount; // Count of parameter words = 3
+ _USHORT( Tid2 ); // Second (target) file id
+ _USHORT( OpenFunction ); // what to do if target file exists
+ _USHORT( Flags ); // Flags to control move operations:
+ // 0 - target must be a file
+ // 1 - target must be a directory
+ // 2 - reserved (must be 0)
+ // 3 - reserved (must be 0)
+ // 4 - verify all writes
+ _USHORT( ByteCount ); // Count of data bytes; min = 2
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR OldFileName[]; // Old file name
+ //UCHAR NewFileName[]; // New file name
+} REQ_MOVE;
+typedef REQ_MOVE SMB_UNALIGNED *PREQ_MOVE;
+
+typedef struct _RESP_MOVE {
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( Count ); // Number of files moved
+ _USHORT( ByteCount ); // Count of data bytes; min = 0
+ UCHAR Buffer[1]; // Pathname of file where error occurred
+} RESP_MOVE;
+typedef RESP_MOVE SMB_UNALIGNED *PRESP_MOVE;
+
+#endif // def INCLUDE_SMB_FILE_CONTROL
+
+#ifdef INCLUDE_SMB_ADMIN
+
+//
+// Negotiate SMB's for Net 1 and Net 3, see #1 page 25 and #2 page 20
+// Function is SrvSmbNegotiate()
+// SMB_COM_NEGOTIATE 0x72
+//
+
+typedef struct _REQ_NEGOTIATE {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes; min = 2
+ UCHAR Buffer[1]; // Buffer containing:
+ //struct {
+ // UCHAR BufferFormat; // 0x02 -- Dialect
+ // UCHAR DialectName[]; // ASCIIZ
+ //} Dialects[];
+} REQ_NEGOTIATE;
+typedef REQ_NEGOTIATE *PREQ_NEGOTIATE; // *** NOT SMB_UNALIGNED!
+
+typedef struct _RESP_NEGOTIATE {
+ UCHAR WordCount; // Count of parameter words = 13
+ _USHORT( DialectIndex ); // Index of selected dialect
+ _USHORT( SecurityMode ); // Security mode:
+ // bit 0: 0 = share, 1 = user
+ // bit 1: 1 = encrypt passwords
+ _USHORT( MaxBufferSize ); // Max transmit buffer size
+ _USHORT( MaxMpxCount ); // Max pending multiplexed requests
+ _USHORT( MaxNumberVcs ); // Max VCs between client and server
+ _USHORT( RawMode ); // Raw modes supported:
+ // bit 0: 1 = Read Raw supported
+ // bit 1: 1 = Write Raw supported
+ _ULONG( SessionKey );
+ SMB_TIME ServerTime; // Current time at server
+ SMB_DATE ServerDate; // Current date at server
+ _USHORT( ServerTimeZone ); // Current time zone at server
+ _USHORT( EncryptionKeyLength ); // MBZ if this is not LM2.1
+ _USHORT( Reserved ); // MBZ
+ _USHORT( ByteCount ); // Count of data bytes
+ UCHAR Buffer[1]; // Password encryption key
+ //UCHAR EncryptionKey[]; // The challenge encryption key
+ //UCHAR PrimaryDomain[]; // The server's primary domain (2.1 only)
+} RESP_NEGOTIATE;
+typedef RESP_NEGOTIATE *PRESP_NEGOTIATE; // *** NOT SMB_UNALIGNED!
+
+// Macros for SecurityMode field, above
+#define NEGOTIATE_USER_SECURITY 1
+#define NEGOTIATE_ENCRYPT_PASSWORDS 2
+
+// Macros for RawMode field, above
+#define NEGOTIATE_READ_RAW_SUPPORTED 1
+#define NEGOTIATE_WRITE_RAW_SUPPORTED 2
+
+typedef struct _RESP_OLD_NEGOTIATE {
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( DialectIndex ); // Index of selected dialect
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_OLD_NEGOTIATE;
+typedef RESP_OLD_NEGOTIATE *PRESP_OLD_NEGOTIATE; // *** NOT SMB_UNALIGNED!
+
+typedef struct _RESP_NT_NEGOTIATE {
+ UCHAR WordCount; // Count of parameter words = 17
+ _USHORT( DialectIndex ); // Index of selected dialect
+ UCHAR( SecurityMode ); // Security mode:
+ // bit 0: 0 = share, 1 = user
+ // bit 1: 1 = encrypt passwords
+ _USHORT( MaxMpxCount ); // Max pending multiplexed requests
+ _USHORT( MaxNumberVcs ); // Max VCs between client and server
+ _ULONG( MaxBufferSize ); // Max transmit buffer size
+ _ULONG( MaxRawSize ); // Maximum raw buffer size
+ _ULONG( SessionKey );
+ _ULONG( Capabilities ); // Server capabilities
+ _ULONG( SystemTimeLow ); // System (UTC) time of the server (low).
+ _ULONG( SystemTimeHigh ); // System (UTC) time of the server (high).
+ _USHORT( ServerTimeZone ); // Time zone of server (min from UTC)
+ UCHAR( EncryptionKeyLength ); // Length of encryption key.
+ _USHORT( ByteCount ); // Count of data bytes
+ UCHAR Buffer[1]; // Password encryption key
+ //UCHAR EncryptionKey[]; // The challenge encryption key
+ //UCHAR OemDomainName[]; // The name of the domain (in OEM chars)
+} RESP_NT_NEGOTIATE;
+typedef RESP_NT_NEGOTIATE *PRESP_NT_NEGOTIATE; // *** NOT SMB_UNALIGNED!
+
+#endif // def INCLUDE_SMB_ADMIN
+
+//
+// Server / workstation capabilities
+// N.B. Most messages use a ULONG for this, so there are many more
+// bits available.
+//
+
+#define CAP_RAW_MODE 0x0001
+#define CAP_MPX_MODE 0x0002
+#define CAP_UNICODE 0x0004
+#define CAP_LARGE_FILES 0x0008
+#define CAP_NT_SMBS 0x0010
+#define CAP_RPC_REMOTE_APIS 0x0020
+#define CAP_NT_STATUS 0x0040
+#define CAP_LEVEL_II_OPLOCKS 0x0080
+#define CAP_LOCK_AND_READ 0x0100
+#define CAP_NT_FIND 0x0200
+#define CAP_BULK_TRANSFER 0x0400
+#define CAP_COMPRESSED_DATA 0x0800
+#define CAP_DFS 0x1000 // This server is DFS aware
+#define CAP_QUADWORD_ALIGNED 0x2000 // NT dir info level responses are quad aligned
+#define CAP_LARGE_READX 0x4000 // Server supports oversized READ&X on files
+
+#ifdef INCLUDE_SMB_OPEN_CLOSE
+
+//
+// Open SMB, see #1, page 7
+// Function is SrvSmbOpen()
+// SMB_COM_OPEN 0x02
+//
+
+typedef struct _REQ_OPEN {
+ UCHAR WordCount; // Count of parameter words = 2
+ _USHORT( DesiredAccess ); // Mode - read/write/share
+ _USHORT( SearchAttributes );
+ _USHORT( ByteCount ); // Count of data bytes; min = 2
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR BufferFormat; // 0x04 -- ASCII
+ //UCHAR FileName[]; // File name
+} REQ_OPEN;
+typedef REQ_OPEN SMB_UNALIGNED *PREQ_OPEN;
+
+typedef struct _RESP_OPEN {
+ UCHAR WordCount; // Count of parameter words = 7
+ _USHORT( Fid ); // File handle
+ _USHORT( FileAttributes );
+ _ULONG( LastWriteTimeInSeconds );
+ _ULONG( DataSize ); // File size
+ _USHORT( GrantedAccess ); // Access allowed
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_OPEN;
+typedef RESP_OPEN SMB_UNALIGNED *PRESP_OPEN;
+
+#endif // def INCLUDE_SMB_OPEN_CLOSE
+
+#ifdef INCLUDE_SMB_OPEN_CLOSE
+
+//
+// Open and X SMB, see #2 page 51
+// Function is SrvOpenAndX()
+// SMB_COM_OPEN_ANDX 0x2D
+//
+
+typedef struct _REQ_OPEN_ANDX {
+ UCHAR WordCount; // Count of parameter words = 15
+ UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
+ UCHAR AndXReserved; // Reserved (must be 0)
+ _USHORT( AndXOffset ); // Offset to next command WordCount
+ _USHORT( Flags ); // Additional information: bit set-
+ // 0 - return additional info
+ // 1 - set single user total file lock
+ // 2 - server notifies consumer of
+ // actions which may change file
+ _USHORT( DesiredAccess ); // File open mode
+ _USHORT( SearchAttributes );
+ _USHORT( FileAttributes );
+ _ULONG( CreationTimeInSeconds );
+ _USHORT( OpenFunction );
+ _ULONG( AllocationSize ); // Bytes to reserve on create or truncate
+ _ULONG( Timeout ); // Max milliseconds to wait for resource
+ _ULONG( Reserved ); // Reserved (must be 0)
+ _USHORT( ByteCount ); // Count of data bytes; min = 1
+ UCHAR Buffer[1]; // File name
+} REQ_OPEN_ANDX;
+typedef REQ_OPEN_ANDX SMB_UNALIGNED *PREQ_OPEN_ANDX;
+
+typedef struct _RESP_OPEN_ANDX {
+ UCHAR WordCount; // Count of parameter words = 15
+ UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
+ UCHAR AndXReserved; // Reserved (must be 0)
+ _USHORT( AndXOffset ); // Offset to next command WordCount
+ _USHORT( Fid ); // File handle
+ _USHORT( FileAttributes );
+ _ULONG( LastWriteTimeInSeconds );
+ _ULONG( DataSize ); // Current file size
+ _USHORT( GrantedAccess ); // Access permissions actually allowed
+ _USHORT( FileType );
+ _USHORT( DeviceState ); // state of IPC device (e.g. pipe)
+ _USHORT( Action ); // Action taken
+ _ULONG( ServerFid ); // Server unique file id
+ _USHORT( Reserved ); // Reserved (must be 0)
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_OPEN_ANDX;
+typedef RESP_OPEN_ANDX SMB_UNALIGNED *PRESP_OPEN_ANDX;
+
+typedef struct _REQ_NT_CREATE_ANDX {
+ UCHAR WordCount; // Count of parameter words = 24
+ UCHAR AndXCommand; // Secondary command; 0xFF = None
+ UCHAR AndXReserved; // MBZ
+ _USHORT( AndXOffset ); // Offset to next command wordcount
+ UCHAR Reserved; // MBZ
+ _USHORT( NameLength ); // Length of Name[] in bytes
+ _ULONG( Flags ); // Create flags
+ _ULONG( RootDirectoryFid ); // If non-zero, open is relative to this directory
+ ACCESS_MASK DesiredAccess; // NT access desired
+ LARGE_INTEGER AllocationSize; // Initial allocation size
+ _ULONG( FileAttributes ); // File attributes for creation
+ _ULONG( ShareAccess ); // Type of share access
+ _ULONG( CreateDisposition ); // Action to take if file exists or not
+ _ULONG( CreateOptions ); // Options to use if creating a file
+ _ULONG( ImpersonationLevel ); // Security QOS information
+ UCHAR SecurityFlags; // Security QOS information
+ _USHORT( ByteCount ); // Length of byte parameters
+ UCHAR Buffer[1];
+ //UCHAR Name[]; // File to open or create
+} REQ_NT_CREATE_ANDX;
+typedef REQ_NT_CREATE_ANDX SMB_UNALIGNED *PREQ_NT_CREATE_ANDX;
+
+// Flag bit for Security flags
+
+#define SMB_SECURITY_DYNAMIC_TRACKING 0x01
+#define SMB_SECURITY_EFFECTIVE_ONLY 0x02
+
+typedef struct _RESP_NT_CREATE_ANDX {
+ UCHAR WordCount; // Count of parameter words = 26
+ UCHAR AndXCommand; // Secondary command; 0xFF = None
+ UCHAR AndXReserved; // MBZ
+ _USHORT( AndXOffset ); // Offset to next command wordcount
+ UCHAR OplockLevel; // The oplock level granted
+ _USHORT( Fid ); // The file ID
+ _ULONG( CreateAction ); // The action taken
+ TIME CreationTime; // The time the file was created
+ TIME LastAccessTime; // The time the file was accessed
+ TIME LastWriteTime; // The time the file was last written
+ TIME ChangeTime; // The time the file was last changed
+ _ULONG( FileAttributes ); // The file attributes
+ LARGE_INTEGER AllocationSize; // The number of byes allocated
+ LARGE_INTEGER EndOfFile; // The end of file offset
+ _USHORT( FileType );
+ _USHORT( DeviceState ); // state of IPC device (e.g. pipe)
+ BOOLEAN Directory; // TRUE if this is a directory
+ _USHORT( ByteCount ); // = 0
+ UCHAR Buffer[1];
+} RESP_NT_CREATE_ANDX;
+typedef RESP_NT_CREATE_ANDX SMB_UNALIGNED *PRESP_NT_CREATE_ANDX;
+
+#define SMB_OPLOCK_LEVEL_NONE 0
+#define SMB_OPLOCK_LEVEL_EXCLUSIVE 1
+#define SMB_OPLOCK_LEVEL_BATCH 2
+#define SMB_OPLOCK_LEVEL_II 3
+
+#endif // def INCLUDE_SMB_OPEN_CLOSE
+
+#ifdef INCLUDE_SMB_PRINT
+
+//
+// Open Print File SMB, see #1 page 27
+// Function is SrvSmbOpenPrintFile()
+// SMB_COM_OPEN_PRINT_FILE 0xC0
+//
+
+typedef struct _REQ_OPEN_PRINT_FILE {
+ UCHAR WordCount; // Count of parameter words = 2
+ _USHORT( SetupLength ); // Length of printer setup data
+ _USHORT( Mode ); // 0 = Text mode (DOS expands TABs)
+ // 1 = Graphics mode
+ _USHORT( ByteCount ); // Count of data bytes; min = 2
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR BufferFormat; // 0x04 -- ASCII
+ //UCHAR IdentifierString[]; // Identifier string
+} REQ_OPEN_PRINT_FILE;
+typedef REQ_OPEN_PRINT_FILE SMB_UNALIGNED *PREQ_OPEN_PRINT_FILE;
+
+typedef struct _RESP_OPEN_PRINT_FILE {
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( Fid ); // File handle
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_OPEN_PRINT_FILE;
+typedef RESP_OPEN_PRINT_FILE SMB_UNALIGNED *PRESP_OPEN_PRINT_FILE;
+
+#endif // def INCLUDE_SMB_PRINT
+
+#ifdef INCLUDE_SMB_ADMIN
+
+//
+// Process Exit SMB, see #1 page 22
+// Function is SrvSmbProcessExit()
+// SMB_COM_PROCESS_EXIT 0x11
+//
+
+typedef struct _REQ_PROCESS_EXIT {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} REQ_PROCESS_EXIT;
+typedef REQ_PROCESS_EXIT SMB_UNALIGNED *PREQ_PROCESS_EXIT;
+
+typedef struct _RESP_PROCESS_EXIT {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_PROCESS_EXIT;
+typedef RESP_PROCESS_EXIT SMB_UNALIGNED *PRESP_PROCESS_EXIT;
+
+#endif // def INCLUDE_SMB_ADMIN
+
+#ifdef INCLUDE_SMB_QUERY_SET
+
+//
+// Query Information SMB, see #1 page 18
+// Function is SrvSmbQueryInformation()
+// SMB_COM_QUERY_INFORMATION 0x08
+//
+
+typedef struct _REQ_QUERY_INFORMATION {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes; min = 2
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR BufferFormat; // 0x04 -- ASCII
+ //UCHAR FileName[]; // File name
+} REQ_QUERY_INFORMATION;
+typedef REQ_QUERY_INFORMATION SMB_UNALIGNED *PREQ_QUERY_INFORMATION;
+
+typedef struct _RESP_QUERY_INFORMATION {
+ UCHAR WordCount; // Count of parameter words = 10
+ _USHORT( FileAttributes );
+ _ULONG( LastWriteTimeInSeconds );
+ _ULONG( FileSize ); // File size
+ _USHORT( Reserved )[5]; // Reserved (must be 0)
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_QUERY_INFORMATION;
+typedef RESP_QUERY_INFORMATION SMB_UNALIGNED *PRESP_QUERY_INFORMATION;
+
+#endif // def INCLUDE_SMB_QUERY_SET
+
+#ifdef INCLUDE_SMB_QUERY_SET
+
+//
+// Query Information2 SMB, see #2 page 37
+// Function is SrvSmbQueryInformation2()
+// SMB_COM_QUERY_INFORMATION2 0x23
+//
+
+typedef struct _REQ_QUERY_INFORMATION2 {
+ UCHAR WordCount; // Count of parameter words = 2
+ _USHORT( Fid ); // File handle
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} REQ_QUERY_INFORMATION2;
+typedef REQ_QUERY_INFORMATION2 SMB_UNALIGNED *PREQ_QUERY_INFORMATION2;
+
+typedef struct _RESP_QUERY_INFORMATION2 {
+ UCHAR WordCount; // Count of parameter words = 11
+ SMB_DATE CreationDate;
+ SMB_TIME CreationTime;
+ SMB_DATE LastAccessDate;
+ SMB_TIME LastAccessTime;
+ SMB_DATE LastWriteDate;
+ SMB_TIME LastWriteTime;
+ _ULONG( FileDataSize ); // File end of data
+ _ULONG( FileAllocationSize ); // File allocation size
+ _USHORT( FileAttributes );
+ _USHORT( ByteCount ); // Count of data bytes; min = 0
+ UCHAR Buffer[1]; // Reserved buffer
+} RESP_QUERY_INFORMATION2;
+typedef RESP_QUERY_INFORMATION2 SMB_UNALIGNED *PRESP_QUERY_INFORMATION2;
+
+#endif // def INCLUDE_SMB_QUERY_SET
+
+#ifdef INCLUDE_SMB_MISC
+
+//
+// Query Information Disk SMB, see #1 page 24
+// Function is SrvSmbQueryInformationDisk()
+// SMB_COM_QUERY_INFORMATION_DISK 0x80
+//
+
+typedef struct _REQ_QUERY_INFORMATION_DISK {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} REQ_QUERY_INFORMATION_DISK;
+typedef REQ_QUERY_INFORMATION_DISK SMB_UNALIGNED *PREQ_QUERY_INFORMATION_DISK;
+
+typedef struct _RESP_QUERY_INFORMATION_DISK {
+ UCHAR WordCount; // Count of parameter words = 5
+ _USHORT( TotalUnits ); // Total allocation units per server
+ _USHORT( BlocksPerUnit ); // Blocks per allocation unit
+ _USHORT( BlockSize ); // Block size (in bytes)
+ _USHORT( FreeUnits ); // Number of free units
+ _USHORT( Reserved ); // Reserved (media identification code)
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_QUERY_INFORMATION_DISK;
+typedef RESP_QUERY_INFORMATION_DISK SMB_UNALIGNED *PRESP_QUERY_INFORMATION_DISK;
+
+#endif // def INCLUDE_SMB_MISC
+
+#ifdef INCLUDE_SMB_MISC
+
+//
+// Query Server Information SMB, see #? page ??
+// Function is SrvSmbQueryInformationServer
+// SMB_COM_QUERY_INFORMATION_SRV 0x21
+//
+
+typedef struct _REQ_QUERY_INFORMATION_SRV {
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( Mode );
+ _USHORT( ByteCount ); // Count of data bytes; min =
+ UCHAR Buffer[1]; //
+} REQ_QUERY_INFORMATION_SRV;
+typedef REQ_QUERY_INFORMATION_SRV SMB_UNALIGNED *PREQ_QUERY_INFORMATION_SRV;
+
+typedef struct _RESP_QUERY_INFORMATION_SRV {
+ UCHAR WordCount; // Count of parameter words = 20
+ _ULONG( smb_fsid );
+ _ULONG( BlocksPerUnit );
+ _ULONG( smb_aunits );
+ _ULONG( smb_fau );
+ _USHORT( BlockSize );
+ SMB_DATE smb_vldate;
+ SMB_TIME smb_vltime;
+ UCHAR smb_vllen;
+ UCHAR Reserved; // Reserved (must be 0)
+ _USHORT( SecurityMode );
+ _USHORT( BlockMode );
+ _ULONG( Services );
+ _USHORT( MaxTransmitSize );
+ _USHORT( MaxMpxCount );
+ _USHORT( MaxNumberVcs );
+ SMB_TIME ServerTime;
+ SMB_DATE ServerDate;
+ _USHORT( ServerTimeZone );
+ _ULONG( Reserved2 );
+ _USHORT( ByteCount ); // Count of data bytes; min =
+ UCHAR Buffer[1]; //
+} RESP_QUERY_INFORMATION_SRV;
+typedef RESP_QUERY_INFORMATION_SRV SMB_UNALIGNED *PRESP_QUERY_INFORMATION_SRV;
+
+#endif // def INCLUDE_SMB_MISC
+
+#ifdef INCLUDE_SMB_READ_WRITE
+
+//
+// Read SMB, see #1 page 12
+// Lock and Read SMB, see #2 page 44
+// SMB_COM_READ 0x0A, Function is SrvSmbRead
+// SMB_COM_LOCK_AND_READ 0x13, Function is SrvSmbLockAndRead
+//
+
+typedef struct _REQ_READ {
+ UCHAR WordCount; // Count of parameter words = 5
+ _USHORT( Fid ); // File handle
+ _USHORT( Count ); // Count of bytes being requested
+ _ULONG( Offset ); // Offset in file of first byte to read
+ _USHORT( Remaining ); // Estimate of bytes to read if nonzero
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} REQ_READ;
+typedef REQ_READ SMB_UNALIGNED *PREQ_READ;
+
+//
+// *** Warning: the following structure is defined the way it is to
+// ensure longword alignment of the data buffer. (This only matters
+// when packing is disabled; when packing is turned on, the right
+// thing happens no matter what.)
+//
+
+typedef struct _RESP_READ {
+ UCHAR WordCount; // Count of parameter words = 5
+ _USHORT( Count ); // Count of bytes actually returned
+ _USHORT( Reserved )[4]; // Reserved (must be 0)
+ _USHORT( ByteCount ); // Count of data bytes
+ //UCHAR Buffer[1]; // Buffer containing:
+ UCHAR BufferFormat; // 0x01 -- Data block
+ _USHORT( DataLength ); // Length of data
+ ULONG Buffer[1]; // Data
+} RESP_READ;
+typedef RESP_READ SMB_UNALIGNED *PRESP_READ;
+
+#endif // def INCLUDE_SMB_READ_WRITE
+
+#ifdef INCLUDE_SMB_READ_WRITE
+
+//
+// Read and X SMB, see #2 page 56
+// Function is SrvSmbReadAndX()
+// SMB_COM_READ_ANDX 0x2E
+//
+
+typedef struct _REQ_READ_ANDX {
+ UCHAR WordCount; // Count of parameter words = 10
+ UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
+ UCHAR AndXReserved; // Reserved (must be 0)
+ _USHORT( AndXOffset ); // Offset to next command WordCount
+ _USHORT( Fid ); // File handle
+ _ULONG( Offset ); // Offset in file to begin read
+ _USHORT( MaxCount ); // Max number of bytes to return
+ _USHORT( MinCount ); // Min number of bytes to return
+ _ULONG( Timeout );
+ _USHORT( Remaining ); // Bytes remaining to satisfy request
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} REQ_READ_ANDX;
+typedef REQ_READ_ANDX SMB_UNALIGNED *PREQ_READ_ANDX;
+
+typedef struct _REQ_NT_READ_ANDX {
+ UCHAR WordCount; // Count of parameter words = 12
+ UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
+ UCHAR AndXReserved; // Reserved (must be 0)
+ _USHORT( AndXOffset ); // Offset to next command WordCount
+ _USHORT( Fid ); // File handle
+ _ULONG( Offset ); // Offset in file to begin read
+ _USHORT( MaxCount ); // Max number of bytes to return
+ _USHORT( MinCount ); // Min number of bytes to return
+ _ULONG( Timeout );
+ _USHORT( Remaining ); // Bytes remaining to satisfy request
+ _ULONG( OffsetHigh ); // Used for NT Protocol only
+ // Upper 32 bits of offset
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} REQ_NT_READ_ANDX;
+typedef REQ_NT_READ_ANDX SMB_UNALIGNED *PREQ_NT_READ_ANDX;
+
+typedef struct _RESP_READ_ANDX {
+ UCHAR WordCount; // Count of parameter words = 12
+ UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
+ UCHAR AndXReserved; // Reserved (must be 0)
+ _USHORT( AndXOffset ); // Offset to next command WordCount
+ _USHORT( Remaining ); // Bytes remaining to be read
+ _USHORT( DataCompactionMode );
+ _USHORT( Reserved ); // Reserved (must be 0)
+ _USHORT( DataLength ); // Number of data bytes (min = 0)
+ _USHORT( DataOffset ); // Offset (from header start) to data
+ _USHORT( Reserved2 ); // Reserved (must be 0)
+ _ULONG( Reserved3 )[2]; // Reserved (must be 0)
+ _USHORT( ByteCount ); // Count of data bytes
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR Pad[]; // Pad to SHORT or LONG
+ //UCHAR Data[]; // Data (size = DataLength)
+} RESP_READ_ANDX;
+typedef RESP_READ_ANDX SMB_UNALIGNED *PRESP_READ_ANDX;
+
+#endif // def INCLUDE_SMB_READ_WRITE
+
+#ifdef INCLUDE_SMB_MPX
+
+//
+// Read Block Multiplexed SMB, see #2 page 58
+// Function is SrvSmbReadMpx()
+// SMB_COM_READ_MPX 0x1B
+// SMB_COM_READ_MPX_SECONDARY 0x1C
+//
+
+typedef struct _REQ_READ_MPX {
+ UCHAR WordCount; // Count of parameter words = 8
+ _USHORT( Fid ); // File handle
+ _ULONG( Offset ); // Offset in file to begin read
+ _USHORT( MaxCount ); // Max bytes to return (max 65535)
+ _USHORT( MinCount ); // Min bytes to return (normally 0)
+ _ULONG( Timeout );
+ _USHORT( Reserved );
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} REQ_READ_MPX;
+typedef REQ_READ_MPX SMB_UNALIGNED *PREQ_READ_MPX;
+
+typedef struct _RESP_READ_MPX {
+ UCHAR WordCount; // Count of parameter words = 8
+ _ULONG( Offset ); // Offset in file where data read
+ _USHORT( Count ); // Total bytes being returned
+ _USHORT( Remaining ); // Bytes remaining to be read (pipe/dev)
+ _USHORT( DataCompactionMode );
+ _USHORT( Reserved );
+ _USHORT( DataLength ); // Number of data bytes this buffer
+ _USHORT( DataOffset ); // Offset (from header start) to data
+ _USHORT( ByteCount ); // Count of data bytes
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR Pad[]; // Pad to SHORT or LONG
+ //UCHAR Data[]; // Data (size = DataLength)
+} RESP_READ_MPX;
+typedef RESP_READ_MPX SMB_UNALIGNED *PRESP_READ_MPX;
+
+#endif // def INCLUDE_SMB_MPX
+
+#ifdef INCLUDE_SMB_RAW
+
+//
+// Read Block Raw SMB, see #2 page 61
+// Function is SrvSmbReadRaw()
+// SMB_COM_READ_RAW 0x1A
+//
+
+typedef struct _REQ_READ_RAW {
+ UCHAR WordCount; // Count of parameter words = 8
+ _USHORT( Fid ); // File handle
+ _ULONG( Offset ); // Offset in file to begin read
+ _USHORT( MaxCount ); // Max bytes to return (max 65535)
+ _USHORT( MinCount ); // Min bytes to return (normally 0)
+ _ULONG( Timeout );
+ _USHORT( Reserved );
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} REQ_READ_RAW;
+typedef REQ_READ_RAW SMB_UNALIGNED *PREQ_READ_RAW;
+
+typedef struct _REQ_NT_READ_RAW {
+ UCHAR WordCount; // Count of parameter words = 10
+ _USHORT( Fid ); // File handle
+ _ULONG( Offset ); // Offset in file to begin read
+ _USHORT( MaxCount ); // Max bytes to return (max 65535)
+ _USHORT( MinCount ); // Min bytes to return (normally 0)
+ _ULONG( Timeout );
+ _USHORT( Reserved );
+ _ULONG( OffsetHigh ); // Used for NT Protocol only
+ // Upper 32 bits of offset
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} REQ_NT_READ_RAW;
+typedef REQ_NT_READ_RAW SMB_UNALIGNED *PREQ_NT_READ_RAW;
+
+// No response params for raw read--the response is the raw data.
+
+#endif // def INCLUDE_SMB_RAW
+
+#ifdef INCLUDE_SMB_BULK
+
+typedef enum {
+ CompressionTechnologyNone,
+ CompressionTechnologyOne
+} COMPRESSION_TECHNOLOGY_TYPE;
+
+#define READ_BULK_COMPRESSED_DATA_INFO 0x01
+
+typedef struct _REQ_READ_BULK {
+ UCHAR WordCount; // Count of parameter words = 12
+ _USHORT( Fid ); // File handle
+ UCHAR CompressionTechnology; // Compression Technology or zero
+ UCHAR Reserved; // Not used, MBZ
+ LARGE_INTEGER Offset; // Offset in file to begin read
+ _ULONG( MaxCount ); // Max bytes to return
+ _ULONG( MinCount ); // Min bytes to return (normally 0)
+ _ULONG( MessageSize ); // Max bytes to return per message
+ UCHAR Buffer[1]; // empty
+} REQ_READ_BULK;
+typedef REQ_READ_BULK SMB_UNALIGNED *PREQ_READ_BULK;
+
+typedef struct _COMPRESSION_TECHNOLOGY_1 {
+ _USHORT( CompressionFormatAndEngine ); // Compression Format
+ UCHAR CompressionUnitShift; // log2 of compression unit size
+ UCHAR ChunkShift; // log 2 of chunk size
+ _ULONG( NumberOfChunks ); // number of chunks in next field
+ _ULONG( CompressedChunkSizes )[1]; // Chunk sizes
+} COMPRESSION_TECHNOLOGY_1;
+
+typedef struct _RESP_READ_BULK {
+ UCHAR WordCount; // Count of parameter words = 12
+ UCHAR Flags; // bit 0: 1 if Compressed Data Info sent
+ UCHAR CompressionTechnology; // Compression Technology
+ _ULONG( Count ); // Bytes 'covered' by this message,
+ // since data could be compressed
+ LARGE_INTEGER( Offset ); // Offset in file for this data
+ _ULONG( DataCount ); // Data bytes, replaces ByteCount
+ _ULONG( Remaining ); // Bytes remaining to be sent
+ _USHORT( DataOffset ); // Offset from Buffer to data
+ union {
+ UCHAR Buffer[1]; // Start of data if not compressed
+ COMPRESSION_TECHNOLOGY_1 CompressedInfo1; // Compression Info
+ };
+} RESP_READ_BULK;
+typedef RESP_READ_BULK SMB_UNALIGNED *PRESP_READ_BULK;
+
+//
+// Define RESP_READ_BULK Flags
+//
+
+#define READ_BULK_COMPRESSED_DATA_INFO 0x01
+
+typedef struct _REQ_WRITE_BULK {
+ UCHAR WordCount; // Count of parameter words = 12
+ UCHAR Flags; // bit 0: 1 if write through mode
+ UCHAR CompressionTechnology; // The Compression Technology used
+ _USHORT( Fid ); // File handle
+ LARGE_INTEGER Offset; // Offset in file to begin write
+ _ULONG( TotalCount ); // Amount of data in next write message
+ _ULONG( DataCount ); // Data bytes, replaces ByteCount
+ _ULONG( MessageSize ); // Max bytes sent per message
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ union {
+ UCHAR Buffer[1]; // Empty if data is not compressed
+ COMPRESSION_TECHNOLOGY_1 CompressedInfo1; // Chunk descriptor if compressed
+ };
+} REQ_WRITE_BULK;
+typedef REQ_WRITE_BULK SMB_UNALIGNED *PREQ_WRITE_BULK;
+
+//
+// Define REQ_WRITE_BULK Flags
+//
+
+typedef struct _RESP_WRITE_BULK {
+ UCHAR WordCount; // Count of parameter words = 5
+ UCHAR Sequence; // Handle for this exchange sequence
+ UCHAR CompressionTechnology; // Send data according to this format
+ _ULONG( Length ); // Length of data client may send
+ _ULONG( MessageSize ); // Max bytes allowed per message
+ UCHAR Buffer[1]; // Empty
+} RESP_WRITE_BULK;
+typedef RESP_WRITE_BULK SMB_UNALIGNED *PRESP_WRITE_BULK;
+
+typedef struct _REQ_WRITE_BULK_DATA {
+ UCHAR WordCount; // Count of parameter words = 10
+ UCHAR Sequence; // Handle for this exchange sequence
+ UCHAR Reserved; // Not used, MBZ
+ _USHORT( Fid ); // File handle
+ _ULONG( DataCount ); // Count data bytes, replaces ByteCount
+ LARGE_INTEGER Offset; // Offset in file for this write
+ _ULONG( Remaining ); // bytes remaining to be written
+ _USHORT( ByteCount ); // Not used, not big enough = 0
+ UCHAR Buffer[1]; // Start of data/chunks
+} REQ_WRITE_BULK_DATA;
+typedef REQ_WRITE_BULK_DATA SMB_UNALIGNED *PREQ_WRITE_BULK_DATA;
+
+// There is no response to a REQ_WRITE_BULK_DATA, except on error.
+
+#endif // def INCLUDE_SMB_BULK
+
+#ifdef INCLUDE_SMB_FILE_CONTROL
+
+//
+// Rename SMB, see #1 page 17
+// Function is SrvSmbRename()
+// SMB_COM_RENAME 0x07
+//
+
+typedef struct _REQ_RENAME {
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( SearchAttributes );
+ _USHORT( ByteCount ); // Count of data bytes; min = 4
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR BufferFormat1; // 0x04 -- ASCII
+ //UCHAR OldFileName[]; // Old file name
+ //UCHAR BufferFormat2; // 0x04 -- ASCII
+ //UCHAR NewFileName[]; // New file name
+} REQ_RENAME;
+typedef REQ_RENAME SMB_UNALIGNED *PREQ_RENAME;
+
+
+//
+// Extended NT rename SMB
+// Function is SrvSmbRename()
+// SMB_COM_NT_RENAME 0xA5
+//
+
+typedef struct _REQ_NTRENAME {
+ UCHAR WordCount; // Count of parameter words = 4
+ _USHORT( SearchAttributes );
+ _USHORT( InformationLevel );
+ _ULONG( ClusterCount );
+ _USHORT( ByteCount ); // Count of data bytes; min = 4
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR BufferFormat1; // 0x04 -- ASCII
+ //UCHAR OldFileName[]; // Old file name
+ //UCHAR BufferFormat2; // 0x04 -- ASCII
+ //UCHAR NewFileName[]; // New file name
+} REQ_NTRENAME;
+typedef REQ_NTRENAME SMB_UNALIGNED *PREQ_NTRENAME;
+
+typedef struct _RESP_RENAME {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_RENAME;
+typedef RESP_RENAME SMB_UNALIGNED *PRESP_RENAME;
+
+#endif // def INCLUDE_SMB_FILE_CONTROL
+
+#ifdef INCLUDE_SMB_SEARCH
+
+//
+// Search SMBs. One structure is common for both the core Search and the
+// LAN Manager 1.0 Find First/Next/Close.
+//
+// Function is SrvSmbSearch()
+//
+// Search, see #1 page 26
+// SMB_COM_SEARCH 0x81
+// FindFirst and FindNext, see #2 page 27
+// SMB_COM_FIND 0x82
+// FindUnique, see #2 page 33
+// SMB_COM_FIND_UNIQUE 0x83
+// FindClose, see #2 page 31
+// SMB_COM_FIND_CLOSE 0x84
+//
+
+typedef struct _REQ_SEARCH {
+ UCHAR WordCount; // Count of parameter words = 2
+ _USHORT( MaxCount ); // Number of dir. entries to return
+ _USHORT( SearchAttributes );
+ _USHORT( ByteCount ); // Count of data bytes; min = 5
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR BufferFormat1; // 0x04 -- ASCII
+ //UCHAR FileName[]; // File name, may be null
+ //UCHAR BufferFormat2; // 0x05 -- Variable block
+ //USHORT ResumeKeyLength; // Length of resume key, may be 0
+ //UCHAR SearchStatus[]; // Resume key
+} REQ_SEARCH;
+typedef REQ_SEARCH SMB_UNALIGNED *PREQ_SEARCH;
+
+typedef struct _RESP_SEARCH {
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( Count ); // Number of entries returned
+ _USHORT( ByteCount ); // Count of data bytes; min = 3
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR BufferFormat; // 0x05 -- Variable block
+ //USHORT DataLength; // Length of data
+ //UCHAR Data[]; // Data
+} RESP_SEARCH;
+typedef RESP_SEARCH SMB_UNALIGNED *PRESP_SEARCH;
+
+//
+// These two structures are use to return information in the Search SMBs.
+// SMB_DIRECTORY_INFORMATION is used to return information about a file
+// that was found. In addition to the usual information about the file,
+// each of these structures contains an SMB_RESUME_KEY, which is used to
+// continue or rewind a search.
+//
+// These structures must be packed, so turn on packing if it isn't
+// already on.
+//
+
+#ifdef NO_PACKING
+#include <packon.h>
+#endif // def NO_PACKING
+
+typedef struct _SMB_RESUME_KEY {
+ UCHAR Reserved; // bit 7 - comsumer use
+ // bits 5,6 - system use (must preserve)
+ // bits 0-4 - server use (must preserve)
+ UCHAR FileName[11];
+ UCHAR Sid; // Uniquely identifies Find through Close
+ _ULONG( FileIndex ); // Reserved for server use
+ UCHAR Consumer[4]; // Reserved for comsumer use
+} SMB_RESUME_KEY;
+typedef SMB_RESUME_KEY SMB_UNALIGNED *PSMB_RESUME_KEY;
+
+typedef struct _SMB_DIRECTORY_INFORMATION {
+ SMB_RESUME_KEY ResumeKey;
+ UCHAR FileAttributes;
+ SMB_TIME LastWriteTime;
+ SMB_DATE LastWriteDate;
+ _ULONG( FileSize );
+ UCHAR FileName[13]; // ASCII, space-filled null terminated
+} SMB_DIRECTORY_INFORMATION;
+typedef SMB_DIRECTORY_INFORMATION SMB_UNALIGNED *PSMB_DIRECTORY_INFORMATION;
+
+#ifdef NO_PACKING
+#include <packoff.h>
+#endif // def NO_PACKING
+
+#endif // def INCLUDE_SMB_SEARCH
+
+#ifdef INCLUDE_SMB_READ_WRITE
+
+//
+// Seek SMB, see #1 page 14
+// Function is SrvSmbSeek
+// SMB_COM_SEEK 0x12
+//
+
+typedef struct _REQ_SEEK {
+ UCHAR WordCount; // Count of parameter words = 4
+ _USHORT( Fid ); // File handle
+ _USHORT( Mode ); // Seek mode:
+ // 0 = from start of file
+ // 1 = from current position
+ // 2 = from end of file
+ _ULONG( Offset ); // Relative offset
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} REQ_SEEK;
+typedef REQ_SEEK SMB_UNALIGNED *PREQ_SEEK;
+
+typedef struct _RESP_SEEK {
+ UCHAR WordCount; // Count of parameter words = 2
+ _ULONG( Offset ); // Offset from start of file
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_SEEK;
+typedef RESP_SEEK SMB_UNALIGNED *PRESP_SEEK;
+
+#endif // def INCLUDE_SMB_READ_WRITE
+
+#ifdef INCLUDE_SMB_MESSAGE
+
+//
+// Send Broadcast Message SMB, see #1 page 32
+// Function is SrvSmbSendBroadcastMessage()
+// SMB_COM_SEND_BROADCAST_MESSAGE 0xD1
+//
+
+typedef struct _REQ_SEND_BROADCAST_MESSAGE {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes; min = 8
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR BufferFormat1; // 0x04 -- ASCII
+ //UCHAR OriginatorName[]; // Originator name (max = 15)
+ //UCHAR BufferFormat2; // 0x04 -- ASCII
+ //UCHAR DestinationName[]; // "*"
+ //UCHAR BufferFormat3; // 0x01 -- Data block
+ //USHORT DataLength; // Length of message; max = 128
+ //UCHAR Data[]; // Message
+} REQ_SEND_BROADCAST_MESSAGE;
+typedef REQ_SEND_BROADCAST_MESSAGE SMB_UNALIGNED *PREQ_SEND_BROADCAST_MESSAGE;
+
+// No response for Send Broadcast Message
+
+#endif // def INCLUDE_SMB_MESSAGE
+
+#ifdef INCLUDE_SMB_MESSAGE
+
+//
+// Send End of Multi-block Message SMB, see #1 page 33
+// Function is SrvSmbSendEndMbMessage()
+// SMB_COM_SEND_END_MB_MESSAGE 0xD6
+//
+
+typedef struct _REQ_SEND_END_MB_MESSAGE {
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( MessageGroupId );
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} REQ_SEND_END_MB_MESSAGE;
+typedef REQ_SEND_END_MB_MESSAGE SMB_UNALIGNED *PREQ_SEND_END_MB_MESSAGE;
+
+typedef struct _RESP_SEND_END_MB_MESSAGE {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_SEND_END_MB_MESSAGE;
+typedef RESP_SEND_END_MB_MESSAGE SMB_UNALIGNED *PRESP_SEND_END_MB_MESSAGE;
+
+#endif // def INCLUDE_SMB_MESSAGE
+
+#ifdef INCLUDE_SMB_MESSAGE
+
+//
+// Send Single Block Message SMB, see #1 page 31
+// Function is SrvSmbSendMessage()
+// SMB_COM_SEND_MESSAGE 0xD0
+//
+
+typedef struct _REQ_SEND_MESSAGE {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes; min = 7
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR BufferFormat1; // 0x04 -- ASCII
+ //UCHAR OriginatorName[]; // Originator name (max = 15)
+ //UCHAR BufferFormat2; // 0x04 -- ASCII
+ //UCHAR DestinationName[]; // Destination name (max = 15)
+ //UCHAR BufferFormat3; // 0x01 -- Data block
+ //USHORT DataLength; // Length of message; max = 128
+ //UCHAR Data[]; // Message
+} REQ_SEND_MESSAGE;
+typedef REQ_SEND_MESSAGE SMB_UNALIGNED *PREQ_SEND_MESSAGE;
+
+typedef struct _RESP_SEND_MESSAGE {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_SEND_MESSAGE;
+typedef RESP_SEND_MESSAGE SMB_UNALIGNED *PRESP_SEND_MESSAGE;
+
+#endif // def INCLUDE_SMB_MESSAGE
+
+#ifdef INCLUDE_SMB_MESSAGE
+
+//
+// Send Start of Multi-block Message SMB, see #1 page 32
+// Function is SrvSmbSendStartMbMessage()
+// SMB_COM_SEND_START_MB_MESSAGE 0xD5
+//
+
+typedef struct _REQ_SEND_START_MB_MESSAGE {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes; min = 0
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR BufferFormat1; // 0x04 -- ASCII
+ //UCHAR OriginatorName[]; // Originator name (max = 15)
+ //UCHAR BufferFormat2; // 0x04 -- ASCII
+ //UCHAR DestinationName[]; // Destination name (max = 15)
+} REQ_SEND_START_MB_MESSAGE;
+typedef REQ_SEND_START_MB_MESSAGE SMB_UNALIGNED *PREQ_SEND_START_MB_MESSAGE;
+
+typedef struct _RESP_SEND_START_MB_MESSAGE {
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( MessageGroupId );
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_SEND_START_MB_MESSAGE;
+typedef RESP_SEND_START_MB_MESSAGE SMB_UNALIGNED *PSEND_START_MB_MESSAGE;
+
+#endif // def INCLUDE_SMB_MESSAGE
+
+#ifdef INCLUDE_SMB_MESSAGE
+
+//
+// Send Text of Multi-block Message SMB, see #1 page 33
+// Function is SrvSmbSendTextMbMessage()
+// SMB_COM_SEND_TEXT_MB_MESSAGE 0xD7
+//
+
+typedef struct _REQ_SEND_TEXT_MB_MESSAGE {
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( MessageGroupId );
+ _USHORT( ByteCount ); // Count of data bytes; min = 3
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR BufferFormat; // 0x01 -- Data block
+ //USHORT DataLength; // Length of message; max = 128
+ //UCHAR Data[]; // Message
+} REQ_SEND_TEXT_MB_MESSAGE;
+typedef REQ_SEND_TEXT_MB_MESSAGE SMB_UNALIGNED *PREQ_SEND_TEXT_MB_MESSAGE;
+
+typedef struct _RESP_SEND_TEXT_MB_MESSAGE {
+ UCHAR WordCount; // Count of aprameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_SEND_TEXT_MB_MESSAGE;
+typedef RESP_SEND_TEXT_MB_MESSAGE SMB_UNALIGNED *PRESP_SEND_TEXT_MB_MESSAGE;
+
+#endif // def INCLUDE_SMB_MESSAGE
+
+#ifdef INCLUDE_SMB_ADMIN
+
+//
+// Session Setup and X SMB, see #2 page 63 and #3 page 10
+// Function is SrvSmbSessionSetupAndX()
+// SMB_COM_SESSION_SETUP_ANDX 0x73
+//
+
+typedef struct _REQ_SESSION_SETUP_ANDX {
+ UCHAR WordCount; // Count of parameter words = 10
+ UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
+ UCHAR AndXReserved; // Reserved (must be 0)
+ _USHORT( AndXOffset ); // Offset to next command WordCount
+ _USHORT( MaxBufferSize ); // Consumer's maximum buffer size
+ _USHORT( MaxMpxCount ); // Actual maximum multiplexed pending requests
+ _USHORT( VcNumber ); // 0 = first (only), nonzero=additional VC number
+ _ULONG( SessionKey ); // Session key (valid iff VcNumber != 0)
+ _USHORT( PasswordLength ); // Account password size
+ _ULONG( Reserved );
+ _USHORT( ByteCount ); // Count of data bytes; min = 0
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR AccountPassword[]; // Account Password
+ //UCHAR AccountName[]; // Account Name
+ //UCHAR PrimaryDomain[]; // Client's primary domain
+ //UCHAR NativeOS[]; // Client's native operating system
+ //UCHAR NativeLanMan[]; // Client's native LAN Manager type
+} REQ_SESSION_SETUP_ANDX;
+typedef REQ_SESSION_SETUP_ANDX SMB_UNALIGNED *PREQ_SESSION_SETUP_ANDX;
+
+typedef struct _REQ_NT_SESSION_SETUP_ANDX {
+ UCHAR WordCount; // Count of parameter words = 13
+ UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
+ UCHAR AndXReserved; // Reserved (must be 0)
+ _USHORT( AndXOffset ); // Offset to next command WordCount
+ _USHORT( MaxBufferSize ); // Consumer's maximum buffer size
+ _USHORT( MaxMpxCount ); // Actual maximum multiplexed pending requests
+ _USHORT( VcNumber ); // 0 = first (only), nonzero=additional VC number
+ _ULONG( SessionKey ); // Session key (valid iff VcNumber != 0)
+ _USHORT( CaseInsensitivePasswordLength ); // Account password size, ANSI
+ _USHORT( CaseSensitivePasswordLength ); // Account password size, Unicode
+ _ULONG( Reserved);
+ _ULONG( Capabilities ); // Client capabilities
+ _USHORT( ByteCount ); // Count of data bytes; min = 0
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR CaseInsensitivePassword[]; // Account Password, ANSI
+ //UCHAR CaseSensitivePassword[]; // Account Password, Unicode
+ //UCHAR AccountName[]; // Account Name
+ //UCHAR PrimaryDomain[]; // Client's primary domain
+ //UCHAR NativeOS[]; // Client's native operating system
+ //UCHAR NativeLanMan[]; // Client's native LAN Manager type
+} REQ_NT_SESSION_SETUP_ANDX;
+typedef REQ_NT_SESSION_SETUP_ANDX SMB_UNALIGNED *PREQ_NT_SESSION_SETUP_ANDX;
+
+#define SMB_SETUP_GUEST 0x0001 // Session setup as a guest
+#define SMB_SETUP_USE_LANMAN_KEY 0x0002 // Use the Lan Manager setup key.
+
+
+typedef struct _RESP_SESSION_SETUP_ANDX {
+ UCHAR WordCount; // Count of parameter words = 3
+ UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
+ UCHAR AndXReserved; // Reserved (must be 0)
+ _USHORT( AndXOffset ); // Offset to next command WordCount
+ _USHORT( Action ); // Request mode:
+ // bit0 = logged in as GUEST
+ _USHORT( ByteCount ); // Count of data bytes
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR NativeOS[]; // Server's native operating system
+ //UCHAR NativeLanMan[]; // Server's native LAN Manager type
+ //UCHAR PrimaryDomain[]; // Server's primary domain
+} RESP_SESSION_SETUP_ANDX;
+typedef RESP_SESSION_SETUP_ANDX SMB_UNALIGNED *PRESP_SESSION_SETUP_ANDX;
+
+#endif // def INCLUDE_SMB_ADMIN
+
+#ifdef INCLUDE_SMB_QUERY_SET
+
+//
+// Set Information SMB, see #1 page 19
+// Function is SrvSmbSetInformation()
+// SMB_COM_SET_INFORMATION 0x09
+//
+
+typedef struct _REQ_SET_INFORMATION {
+ UCHAR WordCount; // Count of parameter words = 8
+ _USHORT( FileAttributes );
+ _ULONG( LastWriteTimeInSeconds );
+ _USHORT( Reserved )[5]; // Reserved (must be 0)
+ _USHORT( ByteCount ); // Count of data bytes; min = 2
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR BufferFormat; // 0x04 -- ASCII
+ //UCHAR FileName[]; // File name
+} REQ_SET_INFORMATION;
+typedef REQ_SET_INFORMATION SMB_UNALIGNED *PREQ_SET_INFORMATION;
+
+typedef struct _RESP_SET_INFORMATION {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_SET_INFORMATION;
+typedef RESP_SET_INFORMATION SMB_UNALIGNED *PRESP_SET_INFORMATION;
+
+#endif // def INCLUDE_SMB_QUERY_SET
+
+#ifdef INCLUDE_SMB_QUERY_SET
+
+//
+// Set Information2 SMB, see #2 page 66
+// Function is SrvSmbSetInformation2
+// SMB_COM_SET_INFORMATION2 0x22
+//
+
+typedef struct _REQ_SET_INFORMATION2 {
+ UCHAR WordCount; // Count of parameter words = 7
+ _USHORT( Fid ); // File handle
+ SMB_DATE CreationDate;
+ SMB_TIME CreationTime;
+ SMB_DATE LastAccessDate;
+ SMB_TIME LastAccessTime;
+ SMB_DATE LastWriteDate;
+ SMB_TIME LastWriteTime;
+ _USHORT( ByteCount ); // Count of data bytes; min = 0
+ UCHAR Buffer[1]; // Reserved buffer
+} REQ_SET_INFORMATION2;
+typedef REQ_SET_INFORMATION2 SMB_UNALIGNED *PREQ_SET_INFORMATION2;
+
+typedef struct _RESP_SET_INFORMATION2 {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_SET_INFORMATION2;
+typedef RESP_SET_INFORMATION2 SMB_UNALIGNED *PRESP_SET_INFORMATION2;
+
+#endif // def INCLUDE_SMB_QUERY_SET
+
+#ifdef INCLUDE_SMB_TRANSACTION
+
+//
+// Transaction and Transaction2 SMBs, see #2 page 68 and #3 page 13
+// Function is SrvSmbTransaction()
+// SMB_COM_TRANSACTION 0x25
+// SMB_COM_TRANSACTION_SECONDARY 0x26
+// SMB_COM_TRANSACTION2 0x32
+// SMB_COM_TRANSACTION2_SECONDARY 0x33
+//
+// Structures for specific transaction types are defined in smbtrans.h.
+//
+// *** The Transaction2 secondary request format includes a USHORT Fid
+// field that we ignore. We can do this because the Fid field
+// occurs at the end of the word parameters part of the request, and
+// because the rest of the request (parameter and data bytes) is
+// pointed by offset fields occurring prior to the Fid field. (The
+// Fid field was added to speed up dispatching in the OS/2 server,
+// in which different worker processes handle each Fid. The NT
+// server has only one process.)
+//
+
+typedef struct _REQ_TRANSACTION {
+ UCHAR WordCount; // Count of parameter words; value = (14 + SetupCount)
+ _USHORT( TotalParameterCount ); // Total parameter bytes being sent
+ _USHORT( TotalDataCount ); // Total data bytes being sent
+ _USHORT( MaxParameterCount ); // Max parameter bytes to return
+ _USHORT( MaxDataCount ); // Max data bytes to return
+ UCHAR MaxSetupCount; // Max setup words to return
+ UCHAR Reserved;
+ _USHORT( Flags ); // Additional information:
+ // bit 0 - also disconnect TID in Tid
+ // bit 1 - one-way transacion (no resp)
+ _ULONG( Timeout );
+ _USHORT( Reserved2 );
+ _USHORT( ParameterCount ); // Parameter bytes sent this buffer
+ _USHORT( ParameterOffset ); // Offset (from header start) to params
+ _USHORT( DataCount ); // Data bytes sent this buffer
+ _USHORT( DataOffset ); // Offset (from header start) to data
+ UCHAR SetupCount; // Count of setup words
+ UCHAR Reserved3; // Reserved (pad above to word)
+ UCHAR Buffer[1]; // Buffer containing:
+ //USHORT Setup[]; // Setup words (# = SetupWordCount)
+ //USHORT ByteCount; // Count of data bytes
+ //UCHAR Name[]; // Name of transaction (NULL if Transact2)
+ //UCHAR Pad[]; // Pad to SHORT or LONG
+ //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount)
+ //UCHAR Pad1[]; // Pad to SHORT or LONG
+ //UCHAR Data[]; // Data bytes (# = DataCount)
+} REQ_TRANSACTION;
+typedef REQ_TRANSACTION SMB_UNALIGNED *PREQ_TRANSACTION;
+
+#define SMB_TRANSACTION_DISCONNECT 1
+#define SMB_TRANSACTION_NO_RESPONSE 2
+#define SMB_TRANSACTION_RECONNECTING 4
+#define SMB_TRANSACTION_DFSFILE 8
+
+typedef struct _RESP_TRANSACTION_INTERIM {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_TRANSACTION_INTERIM;
+typedef RESP_TRANSACTION_INTERIM SMB_UNALIGNED *PRESP_TRANSACTION_INTERIM;
+
+typedef struct _REQ_TRANSACTION_SECONDARY {
+ UCHAR WordCount; // Count of parameter words = 8
+ _USHORT( TotalParameterCount ); // Total parameter bytes being sent
+ _USHORT( TotalDataCount ); // Total data bytes being sent
+ _USHORT( ParameterCount ); // Parameter bytes sent this buffer
+ _USHORT( ParameterOffset ); // Offset (from header start) to params
+ _USHORT( ParameterDisplacement ); // Displacement of these param bytes
+ _USHORT( DataCount ); // Data bytes sent this buffer
+ _USHORT( DataOffset ); // Offset (from header start) to data
+ _USHORT( DataDisplacement ); // Displacement of these data bytes
+ _USHORT( ByteCount ); // Count of data bytes
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR Pad[]; // Pad to SHORT or LONG
+ //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount)
+ //UCHAR Pad1[]; // Pad to SHORT or LONG
+ //UCHAR Data[]; // Data bytes (# = DataCount)
+} REQ_TRANSACTION_SECONDARY;
+typedef REQ_TRANSACTION_SECONDARY SMB_UNALIGNED *PREQ_TRANSACTION_SECONDARY;
+
+typedef struct _RESP_TRANSACTION {
+ UCHAR WordCount; // Count of data bytes; value = 10 + SetupCount
+ _USHORT( TotalParameterCount ); // Total parameter bytes being sent
+ _USHORT( TotalDataCount ); // Total data bytes being sent
+ _USHORT( Reserved );
+ _USHORT( ParameterCount ); // Parameter bytes sent this buffer
+ _USHORT( ParameterOffset ); // Offset (from header start) to params
+ _USHORT( ParameterDisplacement ); // Displacement of these param bytes
+ _USHORT( DataCount ); // Data bytes sent this buffer
+ _USHORT( DataOffset ); // Offset (from header start) to data
+ _USHORT( DataDisplacement ); // Displacement of these data bytes
+ UCHAR SetupCount; // Count of setup words
+ UCHAR Reserved2; // Reserved (pad above to word)
+ UCHAR Buffer[1]; // Buffer containing:
+ //USHORT Setup[]; // Setup words (# = SetupWordCount)
+ //USHORT ByteCount; // Count of data bytes
+ //UCHAR Pad[]; // Pad to SHORT or LONG
+ //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount)
+ //UCHAR Pad1[]; // Pad to SHORT or LONG
+ //UCHAR Data[]; // Data bytes (# = DataCount)
+} RESP_TRANSACTION;
+typedef RESP_TRANSACTION SMB_UNALIGNED *PRESP_TRANSACTION;
+
+typedef struct _REQ_NT_TRANSACTION {
+ UCHAR WordCount; // Count of parameter words; value = (19 + SetupCount)
+ UCHAR MaxSetupCount; // Max setup words to return
+ _USHORT( Flags ); // Currently unused
+ _ULONG( TotalParameterCount ); // Total parameter bytes being sent
+ _ULONG( TotalDataCount ); // Total data bytes being sent
+ _ULONG( MaxParameterCount ); // Max parameter bytes to return
+ _ULONG( MaxDataCount ); // Max data bytes to return
+ _ULONG( ParameterCount ); // Parameter bytes sent this buffer
+ _ULONG( ParameterOffset ); // Offset (from header start) to params
+ _ULONG( DataCount ); // Data bytes sent this buffer
+ _ULONG( DataOffset ); // Offset (from header start) to data
+ UCHAR SetupCount; // Count of setup words
+ _USHORT( Function ); // The transaction function code
+ UCHAR Buffer[1];
+ //USHORT Setup[]; // Setup words (# = SetupWordCount)
+ //USHORT ByteCount; // Count of data bytes
+ //UCHAR Pad1[]; // Pad to LONG
+ //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount)
+ //UCHAR Pad2[]; // Pad to LONG
+ //UCHAR Data[]; // Data bytes (# = DataCount)
+} REQ_NT_TRANSACTION;
+typedef REQ_NT_TRANSACTION SMB_UNALIGNED *PREQ_NT_TRANSACTION;
+
+#define SMB_TRANSACTION_DISCONNECT 1
+#define SMB_TRANSACTION_NO_RESPONSE 2
+
+typedef struct _RESP_NT_TRANSACTION_INTERIM {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1];
+} RESP_NT_TRANSACTION_INTERIM;
+typedef RESP_NT_TRANSACTION_INTERIM SMB_UNALIGNED *PRESP_NT_TRANSACTION_INTERIM;
+
+typedef struct _REQ_NT_TRANSACTION_SECONDARY {
+ UCHAR WordCount; // Count of parameter words = 18
+ UCHAR Reserved1; // MBZ
+ _USHORT( Reserved2 ); // MBZ
+ _ULONG( TotalParameterCount ); // Total parameter bytes being sent
+ _ULONG( TotalDataCount ); // Total data bytes being sent
+ _ULONG( ParameterCount ); // Parameter bytes sent this buffer
+ _ULONG( ParameterOffset ); // Offset (from header start) to params
+ _ULONG( ParameterDisplacement ); // Displacement of these param bytes
+ _ULONG( DataCount ); // Data bytes sent this buffer
+ _ULONG( DataOffset ); // Offset (from header start) to data
+ _ULONG( DataDisplacement ); // Displacement of these data bytes
+ UCHAR Reserved3;
+ _USHORT( ByteCount ); // Count of data bytes
+ UCHAR Buffer[1];
+ //UCHAR Pad1[]; // Pad to LONG
+ //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount)
+ //UCHAR Pad2[]; // Pad to LONG
+ //UCHAR Data[]; // Data bytes (# = DataCount)
+} REQ_NT_TRANSACTION_SECONDARY;
+typedef REQ_NT_TRANSACTION_SECONDARY SMB_UNALIGNED *PREQ_NT_TRANSACTION_SECONDARY;
+
+typedef struct _RESP_NT_TRANSACTION {
+ UCHAR WordCount; // Count of data bytes; value = 18 + SetupCount
+ UCHAR Reserved1;
+ _USHORT( Reserved2 );
+ _ULONG( TotalParameterCount ); // Total parameter bytes being sent
+ _ULONG( TotalDataCount ); // Total data bytes being sent
+ _ULONG( ParameterCount ); // Parameter bytes sent this buffer
+ _ULONG( ParameterOffset ); // Offset (from header start) to params
+ _ULONG( ParameterDisplacement ); // Displacement of these param bytes
+ _ULONG( DataCount ); // Data bytes sent this buffer
+ _ULONG( DataOffset ); // Offset (from header start) to data
+ _ULONG( DataDisplacement ); // Displacement of these data bytes
+ UCHAR SetupCount; // Count of setup words
+ UCHAR Buffer[1];
+ //USHORT Setup[]; // Setup words (# = SetupWordCount)
+ //USHORT ByteCount; // Count of data bytes
+ //UCHAR Pad1[]; // Pad to LONG
+ //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount)
+ //UCHAR Pad2[]; // Pad to SHORT or LONG
+ //UCHAR Data[]; // Data bytes (# = DataCount)
+} RESP_NT_TRANSACTION;
+typedef RESP_NT_TRANSACTION SMB_UNALIGNED *PRESP_NT_TRANSACTION;
+
+#endif // def INCLUDE_SMB_TRANSACTION
+
+#ifdef INCLUDE_SMB_TREE
+
+//
+// Tree Connect SMB, see #1, page 6
+// Function is SrvSmbTreeConnect()
+// SMB_COM_TREE_CONNECT 0x70
+//
+
+typedef struct _REQ_TREE_CONNECT {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes; min = 4
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR BufferFormat1; // 0x04 -- ASCII
+ //UCHAR Path[]; // Server name and share name
+ //UCHAR BufferFormat2; // 0x04 -- ASCII
+ //UCHAR Password[]; // Password
+ //UCHAR BufferFormat3; // 0x04 -- ASCII
+ //UCHAR Service[]; // Service name
+} REQ_TREE_CONNECT;
+typedef REQ_TREE_CONNECT SMB_UNALIGNED *PREQ_TREE_CONNECT;
+
+typedef struct _RESP_TREE_CONNECT {
+ UCHAR WordCount; // Count of parameter words = 2
+ _USHORT( MaxBufferSize ); // Max size message the server handles
+ _USHORT( Tid ); // Tree ID
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_TREE_CONNECT;
+typedef RESP_TREE_CONNECT SMB_UNALIGNED *PRESP_TREE_CONNECT;
+
+#endif // def INCLUDE_SMB_TREE
+
+#ifdef INCLUDE_SMB_TREE
+
+//
+// Tree Connect and X SMB, see #2, page 88
+// Function is SrvSmbTreeConnectAndX()
+// SMB_COM_TREE_CONNECT_ANDX 0x75
+//
+
+typedef struct _REQ_TREE_CONNECT_ANDX {
+ UCHAR WordCount; // Count of parameter words = 4
+ UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
+ UCHAR AndXReserved; // Reserved (must be 0)
+ _USHORT( AndXOffset ); // Offset to next command WordCount
+ _USHORT( Flags ); // Additional information
+ // bit 0 set = disconnect Tid
+ _USHORT( PasswordLength ); // Length of Password[]
+ _USHORT( ByteCount ); // Count of data bytes; min = 3
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR Password[]; // Password
+ //UCHAR Path[]; // Server name and share name
+ //UCHAR Service[]; // Service name
+} REQ_TREE_CONNECT_ANDX;
+typedef REQ_TREE_CONNECT_ANDX SMB_UNALIGNED *PREQ_TREE_CONNECT_ANDX;
+
+typedef struct _RESP_TREE_CONNECT_ANDX {
+ UCHAR WordCount; // Count of parameter words = 2
+ UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
+ UCHAR AndXReserved; // Reserved (must be 0)
+ _USHORT( AndXOffset ); // Offset to next command WordCount
+ _USHORT( ByteCount ); // Count of data bytes; min = 3
+ UCHAR Buffer[1]; // Service type connected to
+} RESP_TREE_CONNECT_ANDX;
+typedef RESP_TREE_CONNECT_ANDX SMB_UNALIGNED *PRESP_TREE_CONNECT_ANDX;
+
+//
+// The response for clients that are LAN Manager 2.1 or better.
+//
+
+typedef struct _RESP_21_TREE_CONNECT_ANDX {
+ UCHAR WordCount; // Count of parameter words = 3
+ UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
+ UCHAR AndXReserved; // Reserved (must be 0)
+ _USHORT( AndXOffset ); // Offset to next command WordCount
+ _USHORT( OptionalSupport ); // Optional support bits
+ _USHORT( ByteCount ); // Count of data bytes; min = 3
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR Service[]; // Service type connected to
+ //UCHAR NativeFileSystem[]; // Native file system for this tree
+} RESP_21_TREE_CONNECT_ANDX;
+typedef RESP_21_TREE_CONNECT_ANDX SMB_UNALIGNED *PRESP_21_TREE_CONNECT_ANDX;
+
+#define SMB_SUPPORT_SEARCH_BITS 1
+#define SMB_SHARE_IS_IN_DFS 2
+
+#endif // def INCLUDE_SMB_TREE
+
+#ifdef INCLUDE_SMB_TREE
+
+//
+// Tree Disconnect SMB, see #1 page 7
+// Function is SrvSmbTreeDisconnect()
+// SMB_COM_TREE_DISCONNECT 0x71
+//
+
+typedef struct _REQ_TREE_DISCONNECT {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} REQ_TREE_DISCONNECT;
+typedef REQ_TREE_DISCONNECT SMB_UNALIGNED *PREQ_TREE_DISCONNECT;
+
+typedef struct _RESP_TREE_DISCONNECT {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_TREE_DISCONNECT;
+typedef RESP_TREE_DISCONNECT SMB_UNALIGNED *PRESP_TREE_DISCONNECT;
+
+#endif // def INCLUDE_SMB_TREE
+
+#ifdef INCLUDE_SMB_LOCK
+
+//
+// Unlock Byte Range SMB, see #1 page 20
+// Function is SrvSmbUnlockByteRange()
+// SMB_COM_UNLOCK_BYTE_RANGE 0x0D
+//
+
+typedef struct _REQ_UNLOCK_BYTE_RANGE {
+ UCHAR WordCount; // Count of parameter words = 5
+ _USHORT( Fid ); // File handle
+ _ULONG( Count ); // Count of bytes to unlock
+ _ULONG( Offset ); // Offset from start of file
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} REQ_UNLOCK_BYTE_RANGE;
+typedef REQ_UNLOCK_BYTE_RANGE SMB_UNALIGNED *PREQ_UNLOCK_BYTE_RANGE;
+
+typedef struct _RESP_UNLOCK_BYTE_RANGE {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_UNLOCK_BYTE_RANGE;
+typedef RESP_UNLOCK_BYTE_RANGE SMB_UNALIGNED *PRESP_UNLOCK_BYTE_RANGE;
+
+#endif // def INCLUDE_SMB_LOCK
+
+#ifdef INCLUDE_SMB_READ_WRITE
+
+//
+// Write SMB, see #1 page 12
+// Write and Unlock SMB, see #2 page 92
+// Function is SrvSmbWrite()
+// SMB_COM_WRITE 0x0B
+// SMB_COM_WRITE_AND_UNLOCK 0x14
+//
+
+//
+// *** Warning: the following structure is defined the way it is to
+// ensure longword alignment of the data buffer. (This only matters
+// when packing is disabled; when packing is turned on, the right
+// thing happens no matter what.)
+//
+
+typedef struct _REQ_WRITE {
+ UCHAR WordCount; // Count of parameter words = 5
+ _USHORT( Fid ); // File handle
+ _USHORT( Count ); // Number of bytes to be written
+ _ULONG( Offset ); // Offset in file to begin write
+ _USHORT( Remaining ); // Bytes remaining to satisfy request
+ _USHORT( ByteCount ); // Count of data bytes
+ //UCHAR Buffer[1]; // Buffer containing:
+ UCHAR BufferFormat; // 0x01 -- Data block
+ _USHORT( DataLength ); // Length of data
+ ULONG Buffer[1]; // Data
+} REQ_WRITE;
+typedef REQ_WRITE SMB_UNALIGNED *PREQ_WRITE;
+
+typedef struct _RESP_WRITE {
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( Count ); // Count of bytes actually written
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_WRITE;
+typedef RESP_WRITE SMB_UNALIGNED *PRESP_WRITE;
+
+#endif // def INCLUDE_SMB_READ_WRITE
+
+#ifdef INCLUDE_SMB_READ_WRITE
+
+//
+// Write and Close SMB, see #2 page 90
+// Function is SrvSmbWriteAndClose()
+// SMB_COM_WRITE_AND_CLOSE 0x2C
+//
+
+//
+// The Write and Close parameters can be 6 words long or 12 words long,
+// depending on whether it's supposed to look like a Write SMB or a
+// Write and X SMB. So we define two different structures here.
+//
+// *** Warning: the following structures are defined the way they are to
+// ensure longword alignment of the data buffer. (This only matters
+// when packing is disabled; when packing is turned on, the right
+// thing happens no matter what.)
+//
+
+typedef struct _REQ_WRITE_AND_CLOSE {
+ UCHAR WordCount; // Count of parameter words = 6
+ _USHORT( Fid ); // File handle
+ _USHORT( Count ); // Number of bytes to write
+ _ULONG( Offset ); // Offset in file of first byte to write
+ _ULONG( LastWriteTimeInSeconds ); // Time of last write
+ _USHORT( ByteCount ); // 1 (for pad) + value of Count
+ UCHAR Pad; // To force to doubleword boundary
+ ULONG Buffer[1]; // Data
+} REQ_WRITE_AND_CLOSE;
+typedef REQ_WRITE_AND_CLOSE SMB_UNALIGNED *PREQ_WRITE_AND_CLOSE;
+
+typedef struct _REQ_WRITE_AND_CLOSE_LONG {
+ UCHAR WordCount; // Count of parameter words = 12
+ _USHORT( Fid ); // File handle
+ _USHORT( Count ); // Number of bytes to write
+ _ULONG( Offset ); // Offset in file of first byte to write
+ _ULONG( LastWriteTimeInSeconds ); // Time of last write
+ _ULONG( Reserved )[3]; // Reserved, must be 0
+ _USHORT( ByteCount ); // 1 (for pad) + value of Count
+ UCHAR Pad; // To force to doubleword boundary
+ ULONG Buffer[1]; // Data
+} REQ_WRITE_AND_CLOSE_LONG;
+typedef REQ_WRITE_AND_CLOSE_LONG SMB_UNALIGNED *PREQ_WRITE_AND_CLOSE_LONG;
+
+typedef struct _RESP_WRITE_AND_CLOSE {
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( Count ); // Count of bytes actually written
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_WRITE_AND_CLOSE;
+typedef RESP_WRITE_AND_CLOSE SMB_UNALIGNED *PRESP_WRITE_AND_CLOSE;
+
+#endif // def INCLUDE_SMB_READ_WRITE
+
+#ifdef INCLUDE_SMB_READ_WRITE
+
+//
+// Write and X SMB, see #2 page 94
+// Function is SrvSmbWriteAndX()
+// SMB_COM_WRITE_ANDX 0x2F
+//
+
+typedef struct _REQ_WRITE_ANDX {
+ UCHAR WordCount; // Count of parameter words = 12
+ UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
+ UCHAR AndXReserved; // Reserved (must be 0)
+ _USHORT( AndXOffset ); // Offset to next command WordCount
+ _USHORT( Fid ); // File handle
+ _ULONG( Offset ); // Offset in file to begin write
+ _ULONG( Timeout );
+ _USHORT( WriteMode ); // Write mode:
+ // 0 - write through
+ // 1 - return Remaining
+ // 2 - use WriteRawNamedPipe (n. pipes)
+ // 3 - "this is the start of the msg"
+ _USHORT( Remaining ); // Bytes remaining to satisfy request
+ _USHORT( Reserved );
+ _USHORT( DataLength ); // Number of data bytes in buffer (>=0)
+ _USHORT( DataOffset ); // Offset to data bytes
+ _USHORT( ByteCount ); // Count of data bytes
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR Pad[]; // Pad to SHORT or LONG
+ //UCHAR Data[]; // Data (# = DataLength)
+} REQ_WRITE_ANDX;
+typedef REQ_WRITE_ANDX SMB_UNALIGNED *PREQ_WRITE_ANDX;
+
+typedef struct _REQ_NT_WRITE_ANDX {
+ UCHAR WordCount; // Count of parameter words = 14
+ UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
+ UCHAR AndXReserved; // Reserved (must be 0)
+ _USHORT( AndXOffset ); // Offset to next command WordCount
+ _USHORT( Fid ); // File handle
+ _ULONG( Offset ); // Offset in file to begin write
+ _ULONG( Timeout );
+ _USHORT( WriteMode ); // Write mode:
+ // 0 - write through
+ // 1 - return Remaining
+ // 2 - use WriteRawNamedPipe (n. pipes)
+ // 3 - "this is the start of the msg"
+ _USHORT( Remaining ); // Bytes remaining to satisfy request
+ _USHORT( Reserved );
+ _USHORT( DataLength ); // Number of data bytes in buffer (>=0)
+ _USHORT( DataOffset ); // Offset to data bytes
+ _ULONG( OffsetHigh ); // Used for NT Protocol only
+ // Upper 32 bits of offset
+ _USHORT( ByteCount ); // Count of data bytes
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR Pad[]; // Pad to SHORT or LONG
+ //UCHAR Data[]; // Data (# = DataLength)
+} REQ_NT_WRITE_ANDX;
+typedef REQ_NT_WRITE_ANDX SMB_UNALIGNED *PREQ_NT_WRITE_ANDX;
+
+typedef struct _RESP_WRITE_ANDX {
+ UCHAR WordCount; // Count of parameter words = 6
+ UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
+ UCHAR AndXReserved; // Reserved (must be 0)
+ _USHORT( AndXOffset ); // Offset to next command WordCount
+ _USHORT( Count ); // Number of bytes written
+ _USHORT( Remaining ); // Bytes remaining to be read (pipe/dev)
+ _ULONG( Reserved );
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_WRITE_ANDX;
+typedef RESP_WRITE_ANDX SMB_UNALIGNED *PRESP_WRITE_ANDX;
+
+#endif // def INCLUDE_SMB_READ_WRITE
+
+#ifdef INCLUDE_SMB_MPX
+
+//
+// Write Block Multiplexed SMB, see #2 page 97
+// Function is SrvSmbWriteMpx()
+// SMB_COM_WRITE_MPX 0x1E
+// SMB_COM_WRITE_MPX_SECONDARY 0x1F
+// SMB_COM_WRITE_MPX_COMPLETE 0x20
+//
+
+typedef struct _REQ_WRITE_MPX {
+ UCHAR WordCount; // Count of parameter words = 12
+ _USHORT( Fid ); // File handle
+ _USHORT( Count ); // Total bytes, including this buffer
+ _USHORT( Reserved );
+ _ULONG( Offset ); // Offset in file to begin write
+ _ULONG( Timeout );
+ _USHORT( WriteMode ); // Write mode:
+ // bit 0 - complete write to disk and
+ // send final result response
+ // bit 1 - return Remaining (pipe/dev)
+ // bit 7 - IPX datagram mode
+ union {
+ struct {
+ _USHORT( DataCompactionMode );
+ _USHORT( Reserved2 );
+ } ;
+ _ULONG( Mask ); // IPX datagram mode mask
+ } ;
+ _USHORT( DataLength ); // Number of data bytes this buffer
+ _USHORT( DataOffset ); // Offset (from header start) to data
+ _USHORT( ByteCount ); // Count of data bytes
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR Pad[]; // Pad to SHORT or LONG
+ //UCHAR Data[]; // Data (# = DataLength)
+} REQ_WRITE_MPX;
+typedef REQ_WRITE_MPX SMB_UNALIGNED *PREQ_WRITE_MPX;
+
+typedef struct _RESP_WRITE_MPX_INTERIM { // First response
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( Remaining ); // Bytes ramaining to be read (pipe/dev)
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_WRITE_MPX_INTERIM;
+typedef RESP_WRITE_MPX_INTERIM SMB_UNALIGNED *PRESP_WRITE_MPX_INTERIM;
+
+typedef struct _RESP_WRITE_MPX_DATAGRAM { // Response to sequenced request
+ UCHAR WordCount; // Count of parameter words = 2
+ _ULONG( Mask ); // OR of all masks received
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_WRITE_MPX_DATAGRAM;
+typedef RESP_WRITE_MPX_DATAGRAM SMB_UNALIGNED *PRESP_WRITE_MPX_DATAGRAM;
+
+// Secondary request format, 0 to N of these.
+
+typedef struct _REQ_WRITE_MPX_SECONDARY {
+ UCHAR WordCount; // Count of parameter words = 8
+ _USHORT( Fid ); // File handle
+ _USHORT( Count ); // Total bytes to be sent
+ _ULONG( Offset ); // Offset in file to begin write
+ _ULONG( Reserved );
+ _USHORT( DataLength ); // Number of data bytes this buffer
+ _USHORT( DataOffset ); // Offset (from header start) to data
+ _USHORT( ByteCount ); // Count of data bytes
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR Pad[]; // Pad to SHORT or LONG
+ //UCHAR Data[]; // Data (# = DataLength)
+} REQ_WRITE_MPX_SECONDARY;
+typedef REQ_WRITE_MPX_SECONDARY SMB_UNALIGNED *PREQ_WRITE_MPX_SECONDARY;
+
+#endif // def INCLUDE_SMB_MPX
+
+#ifndef INCLUDE_SMB_WRITE_COMPLETE
+#ifdef INCLUDE_SMB_MPX
+#define INCLUDE_SMB_WRITE_COMPLETE
+#else
+#ifdef INCLUDE_SMB_RAW
+#define INCLUDE_SMB_WRITE_COMPLETE
+#endif
+#endif
+#endif
+
+#ifdef INCLUDE_SMB_WRITE_COMPLETE
+
+//
+// The following structure is used as the final response to both Write
+// Block Multiplexed and Write Block Raw.
+//
+
+typedef struct _RESP_WRITE_COMPLETE { // Final response; command is
+ // SMB_COM_WRITE_COMPLETE
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( Count ); // Total number of bytes written
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_WRITE_COMPLETE;
+typedef RESP_WRITE_COMPLETE SMB_UNALIGNED *PRESP_WRITE_COMPLETE;
+
+#endif // def INCLUDE_SMB_WRITE_COMPLETE
+
+#ifdef INCLUDE_SMB_READ_WRITE
+
+//
+// Write Print File SMB, see #1 page 29
+// Function is SrvSmbWritePrintFile()
+// SMB_COM_WRITE_PRINT_FILE 0xC1
+//
+
+typedef struct _REQ_WRITE_PRINT_FILE {
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( Fid ); // File handle
+ _USHORT( ByteCount ); // Count of data bytes; min = 4
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR BufferFormat; // 0x01 -- Data block
+ //USHORT DataLength; // Length of data
+ //UCHAR Data[]; // Data
+} REQ_WRITE_PRINT_FILE;
+typedef REQ_WRITE_PRINT_FILE SMB_UNALIGNED *PREQ_WRITE_PRINT_FILE;
+
+typedef struct _RESP_WRITE_PRINT_FILE {
+ UCHAR WordCount; // Count of parameter words = 0
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_WRITE_PRINT_FILE;
+typedef RESP_WRITE_PRINT_FILE SMB_UNALIGNED *PRESP_WRITE_PRINT_FILE;
+
+#endif // def INCLUDE_SMB_READ_WRITE
+
+#ifdef INCLUDE_SMB_RAW
+
+//
+// Write Block Raw SMB, see #2 page 100
+// Function is SrvSmbWriteRaw()
+// SMB_COM_WRITE_RAW 0x1D
+//
+
+typedef struct _REQ_WRITE_RAW {
+ UCHAR WordCount; // Count of parameter words = 12
+ _USHORT( Fid ); // File handle
+ _USHORT( Count ); // Total bytes, including this buffer
+ _USHORT( Reserved );
+ _ULONG( Offset ); // Offset in file to begin write
+ _ULONG( Timeout );
+ _USHORT( WriteMode ); // Write mode:
+ // bit 0 - complete write to disk and
+ // send final result response
+ // bit 1 - return Remaining (pipe/dev)
+ // (see WriteAndX for #defines)
+ _ULONG( Reserved2 );
+ _USHORT( DataLength ); // Number of data bytes this buffer
+ _USHORT( DataOffset ); // Offset (from header start) to data
+ _USHORT( ByteCount ); // Count of data bytes
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR Pad[]; // Pad to SHORT or LONG
+ //UCHAR Data[]; // Data (# = DataLength)
+} REQ_WRITE_RAW;
+typedef REQ_WRITE_RAW SMB_UNALIGNED *PREQ_WRITE_RAW;
+
+typedef struct _REQ_NT_WRITE_RAW {
+ UCHAR WordCount; // Count of parameter words = 14
+ _USHORT( Fid ); // File handle
+ _USHORT( Count ); // Total bytes, including this buffer
+ _USHORT( Reserved );
+ _ULONG( Offset ); // Offset in file to begin write
+ _ULONG( Timeout );
+ _USHORT( WriteMode ); // Write mode:
+ // bit 0 - complete write to disk and
+ // send final result response
+ // bit 1 - return Remaining (pipe/dev)
+ // (see WriteAndX for #defines)
+ _ULONG( Reserved2 );
+ _USHORT( DataLength ); // Number of data bytes this buffer
+ _USHORT( DataOffset ); // Offset (from header start) to data
+ _ULONG( OffsetHigh ); // Used for NT Protocol only
+ // Upper 32 bits of offset
+ _USHORT( ByteCount ); // Count of data bytes
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR Pad[]; // Pad to SHORT or LONG
+ //UCHAR Data[]; // Data (# = DataLength)
+} REQ_NT_WRITE_RAW;
+typedef REQ_NT_WRITE_RAW SMB_UNALIGNED *PREQ_NT_WRITE_RAW;
+
+typedef struct _RESP_WRITE_RAW_INTERIM { // First response
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( Remaining ); // Bytes remaining to be read (pipe/dev)
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_WRITE_RAW_INTERIM;
+typedef RESP_WRITE_RAW_INTERIM SMB_UNALIGNED *PRESP_WRITE_RAW_INTERIM;
+
+typedef struct _RESP_WRITE_RAW_SECONDARY { // Second (final) response
+ UCHAR WordCount; // Count of parameter words = 1
+ _USHORT( Count ); // Total number of bytes written
+ _USHORT( ByteCount ); // Count of data bytes = 0
+ UCHAR Buffer[1]; // empty
+} RESP_WRITE_RAW_SECONDARY;
+typedef RESP_WRITE_RAW_SECONDARY SMB_UNALIGNED *PRESP_WRITE_RAW_SECONDARY;
+
+typedef struct _REQ_103_WRITE_RAW {
+ UCHAR WordCount; // Count of parameter words
+ _USHORT( Fid ); // File handle
+ _USHORT( Count );
+ _USHORT( Reserved );
+ _ULONG( Offset );
+ _ULONG( Timeout );
+ _USHORT( WriteMode );
+ _ULONG( Reserved2 );
+ _USHORT( ByteCount ); // Count of data bytes; min =
+ UCHAR Buffer[1]; //
+} REQ_103_WRITE_RAW;
+typedef REQ_103_WRITE_RAW SMB_UNALIGNED *PREQ_103_WRITE_RAW;
+
+typedef struct _RESP_103_WRITE_RAW {
+ UCHAR WordCount; // Count of parameter words
+ _USHORT( ByteCount ); // Count of data bytes; min =
+ UCHAR Buffer[1]; //
+} RESP_103_WRITE_RAW;
+typedef RESP_103_WRITE_RAW SMB_UNALIGNED *PRESP_103_WRITE_RAW;
+
+#endif // def INCLUDE_SMB_RAW
+
+typedef struct _REQ_NT_CANCEL {
+ UCHAR WordCount; // = 0
+ _USHORT( ByteCount ); // = 0
+ UCHAR Buffer[1];
+} REQ_NT_CANCEL;
+typedef REQ_NT_CANCEL SMB_UNALIGNED *PREQ_NT_CANCEL;
+
+typedef struct _RESP_NT_CANCEL {
+ UCHAR WordCount; // = 0
+ _USHORT( ByteCount ); // = 0
+ UCHAR Buffer[1];
+} RESP_NT_CANCEL;
+typedef RESP_NT_CANCEL SMB_UNALIGNED *PRESP_NT_CANCEL;
+
+//
+// File open modes
+//
+
+#define SMB_ACCESS_READ_ONLY 0
+#define SMB_ACCESS_WRITE_ONLY 1
+#define SMB_ACCESS_READ_WRITE 2
+#define SMB_ACCESS_EXECUTE 3
+
+//
+// Open flags
+//
+
+#define SMB_OPEN_QUERY_INFORMATION 0x01
+#define SMB_OPEN_OPLOCK 0x02
+#define SMB_OPEN_OPBATCH 0x04
+#define SMB_OPEN_QUERY_EA_LENGTH 0x08
+
+//
+// NT open manifests
+//
+
+#define NT_CREATE_REQUEST_OPLOCK 0x02
+#define NT_CREATE_REQUEST_OPBATCH 0x04
+#define NT_CREATE_OPEN_TARGET_DIR 0x08
+
+#define Added 0
+#define Removed 1
+#define Modified 2
+#define RenamedOldName 3
+#define RenamedNewName 4
+
+//
+// Lockrange for use with OS/2 DosFileLocks call
+//
+
+// *** Where is this used?
+
+//typedef struct lockrange {
+// ULONG offset;
+// ULONG range;
+// };
+
+//#define LOCK 0x1
+//#define UNLOCK 0x2
+
+//
+// Data buffer format codes, from the core protocol.
+//
+
+#define SMB_FORMAT_DATA 1
+#define SMB_FORMAT_DIALECT 2
+#define SMB_FORMAT_PATHNAME 3
+#define SMB_FORMAT_ASCII 4
+#define SMB_FORMAT_VARIABLE 5
+
+//
+// WriteMode flags
+//
+
+#define SMB_WMODE_WRITE_THROUGH 0x0001 // complete write before responding
+#define SMB_WMODE_SET_REMAINING 0x0002 // returning amt remaining in pipe
+#define SMB_WMODE_WRITE_RAW_NAMED_PIPE 0x0004 // write named pipe in raw mode
+#define SMB_WMODE_START_OF_MESSAGE 0x0008 // start of pipe message
+#define SMB_WMODE_DATAGRAM 0x0080 // start of pipe message
+
+//
+// Various SMB flags:
+//
+
+//
+// If the server supports LockAndRead and WriteAndUnlock, it sets this
+// bit the Negotiate response.
+//
+
+#define SMB_FLAGS_LOCK_AND_READ_OK 0x01
+
+//
+// When on, the consumer guarantees that there is a receive buffer posted
+// such that a "Send.No.Ack" can be used by the server to respond to
+// the consumer's request.
+//
+
+#define SMB_FLAGS_SEND_NO_ACK 0x2
+
+//
+// This is part of the Flags field of every SMB header. If this bit
+// is set, then all pathnames in the SMB should be treated as case-
+// insensitive.
+//
+
+#define SMB_FLAGS_CASE_INSENSITIVE 0x8
+
+//
+// When on in session setup, this bit indicates that all paths sent to
+// the server are already in OS/2 canonicalized format.
+//
+
+#define SMB_FLAGS_CANONICALIZED_PATHS 0x10
+
+//
+// When on in a open file request SMBs (open, create, openX, etc.) this
+// bit indicates a request for an oplock on the file. When on in the
+// response, this bit indicates that the oplock was granted.
+//
+
+#define SMB_FLAGS_OPLOCK 0x20
+
+//
+// When on, this bit indicates that the server should notify the client
+// on any request that could cause the file to be changed. If not set,
+// the server only notifies the client on other open requests on the
+// file.
+//
+
+#define SMB_FLAGS_OPLOCK_NOTIFY_ANY 0x40
+
+//
+// This bit indicates that the SMB is being sent from server to redir.
+//
+
+#define SMB_FLAGS_SERVER_TO_REDIR 0x80
+
+//
+// Valid bits for Flags on an incoming SMB
+//
+
+#define INCOMING_SMB_FLAGS \
+ (SMB_FLAGS_LOCK_AND_READ_OK | \
+ SMB_FLAGS_SEND_NO_ACK | \
+ SMB_FLAGS_CASE_INSENSITIVE | \
+ SMB_FLAGS_CANONICALIZED_PATHS | \
+ SMB_FLAGS_OPLOCK_NOTIFY_ANY | \
+ SMB_FLAGS_OPLOCK)
+
+//
+// Names for bits in Flags2 field of SMB header that indicate what the
+// client app is aware of.
+//
+
+#define SMB_FLAGS2_KNOWS_LONG_NAMES 0x0001
+#define SMB_FLAGS2_KNOWS_EAS 0x0002
+#define SMB_FLAGS2_IS_LONG_NAME 0x0040
+#define SMB_FLAGS2_DFS 0x1000
+#define SMB_FLAGS2_PAGING_IO 0x2000
+#define SMB_FLAGS2_NT_STATUS 0x4000
+#define SMB_FLAGS2_UNICODE 0x8000
+
+//
+// Valid bits for Flags2 on an incoming SMB
+//
+
+#define INCOMING_SMB_FLAGS2 \
+ (SMB_FLAGS2_KNOWS_LONG_NAMES | \
+ SMB_FLAGS2_KNOWS_EAS | \
+ SMB_FLAGS2_DFS | \
+ SMB_FLAGS2_PAGING_IO | \
+ SMB_FLAGS2_IS_LONG_NAME | \
+ SMB_FLAGS2_NT_STATUS | \
+ SMB_FLAGS2_UNICODE )
+
+//
+// The SMB open function determines what action should be taken depending
+// on the existence or lack thereof of files used in the operation. It
+// has the following mapping:
+//
+// 1111 1
+// 5432 1098 7654 3210
+// rrrr rrrr rrrC rrOO
+//
+// where:
+//
+// O - Open (action to be taken if the target file exists)
+// 0 - Fail
+// 1 - Open or Append file
+// 2 - Truncate file
+//
+// C - Create (action to be taken if the target file does not exist)
+// 0 - Fail
+// 1 - Create file
+//
+
+#define SMB_OFUN_OPEN_MASK 0x3
+#define SMB_OFUN_CREATE_MASK 0x10
+
+#define SMB_OFUN_OPEN_FAIL 0
+#define SMB_OFUN_OPEN_APPEND 1
+#define SMB_OFUN_OPEN_OPEN 1
+#define SMB_OFUN_OPEN_TRUNCATE 2
+
+#define SMB_OFUN_CREATE_FAIL 0x00
+#define SMB_OFUN_CREATE_CREATE 0x10
+
+//++
+//
+// BOOLEAN
+// SmbOfunCreate(
+// IN USHORT SmbOpenFunction
+// )
+//
+//--
+
+#define SmbOfunCreate(SmbOpenFunction) \
+ (BOOLEAN)((SmbOpenFunction & SMB_OFUN_CREATE_MASK) == SMB_OFUN_CREATE_CREATE)
+
+//++
+//
+// BOOLEAN
+// SmbOfunAppend(
+// IN USHORT SmbOpenFunction
+// )
+//
+//--
+
+#define SmbOfunAppend(SmbOpenFunction) \
+ (BOOLEAN)((SmbOpenFunction & SMB_OFUN_OPEN_MASK) == SMB_OFUN_OPEN_APPEND)
+
+//++
+//
+// BOOLEAN
+// SmbOfunTruncate(
+// IN USHORT SmbOpenFunction
+// )
+//
+//--
+
+#define SmbOfunTruncate(SmbOpenFunction) \
+ (BOOLEAN)((SmbOpenFunction & SMB_OFUN_OPEN_MASK) == SMB_OFUN_OPEN_TRUNCATE)
+
+//
+// The desired access mode passed in Open and Open and X has the following
+// mapping:
+//
+// 1111 11
+// 5432 1098 7654 3210
+// rWrC rLLL rSSS rAAA
+//
+// where:
+//
+// W - Write through mode. No read ahead or write behind allowed on
+// this file or device. When protocol is returned, data is expected
+// to be on the disk or device.
+//
+// S - Sharing mode:
+// 0 - Compatibility mode (as in core open)
+// 1 - Deny read/write/execute (exclusive)
+// 2 - Deny write
+// 3 - Deny read/execute
+// 4 - Deny none
+//
+// A - Access mode
+// 0 - Open for reading
+// 1 - Open for writing
+// 2 - Open for reading and writing
+// 3 - Open for execute
+//
+// rSSSrAAA = 11111111 (hex FF) indicates FCB open (as in core protocol)
+//
+// C - Cache mode
+// 0 - Normal file
+// 1 - Do not cache this file
+//
+// L - Locality of reference
+// 0 - Locality of reference is unknown
+// 1 - Mainly sequential access
+// 2 - Mainly random access
+// 3 - Random access with some locality
+// 4 to 7 - Currently undefined
+//
+
+
+#define SMB_DA_SHARE_MASK 0x70
+#define SMB_DA_ACCESS_MASK 0x07
+#define SMB_DA_FCB_MASK (UCHAR)0xFF
+
+#define SMB_DA_ACCESS_READ 0x00
+#define SMB_DA_ACCESS_WRITE 0x01
+#define SMB_DA_ACCESS_READ_WRITE 0x02
+#define SMB_DA_ACCESS_EXECUTE 0x03
+
+#define SMB_DA_SHARE_COMPATIBILITY 0x00
+#define SMB_DA_SHARE_EXCLUSIVE 0x10
+#define SMB_DA_SHARE_DENY_WRITE 0x20
+#define SMB_DA_SHARE_DENY_READ 0x30
+#define SMB_DA_SHARE_DENY_NONE 0x40
+
+#define SMB_DA_FCB (UCHAR)0xFF
+
+#define SMB_CACHE_NORMAL 0x0000
+#define SMB_DO_NOT_CACHE 0x1000
+
+#define SMB_LR_UNKNOWN 0x0000
+#define SMB_LR_SEQUENTIAL 0x0100
+#define SMB_LR_RANDOM 0x0200
+#define SMB_LR_RANDOM_WITH_LOCALITY 0x0300
+#define SMB_LR_MASK 0x0F00
+
+#define SMB_DA_WRITE_THROUGH 0x4000
+
+//
+// The Action field of OpenAndX has the following format:
+//
+// 1111 11
+// 5432 1098 7654 3210
+// Lrrr rrrr rrrr rrOO
+//
+// where:
+//
+// L - Opportunistic lock. 1 if lock granted, else 0.
+//
+// O - Open action:
+// 1 - The file existed and was opened
+// 2 - The file did not exist but was created
+// 3 - The file existed and was truncated
+//
+
+#define SMB_OACT_OPENED 0x01
+#define SMB_OACT_CREATED 0x02
+#define SMB_OACT_TRUNCATED 0x03
+
+#define SMB_OACT_OPLOCK 0x8000
+
+//
+// These flags are passed in the Flags field of the copy and extended rename
+// SMBs.
+//
+
+//
+// If set, the target must be a file or directory.
+//
+
+#define SMB_TARGET_IS_FILE 0x1
+#define SMB_TARGET_IS_DIRECTORY 0x2
+
+//
+// The copy mode--if set, ASCII copying should be done, otherwise binary.
+//
+
+#define SMB_COPY_TARGET_ASCII 0x4
+#define SMB_COPY_SOURCE_ASCII 0x8
+
+#define SMB_COPY_TREE 0x20
+
+//
+// If set, verify all writes.
+//
+
+#define SMB_VERIFY_WRITES
+
+//
+// Define file attribute bits as used in the SMB protocol. The specific
+// bit positions are, for the most part, identical to those used in NT.
+// However, NT does not define Volume and Directory bits. It also has
+// an explicit Normal bit; this bit is implied in SMB attributes by
+// Hidden, System, and Directory being off.
+//
+
+#define SMB_FILE_ATTRIBUTE_READONLY 0x01
+#define SMB_FILE_ATTRIBUTE_HIDDEN 0x02
+#define SMB_FILE_ATTRIBUTE_SYSTEM 0x04
+#define SMB_FILE_ATTRIBUTE_VOLUME 0x08
+#define SMB_FILE_ATTRIBUTE_DIRECTORY 0x10
+#define SMB_FILE_ATTRIBUTE_ARCHIVE 0x20
+
+//
+// Share type strings are passed in SMBs to indicate what type of shared
+// resource is being or has been connected to.
+//
+
+#define SHARE_TYPE_NAME_DISK "A:"
+#define SHARE_TYPE_NAME_PIPE "IPC"
+#define SHARE_TYPE_NAME_COMM "COMM"
+#define SHARE_TYPE_NAME_PRINT "LPT1:"
+#define SHARE_TYPE_NAME_WILD "?????"
+
+//
+// SMB Error codes:
+//
+
+//
+// Success Class:
+//
+
+#define SMB_ERR_SUCCESS (UCHAR)0x00
+
+//
+// DOS Error Class:
+//
+
+#define SMB_ERR_CLASS_DOS (UCHAR)0x01
+
+#define SMB_ERR_BAD_FUNCTION 1 // Invalid function
+#define SMB_ERR_BAD_FILE 2 // File not found
+#define SMB_ERR_BAD_PATH 3 // Invalid directory
+#define SMB_ERR_NO_FIDS 4 // Too many open files
+#define SMB_ERR_ACCESS_DENIED 5 // Access not allowed for req. func.
+#define SMB_ERR_BAD_FID 6 // Invalid file handle
+#define SMB_ERR_BAD_MCB 7 // Memory control blocks destroyed
+#define SMB_ERR_INSUFFICIENT_MEMORY 8 // For the desired function
+#define SMB_ERR_BAD_MEMORY 9 // Invalid memory block address
+#define SMB_ERR_BAD_ENVIRONMENT 10 // Invalid environment
+#define SMB_ERR_BAD_FORMAT 11 // Invalid format
+#define SMB_ERR_BAD_ACCESS 12 // Invalid open mode
+#define SMB_ERR_BAD_DATA 13 // Invalid data (only from IOCTL)
+#define SMB_ERR_RESERVED 14
+#define SMB_ERR_BAD_DRIVE 15 // Invalid drive specified
+#define SMB_ERR_CURRENT_DIRECTORY 16 // Attempted to remove currect directory
+#define SMB_ERR_DIFFERENT_DEVICE 17 // Not the same device
+#define SMB_ERR_NO_FILES 18 // File search can't find more files
+#define SMB_ERR_BAD_SHARE 32 // An open conflicts with FIDs on file
+#define SMB_ERR_LOCK 33 // Conflict with existing lock
+#define SMB_ERR_FILE_EXISTS 80 // Tried to overwrite existing file
+#define SMB_ERR_BAD_PIPE 230 // Invalie pipe
+#define SMB_ERR_PIPE_BUSY 231 // All instances of the pipe are busy
+#define SMB_ERR_PIPE_CLOSING 232 // Pipe close in progress
+#define SMB_ERR_PIPE_NOT_CONNECTED 233 // No process on other end of pipe
+#define SMB_ERR_MORE_DATA 234 // There is more data to return
+
+//
+// SERVER Error Class:
+//
+
+#define SMB_ERR_CLASS_SERVER (UCHAR)0x02
+
+#define SMB_ERR_ERROR 1 // Non-specific error code
+#define SMB_ERR_BAD_PASSWORD 2 // Bad name/password pair
+#define SMB_ERR_BAD_TYPE 3 // Reserved
+#define SMB_ERR_ACCESS 4 // Requester lacks necessary access
+#define SMB_ERR_BAD_TID 5 // Invalid TID
+#define SMB_ERR_BAD_NET_NAME 6 // Invalid network name in tree connect
+#define SMB_ERR_BAD_DEVICE 7 // Invalid device request
+#define SMB_ERR_QUEUE_FULL 49 // Print queue full--returned print file
+#define SMB_ERR_QUEUE_TOO_BIG 50 // Print queue full--no space
+#define SMB_ERR_QUEUE_EOF 51 // EOF on print queue dump
+#define SMB_ERR_BAD_PRINT_FID 52 // Invalid print file FID
+#define SMB_ERR_BAD_SMB_COMMAND 64 // SMB command not recognized
+#define SMB_ERR_SERVER_ERROR 65 // Internal server error
+#define SMB_ERR_FILE_SPECS 67 // FID and pathname were incompatible
+#define SMB_ERR_RESERVED2 68
+#define SMB_ERR_BAD_PERMITS 69 // Access permissions invalid
+#define SMB_ERR_RESERVED3 70
+#define SMB_ERR_BAD_ATTRIBUTE_MODE 71 // Invalid attribute mode specified
+#define SMB_ERR_SERVER_PAUSED 81 // Server is paused
+#define SMB_ERR_MESSAGE_OFF 82 // Server not receiving messages
+#define SMB_ERR_NO_ROOM 83 // No room for buffer message
+#define SMB_ERR_TOO_MANY_NAMES 87 // Too many remote user names
+#define SMB_ERR_TIMEOUT 88 // Operation was timed out
+#define SMB_ERR_NO_RESOURCE 89 // No resources available for request
+#define SMB_ERR_TOO_MANY_UIDS 90 // Too many UIDs active in session
+#define SMB_ERR_BAD_UID 91 // UID not known as a valid UID
+#define SMB_ERR_INVALID_NAME 123 // Invalid name returned from FAT.
+#define SMB_ERR_INVALID_NAME_RANGE 206 // Non 8.3 name passed to FAT (or non 255 name to HPFS)
+#define SMB_ERR_USE_MPX 250 // Can't support Raw; use MPX
+#define SMB_ERR_USE_STANDARD 251 // Can't support Raw, use standard r/w
+#define SMB_ERR_CONTINUE_MPX 252 // Reserved
+#define SMB_ERR_RESERVED4 253
+#define SMB_ERR_RESERVED5 254
+#define SMB_ERR_NO_SUPPORT_INTERNAL 255 // Internal code for NO_SUPPORT--
+ // allows codes to be stored in a byte
+#define SMB_ERR_NO_SUPPORT (USHORT)0xFFFF // Function not supported
+
+//
+// HARDWARE Error Class:
+//
+
+#define SMB_ERR_CLASS_HARDWARE (UCHAR)0x03
+
+#define SMB_ERR_NO_WRITE 19 // Write attempted to write-prot. disk
+#define SMB_ERR_BAD_UNIT 20 // Unknown unit
+#define SMB_ERR_DRIVE_NOT_READY 21 // Disk drive not ready
+#define SMB_ERR_BAD_COMMAND 22 // Unknown command
+#define SMB_ERR_DATA 23 // Data error (CRC)
+#define SMB_ERR_BAD_REQUEST 24 // Bad request structure length
+#define SMB_ERR_SEEK 25 // Seek error
+#define SMB_ERR_BAD_MEDIA 26 // Unknown media type
+#define SMB_ERR_BAD_SECTOR 27 // Sector not found
+#define SMB_ERR_NO_PAPER 28 // Printer out of paper
+#define SMB_ERR_WRITE_FAULT 29 // Write fault
+#define SMB_ERR_READ_FAULT 30 // Read fault
+#define SMB_ERR_GENERAL 31 // General failure
+#define SMB_ERR_LOCK_CONFLICT 33 // Lock conflicts with existing lock
+#define SMB_ERR_WRONG_DISK 34 // Wrong disk was found in a drive
+#define SMB_ERR_FCB_UNAVAILABLE 35 // No FCBs available to process request
+#define SMB_ERR_SHARE_BUFFER_EXCEEDED 36
+#define SMB_ERR_DISK_FULL 39 // !!! Undocumented, but in LM2.0
+
+//
+// Other Error Classes:
+//
+
+#define SMB_ERR_CLASS_XOS (UCHAR)0x04 // Reserved for XENIX
+#define SMB_ERR_CLASS_RMX1 (UCHAR)0xE1 // Reserved for iRMX
+#define SMB_ERR_CLASS_RMX2 (UCHAR)0xE2 // Reserved for iRMX
+#define SMB_ERR_CLASS_RMX3 (UCHAR)0xE3 // Reserved for iRMX
+#define SMB_ERR_CLASS_COMMAND (UCHAR)0xFF // Command was not in the SMB format
+
+
+//
+// Turn structure packing back off
+//
+
+#ifndef NO_PACKING
+#include <packoff.h>
+#endif // ndef NO_PACKING
+
+
+#endif // _SMB_
+
+// Old (LanMan 1.2) and new (NT) field names:
+// (Undocumented fields have corresponding structure in parenthesis)
+// smb_access Access
+// smb_action Action
+// smb_adate AccessDate
+// smb_allocsize AllocationSize
+// smb_aname AccountName
+// smb_apasslen PasswordSize
+// smb_apasswd AccountPassword
+// smb_atime AccessTime
+// smb_attr Attribute
+// smb_attribute Attribute
+// smb_aunits (RESP_QUERY_INFORMATION_SERVER)
+// smb_bcc BufferSize
+// smb_blkmode BlockMode
+// smb_blksize BlockSize
+// smb_blksperunit BlocksPerUnit
+// smb_bpu BlocksPerUnit
+// smb_bs BlockSize
+// smb_bufsize MaxBufferSize
+// smb_buf[1] Buffer[1]
+// smb_bytes[*] Bytes[*]
+// smb_cat Category
+// smb_cct FilesCopied
+// smb_cdate CreateDate
+// smb_cert CertificateOffset
+// smb_com Command
+// smb_com2 AndXCommand
+// smb_count Count
+// smb_count_left Remaining
+// smb_cryptkey[*] CryptKey
+// smb_ctime CreateTime
+// smb_datablock DataBlock
+// smb_datalen DataSize
+// smb_datasize DataSize
+// smb_data[*] Data[*]
+// smb_dcmode DataCompactMode
+// smb_dev DeviceName
+// smb_doff DataOffset
+// smb_drcnt DataCount
+// smb_drdisp DataDisplacement
+// smb_droff DataOffset
+// smb_dscnt DataCount
+// smb_dsdisp DataDisplacement
+// smb_dsize DataSize
+// smb_dsoff DataOffset
+// smb_encrypt EncryptKey
+// smb_encryptlen EncryptKeySize
+// smb_encryptoff EncryptKeyOffset
+// smb_eos EndOfSearch
+// smb_err Error
+// smb_errmsg[1] ErrorMessage[1]
+// smb_fau (RESP_QUERY_INFORMATION_SERVER)
+// smb_fid Fid
+// smb_fileid ServerFid
+// smb_flag Flag
+// smb_flag2 Flag2
+// smb_flags Flag
+// smb_flg Flag
+// smb_freeunits FreeUnits
+// smb_fsid (RESP_QUERY_INFORMATION_SERVER)
+// smb_fsize FileSize
+// smb_fun Function
+// smb_gid Gid
+// smb_handle Handle
+// smb_ident1 Identifier
+// smb_idf[4] Protocol[4]
+// smb_index Index
+// smb_info Info
+// smb_left Remaining
+// smb_len SetupLength
+// smb_locknum NumberOfLocks
+// smb_lockrng[*] LockRange
+// smb_locktype LockType
+// smb_lpid OwnerPid
+// smb_maxbytes MaxBytes
+// smb_maxcnt MaxCount
+// smb_maxcount MaxCount
+// smb_maxmux (RESP_NEGOTIATE)
+// smb_maxvcs MaxNumberVcs
+// smb_maxxmitsz MaxTransmitSize
+// smb_maxxmt MaxTransmitSize
+// smb_mdate ModificationDate
+// smb_mdrcnt MaxDataCount
+// smb_mid Mid
+// smb_mincnt MinCount
+// smb_mode Mode
+// smb_mprcnt MaxParameterCount
+// smb_mpxmax MaxMpxCount
+// smb_msrcnt MaxSetupCount
+// smb_mtime ModificationTime
+// smb_name[*] Name[*]
+// smb_off2 AndXOffset
+// smb_offset Offset
+// smb_ofun OpenFunction
+// smb_pad Pad
+// smb_pad1[] Pad1
+// smb_pad[] Pad[]
+// smb_param[*] Parameter[*]
+// smb_path ServerName
+// smb_pathname PathName
+// smb_pid Pid
+// smb_prcnt ParameterCount
+// smb_prdisp ParameterDisplacement
+// smb_proff ParameterCount
+// smb_pscnt ParameterCount
+// smb_psdisp ParameterDisplacement
+// smb_psoff ParameterOffset
+// smb_range LockLength or UnlockLength
+// smb_rcls ErrorClass
+// smb_reh ReservedH
+// smb_reh2 ReservedH2
+// smb_remaining Remaining
+// smb_remcnt Remaining
+// smb_res1 Reserved
+// smb_res2 Reserved2
+// smb_res3 Reserved3
+// smb_res4 Reserved4
+// smb_res5 Reserved5
+// smb_reserved Reserved
+// smb_restart Restart
+// smb_resumekey ResumeKey
+// smb_res[5] Reserved[]
+// smb_reverb ReverbCount
+// smb_rsvd Reserved
+// smb_rsvd1 Reserved
+// smb_rsvd2 Reserved2
+// smb_rsvd3 Reserved3
+// smb_rsvd4 Reserved4
+// smb_sattr SearchAttribute
+// smb_secmode SecurityMode
+// smb_seq SequenceNumber
+// smb_services Services
+// smb_sesskey SessionKey
+// smb_setup[*] Setup[*]
+// smb_size Size
+// smb_spasslen ServerPasswordSize
+// smb_spasswd ServerPassword
+// smb_srv_date ServerDate
+// smb_srv_time ServerTime
+// smb_srv_tzone ServerTimeZone
+// smb_start StartIndex
+// smb_state DeviceState
+// smb_suwcnt SetupWordCount
+// smb_su_class SetupClass
+// smb_su_com SetupCommand
+// smb_su_handle SetupFid
+// smb_su_opcode SetupOpcode
+// smb_su_priority SetupPriority
+// smb_tcount Count
+// smb_tdis TreeDisconnect
+// smb_tdrcnt TotalDataCount
+// smb_tdscnt TotalDataCount
+// smb_tid Tid
+// smb_tid2 Tid2
+// smb_time Time
+// smb_timeout Timeout
+// smb_totalunits TotalUnits
+// smb_tprcnt TotalParameterCount
+// smb_tpscnt TotalParameterCount
+// smb_type FileType
+// smb_uid Uid
+// smb_unlkrng[*] UnlockRange
+// smb_unlocknum NumberOfUnlocks
+// smb_vblen DataLength
+// smb_vcnum VcNumber
+// smb_vldate (RESP_QUERY_INFORMATION_SERVER)
+// smb_vllen (RESP_QUERY_INFORMATION_SERVER)
+// smb_vltime (RESP_QUERY_INFORMATION_SERVER)
+// smb_vwv[1] Param
+// smb_wct WordCount
+// smb_wmode WriteMode
+// smb_xchain EncryptChainOffset
+
diff --git a/private/inc/smbgtpt.h b/private/inc/smbgtpt.h
new file mode 100644
index 000000000..b8bbd1b06
--- /dev/null
+++ b/private/inc/smbgtpt.h
@@ -0,0 +1,915 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ smbgtpt.h
+
+Abstract:
+
+ This module defines macros for retrieving and storing SMB data.
+ The macros account for the misaligned nature of the SMB protocol.
+ They also translate from the little-endian SMB format into
+ big-endian format, when necessary.
+
+Author:
+
+ Chuck Lenzmeier (chuckl) 2-Mar-90
+ David Treadwell (davditr)
+
+Revision History:
+
+ 15-Apr-1991 JohnRo
+ Include <smbtypes.h>, to define SMBDBG etc.
+--*/
+
+#ifndef _SMBGTPT_
+#define _SMBGTPT_
+
+#include <smbtypes.h>
+//#include <smb.h>
+
+//
+// The following macros store and retrieve USHORTS and ULONGS from
+// potentially unaligned addresses, avoiding alignment faults. They
+// would best be written as inline assembly code.
+//
+// The macros are designed to be used for accessing SMB fields. Such
+// fields are always stored in little-endian byte order, so these macros
+// do byte swapping when compiled for a big-endian machine.
+//
+// !!! Not yet.
+//
+
+#if !SMBDBG
+
+#define BYTE_0_MASK 0xFF
+
+#define BYTE_0(Value) (UCHAR)( (Value) & BYTE_0_MASK)
+#define BYTE_1(Value) (UCHAR)( ((Value) >> 8) & BYTE_0_MASK)
+#define BYTE_2(Value) (UCHAR)( ((Value) >> 16) & BYTE_0_MASK)
+#define BYTE_3(Value) (UCHAR)( ((Value) >> 24) & BYTE_0_MASK)
+
+#endif
+
+//++
+//
+// USHORT
+// SmbGetUshort (
+// IN PSMB_USHORT SrcAddress
+// )
+//
+// Routine Description:
+//
+// This macro retrieves a USHORT value from the possibly misaligned
+// source address, avoiding alignment faults.
+//
+// Arguments:
+//
+// SrcAddress - where to retrieve USHORT value from
+//
+// Return Value:
+//
+// USHORT - the value retrieved. The target must be aligned.
+//
+//--
+
+#if !SMBDBG
+
+#if !SMBDBG1
+#if SMB_USE_UNALIGNED
+#define SmbGetUshort(SrcAddress) *(PSMB_USHORT)(SrcAddress)
+#else
+#define SmbGetUshort(SrcAddress) (USHORT)( \
+ ( ( (PUCHAR)(SrcAddress) )[0] ) | \
+ ( ( (PUCHAR)(SrcAddress) )[1] << 8 ) \
+ )
+#endif
+#else
+#define SmbGetUshort(SrcAddress) (USHORT)( \
+ ( ( (PUCHAR)(SrcAddress ## S) )[0] ) | \
+ ( ( (PUCHAR)(SrcAddress ## S) )[1] << 8 ) \
+ )
+#endif
+
+#else
+
+USHORT
+SmbGetUshort (
+ IN PSMB_USHORT SrcAddress
+ );
+
+#endif
+
+//++
+//
+// USHORT
+// SmbGetAlignedUshort (
+// IN PUSHORT SrcAddress
+// )
+//
+// Routine Description:
+//
+// This macro retrieves a USHORT value from the source address,
+// correcting for the endian characteristics of the server if
+// necessary.
+//
+// Arguments:
+//
+// SrcAddress - where to retrieve USHORT value from; must be aligned.
+//
+// Return Value:
+//
+// USHORT - the value retrieved. The target must be aligned.
+//
+//--
+
+#if !SMBDBG
+
+#if !SMBDBG1
+#define SmbGetAlignedUshort(SrcAddress) *(SrcAddress)
+#else
+#define SmbGetAlignedUshort(SrcAddress) *(SrcAddress ## S)
+#endif
+
+#else
+
+USHORT
+SmbGetAlignedUshort (
+ IN PUSHORT SrcAddress
+ );
+
+#endif
+
+//++
+//
+// VOID
+// SmbPutUshort (
+// OUT PSMB_USHORT DestAddress,
+// IN USHORT Value
+// )
+//
+// Routine Description:
+//
+// This macro stores a USHORT value at the possibly misaligned
+// destination address, avoiding alignment faults.
+//
+// Arguments:
+//
+// DestAddress - where to store USHORT value. Address may be
+// misaligned.
+//
+// Value - USHORT to store. Value must be a constant or an aligned
+// field.
+//
+// Return Value:
+//
+// None.
+//
+//--
+
+#if !SMBDBG
+
+#if !SMBDBG1
+#if SMB_USE_UNALIGNED
+#define SmbPutUshort(SrcAddress, Value) \
+ *(PSMB_USHORT)(SrcAddress) = (Value)
+#else
+#define SmbPutUshort(DestAddress,Value) { \
+ ( (PUCHAR)(DestAddress) )[0] = BYTE_0(Value); \
+ ( (PUCHAR)(DestAddress) )[1] = BYTE_1(Value); \
+ }
+#endif
+#else
+#define SmbPutUshort(DestAddress,Value) { \
+ ( (PUCHAR)(DestAddress ## S) )[0] = BYTE_0(Value); \
+ ( (PUCHAR)(DestAddress ## S) )[1] = BYTE_1(Value); \
+ }
+#endif
+
+#else
+
+VOID
+SmbPutUshort (
+ OUT PSMB_USHORT DestAddress,
+ IN USHORT Value
+ );
+
+#endif
+
+//++
+//
+// VOID
+// SmbPutAlignedUshort (
+// OUT PUSHORT DestAddres,
+// IN USHORT Value
+// )
+//
+// Routine Description:
+//
+// This macro stores a USHORT value from the source address,
+// correcting for the endian characteristics of the server if
+// necessary.
+//
+// Arguments:
+//
+// DestAddress - where to store USHORT value. Address may not be
+// misaligned.
+//
+// Value - USHORT to store. Value must be a constant or an aligned
+// field.
+//
+// Return Value:
+//
+// None.
+//
+//--
+
+#if !SMBDBG
+
+#if !SMBDBG1
+#define SmbPutAlignedUshort(DestAddress,Value) *(DestAddress) = (Value)
+#else
+#define SmbPutAlignedUshort(DestAddress,Value) *(DestAddress ## S) = (Value)
+#endif
+
+#else
+
+VOID
+SmbPutAlignedUshort (
+ OUT PUSHORT DestAddress,
+ IN USHORT Value
+ );
+
+#endif
+
+//++
+//
+// VOID
+// SmbMoveUshort (
+// OUT PSMB_USHORT DestAddress
+// IN PSMB_USHORT SrcAddress
+// )
+//
+// Routine Description:
+//
+// This macro moves a USHORT value from the possibly misaligned
+// source address to the possibly misaligned destination address,
+// avoiding alignment faults.
+//
+// Arguments:
+//
+// DestAddress - where to store USHORT value
+//
+// SrcAddress - where to retrieve USHORT value from
+//
+// Return Value:
+//
+// None.
+//
+//--
+
+#if !SMBDBG
+
+#if !SMBDBG1
+#if SMB_USE_UNALIGNED
+#define SmbMoveUshort(DestAddress, SrcAddress) \
+ *(PSMB_USHORT)(DestAddress) = *(PSMB_USHORT)(SrcAddress)
+#else
+#define SmbMoveUshort(DestAddress,SrcAddress) { \
+ ( (PUCHAR)(DestAddress) )[0] = ( (PUCHAR)(SrcAddress) )[0]; \
+ ( (PUCHAR)(DestAddress) )[1] = ( (PUCHAR)(SrcAddress) )[1]; \
+ }
+#endif
+#else
+#define SmbMoveUshort(DestAddress,SrcAddress) { \
+ ( (PUCHAR)(DestAddress ## S) )[0] = ( (PUCHAR)(SrcAddress ## S) )[0]; \
+ ( (PUCHAR)(DestAddress ## S) )[1] = ( (PUCHAR)(SrcAddress ## S) )[1]; \
+ }
+#endif
+
+#else
+
+VOID
+SmbMoveUshort (
+ OUT PSMB_USHORT DestAddress,
+ IN PSMB_USHORT SrcAddress
+ );
+
+#endif
+
+//++
+//
+// ULONG
+// SmbGetUlong (
+// IN PSMB_ULONG SrcAddress
+// )
+//
+// Routine Description:
+//
+// This macro retrieves a ULONG value from the possibly misaligned
+// source address, avoiding alignment faults.
+//
+// Arguments:
+//
+// SrcAddress - where to retrieve ULONG value from
+//
+// Return Value:
+//
+// ULONG - the value retrieved. The target must be aligned.
+//
+//--
+
+#if !SMBDBG
+
+#if !SMBDBG1
+#if SMB_USE_UNALIGNED
+#define SmbGetUlong(SrcAddress) *(PSMB_ULONG)(SrcAddress)
+#else
+#define SmbGetUlong(SrcAddress) (ULONG)( \
+ ( ( (PUCHAR)(SrcAddress) )[0] ) | \
+ ( ( (PUCHAR)(SrcAddress) )[1] << 8 ) | \
+ ( ( (PUCHAR)(SrcAddress) )[2] << 16 ) | \
+ ( ( (PUCHAR)(SrcAddress) )[3] << 24 ) \
+ )
+#endif
+#else
+#define SmbGetUlong(SrcAddress) (ULONG)( \
+ ( ( (PUCHAR)(SrcAddress ## L) )[0] ) | \
+ ( ( (PUCHAR)(SrcAddress ## L) )[1] << 8 ) | \
+ ( ( (PUCHAR)(SrcAddress ## L) )[2] << 16 ) | \
+ ( ( (PUCHAR)(SrcAddress ## L) )[3] << 24 ) \
+ )
+#endif
+
+#else
+
+ULONG
+SmbGetUlong (
+ IN PSMB_ULONG SrcAddress
+ );
+
+#endif
+
+//++
+//
+// USHORT
+// SmbGetAlignedUlong (
+// IN PULONG SrcAddress
+// )
+//
+// Routine Description:
+//
+// This macro retrieves a ULONG value from the source address,
+// correcting for the endian characteristics of the server if
+// necessary.
+//
+// Arguments:
+//
+// SrcAddress - where to retrieve ULONG value from; must be aligned.
+//
+// Return Value:
+//
+// ULONG - the value retrieved. The target must be aligned.
+//
+//--
+
+#if !SMBDBG
+
+#if !SMBDBG1
+#define SmbGetAlignedUlong(SrcAddress) *(SrcAddress)
+#else
+#define SmbGetAlignedUlong(SrcAddress) *(SrcAddress ## L)
+#endif
+
+#else
+
+ULONG
+SmbGetAlignedUlong (
+ IN PULONG SrcAddress
+ );
+
+#endif
+
+//++
+//
+// VOID
+// SmbPutUlong (
+// OUT PSMB_ULONG DestAddress,
+// IN ULONG Value
+// )
+//
+// Routine Description:
+//
+// This macro stores a ULONG value at the possibly misaligned
+// destination address, avoiding alignment faults.
+//
+// Arguments:
+//
+// DestAddress - where to store ULONG value
+//
+// Value - ULONG to store. Value must be a constant or an aligned
+// field.
+//
+// Return Value:
+//
+// None.
+//
+//--
+
+#if !SMBDBG
+
+#if !SMBDBG1
+#if SMB_USE_UNALIGNED
+#define SmbPutUlong(SrcAddress, Value) *(PSMB_ULONG)(SrcAddress) = Value
+#else
+#define SmbPutUlong(DestAddress,Value) { \
+ ( (PUCHAR)(DestAddress) )[0] = BYTE_0(Value); \
+ ( (PUCHAR)(DestAddress) )[1] = BYTE_1(Value); \
+ ( (PUCHAR)(DestAddress) )[2] = BYTE_2(Value); \
+ ( (PUCHAR)(DestAddress) )[3] = BYTE_3(Value); \
+ }
+#endif
+#else
+#define SmbPutUlong(DestAddress,Value) { \
+ ( (PUCHAR)(DestAddress ## L) )[0] = BYTE_0(Value); \
+ ( (PUCHAR)(DestAddress ## L) )[1] = BYTE_1(Value); \
+ ( (PUCHAR)(DestAddress ## L) )[2] = BYTE_2(Value); \
+ ( (PUCHAR)(DestAddress ## L) )[3] = BYTE_3(Value); \
+ }
+#endif
+
+#else
+
+VOID
+SmbPutUlong (
+ OUT PSMB_ULONG DestAddress,
+ IN ULONG Value
+ );
+
+#endif
+
+//++
+//
+// VOID
+// SmbPutAlignedUlong (
+// OUT PULONG DestAddres,
+// IN ULONG Value
+// )
+//
+// Routine Description:
+//
+// This macro stores a ULONG value from the source address,
+// correcting for the endian characteristics of the server if
+// necessary.
+//
+// Arguments:
+//
+// DestAddress - where to store ULONG value. Address may not be
+// misaligned.
+//
+// Value - ULONG to store. Value must be a constant or an aligned
+// field.
+//
+// Return Value:
+//
+// None.
+//
+//--
+
+#if !SMBDBG
+
+#if !SMBDBG1
+#define SmbPutAlignedUlong(DestAddress,Value) *(DestAddress) = (Value)
+#else
+#define SmbPutAlignedUlong(DestAddress,Value) *(DestAddress ## L) = (Value)
+#endif
+
+#else
+
+VOID
+SmbPutAlignedUlong (
+ OUT PULONG DestAddress,
+ IN ULONG Value
+ );
+
+#endif
+
+//++
+//
+// VOID
+// SmbMoveUlong (
+// OUT PSMB_ULONG DestAddress,
+// IN PSMB_ULONG SrcAddress
+// )
+//
+// Routine Description:
+//
+// This macro moves a ULONG value from the possibly misaligned
+// source address to the possible misaligned destination address,
+// avoiding alignment faults.
+//
+// Arguments:
+//
+// DestAddress - where to store ULONG value
+//
+// SrcAddress - where to retrieve ULONG value from
+//
+// Return Value:
+//
+// None.
+//
+//--
+
+#if !SMBDBG
+
+#if !SMBDBG1
+#if SMB_USE_UNALIGNED
+#define SmbMoveUlong(DestAddress,SrcAddress) \
+ *(PSMB_ULONG)(DestAddress) = *(PSMB_ULONG)(SrcAddress)
+#else
+#define SmbMoveUlong(DestAddress,SrcAddress) { \
+ ( (PUCHAR)(DestAddress) )[0] = ( (PUCHAR)(SrcAddress) )[0]; \
+ ( (PUCHAR)(DestAddress) )[1] = ( (PUCHAR)(SrcAddress) )[1]; \
+ ( (PUCHAR)(DestAddress) )[2] = ( (PUCHAR)(SrcAddress) )[2]; \
+ ( (PUCHAR)(DestAddress) )[3] = ( (PUCHAR)(SrcAddress) )[3]; \
+ }
+#endif
+#else
+#define SmbMoveUlong(DestAddress,SrcAddress) { \
+ ( (PUCHAR)(DestAddress ## L) )[0] = ( (PUCHAR)(SrcAddress ## L) )[0]; \
+ ( (PUCHAR)(DestAddress ## L) )[1] = ( (PUCHAR)(SrcAddress ## L) )[1]; \
+ ( (PUCHAR)(DestAddress ## L) )[2] = ( (PUCHAR)(SrcAddress ## L) )[2]; \
+ ( (PUCHAR)(DestAddress ## L) )[3] = ( (PUCHAR)(SrcAddress ## L) )[3]; \
+ }
+#endif
+
+#else
+
+VOID
+SmbMoveUlong (
+ OUT PSMB_ULONG DestAddress,
+ IN PSMB_ULONG SrcAddress
+ );
+
+#endif
+
+//++
+//
+// VOID
+// SmbPutDate (
+// OUT PSMB_DATE DestAddress,
+// IN SMB_DATE Value
+// )
+//
+// Routine Description:
+//
+// This macro stores an SMB_DATE value at the possibly misaligned
+// destination address, avoiding alignment faults. This macro
+// is different from SmbPutUshort in order to be able to handle
+// funny bitfield / big-endian interactions.
+//
+// Arguments:
+//
+// DestAddress - where to store SMB_DATE value
+//
+// Value - SMB_DATE to store. Value must be a constant or an
+// aligned field.
+//
+// Return Value:
+//
+// None.
+//
+//--
+
+#if !SMBDBG
+
+#if SMB_USE_UNALIGNED
+#define SmbPutDate(DestAddress,Value) (DestAddress)->Ushort = (Value).Ushort
+#else
+#define SmbPutDate(DestAddress,Value) { \
+ ( (PUCHAR)&(DestAddress)->Ushort )[0] = BYTE_0((Value).Ushort); \
+ ( (PUCHAR)&(DestAddress)->Ushort )[1] = BYTE_1((Value).Ushort); \
+ }
+#endif
+
+#else
+
+VOID
+SmbPutDate (
+ OUT PSMB_DATE DestAddress,
+ IN SMB_DATE Value
+ );
+
+#endif
+
+//++
+//
+// VOID
+// SmbMoveDate (
+// OUT PSMB_DATE DestAddress,
+// IN PSMB_DATE SrcAddress
+// )
+//
+// Routine Description:
+//
+// This macro copies an SMB_DATE value from the possibly misaligned
+// source address, avoiding alignment faults. This macro is
+// different from SmbGetUshort in order to be able to handle funny
+// bitfield / big-endian interactions.
+//
+// Note that there is no SmbGetDate because of the way SMB_DATE is
+// defined. It is a union containing a USHORT and a bitfield
+// struct. The caller of an SmbGetDate macro would have to
+// explicitly use one part of the union.
+//
+// Arguments:
+//
+// DestAddress - where to store SMB_DATE value. MUST BE ALIGNED!
+//
+// SrcAddress - where to retrieve SMB_DATE value from
+//
+// Return Value:
+//
+// None.
+//
+//--
+
+#if !SMBDBG
+
+#if SMB_USE_UNALIGNED
+#define SmbMoveDate(DestAddress,SrcAddress) \
+ (DestAddress)->Ushort = (SrcAddress)->Ushort
+#else
+#define SmbMoveDate(DestAddress,SrcAddress) \
+ (DestAddress)->Ushort = \
+ ( ( (PUCHAR)&(SrcAddress)->Ushort )[0] ) | \
+ ( ( (PUCHAR)&(SrcAddress)->Ushort )[1] << 8 )
+#endif
+
+#else
+
+VOID
+SmbMoveDate (
+ OUT PSMB_DATE DestAddress,
+ IN PSMB_DATE SrcAddress
+ );
+
+#endif
+
+//++
+//
+// VOID
+// SmbZeroDate (
+// IN PSMB_DATE Date
+// )
+//
+// Routine Description:
+//
+// This macro zeroes a possibly misaligned SMB_DATE field.
+//
+// Arguments:
+//
+// Date - Pointer to SMB_DATE field to zero.
+//
+// Return Value:
+//
+// None.
+//
+//--
+
+#if !SMBDBG
+
+#if SMB_USE_UNALIGNED
+#define SmbZeroDate(Date) (Date)->Ushort = 0
+#else
+#define SmbZeroDate(Date) { \
+ ( (PUCHAR)&(Date)->Ushort )[0] = 0; \
+ ( (PUCHAR)&(Date)->Ushort )[1] = 0; \
+ }
+#endif
+
+#else
+
+VOID
+SmbZeroDate (
+ IN PSMB_DATE Date
+ );
+
+#endif
+
+//++
+//
+// BOOLEAN
+// SmbIsDateZero (
+// IN PSMB_DATE Date
+// )
+//
+// Routine Description:
+//
+// This macro returns TRUE if the supplied SMB_DATE value is zero.
+//
+// Arguments:
+//
+// Date - Pointer to SMB_DATE value to check. MUST BE ALIGNED!
+//
+// Return Value:
+//
+// BOOLEAN - TRUE if Date is zero, else FALSE.
+//
+//--
+
+#if !SMBDBG
+
+#define SmbIsDateZero(Date) ( (Date)->Ushort == 0 )
+
+#else
+
+BOOLEAN
+SmbIsDateZero (
+ IN PSMB_DATE Date
+ );
+
+#endif
+
+//++
+//
+// VOID
+// SmbPutTime (
+// OUT PSMB_TIME DestAddress,
+// IN SMB_TIME Value
+// )
+//
+// Routine Description:
+//
+// This macro stores an SMB_TIME value at the possibly misaligned
+// destination address, avoiding alignment faults. This macro
+// is different from SmbPutUshort in order to be able to handle
+// funny bitfield / big-endian interactions.
+//
+// Arguments:
+//
+// DestAddress - where to store SMB_TIME value
+//
+// Value - SMB_TIME to store. Value must be a constant or an
+// aligned field.
+//
+// Return Value:
+//
+// None.
+//
+//--
+
+#if !SMBDBG
+
+#if SMB_USE_UNALIGNED
+#define SmbPutTime(DestAddress,Value) (DestAddress)->Ushort = (Value).Ushort
+#else
+#define SmbPutTime(DestAddress,Value) { \
+ ( (PUCHAR)&(DestAddress)->Ushort )[0] = BYTE_0((Value).Ushort); \
+ ( (PUCHAR)&(DestAddress)->Ushort )[1] = BYTE_1((Value).Ushort); \
+ }
+#endif
+
+#else
+
+VOID
+SmbPutTime (
+ OUT PSMB_TIME DestAddress,
+ IN SMB_TIME Value
+ );
+
+#endif
+
+//++
+//
+// VOID
+// SmbMoveTime (
+// OUT PSMB_TIME DestAddress,
+// IN PSMB_TIME SrcAddress
+// )
+//
+// Routine Description:
+//
+// This macro copies an SMB_TIME value from the possibly
+// misaligned source address, avoiding alignment faults. This macro
+// is different from SmbGetUshort in order to be able to handle
+// funny bitfield / big-endian interactions.
+//
+// Note that there is no SmbGetTime because of the way SMB_TIME is
+// defined. It is a union containing a USHORT and a bitfield
+// struct. The caller of an SmbGetTime macro would have to
+// explicitly use one part of the union.
+//
+// Arguments:
+//
+// DestAddress - where to store SMB_TIME value. MUST BE ALIGNED!
+//
+// SrcAddress - where to retrieve SMB_TIME value from
+//
+// Return Value:
+//
+// None.
+//
+//--
+
+#if !SMBDBG
+
+#if SMB_USE_UNALIGNED
+#define SmbMoveTime(DestAddress,SrcAddress) \
+ (DestAddress)->Ushort = (SrcAddress)->Ushort
+#else
+#define SmbMoveTime(DestAddress,SrcAddress) \
+ (DestAddress)->Ushort = \
+ ( ( (PUCHAR)&(SrcAddress)->Ushort )[0] ) | \
+ ( ( (PUCHAR)&(SrcAddress)->Ushort )[1] << 8 )
+#endif
+
+#else
+
+VOID
+SmbMoveTime (
+ OUT PSMB_TIME DestAddress,
+ IN PSMB_TIME SrcAddress
+ );
+
+#endif
+
+//++
+//
+// VOID
+// SmbZeroTime (
+// IN PSMB_TIME Time
+// )
+//
+// Routine Description:
+//
+// This macro zeroes a possibly misaligned SMB_TIME field.
+//
+// Arguments:
+//
+// Time - Pointer to SMB_TIME field to zero.
+//
+// Return Value:
+//
+// None.
+//
+//--
+
+#if !SMBDBG
+
+#if SMB_USE_UNALIGNED
+#define SmbZeroTime(Time) (Time)->Ushort = 0
+#else
+#define SmbZeroTime(Time) { \
+ ( (PUCHAR)&(Time)->Ushort )[0] = 0; \
+ ( (PUCHAR)&(Time)->Ushort )[1] = 0; \
+ }
+#endif
+
+#else
+
+VOID
+SmbZeroTime (
+ IN PSMB_TIME Time
+ );
+
+#endif
+
+//++
+//
+// BOOLEAN
+// SmbIsTimeZero (
+// IN PSMB_TIME Time
+// )
+//
+// Routine Description:
+//
+// This macro returns TRUE if the supplied SMB_TIME value is zero.
+//
+// Arguments:
+//
+// Time - Pointer to SMB_TIME value to check. Must be aligned and
+// in native format!
+//
+// Return Value:
+//
+// BOOLEAN - TRUE if Time is zero, else FALSE.
+//
+//--
+
+#if !SMBDBG
+
+#define SmbIsTimeZero(Time) ( (Time)->Ushort == 0 )
+
+#else
+
+BOOLEAN
+SmbIsTimeZero (
+ IN PSMB_TIME Time
+ );
+
+#endif
+
+#endif // def _SMBGTPT_
diff --git a/private/inc/smbipx.h b/private/inc/smbipx.h
new file mode 100644
index 000000000..33c184a41
--- /dev/null
+++ b/private/inc/smbipx.h
@@ -0,0 +1,64 @@
+/*++
+
+Copyright (c) 1993 Microsoft Corporation
+
+Module Name:
+
+ smb.h
+
+Abstract:
+
+ This file contains request and response structure definitions
+ for the specific parameters of each SMB command, as well as codes
+ for SMB commands and errors.
+
+Author:
+
+ Chuck Lenzmeier (chuckl) 10-Dec-1993
+
+Revision History:
+
+--*/
+
+#ifndef _SMBIPX_
+#define _SMBIPX_
+
+#define SMB_IPX_SERVER_SOCKET 0x5005 // 0x0550 in high-low format
+#define SMB_IPX_NAME_SOCKET 0x5105 // 0x0551 in high-low format
+#define SMB_IPX_REDIR_SOCKET 0x5205 // 0x0552 in high-low format
+#define SMB_IPX_MAILSLOT_SOCKET 0x5305 // 0x0553 in high-low format
+#define SMB_IPX_MESSENGER_SOCKET 0x5405 // 0x0554 in high-low format
+
+#define SMB_ERR_BAD_SID 0x10
+#define SMB_ERR_WORKING 0x11
+#define SMB_ERR_NOT_ME 0x12
+
+#define SMB_IPX_NAME_LENGTH 16
+
+typedef struct _SMB_IPX_NAME_PACKET {
+ UCHAR Route[32];
+ UCHAR Operation;
+ UCHAR NameType;
+ USHORT MessageId;
+ UCHAR Name[SMB_IPX_NAME_LENGTH];
+ UCHAR SourceName[SMB_IPX_NAME_LENGTH];
+} SMB_IPX_NAME_PACKET;
+typedef SMB_IPX_NAME_PACKET SMB_UNALIGNED *PSMB_IPX_NAME_PACKET;
+
+#define SMB_IPX_NAME_CLAIM 0xf1
+#define SMB_IPX_NAME_DELETE 0xf2
+#define SMB_IPX_NAME_QUERY 0xf3
+#define SMB_IPX_NAME_FOUND 0xf4
+
+#define SMB_IPX_MESSENGER_HANGUP 0xf5
+
+#define SMB_IPX_MAILSLOT_SEND 0xfc
+#define SMB_IPX_MAILSLOT_FIND 0xfd
+#define SMB_IPX_MAILSLOT_FOUND 0xfe
+
+#define SMB_IPX_NAME_TYPE_MACHINE 0x01
+#define SMB_IPX_NAME_TYPE_WORKKGROUP 0x02
+#define SMB_IPX_NAME_TYPE_BROWSER 0x03
+
+#endif // _SMBIPX_
+
diff --git a/private/inc/smbmacro.h b/private/inc/smbmacro.h
new file mode 100644
index 000000000..791af6be6
--- /dev/null
+++ b/private/inc/smbmacro.h
@@ -0,0 +1,240 @@
+/*++
+
+Copyright (c) 1989 Microsoft Corporation
+
+Module Name:
+
+ smbmacro.h
+
+Abstract:
+
+ This module defines macros related to SMB processing.
+
+Author:
+
+ Chuck Lenzmeier (chuckl) 1-Dec-1989
+ David Treadwell (davidtr)
+
+Revision History:
+
+--*/
+
+#ifndef _SMBMACRO_
+#define _SMBMACRO_
+
+//#include <nt.h>
+
+
+//
+// PVOID
+// ALIGN_SMB_WSTR(
+// IN PVOID Pointer
+// )
+//
+// Routine description:
+//
+// This macro aligns the input pointer to the next 2-byte boundary.
+// Used to align Unicode strings in SMBs.
+//
+// Arguments:
+//
+// Pointer - A pointer
+//
+// Return Value:
+//
+// PVOID - Pointer aligned to next 2-byte boundary.
+//
+
+#define ALIGN_SMB_WSTR( Pointer ) \
+ (PVOID)( ((ULONG)Pointer + 1) & ~1 )
+
+//
+// Macro to find the size of an SMB parameter block. This macro takes
+// as input the type of a parameter block and a byte count. It finds
+// the offset of the Buffer field, which appears at the end of all
+// parameter blocks, and adds the byte count to find the total size.
+// The type of the returned offset is USHORT.
+//
+// Note that this macro does NOT pad to a word or longword boundary.
+//
+
+#define SIZEOF_SMB_PARAMS(type,byteCount) \
+ (USHORT)( (CLONG)&((type *)0)->Buffer[0] + (byteCount) )
+
+//
+// Macro to find the next location after an SMB parameter block. This
+// macro takes as input the address of the current parameter block, its
+// type, and a byte count. It finds the address of the Buffer field,
+// which appears at the end of all parameter blocks, and adds the byte
+// count to find the next available location. The type of the returned
+// pointer is PVOID.
+//
+// The byte count is passed in even though it is available through
+// base->ByteCount. The reason for this is that this number will be a
+// compile-time constant in most cases, so the resulting code will be
+// simpler and faster.
+//
+// !!! This macro does not round to a longword boundary when packing
+// is turned off. Pre-LM 2.0 DOS redirectors cannot handle having
+// too much data sent to them; the exact amount must be sent.
+// We may want to make this macro such that the first location
+// AFTER the returned value (WordCount field of the SMB) is aligned,
+// since most of the fields are misaligned USHORTs. This would
+// result in a minor performance win on the 386 and other CISC
+// machines.
+//
+
+#ifndef NO_PACKING
+
+#define NEXT_LOCATION(base,type,byteCount) \
+ (PVOID)( (ULONG)( (PUCHAR)( &((type *)(base))->Buffer[0] ) ) + \
+ (byteCount) )
+
+#else
+
+#define NEXT_LOCATION(base,type,byteCount) \
+ (PVOID)(( (ULONG)( (PUCHAR)( &((type *)(base))->Buffer[0] ) ) + \
+ (byteCount) + 3) & ~3)
+
+#endif
+
+//
+// Macro to find the offset of a followon command to an and X command.
+// This offset is the number of bytes from the start of the SMB header
+// to where the followon command's parameters should start.
+//
+
+#define GET_ANDX_OFFSET(header,params,type,byteCount) \
+ (USHORT)( (PCHAR)(params) - (PCHAR)(header) + \
+ SIZEOF_SMB_PARAMS( type,(byteCount) ) )
+
+//
+// The following are macros to assist in converting OS/2 1.2 EAs to
+// NT style and vice-versa.
+//
+
+//++
+//
+// ULONG
+// SmbGetNtSizeOfFea (
+// IN PFEA Fea
+// )
+//
+// Routine Description:
+//
+// This macro gets the size that would be required to hold the FEA
+// in NT format. The length is padded to account for the fact that
+// each FILE_FULL_EA_INFORMATION structure must start on a
+// longword boundary.
+//
+// Arguments:
+//
+// Fea - a pointer to the OS/2 1.2 FEA structure to evaluate.
+//
+// Return Value:
+//
+// ULONG - number of bytes the FEA would require in NT format.
+//
+//--
+
+//
+// The +1 is for the zero terminator on the name, the +3 is for padding.
+//
+
+#define SmbGetNtSizeOfFea( Fea ) \
+ (ULONG)(( FIELD_OFFSET(FILE_FULL_EA_INFORMATION, EaName[0]) + \
+ (Fea)->cbName + 1 + SmbGetUshort( &(Fea)->cbValue ) + \
+ 3 ) & ~3 )
+
+//++
+//
+// ULONG
+// SmbGetNtSizeOfGea (
+// IN PFEA Gea
+// )
+//
+// Routine Description:
+//
+// This macro gets the size that would be required to hold the GEA
+// in NT format. The length is padded to account for the fact that
+// each FILE_FULL_EA_INFORMATION structure must start on a
+// longword boundary.
+//
+// Arguments:
+//
+// Gea - a pointer to the OS/2 1.2 GEA structure to evaluate.
+//
+// Return Value:
+//
+// ULONG - number of bytes the GEA would require in NT format.
+//
+//--
+
+//
+// The +1 is for the zero terminator on the name, the +3 is for padding.
+//
+
+#define SmbGetNtSizeOfGea( Gea ) \
+ (ULONG)(( FIELD_OFFSET(FILE_FULL_EA_INFORMATION, EaName[0]) + \
+ (Gea)->cbName + 1 + 3 ) & ~3 )
+
+//++
+//
+// ULONG
+// SmbGetOs2SizeOfNtFullEa (
+// IN PFILE_FULL_EA_INFORMATION NtFullEa;
+// )
+//
+// Routine Description:
+//
+// This macro gets the size a FILE_FULL_EA_INFORMATION structure would
+// require to be represented in a OS/2 1.2 style FEA.
+//
+// Arguments:
+//
+// NtFullEa - a pointer to the NT FILE_FULL_EA_INFORMATION structure
+// to evaluate.
+//
+// Return Value:
+//
+// ULONG - number of bytes requires for the FEA.
+//
+//--
+
+#define SmbGetOs2SizeOfNtFullEa( NtFullEa ) \
+ (ULONG)( sizeof(FEA) + (NtFullEa)->EaNameLength + 1 + \
+ (NtFullEa)->EaValueLength )
+
+//++
+//
+// ULONG
+// SmbGetOs2SizeOfNtGetEa (
+// IN PFILE_GET_EA_INFORMATION NtGetEa;
+// )
+//
+// Routine Description:
+//
+// This macro gets the size a FILE_GET_EA_INFORMATION structure would
+// require to be represented in a OS/2 1.2 style GEA.
+//
+// Arguments:
+//
+// NtGetEa - a pointer to the NT FILE_GET_EA_INFORMATION structure
+// to evaluate.
+//
+// Return Value:
+//
+// ULONG - number of bytes requires for the GEA.
+//
+//--
+
+//
+// The zero terminator on the name is accounted for by the szName[0]
+// field in the GEA definition.
+//
+
+#define SmbGetOs2SizeOfNtGetEa( NtGetEa ) \
+ (ULONG)( sizeof(GEA) + (NtGetEa)->EaNameLength )
+
+#endif // def _SMBMACRO_
+
diff --git a/private/inc/smbtrace.h b/private/inc/smbtrace.h
new file mode 100644
index 000000000..5780eb19a
--- /dev/null
+++ b/private/inc/smbtrace.h
@@ -0,0 +1,107 @@
+/*++
+
+Copyright (c) 1992 Microsoft Corporation
+
+Module Name:
+
+ smbtrace.h
+
+Abstract:
+
+ This module provides the interface between the SmbTrace program and
+ the kernel mode SmbTrace component.
+ The interface between the kernel mode component and the
+ server/redirector is found in nt\private\inc\smbtrsup.h
+
+Author:
+
+ Peter Gray (w-peterg) 16-Mar-92
+
+Revision History:
+
+ Stephan Mueller (t-stephm) 08-July-92
+
+ Extensions to support smbtrace in the redirector as well as the
+ server.
+
+--*/
+
+#ifndef _SMBTRACE_
+#define _SMBTRACE_
+
+//
+// The shared memory has this structure in it, used to manage the
+// table and other data shared by the kernel mode component and
+// the appliction. It is passed back to the client after creation by the
+// server during a FSCTL_???_START_SMBTRACE via an offset (pointer).
+//
+typedef struct _SMBTRACE_TABLE_HEADER {
+ ULONG HighestConsumed; // last table entry processed by app (queue head)
+ ULONG NextFree; // next free entry in table (queue tail)
+ BOOLEAN ApplicationStop; // when set, the application should halt
+} SMBTRACE_TABLE_HEADER, *PSMBTRACE_TABLE_HEADER;
+
+
+//
+// The following stucture is one entry in the shared table of
+// offsets to the received SMBs. The offsets are relative to the
+// start of the shared memory section.
+//
+typedef struct _SMBTRACE_TABLE_ENTRY {
+ ULONG BufferOffset; // location of SMB from start of shared memory
+ ULONG SmbLength; // the length of the SMB
+ ULONG NumberMissed; // number of preceding SMBs that were missed
+ PVOID SmbAddress; // real address of original SMB, if available
+} SMBTRACE_TABLE_ENTRY, *PSMBTRACE_TABLE_ENTRY;
+
+
+//
+// The following stucture is passed to the server when doing the
+// FSCtl "FSCTL_???_START_SMBTRACE". It contains configuration
+// information that will affect the way the NT server and Smbtrace
+// will interact.
+//
+typedef struct _SMBTRACE_CONFIG_PACKET_REQ {
+ BOOLEAN SingleSmbMode; // T to block on DoneEvent, F for faster.
+ CLONG Verbosity; // how much data the app intends to decode
+ // indicates how much needs to be saved
+ ULONG BufferSize; // size of shared memory used to store SMBs
+ ULONG TableSize; // number of entries in the table
+} SMBTRACE_CONFIG_PACKET_REQ, *PSMBTRACE_CONFIG_PACKET_REQ;
+
+
+//
+// Here is the response to that FSCTL.
+//
+typedef struct _SMBTRACE_CONFIG_PACKET_RESP {
+ ULONG HeaderOffset; // location of header from start of shared memory
+ ULONG TableOffset; // location of table from start of shared memory
+} SMBTRACE_CONFIG_PACKET_RESP, *PSMBTRACE_CONFIG_PACKET_RESP;
+
+
+//
+// Well-known names for objects accessible to both the server/redirector
+// and the Smbtrace application.
+//
+#define SMBTRACE_SRV_SHARED_MEMORY_NAME TEXT( "\\SmbTraceSrvMemory" )
+#define SMBTRACE_SRV_NEW_SMB_EVENT_NAME TEXT( "\\SmbTraceSrvNewSmbEvent" )
+#define SMBTRACE_SRV_DONE_SMB_EVENT_NAME TEXT( "\\SmbTraceSrvDoneSmbEvent" )
+
+#define SMBTRACE_LMR_SHARED_MEMORY_NAME TEXT( "\\SmbTraceRdrMemory" )
+#define SMBTRACE_LMR_NEW_SMB_EVENT_NAME TEXT( "\\SmbTraceRdrNewSmbEvent" )
+#define SMBTRACE_LMR_DONE_SMB_EVENT_NAME TEXT( "\\SmbTraceRdrDoneSmbEvent" )
+
+//
+// Verbosity levels indicating how much data the SmbTrace application
+// intends to decode, and consequently, how much data the server/redirector
+// must preserve for it.
+//
+#define SMBTRACE_VERBOSITY_OFF 0
+#define SMBTRACE_VERBOSITY_SINGLE_LINE 1
+#define SMBTRACE_VERBOSITY_ERROR 2
+#define SMBTRACE_VERBOSITY_HEADER 3
+#define SMBTRACE_VERBOSITY_PARAMS 4
+#define SMBTRACE_VERBOSITY_NONESSENTIAL 5
+
+#endif // _SMBTRACE_
+
diff --git a/private/inc/smbtrans.h b/private/inc/smbtrans.h
new file mode 100644
index 000000000..8a0b40b8c
--- /dev/null
+++ b/private/inc/smbtrans.h
@@ -0,0 +1,976 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ smbtrans.h
+
+Abstract:
+
+ This file contains request and response structure definitions for
+ the specific parameters of Transaction and Transaction2 SMBs.
+
+Author:
+
+ Chuck Lenzmeier (chuckl) 23-Feb-1990
+ David Treadwell (davidtr)
+
+Revision History:
+
+--*/
+
+#ifndef _SMBTRANS_
+#define _SMBTRANS_
+
+//#include <nt.h>
+
+//#include <smbtypes.h>
+//#include <smb.h>
+
+//
+// Force misalignment of the following structures
+//
+
+#ifndef NO_PACKING
+#include <packon.h>
+#endif // ndef NO_PACKING
+
+
+
+//
+// Named pipe function codes
+//
+
+#define TRANS_SET_NMPIPE_STATE 0x01
+#define TRANS_RAW_READ_NMPIPE 0x11
+#define TRANS_QUERY_NMPIPE_STATE 0x21
+#define TRANS_QUERY_NMPIPE_INFO 0x22
+#define TRANS_PEEK_NMPIPE 0x23
+#define TRANS_TRANSACT_NMPIPE 0x26
+#define TRANS_RAW_WRITE_NMPIPE 0x31
+#define TRANS_READ_NMPIPE 0x36
+#define TRANS_WRITE_NMPIPE 0x37
+#define TRANS_WAIT_NMPIPE 0x53
+#define TRANS_CALL_NMPIPE 0x54
+
+//
+// Mailslot function code
+//
+
+#define TRANS_MAILSLOT_WRITE 0x01
+
+//
+// Transaction2 function codes
+//
+
+#define TRANS2_OPEN2 0x00
+#define TRANS2_FIND_FIRST2 0x01
+#define TRANS2_FIND_NEXT2 0x02
+#define TRANS2_QUERY_FS_INFORMATION 0x03
+#define TRANS2_SET_FS_INFORMATION 0x04
+#define TRANS2_QUERY_PATH_INFORMATION 0x05
+#define TRANS2_SET_PATH_INFORMATION 0x06
+#define TRANS2_QUERY_FILE_INFORMATION 0x07
+#define TRANS2_SET_FILE_INFORMATION 0x08
+#define TRANS2_FSCTL 0x09
+#define TRANS2_IOCTL2 0x0A
+#define TRANS2_FIND_NOTIFY_FIRST 0x0B
+#define TRANS2_FIND_NOTIFY_NEXT 0x0C
+#define TRANS2_CREATE_DIRECTORY 0x0D
+#define TRANS2_SESSION_SETUP 0x0E
+#define TRANS2_QUERY_FS_INFORMATION_FID 0x0F
+#define TRANS2_GET_DFS_REFERRAL 0x10
+#define TRANS2_REPORT_DFS_INCONSISTENCY 0x11
+
+#define TRANS2_MAX_FUNCTION 0x11
+
+//
+// Nt Transaction function codes
+//
+
+#define NT_TRANSACT_MIN_FUNCTION 1
+
+#define NT_TRANSACT_CREATE 1
+#define NT_TRANSACT_IOCTL 2
+#define NT_TRANSACT_SET_SECURITY_DESC 3
+#define NT_TRANSACT_NOTIFY_CHANGE 4
+#define NT_TRANSACT_RENAME 5
+#define NT_TRANSACT_QUERY_SECURITY_DESC 6
+
+#define NT_TRANSACT_MAX_FUNCTION 6
+
+//
+// File information levels
+//
+
+#define SMB_INFO_STANDARD 1
+#define SMB_INFO_QUERY_EA_SIZE 2
+#define SMB_INFO_SET_EAS 2
+#define SMB_INFO_QUERY_EAS_FROM_LIST 3
+#define SMB_INFO_QUERY_ALL_EAS 4 // undocumented but supported
+#define SMB_INFO_QUERY_FULL_NAME 5 // never sent by redir
+#define SMB_INFO_IS_NAME_VALID 6
+
+//
+// NT extension to file info levels
+//
+
+#define SMB_QUERY_FILE_BASIC_INFO 0x101
+#define SMB_QUERY_FILE_STANDARD_INFO 0x102
+#define SMB_QUERY_FILE_EA_INFO 0x103
+#define SMB_QUERY_FILE_NAME_INFO 0x104
+#define SMB_QUERY_FILE_ALLOCATION_INFO 0x105
+#define SMB_QUERY_FILE_END_OF_FILEINFO 0x106
+#define SMB_QUERY_FILE_ALL_INFO 0x107
+#define SMB_QUERY_FILE_ALT_NAME_INFO 0x108
+#define SMB_QUERY_FILE_STREAM_INFO 0x109
+#define SMB_QUERY_FILE_OLE_ALL_INFO 0x10A
+#define SMB_QUERY_FILE_COMPRESSION_INFO 0x10B
+#define SMB_QUERY_FILE_OLE_INFO 0x10C
+
+#define SMB_SET_FILE_BASIC_INFO 0x101
+#define SMB_SET_FILE_DISPOSITION_INFO 0x102
+#define SMB_SET_FILE_ALLOCATION_INFO 0x103
+#define SMB_SET_FILE_END_OF_FILE_INFO 0x104
+#define SMB_SET_FILE_OLE_CLASSID_INFO 0x105
+#define SMB_SET_FILE_OLE_STATE_BITS_INFO 0x106
+#define SMB_SET_FILE_OBJECTID_INFO 0x107
+#define SMB_SET_FILE_CONTENT_INDEX_INFO 0x108
+#define SMB_SET_FILE_INHERIT_CONTENT_INDEX_INFO 0x109
+#define SMB_SET_FILE_OLE_INFO 0x10A
+
+#define SMB_QUERY_FS_LABEL_INFO 0x101
+#define SMB_QUERY_FS_VOLUME_INFO 0x102
+#define SMB_QUERY_FS_SIZE_INFO 0x103
+#define SMB_QUERY_FS_DEVICE_INFO 0x104
+#define SMB_QUERY_FS_ATTRIBUTE_INFO 0x105
+#define SMB_QUERY_FS_QUOTA_INFO 0x106
+#define SMB_QUERY_FS_CONTROL_INFO 0x107
+
+//
+// Volume information levels.
+//
+
+#define SMB_INFO_ALLOCATION 1
+#define SMB_INFO_VOLUME 2
+
+//
+// Rename2 information levels.
+//
+
+#define SMB_NT_RENAME_SET_COPY_ON_WRITE 0x101
+#define SMB_NT_RENAME_MOVE_CLUSTER_INFO 0x102
+#define SMB_NT_RENAME_SET_LINK_INFO 0x103
+#define SMB_NT_RENAME_RENAME_FILE 0x104 // Server internal
+#define SMB_NT_RENAME_MOVE_FILE 0x105 // Server internal
+
+
+#ifdef INCLUDE_SMB_CAIRO
+
+//
+// protocol for sessionsetup as trans2
+// function is srvsmbsessionsetup (int srv\smbtrans.c)
+// #define TRANS2_SESSION_SETUP 0x0E
+//
+
+typedef struct _REQ_CAIRO_TRANS2_SESSION_SETUP {
+ UCHAR WordCount; // Count of parameter words = 6
+ UCHAR Pad; // So things are aligned
+ _USHORT ( MaxBufferSize ); // Max transmit buffer size
+ _USHORT ( MaxMpxCount ); // Max pending multiplexed requests
+ _USHORT ( VcNumber ); // 0 = first (only), nonzero=additional VC number
+ _ULONG ( SessionKey ); // Session key (valid iff VcNumber != 0)
+ _ULONG ( Capabilities ); // Server capabilities
+ _ULONG ( BufferLength );
+ UCHAR Buffer[1];
+ //UCHAR KerberosTicket[]; // The KerberosTicket
+} REQ_CAIRO_TRANS2_SESSION_SETUP;
+typedef REQ_CAIRO_TRANS2_SESSION_SETUP *PREQ_CAIRO_TRANS2_SESSION_SETUP; // *** NOT SMB_UNALIGNED!
+
+typedef struct _RESP_CAIRO_TRANS2_SESSION_SETUP {
+ UCHAR WordCount; // Count of parameter words = 0
+ UCHAR Pad; // So things are aligned
+ _USHORT( Uid ); // Unauthenticated user id
+ _ULONG ( BufferLength );
+ UCHAR Buffer[1];
+ //UCHAR KerberosTicket[]; // The KerberosTicket
+} RESP_CAIRO_TRANS2_SESSION_SETUP;
+typedef RESP_CAIRO_TRANS2_SESSION_SETUP *PRESP_CAIRO_TRANS2_SESSION_SETUP; // *** NOT SMB_UNALIGNED!
+
+typedef struct _REQ_QUERY_FS_INFORMATION_FID {
+ _USHORT( InformationLevel );
+ _USHORT( Fid );
+} REQ_QUERY_FS_INFORMATION_FID;
+typedef REQ_QUERY_FS_INFORMATION_FID SMB_UNALIGNED *PREQ_QUERY_FS_INFORMATION_FID;
+
+//
+// Setup words for NT I/O control request
+//
+
+struct _TempSetup {
+ _ULONG( FunctionCode );
+ _USHORT( Fid );
+ BOOLEAN IsFsctl;
+ UCHAR IsFlags;
+};
+
+typedef struct _REQ_CAIRO_IO_CONTROL {
+ _USHORT( Trans2Function ); // used for Trans2, but not NT transact
+ _ULONG( FunctionCode );
+ _USHORT( Fid );
+ BOOLEAN IsFsctl;
+ UCHAR IsFlags;
+} REQ_CAIRO_IO_CONTROL;
+typedef REQ_CAIRO_IO_CONTROL SMB_UNALIGNED *PREQ_CAIRO_IO_CONTROL;
+
+//
+// For Cairo remoting general FSCTLS
+//
+
+#define IsTID 1
+
+
+#endif // INCLUDE_SMB_CAIRO
+
+//
+// Dfs Transactions
+//
+
+//
+// Request for Referral.
+//
+typedef struct {
+ USHORT MaxReferralLevel; // Latest version of referral understood
+ UCHAR RequestFileName[1]; // Dfs name for which referral is sought
+} REQ_GET_DFS_REFERRAL;
+typedef REQ_GET_DFS_REFERRAL SMB_UNALIGNED *PREQ_GET_DFS_REFERRAL;
+
+//
+// The format of an individual referral contains version and length information
+// allowing the client to skip referrals it does not understand.
+//
+// !! All referral elements must have VersionNumber and Size as the first 2 elements !!
+//
+
+typedef struct {
+ USHORT VersionNumber; // == 1
+ USHORT Size; // Size of this whole element
+ USHORT ServerType; // Type of server: 0 == Don't know, 1 == SMB, 2 == Netware
+ struct {
+ USHORT StripPath : 1; // Strip off PathConsumed characters from front of
+ // DfsPathName prior to submitting name to UncShareName
+ };
+ WCHAR ShareName[1]; // The server+share name go right here. NULL terminated.
+} DFS_REFERRAL_V1;
+typedef DFS_REFERRAL_V1 SMB_UNALIGNED *PDFS_REFERRAL_V1;
+
+typedef struct {
+ USHORT VersionNumber; // == 2
+ USHORT Size; // Size of this whole element
+ USHORT ServerType; // Type of server: 0 == Don't know, 1 == SMB, 2 == Netware
+ struct {
+ USHORT StripPath : 1; // Strip off PathConsumed characters from front of
+ // DfsPathName prior to submitting name to UncShareName
+ };
+ ULONG Proximity; // Hint of transport cost
+ ULONG TimeToLive; // In number of seconds
+ USHORT DfsPathOffset; // Offset from beginning of this element to Path to access
+ USHORT DfsAlternatePathOffset; // Offset from beginning of this element to 8.3 path
+ USHORT NetworkAddressOffset; // Offset from beginning of this element to Network path
+} DFS_REFERRAL_V2;
+typedef DFS_REFERRAL_V2 SMB_UNALIGNED *PDFS_REFERRAL_V2;
+
+typedef struct {
+ USHORT PathConsumed; // Number of WCHARs consumed in DfsPathName
+ USHORT NumberOfReferrals; // Number of referrals contained here
+ struct {
+ ULONG ReferralServers : 1; // Elements in Referrals[] are referral servers
+ ULONG StorageServers : 1; // Elements in Referrals[] are storage servers
+ };
+ union { // The vector of referrals
+ DFS_REFERRAL_V1 v1;
+ DFS_REFERRAL_V2 v2;
+ } Referrals[1]; // [ NumberOfReferrals ]
+
+ //
+ // WCHAR StringBuffer[]; // Used by DFS_REFERRAL_V2
+ //
+
+} RESP_GET_DFS_REFERRAL;
+typedef RESP_GET_DFS_REFERRAL SMB_UNALIGNED *PRESP_GET_DFS_REFERRAL;
+
+//
+// During Dfs operations, a client may discover a knowledge inconsistency in the Dfs.
+// The parameter portion of the TRANS2_REPORT_DFS_INCONSISTENCY SMB is
+// encoded in this way
+//
+
+typedef struct {
+ UCHAR RequestFileName[1]; // Dfs name for which inconsistency is being reported
+ union {
+ DFS_REFERRAL_V1 v1; // The single referral thought to be in error
+ } Referral;
+} REQ_REPORT_DFS_INCONSISTENCY;
+typedef REQ_REPORT_DFS_INCONSISTENCY SMB_UNALIGNED *PREQ_REPORT_DFS_INCONSISTENCY;
+
+//
+// The client also needs to send to this server the referral which it believes to be
+// in error. The data part of this transaction contains the errant referral(s), encoded
+// as above in the DFS_REFERRAL_* structures.
+//
+
+//
+// Find First, information levels
+//
+
+#define SMB_FIND_FILE_DIRECTORY_INFO 0x101
+#define SMB_FIND_FILE_FULL_DIRECTORY_INFO 0x102
+#define SMB_FIND_FILE_NAMES_INFO 0x103
+#define SMB_FIND_FILE_BOTH_DIRECTORY_INFO 0x104
+#define SMB_FIND_FILE_OLE_DIRECTORY_INFO 0x105
+
+#ifdef INCLUDE_SMB_DIRECTORY
+
+//
+// CreateDirectory2 function code os Transaction2 SMB, see #3 page 51
+// Function is SrvSmbCreateDirectory2()
+// TRANS2_CREATE_DIRECTORY 0x0D
+//
+
+typedef struct _REQ_CREATE_DIRECTORY2 {
+ _ULONG( Reserved ); // Reserved--must be zero
+ UCHAR Buffer[1]; // Directory name to create
+} REQ_CREATE_DIRECTORY2;
+typedef REQ_CREATE_DIRECTORY2 SMB_UNALIGNED *PREQ_CREATE_DIRECTORY2;
+
+// Data bytes for CreateDirectory2 request are the extended attributes for the
+// created file.
+
+typedef struct _RESP_CREATE_DIRECTORY2 {
+ _USHORT( EaErrorOffset ); // Offset into FEAList of first error
+ // which occurred while setting EAs
+} RESP_CREATE_DIRECTORY2;
+typedef RESP_CREATE_DIRECTORY2 SMB_UNALIGNED *PRESP_CREATE_DIRECTORY2;
+
+#endif // def INCLUDE_SMB_DIRECTORY
+
+#ifdef INCLUDE_SMB_SEARCH
+
+//
+// FindFirst2 function code of Transaction2 SMB, see #3 page 22
+// Function is SrvSmbFindFirst2()
+// TRANS2_FIND_FIRST2 0x01
+//
+
+typedef struct _REQ_FIND_FIRST2 {
+ _USHORT( SearchAttributes );
+ _USHORT( SearchCount ); // Maximum number of entries to return
+ _USHORT( Flags ); // Additional information: bit set-
+ // 0 - close search after this request
+ // 1 - close search if end reached
+ // 2 - return resume keys
+ _USHORT( InformationLevel );
+ _ULONG(SearchStorageType);
+ UCHAR Buffer[1]; // File name
+} REQ_FIND_FIRST2;
+typedef REQ_FIND_FIRST2 SMB_UNALIGNED *PREQ_FIND_FIRST2;
+
+// Data bytes for Find First2 request are a list of extended attributes
+// to retrieve (a GEAList), if InformationLevel is QUERY_EAS_FROM_LIST.
+
+typedef struct _RESP_FIND_FIRST2 {
+ _USHORT( Sid ); // Search handle
+ _USHORT( SearchCount ); // Number of entries returned
+ _USHORT( EndOfSearch ); // Was last entry returned?
+ _USHORT( EaErrorOffset ); // Offset into EA list if EA error
+ _USHORT( LastNameOffset ); // Offset into data to file name of
+ // last entry, if server needs it
+ // to resume search; else 0
+} RESP_FIND_FIRST2;
+typedef RESP_FIND_FIRST2 SMB_UNALIGNED *PRESP_FIND_FIRST2;
+
+// Data bytes for Find First2 response are level-dependent information
+// about the matching files. If bit 2 in the request parameters was
+// set, each entry is preceded by a four-byte resume key.
+
+//
+// FindNext2 function code of Transaction2 SMB, see #3 page 26
+// Function is SrvSmbFindNext2()
+// TRANS2_FIND_NEXT2 0x02
+//
+
+typedef struct _REQ_FIND_NEXT2 {
+ _USHORT( Sid ); // Search handle
+ _USHORT( SearchCount ); // Maximum number of entries to return
+ _USHORT( InformationLevel );
+ _ULONG( ResumeKey ); // Value returned by previous find
+ _USHORT( Flags ); // Additional information: bit set-
+ // 0 - close search after this request
+ // 1 - close search if end reached
+ // 2 - return resume keys
+ // 3 - resume/continue, NOT rewind
+ UCHAR Buffer[1]; // Resume file name
+} REQ_FIND_NEXT2;
+typedef REQ_FIND_NEXT2 SMB_UNALIGNED *PREQ_FIND_NEXT2;
+
+// Data bytes for Find Next2 request are a list of extended attributes
+// to retrieve, if InformationLevel is QUERY_EAS_FROM_LIST.
+
+typedef struct _RESP_FIND_NEXT2 {
+ _USHORT( SearchCount ); // Number of entries returned
+ _USHORT( EndOfSearch ); // Was last entry returned?
+ _USHORT( EaErrorOffset ); // Offset into EA list if EA error
+ _USHORT( LastNameOffset ); // Offset into data to file name of
+ // last entry, if server needs it
+ // to resume search; else 0
+} RESP_FIND_NEXT2;
+typedef RESP_FIND_NEXT2 SMB_UNALIGNED *PRESP_FIND_NEXT2;
+
+// Data bytes for Find Next2 response are level-dependent information
+// about the matching files. If bit 2 in the request parameters was
+// set, each entry is preceded by a four-byte resume key.
+
+//
+// Flags for REQ_FIND_FIRST2.Flags
+//
+
+#define SMB_FIND_CLOSE_AFTER_REQUEST 0x01
+#define SMB_FIND_CLOSE_AT_EOS 0x02
+#define SMB_FIND_RETURN_RESUME_KEYS 0x04
+#define SMB_FIND_CONTINUE_FROM_LAST 0x08
+#define SMB_FIND_WITH_BACKUP_INTENT 0x10
+
+#endif // def INCLUDE_SMB_SEARCH
+
+#ifdef INCLUDE_SMB_OPEN_CLOSE
+
+//
+// Open2 function code of Transaction2 SMB, see #3 page 19
+// Function is SrvSmbOpen2()
+// TRANS2_OPEN2 0x00
+//
+// *** Note that the REQ_OPEN2 and RESP_OPEN2 structures closely
+// resemble the REQ_OPEN_ANDX and RESP_OPEN_ANDX structures.
+//
+
+typedef struct _REQ_OPEN2 {
+ _USHORT( Flags ); // Additional information: bit set-
+ // 0 - return additional info
+ // 1 - set single user total file lock
+ // 2 - server notifies consumer of
+ // actions which may change file
+ // 3 - return total length of EAs
+ _USHORT( DesiredAccess ); // File open mode
+ _USHORT( SearchAttributes ); // *** ignored
+ _USHORT( FileAttributes );
+ _ULONG( CreationTimeInSeconds );
+ _USHORT( OpenFunction );
+ _ULONG( AllocationSize ); // Bytes to reserve on create or truncate
+ _USHORT( Reserved )[5]; // Pad through OpenAndX's Timeout,
+ // Reserved, and ByteCount
+ UCHAR Buffer[1]; // File name
+} REQ_OPEN2;
+typedef REQ_OPEN2 SMB_UNALIGNED *PREQ_OPEN2;
+
+// Data bytes for Open2 request are the extended attributes for the
+// created file.
+
+typedef struct _RESP_OPEN2 {
+ _USHORT( Fid ); // File handle
+ _USHORT( FileAttributes );
+ _ULONG( CreationTimeInSeconds );
+ _ULONG( DataSize ); // Current file size
+ _USHORT( GrantedAccess ); // Access permissions actually allowed
+ _USHORT( FileType );
+ _USHORT( DeviceState ); // state of IPC device (e.g. pipe)
+ _USHORT( Action ); // Action taken
+ _ULONG( ServerFid ); // Server unique file id
+ _USHORT( EaErrorOffset ); // Offset into EA list if EA error
+ _ULONG( EaLength ); // Total EA length for opened file
+} RESP_OPEN2;
+typedef RESP_OPEN2 SMB_UNALIGNED *PRESP_OPEN2;
+
+// The Open2 response has no data bytes.
+
+
+#endif // def INCLUDE_SMB_OPEN_CLOSE
+
+#ifdef INCLUDE_SMB_MISC
+
+//
+// QueryFsInformation function code of Transaction2 SMB, see #3 page 30
+// Function is SrvSmbQueryFsInformation()
+// TRANS2_QUERY_FS_INFORMATION 0x03
+//
+
+typedef struct _REQ_QUERY_FS_INFORMATION {
+ _USHORT( InformationLevel );
+} REQ_QUERY_FS_INFORMATION;
+typedef REQ_QUERY_FS_INFORMATION SMB_UNALIGNED *PREQ_QUERY_FS_INFORMATION;
+
+// No data bytes for Query FS Information request.
+
+//typedef struct _RESP_QUERY_FS_INFORMATION {
+//} RESP_QUERY_FS_INFORMATION;
+//typedef RESP_QUERY_FS_INFORMATION SMB_UNALIGNED *PRESP_QUERY_FS_INFORMATION;
+
+// Data bytes for Query FS Information response are level-dependent
+// information about the specified volume.
+
+//
+// SetFSInformation function code of Transaction2 SMB, see #3 page 31
+// Function is SrvSmbSetFSInformation()
+// TRANS2_SET_PATH_INFORMATION 0x04
+//
+
+typedef struct _REQ_SET_FS_INFORMATION {
+ _USHORT( InformationLevel );
+} REQ_SET_FS_INFORMATION;
+typedef REQ_SET_FS_INFORMATION SMB_UNALIGNED *PREQ_SET_FS_INFORMATION;
+
+// Data bytes for Set FS Information request are level-dependant
+// information about the specified volume.
+
+//typedef struct _RESP_SET_FS_INFORMATION {
+//} RESP_SET_FS_INFORMATION;
+//typedef RESP_SET_FS_INFORMATION SMB_UNALIGNED *PRESP_SET_FS_INFORMATION;
+
+// The Set FS Information response has no data bytes.
+
+#endif // def INCLUDE_SMB_MISC
+
+#ifdef INCLUDE_SMB_QUERY_SET
+
+//
+// QueryPathInformation function code of Transaction2 SMB, see #3 page 33
+// Function is SrvSmbQueryPathInformation()
+// TRANS2_QUERY_PATH_INFORMATION 0x05
+//
+
+typedef struct _REQ_QUERY_PATH_INFORMATION {
+ _USHORT( InformationLevel );
+ _ULONG( Reserved ); // Must be zero
+ UCHAR Buffer[1]; // File name
+} REQ_QUERY_PATH_INFORMATION;
+typedef REQ_QUERY_PATH_INFORMATION SMB_UNALIGNED *PREQ_QUERY_PATH_INFORMATION;
+
+// Data bytes for Query Path Information request are a list of extended
+// attributes to retrieve, if InformationLevel is QUERY_EAS_FROM_LIST.
+
+typedef struct _RESP_QUERY_PATH_INFORMATION {
+ _USHORT( EaErrorOffset ); // Offset into EA list if EA error
+} RESP_QUERY_PATH_INFORMATION;
+typedef RESP_QUERY_PATH_INFORMATION SMB_UNALIGNED *PRESP_QUERY_PATH_INFORMATION;
+
+// Data bytes for Query Path Information response are level-dependent
+// information about the specified path/file.
+
+//
+// SetPathInformation function code of Transaction2 SMB, see #3 page 35
+// Function is SrvSmbSetPathInformation()
+// TRANS2_SET_PATH_INFORMATION 0x06
+//
+
+typedef struct _REQ_SET_PATH_INFORMATION {
+ _USHORT( InformationLevel );
+ _ULONG( Reserved ); // Must be zero
+ UCHAR Buffer[1]; // File name
+} REQ_SET_PATH_INFORMATION;
+typedef REQ_SET_PATH_INFORMATION SMB_UNALIGNED *PREQ_SET_PATH_INFORMATION;
+
+// Data bytes for Set Path Information request are either file information
+// and attributes or a list of extended attributes for the file.
+
+typedef struct _RESP_SET_PATH_INFORMATION {
+ _USHORT( EaErrorOffset ); // Offset into EA list if EA error
+} RESP_SET_PATH_INFORMATION;
+typedef RESP_SET_PATH_INFORMATION SMB_UNALIGNED *PRESP_SET_PATH_INFORMATION;
+
+// The Set Path Information response has no data bytes.
+
+//
+// QueryFileInformation function code of Transaction2 SMB, see #3 page 37
+// Function is SrvSmbQueryFileInformation()
+// TRANS2_QUERY_FILE_INFORMATION 0x07
+//
+
+typedef struct _REQ_QUERY_FILE_INFORMATION {
+ _USHORT( Fid ); // File handle
+ _USHORT( InformationLevel );
+} REQ_QUERY_FILE_INFORMATION;
+typedef REQ_QUERY_FILE_INFORMATION SMB_UNALIGNED *PREQ_QUERY_FILE_INFORMATION;
+
+// Data bytes for Query File Information request are a list of extended
+// attributes to retrieve, if InformationLevel is QUERY_EAS_FROM_LIST.
+
+typedef struct _RESP_QUERY_FILE_INFORMATION {
+ _USHORT( EaErrorOffset ); // Offset into EA list if EA error
+} RESP_QUERY_FILE_INFORMATION;
+typedef RESP_QUERY_FILE_INFORMATION SMB_UNALIGNED *PRESP_QUERY_FILE_INFORMATION;
+
+// Data bytes for Query File Information response are level-dependent
+// information about the specified path/file.
+
+//
+// SetFileInformation function code of Transaction2 SMB, see #3 page 39
+// Function is SrvSmbSetFileInformation()
+// TRANS2_SET_FILE_INFORMATION 0x08
+//
+
+typedef struct _REQ_SET_FILE_INFORMATION {
+ _USHORT( Fid ); // File handle
+ _USHORT( InformationLevel );
+ _USHORT( Flags ); // File I/O control flags: bit set-
+ // 4 - write through
+ // 5 - no cache
+} REQ_SET_FILE_INFORMATION;
+typedef REQ_SET_FILE_INFORMATION SMB_UNALIGNED *PREQ_SET_FILE_INFORMATION;
+
+// Data bytes for Set File Information request are either file information
+// and attributes or a list of extended attributes for the file.
+
+typedef struct _RESP_SET_FILE_INFORMATION {
+ _USHORT( EaErrorOffset ); // Offset into EA list if EA error
+} RESP_SET_FILE_INFORMATION;
+typedef RESP_SET_FILE_INFORMATION SMB_UNALIGNED *PRESP_SET_FILE_INFORMATION;
+
+// The Set File Information response has no data bytes.
+
+#endif // def INCLUDE_SMB_QUERY_SET
+
+//
+// Opcodes for Mailslot transactions. Not all filled in at present.
+// WARNING ... the info here on mailslots (opcode and smb struct)
+// is duplicated in net/h/mslotsmb.h
+//
+
+#define MS_WRITE_OPCODE 1
+
+typedef struct _SMB_TRANSACT_MAILSLOT {
+ UCHAR WordCount; // Count of data bytes; value = 17
+ _USHORT( TotalParameterCount ); // Total parameter bytes being sent
+ _USHORT( TotalDataCount ); // Total data bytes being sent
+ _USHORT( MaxParameterCount ); // Max parameter bytes to return
+ _USHORT( MaxDataCount ); // Max data bytes to return
+ UCHAR MaxSetupCount; // Max setup words to return
+ UCHAR Reserved;
+ _USHORT( Flags ); // Additional information:
+ // bit 0 - unused
+ // bit 1 - one-way transacion (no resp)
+ _ULONG( Timeout );
+ _USHORT( Reserved1 );
+ _USHORT( ParameterCount ); // Parameter bytes sent this buffer
+ _USHORT( ParameterOffset ); // Offset (from header start) to params
+ _USHORT( DataCount ); // Data bytes sent this buffer
+ _USHORT( DataOffset ); // Offset (from header start) to data
+ UCHAR SetupWordCount; // = 3
+ UCHAR Reserved2; // Reserved (pad above to word)
+ _USHORT( Opcode ); // 1 -- Write Mailslot
+ _USHORT( Priority ); // Priority of transaction
+ _USHORT( Class ); // Class: 1 = reliable, 2 = unreliable
+ _USHORT( ByteCount ); // Count of data bytes
+ UCHAR Buffer[1]; // Buffer containing:
+ //UCHAR MailslotName[]; // "\MAILSLOT\<name>0"
+ //UCHAR Pad[] // Pad to SHORT or LONG
+ //UCHAR Data[]; // Data to write to mailslot
+} SMB_TRANSACT_MAILSLOT;
+typedef SMB_TRANSACT_MAILSLOT SMB_UNALIGNED *PSMB_TRANSACT_MAILSLOT;
+
+typedef struct _SMB_TRANSACT_NAMED_PIPE {
+ UCHAR WordCount; // Count of data bytes; value = 16
+ _USHORT( TotalParameterCount ); // Total parameter bytes being sent
+ _USHORT( TotalDataCount ); // Total data bytes being sent
+ _USHORT( MaxParameterCount ); // Max parameter bytes to return
+ _USHORT( MaxDataCount ); // Max data bytes to return
+ UCHAR MaxSetupCount; // Max setup words to return
+ UCHAR Reserved;
+ _USHORT( Flags ); // Additional information:
+ // bit 0 - also disconnect TID in Tid
+ // bit 1 - one-way transacion (no resp)
+ _ULONG( Timeout );
+ _USHORT( Reserved1 );
+ _USHORT( ParameterCount );
+ // Buffer containing:
+ //UCHAR PipeName[]; // "\PIPE\<name>0"
+ //UCHAR Pad[] // Pad to SHORT or LONG
+ //UCHAR Param[]; // Parameter bytes (# = ParameterCount)
+ //UCHAR Pad1[] // Pad to SHORT or LONG
+ //UCHAR Data[]; // Data bytes (# = DataCount)
+} SMB_TRANSACT_NAMED_PIPE;
+typedef SMB_TRANSACT_NAMED_PIPE SMB_UNALIGNED *PSMB_TRANSACT_NAMED_PIPE;
+
+
+//
+// Transaction - QueryInformationNamedPipe, Level 1, output data format
+//
+
+typedef struct _NAMED_PIPE_INFORMATION_1 {
+ _USHORT( OutputBufferSize );
+ _USHORT( InputBufferSize );
+ UCHAR MaximumInstances;
+ UCHAR CurrentInstances;
+ UCHAR PipeNameLength;
+ UCHAR PipeName[1];
+} NAMED_PIPE_INFORMATION_1;
+typedef NAMED_PIPE_INFORMATION_1 SMB_UNALIGNED *PNAMED_PIPE_INFORMATION_1;
+
+//
+// Transaction - PeekNamedPipe, output format
+//
+
+typedef struct _RESP_PEEK_NMPIPE {
+ _USHORT( ReadDataAvailable );
+ _USHORT( MessageLength );
+ _USHORT( NamedPipeState );
+ //UCHAR Pad[];
+ //UCHAR Data[];
+} RESP_PEEK_NMPIPE;
+typedef RESP_PEEK_NMPIPE SMB_UNALIGNED *PRESP_PEEK_NMPIPE;
+
+//
+// Define SMB pipe handle state bits used by Query/SetNamedPipeHandleState
+//
+// These number are the bit location of the fields in the handle state.
+//
+
+#define PIPE_COMPLETION_MODE_BITS 15
+#define PIPE_PIPE_END_BITS 14
+#define PIPE_PIPE_TYPE_BITS 10
+#define PIPE_READ_MODE_BITS 8
+#define PIPE_MAXIMUM_INSTANCES_BITS 0
+
+/* DosPeekNmPipe() pipe states */
+
+#define PIPE_STATE_DISCONNECTED 0x0001
+#define PIPE_STATE_LISTENING 0x0002
+#define PIPE_STATE_CONNECTED 0x0003
+#define PIPE_STATE_CLOSING 0x0004
+
+/* DosCreateNPipe and DosQueryNPHState state */
+
+#define SMB_PIPE_READMODE_BYTE 0x0000
+#define SMB_PIPE_READMODE_MESSAGE 0x0100
+#define SMB_PIPE_TYPE_BYTE 0x0000
+#define SMB_PIPE_TYPE_MESSAGE 0x0400
+#define SMB_PIPE_END_CLIENT 0x0000
+#define SMB_PIPE_END_SERVER 0x4000
+#define SMB_PIPE_WAIT 0x0000
+#define SMB_PIPE_NOWAIT 0x8000
+#define SMB_PIPE_UNLIMITED_INSTANCES 0x00FF
+
+
+//
+// Pipe name string for conversion between SMB and NT formats.
+//
+
+#define SMB_PIPE_PREFIX "\\PIPE"
+#define UNICODE_SMB_PIPE_PREFIX L"\\PIPE"
+#define CANONICAL_PIPE_PREFIX "PIPE\\"
+#define NT_PIPE_PREFIX L"\\Device\\NamedPipe"
+
+#define SMB_PIPE_PREFIX_LENGTH (sizeof(SMB_PIPE_PREFIX) - 1)
+#define UNICODE_SMB_PIPE_PREFIX_LENGTH \
+ (sizeof(UNICODE_SMB_PIPE_PREFIX) - sizeof(WCHAR))
+#define CANONICAL_PIPE_PREFIX_LENGTH (sizeof(CANONICAL_PIPE_PREFIX) - 1)
+#define NT_PIPE_PREFIX_LENGTH (sizeof(NT_PIPE_PREFIX) - sizeof(WCHAR))
+
+//
+// Mailslot name strings.
+//
+
+#define SMB_MAILSLOT_PREFIX "\\MAILSLOT"
+#define UNICODE_SMB_MAILSLOT_PREFIX L"\\MAILSLOT"
+
+#define SMB_MAILSLOT_PREFIX_LENGTH (sizeof(SMB_MAILSLOT_PREFIX) - 1)
+#define UNICODE_SMB_MAILSLOT_PREFIX_LENGTH \
+ (sizeof(UNICODE_SMB_MAILSLOT_PREFIX) - sizeof(WCHAR))
+
+//
+// NT Transaction subfunctions
+//
+
+#ifdef INCLUDE_SMB_OPEN_CLOSE
+
+typedef struct _REQ_CREATE_WITH_SD_OR_EA {
+ _ULONG( Flags ); // Creation flags
+ _ULONG( RootDirectoryFid ); // Optional directory for relative open
+ ACCESS_MASK DesiredAccess; // Desired access (NT format)
+ LARGE_INTEGER AllocationSize; // The initial allocation size in bytes
+ _ULONG( FileAttributes ); // The file attributes
+ _ULONG( ShareAccess ); // The share access
+ _ULONG( CreateDisposition ); // Action to take if file exists or not
+ _ULONG( CreateOptions ); // Options for creating a new file
+ _ULONG( SecurityDescriptorLength );// Length of SD in bytes
+ _ULONG( EaLength ); // Length of EA in bytes
+ _ULONG( NameLength ); // Length of name in characters
+ _ULONG( ImpersonationLevel ); // Security QOS information
+ UCHAR SecurityFlags; // Security QOS information
+ UCHAR Buffer[1];
+ //UCHAR Name[]; // The name of the file (not NUL terminated)
+} REQ_CREATE_WITH_SD_OR_EA;
+typedef REQ_CREATE_WITH_SD_OR_EA SMB_UNALIGNED *PREQ_CREATE_WITH_SD_OR_EA;
+
+//
+// Data format:
+// UCHAR SecurityDesciptor[];
+// UCHAR Pad1[]; // Pad to LONG
+// UCHAR EaList[];
+//
+
+typedef struct _RESP_CREATE_WITH_SD_OR_EA {
+ UCHAR OplockLevel; // The oplock level granted
+ UCHAR Reserved;
+ _USHORT( Fid ); // The file ID
+ _ULONG( CreateAction ); // The action taken
+ _ULONG( EaErrorOffset ); // Offset of the EA error
+ TIME CreationTime; // The time the file was created
+ TIME LastAccessTime; // The time the file was accessed
+ TIME LastWriteTime; // The time the file was last written
+ TIME ChangeTime; // The time the file was last changed
+ _ULONG( FileAttributes ); // The file attributes
+ LARGE_INTEGER AllocationSize; // The number of byes allocated
+ LARGE_INTEGER EndOfFile; // The end of file offset
+ _USHORT( FileType );
+ _USHORT( DeviceState ); // state of IPC device (e.g. pipe)
+ BOOLEAN Directory; // TRUE if this is a directory
+} RESP_CREATE_WITH_SD_OR_EA;
+typedef RESP_CREATE_WITH_SD_OR_EA SMB_UNALIGNED *PRESP_CREATE_WITH_SD_OR_EA;
+
+// No data bytes for the response
+
+#endif // INCLUDE_SMB_OPEN_CLOSE
+
+//
+// Setup words for NT I/O control request
+//
+
+typedef struct _REQ_NT_IO_CONTROL {
+ _ULONG( FunctionCode );
+ _USHORT( Fid );
+ BOOLEAN IsFsctl;
+ UCHAR IsFlags;
+} REQ_NT_IO_CONTROL;
+typedef REQ_NT_IO_CONTROL SMB_UNALIGNED *PREQ_NT_IO_CONTROL;
+
+//
+// Request parameter bytes - The first buffer
+// Request data bytes - The second buffer
+//
+
+//
+// NT I/O Control response:
+//
+// Setup Words: None.
+// Parameter Bytes: First buffer.
+// Data Bytes: Second buffer.
+//
+
+//
+// NT Notify directory change
+//
+
+// Request Setup Words
+
+typedef struct _REQ_NOTIFY_CHANGE {
+ _ULONG( CompletionFilter ); // Specifies operation to monitor
+ _USHORT( Fid ); // Fid of directory to monitor
+ BOOLEAN WatchTree; // TRUE = watch all subdirectories too
+ UCHAR Reserved; // MBZ
+} REQ_NOTIFY_CHANGE;
+typedef REQ_NOTIFY_CHANGE SMB_UNALIGNED *PREQ_NOTIFY_CHANGE;
+
+//
+// Request parameter bytes: None
+// Request data bytes: None
+//
+
+//
+// NT Notify directory change response
+//
+// Setup words: None.
+// Parameter bytes: The change data buffer.
+// Data bytes: None.
+//
+
+//
+// NT Set Security Descriptor request
+//
+// Setup words: REQ_SET_SECURITY_DESCIPTOR.
+// Parameter Bytes: None.
+// Data Bytes: The Security Descriptor data.
+//
+
+typedef struct _REQ_SET_SECURITY_DESCRIPTOR {
+ _USHORT( Fid ); // FID of target
+ _USHORT( Reserved ); // MBZ
+ _ULONG( SecurityInformation ); // Fields of SD that to set
+} REQ_SET_SECURITY_DESCRIPTOR;
+typedef REQ_SET_SECURITY_DESCRIPTOR SMB_UNALIGNED *PREQ_SET_SECURITY_DESCRIPTOR;
+
+//
+// NT Set Security Desciptor response
+//
+// Setup words: None.
+// Parameter Bytes: None.
+// Data Bytes: None.
+//
+
+//
+// NT Query Security Descriptor request
+//
+// Setup words: None.
+// Parameter Bytes: REQ_QUERY_SECURITY_DESCRIPTOR.
+// Data Bytes: None.
+//
+
+typedef struct _REQ_QUERY_SECURITY_DESCRIPTOR {
+ _USHORT( Fid ); // FID of target
+ _USHORT( Reserved ); // MBZ
+ _ULONG( SecurityInformation ); // Fields of SD that to query
+} REQ_QUERY_SECURITY_DESCRIPTOR;
+typedef REQ_QUERY_SECURITY_DESCRIPTOR SMB_UNALIGNED *PREQ_QUERY_SECURITY_DESCRIPTOR;
+
+//
+// NT Query Security Desciptor response
+//
+// Parameter bytes: RESP_QUERY_SECURITY_DESCRIPTOR
+// Data Bytes: The Security Descriptor data.
+//
+
+typedef struct _RESP_QUERY_SECURITY_DESCRIPTOR {
+ _ULONG( LengthNeeded ); // Size of data buffer required for SD
+} RESP_QUERY_SECURITY_DESCRIPTOR;
+typedef RESP_QUERY_SECURITY_DESCRIPTOR SMB_UNALIGNED *PRESP_QUERY_SECURITY_DESCRIPTOR;
+
+//
+// NT Rename file
+//
+// Setup words: None
+// Parameters bytes: REQ_NT_RENAME
+// Data bytes: None
+//
+
+typedef struct _REQ_NT_RENAME {
+ _USHORT( Fid ); // FID of file to rename
+ _USHORT( RenameFlags ); // defined below
+ UCHAR NewName[]; // New file name.
+} REQ_NT_RENAME;
+typedef REQ_NT_RENAME SMB_UNALIGNED *PREQ_NT_RENAME;
+
+//
+// Rename flags defined
+//
+
+#define SMB_RENAME_REPLACE_IF_EXISTS 1
+
+//
+// Turn structure packing back off
+//
+
+#ifndef NO_PACKING
+#include <packoff.h>
+#endif // ndef NO_PACKING
+
+
+#endif // ndef _SMBTRANS_
diff --git a/private/inc/smbtrsup.h b/private/inc/smbtrsup.h
new file mode 100644
index 000000000..ee9298130
--- /dev/null
+++ b/private/inc/smbtrsup.h
@@ -0,0 +1,230 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ smbtrsup.h
+
+Abstract:
+
+ This module provides the interface to the kernel mode SmbTrace
+ component within the LanMan server and redirector.
+ The interface providing user-level access to SmbTrace is found in
+ nt\private\inc\smbtrace.h
+
+Author:
+
+ Stephan Mueller (t-stephm) 20-July-1992
+
+Revision History:
+
+ 20-July-1992 t-stephm
+
+ Created
+
+--*/
+
+#ifndef _SMBTRSUP_
+#define _SMBTRSUP_
+
+//
+// Selection of components in which SmbTrace will run.
+// Pass the appropriate value to SmbTraceStart and SmbTraceStop,
+// and test the appropriate element of SmbTraceActive and
+// SmbTraceTransitioning. The actual tracing calls do not require
+// a Component parameter as it is implied by the routine being called.
+//
+
+typedef enum _SMBTRACE_COMPONENT {
+ SMBTRACE_SERVER,
+ SMBTRACE_REDIRECTOR
+} SMBTRACE_COMPONENT;
+
+
+extern BOOLEAN SmbTraceActive[];
+
+//
+// SmbTrace support exported routines
+//
+
+
+//
+// Initialize the SMB tracing package
+//
+NTSTATUS
+SmbTraceInitialize (
+ IN SMBTRACE_COMPONENT Component
+ );
+
+//
+// Terminate the SMB tracing package
+//
+VOID
+SmbTraceTerminate (
+ IN SMBTRACE_COMPONENT Component
+ );
+
+//
+// Start tracing
+//
+NTSTATUS
+SmbTraceStart(
+ IN ULONG InputBufferLength,
+ IN ULONG OutputBufferLength,
+ IN OUT PVOID ConfigInOut,
+ IN PFILE_OBJECT FileObject,
+ IN SMBTRACE_COMPONENT Component
+ );
+
+//
+// Stop tracing
+//
+NTSTATUS
+SmbTraceStop(
+ IN PFILE_OBJECT FileObject OPTIONAL,
+ IN SMBTRACE_COMPONENT Component
+ );
+
+
+//
+// VOID
+// SMBTRACE_SRV(
+// IN PMDL SmbMdl,
+// )
+//
+// Routine description:
+//
+// If SmbTrace is turned on, this macro calls SmbTraceCompleteSrv
+// to send the SMB to the smbtrace program in user mode. This routine
+// is specific to the LanMan server. Use it for tracing an SMB
+// contained in an Mdl.
+//
+// Arguments:
+//
+// SmbMdl - a pointer to the Mdl containing the SMB that is about
+// to be sent.
+//
+// Return Value:
+//
+// None
+//
+
+#define SMBTRACE_SRV(smbmdl) \
+ if ( SmbTraceActive[SMBTRACE_SERVER] ) { \
+ SmbTraceCompleteSrv( (smbmdl), NULL, 0 ); \
+ }
+
+//
+// VOID
+// SMBTRACE_SRV2(
+// IN PVOID Smb,
+// IN ULONG SmbLength
+// )
+//
+// Routine description:
+//
+// If SmbTrace is turned on, this macro calls SmbTraceCompleteSrv
+// to send the SMB to the smbtrace program in user mode. This routine
+// is specific to the LanMan server. Use it for tracing an SMB
+// found in contiguous memory.
+//
+// Arguments:
+//
+// Smb - a pointer to the SMB that is about to be sent.
+//
+// SmbLength - the length of the SMB.
+//
+// Return Value:
+//
+// None
+//
+
+#define SMBTRACE_SRV2(smb,smblength) \
+ if ( SmbTraceActive[SMBTRACE_SERVER] ) { \
+ SmbTraceCompleteSrv( NULL, (smb), (smblength) ); \
+ }
+
+//
+// Identify a packet for tracing in the server.
+// Do not call this routine directly, always use the SMBTRACE_SRV macro
+//
+VOID
+SmbTraceCompleteSrv (
+ IN PMDL SmbMdl,
+ IN PVOID Smb,
+ IN CLONG SmbLength
+ );
+
+//
+// VOID
+// SMBTRACE_RDR(
+// IN PMDL SmbMdl
+// )
+//
+// Routine description:
+//
+// If SmbTrace is turned on, this macro calls SmbTraceCompleteRdr
+// to send the SMB to the smbtrace program in user mode. This routine
+// is specific to the LanMan redirector. Use it for tracing an SMB
+// contained in an Mdl.
+//
+// Arguments:
+//
+// SmbMdl - a pointer to the Mdl containing the SMB that is about
+// to be sent.
+//
+// Return Value:
+//
+// None
+//
+
+#define SMBTRACE_RDR(smbmdl) \
+ if ( SmbTraceActive[SMBTRACE_REDIRECTOR] ) { \
+ SmbTraceCompleteRdr( (smbmdl), NULL, 0 ); \
+ }
+
+//
+// VOID
+// SMBTRACE_RDR2(
+// IN PVOID Smb,
+// IN ULONG SmbLength
+// )
+//
+// Routine description:
+//
+// If SmbTrace is turned on, this macro calls SmbTraceCompleteRdr
+// to send the SMB to the smbtrace program in user mode. This routine
+// is specific to the LanMan redirector. Use it for tracing an SMB
+// found in contiguous memory.
+//
+// Arguments:
+//
+// Smb - a pointer to the SMB that is about to be sent.
+//
+// SmbLength - the length of the SMB.
+//
+// Return Value:
+//
+// None
+//
+
+#define SMBTRACE_RDR2(smb,smblength) \
+ if ( SmbTraceActive[SMBTRACE_REDIRECTOR] ) { \
+ SmbTraceCompleteRdr( NULL, (smb), (smblength) ); \
+ }
+
+//
+// Identify a packet for tracing in the redirector.
+// Do not call this routine directly, always use one of the SMBTRACE_RDR
+// macros.
+//
+VOID
+SmbTraceCompleteRdr (
+ IN PMDL SmbMdl,
+ IN PVOID Smb,
+ IN CLONG SmbLength
+ );
+
+#endif // _SMBTRSUP_
+
diff --git a/private/inc/smbtypes.h b/private/inc/smbtypes.h
new file mode 100644
index 000000000..1bb732589
--- /dev/null
+++ b/private/inc/smbtypes.h
@@ -0,0 +1,371 @@
+/*++
+
+Copyright (c) 1989 Microsoft Corporation
+
+Module Name:
+
+ smbtypes.h
+
+Abstract:
+
+ This module defines types related to SMB processing.
+
+Author:
+
+ Chuck Lenzmeier (chuckl) 1-Dec-1989
+ David Treadwell (davidtr)
+Revision History:
+
+--*/
+
+#ifndef _SMBTYPES_
+#define _SMBTYPES_
+
+//#include <nt.h>
+
+//
+// SMBDBG determines whether the get/put macros (in smbgtpt.h) are
+// instead defined as function calls. (This is used to more reliably
+// find char/short/long mismatches.
+//
+
+#ifndef SMBDBG
+#define SMBDBG 0
+#endif
+
+//
+// SMBDBG1 determines whether the names of short and long fields in SMB
+// structures have an extra character appended. This is used to ensure
+// that these fields are only accessed via the get/put macros. SMBDBG1
+// must be disabled when SMBDBG is enabled.
+//
+
+#ifndef SMBDBG1
+#define SMBDBG1 0
+#endif
+
+#if SMBDBG && SMBDBG1
+#undef SMBDBG1
+#define SMBDBG1 0
+#endif
+
+//
+// If __unaligned support is available, or if we're compiling for a
+// machine that handles unaligned accesses in hardware, then define
+// SMB_USE_UNALIGNED as 1 (TRUE). Otherwise, define it as 0 (FALSE).
+// If SMB_USE_UNALIGNED is FALSE, then the macros below use byte
+// accesses to build up word and longword accesses to unaligned fields.
+//
+// Currently, the machines we build for all have SMB_USE_UNALIGNED as
+// TRUE. x86 supports unaligned accesses in hardware, while the MIPS
+// compiler supports the __unaligned keyword.
+//
+// Note that if SMB_USE_UNALIGNED is predefined, we use that definition.
+// Also, if SMB_NO_UNALIGNED is defined as TRUE, it forces
+// SMB_USE_ALIGNED off. This allows us to force, for testing purposes,
+// use of byte accesses in the macros.
+//
+
+#ifndef SMB_NO_UNALIGNED
+#define SMB_NO_UNALIGNED 0
+#endif
+
+#ifndef SMB_USE_UNALIGNED
+#if SMB_NO_UNALIGNED
+#define SMB_USE_UNALIGNED 0
+#else
+#define SMB_USE_UNALIGNED 1
+#endif
+#endif
+
+//
+// ntdef.h defines UNALIGNED as "__unaligned" or "", depending on
+// whether we're building for MIPS or x86, respectively. Because we
+// want to be able to disable use of __unaligned, we define
+// SMB_UNALIGNED as "UNALIGNED" or "", depending on whether
+// SMB_USE_UNALIGNED is TRUE or FALSE, respectively.
+//
+
+#if SMB_USE_UNALIGNED
+#define SMB_UNALIGNED UNALIGNED
+#else
+#define SMB_UNALIGNED
+#endif
+
+//
+// For ease of use, we define types for unaligned pointers to shorts
+// and longs in SMBs. Note that "PUSHORT UNALIGNED" doesn't work.
+//
+
+typedef unsigned short SMB_UNALIGNED *PSMB_USHORT;
+typedef unsigned long SMB_UNALIGNED *PSMB_ULONG;
+
+//
+// Macros for renaming short and long SMB fields.
+//
+
+#if SMBDBG1
+
+#define _USHORT( field ) USHORT field ## S
+#define _ULONG( field ) ULONG field ## L
+
+#else
+
+#define _USHORT( field ) USHORT field
+#define _ULONG( field ) ULONG field
+
+#endif
+
+//
+// Force misalignment of the following structures
+//
+
+#ifndef NO_PACKING
+#include <packon.h>
+#endif // ndef NO_PACKING
+
+
+//
+// The SMB_DIALECT type corresponds to the different SMB dialects
+// that the server can speak. Associated with it is the DialectStrings[]
+// array that holds information about the ASCIIZ strings that are passed
+// in the Negotiate SMB.s
+//
+// These are listed in order from highest preference to lowest preference.
+// The assigned numbers correspond to the array SrvClientTypes[] in the
+// server module srvdata.c.
+//
+
+typedef enum _SMB_DIALECT {
+
+
+ SmbDialectCairo, // Cairo
+ SmbDialectNtLanMan, // NT LAN Man
+ SmbDialectLanMan21, // OS/2 Lanman 2.1
+ SmbDialectDosLanMan21, // DOS Lanman 2.1
+ SmbDialectLanMan20, // OS/2 1.2 LanMan 2.0
+ SmbDialectDosLanMan20, // DOS LanMan 2.0
+ SmbDialectLanMan10, // 1st version of full LanMan extensions
+ SmbDialectMsNet30, // Larger subset of LanMan extensions
+ SmbDialectMsNet103, // Limited subset of LanMan extensions
+ SmbDialectPcLan10, // Alternate original protocol
+ SmbDialectPcNet10, // Original protocol
+ SmbDialectIllegal,
+
+} SMB_DIALECT, *PSMB_DIALECT;
+
+#define FIRST_DIALECT SmbDialectCairo
+
+#define FIRST_DIALECT_EMULATED SmbDialectNtLanMan
+
+#define LAST_DIALECT SmbDialectIllegal
+#define IS_DOS_DIALECT(dialect) \
+ ( (BOOLEAN)( (dialect) == SmbDialectDosLanMan21 || \
+ (dialect) == SmbDialectDosLanMan20 || \
+ (dialect) > SmbDialectLanMan10 ) )
+#define IS_OS2_DIALECT(dialect) ( (BOOLEAN)!IS_DOS_DIALECT(dialect) )
+
+#define IS_NT_DIALECT(dialect) ( (dialect) == SmbDialectNtLanMan || \
+ (dialect) == SmbDialectCairo )
+
+#define DIALECT_HONORS_UID(dialect) \
+ ( (BOOLEAN)(dialect <= SmbDialectDosLanMan20 ) )
+
+
+//
+// Date and time structures that conform to MS-DOS standard used in
+// some SMBs.
+//
+// !!! These structures are not portable--they depend on a little-endian
+// machine (TwoSeconds in lowest bits, etc.)
+//
+
+typedef union _SMB_DATE {
+ USHORT Ushort;
+ struct {
+ USHORT Day : 5;
+ USHORT Month : 4;
+ USHORT Year : 7;
+ } Struct;
+} SMB_DATE;
+typedef SMB_DATE SMB_UNALIGNED *PSMB_DATE;
+
+typedef union _SMB_TIME {
+ USHORT Ushort;
+ struct {
+ USHORT TwoSeconds : 5;
+ USHORT Minutes : 6;
+ USHORT Hours : 5;
+ } Struct;
+} SMB_TIME;
+typedef SMB_TIME SMB_UNALIGNED *PSMB_TIME;
+
+
+//
+// The SMB_FIND_BUFFER and SMB_FIND_BUFFER2 structures are used in the
+// Transaction2 Find protocols to return files matching the requested
+// specifications. They are identical except for the EaSize field
+// in SMB_FIND_BUFFER2.
+//
+
+typedef struct _SMB_FIND_BUFFER {
+ SMB_DATE CreationDate;
+ SMB_TIME CreationTime;
+ SMB_DATE LastAccessDate;
+ SMB_TIME LastAccessTime;
+ SMB_DATE LastWriteDate;
+ SMB_TIME LastWriteTime;
+ _ULONG( DataSize );
+ _ULONG( AllocationSize );
+ _USHORT( Attributes );
+ UCHAR FileNameLength;
+ CHAR FileName[1];
+} SMB_FIND_BUFFER;
+typedef SMB_FIND_BUFFER SMB_UNALIGNED *PSMB_FIND_BUFFER;
+
+typedef struct _SMB_FIND_BUFFER2 {
+ SMB_DATE CreationDate;
+ SMB_TIME CreationTime;
+ SMB_DATE LastAccessDate;
+ SMB_TIME LastAccessTime;
+ SMB_DATE LastWriteDate;
+ SMB_TIME LastWriteTime;
+ _ULONG( DataSize );
+ _ULONG( AllocationSize );
+ _USHORT( Attributes );
+ _ULONG( EaSize ); // this field intentionally misaligned!
+ UCHAR FileNameLength;
+ CHAR FileName[1];
+} SMB_FIND_BUFFER2;
+typedef SMB_FIND_BUFFER2 SMB_UNALIGNED *PSMB_FIND_BUFFER2;
+
+
+//
+// The following structures are used in OS/2 1.2 for extended attributes
+// (EAs). OS/2 2.0 uses the same structures as NT. See the OS/2
+// Programmer's Reference, Volume 4, Chapter 4 for more information.
+//
+// The FEA structure holds a single EA's name and value and is the
+// equivalent ofthe NT structure FILE_FULL_EA_INFORMATION.
+//
+
+typedef struct _FEA {
+ UCHAR fEA;
+ UCHAR cbName;
+ _USHORT( cbValue );
+} FEA;
+typedef FEA SMB_UNALIGNED *PFEA;
+
+//
+// The only legal bit in fEA is FEA_NEEDEA.
+//
+
+#define FEA_NEEDEA 0x80
+
+//
+// The FEALIST structure holds the names and values of multiple EAs
+// NT has no direct equivalent but rather strings together
+// FILE_FULL_EA_INFORMATION structures.
+//
+
+typedef struct _FEALIST {
+ _ULONG( cbList );
+ FEA list[1];
+} FEALIST;
+typedef FEALIST SMB_UNALIGNED *PFEALIST;
+
+//
+// The GEA structure holds the name of a single EA. It is used to
+// request the value of that EA in OS/2 API functions. The NT
+// equivalent is FILE_GET_EA_INFORMATION.
+//
+
+typedef struct _GEA {
+ UCHAR cbName;
+ CHAR szName[1];
+} GEA;
+typedef GEA SMB_UNALIGNED *PGEA;
+
+//
+// The GEALIST structure holds the names of multiple EAs. NT has no
+// direct equivalent but rather strings together FILE_GET_EA_INFORMATION
+// structures.
+//
+
+typedef struct _GEALIST {
+ _ULONG( cbList );
+ GEA list[1];
+} GEALIST;
+typedef GEALIST SMB_UNALIGNED *PGEALIST;
+
+//
+// The EAOP structure holds EA information needed by API calls. It has
+// no NT equivalent.
+//
+
+typedef struct _EAOP {
+ PGEALIST fpGEAList;
+ PFEALIST fpFEAList;
+ ULONG oError;
+} EAOP;
+typedef EAOP SMB_UNALIGNED *PEAOP;
+
+//
+// FSALLOCATE contains information about a disk returned by
+// SrvSmbQueryFsInfo.
+//
+
+typedef struct _FSALLOCATE {
+ _ULONG( idFileSystem );
+ _ULONG( cSectorUnit );
+ _ULONG( cUnit );
+ _ULONG( cUnitAvail );
+ _USHORT( cbSector );
+} FSALLOCATE, *PFSALLOCATE; // *** NOT SMB_UNALIGNED!
+
+//
+// VOLUMELABEL contains information about a volume label returned by
+// SrvSmbQueryFsInformation.
+//
+
+typedef struct _VOLUMELABEL {
+ UCHAR cch;
+ CHAR szVolLabel[12];
+} VOLUMELABEL, *PVOLUMELABEL; // *** NOT SMB_UNALIGNED!
+
+//
+// FSINFO holds information about a volume returned by
+// SrvSmbQueryFsInformation.
+//
+
+typedef struct _FSINFO {
+ _ULONG( ulVsn );
+ VOLUMELABEL vol;
+} FSINFO, *PFSINFO; // *** NOT SMB_UNALIGNED!
+
+//
+// File types (returned by OpenAndX and Transact2_Open)
+// FileTypeIPC is a private definition for the NT redirector and
+// is not in the smb protocol.
+//
+
+typedef enum _FILE_TYPE {
+ FileTypeDisk = 0,
+ FileTypeByteModePipe = 1,
+ FileTypeMessageModePipe = 2,
+ FileTypePrinter = 3,
+ FileTypeCommDevice = 4,
+ FileTypeIPC = 0xFFFE,
+ FileTypeUnknown = 0xFFFF
+} FILE_TYPE;
+
+//
+// Turn structure packing back off
+//
+
+#ifndef NO_PACKING
+#include <packoff.h>
+#endif // ndef NO_PACKING
+
+#endif // def _SMBTYPES_
+
diff --git a/private/inc/sndblst.h b/private/inc/sndblst.h
new file mode 100644
index 000000000..5c00b31dd
--- /dev/null
+++ b/private/inc/sndblst.h
@@ -0,0 +1,150 @@
+/*++ BUILD Version: 0001 // Increment this if a change has global effects
+
+
+Copyright (c) 1992 Microsoft Corporation
+
+Module Name:
+
+ sndblst.h
+
+Abstract:
+
+ This include file defines constants and types for
+ the Sound blaster card.
+
+ This header file is shared between the low level driver and the
+ kernel driver.
+
+Revision History:
+
+--*/
+
+#define SOUND_DEF_DMACHANNEL 1 // DMA channel no
+#define SOUND_DEF_DMACHANNEL16 5 // DMA channel no 5
+#define SOUND_DEF_INT 7
+#define SOUND_DEF_PORT 0x220
+#define SOUND_DEF_MPU401_PORT 0x330
+
+#define NUMBER_OF_SOUND_PORTS (0x10)
+#define NUMBER_OF_MPU401_PORTS (0x02)
+
+/*
+** Registry value names
+*/
+
+#define SOUND_REG_DMACHANNEL16 (L"DmaChannel16")
+#define SOUND_REG_MPU401_PORT (L"MPU401 Port")
+#define SOUND_REG_DSP_VERSION (L"DSP Version")
+#define SOUND_REG_REALBUFFERSIZE (L"Actual Dma Buffer Size")
+
+/*
+** Sound blaster midi mappings
+*/
+
+#define SNDBLST_MAPPER_OPL3 TEXT("SNDBLST OPL3")
+#define SNDBLST_MAPPER_ADLIB TEXT("SNDBLST AD LIB")
+
+
+/*
+** Registry 'return' codes
+*/
+
+#define SOUND_CONFIG_THUNDER 0x80000001
+#define SOUND_CONFIG_MPU401_PORT_INUSE 0x80000002
+#define SOUND_CONFIG_BAD_MPU401_PORT 0x80000003
+
+/*
+** String ids (strings in sndblst.dll)
+*/
+
+#define IDS_AUX_LINE_PNAME 100
+#define IDS_AUX_CD_PNAME 101
+#define IDS_SYNTH_PNAME 102
+#define IDS_WAVEIN_PNAME 103
+#define IDS_WAVEOUT_PNAME 104
+#define IDS_MIXER_PNAME 105
+
+#define IDS_CONTROL_AGCMIC_LONG_NAME 106
+#define IDS_CONTROL_AGCMIC_SHORT_NAME 107
+#define IDS_CONTROL_METERRECORD_LONG_NAME 108
+#define IDS_CONTROL_METERRECORD_SHORT_NAME 109
+#define IDS_CONTROL_MUTEAUX_LONG_NAME 110
+#define IDS_CONTROL_MUTEAUX_SHORT_NAME 111
+#define IDS_CONTROL_MUTEINTERNAL_LONG_NAME 112
+#define IDS_CONTROL_MUTEINTERNAL_SHORT_NAME 113
+#define IDS_CONTROL_MUTELINEOUT_LONG_NAME 114
+#define IDS_CONTROL_MUTELINEOUT_SHORT_NAME 115
+#define IDS_CONTROL_MUTEMIC_SHORT_NAME 116
+#define IDS_CONTROL_MUTEMIC_LONG_NAME 117
+#define IDS_CONTROL_MUTEMIDIOUT_LONG_NAME 118
+#define IDS_CONTROL_MUTEMIDIOUT_SHORT_NAME 119
+#define IDS_CONTROL_MUTEWAVEOUT_LONG_NAME 120
+#define IDS_CONTROL_MUTEWAVEOUT_SHORT_NAME 121
+#define IDS_CONTROL_MUXLINEOUT_LONG_NAME 122
+#define IDS_CONTROL_MUXLINEOUT_SHORT_NAME 123
+#define IDS_CONTROL_MUXWAVEIN_LONG_NAME 124
+#define IDS_CONTROL_MUXWAVEIN_SHORT_NAME 125
+#define IDS_CONTROL_PEAKVOICEINAUX_LONG_NAME 126
+#define IDS_CONTROL_PEAKVOICEINAUX_SHORT_NAME 127
+#define IDS_CONTROL_PEAKVOICEINMIC_LONG_NAME 128
+#define IDS_CONTROL_PEAKVOICEINMIC_SHORT_NAME 129
+#define IDS_CONTROL_PEAKWAVEINAUX_LONG_NAME 130
+#define IDS_CONTROL_PEAKWAVEINAUX_SHORT_NAME 131
+#define IDS_CONTROL_PEAKWAVEININTERNAL_LONG_NAME 132
+#define IDS_CONTROL_PEAKWAVEININTERNAL_SHORT_NAME 133
+#define IDS_CONTROL_PEAKWAVEINMIC_LONG_NAME 134
+#define IDS_CONTROL_PEAKWAVEINMIC_SHORT_NAME 135
+#define IDS_CONTROL_PEAKWAVEOUT_LONG_NAME 136
+#define IDS_CONTROL_PEAKWAVEOUT_SHORT_NAME 137
+#define IDS_CONTROL_VOICEINMUX_LONG_NAME 138
+#define IDS_CONTROL_VOICEINMUX_SHORT_NAME 139
+#define IDS_CONTROL_VOLBASS_LONG_NAME 140
+#define IDS_CONTROL_VOLBASS_SHORT_NAME 141
+#define IDS_CONTROL_VOLLINEOUTAUX_LONG_NAME 142
+#define IDS_CONTROL_VOLLINEOUTAUX_SHORT_NAME 143
+#define IDS_CONTROL_VOLLINEOUTINTERNAL_LONG_NAME 144
+#define IDS_CONTROL_VOLLINEOUTINTERNAL_SHORT_NAME 145
+#define IDS_CONTROL_VOLLINEOUTMIC_LONG_NAME 146
+#define IDS_CONTROL_VOLLINEOUTMIC_SHORT_NAME 147
+#define IDS_CONTROL_VOLLINEOUTMIDIOUT_LONG_NAME 148
+#define IDS_CONTROL_VOLLINEOUTMIDIOUT_SHORT_NAME 149
+#define IDS_CONTROL_VOLLINEOUTWAVEOUT_LONG_NAME 150
+#define IDS_CONTROL_VOLLINEOUTWAVEOUT_SHORT_NAME 151
+#define IDS_CONTROL_VOLLINEOUT_LONG_NAME 152
+#define IDS_CONTROL_VOLLINEOUT_SHORT_NAME 153
+#define IDS_CONTROL_VOLRECORD_LONG_NAME 154
+#define IDS_CONTROL_VOLRECORD_SHORT_NAME 155
+#define IDS_CONTROL_VOLTREBLE_LONG_NAME 156
+#define IDS_CONTROL_VOLTREBLE_SHORT_NAME 157
+#define IDS_CONTROL_VOLVOICEINAUX_LONG_NAME 158
+#define IDS_CONTROL_VOLVOICEINAUX_SHORT_NAME 159
+#define IDS_CONTROL_VOLVOICEINMIC_LONG_NAME 160
+#define IDS_CONTROL_VOLVOICEINMIC_SHORT_NAME 161
+#define IDS_CONTROL_VOLWAVEINAUX_LONG_NAME 162
+#define IDS_CONTROL_VOLWAVEINAUX_SHORT_NAME 163
+#define IDS_CONTROL_VOLWAVEININTERNAL_LONG_NAME 164
+#define IDS_CONTROL_VOLWAVEININTERNAL_SHORT_NAME 165
+#define IDS_CONTROL_VOLWAVEINMIC_LONG_NAME 166
+#define IDS_CONTROL_VOLWAVEINMIC_SHORT_NAME 167
+#define IDS_CONTROL_VOLWAVEINMIDIOUT_LONG_NAME 168
+#define IDS_CONTROL_VOLWAVEINMIDIOUT_SHORT_NAME 169
+#define IDS_DESTLINEOUT_LONG_NAME 170
+#define IDS_DESTLINEOUT_SHORT_NAME 171
+#define IDS_DESTVOICEIN_LONG_NAME 172
+#define IDS_DESTVOICEIN_SHORT_NAME 173
+#define IDS_DESTWAVEIN_LONG_NAME 174
+#define IDS_DESTWAVEIN_SHORT_NAME 175
+#define IDS_SRCAUX_LONG_NAME 176
+#define IDS_SRCAUX_SHORT_NAME 177
+#define IDS_SRCINTERNALCD_LONG_NAME 178
+#define IDS_SRCINTERNALCD_SHORT_NAME 179
+#define IDS_SRCMICOUT_LONG_NAME 180
+#define IDS_SRCMICOUT_SHORT_NAME 181
+#define IDS_SRCMIDIOUT_LONG_NAME 182
+#define IDS_SRCMIDIOUT_SHORT_NAME 183
+#define IDS_SRCWAVEOUT_LONG_NAME 184
+#define IDS_SRCWAVEOUT_SHORT_NAME 185
+#define IDS_CONTROL_MIXERWAVEIN_LONG_NAME 186
+#define IDS_CONTROL_MIXERWAVEIN_SHORT_NAME 187
+#define IDS_CONTROL_VOLGAIN_SHORT_NAME 188
+#define IDS_CONTROL_VOLGAIN_LONG_NAME 189
diff --git a/private/inc/sockets/arpa/bootp.h b/private/inc/sockets/arpa/bootp.h
new file mode 100644
index 000000000..484be4227
--- /dev/null
+++ b/private/inc/sockets/arpa/bootp.h
@@ -0,0 +1,74 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ bootp.h
+
+Abstract:
+
+ Include file for the bootp daemon.
+
+Author:
+
+ Sam Patton (sampa) July 26, 1991
+
+Revision History:
+
+ when who what
+ ---- --- ----
+ 7-26-91 sampa initial version
+
+--*/
+
+/******************************************************************
+ *
+ * SpiderTCP Include Files
+ *
+ * Copyright 1989 Spider Systems Limited
+ *
+ * BOOTP.H
+ *
+ * Include file for the booting daemon,
+ * which uses BOOTP (bootstrap protocol).
+ * See [SRI-NIC]<RFC>RFC951.TXT for a description of the protocol.
+ *
+ ******************************************************************/
+
+/*
+ * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/arpa/0/s.bootp.h
+ * @(#)bootp.h 1.1
+ *
+ * Last delta created 16:45:42 6/14/89
+ * This file extracted 08:53:49 7/10/91
+ *
+ * Modifications:
+ *
+ * GSS 23 May 89 New File
+ */
+
+#ifndef BOOTP_INCLUDED
+#define BOOTP_INCLUDED
+
+struct bootp {
+ unchar bp_op; /* packet opcode type */
+#define BOOTREQUEST 1
+#define BOOTREPLY 2
+ unchar bp_htype; /* hardware addr type */
+ unchar bp_hlen; /* hardware addr length */
+ unchar bp_hops; /* gateway hops */
+ ulong bp_xid; /* transaction ID */
+ ushort bp_secs; /* seconds since boot began */
+ ushort bp_unused;
+ iaddr_t bp_ciaddr; /* client IP address */
+ iaddr_t bp_yiaddr; /* 'your' IP address */
+ iaddr_t bp_siaddr; /* server IP address */
+ iaddr_t bp_giaddr; /* gateway IP address */
+ unchar bp_chaddr[16]; /* client hardware address */
+ unchar bp_sname[64]; /* server host name */
+ unchar bp_file[128]; /* boot file name */
+ unchar bp_vend[64]; /* vendor-specific area */
+};
+
+#endif //BOOTP_INCLUDED
diff --git a/private/inc/sockets/arpa/ftp.h b/private/inc/sockets/arpa/ftp.h
new file mode 100644
index 000000000..4433e87ec
--- /dev/null
+++ b/private/inc/sockets/arpa/ftp.h
@@ -0,0 +1,109 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ ftp.h
+
+Abstract:
+
+ ftp daemon definitions
+
+Author:
+
+ Sam Patton (sampa) July 26, 1991
+
+Revision History:
+
+ when who what
+ ---- --- ----
+ 7-26-91 sampa initial version
+
+--*/
+
+/******************************************************************
+ *
+ * SpiderTCP Socket Utilities
+ *
+ * Copyright 1987 Spider Systems Limited
+ *
+ * FTP.H
+ *
+ * FTP Daemon - Definitions (see RFC-765)
+ *
+ *
+ ******************************************************************/
+
+/*
+ * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/arpa/0/s.ftp.h
+ * @(#)ftp.h 1.2
+ *
+ * Last delta created 20:46:15 6/24/88
+ * This file extracted 08:53:49 7/10/91
+ *
+ * Modifications:
+ *
+ * PR 01/12/87 Integrated into Admin System II, all
+ * projects
+ */
+
+#ifndef FTP_INCLUDED
+#define FTP_INCLUDED
+
+/*
+ * Reply codes.
+ */
+#define PRELIM 1 /* positive preliminary */
+#define COMPLETE 2 /* positive completion */
+#define CONTINUE 3 /* positive intermediate */
+#define TRANSIENT 4 /* transient negative completion */
+#define FTP_ERROR 5 /* permanent negative completion */
+
+/*
+ * Type codes
+ */
+#define TYPE_A 1 /* ASCII */
+#define TYPE_E 2 /* EBCDIC */
+#define TYPE_I 3 /* image */
+#define TYPE_L 4 /* local byte size */
+
+/*
+ * Form codes
+ */
+#define FORM_N 1 /* non-print */
+#define FORM_T 2 /* telnet format effectors */
+#define FORM_C 3 /* carriage control (ASA) */
+
+/*
+ * Structure codes
+ */
+#define STRU_F 1 /* file (no record structure) */
+#define STRU_R 2 /* record structure */
+#define STRU_P 3 /* page structure */
+
+/*
+ * Mode types
+ */
+#define MODE_S 1 /* stream */
+#define MODE_B 2 /* block */
+#define MODE_C 3 /* compressed */
+
+/*
+ * Record Tokens
+ */
+#define REC_ESC '\377' /* Record-mode Escape */
+#define REC_EOR '\001' /* Record-mode End-of-Record */
+#define REC_EOF '\002' /* Record-mode End-of-File */
+
+/*
+ * Block Header
+ */
+#define BLK_EOR 0x80 /* Block is End-of-Record */
+#define BLK_EOF 0x40 /* Block is End-of-File */
+#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */
+#define BLK_RESTART 0x10 /* Block is Restart Marker */
+
+#define BLK_BYTECOUNT 2 /* Bytes in this block */
+
+#endif //FTP_INCLUDED
diff --git a/private/inc/sockets/arpa/inet.h b/private/inc/sockets/arpa/inet.h
new file mode 100644
index 000000000..d64dc631b
--- /dev/null
+++ b/private/inc/sockets/arpa/inet.h
@@ -0,0 +1,91 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ inet.h
+
+Abstract:
+
+ ARPANet include file - network address defines and macros
+
+Author:
+
+ Sam Patton (sampa) July 26, 1991
+
+Revision History:
+
+ when who what
+ ---- --- ----
+ 7-26-91 sampa initial version
+
+--*/
+
+/******************************************************************
+ *
+ * SpiderTCP Net Utilities
+ *
+ * Copyright 1987 Spider Systems Limited
+ *
+ * INET.H
+ *
+ * ARPANet include file - network address defines and macros
+ *
+ ******************************************************************/
+
+/*
+ * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/arpa/0/s.inet.h
+ * @(#)inet.h 1.5
+ *
+ * Last delta created 19:04:03 4/17/89
+ * This file extracted 08:53:50 7/10/91
+ *
+ * Modifications:
+ *
+ * IPH - 24/09/86 extend protocol table entries to include the
+ * protocol number and the protocol receive &
+ * transmit queues.
+ * PR - 01/12/87 Integrated into Admin System II, all projects
+ */
+
+#ifndef INET_INCLUDED
+#define INET_INCLUDED
+
+/*
+ * External definitions for
+ * functions in inet(3N)
+ */
+
+unsigned long
+inet_netof(
+ IN struct in_addr in
+ );
+
+unsigned long PASCAL
+inet_addr(
+ IN const char *cp
+ );
+
+unsigned long
+inet_network(
+ IN char *cp
+ );
+
+unsigned long
+inet_lnaof(
+ IN struct in_addr in
+ );
+
+char FAR *
+PASCAL FAR inet_ntoa(
+ IN struct in_addr in
+ );
+
+struct in_addr
+inet_makeaddr(
+ IN unsigned long net,
+ IN unsigned long host
+ );
+
+#endif //INET_INCLUDED
diff --git a/private/inc/sockets/arpa/nameser.h b/private/inc/sockets/arpa/nameser.h
new file mode 100644
index 000000000..73e0489a6
--- /dev/null
+++ b/private/inc/sockets/arpa/nameser.h
@@ -0,0 +1,298 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ nameser.h
+
+Abstract:
+
+ Definitions for the DNS resolver and nameserver.
+
+Author:
+
+ Mike Massa (mikemas) Jan 31, 1992
+
+Revision History:
+
+ Who When What
+ -------- -------- ----------------------------------------------
+ mikemas 01-31-92 created
+
+Notes:
+
+--*/
+
+/******************************************************************
+ *
+ * SpiderTCP BIND
+ *
+ * Copyright 1990 Spider Systems Limited
+ *
+ * NAMESER.H
+ *
+ ******************************************************************/
+
+/*
+ * /usr/projects/tcp/SCCS.rel3/rel/src/include/arpa/0/s.nameser.h
+ * @(#)nameser.h 5.3
+ *
+ * Last delta created 14:06:04 3/4/91
+ * This file extracted 11:19:28 3/8/91
+ *
+ * Modifications:
+ *
+ * GSS 20 Jul 90 New File
+ */
+
+/*
+ * Copyright (c) 1983, 1989 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that: (1) source distributions retain this entire copyright
+ * notice and comment, and (2) distributions including binaries display
+ * the following acknowledgement: ``This product includes software
+ * developed by the University of California, Berkeley and its contributors''
+ * in the documentation or other materials provided with the distribution
+ * and in all advertising materials mentioning features or use of this
+ * software. Neither the name of the University nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * @(#)nameser.h 5.24 (Berkeley) 6/1/90
+ */
+
+#ifndef _NAMESER_INCLUDED
+#define _NAMESER_INCLUDED
+
+
+/*
+ * Define constants based on rfc883
+ */
+#define PACKETSZ 512 /* maximum packet size */
+#define MAXDNAME 256 /* maximum domain name */
+#define MAXCDNAME 255 /* maximum compressed domain name */
+#define MAXLABEL 63 /* maximum length of domain label */
+ /* Number of bytes of fixed size data in query structure */
+#define QFIXEDSZ 4
+ /* number of bytes of fixed size data in resource record */
+#define RRFIXEDSZ 10
+
+/*
+ * Internet nameserver port number
+ */
+#define NAMESERVER_PORT 53
+
+/*
+ * Currently defined opcodes
+ */
+#define QUERY 0x0 /* standard query */
+#define IQUERY 0x1 /* inverse query */
+#define STATUS 0x2 /* nameserver status query */
+/*#define xxx 0x3 /* 0x3 reserved */
+ /* non standard */
+#define UPDATEA 0x9 /* add resource record */
+#define UPDATED 0xa /* delete a specific resource record */
+#define UPDATEDA 0xb /* delete all nemed resource record */
+#define UPDATEM 0xc /* modify a specific resource record */
+#define UPDATEMA 0xd /* modify all named resource record */
+
+#define ZONEINIT 0xe /* initial zone transfer */
+#define ZONEREF 0xf /* incremental zone referesh */
+
+/*
+ * Currently defined response codes
+ */
+#ifndef NOERROR
+#define NOERROR 0 /* no error */
+#endif
+#define FORMERR 1 /* format error */
+#define SERVFAIL 2 /* server failure */
+#define NXDOMAIN 3 /* non existent domain */
+#define NOTIMP 4 /* not implemented */
+#define REFUSED 5 /* query refused */
+ /* non standard */
+#define NOCHANGE 0xf /* update failed to change db */
+
+/*
+ * Type values for resources and queries
+ */
+#define T_A 1 /* host address */
+#define T_NS 2 /* authoritative server */
+#define T_MD 3 /* mail destination */
+#define T_MF 4 /* mail forwarder */
+#define T_CNAME 5 /* connonical name */
+#define T_SOA 6 /* start of authority zone */
+#define T_MB 7 /* mailbox domain name */
+#define T_MG 8 /* mail group member */
+#define T_MR 9 /* mail rename name */
+#define T_NULL 10 /* null resource record */
+#define T_WKS 11 /* well known service */
+#define T_PTR 12 /* domain name pointer */
+#define T_HINFO 13 /* host information */
+#define T_MINFO 14 /* mailbox information */
+#define T_MX 15 /* mail routing information */
+#define T_TXT 16 /* text strings */
+#define T_AFSDB 18 /* AFS database servers */
+ /* non standard */
+#define T_UINFO 100 /* user (finger) information */
+#define T_UID 101 /* user ID */
+#define T_GID 102 /* group ID */
+#define T_UNSPEC 103 /* Unspecified format (binary data) */
+ /* Query type values which do not appear in resource records */
+#define T_AXFR 252 /* transfer zone of authority */
+#define T_MAILB 253 /* transfer mailbox records */
+#define T_MAILA 254 /* transfer mail agent records */
+#define T_ANY 255 /* wildcard match */
+
+/*
+ * Values for class field
+ */
+
+#define C_IN 1 /* the arpa internet */
+#define C_CHAOS 3 /* for chaos net at MIT */
+#define C_HS 4 /* for Hesiod name server at MIT */
+ /* Query class values which do not appear in resource records */
+#define C_ANY 255 /* wildcard match */
+
+/*
+ * Status return codes for T_UNSPEC conversion routines
+ */
+#define CONV_SUCCESS 0
+#define CONV_OVERFLOW -1
+#define CONV_BADFMT -2
+#define CONV_BADCKSUM -3
+#define CONV_BADBUFLEN -4
+
+#ifndef BYTE_ORDER
+#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */
+#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */
+#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */
+
+#if defined(vax) || defined(ns32000) || defined(sun386) || defined(MIPSEL) || \
+ defined(BIT_ZERO_ON_RIGHT)
+#define BYTE_ORDER LITTLE_ENDIAN
+
+#endif
+#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \
+ defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \
+ defined(MIPSEB) || defined (BIT_ZERO_ON_LEFT)
+#define BYTE_ORDER BIG_ENDIAN
+#endif
+#ifndef BYTE_ORDER /* still not defined */
+#if defined(u3b2) || defined(m68k)
+#define BYTE_ORDER BIG_ENDIAN
+#endif
+#if defined(i286) || defined(i386) || defined(_MIPS_) || defined(_ALPHA_) || defined(_PPC_)
+#define BYTE_ORDER LITTLE_ENDIAN
+#endif
+#endif /* ~BYTE_ORDER */
+#endif /* BYTE_ORDER */
+
+#ifndef BYTE_ORDER
+ /* you must determine what the correct bit order is for your compiler */
+ UNDEFINED_BIT_ORDER;
+#endif
+/*
+ * Structure for query header, the order of the fields is machine and
+ * compiler dependent, in our case, the bits within a byte are assignd
+ * least significant first, while the order of transmition is most
+ * significant first. This requires a somewhat confusing rearrangement.
+ */
+
+typedef struct {
+ unsigned short id; /* query identification number */
+#if BYTE_ORDER == BIG_ENDIAN
+ /* fields in third byte */
+ unsigned char qr:1; /* response flag */
+ unsigned char opcode:4; /* purpose of message */
+ unsigned char aa:1; /* authoritive answer */
+ unsigned char tc:1; /* truncated message */
+ unsigned char rd:1; /* recursion desired */
+ /* fields in fourth byte */
+ unsigned char ra:1; /* recursion available */
+ unsigned char pr:1; /* primary server required (non standard) */
+ unsigned char unused:2; /* unused bits */
+ unsigned char rcode:4; /* response code */
+#endif
+#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
+ /* fields in third byte */
+ unsigned char rd:1; /* recursion desired */
+ unsigned char tc:1; /* truncated message */
+ unsigned char aa:1; /* authoritive answer */
+ unsigned char opcode:4; /* purpose of message */
+ unsigned char qr:1; /* response flag */
+ /* fields in fourth byte */
+ unsigned char rcode:4; /* response code */
+ unsigned char unused:2; /* unused bits */
+ unsigned char pr:1; /* primary server required (non standard) */
+ unsigned char ra:1; /* recursion available */
+#endif
+ /* remaining bytes */
+ unsigned short qdcount; /* number of question entries */
+ unsigned short ancount; /* number of answer entries */
+ unsigned short nscount; /* number of authority entries */
+ unsigned short arcount; /* number of resource entries */
+} HEADER;
+
+/*
+ * Defines for handling compressed domain names
+ */
+#define INDIR_MASK 0xc0
+
+/*
+ * Structure for passing resource records around.
+ */
+struct rrec {
+ short r_zone; /* zone number */
+ short r_class; /* class number */
+ short r_type; /* type number */
+ unsigned long r_ttl; /* time to live */
+ int r_size; /* size of data area */
+ char *r_data; /* pointer to data */
+};
+
+extern unsigned short _getshort();
+extern unsigned long _getlong();
+
+/*
+ * Inline versions of get/put short/long.
+ * Pointer is advanced; we assume that both arguments
+ * are lvalues and will already be in registers.
+ * cp MUST be unsigned char *.
+ */
+#define GETSHORT(s, cp) { \
+ (s) = *(cp)++ << 8; \
+ (s) |= *(cp)++; \
+}
+
+#define GETLONG(l, cp) { \
+ (l) = *(cp)++ << 8; \
+ (l) |= *(cp)++; (l) <<= 8; \
+ (l) |= *(cp)++; (l) <<= 8; \
+ (l) |= *(cp)++; \
+}
+
+
+#define PUTSHORT(s, cp) { \
+ *(cp)++ = (s) >> 8; \
+ *(cp)++ = (s); \
+}
+
+/*
+ * Warning: PUTLONG destroys its first argument.
+ */
+#define PUTLONG(l, cp) { \
+ (cp)[3] = l; \
+ (cp)[2] = (l >>= 8); \
+ (cp)[1] = (l >>= 8); \
+ (cp)[0] = l >> 8; \
+ (cp) += sizeof(unsigned long); \
+}
+
+#endif // _NAMESER_INCLUDED
diff --git a/private/inc/sockets/arpa/telnet.h b/private/inc/sockets/arpa/telnet.h
new file mode 100644
index 000000000..c9e18c11f
--- /dev/null
+++ b/private/inc/sockets/arpa/telnet.h
@@ -0,0 +1,148 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ telnet.h
+
+Abstract:
+
+ User telnet, remote login utility - includes. Taken directly from Spider's
+ sources
+
+Author:
+
+ Sam Patton (sampa) July 26, 1991
+
+Revision History:
+
+ when who what
+ ---- --- ----
+ 7-26-91 sampa initial version
+
+--*/
+
+/******************************************************************
+ *
+ * SpiderTCP Socket Utilities
+ *
+ * Copyright 1987 Spider Systems Limited
+ *
+ * TELNET.H
+ *
+ * User telnet, remote login utility - includes
+ *
+ *
+ ******************************************************************/
+
+/*
+ * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/arpa/0/s.telnet.h
+ * @(#)telnet.h 1.2
+ *
+ * Last delta created 20:46:00 6/24/88
+ * This file extracted 08:53:50 7/10/91
+ *
+ * Modifications:
+ *
+ * PR 01/12/87 Integrated into Admin System II, all
+ * projects
+ */
+
+#ifndef TELNET_INCLUDED
+#define TELNET_INCLUDED
+
+/*
+ * Definitions for the TELNET protocol.
+ */
+#define IAC 255 /* interpret as command: */
+#define DONT 254 /* you are not to use option */
+#define DO 253 /* please, you use option */
+#define WONT 252 /* I won't use option */
+#define WILL 251 /* I will use option */
+#define SB 250 /* interpret as subnegotiation */
+#define GA 249 /* you may reverse the line */
+#define EL 248 /* erase the current line */
+#define EC 247 /* erase the current character */
+#define AYT 246 /* are you there */
+#define AO 245 /* abort output--but let prog finish */
+#define IP 244 /* interrupt process--permanently */
+#define BREAK 243 /* break */
+#define DM 242 /* data mark--for connect. cleaning */
+#define NOP 241 /* nop */
+#define SE 240 /* end sub negotiation */
+
+#define SYNCH 242 /* for telfunc calls */
+
+/* Telnet options - Names have been truncated to be unique in 7 chars */
+
+
+#define TO_BINARY 0 /* 8-bit data path */
+#define TO_ECHO 1 /* echo */
+#define TO_RCP 2 /* prepare to reconnect */
+#define TO_SGA 3 /* suppress go ahead */
+#define TO_NAMS 4 /* approximate message size */
+#define TO_STATUS 5 /* give status */
+#define TO_TM 6 /* timing mark */
+#define TO_RCTE 7 /* remote controlled transmission and echo */
+#define TO_NL 8 /* negotiate about output line width */
+#define TO_NP 9 /* negotiate about output page size */
+#define TO_NCRD 10 /* negotiate about CR disposition */
+#define TO_NHTS 11 /* negotiate about horizontal tabstops */
+#define TO_NHTD 12 /* negotiate about horizontal tab disposition */
+#define TO_NFFD 13 /* negotiate about formfeed disposition */
+#define TO_NVTS 14 /* negotiate about vertical tab stops */
+#define TO_NVTD 15 /* negotiate about vertical tab disposition */
+#define TO_NLFD 16 /* negotiate about output LF disposition */
+#define TO_XASCII 17 /* extended ascic character set */
+#define TO_LOGOUT 18 /* force logout */
+#define TO_BM 19 /* byte macro */
+#define TO_DET 20 /* data entry terminal */
+#define TO_SUPDUP 21 /* supdup protocol */
+#define TO_TERM_TYPE 24 /* terminal type */
+#define TO_EXOPL 255 /* extended-options-list */
+
+/* Define (real) long names to be the shorter ones */
+
+#define TELOPT_BINARY TO_BINARY
+#define TELOPT_ECHO TO_ECHO
+#define TELOPT_RCP TO_RCP
+#define TELOPT_SGA TO_SGA
+#define TELOPT_NAMS TO_NAMS
+#define TELOPT_STATUS TO_STATUS
+#define TELOPT_TM TO_TM
+#define TELOPT_RCTE TO_RCTE
+#define TELOPT_NAOL TO_NL
+#define TELOPT_NAOP TO_NP
+#define TELOPT_NAOCRD TO_NCRD
+#define TELOPT_NAOHTS TO_NHTS
+#define TELOPT_NAOHTD TO_NHTD
+#define TELOPT_NAOFFD TO_NFFD
+#define TELOPT_NAOVTS TO_NVTS
+#define TELOPT_NAOVTD TO_NVTD
+#define TELOPT_NAOLFD TO_NLFD
+#define TELOPT_XASCII TO_XASCII
+#define TELOPT_LOGOUT TO_LOGOUT
+#define TELOPT_BM TO_BM
+#define TELOPT_DET TO_DET
+#define TELOPT_SUPDUP TO_SUPDUP
+#define TELOPT_EXOPL TO_EXOPL
+
+#ifdef TELCMDS
+char *telcmds[] = {
+ "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
+ "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC",
+};
+#endif
+
+#ifdef TELOPTS
+char *telopts[] = {
+ "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
+ "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
+ "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
+ "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
+ "DATA ENTRY TERMINAL", "SUPDUP"
+};
+#endif
+
+#endif //TELNET_INCLUDED
diff --git a/private/inc/sockets/netdb.h b/private/inc/sockets/netdb.h
new file mode 100644
index 000000000..468b2daec
--- /dev/null
+++ b/private/inc/sockets/netdb.h
@@ -0,0 +1,209 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ netdb.h
+
+Abstract:
+
+ This contains the #defines for the tcp/ip net database operations
+
+Author:
+
+ Sam Patton (sampa) July 26, 1991
+
+Revision History:
+
+ when who what
+ ---- --- ----
+ 7-26-91 sampa initial version
+
+--*/
+
+/*-
+ * Copyright (c) 1980, 1983, 1988 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that: (1) source distributions retain this entire copyright
+ * notice and comment, and (2) distributions including binaries display
+ * the following acknowledgement: ``This product includes software
+ * developed by the University of California, Berkeley and its contributors''
+ * in the documentation or other materials provided with the distribution
+ * and in all advertising materials mentioning features or use of this
+ * software. Neither the name of the University nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * @(#)netdb.h 5.11 (Berkeley) 5/21/90
+ */
+
+#ifndef NETDB_INCLUDED
+#define NETDB_INCLUDED
+
+#define _PATH_HEQUIV "/etc/hosts.equiv"
+#define _PATH_HOSTS "/etc/hosts"
+#define _PATH_NETWORKS "/etc/networks"
+#define _PATH_PROTOCOLS "/etc/protocols"
+#define _PATH_SERVICES "/etc/services"
+
+/*
+ * Structures returned by network data base library. All addresses are
+ * supplied in host order, and returned in network order (suitable for
+ * use in system calls).
+ */
+struct hostent {
+ char *h_name; /* official name of host */
+ char **h_aliases; /* alias list */
+ int h_addrtype; /* host address type */
+ int h_length; /* length of address */
+ char **h_addr_list; /* list of addresses from name server */
+#define h_addr h_addr_list[0] /* address, for backward compatiblity */
+};
+
+/*
+ * Assumption here is that a network number
+ * fits in 32 bits -- probably a poor one.
+ */
+struct netent {
+ char *n_name; /* official name of net */
+ char **n_aliases; /* alias list */
+ int n_addrtype; /* net address type */
+ unsigned long n_net; /* network # */
+};
+
+struct servent {
+ char *s_name; /* official service name */
+ char **s_aliases; /* alias list */
+ int s_port; /* port # */
+ char *s_proto; /* protocol to use */
+};
+
+struct protoent {
+ char *p_name; /* official protocol name */
+ char **p_aliases; /* alias list */
+ int p_proto; /* protocol # */
+};
+
+
+//
+// Network table access function prototypes
+//
+
+struct hostent *
+gethostbyname(
+ char *name
+ );
+
+struct hostent *
+gethostbyaddr(
+ char *addr,
+ int len,
+ int type
+ );
+
+void
+sethostent(
+ int stayopen
+ );
+
+void
+endhostent(
+ void
+ );
+
+struct netent *
+getnetent(
+ void
+ );
+
+struct netent *
+getnetbyaddr(
+ unsigned long net,
+ int type
+ );
+
+struct netent *
+getnetbyname(
+ char *name
+ );
+
+void
+setnetent(
+ int stayopen
+ );
+
+void
+endnetent(
+ void
+ );
+
+struct protoent *
+getprotoent(
+ void
+ );
+
+struct protoent *
+getprotobynumber(
+ int proto
+ );
+
+struct protoent *
+getprotobyname(
+ char *name
+ );
+
+void
+setprotoent(
+ int stayopen
+ );
+
+void
+endprotoent(
+ void
+ );
+
+struct servent *
+getservent(
+ void
+ );
+
+struct servent *
+getservbyport(
+ int port,
+ char *proto
+ );
+
+struct servent *
+getservbyname(
+ char *name,
+ char *proto
+ );
+
+void
+setservent(
+ int stayopen
+ );
+
+void
+endservent(
+ void
+ );
+
+/*
+ * Error return codes from gethostbyname() and gethostbyaddr()
+ * (left in extern int h_errno).
+ */
+
+#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
+#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
+#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
+#define NO_DATA 4 /* Valid name, no data record of requested type */
+#define NO_ADDRESS NO_DATA /* no address, look for MX record */
+
+#endif //NETDB_INCLUDED
diff --git a/private/inc/sockets/netinet/in.h b/private/inc/sockets/netinet/in.h
new file mode 100644
index 000000000..53c264937
--- /dev/null
+++ b/private/inc/sockets/netinet/in.h
@@ -0,0 +1,433 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ in.h
+
+Abstract:
+
+ A version of the BSD 4.2 file <netinet/in.h> for NT tcp
+
+Author:
+
+ Sam Patton (sampa) July 26, 1991
+
+Revision History:
+
+ when who what
+ ---- --- ----
+ 7-26-91 sampa initial version
+
+--*/
+
+/******************************************************************
+ *
+ * SpiderTCP Application Include Files
+ *
+ * Spider Systems Limited
+ *
+ * IN.H
+ *
+ * A version of the BSD 4.2 file <netinet/in.h>
+ * for SpiderTCP
+ *
+ *
+ ******************************************************************/
+
+/*
+ * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/netinet/0/s.in.h
+ * @(#)in.h 1.31
+ *
+ * Last delta created 13:33:59 8/27/90
+ * This file extracted 08:53:51 7/10/91
+ *
+ * Modifications:
+ *
+ */
+
+#ifndef IN_INCLUDED
+#define IN_INCLUDED
+
+
+#ifdef PROJ8
+/*
+ * BYTESWAP should be undef'ed if the machine's byte order
+ * is the same as network byte order - if it is the reverse
+ * it should be set to 1.
+ */
+#define BYTESWAP 1
+#endif
+#ifdef PROJ11
+/*
+ * BYTESWAP should be undef'ed if the machine's byte order
+ * is the same as network byte order - if it is the reverse
+ * it should be set to 1.
+ */
+#define BYTESWAP 1
+#endif
+
+#ifdef PROJ9
+/*
+ * BYTESWAP should be undef'ed if the machine's byte order
+ * is the same as network byte order - if it is the reverse
+ * it should be set to 1.
+ */
+#if m68k
+#undef BYTESWAP
+#define EMBED 1
+#else
+#define BYTESWAP 1
+#undef EMBED
+#endif
+#endif
+
+
+#ifndef BYTESWAP
+# ifdef i386
+# define BYTESWAP 1
+# endif
+# ifdef MIPS
+# define BYTESWAP 1
+# endif
+# ifdef ALPHA
+# define BYTESWAP 1
+# endif
+# ifdef PPC
+# define BYTESWAP 1
+# endif
+#endif
+
+
+#define TLI_TCP "/dev/tcp" /* or else */
+#define TLI_UDP "/dev/udp" /* or else */
+
+/*
+ * Protocols
+ */
+#define IPPROTO_IP 256 /* IP (for socket options etc) */
+#define IPPROTO_ICMP 1 /* control message protocol */
+#define IPPROTO_GGP 2 /* gateway^2 (deprecated) */
+#define IPPROTO_TCP 6 /* tcp */
+#define IPPROTO_EGP 8 /* exterior gateway protocol */
+#define IPPROTO_PUP 12 /* pup */
+#define IPPROTO_UDP 17 /* user datagram protocol */
+
+#define IPPROTO_RAW 255 /* raw IP packet */
+#define IPPROTO_MAX 256
+
+
+#define ICMP_PROT IPPROTO_ICMP
+#define GWAY_PROT 3
+#define TCP_PROT IPPROTO_TCP
+#define UDP_PROT IPPROTO_UDP
+
+
+#include <sys\snet\ip_proto.h>
+
+#if 0
+/*
+ * define structure for DARPA internet address
+ * usually use "longs" to access but sometimes need to split into
+ * components
+ */
+
+typedef union {
+ char typea[4]; /* 4 x 8 bit version */
+ short typeb[2]; /* 2 x 16 bit */
+ long typec; /* 1 x 32 bit */
+} IN_ADDRESS;
+#endif
+
+
+/*
+ * Port/socket numbers: network standard functions
+ */
+#define IPPORT_ECHO 7
+#define IPPORT_DISCARD 9
+#define IPPORT_SYSTAT 11
+#define IPPORT_DAYTIME 13
+#define IPPORT_NETSTAT 15
+#define IPPORT_FTP 21
+#define IPPORT_TELNET 23
+#define IPPORT_SMTP 25
+#define IPPORT_TIMESERVER 37
+#define IPPORT_NAMESERVER 42
+#define IPPORT_WHOIS 43
+#define IPPORT_MTP 57
+
+/*
+ * Port/socket numbers: host specific functions
+ */
+#define IPPORT_TFTP 69
+#define IPPORT_RJE 77
+#define IPPORT_FINGER 79
+#define IPPORT_TTYLINK 87
+#define IPPORT_SUPDUP 95
+
+#define IPPORT_BIFFUDP 512
+#define IPPORT_EXECSERVER 512
+#define IPPORT_LOGINSERVER 513
+#define IPPORT_WHOSERVER 513
+#define IPPORT_CMDSERVER 514
+
+/*
+ * Ports < IPPORT_RESERVED are reserved for
+ * privileged processes (e.g. root).
+ */
+#define IPPORT_RESERVED 1024
+
+/*
+ * Link numbers
+ */
+#define IMPLINK_IP 155
+#define IMPLINK_LOWEXPER 156
+#define IMPLINK_HIGHEXPER 158
+
+
+/*
+ * Internet address
+ */
+struct in_addr {
+ union {
+ struct { unsigned char s_b1,s_b2,s_b3,s_b4; } S_un_b;
+ struct { unsigned short s_w1,s_w2; } S_un_w;
+ unsigned long S_addr;
+ } S_un;
+#define s_addr S_un.S_addr /* can be used for most tcp & ip code */
+#define s_host S_un.S_un_b.s_b2 /* host on imp */
+#define s_net S_un.S_un_b.s_b1 /* network */
+#define s_imp S_un.S_un_w.s_w2 /* imp */
+#define s_impno S_un.S_un_b.s_b4 /* imp # */
+#define s_lh S_un.S_un_b.s_b3 /* logical host */
+};
+
+/*
+ * Definitions of bits in internet address integers.
+ */
+#define IN_CLASSA(i) ((((long)(i))&0x80000000)==0)
+#define IN_CLASSA_NET 0xff000000
+#define IN_CLASSA_NSHIFT 24
+#define IN_CLASSA_HOST 0x00ffffff
+#define IN_CLASSA_MAX 128
+
+#define IN_CLASSB(i) ((((long)(i))&0xc0000000)==0x80000000)
+#define IN_CLASSB_NET 0xffff0000
+#define IN_CLASSB_NSHIFT 16
+#define IN_CLASSB_HOST 0x0000ffff
+#define IN_CLASSB_MAX 65536
+
+#define IN_CLASSC(i) ((((long)(i))&0xe0000000)==0xc0000000)
+#define IN_CLASSC_NET 0xffffff00
+#define IN_CLASSC_NSHIFT 8
+#define IN_CLASSC_HOST 0x000000ff
+
+#define INADDR_ANY 0x00000000
+#define INADDR_BROADCAST 0xffffffff
+
+/*
+ * Socket address, internet style.
+ */
+struct sockaddr_in {
+ short sin_family;
+ unsigned short sin_port;
+ struct in_addr sin_addr;
+ char sin_zero[8];
+};
+
+/* Length of a SOCKADDR or SOCKADDR_IN structure */
+#define SOCAD_LEN 16
+
+#ifdef BYTESWAP
+
+#define htons(x) ((((x) >> 8) & 0x00FF) | (((x) << 8) & 0xFF00))
+
+//
+//BUGBUG - we need to investigate this
+//
+
+#define FUTURE 1
+#ifdef FUTURE
+/*
+ * this macro should be used if its faster than the function
+ * - measure it on the target machine
+ */
+#ifndef i386
+#define htonl(x) ((((x) >> 24) & 0x000000FFL) | \
+ (((x) >> 8) & 0x0000FF00L) | \
+ (((x) << 8) & 0x00FF0000L) | \
+ (((x) << 24) & 0xFF000000L))
+#else
+
+__inline long
+htonl(long x)
+{
+ return((((x) >> 24) & 0x000000FFL) |
+ (((x) >> 8) & 0x0000FF00L) |
+ (((x) << 8) & 0x00FF0000L) |
+ (((x) << 24) & 0xFF000000L));
+}
+
+#endif /* i386 */
+#else
+extern long htonl();
+#endif
+#undef FUTURE
+
+#define ntohs(x) htons(x)
+#define ntohl(x) htonl(x)
+
+#define MASKA 0x000000FFL
+#define MASKB 0x0000FFFFL
+#define MASKC 0x00FFFFFFL
+#define CLSHFT 5 /* Make C generate hyper-optimized case */
+
+#else
+/*
+ * Macros for number representation conversion.
+ */
+#define ntohl(x) (x)
+#define ntohs(x) (x)
+#define htonl(x) (x)
+#define htons(x) (x)
+
+#define MASKA 0xFF000000L
+#define MASKB 0xFFFF0000L
+#define MASKC 0xFFFFFF00L
+#define CLSHFT 29
+#endif
+
+#define CLA0 0 /* It takes the same arg; you mask it off, */
+#define CLA1 1 /* shift, and then do a case statment with */
+#define CLA2 2 /* some code having more than one label. */
+#define CLA3 3 /* Values for class A */
+#define CLB0 4
+#define CLB1 5 /* B */
+#define CLC 6 /* C */
+#define CLI 7 /* Illegal */
+
+#define BROADCAST 0x00000000L
+
+#define CASTA 0x00FFFFFFL
+#define CASTB 0x0000FFFFL
+#define CASTC 0x000000FFL
+
+
+/******************************************************************
+ *
+ * Type Codes for Ethernet packets
+ *
+ ******************************************************************/
+
+#define TY_ETHER 1
+#ifndef TYPE_HACK
+#define TY_PUP 0x0200
+#define TY_IDP 0x0600
+#define TY_IP 0x0800
+#define TY_X25 0x0805
+#define TY_ARP 0x0806
+#define TY_RARP 0x8035
+#ifndef NOTRAILER
+#define TY_TRAIL 0x1000
+#define TY_TRAIL_LO 0x1001
+#define TY_TRAIL_HI 0x1002
+#endif
+#define TY_ECHO 0x9000
+#else /*TYPE_HACK*/
+#define TY_PUP 0x0200
+#define TY_IDP 0x0600
+#define TY_IP 0x0807 /* modified */
+#define TY_X25 0x0805
+#define TY_ARP 0x0808 /* modified */
+#ifndef NOTRAILER
+#define TY_TRAIL 0x2000 /* modified */
+#define TY_TRAIL_LO 0x2001 /* modified */
+#define TY_TRAIL_HI 0x2002 /* modified */
+#endif
+#define TY_ECHO 0x9000
+#endif /*TYPE_HACK*/
+
+/******************************************************************
+ *
+ * Type Codes for Arcnet packets
+ *
+ ******************************************************************/
+
+#define ARCNET_TY_IP 0xd4
+#define ARCNET_TY_ARP 0xd5
+#define ARCNET_TY_RARP 0xd6
+
+/*
+ * LOOPBACK Address - in host and network byte order
+ */
+#define LOOPBACK 0x7F000001L
+#ifdef BYTESWAP
+#define NLOOPBACK 0x0100007FL
+#else
+#define NLOOPBACK 0x7F000001L
+#endif
+
+/*
+ * interface flags
+ */
+#define IFF_UP 0x01
+#define IFF_BROADCAST 0x02
+#define IFF_LOOPBACK 0x04
+#define IFF_POINTOPOINT 0x08
+#define IFF_FORWARDBROADCAST 0x10
+#define IFF_NOKEEPALIVE 0x20
+#define IFF_SLOWLINK 0x40
+
+
+/*
+ * IP Options
+ */
+
+#define IPO_TTL 103
+#define IPO_TOS 104
+#define IPO_OPTS 105
+#define IPO_RDOPTION 106
+#define IPO_RDROUTE IPO_RDOPTION
+#define IPO_OPTCOUNT 107
+#define IPO_RRCOUNT IPO_OPTCOUNT
+
+
+/*
+ * IP Option values
+ */
+
+#define OPT_SECURITY 130
+#define OPT_LSRR 131
+#define OPT_SSRR 137
+#define OPT_RR 7
+#define OPT_STRID 136
+#define OPT_TIMESTAMP 68
+
+/*
+ * Default Time to Live
+ */
+
+#define IHTTL 60
+
+/*
+ * Maximum number of hops stored in a recorded route packet
+ */
+
+#define TCP_RR_MAX 16
+
+#define MAXOPTLEN 256
+
+#ifndef GENERICE
+/*
+ * errors generated
+ */
+#define EFRGSZ 1
+#define EDLTYPE 2
+#define EPRIM 3
+#define EBUF 4
+#define EMSG 5
+#endif /*~GENERICE*/
+
+#endif //IN_INCLUDED
+
diff --git a/private/inc/sockets/resolv.h b/private/inc/sockets/resolv.h
new file mode 100644
index 000000000..5edc854c4
--- /dev/null
+++ b/private/inc/sockets/resolv.h
@@ -0,0 +1,156 @@
+/******************************************************************
+ *
+ * SpiderTCP BIND
+ *
+ * Copyright 1990 Spider Systems Limited
+ *
+ * RESOLV.H
+ *
+ ******************************************************************/
+
+/*
+ * /usr/projects/tcp/SCCS.rel3/rel/src/include/0/s.resolv.h
+ * @(#)resolv.h 5.3
+ *
+ * Last delta created 14:05:35 3/4/91
+ * This file extracted 11:19:25 3/8/91
+ *
+ * Modifications:
+ *
+ * GSS 20 Jul 90 New File
+ */
+
+/*
+ * Copyright (c) 1983, 1987, 1989 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that: (1) source distributions retain this entire copyright
+ * notice and comment, and (2) distributions including binaries display
+ * the following acknowledgement: ``This product includes software
+ * developed by the University of California, Berkeley and its contributors''
+ * in the documentation or other materials provided with the distribution
+ * and in all advertising materials mentioning features or use of this
+ * software. Neither the name of the University nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * @(#)resolv.h 5.10 (Berkeley) 6/1/90
+ */
+
+#ifndef _RESOLV_INCLUDED
+#define _RESOLV_INCLUDED
+
+/*
+ * Global defines and variables for resolver stub.
+ */
+#define MAXNS 8 /* max # name servers we'll track per list */
+#define MAXNSLIST 4 /* max # name servers lists we'll track */
+#define MAXDFLSRCH 3 /* # default domain levels to try */
+#define MAXDNSRCH 6 /* max # domains in search path */
+#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */
+#define RES_TIMEOUT 5 /* min. seconds between retries */
+
+typedef struct _ADDR_LIST {
+ u_long ServerCount;
+ u_long Servers[MAXNS];
+
+} ADDR_LIST, FAR * LPADDR_LIST;
+
+struct state {
+ long options; /* option flags - see below. */
+ int retrans; /* retransmition time interval */
+ u_short retry; /* number of times to retransmit */
+ u_short id; /* current packet id */
+ ADDR_LIST nslist[MAXNSLIST]; /* the server lists */
+ char defdname[MAXDNAME]; /* default domain */
+ char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
+};
+
+/*
+ * Resolver options
+ */
+#define RES_INIT 0x0001 /* address initialized */
+#define RES_DEBUG 0x0002 /* print debug messages */
+#define RES_AAONLY 0x0004 /* authoritative answers only */
+#define RES_USEVC 0x0008 /* use virtual circuit */
+#define RES_PRIMARY 0x0010 /* query primary server only */
+#define RES_IGNTC 0x0020 /* ignore trucation errors */
+#define RES_RECURSE 0x0040 /* recursion desired */
+#define RES_DEFNAMES 0x0080 /* use default domain name */
+#define RES_STAYOPEN 0x0100 /* Keep TCP socket open */
+#define RES_DNSRCH 0x0200 /* search up local domain tree */
+
+#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
+
+
+//
+// Resolver function prototypes
+//
+
+int
+dn_expand(
+ IN unsigned char *msg,
+ IN unsigned char *eomorig,
+ IN unsigned char *comp_dn,
+ OUT unsigned char *exp_dn,
+ IN int length
+ );
+
+int
+dn_comp(
+ IN unsigned char *exp_dn,
+ OUT unsigned char *comp_dn,
+ IN int length,
+ IN unsigned char **dnptrs, OPTIONAL
+ IN OUT unsigned char **lastdnptr OPTIONAL
+ );
+
+int
+res_init(
+ void
+ );
+
+int
+res_send(
+ IN char *buf,
+ IN int buflen,
+ OUT char *answer,
+ IN int anslen
+ );
+
+int
+res_query(
+ IN char *name, /* domain name */
+ IN int class, /* class of query */
+ IN int type, /* type of query */
+ OUT unsigned char *answer, /* buffer to put answer */
+ IN int anslen /* size of answer buffer */
+ );
+
+int
+res_search(
+ IN char *name, /* domain name */
+ IN int class, /* class of query */
+ IN int type, /* type of query */
+ OUT unsigned char *answer, /* buffer to put answer */
+ IN int anslen /* size of answer */
+ );
+
+int
+res_mkquery(
+ IN int op, // opcode of query
+ IN char *dname, // domain name
+ IN int class, // class of query
+ IN int type, // type of query
+ IN char *data, OPTIONAL // resource record data
+ IN int datalen, OPTIONAL // length of data
+ IN struct rrec *newrr, OPTIONAL // new rr for modify or append
+ OUT char *buf, // buffer to put query
+ IN int buflen // size of buffer
+ );
+
+#endif // _RESOLV_INCLUDED
diff --git a/private/inc/sockets/sock_err.h b/private/inc/sockets/sock_err.h
new file mode 100644
index 000000000..2934efbd2
--- /dev/null
+++ b/private/inc/sockets/sock_err.h
@@ -0,0 +1,159 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ sock_err.h
+
+Abstract:
+
+ This module contains error codes for sockets and STREAMS sources.
+
+Author:
+
+ Sam Patton (sampa) July 26, 1991
+
+Revision History:
+
+ when who what
+ ---- --- ----
+ 7-26-91 sampa initial version (in posix\sys\errno.h)
+ 9-19-91 mikemas extracted these codes from posix\sys\errno.h
+
+Notes:
+
+--*/
+/*
+ * Copyright (c) 1984 AT&T
+ * Copyright (c) 1987 Fairchild Semiconductor Corporation
+ * Copyright 1987 Lachman Associates, Incorporated (LAI)
+ * All Rights Reserved
+ *
+ * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T,
+ * FAIRCHILD SEMICONDUCTOR CORPORATION,
+ * (AND LACHMAN ASSOCIATES)
+ * AND SPIDER SYSTEMS.
+ *
+ * stcp copyright above and this notice must be preserved in all
+ * copies of this source code. The copyright above does not
+ * evidence any actual or intended publication of this source
+ * code
+ */
+
+#ifndef SOCK_ERR_INCLUDED
+#define SOCK_ERR_INCLUDED
+
+
+// in CRT #define ENOTBLK 54 /* Block device required */
+// in CRT #define ETXTBSY 55 /* Text file busy */
+#define ENOMSG 56 /* No message of desired type */
+#define EIDRM 57 /* Identifier removed */
+#define ECHRNG 58 /* Channel number out of range */
+#define EL2NSYNC 59 /* Level 2 not synchronized */
+#define EL3HLT 60 /* Level 3 halted */
+#define EL3RST 61 /* Level 3 reset */
+#define ELNRNG 62 /* Link number out of range */
+#define EUNATCH 63 /* Protocol driver not attached */
+#define ENOCSI 64 /* No CSI structure available */
+#define EL2HLT 65 /* Level 2 halted */
+
+/* Convergent Error Returns */
+#define EBADE 66 /* invalid exchange */
+#define EBADR 67 /* invalid request descriptor */
+#define EXFULL 68 /* exchange full */
+#define ENOANO 69 /* no anode */
+#define EBADRQC 70 /* invalid request code */
+#define EBADSLT 71 /* invalid slot */
+// in CRT #define EDEADLOCK 72 /* file locking deadlock error */
+
+#define EBFONT 73 /* bad font file fmt */
+
+/* stream problems */
+#define ENOSTR 74 /* Device not a stream */
+#define ENODATA 75 /* no data (for no delay io) */
+#define ETIME 76 /* timer expired */
+#define ENOSR 77 /* out of streams resources */
+
+#define ENONET 78 /* Machine is not on the network */
+#define ENOPKG 79 /* Package not installed */
+#define EREMOTE 80 /* The object is remote */
+#define ENOLINK 81 /* the link has been severed */
+#define EADV 82 /* advertise error */
+#define ESRMNT 83 /* srmount error */
+
+#define ECOMM 84 /* Communication error on send */
+#define EPROTO 85 /* Protocol error */
+#define EMULTIHOP 86 /* multihop attempted */
+#define ELBIN 87 /* Inode is remote (not really error)*/
+#define EDOTDOT 88 /* Cross mount point (not really error)*/
+#define EBADMSG 89 /* trying to read unreadable message */
+
+#define ENOTUNIQ 90 /* given log. name not unique */
+#define EREMCHG 91 /* Remote address changed */
+
+/* shared library problems */
+#define ELIBACC 92 /* Can't access a needed shared lib. */
+#define ELIBBAD 93 /* Accessing a corrupted shared lib. */
+#define ELIBSCN 94 /* .lib section in a.out corrupted. */
+#define ELIBMAX 95 /* Attempting to link in too many libs. */
+#define ELIBEXEC 96 /* Attempting to exec a shared library. */
+
+
+/*
+ * Additional error codes for the socket library
+ */
+
+#define EWOULDBLOCK EAGAIN /* Operation would block */
+
+#define ENOTSOCK 100 /* Socket operation on non-socket */
+#define EADDRNOTAVAIL 101 /* Can't assign requested address */
+#define EADDRINUSE 102 /* Address already in use */
+#define EAFNOSUPPORT 103
+ /* Address family not supported by protocol family */
+#define ESOCKTNOSUPPORT 104 /* Socket type not supported */
+#define EPROTONOSUPPORT 105 /* Protocol not supported */
+#define ENOBUFS 106 /* No buffer space available */
+#define ETIMEDOUT 107 /* Connection timed out */
+#define EISCONN 108 /* Socket is already connected */
+#define ENOTCONN 109 /* Socket is not connected */
+#define ENOPROTOOPT 110 /* Bad protocol option */
+#define ECONNRESET 111 /* Connection reset by peer */
+#define ECONNABORT 112 /* Software caused connection abort */
+#define ENETDOWN 113 /* Network is down */
+#define ECONNREFUSED 114 /* Connection refused */
+#define EHOSTUNREACH 115 /* Host is unreachable */
+#define EPROTOTYPE 116 /* Protocol wrong type for socket */
+#define EOPNOTSUPP 117 /* Operation not supported on socket */
+
+#define ETIMEOUT ETIMEDOUT
+
+/*
+ * these originate from the Internet Module
+ */
+#define ESUBNET 118 /* IP subnet table full */
+#define ENETNOLNK 119 /* Subnet module not linked */
+#define EBADIOCTL 120 /* Unknown ioctl call */
+#define ERESOURCE 121 /* Failure in Streams buffer allocn */
+
+#define EPROTUNR 122 /* ICMP Protocol unreachable */
+#define EPORTUNR 123 /* ICMP Port unreachable */
+#define ENETUNR 124 /* ICMP Network unreachable */
+
+#define ENETUNREACH ENETUNR /* ICMP Network unreachable */
+
+/*
+ * Ethernet Driver Errors
+ */
+
+#define EPACKET 150 /* Invalid Ethernet Packet */
+#define ETYPEREG 151 /* Type registration error */
+
+/*
+ * Socket library call
+ */
+
+#define ENOTINIT 152 /* Sockets library not initialized */
+
+
+#endif //SOCK_ERR_INCLUDED
diff --git a/private/inc/sockets/sys/psxsock.h b/private/inc/sockets/sys/psxsock.h
new file mode 100644
index 000000000..5c30fe35b
--- /dev/null
+++ b/private/inc/sockets/sys/psxsock.h
@@ -0,0 +1,222 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ psxsock.h
+
+Abstract:
+
+ Types, prototypes and definitions for Win32 sockets.
+
+Author:
+
+ Sam Patton (sampa) September 11, 1991
+
+Revision History:
+
+ when who what
+ ---- --- ----
+ 11-21-91 mikemas intitial version - cloned from winsock.h
+
+--*/
+
+#ifndef PSXSOCK_INCLUDED
+#define PSXSOCK_INCLUDED
+
+//
+// POSIX includes
+//
+// #include <posix.h>
+
+
+//
+// POSIX-specific defintions
+//
+#define INVALID_SOCKET_HANDLE ((int) -1)
+#define SOCKET_HANDLE int
+
+
+//
+// common sockets include file
+//
+#include <sys\socket.h>
+
+
+//
+// Prototypes for all exported socket functions
+//
+
+SOCKET_HANDLE
+accept(
+ IN SOCKET_HANDLE, //socket to accept on
+ OUT struct sockaddr *, //peer address
+ OUT int *); //size of peer address
+
+int
+bind(
+ IN SOCKET_HANDLE, //socket to bind
+ IN struct sockaddr *, //address to bind to
+ IN int); //size of address
+
+int
+connect(
+ IN SOCKET_HANDLE, //socket to connect from
+ IN struct sockaddr *, //address to connect to
+ IN int); //size of address
+
+int
+listen(
+ IN SOCKET_HANDLE, //socket to listen with
+ IN int); //length of listen queue
+
+int
+getpeername(
+ IN SOCKET_HANDLE, //connected socket to get peer of
+ OUT struct sockaddr *, //buffer to put peer address into
+ OUT int *); //length of buffer
+
+int
+getsockname(
+ IN SOCKET_HANDLE, //socket to get the address of
+ OUT struct sockaddr *, //buffer to put my address into
+ OUT int *); //length of buffer
+
+
+int
+poll(
+ IN OUT struct pollfd *,
+ IN unsigned int,
+ IN int);
+
+int
+recv(
+ IN SOCKET_HANDLE, //socket to receive with
+ IN char *, //buffer to receive into
+ IN int, //size of buffer
+ IN int); //receive flags
+
+int
+recvfrom(
+ IN SOCKET_HANDLE, //socket to receive with
+ OUT char *, //buffer to receive into
+ IN int, //size of buffer
+ IN int, //receive flags
+ OUT struct sockaddr *, //address received from
+ OUT int *); //size of address
+
+int
+send(
+ IN SOCKET_HANDLE, //socket to send from
+ IN char *, //buffer to send
+ IN int, //size of buffer
+ IN int); //send flags
+
+int
+sendto(
+ IN SOCKET_HANDLE, //socket to send from
+ IN char *, //buffer to send
+ IN int, //size of buffer
+ IN int, //send flags
+ IN struct sockaddr *, //address to send to
+ IN int); //size of address
+
+SOCKET_HANDLE
+socket(
+ IN int, //address family
+ IN int, //socket type
+ IN int); //protocol
+
+int
+so_recv(
+ IN SOCKET_HANDLE, //socket to receive with
+ OUT char *, //buffer to receive into
+ IN int, //size of buffer
+ OUT int *); //receive flags
+
+int
+setsockopt(
+ IN SOCKET_HANDLE,
+ int,
+ int,
+ char *,
+ int);
+
+int
+getsockopt(
+ IN SOCKET_HANDLE,
+ int,
+ int,
+ char *,
+ int *);
+
+int
+shutdown(
+ IN SOCKET_HANDLE,
+ IN int);
+
+
+//
+// Host name control
+//
+
+int
+gethostname(
+ OUT char *name,
+ IN int namelen
+ );
+
+int
+sethostname (
+ IN char *name,
+ IN int namelen
+ );
+
+
+//
+// Remote execution utilities
+//
+
+SOCKET_HANDLE
+rcmd(
+ IN OUT char **ahost,
+ IN unsigned short inport,
+ IN char *locuser,
+ IN char *remuser,
+ IN char *cmd,
+ IN OUT SOCKET_HANDLE *fd2p OPTIONAL
+ );
+
+SOCKET_HANDLE
+rresvport(
+ IN OUT unsigned short *port
+ );
+
+SOCKET_HANDLE
+rexec(
+ IN char **ahost,
+ IN unsigned short rport,
+ IN char *name,
+ IN char *pass,
+ IN char *cmd,
+ OUT SOCKET_HANDLE *fd2p OPTIONAL
+ );
+
+
+//
+// Resolver error return utilities
+//
+
+DWORD
+GetLastHError(
+ VOID
+ );
+
+VOID
+SetLastHError(
+ DWORD ErrCode
+ );
+
+
+#endif //PSXSOCK_INCLUDED
diff --git a/private/inc/sockets/sys/socket.h b/private/inc/sockets/sys/socket.h
new file mode 100644
index 000000000..7216c7b49
--- /dev/null
+++ b/private/inc/sockets/sys/socket.h
@@ -0,0 +1,158 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ socket.h
+
+Abstract:
+
+ contains types and #defines for sockets.
+
+Author:
+
+ Sam Patton (sampa) July 26, 1991
+
+Revision History:
+
+ when who what
+ ---- --- ----
+ 7-26-91 sampa initial version
+
+--*/
+
+/******************************************************************
+ *
+ * SpiderTCP System Include Files
+ *
+ * Copyright 1987 Spider Systems Limited
+ *
+ * SOCKET.H
+ *
+ * Definitions related to sockets:
+ * types, address families, options.
+ *
+ *
+ ******************************************************************/
+
+
+#ifndef SYS_SOCKET_INCLUDED
+#define SYS_SOCKET_INCLUDED
+/*
+ * Types
+ */
+#define SOCK_STREAM 1 /* stream socket */
+#define SOCK_DGRAM 2 /* datagram socket */
+#define SOCK_RAW 3 /* raw-protocol interface */
+#define SOCK_RDM 4 /* reliably-delivered message */
+#define SOCK_SEQPACKET 5 /* sequenced packet stream */
+
+/*
+ * Option flags per-socket.
+ */
+#define SO_DEBUG 0x01 /* turn on debugging info recording */
+#define SO_ACCEPTCONN 0x02 /* socket has had listen() */
+#define SO_REUSEADDR 0x04 /* allow local address reuse */
+#define SO_KEEPALIVE 0x08 /* keep connections alive */
+#define SO_DONTROUTE 0x10 /* just use interface addresses */
+#define SO_BROADCAST 0x20 /* permit sending of broadcast msgs */
+#define SO_USELOOPBACK 0x40 /* bypass hardware when possible */
+#define SO_LINGER 0x80 /* linger on close if data present */
+#define SO_RDWR 0x100 /* User read/write for datagram sockets */
+#define SO_NODELAY 0x200 /* Forward data expediently */
+#define SO_URGENT 0x400 /* Notify urgent data */
+
+#ifdef TESTOPT
+#define SO_TESTOPT 0x800 /* option for testing internals */
+#endif
+#ifdef UNDEF
+ /*
+ * I don't think we use these?? NCF
+ */
+
+/*
+ * Additional options, not kept in so_options.
+ */
+#define SO_SNDBUF 0x1001 /* send buffer size */
+#define SO_RCVBUF 0x1002 /* receive buffer size */
+#define SO_SNDLOWAT 0x1003 /* send low-water mark */
+#define SO_RCVLOWAT 0x1004 /* receive low-water mark */
+#define SO_SNDTIMEO 0x1005 /* send timeout */
+#define SO_RCVTIMEO 0x1006 /* receive timeout */
+#endif
+
+/*
+ * Structure used for manipulating linger option.
+ */
+struct linger {
+ int l_onoff; /* option on/off */
+ int l_linger; /* linger time */
+};
+
+/*
+ * Level number for (get/set)sockopt() to apply to socket itself.
+ */
+#define SOL_SOCKET 0xffff /* options for socket level */
+
+/*
+ * Address families.
+ */
+#define AF_UNSPEC 0 /* unspecified */
+#define AF_UNIX 1 /* local to host (pipes, portals) */
+#define AF_INET 2 /* internetwork: UDP, TCP, etc. */
+#define AF_NS 3 /* XNS -- not implemented */
+#define AF_IMPLINK 4 /* IMP link layer -- not implemented */
+#define AF_NETBIOS 5 /* NetBios, unique to NT */
+#define AF_LOOPBACK 6 /* for testing only */
+
+#ifdef ROUTED
+#define AF_MAX 6 /* must be > 2 for ROUTED */
+#else
+#define AF_MAX 6
+#endif
+
+/*
+ * Structure used by kernel to store most
+ * addresses.
+ */
+struct sockaddr {
+ unsigned short sa_family; /* address family */
+ char sa_data[14]; /* up to 14 bytes of direct address */
+};
+
+/*
+ * Structure used by kernel to pass protocol
+ * information in raw sockets.
+ */
+struct sockproto {
+ unsigned short sp_family; /* address family */
+ unsigned short sp_protocol; /* protocol */
+};
+
+/*
+ * Protocol families, same as address families for now.
+ */
+#define PF_UNSPEC AF_UNSPEC
+#define PF_UNIX AF_UNIX
+#define PF_INET AF_INET
+
+#define PF_MAX 2
+
+/*
+ * Maximum queue length specifiable by listen.
+ */
+#define SOMAXCONN 5
+
+#define MSG_OOB 0x1 /* process out-of-band data */
+#define MSG_DONTROUTE 0x4 /* send without using routing tables */
+#ifdef UNDEF
+#define MSG_PEEK 0x2 /* peek at incoming message */
+#endif
+
+#define OOB_PEND 0x08 /* Urgent data pending */
+
+#define MSG_MAXIOVLEN 16
+
+
+#endif //SYS_SOCKET_INCLUDED
diff --git a/private/inc/sockets/sys/winsock.h b/private/inc/sockets/sys/winsock.h
new file mode 100644
index 000000000..b7ab434cc
--- /dev/null
+++ b/private/inc/sockets/sys/winsock.h
@@ -0,0 +1,216 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ winsock.h
+
+Abstract:
+
+ Types, prototypes and definitions for Win32 sockets.
+
+Author:
+
+ Sam Patton (sampa) September 11, 1991
+
+Revision History:
+
+ when who what
+ ---- --- ----
+ 9-11-91 sampa initial version
+ 11-21-91 mikemas introduced socket type definitions, moved prototypes
+ into socket.h
+
+--*/
+
+#ifndef WINSOCK_INCLUDED
+#define WINSOCK_INCLUDED
+
+
+// Windows includes
+#include <windows.h>
+
+
+//
+// Windows-specific defintions
+//
+#define INVALID_SOCKET_HANDLE INVALID_HANDLE_VALUE
+#define SOCKET_HANDLE HANDLE
+
+
+//
+// common sockets include file
+//
+#include <sockets\sys\socket.h>
+
+
+//
+// Prototypes for all exported socket functions
+//
+
+SOCKET_HANDLE
+accept(
+ IN SOCKET_HANDLE, //socket to accept on
+ OUT struct sockaddr *, //peer address
+ OUT int *); //size of peer address
+
+int
+bind(
+ IN SOCKET_HANDLE, //socket to bind
+ IN struct sockaddr *, //address to bind to
+ IN int); //size of address
+
+int
+connect(
+ IN SOCKET_HANDLE, //socket to connect from
+ IN struct sockaddr *, //address to connect to
+ IN int); //size of address
+
+int
+listen(
+ IN SOCKET_HANDLE, //socket to listen with
+ IN int); //length of listen queue
+
+int
+getpeername(
+ IN SOCKET_HANDLE, //connected socket to get peer of
+ OUT struct sockaddr *, //buffer to put peer address into
+ OUT int *); //length of buffer
+
+int
+getsockname(
+ IN SOCKET_HANDLE, //socket to get the address of
+ OUT struct sockaddr *, //buffer to put my address into
+ OUT int *); //length of buffer
+
+int
+recv(
+ IN SOCKET_HANDLE, //socket to receive with
+ IN char *, //buffer to receive into
+ IN int, //size of buffer
+ IN int); //receive flags
+
+int
+recvfrom(
+ IN SOCKET_HANDLE, //socket to receive with
+ OUT char *, //buffer to receive into
+ IN int, //size of buffer
+ IN int, //receive flags
+ OUT struct sockaddr *, //address received from
+ OUT int *); //size of address
+
+int
+send(
+ IN SOCKET_HANDLE, //socket to send from
+ IN char *, //buffer to send
+ IN int, //size of buffer
+ IN int); //send flags
+
+int
+sendto(
+ IN SOCKET_HANDLE, //socket to send from
+ IN char *, //buffer to send
+ IN int, //size of buffer
+ IN int, //send flags
+ IN struct sockaddr *, //address to send to
+ IN int); //size of address
+
+SOCKET_HANDLE
+socket(
+ IN int, //address family
+ IN int, //socket type
+ IN int); //protocol
+
+int
+so_recv(
+ IN SOCKET_HANDLE, //socket to receive with
+ OUT char *, //buffer to receive into
+ IN int, //size of buffer
+ OUT int *); //receive flags
+
+int
+setsockopt(
+ IN SOCKET_HANDLE,
+ int,
+ int,
+ char *,
+ int);
+
+int
+getsockopt(
+ IN SOCKET_HANDLE,
+ int,
+ int,
+ char *,
+ int *);
+
+int
+shutdown(
+ IN SOCKET_HANDLE,
+ IN int);
+
+
+//
+// Host name control
+//
+
+int
+gethostname(
+ OUT char *name,
+ IN int namelen
+ );
+
+int
+sethostname (
+ IN char *name,
+ IN int namelen
+ );
+
+
+//
+// Remote execution utilities
+//
+
+SOCKET_HANDLE
+rcmd(
+ IN OUT char **ahost,
+ IN unsigned short inport,
+ IN char *locuser,
+ IN char *remuser,
+ IN char *cmd,
+ IN OUT SOCKET_HANDLE *fd2p OPTIONAL
+ );
+
+SOCKET_HANDLE
+rresvport(
+ IN OUT unsigned short *port
+ );
+
+SOCKET_HANDLE
+rexec(
+ IN char **ahost,
+ IN unsigned short rport,
+ IN char *name,
+ IN char *pass,
+ IN char *cmd,
+ OUT SOCKET_HANDLE *fd2p OPTIONAL
+ );
+
+
+//
+// Resolver error return utilities
+//
+
+DWORD
+GetLastHError(
+ VOID
+ );
+
+VOID
+SetLastHError(
+ DWORD ErrCode
+ );
+
+
+#endif //WINSOCK_INCLUDED
diff --git a/private/inc/soundcfg.h b/private/inc/soundcfg.h
new file mode 100644
index 000000000..55c11e498
--- /dev/null
+++ b/private/inc/soundcfg.h
@@ -0,0 +1,127 @@
+
+/*++ BUILD Version: 0001 // Increment this if a change has global effects
+
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ soundcfg.h
+
+Abstract:
+
+ This include file defines common strings and values for sound driver
+ configuration.
+
+Author:
+
+ Robin Speed (RobinSp) 17-Oct-92
+
+Revision History:
+--*/
+
+#define SOUND_REG_PORT (L"Port")
+#define SOUND_REG_DMACHANNEL (L"DmaChannel")
+#define SOUND_REG_INTERRUPT (L"Interrupt")
+#define SOUND_REG_INPUTSOURCE (L"Input Source")
+#define SOUND_REG_DMABUFFERSIZE (L"Dma Buffer Size")
+#define SOUND_REG_CONFIGERROR (L"Configuration Error")
+#define SOUND_REG_LOADTYPE (L"Load Type")
+#define SOUND_REG_PNPDEVICE (L"PnP Device")
+
+ //
+ // Values for Load Type
+ //
+
+ #define SOUND_LOADTYPE_NORMAL 0x00
+ #define SOUND_LOADTYPE_CONFIG 0x01 // Fail load but return config data
+
+#define SOUND_REG_SYNTH_TYPE (L"Synth Type")
+
+ //
+ // Values for synth type
+ //
+
+ #define SOUND_SYNTH_TYPE_NONE 0x00
+ #define SOUND_SYNTH_TYPE_ADLIB 0x01
+ #define SOUND_SYNTH_TYPE_OPL3 0x02
+
+#define SOUND_MIXER_SETTINGS_NAME (L"Mixer Settings")
+
+
+//
+// Errors
+//
+
+#define SOUND_CONFIG_ERROR 0x00000000
+#define SOUND_CONFIG_OK 0xFFFFFFFF
+#define SOUND_CONFIG_NOCARD 0x00000001
+#define SOUND_CONFIG_BADINT 0x00000002
+#define SOUND_CONFIG_BADDMA 0x00000003
+#define SOUND_CONFIG_BADCARD 0x00000004
+#define SOUND_CONFIG_RESOURCE 0x00000005
+
+#define SOUND_CONFIG_BADPORT 0x00000006
+#define SOUND_CONFIG_PORT_INUSE 0x00000007
+#define SOUND_CONFIG_DMA_INUSE 0x00000008
+#define SOUND_CONFIG_INT_INUSE 0x00000009
+
+#define SOUND_CONFIG_NOINT 0x0000000A
+#define SOUND_CONFIG_NODMA 0x0000000B
+
+
+#define PARMS_SUBKEY L"Parameters"
+#define SOUND_DEVICES_SUBKEY L"Devices"
+#define SOUND_DRIVER_PARMS L"DriverParameters"
+
+#define REG_VALUENAME_LEFTMASTER L"LeftMasterVolumeAtten"
+#define REG_VALUENAME_RIGHTMASTER L"RightMasterVolumeAtten"
+#define REG_VALUENAME_LEFTLINEIN L"LeftLineInAtten"
+#define REG_VALUENAME_RIGHTLINEIN L"RightLineInAtten"
+#define REG_VALUENAME_LEFTDAC L"LeftDACAtten"
+#define REG_VALUENAME_RIGHTDAC L"RightDACAtten"
+#define REG_VALUENAME_LEFTMICMIX L"LeftMicMixAtten"
+#define REG_VALUENAME_RIGHTMICMIX L"RightMicMixAtten"
+#define REG_VALUENAME_LEFTADC L"LeftADCAtten"
+#define REG_VALUENAME_RIGHTADC L"RightADCAtten"
+#define REG_VALUENAME_LEFTSYNTH L"LeftSynthAtten"
+#define REG_VALUENAME_RIGHTSYNTH L"RightSynthAtten"
+
+
+//
+// Input source selection
+//
+
+#define INPUT_LINEIN 0
+#define INPUT_AUX 1
+#define INPUT_MIC 2
+#define INPUT_OUTPUT 3
+
+//
+// Default volume settings on initial install
+//
+
+#define DEF_ADC_VOLUME 0x24000000
+#define DEF_DAC_VOLUME 0x24000000
+#define DEF_SYNTH_VOLUME 0x24000000
+#define DEF_AUX_VOLUME 0x24000000
+#define DEF_MICMIX_VOLUME 0x00000000
+
+/****************************************************************************
+
+ Device Types
+
+ ***************************************************************************/
+
+//
+// Device type flags used in the local info structure
+//
+
+#define WAVE_IN 0x01 // Wave in device
+#define WAVE_OUT 0x02 // Wave out device
+#define MIDI_IN 0x03 // Midi in device
+#define MIDI_OUT 0x04 // Midi out device
+#define AUX_DEVICE 0x05 // aux device
+#define MIXER_DEVICE 0x06 // Mixer device
+#define SYNTH_DEVICE 0x07 // Synth device (adlib or opl3)
+
diff --git a/private/inc/soundsys.h b/private/inc/soundsys.h
new file mode 100644
index 000000000..546917926
--- /dev/null
+++ b/private/inc/soundsys.h
@@ -0,0 +1,111 @@
+/*++ BUILD Version: 0001 // Increment this if a change has global effects
+
+
+Copyright (c) 1992 Microsoft Corporation
+
+Module Name:
+
+ soundsys.h
+
+Abstract:
+
+ This include file defines constants and types for
+ the Microsoft sound system card.
+
+ This header file is shared between the low level driver and the
+ kernel driver.
+
+Author:
+
+ Robin Speed (RobinSp) 20-Oct-92
+
+Revision History:
+
+--*/
+
+#define VALID_IO_PORTS {0x530, 0x604, 0xE80, 0xF40, 0xFFFF}
+#define VALID_INTERRUPTS {7, 9, 10, 11, 0xFFFF}
+#define VALID_DMA_CHANNELS {0, 1, 3, 0xFFFF}
+
+#define SOUND_DEF_DMACHANNEL 1 // DMA channel no
+#define SOUND_DEF_INT 11
+#define SOUND_DEF_PORT 0x530
+
+#define SOUND_REG_SINGLEMODEDMA L"Single Mode DMA"
+
+#define SOUNDSYS_BUFFERSIZE 0x4000 // DMA buffer size - 16K
+
+/*
+** CAPS strings
+*/
+
+#define STR_DRIVERWAVEIN L"Windows Sound System Record"
+#define STR_DRIVERWAVEOUT L"Windows Sound System Playback"
+#define STR_DRIVERMIDIOUT L"Windows Sound System MIDI"
+#define STR_DRIVERMIC L"Windows Sound System Mic"
+#define STR_DRIVERLINEIN L"Windows Sound System Line In"
+#define STR_DRIVERMASTERVOLUME L"Windows Sound System Master"
+
+
+#define IDS_WAVEOUT_PNAME 101
+#define IDS_WAVEIN_PNAME 102
+#define IDS_MIDIOUT_PNAME 103
+#define IDS_AUX_PNAME 104
+
+#define IDS_DESTLINEOUT_SHORT_NAME 110
+#define IDS_DESTLINEOUT_LONG_NAME 111
+#define IDS_DESTWAVEIN_SHORT_NAME 112
+#define IDS_DESTWAVEIN_LONG_NAME 113
+#define IDS_DESTVOICEIN_SHORT_NAME 114
+#define IDS_DESTVOICEIN_LONG_NAME 115
+
+#define IDS_SRCAUX1_SHORT_NAME 120
+#define IDS_SRCAUX1_LONG_NAME 121
+#define IDS_SRCWAVEOUT_SHORT_NAME 122
+#define IDS_SRCWAVEOUT_LONG_NAME 123
+#define IDS_SRCMIDIOUT_SHORT_NAME 124
+#define IDS_SRCMIDIOUT_LONG_NAME 125
+#define IDS_SRCMIC_SHORT_NAME 126
+#define IDS_SRCMIC_LONG_NAME 127
+
+#define IDS_CONTROL_VOLLINEOUT_SHORT_NAME 130
+#define IDS_CONTROL_VOLLINEOUT_LONG_NAME 131
+#define IDS_CONTROL_MUTELINEOUT_SHORT_NAME 132
+#define IDS_CONTROL_MUTELINEOUT_LONG_NAME 133
+#define IDS_CONTROL_MUXWAVEIN_SHORT_NAME 134
+#define IDS_CONTROL_MUXWAVEIN_LONG_NAME 135
+#define IDS_CONTROL_MUXVOICEIN_SHORT_NAME 136
+#define IDS_CONTROL_MUXVOICEIN_LONG_NAME 137
+#define IDS_CONTROL_VOLLINEOUTAUX1_SHORT_NAME 138
+#define IDS_CONTROL_VOLLINEOUTAUX1_LONG_NAME 139
+#define IDS_CONTROL_MUTELINEOUTAUX1_SHORT_NAME 140
+#define IDS_CONTROL_MUTELINEOUTAUX1_LONG_NAME 141
+#define IDS_CONTROL_VOLLINEOUTWAVEOUT_SHORT_NAME 142
+#define IDS_CONTROL_VOLLINEOUTWAVEOUT_LONG_NAME 143
+#define IDS_CONTROL_MUTELINEOUTWAVEOUT_SHORT_NAME 144
+#define IDS_CONTROL_MUTELINEOUTWAVEOUT_LONG_NAME 145
+#define IDS_CONTROL_PEAKLINEOUTWAVEOUT_SHORT_NAME 146
+#define IDS_CONTROL_PEAKLINEOUTWAVEOUT_LONG_NAME 147
+#define IDS_CONTROL_VOLLINEOUTMIDIOUT_SHORT_NAME 148
+#define IDS_CONTROL_VOLLINEOUTMIDIOUT_LONG_NAME 149
+#define IDS_CONTROL_MUTELINEOUTMIDIOUT_SHORT_NAME 150
+#define IDS_CONTROL_MUTELINEOUTMIDIOUT_LONG_NAME 151
+#define IDS_CONTROL_VOLWAVEINAUX1_SHORT_NAME 152
+#define IDS_CONTROL_VOLWAVEINAUX1_LONG_NAME 153
+#define IDS_CONTROL_PEAKWAVEINAUX1_SHORT_NAME 154
+#define IDS_CONTROL_PEAKWAVEINUAX1_LONG_NAME 155
+#define IDS_CONTROL_VOLWAVEINMIC_SHORT_NAME 156
+#define IDS_CONTROL_VOLWAVEINMIC_LONG_NAME 157
+#define IDS_CONTROL_PEAKWAVEINMIC_SHORT_NAME 158
+#define IDS_CONTROL_PEAKWAVEINMIC_LONG_NAME 159
+#define IDS_CONTROL_VOLVOICEINAUX1_SHORT_NAME 160
+#define IDS_CONTROL_VOLVOICEINAUX1_LONG_NAME 161
+#define IDS_CONTROL_PEAKVOICEINAUX1_SHORT_NAME 162
+#define IDS_CONTROL_PEAKVOICEINUAX1_LONG_NAME 163
+#define IDS_CONTROL_VOLVOICEINMIC_SHORT_NAME 164
+#define IDS_CONTROL_VOLVOICEINMIC_LONG_NAME 165
+#define IDS_CONTROL_PEAKVOICEINMIC_SHORT_NAME 166
+#define IDS_CONTROL_PEAKVOICEINMIC_LONG_NAME 167
+
+#define SR_STR_DRIVER_MIXER 180
+
diff --git a/private/inc/srvann.h b/private/inc/srvann.h
new file mode 100644
index 000000000..66cf9756b
--- /dev/null
+++ b/private/inc/srvann.h
@@ -0,0 +1,110 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ srvann.h
+
+Abstract:
+
+ Contains function prototypes for internal server announcement interfaces
+ between services and the service controller.
+
+Author:
+
+ Dan Lafferty (danl) 31-Mar-1991
+
+Environment:
+
+ User Mode -Win32
+
+Revision History:
+
+ 31-Mar-1991 danl
+ created
+ 15-Aug-1995 anirudhs
+ Added I_ScGetCurrentGroupStateW.
+
+--*/
+
+#ifndef _SRVANN_INCLUDED
+#define _SRVANN_INCLUDED
+
+//
+// This entrypoint is exported by the service controller. It is to be
+// called by any service wishing to set up announcement bits.
+//
+// The service controller will then pass the information on to the
+// server service when appropriate.
+//
+BOOL
+I_ScSetServiceBitsW(
+ IN SERVICE_STATUS_HANDLE hServiceStatus,
+ IN DWORD dwServiceBits,
+ IN BOOL bSetBitsOn,
+ IN BOOL bUpdateImmediately,
+ IN LPWSTR pszReserved
+ );
+
+BOOL
+I_ScSetServiceBitsA (
+ IN SERVICE_STATUS_HANDLE hServiceStatus,
+ IN DWORD dwServiceBits,
+ IN BOOL bSetBitsOn,
+ IN BOOL bUpdateImmediately,
+ IN LPSTR pszReserved
+ );
+
+#ifdef UNICODE
+#define I_ScSetServiceBits I_ScSetServiceBitsW
+#else
+#define I_ScSetServiceBits I_ScSetServiceBitsA
+#endif
+
+//
+// This entrypoint is exported by the service controller. It returns
+// the startup status of a specified service group. It is used by
+// the LSA to determine whether logon can proceed, by checking whether
+// the transports have been started. This enables logon to proceed
+// before the workstation service has started.
+// This function should NOT be called by any service's initialization
+// code. The service should use a dependency on the group instead.
+//
+
+#define GROUP_NOT_STARTED 0x00000000
+#define GROUP_ONE_STARTED 0x00000001
+#define GROUP_START_FAIL 0x00000002
+
+DWORD
+I_ScGetCurrentGroupStateW(
+ IN SC_HANDLE hSCManager,
+ IN LPWSTR pszGroupName,
+ OUT LPDWORD pdwCurrentState
+ );
+
+
+//
+// These entrypoints are exported by the server service. They are called
+// by the service controller only.
+//
+NET_API_STATUS
+I_NetServerSetServiceBits (
+ IN LPTSTR servername,
+ IN LPTSTR transport OPTIONAL,
+ IN DWORD servicebits,
+ IN DWORD updateimmediately
+ );
+
+NET_API_STATUS
+I_NetServerSetServiceBitsEx (
+ IN LPWSTR ServerName,
+ IN LPWSTR EmulatedServerName OPTIONAL,
+ IN LPTSTR TransportName OPTIONAL,
+ IN DWORD ServiceBitsOfInterest,
+ IN DWORD ServiceBits,
+ IN DWORD UpdateImmediately
+ );
+
+
+#endif // _SRVANN_INCLUDED
diff --git a/private/inc/srvfsctl.h b/private/inc/srvfsctl.h
new file mode 100644
index 000000000..6144a6cd1
--- /dev/null
+++ b/private/inc/srvfsctl.h
@@ -0,0 +1,629 @@
+/*++ BUILD Version: 0001 // Increment this if a change has global effects
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ srvfsctl.h
+
+Abstract:
+
+ This module defines I/O control codes and structures for the File
+ System Driver of the LAN Manager server.
+
+Author:
+
+ David Treadwell (davidtr) 22-May-1990
+
+Revision History:
+
+--*/
+
+#ifndef _SRVFSCTL_
+#define _SRVFSCTL_
+
+
+//
+// The name of the server device.
+//
+
+#define SERVER_DEVICE_NAME TEXT("\\Device\\LanmanServer")
+
+//
+// IRP control codes used to send requests to the server. These are
+// used as parameters to NtFsControlFile, and may be found in
+// Irp->Parameters.FsControl.FsControlCode in the server dispatch
+// routine.
+//
+// Note that the low two bits of this code indicate the "method" in
+// which the IO system uses the buffers passed by the user to
+// NtFsControlFile. We use method 0--normal, buffered output (not
+// DMA)--for non-API requests, and method 3--"neither" IO--for API
+// requests that get processed in the server FSD. For the APIs
+// that are processed in the server FSP, use method 0.
+//
+// !!! Add more as necessary.
+
+#define FSCTL_SRV_BASE FILE_DEVICE_NETWORK
+#define FSCTL_SRV_API 1 << 11
+
+#define _SRV_CONTROL_CODE(request,method) \
+ ((FSCTL_SRV_BASE)<<12 | (request<<2) | method)
+
+#define _SRV_API_CONTROL_CODE(request) \
+ ((FSCTL_SRV_BASE)<<12 | FSCTL_SRV_API | (request<<2) | METHOD_NEITHER )
+
+#define SRV_API_INDEX(code) \
+ ((code & ~(0xFFFFF000 | FSCTL_SRV_API)) >> 2)
+
+//
+// Standard FSCTLs.
+//
+
+#define FSCTL_SRV_STARTUP _SRV_CONTROL_CODE( 0, METHOD_NEITHER )
+#define FSCTL_SRV_SHUTDOWN _SRV_CONTROL_CODE( 1, METHOD_NEITHER )
+#define FSCTL_SRV_CLEAR_STATISTICS _SRV_CONTROL_CODE( 2, METHOD_BUFFERED )
+#define FSCTL_SRV_GET_STATISTICS _SRV_CONTROL_CODE( 3, METHOD_BUFFERED )
+#define FSCTL_SRV_SET_DEBUG _SRV_CONTROL_CODE( 4, METHOD_BUFFERED )
+#define FSCTL_SRV_XACTSRV_CONNECT _SRV_CONTROL_CODE( 5, METHOD_BUFFERED )
+#define FSCTL_SRV_SEND_DATAGRAM _SRV_CONTROL_CODE( 6, METHOD_NEITHER )
+#define FSCTL_SRV_SET_PASSWORD_SERVER _SRV_CONTROL_CODE( 7, METHOD_BUFFERED )
+#define FSCTL_SRV_START_SMBTRACE _SRV_CONTROL_CODE( 8, METHOD_BUFFERED )
+#define FSCTL_SRV_SMBTRACE_FREE_SMB _SRV_CONTROL_CODE( 9, METHOD_BUFFERED )
+#define FSCTL_SRV_END_SMBTRACE _SRV_CONTROL_CODE( 10, METHOD_BUFFERED )
+#define FSCTL_SRV_QUERY_CONNECTIONS _SRV_CONTROL_CODE( 11, METHOD_BUFFERED )
+#define FSCTL_SRV_PAUSE _SRV_CONTROL_CODE( 12, METHOD_NEITHER )
+#define FSCTL_SRV_CONTINUE _SRV_CONTROL_CODE( 13, METHOD_NEITHER )
+#define FSCTL_SRV_GET_CHALLENGE _SRV_CONTROL_CODE( 14, METHOD_BUFFERED )
+#define FSCTL_SRV_GET_DEBUG_STATISTICS _SRV_CONTROL_CODE( 15, METHOD_BUFFERED )
+#define FSCTL_SRV_XACTSRV_DISCONNECT _SRV_CONTROL_CODE( 16, METHOD_BUFFERED )
+#define FSCTL_SRV_REGISTRY_CHANGE _SRV_CONTROL_CODE( 17, METHOD_NEITHER )
+#define FSCTL_SRV_GET_QUEUE_STATISTICS _SRV_CONTROL_CODE( 18, METHOD_BUFFERED )
+#define FSCTL_SRV_SHARE_STATE_CHANGE _SRV_CONTROL_CODE( 19, METHOD_BUFFERED )
+#define FSCTL_SRV_BEGIN_PNP_NOTIFICATIONS _SRV_CONTROL_CODE(20, METHOD_BUFFERED )
+
+//
+// The following FSCTL can be issued by a kernel driver to hook into the server
+// for accelerated direct host IPX performance. A pointer to an SRV_IPX_SMART_CARD
+// structure is given for the START fsctl as the InputBuffer.
+
+#define FSCTL_SRV_IPX_SMART_CARD_START _SRV_CONTROL_CODE( 21, METHOD_NEITHER )
+
+//
+// API FSCTLs.
+//
+// *** The order of these must match the order of API processors in
+// the SrvApiDispatchTable jump table defined in ntos\srv\srvdata.c!
+
+#define FSCTL_SRV_NET_CHARDEV_CONTROL _SRV_API_CONTROL_CODE( 0 )
+#define FSCTL_SRV_NET_CHARDEV_ENUM _SRV_API_CONTROL_CODE( 1 )
+#define FSCTL_SRV_NET_CHARDEVQ_ENUM _SRV_API_CONTROL_CODE( 2 )
+#define FSCTL_SRV_NET_CHARDEVQ_PURGE _SRV_API_CONTROL_CODE( 3 )
+#define FSCTL_SRV_NET_CHARDEVQ_SET_INFO _SRV_API_CONTROL_CODE( 4 )
+#define FSCTL_SRV_NET_CONNECTION_ENUM _SRV_API_CONTROL_CODE( 5 )
+#define FSCTL_SRV_NET_FILE_CLOSE _SRV_API_CONTROL_CODE( 6 )
+#define FSCTL_SRV_NET_FILE_ENUM _SRV_API_CONTROL_CODE( 7 )
+#define FSCTL_SRV_NET_SERVER_DISK_ENUM _SRV_API_CONTROL_CODE( 8 )
+#define FSCTL_SRV_NET_SERVER_SET_INFO _SRV_API_CONTROL_CODE( 9 )
+#define FSCTL_SRV_NET_SERVER_XPORT_ADD _SRV_API_CONTROL_CODE( 10 )
+#define FSCTL_SRV_NET_SERVER_XPORT_DEL _SRV_API_CONTROL_CODE( 11 )
+#define FSCTL_SRV_NET_SERVER_XPORT_ENUM _SRV_API_CONTROL_CODE( 12 )
+#define FSCTL_SRV_NET_SESSION_DEL _SRV_API_CONTROL_CODE( 13 )
+#define FSCTL_SRV_NET_SESSION_ENUM _SRV_API_CONTROL_CODE( 14 )
+#define FSCTL_SRV_NET_SHARE_ADD _SRV_API_CONTROL_CODE( 15 )
+#define FSCTL_SRV_NET_SHARE_DEL _SRV_API_CONTROL_CODE( 16 )
+#define FSCTL_SRV_NET_SHARE_ENUM _SRV_API_CONTROL_CODE( 17 )
+#define FSCTL_SRV_NET_SHARE_SET_INFO _SRV_API_CONTROL_CODE( 18 )
+#define FSCTL_SRV_NET_STATISTICS_GET _SRV_API_CONTROL_CODE( 19 )
+#define FSCTL_SRV_MAX_API_CODE FSCTL_SRV_NET_STATISTICS_GET
+
+//
+// Startup information level
+//
+
+#define SS_STARTUP_LEVEL -1L
+
+#ifdef INCLUDE_SRV_IPX_SMART_CARD_INTERFACE
+
+//
+// Structure passed to the srv via the FSCTL_SRV_IPX_SMART_CARD_START call by an
+// intelligent direct host IPX card. The Smart card fills in its own
+// Open, Close, Read, and DeRegister entry points - which the server
+// calls at the appropriate times. The server fills in its own
+// ReadComplete entry point which the smart card calls when it is done
+// transferring the data to the client.
+//
+typedef struct {
+ //
+ // This routine is called by the server when it is opening a file on
+ // behalf of a direct host IPX client. It gives the smart card a chance
+ // to decide it it wants to help with file access. If the smart card is
+ // interested, it should return TRUE and set SmartCardContext to a
+ // non-zero value of its choice.
+ //
+ BOOLEAN (* Open)(
+ IN PVOID SmbHeader, // Points to request PNT_SMB_HEADER
+ IN PFILE_OBJECT FileObject, // FileObject opened by the client
+ IN PUNICODE_STRING FileName, // Name of the file opened by the client
+ IN PTDI_ADDRESS_IPX IpxAddress, // Address of the client
+ IN ULONG Flags, // FO_CACHE_SUPPORTED (for now)
+ OUT PVOID *SmartCardContext // Context value returned by this routine
+ );
+
+ //
+ // This is called by the server when the file is being closed. The context
+ // value received at Open time is passed to this routine.
+ //
+ VOID ( * Close )(
+ IN PVOID SmartCardContext // Same context returned by Open() above
+ );
+
+ //
+ // This is called by the server to see if the smart card wishes to handle the
+ // client's read request. If the card is handling the read, it should return
+ // TRUE and the server will discontinue processing the read. When the card is
+ // finished handling the read, it must call ReadComplete (below) to inform the
+ // server. If Read returns FALSE, the server handles the read as usual.
+ //
+ BOOLEAN ( * Read )(
+ IN PVOID SmbHeader, // Points to request PNT_SMB_HEADER
+ IN PVOID SmartCardContext, // Same context returned by Open() above
+ IN ULONG Key, // Key value needed to read through locks
+ IN PVOID SrvContext // Opaque value provided by the server
+ );
+
+ //
+ // This is the server's entry point which the smart card must call when it is
+ // finished handling the Read request (above).
+ //
+ VOID ( * ReadComplete )(
+ IN PVOID SrvContext, // Same as SrvContext in Read() above
+ IN PFILE_OBJECT FileObject, // Client FileObject to which this applies
+ IN PMDL Mdl OPTIONAL, // Mdl smart card is now finished with
+ IN ULONG Length // Length of data indicated by the MDL
+ );
+
+ //
+ // This is called by the server when the server wishes to disconnect from the
+ // card. Once this returns, the card should not call back into the server.
+ //
+ VOID ( *DeRegister )(
+ VOID
+ );
+
+
+} SRV_IPX_SMART_CARD, *PSRV_IPX_SMART_CARD;
+
+#endif
+
+//
+// SMB_STATISTICS holds the count of SMBs and total turn around for a
+// class of SMBs. For example, a single SMB_STATISTIC structure could
+// hold information about all read SMBs: Read, ReadAndX, ReadRaw,
+// and ReadMultiplexed.
+//
+
+typedef struct _SMB_STATISTICS {
+ LARGE_INTEGER TotalTurnaroundTime;
+ ULONG SmbCount;
+} SMB_STATISTICS, *PSMB_STATISTICS;
+
+//
+// Used to record the number of times something happened and some
+// pertinent time measure.
+//
+
+typedef struct _SRV_TIMED_COUNTER {
+ LARGE_INTEGER Time;
+ ULONG Count;
+} SRV_TIMED_COUNTER, *PSRV_TIMED_COUNTER;
+
+//
+// SRV_POOL_STATISTICS is used for tracking server pool usage, paged and
+// nonpaged. It is only enabled with SRVDBG2 and is controlled in the
+// server module heapmgr.c.
+//
+
+typedef struct _SRV_POOL_STATISTICS {
+ ULONG TotalBlocksAllocated;
+ ULONG TotalBytesAllocated;
+ ULONG TotalBlocksFreed;
+ ULONG TotalBytesFreed;
+ ULONG BlocksInUse;
+ ULONG BytesInUse;
+ ULONG MaxBlocksInUse;
+ ULONG MaxBytesInUse;
+} SRV_POOL_STATISTICS, *PSRV_POOL_STATISTICS;
+
+//
+// BLOCK_COUNTS is used to maintain statistics on server block types
+//
+
+typedef struct _BLOCK_COUNTS {
+ ULONG Allocations;
+ ULONG Closes;
+ ULONG Frees;
+} BLOCK_COUNTS, *PBLOCK_COUNTS;
+
+#define MAX_NON_TRANS_SMB 0x84
+
+#ifndef TRANS2_MAX_FUNCTION
+#define TRANS2_MAX_FUNCTION 0x11
+#endif
+
+#define MAX_STATISTICS_SMB MAX_NON_TRANS_SMB + TRANS2_MAX_FUNCTION + 1
+
+//
+// SRV_STATISTICS is the structure returned to the FSCTL_GET_STATISTICS
+// fsctl.
+//
+
+typedef struct _SRV_STATISTICS {
+
+ //
+ // The time at which statistics gathering began (or stats were last
+ // cleared).
+ //
+
+ TIME StatisticsStartTime;
+
+ //
+ // Large integer counts of bytes received and sent
+ //
+
+ LARGE_INTEGER TotalBytesReceived;
+ LARGE_INTEGER TotalBytesSent;
+
+ //
+ // Causes of session termination
+ //
+
+ ULONG SessionLogonAttempts;
+ ULONG SessionsTimedOut;
+ ULONG SessionsErroredOut;
+ ULONG SessionsLoggedOff;
+ ULONG SessionsForcedLogOff;
+
+ //
+ // Misc. Errors
+ //
+
+ ULONG LogonErrors;
+ ULONG AccessPermissionErrors;
+ ULONG GrantedAccessErrors;
+ ULONG SystemErrors;
+ ULONG BlockingSmbsRejected;
+ ULONG WorkItemShortages;
+
+ //
+ // Cumulative counts of various statistics. Note that when stats are
+ // cleared, those "Total" fields which have a "Current" equivalent
+ // are set to the "Current" value to avoid situations where the
+ // current count is greater than the total.
+ //
+
+ ULONG TotalFilesOpened;
+
+ ULONG CurrentNumberOfOpenFiles;
+ ULONG CurrentNumberOfSessions;
+ ULONG CurrentNumberOfOpenSearches;
+
+ //
+ // Memory usage stats we want to xport
+ //
+
+ ULONG CurrentNonPagedPoolUsage;
+ ULONG NonPagedPoolFailures;
+ ULONG PeakNonPagedPoolUsage;
+
+ ULONG CurrentPagedPoolUsage;
+ ULONG PagedPoolFailures;
+ ULONG PeakPagedPoolUsage;
+
+
+ //
+ // Used to record the number of times work context blocks were placed
+ // on the server's FSP queue and the total amount of time they spent
+ // there.
+ //
+
+ SRV_TIMED_COUNTER TotalWorkContextBlocksQueued;
+
+
+} SRV_STATISTICS, *PSRV_STATISTICS;
+
+//
+// Per work-queue statistics for the server. There is a workqueue for each
+// processor in the system for nonblocking work, and a single workqueue for
+// blocking work.
+//
+// These statistics are retrieved via FSCTL_SRV_GET_QUEUE_STATISTICS to the
+// server driver. For an N-processor system, the first N structs are per-processor,
+// the N+1'th struct is for the blocking work queue.
+//
+typedef struct _SRV_QUEUE_STATISTICS {
+ ULONG QueueLength; // current length of the workitem queue
+ ULONG ActiveThreads; // # of threads currently servicing requests
+ ULONG AvailableThreads; // # of threads waiting for work
+ ULONG FreeWorkItems; // # of free work items
+ ULONG StolenWorkItems; // # of work items taken from this free list
+ // by another queue
+ ULONG NeedWorkItem; // # of work items we are currently short for this queue
+ ULONG CurrentClients; // # of clients being serviced by this queue
+ LARGE_INTEGER BytesReceived; // # of bytes in from the network to clients on this queue
+ LARGE_INTEGER BytesSent; // # of bytes sent to the network from clients on this queue
+ LARGE_INTEGER ReadOperations; // # file read operations by clients on this queue
+ LARGE_INTEGER BytesRead; // # of data bytes read from files by clients on this queue
+ LARGE_INTEGER WriteOperations; // # of file write ops by clients on this queue
+ LARGE_INTEGER BytesWritten; // # of data bytes written to files by clients on this queue
+ SRV_TIMED_COUNTER TotalWorkContextBlocksQueued; // as above, but per-queue
+
+} SRV_QUEUE_STATISTICS, *PSRV_QUEUE_STATISTICS;
+
+//
+// SRV_STATISTICS_DEBUG is the structure used for the
+// FSCTL_SRV_GET_DEBUG_STATISTICS fsctl. This structure is valid
+// only when SRVDBG3 is set.
+//
+
+typedef struct _SRV_STATISTICS_DEBUG {
+
+ //
+ // Large integer counts of bytes read and written.
+ //
+
+ LARGE_INTEGER TotalBytesRead;
+ LARGE_INTEGER TotalBytesWritten;
+
+ //
+ // Raw reads and writes statistics
+ //
+
+ ULONG RawWritesAttempted;
+ ULONG RawWritesRejected;
+ ULONG RawReadsAttempted;
+ ULONG RawReadsRejected;
+
+ //
+ // Cumulative count of time spent opening files and closing handles.
+ //
+
+ LARGE_INTEGER TotalIoCreateFileTime;
+ LARGE_INTEGER TotalNtCloseTime;
+
+ ULONG TotalHandlesClosed;
+ ULONG TotalOpenAttempts;
+ ULONG TotalOpensForPathOperations;
+ ULONG TotalOplocksGranted;
+ ULONG TotalOplocksDenied;
+ ULONG TotalOplocksBroken;
+ ULONG OpensSatisfiedWithCachedRfcb;
+
+ ULONG FastLocksAttempted;
+ ULONG FastLocksFailed;
+ ULONG FastReadsAttempted;
+ ULONG FastReadsFailed;
+ ULONG FastUnlocksAttempted;
+ ULONG FastUnlocksFailed;
+ ULONG FastWritesAttempted;
+ ULONG FastWritesFailed;
+
+ ULONG DirectSendsAttempted;
+
+ ULONG LockViolations;
+ ULONG LockDelays;
+
+ ULONG CoreSearches;
+ ULONG CompleteCoreSearches;
+
+ //
+ // information about block types
+ //
+
+ BLOCK_COUNTS ConnectionInfo;
+ BLOCK_COUNTS EndpointInfo;
+ BLOCK_COUNTS LfcbInfo;
+ BLOCK_COUNTS MfcbInfo;
+ BLOCK_COUNTS RfcbInfo;
+ BLOCK_COUNTS SearchInfo;
+ BLOCK_COUNTS SessionInfo;
+ BLOCK_COUNTS ShareInfo;
+ BLOCK_COUNTS TransactionInfo;
+ BLOCK_COUNTS TreeConnectInfo;
+ BLOCK_COUNTS WorkContextInfo;
+ BLOCK_COUNTS WaitForOplockBreakInfo;
+
+ //
+ // Statistics for different read and write sizes. Each element of
+ // the array corresponds to a range of IO sizes; see srv\smbsupp.c
+ // for exact correspondences.
+ //
+
+ SMB_STATISTICS ReadSize[17];
+ SMB_STATISTICS WriteSize[17];
+
+ //
+ // Statistics for each SMB type by command code.
+ //
+
+ SMB_STATISTICS Smb[MAX_STATISTICS_SMB+2+TRANS2_MAX_FUNCTION+1];
+
+ struct {
+ ULONG Depth;
+ ULONG Threads;
+ ULONG ItemsQueued;
+ ULONG MaximumDepth;
+ } QueueStatistics[3];
+
+} SRV_STATISTICS_DEBUG, *PSRV_STATISTICS_DEBUG;
+
+//
+// SET DEBUG input and output structure. Contains off/on masks for SrvDebug
+// and SmbDebug. The off mask is applied first, then the on mask is
+// applied. To set the entire mask to a specific value, set the off
+// mask to all ones, and set the on mask to the desired value. To leave
+// a mask unchanged, set both masks to 0. SET DEBUG is also used
+// to modify other server heuristics. HeuristicsChangeMask is used to
+// indicate which heuristics are being changed.
+//
+// On output, the structure is presented in such a way as to allow the
+// original values to be restored easily. The output data is simply
+// passed back as input data.
+//
+
+typedef struct _FSCTL_SRV_SET_DEBUG_IN_OUT {
+ ULONG SrvDebugOff;
+ ULONG SrvDebugOn;
+ ULONG SmbDebugOff;
+ ULONG SmbDebugOn;
+ ULONG CcDebugOff;
+ ULONG CcDebugOn;
+ ULONG PbDebugOff;
+ ULONG PbDebugOn;
+ ULONG FatDebugOff;
+ ULONG FatDebugOn;
+ ULONG HeuristicsChangeMask;
+ ULONG MaxCopyReadLength;
+ ULONG MaxCopyWriteLength;
+ ULONG DumpVerbosity;
+ ULONG DumpRawLength;
+ BOOLEAN EnableOplocks;
+ BOOLEAN EnableFcbOpens;
+ BOOLEAN EnableSoftCompatibility;
+ BOOLEAN EnableRawMode;
+ BOOLEAN EnableDpcLevelProcessing;
+ BOOLEAN EnableMdlIo;
+ BOOLEAN EnableFastIo;
+ BOOLEAN DumpRequests;
+ BOOLEAN DumpResponses;
+} FSCTL_SRV_SET_DEBUG_IN_OUT, *PFSCTL_SRV_SET_DEBUG_IN_OUT;
+
+//
+// Bit assignments for server heuristics change mask. The first group
+// contains those that are values, while the second group contains those
+// that are booleans.
+//
+
+#define SRV_HEUR_MAX_COPY_READ 0x00000001
+#define SRV_HEUR_MAX_COPY_WRITE 0x00000002
+#define SRV_HEUR_DUMP_VERBOSITY 0x00000004
+#define SRV_HEUR_DUMP_RAW_LENGTH 0x00000008
+
+#define SRV_HEUR_OPLOCKS 0x00010000
+#define SRV_HEUR_FCB_OPENS 0x00020000
+#define SRV_HEUR_SOFT_COMPATIBILITY 0x00040000
+#define SRV_HEUR_RAW_MODE 0x00080000
+#define SRV_HEUR_DPC_LEVEL_PROCESSING 0x00100000
+#define SRV_HEUR_MDL_IO 0x00200000
+#define SRV_HEUR_FAST_IO 0x00400000
+#define SRV_HEUR_DUMP_REQUESTS 0x00800000
+#define SRV_HEUR_DUMP_RESPONSES 0x01000000
+
+//
+// Structure returned in response to FSCTL_SRV_QUERY_CONNECTIONS.
+//
+
+typedef struct _BLOCK_INFORMATION {
+ PVOID Block;
+ ULONG BlockType;
+ ULONG BlockState;
+ ULONG ReferenceCount;
+} BLOCK_INFORMATION, *PBLOCK_INFORMATION;
+
+//
+// Structure for communication between the file server and the server
+// service.
+//
+
+typedef struct _SERVER_REQUEST_PACKET {
+
+ UNICODE_STRING Name1;
+ UNICODE_STRING Name2;
+ ULONG Level;
+ ULONG ErrorCode;
+ ULONG Flags;
+
+ union {
+
+ struct {
+
+ ULONG EntriesRead;
+ ULONG TotalEntries;
+ ULONG TotalBytesNeeded;
+ ULONG ResumeHandle;
+
+ } Get;
+
+ struct {
+
+ ULONG ErrorParameter;
+
+ union {
+
+ struct {
+ ULONG MaxUses;
+ } ShareInfo;
+
+ } Api;
+
+ } Set;
+
+ } Parameters;
+
+} SERVER_REQUEST_PACKET, *PSERVER_REQUEST_PACKET;
+
+//
+// Flags for the Flags field of the server request packet.
+//
+
+#define SRP_RETURN_SINGLE_ENTRY 0x01
+#define SRP_CLEAR_STATISTICS 0x02
+#define SRP_SET_SHARE_IN_DFS 0x04
+#define SRP_CLEAR_SHARE_IN_DFS 0x08
+
+//
+// Flag used in the XPORT_ADD function
+//
+
+#define SRP_XADD_PRIMARY_MACHINE 0x1 // this is the primary machine name
+
+//
+// #defines for the share GENERIC_MAPPING structure, which must be available
+// to both the server and the server service.
+//
+
+#define SRVSVC_SHARE_CONNECT 0x0001
+#define SRVSVC_PAUSED_SHARE_CONNECT 0x0002
+
+#define SRVSVC_SHARE_CONNECT_ALL_ACCESS ( STANDARD_RIGHTS_REQUIRED | \
+ SRVSVC_SHARE_CONNECT | \
+ SRVSVC_PAUSED_SHARE_CONNECT )
+
+#define GENERIC_SHARE_CONNECT_MAPPING { \
+ STANDARD_RIGHTS_READ | \
+ SRVSVC_SHARE_CONNECT, \
+ STANDARD_RIGHTS_WRITE | \
+ SRVSVC_PAUSED_SHARE_CONNECT, \
+ STANDARD_RIGHTS_EXECUTE, \
+ SRVSVC_SHARE_CONNECT_ALL_ACCESS }
+
+//
+// #defines for the file GENERIC_MAPPING structure, which must be available
+// to both the server and the server service. This structure is identical
+// to the io file generic mapping "IopFileMapping" defined in io\ioinit.c
+//
+
+#define GENERIC_SHARE_FILE_ACCESS_MAPPING { \
+ FILE_GENERIC_READ, \
+ FILE_GENERIC_WRITE, \
+ FILE_GENERIC_EXECUTE, \
+ FILE_ALL_ACCESS }
+
+//
+// Special cases of STYPE_DISKTREE
+//
+
+#define STYPE_CDROM 104
+#define STYPE_REMOVABLE 105
+
+#endif // ndef _SRVFSCTL_
diff --git a/private/inc/status.h b/private/inc/status.h
new file mode 100644
index 000000000..cc297b595
--- /dev/null
+++ b/private/inc/status.h
@@ -0,0 +1,219 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ status.h
+
+Abstract:
+
+ This module defines manifest constants for the LAN Manager server.
+
+Author:
+
+ David Treadwell (davidtr) 10-May-1990
+
+Revision History:
+
+--*/
+
+#ifndef _STATUS_
+#define _STATUS_
+
+
+
+//
+// The server has 16 bits available to it in each 32-bit status code.
+// See \nt\sdk\inc\ntstatus.h for a description of the use of the
+// high 16 bits of the status.
+//
+// The layout of the bits is:
+//
+// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+// +---+-+-------------------------+-------+-----------------------+
+// |Sev|C| Facility--Server | Class | Code |
+// +---+-+-------------------------+-------+-----------------------+
+//
+// Class values:
+// 0 - a server-specific error code, not put directly on the wire.
+// 1 - SMB error class DOS. This includes those OS/2 errors
+// that share code values and meanings with the SMB protocol.
+// 2 - SMB error class SERVER.
+// 3 - SMB error class HARDWARE.
+// 4 - other SMB error classes
+// 5-E - undefined
+// F - an OS/2-specific error. If the client is OS/2, then the
+// SMB error class is set to DOS and the code is set to
+// the actual OS/2 error code contained in the Code field.
+//
+// The meaning of the Code field depends on the Class value. If the
+// class is 00, then the code value is arbitrary. For other classes,
+// the code is the actual code of the error in the SMB or OS/2
+// protocols.
+//
+
+#define SRV_STATUS_FACILITY_CODE 0x00980000L
+#define SRV_SRV_STATUS (0xC0000000L | SRV_STATUS_FACILITY_CODE)
+#define SRV_DOS_STATUS (0xC0001000L | SRV_STATUS_FACILITY_CODE)
+#define SRV_SERVER_STATUS (0xC0002000L | SRV_STATUS_FACILITY_CODE)
+#define SRV_HARDWARE_STATUS (0xC0003000L | SRV_STATUS_FACILITY_CODE)
+#define SRV_WIN32_STATUS (0xC000E000L | SRV_STATUS_FACILITY_CODE)
+#define SRV_OS2_STATUS (0xC000F000L | SRV_STATUS_FACILITY_CODE)
+
+//++
+//
+// BOOLEAN
+// SmbIsSrvStatus (
+// IN NTSTATUS Status
+// )
+//
+// Routine Description:
+//
+// Macro to determine whether a status code is one defined by the
+// server (has the server facility code).
+//
+// Arguments:
+//
+// Status - the status code to check.
+//
+// Return Value:
+//
+// BOOLEAN - TRUE if the facility code is the servers, FALSE
+// otherwise.
+//
+//--
+
+#define SrvIsSrvStatus(Status) \
+ ( ((Status) & 0x1FFF0000) == SRV_STATUS_FACILITY_CODE ? TRUE : FALSE )
+
+//++
+//
+// UCHAR
+// SmbErrorClass (
+// IN NTSTATUS Status
+// )
+//
+// Routine Description:
+//
+// This macro extracts the error class field from a server status
+// code.
+//
+// Arguments:
+//
+// Status - the status code from which to get the error class.
+//
+// Return Value:
+//
+// UCHAR - the server error class of the status code.
+//
+//--
+
+#define SrvErrorClass(Status) ((UCHAR)( ((Status) & 0x0000F000) >> 12 ))
+
+//++
+//
+// UCHAR
+// SmbErrorCode (
+// IN NTSTATUS Status
+// )
+//
+// Routine Description:
+//
+// This macro extracts the error code field from a server status
+// code.
+//
+// Arguments:
+//
+// Status - the status code from which to get the error code.
+//
+// Return Value:
+//
+// UCHAR - the server error code of the status code.
+//
+//--
+
+#define SrvErrorCode(Status) ((USHORT)( (Status) & 0xFFF) )
+
+//
+// Status codes unique to the server. These error codes are used
+// internally only.
+//
+
+#define STATUS_ENDPOINT_CLOSED (SRV_SRV_STATUS | 0x01)
+#define STATUS_DISCONNECTED (SRV_SRV_STATUS | 0x02)
+#define STATUS_SERVER_ALREADY_STARTED (SRV_SRV_STATUS | 0x04)
+#define STATUS_SERVER_NOT_STARTED (SRV_SRV_STATUS | 0x05)
+#define STATUS_OPLOCK_BREAK_UNDERWAY (SRV_SRV_STATUS | 0x06)
+#define STATUS_NONEXISTENT_NET_NAME (SRV_SRV_STATUS | 0x08)
+
+//
+// Error codes that exist in both the SMB protocol and OS/2 but not NT.
+// Note that all SMB DOS-class error codes are defined in OS/2.
+//
+
+#define STATUS_OS2_INVALID_FUNCTION (SRV_DOS_STATUS | ERROR_INVALID_FUNCTION)
+#define STATUS_OS2_TOO_MANY_OPEN_FILES \
+ (SRV_DOS_STATUS | ERROR_TOO_MANY_OPEN_FILES)
+#define STATUS_OS2_INVALID_ACCESS (SRV_DOS_STATUS | ERROR_INVALID_ACCESS)
+
+//
+// SMB SERVER-class error codes that lack an NT or OS/2 equivalent.
+//
+
+#define STATUS_INVALID_SMB (SRV_SERVER_STATUS | SMB_ERR_ERROR)
+#define STATUS_SMB_BAD_NET_NAME (SRV_SERVER_STATUS | SMB_ERR_BAD_NET_NAME)
+#define STATUS_SMB_BAD_TID (SRV_SERVER_STATUS | SMB_ERR_BAD_TID)
+#define STATUS_SMB_BAD_UID (SRV_SERVER_STATUS | SMB_ERR_BAD_UID)
+#define STATUS_SMB_TOO_MANY_UIDS (SRV_SERVER_STATUS | SMB_ERR_TOO_MANY_UIDS)
+#define STATUS_SMB_USE_MPX (SRV_SERVER_STATUS | SMB_ERR_USE_MPX)
+#define STATUS_SMB_USE_STANDARD (SRV_SERVER_STATUS | SMB_ERR_USE_STANDARD)
+#define STATUS_SMB_CONTINUE_MPX (SRV_SERVER_STATUS | SMB_ERR_CONTINUE_MPX)
+#define STATUS_SMB_BAD_COMMAND (SRV_SERVER_STATUS | SMB_ERR_BAD_COMMAND)
+#define STATUS_SMB_NO_SUPPORT (SRV_SERVER_STATUS | SMB_ERR_NO_SUPPORT_INTERNAL)
+
+// *** because SMB_ERR_NO_SUPPORT uses 16 bits, but we have only 12 bits
+// available for error codes, it must be special-cased in the code.
+
+//
+// SMB HARDWARE-class error codes that lack an NT or OS/2 equivalent.
+//
+
+#define STATUS_SMB_DATA (SRV_HARDWARE_STATUS | SMB_ERR_DATA)
+
+//
+// OS/2 error codes that lack an NT or SMB equivalent.
+//
+
+#include <winerror.h>
+
+#define STATUS_OS2_INVALID_LEVEL \
+ (NTSTATUS)(SRV_OS2_STATUS | ERROR_INVALID_LEVEL)
+
+#define STATUS_OS2_EA_LIST_INCONSISTENT \
+ (NTSTATUS)(SRV_OS2_STATUS | ERROR_EA_LIST_INCONSISTENT)
+
+#define STATUS_OS2_NEGATIVE_SEEK \
+ (NTSTATUS)(SRV_OS2_STATUS | ERROR_NEGATIVE_SEEK)
+
+#define STATUS_OS2_NO_MORE_SIDS \
+ (NTSTATUS)(SRV_OS2_STATUS | ERROR_NO_MORE_SEARCH_HANDLES)
+
+#define STATUS_OS2_EAS_DIDNT_FIT \
+ (NTSTATUS)(SRV_OS2_STATUS | ERROR_EAS_DIDNT_FIT)
+
+#define STATUS_OS2_EA_ACCESS_DENIED \
+ (NTSTATUS)(SRV_OS2_STATUS | ERROR_EA_ACCESS_DENIED)
+
+#define STATUS_OS2_CANCEL_VIOLATION \
+ (NTSTATUS)(SRV_OS2_STATUS | ERROR_CANCEL_VIOLATION)
+
+#define STATUS_OS2_ATOMIC_LOCKS_NOT_SUPPORTED \
+ (NTSTATUS)(SRV_OS2_STATUS | ERROR_ATOMIC_LOCKS_NOT_SUPPORTED)
+
+#define STATUS_OS2_CANNOT_COPY \
+ (NTSTATUS)(SRV_OS2_STATUS | ERROR_CANNOT_COPY)
+
+#endif // ndef _STATUS_
+
diff --git a/private/inc/svcs.h b/private/inc/svcs.h
new file mode 100644
index 000000000..45e40b796
--- /dev/null
+++ b/private/inc/svcs.h
@@ -0,0 +1,207 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ svcs.h
+
+Abstract:
+
+ This file contains definitions used by service dlls that share
+ a process in the system. The SERVICES.EXE process is an example of
+ a user of these definitions.
+
+
+Author:
+
+ Rajen Shah rajens 12-Apr-1991
+
+[Environment:]
+
+ User Mode - Win32
+
+Revision History:
+
+ 25-Oct-1993 Danl
+ Used to be services.h in the net\inc directory.
+ Made it non-network specific and moved to private\inc.
+
+ 12-Apr-1991 RajenS
+ Created
+
+--*/
+#ifndef _SVCS_
+#define _SVCS_
+
+#ifndef RPC_NO_WINDOWS_H // Don't let rpc.h include windows.h
+#define RPC_NO_WINDOWS_H
+#endif // RPC_NO_WINDOWS_H
+
+#include <rpc.h> // RPC_IF_HANDLE
+
+//
+// Service DLLs loaded into services.exe all export the same main
+// entry point. SVCS_ENTRY_POINT defines that name.
+//
+// Note that SVCS_ENTRY_POINT_STRING is always ANSI, because that's
+// what GetProcAddress takes.
+//
+
+#define SVCS_ENTRY_POINT ServiceEntry
+#define SVCS_ENTRY_POINT_STRING "ServiceEntry"
+
+//
+// Name for the common RPC pipe shared by all the RPC servers in services.exe.
+// Note: Because version 1.0 of WinNt had seperate names for each server's
+// pipe, the client side names have remained the same. Mapping to the new
+// name is handled by the named pipe file system.
+//
+#define SVCS_RPC_PIPE L"ntsvcs"
+
+//
+// Flags indicating how a work item is to be operated upon.
+// SVC_QUEUE_WORK_ITEM - This indicates that the work item should be
+// placed in the work queue to be operated upon when a worker
+// thread becomes available.
+// SVC_IMMEDIATE_CALLBACK - This indicates that the Watcher Thread
+// should make the callback and return the response prior to
+// returning from this call to SvcAddWorkItem. This allows
+// asynchronous I/O events to be setup in the context of the
+// Watcher Thread, which never goes away. If the service had
+// a worker thread setup the async I/O operation, the operation
+// would become signalled as soon as the worker thread was
+// terminated. I/O is terminated when the requesting thread
+// goes away.
+//
+#define SVC_QUEUE_WORK_ITEM 0x00000001
+#define SVC_IMMEDIATE_CALLBACK 0x00000002
+
+//
+// Start and stop RPC server entry point prototype.
+//
+
+typedef
+DWORD
+(*PSVCS_START_RPC_SERVER) (
+ IN LPTSTR InterfaceName,
+ IN RPC_IF_HANDLE InterfaceSpecification
+ );
+
+typedef
+DWORD
+(*PSVCS_STOP_RPC_SERVER) (
+ IN RPC_IF_HANDLE InterfaceSpecification
+ );
+
+typedef
+VOID
+(*PSVCS_NET_BIOS_OPEN) (
+ VOID
+ );
+
+typedef
+VOID
+(*PSVCS_NET_BIOS_CLOSE) (
+ VOID
+ );
+
+typedef
+DWORD
+(*PSVCS_NET_BIOS_RESET) (
+ IN UCHAR LanAdapterNumber
+ );
+
+//
+// Thread Management
+//
+
+typedef
+DWORD
+(*PSVCS_WORKER_CALLBACK) (
+ IN PVOID pContext,
+ IN DWORD dwWaitStatus
+ );
+
+//
+// Call this function to add a work item
+typedef
+HANDLE
+(*PSVCS_ADD_WORK_ITEM) (
+ IN HANDLE hWaitableObject,
+ IN PSVCS_WORKER_CALLBACK pCallbackFunction,
+ IN PVOID pContext,
+ IN DWORD dwFlags,
+ IN DWORD dwTimeout,
+ IN HANDLE hDllReference
+ );
+
+//
+// Call this function to remove a work item.
+typedef
+BOOL
+(*PSVCS_REMOVE_WORK_ITEM) (
+ IN HANDLE hWorkItem
+ );
+
+
+//
+// Structure containing "global" data for the various DLLs.
+//
+
+typedef struct _SVCS_GLOBAL_DATA {
+
+ //
+ // NT well-known SIDs
+ //
+
+ PSID NullSid; // No members SID
+ PSID WorldSid; // All users SID
+ PSID LocalSid; // NT local users SID
+ PSID NetworkSid; // NT remote users SID
+ PSID LocalSystemSid; // NT system processes SID
+ PSID BuiltinDomainSid; // Domain Id of the Builtin Domain
+
+ //
+ // Well Known Aliases.
+ //
+ // These are aliases that are relative to the built-in domain.
+ //
+
+ PSID AliasAdminsSid; // Administrator Sid
+ PSID AliasUsersSid; // User Sid
+ PSID AliasGuestsSid; // Guest Sid
+ PSID AliasPowerUsersSid; // Power User Sid
+ PSID AliasAccountOpsSid; // Account Operator Sid
+ PSID AliasSystemOpsSid; // System Operator Sid
+ PSID AliasPrintOpsSid; // Print Operator Sid
+ PSID AliasBackupOpsSid; // Backup Operator Sid
+
+ //
+ // Entry points provided by SERVICES.EXE.
+ //
+
+ PSVCS_START_RPC_SERVER StartRpcServer;
+ PSVCS_STOP_RPC_SERVER StopRpcServer;
+ PSVCS_NET_BIOS_OPEN NetBiosOpen;
+ PSVCS_NET_BIOS_CLOSE NetBiosClose;
+ PSVCS_NET_BIOS_RESET NetBiosReset;
+ LPWSTR SvcsRpcPipeName;
+ PSVCS_ADD_WORK_ITEM SvcsAddWorkItem;
+ PSVCS_REMOVE_WORK_ITEM SvcsRemoveWorkItem;
+} SVCS_GLOBAL_DATA, *PSVCS_GLOBAL_DATA;
+
+//
+// Service DLL entry point prototype.
+//
+
+typedef
+VOID
+(*PSVCS_SERVICE_DLL_ENTRY) (
+ IN DWORD argc,
+ IN LPTSTR argv[],
+ IN PSVCS_GLOBAL_DATA pGlobalData,
+ IN HANDLE SvcReferenceHandle
+ );
+
+#endif // ndef _SVCS_
diff --git a/private/inc/synth.h b/private/inc/synth.h
new file mode 100644
index 000000000..473966499
--- /dev/null
+++ b/private/inc/synth.h
@@ -0,0 +1,72 @@
+/*++ BUILD Version: 0001 // Increment this if a change has global effects
+
+
+Copyright (c) 1992 Microsoft Corporation
+
+Module Name:
+
+ synth.h
+
+Abstract:
+
+ This include file defines constants and types for
+ the Microsoft midi synthesizer driver
+
+ This header file is shared between the low level driver and the
+ kernel mode driver.
+
+Author:
+
+ Robin Speed (RobinSp) 20-Oct-92
+
+Revision History:
+
+--*/
+
+#define STR_DRIVERNAME L"synth"
+#define STR_MV_DRIVERNAME L"mvopl3"
+#define STR_OPL3_DEVICENAME L"\\Device\\opl3.mid"
+#define STR_ADLIB_DEVICENAME L"\\Device\\adlib.mid"
+
+/*
+ * Stucture for passing synth data
+ * Why on earth isn't there a type for sharing short data?
+ */
+
+ typedef struct {
+ unsigned short IoPort;
+ unsigned short PortData;
+ } SYNTH_DATA, *PSYNTH_DATA;
+
+/* positions within FM */
+#define AD_LSI (0x000)
+#define AD_LSI2 (0x101)
+#define AD_TIMER1 (0x001)
+#define AD_TIMER2 (0x002)
+#define AD_MASK (0x004)
+#define AD_CONNECTION (0x104)
+#define AD_NEW (0x105)
+#define AD_NTS (0x008)
+#define AD_MULT (0x020)
+#define AD_MULT2 (0x120)
+#define AD_LEVEL (0x040)
+#define AD_LEVEL2 (0x140)
+#define AD_AD (0x060)
+#define AD_AD2 (0x160)
+#define AD_SR (0x080)
+#define AD_SR2 (0x180)
+#define AD_FNUMBER (0x0a0)
+#define AD_FNUMBER2 (0x1a0)
+#define AD_BLOCK (0x0b0)
+#define AD_BLOCK2 (0x1b0)
+#define AD_DRUM (0x0bd)
+#define AD_FEEDBACK (0x0c0)
+#define AD_FEEDBACK2 (0x1c0)
+#define AD_WAVE (0x0e0)
+#define AD_WAVE2 (0x1e0)
+
+/*
+** Special IOCTL
+*/
+
+#define IOCTL_MIDI_SET_OPL3_MODE CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x000A, METHOD_BUFFERED, FILE_WRITE_ACCESS)
diff --git a/private/inc/sys/poll.h b/private/inc/sys/poll.h
new file mode 100644
index 000000000..e2599db6c
--- /dev/null
+++ b/private/inc/sys/poll.h
@@ -0,0 +1,75 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ poll.h
+
+Abstract:
+
+ Contains #defines, types, and macros for poll
+
+Author:
+
+ Sam Patton (sampa) July 26, 1991
+
+Revision History:
+
+--*/
+
+#ifndef SYS_POLL_INCLUDED
+#define SYS_POLL_INCLUDED
+
+/*
+ * Structure of file descriptor/event pairs supplied in
+ * the poll arrays.
+ */
+struct pollfd {
+#ifndef _POSIX_SOURCE
+ HANDLE fd; /* file handle to poll */
+#else
+ int fd; /* file desc to poll */
+#endif
+ short events; /* events of interest on fd */
+ short revents; /* events that occurred on fd */
+};
+
+/*
+ * Testable select events
+ */
+#define POLLIN 01 /* fd is readable */
+#define POLLPRI 02 /* priority info at fd */
+#define POLLOUT 04 /* fd is writeable (won't block) */
+#define POLLMSG 0100 /* M_SIG or M_PCSIG arrived */
+
+/*
+ * Non-testable poll events (may not be specified in events field,
+ * but may be returned in revents field).
+ */
+#define POLLERR 010 /* fd has error condition */
+#define POLLHUP 020 /* fd has been hung up on */
+#define POLLNVAL 040 /* invalid pollfd entry */
+
+/*
+ * Number of pollfd entries to read in at a time in poll.
+ * The larger the value the better the performance, up to the
+ * maximum number of open files allowed. Large numbers will
+ * use excessive amounts of kernel stack space.
+ */
+#define NPOLLFILE 20
+
+
+/*
+ * Poll function prototype
+ *
+ */
+
+int
+poll(
+ IN OUT struct pollfd *,
+ IN unsigned int,
+ IN int);
+
+
+#endif //SYS_POLL_INCLUDED
diff --git a/private/inc/sys/snet/adp_ctrl.h b/private/inc/sys/snet/adp_ctrl.h
new file mode 100644
index 000000000..f8b8d7149
--- /dev/null
+++ b/private/inc/sys/snet/adp_ctrl.h
@@ -0,0 +1,20 @@
+/*
+ * /redknee10/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.adp_control.h
+ * @(#)adp_control.h 1.1
+ *
+ * Last delta created 09:32:52 11/13/91
+ * This file extracted 09:26:04 3/18/92
+ *
+ * Modifications:
+ *
+ * RAE 13 Nov 1991 New File
+ */
+
+#define ADP_SETSNID (('A'<<8) | 1) /* set ADP snid */
+
+struct adp_snioc {
+ uint8 adp_snid;
+ uint32 adp_index;
+};
+
+
diff --git a/private/inc/sys/snet/arp_ctrl.h b/private/inc/sys/snet/arp_ctrl.h
new file mode 100644
index 000000000..4dfee02b1
--- /dev/null
+++ b/private/inc/sys/snet/arp_ctrl.h
@@ -0,0 +1,153 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ arp_ctrl.h
+
+Abstract:
+
+ This file defines the user-level IOCTL interface to the ARP driver.
+
+Author:
+
+ Mike Massa (mikemas) Jan 18, 1992
+
+Revision History:
+
+ Who When What
+ -------- -------- ----------------------------------------------
+ mikemas 01-18-92 created
+
+Notes:
+
+--*/
+
+/******************************************************************
+ *
+ * SpiderTCP ARP Interface Primitives
+ *
+ * Copyright 1988 Spider Systems Limited
+ *
+ * arp_control.h
+ *
+ * ARP Streams ioctl primitives for SpiderTCP
+ *
+ ******************************************************************/
+
+/*
+ * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.arp_control.h
+ * @(#)arp_control.h 1.5
+ *
+ * Last delta created 19:19:24 11/1/91
+ * This file extracted 16:49:13 12/23/91
+ *
+ * Modifications:
+ *
+ *
+ */
+
+#ifndef _SYS_SNET_ARP_CTRL_INCLUDED
+#define _SYS_SNET_ARP_CTRL_INCLUDED
+
+
+#define MAXHWLEN 6 /* max size of a hardware address */
+#define MAXANAMLEN 64 /* max size of adaptername */
+
+
+
+/*
+ * M_IOCTL types
+ */
+#define ARP_INS (('A'<<8) | 1) /* put arp entry into table */
+#define ARP_DEL (('A'<<8) | 2) /* delete entry from table */
+#define ARP_GET (('A'<<8) | 3) /* return table entry */
+#define ARP_MGET (('A'<<8) | 4) /* return all table entries */
+#define ARP_TYPE (('A'<<8) | 5) /* cause a DL_TYPE transfer */
+
+/*
+ * IOCTL structure definitions
+ */
+
+#ifdef COMPILE_UP_TCPIP
+
+/*
+ * Uniprocessor stack-specific definitions
+ */
+
+#define LONGLIFE 1 /* entry is permanent */
+#define ARP_PENDING 2 /* ARP request pending */
+
+struct arp_ins {
+ long in_addr;
+ char dl_add[6];
+ short life; /* lifetime in minutes; LONGLIFE for permanent */
+};
+
+struct arp_get {
+ long in_addr;
+ char dl_add[6];
+ int life;
+ int flag;
+};
+
+#else /* COMPILE_UP_TCPIP */
+
+/*
+ * Multiprocessor stack-specific definitions
+ */
+
+struct arp_ins {
+ long in_addr;
+ char hw_len;
+ char dl_add[MAXHWLEN];
+ time_t expiry; /* relative expiration time in seconds */
+};
+
+
+struct arp_get {
+ long in_addr;
+ char hw_len;
+ short hardware_type;
+ char dl_add[MAXHWLEN];
+ time_t expiry; /* relative expiration time in seconds */
+};
+
+#endif /* COMPILE_UP_TCPIP */
+
+
+struct arp_del {
+ long in_addr;
+};
+
+
+struct arp_mget {
+ long network;
+ int num;
+};
+
+
+/*
+ * IOCTL structure
+ */
+struct arp_req {
+ int prim_type;
+ union req {
+ struct arp_ins arp_ins;
+ struct arp_del arp_del;
+ struct arp_get arp_get;
+ struct arp_mget arp_mget;
+ } req;
+};
+
+typedef struct arp_type {
+ short trailers; /* are trailers used? */
+ char aname[MAXANAMLEN]; /* name of adapter, used by snmp */
+} ARP_TYPES;
+
+#define MAX_EXPIRY 0xFFFFFFFF /* expiry time for permanent entries */
+#define TIME_TIL_REUSE 15 /* time (secs) until entry reused */
+
+#endif // _SYS_SNET_ARP_CTRL_INCLUDED
+
diff --git a/private/inc/sys/snet/bsd_type.h b/private/inc/sys/snet/bsd_type.h
new file mode 100644
index 000000000..2e4dfb7ae
--- /dev/null
+++ b/private/inc/sys/snet/bsd_type.h
@@ -0,0 +1,89 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ bsd_type.h.h
+
+Abstract:
+
+ This module contains definitions for BSD compatibility for
+ STREAMS drivers.
+
+Author:
+
+ Eric Chin (ericc) July 18, 1991
+
+Revision History:
+
+--*/
+
+/*************************************************************************
+ *
+ * SpiderTCP/SNMP
+ *
+ * Copyright 1990 Spider Systems Limited
+ *
+ * BSD_TYPES.H
+ *
+ * some #defines for BSD compatibility
+ *
+ *
+ *************************************************************************/
+
+/*
+ * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.bsd_types.h
+ * @(#)bsd_types.h 1.3
+ *
+ * Last delta created 11:54:01 10/16/90
+ * This file extracted 08:53:46 7/10/91
+ *
+ * Modifications:
+ *
+ * GSS 01/03/90 put in Pbrain
+ */
+
+#ifndef _SYS_SNET_BSD_TYPE_
+#define _SYS_SNET_BSD_TYPE_
+
+
+#ifndef u_char
+#define u_char unsigned char
+#define u_short unsigned short
+#define u_long unsigned long
+#define u_int unsigned int
+#endif
+
+
+/*
+ * Select uses bit masks of file descriptors in integers.
+ * These macros manipulate such bit fields (the filesystem macros use chars).
+ * FD_SETSIZE may be defined by the user, but the default here
+ * should be >= NOFILE (param.h). In the current implementation it should
+ * not exceed 32 (sizeof int).
+ */
+#ifndef FD_SETSIZE
+#define FD_SETSIZE 32
+#endif
+
+/* number of bits in a byte */
+#define NBBY 8
+
+typedef int fd_mask;
+#define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */
+#ifndef howmany
+#define howmany(x, y) (((x)+((y)-1))/(y))
+#endif
+
+typedef struct fd_set {
+ fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
+} fd_set;
+
+
+#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
+#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
+#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
+#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p)))
+
+#endif /* _SYS_SNET_BSD_TYPE_ */
diff --git a/private/inc/sys/snet/dl_ctrl.h b/private/inc/sys/snet/dl_ctrl.h
new file mode 100644
index 000000000..5516706d0
--- /dev/null
+++ b/private/inc/sys/snet/dl_ctrl.h
@@ -0,0 +1,131 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ dl_proto.h
+
+Abstract:
+
+ This module defines some of the data types and manifests for the
+ Spider Generic Ethernet Interface.
+
+Author:
+
+ Eric Chin (ericc) August 9, 1991
+
+Revision History:
+
+ Sam Patton (sampa) July 31, 1992 merge for snap/token ring
+
+--*/
+/*
+ * Spider STREAMS Data Link Interface Primitives
+ *
+ * Copyright (c) 1989 Spider Systems Limited
+ *
+ * This Source Code is furnished under Licence, and may not be
+ * copied or distributed without express written agreement.
+ *
+ * All rights reserved.
+ *
+ * Written by Mark Valentine
+ *
+ * Made in Scotland.
+ *
+ * @(#)dl_control.h 1.6
+ *
+ * Last delta created 14:58:43 2/12/92
+ * This file extracted 09:26:06 3/18/92
+ *
+ * Modifications:
+ *
+ * 28 Jan 1992 Modified for datalink version 2
+ *
+ */
+
+#ifndef DL_CTRL_INCLUDED
+#define DL_CTRL_INCLUDED
+
+#include <sys\snet\uint.h>
+
+/*
+ * This defines Version 2 of Spider's STREAMS Data Link protocol.
+ * Its main feature is its ability to cope with hardware addresses
+ * of length not equal to 6.
+ */
+
+/*
+ * Data Link ioctl commands.
+ *
+ * To determine the version of the protocol in use, use the DATAL_VERSION
+ * command, and assume Version 0 if this fails with EINVAL. (Yuk.)
+ *
+ * The ETH_* commands will work for any current version of the protocol,
+ * but only for Ethernet drivers (hw_type == HW_ETHER).
+ *
+ * Hardware types are defined in dl_proto.h.
+ */
+
+#define DATAL_STAT ('E'<<8|1) /* gather data link statistics */
+#define DATAL_ZERO ('E'<<8|2) /* reset data link statistics */
+#define DATAL_REGISTER ('E'<<8|3) /* register data link type range */
+#define DATAL_GPARM ('E'<<8|4) /* determine data link parameters */
+#define DATAL_VERSION ('E'<<8|5) /* interrogate protocol version */
+#define DATAL_SET_ADDR ('E'<<8|6) /* set hardware address */
+#define DATAL_DFLT_ADDR ('E'<<8|7) /* restore default hardware address */
+#define DATAL_IBIND ('D'<<8|1) /* bind card to stream */
+
+/*
+ * Data Link statistics structure.
+ */
+
+struct datal_stat
+{
+ uint32 dl_tx; /* packets transmitted */
+ uint32 dl_rx; /* packets received */
+ uint32 dl_coll; /* collisions detected */
+ uint32 dl_lost; /* packets lost */
+ uint32 dl_txerr; /* transmission errors */
+ uint32 dl_rxerr; /* receive errors */
+ uint32 dl_pool_quota; /* receive pool quota */
+ uint32 dl_pool_used; /* receive pool used */
+};
+
+struct datal_register
+{
+ uint8 version; /* protocol version */
+ uint8 hw_type; /* hardware type */
+ uint8 addr_len; /* hardware address length */
+ uint8 align; /* don't use */
+ uint16 lwb; /* data link type (lower bound) */
+ uint16 upb; /* data link type (upper bound) */
+};
+
+struct datal_gparm
+{
+ uint8 version; /* protocol version */
+ uint8 hw_type; /* hardware type */
+ uint8 addr_len; /* hardware address length */
+ uint8 align; /* don't use */
+ uint16 frgsz; /* max. packet size on net */
+ uint8 addr[1]; /* hardware address (variable length) */
+};
+
+struct datal_version
+{
+ uint8 version; /* protocol version number */
+ uint8 hw_type; /* hardware type */
+};
+
+struct datal_ibind
+{
+ ULONG UseRawArcnet; /* 0 if this open should use Encapsulated */
+ /* Ethernet over arcnet */
+ /* 1 if it should use raw arcnet frames */
+ STRING adapter_name; /* adapter device driver string */
+ char buffer[80]; /* buffer to contain the name */
+};
+
+#endif //DL_CTRL_INCLUDED
diff --git a/private/inc/sys/snet/eth_prot.h b/private/inc/sys/snet/eth_prot.h
new file mode 100644
index 000000000..7599f7ad8
--- /dev/null
+++ b/private/inc/sys/snet/eth_prot.h
@@ -0,0 +1,253 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ eth_prot.h
+
+Abstract:
+
+ Definitions for the SNDIS upper protocol interface.
+
+Author:
+
+ Mike Massa (mikemas) Jan 31, 1992
+
+Revision History:
+
+ Who When What
+ -------- -------- ----------------------------------------------
+ mikemas 01-31-92 created
+
+Notes:
+
+--*/
+
+/******************************************************************
+ *
+ * SpiderTCP Interface Primitives
+ *
+ * Copyright (c) 1988 Spider Systems Limited
+ *
+ * This Source Code is furnished under Licence, and may not be
+ * copied or distributed without express written agreement.
+ *
+ * All rights reserved.
+ *
+ * Written by Nick Felisiak, Ian Heavens, Peter Reid,
+ * Gavin Shearer, Mark Valentine
+ *
+ * ETH_PROTO.H
+ *
+ * Ethernet Streams proto primitives for TCP/IP on V.3 Streams
+ *
+ ******************************************************************/
+
+/*
+ * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.eth_proto.h
+ * @(#)eth_proto.h 1.9
+ *
+ * Last delta created 11:03:25 10/29/90
+ * This file extracted 08:53:41 7/10/91
+ */
+
+#ifdef GENERICE
+
+/*
+ * Primitive type values.
+ */
+
+#define DL_TYPE ETH_TYPE /* ethernet registration (old style) */
+#define ETH_TYPE 'R' /* ethernet registration */
+#define ETH_PARAMS 'P' /* ethernet parameters */
+/*efine ETH_PACKET 'p' /* ethernet packet */
+#define ETH_TX 't' /* packet for transmission */
+#define ETH_RX 'r' /* incoming packet */
+
+/*
+ * Ethernet Type registration.
+ */
+
+#define dl_type eth_type
+#define dl_lwb lwb
+#define dl_upb upb
+#define dl_ethaddr ethaddr
+#define dl_frgsz frgsz
+#define S_DL_TYPE S_ETH_TYPE
+
+typedef struct eth_type {
+ uint8 prim_type; /* i.e. ETH_TYPE */
+ uint8 aux_type; /* unused in Ethernet Driver */
+ uint16 pad; /* compatibility with previous interface */
+ uint16 lwb; /* lower bound of type range */
+ uint16 upb; /* upper bound of type range */
+ uint8 ethaddr[6]; /* ethernet address */
+ uint16 frgsz; /* max. packet size on net */
+} S_ETH_TYPE;
+
+typedef struct eth_params {
+ uint8 prim_type; /* i.e. ETH_PARAMS */
+ uint8 aux_type; /* unused in Ethernet Driver */
+ uint16 pad; /* compatibility with previous interface */
+ uint8 ethaddr[6]; /* ethernet address */
+ uint16 frgsz; /* max. packet size on net */
+} S_ETH_PARAMS;
+
+/*
+ * Packet header data.
+ */
+
+typedef struct eth_packet {
+ uint8 prim_type; /* i.e. ETH_PACKET */
+ uint8 aux_type; /* unused in Ethernet Driver */
+ uint16 pad; /* compatibility with previous interface */
+ uint16 eth_type; /* ethernet type field */
+ uint8 eth_src[6]; /* source ethernet address */
+ uint8 eth_dst[6]; /* destination ethernet address */
+} S_ETH_PACKET;
+
+typedef struct eth_rx {
+ uint8 prim_type; /* i.e. ETH_RX */
+ uint8 aux_type; /* unused in Ethernet Driver */
+ uint16 pad; /* compatibility with previous interface */
+ uint16 eth_type; /* ethernet type field */
+ uint8 eth_src[6]; /* source ethernet address */
+} S_ETH_RX;
+
+typedef struct eth_tx {
+ uint8 prim_type; /* i.e. ETH_TX */
+ uint8 aux_type; /* unused in Ethernet Driver */
+ uint16 pad; /* compatibility with previous interface */
+ uint16 eth_type; /* ethernet type field */
+ uint8 eth_dst[6]; /* destination ethernet address */
+} S_ETH_TX;
+
+/*
+ * Generic ethernet protocol primitive
+ */
+
+typedef union eth_proto
+{
+ uint8 type; /* variant tag */
+ struct eth_type etype; /* if type == ETH_TYPE */
+ struct eth_params eparm; /* if type == ETH_PARAMS */
+ struct eth_rx erx; /* if type == ETH_RX */
+ struct eth_tx etx; /* if type == ETH_TX */
+} S_ETH_PROTO;
+
+#else /* GENERICE */
+
+/* type range we want to receive from ethernet */
+typedef struct dl_type {
+ int prim_type;
+ unsigned short dl_lwb;
+ unsigned short dl_upb;
+} S_DL_TYPE;
+
+/* M_PROTO Message primitives */
+
+#define DL_RX 4 /* arp receives from eth */
+#define DL_TYPE 5 /* arp send type field to eth */
+#ifdef PROJ4
+#define ETH_TX 1 /* packet for transmission */
+#define ETH_RX 2 /* incoming packet */
+#else
+#define ETH_TX 6 /* packet for transmission */
+#define ETH_RX 7 /* incoming packet */
+#endif
+
+/*
+ * M_PROTO message formats
+ */
+#ifdef EMD
+struct eth_tx {
+ char dl_dst[6];
+ char dl_src[6];
+ short dl_type;
+};
+#else
+struct eth_tx {
+ int prim_type;
+ short dl_type;
+ char dl_dst[6];
+};
+#endif
+
+struct eth_rx {
+ int prim_type;
+ struct ethmessage *eth_msg;
+};
+
+
+union eth_proto {
+ int type;
+ struct eth_tx eth_tx;
+ struct eth_rx eth_rx;
+ struct dl_type dl_type;
+};
+
+/*
+ * errors generated
+ */
+#define EFRGSZ 1
+#define EDLTYPE 2
+#define EPRIM 3
+#define EBUF 4
+#define EMSG 5
+
+/*
+ * arp receives datalink pkt from eth
+ */
+typedef struct dl_rx {
+ int prim_type;
+ unsigned short dl_type;
+ char dl_src[6];
+} S_DL_RX;
+
+#endif /* GENERICE */
+
+
+#ifdef PROJ4
+
+/*
+ * PROJ4 Attachment values
+ */
+#define A_LAN 9
+#define A_IP 20
+#define A_UDP 23
+#define A_ARP 24
+
+#define ATTACH 13 /* attach to driver */
+
+/*
+ * ATTACH struct - for communication with the lower
+ * Driver
+ */
+typedef struct attach {
+ int prim_type;
+ unsigned short fromid;
+ unsigned short toid;
+ unsigned int fromvers;
+ unsigned int tovers;
+ int result;
+ unsigned short type_upb0;
+ unsigned short type_lwb0;
+ unsigned short type_upb1;
+ unsigned short type_lwb1;
+ unsigned short type_upb2;
+ unsigned short type_lwb2;
+ unsigned short type_upb3;
+ unsigned short type_lwb3;
+} S_ATTACH;
+
+#define DATAL_TX ETH_TX
+#define S_DATAL_TX struct eth_tx
+#define datal_tx eth_tx
+
+/*
+ * Hardware types
+ */
+
+#define HW_ETHERNET 1
+#endif
diff --git a/private/inc/sys/snet/inet_var.h b/private/inc/sys/snet/inet_var.h
new file mode 100644
index 000000000..83e142ba7
--- /dev/null
+++ b/private/inc/sys/snet/inet_var.h
@@ -0,0 +1,485 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ inet_var.h
+
+Abstract:
+
+ This module contains definitions for variable finding functions for
+ the Internet MIB. Used by STREAMS drivers.
+
+Author:
+
+ Eric Chin (ericc) July 18, 1991
+
+Revision History:
+
+--*/
+
+/*
+ * Copyright (c) 1988 Spider Systems Limited
+ *
+ * /usr/users/bridge/sccs/appln/snmp/corecode/s.inet_var.h
+ * @(#)inet_var.h 1.4
+ *
+ * Last delta created 10:33:41 12/13/90
+ * This file extracted 19:57:15 12/20/90
+ */
+/*************************************************************************
+ *
+ * SpiderSNMP
+ *
+ * Copyright 1989 Spider Systems Limited
+ *
+ * INET_VAR.H
+ *
+ * Definitions for variable finding functions for the Internet
+ * MIB
+ *
+ * Peter Reid @ Spider Systems Limited
+ * Ted Socolofsky @ Spider Systems Limited
+ *
+ *************************************************************************/
+
+/*
+ * Modifications:
+ *
+ * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.inet_var.h
+ * @(#)inet_var.h 1.24
+ *
+ * Last delta created 12:10:30 1/9/91
+ * This file extracted 08:53:47 7/10/91
+ *
+ * PR 1 Jun 89 Built simulator
+ * PR/TS 31 Jun 89 Built remote box simulation
+ * GSS 2 Mar 90 Put in Pbrain
+ */
+
+
+#ifndef _SYS_SNET_INET_VAR_
+#define _SYS_SNET_INET_VAR_
+
+
+#ifndef SPIDER_ROUTER
+#ifndef SPIDER_BRIDGE
+#ifdef SNMP
+#define SPIDER_TCP
+#define SYSTEM_MIB
+#define IF_MIB2
+#define AT_MIB
+#define IP_MIB
+#define ICMP_MIB
+#define TCP_MIB
+#define UDP_MIB
+#endif /* SNMP */
+#endif /* ~SPIDER_BRIDGE */
+#endif /* SPIDER_ROUTER */
+
+#ifdef SYSTEM_MIB
+#ifndef SHMEM
+
+
+/*
+ * Internet variables
+ */
+#define SYSDESCRLEN 80
+
+#ifndef SYSOBJLEN
+#define SYSOBJLEN 32
+#endif
+
+extern char sysDescr[];
+#ifdef SID_T
+extern SID_T sysObjectID[];
+#endif
+
+#ifdef DOS_COMPILE
+#ifdef SPIDER_PROBE
+#define sysUpTime tod_tick
+extern u_long tod_tick;
+#endif /* SPIDER_PROBE */
+#endif /* DOS_COMPILE */
+
+#ifndef SPIDER_PROBE
+extern int sysObjectIDLen;
+#endif
+
+#endif /* ~SHMEM */
+
+#endif /* SYSTEM_MIB */
+
+#ifdef IF_MIB2
+
+struct mib_interface {
+ long version; /* version number of the MIB */
+ long ifNumber; /* number of interfaces */
+};
+
+#define IFDESCRLEN 64
+#define IFPHYSADDRLEN 64
+
+struct mib_ifEntry {
+ long version; /* version number of the MIB */
+ long ifIndex; /* index of this interface */
+ char ifDescr[IFDESCRLEN]; /* English description of interface */
+ long ifType; /* network type of device */
+ long ifMtu; /* size of largest packet in bytes */
+ u_long ifSpeed; /* bandwidth in bits/sec */
+ u_char ifPhysAddress[IFPHYSADDRLEN]; /* interface's address */
+ u_char PhysAddrLen; /* length of physAddr */
+ long ifAdminStatus; /* desired state of interface */
+ long ifOperStatus; /* current operational status */
+ u_long ifLastChange; /* sysUpTime when curr state entered */
+ u_long ifInOctets; /* # octets received on interface */
+ u_long ifInUcastPkts; /* # unicast packets delivered */
+ u_long ifInNUcastPkts; /* # broadcasts or multicasts */
+ u_long ifInDiscards; /* # packets discarded with no error */
+ u_long ifInErrors; /* # packets containing errors */
+ u_long ifInUnknownProtos; /* # packets with unknown protocol */
+ u_long ifOutOctets; /* # octets transmittedwn protocol */
+ u_long ifOutUcastPkts; /* # unicast packets sent protocol */
+ u_long ifOutNUcastPkts; /* # broadcast or multicast pkts */
+ u_long ifOutDiscards; /* # packets discarded with no error */
+ u_long ifOutErrors; /* # pkts discarded with an error */
+ u_long ifOutQLen; /* # packets in output queue */
+ u_char ifSpecificLen; /* length of object ID */
+ u_long ifSpecific[SYSOBJLEN]; /* object ID of product specific stuf*/
+};
+
+#ifndef SPIDER_TCP
+#define MAX_INTERFACES 2
+#define MAXDATA 630
+#endif /* SPIDER_TCP */
+
+#endif /* IF_MIB2 */
+
+#ifdef AT_MIB
+
+#ifdef SPIDER_TCP
+#define ATPHYSADDRLEN 64
+
+#endif
+struct mib_atEntry {
+#ifdef SPIDER_TCP
+ long version; /* version number of the MIB */
+#endif /* SPIDER_TCP */
+ long atIfIndex; /* interface on which entry maps */
+#ifdef SPIDER_TCP
+ u_char atPhysAddress[ATPHYSADDRLEN]; /* physical address of destination */
+#else
+ u_char atPhysAddress[IFPHYSADDRLEN]; /* physical address of destination */
+#endif
+ u_char PhysAddressLen; /* length of atPhysAddress */
+ u_long atNetAddress; /* IP address of physical address */
+ long atType; /* Type of Entry */
+};
+#endif /* AT_MIB */
+
+#ifdef IP_MIB
+
+struct mib_ip {
+#ifdef SPIDER_TCP
+ long version; /* version number of the MIB */
+#endif /* SPIDER_TCP */
+ long ipForwarding; /* 1 if gateway, 2 if host */
+ long ipDefaultTTL; /* default TTL for pkts from here */
+ u_long ipInReceives; /* # IP packets rcvd from interfaces */
+ u_long ipInHdrErrors; /* # pkts discarded - header errors */
+ u_long ipInAddrErrors; /* # pkts discarded - bad address */
+ u_long ipForwDatagrams; /* # pkts forwarded through entity */
+ u_long ipInUnknownProtos; /* # local-addr pkts w/unknown proto */
+ u_long ipInDiscards; /* # error-free packets discarded */
+ u_long ipInDelivers; /* # pkts delivered to upper level */
+ u_long ipOutRequests; /* # IP pkts originating locally */
+ u_long ipOutDiscards; /* # valid output IP pkts dropped */
+ u_long ipOutNoRoutes; /* # IP pkts discarded - no route */
+ long ipReasmTimeout; /* fragment reassembly time (secs) */
+ u_long ipReasmReqds; /* # fragments needing reassembly */
+ u_long ipReasmOKs; /* # fragments reassembled */
+ u_long ipReasmFails; /* # failures in IP reassembly */
+ u_long ipFragOKs; /* # datagrams fragmented here */
+ u_long ipFragFails; /* # pkts unable to be fragmented */
+ u_long ipFragCreates; /* # IP fragments created here */
+ u_long ipRoutingDiscards; /* # IP Routing Discards */
+};
+
+struct mib_ipAddrEntry {
+#ifdef SPIDER_TCP
+ long version; /* version number of the MIB */
+#endif /* SPIDER_TCP */
+ u_long ipAdEntAddr; /* IP address of this entry */
+ long ipAdEntIfIndex; /* IF for this entry */
+ u_long ipAdEntNetMask; /* subnet mask of this entry */
+ long ipAdEntBcastAddr; /* read the MIB for this one */
+ u_long ipAdEntReasmMaxSize; /* and this one */
+};
+
+struct mib_ipRouteEntry {
+#ifdef SPIDER_TCP
+ long version; /* version number of the MIB */
+#endif /* SPIDER_TCP */
+ u_long ipRouteDest; /* destination IP addr for this route */
+ long ipRouteIfIndex; /* index of local IF for this route */
+ long ipRouteMetric1; /* Primary routing metric */
+ long ipRouteMetric2; /* Alternate routing metric */
+ long ipRouteMetric3; /* Alternate routing metric */
+ long ipRouteMetric4; /* Alternate routing metric */
+ u_long ipRouteNextHop; /* IP addr of next hop */
+ long ipRouteType; /* Type of this route */
+ long ipRouteProto; /* How this route was learned */
+ long ipRouteAge; /* No. of seconds since updating this route */
+ u_long ipRouteMask; /* */
+ long ipRouteMetric5; /* Alternate routing metric */
+ u_char ipRouteInfoLen; /* length of object ID */
+ u_long ipRouteInfo[SYSOBJLEN]; /* object ID of product specific stuf*/
+};
+
+#if 0 /* MIB_II */
+#define IPNTOMPHYSADDRLEN 16
+struct mib_ipNetToMediaEntry {
+ long ipNtoMIfIndex; /* interface on which entry maps */
+ u_char ipNtoMPhysAddress[IPNTOMPHYSADDRLEN]; /* physical address of destination */
+ u_char NtoMPhysAddressLen; /* length of atPhysAddress */
+ u_long ipNtoMNetAddress; /* IP address of physical address */
+ u_long ipNtoMMediaType; /* */
+};
+#endif /* MIB_II */
+
+#ifndef SPIDER_TCP
+#define IPFRAGTTL 15
+#define ROUTE_ENTRIES 2
+#endif /* SPIDER_TCP */
+
+#endif /* IP_MIB */
+#ifdef ICMP_MIB
+
+
+struct mib_icmp {
+#ifdef SPIDER_TCP
+ long version; /* version number of the MIB */
+#endif /* SPIDER_TCP */
+ u_long icmpInMsgs; /* Total of ICMP msgs received */
+ u_long icmpInErrors; /* Total ICMP msgs rcvd with errors */
+ u_long icmpInDestUnreachs; /* */
+ u_long icmpInTimeExcds; /* */
+ u_long icmpInParmProbs; /* */
+ u_long icmpInSrcQuenchs; /* */
+ u_long icmpInRedirects; /* */
+ u_long icmpInEchos; /* */
+ u_long icmpInEchoReps; /* */
+ u_long icmpInTimestamps; /* */
+ u_long icmpInTimestampReps; /* */
+ u_long icmpInAddrMasks; /* */
+ u_long icmpInAddrMaskReps; /* */
+ u_long icmpOutMsgs; /* */
+ u_long icmpOutErrors; /* */
+ u_long icmpOutDestUnreachs; /* */
+ u_long icmpOutTimeExcds; /* */
+ u_long icmpOutParmProbs; /* */
+ u_long icmpOutSrcQuenchs; /* */
+ u_long icmpOutRedirects; /* */
+ u_long icmpOutEchos; /* */
+ u_long icmpOutEchoReps; /* */
+ u_long icmpOutTimestamps; /* */
+ u_long icmpOutTimestampReps; /* */
+ u_long icmpOutAddrMasks; /* */
+ u_long icmpOutAddrMaskReps; /* */
+};
+
+#define ICMP_MAXTYPE 18
+
+#endif /* ICMP_MIB */
+#ifdef TCP_MIB
+
+struct mib_tcp {
+#ifdef SPIDER_TCP
+ long version; /* version number of the MIB */
+#endif /* SPIDER_TCP */
+ long tcpRtoAlgorithm;/* retransmission timeout algorithm */
+ long tcpRtoMin; /* minimum retransmission timeout (mS) */
+ long tcpRtoMax; /* maximum retransmission timeout (mS) */
+ long tcpMaxConn; /* maximum tcp connections possible */
+ u_long tcpActiveOpens; /* number of SYN-SENT -> CLOSED transitions */
+ u_long tcpPassiveOpens;/* number of SYN-RCVD -> LISTEN transitions */
+ u_long tcpAttemptFails;/* (SYNSENT,SYNRCV)->CLOSED, SYN-RCV->LISTEN */
+ u_long tcpEstabResets; /* (ESTABLISHED,CLOSE-WAIT) -> CLOSED */
+ u_long tcpCurrEstab; /* number in ESTABLISHED or CLOSE-WAIT state */
+ u_long tcpInSegs; /* number of segments received */
+ u_long tcpOutSegs; /* number of segments sent */
+ u_long tcpRetransSegs; /* number of retransmitted segments */
+ u_long tcpInErrs; /* # rcved in err */
+ u_long tcpOutRsts; /* # segs sent with RST flag */
+};
+
+struct mib_tcpConnEntry {
+#ifdef SPIDER_TCP
+ long version; /* version number of the MIB */
+#endif /* SPIDER_TCP */
+ long tcpConnState; /* State of this conn */
+ u_long tcpConnLocalAddress; /* local IP address for this conn */
+ long tcpConnLocalPort; /* local port for this conn */
+ u_long tcpConnRemAddress; /* remote IP address for this conn */
+ long tcpConnRemPort; /* remote port for this conn */
+};
+
+#endif /* TCP_MIB */
+#ifdef UDP_MIB
+
+struct mib_udp {
+#ifdef SPIDER_TCP
+ long version; /* version number of the MIB */
+#endif /* SPIDER_TCP */
+ u_long udpInDatagrams; /* # UDP pkts delivered to users */
+ u_long udpNoPorts; /* # UDP pkts to unbound port */
+ u_long udpInErrors; /* # UDP pkts unable to be delivered */
+ u_long udpOutDatagrams; /* # UDP pkts sent from this entity */
+};
+
+struct mib_udpEntry {
+#ifdef SPIDER_TCP
+ long version; /* version number of the MIB */
+#endif /* SPIDER_TCP */
+ u_long udpLocalAddress; /* local IP adress */
+ u_long udpLocalPort; /* local port */
+};
+#endif /* UDP_MIB */
+#ifdef EGP_MIB
+
+struct mib_egp {
+#ifdef SPIDER_TCP
+ long version; /* version number of the MIB */
+#endif /* SPIDER_TCP */
+ u_long egpInMsgs; /* No. of EGP msgs received without error */
+ u_long egpInErrors; /* No. of EGP msgs received with error */
+ u_long egpOutMsgs; /* No. of EGP msgs sent */
+ u_long egpOutErrors; /* No. of EGP TX msgs dropped due to error */
+};
+
+struct mib_egpNeighEntry {
+#ifdef SPIDER_TCP
+ long version; /* version number of the MIB */
+#endif /* SPIDER_TCP */
+ long egpNeighState; /* local EGP state with entry's neighbor */
+ u_long egpNeighAddr; /* IP address of this entry's neighbor */
+};
+
+#endif /* EGP_MIB */
+
+#ifdef SYSTEM_MIB
+#define SYS_SERVICE_PHYS 1
+#define SYS_SERVICE_DATALINK 2
+#define SYS_SERVICE_INTERNET 3
+#define SYS_SERVICE_ENDTOEND 4
+#define SYS_SERVICE_APPLIC 7
+#endif
+
+#ifdef IF_MIB2
+#define MIB_IFTYPE_OTHER 1
+#define MIB_IFTYPE_REGULAR1822 2
+#define MIB_IFTYPE_HDH1822 3
+#define MIB_IFTYPE_DDNX25 4
+#define MIB_IFTYPE_RFC877X25 5
+#define MIB_IFTYPE_ETHERNETCSMACD 6
+#define MIB_IFTYPE_ISO88023CSMACD 7
+#define MIB_IFTYPE_ISO88024TOKENBUS 8
+#define MIB_IFTYPE_ISO88025TOKENRING 9
+#define MIB_IFTYPE_ISO88026MAN 10
+#define MIB_IFTYPE_STARLAN 11
+#define MIB_IFTYPE_PROTEON10MBIT 12
+#define MIB_IFTYPE_PROTEON80MBIT 13
+#define MIB_IFTYPE_HYPERCHANNEL 14
+#define MIB_IFTYPE_FDDI 15
+#define MIB_IFTYPE_LAPB 16
+#define MIB_IFTYPE_SDLC 17
+#define MIB_IFTYPE_T1CARRIER 18
+#define MIB_IFTYPE_CEPT 19
+#define MIB_IFTYPE_BASICISDN 20
+#define MIB_IFTYPE_PRIMARYISDN 21
+#define MIB_IFTYPE_PROPPNTTOPNTSERIAL 22
+#define MIB_IFTYPE_PPP 23
+#define MIB_IFTYPE_SOFTWARELOOPBACK 24
+#define MIB_IFTYPE_EON 25
+#define MIB_IFTYPE_ETHERNET3MBIT 26
+#define MIB_IFTYPE_NSIP 27
+#define MIB_IFTYPE_SLIP 28
+#define MIB_IFTYPE_ULTRA 29
+#define MIB_IFTYPE_DS3 30
+#define MIB_IFTYPE_SIP 31
+#define MIB_IFTYPE_FRAMERELAY 32
+
+
+#define MIB_IFMTU_ETH 1514
+
+#define MIB_IFSPEED_ETH 10000000L
+
+#define MIB_PHYADDRLEN_ETH 6
+
+#define MIB_IFSTATUS_UP 1
+#define MIB_IFSTATUS_DOWN 2
+#define MIB_IFSTATUS_TESTING 3
+
+#endif /* IF_MIB2 */
+
+#define AT_OTHER 1
+#define AT_INVALID 2
+#define AT_DYNAMIC 3
+#define AT_STATIC 4
+
+#ifdef IP_MIB
+#define MIB_FORWARD_GATEWAY 1
+#define MIB_FORWARD_HOST 2
+
+#define MIB_IPROUTETYPE_OTHER 1
+#define MIB_IPROUTETYPE_INVALID 2
+#define MIB_IPROUTETYPE_DIRECT 3
+#define MIB_IPROUTETYPE_REMOTE 4
+
+#define MIB_IPROUTEPROTO_OTHER 1
+#define MIB_IPROUTEPROTO_LOCAL 2
+#define MIB_IPROUTEPROTO_NETMGMT 3
+#define MIB_IPROUTEPROTO_ICMP 4
+#define MIB_IPROUTEPROTO_EGP 5
+#define MIB_IPROUTEPROTO_GGP 6
+#define MIB_IPROUTEPROTO_HELLO 7
+#define MIB_IPROUTEPROTO_RIP 8
+#define MIB_IPROUTEPROTO_ISIS 9
+#define MIB_IPROUTEPROTO_ESIS 10
+#define MIB_IPROUTEPROTO_CISCOIGRP 11
+#define MIB_IPROUTEPROTO_BBNSPFIGP 12
+#define MIB_IPROUTEPROTO_OIGP 13
+
+#endif /* IP_MIB */
+#ifdef TCP_MIB
+
+#define MIB_TCPRTOALG_OTHER 1
+#define MIB_TCPRTOALG_CONSTANT 2
+#define MIB_TCPRTOALG_RSRE 3
+#define MIB_TCPRTOALG_VANJ 4
+
+#define MIB_TCPCONNSTATE_CLOSED 1
+#define MIB_TCPCONNSTATE_LISTEN 2
+#define MIB_TCPCONNSTATE_SYNSENT 3
+#define MIB_TCPCONNSTATE_SYNRECEIVED 4
+#define MIB_TCPCONNSTATE_ESTABLISHED 5
+#define MIB_TCPCONNSTATE_FINWAIT1 6
+#define MIB_TCPCONNSTATE_FINWAIT2 7
+#define MIB_TCPCONNSTATE_CLOSEWAIT 8
+#define MIB_TCPCONNSTATE_LASTACK 9
+#define MIB_TCPCONNSTATE_CLOSING 10
+#define MIB_TCPCONNSTATE_TIMEWAIT 11
+
+#endif /* TCP_MIB */
+#ifdef EGP_MIB
+
+#define MIB_EGPNEIGHSTATE_IDLE 1
+#define MIB_EGPNEIGHSTATE_AQUISITION 2
+#define MIB_EGPNEIGHSTATE_DOWN 3
+#define MIB_EGPNEIGHSTATE_UP 4
+#define MIB_EGPNEIGHSTATE_CEASE 5
+
+#endif /* EGP_MIB */
+
+#endif /* _SYS_SNET_INET_VAR_ */
diff --git a/private/inc/sys/snet/ip_ctrl.h b/private/inc/sys/snet/ip_ctrl.h
new file mode 100644
index 000000000..8abfaef8f
--- /dev/null
+++ b/private/inc/sys/snet/ip_ctrl.h
@@ -0,0 +1,253 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ ip_ctrl.h
+
+Abstract:
+
+ This file contains the user-level STREAMS ioctl interface definitions
+ for the IP driver.
+
+Author:
+
+ Eric Chin (ericc) July 18, 1991
+
+Revision History:
+
+--*/
+
+/******************************************************************
+ *
+ * SpiderTCP Interface Primitives
+ *
+ * Copyright (c) 1988 Spider Systems Limited
+ *
+ * This Source Code is furnished under Licence, and may not be
+ * copied or distributed without express written agreement.
+ *
+ * All rights reserved.
+ *
+ * Written by Nick Felisiak, Ian Heavens, Peter Reid,
+ * Gavin Shearer, Mark Valentine
+ *
+ * IP_CONTROL.H
+ *
+ * IP Streams ioctl primitives for TCP/IP on V.3/V.4 Streams
+ *
+ ******************************************************************/
+
+#ifndef _SYS_SNET_IP_CTRL_
+#define _SYS_SNET_IP_CTRL_
+
+#ifndef SYSOBJLEN
+#define SYSOBJLEN 32
+#endif
+
+
+#define IP_NET_ADDR (('I'<<8)+1) /* IP registration from netd */
+#define ICMP_CTRL (('I'<<8)+2) /* control ICMP redirects */
+#define SET_IP_CTRL (('I'<<8)+3) /* set IP control information */
+#define GET_IP_CTRL (('I'<<8)+4) /* get IP control information */
+#ifdef MULTIH
+#define ADD_IPNET IP_NET_ADDR /* add IP network to this interface */
+#define SHOW_IPNET (('I'<<8)+5) /* dump IP network information */
+#define DEL_IPNET (('I'<<8)+6) /* delete IP network from interface */
+#define ADD_IPADDR (('I'<<8)+7) /* add IP address to this interface */
+#define SHOW_IPADDR (('I'<<8)+8) /* dump IP address information */
+#define DEL_IPADDR (('I'<<8)+9) /* delete IP address from interface */
+#endif
+
+#define GET_ALL_INTERFACES 1
+#define GET_INTERFACE_INFO 2
+#ifdef HOSTREQ_MAYBE
+#define SET_INTERFACE_INFO 3
+#endif
+#define GATE_ACCESS 4
+
+
+
+/*
+ * ** netd registration **
+ */
+
+typedef struct net_addr {
+ int muxid;
+ long inaddr;
+ long subnet_mask;
+ char forward_bdcst;
+ char keepalive;
+ short mtu;
+ short router_mtu;
+ char if_broadcast;
+} NET_ADDRS;
+
+
+
+/*
+ * ** routing cache access **
+ */
+
+/*
+ * Gateway access structures etc.
+ */
+struct gate_access {
+ char flush;
+ char smart;
+ short command;
+ long dest;
+ long gate;
+};
+
+
+/*
+ * routing cache access command values (subcodes of GATE_ACCESS)
+ */
+
+#define GATE_PRINT 1
+#define GATE_ADD 2
+#define GATE_DEL 3
+#define GATE_CHANGE 4
+
+#define WILD_CARD -1L /* to indicate that all networks should be acted on */
+
+/*
+ * routing cache definitions
+ */
+
+#ifdef COMPILE_UP_TCPIP
+
+#define GWAY_TIMEOUT 30
+
+typedef struct gw_hashentry {
+ long from; /* network */
+ long to; /* default gateway, if it exists */
+ long redirect; /* ICMP Redirect gateway, if it exists */
+ long active_gw; /* 1 = gateway is active, 0 = not active */
+ short count; /* Counter for timer */
+ /*
+ * "from" is equivalent to "ipRouteDest",
+ * and "to" or "redirect" is equivalent to "ipRouteNextHop"
+ */
+ long saveProto; /* saved protocol when doing a redirect */
+ long ipRouteIfIndex; /* index of local IF for this route */
+ long ipRouteMetric1; /* Primary routing metric */
+ long ipRouteMetric2; /* Alternate routing metric */
+ long ipRouteMetric3; /* Alternate routing metric */
+ long ipRouteMetric4; /* Alternate routing metric */
+ long ipRouteMetric5; /* Alternate routing metric */
+ long ipRouteType; /* Type of this route */
+ long ipRouteProto; /* How this route was learned */
+ long ipRouteAge; /* time this route was updated */
+ long ipRouteMask; /* Subnet Mask for Route */
+ unsigned char ipRouteInfoLen; /* length of object ID */
+ unsigned long ipRouteInfo[SYSOBJLEN]; /* object ID of product specific stuf*/
+} GW_HASHENTRY;
+
+#else /* COMPILE_UP_TCPIP */
+
+#define GWAY_LIFE 300 /* 5 minute timeout in seconds */
+
+typedef struct gw_hashentry {
+ long from; /* network */
+ long to; /* default gateway, if it exists */
+ long redirect; /* ICMP Redirect gateway, if it exists */
+ long active_gw; /* 1 = gateway is active, 0 = not active */
+ /*
+ * "from" is equivalent to "ipRouteDest",
+ * and "to" or "redirect" is equivalent to "ipRouteNextHop"
+ */
+ long saveProto; /* saved protocol when doing a redirect */
+ long ipRouteIfIndex; /* index of local IF for this route */
+ long ipRouteMetric1; /* Primary routing metric */
+ long ipRouteMetric2; /* Alternate routing metric */
+ long ipRouteMetric3; /* Alternate routing metric */
+ long ipRouteMetric4; /* Alternate routing metric */
+ long ipRouteMetric5; /* Alternate routing metric */
+ long ipRouteType; /* Type of this route */
+ long ipRouteProto; /* How this route was learned */
+ long ipRouteAge; /* time this route was updated */
+ long ipRouteMask; /* Subnet Mask for Route */
+ unsigned char ipRouteInfoLen; /* length of object ID */
+ unsigned long ipRouteInfo[SYSOBJLEN]; /* object ID of product specific stuf*/
+} GW_HASHENTRY;
+
+#endif /* COMPILE_UP_TCPIP */
+
+
+
+/*
+ * Subnet mux table entry data. This structure is a subset of the
+ * kernel-level structure. They must match. This is a maintenance
+ * headache, but to remedy it, the IP code would have to be modified
+ * to make this structure a subfield of the real table structure.
+ */
+
+#ifdef COMPILE_UP_TCPIP
+
+typedef struct net_interface_data {
+ long inaddr; /* network internet address */
+ long net_num; /* network number */
+ long subnet_num; /* subnet number */
+ long subnet_mask; /* subnet mask */
+ long sn_bdcst1; /* subnet broadcast :all zeroes */
+ long sn_bdcst2; /* subnet broadcast :all 1's */
+ long net_bdcst1; /* network broadcast :all zeroes */
+ long net_bdcst2; /* network broadcast :all 1's */
+ int frag_size; /* max allowable fragment size for subnet */
+ int opt_size; /* optimum size (may be same as frag_size) */
+ short int_flags; /* interface flags (see below) */
+ short blocked; /* true if interface is blocked */
+#ifdef HOSTREQ_MAYBE
+ union {
+ long bdcast_addr;
+ long dst_addr;
+ } addr; /* broadcast address, or dest address for SLIP */
+# define if_broadcast addr.bdcast_addr
+# define if_destination addr.dst_addr
+#endif
+ int lower_snmp; /* true if lower interface supports SNMP */
+ long status; /* status: up, down, or testing */
+ time_t change; /* time state was entered */
+ long if_broadcast; /* preferred network broadcast */
+ long if_snbroadcast; /* preferred subnet broadcast */
+} NET_INTERFACE_DATA;
+
+#else /* COMPILE_UP_TCPIP */
+
+typedef struct net_interface_data {
+ long inaddr; /* network internet address */
+ long net_num; /* network number */
+ long subnet_num; /* subnet number */
+ long subnet_mask; /* subnet mask */
+ long sn_bdcst1; /* subnet broadcast :all zeroes */
+ long sn_bdcst2; /* subnet broadcast :all 1's */
+ long net_bdcst1; /* network broadcast :all zeroes */
+ long net_bdcst2; /* network broadcast :all 1's */
+ int frag_size; /* max allowable fragment size for subnet */
+ int opt_size; /* optimum size (may be same as frag_size) */
+ short int_flags; /* interface flags */
+ short user_flags; /* user flags */
+ short blocked; /* true if interface is blocked */
+
+#ifdef HOSTREQ_MAYBE
+ union {
+ long bdcast_addr;
+ long dst_addr;
+ } addr; /* broadcast address, or dest address for SLIP */
+# define if_broadcast addr.bdcast_addr
+# define if_destination addr.dst_addr
+#endif
+
+ int lower_snmp; /* true if lower interface supports SNMP */
+ long status; /* status: up, down, or testing */
+ time_t change; /* time state was entered */
+ long if_broadcast; /* preferred network broadcast */
+ long if_snbroadcast; /* preferred subnet broadcast */
+} NET_INTERFACE_DATA;
+
+#endif /* COMPILE_UP_TCPIP */
+
+#endif /* _SYS_SNET_IP_CTRL_ */
diff --git a/private/inc/sys/snet/ip_proto.h b/private/inc/sys/snet/ip_proto.h
new file mode 100644
index 000000000..aa42742ed
--- /dev/null
+++ b/private/inc/sys/snet/ip_proto.h
@@ -0,0 +1,317 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ ip_proto.h
+
+Abstract:
+
+ This module contains definitions for STREAMS IP
+
+Author:
+
+ Eric Chin (ericc) July 18, 1991
+
+Revision History:
+
+--*/
+
+/******************************************************************
+ *
+ * SpiderTCP Interface Primitives
+ *
+ * Copyright (c) 1988 Spider Systems Limited
+ *
+ * This Source Code is furnished under Licence, and may not be
+ * copied or distributed without express written agreement.
+ *
+ * All rights reserved.
+ *
+ * Written by Nick Felisiak, Ian Heavens, Peter Reid,
+ * Gavin Shearer, Mark Valentine
+ *
+ * IP_PROTO.H
+ *
+ * IP Streams proto primitives for TCP/IP on V.3/V.4 Streams
+ *
+ ******************************************************************/
+
+#ifndef _SYS_SNET_IP_PROTO_
+#define _SYS_SNET_IP_PROTO_
+
+
+#ifndef IPOPTS
+#define IPOPTS
+#endif
+
+#define IP_TX 6 /* tcp/udp send pkt to ip */
+#define PROT_RX 8 /* tcp/udp get pkt from ip */
+#define IP_PROTQ 9 /* tcp/udp send prot q to ip */
+#define ICMP_RX 12 /* upper layer rcv icmp pkt from ip */
+#define ICMP_TX 13 /* upper layer send icmp pkt to ip */
+#define ENQ_LOCAL 14 /* validate local address enquiry */
+#define ENQ_REMOTE 15 /* validate remote address enquiry */
+#define IP_FLOW 16 /* flow control interface to upper layers */
+#define IP_PROT_REMOVEQ 17 /* tcp/udp deregister prot q to ip */
+
+#ifdef TESTOPT
+/*
+ * TESTOPT driver field
+ */
+#define TCPTEST 1
+#define UDPTEST TCPTEST
+#define IPTEST 2
+
+/*
+ * TESTOPT type field
+ */
+
+#define NEXT 1 /* carry out for next num packets */
+#define ALL 2 /* carry out for all packets */
+#define OFF 3 /* turn off option */
+#define RANDOM 4 /* carry out for random packets, prob 1/num */
+
+/*
+ * TESTOPT option field
+ */
+
+#define BAD_CKSUM 1
+#define SHORT_HDR 2
+#define DROP 3 /* drop packet or fragment */
+#define CONTROL 4 /* OR ctl field with subopt, TCP only */
+#define BAD_TYPE 5 /* bad multiplexing type: port for TCP,
+ protocol for IP */
+
+typedef struct testopt {
+ char driver; /* option for which driver: TCP/UDP, IP */
+ char option; /* option */
+ char subopt; /* suboption if applicable */
+ char type; /* next, on, off */
+ int num; /* number of packets - depends on */
+} TEST_OPT;
+
+#endif
+
+/*
+ * define structure for DARPA internet address
+ * usually use "longs" to access but sometimes need to split into
+ * components
+ */
+
+typedef union {
+ char typea[4]; /* 4 x 8 bit version */
+ short typeb[2]; /* 2 x 16 bit */
+ long typec; /* 1 x 32 bit */
+} IN_ADDRESS;
+
+/*
+ * IP Option values
+ */
+#define OPT_EOL 0
+#define OPT_NOP 1
+#define OPT_SECURITY 130
+#define OPT_LSRR 131
+#define OPT_SSRR 137
+#define OPT_RR 7
+#define OPT_STRID 136
+#define OPT_TIMESTAMP 68
+
+/*
+ * structure of pseudo-header used for communication
+ * between IP and higher level processes
+ */
+typedef struct {
+ short ps_pktid; /* id to be used in inet header */
+ short ps_status; /* indicates status of requested action */
+#define OK 0 /* status for non-ICMP packet */
+ IN_ADDRESS ps_src; /* source address */
+ IN_ADDRESS ps_dst; /* destination address */
+ unsigned short ps_txtlen; /* length of text */
+ short ps_offset; /* Fragment Offset */
+ short ps_if; /* IP Interface number */
+ unsigned char ps_prot; /* Internet protocol number */
+ char ps_df; /* Don't Fragment flag */
+ char ps_ttl; /* Time to Live flag */
+#ifdef TESTOPT
+ int test; /* testing on for this packet */
+ TEST_OPT testopt; /* options for testing */
+#endif
+#ifdef IPOPTS
+ char ps_pkt_type; /* What's this packet doing? */
+ char ps_optlen; /* Length of options (in words) */
+ char ps_tos; /* Type of service */
+ int ps_options[1]; /* Options */
+#endif
+} PSEUDO_HDR;
+
+#define SIZ_PSEUDOHDR sizeof(PSEUDO_HDR)
+
+
+/*
+ * Types of pkt_type
+ */
+
+#define PS_FROM_ME 1 /* Started here */
+#define PS_FOR_ME 2 /* Dest is this machine */
+#define PS_THRU_ME 3 /* Just passing through */
+#define PS_SS_ROUTING 4 /* Being strict source routed */
+#define PS_LS_ROUTING 5 /* Being loose source routed */
+#define PS_REPLY 6 /* response to another pkt (ie echo reply) */
+
+typedef struct ip_protq {
+ int prim_type;
+ unsigned char prot;
+} S_IP_PROTQ;
+
+/*
+ * status returned to upper layer in prot
+ */
+#define VALID 0
+#define IN_USE 1
+#define INVALID 2
+
+/*
+ * received from transport protocol when it sends a packet
+ */
+typedef struct ip_tx {
+ int prim_type;
+ short hdr_cnt;
+ short unused1; /* ensure structure is same size as S_PROT_RX */
+ BOOLEAN unused2; /* ensure structure is same size as S_PROT_RX */
+ PSEUDO_HDR uph;
+} S_IP_TX;
+
+/*
+ * sent to transport protocol when we receive a packet
+ */
+typedef struct prot_rx {
+ int prim_type;
+ IN_ADDRESS if_addr;
+ BOOLEAN is_broadcast;
+ PSEUDO_HDR uph;
+} S_PROT_RX;
+
+
+/*
+ * The ICMP_RX struct
+ */
+struct icmp_rx {
+ int prim_type;
+ IN_ADDRESS if_addr;
+ BOOLEAN is_broadcast;
+ unsigned char type;
+ unsigned char code;
+ long src;
+ long dst;
+ unsigned long misc;
+ PSEUDO_HDR uph;
+};
+
+
+/*
+ * The ICMP_TX struct
+ */
+struct icmp_tx {
+ int prim_type;
+ unsigned char type;
+ unsigned char code;
+ long src;
+ long dst;
+ unsigned long misc;
+ PSEUDO_HDR ph;
+};
+
+
+
+/*
+ * The IP_ADDRENQ struct
+ */
+
+struct ip_addrenq {
+ int prim_type; /* ENQ_LOCAL or ENQ_REMOTE */
+ char *handle; /* Place holder for TCP */
+ long addr; /* Remote address */
+ long local; /* Returned local address */
+ int error; /* Zero if OK, else errno */
+ int mss; /* Max seg size for this transfer */
+ int flags; /* See below */
+ int ifno; /* IP's interface number for this addr */
+ int broadcast; /* Set if remote address is broadcast */
+ unsigned long link_speed; /* adapter link speed in kbits/second */
+ unsigned long receive_buffer_size; /* bytes of adapter receive space */
+};
+
+
+#define ENQ_NO_KEEPALIVE 1 /* No keep-alives for this net */
+
+
+/*
+ * IP Flow control structure
+ */
+
+struct ip_flow_info {
+ int prim_type; /* IP_FLOW */
+ int index; /* IP Interface number */
+ int info; /* Blocked or unblocked */
+};
+
+/**************************************************************
+ * ICMP constants: types & codes
+ **************************************************************/
+
+#define ECHO_REPLY 0 /* echo reply */
+
+#define DEST_UNR 3 /* destination unreachable: */
+
+/* codes for DEST_UNR */
+#define NET_UNR 0 /* net unreachable */
+#define HOST_UNR 1 /* host unreachable */
+#define PROT_UNR 2 /* protocol unreachable */
+#define PORT_UNR 3 /* port unreachable */
+#define FRAG_DF 4 /* fragmentation needed + DF */
+#define SR_FAIL 5 /* source route failed */
+#define DST_NET_UNKNOWN 6 /* dest network unknown */
+#define DST_HOST_UNKNOWN 7 /* dest host unknown */
+#define SRC_HOST_ISOLATED 8 /* source host isolated */
+#define NET_PROHIBITED 9 /* communication with dest
+ network administratively
+ prohibited */
+#define HOST_PROHIBITED 10 /* communication with dest
+ host administratively
+ prohibited */
+#define NET_UNR_FOR_TOS 11 /* network unreachable
+ for type of service */
+#define HOST_UNR_FOR_TOS 12 /* host unreachable
+ for type of service */
+
+#define SRC_QUENCH 4 /* source quench */
+
+#define REDIRECT 5 /* redirect message: */
+#define NET_RE 0 /* redirect for network */
+#define HOST_RE 1 /* redirect for host */
+#define TOSN_RE 2 /* redirect for TOS/network */
+#define TOSH_RE 3 /* redirect for TOS/host */
+
+#define ICMP_ECHO 8 /* echo request */
+
+#define TIME_EXCEEDED 11 /* time exceeded: */
+#define TTL_X 0 /* time-to-live exceeded */
+#define FRAG_X 1 /* frag reassem time excluded */
+
+#define PARAMETER 12 /* parameter problem */
+#define PARAM_POINTER 0 /* pointer indicates error */
+#define PARAM_OPTION 1 /* required option missing */
+
+#define TIME_STAMP 13 /* timestamp request */
+#define STAMP_REPLY 14 /* timestamp reply */
+
+#define INFO_REQ 15 /* information request */
+#define INFO_REPLY 16 /* information reply */
+
+#define MASK_REQ 17 /* address mask request */
+#define MASK_REPLY 18 /* address mask reply */
+
+#endif /* _SYS_SNET_IP_PROTO_ */
+
diff --git a/private/inc/sys/snet/ipdl_pro.h b/private/inc/sys/snet/ipdl_pro.h
new file mode 100644
index 000000000..6c8ccb3d6
--- /dev/null
+++ b/private/inc/sys/snet/ipdl_pro.h
@@ -0,0 +1,93 @@
+#ident "@(#)ipdl_proto.h 1.7 3/18/92"
+
+/******************************************************************
+ *
+ * SpiderTCP Interface Primitives
+ *
+ * Copyright (c) 1988 Spider Systems Limited
+ *
+ * This Source Code is furnished under Licence, and may not be
+ * copied or distributed without express written agreement.
+ *
+ * All rights reserved.
+ *
+ * Written by Nick Felisiak, Ian Heavens, Peter Reid,
+ * Gavin Shearer, Mark Valentine
+ *
+ * DL_PROTO.H
+ *
+ * Datalink Streams proto primitives for TCP/IP on V.3 Streams
+ *
+ ******************************************************************/
+
+/*
+ * /redknee10/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.ipdl_proto.h
+ * @(#)ipdl_proto.h 1.7
+ *
+ * Last delta created 17:44:27 10/22/91
+ * This file extracted 09:25:54 3/18/92
+ *
+ * Modifications:
+ *
+ */
+
+#define NET_TX 3 /* send ip pkt to sub-net */
+#define BROAD_TX 15 /* send ip broadcast pkt to sub-net */
+#define SN_FRGSZ 10 /* ip request sub net frag size */
+#define IP_NETREG 11 /* ip send sub net addr to sub-net */
+#define IP_RX 7 /* ip receives from sub net */
+#define ARP_SNADDR IP_NETREG /* old, ARP specific defintion */
+#define SNMP_TRAP 1 /* trap info from lower driver */
+
+/*
+ * - IP sends data pkt to datalink module for transmission
+ */
+typedef struct net_tx {
+ int prim_type;
+ long src_inaddr;
+ long dst_inaddr;
+ short hdr_cnt;
+#ifdef EMD
+ char padding[2]; /* make sizeof(net_tx) >= sizeof(eth_tx) */
+#endif
+} S_NET_TX;
+
+/*
+ * ip receives only primitive type, data unknown to lower layer
+ */
+typedef struct ip_rx {
+ int prim_type;
+} S_IP_RX;
+
+union dl_proto {
+ int type;
+ S_NET_TX net_tx;
+};
+
+/*
+ * datalink layer registration
+ */
+typedef struct ip_dl_reg {
+ int prim_type;
+ long inaddr;
+ long subnet_mask;
+ short int_flags; /* flags to be filled in by lower module */
+} IP_DL_REG;
+
+/*
+ * the old, ARP specific interface definition
+ */
+#define arp_snaddr ip_dl_reg
+#define S_ARP_SNADDR IP_DL_REG
+
+/*
+ * datalink layer information (received after a IP_DLL_REG sent down)
+ */
+typedef struct sn_frgsz {
+ int prim_type;
+ int frgsz;
+ int opt_size;
+ short int_flags;
+ unsigned long link_speed;
+ unsigned long receive_buffer_size;
+} S_SN_FRGSZ;
diff --git a/private/inc/sys/snet/ll_ctrl.h b/private/inc/sys/snet/ll_ctrl.h
new file mode 100644
index 000000000..31eb29191
--- /dev/null
+++ b/private/inc/sys/snet/ll_ctrl.h
@@ -0,0 +1,91 @@
+/*
+ * /redknee10/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/35/s.ll_control.h
+ * @(#)ll_control.h 1.2
+ *
+ * Last delta created 15:48:28 11/18/91
+ * This file extracted 09:26:04 3/18/92
+ *
+ * Modifications:
+ *
+ * IS Oct 1991 Ported for LLC1
+ */
+
+
+/* IOCTL commands */
+#define L_SETSNID ('L'<<8 | 1) /* Set subnet identifier (use ll_snioc) */
+#define L_GETSNID ('L'<<8 | 2) /* Get subnet identifier (use ll_snioc) */
+#define L_SETTUNE ('L'<<8 | 3) /* Set tuning parameters (use ll_tnioc) */
+#define L_GETTUNE ('L'<<8 | 4) /* Get tuning parameters (use ll_tnioc) */
+#define L_GETSTATS ('L'<<8 | 5) /* Get statistics counts (use ll_stioc) */
+#define L_ZEROSTATS ('L'<<8 | 6) /* Zero statistics (use ll_hdioc) */
+
+/* Values for 'lli_type' (with names of corresponding structures) */
+#define LI_PLAIN 0x01 /* Indicates 'struct ll_hdioc' */
+#define LI_SNID 0x02 /* Indicates 'struct ll_snioc' */
+#define LI_STATS 0x04 /* Indicates 'struct ll_stioc' */
+
+
+#define LI_LLC2TUNE 0x23 /* Indicates 'struct llc2_tnioc'*/
+
+
+/* LLC1 tuning structure */
+typedef struct llc2tune {
+ uint16 Tbusy; /* Remote busy check time (unit 0.1 sec) */
+ uint16 Tidle; /* Idle P/F cycle time (unit 0.1 sec) */
+ uint16 tx_window; /* Transmit window (if no XID received) */
+ uint16 tx_probe; /* P-bit position before end of Tx window */
+ uint16 xid_window; /* XID window size (receive window) */
+ uint16 xid_Ndup; /* Duplicate MAC XID count (0 => no test) */
+ uint16 xid_Tdup; /* Duplicate MAC XID time (unit 0.1 sec) */
+} llc2tune_t;
+
+/* LLC2/LAPB stats structure */
+typedef struct ll_stats {
+ uint32 lls_txU; /* Number of 'U' frames sent */
+ uint32 lls_rxU; /* Number of good 'U' frames received */
+ uint32 lls_rxign; /* Number of frames ignored */
+ uint32 lls_rxbad; /* Number of erroneous frames received */
+ uint32 lls_rxdud; /* Number of received and discarded frames */
+} llstats_t;
+
+/* Header alone (for decoding and L_ZEROSTATS commands) */
+struct ll_hdioc {
+ uint8 lli_type; /* Table type = LI_PLAIN */
+ uint8 lli_snid; /* Subnet ID character */
+ uint16 lli_spare; /* (for alignment) */
+};
+
+/* Ioctl block for L_SETSNID and L_GETSNID commands */
+struct ll_snioc {
+ uint8 lli_type; /* Table type = LI_SNID */
+ uint8 lli_snid; /* Subnet ID character */
+ uint16 lli_spare; /* (for alignment) */
+
+ uint32 lli_index; /* Link index */
+};
+
+
+/* Ioctl block for LLC1 L_SETTUNE and L_GETTUNE commands */
+struct llc2_tnioc {
+ uint8 lli_type; /* Table type = LI_LLC2TUNE */
+ uint8 lli_snid; /* Subnet ID character ('*' => 'all') */
+ uint16 lli_spare; /* (for alignment) */
+
+ llc2tune_t llc2_tune; /* Table of tuning values */
+};
+
+/* Ioctl block for L_GETSTATS command */
+struct ll_stioc {
+ uint8 lli_type; /* Table type = LI_STATS */
+ uint8 lli_snid; /* Subnet ID character */
+ uint16 lli_spare; /* (for alignment) */
+ llstats_t lli_stats; /* Table of stats values */
+};
+
+/* Union of ioctl blocks */
+typedef union lli_union {
+ struct ll_hdioc ll_hd; /* Parameter-less command */
+ struct ll_snioc ll_sn; /* Set/get subnet identifier */
+ struct llc2_tnioc llc2_tn; /* Set/get LLC1 tuning */
+ struct ll_stioc ll_st; /* Get statistics */
+} lliun_t;
diff --git a/private/inc/sys/snet/ll_proto.h b/private/inc/sys/snet/ll_proto.h
new file mode 100644
index 000000000..3fe33b812
--- /dev/null
+++ b/private/inc/sys/snet/ll_proto.h
@@ -0,0 +1,105 @@
+
+/******************************************************************
+ *
+ * Copyright 1991 Spider Systems Limited
+ *
+ * LL_PROTO.C
+ *
+ ******************************************************************/
+/*
+ * /redknee10/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/35/s.ll_proto.h
+ * @(#)ll_proto.h 1.2
+ *
+ * Last delta created 18:43:07 1/28/92
+ * This file extracted 09:26:05 3/18/92
+ *
+#ifdef MOD_HISTORY
+ *
+ * Modifications:
+ *
+ * JS 25 Sep 90 Added LAP classes.
+ * JS 17 Oct 90 Renamed LC_LAPB as LC_LAPBDTE and LC_LAPBX
+ * as LC_LAPBXDTE.
+ * JS 21 Nov 90 Moved ll_mymacaddr field in ll_reg structure
+ * to start on 4 byte boundary.
+ * IS Oct 1991 Changed for LLC1
+#endif
+ */
+
+
+#define MAXHWLEN 6
+#define LL_MAXADDRLEN 8
+
+/* Interface structures */
+struct ll_reg {
+ uint8 ll_type;
+ uint8 ll_class;
+ uint8 ll_regstatus;
+ uint8 ll_snid;
+ uint8 ll_normalSAP;
+ uint8 ll_loopbackSAP;
+ uint8 ll_mactype; /* type of hardware interface */
+ uint8 ll_addrsize; /* size of hardware address */
+ uint16 ll_frgsz; /* max fragment size of HW */
+ uint8 ll_mymacaddr[LL_MAXADDRLEN]; /* hardware address */
+};
+
+struct ll_msg {
+ uint8 ll_type;
+ uint8 ll_command;
+ uint16 ll_connID;
+ uint32 ll_yourhandle;
+ uint32 ll_status;
+};
+
+struct ll_msgc {
+ uint8 ll_type;
+ uint8 ll_command;
+ uint16 ll_connID;
+ uint32 ll_yourhandle;
+ uint32 ll_myhandle;
+ uint16 ll_service_class;
+ uint8 ll_remsize; /* semi-octect size of remote address */
+ uint8 ll_locsize; /* semi-octect size of local address */
+ uint8 ll_route_length; /* size of routing information */
+ uint8 ll_locaddr[LL_MAXADDRLEN]; /* local address */
+ uint8 ll_remaddr[LL_MAXADDRLEN]; /* remote address */
+ uint8 ll_route_info[1]; /* optional routing info field MUST */
+ /* follow ll_remaddr field */
+};
+
+/* Values for 'll_type' */
+#define LL_REG 50
+#define LL_DAT 52
+
+/* Values for 'll_command' */
+
+#define LC_UDATA 4
+#define LC_DISC 5
+#define LC_DISCNF 6
+#define LC_RESET 7
+#define LC_RSTCNF 8
+#define LC_REPORT 9
+
+
+/* Values of 'll_class' in 'll_reg' */
+#define LC_LLC1 15
+
+/* Values in 'll_regstatus' and 'll_status' */
+#define LS_SUCCESS 1
+#define LS_RESETTING 2
+#define LS_RESETDONE 3
+#define LS_DISCONNECT 4
+#define LS_FAILED 5
+#define LS_CONFLICT 6
+#define LS_RST_FAILED 7
+#define LS_RST_REFUSED 8
+#define LS_RST_DECLINED 9
+#define LS_REM_BUSY 12
+#define LS_REM_NOT_BUSY 13
+#define LS_EXHAUSTED 14
+#define LS_SSAPINUSE 15
+#define LS_LSAPINUSE 16
+#define LS_DUPLICATED 17
+#define LS_LSAPWRONG 18
+
diff --git a/private/inc/sys/snet/nbdebug.h b/private/inc/sys/snet/nbdebug.h
new file mode 100644
index 000000000..810c9fc1a
--- /dev/null
+++ b/private/inc/sys/snet/nbdebug.h
@@ -0,0 +1,41 @@
+/*
+ * /usr/projects/spare/PBRAIN/SCCS/pbrainD/dev/src/include/sys/snet/0/s.nbdebug.h
+ * @(#)nbdebug.h 1.3
+ *
+ * Last delta created 12:37:27 3/11/91
+ * This file extracted 15:16:57 4/1/91
+ *
+ * Modifications:
+ *
+ * 6 Feb 1991 (RAE) Ported to SpiderTCP
+ */
+
+#ifndef _NBDEBUG_INCLUDED
+#define _NBDEBUG_INCLUDED
+
+extern int nbtraceflag;
+
+#define I_NBDEBUG 0x8000
+
+/* debug_cmd */
+
+#define DTRACE 1
+
+/* flags for debug_cmd DTRACE */
+
+#define D_STRM 0x0001
+#define D_DEP 0x0002
+#define D_SEP 0x0004
+#define D_SIB 0x0008
+#define D_NSRV 0x0010
+#define D_SSRV 0x0020
+#define D_DSRV 0x0040
+#define D_CTRL 0x0080
+#define D_LMH 0x0100
+
+struct nb_debug {
+ int debug_cmd;
+ int debugflag;
+};
+
+#endif // _NBDEBUG_INCLUDED
diff --git a/private/inc/sys/snet/nbt_ctrl.h b/private/inc/sys/snet/nbt_ctrl.h
new file mode 100644
index 000000000..8f78167c0
--- /dev/null
+++ b/private/inc/sys/snet/nbt_ctrl.h
@@ -0,0 +1,193 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ nbt_ctrl.h
+
+Abstract:
+
+ This file contains structure definitions for the user-level interface to
+ the NBT driver.
+
+Author:
+
+ Mike Massa (mikemas) Jan 30, 1992
+
+Revision History:
+
+ Who When What
+ -------- -------- ----------------------------------------------
+ mikemas 01-30-92 created
+
+Notes:
+
+--*/
+
+/*
+ * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.nbt_control.h
+ * @(#)nbt_control.h 1.9
+ *
+ * Last delta created 15:54:26 10/25/91
+ * This file extracted 16:49:25 12/23/91
+ *
+ * Modifications:
+ *
+ * 6 Feb 1991 (RAE) Ported to SpiderTCP
+ */
+
+#ifndef _NBT_CTRL_INCLUDED_
+#define _NBT_CTRL_INCLUDED_
+
+
+typedef unsigned short word;
+typedef unsigned char byte;
+typedef unsigned int dword;
+
+//
+// #defines for debugging reference count problems
+//
+
+#if DBG
+
+#define REFCOUNT_TRACE 1
+
+#endif
+
+#define REFCOUNT_TRACE_UNUSENAME 0
+#define REFCOUNT_TRACE_USENAME 1
+#define REFCOUNT_TRACE_FINDNAME 2
+#define REFCOUNT_TRACE_PUTNEXT 3
+#define REFCOUNT_TRACE_LINKREQ 4
+#define REFCOUNT_TRACE_ACTIVE 5
+
+#define NUM_REFCOUNT_TRACE 6
+
+/*
+ * XEB (Standard Object Block)
+ */
+
+#ifdef COMPILE_UP_TCPIP
+
+typedef struct xeb {
+ struct msgb *msg; /* the allocated stream msg */
+ char blockname[4]; /* Debug name information */
+ struct xeb *dnlink; /* Debug link to next block) */
+ struct xeb *dplink; /* Debug link to previous block */
+ struct xeb *nlink; /* link to next block) */
+ struct xeb *plink; /* link to previous block */
+ struct queue *uqptrRD;
+ struct queue *uqptrWR;
+ struct queue *lqptrRD;
+ struct queue *lqptrWR;
+ int state;
+ int (*init_object)(); /* init_object procedure */
+ void (*in_object)(); /* in_object procedure */
+ int (*out_object)(); /* out_object procedure */
+ int (*close_object)(); /* close_object procedure */
+ int (*test_resource)(); /* procedure, test buf resources */
+ int bufcall_flag; /* object wait on buf resources */
+ struct xeb *nmptr; /* pointer to bound name */
+ struct msgb *work_q; /* queue of work to do */
+} XEB;
+
+#else /* COMPILE_UP_TCPIP */
+
+typedef struct xeb {
+ struct msgb **msg; /* the allocated stream msg */
+ char blockname[4]; /* Debug name information */
+ struct xeb *nlink; /* link to next block) */
+ struct xeb *plink; /* link to previous block */
+ struct queue *uqptrRD;
+ struct queue *uqptrWR;
+ struct queue *lqptrRD;
+ struct queue *lqptrWR;
+ int state;
+ int ref_count; /* reference count for the object */
+ /* each pending operation references the */
+ /* object and the completion deref's it */
+ /* when the ref count goes to zero, the */
+ /* object can be safely closed */
+#ifdef REFCOUNT_TRACE
+ int trace_count[NUM_REFCOUNT_TRACE];
+ /* each type of reference has a trace entry */
+ /* when a reference is made, it is made with */
+ /* a reference type that is incremented for */
+ /* the entry */
+ int FindNamesAdded; /* number of findname requests added to the */
+ /* FASTTIMQ for this xeb */
+ int FindNamesRemoved; /* number of findname requests taken from the */
+ /* FASTTIMQ for this xeb */
+#endif
+ KEVENT close_event; /* This event is signalled when the ref count */
+ /* goes to zero. It is waited on in nbtclose */
+ int (*init_object)(); /* init_object procedure */
+ void (*in_object)(); /* in_object procedure */
+ int (*out_object)(); /* out_object procedure */
+ int (*close_object)(); /* close_object procedure */
+ int (*test_resource)(); /* procedure, test buf resources */
+ int spl; /* level at which per xeb lock was acquired */
+ struct msgb *work_q; /* work to do queue for deferred actions */
+ int bufcall_flag; /* object wait on buf resources */
+ struct xeb *nmptr; /* pointer to bound name */
+} XEB;
+
+#endif /* COMPILE_UP_TCPIP */
+
+
+typedef struct linkreq {
+ unsigned int primtype;
+ XEB *xeb;
+ struct queue *toq; /* who have asked */
+ struct queue *l_qbot;
+ int l_index;
+ struct msgb * mconind; /* msg pointer to message which have started */
+ /* this request */
+} LINKREQ;
+
+
+
+typedef struct confreq {
+ unsigned int primtype;
+
+ /* General */
+
+ unsigned char this_scope[240]; /* SCOPE_ID */
+ unsigned char name[17]; /* permanent nb name */
+ unsigned long broadcast_inaddr; /* ip broadcast addr */
+ unsigned long subnet_mask; /* subnet mask for the ip addr */
+ unsigned long this_inaddr; /* ip addr for the nbt */
+ unsigned short bcast_req_retry_timeout; /* 250 ms */
+ unsigned short bcast_req_retry_count; /* 3 */
+
+ /* Name service */
+
+ unsigned short conflict_timer; /* 1000 ms */
+ unsigned short namesrv_udpport; /* 137 */
+
+ /* Session service */
+
+ unsigned short sessionsrv_tcpport; /* 139 */
+ unsigned short ssn_retry_count; /* 4 */
+ unsigned short ssn_close_timeout; /* 30 sek */
+ unsigned short ssn_keep_alive_timeout; /* 60 sek */
+
+ /* Datagram service */
+
+ unsigned short datagramsrv_udpport; /* 138 */
+ unsigned short dgr_frag_timeout; /* 2 sec */
+} CONFREQ;
+
+
+#define CONF_REQ 3001
+#define NBT_LINK_REQ 3016
+#define NBT_LINK_ACK 3017
+#define NBT_LINK_NACK 3018
+#define NBT_UNLINK_REQ 3019
+#define NBT_UNLINK_ACK 3020
+#define NBT_UNLINK_NACK 3021
+
+
+#endif // _NBT_CTRL_INCLUDED_
+
diff --git a/private/inc/sys/snet/nbt_stat.h b/private/inc/sys/snet/nbt_stat.h
new file mode 100644
index 000000000..a54e92204
--- /dev/null
+++ b/private/inc/sys/snet/nbt_stat.h
@@ -0,0 +1,129 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ nbt_stat.h
+
+Abstract:
+
+ This file contains statistics structure declarations for the user-
+ level interface to the NBT driver.
+
+Author:
+
+ Mike Massa (mikemas) Jan 30, 1992
+
+Revision History:
+
+ Who When What
+ -------- -------- ----------------------------------------------
+ mikemas 01-30-92 created
+
+Notes:
+
+--*/
+
+/*
+ * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.nbt_stat.h
+ * @(#)nbt_stat.h 1.2
+ *
+ * Last delta created 14:05:19 10/2/91
+ * This file extracted 16:49:25 12/23/91
+ *
+ * Modifications:
+ *
+ * 6 Feb 1991 (RAE) Ported to SpiderTCP
+ */
+
+#ifndef _NBT_STAT_INCLUDED_
+#define _NBT_STAT_INCLUDED_
+
+#define MAX_XEB 32 /* max. no. of xebinfos in a message */
+
+/* structure passed/returned in NBT_STAT/NBT_NAME ioctl command */
+struct nbt_stat
+{
+ int xeb_count;
+ char perm_name[17]; /* Permanent name of node */
+ char scope_id[240]; /* Scope identifier of node */
+};
+
+
+#define NBT_XEBINFO 1 /* primtype of nbt_xebinfo struct */
+#define NBT_NAMEINFO 2 /* primtype of nbt_nameinfo struct */
+#define NBT_CACHEINFO 3 /* primtype of nbt_cacheinfo struct */
+
+struct nbt_info {
+ int prim_type; /* NBT_XEBINFO or _NAMEINFO or _CACHEINFO */
+ int count; /* number of entries in message */
+};
+
+/*
+ * Per-Endpoint (XEB) Data.
+ */
+struct xebinfo
+{
+ long addr; /* XEB address */
+ char type[4]; /* type of XEB */
+ int xeb_state; /* internal xeb state */
+ char local_name[17]; /* NetBIOS name of endpoint */
+ char remote_name[17]; /* NetBIOS name of endpoint */
+ int dev; /* minor device number of endpoint */
+ unsigned int in_data; /* received data bytes to endpoint */
+ unsigned int out_data; /* transmitted data bytes from endpoint */
+};
+
+/*
+ * Name Data.
+ */
+struct nameinfo
+{
+ long addr; /* NEB address */
+ int type; /* type of name */
+ int status; /* name status */
+ char name[17]; /* NetBIOS name of endpoint */
+};
+
+/*
+ * Cache Data.
+ */
+struct cacheinfo
+{
+ long addr; /* CACHE_ELEM address */
+ unsigned int type; /* type of name */
+ unsigned char name[17]; /* NetBIOS name */
+ unsigned long ip_addr; /* Internet Address of name */
+ unsigned int ttl; /* Time To Live */
+};
+
+
+/*
+ * Ioctl(2) commands for NetBIOS Device.
+ */
+#define NBT_STAT ('B'<<8|1) /* generic status gathering */
+#define NBT_RESET ('B'<<8|2) /* generic status reset */
+#define NBT_NAME ('B'<<8|3) /* generic name gathering */
+#define NBT_CACHE ('B'<<8|4) /* generic cache gathering */
+#define NBT_RESYNC ('B'<<8|5) /* reread the lmhosts file */
+
+
+/*
+ * Name types and status
+ */
+#define UNIQUE 0x0000
+#define GROUP 0x8000
+
+
+#define INFINITE_TTL ((unsigned int) -1)/* CACHE_ELEM.timeout, cacheinfo.ttl */
+
+
+#define CONFLICT 1
+#define REGISTERING 2
+#define DEREGISTERING 3
+#define REGISTERED 4
+
+
+#endif // _NBT_STAT_INCLUDED_
+
diff --git a/private/inc/sys/snet/nbtuser.h b/private/inc/sys/snet/nbtuser.h
new file mode 100644
index 000000000..90e88fb7e
--- /dev/null
+++ b/private/inc/sys/snet/nbtuser.h
@@ -0,0 +1,43 @@
+/*
+ * /usr/projects/spare/PBRAIN/SCCS/pbrainD/dev/src/include/sys/snet/0/s.nbtuser.h
+ * @(#)nbtuser.h 1.3
+ *
+ * Last delta created 14:57:27 2/22/91
+ * This file extracted 15:16:56 4/1/91
+ *
+ * Modifications:
+ *
+ * 6 Feb 1991 (RAE) Ported to SpiderTCP
+ */
+
+/*
+ * NetBIOS specific error codes
+ */
+#define PROTO_SESSIONCLOSED 1
+#define PROTO_SESSIONABORTED 2
+#define ENAMEUNR 3
+
+/* Netbios interface definitions */
+
+/* nbt open types */
+#define O_CLTS 0x4000 /* flag used in open to specify a
+ * connectionless transport endpoint */
+
+//#define TLI_NBT "/dev/nbt"
+
+/* Netbios names */
+#define NBNAMSZ 16
+#define MAXNBDG 512 /* maximum datagram size */
+#define NBUNIQUENM 0x00 /* unique name flag, nb_type */
+#define NBGROUPNM 0x01 /* group name flag, nb_type */
+#define NBBROADCAST 0x40 /* broadcast flag, nb_type */
+
+struct nbaddr {
+ USHORT nb_type; /* name type: group, unique */
+ UCHAR nb_name[NBNAMSZ];
+// char nb_res; /* reserved, unused */
+};
+
+/* Length's are passed as ioctl's: */
+#define NBSTR ('N'<<8)
+#define NBIOCTL_TSDUSZ (NBSTR|0x1)
diff --git a/private/inc/sys/snet/net_stat.h b/private/inc/sys/snet/net_stat.h
new file mode 100644
index 000000000..c9f46d507
--- /dev/null
+++ b/private/inc/sys/snet/net_stat.h
@@ -0,0 +1,159 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ net_stat.h
+
+Abstract:
+
+ This file defines the IOCTL interface to the TCP/IP drivers used by
+ the netstat program.
+
+Author:
+
+ Mike Massa (mikemas) Jan 31, 1992
+
+Revision History:
+
+ Who When What
+ -------- -------- ----------------------------------------------
+ mikemas 01-31-92 created
+
+Notes:
+
+--*/
+
+/*
+ * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.net_stat.h
+ * @(#)net_stat.h 1.9
+ *
+ * Last delta created 12:04:31 3/6/90
+ * This file extracted 16:49:18 12/23/91
+ *
+ * MV 08/06/88 Mods for Generic Ethernet Driver (GENERICE).
+ *
+ * MV 18/07/88 To get over limits on STREAMS ioctl size, we now
+ * get connection information send up in separate
+ * messages, with the number of connections to expect
+ * passed up (along with protocol stats) in the initial
+ * ioctl.
+ */
+
+/*
+ * TCP statistics.
+ */
+
+struct tcp_stat
+{
+ long net; /* net to get stats on, 0L -> all nets */
+
+ /* protocol statistics */
+ int tcp_small; /* incomplete headers */
+ int tcp_cksum; /* header checksum errors */
+
+ /* connection information */
+ int tcp_conns; /* number of active TCBs */
+};
+
+#define MAX_TCB 32 /* max. no. of tcp_conns in a message */
+
+/*
+ * Per-Connection (TCB) Data.
+ */
+
+struct tcp_conn
+{
+ long tcp_addr; /* TCB address */
+ int tcp_rcvq; /* packets on receive queue */
+ int tcp_sndq; /* packets on send queue */
+ long tcp_laddr; /* local address */
+ long tcp_faddr; /* foreign address */
+ short tcp_lport; /* local port */
+ short tcp_fport; /* foreign port */
+ int tcp_state; /* connection state */
+};
+
+/* possible values for tcp_state */
+
+#define CLOSED 0 /* connection not in use */
+#define LISTEN 1 /* listening for requests */
+#define SYN_SEND 2 /* sent SYN, awaiting ACK */
+#define SYN_RECV 3 /* received SYN, not ACKed */
+#define ESTABLISHED 4 /* connection established */
+#define FIN_WAIT_1 5 /* sent FIN, awaiting ACK */
+#define FIN_WAIT_2 6 /* sent FIN, got ACK not FIN */
+#define CLOSE_WAIT 7 /* received FIN, not ACKed */
+#define LAST_ACK 8 /* waiting for final ACK */
+
+/*
+ * UDP statistics.
+ */
+
+struct udp_stat
+{
+ long net; /* net to get stats on, 0L -> all nets */
+
+ /* protocol statistics */
+ int udp_small; /* packets smaller than minimum */
+ int udp_cksum; /* header checksum errors */
+ int udp_header; /* bad data length fields */
+
+ /* connection information */
+ int udp_conns; /* number of active UCBs */
+};
+
+#define MAX_UCB 32 /* max. no. of udp_conns in a message */
+
+/*
+ * Per-Connection (UCB) Data.
+ */
+
+struct udp_conn
+{
+ long udp_addr; /* UCB address */
+ int udp_rcvq; /* packets on receive queue */
+ int udp_sndq; /* packets on send queue */
+ long udp_laddr; /* local address */
+ int udp_lport; /* local port */
+ long udp_faddr; /* foreign address */
+ int udp_fport; /* foreign port */
+};
+
+/*
+ * IP statistics
+ */
+
+struct ip_stat
+{
+ long net; /* net to get stats on, 0L -> all nets */
+
+ int ip_small; /* packets smaller than minimum */
+ int ip_cksum; /* header checksum errors */
+ int ip_header; /* bad data length fields */
+};
+
+#ifndef GENERICE
+/*
+ * Ethernet statistics
+ */
+
+struct eth_stat
+{
+ long eth_tx; /* packets transmitted */
+ long eth_rx; /* packets received */
+ long eth_lost; /* packets discarded */
+ int eth_crc; /* CRC error packets */
+ int eth_align; /* alignment error packets */
+ int eth_res; /* 82586 resource errors */
+ int eth_over; /* overrun error packets */
+};
+#endif /*~GENERICE*/
+
+/*
+ * Ioctl(2) commands for Network Devices.
+ */
+
+#define NET_STAT ('N'<<8|1) /* generic statistics gathering */
+#define NET_RESET ('N'<<8|2) /* generic statistics reset */
diff --git a/private/inc/sys/snet/s_socket.h b/private/inc/sys/snet/s_socket.h
new file mode 100644
index 000000000..a91e293c4
--- /dev/null
+++ b/private/inc/sys/snet/s_socket.h
@@ -0,0 +1,105 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ s_socket.h
+
+Abstract:
+
+ This module contains socket definitions for STREAMS TCP/IP sockets.
+
+Author:
+
+ Eric Chin (ericc) July 18, 1991
+
+Revision History:
+
+--*/
+
+/******************************************************************
+ *
+ * S-TCP Socket Library
+ *
+ * Copyright 1987 Spider Systems Limited
+ *
+ * S_SOCKET.H
+ *
+ * Contains socket definitions for SpiderTCP In-kernel socket
+ * code
+ *
+ *
+ ******************************************************************/
+
+/*
+ * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.s_socket.h
+ * @(#)s_socket.h 1.4
+ *
+ * Last delta created 15:05:38 6/20/89
+ * This file extracted 08:53:44 7/10/91
+ *
+ * Modifications:
+ *
+ * NCF 00/00/00 Written
+ *
+ * PR 01/12/87 Integrated into Admin System II, all
+ * projects
+ */
+
+
+#ifndef _SYS_SNET_S_SOCKET_
+#define _SYS_SNET_S_SOCKET_
+
+
+/*
+ * IOCTL types
+ */
+#define SO_IOCTL 'S'<<8
+#define SO_ACCEPT (SO_IOCTL | 'a')
+#define SO_BIND (SO_IOCTL | 'b')
+#define SO_CONNECT (SO_IOCTL | 'c')
+#define SO_GETPEER (SO_IOCTL | 'p')
+#define SO_GETSOCK (SO_IOCTL | 'h')
+#define SO_GETSOPT (SO_IOCTL | 'o')
+#define SO_SETSOPT (SO_IOCTL | 't')
+#define SO_LISTEN (SO_IOCTL | 'l')
+#define SO_SHUTDOWN (SO_IOCTL | 'x')
+
+
+/*
+ * Message types
+ */
+#define SO_DO_ACCEPT (SO_IOCTL | 'A')
+#define SO_EXRCV (SO_IOCTL | 'U')
+#define SO_EXSEND (SO_IOCTL | 'X')
+#define SO_RECV (SO_IOCTL | 'r')
+#define SO_RECVFROM (SO_IOCTL | 'R')
+#define SO_SEND (SO_IOCTL | 's')
+#define SO_SENDTO (SO_IOCTL | 'S')
+
+/*
+ * Socket options structure
+ */
+struct s_sockopt {
+ int level;
+ int optnam;
+ int optval; /* May be extended */
+};
+
+struct s_ctlhdr {
+ long prim_type;
+ int addrlen;
+ char addr[32];
+};
+
+/*
+ * Socket SO_DO_ACCEPT structure
+ */
+struct acc_str {
+ int type;
+ int pad;
+ int *ptr;
+};
+
+#endif /* _SYS_SNET_S_SOCKET_ */
diff --git a/private/inc/sys/snet/snmp.h b/private/inc/sys/snet/snmp.h
new file mode 100644
index 000000000..b903daea7
--- /dev/null
+++ b/private/inc/sys/snet/snmp.h
@@ -0,0 +1,132 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ snmp.h
+
+Abstract:
+
+ This module contains SNMP definitions for STREAMS TCP/IP drivers.
+
+Author:
+
+ Eric Chin (ericc) July 18, 1991
+
+Revision History:
+
+--*/
+
+/*************************************************************************
+ *
+ * SpiderSNMP
+ *
+ * Copyright 1990 Spider Systems Limited
+ *
+ * SNMP.H
+ *
+ * Daemon/kernel interface
+ *
+ *
+ *************************************************************************/
+
+/*
+ * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.snmp.h
+ * @(#)snmp.h 1.1
+ *
+ * Last delta created 10:15:32 3/1/90
+ * This file extracted 08:53:47 7/10/91
+ *
+ * Modifications:
+ *
+ * GSS 01/03/90 put in Pbrain
+ */
+
+#ifndef _SYS_SNET_SNMP_
+#define _SYS_SNET_SNMP_
+
+
+/*
+ * Values for the 'ic_cmd' field of I_STR ioctls.
+ * These indicate the request to be performed.
+ * These should be ored with the constants below, which specify
+ * the variables on which the request should be performed.
+ */
+
+#define SNMPIOC ('M' << 8)
+
+#define SNMP_GET_REQ (SNMPIOC | (0 << 5))
+#define SNMP_GETNEXT_REQ (SNMPIOC | (1 << 5))
+#define SNMP_SET_REQ (SNMPIOC | (3 << 5))
+
+#define SNMP_REQ_MASK (SNMPIOC | (7 << 5))
+
+/*
+ * Values for the 'ic_cmd' field of I_STR ioctls.
+ * These indicate the variables to be affected.
+ * These should be ored with the constants above, which specify
+ * the type of request.
+ */
+
+#define SNMP_IF 0
+#define SNMP_IFENTRY 1
+#define SNMP_ATENTRY 2
+#define SNMP_IP 3
+#define SNMP_IPADDRENTRY 4
+#define SNMP_IPROUTEENTRY 5
+#define SNMP_ICMP 6
+#define SNMP_TCP 7
+#define SNMP_TCPCONNENTRY 8
+#define SNMP_UDP 9
+#define SNMP_UDPENTRY 10
+
+#define SNMP_VAR_MASK 31
+
+/*
+ * Values for the 'ic_cmd' field of I_STR ioctls.
+ * This indicates that an SNMP control message
+ * is being sent.
+ */
+
+#define SNMP_CONTROL (SNMPIOC | (7 << 5) | 0)
+
+/*
+ * init structure for SNMP
+ */
+
+struct snmp_init
+{
+ uint8 prim_type;
+ u_long since;
+};
+
+#define SNMP_INIT 1
+
+/*
+ * trap structure for SNMP;
+ * currently this is only used between drivers
+ */
+
+struct snmp_trap
+{
+ int prim_type;
+ long generic_trap;
+ long specific_trap;
+ int info_len; /* length of info in bytes */
+ char info[1]; /* "interesting" information */
+};
+
+/*
+ * values for "generic_trap"
+ */
+
+#define SNMP_TRAP_ENTSPEC 6
+
+/*
+ * values for "specific_trap" are the same as the interface status field
+ * i.e. up(1), down(2), testing(3).
+ */
+
+#endif /* _SYS_SNET_SNMP_ */
+
diff --git a/private/inc/sys/snet/stcp_opt.h b/private/inc/sys/snet/stcp_opt.h
new file mode 100644
index 000000000..42f5c859a
--- /dev/null
+++ b/private/inc/sys/snet/stcp_opt.h
@@ -0,0 +1,87 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ stcp_opt.h
+
+Abstract:
+
+ This module contains TCP/IP user options definitions for STREAMS TCP/IP.
+
+Author:
+
+ Eric Chin (ericc) July 18, 1991
+
+Revision History:
+
+--*/
+
+/******************************************************************
+ *
+ * SpiderTCP Application Definitions
+ *
+ * Copyright 1987 Spider Systems Limited
+ *
+ * STCP_OPT.H
+ *
+ * User options for TCP/IP on V.3 Streams
+ *
+ * PR@Spider /\oo/\
+ *
+ ******************************************************************/
+
+/*
+ * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.stcp_opt.h
+ * @(#)stcp_opt.h 1.9
+ *
+ * Last delta created 19:24:09 2/21/90
+ * This file extracted 08:53:45 7/10/91
+ *
+ * Modifications:
+ *
+ * PR 01/12/87 Integrated into Admin System II, all
+ * projects
+ */
+
+#ifndef _SYS_SNET_STCP_OPT_
+#define _SYS_SNET_STCP_OPT_
+
+
+/*
+ * TCP Top level option. These may be or'ed together in
+ * the option word. opt_level should be set to TOL_TLI
+ * to set these parameters
+ */
+
+#define TOL_TLI 0xffff
+
+#define TO_NO_OPTS 0x0000
+#define TO_REUSE_ADDR 0x0001
+#define TO_KEEPALIVE 0x0004
+#define TO_DEBUG 0x0002
+#define TO_LINGER 0x0008
+#define TO_RDWR 0x0010
+#define TO_NODELAY 0x0020
+
+#ifdef TESTOPT
+#define TO_TESTOPT 0x0040
+#endif
+
+#define TOL_RCVBUF 0x0001
+
+/*
+ * TCP/IP Option struct for use with the T_OPTMGMT
+ * function.
+ */
+
+typedef struct tcp_opt {
+ int opt_level;
+ int opt_name;
+ int opt_data[1];
+
+} TOPT;
+
+#endif /* _SYS_SNET_STCP_OPT_ */
+
diff --git a/private/inc/sys/snet/tcp_ctrl.h b/private/inc/sys/snet/tcp_ctrl.h
new file mode 100644
index 000000000..ef99e3424
--- /dev/null
+++ b/private/inc/sys/snet/tcp_ctrl.h
@@ -0,0 +1,78 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ tcp_ctrl.h
+
+Abstract:
+
+ TCP interface declarations.
+
+Author:
+
+ Mike Massa (mikemas) Jan 30, 1992
+
+Revision History:
+
+ Who When What
+ -------- -------- ----------------------------------------------
+ mikemas 01-30-92 created
+
+Notes:
+
+--*/
+
+/******************************************************************
+ *
+ * SpiderTCP Interface Primitives
+ *
+ * Copyright (c) 1988 Spider Systems Limited
+ *
+ * This Source Code is furnished under Licence, and may not be
+ * copied or distributed without express written agreement.
+ *
+ * All rights reserved.
+ *
+ * Written by Nick Felisiak, Ian Heavens, Peter Reid,
+ * Gavin Shearer, Mark Valentine
+ *
+ * TCP_CONTROL.H
+ *
+ * TCP Streams ioctl primitives for TCP/IP on V.3 Streams
+ *
+ ******************************************************************/
+
+/*
+ * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.tcp_control.h
+ * @(#)tcp_control.h 1.4
+ *
+ * Last delta created 11:56:46 11/1/91
+ * This file extracted 16:49:20 12/23/91
+ *
+ * Modifications:
+ *
+ * 20/07/88 MV Added tcp_proto to hold tcp_pcbinfo.
+ */
+
+#ifndef _SYS_SNET_TCP_CTRL_INCLUDED
+#define _SYS_SNET_TCP_CTRL_INCLUDED
+
+
+struct tcp_pcbinfo {
+ int prim_type;
+ int tcbcount;
+};
+
+typedef union tcp_proto {
+ int type;
+ struct tcp_pcbinfo pcbinfo;
+} S_TCP_PROTO;
+
+#define TCP_PCBINFO 1
+#define TCP_TCBINFO 2
+
+
+#endif // _SYS_SNET_TCP_CTRL_INCLUDED
+
diff --git a/private/inc/sys/snet/tftp.h b/private/inc/sys/snet/tftp.h
new file mode 100644
index 000000000..a9e96fcd7
--- /dev/null
+++ b/private/inc/sys/snet/tftp.h
@@ -0,0 +1,203 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ tftp.h
+
+Abstract:
+
+ Definitions for the tftp program.
+
+Author:
+
+ Mike Massa (mikemas) Jan 31, 1992
+
+Revision History:
+
+ Who When What
+ -------- -------- ----------------------------------------------
+ mikemas 01-31-92 created
+
+Notes:
+
+--*/
+
+/******************************************************************
+ *
+ * SpiderTCP Socket Utilities
+ *
+ * Copyright 1988 Spider Systems Limited
+ *
+ * TFTP.H
+ *
+ * Tftp and tftpd includes
+ *
+ * CN_RQ, CN_LSTN, CN_RCV, CN_WAIT, CN_MKWRT, STRSAVE, UDP_ALLOC
+ * CN_ACK, LOGPKT, CN_SWAB, CN_CLOSE, CN_SEND, CN_RCVF, CN_ERR
+ * CN_LOG, CN_INFORM, TST_AND_CLR
+ *
+ *
+ ******************************************************************/
+
+/*
+ * /usr/projects/tcp/SCCS.rel3/rel/src/include/sys/snet/0/s.tftp.h
+ * @(#)tftp.h 5.3
+ *
+ * Last delta created 14:07:57 3/4/91
+ * This file extracted 11:19:46 3/8/91
+ *
+ * Modifications:
+ *
+ * GSS 12/04/88 Integrated into Admin System II, all
+ * projects
+ */
+
+/* This file contains the definitions for the TFTP connection control
+ * block, which contains all the information pertaining to a connection.
+ * A conn structure is allocated at connection open time and retained
+ * until the connection is closed. The routines in the file conn.c
+ * are sufficient for dealing with connections.
+ * It also contains the structure definition for tftp packets.
+ */
+
+
+/* A connection control block */
+
+struct conn {
+ SOCKET netfd; /* network file descriptor */
+ int type; /* user or server connection */
+ int synced; /* conn synchronized flag */
+ unsigned int block_num; /* next block number */
+ char * last_sent; /* previous packet sent */
+ int last_len; /* size of previous packet */
+ time_t nxt_retrans; /* when to retransmit */
+ int retrans; /* number of retransmits */
+ int timeout; /* retransmit timeout */
+ char * cur_pkt; /* current packet (send or rcv) */
+ int cur_len; /* current packet len */
+ char * last_rcv; /* last received packet */
+ int rcv_len; /* size of last rcvd. packet */
+ char *file; /* file name */
+ int dir; /* direction */
+ int mode; /* transfer mode */
+ char *c_mode; /* char. string mode */
+ struct in_addr fhost; /* foreign host */
+ int fport; /* foreign port for connection */
+ int lport; /* local port for connection */
+ int intrace; /* input packet trace flag */
+ int outtrace; /* output packet trace flag */
+ int logging; /* connection logging flag */
+};
+
+/* connection constants */
+
+#define TIMEOUT 1 /* initial retransmit timeout */
+#define INITTIMEOUT 1 /* initial connection timeout */
+#define MAX_TIMEOUT 30 /* max. retransmit timeout */
+#define MAX_RETRANS 5 /* max. no. of retransmits */
+#define DAEMON 0 /* a daemon connection */
+#define USER 1 /* a user connection */
+#define TMO 0 /* retransmitting due to timeout */
+#define DUP 1 /* retransmitting due to duplicate */
+
+#define DATALEN 512 /* size of data portion of tftp pkt */
+
+/* tftp packet structure */
+
+struct tftp {
+ unsigned short fp_opcode; /* header */
+ unsigned short fp_blkno; /* Block number */
+ char fp_blk[DATALEN];/* Data */
+};
+
+/* values for fp_opcode */
+
+#define RRQ 1 /* Read Request */
+#define WRQ 2 /* Write Request */
+#define DATA 3 /* Data block */
+#define DACK 4 /* Data Acknowledge */
+#define ERROR 5 /* Error */
+
+/* values for error codes in ERROR packets */
+
+#define TEUNDEF 0 /* Not defined, see message (if any) */
+#define TEFNF 1 /* File not found */
+#define TEACESS 2 /* Access violation */
+#define TEFULL 3 /* Disc full or allocation exceeded */
+#define TETFTP 4 /* Illegal TFTP operation */
+#define TETID 5 /* Unknown transfer ID */
+
+/* Random constants */
+
+#define TFTPLEN sizeof(struct tftp) /* max inet packet size */
+
+#define READ RRQ /* read requested */
+#define WRITE WRQ /* write requested */
+
+#define NETASCII 0 /* netascii transfer mode */
+#define IMAGE 1 /* image transfer mode */
+
+#define INPKT 0 /* input packet */
+#define OUTPKT 1 /* output packet */
+
+#define TRUE 1
+#define FALSE 0
+
+/* extern declarations */
+
+
+#include <stdio.h>
+
+extern struct conn *cn_rq();
+extern struct conn *cn_lstn();
+extern struct tftp *cn_rcv();
+extern struct tftp *cn_mkwrt();
+extern void cn_ack();
+extern void logpkt();
+extern void cn_swab();
+extern void cn_close();
+extern void cn_send();
+extern void cn_rcvf();
+extern void _CRTAPI2 cn_log(const char *, int, ...);
+extern void _CRTAPI2 cn_inform(const char *, ...);
+extern void cn_err (register struct conn *, struct in_addr,
+ int, int, char *);
+extern char *strsave();
+extern char tst_and_clr();
+extern char * udp_alloc();
+
+struct tftp *
+cn_wait(
+ struct conn *cn,
+ unsigned short opcode);
+
+int
+cn_parse(
+ struct conn *,
+ struct in_addr,
+ int,
+ char *,
+ int);
+
+int
+cn_retrans(
+ struct conn *,
+ int
+ );
+
+int
+cn_wrt(
+ struct conn *,
+ int);
+
+int
+cn_wrtf(
+ struct conn *);
+
+int
+do_cmd(
+ struct conn *);
+
+
diff --git a/private/inc/sys/snet/timer.h b/private/inc/sys/snet/timer.h
new file mode 100644
index 000000000..f8868d1d1
--- /dev/null
+++ b/private/inc/sys/snet/timer.h
@@ -0,0 +1,41 @@
+
+
+/********************************************************/
+/* */
+/* /redknee10/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.timer.h */
+/* @(#)timer.h 1.2 */
+/* */
+/* Copyright (c) 1991 Spider Systems Limited */
+/* */
+/* TIMER.H - Multiple timer module heade */
+/* */
+/* Last delta created 12:22:12 3/12/91 */
+/* This file extracted 09:26:06 3/18/92 */
+/* */
+/* Modifications: */
+/* */
+/* */
+/********************************************************/
+
+
+/* Lock out clock ISR */
+#define splclock() splhi()
+
+/* Timers header, used to process expiries */
+typedef struct thead
+{
+ void (*th_expfunc)();
+ void * th_exparg;
+ struct timer *th_expired;
+} thead_t;
+
+/* Individual timer */
+typedef struct timer
+{
+ unsigned char tm_id;
+ unsigned char tm_offset;
+ unsigned short tm_left;
+ struct timer *tm_next;
+ struct timer **tm_back;
+} timer_t;
+
diff --git a/private/inc/sys/snet/udp_ctrl.h b/private/inc/sys/snet/udp_ctrl.h
new file mode 100644
index 000000000..ad4c16906
--- /dev/null
+++ b/private/inc/sys/snet/udp_ctrl.h
@@ -0,0 +1,77 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ udp_ctrl.h
+
+Abstract:
+
+ UDP interface declarations
+
+Author:
+
+ Mike Massa (mikemas) Jan 30, 1992
+
+Revision History:
+
+ Who When What
+ -------- -------- ----------------------------------------------
+ mikemas 01-30-92 created
+
+Notes:
+
+--*/
+
+/******************************************************************
+ *
+ * SpiderTCP Interface Primitives
+ *
+ * Copyright (c) 1988 Spider Systems Limited
+ *
+ * This Source Code is furnished under Licence, and may not be
+ * copied or distributed without express written agreement.
+ *
+ * All rights reserved.
+ *
+ * Written by Nick Felisiak, Ian Heavens, Peter Reid,
+ * Gavin Shearer, Mark Valentine
+ *
+ * UDP_CONTROL.H
+ *
+ * UDP Streams ioctl primitives for TCP/IP on V.3 Streams
+ *
+ ******************************************************************/
+
+
+/*
+ * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.udp_control.h
+ * @(#)udp_control.h 1.1
+ *
+ * Last delta created 16:21:22 1/16/89
+ * This file extracted 16:49:20 12/23/91
+ *
+ * Modifications:
+ *
+ * 20/07/88 MV New file for netstat protocol message.
+ */
+
+#ifndef _SYS_SNET_UDP_CTRL_INCLUDED
+#define _SYS_SNET_UDP_CTRL_INCLUDED
+
+
+struct udp_pcbinfo {
+ int prim_type;
+ int ucbcount;
+};
+
+typedef union udp_proto {
+ int type;
+ struct udp_pcbinfo pcbinfo;
+} S_UDP_PROTO;
+
+#define UDP_PCBINFO 1
+
+#endif // _SYS_SNET_UDP_CTRL_INCLUDED
+
diff --git a/private/inc/sys/snet/uint.h b/private/inc/sys/snet/uint.h
new file mode 100644
index 000000000..013292254
--- /dev/null
+++ b/private/inc/sys/snet/uint.h
@@ -0,0 +1,63 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ uint.h
+
+Abstract:
+
+ This file contains type definitions used by STREAMS drivers.
+
+Author:
+
+ Eric Chin (ericc) July 18, 1991
+
+Revision History:
+
+--*/
+
+
+/******************************************************************
+ *
+ * Copyright 1991 Spider Systems Limited
+ *
+ * UINT.H
+ *
+ ******************************************************************/
+
+/*
+ * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.uint.h
+ * @(#)uint.h 1.2
+ *
+ * UINT.H
+ *
+ * Last delta created 12:22:31 3/12/91
+ * This file extracted 08:53:39 7/10/91
+ *
+#ifdef MOD_HISTORY
+ *
+ * Modifications:
+ *
+ * JS 14 Jan 91 Added signed types.
+#endif
+ */
+
+#ifndef _SYS_SNET_UINT_
+#define _SYS_SNET_UINT_
+
+
+/*
+ * Fixed-length types
+ */
+
+typedef unsigned char uint8;
+typedef unsigned short uint16;
+typedef unsigned long uint32;
+
+typedef char int8;
+typedef short int16;
+typedef long int32;
+
+#endif /* _SYS_SNET_UINT_ */
diff --git a/private/inc/sys/stropts.h b/private/inc/sys/stropts.h
new file mode 100644
index 000000000..12ab512f3
--- /dev/null
+++ b/private/inc/sys/stropts.h
@@ -0,0 +1,236 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ stropts.h
+
+Abstract:
+
+ This module defines the STREAMS ioctl message interface.
+
+Author:
+
+ Eric Chin (ericc) July 18, 1991
+
+Revision History:
+
+--*/
+
+/*
+ * Streams ioctl message interface
+ *
+ * @(#)stropts.h 1.19 (Spider) 91/11/27
+ */
+
+#ifndef _SYS_STROPTS_
+#define _SYS_STROPTS_
+
+
+/*
+ * Read options
+ */
+
+#define RNORM 0x00 /* Normal - bytes stream */
+#define RMSGD 0x01 /* Message, non-discard mode */
+#define RMSGN 0x02 /* Message, discard mode */
+
+#define RMASK 0x0F /* mask for read options */
+
+/*
+ * Protocol read options
+ */
+
+#define RPROTNORM 0x00 /* Fail reads with EBADMSG */
+#define RPROTDIS 0x10 /* Discard proto part */
+#define RPROTDAT 0x20 /* Turn proto part into data */
+
+#define RPROTMASK 0xF0 /* mask for protocol read options */
+
+/*
+ * Values for I_ATMARK argument
+ */
+
+#define ANYMARK 0 /* check if message is marked */
+#define LASTMARK 1 /* check if last one marked */
+
+/*
+ * Value for I_SWROPT argument
+ */
+
+#define NOSNDZERO 0 /* disallow zero length sends */
+#define SNDZERO 1 /* permit zero length sends */
+
+/*
+ * STREAMS ioctl defines
+ */
+
+#define STR ('S'<<8)
+#define I_NREAD (STR|1)
+#define I_PUSH (STR|2)
+#define I_POP (STR|3)
+#define I_LOOK (STR|4)
+#define I_FLUSH (STR|5)
+#define I_SRDOPT (STR|6)
+#define I_GRDOPT (STR|7)
+#define I_STR (STR|8)
+#define I_SETSIG (STR|9)
+#define I_GETSIG (STR|10)
+#define I_FIND (STR|11)
+#define I_LINK (STR|12)
+#define I_UNLINK (STR|13)
+#define I_PEEK (STR|15)
+#define I_FDINSERT (STR|16)
+#define I_SENDFD (STR|17)
+#define I_RECVFD (STR|18)
+#ifdef SVR2
+#define I_GETMSG (STR|19)
+#define I_PUTMSG (STR|20)
+#define I_GETID (STR|21)
+#define I_POLL (STR|22)
+#endif /*SVR2*/
+#define I_SWROPT (STR|23)
+#define I_GWROPT (STR|24)
+#define I_LIST (STR|25)
+#define I_ATMARK (STR|26)
+#define I_SETCLTIME (STR|27)
+#define I_GETCLTIME (STR|28)
+#define I_PLINK (STR|29)
+#define I_PUNLINK (STR|30)
+#define I_DEBUG (STR|31)
+#define I_CLOSE (STR|32)
+
+
+#define MUXID_ALL -1
+
+
+/*
+ * General buffer structure (putmsg, getmsg, etc)
+ */
+
+struct strbuf {
+ int maxlen; /* no. of bytes in buffer */
+ int len; /* no. of bytes returned */
+ char *buf; /* pointer to data */
+};
+
+/*
+ * General ioctl
+ */
+
+struct strioctl {
+ int ic_cmd; /* command */
+ int ic_timout; /* timeout value */
+ int ic_len; /* length of data */
+ char *ic_dp; /* pointer to data */
+};
+
+/*
+ * Structure for I_FDINSERT ioctl
+ */
+
+struct strfdinsert {
+ struct strbuf ctlbuf;
+ struct strbuf databuf;
+ long flags;
+ HANDLE fildes;
+ int offset;
+};
+
+
+/*
+ * Structures for I_DEBUG ioctl
+ */
+typedef enum _str_trace_options {
+ MSG_TRACE_PRINT = 0x00000001,
+ MSG_TRACE_FLUSH = 0x00000002,
+ MSG_TRACE_ON = 0x00000004,
+ MSG_TRACE_OFF = 0x00000008,
+ POOL_TRACE_PRINT = 0x00000010,
+ POOL_TRACE_FLUSH = 0x00000020,
+ POOL_TRACE_ON = 0x00000040,
+ POOL_TRACE_OFF = 0x00000080,
+ POOL_FAIL_ON = 0x00000100,
+ POOL_FAIL_OFF = 0x00000200,
+ LOCK_TRACE_ON = 0x00000400,
+ LOCK_TRACE_OFF = 0x00000800,
+ QUEUE_PRINT = 0x00001000,
+ BUFFER_PRINT = 0x00002000,
+ POOL_LOGGING_ON = 0x00004000,
+ POOL_LOGGING_OFF = 0x00008000
+} str_trace_options;
+
+
+struct strdebug {
+ ULONG trace_cmd;
+};
+
+
+/*
+ * stream I_PEEK ioctl format
+ */
+
+struct strpeek {
+ struct strbuf ctlbuf;
+ struct strbuf databuf;
+ long flags;
+};
+
+/*
+ * receive file descriptor structure
+ */
+struct strrecvfd {
+#ifdef INKERNEL
+ union {
+ struct file *fp;
+ int fd;
+ } f;
+#else
+ int fd;
+#endif
+ unsigned short uid;
+ unsigned short gid;
+ char fill[8];
+};
+
+#define FMNAMESZ 8
+
+struct str_mlist {
+ char l_name[FMNAMESZ+1];
+};
+
+struct str_list {
+ int sl_nmods;
+ struct str_mlist *sl_modlist;
+};
+
+/*
+ * get/putmsg flags
+ */
+
+#define RS_HIPRI 1 /* High priority message */
+
+#define MORECTL 1
+#define MOREDATA 2
+
+
+/*
+ * M_SETSIG flags
+ */
+
+#define S_INPUT 1
+#define S_HIPRI 2
+#define S_OUTPUT 4
+#define S_MSG 8
+#define S_ERROR 16
+#define S_HANGUP 32
+
+/*
+ * Flags for MFLUSH messages
+ */
+#define FLUSHW 01 /* flush downstream */
+#define FLUSHR 02 /* flush upstream */
+#define FLUSHRW (FLUSHR | FLUSHW)
+
+#endif /* _SYS_STROPTS_ */
diff --git a/private/inc/sys/uio.h b/private/inc/sys/uio.h
new file mode 100644
index 000000000..afe3d5c96
--- /dev/null
+++ b/private/inc/sys/uio.h
@@ -0,0 +1,84 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ uio.h
+
+Abstract:
+
+ I/O structure definitions for compatibility with BSD.
+
+Author:
+
+ Mike Massa (mikemas) Jan 31, 1992
+
+Revision History:
+
+ Who When What
+ -------- -------- ----------------------------------------------
+ mikemas 01-31-92 created
+
+Notes:
+
+--*/
+
+/******************************************************************
+ *
+ * Spider BSD Compatibility
+ *
+ * Copyright 1990 Spider Systems Limited
+ *
+ * UIO.H
+ *
+ ******************************************************************/
+
+/*
+ * /usr/projects/tcp/SCCS.rel3/rel/src/include/bsd/sys/0/s.uio.h
+ * @(#)uio.h 5.3
+ *
+ * Last delta created 14:41:47 3/4/91
+ * This file extracted 11:24:29 3/8/91
+ *
+ * Modifications:
+ *
+ * GSS 19 Jun 90 New File
+ */
+
+/*
+ * Copyright (c) 1982, 1986 Regents of the University of California.
+ * All rights reserved. The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ * @(#)uio.h 7.1 (Berkeley) 6/4/86
+ */
+
+#ifndef _UIO_
+#define _UIO_
+
+typedef long daddr_t;
+typedef char FAR * caddr_t;
+
+struct iovec {
+ caddr_t iov_base;
+ int iov_len;
+};
+
+struct uio {
+ struct iovec *uio_iov;
+ int uio_iovcnt;
+ int uio_offset;
+ int uio_segflg;
+ int uio_resid;
+};
+
+enum uio_rw { UIO_READ, UIO_WRITE };
+
+/*
+ * Segment flag values (should be enum).
+ */
+#define UIO_USERSPACE 0 /* from user data space */
+#define UIO_SYSSPACE 1 /* from system space */
+#define UIO_USERISPACE 2 /* from user I space */
+#endif
diff --git a/private/inc/tcpinfo.h b/private/inc/tcpinfo.h
new file mode 100644
index 000000000..e636183c9
--- /dev/null
+++ b/private/inc/tcpinfo.h
@@ -0,0 +1,186 @@
+/********************************************************************/
+/** Microsoft LAN Manager **/
+/** Copyright(c) Microsoft Corp., 1990-1993 **/
+/********************************************************************/
+/* :ts=4 */
+
+//** TCPINFO.H - TDI Query/SetInfo and Action definitons.
+//
+// This file contains definitions for information returned from TCP/UDP.
+//
+
+#ifndef TCP_INFO_INCLUDED
+#define TCP_INFO_INCLUDED
+
+
+#ifndef CTE_TYPEDEFS_DEFINED
+#define CTE_TYPEDEFS_DEFINED
+
+typedef unsigned long ulong;
+typedef unsigned short ushort;
+typedef unsigned char uchar;
+typedef unsigned int uint;
+
+#endif // CTE_TYPEDEFS_DEFINED
+
+
+typedef struct TCPStats {
+ ulong ts_rtoalgorithm;
+ ulong ts_rtomin;
+ ulong ts_rtomax;
+ ulong ts_maxconn;
+ ulong ts_activeopens;
+ ulong ts_passiveopens;
+ ulong ts_attemptfails;
+ ulong ts_estabresets;
+ ulong ts_currestab;
+ ulong ts_insegs;
+ ulong ts_outsegs;
+ ulong ts_retranssegs;
+ ulong ts_inerrs;
+ ulong ts_outrsts;
+ ulong ts_numconns;
+} TCPStats;
+
+#define TCP_RTO_OTHER 1
+#define TCP_RTO_CONSTANT 2
+#define TCP_RTO_RSRE 3
+#define TCP_RTO_VANJ 4
+
+#define TCP_MAXCONN_DYNAMIC -1
+
+typedef struct UDPStats {
+ ulong us_indatagrams;
+ ulong us_noports;
+ ulong us_inerrors;
+ ulong us_outdatagrams;
+ ulong us_numaddrs;
+} UDPStats;
+
+typedef struct TCPConnTableEntry {
+ ulong tct_state;
+ ulong tct_localaddr;
+ ulong tct_localport;
+ ulong tct_remoteaddr;
+ ulong tct_remoteport;
+} TCPConnTableEntry;
+
+//* Definitions for the tct_state variable.
+#define TCP_CONN_CLOSED 1 // Closed.
+#define TCP_CONN_LISTEN 2 // Listening.
+#define TCP_CONN_SYN_SENT 3 // SYN Sent.
+#define TCP_CONN_SYN_RCVD 4 // SYN received.
+#define TCP_CONN_ESTAB 5 // Established.
+#define TCP_CONN_FIN_WAIT1 6 // FIN-WAIT-1
+#define TCP_CONN_FIN_WAIT2 7 // FIN-WAIT-2
+#define TCP_CONN_CLOSE_WAIT 8 // Close waiting.
+#define TCP_CONN_CLOSING 9 // Closing state.
+#define TCP_CONN_LAST_ACK 10 // Last ack state.
+#define TCP_CONN_TIME_WAIT 11 // Time wait state.
+#define TCP_DELETE_TCB 12 // Set to delete this TCB.
+
+
+typedef struct UDPEntry {
+ ulong ue_localaddr;
+ ulong ue_localport;
+} UDPEntry;
+
+
+#define TCP_MIB_STAT_ID 1
+#define UDP_MIB_STAT_ID 1
+#define TCP_MIB_TABLE_ID 0x101
+#define UDP_MIB_TABLE_ID 0x101
+
+// Sockets based identifiers for connections.
+
+typedef struct TCPSocketOption {
+ ulong tso_value;
+} TCPSocketOption;
+
+//* Structure passed in/returned from the SOCKET_ATMARK call. The tsa_offset
+// field indicate how far back or forward in the data stream urgent data
+// was or will be returned. A negative value means inline urgent data has
+// already been given to the client, -tsa_offset bytes ago. A positive value
+// means that inline urgent data is available tsa_offset bytes down the
+// data stream. The tsa_size field is the size in bytes of the urgent data.
+// This call when always return a 0 size and offset if the connection is not
+// in the urgent inline mode.
+
+typedef struct TCPSocketAMInfo {
+ ulong tsa_size; // Size of urgent data returned.
+ long tsa_offset; // Offset of urgent data returned.
+} TCPSocketAMInfo;
+
+#define TCP_SOCKET_NODELAY 1
+#define TCP_SOCKET_KEEPALIVE 2
+#define TCP_SOCKET_OOBINLINE 3
+#define TCP_SOCKET_BSDURGENT 4
+#define TCP_SOCKET_ATMARK 5
+#define TCP_SOCKET_WINDOW 6
+
+// Address object identifies. All but AO_OPTION_MCASTIF take single boolean
+// character value. That one expects a pointer to an IP address.
+
+#define AO_OPTION_TTL 1
+#define AO_OPTION_MCASTTTL 2
+#define AO_OPTION_MCASTIF 3
+#define AO_OPTION_XSUM 4
+#define AO_OPTION_IPOPTIONS 5
+#define AO_OPTION_ADD_MCAST 6
+#define AO_OPTION_DEL_MCAST 7
+#define AO_OPTION_TOS 8
+#define AO_OPTION_IP_DONTFRAGMENT 9
+
+
+//* Information relating to setting/deleting IP multicast addresses.
+typedef struct UDPMCastReq {
+ ulong umr_addr; // MCast address to add/delete.
+ ulong umr_if; // I/F on which to join.
+} UDPMCastReq;
+
+//* Structure defining what is passed in to AO_OPTION_MCASTIF request.
+typedef struct UDPMCastIFReq {
+ IPAddr umi_addr;
+} UDPMCastIFReq;
+
+
+//
+// Structures used in security filter enumeration.
+//
+// All values are in HOST byte order!!!
+//
+typedef struct TCPSecurityFilterEntry {
+ ulong tsf_address; // IP interface address
+ ulong tsf_protocol; // Transport protocol number
+ ulong tsf_value; // Transport filter value (e.g. TCP port)
+} TCPSecurityFilterEntry;
+
+typedef struct TCPSecurityFilterEnum {
+ ULONG tfe_entries_returned; // The number of TCPSecurityFilterEntry structs
+ // returned in the subsequent array.
+
+ ULONG tfe_entries_available; // The number of TCPSecurityFilterEntry structs
+ // currently available from the transport.
+} TCPSecurityFilterEnum;
+
+//
+// Structures used in connection list enumeration.
+//
+// All values are in HOST byte order!!!
+//
+
+typedef struct TCPConnectionListEntry {
+ IPAddr tcf_address; // IP address
+ uint tcf_ticks; // Tick Count remaining
+} TCPConnectionListEntry;
+
+typedef struct TCPConnectionListEnum {
+ ULONG tce_entries_returned; // The number of TCPConnectionListEntry structs
+ // returned in the subsequent array.
+
+ ULONG tce_entries_available; // The number of TCPConnectionListEntry structs
+ // currently available from the transport.
+} TCPConnectionListEnum;
+
+
+#endif // TCP_INFO_INCLUDED
diff --git a/private/inc/tcpsvcs.h b/private/inc/tcpsvcs.h
new file mode 100644
index 000000000..625ec10a5
--- /dev/null
+++ b/private/inc/tcpsvcs.h
@@ -0,0 +1,87 @@
+/*++
+
+Copyright (c) 1993 Microsoft Corporation
+
+Module Name:
+
+ Tcpsvcs.h
+
+Abstract:
+
+ Header file fr TCP/IP services.
+
+Author:
+
+ David Treadwell (davidtr) 7-27-93
+
+Revision History:
+
+--*/
+
+#ifndef _TCPSVCS_
+#define _TCPSVCS_
+
+//
+// Service DLLs loaded into tcpsvcs.exe all export the same main
+// entry point. TCPSVCS_ENTRY_POINT defines that name.
+//
+// Note that TCPSVCS_ENTRY_POINT_STRING is always ANSI, because that's
+// what GetProcAddress takes.
+//
+
+#define TCPSVCS_ENTRY_POINT ServiceEntry
+#define TCPSVCS_ENTRY_POINT_STRING "ServiceEntry"
+
+//
+// Name for the common RPC pipe shared by all the RPC servers in tcpsvcs.exe.
+// Note: Because version 1.0 of WinNt had seperate names for each server's
+// pipe, the client side names have remained the same. Mapping to the new
+// name is handled by the named pipe file system.
+//
+
+#define TCPSVCS_RPC_PIPE L"nttcpsvcs"
+
+//
+// Start and stop RPC server entry point prototype.
+//
+
+typedef
+DWORD
+(*PTCPSVCS_START_RPC_SERVER_LISTEN) (
+ VOID
+ );
+
+typedef
+DWORD
+(*PTCPSVCS_STOP_RPC_SERVER_LISTEN) (
+ VOID
+ );
+
+//
+// Structure containing "global" data for the various DLLs.
+//
+
+typedef struct _TCPSVCS_GLOBAL_DATA {
+
+ //
+ // Entry points provided by TCPSVCS.EXE.
+ //
+
+ PTCPSVCS_START_RPC_SERVER_LISTEN StartRpcServerListen;
+ PTCPSVCS_STOP_RPC_SERVER_LISTEN StopRpcServerListen;
+
+} TCPSVCS_GLOBAL_DATA, *PTCPSVCS_GLOBAL_DATA;
+
+//
+// Service DLL entry point prototype.
+//
+
+typedef
+VOID
+(*PTCPSVCS_SERVICE_DLL_ENTRY) (
+ IN DWORD argc,
+ IN LPTSTR argv[],
+ IN PTCPSVCS_GLOBAL_DATA pGlobalData
+ );
+
+#endif // ndef _TCPSVCS_
diff --git a/private/inc/tdi.h b/private/inc/tdi.h
new file mode 100644
index 000000000..1b122d8fa
--- /dev/null
+++ b/private/inc/tdi.h
@@ -0,0 +1,937 @@
+/*++
+
+Copyright (c) 1989 Microsoft Corporation
+
+Module Name:
+
+ tdi.h
+
+Abstract:
+
+ This header file contains interface definitions for NT transport
+ providers. This interface is documented in the NT Transport
+ Driver Interface (TDI) Specification, Version 2.
+
+Author:
+
+ Dave Beaver (dbeaver) 1 June 1991
+
+Revision History:
+
+ TomH Jan 1995 added VINES IP definitions
+
+--*/
+
+//
+// Include the types which are common to TDI and other network users
+//
+
+#ifndef _TDI_USER_
+#define _TDI_USER_
+
+#include <nettypes.h>
+
+#include <ntddtdi.h>
+
+//
+// Include Transport driver interface definitions
+// All of the following have two definitions; ones that correspond exactly to
+// the TDI spec, and those that correspond to the NT coding standards. They
+// should be equivalent.
+//
+
+typedef LONG TDI_STATUS;
+typedef PVOID CONNECTION_CONTEXT; // connection context
+
+//
+// Basic type used to represent an address at the transport level. There may
+// be many addresses represented in a single address structure. If there are
+// multiple addresses, a given provider must understand all of them or it can
+// use none of them. Note that it is acceptible for the provider to not know
+// how to use the address, as long as it knows the address type. Thus, a
+// TCP/IP NetBIOS provider may know both NetBIOS and TCP/IP addresses, but
+// use only the NetBIOS address; the TCP/IP address would (likely) be passed on
+// to the TCP/IP provider.
+//
+
+typedef struct _TA_ADDRESS {
+ USHORT AddressLength; // length in bytes of Address[] in this
+ USHORT AddressType; // type of this address
+ UCHAR Address[1]; // actually AddressLength bytes long
+} TA_ADDRESS, *PTA_ADDRESS;
+
+
+typedef struct _TRANSPORT_ADDRESS {
+ LONG TAAddressCount; // number of addresses following
+ TA_ADDRESS Address[1]; // actually TAAddressCount elements long
+} TRANSPORT_ADDRESS, *PTRANSPORT_ADDRESS;
+
+//
+// define some names for the EAs so people don't have to make them up.
+//
+
+#define TdiTransportAddress "TransportAddress"
+#define TdiConnectionContext "ConnectionContext"
+#define TDI_TRANSPORT_ADDRESS_LENGTH (sizeof (TdiTransportAddress) - 1)
+#define TDI_CONNECTION_CONTEXT_LENGTH (sizeof (TdiConnectionContext) - 1)
+
+//
+// Known Address types
+//
+
+#define TDI_ADDRESS_TYPE_UNSPEC ((USHORT)0) // unspecified
+#define TDI_ADDRESS_TYPE_UNIX ((USHORT)1) // local to host (pipes, portals)
+#define TDI_ADDRESS_TYPE_IP ((USHORT)2) // internetwork: UDP, TCP, etc.
+#define TDI_ADDRESS_TYPE_IMPLINK ((USHORT)3) // arpanet imp addresses
+#define TDI_ADDRESS_TYPE_PUP ((USHORT)4) // pup protocols: e.g. BSP
+#define TDI_ADDRESS_TYPE_CHAOS ((USHORT)5) // mit CHAOS protocols
+#define TDI_ADDRESS_TYPE_NS ((USHORT)6) // XEROX NS protocols
+#define TDI_ADDRESS_TYPE_IPX ((USHORT)6) // Netware IPX
+#define TDI_ADDRESS_TYPE_NBS ((USHORT)7) // nbs protocols
+#define TDI_ADDRESS_TYPE_ECMA ((USHORT)8) // european computer manufacturers
+#define TDI_ADDRESS_TYPE_DATAKIT ((USHORT)9) // datakit protocols
+#define TDI_ADDRESS_TYPE_CCITT ((USHORT)10) // CCITT protocols, X.25 etc
+#define TDI_ADDRESS_TYPE_SNA ((USHORT)11) // IBM SNA
+#define TDI_ADDRESS_TYPE_DECnet ((USHORT)12) // DECnet
+#define TDI_ADDRESS_TYPE_DLI ((USHORT)13) // Direct data link interface
+#define TDI_ADDRESS_TYPE_LAT ((USHORT)14) // LAT
+#define TDI_ADDRESS_TYPE_HYLINK ((USHORT)15) // NSC Hyperchannel
+#define TDI_ADDRESS_TYPE_APPLETALK ((USHORT)16) // AppleTalk
+#define TDI_ADDRESS_TYPE_NETBIOS ((USHORT)17) // Netbios Addresses
+#define TDI_ADDRESS_TYPE_8022 ((USHORT)18) //
+#define TDI_ADDRESS_TYPE_OSI_TSAP ((USHORT)19) //
+#define TDI_ADDRESS_TYPE_NETONE ((USHORT)20) // for WzMail
+#define TDI_ADDRESS_TYPE_VNS ((USHORT)21) // Banyan VINES IP
+#define TDI_ADDRESS_TYPE_NETBIOS_EX ((USHORT)22) // NETBIOS address extensions
+
+//
+// Definition of address structures. These need to be packed
+// and misaligned where necessary.
+//
+
+#include <packon.h>
+
+
+//
+// NetBIOS
+//
+
+typedef struct _TDI_ADDRESS_NETBIOS {
+ USHORT NetbiosNameType;
+ UCHAR NetbiosName[16];
+} TDI_ADDRESS_NETBIOS, *PTDI_ADDRESS_NETBIOS;
+
+#define TDI_ADDRESS_NETBIOS_TYPE_UNIQUE ((USHORT)0x0000)
+#define TDI_ADDRESS_NETBIOS_TYPE_GROUP ((USHORT)0x0001)
+#define TDI_ADDRESS_NETBIOS_TYPE_QUICK_UNIQUE ((USHORT)0x0002)
+#define TDI_ADDRESS_NETBIOS_TYPE_QUICK_GROUP ((USHORT)0x0003)
+
+#define TDI_ADDRESS_LENGTH_NETBIOS sizeof (TDI_ADDRESS_NETBIOS)
+
+//
+// NETBIOS Extended address
+//
+
+typedef struct _TDI_ADDRESS_NETBIOS_EX {
+ UCHAR EndpointName[16]; // the called name to be used in NETBT session setup
+ TDI_ADDRESS_NETBIOS NetbiosAddress;
+} TDI_ADDRESS_NETBIOS_EX, *PTDI_ADDRESS_NETBIOS_EX;
+
+#define TDI_ADDRESS_LENGTH_NETBIOS_EX sizeof(TDI_ADDRESS_NETBIOS_EX)
+
+//
+// Xns address for UB
+//
+
+typedef struct _TDI_ADDRESS_NETONE {
+ USHORT NetoneNameType;
+ UCHAR NetoneName[20];
+} TDI_ADDRESS_NETONE, *PTDI_ADDRESS_NETONE;
+
+#define TDI_ADDRESS_NETONE_TYPE_UNIQUE ((USHORT)0x0000)
+#define TDI_ADDRESS_NETONE_TYPE_ROTORED ((USHORT)0x0001)
+
+#define TDI_ADDRESS_LENGTH_NETONE sizeof (TDI_ADDRESS_NETONE)
+
+
+//
+// AppleTalk
+//
+
+typedef struct _TDI_ADDRESS_APPLETALK {
+ USHORT Network;
+ UCHAR Node;
+ UCHAR Socket;
+} TDI_ADDRESS_APPLETALK, *PTDI_ADDRESS_APPLETALK;
+
+#define TDI_ADDRESS_LENGTH_APPLETALK sizeof (TDI_ADDRESS_APPLETALK)
+
+
+//
+// 802.2 MAC addresses
+//
+
+typedef struct _TDI_ADDRESS_8022 {
+ UCHAR MACAddress[6];
+} TDI_ADDRESS_8022, *PTDI_ADDRESS_8022;
+
+#define TDI_ADDRESS_LENGTH_8022 sizeof (TDI_ADDRESS_8022);
+
+
+//
+// IP address
+//
+
+typedef struct _TDI_ADDRESS_IP {
+ USHORT sin_port;
+ ULONG in_addr;
+ UCHAR sin_zero[8];
+} TDI_ADDRESS_IP, *PTDI_ADDRESS_IP;
+
+#define TDI_ADDRESS_LENGTH_IP sizeof (TDI_ADDRESS_IP)
+
+//
+// IPX address
+//
+
+typedef struct _TDI_ADDRESS_IPX {
+ ULONG NetworkAddress;
+ UCHAR NodeAddress[6];
+ USHORT Socket;
+} TDI_ADDRESS_IPX, *PTDI_ADDRESS_IPX;
+
+
+#define TDI_ADDRESS_LENGTH_IPX sizeof (TDI_ADDRESS_IPX)
+
+//
+// XNS address (same as IPX)
+//
+
+typedef struct _TDI_ADDRESS_NS {
+ ULONG NetworkAddress;
+ UCHAR NodeAddress[6];
+ USHORT Socket;
+} TDI_ADDRESS_NS, *PTDI_ADDRESS_NS;
+
+
+#define TDI_ADDRESS_LENGTH_NS sizeof (TDI_ADDRESS_NS)
+
+//
+// Banyan VINES IP address
+//
+
+typedef struct _TDI_ADDRESS_VNS {
+ UCHAR net_address[4]; // network address (static)
+ UCHAR subnet_addr[2]; // subnet address (dynamic)
+ UCHAR port[2];
+ UCHAR hops; // # hops for broadcasts
+ UCHAR filler[5]; // filler, zeros
+} TDI_ADDRESS_VNS, *PTDI_ADDRESS_VNS;
+
+#define TDI_ADDRESS_LENGTH_VNS sizeof (TDI_ADDRESS_VNS)
+
+
+// OSI TSAP
+
+/*
+ * The maximum size of the tranport address (tp_addr field of a
+ * sockaddr_tp structure) is 64.
+ */
+
+#define ISO_MAX_ADDR_LENGTH 64
+
+/*
+ * There are two types of ISO addresses, hierarchical and
+ * non-hierarchical. For hierarchical addresses, the tp_addr
+ * field contains both the transport selector and the network
+ * address. For non-hierarchical addresses, tp_addr contains only
+ * the transport address, which must be translated by the ISO TP4
+ * transport provider into the transport selector and network address.
+ */
+
+#define ISO_HIERARCHICAL 0
+#define ISO_NON_HIERARCHICAL 1
+
+typedef struct _TDI_ADDRESS_OSI_TSAP {
+ USHORT tp_addr_type; /* ISO_HIERARCHICAL or ISO_NON_HIERARCHICAL
+*/
+ USHORT tp_taddr_len; /* Length of transport address, <= 52 */
+ USHORT tp_tsel_len; /* Length of transport selector, <= 32 */
+ /* 0 if ISO_NON_HIERARCHICAL */
+ UCHAR tp_addr[ISO_MAX_ADDR_LENGTH];
+} TDI_ADDRESS_OSI_TSAP, *PTDI_ADDRESS_OSI_TSAP;
+
+#define TDI_ADDRESS_LENGTH_OSI_TSAP sizeof (TDI_ADDRESS_OSI_TSAP)
+
+//
+// Some pre-defined structures to make life easier for
+// the 99.99% of us who use but one address.
+//
+
+typedef struct _TA_ADDRESS_NETBIOS {
+ LONG TAAddressCount;
+ struct _Addr {
+ USHORT AddressLength; // length in bytes of this address == 18
+ USHORT AddressType; // this will == TDI_ADDRESS_TYPE_NETBIOS
+ TDI_ADDRESS_NETBIOS Address[1];
+ } Address [1];
+} TA_NETBIOS_ADDRESS, *PTA_NETBIOS_ADDRESS;
+
+typedef struct _TA_ADDRESS_NETBIOS_EX {
+ LONG TAAddressCount;
+ struct _AddrNetbiosEx {
+ USHORT AddressLength; // length in bytes of this address == 36
+ USHORT AddressType; // this will == TDI_ADDRESS_TYPE_NETBIOS_EX
+ TDI_ADDRESS_NETBIOS_EX Address[1];
+ } Address [1];
+} TA_NETBIOS_EX_ADDRESS, *PTA_NETBIOS_EX_ADDRESS;
+
+typedef struct _TA_APPLETALK_ADDR {
+ LONG TAAddressCount;
+ struct _AddrAtalk {
+ USHORT AddressLength; // length in bytes of this address == 4
+ USHORT AddressType; // this will == TDI_ADDRESS_TYPE_APPLETALK
+ TDI_ADDRESS_APPLETALK Address[1];
+ } Address[1];
+} TA_APPLETALK_ADDRESS, *PTA_APPLETALK_ADDRESS;
+
+typedef struct _TA_ADDRESS_IP {
+ LONG TAAddressCount;
+ struct _AddrIp {
+ USHORT AddressLength; // length in bytes of this address == 14
+ USHORT AddressType; // this will == TDI_ADDRESS_TYPE_IP
+ TDI_ADDRESS_IP Address[1];
+ } Address [1];
+} TA_IP_ADDRESS, *PTA_IP_ADDRESS;
+
+typedef struct _TA_ADDRESS_IPX {
+ LONG TAAddressCount;
+ struct _AddrIpx {
+ USHORT AddressLength; // length in bytes of this address == 12
+ USHORT AddressType; // this will == TDI_ADDRESS_TYPE_IPX
+ TDI_ADDRESS_IPX Address[1];
+ } Address [1];
+} TA_IPX_ADDRESS, *PTA_IPX_ADDRESS;
+
+typedef struct _TA_ADDRESS_NS {
+ LONG TAAddressCount;
+ struct _AddrNs {
+ USHORT AddressLength; // length in bytes of this address == 12
+ USHORT AddressType; // this will == TDI_ADDRESS_TYPE_NS
+ TDI_ADDRESS_NS Address[1];
+ } Address [1];
+} TA_NS_ADDRESS, *PTA_NS_ADDRESS;
+
+typedef struct _TA_ADDRESS_VNS {
+ LONG TAAddressCount;
+ struct _AddrVns {
+ USHORT AddressLength; // length in bytes of this address == 14
+ USHORT AddressType; // this will == TDI_ADDRESS_TYPE_VNS
+ TDI_ADDRESS_VNS Address[1];
+ } Address [1];
+} TA_VNS_ADDRESS, *PTA_VNS_ADDRESS;
+
+#include <packoff.h>
+
+
+//
+// This structure is passed with every request to TDI. It describes that
+// request and the parameters to it.
+//
+
+typedef struct _TDI_REQUEST {
+ union {
+ HANDLE AddressHandle;
+ CONNECTION_CONTEXT ConnectionContext;
+ HANDLE ControlChannel;
+ } Handle;
+
+ PVOID RequestNotifyObject;
+ PVOID RequestContext;
+ TDI_STATUS TdiStatus;
+} TDI_REQUEST, *PTDI_REQUEST;
+
+//
+// Structure for information returned by the TDI provider. This structure is
+// filled in upon request completion.
+//
+
+typedef struct _TDI_REQUEST_STATUS {
+ TDI_STATUS Status; // status of request completion
+ PVOID RequestContext; // the request Context
+ ULONG BytesTransferred; // number of bytes transferred in the request
+
+} TDI_REQUEST_STATUS, *PTDI_REQUEST_STATUS;
+
+//
+// connection primitives information structure. This is passed to the TDI calls
+// (Accept, Connect, xxx) that do connecting sorts of things.
+//
+
+typedef struct _TDI_CONNECTION_INFORMATION {
+ LONG UserDataLength; // length of user data buffer
+ PVOID UserData; // pointer to user data buffer
+ LONG OptionsLength; // length of follwoing buffer
+ PVOID Options; // pointer to buffer containing options
+ LONG RemoteAddressLength; // length of following buffer
+ PVOID RemoteAddress; // buffer containing the remote address
+} TDI_CONNECTION_INFORMATION, *PTDI_CONNECTION_INFORMATION;
+
+//
+// structure defining a counted string is defined in
+// \nt\public\sdk\inc\ntdefs.h as
+// typedef struct _STRING {
+// USHORT Length;
+// USHORT MaximumLength;
+// PCHAR Buffer;
+// } STRING;
+// typedef STRING *PSTRING;
+// typedef STRING ANSI_STRING;
+// typedef PSTRING PANSI_STRING;
+//
+
+//
+// Event types that are known
+//
+
+#define TDI_EVENT_CONNECT ((USHORT)0) // TDI_IND_CONNECT event handler.
+#define TDI_EVENT_DISCONNECT ((USHORT)1) // TDI_IND_DISCONNECT event handler.
+#define TDI_EVENT_ERROR ((USHORT)2) // TDI_IND_ERROR event handler.
+#define TDI_EVENT_RECEIVE ((USHORT)3) // TDI_IND_RECEIVE event handler.
+#define TDI_EVENT_RECEIVE_DATAGRAM ((USHORT)4) // TDI_IND_RECEIVE_DATAGRAM event handler.
+#define TDI_EVENT_RECEIVE_EXPEDITED ((USHORT)5) // TDI_IND_RECEIVE_EXPEDITED event handler.
+#define TDI_EVENT_SEND_POSSIBLE ((USHORT)6) // TDI_IND_SEND_POSSIBLE event handler
+
+//
+// Associate Address is done through NtDeviceIoControlFile, which passes this
+// structure as its input buffer. The Handle specified in the
+// NtDeviceIoControlFile is the handle of the connection returned in the
+// NtCreateFile call.
+//
+
+typedef struct _TDI_REQUEST_ASSOCIATE {
+ TDI_REQUEST Request;
+ HANDLE AddressHandle;
+} TDI_REQUEST_ASSOCIATE_ADDRESS, *PTDI_REQUEST_ASSOCIATE_ADDRESS;
+
+
+//
+// Disassociate Address passes no structure, uses the request code
+// IOCTL_TDI_DISASSOCIATE_ADDRESS. This call will never pend.
+//
+
+//
+// Connect is done through NtDeviceIoControlFile, which passes this
+// structure as its input buffer. The Handle specified in the
+// NtDeviceIoControlFile is the handle of the connection returned in the
+// NtCreateFile call.
+//
+
+typedef struct _TDI_CONNECT_REQUEST {
+ TDI_REQUEST Request;
+ PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
+ PTDI_CONNECTION_INFORMATION ReturnConnectionInformation;
+ LARGE_INTEGER Timeout;
+} TDI_REQUEST_CONNECT, *PTDI_REQUEST_CONNECT;
+
+//
+// Accept is done through NtDeviceIoControlFile, which passes this
+// structure as its input buffer. The Handle specified in the
+// NtDeviceIoControlFile is the handle of the connection returned in the
+// NtCreateFile call. Accept is called by the user when a listen completes,
+// before any activity can occur on a connection. AcceptConnectionId specifies
+// the connection on which the connection is accepted; in most cases, this
+// will be null, which that the connection is to be accepted on the
+// connection on which the listen completed. If the transport provider supports
+// "forwarding" of connections (the idea that a particular connection listens
+// all the time, and creates new connections as needed for incoming connection
+// requests and attaches them to the listen), this is the mechanism used to
+// associate connections with the listen.
+//
+
+typedef struct _TDI_REQUEST_ACCEPT {
+ TDI_REQUEST Request;
+ PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
+ PTDI_CONNECTION_INFORMATION ReturnConnectionInformation;
+} TDI_REQUEST_ACCEPT, *PTDI_REQUEST_ACCEPT;
+
+//
+// Listen is done through NtDeviceIoControlFile, which passes this
+// structure as its input buffer. The Handle specified in the
+// NtDeviceIoControlFile is the handle of the connection returned in the
+// NtCreateFile call. RequestConnectionInformation contains information about
+// the remote address to be listen for connections from; if NULL, any address
+// is accepted. ReturnConnectionInformation returns information about the
+// remote node that actually connected.
+//
+
+typedef struct _TDI_REQUEST_LISTEN {
+ TDI_REQUEST Request;
+ PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
+ PTDI_CONNECTION_INFORMATION ReturnConnectionInformation;
+ USHORT ListenFlags;
+} TDI_REQUEST_LISTEN, *PTDI_REQUEST_LISTEN;
+
+//
+// Disconnect is done through NtDeviceIoControlFile, which passes this
+// structure as its input buffer. The Handle specified in the
+// NtDeviceIoControlFile is the handle of the connection returned in the
+// NtCreateFile call. Disconnect differs from Close in offering more options.
+// For example, Close terminates all activity on a connection (immediately),
+// failing all outstanding requests, and tearing down the connection. With
+// some providers, Disconnect allows a "graceful" disconnect, causing new activity
+// to be rejected but allowing old activity to run down to completion.
+//
+
+typedef struct _TDI_DISCONNECT_REQUEST {
+ TDI_REQUEST Request;
+ LARGE_INTEGER Timeout;
+} TDI_REQUEST_DISCONNECT, *PTDI_REQUEST_DISCONNECT;
+
+//
+// Send is done through NtDeviceIoControlFile, which passes this
+// structure as its input buffer. The Handle specified in the
+// NtDeviceIoControlFile is the handle of the connection returned in the
+// NtCreateFile call. Note that it is possible to Send using the file system's
+// Write call. This will have the same effect as doing a Send with all flags
+// set to null.
+//
+
+typedef struct _TDI_REQUEST_SEND {
+ TDI_REQUEST Request;
+ USHORT SendFlags;
+} TDI_REQUEST_SEND, *PTDI_REQUEST_SEND;
+
+//
+// Receive is done through NtDeviceIoControlFile, which passes this
+// structure as its input buffer. The Handle specified in the
+// NtDeviceIoControlFile is the handle of the connection returned in the
+// NtCreateFile call. Note that it is possible to Receive using the file
+// system's Read call. Note further that receive returns a number of TDI_STATUS
+// values, which indicate things such as partial receives.
+//
+
+typedef struct _TDI_REQUEST_RECEIVE {
+ TDI_REQUEST Request;
+ USHORT ReceiveFlags;
+} TDI_REQUEST_RECEIVE, *PTDI_REQUEST_RECEIVE;
+
+//
+// SendDatagram is done through NtDeviceIoControlFile, which passes this
+// structure as its input buffer. The Handle specified in the
+// NtDeviceIoControlFile is the handle of the ADDRESS (note this is
+// different than above!!) returned in the NtCreateFile call. Send Datagram
+// specifies the address of the receiver through the SendDatagramInformation
+// structure, using RemoteAddress to point to the transport address of the
+// destination of the datagram.
+//
+
+typedef struct _TDI_REQUEST_SEND_DATAGRAM {
+ TDI_REQUEST Request;
+ PTDI_CONNECTION_INFORMATION SendDatagramInformation;
+} TDI_REQUEST_SEND_DATAGRAM, *PTDI_REQUEST_SEND_DATAGRAM;
+
+//
+// ReceiveDatagram is done through NtDeviceIoControlFile, which passes this
+// structure as its input buffer. The Handle specified in the
+// NtDeviceIoControlFile is the handle of the ADDRESS (note this is
+// different than above!!) returned in the NtCreateFile call. Receive Datagram
+// specifies the address from which to receive a datagram through the
+// ReceiveDatagramInformation structure, using RemoteAddress to point to the
+// transport address of the origin of the datagram. (Broadcast datagrams are
+// received by making the pointer NULL.) The actual address of the sender of
+// the datagram is returned in ReturnInformation.
+//
+// for the receive datagram call
+//
+
+typedef struct _TDI_REQUEST_RECEIVE_DATAGRAM {
+ TDI_REQUEST Request;
+ PTDI_CONNECTION_INFORMATION ReceiveDatagramInformation;
+ PTDI_CONNECTION_INFORMATION ReturnInformation;
+ USHORT ReceiveFlags;
+} TDI_REQUEST_RECEIVE_DATAGRAM, *PTDI_REQUEST_RECEIVE_DATAGRAM;
+
+//
+// SetEventHandler is done through NtDeviceIoControlFile, which passes this
+// structure as its input buffer. The Handle specified in the
+// NtDeviceIoControlFile is the handle of the ADDRESS (note this is
+// different than above!!) returned in the NtCreateFile call.
+
+typedef struct _TDI_REQUEST_SET_EVENT {
+ TDI_REQUEST Request;
+ LONG EventType;
+ PVOID EventHandler;
+ PVOID EventContext;
+} TDI_REQUEST_SET_EVENT_HANDLER, *PTDI_REQUEST_SET_EVENT_HANDLER;
+
+//
+// ReceiveIndicator values (from TdiReceive and TdiReceiveDatagram requests,
+// and also presented at TDI_IND_RECEIVE and TDI_IND_RECEIVE_DATAGRAM time).
+//
+// The TDI_RECEIVE_PARTIAL bit is no longer used at the kernel level
+// interface. TDI_RECEIVE_ENTIRE_MESSAGE has replaced it. Providers
+// may continue to set TDI_RECEIVE_PARTIAL when appropriate if they so
+// desire, but the TDI_RECEIVE_ENTIRE_MESSAGE bit must be set or
+// cleared as appropriate on all receive indications.
+//
+
+#if 0
+#define TDI_RECEIVE_TRUNCATED 0x00000001 // received TSDU was truncated.
+#define TDI_RECEIVE_FRAGMENT 0x00000002 // received TSDU was fragmented.
+#endif
+#define TDI_RECEIVE_BROADCAST 0x00000004 // received TSDU was broadcast.
+#define TDI_RECEIVE_MULTICAST 0x00000008 // received TSDU was multicast.
+#define TDI_RECEIVE_PARTIAL 0x00000010 // received TSDU is not fully presented.
+#define TDI_RECEIVE_NORMAL 0x00000020 // received TSDU is normal data
+#define TDI_RECEIVE_EXPEDITED 0x00000040 // received TSDU is expedited data
+#define TDI_RECEIVE_PEEK 0x00000080 // received TSDU is not released
+#define TDI_RECEIVE_NO_RESPONSE_EXP 0x00000100 // HINT: no back-traffic expected
+#define TDI_RECEIVE_COPY_LOOKAHEAD 0x00000200 // for kernel-mode indications
+#define TDI_RECEIVE_ENTIRE_MESSAGE 0x00000400 // opposite of RECEIVE_PARTIAL
+ // (for kernel-mode indications)
+#define TDI_RECEIVE_AT_DISPATCH_LEVEL 0x00000800 // receive indication called
+ // at dispatch level
+
+
+//
+// Listen Flags
+//
+
+#define TDI_QUERY_ACCEPT 0x00000001 // complete TdiListen
+ // without accepting
+ // connection
+
+//
+// Options which are used for both SendOptions and ReceiveIndicators.
+//
+
+#define TDI_SEND_EXPEDITED ((USHORT)0x0020) // TSDU is/was urgent/expedited.
+#define TDI_SEND_PARTIAL ((USHORT)0x0040) // TSDU is/was terminated by an EOR.
+#define TDI_SEND_NO_RESPONSE_EXPECTED ((USHORT)0x0080) // HINT: no back traffic expected.
+#define TDI_SEND_NON_BLOCKING ((USHORT)0x0100) // don't block if no buffer space in protocol
+
+
+//
+// Disconnect Flags
+//
+
+#define TDI_DISCONNECT_WAIT ((USHORT)0x0001) // used for disconnect
+ // notification
+#define TDI_DISCONNECT_ABORT ((USHORT)0x0002) // immediately terminate
+ // connection
+#define TDI_DISCONNECT_RELEASE ((USHORT)0x0004) // initiate graceful
+ // disconnect
+
+//
+// TdiRequest structure for TdiQueryInformation request.
+//
+
+typedef struct _TDI_REQUEST_QUERY_INFORMATION {
+ TDI_REQUEST Request;
+ ULONG QueryType; // class of information to be queried.
+ PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
+} TDI_REQUEST_QUERY_INFORMATION, *PTDI_REQUEST_QUERY_INFORMATION;
+
+//
+// TdiRequest structure for TdiSetInformation request.
+//
+
+typedef struct _TDI_REQUEST_SET_INFORMATION {
+ TDI_REQUEST Request;
+ ULONG SetType; // class of information to be set.
+ PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
+} TDI_REQUEST_SET_INFORMATION, *PTDI_REQUEST_SET_INFORMATION;
+
+//
+// This is the old name, do not use it.
+//
+
+typedef TDI_REQUEST_SET_INFORMATION TDI_REQ_SET_INFORMATION, *PTDI_REQ_SET_INFORMATION;
+
+//
+// Convenient universal request type.
+//
+
+typedef union _TDI_REQUEST_TYPE {
+ TDI_REQUEST_ACCEPT TdiAccept;
+ TDI_REQUEST_CONNECT TdiConnect;
+ TDI_REQUEST_DISCONNECT TdiDisconnect;
+ TDI_REQUEST_LISTEN TdiListen;
+ TDI_REQUEST_QUERY_INFORMATION TdiQueryInformation;
+ TDI_REQUEST_RECEIVE TdiReceive;
+ TDI_REQUEST_RECEIVE_DATAGRAM TdiReceiveDatagram;
+ TDI_REQUEST_SEND TdiSend;
+ TDI_REQUEST_SEND_DATAGRAM TdiSendDatagram;
+ TDI_REQUEST_SET_EVENT_HANDLER TdiSetEventHandler;
+ TDI_REQUEST_SET_INFORMATION TdiSetInformation;
+} TDI_REQUEST_TYPE, *PTDI_REQUEST_TYPE;
+
+
+//
+// Query information types
+//
+
+//
+// Generic query info types, must be supported by all transports.
+//
+
+#define TDI_QUERY_BROADCAST_ADDRESS 0x00000001
+#define TDI_QUERY_PROVIDER_INFORMATION 0x00000002 // temp, renamed ...
+#define TDI_QUERY_PROVIDER_INFO 0x00000002 // ... to this
+#define TDI_QUERY_ADDRESS_INFO 0x00000003
+#define TDI_QUERY_CONNECTION_INFO 0x00000004
+#define TDI_QUERY_PROVIDER_STATISTICS 0x00000005
+#define TDI_QUERY_DATAGRAM_INFO 0x00000006
+#define TDI_QUERY_DATA_LINK_ADDRESS 0x00000007
+#define TDI_QUERY_NETWORK_ADDRESS 0x00000008
+#define TDI_QUERY_MAX_DATAGRAM_INFO 0x00000009
+
+//
+// netbios specific query information types, must be supported by netbios
+// providers. Query adapter status returns the ADAPTER_STATUS struture defined
+// in the file NB30.H. Query session status returns the SESSION_HEADER/
+// SESSION_BUFFER structures defined in NB30.H. Query find name returns
+// the FIND_NAME_HEADER/FIND_NAME_BUFFER structures defined in NB30.H.
+//
+
+#define TDI_QUERY_ADAPTER_STATUS 0x00000100
+#define TDI_QUERY_SESSION_STATUS 0x00000200
+#define TDI_QUERY_FIND_NAME 0x00000300
+
+//
+// The following structures are returned by TdiQueryInformation and are read
+// by TdiSetInformation. Note that a provider with netbios support will also
+// return the adapter status
+//
+
+typedef struct _TDI_ENDPOINT_INFO {
+ ULONG State; // current state of the endpoint.
+ ULONG Event; // last event at the endpoint.
+ ULONG TransmittedTsdus; // TSDUs sent from this endpoint.
+ ULONG ReceivedTsdus; // TSDUs received at this endpoint.
+ ULONG TransmissionErrors; // TSDUs transmitted in error.
+ ULONG ReceiveErrors; // TSDUs received in error.
+ ULONG MinimumLookaheadData; // guaranteed min size of lookahead data.
+ ULONG MaximumLookaheadData; // maximum size of lookahead data.
+ ULONG PriorityLevel; // priority class assigned to outgoing data.
+ ULONG SecurityLevel; // security level assigned to outgoing data.
+ ULONG SecurityCompartment; // security compartment assigned to outgoing data.
+} TDI_ENDPOINT_INFO, *PTDI_ENDPOINT_INFO;
+
+typedef struct _TDI_CONNECTION_INFO {
+ ULONG State; // current state of the connection.
+ ULONG Event; // last event on the connection.
+ ULONG TransmittedTsdus; // TSDUs sent on this connection.
+ ULONG ReceivedTsdus; // TSDUs received on this connection.
+ ULONG TransmissionErrors; // TSDUs transmitted in error/this connection.
+ ULONG ReceiveErrors; // TSDUs received in error/this connection.
+ LARGE_INTEGER Throughput; // estimated throughput on this connection.
+ LARGE_INTEGER Delay; // estimated delay on this connection.
+ ULONG SendBufferSize; // size of buffer for sends - only
+ // meaningful for internal buffering
+ // protocols like tcp
+ ULONG ReceiveBufferSize; // size of buffer for receives - only
+ // meaningful for internal buffering
+ // protocols like tcp
+ BOOLEAN Unreliable; // is this connection "unreliable".
+} TDI_CONNECTION_INFO, *PTDI_CONNECTION_INFO;
+
+typedef struct _TDI_ADDRESS_INFO {
+ ULONG ActivityCount; // outstanding open file objects/this address.
+ TRANSPORT_ADDRESS Address; // the actual address & its components.
+} TDI_ADDRESS_INFO, *PTDI_ADDRESS_INFO;
+
+typedef struct _TDI_DATAGRAM_INFO {
+ ULONG MaximumDatagramBytes;
+ ULONG MaximumDatagramCount;
+} TDI_DATAGRAM_INFO, *PTDI_DATAGRAM_INFO;
+
+typedef struct _TDI_MAX_DATAGRAM_INFO {
+ ULONG MaxDatagramSize; // max datagram length in bytes.
+} TDI_MAX_DATAGRAM_INFO, *PTDI_MAX_DATAGRAM_INFO;
+
+
+typedef struct _TDI_PROVIDER_INFO {
+ ULONG Version; // TDI version: 0xaabb, aa=major, bb=minor
+ ULONG MaxSendSize; // max size of user send.
+ ULONG MaxConnectionUserData; // max size of user-specified connect data.
+ ULONG MaxDatagramSize; // max datagram length in bytes.
+ ULONG ServiceFlags; // service options, defined below.
+ ULONG MinimumLookaheadData; // guaranteed min size of lookahead data.
+ ULONG MaximumLookaheadData; // maximum size of lookahead data.
+ ULONG NumberOfResources; // how many TDI_RESOURCE_STATS for provider.
+ LARGE_INTEGER StartTime; // when the provider became active.
+} TDI_PROVIDER_INFO, *PTDI_PROVIDER_INFO;
+
+#define TDI_SERVICE_CONNECTION_MODE 0x00000001 // connection mode supported.
+#define TDI_SERVICE_ORDERLY_RELEASE 0x00000002 // orderly release supported.
+#define TDI_SERVICE_CONNECTIONLESS_MODE 0x00000004 // connectionless mode supported.
+#define TDI_SERVICE_ERROR_FREE_DELIVERY 0x00000008 // error free delivery supported.
+#define TDI_SERVICE_SECURITY_LEVEL 0x00000010 // security wrapper supported.
+#define TDI_SERVICE_BROADCAST_SUPPORTED 0x00000020 // broadcast datagrams supported.
+#define TDI_SERVICE_MULTICAST_SUPPORTED 0x00000040 // multicast datagrams supported.
+#define TDI_SERVICE_DELAYED_ACCEPTANCE 0x00000080 // use of TDI_ACCEPT_OR_REJECT is supported.
+#define TDI_SERVICE_EXPEDITED_DATA 0x00000100 // expedited data supported.
+#define TDI_SERVICE_INTERNAL_BUFFERING 0x00000200 // protocol does internal buffering
+#define TDI_SERVICE_ROUTE_DIRECTED 0x00000400 // directed packets may go further than MC.
+#define TDI_SERVICE_NO_ZERO_LENGTH 0x00000800 // zero-length sends NOT supported
+#define TDI_SERVICE_POINT_TO_POINT 0x00001000 // transport is functioning as a RAS gateway
+#define TDI_SERVICE_MESSAGE_MODE 0x00002000 // message-mode send supported
+#define TDI_SERVICE_HALF_DUPLEX 0x00004000 // data can be received after local disc
+
+
+typedef struct _TDI_PROVIDER_RESOURCE_STATS {
+ ULONG ResourceId; // identifies resource in question.
+ ULONG MaximumResourceUsed; // maximum number in use at once.
+ ULONG AverageResourceUsed; // average number in use.
+ ULONG ResourceExhausted; // number of times resource not available.
+} TDI_PROVIDER_RESOURCE_STATS, *PTDI_PROVIDER_RESOURCE_STATS;
+
+typedef struct _TDI_PROVIDER_STATISTICS {
+ ULONG Version; // TDI version: 0xaabb, aa=major, bb=minor
+ ULONG OpenConnections; // currently active connections.
+ ULONG ConnectionsAfterNoRetry; // successful connections, no retries.
+ ULONG ConnectionsAfterRetry; // successful connections after retry.
+ ULONG LocalDisconnects; // connection disconnected locally.
+ ULONG RemoteDisconnects; // connection disconnected by remote.
+ ULONG LinkFailures; // connections dropped, link failure.
+ ULONG AdapterFailures; // connections dropped, adapter failure.
+ ULONG SessionTimeouts; // connections dropped, session timeout.
+ ULONG CancelledConnections; // connect attempts cancelled.
+ ULONG RemoteResourceFailures; // connections failed, remote resource problems.
+ ULONG LocalResourceFailures; // connections failed, local resource problems.
+ ULONG NotFoundFailures; // connections failed, remote not found.
+ ULONG NoListenFailures; // connections rejected, we had no listens.
+ ULONG DatagramsSent;
+ LARGE_INTEGER DatagramBytesSent;
+ ULONG DatagramsReceived;
+ LARGE_INTEGER DatagramBytesReceived;
+ ULONG PacketsSent; // total packets given to NDIS.
+ ULONG PacketsReceived; // total packets received from NDIS.
+ ULONG DataFramesSent;
+ LARGE_INTEGER DataFrameBytesSent;
+ ULONG DataFramesReceived;
+ LARGE_INTEGER DataFrameBytesReceived;
+ ULONG DataFramesResent;
+ LARGE_INTEGER DataFrameBytesResent;
+ ULONG DataFramesRejected;
+ LARGE_INTEGER DataFrameBytesRejected;
+ ULONG ResponseTimerExpirations; // e.g. T1 for Netbios
+ ULONG AckTimerExpirations; // e.g. T2 for Netbios
+ ULONG MaximumSendWindow; // in bytes
+ ULONG AverageSendWindow; // in bytes
+ ULONG PiggybackAckQueued; // attempts to wait to piggyback ack.
+ ULONG PiggybackAckTimeouts; // times that wait timed out.
+ LARGE_INTEGER WastedPacketSpace; // total amount of "wasted" packet space.
+ ULONG WastedSpacePackets; // how many packets contributed to that.
+ ULONG NumberOfResources; // how many TDI_RESOURCE_STATS follow.
+ TDI_PROVIDER_RESOURCE_STATS ResourceStats[1]; // variable array of them.
+} TDI_PROVIDER_STATISTICS, *PTDI_PROVIDER_STATISTICS;
+
+#if 0
+
+typedef struct _TDI_NETMAN_INFO {
+ OFFSET VariableName; // name of variable (a FLAT_STRING).
+ OFFSET VariableValue; // value of variable (a TDI_NETMAN_VARIABLE).
+} TDI_NETMAN_INFO, *PTDI_NETMAN_INFO;
+
+typedef struct _TDI_NETMAN_VARIABLE {
+ ULONG VariableType; // selector for union, below.
+ union {
+ ULONG LongValue;
+ HARDWARE_ADDRESS HardwareAddressValue;
+ FLAT_STRING StringValue;
+ } Value;
+} TDI_NETMAN_VARIABLE, *PTDI_NETMAN_VARIABLE;
+
+#define NETMAN_VARTYPE_ULONG 0 // type is a ULONG.
+#define NETMAN_VARTYPE_HARDWARE_ADDRESS 1 // type is a HARDWARE_ADDRESS.
+#define NETMAN_VARTYPE_STRING 2 // type is a FLAT_STRING.
+
+typedef union _TDI_INFO_BUFFER {
+ TDI_ENDPOINT_INFO EndpointInfo;
+ TDI_CONNECTION_INFO ConnectionInfo;
+ TDI_ADDRESS_INFO AddressInfo;
+ TDI_PROVIDER_INFO ProviderInfo;
+ TDI_NETMAN_INFO NetmanVariable;
+} TDI_INFO_BUFFER, *PTDI_INFO_BUFFER;
+
+#define TDI_INFO_CLASS_ENDPOINT 0 // endpoint information class.
+#define TDI_INFO_CLASS_CONNECTION 1 // connection information class.
+#define TDI_INFO_CLASS_ADDRESS 2 // address information class.
+#define TDI_INFO_CLASS_PROVIDER 3 // provider information class.
+#define TDI_INFO_CLASS_NETMAN 4 // network management info class.
+
+#endif
+
+NTSTATUS
+TdiOpenNetbiosAddress (
+ IN OUT PHANDLE FileHandle,
+ IN PUCHAR Buffer,
+ IN PVOID DeviceName,
+ IN PVOID Name
+ );
+
+
+
+#define IOCTL_TDI_MAGIC_BULLET _TDI_CONTROL_CODE( 0x7f, METHOD_NEITHER )
+
+//
+// NtDeviceIoControlFile InputBuffer/OutputBuffer record structures for
+// this device.
+//
+
+#if 0
+
+//
+// These are the old definitions
+//
+
+typedef struct _TDI_REQUEST_USER_ASSOCIATE {
+ HANDLE AddressHandle;
+} TDI_REQUEST_USER_ASSOCIATE, *PTDI_REQUEST_USER_ASSOCIATE;
+
+typedef struct _TDI_REQUEST_USER_CONNECT {
+ TDI_CONNECTION_INFORMATION CallInformation;
+ //CHAR UserData[CallInformation.UserDataLength];
+ //CHAR Options[CallInformation.OptionsLength];
+ //CHAR RemoteAddress[CallInformation.RemoteAddressLength];
+} TDI_REQUEST_USER_CONNECT, *PTDI_REQUEST_USER_CONNECT;
+
+typedef struct _TDI_REQUEST_USER_QUERY_INFO {
+ LONG QueryType;
+} TDI_REQUEST_USER_QUERY_INFO, *PTDI_REQUEST_USER_QUERY_INFO;
+
+#else
+
+//
+// Define these to match the kernel ones for compatibility; eventually
+// these will be removed.
+//
+
+typedef TDI_REQUEST_ASSOCIATE_ADDRESS TDI_REQUEST_USER_ASSOCIATE, *PTDI_REQUEST_USER_ASSOCIATE;
+typedef TDI_REQUEST_CONNECT TDI_REQUEST_USER_CONNECT, *PTDI_REQUEST_USER_CONNECT;
+typedef TDI_REQUEST_QUERY_INFORMATION TDI_REQUEST_USER_QUERY_INFO, *PTDI_REQUEST_USER_QUERY_INFO;
+
+#endif
+
+
+//
+// The header in the OutputBuffer passed to TdiAction
+//
+
+typedef struct _TDI_ACTION_HEADER {
+ ULONG TransportId;
+ USHORT ActionCode;
+ USHORT Reserved;
+} TDI_ACTION_HEADER, *PTDI_ACTION_HEADER;
+
+typedef struct _STREAMS_TDI_ACTION {
+ TDI_ACTION_HEADER Header;
+ BOOLEAN DatagramOption;
+ ULONG BufferLength;
+ CHAR Buffer[1];
+} STREAMS_TDI_ACTION, *PSTREAMS_TDI_ACTION;
+
+#endif // ndef _TDI_USER_
diff --git a/private/inc/tdiinfo.h b/private/inc/tdiinfo.h
new file mode 100644
index 000000000..a46d83b6f
--- /dev/null
+++ b/private/inc/tdiinfo.h
@@ -0,0 +1,140 @@
+/********************************************************************/
+/** Microsoft LAN Manager **/
+/** Copyright(c) Microsoft Corp., 1990-1993 **/
+/********************************************************************/
+/* :ts=4 */
+
+//** TDIINFO.H - TDI Query/SetInfoEx definitons.
+//
+// This file contains definitions for the extended TDI query and set info.
+// calls.
+//
+
+#ifndef TDI_INFO_INCLUDED
+#define TDI_INFO_INCLUDED
+
+
+#ifndef CTE_TYPEDEFS_DEFINED
+#define CTE_TYPEDEFS_DEFINED
+
+typedef unsigned long ulong;
+typedef unsigned short ushort;
+typedef unsigned char uchar;
+typedef unsigned int uint;
+
+#endif // CTE_TYPEDEFS_DEFINED
+
+
+//* Structure of an entity ID.
+typedef struct TDIEntityID {
+ ulong tei_entity;
+ ulong tei_instance;
+} TDIEntityID;
+
+//* Structure of an object ID.
+typedef struct TDIObjectID {
+ TDIEntityID toi_entity;
+ ulong toi_class;
+ ulong toi_type;
+ ulong toi_id;
+} TDIObjectID;
+
+#define MAX_TDI_ENTITIES 512
+
+#define INFO_CLASS_GENERIC 0x100
+#define INFO_CLASS_PROTOCOL 0x200
+#define INFO_CLASS_IMPLEMENTATION 0x300
+
+#define INFO_TYPE_PROVIDER 0x100
+#define INFO_TYPE_ADDRESS_OBJECT 0x200
+#define INFO_TYPE_CONNECTION 0x300
+
+#define ENTITY_LIST_ID 0
+
+#define GENERIC_ENTITY 0
+
+#define CO_TL_ENTITY 0x400
+#define CL_TL_ENTITY 0x401
+
+#define ER_ENTITY 0x380
+
+#define CO_NL_ENTITY 0x300
+#define CL_NL_ENTITY 0x301
+
+#define AT_ENTITY 0x280
+
+#define IF_ENTITY 0x200
+
+#define CONTEXT_SIZE 16
+
+
+//* The following are IDs supported by all entities. They are of class
+// GENERIC and type PROVIDER.
+
+#define ENTITY_TYPE_ID 1 // The ID to get the entity
+ // type. The return from this
+ // type is an unsigned integer
+ // (see below).
+
+
+// Valid values to get back from entity type ID query.
+#define CO_TL_NBF 0x400 // Entity implements NBF prot.
+#define CO_TL_SPX 0x402 // Entity implements SPX prot.
+#define CO_TL_TCP 0x404 // Entity implements TCP prot.
+#define CO_TL_SPP 0x406 // Entity implements SPP prot.
+
+#define CL_TL_NBF 0x401 // CL NBF protocol.
+#define CL_TL_UDP 0x403 // Entity implements UDP.
+
+#define ER_ICMP 0x380 // The ICMP protocol.
+
+#define CL_NL_IPX 0x301 // Entity implements IPX.
+#define CL_NL_IP 0x303 // Entity implements IP.
+
+#define AT_ARP 0x280 // Entity implements ARP.
+#define AT_NULL 0x282 // Entity does no address
+ // translation.
+
+#define IF_GENERIC 0x200 // Generic interface.
+#define IF_MIB 0x202 // Supports MIB-2 interface.
+
+
+/*NOINC*/
+//
+// NT DeviceIoControl definitions for TdiExtendedInformationEx functions.
+//
+
+//
+// QueryInformationEx IOCTL. The return buffer is passed as the OutputBuffer
+// in the DeviceIoControl request. This structure is passed as the
+// InputBuffer.
+//
+struct tcp_request_query_information_ex {
+ TDIObjectID ID; // object ID to query.
+ uchar Context[CONTEXT_SIZE]; // multi-request context. Zeroed
+ // for the first request.
+};
+
+typedef struct tcp_request_query_information_ex
+ TCP_REQUEST_QUERY_INFORMATION_EX,
+ *PTCP_REQUEST_QUERY_INFORMATION_EX;
+
+//
+// SetInformationEx IOCTL request structure. This structure is passed as the
+// InputBuffer. The space allocated for the structure must be large enough
+// to contain the structure and the set data buffer, which begins at the
+// Buffer field. The OutputBuffer parameter in the DeviceIoControl is not used.
+//
+struct tcp_request_set_information_ex {
+ TDIObjectID ID; // object ID to set.
+ unsigned int BufferSize; // size of the set data buffer in bytes
+ unsigned char Buffer[1]; // beginning of the set data buffer
+};
+
+typedef struct tcp_request_set_information_ex
+ TCP_REQUEST_SET_INFORMATION_EX,
+ *PTCP_REQUEST_SET_INFORMATION_EX;
+
+
+#endif // TDI_INFO_INCLUDED
+
diff --git a/private/inc/tdikrnl.h b/private/inc/tdikrnl.h
new file mode 100644
index 000000000..966a1451f
--- /dev/null
+++ b/private/inc/tdikrnl.h
@@ -0,0 +1,1023 @@
+/*++
+
+Copyright (c) 1989 Microsoft Corporation
+
+Module Name:
+
+ tdikrnl.h
+
+Abstract:
+
+ This header file contains interface definitions for NT transport
+ providers running in kernel mode. This interface is documented in the
+ NT Transport Driver Interface (TDI) Specification, Version 2.
+
+Author:
+
+ Dave Beaver (dbeaver) 20 June 1991
+
+Revision History:
+
+--*/
+
+#ifndef _TDI_KRNL_
+#define _TDI_KRNL_
+
+#include <tdi.h> // get the user mode includes
+
+//
+// In this TDI, a kernel mode client calls TDI using IoCallDriver with the
+// current Irp stack pointer set to 16 bytes of pointers to other structures.
+// each of the supported NtDeviceIoControlFile analogs has a somehat different
+// structure, laid out below.
+//
+// The IrpSP information passed by kernel mode clients looks like:
+//
+
+typedef struct _TDI_REQUEST_KERNEL {
+ ULONG RequestFlags;
+ PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
+ PTDI_CONNECTION_INFORMATION ReturnConnectionInformation;
+ PVOID RequestSpecific;
+} TDI_REQUEST_KERNEL, *PTDI_REQUEST_KERNEL;
+
+//
+// defined request codes for the kernel clients. We make these the same
+// as the IOCTL codes mostly for convenience; either can be used with
+// the same results.
+//
+
+#define TDI_ASSOCIATE_ADDRESS (0x01)
+#define TDI_DISASSOCIATE_ADDRESS (0x02)
+#define TDI_CONNECT (0x03)
+#define TDI_LISTEN (0x04)
+#define TDI_ACCEPT (0x05)
+#define TDI_DISCONNECT (0x06)
+#define TDI_SEND (0x07)
+#define TDI_RECEIVE (0x08)
+#define TDI_SEND_DATAGRAM (0x09)
+#define TDI_RECEIVE_DATAGRAM (0x0A)
+#define TDI_SET_EVENT_HANDLER (0x0B)
+#define TDI_QUERY_INFORMATION (0x0C)
+#define TDI_SET_INFORMATION (0x0D)
+#define TDI_ACTION (0x0E)
+
+#define TDI_DIRECT_SEND (0x27)
+#define TDI_DIRECT_SEND_DATAGRAM (0x29)
+
+//
+// TdiOpenAddress (Not Used)
+// TdiCloseAddress (Not Used)
+// TdiOpenConnection (Not Used)
+// TdiCloseConnection (Not Used)
+//
+
+//
+// some useful constants for comparison when determining the file type;
+// not required.
+//
+
+#define TDI_TRANSPORT_ADDRESS_FILE 1
+#define TDI_CONNECTION_FILE 2
+#define TDI_CONTROL_CHANNEL_FILE 3
+
+//
+// Internal TDI IOCTLS
+//
+
+#define IOCTL_TDI_QUERY_DIRECT_SEND_HANDLER _TDI_CONTROL_CODE( 0x80, METHOD_NEITHER )
+#define IOCTL_TDI_QUERY_DIRECT_SENDDG_HANDLER _TDI_CONTROL_CODE( 0x81, METHOD_NEITHER )
+
+//
+// TdiAssociateAddress
+//
+
+typedef struct _TDI_REQUEST_KERNEL_ASSOCIATE {
+ HANDLE AddressHandle;
+} TDI_REQUEST_KERNEL_ASSOCIATE, *PTDI_REQUEST_KERNEL_ASSOCIATE;
+
+//
+// TdiDisassociateAddress -- None supplied
+//
+
+typedef TDI_REQUEST_KERNEL TDI_REQUEST_KERNEL_DISASSOCIATE,
+ *PTDI_REQUEST_KERNEL_DISASSOCIATE;
+
+//
+// TdiConnect uses the structure given above (TDI_REQUEST_KERNEL); it's
+// defined again below for convenience
+//
+
+typedef TDI_REQUEST_KERNEL TDI_REQUEST_KERNEL_CONNECT,
+ *PTDI_REQUEST_KERNEL_CONNECT;
+
+//
+// TdiDisconnect uses the structure given above (TDI_REQUEST_KERNEL); it's
+// defined again below for convenience
+//
+
+typedef TDI_REQUEST_KERNEL TDI_REQUEST_KERNEL_DISCONNECT,
+ *PTDI_REQUEST_KERNEL_DISCONNECT;
+
+//
+// TdiListen uses the structure given above (TDI_REQUEST_KERNEL); it's
+// defined again below for convenience
+//
+
+typedef TDI_REQUEST_KERNEL TDI_REQUEST_KERNEL_LISTEN,
+ *PTDI_REQUEST_KERNEL_LISTEN;
+
+//
+// TdiAccept
+//
+
+typedef struct _TDI_REQUEST_KERNEL_ACCEPT {
+ PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
+ PTDI_CONNECTION_INFORMATION ReturnConnectionInformation;
+} TDI_REQUEST_KERNEL_ACCEPT, *PTDI_REQUEST_KERNEL_ACCEPT;
+
+//
+// TdiSend
+//
+
+typedef struct _TDI_REQUEST_KERNEL_SEND {
+ ULONG SendLength;
+ ULONG SendFlags;
+} TDI_REQUEST_KERNEL_SEND, *PTDI_REQUEST_KERNEL_SEND;
+
+//
+// TdiReceive
+//
+
+typedef struct _TDI_REQUEST_KERNEL_RECEIVE {
+ ULONG ReceiveLength;
+ ULONG ReceiveFlags;
+} TDI_REQUEST_KERNEL_RECEIVE, *PTDI_REQUEST_KERNEL_RECEIVE;
+
+//
+// TdiSendDatagram
+//
+
+typedef struct _TDI_REQUEST_KERNEL_SENDDG {
+ ULONG SendLength;
+ PTDI_CONNECTION_INFORMATION SendDatagramInformation;
+} TDI_REQUEST_KERNEL_SENDDG, *PTDI_REQUEST_KERNEL_SENDDG;
+
+//
+// TdiReceiveDatagram
+//
+
+typedef struct _TDI_REQUEST_KERNEL_RECEIVEDG {
+ ULONG ReceiveLength;
+ PTDI_CONNECTION_INFORMATION ReceiveDatagramInformation;
+ PTDI_CONNECTION_INFORMATION ReturnDatagramInformation;
+ ULONG ReceiveFlags;
+} TDI_REQUEST_KERNEL_RECEIVEDG, *PTDI_REQUEST_KERNEL_RECEIVEDG;
+
+//
+// TdiSetEventHandler
+//
+
+typedef struct _TDI_REQUEST_KERNEL_SET_EVENT {
+ LONG EventType;
+ PVOID EventHandler;
+ PVOID EventContext;
+} TDI_REQUEST_KERNEL_SET_EVENT, *PTDI_REQUEST_KERNEL_SET_EVENT;
+
+//
+// TdiQueryInformation
+//
+
+typedef struct _TDI_REQUEST_KERNEL_QUERY_INFO {
+ LONG QueryType;
+ PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
+} TDI_REQUEST_KERNEL_QUERY_INFORMATION, *PTDI_REQUEST_KERNEL_QUERY_INFORMATION;
+
+//
+// TdiSetInformation
+//
+
+typedef struct _TDI_REQUEST_KERNEL_SET_INFO {
+ LONG SetType;
+ PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
+} TDI_REQUEST_KERNEL_SET_INFORMATION, *PTDI_REQUEST_KERNEL_SET_INFORMATION;
+
+//
+// Event types that are known
+//
+
+#define TDI_EVENT_CONNECT ((USHORT)0) // TDI_IND_CONNECT event handler.
+#define TDI_EVENT_DISCONNECT ((USHORT)1) // TDI_IND_DISCONNECT event handler.
+#define TDI_EVENT_ERROR ((USHORT)2) // TDI_IND_ERROR event handler.
+#define TDI_EVENT_RECEIVE ((USHORT)3) // TDI_IND_RECEIVE event handler.
+#define TDI_EVENT_RECEIVE_DATAGRAM ((USHORT)4) // TDI_IND_RECEIVE_DATAGRAM event handler.
+#define TDI_EVENT_RECEIVE_EXPEDITED ((USHORT)5) // TDI_IND_RECEIVE_EXPEDITED event handler.
+#define TDI_EVENT_SEND_POSSIBLE ((USHORT)6) // TDI_IND_SEND_POSSIBLE event handler
+#define TDI_EVENT_CHAINED_RECEIVE ((USHORT)7) // TDI_IND_CHAINED_RECEIVE event handler.
+#define TDI_EVENT_CHAINED_RECEIVE_DATAGRAM ((USHORT)8) // TDI_IND_CHAINED_RECEIVE_DATAGRAM event handler.
+#define TDI_EVENT_CHAINED_RECEIVE_EXPEDITED ((USHORT)9) // TDI_IND_CHAINED_RECEIVE_EXPEDITED event handler.
+
+//
+// indicate connection event prototype. This is invoked when a request for
+// connection has been received by the provider and the user wishes to either
+// accept or reject that request.
+//
+
+typedef
+NTSTATUS
+(*PTDI_IND_CONNECT)(
+ IN PVOID TdiEventContext,
+ IN LONG RemoteAddressLength,
+ IN PVOID RemoteAddress,
+ IN LONG UserDataLength,
+ IN PVOID UserData,
+ IN LONG OptionsLength,
+ IN PVOID Options,
+ OUT CONNECTION_CONTEXT *ConnectionContext,
+ OUT PIRP *AcceptIrp
+ )
+ ;
+
+NTSTATUS
+TdiDefaultConnectHandler (
+ IN PVOID TdiEventContext,
+ IN LONG RemoteAddressLength,
+ IN PVOID RemoteAddress,
+ IN LONG UserDataLength,
+ IN PVOID UserData,
+ IN LONG OptionsLength,
+ IN PVOID Options,
+ OUT CONNECTION_CONTEXT *ConnectionContext,
+ OUT PIRP *AcceptIrp
+ );
+
+//
+// Disconnection indication prototype. This is invoked when a connection is
+// being disconnected for a reason other than the user requesting it. Note that
+// this is a change from TDI V1, which indicated only when the remote caused
+// a disconnection. Any non-directed disconnection will cause this indication.
+//
+
+typedef
+NTSTATUS
+(*PTDI_IND_DISCONNECT)(
+ IN PVOID TdiEventContext,
+ IN CONNECTION_CONTEXT ConnectionContext,
+ IN LONG DisconnectDataLength,
+ IN PVOID DisconnectData,
+ IN LONG DisconnectInformationLength,
+ IN PVOID DisconnectInformation,
+ IN ULONG DisconnectFlags
+ );
+
+NTSTATUS
+TdiDefaultDisconnectHandler (
+ IN PVOID TdiEventContext,
+ IN CONNECTION_CONTEXT ConnectionContext,
+ IN LONG DisconnectDataLength,
+ IN PVOID DisconnectData,
+ IN LONG DisconnectInformationLength,
+ IN PVOID DisconnectInformation,
+ IN ULONG DisconnectFlags
+ );
+
+//
+// A protocol error has occurred when this indication happens. This indication
+// occurs only for errors of the worst type; the address this indication is
+// delivered to is no longer usable for protocol-related operations, and
+// should not be used for operations henceforth. All connections associated
+// it are invalid.
+// For NetBIOS-type providers, this indication is also delivered when a name
+// in conflict or duplicate name occurs.
+//
+
+typedef
+NTSTATUS
+(*PTDI_IND_ERROR)(
+ IN PVOID TdiEventContext, // the endpoint's file object.
+ IN NTSTATUS Status // status code indicating error type.
+ );
+
+NTSTATUS
+TdiDefaultErrorHandler (
+ IN PVOID TdiEventContext, // the endpoint's file object.
+ IN NTSTATUS Status // status code indicating error type.
+ );
+
+//
+// TDI_IND_RECEIVE indication handler definition. This client routine is
+// called by the transport provider when a connection-oriented TSDU is received
+// that should be presented to the client.
+//
+
+typedef
+NTSTATUS
+(*PTDI_IND_RECEIVE)(
+ IN PVOID TdiEventContext,
+ IN CONNECTION_CONTEXT ConnectionContext,
+ IN ULONG ReceiveFlags,
+ IN ULONG BytesIndicated,
+ IN ULONG BytesAvailable,
+ OUT ULONG *BytesTaken,
+ IN PVOID Tsdu, // pointer describing this TSDU, typically a lump of bytes
+ OUT PIRP *IoRequestPacket // TdiReceive IRP if MORE_PROCESSING_REQUIRED.
+ );
+
+NTSTATUS
+TdiDefaultReceiveHandler (
+ IN PVOID TdiEventContext,
+ IN CONNECTION_CONTEXT ConnectionContext,
+ IN ULONG ReceiveFlags,
+ IN ULONG BytesIndicated,
+ IN ULONG BytesAvailable,
+ OUT ULONG *BytesTaken,
+ IN PVOID Tsdu, // pointer describing this TSDU, typically a lump of bytes
+ OUT PIRP *IoRequestPacket // TdiReceive IRP if MORE_PROCESSING_REQUIRED.
+ );
+
+//
+// TDI_IND_RECEIVE_DATAGRAM indication handler definition. This client routine
+// is called by the transport provider when a connectionless TSDU is received
+// that should be presented to the client.
+//
+
+typedef
+NTSTATUS
+(*PTDI_IND_RECEIVE_DATAGRAM)(
+ IN PVOID TdiEventContext, // the event context
+ IN LONG SourceAddressLength, // length of the originator of the datagram
+ IN PVOID SourceAddress, // string describing the originator of the datagram
+ IN LONG OptionsLength, // options for the receive
+ IN PVOID Options, //
+ IN ULONG ReceiveDatagramFlags, //
+ IN ULONG BytesIndicated, // number of bytes this indication
+ IN ULONG BytesAvailable, // number of bytes in complete Tsdu
+ OUT ULONG *BytesTaken, // number of bytes used
+ IN PVOID Tsdu, // pointer describing this TSDU, typically a lump of bytes
+ OUT PIRP *IoRequestPacket // TdiReceive IRP if MORE_PROCESSING_REQUIRED.
+ );
+
+NTSTATUS
+TdiDefaultRcvDatagramHandler (
+ IN PVOID TdiEventContext, // the event context
+ IN LONG SourceAddressLength, // length of the originator of the datagram
+ IN PVOID SourceAddress, // string describing the originator of the datagram
+ IN LONG OptionsLength, // options for the receive
+ IN PVOID Options, //
+ IN ULONG ReceiveDatagramFlags, //
+ IN ULONG BytesIndicated, // number of bytes this indication
+ IN ULONG BytesAvailable, // number of bytes in complete Tsdu
+ OUT ULONG *BytesTaken, // number of bytes used
+ IN PVOID Tsdu, // pointer describing this TSDU, typically a lump of bytes
+ OUT PIRP *IoRequestPacket // TdiReceive IRP if MORE_PROCESSING_REQUIRED.
+ );
+
+//
+// This indication is delivered if expedited data is received on the connection.
+// This will only occur in providers that support expedited data.
+//
+
+typedef
+NTSTATUS
+(*PTDI_IND_RECEIVE_EXPEDITED)(
+ IN PVOID TdiEventContext,
+ IN CONNECTION_CONTEXT ConnectionContext,
+ IN ULONG ReceiveFlags, //
+ IN ULONG BytesIndicated, // number of bytes in this indication
+ IN ULONG BytesAvailable, // number of bytes in complete Tsdu
+ OUT ULONG *BytesTaken, // number of bytes used by indication routine
+ IN PVOID Tsdu, // pointer describing this TSDU, typically a lump of bytes
+ OUT PIRP *IoRequestPacket // TdiReceive IRP if MORE_PROCESSING_REQUIRED.
+ );
+
+NTSTATUS
+TdiDefaultRcvExpeditedHandler (
+ IN PVOID TdiEventContext,
+ IN CONNECTION_CONTEXT ConnectionContext,
+ IN ULONG ReceiveFlags, //
+ IN ULONG BytesIndicated, // number of bytes in this indication
+ IN ULONG BytesAvailable, // number of bytes in complete Tsdu
+ OUT ULONG *BytesTaken, // number of bytes used by indication routine
+ IN PVOID Tsdu, // pointer describing this TSDU, typically a lump of bytes
+ OUT PIRP *IoRequestPacket // TdiReceive IRP if MORE_PROCESSING_REQUIRED.
+ );
+
+//
+// TDI_IND_CHAINED_RECEIVE indication handler definition. This client routine
+// is called by the transport provider when a connection-oriented TSDU is
+// received that should be presented to the client. The TSDU is stored in an
+// MDL chain. The client may take ownership of the TSDU and return it at a
+// later time.
+//
+
+typedef
+NTSTATUS
+(*PTDI_IND_CHAINED_RECEIVE)(
+ IN PVOID TdiEventContext,
+ IN CONNECTION_CONTEXT ConnectionContext,
+ IN ULONG ReceiveFlags,
+ IN ULONG ReceiveLength, // length of client data in TSDU
+ IN ULONG StartingOffset, // offset of start of client data in TSDU
+ IN PMDL Tsdu, // TSDU data chain
+ IN PVOID TsduDescriptor // for call to TdiReturnChainedReceives
+ );
+
+NTSTATUS
+TdiDefaultChainedReceiveHandler (
+ IN PVOID TdiEventContext,
+ IN CONNECTION_CONTEXT ConnectionContext,
+ IN ULONG ReceiveFlags,
+ IN ULONG ReceiveLength, // length of client data in TSDU
+ IN ULONG StartingOffset, // offset of start of client data in TSDU
+ IN PMDL Tsdu, // TSDU data chain
+ IN PVOID TsduDescriptor // for call to TdiReturnChainedReceives
+ );
+
+//
+// TDI_IND_CHAINED_RECEIVE_DATAGRAM indication handler definition. This client
+// routine is called by the transport provider when a connectionless TSDU is
+// received that should be presented to the client. The TSDU is stored in an
+// MDL chain. The client may take ownership of the TSDU and return it at a
+// later time.
+//
+
+typedef
+NTSTATUS
+(*PTDI_IND_CHAINED_RECEIVE_DATAGRAM)(
+ IN PVOID TdiEventContext, // the event context
+ IN LONG SourceAddressLength, // length of the originator of the datagram
+ IN PVOID SourceAddress, // string describing the originator of the datagram
+ IN LONG OptionsLength, // options for the receive
+ IN PVOID Options, //
+ IN ULONG ReceiveDatagramFlags, //
+ IN ULONG ReceiveDatagramLength, // length of client data in TSDU
+ IN ULONG StartingOffset, // offset of start of client data in TSDU
+ IN PMDL Tsdu, // TSDU data chain
+ IN PVOID TsduDescriptor // for call to TdiReturnChainedReceives
+ );
+
+NTSTATUS
+TdiDefaultChainedRcvDatagramHandler (
+ IN PVOID TdiEventContext, // the event context
+ IN LONG SourceAddressLength, // length of the originator of the datagram
+ IN PVOID SourceAddress, // string describing the originator of the datagram
+ IN LONG OptionsLength, // options for the receive
+ IN PVOID Options, //
+ IN ULONG ReceiveDatagramFlags, //
+ IN ULONG ReceiveDatagramLength, // length of client data in TSDU
+ IN ULONG StartingOffset, // offset of start of client data in TSDU
+ IN PMDL Tsdu, // TSDU data chain
+ IN PVOID TsduDescriptor // for call to TdiReturnChainedReceives
+ );
+
+//
+// This indication is delivered if expedited data is received on the connection.
+// This will only occur in providers that support expedited data. The TSDU is
+// stored in an MDL chain. The client may take ownership of the TSDU and
+// return it at a later time.
+//
+
+typedef
+NTSTATUS
+(*PTDI_IND_CHAINED_RECEIVE_EXPEDITED)(
+ IN PVOID TdiEventContext,
+ IN CONNECTION_CONTEXT ConnectionContext,
+ IN ULONG ReceiveFlags,
+ IN ULONG ReceiveLength, // length of client data in TSDU
+ IN ULONG StartingOffset, // offset of start of client data in TSDU
+ IN PMDL Tsdu, // TSDU data chain
+ IN PVOID TsduDescriptor // for call to TdiReturnChainedReceives
+ );
+
+NTSTATUS
+TdiDefaultChainedRcvExpeditedHandler (
+ IN PVOID TdiEventContext,
+ IN CONNECTION_CONTEXT ConnectionContext,
+ IN ULONG ReceiveFlags,
+ IN ULONG ReceiveLength, // length of client data in TSDU
+ IN ULONG StartingOffset, // offset of start of client data in TSDU
+ IN PMDL Tsdu, // TSDU data chain
+ IN PVOID TsduDescriptor // for call to TdiReturnChainedReceives
+ );
+
+//
+// This indication is delivered if there is room for a send in the buffer of
+// a buffering protocol.
+//
+
+typedef
+NTSTATUS
+(*PTDI_IND_SEND_POSSIBLE)(
+ IN PVOID TdiEventContext,
+ IN PVOID ConnectionContext,
+ IN ULONG BytesAvailable);
+
+NTSTATUS
+TdiDefaultSendPossibleHandler (
+ IN PVOID TdiEventContext,
+ IN PVOID ConnectionContext,
+ IN ULONG BytesAvailable);
+
+//
+// defined MACROS to allow the kernel mode client to easily build an IRP for
+// any function.
+//
+
+#define TdiBuildAssociateAddress(Irp, DevObj, FileObj, CompRoutine, Contxt, AddrHandle) \
+ { \
+ PTDI_REQUEST_KERNEL_ASSOCIATE p; \
+ PIO_STACK_LOCATION _IRPSP; \
+ if ( CompRoutine != NULL) { \
+ IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\
+ } else { \
+ IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \
+ } \
+ _IRPSP = IoGetNextIrpStackLocation (Irp); \
+ _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \
+ _IRPSP->MinorFunction = TDI_ASSOCIATE_ADDRESS; \
+ _IRPSP->DeviceObject = DevObj; \
+ _IRPSP->FileObject = FileObj; \
+ p = (PTDI_REQUEST_KERNEL_ASSOCIATE)&_IRPSP->Parameters; \
+ p->AddressHandle = (HANDLE)(AddrHandle); \
+ }
+
+#define TdiBuildDisassociateAddress(Irp, DevObj, FileObj, CompRoutine, Contxt) \
+ { \
+ PTDI_REQUEST_KERNEL_DISASSOCIATE p; \
+ PIO_STACK_LOCATION _IRPSP; \
+ if ( CompRoutine != NULL) { \
+ IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\
+ } else { \
+ IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \
+ } \
+ _IRPSP = IoGetNextIrpStackLocation (Irp); \
+ _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \
+ _IRPSP->MinorFunction = TDI_DISASSOCIATE_ADDRESS; \
+ _IRPSP->DeviceObject = DevObj; \
+ _IRPSP->FileObject = FileObj; \
+ p = (PTDI_REQUEST_KERNEL_DISASSOCIATE)&_IRPSP->Parameters; \
+ }
+
+#define TdiBuildConnect(Irp, DevObj, FileObj, CompRoutine, Contxt, Time, RequestConnectionInfo, ReturnConnectionInfo)\
+ { \
+ PTDI_REQUEST_KERNEL p; \
+ PIO_STACK_LOCATION _IRPSP; \
+ if ( CompRoutine != NULL) { \
+ IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\
+ } else { \
+ IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \
+ } \
+ _IRPSP = IoGetNextIrpStackLocation (Irp); \
+ _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \
+ _IRPSP->MinorFunction = TDI_CONNECT; \
+ _IRPSP->DeviceObject = DevObj; \
+ _IRPSP->FileObject = FileObj; \
+ p = (PTDI_REQUEST_KERNEL)&_IRPSP->Parameters; \
+ p->RequestConnectionInformation = RequestConnectionInfo; \
+ p->ReturnConnectionInformation = ReturnConnectionInfo; \
+ p->RequestSpecific = (PVOID)Time; \
+ }
+
+#define TdiBuildListen(Irp, DevObj, FileObj, CompRoutine, Contxt, Flags, RequestConnectionInfo, ReturnConnectionInfo)\
+ { \
+ PTDI_REQUEST_KERNEL p; \
+ PIO_STACK_LOCATION _IRPSP; \
+ if ( CompRoutine != NULL) { \
+ IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\
+ } else { \
+ IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \
+ } \
+ _IRPSP = IoGetNextIrpStackLocation (Irp); \
+ _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \
+ _IRPSP->MinorFunction = TDI_LISTEN; \
+ _IRPSP->DeviceObject = DevObj; \
+ _IRPSP->FileObject = FileObj; \
+ p = (PTDI_REQUEST_KERNEL)&_IRPSP->Parameters; \
+ p->RequestFlags = Flags; \
+ p->RequestConnectionInformation = RequestConnectionInfo; \
+ p->ReturnConnectionInformation = ReturnConnectionInfo; \
+ }
+
+#define TdiBuildAccept(Irp, DevObj, FileObj, CompRoutine, Contxt, RequestConnectionInfo, ReturnConnectionInfo)\
+ { \
+ PTDI_REQUEST_KERNEL_ACCEPT p; \
+ PIO_STACK_LOCATION _IRPSP; \
+ if ( CompRoutine != NULL) { \
+ IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\
+ } else { \
+ IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \
+ } \
+ _IRPSP = IoGetNextIrpStackLocation (Irp); \
+ _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \
+ _IRPSP->MinorFunction = TDI_ACCEPT; \
+ _IRPSP->DeviceObject = DevObj; \
+ _IRPSP->FileObject = FileObj; \
+ p = (PTDI_REQUEST_KERNEL_ACCEPT)&_IRPSP->Parameters; \
+ p->RequestConnectionInformation = RequestConnectionInfo; \
+ p->ReturnConnectionInformation = ReturnConnectionInfo; \
+ }
+
+#define TdiBuildDisconnect(Irp, DevObj, FileObj, CompRoutine, Contxt, Time, Flags, RequestConnectionInfo, ReturnConnectionInfo)\
+ { \
+ PTDI_REQUEST_KERNEL p; \
+ PIO_STACK_LOCATION _IRPSP; \
+ if ( CompRoutine != NULL) { \
+ IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\
+ } else { \
+ IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \
+ } \
+ _IRPSP = IoGetNextIrpStackLocation (Irp); \
+ _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \
+ _IRPSP->MinorFunction = TDI_DISCONNECT; \
+ _IRPSP->DeviceObject = DevObj; \
+ _IRPSP->FileObject = FileObj; \
+ p = (PTDI_REQUEST_KERNEL)&_IRPSP->Parameters; \
+ p->RequestFlags = Flags; \
+ p->RequestConnectionInformation = RequestConnectionInfo; \
+ p->ReturnConnectionInformation = ReturnConnectionInfo; \
+ p->RequestSpecific = (PVOID)Time; \
+ }
+
+#define TdiBuildReceive(Irp, DevObj, FileObj, CompRoutine, Contxt, MdlAddr, InFlags, ReceiveLen)\
+ { \
+ PTDI_REQUEST_KERNEL_RECEIVE p; \
+ PIO_STACK_LOCATION _IRPSP; \
+ if ( CompRoutine != NULL) { \
+ IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\
+ } else { \
+ IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \
+ } \
+ _IRPSP = IoGetNextIrpStackLocation (Irp); \
+ _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \
+ _IRPSP->MinorFunction = TDI_RECEIVE; \
+ _IRPSP->DeviceObject = DevObj; \
+ _IRPSP->FileObject = FileObj; \
+ p = (PTDI_REQUEST_KERNEL_RECEIVE)&_IRPSP->Parameters; \
+ p->ReceiveFlags = InFlags; \
+ p->ReceiveLength = ReceiveLen; \
+ Irp->MdlAddress = MdlAddr; \
+ }
+
+#define TdiBuildSend(Irp, DevObj, FileObj, CompRoutine, Contxt, MdlAddr, InFlags, SendLen)\
+ { \
+ PTDI_REQUEST_KERNEL_SEND p; \
+ PIO_STACK_LOCATION _IRPSP; \
+ if ( CompRoutine != NULL) { \
+ IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\
+ } else { \
+ IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \
+ } \
+ _IRPSP = IoGetNextIrpStackLocation (Irp); \
+ _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \
+ _IRPSP->MinorFunction = TDI_SEND; \
+ _IRPSP->DeviceObject = DevObj; \
+ _IRPSP->FileObject = FileObj; \
+ p = (PTDI_REQUEST_KERNEL_SEND)&_IRPSP->Parameters; \
+ p->SendFlags = InFlags; \
+ p->SendLength = SendLen; \
+ Irp->MdlAddress = MdlAddr; \
+ }
+
+#define TdiBuildSendDatagram(Irp, DevObj, FileObj, CompRoutine, Contxt, MdlAddr, SendLen, SendDatagramInfo)\
+ { \
+ PTDI_REQUEST_KERNEL_SENDDG p; \
+ PIO_STACK_LOCATION _IRPSP; \
+ if ( CompRoutine != NULL) { \
+ IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\
+ } else { \
+ IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \
+ } \
+ _IRPSP = IoGetNextIrpStackLocation (Irp); \
+ _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \
+ _IRPSP->MinorFunction = TDI_SEND_DATAGRAM; \
+ _IRPSP->DeviceObject = DevObj; \
+ _IRPSP->FileObject = FileObj; \
+ p = (PTDI_REQUEST_KERNEL_SENDDG)&_IRPSP->Parameters; \
+ p->SendLength = SendLen; \
+ p->SendDatagramInformation = SendDatagramInfo; \
+ Irp->MdlAddress = MdlAddr; \
+ }
+
+#define TdiBuildReceiveDatagram(Irp, DevObj, FileObj, CompRoutine, Contxt, MdlAddr, ReceiveLen, ReceiveDatagramInfo, ReturnInfo, InFlags)\
+ { \
+ PTDI_REQUEST_KERNEL_RECEIVEDG p; \
+ PIO_STACK_LOCATION _IRPSP; \
+ if ( CompRoutine != NULL) { \
+ IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\
+ } else { \
+ IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \
+ } \
+ _IRPSP = IoGetNextIrpStackLocation (Irp); \
+ _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \
+ _IRPSP->MinorFunction = TDI_RECEIVE_DATAGRAM; \
+ _IRPSP->DeviceObject = DevObj; \
+ _IRPSP->FileObject = FileObj; \
+ p = (PTDI_REQUEST_KERNEL_RECEIVEDG)&_IRPSP->Parameters; \
+ p->ReceiveLength = ReceiveLen; \
+ p->ReceiveDatagramInformation = ReceiveDatagramInfo; \
+ p->ReturnDatagramInformation = ReturnInfo; \
+ p->ReceiveFlags = InFlags; \
+ Irp->MdlAddress = MdlAddr; \
+ }
+
+#define TdiBuildSetEventHandler(Irp, DevObj, FileObj, CompRoutine, Contxt, InEventType, InEventHandler, InEventContext) \
+ { \
+ PTDI_REQUEST_KERNEL_SET_EVENT p; \
+ PIO_STACK_LOCATION _IRPSP; \
+ if ( CompRoutine != NULL) { \
+ IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\
+ } else { \
+ IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \
+ } \
+ _IRPSP = IoGetNextIrpStackLocation (Irp); \
+ _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \
+ _IRPSP->MinorFunction = TDI_SET_EVENT_HANDLER; \
+ _IRPSP->DeviceObject = DevObj; \
+ _IRPSP->FileObject = FileObj; \
+ p = (PTDI_REQUEST_KERNEL_SET_EVENT)&_IRPSP->Parameters; \
+ p->EventType = InEventType; \
+ p->EventHandler = (PVOID)InEventHandler; \
+ p->EventContext = (PVOID)InEventContext; \
+ }
+
+#define TdiBuildQueryInformation(Irp, DevObj, FileObj, CompRoutine, Contxt, QType, MdlAddr)\
+ { \
+ PTDI_REQUEST_KERNEL_QUERY_INFORMATION p; \
+ PIO_STACK_LOCATION _IRPSP; \
+ Irp->MdlAddress = MdlAddr; \
+ if ( CompRoutine != NULL) { \
+ IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\
+ } else { \
+ IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \
+ } \
+ _IRPSP = IoGetNextIrpStackLocation (Irp); \
+ _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \
+ _IRPSP->MinorFunction = TDI_QUERY_INFORMATION; \
+ _IRPSP->DeviceObject = DevObj; \
+ _IRPSP->FileObject = FileObj; \
+ p = (PTDI_REQUEST_KERNEL_QUERY_INFORMATION)&_IRPSP->Parameters; \
+ p->QueryType = (ULONG)QType; \
+ p->RequestConnectionInformation = NULL; \
+ }
+
+
+#define TdiBuildSetInformation(Irp, DevObj, FileObj, CompRoutine, Contxt, SType, MdlAddr)\
+ { \
+ PTDI_REQUEST_KERNEL_SET_INFORMATION p; \
+ PIO_STACK_LOCATION _IRPSP; \
+ Irp->MdlAddress = MdlAddr; \
+ if ( CompRoutine != NULL) { \
+ IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\
+ } else { \
+ IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \
+ } \
+ _IRPSP = IoGetNextIrpStackLocation (Irp); \
+ _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \
+ _IRPSP->MinorFunction = TDI_SET_INFORMATION; \
+ _IRPSP->DeviceObject = DevObj; \
+ _IRPSP->FileObject = FileObj; \
+ p = (PTDI_REQUEST_KERNEL_SET_INFORMATION)&_IRPSP->Parameters; \
+ p->SetType = (ULONG)SType; \
+ p->RequestConnectionInformation = NULL; \
+ }
+
+#define TdiBuildAction(Irp, DevObj, FileObj, CompRoutine, Contxt, MdlAddr)\
+ { \
+ PIO_STACK_LOCATION _IRPSP; \
+ if ( CompRoutine != NULL) { \
+ IoSetCompletionRoutine( Irp, CompRoutine, Contxt, TRUE, TRUE, TRUE);\
+ } else { \
+ IoSetCompletionRoutine( Irp, NULL, NULL, FALSE, FALSE, FALSE); \
+ } \
+ _IRPSP = IoGetNextIrpStackLocation (Irp); \
+ _IRPSP->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \
+ _IRPSP->MinorFunction = TDI_ACTION; \
+ _IRPSP->DeviceObject = DevObj; \
+ _IRPSP->FileObject = FileObj; \
+ Irp->MdlAddress = MdlAddr; \
+ }
+
+//
+// definitions for the helper routines for TDI compliant transports and clients
+//
+// Note that the IOCTL used here for the Irp Function is not real; it is used
+// to avoid this IO routine having to map buffers (which we don't want).
+//
+//PIRP
+//TdiBuildInternalDeviceControlIrp (
+// IN CCHAR IrpSubFunction,
+// IN PDEVICE_OBJECT DeviceObject,
+// IN PFILE_OBJECT FileObject,
+// IN PKEVENT Event,
+// IN PIO_STATUS_BLOCK IoStatusBlock
+// );
+
+#define TdiBuildInternalDeviceControlIrp(IrpSubFunction,DeviceObject,FileObject,Event,IoStatusBlock) \
+ IoBuildDeviceIoControlRequest (\
+ 0x00000003,\
+ DeviceObject, \
+ NULL, \
+ 0, \
+ NULL, \
+ 0, \
+ TRUE, \
+ Event, \
+ IoStatusBlock)
+
+
+//
+// VOID
+// TdiCopyLookaheadData(
+// IN PVOID Destination,
+// IN PVOID Source,
+// IN ULONG Length,
+// IN ULONG ReceiveFlags
+// );
+//
+
+#ifdef _M_IX86
+#define TdiCopyLookaheadData(_Destination,_Source,_Length,_ReceiveFlags) \
+ RtlCopyMemory(_Destination,_Source,_Length)
+#else
+#define TdiCopyLookaheadData(_Destination,_Source,_Length,_ReceiveFlags) { \
+ if ((_ReceiveFlags) & TDI_RECEIVE_COPY_LOOKAHEAD) { \
+ RtlCopyMemory(_Destination,_Source,_Length); \
+ } else { \
+ PUCHAR _Src = (PUCHAR)(_Source); \
+ PUCHAR _Dest = (PUCHAR)(_Destination); \
+ PUCHAR _End = _Dest + (_Length); \
+ while (_Dest < _End) { \
+ *_Dest++ = *_Src++; \
+ } \
+ } \
+}
+#endif
+
+
+NTSTATUS
+TdiMapUserRequest(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp,
+ IN PIO_STACK_LOCATION IrpSp
+ );
+
+VOID
+TdiMapBuffer (
+ IN PMDL MdlChain
+ );
+
+VOID
+TdiUnmapBuffer (
+ IN PMDL MdlChain
+ );
+
+NTSTATUS
+TdiCopyBufferToMdl (
+ IN PVOID SourceBuffer,
+ IN ULONG SourceOffset,
+ IN ULONG SourceBytesToCopy,
+ IN PMDL DestinationMdlChain,
+ IN ULONG DestinationOffset,
+ IN PULONG BytesCopied
+ );
+
+NTSTATUS
+TdiCopyMdlToBuffer(
+ IN PMDL SourceMdlChain,
+ IN ULONG SourceOffset,
+ IN PVOID DestinationBuffer,
+ IN ULONG DestinationOffset,
+ IN ULONG DestinationBufferSize,
+ OUT PULONG BytesCopied
+ );
+
+VOID
+TdiBuildNetbiosAddress (
+ IN PUCHAR NetbiosName,
+ IN BOOLEAN IsGroupName,
+ IN OUT PTA_NETBIOS_ADDRESS NetworkName
+ );
+
+NTSTATUS
+TdiBuildNetbiosAddressEa (
+ IN PUCHAR Buffer,
+ IN BOOLEAN IsGroupName,
+ IN PUCHAR NetbiosName
+ );
+
+//++
+//
+// VOID
+// TdiCompleteRequest (
+// IN PIRP Irp,
+// IN NTSTATUS Status
+// );
+//
+// Routine Description:
+//
+// This routine is used to complete an IRP with the indicated
+// status.
+//
+// Arguments:
+//
+// Irp - Supplies a pointer to the Irp to complete
+//
+// Status - Supplies the completion status for the Irp
+//
+// Return Value:
+//
+// None.
+//
+//--
+
+#define TdiCompleteRequest(IRP,STATUS) { \
+ (IRP)->IoStatus.Status = (STATUS); \
+ IoCompleteRequest( (IRP), IO_NETWORK_INCREMENT ); \
+}
+
+
+VOID
+TdiReturnChainedReceives(
+ IN PVOID *TsduDescriptors,
+ IN ULONG NumberOfTsdus
+ );
+
+
+// The type definition for a TDI Bind handler callout. This callout is
+// called when a new transport device arrives.
+
+typedef VOID
+(*TDI_BIND_HANDLER)(
+ IN PUNICODE_STRING DeviceName
+ );
+
+typedef VOID
+(*TDI_UNBIND_HANDLER)(
+ IN PUNICODE_STRING DeviceName
+ );
+
+// The type definition for a TDI address handler callout. This callout is
+// called when a new net address arrives
+
+typedef VOID
+(*TDI_ADD_ADDRESS_HANDLER)(
+ IN PTA_ADDRESS Address
+ );
+
+typedef VOID
+(*TDI_DEL_ADDRESS_HANDLER)(
+ IN PTA_ADDRESS Address
+ );
+
+NTSTATUS
+TdiRegisterNotificationHandler(
+ IN TDI_BIND_HANDLER BindHandler,
+ IN TDI_UNBIND_HANDLER UnbindHandler,
+ OUT HANDLE *BindingHandle
+);
+
+NTSTATUS
+TdiDeregisterNotificationHandler(
+ IN HANDLE BindingHandle
+);
+
+NTSTATUS
+TdiRegisterDeviceObject(
+ IN PUNICODE_STRING DeviceName,
+ OUT HANDLE *RegistrationHandle
+);
+
+NTSTATUS
+TdiDeregisterDeviceObject(
+ IN HANDLE RegistrationHandle
+);
+
+NTSTATUS
+TdiRegisterAddressChangeHandler(
+ IN TDI_ADD_ADDRESS_HANDLER AddHandler,
+ IN TDI_DEL_ADDRESS_HANDLER DeleteHandler,
+ OUT HANDLE *BindingHandle
+);
+
+NTSTATUS
+TdiDeregisterAddressChangeHandler(
+ IN HANDLE BindingHandle
+);
+
+NTSTATUS
+TdiRegisterNetAddress(
+ IN PTA_ADDRESS Address,
+ OUT HANDLE *RegistrationHandle
+);
+
+NTSTATUS
+TdiDeregisterNetAddress(
+ IN HANDLE RegistrationHandle
+);
+
+VOID
+TdiInitialize(
+ VOID
+);
+
+#endif // _TDI_KRNL_
diff --git a/private/inc/tdistat.h b/private/inc/tdistat.h
new file mode 100644
index 000000000..89e9f01da
--- /dev/null
+++ b/private/inc/tdistat.h
@@ -0,0 +1,101 @@
+/********************************************************************/
+/** Microsoft LAN Manager **/
+/** Copyright(c) Microsoft Corp., 1990-1993 **/
+/********************************************************************/
+/* :ts=4 */
+
+//** TDISTAT.H - TDI status code definitions.
+//
+// This file contains the TDI status code definitions.
+
+#ifndef NT
+
+#define TDI_SUCCESS 0 // Success
+#define TDI_NO_RESOURCES 1 // No resources.
+#define TDI_ADDR_IN_USE 2 // Address already in use.
+#define TDI_BAD_ADDR 3 // Address given is bad.
+#define TDI_NO_FREE_ADDR 4 // No addresses available.
+#define TDI_ADDR_INVALID 6 // Address object is invalid.
+#define TDI_ADDR_DELETED 7 // Address object was deleted.
+#define TDI_BUFFER_OVERFLOW 9 // Buffer overflowed.
+#define TDI_BAD_EVENT_TYPE 10 // Bad event type.
+#define TDI_BAD_OPTION 11 // Bad option or length.
+#define TDI_CONN_REFUSED 14 // Connection was refused.
+#define TDI_INVALID_CONNECTION 15 // Invalid connection.
+#define TDI_ALREADY_ASSOCIATED 16 // Connection already associated.
+#define TDI_NOT_ASSOCIATED 17 // Connection not associated.
+#define TDI_CONNECTION_ACTIVE 18 // Connection is still active.
+#define TDI_CONNECTION_ABORTED 19 // Connection was aborted.
+#define TDI_CONNECTION_RESET 20 // Connection was reset.
+#define TDI_TIMED_OUT 21 // Connection timed out.
+#define TDI_GRACEFUL_DISC 22 // Received a graceful disconnect.
+#define TDI_NOT_ACCEPTED 23 // Data not accepted.
+#define TDI_MORE_PROCESSING 24 // More processing required.
+#define TDI_INVALID_STATE 25 // TCB in an invalid state.
+#define TDI_INVALID_PARAMETER 26 // An invalid parameter.
+#define TDI_DEST_NET_UNREACH 27 // Destination net is unreachable.
+#define TDI_DEST_HOST_UNREACH 28 // Dest. host is unreachable.
+#define TDI_DEST_UNREACHABLE TDI_DEST_HOST_UNREACH
+#define TDI_DEST_PROT_UNREACH 29 // Destination protocol is
+ // unreachable.
+#define TDI_DEST_PORT_UNREACH 30 // Dest. port is unreachable.
+#define TDI_INVALID_QUERY 31 // Invalid query type specified.
+#define TDI_REQ_ABORTED 32 // Request was aborted for some
+ // reason.
+#define TDI_BUFFER_TOO_SMALL 33 // Buffer was too small.
+#define TDI_CANCELLED 34 // The request was cancelled.
+#define TDI_BUFFER_TOO_BIG 35 // Send buffer was too big.
+#define TDI_ITEM_NOT_FOUND 36 // Item not found.
+#define TDI_INVALID_REQUEST 0xfe // Invalid request.
+#define TDI_PENDING 0xff // Pending
+
+#else
+
+//
+// Map to NT STATUS codes.
+//
+#define TDI_SUCCESS STATUS_SUCCESS
+#define TDI_NO_RESOURCES STATUS_INSUFFICIENT_RESOURCES
+#define TDI_ADDR_IN_USE STATUS_ADDRESS_ALREADY_EXISTS
+#define TDI_BAD_ADDR STATUS_INVALID_ADDRESS_COMPONENT
+#define TDI_NO_FREE_ADDR STATUS_TOO_MANY_ADDRESSES
+#define TDI_ADDR_INVALID STATUS_INVALID_ADDRESS
+#define TDI_ADDR_DELETED STATUS_ADDRESS_CLOSED
+#define TDI_BUFFER_OVERFLOW STATUS_BUFFER_OVERFLOW
+#define TDI_BAD_EVENT_TYPE STATUS_INVALID_PARAMETER
+#define TDI_BAD_OPTION STATUS_INVALID_PARAMETER
+#define TDI_CONN_REFUSED STATUS_CONNECTION_REFUSED
+#define TDI_INVALID_CONNECTION STATUS_CONNECTION_INVALID
+#define TDI_ALREADY_ASSOCIATED STATUS_ADDRESS_ALREADY_ASSOCIATED
+#define TDI_NOT_ASSOCIATED STATUS_ADDRESS_NOT_ASSOCIATED
+#define TDI_CONNECTION_ACTIVE STATUS_CONNECTION_ACTIVE
+#define TDI_CONNECTION_ABORTED STATUS_CONNECTION_ABORTED
+#define TDI_CONNECTION_RESET STATUS_CONNECTION_RESET
+#define TDI_TIMED_OUT STATUS_IO_TIMEOUT
+#define TDI_GRACEFUL_DISC STATUS_GRACEFUL_DISCONNECT
+#define TDI_NOT_ACCEPTED STATUS_DATA_NOT_ACCEPTED
+#define TDI_MORE_PROCESSING STATUS_MORE_PROCESSING_REQUIRED
+#define TDI_INVALID_STATE STATUS_INVALID_DEVICE_STATE
+#define TDI_INVALID_PARAMETER STATUS_INVALID_PARAMETER
+#define TDI_DEST_NET_UNREACH STATUS_NETWORK_UNREACHABLE
+#define TDI_DEST_HOST_UNREACH STATUS_HOST_UNREACHABLE
+#define TDI_DEST_UNREACHABLE TDI_DEST_HOST_UNREACH
+#define TDI_DEST_PROT_UNREACH STATUS_PROTOCOL_UNREACHABLE
+#define TDI_DEST_PORT_UNREACH STATUS_PORT_UNREACHABLE
+#define TDI_INVALID_QUERY STATUS_INVALID_DEVICE_REQUEST
+#define TDI_REQ_ABORTED STATUS_REQUEST_ABORTED
+#define TDI_BUFFER_TOO_SMALL STATUS_BUFFER_TOO_SMALL
+#define TDI_CANCELLED STATUS_CANCELLED
+#define TDI_BUFFER_TOO_BIG STATUS_INVALID_BUFFER_SIZE
+#define TDI_INVALID_REQUEST STATUS_INVALID_DEVICE_REQUEST
+#define TDI_PENDING STATUS_PENDING
+#define TDI_ITEM_NOT_FOUND STATUS_OBJECT_NAME_NOT_FOUND
+
+
+#endif // NT
+
+#define TDI_OPTION_EOL 0
+
+#define TDI_ADDRESS_OPTION_REUSE 1
+#define TDI_ADDRESS_OPTION_DHCP 2
+
diff --git a/private/inc/tstr.h b/private/inc/tstr.h
new file mode 100644
index 000000000..afd3231a7
--- /dev/null
+++ b/private/inc/tstr.h
@@ -0,0 +1,299 @@
+/*++
+
+Copyright (c) 1991-92 Microsoft Corporation
+
+Module Name:
+
+ tstr.h
+
+Abstract:
+
+ This include file contains manifests and macros to be used to integrate
+ the TCHAR and LPTSTR definitions
+
+ Note that our naming convention is that a "size" indicates a number of
+ bytes whereas a "length" indicates a number of characters.
+
+Author:
+
+ Richard Firth (rfirth) 02-Apr-1991
+
+Environment:
+
+ Portable (Win/32).
+ Requires ANSI C extensions: slash-slash comments, long external names,
+ _ultoa() routine.
+
+Revision History:
+
+ 22-May-1991 Danl
+ Added STRSIZE macro
+ 19-May-1991 JohnRo
+ Changed some parm names to make things easier to read.
+ 15-May-1991 rfirth
+ Added TCHAR_SPACE and MAKE_TCHAR() macro
+ 15-Jul-1991 RFirth
+ Added STRING_SPACE_REQD() and DOWN_LEVEL_STRSIZE
+ 05-Aug-1991 JohnRo
+ Added MEMCPY macro.
+ 19-Aug-1991 JohnRo
+ Added character type stuff: ISDIGIT(), TOUPPER(), etc.
+ 20-Aug-1991 JohnRo
+ Changed strnicmp to _strnicmp to keep PC-LINT happy. Ditto stricmp.
+ 13-Sep-1991 JohnRo
+ Need UNICODE STRSIZE() too.
+ 13-Sep-1991 JohnRo
+ Added UNICODE STRCMP() and various others.
+ 18-Oct-1991 JohnRo
+ Added NetpCopy routines and WCSSIZE().
+ 26-Nov-1991 JohnRo
+ Added NetpNCopy routines (like strncpy but do conversions as well).
+ 09-Dec-1991 rfirth
+ Added STRREV
+ 03-Jan-1992 JohnRo
+ Added NetpAlloc{type}From{type} routines and macros.
+ 09-Jan-1992 JohnRo
+ Added ATOL() macro and wtol() routine.
+ Ditto ULTOA() macro and ultow() routine.
+ 16-Jan-1992 Danl
+ Cut this info from \net\inc\tstring.h
+ 30-Jan-1992 JohnRo
+ Added STRSTR().
+ Use _wcsupr() instead of wcsupr() to keep PC-LINT happy.
+ Added STRCMPI() and STRNCMPI().
+ Fixed a few definitions which were missing MAKE_STR_FUNCTION etc.
+ 14-Mar-1992 JohnRo
+ Avoid compiler warnings using WCSSIZE(), MEMCPY(), etc.
+ Added TCHAR_TAB.
+ 09-Apr-1992 JohnRo
+ Prepare for WCHAR.H (_wcsicmp vs _wcscmpi, etc).
+
+--*/
+
+#ifndef _TSTR_H_INCLUDED
+#define _TSTR_H_INCLUDED
+
+#include <ctype.h> // isdigit(), iswdigit() eventually, etc.
+#include <stdlib.h> // atol(), _ultoa().
+#include <string.h> // memcpy(), strlen(), etc.
+#include <wchar.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+LPWSTR
+ultow (
+ IN DWORD Value,
+ OUT LPWSTR Area,
+ IN DWORD Radix
+ );
+
+LONG
+wtol (
+ IN LPWSTR Src
+ );
+
+
+#ifdef LM20_COMPATIBLE
+#define MAKE_STR_FUNCTION(s) s##f
+#else
+#define MAKE_STR_FUNCTION(s) s
+#endif
+
+
+#if defined(UNICODE)
+
+//
+// function macro prototypes
+//
+
+#define ATOL(Src) (LONG)MAKE_STR_FUNCTION(wtol)(Src)
+
+#define ISALNUM(tchar) iswalnum(tchar) // locale-dependent.
+#define ISALPHA(tchar) iswalpha(tchar) // locale-dependent.
+#define ISCNTRL(tchar) iswcntrl(tchar) // locale-dependent.
+#define ISDIGIT(tchar) iswdigit(tchar)
+#define ISGRAPH(tchar) iswgraph(tchar) // locale-dependent.
+#define ISLOWER(tchar) iswlower(tchar) // locale-dependent.
+#define ISPRINT(tchar) iswprint(tchar) // locale-dependent.
+#define ISPUNCT(tchar) iswpunct(tchar) // locale-dependent.
+#define ISSPACE(tchar) iswspace(tchar) // locale-dependent.
+#define ISUPPER(tchar) iswupper(tchar) // locale-dependent.
+#define ISXDIGIT(tchar) iswxdigit(tchar)
+
+#define STRCAT(dest, src) (LPTSTR)MAKE_STR_FUNCTION(wcscat)((dest), (src))
+#define STRCHR(s1, c) (LPTSTR)MAKE_STR_FUNCTION(wcschr)((s1), (c))
+#define STRCPY(dest, src) (LPTSTR)MAKE_STR_FUNCTION(wcscpy)((dest), (src))
+#define STRCSPN(s, c) (DWORD)MAKE_STR_FUNCTION(wcscspn)((s), (c))
+// STRLEN: Get character count of s.
+#define STRLEN(s) (DWORD)MAKE_STR_FUNCTION(wcslen)(s)
+#define STRNCAT(dest, src, n) \
+ (LPTSTR)MAKE_STR_FUNCTION(wcsncat)((dest), (src), (n))
+#define STRNCPY(dest, src, n) \
+ (LPTSTR)MAKE_STR_FUNCTION(wcsncpy)((dest), (src), (n))
+#define STRSPN(s1, s2) (DWORD)MAKE_STR_FUNCTION(wcsspn)((s1), (s2))
+#define STRRCHR (LPTSTR)MAKE_STR_FUNCTION(wcsrchr)
+#define STRSTR (LPTSTR)MAKE_STR_FUNCTION(wcswcs)
+#define STRUPR(s) (LPTSTR)MAKE_STR_FUNCTION(_wcsupr)(s)
+
+// these don't have formal parameters because we want to take the address of
+// the mapped function in certain cases. Modify as appropriate.
+// Note that for these functions, lengths are in characters.
+
+// compare functions: len is maximum number of characters being compared.
+#define STRCMP (LONG)MAKE_STR_FUNCTION(wcscmp)
+#define STRCMPI (LONG)MAKE_STR_FUNCTION(_wcsicmp)
+#define STRICMP (LONG)MAKE_STR_FUNCTION(_wcsicmp)
+#define STRNCMP (LONG)MAKE_STR_FUNCTION(wcsncmp)
+#define STRNCMPI (LONG)MAKE_STR_FUNCTION(_wcsnicmp)
+#define STRNICMP (LONG)MAKE_STR_FUNCTION(_wcsnicmp)
+
+#define TOLOWER(tchar) towlower(tchar) // locale-dependent.
+#define TOUPPER(tchar) towupper(tchar) // locale-dependent.
+
+#define ULTOA(Value,Result,Radix) \
+ (LPTSTR)MAKE_STR_FUNCTION(ultow)( (Value), (Result), (Radix) )
+
+//
+// manifests
+//
+
+#define _CHAR_TYPE WCHAR
+
+#else // not UNICODE
+
+//
+// function macro prototypes
+//
+
+#define ATOL(Src) (LONG)MAKE_STR_FUNCTION(atol)(Src)
+
+#define ISALNUM(tchar) isalnum(tchar) // locale-dependent.
+#define ISALPHA(tchar) isalpha(tchar) // locale-dependent.
+#define ISCNTRL(tchar) iscntrl(tchar) // locale-dependent.
+#define ISDIGIT(tchar) isdigit(tchar)
+#define ISGRAPH(tchar) isgraph(tchar) // locale-dependent.
+#define ISLOWER(tchar) islower(tchar) // locale-dependent.
+#define ISPRINT(tchar) isprint(tchar) // locale-dependent.
+#define ISPUNCT(tchar) ispunct(tchar) // locale-dependent.
+#define ISSPACE(tchar) isspace(tchar) // locale-dependent.
+#define ISUPPER(tchar) isupper(tchar) // locale-dependent.
+#define ISXDIGIT(tchar) isxdigit(tchar)
+
+#define STRCAT(dest, src) (LPTSTR)MAKE_STR_FUNCTION(strcat)((dest), (src))
+#define STRNCAT(dest, src, n) \
+ (LPTSTR)MAKE_STR_FUNCTION(strncat)((dest), (src), (n))
+// STRLEN: Get character count of s.
+#define STRLEN(s) (DWORD)MAKE_STR_FUNCTION(strlen)(s)
+#define STRSPN(s1, s2) (DWORD)MAKE_STR_FUNCTION(strspn)((s1), (s2))
+#define STRCSPN(s, c) (DWORD)MAKE_STR_FUNCTION(strcspn)((s), (c))
+#define STRCPY(dest, src) (LPTSTR)MAKE_STR_FUNCTION(strcpy)((dest), (src))
+#define STRNCPY(dest, src, n) \
+ (LPTSTR)MAKE_STR_FUNCTION(strncpy)((dest), (src), (n))
+#define STRCHR(s1, c) (LPTSTR)MAKE_STR_FUNCTION(strchr)((s1), (c))
+#define STRRCHR (LPTSTR)MAKE_STR_FUNCTION(strrchr)
+#define STRSTR (LPTSTR)MAKE_STR_FUNCTION(strstr)
+#define STRUPR(s) (LPTSTR)MAKE_STR_FUNCTION(strupr)(s)
+#define STRREV(s) (LPTSTR)MAKE_STR_FUNCTION(strrev)(s)
+
+// these don't have formal parameters because we want to take the address of
+// the mapped function in certain cases. Modify as appropriate.
+// Note that for these functions, lengths are in characters.
+
+// compare functions: len is maximum number of characters being compared.
+#define STRCMP (LONG)MAKE_STR_FUNCTION(strcmp)
+#define STRCMPI (LONG)MAKE_STR_FUNCTION(_stricmp)
+#define STRICMP (LONG)MAKE_STR_FUNCTION(_stricmp)
+#define STRNCMP (LONG)MAKE_STR_FUNCTION(strncmp)
+#define STRNCMPI (LONG)MAKE_STR_FUNCTION(_strnicmp)
+#define STRNICMP (LONG)MAKE_STR_FUNCTION(_strnicmp)
+
+#define TOLOWER(tchar) tolower(tchar) // locale-dependent.
+#define TOUPPER(tchar) toupper(tchar) // locale-dependent.
+
+#define ULTOA(Value,Result,Radix) \
+ (LPTSTR)MAKE_STR_FUNCTION(_ultoa)( (Value), (Result), (Radix) )
+
+//
+// manifests
+//
+
+#define _CHAR_TYPE TCHAR
+
+#endif // not UNICODE
+
+
+//
+// For the memory routines, the counts are always BYTE counts.
+//
+#define MEMCPY MAKE_STR_FUNCTION(memcpy)
+#define MEMMOVE MAKE_STR_FUNCTION(memmove)
+
+//
+// These are used to determine the number of bytes (including the NUL
+// terminator) in a string. This will generally be used when
+// calculating the size of a string for allocation purposes.
+//
+
+#define STRSIZE(p) ((STRLEN(p)+1) * sizeof(TCHAR))
+#define WCSSIZE(s) ((MAKE_STR_FUNCTION(wcslen)(s)+1) * sizeof(WCHAR))
+
+
+//
+// character literals (both types)
+//
+
+#define TCHAR_EOS ((_CHAR_TYPE)'\0')
+#define TCHAR_STAR ((_CHAR_TYPE)'*')
+#define TCHAR_BACKSLASH ((_CHAR_TYPE)'\\')
+#define TCHAR_FWDSLASH ((_CHAR_TYPE)'/')
+#define TCHAR_COLON ((_CHAR_TYPE)':')
+#define TCHAR_DOT ((_CHAR_TYPE)'.')
+#define TCHAR_SPACE ((_CHAR_TYPE)' ')
+#define TCHAR_TAB ((_CHAR_TYPE)'\t')
+
+
+//
+// General purpose macro for casting character types to whatever type in vogue
+// (as defined in this file)
+//
+
+#define MAKE_TCHAR(c) ((_CHAR_TYPE)(c))
+
+//
+// IS_PATH_SEPARATOR
+//
+// lifted from curdir.c and changed to use TCHAR_ character literals, checks
+// if a character is a path separator i.e. is a member of the set [\/]
+//
+
+#define IS_PATH_SEPARATOR(ch) ((ch == TCHAR_BACKSLASH) || (ch == TCHAR_FWDSLASH))
+
+//
+// The following 2 macros lifted from I_Net canonicalization files
+//
+
+#define IS_DRIVE(c) ISALPHA(c)
+#define IS_NON_ZERO_DIGIT(c) (((c) >= MAKE_TCHAR('1')) && ((c) <= MAKE_TCHAR('9')))
+
+//
+// STRING_SPACE_REQD returns a number (of bytes) corresponding to the space
+// required in which (n) characters can be accomodated
+//
+
+#define STRING_SPACE_REQD(n) ((n) * sizeof(_CHAR_TYPE))
+
+//
+// DOWN_LEVEL_STRLEN returns the number of single-byte characters necessary to
+// store a converted _CHAR_TYPE string. This will be WCHAR (or wchar_t) if
+// UNICODE is defined or CHAR (or char) otherwise
+//
+
+#define DOWN_LEVEL_STRSIZE(n) ((n) / sizeof(_CHAR_TYPE))
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _TSTR_H_INCLUDED
diff --git a/private/inc/uiexport.h b/private/inc/uiexport.h
new file mode 100644
index 000000000..8dc92c48d
--- /dev/null
+++ b/private/inc/uiexport.h
@@ -0,0 +1,138 @@
+/**********************************************************************/
+/** Microsoft Windows NT **/
+/** Copyright(c) Microsoft Corp., 1992 **/
+/**********************************************************************/
+
+/*
+ uiexport.h
+
+ Prototypes for Net UI exported APIs
+
+
+
+ FILE HISTORY:
+ Johnl 17-Apr-1992 Created
+
+*/
+
+#ifndef _UIEXPORT_H_
+#define _UIEXPORT_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Selections the user can make in the System focus dialog
+ */
+
+/* Low word of the selection type
+ */
+#define FOCUSDLG_DOMAINS_ONLY (1)
+#define FOCUSDLG_SERVERS_ONLY (2)
+#define FOCUSDLG_SERVERS_AND_DOMAINS (3)
+
+/* High word of the selection type contains a bitmask indicating
+ * which domains to display in the dialog.
+ * WARNING: This bitmask are shifted up 16 bits from the bitmask in
+ * \nt\private\net\ui\common\h\domenum.h. If you want to
+ * modify the values of the bitmask, you will need to
+ * make corresponding changes to domenum.h.
+ *
+ */
+
+#define FOCUSDLG_BROWSE_LOGON_DOMAIN 0x00010000
+#define FOCUSDLG_BROWSE_WKSTA_DOMAIN 0x00020000
+#define FOCUSDLG_BROWSE_OTHER_DOMAINS 0x00040000
+#define FOCUSDLG_BROWSE_TRUSTING_DOMAINS 0x00080000
+#define FOCUSDLG_BROWSE_WORKGROUP_DOMAINS 0x00100000
+
+/* Some handy combinations of flags.
+*/
+
+/* FOCUSDLG_BROWSE_LM2X_DOMAINS will return only the domains available
+ from a LanMan 2.x workstation. This returns just the logon,
+ workstation, and other domains. This is the default value.
+*/
+
+#define FOCUSDLG_BROWSE_LM2X_DOMAINS ( FOCUSDLG_BROWSE_LOGON_DOMAIN | \
+ FOCUSDLG_BROWSE_WKSTA_DOMAIN | \
+ FOCUSDLG_BROWSE_OTHER_DOMAINS )
+
+/*
+ FOCUSDLG_BROWSE_LOCAL_DOMAINS will return only the domains available
+ to the local machine. This returns the logon, workstation,
+ and other, plus the domains that trust "us".
+*/
+
+#define FOCUSDLG_BROWSE_LOCAL_DOMAINS ( FOCUSDLG_BROWSE_LM2X_DOMAINS | \
+ FOCUSDLG_BROWSE_TRUSTING_DOMAINS )
+
+/*
+ FOCUSDLG_BROWSE_ALL_DOMAINS is a conglomeration of all potential domain
+ sources available to the domain enumerator.
+*/
+
+#define FOCUSDLG_BROWSE_ALL_DOMAINS ( FOCUSDLG_BROWSE_LOCAL_DOMAINS | \
+ FOCUSDLG_BROWSE_WORKGROUP_DOMAINS )
+
+/*******************************************************************
+
+ NAME: I_SystemFocusDialog
+
+ SYNOPSIS: Presents a dialog to the user from which a server or domain
+ maybe selected.
+
+ ENTRY: hwndOwner - Parent window handle
+ nSelectionType - The type of selection the user is allowed
+ to make
+ pszName - The server or domain name. It will be
+ undefined if the user hits the CANCEL
+ button ( pfOK = FALSE )
+ cchBufSize - The buffer size of the lptstrName.
+ pfUserQuit - If the user hits the OKAY button, it will
+ return TRUE. Otherwise, it will return FALSE.
+ pszHelpFile - The helpfile to use when the user hits F1.
+ If NULL, the default helpfile is used.
+ nHelpContext - The helpcontext to use for the helpfile above.
+ If the above is NULL, this must be 0 (& vice
+ versa).
+
+ EXIT: if *pfOKPressed is TRUE (and an error didn't occur), then
+ lptstrName will be filled with the user selected name.
+
+ RETURNS: NO_ERROR on success, standard ERROR_* error code otherwise
+
+ NOTES: This will be a UNICODE only API when the net group goes UNICODE
+
+ HISTORY:
+ JohnL 22-Apr-1992 Added selection option, exported to private\inc
+ ChuckC 03-Nov-1992 Added helpfile & help context
+
+********************************************************************/
+
+UINT FAR PASCAL I_SystemFocusDialog(
+ HWND hwndOwner,
+ UINT nSelectionType,
+ LPWSTR pszName,
+ UINT cchBufSize,
+ BOOL *pfOKPressed,
+ LPWSTR pszHelpFile,
+ DWORD nHelpContext
+ );
+
+typedef UINT (FAR PASCAL *LPFNI_SYSTEMFOCUSDIALOG)(
+ HWND hwndOwner,
+ UINT nSelectionType,
+ LPWSTR pszName,
+ UINT cchBufSize,
+ BOOL *pfOKPressed,
+ LPWSTR pszHelpFile,
+ DWORD nHelpContext
+ );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //_UIEXPORT_H_
diff --git a/private/inc/unimdmp.h b/private/inc/unimdmp.h
new file mode 100644
index 000000000..06f776b21
--- /dev/null
+++ b/private/inc/unimdmp.h
@@ -0,0 +1,47 @@
+
+//---------------------------------------------------------------------------
+//
+// Copyright (c) Microsoft Corporation 1993-1996
+//
+// File: unimdmp.h
+//
+// This file contains private modem structures and defines shared
+// between Unimodem components, and components that invoke the Unimodem
+// class installer.
+//
+//---------------------------------------------------------------------------
+
+#ifndef __UNIMDMP_H__
+#define __UNIMDMP_H__
+
+
+#ifndef __ROVCOMM_H__
+#define MAX_BUF_SHORT 32
+#endif // __ROVCOMM_H__
+
+// Unattended install parameters
+typedef struct _tagInstallParams
+{
+ BOOL bUnattended;
+ TCHAR szPort[MAX_BUF_SHORT];
+ TCHAR szInfName[MAX_PATH];
+ TCHAR szInfSect[LINE_LEN];
+
+} INSTALLPARAMS, FAR *LPINSTALLPARAMS;
+
+
+// This structure is the private structure that may be
+// specified in the SP_INSTALLWIZARD_DATA's PrivateData field.
+typedef struct tagMODEM_INSTALL_WIZARD
+{
+ DWORD cbSize;
+ DWORD Flags; // MIWF_ bit field
+ DWORD ExitButton; // PSBTN_ value
+ LPARAM PrivateData;
+ INSTALLPARAMS InstallParams;
+
+} MODEM_INSTALL_WIZARD, * PMODEM_INSTALL_WIZARD;
+
+
+#endif // __UNIMDMP_H__
+
diff --git a/private/inc/vdm.h b/private/inc/vdm.h
new file mode 100644
index 000000000..713742bb0
--- /dev/null
+++ b/private/inc/vdm.h
@@ -0,0 +1,354 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ vdm.h
+
+Abstract:
+
+ This include file defines the usermode visible portions of the vdm support
+
+Author:
+
+Revision History:
+
+--*/
+
+/* XLATOFF */
+
+#ifndef _VDM_H_
+#define _VDM_H_
+
+
+
+typedef enum _VdmServiceClass {
+ VdmStartExecution, // is also defined in ntos\ke\i386\biosa.asm
+ VdmQueueInterrupt,
+ VdmDelayInterrupt,
+ VdmInitialize,
+ VdmFeatures,
+ VdmSetInt21Handler,
+ VdmQueryDir,
+ VdmPrinterDirectIoOpen,
+ VdmPrinterDirectIoClose,
+} VDMSERVICECLASS, *PVDMSERVICECLASS;
+
+
+#if defined (_NTDEF_)
+
+NTSTATUS
+NtVdmControl(
+ IN VDMSERVICECLASS Service,
+ IN OUT PVOID ServiceData
+ );
+
+typedef struct _VdmQueryDirInfo {
+ HANDLE FileHandle;
+ PVOID FileInformation;
+ ULONG Length;
+ PUNICODE_STRING FileName;
+ ULONG FileIndex;
+} VDMQUERYDIRINFO, *PVDMQUERYDIRINFO;
+
+#endif
+
+
+/*
+ * The Vdm Virtual Ica
+ * note: this structure definition is duplicated in
+ * mvdm\softpc\base\inc\ica.c. KEEP IN SYNC
+ *
+ */
+typedef struct _VdmVirtualIca{
+ LONG ica_count[8]; /* Count of Irq pending not in irr */
+ LONG ica_int_line; /* Current pending interrupt */
+ LONG ica_cpu_int; /* The state of the INT line to the CPU */
+ USHORT ica_base; /* Interrupt base address for cpu */
+ USHORT ica_hipri; /* Line no. of highest priority line */
+ USHORT ica_mode; /* Various single-bit modes */
+ UCHAR ica_master; /* 1 = Master; 0 = Slave */
+ UCHAR ica_irr; /* Interrupt Request Register */
+ UCHAR ica_isr; /* In Service Register */
+ UCHAR ica_imr; /* Interrupt Mask Register */
+ UCHAR ica_ssr; /* Slave Select Register */
+} VDMVIRTUALICA, *PVDMVIRTUALICA;
+
+
+//
+// copied from softpc\base\system\ica.c
+//
+#define ICA_AEOI 0x0020
+#define ICA_SMM 0x0200
+#define ICA_SFNM 0x0100
+
+
+#if defined(i386)
+#define VDM_PM_IRETBOPSEG 0x147
+#define VDM_PM_IRETBOPOFF 0x6
+#define VDM_PM_IRETBOPSIZE 8
+#else
+#define VDM_PM_IRETBOPSEG 0xd3
+#define VDM_PM_IRETBOPOFF 0x0
+#define VDM_PM_IRETBOPSIZE 4
+#endif
+
+#define VDM_RM_IRETBOPSIZE 4
+
+
+
+// VDM state which was earlier in vdmtib->flags has been moved to
+// dos arena at following fixed address.
+#ifdef _VDMNTOS_
+
+#define FIXED_NTVDMSTATE_LINEAR VdmFixedStateLinear
+#define FIXED_NTVDMSTATE_SIZE 4
+
+#else // _VDMNTOS_
+
+/* XLATON */
+#if defined(_PC98_)
+#define FIXED_NTVDMSTATE_SEGMENT 0x60
+#else // !_PC98_
+#define FIXED_NTVDMSTATE_SEGMENT 0x70
+#endif // _PC98_
+
+#define FIXED_NTVDMSTATE_OFFSET 0x14
+#define FIXED_NTVDMSTATE_LINEAR ((FIXED_NTVDMSTATE_SEGMENT << 4) + FIXED_NTVDMSTATE_OFFSET)
+#define FIXED_NTVDMSTATE_SIZE 4
+/* XLATOFF */
+
+#endif // _VDMNTOS_
+
+#if defined (i386)
+ // defined on x86 only since on mips we must reference thru sas
+#define pNtVDMState ((PULONG)FIXED_NTVDMSTATE_LINEAR)
+#endif
+
+/* XLATON */
+//
+// Vdm State Flags
+//
+#define VDM_INT_HARDWARE 0x00000001
+#define VDM_INT_TIMER 0x00000002
+
+ // A bitMask which includes all interrupts
+#define VDM_INTERRUPT_PENDING (VDM_INT_HARDWARE | VDM_INT_TIMER)
+
+#define VDM_BREAK_EXCEPTIONS 0x00000008
+#define VDM_BREAK_DEBUGGER 0x00000010
+#define VDM_PROFILE 0x00000020
+#define VDM_ANALYZE_PROFILE 0x00000040
+
+#define VDM_32BIT_APP 0x00000100
+#define VDM_VIRTUAL_INTERRUPTS 0x00000200
+#define VDM_ON_MIPS 0x00000400
+#define VDM_EXEC 0x00000800
+#define VDM_RM 0x00001000
+
+#define VDM_WOWBLOCKED 0x00100000
+#define VDM_IDLEACTIVITY 0x00200000
+#define VDM_TIMECHANGE 0x00400000
+#define VDM_WOWHUNGAPP 0x00800000
+
+#define VDM_PE_MASK 0x80000000
+
+/* XLATOFF */
+
+//
+// If the size of the structure is changed, ke\i386\instemul.asm must
+// be modified too. If not, it will fail to build
+//
+#pragma pack(1)
+typedef struct _Vdm_InterruptHandler {
+ USHORT CsSelector;
+ USHORT Flags;
+ ULONG Eip;
+} VDM_INTERRUPTHANDLER, *PVDM_INTERRUPTHANDLER;
+#pragma pack()
+
+typedef struct _Vdm_FaultHandler {
+ USHORT CsSelector;
+ USHORT SsSelector;
+ ULONG Eip;
+ ULONG Esp;
+ ULONG Flags;
+} VDM_FAULTHANDLER, *PVDM_FAULTHANDLER;
+
+#pragma pack(1)
+/* XLATON */
+typedef struct _VdmPmStackInfo { /* VDMTIB */
+ USHORT LockCount;
+ USHORT Flags;
+ USHORT SsSelector;
+ USHORT SaveSsSelector;
+ ULONG SaveEsp;
+ ULONG SaveEip;
+ ULONG DosxIntIret;
+ ULONG DosxIntIretD;
+ ULONG DosxFaultIret;
+ ULONG DosxFaultIretD;
+} VDM_PMSTACKINFO, *PVDM_PMSTACKINFO;
+/* XLATOFF */
+#pragma pack()
+
+
+#if defined(i386)
+
+typedef struct _VdmIcaUserData {
+ PVOID pIcaLock; // rtl critical section
+ PVDMVIRTUALICA pIcaMaster;
+ PVDMVIRTUALICA pIcaSlave;
+ PULONG pDelayIrq;
+ PULONG pUndelayIrq;
+ PULONG pDelayIret;
+ PULONG pIretHooked;
+ PULONG pAddrIretBopTable;
+ PHANDLE phWowIdleEvent;
+}VDMICAUSERDATA, *PVDMICAUSERDATA;
+
+typedef struct _VdmDelayIntsServiceData {
+ ULONG Delay; /* Delay Time in usecs */
+ ULONG DelayIrqLine; /* IRQ Number of ints delayed */
+ HANDLE hThread; /* Thread Handle of CurrentMonitorTeb */
+}VDMDELAYINTSDATA, *PVDMDELAYINTSDATA;
+
+typedef struct _VDMSET_INT21_HANDLER_DATA {
+ ULONG Selector;
+ ULONG Offset;
+ BOOLEAN Gate32;
+}VDMSET_INT21_HANDLER_DATA, *PVDMSET_INT21_HANDLER_DATA;
+
+#if defined (_NTDEF_)
+NTSTATUS
+NtVdmControl(
+ IN VDMSERVICECLASS Service,
+ IN OUT PVOID ServiceData
+ );
+
+//
+// Interrupt handler flags
+//
+
+#define VDM_INT_INT_GATE 0x00000001
+#define VDM_INT_TRAP_GATE 0x00000000
+#define VDM_INT_32 0x00000002
+#define VDM_INT_16 0x00000000
+
+
+typedef enum _VdmEventClass {
+ VdmIO,
+ VdmStringIO,
+ VdmMemAccess,
+ VdmIntAck,
+ VdmBop,
+ VdmError,
+ VdmIrq13,
+ VdmMaxEvent
+} VDMEVENTCLASS, *PVDMEVENTCLASS;
+
+// VdmPrinterInfo
+
+#define VDM_NUMBER_OF_LPT 3
+
+#define PRT_MODE_NO_SIMULATION 1
+#define PRT_MODE_SIMULATE_STATUS_PORT 2
+#define PRT_MODE_DIRECT_IO 3
+#define PRT_MODE_VDD_CONNECTED 4
+
+#define PRT_DATA_BUFFER_SIZE 16
+
+typedef struct _Vdm_Printer_Info {
+ PUCHAR prt_State;
+ PUCHAR prt_Control;
+ PUCHAR prt_Status;
+ PUCHAR prt_HostState;
+ USHORT prt_PortAddr[VDM_NUMBER_OF_LPT];
+ HANDLE prt_Handle[VDM_NUMBER_OF_LPT];
+ UCHAR prt_Mode[VDM_NUMBER_OF_LPT];
+ USHORT prt_BytesInBuffer[VDM_NUMBER_OF_LPT];
+ UCHAR prt_Buffer[VDM_NUMBER_OF_LPT][PRT_DATA_BUFFER_SIZE];
+ ULONG prt_Scratch;
+} VDM_PRINTER_INFO, *PVDM_PRINTER_INFO;
+
+
+typedef struct _VdmIoInfo {
+ USHORT PortNumber;
+ USHORT Size;
+ BOOLEAN Read;
+} VDMIOINFO, *PVDMIOINFO;
+
+typedef struct _VdmFaultInfo{
+ ULONG FaultAddr;
+ ULONG RWMode;
+} VDMFAULTINFO, *PVDMFAULTINFO;
+
+
+typedef struct _VdmStringIoInfo {
+ USHORT PortNumber;
+ USHORT Size;
+ BOOLEAN Rep;
+ BOOLEAN Read;
+ ULONG Count;
+ ULONG Address;
+} VDMSTRINGIOINFO, *PVDMSTRINGIOINFO;
+
+typedef ULONG VDMBOPINFO;
+typedef NTSTATUS VDMERRORINFO;
+
+
+typedef ULONG VDMINTACKINFO;
+#define VDMINTACK_RAEOIMASK 0x0000ffff
+#define VDMINTACK_SLAVE 0x00010000
+#define VDMINTACK_AEOI 0x00020000
+
+
+typedef struct _VdmEventInfo {
+ ULONG Size;
+ VDMEVENTCLASS Event;
+ ULONG InstructionSize;
+ union {
+ VDMIOINFO IoInfo;
+ VDMSTRINGIOINFO StringIoInfo;
+ VDMBOPINFO BopNumber;
+ VDMFAULTINFO FaultInfo;
+ VDMERRORINFO ErrorStatus;
+ VDMINTACKINFO IntAckInfo;
+ };
+} VDMEVENTINFO, *PVDMEVENTINFO;
+
+
+// Sudeepb 12-Mar-1993
+// Scratch areas are used from VDMTib to get user space while
+// in kernel. This allows us to make Nt APIs (faster) from kernel
+// rather than Zw apis (slower). These are currently being used
+// for DOS read/write.
+
+typedef struct _Vdm_Tib {
+ ULONG Size;
+ VDM_INTERRUPTHANDLER VdmInterruptHandlers[256];
+ VDM_FAULTHANDLER VdmFaultHandlers[32];
+ CONTEXT MonitorContext;
+ CONTEXT VdmContext;
+ VDMEVENTINFO EventInfo;
+ VDM_PRINTER_INFO PrinterInfo;
+ ULONG TempArea1[2]; // Scratch area
+ ULONG TempArea2[2]; // Scratch aArea
+ VDM_PMSTACKINFO PmStackInfo;
+} VDM_TIB, *PVDM_TIB;
+
+#define EFLAGS_TF_MASK 0x00000100
+#define EFLAGS_NT_MASK 0x00004000
+
+//
+// Feature flags returned by NtVdmControl(VdmFeatures...)
+//
+
+// System/processor supports fast emulation for IF instructions
+#define V86_VIRTUAL_INT_EXTENSIONS 0x00000001 // in v86 mode
+#define PM_VIRTUAL_INT_EXTENSIONS 0x00000002 // in protected mode (non-flat)
+
+#endif // if defined _NTDEF_
+#endif
+#endif
diff --git a/private/inc/wanpub.h b/private/inc/wanpub.h
new file mode 100644
index 000000000..dcebe6758
--- /dev/null
+++ b/private/inc/wanpub.h
@@ -0,0 +1,627 @@
+/*++
+
+Copyright (c) 1990-1995 Microsoft Corporation
+
+Module Name:
+
+ Wanpub.h
+
+Abstract:
+
+ This file contains all public data structures and defines used
+ by NdisWan. It defines the Ioctl interface to NdisWan as well
+ as the LineUp/LineDown interface between NdisWan and the transports.
+
+Author:
+
+ Tony Bell (TonyBe) June 06, 1995
+
+Environment:
+
+ Kernel Mode
+
+Revision History:
+
+ TonyBe 06/06/95 Created
+
+--*/
+
+#ifndef _NDISWAN_PUB_
+#define _NDISWAN_PUB_
+
+#ifndef NTSTATUS
+typedef LONG NTSTATUS;
+#endif
+
+#ifndef NDIS_HANDLE
+typedef PVOID NDIS_HANDLE, *PNDIS_HANDLE;
+#endif
+
+#ifndef NDIS_STRING
+typedef UNICODE_STRING NDIS_STRING, *PNDIS_STRING;
+#endif
+
+#ifndef NDIS_WAN_QUALITY
+
+#endif
+
+#include <ntddndis.h>
+
+//
+// Different handle types that ndiswan expects
+//
+#define LINKHANDLE 0xABB0
+#define BUNDLEHANDLE 0xABB1
+#define CANCELEDHANDLE 0xABB2
+
+//
+// Different threshold event types
+//
+#define UPPER_THRESHOLD 0x00000000
+#define LOWER_THRESHOLD 0x00000001
+
+//
+// Unroute a bundle
+//
+#define PROTOCOL_UNROUTE 0xFFFF
+
+//
+// Get Bundle's Idle time
+//
+#define BUNDLE_IDLE_TIME 0xFFFF
+
+#define MAX_PPP_HEADER 8
+
+#define MAX_NAME_LENGTH 64
+
+//
+// NDISWAN_IO_PACKET flags
+//
+#define PACKET_IS_DIRECT 0x0001
+#define PACKET_IS_BROADCAST 0x0002
+#define PACKET_IS_MULTICAST 0x0004
+
+
+//
+// Ioctl function codes should be kept contiguous. Dispatch
+// table is in io.c. If a new function is added the dispatch
+// table has to be updated!
+//
+#define FUNC_MAP_CONNECTION_ID 0
+#define FUNC_GET_BUNDLE_HANDLE 1
+#define FUNC_SET_FRIENDLY_NAME 2
+#define FUNC_ROUTE 3
+#define FUNC_ADD_LINK_TO_BUNDLE 4
+#define FUNC_ENUM_LINKS_IN_BUNDLE 5
+#define FUNC_SET_PROTOCOL_PRIORITY 6
+#define FUNC_SET_BANDWIDTH_ON_DEMAND 7
+#define FUNC_SET_THRESHOLD_EVENT 8
+#define FUNC_FLUSH_THRESHOLD_EVENTS 9
+#define FUNC_SEND_PACKET 10
+#define FUNC_RECEIVE_PACKET 11
+#define FUNC_FLUSH_RECEIVE_PACKETS 12
+#define FUNC_GET_STATS 13
+#define FUNC_SET_LINK_INFO 14
+#define FUNC_GET_LINK_INFO 15
+#define FUNC_SET_COMPRESSION_INFO 16
+#define FUNC_GET_COMPRESSION_INFO 17
+#define FUNC_SET_BRIDGE_INFO 18
+#define FUNC_GET_BRIDGE_INFO 19
+#define FUNC_SET_VJ_INFO 20
+#define FUNC_GET_VJ_INFO 21
+#define FUNC_SET_CIPX_INFO 22
+#define FUNC_GET_CIPX_INFO 23
+#define FUNC_SET_ENCRYPTION_INFO 24
+#define FUNC_GET_ENCRYPTION_INFO 25
+#define FUNC_SET_DEBUG_INFO 26
+#define FUNC_ENUM_ACTIVE_BUNDLES 27
+#define FUNC_GET_NDISWANCB 28
+#define FUNC_GET_ADAPTERCB 29
+#define FUNC_GET_WAN_ADAPTERCB 30
+#define FUNC_GET_BANDWIDTH_UTILIZATION 31
+#define FUNC_ENUM_PROTOCOL_UTILIZATION 32
+#define FUNC_ENUM_ADAPTERCB 33
+#define FUNC_ENUM_WAN_ADAPTERCB 34
+#define FUNC_GET_WAN_INFO 35
+#define FUNC_GET_IDLE_TIME 36
+#define FUNC_UNROUTE 37
+
+
+#ifdef NT // NT Specific stuff
+
+#define FILE_DEVICE_NDISWAN 0x030
+
+#define NDISWAN_CTL_CODE(_Function) CTL_CODE(FILE_DEVICE_NDISWAN, _Function, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_NDISWAN_MAP_CONNECTION_ID NDISWAN_CTL_CODE(FUNC_MAP_CONNECTION_ID )
+#define IOCTL_NDISWAN_GET_BUNDLE_HANDLE NDISWAN_CTL_CODE(FUNC_GET_BUNDLE_HANDLE )
+#define IOCTL_NDISWAN_SET_FRIENDLY_NAME NDISWAN_CTL_CODE(FUNC_SET_FRIENDLY_NAME )
+#define IOCTL_NDISWAN_ROUTE NDISWAN_CTL_CODE(FUNC_ROUTE )
+#define IOCTL_NDISWAN_ADD_LINK_TO_BUNDLE NDISWAN_CTL_CODE(FUNC_ADD_LINK_TO_BUNDLE )
+#define IOCTL_NDISWAN_ENUM_LINKS_IN_BUNDLE NDISWAN_CTL_CODE(FUNC_ENUM_LINKS_IN_BUNDLE )
+#define IOCTL_NDISWAN_SET_PROTOCOL_PRIORITY NDISWAN_CTL_CODE(FUNC_SET_PROTOCOL_PRIORITY )
+#define IOCTL_NDISWAN_SET_BANDWIDTH_ON_DEMAND NDISWAN_CTL_CODE(FUNC_SET_BANDWIDTH_ON_DEMAND)
+#define IOCTL_NDISWAN_SET_THRESHOLD_EVENT NDISWAN_CTL_CODE(FUNC_SET_THRESHOLD_EVENT )
+#define IOCTL_NDISWAN_FLUSH_THRESHOLD_EVENTS NDISWAN_CTL_CODE(FUNC_FLUSH_THRESHOLD_EVENTS)
+#define IOCTL_NDISWAN_SEND_PACKET NDISWAN_CTL_CODE(FUNC_SEND_PACKET )
+#define IOCTL_NDISWAN_RECEIVE_PACKET NDISWAN_CTL_CODE(FUNC_RECEIVE_PACKET )
+#define IOCTL_NDISWAN_FLUSH_RECEIVE_PACKETS NDISWAN_CTL_CODE(FUNC_FLUSH_RECEIVE_PACKETS )
+#define IOCTL_NDISWAN_GET_STATS NDISWAN_CTL_CODE(FUNC_GET_STATS )
+#define IOCTL_NDISWAN_SET_LINK_INFO NDISWAN_CTL_CODE(FUNC_SET_LINK_INFO )
+#define IOCTL_NDISWAN_GET_LINK_INFO NDISWAN_CTL_CODE(FUNC_GET_LINK_INFO )
+#define IOCTL_NDISWAN_SET_COMPRESSION_INFO NDISWAN_CTL_CODE(FUNC_SET_COMPRESSION_INFO )
+#define IOCTL_NDISWAN_GET_COMPRESSION_INFO NDISWAN_CTL_CODE(FUNC_GET_COMPRESSION_INFO )
+#define IOCTL_NDISWAN_SET_BRIDGE_INFO NDISWAN_CTL_CODE(FUNC_SET_BRIDGE_INFO )
+#define IOCTL_NDISWAN_GET_BRIDGE_INFO NDISWAN_CTL_CODE(FUNC_GET_BRIDGE_INFO )
+#define IOCTL_NDISWAN_SET_VJ_INFO NDISWAN_CTL_CODE(FUNC_SET_VJ_INFO )
+#define IOCTL_NDISWAN_GET_VJ_INFO NDISWAN_CTL_CODE(FUNC_GET_VJ_INFO )
+#define IOCTL_NDISWAN_SET_CIPX_INFO NDISWAN_CTL_CODE(FUNC_SET_CIPX_INFO )
+#define IOCTL_NDISWAN_GET_CIPX_INFO NDISWAN_CTL_CODE(FUNC_GET_CIPX_INFO )
+#define IOCTL_NDISWAN_SET_ENCRYPTION_INFO NDISWAN_CTL_CODE(FUNC_SET_ENCRYPTION_INFO )
+#define IOCTL_NDISWAN_GET_ENCRYPTION_INFO NDISWAN_CTL_CODE(FUNC_GET_ENCRYPTION_INFO )
+#define IOCTL_NDISWAN_SET_DEBUG_INFO NDISWAN_CTL_CODE(FUNC_SET_DEBUG_INFO )
+#define IOCTL_NDISWAN_ENUM_ACTIVE_BUNDLES NDISWAN_CTL_CODE(FUNC_ENUM_ACTIVE_BUNDLES )
+#define IOCTL_NDISWAN_GET_NDISWANCB NDISWAN_CTL_CODE(FUNC_GET_NDISWANCB )
+#define IOCTL_NDISWAN_GET_ADAPTERCB NDISWAN_CTL_CODE(FUNC_GET_ADAPTERCB )
+#define IOCTL_NDISWAN_GET_WAN_ADAPTERCB NDISWAN_CTL_CODE(FUNC_GET_WAN_ADAPTERCB )
+#define IOCTL_NDISWAN_GET_BANDWIDTH_UTILIZATION NDISWAN_CTL_CODE(FUNC_GET_BANDWIDTH_UTILIZATION)
+#define IOCTL_NDISWAN_ENUM_PROTOCOL_UTILIZATION NDISWAN_CTL_CODE(FUNC_ENUM_PROTOCOL_UTILIZATION)
+#define IOCTL_NDISWAN_ENUM_ADAPTERCB NDISWAN_CTL_CODE(FUNC_ENUM_ADAPTERCB )
+#define IOCTL_NDISWAN_ENUM_WAN_ADAPTERCB NDISWAN_CTL_CODE(FUNC_ENUM_WAN_ADAPTERCB )
+#define IOCTL_NDISWAN_GET_WAN_INFO NDISWAN_CTL_CODE(FUNC_GET_WAN_INFO )
+#define IOCTL_NDISWAN_GET_IDLE_TIME NDISWAN_CTL_CODE(FUNC_GET_IDLE_TIME )
+#define IOCTL_NDISWAN_UNROUTE NDISWAN_CTL_CODE(FUNC_UNROUTE )
+
+#endif // end NT
+
+//
+// NdisWan error messages
+//
+#define NDISWAN_ERROR_BASE 600
+#define NDISWAN_ERROR_INVALID_HANDLE NDISWAN_ERROR_BASE + 1
+#define NDISWAN_ERROR_ALREADY_ROUTED NDISWAN_ERROR_BASE + 2
+#define NDISWAN_ERROR_NO_ROUTE NDISWAN_ERROR_BASE + 3
+#define NDISWAN_ERROR_INVALID_HANDLE_TYPE NDISWAN_ERROR_BASE + 4
+#define NDISWAN_ERROR_INVALID_ADDRESS NDISWAN_ERROR_BASE + 5
+
+//
+// Structure used to store wan statistics
+//
+typedef struct _WAN_STATS {
+ ULONG BytesTransmitted;
+ ULONG BytesReceived;
+ ULONG FramesTransmitted;
+ ULONG FramesReceived;
+
+ ULONG CRCErrors;
+ ULONG TimeoutErrors;
+ ULONG AlignmentErrors;
+ ULONG SerialOverrunErrors;
+ ULONG FramingErrors;
+ ULONG BufferOverrunErrors;
+
+ ULONG BytesTransmittedUncompressed;
+ ULONG BytesReceivedUncompressed;
+ ULONG BytesTransmittedCompressed;
+ ULONG BytesReceivedCompressed;
+} WAN_STATS, *PWAN_STATS;
+
+//
+// Structure used to get and set WAN Link Information
+// Needs to be kept in sync with NDIS_WAN_SET_LINK_INFO
+// and NDIS_WAN_GET_LINK_INFO in ndiswan.h
+//
+typedef struct _WAN_LINK_INFO {
+ IN ULONG MaxSendFrameSize;
+ IN ULONG MaxRecvFrameSize;
+ ULONG HeaderPadding;
+ ULONG TailPadding;
+ IN ULONG SendFramingBits;
+ IN ULONG RecvFramingBits;
+ IN ULONG SendCompressionBits;
+ IN ULONG RecvCompressionBits;
+ IN ULONG SendACCM;
+ IN ULONG RecvACCM;
+ IN ULONG MaxRSendFrameSize;
+ IN ULONG MaxRRecvFrameSize;
+} WAN_LINK_INFO, *PWAN_LINK_INFO;
+
+//
+// Structure used to get general information about
+// a wan link
+//
+typedef struct _WAN_INFO {
+ OUT ULONG MaxFrameSize;
+ OUT ULONG MaxTransmit;
+ OUT ULONG FramingBits;
+ OUT ULONG DesiredACCM;
+ OUT ULONG MaxReconstructedFrameSize;
+ OUT ULONG LinkSpeed;
+} WAN_INFO, *PWAN_INFO;
+
+//
+// Structure used to set Protocol Utilization
+//
+typedef struct _PROTOCOL_UTILIZATION {
+ USHORT usProtocolType;
+ USHORT usUtilization;
+} PROTOCOL_UTILIZATION, *PPROTOCOL_UTILIZATION;
+
+//
+// Encryption key sizes
+//
+#ifndef MAX_SESSIONKEY_SIZE
+#define MAX_SESSIONKEY_SIZE 8
+#endif
+
+#ifndef MAX_USERSESSIONKEY_SIZE
+#define MAX_USERSESSIONKEY_SIZE 16
+#endif
+
+#ifndef MAX_CHALLENGE_SIZE
+#define MAX_CHALLENGE_SIZE 8
+#endif
+//
+// Structure used to get and set compression information
+//
+typedef struct _COMPRESS_INFO {
+ UCHAR LMSessionKey[MAX_SESSIONKEY_SIZE];
+ UCHAR UserSessionKey[MAX_USERSESSIONKEY_SIZE];
+ UCHAR Challenge[MAX_CHALLENGE_SIZE];
+ ULONG MSCompType;
+
+ UCHAR CompType;
+ USHORT CompLength;
+
+ union {
+ struct {
+ UCHAR CompOUI[3];
+ UCHAR CompSubType;
+ UCHAR CompValues[32];
+ } Proprietary;
+
+ struct {
+ UCHAR CompValues[32];
+ } Public;
+ };
+} COMPRESS_INFO, *PCOMPRESS_INFO;
+
+//
+// Structure used to get and set VJ header compression information
+//
+typedef struct _VJ_INFO {
+ USHORT IPCompressionProtocol;
+ UCHAR MaxSlotID;
+ UCHAR CompSlotID;
+} VJ_INFO, *PVJ_INFO;
+
+//
+// Structure used to get and set IPX header compression information
+//
+typedef struct _CIPX_INFO {
+ USHORT IPXCompressionProtocol;
+} CIPX_INFO, *PCIPX_INFO;
+
+//
+// Structure used to get and set encryption information
+//
+typedef struct __ENCRYPT_INFO {
+ UCHAR EncryptType;
+ USHORT EncryptLength;
+
+ union {
+ struct {
+ UCHAR EncryptOUI[3];
+ UCHAR EncryptSubtype;
+ UCHAR EncryptValues[1];
+ } Proprietary;
+
+ struct {
+ UCHAR EncryptValues[1];
+ } Public;
+ };
+} ENCRYPT_INFO, *PENCRYPT_INFO;
+
+//
+// Structure used in IOCTL_NDISWAN_MAP_CONNECTION_ID
+//
+typedef struct _NDISWAN_MAP_CONNECTION_ID {
+ OUT NDIS_HANDLE hLinkHandle;
+ OUT NDIS_HANDLE hBundleHandle;
+ IN NDIS_HANDLE hConnectionID;
+ IN NDIS_HANDLE hLinkContext;
+ IN NDIS_HANDLE hBundleContext;
+ IN ULONG ulNameLength;
+ IN CHAR szName[1];
+} NDISWAN_MAP_CONNECTION_ID, *PNDISWAN_MAP_CONNECTION_ID;
+
+//
+// Structure used in IOCTL_NDISWAN_GET_BUNDLE_HANDLE
+//
+typedef struct _NDISWAN_GET_BUNDLE_HANDLE {
+ OUT NDIS_HANDLE hBundleHandle;
+ IN NDIS_HANDLE hLinkHandle;
+} NDISWAN_GET_BUNDLE_HANDLE, *PNDISWAN_GET_BUNDLE_HANDLE;
+
+//
+// Structure used in IOCTL_NDISWAN_SET_FRIENDLY_NAME
+//
+typedef struct _NDISWAN_SET_FRIENDLY_NAME {
+ IN NDIS_HANDLE hHandle;
+ IN USHORT usHandleType;
+ IN ULONG ulNameLength;
+ IN CHAR szName[1];
+} NDISWAN_SET_FRIENDLY_NAME, *PNDISWAN_SET_FRIENDLY_NAME;
+
+//
+// Structure used in IOCTL_NDISWAN_ROUTE
+//
+typedef struct _NDISWAN_ROUTE {
+ IN NDIS_HANDLE hBundleHandle;
+ IN USHORT usProtocolType;
+ IN USHORT usBindingNameLength;
+ IN WCHAR BindingName[MAX_NAME_LENGTH];
+ OUT USHORT usDeviceNameLength;
+ OUT WCHAR DeviceName[MAX_NAME_LENGTH];
+ IN ULONG ulBufferLength;
+ IN UCHAR Buffer[1];
+} NDISWAN_ROUTE, *PNDISWAN_ROUTE;
+
+//
+// Structure used in IOCTL_NDISWAN_UNROUTE
+//
+typedef struct _NDISWAN_UNROUTE {
+ IN NDIS_HANDLE hBundleHandle;
+ IN USHORT usProtocolType;
+} NDISWAN_UNROUTE, *PNDISWAN_UNROUTE;
+
+
+//
+// Structure used in IOCTL_NDISWAN_ADD_LINK_TO_BUNDLE
+//
+typedef struct _NDISWAN_ADD_LINK_TO_BUNDLE {
+ IN NDIS_HANDLE hBundleHandle;
+ IN NDIS_HANDLE hLinkHandle;
+} NDISWAN_ADD_LINK_TO_BUNDLE, *PNDISWAN_ADD_LINK_TO_BUNDLE;
+
+//
+// Structure used in IOCTL_NDISWAN_ENUM_LINKS_IN_BUNDLE
+//
+typedef struct _NDISWAN_ENUM_LINKS_IN_BUNDLE {
+ IN NDIS_HANDLE hBundleHandle;
+ OUT ULONG ulNumberOfLinks;
+ OUT NDIS_HANDLE hLinkHandleArray[1];
+} NDISWAN_ENUM_LINKS_IN_BUNDLE, *PNDISWAN_ENUM_LINKS_IN_BUNDLE;
+
+//
+// Structure used in IOCTL_NDISWAN_SET_PROTOCOL_PRIORITY
+//
+typedef struct _NDISWAN_SET_PROTOCOL_PRIORITY {
+ IN NDIS_HANDLE hBundleHandle;
+ IN USHORT usProtocolType;
+ IN USHORT usPriority;
+} NDISWAN_SET_PROTOCOL_PRIORITY, *PNDISWAN_SET_PROTOCOL_PRIORITY;
+
+//
+// Structure used in IOCTL_NDISWAN_SET_BANDWIDTH_ON_DEMAND
+//
+typedef struct _NDISWAN_SET_BANDWIDTH_ON_DEMAND {
+ IN NDIS_HANDLE hBundleHandle;
+ IN USHORT usLowerThreshold;
+ IN USHORT usUpperThreshold;
+ IN ULONG ulLowerSamplePeriod;
+ IN ULONG ulUpperSamplePeriod;
+} NDISWAN_SET_BANDWIDTH_ON_DEMAND, *PNDISWAN_SET_BANDWIDTH_ON_DEMAND;
+
+//
+// Structure used in IOCTL_NDISWAN_SET_THRESHOLD_EVENT
+//
+typedef struct _NDISWAN_SET_THRESHOLD_EVENT {
+ OUT NDIS_HANDLE hBundleHandle;
+ OUT ULONG ulThreshold;
+} NDISWAN_SET_THRESHOLD_EVENT, *PNDISWAN_SET_THRESHOLD_EVENT;
+
+//
+// Structure used in IOCTL_NDISWAN_SEND_PACKET and IOCTL_NDISWAN_RECEIVE_PACKET
+//
+typedef struct _NDISWAN_IO_PACKET {
+ IN OUT NDIS_HANDLE hHandle;
+ IN OUT USHORT usHandleType;
+ IN OUT USHORT usHeaderSize;
+ IN OUT USHORT usPacketSize;
+ IN OUT USHORT usPacketFlags;
+ IN OUT UCHAR PacketData[1];
+} NDISWAN_IO_PACKET, *PNDISWAN_IO_PACKET;
+
+//
+// Structure used in IOCTL_NDISWAN_GET_STATS
+//
+typedef struct _NDISWAN_GET_STATS {
+ IN NDIS_HANDLE hHandle;
+ IN USHORT usHandleType;
+ OUT struct _STATS {
+ OUT WAN_STATS BundleStats;
+ OUT WAN_STATS LinkStats;
+ } Stats;
+} NDISWAN_GET_STATS, *PNDISWAN_GET_STATS;
+
+//
+// Structure used in IOCTL_NDISWAN_GET_BANDWIDTH_UTILIZATION
+//
+typedef struct _NDISWAN_GET_BANDWIDTH_UTILIZATION {
+ IN NDIS_HANDLE hBundleHandle;
+ OUT USHORT usBandwidthUtilization;
+} NDISWAN_GET_BANDWIDTH_UTILIZATION, *PNDISWAN_GET_BANDWIDTH_UTILIZATION;
+
+//
+// Structure used in IOCTL_NDISWAN_ENUM_PROTOCOL_UTILIZATION
+//
+typedef struct _NDISWAN_ENUM_PROTOCOL_UTILIZATION {
+ IN NDIS_HANDLE hBundleHandle;
+ OUT PROTOCOL_UTILIZATION ProtocolArray[1];
+} NDISWAN_ENUM_PROTOCOL_UTILIZATION, *PNDISWAN_ENUM_PROTOCOL_UTILIZATION;
+
+//
+// Structure used in IOCTL_NDISWAN_ENUM_ACTIVE_BUNDLES
+//
+typedef struct _NDISWAN_ENUM_ACTIVE_BUNDLES {
+ OUT ULONG ulNumberOfActiveBundles;
+} NDISWAN_ENUM_ACTIVE_BUNDLES, *PNDISWAN_ENUM_ACTIVE_BUNDLES;
+
+//
+// Structure used in IOCTL_NDISWAN_SET_LINK_INFO
+//
+typedef struct _NDISWAN_SET_LINK_INFO {
+ IN NDIS_HANDLE hLinkHandle;
+ IN WAN_LINK_INFO LinkInfo;
+} NDISWAN_SET_LINK_INFO, *PNDISWAN_SET_LINK_INFO;
+
+//
+// Structure used in IOCTL_NDISWAN_GET_LINK_INFO
+//
+typedef struct _NDISWAN_GET_LINK_INFO {
+ IN NDIS_HANDLE hLinkHandle;
+ OUT WAN_LINK_INFO LinkInfo;
+} NDISWAN_GET_LINK_INFO, *PNDISWAN_GET_LINK_INFO;
+
+//
+// Structure used in IOCTL_NDISWAN_GET_WAN_INFO
+//
+typedef struct _NDISWAN_GET_WAN_INFO {
+ IN NDIS_HANDLE hLinkHandle;
+ OUT WAN_INFO WanInfo;
+} NDISWAN_GET_WAN_INFO, *PNDISWAN_GET_WAN_INFO;
+
+//
+// Structure used in IOCTL_NDISWAN_SET_COMPRESSION_INFO
+//
+typedef struct _NDISWAN_SET_COMPRESSION_INFO {
+ IN NDIS_HANDLE hLinkHandle;
+ IN COMPRESS_INFO SendCapabilities;
+ IN COMPRESS_INFO RecvCapabilities;
+} NDISWAN_SET_COMPRESSION_INFO, *PNDISWAN_SET_COMPRESSION_INFO;
+
+//
+// Structure used in IOCTL_NDISWAN_GET_COMPRESSION_INFO
+//
+typedef struct _NDISWAN_GET_COMPRESSION_INFO {
+ IN NDIS_HANDLE hLinkHandle;
+ OUT COMPRESS_INFO SendCapabilities;
+ OUT COMPRESS_INFO RecvCapabilities;
+} NDISWAN_GET_COMPRESSION_INFO, *PNDISWAN_GET_COMPRESSION_INFO;
+
+//
+// Structure used in IOCTL_NDISWAN_SET_VJ_INFO
+//
+typedef struct _NDISWAN_SET_VJ_INFO {
+ IN NDIS_HANDLE hLinkHandle;
+ IN VJ_INFO SendCapabilities;
+ IN VJ_INFO RecvCapabilities;
+} NDISWAN_SET_VJ_INFO, *PNDISWAN_SET_VJ_INFO;
+
+//
+// Structure used in IOCTL_NDISWAN_GET_VJ_INFO
+//
+typedef struct _NDISWAN_GET_VJ_INFO {
+ IN NDIS_HANDLE hLinkHandle;
+ OUT VJ_INFO SendCapabilities;
+ OUT VJ_INFO RecvCapabilities;
+} NDISWAN_GET_VJ_INFO, *PNDISWAN_GET_VJ_INFO;
+
+//
+// Structure used in IOCTL_NDISWAN_SET_BRIDGE_INFO
+//
+typedef struct _NDISWAN_SET_BRIDGE_INFO {
+ IN NDIS_HANDLE hLinkHandle;
+ IN USHORT LanSegmentNumber;
+ IN UCHAR BridgeNumber;
+ IN UCHAR BridgingOptions;
+ IN ULONG BridgingCapabilities;
+ IN UCHAR BridgingType;
+ IN UCHAR MacBytes[6];
+} NDISWAN_SET_BRIDGE_INFO, *PNDISWAN_SET_BRIDGE_INFO;
+
+//
+// Structure used in IOCTL_NDISWAN_GET_BRIDGE_INFO
+//
+typedef struct _NDISWAN_GET_BRIDGE_INFO {
+ IN NDIS_HANDLE hLinkHandle;
+ OUT USHORT LanSegmentNumber;
+ OUT UCHAR BridgeNumber;
+ OUT UCHAR BridgingOptions;
+ OUT ULONG BridgingCapabilities;
+ OUT UCHAR BridgingType;
+ OUT UCHAR MacBytes[6];
+} NDISWAN_GET_BRIDGE_INFO, *PNDISWAN_GET_BRIDGE_INFO;
+
+//
+// Structure used in IOCTL_NDISWAN_SET_CIPX_INFO
+//
+typedef struct _NDISWAN_SET_CIPX_INFO {
+ IN NDIS_HANDLE hLinkHandle;
+ IN CIPX_INFO SendCapabilities;
+ IN CIPX_INFO RecvCapabilities;
+} NDISWAN_SET_CIPX_INFO, *PNDISWAN_SET_CIPX_INFO;
+
+//
+// Structure used in IOCTL_NDISWAN_GET_CIPX_INFO
+//
+typedef struct _NDISWAN_GET_CIPX_INFO {
+ IN NDIS_HANDLE hLinkHandle;
+ OUT CIPX_INFO SendCapabilities;
+ OUT CIPX_INFO RecvCapabilities;
+} NDISWAN_GET_CIPX_INFO, *PNDISWAN_GET_CIPX_INFO;
+
+//
+// Structure used in IOCTL_NDISWAN_SET_ENCRYPTION_INFO
+//
+typedef struct _NDISWAN_SET_ENCRYPTION_INFO {
+ IN NDIS_HANDLE hLinkHandle;
+ IN ENCRYPT_INFO SendCapabilities;
+ IN ENCRYPT_INFO RecvCapabilities;
+} NDISWAN_SET_ENCRYPTION_INFO, *PNDISWAN_SET_ENCRYPTION_INFO;
+
+//
+// Structure used in IOCTL_NDISWAN_GET_ENCRYPTION_INFO
+//
+typedef struct _NDISWAN_GET_ENCRYPTION_INFO {
+ IN NDIS_HANDLE hLinkHandle;
+ IN ENCRYPT_INFO SendCapabilities;
+ IN ENCRYPT_INFO RecvCapabilities;
+} NDISWAN_GET_ENCRYPTION_INFO, *PNDISWAN_GET_ENCRYPTION_INFO;
+
+//
+// Structure used in IOCTL_NDISWAN_GET_IDLE_TIME
+//
+typedef struct _NDISWAN_GET_IDLE_TIME {
+ IN NDIS_HANDLE hBundleHandle;
+ IN USHORT usProtocolType;
+ OUT ULONG ulSeconds;
+} NDISWAN_GET_IDLE_TIME, *PNDISWAN_GET_IDLE_TIME;
+
+//
+// Structure used in IOCTL_NDISWAN_SET_DEBUG_INFO
+//
+typedef struct _NDISWAN_SET_DEBUG_INFO {
+ IN ULONG ulTraceLevel;
+ IN ULONG ulTraceMask;
+}NDISWAN_SET_DEBUG_INFO, *PNDISWAN_SET_DEBUG_INFO;
+
+//
+// Structure used in IOCTL_NDISWAN_ENUM_ADAPTERCB, WAN_ADAPTERCB
+//
+typedef struct _NDISWAN_ENUMCB {
+ OUT ULONG ulNumberOfCBs;
+ OUT PVOID Address[1];
+} NDISWAN_ENUMCB, *PNDISWAN_ENUMCB;
+
+//
+// Structure used in IOCTL_NDISWAN_GET_NDISWANCB, ADAPTERCB, WAN_ADAPTERCB
+//
+typedef struct _NDISWAN_DUMPCB {
+ IN OUT PVOID Address;
+ OUT UCHAR Buffer[1];
+} NDISWAN_DUMPCB, *PNDISWAN_DUMPCB;
+
+#endif // WAN_PUB
+
diff --git a/private/inc/winsintf.h b/private/inc/winsintf.h
new file mode 100644
index 000000000..87bd3b790
--- /dev/null
+++ b/private/inc/winsintf.h
@@ -0,0 +1,981 @@
+#ifndef WINSINTF_H
+#define WINSINTF_H
+/*++
+
+Copyright (c) 1989 Microsoft Corporation
+
+Module Name:
+
+ winsintf.h
+
+Abstract:
+
+ This is the header file to be included in a client of the WINS
+
+Functions:
+
+
+
+Portability:
+
+
+ This header is portable.
+
+Author:
+
+ Pradeep Bahl (PradeepB) April-1993
+
+
+
+Revision History:
+
+ Modification Date Person Description of Modification
+ ------------------ ------- ---------------------------
+
+--*/
+
+/*
+ includes
+*/
+#include <winbase.h>
+
+#if !defined(MIDL_PASS)
+#include <rpc.h>
+#include <winerror.h>
+#endif
+
+//#include <ntdef.h>
+
+/*
+ defines
+*/
+#define WINSINTF_MAX_NAME_SIZE 255
+
+
+#define WINSINTF_MAX_NO_RPL_PNRS 25
+#define WINSINTF_SUCCESS ERROR_SUCCESS
+#define WINSINTF_FAILURE ERROR_WINS_INTERNAL
+#define WINSINTF_CAN_NOT_DEL_LOCAL_WINS ERROR_CAN_NOT_DEL_LOCAL_WINS
+#define WINSINTF_STATIC_INIT_FAILED ERROR_STATIC_INIT
+#define WINSINTF_INC_BACKUP_FAILED ERROR_INC_BACKUP
+#define WINSINTF_FULL_BACKUP_FAILED ERROR_FULL_BACKUP
+#define WINSINTF_REC_NOT_FOUND ERROR_REC_NON_EXISTENT
+#define WINSINTF_RPL_NOT_ALLOWED ERROR_RPL_NOT_ALLOWED
+
+#define WINSINTF_TOO_MANY_STATIC_INITS ERROR_TOO_MANY_OPEN_FILES
+#define WINSINTF_LAST_FAILURE_CODE WINSINTF_TOO_MANY_STATIC_INITS
+
+#define WINS_BACKUP_DIR_ASCII "\\wins_bak"
+#define WINS_BACKUP_DIR TEXT(WINS_BACKUP_DIR_ASCII)
+
+//
+// Flags that can be set in WINS
+//
+#define WINSINTF_BS 0x01
+#define WINSINTF_MEMORY_INFO_DUMP 0x02
+#define WINSINTF_HEAP_INFO_DUMP 0x04
+#define WINSINTF_QUE_ITEMS_DUMP 0x08
+
+//
+// Type of address families
+//
+#define WINSINTF_TCP_IP 0x0
+
+//
+// Type Of Recs to retrieve (WinsGetDbRecsByName)
+//
+// Note: There should be no ovelap of bit patterns
+//
+#define WINSINTF_STATIC 1
+#define WINSINTF_DYNAMIC 2
+#define WINSINTF_BOTH 4
+
+//
+// Max. members returned for a special group or a multihomed entry
+//
+#define WINSINTF_MAX_MEM 25
+#define WINSINTF_MAX_ADD (WINSINTF_MAX_MEM * 2)
+
+//
+// used as argument of WinsGetDbRecsByName
+//
+#define WINSINTF_BEGINNING 0
+#define WINSINTF_END 1
+
+#if 0
+#define WINSINTF_INC_RPC_THD_CNT \
+ { \
+ EnterCrticalSection(&WinsIntfCrtSec); \
+ WinsIntfNoOfRpcThds++; \
+ LeaveCriticalSection(&WinsIntfCrtSec); \
+ }
+#define WINSINTF_DEC_RPC_THD_CNT \
+ { \
+ EnterCrticalSection(&WinsIntfCrtSec); \
+ WinsIntfNoOfRpcThds--; \
+ LeaveCriticalSection(&WinsIntfCrtSec); \
+ }
+#endif
+/*
+ macros
+*/
+
+//
+// Pass the value of the field NameLen (WINSINTF_RECORD_ACTION_T) to get
+// the actual length of the name
+//
+#define WINSINTF_NAME_LEN_M(NameLen) ((NameLen) - 1)
+
+
+/*
+ externs
+*/
+struct _WINSINTF_STAT_T; //forward declaration
+
+#if !defined(MIDL_PASS)
+extern struct _WINSINTF_STAT_T WinsIntfStat;
+extern CRITICAL_SECTION WinsIntfCrtSec;
+extern CRITICAL_SECTION WinsIntfPotentiallyLongCrtSec;
+#endif
+
+extern DWORD WinsIntfNoOfNbtThds;
+extern DWORD WinsIntfNoCncrntStaticInits;
+//extern DWORD WinsIntfNoOfRpcThds;
+
+#if 0
+typedef struct _BOUNDED_STRING {
+ unsigned short size;
+#if defined(MIDL_PASS)
+ [size_is(size), string] char *pString;
+#else
+ char *pString;
+#endif
+} BOUNDED_STRING_T, *PBOUNDED_STRING_T;
+#endif
+
+#ifndef UNICODE
+#define WinsBind WinsABind
+#else
+#define WinsBind WinsUBind
+#endif
+
+/*
+* typedefs
+*/
+typedef LARGE_INTEGER WINSINTF_VERS_NO_T;
+
+//
+// NOTE NOTE NOTE
+//
+// When UNICODE is defined, the client should put a unicode string in
+// the pServerAdd and pPipeName fields.
+//
+typedef struct _WINSINTF_BIND_DATA_T {
+ DWORD fTcpIp;
+ LPSTR pServerAdd; //IP address
+ LPSTR pPipeName; //unc name
+ } WINSINTF_BIND_DATA_T, *PWINSINTF_BIND_DATA_T;
+
+
+typedef struct _WINSINTF_ADD_T {
+ BYTE Type;
+ DWORD Len;
+ DWORD IPAdd;
+ } WINSINTF_ADD_T, *PWINSINTF_ADD_T;
+
+
+#if 0
+//
+// List of addresses
+//
+typedef struct _WINSINTF_ADD_LIST_T {
+ DWORD NoOfAdds;
+#if defined(MIDL_PASS)
+ [size_is(NoOfAdds)] PWINSINTF_ADD_T pAddList;
+#else
+ PWINSINTF_ADD_T pAddList;
+#endif
+} WINSINTF_ADD_LIST_T, *PWINSINTF_ADD_LIST_T;
+
+#endif
+
+/*
+ enum definitions. Have the enum types be of the same value as given
+ in nmsdb.h for the various types (otherwise modify winsintf.c code)
+*/
+
+//
+// Wins Priority Class
+//
+typedef enum _WINSINTF_PRIORITY_CLASS_E {
+ WINSINTF_E_NORMAL = 0,
+ WINSINTF_E_HIGH
+ } WINSINTF_PRIORITY_CLASS_E, *PWINSINTF_PRIORITY_CLASS_E;
+
+//
+// same values as those defined in nmsdb.h
+//
+
+//
+//NOTE NOTE NOTE
+//
+// For the enum below, WINSINTF_E_MULTIHOMED should be the last entry. If
+// it is not, you should change WinsRecordAction (under MODIFY) in winsintf.c
+//
+// Do not disturb the order without changing wins.mib correspondingly
+//
+typedef enum _WINSINTF_RECTYPE_E {
+ WINSINTF_E_UNIQUE = 0,
+ WINSINTF_E_NORM_GROUP,
+ WINSINTF_E_SPEC_GROUP,
+ WINSINTF_E_MULTIHOMED
+ } WINSINTF_RECTYPE_E, *PWINSINTF_RECTYPE_E;
+
+//
+// Same values as those in NMSDB_STATE_E
+//
+
+//
+//NOTE NOTE NOTE
+//
+// For the enum below, WINSINTF_E_DELETED should be the last entry. If
+// it is not, you should change WinsRecordAction (under MODIFY) in winsintf.c
+//
+// NOTE NOTE NOTE
+//
+// Do not disturb the order without changing wins.mib correspondingly
+//
+typedef enum _WINSINTF_STATE_E {
+ WINSINTF_E_ACTIVE = 0,
+ WINSINTF_E_RELEASED,
+ WINSINTF_E_TOMBSTONE,
+ WINSINTF_E_DELETED
+ } WINSINTF_STATE_E, *PWINSINTF_STATE_E;
+
+typedef enum _WINSINTF_NODE_TYPE_E {
+ WINSINTF_E_BNODE = 0,
+ WINSINTF_E_PNODE,
+ WINSINTF_E_HNODE = 3,
+ } WINSINTF_NODE_TYPE_E, *PWINSINTF_NODE_TYPE_E;
+//
+// Type of action to take on a record. This is passed as the "command" to
+// WinsRecordAction.
+//
+typedef enum _WINSINTF_ACT_E {
+ WINSINTF_E_INSERT = 0,
+ WINSINTF_E_DELETE,
+ WINSINTF_E_RELEASE,
+ WINSINTF_E_MODIFY,
+ WINSINTF_E_QUERY
+ } WINSINTF_ACT_E, *PWINSINTF_ACT_E;
+
+
+//
+// Passed as argument to WinsIntfSetTime
+//
+typedef enum _WINSINTF_TIME_TYPE_E {
+ WINSINTF_E_PLANNED_PULL = 0,
+ WINSINTF_E_ADDCHG_TRIG_PULL,
+ WINSINTF_E_UPDCNT_TRIG_PULL,
+ WINSINTF_E_ADMIN_TRIG_PULL,
+ WINSINTF_E_NTWRK_TRIG_PULL,
+ WINSINTF_E_PLANNED_SCV,
+ WINSINTF_E_ADMIN_TRIG_SCV,
+ WINSINTF_E_TOMBSTONES_SCV,
+ WINSINTF_E_VERIFY_SCV,
+ WINSINTF_E_INIT_DB,
+ WINSINTF_E_WINS_START,
+ WINSINTF_E_COUNTER_RESET
+ } WINSINTF_TIME_TYPE_E, *PWINSINTF_TIME_TYPE_E;
+
+//
+// Type of trigger to send to a WINS
+//
+typedef enum _WINSINTF_TRIG_TYPE_E {
+ WINSINTF_E_PULL = 0,
+ WINSINTF_E_PUSH,
+ WINSINTF_E_PUSH_PROP
+ } WINSINTF_TRIG_TYPE_E, *PWINSINTF_TRIG_TYPE_E;
+
+
+typedef struct _WINSINTF_RECORD_ACTION_T {
+
+ WINSINTF_ACT_E Cmd_e;
+#if defined(MIDL_PASS)
+ [size_is(NameLen)] LPBYTE pName; //ansi form
+#else
+ LPBYTE pName;
+#endif
+
+ DWORD NameLen;
+ DWORD TypOfRec_e;
+ DWORD NoOfAdds;
+#if defined(MIDL_PASS)
+ [unique, size_is(NoOfAdds)] PWINSINTF_ADD_T pAdd;
+#else
+ PWINSINTF_ADD_T pAdd;
+#endif
+
+ WINSINTF_ADD_T Add;
+ LARGE_INTEGER VersNo;
+ BYTE NodeTyp;
+ DWORD OwnerId;
+ DWORD State_e;
+ DWORD fStatic;
+ DWORD TimeStamp;
+ } WINSINTF_RECORD_ACTION_T, *PWINSINTF_RECORD_ACTION_T;
+
+
+typedef struct _WINSINTF_RPL_COUNTERS_T {
+ WINSINTF_ADD_T Add;
+ DWORD NoOfRpls;
+ DWORD NoOfCommFails;
+ } WINSINTF_RPL_COUNTERS_T, *PWINSINTF_RPL_COUNTERS_T;
+//
+// Structure holds the various statistics collected by WINS
+//
+typedef struct _WINSINTF_STAT_T {
+ struct {
+ DWORD NoOfUniqueReg;
+ DWORD NoOfGroupReg;
+ DWORD NoOfQueries;
+ DWORD NoOfSuccQueries;
+ DWORD NoOfFailQueries;
+ DWORD NoOfUniqueRef;
+ DWORD NoOfGroupRef;
+ DWORD NoOfRel;
+ DWORD NoOfSuccRel;
+ DWORD NoOfFailRel;
+ DWORD NoOfUniqueCnf;
+ DWORD NoOfGroupCnf;
+ } Counters;
+ struct {
+ SYSTEMTIME WinsStartTime;
+ SYSTEMTIME LastPScvTime;
+ SYSTEMTIME LastATScvTime; //admin triggered
+ SYSTEMTIME LastTombScvTime;
+ SYSTEMTIME LastVerifyScvTime;
+ SYSTEMTIME LastPRplTime;
+ SYSTEMTIME LastATRplTime; //admin triggered
+ SYSTEMTIME LastNTRplTime; //network triggered
+ SYSTEMTIME LastACTRplTime; //address change triggered
+ SYSTEMTIME LastInitDbTime; //db initialization
+ SYSTEMTIME CounterResetTime; //counter reset time
+ } TimeStamps;
+ DWORD NoOfPnrs;
+
+#if defined(MIDL_PASS)
+ [unique, size_is(NoOfPnrs)] PWINSINTF_RPL_COUNTERS_T pRplPnrs;
+#else
+ PWINSINTF_RPL_COUNTERS_T pRplPnrs;
+#endif
+ } WINSINTF_STAT_T, *PWINSINTF_STAT_T;
+
+typedef struct _WINSINTF_ADD_VERS_MAP_T {
+ WINSINTF_ADD_T Add;
+ LARGE_INTEGER VersNo;
+ } WINSINTF_ADD_VERS_MAP_T, *PWINSINTF_ADD_VERS_MAP_T;
+
+typedef struct _WINSINTF_RESULTS_T {
+ DWORD NoOfOwners;
+ WINSINTF_ADD_VERS_MAP_T AddVersMaps[WINSINTF_MAX_NO_RPL_PNRS];
+ LARGE_INTEGER MyMaxVersNo;
+ DWORD RefreshInterval;
+ DWORD TombstoneInterval;
+ DWORD TombstoneTimeout;
+ DWORD VerifyInterval;
+ DWORD WinsPriorityClass;
+ DWORD NoOfWorkerThds;
+ WINSINTF_STAT_T WinsStat;
+ } WINSINTF_RESULTS_T, *PWINSINTF_RESULTS_T;
+
+typedef struct _WINSINTF_RESULTS_NEW_T {
+ DWORD NoOfOwners;
+#if defined(MIDL_PASS)
+ [unique, size_is(NoOfOwners)] PWINSINTF_ADD_VERS_MAP_T pAddVersMaps;
+#else
+ PWINSINTF_ADD_VERS_MAP_T pAddVersMaps;
+#endif
+ LARGE_INTEGER MyMaxVersNo;
+ DWORD RefreshInterval;
+ DWORD TombstoneInterval;
+ DWORD TombstoneTimeout;
+ DWORD VerifyInterval;
+ DWORD WinsPriorityClass;
+ DWORD NoOfWorkerThds;
+ WINSINTF_STAT_T WinsStat;
+ } WINSINTF_RESULTS_NEW_T, *PWINSINTF_RESULTS_NEW_T;
+
+typedef enum _WINSINTF_CMD_E {
+ WINSINTF_E_ADDVERSMAP = 0,
+ WINSINTF_E_CONFIG,
+ WINSINTF_E_STAT, //get statistics
+ WINSINTF_E_CONFIG_ALL_MAPS
+ } WINSINTF_CMD_E, *PWINSINTF_CMD_E;
+
+
+#if 0
+typedef struct _WINSINTF_RECS_T {
+ PWINSINTF_RECORD_ACTION_T pRow;
+ DWORD NoOfRecs;
+ DWORD TotalNoOfRecs;
+ } WINSINTF_RECS_T, *PWINSINTF_RECS_T;
+
+typedef struct _WINSINTF_RECS_T {
+ DWORD BuffSize;
+#if defined(MIDL_PASS)
+ [unique,size_is(BuffSize)] LPBYTE pRow; //will store a pointer to
+ //an array of
+ //WINSINTF_RECORD_ACTION_T
+ //recs
+#else
+ LPBYTE pRow;
+#endif
+ DWORD NoOfRecs;
+ DWORD TotalNoOfRecs;
+ } WINSINTF_RECS_T, *PWINSINTF_RECS_T;
+#endif
+
+typedef struct _WINSINTF_RECS_T {
+ DWORD BuffSize;
+#if defined(MIDL_PASS)
+ [unique,size_is(NoOfRecs)] PWINSINTF_RECORD_ACTION_T pRow; //will store a pointer to
+ //an array of
+ //WINSINTF_RECORD_ACTION_T
+ //recs
+#else
+ PWINSINTF_RECORD_ACTION_T pRow;
+#endif
+ DWORD NoOfRecs;
+ DWORD TotalNoOfRecs;
+ } WINSINTF_RECS_T, *PWINSINTF_RECS_T;
+
+//
+// Provides information to the Pull thread for pulling the specfied range
+// of records from a WINS server. This structure is passed with the
+// QUE_E_CMD_PULL_RANGE cmd.
+//
+typedef struct _WINSINTF_PULL_RANGE_INFO_T {
+ LPVOID pPnr; //info of pnr to pull from
+ WINSINTF_ADD_T OwnAdd;
+ WINSINTF_VERS_NO_T MinVersNo;
+ WINSINTF_VERS_NO_T MaxVersNo;
+ } WINSINTF_PULL_RANGE_INFO_T, *PWINSINTF_PULL_RANGE_INFO_T;
+
+//
+// NOTE NOTE NOTE:
+//
+// This structure is exactly the same as SERVER_INFO_100_CONTAINER.
+// IT SHOULD STAY THE SAME.
+//
+typedef struct _WINSINTF_BROWSER_INFO_T {
+ DWORD Id; //no use
+#if defined(MIDL_PASS)
+ [string] LPBYTE pName;
+#else
+ LPBYTE pName;
+#endif
+ } WINSINTF_BROWSER_INFO_T, *PWINSINTF_BROWSER_INFO_T;
+
+typedef struct _WINSINTF_BROWSER_NAMES_T {
+ DWORD EntriesRead; //no use
+#if defined(MIDL_PASS)
+ [unique, size_is(EntriesRead)] PWINSINTF_BROWSER_INFO_T pInfo;
+#else
+ PWINSINTF_BROWSER_INFO_T pInfo;
+#endif
+ } WINSINTF_BROWSER_NAMES_T, *PWINSINTF_BROWSER_NAMES_T;
+
+typedef enum _WINSINTF_SCV_OPC_E {
+ WINSINTF_E_SCV_GENERAL,
+ WINSINTF_E_SCV_VERIFY
+ } WINSINTF_SCV_OPC_E, *PWINSINTF_SCV_OPC_E;
+
+//
+// To send a scavenge request
+//
+typedef struct _WINSINTF_SCV_REQ_T {
+ WINSINTF_SCV_OPC_E Opcode_e;
+ DWORD Age;
+ DWORD fForce;
+ } WINSINTF_SCV_REQ_T, *PWINSINTF_SCV_REQ_T;
+
+
+/*
+* function declarations
+*/
+extern
+handle_t
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+WinsBind(
+ PWINSINTF_BIND_DATA_T pBindData
+ );
+
+extern
+VOID
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+WinsUnbind(
+ PWINSINTF_BIND_DATA_T pBindData,
+ handle_t BindHdl
+ );
+
+extern
+DWORD
+R_WinsRecordAction(
+ PWINSINTF_RECORD_ACTION_T *ppRecAction
+ );
+
+extern
+DWORD
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+WinsRecordAction(
+ PWINSINTF_RECORD_ACTION_T *ppRecAction
+ );
+
+extern
+DWORD
+R_WinsStatus(
+ //LPTSTR pWinsAddStr,
+ WINSINTF_CMD_E Cmd_e,
+ PWINSINTF_RESULTS_T pResults
+ );
+
+
+extern
+DWORD
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+
+WinsStatus(
+// LPTSTR pWinsAddStr,
+ WINSINTF_CMD_E Cmd_e,
+ LPVOID pResults
+ );
+extern
+DWORD
+R_WinsStatusNew(
+ WINSINTF_CMD_E Cmd_e,
+ PWINSINTF_RESULTS_NEW_T pResults
+ );
+extern
+DWORD
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+
+WinsStatusNew(
+ WINSINTF_CMD_E Cmd_e,
+ PWINSINTF_RESULTS_NEW_T pResults
+ );
+extern
+DWORD
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+
+WinsStatusWHdl(
+ PWINSINTF_BIND_DATA_T pWinsHdl,
+ WINSINTF_CMD_E Cmd_e,
+ PWINSINTF_RESULTS_NEW_T pResults
+ );
+
+extern
+DWORD
+R_WinsTrigger (
+ PWINSINTF_ADD_T pWinsAdd,
+ WINSINTF_TRIG_TYPE_E TrigType_e
+ );
+extern
+DWORD
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+
+WinsTrigger (
+ PWINSINTF_ADD_T pWinsAdd,
+ WINSINTF_TRIG_TYPE_E TrigType_e
+ );
+
+extern
+DWORD
+R_WinsDoStaticInit (
+ LPWSTR pDataFilePath,
+ DWORD fDel
+ );
+
+extern
+DWORD
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+
+WinsDoStaticInit (
+ LPWSTR pDataFilePath,
+ DWORD fDel
+ );
+
+extern
+DWORD
+R_WinsGetDbRecs (
+ PWINSINTF_ADD_T pWinsAdd,
+ WINSINTF_VERS_NO_T MinVersNo,
+ WINSINTF_VERS_NO_T MaxVersNo,
+ PWINSINTF_RECS_T pRecs
+ );
+extern
+DWORD
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+WinsGetDbRecs (
+ PWINSINTF_ADD_T pWinsAdd,
+ WINSINTF_VERS_NO_T MinVersNo,
+ WINSINTF_VERS_NO_T MaxVersNo,
+ PWINSINTF_RECS_T pRecs
+ );
+
+extern
+DWORD
+R_WinsGetDbRecsByName (
+ PWINSINTF_ADD_T pWinsAdd,
+ DWORD Location,
+ LPBYTE pName,
+ DWORD NameLen,
+ DWORD NoOfRecsDesired,
+ DWORD TypeOfRecs,
+ PWINSINTF_RECS_T pRecs
+ );
+extern
+DWORD
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+
+WinsGetDbRecsByName (
+ PWINSINTF_ADD_T pWinsAdd,
+ DWORD Location,
+ LPBYTE pName,
+ DWORD NameLen,
+ DWORD NoOfRecsDesired,
+ DWORD TypeOfRecs,
+ PWINSINTF_RECS_T pRecs
+ );
+
+extern
+DWORD
+R_WinsDoScavenging (
+ VOID
+ );
+
+extern
+DWORD
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+
+WinsDoScavenging (
+ VOID
+ );
+extern
+DWORD
+R_WinsDoScavengingNew (
+ PWINSINTF_SCV_REQ_T pScvReq
+ );
+
+extern
+DWORD
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+
+WinsDoScavengingNew (
+ PWINSINTF_SCV_REQ_T pScvReq
+ );
+
+extern
+VOID
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+
+WinsIntfSetTime(
+ IN OUT PSYSTEMTIME pTime,
+ IN WINSINTF_TIME_TYPE_E TimeType_e
+ );
+extern
+DWORD
+R_WinsTerm (
+ IN handle_t ClientHdl,
+ IN short fAbruptTerm
+ );
+extern
+DWORD
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+
+WinsTerm (
+ IN handle_t ClientHdl,
+ IN short fAbruptTerm
+ );
+extern
+DWORD
+R_WinsBackup (
+ IN LPBYTE pBackupPath,
+ IN short fIncremental
+ );
+extern
+DWORD
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+
+WinsBackup (
+ IN LPBYTE pBackupPath,
+ IN short fIncremental
+ );
+extern
+DWORD
+R_WinsDelDbRecs (
+ PWINSINTF_ADD_T pWinsAdd,
+ WINSINTF_VERS_NO_T MinVersNo,
+ WINSINTF_VERS_NO_T MaxVersNo
+ );
+extern
+DWORD
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+
+WinsDelDbRecs (
+ PWINSINTF_ADD_T pWinsAdd,
+ WINSINTF_VERS_NO_T MinVersNo,
+ WINSINTF_VERS_NO_T MaxVersNo
+ );
+extern
+DWORD
+R_WinsPullRange (
+ PWINSINTF_ADD_T pWinsAdd,
+ PWINSINTF_ADD_T pOwnAdd,
+ WINSINTF_VERS_NO_T MinVersNo,
+ WINSINTF_VERS_NO_T MaxVersNo
+ );
+extern
+DWORD
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+
+WinsPullRange (
+ PWINSINTF_ADD_T pWinsAdd,
+ PWINSINTF_ADD_T pOwnAdd,
+ WINSINTF_VERS_NO_T MinVersNo,
+ WINSINTF_VERS_NO_T MaxVersNo
+ );
+
+extern
+DWORD
+R_WinsSetPriorityClass (
+ IN WINSINTF_PRIORITY_CLASS_E PrCls_e
+ );
+extern
+DWORD
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+
+WinsSetPriorityClass (
+ IN WINSINTF_PRIORITY_CLASS_E PrCls_e
+ );
+
+extern
+DWORD
+R_WinsResetCounters (
+ VOID
+ );
+
+extern
+DWORD
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+
+WinsResetCounters (
+ VOID
+ );
+
+extern
+DWORD
+R_WinsWorkerThdUpd (
+ DWORD NewNoOfNbtThds
+ );
+
+extern
+DWORD
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+
+WinsWorkerThdUpd (
+ DWORD NewNoOfNbtThds
+ );
+extern
+DWORD
+WinsRestore (
+ LPBYTE BackupPath
+ );
+
+extern
+DWORD
+WinsRestoreO (
+ LPBYTE BackupPath
+ );
+
+extern
+DWORD
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+
+WinsSyncUp (
+ PWINSINTF_ADD_T pWinsAdd,
+ PWINSINTF_ADD_T pOwnAdd
+ );
+
+
+extern
+DWORD
+R_WinsGetNameAndAdd(
+ PWINSINTF_ADD_T pWinsAdd,
+ LPBYTE pUncName
+ );
+
+extern
+DWORD
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+
+WinsGetNameAndAdd(
+ PWINSINTF_ADD_T pWinsAdd,
+ LPBYTE pUncName
+ );
+
+extern
+DWORD
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+
+WinsGetBrowserNames(
+ PWINSINTF_BIND_DATA_T pWinsHdl,
+ PWINSINTF_BROWSER_NAMES_T pNames
+ );
+
+
+extern
+VOID
+R_WinsGetBrowserNames_notify(
+ VOID
+);
+
+extern
+DWORD
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+
+WinsGetBrowserNames_Old(
+ PWINSINTF_BROWSER_NAMES_T pNames
+ );
+
+extern
+DWORD
+R_WinsDeleteWins(
+ PWINSINTF_ADD_T pWinsAdd
+ );
+
+extern
+DWORD
+R_WinsSetFlags(
+ DWORD fFlags
+ );
+
+extern
+DWORD
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+
+WinsSetFlags(
+ DWORD fFlags
+ );
+extern
+DWORD
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+
+WinsDeleteWins(
+ PWINSINTF_ADD_T pWinsAdd
+ );
+
+extern
+void
+#if !defined(MIDL_PASS)
+__RPC_FAR * __RPC_API
+//void * __RPC_API
+//void *
+#endif // MIDL_PASS
+midl_user_allocate(size_t cBytes);
+
+extern
+//void __RPC_FAR * __RPC_API
+void
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+//void
+//midl_user_free(void __RPC_FAR *pMem);
+midl_user_free(void *pMem);
+
+extern
+VOID
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+
+WinsFreeMem(LPVOID pMem);
+
+extern
+LPVOID
+#if !defined(MIDL_PASS)
+__RPC_API
+#endif // MIDL_PASS
+
+WinsAllocMem(size_t cBytes);
+
+typedef struct _TREE_T {
+#if defined(MIDL_PASS)
+ [unique] struct _TREE_T *fPtr;
+ [ignore, unique] struct _TREE_T *bPtr;
+ [unique, size_is(NameLen)] LPBYTE pName;
+#else
+ struct _TREE_T *fPtr;
+ struct _TREE_T *bPtr;
+ LPBYTE pName;
+#endif
+ unsigned short NameLen;
+ DWORD x;
+ } TREE_T, *PTREE_T;
+
+
+
+#endif
diff --git a/private/inc/wsahelp.h b/private/inc/wsahelp.h
new file mode 100644
index 000000000..ff66b786b
--- /dev/null
+++ b/private/inc/wsahelp.h
@@ -0,0 +1,451 @@
+/*++
+
+Copyright (c) 1992 Microsoft Corporation
+
+Module Name:
+
+ WsaHelp.h
+
+Abstract:
+
+ This header file contains prototypes required for Windows Sockets
+ Helper DLLs. The helper DLLs allow the Windows Sockets DLL to be
+ transport independent by suppling the necessary option get/set and
+ address conversion routines for an individual transport or transport
+ family.
+
+Author:
+
+ David Treadwell (davidtr) 15-Jul-1992
+
+Revision History:
+
+ Keith Moore (keithmo) 08-Jan-1996
+ Added WinSock 2 entrypoints.
+
+--*/
+
+#ifndef _WSAHELP_H_
+#define _WSAHELP_H_
+
+//
+// Notification event definitions. A helper DLL returns a mask of the
+// events for which it wishes to be notified, and the Windows Sockets
+// DLL calls the helper DLL in WSHNotify for each requested event.
+//
+
+#define WSH_NOTIFY_BIND 0x01
+#define WSH_NOTIFY_LISTEN 0x02
+#define WSH_NOTIFY_CONNECT 0x04
+#define WSH_NOTIFY_ACCEPT 0x08
+#define WSH_NOTIFY_SHUTDOWN_RECEIVE 0x10
+#define WSH_NOTIFY_SHUTDOWN_SEND 0x20
+#define WSH_NOTIFY_SHUTDOWN_ALL 0x40
+#define WSH_NOTIFY_CLOSE 0x80
+#define WSH_NOTIFY_CONNECT_ERROR 0x100
+
+//
+// Definitions for various internal socket options. These are used
+// by the Windows Sockets DLL to communicate information to the helper
+// DLL via get and set socket information calls.
+//
+
+#define SOL_INTERNAL 0xFFFE
+#define SO_CONTEXT 1
+
+//
+// Open, Notify, and Socket Option routine prototypes.
+//
+
+typedef
+INT
+(WINAPI * PWSH_OPEN_SOCKET) (
+ IN PINT AddressFamily,
+ IN PINT SocketType,
+ IN PINT Protocol,
+ OUT PUNICODE_STRING TransportDeviceName,
+ OUT PVOID *HelperDllSocketContext,
+ OUT PDWORD NotificationEvents
+ );
+
+INT
+WINAPI
+WSHOpenSocket (
+ IN OUT PINT AddressFamily,
+ IN OUT PINT SocketType,
+ IN OUT PINT Protocol,
+ OUT PUNICODE_STRING TransportDeviceName,
+ OUT PVOID *HelperDllSocketContext,
+ OUT PDWORD NotificationEvents
+ );
+
+typedef
+INT
+(WINAPI * PWSH_NOTIFY) (
+ IN PVOID HelperDllSocketContext,
+ IN SOCKET SocketHandle,
+ IN HANDLE TdiAddressObjectHandle,
+ IN HANDLE TdiConnectionObjectHandle,
+ IN DWORD NotifyEvent
+ );
+
+INT
+WINAPI
+WSHNotify (
+ IN PVOID HelperDllSocketContext,
+ IN SOCKET SocketHandle,
+ IN HANDLE TdiAddressObjectHandle,
+ IN HANDLE TdiConnectionObjectHandle,
+ IN DWORD NotifyEvent
+ );
+
+typedef
+INT
+(WINAPI * PWSH_GET_SOCKET_INFORMATION) (
+ IN PVOID HelperDllSocketContext,
+ IN SOCKET SocketHandle,
+ IN HANDLE TdiAddressObjectHandle,
+ IN HANDLE TdiConnectionObjectHandle,
+ IN INT Level,
+ IN INT OptionName,
+ OUT PCHAR OptionValue,
+ OUT PINT OptionLength
+ );
+
+INT
+WINAPI
+WSHGetSocketInformation (
+ IN PVOID HelperDllSocketContext,
+ IN SOCKET SocketHandle,
+ IN HANDLE TdiAddressObjectHandle,
+ IN HANDLE TdiConnectionObjectHandle,
+ IN INT Level,
+ IN INT OptionName,
+ OUT PCHAR OptionValue,
+ OUT PINT OptionLength
+ );
+
+typedef
+INT
+(WINAPI * PWSH_SET_SOCKET_INFORMATION) (
+ IN PVOID HelperDllSocketContext,
+ IN SOCKET SocketHandle,
+ IN HANDLE TdiAddressObjectHandle,
+ IN HANDLE TdiConnectionObjectHandle,
+ IN INT Level,
+ IN INT OptionName,
+ IN PCHAR OptionValue,
+ IN INT OptionLength
+ );
+
+INT
+WINAPI
+WSHSetSocketInformation (
+ IN PVOID HelperDllSocketContext,
+ IN SOCKET SocketHandle,
+ IN HANDLE TdiAddressObjectHandle,
+ IN HANDLE TdiConnectionObjectHandle,
+ IN INT Level,
+ IN INT OptionName,
+ IN PCHAR OptionValue,
+ IN INT OptionLength
+ );
+
+//
+// Structure and routine for determining the address family/socket
+// type/protocol triples supported by an individual Windows Sockets
+// Helper DLL. The Rows field of WINSOCK_MAPPING determines the
+// number of entries in the Mapping[] array; the Columns field is
+// always 3 for Windows/NT product 1.
+//
+
+typedef struct _WINSOCK_MAPPING {
+ DWORD Rows;
+ DWORD Columns;
+ struct {
+ DWORD AddressFamily;
+ DWORD SocketType;
+ DWORD Protocol;
+ } Mapping[1];
+} WINSOCK_MAPPING, *PWINSOCK_MAPPING;
+
+typedef
+DWORD
+(WINAPI * PWSH_GET_WINSOCK_MAPPING) (
+ OUT PWINSOCK_MAPPING Mapping,
+ IN DWORD MappingLength
+ );
+
+DWORD
+WINAPI
+WSHGetWinsockMapping (
+ OUT PWINSOCK_MAPPING Mapping,
+ IN DWORD MappingLength
+ );
+
+//
+// Address manipulation routine.
+//
+
+typedef enum _SOCKADDR_ADDRESS_INFO {
+ SockaddrAddressInfoNormal,
+ SockaddrAddressInfoWildcard,
+ SockaddrAddressInfoBroadcast,
+ SockaddrAddressInfoLoopback
+} SOCKADDR_ADDRESS_INFO, *PSOCKADDR_ADDRESS_INFO;
+
+typedef enum _SOCKADDR_ENDPOINT_INFO {
+ SockaddrEndpointInfoNormal,
+ SockaddrEndpointInfoWildcard,
+ SockaddrEndpointInfoReserved
+} SOCKADDR_ENDPOINT_INFO, *PSOCKADDR_ENDPOINT_INFO;
+
+typedef struct _SOCKADDR_INFO {
+ SOCKADDR_ADDRESS_INFO AddressInfo;
+ SOCKADDR_ENDPOINT_INFO EndpointInfo;
+} SOCKADDR_INFO, *PSOCKADDR_INFO;
+
+typedef
+INT
+(WINAPI * PWSH_GET_SOCKADDR_TYPE) (
+ IN PSOCKADDR Sockaddr,
+ IN DWORD SockaddrLength,
+ OUT PSOCKADDR_INFO SockaddrInfo
+ );
+
+INT
+WINAPI
+WSHGetSockaddrType (
+ IN PSOCKADDR Sockaddr,
+ IN DWORD SockaddrLength,
+ OUT PSOCKADDR_INFO SockaddrInfo
+ );
+
+typedef
+INT
+(WINAPI * PWSH_GET_WILDCARD_SOCKADDR) (
+ IN PVOID HelperDllSocketContext,
+ OUT PSOCKADDR Sockaddr,
+ OUT PINT SockaddrLength
+ );
+
+INT
+WINAPI
+WSHGetWildcardSockaddr (
+ IN PVOID HelperDllSocketContext,
+ OUT PSOCKADDR Sockaddr,
+ OUT PINT SockaddrLength
+ );
+
+typedef
+INT
+(WINAPI * PWSH_ENUM_PROTOCOLS) (
+ IN LPINT lpiProtocols,
+ IN LPTSTR lpTransportKeyName,
+ IN OUT LPVOID lpProtocolBuffer,
+ IN OUT LPDWORD lpdwBufferLength
+ );
+
+INT
+WINAPI
+WSHEnumProtocols (
+ IN LPINT lpiProtocols,
+ IN LPTSTR lpTransportKeyName,
+ IN OUT LPVOID lpProtocolBuffer,
+ IN OUT LPDWORD lpdwBufferLength
+ );
+
+#ifdef _WINSOCK2API_
+
+//
+// New WinSock 2 Entrypoints.
+//
+
+typedef
+INT
+(WINAPI * PWSH_OPEN_SOCKET2) (
+ IN PINT AddressFamily,
+ IN PINT SocketType,
+ IN PINT Protocol,
+ IN GROUP Group,
+ IN DWORD Flags,
+ OUT PUNICODE_STRING TransportDeviceName,
+ OUT PVOID *HelperDllSocketContext,
+ OUT PDWORD NotificationEvents
+ );
+
+INT
+WINAPI
+WSHOpenSocket2 (
+ IN OUT PINT AddressFamily,
+ IN OUT PINT SocketType,
+ IN OUT PINT Protocol,
+ IN GROUP Group,
+ IN DWORD Flags,
+ OUT PUNICODE_STRING TransportDeviceName,
+ OUT PVOID *HelperDllSocketContext,
+ OUT PDWORD NotificationEvents
+ );
+
+typedef
+INT
+(WINAPI * PWSH_JOIN_LEAF) (
+ IN PVOID HelperDllSocketContext,
+ IN SOCKET SocketHandle,
+ IN HANDLE TdiAddressObjectHandle,
+ IN HANDLE TdiConnectionObjectHandle,
+ IN PVOID LeafHelperDllSocketContext,
+ IN SOCKET LeafSocketHandle,
+ IN PSOCKADDR Sockaddr,
+ IN DWORD SockaddrLength,
+ IN LPWSABUF CallerData,
+ IN LPWSABUF CalleeData,
+ IN LPQOS SocketQOS,
+ IN LPQOS GroupQOS,
+ IN DWORD Flags
+ );
+
+INT
+WINAPI
+WSHJoinLeaf (
+ IN PVOID HelperDllSocketContext,
+ IN SOCKET SocketHandle,
+ IN HANDLE TdiAddressObjectHandle,
+ IN HANDLE TdiConnectionObjectHandle,
+ IN PVOID LeafHelperDllSocketContext,
+ IN SOCKET LeafSocketHandle,
+ IN PSOCKADDR Sockaddr,
+ IN DWORD SockaddrLength,
+ IN LPWSABUF CallerData,
+ IN LPWSABUF CalleeData,
+ IN LPQOS SocketQOS,
+ IN LPQOS GroupQOS,
+ IN DWORD Flags
+ );
+
+INT
+WINAPI
+WSHAddressToString (
+ IN LPSOCKADDR Address,
+ IN INT AddressLength,
+ IN LPWSAPROTOCOL_INFOW ProtocolInfo,
+ OUT LPWSTR AddressString,
+ IN OUT LPDWORD AddressStringLength
+ );
+
+typedef
+INT
+(WINAPI * PWSH_ADDRESS_TO_STRING) (
+ IN LPSOCKADDR Address,
+ IN INT AddressLength,
+ IN LPWSAPROTOCOL_INFOW ProtocolInfo,
+ OUT LPWSTR AddressString,
+ IN OUT LPDWORD AddressStringLength
+ );
+
+INT
+WINAPI
+WSHStringToAddress (
+ IN LPWSTR AddressString,
+ IN DWORD AddressFamily,
+ IN LPWSAPROTOCOL_INFOW ProtocolInfo,
+ OUT LPSOCKADDR Address,
+ IN OUT LPINT AddressLength
+ );
+
+typedef
+INT
+(WINAPI * PWSH_STRING_TO_ADDRESS) (
+ IN LPWSTR AddressString,
+ IN DWORD AddressFamily,
+ IN LPWSAPROTOCOL_INFOW ProtocolInfo,
+ OUT LPSOCKADDR Address,
+ IN OUT LPINT AddressLength
+ );
+
+typedef
+INT
+(WINAPI * PWSH_GET_BROADCAST_SOCKADDR) (
+ IN PVOID HelperDllSocketContext,
+ OUT PSOCKADDR Sockaddr,
+ OUT PINT SockaddrLength
+ );
+
+INT
+WINAPI
+WSHGetBroadcastSockaddr (
+ IN PVOID HelperDllSocketContext,
+ OUT PSOCKADDR Sockaddr,
+ OUT PINT SockaddrLength
+ );
+
+typedef
+INT
+(WINAPI * PWSH_GET_PROVIDER_GUID) (
+ IN LPWSTR ProviderName,
+ OUT LPGUID ProviderGuid
+ );
+
+INT
+WINAPI
+WSHGetProviderGuid (
+ IN LPWSTR ProviderName,
+ OUT LPGUID ProviderGuid
+ );
+
+typedef
+INT
+(WINAPI * PWSH_GET_WSAPROTOCOL_INFO) (
+ IN LPWSTR ProviderName,
+ OUT LPWSAPROTOCOL_INFOW * ProtocolInfo,
+ OUT LPDWORD ProtocolInfoEntries
+ );
+
+INT
+WINAPI
+WSHGetWSAProtocolInfo (
+ IN LPWSTR ProviderName,
+ OUT LPWSAPROTOCOL_INFOW * ProtocolInfo,
+ OUT LPDWORD ProtocolInfoEntries
+ );
+
+typedef
+INT
+(WINAPI * PWSH_IOCTL) (
+ IN PVOID HelperDllSocketContext,
+ IN SOCKET SocketHandle,
+ IN HANDLE TdiAddressObjectHandle,
+ IN HANDLE TdiConnectionObjectHandle,
+ IN DWORD IoControlCode,
+ IN LPVOID InputBuffer,
+ IN DWORD InputBufferLength,
+ IN LPVOID OutputBuffer,
+ IN DWORD OutputBufferLength,
+ OUT LPDWORD NumberOfBytesReturned,
+ IN LPWSAOVERLAPPED Overlapped,
+ IN LPWSAOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine,
+ OUT LPBOOL NeedsCompletion
+ );
+
+INT
+WINAPI
+WSHIoctl (
+ IN PVOID HelperDllSocketContext,
+ IN SOCKET SocketHandle,
+ IN HANDLE TdiAddressObjectHandle,
+ IN HANDLE TdiConnectionObjectHandle,
+ IN DWORD IoControlCode,
+ IN LPVOID InputBuffer,
+ IN DWORD InputBufferLength,
+ IN LPVOID OutputBuffer,
+ IN DWORD OutputBufferLength,
+ OUT LPDWORD NumberOfBytesReturned,
+ IN LPWSAOVERLAPPED Overlapped,
+ IN LPWSAOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine,
+ OUT LPBOOL NeedsCompletion
+ );
+
+#endif // _WINSOCK2API_
+
+#endif // _WSAHELP_H_
+
diff --git a/private/inc/wsasetup.h b/private/inc/wsasetup.h
new file mode 100644
index 000000000..e2123004e
--- /dev/null
+++ b/private/inc/wsasetup.h
@@ -0,0 +1,92 @@
+/*++
+
+Copyright (c) 1995 Microsoft Corporation
+
+Module Name:
+
+ wsasetup.h
+
+Abstract:
+
+ This header file contains the type definitions and function prototypes
+ for the private interface between NT Setup and WSOCK32.DLL.
+
+Author:
+
+ Keith Moore (keithmo) 27-Oct-1995
+
+Revision History:
+
+--*/
+
+
+#ifndef _WSASETUP_
+#define _WSASETUP_
+
+
+//
+// Setup disposition, used to tell Setup what actions were taken (if any).
+//
+
+typedef enum _WSA_SETUP_DISPOSITION {
+
+ WsaSetupNoChangesMade,
+ WsaSetupChangesMadeRebootNotNecessary,
+ WsaSetupChangesMadeRebootRequired
+
+} WSA_SETUP_DISPOSITION, *LPWSA_SETUP_DISPOSITION;
+
+
+//
+// Opcodes for the migration callback (see below).
+//
+
+typedef enum _WSA_SETUP_OPCODE {
+
+ WsaSetupInstallingProvider,
+ WsaSetupRemovingProvider,
+ WsaSetupValidatingProvider,
+ WsaSetupUpdatingProvider
+
+} WSA_SETUP_OPCODE, *LPWSA_SETUP_OPCODE;
+
+
+//
+// Callback function invoked by MigrationWinsockConfiguration() at
+// strategic points in the migration process.
+//
+
+typedef
+BOOL
+(CALLBACK LPFN_WSA_SETUP_CALLBACK)(
+ WSA_SETUP_OPCODE Opcode,
+ LPVOID Parameter,
+ DWORD Context
+ );
+
+
+//
+// Private function exported by WSOCK32.DLL for use by NT Setup only. This
+// function updates the WinSock 2.0 configuration information to reflect any
+// changes made to the WinSock 1.1 configuration.
+//
+
+DWORD
+WINAPI
+MigrateWinsockConfiguration(
+ LPWSA_SETUP_DISPOSITION Disposition,
+ LPFN_WSA_SETUP_CALLBACK Callback OPTIONAL,
+ DWORD Context OPTIONAL
+ );
+
+typedef
+DWORD
+(WINAPI * LPFN_MIGRATE_WINSOCK_CONFIGURATION)(
+ LPWSA_SETUP_DISPOSITION Disposition,
+ LPFN_WSA_SETUP_CALLBACK Callback OPTIONAL,
+ DWORD Context OPTIONAL
+ );
+
+
+#endif // _WSASETUP_
+
diff --git a/private/inc/xactsrv.h b/private/inc/xactsrv.h
new file mode 100644
index 000000000..8cfe55b9b
--- /dev/null
+++ b/private/inc/xactsrv.h
@@ -0,0 +1,44 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ xactsrv.h
+
+Abstract:
+
+ Header file for XACTSRV. Defines structures common to the server and
+ XACTSRV.
+
+Author:
+
+ David Treadwell (davidtr) 07-Jan-1991
+
+Revision History:
+
+--*/
+
+#ifndef _XACTSRV_
+#define _XACTSRV_
+
+//
+// Structures for messages that are passed across the LPC port between
+// the server and XACTSRV.
+//
+// *** The PORT_MESSAGE structure *must* be the first element of these
+// structures!
+
+typedef struct _XACTSRV_REQUEST_MESSAGE {
+ PORT_MESSAGE PortMessage;
+ PTRANSACTION Transaction;
+ WCHAR ClientMachineName[CNLEN + 1];
+} XACTSRV_REQUEST_MESSAGE, *PXACTSRV_REQUEST_MESSAGE;
+
+typedef struct _XACTSRV_REPLY_MESSAGE {
+ PORT_MESSAGE PortMessage;
+ NTSTATUS Status;
+} XACTSRV_REPLY_MESSAGE, *PXACTSRV_REPLY_MESSAGE;
+
+#endif // ndef _XACTSRV_
+
diff --git a/private/inc/xactsrv2.h b/private/inc/xactsrv2.h
new file mode 100644
index 000000000..7a46e1501
--- /dev/null
+++ b/private/inc/xactsrv2.h
@@ -0,0 +1,158 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ xactsrv.h
+
+Abstract:
+
+ Header file for XACTSRV. Defines structures common to the server and
+ XACTSRV.
+
+Author:
+
+ David Treadwell (davidtr) 07-Jan-1991
+
+Revision History:
+
+--*/
+
+#ifndef _XACTSRV_
+#define _XACTSRV_
+
+//
+// Structures for messages that are passed across the LPC port between
+// the server and XACTSRV.
+//
+// *** The PORT_MESSAGE structure *must* be the first element of these
+// structures!
+
+typedef struct _XACTSRV_REQUEST_MESSAGE {
+
+ PORT_MESSAGE PortMessage;
+ ULONG MessageType;
+
+ union {
+
+ struct {
+ struct _TRANSACTION *Transaction;
+ WCHAR ClientMachineName[CNLEN + 1];
+ UCHAR ServerName[ NETBIOS_NAME_LEN ];
+ ULONG TransportNameLength;
+ PWSTR TransportName;
+ UCHAR LanmanSessionKey[MSV1_0_LANMAN_SESSION_KEY_LENGTH];
+ ULONG Flags;
+ } DownLevelApi;
+
+ struct {
+ PSZ PrinterName;
+ } OpenPrinter;
+
+ struct {
+ HANDLE hPrinter;
+ PVOID Buffer;
+ ULONG BufferLength;
+ } AddPrintJob;
+
+ struct {
+ HANDLE hPrinter;
+ ULONG JobId;
+ } SchedulePrintJob;
+
+ struct {
+ HANDLE hPrinter;
+ } ClosePrinter;
+
+ struct {
+ PSZ Receipient;
+ PVOID Buffer;
+ USHORT BufferLength;
+ } MessageBufferSend;
+
+ struct {
+ PWSTR UserName;
+ BOOL IsAdmin;
+ } LSRequest;
+
+ struct {
+ HANDLE hLicense;
+ } LSRelease;
+
+ struct {
+ BOOLEAN Bind;
+ UNICODE_STRING TransportName;
+ } Pnp;
+
+ } Message;
+
+
+} XACTSRV_REQUEST_MESSAGE, *PXACTSRV_REQUEST_MESSAGE;
+
+typedef struct _XACTSRV_REPLY_MESSAGE {
+
+ PORT_MESSAGE PortMessage;
+
+ union {
+
+ struct {
+ NTSTATUS Status;
+ } DownLevelApi;
+
+ struct {
+ ULONG Error;
+ HANDLE hPrinter;
+ } OpenPrinter;
+
+ struct {
+ ULONG Error;
+ USHORT BufferLength;
+ ULONG JobId;
+ } AddPrintJob;
+
+ struct {
+ ULONG Error;
+ } SchedulePrintJob;
+
+ struct {
+ ULONG Error;
+ } ClosePrinter;
+
+ struct {
+ ULONG Error;
+ } MessageBufferSend;
+
+ struct {
+ NTSTATUS Status;
+ HANDLE hLicense;
+ } LSRequest;
+
+ } Message;
+
+} XACTSRV_REPLY_MESSAGE, *PXACTSRV_REPLY_MESSAGE;
+
+//
+// Message types that can be sent to XACTSRV.
+//
+
+#define XACTSRV_MESSAGE_DOWN_LEVEL_API 0
+#define XACTSRV_MESSAGE_OPEN_PRINTER 1
+#define XACTSRV_MESSAGE_ADD_JOB_PRINTER 2
+#define XACTSRV_MESSAGE_SCHD_JOB_PRINTER 4
+#define XACTSRV_MESSAGE_CLOSE_PRINTER 5
+#define XACTSRV_MESSAGE_MESSAGE_SEND 6
+#define XACTSRV_MESSAGE_WAKEUP 7
+#define XACTSRV_MESSAGE_LSREQUEST 8
+#define XACTSRV_MESSAGE_LSRELEASE 9
+#define XACTSRV_MESSAGE_PNP 10
+#define XACTSRV_MESSAGE_SERVER_THREAD_EXIT 11
+
+//
+// Request Flags definitions
+//
+
+#define XS_FLAGS_NT_CLIENT 0x00000001
+
+#endif // ndef _XACTSRV_
+