kernel32: Forward SetFileInformationByHandle FileDispositionInfo class to ntdll.

This commit is contained in:
Michael Müller 2015-06-10 07:56:32 +02:00 committed by Alexandre Julliard
parent bdef5c5508
commit 7fe0b56e15
2 changed files with 28 additions and 1 deletions

View File

@ -1046,6 +1046,9 @@ BOOL WINAPI SetEndOfFile( HANDLE hFile )
*/
BOOL WINAPI SetFileInformationByHandle( HANDLE file, FILE_INFO_BY_HANDLE_CLASS class, VOID *info, DWORD size )
{
NTSTATUS status;
IO_STATUS_BLOCK io;
TRACE( "%p %u %p %u\n", file, class, info, size );
switch (class)
@ -1053,7 +1056,6 @@ BOOL WINAPI SetFileInformationByHandle( HANDLE file, FILE_INFO_BY_HANDLE_CLASS c
case FileBasicInfo:
case FileNameInfo:
case FileRenameInfo:
case FileDispositionInfo:
case FileAllocationInfo:
case FileEndOfFileInfo:
case FileStreamInfo:
@ -1071,6 +1073,10 @@ BOOL WINAPI SetFileInformationByHandle( HANDLE file, FILE_INFO_BY_HANDLE_CLASS c
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return FALSE;
case FileDispositionInfo:
status = NtSetInformationFile( file, &io, info, size, FileDispositionInformation );
break;
case FileStandardInfo:
case FileCompressionInfo:
case FileAttributeTagInfo:
@ -1080,6 +1086,11 @@ BOOL WINAPI SetFileInformationByHandle( HANDLE file, FILE_INFO_BY_HANDLE_CLASS c
return FALSE;
}
if (status != STATUS_SUCCESS)
{
SetLastError( RtlNtStatusToDosError( status ) );
return FALSE;
}
return TRUE;
}

View File

@ -38,6 +38,10 @@
#include "winnls.h"
#include "fileapi.h"
#ifdef WINE_NO_UNICODE_MACROS
#undef DeleteFile /* needed for FILE_DISPOSITION_INFO */
#endif
static HANDLE (WINAPI *pFindFirstFileExA)(LPCSTR,FINDEX_INFO_LEVELS,LPVOID,FINDEX_SEARCH_OPS,LPVOID,DWORD);
static BOOL (WINAPI *pReplaceFileA)(LPCSTR, LPCSTR, LPCSTR, DWORD, LPVOID, LPVOID);
static BOOL (WINAPI *pReplaceFileW)(LPCWSTR, LPCWSTR, LPCWSTR, DWORD, LPVOID, LPVOID);
@ -4589,6 +4593,7 @@ static void test_SetFileInformationByHandle(void)
FILE_REMOTE_PROTOCOL_INFO protinfo = { 0 };
FILE_STANDARD_INFO stdinfo = { };
FILE_COMPRESSION_INFO compressinfo;
FILE_DISPOSITION_INFO dispinfo;
char tempFileName[MAX_PATH];
char tempPath[MAX_PATH];
HANDLE file;
@ -4632,6 +4637,17 @@ static void test_SetFileInformationByHandle(void)
ret = pSetFileInformationByHandle(file, FileRemoteProtocolInfo, &protinfo, sizeof(protinfo));
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "got %d, error %d\n", ret, GetLastError());
/* test FileDispositionInfo, additional details already covered by ntdll tests */
SetLastError(0xdeadbeef);
ret = pSetFileInformationByHandle(file, FileDispositionInfo, &dispinfo, 0);
todo_wine
ok(!ret && GetLastError() == ERROR_BAD_LENGTH, "got %d, error %d\n", ret, GetLastError());
dispinfo.DeleteFile = TRUE;
ret = pSetFileInformationByHandle(file, FileDispositionInfo, &dispinfo, sizeof(dispinfo));
todo_wine
ok(ret, "setting FileDispositionInfo failed, error %d\n", GetLastError());
CloseHandle(file);
}