Author: mjansen
Date: Sun Nov 27 18:33:21 2016
New Revision: 73398
URL:
http://svn.reactos.org/svn/reactos?rev=73398&view=rev
Log:
[APPHELP][APPHELP_APITEST] Stub ApphelpCheckShellObject + add tests, based on the work of
Mislav Blažević. CORE-12476
Modified:
trunk/reactos/dll/appcompat/apphelp/apphelp.c
trunk/reactos/dll/appcompat/apphelp/apphelp.h
trunk/reactos/dll/appcompat/apphelp/apphelp.spec
trunk/rostests/apitests/apphelp/apphelp.c
Modified: trunk/reactos/dll/appcompat/apphelp/apphelp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/apph…
==============================================================================
--- trunk/reactos/dll/appcompat/apphelp/apphelp.c [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/apphelp.c [iso-8859-1] Sun Nov 27 18:33:21 2016
@@ -82,10 +82,23 @@
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.
Modified: trunk/reactos/dll/appcompat/apphelp/apphelp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/apph…
==============================================================================
--- trunk/reactos/dll/appcompat/apphelp/apphelp.h [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/apphelp.h [iso-8859-1] Sun Nov 27 18:33:21 2016
@@ -85,6 +85,7 @@
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);
Modified: trunk/reactos/dll/appcompat/apphelp/apphelp.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/apph…
==============================================================================
--- trunk/reactos/dll/appcompat/apphelp/apphelp.spec [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/apphelp.spec [iso-8859-1] Sun Nov 27 18:33:21
2016
@@ -4,7 +4,7 @@
@ stub ApphelpCheckMsiPackage
@ stub ApphelpCheckRunApp
@ stub ApphelpCheckRunAppEx
-@ stub ApphelpCheckShellObject
+@ stdcall ApphelpCheckShellObject(ptr long ptr)
@ stub ApphelpCreateAppcompatData
@ stub ApphelpFixMsiPackage
@ stub ApphelpFixMsiPackageExe
Modified: trunk/rostests/apitests/apphelp/apphelp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/apphelp/apphelp.…
==============================================================================
--- trunk/rostests/apitests/apphelp/apphelp.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/apphelp/apphelp.c [iso-8859-1] Sun Nov 27 18:33:21 2016
@@ -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 @@
} 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_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 @@
//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 @@
pSdbGetFileAttributes = (void *) GetProcAddress(hdll,
"SdbGetFileAttributes");
pSdbFreeFileAttributes = (void *) GetProcAddress(hdll,
"SdbFreeFileAttributes");
+ test_ApphelpCheckShellObject();
test_GuidFunctions();
test_ApplicationAttributes();
test_SdbTagToString();