aboutsummaryrefslogtreecommitdiffstats
path: root/packet-dcerpc-efs.c
blob: 271e37e7f4ce8959d1b43c3f0b6c1494746d7135 (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
/* packet-dcerpc-efs.c
 * Routines for the efsrpc MSRPC interface
 * Copyright 2004 Ronnie Sahlberg, Jean-Baptiste Marchand
 *
 * $Id: packet-dcerpc-efs.c,v 1.2 2004/05/19 04:52:31 tpot Exp $
 *
 * Ethereal - Network traffic analyzer
 * By Gerald Combs <gerald@ethereal.com>
 * 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-efs.h"
#include "smb.h"


static int proto_dcerpc_efs = -1;
static int hf_efsrpc_opnum = -1;
static int hf_efsrpc_rc = -1;
static int hf_efsrpc_filename = -1;
static int hf_efsrpc_flags = -1;
static int hf_efsrpc_hnd = -1;
static int hf_efsrpc_reserved = -1;
static int hf_efsrpc_num_entries = -1;
static int hf_efsrpc_data_size = -1;
static int hf_efsrpc_cert_dn = -1;

static gint ett_dcerpc_efs = -1;
static gint ett_dcerpc_efs_cert_hash = -1;


/* 
IDL [ uuid(c681d488-d850-11d0-8c52-00c04fd90f7e),
IDL  version(1.0),
IDL  implicit_handle(handle_t rpc_binding)
IDL ] interface efsrpc
*/


static e_uuid_t uuid_dcerpc_efs = {
	0xc681d488, 0xd850, 0x11d0,
	{ 0x8c, 0x52, 0x00, 0xc0, 0x4f, 0xd9, 0x0f, 0x7e }
};

static guint16 ver_dcerpc_efs = 1; 


/*
IDL long EfsRpcOpenFileRaw(
IDL       [out] [context_handle] void *pvContext,
IDL        [in] [string] wchar_t FileName,
IDL        [in] long Flags
IDL  );
*/

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

        offset = dissect_ndr_cvstring(tvb, offset, pinfo, tree, drep,
                                      sizeof(guint16),
			              hf_efsrpc_filename, TRUE, NULL);

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

	return offset;

}

static int
efsrpc_dissect_open_file_raw_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_efsrpc_hnd, NULL, NULL, TRUE, FALSE);

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

	return offset;
}



/*
IDL  long EfsRpcReadFileRaw(
IDL        [in] [context_handle] void *pvContext,
IDL       [out] ??? element_5
IDL  );
*/

static int
efsrpc_dissect_read_file_raw_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_efsrpc_hnd, NULL, NULL, FALSE, FALSE);

	return offset;

}


/*
IDL  long EfsRpcWriteFileRaw(
IDL        [in] [context_handle] void *pvContext,
IDL        [in] ??? element_7
IDL  );
*/


static int
efsrpc_dissect_write_file_raw_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_efsrpc_hnd, NULL, NULL, FALSE, FALSE);

	return offset;

}


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

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

	return offset;

}


/*
IDL
IDL  void EfsRpcCloseRaw(
IDL        [in,out] [context_handle] void *pvContext,
IDL  );
*/


static int
efsrpc_dissect_close_file_raw_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_efsrpc_hnd, NULL, NULL, FALSE, TRUE);

	return offset;

}


static int
efsrpc_dissect_close_file_raw_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_efsrpc_hnd, NULL, NULL, FALSE, FALSE);

	return offset;

}



/*
IDL long EfsRpcEncryptFileSrv(
IDL       [in] [string] wchar_t Filename
IDL );
 */

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

        offset = dissect_ndr_cvstring(tvb, offset, pinfo, tree, drep,
                                      sizeof(guint16),
			              hf_efsrpc_filename, TRUE, NULL);

	return offset;

}


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

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

	return offset;

}


/*
IDL  long EfsRpcDecryptFileSrv(
IDL        [in] [string] wchar_t FileName, 
IDL        [in] long Reserved
IDL  );
*/


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

        offset = dissect_ndr_cvstring(tvb, offset, pinfo, tree, drep,
                                      sizeof(guint16),
			              hf_efsrpc_filename, TRUE, NULL);

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

	return offset;

}


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

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

	return offset;

}


/*
IDL typedef struct {
IDL    long   cbData;
IDL    [size_is(cbData)]  void  *pbData;
IDL } EFS_HASH_BLOB;
*/

static int
efsrpc_dissect_EFS_HASH_BLOB_data(tvbuff_t *tvb, int offset,
				     packet_info *pinfo, proto_tree *tree,
				     guint8 *drep)
{
	guint32 size;
	dcerpc_info *di = (dcerpc_info *)pinfo->private_data;

	if(di->conformant_run){
		return offset;   /* cant modify offset while performing conformant run */
	}

	offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
		hf_efsrpc_data_size, &size);

	/* XXX insert some sort of proto_tree_add_item  here and show hex data
	   of the blob */
	offset += size;
	return offset;
}

static int
efsrpc_dissect_EFS_HASH_BLOB(tvbuff_t *tvb, int offset,
				     packet_info *pinfo, proto_tree *tree,
				     guint8 *drep)
{
	guint32 size;

	offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
		hf_efsrpc_data_size, &size);

        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
		efsrpc_dissect_EFS_HASH_BLOB_data, NDR_POINTER_UNIQUE,
		"HASH_BLOB", -1);

	return offset;
}


static int
efsrpc_dissect_efs_SID_ptr(tvbuff_t *tvb, int offset,
				     packet_info *pinfo, proto_tree *tree,
				     guint8 *drep)
{
	offset = dissect_ndr_nt_SID(tvb, offset, pinfo, tree, drep);

	return offset;
}


/*
IDL typedef struct {
IDL    long cbTotalLength;
IDL    SID *pUserSid;
IDL    EFS_HASH_BLOB  *pHash;
IDL    [string] wchar_t lpDisplayInformation;
IDL } ENCRYPTION_CERTIFICATE_HASH;
*/

static int
efsrpc_dissect_ENCRYPTION_CERTIFICATE_HASH(tvbuff_t *tvb, int offset,
				     packet_info *pinfo, proto_tree *parent_tree,
				     guint8 *drep)
{
	proto_item *item = NULL;
	proto_tree *tree = NULL;

	if (parent_tree) {
		item = proto_tree_add_text(parent_tree, tvb, offset, -1, "ENCRYPTION_CERTIFICATE_HASH");
		tree = proto_item_add_subtree(item, ett_dcerpc_efs_cert_hash);
	}

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

        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
		efsrpc_dissect_efs_SID_ptr, NDR_POINTER_UNIQUE,
		"SID", -1);

        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
		efsrpc_dissect_EFS_HASH_BLOB, NDR_POINTER_UNIQUE,
		"EFS_HASH_BLOB", -1);

	offset = dissect_ndr_pointer_cb(
		tvb, offset, pinfo, tree, drep,
		dissect_ndr_wchar_cvstring, NDR_POINTER_UNIQUE,
		"Certificate DN", hf_efsrpc_cert_dn, cb_wstr_postprocess,
		GINT_TO_POINTER(CB_STR_COL_INFO | 1));

	return offset;
}


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

	offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
		efsrpc_dissect_ENCRYPTION_CERTIFICATE_HASH, NDR_POINTER_UNIQUE,
		"ENCRYPTION_CERTIFICATE_HASH", -1);

	return offset;

}


static int
efsrpc_dissect_ENCRYPTION_CERTIFICATE_HASH_array(tvbuff_t *tvb, int offset,
				     packet_info *pinfo, proto_tree *tree,
				     guint8 *drep)
{
	offset = dissect_ndr_ucarray(tvb, offset, pinfo, tree, drep,
			efsrpc_dissect_ENCRYPTION_CERTIFICATE_HASH_ptr);

	return offset;
}

/*
IDL  typedef struct {
IDL    long nCert_Hash;
IDL    [size_is(nCert_Hash)] [unique] ENCRYPTION_CERTIFICATE_HASH *pUsers;
IDL  } ENCRYPTION_CERTIFICATE_HASH_LIST;
*/

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

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

	offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
		efsrpc_dissect_ENCRYPTION_CERTIFICATE_HASH_array, NDR_POINTER_UNIQUE,
		"ENCRYPTION_CERTIFICATE_HASH array:", -1);

	return offset;

}



/*
IDL  long EfsRpcQueryUsersOnFile(
IDL        [in] [string] wchar_t FileName,
IDL       [out] [ref] ENCRYPTION_CERTIFICATE_HASH_LIST **pUsers
IDL  );
*/


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

        offset = dissect_ndr_cvstring(tvb, offset, pinfo, tree, drep,
                                      sizeof(guint16),
			              hf_efsrpc_filename, TRUE, NULL);


	return offset;

}


static int
efsrpc_dissect_query_users_on_file_reply(tvbuff_t *tvb, int offset,
	packet_info *pinfo, proto_tree *tree, guint8 *drep)
{
	offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
		efsrpc_dissect_ENCRYPTION_CERTIFICATE_HASH_LIST, NDR_POINTER_UNIQUE,
		"ENCRYPTION_CERTIFICATE_HASH_LIST", -1);

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

	return offset;

}

/*
IDL  long EfsRpcQueryRecoveryAgents(
IDL        [in] [string] wchar_t FileName,
IDL       [out] [ref] ENCRYPTION_CERTIFICATE_HASH_LIST **pRecoveryAgents
IDL  );
*/

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

        offset = dissect_ndr_cvstring(tvb, offset, pinfo, tree, drep,
                                      sizeof(guint16),
			              hf_efsrpc_filename, TRUE, NULL);

	return offset;

}


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

	offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
		efsrpc_dissect_ENCRYPTION_CERTIFICATE_HASH_LIST, NDR_POINTER_UNIQUE,
		"ENCRYPTION_CERTIFICATE_HASH_LIST", -1);

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

	return offset;


}



/*
IDL long EfsRpcRemoveUsersFromFile(
IDL        [in] [string] wchar_t FileName,
IDL        [in] ENCRYPTION_CERTIFICATE_LIST Hashes
IDL  );
*/

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

        offset = dissect_ndr_cvstring(tvb, offset, pinfo, tree, drep,
                                      sizeof(guint16),
			              hf_efsrpc_filename, TRUE, NULL);
#if 0
	offset = efsrpc_dissect_ENCRYPTION_CERTIFICATE_LIST(tvb, offset,
			pinfo, tree, drep);
#endif
	return offset;

}


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

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

	return offset;

}

/*
IDL long EfsRpcAddUsersToFile(
IDL        [in] [string] wchar_t FileName,
IDL        [in] ENCRYPTION_CERTIFICATE_LIST Hashes
IDL  );
*/

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

        offset = dissect_ndr_cvstring(tvb, offset, pinfo, tree, drep,
                                      sizeof(guint16),
			              hf_efsrpc_filename, TRUE, NULL);
#if 0
	offset = efsrpc_dissect_ENCRYPTION_CERTIFICATE_LIST(tvb, offset,
			pinfo, tree, drep);
#endif
	return offset;

}


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

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

	return offset;

}


/*
IDL typedef struct {
IDL    long dwCertEncodingType;
IDL    long cbData;
IDL    [size_is(cbData)] [unique] byte *pbData
IDL  } EFS_CERTIFICATE_BLOB;
*/

/*
IDL typedef struct {
IDL    long TotalLength;
IDL    [unique] SID *pUserSid;
IDL    [unique] EFS_CERTIFICATE_BLOB *pCertBlob;
IDL  } ENCRYPTION_CERTIFICATE;
*/

/*
IDL  long EfsRpcSetFileEncryptionKey(
IDL        [in] [unique] ENCRYPTION_CERTIFICATE *pEncryptionCertificate
IDL  );
*/

static dcerpc_sub_dissector dcerpc_efs_dissectors[] = {
        { EFS_RPC_OPEN_FILE_RAW , "EfsRpcOpenFileRaw",
		efsrpc_dissect_open_file_raw_rqst,
		efsrpc_dissect_open_file_raw_reply },
        { EFS_RPC_READ_FILE_RAW, "EfsRpcReadFileRaw",
		efsrpc_dissect_read_file_raw_rqst,
		NULL },
        { EFS_RPC_WRITE_FILE_RAW, "EfsRpcWriteFileRaw",
		efsrpc_dissect_write_file_raw_rqst,
		efsrpc_dissect_write_file_raw_reply },
        { EFS_RPC_CLOSE_RAW, "EfsRpcCloseRaw",
		efsrpc_dissect_close_file_raw_rqst,
		efsrpc_dissect_close_file_raw_reply },
        { EFS_RPC_ENCRYPT_FILE_SRV, "EfsRpcEncryptFileSrv",
		efsrpc_dissect_encrypt_file_srv_rqst, 
        	efsrpc_dissect_encrypt_file_srv_reply },
        { EFS_RPC_DECRYPT_FILE_SRV, "EfsRpcDecryptFileSrv",
		efsrpc_dissect_decrypt_file_srv_rqst, 
        	efsrpc_dissect_decrypt_file_srv_reply },
        { EFS_RPC_QUERY_USERS_ON_FILE, "EfsRpcQueryUsersOnFile",
		efsrpc_dissect_query_users_on_file_rqst,
		efsrpc_dissect_query_users_on_file_reply },
        { EFS_RPC_QUERY_RECOVERY_AGENTS, "EfsRpcQueryRecoveryAgents",
		efsrpc_dissect_query_recovery_agents_rqst,
		efsrpc_dissect_query_recovery_agents_reply },
        { EFS_RPC_REMOVE_USERS_FROM_FILE, "EfsRpcRemoveUsersFromFile",
		efsrpc_dissect_remove_users_from_file_rqst,
		efsrpc_dissect_remove_users_from_file_reply },
        { EFS_RPC_ADD_USERS_TO_FILE, "EfsRpcAddUsersToFile",
		efsrpc_dissect_add_users_from_file_rqst,
		efsrpc_dissect_add_users_from_file_reply },
        { EFS_RPC_SET_FILE_ENCRYPTION_KEY, "EfsRpcSetFileEncryptionKey"
		, NULL, NULL },
        { EFS_RPC_NOT_SUPPORTED, "EfsRpcNotSupported"
		, NULL, NULL },
        { EFS_RPC_FILE_KEY_INFO, "EfsRpcFileKeyInfo"
		, NULL, NULL },
        { EFS_RPC_DUPLICATE_ENCRYPTION_INFO_FILE,
		"EfsRpcDuplicateEncryptionInfoFile", NULL, NULL },
        { 0, NULL, NULL,  NULL }
};

void
proto_register_dcerpc_efs(void)
{
static hf_register_info hf[] = {
	{ &hf_efsrpc_opnum, { 
		"Operation", "efsrpc.opnum", FT_UINT16, BASE_DEC,
		NULL, 0x0, "", HFILL }},
	{ &hf_efsrpc_rc, {
		"Return code", "efsrpc.rc", FT_UINT32, BASE_HEX,
		VALS(NT_errors), 0x0, "EFSRPC return code", HFILL }},
	{ &hf_efsrpc_filename,
	    { "Filename", "efsrpc.filename", FT_STRING, BASE_NONE,
	      NULL, 0x0, "File name", HFILL}},

	{ &hf_efsrpc_flags, {
		"Flags", "efsrpc.flags", FT_UINT32, BASE_HEX,
		NULL, 0x0, "EFSRPC Flags", HFILL }},

	{ &hf_efsrpc_hnd, { 
		"Context Handle", "efsrpc.hnd", FT_BYTES,
	      	BASE_NONE, NULL, 0x0, "Context Handle", HFILL}},

	{ &hf_efsrpc_reserved, {
		"Reserved value", "efsrpc.reserved", FT_UINT32, BASE_HEX,
		NULL, 0x0, "Reserved value", HFILL }},

	 { &hf_efsrpc_num_entries,
	    { "Number of entries", "efsrpc.num_entries", FT_UINT32,
	      BASE_DEC, NULL, 0x0, "Number of Entries", HFILL}},

	 { &hf_efsrpc_data_size,
	    { "Size of data structure", "efsrpc.data_size", FT_UINT32,
	      BASE_DEC, NULL, 0x0, "Size of data structure", HFILL}},

	{ &hf_efsrpc_cert_dn,
	    { "Certificate DN", "efsrpc.cert_dn", FT_STRING, BASE_NONE,
	      NULL, 0x0, "Distinguished Name of EFS certificate", HFILL}},


	};

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

        proto_dcerpc_efs = proto_register_protocol(
                "Microsoft Encrypted File System Service", "EFSRPC", "efsrpc");

        proto_register_field_array(proto_dcerpc_efs, hf,
				   array_length(hf));

        proto_register_subtree_array(ett, array_length(ett));
}

void
proto_reg_handoff_dcerpc_efs(void)
{
        /* Register protocol as dcerpc */

        dcerpc_init_uuid(proto_dcerpc_efs, ett_dcerpc_efs,
                         &uuid_dcerpc_efs, ver_dcerpc_efs,
                         dcerpc_efs_dissectors, hf_efsrpc_opnum);
}