Initial commit: Complete open-source Decal rebuild
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>
This commit is contained in:
commit
d1442e3747
1382 changed files with 170725 additions and 0 deletions
10
Managed/Decal.DecalNet/Decal.DecalNet.csproj
Normal file
10
Managed/Decal.DecalNet/Decal.DecalNet.csproj
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<AssemblyName>Decal.DecalNet</AssemblyName>
|
||||
<RootNamespace>Decal.DecalNet</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Decal.Interop.Core\Decal.Interop.Core.csproj" />
|
||||
<ProjectReference Include="..\Decal.Interop.Net\Decal.Interop.Net.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
45
Managed/Decal.DecalNet/MessageImpl.cs
Normal file
45
Managed/Decal.DecalNet/MessageImpl.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Decal.Interop.Net;
|
||||
|
||||
namespace Decal.DecalNet
|
||||
{
|
||||
[ComVisible(true)]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
public class MessageImpl : IMessage2
|
||||
{
|
||||
private readonly byte[] _rawData;
|
||||
private readonly int _type;
|
||||
private readonly bool _outgoing;
|
||||
|
||||
public MessageImpl(byte[] rawData, bool outgoing)
|
||||
{
|
||||
_rawData = rawData ?? Array.Empty<byte>();
|
||||
_outgoing = outgoing;
|
||||
|
||||
// Message type is the first DWORD in the raw data
|
||||
if (_rawData.Length >= 4)
|
||||
_type = BitConverter.ToInt32(_rawData, 0);
|
||||
}
|
||||
|
||||
public int Type => _type;
|
||||
|
||||
public byte[] RawData => _rawData;
|
||||
|
||||
// Parameterized property - Value takes an index via IDispatch
|
||||
public object Value => null;
|
||||
|
||||
// Parameterized property - Struct takes an index via IDispatch
|
||||
public IMessageMember Struct => null;
|
||||
|
||||
// Parameterized property
|
||||
public byte[] RawValue => _rawData;
|
||||
|
||||
// Parameterized property
|
||||
public string FieldName => string.Empty;
|
||||
|
||||
public int Count => 0;
|
||||
|
||||
public MessageRoot Begin => null;
|
||||
}
|
||||
}
|
||||
100
Managed/Decal.DecalNet/NetServiceImpl.cs
Normal file
100
Managed/Decal.DecalNet/NetServiceImpl.cs
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using Decal.Interop.Core;
|
||||
using Decal.Interop.Net;
|
||||
|
||||
namespace Decal.DecalNet
|
||||
{
|
||||
[ComVisible(true)]
|
||||
[Guid("C8C406F8-BA2E-4964-8B04-FF38394A8E0E")]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
[ProgId("DecalNet.NetService")]
|
||||
public class NetServiceImpl : INetService, IDecalService
|
||||
{
|
||||
internal static NetServiceImpl Instance { get; private set; }
|
||||
|
||||
private IDecalCore _decalCore;
|
||||
private readonly List<INetworkFilter2> _filters = new List<INetworkFilter2>();
|
||||
|
||||
public DecalCore Decal => (DecalCore)_decalCore;
|
||||
|
||||
// Returns the network filter (V2 interface) if available
|
||||
public object Filter => _filters.Count > 0 ? _filters[0] : null;
|
||||
|
||||
// Returns filter via IDispatch for VB compatibility
|
||||
public object FilterVB => Filter;
|
||||
|
||||
public ACHooks Hooks => _decalCore?.Hooks;
|
||||
|
||||
// IDecalService
|
||||
public void Initialize(DecalCore pDecal)
|
||||
{
|
||||
_decalCore = (IDecalCore)pDecal;
|
||||
Instance = this;
|
||||
|
||||
// In native code: hooks recvfrom/sendto from wsock32.dll
|
||||
// Network hooking in C# will use the same approach via P/Invoke
|
||||
// or be handled by the native Inject.DLL shim
|
||||
}
|
||||
|
||||
public void BeforePlugins()
|
||||
{
|
||||
// Load V1 network filters from registry
|
||||
}
|
||||
|
||||
public void AfterPlugins()
|
||||
{
|
||||
// Remove V1 filters (after plugins had a chance to upgrade to V2)
|
||||
}
|
||||
|
||||
public void Terminate()
|
||||
{
|
||||
// Terminate all filters
|
||||
foreach (var filter in _filters)
|
||||
{
|
||||
try { filter.Terminate(); } catch { }
|
||||
}
|
||||
_filters.Clear();
|
||||
_decalCore = null;
|
||||
|
||||
if (Instance == this)
|
||||
Instance = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register a V2 network filter.
|
||||
/// </summary>
|
||||
internal void RegisterFilter(INetworkFilter2 filter)
|
||||
{
|
||||
_filters.Add(filter);
|
||||
filter.Initialize((NetService)(object)this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispatch a server-to-client message to all filters.
|
||||
/// Called from the network hook when a packet is received.
|
||||
/// </summary>
|
||||
internal void DispatchServerMessage(byte[] data)
|
||||
{
|
||||
var msg = new MessageImpl(data, false);
|
||||
foreach (var filter in _filters)
|
||||
{
|
||||
try { filter.DispatchServer((IMessage2)msg); } catch { }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispatch a client-to-server message to all filters.
|
||||
/// Called from the network hook when a packet is sent.
|
||||
/// </summary>
|
||||
internal void DispatchClientMessage(byte[] data)
|
||||
{
|
||||
var msg = new MessageImpl(data, true);
|
||||
foreach (var filter in _filters)
|
||||
{
|
||||
try { filter.DispatchClient((IMessage2)msg); } catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
74
Managed/Decal.DecalNet/WebRequestImpl.cs
Normal file
74
Managed/Decal.DecalNet/WebRequestImpl.cs
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
using System;
|
||||
using System.Net;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using Decal.Interop.Net;
|
||||
|
||||
namespace Decal.DecalNet
|
||||
{
|
||||
[ComVisible(true)]
|
||||
[Guid("15631E36-55CB-4D16-ADE7-74D9F8A5F4B6")]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
[ComSourceInterfaces(typeof(IWebRequestEvents))]
|
||||
[ProgId("DecalNet.WebRequest")]
|
||||
public class WebRequestImpl : IWebRequest
|
||||
{
|
||||
public event IWebRequestEvents_BeginEventHandler Begin;
|
||||
public event IWebRequestEvents_EndEventHandler End;
|
||||
|
||||
public void Get(string strURL)
|
||||
{
|
||||
Begin?.Invoke();
|
||||
ThreadPool.QueueUserWorkItem(_ =>
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var client = new WebClient())
|
||||
{
|
||||
string result = client.DownloadString(strURL);
|
||||
End?.Invoke(200, result);
|
||||
}
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
int code = 0;
|
||||
if (ex.Response is HttpWebResponse resp)
|
||||
code = (int)resp.StatusCode;
|
||||
End?.Invoke(code, ex.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
End?.Invoke(0, ex.Message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void Post(string strURL, string strPostData)
|
||||
{
|
||||
Begin?.Invoke();
|
||||
ThreadPool.QueueUserWorkItem(_ =>
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var client = new WebClient())
|
||||
{
|
||||
client.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
|
||||
string result = client.UploadString(strURL, strPostData);
|
||||
End?.Invoke(200, result);
|
||||
}
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
int code = 0;
|
||||
if (ex.Response is HttpWebResponse resp)
|
||||
code = (int)resp.StatusCode;
|
||||
End?.Invoke(code, ex.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
End?.Invoke(0, ex.Message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue