コード例 #1
0
        private UInt32 GetAdapterIdentifierDetour(UInt32 Adapter, UInt64 Flags, [In][Out] IntPtr pIdentifier)
        {
            var result = GetAdapterIdentifierOriginal(Adapter, Flags, pIdentifier);


            D3DADAPTER_IDENTIFIER9 newStructBefore = (D3DADAPTER_IDENTIFIER9)Marshal.PtrToStructure(pIdentifier, typeof(D3DADAPTER_IDENTIFIER9));
            string before = string.Format("[DX9Controller] Before: Description: {0} GpuDeviceId: {1} GpuIdentifier: {2} GpuDriverversion: {3} GpuRevision: {4} GpuVendorId: {5}",
                                          newStructBefore.Description, newStructBefore.DeviceId.ToString(), newStructBefore.DeviceIdentifier.ToString(), ((long)newStructBefore.DriverVersion.QuadPart).ToString(), newStructBefore.Revision.ToString(), newStructBefore.VendorId.ToString(), Color.Orange);

            HookManager.Log(before, Color.Orange);

            newStructBefore.Description = _settings.GpuDescription;
            newStructBefore.DeviceId    = _settings.GpuDeviceId;

            newStructBefore.DeviceIdentifier = Guid.Parse(_settings.GpuIdentifier);

            newStructBefore.DriverVersion.QuadPart = _settings.GpuDriverversion;
            newStructBefore.Revision = _settings.GpuRevision;
            newStructBefore.VendorId = _settings.GpuVendorId;
            Marshal.StructureToPtr(newStructBefore, pIdentifier, true);

            D3DADAPTER_IDENTIFIER9 newStructAfter = (D3DADAPTER_IDENTIFIER9)Marshal.PtrToStructure(pIdentifier, typeof(D3DADAPTER_IDENTIFIER9));

            string after = string.Format("[DX9Controller] After: Description: {0} GpuDeviceId: {1} GpuIdentifier: {2} GpuDriverversion: {3} GpuRevision: {4} GpuVendorId: {5}",
                                         newStructAfter.Description, newStructAfter.DeviceId.ToString(), newStructAfter.DeviceIdentifier.ToString(), ((long)newStructAfter.DriverVersion.QuadPart).ToString(), newStructAfter.Revision.ToString(), newStructAfter.VendorId.ToString(), Color.Orange);

            HookManager.Log(after, Color.Orange);
            return(0);            // D3D_OK
        }
コード例 #2
0
        private UInt32 GetAdapterIdentifierDetour(UInt32 Adapter, UInt64 Flags, [In][Out] IntPtr pIdentifier)
        {
            var result = GetAdapterIdentifierOriginal(Adapter, Flags, pIdentifier);

            D3DADAPTER_IDENTIFIER9 newStruct = (D3DADAPTER_IDENTIFIER9)Marshal.PtrToStructure(pIdentifier, typeof(D3DADAPTER_IDENTIFIER9));

            newStruct.Description            = _settings.GpuDescription;
            newStruct.DeviceId               = _settings.GpuDeviceId;
            newStruct.DeviceIdentifier       = Guid.Parse(_settings.GpuIdentifier);
            newStruct.DriverVersion.QuadPart = _settings.GpuDriverversion;
            newStruct.Revision               = _settings.GpuRevision;
            newStruct.VendorId               = _settings.GpuVendorId;
            Marshal.StructureToPtr(newStruct, pIdentifier, true);
            return(0);
        }