📄 smb.h
字号:
typedef struct _SmbCore_WriteReq /* smb_wct = 5 */{ uint8_t smb_wct; /* count of 16-bit words that follow */ uint16_t smb_fid; /* file handle */ uint16_t smb_cnt; /* count of bytes */ uint16_t smb_olow; /* offset low */ uint16_t smb_ohigh; /* offset high */ uint16_t smb_left; /* count left */ uint16_t smb_bcc; /* length of data + 3 */#if 0 uint16_t smb_fmt; /* Data Block -- 01 */ uint16_t smb_dlen; /* length of data */ uint8_t smb_buf[]; /* data */#endif} SmbCore_WriteReq;typedef struct _SmbCore_WriteResp /* smb_wct = 1 */{ uint8_t smb_wct; /* count of 16-bit words that follow */ uint16_t smb_cnt; /* count */ uint16_t smb_bcc; /* must be 0 */} SmbCore_WriteResp;/******************************************************************** * Transaction :: smb_com = SMB_COM_TRANS * ********************************************************************/typedef struct _SmbLm10_TransactionReq /* smb_wct = 14 + value of smb_suwcnt */{ uint8_t smb_wct; /* count of 16-bit words that follow */ uint16_t smb_tpscnt; /* total number of parameter bytes being sent */ uint16_t smb_tdscnt; /* total number of data bytes being sent */ uint16_t smb_mprcnt; /* max number of parameter bytes to return */ uint16_t smb_mdrcnt; /* max number of data bytes to return */ uint8_t smb_msrcnt; /* max number of setup words to return */ uint8_t smb_rsvd; /* reserved (pad above to word) */ uint16_t smb_flags; /* additional information: bit 0 - if set, also disconnect TID in smb_tid bit 1 - if set, transaction is one way (no final response) */ uint32_t smb_timeout; /* number of milliseconds to wait for completion */ uint16_t smb_rsvd1; /* reserved */ uint16_t smb_pscnt; /* number of parameter bytes being sent this buffer */ uint16_t smb_psoff; /* offset (from start of SMB hdr) to parameter bytes */ uint16_t smb_dscnt; /* number of data bytes being sent this buffer */ uint16_t smb_dsoff; /* offset (from start of SMB hdr) to data bytes */ uint8_t smb_suwcnt; /* set up word count */ uint8_t smb_rsvd2; /* reserved (pad above to word) */#if 0 uint16_t smb_setup[*]; /* variable number of set up words (* = smb_suwcnt) */ uint16_t smb_bcc; /* total bytes (including pad bytes) following */ uint8_t smb_name[]; /* name of transaction */ uint8_t smb_pad[]; /* (optional) to pad to word or dword boundary */ uint8_t smb_param[*]; /* param bytes (* = value of smb_pscnt) */ uint8_t smb_pad1[]; /* (optional) to pad to word or dword boundary */ uint8_t smb_data[*]; /* data bytes (* = value of smb_dscnt) */#endif} SmbLm10_TransactionReq;typedef struct _SmbLm10_TransactionInterimResp /* smb_wct = 0 */{ uint8_t smb_wct; /* count of 16-bit words that follow */ uint16_t smb_bcc; /* must be 0 */} SmbLm10_TransactionInterimResp;typedef struct _SmbLm10_TransactionSecondaryReq /* smb_wct = 8 */{ uint8_t smb_wct; /* count of 16-bit words that follow */ uint16_t smb_tpscnt; /* total number of parameter bytes being sent */ uint16_t smb_tdscnt; /* total number of data bytes being sent */ uint16_t smb_pscnt; /* number of parameter bytes being sent this buffer */ uint16_t smb_psoff; /* offset (from start of SMB hdr) to parameter bytes */ uint16_t smb_psdisp; /* byte displacement for these parameter bytes */ uint16_t smb_dscnt; /* number of data bytes being sent this buffer */ uint16_t smb_dsoff; /* offset (from start of SMB hdr) to data bytes */ uint16_t smb_dsdisp; /* byte displacement for these data bytes */ uint16_t smb_bcc; /* total bytes (including pad bytes) following */#if 0 uint8_t smb_pad[]; /* (optional) to pad to word or dword boundary */ uint8_t smb_param[*]; /* param bytes (* = value of smb_pscnt) */ uint8_t smb_pad1[]; /* (optional) to pad to word or dword boundary */ uint8_t smb_data[*]; /* data bytes (* = value of smb_dscnt) */#endif} SmbLm10_TransactionSecondaryReq;typedef struct _SmbLm10_TransactionResp /* smb_wct = 10 + value of smb_suwcnt */{ uint8_t smb_wct; /* count of 16-bit words that follow */ uint16_t smb_tprcnt; /* total number of parameter bytes being returned */ uint16_t smb_tdrcnt; /* total number of data bytes being returned */ uint16_t smb_rsvd; /* reserved */ uint16_t smb_prcnt; /* number of parameter bytes being returned this buf */ uint16_t smb_proff; /* offset (from start of SMB hdr) to parameter bytes */ uint16_t smb_prdisp; /* byte displacement for these parameter bytes */ uint16_t smb_drcnt; /* number of data bytes being returned this buffer */ uint16_t smb_droff; /* offset (from start of SMB hdr) to data bytes */ uint16_t smb_drdisp; /* byte displacement for these data bytes */ uint8_t smb_suwcnt; /* set up return word count */ uint8_t smb_rsvd1; /* reserved (pad above to word) */#if 0 uint16_t smb_setup[*]; /* variable # of set up return words (* = smb_suwcnt) */ uint16_t smb_bcc; /* total bytes (including pad bytes) following */ uint8_t smb_pad[]; /* (optional) to pad to word or dword boundary */ uint8_t smb_param[*]; /* param bytes (* = value of smb_prcnt) */ uint8_t smb_pad1[]; /* (optional) to pad to word or dword boundary */ uint8_t smb_data[*]; /* data bytes (* = value of smb_drcnt) */#endif} SmbLm10_TransactionResp;typedef struct _SmbLm10_TransactNamedPipeReq /* smb_wct = 16 */{ uint8_t smb_wct; /* count of 16-bit words that follow */ uint16_t smb_tpscnt; /* total number of parameter bytes being sent */ uint16_t smb_tdscnt; /* size of data to be written to pipe (if any) */ uint16_t smb_mprcnt; /* max number of parameter bytes to return */ uint16_t smb_mdrcnt; /* size of data to be read from pipe (if any) */ uint8_t smb_msrcnt; /* value = 0 max number of setup words to return */ uint8_t smb_rsvd; /* reserved (pad above to word) */ uint16_t smb_flags; /* additional information: bit 0 - if set, also disconnect TID in smb_tid bit 1 - not set, response is required */ uint32_t smb_timeout; /* (user defined) number of milliseconds to wait */ uint16_t smb_rsvd1; /* reserved */ uint16_t smb_pscnt; /* number of parameter bytes being sent this buffer */ uint16_t smb_psoff; /* offset (from start of SMB hdr) to parameter bytes */ uint16_t smb_dscnt; /* number of data bytes being sent this buffer */ uint16_t smb_dsoff; /* offset (from start of SMB hdr) to data bytes */ uint8_t smb_suwcnt; /* value = 2 */ uint8_t smb_rsvd2; /* reserved (pad above to word) */ uint16_t smb_setup1; /* function (defined below) 0x54 - CallNmPipe - open/write/read/close pipe 0x53 - WaitNmPipe - wait for pipe to be nonbusy 0x23 - PeekNmPipe - read but don’t remove data 0x21 - QNmPHandState - query pipe handle modes 0x01 - SetNmPHandState - set pipe handle modes 0x22 - QNmPipeInfo - query pipe attributes 0x26 - TransactNmPipe - write/read operation on pipe 0x11 - RawReadNmPipe - read pipe in "raw" (non message mode) 0x31 - RawWriteNmPipe - write pipe "raw" (non message mode) */ uint16_t smb_setup2; /* FID (handle) of pipe (if needed), or priority */ uint16_t smb_bcc; /* total bytes (including pad bytes) following */#if 0 uint8_t smb_name[]; /* "\PIPE\<name>0" */ uint8_t smb_pad[]; /* (optional) to pad to word or dword boundary */ uint8_t smb_param[*]; /* param bytes (* = value of smb_pscnt) */ uint8_t smb_pad1[]; /* (optional) to pad to word or dword boundary */ uint8_t smb_data[*]; /* data bytes (* = value of smb_dscnt) */#endif} SmbLm10_TransactNamedPipeReq;typedef struct _SmbLm10_TransactNamedPipeResp /* smb_wct = 10 */{ uint8_t smb_wct; /* count of 16-bit words that follow */ uint16_t smb_tprcnt; /* total number of parameter bytes being returned */ uint16_t smb_tdrcnt; /* total number of data bytes being returned */ uint16_t smb_rsvd; /* reserved */ uint16_t smb_prcnt; /* number of parameter bytes being returned this buf */ uint16_t smb_proff; /* offset (from start of SMB hdr) to parameter bytes */ uint16_t smb_prdisp; /* byte displacement for these parameter bytes */ uint16_t smb_drcnt; /* number of data bytes being returned this buffer */ uint16_t smb_droff; /* offset (from start of SMB hdr) to data bytes */ uint16_t smb_drdisp; /* byte displacement for these data bytes */ uint8_t smb_suwcnt; /* set up return word count */ uint8_t smb_rsvd1; /* reserved (pad above to word) */ uint16_t smb_bcc; /* total bytes (including pad bytes) following */#if 0 uint8_t smb_pad[]; /* (optional) to pad to word or dword boundary */ uint8_t smb_param[*]; /* param bytes (* = value of smb_prcnt) */ uint8_t smb_pad1[]; /* (optional) to pad to word or dword boundary */ uint8_t smb_data[*]; /* data bytes (* = value of smb_drcnt) */#endif} SmbLm10_TransactNamedPipeResp;/******************************************************************** * Write and Close :: smb_com = SMB_COM_WRITE_AND_CLOSE * ********************************************************************/typedef struct _SmbLm10_WriteAndCloseReq6 /* smb_wct = 6 */{ uint8_t smb_wct; /* count of 16-bit words that follow */ uint16_t smb_fid; /* file handle (close after write) */ uint16_t smb_count; /* number of bytes to write */ uint32_t smb_offset; /* offset in file to begin write */ uint32_t smb_mtime; /* modification time */ uint16_t smb_bcc; /* 1 (for pad) + value of smb_count */#if 0 uint8_t smb_pad; /* force data to dword boundary */ uint8_t smb_data[]; /* data */#endif} SmbLm10_WriteAndCloseReq6;typedef struct _SmbLm10_WriteAndCloseReq12 /* smb_wct = 12 */{ uint8_t smb_wct; /* count of 16-bit words that follow */ uint16_t smb_fid; /* file handle (close after write) */ uint16_t smb_count; /* number of bytes to write */ uint32_t smb_offset; /* offset in file to begin write */ uint32_t smb_mtime; /* modification time */ uint32_t smb_rsvd1; /* Optional */ uint32_t smb_rsvd2; /* Optional */ uint32_t smb_rsvd3; /* Optional */ uint16_t smb_bcc; /* 1 (for pad) + value of smb_count */#if 0 uint8_t smb_pad; /* force data to dword boundary */ uint8_t smb_data[]; /* data */#endif} SmbLm10_WriteAndCloseReq12;typedef struct _SmbLm10_WriteAndCloseResp /* smb_wct = 1 */{ uint8_t smb_wct; /* count of 16-bit words that follow */ uint8_t smb_count; /* number of bytes written */ uint16_t smb_bcc; /* must be 0 */} SmbLm10_WriteAndCloseResp;/******************************************************************** * Write Block Raw :: smb_com = SMB_COM_WRITE_BLOCK_RAW * ********************************************************************/typedef struct _SmbLm10_WriteBlockRawReq{ uint8_t smb_wct; /* value = 12 */ uint16_t smb_fid; /* file handle */ uint16_t smb_tcount; /* total bytes (including this buf, 65,535 max ) */ uint16_t smb_rsvd; /* reserved */ uint32_t smb_offset; /* offset in file to begin write */ uint32_t smb_timeout; /* number of milliseconds to wait for completion */ uint16_t smb_wmode; /* write mode: bit0 - complete write to disk and send final result response bit1 - return smb_remaining (pipes/devices only) */ uint32_t smb_rsvd2; /* reserved */ uint16_t smb_dsize; /* number of data bytes this buffer (min value = 0) */ uint16_t smb_doff; /* offset (from start of SMB hdr) to data bytes */ uint16_t smb_bcc; /* total bytes (including pad bytes) following */#if 0 uint8_t smb_pad[]; /* (optional) to pad to word or dword boundary */ uint8_t smb_data[*]; /* data bytes (* = value of smb_dsize) */#endif} SmbLm10_WriteBlockRawReq;typedef struct _SmbLm10_WriteBlockRawFirstResp{ uint8_t smb_wct; /* value = 1 */ uint16_t smb_remaining; /* bytes remaining to be read (pipes/devices only) */ uint16_t smb_bcc; /* value = 0 */} SmbLm10_WriteBlockRawFirstResp;/* If write through or error :: smb_com = SMB_COM_WRITE_COMPLETE */typedef struct _SmbLm10_WriteBlockRawFinalResp{ uint8_t smb_wct; /* value = 1 */ uint16_t smb_count; /* total number of bytes written */ uint16_t smb_bcc; /* value = 0 */} SmbLm10_WriteBlockRawFinalResp;typedef struct _SmbNt10_WriteBlockRawReq{ uint8_t smb_wct; /* value = 14 */ uint16_t smb_fid; /* file handle */ uint16_t smb_tcount; /* total bytes (including this buf, 65,535 max ) */ uint16_t smb_rsvd; /* reserved */ uint32_t smb_offset; /* offset in file to begin write */ uint32_t smb_timeout; /* number of milliseconds to wait for completion */ uint16_t smb_wmode; /* write mode: bit0 - complete write to disk and send final result response bit1 - return smb_remaining (pipes/devices only) */ uint32_t smb_rsvd2; /* reserved */ uint16_t smb_dsize; /* number of data bytes this buffer (min value = 0) */ uint16_t smb_doff; /* offset (from start of SMB hdr) to data bytes */ uint32_t smb_off_high; /* high offset in file to begin write */ uint16_t smb_bcc; /* total bytes (including pad bytes) following */#if 0 uint8_t smb_pad[]; /* (optional) to pad to word or dword boundary */ uint8_t smb_data[*]; /* data bytes (* = value of smb_dsize) */#endif} SmbNt10_WriteBlockRawReq;/********************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -