Skip to content

Commit 6be3c18

Browse files
authored
Merge pull request #10 from qtc-de/dev
Formatting changes
2 parents 5a78b14 + 4c114b8 commit 6be3c18

32 files changed

+1867
-1584
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88

9-
## v1.3.0 - Apr 07, 2025
9+
## v1.3.0 - Apr 08, 2025
1010

1111
### Added
1212

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div align="center">
2-
<img src="https://github.com/qtc-de/rpv/assets/49147108/89c49bf5-6f97-455e-b9e1-b38b27e58658"/>
2+
<img src="https://github.com/user-attachments/assets/be814b15-8485-412e-a3a5-fa0989865bd7"/>
33
</div>
44
<br/>
55

alternate/default-x64.v

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ pub const compatible_rpc_versions = [
8484
// available in future. Up to this point, we need to keep the x64 and x86
8585
// struct definitions in separate files.
8686
@[if x64]
87-
pub struct RpcInterface {
87+
pub struct RpcInterface
88+
{
8889
pub:
8990
p_rpc_server &RpcServer = unsafe { nil }
9091
flags u32
@@ -125,7 +126,8 @@ pub:
125126
// available in future. Up to this point, we need to keep the x64 and x86
126127
// struct definitions in separate files.
127128
@[if x64]
128-
pub struct RpcServer {
129+
pub struct RpcServer
130+
{
129131
pub:
130132
mutex Mutex
131133
is_listening1 u32
@@ -169,7 +171,8 @@ pub:
169171
// available in future. Up to this point, we need to keep the x64 and x86
170172
// struct definitions in separate files.
171173
@[if x64]
172-
pub struct RpcAddress {
174+
pub struct RpcAddress
175+
{
173176
pub:
174177
vtable voidptr
175178
magic u32

alternate/default-x86.v

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ pub const compatible_rpc_versions = [
8484
// available in future. Up to this point, we need to keep the x64 and x86
8585
// struct definitions in separate files.
8686
@[if x86]
87-
pub struct RpcInterface {
87+
pub struct RpcInterface
88+
{
8889
pub:
8990
p_rpc_server &RpcServer = unsafe { nil }
9091
flags u32
@@ -121,7 +122,8 @@ pub:
121122
// available in future. Up to this point, we need to keep the x64 and x86
122123
// struct definitions in separate files.
123124
@[if x86]
124-
pub struct RpcServer {
125+
pub struct RpcServer
126+
{
125127
pub:
126128
mutex Mutex
127129
is_listening1 int
@@ -160,7 +162,8 @@ pub:
160162
// available in future. Up to this point, we need to keep the x64 and x86
161163
// struct definitions in separate files.
162164
@[if x86]
163-
pub struct RpcAddress {
165+
pub struct RpcAddress
166+
{
164167
pub:
165168
vtable voidptr
166169
magic u32

examples/list.v

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ module main
22

33
import qtc_de.rpv
44

5-
/*
6-
* This example attempts to list all running processes that
7-
* expose RPC endpoints.
8-
*/
5+
// This example attempts to list all running processes that
6+
// expose RPC endpoints.
97

108
fn main()
119
{

internals/rpc-common.v

Lines changed: 65 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ type RpcCallbackFunction = fn (intf_handle voidptr, context voidptr) RPC_STATUS
1212

1313
// ListEntry represents one node in a list with a forward and a backward pointer.
1414
// It is used within RtlCriticalSectionDebug and the RpcServer struct.
15-
pub struct ListEntry {
15+
pub struct ListEntry
16+
{
1617
f_link &ListEntry = unsafe { nil }
1718
b_link &ListEntry = unsafe { nil }
1819
}
1920

2021
// RtlCriticalSectionDebug is a mutex related structure. It is not really used by rpv
2122
// but needs to be defined as it is part of other RpcStructures.
22-
pub struct RtlCriticalSectionDebug {
23+
pub struct RtlCriticalSectionDebug
24+
{
2325
section_type u16
2426
creator_back_trace_index u16
2527
critical_section &RtlCriticalSection = unsafe { nil }
@@ -33,7 +35,8 @@ pub struct RtlCriticalSectionDebug {
3335

3436
// RtlCriticalSection is a mutex related structure. It is not really used by rpv
3537
// but needs to be defined as it is part of other RpcStructures.
36-
pub struct RtlCriticalSection {
38+
pub struct RtlCriticalSection
39+
{
3740
debug_info &RtlCriticalSectionDebug = unsafe { nil }
3841
lock_count u32
3942
recursion_count u32
@@ -45,15 +48,17 @@ pub struct RtlCriticalSection {
4548
// Mutex is a synchronization struct to signal ownership of a thread on a
4649
// critical section. It is not really used by rpv but needs to be defined
4750
// as it is part of other RpcStructures.
48-
pub struct Mutex {
51+
pub struct Mutex
52+
{
4953
critical_section RtlCriticalSection
5054
}
5155

5256
// SimpleDict represents a simple dictionary struct. Actually, it feels more
5357
// like an array than a dictionary, as contained elements are simply references
5458
// by the p_array (pointer array) member. Internal RPC structs use this struct
5559
// to reference to different elements like e.g. their interfaces.
56-
pub struct SimpleDict {
60+
pub struct SimpleDict
61+
{
5762
pub:
5863
p_array &voidptr = unsafe { nil }
5964
array_size u32
@@ -63,15 +68,17 @@ pub:
6368

6469
// RpcProtSeqEndpoint is an internal RPC structure. It is not really used
6570
// by rpv but needs to be defined as it is part of other RpcStructures.
66-
pub struct RpcProtSeqEndpoint {
71+
pub struct RpcProtSeqEndpoint
72+
{
6773
rpc_protocol_sequence &char = unsafe { nil }
6874
endpoint &char = unsafe { nil }
6975
}
7076

7177
// RpcServerInterface is an internal RPC structure that stores interface related
7278
// information. It is contained within the RpcInterface struct and provides
7379
// information such as the interface id, it's transfer syntax and RPC flags.
74-
pub struct RpcServerInterface {
80+
pub struct RpcServerInterface
81+
{
7582
pub:
7683
length u32
7784
interface_id C.RPC_IF_ID
@@ -87,7 +94,8 @@ pub:
8794
// C.RPC_IF_ID represents an ID of an RPC interface. This is basically an GUID
8895
// but also contains a major and minor version.
8996
@[typedef]
90-
pub struct C.RPC_IF_ID {
97+
pub struct C.RPC_IF_ID
98+
{
9199
Uuid C.GUID
92100
VersMajor u16
93101
VersMinor u16
@@ -104,7 +112,8 @@ pub fn (this C.RPC_IF_ID) equals(other C.RPC_IF_ID) bool
104112
// RPC interface. rpv uses it to determine the method count, that can be obtained
105113
// from the DispatchTableCount property.
106114
@[typedef]
107-
pub struct C.RPC_DISPATCH_TABLE {
115+
pub struct C.RPC_DISPATCH_TABLE
116+
{
108117
DispatchTableCount u32
109118
DispatchTable voidptr
110119
Reserved isize
@@ -117,15 +126,16 @@ pub struct C.RPC_DISPATCH_TABLE {
117126
// property, which contains the offset of the different methods within the ProcString,
118127
// to decompile RPC methods.
119128
@[typedef]
120-
pub struct C.MIDL_SERVER_INFO {
129+
pub struct C.MIDL_SERVER_INFO
130+
{
121131
pStubDesc &C.MIDL_STUB_DESC = unsafe { nil }
122-
DispatchTable &voidptr = unsafe { nil }
123-
ProcString &char = unsafe { nil }
124-
FmtStringOffset &u16 = unsafe { nil }
125-
ThunkTable &voidptr = unsafe { nil }
126-
pTransferSyntax &C.RPC_IF_ID = unsafe { nil }
127-
nCount &u32 = unsafe { nil }
128-
pSyntaxInfo voidptr = unsafe { nil }
132+
DispatchTable &voidptr = unsafe { nil }
133+
ProcString &char = unsafe { nil }
134+
FmtStringOffset &u16 = unsafe { nil }
135+
ThunkTable &voidptr = unsafe { nil }
136+
pTransferSyntax &C.RPC_IF_ID = unsafe { nil }
137+
nCount &u32 = unsafe { nil }
138+
pSyntaxInfo voidptr = unsafe { nil }
129139
}
130140

131141
// C.MIDL_STUB_DESC contains information about an RPC stub. For rpv, mainly the pFormatTypes
@@ -134,7 +144,8 @@ pub struct C.MIDL_SERVER_INFO {
134144
// RPC methods. Moreover, Reserved5 is required for parsing NDR expressions. Actually the
135145
// member is named pExprInfo by Microsoft, but within the mingw libraries it is Reserved5.
136146
@[typedef]
137-
pub struct C.MIDL_STUB_DESC {
147+
pub struct C.MIDL_STUB_DESC
148+
{
138149
RpcInterfaceInformation voidptr = unsafe { nil }
139150
pfnAllocate voidptr = unsafe { nil }
140151
pfnFree voidptr = unsafe { nil }
@@ -146,35 +157,36 @@ pub struct C.MIDL_STUB_DESC {
146157
pFormatTypes &char = unsafe { nil } // mIDA: type_raw
147158
fCheckBounds int
148159
// Ndr library version.
149-
Version u32
150-
pMallocFreeStruct voidptr = unsafe { nil }
151-
MIDLVersion u32
152-
CommFaultOffsets &C.COMM_FAULT_OFFSETS = unsafe { nil }
160+
Version u32
161+
pMallocFreeStruct voidptr = unsafe { nil }
162+
MIDLVersion u32
163+
CommFaultOffsets &C.COMM_FAULT_OFFSETS = unsafe { nil }
153164
// New fields for version 3.0+
154-
aUserMarshalQuadruple voidptr = unsafe { nil }
165+
aUserMarshalQuadruple voidptr = unsafe { nil }
155166
// Notify routines - added for NT5, MIDL 5.0
156-
NotifyRoutineTable voidptr = unsafe { nil }
167+
NotifyRoutineTable voidptr = unsafe { nil }
157168
// Reserved for future use.
158-
mFlags &u32 = unsafe { nil }
169+
mFlags &u32 = unsafe { nil }
159170
// International support routines - added for 64bit post NT5
160-
CsRoutineTables voidptr = unsafe { nil }
161-
Reserved4 voidptr = unsafe { nil }
162-
Reserved5 voidptr = unsafe { nil } // mIDA: expr_table - RpcView: pExprInfo
163-
// Fields up to now present in win2000 release.
171+
CsRoutineTables voidptr = unsafe { nil }
172+
Reserved4 voidptr = unsafe { nil }
173+
Reserved5 voidptr = unsafe { nil } // mIDA: expr_table - RpcView: pExprInfo
164174
}
165175

166176
// NDR_EXPR_DESC is the struct that is pointed to by C.MIDL_STUB_DESC.Reserved5, alias
167177
// pExprInfo. It is used by rpv to parse NDR expressions.
168-
pub struct NDR_EXPR_DESC {
169-
pub:
170-
p_offset voidptr
178+
pub struct NDR_EXPR_DESC
179+
{
180+
pub:
181+
p_offset voidptr
171182
p_format_expr voidptr
172183
}
173184

174185
// C.MIDL_SYNTAX_INFO is a struct that is used within internal RPC struct definitions.
175186
// It is currently not used by rpv.
176187
@[typedef]
177-
pub struct C.MIDL_SYNTAX_INFO {
188+
pub struct C.MIDL_SYNTAX_INFO
189+
{
178190
TransferSyntax C.RPC_SYNTAX_IDENTIFIER
179191
DispatchTable &C.RPC_DISPATCH_TABLE
180192
ProcString &char
@@ -187,47 +199,53 @@ pub struct C.MIDL_SYNTAX_INFO {
187199
// C.MIDL_INTERFACE_METHOD_PROPERTIES is a struct that is used within internal RPC struct definitions.
188200
// It is currently not used by rpv.
189201
@[typedef]
190-
pub struct C.MIDL_INTERFACE_METHOD_PROPERTIES {
202+
pub struct C.MIDL_INTERFACE_METHOD_PROPERTIES
203+
{
191204
MethodCount u16
192205
MethodProperties &C.MIDL_METHOD_PROPERTY_MAP
193206
}
194207

195208
// C.MIDL_METHOD_PROPERTY_MAP is a struct that is used within internal RPC struct definitions.
196209
// It is currently not used by rpv.
197210
@[typedef]
198-
pub struct C.MIDL_METHOD_PROPERTY_MAP {
211+
pub struct C.MIDL_METHOD_PROPERTY_MAP
212+
{
199213
count u32
200214
Properties &C.MIDL_METHOD_PROPERTY
201215
}
202216

203217
// C.MIDL_METHOD_PROPERTY is a struct that is used within internal RPC struct definitions.
204218
// It is currently not used by rpv.
205219
@[typedef]
206-
pub struct C.MIDL_METHOD_PROPERTY {
220+
pub struct C.MIDL_METHOD_PROPERTY
221+
{
207222
Id u32
208223
value usize
209224
}
210225

211226
// C.UUID_VECTOR is a struct that is used within internal RPC struct definitions.
212227
// It is currently not used by rpv.
213228
@[typedef]
214-
pub struct C.UUID_VECTOR {
229+
pub struct C.UUID_VECTOR
230+
{
215231
Count u32
216232
Uuid [1]&C.GUID
217233
}
218234

219235
// C.RPC_SYNTAX_IDENTIFIER is a struct that is used within internal RPC struct definitions.
220236
// It is currently not used by rpv.
221237
@[typedef]
222-
pub struct C.RPC_SYNTAX_IDENTIFIER {
238+
pub struct C.RPC_SYNTAX_IDENTIFIER
239+
{
223240
SyntaxGUID C.GUID
224241
SyntaxVersion C.RPC_VERSION
225242
}
226243

227244
// C.RPC_VERSION is a struct that is used within internal RPC struct definitions.
228245
// It is currently not used by rpv.
229246
@[typedef]
230-
pub struct C.RPC_VERSION {
247+
pub struct C.RPC_VERSION
248+
{
231249
MajorVersion u16
232250
MinorVersion u16
233251
}
@@ -236,7 +254,8 @@ pub struct C.RPC_VERSION {
236254
// This includes for example the utilized security packages and the associated
237255
// principal. rpv uses this struct only to parse the information and makes it
238256
// accessible within the RpcAuthInfo struct.
239-
pub struct RPC_AUTH_INFO {
257+
pub struct RPC_AUTH_INFO
258+
{
240259
pub:
241260
principal &u16 = unsafe { nil }
242261
auth_svc u32
@@ -246,17 +265,20 @@ pub:
246265

247266
pub const max_simple_dict_entries = 0x200
248267
pub const iid_iunknown = win.new_guid('00000000-0000-0000-C000-000000000046') or { panic(err) }
249-
pub const dce_transfer_syntax = C.RPC_IF_ID{
268+
pub const dce_transfer_syntax = C.RPC_IF_ID
269+
{
250270
Uuid: win.new_guid('8A885D04-1CEB-11C9-9FE8-08002B104860') or { panic(err) }
251271
VersMajor: 2
252272
VersMinor: 0
253273
}
254-
pub const ndr64_transfer_syntax = C.RPC_IF_ID{
274+
pub const ndr64_transfer_syntax = C.RPC_IF_ID
275+
{
255276
Uuid: win.new_guid('71710533-BEBA-4937-8319-B5DBEF9CCC36') or { panic(err) }
256277
VersMajor: 2
257278
VersMinor: 0
258279
}
259-
pub const ior_callback = C.RPC_IF_ID{
280+
pub const ior_callback = C.RPC_IF_ID
281+
{
260282
Uuid: win.new_guid('18f70770-8e64-11cf-9af1-0020AF6E72F4') or { panic(err) }
261283
VersMajor: 0
262284
VersMinor: 0

internals/rpc-internal-structs.v

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ pub const compatible_rpc_versions = [
8383
// available in future. Up to this point, we need to keep the x64 and x86
8484
// struct definitions in separate files.
8585
@[if x64]
86-
pub struct RpcInterface {
86+
pub struct RpcInterface
87+
{
8788
pub:
8889
p_rpc_server &RpcServer = unsafe { nil }
8990
flags u32
@@ -124,7 +125,8 @@ pub:
124125
// available in future. Up to this point, we need to keep the x64 and x86
125126
// struct definitions in separate files.
126127
@[if x64]
127-
pub struct RpcServer {
128+
pub struct RpcServer
129+
{
128130
pub:
129131
mutex Mutex
130132
is_listening1 u32
@@ -168,7 +170,8 @@ pub:
168170
// available in future. Up to this point, we need to keep the x64 and x86
169171
// struct definitions in separate files.
170172
@[if x64]
171-
pub struct RpcAddress {
173+
pub struct RpcAddress
174+
{
172175
pub:
173176
vtable voidptr
174177
magic u32

0 commit comments

Comments
 (0)