#include "shelltest.h"
#include "closewnd.h"
#include <pstypes.h>
#include <psfuncs.h>
#include <stdlib.h>
#include <stdio.h>
#include <strsafe.h>
#include <versionhelpers.h>
#include <shellutils.h>
#include "shell32_apitest_sub.h"
Go to the source code of this file.
◆ REG_APPPATHS
#define REG_APPPATHS L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\" |
◆ PTEST_ENTRY
◆ TEST_ENTRY
◆ TEST_RESULT
◆ TEST_RESULT
Enumerator |
---|
TEST_FAILED | |
TEST_SUCCESS_NO_PROCESS | |
TEST_SUCCESS_WITH_PROCESS | |
Definition at line 38 of file ShellExecuteEx.cpp.
39{
@ TEST_SUCCESS_NO_PROCESS
@ TEST_SUCCESS_WITH_PROCESS
◆ CreateAppPath()
Definition at line 439 of file ShellExecuteEx.cpp.
440{
443
449 trace(
"Could not create test key (%lu)\n",
error);
450
454 trace(
"Could not set value of the test key (%lu)\n",
error);
455
457
459}
#define RegCloseKey(hKey)
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
#define HKEY_LOCAL_MACHINE
Referenced by TEST_AppPath().
◆ DeleteAppPath()
◆ enableTokenPrivilege()
static BOOL enableTokenPrivilege |
( |
LPCWSTR |
pszPrivilege | ) |
|
|
static |
Definition at line 222 of file ShellExecuteEx.cpp.
223{
227
231
235}
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
#define GetCurrentProcess()
LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]
#define TOKEN_ADJUST_PRIVILEGES
#define SE_PRIVILEGE_ENABLED
Referenced by TEST_Start().
◆ getCommandLineFromProcess()
Definition at line 112 of file ShellExecuteEx.cpp.
113{
119
122
126
130
134
136 if (!cbCmdLine)
137 trace(
"!cbCmdLine\n");
138
140 if (!pszBuffer)
141 trace(
"!pszBuffer\n");
142
146
148
149 return pszBuffer;
150}
#define ok_ntstatus(status, expected)
@ ProcessBasicInformation
#define ReadProcessMemory(a, b, c, d, e)
_In_ BOOL _In_ HANDLE hProcess
NTSTATUS NTAPI NtQueryInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _Out_ PVOID ProcessInformation, _In_ ULONG ProcessInformationLength, _Out_opt_ PULONG ReturnLength)
PRTL_USER_PROCESS_PARAMETERS ProcessParameters
_In_ WDFIOTARGET _In_ PWDF_REQUEST_COMPLETION_PARAMS Params
DWORD WINAPI GetLastError(void)
Referenced by TEST_DoTestEntryStruct().
◆ START_TEST()
Definition at line 514 of file ShellExecuteEx.cpp.
515{
516#ifdef _WIN64
517 skip(
"Win64 is not supported yet\n");
518 return;
519#endif
520
522 return;
523
529
531}
static void test_sei_lpIDList()
static BOOL TEST_Start(void)
static void test_properties()
static void TEST_AppPath(void)
static void test_DoInvalidDir(void)
static void TEST_DoTestEntries(void)
static void TEST_End(void)
◆ TEST_AppPath()
Definition at line 472 of file ShellExecuteEx.cpp.
473{
475 {
479 }
480
482 {
486 }
487}
static WCHAR s_win_test_exe[MAX_PATH]
static void TEST_DoTestEntry(INT line, TEST_RESULT result, LPCWSTR lpFile, LPCWSTR cmdline=NULL)
static WCHAR s_sys_test_exe[MAX_PATH]
static BOOL CreateAppPath(LPCWSTR pszName, LPCWSTR pszValue)
static VOID DeleteAppPath(LPCWSTR pszName)
Referenced by START_TEST().
◆ test_DoInvalidDir()
Definition at line 489 of file ShellExecuteEx.cpp.
490{
493 {
494 skip(
"shell32_apitest_sub.exe not found\n");
495 return;
496 }
497
500 sei.
lpFile = szSubProgram;
503
504
512}
#define ok_long(expression, result)
#define ok_int(expression, result)
BOOL WINAPI GetExitCodeProcess(IN HANDLE hProcess, IN LPDWORD lpExitCode)
static BOOL FindSubProgram(LPWSTR pszSubProgram, DWORD cchSubProgram)
#define SEE_MASK_NOCLOSEPROCESS
#define SEE_MASK_FLAG_NO_UI
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Referenced by START_TEST().
◆ TEST_DoTestEntries()
Definition at line 56 of file ShellExecuteEx.cpp.
57{
79
81 {
87 }
88
109}
static WCHAR s_win_dir[MAX_PATH]
static WCHAR s_sys_bat_file[MAX_PATH]
static WCHAR s_sys_test_exe_cmdline[MAX_PATH]
static WCHAR s_win_txt_file[MAX_PATH]
static WCHAR s_sys_notepad_cmdline[MAX_PATH]
static WCHAR s_win_test_exe_cmdline[MAX_PATH]
static WCHAR s_win_bat_file[MAX_PATH]
static WCHAR s_win_notepad[MAX_PATH]
static WCHAR s_win_notepad_cmdline[MAX_PATH]
static WCHAR s_sys_txt_file[MAX_PATH]
static WCHAR s_sys_dir[MAX_PATH]
#define GetCurrentDirectoryW(x, y)
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
VERSIONHELPERAPI IsWindowsVistaOrGreater()
Referenced by START_TEST().
◆ TEST_DoTestEntry()
Definition at line 201 of file ShellExecuteEx.cpp.
202{
206
209
211 {
212
215 }
216
219}
static TEST_RESULT TEST_DoTestEntryStruct(const TEST_ENTRY *pEntry)
static VOID FreeWindowList(PWINDOW_LIST pList)
static VOID CloseNewWindows(PWINDOW_LIST pExisting, PWINDOW_LIST pNew)
static VOID GetWindowList(PWINDOW_LIST pList)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
HWND WINAPI GetForegroundWindow(void)
Referenced by TEST_AppPath(), and TEST_DoTestEntries().
◆ TEST_DoTestEntryStruct()
Definition at line 152 of file ShellExecuteEx.cpp.
153{
161
163
167 else if (
ret && !
info.hProcess)
169 else
171
174
177
179 {
182 {
184 }
185 else
186 {
188 "Line %d: cmdline: '%ls' vs '%ls'\n",
pEntry->line,
190 }
191
194 }
195
198}
static LPWSTR getCommandLineFromProcess(HANDLE hProcess)
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
#define SEE_MASK_WAITFORINPUTIDLE
DWORD WINAPI WaitForInputIdle(_In_ HANDLE, _In_ DWORD)
Referenced by TEST_DoTestEntry().
◆ TEST_End()
Definition at line 333 of file ShellExecuteEx.cpp.
334{
341
342
344 for (
INT i = 0;
i < 100; ++
i)
345 {
346 INT nOldCount = nCount;
349 if (nOldCount == nCount)
350 break;
351 }
353
354
359}
static WINDOW_LIST s_List2
static WINDOW_LIST s_List1
static INT GetWindowCount(VOID)
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Referenced by START_TEST().
◆ test_properties()
Definition at line 361 of file ShellExecuteEx.cpp.
362{
364
367
370 info.lpVerb =
L"properties";
373
377
380 {
381
383 }
384
385
389
390
391 info.lpFile =
L"complete garbage, cannot run this!";
395
398}
#define ok_ptr(expression, result)
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
LPWSTR WINAPI PathFindExtensionW(const WCHAR *path)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
_Inout_opt_ PUNICODE_STRING Extension
#define SEE_MASK_INVOKEIDLIST
Referenced by START_TEST().
◆ test_sei_lpIDList()
static void test_sei_lpIDList |
( |
| ) |
|
|
static |
Definition at line 400 of file ShellExecuteEx.cpp.
401{
402
404
405
409 if (!pidl)
410 {
411 skip(
"Unable to initialize test\n");
412 return;
413 }
414
422
423
426 if (!pidl)
427 {
428 skip(
"Unable to initialize test\n");
429 return;
430 }
436}
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
BOOL WINAPI PathStripToRootW(WCHAR *path)
LPITEMIDLIST WINAPI SHCloneSpecialIDList(HWND hwndOwner, int nFolder, BOOL fCreate)
void WINAPI ILFree(LPITEMIDLIST pidl)
LPITEMIDLIST WINAPI ILCreateFromPathW(LPCWSTR path)
#define SEE_MASK_FLAG_DDEWAIT
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Referenced by START_TEST().
◆ TEST_Start()
Definition at line 239 of file ShellExecuteEx.cpp.
240{
241
245 skip(
"Wow64: Command Line check is skipped\n");
246
247
249
250
252
253
255
256
259
260
263
264
269 {
270 skip(
"Please retry with admin rights\n");
272 }
273
274
278
279
286
287
294
295
301
302
308
309
313 {
314 skip(
"Please associate .txt with notepad.exe before tests\n");
316 }
317
318
327
329
331}
static BOOL enableTokenPrivilege(LPCWSTR pszPrivilege)
static WCHAR s_sys_notepad[MAX_PATH]
BOOL WINAPI CopyFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName, IN BOOL bFailIfExists)
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
WCHAR *WINAPI PathFindFileNameW(const WCHAR *path)
BOOL WINAPI PathFileExistsW(const WCHAR *path)
_Check_return_ _CRTIMP FILE *__cdecl _wfopen(_In_z_ const wchar_t *_Filename, _In_z_ const wchar_t *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
HINSTANCE WINAPI FindExecutableW(LPCWSTR lpFile, LPCWSTR lpDirectory, LPWSTR lpResult)
Referenced by START_TEST().
◆ s_bWow64
◆ s_List1
◆ s_List2
◆ s_sys_bat_file
◆ s_sys_dir
◆ s_sys_notepad
◆ s_sys_notepad_cmdline
◆ s_sys_test_exe
◆ s_sys_test_exe_cmdline
◆ s_sys_txt_file
◆ s_win_bat_file
◆ s_win_dir
◆ s_win_notepad
◆ s_win_notepad_cmdline
◆ s_win_test_exe
◆ s_win_test_exe_cmdline
◆ s_win_txt_file