-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathcomt.go
700 lines (678 loc) · 24.2 KB
/
comt.go
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
// The comt package implements the COMT client protocol.
//
// # Introduction
//
// This document specifies the Component Object Model Plus (COM+) Tracker Service Protocol
// (COMT), which allows clients to monitor running instances of components.
//
// # Overview
//
// The COM+ Tracker Service Protocol enables remote clients to monitor instances of
// components running on a server. The server end of the protocol tracks the status
// of component instances and instance containers on the server and implements an interface
// that clients can use to poll for this status. It also optionally includes an event-driven
// notification system in which the client can supply (via another protocol) a callback
// interface for receiving tracker events. The server then calls the client's callback
// interface whenever new tracking data is available, for example, as a result of local
// events on the server.
package comt
import (
"context"
"fmt"
"strings"
"unicode/utf16"
dcerpc "github.com/oiweiwei/go-msrpc/dcerpc"
errors "github.com/oiweiwei/go-msrpc/dcerpc/errors"
uuid "github.com/oiweiwei/go-msrpc/midl/uuid"
dcom "github.com/oiweiwei/go-msrpc/msrpc/dcom"
dtyp "github.com/oiweiwei/go-msrpc/msrpc/dtyp"
ndr "github.com/oiweiwei/go-msrpc/ndr"
)
var (
_ = context.Background
_ = fmt.Errorf
_ = utf16.Encode
_ = strings.TrimPrefix
_ = ndr.ZeroString
_ = (*uuid.UUID)(nil)
_ = (*dcerpc.SyntaxID)(nil)
_ = (*errors.Error)(nil)
_ = dtyp.GoPackage
_ = dcom.GoPackage
)
var (
// import guard
GoPackage = "dcom/comt"
)
// ContainerStatistics structure represents ContainerStatistics RPC structure.
//
// The ContainerStatistics type represents activity statistics for an instance container.
type ContainerStatistics struct {
// cCalls: The number of method calls that the component instances perform in an instance
// container.
CallsCount uint32 `idl:"name:cCalls" json:"calls_count"`
// cComponentInstances: The number of component instances in an instance container.
ComponentInstancesCount uint32 `idl:"name:cComponentInstances" json:"component_instances_count"`
// cComponents: The number of distinct components currently instantiated in an instance
// container.
ComponentsCount uint32 `idl:"name:cComponents" json:"components_count"`
// cCallsPerSecond: This SHOULD be set to a running average, over an implementation-specific
// time period,<1> of the number of method calls per second received by an instance
// container. Alternatively, an implementation MAY instead simply set this field to
// zero.
CallsPerSecondCount uint32 `idl:"name:cCallsPerSecond" json:"calls_per_second_count"`
}
func (o *ContainerStatistics) xxx_PreparePayload(ctx context.Context) error {
if hook, ok := (interface{})(o).(interface{ AfterPreparePayload(context.Context) error }); ok {
if err := hook.AfterPreparePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *ContainerStatistics) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
if err := w.WriteAlign(4); err != nil {
return err
}
if err := w.WriteData(o.CallsCount); err != nil {
return err
}
if err := w.WriteData(o.ComponentInstancesCount); err != nil {
return err
}
if err := w.WriteData(o.ComponentsCount); err != nil {
return err
}
if err := w.WriteData(o.CallsPerSecondCount); err != nil {
return err
}
return nil
}
func (o *ContainerStatistics) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(4); err != nil {
return err
}
if err := w.ReadData(&o.CallsCount); err != nil {
return err
}
if err := w.ReadData(&o.ComponentInstancesCount); err != nil {
return err
}
if err := w.ReadData(&o.ComponentsCount); err != nil {
return err
}
if err := w.ReadData(&o.CallsPerSecondCount); err != nil {
return err
}
return nil
}
// ContainerData structure represents ContainerData RPC structure.
//
// The ContainerData type represents run-time information for a conglomeration that
// has one or more instance containers on the server. The meanings of the fields in
// this structure depend on the number of instance containers that exist on the server
// for the conglomeration represented, as specified in the following section.
type ContainerData struct {
// dwLegacyId: The container legacy identifier of one of the instance containers, arbitrarily
// selected by the server, that exist for the conglomeration represented.
LegacyID uint32 `idl:"name:dwLegacyId" json:"legacy_id"`
// wszApplicationIdentifier: A null-terminated Unicode string that MUST contain the
// CurlyBraceGuidString (section 2.2.1) representation of a conglomeration identifier.
// Note that a null-terminated CurlyBraceGuidString is 39 Unicode characters, including
// the null character, and this field is 40 characters long. The final element in this
// array is unused. It SHOULD be set to 0 and MUST be ignored upon receipt.
ApplicationID []uint16 `idl:"name:wszApplicationIdentifier" json:"application_id"`
// dwProcessId: The process identifier of the process that contains one of the instance
// containers, arbitrarily selected by the server, that exist for the conglomeration
// represented.
ProcessID uint32 `idl:"name:dwProcessId" json:"process_id"`
// statistics: A ContainerStatistics (section 2.2.2) structure with fields that contain
// statistics averaged across all instance containers that exist for the conglomeration
// represented.
Statistics *ContainerStatistics `idl:"name:statistics" json:"statistics"`
}
func (o *ContainerData) xxx_PreparePayload(ctx context.Context) error {
if hook, ok := (interface{})(o).(interface{ AfterPreparePayload(context.Context) error }); ok {
if err := hook.AfterPreparePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *ContainerData) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
if err := w.WriteAlign(4); err != nil {
return err
}
if err := w.WriteData(o.LegacyID); err != nil {
return err
}
for i1 := range o.ApplicationID {
i1 := i1
if uint64(i1) >= 40 {
break
}
if err := w.WriteData(o.ApplicationID[i1]); err != nil {
return err
}
}
for i1 := len(o.ApplicationID); uint64(i1) < 40; i1++ {
if err := w.WriteData(uint16(0)); err != nil {
return err
}
}
if err := w.WriteData(o.ProcessID); err != nil {
return err
}
if o.Statistics != nil {
if err := o.Statistics.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&ContainerStatistics{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
return nil
}
func (o *ContainerData) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(4); err != nil {
return err
}
if err := w.ReadData(&o.LegacyID); err != nil {
return err
}
o.ApplicationID = make([]uint16, 40)
for i1 := range o.ApplicationID {
i1 := i1
if err := w.ReadData(&o.ApplicationID[i1]); err != nil {
return err
}
}
if err := w.ReadData(&o.ProcessID); err != nil {
return err
}
if o.Statistics == nil {
o.Statistics = &ContainerStatistics{}
}
if err := o.Statistics.UnmarshalNDR(ctx, w); err != nil {
return err
}
return nil
}
// ComponentData structure represents ComponentData RPC structure.
//
// This type represents activity statistics for a component that has one or more component
// instances in an instance container.
type ComponentData struct {
// clsid: The CLSID of the component.
ClassID *dtyp.GUID `idl:"name:clsid" json:"class_id"`
// cTotalReferences: An implementation-specific<2> count of the number of references
// to all component instances of the component. This MUST be set to 0xffffffff if the
// server does not track this information.<3>
TotalReferencesCount uint32 `idl:"name:cTotalReferences" json:"total_references_count"`
// cBoundReferences: The number of references to all active (not pooled) component
// instances of the component. This MUST be set to 0xffffffff if the server does not
// track this information.<4>
BoundReferencesCount uint32 `idl:"name:cBoundReferences" json:"bound_references_count"`
// cPooledInstances: The number of pooled component instances of the component, if
// the server enables instance pooling. This MUST be set to 0xffffffff if the server
// does not track this information.<5>
PooledInstancesCount uint32 `idl:"name:cPooledInstances" json:"pooled_instances_count"`
// cInstancesInCall: The number of component instances of the component that are currently
// performing a method call. This MUST be set to 0xffffffff if the server does not track
// this information.<6>
InstancesInCallCount uint32 `idl:"name:cInstancesInCall" json:"instances_in_call_count"`
// dwResponseTime: A value that indicates the average time, in milliseconds, it takes
// to complete method calls to component instances of the component. Calculation of
// this value is implementation-specific.<7> This MUST be set to 0xffffffff if the server
// does not track this information.<8>
ResponseTime uint32 `idl:"name:dwResponseTime" json:"response_time"`
// cCallsCompleted: The number of method calls to component instances of the component
// that were successfully completed in an implementation-specific<9> time period. Whether
// a server considers a method call successfully completed is implementation-specific.<10>
// This MUST be set to 0xffffffff if the server does not track this information.<11>
CallsCompletedCount uint32 `idl:"name:cCallsCompleted" json:"calls_completed_count"`
// cCallsFailed: The number of method calls to component instances of the component
// that failed in an implementation-specific<12> time period. Whether a server considers
// a method call to have failed is implementation-specific.<13> This MUST be set to
// 0xffffffff if the server does not track this information.<14>
CallsFailedCount uint32 `idl:"name:cCallsFailed" json:"calls_failed_count"`
}
func (o *ComponentData) xxx_PreparePayload(ctx context.Context) error {
if hook, ok := (interface{})(o).(interface{ AfterPreparePayload(context.Context) error }); ok {
if err := hook.AfterPreparePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *ComponentData) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
if err := w.WriteAlign(4); err != nil {
return err
}
if o.ClassID != nil {
if err := o.ClassID.MarshalNDR(ctx, w); err != nil {
return err
}
} else {
if err := (&dtyp.GUID{}).MarshalNDR(ctx, w); err != nil {
return err
}
}
if err := w.WriteData(o.TotalReferencesCount); err != nil {
return err
}
if err := w.WriteData(o.BoundReferencesCount); err != nil {
return err
}
if err := w.WriteData(o.PooledInstancesCount); err != nil {
return err
}
if err := w.WriteData(o.InstancesInCallCount); err != nil {
return err
}
if err := w.WriteData(o.ResponseTime); err != nil {
return err
}
if err := w.WriteData(o.CallsCompletedCount); err != nil {
return err
}
if err := w.WriteData(o.CallsFailedCount); err != nil {
return err
}
return nil
}
func (o *ComponentData) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
if err := w.ReadAlign(4); err != nil {
return err
}
if o.ClassID == nil {
o.ClassID = &dtyp.GUID{}
}
if err := o.ClassID.UnmarshalNDR(ctx, w); err != nil {
return err
}
if err := w.ReadData(&o.TotalReferencesCount); err != nil {
return err
}
if err := w.ReadData(&o.BoundReferencesCount); err != nil {
return err
}
if err := w.ReadData(&o.PooledInstancesCount); err != nil {
return err
}
if err := w.ReadData(&o.InstancesInCallCount); err != nil {
return err
}
if err := w.ReadData(&o.ResponseTime); err != nil {
return err
}
if err := w.ReadData(&o.CallsCompletedCount); err != nil {
return err
}
if err := w.ReadData(&o.CallsFailedCount); err != nil {
return err
}
return nil
}
// GetTrackingData structure represents IGetTrackingData RPC structure.
//
// The IGetTrackingData interface provides methods for a client to poll for tracking
// information. This interface inherits from IUnknown, as specified in [MS-DCOM] section
// 3.1.1.5.8. The version for this interface is 0.0.
//
// To receive incoming remote calls for this interface, the server MUST implement a
// DCOM object class with the CLSID CLSID_TrackerService (as specified in section 1.9)
// by using the UUID {B60040E0-BCF3-11D1-861D-0080C729264D} for this interface.
//
// The IGetTrackingData interface includes the following methods beyond those of IUnknown.
//
// Methods in RPC Opnum Order
//
// +-------------------------------------+----------------------------------------------------------------------------------+
// | | |
// | METHOD | DESCRIPTION |
// | | |
// +-------------------------------------+----------------------------------------------------------------------------------+
// +-------------------------------------+----------------------------------------------------------------------------------+
// | Opnum3NotUsedOnWire | Reserved for local use. Opnum: 3 |
// +-------------------------------------+----------------------------------------------------------------------------------+
// | GetContainerData | Returns tracking information for instance containers. Opnum: 4 |
// +-------------------------------------+----------------------------------------------------------------------------------+
// | GetComponentDataByContainer | Returns tracking information for components by instance container. Opnum: 5 |
// +-------------------------------------+----------------------------------------------------------------------------------+
// | GetComponentDataByContainerAndCLSID | Returns tracking information for a component by instance container and CLSID. |
// | | Opnum: 6 |
// +-------------------------------------+----------------------------------------------------------------------------------+
// | Opnum7NotUsedOnWire | Reserved for local use. Opnum: 7 |
// +-------------------------------------+----------------------------------------------------------------------------------+
//
// In the preceding table, the phrase "Reserved for local use" means that the client
// MUST NOT send the opnum and that the server behavior is undefined<19> because it
// does not affect interoperability.
//
// All methods MUST NOT throw exceptions.
type GetTrackingData dcom.InterfacePointer
func (o *GetTrackingData) InterfacePointer() *dcom.InterfacePointer {
return (*dcom.InterfacePointer)(o)
}
func (o *GetTrackingData) xxx_PreparePayload(ctx context.Context) error {
if o.Data != nil && o.DataCount == 0 {
o.DataCount = uint32(len(o.Data))
}
if hook, ok := (interface{})(o).(interface{ AfterPreparePayload(context.Context) error }); ok {
if err := hook.AfterPreparePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *GetTrackingData) NDRSizeInfo() []uint64 {
dimSize1 := uint64(o.DataCount)
return []uint64{
dimSize1,
}
}
func (o *GetTrackingData) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
sizeInfo, ok := ctx.Value(ndr.SizeInfo).([]uint64)
if !ok {
sizeInfo = o.NDRSizeInfo()
for sz1 := range sizeInfo {
if err := w.WriteSize(sizeInfo[sz1]); err != nil {
return err
}
}
ctx = context.WithValue(ctx, ndr.SizeInfo, sizeInfo)
}
if err := w.WriteAlign(4); err != nil {
return err
}
if err := w.WriteData(o.DataCount); err != nil {
return err
}
for i1 := range o.Data {
i1 := i1
if uint64(i1) >= sizeInfo[0] {
break
}
if err := w.WriteData(o.Data[i1]); err != nil {
return err
}
}
for i1 := len(o.Data); uint64(i1) < sizeInfo[0]; i1++ {
if err := w.WriteData(uint8(0)); err != nil {
return err
}
}
return nil
}
func (o *GetTrackingData) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
sizeInfo, ok := ctx.Value(ndr.SizeInfo).([]uint64)
if !ok {
sizeInfo = o.NDRSizeInfo()
for i1 := range sizeInfo {
if err := w.ReadSize(&sizeInfo[i1]); err != nil {
return err
}
}
ctx = context.WithValue(ctx, ndr.SizeInfo, sizeInfo)
}
if err := w.ReadAlign(4); err != nil {
return err
}
if err := w.ReadData(&o.DataCount); err != nil {
return err
}
// XXX: for opaque unmarshaling
if o.DataCount > 0 && sizeInfo[0] == 0 {
sizeInfo[0] = uint64(o.DataCount)
}
if sizeInfo[0] > uint64(w.Len()) /* sanity-check */ {
return fmt.Errorf("buffer overflow for size %d of array o.Data", sizeInfo[0])
}
o.Data = make([]byte, sizeInfo[0])
for i1 := range o.Data {
i1 := i1
if err := w.ReadData(&o.Data[i1]); err != nil {
return err
}
}
return nil
}
// COMTrackingInfoEvents structure represents IComTrackingInfoEvents RPC structure.
//
// The IComTrackingInfoEvents interface provides a method for a server to send the client
// tracker events. This interface inherits from IUnknown, as specified in [MS-DCOM]
// section 3.1.1.5.8. The version for this interface is 0.0.
//
// This interface includes the following method beyond those of IUnknown.
//
// Methods in RPC Opnum Order
//
// +-------------------+-------------------------------------+
// | | |
// | METHOD | DESCRIPTION |
// | | |
// +-------------------+-------------------------------------+
// +-------------------+-------------------------------------+
// | OnNewTrackingInfo | Handles new tracking info. Opnum: 3 |
// +-------------------+-------------------------------------+
//
// This method MUST NOT throw exceptions.
type COMTrackingInfoEvents dcom.InterfacePointer
func (o *COMTrackingInfoEvents) InterfacePointer() *dcom.InterfacePointer {
return (*dcom.InterfacePointer)(o)
}
func (o *COMTrackingInfoEvents) xxx_PreparePayload(ctx context.Context) error {
if o.Data != nil && o.DataCount == 0 {
o.DataCount = uint32(len(o.Data))
}
if hook, ok := (interface{})(o).(interface{ AfterPreparePayload(context.Context) error }); ok {
if err := hook.AfterPreparePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *COMTrackingInfoEvents) NDRSizeInfo() []uint64 {
dimSize1 := uint64(o.DataCount)
return []uint64{
dimSize1,
}
}
func (o *COMTrackingInfoEvents) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
sizeInfo, ok := ctx.Value(ndr.SizeInfo).([]uint64)
if !ok {
sizeInfo = o.NDRSizeInfo()
for sz1 := range sizeInfo {
if err := w.WriteSize(sizeInfo[sz1]); err != nil {
return err
}
}
ctx = context.WithValue(ctx, ndr.SizeInfo, sizeInfo)
}
if err := w.WriteAlign(4); err != nil {
return err
}
if err := w.WriteData(o.DataCount); err != nil {
return err
}
for i1 := range o.Data {
i1 := i1
if uint64(i1) >= sizeInfo[0] {
break
}
if err := w.WriteData(o.Data[i1]); err != nil {
return err
}
}
for i1 := len(o.Data); uint64(i1) < sizeInfo[0]; i1++ {
if err := w.WriteData(uint8(0)); err != nil {
return err
}
}
return nil
}
func (o *COMTrackingInfoEvents) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
sizeInfo, ok := ctx.Value(ndr.SizeInfo).([]uint64)
if !ok {
sizeInfo = o.NDRSizeInfo()
for i1 := range sizeInfo {
if err := w.ReadSize(&sizeInfo[i1]); err != nil {
return err
}
}
ctx = context.WithValue(ctx, ndr.SizeInfo, sizeInfo)
}
if err := w.ReadAlign(4); err != nil {
return err
}
if err := w.ReadData(&o.DataCount); err != nil {
return err
}
// XXX: for opaque unmarshaling
if o.DataCount > 0 && sizeInfo[0] == 0 {
sizeInfo[0] = uint64(o.DataCount)
}
if sizeInfo[0] > uint64(w.Len()) /* sanity-check */ {
return fmt.Errorf("buffer overflow for size %d of array o.Data", sizeInfo[0])
}
o.Data = make([]byte, sizeInfo[0])
for i1 := range o.Data {
i1 := i1
if err := w.ReadData(&o.Data[i1]); err != nil {
return err
}
}
return nil
}
// ProcessDump structure represents IProcessDump RPC structure.
//
// The IProcessDump interface provides methods for a client to request a process dump
// of a process containing an instance container on the COMT server. This interface
// inherits from IDispatch, as specified in [MS-OAUT] section 3.1.4. The version for
// this interface is 0.0.
//
// To receive incoming remote calls for this interface, the server MUST implement a
// DCOM object class with the CLSID CLSID_ProcessDump (as specified in section 1.9)
// by using the UUID {23C9DD26-2355-4FE2-84DE-F779A238ADBD} for this interface.
//
// This interface includes the following methods beyond those of IDispatch.
//
// Methods in RPC Opnum Order
//
// +-------------+--------------------------------------------------------------------------------+
// | | |
// | METHOD | DESCRIPTION |
// | | |
// +-------------+--------------------------------------------------------------------------------+
// +-------------+--------------------------------------------------------------------------------+
// | IsSupported | Returns a result indicating whether or not process dump is supported. Opnum: 7 |
// +-------------+--------------------------------------------------------------------------------+
// | DumpProcess | Requests a process dump. Opnum: 8 |
// +-------------+--------------------------------------------------------------------------------+
//
// All methods MUST NOT throw exceptions.
type ProcessDump dcom.InterfacePointer
func (o *ProcessDump) InterfacePointer() *dcom.InterfacePointer { return (*dcom.InterfacePointer)(o) }
func (o *ProcessDump) xxx_PreparePayload(ctx context.Context) error {
if o.Data != nil && o.DataCount == 0 {
o.DataCount = uint32(len(o.Data))
}
if hook, ok := (interface{})(o).(interface{ AfterPreparePayload(context.Context) error }); ok {
if err := hook.AfterPreparePayload(ctx); err != nil {
return err
}
}
return nil
}
func (o *ProcessDump) NDRSizeInfo() []uint64 {
dimSize1 := uint64(o.DataCount)
return []uint64{
dimSize1,
}
}
func (o *ProcessDump) MarshalNDR(ctx context.Context, w ndr.Writer) error {
if err := o.xxx_PreparePayload(ctx); err != nil {
return err
}
sizeInfo, ok := ctx.Value(ndr.SizeInfo).([]uint64)
if !ok {
sizeInfo = o.NDRSizeInfo()
for sz1 := range sizeInfo {
if err := w.WriteSize(sizeInfo[sz1]); err != nil {
return err
}
}
ctx = context.WithValue(ctx, ndr.SizeInfo, sizeInfo)
}
if err := w.WriteAlign(4); err != nil {
return err
}
if err := w.WriteData(o.DataCount); err != nil {
return err
}
for i1 := range o.Data {
i1 := i1
if uint64(i1) >= sizeInfo[0] {
break
}
if err := w.WriteData(o.Data[i1]); err != nil {
return err
}
}
for i1 := len(o.Data); uint64(i1) < sizeInfo[0]; i1++ {
if err := w.WriteData(uint8(0)); err != nil {
return err
}
}
return nil
}
func (o *ProcessDump) UnmarshalNDR(ctx context.Context, w ndr.Reader) error {
sizeInfo, ok := ctx.Value(ndr.SizeInfo).([]uint64)
if !ok {
sizeInfo = o.NDRSizeInfo()
for i1 := range sizeInfo {
if err := w.ReadSize(&sizeInfo[i1]); err != nil {
return err
}
}
ctx = context.WithValue(ctx, ndr.SizeInfo, sizeInfo)
}
if err := w.ReadAlign(4); err != nil {
return err
}
if err := w.ReadData(&o.DataCount); err != nil {
return err
}
// XXX: for opaque unmarshaling
if o.DataCount > 0 && sizeInfo[0] == 0 {
sizeInfo[0] = uint64(o.DataCount)
}
if sizeInfo[0] > uint64(w.Len()) /* sanity-check */ {
return fmt.Errorf("buffer overflow for size %d of array o.Data", sizeInfo[0])
}
o.Data = make([]byte, sizeInfo[0])
for i1 := range o.Data {
i1 := i1
if err := w.ReadData(&o.Data[i1]); err != nil {
return err
}
}
return nil
}