mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 11:51:58 +00:00
[SHLWAPI_APITEST] Fix heap assertion and test failures (#8217)
- Properly initialize a string in SHPropertyBag test. This prevents a heap assertion failure on Vista+ when freed and connected to a debugger. - Adjust a value against Windows 8+ instead of Vista as originally assumed in the IsQSForward test. - Use GetVersion() to check if we are running on NT6+ and test appropriately in the PathIsUNC and PathIsUNCServer tests.
This commit is contained in:
parent
375fca5058
commit
a993c589ae
4 changed files with 21 additions and 10 deletions
|
@ -13,7 +13,7 @@
|
|||
#include <pseh/pseh2.h>
|
||||
#include <versionhelpers.h>
|
||||
|
||||
static BOOL g_bVista = FALSE;
|
||||
static const BOOL g_bWin8 = IsWindows8OrGreater();
|
||||
|
||||
static HRESULT
|
||||
IsQSForwardMockup(_In_opt_ const GUID *pguidCmdGroup, _In_ ULONG cCmds, _In_ OLECMD *prgCmds)
|
||||
|
@ -63,7 +63,7 @@ IsQSForwardMockup(_In_opt_ const GUID *pguidCmdGroup, _In_ ULONG cCmds, _In_ OLE
|
|||
{
|
||||
if (!IsEqualGUID(CGID_Explorer, *pguidCmdGroup))
|
||||
{
|
||||
if (g_bVista)
|
||||
if (g_bWin8)
|
||||
return OLECMDERR_E_UNKNOWNGROUP;
|
||||
else
|
||||
return OLECMDERR_E_NOTSUPPORTED;
|
||||
|
@ -363,8 +363,6 @@ static VOID TEST_MayExecForwardMockup(VOID)
|
|||
|
||||
START_TEST(IsQSForward)
|
||||
{
|
||||
g_bVista = IsWindowsVistaOrGreater();
|
||||
|
||||
TEST_IsQSForward();
|
||||
TEST_MayQSForwardMockup();
|
||||
TEST_MayExecForwardMockup();
|
||||
|
|
|
@ -40,8 +40,10 @@ START_TEST(isuncpath)
|
|||
DO_TEST(FALSE, L"path1");
|
||||
DO_TEST(FALSE, L"c:\\path1");
|
||||
|
||||
/* MSDN says FALSE but the test shows TRUE on Windows 2003, but returns FALSE on Windows 7 */
|
||||
DO_TEST(TRUE, L"\\\\?\\c:\\path1");
|
||||
if (GetNTVersion() >= _WIN32_WINNT_VISTA)
|
||||
DO_TEST(FALSE, L"\\\\?\\c:\\path1");
|
||||
else
|
||||
DO_TEST(TRUE, L"\\\\?\\c:\\path1");
|
||||
|
||||
DO_TEST(TRUE, L"\\\\path1\\");
|
||||
DO_TEST(FALSE, L"//");
|
||||
|
@ -53,6 +55,8 @@ START_TEST(isuncpath)
|
|||
DO_TEST(FALSE, (wchar_t*)NULL);
|
||||
DO_TEST(FALSE, L" ");
|
||||
|
||||
/* The test shows TRUE on Windows 2003, but returns FALSE on Windows 7 */
|
||||
DO_TEST(TRUE, L"\\\\?\\");
|
||||
if (GetNTVersion() >= _WIN32_WINNT_VISTA)
|
||||
DO_TEST(FALSE, L"\\\\?\\");
|
||||
else
|
||||
DO_TEST(TRUE, L"\\\\?\\");
|
||||
}
|
||||
|
|
|
@ -39,6 +39,8 @@ START_TEST(isuncpathserver)
|
|||
DO_TEST(FALSE, L"");
|
||||
DO_TEST(FALSE, L" ");
|
||||
|
||||
/* The test shows TRUE on Windows 2003, but returns FALSE on Windows 7 */
|
||||
DO_TEST(TRUE, L"\\\\?");
|
||||
if (GetNTVersion() >= _WIN32_WINNT_VISTA)
|
||||
DO_TEST(FALSE, L"\\\\?");
|
||||
else
|
||||
DO_TEST(TRUE, L"\\\\?");
|
||||
}
|
||||
|
|
|
@ -95,6 +95,13 @@ public:
|
|||
if (lstrcmpiW(pszPropName, L"RECTL2.top") == 0)
|
||||
return E_FAIL;
|
||||
|
||||
if (lstrcmpiW(pszPropName, L"Str1") == 0)
|
||||
{
|
||||
V_VT(pvari) = VT_BSTR;
|
||||
V_BSTR(pvari) = SysAllocString(L"TestString");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (lstrcmpiW(pszPropName, L"GUID1") == 0)
|
||||
{
|
||||
V_VT(pvari) = (VT_UI1 | VT_ARRAY);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue