Skip to content

Commit

Permalink
qt6.5和libcef109在适配XP时一些缺失的API
Browse files Browse the repository at this point in the history
  • Loading branch information
cxxzhang authored and mingkuang-Chuyu committed May 28, 2024
1 parent 7ac3068 commit 8d50e02
Show file tree
Hide file tree
Showing 5 changed files with 531 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Thunks/YY_Thunks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#define _YY_APPLY_TO_LATE_BOUND_MODULES(_APPLY) \
_APPLY(ntdll, "ntdll" , USING_UNSAFE_LOAD ) \
_APPLY(kernel32, "kernel32" , USING_UNSAFE_LOAD ) \
_APPLY(credui, "credui" , 0 ) \
_APPLY(crypt32, "crypt32" , 0 ) \
_APPLY(dwmapi, "dwmapi" , 0 ) \
_APPLY(d3d9, "d3d9" , 0 ) \
Expand Down Expand Up @@ -33,8 +34,10 @@
_APPLY(userenv, "userenv" , 0 ) \
_APPLY(mfplat, "mfplat" , 0 ) \
_APPLY(bluetoothapis, "bluetoothapis" , 0 ) \
_APPLY(ncrypt, "ncrypt" , 0 ) \
_APPLY(netapi32, "netapi32" , 0 ) \
_APPLY(powrprof, "powrprof" , 0 ) \
_APPLY(propsys, "propsys" , 0 ) \
_APPLY(wevtapi, "wevtapi" , 0 ) \
_APPLY(winhttp, "winhttp" , 0 ) \
_APPLY(zipfldr, "zipfldr" , LOAD_AS_DATA_FILE ) \
Expand Down
45 changes: 45 additions & 0 deletions src/Thunks/credui.hpp
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
246 changes: 246 additions & 0 deletions src/Thunks/ncrypt.hpp
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
Loading

0 comments on commit 8d50e02

Please sign in to comment.