ReactOS 0.4.16-dev-1875-g3000d45
db.cpp File Reference
#include <ntstatus.h>
#include <windows.h>
#include <shlwapi.h>
#include <winnt.h>
#include <winternl.h>
#include <winerror.h>
#include <stdio.h>
#include <initguid.h>
#include <pseh/pseh2.h>
#include "wine/test.h"
#include "apphelp_apitest.h"
Include dependency graph for db.cpp:

Go to the source code of this file.

Classes

struct  _DB_INFORMATION
 

Macros

#define WIN32_NO_STATUS
 
#define DOS_PATH   0
 
#define HID_DATABASE_FULLPATH   2
 
#define SDB_DATABASE_MAIN_SHIM   0x80030000
 
#define TAGID_NULL   0x0
 
#define TAGID_ROOT   0x0
 
#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
 
#define TAG_INCLUDE   (0x1 | TAG_TYPE_NULL)
 
#define TAG_MATCH_MODE   (0x1 | TAG_TYPE_WORD)
 
#define TAG_SIZE   (0x1 | TAG_TYPE_DWORD)
 
#define TAG_CHECKSUM   (0x3 | TAG_TYPE_DWORD)
 
#define TAG_MODULE_TYPE   (0x6 | 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_PROBLEMSEVERITY   (0x10 | TAG_TYPE_DWORD)
 
#define TAG_HTMLHELPID   (0x15 | TAG_TYPE_DWORD)
 
#define TAG_FLAGS   (0x17 | TAG_TYPE_DWORD)
 
#define TAG_LAYER_TAGID   (0x1A | 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_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_OS_PLATFORM   (0x23 | TAG_TYPE_DWORD)
 
#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_UPTO_BIN_PRODUCT_VERSION   (0x6 | TAG_TYPE_QWORD)
 
#define TAG_UPTO_BIN_FILE_VERSION   (0xD | TAG_TYPE_QWORD)
 
#define TAG_FLAG_LUA   (0x10 | TAG_TYPE_QWORD)
 
#define TAG_DATABASE   (0x1 | TAG_TYPE_LIST)
 
#define TAG_INEXCLUD   (0x3 | 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_LAYER   (0xB | 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_STRINGTABLE   (0x801 | TAG_TYPE_LIST)
 
#define TAG_STRINGTABLE_ITEM   (0x801 | TAG_TYPE_STRING)
 
#define TAG_NAME   (0x1 | TAG_TYPE_STRINGREF)
 
#define TAG_MODULE   (0x3 | 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_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_APPHELP_DETAILS   (0x18 | TAG_TYPE_STRINGREF)
 
#define TAG_LINK_URL   (0x19 | TAG_TYPE_STRINGREF)
 
#define TAG_APPHELP_TITLE   (0x1B | TAG_TYPE_STRINGREF)
 
#define TAG_COMPILER_VERSION   (0x22 | TAG_TYPE_STRINGREF)
 
#define TAG_GENERAL   (0x2 | TAG_TYPE_NULL)
 
#define TAG_EXE_ID   (0x4 | TAG_TYPE_BINARY)
 
#define TAG_DATA_BITS   (0x5 | TAG_TYPE_BINARY)
 
#define TAG_DATABASE_ID   (0x7 | TAG_TYPE_BINARY)
 
#define DB_INFO_FLAGS_VALID_GUID   1
 
#define match_strw_attr   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : match_strw_attr_imp
 
#define match_dw_attr   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : match_dw_attr_imp
 
#define match_qw_attr   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : match_qw_attr_imp
 
#define match_guid_attr   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : match_guid_attr_imp
 
#define expect_indexA   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : expect_indexA_imp
 

Typedefs

typedef struct _DB_INFORMATION DB_INFORMATION
 
typedef struct _DB_INFORMATIONPDB_INFORMATION
 

Functions

static LPCWSTR (WINAPI *pSdbTagToString)(TAG)
 
static PDB (WINAPI *pSdbOpenDatabase)(LPCWSTR
 
static BOOL (WINAPI *pSdbGetDatabaseVersion)(LPCWSTR
 
static void (WINAPI *pSdbCloseDatabase)(PDB)
 
static TAG (WINAPI *pSdbGetTagFromTagID)(PDB
 
static TAGID (WINAPI *pSdbBeginWriteListTag)(PDB
 
static WORD (WINAPI *pSdbReadWORDTag)(PDB
 
static DWORD (WINAPI *pSdbReadDWORDTag)(PDB
 
static QWORD (WINAPI *pSdbReadQWORDTag)(PDB
 
static PVOID (WINAPI *pSdbGetBinaryTagData)(PDB
 
static LPWSTR (WINAPI *pSdbGetStringTagPtr)(PDB
 
static HSDB (WINAPI *pSdbInitDatabase)(DWORD
 
static TAGREF (WINAPI *pSdbGetLayerTagRef)(HSDB hsdb
 
static LONGLONG (WINAPI *pSdbMakeIndexKeyFromString)(LPCWSTR)
 
static VOID (WINAPI *pSdbFreeDatabaseInformation)(PDB_INFORMATION information)
 
 DEFINE_GUID (GUID_DATABASE_TEST, 0xe39b0eb0, 0x55db, 0x450b, 0x9b, 0xd4, 0xd2, 0x0c, 0x94, 0x84, 0x26, 0x0f)
 
 DEFINE_GUID (GUID_MAIN_DATABASE, 0x11111111, 0x1111, 0x1111, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11)
 
static void Write (HANDLE file, LPCVOID buffer, DWORD size)
 
static void test_GetDatabaseInformationEmpty (PDB pdb)
 
static void test_Sdb (void)
 
static void test_write_ex (void)
 
static void write_db_strings (const WCHAR *name, const WCHAR *data[], size_t count)
 
static void test_stringtable ()
 
static void match_strw_attr_imp (PDB pdb, TAGID parent, TAG find, const WCHAR *compare)
 
static void match_dw_attr_imp (PDB pdb, TAGID parent, TAG find, DWORD compare)
 
static void match_qw_attr_imp (PDB pdb, TAGID parent, TAG find, QWORD compare)
 
static void match_guid_attr_imp (PDB pdb, TAGID parent, TAG find, const GUID *compare)
 
static void check_db_properties (PDB pdb, TAGID root)
 
static void check_db_layer (PDB pdb, TAGID layer)
 
static void check_matching_file (PDB pdb, TAGID exe, TAGID matching_file, int num)
 
static void check_matching_apphelp (PDB pdb, TAGID apphelp, int num)
 
static void check_matching_layer (PDB pdb, TAGID layer, int num)
 
static void check_db_exes (PDB pdb, TAGID root)
 
static void check_db_apphelp (PDB pdb, TAGID root)
 
static void test_GetDatabaseInformation (PDB pdb)
 
static void test_CheckDatabaseManually (void)
 
static void test_is_testdb (PDB pdb)
 
template<typename SDBQUERYRESULT_T >
static void check_adwExeFlags (DWORD adwExeFlags_0, SDBQUERYRESULT_T &query, const char *file, int line, size_t cur)
 
template<>
void check_adwExeFlags (DWORD, SDBQUERYRESULT_2k3 &, const char *, int, size_t)
 
template<typename SDBQUERYRESULT_T >
static void test_mode_generic (const WCHAR *workdir, HSDB hsdb, size_t cur)
 
template<typename SDBQUERYRESULT_T >
static void test_MatchApplications (void)
 
static BOOL write_raw_file (const WCHAR *FileName, const void *Data, DWORD Size)
 
static bool extract_resource (const WCHAR *Filename, LPCWSTR ResourceName)
 
template<typename SDBQUERYRESULT_T >
static void test_match_ex (const WCHAR *workdir, HSDB hsdb)
 
template<typename SDBQUERYRESULT_T >
static void test_MatchApplicationsEx (void)
 
static void test_TagRef (void)
 
static void test_DataTags (HSDB hsdb)
 
static void test_Data (void)
 
static void expect_indexA_imp (const char *text, LONGLONG expected)
 
static void test_IndexKeyFromString (void)
 
static int validate_SDBQUERYRESULT_size ()
 
 START_TEST (db)
 

Variables

static HMODULE hdll
 
static PATH_TYPE
 
static PDWORD
 
static TAGID
 
static TAG
 
static WORD
 
static DWORD
 
static QWORD
 
static LPCWSTR
 
static TAGID root
 
static TAGID TAGID find
 
static TAGID TAGID TAGID nametag
 
static TAGID TAGID TAGID LPCWSTR find_name
 
static PBYTE
 
static LPWSTR
 
static GUID *static PCWSTR
 
static GUID *static SIZE_T
 
static LPCWSTR path
 
static LPCWSTR LPCWSTR module_name
 
static LPCWSTR LPCWSTR LPCWSTR env
 
static LPCWSTR LPCWSTR LPCWSTR DWORD flags
 
static LPCWSTR LPCWSTR LPCWSTR DWORD PSDBQUERYRESULT_VISTA result
 
static TAGREF trWhich
 
static TAGREF PDBppdb
 
static TAGREF PDB TAGIDptiWhich
 
static PDB pdb
 
static PDB TAGID tiWhich
 
static PDB TAGID TAGREFptrWhich
 
static LPCWSTR layerName
 
static TAGREF LPCWSTR lpszDataName
 
static TAGREF LPCWSTR LPDWORD lpdwDataType
 
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
 
static TAGREF LPCWSTR LPDWORD LPVOID LPDWORD lpcbBufferSize
 
static TAGREF LPCWSTR LPDWORD LPVOID LPDWORD TAGREFptrData
 
static TAGID tiExe
 
static TAGID LPCWSTR LPDWORD LPVOID LPDWORD TAGIDptiData
 
static PDB_INFORMATION information
 
struct {
   const WCHAR *   name
 
   const WCHAR *   app_name
 
   const WCHAR *   vendor
 
   GUID   exe_id
 
   const WCHAR *   extra_file
 
   DWORD   dwLayerCount
 
   TAGREF   atrExes_0
 
   DWORD   adwExeFlags_0
 
   TAGREF   atrLayers_0
 
   TAGREF   trApphelp
 
   const char *   env_var
 
test_exedata [5]
 
struct {
   DWORD   htmlhelpid
 
   const WCHAR *   link
 
   const WCHAR *   apphelp_title
 
   const WCHAR *   apphelp_details
 
test_layerdata [2]
 

Macro Definition Documentation

◆ _TAGID_ROOT

#define _TAGID_ROOT   12

Definition at line 40 of file db.cpp.

◆ DB_INFO_FLAGS_VALID_GUID

#define DB_INFO_FLAGS_VALID_GUID   1

Definition at line 124 of file db.cpp.

◆ DOS_PATH

#define DOS_PATH   0

Definition at line 32 of file db.cpp.

◆ expect_indexA

#define expect_indexA   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : expect_indexA_imp

Definition at line 1959 of file db.cpp.

◆ HID_DATABASE_FULLPATH

#define HID_DATABASE_FULLPATH   2

Definition at line 33 of file db.cpp.

◆ match_dw_attr

#define match_dw_attr   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : match_dw_attr_imp

Definition at line 667 of file db.cpp.

◆ match_guid_attr

#define match_guid_attr   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : match_guid_attr_imp

Definition at line 669 of file db.cpp.

◆ match_qw_attr

#define match_qw_attr   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : match_qw_attr_imp

Definition at line 668 of file db.cpp.

◆ match_strw_attr

#define match_strw_attr   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : match_strw_attr_imp

Definition at line 666 of file db.cpp.

◆ SDB_DATABASE_MAIN_SHIM

#define SDB_DATABASE_MAIN_SHIM   0x80030000

Definition at line 35 of file db.cpp.

◆ TAG_APP_NAME

#define TAG_APP_NAME   (0x6 | TAG_TYPE_STRINGREF)

Definition at line 101 of file db.cpp.

◆ TAG_APP_NAME_RC_ID

#define TAG_APP_NAME_RC_ID   (0x24 | TAG_TYPE_DWORD)

Definition at line 73 of file db.cpp.

◆ TAG_APPHELP

#define TAG_APPHELP   (0xD | TAG_TYPE_LIST)

Definition at line 91 of file db.cpp.

◆ TAG_APPHELP_DETAILS

#define TAG_APPHELP_DETAILS   (0x18 | TAG_TYPE_STRINGREF)

Definition at line 112 of file db.cpp.

◆ TAG_APPHELP_TITLE

#define TAG_APPHELP_TITLE   (0x1B | TAG_TYPE_STRINGREF)

Definition at line 114 of file db.cpp.

◆ TAG_BIN_FILE_VERSION

#define TAG_BIN_FILE_VERSION   (0x2 | TAG_TYPE_QWORD)

Definition at line 79 of file db.cpp.

◆ TAG_BIN_PRODUCT_VERSION

#define TAG_BIN_PRODUCT_VERSION   (0x3 | TAG_TYPE_QWORD)

Definition at line 80 of file db.cpp.

◆ TAG_CHECKSUM

#define TAG_CHECKSUM   (0x3 | TAG_TYPE_DWORD)

Definition at line 61 of file db.cpp.

◆ TAG_COMMAND_LINE

#define TAG_COMMAND_LINE   (0x8 | TAG_TYPE_STRINGREF)

Definition at line 102 of file db.cpp.

◆ TAG_COMPANY_NAME

#define TAG_COMPANY_NAME   (0x9 | TAG_TYPE_STRINGREF)

Definition at line 103 of file db.cpp.

◆ TAG_COMPILER_VERSION

#define TAG_COMPILER_VERSION   (0x22 | TAG_TYPE_STRINGREF)

Definition at line 116 of file db.cpp.

◆ TAG_DATA

#define TAG_DATA   (0xF | TAG_TYPE_LIST)

Definition at line 93 of file db.cpp.

◆ TAG_DATA_BITS

#define TAG_DATA_BITS   (0x5 | TAG_TYPE_BINARY)

Definition at line 121 of file db.cpp.

◆ TAG_DATABASE

#define TAG_DATABASE   (0x1 | TAG_TYPE_LIST)

Definition at line 85 of file db.cpp.

◆ TAG_DATABASE_ID

#define TAG_DATABASE_ID   (0x7 | TAG_TYPE_BINARY)

Definition at line 122 of file db.cpp.

◆ TAG_EXE

#define TAG_EXE   (0x7 | TAG_TYPE_LIST)

Definition at line 87 of file db.cpp.

◆ TAG_EXE_ID

#define TAG_EXE_ID   (0x4 | TAG_TYPE_BINARY)

Definition at line 120 of file db.cpp.

◆ TAG_FILE_DESCRIPTION

#define TAG_FILE_DESCRIPTION   (0x12 | TAG_TYPE_STRINGREF)

Definition at line 107 of file db.cpp.

◆ TAG_FILE_VERSION

#define TAG_FILE_VERSION   (0x13 | TAG_TYPE_STRINGREF)

Definition at line 108 of file db.cpp.

◆ TAG_FLAG_LUA

#define TAG_FLAG_LUA   (0x10 | TAG_TYPE_QWORD)

Definition at line 83 of file db.cpp.

◆ TAG_FLAGS

#define TAG_FLAGS   (0x17 | TAG_TYPE_DWORD)

Definition at line 68 of file db.cpp.

◆ TAG_GENERAL

#define TAG_GENERAL   (0x2 | TAG_TYPE_NULL)

Definition at line 118 of file db.cpp.

◆ TAG_HTMLHELPID

#define TAG_HTMLHELPID   (0x15 | TAG_TYPE_DWORD)

Definition at line 67 of file db.cpp.

◆ TAG_INCLUDE

#define TAG_INCLUDE   (0x1 | TAG_TYPE_NULL)

Definition at line 56 of file db.cpp.

◆ TAG_INEXCLUD

#define TAG_INEXCLUD   (0x3 | TAG_TYPE_LIST)

Definition at line 86 of file db.cpp.

◆ TAG_INTERNAL_NAME

#define TAG_INTERNAL_NAME   (0x15 | TAG_TYPE_STRINGREF)

Definition at line 110 of file db.cpp.

◆ TAG_LAYER

#define TAG_LAYER   (0xB | TAG_TYPE_LIST)

Definition at line 90 of file db.cpp.

◆ TAG_LAYER_TAGID

#define TAG_LAYER_TAGID   (0x1A | TAG_TYPE_DWORD)

Definition at line 69 of file db.cpp.

◆ TAG_LEGAL_COPYRIGHT

#define TAG_LEGAL_COPYRIGHT   (0x16 | TAG_TYPE_STRINGREF)

Definition at line 111 of file db.cpp.

◆ TAG_LINK

#define TAG_LINK   (0xE | TAG_TYPE_LIST)

Definition at line 92 of file db.cpp.

◆ TAG_LINK_DATE

#define TAG_LINK_DATE   (0x1D | TAG_TYPE_DWORD)

Definition at line 71 of file db.cpp.

◆ TAG_LINK_URL

#define TAG_LINK_URL   (0x19 | TAG_TYPE_STRINGREF)

Definition at line 113 of file db.cpp.

◆ TAG_LINKER_VERSION

#define TAG_LINKER_VERSION   (0x1C | TAG_TYPE_DWORD)

Definition at line 70 of file db.cpp.

◆ TAG_MATCH_MODE

#define TAG_MATCH_MODE   (0x1 | TAG_TYPE_WORD)

Definition at line 58 of file db.cpp.

◆ TAG_MATCHING_FILE

#define TAG_MATCHING_FILE   (0x8 | TAG_TYPE_LIST)

Definition at line 88 of file db.cpp.

◆ TAG_MODULE

#define TAG_MODULE   (0x3 | TAG_TYPE_STRINGREF)

Definition at line 99 of file db.cpp.

◆ TAG_MODULE_TYPE

#define TAG_MODULE_TYPE   (0x6 | TAG_TYPE_DWORD)

Definition at line 62 of file db.cpp.

◆ TAG_NAME

#define TAG_NAME   (0x1 | TAG_TYPE_STRINGREF)

Definition at line 98 of file db.cpp.

◆ TAG_NULL

#define TAG_NULL   0x0

Definition at line 54 of file db.cpp.

◆ TAG_ORIGINAL_FILENAME

#define TAG_ORIGINAL_FILENAME   (0x14 | TAG_TYPE_STRINGREF)

Definition at line 109 of file db.cpp.

◆ TAG_OS_PLATFORM

#define TAG_OS_PLATFORM   (0x23 | TAG_TYPE_DWORD)

Definition at line 76 of file db.cpp.

◆ TAG_PE_CHECKSUM

#define TAG_PE_CHECKSUM   (0xB | TAG_TYPE_DWORD)

Definition at line 65 of file db.cpp.

◆ TAG_PROBLEMSEVERITY

#define TAG_PROBLEMSEVERITY   (0x10 | TAG_TYPE_DWORD)

Definition at line 66 of file db.cpp.

◆ TAG_PRODUCT_NAME

#define TAG_PRODUCT_NAME   (0x10 | TAG_TYPE_STRINGREF)

Definition at line 105 of file db.cpp.

◆ TAG_PRODUCT_VERSION

#define TAG_PRODUCT_VERSION   (0x11 | TAG_TYPE_STRINGREF)

Definition at line 106 of file db.cpp.

◆ TAG_SHIM_REF

#define TAG_SHIM_REF   (0x9| TAG_TYPE_LIST)

Definition at line 89 of file db.cpp.

◆ TAG_SIZE

#define TAG_SIZE   (0x1 | TAG_TYPE_DWORD)

Definition at line 60 of file db.cpp.

◆ TAG_STRINGTABLE

#define TAG_STRINGTABLE   (0x801 | TAG_TYPE_LIST)

Definition at line 94 of file db.cpp.

◆ TAG_STRINGTABLE_ITEM

#define TAG_STRINGTABLE_ITEM   (0x801 | TAG_TYPE_STRING)

Definition at line 96 of file db.cpp.

◆ TAG_SUMMARY_MSG_RC_ID

#define TAG_SUMMARY_MSG_RC_ID   (0x26 | TAG_TYPE_DWORD)

Definition at line 75 of file db.cpp.

◆ TAG_TIME

#define TAG_TIME   (0x1 | TAG_TYPE_QWORD)

Definition at line 78 of file db.cpp.

◆ TAG_TYPE_BINARY

#define TAG_TYPE_BINARY   0x9000

Definition at line 53 of file db.cpp.

◆ TAG_TYPE_BYTE

#define TAG_TYPE_BYTE   0x2000

Definition at line 46 of file db.cpp.

◆ TAG_TYPE_DWORD

#define TAG_TYPE_DWORD   0x4000

Definition at line 48 of file db.cpp.

◆ TAG_TYPE_LIST

#define TAG_TYPE_LIST   0x7000

Definition at line 51 of file db.cpp.

◆ TAG_TYPE_MASK

#define TAG_TYPE_MASK   0xF000

Definition at line 43 of file db.cpp.

◆ TAG_TYPE_NULL

#define TAG_TYPE_NULL   0x1000

Definition at line 45 of file db.cpp.

◆ TAG_TYPE_QWORD

#define TAG_TYPE_QWORD   0x5000

Definition at line 49 of file db.cpp.

◆ TAG_TYPE_STRING

#define TAG_TYPE_STRING   0x8000

Definition at line 52 of file db.cpp.

◆ TAG_TYPE_STRINGREF

#define TAG_TYPE_STRINGREF   0x6000

Definition at line 50 of file db.cpp.

◆ TAG_TYPE_WORD

#define TAG_TYPE_WORD   0x3000

Definition at line 47 of file db.cpp.

◆ TAG_UPTO_BIN_FILE_VERSION

#define TAG_UPTO_BIN_FILE_VERSION   (0xD | TAG_TYPE_QWORD)

Definition at line 82 of file db.cpp.

◆ TAG_UPTO_BIN_PRODUCT_VERSION

#define TAG_UPTO_BIN_PRODUCT_VERSION   (0x6 | TAG_TYPE_QWORD)

Definition at line 81 of file db.cpp.

◆ TAG_UPTO_LINK_DATE

#define TAG_UPTO_LINK_DATE   (0x1E | TAG_TYPE_DWORD)

Definition at line 72 of file db.cpp.

◆ TAG_VENDOR

#define TAG_VENDOR   (0x5 | TAG_TYPE_STRINGREF)

Definition at line 100 of file db.cpp.

◆ TAG_VENDOR_NAME_RC_ID

#define TAG_VENDOR_NAME_RC_ID   (0x25 | TAG_TYPE_DWORD)

Definition at line 74 of file db.cpp.

◆ TAG_VERFILEOS

#define TAG_VERFILEOS   (0x9 | TAG_TYPE_DWORD)

Definition at line 63 of file db.cpp.

◆ TAG_VERFILETYPE

#define TAG_VERFILETYPE   (0xA | TAG_TYPE_DWORD)

Definition at line 64 of file db.cpp.

◆ TAG_WILDCARD_NAME

#define TAG_WILDCARD_NAME   (0xB | TAG_TYPE_STRINGREF)

Definition at line 104 of file db.cpp.

◆ TAGID_NULL

#define TAGID_NULL   0x0

Definition at line 38 of file db.cpp.

◆ TAGID_ROOT

#define TAGID_ROOT   0x0

Definition at line 39 of file db.cpp.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 11 of file db.cpp.

Typedef Documentation

◆ DB_INFORMATION

◆ PDB_INFORMATION

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pSdbGetDatabaseVersion)
static

◆ check_adwExeFlags() [1/2]

template<typename SDBQUERYRESULT_T >
static void check_adwExeFlags ( DWORD  adwExeFlags_0,
SDBQUERYRESULT_T &  query,
const char file,
int  line,
size_t  cur 
)
static

Definition at line 1196 of file db.cpp.

1197{
1198 ok_(file, line)(query.adwExeFlags[0] == adwExeFlags_0, "Expected adwExeFlags[0] to be 0x%x, was: 0x%x for %d\n", adwExeFlags_0, query.adwExeFlags[0], cur);
1199 for (size_t n = 1; n < _countof(query.atrExes); ++n)
1200 ok_(file, line)(query.adwExeFlags[n] == 0, "Expected adwExeFlags[%d] to be 0, was: %x for %d\n", n, query.adwExeFlags[0], cur);
1201}
#define ok_(x1, x2)
Definition: atltest.h:61
DWORD adwExeFlags_0
Definition: db.cpp:878
FxCollectionEntry * cur
GLdouble n
Definition: glext.h:7729
#define _countof(array)
Definition: sndvol32.h:70
Definition: fci.c:127
Definition: parser.c:49

Referenced by test_mode_generic().

◆ check_adwExeFlags() [2/2]

template<>
void check_adwExeFlags ( DWORD  ,
SDBQUERYRESULT_2k3 ,
const char ,
int  ,
size_t   
)

Definition at line 1204 of file db.cpp.

1205{
1206}

◆ check_db_apphelp()

static void check_db_apphelp ( PDB  pdb,
TAGID  root 
)
static

Definition at line 1016 of file db.cpp.

1017{
1018 int num = 0;
1019 TAGID apphelp = pSdbFindFirstTag(pdb, root, TAG_APPHELP);
1020 while (apphelp != TAGID_NULL)
1021 {
1022 TAGID link;
1023 ok(num < 2, "Too many matches, expected only 4!\n");
1024 if (num >= 2)
1025 break;
1027 link = pSdbFindFirstTag(pdb, apphelp, TAG_LINK);
1028 ok(link != TAGID_NULL, "expected to find a link tag\n");
1029 if (link != TAGID_NULL)
1030 {
1032 }
1035 apphelp = pSdbFindNextTag(pdb, root, apphelp);
1036 num++;
1037 }
1038 ok(num == 2, "Expected to find 2 layer tags, found: %d\n", num);
1039}
DWORD TAGID
#define ok(value,...)
Definition: atltest.h:57
static PDB pdb
Definition: db.cpp:173
#define match_dw_attr
Definition: db.cpp:667
#define TAGID_NULL
Definition: db.cpp:38
static struct @1702 test_layerdata[2]
#define TAG_HTMLHELPID
Definition: db.cpp:67
DWORD htmlhelpid
Definition: db.cpp:997
const WCHAR * apphelp_details
Definition: db.cpp:1000
const WCHAR * apphelp_title
Definition: db.cpp:999
#define TAG_APPHELP_DETAILS
Definition: db.cpp:112
#define TAG_APPHELP
Definition: db.cpp:91
#define TAG_LINK
Definition: db.cpp:92
#define TAG_APPHELP_TITLE
Definition: db.cpp:114
const WCHAR * link
Definition: db.cpp:998
#define TAG_LINK_URL
Definition: db.cpp:113
#define match_strw_attr
Definition: db.cpp:666
GLuint GLuint num
Definition: glext.h:9618

Referenced by test_CheckDatabaseManually().

◆ check_db_exes()

static void check_db_exes ( PDB  pdb,
TAGID  root 
)
static

Definition at line 950 of file db.cpp.

951{
952 int num = 0;
953 TAGID exe = pSdbFindFirstTag(pdb, root, TAG_EXE);
954 TAGID altExe = pSdbFindFirstNamedTag(pdb, root, TAG_EXE, TAG_NAME, L"test_allow.exe");
955 ok_hex(altExe, (int)exe);
956 while (exe != TAGID_NULL)
957 {
958 TAGID apphelp, layer;
959 ok(num < 4, "Too many matches, expected only 4!\n");
960 if (num >= 4)
961 break;
966 check_matching_file(pdb, exe, pSdbFindFirstTag(pdb, exe, TAG_MATCHING_FILE), num);
967 apphelp = pSdbFindFirstTag(pdb, exe, TAG_APPHELP);
968 if (num == 0 || num == 1)
969 {
970 ok(apphelp != TAGID_NULL, "Expected to find a valid apphelp match on %d.\n", num);
971 if (apphelp)
972 check_matching_apphelp(pdb, apphelp, num);
973 }
974 else
975 {
976 ok(apphelp == TAGID_NULL, "Did not expect an apphelp match on %d\n", num);
977 }
978 layer = pSdbFindFirstTag(pdb, exe, TAG_LAYER);
979 if (num == 2 || num == 3)
980 {
981 ok(layer != TAGID_NULL, "Expected to find a valid layer match on %d.\n", num);
982 if (layer)
984 }
985 else
986 {
987 ok(layer == TAGID_NULL, "Did not expect a layer match on %d\n", num);
988 }
989 ++num;
990 exe = pSdbFindNextTag(pdb, root, exe);
991 }
992 ok(num == 4, "Expected to find 4 exe tags, found: %d\n", num);
993}
#define ok_hex(expression, result)
Definition: atltest.h:94
#define match_guid_attr
Definition: db.cpp:669
#define TAG_LAYER
Definition: db.cpp:90
#define TAG_EXE
Definition: db.cpp:87
GUID exe_id
Definition: db.cpp:874
#define TAG_APP_NAME
Definition: db.cpp:101
const WCHAR * vendor
Definition: db.cpp:873
#define TAG_VENDOR
Definition: db.cpp:100
#define TAG_MATCHING_FILE
Definition: db.cpp:88
static void check_matching_file(PDB pdb, TAGID exe, TAGID matching_file, int num)
Definition: db.cpp:739
static struct @1701 test_exedata[5]
#define TAG_NAME
Definition: db.cpp:98
static void check_matching_layer(PDB pdb, TAGID layer, int num)
Definition: db.cpp:854
#define TAG_EXE_ID
Definition: db.cpp:120
const WCHAR * app_name
Definition: db.cpp:872
static void check_matching_apphelp(PDB pdb, TAGID apphelp, int num)
Definition: db.cpp:806
#define L(x)
Definition: resources.c:13
GLenum GLuint GLint GLint layer
Definition: glext.h:7007
Definition: name.c:39

Referenced by test_CheckDatabaseManually().

◆ check_db_layer()

static void check_db_layer ( PDB  pdb,
TAGID  layer 
)
static

Definition at line 705 of file db.cpp.

706{
707 TAGID shimref, inexclude, is_include;
708 ok(layer != TAGID_NULL, "Expected a valid layer, got NULL\n");
709 if (!layer)
710 return;
711
712 match_strw_attr(pdb, layer, TAG_NAME, L"TestNewMode");
713 shimref = pSdbFindFirstTag(pdb, layer, TAG_SHIM_REF);
714 ok(shimref != TAGID_NULL, "Expected a valid shim ref, got NULL\n");
715 if (!shimref)
716 return;
717
718 match_strw_attr(pdb, shimref, TAG_NAME, L"VirtualRegistry");
719 match_strw_attr(pdb, shimref, TAG_COMMAND_LINE, L"ThemeActive");
720 inexclude = pSdbFindFirstTag(pdb, shimref, TAG_INEXCLUD);
721 ok(inexclude != TAGID_NULL, "Expected a valid in/exclude ref, got NULL\n");
722 if (!inexclude)
723 return;
724
725 is_include = pSdbFindFirstTag(pdb, inexclude, TAG_INCLUDE);
726 ok(is_include == TAGID_NULL, "Expected a NULL include ref, but got one anyway.\n");
727 match_strw_attr(pdb, inexclude, TAG_MODULE, L"exclude.dll");
728
729 inexclude = pSdbFindNextTag(pdb, shimref, inexclude);
730 ok(inexclude != TAGID_NULL, "Expected a valid in/exclude ref, got NULL\n");
731 if (!inexclude)
732 return;
733
734 is_include = pSdbFindFirstTag(pdb, inexclude, TAG_INCLUDE);
735 ok(is_include != TAGID_NULL, "Expected a valid include ref, got NULL\n");
736 match_strw_attr(pdb, inexclude, TAG_MODULE, L"include.dll");
737}
#define TAG_MODULE
Definition: db.cpp:99
#define TAG_INEXCLUD
Definition: db.cpp:86
#define TAG_COMMAND_LINE
Definition: db.cpp:102
#define TAG_INCLUDE
Definition: db.cpp:56
#define TAG_SHIM_REF
Definition: db.cpp:89

Referenced by test_CheckDatabaseManually().

◆ check_db_properties()

static void check_db_properties ( PDB  pdb,
TAGID  root 
)
static

Definition at line 675 of file db.cpp.

676{
677 TAGID iter = pSdbFindFirstTag(pdb, root, TAG_DATABASE_ID);
678 ok(iter != TAGID_NULL, "expected a result, got TAGID_NULL\n");
679 if (iter != TAGID_NULL)
680 {
681 GUID guid = { 0 }, guid2 = { 0 };
682 BOOL result = pSdbReadBinaryTag(pdb, iter, (PBYTE)&guid, sizeof(guid));
683 ok(result, "expected SdbReadBinaryTag not to fail.\n");
684 if (result)
685 {
686 WCHAR guid_wstr[50];
687 result = pSdbGUIDToString(&guid, guid_wstr, 50);
688 ok(result, "expected SdbGUIDToString not to fail.\n");
689 if (result)
690 {
691 char guid_str[50];
692 WideCharToMultiByte(CP_ACP, 0, guid_wstr, -1, guid_str, sizeof(guid_str), NULL, NULL);
693 ok_str(guid_str, "{e39b0eb0-55db-450b-9bd4-d20c9484260f}");
694 }
695 ok(pSdbGetDatabaseID(pdb, &guid2), "expected SdbGetDatabaseID not to fail.\n");
696 ok(IsEqualGUID(guid, guid2), "expected guids to be equal(%s:%s)\n", wine_dbgstr_guid(&guid), wine_dbgstr_guid(&guid2));
697 }
698 }
699 match_qw_attr(pdb, root, TAG_TIME, 0x1d1b91a02c0d63e);
701 match_strw_attr(pdb, root, TAG_NAME, L"apphelp_test1");
703}
#define ok_str(x, y)
Definition: atltest.h:127
#define TAG_DATABASE_ID
Definition: db.cpp:122
#define match_qw_attr
Definition: db.cpp:668
#define TAG_COMPILER_VERSION
Definition: db.cpp:116
#define TAG_OS_PLATFORM
Definition: db.cpp:76
#define TAG_TIME
Definition: db.cpp:78
#define NULL
Definition: types.h:112
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
GUID guid
Definition: version.c:147
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint64EXT * result
Definition: glext.h:11304
static GUID guid2
Definition: devinst.c:42
BYTE * PBYTE
Definition: pedump.c:66
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by test_CheckDatabaseManually().

◆ check_matching_apphelp()

static void check_matching_apphelp ( PDB  pdb,
TAGID  apphelp,
int  num 
)
static

Definition at line 806 of file db.cpp.

807{
808 if (num == 0)
809 {
810/*
811[Window Title]
812Program Compatibility Assistant
813
814[Main Instruction]
815This program has known compatibility issues
816
817[Expanded Information]
818Allow it!
819
820[^] Hide details [ ] Don't show this message again [Check for solutions online] [Run program] [Cancel]
821*/
822 match_dw_attr(pdb, apphelp, TAG_FLAGS, 1);
824 match_dw_attr(pdb, apphelp, TAG_HTMLHELPID, 1);
825 match_dw_attr(pdb, apphelp, TAG_APP_NAME_RC_ID, 0x6f0072);
826 match_dw_attr(pdb, apphelp, TAG_VENDOR_NAME_RC_ID, 0x720067);
828 }
829 else
830 {
831/*
832[Window Title]
833Program Compatibility Assistant
834
835[Main Instruction]
836This program is blocked due to compatibility issues
837
838[Expanded Information]
839Not allowed!
840
841[^] Hide details [Check for solutions online] [Cancel]
842*/
843 match_dw_attr(pdb, apphelp, TAG_FLAGS, 1);
845 match_dw_attr(pdb, apphelp, TAG_HTMLHELPID, 2);
846 match_dw_attr(pdb, apphelp, TAG_APP_NAME_RC_ID, 0x320020);
847 match_dw_attr(pdb, apphelp, TAG_VENDOR_NAME_RC_ID, 0x38002e);
849 }
850 apphelp = pSdbFindNextTag(pdb, apphelp, apphelp);
851 ok(apphelp == TAGID_NULL, "Did not expect a secondary match on %d\n", num);
852}
#define TAG_APP_NAME_RC_ID
Definition: db.cpp:73
#define TAG_SUMMARY_MSG_RC_ID
Definition: db.cpp:75
#define TAG_PROBLEMSEVERITY
Definition: db.cpp:66
#define TAG_VENDOR_NAME_RC_ID
Definition: db.cpp:74
#define TAG_FLAGS
Definition: db.cpp:68

Referenced by check_db_exes().

◆ check_matching_file()

static void check_matching_file ( PDB  pdb,
TAGID  exe,
TAGID  matching_file,
int  num 
)
static

Definition at line 739 of file db.cpp.

740{
741 ok(matching_file != TAGID_NULL, "Expected to find atleast 1 matching file.\n");
742 if (matching_file == TAGID_NULL)
743 return;
744
745 ok(num < 4, "Too many matches, expected only 4!\n");
746 if (num >= 4)
747 return;
748
749
750 match_strw_attr(pdb, matching_file, TAG_NAME, L"*");
751 match_strw_attr(pdb, matching_file, TAG_COMPANY_NAME, L"CompanyName");
752 match_strw_attr(pdb, matching_file, TAG_PRODUCT_NAME, L"ProductName");
753 match_strw_attr(pdb, matching_file, TAG_PRODUCT_VERSION, L"1.0.0.1");
754 match_strw_attr(pdb, matching_file, TAG_FILE_VERSION, L"1.0.0.0");
755
756 if (num == 0 || num == 3)
757 {
758 match_qw_attr(pdb, matching_file, TAG_UPTO_BIN_PRODUCT_VERSION, 0x1000000000001);
759 match_qw_attr(pdb, matching_file, TAG_UPTO_BIN_FILE_VERSION, 0x1000000000000);
760 }
761 if (num == 1 || num == 3)
762 {
763 match_dw_attr(pdb, matching_file, TAG_PE_CHECKSUM, 0xbaad);
764 }
765 if (num != 0)
766 {
767 match_qw_attr(pdb, matching_file, TAG_BIN_PRODUCT_VERSION, 0x1000000000001);
768 match_qw_attr(pdb, matching_file, TAG_BIN_FILE_VERSION, 0x1000000000000);
769 }
770 if (num == 3)
771 {
772 match_dw_attr(pdb, matching_file, TAG_SIZE, 0x800);
773 match_dw_attr(pdb, matching_file, TAG_CHECKSUM, 0x178bd629);
774 match_strw_attr(pdb, matching_file, TAG_FILE_DESCRIPTION, L"FileDescription");
775 match_dw_attr(pdb, matching_file, TAG_MODULE_TYPE, 3);
776 match_dw_attr(pdb, matching_file, TAG_VERFILEOS, 4);
777 match_dw_attr(pdb, matching_file, TAG_VERFILETYPE, 1);
778 match_dw_attr(pdb, matching_file, TAG_LINKER_VERSION, 0x40002);
779 match_strw_attr(pdb, matching_file, TAG_ORIGINAL_FILENAME, L"OriginalFilename");
780 match_strw_attr(pdb, matching_file, TAG_INTERNAL_NAME, L"InternalName");
781 match_strw_attr(pdb, matching_file, TAG_LEGAL_COPYRIGHT, L"LegalCopyright");
782 match_dw_attr(pdb, matching_file, TAG_LINK_DATE, 0x12345);
783 match_dw_attr(pdb, matching_file, TAG_UPTO_LINK_DATE, 0x12345);
784 }
785 if (num > 3)
786 {
787 ok(0, "unknown case: %d\n", num);
788 }
789 matching_file = pSdbFindNextTag(pdb, exe, matching_file);
790 if (num == 2)
791 {
792 ok(matching_file != TAGID_NULL, "Did expect a secondary match on %d\n", num);
793 match_strw_attr(pdb, matching_file, TAG_NAME, L"test_checkfile.txt");
794 match_dw_attr(pdb, matching_file, TAG_SIZE, 0x4);
795 match_dw_attr(pdb, matching_file, TAG_CHECKSUM, 0xb0b0b0b0);
796 }
797 else
798 {
799 ok(matching_file == TAGID_NULL, "Did not expect a secondary match on %d\n", num);
800 }
801}
#define TAG_UPTO_BIN_FILE_VERSION
Definition: db.cpp:82
#define TAG_ORIGINAL_FILENAME
Definition: db.cpp:109
#define TAG_LINKER_VERSION
Definition: db.cpp:70
#define TAG_UPTO_LINK_DATE
Definition: db.cpp:72
#define TAG_SIZE
Definition: db.cpp:60
#define TAG_FILE_DESCRIPTION
Definition: db.cpp:107
#define TAG_VERFILETYPE
Definition: db.cpp:64
#define TAG_BIN_FILE_VERSION
Definition: db.cpp:79
#define TAG_VERFILEOS
Definition: db.cpp:63
#define TAG_UPTO_BIN_PRODUCT_VERSION
Definition: db.cpp:81
#define TAG_FILE_VERSION
Definition: db.cpp:108
#define TAG_LEGAL_COPYRIGHT
Definition: db.cpp:111
#define TAG_PRODUCT_NAME
Definition: db.cpp:105
#define TAG_CHECKSUM
Definition: db.cpp:61
#define TAG_PE_CHECKSUM
Definition: db.cpp:65
#define TAG_COMPANY_NAME
Definition: db.cpp:103
#define TAG_LINK_DATE
Definition: db.cpp:71
#define TAG_BIN_PRODUCT_VERSION
Definition: db.cpp:80
#define TAG_INTERNAL_NAME
Definition: db.cpp:110
#define TAG_MODULE_TYPE
Definition: db.cpp:62
#define TAG_PRODUCT_VERSION
Definition: db.cpp:106

Referenced by check_db_exes().

◆ check_matching_layer()

static void check_matching_layer ( PDB  pdb,
TAGID  layer,
int  num 
)
static

Definition at line 854 of file db.cpp.

855{
856 if (num == 2)
857 {
859 match_strw_attr(pdb, layer, TAG_NAME, L"TestNewMode");
860 }
861 else
862 {
863 TAGID layer_tagid = pSdbFindFirstTag(pdb, layer, TAG_LAYER_TAGID);
864 ok(layer_tagid == TAGID_NULL, "expected not to find a layer tagid, got %x\n", layer_tagid);
865 match_strw_attr(pdb, layer, TAG_NAME, L"WinSrv03");
866 }
867}
#define TAG_LAYER_TAGID
Definition: db.cpp:69

Referenced by check_db_exes().

◆ DEFINE_GUID() [1/2]

DEFINE_GUID ( GUID_DATABASE_TEST  ,
0xe39b0eb0  ,
0x55db  ,
0x450b  ,
0x9b  ,
0xd4  ,
0xd2  ,
0x0c  ,
0x94  ,
0x84  ,
0x26  ,
0x0f   
)

◆ DEFINE_GUID() [2/2]

DEFINE_GUID ( GUID_MAIN_DATABASE  ,
0x11111111  ,
0x1111  ,
0x1111  ,
0x11  ,
0x11  ,
0x11  ,
0x11  ,
0x11  ,
0x11  ,
0x11  ,
0x11   
)

◆ DWORD()

static DWORD ( WINAPI pSdbReadDWORDTag)
static

◆ expect_indexA_imp()

static void expect_indexA_imp ( const char text,
LONGLONG  expected 
)
static

Definition at line 1949 of file db.cpp.

1950{
1951 static WCHAR wide_string[100] = { 0 };
1953 MultiByteToWideChar(CP_ACP, 0, text, -1, wide_string, 100);
1954
1955 result = pSdbMakeIndexKeyFromString(wide_string);
1956 winetest_ok(result == expected, "Expected %s to result in %s, was: %s\n", text, wine_dbgstr_longlong(expected), wine_dbgstr_longlong(result));
1957}
static LPCWSTR LPCWSTR LPCWSTR DWORD PSDBQUERYRESULT_VISTA result
Definition: db.cpp:171
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
#define MultiByteToWideChar
Definition: compat.h:110
const WCHAR * text
Definition: package.c:1794
void __cdecl winetest_ok(int condition, const char *msg,...) __WINE_PRINTF_ATTR(2
BOOL expected
Definition: store.c:2000
int64_t LONGLONG
Definition: typedefs.h:68

◆ extract_resource()

static bool extract_resource ( const WCHAR Filename,
LPCWSTR  ResourceName 
)
static

Definition at line 1451 of file db.cpp.

1452{
1454 HRSRC hRsrc = FindResourceW(hMod, ResourceName, MAKEINTRESOURCEW(RT_RCDATA));
1455 ok(!!hRsrc, "Unable to find %s\n", wine_dbgstr_w(ResourceName));
1456 if (!hRsrc)
1457 return false;
1458
1459 HGLOBAL hGlobal = LoadResource(hMod, hRsrc);
1460 DWORD Size = SizeofResource(hMod, hRsrc);
1461 LPVOID pData = LockResource(hGlobal);
1462
1463 ok(Size && !!pData, "Unable to load %s\n", wine_dbgstr_w(ResourceName));
1464 if (!Size || !pData)
1465 return false;
1466
1467 BOOL Written = write_raw_file(Filename, pData, Size);
1469 return Written;
1470}
static BOOL write_raw_file(const WCHAR *FileName, const void *Data, DWORD Size)
Definition: db.cpp:1433
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
IN PVCB IN PBCB OUT PDIRENT IN USHORT IN POEM_STRING Filename
Definition: fatprocs.h:940
unsigned long DWORD
Definition: ntddk_ex.h:95
#define wine_dbgstr_w
Definition: kernel32.h:34
#define RT_RCDATA
Definition: pedump.c:372
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
#define UnlockResource(handle)
Definition: winbase.h:3114
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by START_TEST(), test_Data(), and test_MatchApplicationsEx().

◆ HSDB()

static HSDB ( WINAPI pSdbInitDatabase)
static

◆ LONGLONG()

static LONGLONG ( WINAPI pSdbMakeIndexKeyFromString)
static

◆ LPCWSTR()

static LPCWSTR ( WINAPI pSdbTagToString)
static

◆ LPWSTR()

static LPWSTR ( WINAPI pSdbGetStringTagPtr)
static

◆ match_dw_attr_imp()

static void match_dw_attr_imp ( PDB  pdb,
TAGID  parent,
TAG  find,
DWORD  compare 
)
static

Definition at line 631 of file db.cpp.

632{
633 TAGID attr = pSdbFindFirstTag(pdb, parent, find);
634 winetest_ok(attr != TAG_NULL, "Could not find: %x\n", find);
635 if (attr != TAG_NULL)
636 {
637 DWORD val = pSdbReadDWORDTag(pdb, attr, 0x1234567);
638 winetest_ok(val == compare, "Expected tagid %x to be 0x%x, was 0x%x\n", attr, compare, val);
639 }
640}
#define TAG_NULL
Definition: db.cpp:54
static TAGID TAGID find
Definition: db.cpp:156
r parent
Definition: btrfs.c:3010
GLuint GLfloat * val
Definition: glext.h:7180
Definition: cookie.c:202
Definition: bug.cpp:8

◆ match_guid_attr_imp()

static void match_guid_attr_imp ( PDB  pdb,
TAGID  parent,
TAG  find,
const GUID compare 
)
static

Definition at line 653 of file db.cpp.

654{
655 TAGID attr = pSdbFindFirstTag(pdb, parent, find);
656 winetest_ok(attr != TAG_NULL, "Could not find: %x\n", find);
657 if (attr != TAG_NULL)
658 {
659 GUID guid = { 0 };
660 BOOL result = pSdbReadBinaryTag(pdb, attr, (PBYTE)&guid, sizeof(guid));
661 winetest_ok(result, "expected pSdbReadBinaryTag not to fail.\n");
662 winetest_ok(IsEqualGUID(guid, *compare), "expected guids to be equal(%s:%s)\n", wine_dbgstr_guid(&guid), wine_dbgstr_guid(compare));
663 }
664}

◆ match_qw_attr_imp()

static void match_qw_attr_imp ( PDB  pdb,
TAGID  parent,
TAG  find,
QWORD  compare 
)
static

Definition at line 642 of file db.cpp.

643{
644 TAGID attr = pSdbFindFirstTag(pdb, parent, find);
645 winetest_ok(attr != TAG_NULL, "Could not find: %x\n", find);
646 if (attr != TAG_NULL)
647 {
648 QWORD val = pSdbReadQWORDTag(pdb, attr, 0x123456789abcdef);
649 winetest_ok(val == compare, "Expected tagid %x to be 0x%I64x, was 0x%I64x\n", attr, compare, val);
650 }
651}
UINT64 QWORD
Definition: shimdbg.c:104

◆ match_strw_attr_imp()

static void match_strw_attr_imp ( PDB  pdb,
TAGID  parent,
TAG  find,
const WCHAR compare 
)
static

Definition at line 616 of file db.cpp.

617{
618 TAGID attr = pSdbFindFirstTag(pdb, parent, find);
619 winetest_ok(attr != TAG_NULL, "Could not find: %x\n", find);
620 if (attr != TAG_NULL)
621 {
622 LPWSTR name = pSdbGetStringTagPtr(pdb, attr);
623 winetest_ok(name != NULL, "Could not convert attr to str.\n");
624 if (name)
625 {
626 winetest_ok(wcscmp(name, compare) == 0, "Expected tagid %x to be %s, was %s\n", attr, wine_dbgstr_w(compare), wine_dbgstr_w(name));
627 }
628 }
629}
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ PDB()

static PDB ( WINAPI pSdbOpenDatabase)
static

◆ PVOID()

static PVOID ( WINAPI pSdbGetBinaryTagData)
static

◆ QWORD()

static QWORD ( WINAPI pSdbReadQWORDTag)
static

◆ START_TEST()

START_TEST ( db  )

Definition at line 2074 of file db.cpp.

2075{
2076 //SetEnvironmentVariableA("SHIM_DEBUG_LEVEL", "4");
2077 //SetEnvironmentVariableA("SHIMENG_DEBUG_LEVEL", "4");
2078 //SetEnvironmentVariableA("DEBUGCHANNEL", "+apphelp");
2079
2081 hdll = LoadLibraryA("apphelp.dll");
2082
2083 /* We detect the apphelp version that is loaded, instead of the os we are running on.
2084 This allows for easier testing multiple versions of the dll */
2086 trace("Apphelp version: 0x%x\n", g_WinVersion);
2087
2088 *(void**)&pSdbTagToString = (void *)GetProcAddress(hdll, "SdbTagToString");
2089 *(void**)&pSdbOpenDatabase = (void *)GetProcAddress(hdll, "SdbOpenDatabase");
2090 *(void**)&pSdbCreateDatabase = (void *)GetProcAddress(hdll, "SdbCreateDatabase");
2091 *(void**)&pSdbGetDatabaseVersion = (void *)GetProcAddress(hdll, "SdbGetDatabaseVersion");
2092 *(void**)&pSdbCloseDatabase = (void *)GetProcAddress(hdll, "SdbCloseDatabase");
2093 *(void**)&pSdbCloseDatabaseWrite = (void *)GetProcAddress(hdll, "SdbCloseDatabaseWrite");
2094 *(void**)&pSdbGetTagFromTagID = (void *)GetProcAddress(hdll, "SdbGetTagFromTagID");
2095 *(void**)&pSdbWriteNULLTag = (void *)GetProcAddress(hdll, "SdbWriteNULLTag");
2096 *(void**)&pSdbWriteWORDTag = (void *)GetProcAddress(hdll, "SdbWriteWORDTag");
2097 *(void**)&pSdbWriteDWORDTag = (void *)GetProcAddress(hdll, "SdbWriteDWORDTag");
2098 *(void**)&pSdbWriteQWORDTag = (void *)GetProcAddress(hdll, "SdbWriteQWORDTag");
2099 *(void**)&pSdbWriteBinaryTagFromFile = (void *)GetProcAddress(hdll, "SdbWriteBinaryTagFromFile");
2100 *(void**)&pSdbWriteStringTag = (void *)GetProcAddress(hdll, "SdbWriteStringTag");
2101 *(void**)&pSdbWriteStringRefTag = (void *)GetProcAddress(hdll, "SdbWriteStringRefTag");
2102 *(void**)&pSdbBeginWriteListTag = (void *)GetProcAddress(hdll, "SdbBeginWriteListTag");
2103 *(void**)&pSdbEndWriteListTag = (void *)GetProcAddress(hdll, "SdbEndWriteListTag");
2104 *(void**)&pSdbFindFirstTag = (void *)GetProcAddress(hdll, "SdbFindFirstTag");
2105 *(void**)&pSdbFindNextTag = (void *)GetProcAddress(hdll, "SdbFindNextTag");
2106 *(void**)&pSdbFindFirstNamedTag = (void *)GetProcAddress(hdll, "SdbFindFirstNamedTag");
2107 *(void**)&pSdbReadWORDTag = (void *)GetProcAddress(hdll, "SdbReadWORDTag");
2108 *(void**)&pSdbReadDWORDTag = (void *)GetProcAddress(hdll, "SdbReadDWORDTag");
2109 *(void**)&pSdbReadQWORDTag = (void *)GetProcAddress(hdll, "SdbReadQWORDTag");
2110 *(void**)&pSdbReadBinaryTag = (void *)GetProcAddress(hdll, "SdbReadBinaryTag");
2111 *(void**)&pSdbReadStringTag = (void *)GetProcAddress(hdll, "SdbReadStringTag");
2112 *(void**)&pSdbGetTagDataSize = (void *)GetProcAddress(hdll, "SdbGetTagDataSize");
2113 *(void**)&pSdbGetBinaryTagData = (void *)GetProcAddress(hdll, "SdbGetBinaryTagData");
2114 *(void**)&pSdbGetStringTagPtr = (void *)GetProcAddress(hdll, "SdbGetStringTagPtr");
2115 *(void**)&pSdbGetFirstChild = (void *)GetProcAddress(hdll, "SdbGetFirstChild");
2116 *(void**)&pSdbGetNextChild = (void *)GetProcAddress(hdll, "SdbGetNextChild");
2117 *(void**)&pSdbGetDatabaseID = (void *)GetProcAddress(hdll, "SdbGetDatabaseID");
2118 *(void**)&pSdbGUIDToString = (void *)GetProcAddress(hdll, "SdbGUIDToString");
2119 *(void**)&pSdbInitDatabase = (void *)GetProcAddress(hdll, "SdbInitDatabase");
2120 *(void**)&pSdbReleaseDatabase = (void *)GetProcAddress(hdll, "SdbReleaseDatabase");
2121 *(void**)&pSdbGetMatchingExe = (void *)GetProcAddress(hdll, "SdbGetMatchingExe");
2122 *(void**)&pSdbTagRefToTagID = (void *)GetProcAddress(hdll, "SdbTagRefToTagID");
2123 *(void**)&pSdbTagIDToTagRef = (void *)GetProcAddress(hdll, "SdbTagIDToTagRef");
2124 *(void**)&pSdbMakeIndexKeyFromString = (void *)GetProcAddress(hdll, "SdbMakeIndexKeyFromString");
2125 *(void**)&pSdbQueryData = (void *)GetProcAddress(hdll, "SdbQueryData");
2126 *(void**)&pSdbQueryDataEx = (void *)GetProcAddress(hdll, "SdbQueryDataEx");
2127 *(void**)&pSdbQueryDataExTagID = (void *)GetProcAddress(hdll, "SdbQueryDataExTagID");
2128 *(void**)&pSdbGetLayerTagRef = (void *)GetProcAddress(hdll, "SdbGetLayerTagRef");
2129 *(void**)&pSdbGetDatabaseInformation = (void *)GetProcAddress(hdll, "SdbGetDatabaseInformation");
2130 *(void**)&pSdbFreeDatabaseInformation = (void *)GetProcAddress(hdll, "SdbFreeDatabaseInformation");
2131
2132 test_Sdb();
2133 test_write_ex();
2136#ifdef _M_IX86
2138 {
2139 case 1:
2140 test_MatchApplications<SDBQUERYRESULT_2k3>();
2141 test_MatchApplicationsEx<SDBQUERYRESULT_2k3>();
2142 break;
2143 case 2:
2144 test_MatchApplications<SDBQUERYRESULT_VISTA>();
2145 test_MatchApplicationsEx<SDBQUERYRESULT_VISTA>();
2146 break;
2147 default:
2148 skip("Skipping tests with SDBQUERYRESULT due to a wrong size reported\n");
2149 break;
2150 }
2151#else
2152 skip("FIXME: We need a new db test for non-x86!\n");
2153#endif
2154 test_TagRef();
2155 test_Data();
2156 skip("test_SecondaryDB()\n");
2158}
DWORD get_module_version(HMODULE mod)
Definition: data.c:811
void silence_debug_output(void)
Definition: data.c:841
DWORD g_WinVersion
Definition: data.c:795
#define trace
Definition: atltest.h:70
#define skip(...)
Definition: atltest.h:64
static HMODULE hdll
Definition: db.cpp:137
static void test_IndexKeyFromString(void)
Definition: db.cpp:1961
static int validate_SDBQUERYRESULT_size()
Definition: db.cpp:2035
static void test_Sdb(void)
Definition: db.cpp:247
static void test_CheckDatabaseManually(void)
Definition: db.cpp:1099
static void test_TagRef(void)
Definition: db.cpp:1585
static void test_write_ex(void)
Definition: db.cpp:408
static void test_Data(void)
Definition: db.cpp:1905
static void test_stringtable()
Definition: db.cpp:534
#define GetProcAddress(x, y)
Definition: compat.h:753
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111

◆ TAG()

static TAG ( WINAPI pSdbGetTagFromTagID)
static

◆ TAGID()

static TAGID ( WINAPI pSdbBeginWriteListTag)
static

◆ TAGREF()

static TAGREF ( WINAPI pSdbGetLayerTagRef)
static

◆ test_CheckDatabaseManually()

static void test_CheckDatabaseManually ( void  )
static

Definition at line 1099 of file db.cpp.

1100{
1101 static const WCHAR path[] = {'t','e','s','t','_','d','b','.','s','d','b',0};
1102 TAGID root;
1103 PDB pdb;
1104 BOOL ret;
1105 DWORD ver_hi, ver_lo;
1106
1107 test_create_db(L"test_db.sdb", g_WinVersion >= WINVER_WIN10);
1108
1109 /* both ver_hi and ver_lo cannot be null, it'll crash. */
1110 ver_hi = ver_lo = 0x12345678;
1111 ret = pSdbGetDatabaseVersion(path, &ver_hi, &ver_lo);
1112 ok(ret, "Expected SdbGetDatabaseVersion to succeed\n");
1114 {
1115 ok(ver_hi == 3, "Expected ver_hi to be 3, was: %d\n", ver_hi);
1116 ok(ver_lo == 0, "Expected ver_lo to be 0, was: %d\n", ver_lo);
1117 }
1118 else
1119 {
1120 ok(ver_hi == 2, "Expected ver_hi to be 2, was: %d\n", ver_hi);
1121 ok(ver_lo == 1, "Expected ver_lo to be 1, was: %d\n", ver_lo);
1122 }
1123
1124 ver_hi = ver_lo = 0x12345678;
1125 ret = pSdbGetDatabaseVersion(NULL, &ver_hi, &ver_lo);
1127 {
1128 ok(ret == FALSE, "Expected SdbGetDatabaseVersion to fail\n");
1129 ok(ver_hi == 0, "Expected ver_hi to be 0, was: 0x%x\n", ver_hi);
1130 ok(ver_lo == 0, "Expected ver_lo to be 0, was: 0x%x\n", ver_lo);
1131 }
1132 else
1133 {
1134 ok(ret, "Expected SdbGetDatabaseVersion to succeed\n");
1135 ok(ver_hi == 0x12345678, "Expected ver_hi to be 0x12345678, was: 0x%x\n", ver_hi);
1136 ok(ver_lo == 0x12345678, "Expected ver_lo to be 0x12345678, was: 0x%x\n", ver_lo);
1137 }
1138
1139 ver_hi = ver_lo = 0x12345678;
1140 ret = pSdbGetDatabaseVersion(path + 1, &ver_hi, &ver_lo);
1142 {
1143 ok(ret == FALSE, "Expected SdbGetDatabaseVersion to fail\n");
1144 ok(ver_hi == 0, "Expected ver_hi to be 0, was: 0x%x\n", ver_hi);
1145 ok(ver_lo == 0, "Expected ver_lo to be 0, was: 0x%x\n", ver_lo);
1146 }
1147 else
1148 {
1149 ok(ret, "Expected SdbGetDatabaseVersion to succeed\n");
1150 ok(ver_hi == 0x12345678, "Expected ver_hi to be 0x12345678, was: 0x%x\n", ver_hi);
1151 ok(ver_lo == 0x12345678, "Expected ver_lo to be 0x12345678, was: 0x%x\n", ver_lo);
1152 }
1153
1154 pdb = pSdbOpenDatabase(path, DOS_PATH);
1155 ok(pdb != NULL, "unexpected NULL handle\n");
1156
1157 root = pSdbFindFirstTag(pdb, TAGID_ROOT, TAG_DATABASE);
1158 ok(root != TAGID_NULL, "expected to find a root tag\n");
1159 if (root != TAGID_NULL)
1160 {
1161 TAGID tagLayer = pSdbFindFirstTag(pdb, root, TAG_LAYER);
1162 TAGID tagAlt = pSdbFindFirstNamedTag(pdb, root, TAG_LAYER, TAG_NAME, L"TestNewMode");
1163 TAGID tagAlt2 = pSdbFindFirstNamedTag(pdb, root, TAG_LAYER, TAG_NAME, L"TESTNEWMODE");
1164 TAGID tagAlt3 = pSdbFindFirstNamedTag(pdb, root, TAG_LAYER, TAG_NAME, L"testnewmode");
1165 ok_hex(tagLayer, (int)tagAlt);
1166 ok_hex(tagLayer, (int)tagAlt2);
1167 ok_hex(tagLayer, (int)tagAlt3);
1169 check_db_layer(pdb, tagLayer);
1172 }
1174
1175 pSdbCloseDatabase(pdb);
1176 DeleteFileA("test_db.sdb");
1177}
#define WINVER_WIN10
#define test_create_db
static void check_db_apphelp(PDB pdb, TAGID root)
Definition: db.cpp:1016
static void test_GetDatabaseInformation(PDB pdb)
Definition: db.cpp:1041
static TAGID root
Definition: db.cpp:156
#define DOS_PATH
Definition: db.cpp:32
#define TAGID_ROOT
Definition: db.cpp:39
static void check_db_properties(PDB pdb, TAGID root)
Definition: db.cpp:675
static void check_db_layer(PDB pdb, TAGID layer)
Definition: db.cpp:705
static void check_db_exes(PDB pdb, TAGID root)
Definition: db.cpp:950
#define TAG_DATABASE
Definition: db.cpp:85
#define FALSE
Definition: types.h:117
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
return ret
Definition: mutex.c:146

Referenced by START_TEST().

◆ test_Data()

static void test_Data ( void  )
static

Definition at line 1905 of file db.cpp.

1906{
1907 WCHAR workdir[MAX_PATH], dbpath[MAX_PATH];
1908 BOOL ret;
1909 HSDB hsdb;
1910
1912 ok(ret, "GetTempPathW error: %d\n", GetLastError());
1913 lstrcatW(workdir, L"apphelp_test");
1914
1916 ok(ret, "CreateDirectoryW error: %d\n", GetLastError());
1917
1918 /* SdbInitDatabase needs an nt-path */
1919 swprintf(dbpath, L"\\??\\%s\\test.sdb", workdir);
1920
1921 if (extract_resource(dbpath + 4, MAKEINTRESOURCEW(101)))
1922 {
1923 hsdb = pSdbInitDatabase(HID_DATABASE_FULLPATH, dbpath);
1924
1925 ok(hsdb != NULL, "Expected a valid database handle\n");
1926
1927 if (!hsdb)
1928 {
1929 skip("SdbInitDatabase not implemented?\n");
1930 }
1931 else
1932 {
1933 test_DataTags(hsdb);
1934 pSdbReleaseDatabase(hsdb);
1935 }
1936 }
1937 else
1938 {
1939 ok(0, "Unable to extract database\n");
1940 }
1941
1942 DeleteFileW(dbpath + 4);
1943
1945 ok(ret, "RemoveDirectoryW error: %d\n", GetLastError());
1946}
static bool extract_resource(const WCHAR *Filename, LPCWSTR ResourceName)
Definition: db.cpp:1451
#define HID_DATABASE_FULLPATH
Definition: db.cpp:33
static void test_DataTags(HSDB hsdb)
Definition: db.cpp:1726
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
BOOL WINAPI RemoveDirectoryW(IN LPCWSTR lpPathName)
Definition: dir.c:732
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2080
#define swprintf
Definition: precomp.h:40
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
static char workdir[MAX_PATH]
Definition: batch.c:26
Definition: apphelp.h:30
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by START_TEST().

◆ test_DataTags()

static void test_DataTags ( HSDB  hsdb)
static

Definition at line 1726 of file db.cpp.

1727{
1728 PDB pdb = NULL;
1729 TAGID db = TAGID_NULL, layer, exe;
1730 TAGREF trData;
1731 BYTE Buffer[1024];
1732 DWORD dwBufferSize, dwDataType, dwRet;
1733 TAGID tiData;
1734
1735 BOOL ret = pSdbTagRefToTagID(hsdb, TAGID_ROOT, &pdb, NULL);
1736
1737 ok(ret != FALSE, "Expected ret to be TRUE, was: %d\n", ret);
1738 ok(pdb != NULL, "Expected pdb to be valid\n");
1739
1740 if (pdb == NULL)
1741 {
1742 skip("Cannot run tests without pdb\n");
1743 return;
1744 }
1745
1746 db = pSdbFindFirstTag(pdb, TAGID_ROOT, TAG_DATABASE);
1747 ok(db != NULL, "Expected db to be valid\n");
1748 if (db == TAGID_NULL)
1749 {
1750 skip("Cannot run tests without db\n");
1751 return;
1752 }
1753
1754 layer = pSdbFindFirstNamedTag(pdb, db, TAG_LAYER, TAG_NAME, L"DATA_LAYER");
1755 ok(layer != NULL, "Expected layer to be valid\n");
1756 if (layer == TAGID_NULL)
1757 {
1758 skip("Cannot run tests without layer\n");
1759 return;
1760 }
1761
1762 memset(Buffer, 0xaa, sizeof(Buffer));
1763 dwBufferSize = sizeof(Buffer);
1764 dwDataType = 0x12345;
1765 tiData = 0x111111;
1766 dwRet = pSdbQueryDataExTagID(pdb, layer, L"TESTDATA1", &dwDataType, Buffer, &dwBufferSize, &tiData);
1767 ok_hex(dwRet, ERROR_SUCCESS);
1768 ok_hex(dwDataType, REG_DWORD);
1769 ok_hex(dwBufferSize, sizeof(DWORD));
1770 ok_hex(*(DWORD*)Buffer, 3333);
1771 ok(tiData != NULL && tiData != 0x111111, "Expected tiData, got NULL\n");
1772 ok_hex(pSdbGetTagFromTagID(pdb, tiData), TAG_DATA);
1773
1774 memset(Buffer, 0xaa, sizeof(Buffer));
1775 dwBufferSize = sizeof(Buffer);
1776 dwRet = pSdbQueryDataExTagID(pdb, layer, L"TESTDATA1", NULL, Buffer, &dwBufferSize, NULL);
1777 ok_hex(dwRet, ERROR_SUCCESS);
1778 ok_hex(dwBufferSize, sizeof(DWORD));
1779 ok_hex(*(DWORD*)Buffer, 3333);
1780
1782 {
1783 memset(Buffer, 0xaa, sizeof(Buffer));
1784 dwBufferSize = sizeof(Buffer);
1785 dwRet = pSdbQueryDataExTagID(pdb, layer, L"TESTDATA1", NULL, Buffer, NULL, NULL);
1787 ok_hex(*(DWORD*)Buffer, (int)0xaaaaaaaa);
1788 }
1789
1790 memset(Buffer, 0xaa, sizeof(Buffer));
1791 dwBufferSize = 1;
1792 dwRet = pSdbQueryDataExTagID(pdb, layer, L"TESTDATA1", NULL, Buffer, &dwBufferSize, NULL);
1794 ok_hex(dwBufferSize, sizeof(DWORD));
1795 ok_hex(*(DWORD*)Buffer, (int)0xaaaaaaaa);
1796
1797 memset(Buffer, 0xaa, sizeof(Buffer));
1798 dwBufferSize = sizeof(Buffer);
1799 dwRet = pSdbQueryDataExTagID(pdb, layer, L"TESTDATA1", NULL, NULL, &dwBufferSize, NULL);
1801 ok_hex(dwBufferSize, sizeof(DWORD));
1802 ok_hex(*(DWORD*)Buffer, (int)0xaaaaaaaa);
1803
1804 memset(Buffer, 0xaa, sizeof(Buffer));
1805 dwBufferSize = sizeof(Buffer);
1806 dwRet = pSdbQueryDataExTagID(pdb, TAGID_NULL, L"TESTDATA1", NULL, Buffer, &dwBufferSize, NULL);
1807 ok_hex(dwRet, ERROR_NOT_FOUND);
1808 ok_hex(dwBufferSize, sizeof(Buffer));
1809 ok_hex(*(DWORD*)Buffer, (int)0xaaaaaaaa);
1810
1811 memset(Buffer, 0xaa, sizeof(Buffer));
1812 dwBufferSize = sizeof(Buffer);
1813 dwDataType = 0x12345;
1814 tiData = 0x111111;
1815 dwRet = pSdbQueryDataExTagID(pdb, layer, L"TESTDATA2", &dwDataType, Buffer, &dwBufferSize, &tiData);
1816 ok_hex(dwRet, ERROR_SUCCESS);
1817 ok_hex(dwDataType, REG_QWORD);
1818 ok_hex(dwBufferSize, sizeof(QWORD));
1819 ok(*(QWORD*)Buffer == 4294967295ull, "unexpected value 0x%I64x, expected 4294967295\n", *(QWORD*)Buffer);
1820 ok(tiData != NULL && tiData != 0x111111, "Expected tiData, got NULL\n");
1821 ok_hex(pSdbGetTagFromTagID(pdb, tiData), TAG_DATA);
1822
1823 /* Not case sensitive */
1824 memset(Buffer, 0xaa, sizeof(Buffer));
1825 dwBufferSize = sizeof(Buffer);
1826 dwDataType = 0x12345;
1827 tiData = 0x111111;
1828 dwRet = pSdbQueryDataExTagID(pdb, layer, L"TESTDATA3", &dwDataType, Buffer, &dwBufferSize, &tiData);
1829 ok_hex(dwRet, ERROR_SUCCESS);
1830 ok_hex(dwDataType, REG_SZ);
1831 ok_hex(dwBufferSize, (int)((wcslen(L"Test string")+1) * sizeof(WCHAR)));
1832 Buffer[_countof(Buffer)-1] = L'\0';
1833 ok_wstr(((WCHAR*)Buffer), L"Test string");
1834 ok(tiData != NULL && tiData != 0x111111, "Expected tiData, got NULL\n");
1835 ok_hex(pSdbGetTagFromTagID(pdb, tiData), TAG_DATA);
1836
1837 /* Show that SdbQueryDataEx behaves the same */
1838 memset(Buffer, 0xaa, sizeof(Buffer));
1839 dwBufferSize = sizeof(Buffer);
1840 dwDataType = 0x12345;
1841 trData = 0x111111;
1842 dwRet = pSdbQueryDataEx(hsdb, layer, L"TESTDATA1", &dwDataType, Buffer, &dwBufferSize, &trData);
1843 ok_hex(dwRet, ERROR_SUCCESS);
1844 ok_hex(dwDataType, REG_DWORD);
1845 ok_hex(dwBufferSize, sizeof(DWORD));
1846 ok_hex(*(DWORD*)Buffer, 3333);
1847 ok(trData != NULL && trData != 0x111111, "Expected trData, got NULL\n");
1848
1849 /* And SdbQueryData as well */
1850 memset(Buffer, 0xaa, sizeof(Buffer));
1851 dwBufferSize = sizeof(Buffer);
1852 dwDataType = 0x12345;
1853 dwRet = pSdbQueryData(hsdb, layer, L"TESTDATA1", &dwDataType, Buffer, &dwBufferSize);
1854 ok_hex(dwRet, ERROR_SUCCESS);
1855 ok_hex(dwDataType, REG_DWORD);
1856 ok_hex(dwBufferSize, sizeof(DWORD));
1857 ok_hex(*(DWORD*)Buffer, 3333);
1858
1859 exe = pSdbFindFirstNamedTag(pdb, db, TAG_EXE, TAG_NAME, L"test_match0.exe");
1860 ok(exe != NULL, "Expected exe to be valid\n");
1861 if (exe == TAGID_NULL)
1862 {
1863 skip("Cannot run tests without exe\n");
1864 return;
1865 }
1866
1867 memset(Buffer, 0xaa, sizeof(Buffer));
1868 dwBufferSize = sizeof(Buffer);
1869 dwDataType = 0x12345;
1870 tiData = 0x111111;
1871 dwRet = pSdbQueryDataExTagID(pdb, exe, L"TESTDATA1", &dwDataType, Buffer, &dwBufferSize, &tiData);
1872 ok_hex(dwRet, ERROR_NOT_FOUND);
1873 ok_hex(dwDataType, 0x12345);
1874 ok_hex(dwBufferSize, sizeof(Buffer));
1875 ok_hex(*(DWORD*)Buffer, (int)0xaaaaaaaa);
1876 ok(tiData == 0x111111, "Expected 0x111111, got 0x%x\n", tiData);
1877
1878 /* Show that SdbQueryDataEx behaves the same */
1879 memset(Buffer, 0xaa, sizeof(Buffer));
1880 dwBufferSize = sizeof(Buffer);
1881 dwDataType = 0x12345;
1882 trData = 0x111111;
1883 dwRet = pSdbQueryDataEx(hsdb, exe, L"TESTDATA1", &dwDataType, Buffer, &dwBufferSize, &trData);
1884 ok_hex(dwRet, ERROR_NOT_FOUND);
1885 ok_hex(dwDataType, 0x12345);
1886 ok_hex(dwBufferSize, sizeof(Buffer));
1887 ok_hex(*(DWORD*)Buffer, (int)0xaaaaaaaa);
1889 ok(trData == 0, "Expected 0, got 0x%x\n", trData);
1890 else
1891 ok(trData == 0x111111, "Expected 0x111111, got 0x%x\n", trData);
1892
1893 /* And SdbQueryData as well */
1894 memset(Buffer, 0xaa, sizeof(Buffer));
1895 dwBufferSize = sizeof(Buffer);
1896 dwDataType = 0x12345;
1897 dwRet = pSdbQueryData(hsdb, exe, L"TESTDATA1", &dwDataType, Buffer, &dwBufferSize);
1898 ok_hex(dwRet, ERROR_NOT_FOUND);
1899 ok_hex(dwDataType, 0x12345);
1900 ok_hex(dwBufferSize, sizeof(Buffer));
1901 ok_hex(*(DWORD*)Buffer, (int)0xaaaaaaaa);
1902}
DWORD TAGREF
#define ok_wstr(x, y)
Definition: atltest.h:130
Definition: bufpool.h:45
#define TAG_DATA
Definition: db.cpp:93
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define ERROR_SUCCESS
Definition: deptool.c:10
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define REG_SZ
Definition: layer.c:22
#define REG_QWORD
Definition: sdbapi.c:616
#define REG_DWORD
Definition: sdbapi.c:615
#define memset(x, y, z)
Definition: compat.h:39
#define _WIN32_WINNT_WIN10
Definition: sdkddkver.h:32
#define ERROR_NOT_FOUND
Definition: winerror.h:1014
unsigned char BYTE
Definition: xxhash.c:193

Referenced by test_Data().

◆ test_GetDatabaseInformation()

static void test_GetDatabaseInformation ( PDB  pdb)
static

Definition at line 1041 of file db.cpp.

1042{
1043 PDB_INFORMATION pInfo;
1044 BOOL fResult;
1045
1046 if (!pSdbGetDatabaseInformation || !pSdbFreeDatabaseInformation)
1047 {
1048 skip("GetDatabaseInformation or SdbFreeDatabaseInformation not found\n");
1049 return;
1050 }
1051
1052 _SEH2_TRY
1053 {
1054 pSdbFreeDatabaseInformation(NULL);
1055 }
1057 {
1058 ok(0, "SdbFreeDatabaseInformation did not handle a NULL pointer very gracefully.\n");
1059 }
1060 _SEH2_END;
1061
1062
1063 pInfo = (PDB_INFORMATION)malloc(sizeof(*pInfo) * 4);
1064 memset(pInfo, 0xDE, sizeof(*pInfo) * 2);
1065
1066 fResult = pSdbGetDatabaseInformation(pdb, pInfo);
1067 ok(fResult, "SdbGetDatabaseInformation failed\n");
1068 if (fResult)
1069 {
1071 ok(IsEqualGUID(GUID_DATABASE_TEST, pInfo->Id), "expected guids to be equal(%s:%s)\n",
1072 wine_dbgstr_guid(&GUID_DATABASE_TEST), wine_dbgstr_guid(&pInfo->Id));
1073 ok(wcscmp(pInfo->Description, L"apphelp_test1") == 0,
1074 "Expected pInfo->Description to be 'apphelp_test1', was %s\n", wine_dbgstr_w(pInfo->Description));
1075
1076 /* Struct is slightly bigger on some Win10, and the DB version nr is different on all */
1078 {
1079 ok(pInfo->dwMajor == 3, "Expected pInfo->dwMajor to be 3, was: %d\n", pInfo->dwMajor);
1080 ok(pInfo->dwMinor == 0, "Expected pInfo->dwMinor to be 0, was: %d\n", pInfo->dwMinor);
1081
1082 ok(pInfo->dwRuntimePlatform == 4 || pInfo->dwRuntimePlatform == 0xdededede, "Something amiss: 0x%x\n",
1083 pInfo->dwRuntimePlatform);
1084 ok(pInfo[1].dwMajor == 0xdededede, "Cookie2 corrupt: 0x%x\n", pInfo[1].dwMajor);
1085 }
1086 else
1087 {
1088 ok(pInfo->dwMajor == 2, "Expected pInfo->dwMajor to be 2, was: %d\n", pInfo->dwMajor);
1089 ok(pInfo->dwMinor == 1, "Expected pInfo->dwMinor to be 1, was: %d\n", pInfo->dwMinor);
1090
1091 ok(pInfo->dwRuntimePlatform == 0xdededede, "Cookie1 corrupt: 0x%x\n", pInfo->dwRuntimePlatform);
1092 ok(pInfo[1].dwMajor == 0xdededede, "Cookie2 corrupt: 0x%x\n", pInfo[1].dwMajor);
1093 }
1094
1095 }
1096 free(pInfo);
1097}
#define ok_int(expression, result)
Definition: atltest.h:134
#define DB_INFO_FLAGS_VALID_GUID
Definition: db.cpp:124
struct _DB_INFORMATION * PDB_INFORMATION
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:82
#define _SEH2_END
Definition: pseh2_64.h:171
#define _SEH2_TRY
Definition: pseh2_64.h:71
DWORD dwRuntimePlatform
Definition: db.cpp:133
DWORD dwFlags
Definition: apphelp.h:83
DWORD dwMajor
Definition: apphelp.h:84
LPCWSTR Description
Definition: apphelp.h:86
DWORD dwMinor
Definition: apphelp.h:85

Referenced by test_CheckDatabaseManually().

◆ test_GetDatabaseInformationEmpty()

static void test_GetDatabaseInformationEmpty ( PDB  pdb)
static

Definition at line 192 of file db.cpp.

193{
194 PDB_INFORMATION pInfo;
195 BOOL fResult;
196
197 if (!pSdbGetDatabaseInformation || !pSdbFreeDatabaseInformation)
198 {
199 skip("GetDatabaseInformation or SdbFreeDatabaseInformation not found\n");
200 return;
201 }
202
203 pInfo = (PDB_INFORMATION)malloc(sizeof(*pInfo) * 4);
204 memset(pInfo, 0xDE, sizeof(*pInfo) * 2);
205
206 fResult = pSdbGetDatabaseInformation(pdb, pInfo);
207 ok(fResult, "SdbGetDatabaseInformation failed\n");
208 if (fResult)
209 {
210 ok_int(pInfo->dwFlags, 0);
211 ok(IsEqualGUID(GUID_NULL, pInfo->Id), "expected guid to be empty(%s)\n", wine_dbgstr_guid(&pInfo->Id));
212 ok(pInfo->Description == NULL, "Expected pInfo->Description to be NULL, was %s\n", wine_dbgstr_w(pInfo->Description));
213
214 /* Struct is slightly bigger on some Win10, and the DB version nr is different on all */
216 {
217 ok(pInfo->dwMajor == 3, "Expected pInfo->dwMajor to be 3, was: %d\n", pInfo->dwMajor);
218 ok(pInfo->dwMinor == 0, "Expected pInfo->dwMinor to be 0, was: %d\n", pInfo->dwMinor);
219
220 ok(pInfo[1].dwFlags == 0 || pInfo[1].dwFlags == 0xdededede, "Something amiss: 0x%x\n", pInfo[1].dwFlags);
221 ok(pInfo[1].dwMajor == 0xdededede, "Cookie2 corrupt: 0x%x\n", pInfo[1].dwMajor);
222 }
223 else
224 {
225 ok(pInfo->dwMajor == 2, "Expected pInfo->dwMajor to be 2, was: %d\n", pInfo->dwMajor);
227 {
228 ok(pInfo->dwMinor == 1, "Expected pInfo->dwMinor to be 1, was: %d\n", pInfo->dwMinor);
229 }
230 else
231 {
232 SYSTEMTIME si = {0};
233 GetLocalTime(&si);
234 DWORD dwExpect = ((DWORD)si.wYear - 2000) * 10000 + si.wMonth * 100 + si.wDay;
235 ok(pInfo->dwMinor == dwExpect, "Expected pInfo->dwMinor to be %d, was: %d\n", dwExpect, pInfo->dwMinor);
236 }
237
238 ok(pInfo[1].dwFlags == 0xdededede, "Cookie1 corrupt: 0x%x\n", pInfo[1].dwFlags);
239 ok(pInfo[1].dwMajor == 0xdededede, "Cookie2 corrupt: 0x%x\n", pInfo[1].dwMajor);
240 }
241
242 }
243 free(pInfo);
244}
static DWORD
Definition: db.cpp:147
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:286
#define GUID_NULL
Definition: ks.h:106
LPCWSTR LPCWSTR LPCWSTR DWORD dwFlags
Definition: env.c:37
#define _WIN32_WINNT_VISTA
Definition: sdkddkver.h:25

Referenced by test_Sdb().

◆ test_IndexKeyFromString()

static void test_IndexKeyFromString ( void  )
static

Definition at line 1961 of file db.cpp.

1962{
1963#if 0
1964 static WCHAR tmp[] = { 0xabba, 0xbcde, 0x2020, 0x20, 0x4444, 0 };
1965 static WCHAR tmp2[] = { 0xabba, 0xbcde, 0x20, 0x4444, 0 };
1966 static WCHAR tmp3[] = { 0x20, 0xbcde, 0x4041, 0x4444, 0 };
1967 static WCHAR tmp4[] = { 0x20, 0xbcde, 0x4041, 0x4444, 0x4444, 0 };
1968 static WCHAR tmp5[] = { 0x2020, 0xbcde, 0x4041, 0x4444, 0x4444, 0 };
1969 static WCHAR tmp6 [] = { 0x20, 0xbcde, 0x4041, 0x4444, 0x4444, 0x4444, 0};
1970 static WCHAR tmp7 [] = { 0xbcde, 0x4041, 0x4444, 0x4444, 0x4444, 0x4444, 0x4444, 0x4444, 0x4444, 0};
1971 static WCHAR tmp8 [] = { 0xbc00, 0x4041, 0x4444, 0x4444, 0x4444, 0x4444, 0x4444, 0x4444, 0x4444, 0};
1972#endif
1973
1974#if 0
1975 /* This crashes. */
1976 pSdbMakeIndexKeyFromString(NULL);
1977#endif
1978
1979 expect_indexA("", 0x0000000000000000);
1980 expect_indexA("a", 0x4100000000000000);
1981 expect_indexA("aa", 0x4141000000000000);
1982 expect_indexA("aaa", 0x4141410000000000);
1983 expect_indexA("aaaa", 0x4141414100000000);
1984 expect_indexA("aaaaa", 0x4141414141000000);
1985 expect_indexA("aaaaaa", 0x4141414141410000);
1986 expect_indexA("aaaaaaa", 0x4141414141414100);
1987 expect_indexA("aaaaaaaa", 0x4141414141414141);
1988 expect_indexA("aaa aaaaa", 0x4141412041414141);
1989 /* Does not change */
1990 expect_indexA("aaaaaaaaa", 0x4141414141414141);
1991 expect_indexA("aaaaaaaab", 0x4141414141414141);
1992 expect_indexA("aaaaaaaac", 0x4141414141414141);
1993 expect_indexA("aaaaaaaaF", 0x4141414141414141);
1994 /* Upcase */
1995 expect_indexA("AAAAAAAA", 0x4141414141414141);
1996 expect_indexA("ABABABAB", 0x4142414241424142);
1997 expect_indexA("ABABABABZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ", 0x4142414241424142);
1998
1999#if 0
2000 /* These fail, but is that because the codepoints are too weird, or because the func is not correct? */
2001 result = pSdbMakeIndexKeyFromString(tmp);
2002 ok(result == 0xbaabdebc20200000, "Expected %s to result in %s, was: %s\n", wine_dbgstr_w(tmp),
2003 wine_dbgstr_longlong(0xbaabdebc20200000), wine_dbgstr_longlong(result));
2004
2005 result = pSdbMakeIndexKeyFromString(tmp2);
2006 ok(result == 0xbaabdebc00000000, "Expected %s to result in %s, was: %s\n", wine_dbgstr_w(tmp2),
2007 wine_dbgstr_longlong(0xbaabdebc00000000), wine_dbgstr_longlong(result));
2008
2009 result = pSdbMakeIndexKeyFromString(tmp3);
2010 ok(result == 0x20debc4140000000, "Expected %s to result in %s, was: %s\n", wine_dbgstr_w(tmp3),
2011 wine_dbgstr_longlong(0x20debc4140000000), wine_dbgstr_longlong(result));
2012
2013 result = pSdbMakeIndexKeyFromString(tmp4);
2014 ok(result == 0x20debc4140000000, "Expected %s to result in %s, was: %s\n", wine_dbgstr_w(tmp4),
2015 wine_dbgstr_longlong(0x20debc4140000000), wine_dbgstr_longlong(result));
2016
2017 result = pSdbMakeIndexKeyFromString(tmp5);
2018 ok(result == 0x2020debc41400000, "Expected %s to result in %s, was: %s\n", wine_dbgstr_w(tmp5),
2019 wine_dbgstr_longlong(0x2020debc41400000), wine_dbgstr_longlong(result));
2020
2021 result = pSdbMakeIndexKeyFromString(tmp6);
2022 ok(result == 0x20debc4140444400, "Expected %s to result in %s, was: %s\n", wine_dbgstr_w(tmp6),
2023 wine_dbgstr_longlong(0x20debc4140444400), wine_dbgstr_longlong(result));
2024
2025 result = pSdbMakeIndexKeyFromString(tmp7);
2026 ok(result == 0xdebc414044444444, "Expected %s to result in %s, was: %s\n", wine_dbgstr_w(tmp7),
2027 wine_dbgstr_longlong(0xdebc414044444444), wine_dbgstr_longlong(result));
2028
2029 result = pSdbMakeIndexKeyFromString(tmp8);
2030 ok(result == 0xbc414044444444, "Expected %s to result in %s, was: %s\n", wine_dbgstr_w(tmp8),
2032#endif
2033}
#define expect_indexA
Definition: db.cpp:1959

Referenced by START_TEST().

◆ test_is_testdb()

static void test_is_testdb ( PDB  pdb)
static

Definition at line 1179 of file db.cpp.

1180{
1181 if (pdb)
1182 {
1183 GUID guid;
1184 memset(&guid, 0, sizeof(guid));
1185 ok(pSdbGetDatabaseID(pdb, &guid), "expected SdbGetDatabaseID not to fail.\n");
1186 ok(IsEqualGUID(guid, GUID_DATABASE_TEST), "Expected SdbGetDatabaseID to return the test db GUID, was: %s\n", wine_dbgstr_guid(&guid));
1187 }
1188 else
1189 {
1190 skip("Not checking DB GUID, received a null pdb\n");
1191 }
1192}

Referenced by test_mode_generic().

◆ test_match_ex()

template<typename SDBQUERYRESULT_T >
static void test_match_ex ( const WCHAR workdir,
HSDB  hsdb 
)
static

Definition at line 1473 of file db.cpp.

1474{
1476 PWCHAR Vendor, AppName, TestName;
1477 SDBQUERYRESULT_T query;
1478 TAGID dbtag, exetag, tagid;
1479 BOOL ret, Succeed;
1480 PDB pdb;
1481
1482 memset(&query, 0xab, sizeof(query));
1483
1484 ret = pSdbTagRefToTagID(hsdb, 0, &pdb, &tagid);
1485 ok(pdb != NULL && pdb != (PDB)0x12345678, "Expected pdb to be set to a valid pdb, was: %p\n", pdb);
1486
1487 dbtag = pSdbFindFirstTag(pdb, TAGID_ROOT, TAG_DATABASE);
1488 ok(dbtag != TAGID_NULL, "Expected to get a valid TAG_DATABASE\n");
1489
1490 for (exetag = pSdbFindFirstTag(pdb, dbtag, TAG_EXE); exetag; exetag = pSdbFindNextTag(pdb, dbtag, exetag))
1491 {
1492 tagid = pSdbFindFirstTag(pdb, exetag, TAG_VENDOR);
1493 Vendor = pSdbGetStringTagPtr(pdb, tagid);
1494 if (!Vendor)
1495 continue;
1496 Succeed = !_wcsicmp(Vendor, L"Succeed");
1497 if (!Succeed && _wcsicmp(Vendor, L"Fail"))
1498 continue;
1499 tagid = pSdbFindFirstTag(pdb, exetag, TAG_APP_NAME);
1500 AppName = pSdbGetStringTagPtr(pdb, tagid);
1501 if (!AppName)
1502 continue;
1503
1504 tagid = pSdbFindFirstTag(pdb, exetag, TAG_NAME);
1505 TestName = pSdbGetStringTagPtr(pdb, tagid);
1506 if (!TestName)
1507 continue;
1508
1509 swprintf(exename, L"%s\\%s", workdir, AppName);
1511
1512 ret = pSdbGetMatchingExe(hsdb, exename, NULL, NULL, 0, (SDBQUERYRESULT_VISTA*)&query);
1513 DWORD exe_count = Succeed ? 1 : 0;
1514
1515 if (Succeed && !ret && g_WinVersion == _WIN32_WINNT_WS03)
1516 {
1517 skip("As long as we do not have indexes, we will hit a bug in W2k3\n");
1518#if 0
1519[Info][SdbGetIndex ] index 0x7007(0x600b) was not found in the index table
1520[Info][SdbGetIndex ] index 0x7007(0x6001) was not found in the index table
1521[Info][SdbpSearchDB ] Searching database with no index.
1522[Err ][SdbpSearchDB ] No DATABASE tag found.
1523#endif
1524 }
1525 else
1526 {
1527 if (Succeed)
1528 ok(ret, "SdbGetMatchingExe should not fail for %s.\n", wine_dbgstr_w(TestName));
1529 else
1530 ok(ret == FALSE, "SdbGetMatchingExe should not succeed for %s.\n", wine_dbgstr_w(TestName));
1531
1532 ok(query.dwExeCount == exe_count, "Expected dwExeCount to be %d, was %d for %s\n", exe_count, query.dwExeCount, wine_dbgstr_w(TestName));
1533 }
1535 }
1536}
#define test_create_exe
static CHAR AppName[MAX_PATH]
Definition: dem.c:252
static WCHAR no[MAX_STRING_RESOURCE_LEN]
Definition: object.c:2340
GLuint index
Definition: glext.h:6031
GLuint in
Definition: glext.h:9616
WCHAR TestName[MAX_PATH]
Definition: main.cpp:13
static char * exename
Definition: process.c:101
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define _WIN32_WINNT_WS03
Definition: sdkddkver.h:23
Definition: ecma_167.h:138
uint16_t * PWCHAR
Definition: typedefs.h:56
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690

◆ test_MatchApplications()

template<typename SDBQUERYRESULT_T >
static void test_MatchApplications ( void  )
static

Definition at line 1392 of file db.cpp.

1393{
1394 WCHAR workdir[MAX_PATH], dbpath[MAX_PATH];
1395 BOOL ret;
1396 HSDB hsdb;
1397
1399 ok(ret, "GetTempPathW error: %d\n", GetLastError());
1400 wcscat(workdir, L"apphelp_test");
1401
1403 ok(ret, "CreateDirectoryW error: %d\n", GetLastError());
1404
1405 /* SdbInitDatabase needs an nt-path */
1406 swprintf(dbpath, L"\\??\\%s\\test.sdb", workdir);
1407
1409
1410 hsdb = pSdbInitDatabase(HID_DATABASE_FULLPATH, dbpath);
1411
1412 ok(hsdb != NULL, "Expected a valid database handle\n");
1413
1414 if (!hsdb)
1415 {
1416 skip("SdbInitDatabase not implemented?\n");
1417 }
1418 else
1419 {
1420 /* now that our enviroment is setup, let's go ahead and run the actual tests.. */
1421 size_t n;
1422 for (n = 0; n < _countof(test_exedata); ++n)
1423 test_mode_generic<SDBQUERYRESULT_T>(workdir, hsdb, n);
1424 pSdbReleaseDatabase(hsdb);
1425 }
1426
1427 DeleteFileW(dbpath + 4);
1428
1430 ok(ret, "RemoveDirectoryW error: %d\n", GetLastError());
1431}
wcscat

◆ test_MatchApplicationsEx()

template<typename SDBQUERYRESULT_T >
static void test_MatchApplicationsEx ( void  )
static

Definition at line 1540 of file db.cpp.

1541{
1542 WCHAR workdir[MAX_PATH], dbpath[MAX_PATH];
1543 BOOL ret;
1544 HSDB hsdb;
1545
1547 ok(ret, "GetTempPathW error: %d\n", GetLastError());
1548 lstrcatW(workdir, L"apphelp_test");
1549
1551 ok(ret, "CreateDirectoryW error: %d\n", GetLastError());
1552
1553 /* SdbInitDatabase needs an nt-path */
1554 swprintf(dbpath, L"\\??\\%s\\test.sdb", workdir);
1555
1556 if (extract_resource(dbpath + 4, MAKEINTRESOURCEW(101)))
1557 {
1558 hsdb = pSdbInitDatabase(HID_DATABASE_FULLPATH, dbpath);
1559
1560 ok(hsdb != NULL, "Expected a valid database handle\n");
1561
1562 if (!hsdb)
1563 {
1564 skip("SdbInitDatabase not implemented?\n");
1565 }
1566 else
1567 {
1568 /* now that our enviroment is setup, let's go ahead and run the actual tests.. */
1569 test_match_ex<SDBQUERYRESULT_T>(workdir, hsdb);
1570 pSdbReleaseDatabase(hsdb);
1571 }
1572 }
1573 else
1574 {
1575 ok(0, "Unable to extract database\n");
1576 }
1577
1578 DeleteFileW(dbpath + 4);
1579
1581 ok(ret, "RemoveDirectoryW error: %d\n", GetLastError());
1582}

◆ test_mode_generic()

template<typename SDBQUERYRESULT_T >
static void test_mode_generic ( const WCHAR workdir,
HSDB  hsdb,
size_t  cur 
)
static

Definition at line 1210 of file db.cpp.

1211{
1212 WCHAR exename[MAX_PATH], testfile[MAX_PATH];
1213 BOOL ret;
1214 SDBQUERYRESULT_T query;
1215 PDB pdb;
1216 TAGID tagid;
1218 DWORD expect_flags = 0, adwExeFlags_0, exe_count;
1219
1220 memset(&query, 0xab, sizeof(query));
1221
1224 swprintf(testfile, L"%s\\%s", workdir, test_exedata[cur].extra_file);
1226
1228 {
1229 /* First we try without the file at all. */
1230 DeleteFileW(testfile);
1231 ret = pSdbGetMatchingExe(hsdb, exename, NULL, NULL, 0, (SDBQUERYRESULT_VISTA*)&query);
1232 ok(ret == 0, "SdbGetMatchingExe should have failed for %d.\n", cur);
1233 /* Now re-try with the correct file */
1234 test_create_file(testfile, "aaaa", 4);
1235 }
1236
1237#if 0
1238 // Results seem to be cached based on filename, until we can invalidate this, do not test the same filename twice!
1240 // skip exports
1242 ret = pSdbGetMatchingExe(hsdb, exenameW, NULL, NULL, 0, &query);
1243 ok(ret == 0, "SdbGetMatchingExe should have failed for %d.\n", cur);
1244
1247#endif
1248
1250 {
1251 SetEnvironmentVariableA("__COMPAT_LAYER", test_exedata[cur].env_var);
1252 }
1253
1254 ret = pSdbGetMatchingExe(hsdb, exename, NULL, NULL, 0, (SDBQUERYRESULT_VISTA*)&query);
1255 ok(ret, "SdbGetMatchingExe should not fail for %d.\n", cur);
1256
1257 exe_count = (test_exedata[cur].env_var == NULL) ? 1 : 0;
1258
1259 ok(query.dwExeCount == exe_count, "Expected dwExeCount to be %d, was %d for %d\n", exe_count, query.dwExeCount, cur);
1260 ok(query.dwLayerCount == test_exedata[cur].dwLayerCount, "Expected dwLayerCount to be %d, was %d for %d\n", test_exedata[cur].dwLayerCount, query.dwLayerCount, cur);
1261 ok(query.dwCustomSDBMap == 1, "Expected dwCustomSDBMap to be 1, was %d for %d\n", query.dwCustomSDBMap, cur);
1262 ok(query.dwLayerFlags == 0, "Expected dwLayerFlags to be 0, was 0x%x for %d\n", query.dwLayerFlags, cur);
1264 ok(query.trApphelp == trApphelp, "Expected trApphelp to be 0x%x, was 0x%x for %d\n", trApphelp, query.trApphelp, cur);
1265
1267 expect_flags = 0;
1268 else if (g_WinVersion < WINVER_WIN8)
1269 expect_flags = 1;
1270 else if (g_WinVersion < WINVER_WIN10)
1271 expect_flags = 0x101;
1272 else
1273 {
1274 expect_flags = 0x121; /* for 2 and 3, this becomes 101 when not elevated. */
1275 if ((cur == 2 || cur == 3) && !IsUserAdmin())
1276 expect_flags &= ~0x20;
1277 }
1278
1280 expect_flags &= ~0x100;
1281
1282 ok(query.dwFlags == expect_flags, "Expected dwFlags to be 0x%x, was 0x%x for %d\n", expect_flags, query.dwFlags, cur);
1283
1284 ok(query.atrExes[0] == test_exedata[cur].atrExes_0, "Expected atrExes[0] to be 0x%x, was: 0x%x for %d\n", test_exedata[cur].atrExes_0, query.atrExes[0], cur);
1285 for (size_t n = 1; n < _countof(query.atrExes); ++n)
1286 ok(query.atrExes[n] == 0, "Expected atrExes[%d] to be 0, was: %x for %d\n", n, query.atrExes[n], cur);
1287
1289 check_adwExeFlags(adwExeFlags_0, query, __FILE__, __LINE__, cur);
1290
1291 ok(query.atrLayers[0] == test_exedata[cur].atrLayers_0, "Expected atrLayers[0] to be 0x%x, was: %x for %d\n", test_exedata[cur].atrLayers_0, query.atrLayers[0], cur);
1292 for (size_t n = 1; n < _countof(query.atrLayers); ++n)
1293 ok(query.atrLayers[n] == 0, "Expected atrLayers[%d] to be 0, was: %x for %d\n", n, query.atrLayers[0], cur);
1294
1296 ok(IsEqualGUID(query.rgGuidDB[0], GUID_DATABASE_TEST), "Expected rgGuidDB[0] to be the test db GUID, was: %s for %d\n", wine_dbgstr_guid(&query.rgGuidDB[0]), cur);
1297 else
1298 ok(IsEqualGUID(query.rgGuidDB[0], GUID_MAIN_DATABASE), "Expected rgGuidDB[0] to be the main db GUID, was: %s for %d\n", wine_dbgstr_guid(&query.rgGuidDB[0]), cur);
1299 for (size_t n = 1; n < _countof(query.rgGuidDB); ++n)
1300 ok(IsEqualGUID(query.rgGuidDB[n], GUID_NULL), "Expected rgGuidDB[%d] to be GUID_NULL, was: %s for %d\n", n, wine_dbgstr_guid(&query.rgGuidDB[n]), cur);
1301
1302 if (query.atrExes[0])
1303 {
1304 pdb = (PDB)0x12345678;
1305 tagid = 0x76543210;
1306 ret = pSdbTagRefToTagID(hsdb, query.atrExes[0], &pdb, &tagid);
1307 ok(ret, "SdbTagRefToTagID failed for %d.\n", cur);
1308 ok(pdb != NULL && pdb != (PDB)0x12345678, "SdbTagRefToTagID failed to return a pdb for %d.\n", cur);
1309 ok(tagid != 0 && tagid != 0x76543210, "SdbTagRefToTagID failed to return a tagid for %d.\n", cur);
1310
1311 if (pdb && pdb != (PDB)0x12345678)
1312 {
1313 TAGREF tr = 0x12345678;
1314 TAG tag = pSdbGetTagFromTagID(pdb, tagid);
1316 ok(tag == TAG_EXE, "Expected tag to be TAG_EXE, was 0x%x for %d.\n", tag, cur);
1318
1319 /* And back again */
1320 ret = pSdbTagIDToTagRef(hsdb, pdb, tagid, &tr);
1321 ok(ret, "SdbTagIDToTagRef failed for %d.\n", cur);
1322 ok(tr == query.atrExes[0], "Expected tr to be 0x%x, was 0x%x for %d.\n", query.atrExes[0], tr, cur);
1323 }
1324 else
1325 {
1326 skip("Skipping a bunch of tests because of an invalid pointer\n");
1327 }
1328 }
1329
1331 {
1332 pdb = (PDB)0x12345678;
1333 tagid = 0x76543210;
1334 ret = pSdbTagRefToTagID(hsdb, query.atrLayers[0], &pdb, &tagid);
1335 ok(ret, "SdbTagRefToTagID failed for %d.\n", cur);
1336 ok(pdb != NULL && pdb != (PDB)0x12345678, "SdbTagRefToTagID failed to return a pdb for %d.\n", cur);
1337 ok(tagid != 0 && tagid != 0x76543210, "SdbTagRefToTagID failed to return a tagid for %d.\n", cur);
1338
1339 if (pdb && pdb != (PDB)0x12345678)
1340 {
1341 TAGREF tr = 0x12345678;
1342 TAG tag = pSdbGetTagFromTagID(pdb, tagid);
1344 ok(tag == TAG_LAYER, "Expected tag to be TAG_LAYER, was 0x%x for %d.\n", tag, cur);
1345 match_strw_attr(pdb, tagid, TAG_NAME, L"TestNewMode");
1346
1347 /* And back again */
1348 ret = pSdbTagIDToTagRef(hsdb, pdb, tagid, &tr);
1349 ok(ret, "SdbTagIDToTagRef failed for %d.\n", cur);
1350 ok(tr == test_exedata[cur].atrLayers_0, "Expected tr to be 0x%x, was 0x%x for %d.\n", test_exedata[cur].atrLayers_0, tr, cur);
1351 }
1352 else
1353 {
1354 skip("Skipping a bunch of tests because of an invalid pointer\n");
1355 }
1356 }
1357
1358 pdb = (PDB)0x12345678;
1359 tagid = 0x76543210;
1360 ret = pSdbTagRefToTagID(hsdb, 0, &pdb, &tagid);
1361 ok(pdb != NULL && pdb != (PDB)0x12345678, "Expected pdb to be set to a valid pdb, was: %p\n", pdb);
1362 ok(tagid == 0, "Expected tagid to be set to 0, was: 0x%x\n", tagid);
1363
1364
1365#if 0
1366 UNICODE_STRING exenameNT;
1367 // In Win10 this does seem to work sometimes, so disable it for now
1368 if (RtlDosPathNameToNtPathName_U(exename, &exenameNT, NULL, NULL))
1369 {
1370 /*
1371 ERROR,AslPathGetLongFileNameLongpath,110,Long path conversion failed 123 [c0000001]
1372 ERROR,AslPathBuildSignatureLongpath,1086,AslPathGetLongFileNameLongpath failed for \??\C:\Users\MARK~1.DEV\AppData\Local\Temp\apphelp_test\test_allow.exe [c0000001]
1373 */
1374 ret = pSdbGetMatchingExe(hsdb, exenameNT.Buffer, NULL, NULL, 0, (SDBQUERYRESULT_VISTA*)&query);
1375 ok(ret == FALSE, "SdbGetMatchingExe should not succeed for %d.\n", cur);
1376
1377 RtlFreeUnicodeString(&exenameNT);
1378 }
1379#endif
1380
1382 DeleteFileW(testfile);
1384
1386 {
1387 SetEnvironmentVariableA("__COMPAT_LAYER", NULL);
1388 }
1389}
static LPWSTR exenameW
Definition: FindFiles.c:28
VOID * PDB
#define test_create_file
#define WINVER_WIN7
#define WINVER_WIN8
#define WINVER_VISTA
static void check_adwExeFlags(DWORD adwExeFlags_0, SDBQUERYRESULT_T &query, const char *file, int line, size_t cur)
Definition: db.cpp:1196
const WCHAR * extra_file
Definition: db.cpp:875
TAGREF atrLayers_0
Definition: db.cpp:879
static void test_is_testdb(PDB pdb)
Definition: db.cpp:1179
const char * env_var
Definition: db.cpp:881
TAGREF trApphelp
Definition: db.cpp:880
BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableA(IN LPCSTR lpName, IN LPCSTR lpValue)
Definition: environ.c:218
NTSYSAPI BOOLEAN NTAPI RtlDosPathNameToNtPathName_U(_In_opt_z_ PCWSTR DosPathName, _Out_ PUNICODE_STRING NtPathName, _Out_opt_ PCWSTR *NtFileNamePart, _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo)
static BOOL IsUserAdmin(VOID)
Definition: netid.c:163
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
Definition: fs_rec.h:143

◆ test_Sdb()

static void test_Sdb ( void  )
static

Definition at line 247 of file db.cpp.

248{
249 static const WCHAR temp[] = L"temp";
250 static const WCHAR path1[] = L"temp.sdb";
251 static const WCHAR path2[] = L"temp2.bin";
252 static const WCHAR tag_size_string[] = L"SIZE";
253 static const WCHAR tag_flag_lua_string[] = L"FLAG_LUA";
254 static const WCHAR invalid_tag[] = L"InvalidTag";
255 static const TAG tags[5] = {
258 };
259 WCHAR buffer[6] = { 0 };
260 PDB pdb;
261 QWORD qword;
262 DWORD dword;
263 WORD word;
264 BOOL ret;
265 HANDLE file; /* temp file created for testing purpose */
266 TAG tag;
267 TAGID tagid, ptagid, stringref = 6;
270
271 pdb = pSdbCreateDatabase(path1, DOS_PATH);
272 ok(pdb != NULL, "failed to create database\n");
273 if (pdb != NULL)
274 {
275 ret = pSdbWriteDWORDTag(pdb, tags[0], 0xDEADBEEF);
276 ok(ret, "failed to write DWORD tag\n");
277 ret = pSdbWriteQWORDTag(pdb, tags[1], 0xDEADBEEFBABE);
278 ok(ret, "failed to write QWORD tag\n");
279 ret = pSdbWriteStringRefTag(pdb, tags[2], stringref);
280 ok(ret, "failed to write stringref tag\n");
281 tagid = pSdbBeginWriteListTag(pdb, tags[3]);
282 ok(tagid != TAGID_NULL, "unexpected NULL tagid\n");
283 ret = pSdbWriteStringTag(pdb, tags[4], temp);
284 ok(ret, "failed to write string tag\n");
285 ret = pSdbWriteNULLTag(pdb, TAG_GENERAL);
286 ok(ret, "failed to write NULL tag\n");
287 ret = pSdbWriteWORDTag(pdb, TAG_MATCH_MODE, 0xACE);
288 ok(ret, "failed to write WORD tag\n");
289 ret = pSdbEndWriteListTag(pdb, tagid);
290 ok(ret, "failed to update list size\n");
291 /* [Err ][SdbCloseDatabase ] Failed to close the file. */
292 pSdbCloseDatabaseWrite(pdb);
293 }
294
295 /* [Err ][SdbGetDatabaseID ] Failed to get root tag */
296 pdb = pSdbOpenDatabase(path1, DOS_PATH);
297 ok(pdb != NULL, "unexpected NULL handle\n");
298
299 if (pdb)
300 {
301 tagid = pSdbGetFirstChild(pdb, TAGID_ROOT);
302 ok(tagid == _TAGID_ROOT, "unexpected tagid %u, expected %u\n", tagid, _TAGID_ROOT);
303
304 tag = pSdbGetTagFromTagID(pdb, tagid);
305 ok(tag == TAG_SIZE, "unexpected tag 0x%x, expected 0x%x\n", tag, TAG_SIZE);
306
307 string = pSdbTagToString(tag);
308 ok(lstrcmpW(string, tag_size_string) == 0, "unexpected string %s, expected %s\n",
309 wine_dbgstr_w(string), wine_dbgstr_w(tag_size_string));
310
311 dword = pSdbReadDWORDTag(pdb, tagid, 0);
312 ok(dword == 0xDEADBEEF, "unexpected value %u, expected 0xDEADBEEF\n", dword);
313
314 tagid = pSdbGetNextChild(pdb, TAGID_ROOT, tagid);
315 ok(tagid == _TAGID_ROOT + sizeof(TAG) + sizeof(DWORD), "unexpected tagid %u, expected %u\n",
316 tagid, _TAGID_ROOT + sizeof(TAG) + sizeof(DWORD));
317
318 tag = pSdbGetTagFromTagID(pdb, tagid);
319 ok(tag == TAG_FLAG_LUA, "unexpected tag 0x%x, expected 0x%x\n", tag, TAG_FLAG_LUA);
320
321 string = pSdbTagToString(tag);
323 {
324 ok(lstrcmpW(string, tag_flag_lua_string) == 0, "unexpected string %s, expected %s\n",
325 wine_dbgstr_w(string), wine_dbgstr_w(tag_flag_lua_string));
326 }
327 else
328 {
329 ok(lstrcmpW(string, invalid_tag) == 0, "unexpected string %s, expected %s\n",
330 wine_dbgstr_w(string), wine_dbgstr_w(invalid_tag));
331 }
332
333 qword = pSdbReadQWORDTag(pdb, tagid, 0);
334 ok(qword == 0xDEADBEEFBABE, "unexpected value 0x%I64x, expected 0xDEADBEEFBABE\n", qword);
335
336 tagid = pSdbGetNextChild(pdb, TAGID_ROOT, tagid);
337 string = pSdbGetStringTagPtr(pdb, tagid);
338 ok(string && (lstrcmpW(string, temp) == 0), "unexpected string %s, expected %s\n",
340
341 ptagid = pSdbGetNextChild(pdb, TAGID_ROOT, tagid);
342 tagid = pSdbGetFirstChild(pdb, ptagid);
343
344 string = pSdbGetStringTagPtr(pdb, tagid);
345 ok(string && (lstrcmpW(string, temp) == 0), "unexpected string %s, expected %s\n",
347
348 ok(pSdbReadStringTag(pdb, tagid, buffer, 6), "failed to write string to buffer\n");
349 /* [Err ][SdbpReadTagData ] Buffer too small. Avail: 6, Need: 10. */
350 ok(pSdbReadStringTag(pdb, tagid, buffer, 3) == FALSE, "string was written to buffer, but failure was expected");
351 ok(pSdbGetTagDataSize(pdb, tagid) == 5 * sizeof(WCHAR), "string has unexpected size\n");
352
353 tagid = pSdbGetNextChild(pdb, ptagid, tagid);
354 tag = pSdbGetTagFromTagID(pdb, tagid);
355 ok(tag == TAG_GENERAL, "unexpected tag 0x%x, expected 0x%x\n", tag, TAG_GENERAL);
356 ok(pSdbGetTagDataSize(pdb, tagid) == 0, "null tag with size > 0\n");
357
358 tagid = pSdbGetNextChild(pdb, ptagid, tagid);
359 word = pSdbReadWORDTag(pdb, tagid, 0);
360 ok(word == 0xACE, "unexpected value 0x%x, expected 0x%x\n", word, 0xACE);
361
363
364 pSdbCloseDatabase(pdb);
365 }
367
369 ok(file != INVALID_HANDLE_VALUE, "failed to open file\n");
370 Write(file, &qword, 8);
372
373 pdb = pSdbCreateDatabase(path1, DOS_PATH);
374 ok(pdb != NULL, "unexpected NULL handle\n");
375
376 if (pdb)
377 {
378 ret = pSdbWriteBinaryTagFromFile(pdb, TAG_DATA_BITS, path2);
379 ok(ret, "failed to write tag from binary file\n");
380 pSdbCloseDatabaseWrite(pdb); /* [Err ][SdbCloseDatabase ] Failed to close the file. */
382
383 /* FIXME: doesnt work on win10?! */
384 pdb = pSdbOpenDatabase(path1, DOS_PATH);
386 {
387 /* ERROR,SdbOpenDatabaseEx,845,Failed to open SDB - File size too large or small. */
388 ok(pdb != NULL, "unexpected NULL handle\n");
389 }
390 if (pdb)
391 {
392 binary = (PBYTE)pSdbGetBinaryTagData(pdb, _TAGID_ROOT);
393 ok(memcmp(binary, &qword, 8) == 0, "binary data is corrupt\n");
394 ret = pSdbReadBinaryTag(pdb, _TAGID_ROOT, (PBYTE)buffer, 12);
395 ok(ret, "failed to read binary tag\n");
396 ok(memcmp(buffer, &qword, 8) == 0, "binary data is corrupt\n");
397 pSdbCloseDatabase(pdb);
398 }
399 }
401}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
static void test_GetDatabaseInformationEmpty(PDB pdb)
Definition: db.cpp:192
#define TAG_STRINGTABLE
Definition: db.cpp:94
static void Write(HANDLE file, LPCVOID buffer, DWORD size)
Definition: db.cpp:186
#define _TAGID_ROOT
Definition: db.cpp:40
#define TAG_FLAG_LUA
Definition: db.cpp:83
#define TAG_MATCH_MODE
Definition: db.cpp:58
static PBYTE
Definition: db.cpp:160
#define TAG_GENERAL
Definition: db.cpp:118
#define TAG_STRINGTABLE_ITEM
Definition: db.cpp:96
#define TAG_DATA_BITS
Definition: db.cpp:121
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4246
unsigned short WORD
Definition: ntddk_ex.h:93
GLuint buffer
Definition: glext.h:5915
const GLuint GLenum const GLvoid * binary
Definition: glext.h:7538
const WCHAR * word
Definition: lex.c:36
char string[160]
Definition: util.h:11
#define OPEN_ALWAYS
Definition: disk.h:70
const char * tags[99]
Definition: apphelp.c:216
static const WCHAR path1[]
Definition: path.c:28
static const WCHAR path2[]
Definition: path.c:29
#define GENERIC_WRITE
Definition: nt_native.h:90
static calc_node_t temp
Definition: rpn_ieee.c:38
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by START_TEST().

◆ test_stringtable()

static void test_stringtable ( void  )
static

Definition at line 534 of file db.cpp.

535{
536 static const WCHAR path1[] = {'t','e','s','t','.','s','d','b',0};
537 static const WCHAR test1[] = {'t','e','s','t','1',0};
538 static const WCHAR test2[] = {'T','e','s','t','1',0};
539 static const WCHAR test3[] = {'T','E','s','t','1',0};
540 static const WCHAR test4[] = {'T','E','S','T','1',0};
541 static const WCHAR test5[] = {'T','E','S','T','2',0};
542 static const WCHAR lipsum[] = {'L','o','r','e','m',' ','i','p','s','u','m',' ','d','o','l','o','r',' ','s','i','t',' ','a','m','e','t',',',' ','c','o','n','s','e','c','t','e','t','u','r',' ','a','d','i','p','i','s','c','i','n','g',' ','e','l','i','t','.',' ','N','u','l','l','a',' ','a','n','t','e',' ','r','i','s','u','s',',',' ','m','a','l','e','s','u','a','d','a',' ','s','e','d',' ','i','a','c','u','l','i','s',' ','l','u','c','t','u','s',',',' ','o','r','n','a','r','e',' ','p','u','l','v','i','n','a','r',' ','v','e','l','i','t','.',' ','L','o','r','e','m',' ','i','p','s','u','m',' ','d','o','l','o','r',' ','s','i','t',' ','a','m','e','t',',',' ','c','o','n','s','e','c','t','e','t','u','r',' ','a','d','i','p','i','s','c','i','n','g',' ','e','l','i','t','.',' ','I','n','t','e','g','e','r',' ','q','u','i','s',' ','f','e','l','i','s',' ','u','t',' ','l','e','o',' ','e','l','e','i','f','e','n','d',' ','u','l','t','r','i','c','e','s',' ','f','i','n','i','b','u','s',' ','e','u',' ','d','o','l','o','r','.',' ','I','n',' ','b','i','b','e','n','d','u','m',',',' ','e','r','o','s',' ','e','u',' ','f','a','u','c','i','b','u','s',' ','c','o','n','s','e','q','u','a','t',',',' ','n','i','s','i',' ','m','a','g','n','a',' ','v','e','n','e','n','a','t','i','s',' ','j','u','s','t','o',',',' ','a','t',' ','t','r','i','s','t','i','q','u','e',' ','m','e','t','u','s',' ','d','o','l','o','r',' ','u','t',' ','r','i','s','u','s','.',' ','N','u','n','c',' ','e','u',' ','o','d','i','o',' ','d','i','g','n','i','s','s','i','m',',',' ','o','r','n','a','r','e',' ','a','n','t','e',' ','g','r','a','v','i','d','a',',',' ','l','o','b','o','r','t','i','s',' ','e','r','o','s','.',' ','C','r','a','s',' ','s','e','m',' ','e','x',',',' ','c','o','n','s','e','c','t','e','t','u','r',' ','p','u','l','v','i','n','a','r',' ','t','i','n','c','i','d','u','n','t',' ','e','u',',',' ','c','o','n','g','u','e',' ','a',' ','e','r','o','s','.',' ','C','u','r','a','b','i','t','u','r',' ','e','r','o','s',' ','e','r','a','t',',',' ','p','e','l','l','e','n','t','e','s','q','u','e',' ','e','t',' ','n','i','b','h',' ','q','u','i','s',',',' ','i','n','t','e','r','d','u','m',' ','t','e','m','p','o','r',' ','o','d','i','o','.',' ','E','t','i','a','m',' ','s','a','p','i','e','n',' ','s','a','p','i','e','n',',',' ','a','l','i','q','u','a','m',' ','u','t',' ','a','l','i','q','u','a','m',' ','a','t',',',' ','s','a','g','i','t','t','i','s',' ','e','u',' ','m','a','g','n','a','.',' ','M','a','e','c','e','n','a','s',' ','m','a','g','n','a',' ','m','a','g','n','a',',',' ','s','u','s','c','i','p','i','t',' ','u','t',' ','l','o','r','e','m',' ','u','t',',',' ','v','a','r','i','u','s',' ','p','r','e','t','i','u','m',' ','f','e','l','i','s','.',' ','I','n','t','e','g','e','r',' ','t','i','n','c','i','d','u','n','t',',',' ','m','e','t','u','s',' ','v','e','l',' ','s','o','l','l','i','c','i','t','u','d','i','n',' ','f','i','n','i','b','u','s',',',' ','f','e','l','i','s',' ','e','r','a','t',' ','m','o','l','e','s','t','i','e',' ','u','r','n','a',',',' ','a',' ','c','o','n','d','i','m','e','n','t','u','m',' ','a','u','g','u','e',' ','a','r','c','u',' ','v','i','t','a','e',' ','r','i','s','u','s','.',' ','E','t','i','a','m',' ','i','d',' ','s','a','g','i','t','t','i','s',' ','q','u','a','m','.',' ','M','o','r','b','i',' ','a',' ','u','l','t','r','i','c','i','e','s',' ','n','u','n','c','.',' ','P','h','a','s','e','l','l','u','s',' ','e','r','o','s',' ','r','i','s','u','s',',',' ','c','u','r','s','u','s',' ','u','l','l','a','m','c','o','r','p','e','r',' ','m','a','s','s','a',' ','s','e','d',',',' ','d','i','g','n','i','s','s','i','m',' ','c','o','n','s','e','q','u','a','t',' ','l','i','g','u','l','a','.',' ','A','l','i','q','u','a','m',' ','t','u','r','p','i','s',' ','a','r','c','u',',',' ','a','c','c','u','m','s','a','n',' ','q','u','i','s',' ','s','a','p','i','e','n',' ','v','i','t','a','e',',',' ','l','a','c','i','n','i','a',' ','e','u','i','s','m','o','d',' ','n','i','s','l','.',' ','M','a','u','r','i','s',' ','i','d',' ','f','e','l','i','s',' ','s','e','m','.',0};
543 /* Last char changed from '.' to '!' */
544 static const WCHAR lipsum2[] = {'L','o','r','e','m',' ','i','p','s','u','m',' ','d','o','l','o','r',' ','s','i','t',' ','a','m','e','t',',',' ','c','o','n','s','e','c','t','e','t','u','r',' ','a','d','i','p','i','s','c','i','n','g',' ','e','l','i','t','.',' ','N','u','l','l','a',' ','a','n','t','e',' ','r','i','s','u','s',',',' ','m','a','l','e','s','u','a','d','a',' ','s','e','d',' ','i','a','c','u','l','i','s',' ','l','u','c','t','u','s',',',' ','o','r','n','a','r','e',' ','p','u','l','v','i','n','a','r',' ','v','e','l','i','t','.',' ','L','o','r','e','m',' ','i','p','s','u','m',' ','d','o','l','o','r',' ','s','i','t',' ','a','m','e','t',',',' ','c','o','n','s','e','c','t','e','t','u','r',' ','a','d','i','p','i','s','c','i','n','g',' ','e','l','i','t','.',' ','I','n','t','e','g','e','r',' ','q','u','i','s',' ','f','e','l','i','s',' ','u','t',' ','l','e','o',' ','e','l','e','i','f','e','n','d',' ','u','l','t','r','i','c','e','s',' ','f','i','n','i','b','u','s',' ','e','u',' ','d','o','l','o','r','.',' ','I','n',' ','b','i','b','e','n','d','u','m',',',' ','e','r','o','s',' ','e','u',' ','f','a','u','c','i','b','u','s',' ','c','o','n','s','e','q','u','a','t',',',' ','n','i','s','i',' ','m','a','g','n','a',' ','v','e','n','e','n','a','t','i','s',' ','j','u','s','t','o',',',' ','a','t',' ','t','r','i','s','t','i','q','u','e',' ','m','e','t','u','s',' ','d','o','l','o','r',' ','u','t',' ','r','i','s','u','s','.',' ','N','u','n','c',' ','e','u',' ','o','d','i','o',' ','d','i','g','n','i','s','s','i','m',',',' ','o','r','n','a','r','e',' ','a','n','t','e',' ','g','r','a','v','i','d','a',',',' ','l','o','b','o','r','t','i','s',' ','e','r','o','s','.',' ','C','r','a','s',' ','s','e','m',' ','e','x',',',' ','c','o','n','s','e','c','t','e','t','u','r',' ','p','u','l','v','i','n','a','r',' ','t','i','n','c','i','d','u','n','t',' ','e','u',',',' ','c','o','n','g','u','e',' ','a',' ','e','r','o','s','.',' ','C','u','r','a','b','i','t','u','r',' ','e','r','o','s',' ','e','r','a','t',',',' ','p','e','l','l','e','n','t','e','s','q','u','e',' ','e','t',' ','n','i','b','h',' ','q','u','i','s',',',' ','i','n','t','e','r','d','u','m',' ','t','e','m','p','o','r',' ','o','d','i','o','.',' ','E','t','i','a','m',' ','s','a','p','i','e','n',' ','s','a','p','i','e','n',',',' ','a','l','i','q','u','a','m',' ','u','t',' ','a','l','i','q','u','a','m',' ','a','t',',',' ','s','a','g','i','t','t','i','s',' ','e','u',' ','m','a','g','n','a','.',' ','M','a','e','c','e','n','a','s',' ','m','a','g','n','a',' ','m','a','g','n','a',',',' ','s','u','s','c','i','p','i','t',' ','u','t',' ','l','o','r','e','m',' ','u','t',',',' ','v','a','r','i','u','s',' ','p','r','e','t','i','u','m',' ','f','e','l','i','s','.',' ','I','n','t','e','g','e','r',' ','t','i','n','c','i','d','u','n','t',',',' ','m','e','t','u','s',' ','v','e','l',' ','s','o','l','l','i','c','i','t','u','d','i','n',' ','f','i','n','i','b','u','s',',',' ','f','e','l','i','s',' ','e','r','a','t',' ','m','o','l','e','s','t','i','e',' ','u','r','n','a',',',' ','a',' ','c','o','n','d','i','m','e','n','t','u','m',' ','a','u','g','u','e',' ','a','r','c','u',' ','v','i','t','a','e',' ','r','i','s','u','s','.',' ','E','t','i','a','m',' ','i','d',' ','s','a','g','i','t','t','i','s',' ','q','u','a','m','.',' ','M','o','r','b','i',' ','a',' ','u','l','t','r','i','c','i','e','s',' ','n','u','n','c','.',' ','P','h','a','s','e','l','l','u','s',' ','e','r','o','s',' ','r','i','s','u','s',',',' ','c','u','r','s','u','s',' ','u','l','l','a','m','c','o','r','p','e','r',' ','m','a','s','s','a',' ','s','e','d',',',' ','d','i','g','n','i','s','s','i','m',' ','c','o','n','s','e','q','u','a','t',' ','l','i','g','u','l','a','.',' ','A','l','i','q','u','a','m',' ','t','u','r','p','i','s',' ','a','r','c','u',',',' ','a','c','c','u','m','s','a','n',' ','q','u','i','s',' ','s','a','p','i','e','n',' ','v','i','t','a','e',',',' ','l','a','c','i','n','i','a',' ','e','u','i','s','m','o','d',' ','n','i','s','l','.',' ','M','a','u','r','i','s',' ','i','d',' ','f','e','l','i','s',' ','s','e','m','!',0};
545 static const WCHAR empty[] = {0};
546 static const WCHAR* all[] = { test1, test2, test3, test4, test5, lipsum, lipsum2, empty };
547 static const TAGID expected_str[] = { 0xc, 0x12, 0x18, 0x1e, 0x24, 0x2a, 0x30, 0x36 };
548 static const TAGID expected_tab[] = { 6, 0x18, 0x2a, 0x3c, 0x4e, 0x60, 0x846, 0x102c };
549 DWORD n, j;
550
551 for (n = 0; n < (sizeof(all) / sizeof(all[0])); ++n)
552 {
553 PDB pdb;
554 TAGID tagstr, table, expected_table;
555
556 write_db_strings(path1, all, n+1);
557
558 pdb = pSdbOpenDatabase(path1, DOS_PATH);
559 ok(pdb != NULL, "Expected a valid database\n");
560 if (!pdb)
561 {
563 continue;
564 }
565 tagstr = pSdbFindFirstTag(pdb, TAGID_ROOT, TAG_NAME);
566 for (j = 0; j <= n; ++j)
567 {
568 ok(tagstr == expected_str[j], "Expected tagstr to be 0x%x, was 0x%x for %u/%u\n", expected_str[j], tagstr, j, n);
569 if (tagstr)
570 {
571 LPWSTR data;
572 DWORD size;
573 TAG tag = pSdbGetTagFromTagID(pdb, tagstr);
574 ok(tag == TAG_NAME, "Expected tag to be TAG_NAME, was 0x%x for %u/%u\n", tag, j, n);
575 size = pSdbGetTagDataSize(pdb, tagstr);
576 ok(size == 4, "Expected datasize to be 4, was %u for %u/%u\n", size, j, n);
577 data = pSdbGetStringTagPtr(pdb, tagstr);
578 ok(data && !_wcsicmp(data, all[j]), "Expected data to be %s was %s for %u/%u\n", wine_dbgstr_w(all[j]), wine_dbgstr_w(data), j, n);
579 }
580 tagstr = pSdbFindNextTag(pdb, TAGID_ROOT, tagstr);
581 }
582 ok(tagstr == TAGID_NULL, "Expected to be at the end for %u\n", n);
583
584
585 table = pSdbFindFirstTag(pdb, TAGID_ROOT, TAG_STRINGTABLE);
586 expected_table = 0xc + (n+1)*6;
587 ok(table == expected_table, "Expected to find a stringtable at 0x%x instead of 0x%x for %u\n", expected_table, table, n);
588 if (table)
589 {
590 tagstr = pSdbFindFirstTag(pdb, table, TAG_STRINGTABLE_ITEM);
591 for (j = 0; j <= n; ++j)
592 {
593 ok(tagstr == (expected_tab[j] + expected_table), "Expected tagstr to be 0x%x, was 0x%x for %u/%u\n", (expected_tab[j] + expected_table), tagstr, j, n);
594 if (tagstr)
595 {
596 LPWSTR data;
597 DWORD size, expected_size;
598 TAG tag = pSdbGetTagFromTagID(pdb, tagstr);
599 ok(tag == TAG_STRINGTABLE_ITEM, "Expected tag to be TAG_NAME, was 0x%x for %u/%u\n", tag, j, n);
600 size = pSdbGetTagDataSize(pdb, tagstr);
601 expected_size = (lstrlenW(all[j])+1) * 2;
602 ok(size == expected_size, "Expected datasize to be %u, was %u for %u/%u\n", expected_size, size, j, n);
603 data = pSdbGetStringTagPtr(pdb, tagstr);
604 ok(data && !_wcsicmp(data, all[j]), "Expected data to be %s was %s for %u/%u\n", wine_dbgstr_w(all[j]), wine_dbgstr_w(data), j, n);
605 }
606 tagstr = pSdbFindNextTag(pdb, TAGID_ROOT, tagstr);
607 }
608 ok(tagstr == TAGID_NULL, "Expected to be at the end for %u\n", n);
609 }
610
611 pSdbCloseDatabase(pdb);
613 }
614}
static void write_db_strings(const WCHAR *name, const WCHAR *data[], size_t count)
Definition: db.cpp:518
static const WCHAR empty[]
Definition: main.c:47
#define lstrlenW
Definition: compat.h:750
void test2()
Definition: ehthrow.cxx:284
void test1()
Definition: ehthrow.cxx:277
void test4()
Definition: ehthrow.cxx:298
void test3()
Definition: ehthrow.cxx:291
void test5()
Definition: ehthrow.cxx:305
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizeiptr size
Definition: glext.h:5919
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250

Referenced by START_TEST().

◆ test_TagRef()

static void test_TagRef ( void  )
static

Definition at line 1585 of file db.cpp.

1586{
1587 WCHAR tmpdir[MAX_PATH], dbpath[MAX_PATH];
1588 BOOL ret;
1589 HSDB hsdb;
1590 PDB pdb;
1591 TAGID db;
1592 DWORD size;
1593 TAGREF tr;
1594
1596 ok(ret, "GetTempPathA error: %d\n", GetLastError());
1597
1598 /* SdbInitDatabase needs an nt-path */
1599 swprintf(dbpath, L"\\??\\%stest.sdb", tmpdir);
1600
1602
1603 hsdb = pSdbInitDatabase(HID_DATABASE_FULLPATH, dbpath);
1604
1605 /* HSDB is the only arg that can't be null */
1606 ret = pSdbTagRefToTagID(hsdb, 0, NULL, NULL);
1607 ok(ret == TRUE, "Expected ret to be TRUE, was: %d\n", ret);
1608
1610
1611 pdb = (PDB)&db;
1612 db = 12345;
1613 ret = pSdbTagRefToTagID(hsdb, size - 1, &pdb, &db);
1614 ok(ret == TRUE, "Expected ret to be TRUE, was: %d\n", ret);
1615 ok(pdb != NULL, "Expected a result, got: %p\n", pdb);
1616 ok(db == (size - 1), "Expected %u, got: %u\n", size - 1, db);
1617
1618 /* Convert it back. */
1619 tr = 0x12345678;
1620 ret = pSdbTagIDToTagRef(hsdb, pdb, db, &tr);
1621 ok(ret == TRUE, "Expected ret to be TRUE, was: %d\n", ret);
1622 ok(tr == (size - 1), "Expected %u, got: %u\n", size - 1, tr);
1623
1624 pdb = (PDB)&db;
1625 db = 12345;
1626 ret = pSdbTagRefToTagID(hsdb, size, &pdb, &db);
1627 ok(ret == TRUE, "Expected ret to be TRUE, was: %d\n", ret);
1628 ok(pdb != NULL, "Expected a result, got: %p\n", pdb);
1629 ok(db == size, "Expected %u, got: %u\n", size, db);
1630
1631 tr = 0x12345678;
1632 ret = pSdbTagIDToTagRef(hsdb, pdb, db, &tr);
1633 ok(ret == TRUE, "Expected ret to be TRUE, was: %d\n", ret);
1634 ok(tr == size, "Expected %u, got: %u\n", size, tr);
1635
1636 pdb = (PDB)&db;
1637 db = 12345;
1638 ret = pSdbTagRefToTagID(hsdb, size + 1, &pdb, &db);
1639 ok(ret == TRUE, "Expected ret to be TRUE, was: %d\n", ret);
1640 ok(pdb != NULL, "Expected a result, got: %p\n", pdb);
1641 ok(db == (size + 1), "Expected %u, got: %u\n", size + 1, db);
1642
1643 tr = 0x12345678;
1644 ret = pSdbTagIDToTagRef(hsdb, pdb, db, &tr);
1645 ok(ret == TRUE, "Expected ret to be TRUE, was: %d\n", ret);
1646 ok(tr == (size + 1), "Expected %u, got: %u\n", (size + 1), tr);
1647
1648 pdb = (PDB)&db;
1649 db = 12345;
1650 ret = pSdbTagRefToTagID(hsdb, 0x0fffffff, &pdb, &db);
1651 ok(ret == TRUE, "Expected ret to be TRUE, was: %d\n", ret);
1652 ok(pdb != NULL, "Expected a result, got: %p\n", pdb);
1653 ok(db == 0x0fffffff, "Expected %u, got: %u\n", 0x0fffffff, db);
1654
1655 tr = 0x12345678;
1656 ret = pSdbTagIDToTagRef(hsdb, pdb, db, &tr);
1657 ok(ret == TRUE, "Expected ret to be TRUE, was: %d\n", ret);
1658 ok(tr == 0x0fffffff, "Expected %u, got: %u\n", 0x0fffffff, tr);
1659
1660 pdb = (PDB)&db;
1661 db = 12345;
1662 ret = pSdbTagRefToTagID(hsdb, 0x10000000, &pdb, &db);
1663 ok(ret == FALSE, "Expected ret to be FALSE, was: %d\n", ret);
1664 ok(pdb == NULL, "Expected no result, got: %p\n", pdb);
1665 ok(db == 0, "Expected no result, got: 0x%x\n", db);
1666
1667 tr = 0x12345678;
1668 ret = pSdbTagIDToTagRef(hsdb, pdb, 0x10000000, &tr);
1669 ok(ret == FALSE, "Expected ret to be TRUE, was: %d\n", ret);
1670 ok(tr == 0, "Expected %u, got: %u\n", 0, tr);
1671
1672 pdb = NULL;
1673 db = TAGID_NULL;
1674 ret = pSdbTagRefToTagID(hsdb, TAGID_ROOT, &pdb, NULL);
1675 ok(ret != FALSE, "Expected ret to be TRUE, was: %d\n", ret);
1676 ok(pdb != NULL, "Expected pdb to be valid\n");
1677
1678 if (pdb == NULL)
1679 {
1680 skip("Cannot run tests without pdb\n");
1681 }
1682 else
1683 {
1684 db = pSdbFindFirstTag(pdb, TAGID_ROOT, TAG_DATABASE);
1685 if (db != TAGID_NULL)
1686 {
1687 TAGID child;
1688 child = pSdbGetFirstChild(pdb, db);
1689 while (child != TAGID_NULL)
1690 {
1691 PDB pdb_res;
1692 TAGID tagid_res;
1693 /* We are using a TAGID as a TAGREF here. */
1694 ret = pSdbTagRefToTagID(hsdb, child, &pdb_res, &tagid_res);
1695 ok(ret, "Expected SdbTagRefToTagID to succeed\n");
1696
1697 /* For simple cases (primary DB) TAGREF == TAGID */
1698 tr = 0x12345678;
1699 ret = pSdbTagIDToTagRef(hsdb, pdb_res, tagid_res, &tr);
1700 ok(ret, "Expected SdbTagIDToTagRef to succeed\n");
1701 ok_hex(tr, (int)tagid_res);
1702
1703 child = pSdbGetNextChild(pdb, db, child);
1704 }
1705 }
1706 else
1707 {
1708 skip("Cannot run tests without valid db tag\n");
1709 }
1710 }
1711
1712 /* Get a tagref for our own layer */
1713 tr = pSdbGetLayerTagRef(hsdb, L"TestNewMode");
1714 ok_hex(tr, 0x18e);
1715
1716 /* We cannot find a tagref from the main database. */
1717 tr = pSdbGetLayerTagRef(hsdb, L"256Color");
1718 ok_hex(tr, 0);
1719
1720 pSdbReleaseDatabase(hsdb);
1721
1722 DeleteFileW(dbpath + 4);
1723}
DWORD test_get_db_size()
Definition: data.c:773
#define TRUE
Definition: types.h:120
static HWND child
Definition: cursoricon.c:298
static char tmpdir[MAX_PATH]
Definition: shlexec.c:52

Referenced by START_TEST().

◆ test_write_ex()

static void test_write_ex ( void  )
static

Definition at line 408 of file db.cpp.

409{
410 WCHAR path1[] = {'t','e','s','t','.','s','d','b',0};
411 WCHAR test1[] = {'T','E','S','T',0};
412 WCHAR test2[] = {'t','e','s','t',0};
413 PDB pdb;
414 TAGID tagdb, tagstr;
415 TAG tag;
416 DWORD size;
417 BOOL ret;
418 LPWSTR ptr;
419
420 /* Write a small database */
421 pdb = pSdbCreateDatabase(path1, DOS_PATH);
422 ok(pdb != NULL, "Expected a valid database\n");
423 if (!pdb)
424 return;
425 tagdb = pSdbBeginWriteListTag(pdb, TAG_DATABASE);
426 ok(tagdb == 12, "Expected tag to be 12, was %u\n", tagdb);
427 ret = pSdbWriteStringTag(pdb, TAG_NAME, test1);
428 ret = pSdbWriteStringTag(pdb, TAG_NAME, test2);
429 ok(ret, "Expected SdbWriteStringTag to succeed\n");
430 ret = pSdbEndWriteListTag(pdb, tagdb);
431 ok(ret, "Expected SdbEndWriteListTag to succeed\n");
432
433 tagdb = pSdbBeginWriteListTag(pdb, TAG_DATABASE);
434 ok(tagdb == 30, "Expected tag to be 24, was %u\n", tagdb);
435 ret = pSdbWriteStringTag(pdb, TAG_NAME, test1);
436 ret = pSdbWriteStringTag(pdb, TAG_NAME, test2);
437 ok(ret, "Expected SdbWriteStringTag to succeed\n");
438 ret = pSdbEndWriteListTag(pdb, tagdb);
439 ok(ret, "Expected SdbEndWriteListTag to succeed\n");
440
441 pSdbCloseDatabaseWrite(pdb);
442
443 /* Now validate it's contents */
444 pdb = pSdbOpenDatabase(path1, DOS_PATH);
445 ok(pdb != NULL, "Expected a valid database\n");
446 if (!pdb)
447 return;
448
449 tagdb = pSdbFindFirstTag(pdb, TAGID_ROOT, TAG_DATABASE);
450 ok(tagdb == 12, "Expected tag to be 12, was %u\n", tagdb);
451 size = pSdbGetTagDataSize(pdb, tagdb);
452 ok(size == 12, "Expected size to be 12, was %u\n", size);
453
454 tagstr = pSdbFindFirstTag(pdb, tagdb, TAG_NAME);
455 ok(tagstr == 18, "Expected string tag to be 18, was %u\n", tagstr);
456 tag = pSdbGetTagFromTagID(pdb, tagstr);
457 ok(tag == TAG_NAME, "Expected tag to be TAG_NAME, was 0x%x\n", (DWORD)tag);
458 size = pSdbGetTagDataSize(pdb, tagstr);
459 ok(size == 4, "Expected size to be 4, was 0x%x\n", size);
460
461 tagstr = pSdbFindNextTag(pdb, tagdb, tagstr);
462 ok(tagstr == 24, "Expected string tag to be 24, was %u\n", tagstr);
463 tag = pSdbGetTagFromTagID(pdb, tagstr);
464 ok(tag == TAG_NAME, "Expected tag to be TAG_NAME, was 0x%x\n", (DWORD)tag);
465 size = pSdbGetTagDataSize(pdb, tagstr);
466 ok(size == 4, "Expected size to be 4, was 0x%x\n", size);
467
468 tagdb = pSdbFindNextTag(pdb, TAGID_ROOT, tagdb);
469 ok(tagdb == 30, "Expected tag to be 30, was %u\n", tagdb);
470 size = pSdbGetTagDataSize(pdb, tagdb);
471 ok(size == 12, "Expected size to be 12, was %u\n", size);
472
473 tagstr = pSdbFindFirstTag(pdb, tagdb, TAG_NAME);
474 ok(tagstr == 36, "Expected string tag to be 36, was %u\n", tagstr);
475 tag = pSdbGetTagFromTagID(pdb, tagstr);
476 ok(tag == TAG_NAME, "Expected tag to be TAG_NAME, was 0x%x\n", (DWORD)tag);
477 size = pSdbGetTagDataSize(pdb, tagstr);
478 ok(size == 4, "Expected size to be 4, was %u\n", size);
479
480 tagstr = pSdbFindNextTag(pdb, tagdb, tagstr);
481 ok(tagstr == 42, "Expected string tag to be 42, was %u\n", tagstr);
482 tag = pSdbGetTagFromTagID(pdb, tagstr);
483 ok(tag == TAG_NAME, "Expected tag to be TAG_NAME, was 0x%x\n", (DWORD)tag);
484 size = pSdbGetTagDataSize(pdb, tagstr);
485 ok(size == 4, "Expected size to be 4, was 0x%x\n", size);
486
487 tagdb = pSdbFindFirstTag(pdb, TAGID_ROOT, TAG_STRINGTABLE);
488 ok(tagdb == 48, "Expected tag to be 48, was %u\n", tagdb);
489 size = pSdbGetTagDataSize(pdb, tagdb);
490 ok(size == 32, "Expected size to be 32, was %u\n", size);
491
492 tagstr = pSdbGetFirstChild(pdb, tagdb);
493 ok(tagstr == 54, "Expected string tag to be 54, was %u\n", tagstr);
494 tag = pSdbGetTagFromTagID(pdb, tagstr);
495 ok(tag == TAG_STRINGTABLE_ITEM, "Expected tag to be TAG_STRINGTABLE_ITEM, was 0x%x\n", (DWORD)tag);
496 size = pSdbGetTagDataSize(pdb, tagstr);
497 ok(size == 10, "Expected size to be 10, was %u\n", size);
498 ptr = pSdbGetStringTagPtr(pdb, tagstr);
499 ok(ptr != NULL, "Expected a valid pointer\n");
500 if (ptr)
501 ok(wcscmp(ptr, test1) == 0, "Expected ptr to be %s, was %s\n", wine_dbgstr_w(test1), wine_dbgstr_w(ptr));
502
503 tagstr = pSdbGetNextChild(pdb, tagdb, tagstr);
504 ok(tagstr == 70, "Expected string tag to be 70, was %u\n", tagstr);
505 tag = pSdbGetTagFromTagID(pdb, tagstr);
506 ok(tag == TAG_STRINGTABLE_ITEM, "Expected tag to be TAG_STRINGTABLE_ITEM, was 0x%x\n", (DWORD)tag);
507 size = pSdbGetTagDataSize(pdb, tagstr);
508 ok(size == 10, "Expected size to be 10, was %u\n", size);
509 ptr = pSdbGetStringTagPtr(pdb, tagstr);
510 ok(ptr != NULL, "Expected a valid pointer\n");
511 if (ptr)
512 ok(wcscmp(ptr, test2) == 0, "Expected ptr to be %s, was %s\n", wine_dbgstr_w(test2), wine_dbgstr_w(ptr));
513
514 pSdbCloseDatabase(pdb);
515}
static PVOID ptr
Definition: dispmode.c:27

Referenced by START_TEST().

◆ validate_SDBQUERYRESULT_size()

static int validate_SDBQUERYRESULT_size ( )
static

Definition at line 2035 of file db.cpp.

2036{
2037 unsigned char buffer[SDBQUERYRESULT_EXPECTED_SIZE_VISTA * 2];
2039 size_t n;
2040
2041 memset(buffer, 0xab, sizeof(buffer));
2042
2044 pSdbGetMatchingExe(NULL, path, NULL, NULL, 0, (SDBQUERYRESULT_VISTA*)buffer);
2045 if (buffer[0] == 0xab)
2046 {
2047 trace("SdbGetMatchingExe didnt do anything, cannot determine SDBQUERYRESULT size\n");
2048 return 0;
2049 }
2050
2052 {
2053 return 1;
2054 }
2055
2057 {
2058 return 2;
2059 }
2060
2061 for (n = 0; n < _countof(buffer); ++n)
2062 {
2063 if (buffer[n] != 0xab)
2064 {
2065 trace("Unknown size: %i\n", n);
2066 break;
2067 }
2068 }
2069
2070 return 0;
2071}
#define SDBQUERYRESULT_EXPECTED_SIZE_2k3
#define SDBQUERYRESULT_EXPECTED_SIZE_VISTA
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600

Referenced by START_TEST().

◆ void()

static void ( WINAPI pSdbCloseDatabase)
static

◆ VOID()

static VOID ( WINAPI pSdbFreeDatabaseInformation)
static

◆ WORD()

static WORD ( WINAPI pSdbReadWORDTag)
static

◆ Write()

static void Write ( HANDLE  file,
LPCVOID  buffer,
DWORD  size 
)
static

Definition at line 186 of file db.cpp.

187{
188 DWORD dwWritten = 0;
189 WriteFile(file, buffer, size, &dwWritten, NULL);
190}
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24

Referenced by test_Sdb().

◆ write_db_strings()

static void write_db_strings ( const WCHAR name,
const WCHAR data[],
size_t  count 
)
static

Definition at line 518 of file db.cpp.

519{
520 PDB pdb;
521 size_t n;
522 BOOL ret;
523
524 pdb = pSdbCreateDatabase(name, DOS_PATH);
525 ok(pdb != NULL, "Failed to create db for case %u\n", count);
526 for (n = 0; n < count; ++n)
527 {
528 ret = pSdbWriteStringTag(pdb, TAG_NAME, data[n]);
529 ok(ret, "Failed to write string %u/%u\n", n, count);
530 }
531 pSdbCloseDatabaseWrite(pdb);
532}
GLuint GLuint GLsizei count
Definition: gl.h:1545

Referenced by test_stringtable().

◆ write_raw_file()

static BOOL write_raw_file ( const WCHAR FileName,
const void Data,
DWORD  Size 
)
static

Definition at line 1433 of file db.cpp.

1434{
1435 BOOL Success;
1436 DWORD dwWritten;
1438
1440 {
1441 skip("Failed to create temp file %ls, error %u\n", FileName, GetLastError());
1442 return FALSE;
1443 }
1444 Success = WriteFile(Handle, Data, Size, &dwWritten, NULL);
1445 ok(Success == TRUE, "WriteFile failed with %u\n", GetLastError());
1446 ok(dwWritten == Size, "WriteFile wrote %u bytes instead of %u\n", dwWritten, Size);
1448 return Success && (dwWritten == Size);
1449}
@ Success
Definition: eventcreate.c:712
ULONG Handle
Definition: gdb_input.c:15
#define CREATE_ALWAYS
Definition: disk.h:72

Referenced by extract_resource().

Variable Documentation

◆ adwExeFlags_0

DWORD adwExeFlags_0

Definition at line 878 of file db.cpp.

Referenced by check_adwExeFlags(), and test_mode_generic().

◆ app_name

const WCHAR* app_name

Definition at line 872 of file db.cpp.

Referenced by check_db_exes().

◆ apphelp_details

const WCHAR* apphelp_details

Definition at line 1000 of file db.cpp.

Referenced by check_db_apphelp().

◆ apphelp_title

const WCHAR* apphelp_title

Definition at line 999 of file db.cpp.

Referenced by check_db_apphelp().

◆ atrExes_0

TAGREF atrExes_0

Definition at line 877 of file db.cpp.

◆ atrLayers_0

TAGREF atrLayers_0

Definition at line 879 of file db.cpp.

Referenced by test_mode_generic().

◆ dwLayerCount

DWORD dwLayerCount

Definition at line 876 of file db.cpp.

Referenced by expect_layeronly_imp().

◆ DWORD

Definition at line 147 of file db.cpp.

Referenced by test_GetDatabaseInformationEmpty().

◆ env

◆ env_var

const char* env_var

Definition at line 881 of file db.cpp.

Referenced by doChild(), and test_mode_generic().

◆ exe_id

GUID exe_id

Definition at line 874 of file db.cpp.

Referenced by check_db_exes().

◆ extra_file

const WCHAR* extra_file

Definition at line 875 of file db.cpp.

Referenced by test_mode_generic().

◆ find

◆ find_name

TAGID TAGID TAGID LPCWSTR find_name

Definition at line 156 of file db.cpp.

Referenced by SdbFindFirstNamedTag(), and SymFromName().

◆ flags

Definition at line 171 of file db.cpp.

◆ hdll

HMODULE hdll
static

Definition at line 137 of file db.cpp.

Referenced by START_TEST().

◆ htmlhelpid

DWORD htmlhelpid

Definition at line 997 of file db.cpp.

Referenced by check_db_apphelp().

◆ information

◆ layerName

LPCWSTR layerName

Definition at line 174 of file db.cpp.

Referenced by SdbGetLayerTagRef(), SdbpAddExeLayers(), and SdbpAddNamedLayerMatch().

◆ link

◆ lpBuffer

*nSize LPWSTR lpBuffer

Definition at line 176 of file db.cpp.

Referenced by __acrt_GetTempPath2A(), __acrt_GetTempPath2W(), __dcrt_peek_console_input_a(), __dcrt_read_console(), __dcrt_read_console_input(), __dcrt_write_console(), _enumerateContextW(), _enumerateGlobalPassthroughW(), _enumerateGlobalW(), _enumerateProvidersW(), _enumerateProviderW(), _hread(), _hwrite(), _RpcAddPortEx(), _tfullpath(), _thunkNetResourceArrayAToW(), _thunkNetResourceArrayWToA(), AddPortExA(), AddPortExW(), AllSysInfo(), AVISaveVW(), BatchGetString(), BuildAdvPropTitle(), BuildDesktopNameList(), BuildWindowStationNameList(), CM_Set_Class_Registry_PropertyA(), CM_Set_DevNode_Registry_Property_ExA(), COMBO_GetText(), COMBO_GetTextA(), COMBO_GetTextW(), ConInKey(), CopyLoop(), Create(), CSR_API(), DECLARE_INTERFACE_(), DeviceProblemTextA(), DisplayClassCoinstallers(), DisplayClassProperties(), DisplayDeviceCoinstallers(), DisplayDevicePropertyText(), DisplayUsage(), DrawTextFromResource(), EngFileWrite(), EngpFileIoRequest(), EnumMRUListA(), EnumMRUListW(), FileGetString(), FilterFindFirst(), FilterFindNext(), FilterGetInformation(), FilterInstanceFindFirst(), FilterInstanceFindNext(), FilterInstanceGetInformation(), FilterVolumeFindFirst(), FilterVolumeFindNext(), FilterVolumeInstanceFindFirst(), FilterVolumeInstanceFindNext(), FormatMessageA(), FormatMessageSafeW(), FormatMessageW(), FormatString(), GdipGetSupportedFileExtensions(), GenerateComputerName(), GetAllUsersProfileDirectoryA(), GetAtomNameA(), GetAtomNameW(), GetBootResourceList(), GetCharacterTimeout(), GetCharWidth32A(), GetCharWidth32W(), GetCharWidthA(), GetCharWidthI(), GetCharWidthW(), GetClipboardFormatNameA(), GetColorDescription(), GetComputerNameA(), GetComputerNameExA(), GetComputerNameExW(), GetComputerNameFromRegistry(), GetComputerNameW(), GetCurrentDirectoryA(), GetCurrentDirectoryW(), GetDefaultUserProfileDirectoryA(), GetDllDirectoryA(), GetDllDirectoryW(), GetDllList(), GetEnvironmentVariableA(), GetEnvironmentVariableW(), GetEventLogInformation(), GetFontObjectA(), GetFontResourceInfoW(), GetFullPathNameA(), GetFullPathNameW(), GetKeyNameTextA(), GetLocalisedText(), GetLogicalDriveStringsA(), GetLogicalDriveStringsW(), GetObjectA(), GetObjectW(), GetProfilesDirectoryA(), GetRefreshRateDescription(), GetServices(), GetSystemDirectoryA(), GetSystemDirectoryW(), GetSystemWindowsDirectoryA(), GetSystemWindowsDirectoryW(), GetTempPathA(), GetUserProfileDirectoryA(), GetWindowsDirectoryA(), GetWindowsDirectoryW(), GlobalGetAtomNameA(), GlobalGetAtomNameW(), GlobalMemoryStatus(), GlobalMemoryStatusEx(), HTTP_HttpQueryInfoW(), HttpQueryInfoA(), HttpQueryInfoW(), IntAddGlobalAtom(), InternetQueryOptionA(), InternetQueryOptionW(), InternetReadFile(), InternetReadFileExW(), InternetSetOptionA(), InternetSetOptionExA(), InternetSetOptionExW(), InternetSetOptionW(), InternetWriteFile(), IntGetAtomName(), IntGetConsoleInput(), IntReadConsole(), IntReadConsoleOutput(), IntWriteConsole(), IntWriteConsoleInput(), IntWriteConsoleOutput(), InvokeRemoteRegistryPickerDialog(), IsDataUnicode(), K32LoadStringExW(), K32LoadStringW(), LoadRdpSettingsFromFile(), LoadStringWrapW(), LocalAddPortEx(), LocalmonAddPortEx(), LsapLoadString(), LsapLoadStringEx(), main(), MAPIFreeBuffer(), MDI_UpdateFrameText(), MsiLoadStringA(), MsiLoadStringW(), NDdeShareAddA(), NDdeShareAddW(), NDdeShareEnumA(), NDdeShareEnumW(), NDdeShareGetInfoA(), NDdeShareGetInfoW(), NDdeShareSetInfoA(), NDdeShareSetInfoW(), NDdeTrustedShareEnumA(), NDdeTrustedShareEnumW(), NPEnumResource(), NpGetUserNamep(), NPSCopyStringA(), NtGdiExtGetObjectW(), NtUserBuildNameList(), PALETTE_GetObject(), ParseSettings(), pCDevSettings_ReadHardwareInfo(), PeekConsoleInput(), PeekConsoleInputA(), PeekConsoleInputW(), PeekNamedPipe(), CDownloadManager::PerformDownloadAndInstall(), pSetupOpenAndMapFileForRead(), pSetupStringTableStringFromIdEx(), pSetupUnmapAndCloseFile(), QueryConfig2A(), QueryConfig2W(), QueryServiceConfig2A(), QueryServiceConfig2W(), QueryServiceStatusEx(), ReadAndHandleOutput(), ReadConsoleA(), ReadConsoleInput(), ReadConsoleInputA(), ReadConsoleInputExA(), ReadConsoleInputExW(), ReadConsoleInputW(), ReadConsoleOutputA(), ReadConsoleOutputW(), ReadConsoleW(), ReadDirectoryChangesW(), ReadEventLogA(), ReadEventLogW(), ReadFile(), ReadFileEx(), ReadProcessMemory(), ReadRdpFile(), ReadUrlCacheEntryStream(), REnumServiceGroupW(), REnumServicesStatusA(), REnumServicesStatusExA(), REnumServicesStatusExW(), REnumServicesStatusW(), RQueryServiceConfig2A(), RQueryServiceConfig2W(), RQueryServiceStatusEx(), SampLoadString(), SdbQueryData(), SdbQueryDataEx(), SdbQueryDataExTagID(), SearchPathA(), SearchPathW(), SetActiveComputerNameToRegistry(), SetAllVars(), SetComputerNameExA(), SetComputerNameExW(), SetComputerNameToRegistry(), SetRegTextData(), SETUP_GetValueString(), SndMixerGetLineName(), SndMixerGetProductName(), test_async_file_errors(), test_normal_imports(), Toolhelp32ReadProcessMemory(), User32GetSystemFilePath(), VirtualQuery(), VirtualQueryEx(), wmain(), WNetEnumResourceA(), WNetEnumResourceW(), WNetGetResourceInformationA(), WNetGetResourceInformationW(), WNetGetResourceParentA(), WNetGetResourceParentW(), WNetGetUniversalNameA(), WNetGetUniversalNameW(), WriteConsole(), WriteConsoleA(), WriteConsoleInputA(), WriteConsoleInputVDMA(), WriteConsoleInputVDMW(), WriteConsoleInputW(), WriteConsoleOutputA(), WriteConsoleOutputW(), WriteConsoleW(), WriteFile(), WriteFileEx(), and WriteProcessMemory().

◆ lpcbBufferSize

static TAGID LPCWSTR LPDWORD LPVOID LPDWORD lpcbBufferSize

Definition at line 176 of file db.cpp.

Referenced by SdbQueryData(), SdbQueryDataEx(), and SdbQueryDataExTagID().

◆ LPCWSTR

Definition at line 149 of file db.cpp.

◆ lpdwDataType

static TAGID LPCWSTR LPDWORD lpdwDataType

Definition at line 176 of file db.cpp.

Referenced by SdbQueryData(), SdbQueryDataEx(), and SdbQueryDataExTagID().

◆ lpszDataName

static TAGID LPCWSTR lpszDataName

Definition at line 176 of file db.cpp.

Referenced by SdbQueryData(), SdbQueryDataEx(), and SdbQueryDataExTagID().

◆ LPWSTR

Definition at line 161 of file db.cpp.

◆ module_name

◆ name

Definition at line 871 of file db.cpp.

◆ nametag

TAGID TAGID TAGID nametag

Definition at line 156 of file db.cpp.

Referenced by SdbFindFirstNamedTag().

◆ path

Definition at line 171 of file db.cpp.

◆ PATH_TYPE

Definition at line 139 of file db.cpp.

◆ PBYTE

Definition at line 160 of file db.cpp.

Referenced by test_Sdb().

◆ PCWSTR

GUID *static PCWSTR

Definition at line 168 of file db.cpp.

◆ pdb

PDB pdb

Definition at line 173 of file db.cpp.

Referenced by Database::BeginWriteListTag(), check_db_apphelp(), check_db_exes(), check_db_layer(), check_db_properties(), check_matching_apphelp(), check_matching_file(), check_matching_layer(), codeview_process_info(), Database::EndWriteListTag(), GetSdbGuid(), match_dw_attr_imp(), match_guid_attr_imp(), match_qw_attr_imp(), match_strw_attr_imp(), MSI_OpenDatabaseW(), pdb_ds_read(), pdb_init(), pdb_jg_read(), pdb_read_ds_file(), pdb_read_jg_file(), ProcessExe(), ProcessLayers(), query_perf_data(), SdbBeginWriteListTag(), SdbCloseDatabase(), SdbCloseDatabaseWrite(), SdbCreateDatabase(), SdbEndWriteListTag(), SdbFindFirstNamedTag(), SdbFindFirstTag(), SdbFindNextTag(), SdbGetBinaryTagData(), SdbGetDatabaseID(), SdbGetDatabaseInformation(), SdbGetDatabaseVersion(), SdbGetFirstChild(), SdbGetLayerTagRef(), SdbGetMatchingExe(), SdbGetNextChild(), SdbGetStringTagPtr(), SdbGetTagDataSize(), SdbGetTagFromTagID(), SdbInstall(), SdbOpenDatabase(), SdbpAddDatabaseGuid(), SdbpAddExeLayers(), SdbpAddExeMatch(), SdbpAddNamedLayerMatch(), SdbpCheckTagIDType(), SdbpCreate(), SdbpFlush(), SdbpGetOrAddStringRef(), SdbpGetString(), SdbpGetTagSize(), SdbpMatchExe(), SdbpMatchFileAttributes(), SdbpOpenDatabase(), SdbpReadData(), SdbpWrite(), SdbpWriteStringtable(), SdbQueryDataEx(), SdbQueryDataExTagID(), SdbReadBinaryTag(), SdbReadDWORDTag(), SdbReadQWORDTag(), SdbReadStringTag(), SdbReadWORDTag(), SdbRegisterDatabaseEx(), SdbTagIDToTagRef(), SdbUninstall(), SdbWriteBinaryTag(), SdbWriteBinaryTagFromFile(), SdbWriteDWORDTag(), SdbWriteNULLTag(), SdbWriteQWORDTag(), SdbWriteStringRefTag(), SdbWriteStringTag(), SdbWriteWORDTag(), SeiAddFlag(), SeiBuildGlobalInclExclList(), SeiBuildInclExclList(), SeiBuildShimRefArray(), SeiGetDWORD(), SeiGetQWORD(), SeiGetStringPtr(), SeiInit(), SeiReadInExclude(), test_CheckDatabaseManually(), test_DataTags(), test_GetDatabaseInformation(), test_GetDatabaseInformationEmpty(), test_is_testdb(), test_match_ex(), test_mode_generic(), test_RegQueryValueExPerformanceData(), test_Sdb(), test_stringtable(), test_TagRef(), test_write_ex(), Database::toSdb(), InExclude::toSdb(), ShimRef::toSdb(), FlagRef::toSdb(), Shim::toSdb(), Flag::toSdb(), Data::toSdb(), Layer::toSdb(), MatchingFile::toSdb(), Exe::toSdb(), ValidateShim(), write_db_strings(), Database::WriteBinary(), Database::WriteDWord(), WriteGeneric(), Database::WriteQWord(), and Database::WriteString().

◆ PDWORD

Definition at line 141 of file db.cpp.

◆ ppdb

TAGREF PDB* ppdb

Definition at line 172 of file db.cpp.

Referenced by SdbTagRefToTagID().

◆ ptiData

Definition at line 178 of file db.cpp.

Referenced by SdbQueryDataExTagID().

◆ ptiWhich

TAGREF PDB TAGID* ptiWhich

Definition at line 172 of file db.cpp.

Referenced by SdbTagRefToTagID().

◆ ptrData

Definition at line 177 of file db.cpp.

Referenced by SdbQueryDataEx().

◆ ptrWhich

PDB TAGID TAGREF* ptrWhich

Definition at line 173 of file db.cpp.

Referenced by SdbTagIDToTagRef().

◆ QWORD

Definition at line 148 of file db.cpp.

◆ result

◆ root

Definition at line 156 of file db.cpp.

Referenced by test_CheckDatabaseManually().

◆ SIZE_T

GUID *static SIZE_T

Definition at line 168 of file db.cpp.

◆ TAG

TAG

Definition at line 145 of file db.cpp.

◆ TAGID

Definition at line 144 of file db.cpp.

◆ 

struct { ... } test_exedata[5]

◆ 

struct { ... } test_layerdata[2]
Initial value:
= {
{
2,
L"http://reactos.org/disallow",
L"apphelp_name_disallow",
L"Not allowed!",
},
{
1,
L"http://reactos.org/allow",
L"apphelp_name_allow",
L"Allow it!",
},
}

Referenced by check_db_apphelp().

◆ tiExe

TAGID tiExe

Definition at line 178 of file db.cpp.

Referenced by SdbQueryDataExTagID().

◆ tiWhich

PDB TAGID tiWhich

Definition at line 173 of file db.cpp.

Referenced by SdbQueryDataEx(), and SdbTagIDToTagRef().

◆ trApphelp

TAGREF trApphelp

Definition at line 880 of file db.cpp.

Referenced by test_mode_generic().

◆ trWhich

static TAGREF trWhich

Definition at line 172 of file db.cpp.

Referenced by SdbQueryData(), SdbQueryDataEx(), and SdbTagRefToTagID().

◆ vendor

◆ WORD

Definition at line 146 of file db.cpp.