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

Commit eabfe72

Browse files
committed
Updated to latest Aurora.Engine.
Fixed not being able to copy a network client on the attach callback.
1 parent 911d471 commit eabfe72

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

Source/Private/Network/COM_Client.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ inline namespace COM
5959

6060
HRESULT Network_Client::Write(BinaryWriter_ * Message)
6161
{
62-
mWrapper->Write<UInt08>(CCast<BinaryWriter>(Message).GetData());
62+
CPtr<const UInt08> Data = CCast<BinaryWriter>(Message).GetData();
63+
mWrapper->Write(Data);
6364
return S_OK;
6465
}
6566

Source/Private/Network/COM_Protocol.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ inline namespace COM
4848

4949
void VB6_Network_Protocol::OnAttach(ConstSPtr<class Network::Client> Session)
5050
{
51+
using Declaration = void (STDAPICALLTYPE *)(CComObject<Network_Client> *);
52+
5153
if (mOnAttach)
5254
{
53-
CComObjectStackEx<Network_Client> CComClient = CCreateStack<Network_Client>(Session);
54-
55-
((void (STDAPICALLTYPE *)(CComObjectStackEx<Network_Client> *)) mOnAttach)(& CComClient);
55+
CComObject<Network_Client> * CComClient = CCreate<Network_Client>(Session);
56+
reinterpret_cast<Declaration>(mOnAttach)(CComClient);
5657
}
5758
}
5859

@@ -61,11 +62,12 @@ inline namespace COM
6162

6263
void VB6_Network_Protocol::OnDetach(ConstSPtr<class Network::Client> Session)
6364
{
65+
using Declaration = void (STDAPICALLTYPE *)(CComObjectStackEx<Network_Client> *);
66+
6467
if (mOnDetach)
6568
{
6669
CComObjectStackEx<Network_Client> CComClient = CCreateStack<Network_Client>(Session);
67-
68-
((void (STDAPICALLTYPE *)(CComObjectStackEx<Network_Client> *)) mOnDetach)(& CComClient);
70+
reinterpret_cast<Declaration>(mOnDetach)(& CComClient);
6971
}
7072
}
7173

@@ -74,12 +76,12 @@ inline namespace COM
7476

7577
void VB6_Network_Protocol::OnError(ConstSPtr<class Network::Client> Session, UInt Error, CStr Description)
7678
{
79+
using Declaration = void (STDAPICALLTYPE *)(CComObjectStackEx<Network_Client> *, vbInt32, vbStr16);
80+
7781
if (mOnError)
7882
{
7983
CComObjectStackEx<Network_Client> CComClient = CCreateStack<Network_Client>(Session);
80-
81-
((void (STDAPICALLTYPE *)(
82-
CComObjectStackEx<Network_Client> *, vbInt32, vbStr16)) mOnRead)(& CComClient, Error, VBString8ToString16(Description));
84+
reinterpret_cast<Declaration>(mOnError)(& CComClient, Error, VBString8ToString16(Description));
8385
}
8486
}
8587

@@ -88,14 +90,13 @@ inline namespace COM
8890

8991
void VB6_Network_Protocol::OnRead(ConstSPtr<class Network::Client> Session, CPtr<UInt08> Bytes)
9092
{
93+
using Declaration = void (STDAPICALLTYPE *)(CComObjectStackEx<Network_Client> *, CComObjectStackEx<BinaryReader> *);
94+
9195
if (mOnRead)
9296
{
9397
CComObjectStackEx<Network_Client> CComClient = CCreateStack<Network_Client>(Session);
9498
CComObjectStackEx<BinaryReader> CComReader = CCreateStack<BinaryReader>(Reader(Bytes));
95-
96-
((void (STDAPICALLTYPE *)(
97-
CComObjectStackEx<Network_Client> *,
98-
CComObjectStackEx<BinaryReader> *)) mOnRead)(& CComClient, & CComReader);
99+
reinterpret_cast<Declaration>(mOnRead)(& CComClient, & CComReader);
99100
}
100101
}
101102

@@ -104,14 +105,13 @@ inline namespace COM
104105

105106
void VB6_Network_Protocol::OnWrite(ConstSPtr<class Network::Client> Session, CPtr<UInt08> Bytes)
106107
{
108+
using Declaration = void (STDAPICALLTYPE *)(CComObjectStackEx<Network_Client> *, CComObjectStackEx<BinaryReader> *);
109+
107110
if (mOnWrite)
108111
{
109112
CComObjectStackEx<Network_Client> CComClient = CCreateStack<Network_Client>(Session);
110113
CComObjectStackEx<BinaryReader> CComReader = CCreateStack<BinaryReader>(Reader(Bytes));
111-
112-
((void (STDAPICALLTYPE *)(
113-
CComObjectStackEx<Network_Client> *,
114-
CComObjectStackEx<BinaryReader> *)) mOnWrite)(& CComClient, & CComReader);
114+
reinterpret_cast<Declaration>(mOnWrite)(& CComClient, & CComReader);
115115
}
116116
}
117117

0 commit comments

Comments
 (0)