Skip to content

Instantly share code, notes, and snippets.

@navossoc
Last active November 2, 2018 09:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save navossoc/7572c7d82243e9f818989e2765e7793a to your computer and use it in GitHub Desktop.
Save navossoc/7572c7d82243e9f818989e2765e7793a to your computer and use it in GitHub Desktop.
Check if SHA-2 support is available on Windows 7 SP1 (KB3033929)
BOOL IsSHA2Supported()
{
// Get a handle to the DLL module
HMODULE hLib = LoadLibraryA("wintrust.dll");
// If the handle is valid, try to get the function address
if (hLib != NULL)
{
PVOID fpCryptCATAdminAcquireContext2 = GetProcAddress(hLib, "CryptCATAdminAcquireContext2");
// Free the DLL module
FreeLibrary(hLib);
return fpCryptCATAdminAcquireContext2 != NULL;
}
return FALSE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment