aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-dcerpc-eventlog.c
blob: 2c26f7d8947e2cfdfa31e9e65b63f16d05ecb2bc (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
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
/* packet-dcerpc-eventlog.c
 * Routines for SMB \pipe\eventlog packet disassembly
 * Copyright 2004 Jean-Baptiste Marchand <jbm@hsc.fr>
 *
 * $Id$
 *
 * Wireshark - Network traffic analyzer
 * By Gerald Combs <gerald@wireshark.org>
 * Copyright 1998 Gerald Combs
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <glib.h>
#include <epan/packet.h>
#include "packet-dcerpc.h"
#include "packet-dcerpc-nt.h"
#include "packet-dcerpc-eventlog.h"
#include "packet-windows-common.h"


static int proto_dcerpc_eventlog = -1;

static int hf_eventlog_opnum = -1;
static int hf_eventlog_name = -1;
static int hf_eventlog_numofrecords = -1;
static int hf_eventlog_oldest_record = -1;
static int hf_eventlog_rc = -1;
static int hf_eventlog_hnd = -1;
static int hf_eventlog_backup_file = -1;
static int hf_eventlog_infolevel = -1;
static int hf_eventlog_bufsize = -1;
static int hf_eventlog_unknown = -1;
static int hf_eventlog_unknown_string = -1;
static int hf_eventlog_flags = -1;
static int hf_eventlog_offset = -1;
static int hf_eventlog_size = -1;

static gint ett_dcerpc_eventlog = -1;


/* 
 IDL [ uuid(82273fdc-e32a-18c3-3f78-827929dc23ea),
 IDL  version(0.0),
 IDL implicit_handle(handle_t rpc_binding)
 IDL ] interface eventlog
*/


static e_uuid_t uuid_dcerpc_eventlog = {
	0x82273fdc, 0xe32a, 0x18c3, 
	{ 0x3f, 0x78, 0x82, 0x79, 0x29, 0xdc, 0x23, 0xea }
};

static guint16 ver_dcerpc_eventlog = 0; 



/* 
 IDL
 IDL long ElfrClearELFW(
 IDL      [in] [context_handle] void *hEventLog,
 IDL      [in] [string] [unique] wchar_t *BackupFileName
 IDL );
 */

static int
eventlog_dissect_clearw_rqst(tvbuff_t *tvb, int offset,
	packet_info *pinfo, proto_tree *tree, guint8 *drep)
{

        offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep,
				       hf_eventlog_hnd, NULL, NULL, FALSE, FALSE);

	offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
		dissect_ndr_counted_string_ptr, NDR_POINTER_UNIQUE,
		"Backup filename", hf_eventlog_backup_file);

	return offset;
}

static int
eventlog_dissect_clearw_reply(tvbuff_t *tvb, int offset,
	packet_info *pinfo, proto_tree *tree, guint8 *drep)
{
	offset = dissect_ntstatus(tvb, offset, pinfo, tree, drep, 
			hf_eventlog_rc, NULL);

	return offset;
}


/*
 IDL long ElfrBackupELFW(
 IDL      [in] [context_handle] void *hEventLog,
 IDL      [in] [string] wchar_t *BackupFileName
 IDL );
 */

static int
eventlog_dissect_backupw_rqst(tvbuff_t *tvb, int offset,
	packet_info *pinfo, proto_tree *tree, guint8 *drep)
{

        offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep,
				       hf_eventlog_hnd, NULL, NULL, FALSE, FALSE);

	offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
		dissect_ndr_counted_string_ptr, NDR_POINTER_REF,
		"Backup filename", hf_eventlog_backup_file);

	return offset;
}

static int
eventlog_dissect_backupw_reply(tvbuff_t *tvb, int offset,
	packet_info *pinfo, proto_tree *tree, guint8 *drep)
{
	offset = dissect_ntstatus(tvb, offset, pinfo, tree, drep, 
			hf_eventlog_rc, NULL);

	return offset;
}


/*
 IDL long ElfrCloseEL(
 IDL    [in,out] [context_handle] void *hEventLog,
 IDL );
 */

static int
eventlog_dissect_close_rqst(tvbuff_t *tvb, int offset,
	packet_info *pinfo, proto_tree *tree, guint8 *drep)
{
        offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep,
				       hf_eventlog_hnd, NULL, NULL, FALSE, TRUE);

	return offset;
}

static int
eventlog_dissect_close_reply(tvbuff_t *tvb, int offset,
	packet_info *pinfo, proto_tree *tree, guint8 *drep)
{
        offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep,
				       hf_eventlog_hnd, NULL, NULL, FALSE, FALSE);

	offset = dissect_ntstatus(tvb, offset, pinfo, tree, drep, 
			hf_eventlog_rc, NULL);

	return offset;
}


/*
 IDL
 IDL long ElfrDeregisterEventSource(
 IDL   [in,out] [context_handle] void *hEventLog
 IDL );
 */

static int
eventlog_dissect_deregister_evt_src_rqst(tvbuff_t *tvb, int offset,
	packet_info *pinfo, proto_tree *tree, guint8 *drep)
{

        offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep,
				       hf_eventlog_hnd, NULL, NULL, FALSE, FALSE);
	return offset;
}

static int
eventlog_dissect_deregister_evt_src_reply(tvbuff_t *tvb, int offset,
	packet_info *pinfo, proto_tree *tree, guint8 *drep)
{

        offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep,
				       hf_eventlog_hnd, NULL, NULL, FALSE, FALSE);

	offset = dissect_ntstatus(tvb, offset, pinfo, tree, drep, 
			hf_eventlog_rc, NULL);

	return offset;
}


/* 
 IDL
 IDL long ElfrNumberOfRecords(
 IDL      [in] [context_handle] void *hEventLog,
 IDL      [out] long NumberOfRecords
 IDL );
 */

static int
eventlog_dissect_getnumofrecords_rqst(tvbuff_t *tvb, int offset,
	packet_info *pinfo, proto_tree *tree, guint8 *drep)
{

        offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep,
				       hf_eventlog_hnd, NULL, NULL, FALSE, FALSE);
	return offset;
}

static int
eventlog_dissect_getnumofrecords_reply(tvbuff_t *tvb, int offset,
	packet_info *pinfo, proto_tree *tree, guint8 *drep)
{

	offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
			hf_eventlog_numofrecords, NULL);

	offset = dissect_ntstatus(tvb, offset, pinfo, tree, drep, 
			hf_eventlog_rc, NULL);

	return offset;
}

/*
 IDL
 IDL long ElfrOldestRecord(
 IDL      [in] [context_handle] void *hEventLog,
 IDL      [out] long OldestRecord
 IDL );
 */

static int
eventlog_dissect_oldestrecord_rqst(tvbuff_t *tvb, int offset,
	packet_info *pinfo, proto_tree *tree, guint8 *drep)
{

        offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep,
				       hf_eventlog_hnd, NULL, NULL, FALSE, FALSE);

	return offset;
}


static int
eventlog_dissect_oldestrecord_reply(tvbuff_t *tvb, int offset,
	packet_info *pinfo, proto_tree *tree, guint8 *drep)
{
	offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
			hf_eventlog_oldest_record, NULL);

	offset = dissect_ntstatus(tvb, offset, pinfo, tree, drep, 
			hf_eventlog_rc, NULL);

	return offset;
}


/*
 IDL typedef struct {
 IDL   long element_14;
 IDL   long element_15;
 IDL } TYPE_2;
 */

static int
eventlog_dissect_TYPE_2(tvbuff_t *tvb, int offset,
	packet_info *pinfo, proto_tree *tree, guint8 *drep)
{
	offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
			hf_eventlog_unknown, NULL);

	offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
			hf_eventlog_unknown, NULL);

	return offset;
}

/*
 IDL long ElfrChangeNotify (
 IDL      [in] [context_handle] void *element_16,
 IDL      [in] TYPE_2 element_17,
 IDL      [in] long element_18
 IDL );
 */


static int
eventlog_dissect_changenotify_rqst(tvbuff_t *tvb, int offset,
	packet_info *pinfo, proto_tree *tree, guint8 *drep)
{

        offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep,
				       hf_eventlog_hnd, NULL, NULL, FALSE, FALSE);

	offset = eventlog_dissect_TYPE_2(tvb, offset, pinfo, tree, drep);

	offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
			hf_eventlog_unknown, NULL);

	return offset;
}


static int
eventlog_dissect_changenotify_reply(tvbuff_t *tvb, int offset,
	packet_info *pinfo, proto_tree *tree, guint8 *drep)
{
	offset = dissect_ntstatus(tvb, offset, pinfo, tree, drep, 
			hf_eventlog_rc, NULL);

	return offset;
}


/*
 IDL typedef struct {
 IDL   short unknown0;
 IDL   short unknown1;
 IDL } TYPE_6;
 */

static int
eventlog_dissect_TYPE_6(tvbuff_t *tvb, int offset,
	packet_info *pinfo, proto_tree *tree, guint8 *drep)
{
	offset = dissect_ndr_uint16(tvb, offset, pinfo, tree, drep,
			hf_eventlog_unknown, NULL);

	offset = dissect_ndr_uint16(tvb, offset, pinfo, tree, drep,
			hf_eventlog_unknown, NULL);

	return offset;
}


/*
 IDL NTSTATUS ElfrOpenELW(
 IDL      [in] [unique] TYPE_6 *unknown0,
 IDL      [in] UNICODE_STRING eventlog_name,
 IDL      [in] UNICODE_STRING unknown1,
 IDL      [in] long unknown2,
 IDL      [in] long unknown3,
 IDL      [out] [context_handle] void *hEventLog
 IDL );
 */

static int 
eventlog_dissect_openw_rqst(tvbuff_t *tvb, int offset,
	packet_info *pinfo, proto_tree *tree, guint8 *drep)
{

	offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
			eventlog_dissect_TYPE_6, NDR_POINTER_UNIQUE,
			"Unknown struct pointer:", hf_eventlog_unknown);

	offset = dissect_ndr_counted_string(tvb, offset, pinfo, tree, 
					    drep, hf_eventlog_name, 0);

	offset = dissect_ndr_counted_string(tvb, offset, pinfo, tree, 
					    drep, hf_eventlog_unknown_string, 0);

	offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
			hf_eventlog_unknown, NULL);

	offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
			hf_eventlog_unknown, NULL);

	return offset;
}

static int
eventlog_dissect_openw_reply(tvbuff_t *tvb, int offset,
	packet_info *pinfo, proto_tree *tree, guint8 *drep)
{

        offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep,
				       hf_eventlog_hnd, NULL, NULL, TRUE, FALSE);

	offset = dissect_ntstatus(tvb, offset, pinfo, tree, drep, 
			hf_eventlog_rc, NULL);

	return offset;
}

/*
 IDL 
 IDL long ElfrRegisterEventSourceW(
 IDL       [in] [unique] TYPE_6 *unknown0,
 IDL       [in] UNICODE_STRING element_26,
 IDL       [in] UNICODE_STRING element_27,
 IDL       [in] long unknown3,
 IDL       [in] long unknown3,
 IDL      [out] [context_handle] void *hEventLog,
 IDL );
 */

static int 
eventlog_dissect_register_evt_srcw_rqst(tvbuff_t *tvb, int offset,
	packet_info *pinfo, proto_tree *tree, guint8 *drep)
{
	offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
			eventlog_dissect_TYPE_6, NDR_POINTER_UNIQUE,
			"Unknown struct pointer:", hf_eventlog_unknown);

	offset = dissect_ndr_counted_string(tvb, offset, pinfo, tree, 
					    drep, hf_eventlog_name, 0);

	offset = dissect_ndr_counted_string(tvb, offset, pinfo, tree, 
					    drep, hf_eventlog_unknown_string, 0);

	offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
			hf_eventlog_unknown, NULL);

	offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
			hf_eventlog_unknown, NULL);

	return offset;
}

static int 
eventlog_dissect_register_evt_srcw_reply(tvbuff_t *tvb, int offset,
	packet_info *pinfo, proto_tree *tree, guint8 *drep)
{

        offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep,
				       hf_eventlog_hnd, NULL, NULL, TRUE, FALSE);

	offset = dissect_ntstatus(tvb, offset, pinfo, tree, drep, 
			hf_eventlog_rc, NULL);

	return offset;
}

/*
 IDL NTSTATUS ElfrOpenBELW(
 IDL       [in] [unique] TYPE_6 *unknown0,
 IDL       [in] UNICODE_STRING eventlog_name,
 IDL       [in] long unknown2,
 IDL       [in] long unknown3,
 IDL      [out] [context_handle] void *hEventLog
 IDL );
 */

static int 
eventlog_dissect_open_backupw_rqst(tvbuff_t *tvb, int offset,
	packet_info *pinfo, proto_tree *tree, guint8 *drep)
{
	offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
			eventlog_dissect_TYPE_6, NDR_POINTER_UNIQUE,
			"Unknown struct pointer:", hf_eventlog_unknown);

	offset = dissect_ndr_counted_string(tvb, offset, pinfo, tree, 
					    drep, hf_eventlog_name, 0);

	offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
			hf_eventlog_unknown, NULL);

	offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
			hf_eventlog_unknown, NULL);

	return offset;
}

static int 
eventlog_dissect_open_backupw_reply(tvbuff_t *tvb, int offset,
	packet_info *pinfo, proto_tree *tree, guint8 *drep)
{

        offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep,
				       hf_eventlog_hnd, NULL, NULL, TRUE, FALSE);

	offset = dissect_ntstatus(tvb, offset, pinfo, tree, drep, 
			hf_eventlog_rc, NULL);

	return offset;
}

/*
 IDL long ElfrReadELW(
 IDL      [in] [context_handle] void *hEventLog,
 IDL      [in] long flags,
 IDL      [in] long offset,
 IDL      [in,out] long number_of_bytes, 
 IDL     [out] [size_is(number_of_bytes)] byte *data,
 IDL     [out] long sent_size,
 IDL     [out] long real_size
 IDL   );
 */

static int 
eventlog_dissect_readw_rqst(tvbuff_t *tvb, int offset,
	packet_info *pinfo, proto_tree *tree, guint8 *drep)
{

        offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep,
				       hf_eventlog_hnd, NULL, NULL, FALSE, FALSE);

	offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
			hf_eventlog_flags, NULL);

	offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
			hf_eventlog_offset, NULL);
	
	offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
			hf_eventlog_size, NULL);

	return offset;
}


/* 
 IDL typedef struct {
 IDL   char element_47[6];
 IDL } TYPE_4;
 */

/*
 IDL typedef struct {
 IDL   char element_43;
 IDL   char element_44;
 IDL   TYPE_4 element_45;
 IDL   [size_is(element_44)] byte element_46[*];
 IDL } TYPE_3;
 */

/*
 IDL long ElfrReportEventW(
 IDL       [in] [context_handle] void *hEventLog,
 IDL      [in] long element_49,
 IDL       [in] short element_50,
 IDL       [in] short element_51,
 IDL      [in] long element_52,
 IDL       [in] short element_53,
 IDL       [in] long element_54,
 IDL       [in] UNICODE_STRING element_55,
 IDL       [in] [unique] TYPE_3 *element_56,
 IDL       [in] [size_is(element_53)] [unique] byte *element_57,
 IDL       [in] [size_is(element_54)] [unique] byte *element_58,
 IDL       [in] short element_59,
 IDL   [in,out] [unique] long *element_60,
 IDL   [in,out] [unique] long *element_61
 IDL );
 */

/*
 * IDL typedef struct {
 * IDL   short length;
 * IDL   short size;
 * IDL   [size_is(size] [unique] byte *string;
 * IDL } ASCII_STRING;
 */

/*
 IDL NTSTATUS ElfrClearELFA
 IDL       [in] [context_handle] void *hEventLog,
 IDL       [in] [unique] ASCII_STRING *BackupFileName
 IDL );
 */

/*
 IDL NTSTATUS ElfrBackupELFA(
 IDL       [in] [context_handle] void *hEventLog,
 IDL       [in] ASCII_STRING BackupFileName
 IDL );
 */

/*
 IDL NTSTATUS ElfrOpenELA(
 IDL       [in] [unique] TYPE_6 *unknown0,
 IDL       [in] ASCII_STRING eventlog_name,
 IDL       [in] ASCII_STRING unknown1,
 IDL       [in] long unknown2,
 IDL       [in] long unknown3,
 IDL      [out] [context_handle] void *hEventLog,
 IDL );
 */

/*
 IDL long ElfrRegisterEventSourceA(
 IDL      [in] [unique] char *element_75,
 IDL      [in] ASCII_STRING element_76,
 IDL      [in] ASCII_STRING element_77,
 IDL      [in] long element_78,
 IDL      [in] long element_79,
 IDL     [out] [context_handle] void *hEventLog,
  );
 */


/*
 IDL NTSTATUS ElfrOpenBELA(
 IDL       [in] [unique] char *element_81,
 IDL       [in] ASCII_STRING element_82,
 IDL       [in] long element_83,
 IDL       [in] long element_84,
 IDL      [out] [context_handle] void *hEventLog
  );
 */


/*
 IDL long ElfrReadELA(
 IDL       [in] [context_handle] void *hEventLog,
 IDL       [in] long element_87,
 IDL       [in] long element_88,
 IDL       [in] long element_89,
 IDL      [out] [size_is(element_89)] byte element_90[*],
 IDL      [out] long element_91,
 IDL      [out] long element_92
 IDL );
 */

/*
 IDL long ElfrReportEventA
 IDL      [in] [context_handle] void *hEventLog,
 IDL      [in] long element_94,
 IDL      [in] short element_95,
 IDL      [in] short element_96,
 IDL      [in] long element_97,
 IDL      [in] short element_98,
 IDL      [in] long element_99,
 IDL      [in] ASCII_STRING element_100,
 IDL      [in] [unique] TYPE_3 *element_101,
 IDL      [in] [size_is(element_98)] [unique] byte *element_102,
 IDL      [in] [size_is(element_99)] [unique] byte *element_103,
 IDL      [in] short element_104,
 IDL  [in,out] [unique] long *element_105,
 IDL  [in,out] [unique] long *element_106
 IDL   );
 */


/*
 IDL long ElfrRegisterClusterSvc(
 IDL      [in] [unique] wchar_t *element_107,
 IDL      [out] long element_108,
 IDL      [out] [size_is(*element_108)] [ref] byte **element_109
 IDL );
 */

/*
 IDL long ElfrWriteClusterEvents(
 IDL      [in] [unique] wchar_t *element_110
 IDL );
 */

/*
 IDL long ElfrUnregisterClusterSvc(
 IDL       [in] [unique] wchar_t *element_111,
 IDL       [in] long element_112,
 IDL       [in] [size_is(element_112)] byte element_113[*]
 IDL );
 */




static value_string infoLevels[] = {
  { 0, "EVENTLOG_FULL_INFORMATION" },
  { 0, NULL}
};


/*
 IDL   long ElfrGetLogInformation(
 IDL        [in] [context_handle] void *hEventLog,
 IDL        [in] long dwInfoLevel,
 IDL       [out] [size_is(cbBufSize)] char lpBuffer[*],
 IDL        [in] long cbBufSize,
 IDL       [out] long cbBytesNeeded,
 IDL   );
 */

static int 
eventlog_dissect_getloginfo_rqst(tvbuff_t *tvb, int offset,
	packet_info *pinfo, proto_tree *tree, guint8 *drep)
{

        offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep,
				       hf_eventlog_hnd, NULL, NULL, FALSE, FALSE);
	
	offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
			hf_eventlog_infolevel, NULL);

	offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
			hf_eventlog_bufsize, NULL);

	return offset;
}


static dcerpc_sub_dissector dcerpc_eventlog_dissectors[] = {
	{ EVENTLOG_CLEAR, "ElfrClearELFW", 
		eventlog_dissect_clearw_rqst, 
		eventlog_dissect_clearw_reply},
	{ EVENTLOG_BACKUP, "ElfrBackupELFW", 
		eventlog_dissect_backupw_rqst,
		eventlog_dissect_backupw_reply },
	{ EVENTLOG_CLOSE, "ElfrCloseEL", 
		eventlog_dissect_close_rqst,	
		eventlog_dissect_close_reply },
	{ EVENTLOG_DEREGISTER_EVT_SRC, "ElfrDeregisterEventSource", 
		eventlog_dissect_deregister_evt_src_rqst,
		eventlog_dissect_deregister_evt_src_reply },
	{ EVENTLOG_NUMOFRECORDS, "ElfrNumberOfRecords",
		eventlog_dissect_getnumofrecords_rqst, 
		eventlog_dissect_getnumofrecords_reply },
	{ EVENTLOG_GET_OLDEST_RECORD, "ElfrOldestRecord", 
		eventlog_dissect_oldestrecord_rqst, 
		eventlog_dissect_oldestrecord_reply },
	{ EVENTLOG_NOTIFY_CHANGE, "ElfrChangeNotify", 
		eventlog_dissect_changenotify_rqst,
		eventlog_dissect_changenotify_reply },
	{ EVENTLOG_OPEN, "ElfrOpenELW", 
		eventlog_dissect_openw_rqst, 
		eventlog_dissect_openw_reply },
	{ EVENTLOG_REGISTER_EVT_SRC, "ElfrRegisterEventSourceW", 
		eventlog_dissect_register_evt_srcw_rqst,
		eventlog_dissect_register_evt_srcw_reply },
	{ EVENTLOG_OPEN_BACKUP, "ElfrOpenBELW", 
		eventlog_dissect_open_backupw_rqst,	
		eventlog_dissect_open_backupw_reply },
	{ EVENTLOG_READ, "ElfrReadELW", 
	 	eventlog_dissect_readw_rqst,	
		NULL },
	{ EVENTLOG_REPORT, "ElfrReportEventW", 
		NULL, NULL },
	{ EVENTLOG_CLEAR_ASCII, "ElfrClearELFA", 
		NULL, NULL },
	{ EVENTLOG_BACKUP_ASCII, "ElfrBackupELFA", 
		NULL, NULL },
	{ EVENTLOG_OPEN_ASCII, "ElfrOpenELA", 
		NULL, NULL },
	{ EVENTLOG_REGISTER_EVT_SRC_ASCII, "ElfrRegisterEventSourceA", 
		NULL, NULL },
	{ EVENTLOG_OPEN_BACKUP_ASCII, "ElfrOpenBELA", 
		NULL, NULL },
	{ EVENTLOG_READ_ASCII, "ElfrReadELA", 
		NULL, NULL },
 	{ EVENTLOG_REPORT_ASCII, "ElfrReportEventA", 
		NULL, NULL },
	{ EVENTLOG_REGISTER_CLUSTER_SVC, "ElfrRegisterClusterSvc", 
		NULL, NULL },
	{ EVENTLOG_DEREGISTER_CLUSTER_SVC, "ElfrDeregisterClusterSvc", 
		NULL, NULL }, 
	{ EVENTLOG_WRITE_CLUSTER_EVENTS, "ElfrWriteClusterEvents", 
		NULL, NULL },
	{ EVENTLOG_GET_INFO, "ElfrGetLogInformation", 
		eventlog_dissect_getloginfo_rqst,
		NULL },
	{ EVENTLOG_FLUSH, "ElfrFlushEL", 
		NULL, NULL },
        { 0, NULL, NULL,  NULL }
};


void
proto_register_dcerpc_eventlog(void)
{

        static hf_register_info hf[] = {

		{ &hf_eventlog_opnum, 
		  { "Operation", "eventlog.opnum", FT_UINT16, BASE_DEC,
		   NULL, 0x0, "Operation", HFILL }},	

	  	{ &hf_eventlog_name,
		    { "Eventlog name", "eventlog.name", FT_STRING, BASE_NONE,
		      NULL, 0x0, "Eventlog name", HFILL}},

		{&hf_eventlog_numofrecords,
		  { "Number of records", "eventlog.records", FT_UINT32, BASE_DEC,
		    NULL, 0x0, "Number of records in eventlog", HFILL }},

		{&hf_eventlog_oldest_record,
		  { "Oldest record", "eventlog.oldest_record", FT_UINT32, BASE_DEC,
		    NULL, 0x0, "Oldest record available in eventlog", HFILL }},

		{&hf_eventlog_rc,
		  { "Return code", "eventlog.rc", FT_UINT32, BASE_HEX,
		    VALS(NT_errors), 0x0, "Eventlog return status code", HFILL }}, 

	  	{ &hf_eventlog_hnd,
		    { "Context Handle", "eventlog.hnd", FT_BYTES, BASE_NONE,
		      NULL, 0x0, "Eventlog context handle", HFILL }},

	  	{ &hf_eventlog_backup_file,
		    { "Backup filename", "eventlog.backup_file", FT_STRING, BASE_NONE,
		      NULL, 0x0, "Eventlog backup file", HFILL}},

		{&hf_eventlog_infolevel,
		  { "Information level", "eventlog.info_level", FT_UINT32, BASE_DEC,
		    &infoLevels, 0x0, "Eventlog information level", HFILL }},

		{&hf_eventlog_bufsize,
		  { "Buffer size", "eventlog.buf_size", FT_UINT32, BASE_DEC,
		    NULL, 0x0, "Eventlog buffer size", HFILL }},

		{&hf_eventlog_unknown,
		  { "Unknown field", "eventlog.unknown", FT_UINT32, BASE_DEC,
		    NULL, 0x0, "Unknown field", HFILL }},

	  	{ &hf_eventlog_unknown_string,
		    { "Unknown string", "eventlog.unknown_str", FT_STRING, BASE_NONE,
		      NULL, 0x0, "Unknown string", HFILL}},

		{&hf_eventlog_flags,
		  { "Eventlog flags", "eventlog.flags", FT_UINT32, BASE_HEX,
		    NULL, 0x0, "Eventlog flags", HFILL }},

		{&hf_eventlog_offset,
		  { "Eventlog offset", "eventlog.offset", FT_UINT32, BASE_DEC,
		    NULL, 0x0, "Eventlog offset", HFILL }},

		{&hf_eventlog_size,
		  { "Eventlog size", "eventlog.size", FT_UINT32, BASE_DEC,
		    NULL, 0x0, "Eventlog size", HFILL }},

	};


        static gint *ett[] = {
                &ett_dcerpc_eventlog,
        };


	proto_dcerpc_eventlog = proto_register_protocol(
		"Microsoft Eventlog Service", "EVENTLOG", "eventlog");

	proto_register_field_array(proto_dcerpc_eventlog, hf, array_length(hf));

        proto_register_subtree_array(ett, array_length(ett));

}


void
proto_reg_handoff_dcerpc_eventlog(void)
{

	/* register protocol as dcerpc */

	dcerpc_init_uuid(
		proto_dcerpc_eventlog, ett_dcerpc_eventlog, &uuid_dcerpc_eventlog,
		ver_dcerpc_eventlog, dcerpc_eventlog_dissectors, hf_eventlog_opnum);

}