Beispiel #1
0
        /* Loader of library */

        /*
         * Loads the Injector library.
         *
         * libPath - Path to DACInjector.dll (or your own name, for my Library dll).
         */
        public static bool Load(string libPath = "")
        {
            if (pLibDll == IntPtr.Zero)
            {
                if (libPath == "")
                {
                    libPath = Path.GetFullPath("DACInjector.dll");
                }

                pLibDll = Util.LoadLibrary(libPath);
                if (pLibDll == IntPtr.Zero)
                {
                    return(false);
                }
            }

            /* Load "Inject" */
            IntPtr pFunc = Util.GetProcAddress(pLibDll, "Inject");

            if (pFunc == IntPtr.Zero)
            {
                return(false);
            }

            pInject = Marshal.GetDelegateForFunctionPointer <Inject_T>(pFunc);
            return(true);
        }
Beispiel #2
0
 /*
  * Unloads the Injector library.
  */
 public static void Unload()
 {
     if (pLibDll != IntPtr.Zero)
     {
         Util.FreeLibrary(pLibDll);
     }
     pInject = null;
 }