1 | // Licensed to the .NET Foundation under one or more agreements. |
2 | // The .NET Foundation licenses this file to you under the MIT license. |
3 | // See the LICENSE file in the project root for more information. |
4 | |
5 | /*===================================================================== |
6 | ** |
7 | ** Source: SetFileAttributesW.c |
8 | ** |
9 | ** Purpose: Tests the PAL implementation of the SetFileAttributesW function |
10 | ** Test that the function fails if the file doesn't exist.. |
11 | ** |
12 | ** |
13 | **===================================================================*/ |
14 | |
15 | #define UNICODE |
16 | |
17 | #include <palsuite.h> |
18 | |
19 | |
20 | int __cdecl main(int argc, char **argv) |
21 | { |
22 | DWORD TheResult; |
23 | WCHAR FileName[MAX_PATH]; |
24 | |
25 | if (0 != PAL_Initialize(argc,argv)) |
26 | { |
27 | return FAIL; |
28 | } |
29 | |
30 | /* Make a wide character string for the file name */ |
31 | |
32 | MultiByteToWideChar(CP_ACP, |
33 | 0, |
34 | "no_file" , |
35 | -1, |
36 | FileName, |
37 | MAX_PATH); |
38 | |
39 | |
40 | /* Try to set the file to NORMAL on a file that doesn't |
41 | exist. |
42 | */ |
43 | |
44 | TheResult = SetFileAttributes(FileName,FILE_ATTRIBUTE_NORMAL); |
45 | |
46 | if(TheResult != 0) |
47 | { |
48 | Fail("ERROR: SetFileAttributes returned non-zero0, success, when" |
49 | " trying to set the FILE_ATTRIBUTE_NORMAL attribute on a non " |
50 | "existant file. This should fail." ); |
51 | } |
52 | |
53 | |
54 | |
55 | PAL_Terminate(); |
56 | return PASS; |
57 | } |
58 | |