private int GetProp(IBaseClientDLL.RecvTable *RecvTable, string PropName, IBaseClientDLL.RecvProp **Prop) { int ExtraOffset = 0; for (int Index = 0; Index < RecvTable->propCount; Index++) { IBaseClientDLL.RecvProp * RecvProp = &RecvTable->props[Index]; IBaseClientDLL.RecvTable *Child = RecvProp->dataTable; if (Child != null && (Child->propCount > 0)) { int Temp = GetProp(Child, PropName, Prop); if (Temp != 0) { ExtraOffset += RecvProp->offset + Temp; } } if (Marshal.PtrToStringAnsi((IntPtr)RecvProp->name) != PropName) { continue; } if (Prop != null) { *Prop = RecvProp; } return(RecvProp->offset + ExtraOffset); } return(ExtraOffset); }
public void HookProp <T>(string TableName, string PropName, T Funct, ref uint OldPtr) { IBaseClientDLL.RecvProp *Prop = (IBaseClientDLL.RecvProp *) 0; GetProp(TableName, PropName, &Prop); if (Prop == null) { return; } OldPtr = (uint)Prop->proxy; Prop->proxy = Marshal.GetFunctionPointerForDelegate(Funct).ToPointer(); }