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

View file

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

View file

@ -1,9 +1,9 @@
/* $Id:$
/* $Id$
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* 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)
*/
@ -11,27 +11,129 @@
/* INCLUDES *****************************************************************/
#include <ntoskrnl.h>
#define NDEBUG
#include <internal/debug.h>
/* GLOBALS *******************************************************************/
static LIST_ENTRY IopPnpEventListHead;
static KEVENT IopPnpNotifyEvent;
/* FUNCTIONS *****************************************************************/
NTSTATUS
STDCALL
NtPlugPlayControl (DWORD Unknown1,
DWORD Unknown2,
DWORD Unknown3)
NTSTATUS INIT_FUNCTION
IopInitPlugPlayEvents(VOID)
{
UNIMPLEMENTED;
return(STATUS_NOT_IMPLEMENTED);
InitializeListHead(&IopPnpEventListHead);
KeInitializeEvent(&IopPnpNotifyEvent,
NotificationEvent,
FALSE);
return STATUS_SUCCESS;
}
NTSTATUS
STDCALL
NtGetPlugPlayEvent (ULONG Reserved1,
ULONG Reserved2,
PVOID Buffer,
ULONG BufferLength)
#if 0
/* Insert a new pnp event at the head of the event queue */
VOID
IopEnqueuePlugPlayEvent(VOID)
{
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;
}
/**********************************************************************
/*
* DESCRIPTION
* Creates a device node
*
@ -1556,7 +1556,6 @@ IopActionInitAllServices(
* parent node. This function just calls IopActionInitChildServices with
* BootDrivers = TRUE.
*/
NTSTATUS
IopActionInitBootServices(
PDEVICE_NODE DeviceNode,
@ -1581,7 +1580,6 @@ IopActionInitBootServices(
* Return Value
* Status
*/
NTSTATUS
IopInitializePnpServices(
IN PDEVICE_NODE DeviceNode,
@ -1768,6 +1766,14 @@ PnpInit(VOID)
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
*/