Commit fdf8d717 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

kernel32: Support FileBasicInfo case in SetFileInformationByHandle().

parent e14249a3
......@@ -1095,7 +1095,6 @@ BOOL WINAPI SetFileInformationByHandle( HANDLE file, FILE_INFO_BY_HANDLE_CLASS c
switch (class)
{
case FileBasicInfo:
case FileNameInfo:
case FileRenameInfo:
case FileAllocationInfo:
......@@ -1114,6 +1113,9 @@ BOOL WINAPI SetFileInformationByHandle( HANDLE file, FILE_INFO_BY_HANDLE_CLASS c
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return FALSE;
case FileBasicInfo:
status = NtSetInformationFile( file, &io, info, size, FileBasicInformation );
break;
case FileDispositionInfo:
status = NtSetInformationFile( file, &io, info, size, FileDispositionInformation );
break;
......
......@@ -4973,8 +4973,10 @@ static void test_SetFileInformationByHandle(void)
FILE_COMPRESSION_INFO compressinfo;
FILE_DISPOSITION_INFO dispinfo;
DECLSPEC_ALIGN(8) FILE_IO_PRIORITY_HINT_INFO hintinfo;
FILE_BASIC_INFO basicinfo = { {{0}} };
char tempFileName[MAX_PATH];
char tempPath[MAX_PATH];
LARGE_INTEGER atime;
HANDLE file;
BOOL ret;
......@@ -4991,7 +4993,7 @@ static void test_SetFileInformationByHandle(void)
ret = GetTempFileNameA(tempPath, "abc", 0, tempFileName);
ok(ret, "GetTempFileNameA failed, got error %u.\n", GetLastError());
file = CreateFileA(tempFileName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
file = CreateFileA(tempFileName, GENERIC_READ | FILE_WRITE_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
NULL, OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, NULL);
ok(file != INVALID_HANDLE_VALUE, "failed to open the temp file, error %u.\n", GetLastError());
......@@ -5044,6 +5046,25 @@ static void test_SetFileInformationByHandle(void)
todo_wine
ok(!ret && GetLastError() == ERROR_BAD_LENGTH, "got %d, error %d\n", ret, GetLastError());
SetLastError(0xdeadbeef);
ret = pSetFileInformationByHandle(file, FileBasicInfo, &basicinfo, 0);
todo_wine
ok(!ret && GetLastError() == ERROR_BAD_LENGTH, "got %d, error %d\n", ret, GetLastError());
memset(&basicinfo, 0, sizeof(basicinfo));
ret = pGetFileInformationByHandleEx(file, FileBasicInfo, &basicinfo, sizeof(basicinfo));
ok(ret, "Failed to get basic info, error %d.\n", GetLastError());
atime = basicinfo.LastAccessTime;
basicinfo.LastAccessTime.QuadPart++;
ret = pSetFileInformationByHandle(file, FileBasicInfo, &basicinfo, sizeof(basicinfo));
ok(ret, "Failed to set basic info, error %d.\n", GetLastError());
memset(&basicinfo, 0, sizeof(basicinfo));
ret = pGetFileInformationByHandleEx(file, FileBasicInfo, &basicinfo, sizeof(basicinfo));
ok(ret, "Failed to get basic info, error %d.\n", GetLastError());
ok(atime.QuadPart + 1 == basicinfo.LastAccessTime.QuadPart, "Unexpected access time.\n");
dispinfo.DeleteFile = TRUE;
ret = pSetFileInformationByHandle(file, FileDispositionInfo, &dispinfo, sizeof(dispinfo));
ok(ret, "setting FileDispositionInfo failed, error %d\n", GetLastError());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment