Exemplo n.º 1
0
        IntPtr D3DCreate9Detour(uint sdkVersion)
        {
            //hook_d3d_create9.Dispose();

            // Retrieve created D3D9 object
            Direct3D9 = Direct3DCreate9(sdkVersion);

            if (hook_d3d9_create_device == null)
            {
                // Retrieve pointer to Direct3D9CreateDevice function and hook it
                var create_device_func = Misc.GetVTableFunction(Direct3D9, 16);

                Direct3D9CreateDevice   = Misc.GetDelegate <NativeAPI.Direct3D9CreateDeviceDelegate>(create_device_func);
                hook_d3d9_create_device = LocalHook.Create(create_device_func, new NativeAPI.Direct3D9CreateDeviceDelegate(D3D9CreateDeviceDetour), this);
                hook_d3d9_create_device.ThreadACL.SetExclusiveACL(new Int32[] { });
            }

            return(Direct3D9);
        }
Exemplo n.º 2
0
        IntPtr D3DCreate9Detour(uint sdkVersion)
        {
            //hook_d3d_create9.Dispose();

            // Retrieve created D3D9 object
            Direct3D9 = Direct3DCreate9(sdkVersion);

            if (hook_d3d9_create_device == null) {
                // Retrieve pointer to Direct3D9CreateDevice function and hook it
                var create_device_func = Misc.GetVTableFunction(Direct3D9, 16);

                Direct3D9CreateDevice = Misc.GetDelegate<NativeAPI.Direct3D9CreateDeviceDelegate>(create_device_func);
                hook_d3d9_create_device = LocalHook.Create(create_device_func, new NativeAPI.Direct3D9CreateDeviceDelegate(D3D9CreateDeviceDetour), this);
                hook_d3d9_create_device.ThreadACL.SetExclusiveACL(new Int32[] { });
            }

            return Direct3D9;
        }