First attempt at implementing NtGetPlugPlayEvent.

svn path=/trunk/; revision=13377
This commit is contained in:
Eric Kohl 2005-02-01 16:24:10 +00:00
parent 7a91135976
commit 0a44e5f7e6
4 changed files with 145 additions and 36 deletions

View file

@ -2702,7 +2702,7 @@ ZwQueryFullAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes,
FileNamesInformation FILE_NAMES_INFORMATION FileNamesInformation FILE_NAMES_INFORMATION
FileDispositionInformation FILE_DISPOSITION_INFORMATION FileDispositionInformation FILE_DISPOSITION_INFORMATION
FilePositionInformation FILE_POSITION_INFORMATION FilePositionInformation FILE_POSITION_INFORMATION
FileFullEaInformation FILE_FULL_EA_INFORMATION FileFullEaInformation FILE_FULL_EA_INFORMATION
FileModeInformation FILE_MODE_INFORMATION FileModeInformation FILE_MODE_INFORMATION
FileAlignmentInformation FILE_ALIGNMENT_INFORMATION FileAlignmentInformation FILE_ALIGNMENT_INFORMATION
FileAllInformation FILE_ALL_INFORMATION FileAllInformation FILE_ALL_INFORMATION
@ -2715,7 +2715,7 @@ ZwQueryFullAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes,
FilePipeRemoteInformation FilePipeRemoteInformation
FileMailslotQueryInformation FileMailslotQueryInformation
FileMailslotSetInformation FileMailslotSetInformation
FileCompressionInformation FILE_COMPRESSION_INFORMATION FileCompressionInformation FILE_COMPRESSION_INFORMATION
FileCopyOnWriteInformation FileCopyOnWriteInformation
FileCompletionInformation IO_COMPLETION_CONTEXT FileCompletionInformation IO_COMPLETION_CONTEXT
FileMoveClusterInformation FileMoveClusterInformation
@ -2728,7 +2728,7 @@ ZwQueryFullAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes,
FileContentIndexInformation FileContentIndexInformation
FileInheritContentIndexInformation FileInheritContentIndexInformation
FileOleInformation FileOleInformation
FileMaximumInformation FileMaximumInformation
* REMARK: * REMARK:
* This procedure maps to the win32 GetShortPathName, GetLongPathName, * This procedure maps to the win32 GetShortPathName, GetLongPathName,
@ -4933,16 +4933,16 @@ ZwYieldExecution(
NTSTATUS NTSTATUS
STDCALL STDCALL
NtPlugPlayControl (DWORD Unknown1, NtPlugPlayControl(IN ULONG ControlCode,
DWORD Unknown2, IN OUT PVOID Buffer,
DWORD Unknown3); IN ULONG BufferLength);
NTSTATUS NTSTATUS
STDCALL STDCALL
NtGetPlugPlayEvent (ULONG Reserved1, NtGetPlugPlayEvent(IN ULONG Reserved1,
ULONG Reserved2, IN ULONG Reserved2,
PVOID Buffer, OUT PVOID Buffer,
ULONG BufferLength); IN ULONG BufferLength);
/* --- POWER MANAGEMENT --- */ /* --- POWER MANAGEMENT --- */
@ -5027,12 +5027,6 @@ NtSetLdtEntries (ULONG Selector1,
ULONG Selector2, ULONG Selector2,
LDT_ENTRY LdtEntry2); LDT_ENTRY LdtEntry2);
NTSTATUS
STDCALL
NtQueryOleDirectoryFile (
VOID
);
/* /*
* FUNCTION: Checks a clients access rights to a object * FUNCTION: Checks a clients access rights to a object
* ARGUMENTS: * ARGUMENTS:

View file

@ -500,6 +500,13 @@ IopMarkLastReinitializeDriver(VOID);
VOID FASTCALL VOID FASTCALL
IopReinitializeDrivers(VOID); IopReinitializeDrivers(VOID);
/* pnpevent.c */
NTSTATUS INIT_FUNCTION
IopInitPlugPlayEvents(VOID);
/* pnpmgr.c */ /* pnpmgr.c */
NTSTATUS NTSTATUS

View file

@ -1,9 +1,9 @@
/* $Id:$ /* $Id$
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/plugplay.c * FILE: ntoskrnl/io/plugplay.c
* PURPOSE: Mysterious nt4 support for plug-and-play * PURPOSE: Plug-and-play interface routines
* *
* PROGRAMMERS: David Welch (welch@mcmail.com) * PROGRAMMERS: David Welch (welch@mcmail.com)
*/ */
@ -11,27 +11,129 @@
/* INCLUDES *****************************************************************/ /* INCLUDES *****************************************************************/
#include <ntoskrnl.h> #include <ntoskrnl.h>
#define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
/* GLOBALS *******************************************************************/
static LIST_ENTRY IopPnpEventListHead;
static KEVENT IopPnpNotifyEvent;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
NTSTATUS NTSTATUS INIT_FUNCTION
STDCALL IopInitPlugPlayEvents(VOID)
NtPlugPlayControl (DWORD Unknown1,
DWORD Unknown2,
DWORD Unknown3)
{ {
UNIMPLEMENTED;
return(STATUS_NOT_IMPLEMENTED); InitializeListHead(&IopPnpEventListHead);
KeInitializeEvent(&IopPnpNotifyEvent,
NotificationEvent,
FALSE);
return STATUS_SUCCESS;
} }
NTSTATUS
STDCALL #if 0
NtGetPlugPlayEvent (ULONG Reserved1, /* Insert a new pnp event at the head of the event queue */
ULONG Reserved2, VOID
PVOID Buffer, IopEnqueuePlugPlayEvent(VOID)
ULONG BufferLength)
{ {
UNIMPLEMENTED;
return(STATUS_NOT_IMPLEMENTED);
} }
#endif
#if 0
/*
* Remove the current PnP event from the tail of the event queue
* and signal IopPnpNotifyEvent if there is yet another event in the queue.
*/
VOID
IopDequeuePlugPlayEvent(VOID)
{
}
#endif
/*
* @unimplemented
*/
NTSTATUS STDCALL
NtGetPlugPlayEvent(IN ULONG Reserved1,
IN ULONG Reserved2,
OUT PVOID Buffer,
IN ULONG BufferLength)
{
NTSTATUS Status;
DPRINT("NtGetPlugPlayEvent() called\n");
/* Function can only be called from user-mode */
if (KeGetPreviousMode() != UserMode)
{
DPRINT1("NtGetPlugPlayEvent cannot be called from kernel mode!\n");
return STATUS_ACCESS_DENIED;
}
/* Check for Tcb privilege */
if (!SeSinglePrivilegeCheck(SeTcbPrivilege,
UserMode))
{
DPRINT1("NtGetPlugPlayEvent: Caller requires the SeTcbPrivilege privilege!\n");
return STATUS_PRIVILEGE_NOT_HELD;
}
/* Wait for a PnP event */
DPRINT("Waiting for pnp notification event\n");
Status = KeWaitForSingleObject(&IopPnpNotifyEvent,
UserRequest,
KernelMode,
FALSE,
NULL);
if (NT_SUCCESS(Status))
{
DPRINT("Waiting done\n");
#if 0
/* Get entry from the tail of the list */
Entry = IopPnpEventListHead.Blink;
/* Check the buffer size */
if (BufferLength < Entry->Event.Size)
{
DPRINT1("Buffer is too small for the pnp-event\n");
return STATUS_BUFFER_TOO_SMALL;
}
/* Copy event data to user buffer */
memcpy(Buffer,
&Entry->Event,
&Entry->Event.Size);
#endif
}
DPRINT("NtGetPlugPlayEvent() done\n");
return Status;
}
/*
* @unimplemented
*/
NTSTATUS STDCALL
NtPlugPlayControl(IN ULONG ControlCode,
IN OUT PVOID Buffer,
IN ULONG BufferLength)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
/* EOF */

View file

@ -481,7 +481,7 @@ IopGetSystemPowerDeviceObject(PDEVICE_OBJECT *DeviceObject)
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
/********************************************************************** /*
* DESCRIPTION * DESCRIPTION
* Creates a device node * Creates a device node
* *
@ -1556,7 +1556,6 @@ IopActionInitAllServices(
* parent node. This function just calls IopActionInitChildServices with * parent node. This function just calls IopActionInitChildServices with
* BootDrivers = TRUE. * BootDrivers = TRUE.
*/ */
NTSTATUS NTSTATUS
IopActionInitBootServices( IopActionInitBootServices(
PDEVICE_NODE DeviceNode, PDEVICE_NODE DeviceNode,
@ -1581,7 +1580,6 @@ IopActionInitBootServices(
* Return Value * Return Value
* Status * Status
*/ */
NTSTATUS NTSTATUS
IopInitializePnpServices( IopInitializePnpServices(
IN PDEVICE_NODE DeviceNode, IN PDEVICE_NODE DeviceNode,
@ -1768,6 +1766,14 @@ PnpInit(VOID)
KeInitializeSpinLock(&IopDeviceTreeLock); KeInitializeSpinLock(&IopDeviceTreeLock);
/* Initialize PnP-Event notification support */
Status = IopInitPlugPlayEvents();
if (!NT_SUCCESS(Status))
{
CPRINT("IopInitPlugPlayEvents() failed\n");
KEBUGCHECKEX(PHASE1_INITIALIZATION_FAILED, Status, 0, 0, 0);
}
/* /*
* Create root device node * Create root device node
*/ */