-
Notifications
You must be signed in to change notification settings - Fork 2
/
server.go
207 lines (189 loc) · 8.11 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
package ivdsvolumemf
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"
iunknown "github.com/oiweiwei/go-msrpc/msrpc/dcom/iunknown/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)
_ = iunknown.GoPackage
)
// IVdsVolumeMF server interface.
type VolumeMFServer interface {
// IUnknown base class.
iunknown.UnknownServer
// The GetFileSystemProperties method returns property details about the file system
// on the current volume.
//
// Return Values: The method MUST return zero or a non-error HRESULT (as specified in
// [MS-ERREF]) to indicate success, or return an implementation-specific nonzero error
// code to indicate failure. For the HRESULT values predefined by the Virtual Disk Service
// Remote Protocol, see section 2.2.3.
GetFileSystemProperties(context.Context, *GetFileSystemPropertiesRequest) (*GetFileSystemPropertiesResponse, error)
// The Format method formats a file system on the current volume.
//
// Return Values: The method MUST return zero or a non-error HRESULT (as specified in
// [MS-ERREF]) to indicate success, or return an implementation-specific nonzero error
// code to indicate failure. For the HRESULT values predefined by the Virtual Disk Service
// Remote Protocol, see section 2.2.3.
Format(context.Context, *FormatRequest) (*FormatResponse, error)
// The AddAccessPath method adds an access path to the current volume.<129>
//
// Return Values: The method MUST return zero or a non-error HRESULT (as specified in
// [MS-ERREF]) to indicate success, or return an implementation-specific nonzero error
// code to indicate failure. For the HRESULT values predefined by the Virtual Disk Service
// Remote Protocol, see section 2.2.3.
AddAccessPath(context.Context, *AddAccessPathRequest) (*AddAccessPathResponse, error)
// The QueryAccessPaths method returns a list of access paths and a drive letter as
// a single case-insensitive Unicode character, if one exists, for the current volume.
//
// Return Values: The method MUST return zero or a non-error HRESULT (as specified in
// [MS-ERREF]) to indicate success, or return an implementation-specific nonzero error
// code to indicate failure. For the HRESULT values predefined by the Virtual Disk Service
// Remote Protocol, see section 2.2.3.
QueryAccessPaths(context.Context, *QueryAccessPathsRequest) (*QueryAccessPathsResponse, error)
// The QueryReparsePoints method returns all reparse points for the current volume.
//
// Return Values: The method MUST return zero or a non-error HRESULT (as specified in
// [MS-ERREF]) to indicate success, or return an implementation-specific nonzero error
// code to indicate failure. For the HRESULT values predefined by the Virtual Disk Service
// Remote Protocol, see section 2.2.3.
QueryReparsePoints(context.Context, *QueryReparsePointsRequest) (*QueryReparsePointsResponse, error)
// The DeleteAccessPath method removes the access path from the current volume.
//
// Return Values: The method MUST return zero or a non-error HRESULT (as specified in
// [MS-ERREF]) to indicate success, or return an implementation-specific nonzero error
// code to indicate failure. For the HRESULT values predefined by the Virtual Disk Service
// Remote Protocol, see section 2.2.3.
DeleteAccessPath(context.Context, *DeleteAccessPathRequest) (*DeleteAccessPathResponse, error)
// The Mount method mounts a volume.
//
// This method has no parameters.
//
// Return Values: The method MUST return zero or a non-error HRESULT (as specified in
// [MS-ERREF]) to indicate success, or return an implementation-specific nonzero error
// code to indicate failure. For the HRESULT values predefined by the Virtual Disk Service
// Remote Protocol, see section 2.2.3.
Mount(context.Context, *MountRequest) (*MountResponse, error)
// The Dismount method dismounts a mounted volume.
//
// Return Values: The method MUST return zero or a non-error HRESULT (as specified in
// [MS-ERREF]) to indicate success, or return an implementation-specific nonzero error
// code to indicate failure. For the HRESULT values predefined by the Virtual Disk Service
// Remote Protocol, see section 2.2.3.
Dismount(context.Context, *DismountRequest) (*DismountResponse, error)
// The SetFileSystemFlags method sets the file system flags.
//
// Return Values: The method MUST return zero or a non-error HRESULT (as specified in
// [MS-ERREF]) to indicate success, or return an implementation-specific nonzero error
// code to indicate failure. For the HRESULT values predefined by the Virtual Disk Service
// Remote Protocol, see section 2.2.3.
SetFileSystemFlags(context.Context, *SetFileSystemFlagsRequest) (*SetFileSystemFlagsResponse, error)
// The ClearFileSystemFlags method clears the file system flags.
//
// Return Values: The method MUST return zero or a non-error HRESULT (as specified in
// [MS-ERREF]) to indicate success, or return an implementation-specific nonzero error
// code to indicate failure. For the HRESULT values predefined by the Virtual Disk Service
// Remote Protocol, see section 2.2.3.
ClearFileSystemFlags(context.Context, *ClearFileSystemFlagsRequest) (*ClearFileSystemFlagsResponse, error)
}
func RegisterVolumeMFServer(conn dcerpc.Conn, o VolumeMFServer, opts ...dcerpc.Option) {
conn.RegisterServer(NewVolumeMFServerHandle(o), append(opts, dcerpc.WithAbstractSyntax(VolumeMFSyntaxV0_0))...)
}
func NewVolumeMFServerHandle(o VolumeMFServer) dcerpc.ServerHandle {
return func(ctx context.Context, opNum int, r ndr.Reader) (dcerpc.Operation, error) {
return VolumeMFServerHandle(ctx, o, opNum, r)
}
}
func VolumeMFServerHandle(ctx context.Context, o VolumeMFServer, opNum int, r ndr.Reader) (dcerpc.Operation, error) {
if opNum < 3 {
// IUnknown base method.
return iunknown.UnknownServerHandle(ctx, o, opNum, r)
}
switch opNum {
case 3: // GetFileSystemProperties
in := &GetFileSystemPropertiesRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.GetFileSystemProperties(ctx, in)
return resp.xxx_ToOp(ctx), err
case 4: // Format
in := &FormatRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.Format(ctx, in)
return resp.xxx_ToOp(ctx), err
case 5: // AddAccessPath
in := &AddAccessPathRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.AddAccessPath(ctx, in)
return resp.xxx_ToOp(ctx), err
case 6: // QueryAccessPaths
in := &QueryAccessPathsRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.QueryAccessPaths(ctx, in)
return resp.xxx_ToOp(ctx), err
case 7: // QueryReparsePoints
in := &QueryReparsePointsRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.QueryReparsePoints(ctx, in)
return resp.xxx_ToOp(ctx), err
case 8: // DeleteAccessPath
in := &DeleteAccessPathRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.DeleteAccessPath(ctx, in)
return resp.xxx_ToOp(ctx), err
case 9: // Mount
in := &MountRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.Mount(ctx, in)
return resp.xxx_ToOp(ctx), err
case 10: // Dismount
in := &DismountRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.Dismount(ctx, in)
return resp.xxx_ToOp(ctx), err
case 11: // SetFileSystemFlags
in := &SetFileSystemFlagsRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.SetFileSystemFlags(ctx, in)
return resp.xxx_ToOp(ctx), err
case 12: // ClearFileSystemFlags
in := &ClearFileSystemFlagsRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.ClearFileSystemFlags(ctx, in)
return resp.xxx_ToOp(ctx), err
}
return nil, nil
}