📄 smbcedbp.h
字号:
/*++
Copyright (c) 1987-1999 Microsoft Corporation
Module Name:
smbcedbp.h
Abstract:
This is the include file that defines all constants and types for
implementing the SMB mini redirector connection engine.
This module contains all the implementation details of the connection engine
data structures and should be included only by the implementation modules.
Notes:
--*/
#ifndef _SMBCEDBP_H_
#define _SMBCEDBP_H_
//
// There is reliance on the fact that SMBCEDB_OT_SENTINEL is the last entry in the
// enumerated type and the types have a range of values from 0. Please ensure that
// this is always true.
//
typedef struct _REFERENCE_RECORD_ {
PVOID FileName;
ULONG FileLine;
} REFERENCE_RECORD,*PREFERENCE_RECORD;
#define REFERENCE_RECORD_SIZE 20
typedef enum _SMBCEDB_OBJECT_TYPE {
SMBCEDB_OT_SERVER,
SMBCEDB_OT_NETROOT,
SMBCEDB_OT_SESSION,
SMBCEDB_OT_REQUEST,
SMBCEDB_OT_VNETROOTCONTEXT,
SMBCEDB_OT_SENTINEL,
SMBCEDB_OT_TRANSPORT
} SMBCEDB_OBJECT_TYPE, *PSMBCEDB_OBJECT_TYPE;
typedef enum _SMBCEDB_OBJECT_STATE_ {
SMBCEDB_ACTIVE, // the instance is in use
SMBCEDB_INVALID, // the instance has been invalidated/disconnected.
SMBCEDB_MARKED_FOR_DELETION, // the instance has been marked for deletion.
SMBCEDB_RECYCLE, // the instance is available for recycling
SMBCEDB_START_CONSTRUCTION, // Initiate construction.
SMBCEDB_CONSTRUCTION_IN_PROGRESS, // the instance construction is in progress
SMBCEDB_DESTRUCTION_IN_PROGRESS // the instance destruction is in progress
} SMBCEDB_OBJECT_STATE, *PSMBCEDB_OBJECT_STATE;
typedef struct _SMBCE_OBJECT_HEADER_ {
union {
struct {
UCHAR ObjectType; // type of the object
UCHAR ObjectCategory; // Node type for debugging
};
USHORT NodeType;
};
UCHAR Flags; // flags associated with the object, This is implementation dependent
UCHAR Reserved; // padding
LONG SwizzleCount; // Number of swizzled references to this object
LONG State; // State of the object
} SMBCE_OBJECT_HEADER, *PSMBCE_OBJECT_HEADER;
typedef struct _SMBCE_SERVERS_LIST_ {
LIST_ENTRY ListHead;
} SMBCEDB_SERVERS, *PSMBCEDB_SERVERS;
typedef struct _SMBCEDB_SESSIONS_ {
LIST_ENTRY ListHead;
LIST_ENTRY DefaultSessionList;
} SMBCEDB_SESSIONS, *PSMBCEDB_SESSIONS;
typedef struct _SMBCEDB_NET_ROOTS_ {
LIST_ENTRY ListHead;
} SMBCEDB_NET_ROOTS, *PSMBCEDB_NET_ROOTS;
typedef struct _MRX_SMB_V_NET_ROOT_CONTEXTS {
LIST_ENTRY ListHead;
} SMBCE_V_NET_ROOT_CONTEXTS, *PSMBCE_V_NET_ROOT_CONTEXTS;
typedef struct _SMBCEDB_REQUESTS_ {
LIST_ENTRY ListHead;
SMB_MPX_ID NextRequestId;
} SMBCEDB_REQUESTS, *PSMBCEDB_REQUESTS;
typedef enum _SMBCEDB_SERVER_TYPE_ {
SMBCEDB_MAILSLOT_SERVER = 1,
SMBCEDB_FILE_SERVER = 2
} SMBCEDB_SERVER_TYPE, *PSMBCEDB_SERVER_TYPE;
//
// The SMBCEDB_SERVER_ENTRY is the data structure which encapsulates all the information
// w.r.t a remote server for the connection engine. This information includes the dialect
// details as well as the operational data structures required to communicate with the server.
//
// All the dialect related details are further encapsulated in SMBCE_SERVER while the operational
// data structures constitute the remaining parts of the server entry. A pointer to a
// SMBCEDB_SERVER_ENTRY instance is associated with every SRV_CALL that has been hooked
// onto this mini redirector by the wrapper. It is stored in the Context field of MRX_SRV_CALL.
//
// The operational information associated with a server entry includes the Transport related
// information, a collection of requests and a mechanism for associating MID's ( See SMB
// protocol spec.) and a mechanism for posting to threads ( WORK_QUEUE_ITEM ).
//
typedef struct _SMBCEDB_SERVER_ENTRY {
SMBCE_OBJECT_HEADER Header; // struct header.
LIST_ENTRY ServersList; // list of server instances.
PMRX_SRV_CALL pRdbssSrvCall;
UNICODE_STRING Name; // the server name.
UNICODE_STRING DomainName; // the server domain name.
SMBCEDB_SESSIONS Sessions; // the sessions associated with the server
SMBCEDB_NET_ROOTS NetRoots; // the net roots associated with the server.
SMBCE_V_NET_ROOT_CONTEXTS VNetRootContexts; // the V_NET_ROOT contexts
LIST_ENTRY ActiveExchanges; // list of exchanges active for this server
LIST_ENTRY ExpiredExchanges; // exchanges that have been timed out
RX_WORK_QUEUE_ITEM WorkQueueItem; // work queue item for posting
BOOLEAN WorkItemOutstanding; // is there a work item already in the queue?
NTSTATUS ServerStatus; // the status of the server as determined by negotiate response
struct _SMBCE_TRANSPORT_ *PreferredTransport;
LONG TransportSpecifiedByUser; // ture if the connection is established on the tranport
// with the name specified
struct SMBCE_SERVER_TRANSPORT *pTransport;
SMBCEDB_REQUESTS MidAssignmentRequests;
SMBCEDB_REQUESTS OutstandingRequests;
PMID_ATLAS pMidAtlas;
struct _SMB_EXCHANGE *pNegotiateExchange;
SMBCE_SERVER Server; // the server data structure.
UNICODE_STRING DfsRootName;
PVOID ConstructionContext; // debug only
KEVENT TransportRundownEvent;
BOOLEAN IsTransportDereferenced; // prevent transport from being dereferenced more than once
BOOLEAN NegotiateInProgress; // a negotiate is in progress for this server
} SMBCEDB_SERVER_ENTRY, *PSMBCEDB_SERVER_ENTRY;
// The SMBCEDB_NET_ROOT_ENTRY encapsulates all the information associated with a particular
// TREE_CONNECT ( Net use ) made on a server. As with the server entry this data structure
// encapsulates the dialect oriented details as well as the opertaional information
// associated with handling the requests on a net root.
//
// The dialect specific information is encapsulated in the SMBCE_NET_ROOT data structure. A
// pointer to an instance of this data structure is associated with every MRX_NET_ROOT call
// associated with a MRX_SRV_CALL hooked to this mini redirector.
typedef struct _SMBCEDB_NET_ROOT_ENTRY {
SMBCE_OBJECT_HEADER Header; // the struct header
LIST_ENTRY NetRootsList; // the list of net roots asssociated with a server
PMRX_NET_ROOT pRdbssNetRoot; // the associated net root ( purely as a debug aid )
PSMBCEDB_SERVER_ENTRY pServerEntry; // the associated server entry
struct _SMB_EXCHANGE *pExchange; // the exchange which is responsible for construction
SMBCEDB_REQUESTS Requests; // the pending requests for this net root
UNICODE_STRING Name;
ACCESS_MASK MaximalAccessRights;
ACCESS_MASK GuestMaximalAccessRights;
SMBCE_NET_ROOT NetRoot; // the net root data structure.
NAME_CACHE_CONTROL NameCacheCtlGFABasic; // The get file attributes name cache control.
NAME_CACHE_CONTROL NameCacheCtlGFAStandard; // The get file attributes name cache control.
NAME_CACHE_CONTROL NameCacheCtlFNF; // The File not found name cache control.
REFERENCE_RECORD ReferenceRecord[REFERENCE_RECORD_SIZE]; // debug only
} SMBCEDB_NET_ROOT_ENTRY, *PSMBCEDB_NET_ROOT_ENTRY;
// The SMBCEDB_SESSION_ENTRY encapsulates all the information associated with a session
// established to a remote machine. The session encapsulates all the security information.
// The dialect specific details are encapsulated in teh SMBCE_SESSION data structure. The
// SMBCE_SESSION data structure is available in many flavours depending on the security
// package used. Currently there is support for handling LSA sessions.
//
// A pointer to an instance of this data structure is associated with every MRX_V_NET_ROOT
// data structure hooked to this mini redirector by the wrapper.
typedef struct _SMBCEDB_SESSION_ENTRY {
SMBCE_OBJECT_HEADER Header; // the struct header
LIST_ENTRY SessionsList; // the list of sessions associated with the server
LIST_ENTRY DefaultSessionLink; // the list of explicit credentials for this server
PSMBCEDB_SERVER_ENTRY pServerEntry; // the associated server entry
struct _SMB_EXCHANGE *pExchange; // the exchange which is responsible for construction
SMBCEDB_REQUESTS Requests; // pending requests
LIST_ENTRY SerializationList; // session construction serialization
PKEVENT pSerializationEvent;
ULONG SessionVCNumber; // the VC number to be packaged with session setup
SMBCE_SESSION Session; // the Session
} SMBCEDB_SESSION_ENTRY, *PSMBCEDB_SESSION_ENTRY;
//
// The wrapper exposes three data structures for manipulating and describing
// name spaces set up on remote servers, Viz., MRX_SRV_CALL, MRX_NET_ROOT and
// MRX_V_NET_ROOT. The SRV_CALL corresponds to a remote server, the MRX_NET_ROOT
// corresponds to a share on that machine and V_NET_ROOT encapsulates
// the notion of a view of a MRX_NET_ROOT ( share in SMB terminology)
//
// The mapping between the wrapper level data structures and the SMB notion
// of SMBCEDB_SERVER_ENTRY, SMBCEDB_SESSION_ENTRY and SMBCEDB_NET_ROOT_ENTRY
// is not one to one in all cases.
//
// It is one to one between MRX_SRV_CALL and SMBCEDB_SERVER_ENTRY. It is for this
// reason that a pointer to SMBCEDB_SERVER_ENTRY is stored in the context field
// of the MRX_SRV_CALL instance.
//
// SMBCEDB_SESSION_ENTRY has a one to one mapping with the set of credentials
// supplied to establish a connection to a server. Having established a session
// one can have access to all the shares available on the server.
//
// SMBCEDB_NET_ROOT_ENTRY has a one to one mapping with a share on a given
// server. Since this closely corresponds to the wrappers interpretation of
// MRX_NET_ROOT a pointer to SMBCEDB_NET_ROOT_ENTRY is stored as part of the
// MRX_NET_ROOT instance.
//
// The context associated with every MRX_V_NET_ROOT instance is a pointer to
// an instance of SMBCE_V_NET_ROOT_CONTEXT. This encapsulates the associated session
// entry, the net root entry and the relevant book keeping information.
//
// The bookkeeping information is the UID/TID used in the SMB protocol, a
// reference count and a LIST_ENTRY to thread the instance into the appropriate
// list.
//
#define SMBCE_V_NET_ROOT_CONTEXT_FLAG_VALID_TID (0x1)
typedef struct _SMBCE_V_NET_ROOT_CONTEXT {
SMBCE_OBJECT_HEADER Header;
PMRX_V_NET_ROOT pRdbssVNetRoot; // the associated VNetRoot ( purely as a debug aid)
struct _SMB_EXCHANGE *pExchange; // the exchange which is responsible for construction
SMBCEDB_REQUESTS Requests;
LIST_ENTRY ListEntry;
LARGE_INTEGER ExpireTime;
struct _SMBCEDB_SERVER_ENTRY *pServerEntry;
struct _SMBCEDB_SESSION_ENTRY *pSessionEntry;
struct _SMBCEDB_NET_ROOT_ENTRY *pNetRootEntry;
USHORT Flags;
SMB_TREE_ID TreeId;
BOOLEAN NumberOfActiveVNetRootIncremented;
} SMBCE_V_NET_ROOT_CONTEXT, *PSMBCE_V_NET_ROOT_CONTEXT;
//
// An SMBCEDB_REQUEST_ENTRY encapsulates an action being processed by the SMBCE connection
// engine. The requests come in vairous flavours and each of these flavours is associated
// with the appropriate context required for resumption. In order to provide better memory
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -