Skip to content

Instantly share code, notes, and snippets.

@xcvd
Created June 14, 2012 10:21
Show Gist options
  • Save xcvd/2929459 to your computer and use it in GitHub Desktop.
Save xcvd/2929459 to your computer and use it in GitHub Desktop.
COutPacket functions in C# ready to be hooked
namespace Polar.MapleFunctions
{
using System;
using System.Runtime.InteropServices;
using Polar.Util;
public class COutPacket
{
public static readonly FunctionInfo[] FunctionInfo = new[]
{
new FunctionInfo
{
ArrayOfBytes = "56 8B F1 8B 46 ?? 57 8D 7E ?? 85 C0",
Offset = 0,
Name = "COutPacket::Encode1",
Target = Encode1,
TargetType = typeof(DEncode1)
},
new FunctionInfo
{
ArrayOfBytes = "56 8B F1 8B 46 ?? 57 8D 7E ?? 85 C0 74 ?? 8B 40 ?? 8B 4E ?? 83 C1 ??",
Offset = 0,
Name = "COutPacket::Encode2",
Target = Encode2,
TargetType = typeof(DEncode2)
},
new FunctionInfo
{
ArrayOfBytes = "56 8B F1 8B 46 ?? 57 8D 7E ?? 85 C0 74 ?? 8B 40 ?? 8B 4E ?? 83 C1 ?? 3B C8",
Offset = 0,
Name = "COutPacket::Encode4",
Target = Encode4,
TargetType = typeof(DEncode4)
},
new FunctionInfo
{
ArrayOfBytes = "53 56 8B F1 8B 46 ?? 57 8D 7E ?? 85 C0",
Offset = 0,
Name = "COutPacket::EncodeBuffer",
Target = EncodeBuffer,
TargetType = typeof(DEncodeBuffer)
},
new FunctionInfo
{
ArrayOfBytes = "8B 17 03 56 ?? 8D 44 24 ?? 52 51",
Offset = 0x75,
Name = "COutPacket::EncodeString",
Target = EncodeString,
TargetType = typeof(DEncodeString)
},
new FunctionInfo
{
ArrayOfBytes =
"68 ?? ?? ?? ?? C7 01 ?? ?? ?? ?? E8 ?? ?? ?? ?? 8B 4C 24 ?? 51",
Offset = 0x30,
Name = "COutPacket::Init",
Target = Init,
TargetType = typeof(DInit)
}
};
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
public delegate void DEncode1(IntPtr @this, [In] byte value);
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
public delegate void DEncode2(IntPtr @this, [In] ushort value);
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
public delegate void DEncode4(IntPtr @this, [In] uint value);
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
public delegate void DEncodeBuffer(
IntPtr @this,
[In] [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] byte[] buffer,
[In] uint size);
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
public delegate void DEncodeString(
IntPtr @this, [In] [MarshalAs(UnmanagedType.LPStr)] string value);
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
public delegate void DInit(IntPtr @this, [In] int type, [In] int loopback);
public static DEncode1 Encode1 { get; set; }
public static DEncode2 Encode2 { get; set; }
public static DEncode4 Encode4 { get; set; }
public static DEncodeBuffer EncodeBuffer { get; set; }
public static DEncodeString EncodeString { get; set; }
public static DInit Init { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment