mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 10:35:28 +00:00
[SHELL32_APITEST] Strengthen ShellExecCmdLine testcase (#3164)
- Add tests for "My Documents" and "Control Panel". - Add some comments for usability. CORE-16939
This commit is contained in:
parent
a373198419
commit
78edea8164
1 changed files with 36 additions and 27 deletions
|
@ -13,8 +13,6 @@
|
|||
#include <debug.h>
|
||||
#include <stdio.h>
|
||||
|
||||
//#define ShellExecCmdLine ShellExecCmdLine
|
||||
|
||||
#ifndef SECL_NO_UI
|
||||
#define SECL_NO_UI 0x2
|
||||
#define SECL_LOG_USAGE 0x8
|
||||
|
@ -23,7 +21,7 @@
|
|||
#define SECL_RUNAS 0x40
|
||||
#endif
|
||||
|
||||
#ifdef ShellExecCmdLine
|
||||
#define ShellExecCmdLine proxy_ShellExecCmdLine
|
||||
|
||||
#define shell32_hInstance GetModuleHandle(NULL)
|
||||
#define IDS_FILE_NOT_FOUND (-1)
|
||||
|
@ -38,6 +36,7 @@ static __inline void __SHCloneStrW(WCHAR **target, const WCHAR *source)
|
|||
lstrcpyW(*target, source);
|
||||
}
|
||||
|
||||
// NOTE: You have to sync the following code to dll/win32/shell32/shlexec.cpp.
|
||||
static LPCWSTR
|
||||
SplitParams(LPCWSTR psz, LPWSTR pszArg0, size_t cchArg0)
|
||||
{
|
||||
|
@ -236,10 +235,11 @@ HRESULT WINAPI ShellExecCmdLine(
|
|||
|
||||
return HRESULT_FROM_WIN32(dwError);
|
||||
}
|
||||
#else
|
||||
typedef HRESULT (WINAPI *SHELLEXECCMDLINE)(HWND, LPCWSTR, LPCWSTR, INT, LPVOID, DWORD);
|
||||
SHELLEXECCMDLINE g_pShellExecCmdLine = NULL;
|
||||
#endif
|
||||
|
||||
#undef ShellExecCmdLine
|
||||
|
||||
typedef HRESULT (WINAPI *SHELLEXECCMDLINE)(HWND, LPCWSTR, LPCWSTR, INT, LPVOID, DWORD);
|
||||
SHELLEXECCMDLINE g_pShellExecCmdLine = NULL;
|
||||
|
||||
typedef struct TEST_ENTRY
|
||||
{
|
||||
|
@ -396,6 +396,12 @@ static const TEST_ENTRY s_entries[] =
|
|||
{ __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"\"invalid program.exe\"", L"C:\\Program Files" },
|
||||
{ __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"\"invalid program.exe\" \"Test File.txt\"", NULL },
|
||||
{ __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"\"invalid program.exe\" \"Test File.txt\"", L"." },
|
||||
// My Documents
|
||||
{ __LINE__, S_OK, TRUE, NULL, L"::{450d8fba-ad25-11d0-98a8-0800361b1103}", NULL },
|
||||
{ __LINE__, S_OK, TRUE, NULL, L"shell:::{450d8fba-ad25-11d0-98a8-0800361b1103}", NULL },
|
||||
// Control Panel
|
||||
{ __LINE__, S_OK, TRUE, NULL, L"::{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}", NULL },
|
||||
{ __LINE__, S_OK, TRUE, NULL, L"shell:::{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}", NULL },
|
||||
};
|
||||
|
||||
static void DoEntry(const TEST_ENTRY *pEntry)
|
||||
|
@ -410,13 +416,16 @@ static void DoEntry(const TEST_ENTRY *pEntry)
|
|||
|
||||
_SEH2_TRY
|
||||
{
|
||||
#ifdef ShellExecCmdLine
|
||||
hr = ShellExecCmdLine(NULL, pEntry->pwszCommand, pEntry->pwszStartDir,
|
||||
SW_SHOWNORMAL, NULL, dwSeclFlags);
|
||||
#else
|
||||
hr = (*g_pShellExecCmdLine)(NULL, pEntry->pwszCommand, pEntry->pwszStartDir,
|
||||
SW_SHOWNORMAL, NULL, dwSeclFlags);
|
||||
#endif
|
||||
if (IsReactOS())
|
||||
{
|
||||
hr = proxy_ShellExecCmdLine(NULL, pEntry->pwszCommand, pEntry->pwszStartDir,
|
||||
SW_SHOWNORMAL, NULL, dwSeclFlags);
|
||||
}
|
||||
else
|
||||
{
|
||||
hr = (*g_pShellExecCmdLine)(NULL, pEntry->pwszCommand, pEntry->pwszStartDir,
|
||||
SW_SHOWNORMAL, NULL, dwSeclFlags);
|
||||
}
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
|
@ -454,22 +463,22 @@ START_TEST(ShellExecCmdLine)
|
|||
{
|
||||
using namespace std;
|
||||
|
||||
#ifndef ShellExecCmdLine
|
||||
// CHECKME
|
||||
if (!IsWindowsVistaOrGreater())
|
||||
if (!IsReactOS())
|
||||
{
|
||||
skip("ShellExecCmdLine is not available on this platform\n");
|
||||
return;
|
||||
}
|
||||
if (!IsWindowsVistaOrGreater())
|
||||
{
|
||||
skip("ShellExecCmdLine is not available on this platform\n");
|
||||
return;
|
||||
}
|
||||
|
||||
HMODULE hShell32 = GetModuleHandleA("shell32");
|
||||
g_pShellExecCmdLine = (SHELLEXECCMDLINE)GetProcAddress(hShell32, (LPCSTR)(INT_PTR)265);
|
||||
if (!g_pShellExecCmdLine)
|
||||
{
|
||||
skip("ShellExecCmdLine is not found\n");
|
||||
return;
|
||||
HMODULE hShell32 = GetModuleHandleA("shell32");
|
||||
g_pShellExecCmdLine = (SHELLEXECCMDLINE)GetProcAddress(hShell32, (LPCSTR)(INT_PTR)265);
|
||||
if (!g_pShellExecCmdLine)
|
||||
{
|
||||
skip("ShellExecCmdLine is not found\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// s_testfile1
|
||||
FILE *fp = fopen(s_testfile1, "wb");
|
||||
|
|
Loading…
Reference in a new issue