Skip to content
This repository was archived by the owner on Dec 11, 2024. It is now read-only.

Commit 067ca1e

Browse files
committed
Added initial implementation of the network module.
Added binary serialization classes.
1 parent 3ff7254 commit 067ca1e

File tree

15 files changed

+1345
-0
lines changed

15 files changed

+1345
-0
lines changed

Source/Private/Core/COM_Common.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,15 @@ inline namespace Proxy
240240
return ComInstance;
241241
}
242242

243+
// -=(Undocumented)=-
244+
template<typename Base, typename Wrapper>
245+
static CComObjectStackEx<Base> CCreateStack(Wrapper Instance)
246+
{
247+
CComObjectStackEx<Base> ComInstance;
248+
ComInstance.Internal_Reset(Instance);
249+
return ComInstance;
250+
}
251+
243252
// -=(Undocumented)=-
244253
template<typename Base, typename Class>
245254
static auto CCast(Class Instance)
Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
2+
// Copyright (C) 2021-2024 by Agustin Alvarez. All rights reserved.
3+
//
4+
// This work is licensed under the terms of the MIT license.
5+
//
6+
// For a copy, see <https://opensource.org/licenses/MIT>.
7+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
8+
9+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
10+
// [ HEADER ]
11+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
12+
13+
#include "COM_Reader.hpp"
14+
15+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
16+
// [ CODE ]
17+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
18+
19+
inline namespace COM
20+
{
21+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
22+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
23+
24+
HRESULT BinaryReader::SetData(SAFEARRAY ** Result)
25+
{
26+
mWrapper = Core::Reader(VBSafeArrayToSpan<UInt08>(Result));
27+
return S_OK;
28+
}
29+
30+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
31+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
32+
33+
HRESULT BinaryReader::GetData(SAFEARRAY ** Result)
34+
{
35+
VBSpanToSafeArrayTemp(mWrapper.GetData(), Result);
36+
return S_OK;
37+
}
38+
39+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
40+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
41+
42+
HRESULT BinaryReader::GetCapacity(vbInt32 * Result)
43+
{
44+
(* Result) = mWrapper.GetCapacity();
45+
return S_OK;
46+
}
47+
48+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
49+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
50+
51+
HRESULT BinaryReader::GetOffset(vbInt32 * Result)
52+
{
53+
(* Result) = mWrapper.GetOffset();
54+
return S_OK;
55+
}
56+
57+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
58+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
59+
60+
HRESULT BinaryReader::GetAvailable(vbInt32 * Result)
61+
{
62+
(* Result) = mWrapper.GetAvailable();
63+
return S_OK;
64+
}
65+
66+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
67+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
68+
69+
HRESULT BinaryReader::Skip(vbInt32 Length)
70+
{
71+
mWrapper.Skip(Length);
72+
return S_OK;
73+
}
74+
75+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
76+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
77+
78+
HRESULT BinaryReader::Read(vbAny Address, vbInt32 Length)
79+
{
80+
FastCopyMemory(mWrapper.Read<Ptr<UInt08>>(Length), Address, Length);
81+
return S_OK;
82+
}
83+
84+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
85+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
86+
87+
HRESULT BinaryReader::ReadBool(vbBool * Result)
88+
{
89+
(* Result) = (mWrapper.ReadBool() ? VBTrue : VBFalse);
90+
return S_OK;
91+
}
92+
93+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
94+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
95+
96+
HRESULT BinaryReader::ReadInt(vbInt32 * Result)
97+
{
98+
(* Result) = mWrapper.ReadInt<vbInt32>();
99+
return S_OK;
100+
}
101+
102+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
103+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
104+
105+
HRESULT BinaryReader::ReadInt8(vbInt8 * Result)
106+
{
107+
(* Result) = mWrapper.ReadInt8();
108+
return S_OK;
109+
}
110+
111+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
112+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
113+
114+
HRESULT BinaryReader::ReadInt16(vbInt16 * Result)
115+
{
116+
(* Result) = mWrapper.ReadInt16();
117+
return S_OK;
118+
}
119+
120+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
121+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
122+
123+
HRESULT BinaryReader::ReadInt32(vbInt32 * Result)
124+
{
125+
(* Result) = mWrapper.ReadInt32();
126+
return S_OK;
127+
}
128+
129+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
130+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
131+
132+
HRESULT BinaryReader::ReadInt64(vbInt64 * Result)
133+
{
134+
(* Result).vt = VT_I8;
135+
(* Result).llVal = mWrapper.ReadInt64();
136+
return S_OK;
137+
}
138+
139+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
140+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
141+
142+
HRESULT BinaryReader::ReadReal32(vbReal32 * Result)
143+
{
144+
(* Result) = mWrapper.ReadReal32();
145+
return S_OK;
146+
}
147+
148+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
149+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
150+
151+
HRESULT BinaryReader::ReadReal64(vbReal64 * Result)
152+
{
153+
(* Result) = mWrapper.ReadReal64();
154+
return S_OK;
155+
}
156+
157+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
158+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
159+
160+
HRESULT BinaryReader::ReadString8(vbStr16 * Result)
161+
{
162+
(* Result) = VBString8ToString16(mWrapper.ReadString8());
163+
return S_OK;
164+
}
165+
166+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
167+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
168+
169+
HRESULT BinaryReader::ReadString16(vbStr16 * Result)
170+
{
171+
const CStr16 Pointer = mWrapper.ReadString16();
172+
(* Result) = ::SysAllocStringLen(reinterpret_cast<Ptr<const OLECHAR>>(Pointer.data()), Pointer.size());
173+
return S_OK;
174+
}
175+
176+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
177+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
178+
179+
HRESULT BinaryReader::ReadSafeArrayInt8(SAFEARRAY ** Value)
180+
{
181+
return ReadSafeArray(Value, VT_I1, sizeof(vbInt8));
182+
}
183+
184+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
185+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
186+
187+
HRESULT BinaryReader::ReadSafeArrayInt16(SAFEARRAY ** Value)
188+
{
189+
return ReadSafeArray(Value, VT_I2, sizeof(vbInt16));
190+
}
191+
192+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
193+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
194+
195+
HRESULT BinaryReader::ReadSafeArrayInt32(SAFEARRAY ** Value)
196+
{
197+
return ReadSafeArray(Value, VT_I4, sizeof(vbInt32));
198+
}
199+
200+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
201+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
202+
203+
HRESULT BinaryReader::ReadSafeArrayInt64(SAFEARRAY ** Value)
204+
{
205+
return ReadSafeArray(Value, VT_I8, sizeof(vbInt64));
206+
}
207+
208+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
209+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
210+
211+
HRESULT BinaryReader::ReadSafeArrayReal32(SAFEARRAY ** Value)
212+
{
213+
return ReadSafeArray(Value, VT_R4, sizeof(vbReal32));
214+
}
215+
216+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
217+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
218+
219+
HRESULT BinaryReader::ReadSafeArrayReal64(SAFEARRAY ** Value)
220+
{
221+
return ReadSafeArray(Value, VT_R8, sizeof(vbReal64));
222+
}
223+
224+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
225+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
226+
227+
HRESULT BinaryReader::ReadSafeArray(SAFEARRAY ** Value, VARTYPE Type, UInt32 Element)
228+
{
229+
UInt32 Dimension = mWrapper.ReadInt<UInt32>();
230+
UInt32 Quantity = 1;
231+
232+
Vector<SAFEARRAYBOUND> Bounds;
233+
Bounds.resize(Dimension);
234+
235+
for (SInt32 Index = Dimension - 1; Index >= 0; --Index)
236+
{
237+
const UInt32 Lower = mWrapper.ReadInt<UInt32>();
238+
const UInt32 Count = mWrapper.ReadInt<UInt32>();
239+
240+
Quantity *= Count;
241+
242+
Bounds[Index].lLbound = Lower;
243+
Bounds[Index].cElements = Count;
244+
}
245+
246+
(* Value) = ::SafeArrayCreate(Type, Dimension, Bounds.data());
247+
248+
FastCopyMemory((* Value)->pvData, mWrapper.Read<UInt08 *>(Quantity * Element), Quantity * Element);
249+
250+
return S_OK;
251+
}
252+
}

0 commit comments

Comments
 (0)