Reactos
at master 66 lines 1.6 kB view raw
1/* 2 * PROJECT: ReactOS API tests 3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) 4 * PURPOSE: Test for ShellExec_RunDLL 5 * COPYRIGHT: Copyright 2025 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com> 6 */ 7 8#include "shelltest.h" 9#include "closewnd.h" 10#include <undocshell.h> 11 12static WINDOW_LIST s_List1, s_List2; 13 14static VOID TEST_ShellExec_RunDLL(VOID) 15{ 16 ShellExec_RunDLL(NULL, NULL, "?0?notepad.exe", SW_SHOWNORMAL); 17} 18 19static VOID TEST_ShellExec_RunDLLA(VOID) 20{ 21 ShellExec_RunDLLA(NULL, NULL, "?0?notepad.exe", SW_SHOWNORMAL); 22} 23 24static VOID TEST_ShellExec_RunDLLW(VOID) 25{ 26 ShellExec_RunDLLW(NULL, NULL, L"?0?notepad.exe", SW_SHOWNORMAL); 27} 28 29static BOOL CloseNotepad(VOID) 30{ 31 HWND hwndNew; 32 WCHAR szClass[64]; 33 34 // Execution can be asynchronous; you have to wait for it to finish. 35 Sleep(1000); 36 37 // Close newly-opened window(s) 38 GetWindowList(&s_List2); 39 hwndNew = FindNewWindow(&s_List1, &s_List2); 40 if (!GetClassNameW(hwndNew, szClass, _countof(szClass))) 41 szClass[0] = UNICODE_NULL; 42 CloseNewWindows(&s_List1, &s_List2); 43 FreeWindowList(&s_List1); 44 FreeWindowList(&s_List2); 45 return lstrcmpiW(szClass, L"Notepad") == 0; 46} 47 48START_TEST(ShellExec_RunDLL) 49{ 50 BOOL ret; 51 52 GetWindowList(&s_List1); 53 TEST_ShellExec_RunDLL(); 54 ret = CloseNotepad(); 55 ok(ret, "Notepad not found\n"); 56 57 GetWindowList(&s_List1); 58 TEST_ShellExec_RunDLLA(); 59 ret = CloseNotepad(); 60 ok(ret, "Notepad not found\n"); 61 62 GetWindowList(&s_List1); 63 TEST_ShellExec_RunDLLW(); 64 ret = CloseNotepad(); 65 ok(ret, "Notepad not found\n"); 66}