|
@@ -33,6 +33,8 @@
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
+#include "bdsm_common.h"
|
|
|
+
|
|
|
#define SMB_ANDX_MEMBERS \
|
|
|
uint8_t andx; /* 0xff when no other command (do this :)*/ \
|
|
|
uint8_t andx_reserved; /* 0x00 */ \
|
|
@@ -56,13 +58,13 @@ typedef struct
|
|
|
uint16_t pid; // Process ID.
|
|
|
uint16_t uid; // User ID.
|
|
|
uint16_t mux_id; // Multiplex ID. Increment it sometimes.
|
|
|
-} __attribute__((packed)) smb_header;
|
|
|
+} SMB_PACKED_STRUCT smb_header;
|
|
|
|
|
|
typedef struct
|
|
|
{
|
|
|
smb_header header; // A packet header full of gorgeous goodness.
|
|
|
uint8_t payload[]; // Ze yummy data inside. Eat 5 fruits/day !
|
|
|
-} __attribute__((packed)) smb_packet;
|
|
|
+} SMB_PACKED_STRUCT smb_packet;
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
@@ -73,7 +75,7 @@ typedef struct
|
|
|
{
|
|
|
uint8_t wct; // 0
|
|
|
uint16_t bct;
|
|
|
-} __attribute__((packed)) smb_simple_struct;
|
|
|
+} SMB_PACKED_STRUCT smb_simple_struct;
|
|
|
|
|
|
|
|
|
//-> Negotiate Protocol
|
|
@@ -83,7 +85,7 @@ typedef struct
|
|
|
uint16_t bct;
|
|
|
char dialects[];
|
|
|
|
|
|
-} __attribute__((packed)) smb_nego_req;
|
|
|
+} SMB_PACKED_STRUCT smb_nego_req;
|
|
|
|
|
|
|
|
|
#define SMB_NEGO_RESP_COMMON \
|
|
@@ -106,7 +108,7 @@ typedef struct
|
|
|
SMB_NEGO_RESP_COMMON
|
|
|
uint64_t challenge; // Normally 8 bytes, if not then wtf monkey
|
|
|
uint8_t payload[]; // The rest isn't really meaningfull for us
|
|
|
-} __attribute__((packed)) smb_nego_resp;
|
|
|
+} SMB_PACKED_STRUCT smb_nego_resp;
|
|
|
|
|
|
//<- Negotiate Protocol
|
|
|
typedef struct
|
|
@@ -114,7 +116,7 @@ typedef struct
|
|
|
SMB_NEGO_RESP_COMMON
|
|
|
uint8_t srv_guid[16];
|
|
|
uint8_t gssapi[];
|
|
|
-} __attribute__((packed)) smb_nego_xsec_resp;
|
|
|
+} SMB_PACKED_STRUCT smb_nego_xsec_resp;
|
|
|
|
|
|
#define SMB_SESSION_REQ_COMMON \
|
|
|
uint8_t wct; /* +-13 :) */ \
|
|
@@ -134,7 +136,7 @@ typedef struct
|
|
|
uint32_t caps; // Capabilities
|
|
|
uint16_t payload_size;
|
|
|
uint8_t payload[];
|
|
|
-} __attribute__((packed)) smb_session_req;
|
|
|
+} SMB_PACKED_STRUCT smb_session_req;
|
|
|
|
|
|
//-> Session Setup
|
|
|
typedef struct
|
|
@@ -145,7 +147,7 @@ typedef struct
|
|
|
uint32_t caps; // Capabilities
|
|
|
uint16_t payload_size;
|
|
|
uint8_t payload[];
|
|
|
-} __attribute__((packed)) smb_session_xsec_req;
|
|
|
+} SMB_PACKED_STRUCT smb_session_xsec_req;
|
|
|
|
|
|
|
|
|
//<- Session Setup
|
|
@@ -156,7 +158,7 @@ typedef struct
|
|
|
uint16_t action;
|
|
|
uint16_t bct;
|
|
|
uint8_t bullshit[];
|
|
|
-} __attribute__((packed)) smb_session_resp;
|
|
|
+} SMB_PACKED_STRUCT smb_session_resp;
|
|
|
|
|
|
typedef struct
|
|
|
{
|
|
@@ -166,7 +168,7 @@ typedef struct
|
|
|
uint16_t xsec_blob_size;
|
|
|
uint16_t payload_size;
|
|
|
uint8_t payload[];
|
|
|
-} __attribute__((packed)) smb_session_xsec_resp;
|
|
|
+} SMB_PACKED_STRUCT smb_session_xsec_resp;
|
|
|
|
|
|
|
|
|
|
|
@@ -180,7 +182,7 @@ typedef struct
|
|
|
uint16_t bct;
|
|
|
uint8_t payload[]; // Password | Path | Service
|
|
|
|
|
|
-} __attribute__((packed)) smb_tree_connect_req;
|
|
|
+} SMB_PACKED_STRUCT smb_tree_connect_req;
|
|
|
|
|
|
//<- Tree Connect
|
|
|
typedef struct
|
|
@@ -192,7 +194,7 @@ typedef struct
|
|
|
uint32_t guest_rights;
|
|
|
uint16_t bct;
|
|
|
uint8_t payload[];
|
|
|
-} __attribute__((packed)) smb_tree_connect_resp;
|
|
|
+} SMB_PACKED_STRUCT smb_tree_connect_resp;
|
|
|
|
|
|
//-> Tree Disconnect / <- Tree Disconnect
|
|
|
typedef smb_simple_struct smb_tree_disconnect_req;
|
|
@@ -217,7 +219,7 @@ typedef struct
|
|
|
uint8_t security_flags;
|
|
|
uint16_t bct;
|
|
|
uint8_t path[]; // UTF16 Path, starting with '\'
|
|
|
-} __attribute__((packed)) smb_create_req;
|
|
|
+} SMB_PACKED_STRUCT smb_create_req;
|
|
|
|
|
|
//<- Create File
|
|
|
typedef struct
|
|
@@ -238,7 +240,7 @@ typedef struct
|
|
|
uint16_t ipc_state;
|
|
|
uint8_t is_dir;
|
|
|
uint16_t bct; // 0
|
|
|
-} __attribute__((packed)) smb_create_resp;
|
|
|
+} SMB_PACKED_STRUCT smb_create_resp;
|
|
|
|
|
|
|
|
|
|
|
@@ -249,7 +251,7 @@ typedef struct
|
|
|
uint16_t fid;
|
|
|
uint32_t last_write; // Not defined == 0xffffffff
|
|
|
uint16_t bct; // 0
|
|
|
-} __attribute__((packed)) smb_close_req;
|
|
|
+} SMB_PACKED_STRUCT smb_close_req;
|
|
|
|
|
|
|
|
|
|
|
@@ -266,7 +268,7 @@ typedef struct
|
|
|
uint16_t remaining;
|
|
|
uint32_t offset_high; // Continuation of offset field'
|
|
|
uint16_t bct; // 0
|
|
|
-} __attribute__((packed)) smb_read_req;
|
|
|
+} SMB_PACKED_STRUCT smb_read_req;
|
|
|
|
|
|
//<- Read File
|
|
|
typedef struct
|
|
@@ -282,7 +284,7 @@ typedef struct
|
|
|
uint32_t reserved2;
|
|
|
uint16_t reserved3;
|
|
|
uint16_t bct;
|
|
|
-} __attribute__((packed)) smb_read_resp;
|
|
|
+} SMB_PACKED_STRUCT smb_read_resp;
|
|
|
|
|
|
//-> Write File
|
|
|
typedef struct
|
|
@@ -300,7 +302,7 @@ typedef struct
|
|
|
uint32_t offset_high; // Continuation of offset field'
|
|
|
uint16_t bct;
|
|
|
uint8_t padding;
|
|
|
-} __attribute__((packed)) smb_write_req;
|
|
|
+} SMB_PACKED_STRUCT smb_write_req;
|
|
|
|
|
|
//<- Write File
|
|
|
typedef struct
|
|
@@ -312,7 +314,7 @@ typedef struct
|
|
|
uint16_t available;
|
|
|
uint32_t reserved;
|
|
|
uint16_t bct;
|
|
|
-} __attribute__((packed)) smb_write_resp;
|
|
|
+} SMB_PACKED_STRUCT smb_write_resp;
|
|
|
|
|
|
//-> Remove File
|
|
|
typedef struct
|
|
@@ -321,14 +323,14 @@ typedef struct
|
|
|
uint16_t search_attributes; // 0x0000 for "normal" (not hidden/ystem) files
|
|
|
uint16_t bct; // >= 2
|
|
|
uint8_t buffer_format; // 0x04
|
|
|
-} __attribute__((packed)) smb_file_rm_req;
|
|
|
+} SMB_PACKED_STRUCT smb_file_rm_req;
|
|
|
|
|
|
//<- Remove File
|
|
|
typedef struct
|
|
|
{
|
|
|
uint8_t wct; // 0x00
|
|
|
uint16_t bct; // 0x0000
|
|
|
-} __attribute__((packed)) smb_file_rm_resp;
|
|
|
+} SMB_PACKED_STRUCT smb_file_rm_resp;
|
|
|
|
|
|
//-> Remove Directory
|
|
|
typedef struct
|
|
@@ -336,14 +338,14 @@ typedef struct
|
|
|
uint8_t wct; // 0x00
|
|
|
uint16_t bct; // >= 2
|
|
|
uint8_t buffer_format; // 0x04
|
|
|
-} __attribute__((packed)) smb_directory_rm_req;
|
|
|
+} SMB_PACKED_STRUCT smb_directory_rm_req;
|
|
|
|
|
|
//<- Remove Directory
|
|
|
typedef struct
|
|
|
{
|
|
|
uint8_t wct; // 0x00
|
|
|
uint16_t bct; // 0x0000
|
|
|
-} __attribute__((packed)) smb_directory_rm_resp;
|
|
|
+} SMB_PACKED_STRUCT smb_directory_rm_resp;
|
|
|
|
|
|
//-> Move File
|
|
|
typedef struct
|
|
@@ -351,7 +353,7 @@ typedef struct
|
|
|
uint8_t wct; // 0x01
|
|
|
uint16_t search_attributes; // 0x0000 for "normal" (not hidden/ystem) files
|
|
|
uint16_t bct; // >= 2
|
|
|
-} __attribute__((packed)) smb_file_mv_req;
|
|
|
+} SMB_PACKED_STRUCT smb_file_mv_req;
|
|
|
|
|
|
//<- Move File
|
|
|
typedef smb_simple_struct smb_file_mv_resp;
|
|
@@ -362,7 +364,7 @@ typedef struct
|
|
|
uint8_t wct; // 0x00
|
|
|
uint16_t bct; // >= 2
|
|
|
uint8_t buffer_format; // 0x04
|
|
|
-} __attribute__((packed)) smb_directory_mk_req;
|
|
|
+} SMB_PACKED_STRUCT smb_directory_mk_req;
|
|
|
|
|
|
//<- Create Directory
|
|
|
typedef smb_simple_struct smb_directory_mk_resp;
|
|
@@ -390,7 +392,7 @@ typedef struct
|
|
|
uint16_t fid;
|
|
|
uint16_t bct;
|
|
|
uint8_t payload[];
|
|
|
-} __attribute__((packed)) smb_trans_req;
|
|
|
+} SMB_PACKED_STRUCT smb_trans_req;
|
|
|
|
|
|
|
|
|
|
|
@@ -419,7 +421,7 @@ typedef struct
|
|
|
uint16_t bct;
|
|
|
uint8_t padding[3];
|
|
|
uint8_t payload[];
|
|
|
-} __attribute__((packed)) smb_trans2_req;
|
|
|
+} SMB_PACKED_STRUCT smb_trans2_req;
|
|
|
|
|
|
//// -> Trans2|FindFirst2
|
|
|
typedef struct
|
|
@@ -430,7 +432,7 @@ typedef struct
|
|
|
uint16_t interest; // What kind of info do we want ?
|
|
|
uint32_t storage; // ? => 0
|
|
|
uint8_t pattern[]; // The queried pattern "\\folder\\*"
|
|
|
-} __attribute__((packed)) smb_tr2_findfirst2;
|
|
|
+} SMB_PACKED_STRUCT smb_tr2_findfirst2;
|
|
|
|
|
|
//// -> Trans2|FindNext2
|
|
|
typedef struct
|
|
@@ -441,7 +443,7 @@ typedef struct
|
|
|
uint32_t resume_key; // Value returned by previous find2 call
|
|
|
uint16_t flags;
|
|
|
uint8_t pattern[]; // The queried pattern "\\folder\\*"
|
|
|
-} __attribute__((packed)) smb_tr2_findnext2;
|
|
|
+} SMB_PACKED_STRUCT smb_tr2_findnext2;
|
|
|
|
|
|
//// -> Trans2|QueryPathInfo
|
|
|
typedef struct
|
|
@@ -449,7 +451,7 @@ typedef struct
|
|
|
uint16_t interest;
|
|
|
uint32_t reserved;
|
|
|
uint8_t path[];
|
|
|
-} __attribute__((packed)) smb_tr2_query;
|
|
|
+} SMB_PACKED_STRUCT smb_tr2_query;
|
|
|
|
|
|
//<- Trans2
|
|
|
|
|
@@ -470,7 +472,7 @@ typedef struct
|
|
|
uint16_t bct;
|
|
|
uint8_t padding;
|
|
|
uint8_t payload[];
|
|
|
-} __attribute__((packed)) smb_trans2_resp;
|
|
|
+} SMB_PACKED_STRUCT smb_trans2_resp;
|
|
|
|
|
|
//// <- Trans2|FindFirst2Params
|
|
|
typedef struct
|
|
@@ -481,7 +483,7 @@ typedef struct
|
|
|
uint16_t ea_error_offset;
|
|
|
uint16_t last_name_offset;
|
|
|
uint16_t padding;
|
|
|
-} __attribute__((packed)) smb_tr2_findfirst2_params;
|
|
|
+} SMB_PACKED_STRUCT smb_tr2_findfirst2_params;
|
|
|
|
|
|
//// <- Trans2|FindNext2Params
|
|
|
typedef struct
|
|
@@ -490,7 +492,7 @@ typedef struct
|
|
|
uint16_t eos;
|
|
|
uint16_t ea_error_offset;
|
|
|
uint16_t last_name_offset;
|
|
|
-} __attribute__((packed)) smb_tr2_findnext2_params;
|
|
|
+} SMB_PACKED_STRUCT smb_tr2_findnext2_params;
|
|
|
|
|
|
//// <- Trans2|FindFirst2FileInfo
|
|
|
typedef struct
|
|
@@ -510,7 +512,7 @@ typedef struct
|
|
|
uint8_t reserved;
|
|
|
uint8_t short_name[24];
|
|
|
uint8_t name[];
|
|
|
-} __attribute__((packed)) smb_tr2_find2_entry;
|
|
|
+} SMB_PACKED_STRUCT smb_tr2_find2_entry;
|
|
|
|
|
|
|
|
|
//// <- Trans2|QueryPathInfo
|
|
@@ -531,7 +533,7 @@ typedef struct
|
|
|
uint32_t ea_list_len;
|
|
|
uint32_t name_len;
|
|
|
uint8_t name[];
|
|
|
-} __attribute__((packed)) smb_tr2_path_info;
|
|
|
+} SMB_PACKED_STRUCT smb_tr2_path_info;
|
|
|
|
|
|
//-> Example
|
|
|
typedef struct
|
|
@@ -542,7 +544,7 @@ typedef struct
|
|
|
uint16_t bct;
|
|
|
//uint8_t padding;
|
|
|
uint8_t file[];
|
|
|
-} __attribute__((packed)) smb_example_t;
|
|
|
+} SMB_PACKED_STRUCT smb_example_t;
|
|
|
|
|
|
|
|
|
#endif
|