-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7ac3068
commit 8d50e02
Showing
5 changed files
with
531 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
#include <wincred.h> | ||
|
||
namespace YY | ||
{ | ||
namespace Thunks | ||
{ | ||
|
||
#if (YY_Thunks_Support_Version < NTDDI_WIN6) | ||
|
||
// 最低受支持的客户端 Windows Vista [仅限桌面应用] | ||
// 最低受支持的服务器 Windows Server 2008[仅限桌面应用] | ||
__DEFINE_THUNK( | ||
credui, | ||
36, | ||
DWORD, | ||
WINAPI, | ||
CredUIPromptForWindowsCredentialsW, | ||
_In_opt_ PCREDUI_INFOW pUiInfo, | ||
_In_ DWORD dwAuthError, | ||
_Inout_ ULONG* pulAuthPackage, | ||
_In_reads_bytes_opt_(ulInAuthBufferSize) LPCVOID pvInAuthBuffer, | ||
_In_ ULONG ulInAuthBufferSize, | ||
_Outptr_result_bytebuffer_to_(*pulOutAuthBufferSize, *pulOutAuthBufferSize) LPVOID* ppvOutAuthBuffer, | ||
_Out_ ULONG* pulOutAuthBufferSize, | ||
_Inout_opt_ BOOL* pfSave, | ||
_In_ DWORD dwFlags | ||
) | ||
{ | ||
if (auto const _pfnCredUIPromptForWindowsCredentialsW = try_get_CredUIPromptForWindowsCredentialsW()) | ||
{ | ||
return _pfnCredUIPromptForWindowsCredentialsW(pUiInfo, dwAuthError, pulAuthPackage, pvInAuthBuffer, ulInAuthBufferSize, ppvOutAuthBuffer, | ||
pulOutAuthBufferSize, pfSave, dwFlags); | ||
} | ||
|
||
return ERROR_CANCELLED; | ||
} | ||
#endif | ||
|
||
|
||
|
||
|
||
}//namespace Thunks | ||
|
||
} //namespace YY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,246 @@ | ||
#include <ncrypt.h> | ||
|
||
namespace YY::Thunks | ||
{ | ||
#if (YY_Thunks_Support_Version < NTDDI_WIN6) | ||
|
||
//Minimum supported client Windows Vista | ||
//Minimum supported server Windows Server 2008 | ||
__DEFINE_THUNK( | ||
ncrypt, | ||
32, | ||
SECURITY_STATUS, | ||
NTAPI, | ||
NCryptSignHash, | ||
NCRYPT_KEY_HANDLE hKey, | ||
VOID* pPaddingInfo, | ||
PBYTE pbHashValue, | ||
DWORD cbHashValue, | ||
PBYTE pbSignature, | ||
DWORD cbSignature, | ||
DWORD* pcbResult, | ||
DWORD dwFlags | ||
) | ||
{ | ||
if (auto const _pfnNCryptSignHash = try_get_NCryptSignHash()) | ||
{ | ||
return _pfnNCryptSignHash(hKey, pPaddingInfo, pbHashValue, cbHashValue, pbSignature, cbSignature, pcbResult, dwFlags); | ||
} | ||
|
||
return NTE_BAD_FLAGS; | ||
} | ||
#endif | ||
|
||
|
||
#if (YY_Thunks_Support_Version < NTDDI_WIN6) | ||
|
||
//Minimum supported client Windows Vista | ||
//Minimum supported server Windows Server 2008 | ||
__DEFINE_THUNK( | ||
ncrypt, | ||
24, | ||
SECURITY_STATUS, | ||
NTAPI, | ||
NCryptGetProperty, | ||
NCRYPT_HANDLE hObject, | ||
LPCWSTR pszProperty, | ||
PBYTE pbOutput, | ||
DWORD cbOutput, | ||
DWORD* pcbResult, | ||
DWORD dwFlags | ||
) | ||
{ | ||
if (auto const _pfnNCryptGetProperty = try_get_NCryptGetProperty()) | ||
{ | ||
return _pfnNCryptGetProperty(hObject, pszProperty, pbOutput, cbOutput, pcbResult, dwFlags); | ||
} | ||
|
||
return NTE_BAD_FLAGS; | ||
} | ||
#endif | ||
|
||
|
||
#if (YY_Thunks_Support_Version < NTDDI_WIN6) | ||
|
||
//Minimum supported client Windows Vista | ||
//Minimum supported server Windows Server 2008 | ||
__DEFINE_THUNK( | ||
ncrypt, | ||
4, | ||
SECURITY_STATUS, | ||
NTAPI, | ||
NCryptFreeObject, | ||
NCRYPT_HANDLE hObject | ||
) | ||
{ | ||
if (auto const _pfnNCryptFreeObject = try_get_NCryptFreeObject()) | ||
{ | ||
return _pfnNCryptFreeObject(hObject); | ||
} | ||
|
||
return NTE_BAD_FLAGS; | ||
} | ||
#endif | ||
|
||
|
||
#if (YY_Thunks_Support_Version < NTDDI_WIN6) | ||
|
||
//Minimum supported client Windows Vista | ||
//Minimum supported server Windows Server 2008 | ||
__DEFINE_THUNK( | ||
ncrypt, | ||
24, | ||
SECURITY_STATUS, | ||
NTAPI, | ||
NCryptCreatePersistedKey, | ||
_In_ NCRYPT_PROV_HANDLE hProvider, | ||
_Out_ NCRYPT_KEY_HANDLE* phKey, | ||
_In_ LPCWSTR pszAlgId, | ||
_In_opt_ LPCWSTR pszKeyName, | ||
_In_ DWORD dwLegacyKeySpec, | ||
_In_ DWORD dwFlags | ||
) | ||
{ | ||
if (auto const _pfnNCryptCreatePersistedKey = try_get_NCryptCreatePersistedKey()) | ||
{ | ||
return _pfnNCryptCreatePersistedKey(hProvider, phKey, pszAlgId, pszKeyName, dwLegacyKeySpec, dwFlags); | ||
} | ||
|
||
return NTE_BAD_FLAGS; | ||
} | ||
#endif | ||
|
||
|
||
#if (YY_Thunks_Support_Version < NTDDI_WIN6) | ||
|
||
//Minimum supported client Windows Vista | ||
//Minimum supported server Windows Server 2008 | ||
__DEFINE_THUNK( | ||
ncrypt, | ||
32, | ||
SECURITY_STATUS, | ||
NTAPI, | ||
NCryptExportKey, | ||
_In_ NCRYPT_KEY_HANDLE hKey, | ||
_In_opt_ NCRYPT_KEY_HANDLE hExportKey, | ||
_In_ LPCWSTR pszBlobType, | ||
_In_opt_ NCryptBufferDesc* pParameterList, | ||
_Out_writes_bytes_to_opt_(cbOutput, *pcbResult) PBYTE pbOutput, | ||
_In_ DWORD cbOutput, | ||
_Out_ DWORD* pcbResult, | ||
_In_ DWORD dwFlags | ||
) | ||
{ | ||
if (auto const _pfnNCryptExportKey = try_get_NCryptExportKey()) | ||
{ | ||
return _pfnNCryptExportKey(hKey, hExportKey, pszBlobType, pParameterList, pbOutput, cbOutput, pcbResult, dwFlags); | ||
} | ||
|
||
return NTE_BAD_FLAGS; | ||
} | ||
#endif | ||
|
||
|
||
#if (YY_Thunks_Support_Version < NTDDI_WIN6) | ||
|
||
//Minimum supported client Windows Vista | ||
//Minimum supported server Windows Server 2008 | ||
__DEFINE_THUNK( | ||
ncrypt, | ||
8, | ||
SECURITY_STATUS, | ||
NTAPI, | ||
NCryptFinalizeKey, | ||
_In_ NCRYPT_KEY_HANDLE hKey, | ||
_In_ DWORD dwFlags | ||
) | ||
{ | ||
if (auto const _pfnNCryptFinalizeKey = try_get_NCryptFinalizeKey()) | ||
{ | ||
return _pfnNCryptFinalizeKey(hKey, dwFlags); | ||
} | ||
|
||
return NTE_BAD_FLAGS; | ||
} | ||
#endif | ||
|
||
|
||
#if (YY_Thunks_Support_Version < NTDDI_WIN6) | ||
|
||
//Minimum supported client Windows Vista | ||
//Minimum supported server Windows Server 2008 | ||
__DEFINE_THUNK( | ||
ncrypt, | ||
32, | ||
SECURITY_STATUS, | ||
NTAPI, | ||
NCryptImportKey, | ||
_In_ NCRYPT_PROV_HANDLE hProvider, | ||
_In_opt_ NCRYPT_KEY_HANDLE hImportKey, | ||
_In_ LPCWSTR pszBlobType, | ||
_In_opt_ NCryptBufferDesc* pParameterList, | ||
_Out_ NCRYPT_KEY_HANDLE* phKey, | ||
_In_reads_bytes_(cbData) PBYTE pbData, | ||
_In_ DWORD cbData, | ||
_In_ DWORD dwFlags | ||
) | ||
{ | ||
if (auto const _pfnNCryptImportKey = try_get_NCryptImportKey()) | ||
{ | ||
return _pfnNCryptImportKey(hProvider, hImportKey, pszBlobType, pParameterList, phKey, pbData, cbData, dwFlags); | ||
} | ||
|
||
return NTE_BAD_FLAGS; | ||
} | ||
#endif | ||
|
||
|
||
#if (YY_Thunks_Support_Version < NTDDI_WIN6) | ||
|
||
//Minimum supported client Windows Vista | ||
//Minimum supported server Windows Server 2008 | ||
__DEFINE_THUNK( | ||
ncrypt, | ||
12, | ||
SECURITY_STATUS, | ||
NTAPI, | ||
NCryptIsAlgSupported, | ||
_In_ NCRYPT_PROV_HANDLE hProvider, | ||
_In_ LPCWSTR pszAlgId, | ||
_In_ DWORD dwFlags | ||
) | ||
{ | ||
if (auto const _pfnNCryptIsAlgSupported = try_get_NCryptIsAlgSupported()) | ||
{ | ||
return _pfnNCryptIsAlgSupported(hProvider, pszAlgId, dwFlags); | ||
} | ||
|
||
return NTE_BAD_FLAGS; | ||
} | ||
#endif | ||
|
||
|
||
#if (YY_Thunks_Support_Version < NTDDI_WIN6) | ||
|
||
//Minimum supported client Windows Vista | ||
//Minimum supported server Windows Server 2008 | ||
__DEFINE_THUNK( | ||
ncrypt, | ||
12, | ||
SECURITY_STATUS, | ||
NTAPI, | ||
NCryptOpenStorageProvider, | ||
_Out_ NCRYPT_PROV_HANDLE* phProvider, | ||
_In_opt_ LPCWSTR pszProviderName, | ||
_In_ DWORD dwFlags | ||
) | ||
{ | ||
if (auto const _pfnNCryptOpenStorageProvider = try_get_NCryptOpenStorageProvider()) | ||
{ | ||
return _pfnNCryptOpenStorageProvider(phProvider, pszProviderName, dwFlags); | ||
} | ||
|
||
return NTE_BAD_FLAGS; | ||
} | ||
#endif | ||
} //namespace YY::Thunks |
Oops, something went wrong.