ReactOS 0.4.15-dev-7924-g5949c20
FindExecutable.cpp File Reference
#include "shelltest.h"
#include <stdio.h>
#include <shlwapi.h>
Include dependency graph for FindExecutable.cpp:

Go to the source code of this file.

Classes

struct  TEST_ENTRY
 

Macros

#define DIR_0   NULL
 
#define DIR_1   "."
 
#define DIR_2   ".."
 
#define DIR_3   s_win_dir
 
#define DIR_4   "(invalid)"
 

Typedefs

typedef struct TEST_ENTRY TEST_ENTRY
 

Functions

static void DoTestEntry (const TEST_ENTRY *pEntry)
 
 START_TEST (FindExecutable)
 

Variables

static char s_win_dir [MAX_PATH]
 
static char s_win_notepad [MAX_PATH]
 
static char s_sys_notepad [MAX_PATH]
 
static char s_win_test_exe [MAX_PATH]
 
static char s_sys_test_exe [MAX_PATH]
 
static char s_win_bat_file [MAX_PATH]
 
static char s_sys_bat_file [MAX_PATH]
 
static char s_win_txt_file [MAX_PATH]
 
static char s_sys_txt_file [MAX_PATH]
 
static const TEST_ENTRY s_entries []
 

Macro Definition Documentation

◆ DIR_0

#define DIR_0   NULL

Definition at line 31 of file FindExecutable.cpp.

◆ DIR_1

#define DIR_1   "."

Definition at line 32 of file FindExecutable.cpp.

◆ DIR_2

#define DIR_2   ".."

Definition at line 33 of file FindExecutable.cpp.

◆ DIR_3

#define DIR_3   s_win_dir

Definition at line 34 of file FindExecutable.cpp.

◆ DIR_4

#define DIR_4   "(invalid)"

Definition at line 35 of file FindExecutable.cpp.

Typedef Documentation

◆ TEST_ENTRY

Function Documentation

◆ DoTestEntry()

static void DoTestEntry ( const TEST_ENTRY pEntry)
static

Definition at line 161 of file FindExecutable.cpp.

162{
163 char result[MAX_PATH];
164 result[0] = 0;
165
167 if (ret > 32)
168 ret = 0xBEEFCAFE;
169
170 ok(ret == pEntry->ret, "Line %u: ret expected %d, got %d\n", pEntry->lineno, pEntry->ret, ret);
171
173
174 ok(lstrcmpiA(result, pEntry->result) == 0,
175 "Line %u: result expected '%s', got '%s'\n",
176 pEntry->lineno, pEntry->result, result);
177}
#define ok(value,...)
Definition: atltest.h:57
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI GetLongPathNameA(IN LPCSTR lpszShortPath, OUT LPSTR lpszLongPath, IN DWORD cchBuffer)
Definition: path.c:1671
PLIST_ENTRY pEntry
Definition: fxioqueue.cpp:4484
GLuint64EXT * result
Definition: glext.h:11304
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
unsigned int UINT
Definition: ndis.h:50
HINSTANCE WINAPI FindExecutableA(LPCSTR lpFile, LPCSTR lpDirectory, LPSTR lpResult)
Definition: shlexec.cpp:1214
#define _countof(array)
Definition: sndvol32.h:68
int ret

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( FindExecutable  )

Definition at line 179 of file FindExecutable.cpp.

180{
181 char cur_dir[MAX_PATH];
182 GetCurrentDirectoryA(_countof(cur_dir), cur_dir);
183 if (PathIsRootA(cur_dir))
184 {
185 skip("Don't use this program at root directory\n");
186 return;
187 }
188
190
192 PathAppendA(s_win_notepad, "notepad.exe");
193
195 PathAppendA(s_sys_notepad, "notepad.exe");
196
198 PathAppendA(s_win_test_exe, "test program.exe");
200 if (!ret)
201 {
202 skip("Please retry with admin rights\n");
203 return;
204 }
205
207 PathAppendA(s_sys_test_exe, "test program.exe");
209 if (!ret)
210 {
211 skip("Please retry with admin rights\n");
212 return;
213 }
214
216 PathAppendA(s_win_bat_file, "test program.bat");
219
221 PathAppendA(s_sys_bat_file, "test program.bat");
224
226 PathAppendA(s_win_txt_file, "test file.txt");
229
231 PathAppendA(s_sys_txt_file, "test file.txt");
234
235 for (UINT iTest = 0; iTest < _countof(s_entries); ++iTest)
236 {
237 DoTestEntry(&s_entries[iTest]);
238 }
239
246}
static char s_win_dir[MAX_PATH]
static char s_win_txt_file[MAX_PATH]
static char s_win_bat_file[MAX_PATH]
static void DoTestEntry(const TEST_ENTRY *pEntry)
static const TEST_ENTRY s_entries[]
static char s_win_test_exe[MAX_PATH]
static char s_sys_bat_file[MAX_PATH]
static char s_sys_txt_file[MAX_PATH]
static char s_win_notepad[MAX_PATH]
static char s_sys_test_exe[MAX_PATH]
static char s_sys_notepad[MAX_PATH]
#define skip(...)
Definition: atltest.h:64
#define ok_int(expression, result)
Definition: atltest.h:134
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL WINAPI CopyFileA(IN LPCSTR lpExistingFileName, IN LPCSTR lpNewFileName, IN BOOL bFailIfExists)
Definition: copy.c:404
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2146
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2337
UINT WINAPI GetSystemDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2283
BOOL WINAPI PathFileExistsA(LPCSTR lpszPath)
Definition: path.c:1755
BOOL WINAPI PathIsRootA(LPCSTR lpszPath)
Definition: path.c:1602
unsigned int BOOL
Definition: ntddk_ex.h:94
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
#define PathAppendA
Definition: pathcch.h:308

Variable Documentation

◆ s_entries

const TEST_ENTRY s_entries[]
static

Definition at line 37 of file FindExecutable.cpp.

Referenced by START_TEST().

◆ s_sys_bat_file

char s_sys_bat_file[MAX_PATH]
static

Definition at line 27 of file FindExecutable.cpp.

Referenced by START_TEST().

◆ s_sys_notepad

char s_sys_notepad[MAX_PATH]
static

Definition at line 23 of file FindExecutable.cpp.

Referenced by START_TEST().

◆ s_sys_test_exe

char s_sys_test_exe[MAX_PATH]
static

Definition at line 25 of file FindExecutable.cpp.

Referenced by START_TEST().

◆ s_sys_txt_file

char s_sys_txt_file[MAX_PATH]
static

Definition at line 29 of file FindExecutable.cpp.

Referenced by START_TEST().

◆ s_win_bat_file

char s_win_bat_file[MAX_PATH]
static

Definition at line 26 of file FindExecutable.cpp.

Referenced by START_TEST().

◆ s_win_dir

char s_win_dir[MAX_PATH]
static

Definition at line 21 of file FindExecutable.cpp.

Referenced by START_TEST().

◆ s_win_notepad

char s_win_notepad[MAX_PATH]
static

Definition at line 22 of file FindExecutable.cpp.

Referenced by START_TEST().

◆ s_win_test_exe

char s_win_test_exe[MAX_PATH]
static

Definition at line 24 of file FindExecutable.cpp.

Referenced by START_TEST().

◆ s_win_txt_file

char s_win_txt_file[MAX_PATH]
static

Definition at line 28 of file FindExecutable.cpp.

Referenced by START_TEST().