blob: 8d5cef4d8fca03eb1920de368aebd5dc480cf989 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
|
module cifs
#define BOOL uint32
#define UCHAR uint8
#define USHORT uint16
#define LONG uint32
#define ULONG uint32
#define DWORD uint32
#define SMB_TIME uint16
#define SMB_DATE uint16
typedef struct {
ULONG low;
LONG high;
} TIME;
typedef struct {
ULONG low;
ULONG high;
} hyper;
typedef struct {
uint8 cmd;
uint8 reserved;
uint16 offset;
} ANDX_INFO;
typedef struct {
uint8 tag2;
fstring protocol;
} BUF2;
typedef struct {
uint16 bcount;
BUF2 protocol[*];
} Q_NEGPROT_0;
typedef struct {
uint8 wcount;
union ctr[wcount] {
case 0 Q_NEGPROT_0 q0;
}
} Q_NEGPROT;
typedef struct {
USHORT DialectIndex; /* Index of selected dialect */
USHORT SecurityMode; /* Security mode: */
/* bit 0: 0 = share, 1 = user */
/* bit 1: 1 = use challenge/response */
/* authentication */
USHORT MaxBufferSize; /* Max transmit buffer size (>= 1024) */
USHORT MaxMpxCount; /* Max pending multiplexed requests */
USHORT MaxNumberVcs; /* Max VCs between client and server */
USHORT RawMode; /* Raw modes supported: */
/* bit 0: 1 = Read Raw supported */
/* bit 1: 1 = Write Raw supported */
ULONG SessionKey; /* Unique token identifying this session */
SMB_TIME ServerTime; /* Current time at server */
SMB_DATE ServerDate; /* Current date at server */
USHORT ServerTimeZone; /* Current time zone at server */
USHORT ChallengeLength; /* Length of Challenge; MBZ if not LM2.1
/* dialect or later */
USHORT Reserved; /* MBZ */
USHORT ByteCount; /* Count of data bytes */
UCHAR Challenge[ChallengeLength]; /* The challenge */
fstring PrimaryDomain; /* The server's primary domain */
uint16 bcount;
uint8 chal[8];
fstring domain;
} R_NEGPROT_12;
typedef struct {
USHORT DialectIndex; /*Index of selected dialect */
UCHAR SecurityMode; /*Security mode: */
/* bit 0: 0 = share, 1 = user */
/* bit 1: 1 = use challenge/response */
/* authentication */
/* bit 2: 1 = Security Signatures (SMB integrity */
/* check) enabled */
/* bit 3: 1 = Security Signatures (SMB integrity */
/* check) required */
USHORT MaxMpxCount; /*Max pending outstanding requests */
USHORT MaxNumberVcs; /*Max VCs between client and server */
ULONG MaxBufferSize; /*Max transmit buffer size */
ULONG MaxRawSize; /*Maximum raw buffer size */
ULONG SessionKey; /*Unique token identifying this session */
ULONG Capabilities; /*Server capabilities */
ULONG SystemTimeLow; /*System (UTC) time of the server (low). */
ULONG SystemTimeHigh; /*System (UTC) time of the server (high). */
USHORT ServerTimeZone;/*Time zone of server (minutes from UTC) */
UCHAR SecurityBlobLength;/*Length of SecurityBlob */
USHORT bcount; /*Count of data bytes */
/*UCHAR GUID[16]; A globally unique identifier assigned to the */
/* server; present only when */
/* CAP_EXTENDED_SECURITY is on in the */
/* Capabilities field. */
UCHAR SecurityBlob[SecurityBlobLength]; /*Opaque Security Blob associated with the */
/* security package if CAP_EXTENDED_SECURITY is */
/* on in the Capabilities field; else challenge */
/* for CIFS challenge/response authentication. */
fstring OemDomainName; /*The name of the domain (in OEM chars); not */
/* present if CAP_EXTENDED_SECURITY is on in the */
/* Capabilities field */
} R_NEGPROT_17;
typedef struct {
uint8 wcount;
union ctr[wcount] {
case 17 R_NEGPROT_17 r17;
}
} R_NEGPROT;
typedef struct {
uint8 wcount;
uint16 vwv[wcount];
uint16 bcount;
uint8 none[bcount];
} Q_TDIS;
typedef struct {
uint8 wcount;
uint16 vwv[wcount];
uint16 bcount;
uint8 none[bcount];
} R_TDIS;
typedef struct {
ANDX_INFO andx;
uint16 bcount;
uint8 none[bcount];
} R_ULOGOFF_ANDX_2;
typedef struct {
uint8 wcount;
union ctr[wcount] {
case 2 R_ULOGOFF_ANDX_2 q2;
}
} R_ULOGOFF_ANDX;
typedef struct {
ANDX_INFO andx;
uint16 bcount;
uint8 none[bcount];
} Q_ULOGOFF_ANDX_2;
typedef struct {
uint8 wcount;
union ctr[wcount] {
case 2 Q_ULOGOFF_ANDX_2 q2;
}
} Q_ULOGOFF_ANDX;
typedef struct {
ANDX_INFO andx;
uint16 bufsize;
uint16 max_mpx;
uint16 vc;
ULONG sess_key;
uint16 pwlen;
ULONG reserved;
uint16 bcount;
uint8 password[pwlen];
fstring domain;
fstring os;
fstring server;
} Q_SESSION_SETUP_ANDX_10;
typedef struct {
ANDX_INFO andx;
uint16 bufsize;
uint16 max_mpx;
uint16 vc;
ULONG sess_key;
uint16 pwlen;
uint16 upwlen;
ULONG capabilities;
ULONG reserved;
uint16 bcount;
uint8 password[pwlen];
uint8 upassword[upwlen];
fstring user;
fstring domain;
fstring os;
fstring server;
} Q_SESSION_SETUP_ANDX_13;
typedef struct _Q_SESSION_SETUP_ANDX {
uint8 wcount;
union ctr[wcount] {
case 10 Q_SESSION_SETUP_ANDX_10 q10;
case 13 Q_SESSION_SETUP_ANDX_13 q13;
}
} Q_SESSION_SETUP_ANDX;
typedef struct {
ANDX_INFO andx;
uint16 vwv2;
uint16 passlen;
uint16 bcount;
uint8 password[passlen];
fstring path;
fstring device;
} Q_TCON_ANDX_4;
typedef struct _Q_TCON_ANDX {
uint8 wcount;
union ctr[wcount] {
case 4 Q_TCON_ANDX_4 q4;
}
} Q_TCON_ANDX;
typedef struct {
ANDX_INFO andx;
uint16 vwv2;
uint16 bcount;
fstring share;
} R_TCON_ANDX_3;
typedef struct _R_TCON_ANDX {
uint8 wcount;
union ctr[wcount] {
case 3 R_TCON_ANDX_3 q3;
}
} R_TCON_ANDX;
typedef struct {
ANDX_INFO andx;
uint16 action;
uint16 count;
fstring os;
fstring server;
fstring domain;
} R_SESSION_SETUP_ANDX_10;
typedef struct _R_SESSION_SETUP_ANDX {
uint8 wcount;
union ctr[wcount] {
case 3 R_SESSION_SETUP_ANDX_10 r3;
}
} R_SESSION_SETUP_ANDX;
typedef struct _R_CLOSE {
uint8 wcount;
uint16 count;
uint8 none[count];
} R_CLOSE;
typedef struct _Q_CLOSE {
uint8 wcount;
uint16 fnum;
uint32 vwv1;
uint16 count;
uint8 none[count];
} Q_CLOSE;
typedef struct {
uint16 dsize;
uint16 bsizehi;
uint16 bsizelo;
uint16 avail;
uint16 vwv4;
uint16 bcount;
uint8 none[bcount];
} R_DSKATTR_5;
typedef struct {
uint8 wcount;
union ctr[wcount] {
case 5 R_DSKATTR_5 r5;
}
} R_DSKATTR;
typedef struct {
uint16 count;
uint8 none[count];
} Q_DSKATTR_0;
typedef struct _Q_DSKATTR {
uint8 wcount;
union ctr[wcount] {
case 0 Q_DSKATTR_0 q1;
}
} Q_DSKATTR;
typedef struct {
uint16 bcount;
uint8 protocols[bcount];
} R_UNLINK_0;
typedef struct {
uint8 wcount;
union ctr[wcount] {
case 0 R_UNLINK_0 r0;
}
} R_UNLINK;
typedef struct {
uint16 dirtype;
uint16 count;
uint8 fname[count];
} Q_UNLINK_1;
typedef struct _Q_UNLINK {
uint8 wcount;
union ctr[wcount] {
case 1 Q_UNLINK_1 q1;
}
} Q_UNLINK;
typedef struct _R_OPEN_ANDX{
uint8 wcount;
ANDX_INFO andx;
uint16 fnum;
uint16 fmode;
uint32 mtime;
uint32 size;
uint16 rmode;
uint16 vwv9;
uint16 vwv10;
uint16 smb_action;
uint16 vwv12;
uint16 vwv13;
uint16 vwv14;
uint16 count;
uint8 none[count];
} R_OPEN_ANDX;
typedef struct _Q_OPEN_ANDX{
uint8 wcount;
ANDX_INFO andx;
uint16 fnum;
uint16 fmode;
uint32 mtime;
uint32 size;
uint16 rmode;
uint16 vwv9;
uint16 vwv10;
uint16 smb_action;
uint16 vwv12;
uint16 vwv13;
uint16 vwv14;
uint16 count;
uint8 fname[count];
} Q_OPEN_ANDX;
typedef struct _R_READ_ANDX {
uint8 wcount;
ANDX_INFO andx;
uint16 vwv2;
uint16 vwv3;
uint16 vwv4;
uint16 nread;
uint16 offset;
uint16 vwv7;
uint16 vwv8;
uint16 vwv9;
uint16 vwv10;
uint16 vwv11;
uint16 count;
uint8 data[count];
} R_READ_ANDX;
typedef struct _Q_READ_ANDX_10 {
ANDX_INFO andx;
uint16 fnum;
uint32 startpos;
uint16 smb_maxcnt;
uint16 smb_mincnt;
uint16 vwv7;
uint16 vwv8;
uint16 vwv9;
uint16 count;
uint8 none[count];
} Q_READ_ANDX_10;
typedef struct _Q_READ_ANDX_12 {
ANDX_INFO andx;
uint16 fnum;
uint32 startpos;
uint16 smb_maxcnt;
uint16 smb_mincnt;
uint16 vwv7;
uint16 vwv8;
uint16 vwv9;
uint32 startposhi;
uint16 count;
uint8 none[count];
} Q_READ_ANDX_12;
typedef struct _Q_READ_ANDX {
uint8 wcount;
union ctr[wcount] {
case 10 Q_READ_ANDX_10 q10;
case 12 Q_READ_ANDX_12 q12;
}
} Q_READ_ANDX;
typedef struct _R_WRITE_ANDX {
uint8 wcount;
ANDX_INFO andx;
uint16 nwritten;
uint16 vwv3;
uint16 vwv4;
uint16 vwv5;
uint16 count;
uint8 none[count];
} R_WRITE_ANDX;
typedef struct _Q_WRITE_ANDX_12 {
ANDX_INFO andx;
uint16 fnum;
uint32 startpos;
uint16 vwv5;
uint16 vwv6;
uint16 write_through;
uint16 vwv8;
uint16 vwv9;
uint16 numtowrite;
uint16 smb_doff;
uint16 count;
uint8 data[count];
} Q_WRITE_ANDX_12;
typedef struct _Q_WRITE_ANDX_14 {
ANDX_INFO andx;
uint16 fnum;
uint32 startpos;
uint16 vwv5;
uint16 vwv6;
uint16 write_through;
uint16 vwv8;
uint16 vwv9;
uint16 numtowrite;
uint16 smb_doff;
uint32 startposhi;
uint16 count;
uint8 data[count];
} Q_WRITE_ANDX_14;
typedef struct _Q_WRITE_ANDX {
uint8 wcount;
union ctr[wcount] {
case 12 Q_WRITE_ANDX_12 q12;
case 14 Q_WRITE_ANDX_14 q14;
}
} Q_WRITE_ANDX;
typedef struct _Q_NT_CREATE_ANDX{
uint8 wcount;
ANDX_INFO andx;
uint8 reserved;
uint16 name_len;
ULONG flags;
ULONG rootfid;
ULONG access;
hyper allocsize;
ULONG attribs;
ULONG sharing;
ULONG creat_disp;
ULONG impersonation;
uint8 sec_flags;
uint16 count;
uint8 name[name_len];
} Q_NT_CREATE_ANDX;
typedef struct {
uint8 wcount;
uint8 oplock_level;
uint16 fid;
ULONG action;
TIME create_time;
TIME write_time;
TIME change_time;
ULONG ext_attribs;
hyper allocsize;
hyper size;
uint16 type;
uint16 state;
uint8 directory;
uint16 count;
} R_NT_CREATE_ANDX;
typedef struct _R_SMB {
ULONG nbhdr;
ULONG smbhdr;
uint8 com;
uint8 rcls;
uint8 reh;
uint16 err;
uint8 flg;
uint8 flg2;
uint8 reb[13];
uint16 tid;
uint16 pid;
uint16 uid;
uint16 mid;
union ctr[com] {
case 4 R_CLOSE r4;
case 6 R_UNLINK r6;
case 45 R_OPEN_ANDX r45;
case 46 R_READ_ANDX r46;
case 47 R_WRITE_ANDX r47;
case 113 R_TDIS r113;
case 114 R_NEGPROT r114;
case 115 R_SESSION_SETUP_ANDX r115;
case 117 R_TCON_ANDX q117;
case 128 R_DSKATTR r128;
}
} R_SMB;
typedef struct _Q_SMB {
ULONG nbhdr;
ULONG smbhdr;
uint8 com;
uint8 rcls;
uint8 reh;
uint16 err;
uint8 flg;
uint8 flg2;
uint8 reb[13];
uint16 tid;
uint16 pid;
uint16 uid;
uint16 mid;
union ctr[com] {
case 4 Q_CLOSE q4;
case 6 Q_UNLINK q6;
case 45 Q_OPEN_ANDX q45;
case 46 Q_READ_ANDX q46;
case 47 Q_WRITE_ANDX q47;
case 113 Q_TDIS q113;
case 114 Q_NEGPROT q114;
case 115 Q_SESSION_SETUP_ANDX q115;
case 117 Q_TCON_ANDX q117;
case 128 Q_DSKATTR q128;
}
} Q_SMB;
|