📄 cifs.h
字号:
_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;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -