/// <summary> /// Call any API C function (STDCALL and/or CDECL) /// </summary> /// <param name="DllName">Name of the DLL where the FuncName exists</param> /// <param name="FuncName">Name of the very function to invoke</param> /// <param name="FuncParameters">Parameters given to FuncName</param> /// <returns>True if the call succeeded</returns> public int Invoke(string DllName, string FuncName, params object[] FuncParameters) { try { DoCleanup(); if (ad.UnicodeFlag.HasValue) { ad = DoConvert(FuncParameters, ad.UnicodeFlag.Value); // Ansi(false) or Unicode(true) use of allocated strings } else { ad = DoConvert(FuncParameters, FuncName.EndsWith("W") ? true : false); // Automatic pistol :) } ad.PtrApiCall = ApiCall(DllName, FuncName, ad.Datas.Length, ad.Datas); ad.LastError = Marshal.GetLastWin32Error(); ad.CleanupFlag = true; return(ad.PtrApiCall.ToInt32()); } catch (Exception ex) { ad.Exception = ex; } return(0); }
public Apicall(bool Unicode) { ad = new ArrayDatas(Unicode); }
public Apicall() { ad = new ArrayDatas(); }