[SHELL32][SHELL32_APITEST][SDK] Implement PathIsEqualOrSubFolder (#5714)

Implement PathIsEqualOrSubFolder function.
- Add it to <undocshell.h>.
- Add PathIsEqualOrSubFolder testcase.
- Add SHGetPathCchFromIDListW as an
  extension of SHGetPathFromIDListW.
CORE-19278
This commit is contained in:
Katayama Hirofumi MZ
2023-11-29 22:50:01 +09:00
committed by GitHub
parent ea8a49d81f
commit 2aeda3dc15
7 changed files with 183 additions and 18 deletions

View File

@@ -19,6 +19,7 @@ list(APPEND SOURCE
Int64ToString.cpp
IShellFolderViewCB.cpp
OpenAs_RunDLL.cpp
PathIsEqualOrSubFolder.cpp
PathResolve.cpp
SHAppBarMessage.cpp
SHChangeNotify.cpp

View File

@@ -0,0 +1,41 @@
/*
* PROJECT: ReactOS API Tests
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Tests for PathIsEqualOrSubFolder
* COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*/
#include "shelltest.h"
#include <undocshell.h>
START_TEST(PathIsEqualOrSubFolder)
{
ok_int(PathIsEqualOrSubFolder(L"C:", L"C:"), TRUE);
ok_int(PathIsEqualOrSubFolder(L"C:", L"C:\\"), TRUE);
ok_int(PathIsEqualOrSubFolder(L"C:\\", L"C:"), TRUE);
ok_int(PathIsEqualOrSubFolder(L"C:\\", L"C:\\"), TRUE);
ok_int(PathIsEqualOrSubFolder(L"C:\\", L"C:\\TestTestTest"), TRUE);
ok_int(PathIsEqualOrSubFolder(L"C:\\TestTestTest", L"C:\\"), FALSE);
ok_int(PathIsEqualOrSubFolder(L"C:\\TestTestTest", L"C:\\TestTestTest"), TRUE);
ok_int(PathIsEqualOrSubFolder(L"C:\\TestTestTest", L"C:\\TestTestTest\\"), TRUE);
WCHAR szPath1[MAX_PATH], szPath2[MAX_PATH];
GetWindowsDirectoryW(szPath1, _countof(szPath1));
ok_int(PathIsEqualOrSubFolder(szPath1, szPath1), TRUE);
GetWindowsDirectoryW(szPath2, _countof(szPath2));
PathAppendW(szPath2, L"TestTestTest");
ok_int(PathIsEqualOrSubFolder(szPath1, szPath2), TRUE);
ok_int(PathIsEqualOrSubFolder(szPath2, szPath1), FALSE);
ok_int(PathIsEqualOrSubFolder(szPath2, szPath2), TRUE);
GetTempPathW(_countof(szPath1), szPath1);
GetTempPathW(_countof(szPath2), szPath2);
PathAppendW(szPath2, L"TestTestTest");
ok_int(PathIsEqualOrSubFolder(szPath1, szPath2), TRUE);
ok_int(PathIsEqualOrSubFolder(szPath2, szPath1), FALSE);
ok_int(PathIsEqualOrSubFolder(szPath2, szPath2), TRUE);
}

View File

@@ -21,6 +21,7 @@ extern void func_Int64ToString(void);
extern void func_IShellFolderViewCB(void);
extern void func_menu(void);
extern void func_OpenAs_RunDLL(void);
extern void func_PathIsEqualOrSubFolder(void);
extern void func_PathResolve(void);
extern void func_SHAppBarMessage(void);
extern void func_SHChangeNotify(void);
@@ -57,6 +58,7 @@ const struct test winetest_testlist[] =
{ "IShellFolderViewCB", func_IShellFolderViewCB },
{ "menu", func_menu },
{ "OpenAs_RunDLL", func_OpenAs_RunDLL },
{ "PathIsEqualOrSubFolder", func_PathIsEqualOrSubFolder },
{ "PathResolve", func_PathResolve },
{ "SHAppBarMessage", func_SHAppBarMessage },
{ "SHChangeNotify", func_SHChangeNotify },