#define NDEBUG
#include <debug.h>
-/* Undefine some macros we implement here */
-#undef IoCallDriver
-#undef IoCompleteRequest
-
PIRP IopDeadIrp;
/* PRIVATE FUNCTIONS ********************************************************/
(Irp->IoStatus.Information == IO_REPARSE_TAG_MOUNT_POINT))
{
/* We should never get this yet */
- DPRINT1("Reparse support not yet present!\n");
- while (TRUE);
+ UNIMPLEMENTED_DBGBREAK("Reparse support not yet present!\n");
+ return;
}
}
/* Check if we should charge quota */
if (ChargeQuota)
{
- /* Irp = ExAllocatePoolWithQuotaTag(NonPagedPool, Size, TAG_IRP); */
- /* FIXME */
- Irp = ExAllocatePoolWithTag(NonPagedPool, Size, TAG_IRP);
+ Irp = ExAllocatePoolWithQuotaTag(NonPagedPool | POOL_QUOTA_FAIL_INSTEAD_OF_RAISE,
+ Size,
+ TAG_IRP);
}
else
{
- /* Allocate the IRP With no Quota charge */
+ /* Allocate the IRP with no quota charge */
Irp = ExAllocatePoolWithTag(NonPagedPool, Size, TAG_IRP);
}
/* Make sure it was sucessful */
- if (!Irp) return(NULL);
+ if (!Irp) return NULL;
}
else
{
return Irp;
}
+/*
+ * @implemented
+ */
+PIRP
+NTAPI
+IopAllocateIrpMustSucceed(IN CCHAR StackSize)
+{
+ LONG i;
+ PIRP Irp;
+ LARGE_INTEGER Sleep;
+
+ /* Try to get an IRP */
+ Irp = IoAllocateIrp(StackSize, FALSE);
+ if (Irp)
+ return Irp;
+
+ /* If we fail, start looping till we may get one */
+ i = LONG_MAX;
+ do {
+ i--;
+
+ /* First, sleep for 10ms */
+ Sleep.QuadPart = -10 * 1000 * 10;;
+ KeDelayExecutionThread(KernelMode, FALSE, &Sleep);
+
+ /* Then, retry allocation */
+ Irp = IoAllocateIrp(StackSize, FALSE);
+ if (Irp)
+ return Irp;
+ } while (i > 0);
+
+ return Irp;
+}
+
/*
* @implemented
*/
/*
* @implemented
*/
+#undef IoCallDriver
NTSTATUS
NTAPI
IoCallDriver(IN PDEVICE_OBJECT DeviceObject,
return IofCallDriver(DeviceObject, Irp);
}
+#define IoCallDriver IofCallDriver
+
/*
* @implemented
*/
+#undef IoCompleteRequest
VOID
NTAPI
IoCompleteRequest(IN PIRP Irp,
IofCompleteRequest(Irp, PriorityBoost);
}
+#define IoCompleteRequest IofCompleteRequest
+
/*
* @implemented
*/
PriorityBoost);
#else
/* Not implemented yet. */
- DPRINT1("Not supported!\n");
- while (TRUE);
+ UNIMPLEMENTED_DBGBREAK("Not supported!\n");
#endif
}
/* Return the requestor process */
if (Irp->Tail.Overlay.Thread)
{
- return Irp->Tail.Overlay.Thread->ThreadsProcess;
+ if (Irp->ApcEnvironment == OriginalApcEnvironment)
+ {
+ return Irp->Tail.Overlay.Thread->ThreadsProcess;
+ }
+ else if (Irp->ApcEnvironment == AttachedApcEnvironment)
+ {
+ return (PEPROCESS)Irp->Tail.Overlay.Thread->Tcb.ApcState.Process;
+ }
}
return NULL;
PEPROCESS Process;
/* Return the requestor process' id */
- if ((Process = IoGetRequestorProcess(Irp)))
- {
- return PtrToUlong(Process->UniqueProcessId);
- }
+ Process = IoGetRequestorProcess(Irp);
+ if (Process) return PtrToUlong(Process->UniqueProcessId);
return 0;
}
PEPROCESS Process;
/* Return the session */
- if ((Process = IoGetRequestorProcess(Irp)))
+ if (Irp->Tail.Overlay.Thread)
{
- *pSessionId = Process->Session;
+ Process = Irp->Tail.Overlay.Thread->ThreadsProcess;
+ *pSessionId = MmGetSessionId(Process);
return STATUS_SUCCESS;
}
IoIs32bitProcess(
IN PIRP Irp OPTIONAL)
{
-#pragma message "IoIs32bitProcess is hardcoded to FALSE"
+ UNIMPLEMENTED;
return FALSE;
}
#endif