[KERNEL32] Implement SetFileCompletionNotificationModes

Call native Nt* function to do the actual work, similarly to as it done in Wine: 530c183960:/dlls/kernel32/file.c#l258.
Also add/fix some declarations in internal kernel32/public ndk neaders, to fix compilation.
CORE-17821
This commit is contained in:
Oleg Dubinskiy 2021-10-20 01:22:29 +03:00 committed by George Bișoc
parent fe0415a4ba
commit 334ab0f2a5
3 changed files with 28 additions and 5 deletions

View file

@ -3,7 +3,8 @@
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
* FILE: dll/win32/kernel32/client/file/iocompl.c * FILE: dll/win32/kernel32/client/file/iocompl.c
* PURPOSE: Io Completion functions * PURPOSE: Io Completion functions
* PROGRAMMER: Ariadne ( ariadne@xs4all.nl) * PROGRAMMERS: Ariadne (ariadne@xs4all.nl)
* Oleg Dubinskiy (oleg.dubinskij2013@yandex.ua)
* UPDATE HISTORY: * UPDATE HISTORY:
* Created 01/11/98 * Created 01/11/98
*/ */
@ -23,21 +24,37 @@
#endif #endif
/* /*
* @unimplemented * @implemented
*/ */
BOOL BOOL
WINAPI WINAPI
SetFileCompletionNotificationModes(IN HANDLE FileHandle, SetFileCompletionNotificationModes(IN HANDLE FileHandle,
IN UCHAR Flags) IN UCHAR Flags)
{ {
NTSTATUS Status;
FILE_IO_COMPLETION_NOTIFICATION_INFORMATION FileInformation;
IO_STATUS_BLOCK IoStatusBlock;
if (Flags & ~(FILE_SKIP_COMPLETION_PORT_ON_SUCCESS | FILE_SKIP_SET_EVENT_ON_HANDLE)) if (Flags & ~(FILE_SKIP_COMPLETION_PORT_ON_SUCCESS | FILE_SKIP_SET_EVENT_ON_HANDLE))
{ {
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return FALSE; return FALSE;
} }
UNIMPLEMENTED; FileInformation.Flags = Flags;
return FALSE;
Status = NtSetInformationFile(FileHandle,
&IoStatusBlock,
&FileInformation,
sizeof(FileInformation),
FileIoCompletionNotificationInformation);
if (!NT_SUCCESS(Status))
{
BaseSetLastNTError(Status);
return FALSE;
}
return TRUE;
} }
/* /*

View file

@ -35,6 +35,7 @@
#include <ndk/cmfuncs.h> #include <ndk/cmfuncs.h>
#include <ndk/exfuncs.h> #include <ndk/exfuncs.h>
#include <ndk/iofuncs.h> #include <ndk/iofuncs.h>
#include <ndk/iotypes.h>
#include <ndk/kdtypes.h> #include <ndk/kdtypes.h>
#include <ndk/kefuncs.h> #include <ndk/kefuncs.h>
#include <ndk/ldrfuncs.h> #include <ndk/ldrfuncs.h>

View file

@ -323,8 +323,8 @@ typedef enum _FILE_INFORMATION_CLASS
FileIdFullDirectoryInformation, FileIdFullDirectoryInformation,
FileValidDataLengthInformation, FileValidDataLengthInformation,
FileShortNameInformation, FileShortNameInformation,
#if (NTDDI_VERSION >= NTDDI_VISTA)
FileIoCompletionNotificationInformation, FileIoCompletionNotificationInformation,
#if (NTDDI_VERSION >= NTDDI_VISTA)
FileIoStatusBlockRangeInformation, FileIoStatusBlockRangeInformation,
FileIoPriorityHintInformation, FileIoPriorityHintInformation,
FileSfioReserveInformation, FileSfioReserveInformation,
@ -604,6 +604,11 @@ typedef struct _FILE_COMPLETION_INFORMATION
PVOID Key; PVOID Key;
} FILE_COMPLETION_INFORMATION, *PFILE_COMPLETION_INFORMATION; } FILE_COMPLETION_INFORMATION, *PFILE_COMPLETION_INFORMATION;
typedef struct _FILE_IO_COMPLETION_NOTIFICATION_INFORMATION
{
ULONG Flags;
} FILE_IO_COMPLETION_NOTIFICATION_INFORMATION, *PFILE_IO_COMPLETION_NOTIFICATION_INFORMATION;
typedef struct _FILE_LINK_INFORMATION typedef struct _FILE_LINK_INFORMATION
{ {
BOOLEAN ReplaceIfExists; BOOLEAN ReplaceIfExists;