Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

Dynamic API Call With Dynamic Delegates

You Dont Need Apis
Pure Reflection
Code
public static object DynamicInvoke(string Dll, string Name, object[] Param, Type Ret)
      {
      List<Type> Types = new List<Type>();
      for (int i = 0; i <= Param.Length - 1; i++)
            Types.Add(Param[i].GetType());
      AssemblyBuilder A = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName("DI"), AssemblyBuilderAccess.Run);
      ModuleBuilder M = A.DefineDynamicModule("MB");
      MethodBuilder MB = M.DefinePInvokeMethod(Name, Dll, MethodAttributes.Public | MethodAttributes.Static | MethodAttributes.PinvokeImpl, CallingConventions.Standard, Ret, Types.ToArray(), CallingConvention.Winapi, CharSet.Ansi);
      MB.SetImplementationFlags(MethodImplAttributes.PreserveSig);
      M.CreateGlobalFunctions();
      return M.GetMethod(Name).Invoke(null, Param);
      }
if this ur point ok but its been posted as well from what i remember


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by skinnypete2Apr 28, 2022 09:45 PM 6 211 Apr 28, 2022 09:45 PM
Last Post: Crackist
[Python] by TilcayoMar 16, 2020 04:20 AM 2 127 Mar 16, 2020 04:20 AM
Last Post: Tilcayo
[C#] by gigajewMar 5, 2020 08:36 PM 3 459 Mar 5, 2020 08:36 PM
Last Post: gigajew