All 5 phases of the open-source Decal rebuild: Phase 1: 14 decompiled .NET projects (Interop.*, Adapter, FileService, DecalUtil) Phase 2: 10 native DLLs rewritten as C# COM servers with matching GUIDs - DecalDat, DHS, SpellFilter, DecalInput, DecalNet, DecalFilters - Decal.Core, DecalControls, DecalRender, D3DService Phase 3: C++ shims for Inject.DLL (D3D9 hooking) and LauncherHook.DLL Phase 4: DenAgent WinForms tray application Phase 5: WiX installer and build script 25 C# projects building with 0 errors. Native C++ projects require VS 2022 + Windows SDK (x86). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
106 lines
2.2 KiB
C++
106 lines
2.2 KiB
C++
// ProtocolStack.h
|
|
// Declaration of class cProtocolStack
|
|
|
|
#ifndef __PROTOCOLSTACK_H
|
|
#define __PROTOCOLSTACK_H
|
|
|
|
#include "ACMessage.h"
|
|
|
|
#define DEFAULT_HEADER_SIZE 16
|
|
#define FRAGMENT_SIZE 448
|
|
|
|
#pragma pack( push, 1 )
|
|
// The packet header
|
|
struct cPacketHeader
|
|
{
|
|
DWORD m_dwSequence;
|
|
DWORD m_dwFlags;
|
|
DWORD m_dwCRC;
|
|
|
|
WORD m_wUnk1;
|
|
WORD m_wUnk2;
|
|
WORD m_wTotalSize;
|
|
WORD m_wUnk3;
|
|
};
|
|
#pragma pack( pop )
|
|
|
|
class cMessageStack
|
|
{
|
|
public:
|
|
#pragma pack( push, 1 )
|
|
struct cMessageHeader
|
|
{
|
|
DWORD m_dwSequence;
|
|
DWORD m_dwObjectID;
|
|
WORD m_wFragmentCount;
|
|
WORD m_wFragmentLength;
|
|
WORD m_wFragmentIndex,
|
|
m_wUnknown1;
|
|
};
|
|
#pragma pack( pop )
|
|
|
|
class cProtocolMessage : public ACMessage
|
|
{
|
|
protected:
|
|
mutable BYTE *m_pbData;
|
|
mutable bool *m_pbReceived;
|
|
mutable bool m_bOwn;
|
|
|
|
public:
|
|
cProtocolMessage( BYTE *pbData );
|
|
cProtocolMessage( const cProtocolMessage &msg );
|
|
~cProtocolMessage();
|
|
|
|
cMessageHeader *getMessageHeader() const
|
|
{
|
|
return reinterpret_cast< cMessageHeader * >( m_pbData );
|
|
}
|
|
|
|
cProtocolMessage &operator= ( const cProtocolMessage &msg );
|
|
|
|
// ACMessage interface implementation for protocol stack
|
|
virtual BYTE *getData ()
|
|
{
|
|
return m_pbData + sizeof( cMessageHeader );
|
|
}
|
|
|
|
virtual DWORD getSize ()
|
|
{
|
|
return getMessageHeader()->m_wFragmentLength - sizeof( cMessageHeader );
|
|
}
|
|
|
|
virtual DWORD getType ()
|
|
{
|
|
return *reinterpret_cast< DWORD * >( m_pbData + sizeof( cMessageHeader ) );
|
|
}
|
|
|
|
bool isComplete() const;
|
|
|
|
bool fragmentMatch( BYTE *pFragmentStart );
|
|
void insertFragment( BYTE *pFragmentStart );
|
|
|
|
static DWORD calcMessageLength( BYTE *pbHeader );
|
|
};
|
|
|
|
private:
|
|
typedef std::list< cProtocolMessage > cMessageList;
|
|
|
|
ACMessageSink *m_pCallback;
|
|
cMessageList m_messages;
|
|
|
|
public:
|
|
cMessageStack();
|
|
~cMessageStack();
|
|
|
|
void start( ACMessageSink * );
|
|
void stop();
|
|
|
|
void processPacket( DWORD dwLength, BYTE *pbPayload );
|
|
void processPacketOut( DWORD dwLength, const BYTE *pbPayload );
|
|
|
|
private:
|
|
void splitPacket( DWORD dwLength, BYTE *pbPayload );
|
|
void splitPacketOut( DWORD dwLength, const BYTE *pbPayload );
|
|
};
|
|
|
|
#endif
|