📄 smbcedbp.h
字号:
RemoveEntryList(&(pNetRootEntry)->NetRootsList);
#define SmbCeGetFirstNetRootEntry(pServerEntry) \
(IsListEmpty(&(pServerEntry)->NetRoots.ListHead) \
? NULL \
: (PSMBCEDB_NET_ROOT_ENTRY) \
(CONTAINING_RECORD((pServerEntry)->NetRoots.ListHead.Flink, \
SMBCEDB_NET_ROOT_ENTRY, \
NetRootsList)))
#define SmbCeGetNextNetRootEntry(pServerEntry,pNetRootEntry) \
(((pNetRootEntry)->NetRootsList.Flink == \
&(pServerEntry)->NetRoots.ListHead) \
? NULL \
: (PSMBCEDB_NET_ROOT_ENTRY) \
(CONTAINING_RECORD((pNetRootEntry)->NetRootsList.Flink, \
SMBCEDB_NET_ROOT_ENTRY, \
NetRootsList)))
// Macros to manipulate the collection of SMBCE_V_NET_ROOT_CONTEXT instances.
#define SmbCeAddVNetRootContext(pVNetRootContexts,pVNetRootContext) \
SmbCeAcquireSpinLock(); \
InsertTailList(&(pVNetRootContexts)->ListHead,&(pVNetRootContext)->ListEntry); \
SmbCeReleaseSpinLock()
#define SmbCeAddVNetRootContextLite(pVNetRootContexts,pVNetRootContext) \
InsertTailList(&(pVNetRootContexts)->ListHead,&(pVNetRootContext)->ListEntry);
#define SmbCeRemoveVNetRootContext(pVNetRootContexts,pVNetRootContext) \
SmbCeAcquireSpinLock(); \
RemoveEntryList(&(pVNetRootContext)->ListEntry); \
SmbCeReleaseSpinLock()
#define SmbCeRemoveVNetRootContextLite(pVNetRootContexts,pVNetRootContext) \
RemoveEntryList(&(pVNetRootContext)->ListEntry);
#define SmbCeGetFirstVNetRootContext(pVNetRootContexts) \
(IsListEmpty(&((pVNetRootContexts)->ListHead)) \
? NULL \
: (PSMBCE_V_NET_ROOT_CONTEXT) \
(CONTAINING_RECORD((pVNetRootContexts)->ListHead.Flink, \
SMBCE_V_NET_ROOT_CONTEXT, \
ListEntry)))
#define SmbCeGetNextVNetRootContext(pVNetRootContexts,pVNetRootContext) \
(((pVNetRootContext)->ListEntry.Flink == \
&(pVNetRootContexts)->ListHead) \
? NULL \
: (PSMBCE_V_NET_ROOT_CONTEXT) \
(CONTAINING_RECORD((pVNetRootContext)->ListEntry.Flink, \
SMBCE_V_NET_ROOT_CONTEXT, \
ListEntry)))
//
// SmbCe database initialization
//
extern NTSTATUS
SmbCeDbInit();
extern VOID
SmbCeDbTearDown();
//
// Object allocation and deallocation
//
extern PSMBCE_OBJECT_HEADER
SmbCeDbAllocateObject(
SMBCEDB_OBJECT_TYPE ObjectType);
extern VOID
SmbCeDbFreeObject(
PVOID pObject);
//
// Object destruction
//
extern VOID
SmbCeTearDownServerEntry(PSMBCEDB_SERVER_ENTRY pServerEntry);
extern VOID
SmbCeTearDownNetRootEntry(PSMBCEDB_NET_ROOT_ENTRY pNetRootEntry);
extern VOID
SmbCeTearDownSessionEntry(PSMBCEDB_SESSION_ENTRY pSessionEntry);
extern VOID
SmbCeTearDownRequestEntry(PSMBCEDB_REQUEST_ENTRY pRequestEntry);
//
// The routines for mapping a MID with an exchange and for associating an exchange with
// a MID
//
extern NTSTATUS
SmbCeAssociateExchangeWithMid(
PSMBCEDB_SERVER_ENTRY pServerEntry,
struct _SMB_EXCHANGE *pExchange);
extern struct _SMB_EXCHANGE *
SmbCeMapMidToExchange(
PSMBCEDB_SERVER_ENTRY pServerEntry,
SMB_MPX_ID Mid);
extern NTSTATUS
SmbCeDissociateMidFromExchange(
PSMBCEDB_SERVER_ENTRY pServerEntry,
struct _SMB_EXCHANGE *pExchange);
extern struct _SMB_EXCHANGE *
SmbCeGetExchangeAssociatedWithBuffer(
PSMBCEDB_SERVER_ENTRY pServerEntry,
PVOID pBuffer);
extern NTSTATUS
SmbCeAssociateBufferWithExchange(
PSMBCEDB_SERVER_ENTRY pServerEntry,
struct _SMB_EXCHANGE * pExchange,
PVOID pBuffer);
extern VOID
SmbCePurgeBuffersAssociatedWithExchange(
PSMBCEDB_SERVER_ENTRY pServerEntry,
struct _SMB_EXCHANGE * pExchange);
extern NTSTATUS
SmbCepDiscardMidAssociatedWithExchange(
struct _SMB_EXCHANGE * pExchange);
extern VOID
SmbCeResumeDiscardedMidAssignmentRequests(
PSMBCEDB_REQUESTS pMidRequests,
NTSTATUS ResumptionStatus);
//
// Routines for handling transport disconnects/invalidation.
//
extern VOID
SmbCeTransportDisconnectIndicated(
PSMBCEDB_SERVER_ENTRY pServerEntry);
extern VOID
SmbCeResumeAllOutstandingRequestsOnError(
PSMBCEDB_SERVER_ENTRY pServerEntry);
extern VOID
SmbCeHandleTransportInvalidation(
struct _SMBCE_TRANSPORT_ *pTransport);
extern VOID
SmbCeFinalizeAllExchangesForNetRoot(
PMRX_NET_ROOT pNetRoot);
//
// Resource acquistion/release
//
PVOID SmbCeDbResourceAcquireFile;
ULONG SmbCeDbResourceAcquireLine;
#define SmbCeAcquireResource() \
ExAcquireResourceExclusiveLite(&s_SmbCeDbResource,TRUE);\
SmbCeDbResourceAcquireFile = __FILE__;\
SmbCeDbResourceAcquireLine = __LINE__
#define SmbCeReleaseResource() \
SmbCeDbResourceAcquireFile = NULL;\
SmbCeDbResourceAcquireLine = 0;\
ExReleaseResourceLite(&s_SmbCeDbResource)
#define SmbCeIsResourceOwned() ExIsResourceAcquiredExclusive(&s_SmbCeDbResource)
#define SmbCeAcquireSpinLock() \
KeAcquireSpinLock(&s_SmbCeDbSpinLock,&s_SmbCeDbSpinLockSavedIrql); \
s_SmbCeDbSpinLockAcquired = TRUE
#define SmbCeReleaseSpinLock() \
s_SmbCeDbSpinLockAcquired = FALSE; \
KeReleaseSpinLock(&s_SmbCeDbSpinLock,s_SmbCeDbSpinLockSavedIrql)
#define SmbCeSpinLockAcquired() \
(s_SmbCeDbSpinLockAcquired == TRUE)
//INLINE BOOLEAN SmbCeDbIsEntryInUse(PSMBCE_OBJECT_HEADER pHeader)
/*++
Routine Description:
This routine determines if a SmbCe database entry is in use.
Arguments:
pHeader - the entry header
Return Value:
TRUE if the entry is in use otherwise FALSE
--*/
#define SmbCeIsEntryInUse(pHeader) \
(((PSMBCE_OBJECT_HEADER)(pHeader))->State == SMBCEDB_ACTIVE || \
((PSMBCE_OBJECT_HEADER)(pHeader))->State == SMBCEDB_INVALID || \
((PSMBCE_OBJECT_HEADER)(pHeader))->State == SMBCEDB_CONSTRUCTION_IN_PROGRESS)
#define SmbCeSetServerType(pServerEntry,ServerType) \
(pServerEntry)->Header.Flags = (UCHAR)(ServerType)
#define SmbCeGetServerType(pServerEntry) \
((SMBCEDB_SERVER_TYPE)(pServerEntry)->Header.Flags)
//
// Static variable declarations that constitute the SmbCe database.
//
extern SMBCEDB_SERVERS s_DbServers;
//
// Currently there is only one resource for synchronizing the access to all the
// entities in the connection engine database. It is possible to customize it
// subsequently since the acquistion/release methods take the type of the object
// as a parameter.
//
extern ERESOURCE s_SmbCeDbResource;
extern RX_SPIN_LOCK s_SmbCeDbSpinLock;
extern KIRQL s_SmbCeDbSpinLockSavedIrql;
extern BOOLEAN s_SmbCeDbSpinLockAcquired;
#endif // _SMBCEDBP_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -