@@ -424,13 +424,17 @@ private static string GetDllName()
424424 }
425425 }
426426
427- private static void GetDelegate < T > ( uint id , out T newDelegate ) where T : class
427+ private static void GetDelegate < T > ( uint id , out T newDelegate , uint ? fallbackId = null ) where T : class
428428 {
429429 IntPtr ptr = nvapi_QueryInterface ( id ) ;
430430 if ( ptr != IntPtr . Zero )
431431 {
432432 newDelegate = Marshal . GetDelegateForFunctionPointer ( ptr , typeof ( T ) ) as T ;
433433 }
434+ else if ( fallbackId . HasValue )
435+ {
436+ GetDelegate ( fallbackId . Value , out newDelegate ) ;
437+ }
434438 else
435439 {
436440 newDelegate = null ;
@@ -604,6 +608,7 @@ public static NvAPI_Status DRS_GetSetting(IntPtr hSession, IntPtr hProfile, uint
604608 [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
605609 public delegate NvAPI_Status DRS_GetSettingDelegate ( IntPtr hSession , IntPtr hProfile , uint settingId , ref NVDRS_SETTING pSetting , ref uint x ) ;
606610 private static readonly DRS_GetSettingDelegate _DRS_GetSetting ;
611+
607612
608613 [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
609614 private delegate NvAPI_Status DRS_EnumSettingsDelegate ( IntPtr hSession , IntPtr hProfile , uint startIndex , ref uint settingsCount , IntPtr pSetting ) ;
@@ -739,20 +744,19 @@ static NvapiDrsWrapper()
739744 GetDelegate ( 0xED1F8C69 , out DRS_GetApplicationInfo ) ;
740745 GetDelegate ( 0x7FA2173A , out DRS_EnumApplicationsInternal ) ;
741746 GetDelegate ( 0xEEE566B2 , out DRS_FindApplicationByName ) ;
742- GetDelegate ( 0x8A2CF5F5 , out _DRS_SetSetting ) ;
743- GetDelegate ( 0xEA99498D , out _DRS_GetSetting ) ;
744- GetDelegate ( 0xCFD6983E , out DRS_EnumSettingsInternal ) ;
745- GetDelegate ( 0xE5DE48E5 , out DRS_EnumAvailableSettingIdsInternal ) ;
747+ GetDelegate ( 0x8A2CF5F5 , out _DRS_SetSetting , 0x577DD202 ) ;
748+ GetDelegate ( 0xEA99498D , out _DRS_GetSetting , 0x73BF8338 ) ;
749+ GetDelegate ( 0xCFD6983E , out DRS_EnumSettingsInternal , 0xAE3039DA ) ;
750+ GetDelegate ( 0xE5DE48E5 , out DRS_EnumAvailableSettingIdsInternal , 0xF020614A ) ;
746751 GetDelegate ( 0x2EC39F90 , out DRS_EnumAvailableSettingValuesInternal ) ;
747752 GetDelegate ( 0xCB7309CD , out DRS_GetSettingIdFromName ) ;
748- GetDelegate ( 0x1EB13791 , out DRS_GetSettingNameFromId ) ;
749- GetDelegate ( 0xD20D29DF , out DRS_DeleteProfileSetting ) ;
753+ GetDelegate ( 0x1EB13791 , out DRS_GetSettingNameFromId , 0xD61CBE6E ) ;
754+ GetDelegate ( 0xD20D29DF , out DRS_DeleteProfileSetting , 0xE4A26362 ) ;
750755 GetDelegate ( 0x5927B094 , out DRS_RestoreAllDefaults ) ;
751756 GetDelegate ( 0xFA5F6134 , out DRS_RestoreProfileDefault ) ;
752- GetDelegate ( 0x7DD5B261 , out DRS_RestoreProfileDefaultSetting ) ;
757+ GetDelegate ( 0x7DD5B261 , out DRS_RestoreProfileDefaultSetting , 0x53F0381E ) ;
753758 GetDelegate ( 0xDA8466A0 , out DRS_GetBaseProfile ) ;
754759 #endregion
755-
756760 }
757761 }
758762 }
0 commit comments