Skip to content

Commit

Permalink
Fea #90, 为Chrome 125内核补充WinXP/Win7不存在的接口
Browse files Browse the repository at this point in the history
- 添加 CompareObjectHandles
- 添加 DWriteCreateFactory新增IDWriteFactory3支持(仅Vista以及更高版本)
- 添加 CM_Get_DevNode_Property_ExW
- 添加 CM_Set_DevNode_Property_ExW
- 添加 CM_Get_DevNode_PropertyW
- 添加 CM_Set_DevNode_PropertyW
- 添加 Wow64GetThreadContext(新增对WinXP 64支持)
- 添加 SetDefaultDllDirectories
- 添加 NtOpenKeyEx
- 添加 InitPropVariantFromCLSID
- 添加 PSGetPropertyKeyFromName
- 添加 PSCreateMemoryPropertyStore
- 添加 VariantCompare
- 添加 AddMandatoryAce
- 添加 RegisterPointerDeviceNotifications
- 添加 GetPointerDevices
- 添加 GetPointerDevice
- 添加 GetPointerPenInfo
- 添加 GetPointerType
- 添加 UiaRaiseNotificationEvent
- 添加 MFCreateDeviceSource
- 添加 MFEnumDeviceSources
- 添加 MFCreateAlignedMemoryBuffer
- 添加 MFCreateAsyncResult
- 添加 MFCreateAttributes
- 添加 MFCreateEventQueue
- 添加 MFCreateMediaBufferWrapper
- 添加 MFCreateMediaEvent
- 添加 MFCreateMediaType
- 添加 MFCreateMemoryBuffer
- 添加 MFCreatePresentationDescriptor
- 添加 MFCreateSample
- 添加 MFCreateStreamDescriptor
- 添加 MFCreateWaveFormatExFromMFMediaType
- 添加 MFFrameRateToAverageTimePerFrame
- 添加 MFGetSystemTime
- 添加 MFInitMediaTypeFromWaveFormatEx
- 添加 MFShutdown
- 添加 MFStartup
- 添加 MFTEnumEx
- 添加 MFCreateSourceReaderFromMediaSource
- 添加 NdfCreateWebIncident
- 添加 NdfCloseIncident
- 添加 NdfExecuteDiagnosis
- 添加 WinUsb_Free
- 添加 WinUsb_GetAssociatedInterface
- 添加 WinUsb_GetOverlappedResult
- 添加 WinUsb_Initialize
- 添加 WinUsb_ReadPipe
- 添加 WinUsb_ResetPipe
- 添加 WinUsb_SetCurrentAlternateSetting
- 添加 WinUsb_WritePipe
- 添加 D3D12CreateDevice
  • Loading branch information
mingkuang-Chuyu committed Jun 22, 2024
1 parent 45d7751 commit bee5f7c
Show file tree
Hide file tree
Showing 42 changed files with 7,287 additions and 1,620 deletions.
11 changes: 11 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,17 @@ Compatible with all platforms.
* All runtime modes are supported (such as: `/MD`, `/MT`, `/MDd`, `/MTd`).
### 3.2. Windows SDK Version Requirements
| Thunks Target | At Least Windows SDK Version is required
| ------------------ | -----------
| Windows 2000 | SDK 6.0 (VS2008 built-in)
| Windows XP(2003) | SDK 6.0 (VS2008 built-in)
| Windows Vista | SDK 6.0 (VS2008 built-in)
| Windows 7 | SDK 7.0
| Windows 8 | SDK 8.0
| Windows 8.1 | SDK 8.1
| Windows 10 10240 | SDK 10.0.10240
| Windows 10 19041 | SDK 10.0.19041
At least Windows SDK 6.0 is required.
> Note: VC6.0 and VS2005 users should note that the SDK version that comes with these compilers by default is too low.
Expand Down
12 changes: 11 additions & 1 deletion Readme.osc.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,17 @@ ULONGLONG WINAPI GetTickCount64(VOID)
* 所有运行库模式均支持(比如:`/MD`、`/MT`、`/MDd`、`/MTd`)。
### 3.2. SDK版本要求
至少需要SDK 6.0(VS2008默认附带)
| Thunks等级 | 最低SDK要求
| ------------------ | -----------
| Windows 2000 | SDK 6.0(VS2008默认附带)
| Windows XP(2003) | SDK 6.0(VS2008默认附带)
| Windows Vista | SDK 6.0(VS2008默认附带)
| Windows 7 | SDK 7.0
| Windows 8 | SDK 8.0
| Windows 8.1 | SDK 8.1
| Windows 10 10240 | SDK 10.0.10240
| Windows 10 19041 | SDK 10.0.19041
> 温馨提示:VC6.0、VS2005用户请注意,由于这些编译器默认附带的SDK版本太低。请先将SDK升级到6.0或者更高版本,然后再使用YY-Thunks,否则将发生链接失败!
高版本的SDK不影响对老系统的兼容性,请坐和放宽,安心升级。
Expand Down
85 changes: 84 additions & 1 deletion ThunksList.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

> 开头带`*`的函数并不建议使用,存在一些较大负面影响,仅用于编译通过处理,具体负面影响可参考注释内容。
## api-ms-win-core-handle-l1-1-0.dll
| 函数 | Fallback
| ---- | -----------
| CompareObjectHandles | 不存在时,调用NtQueryObject以及DuplicateHandle。

## api-ms-win-core-path-l1-1-0.dll
| 函数 | Fallback
| ---- | -----------
Expand Down Expand Up @@ -121,6 +126,7 @@
| EventWriteEx | 不存在时,调用EventWriteTransfer。
| EventWriteString | 不存在时,返回ERROR_NOT_SUPPORTED。
| GetDynamicTimeZoneInformationEffectiveYears| 不存在时,直接读取`Time Zones`注册表。
| AddMandatoryAce | 不存在时,调用RtlCopySid。

## bcrypt.dll
| 函数 | Fallback
Expand Down Expand Up @@ -159,6 +165,14 @@
| BluetoothGATTSetCharacteristicValue | 不存在时,返回ERROR_NOT_SUPPORTED。
| BluetoothGATTSetDescriptorValue | 不存在时,返回ERROR_NOT_SUPPORTED。

## CfgMgr32.dll
| 函数 | Fallback
| ---- | -----------
| CM_Get_DevNode_Property_ExW | 不存在时,调用CM_Get_DevNode_Registry_PropertyW。
| CM_Set_DevNode_Property_ExW | 不存在时,调用CM_Set_DevNode_Registry_PropertyW。
| CM_Get_DevNode_PropertyW | 不存在时,调用CM_Get_DevNode_Property_ExW。
| CM_Set_DevNode_PropertyW | 不存在时,调用CM_Set_DevNode_Property_ExW。

## Crypt32.dll
| 函数 | Fallback
| ---- | -----------
Expand All @@ -175,6 +189,11 @@
| ---- | -----------
| D3D11CreateDevice | 不存在时,返回 `E_NOINTERFACE`

## d3d12.dll
| 函数 | Fallback
| ---- | -----------
| D3D12CreateDevice | 不存在时,返回 `E_NOINTERFACE`

## DbgHelp.dll
| 函数 | Fallback
| ---- | -----------
Expand Down Expand Up @@ -518,7 +537,14 @@
| CreateRemoteThreadEx | 不存在时,调用CreateRemoteThread。
| WerRegisterRuntimeExceptionModule | 不存在时,返回S_OK。
| WerUnregisterRuntimeExceptionModule | 不存在时,返回S_OK。
| Wow64GetThreadContext | 不存在时,返回ERROR_INVALID_PARAMETER。
| Wow64GetThreadContext | 不存在时,调用GetThreadContext或者返回ERROR_INVALID_PARAMETER。
| SetDefaultDllDirectories | 不存在时,手工控制LoadLibrary加载顺序。

## mfplat.dll
| 函数 | Fallback
| ---- | -----------
| MFCreateDeviceSource | 不存在时,返回E_NOTIMPL。
| MFEnumDeviceSources | 不存在时,返回E_NOTIMPL。

## mfplat.dll
| 函数 | Fallback
Expand All @@ -527,6 +553,36 @@
| MFCreateDXGISurfaceBuffer | 不存在时,返回E_NOTIMPL。
| MFLockDXGIDeviceManager | 不存在时,返回E_NOTIMPL。
| MFUnlockDXGIDeviceManager | 不存在时,返回E_NOTIMPL。
| MFCreateAlignedMemoryBuffer | 不存在时,返回E_NOTIMPL。
| MFCreateAsyncResult | 不存在时,返回E_NOTIMPL。
| MFCreateAttributes | 不存在时,返回E_NOTIMPL。
| MFCreateEventQueue | 不存在时,返回E_NOTIMPL。
| MFCreateMediaBufferWrapper | 不存在时,返回E_NOTIMPL。
| MFCreateMediaEvent | 不存在时,返回E_NOTIMPL。
| MFCreateMediaType | 不存在时,返回E_NOTIMPL。
| MFCreateMemoryBuffer | 不存在时,返回E_NOTIMPL。
| MFCreatePresentationDescriptor | 不存在时,返回E_NOTIMPL。
| MFCreateSample | 不存在时,返回E_NOTIMPL。
| MFCreateStreamDescriptor | 不存在时,返回E_NOTIMPL。
| MFCreateWaveFormatExFromMFMediaType | 不存在时,返回E_NOTIMPL。
| MFFrameRateToAverageTimePerFrame | 不存在时,返回E_NOTIMPL。
| MFGetSystemTime | 不存在时,调用GetSystemTimeAsFileTime。
| MFInitMediaTypeFromWaveFormatEx | 不存在时,返回E_NOTIMPL。
| MFShutdown | 不存在时,返回E_NOTIMPL。
| MFStartup | 不存在时,返回E_NOTIMPL。
| MFTEnumEx | 不存在时,返回E_NOTIMPL。

## mfreadwrite.dll
| 函数 | Fallback
| ---- | -----------
| MFCreateSourceReaderFromMediaSource | 不存在时,返回E_NOTIMPL。

## ndfapi.dll
| 函数 | Fallback
| ---- | -----------
| NdfCreateWebIncident | 不存在时,返回一个伪句柄假装成功。
| NdfCloseIncident | 不存在时,假装成功关闭句柄。
| NdfExecuteDiagnosis | 不存在时,假装什么问题也没有发现。

## netapi32.dll
| 函数 | Fallback
Expand All @@ -538,6 +594,7 @@
| 函数 | Fallback
| ---- | -----------
| NtCancelIoFileEx | 不存在时,调用 NtCancelIoFile。注意:将取消此文件的所有IO请求。
| NtOpenKeyEx | 不存在时,调用 NtOpenKey 或者 NtCreateKey。

## ole32.dll
| 函数 | Fallback
Expand All @@ -557,6 +614,14 @@
| PowerRegisterSuspendResumeNotification | 不存在时,使用窗口模拟。
| PowerUnregisterSuspendResumeNotification | 内部实现。

## PropSys.dll
| 函数 | Fallback
| ---- | -----------
| InitPropVariantFromCLSID | 不存在时,CoTaskMemAlloc分配内存。
| PSGetPropertyKeyFromName | 不存在时,返回 TYPE_E_ELEMENTNOTFOUND(属性不存在)。
| PSCreateMemoryPropertyStore | 不存在时,返回 E_NOTIMPL。
| VariantCompare | 不存在时,内部实现。

## psapi.dll
| 函数 | Fallback
| ---- | -----------
Expand Down Expand Up @@ -617,6 +682,7 @@
| UiaGetReservedMixedAttributeValue | 不存在时,报告错误 E_NOTIMPL。
| UiaGetReservedNotSupportedValue | 不存在时,报告错误 E_NOTIMPL。
| UiaRaiseStructureChangedEvent | 不存在时,报告错误 E_NOTIMPL。
| UiaRaiseNotificationEvent | 不存在时,假装成功。

## user32.dll
| 函数 | Fallback
Expand Down Expand Up @@ -649,6 +715,11 @@
| DisplayConfigGetDeviceInfo | 不存在时,报告没有安装驱动。
| GetDisplayConfigBufferSizes | 不存在时,报告没有安装驱动。
| QueryDisplayConfig | 不存在时,报告没有安装驱动。
| RegisterPointerDeviceNotifications | 不存在时,假装成功。
| GetPointerDevices | 不存在时,假装没有触摸设备。
| GetPointerDevice | 不存在时,假装没有触摸设备。
| GetPointerPenInfo | 不存在时,假装没有触摸设备。
| GetPointerType | 不存在时,假装没有触摸设备。

## userenv.dll
| 函数 | Fallback
Expand Down Expand Up @@ -689,6 +760,18 @@
| WinHttpGetProxyResult | 不存在时,内部实现。
| WinHttpFreeProxyResult | 不存在时,内部实现。

## WinUsb.dll
| 函数 | Fallback
| ---- | -----------
| WinUsb_Free | 不存在时,报告ERROR_INVALID_HANDLE。
| WinUsb_GetAssociatedInterface | 不存在时,报告ERROR_INVALID_HANDLE。
| WinUsb_GetOverlappedResult | 不存在时,报告ERROR_INVALID_HANDLE。
| WinUsb_Initialize | 不存在时,报告ERROR_INVALID_HANDLE。
| WinUsb_ReadPipe | 不存在时,报告ERROR_INVALID_HANDLE。
| WinUsb_ResetPipe | 不存在时,报告ERROR_INVALID_HANDLE。
| WinUsb_SetCurrentAlternateSetting | 不存在时,报告ERROR_INVALID_HANDLE。
| WinUsb_WritePipe | 不存在时,报告ERROR_INVALID_HANDLE。

## ws2_32.dll
| 函数 | Fallback
| ---- | -----------
Expand Down
4 changes: 2 additions & 2 deletions src/Build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ goto:eof
:BuildObj
echo BuildObj %1 %2 %3

cl /O1 /Os /Oi /GS- /std:c++17 /arch:IA32 /Z7 /MT /Fo"objs\\%Platform%\\%1" /Zl /c /D "NDEBUG" /D "YY_Thunks_Support_Version=%2" "%~dp0Thunks\YY_Thunks.cpp"
cl /O1 /Os /Oi /GS- /std:c++17 /execution-charset:utf-8 /arch:IA32 /Z7 /MT /Fo"objs\\%Platform%\\%1" /Zl /c /D "NDEBUG" /D "YY_Thunks_Support_Version=%2" "%~dp0Thunks\YY_Thunks.cpp"
if %ErrorLevel% NEQ 0 exit /b %ErrorLevel%

::生成weak符号,一些非必须符号安排为weak可以避免链接失败
Expand All @@ -52,7 +52,7 @@ echo BuildLib %1 %2 %3

md "Lib\\%1\\%Platform%"

cl /O1 /Os /Oi /GS- /std:c++17 /arch:IA32 /Z7 /MT /Fo"Lib\\%1\\%Platform%\\YY_Thunks_for_%1.obj" /Zl /c /D "NDEBUG" /D "YY_Thunks_Support_Version=%2" /D "__FALLBACK_PREFIX=YY_Thunks_" "%~dp0Thunks\YY_Thunks.cpp"
cl /O1 /Os /Oi /GS- /std:c++17 /execution-charset:utf-8 /arch:IA32 /Z7 /MT /Fo"Lib\\%1\\%Platform%\\YY_Thunks_for_%1.obj" /Zl /c /D "__APPLY_CHROMIUM_WORKAROUNDS" /D "__USING_NTDLL_LIB" /D "NDEBUG" /D "YY_Thunks_Support_Version=%2" /D "__FALLBACK_PREFIX=YY_Thunks_" "%~dp0Thunks\YY_Thunks.cpp"

if %ErrorLevel% NEQ 0 exit /b %ErrorLevel%

Expand Down
32 changes: 32 additions & 0 deletions src/Shared/km.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@

#define NtGetCurrentProcess() (HANDLE)-1

#define NtGetCurrentThread() (HANDLE)-2

// begin_access
#define DUPLICATE_CLOSE_SOURCE 0x00000001
#define DUPLICATE_SAME_ACCESS 0x00000002
Expand Down Expand Up @@ -1580,6 +1582,21 @@ NtQueryDirectoryFile (

};

typedef struct _OBJECT_BASIC_INFORMATION
{
ULONG Attributes;
ACCESS_MASK GrantedAccess;
ULONG HandleCount;
ULONG PointerCount;
ULONG PagedPoolCharge;
ULONG NonPagedPoolCharge;
ULONG Reserved[3];
ULONG NameInfoSize;
ULONG TypeInfoSize;
ULONG SecurityDescriptorSize;
LARGE_INTEGER CreationTime;
} OBJECT_BASIC_INFORMATION, * POBJECT_BASIC_INFORMATION;

typedef struct _OBJECT_NAME_INFORMATION
{
UNICODE_STRING Name;
Expand Down Expand Up @@ -5205,6 +5222,21 @@ typedef struct _KUSER_SHARED_DATA
#define KI_USER_SHARED_DATA 0x7ffe0000
const auto SharedUserData = reinterpret_cast<const KUSER_SHARED_DATA*>(KI_USER_SHARED_DATA);

EXTERN_C NTSYSAPI BOOLEAN NTAPI RtlValidSid(_In_ PSID Sid);

EXTERN_C NTSYSAPI BOOLEAN NTAPI RtlValidAcl(IN PACL Acl);

EXTERN_C NTSYSAPI BOOLEAN NTAPI RtlFirstFreeAce(
IN PACL Acl,
OUT PVOID* FirstFree
);

EXTERN_C NTSYSAPI NTSTATUS NTAPI RtlCopySid(
IN ULONG DestinationSidLength,
OUT PSID DestinationSid,
IN PSID SourceSid
);

#pragma warning(pop)
#if defined __cplusplus && !defined _Disallow_YY_KM_Namespace
} //namespace YY
Expand Down
Loading

0 comments on commit bee5f7c

Please sign in to comment.