Author: mjansen
Date: Sun Apr 24 13:05:00 2016
New Revision: 71197
URL:
http://svn.reactos.org/svn/reactos?rev=71197&view=rev
Log:
[APPHELP][APPHELP_APITEST] Add SdbTagToString + test by Mislav Blažević CORE-10367
Added:
trunk/rostests/apitests/apphelp/apphelp.c (with props)
Modified:
trunk/reactos/dll/appcompat/apphelp/apphelp.h
trunk/reactos/dll/appcompat/apphelp/apphelp.spec
trunk/reactos/dll/appcompat/apphelp/sdbapi.c
trunk/rostests/apitests/apphelp/CMakeLists.txt
trunk/rostests/apitests/apphelp/testlist.c
Modified: trunk/reactos/dll/appcompat/apphelp/apphelp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/apph…
==============================================================================
--- trunk/reactos/dll/appcompat/apphelp/apphelp.h [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/apphelp.h [iso-8859-1] Sun Apr 24 13:05:00 2016
@@ -24,6 +24,14 @@
extern "C" {
#endif
+typedef WORD TAG;
+typedef DWORD TAGID;
+typedef DWORD TAGREF;
+typedef UINT64 QWORD;
+
+#define TAGREF_NULL (0)
+#define TAGREF_ROOT (0)
+
typedef enum _SHIM_LOG_LEVEL {
SHIM_ERR = 1,
SHIM_WARN = 2,
@@ -71,6 +79,196 @@
BOOL WINAPI SetPermLayerState(PCWSTR wszPath, PCWSTR wszLayer, DWORD dwFlags, BOOL
bMachine, BOOL bEnable);
+#define TAGID_NULL 0x0
+#define TAGID_ROOT 0x0
+
+/* The above definition of TAGID_ROOT is used in winapi and can be found
+ * on msdn it but doesn't make sense, especially internally, because
+ * TAGID represents offset into database data and there is a header at
+ * offset 0, NOT a tag. Therfore, this definition should be used internally
+ * to represent first valid TAGID. Header size is 12 bytes. */
+#define _TAGID_ROOT 12
+
+#define TAG_TYPE_MASK 0xF000
+
+#define TAG_TYPE_NULL 0x1000
+#define TAG_TYPE_BYTE 0x2000
+#define TAG_TYPE_WORD 0x3000
+#define TAG_TYPE_DWORD 0x4000
+#define TAG_TYPE_QWORD 0x5000
+#define TAG_TYPE_STRINGREF 0x6000
+#define TAG_TYPE_LIST 0x7000
+#define TAG_TYPE_STRING 0x8000
+#define TAG_TYPE_BINARY 0x9000
+
+#define TAG_NULL 0x0
+
+/* TAG_TYPE_NULL */
+#define TAG_INCLUDE (0x1 | TAG_TYPE_NULL)
+#define TAG_GENERAL (0x2 | TAG_TYPE_NULL)
+#define TAG_MATCH_LOGIC_NOT (0x3 | TAG_TYPE_NULL)
+#define TAG_APPLY_ALL_SHIMS (0x4 | TAG_TYPE_NULL)
+#define TAG_USE_SERVICE_PACK_FILES (0x5 | TAG_TYPE_NULL)
+#define TAG_MITIGATION_OS (0x6 | TAG_TYPE_NULL)
+#define TAG_BLOCK_UPGRADE (0x7 | TAG_TYPE_NULL)
+#define TAG_INCLUDEEXCLUDEDLL (0x8 | TAG_TYPE_NULL)
+#define TAG_RAC_EVENT_OFF (0x9 | TAG_TYPE_NULL)
+#define TAG_TELEMETRY_OFF (0xA | TAG_TYPE_NULL)
+#define TAG_SHIM_ENGINE_OFF (0xB | TAG_TYPE_NULL)
+#define TAG_LAYER_PROPAGATION_OFF (0xC | TAG_TYPE_NULL)
+#define TAG_REINSTALL_UPGRADE (0xD | TAG_TYPE_NULL)
+
+/* TAG_TYPE_BYTE */
+
+/* TAG_TYPE_WORD */
+#define TAG_MATCH_MODE (0x1 | TAG_TYPE_WORD)
+#define TAG_TAG (0x801 | TAG_TYPE_WORD)
+#define TAG_INDEX_TAG (0x802 | TAG_TYPE_WORD)
+#define TAG_INDEX_KEY (0x803 | TAG_TYPE_WORD)
+
+/* TAG_TYPE_DWORD */
+#define TAG_SIZE (0x1 | TAG_TYPE_DWORD)
+#define TAG_OFFSET (0x2 | TAG_TYPE_DWORD)
+#define TAG_CHECKSUM (0x3 | TAG_TYPE_DWORD)
+#define TAG_SHIM_TAGID (0x4 | TAG_TYPE_DWORD)
+#define TAG_PATCH_TAGID (0x5 | TAG_TYPE_DWORD)
+#define TAG_MODULE_TYPE (0x6 | TAG_TYPE_DWORD)
+#define TAG_VERDATEHI (0x7 | TAG_TYPE_DWORD)
+#define TAG_VERDATELO (0x8 | TAG_TYPE_DWORD)
+#define TAG_VERFILEOS (0x9 | TAG_TYPE_DWORD)
+#define TAG_VERFILETYPE (0xA | TAG_TYPE_DWORD)
+#define TAG_PE_CHECKSUM (0xB | TAG_TYPE_DWORD)
+#define TAG_PREVOSMAJORVER (0xC | TAG_TYPE_DWORD)
+#define TAG_PREVOSMINORVER (0xD | TAG_TYPE_DWORD)
+#define TAG_PREVOSPLATFORMID (0xE | TAG_TYPE_DWORD)
+#define TAG_PREVOSBUILDNO (0xF | TAG_TYPE_DWORD)
+#define TAG_PROBLEMSEVERITY (0x10 | TAG_TYPE_DWORD)
+#define TAG_LANGID (0x11 | TAG_TYPE_DWORD)
+#define TAG_VER_LANGUAGE (0x12 | TAG_TYPE_DWORD)
+#define TAG_ENGINE (0x14 | TAG_TYPE_DWORD)
+#define TAG_HTMLHELPID (0x15 | TAG_TYPE_DWORD)
+#define TAG_INDEX_FLAGS (0x16 | TAG_TYPE_DWORD)
+#define TAG_FLAGS (0x17 | TAG_TYPE_DWORD)
+#define TAG_DATA_VALUETYPE (0x18 | TAG_TYPE_DWORD)
+#define TAG_DATA_DWORD (0x19 | TAG_TYPE_DWORD)
+#define TAG_LAYER_TAGID (0x1A | TAG_TYPE_DWORD)
+#define TAG_MSI_TRANSFORM_TAGID (0x1B | TAG_TYPE_DWORD)
+#define TAG_LINKER_VERSION (0x1C | TAG_TYPE_DWORD)
+#define TAG_LINK_DATE (0x1D | TAG_TYPE_DWORD)
+#define TAG_UPTO_LINK_DATE (0x1E | TAG_TYPE_DWORD)
+#define TAG_OS_SERVICE_PACK (0x1F | TAG_TYPE_DWORD)
+#define TAG_FLAG_TAGID (0x20 | TAG_TYPE_DWORD)
+#define TAG_RUNTIME_PLATFORM (0x21 | TAG_TYPE_DWORD)
+#define TAG_OS_SKU (0x22 | TAG_TYPE_DWORD)
+#define TAG_OS_PLATFORM (0x23 | TAG_TYPE_DWORD)
+#define TAG_APP_NAME_RC_ID (0x24 | TAG_TYPE_DWORD)
+#define TAG_VENDOR_NAME_RC_ID (0x25 | TAG_TYPE_DWORD)
+#define TAG_SUMMARY_MSG_RC_ID (0x26 | TAG_TYPE_DWORD)
+#define TAG_VISTA_SKU (0x27 | TAG_TYPE_DWORD)
+#define TAG_DESCRIPTION_RC_ID (0x28 | TAG_TYPE_DWORD)
+#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_TAGID (0x801 | TAG_TYPE_DWORD)
+
+/* TAG_TYPE_QWORD */
+#define TAG_TIME (0x1 | TAG_TYPE_QWORD)
+#define TAG_BIN_FILE_VERSION (0x2 | TAG_TYPE_QWORD)
+#define TAG_BIN_PRODUCT_VERSION (0x3 | TAG_TYPE_QWORD)
+#define TAG_MODTIME (0x4 | TAG_TYPE_QWORD)
+#define TAG_FLAG_MASK_KERNEL (0x5 | TAG_TYPE_QWORD)
+#define TAG_UPTO_BIN_PRODUCT_VERSION (0x6 | TAG_TYPE_QWORD)
+#define TAG_DATA_QWORD (0x7 | TAG_TYPE_QWORD)
+#define TAG_FLAG_MASK_USER (0x8 | TAG_TYPE_QWORD)
+#define TAG_FLAGS_NTVDM1 (0x9 | TAG_TYPE_QWORD)
+#define TAG_FLAGS_NTVDM2 (0xA | TAG_TYPE_QWORD)
+#define TAG_FLAGS_NTVDM3 (0xB | TAG_TYPE_QWORD)
+#define TAG_FLAG_MASK_SHELL (0xC | TAG_TYPE_QWORD)
+#define TAG_UPTO_BIN_FILE_VERSION (0xD | TAG_TYPE_QWORD)
+#define TAG_FLAG_MASK_FUSION (0xE | TAG_TYPE_QWORD)
+#define TAG_FLAG_PROCESSPARAM (0xF | TAG_TYPE_QWORD)
+#define TAG_FLAG_LUA (0x10 | TAG_TYPE_QWORD)
+#define TAG_FLAG_INSTALL (0x11 | TAG_TYPE_QWORD)
+
+/* TAG_TYPE_STRINGREF */
+#define TAG_NAME (0x1 | TAG_TYPE_STRINGREF)
+#define TAG_DESCRIPTION (0x2 | TAG_TYPE_STRINGREF)
+#define TAG_MODULE (0x3 | TAG_TYPE_STRINGREF)
+#define TAG_API (0x4 | TAG_TYPE_STRINGREF)
+#define TAG_VENDOR (0x5 | TAG_TYPE_STRINGREF)
+#define TAG_APP_NAME (0x6 | TAG_TYPE_STRINGREF)
+#define TAG_COMMAND_LINE (0x8 | TAG_TYPE_STRINGREF)
+#define TAG_COMPANY_NAME (0x9 | TAG_TYPE_STRINGREF)
+#define TAG_DLLFILE (0xA | TAG_TYPE_STRINGREF)
+#define TAG_WILDCARD_NAME (0xB | TAG_TYPE_STRINGREF)
+#define TAG_PRODUCT_NAME (0x10 | TAG_TYPE_STRINGREF)
+#define TAG_PRODUCT_VERSION (0x11 | TAG_TYPE_STRINGREF)
+#define TAG_FILE_DESCRIPTION (0x12 | TAG_TYPE_STRINGREF)
+#define TAG_FILE_VERSION (0x13 | TAG_TYPE_STRINGREF)
+#define TAG_ORIGINAL_FILENAME (0x14 | TAG_TYPE_STRINGREF)
+#define TAG_INTERNAL_NAME (0x15 | TAG_TYPE_STRINGREF)
+#define TAG_LEGAL_COPYRIGHT (0x16 | TAG_TYPE_STRINGREF)
+#define TAG_16BIT_DESCRIPTION (0x17 | TAG_TYPE_STRINGREF)
+#define TAG_APPHELP_DETAILS (0x18 | TAG_TYPE_STRINGREF)
+#define TAG_LINK_URL (0x19 | TAG_TYPE_STRINGREF)
+#define TAG_LINK_TEXT (0x1A | TAG_TYPE_STRINGREF)
+#define TAG_APPHELP_TITLE (0x1B | TAG_TYPE_STRINGREF)
+#define TAG_APPHELP_CONTACT (0x1C | TAG_TYPE_STRINGREF)
+#define TAG_SXS_MANIFEST (0x1D | TAG_TYPE_STRINGREF)
+#define TAG_DATA_STRING (0x1E | TAG_TYPE_STRINGREF)
+#define TAG_MSI_TRANSFORM_FILE (0x1F | TAG_TYPE_STRINGREF)
+#define TAG_16BIT_MODULE_NAME (0x20 | TAG_TYPE_STRINGREF)
+#define TAG_LAYER_DISPLAYNAME (0x21 | TAG_TYPE_STRINGREF)
+#define TAG_COMPILER_VERSION (0x22 | TAG_TYPE_STRINGREF)
+#define TAG_ACTION_TYPE (0x23 | TAG_TYPE_STRINGREF)
+#define TAG_EXPORT_NAME (0x24 | TAG_TYPE_STRINGREF)
+
+/* TAG_TYPE_LIST */
+#define TAG_DATABASE (0x1 | TAG_TYPE_LIST)
+#define TAG_LIBRARY (0x2 | TAG_TYPE_LIST)
+#define TAG_INEXCLUD (0x3 | TAG_TYPE_LIST)
+#define TAG_SHIM (0x4 | TAG_TYPE_LIST)
+#define TAG_PATCH (0x5 | TAG_TYPE_LIST)
+#define TAG_APP (0x6 | TAG_TYPE_LIST)
+#define TAG_EXE (0x7 | TAG_TYPE_LIST)
+#define TAG_MATCHING_FILE (0x8 | TAG_TYPE_LIST)
+#define TAG_SHIM_REF (0x9| TAG_TYPE_LIST)
+#define TAG_PATCH_REF (0xA | TAG_TYPE_LIST)
+#define TAG_LAYER (0xB | TAG_TYPE_LIST)
+#define TAG_FILE (0xC | TAG_TYPE_LIST)
+#define TAG_APPHELP (0xD | TAG_TYPE_LIST)
+#define TAG_LINK (0xE | TAG_TYPE_LIST)
+#define TAG_DATA (0xF | TAG_TYPE_LIST)
+#define TAG_MSI_TRANSFORM (0x10 | TAG_TYPE_LIST)
+#define TAG_MSI_TRANSFORM_REF (0x11 | TAG_TYPE_LIST)
+#define TAG_MSI_PACKAGE (0x12 | TAG_TYPE_LIST)
+#define TAG_FLAG (0x13 | TAG_TYPE_LIST)
+#define TAG_MSI_CUSTOM_ACTION (0x14 | TAG_TYPE_LIST)
+#define TAG_FLAG_REF (0x15 | TAG_TYPE_LIST)
+#define TAG_ACTION (0x16 | TAG_TYPE_LIST)
+#define TAG_LOOKUP (0x17 | TAG_TYPE_LIST)
+#define TAG_CONTEXT (0x18 | TAG_TYPE_LIST)
+#define TAG_CONTEXT_REF (0x19 | TAG_TYPE_LIST)
+#define TAG_STRINGTABLE (0x801 | TAG_TYPE_LIST)
+#define TAG_INDEXES (0x802 | TAG_TYPE_LIST)
+#define TAG_INDEX (0x803 | TAG_TYPE_LIST)
+
+/* TAG_TYPE_STRING */
+#define TAG_STRINGTABLE_ITEM (0x801 | TAG_TYPE_STRING)
+
+/* TAG_TYPE_BINARY */
+#define TAG_PATCH_BITS (0x2 | TAG_TYPE_BINARY)
+#define TAG_FILE_BITS (0x3 | TAG_TYPE_BINARY)
+#define TAG_EXE_ID (0x4 | TAG_TYPE_BINARY)
+#define TAG_DATA_BITS (0x5 | TAG_TYPE_BINARY)
+#define TAG_MSI_PACKAGE_ID (0x6 | TAG_TYPE_BINARY)
+#define TAG_DATABASE_ID (0x7 | TAG_TYPE_BINARY)
+#define TAG_CONTEXT_PLATFORM_ID (0x8 | TAG_TYPE_BINARY)
+#define TAG_CONTEXT_BRANCH_ID (0x9 | TAG_TYPE_BINARY)
+#define TAG_FIX_ID (0x10 | TAG_TYPE_BINARY)
+#define TAG_APP_ID (0x11 | TAG_TYPE_BINARY)
+#define TAG_INDEX_BITS (0x801 | TAG_TYPE_BINARY)
+
#ifdef __cplusplus
} // extern "C"
#endif
Modified: trunk/reactos/dll/appcompat/apphelp/apphelp.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/apph…
==============================================================================
--- trunk/reactos/dll/appcompat/apphelp/apphelp.spec [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/apphelp.spec [iso-8859-1] Sun Apr 24 13:05:00
2016
@@ -145,7 +145,7 @@
@ stub SdbStringReplaceArray
@ stub SdbTagIDToTagRef
@ stub SdbTagRefToTagID
-@ stub SdbTagToString
+@ stdcall SdbTagToString(long)
@ stub SdbUnregisterDatabase
@ stub SdbWriteBinaryTag
@ stub SdbWriteBinaryTagFromFile
Modified: trunk/reactos/dll/appcompat/apphelp/sdbapi.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/sdba…
==============================================================================
--- trunk/reactos/dll/appcompat/apphelp/sdbapi.c [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/sdbapi.c [iso-8859-1] Sun Apr 24 13:05:00 2016
@@ -202,3 +202,267 @@
#endif
HeapFree(SdbpHeap(), 0, mem);
}
+
+/**
+ * Converts specified tag into a string.
+ *
+ * @param [in] tag The tag which will be converted to a string.
+ *
+ * @return Success: Pointer to the string matching specified tag, or
L"InvalidTag" on failure.
+ */
+LPCWSTR WINAPI SdbTagToString(TAG tag)
+{
+ /* lookup tables for tags in range 0x1 -> 0xFF | TYPE */
+ static const WCHAR table[9][0x31][25] = {
+ { /* TAG_TYPE_NULL */
+
{'I','N','C','L','U','D','E',0},
+
{'G','E','N','E','R','A','L',0},
+
{'M','A','T','C','H','_','L','O','G','I','C','_','N','O','T',0},
+
{'A','P','P','L','Y','_','A','L','L','_','S','H','I','M','S',0},
+
{'U','S','E','_','S','E','R','V','I','C','E','_','P','A','C','K','_','F','I','L','E','S',0},
+
{'M','I','T','I','G','A','T','I','O','N','_','O','S',0},
+
{'B','L','O','C','K','_','U','P','G','R','A','D','E',0},
+
{'I','N','C','L','U','D','E','E','X','C','L','U','D','E','D','L','L',0},
+
{'R','A','C','_','E','V','E','N','T','_','O','F','F',0},
+
{'T','E','L','E','M','E','T','R','Y','_','O','F','F',0},
+
{'S','H','I','M','_','E','N','G','I','N','E','_','O','F','F',0},
+
{'L','A','Y','E','R','_','P','R','O','P','A','G','A','T','I','O','N','_','O','F','F',0},
+
{'R','E','I','N','S','T','A','L','L','_','U','P','G','R','A','D','E',0}
+ },
+ { /* TAG_TYPE_BYTE */
+
{'I','n','v','a','l','i','d','T','a','g',0}
+ },
+ { /* TAG_TYPE_WORD */
+
{'M','A','T','C','H','_','M','O','D','E',0}
+ },
+ { /* TAG_TYPE_DWORD */
+ {'S','I','Z','E',0},
+ {'O','F','F','S','E','T',0},
+
{'C','H','E','C','K','S','U','M',0},
+
{'S','H','I','M','_','T','A','G','I','D',0},
+
{'P','A','T','C','H','_','T','A','G','I','D',0},
+
{'M','O','D','U','L','E','_','T','Y','P','E',0},
+
{'V','E','R','D','A','T','E','H','I',0},
+
{'V','E','R','D','A','T','E','L','O',0},
+
{'V','E','R','F','I','L','E','O','S',0},
+
{'V','E','R','F','I','L','E','T','Y','P','E',0},
+
{'P','E','_','C','H','E','C','K','S','U','M',0},
+
{'P','R','E','V','O','S','M','A','J','O','R','V','E','R',0},
+
{'P','R','E','V','O','S','M','I','N','O','R','V','E','R',0},
+
{'P','R','E','V','O','S','P','L','A','T','F','O','R','M','I','D',0},
+
{'P','R','E','V','O','S','B','U','I','L','D','N','O',0},
+
{'P','R','O','B','L','E','M','S','E','V','E','R','I','T','Y',0},
+ {'L','A','N','G','I','D',0},
+
{'V','E','R','_','L','A','N','G','U','A','G','E',0},
+
{'I','n','v','a','l','i','d','T','a','g',0},
+ {'E','N','G','I','N','E',0},
+
{'H','T','M','L','H','E','L','P','I','D',0},
+
{'I','N','D','E','X','_','F','L','A','G','S',0},
+ {'F','L','A','G','S',0},
+
{'D','A','T','A','_','V','A','L','U','E','T','Y','P','E',0},
+
{'D','A','T','A','_','D','W','O','R','D',0},
+
{'L','A','Y','E','R','_','T','A','G','I','D',0},
+
{'M','S','I','_','T','R','A','N','S','F','O','R','M','_','T','A','G','I','D',0},
+
{'L','I','N','K','E','R','_','V','E','R','S','I','O','N',0},
+
{'L','I','N','K','_','D','A','T','E',0},
+
{'U','P','T','O','_','L','I','N','K','_','D','A','T','E',0},
+
{'O','S','_','S','E','R','V','I','C','E','_','P','A','C','K',0},
+
{'F','L','A','G','_','T','A','G','I','D',0},
+
{'R','U','N','T','I','M','E','_','P','L','A','T','F','O','R','M',0},
+ {'O','S','_','S','K','U',0},
+
{'O','S','_','P','L','A','T','F','O','R','M',0},
+
{'A','P','P','_','N','A','M','E','_','R','C','_','I','D',0},
+
{'V','E','N','D','O','R','_','N','A','M','E','_','R','C','_','I','D',0},
+
{'S','U','M','M','A','R','Y','_','M','S','G','_','R','C','_','I','D',0},
+
{'V','I','S','T','A','_','S','K','U',0},
+
{'D','E','S','C','R','I','P','T','I','O','N','_','R','C','_','I','D',0},
+
{'P','A','R','A','M','E','T','E','R','1','_','R','C','_','I','D',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},
+
{'C','O','N','T','E','X','T','_','T','A','G','I','D',0},
+
{'E','X','E','_','W','R','A','P','P','E','R',0}
+ },
+ { /* TAG_TYPE_QWORD */
+ {'T','I','M','E',0},
+
{'B','I','N','_','F','I','L','E','_','V','E','R','S','I','O','N',0},
+
{'B','I','N','_','P','R','O','D','U','C','T','_','V','E','R','S','I','O','N',0},
+
{'M','O','D','T','I','M','E',0},
+
{'F','L','A','G','_','M','A','S','K','_','K','E','R','N','E','L',0},
+
{'U','P','T','O','_','B','I','N','_','P','R','O','D','U','C','T','_','V','E','R','S','I','O','N',0},
+
{'D','A','T','A','_','Q','W','O','R','D',0},
+
{'F','L','A','G','_','M','A','S','K','_','U','S','E','R',0},
+
{'F','L','A','G','S','_','N','T','V','D','M','1',0},
+
{'F','L','A','G','S','_','N','T','V','D','M','2',0},
+
{'F','L','A','G','S','_','N','T','V','D','M','3',0},
+
{'F','L','A','G','_','M','A','S','K','_','S','H','E','L','L',0},
+
{'U','P','T','O','_','B','I','N','_','F','I','L','E','_','V','E','R','S','I','O','N',0},
+
{'F','L','A','G','_','M','A','S','K','_','F','U','S','I','O','N',0},
+
{'F','L','A','G','_','P','R','O','C','E','S','S','P','A','R','A','M',0},
+
{'F','L','A','G','_','L','U','A',0},
+
{'F','L','A','G','_','I','N','S','T','A','L','L',0}
+ },
+ { /* TAG_TYPE_STRINGREF */
+ {'N','A','M','E',0},
+
{'D','E','S','C','R','I','P','T','I','O','N',0},
+ {'M','O','D','U','L','E',0},
+ {'A','P','I',0},
+ {'V','E','N','D','O','R',0},
+
{'A','P','P','_','N','A','M','E',0},
+
{'I','n','v','a','l','i','d','T','a','g',0},
+
{'C','O','M','M','A','N','D','_','L','I','N','E',0},
+
{'C','O','M','P','A','N','Y','_','N','A','M','E',0},
+
{'D','L','L','F','I','L','E',0},
+
{'W','I','L','D','C','A','R','D','_','N','A','M','E',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},
+
{'P','R','O','D','U','C','T','_','N','A','M','E',0},
+
{'P','R','O','D','U','C','T','_','V','E','R','S','I','O','N',0},
+
{'F','I','L','E','_','D','E','S','C','R','I','P','T','I','O','N',0},
+
{'F','I','L','E','_','V','E','R','S','I','O','N',0},
+
{'O','R','I','G','I','N','A','L','_','F','I','L','E','N','A','M','E',0},
+
{'I','N','T','E','R','N','A','L','_','N','A','M','E',0},
+
{'L','E','G','A','L','_','C','O','P','Y','R','I','G','H','T',0},
+
{'1','6','B','I','T','_','D','E','S','C','R','I','P','T','I','O','N',0},
+
{'A','P','P','H','E','L','P','_','D','E','T','A','I','L','S',0},
+
{'L','I','N','K','_','U','R','L',0},
+
{'L','I','N','K','_','T','E','X','T',0},
+
{'A','P','P','H','E','L','P','_','T','I','T','L','E',0},
+
{'A','P','P','H','E','L','P','_','C','O','N','T','A','C','T',0},
+
{'S','X','S','_','M','A','N','I','F','E','S','T',0},
+
{'D','A','T','A','_','S','T','R','I','N','G',0},
+
{'M','S','I','_','T','R','A','N','S','F','O','R','M','_','F','I','L','E',0},
+
{'1','6','B','I','T','_','M','O','D','U','L','E','_','N','A','M','E',0},
+
{'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}
+ },
+ { /* TAG_TYPE_LIST */
+
{'D','A','T','A','B','A','S','E',0},
+
{'L','I','B','R','A','R','Y',0},
+
{'I','N','E','X','C','L','U','D','E',0},
+ {'S','H','I','M',0},
+ {'P','A','T','C','H',0},
+ {'A','P','P',0},
+ {'E','X','E',0},
+
{'M','A','T','C','H','I','N','G','_','F','I','L','E',0},
+
{'S','H','I','M','_','R','E','F',0},
+
{'P','A','T','C','H','_','R','E','F',0},
+ {'L','A','Y','E','R',0},
+ {'F','I','L','E',0},
+
{'A','P','P','H','E','L','P',0},
+ {'L','I','N','K',0},
+ {'D','A','T','A',0},
+
{'M','S','I','_','T','R','A','N','S','F','O','R','M',0},
+
{'M','S','I','_','T','R','A','N','S','F','O','R','M','_','R','E','F',0},
+
{'M','S','I','_','P','A','C','K','A','G','E',0},
+ {'F','L','A','G',0},
+
{'M','S','I','_','C','U','S','T','O','M','_','A','C','T','I','O','N',0},
+
{'F','L','A','G','_','R','E','F',0},
+ {'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}
+ },
+ { /* TAG_TYPE_STRING */
+
{'I','n','v','a','l','i','d','T','a','g',0}
+ },
+ { /* TAG_TYPE_BINARY */
+
{'I','n','v','a','l','i','d','T','a','g',0},
+
{'P','A','T','C','H','_','B','I','T','S',0},
+
{'F','I','L','E','_','B','I','T','S',0},
+ {'E','X','E','_','I','D',0},
+
{'D','A','T','A','_','B','I','T','S',0},
+
{'M','S','I','_','P','A','C','K','A','G','E','_','I','D',0},
+
{'D','A','T','A','B','A','S','E','_','I','D',0},
+
{'C','O','N','T','E','X','T','_','P','L','A','T','F','O','R','M','_','I','D',0},
+
{'C','O','N','T','E','X','T','_','B','R','A','N','C','H','_','I','D',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},
+ {'F','I','X','_','I','D',0},
+ {'A','P','P','_','I','D',0}
+ }
+ };
+
+ /* sizes of tables in above array (# strings per type) */
+ static const WORD limits[9] = {
+ /* switch off TYPE_* nibble of last tag for each type */
+ TAG_REINSTALL_UPGRADE & 0xFF,
+ 1,
+ TAG_MATCH_MODE & 0xFF,
+ TAG_EXE_WRAPPER & 0xFF,
+ TAG_FLAG_INSTALL & 0xFF,
+ TAG_EXPORT_NAME & 0xFF,
+ TAG_CONTEXT_REF & 0xFF,
+ 1,
+ TAG_APP_ID & 0xFF
+ };
+
+ /* lookup tables for tags in range 0x800 + (0x1 -> 0xFF) | TYPE */
+ static const WCHAR table2[9][3][17] = {
+ {
{'I','n','v','a','l','i','d','T','a','g',0}
}, /* TAG_TYPE_NULL */
+ {
{'I','n','v','a','l','i','d','T','a','g',0}
}, /* TAG_TYPE_BYTE */
+ {
+ {'T','A','G',0}, /* TAG_TYPE_WORD */
+
{'I','N','D','E','X','_','T','A','G',0},
+
{'I','N','D','E','X','_','K','E','Y',0}
+ },
+ { {'T','A','G','I','D',0} }, /*
TAG_TYPE_DWORD */
+ {
{'I','n','v','a','l','i','d','T','a','g',0}
}, /* TAG_TYPE_QWORD */
+ {
{'I','n','v','a','l','i','d','T','a','g',0}
}, /* TAG_TYPE_STRINGREF */
+ {
+
{'S','T','R','I','N','G','T','A','B','L','E',0},
/* TAG_TYPE_LIST */
+
{'I','N','D','E','X','E','S',0},
+ {'I','N','D','E','X',0}
+ },
+ {
{'S','T','R','I','N','G','T','A','B','L','E','_','I','T','E','M',0},
}, /* TAG_TYPE_STRING */
+ {
{'I','N','D','E','X','_','B','I','T','S',0}
} /* TAG_TYPE_BINARY */
+ };
+
+ /* sizes of tables in above array, hardcoded for simplicity */
+ static const WORD limits2[9] = { 0, 0, 3, 1, 0, 0, 3, 1, 1 };
+
+ static const WCHAR null[] = {'N','U','L','L',0};
+ static const WCHAR invalid[] =
{'I','n','v','a','l','i','d','T','a','g',0};
+
+ BOOL switch_table; /* should we use table2 and limits2? */
+ WORD index, type_index;
+
+ /* special case: null tag */
+ if (tag == TAG_NULL)
+ return null;
+
+ /* tags with only type mask or no type mask are invalid */
+ if ((tag & ~TAG_TYPE_MASK) == 0 || (tag & TAG_TYPE_MASK) == 0)
+ return invalid;
+
+ /* some valid tags are in range 0x800 + (0x1 -> 0xF) | TYPE */
+ if ((tag & 0xF00) == 0x800)
+ switch_table = TRUE;
+ else if ((tag & 0xF00) == 0)
+ switch_table = FALSE;
+ else return invalid;
+
+ /* index of table in array is type nibble */
+ type_index = (tag >> 12) - 1;
+
+ /* index of string in table is low byte */
+ index = (tag & 0xFF) - 1;
+
+ /* bound check */
+ if (type_index >= 9 || index >= (switch_table ? limits2[type_index] :
limits[type_index]))
+ return invalid;
+
+ /* tag is valid */
+ return switch_table ? table2[type_index][index] : table[type_index][index];
+}
Modified: trunk/rostests/apitests/apphelp/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/apphelp/CMakeLis…
==============================================================================
--- trunk/rostests/apitests/apphelp/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/apitests/apphelp/CMakeLists.txt [iso-8859-1] Sun Apr 24 13:05:00 2016
@@ -3,6 +3,7 @@
list(APPEND SOURCE
layerapi.c
+ apphelp.c
testlist.c)
add_executable(apphelp_apitest ${SOURCE})
Added: trunk/rostests/apitests/apphelp/apphelp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/apphelp/apphelp.…
==============================================================================
--- trunk/rostests/apitests/apphelp/apphelp.c (added)
+++ trunk/rostests/apitests/apphelp/apphelp.c [iso-8859-1] Sun Apr 24 13:05:00 2016
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2012 Detlef Riekenberg
+ * Copyright 2013 Mislav Blaevic
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+
+#include <ntstatus.h>
+#define WIN32_NO_STATUS
+#include <windows.h>
+#include <shlwapi.h>
+#include <winnt.h>
+#ifdef __REACTOS__
+#include <ntndk.h>
+#else
+#include <winternl.h>
+#endif
+
+#include <winerror.h>
+#include <stdio.h>
+
+#include "wine/test.h"
+
+
+typedef WORD TAG;
+
+#define TAG_TYPE_MASK 0xF000
+
+#define TAG_TYPE_NULL 0x1000
+#define TAG_TYPE_BYTE 0x2000
+#define TAG_TYPE_WORD 0x3000
+#define TAG_TYPE_DWORD 0x4000
+#define TAG_TYPE_QWORD 0x5000
+#define TAG_TYPE_STRINGREF 0x6000
+#define TAG_TYPE_LIST 0x7000
+#define TAG_TYPE_STRING 0x8000
+#define TAG_TYPE_BINARY 0x9000
+
+
+static HMODULE hdll;
+static LPCWSTR (WINAPI *pSdbTagToString)(TAG);
+
+static void test_SdbTagToString(void)
+{
+ static const TAG invalid_values[] = {
+ 1, TAG_TYPE_WORD, TAG_TYPE_MASK,
+ TAG_TYPE_DWORD | 0xFF,
+ TAG_TYPE_DWORD | (0x800 + 0xEE),
+ 0x900, 0xFFFF, 0xDEAD, 0xBEEF
+ };
+ static const WCHAR invalid[] =
{'I','n','v','a','l','i','d','T','a','g',0};
+ LPCWSTR ret;
+ WORD i;
+
+ for (i = 0; i < 9; ++i)
+ {
+ ret = pSdbTagToString(invalid_values[i]);
+ ok(lstrcmpW(ret, invalid) == 0, "unexpected string %s, should be
%s\n",
+ wine_dbgstr_w(ret), wine_dbgstr_w(invalid));
+ }
+}
+
+START_TEST(apphelp)
+{
+ hdll = LoadLibraryA("apphelp.dll");
+ pSdbTagToString = (void *) GetProcAddress(hdll, "SdbTagToString");
+ test_SdbTagToString();
+}
Propchange: trunk/rostests/apitests/apphelp/apphelp.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/rostests/apitests/apphelp/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/apphelp/testlist…
==============================================================================
--- trunk/rostests/apitests/apphelp/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/apphelp/testlist.c [iso-8859-1] Sun Apr 24 13:05:00 2016
@@ -4,9 +4,11 @@
#include <wine/test.h>
extern void func_layerapi(void);
+extern void func_apphelp(void);
const struct test winetest_testlist[] =
{
{ "layerapi", func_layerapi },
+ { "apphelp", func_apphelp },
{ 0, 0 }
};