private static bool CheckApiSupport()
{
if (Environment.OSVersion.Platform == PlatformID.Win32NT &&
Environment.OSVersion.Version.Major >= 6)
{
// Windows Vista or later
return true;
}
try
{
// Try to call the API.
DELTA_INPUT options = new DELTA_INPUT();
NativeMethods.CreateDeltaW(
NativeConstants.DELTA_FILE_TYPE_SET_EXECUTABLES,
NativeConstants.DELTA_FLAG_NONE,
NativeConstants.DELTA_FLAG_NONE,
null,
null,
null,
null,
options,
IntPtr.Zero,
0,
null);
// The API is supported.
return true;
}
catch (DllNotFoundException)
{
// Unable to load DLL 'msdelta.dll'
return false;
}
catch (Exception)
{
return false;
}
}