ReactOS  0.4.14-dev-98-gb0d4763
FileAttributes_user.c File Reference
#include <kmt_test.h>
#include "kernel32_test.h"
Include dependency graph for FileAttributes_user.c:

Go to the source code of this file.

Functions

 START_TEST (FileAttributes)
 

Function Documentation

◆ START_TEST()

START_TEST ( FileAttributes  )

Directory attribute

Definition at line 13 of file FileAttributes_user.c.

14 {
15  PCWSTR FileName = L"\\\\.\\Global\\GLOBALROOT\\Device\\Kmtest-kernel32\\Somefile";
16  BOOL Ret;
18 
19  KmtLoadDriver(L"kernel32", FALSE);
20  KmtOpenDriver();
21 
22  /* Set read-only attribute */
25  ok(Ret == TRUE, "SetFileAttributesW returned %d, error %lu\n", Ret, GetLastError());
26 
27  /* Set normal attribute */
30  ok(Ret == TRUE, "SetFileAttributesW returned %d, error %lu\n", Ret, GetLastError());
31 
32  /* Set 0 attribute (driver should receive normal) */
34  Ret = SetFileAttributesW(FileName, 0);
35  ok(Ret == TRUE, "SetFileAttributesW returned %d, error %lu\n", Ret, GetLastError());
36 
37  /* Set invalid attributes */
40  ok(Ret == TRUE, "SetFileAttributesW returned %d, error %lu\n", Ret, GetLastError());
41 
42  /* Query read-only attribute */
46 
47  /* Query read-only + normal attribute */
51 
52  /* Query normal attribute */
56 
57  /* Query 0 attribute */
61 
62  /* Query invalid attributes */
66 
68  /* Set read-only and directory attribute */
71  ok(Ret == TRUE, "SetFileAttributesW returned %d, error %lu\n", Ret, GetLastError());
72 
73  /* Set normal and directory attribute */
76  ok(Ret == TRUE, "SetFileAttributesW returned %d, error %lu\n", Ret, GetLastError());
77 
78  /* Set directory attribute */
81  ok(Ret == TRUE, "SetFileAttributesW returned %d, error %lu\n", Ret, GetLastError());
82 
83  /* Query read-only and directory attribute */
87 
88  /* Query read-only + normal + directory attribute */
92 
93  /* Query normal and directory attribute */
97 
98  /* Query directory attribute */
102 
103  KmtCloseDriver();
104  KmtUnloadDriver();
105 }
BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:944
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define TRUE
Definition: types.h:120
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:802
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define IOCTL_RETURN_QUERY_ATTRIBUTES
Definition: kernel32_test.h:12
VOID KmtCloseDriver(VOID)
Definition: support.c:200
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
unsigned long DWORD
Definition: ntddk_ex.h:95
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
static const WCHAR L[]
Definition: oid.c:1250
_Must_inspect_result_ _In_ USHORT _In_ PHIDP_PREPARSED_DATA _Out_writes_to_ LengthAttributes PHIDP_EXTENDED_ATTRIBUTES Attributes
Definition: hidpi.h:348
VOID KmtUnloadDriver(VOID)
Definition: support.c:155
#define ok(value,...)
Definition: atltest.h:57
#define ok_eq_hex(value, expected)
VOID KmtLoadDriver(IN PCWSTR ServiceName, IN BOOLEAN RestartIfRunning)
Definition: support.c:127
VOID KmtOpenDriver(VOID)
Definition: support.c:174
#define FILE_ATTRIBUTE_VALID_SET_FLAGS
Definition: nt_native.h:715
DWORD KmtSendUlongToDriver(IN DWORD ControlCode, IN DWORD Value)
Definition: support.c:298
#define IOCTL_EXPECT_SET_ATTRIBUTES
Definition: kernel32_test.h:13