[APPHELP][APPHELP_APITEST] Update SdbTagToString tests to check all known tags CORE...
authorMark Jansen <mark.jansen@reactos.org>
Sun, 24 Apr 2016 17:19:09 +0000 (17:19 +0000)
committerMark Jansen <mark.jansen@reactos.org>
Sun, 24 Apr 2016 17:19:09 +0000 (17:19 +0000)
- Add a list of hardcoded tags, for all versions up to win7 they are checked against windows.
- Update SdbTagToString with a few missing strings
- Hardcode the used version to Win7 for now, as backporting these strings would not make much sense.

svn path=/trunk/; revision=71200

reactos/dll/appcompat/apphelp/apphelp.h
reactos/dll/appcompat/apphelp/sdbapi.c
rostests/apitests/apphelp/apphelp.c

index b5e7cc7..1665b7f 100644 (file)
@@ -169,6 +169,7 @@ BOOL WINAPI SetPermLayerState(PCWSTR wszPath, PCWSTR wszLayer, DWORD dwFlags, BO
 #define TAG_PARAMETER1_RC_ID (0x29 | TAG_TYPE_DWORD)
 #define TAG_CONTEXT_TAGID (0x30 | TAG_TYPE_DWORD)
 #define TAG_EXE_WRAPPER (0x31 | TAG_TYPE_DWORD)
+#define TAG_URL_ID (0x32 | TAG_TYPE_DWORD)
 #define TAG_TAGID (0x801 | TAG_TYPE_DWORD)
 
 /* TAG_TYPE_QWORD */
@@ -222,6 +223,7 @@ BOOL WINAPI SetPermLayerState(PCWSTR wszPath, PCWSTR wszLayer, DWORD dwFlags, BO
 #define TAG_COMPILER_VERSION (0x22 | TAG_TYPE_STRINGREF)
 #define TAG_ACTION_TYPE (0x23 | TAG_TYPE_STRINGREF)
 #define TAG_EXPORT_NAME (0x24 | TAG_TYPE_STRINGREF)
+#define TAG_URL (0x25 | TAG_TYPE_STRINGREF)
 
 /* TAG_TYPE_LIST */
 #define TAG_DATABASE (0x1 | TAG_TYPE_LIST)
@@ -249,6 +251,7 @@ BOOL WINAPI SetPermLayerState(PCWSTR wszPath, PCWSTR wszLayer, DWORD dwFlags, BO
 #define TAG_LOOKUP (0x17 | TAG_TYPE_LIST)
 #define TAG_CONTEXT (0x18 | TAG_TYPE_LIST)
 #define TAG_CONTEXT_REF (0x19 | TAG_TYPE_LIST)
+#define TAG_SPC (0x20 | TAG_TYPE_LIST)
 #define TAG_STRINGTABLE (0x801 | TAG_TYPE_LIST)
 #define TAG_INDEXES (0x802 | TAG_TYPE_LIST)
 #define TAG_INDEX (0x803 | TAG_TYPE_LIST)
index 1172121..5c99d37 100644 (file)
@@ -213,7 +213,7 @@ void SdbpFree(LPVOID mem
 LPCWSTR WINAPI SdbTagToString(TAG tag)
 {
     /* lookup tables for tags in range 0x1 -> 0xFF | TYPE */
-    static const WCHAR table[9][0x31][25] = {
+    static const WCHAR table[9][0x32][25] = {
     {   /* TAG_TYPE_NULL */
         {'I','N','C','L','U','D','E',0},
         {'G','E','N','E','R','A','L',0},
@@ -284,7 +284,8 @@ LPCWSTR WINAPI SdbTagToString(TAG tag)
         {'I','n','v','a','l','i','d','T','a','g',0},
         {'I','n','v','a','l','i','d','T','a','g',0},
         {'C','O','N','T','E','X','T','_','T','A','G','I','D',0},
-        {'E','X','E','_','W','R','A','P','P','E','R',0}
+        {'E','X','E','_','W','R','A','P','P','E','R',0},
+        {'U','R','L','_','I','D',0}
     },
     {   /* TAG_TYPE_QWORD */
         {'T','I','M','E',0},
@@ -341,7 +342,8 @@ LPCWSTR WINAPI SdbTagToString(TAG tag)
         {'L','A','Y','E','R','_','D','I','S','P','L','A','Y','N','A','M','E',0},
         {'C','O','M','P','I','L','E','R','_','V','E','R','S','I','O','N',0},
         {'A','C','T','I','O','N','_','T','Y','P','E',0},
-        {'E','X','P','O','R','T','_','N','A','M','E',0}
+        {'E','X','P','O','R','T','_','N','A','M','E',0},
+        {'U','R','L',0}
     },
     {   /* TAG_TYPE_LIST */
         {'D','A','T','A','B','A','S','E',0},
@@ -368,7 +370,14 @@ LPCWSTR WINAPI SdbTagToString(TAG tag)
         {'A','C','T','I','O','N',0},
         {'L','O','O','K','U','P',0},
         {'C','O','N','T','E','X','T',0},
-        {'C','O','N','T','E','X','T','_','R','E','F',0}
+        {'C','O','N','T','E','X','T','_','R','E','F',0},
+        {'I','n','v','a','l','i','d','T','a','g',0},
+        {'I','n','v','a','l','i','d','T','a','g',0},
+        {'I','n','v','a','l','i','d','T','a','g',0},
+        {'I','n','v','a','l','i','d','T','a','g',0},
+        {'I','n','v','a','l','i','d','T','a','g',0},
+        {'I','n','v','a','l','i','d','T','a','g',0},
+        {'S','P','C',0}
     },
     {   /* TAG_TYPE_STRING */
         {'I','n','v','a','l','i','d','T','a','g',0}
@@ -400,10 +409,10 @@ LPCWSTR WINAPI SdbTagToString(TAG tag)
         TAG_REINSTALL_UPGRADE & 0xFF,
         1,
         TAG_MATCH_MODE & 0xFF,
-        TAG_EXE_WRAPPER & 0xFF,
+        TAG_URL_ID & 0xFF,
         TAG_FLAG_INSTALL & 0xFF,
-        TAG_EXPORT_NAME & 0xFF,
-        TAG_CONTEXT_REF & 0xFF,
+        TAG_URL & 0xFF,
+        TAG_SPC & 0xFF,
         1,
         TAG_APP_ID & 0xFF
     };
index 7779e57..8900c7a 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Copyright 2012 Detlef Riekenberg
- * Copyright 2013 Mislav Bla\9eevic
+ * Copyright 2013 Mislav Blažević
+ * Copyright 2016 Mark Jansen
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
 #include "wine/test.h"
 
 
+static DWORD g_Version;
+
+#define VERSION_ANY     0
+#define VERSION_WINXP   0x0501
+#define VERSION_2003    0x0502
+#define VERSION_VISTA   0x0600
+#define VERSION_WIN7    0x0601
+#define VERSION_WIN8    0x0602
+#define VERSION_WIN10   0x1000
+
+
 typedef WORD TAG;
 
 #define TAG_TYPE_MASK 0xF000
@@ -73,9 +85,311 @@ static void test_SdbTagToString(void)
     }
 }
 
+static int strcmp_wa(LPCWSTR strw, const char *stra)
+{
+    CHAR buf[512];
+    WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), 0, 0);
+    return lstrcmpA(buf, stra);
+}
+
+void test_tag(TAG base, const char* names[], size_t upperlimit, int line)
+{
+    TAG n;
+    for (n = 0; names[n]; ++n)
+    {
+        LPCWSTR tagstr = pSdbTagToString(base | n);
+        ok_(__FILE__, line + 2)(!strcmp_wa(tagstr, names[n]), "Got %s instead of '%s' for %x\n", wine_dbgstr_w(tagstr), names[n], base | n);
+    }
+    for (; n < upperlimit; ++n)
+    {
+        LPCWSTR tagstr = pSdbTagToString(base | n);
+        ok_(__FILE__, line + 2)(!strcmp_wa(tagstr, "InvalidTag"), "Got %s instead of 'InvalidTag' for %x\n", wine_dbgstr_w(tagstr), base | n);
+    }
+}
+
+static struct
+{
+    TAG base;
+    DWORD upper_limit;
+    DWORD line;
+    DWORD min_ver;
+    DWORD max_ver;
+    const char* tags[7*8];
+} data[] = {
+    {
+        TAG_TYPE_NULL, 0x1000, __LINE__, VERSION_ANY, VERSION_2003,
+        {
+            "InvalidTag", "INCLUDE", "GENERAL", "MATCH_LOGIC_NOT", "APPLY_ALL_SHIMS", "USE_SERVICE_PACK_FILES", NULL
+        }
+    },
+    {
+        TAG_TYPE_NULL, 0x1000, __LINE__, VERSION_VISTA, VERSION_VISTA,
+        {
+            "InvalidTag", "INCLUDE", "GENERAL", "MATCH_LOGIC_NOT", "APPLY_ALL_SHIMS", "USE_SERVICE_PACK_FILES", "MITIGATION_OS", "BLOCK_UPGRADE",
+            "INCLUDEEXCLUDEDLL", NULL
+        }
+    },
+    {
+        TAG_TYPE_NULL, 0x1000, __LINE__, VERSION_WIN7, VERSION_ANY,
+        {
+            "InvalidTag", "INCLUDE", "GENERAL", "MATCH_LOGIC_NOT", "APPLY_ALL_SHIMS", "USE_SERVICE_PACK_FILES", "MITIGATION_OS", "BLOCK_UPGRADE",
+            "INCLUDEEXCLUDEDLL", "RAC_EVENT_OFF", "TELEMETRY_OFF", "SHIM_ENGINE_OFF", "LAYER_PROPAGATION_OFF", "REINSTALL_UPGRADE", NULL
+        }
+    },
+
+    {
+        TAG_TYPE_BYTE, 0x1000, __LINE__, VERSION_ANY, VERSION_ANY,
+        {
+            "InvalidTag", NULL
+        }
+    },
+
+    {
+        TAG_TYPE_WORD, 0x800, __LINE__, VERSION_ANY, VERSION_WIN7,
+        {
+            "InvalidTag", "MATCH_MODE", NULL
+        }
+    },
+    {
+        TAG_TYPE_WORD, 0x800, __LINE__, VERSION_WIN8, VERSION_ANY,
+        {
+            "InvalidTag", "MATCH_MODE", "QUIRK_COMPONENT_CODE_ID", "QUIRK_CODE_ID", NULL
+        }
+    },
+    {
+        TAG_TYPE_WORD | 0x800, 0x800, __LINE__, VERSION_ANY, VERSION_ANY,
+        {
+            "InvalidTag", "TAG", "INDEX_TAG", "INDEX_KEY", NULL
+        }
+    },
+
+    {
+        TAG_TYPE_DWORD, 0x800, __LINE__, VERSION_ANY, VERSION_WINXP,
+        {
+            "InvalidTag", "SIZE", "OFFSET", "CHECKSUM", "SHIM_TAGID", "PATCH_TAGID", "MODULE_TYPE", "VERFILEDATEHI",
+            "VERFILEDATELO", "VERFILEOS", "VERFILETYPE", "PE_CHECKSUM", "PREVOSMAJORVERSION", "PREVOSMINORVERSION", "PREVOSPLATFORMID", "PREVOSBUILDNO",
+            "PROBLEM_SEVERITY", "APPHELP_LANGID", "VER_LANGUAGE", "InvalidTag", "ENGINE", "HTMLHELPID", "INDEXFLAGS", "FLAGS",
+            "VALUETYPE", "DATA_DWORD", "LAYER_TAGID", "MSI_TRANSFORM_TAGID", "LINKER_VERSION", "LINK_DATE", "UPTO_LINK_DATE", "OS_SERVICE_PACK",
+            "FLAG_TAGID", "RUNTIME_PLATFORM", "OS_SKU", NULL
+        }
+    },
+    {
+        TAG_TYPE_DWORD, 0x800, __LINE__, VERSION_2003, VERSION_2003,
+        {
+            "InvalidTag", "SIZE", "OFFSET", "CHECKSUM", "SHIM_TAGID", "PATCH_TAGID", "MODULE_TYPE", "VERFILEDATEHI",
+            "VERFILEDATELO", "VERFILEOS", "VERFILETYPE", "PE_CHECKSUM", "PREVOSMAJORVERSION", "PREVOSMINORVERSION", "PREVOSPLATFORMID", "PREVOSBUILDNO",
+            "PROBLEM_SEVERITY", "APPHELP_LANGID", "VER_LANGUAGE", "InvalidTag", "ENGINE", "HTMLHELPID", "INDEXFLAGS", "FLAGS",
+            "VALUETYPE", "DATA_DWORD", "LAYER_TAGID", "MSI_TRANSFORM_TAGID", "LINKER_VERSION", "LINK_DATE", "UPTO_LINK_DATE", "OS_SERVICE_PACK",
+            "FLAG_TAGID", "RUNTIME_PLATFORM", "OS_SKU", "OS_PLATFORM", NULL
+        }
+    },
+    {
+        TAG_TYPE_DWORD, 0x800, __LINE__, VERSION_VISTA, VERSION_VISTA,
+        {
+            "InvalidTag", "SIZE", "OFFSET", "CHECKSUM", "SHIM_TAGID", "PATCH_TAGID", "MODULE_TYPE", "VERDATEHI",
+            "VERDATELO", "VERFILEOS", "VERFILETYPE", "PE_CHECKSUM", "PREVOSMAJORVER", "PREVOSMINORVER", "PREVOSPLATFORMID", "PREVOSBUILDNO",
+            "PROBLEMSEVERITY", "LANGID", "VER_LANGUAGE", "InvalidTag", "ENGINE", "HTMLHELPID", "INDEX_FLAGS", "FLAGS",
+            "DATA_VALUETYPE", "DATA_DWORD", "LAYER_TAGID", "MSI_TRANSFORM_TAGID", "LINKER_VERSION", "LINK_DATE", "UPTO_LINK_DATE", "OS_SERVICE_PACK",
+            "FLAG_TAGID", "RUNTIME_PLATFORM", "OS_SKU", "OS_PLATFORM", "APP_NAME_RC_ID", "VENDOR_NAME_RC_ID", "SUMMARY_MSG_RC_ID", "VISTA_SKU",
+            NULL
+        }
+    },
+    {
+        TAG_TYPE_DWORD, 0x800, __LINE__, VERSION_WIN7, VERSION_ANY,
+        {
+            "InvalidTag", "SIZE", "OFFSET", "CHECKSUM", "SHIM_TAGID", "PATCH_TAGID", "MODULE_TYPE", "VERDATEHI",
+            "VERDATELO", "VERFILEOS", "VERFILETYPE", "PE_CHECKSUM", "PREVOSMAJORVER", "PREVOSMINORVER", "PREVOSPLATFORMID", "PREVOSBUILDNO",
+            "PROBLEMSEVERITY", "LANGID", "VER_LANGUAGE", "InvalidTag", "ENGINE", "HTMLHELPID", "INDEX_FLAGS", "FLAGS",
+            "DATA_VALUETYPE", "DATA_DWORD", "LAYER_TAGID", "MSI_TRANSFORM_TAGID", "LINKER_VERSION", "LINK_DATE", "UPTO_LINK_DATE", "OS_SERVICE_PACK",
+            "FLAG_TAGID", "RUNTIME_PLATFORM", "OS_SKU", "OS_PLATFORM", "APP_NAME_RC_ID", "VENDOR_NAME_RC_ID", "SUMMARY_MSG_RC_ID", "VISTA_SKU",
+            "DESCRIPTION_RC_ID", "PARAMETER1_RC_ID", "InvalidTag", "InvalidTag", "InvalidTag", "InvalidTag", "InvalidTag", "InvalidTag", 
+            "CONTEXT_TAGID", "EXE_WRAPPER", "URL_ID", NULL
+        }
+    },
+    {
+        TAG_TYPE_DWORD | 0x800, 0x800, __LINE__, VERSION_ANY, VERSION_ANY,
+        {
+            "InvalidTag", "TAGID", NULL
+        }
+    },
+
+    {
+        TAG_TYPE_QWORD, 0x1000, __LINE__, VERSION_ANY, VERSION_WINXP,
+        {
+            "InvalidTag", "TIME", "BIN_FILE_VERSION", "BIN_PRODUCT_VERSION", "MODTIME", "FLAG_MASK_KERNEL", "UPTO_BIN_PRODUCT_VERSION", "DATA_QWORD",
+            "FLAG_MASK_USER", "FLAGS_NTVDM1", "FLAGS_NTVDM2", "FLAGS_NTVDM3", "FLAG_MASK_SHELL", "UPTO_BIN_FILE_VERSION", NULL
+        }
+    },
+    {
+        TAG_TYPE_QWORD, 0x1000, __LINE__, VERSION_2003, VERSION_2003,
+        {
+            "InvalidTag", "TIME", "BIN_FILE_VERSION", "BIN_PRODUCT_VERSION", "MODTIME", "FLAG_MASK_KERNEL", "UPTO_BIN_PRODUCT_VERSION", "DATA_QWORD",
+            "FLAG_MASK_USER", "FLAGS_NTVDM1", "FLAGS_NTVDM2", "FLAGS_NTVDM3", "FLAG_MASK_SHELL", "UPTO_BIN_FILE_VERSION", "FLAG_MASK_FUSION", "FLAGS_PROCESSPARAM",
+            NULL
+        }
+    },
+    {
+        TAG_TYPE_QWORD, 0x1000, __LINE__, VERSION_VISTA, VERSION_ANY,
+        {
+            "InvalidTag", "TIME", "BIN_FILE_VERSION", "BIN_PRODUCT_VERSION", "MODTIME", "FLAG_MASK_KERNEL", "UPTO_BIN_PRODUCT_VERSION", "DATA_QWORD",
+            "FLAG_MASK_USER", "FLAGS_NTVDM1", "FLAGS_NTVDM2", "FLAGS_NTVDM3", "FLAG_MASK_SHELL", "UPTO_BIN_FILE_VERSION", "FLAG_MASK_FUSION", "FLAG_PROCESSPARAM",
+            "FLAG_LUA", "FLAG_INSTALL", NULL
+        }
+    },
+
+    {
+        TAG_TYPE_STRINGREF, 0x1000, __LINE__, VERSION_ANY, VERSION_2003,
+        {
+            "InvalidTag", "NAME", "DESCRIPTION", "MODULE", "API", "VENDOR", "APP_NAME", "InvalidTag",
+            "COMMAND_LINE", "COMPANY_NAME", "DLLFILE", "WILDCARD_NAME", "InvalidTag", "InvalidTag", "InvalidTag", "InvalidTag",
+            "PRODUCT_NAME", "PRODUCT_VERSION", "FILE_DESCRIPTION", "FILE_VERSION", "ORIGINAL_FILENAME", "INTERNAL_NAME", "LEGAL_COPYRIGHT", "S16BIT_DESCRIPTION",
+            "PROBLEM_DETAILS", "LINK_URL", "LINK_TEXT", "APPHELP_TITLE", "APPHELP_CONTACT", "SXS_MANIFEST", "DATA_STRING", "MSI_TRANSFORM_FILE",
+            "S16BIT_MODULE_NAME", "LAYER_DISPLAYNAME", "COMPILER_VERSION", "ACTION_TYPE", NULL
+        }
+    },
+    {
+        TAG_TYPE_STRINGREF, 0x1000, __LINE__, VERSION_VISTA, VERSION_VISTA,
+        {
+            "InvalidTag", "NAME", "DESCRIPTION", "MODULE", "API", "VENDOR", "APP_NAME", "InvalidTag",
+            "COMMAND_LINE", "COMPANY_NAME", "DLLFILE", "WILDCARD_NAME", "InvalidTag", "InvalidTag", "InvalidTag", "InvalidTag",
+            "PRODUCT_NAME", "PRODUCT_VERSION", "FILE_DESCRIPTION", "FILE_VERSION", "ORIGINAL_FILENAME", "INTERNAL_NAME", "LEGAL_COPYRIGHT", "16BIT_DESCRIPTION",
+            "APPHELP_DETAILS", "LINK_URL", "LINK_TEXT", "APPHELP_TITLE", "APPHELP_CONTACT", "SXS_MANIFEST", "DATA_STRING", "MSI_TRANSFORM_FILE",
+            "16BIT_MODULE_NAME", "LAYER_DISPLAYNAME", "COMPILER_VERSION", "ACTION_TYPE", "EXPORT_NAME", NULL
+        }
+    },
+    {
+        TAG_TYPE_STRINGREF, 0x1000, __LINE__, VERSION_WIN7, VERSION_ANY,
+        {
+            "InvalidTag", "NAME", "DESCRIPTION", "MODULE", "API", "VENDOR", "APP_NAME", "InvalidTag",
+            "COMMAND_LINE", "COMPANY_NAME", "DLLFILE", "WILDCARD_NAME", "InvalidTag", "InvalidTag", "InvalidTag", "InvalidTag",
+            "PRODUCT_NAME", "PRODUCT_VERSION", "FILE_DESCRIPTION", "FILE_VERSION", "ORIGINAL_FILENAME", "INTERNAL_NAME", "LEGAL_COPYRIGHT", "16BIT_DESCRIPTION",
+            "APPHELP_DETAILS", "LINK_URL", "LINK_TEXT", "APPHELP_TITLE", "APPHELP_CONTACT", "SXS_MANIFEST", "DATA_STRING", "MSI_TRANSFORM_FILE",
+            "16BIT_MODULE_NAME", "LAYER_DISPLAYNAME", "COMPILER_VERSION", "ACTION_TYPE", "EXPORT_NAME", "URL", NULL
+        }
+    },
+
+    {
+        TAG_TYPE_LIST, 0x800, __LINE__, VERSION_ANY, VERSION_2003,
+        {
+            "InvalidTag", "DATABASE", "LIBRARY", "INEXCLUDE", "SHIM", "PATCH", "APP", "EXE",
+            "MATCHING_FILE", "SHIM_REF", "PATCH_REF", "LAYER", "FILE", "APPHELP", "LINK", "DATA",
+            "MSI TRANSFORM", "MSI TRANSFORM REF", "MSI PACKAGE", "FLAG", "MSI CUSTOM ACTION", "FLAG_REF", "ACTION", NULL
+        }
+    },
+    {
+        TAG_TYPE_LIST, 0x800, __LINE__, VERSION_VISTA, VERSION_VISTA,
+        {
+            "InvalidTag", "DATABASE", "LIBRARY", "INEXCLUDE", "SHIM", "PATCH", "APP", "EXE",
+            "MATCHING_FILE", "SHIM_REF", "PATCH_REF", "LAYER", "FILE", "APPHELP", "LINK", "DATA",
+            "MSI_TRANSFORM", "MSI_TRANSFORM_REF", "MSI_PACKAGE", "FLAG", "MSI_CUSTOM_ACTION", "FLAG_REF", "ACTION", "LOOKUP",
+            NULL
+        }
+    },
+    {
+        TAG_TYPE_LIST, 0x800, __LINE__, VERSION_WIN7, VERSION_ANY,
+        {
+            "InvalidTag", "DATABASE", "LIBRARY", "INEXCLUDE", "SHIM", "PATCH", "APP", "EXE",
+            "MATCHING_FILE", "SHIM_REF", "PATCH_REF", "LAYER", "FILE", "APPHELP", "LINK", "DATA",
+            "MSI_TRANSFORM", "MSI_TRANSFORM_REF", "MSI_PACKAGE", "FLAG", "MSI_CUSTOM_ACTION", "FLAG_REF", "ACTION", "LOOKUP",
+            "CONTEXT", "CONTEXT_REF", "InvalidTag", "InvalidTag", "InvalidTag", "InvalidTag", "InvalidTag", "InvalidTag",
+            "SPC", NULL
+        }
+    },
+    {
+        TAG_TYPE_LIST | 0x800, 0x800, __LINE__, VERSION_ANY, VERSION_ANY,
+        {
+            "InvalidTag", "STRINGTABLE", "INDEXES", "INDEX", NULL
+        }
+    },
+
+    {
+        TAG_TYPE_STRING, 0x800, __LINE__, VERSION_ANY, VERSION_ANY,
+        {
+            "InvalidTag", NULL
+        }
+    },
+    {
+        TAG_TYPE_STRING | 0x800, 0x800, __LINE__, VERSION_ANY, VERSION_2003,
+        {
+            "InvalidTag", "STRTAB_ITEM", NULL
+        }
+    },
+    {
+        TAG_TYPE_STRING | 0x800, 0x800, __LINE__, VERSION_VISTA, VERSION_ANY,
+        {
+            "InvalidTag", "STRINGTABLE_ITEM", NULL
+        }
+    },
+
+
+    {
+        TAG_TYPE_BINARY, 0x800, __LINE__, VERSION_ANY, VERSION_2003,
+        {
+            "InvalidTag", "InvalidTag", "PATCH_BITS", "FILE_BITS", "EXE_ID(GUID)", "DATA_BITS", "MSI_PACKAGE_ID(GUID)", "DATABASE_ID(GUID)",
+            NULL
+        }
+    },
+    {
+        TAG_TYPE_BINARY, 0x800, __LINE__, VERSION_VISTA, VERSION_VISTA,
+        {
+            "InvalidTag", "InvalidTag", "PATCH_BITS", "FILE_BITS", "EXE_ID", "DATA_BITS", "MSI_PACKAGE_ID", "DATABASE_ID",
+            NULL
+        }
+    },
+    {
+        TAG_TYPE_BINARY, 0x800, __LINE__, VERSION_WIN7, VERSION_ANY,
+        {
+            "InvalidTag", "InvalidTag", "PATCH_BITS", "FILE_BITS", "EXE_ID", "DATA_BITS", "MSI_PACKAGE_ID", "DATABASE_ID",
+            "CONTEXT_PLATFORM_ID", "CONTEXT_BRANCH_ID", "InvalidTag", "InvalidTag", "InvalidTag", "InvalidTag", "InvalidTag", "InvalidTag",
+            "FIX_ID", "APP_ID", NULL
+        }
+    },
+    {
+        TAG_TYPE_BINARY | 0x800, 0x800, __LINE__, VERSION_ANY, VERSION_ANY,
+        {
+            "InvalidTag", "INDEX_BITS", NULL
+        }
+    },
+
+    { 0, 0, 0, 0, 0, { NULL } }
+};
+
+
+static void test_SdbTagToStringAllTags(void)
+{
+    int n;
+    for (n = 0; data[n].base; ++n)
+    {
+        if ((data[n].min_ver == VERSION_ANY || g_Version >= data[n].min_ver) &&
+            (data[n].max_ver == VERSION_ANY || g_Version <= data[n].max_ver))
+        {
+            test_tag(data[n].base, data[n].tags, data[n].upper_limit, data[n].line);
+        }
+    }
+}
+
 START_TEST(apphelp)
 {
+    RTL_OSVERSIONINFOEXW rtlinfo;
+    rtlinfo.dwOSVersionInfoSize = sizeof(rtlinfo);
+#ifdef __REACTOS__
+    RtlGetVersion((PRTL_OSVERSIONINFOW)&rtlinfo);
+#else
+    RtlGetVersion(&rtlinfo);
+#endif
+    g_Version = (rtlinfo.dwMajorVersion << 8) | rtlinfo.dwMinorVersion;
+    trace("Detected version: 0x%x\n", g_Version);
+    //SetEnvironmentVariable("SHIM_DEBUG_LEVEL", "4");
+    //SetEnvironmentVariable("DEBUGCHANNEL", "+apphelp");
     hdll = LoadLibraryA("apphelp.dll");
     pSdbTagToString = (void *) GetProcAddress(hdll, "SdbTagToString");
     test_SdbTagToString();
+#ifdef __REACTOS__
+    if (g_Version < VERSION_WIN7)
+    {
+        g_Version = VERSION_WIN7;
+        trace("Using version 0x%x for SdbTagToString tests\n", g_Version);
+    }
+#endif
+    test_SdbTagToStringAllTags();
 }