diff --git a/ThunksList.md b/ThunksList.md
index 7c8bb74..8edd493 100644
--- a/ThunksList.md
+++ b/ThunksList.md
@@ -80,6 +80,11 @@
| BCryptCloseAlgorithmProvider | 内部实现。
| BCryptGenRandom | 不存在时调用,RtlGenRandom。
+## bcryptprimitives.dll
+| 函数 | Fallback
+| ---- | -----------
+| ProcessPrng | 不存在时调用,RtlGenRandom。
+
## bluetoothapis.dll
| 函数 | Fallback
| ---- | -----------
diff --git a/src/Thunks/BCryptPrimitives.hpp b/src/Thunks/BCryptPrimitives.hpp
new file mode 100644
index 0000000..a2a3ce7
--- /dev/null
+++ b/src/Thunks/BCryptPrimitives.hpp
@@ -0,0 +1,41 @@
+
+extern "C" BOOL WINAPI ProcessPrng(
+ _Out_writes_bytes_(_cbBuffer) PUCHAR _pbBuffer,
+ _In_ ULONG _cbBuffer
+ );
+
+namespace YY
+{
+ namespace Thunks
+ {
+#if (YY_Thunks_Support_Version < NTDDI_WIN6)
+
+ // 最低受支持的客户端 Windows Vista [桌面应用|UWP 应用]
+ // 最低受支持的服务器 Windows Server 2008[桌面应用 | UWP 应用]
+ __DEFINE_THUNK(
+ bcryptprimitives,
+ 8,
+ BOOL,
+ WINAPI,
+ ProcessPrng,
+ _Out_writes_bytes_(_cbBuffer) PUCHAR _pbBuffer,
+ _In_ ULONG _cbBuffer
+ )
+ {
+ if (auto _pfnProcessPrng = try_get_ProcessPrng())
+ {
+ return _pfnProcessPrng(_pbBuffer, _cbBuffer);
+ }
+
+ const auto _pfnRtlGenRandom = try_get_SystemFunction036();
+ if (!_pfnRtlGenRandom)
+ {
+ SetLastError(ERROR_FUNCTION_FAILED);
+ return FALSE;
+ }
+
+ return _pfnRtlGenRandom(_pbBuffer, _cbBuffer);
+ }
+#endif
+ } // namespace Thunks
+} // namespace YY
diff --git a/src/Thunks/YY_Thunks.cpp b/src/Thunks/YY_Thunks.cpp
index ff07a4f..d257f8e 100644
--- a/src/Thunks/YY_Thunks.cpp
+++ b/src/Thunks/YY_Thunks.cpp
@@ -11,6 +11,7 @@
_APPLY(version, "version" , 0 ) \
_APPLY(advapi32, "advapi32" , 0 ) \
_APPLY(bcrypt, "bcrypt" , 0 ) \
+ _APPLY(bcryptprimitives, "bcryptprimitives" , 0 ) \
_APPLY(user32, "user32" , 0 ) \
_APPLY(ws2_32, "ws2_32" , 0 ) \
_APPLY(shell32, "shell32" , 0 ) \
diff --git a/src/Thunks/bcrypt.hpp b/src/Thunks/bcrypt.hpp
index 2513fd9..45c23d8 100644
--- a/src/Thunks/bcrypt.hpp
+++ b/src/Thunks/bcrypt.hpp
@@ -139,7 +139,7 @@ namespace YY
WINAPI,
BCryptGenRandom,
_In_opt_ BCRYPT_ALG_HANDLE _hAlgorithm,
- _Out_writes_bytes_(cbBuffer) PUCHAR _pbBuffer,
+ _Out_writes_bytes_(_cbBuffer) PUCHAR _pbBuffer,
_In_ ULONG _cbBuffer,
_In_ ULONG _fFlags
)
@@ -180,4 +180,4 @@ namespace YY
}
#endif
}
-}
\ No newline at end of file
+}
diff --git a/src/YY-Thunks.UnitTest/YY-Thunks.UnitTest.vcxproj b/src/YY-Thunks.UnitTest/YY-Thunks.UnitTest.vcxproj
index 8f32298..0b19370 100644
--- a/src/YY-Thunks.UnitTest/YY-Thunks.UnitTest.vcxproj
+++ b/src/YY-Thunks.UnitTest/YY-Thunks.UnitTest.vcxproj
@@ -198,6 +198,7 @@
+
diff --git a/src/YY-Thunks.UnitTest/YY-Thunks.UnitTest.vcxproj.filters b/src/YY-Thunks.UnitTest/YY-Thunks.UnitTest.vcxproj.filters
index 7b5dfc2..9e237a7 100644
--- a/src/YY-Thunks.UnitTest/YY-Thunks.UnitTest.vcxproj.filters
+++ b/src/YY-Thunks.UnitTest/YY-Thunks.UnitTest.vcxproj.filters
@@ -236,6 +236,9 @@
Thunks
+
+ Thunks
+