mirror of
https://github.com/reactos/reactos.git
synced 2024-11-24 12:03:31 +08:00
[SHELL32][SHELL32_APITEST][SDK] Implement SheRemoveQuotesA/W (#5517)
- Implement SheRemoveQuotesA and SheRemoveQuotesW functions. - Add She testcase into shell32_apitest. - Add SheRemoveQuotesA/W into <undocshell.h>. CORE-9277
This commit is contained in:
parent
1273bbe417
commit
358e45d33a
@ -440,26 +440,44 @@ SheSetCurDrive(INT iIndex)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unimplemented
|
||||
*/
|
||||
EXTERN_C LPWSTR
|
||||
WINAPI
|
||||
SheRemoveQuotesW(LPWSTR lpInput)
|
||||
SheRemoveQuotesW(LPWSTR psz)
|
||||
{
|
||||
FIXME("SheRemoveQuotesW() stub\n");
|
||||
return NULL;
|
||||
PWCHAR pch;
|
||||
|
||||
if (*psz == L'"')
|
||||
{
|
||||
for (pch = psz + 1; *pch && *pch != L'"'; ++pch)
|
||||
{
|
||||
*(pch - 1) = *pch;
|
||||
}
|
||||
|
||||
if (*pch == L'"')
|
||||
*(pch - 1) = UNICODE_NULL;
|
||||
}
|
||||
|
||||
return psz;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unimplemented
|
||||
*/
|
||||
EXTERN_C LPSTR
|
||||
WINAPI
|
||||
SheRemoveQuotesA(LPSTR lpInput)
|
||||
SheRemoveQuotesA(LPSTR psz)
|
||||
{
|
||||
FIXME("SheRemoveQuotesA() stub\n");
|
||||
return NULL;
|
||||
PCHAR pch;
|
||||
|
||||
if (*psz == '"')
|
||||
{
|
||||
for (pch = psz + 1; *pch && *pch != '"'; ++pch)
|
||||
{
|
||||
*(pch - 1) = *pch;
|
||||
}
|
||||
|
||||
if (*pch == '"')
|
||||
*(pch - 1) = ANSI_NULL;
|
||||
}
|
||||
|
||||
return psz;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -25,6 +25,7 @@ list(APPEND SOURCE
|
||||
SHCreateFileDataObject.cpp
|
||||
SHCreateFileExtractIconW.cpp
|
||||
SHParseDisplayName.cpp
|
||||
She.cpp
|
||||
ShellExecCmdLine.cpp
|
||||
ShellExecuteEx.cpp
|
||||
ShellExecuteW.cpp
|
||||
|
87
modules/rostests/apitests/shell32/She.cpp
Normal file
87
modules/rostests/apitests/shell32/She.cpp
Normal file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
|
||||
* PURPOSE: Test for She* functions
|
||||
* COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
|
||||
*/
|
||||
|
||||
#include "shelltest.h"
|
||||
#include <undocshell.h>
|
||||
|
||||
typedef LPSTR (WINAPI *FN_SheRemoveQuotesA)(LPSTR psz);
|
||||
typedef LPWSTR (WINAPI *FN_SheRemoveQuotesW)(LPWSTR psz);
|
||||
|
||||
static FN_SheRemoveQuotesA pSheRemoveQuotesA = NULL;
|
||||
static FN_SheRemoveQuotesW pSheRemoveQuotesW = NULL;
|
||||
|
||||
static void test_SheRemoveQuotesA(void)
|
||||
{
|
||||
CHAR sz0[] = "A\"Test\"";
|
||||
CHAR sz1[] = "\"Test\"";
|
||||
CHAR sz2[] = "\"Test\"123";
|
||||
|
||||
BOOL bGotException = FALSE;
|
||||
_SEH2_TRY
|
||||
{
|
||||
pSheRemoveQuotesA(NULL);
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
bGotException = TRUE;
|
||||
}
|
||||
_SEH2_END;
|
||||
ok_int(bGotException, TRUE);
|
||||
|
||||
ok_ptr(pSheRemoveQuotesA(sz0), sz0);
|
||||
ok_str(sz0, "A\"Test\"");
|
||||
|
||||
ok_ptr(pSheRemoveQuotesA(sz1), sz1);
|
||||
ok_str(sz1, "Test");
|
||||
|
||||
ok_ptr(pSheRemoveQuotesA(sz2), sz2);
|
||||
ok_str(sz2, "Test");
|
||||
}
|
||||
|
||||
static void test_SheRemoveQuotesW(void)
|
||||
{
|
||||
WCHAR sz0[] = L"A\"Test\"";
|
||||
WCHAR sz1[] = L"\"Test\"";
|
||||
WCHAR sz2[] = L"\"Test\"123";
|
||||
|
||||
BOOL bGotException = FALSE;
|
||||
_SEH2_TRY
|
||||
{
|
||||
pSheRemoveQuotesW(NULL);
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
bGotException = TRUE;
|
||||
}
|
||||
_SEH2_END;
|
||||
ok_int(bGotException, TRUE);
|
||||
|
||||
ok_ptr(pSheRemoveQuotesW(sz0), sz0);
|
||||
ok_wstr(sz0, L"A\"Test\"");
|
||||
|
||||
ok_ptr(pSheRemoveQuotesW(sz1), sz1);
|
||||
ok_wstr(sz1, L"Test");
|
||||
|
||||
ok_ptr(pSheRemoveQuotesW(sz2), sz2);
|
||||
ok_wstr(sz2, L"Test");
|
||||
}
|
||||
|
||||
START_TEST(She)
|
||||
{
|
||||
HINSTANCE hShell32 = GetModuleHandleW(L"shell32");
|
||||
pSheRemoveQuotesA = (FN_SheRemoveQuotesA)GetProcAddress(hShell32, "SheRemoveQuotesA");
|
||||
pSheRemoveQuotesW = (FN_SheRemoveQuotesW)GetProcAddress(hShell32, "SheRemoveQuotesW");
|
||||
|
||||
if (!pSheRemoveQuotesA || !pSheRemoveQuotesW)
|
||||
{
|
||||
skip("SheRemoveQuotes not found");
|
||||
return;
|
||||
}
|
||||
|
||||
test_SheRemoveQuotesA();
|
||||
test_SheRemoveQuotesW();
|
||||
}
|
@ -26,6 +26,7 @@ extern void func_SHChangeNotify(void);
|
||||
extern void func_SHCreateDataObject(void);
|
||||
extern void func_SHCreateFileDataObject(void);
|
||||
extern void func_SHCreateFileExtractIconW(void);
|
||||
extern void func_She(void);
|
||||
extern void func_ShellExecCmdLine(void);
|
||||
extern void func_ShellExecuteEx(void);
|
||||
extern void func_ShellExecuteW(void);
|
||||
@ -60,6 +61,7 @@ const struct test winetest_testlist[] =
|
||||
{ "SHCreateDataObject", func_SHCreateDataObject },
|
||||
{ "SHCreateFileDataObject", func_SHCreateFileDataObject },
|
||||
{ "SHCreateFileExtractIconW", func_SHCreateFileExtractIconW },
|
||||
{ "She", func_She },
|
||||
{ "ShellExecCmdLine", func_ShellExecCmdLine },
|
||||
{ "ShellExecuteEx", func_ShellExecuteEx },
|
||||
{ "ShellExecuteW", func_ShellExecuteW },
|
||||
|
@ -653,6 +653,9 @@ BOOL WINAPI GUIDFromStringW(
|
||||
_Out_ LPGUID pguid
|
||||
);
|
||||
|
||||
LPSTR WINAPI SheRemoveQuotesA(LPSTR psz);
|
||||
LPWSTR WINAPI SheRemoveQuotesW(LPWSTR psz);
|
||||
|
||||
/*****************************************************************************
|
||||
* Shell32 resources
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user