[PATCH 4/4] kernel32: Implement compatibility mode for VerifyVersionInfo.

Gabriel Ivăncescu gabrielopcode at gmail.com
Mon Mar 16 08:06:01 CDT 2020


Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
 dlls/kernel32/version.c |  7 ++++++-
 dlls/ntdll/ntdll.spec   |  1 +
 dlls/ntdll/version.c    | 18 ++++++++++++++++++
 3 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/dlls/kernel32/version.c b/dlls/kernel32/version.c
index 5f33847..d67bef5 100644
--- a/dlls/kernel32/version.c
+++ b/dlls/kernel32/version.c
@@ -41,6 +41,8 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(ver);
 
+extern NTSTATUS CDECL __wine_verify_compat_win_version(const RTL_OSVERSIONINFOEXW*,DWORD,DWORDLONG);
+
 
 /******************************************************************************
  *        VerifyVersionInfoA   (KERNEL32.@)
@@ -71,11 +73,14 @@ BOOL WINAPI VerifyVersionInfoA( LPOSVERSIONINFOEXA lpVersionInfo, DWORD dwTypeMa
 BOOL WINAPI VerifyVersionInfoW( LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMask,
                                 DWORDLONG dwlConditionMask)
 {
-    switch(RtlVerifyVersionInfo( lpVersionInfo, dwTypeMask, dwlConditionMask ))
+    switch(__wine_verify_compat_win_version( lpVersionInfo, dwTypeMask, dwlConditionMask ))
     {
     case STATUS_INVALID_PARAMETER:
         SetLastError( ERROR_BAD_ARGUMENTS );
         return FALSE;
+    case STATUS_NO_MEMORY:
+        SetLastError( ERROR_NOT_ENOUGH_MEMORY );
+        return FALSE;
     case STATUS_REVISION_MISMATCH:
         SetLastError( ERROR_OLD_WIN_VERSION );
         return FALSE;
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 5f58e4a..5cc6d63 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -1573,6 +1573,7 @@
 @ cdecl wine_get_build_id() NTDLL_wine_get_build_id
 @ cdecl wine_get_host_version(ptr ptr) NTDLL_wine_get_host_version
 @ cdecl __wine_get_compat_win_version()
+@ cdecl __wine_verify_compat_win_version()
 
 # Codepages
 @ cdecl __wine_get_unix_codepage()
diff --git a/dlls/ntdll/version.c b/dlls/ntdll/version.c
index 60c4942..76df243 100644
--- a/dlls/ntdll/version.c
+++ b/dlls/ntdll/version.c
@@ -874,3 +874,21 @@ CDECL const RTL_OSVERSIONINFOEXW *__wine_get_compat_win_version(void)
 
     return compat_ver;
 }
+
+/******************************************************************************
+ *  __wine_verify_compat_win_version   (NTDLL.@)
+ *
+ * Same as RtlVerifyVersionInfo, but uses compatibility mode.
+ * See __wine_get_compat_win_version for more information.
+ *
+ */
+NTSTATUS CDECL __wine_verify_compat_win_version( const RTL_OSVERSIONINFOEXW *info,
+                                                 DWORD dwTypeMask, DWORDLONG dwlConditionMask )
+{
+    const RTL_OSVERSIONINFOEXW *ver;
+
+    if (!(ver = __wine_get_compat_win_version()))
+        return STATUS_NO_MEMORY;
+
+    return verify_version_info(info, ver, dwTypeMask, dwlConditionMask);
+}
-- 
2.21.0




More information about the wine-devel mailing list