https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bcb2613684fe74ca34d1286688620ed2c7ae844e

commit bcb2613684fe74ca34d1286688620ed2c7ae844e
Author:     Mark Jansen <mark.jan...@reactos.org>
AuthorDate: Wed Apr 11 00:05:41 2018 +0200
Commit:     Mark Jansen <mark.jan...@reactos.org>
CommitDate: Thu Apr 12 18:49:25 2018 +0200

    [SDB][APPHELP] Add ShimVersionNT data tags + read them in 
SdbPackAppCompatData
---
 dll/appcompat/apphelp/hsdb.c | 24 +++++++++++++++++++++++-
 media/sdb/sysmain.xml        |  9 +++++++++
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/dll/appcompat/apphelp/hsdb.c b/dll/appcompat/apphelp/hsdb.c
index ddc501b539..b450e30ac9 100644
--- a/dll/appcompat/apphelp/hsdb.c
+++ b/dll/appcompat/apphelp/hsdb.c
@@ -686,6 +686,7 @@ BOOL WINAPI SdbPackAppCompatData(HSDB hsdb, PSDBQUERYRESULT 
pQueryResult, PVOID*
     ShimData* pData;
     HRESULT hr;
     DWORD n;
+    BOOL bCloseDatabase = FALSE;
 
     if (!pQueryResult || !ppData || !pdwSize)
     {
@@ -719,13 +720,34 @@ BOOL WINAPI SdbPackAppCompatData(HSDB hsdb, 
PSDBQUERYRESULT pQueryResult, PVOID*
               pData->Query.dwFlags, pData->dwMagic, pData->Query.atrExes[0], 
pData->Query.atrLayers[0]);
 
     /* Database List */
-    /* 0x0 {GUID} NAME */
+    /* 0x0 {GUID} NAME: Use to open HSDB */
+    if (hsdb == NULL)
+    {
+        hsdb = SdbInitDatabase(HID_DOS_PATHS | SDB_DATABASE_MAIN_SHIM, NULL);
+        bCloseDatabase = TRUE;
+    }
 
     for (n = 0; n < pQueryResult->dwLayerCount; ++n)
     {
+        DWORD dwValue = 0, dwType;
+        DWORD dwValueSize = sizeof(dwValue);
         SHIM_INFO("Layer 0x%x\n", pQueryResult->atrLayers[n]);
+
+        if (SdbQueryData(hsdb, pQueryResult->atrLayers[n], L"SHIMVERSIONNT", 
&dwType, &dwValue, &dwValueSize) == ERROR_SUCCESS &&
+            dwType == REG_DWORD && dwValueSize == sizeof(dwValue))
+        {
+            dwValue = (dwValue % 100) | ((dwValue / 100) << 8);
+            if (dwValue > pData->dwRosProcessCompatVersion)
+                pData->dwRosProcessCompatVersion = dwValue;
+        }
     }
 
+    if (pData->dwRosProcessCompatVersion)
+        SHIM_INFO("Setting ProcessCompatVersion 0x%x\n", 
pData->dwRosProcessCompatVersion);
+
+    if (bCloseDatabase)
+        SdbReleaseDatabase(hsdb);
+
     *ppData = pData;
     *pdwSize = pData->dwSize;
 
diff --git a/media/sdb/sysmain.xml b/media/sdb/sysmain.xml
index a27542e38e..c451c28d50 100644
--- a/media/sdb/sysmain.xml
+++ b/media/sdb/sysmain.xml
@@ -283,38 +283,47 @@
         </LAYER>
         <LAYER NAME="VISTARTM">
             <SHIM_REF NAME="VistaRTMVersionLie" />
+            <DATA NAME="SHIMVERSIONNT" DATA_DWORD="600" />
             <!-- TODO: Add more fixes! -->
         </LAYER>
         <LAYER NAME="VISTASP1">
             <SHIM_REF NAME="VistaSP1VersionLie" />
+            <DATA NAME="SHIMVERSIONNT" DATA_DWORD="600" />
             <!-- TODO: Add more fixes! -->
         </LAYER>
         <LAYER NAME="VISTASP2">
             <SHIM_REF NAME="VistaSP2VersionLie" />
+            <DATA NAME="SHIMVERSIONNT" DATA_DWORD="600" />
             <!-- TODO: Add more fixes! -->
         </LAYER>
         <LAYER NAME="WINSRV08">
             <SHIM_REF NAME="VistaRTMVersionLie" />
+            <DATA NAME="SHIMVERSIONNT" DATA_DWORD="600" />
             <!-- TODO: Add more fixes! -->
         </LAYER>
         <LAYER NAME="WINSRV08SP1">
             <SHIM_REF NAME="VistaSP1VersionLie" />
+            <DATA NAME="SHIMVERSIONNT" DATA_DWORD="600" />
             <!-- TODO: Add more fixes! -->
         </LAYER>
         <LAYER NAME="WINSRV08SP2">
             <SHIM_REF NAME="VistaSP2VersionLie" />
+            <DATA NAME="SHIMVERSIONNT" DATA_DWORD="600" />
             <!-- TODO: Add more fixes! -->
         </LAYER>
         <LAYER NAME="WIN7RTM">
             <SHIM_REF NAME="Win7RTMVersionLie" />
+            <DATA NAME="SHIMVERSIONNT" DATA_DWORD="601" />
             <!-- TODO: Add more fixes! -->
         </LAYER>
         <LAYER NAME="WIN8RTM">
             <SHIM_REF NAME="Win8RTMVersionLie" />
+            <DATA NAME="SHIMVERSIONNT" DATA_DWORD="602" />
             <!-- TODO: Add more fixes! -->
         </LAYER>
         <LAYER NAME="WIN81RTM">
             <SHIM_REF NAME="Win81RTMVersionLie" />
+            <DATA NAME="SHIMVERSIONNT" DATA_DWORD="603" />
             <!-- TODO: Add more fixes! -->
         </LAYER>
 

Reply via email to