private static bool GetProcs() { if (IntPtr.Size != 4) { return(false); } if (SOP.LoadLibrary("nvapi.dll") == IntPtr.Zero) { return(false); } try { SOP.CreateApplication = Marshal.GetDelegateForFunctionPointer(SOP.QueryInterface(1128770014U), typeof(SOP.CreateApplicationDelegate)) as SOP.CreateApplicationDelegate; SOP.CreateProfile = Marshal.GetDelegateForFunctionPointer(SOP.QueryInterface(3424084072U), typeof(SOP.CreateProfileDelegate)) as SOP.CreateProfileDelegate; SOP.CreateSession = Marshal.GetDelegateForFunctionPointer(SOP.QueryInterface(110417198U), typeof(SOP.CreateSessionDelegate)) as SOP.CreateSessionDelegate; SOP.DeleteProfile = Marshal.GetDelegateForFunctionPointer(SOP.QueryInterface(386478598U), typeof(SOP.DeleteProfileDelegate)) as SOP.DeleteProfileDelegate; SOP.DestroySession = Marshal.GetDelegateForFunctionPointer(SOP.QueryInterface(3671707640U), typeof(SOP.DestroySessionDelegate)) as SOP.DestroySessionDelegate; SOP.EnumApplications = Marshal.GetDelegateForFunctionPointer(SOP.QueryInterface(2141329210U), typeof(SOP.EnumApplicationsDelegate)) as SOP.EnumApplicationsDelegate; SOP.FindProfileByName = Marshal.GetDelegateForFunctionPointer(SOP.QueryInterface(2118818315U), typeof(SOP.FindProfileByNameDelegate)) as SOP.FindProfileByNameDelegate; SOP.GetProfileInfo = Marshal.GetDelegateForFunctionPointer(SOP.QueryInterface(1640853462U), typeof(SOP.GetProfileInfoDelegate)) as SOP.GetProfileInfoDelegate; SOP.Initialize = Marshal.GetDelegateForFunctionPointer(SOP.QueryInterface(22079528U), typeof(SOP.InitializeDelegate)) as SOP.InitializeDelegate; SOP.LoadSettings = Marshal.GetDelegateForFunctionPointer(SOP.QueryInterface(928890219U), typeof(SOP.LoadSettingsDelegate)) as SOP.LoadSettingsDelegate; SOP.SaveSettings = Marshal.GetDelegateForFunctionPointer(SOP.QueryInterface(4240211476U), typeof(SOP.SaveSettingsDelegate)) as SOP.SaveSettingsDelegate; SOP.SetSetting = Marshal.GetDelegateForFunctionPointer(SOP.QueryInterface(1467863554U), typeof(SOP.SetSettingDelegate)) as SOP.SetSettingDelegate; } catch (Exception ex) { return(false); } return(true); }
private static bool GetProcs() { if (IntPtr.Size != 4) return false; if (SOP.LoadLibrary("nvapi.dll") == IntPtr.Zero) return false; try { SOP.CreateApplication = Marshal.GetDelegateForFunctionPointer(SOP.QueryInterface(1128770014U), typeof (SOP.CreateApplicationDelegate)) as SOP.CreateApplicationDelegate; SOP.CreateProfile = Marshal.GetDelegateForFunctionPointer(SOP.QueryInterface(3424084072U), typeof (SOP.CreateProfileDelegate)) as SOP.CreateProfileDelegate; SOP.CreateSession = Marshal.GetDelegateForFunctionPointer(SOP.QueryInterface(110417198U), typeof (SOP.CreateSessionDelegate)) as SOP.CreateSessionDelegate; SOP.DeleteProfile = Marshal.GetDelegateForFunctionPointer(SOP.QueryInterface(386478598U), typeof (SOP.DeleteProfileDelegate)) as SOP.DeleteProfileDelegate; SOP.DestroySession = Marshal.GetDelegateForFunctionPointer(SOP.QueryInterface(3671707640U), typeof (SOP.DestroySessionDelegate)) as SOP.DestroySessionDelegate; SOP.EnumApplications = Marshal.GetDelegateForFunctionPointer(SOP.QueryInterface(2141329210U), typeof (SOP.EnumApplicationsDelegate)) as SOP.EnumApplicationsDelegate; SOP.FindProfileByName = Marshal.GetDelegateForFunctionPointer(SOP.QueryInterface(2118818315U), typeof (SOP.FindProfileByNameDelegate)) as SOP.FindProfileByNameDelegate; SOP.GetProfileInfo = Marshal.GetDelegateForFunctionPointer(SOP.QueryInterface(1640853462U), typeof (SOP.GetProfileInfoDelegate)) as SOP.GetProfileInfoDelegate; SOP.Initialize = Marshal.GetDelegateForFunctionPointer(SOP.QueryInterface(22079528U), typeof (SOP.InitializeDelegate)) as SOP.InitializeDelegate; SOP.LoadSettings = Marshal.GetDelegateForFunctionPointer(SOP.QueryInterface(928890219U), typeof (SOP.LoadSettingsDelegate)) as SOP.LoadSettingsDelegate; SOP.SaveSettings = Marshal.GetDelegateForFunctionPointer(SOP.QueryInterface(4240211476U), typeof (SOP.SaveSettingsDelegate)) as SOP.SaveSettingsDelegate; SOP.SetSetting = Marshal.GetDelegateForFunctionPointer(SOP.QueryInterface(1467863554U), typeof (SOP.SetSettingDelegate)) as SOP.SetSettingDelegate; } catch (Exception ex) { return false; } return true; }