ReactOS 0.4.16-dev-1489-g8fbbb41
apphelp.c 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 <shlguid.h>
#include <shobjidl.h>
#include <pseh/pseh2.h>
#include "wine/test.h"
#include "apphelp_apitest.h"
Include dependency graph for apphelp.c:

Go to the source code of this file.

Classes

struct  tagATTRINFO
 

Macros

#define WIN32_NO_STATUS
 
#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_SIZE   (0x1 | TAG_TYPE_DWORD)
 
#define TAG_CHECKSUM   (0x3 | TAG_TYPE_DWORD)
 
#define TAG_MODULE_TYPE   (0x6 | TAG_TYPE_DWORD)
 
#define TAG_VERDATEHI   (0x7 | TAG_TYPE_DWORD)
 
#define TAG_VERDATELO   (0x8 | TAG_TYPE_DWORD)
 
#define TAG_VERFILEOS   (0x9 | TAG_TYPE_DWORD)
 
#define TAG_VERFILETYPE   (0xA | TAG_TYPE_DWORD)
 
#define TAG_PE_CHECKSUM   (0xB | TAG_TYPE_DWORD)
 
#define TAG_VER_LANGUAGE   (0x12 | 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_EXE_WRAPPER   (0x31 | TAG_TYPE_DWORD)
 
#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_NAME   (0x1 | TAG_TYPE_STRINGREF)
 
#define TAG_COMPANY_NAME   (0x9 | TAG_TYPE_STRINGREF)
 
#define TAG_PRODUCT_NAME   (0x10 | TAG_TYPE_STRINGREF)
 
#define TAG_PRODUCT_VERSION   (0x11 | TAG_TYPE_STRINGREF)
 
#define TAG_FILE_DESCRIPTION   (0x12 | TAG_TYPE_STRINGREF)
 
#define TAG_FILE_VERSION   (0x13 | TAG_TYPE_STRINGREF)
 
#define TAG_ORIGINAL_FILENAME   (0x14 | TAG_TYPE_STRINGREF)
 
#define TAG_INTERNAL_NAME   (0x15 | TAG_TYPE_STRINGREF)
 
#define TAG_LEGAL_COPYRIGHT   (0x16 | TAG_TYPE_STRINGREF)
 
#define TAG_16BIT_DESCRIPTION   (0x17 | TAG_TYPE_STRINGREF)
 
#define TAG_16BIT_MODULE_NAME   (0x20 | TAG_TYPE_STRINGREF)
 
#define TAG_EXPORT_NAME   (0x24 | TAG_TYPE_STRINGREF)
 
#define ATTRIBUTE_AVAILABLE   0x1
 
#define ATTRIBUTE_FAILED   0x2
 
#define expect_tag_skip   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : expect_tag_skip_imp
 
#define expect_tag_empty   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : expect_tag_empty_imp
 
#define expect_tag_dword   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : expect_tag_dword_imp
 
#define expect_tag_qword   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : expect_tag_qword_imp
 
#define expect_tag_str   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : expect_tag_str_imp
 
#define expect_tag_skip_range(ptr, from, to)
 
#define test_crc   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : test_crc_imp
 
#define test_crc2   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : test_crc2_imp
 
#define RESOLVE(fnc)   do { p##fnc = (void *) GetProcAddress(hdll, #fnc); ok(!!p##fnc, #fnc " not found.\n"); } while (0)
 

Typedefs

typedef struct tagATTRINFO ATTRINFO
 
typedef struct tagATTRINFOPATTRINFO
 

Functions

static BOOL (WINAPI *pApphelpCheckShellObject)(REFCLSID
 
static ULONGLONG *static LPCWSTR (WINAPI *pSdbTagToString)(TAG tag)
 
static HRESULT (WINAPI *pSdbGetAppPatchDir)(PVOID hsdb
 
 DEFINE_GUID (GUID_DATABASE_MSI, 0xd8ff6d16, 0x6a3a, 0x468a, 0x8b, 0x44, 0x01, 0x71, 0x4d, 0xdc, 0x49, 0xea)
 
 DEFINE_GUID (GUID_DATABASE_SHIM, 0x11111111, 0x1111, 0x1111, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11)
 
 DEFINE_GUID (GUID_DATABASE_DRIVERS, 0xf9ab2228, 0x3312, 0x4a73, 0xb6, 0xf9, 0x93, 0x6d, 0x70, 0xe1, 0x12, 0xef)
 
 DEFINE_GUID (GUID_NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
 
 DEFINE_GUID (test_Microsoft_Browser_Architecture, 0xa5e46e3a, 0x8849, 0x11d1, 0x9d, 0x8c, 0x00, 0xc0, 0x4f, 0xc9, 0x9d, 0x61)
 
 DEFINE_GUID (test_UserAssist, 0xdd313e04, 0xfeff, 0x11d1, 0x8e, 0xcd, 0x00, 0x00, 0xf8, 0x7a, 0x47, 0x0c)
 
 DEFINE_GUID (CLSID_InternetSecurityManager, 0x7b8a2d94, 0x0ac9, 0x11d1, 0x89, 0x6c, 0x00, 0xc0, 0x4f, 0xB6, 0xbf, 0xc4)
 
static void test_ApphelpCheckShellObject (void)
 
static void test_SdbTagToString (void)
 
static int strcmp_wa (LPCWSTR strw, const char *stra)
 
void test_tag (TAG base, const char *names[], size_t upperlimit, int line)
 
static void test_SdbTagToStringAllTags (void)
 
static void test_GuidFunctions (void)
 
static DWORD find_tag (TAG tag)
 
static void expect_tag_skip_imp (PATTRINFO pattr, TAG tag)
 
static void expect_tag_empty_imp (PATTRINFO pattr, TAG tag)
 
static void expect_tag_dword_imp (PATTRINFO pattr, TAG tag, DWORD value)
 
static void expect_tag_qword_imp (PATTRINFO pattr, TAG tag, QWORD value)
 
static void expect_tag_str_imp (PATTRINFO pattr, TAG tag, const WCHAR *value)
 
void test_onefile (WCHAR *filename)
 
static void test_crc_imp (size_t len, DWORD expected)
 
static void test_crc2_imp (DWORD len, int fill, DWORD expected)
 
static void test_ApplicationAttributes (void)
 
static void test_SdbGetAppPatchDir (void)
 
 START_TEST (apphelp)
 

Variables

static HMODULE hdll
 
static BOOL
 
static PWSTR GuidString
 
static PWSTR SIZE_T Length
 
static GUIDGuid
 
static PATTRINFOppAttrInfo
 
static PATTRINFO LPDWORD pdwAttrCount
 
static LPWSTR path
 
static LPWSTR DWORD size
 
static DWORD g_AttrInfoSize
 
static const CLSIDobjects []
 
struct {
   TAG   base
 
   DWORD   upper_limit
 
   DWORD   line
 
   DWORD   min_ver
 
   DWORD   max_ver
 
   const char *   tags [99]
 
data []
 
static TAG g_Tags_26 []
 
static TAG g_Tags_28 []
 

Macro Definition Documentation

◆ ATTRIBUTE_AVAILABLE

#define ATTRIBUTE_AVAILABLE   0x1

Definition at line 77 of file apphelp.c.

◆ ATTRIBUTE_FAILED

#define ATTRIBUTE_FAILED   0x2

Definition at line 78 of file apphelp.c.

◆ expect_tag_dword

#define expect_tag_dword   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : expect_tag_dword_imp

Definition at line 797 of file apphelp.c.

◆ expect_tag_empty

#define expect_tag_empty   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : expect_tag_empty_imp

Definition at line 796 of file apphelp.c.

◆ expect_tag_qword

#define expect_tag_qword   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : expect_tag_qword_imp

Definition at line 798 of file apphelp.c.

◆ expect_tag_skip

#define expect_tag_skip   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : expect_tag_skip_imp

Definition at line 795 of file apphelp.c.

◆ expect_tag_skip_range

#define expect_tag_skip_range (   ptr,
  from,
  to 
)
Value:
do { \
int n = (from), n_end = (to); \
winetest_set_location(__FILE__, __LINE__); \
for ( ; n < n_end; ++n) \
} while (0)
GLdouble n
Definition: glext.h:7729
static void expect_tag_skip_imp(PATTRINFO pattr, TAG tag)
Definition: apphelp.c:726
static PVOID ptr
Definition: dispmode.c:27
CardRegion * from
Definition: spigame.cpp:19

Definition at line 800 of file apphelp.c.

◆ expect_tag_str

#define expect_tag_str   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : expect_tag_str_imp

Definition at line 799 of file apphelp.c.

◆ RESOLVE

#define RESOLVE (   fnc)    do { p##fnc = (void *) GetProcAddress(hdll, #fnc); ok(!!p##fnc, #fnc " not found.\n"); } while (0)

◆ TAG_16BIT_DESCRIPTION

#define TAG_16BIT_DESCRIPTION   (0x17 | TAG_TYPE_STRINGREF)

Definition at line 72 of file apphelp.c.

◆ TAG_16BIT_MODULE_NAME

#define TAG_16BIT_MODULE_NAME   (0x20 | TAG_TYPE_STRINGREF)

Definition at line 73 of file apphelp.c.

◆ TAG_BIN_FILE_VERSION

#define TAG_BIN_FILE_VERSION   (0x2 | TAG_TYPE_QWORD)

Definition at line 59 of file apphelp.c.

◆ TAG_BIN_PRODUCT_VERSION

#define TAG_BIN_PRODUCT_VERSION   (0x3 | TAG_TYPE_QWORD)

Definition at line 60 of file apphelp.c.

◆ TAG_CHECKSUM

#define TAG_CHECKSUM   (0x3 | TAG_TYPE_DWORD)

Definition at line 47 of file apphelp.c.

◆ TAG_COMPANY_NAME

#define TAG_COMPANY_NAME   (0x9 | TAG_TYPE_STRINGREF)

Definition at line 64 of file apphelp.c.

◆ TAG_EXE_WRAPPER

#define TAG_EXE_WRAPPER   (0x31 | TAG_TYPE_DWORD)

Definition at line 58 of file apphelp.c.

◆ TAG_EXPORT_NAME

#define TAG_EXPORT_NAME   (0x24 | TAG_TYPE_STRINGREF)

Definition at line 74 of file apphelp.c.

◆ TAG_FILE_DESCRIPTION

#define TAG_FILE_DESCRIPTION   (0x12 | TAG_TYPE_STRINGREF)

Definition at line 67 of file apphelp.c.

◆ TAG_FILE_VERSION

#define TAG_FILE_VERSION   (0x13 | TAG_TYPE_STRINGREF)

Definition at line 68 of file apphelp.c.

◆ TAG_INTERNAL_NAME

#define TAG_INTERNAL_NAME   (0x15 | TAG_TYPE_STRINGREF)

Definition at line 70 of file apphelp.c.

◆ TAG_LEGAL_COPYRIGHT

#define TAG_LEGAL_COPYRIGHT   (0x16 | TAG_TYPE_STRINGREF)

Definition at line 71 of file apphelp.c.

◆ TAG_LINK_DATE

#define TAG_LINK_DATE   (0x1D | TAG_TYPE_DWORD)

Definition at line 56 of file apphelp.c.

◆ TAG_LINKER_VERSION

#define TAG_LINKER_VERSION   (0x1C | TAG_TYPE_DWORD)

Definition at line 55 of file apphelp.c.

◆ TAG_MODULE_TYPE

#define TAG_MODULE_TYPE   (0x6 | TAG_TYPE_DWORD)

Definition at line 48 of file apphelp.c.

◆ TAG_NAME

#define TAG_NAME   (0x1 | TAG_TYPE_STRINGREF)

Definition at line 63 of file apphelp.c.

◆ TAG_NULL

#define TAG_NULL   0x0

Definition at line 45 of file apphelp.c.

◆ TAG_ORIGINAL_FILENAME

#define TAG_ORIGINAL_FILENAME   (0x14 | TAG_TYPE_STRINGREF)

Definition at line 69 of file apphelp.c.

◆ TAG_PE_CHECKSUM

#define TAG_PE_CHECKSUM   (0xB | TAG_TYPE_DWORD)

Definition at line 53 of file apphelp.c.

◆ TAG_PRODUCT_NAME

#define TAG_PRODUCT_NAME   (0x10 | TAG_TYPE_STRINGREF)

Definition at line 65 of file apphelp.c.

◆ TAG_PRODUCT_VERSION

#define TAG_PRODUCT_VERSION   (0x11 | TAG_TYPE_STRINGREF)

Definition at line 66 of file apphelp.c.

◆ TAG_SIZE

#define TAG_SIZE   (0x1 | TAG_TYPE_DWORD)

Definition at line 46 of file apphelp.c.

◆ TAG_TYPE_BINARY

#define TAG_TYPE_BINARY   0x9000

Definition at line 44 of file apphelp.c.

◆ TAG_TYPE_BYTE

#define TAG_TYPE_BYTE   0x2000

Definition at line 37 of file apphelp.c.

◆ TAG_TYPE_DWORD

#define TAG_TYPE_DWORD   0x4000

Definition at line 39 of file apphelp.c.

◆ TAG_TYPE_LIST

#define TAG_TYPE_LIST   0x7000

Definition at line 42 of file apphelp.c.

◆ TAG_TYPE_MASK

#define TAG_TYPE_MASK   0xF000

Definition at line 34 of file apphelp.c.

◆ TAG_TYPE_NULL

#define TAG_TYPE_NULL   0x1000

Definition at line 36 of file apphelp.c.

◆ TAG_TYPE_QWORD

#define TAG_TYPE_QWORD   0x5000

Definition at line 40 of file apphelp.c.

◆ TAG_TYPE_STRING

#define TAG_TYPE_STRING   0x8000

Definition at line 43 of file apphelp.c.

◆ TAG_TYPE_STRINGREF

#define TAG_TYPE_STRINGREF   0x6000

Definition at line 41 of file apphelp.c.

◆ TAG_TYPE_WORD

#define TAG_TYPE_WORD   0x3000

Definition at line 38 of file apphelp.c.

◆ TAG_UPTO_BIN_FILE_VERSION

#define TAG_UPTO_BIN_FILE_VERSION   (0xD | TAG_TYPE_QWORD)

Definition at line 62 of file apphelp.c.

◆ TAG_UPTO_BIN_PRODUCT_VERSION

#define TAG_UPTO_BIN_PRODUCT_VERSION   (0x6 | TAG_TYPE_QWORD)

Definition at line 61 of file apphelp.c.

◆ TAG_UPTO_LINK_DATE

#define TAG_UPTO_LINK_DATE   (0x1E | TAG_TYPE_DWORD)

Definition at line 57 of file apphelp.c.

◆ TAG_VER_LANGUAGE

#define TAG_VER_LANGUAGE   (0x12 | TAG_TYPE_DWORD)

Definition at line 54 of file apphelp.c.

◆ TAG_VERDATEHI

#define TAG_VERDATEHI   (0x7 | TAG_TYPE_DWORD)

Definition at line 49 of file apphelp.c.

◆ TAG_VERDATELO

#define TAG_VERDATELO   (0x8 | TAG_TYPE_DWORD)

Definition at line 50 of file apphelp.c.

◆ TAG_VERFILEOS

#define TAG_VERFILEOS   (0x9 | TAG_TYPE_DWORD)

Definition at line 51 of file apphelp.c.

◆ TAG_VERFILETYPE

#define TAG_VERFILETYPE   (0xA | TAG_TYPE_DWORD)

Definition at line 52 of file apphelp.c.

◆ test_crc

#define test_crc   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : test_crc_imp

Definition at line 807 of file apphelp.c.

◆ test_crc2

#define test_crc2   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : test_crc2_imp

Definition at line 808 of file apphelp.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 11 of file apphelp.c.

Typedef Documentation

◆ ATTRINFO

◆ PATTRINFO

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pApphelpCheckShellObject)
static

◆ DEFINE_GUID() [1/7]

DEFINE_GUID ( CLSID_InternetSecurityManager  ,
0x7b8a2d94  ,
0x0ac9  ,
0x11d1  ,
0x89  ,
0x6c  ,
0x00  ,
0xc0  ,
0x4f  ,
0xB6  ,
0xbf  ,
0xc4   
)

◆ DEFINE_GUID() [2/7]

DEFINE_GUID ( GUID_DATABASE_DRIVERS  ,
0xf9ab2228  ,
0x3312  ,
0x4a73  ,
0xb6  ,
0xf9  ,
0x93  ,
0x6d  ,
0x70  ,
0xe1  ,
0x12  ,
0xef   
)

◆ DEFINE_GUID() [3/7]

DEFINE_GUID ( GUID_DATABASE_MSI  ,
0xd8ff6d16  ,
0x6a3a  ,
0x468a  ,
0x8b  ,
0x44  ,
0x01  ,
0x71  ,
0x4d  ,
0xdc  ,
0x49  ,
0xea   
)

◆ DEFINE_GUID() [4/7]

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

◆ DEFINE_GUID() [5/7]

DEFINE_GUID ( GUID_NULL  ,
,
,
,
,
,
,
,
,
,
,
 
)

◆ DEFINE_GUID() [6/7]

DEFINE_GUID ( test_Microsoft_Browser_Architecture  ,
0xa5e46e3a  ,
0x8849  ,
0x11d1  ,
0x9d  ,
0x8c  ,
0x00  ,
0xc0  ,
0x4f  ,
0xc9  ,
0x9d  ,
0x61   
)

◆ DEFINE_GUID() [7/7]

DEFINE_GUID ( test_UserAssist  ,
0xdd313e04  ,
0xfeff  ,
0x11d1  ,
0x8e  ,
0xcd  ,
0x00  ,
0x00  ,
0xf8  ,
0x7a  ,
0x47  ,
0x0c   
)

◆ expect_tag_dword_imp()

static void expect_tag_dword_imp ( PATTRINFO  pattr,
TAG  tag,
DWORD  value 
)
static

Definition at line 753 of file apphelp.c.

754{
756 PATTRINFO p;
757
758 if (num == ~0)
759 return;
760
761 p = &pattr[num];
762 winetest_ok(p->type == tag, "expected entry #%d to be %x, was %x\n", num, tag, p->type);
763 winetest_ok(p->flags == ATTRIBUTE_AVAILABLE, "expected entry #%d to be available, was %d\n", num, p->flags);
764 winetest_ok(p->dwattr == value, "expected entry #%d to be 0x%x, was 0x%x\n", num, value, p->dwattr);
765}
unsigned long DWORD
Definition: ntddk_ex.h:95
GLfloat GLfloat p
Definition: glext.h:8902
GLuint GLuint num
Definition: glext.h:9618
#define ATTRIBUTE_AVAILABLE
Definition: apphelp.c:77
static DWORD find_tag(TAG tag)
Definition: apphelp.c:702
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)
Definition: ecma_167.h:138
Definition: pdh_main.c:96

Referenced by test_crc2_imp(), and test_crc_imp().

◆ expect_tag_empty_imp()

static void expect_tag_empty_imp ( PATTRINFO  pattr,
TAG  tag 
)
static

Definition at line 739 of file apphelp.c.

740{
742 PATTRINFO p;
743
744 if (num == ~0)
745 return;
746
747 p = &pattr[num];
748 winetest_ok(p->type == TAG_NULL, "expected entry #%d to be TAG_NULL, was %x\n", num, p->type);
749 winetest_ok(p->flags == 0, "expected entry #%d to be 0, was %d\n", num, p->flags);
750 winetest_ok(p->qwattr == 0, "expected entry #%d to be 0, was 0x%I64x\n", num, p->qwattr);
751}
#define TAG_NULL
Definition: apphelp.c:45

◆ expect_tag_qword_imp()

static void expect_tag_qword_imp ( PATTRINFO  pattr,
TAG  tag,
QWORD  value 
)
static

Definition at line 767 of file apphelp.c.

768{
770 PATTRINFO p;
771
772 if (num == ~0)
773 return;
774
775 p = &pattr[num];
776 winetest_ok(p->type == tag, "expected entry #%d to be %x, was %x\n", num, tag, p->type);
777 winetest_ok(p->flags == ATTRIBUTE_AVAILABLE, "expected entry #%d to be available, was %d\n", num, p->flags);
778 winetest_ok(p->qwattr == value, "expected entry #%d to be 0x%I64x, was 0x%I64x\n", num, value, p->qwattr);
779}

◆ expect_tag_skip_imp()

static void expect_tag_skip_imp ( PATTRINFO  pattr,
TAG  tag 
)
static

Definition at line 726 of file apphelp.c.

727{
729 PATTRINFO p;
730
731 if (num == ~0)
732 return;
733
734 p = &pattr[num];
735 winetest_ok(p->type == TAG_NULL, "expected entry #%d to be TAG_NULL, was %x\n", num, p->type);
736 winetest_ok(p->flags == ATTRIBUTE_FAILED, "expected entry #%d to be failed, was %d\n", num, p->flags);
737 winetest_ok(p->qwattr == 0, "expected entry #%d to be 0, was 0x%I64x\n", num, p->qwattr);
738}
#define ATTRIBUTE_FAILED
Definition: apphelp.c:78

◆ expect_tag_str_imp()

static void expect_tag_str_imp ( PATTRINFO  pattr,
TAG  tag,
const WCHAR value 
)
static

Definition at line 781 of file apphelp.c.

782{
784 PATTRINFO p;
785
786 if (num == ~0)
787 return;
788
789 p = &pattr[num];
790 winetest_ok(p->type == tag, "expected entry #%d to be %x, was %x\n", num, tag, p->type);
791 winetest_ok(p->flags == ATTRIBUTE_AVAILABLE, "expected entry #%d to be available, was %d\n", num, p->flags);
792 winetest_ok(p->lpattr && wcscmp(p->lpattr, value) == 0, "expected entry #%d to be %s, was %s\n", num, wine_dbgstr_w(value), wine_dbgstr_w(p->lpattr));
793}
#define wine_dbgstr_w
Definition: kernel32.h:34
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

◆ find_tag()

static DWORD find_tag ( TAG  tag)
static

Definition at line 702 of file apphelp.c.

703{
704 DWORD n;
705 TAG* allTags;
706 switch (g_AttrInfoSize)
707 {
708 case 26:
709 allTags = g_Tags_26;
710 break;
711 case 28:
712 allTags = g_Tags_28;
713 break;
714 default:
715 return ~0;
716 }
717
718 for (n = 0; n < allTags[n]; ++n)
719 {
720 if (allTags[n] == tag)
721 return n;
722 }
723 return ~0;
724}
static DWORD g_AttrInfoSize
Definition: apphelp.c:99
static TAG g_Tags_26[]
Definition: apphelp.c:640
static TAG g_Tags_28[]
Definition: apphelp.c:670
Definition: fs_rec.h:143

Referenced by expect_tag_dword_imp(), expect_tag_empty_imp(), expect_tag_qword_imp(), expect_tag_skip_imp(), and expect_tag_str_imp().

◆ HRESULT()

static HRESULT ( WINAPI pSdbGetAppPatchDir)
static

◆ LPCWSTR()

static ULONGLONG *static LPCWSTR ( WINAPI pSdbTagToString)
static

◆ START_TEST()

START_TEST ( apphelp  )

Definition at line 1230 of file apphelp.c.

1231{
1232 //SetEnvironmentVariable("SHIM_DEBUG_LEVEL", "4");
1233 //SetEnvironmentVariable("DEBUGCHANNEL", "+apphelp");
1235
1236 hdll = LoadLibraryA("apphelp.dll");
1238 trace("Detected apphelp.dll version: 0x%x\n", g_WinVersion);
1239
1240#define RESOLVE(fnc) do { p##fnc = (void *) GetProcAddress(hdll, #fnc); ok(!!p##fnc, #fnc " not found.\n"); } while (0)
1249#undef RESOLVE
1250
1256#ifndef _M_IX86
1257 skip("FIXME: Need new SdbGetAppPatchDir() for non-x86!\n");
1258#else
1259 if (pSdbGetAppPatchDir)
1261#endif
1262}
BOOL WINAPI SdbFreeFileAttributes(PATTRINFO attr_info)
Definition: sdbfileattr.c:214
LPCWSTR WINAPI SdbTagToString(TAG tag)
Definition: sdbapi.c:752
BOOL WINAPI SdbGUIDToString(CONST GUID *Guid, PWSTR GuidString, SIZE_T Length)
Definition: sdbapi.c:412
HRESULT WINAPI SdbGetAppPatchDir(HSDB db, LPWSTR path, DWORD size)
Definition: hsdb.c:579
BOOL WINAPI SdbIsNullGUID(CONST GUID *Guid)
Definition: sdbapi.c:431
BOOL WINAPI SdbGetFileAttributes(LPCWSTR path, PATTRINFO *attr_info_ret, LPDWORD attr_count)
Definition: sdbfileattr.c:239
DWORD get_module_version(HMODULE mod)
Definition: data.c:811
void silence_debug_output(void)
Definition: data.c:841
DWORD g_WinVersion
Definition: data.c:795
#define trace
Definition: atltest.h:70
#define skip(...)
Definition: atltest.h:64
BOOL WINAPI ApphelpCheckShellObject(REFCLSID ObjectCLSID, BOOL bShimIfNecessary, ULONGLONG *pullFlags)
Definition: apphelp.c:83
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
static HMODULE hdll
Definition: apphelp.c:90
static void test_SdbGetAppPatchDir(void)
Definition: apphelp.c:1175
static void test_GuidFunctions(void)
Definition: apphelp.c:614
static void test_SdbTagToStringAllTags(void)
Definition: apphelp.c:601
#define RESOLVE(fnc)
static void test_ApplicationAttributes(void)
Definition: apphelp.c:900
static void test_ApphelpCheckShellObject(void)
Definition: apphelp.c:124
static void test_SdbTagToString(void)
Definition: apphelp.c:167
BOOL WINAPI SdbGetStandardDatabaseGUID(DWORD Flags, GUID *Guid)
Definition: sdbapi.c:445

◆ strcmp_wa()

static int strcmp_wa ( LPCWSTR  strw,
const char stra 
)
static

Definition at line 187 of file apphelp.c.

188{
189 CHAR buf[512];
190 WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), 0, 0);
191 return lstrcmpA(buf, stra);
192}
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4198
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static const char * strw(LPCWSTR x)
Definition: actctx.c:49
char CHAR
Definition: xmlstorage.h:175

Referenced by _test_body_scroll(), _test_button_name(), _test_compatmode(), _test_doc_title(), _test_elem_title(), _test_form_action(), _test_form_encoding(), _test_form_method(), _test_form_name(), _test_framebase_marginheight(), _test_framebase_marginwidth(), _test_framebase_name(), _test_framebase_src(), _test_iframe_height(), _test_iframe_width(), _test_link_href(), _test_link_media(), _test_link_rel(), _test_link_rev(), _test_link_type(), _test_meta_charset(), _test_meta_content(), _test_meta_httpequiv(), _test_meta_name(), _test_node_get_value_str(), _test_script_text(), _test_table_cell_padding(), _test_table_cell_spacing(), PropertyNotifySink_OnChanged(), test_attr(), test_body_funs(), test_default_body(), test_default_selection(), test_doc_elem(), test_elems(), test_form_target(), test_framebase(), test_label_elem(), test_location(), test_navigator(), test_table_elem(), test_tag(), test_td_elem(), test_tr_elem(), and test_window().

◆ test_ApphelpCheckShellObject()

static void test_ApphelpCheckShellObject ( void  )
static

Definition at line 124 of file apphelp.c.

125{
127 BOOL res;
128 int i;
129
130 if (!pApphelpCheckShellObject)
131 {
132 win_skip("ApphelpCheckShellObject not available\n");
133 return;
134 }
135
136 for (i = 0; objects[i]; i++)
137 {
138 flags = 0xdeadbeef;
139 SetLastError(0xdeadbeef);
140 res = pApphelpCheckShellObject(objects[i], FALSE, &flags);
141 ok(res && (flags == 0), "%s 0: got %d and 0x%x%08x with 0x%x (expected TRUE and 0)\n",
143
144 flags = 0xdeadbeef;
145 SetLastError(0xdeadbeef);
146 res = pApphelpCheckShellObject(objects[i], TRUE, &flags);
147 ok(res && (flags == 0), "%s 1: got %d and 0x%x%08x with 0x%x (expected TRUE and 0)\n",
149
150 }
151
152 /* NULL as pointer to flags is checked */
153 SetLastError(0xdeadbeef);
154 res = pApphelpCheckShellObject(&GUID_NULL, FALSE, NULL);
155 ok(res, "%s 0: got %d with 0x%x (expected != FALSE)\n", wine_dbgstr_guid(&GUID_NULL), res, GetLastError());
156
157 /* NULL as CLSID* crash on Windows */
158 if (0)
159 {
160 flags = 0xdeadbeef;
161 SetLastError(0xdeadbeef);
162 res = pApphelpCheckShellObject(NULL, FALSE, &flags);
163 trace("NULL as CLSID*: got %d and 0x%x%08x with 0x%x\n", res, (ULONG)(flags >> 32), (ULONG)flags, GetLastError());
164 }
165}
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define SetLastError(x)
Definition: compat.h:752
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint res
Definition: glext.h:9613
GLbitfield flags
Definition: glext.h:7161
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 i
Definition: glfuncs.h:248
#define GUID_NULL
Definition: ks.h:106
static const CLSID * objects[]
Definition: apphelp.c:112
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197
#define win_skip
Definition: test.h:164
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by START_TEST().

◆ test_ApplicationAttributes()

static void test_ApplicationAttributes ( void  )
static

Definition at line 900 of file apphelp.c.

901{
902 static const WCHAR path[] = {'t','e','s','t','x','x','.','e','x','e',0};
903 static const WCHAR PRODUCT_VERSION[] = {'1','.','0','.','0','.','1',0};
904 static const WCHAR FILE_DESCRIPTION[] = {'F','i','l','e','D','e','s','c','r','i','p','t','i','o','n',0};
905 static const WCHAR COMPANY_NAME[] = {'C','o','m','p','a','n','y','N','a','m','e',0};
906 static const WCHAR PRODUCT_NAME[] = {'P','r','o','d','u','c','t','N','a','m','e',0};
907 static const WCHAR FILE_VERSION[] = {'1','.','0','.','0','.','0',0};
908 static const WCHAR ORIGINAL_FILENAME[] = {'O','r','i','g','i','n','a','l','F','i','l','e','n','a','m','e',0};
909 static const WCHAR INTERNAL_NAME[] = {'I','n','t','e','r','n','a','l','N','a','m','e',0};
910 static const WCHAR LEGAL_COPYRIGHT[] = {'L','e','g','a','l','C','o','p','y','r','i','g','h','t',0};
911 static const WCHAR EXPORT_NAME[] = {'T','e','S','t','2','.','e','x','e',0};
912 static const WCHAR OS2_DESCRIPTION[] = {'M','O','D',' ','D','E','S','C','R','I','P','T','I','O','N',' ','H','E','R','E',0};
913 static const WCHAR OS2_EXPORT_NAME[] = {'T','E','S','T','M','O','D','.','h','X','x',0};
914 static const WCHAR OS2_DESCRIPTION_broken[] = {'Z',0};
915 static const WCHAR OS2_EXPORT_NAME_broken[] = {'E',0};
916
917 PATTRINFO pattrinfo = (PATTRINFO)0xdead;
918 DWORD num = 333;
919 BOOL ret;
920
921 /* ensure the file is not there. */
922 DeleteFileA("testxx.exe");
923 ret = pSdbGetFileAttributes(path, &pattrinfo, &num);
924 ok(ret == FALSE, "expected SdbGetFileAttributes to fail.\n");
925 ok(pattrinfo == (PATTRINFO)0xdead || pattrinfo == NULL, "expected the pointer not to change or to be NULL.\n");
926 ok(num == 333 || num == 0, "expected the number of items not to change or to be 0.\n");
927 if (ret)
928 pSdbFreeFileAttributes(pattrinfo);
929
930 /* Test a file with as much features as possible */
931 test_create_exe(L"testxx.exe", 0);
932
933 ret = pSdbGetFileAttributes(path, &pattrinfo, &num);
934 ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n");
935 ok(pattrinfo != (PATTRINFO)0xdead, "expected a valid pointer.\n");
936
937 //for (UINT n = 0; n < num; ++n)
938 //{
939 // trace("%S\n", pSdbTagToString(pattrinfo[n].type));
940 //}
941
942 switch(g_WinVersion)
943 {
944 case WINVER_2003:
945 g_AttrInfoSize = 26;
946 break;
947 case WINVER_VISTA:
948 g_AttrInfoSize = 27;
949 break;
950 case WINVER_WIN7:
951 g_AttrInfoSize = 28;
952 break;
953 case WINVER_WIN8:
954 case WINVER_WIN81:
955 g_AttrInfoSize = 43;
956 break;
957 case WINVER_WIN10:
958 g_AttrInfoSize = 38;
959 break;
960 default:
961 ok(0, "Unknown attrinfo size: %u\n", num);
962 break;
963 }
964
965 ok(num == g_AttrInfoSize, "expected %u items, got %d.\n", g_AttrInfoSize, num);
966
967#ifndef _M_IX86
969#else
970 if (num == g_AttrInfoSize && ret)
971#endif
972 {
973 expect_tag_dword(pattrinfo, TAG_SIZE, 0x800);
974 expect_tag_dword(pattrinfo, TAG_CHECKSUM, 0x178bd629);
975 expect_tag_qword(pattrinfo, TAG_BIN_FILE_VERSION, 0x1000000000000ull);
976 expect_tag_qword(pattrinfo, TAG_BIN_PRODUCT_VERSION, 0x1000000000001ull);
977 expect_tag_str(pattrinfo, TAG_PRODUCT_VERSION, PRODUCT_VERSION);
978 expect_tag_str(pattrinfo, TAG_FILE_DESCRIPTION, FILE_DESCRIPTION);
979 expect_tag_str(pattrinfo, TAG_COMPANY_NAME, COMPANY_NAME);
981 expect_tag_str(pattrinfo, TAG_FILE_VERSION, FILE_VERSION);
982 expect_tag_str(pattrinfo, TAG_ORIGINAL_FILENAME, ORIGINAL_FILENAME);
983 expect_tag_str(pattrinfo, TAG_INTERNAL_NAME, INTERNAL_NAME);
984 expect_tag_str(pattrinfo, TAG_LEGAL_COPYRIGHT, LEGAL_COPYRIGHT);
985 expect_tag_dword(pattrinfo, TAG_VERDATEHI, 0x1d1a019);
986 expect_tag_dword(pattrinfo, TAG_VERDATELO, 0xac754c50);
989 expect_tag_dword(pattrinfo, TAG_MODULE_TYPE, 0x3); /* Win32 */
990 expect_tag_dword(pattrinfo, TAG_PE_CHECKSUM, 0xBAAD);
991 expect_tag_dword(pattrinfo, TAG_LINKER_VERSION, 0x40002);
994 expect_tag_qword(pattrinfo, TAG_UPTO_BIN_FILE_VERSION, 0x1000000000000ull);
995 expect_tag_qword(pattrinfo, TAG_UPTO_BIN_PRODUCT_VERSION, 0x1000000000001ull);
996 expect_tag_dword(pattrinfo, TAG_LINK_DATE, 0x12345);
997 expect_tag_dword(pattrinfo, TAG_UPTO_LINK_DATE, 0x12345);
998 expect_tag_str(pattrinfo, TAG_EXPORT_NAME, EXPORT_NAME);
999 expect_tag_dword(pattrinfo, TAG_VER_LANGUAGE, 0xffff);
1000 expect_tag_dword(pattrinfo, TAG_EXE_WRAPPER, 0x0);
1001 }
1002 if (ret)
1003 pSdbFreeFileAttributes(pattrinfo);
1004
1005
1006 /* Disable resource and exports */
1007 test_create_exe(L"testxx.exe", 1);
1008
1009 ret = pSdbGetFileAttributes(path, &pattrinfo, &num);
1010 ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n");
1011 ok(pattrinfo != (PATTRINFO)0xdead, "expected a valid pointer.\n");
1012 ok(num == g_AttrInfoSize, "expected %u items, got %d.\n", g_AttrInfoSize, num);
1013
1014 if (num == g_AttrInfoSize && ret)
1015 {
1016 expect_tag_dword(pattrinfo, TAG_SIZE, 0x800);
1017#ifndef _M_IX86
1019 expect_tag_dword(pattrinfo, TAG_CHECKSUM, 0xea7caffd);
1020 else
1021 expect_tag_dword(pattrinfo, TAG_CHECKSUM, 0xea7cf1fd);
1022#else
1023 expect_tag_dword(pattrinfo, TAG_CHECKSUM, 0xea7caffd);
1024#endif
1025 //expect_tag_skip_range(pattrinfo, 2, 16);
1026 expect_tag_dword(pattrinfo, TAG_MODULE_TYPE, 0x3); /* Win32 */
1027 expect_tag_dword(pattrinfo, TAG_PE_CHECKSUM, 0xBAAD);
1028 expect_tag_dword(pattrinfo, TAG_LINKER_VERSION, 0x40002);
1029 //expect_tag_skip_range(pattrinfo, 19, 23);
1030 expect_tag_dword(pattrinfo, TAG_LINK_DATE, 0x12345);
1031 expect_tag_dword(pattrinfo, TAG_UPTO_LINK_DATE, 0x12345);
1032 expect_tag_skip(pattrinfo, TAG_EXPORT_NAME);
1034 expect_tag_dword(pattrinfo, TAG_EXE_WRAPPER, 0x0);
1035 }
1036 if (ret)
1037 pSdbFreeFileAttributes(pattrinfo);
1038
1039 /* A file with just 'MZ' */
1040 test_create_file(L"testxx.exe", "MZ", 2);
1041
1042 ret = pSdbGetFileAttributes(path, &pattrinfo, &num);
1043 ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n");
1044 ok(pattrinfo != (PATTRINFO)0xdead, "expected a valid pointer.\n");
1045 ok(num == g_AttrInfoSize, "expected %u items, got %d.\n", g_AttrInfoSize, num);
1046
1047 if (num == g_AttrInfoSize && ret)
1048 {
1049 expect_tag_dword(pattrinfo, TAG_SIZE, 0x2);
1050 expect_tag_dword(pattrinfo, TAG_CHECKSUM, 0);
1051 //expect_tag_skip_range(pattrinfo, 2, 16);
1052 expect_tag_dword(pattrinfo, TAG_MODULE_TYPE, 0x1);
1053 //expect_tag_skip_range(pattrinfo, 17, 26);
1055 expect_tag_skip(pattrinfo, TAG_EXE_WRAPPER);
1056 }
1057 if (ret)
1058 pSdbFreeFileAttributes(pattrinfo);
1059
1060 /* Empty file */
1061 test_create_file(L"testxx.exe", NULL, 0);
1062
1063 ret = pSdbGetFileAttributes(path, &pattrinfo, &num);
1064 ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n");
1065 ok(pattrinfo != (PATTRINFO)0xdead, "expected a valid pointer.\n");
1066 ok(num == g_AttrInfoSize, "expected %u items, got %d.\n", g_AttrInfoSize, num);
1067
1068 if (num == g_AttrInfoSize && ret)
1069 {
1070 expect_tag_dword(pattrinfo, TAG_SIZE, 0);
1071 //expect_tag_skip_range(pattrinfo, 1, 26);
1073 expect_tag_skip(pattrinfo, TAG_EXE_WRAPPER);
1074 }
1075 if (ret)
1076 pSdbFreeFileAttributes(pattrinfo);
1077
1078 /* minimal NE executable */
1079 test_create_ne(L"testxx.exe", 0);
1080
1081 ret = pSdbGetFileAttributes(path, &pattrinfo, &num);
1082 ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n");
1083 ok(pattrinfo != (PATTRINFO)0xdead, "expected a valid pointer.\n");
1084 ok(num == g_AttrInfoSize, "expected %u items, got %d.\n", g_AttrInfoSize, num);
1085
1086 if (num == g_AttrInfoSize && ret)
1087 {
1088 expect_tag_dword(pattrinfo, TAG_SIZE, 0xa8);
1089 expect_tag_dword(pattrinfo, TAG_CHECKSUM, 0xf2abe4e9);
1090 //expect_tag_skip_range(pattrinfo, 2, 16);
1091 expect_tag_dword(pattrinfo, TAG_MODULE_TYPE, 0x2);
1092 expect_tag_skip(pattrinfo, TAG_PE_CHECKSUM);
1094 expect_tag_str(pattrinfo, TAG_16BIT_DESCRIPTION, OS2_DESCRIPTION);
1095 expect_tag_str(pattrinfo, TAG_16BIT_MODULE_NAME, OS2_EXPORT_NAME);
1096 //expect_tag_skip_range(pattrinfo, 21, 26);
1098 expect_tag_skip(pattrinfo, TAG_EXE_WRAPPER);
1099 }
1100 if (ret)
1101 pSdbFreeFileAttributes(pattrinfo);
1102
1103 /* NE executable with description / module name pointers zero, to show they are always used */
1104 test_create_ne(L"testxx.exe", 1);
1105
1106 ret = pSdbGetFileAttributes(path, &pattrinfo, &num);
1107 ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n");
1108 ok(pattrinfo != (PATTRINFO)0xdead, "expected a valid pointer.\n");
1109 ok(num == g_AttrInfoSize, "expected %u items, got %d.\n", g_AttrInfoSize, num);
1110
1111 if (num == g_AttrInfoSize && ret)
1112 {
1113 expect_tag_dword(pattrinfo, TAG_SIZE, 0xa8);
1114 expect_tag_dword(pattrinfo, TAG_CHECKSUM, 0xddcbe4c9);
1115 //expect_tag_skip_range(pattrinfo, 2, 16);
1116 expect_tag_dword(pattrinfo, TAG_MODULE_TYPE, 0x2);
1117 expect_tag_skip(pattrinfo, TAG_PE_CHECKSUM);
1119 expect_tag_str(pattrinfo, TAG_16BIT_DESCRIPTION, OS2_DESCRIPTION_broken); /* the 'Z' from 'MZ' */
1120 expect_tag_str(pattrinfo, TAG_16BIT_MODULE_NAME, OS2_EXPORT_NAME_broken); /* the 'E' from 'NE' */
1121 //expect_tag_skip_range(pattrinfo, 21, 26);
1123 expect_tag_skip(pattrinfo, TAG_EXE_WRAPPER);
1124 }
1125 if (ret)
1126 pSdbFreeFileAttributes(pattrinfo);
1127
1128 test_crc(1, 0);
1129 test_crc(2, 0);
1130 test_crc(3, 0);
1131 test_crc(4, 0x2020202);
1132 test_crc(5, 0x2020202);
1133 test_crc(6, 0x2020202);
1134 test_crc(7, 0x2020202);
1135 test_crc(8, 0x81818181);
1136 test_crc(9, 0x81818181);
1137 test_crc(10, 0x81818181);
1138 test_crc(11, 0x81818181);
1139 test_crc(12, 0xc2c2c2c2);
1140 test_crc(16, 0x62626262);
1141
1142 /* This seems to be the cutoff point */
1143 test_crc2(0xffc, 4, 0xfbfbfcfc);
1144 test_crc2(0xffc, 8, 0x7070717);
1145 test_crc2(0xffc, 0xcc, 0xc8eba002);
1146 test_crc2(0xffc, 0, 0x4622028d);
1147
1148 test_crc2(0x1000, 4, 0x80);
1149 test_crc2(0x1000, 8, 0x8787878f);
1150 test_crc2(0x1000, 0xcc, 0x4adc3667);
1151 test_crc2(0x1000, 0, 0xa3108044);
1152
1153 /* Here is another cutoff point */
1154 test_crc2(0x11fc, 4, 0x80);
1155 test_crc2(0x11fc, 8, 0x8787878f);
1156 test_crc2(0x11fc, 0xcc, 0x4adc3667);
1157 test_crc2(0x11fc, 0, 0xf03e0800);
1158
1159 test_crc2(0x1200, 4, 0x80);
1160 test_crc2(0x1200, 8, 0x8787878f);
1161 test_crc2(0x1200, 0xcc, 0x4adc3667);
1162 test_crc2(0x1200, 0, 0xa3108044);
1163
1164 /* After that, it stays the same for all sizes */
1165 test_crc2(0xf000, 4, 0x80);
1166 test_crc2(0xf000, 8, 0x8787878f);
1167 test_crc2(0xf000, 0xcc, 0x4adc3667);
1168 test_crc2(0xf000, 0, 0xa3108044);
1169
1170
1171 DeleteFileA("testxx.exe");
1172}
#define PRODUCT_NAME
#define test_create_ne
#define WINVER_WIN10
#define WINVER_2003
#define test_create_exe
#define test_create_file
#define WINVER_WIN81
#define WINVER_WIN7
#define WINVER_WIN8
#define WINVER_VISTA
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
#define TAG_UPTO_BIN_FILE_VERSION
Definition: apphelp.c:62
#define test_crc2
Definition: apphelp.c:808
#define TAG_ORIGINAL_FILENAME
Definition: apphelp.c:69
#define TAG_LINKER_VERSION
Definition: apphelp.c:55
#define TAG_16BIT_DESCRIPTION
Definition: apphelp.c:72
#define TAG_UPTO_LINK_DATE
Definition: apphelp.c:57
#define TAG_SIZE
Definition: apphelp.c:46
#define TAG_FILE_DESCRIPTION
Definition: apphelp.c:67
#define TAG_VERFILETYPE
Definition: apphelp.c:52
#define TAG_BIN_FILE_VERSION
Definition: apphelp.c:59
#define expect_tag_dword
Definition: apphelp.c:797
#define TAG_VERFILEOS
Definition: apphelp.c:51
struct tagATTRINFO * PATTRINFO
#define TAG_VERDATEHI
Definition: apphelp.c:49
#define TAG_EXE_WRAPPER
Definition: apphelp.c:58
#define TAG_VER_LANGUAGE
Definition: apphelp.c:54
#define expect_tag_skip
Definition: apphelp.c:795
#define TAG_UPTO_BIN_PRODUCT_VERSION
Definition: apphelp.c:61
#define TAG_FILE_VERSION
Definition: apphelp.c:68
#define TAG_LEGAL_COPYRIGHT
Definition: apphelp.c:71
#define TAG_PRODUCT_NAME
Definition: apphelp.c:65
#define TAG_EXPORT_NAME
Definition: apphelp.c:74
#define TAG_CHECKSUM
Definition: apphelp.c:47
#define TAG_PE_CHECKSUM
Definition: apphelp.c:53
#define test_crc
Definition: apphelp.c:807
#define TAG_VERDATELO
Definition: apphelp.c:50
#define expect_tag_empty
Definition: apphelp.c:796
#define TAG_COMPANY_NAME
Definition: apphelp.c:64
#define TAG_LINK_DATE
Definition: apphelp.c:56
#define expect_tag_qword
Definition: apphelp.c:798
#define TAG_16BIT_MODULE_NAME
Definition: apphelp.c:73
#define TAG_BIN_PRODUCT_VERSION
Definition: apphelp.c:60
#define TAG_INTERNAL_NAME
Definition: apphelp.c:70
#define expect_tag_str
Definition: apphelp.c:799
#define TAG_MODULE_TYPE
Definition: apphelp.c:48
#define TAG_PRODUCT_VERSION
Definition: apphelp.c:66
#define VOS__WINDOWS32
Definition: verrsrc.h:64
#define VFT_APP
Definition: verrsrc.h:75
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

◆ test_crc2_imp()

static void test_crc2_imp ( DWORD  len,
int  fill,
DWORD  expected 
)
static

Definition at line 872 of file apphelp.c.

873{
874 static const WCHAR path[] = {'t','e','s','t','x','x','.','e','x','e',0};
875
876 PATTRINFO pattrinfo = (PATTRINFO)0xdead;
877 DWORD num = 333;
878 BOOL ret;
879 size_t n;
880 char* crc_test = malloc(len);
881 for (n = 0; n < len; ++n)
882 crc_test[n] = (char)(fill ? fill : n);
883
884 test_create_file_imp(L"testxx.exe", crc_test, len);
885 free(crc_test);
886 ret = pSdbGetFileAttributes(path, &pattrinfo, &num);
887 winetest_ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n");
888 winetest_ok(pattrinfo != (PATTRINFO)0xdead, "expected a valid pointer.\n");
889 winetest_ok(num == g_AttrInfoSize, "expected %u items, got %d.\n", g_AttrInfoSize, num);
890
891 if (num == g_AttrInfoSize && ret)
892 {
893 expect_tag_dword_imp(pattrinfo, TAG_SIZE, len);
895 }
896 if (ret)
897 pSdbFreeFileAttributes(pattrinfo);
898}
_STLP_MOVE_TO_STD_NAMESPACE void fill(_ForwardIter __first, _ForwardIter __last, const _Tp &__val)
Definition: _algobase.h:449
void test_create_file_imp(const WCHAR *name, const char *contents, size_t len)
Definition: data.c:555
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
GLenum GLsizei len
Definition: glext.h:6722
static void expect_tag_dword_imp(PATTRINFO pattr, TAG tag, DWORD value)
Definition: apphelp.c:753
BOOL expected
Definition: store.c:2063

◆ test_crc_imp()

static void test_crc_imp ( size_t  len,
DWORD  expected 
)
static

Definition at line 849 of file apphelp.c.

850{
851 static const WCHAR path[] = {'t','e','s','t','x','x','.','e','x','e',0};
852 static char crc_test[] = {4, 4, 4, 4, 1, 1, 1, 1, 4, 4, 4, 4, 2, 2, 2, 2};
853
854 PATTRINFO pattrinfo = (PATTRINFO)0xdead;
855 DWORD num = 333;
856 BOOL ret;
857
858 test_create_file_imp(L"testxx.exe", crc_test, len);
859 ret = pSdbGetFileAttributes(path, &pattrinfo, &num);
860 winetest_ok(ret != FALSE, "expected SdbGetFileAttributes to succeed.\n");
861 winetest_ok(pattrinfo != (PATTRINFO)0xdead, "expected a valid pointer.\n");
862 winetest_ok(num == g_AttrInfoSize, "expected %u items, got %d.\n", g_AttrInfoSize, num);
863
864 if (num == g_AttrInfoSize && ret)
865 {
867 }
868 if (ret)
869 pSdbFreeFileAttributes(pattrinfo);
870}

◆ test_GuidFunctions()

static void test_GuidFunctions ( void  )
static

Definition at line 614 of file apphelp.c.

615{
616 GUID guid;
617 ok(pSdbIsNullGUID(&GUID_NULL), "expected GUID_NULL to be recognized as NULL GUID\n");
618 ok(pSdbIsNullGUID(NULL), "expected NULL to be recognized as NULL GUID\n");
619 ok(pSdbIsNullGUID(&test_UserAssist) == 0, "expected a set GUID not to be recognized as NULL GUID\n");
620
621 memset(&guid, 0, sizeof(guid));
622 ok(pSdbGetStandardDatabaseGUID(0, &guid) == 0,"Expected SdbGetStandardDatabaseGUID to fail\n");
623 ok(IsEqualGUID(&GUID_NULL, &guid), "Expected guid not to be changed\n");
624
625 ok(pSdbGetStandardDatabaseGUID(0x80020000, NULL),"Expected SdbGetStandardDatabaseGUID to succeed\n");
626
627 memset(&guid, 0, sizeof(guid));
628 ok(pSdbGetStandardDatabaseGUID(0x80020000, &guid),"Expected SdbGetStandardDatabaseGUID to succeed\n");
629 ok(IsEqualGUID(&GUID_DATABASE_MSI, &guid), "Expected guid to equal GUID_DATABASE_MSI, was: %s\n", wine_dbgstr_guid(&guid));
630
631 memset(&guid, 0, sizeof(guid));
632 ok(pSdbGetStandardDatabaseGUID(0x80030000, &guid),"Expected SdbGetStandardDatabaseGUID to succeed\n");
633 ok(IsEqualGUID(&GUID_DATABASE_SHIM, &guid), "Expected guid to equal GUID_DATABASE_SHIM, was: %s\n", wine_dbgstr_guid(&guid));
634
635 memset(&guid, 0, sizeof(guid));
636 ok(pSdbGetStandardDatabaseGUID(0x80040000, &guid),"Expected SdbGetStandardDatabaseGUID to succeed\n");
637 ok(IsEqualGUID(&GUID_DATABASE_DRIVERS, &guid), "Expected guid to equal GUID_DATABASE_DRIVERS, was: %s\n", wine_dbgstr_guid(&guid));
638}
GUID guid
Definition: version.c:147
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
static const GUID GUID_DATABASE_DRIVERS
Definition: sdbapi.c:18
static const GUID GUID_DATABASE_MSI
Definition: sdbapi.c:16
static const GUID GUID_DATABASE_SHIM
Definition: sdbapi.c:17
#define memset(x, y, z)
Definition: compat.h:39

Referenced by START_TEST().

◆ test_onefile()

void test_onefile ( WCHAR filename)

Definition at line 810 of file apphelp.c.

811{
812 PATTRINFO pattrinfo;
813 DWORD num;
814
815 if (!pSdbFreeFileAttributes)
816 {
817 hdll = LoadLibraryA("apphelp.dll");
818 pSdbTagToString = (void *)GetProcAddress(hdll, "SdbTagToString");
819 pSdbGetFileAttributes = (void *)GetProcAddress(hdll, "SdbGetFileAttributes");
820 pSdbFreeFileAttributes = (void *)GetProcAddress(hdll, "SdbFreeFileAttributes");
821 }
822
823 if (pSdbGetFileAttributes(filename, &pattrinfo, &num))
824 {
825 if (pattrinfo[16].flags == ATTRIBUTE_AVAILABLE)
826 {
827 if (pattrinfo[16].type != TAG_MODULE_TYPE)//SdbpSetAttrFail(&attr_info[16]); /* TAG_MODULE_TYPE (1: WIN16?) (3: WIN32?) (WIN64?), Win32VersionValue? */)
828 printf("FAIL TAG_MODULE_TYPE (%S)\n", filename);
829 if (pattrinfo[16].dwattr != 3 && pattrinfo[16].dwattr != 2)
830 printf("TAG_MODULE_TYPE(%S): %d\n", filename, pattrinfo[16].dwattr); // C:\Program Files (x86)\Windows Kits\8.1\Lib\win7\stub512.com
831 if (pattrinfo[16].dwattr == 2)
832 {
833 printf("TAG_MODULE_TYPE(%S): %d, %d\n", filename, pattrinfo[16].dwattr, pattrinfo[0].dwattr);
834 }
835 }
836
837 if (pattrinfo[27].flags == ATTRIBUTE_AVAILABLE)
838 {
839 if (pattrinfo[27].type != TAG_EXE_WRAPPER)
840 printf("FAIL TAG_EXE_WRAPPER (%S)\n", filename);
841 if (pattrinfo[27].dwattr != 0)
842 printf("TAG_EXE_WRAPPER(%S): %d\n", filename, pattrinfo[27].dwattr);
843 }
844
845 pSdbFreeFileAttributes(pattrinfo);
846 }
847}
#define GetProcAddress(x, y)
Definition: compat.h:753
#define printf
Definition: freeldr.h:97
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
const char * filename
Definition: ioapi.h:137

◆ test_SdbGetAppPatchDir()

static void test_SdbGetAppPatchDir ( void  )
static

Definition at line 1175 of file apphelp.c.

1176{
1179 int n;
1180
1181
1182 _SEH2_TRY
1183 {
1184 hr = pSdbGetAppPatchDir(NULL, NULL, 0);
1186 ok_hex(hr, S_FALSE);
1187 else
1188 ok_hex(hr, S_OK);
1189 }
1191 {
1192 /* Some versions accept it, some don't */
1193 trace("SdbGetAppPatchDir did not handle a NULL pointer very gracefully.\n");
1194 }
1195 _SEH2_END;
1196
1197
1198
1199 memset(Buffer, 0xbb, sizeof(Buffer));
1200 hr = pSdbGetAppPatchDir(NULL, Buffer, 0);
1203 else if (g_WinVersion < WINVER_WIN10)
1204 expect_hr = S_OK;
1205 else
1208
1211 else if (g_WinVersion <= WINVER_WIN10)
1212 expect_hr = S_OK;
1213 else
1214 expect_hr = TRUE;
1215
1216 memset(Buffer, 0xbb, sizeof(Buffer));
1217 hr = pSdbGetAppPatchDir(NULL, Buffer, 1);
1219
1220
1221 for (n = 2; n < _countof(Buffer) - 1; ++n)
1222 {
1223 memset(Buffer, 0xbb, sizeof(Buffer));
1224 hr = pSdbGetAppPatchDir(NULL, Buffer, n);
1225 ok(Buffer[n] == 0xbbbb, "Expected SdbGetAppPatchDir to leave WCHAR at %d untouched, was: %d\n",
1226 n, Buffer[n]);
1227 ok(hr == S_OK || hr == expect_hr, "Expected S_OK or 0x%x, was: 0x%x (at %d)\n", expect_hr, hr, n);
1228 }
1229}
#define ok_hex(expression, result)
Definition: atltest.h:94
Definition: bufpool.h:45
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define MAX_PATH
Definition: compat.h:34
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define S_OK
Definition: intsafe.h:52
#define expect_hr(expected, got)
Definition: assoc.c:27
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:82
#define _SEH2_END
Definition: pseh2_64.h:171
#define _SEH2_TRY
Definition: pseh2_64.h:71
HRESULT hr
Definition: shlfolder.c:183
#define _countof(array)
Definition: sndvol32.h:70
#define S_FALSE
Definition: winerror.h:2357
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92

Referenced by START_TEST().

◆ test_SdbTagToString()

static void test_SdbTagToString ( void  )
static

Definition at line 167 of file apphelp.c.

168{
169 static const TAG invalid_values[] = {
171 TAG_TYPE_DWORD | 0xFF,
172 TAG_TYPE_DWORD | (0x800 + 0xEE),
173 0x900, 0xFFFF, 0xDEAD, 0xBEEF
174 };
175 static const WCHAR invalid[] = {'I','n','v','a','l','i','d','T','a','g',0};
176 LPCWSTR ret;
177 WORD i;
178
179 for (i = 0; i < 9; ++i)
180 {
181 ret = pSdbTagToString(invalid_values[i]);
182 ok(lstrcmpW(ret, invalid) == 0, "unexpected string %s, should be %s\n",
184 }
185}
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4246
unsigned short WORD
Definition: ntddk_ex.h:93
#define TAG_TYPE_DWORD
Definition: apphelp.c:39
#define TAG_TYPE_WORD
Definition: apphelp.c:38
#define TAG_TYPE_MASK
Definition: apphelp.c:34
static const WCHAR invalid[]
Definition: assoc.c:39
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by START_TEST().

◆ test_SdbTagToStringAllTags()

static void test_SdbTagToStringAllTags ( void  )
static

Definition at line 601 of file apphelp.c.

602{
603 int n;
604 for (n = 0; data[n].base; ++n)
605 {
606 if ((data[n].min_ver == WINVER_ANY || g_WinVersion >= data[n].min_ver) &&
608 {
610 }
611 }
612}
#define WINVER_ANY
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
const char * tags[99]
Definition: apphelp.c:216
void test_tag(TAG base, const char *names[], size_t upperlimit, int line)
Definition: apphelp.c:194
DWORD min_ver
Definition: apphelp.c:214
DWORD upper_limit
Definition: apphelp.c:212
DWORD max_ver
Definition: apphelp.c:215
Definition: parser.c:49

Referenced by START_TEST().

◆ test_tag()

void test_tag ( TAG  base,
const char names[],
size_t  upperlimit,
int  line 
)

Definition at line 194 of file apphelp.c.

195{
196 TAG n;
197 for (n = 0; names[n]; ++n)
198 {
199 LPCWSTR tagstr = pSdbTagToString(base | n);
200 ok_(__FILE__, line + 2)(!strcmp_wa(tagstr, names[n]), "Got %s instead of '%s' for %x\n", wine_dbgstr_w(tagstr), names[n], base | n);
201 }
202 for (; n < upperlimit; ++n)
203 {
204 LPCWSTR tagstr = pSdbTagToString(base | n);
205 ok_(__FILE__, line + 2)(!strcmp_wa(tagstr, "InvalidTag"), "Got %s instead of 'InvalidTag' for %x\n", wine_dbgstr_w(tagstr), base | n);
206 }
207}
#define ok_(x1, x2)
Definition: atltest.h:61
GLuint GLuint * names
Definition: glext.h:11545
static int strcmp_wa(LPCWSTR strw, const char *stra)
Definition: apphelp.c:187

Referenced by test_SdbTagToStringAllTags().

Variable Documentation

◆ base

Definition at line 211 of file apphelp.c.

◆ BOOL

Definition at line 91 of file apphelp.c.

◆ 

struct { ... } data[]

◆ g_AttrInfoSize

DWORD g_AttrInfoSize
static

Definition at line 99 of file apphelp.c.

Referenced by find_tag(), test_ApplicationAttributes(), test_crc2_imp(), and test_crc_imp().

◆ g_Tags_26

◆ g_Tags_28

TAG g_Tags_28[]
static

Definition at line 670 of file apphelp.c.

Referenced by find_tag().

◆ Guid

Definition at line 95 of file apphelp.c.

◆ GuidString

PWSTR GuidString

Definition at line 93 of file apphelp.c.

Referenced by ApphelpCheckShellObject(), BcdOpenObject(), BiConvertRegistryDataToElement(), CreateNewVolumeName(), CreateNoDriveLetterEntry(), DumpAutomationTable(), EfiInitpCreateApplicationEntry(), GetInterfaceNameInternal(), CPortPinWavePci::HandleKsProperty(), CPortPinWaveRT::HandleKsProperty(), IKsClock_DispatchDeviceIoControl(), IKsFilter_DispatchDeviceIoControl(), IKsPin_DispatchDeviceIoControl(), InitializeMachineInformation(), IopBuildSymbolicLink(), IopOpenInterfaceKey(), IopSeparateSymbolicLink(), IopStartRamdisk(), IoRegisterDeviceInterface(), IoSetDeviceInterfaceState(), KsCacheMedium(), KspCreatePin(), KspEnableEvent(), KspPinPropertyHandler(), KspReadMediaCategory(), KspValidateConnectRequest(), MMixerGetDeviceNameWithComponentId(), ok_keys_(), OpenRegistryHandlesFromSymbolicLink(), PciQueryInterface(), PcNewPort(), CUnregisterPhysicalConnection::QueryInterface(), CDrmPort2::QueryInterface(), CInterruptSync::QueryInterface(), CPortDMus::QueryInterface(), CPortTopology::QueryInterface(), CPortWaveCyclic::QueryInterface(), CPortWavePci::QueryInterface(), CPortWaveRT::QueryInterface(), CRegistryKey::QueryInterface(), CResourceList::QueryInterface(), CServiceGroup::QueryInterface(), CUnregisterSubdevice::QueryInterface(), CPortClsVersion::QueryInterface(), RamdiskCreateDiskDevice(), RtlStringFromGUID(), SdbGUIDFromString(), SdbGUIDToString(), SysAudioHandleProperty(), test_GetInterfaceName(), Test_IoGetDeviceInterfaces(), USBAudioInitComponentId(), WINTRUST_Guid2Wstr(), WINTRUST_ReadProviderFromReg(), WINTRUST_RemoveProviderFromReg(), WINTRUST_WriteProviderToReg(), WintrustAddActionID(), WintrustAddDefaultForUsage(), WintrustLoadFunctionPointers(), WintrustRemoveActionID(), WmipGUIDFromString(), and WmipOpenGuidObjectByName().

◆ hdll

HMODULE hdll
static

Definition at line 90 of file apphelp.c.

Referenced by START_TEST(), and test_onefile().

◆ Length

Definition at line 93 of file apphelp.c.

Referenced by ApphelpCacheWrite().

◆ line

Definition at line 213 of file apphelp.c.

◆ max_ver

DWORD max_ver

Definition at line 215 of file apphelp.c.

Referenced by test_SdbTagToStringAllTags().

◆ min_ver

DWORD min_ver

Definition at line 214 of file apphelp.c.

Referenced by test_SdbTagToStringAllTags(), and test_source_iface().

◆ objects

const CLSID* objects[]
static

◆ path

Definition at line 98 of file apphelp.c.

◆ pdwAttrCount

PATTRINFO LPDWORD pdwAttrCount

Definition at line 96 of file apphelp.c.

◆ ppAttrInfo

PATTRINFO* ppAttrInfo

Definition at line 96 of file apphelp.c.

◆ size

Definition at line 98 of file apphelp.c.

◆ tags

◆ upper_limit

DWORD upper_limit