mirror of
https://github.com/reactos/reactos.git
synced 2024-07-02 10:45:24 +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
|
@ -13,8 +13,6 @@
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
//#define ShellExecCmdLine ShellExecCmdLine
|
|
||||||
|
|
||||||
#ifndef SECL_NO_UI
|
#ifndef SECL_NO_UI
|
||||||
#define SECL_NO_UI 0x2
|
#define SECL_NO_UI 0x2
|
||||||
#define SECL_LOG_USAGE 0x8
|
#define SECL_LOG_USAGE 0x8
|
||||||
|
@ -23,7 +21,7 @@
|
||||||
#define SECL_RUNAS 0x40
|
#define SECL_RUNAS 0x40
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ShellExecCmdLine
|
#define ShellExecCmdLine proxy_ShellExecCmdLine
|
||||||
|
|
||||||
#define shell32_hInstance GetModuleHandle(NULL)
|
#define shell32_hInstance GetModuleHandle(NULL)
|
||||||
#define IDS_FILE_NOT_FOUND (-1)
|
#define IDS_FILE_NOT_FOUND (-1)
|
||||||
|
@ -38,6 +36,7 @@ static __inline void __SHCloneStrW(WCHAR **target, const WCHAR *source)
|
||||||
lstrcpyW(*target, source);
|
lstrcpyW(*target, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: You have to sync the following code to dll/win32/shell32/shlexec.cpp.
|
||||||
static LPCWSTR
|
static LPCWSTR
|
||||||
SplitParams(LPCWSTR psz, LPWSTR pszArg0, size_t cchArg0)
|
SplitParams(LPCWSTR psz, LPWSTR pszArg0, size_t cchArg0)
|
||||||
{
|
{
|
||||||
|
@ -236,10 +235,11 @@ HRESULT WINAPI ShellExecCmdLine(
|
||||||
|
|
||||||
return HRESULT_FROM_WIN32(dwError);
|
return HRESULT_FROM_WIN32(dwError);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
typedef HRESULT (WINAPI *SHELLEXECCMDLINE)(HWND, LPCWSTR, LPCWSTR, INT, LPVOID, DWORD);
|
#undef ShellExecCmdLine
|
||||||
SHELLEXECCMDLINE g_pShellExecCmdLine = NULL;
|
|
||||||
#endif
|
typedef HRESULT (WINAPI *SHELLEXECCMDLINE)(HWND, LPCWSTR, LPCWSTR, INT, LPVOID, DWORD);
|
||||||
|
SHELLEXECCMDLINE g_pShellExecCmdLine = NULL;
|
||||||
|
|
||||||
typedef struct TEST_ENTRY
|
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\"", 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\"", NULL },
|
||||||
{ __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"\"invalid program.exe\" \"Test File.txt\"", L"." },
|
{ __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)
|
static void DoEntry(const TEST_ENTRY *pEntry)
|
||||||
|
@ -410,13 +416,16 @@ static void DoEntry(const TEST_ENTRY *pEntry)
|
||||||
|
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
#ifdef ShellExecCmdLine
|
if (IsReactOS())
|
||||||
hr = ShellExecCmdLine(NULL, pEntry->pwszCommand, pEntry->pwszStartDir,
|
{
|
||||||
SW_SHOWNORMAL, NULL, dwSeclFlags);
|
hr = proxy_ShellExecCmdLine(NULL, pEntry->pwszCommand, pEntry->pwszStartDir,
|
||||||
#else
|
SW_SHOWNORMAL, NULL, dwSeclFlags);
|
||||||
hr = (*g_pShellExecCmdLine)(NULL, pEntry->pwszCommand, pEntry->pwszStartDir,
|
}
|
||||||
SW_SHOWNORMAL, NULL, dwSeclFlags);
|
else
|
||||||
#endif
|
{
|
||||||
|
hr = (*g_pShellExecCmdLine)(NULL, pEntry->pwszCommand, pEntry->pwszStartDir,
|
||||||
|
SW_SHOWNORMAL, NULL, dwSeclFlags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
|
@ -454,22 +463,22 @@ START_TEST(ShellExecCmdLine)
|
||||||
{
|
{
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#ifndef ShellExecCmdLine
|
if (!IsReactOS())
|
||||||
// CHECKME
|
|
||||||
if (!IsWindowsVistaOrGreater())
|
|
||||||
{
|
{
|
||||||
skip("ShellExecCmdLine is not available on this platform\n");
|
if (!IsWindowsVistaOrGreater())
|
||||||
return;
|
{
|
||||||
}
|
skip("ShellExecCmdLine is not available on this platform\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
HMODULE hShell32 = GetModuleHandleA("shell32");
|
HMODULE hShell32 = GetModuleHandleA("shell32");
|
||||||
g_pShellExecCmdLine = (SHELLEXECCMDLINE)GetProcAddress(hShell32, (LPCSTR)(INT_PTR)265);
|
g_pShellExecCmdLine = (SHELLEXECCMDLINE)GetProcAddress(hShell32, (LPCSTR)(INT_PTR)265);
|
||||||
if (!g_pShellExecCmdLine)
|
if (!g_pShellExecCmdLine)
|
||||||
{
|
{
|
||||||
skip("ShellExecCmdLine is not found\n");
|
skip("ShellExecCmdLine is not found\n");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// s_testfile1
|
// s_testfile1
|
||||||
FILE *fp = fopen(s_testfile1, "wb");
|
FILE *fp = fopen(s_testfile1, "wb");
|
||||||
|
|
Loading…
Reference in a new issue