ReactOS 0.4.15-dev-7674-gc0b4db1
devinst.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

NTSTATUS WaitNoPendingInstallEvents (IN PLARGE_INTEGER Timeout OPTIONAL)
 
BOOLEAN EnableUserModePnpManager (VOID)
 
BOOLEAN DisableUserModePnpManager (VOID)
 
NTSTATUS InitializeUserModePnpManager (IN HINF *phSetupInf)
 
VOID TerminateUserModePnpManager (VOID)
 

Function Documentation

◆ DisableUserModePnpManager()

BOOLEAN DisableUserModePnpManager ( VOID  )

Definition at line 544 of file devinst.c.

545{
546 /* Wait until all pending installations are done, then freeze the threads */
548 DPRINT1("WaitNoPendingInstallEvents() failed to wait!\n");
549
550 // TODO: use signalling events
551
554
555 return TRUE;
556}
#define DPRINT1
Definition: precomp.h:8
static HANDLE hPnpThread
Definition: devinst.c:25
static HANDLE hDeviceInstallThread
Definition: devinst.c:26
NTSTATUS WaitNoPendingInstallEvents(IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: devinst.c:514
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
NTSTATUS NTAPI NtSuspendThread(IN HANDLE ThreadHandle, OUT PULONG PreviousSuspendCount OPTIONAL)
Definition: state.c:352
#define STATUS_WAIT_0
Definition: ntstatus.h:237

Referenced by TerminateUserModePnpManager().

◆ EnableUserModePnpManager()

BOOLEAN EnableUserModePnpManager ( VOID  )

Definition at line 521 of file devinst.c.

522{
524
525 /* Start the PnP thread */
526 if (hPnpThread != NULL)
528
529 /*
530 * Wait a little bit so that we get a chance to have some events being
531 * queued by the time the device-installation thread becomes resumed.
532 */
533 Timeout.QuadPart = -10000000LL; /* Wait for 1 second */
535
536 /* Start the device installation thread */
539
540 return TRUE;
541}
static HANDLE hDeviceInstallListNotEmpty
Definition: devinst.c:31
#define FALSE
Definition: types.h:117
NTSYSAPI NTSTATUS NTAPI NtWaitForSingleObject(IN HANDLE hObject, IN BOOLEAN bAlertable, IN PLARGE_INTEGER Timeout)
NTSTATUS NTAPI NtResumeThread(IN HANDLE ThreadHandle, OUT PULONG SuspendCount OPTIONAL)
Definition: state.c:290
static ULONG Timeout
Definition: ping.c:61

Referenced by SetupStartPage().

◆ InitializeUserModePnpManager()

NTSTATUS InitializeUserModePnpManager ( IN HINF phSetupInf)

Definition at line 559 of file devinst.c.

561{
564
565 UNICODE_STRING EnumU = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Enum");
566 UNICODE_STRING ServicesU = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Services");
567
570 NULL,
572 FALSE);
573 if (!NT_SUCCESS(Status))
574 {
575 DPRINT1("Could not create the Pending-Install Event! (Status 0x%08lx)\n", Status);
576 goto Failure;
577 }
578
579 /*
580 * Initialize the device-install event list
581 */
582
585 NULL,
587 FALSE);
588 if (!NT_SUCCESS(Status))
589 {
590 DPRINT1("Could not create the List Event! (Status 0x%08lx)\n", Status);
591 goto Failure;
592 }
593
596 NULL, FALSE);
597 if (!NT_SUCCESS(Status))
598 {
599 DPRINT1("Could not create the List Mutex! (Status 0x%08lx)\n", Status);
600 goto Failure;
601 }
603
606 if (!NT_SUCCESS(Status))
607 {
608 DPRINT1("NtOpenKey('%wZ') failed (Status 0x%08lx)\n", &EnumU, Status);
609 goto Failure;
610 }
611
614 if (!NT_SUCCESS(Status))
615 {
616 DPRINT1("NtCreateKey('%wZ') failed (Status 0x%08lx)\n", &ServicesU, Status);
617 goto Failure;
618 }
619
620 /* Create the PnP event thread in suspended state */
622 NULL,
623 TRUE,
624 0,
625 0,
626 0,
628 NULL,
629 &hPnpThread,
630 NULL);
631 if (!NT_SUCCESS(Status))
632 {
633 DPRINT1("Failed to create the PnP event thread (Status 0x%08lx)\n", Status);
635 goto Failure;
636 }
637
638 /* Create the device installation thread in suspended state */
640 NULL,
641 TRUE,
642 0,
643 0,
644 0,
646 phSetupInf,
648 NULL);
649 if (!NT_SUCCESS(Status))
650 {
651 DPRINT1("Failed to create the device installation thread (Status 0x%08lx)\n", Status);
653 goto Failure;
654 }
655
656 return STATUS_SUCCESS;
657
658Failure:
659 if (hPnpThread)
660 {
663 }
665
666 if (hServicesKey)
669
670 if (hEnumKey)
672 hEnumKey = NULL;
673
677
681
685
686 return Status;
687}
LONG NTSTATUS
Definition: precomp.h:26
static ULONG NTAPI DeviceInstallThread(IN PVOID Parameter)
Definition: devinst.c:360
static ULONG NTAPI PnpEventThread(IN PVOID Parameter)
Definition: devinst.c:406
static HANDLE hServicesKey
Definition: devinst.c:21
static HANDLE hDeviceInstallListMutex
Definition: devinst.c:29
static HANDLE hNoPendingInstalls
Definition: devinst.c:23
static LIST_ENTRY DeviceInstallListHead
Definition: devinst.c:30
static HANDLE hEnumKey
Definition: devinst.c:20
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
Status
Definition: gdiplustypes.h:25
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define EVENT_ALL_ACCESS
Definition: isotest.c:82
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
NTSTATUS NTAPI NtCreateMutant(OUT PHANDLE MutantHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN BOOLEAN InitialOwner)
Definition: mutant.c:79
#define MUTANT_ALL_ACCESS
Definition: extypes.h:110
NTSYSAPI NTSTATUS NTAPI RtlCreateUserThread(_In_ PVOID ThreadContext, _Out_ HANDLE *OutThreadHandle, _Reserved_ PVOID Reserved1, _Reserved_ PVOID Reserved2, _Reserved_ PVOID Reserved3, _Reserved_ PVOID Reserved4, _Reserved_ PVOID Reserved5, _Reserved_ PVOID Reserved6, _Reserved_ PVOID Reserved7, _Reserved_ PVOID Reserved8)
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
NTSTATUS NtTerminateThread(IN HANDLE ThreadHandle OPTIONAL, IN NTSTATUS ExitStatus)
Definition: kill.c:1279
#define NtCurrentProcess()
Definition: nt_native.h:1657
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
NTSTATUS NTAPI NtCreateKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN ULONG TitleIndex, IN PUNICODE_STRING Class OPTIONAL, IN ULONG CreateOptions, OUT PULONG Disposition OPTIONAL)
Definition: ntapi.c:240
@ NotificationEvent
@ SynchronizationEvent
NTSTATUS NTAPI NtCreateEvent(OUT PHANDLE EventHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN EVENT_TYPE EventType, IN BOOLEAN InitialState)
Definition: event.c:96
#define L(x)
Definition: ntvdm.h:50
#define STATUS_SUCCESS
Definition: shellext.h:65
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

Referenced by RunUSetup().

◆ TerminateUserModePnpManager()

VOID TerminateUserModePnpManager ( VOID  )

Definition at line 690 of file devinst.c.

691{
693
694 // TODO: use signalling events
695
696 /* Kill the PnP thread as it blocks inside the NtGetPlugPlayEvent() call */
697 if (hPnpThread)
698 {
701 }
703
704 /* Kill the device installation thread */
706 {
709 }
711
712 /* Close the opened handles */
713
714 if (hServicesKey)
717
718 if (hEnumKey)
720 hEnumKey = NULL;
721
725
729}
BOOLEAN DisableUserModePnpManager(VOID)
Definition: devinst.c:544

Referenced by RunUSetup().

◆ WaitNoPendingInstallEvents()

NTSTATUS WaitNoPendingInstallEvents ( IN PLARGE_INTEGER Timeout  OPTIONAL)

Definition at line 514 of file devinst.c.

Referenced by DisableUserModePnpManager(), and SetupStartPage().