[0.4.13][BTRFS] Create system threads with OBJ_KERNEL_HANDLE

CORE-16375 #1914

Thanks to patches author ThFabba.
According to JIRA user 'Zero3k' this allows to format a
BTRFS drive again without INVALID_KERNEL_HANDLE BSOD.

Master remains affected,
our devs wait for upstream integration
This commit is contained in:
Joachim Henze 2019-10-13 22:11:43 +02:00
parent e2e90230d1
commit c722bc867e
6 changed files with 49 additions and 1 deletions

View file

@ -3599,7 +3599,11 @@ NTSTATUS start_balance(device_extension* Vcb, void* data, ULONG length, KPROCESS
Vcb->balance.status = STATUS_SUCCESS;
KeInitializeEvent(&Vcb->balance.event, NotificationEvent, !Vcb->balance.paused);
#if defined(__REACTOS__) && (NTDDI_VERSION < NTDDI_VISTA)
Status = PsCreateSystemThread(&Vcb->balance.thread, 0, &system_thread_attributes, NULL, NULL, balance_thread, Vcb);
#else
Status = PsCreateSystemThread(&Vcb->balance.thread, 0, NULL, NULL, NULL, balance_thread, Vcb);
#endif
if (!NT_SUCCESS(Status)) {
ERR("PsCreateSystemThread returned %08x\n", Status);
return Status;
@ -3679,7 +3683,11 @@ NTSTATUS look_for_balance_item(_Requires_lock_held_(_Curr_->tree_lock) device_ex
Vcb->balance.status = STATUS_SUCCESS;
KeInitializeEvent(&Vcb->balance.event, NotificationEvent, !Vcb->balance.paused);
#if defined(__REACTOS__) && (NTDDI_VERSION < NTDDI_VISTA)
Status = PsCreateSystemThread(&Vcb->balance.thread, 0, &system_thread_attributes, NULL, NULL, balance_thread, Vcb);
#else
Status = PsCreateSystemThread(&Vcb->balance.thread, 0, NULL, NULL, NULL, balance_thread, Vcb);
#endif
if (!NT_SUCCESS(Status)) {
ERR("PsCreateSystemThread returned %08x\n", Status);
return Status;
@ -3876,7 +3884,11 @@ NTSTATUS remove_device(device_extension* Vcb, void* data, ULONG length, KPROCESS
Vcb->balance.status = STATUS_SUCCESS;
KeInitializeEvent(&Vcb->balance.event, NotificationEvent, !Vcb->balance.paused);
#if defined(__REACTOS__) && (NTDDI_VERSION < NTDDI_VISTA)
Status = PsCreateSystemThread(&Vcb->balance.thread, 0, &system_thread_attributes, NULL, NULL, balance_thread, Vcb);
#else
Status = PsCreateSystemThread(&Vcb->balance.thread, 0, NULL, NULL, NULL, balance_thread, Vcb);
#endif
if (!NT_SUCCESS(Status)) {
ERR("PsCreateSystemThread returned %08x\n", Status);
dev->reloc = false;