[APPHELP][APPHELP_APITEST] Stub ApphelpCheckShellObject + add tests, based on the work of Mislav Blažević. CORE-12476

svn path=/trunk/; revision=73398
This commit is contained in:
Mark Jansen 2016-11-27 18:33:21 +00:00
parent 7fe41a4b39
commit 26627a49b0
4 changed files with 80 additions and 2 deletions

View file

@ -82,11 +82,24 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
BOOL WINAPI ApphelpCheckInstallShieldPackage(void* ptr, LPCWSTR path)
{
SHIM_WARN("stub: ptr=%p path='%S'\r\n", ptr, path);
SHIM_WARN("stub: ptr=%p, path='%S'\r\n", ptr, path);
return TRUE;
}
BOOL WINAPI ApphelpCheckShellObject(REFCLSID ObjectCLSID, BOOL bShimIfNecessary, ULONGLONG *pullFlags)
{
WCHAR GuidString[100];
if (!ObjectCLSID || !SdbGUIDToString(ObjectCLSID, GuidString, 100))
GuidString[0] = L'\0';
SHIM_WARN("stub: ObjectCLSID='%S', bShimIfNecessary=%d, pullFlags=%p)\n", GuidString, bShimIfNecessary, pullFlags);
if (pullFlags)
*pullFlags = 0;
return TRUE;
}
/**
* Outputs diagnostic info.
*

View file

@ -85,6 +85,7 @@ typedef struct tagSDBQUERYRESULT {
PWSTR SdbpStrDup(LPCWSTR string);
HSDB WINAPI SdbInitDatabase(DWORD, LPCWSTR);
void WINAPI SdbReleaseDatabase(HSDB);
BOOL WINAPI SdbGUIDToString(CONST GUID *Guid, PWSTR GuidString, SIZE_T Length);
PDB WINAPI SdbOpenDatabase(LPCWSTR path, PATH_TYPE type);
void WINAPI SdbCloseDatabase(PDB);

View file

@ -4,7 +4,7 @@
@ stub ApphelpCheckMsiPackage
@ stub ApphelpCheckRunApp
@ stub ApphelpCheckRunAppEx
@ stub ApphelpCheckShellObject
@ stdcall ApphelpCheckShellObject(ptr long ptr)
@ stub ApphelpCreateAppcompatData
@ stub ApphelpFixMsiPackage
@ stub ApphelpFixMsiPackageExe

View file

@ -33,6 +33,8 @@
#include <winerror.h>
#include <stdio.h>
#include <initguid.h>
#include <shlguid.h>
#include <shobjidl.h>
#include "wine/test.h"
@ -101,6 +103,7 @@ typedef struct tagATTRINFO {
} ATTRINFO, *PATTRINFO;
static HMODULE hdll;
static BOOL (WINAPI *pApphelpCheckShellObject)(REFCLSID, BOOL, ULONGLONG *);
static LPCWSTR (WINAPI *pSdbTagToString)(TAG);
static BOOL (WINAPI *pSdbGUIDToString)(CONST GUID *, PCWSTR, SIZE_T);
static BOOL (WINAPI *pSdbIsNullGUID)(CONST GUID *);
@ -114,7 +117,65 @@ DEFINE_GUID(GUID_DATABASE_SHIM,0x11111111,0x1111,0x1111,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 const CLSID * objects[] = {
&GUID_NULL,
/* used by IE */
&test_Microsoft_Browser_Architecture,
&CLSID_MenuBand,
&CLSID_ShellLink,
&CLSID_ShellWindows,
&CLSID_InternetSecurityManager,
&test_UserAssist,
(const CLSID *)NULL
};
static void test_ApphelpCheckShellObject(void)
{
ULONGLONG flags;
BOOL res;
int i;
if (!pApphelpCheckShellObject)
{
win_skip("ApphelpCheckShellObject not available\n");
return;
}
for (i = 0; objects[i]; i++)
{
flags = 0xdeadbeef;
SetLastError(0xdeadbeef);
res = pApphelpCheckShellObject(objects[i], FALSE, &flags);
ok(res && (flags == 0), "%s 0: got %d and 0x%x%08x with 0x%x (expected TRUE and 0)\n",
wine_dbgstr_guid(objects[i]), res, (ULONG)(flags >> 32), (ULONG)flags, GetLastError());
flags = 0xdeadbeef;
SetLastError(0xdeadbeef);
res = pApphelpCheckShellObject(objects[i], TRUE, &flags);
ok(res && (flags == 0), "%s 1: got %d and 0x%x%08x with 0x%x (expected TRUE and 0)\n",
wine_dbgstr_guid(objects[i]), res, (ULONG)(flags >> 32), (ULONG)flags, GetLastError());
}
/* NULL as pointer to flags is checked */
SetLastError(0xdeadbeef);
res = pApphelpCheckShellObject(&GUID_NULL, FALSE, NULL);
ok(res, "%s 0: got %d with 0x%x (expected != FALSE)\n", wine_dbgstr_guid(&GUID_NULL), res, GetLastError());
/* NULL as CLSID* crash on Windows */
if (0)
{
flags = 0xdeadbeef;
SetLastError(0xdeadbeef);
res = pApphelpCheckShellObject(NULL, FALSE, &flags);
trace("NULL as CLSID*: got %d and 0x%x%08x with 0x%x\n", res, (ULONG)(flags >> 32), (ULONG)flags, GetLastError());
}
}
static void test_SdbTagToString(void)
{
@ -834,6 +895,8 @@ START_TEST(apphelp)
//SetEnvironmentVariable("SHIM_DEBUG_LEVEL", "4");
//SetEnvironmentVariable("DEBUGCHANNEL", "+apphelp");
hdll = LoadLibraryA("apphelp.dll");
pApphelpCheckShellObject = (void *) GetProcAddress(hdll, "ApphelpCheckShellObject");
pSdbTagToString = (void *) GetProcAddress(hdll, "SdbTagToString");
pSdbGUIDToString = (void *) GetProcAddress(hdll, "SdbGUIDToString");
pSdbIsNullGUID = (void *) GetProcAddress(hdll, "SdbIsNullGUID");
@ -841,6 +904,7 @@ START_TEST(apphelp)
pSdbGetFileAttributes = (void *) GetProcAddress(hdll, "SdbGetFileAttributes");
pSdbFreeFileAttributes = (void *) GetProcAddress(hdll, "SdbFreeFileAttributes");
test_ApphelpCheckShellObject();
test_GuidFunctions();
test_ApplicationAttributes();
test_SdbTagToString();