ReactOS
0.4.16-dev-329-g9223134
PathFileExistsDefExtAndAttributesW.c
Go to the documentation of this file.
1
/*
2
* PROJECT: ReactOS api tests
3
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4
* PURPOSE: Tests for PathFileExistsDefExtAndAttributesW
5
* COPYRIGHT: Copyright 2024 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
6
*/
7
8
#include <
apitest.h
>
9
#include <
shlobj.h
>
10
#include <
shlwapi.h
>
11
#include <
shlwapi_undoc.h
>
12
13
START_TEST
(
PathFileExistsDefExtAndAttributesW
)
14
{
15
WCHAR
szPath
[
MAX_PATH
];
16
DWORD
attrs;
17
BOOL
ret
;
18
19
/* NULL check */
20
ret
=
PathFileExistsDefExtAndAttributesW
(
NULL
, 0,
NULL
);
21
ok_int
(
ret
,
FALSE
);
22
23
/* Not existent file */
24
lstrcpynW
(
szPath
,
L
"Not Existent File.txt"
,
_countof
(
szPath
));
25
ret
=
PathFileExistsDefExtAndAttributesW
(
szPath
, 0,
NULL
);
26
ok_int
(
ret
,
FALSE
);
27
28
/* "Windows" directory */
29
GetWindowsDirectoryW
(
szPath
,
_countof
(
szPath
));
30
ret
=
PathFileExistsDefExtAndAttributesW
(
szPath
, 0,
NULL
);
31
ok_int
(
ret
,
TRUE
);
32
33
/* "Windows" directory with attributes check */
34
attrs = 0;
35
ret
=
PathFileExistsDefExtAndAttributesW
(
szPath
, 0, &attrs);
36
ok_int
(
ret
,
TRUE
);
37
ok
(attrs != 0 && attrs !=
INVALID_FILE_ATTRIBUTES
,
"attrs was 0x%lX\n"
, attrs);
38
39
/* Find notepad.exe */
40
SearchPathW
(
NULL
,
L
"notepad.exe"
,
NULL
,
_countof
(
szPath
),
szPath
,
NULL
);
41
ret
=
PathFileExistsW
(
szPath
);
42
ok_int
(
ret
,
TRUE
);
43
44
/* Remove .exe */
45
PathRemoveExtensionW
(
szPath
);
46
ret
=
PathFileExistsW
(
szPath
);
47
ok_int
(
ret
,
FALSE
);
48
49
/* Add .exe */
50
ret
=
PathFileExistsDefExtAndAttributesW
(
szPath
,
WHICH_EXE
,
NULL
);
51
ok_int
(
ret
,
TRUE
);
52
ret
=
PathFileExistsW
(
szPath
);
53
ok_int
(
ret
,
TRUE
);
54
55
/* notepad.cmd doesn't exist */
56
PathRemoveExtensionW
(
szPath
);
57
ret
=
PathFileExistsDefExtAndAttributesW
(
szPath
,
WHICH_CMD
,
NULL
);
58
ok_int
(
ret
,
FALSE
);
59
ret
=
PathFileExistsW
(
szPath
);
60
ok_int
(
ret
,
FALSE
);
61
}
apitest.h
ok
#define ok(value,...)
Definition:
atltest.h:57
START_TEST
#define START_TEST(x)
Definition:
atltest.h:75
ok_int
#define ok_int(expression, result)
Definition:
atltest.h:134
NULL
#define NULL
Definition:
types.h:112
TRUE
#define TRUE
Definition:
types.h:120
FALSE
#define FALSE
Definition:
types.h:117
MAX_PATH
#define MAX_PATH
Definition:
compat.h:34
lstrcpynW
#define lstrcpynW
Definition:
compat.h:738
SearchPathW
DWORD WINAPI SearchPathW(IN LPCWSTR lpPath OPTIONAL, IN LPCWSTR lpFileName, IN LPCWSTR lpExtension OPTIONAL, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart OPTIONAL)
Definition:
path.c:1298
GetWindowsDirectoryW
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition:
path.c:2352
PathRemoveExtensionW
void WINAPI PathRemoveExtensionW(LPWSTR lpszPath)
Definition:
path.c:823
PathFileExistsW
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition:
path.c:1777
PathFileExistsDefExtAndAttributesW
BOOL WINAPI PathFileExistsDefExtAndAttributesW(_Inout_ LPWSTR pszPath, _In_ DWORD dwWhich, _Out_opt_ LPDWORD pdwFileAttributes)
Definition:
utils.cpp:222
BOOL
unsigned int BOOL
Definition:
ntddk_ex.h:94
DWORD
unsigned long DWORD
Definition:
ntddk_ex.h:95
szPath
LPCWSTR szPath
Definition:
env.c:37
L
#define L(x)
Definition:
ntvdm.h:50
shlobj.h
shlwapi.h
shlwapi_undoc.h
WHICH_CMD
#define WHICH_CMD
Definition:
shlwapi_undoc.h:325
WHICH_EXE
#define WHICH_EXE
Definition:
shlwapi_undoc.h:322
_countof
#define _countof(array)
Definition:
sndvol32.h:70
INVALID_FILE_ATTRIBUTES
#define INVALID_FILE_ATTRIBUTES
Definition:
vfdcmd.c:23
ret
int ret
Definition:
wcstombs-tests.c:31
WCHAR
__wchar_t WCHAR
Definition:
xmlstorage.h:180
modules
rostests
apitests
shlwapi
PathFileExistsDefExtAndAttributesW.c
Generated on Sat Dec 7 2024 06:07:40 for ReactOS by
1.9.6