mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 05:22:57 +00:00
[SHELL32_APITEST] Add some tests for ShellExecuteEx showing extension completion with the App Paths registry key. Patch by Yaroslav Veremenko. CORE-12049
svn path=/trunk/; revision=73180
This commit is contained in:
parent
d4c71dda90
commit
353c67c0d4
3 changed files with 109 additions and 1 deletions
|
@ -10,8 +10,9 @@ add_executable(shell32_apitest
|
||||||
menu.cpp
|
menu.cpp
|
||||||
shelltest.cpp
|
shelltest.cpp
|
||||||
SHParseDisplayName.cpp
|
SHParseDisplayName.cpp
|
||||||
|
shlexec.cpp
|
||||||
testlist.c)
|
testlist.c)
|
||||||
target_link_libraries(shell32_apitest wine uuid ${PSEH_LIB})
|
target_link_libraries(shell32_apitest wine uuid ${PSEH_LIB})
|
||||||
set_module_type(shell32_apitest win32cui)
|
set_module_type(shell32_apitest win32cui)
|
||||||
add_importlibs(shell32_apitest user32 gdi32 shell32 ole32 oleaut32 shlwapi msvcrt kernel32 ntdll)
|
add_importlibs(shell32_apitest user32 gdi32 shell32 ole32 oleaut32 advapi32 shlwapi msvcrt kernel32 ntdll)
|
||||||
add_cd_file(TARGET shell32_apitest DESTINATION reactos/bin FOR all)
|
add_cd_file(TARGET shell32_apitest DESTINATION reactos/bin FOR all)
|
||||||
|
|
105
rostests/apitests/shell32/shlexec.cpp
Normal file
105
rostests/apitests/shell32/shlexec.cpp
Normal file
|
@ -0,0 +1,105 @@
|
||||||
|
/*
|
||||||
|
* PROJECT: ReactOS api tests
|
||||||
|
* LICENSE: GPLv2+ - See COPYING in the top level directory
|
||||||
|
* PURPOSE: Testing ShellExecuteEx
|
||||||
|
* PROGRAMMER: Yaroslav Veremenko <yaroslav@veremenko.info>
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "shelltest.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define ok_ShellExecuteEx (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : TestShellExecuteEx
|
||||||
|
|
||||||
|
static
|
||||||
|
BOOL
|
||||||
|
CreateAppPathRegKey(const WCHAR* Name)
|
||||||
|
{
|
||||||
|
HKEY RegistryKey;
|
||||||
|
LONG Result;
|
||||||
|
WCHAR Buffer[1024];
|
||||||
|
WCHAR KeyValue[1024];
|
||||||
|
DWORD Length = sizeof(KeyValue);
|
||||||
|
DWORD Disposition;
|
||||||
|
|
||||||
|
wcscpy(Buffer, L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\");
|
||||||
|
wcscat(Buffer, L"IEXPLORE.EXE");
|
||||||
|
Result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, Buffer, 0, KEY_READ, &RegistryKey);
|
||||||
|
if (Result != ERROR_SUCCESS) trace("Could not open iexplore.exe key. Status: %d\n", Result);
|
||||||
|
if (Result) goto end;
|
||||||
|
Result = RegQueryValueExW(RegistryKey, NULL, NULL, NULL, (LPBYTE)KeyValue, &Length);
|
||||||
|
if (Result != ERROR_SUCCESS) trace("Could not read iexplore.exe key. Status: %d\n", Result);
|
||||||
|
if (Result) goto end;
|
||||||
|
RegCloseKey(RegistryKey);
|
||||||
|
|
||||||
|
wcscpy(Buffer, L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\");
|
||||||
|
wcscat(Buffer, Name);
|
||||||
|
Result = RegCreateKeyExW(HKEY_LOCAL_MACHINE, Buffer, 0, NULL,
|
||||||
|
0, KEY_WRITE, NULL, &RegistryKey, &Disposition);
|
||||||
|
if (Result != ERROR_SUCCESS) trace("Could not create test key. Status: %d\n", Result);
|
||||||
|
if (Result) goto end;
|
||||||
|
Result = RegSetValueW(RegistryKey, NULL, REG_SZ, KeyValue, 0);
|
||||||
|
if (Result != ERROR_SUCCESS) trace("Could not set value of the test key. Status: %d\n", Result);
|
||||||
|
if (Result) goto end;
|
||||||
|
RegCloseKey(RegistryKey);
|
||||||
|
end:
|
||||||
|
if (RegistryKey) RegCloseKey(RegistryKey);
|
||||||
|
return Result == ERROR_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
DeleteAppPathRegKey(const WCHAR* Name)
|
||||||
|
{
|
||||||
|
LONG Result;
|
||||||
|
WCHAR Buffer[1024];
|
||||||
|
wcscpy(Buffer, L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\");
|
||||||
|
wcscat(Buffer, Name);
|
||||||
|
Result = RegDeleteKeyW(HKEY_LOCAL_MACHINE, Buffer);
|
||||||
|
if (Result != ERROR_SUCCESS) trace("Could not remove the test key. Status: %d\n", Result);
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
TestShellExecuteEx(const WCHAR* Name, BOOL ExpectedResult)
|
||||||
|
{
|
||||||
|
SHELLEXECUTEINFOW ShellExecInfo;
|
||||||
|
BOOL Result;
|
||||||
|
ZeroMemory(&ShellExecInfo, sizeof(ShellExecInfo));
|
||||||
|
ShellExecInfo.cbSize = sizeof(ShellExecInfo);
|
||||||
|
ShellExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI;
|
||||||
|
ShellExecInfo.hwnd = NULL;
|
||||||
|
ShellExecInfo.nShow = SW_SHOWNORMAL;
|
||||||
|
ShellExecInfo.lpFile = Name;
|
||||||
|
ShellExecInfo.lpDirectory = NULL;
|
||||||
|
Result = ShellExecuteExW(&ShellExecInfo);
|
||||||
|
ok(Result == ExpectedResult, "ShellExecuteEx lpFile %s failed. Error: %d\n", wine_dbgstr_w(Name), GetLastError());
|
||||||
|
if (ShellExecInfo.hProcess)
|
||||||
|
{
|
||||||
|
Result = TerminateProcess(ShellExecInfo.hProcess, 0);
|
||||||
|
if (!Result) trace("Terminate process failed. Error: %d\n", GetLastError());
|
||||||
|
WaitForSingleObject(ShellExecInfo.hProcess, INFINITE);
|
||||||
|
CloseHandle(ShellExecInfo.hProcess);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
START_TEST(shlexec)
|
||||||
|
{
|
||||||
|
ok_ShellExecuteEx(L"iexplore", TRUE);
|
||||||
|
ok_ShellExecuteEx(L"iexplore.exe", TRUE);
|
||||||
|
|
||||||
|
if (CreateAppPathRegKey(L"iexplore.bat"))
|
||||||
|
{
|
||||||
|
ok_ShellExecuteEx(L"iexplore.bat", TRUE);
|
||||||
|
ok_ShellExecuteEx(L"iexplore.bat.exe", FALSE);
|
||||||
|
DeleteAppPathRegKey(L"iexplore.bat");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CreateAppPathRegKey(L"iexplore.bat.exe"))
|
||||||
|
{
|
||||||
|
ok_ShellExecuteEx(L"iexplore.bat", FALSE);
|
||||||
|
ok_ShellExecuteEx(L"iexplore.bat.exe", TRUE);
|
||||||
|
DeleteAppPathRegKey(L"iexplore.bat.exe");
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ extern void func_CShellDesktop(void);
|
||||||
extern void func_CShellLink(void);
|
extern void func_CShellLink(void);
|
||||||
extern void func_menu(void);
|
extern void func_menu(void);
|
||||||
extern void func_SHParseDisplayName(void);
|
extern void func_SHParseDisplayName(void);
|
||||||
|
extern void func_shlexec(void);
|
||||||
|
|
||||||
const struct test winetest_testlist[] =
|
const struct test winetest_testlist[] =
|
||||||
{
|
{
|
||||||
|
@ -16,5 +17,6 @@ const struct test winetest_testlist[] =
|
||||||
{ "CShellLink", func_CShellLink },
|
{ "CShellLink", func_CShellLink },
|
||||||
{ "menu", func_menu },
|
{ "menu", func_menu },
|
||||||
{ "SHParseDisplayName", func_SHParseDisplayName },
|
{ "SHParseDisplayName", func_SHParseDisplayName },
|
||||||
|
{ "shlexec", func_shlexec },
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue