ReactOS  0.4.15-dev-2704-gd5265b0
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 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)
 
static BOOL IsUserAdmin ()
 
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.

◆ 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 1972 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 660 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 662 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 661 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 659 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 1209 of file db.cpp.

1210 {
1211  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);
1212  for (size_t n = 1; n < _countof(query.atrExes); ++n)
1213  ok_(file, line)(query.adwExeFlags[n] == 0, "Expected adwExeFlags[%d] to be 0, was: %x for %d\n", n, query.adwExeFlags[0], cur);
1214 }
GLdouble n
Definition: glext.h:7729
DWORD adwExeFlags_0
Definition: db.cpp:871
Definition: parser.c:48
#define _countof(array)
Definition: sndvol32.h:68
FxCollectionEntry * cur
#define ok_(x1, x2)
Definition: atltest.h:61
Definition: fci.c:126

Referenced by test_mode_generic().

◆ check_adwExeFlags() [2/2]

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

Definition at line 1217 of file db.cpp.

1218 {
1219 }

◆ check_db_apphelp()

static void check_db_apphelp ( PDB  pdb,
TAGID  root 
)
static

Definition at line 1009 of file db.cpp.

1010 {
1011  int num = 0;
1012  TAGID apphelp = pSdbFindFirstTag(pdb, root, TAG_APPHELP);
1013  while (apphelp != TAGID_NULL)
1014  {
1015  TAGID link;
1016  ok(num < 2, "Too many matches, expected only 4!\n");
1017  if (num >= 2)
1018  break;
1020  link = pSdbFindFirstTag(pdb, apphelp, TAG_LINK);
1021  ok(link != TAGID_NULL, "expected to find a link tag\n");
1022  if (link != TAGID_NULL)
1023  {
1025  }
1028  apphelp = pSdbFindNextTag(pdb, root, apphelp);
1029  num++;
1030  }
1031  ok(num == 2, "Expected to find 2 layer tags, found: %d\n", num);
1032 }
#define TAG_HTMLHELPID
Definition: db.cpp:67
static PDB pdb
Definition: db.cpp:172
#define TAG_LINK
Definition: db.cpp:92
const WCHAR * apphelp_details
Definition: db.cpp:993
static struct @1584 test_layerdata[2]
#define TAG_LINK_URL
Definition: db.cpp:113
const WCHAR * apphelp_title
Definition: db.cpp:992
DWORD htmlhelpid
Definition: db.cpp:990
#define TAG_APPHELP_DETAILS
Definition: db.cpp:112
#define match_strw_attr
Definition: db.cpp:659
GLuint GLuint num
Definition: glext.h:9618
#define TAGID_NULL
Definition: db.cpp:38
#define TAG_APPHELP_TITLE
Definition: db.cpp:114
#define ok(value,...)
Definition: atltest.h:57
#define TAG_APPHELP
Definition: db.cpp:91
const WCHAR * link
Definition: db.cpp:991
DWORD TAGID
#define match_dw_attr
Definition: db.cpp:660

Referenced by test_CheckDatabaseManually().

◆ check_db_exes()

static void check_db_exes ( PDB  pdb,
TAGID  root 
)
static

Definition at line 943 of file db.cpp.

944 {
945  int num = 0;
946  TAGID exe = pSdbFindFirstTag(pdb, root, TAG_EXE);
947  TAGID altExe = pSdbFindFirstNamedTag(pdb, root, TAG_EXE, TAG_NAME, L"test_allow.exe");
948  ok_hex(altExe, (int)exe);
949  while (exe != TAGID_NULL)
950  {
951  TAGID apphelp, layer;
952  ok(num < 4, "Too many matches, expected only 4!\n");
953  if (num >= 4)
954  break;
959  check_matching_file(pdb, exe, pSdbFindFirstTag(pdb, exe, TAG_MATCHING_FILE), num);
960  apphelp = pSdbFindFirstTag(pdb, exe, TAG_APPHELP);
961  if (num == 0 || num == 1)
962  {
963  ok(apphelp != TAGID_NULL, "Expected to find a valid apphelp match on %d.\n", num);
964  if (apphelp)
965  check_matching_apphelp(pdb, apphelp, num);
966  }
967  else
968  {
969  ok(apphelp == TAGID_NULL, "Did not expect an apphelp match on %d\n", num);
970  }
971  layer = pSdbFindFirstTag(pdb, exe, TAG_LAYER);
972  if (num == 2 || num == 3)
973  {
974  ok(layer != TAGID_NULL, "Expected to find a valid layer match on %d.\n", num);
975  if (layer)
977  }
978  else
979  {
980  ok(layer == TAGID_NULL, "Did not expect a layer match on %d\n", num);
981  }
982  ++num;
983  exe = pSdbFindNextTag(pdb, root, exe);
984  }
985  ok(num == 4, "Expected to find 4 exe tags, found: %d\n", num);
986 }
static PDB pdb
Definition: db.cpp:172
#define TAG_EXE_ID
Definition: db.cpp:120
static void check_matching_apphelp(PDB pdb, TAGID apphelp, int num)
Definition: db.cpp:799
const WCHAR * app_name
Definition: db.cpp:865
#define TAG_APP_NAME
Definition: db.cpp:101
static void check_matching_layer(PDB pdb, TAGID layer, int num)
Definition: db.cpp:847
#define ok_hex(expression, result)
Definition: atltest.h:94
#define TAG_MATCHING_FILE
Definition: db.cpp:88
#define TAG_VENDOR
Definition: db.cpp:100
#define TAG_EXE
Definition: db.cpp:87
static void check_matching_file(PDB pdb, TAGID exe, TAGID matching_file, int num)
Definition: db.cpp:732
#define match_strw_attr
Definition: db.cpp:659
GLenum GLuint GLint GLint layer
Definition: glext.h:7007
const WCHAR * vendor
Definition: db.cpp:866
GLuint GLuint num
Definition: glext.h:9618
static const WCHAR L[]
Definition: oid.c:1250
#define TAGID_NULL
Definition: db.cpp:38
#define ok(value,...)
Definition: atltest.h:57
#define TAG_LAYER
Definition: db.cpp:90
#define TAG_NAME
Definition: db.cpp:98
#define TAG_APPHELP
Definition: db.cpp:91
Definition: name.c:38
#define match_guid_attr
Definition: db.cpp:662
DWORD TAGID
static struct @1583 test_exedata[5]
GUID exe_id
Definition: db.cpp:867

Referenced by test_CheckDatabaseManually().

◆ check_db_layer()

static void check_db_layer ( PDB  pdb,
TAGID  layer 
)
static

Definition at line 698 of file db.cpp.

699 {
700  TAGID shimref, inexclude, is_include;
701  ok(layer != TAGID_NULL, "Expected a valid layer, got NULL\n");
702  if (!layer)
703  return;
704 
705  match_strw_attr(pdb, layer, TAG_NAME, L"TestNewMode");
706  shimref = pSdbFindFirstTag(pdb, layer, TAG_SHIM_REF);
707  ok(shimref != TAGID_NULL, "Expected a valid shim ref, got NULL\n");
708  if (!shimref)
709  return;
710 
711  match_strw_attr(pdb, shimref, TAG_NAME, L"VirtualRegistry");
712  match_strw_attr(pdb, shimref, TAG_COMMAND_LINE, L"ThemeActive");
713  inexclude = pSdbFindFirstTag(pdb, shimref, TAG_INEXCLUD);
714  ok(inexclude != TAGID_NULL, "Expected a valid in/exclude ref, got NULL\n");
715  if (!inexclude)
716  return;
717 
718  is_include = pSdbFindFirstTag(pdb, inexclude, TAG_INCLUDE);
719  ok(is_include == TAGID_NULL, "Expected a NULL include ref, but got one anyway.\n");
720  match_strw_attr(pdb, inexclude, TAG_MODULE, L"exclude.dll");
721 
722  inexclude = pSdbFindNextTag(pdb, shimref, inexclude);
723  ok(inexclude != TAGID_NULL, "Expected a valid in/exclude ref, got NULL\n");
724  if (!inexclude)
725  return;
726 
727  is_include = pSdbFindFirstTag(pdb, inexclude, TAG_INCLUDE);
728  ok(is_include != TAGID_NULL, "Expected a valid include ref, got NULL\n");
729  match_strw_attr(pdb, inexclude, TAG_MODULE, L"include.dll");
730 }
#define TAG_INCLUDE
Definition: db.cpp:56
static PDB pdb
Definition: db.cpp:172
#define TAG_COMMAND_LINE
Definition: db.cpp:102
#define TAG_INEXCLUD
Definition: db.cpp:86
#define TAG_MODULE
Definition: db.cpp:99
#define match_strw_attr
Definition: db.cpp:659
GLenum GLuint GLint GLint layer
Definition: glext.h:7007
static const WCHAR L[]
Definition: oid.c:1250
#define TAG_SHIM_REF
Definition: db.cpp:89
#define TAGID_NULL
Definition: db.cpp:38
#define ok(value,...)
Definition: atltest.h:57
#define TAG_NAME
Definition: db.cpp:98
DWORD TAGID

Referenced by test_CheckDatabaseManually().

◆ check_db_properties()

static void check_db_properties ( PDB  pdb,
TAGID  root 
)
static

Definition at line 668 of file db.cpp.

669 {
670  TAGID iter = pSdbFindFirstTag(pdb, root, TAG_DATABASE_ID);
671  ok(iter != TAGID_NULL, "expected a result, got TAGID_NULL\n");
672  if (iter != TAGID_NULL)
673  {
674  GUID guid = { 0 }, guid2 = { 0 };
675  BOOL result = pSdbReadBinaryTag(pdb, iter, (PBYTE)&guid, sizeof(guid));
676  ok(result, "expected SdbReadBinaryTag not to fail.\n");
677  if (result)
678  {
679  WCHAR guid_wstr[50];
680  result = pSdbGUIDToString(&guid, guid_wstr, 50);
681  ok(result, "expected SdbGUIDToString not to fail.\n");
682  if (result)
683  {
684  char guid_str[50];
685  WideCharToMultiByte(CP_ACP, 0, guid_wstr, -1, guid_str, sizeof(guid_str), NULL, NULL);
686  ok_str(guid_str, "{e39b0eb0-55db-450b-9bd4-d20c9484260f}");
687  }
688  ok(pSdbGetDatabaseID(pdb, &guid2), "expected SdbGetDatabaseID not to fail.\n");
689  ok(IsEqualGUID(guid, guid2), "expected guids to be equal(%s:%s)\n", wine_dbgstr_guid(&guid), wine_dbgstr_guid(&guid2));
690  }
691  }
692  match_qw_attr(pdb, root, TAG_TIME, 0x1d1b91a02c0d63e);
694  match_strw_attr(pdb, root, TAG_NAME, L"apphelp_test1");
696 }
#define TAG_OS_PLATFORM
Definition: db.cpp:76
static PDB pdb
Definition: db.cpp:172
#define ok_str(x, y)
Definition: atltest.h:127
#define WideCharToMultiByte
Definition: compat.h:111
GLuint64EXT * result
Definition: glext.h:11304
#define CP_ACP
Definition: compat.h:109
const char * wine_dbgstr_guid(const GUID *guid)
#define match_qw_attr
Definition: db.cpp:661
static GUID guid2
Definition: devinst.c:42
const GUID * guid
unsigned int BOOL
Definition: ntddk_ex.h:94
#define match_strw_attr
Definition: db.cpp:659
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR L[]
Definition: oid.c:1250
#define TAGID_NULL
Definition: db.cpp:38
#define ok(value,...)
Definition: atltest.h:57
#define TAG_NAME
Definition: db.cpp:98
#define TAG_TIME
Definition: db.cpp:78
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define TAG_COMPILER_VERSION
Definition: db.cpp:116
#define TAG_DATABASE_ID
Definition: db.cpp:122
DWORD TAGID
#define match_dw_attr
Definition: db.cpp:660
BYTE * PBYTE
Definition: pedump.c:66

Referenced by test_CheckDatabaseManually().

◆ check_matching_apphelp()

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

Definition at line 799 of file db.cpp.

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

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 732 of file db.cpp.

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

Referenced by check_db_exes().

◆ check_matching_layer()

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

Definition at line 847 of file db.cpp.

848 {
849  if (num == 2)
850  {
852  match_strw_attr(pdb, layer, TAG_NAME, L"TestNewMode");
853  }
854  else
855  {
856  TAGID layer_tagid = pSdbFindFirstTag(pdb, layer, TAG_LAYER_TAGID);
857  ok(layer_tagid == TAGID_NULL, "expected not to find a layer tagid, got %x\n", layer_tagid);
858  match_strw_attr(pdb, layer, TAG_NAME, L"WinSrv03");
859  }
860 }
static PDB pdb
Definition: db.cpp:172
#define TAG_LAYER_TAGID
Definition: db.cpp:69
#define match_strw_attr
Definition: db.cpp:659
GLenum GLuint GLint GLint layer
Definition: glext.h:7007
GLuint GLuint num
Definition: glext.h:9618
static const WCHAR L[]
Definition: oid.c:1250
#define TAGID_NULL
Definition: db.cpp:38
#define ok(value,...)
Definition: atltest.h:57
#define TAG_NAME
Definition: db.cpp:98
DWORD TAGID
#define match_dw_attr
Definition: db.cpp:660

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 1962 of file db.cpp.

1963 {
1964  static WCHAR wide_string[100] = { 0 };
1965  LONGLONG result;
1966  MultiByteToWideChar(CP_ACP, 0, text, -1, wide_string, 100);
1967 
1968  result = pSdbMakeIndexKeyFromString(wide_string);
1969  winetest_ok(result == expected, "Expected %s to result in %s, was: %s\n", text, wine_dbgstr_longlong(expected), wine_dbgstr_longlong(result));
1970 }
GLuint64EXT * result
Definition: glext.h:11304
const WCHAR * text
Definition: package.c:1827
#define CP_ACP
Definition: compat.h:109
int64_t LONGLONG
Definition: typedefs.h:68
__wchar_t WCHAR
Definition: xmlstorage.h:180
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)
#define MultiByteToWideChar
Definition: compat.h:110
static LPCWSTR LPCWSTR LPCWSTR DWORD PSDBQUERYRESULT_VISTA result
Definition: db.cpp:170
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
BOOL expected
Definition: store.c:2063

◆ extract_resource()

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

Definition at line 1462 of file db.cpp.

1463 {
1464  HMODULE hMod = GetModuleHandleW(NULL);
1465  HRSRC hRsrc = FindResourceW(hMod, ResourceName, MAKEINTRESOURCEW(RT_RCDATA));
1466  ok(!!hRsrc, "Unable to find %s\n", wine_dbgstr_w(ResourceName));
1467  if (!hRsrc)
1468  return false;
1469 
1470  HGLOBAL hGlobal = LoadResource(hMod, hRsrc);
1471  DWORD Size = SizeofResource(hMod, hRsrc);
1472  LPVOID pData = LockResource(hGlobal);
1473 
1474  ok(Size && !!pData, "Unable to load %s\n", wine_dbgstr_w(ResourceName));
1475  if (!Size || !pData)
1476  return false;
1477 
1478  BOOL Written = write_raw_file(Filename, pData, Size);
1480  return Written;
1481 }
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
#define UnlockResource(handle)
Definition: winbase.h:3228
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
IN PVCB IN PBCB OUT PDIRENT IN USHORT IN POEM_STRING Filename
Definition: fatprocs.h:934
unsigned int BOOL
Definition: ntddk_ex.h:94
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
unsigned long DWORD
Definition: ntddk_ex.h:95
#define RT_RCDATA
Definition: pedump.c:372
static BOOL write_raw_file(const WCHAR *FileName, const void *Data, DWORD Size)
Definition: db.cpp:1444
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827

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

◆ HSDB()

static HSDB ( WINAPI pSdbInitDatabase)
static

◆ IsUserAdmin()

static BOOL IsUserAdmin ( )
static

Definition at line 1186 of file db.cpp.

1187 {
1188  BOOL Result;
1190  PSID AdministratorsGroup;
1191 
1195  0, 0, 0, 0, 0, 0,
1196  &AdministratorsGroup);
1197  if (Result)
1198  {
1199  if (!CheckTokenMembership( NULL, AdministratorsGroup, &Result))
1200  Result = FALSE;
1201  FreeSid(AdministratorsGroup);
1202  }
1203 
1204  return Result;
1205 }
BOOL WINAPI CheckTokenMembership(IN HANDLE ExistingTokenHandle, IN PSID SidToCheck, OUT PBOOL IsMember)
Definition: token.c:21
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
PVOID WINAPI FreeSid(PSID pSid)
Definition: security.c:577
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define SECURITY_NT_AUTHORITY
Definition: setypes.h:526
#define SECURITY_BUILTIN_DOMAIN_RID
Definition: setypes.h:553
#define NULL
Definition: types.h:112
#define DOMAIN_ALIAS_RID_ADMINS
Definition: setypes.h:624
SID_IDENTIFIER_AUTHORITY NtAuthority
Definition: database.c:21
BOOL WINAPI AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, PSID *pSid)
Definition: security.c:553

Referenced by test_mode_generic().

◆ 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 624 of file db.cpp.

625 {
626  TAGID attr = pSdbFindFirstTag(pdb, parent, find);
627  winetest_ok(attr != TAG_NULL, "Could not find: %x\n", find);
628  if (attr != TAG_NULL)
629  {
630  DWORD val = pSdbReadDWORDTag(pdb, attr, 0x1234567);
631  winetest_ok(val == compare, "Expected tagid %x to be 0x%x, was 0x%x\n", attr, compare, val);
632  }
633 }
Definition: bug.cpp:7
static PDB pdb
Definition: db.cpp:172
GLuint GLfloat * val
Definition: glext.h:7180
r parent
Definition: btrfs.c:2944
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: cookie.c:201
static TAGID TAGID find
Definition: db.cpp:155
#define TAG_NULL
Definition: db.cpp:54
DWORD TAGID

◆ match_guid_attr_imp()

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

Definition at line 646 of file db.cpp.

647 {
648  TAGID attr = pSdbFindFirstTag(pdb, parent, find);
649  winetest_ok(attr != TAG_NULL, "Could not find: %x\n", find);
650  if (attr != TAG_NULL)
651  {
652  GUID guid = { 0 };
653  BOOL result = pSdbReadBinaryTag(pdb, attr, (PBYTE)&guid, sizeof(guid));
654  winetest_ok(result, "expected pSdbReadBinaryTag not to fail.\n");
655  winetest_ok(IsEqualGUID(guid, *compare), "expected guids to be equal(%s:%s)\n", wine_dbgstr_guid(&guid), wine_dbgstr_guid(compare));
656  }
657 }
Definition: bug.cpp:7
static PDB pdb
Definition: db.cpp:172
GLuint64EXT * result
Definition: glext.h:11304
const char * wine_dbgstr_guid(const GUID *guid)
const GUID * guid
unsigned int BOOL
Definition: ntddk_ex.h:94
r parent
Definition: btrfs.c:2944
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)
Definition: cookie.c:201
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
static TAGID TAGID find
Definition: db.cpp:155
#define TAG_NULL
Definition: db.cpp:54
DWORD TAGID
BYTE * PBYTE
Definition: pedump.c:66

◆ match_qw_attr_imp()

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

Definition at line 635 of file db.cpp.

636 {
637  TAGID attr = pSdbFindFirstTag(pdb, parent, find);
638  winetest_ok(attr != TAG_NULL, "Could not find: %x\n", find);
639  if (attr != TAG_NULL)
640  {
641  QWORD val = pSdbReadQWORDTag(pdb, attr, 0x123456789abcdef);
642  winetest_ok(val == compare, "Expected tagid %x to be 0x%I64x, was 0x%I64x\n", attr, compare, val);
643  }
644 }
Definition: bug.cpp:7
static PDB pdb
Definition: db.cpp:172
GLuint GLfloat * val
Definition: glext.h:7180
r parent
Definition: btrfs.c:2944
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)
UINT64 QWORD
Definition: shimdbg.c:104
Definition: cookie.c:201
static TAGID TAGID find
Definition: db.cpp:155
#define TAG_NULL
Definition: db.cpp:54
DWORD TAGID

◆ match_strw_attr_imp()

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

Definition at line 609 of file db.cpp.

610 {
611  TAGID attr = pSdbFindFirstTag(pdb, parent, find);
612  winetest_ok(attr != TAG_NULL, "Could not find: %x\n", find);
613  if (attr != TAG_NULL)
614  {
615  LPWSTR name = pSdbGetStringTagPtr(pdb, attr);
616  winetest_ok(name != NULL, "Could not convert attr to str.\n");
617  if (name)
618  {
619  winetest_ok(wcscmp(name, compare) == 0, "Expected tagid %x to be %s, was %s\n", attr, wine_dbgstr_w(compare), wine_dbgstr_w(name));
620  }
621  }
622 }
Definition: bug.cpp:7
static PDB pdb
Definition: db.cpp:172
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
r parent
Definition: btrfs.c:2944
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)
Definition: cookie.c:201
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define NULL
Definition: types.h:112
static TAGID TAGID find
Definition: db.cpp:155
Definition: name.c:38
#define TAG_NULL
Definition: db.cpp:54
DWORD TAGID
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ PDB()

static PDB ( WINAPI pSdbOpenDatabase)
static

Referenced by test_mode_generic(), and test_TagRef().

◆ PVOID()

static PVOID ( WINAPI pSdbGetBinaryTagData)
static

◆ QWORD()

static QWORD ( WINAPI pSdbReadQWORDTag)
static

◆ START_TEST()

START_TEST ( db  )

Definition at line 2087 of file db.cpp.

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

◆ 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 1091 of file db.cpp.

1092 {
1093  static const WCHAR path[] = {'t','e','s','t','_','d','b','.','s','d','b',0};
1094  TAGID root;
1095  PDB pdb;
1096  BOOL ret;
1097  DWORD ver_hi, ver_lo;
1098 
1099  test_create_db(L"test_db.sdb", g_WinVersion >= WINVER_WIN10);
1100 
1101  /* both ver_hi and ver_lo cannot be null, it'll crash. */
1102  ver_hi = ver_lo = 0x12345678;
1103  ret = pSdbGetDatabaseVersion(path, &ver_hi, &ver_lo);
1104  ok(ret, "Expected SdbGetDatabaseVersion to succeed\n");
1105  if (g_WinVersion >= WINVER_WIN10)
1106  {
1107  ok(ver_hi == 3, "Expected ver_hi to be 3, was: %d\n", ver_hi);
1108  ok(ver_lo == 0, "Expected ver_lo to be 0, was: %d\n", ver_lo);
1109  }
1110  else
1111  {
1112  ok(ver_hi == 2, "Expected ver_hi to be 2, was: %d\n", ver_hi);
1113  ok(ver_lo == 1, "Expected ver_lo to be 1, was: %d\n", ver_lo);
1114  }
1115 
1116  ver_hi = ver_lo = 0x12345678;
1117  ret = pSdbGetDatabaseVersion(NULL, &ver_hi, &ver_lo);
1118  if (g_WinVersion >= WINVER_WIN10)
1119  {
1120  ok(!ret, "Expected SdbGetDatabaseVersion to fail\n");
1121  ok(ver_hi == 0, "Expected ver_hi to be 0, was: 0x%x\n", ver_hi);
1122  ok(ver_lo == 0, "Expected ver_lo to be 0, was: 0x%x\n", ver_lo);
1123  }
1124  else
1125  {
1126  ok(ret, "Expected SdbGetDatabaseVersion to succeed\n");
1127  ok(ver_hi == 0x12345678, "Expected ver_hi to be 0x12345678, was: 0x%x\n", ver_hi);
1128  ok(ver_lo == 0x12345678, "Expected ver_lo to be 0x12345678, was: 0x%x\n", ver_lo);
1129  }
1130 
1131  ver_hi = ver_lo = 0x12345678;
1132  ret = pSdbGetDatabaseVersion(path + 1, &ver_hi, &ver_lo);
1133  if (g_WinVersion >= WINVER_WIN10)
1134  {
1135  ok(!ret, "Expected SdbGetDatabaseVersion to fail\n");
1136  ok(ver_hi == 0, "Expected ver_hi to be 0, was: 0x%x\n", ver_hi);
1137  ok(ver_lo == 0, "Expected ver_lo to be 0, was: 0x%x\n", ver_lo);
1138  }
1139  else
1140  {
1141  ok(ret, "Expected SdbGetDatabaseVersion to succeed\n");
1142  ok(ver_hi == 0x12345678, "Expected ver_hi to be 0x12345678, was: 0x%x\n", ver_hi);
1143  ok(ver_lo == 0x12345678, "Expected ver_lo to be 0x12345678, was: 0x%x\n", ver_lo);
1144  }
1145 
1146  pdb = pSdbOpenDatabase(path, DOS_PATH);
1147  ok(pdb != NULL, "unexpected NULL handle\n");
1148 
1149  root = pSdbFindFirstTag(pdb, TAGID_ROOT, TAG_DATABASE);
1150  ok(root != TAGID_NULL, "expected to find a root tag\n");
1151  if (root != TAGID_NULL)
1152  {
1153  TAGID tagLayer = pSdbFindFirstTag(pdb, root, TAG_LAYER);
1154  TAGID tagAlt = pSdbFindFirstNamedTag(pdb, root, TAG_LAYER, TAG_NAME, L"TestNewMode");
1155  TAGID tagAlt2 = pSdbFindFirstNamedTag(pdb, root, TAG_LAYER, TAG_NAME, L"TESTNEWMODE");
1156  TAGID tagAlt3 = pSdbFindFirstNamedTag(pdb, root, TAG_LAYER, TAG_NAME, L"testnewmode");
1157  ok_hex(tagLayer, (int)tagAlt);
1158  ok_hex(tagLayer, (int)tagAlt2);
1159  ok_hex(tagLayer, (int)tagAlt3);
1161  check_db_layer(pdb, tagLayer);
1164  }
1166 
1167  pSdbCloseDatabase(pdb);
1168  DeleteFileA("test_db.sdb");
1169 }
static PDB pdb
Definition: db.cpp:172
#define test_create_db
#define TAG_DATABASE
Definition: db.cpp:85
static void check_db_exes(PDB pdb, TAGID root)
Definition: db.cpp:943
static void check_db_properties(PDB pdb, TAGID root)
Definition: db.cpp:668
#define ok_hex(expression, result)
Definition: atltest.h:94
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WINVER_WIN10
static void check_db_layer(PDB pdb, TAGID layer)
Definition: db.cpp:698
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
static DWORD g_WinVersion
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define DOS_PATH
Definition: db.cpp:32
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
static void check_db_apphelp(PDB pdb, TAGID root)
Definition: db.cpp:1009
static const WCHAR L[]
Definition: oid.c:1250
static void test_GetDatabaseInformation(PDB pdb)
Definition: db.cpp:1034
#define TAGID_NULL
Definition: db.cpp:38
#define ok(value,...)
Definition: atltest.h:57
#define TAG_LAYER
Definition: db.cpp:90
#define TAG_NAME
Definition: db.cpp:98
#define NULL
Definition: types.h:112
#define TAGID_ROOT
Definition: db.cpp:39
DWORD TAGID
static TAGID root
Definition: db.cpp:155

Referenced by START_TEST().

◆ test_Data()

static void test_Data ( void  )
static

Definition at line 1918 of file db.cpp.

1919 {
1920  WCHAR workdir[MAX_PATH], dbpath[MAX_PATH];
1921  BOOL ret;
1922  HSDB hsdb;
1923 
1925  ok(ret, "GetTempPathW error: %d\n", GetLastError());
1926  lstrcatW(workdir, L"apphelp_test");
1927 
1929  ok(ret, "CreateDirectoryW error: %d\n", GetLastError());
1930 
1931  /* SdbInitDatabase needs an nt-path */
1932  swprintf(dbpath, L"\\??\\%s\\test.sdb", workdir);
1933 
1934  if (extract_resource(dbpath + 4, MAKEINTRESOURCEW(101)))
1935  {
1936  hsdb = pSdbInitDatabase(HID_DATABASE_FULLPATH, dbpath);
1937 
1938  ok(hsdb != NULL, "Expected a valid database handle\n");
1939 
1940  if (!hsdb)
1941  {
1942  skip("SdbInitDatabase not implemented?\n");
1943  }
1944  else
1945  {
1946  test_DataTags(hsdb);
1947  pSdbReleaseDatabase(hsdb);
1948  }
1949  }
1950  else
1951  {
1952  ok(0, "Unable to extract database\n");
1953  }
1954 
1955  DeleteFileW(dbpath + 4);
1956 
1958  ok(ret, "RemoveDirectoryW error: %d\n", GetLastError());
1959 }
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
static bool extract_resource(const WCHAR *Filename, LPCWSTR ResourceName)
Definition: db.cpp:1462
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define swprintf
Definition: precomp.h:40
#define HID_DATABASE_FULLPATH
Definition: db.cpp:33
Definition: apphelp.h:30
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2079
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
BOOL WINAPI RemoveDirectoryW(IN LPCWSTR lpPathName)
Definition: dir.c:732
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
static char workdir[MAX_PATH]
Definition: batch.c:26
#define MAX_PATH
Definition: compat.h:34
int ret
static const WCHAR L[]
Definition: oid.c:1250
static void test_DataTags(HSDB hsdb)
Definition: db.cpp:1739
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define skip(...)
Definition: atltest.h:64
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274

Referenced by START_TEST().

◆ test_DataTags()

static void test_DataTags ( HSDB  hsdb)
static

Definition at line 1739 of file db.cpp.

1740 {
1741  PDB pdb = NULL;
1742  TAGID db = TAGID_NULL, layer, exe;
1743  TAGREF trData;
1744  BYTE Buffer[1024];
1745  DWORD dwBufferSize, dwDataType, dwRet;
1746  TAGID tiData;
1747 
1748  BOOL ret = pSdbTagRefToTagID(hsdb, TAGID_ROOT, &pdb, NULL);
1749 
1750  ok(ret != FALSE, "Expected ret to be TRUE, was: %d\n", ret);
1751  ok(pdb != NULL, "Expected pdb to be valid\n");
1752 
1753  if (pdb == NULL)
1754  {
1755  skip("Cannot run tests without pdb\n");
1756  return;
1757  }
1758 
1759  db = pSdbFindFirstTag(pdb, TAGID_ROOT, TAG_DATABASE);
1760  ok(db != NULL, "Expected db to be valid\n");
1761  if (db == TAGID_NULL)
1762  {
1763  skip("Cannot run tests without db\n");
1764  return;
1765  }
1766 
1767  layer = pSdbFindFirstNamedTag(pdb, db, TAG_LAYER, TAG_NAME, L"DATA_LAYER");
1768  ok(layer != NULL, "Expected layer to be valid\n");
1769  if (layer == TAGID_NULL)
1770  {
1771  skip("Cannot run tests without layer\n");
1772  return;
1773  }
1774 
1775  memset(Buffer, 0xaa, sizeof(Buffer));
1776  dwBufferSize = sizeof(Buffer);
1777  dwDataType = 0x12345;
1778  tiData = 0x111111;
1779  dwRet = pSdbQueryDataExTagID(pdb, layer, L"TESTDATA1", &dwDataType, Buffer, &dwBufferSize, &tiData);
1780  ok_hex(dwRet, ERROR_SUCCESS);
1781  ok_hex(dwDataType, REG_DWORD);
1782  ok_hex(dwBufferSize, sizeof(DWORD));
1783  ok_hex(*(DWORD*)Buffer, 3333);
1784  ok(tiData != NULL && tiData != 0x111111, "Expected tiData, got NULL\n");
1785  ok_hex(pSdbGetTagFromTagID(pdb, tiData), TAG_DATA);
1786 
1787  memset(Buffer, 0xaa, sizeof(Buffer));
1788  dwBufferSize = sizeof(Buffer);
1789  dwRet = pSdbQueryDataExTagID(pdb, layer, L"TESTDATA1", NULL, Buffer, &dwBufferSize, NULL);
1790  ok_hex(dwRet, ERROR_SUCCESS);
1791  ok_hex(dwBufferSize, sizeof(DWORD));
1792  ok_hex(*(DWORD*)Buffer, 3333);
1793 
1795  {
1796  memset(Buffer, 0xaa, sizeof(Buffer));
1797  dwBufferSize = sizeof(Buffer);
1798  dwRet = pSdbQueryDataExTagID(pdb, layer, L"TESTDATA1", NULL, Buffer, NULL, NULL);
1800  ok_hex(*(DWORD*)Buffer, (int)0xaaaaaaaa);
1801  }
1802 
1803  memset(Buffer, 0xaa, sizeof(Buffer));
1804  dwBufferSize = 1;
1805  dwRet = pSdbQueryDataExTagID(pdb, layer, L"TESTDATA1", NULL, Buffer, &dwBufferSize, NULL);
1807  ok_hex(dwBufferSize, sizeof(DWORD));
1808  ok_hex(*(DWORD*)Buffer, (int)0xaaaaaaaa);
1809 
1810  memset(Buffer, 0xaa, sizeof(Buffer));
1811  dwBufferSize = sizeof(Buffer);
1812  dwRet = pSdbQueryDataExTagID(pdb, layer, L"TESTDATA1", NULL, NULL, &dwBufferSize, NULL);
1814  ok_hex(dwBufferSize, sizeof(DWORD));
1815  ok_hex(*(DWORD*)Buffer, (int)0xaaaaaaaa);
1816 
1817  memset(Buffer, 0xaa, sizeof(Buffer));
1818  dwBufferSize = sizeof(Buffer);
1819  dwRet = pSdbQueryDataExTagID(pdb, TAGID_NULL, L"TESTDATA1", NULL, Buffer, &dwBufferSize, NULL);
1820  ok_hex(dwRet, ERROR_NOT_FOUND);
1821  ok_hex(dwBufferSize, sizeof(Buffer));
1822  ok_hex(*(DWORD*)Buffer, (int)0xaaaaaaaa);
1823 
1824  memset(Buffer, 0xaa, sizeof(Buffer));
1825  dwBufferSize = sizeof(Buffer);
1826  dwDataType = 0x12345;
1827  tiData = 0x111111;
1828  dwRet = pSdbQueryDataExTagID(pdb, layer, L"TESTDATA2", &dwDataType, Buffer, &dwBufferSize, &tiData);
1829  ok_hex(dwRet, ERROR_SUCCESS);
1830  ok_hex(dwDataType, REG_QWORD);
1831  ok_hex(dwBufferSize, sizeof(QWORD));
1832  ok(*(QWORD*)Buffer == 4294967295ull, "unexpected value 0x%I64x, expected 4294967295\n", *(QWORD*)Buffer);
1833  ok(tiData != NULL && tiData != 0x111111, "Expected tiData, got NULL\n");
1834  ok_hex(pSdbGetTagFromTagID(pdb, tiData), TAG_DATA);
1835 
1836  /* Not case sensitive */
1837  memset(Buffer, 0xaa, sizeof(Buffer));
1838  dwBufferSize = sizeof(Buffer);
1839  dwDataType = 0x12345;
1840  tiData = 0x111111;
1841  dwRet = pSdbQueryDataExTagID(pdb, layer, L"TESTDATA3", &dwDataType, Buffer, &dwBufferSize, &tiData);
1842  ok_hex(dwRet, ERROR_SUCCESS);
1843  ok_hex(dwDataType, REG_SZ);
1844  ok_hex(dwBufferSize, (int)((wcslen(L"Test string")+1) * sizeof(WCHAR)));
1845  Buffer[_countof(Buffer)-1] = L'\0';
1846  ok_wstr(((WCHAR*)Buffer), L"Test string");
1847  ok(tiData != NULL && tiData != 0x111111, "Expected tiData, got NULL\n");
1848  ok_hex(pSdbGetTagFromTagID(pdb, tiData), TAG_DATA);
1849 
1850  /* Show that SdbQueryDataEx behaves the same */
1851  memset(Buffer, 0xaa, sizeof(Buffer));
1852  dwBufferSize = sizeof(Buffer);
1853  dwDataType = 0x12345;
1854  trData = 0x111111;
1855  dwRet = pSdbQueryDataEx(hsdb, layer, L"TESTDATA1", &dwDataType, Buffer, &dwBufferSize, &trData);
1856  ok_hex(dwRet, ERROR_SUCCESS);
1857  ok_hex(dwDataType, REG_DWORD);
1858  ok_hex(dwBufferSize, sizeof(DWORD));
1859  ok_hex(*(DWORD*)Buffer, 3333);
1860  ok(trData != NULL && trData != 0x111111, "Expected trData, got NULL\n");
1861 
1862  /* And SdbQueryData as well */
1863  memset(Buffer, 0xaa, sizeof(Buffer));
1864  dwBufferSize = sizeof(Buffer);
1865  dwDataType = 0x12345;
1866  dwRet = pSdbQueryData(hsdb, layer, L"TESTDATA1", &dwDataType, Buffer, &dwBufferSize);
1867  ok_hex(dwRet, ERROR_SUCCESS);
1868  ok_hex(dwDataType, REG_DWORD);
1869  ok_hex(dwBufferSize, sizeof(DWORD));
1870  ok_hex(*(DWORD*)Buffer, 3333);
1871 
1872  exe = pSdbFindFirstNamedTag(pdb, db, TAG_EXE, TAG_NAME, L"test_match0.exe");
1873  ok(exe != NULL, "Expected exe to be valid\n");
1874  if (exe == TAGID_NULL)
1875  {
1876  skip("Cannot run tests without exe\n");
1877  return;
1878  }
1879 
1880  memset(Buffer, 0xaa, sizeof(Buffer));
1881  dwBufferSize = sizeof(Buffer);
1882  dwDataType = 0x12345;
1883  tiData = 0x111111;
1884  dwRet = pSdbQueryDataExTagID(pdb, exe, L"TESTDATA1", &dwDataType, Buffer, &dwBufferSize, &tiData);
1885  ok_hex(dwRet, ERROR_NOT_FOUND);
1886  ok_hex(dwDataType, 0x12345);
1887  ok_hex(dwBufferSize, sizeof(Buffer));
1888  ok_hex(*(DWORD*)Buffer, (int)0xaaaaaaaa);
1889  ok(tiData == 0x111111, "Expected 0x111111, got 0x%x\n", tiData);
1890 
1891  /* Show that SdbQueryDataEx behaves the same */
1892  memset(Buffer, 0xaa, sizeof(Buffer));
1893  dwBufferSize = sizeof(Buffer);
1894  dwDataType = 0x12345;
1895  trData = 0x111111;
1896  dwRet = pSdbQueryDataEx(hsdb, exe, L"TESTDATA1", &dwDataType, Buffer, &dwBufferSize, &trData);
1897  ok_hex(dwRet, ERROR_NOT_FOUND);
1898  ok_hex(dwDataType, 0x12345);
1899  ok_hex(dwBufferSize, sizeof(Buffer));
1900  ok_hex(*(DWORD*)Buffer, (int)0xaaaaaaaa);
1902  ok(trData == 0, "Expected 0, got 0x%x\n", trData);
1903  else
1904  ok(trData == 0x111111, "Expected 0x111111, got 0x%x\n", trData);
1905 
1906  /* And SdbQueryData as well */
1907  memset(Buffer, 0xaa, sizeof(Buffer));
1908  dwBufferSize = sizeof(Buffer);
1909  dwDataType = 0x12345;
1910  dwRet = pSdbQueryData(hsdb, exe, L"TESTDATA1", &dwDataType, Buffer, &dwBufferSize);
1911  ok_hex(dwRet, ERROR_NOT_FOUND);
1912  ok_hex(dwDataType, 0x12345);
1913  ok_hex(dwBufferSize, sizeof(Buffer));
1914  ok_hex(*(DWORD*)Buffer, (int)0xaaaaaaaa);
1915 }
DWORD TAGREF
static PDB pdb
Definition: db.cpp:172
#define ERROR_SUCCESS
Definition: deptool.c:10
#define _WIN32_WINNT_WS03
Definition: sdkddkver.h:23
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define TAG_DATABASE
Definition: db.cpp:85
#define ok_hex(expression, result)
Definition: atltest.h:94
#define TAG_EXE
Definition: db.cpp:87
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: bufpool.h:45
static DWORD g_WinVersion
GLenum GLuint GLint GLint layer
Definition: glext.h:7007
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
UINT64 QWORD
Definition: shimdbg.c:104
unsigned long DWORD
Definition: ntddk_ex.h:95
#define TAG_DATA
Definition: db.cpp:93
int ret
static const WCHAR L[]
Definition: oid.c:1250
#define ok_wstr(x, y)
Definition: atltest.h:130
unsigned char BYTE
Definition: xxhash.c:193
#define TAGID_NULL
Definition: db.cpp:38
#define ok(value,...)
Definition: atltest.h:57
#define TAG_LAYER
Definition: db.cpp:90
#define TAG_NAME
Definition: db.cpp:98
#define NULL
Definition: types.h:112
#define TAGID_ROOT
Definition: db.cpp:39
#define ERROR_NOT_FOUND
Definition: winerror.h:690
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define skip(...)
Definition: atltest.h:64
#define REG_QWORD
Definition: sdbapi.c:597
DWORD TAGID
#define memset(x, y, z)
Definition: compat.h:39
#define REG_DWORD
Definition: sdbapi.c:596
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define REG_SZ
Definition: layer.c:22

Referenced by test_Data().

◆ test_GetDatabaseInformation()

static void test_GetDatabaseInformation ( PDB  pdb)
static

Definition at line 1034 of file db.cpp.

1035 {
1036  PDB_INFORMATION pInfo;
1037  BOOL fResult;
1038 
1039  if (!pSdbGetDatabaseInformation || !pSdbFreeDatabaseInformation)
1040  {
1041  skip("GetDatabaseInformation or SdbFreeDatabaseInformation not found\n");
1042  return;
1043  }
1044 
1045  _SEH2_TRY
1046  {
1047  pSdbFreeDatabaseInformation(NULL);
1048  }
1050  {
1051  ok(0, "SdbFreeDatabaseInformation did not handle a NULL pointer very gracefully.\n");
1052  }
1053  _SEH2_END;
1054 
1055 
1056  pInfo = (PDB_INFORMATION)malloc(sizeof(*pInfo) * 4);
1057  memset(pInfo, 0xDE, sizeof(*pInfo) * 2);
1058 
1059  fResult = pSdbGetDatabaseInformation(pdb, pInfo);
1060  ok(fResult, "SdbGetDatabaseInformation failed\n");
1061  if (fResult)
1062  {
1063  ok_int(pInfo->dwSomething, 1);
1064  ok(IsEqualGUID(GUID_DATABASE_TEST, pInfo->Id), "expected guids to be equal(%s:%s)\n",
1065  wine_dbgstr_guid(&GUID_DATABASE_TEST), wine_dbgstr_guid(&pInfo->Id));
1066  ok(wcscmp(pInfo->Description, L"apphelp_test1") == 0,
1067  "Expected pInfo->Description to be 'apphelp_test1', was %s\n", wine_dbgstr_w(pInfo->Description));
1068 
1069  /* Struct is slightly bigger on some Win10, and the DB version nr is different on all */
1070  if (g_WinVersion >= WINVER_WIN10)
1071  {
1072  ok(pInfo->dwMajor == 3, "Expected pInfo->dwMajor to be 3, was: %d\n", pInfo->dwMajor);
1073  ok(pInfo->dwMinor == 0, "Expected pInfo->dwMinor to be 0, was: %d\n", pInfo->dwMinor);
1074 
1075  ok(pInfo[1].dwSomething == 4 || pInfo[1].dwSomething == 0xdededede, "Something amiss: 0x%x\n", pInfo[1].dwSomething);
1076  ok(pInfo[1].dwMajor == 0xdededede, "Cookie2 corrupt: 0x%x\n", pInfo[1].dwMajor);
1077  }
1078  else
1079  {
1080  ok(pInfo->dwMajor == 2, "Expected pInfo->dwMajor to be 2, was: %d\n", pInfo->dwMajor);
1081  ok(pInfo->dwMinor == 1, "Expected pInfo->dwMinor to be 1, was: %d\n", pInfo->dwMinor);
1082 
1083  ok(pInfo[1].dwSomething == 0xdededede, "Cookie1 corrupt: 0x%x\n", pInfo[1].dwSomething);
1084  ok(pInfo[1].dwMajor == 0xdededede, "Cookie2 corrupt: 0x%x\n", pInfo[1].dwMajor);
1085  }
1086 
1087  }
1088  free(pInfo);
1089 }
struct _DB_INFORMATION * PDB_INFORMATION
static PDB pdb
Definition: db.cpp:172
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define free
Definition: debug_ros.c:5
const char * wine_dbgstr_guid(const GUID *guid)
LPCWSTR Description
Definition: apphelp.h:86
DWORD dwSomething
Definition: db.cpp:127
DWORD dwMajor
Definition: apphelp.h:84
_SEH2_TRY
Definition: create.c:4226
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WINVER_WIN10
#define ok_int(expression, result)
Definition: atltest.h:134
static DWORD g_WinVersion
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
static const WCHAR L[]
Definition: oid.c:1250
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_SEH2_END
Definition: create.c:4400
DWORD dwMinor
Definition: apphelp.h:85
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define skip(...)
Definition: atltest.h:64
#define malloc
Definition: debug_ros.c:4
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define memset(x, y, z)
Definition: compat.h:39

Referenced by test_CheckDatabaseManually().

◆ test_GetDatabaseInformationEmpty()

static void test_GetDatabaseInformationEmpty ( PDB  pdb)
static

Definition at line 191 of file db.cpp.

192 {
193  PDB_INFORMATION pInfo;
194  BOOL fResult;
195 
196  if (!pSdbGetDatabaseInformation || !pSdbFreeDatabaseInformation)
197  {
198  skip("GetDatabaseInformation or SdbFreeDatabaseInformation not found\n");
199  return;
200  }
201 
202  pInfo = (PDB_INFORMATION)malloc(sizeof(*pInfo) * 4);
203  memset(pInfo, 0xDE, sizeof(*pInfo) * 2);
204 
205  fResult = pSdbGetDatabaseInformation(pdb, pInfo);
206  ok(fResult, "SdbGetDatabaseInformation failed\n");
207  if (fResult)
208  {
209  ok_int(pInfo->dwSomething, 0);
210  ok(IsEqualGUID(GUID_NULL, pInfo->Id), "expected guid to be empty(%s)\n", wine_dbgstr_guid(&pInfo->Id));
211  ok(pInfo->Description == NULL, "Expected pInfo->Description to be NULL, was %s\n", wine_dbgstr_w(pInfo->Description));
212 
213  /* Struct is slightly bigger on some Win10, and the DB version nr is different on all */
214  if (g_WinVersion >= WINVER_WIN10)
215  {
216  ok(pInfo->dwMajor == 3, "Expected pInfo->dwMajor to be 3, was: %d\n", pInfo->dwMajor);
217  ok(pInfo->dwMinor == 0, "Expected pInfo->dwMinor to be 0, was: %d\n", pInfo->dwMinor);
218 
219  ok(pInfo[1].dwSomething == 0 || pInfo[1].dwSomething == 0xdededede, "Something amiss: 0x%x\n", pInfo[1].dwSomething);
220  ok(pInfo[1].dwMajor == 0xdededede, "Cookie2 corrupt: 0x%x\n", pInfo[1].dwMajor);
221  }
222  else
223  {
224  ok(pInfo->dwMajor == 2, "Expected pInfo->dwMajor to be 2, was: %d\n", pInfo->dwMajor);
226  ok(pInfo->dwMinor == 1, "Expected pInfo->dwMinor to be 1, was: %d\n", pInfo->dwMinor);
227  else
228  ok(pInfo->dwMinor >= 190915 && pInfo->dwMinor <= 191300,
229  "Expected pInfo->dwMinor to be between 190915 and 191300, was: %d\n", pInfo->dwMinor);
230 
231  ok(pInfo[1].dwSomething == 0xdededede, "Cookie1 corrupt: 0x%x\n", pInfo[1].dwSomething);
232  ok(pInfo[1].dwMajor == 0xdededede, "Cookie2 corrupt: 0x%x\n", pInfo[1].dwMajor);
233  }
234 
235  }
236  free(pInfo);
237 }
struct _DB_INFORMATION * PDB_INFORMATION
static PDB pdb
Definition: db.cpp:172
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define free
Definition: debug_ros.c:5
const char * wine_dbgstr_guid(const GUID *guid)
LPCWSTR Description
Definition: apphelp.h:86
DWORD dwSomething
Definition: db.cpp:127
DWORD dwMajor
Definition: apphelp.h:84
#define _WIN32_WINNT_VISTA
Definition: sdkddkver.h:25
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WINVER_WIN10
#define ok_int(expression, result)
Definition: atltest.h:134
static DWORD g_WinVersion
#define GUID_NULL
Definition: ks.h:106
DWORD dwMinor
Definition: apphelp.h:85
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define skip(...)
Definition: atltest.h:64
#define malloc
Definition: debug_ros.c:4
#define memset(x, y, z)
Definition: compat.h:39

Referenced by test_Sdb().

◆ test_IndexKeyFromString()

static void test_IndexKeyFromString ( void  )
static

Definition at line 1974 of file db.cpp.

1975 {
1976 #if 0
1977  static WCHAR tmp[] = { 0xabba, 0xbcde, 0x2020, 0x20, 0x4444, 0 };
1978  static WCHAR tmp2[] = { 0xabba, 0xbcde, 0x20, 0x4444, 0 };
1979  static WCHAR tmp3[] = { 0x20, 0xbcde, 0x4041, 0x4444, 0 };
1980  static WCHAR tmp4[] = { 0x20, 0xbcde, 0x4041, 0x4444, 0x4444, 0 };
1981  static WCHAR tmp5[] = { 0x2020, 0xbcde, 0x4041, 0x4444, 0x4444, 0 };
1982  static WCHAR tmp6 [] = { 0x20, 0xbcde, 0x4041, 0x4444, 0x4444, 0x4444, 0};
1983  static WCHAR tmp7 [] = { 0xbcde, 0x4041, 0x4444, 0x4444, 0x4444, 0x4444, 0x4444, 0x4444, 0x4444, 0};
1984  static WCHAR tmp8 [] = { 0xbc00, 0x4041, 0x4444, 0x4444, 0x4444, 0x4444, 0x4444, 0x4444, 0x4444, 0};
1985 #endif
1986 
1987 #if 0
1988  /* This crashes. */
1989  pSdbMakeIndexKeyFromString(NULL);
1990 #endif
1991 
1992  expect_indexA("", 0x0000000000000000);
1993  expect_indexA("a", 0x4100000000000000);
1994  expect_indexA("aa", 0x4141000000000000);
1995  expect_indexA("aaa", 0x4141410000000000);
1996  expect_indexA("aaaa", 0x4141414100000000);
1997  expect_indexA("aaaaa", 0x4141414141000000);
1998  expect_indexA("aaaaaa", 0x4141414141410000);
1999  expect_indexA("aaaaaaa", 0x4141414141414100);
2000  expect_indexA("aaaaaaaa", 0x4141414141414141);
2001  expect_indexA("aaa aaaaa", 0x4141412041414141);
2002  /* Does not change */
2003  expect_indexA("aaaaaaaaa", 0x4141414141414141);
2004  expect_indexA("aaaaaaaab", 0x4141414141414141);
2005  expect_indexA("aaaaaaaac", 0x4141414141414141);
2006  expect_indexA("aaaaaaaaF", 0x4141414141414141);
2007  /* Upcase */
2008  expect_indexA("AAAAAAAA", 0x4141414141414141);
2009  expect_indexA("ABABABAB", 0x4142414241424142);
2010  expect_indexA("ABABABABZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ", 0x4142414241424142);
2011 
2012 #if 0
2013  /* These fail, but is that because the codepoints are too weird, or because the func is not correct? */
2014  result = pSdbMakeIndexKeyFromString(tmp);
2015  ok(result == 0xbaabdebc20200000, "Expected %s to result in %s, was: %s\n", wine_dbgstr_w(tmp),
2016  wine_dbgstr_longlong(0xbaabdebc20200000), wine_dbgstr_longlong(result));
2017 
2018  result = pSdbMakeIndexKeyFromString(tmp2);
2019  ok(result == 0xbaabdebc00000000, "Expected %s to result in %s, was: %s\n", wine_dbgstr_w(tmp2),
2020  wine_dbgstr_longlong(0xbaabdebc00000000), wine_dbgstr_longlong(result));
2021 
2022  result = pSdbMakeIndexKeyFromString(tmp3);
2023  ok(result == 0x20debc4140000000, "Expected %s to result in %s, was: %s\n", wine_dbgstr_w(tmp3),
2024  wine_dbgstr_longlong(0x20debc4140000000), wine_dbgstr_longlong(result));
2025 
2026  result = pSdbMakeIndexKeyFromString(tmp4);
2027  ok(result == 0x20debc4140000000, "Expected %s to result in %s, was: %s\n", wine_dbgstr_w(tmp4),
2028  wine_dbgstr_longlong(0x20debc4140000000), wine_dbgstr_longlong(result));
2029 
2030  result = pSdbMakeIndexKeyFromString(tmp5);
2031  ok(result == 0x2020debc41400000, "Expected %s to result in %s, was: %s\n", wine_dbgstr_w(tmp5),
2032  wine_dbgstr_longlong(0x2020debc41400000), wine_dbgstr_longlong(result));
2033 
2034  result = pSdbMakeIndexKeyFromString(tmp6);
2035  ok(result == 0x20debc4140444400, "Expected %s to result in %s, was: %s\n", wine_dbgstr_w(tmp6),
2036  wine_dbgstr_longlong(0x20debc4140444400), wine_dbgstr_longlong(result));
2037 
2038  result = pSdbMakeIndexKeyFromString(tmp7);
2039  ok(result == 0xdebc414044444444, "Expected %s to result in %s, was: %s\n", wine_dbgstr_w(tmp7),
2040  wine_dbgstr_longlong(0xdebc414044444444), wine_dbgstr_longlong(result));
2041 
2042  result = pSdbMakeIndexKeyFromString(tmp8);
2043  ok(result == 0xbc414044444444, "Expected %s to result in %s, was: %s\n", wine_dbgstr_w(tmp8),
2044  wine_dbgstr_longlong(0xbc414044444444), wine_dbgstr_longlong(result));
2045 #endif
2046 }
GLuint64EXT * result
Definition: glext.h:11304
#define expect_indexA
Definition: db.cpp:1972
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49

Referenced by START_TEST().

◆ test_is_testdb()

static void test_is_testdb ( PDB  pdb)
static

Definition at line 1171 of file db.cpp.

1172 {
1173  if (pdb)
1174  {
1175  GUID guid;
1176  memset(&guid, 0, sizeof(guid));
1177  ok(pSdbGetDatabaseID(pdb, &guid), "expected SdbGetDatabaseID not to fail.\n");
1178  ok(IsEqualGUID(guid, GUID_DATABASE_TEST), "Expected SdbGetDatabaseID to return the test db GUID, was: %s\n", wine_dbgstr_guid(&guid));
1179  }
1180  else
1181  {
1182  skip("Not checking DB GUID, received a null pdb\n");
1183  }
1184 }
static PDB pdb
Definition: db.cpp:172
const char * wine_dbgstr_guid(const GUID *guid)
const GUID * guid
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define skip(...)
Definition: atltest.h:64
#define memset(x, y, z)
Definition: compat.h:39

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 1484 of file db.cpp.

1485 {
1487  PWCHAR Vendor, AppName, TestName;
1488  SDBQUERYRESULT_T query;
1489  TAGID dbtag, exetag, tagid;
1490  BOOL ret, Succeed;
1491  PDB pdb;
1492 
1493  memset(&query, 0xab, sizeof(query));
1494 
1495  ret = pSdbTagRefToTagID(hsdb, 0, &pdb, &tagid);
1496  ok(pdb != NULL && pdb != (PDB)0x12345678, "Expected pdb to be set to a valid pdb, was: %p\n", pdb);
1497 
1498  dbtag = pSdbFindFirstTag(pdb, TAGID_ROOT, TAG_DATABASE);
1499  ok(dbtag != TAGID_NULL, "Expected to get a valid TAG_DATABASE\n");
1500 
1501  for (exetag = pSdbFindFirstTag(pdb, dbtag, TAG_EXE); exetag; exetag = pSdbFindNextTag(pdb, dbtag, exetag))
1502  {
1503  tagid = pSdbFindFirstTag(pdb, exetag, TAG_VENDOR);
1504  Vendor = pSdbGetStringTagPtr(pdb, tagid);
1505  if (!Vendor)
1506  continue;
1507  Succeed = !wcsicmp(Vendor, L"Succeed");
1508  if (!Succeed && wcsicmp(Vendor, L"Fail"))
1509  continue;
1510  tagid = pSdbFindFirstTag(pdb, exetag, TAG_APP_NAME);
1511  AppName = pSdbGetStringTagPtr(pdb, tagid);
1512  if (!AppName)
1513  continue;
1514 
1515  tagid = pSdbFindFirstTag(pdb, exetag, TAG_NAME);
1516  TestName = pSdbGetStringTagPtr(pdb, tagid);
1517  if (!TestName)
1518  continue;
1519 
1520  swprintf(exename, L"%s\\%s", workdir, AppName);
1522 
1523  ret = pSdbGetMatchingExe(hsdb, exename, NULL, NULL, 0, (SDBQUERYRESULT_VISTA*)&query);
1524  DWORD exe_count = Succeed ? 1 : 0;
1525 
1526  if (Succeed && !ret && g_WinVersion == _WIN32_WINNT_WS03)
1527  {
1528  skip("As long as we do not have indexes, we will hit a bug in W2k3\n");
1529 #if 0
1530 [Info][SdbGetIndex ] index 0x7007(0x600b) was not found in the index table
1531 [Info][SdbGetIndex ] index 0x7007(0x6001) was not found in the index table
1532 [Info][SdbpSearchDB ] Searching database with no index.
1533 [Err ][SdbpSearchDB ] No DATABASE tag found.
1534 #endif
1535  }
1536  else
1537  {
1538  if (Succeed)
1539  ok(ret, "SdbGetMatchingExe should not fail for %s.\n", wine_dbgstr_w(TestName));
1540  else
1541  ok(!ret, "SdbGetMatchingExe should not succeed for %s.\n", wine_dbgstr_w(TestName));
1542 
1543  ok(query.dwExeCount == exe_count, "Expected dwExeCount to be %d, was %d for %s\n", exe_count, query.dwExeCount, wine_dbgstr_w(TestName));
1544  }
1546  }
1547 }
static PDB pdb
Definition: db.cpp:172
#define _WIN32_WINNT_WS03
Definition: sdkddkver.h:23
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define TAG_DATABASE
Definition: db.cpp:85
static CHAR AppName[MAX_PATH]
Definition: dem.c:252
Definition: ecma_167.h:138
#define TAG_APP_NAME
Definition: db.cpp:101
uint16_t * PWCHAR
Definition: typedefs.h:56
#define swprintf
Definition: precomp.h:40
#define TAG_VENDOR
Definition: db.cpp:100
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
#define TAG_EXE
Definition: db.cpp:87
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
GLuint index
Definition: glext.h:6031
static DWORD g_WinVersion
static WCHAR no[MAX_STRING_RESOURCE_LEN]
Definition: object.c:2340
__wchar_t WCHAR
Definition: xmlstorage.h:180
static char workdir[MAX_PATH]
Definition: batch.c:26
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define wcsicmp
Definition: compat.h:15
int ret
static const WCHAR L[]
Definition: oid.c:1250
#define test_create_exe
#define TAGID_NULL
Definition: db.cpp:38
GLuint in
Definition: glext.h:9616
#define ok(value,...)
Definition: atltest.h:57
#define TAG_NAME
Definition: db.cpp:98
#define NULL
Definition: types.h:112
#define TAGID_ROOT
Definition: db.cpp:39
#define skip(...)
Definition: atltest.h:64
DWORD TAGID
static char * exename
Definition: process.c:101
#define memset(x, y, z)
Definition: compat.h:39
GLenum query
Definition: glext.h:7781

◆ test_MatchApplications()

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

Definition at line 1403 of file db.cpp.

1404 {
1405  WCHAR workdir[MAX_PATH], dbpath[MAX_PATH];
1406  BOOL ret;
1407  HSDB hsdb;
1408 
1410  ok(ret, "GetTempPathW error: %d\n", GetLastError());
1411  wcscat(workdir, L"apphelp_test");
1412 
1414  ok(ret, "CreateDirectoryW error: %d\n", GetLastError());
1415 
1416  /* SdbInitDatabase needs an nt-path */
1417  swprintf(dbpath, L"\\??\\%s\\test.sdb", workdir);
1418 
1419  test_create_db(dbpath + 4, g_WinVersion >= WINVER_WIN10);
1420 
1421  hsdb = pSdbInitDatabase(HID_DATABASE_FULLPATH, dbpath);
1422 
1423  ok(hsdb != NULL, "Expected a valid database handle\n");
1424 
1425  if (!hsdb)
1426  {
1427  skip("SdbInitDatabase not implemented?\n");
1428  }
1429  else
1430  {
1431  /* now that our enviroment is setup, let's go ahead and run the actual tests.. */
1432  size_t n;
1433  for (n = 0; n < _countof(test_exedata); ++n)
1434  test_mode_generic<SDBQUERYRESULT_T>(workdir, hsdb, n);
1435  pSdbReleaseDatabase(hsdb);
1436  }
1437 
1438  DeleteFileW(dbpath + 4);
1439 
1441  ok(ret, "RemoveDirectoryW error: %d\n", GetLastError());
1442 }
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
#define test_create_db
GLdouble n
Definition: glext.h:7729
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define swprintf
Definition: precomp.h:40
#define HID_DATABASE_FULLPATH
Definition: db.cpp:33
Definition: apphelp.h:30
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2079
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WINVER_WIN10
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
BOOL WINAPI RemoveDirectoryW(IN LPCWSTR lpPathName)
Definition: dir.c:732
static DWORD g_WinVersion
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
static char workdir[MAX_PATH]
Definition: batch.c:26
#define MAX_PATH
Definition: compat.h:34
int ret
static const WCHAR L[]
Definition: oid.c:1250
#define ok(value,...)
Definition: atltest.h:57
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define NULL
Definition: types.h:112
#define skip(...)
Definition: atltest.h:64
static struct @1583 test_exedata[5]

◆ test_MatchApplicationsEx()

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

Definition at line 1551 of file db.cpp.

1552 {
1553  WCHAR workdir[MAX_PATH], dbpath[MAX_PATH];
1554  BOOL ret;
1555  HSDB hsdb;
1556 
1558  ok(ret, "GetTempPathW error: %d\n", GetLastError());
1559  lstrcatW(workdir, L"apphelp_test");
1560 
1562  ok(ret, "CreateDirectoryW error: %d\n", GetLastError());
1563 
1564  /* SdbInitDatabase needs an nt-path */
1565  swprintf(dbpath, L"\\??\\%s\\test.sdb", workdir);
1566 
1567  if (extract_resource(dbpath + 4, MAKEINTRESOURCEW(101)))
1568  {
1569  hsdb = pSdbInitDatabase(HID_DATABASE_FULLPATH, dbpath);
1570 
1571  ok(hsdb != NULL, "Expected a valid database handle\n");
1572 
1573  if (!hsdb)
1574  {
1575  skip("SdbInitDatabase not implemented?\n");
1576  }
1577  else
1578  {
1579  /* now that our enviroment is setup, let's go ahead and run the actual tests.. */
1580  test_match_ex<SDBQUERYRESULT_T>(workdir, hsdb);
1581  pSdbReleaseDatabase(hsdb);
1582  }
1583  }
1584  else
1585  {
1586  ok(0, "Unable to extract database\n");
1587  }
1588 
1589  DeleteFileW(dbpath + 4);
1590 
1592  ok(ret, "RemoveDirectoryW error: %d\n", GetLastError());
1593 }
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
static bool extract_resource(const WCHAR *Filename, LPCWSTR ResourceName)
Definition: db.cpp:1462
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define swprintf
Definition: precomp.h:40
#define HID_DATABASE_FULLPATH
Definition: db.cpp:33
Definition: apphelp.h:30
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2079
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
BOOL WINAPI RemoveDirectoryW(IN LPCWSTR lpPathName)
Definition: dir.c:732
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
static char workdir[MAX_PATH]
Definition: batch.c:26
#define MAX_PATH
Definition: compat.h:34
int ret
static const WCHAR L[]
Definition: oid.c:1250
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define skip(...)
Definition: atltest.h:64
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274

◆ test_mode_generic()

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

Definition at line 1223 of file db.cpp.

1224 {
1225  WCHAR exename[MAX_PATH], testfile[MAX_PATH];
1226  BOOL ret;
1227  SDBQUERYRESULT_T query;
1228  PDB pdb;
1229  TAGID tagid;
1230  TAGREF trApphelp;
1231  DWORD expect_flags = 0, adwExeFlags_0, exe_count;
1232  UNICODE_STRING exenameNT;
1233 
1234  memset(&query, 0xab, sizeof(query));
1235 
1236  swprintf(exename, L"%s\\%s", workdir, test_exedata[cur].name);
1238  swprintf(testfile, L"%s\\%s", workdir, test_exedata[cur].extra_file);
1240 
1242  {
1243  /* First we try without the file at all. */
1244  DeleteFileW(testfile);
1245  ret = pSdbGetMatchingExe(hsdb, exename, NULL, NULL, 0, (SDBQUERYRESULT_VISTA*)&query);
1246  ok(ret == 0, "SdbGetMatchingExe should have failed for %d.\n", cur);
1247  /* Now re-try with the correct file */
1248  test_create_file(testfile, "aaaa", 4);
1249  }
1250 
1251 #if 0
1252  // Results seem to be cached based on filename, until we can invalidate this, do not test the same filename twice!
1254  // skip exports
1256  ret = pSdbGetMatchingExe(hsdb, exenameW, NULL, NULL, 0, &query);
1257  ok(ret == 0, "SdbGetMatchingExe should have failed for %d.\n", cur);
1258 
1261 #endif
1262 
1263  if (test_exedata[cur].env_var)
1264  {
1265  SetEnvironmentVariableA("__COMPAT_LAYER", test_exedata[cur].env_var);
1266  }
1267 
1268  ret = pSdbGetMatchingExe(hsdb, exename, NULL, NULL, 0, (SDBQUERYRESULT_VISTA*)&query);
1269  ok(ret, "SdbGetMatchingExe should not fail for %d.\n", cur);
1270 
1271  exe_count = (test_exedata[cur].env_var == NULL) ? 1 : 0;
1272 
1273  ok(query.dwExeCount == exe_count, "Expected dwExeCount to be %d, was %d for %d\n", exe_count, query.dwExeCount, cur);
1274  ok(query.dwLayerCount == test_exedata[cur].dwLayerCount, "Expected dwLayerCount to be %d, was %d for %d\n", test_exedata[cur].dwLayerCount, query.dwLayerCount, cur);
1275  ok(query.dwCustomSDBMap == 1, "Expected dwCustomSDBMap to be 1, was %d for %d\n", query.dwCustomSDBMap, cur);
1276  ok(query.dwLayerFlags == 0, "Expected dwLayerFlags to be 0, was 0x%x for %d\n", query.dwLayerFlags, cur);
1278  ok(query.trApphelp == trApphelp, "Expected trApphelp to be 0x%x, was 0x%x for %d\n", trApphelp, query.trApphelp, cur);
1279 
1280  if (g_WinVersion < WINVER_WIN7)
1281  expect_flags = 0;
1282  else if (g_WinVersion < WINVER_WIN8)
1283  expect_flags = 1;
1284  else if (g_WinVersion < WINVER_WIN10)
1285  expect_flags = 0x101;
1286  else
1287  {
1288  expect_flags = 0x121; /* for 2 and 3, this becomes 101 when not elevated. */
1289  if ((cur == 2 || cur == 3) && !IsUserAdmin())
1290  expect_flags &= ~0x20;
1291  }
1292 
1293  if (test_exedata[cur].env_var)
1294  expect_flags &= ~0x100;
1295 
1296  ok(query.dwFlags == expect_flags, "Expected dwFlags to be 0x%x, was 0x%x for %d\n", expect_flags, query.dwFlags, cur);
1297 
1298  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);
1299  for (size_t n = 1; n < _countof(query.atrExes); ++n)
1300  ok(query.atrExes[n] == 0, "Expected atrExes[%d] to be 0, was: %x for %d\n", n, query.atrExes[n], cur);
1301 
1303  check_adwExeFlags(adwExeFlags_0, query, __FILE__, __LINE__, cur);
1304 
1305  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);
1306  for (size_t n = 1; n < _countof(query.atrLayers); ++n)
1307  ok(query.atrLayers[n] == 0, "Expected atrLayers[%d] to be 0, was: %x for %d\n", n, query.atrLayers[0], cur);
1308 
1309  if (g_WinVersion >= WINVER_VISTA)
1310  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);
1311  else
1312  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);
1313  for (size_t n = 1; n < _countof(query.rgGuidDB); ++n)
1314  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);
1315 
1316  if (query.atrExes[0])
1317  {
1318  pdb = (PDB)0x12345678;
1319  tagid = 0x76543210;
1320  ret = pSdbTagRefToTagID(hsdb, query.atrExes[0], &pdb, &tagid);
1321  ok(ret, "SdbTagRefToTagID failed for %d.\n", cur);
1322  ok(pdb != NULL && pdb != (PDB)0x12345678, "SdbTagRefToTagID failed to return a pdb for %d.\n", cur);
1323  ok(tagid != 0 && tagid != 0x76543210, "SdbTagRefToTagID failed to return a tagid for %d.\n", cur);
1324 
1325  if (pdb && pdb != (PDB)0x12345678)
1326  {
1327  TAGREF tr = 0x12345678;
1328  TAG tag = pSdbGetTagFromTagID(pdb, tagid);
1330  ok(tag == TAG_EXE, "Expected tag to be TAG_EXE, was 0x%x for %d.\n", tag, cur);
1332 
1333  /* And back again */
1334  ret = pSdbTagIDToTagRef(hsdb, pdb, tagid, &tr);
1335  ok(ret, "SdbTagIDToTagRef failed for %d.\n", cur);
1336  ok(tr == query.atrExes[0], "Expected tr to be 0x%x, was 0x%x for %d.\n", query.atrExes[0], tr, cur);
1337  }
1338  else
1339  {
1340  skip("Skipping a bunch of tests because of an invalid pointer\n");
1341  }
1342  }
1343 
1345  {
1346  pdb = (PDB)0x12345678;
1347  tagid = 0x76543210;
1348  ret = pSdbTagRefToTagID(hsdb, query.atrLayers[0], &pdb, &tagid);
1349  ok(ret, "SdbTagRefToTagID failed for %d.\n", cur);
1350  ok(pdb != NULL && pdb != (PDB)0x12345678, "SdbTagRefToTagID failed to return a pdb for %d.\n", cur);
1351  ok(tagid != 0 && tagid != 0x76543210, "SdbTagRefToTagID failed to return a tagid for %d.\n", cur);
1352 
1353  if (pdb && pdb != (PDB)0x12345678)
1354  {
1355  TAGREF tr = 0x12345678;
1356  TAG tag = pSdbGetTagFromTagID(pdb, tagid);
1358  ok(tag == TAG_LAYER, "Expected tag to be TAG_LAYER, was 0x%x for %d.\n", tag, cur);
1359  match_strw_attr(pdb, tagid, TAG_NAME, L"TestNewMode");
1360 
1361  /* And back again */
1362  ret = pSdbTagIDToTagRef(hsdb, pdb, tagid, &tr);
1363  ok(ret, "SdbTagIDToTagRef failed for %d.\n", cur);
1364  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);
1365  }
1366  else
1367  {
1368  skip("Skipping a bunch of tests because of an invalid pointer\n");
1369  }
1370  }
1371 
1372  pdb = (PDB)0x12345678;
1373  tagid = 0x76543210;
1374  ret = pSdbTagRefToTagID(hsdb, 0, &pdb, &tagid);
1375  ok(pdb != NULL && pdb != (PDB)0x12345678, "Expected pdb to be set to a valid pdb, was: %p\n", pdb);
1376  ok(tagid == 0, "Expected tagid to be set to 0, was: 0x%x\n", tagid);
1377 
1378 
1379 
1380  if (RtlDosPathNameToNtPathName_U(exename, &exenameNT, NULL, NULL))
1381  {
1382  /*
1383  ERROR,AslPathGetLongFileNameLongpath,110,Long path conversion failed 123 [c0000001]
1384  ERROR,AslPathBuildSignatureLongpath,1086,AslPathGetLongFileNameLongpath failed for \??\C:\Users\MARK~1.DEV\AppData\Local\Temp\apphelp_test\test_allow.exe [c0000001]
1385  */
1386  ret = pSdbGetMatchingExe(hsdb, exenameNT.Buffer, NULL, NULL, 0, (SDBQUERYRESULT_VISTA*)&query);
1387  ok(!ret, "SdbGetMatchingExe should not succeed for %d.\n", cur);
1388 
1389  RtlFreeUnicodeString(&exenameNT);
1390  }
1391 
1393  DeleteFileW(testfile);
1395 
1396  if (test_exedata[cur].env_var)
1397  {
1398  SetEnvironmentVariableA("__COMPAT_LAYER", NULL);
1399  }
1400 }
DWORD TAGREF
static PDB pdb
Definition: db.cpp:172
GLdouble n
Definition: glext.h:7729
const char * wine_dbgstr_guid(const GUID *guid)
Definition: ecma_167.h:138
#define swprintf
Definition: precomp.h:40
DWORD adwExeFlags_0
Definition: db.cpp:871
static void check_adwExeFlags(DWORD adwExeFlags_0, SDBQUERYRESULT_T &query, const char *file, int line, size_t cur)
Definition: db.cpp:1209
const char * env_var
Definition: db.cpp:874
#define TAG_EXE
Definition: db.cpp:87
static BOOL IsUserAdmin()
Definition: db.cpp:1186
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WINVER_WIN10
static void test_is_testdb(PDB pdb)
Definition: db.cpp:1171
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
static LPWSTR exenameW
Definition: FindFiles.c:28
const WCHAR * extra_file
Definition: db.cpp:868
static DWORD g_WinVersion
#define match_strw_attr
Definition: db.cpp:659
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableA(IN LPCSTR lpName, IN LPCSTR lpValue)
Definition: environ.c:218
static char workdir[MAX_PATH]
Definition: batch.c:26
TAGREF trApphelp
Definition: db.cpp:873
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
int ret
#define WINVER_WIN7
static const WCHAR L[]
Definition: oid.c:1250
#define test_create_exe
#define GUID_NULL
Definition: ks.h:106
#define WINVER_WIN8
FxCollectionEntry * cur
#define WINVER_VISTA
TAGREF atrLayers_0
Definition: db.cpp:872
#define ok(value,...)
Definition: atltest.h:57
#define TAG_LAYER
Definition: db.cpp:90
#define TAG_NAME
Definition: db.cpp:98
#define test_create_file
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
Definition: fs_rec.h:142
#define skip(...)
Definition: atltest.h:64
Definition: name.c:38
static PDB(WINAPI *pSdbOpenDatabase)(LPCWSTR
DWORD TAGID
static struct @1583 test_exedata[5]
static char * exename
Definition: process.c:101
#define memset(x, y, z)
Definition: compat.h:39
GLenum query
Definition: glext.h:7781
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)

◆ test_Sdb()

static void test_Sdb ( void  )
static

Definition at line 240 of file db.cpp.

241 {
242  static const WCHAR temp[] = L"temp";
243  static const WCHAR path1[] = L"temp.sdb";
244  static const WCHAR path2[] = L"temp2.bin";
245  static const WCHAR tag_size_string[] = L"SIZE";
246  static const WCHAR tag_flag_lua_string[] = L"FLAG_LUA";
247  static const WCHAR invalid_tag[] = L"InvalidTag";
248  static const TAG tags[5] = {
251  };
252  WCHAR buffer[6] = { 0 };
253  PDB pdb;
254  QWORD qword;
255  DWORD dword;
256  WORD word;
257  BOOL ret;
258  HANDLE file; /* temp file created for testing purpose */
259  TAG tag;
260  TAGID tagid, ptagid, stringref = 6;
261  LPCWSTR string;
262  PBYTE binary;
263 
264  pdb = pSdbCreateDatabase(path1, DOS_PATH);
265  ok(pdb != NULL, "failed to create database\n");
266  if (pdb != NULL)
267  {
268  ret = pSdbWriteDWORDTag(pdb, tags[0], 0xDEADBEEF);
269  ok(ret, "failed to write DWORD tag\n");
270  ret = pSdbWriteQWORDTag(pdb, tags[1], 0xDEADBEEFBABE);
271  ok(ret, "failed to write QWORD tag\n");
272  ret = pSdbWriteStringRefTag(pdb, tags[2], stringref);
273  ok(ret, "failed to write stringref tag\n");
274  tagid = pSdbBeginWriteListTag(pdb, tags[3]);
275  ok(tagid != TAGID_NULL, "unexpected NULL tagid\n");
276  ret = pSdbWriteStringTag(pdb, tags[4], temp);
277  ok(ret, "failed to write string tag\n");
278  ret = pSdbWriteNULLTag(pdb, TAG_GENERAL);
279  ok(ret, "failed to write NULL tag\n");
280  ret = pSdbWriteWORDTag(pdb, TAG_MATCH_MODE, 0xACE);
281  ok(ret, "failed to write WORD tag\n");
282  ret = pSdbEndWriteListTag(pdb, tagid);
283  ok(ret, "failed to update list size\n");
284  /* [Err ][SdbCloseDatabase ] Failed to close the file. */
285  pSdbCloseDatabaseWrite(pdb);
286  }
287 
288  /* [Err ][SdbGetDatabaseID ] Failed to get root tag */
289  pdb = pSdbOpenDatabase(path1, DOS_PATH);
290  ok(pdb != NULL, "unexpected NULL handle\n");
291 
292  if (pdb)
293  {
294  tagid = pSdbGetFirstChild(pdb, TAGID_ROOT);
295  ok(tagid == _TAGID_ROOT, "unexpected tagid %u, expected %u\n", tagid, _TAGID_ROOT);
296 
297  tag = pSdbGetTagFromTagID(pdb, tagid);
298  ok(tag == TAG_SIZE, "unexpected tag 0x%x, expected 0x%x\n", tag, TAG_SIZE);
299 
300  string = pSdbTagToString(tag);
301  ok(lstrcmpW(string, tag_size_string) == 0, "unexpected string %s, expected %s\n",
302  wine_dbgstr_w(string), wine_dbgstr_w(tag_size_string));
303 
304  dword = pSdbReadDWORDTag(pdb, tagid, 0);
305  ok(dword == 0xDEADBEEF, "unexpected value %u, expected 0xDEADBEEF\n", dword);
306 
307  tagid = pSdbGetNextChild(pdb, TAGID_ROOT, tagid);
308  ok(tagid == _TAGID_ROOT + sizeof(TAG) + sizeof(DWORD), "unexpected tagid %u, expected %u\n",
309  tagid, _TAGID_ROOT + sizeof(TAG) + sizeof(DWORD));
310 
311  tag = pSdbGetTagFromTagID(pdb, tagid);
312  ok(tag == TAG_FLAG_LUA, "unexpected tag 0x%x, expected 0x%x\n", tag, TAG_FLAG_LUA);
313 
314  string = pSdbTagToString(tag);
315  if (g_WinVersion >= WINVER_VISTA)
316  {
317  ok(lstrcmpW(string, tag_flag_lua_string) == 0, "unexpected string %s, expected %s\n",
318  wine_dbgstr_w(string), wine_dbgstr_w(tag_flag_lua_string));
319  }
320  else
321  {
322  ok(lstrcmpW(string, invalid_tag) == 0, "unexpected string %s, expected %s\n",
323  wine_dbgstr_w(string), wine_dbgstr_w(invalid_tag));
324  }
325 
326  qword = pSdbReadQWORDTag(pdb, tagid, 0);
327  ok(qword == 0xDEADBEEFBABE, "unexpected value 0x%I64x, expected 0xDEADBEEFBABE\n", qword);
328 
329  tagid = pSdbGetNextChild(pdb, TAGID_ROOT, tagid);
330  string = pSdbGetStringTagPtr(pdb, tagid);
331  ok(string && (lstrcmpW(string, temp) == 0), "unexpected string %s, expected %s\n",
332  wine_dbgstr_w(string), wine_dbgstr_w(temp));
333 
334  ptagid = pSdbGetNextChild(pdb, TAGID_ROOT, tagid);
335  tagid = pSdbGetFirstChild(pdb, ptagid);
336 
337  string = pSdbGetStringTagPtr(pdb, tagid);
338  ok(string && (lstrcmpW(string, temp) == 0), "unexpected string %s, expected %s\n",
339  wine_dbgstr_w(string), wine_dbgstr_w(temp));
340 
341  ok(pSdbReadStringTag(pdb, tagid, buffer, 6), "failed to write string to buffer\n");
342  /* [Err ][SdbpReadTagData ] Buffer too small. Avail: 6, Need: 10. */
343  ok(!pSdbReadStringTag(pdb, tagid, buffer, 3), "string was written to buffer, but failure was expected");
344  ok(pSdbGetTagDataSize(pdb, tagid) == 5 * sizeof(WCHAR), "string has unexpected size\n");
345 
346  tagid = pSdbGetNextChild(pdb, ptagid, tagid);
347  tag = pSdbGetTagFromTagID(pdb, tagid);
348  ok(tag == TAG_GENERAL, "unexpected tag 0x%x, expected 0x%x\n", tag, TAG_GENERAL);
349  ok(pSdbGetTagDataSize(pdb, tagid) == 0, "null tag with size > 0\n");
350 
351  tagid = pSdbGetNextChild(pdb, ptagid, tagid);
352  word = pSdbReadWORDTag(pdb, tagid, 0);
353  ok(word == 0xACE, "unexpected value 0x%x, expected 0x%x\n", word, 0xACE);
354 
356 
357  pSdbCloseDatabase(pdb);
358  }
360 
362  ok(file != INVALID_HANDLE_VALUE, "failed to open file\n");
363  Write(file, &qword, 8);
364  CloseHandle(file);
365 
366  pdb = pSdbCreateDatabase(path1, DOS_PATH);
367  ok(pdb != NULL, "unexpected NULL handle\n");
368 
369  if (pdb)
370  {
371  ret = pSdbWriteBinaryTagFromFile(pdb, TAG_DATA_BITS, path2);
372  ok(ret, "failed to write tag from binary file\n");
373  pSdbCloseDatabaseWrite(pdb); /* [Err ][SdbCloseDatabase ] Failed to close the file. */
375 
376  /* FIXME: doesnt work on win10?! */
377  pdb = pSdbOpenDatabase(path1, DOS_PATH);
379  {
380  /* ERROR,SdbOpenDatabaseEx,845,Failed to open SDB - File size too large or small. */
381  ok(pdb != NULL, "unexpected NULL handle\n");
382  }
383  if (pdb)
384  {
385  binary = (PBYTE)pSdbGetBinaryTagData(pdb, _TAGID_ROOT);
386  ok(memcmp(binary, &qword, 8) == 0, "binary data is corrupt\n");
387  ret = pSdbReadBinaryTag(pdb, _TAGID_ROOT, (PBYTE)buffer, 12);
388  ok(ret, "failed to read binary tag\n");
389  ok(memcmp(buffer, &qword, 8) == 0, "binary data is corrupt\n");
390  pSdbCloseDatabase(pdb);
391  }
392  }
394 }
static const WCHAR path2[]
Definition: path.c:29
const char * tags[7 *8]
Definition: apphelp.c:216
#define CloseHandle
Definition: compat.h:598
static PDB pdb
Definition: db.cpp:172
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define TAG_GENERAL
Definition: db.cpp:118
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
Definition: ecma_167.h:138
GLuint buffer
Definition: glext.h:5915
static PBYTE
Definition: db.cpp:159
#define TAG_SIZE
Definition: db.cpp:60
#define TAG_STRINGTABLE
Definition: db.cpp:94
unsigned int BOOL
Definition: ntddk_ex.h:94
#define _TAGID_ROOT
Definition: db.cpp:40
#define WINVER_WIN10
#define GENERIC_WRITE
Definition: nt_native.h:90
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
static void Write(HANDLE file, LPCVOID buffer, DWORD size)
Definition: db.cpp:185
#define TAG_FLAG_LUA
Definition: db.cpp:83
static void test_GetDatabaseInformationEmpty(PDB pdb)
Definition: db.cpp:191
static DWORD g_WinVersion
static const WCHAR path1[]
Definition: path.c:28
__wchar_t WCHAR
Definition: xmlstorage.h:180
UINT64 QWORD
Definition: shimdbg.c:104
#define DOS_PATH
Definition: db.cpp:32
#define TAG_DATA_BITS
Definition: db.cpp:121
const char file[]
Definition: icontest.c:11
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
#define OPEN_ALWAYS
Definition: disk.h:70
const GLuint GLenum const GLvoid * binary
Definition: glext.h:7538
int ret
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
static const WCHAR L[]
Definition: oid.c:1250
#define TAG_STRINGTABLE_ITEM
Definition: db.cpp:96
char string[160]
Definition: util.h:11
#define TAGID_NULL
Definition: db.cpp:38
#define WINVER_VISTA
static calc_node_t temp
Definition: rpn_ieee.c:38
#define ok(value,...)
Definition: atltest.h:57
#define TAG_NAME
Definition: db.cpp:98
#define NULL
Definition: types.h:112
#define TAGID_ROOT
Definition: db.cpp:39
Definition: fs_rec.h:142
const WCHAR * word
Definition: lex.c:36
#define CreateFileW
Definition: compat.h:600
DWORD TAGID
#define TAG_MATCH_MODE
Definition: db.cpp:58
BYTE * PBYTE
Definition: pedump.c:66
Definition: fci.c:126
char * tag
Definition: main.c:59

Referenced by START_TEST().

◆ test_stringtable()

static void test_stringtable ( void  )
static

Definition at line 527 of file db.cpp.

528 {
529  static const WCHAR path1[] = {'t','e','s','t','.','s','d','b',0};
530  static const WCHAR test1[] = {'t','e','s','t','1',0};
531  static const WCHAR test2[] = {'T','e','s','t','1',0};
532  static const WCHAR test3[] = {'T','E','s','t','1',0};
533  static const WCHAR test4[] = {'T','E','S','T','1',0};
534  static const WCHAR test5[] = {'T','E','S','T','2',0};
535  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};
536  /* Last char changed from '.' to '!' */
537  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};
538  static const WCHAR empty[] = {0};
539  static const WCHAR* all[] = { test1, test2, test3, test4, test5, lipsum, lipsum2, empty };
540  static const TAGID expected_str[] = { 0xc, 0x12, 0x18, 0x1e, 0x24, 0x2a, 0x30, 0x36 };
541  static const TAGID expected_tab[] = { 6, 0x18, 0x2a, 0x3c, 0x4e, 0x60, 0x846, 0x102c };
542  DWORD n, j;
543 
544  for (n = 0; n < (sizeof(all) / sizeof(all[0])); ++n)
545  {
546  PDB pdb;
547  TAGID tagstr, table, expected_table;
548 
549  write_db_strings(path1, all, n+1);
550 
551  pdb = pSdbOpenDatabase(path1, DOS_PATH);
552  ok(pdb != NULL, "Expected a valid database\n");
553  if (!pdb)
554  {
556  continue;
557  }
558  tagstr = pSdbFindFirstTag(pdb, TAGID_ROOT, TAG_NAME);
559  for (j = 0; j <= n; ++j)
560  {
561  ok(tagstr == expected_str[j], "Expected tagstr to be 0x%x, was 0x%x for %u/%u\n", expected_str[j], tagstr, j, n);
562  if (tagstr)
563  {
564  LPWSTR data;
565  DWORD size;
566  TAG tag = pSdbGetTagFromTagID(pdb, tagstr);
567  ok(tag == TAG_NAME, "Expected tag to be TAG_NAME, was 0x%x for %u/%u\n", tag, j, n);
568  size = pSdbGetTagDataSize(pdb, tagstr);
569  ok(size == 4, "Expected datasize to be 4, was %u for %u/%u\n", size, j, n);
570  data = pSdbGetStringTagPtr(pdb, tagstr);
571  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);
572  }
573  tagstr = pSdbFindNextTag(pdb, TAGID_ROOT, tagstr);
574  }
575  ok(tagstr == TAGID_NULL, "Expected to be at the end for %u\n", n);
576 
577 
578  table = pSdbFindFirstTag(pdb, TAGID_ROOT, TAG_STRINGTABLE);
579  expected_table = 0xc + (n+1)*6;
580  ok(table == expected_table, "Expected to find a stringtable at 0x%x instead of 0x%x for %u\n", expected_table, table, n);
581  if (table)
582  {
583  tagstr = pSdbFindFirstTag(pdb, table, TAG_STRINGTABLE_ITEM);
584  for (j = 0; j <= n; ++j)
585  {
586  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);
587  if (tagstr)
588  {
589  LPWSTR data;
590  DWORD size, expected_size;
591  TAG tag = pSdbGetTagFromTagID(pdb, tagstr);
592  ok(tag == TAG_STRINGTABLE_ITEM, "Expected tag to be TAG_NAME, was 0x%x for %u/%u\n", tag, j, n);
593  size = pSdbGetTagDataSize(pdb, tagstr);
594  expected_size = (lstrlenW(all[j])+1) * 2;
595  ok(size == expected_size, "Expected datasize to be %u, was %u for %u/%u\n", expected_size, size, j, n);
596  data = pSdbGetStringTagPtr(pdb, tagstr);
597  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);
598  }
599  tagstr = pSdbFindNextTag(pdb, TAGID_ROOT, tagstr);
600  }
601  ok(tagstr == TAGID_NULL, "Expected to be at the end for %u\n", n);
602  }
603 
604  pSdbCloseDatabase(pdb);
606  }
607 }
static PDB pdb
Definition: db.cpp:172
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
GLdouble n
Definition: glext.h:7729
Definition: ecma_167.h:138
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
void test4()
Definition: ehthrow.cxx:298
#define lstrlenW
Definition: compat.h:609
static void write_db_strings(const WCHAR *name, const WCHAR *data[], size_t count)
Definition: db.cpp:511
#define TAG_STRINGTABLE
Definition: db.cpp:94
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
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
static const WCHAR path1[]
Definition: path.c:28
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
void test1()
Definition: ehthrow.cxx:277
#define DOS_PATH
Definition: db.cpp:32
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
void test3()
Definition: ehthrow.cxx:291
#define wcsicmp
Definition: compat.h:15
#define TAG_STRINGTABLE_ITEM
Definition: db.cpp:96
#define TAGID_NULL
Definition: db.cpp:38
void test5()
Definition: ehthrow.cxx:305
void test2()
Definition: ehthrow.cxx:284
#define ok(value,...)
Definition: atltest.h:57
#define TAG_NAME
Definition: db.cpp:98
#define NULL
Definition: types.h:112
BOOL empty
Definition: button.c:170
#define TAGID_ROOT
Definition: db.cpp:39
Definition: fs_rec.h:142
DWORD TAGID
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by START_TEST().

◆ test_TagRef()

static void test_TagRef ( void  )
static

Definition at line 1598 of file db.cpp.

1599 {
1600  WCHAR tmpdir[MAX_PATH], dbpath[MAX_PATH];
1601  BOOL ret;
1602  HSDB hsdb;
1603  PDB pdb;
1604  TAGID db;
1605  DWORD size;
1606  TAGREF tr;
1607 
1609  ok(ret, "GetTempPathA error: %d\n", GetLastError());
1610 
1611  /* SdbInitDatabase needs an nt-path */
1612  swprintf(dbpath, L"\\??\\%stest.sdb", tmpdir);
1613 
1614  test_create_db(dbpath + 4, g_WinVersion >= WINVER_WIN10);
1615 
1616  hsdb = pSdbInitDatabase(HID_DATABASE_FULLPATH, dbpath);
1617 
1618  /* HSDB is the only arg that can't be null */
1619  ret = pSdbTagRefToTagID(hsdb, 0, NULL, NULL);
1620  ok(ret == TRUE, "Expected ret to be TRUE, was: %d\n", ret);
1621 
1622  size = test_get_db_size();
1623 
1624  pdb = (PDB)&db;
1625  db = 12345;
1626  ret = pSdbTagRefToTagID(hsdb, size - 1, &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 - 1), "Expected %u, got: %u\n", size - 1, db);
1630 
1631  /* Convert it back. */
1632  tr = 0x12345678;
1633  ret = pSdbTagIDToTagRef(hsdb, pdb, db, &tr);
1634  ok(ret == TRUE, "Expected ret to be TRUE, was: %d\n", ret);
1635  ok(tr == (size - 1), "Expected %u, got: %u\n", size - 1, tr);
1636 
1637  pdb = (PDB)&db;
1638  db = 12345;
1639  ret = pSdbTagRefToTagID(hsdb, size, &pdb, &db);
1640  ok(ret == TRUE, "Expected ret to be TRUE, was: %d\n", ret);
1641  ok(pdb != NULL, "Expected a result, got: %p\n", pdb);
1642  ok(db == size, "Expected %u, got: %u\n", size, db);
1643 
1644  tr = 0x12345678;
1645  ret = pSdbTagIDToTagRef(hsdb, pdb, db, &tr);
1646  ok(ret == TRUE, "Expected ret to be TRUE, was: %d\n", ret);
1647  ok(tr == size, "Expected %u, got: %u\n", size, tr);
1648 
1649  pdb = (PDB)&db;
1650  db = 12345;
1651  ret = pSdbTagRefToTagID(hsdb, size + 1, &pdb, &db);
1652  ok(ret == TRUE, "Expected ret to be TRUE, was: %d\n", ret);
1653  ok(pdb != NULL, "Expected a result, got: %p\n", pdb);
1654  ok(db == (size + 1), "Expected %u, got: %u\n", size + 1, db);
1655 
1656  tr = 0x12345678;
1657  ret = pSdbTagIDToTagRef(hsdb, pdb, db, &tr);
1658  ok(ret == TRUE, "Expected ret to be TRUE, was: %d\n", ret);
1659  ok(tr == (size + 1), "Expected %u, got: %u\n", (size + 1), tr);
1660 
1661  pdb = (PDB)&db;
1662  db = 12345;
1663  ret = pSdbTagRefToTagID(hsdb, 0x0fffffff, &pdb, &db);
1664  ok(ret == TRUE, "Expected ret to be TRUE, was: %d\n", ret);
1665  ok(pdb != NULL, "Expected a result, got: %p\n", pdb);
1666  ok(db == 0x0fffffff, "Expected %u, got: %u\n", 0x0fffffff, db);
1667 
1668  tr = 0x12345678;
1669  ret = pSdbTagIDToTagRef(hsdb, pdb, db, &tr);
1670  ok(ret == TRUE, "Expected ret to be TRUE, was: %d\n", ret);
1671  ok(tr == 0x0fffffff, "Expected %u, got: %u\n", 0x0fffffff, tr);
1672 
1673  pdb = (PDB)&db;
1674  db = 12345;
1675  ret = pSdbTagRefToTagID(hsdb, 0x10000000, &pdb, &db);
1676  ok(ret == FALSE, "Expected ret to be FALSE, was: %d\n", ret);
1677  ok(pdb == NULL, "Expected no result, got: %p\n", pdb);
1678  ok(db == 0, "Expected no result, got: 0x%x\n", db);
1679 
1680  tr = 0x12345678;
1681  ret = pSdbTagIDToTagRef(hsdb, pdb, 0x10000000, &tr);
1682  ok(ret == FALSE, "Expected ret to be TRUE, was: %d\n", ret);
1683  ok(tr == 0, "Expected %u, got: %u\n", 0, tr);
1684 
1685  pdb = NULL;
1686  db = TAGID_NULL;
1687  ret = pSdbTagRefToTagID(hsdb, TAGID_ROOT, &pdb, NULL);
1688  ok(ret != FALSE, "Expected ret to be TRUE, was: %d\n", ret);
1689  ok(pdb != NULL, "Expected pdb to be valid\n");
1690 
1691  if (pdb == NULL)
1692  {
1693  skip("Cannot run tests without pdb\n");
1694  }
1695  else
1696  {
1697  db = pSdbFindFirstTag(pdb, TAGID_ROOT, TAG_DATABASE);
1698  if (db != TAGID_NULL)
1699  {
1700  TAGID child;
1701  child = pSdbGetFirstChild(pdb, db);
1702  while (child != TAGID_NULL)
1703  {
1704  PDB pdb_res;
1705  TAGID tagid_res;
1706  /* We are using a TAGID as a TAGREF here. */
1707  ret = pSdbTagRefToTagID(hsdb, child, &pdb_res, &tagid_res);
1708  ok(ret, "Expected SdbTagRefToTagID to succeed\n");
1709 
1710  /* For simple cases (primary DB) TAGREF == TAGID */
1711  tr = 0x12345678;
1712  ret = pSdbTagIDToTagRef(hsdb, pdb_res, tagid_res, &tr);
1713  ok(ret, "Expected SdbTagIDToTagRef to succeed\n");
1714  ok_hex(tr, (int)tagid_res);
1715 
1716  child = pSdbGetNextChild(pdb, db, child);
1717  }
1718  }
1719  else
1720  {
1721  skip("Cannot run tests without valid db tag\n");
1722  }
1723  }
1724 
1725  /* Get a tagref for our own layer */
1726  tr = pSdbGetLayerTagRef(hsdb, L"TestNewMode");
1727  ok_hex(tr, 0x18e);
1728 
1729  /* We cannot find a tagref from the main database. */
1730  tr = pSdbGetLayerTagRef(hsdb, L"256Color");
1731  ok_hex(tr, 0);
1732 
1733  pSdbReleaseDatabase(hsdb);
1734 
1735  DeleteFileW(dbpath + 4);
1736 }
DWORD TAGREF
static PDB pdb
Definition: db.cpp:172
#define test_create_db
#define TRUE
Definition: types.h:120
#define TAG_DATABASE
Definition: db.cpp:85
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define swprintf
Definition: precomp.h:40
#define ok_hex(expression, result)
Definition: atltest.h:94
static HWND child
Definition: cursoricon.c:298
#define HID_DATABASE_FULLPATH
Definition: db.cpp:33
Definition: apphelp.h:30
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2079
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WINVER_WIN10
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
static DWORD g_WinVersion
GLsizeiptr size
Definition: glext.h:5919
static char tmpdir[MAX_PATH]
Definition: shlexec.c:52
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
static const WCHAR L[]
Definition: oid.c:1250
#define TAGID_NULL
Definition: db.cpp:38
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define TAGID_ROOT
Definition: db.cpp:39
#define skip(...)
Definition: atltest.h:64
static PDB(WINAPI *pSdbOpenDatabase)(LPCWSTR
DWORD TAGID
DWORD test_get_db_size()
Definition: data.c:773

Referenced by START_TEST().

◆ test_write_ex()

static void test_write_ex ( void  )
static

Definition at line 401 of file db.cpp.

402 {
403  WCHAR path1[] = {'t','e','s','t','.','s','d','b',0};
404  WCHAR test1[] = {'T','E','S','T',0};
405  WCHAR test2[] = {'t','e','s','t',0};
406  PDB pdb;
407  TAGID tagdb, tagstr;
408  TAG tag;
409  DWORD size;
410  BOOL ret;
411  LPWSTR ptr;
412 
413  /* Write a small database */
414  pdb = pSdbCreateDatabase(path1, DOS_PATH);
415  ok(pdb != NULL, "Expected a valid database\n");
416  if (!pdb)
417  return;
418  tagdb = pSdbBeginWriteListTag(