modified: pixi.toml
[GalaxyCodeBases.git] / etc / Windows / vlmcsd_old_vancepym / rpc.h
blob86792cb36ae5b18d98fb0f31ce7520744abe4bfb
1 #ifndef __rpc_h
2 #define __rpc_h
4 #ifndef CONFIG
5 #define CONFIG "config.h"
6 #endif // CONFIG
7 #include CONFIG
9 #include "types.h"
11 typedef struct {
12 BYTE VersionMajor;
13 BYTE VersionMinor;
14 BYTE PacketType;
15 BYTE PacketFlags;
16 DWORD DataRepresentation;
17 WORD FragLength;
18 WORD AuthLength;
19 DWORD CallId;
20 } /*__packed*/ RPC_HEADER;
23 typedef struct {
24 WORD MaxXmitFrag;
25 WORD MaxRecvFrag;
26 DWORD AssocGroup;
27 DWORD NumCtxItems;
28 struct {
29 WORD ContextId;
30 WORD NumTransItems;
31 GUID InterfaceUUID;
32 WORD InterfaceVerMajor;
33 WORD InterfaceVerMinor;
34 GUID TransferSyntax;
35 DWORD SyntaxVersion;
36 } CtxItems[1];
37 } /*__packed*/ RPC_BIND_REQUEST;
39 typedef struct {
40 WORD MaxXmitFrag;
41 WORD MaxRecvFrag;
42 DWORD AssocGroup;
43 WORD SecondaryAddressLength;
44 BYTE SecondaryAddress[6];
45 DWORD NumResults;
46 struct {
47 WORD AckResult;
48 WORD AckReason;
49 GUID TransferSyntax;
50 DWORD SyntaxVersion;
51 } Results[0];
52 } /*__packed*/ RPC_BIND_RESPONSE;
55 typedef struct {
56 DWORD AllocHint;
57 WORD ContextId;
58 WORD Opnum;
59 struct {
60 DWORD DataLength;
61 DWORD DataSizeIs;
62 } Ndr;
63 BYTE Data[0];
64 } /*__packed*/ RPC_REQUEST;
66 typedef struct {
67 DWORD AllocHint;
68 WORD ContextId;
69 BYTE CancelCount;
70 BYTE Pad1;
71 struct {
72 DWORD DataLength;
73 DWORD DataSizeIs1;
74 DWORD DataSizeIs2;
75 } Ndr;
76 BYTE Data[0];
77 } /*__packed*/ RPC_RESPONSE;
79 typedef struct {
80 DWORD AllocHint;
81 WORD ContextId;
82 WORD Opnum;
83 union {
84 struct {
85 DWORD DataLength;
86 DWORD DataSizeIs;
87 BYTE Data[0];
88 } Ndr;
89 struct {
90 uint64_t DataLength;
91 uint64_t DataSizeIs;
92 BYTE Data[0];
93 } Ndr64;
95 } /*__packed*/ RPC_REQUEST64;
97 typedef struct {
98 DWORD AllocHint;
99 WORD ContextId;
100 BYTE CancelCount;
101 BYTE Pad1;
102 union {
103 struct {
104 DWORD DataLength;
105 DWORD DataSizeMax;
106 union
108 DWORD DataSizeIs;
109 DWORD status;
111 BYTE Data[0];
112 } Ndr;
113 struct {
114 uint64_t DataLength;
115 uint64_t DataSizeMax;
116 union
118 uint64_t DataSizeIs;
119 DWORD status;
121 BYTE Data[0];
122 } Ndr64;
124 } /*__packed*/ RPC_RESPONSE64;
127 typedef SOCKET RpcCtx;
128 typedef int RpcStatus;
130 #define INVALID_NDR_CTX ((WORD)~0)
132 #define RPC_BIND_ACCEPT (0)
133 #define RPC_BIND_NACK (LE16(2))
134 #define RPC_BIND_ACK (LE16(3))
136 #define RPC_SYNTAX_UNSUPPORTED (LE16(2))
137 #define RPC_ABSTRACTSYNTAX_UNSUPPORTED (LE16(1))
139 #define RPC_BTFN_SEC_CONTEXT_MULTIPLEX (LE16(1))
140 #define RPC_BTFN_KEEP_ORPHAN (LE16(2))
142 #define INVALID_RPCCTX INVALID_SOCKET
143 #define closeRpc socketclose
145 #define RPC_PT_REQUEST 0
146 #define RPC_PT_RESPONSE 2
147 #define RPC_PT_BIND_REQ 11
148 #define RPC_PT_BIND_ACK 12
149 #define RPC_PT_ALTERCONTEXT_REQ 14
150 #define RPC_PT_ALTERCONTEXT_ACK 15
152 #define RPC_PF_FIRST 1
153 #define RPC_PF_LAST 2
154 #define RPC_PF_CANCEL_PENDING 4
155 #define RPC_PF_RESERVED 8
156 #define RPC_PF_MULTIPLEX 16
157 #define RPC_PF_NOT_EXEC 32
158 #define RPC_PF_MAYBE 64
159 #define RPC_PF_OBJECT 128
161 typedef union _RPC_FLAGS
163 DWORD mask;
164 struct {
165 uint32_t FlagsBTFN : 16;
166 BOOL HasNDR32 : 1;
167 BOOL HasNDR64 : 1;
168 BOOL HasBTFN : 1;
170 } RPC_FLAGS, *PRPC_FLAGS;
172 extern RPC_FLAGS RpcFlags;
174 void rpcServer(const RpcCtx socket, const DWORD RpcAssocGroup, const char* const ipstr);
175 RpcStatus rpcBindClient(const RpcCtx sock, const int_fast8_t verbose);
176 RpcStatus rpcSendRequest(const RpcCtx socket, const BYTE *const KmsRequest, const size_t requestSize, BYTE **KmsResponse, size_t *const responseSize);
178 #endif // __rpc_h