-
Notifications
You must be signed in to change notification settings - Fork 2
/
server.go
499 lines (476 loc) · 17.9 KB
/
server.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
package itypeinfo2
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"
itypeinfo "github.com/oiweiwei/go-msrpc/msrpc/dcom/oaut/itypeinfo/v0"
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)
_ = itypeinfo.GoPackage
)
// ITypeInfo2 server interface.
type TypeInfo2Server interface {
// ITypeInfo base class.
itypeinfo.TypeInfoServer
// The GetTypeKind method returns the TYPEKIND value associated with the automation
// type description.
//
// Return Values: The method MUST return information in an HRESULT data structure, defined
// in [MS-ERREF] section 2.1. The severity bit in the structure identifies the following
// conditions:
//
// * If the severity bit is set to 0, the method completed successfully.
//
// * If the severity bit is set to 1, the method failed and encountered a fatal error.
GetTypeKind(context.Context, *GetTypeKindRequest) (*GetTypeKindResponse, error)
// The GetTypeFlags method returns the TYPEFLAGS value associated with the automation
// type description.
//
// Return Values: The method MUST return information in an HRESULT data structure, defined
// in [MS-ERREF] section 2.1. The severity bit in the structure identifies the following
// conditions:
//
// * If the severity bit is set to 0, the method completed successfully.
//
// * If the severity bit is set to 1, the method failed and encountered a fatal error.
GetTypeFlags(context.Context, *GetTypeFlagsRequest) (*GetTypeFlagsResponse, error)
// The GetFuncIndexOfMemId method retrieves the location of an element in the data member
// table, given its associated MEMBERID.
//
// Return Values: The method MUST return information in an HRESULT data structure, defined
// in [MS-ERREF] section 2.1. The severity bit in the structure identifies the following
// conditions:
//
// * If the severity bit is set to 0, the method completed successfully.
//
// * If the severity bit is set to 1 and the entire HRESULT DWORD does not match a value
// in the following table, a fatal failure occurred.
//
// * If the severity bit is set to 1 and the entire HRESULT DWORD matches a value in
// the following table, a failure occurred.
//
// Return value/code
//
// # Description
//
// 0x8002802B
//
// TYPE_E_ELEMENTNOTFOUND
//
// The values of memid and invKind did not specify a member of the type. See [MS-ERREF].
GetFuncIndexOfMemberIDs(context.Context, *GetFuncIndexOfMemberIDsRequest) (*GetFuncIndexOfMemberIDsResponse, error)
// The GetVarIndexOfMemId method retrieves the location of an element in the data member
// table by using the associated MEMBERID of the element.
//
// The method is received by the server in an RPC_REQUEST packet.
//
// Return Values: The method MUST return information in an HRESULT data structure that
// is defined in [MS-ERREF] section 2.1. The severity bit in the structure identifies
// the following conditions:
//
// * If the severity bit is set to 0, the method completed successfully.
//
// * If the severity bit is set to 1 and the entire HRESULT DWORD does not match a value
// in the following table, a fatal failure occurred.
//
// * If the severity bit is set to 1 and the entire HRESULT DWORD matches a value in
// the following table, a failure occurred.
//
// Return value/code
//
// # Description
//
// 0x8002802B
//
// TYPE_E_ELEMENTNOTFOUND
//
// The value of memid did not specify a member of the type. See [MS-ERREF].
GetVarIndexOfMemberIDs(context.Context, *GetVarIndexOfMemberIDsRequest) (*GetVarIndexOfMemberIDsResponse, error)
// The GetCustData method retrieves the value of a custom data item associated with
// the automation type library.
//
// The GetCustData method retrieves the value of a custom data item associated with
// the type.
//
// Return Values: The method MUST return information in an HRESULT data structure, defined
// in [MS-ERREF] section 2.1. The severity bit in the structure identifies the following
// conditions:
//
// * If the severity bit is set to 0, the method completed successfully.
//
// * If the severity bit is set to 1, the method failed and encountered a fatal error.
GetCustomData(context.Context, *GetCustomDataRequest) (*GetCustomDataResponse, error)
// The GetFuncCustData method retrieves the value of a custom data item associated with
// the specified method.
//
// Return Values: The method MUST return information in an HRESULT data structure, defined
// in [MS-ERREF] section 2.1. The severity bit in the structure identifies the following
// conditions:
//
// * If the severity bit is set to 0, the method completed successfully.
//
// * If the severity bit is set to 1 and the entire HRESULT DWORD does not match a value
// in the following table, a fatal failure occurred.
//
// * If the severity bit is set to 1 and the entire HRESULT DWORD matches a value in
// the following table, a failure occurred.
//
// Return value/code
//
// # Description
//
// 0x8002802B
//
// TYPE_E_ELEMENTNOTFOUND
//
// The value of index did not specify the ordinal position of an element in the method
// table. See [MS-ERREF].
GetFuncCustomData(context.Context, *GetFuncCustomDataRequest) (*GetFuncCustomDataResponse, error)
// The GetParamCustData method retrieves the value of a custom data item associated
// with the specified method parameter.
//
// Return Values: The method MUST return information in an HRESULT data structure, defined
// in [MS-ERREF] section 2.1. The severity bit in the structure identifies the following
// conditions:
//
// * If the severity bit is set to 0, the method completed successfully.
//
// * If the severity bit is set to 1 and the entire HRESULT DWORD does not match a value
// in the following table, a fatal failure occurred.
//
// * If the severity bit is set to 1 and the entire HRESULT DWORD matches a value in
// the following table, a failure occurred.
//
// Return value/code
//
// # Description
//
// 0x8002802B
//
// TYPE_E_ELEMENTNOTFOUND
//
// The value of indexFunc did not specify the ordinal position of an element in the
// interface table, or the value of indexParam did not specify the ordinal position
// of an element in the method's parameter table. See [MS-ERREF].
GetParamCustomData(context.Context, *GetParamCustomDataRequest) (*GetParamCustomDataResponse, error)
// The GetVarCustData method retrieves the value of a custom data item associated with
// the specified data member.
//
// Return Values: The method MUST return information in an HRESULT data structure, defined
// in [MS-ERREF] section 2.1. The severity bit in the structure identifies the following
// conditions:
//
// * If the severity bit is set to 0, the method completed successfully.
//
// * If the severity bit is set to 1 and the entire HRESULT DWORD does not match a value
// in the following table, a fatal failure occurred.
//
// * If the severity bit is set to 1 and the entire HRESULT DWORD matches a value in
// the following table, a failure occurred.
//
// Return value/code
//
// # Description
//
// 0x8002802B
//
// TYPE_E_ELEMENTNOTFOUND
//
// The value of index did not specify the ordinal position of an element in the data
// member table. See [MS-ERREF].
GetVarCustomData(context.Context, *GetVarCustomDataRequest) (*GetVarCustomDataResponse, error)
// The GetImplTypeCustData method retrieves the value of a custom data item associated
// with the specified interface member of a coclass.
//
// Return Values: The method MUST return information in an HRESULT data structure, defined
// in [MS-ERREF] section 2.1. The severity bit in the structure identifies the following
// conditions:
//
// * If the severity bit is set to 0, the method completed successfully.
//
// * If the severity bit is set to 1 and the entire HRESULT DWORD does not match a value
// in the following table, a fatal failure occurred.
//
// * If the severity bit is set to 1 and the entire HRESULT DWORD matches a value in
// the following table, a failure occurred.
//
// Return value/code
//
// # Description
//
// 0x8002802B
//
// TYPE_E_ELEMENTNOTFOUND
//
// The value of index did not specify the ordinal position of an element in the interface
// table, or the type is not a coclass. See [MS-ERREF].
GetImplTypeCustomData(context.Context, *GetImplTypeCustomDataRequest) (*GetImplTypeCustomDataResponse, error)
// The GetDocumentation2 method retrieves values associated with the automation type
// library.
//
// The GetDocumentation2 method retrieves values associated with a type member.
//
// Return Values: The method MUST return information in an HRESULT data structure, defined
// in [MS-ERREF] section 2.1. The severity bit in the structure identifies the following
// conditions:
//
// * If the severity bit is set to 0, the method completed successfully.
//
// * If the severity bit is set to 1, the method failed and encountered a fatal error.
GetDocumentation2(context.Context, *GetDocumentation2Request) (*GetDocumentation2Response, error)
// The GetAllCustData method retrieves the values of all custom data items associated
// with the automation type library.
//
// The GetAllCustData method retrieves all the custom data items associated with the
// automation type description.
//
// Return Values: The method MUST return information in an HRESULT data structure, defined
// in [MS-ERREF] section 2.1. The severity bit in the structure identifies the following
// conditions:
//
// * If the severity bit is set to 0, the method completed successfully.
//
// * If the severity bit is set to 1, the method failed and encountered a fatal error.
GetAllCustomData(context.Context, *GetAllCustomDataRequest) (*GetAllCustomDataResponse, error)
// The GetAllFuncCustData method retrieves all of the custom data items associated with
// the specified method.
//
// Return Values: The method MUST return information in an HRESULT data structure, defined
// in [MS-ERREF] section 2.1. The severity bit in the structure identifies the following
// conditions:
//
// * If the severity bit is set to 0, the method completed successfully.
//
// * If the severity bit is set to 1 and the entire HRESULT DWORD does not match a value
// in the following table, a fatal failure occurred.
//
// * If the severity bit is set to 1 and the entire HRESULT DWORD matches a value in
// the following table, a failure occurred.
//
// Return value/code
//
// # Description
//
// 0x8002802B
//
// TYPE_E_ELEMENTNOTFOUND
//
// The value of index did not specify the ordinal position of an element in the data
// member table. See [MS-ERREF].
GetAllFuncCustomData(context.Context, *GetAllFuncCustomDataRequest) (*GetAllFuncCustomDataResponse, error)
// The GetAllParamCustData method retrieves all of the custom data items associated
// with the specified parameter.
//
// Return Values: The method MUST return information in an HRESULT data structure, defined
// in [MS-ERREF] section 2.1. The severity bit in the structure identifies the following
// conditions:
//
// * If the severity bit is set to 0, the method completed successfully.
//
// * If the severity bit is set to 1 and the entire HRESULT DWORD does not match a value
// in the following table, a fatal failure occurred.
//
// * If the severity bit is set to 1 and the entire HRESULT DWORD matches a value in
// the following table, a failure occurred.
//
// Return value/code
//
// # Description
//
// 0x8002802B
//
// TYPE_E_ELEMENTNOTFOUND
//
// The value of indexFunc did not specify the ordinal position of an element in the
// method table, or the value of indexParam did not specify the ordinal position of
// an element in the parameter table.
GetAllParamCustomData(context.Context, *GetAllParamCustomDataRequest) (*GetAllParamCustomDataResponse, error)
// The GetAllVarCustData method retrieves all of the custom data items associated with
// the specified data member.
//
// Return Values: The method MUST return information in an HRESULT data structure, defined
// in [MS-ERREF] section 2.1. The severity bit in the structure identifies the following
// conditions:
//
// * If the severity bit is set to 0, the method completed successfully.
//
// * If the severity bit is set to 1 and the entire HRESULT DWORD does not match a value
// in the following table, a fatal failure occurred.
//
// * If the severity bit is set to 1 and the entire HRESULT DWORD matches a value in
// the following table, a failure occurred.
//
// Return value/code
//
// # Description
//
// 0x8002802B
//
// TYPE_E_ELEMENTNOTFOUND
//
// The value of index did not specify the ordinal position of an element in the data
// member table. See [MS-ERREF].
GetAllVarCustomData(context.Context, *GetAllVarCustomDataRequest) (*GetAllVarCustomDataResponse, error)
// The GetAllImplTypeCustData method retrieves all of the custom data items associated
// with the specified data member.
//
// Return Values: The method MUST return information in an HRESULT data structure, defined
// in [MS-ERREF] section 2.1. The severity bit in the structure identifies the following
// conditions:
//
// * If the severity bit is set to 0, the method completed successfully.
//
// * If the severity bit is set to 1 and the entire HRESULT DWORD does not match a value
// in the following table, a fatal failure occurred.
//
// * If the severity bit is set to 1 and the entire HRESULT DWORD matches a value in
// the following table, a failure occurred.
//
// Return value/code
//
// # Description
//
// 0x8002802B
//
// TYPE_E_ELEMENTNOTFOUND
//
// The value of index did not specify the ordinal position of an element in the interface
// table, or the type is not a coclass ( 5583e1b8-454c-4147-9f56-f72416a15bee#gt_670b0ee2-d101-41b0-ac77-6ac7dbeee7dc
// ). See [MS-ERREF].
GetAllImplTypeCustomData(context.Context, *GetAllImplTypeCustomDataRequest) (*GetAllImplTypeCustomDataResponse, error)
}
func RegisterTypeInfo2Server(conn dcerpc.Conn, o TypeInfo2Server, opts ...dcerpc.Option) {
conn.RegisterServer(NewTypeInfo2ServerHandle(o), append(opts, dcerpc.WithAbstractSyntax(TypeInfo2SyntaxV0_0))...)
}
func NewTypeInfo2ServerHandle(o TypeInfo2Server) dcerpc.ServerHandle {
return func(ctx context.Context, opNum int, r ndr.Reader) (dcerpc.Operation, error) {
return TypeInfo2ServerHandle(ctx, o, opNum, r)
}
}
func TypeInfo2ServerHandle(ctx context.Context, o TypeInfo2Server, opNum int, r ndr.Reader) (dcerpc.Operation, error) {
if opNum < 22 {
// ITypeInfo base method.
return itypeinfo.TypeInfoServerHandle(ctx, o, opNum, r)
}
switch opNum {
case 22: // GetTypeKind
in := &GetTypeKindRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.GetTypeKind(ctx, in)
return resp.xxx_ToOp(ctx), err
case 23: // GetTypeFlags
in := &GetTypeFlagsRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.GetTypeFlags(ctx, in)
return resp.xxx_ToOp(ctx), err
case 24: // GetFuncIndexOfMemId
in := &GetFuncIndexOfMemberIDsRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.GetFuncIndexOfMemberIDs(ctx, in)
return resp.xxx_ToOp(ctx), err
case 25: // GetVarIndexOfMemId
in := &GetVarIndexOfMemberIDsRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.GetVarIndexOfMemberIDs(ctx, in)
return resp.xxx_ToOp(ctx), err
case 26: // GetCustData
in := &GetCustomDataRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.GetCustomData(ctx, in)
return resp.xxx_ToOp(ctx), err
case 27: // GetFuncCustData
in := &GetFuncCustomDataRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.GetFuncCustomData(ctx, in)
return resp.xxx_ToOp(ctx), err
case 28: // GetParamCustData
in := &GetParamCustomDataRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.GetParamCustomData(ctx, in)
return resp.xxx_ToOp(ctx), err
case 29: // GetVarCustData
in := &GetVarCustomDataRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.GetVarCustomData(ctx, in)
return resp.xxx_ToOp(ctx), err
case 30: // GetImplTypeCustData
in := &GetImplTypeCustomDataRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.GetImplTypeCustomData(ctx, in)
return resp.xxx_ToOp(ctx), err
case 31: // GetDocumentation2
in := &GetDocumentation2Request{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.GetDocumentation2(ctx, in)
return resp.xxx_ToOp(ctx), err
case 32: // GetAllCustData
in := &GetAllCustomDataRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.GetAllCustomData(ctx, in)
return resp.xxx_ToOp(ctx), err
case 33: // GetAllFuncCustData
in := &GetAllFuncCustomDataRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.GetAllFuncCustomData(ctx, in)
return resp.xxx_ToOp(ctx), err
case 34: // GetAllParamCustData
in := &GetAllParamCustomDataRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.GetAllParamCustomData(ctx, in)
return resp.xxx_ToOp(ctx), err
case 35: // GetAllVarCustData
in := &GetAllVarCustomDataRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.GetAllVarCustomData(ctx, in)
return resp.xxx_ToOp(ctx), err
case 36: // GetAllImplTypeCustData
in := &GetAllImplTypeCustomDataRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.GetAllImplTypeCustomData(ctx, in)
return resp.xxx_ToOp(ctx), err
}
return nil, nil
}