mirror of
https://github.com/reactos/reactos.git
synced 2024-11-22 19:13:33 +08:00
[FORMATTING][NTOS][HAL][DRIVERS][SDK] Fix trailing spaces
This commit is contained in:
parent
4b4ffa92f5
commit
34593d933b
@ -77,7 +77,7 @@ ConDrvDeleteController(IN PDRIVER_OBJECT DriverObject)
|
||||
|
||||
RtlInitUnicodeString(&SymlinkName, DD_CONDRV_CTRL_SYMLNK_NAME_U);
|
||||
IoDeleteSymbolicLink(&SymlinkName);
|
||||
|
||||
|
||||
/* Delete the controller device itself */
|
||||
IoDeleteDevice(Controller);
|
||||
|
||||
|
@ -59,13 +59,13 @@ get_packet:
|
||||
break;
|
||||
}
|
||||
CheckSum += (CHAR)Byte;
|
||||
|
||||
|
||||
/* See if we should escape */
|
||||
if (Byte == 0x7d)
|
||||
{
|
||||
Status = KdpReceiveByte(&Byte);
|
||||
if (Status != KdPacketReceived)
|
||||
return Status;
|
||||
return Status;
|
||||
CheckSum += (CHAR)Byte;
|
||||
Byte ^= 0x20;
|
||||
}
|
||||
@ -100,7 +100,7 @@ end:
|
||||
case '$':
|
||||
KDDBGPRINT("Received new packet just after %s.\n", gdb_input);
|
||||
goto get_packet;
|
||||
case 0x03:
|
||||
case 0x03:
|
||||
KdContext->KdpControlCPending = TRUE;
|
||||
break;
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ send_gdb_packet(_In_ const CHAR* Buffer)
|
||||
return finish_gdb_packet();
|
||||
}
|
||||
|
||||
ULONG
|
||||
ULONG
|
||||
send_gdb_partial_binary(
|
||||
_In_ const VOID* Buffer,
|
||||
_In_ size_t Length)
|
||||
@ -136,7 +136,7 @@ send_gdb_partial_binary(
|
||||
return Sent;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
send_gdb_partial_memory(
|
||||
_In_ const VOID* Buffer,
|
||||
_In_ size_t Length)
|
||||
@ -172,7 +172,7 @@ gdb_send_debug_io(
|
||||
CHAR gdb_out[3];
|
||||
CHAR* ptr = String->Buffer;
|
||||
USHORT Length = String->Length;
|
||||
|
||||
|
||||
gdb_out[2] = '\0';
|
||||
|
||||
start_gdb_packet();
|
||||
|
@ -52,7 +52,7 @@ find_thread(
|
||||
|
||||
if (
|
||||
#if !MONOPROCESS
|
||||
(Pid == 0) &&
|
||||
(Pid == 0) &&
|
||||
#endif
|
||||
(Tid == 0))
|
||||
{
|
||||
|
@ -201,7 +201,7 @@ NTSTATUS NTAPI FreeBT_AddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJEC
|
||||
deviceExtension->OutStandingIO = 1;
|
||||
KeInitializeSpinLock(&deviceExtension->IOCountLock);
|
||||
|
||||
#ifdef ENABLE_WMI
|
||||
#ifdef ENABLE_WMI
|
||||
// Delegating to WMILIB
|
||||
ntStatus = FreeBT_WmiRegistration(deviceExtension);
|
||||
if (!NT_SUCCESS(ntStatus))
|
||||
|
@ -44,7 +44,7 @@
|
||||
#define FBT_HCI_PACKET_BOUNDARY_FRAGMENT 0x01
|
||||
#define FBT_HCI_PACKET_BOUNDARY_START 0x02
|
||||
|
||||
#define FBT_HCI_BROADCAST_POINT_TO_POINT 0x00
|
||||
#define FBT_HCI_BROADCAST_POINT_TO_POINT 0x00
|
||||
#define FBT_HCI_BROADCAST_ACTIVE_SLAVE 0x01
|
||||
#define FBT_HCI_BROADCAST_PARKED_SLAVE 0x02
|
||||
|
||||
|
@ -6,7 +6,7 @@ class CReg
|
||||
public:
|
||||
// Constructor
|
||||
CReg(LPCSTR lpszSubKey, HKEY hRootKey=HKEY_CURRENT_USER, REGSAM regSam=KEY_ALL_ACCESS, BOOL bCreate=TRUE);
|
||||
|
||||
|
||||
// Destructor
|
||||
~CReg();
|
||||
|
||||
@ -16,7 +16,7 @@ class CReg
|
||||
// BOOL GetValue(LPCSTR lpszValueName, CString &szData, DWORD *dwDataType=NULL);
|
||||
BOOL GetValue(LPCSTR lpszValueName, DWORD &dwData);
|
||||
BOOL GetValue(LPCSTR lpszValueName, BOOL &bData);
|
||||
|
||||
|
||||
// Set the specified registry value
|
||||
BOOL SetValue(LPCSTR lpszValueName, const LPVOID lpvData, DWORD dwDataSize, DWORD dwDataType=REG_SZ);
|
||||
BOOL SetValue(LPCSTR lpszValueName, LPCSTR lpszValue, DWORD dwDataSize=0, DWORD dwDataType=REG_SZ);
|
||||
@ -30,13 +30,13 @@ class CReg
|
||||
|
||||
// Delete all the values in the key
|
||||
BOOL DeleteValues();
|
||||
|
||||
|
||||
// Delete a sub key
|
||||
BOOL DeleteKey(LPCSTR lpszKeyName);
|
||||
|
||||
// Retrieve the names of the values in the key
|
||||
// BOOL EnumerateValues(CStringArray &nszValueNames);
|
||||
|
||||
|
||||
BOOL IsValid() {return m_hKey!=NULL;}
|
||||
|
||||
protected:
|
||||
@ -47,12 +47,12 @@ class CReg
|
||||
LONG Open(LPCSTR lpszSubKey, HKEY hRootKey, HKEY *hKey=NULL, REGSAM regSam=NULL, BOOL bCreate=TRUE);
|
||||
|
||||
BOOL DeleteKey(HKEY hRootKey, HKEY hKey, LPCSTR szKey, LPCSTR szSubKey);
|
||||
|
||||
|
||||
// CString m_szKey; // Name of key this object wraps
|
||||
char m_szKey[1024]; // Name of key this object wraps
|
||||
HKEY m_hRootKey; // Root key of the wrapped key
|
||||
HKEY m_hKey; // Key generated by Open/Create
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -92,7 +92,7 @@ acpi_button_notify_fixed (
|
||||
void *data)
|
||||
{
|
||||
struct acpi_button *button = (struct acpi_button *) data;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_button_notify_fixed");
|
||||
|
||||
if (!button)
|
||||
@ -134,35 +134,35 @@ acpi_button_add (
|
||||
button->type = ACPI_BUTTON_TYPE_POWER;
|
||||
sprintf(acpi_device_name(device), "%s",
|
||||
ACPI_BUTTON_DEVICE_NAME_POWER);
|
||||
sprintf(acpi_device_class(device), "%s/%s",
|
||||
sprintf(acpi_device_class(device), "%s/%s",
|
||||
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
|
||||
}
|
||||
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWERF)) {
|
||||
button->type = ACPI_BUTTON_TYPE_POWERF;
|
||||
sprintf(acpi_device_name(device), "%s",
|
||||
ACPI_BUTTON_DEVICE_NAME_POWERF);
|
||||
sprintf(acpi_device_class(device), "%s/%s",
|
||||
sprintf(acpi_device_class(device), "%s/%s",
|
||||
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
|
||||
}
|
||||
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEP)) {
|
||||
button->type = ACPI_BUTTON_TYPE_SLEEP;
|
||||
sprintf(acpi_device_name(device), "%s",
|
||||
ACPI_BUTTON_DEVICE_NAME_SLEEP);
|
||||
sprintf(acpi_device_class(device), "%s/%s",
|
||||
sprintf(acpi_device_class(device), "%s/%s",
|
||||
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
|
||||
}
|
||||
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEPF)) {
|
||||
button->type = ACPI_BUTTON_TYPE_SLEEPF;
|
||||
sprintf(acpi_device_name(device), "%s",
|
||||
ACPI_BUTTON_DEVICE_NAME_SLEEPF);
|
||||
sprintf(acpi_device_class(device), "%s/%s",
|
||||
sprintf(acpi_device_class(device), "%s/%s",
|
||||
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
|
||||
}
|
||||
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_LID)) {
|
||||
button->type = ACPI_BUTTON_TYPE_LID;
|
||||
sprintf(acpi_device_name(device), "%s",
|
||||
ACPI_BUTTON_DEVICE_NAME_LID);
|
||||
sprintf(acpi_device_class(device), "%s/%s",
|
||||
sprintf(acpi_device_class(device), "%s/%s",
|
||||
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID);
|
||||
}
|
||||
else {
|
||||
@ -239,7 +239,7 @@ acpi_button_add (
|
||||
goto end;
|
||||
}
|
||||
|
||||
DPRINT("%s [%s]\n",
|
||||
DPRINT("%s [%s]\n",
|
||||
acpi_device_name(device), acpi_device_bid(device));
|
||||
|
||||
end:
|
||||
@ -294,7 +294,7 @@ acpi_button_remove (struct acpi_device *device, int type)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
int
|
||||
acpi_button_init (void)
|
||||
{
|
||||
int result = 0;
|
||||
@ -310,7 +310,7 @@ acpi_button_init (void)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
acpi_button_exit (void)
|
||||
{
|
||||
ACPI_FUNCTION_TRACE("acpi_button_exit");
|
||||
|
@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
/* Modified for ReactOS and latest ACPICA
|
||||
* Copyright (C)2009 Samuel Serapion
|
||||
* Copyright (C)2009 Samuel Serapion
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
@ -84,7 +84,7 @@ acpi_system_add (
|
||||
sprintf(acpi_device_class(device), "%s", ACPI_SYSTEM_CLASS);
|
||||
acpi_driver_data(device) = system;
|
||||
|
||||
DPRINT("%s [%s] (supports",
|
||||
DPRINT("%s [%s] (supports",
|
||||
acpi_device_name(device), acpi_device_bid(device));
|
||||
for (i=0; i<ACPI_S_STATE_COUNT; i++) {
|
||||
UINT8 type_a, type_b;
|
||||
@ -97,7 +97,7 @@ acpi_system_add (
|
||||
system->states[i] = 1;
|
||||
}
|
||||
/* no break */
|
||||
default:
|
||||
default:
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
system->states[i] = 1;
|
||||
DPRINT(" S%d", i);
|
||||
@ -156,7 +156,7 @@ ACPI_STATUS
|
||||
acpi_system_restore_state(
|
||||
UINT32 state)
|
||||
{
|
||||
/*
|
||||
/*
|
||||
* We should only be here if we're coming back from STR or STD.
|
||||
* And, in the case of the latter, the memory image should have already
|
||||
* been loaded from disk.
|
||||
@ -167,7 +167,7 @@ acpi_system_restore_state(
|
||||
/* Do _early_ resume for irqs. Required by
|
||||
* ACPI specs.
|
||||
*/
|
||||
/* TBD: call arch dependant reinitialization of the
|
||||
/* TBD: call arch dependant reinitialization of the
|
||||
* interrupts.
|
||||
*/
|
||||
#ifdef _X86_
|
||||
@ -239,7 +239,7 @@ acpi_system_save_state(
|
||||
// return error;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
/* flush caches */
|
||||
ACPI_FLUSH_CPU_CACHE();
|
||||
|
||||
@ -395,7 +395,7 @@ acpi_suspend (
|
||||
return status;
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
acpi_system_init (void)
|
||||
{
|
||||
int result = 0;
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <debug.h>
|
||||
|
||||
/* Modified for ReactOS and latest ACPICA
|
||||
* Copyright (C)2009 Samuel Serapion
|
||||
* Copyright (C)2009 Samuel Serapion
|
||||
*/
|
||||
|
||||
#define _COMPONENT ACPI_BUS_COMPONENT
|
||||
@ -301,24 +301,24 @@ acpi_evaluate_reference (
|
||||
package = (ACPI_OBJECT *) buffer.Pointer;
|
||||
|
||||
if ((buffer.Length == 0) || !package) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"No return object (len %X ptr %p)\n",
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"No return object (len %X ptr %p)\n",
|
||||
buffer.Length, package));
|
||||
status = AE_BAD_DATA;
|
||||
acpi_util_eval_error(handle, pathname, status);
|
||||
goto end;
|
||||
}
|
||||
if (package->Type != ACPI_TYPE_PACKAGE) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Expecting a [Package], found type %X\n",
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Expecting a [Package], found type %X\n",
|
||||
package->Type));
|
||||
status = AE_BAD_DATA;
|
||||
acpi_util_eval_error(handle, pathname, status);
|
||||
goto end;
|
||||
}
|
||||
if (!package->Package.Count) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"[Package] has zero elements (%p)\n",
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"[Package] has zero elements (%p)\n",
|
||||
package));
|
||||
status = AE_BAD_DATA;
|
||||
acpi_util_eval_error(handle, pathname, status);
|
||||
@ -338,13 +338,13 @@ acpi_evaluate_reference (
|
||||
|
||||
if (element->Type != ACPI_TYPE_LOCAL_REFERENCE) {
|
||||
status = AE_BAD_DATA;
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Expecting a [Reference] package element, found type %X\n",
|
||||
element->type));
|
||||
acpi_util_eval_error(handle, pathname, status);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (!element->Reference.Handle) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid reference in"
|
||||
" package %s\n", pathname));
|
||||
|
@ -184,7 +184,7 @@ Bus_PDO_PnP (
|
||||
PoSetPowerState(DeviceData->Common.Self, DevicePowerState, state);
|
||||
DeviceData->Common.DevicePowerState = PowerDeviceD3;
|
||||
}
|
||||
|
||||
|
||||
SET_NEW_PNP_STATE(DeviceData->Common, Stopped);
|
||||
status = STATUS_SUCCESS;
|
||||
break;
|
||||
@ -541,7 +541,7 @@ Bus_PDO_QueryDeviceId(
|
||||
if (DeviceData->AcpiHandle)
|
||||
{
|
||||
acpi_bus_get_device(DeviceData->AcpiHandle, &Device);
|
||||
|
||||
|
||||
if (!Device->flags.hardware_id)
|
||||
{
|
||||
/* We don't have the ID to satisfy this request */
|
||||
@ -615,10 +615,10 @@ Bus_PDO_QueryDeviceId(
|
||||
/* We don't have the ID to satisfy this request */
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
DPRINT("Device name: %s\n", Device->pnp.device_name);
|
||||
DPRINT("Hardware ID: %s\n", Device->pnp.hardware_id);
|
||||
|
||||
|
||||
if (strcmp(Device->pnp.hardware_id, "Processor") == 0)
|
||||
{
|
||||
length += swprintf(&temp[length],
|
||||
@ -640,13 +640,13 @@ Bus_PDO_QueryDeviceId(
|
||||
L"ACPI\\%hs",
|
||||
Device->pnp.cid_list->Ids[i].String);
|
||||
temp[length++] = UNICODE_NULL;
|
||||
|
||||
|
||||
length += swprintf(&temp[length],
|
||||
L"*%hs",
|
||||
Device->pnp.cid_list->Ids[i].String);
|
||||
temp[length++] = UNICODE_NULL;
|
||||
}
|
||||
|
||||
|
||||
temp[length++] = UNICODE_NULL;
|
||||
}
|
||||
else
|
||||
@ -654,7 +654,7 @@ Bus_PDO_QueryDeviceId(
|
||||
/* No compatible IDs */
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
NT_ASSERT(length * sizeof(WCHAR) <= sizeof(temp));
|
||||
|
||||
buffer = ExAllocatePoolWithTag(PagedPool, length * sizeof(WCHAR), 'IpcA');
|
||||
|
@ -22,7 +22,7 @@ KTIMER CmBattWakeDpcTimerObject;
|
||||
KDPC CmBattWakeDpcObject;
|
||||
PDEVICE_OBJECT AcAdapterPdo;
|
||||
LARGE_INTEGER CmBattWakeDpcDelay;
|
||||
|
||||
|
||||
/* FUNCTIONS ******************************************************************/
|
||||
|
||||
VOID
|
||||
@ -35,7 +35,7 @@ CmBattPowerCallBack(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
if (CmBattDebug & 0x10)
|
||||
DbgPrint("CmBattPowerCallBack: action: %d, value: %d \n", Action, Value);
|
||||
|
||||
|
||||
/* Check if a transition is going to happen */
|
||||
if (Action == PO_CB_SYSTEM_STATE_LOCK)
|
||||
{
|
||||
@ -82,7 +82,7 @@ CmBattWakeDpc(IN PKDPC Dpc,
|
||||
PCMBATT_DEVICE_EXTENSION DeviceExtension;
|
||||
ULONG ArFlag;
|
||||
if (CmBattDebug & 2) DbgPrint("CmBattWakeDpc: Entered.\n");
|
||||
|
||||
|
||||
/* Loop all device objects */
|
||||
for (CurrentObject = FdoExtension->DeviceObject;
|
||||
CurrentObject;
|
||||
@ -91,7 +91,7 @@ CmBattWakeDpc(IN PKDPC Dpc,
|
||||
/* Turn delay flag off, we're back in S0 */
|
||||
DeviceExtension = CurrentObject->DeviceExtension;
|
||||
DeviceExtension->DelayNotification = 0;
|
||||
|
||||
|
||||
/* Check if this is an AC adapter */
|
||||
if (DeviceExtension->FdoType == CmBattAcAdapter)
|
||||
{
|
||||
@ -145,20 +145,20 @@ CmBattNotifyHandler(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
ULONG ArFlag;
|
||||
PCMBATT_DEVICE_EXTENSION FdoExtension;
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
|
||||
|
||||
if (CmBattDebug & (CMBATT_ACPI_ASSERT | CMBATT_PNP_INFO))
|
||||
DbgPrint("CmBattNotifyHandler: CmBatt 0x%08x Type %d Number %d Notify Value: %x\n",
|
||||
DeviceExtension,
|
||||
DeviceExtension->FdoType,
|
||||
DeviceExtension->DeviceId,
|
||||
NotifyValue);
|
||||
|
||||
|
||||
/* Check what kind of notification was received */
|
||||
switch (NotifyValue)
|
||||
{
|
||||
/* ACPI Specification says is sends a "Bus Check" when power source changes */
|
||||
case ACPI_BUS_CHECK:
|
||||
|
||||
|
||||
/* We treat it as possible physical change */
|
||||
DeviceExtension->ArFlag |= (CMBATT_AR_NOTIFY | CMBATT_AR_INSERT);
|
||||
if ((DeviceExtension->Tag) &&
|
||||
@ -166,26 +166,26 @@ CmBattNotifyHandler(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
DbgPrint("CmBattNotifyHandler: Received battery #%x insertion, but tag was not invalid.\n",
|
||||
DeviceExtension->DeviceId);
|
||||
break;
|
||||
|
||||
|
||||
/* Status of the battery has changed */
|
||||
case ACPI_BATT_NOTIFY_STATUS:
|
||||
|
||||
|
||||
/* All we'll do is notify the class driver */
|
||||
DeviceExtension->ArFlag |= CMBATT_AR_NOTIFY;
|
||||
break;
|
||||
|
||||
|
||||
/* Information on the battery has changed, such as physical presence */
|
||||
case ACPI_DEVICE_CHECK:
|
||||
case ACPI_BATT_NOTIFY_INFO:
|
||||
|
||||
|
||||
/* Reset all state and let the class driver re-evaluate it all */
|
||||
DeviceExtension->ArFlag |= (CMBATT_AR_NOTIFY |
|
||||
CMBATT_AR_INSERT |
|
||||
CMBATT_AR_REMOVE);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
|
||||
if (CmBattDebug & CMBATT_PNP_INFO)
|
||||
DbgPrint("CmBattNotifyHandler: Unknown Notify Value: %x\n", NotifyValue);
|
||||
}
|
||||
@ -201,7 +201,7 @@ CmBattNotifyHandler(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
}
|
||||
|
||||
/* We're going to handle this now */
|
||||
if (CmBattDebug & CMBATT_PNP_INFO)
|
||||
if (CmBattDebug & CMBATT_PNP_INFO)
|
||||
DbgPrint("CmBattNotifyHandler: Performing ARs: %01x\n", DeviceExtension->ArFlag);
|
||||
|
||||
/* Check if this is a battery or AC adapter notification */
|
||||
@ -209,16 +209,16 @@ CmBattNotifyHandler(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
{
|
||||
/* Reset the current trip point */
|
||||
DeviceExtension->TripPointValue = BATTERY_UNKNOWN_CAPACITY;
|
||||
|
||||
|
||||
/* Check what ARs have to be done */
|
||||
ArFlag = DeviceExtension->ArFlag;
|
||||
|
||||
|
||||
/* New battery inserted, reset lock value */
|
||||
if (ArFlag & CMBATT_AR_INSERT) InterlockedExchange(&DeviceExtension->ArLockValue, 0);
|
||||
|
||||
/* Check if the battery may have been removed */
|
||||
if (ArFlag & CMBATT_AR_REMOVE) DeviceExtension->Tag = 0;
|
||||
|
||||
|
||||
/* Check if there's been any sort of change to the battery */
|
||||
if (ArFlag & CMBATT_AR_NOTIFY)
|
||||
{
|
||||
@ -244,7 +244,7 @@ CmBattNotifyHandler(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ARs have been processed */
|
||||
DeviceExtension->ArFlag = 0;
|
||||
}
|
||||
@ -254,7 +254,7 @@ NTAPI
|
||||
CmBattUnload(IN PDRIVER_OBJECT DriverObject)
|
||||
{
|
||||
if (CmBattDebug & CMBATT_GENERIC_INFO) DPRINT("CmBattUnload: \n");
|
||||
|
||||
|
||||
/* Check if we have a registered power callback */
|
||||
if (CmBattPowerCallBackObject)
|
||||
{
|
||||
@ -262,7 +262,7 @@ CmBattUnload(IN PDRIVER_OBJECT DriverObject)
|
||||
ExUnregisterCallback(CmBattPowerCallBackRegistration);
|
||||
ObDereferenceObject(CmBattPowerCallBackObject);
|
||||
}
|
||||
|
||||
|
||||
/* Free the registry buffer if it exists */
|
||||
if (GlobalRegistryPath.Buffer) ExFreePool(GlobalRegistryPath.Buffer);
|
||||
|
||||
@ -279,7 +279,7 @@ CmBattVerifyStaticInfo(PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
ULONG BatteryTag)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
@ -298,7 +298,7 @@ CmBattOpenClose(IN PDEVICE_OBJECT DeviceObject,
|
||||
/* Grab the device extension and lock it */
|
||||
DeviceExtension = DeviceObject->DeviceExtension;
|
||||
ExAcquireFastMutex(&DeviceExtension->FastMutex);
|
||||
|
||||
|
||||
/* Check if someone is trying to open a device that doesn't exist yet */
|
||||
Count = DeviceExtension->HandleCount;
|
||||
if (Count == 0xFFFFFFFF)
|
||||
@ -312,14 +312,14 @@ CmBattOpenClose(IN PDEVICE_OBJECT DeviceObject,
|
||||
}
|
||||
goto Complete;
|
||||
}
|
||||
|
||||
|
||||
/* Check if this is an open or close */
|
||||
IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
|
||||
Major = IoStackLocation->MajorFunction;
|
||||
if (Major == IRP_MJ_CREATE)
|
||||
{
|
||||
/* Increment the open count */
|
||||
DeviceExtension->HandleCount = Count + 1;
|
||||
DeviceExtension->HandleCount = Count + 1;
|
||||
if (CmBattDebug & CMBATT_PNP_INFO)
|
||||
{
|
||||
DbgPrint("CmBattOpenClose: Open (DeviceNumber = %x)(count = %x).\n",
|
||||
@ -342,7 +342,7 @@ Complete:
|
||||
ExReleaseFastMutex(&DeviceExtension->FastMutex);
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return Status;
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
@ -366,7 +366,7 @@ CmBattIoctl(IN PDEVICE_OBJECT DeviceObject,
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return STATUS_DEVICE_REMOVED;
|
||||
}
|
||||
|
||||
|
||||
/* There's nothing to do for an AC adapter */
|
||||
if (DeviceExtension->FdoType == CmBattAcAdapter)
|
||||
{
|
||||
@ -376,7 +376,7 @@ CmBattIoctl(IN PDEVICE_OBJECT DeviceObject,
|
||||
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, Irp);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/* Send to class driver */
|
||||
Status = BatteryClassIoctl(DeviceExtension->ClassData, Irp);
|
||||
if (Status == STATUS_NOT_SUPPORTED)
|
||||
@ -388,12 +388,12 @@ CmBattIoctl(IN PDEVICE_OBJECT DeviceObject,
|
||||
InputBufferLength = IoStackLocation->Parameters.DeviceIoControl.InputBufferLength;
|
||||
if (CmBattDebug & 4)
|
||||
DbgPrint("CmBattIoctl: Received Direct Access IOCTL %x\n", IoControlCode);
|
||||
|
||||
|
||||
/* Handle internal IOCTLs */
|
||||
switch (IoControlCode)
|
||||
{
|
||||
case IOCTL_BATTERY_QUERY_UNIQUE_ID:
|
||||
|
||||
|
||||
/* Data is 4 bytes long */
|
||||
if (OutputBufferLength == sizeof(ULONG))
|
||||
{
|
||||
@ -408,9 +408,9 @@ CmBattIoctl(IN PDEVICE_OBJECT DeviceObject,
|
||||
Status = STATUS_INVALID_BUFFER_SIZE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case IOCTL_BATTERY_QUERY_STA:
|
||||
|
||||
|
||||
/* Data is 4 bytes long */
|
||||
if (OutputBufferLength == sizeof(ULONG))
|
||||
{
|
||||
@ -425,9 +425,9 @@ CmBattIoctl(IN PDEVICE_OBJECT DeviceObject,
|
||||
Status = STATUS_INVALID_BUFFER_SIZE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case IOCTL_BATTERY_QUERY_PSR:
|
||||
|
||||
|
||||
/* Data is 4 bytes long */
|
||||
if (OutputBufferLength == sizeof(ULONG))
|
||||
{
|
||||
@ -451,9 +451,9 @@ CmBattIoctl(IN PDEVICE_OBJECT DeviceObject,
|
||||
Status = STATUS_INVALID_BUFFER_SIZE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case IOCTL_BATTERY_SET_TRIP_POINT:
|
||||
|
||||
|
||||
/* Data is 4 bytes long */
|
||||
if (InputBufferLength == sizeof(ULONG))
|
||||
{
|
||||
@ -468,9 +468,9 @@ CmBattIoctl(IN PDEVICE_OBJECT DeviceObject,
|
||||
Status = STATUS_INVALID_BUFFER_SIZE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case IOCTL_BATTERY_QUERY_BIF:
|
||||
|
||||
|
||||
/* Data is 1060 bytes long */
|
||||
if (OutputBufferLength == sizeof(ACPI_BIF_DATA))
|
||||
{
|
||||
@ -485,9 +485,9 @@ CmBattIoctl(IN PDEVICE_OBJECT DeviceObject,
|
||||
Status = STATUS_INVALID_BUFFER_SIZE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case IOCTL_BATTERY_QUERY_BST:
|
||||
|
||||
|
||||
/* Data is 16 bytes long */
|
||||
if (OutputBufferLength == sizeof(ACPI_BST_DATA))
|
||||
{
|
||||
@ -502,15 +502,15 @@ CmBattIoctl(IN PDEVICE_OBJECT DeviceObject,
|
||||
Status = STATUS_INVALID_BUFFER_SIZE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
|
||||
/* Unknown, let us pass it on to ACPI */
|
||||
if (CmBattDebug & 0xC)
|
||||
DbgPrint("CmBattIoctl: Unknown IOCTL %x\n", IoControlCode);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Did someone pick it up? */
|
||||
if (Status != STATUS_NOT_SUPPORTED)
|
||||
{
|
||||
@ -544,11 +544,11 @@ CmBattQueryTag(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
if (CmBattDebug & (CMBATT_ACPI_WARNING | CMBATT_GENERIC_INFO))
|
||||
DbgPrint("CmBattQueryTag - Tag (%d), Battery %x, Device %d\n",
|
||||
*Tag, DeviceExtension, DeviceExtension->DeviceId);
|
||||
|
||||
/* Get PDO and clear notification flag */
|
||||
|
||||
/* Get PDO and clear notification flag */
|
||||
PdoDevice = DeviceExtension->PdoDeviceObject;
|
||||
DeviceExtension->NotifySent = 0;
|
||||
|
||||
|
||||
/* Get _STA from PDO (we need the machine status, not the battery status) */
|
||||
Status = CmBattGetStaData(PdoDevice, &StaData);
|
||||
if (NT_SUCCESS(Status))
|
||||
@ -565,11 +565,11 @@ CmBattQueryTag(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
DeviceExtension->Tag = NewTag;
|
||||
if (CmBattDebug & CMBATT_GENERIC_INFO)
|
||||
DbgPrint("CmBattQueryTag - New Tag: (%d)\n", DeviceExtension->Tag);
|
||||
|
||||
|
||||
/* Reset trip point data */
|
||||
DeviceExtension->TripPointOld = 0;
|
||||
DeviceExtension->TripPointValue = BATTERY_UNKNOWN_CAPACITY;
|
||||
|
||||
|
||||
/* Clear AR lock and set new interrupt time */
|
||||
InterlockedExchange(&DeviceExtension->ArLockValue, 0);
|
||||
DeviceExtension->InterruptTime = KeQueryInterruptTime();
|
||||
@ -582,7 +582,7 @@ CmBattQueryTag(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
Status = STATUS_NO_SUCH_DEVICE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Return the tag and status result */
|
||||
*Tag = DeviceExtension->Tag;
|
||||
if (CmBattDebug & CMBATT_ACPI_WARNING)
|
||||
@ -626,7 +626,7 @@ CmBattDisableStatusNotify(IN PCMBATT_DEVICE_EXTENSION DeviceExtension)
|
||||
/* Nothing we can do */
|
||||
Status = STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
/* Return status */
|
||||
return Status;
|
||||
}
|
||||
@ -645,14 +645,14 @@ CmBattSetStatusNotify(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
if (CmBattDebug & (CMBATT_ACPI_WARNING | CMBATT_GENERIC_INFO))
|
||||
DbgPrint("CmBattSetStatusNotify: Tag (%d) Target(0x%x)\n",
|
||||
BatteryTag, BatteryNotify->LowCapacity);
|
||||
|
||||
/* Update any ACPI evaluations */
|
||||
|
||||
/* Update any ACPI evaluations */
|
||||
Status = CmBattVerifyStaticInfo(DeviceExtension, BatteryTag);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
|
||||
|
||||
/* Trip point not supported, fail */
|
||||
if (!DeviceExtension->TripPointSet) return STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
|
||||
|
||||
/* Are both capacities known? */
|
||||
if ((BatteryNotify->HighCapacity == BATTERY_UNKNOWN_CAPACITY) ||
|
||||
(BatteryNotify->LowCapacity == BATTERY_UNKNOWN_CAPACITY))
|
||||
@ -662,7 +662,7 @@ CmBattSetStatusNotify(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
DbgPrint("CmBattSetStatusNotify: Failing request because of BATTERY_UNKNOWN_CAPACITY.\n");
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
/* Is the battery charging? */
|
||||
Charging = DeviceExtension->BstData.State & ACPI_BATT_STAT_CHARGING;
|
||||
if (Charging)
|
||||
@ -704,7 +704,7 @@ CmBattSetStatusNotify(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
Status = STATUS_NOT_SUPPORTED;
|
||||
if (CmBattDebug & CMBATT_ACPI_WARNING)
|
||||
DbgPrint("CmBattSetStatusNotify: Can't calculate BTP, DesignVoltage = 0x%08x\n",
|
||||
DesignVoltage);
|
||||
DesignVoltage);
|
||||
}
|
||||
}
|
||||
else if (Charging)
|
||||
@ -726,7 +726,7 @@ CmBattSetStatusNotify(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
DbgPrint("CmBattSetStatusNotify: Keeping original setting: %X\n", DeviceExtension->TripPointValue);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* Set the trip point with ACPI and check for success */
|
||||
DeviceExtension->TripPointValue = NewTripPoint;
|
||||
Status = CmBattSetTripPpoint(DeviceExtension, NewTripPoint);
|
||||
@ -739,7 +739,7 @@ CmBattSetStatusNotify(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
DbgPrint("CmBattSetStatusNotify: SetTripPoint failed - %x\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/* Read the new BST data to see the latest state */
|
||||
Status = CmBattGetBstData(DeviceExtension, &BstData);
|
||||
if (!NT_SUCCESS(Status))
|
||||
@ -762,7 +762,7 @@ CmBattSetStatusNotify(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
if (CmBattDebug & CMBATT_GENERIC_WARNING)
|
||||
DbgPrint("CmBattSetStatusNotify: Trip point already crossed (1): TP = %08x, remaining capacity = %08x\n",
|
||||
NewTripPoint, BstData.RemainingCapacity);
|
||||
CmBattNotifyHandler(DeviceExtension, ACPI_BATT_NOTIFY_STATUS);
|
||||
CmBattNotifyHandler(DeviceExtension, ACPI_BATT_NOTIFY_STATUS);
|
||||
}
|
||||
|
||||
/* All should've went well if we got here, unless BST failed... return! */
|
||||
@ -789,8 +789,8 @@ CmBattGetBatteryStatus(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
PAGED_CODE();
|
||||
if (CmBattDebug & CMBATT_GENERIC_INFO)
|
||||
DbgPrint("CmBattGetBatteryStatus - CmBatt (%08x) Tag (%d)\n", DeviceExtension, Tag);
|
||||
|
||||
/* Validate ACPI data */
|
||||
|
||||
/* Validate ACPI data */
|
||||
Status = CmBattVerifyStaticInfo(DeviceExtension, Tag);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
|
||||
@ -810,8 +810,8 @@ CmBattGetBatteryStatus(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
InterlockedExchange(&DeviceExtension->ArLockValue, 0);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Clear current BST information */
|
||||
|
||||
/* Clear current BST information */
|
||||
DeviceExtension->State = 0;
|
||||
DeviceExtension->RemainingCapacity = 0;
|
||||
DeviceExtension->PresentVoltage = 0;
|
||||
@ -819,7 +819,7 @@ CmBattGetBatteryStatus(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
|
||||
/* Get battery state */
|
||||
BstState = DeviceExtension->BstData.State;
|
||||
|
||||
|
||||
/* Is the battery both charging and discharging? */
|
||||
if ((BstState & ACPI_BATT_STAT_DISCHARG) && (BstState & ACPI_BATT_STAT_CHARGING) &&
|
||||
(CmBattDebug & (CMBATT_ACPI_WARNING | CMBATT_GENERIC_WARNING)))
|
||||
@ -827,8 +827,8 @@ CmBattGetBatteryStatus(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
"CmBattGetBatteryStatus: Invalid state: _BST method returned 0x%08x for Battery State.\n"
|
||||
"* One battery cannot be charging and discharging at the same time.\n",
|
||||
BstState);
|
||||
|
||||
/* Is the battery discharging? */
|
||||
|
||||
/* Is the battery discharging? */
|
||||
if (BstState & ACPI_BATT_STAT_DISCHARG)
|
||||
{
|
||||
/* Set power state and check if it just started discharging now */
|
||||
@ -844,13 +844,13 @@ CmBattGetBatteryStatus(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
/* Battery is charging, update power state */
|
||||
DeviceExtension->State |= (BATTERY_CHARGING | BATTERY_POWER_ON_LINE);
|
||||
}
|
||||
|
||||
|
||||
/* Is the battery in a critical state? */
|
||||
if (BstState & ACPI_BATT_STAT_CRITICAL) DeviceExtension->State |= BATTERY_CRITICAL;
|
||||
|
||||
/* Read the voltage data */
|
||||
|
||||
/* Read the voltage data */
|
||||
DeviceExtension->PresentVoltage = DeviceExtension->BstData.PresentVoltage;
|
||||
|
||||
|
||||
/* Check if we have an A/C adapter */
|
||||
if (AcAdapterPdo)
|
||||
{
|
||||
@ -868,10 +868,10 @@ CmBattGetBatteryStatus(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
else
|
||||
{
|
||||
/* Assume no charger */
|
||||
PsrData = 0;
|
||||
PsrData = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Is there a charger? */
|
||||
if (PsrData)
|
||||
{
|
||||
@ -882,21 +882,21 @@ CmBattGetBatteryStatus(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
}
|
||||
else if (CmBattDebug & (CMBATT_GENERIC_INFO | CMBATT_GENERIC_STATUS))
|
||||
{
|
||||
DbgPrint("CmBattGetBatteryStatus: AC adapter is NOT connected\n");
|
||||
DbgPrint("CmBattGetBatteryStatus: AC adapter is NOT connected\n");
|
||||
}
|
||||
|
||||
|
||||
/* Get some data we'll need */
|
||||
DesignVoltage = DeviceExtension->BifData.DesignVoltage;
|
||||
PresentRate = DeviceExtension->BstData.PresentRate;
|
||||
RemainingCapacity = DeviceExtension->BstData.RemainingCapacity;
|
||||
|
||||
|
||||
/* Check if we have battery data in Watts instead of Amps */
|
||||
if (DeviceExtension->BifData.PowerUnit == ACPI_BATT_POWER_UNIT_WATTS)
|
||||
{
|
||||
/* Get the data from the BST */
|
||||
DeviceExtension->RemainingCapacity = RemainingCapacity;
|
||||
DeviceExtension->Rate = PresentRate;
|
||||
|
||||
|
||||
/* Check if the rate is invalid */
|
||||
if (PresentRate > CM_MAX_VALUE)
|
||||
{
|
||||
@ -927,7 +927,7 @@ CmBattGetBatteryStatus(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
/* Compute the capacity with the information we have */
|
||||
DeviceExtension->RemainingCapacity = (DesignVoltage * RemainingCapacity + 500) / 1000;
|
||||
}
|
||||
|
||||
|
||||
/* Check if we have a rate */
|
||||
if (PresentRate != CM_UNKNOWN_VALUE)
|
||||
{
|
||||
@ -942,14 +942,14 @@ CmBattGetBatteryStatus(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
DbgPrint("---------------------- Overflow: PresentRate = 0x%08x\n", PresentRate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Compute the rate */
|
||||
DeviceExtension->Rate = (PresentRate * DesignVoltage + 500) / 1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We don't have a rate, so set unknown value */
|
||||
DeviceExtension->Rate = BATTERY_UNKNOWN_RATE;
|
||||
DeviceExtension->Rate = BATTERY_UNKNOWN_RATE;
|
||||
if (CmBattDebug & CMBATT_ACPI_WARNING)
|
||||
{
|
||||
DbgPrint("CmBattGetBatteryStatus - Can't calculate Rate \n");
|
||||
@ -968,7 +968,7 @@ CmBattGetBatteryStatus(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
DbgPrint("---------------------- DesignVoltage = 0x%08x\n", DesignVoltage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Check if we have an unknown rate */
|
||||
if (DeviceExtension->Rate == BATTERY_UNKNOWN_RATE)
|
||||
{
|
||||
@ -990,7 +990,7 @@ CmBattGetBatteryStatus(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
DeviceExtension->Rate);
|
||||
DeviceExtension->Rate = 0;
|
||||
}
|
||||
|
||||
|
||||
/* Done */
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
@ -1036,9 +1036,9 @@ CmBattQueryInformation(IN PCMBATT_DEVICE_EXTENSION FdoExtension,
|
||||
QueryData = &FdoExtension->BatteryInformation;
|
||||
QueryLength = sizeof(BATTERY_INFORMATION);
|
||||
break;
|
||||
|
||||
|
||||
case BatteryGranularityInformation:
|
||||
|
||||
|
||||
/* Return our static information, we have two scales */
|
||||
BatteryReportingScale[0].Granularity = FdoExtension->BatteryCapacityGranularity1;
|
||||
BatteryReportingScale[0].Capacity = FdoExtension->BatteryInformation.DefaultAlert1;
|
||||
@ -1047,25 +1047,25 @@ CmBattQueryInformation(IN PCMBATT_DEVICE_EXTENSION FdoExtension,
|
||||
QueryData = BatteryReportingScale;
|
||||
QueryLength = sizeof(BATTERY_REPORTING_SCALE) * 2;
|
||||
break;
|
||||
|
||||
|
||||
case BatteryEstimatedTime:
|
||||
|
||||
|
||||
/* Check if it's been more than 2 1/2 minutes since the last change */
|
||||
if ((KeQueryInterruptTime() - 150000000) > (FdoExtension->InterruptTime))
|
||||
{
|
||||
/* Get new battery status */
|
||||
CmBattGetBatteryStatus(FdoExtension, FdoExtension->Tag);
|
||||
|
||||
|
||||
/* If the caller didn't specify a rate, use our static one */
|
||||
Rate = AtRate;
|
||||
if (!Rate) Rate = FdoExtension->Rate;
|
||||
|
||||
|
||||
/* If we don't have a valid negative rate, use unknown value */
|
||||
if (Rate >= 0) Rate = BATTERY_UNKNOWN_RATE;
|
||||
|
||||
|
||||
/* Grab the remaining capacity */
|
||||
RemainingCapacity = FdoExtension->RemainingCapacity;
|
||||
|
||||
|
||||
/* See if we don't know one or the other */
|
||||
if ((Rate == BATTERY_UNKNOWN_RATE) ||
|
||||
(RemainingCapacity == BATTERY_UNKNOWN_CAPACITY))
|
||||
@ -1074,7 +1074,7 @@ CmBattQueryInformation(IN PCMBATT_DEVICE_EXTENSION FdoExtension,
|
||||
if ((FdoExtension->BstData.State & ACPI_BATT_STAT_DISCHARG) &&
|
||||
(CmBattDebug & CMBATT_GENERIC_WARNING))
|
||||
DbgPrint("CmBattQueryInformation: Can't calculate EstimatedTime.\n");
|
||||
|
||||
|
||||
/* Check if we don't have a rate and capacity is going down */
|
||||
if ((FdoExtension->Rate == BATTERY_UNKNOWN_RATE) &&
|
||||
(FdoExtension->BstData.State & ACPI_BATT_STAT_DISCHARG))
|
||||
@ -1084,7 +1084,7 @@ CmBattQueryInformation(IN PCMBATT_DEVICE_EXTENSION FdoExtension,
|
||||
if (CmBattDebug & CMBATT_GENERIC_WARNING)
|
||||
DbgPrint("---------------------- PresentRate = BATTERY_UNKNOWN_RATE\n");
|
||||
}
|
||||
|
||||
|
||||
/* If we don't have capacity, the rate is useless */
|
||||
if (RemainingCapacity == BATTERY_UNKNOWN_CAPACITY)
|
||||
{
|
||||
@ -1110,49 +1110,49 @@ CmBattQueryInformation(IN PCMBATT_DEVICE_EXTENSION FdoExtension,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Return the remaining time */
|
||||
QueryData = &RemainingTime;
|
||||
QueryLength = sizeof(ULONG);
|
||||
break;
|
||||
|
||||
|
||||
case BatteryDeviceName:
|
||||
|
||||
|
||||
/* Build the model number string */
|
||||
RtlInitAnsiString(&TempString, FdoExtension->ModelNumber);
|
||||
|
||||
/* Convert it to Unicode */
|
||||
InfoString.Buffer = InfoBuffer;
|
||||
InfoString.MaximumLength = sizeof(InfoBuffer);
|
||||
InfoString.MaximumLength = sizeof(InfoBuffer);
|
||||
Status = RtlAnsiStringToUnicodeString(&InfoString, &TempString, 0);
|
||||
|
||||
|
||||
/* Return the unicode buffer */
|
||||
QueryData = InfoString.Buffer;
|
||||
QueryLength = InfoString.Length;
|
||||
break;
|
||||
|
||||
|
||||
case BatteryTemperature:
|
||||
case BatteryManufactureDate:
|
||||
|
||||
|
||||
/* We don't support these */
|
||||
Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||
break;
|
||||
|
||||
|
||||
case BatteryManufactureName:
|
||||
|
||||
|
||||
/* Build the OEM info string */
|
||||
RtlInitAnsiString(&TempString, FdoExtension->OemInfo);
|
||||
|
||||
|
||||
/* Convert it to Unicode */
|
||||
InfoString.Buffer = InfoBuffer;
|
||||
InfoString.MaximumLength = sizeof(InfoBuffer);
|
||||
Status = RtlAnsiStringToUnicodeString(&InfoString, &TempString, 0);
|
||||
|
||||
|
||||
/* Return the unicode buffer */
|
||||
QueryData = InfoString.Buffer;
|
||||
QueryLength = InfoString.Length;
|
||||
break;
|
||||
|
||||
|
||||
case BatteryUniqueID:
|
||||
|
||||
/* Build the serial number string */
|
||||
@ -1166,32 +1166,32 @@ CmBattQueryInformation(IN PCMBATT_DEVICE_EXTENSION FdoExtension,
|
||||
/* Setup a temporary string for concatenation */
|
||||
TempString2.Buffer = TempBuffer;
|
||||
TempString2.MaximumLength = sizeof(TempBuffer);
|
||||
|
||||
|
||||
/* Check if there's an OEM string */
|
||||
if (FdoExtension->OemInfo[0])
|
||||
{
|
||||
/* Build the OEM info string */
|
||||
RtlInitAnsiString(&TempString, FdoExtension->OemInfo);
|
||||
|
||||
|
||||
/* Convert it to Unicode and append it */
|
||||
RtlAnsiStringToUnicodeString(&TempString2, &TempString, 0);
|
||||
RtlAppendUnicodeStringToString(&InfoString, &TempString2);
|
||||
}
|
||||
|
||||
|
||||
/* Build the model number string */
|
||||
RtlInitAnsiString(&TempString, FdoExtension->ModelNumber);
|
||||
|
||||
|
||||
/* Convert it to Unicode and append it */
|
||||
RtlAnsiStringToUnicodeString(&TempString2, &TempString, 0);
|
||||
RtlAppendUnicodeStringToString(&InfoString, &TempString2);
|
||||
|
||||
|
||||
/* Return the final appended string */
|
||||
QueryData = InfoString.Buffer;
|
||||
QueryLength = InfoString.Length;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
|
||||
/* Everything else is unknown */
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
break;
|
||||
@ -1203,7 +1203,7 @@ CmBattQueryInformation(IN PCMBATT_DEVICE_EXTENSION FdoExtension,
|
||||
|
||||
/* Copy the data if there's enough space and it exists */
|
||||
if ((NT_SUCCESS(Status)) && (QueryData)) RtlCopyMemory(Buffer, QueryData, QueryLength);
|
||||
|
||||
|
||||
/* Return function result */
|
||||
return Status;
|
||||
}
|
||||
@ -1218,7 +1218,7 @@ CmBattQueryStatus(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
PAGED_CODE();
|
||||
if (CmBattDebug & (CMBATT_ACPI_WARNING | CMBATT_GENERIC_INFO))
|
||||
DbgPrint("CmBattQueryStatus - Tag (%d) Device %x\n", Tag, DeviceExtension->DeviceId);
|
||||
|
||||
|
||||
/* Query ACPI information */
|
||||
Status = CmBattGetBatteryStatus(DeviceExtension, Tag);
|
||||
if (NT_SUCCESS(Status))
|
||||
@ -1228,7 +1228,7 @@ CmBattQueryStatus(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
BatteryStatus->Voltage = DeviceExtension->PresentVoltage;
|
||||
BatteryStatus->Rate = DeviceExtension->Rate;
|
||||
}
|
||||
|
||||
|
||||
/* Return status */
|
||||
if (CmBattDebug & (CMBATT_GENERIC_INFO))
|
||||
DbgPrint("CmBattQueryStatus: Returning [%#08lx][%#08lx][%#08lx][%#08lx]\n",
|
||||
@ -1262,14 +1262,14 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject,
|
||||
DbgPrint("CmBatt: Couldn't allocate pool for registry path.");
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
/* Buffer allocated, copy the string */
|
||||
RtlCopyUnicodeString(&GlobalRegistryPath, RegistryPath);
|
||||
if (CmBattDebug & CMBATT_GENERIC_INFO)
|
||||
DbgPrint("CmBatt DriverEntry - Obj (%08x) Path \"%ws\"\n",
|
||||
DriverObject,
|
||||
RegistryPath->Buffer);
|
||||
|
||||
|
||||
/* Setup the major dispatchers */
|
||||
DriverObject->MajorFunction[IRP_MJ_CREATE] = CmBattOpenClose;
|
||||
DriverObject->MajorFunction[IRP_MJ_CLOSE] = CmBattOpenClose;
|
||||
@ -1280,12 +1280,12 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject,
|
||||
|
||||
/* And the unload routine */
|
||||
DriverObject->DriverUnload = CmBattUnload;
|
||||
|
||||
|
||||
/* And the add device routine */
|
||||
DriverExtension = DriverObject->DriverExtension;
|
||||
DriverExtension->AddDevice = CmBattAddDevice;
|
||||
|
||||
/* Create a power callback */
|
||||
/* Create a power callback */
|
||||
RtlInitUnicodeString(&CallbackName, L"\\Callback\\PowerState");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&CallbackName,
|
||||
@ -1318,7 +1318,7 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject,
|
||||
if (CmBattDebug & CMBATT_GENERIC_WARNING)
|
||||
DbgPrint("CmBattRegisterPowerCallBack: ExRegisterCallback failed.\n");
|
||||
}
|
||||
|
||||
|
||||
/* All good */
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -15,13 +15,13 @@
|
||||
#include <wdmguid.h>
|
||||
|
||||
#define IOCTL_BATTERY_QUERY_UNIQUE_ID \
|
||||
CTL_CODE(FILE_DEVICE_BATTERY, 0x101, METHOD_BUFFERED, FILE_READ_ACCESS) // 0x294404
|
||||
|
||||
CTL_CODE(FILE_DEVICE_BATTERY, 0x101, METHOD_BUFFERED, FILE_READ_ACCESS) // 0x294404
|
||||
|
||||
#define IOCTL_BATTERY_QUERY_STA \
|
||||
CTL_CODE(FILE_DEVICE_BATTERY, 0x102, METHOD_BUFFERED, FILE_READ_ACCESS) // 0x294408
|
||||
|
||||
#define IOCTL_BATTERY_QUERY_PSR \
|
||||
CTL_CODE(FILE_DEVICE_BATTERY, 0x103, METHOD_BUFFERED, FILE_READ_ACCESS) // 0x29440C
|
||||
CTL_CODE(FILE_DEVICE_BATTERY, 0x103, METHOD_BUFFERED, FILE_READ_ACCESS) // 0x29440C
|
||||
|
||||
#define IOCTL_BATTERY_SET_TRIP_POINT \
|
||||
CTL_CODE(FILE_DEVICE_BATTERY, 0x104, METHOD_BUFFERED, FILE_READ_ACCESS) // 0x294410
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
#define IOCTL_BATTERY_QUERY_BST \
|
||||
CTL_CODE(FILE_DEVICE_BATTERY, 0x106, METHOD_BUFFERED, FILE_READ_ACCESS) // 0x294418
|
||||
|
||||
|
||||
#define CMBATT_GENERIC_STATUS 0x01
|
||||
#define CMBATT_GENERIC_INFO 0x02
|
||||
#define CMBATT_GENERIC_WARNING 0x04
|
||||
@ -246,7 +246,7 @@ CmBattQueryInformation(
|
||||
IN ULONG BufferLength,
|
||||
OUT PULONG ReturnedLength
|
||||
);
|
||||
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
CmBattQueryStatus(
|
||||
|
@ -64,7 +64,7 @@ CmBattQueryWmiRegInfo(PDEVICE_OBJECT DeviceObject,
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
CmBattQueryWmiDataBlock(PDEVICE_OBJECT DeviceObject,
|
||||
@ -83,7 +83,7 @@ CmBattQueryWmiDataBlock(PDEVICE_OBJECT DeviceObject,
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
CmBattSetWmiDataBlock(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp,
|
||||
PIRP Irp,
|
||||
ULONG GuidIndex,
|
||||
ULONG InstanceIndex,
|
||||
ULONG BufferSize,
|
||||
@ -112,10 +112,10 @@ NTAPI
|
||||
CmBattWmiDeRegistration(IN PCMBATT_DEVICE_EXTENSION DeviceExtension)
|
||||
{
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
/* De-register */
|
||||
return IoWMIRegistrationControl(DeviceExtension->FdoDeviceObject,
|
||||
WMIREG_ACTION_DEREGISTER);
|
||||
WMIREG_ACTION_DEREGISTER);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
@ -123,12 +123,12 @@ NTAPI
|
||||
CmBattWmiRegistration(IN PCMBATT_DEVICE_EXTENSION DeviceExtension)
|
||||
{
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
/* GUID information */
|
||||
DeviceExtension->WmiLibInfo.GuidCount = sizeof(CmBattWmiGuidList) /
|
||||
sizeof(WMIGUIDREGINFO);
|
||||
DeviceExtension->WmiLibInfo.GuidList = CmBattWmiGuidList;
|
||||
|
||||
|
||||
/* Callbacks */
|
||||
DeviceExtension->WmiLibInfo.QueryWmiRegInfo = CmBattQueryWmiRegInfo;
|
||||
DeviceExtension->WmiLibInfo.QueryWmiDataBlock = CmBattQueryWmiDataBlock;
|
||||
@ -136,7 +136,7 @@ CmBattWmiRegistration(IN PCMBATT_DEVICE_EXTENSION DeviceExtension)
|
||||
DeviceExtension->WmiLibInfo.SetWmiDataItem = CmBattSetWmiDataItem;
|
||||
DeviceExtension->WmiLibInfo.ExecuteWmiMethod = NULL;
|
||||
DeviceExtension->WmiLibInfo.WmiFunctionControl = NULL;
|
||||
|
||||
|
||||
/* Register */
|
||||
return IoWMIRegistrationControl(DeviceExtension->FdoDeviceObject,
|
||||
WMIREG_ACTION_REGISTER);
|
||||
@ -155,7 +155,7 @@ CmBattSystemControl(IN PDEVICE_OBJECT DeviceObject,
|
||||
if (CmBattDebug & 2)
|
||||
DbgPrint("CmBatt: SystemControl: %s\n",
|
||||
WMIMinorFunctionString(IoGetCurrentIrpStackLocation(Irp)->MinorFunction));
|
||||
|
||||
|
||||
/* Acquire the remove lock */
|
||||
DeviceExtension = DeviceObject->DeviceExtension;
|
||||
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, 0);
|
||||
@ -166,7 +166,7 @@ CmBattSystemControl(IN PDEVICE_OBJECT DeviceObject,
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return STATUS_DEVICE_REMOVED;
|
||||
}
|
||||
|
||||
|
||||
/* What kind of device is this? */
|
||||
WmiLibContext = &DeviceExtension->WmiLibInfo;
|
||||
if (DeviceExtension->FdoType == CmBattBattery)
|
||||
@ -191,26 +191,26 @@ CmBattSystemControl(IN PDEVICE_OBJECT DeviceObject,
|
||||
switch (Disposition)
|
||||
{
|
||||
case IrpNotCompleted:
|
||||
|
||||
|
||||
/* Complete it here */
|
||||
if (CmBattDebug & 2) DbgPrint("CmBatt: SystemControl: Irp Not Completed.\n");
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
break;
|
||||
|
||||
|
||||
case IrpForward:
|
||||
|
||||
|
||||
/* Forward it to ACPI */
|
||||
if (CmBattDebug & 2) DbgPrint("CmBatt: SystemControl: Irp Forward.\n");
|
||||
IoSkipCurrentIrpStackLocation(Irp);
|
||||
Status = IoCallDriver(DeviceExtension->AttachedDevice, Irp);
|
||||
break;
|
||||
|
||||
|
||||
case IrpProcessed:
|
||||
|
||||
|
||||
/* Nothing to do */
|
||||
if (CmBattDebug & 2) DbgPrint("CmBatt: SystemControl: Irp Processed.\n");
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
ASSERT(FALSE);
|
||||
}
|
||||
@ -219,5 +219,5 @@ CmBattSystemControl(IN PDEVICE_OBJECT DeviceObject,
|
||||
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, 0);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
@ -21,7 +21,7 @@ GetDwordElement(IN PACPI_METHOD_ARGUMENT Argument,
|
||||
OUT PULONG Value)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
/* Must have an integer */
|
||||
if (Argument->Type != ACPI_METHOD_ARGUMENT_INTEGER)
|
||||
{
|
||||
@ -37,7 +37,7 @@ GetDwordElement(IN PACPI_METHOD_ARGUMENT Argument,
|
||||
*Value = Argument->Argument;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* Return status */
|
||||
return Status;
|
||||
}
|
||||
@ -48,7 +48,7 @@ GetStringElement(IN PACPI_METHOD_ARGUMENT Argument,
|
||||
OUT PCHAR Value)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
/* Must have a string of buffer */
|
||||
if ((Argument->Type == ACPI_METHOD_ARGUMENT_STRING) ||
|
||||
(Argument->Type == ACPI_METHOD_ARGUMENT_BUFFER))
|
||||
@ -75,7 +75,7 @@ GetStringElement(IN PACPI_METHOD_ARGUMENT Argument,
|
||||
if (CmBattDebug & 0x4C)
|
||||
DbgPrint("GetStringElement: Object contained wrong data type - %d\n", Argument->Type);
|
||||
}
|
||||
|
||||
|
||||
/* Return the status */
|
||||
return Status;
|
||||
}
|
||||
@ -97,7 +97,7 @@ CmBattSendDownStreamIrp(IN PDEVICE_OBJECT DeviceObject,
|
||||
|
||||
/* Initialize our wait event */
|
||||
KeInitializeEvent(&Event, SynchronizationEvent, 0);
|
||||
|
||||
|
||||
/* Allocate the IRP */
|
||||
Irp = IoBuildDeviceIoControlRequest(IoControlCode,
|
||||
DeviceObject,
|
||||
@ -115,7 +115,7 @@ CmBattSendDownStreamIrp(IN PDEVICE_OBJECT DeviceObject,
|
||||
DbgPrint("CmBattSendDownStreamIrp: Failed to allocate Irp\n");
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
/* Call ACPI */
|
||||
if (CmBattDebug & 0x40)
|
||||
DbgPrint("CmBattSendDownStreamIrp: Irp %x [Tid] %x\n",
|
||||
@ -131,7 +131,7 @@ CmBattSendDownStreamIrp(IN PDEVICE_OBJECT DeviceObject,
|
||||
NULL);
|
||||
Status = Irp->IoStatus.Status;
|
||||
}
|
||||
|
||||
|
||||
/* Check if caller wanted output */
|
||||
if (OutputBuffer)
|
||||
{
|
||||
@ -143,7 +143,7 @@ CmBattSendDownStreamIrp(IN PDEVICE_OBJECT DeviceObject,
|
||||
Status = STATUS_ACPI_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Return status */
|
||||
if (CmBattDebug & 0x40)
|
||||
DbgPrint("CmBattSendDownStreamIrp: Irp %x completed %x! [Tid] %x\n",
|
||||
@ -163,11 +163,11 @@ CmBattGetPsrData(IN PDEVICE_OBJECT DeviceObject,
|
||||
if (CmBattDebug & 0x40)
|
||||
DbgPrint("CmBattGetPsrData: Entered with Pdo %x Tid %x\n",
|
||||
DeviceObject, KeGetCurrentThread());
|
||||
|
||||
|
||||
/* Initialize to zero */
|
||||
ASSERT(PsrData != NULL);
|
||||
*PsrData = 0;
|
||||
|
||||
|
||||
/* Request the _PSR method */
|
||||
*(PULONG)InputBuffer.MethodName = 'RSP_';
|
||||
InputBuffer.Signature = ACPI_EVAL_INPUT_BUFFER_SIGNATURE;
|
||||
@ -191,7 +191,7 @@ CmBattGetPsrData(IN PDEVICE_OBJECT DeviceObject,
|
||||
/* Failure */
|
||||
DbgPrint("CmBattGetPsrData: Failed _PSR method - Status (0x%x)\n", Status);
|
||||
}
|
||||
|
||||
|
||||
/* Return status */
|
||||
return Status;
|
||||
}
|
||||
@ -208,11 +208,11 @@ CmBattGetStaData(IN PDEVICE_OBJECT DeviceObject,
|
||||
if (CmBattDebug & 0x40)
|
||||
DbgPrint("CmBattGetStaData: Entered with Pdo %x Tid %x\n",
|
||||
DeviceObject, KeGetCurrentThread());
|
||||
|
||||
|
||||
/* Initialize to zero */
|
||||
ASSERT(StaData != NULL);
|
||||
*StaData = 0;
|
||||
|
||||
|
||||
/* Request the _PSR method */
|
||||
*(PULONG)InputBuffer.MethodName = 'ATS_';
|
||||
InputBuffer.Signature = ACPI_EVAL_INPUT_BUFFER_SIGNATURE;
|
||||
@ -237,7 +237,7 @@ CmBattGetStaData(IN PDEVICE_OBJECT DeviceObject,
|
||||
DbgPrint("CmBattGetStaData: Failed _STA method - Status (0x%x)\n", Status);
|
||||
Status = STATUS_NO_SUCH_DEVICE;
|
||||
}
|
||||
|
||||
|
||||
/* Return status */
|
||||
return Status;
|
||||
}
|
||||
@ -254,11 +254,11 @@ CmBattGetUniqueId(IN PDEVICE_OBJECT DeviceObject,
|
||||
if (CmBattDebug & 0x40)
|
||||
DbgPrint("CmBattGetUniqueId: Entered with Pdo %x Tid %x\n",
|
||||
DeviceObject, KeGetCurrentThread());
|
||||
|
||||
|
||||
/* Initialize to zero */
|
||||
ASSERT(UniqueId != NULL);
|
||||
*UniqueId = 0;
|
||||
|
||||
|
||||
/* Request the _PSR method */
|
||||
*(PULONG)InputBuffer.MethodName = 'DIU_';
|
||||
InputBuffer.Signature = ACPI_EVAL_INPUT_BUFFER_SIGNATURE;
|
||||
@ -283,7 +283,7 @@ CmBattGetUniqueId(IN PDEVICE_OBJECT DeviceObject,
|
||||
DbgPrint("CmBattGetUniqueId: Failed _UID method - Status (0x%x)\n", Status);
|
||||
Status = STATUS_NO_SUCH_DEVICE;
|
||||
}
|
||||
|
||||
|
||||
/* Return status */
|
||||
return Status;
|
||||
}
|
||||
@ -299,7 +299,7 @@ CmBattSetTripPpoint(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
if (CmBattDebug & 0x440)
|
||||
DbgPrint("CmBattSetTripPpoint: _BTP Alarm Value %x Device %x Tid %x\n",
|
||||
AlarmValue, DeviceExtension->DeviceId, KeGetCurrentThread);
|
||||
|
||||
|
||||
/* Request the _BTP method */
|
||||
*(PULONG)InputBuffer.MethodName = 'PTB_';
|
||||
InputBuffer.Signature = ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_SIGNATURE;
|
||||
@ -315,7 +315,7 @@ CmBattSetTripPpoint(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
if (!(NT_SUCCESS(Status)) && (CmBattDebug & 0x440))
|
||||
DbgPrint("CmBattSetTripPpoint: Failed _BTP method on device %x - Status (0x%x)\n",
|
||||
DeviceExtension->DeviceId, Status);
|
||||
|
||||
|
||||
/* Return status */
|
||||
return Status;
|
||||
}
|
||||
|
@ -25,12 +25,12 @@ CompBattOpenClose(IN PDEVICE_OBJECT DeviceObject,
|
||||
{
|
||||
PAGED_CODE();
|
||||
if (CompBattDebug & 0x100) DbgPrint("CompBatt: ENTERING OpenClose\n");
|
||||
|
||||
|
||||
/* Complete the IRP with success */
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
|
||||
/* Return success */
|
||||
if (CompBattDebug & 0x100) DbgPrint("CompBatt: Exiting OpenClose\n");
|
||||
return STATUS_SUCCESS;
|
||||
@ -45,7 +45,7 @@ CompBattSystemControl(IN PDEVICE_OBJECT DeviceObject,
|
||||
NTSTATUS Status;
|
||||
PAGED_CODE();
|
||||
if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING System Control\n");
|
||||
|
||||
|
||||
/* Are we attached yet? */
|
||||
if (DeviceExtension->AttachedDevice)
|
||||
{
|
||||
@ -60,7 +60,7 @@ CompBattSystemControl(IN PDEVICE_OBJECT DeviceObject,
|
||||
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
}
|
||||
|
||||
|
||||
/* Return status */
|
||||
return Status;
|
||||
}
|
||||
@ -109,13 +109,13 @@ CompBattRecalculateTag(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
|
||||
DeviceExtension->NextTag = Tag + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* No tag for this device extension, clear it */
|
||||
DeviceExtension->Tag = 0;
|
||||
NextEntry = NextEntry->Flink;
|
||||
}
|
||||
|
||||
/* We're done */
|
||||
|
||||
/* We're done */
|
||||
ExReleaseFastMutex(&DeviceExtension->Lock);
|
||||
if (CompBattDebug & 0x100) DbgPrint("CompBatt: EXITING CompBattRecalculateTag\n");
|
||||
}
|
||||
@ -159,7 +159,7 @@ CompBattQueryTag(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
/* Assign one */
|
||||
CompBattRecalculateTag(DeviceExtension);
|
||||
}
|
||||
|
||||
|
||||
/* Do we have a tag now? */
|
||||
if ((DeviceExtension->Flags & COMPBATT_TAG_ASSIGNED) && (DeviceExtension->Tag))
|
||||
{
|
||||
@ -173,7 +173,7 @@ CompBattQueryTag(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
*Tag = 0;
|
||||
Status = STATUS_NO_SUCH_DEVICE;
|
||||
}
|
||||
|
||||
|
||||
/* Return status */
|
||||
if (CompBattDebug & 0x100) DbgPrint("CompBatt: EXITING QueryTag\n");
|
||||
return Status;
|
||||
@ -236,12 +236,12 @@ CompBattGetBatteryInformation(OUT PBATTERY_INFORMATION BatteryInfo,
|
||||
PCOMPBATT_BATTERY_DATA BatteryData;
|
||||
PLIST_ENTRY ListHead, NextEntry;
|
||||
if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING GetBatteryInformation\n");
|
||||
|
||||
|
||||
/* Set defaults */
|
||||
BatteryInfo->DefaultAlert1 = 0;
|
||||
BatteryInfo->DefaultAlert2 = 0;
|
||||
BatteryInfo->CriticalBias = 0;
|
||||
|
||||
|
||||
/* Loop the battery list */
|
||||
ExAcquireFastMutex(&DeviceExtension->Lock);
|
||||
ListHead = &DeviceExtension->BatteryList;
|
||||
@ -254,12 +254,12 @@ CompBattGetBatteryInformation(OUT PBATTERY_INFORMATION BatteryInfo,
|
||||
{
|
||||
/* Now release the device lock since the battery can't go away */
|
||||
ExReleaseFastMutex(&DeviceExtension->Lock);
|
||||
|
||||
|
||||
/* Build the query */
|
||||
InputBuffer.BatteryTag = BatteryData->Tag;
|
||||
InputBuffer.InformationLevel = BatteryInformation;
|
||||
InputBuffer.AtRate = 0;
|
||||
|
||||
|
||||
/* Make sure the battery has a tag */
|
||||
if (BatteryData->Tag)
|
||||
{
|
||||
@ -284,7 +284,7 @@ CompBattGetBatteryInformation(OUT PBATTERY_INFORMATION BatteryInfo,
|
||||
IoReleaseRemoveLock(&BatteryData->RemoveLock, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Next time we can use the static copy */
|
||||
BatteryData->Flags |= COMPBATT_BATTERY_INFORMATION_PRESENT;
|
||||
if (CompBattDebug & 2)
|
||||
@ -307,7 +307,7 @@ CompBattGetBatteryInformation(OUT PBATTERY_INFORMATION BatteryInfo,
|
||||
|
||||
/* Combine capabilities */
|
||||
BatteryInfo->Capabilities |= BatteryData->BatteryInformation.Capabilities;
|
||||
|
||||
|
||||
/* Add-on capacity */
|
||||
if (BatteryData->BatteryInformation.DesignedCapacity != BATTERY_UNKNOWN_CAPACITY)
|
||||
{
|
||||
@ -319,7 +319,7 @@ CompBattGetBatteryInformation(OUT PBATTERY_INFORMATION BatteryInfo,
|
||||
{
|
||||
BatteryInfo->FullChargedCapacity += BatteryData->BatteryInformation.FullChargedCapacity;
|
||||
}
|
||||
|
||||
|
||||
/* Choose the highest alert */
|
||||
BatteryInfo->DefaultAlert1 = max(BatteryInfo->DefaultAlert1,
|
||||
BatteryData->BatteryInformation.DefaultAlert1);
|
||||
@ -327,22 +327,22 @@ CompBattGetBatteryInformation(OUT PBATTERY_INFORMATION BatteryInfo,
|
||||
/* Choose the highest alert */
|
||||
BatteryInfo->DefaultAlert2 = max(BatteryInfo->DefaultAlert2,
|
||||
BatteryData->BatteryInformation.DefaultAlert2);
|
||||
|
||||
|
||||
/* Choose the highest critical bias */
|
||||
BatteryInfo->CriticalBias = max(BatteryInfo->CriticalBias,
|
||||
BatteryData->BatteryInformation.CriticalBias);
|
||||
}
|
||||
|
||||
|
||||
/* Re-acquire the device extension lock and release the remove lock */
|
||||
ExAcquireFastMutex(&DeviceExtension->Lock);
|
||||
IoReleaseRemoveLock(&BatteryData->RemoveLock, 0);
|
||||
}
|
||||
|
||||
|
||||
/* Next entry */
|
||||
NextEntry = NextEntry->Flink;
|
||||
}
|
||||
|
||||
/* We are done with the list, check if the information was queried okay */
|
||||
|
||||
/* We are done with the list, check if the information was queried okay */
|
||||
ExReleaseFastMutex(&DeviceExtension->Lock);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
@ -351,7 +351,7 @@ CompBattGetBatteryInformation(OUT PBATTERY_INFORMATION BatteryInfo,
|
||||
{
|
||||
BatteryInfo->FullChargedCapacity = BatteryInfo->DesignedCapacity;
|
||||
}
|
||||
|
||||
|
||||
/* Print out final combined data */
|
||||
if (CompBattDebug & 2)
|
||||
DbgPrint("CompBattGetBatteryInformation: Returning BATTERY_INFORMATION\n"
|
||||
@ -369,14 +369,14 @@ CompBattGetBatteryInformation(OUT PBATTERY_INFORMATION BatteryInfo,
|
||||
BatteryInfo->DefaultAlert2,
|
||||
BatteryInfo->CriticalBias,
|
||||
BatteryInfo->CycleCount);
|
||||
|
||||
|
||||
/* Copy the data into the device extension */
|
||||
RtlCopyMemory(&DeviceExtension->BatteryInformation,
|
||||
BatteryInfo,
|
||||
sizeof(DeviceExtension->BatteryInformation));
|
||||
DeviceExtension->Flags |= COMPBATT_BATTERY_INFORMATION_PRESENT;
|
||||
}
|
||||
|
||||
|
||||
/* We are done */
|
||||
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING GetBatteryInformation\n");
|
||||
return Status;
|
||||
@ -394,13 +394,13 @@ CompBattGetBatteryGranularity(OUT PBATTERY_REPORTING_SCALE ReportingScale,
|
||||
PLIST_ENTRY ListHead, NextEntry;
|
||||
ULONG i;
|
||||
if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING GetBatteryGranularity\n");
|
||||
|
||||
|
||||
/* Set defaults */
|
||||
ReportingScale[0].Granularity = -1;
|
||||
ReportingScale[1].Granularity = -1;
|
||||
ReportingScale[2].Granularity = -1;
|
||||
ReportingScale[3].Granularity = -1;
|
||||
|
||||
|
||||
/* Loop the battery list */
|
||||
ExAcquireFastMutex(&DeviceExtension->Lock);
|
||||
ListHead = &DeviceExtension->BatteryList;
|
||||
@ -413,11 +413,11 @@ CompBattGetBatteryGranularity(OUT PBATTERY_REPORTING_SCALE ReportingScale,
|
||||
{
|
||||
/* Now release the device lock since the battery can't go away */
|
||||
ExReleaseFastMutex(&DeviceExtension->Lock);
|
||||
|
||||
|
||||
/* Build the query */
|
||||
InputBuffer.BatteryTag = BatteryData->Tag;
|
||||
InputBuffer.InformationLevel = BatteryGranularityInformation;
|
||||
|
||||
|
||||
/* Make sure the battery has a tag */
|
||||
if (BatteryData->Tag)
|
||||
{
|
||||
@ -438,7 +438,7 @@ CompBattGetBatteryGranularity(OUT PBATTERY_REPORTING_SCALE ReportingScale,
|
||||
IoReleaseRemoveLock(&BatteryData->RemoveLock, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Loop all 4 scales */
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
@ -449,10 +449,10 @@ CompBattGetBatteryGranularity(OUT PBATTERY_REPORTING_SCALE ReportingScale,
|
||||
ReportingScale[i].Granularity = min(BatteryScale[i].Granularity,
|
||||
ReportingScale[i].Granularity);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Re-acquire the device extension lock and release the remove lock */
|
||||
ExAcquireFastMutex(&DeviceExtension->Lock);
|
||||
IoReleaseRemoveLock(&BatteryData->RemoveLock, 0);
|
||||
@ -461,7 +461,7 @@ CompBattGetBatteryGranularity(OUT PBATTERY_REPORTING_SCALE ReportingScale,
|
||||
/* Next entry */
|
||||
NextEntry = NextEntry->Flink;
|
||||
}
|
||||
|
||||
|
||||
/* All done */
|
||||
ExReleaseFastMutex(&DeviceExtension->Lock);
|
||||
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING GetBatteryGranularity\n");
|
||||
@ -476,7 +476,7 @@ CompBattGetEstimatedTime(OUT PULONG Time,
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
CompBattQueryInformation(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
@ -505,12 +505,12 @@ CompBattQueryInformation(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
/* Not right, so fail */
|
||||
return STATUS_NO_SUCH_DEVICE;
|
||||
}
|
||||
|
||||
|
||||
/* Check what caller wants */
|
||||
switch (InfoLevel)
|
||||
{
|
||||
case BatteryInformation:
|
||||
|
||||
|
||||
/* Query combined battery information */
|
||||
RtlZeroMemory(&BatteryInfo, sizeof(BatteryInfo));
|
||||
Status = CompBattGetBatteryInformation(&BatteryInfo, DeviceExtension);
|
||||
@ -521,7 +521,7 @@ CompBattQueryInformation(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
QueryLength = sizeof(BatteryInfo);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case BatteryGranularityInformation:
|
||||
|
||||
/* Query combined granularity information */
|
||||
@ -534,9 +534,9 @@ CompBattQueryInformation(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
QueryData = &BatteryGranularity;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case BatteryEstimatedTime:
|
||||
|
||||
|
||||
/* Query combined time estimate information */
|
||||
RtlZeroMemory(&Time, sizeof(Time));
|
||||
Status = CompBattGetEstimatedTime(&Time, DeviceExtension);
|
||||
@ -544,20 +544,20 @@ CompBattQueryInformation(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
{
|
||||
/* Return the data if successful */
|
||||
QueryLength = sizeof(Time);
|
||||
QueryData = &Time;
|
||||
QueryData = &Time;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case BatteryManufactureName:
|
||||
case BatteryDeviceName:
|
||||
|
||||
|
||||
/* Return the static buffer */
|
||||
QueryData = BatteryName;
|
||||
QueryLength = sizeof(L"Composite Battery");
|
||||
break;
|
||||
|
||||
|
||||
case BatteryManufactureDate:
|
||||
|
||||
|
||||
/* Static data */
|
||||
//Date.Day = 26;
|
||||
//Date.Month = 06;
|
||||
@ -572,7 +572,7 @@ CompBattQueryInformation(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
QueryData = &Dummy;
|
||||
QueryLength = sizeof(Dummy);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
/* Everything else is unknown */
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
@ -585,7 +585,7 @@ CompBattQueryInformation(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
|
||||
|
||||
/* Copy the data if there's enough space and it exists */
|
||||
if ((NT_SUCCESS(Status)) && (QueryData)) RtlCopyMemory(Buffer, QueryData, QueryLength);
|
||||
|
||||
|
||||
/* Return function result */
|
||||
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING QueryInformation\n");
|
||||
return Status;
|
||||
@ -598,7 +598,7 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject,
|
||||
{
|
||||
/* Register add device routine */
|
||||
DriverObject->DriverExtension->AddDevice = CompBattAddDevice;
|
||||
|
||||
|
||||
/* Register other handlers */
|
||||
DriverObject->MajorFunction[IRP_MJ_CREATE] = CompBattOpenClose;
|
||||
DriverObject->MajorFunction[IRP_MJ_CLOSE] = CompBattOpenClose;
|
||||
|
@ -88,7 +88,7 @@ CompBattQueryInformation(
|
||||
IN ULONG BufferLength,
|
||||
OUT PULONG ReturnedLength
|
||||
);
|
||||
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
CompBattQueryStatus(
|
||||
@ -144,7 +144,7 @@ CompBattGetDeviceObjectPointer(
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
BatteryIoctl(
|
||||
IN ULONG IoControlCode,
|
||||
IN ULONG IoControlCode,
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PVOID InputBuffer,
|
||||
IN ULONG InputBufferLength,
|
||||
|
@ -250,6 +250,6 @@ Bus_PDO_EvalMethod(PPDO_DEVICE_DATA DeviceData,
|
||||
else
|
||||
{
|
||||
DPRINT1("Query method %4s failed on %p\n", EvalInputBuff->MethodName, DeviceData->AcpiHandle);
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ struct acpi_device_power_flags {
|
||||
|
||||
struct acpi_device_power_state {
|
||||
struct {
|
||||
UINT8 valid:1;
|
||||
UINT8 valid:1;
|
||||
UINT8 explicit_set:1; /* _PSx present? */
|
||||
UINT8 reserved:6;
|
||||
} flags;
|
||||
@ -227,7 +227,7 @@ struct acpi_device_perf_flags {
|
||||
|
||||
struct acpi_device_perf_state {
|
||||
struct {
|
||||
UINT8 valid:1;
|
||||
UINT8 valid:1;
|
||||
UINT8 reserved:7;
|
||||
} flags;
|
||||
UINT8 power; /* % Power (compared to P0) */
|
||||
|
@ -87,7 +87,7 @@
|
||||
#define ACPI_BUTTON_NOTIFY_STATUS 0x80
|
||||
|
||||
#define ACPI_BUTTON_SUBCLASS_POWER "power"
|
||||
#define ACPI_BUTTON_HID_POWER "PNP0C0C"
|
||||
#define ACPI_BUTTON_HID_POWER "PNP0C0C"
|
||||
#define ACPI_BUTTON_HID_POWERF "ACPI_FPB"
|
||||
#define ACPI_BUTTON_DEVICE_NAME_POWER "Power Button (CM)"
|
||||
#define ACPI_BUTTON_DEVICE_NAME_POWERF "Power Button (FF)"
|
||||
|
@ -1,6 +1,6 @@
|
||||
#ifndef _LINUX_LIST_H
|
||||
#define _LINUX_LIST_H
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Simple doubly linked list implementation.
|
||||
@ -11,23 +11,23 @@
|
||||
* generate better code by using them directly rather than
|
||||
* using the generic single-entry routines.
|
||||
*/
|
||||
|
||||
|
||||
struct list_head {
|
||||
struct list_head *next, *prev;
|
||||
};
|
||||
|
||||
|
||||
#define LIST_HEAD_INIT(name) { &(name), &(name) }
|
||||
|
||||
|
||||
#define LIST_HEAD(name) \
|
||||
struct list_head name = LIST_HEAD_INIT(name)
|
||||
|
||||
|
||||
#define INIT_LIST_HEAD(ptr) do { \
|
||||
(ptr)->next = (ptr); (ptr)->prev = (ptr); \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Insert a new entry between two known consecutive entries.
|
||||
* Insert a new entry between two known consecutive entries.
|
||||
*
|
||||
* This is only for internal list manipulation where we know
|
||||
* the prev/next entries already!
|
||||
@ -41,7 +41,7 @@
|
||||
new->prev = prev;
|
||||
prev->next = new;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* list_add - add a new entry
|
||||
* @new: new entry to be added
|
||||
@ -54,7 +54,7 @@
|
||||
{
|
||||
__list_add(new, head, head->next);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* list_add_tail - add a new entry
|
||||
* @new: new entry to be added
|
||||
@ -67,7 +67,7 @@
|
||||
{
|
||||
__list_add(new, head->prev, head);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Delete a list entry by making the prev/next entries
|
||||
* point to each other.
|
||||
@ -80,7 +80,7 @@
|
||||
next->prev = prev;
|
||||
prev->next = next;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* list_del - deletes entry from list.
|
||||
* @entry: the element to delete from the list.
|
||||
@ -92,7 +92,7 @@
|
||||
entry->next = (void *) 0;
|
||||
entry->prev = (void *) 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* list_del_init - deletes entry from list and reinitialize it.
|
||||
* @entry: the element to delete from the list.
|
||||
@ -100,9 +100,9 @@
|
||||
static inline void list_del_init(struct list_head *entry)
|
||||
{
|
||||
__list_del(entry->prev, entry->next);
|
||||
INIT_LIST_HEAD(entry);
|
||||
INIT_LIST_HEAD(entry);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* list_move - delete from one list and add as another's head
|
||||
* @list: the entry to move
|
||||
@ -113,7 +113,7 @@
|
||||
__list_del(list->prev, list->next);
|
||||
list_add(list, head);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* list_move_tail - delete from one list and add as another's tail
|
||||
* @list: the entry to move
|
||||
@ -125,7 +125,7 @@
|
||||
__list_del(list->prev, list->next);
|
||||
list_add_tail(list, head);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* list_empty - tests whether a list is empty
|
||||
* @head: the list to test.
|
||||
@ -134,21 +134,21 @@
|
||||
{
|
||||
return head->next == head;
|
||||
}
|
||||
|
||||
|
||||
static inline void __list_splice(struct list_head *list,
|
||||
struct list_head *head)
|
||||
{
|
||||
struct list_head *first = list->next;
|
||||
struct list_head *last = list->prev;
|
||||
struct list_head *at = head->next;
|
||||
|
||||
|
||||
first->prev = head;
|
||||
head->next = first;
|
||||
|
||||
|
||||
last->next = at;
|
||||
at->prev = last;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* list_splice - join two lists
|
||||
* @list: the new list to add.
|
||||
@ -159,7 +159,7 @@
|
||||
if (!list_empty(list))
|
||||
__list_splice(list, head);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* list_splice_init - join two lists and reinitialise the emptied list.
|
||||
* @list: the new list to add.
|
||||
@ -175,7 +175,7 @@
|
||||
INIT_LIST_HEAD(list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* list_entry - get the struct for this entry
|
||||
* @ptr: the &struct list_head pointer.
|
||||
@ -184,7 +184,7 @@
|
||||
*/
|
||||
#define list_entry(ptr, type, member) \
|
||||
((type *)((char *)(ptr)-(uintptr_t)(&((type *)0)->member)))
|
||||
|
||||
|
||||
/**
|
||||
* list_for_each - iterate over a list
|
||||
* @pos: the &struct list_head to use as a loop counter.
|
||||
@ -201,7 +201,7 @@
|
||||
#define list_for_each_prev(pos, head) \
|
||||
for (pos = (head)->prev; pos != (head); \
|
||||
pos = pos->prev)
|
||||
|
||||
|
||||
/**
|
||||
* list_for_each_safe - iterate over a list safe against removal of list entry
|
||||
* @pos: the &struct list_head to use as a loop counter.
|
||||
@ -211,7 +211,7 @@
|
||||
#define list_for_each_safe(pos, n, head) \
|
||||
for (pos = (head)->next, n = pos->next; pos != (head); \
|
||||
pos = n, n = pos->next)
|
||||
|
||||
|
||||
/**
|
||||
* list_for_each_entry - iterate over list of given type
|
||||
* @pos: the type * to use as a loop counter.
|
||||
@ -222,7 +222,7 @@
|
||||
for (pos = list_entry((head)->next, typeof(*pos), member); \
|
||||
&pos->member != (head); \
|
||||
pos = list_entry(pos->member.next, typeof(*pos), member))
|
||||
|
||||
|
||||
/**
|
||||
* list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
|
||||
* @pos: the type * to use as a loop counter.
|
||||
@ -235,7 +235,7 @@
|
||||
n = list_entry(pos->member.next, typeof(*pos), member); \
|
||||
&pos->member != (head); \
|
||||
pos = n, n = list_entry(n->member.next, typeof(*n), member))
|
||||
|
||||
|
||||
/**
|
||||
* list_for_each_entry_continue - iterate over list of given type
|
||||
* continuing after existing point
|
||||
@ -247,5 +247,5 @@
|
||||
for (pos = list_entry(pos->member.next, typeof(*pos), member); \
|
||||
&pos->member != (head); \
|
||||
pos = list_entry(pos->member.next, typeof(*pos), member))
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -311,7 +311,7 @@ ACPIDispatchDeviceControl(
|
||||
|
||||
status = STATUS_PENDING;
|
||||
break;
|
||||
|
||||
|
||||
case IOCTL_BATTERY_QUERY_TAG:
|
||||
DPRINT("IOCTL_BATTERY_QUERY_TAG is not supported!\n");
|
||||
break;
|
||||
|
@ -78,7 +78,7 @@ Bus_FDO_PnP (
|
||||
{
|
||||
NTSTATUS status;
|
||||
ULONG length, prevcount, numPdosPresent;
|
||||
PLIST_ENTRY entry;
|
||||
PLIST_ENTRY entry;
|
||||
PPDO_DEVICE_DATA pdoData;
|
||||
PDEVICE_RELATIONS relations, oldRelations;
|
||||
|
||||
@ -105,7 +105,7 @@ Bus_FDO_PnP (
|
||||
|
||||
//
|
||||
// The PnP manager is trying to stop the device
|
||||
// for resource rebalancing.
|
||||
// for resource rebalancing.
|
||||
//
|
||||
SET_NEW_PNP_STATE(DeviceData->Common, StopPending);
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
|
@ -72,7 +72,7 @@ Bus_FDO_Power (
|
||||
DbgDevicePowerString(powerState.DeviceState)));
|
||||
|
||||
if (powerType == SystemPowerState)
|
||||
{
|
||||
{
|
||||
switch (powerState.SystemState) {
|
||||
case PowerSystemSleeping1:
|
||||
AcpiState = ACPI_STATE_S1;
|
||||
|
@ -374,7 +374,7 @@ PciDebugPrintCmResList(IN PCM_RESOURCE_LIST PartialList)
|
||||
ListCount = PartialList->Count;
|
||||
FullDescriptor = PartialList->List;
|
||||
DPRINT1(" CM_RESOURCE_LIST (PCI Bus Driver) (List Count = %u)\n", PartialList->Count);
|
||||
|
||||
|
||||
/* Loop full list */
|
||||
for (i = 0; i < ListCount; i++)
|
||||
{
|
||||
|
@ -1601,7 +1601,7 @@ PciScanBus(IN PPCI_FDO_EXTENSION DeviceExtension)
|
||||
|
||||
/* Check for hack which only allows bus to have one child device */
|
||||
if (PdoExtension->HackFlags & PCI_HACK_ONE_CHILD) MaxDevice = 1;
|
||||
|
||||
|
||||
/* Check if the secondary bus number has changed */
|
||||
PciReadDeviceConfig(PdoExtension,
|
||||
&SecondaryBus,
|
||||
|
@ -128,7 +128,7 @@ PciIdPrintf(IN PPCI_ID_BUFFER IdBuffer,
|
||||
va_list va;
|
||||
|
||||
ASSERT(IdBuffer->Count < MAX_ANSI_STRINGS);
|
||||
|
||||
|
||||
/* Do the actual string formatting into the character buffer */
|
||||
va_start(va, Format);
|
||||
vsprintf(IdBuffer->CharBuffer, Format, va);
|
||||
@ -137,19 +137,19 @@ PciIdPrintf(IN PPCI_ID_BUFFER IdBuffer,
|
||||
/* Initialize the ANSI_STRING that will hold this string buffer */
|
||||
AnsiString = &IdBuffer->Strings[IdBuffer->Count];
|
||||
RtlInitAnsiString(AnsiString, IdBuffer->CharBuffer);
|
||||
|
||||
|
||||
/* Calculate the final size of the string, in Unicode */
|
||||
Size = RtlAnsiStringToUnicodeSize(AnsiString);
|
||||
|
||||
|
||||
/* Update hte buffer with the size,and update the character pointer */
|
||||
IdBuffer->StringSize[IdBuffer->Count] = Size;
|
||||
IdBuffer->TotalLength += Size;
|
||||
Length = AnsiString->Length + sizeof(ANSI_NULL);
|
||||
IdBuffer->CharBuffer += Length;
|
||||
|
||||
|
||||
/* Move to the next string for next time */
|
||||
IdBuffer->Count++;
|
||||
|
||||
|
||||
/* Return the length */
|
||||
return Length;
|
||||
}
|
||||
@ -165,13 +165,13 @@ PciIdPrintfAppend(IN PPCI_ID_BUFFER IdBuffer,
|
||||
va_list va;
|
||||
|
||||
ASSERT(IdBuffer->Count);
|
||||
|
||||
|
||||
/* Choose the next static ANSI_STRING to use */
|
||||
NextId = IdBuffer->Count - 1;
|
||||
|
||||
|
||||
/* Max length is from the end of the buffer up until the current pointer */
|
||||
MaxLength = (PCHAR)(IdBuffer + 1) - IdBuffer->CharBuffer;
|
||||
|
||||
MaxLength = (PCHAR)(IdBuffer + 1) - IdBuffer->CharBuffer;
|
||||
|
||||
/* Do the actual append, and return the length this string took */
|
||||
va_start(va, Format);
|
||||
Length = vsprintf(IdBuffer->CharBuffer - 1, Format, va);
|
||||
@ -182,15 +182,15 @@ PciIdPrintfAppend(IN PPCI_ID_BUFFER IdBuffer,
|
||||
AnsiString = &IdBuffer->Strings[NextId];
|
||||
AnsiString->Length += Length;
|
||||
AnsiString->MaximumLength += Length;
|
||||
|
||||
|
||||
/* Calculate the final size of the string, in Unicode */
|
||||
Size = RtlAnsiStringToUnicodeSize(AnsiString);
|
||||
|
||||
|
||||
/* Update the buffer with the size, and update the character pointer */
|
||||
IdBuffer->StringSize[NextId] = Size;
|
||||
IdBuffer->TotalLength += Size;
|
||||
IdBuffer->CharBuffer += Length;
|
||||
|
||||
|
||||
/* Return the size */
|
||||
return Size;
|
||||
}
|
||||
@ -212,28 +212,28 @@ PciQueryId(IN PPCI_PDO_EXTENSION DeviceExtension,
|
||||
UNICODE_STRING DestinationString;
|
||||
PCI_ID_BUFFER IdBuffer;
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
/* Assume failure */
|
||||
Status = STATUS_SUCCESS;
|
||||
*Buffer = NULL;
|
||||
|
||||
|
||||
/* Start with the genric vendor string, which is the vendor ID + device ID */
|
||||
sprintf(VendorString,
|
||||
"PCI\\VEN_%04X&DEV_%04X",
|
||||
DeviceExtension->VendorId,
|
||||
DeviceExtension->DeviceId);
|
||||
|
||||
|
||||
/* Initialize the PCI ID Buffer */
|
||||
PciInitIdBuffer(&IdBuffer);
|
||||
|
||||
|
||||
/* Build the subsystem ID as shown in PCI ID Strings */
|
||||
SubsysId = DeviceExtension->SubsystemVendorId | (DeviceExtension->SubsystemId << 16);
|
||||
|
||||
|
||||
/* Check what the caller is requesting */
|
||||
switch (QueryType)
|
||||
{
|
||||
case BusQueryDeviceID:
|
||||
|
||||
|
||||
/* A single ID, the vendor string + the revision ID */
|
||||
PciIdPrintf(&IdBuffer,
|
||||
"%s&SUBSYS_%08X&REV_%02X",
|
||||
@ -241,22 +241,22 @@ PciQueryId(IN PPCI_PDO_EXTENSION DeviceExtension,
|
||||
SubsysId,
|
||||
DeviceExtension->RevisionId);
|
||||
break;
|
||||
|
||||
|
||||
case BusQueryHardwareIDs:
|
||||
|
||||
|
||||
/* First the vendor string + the subsystem ID + the revision ID */
|
||||
PciIdPrintf(&IdBuffer,
|
||||
"%s&SUBSYS_%08X&REV_%02X",
|
||||
VendorString,
|
||||
SubsysId,
|
||||
DeviceExtension->RevisionId);
|
||||
|
||||
|
||||
/* Next, without the revision */
|
||||
PciIdPrintf(&IdBuffer,
|
||||
"%s&SUBSYS_%08X",
|
||||
VendorString,
|
||||
SubsysId);
|
||||
|
||||
|
||||
/* Next, the vendor string + the base class + sub class + progif */
|
||||
PciIdPrintf(&IdBuffer,
|
||||
"%s&CC_%02X%02X%02X",
|
||||
@ -271,13 +271,13 @@ PciQueryId(IN PPCI_PDO_EXTENSION DeviceExtension,
|
||||
VendorString,
|
||||
DeviceExtension->BaseClass,
|
||||
DeviceExtension->SubClass);
|
||||
|
||||
|
||||
/* And finally, a terminator */
|
||||
PciIdPrintf(&IdBuffer, "\0");
|
||||
break;
|
||||
|
||||
|
||||
case BusQueryCompatibleIDs:
|
||||
|
||||
|
||||
/* First, the vendor + revision ID only */
|
||||
PciIdPrintf(&IdBuffer,
|
||||
"%s&REV_%02X",
|
||||
@ -286,7 +286,7 @@ PciQueryId(IN PPCI_PDO_EXTENSION DeviceExtension,
|
||||
|
||||
/* Next, the vendor string alone */
|
||||
PciIdPrintf(&IdBuffer, "%s", VendorString);
|
||||
|
||||
|
||||
/* Next, the vendor ID + the base class + the sub class + progif */
|
||||
PciIdPrintf(&IdBuffer,
|
||||
"PCI\\VEN_%04X&CC_%02X%02X%02X",
|
||||
@ -319,22 +319,22 @@ PciQueryId(IN PPCI_PDO_EXTENSION DeviceExtension,
|
||||
"PCI\\CC_%02X%02X",
|
||||
DeviceExtension->BaseClass,
|
||||
DeviceExtension->SubClass);
|
||||
|
||||
|
||||
/* And finally, a terminator */
|
||||
PciIdPrintf(&IdBuffer, "\0");
|
||||
break;
|
||||
|
||||
|
||||
case BusQueryInstanceID:
|
||||
|
||||
|
||||
/* Start with a terminator */
|
||||
PciIdPrintf(&IdBuffer, "\0");
|
||||
|
||||
|
||||
/* And then encode the device and function number */
|
||||
PciIdPrintfAppend(&IdBuffer,
|
||||
"%02X",
|
||||
(DeviceExtension->Slot.u.bits.DeviceNumber << 3) |
|
||||
DeviceExtension->Slot.u.bits.FunctionNumber);
|
||||
|
||||
|
||||
/* Loop every parent until the root */
|
||||
ParentExtension = DeviceExtension->ParentFdoExtension;
|
||||
while (!PCI_IS_ROOT_FDO(ParentExtension))
|
||||
@ -347,37 +347,37 @@ PciQueryId(IN PPCI_PDO_EXTENSION DeviceExtension,
|
||||
PdoExtension->Slot.u.bits.FunctionNumber);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
|
||||
/* Unknown query type */
|
||||
DPRINT1("PciQueryId expected ID type = %d\n", QueryType);
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
/* Something should've been generated if this has been reached */
|
||||
ASSERT(IdBuffer.Count > 0);
|
||||
|
||||
|
||||
/* Allocate the final string buffer to hold the ID */
|
||||
StringBuffer = ExAllocatePoolWithTag(PagedPool, IdBuffer.TotalLength, 'BicP');
|
||||
if (!StringBuffer) return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
|
||||
/* Build the UNICODE_STRING structure for it */
|
||||
DPRINT1("PciQueryId(%d)\n", QueryType);
|
||||
DestinationString.Buffer = StringBuffer;
|
||||
DestinationString.MaximumLength = IdBuffer.TotalLength;
|
||||
|
||||
|
||||
/* Loop every ID in the buffer */
|
||||
for (i = 0; i < IdBuffer.Count; i++)
|
||||
{
|
||||
/* Select the ANSI_STRING for the ID */
|
||||
NextString = &IdBuffer.Strings[i];
|
||||
DPRINT1(" <- \"%s\"\n", NextString->Buffer);
|
||||
|
||||
|
||||
/* Convert it to a UNICODE_STRING */
|
||||
Status = RtlAnsiStringToUnicodeString(&DestinationString, NextString, FALSE);
|
||||
ASSERT(NT_SUCCESS(Status));
|
||||
|
||||
|
||||
/* Add it into the final destination buffer */
|
||||
Size = IdBuffer.StringSize[i];
|
||||
DestinationString.MaximumLength -= Size;
|
||||
@ -399,25 +399,25 @@ PciQueryDeviceText(IN PPCI_PDO_EXTENSION PdoExtension,
|
||||
PWCHAR MessageBuffer, LocationBuffer;
|
||||
ULONG Length;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
UNREFERENCED_PARAMETER(Locale);
|
||||
|
||||
/* Check what the caller is requesting */
|
||||
switch (QueryType)
|
||||
{
|
||||
case DeviceTextDescription:
|
||||
|
||||
|
||||
/* Get the message from the resource section */
|
||||
MessageBuffer = PciGetDeviceDescriptionMessage(PdoExtension->BaseClass,
|
||||
PdoExtension->SubClass);
|
||||
|
||||
|
||||
/* Return it to the caller, and select proper status code */
|
||||
*Buffer = MessageBuffer;
|
||||
Status = MessageBuffer ? STATUS_SUCCESS : STATUS_NOT_SUPPORTED;
|
||||
break;
|
||||
|
||||
|
||||
case DeviceTextLocationInformation:
|
||||
|
||||
|
||||
/* Get the message from the resource section */
|
||||
MessageBuffer = PciGetDescriptionMessage(0x10000, &Length);
|
||||
if (!MessageBuffer)
|
||||
@ -426,14 +426,14 @@ PciQueryDeviceText(IN PPCI_PDO_EXTENSION PdoExtension,
|
||||
Status = STATUS_NOT_SUPPORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Add space for a null-terminator, and allocate the buffer */
|
||||
Length += 2 * sizeof(UNICODE_NULL);
|
||||
LocationBuffer = ExAllocatePoolWithTag(PagedPool,
|
||||
Length * sizeof(WCHAR),
|
||||
'BicP');
|
||||
*Buffer = LocationBuffer;
|
||||
|
||||
|
||||
/* Check if the allocation succeeded */
|
||||
if (LocationBuffer)
|
||||
{
|
||||
@ -444,21 +444,21 @@ PciQueryDeviceText(IN PPCI_PDO_EXTENSION PdoExtension,
|
||||
PdoExtension->Slot.u.bits.FunctionNumber,
|
||||
PdoExtension->Slot.u.bits.DeviceNumber);
|
||||
}
|
||||
|
||||
|
||||
/* Free the original string from the resource section */
|
||||
ExFreePoolWithTag(MessageBuffer, 0);
|
||||
|
||||
|
||||
/* Select the correct status */
|
||||
Status = LocationBuffer ? STATUS_SUCCESS : STATUS_INSUFFICIENT_RESOURCES;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
|
||||
/* Anything else is unsupported */
|
||||
Status = STATUS_NOT_SUPPORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Return whether or not a device text string was indeed found */
|
||||
return Status;
|
||||
}
|
||||
|
@ -611,7 +611,7 @@ PciGetHackFlags(IN USHORT VendorId,
|
||||
ULONGLONG HackFlags;
|
||||
ULONG LastWeight, MatchWeight;
|
||||
ULONG EntryFlags;
|
||||
|
||||
|
||||
/* ReactOS SetupLDR Hack */
|
||||
if (!PciHackTable) return 0;
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
//
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||
|
@ -83,12 +83,12 @@ CdDiskOffsetFromMcbEntry (
|
||||
#pragma alloc_text(PAGE, CdUninitializeMcb)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
#ifdef _MSC_VER
|
||||
// PREFast currently has no way to express the Fcb==Fcb->Vcb->VolumeDasdFcb early return
|
||||
#pragma warning(suppress: 6001 6101)
|
||||
#pragma warning(suppress: 6001 6101)
|
||||
#endif
|
||||
CdLookupAllocation (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -330,7 +330,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdAddAllocationFromDirent (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -479,7 +479,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdAddInitialAllocation (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -494,10 +494,10 @@ Routine Description:
|
||||
|
||||
This routine is called to set up the initial entry in an Mcb.
|
||||
|
||||
This routine handles the single initial entry for a directory file. We will
|
||||
round the start block down to a sector boundary. Our caller has already
|
||||
biased the DataLength with any adjustments. This is used for the case
|
||||
where there is a single entry and we want to align the data on a sector
|
||||
This routine handles the single initial entry for a directory file. We will
|
||||
round the start block down to a sector boundary. Our caller has already
|
||||
biased the DataLength with any adjustments. This is used for the case
|
||||
where there is a single entry and we want to align the data on a sector
|
||||
boundary.
|
||||
|
||||
Arguments:
|
||||
@ -570,7 +570,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdTruncateAllocation (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -623,7 +623,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_At_(Fcb->NodeByteSize, _In_range_(>=, FIELD_OFFSET( FCB, FcbType )))
|
||||
VOID
|
||||
CdInitializeMcb (
|
||||
@ -655,7 +655,7 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
ASSERT_IRP_CONTEXT( IrpContext );
|
||||
ASSERT_FCB( Fcb );
|
||||
|
||||
@ -672,7 +672,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_At_(Fcb->NodeByteSize, _In_range_(>=, FIELD_OFFSET( FCB, FcbType )))
|
||||
_When_(Fcb->NodeTypeCode == CDFS_NTC_FCB_PATH_TABLE, _At_(Fcb->NodeByteSize, _In_range_(==, SIZEOF_FCB_INDEX)))
|
||||
_When_(Fcb->NodeTypeCode == CDFS_NTC_FCB_INDEX, _At_(Fcb->NodeByteSize, _In_range_(==, SIZEOF_FCB_INDEX)))
|
||||
@ -707,7 +707,7 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
ASSERT_IRP_CONTEXT( IrpContext );
|
||||
ASSERT_FCB( Fcb );
|
||||
|
||||
@ -723,7 +723,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local suupport routine
|
||||
//
|
||||
@ -764,7 +764,7 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
ASSERT_IRP_CONTEXT( IrpContext );
|
||||
ASSERT_FCB( Fcb );
|
||||
ASSERT_LOCKED_FCB( Fcb );
|
||||
@ -803,7 +803,7 @@ Return Value:
|
||||
return CurrentMcbOffset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -858,7 +858,7 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
ASSERT_IRP_CONTEXT( IrpContext );
|
||||
|
||||
//
|
||||
|
@ -33,7 +33,7 @@ Abstract:
|
||||
#pragma alloc_text(PAGE, CdPurgeVolume)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdCreateInternalStream (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -128,9 +128,9 @@ Return Value:
|
||||
StreamFileOpen,
|
||||
Fcb,
|
||||
NULL );
|
||||
|
||||
|
||||
//
|
||||
// We'll give stream file objects a name to aid IO profiling etc. We
|
||||
// We'll give stream file objects a name to aid IO profiling etc. We
|
||||
// NULL this in CdDeleteInternalStream before OB deletes the file object,
|
||||
// and before CdRemovePrefix is called (which frees Fcb names).
|
||||
//
|
||||
@ -328,7 +328,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdDeleteInternalStream (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -398,7 +398,7 @@ Return Value:
|
||||
// Null the name pointer, since the stream file object never actually
|
||||
// 'owns' the names, we just point it to existing ones.
|
||||
//
|
||||
|
||||
|
||||
FileObject->FileName.Buffer = NULL;
|
||||
FileObject->FileName.MaximumLength = FileObject->FileName.Length = 0;
|
||||
|
||||
@ -406,7 +406,7 @@ Return Value:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
NTSTATUS
|
||||
CdCompleteMdl (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -458,7 +458,7 @@ Return Value:
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
NTSTATUS
|
||||
|
@ -99,7 +99,7 @@ typedef FILE_ID *PFILE_ID;
|
||||
#define TOC_DATA_TRACK (0x04)
|
||||
#define TOC_LAST_TRACK (0xaa)
|
||||
|
||||
|
||||
|
||||
//
|
||||
// There is considerable rearrangement of the volume descriptors for
|
||||
// ISO and HSG. However, within each standard the same structure can
|
||||
@ -122,7 +122,7 @@ typedef FILE_ID *PFILE_ID;
|
||||
|
||||
#define MAX_FILE_ID_LENGTH (255)
|
||||
|
||||
|
||||
|
||||
typedef struct _RAW_ISO_VD {
|
||||
|
||||
UCHAR DescType; // volume type: 1 = standard, 2 = coded
|
||||
@ -165,7 +165,7 @@ typedef struct _RAW_ISO_VD {
|
||||
} RAW_ISO_VD;
|
||||
typedef RAW_ISO_VD *PRAW_ISO_VD;
|
||||
|
||||
|
||||
|
||||
typedef struct _RAW_HSG_VD {
|
||||
|
||||
ULONG BlkNumI; // logical block number Intel
|
||||
@ -209,7 +209,7 @@ typedef struct _RAW_HSG_VD {
|
||||
} RAW_HSG_VD;
|
||||
typedef RAW_HSG_VD *PRAW_HSG_VD;
|
||||
|
||||
|
||||
|
||||
typedef struct _RAW_JOLIET_VD {
|
||||
|
||||
UCHAR DescType; // volume type: 2 = coded
|
||||
@ -316,7 +316,7 @@ typedef RAW_JOLIET_VD *PRAW_JOLIET_VD;
|
||||
((PRAW_ISO_VD) (R))->VolSpaceI \
|
||||
)
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This structure is used to overlay a region of a disk sector
|
||||
// to retrieve a single directory entry. There is a difference
|
||||
@ -409,7 +409,7 @@ typedef RAW_DIRENT *PRAW_DIRENT;
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// The on-disk representation of a Path Table entry differs between
|
||||
// the ISO version and the HSG version. The fields are the same
|
||||
@ -470,7 +470,7 @@ typedef RAW_PATH_HSG *PRAW_PATH_HSG;
|
||||
(RP)->DirLoc \
|
||||
)
|
||||
|
||||
|
||||
|
||||
//
|
||||
// System use are for XA data. The following is the system use area for
|
||||
// directory entries on XA data disks.
|
||||
|
@ -24,7 +24,7 @@ BOOLEAN CdTestTopLevel = TRUE;
|
||||
BOOLEAN CdTestRaisedStatus = TRUE;
|
||||
BOOLEAN CdBreakOnAnyRaise = FALSE;
|
||||
BOOLEAN CdTraceRaises = FALSE;
|
||||
NTSTATUS CdInterestingExceptionCodes[] = { STATUS_DISK_CORRUPT_ERROR,
|
||||
NTSTATUS CdInterestingExceptionCodes[] = { STATUS_DISK_CORRUPT_ERROR,
|
||||
STATUS_FILE_CORRUPT_ERROR,
|
||||
0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
#endif
|
||||
@ -427,7 +427,7 @@ Return Value:
|
||||
break;
|
||||
|
||||
case IRP_MJ_SHUTDOWN :
|
||||
|
||||
|
||||
Status = CdCommonShutdown( IrpContext, Irp );
|
||||
break;
|
||||
|
||||
@ -469,7 +469,7 @@ CdRaiseStatusEx (
|
||||
)
|
||||
{
|
||||
BOOLEAN BreakIn = FALSE;
|
||||
|
||||
|
||||
AssertVerifyDevice( IrpContext, Status);
|
||||
|
||||
if (CdTraceRaises) {
|
||||
@ -481,8 +481,8 @@ CdRaiseStatusEx (
|
||||
|
||||
ULONG Index;
|
||||
|
||||
for (Index = 0;
|
||||
Index < (sizeof( CdInterestingExceptionCodes) / sizeof( CdInterestingExceptionCodes[0]));
|
||||
for (Index = 0;
|
||||
Index < (sizeof( CdInterestingExceptionCodes) / sizeof( CdInterestingExceptionCodes[0]));
|
||||
Index++) {
|
||||
|
||||
if ((STATUS_SUCCESS != CdInterestingExceptionCodes[Index]) &&
|
||||
@ -495,7 +495,7 @@ CdRaiseStatusEx (
|
||||
}
|
||||
|
||||
if (BreakIn || CdBreakOnAnyRaise) {
|
||||
|
||||
|
||||
DbgPrint( "CDFS: Breaking on raised status %08x (BI=%d,BA=%d)\n", Status, BreakIn, CdBreakOnAnyRaise);
|
||||
DbgPrint( "CDFS: (FILEID %d LINE %d)\n", FileId, Line);
|
||||
DbgPrint( "CDFS: Contact CDFS.SYS component owner for triage.\n");
|
||||
@ -503,7 +503,7 @@ CdRaiseStatusEx (
|
||||
|
||||
NT_ASSERT(FALSE);
|
||||
}
|
||||
|
||||
|
||||
if (NormalizeStatus) {
|
||||
|
||||
IrpContext->ExceptionStatus = FsRtlNormalizeNtstatus( Status, STATUS_UNEXPECTED_IO_ERROR);
|
||||
@ -514,7 +514,7 @@ CdRaiseStatusEx (
|
||||
}
|
||||
|
||||
IrpContext->RaisedAtLineFile = (FileId << 16) | Line;
|
||||
|
||||
|
||||
ExRaiseStatus( IrpContext->ExceptionStatus);
|
||||
}
|
||||
|
||||
@ -591,7 +591,7 @@ Return Value:
|
||||
}
|
||||
|
||||
AssertVerifyDevice( IrpContext, IrpContext->ExceptionStatus );
|
||||
|
||||
|
||||
//
|
||||
// Bug check if this status is not supported.
|
||||
//
|
||||
@ -610,7 +610,7 @@ Return Value:
|
||||
return EXCEPTION_EXECUTE_HANDLER;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
NTSTATUS
|
||||
@ -653,7 +653,7 @@ Return Value:
|
||||
|
||||
ASSERT_OPTIONAL_IRP_CONTEXT( IrpContext );
|
||||
ASSERT_IRP( Irp );
|
||||
|
||||
|
||||
//
|
||||
// If there is not an irp context, then complete the request with the
|
||||
// current status code.
|
||||
@ -679,7 +679,7 @@ Return Value:
|
||||
// or we are forcing this to be posted.
|
||||
//
|
||||
// - Status code is STATUS_VERIFY_REQUIRED and we are at APC level
|
||||
// or higher, or within a guarded region. Can't wait for IO in
|
||||
// or higher, or within a guarded region. Can't wait for IO in
|
||||
// the verify path in this case.
|
||||
//
|
||||
// Set the MORE_PROCESSING flag in the IrpContext to keep if from being
|
||||
@ -697,17 +697,17 @@ Return Value:
|
||||
|
||||
ExceptionCode = CdFsdPostRequest( IrpContext, Irp );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((ExceptionCode == STATUS_VERIFY_REQUIRED) &&
|
||||
FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_TOP_LEVEL ) &&
|
||||
KeAreAllApcsDisabled()) {
|
||||
|
||||
|
||||
ExceptionCode = CdFsdPostRequest( IrpContext, Irp );
|
||||
}
|
||||
}
|
||||
_SEH2_EXCEPT( CdExceptionFilter( IrpContext, _SEH2_GetExceptionInformation() )) {
|
||||
|
||||
ExceptionCode = _SEH2_GetExceptionCode();
|
||||
|
||||
ExceptionCode = _SEH2_GetExceptionCode();
|
||||
} _SEH2_END;
|
||||
//
|
||||
// If we posted the request or our caller will retry then just return here.
|
||||
@ -756,7 +756,7 @@ Return Value:
|
||||
|
||||
Device = IoGetDeviceToVerify( Irp->Tail.Overlay.Thread );
|
||||
IoSetDeviceToVerify( Irp->Tail.Overlay.Thread, NULL );
|
||||
|
||||
|
||||
//
|
||||
// If there is no device in that location then check in the
|
||||
// current thread.
|
||||
@ -772,10 +772,10 @@ Return Value:
|
||||
}
|
||||
|
||||
//
|
||||
// It turns out some storage drivers really do set invalid non-NULL device
|
||||
// It turns out some storage drivers really do set invalid non-NULL device
|
||||
// objects to verify.
|
||||
//
|
||||
// To work around this, completely ignore the device to verify in the thread,
|
||||
// To work around this, completely ignore the device to verify in the thread,
|
||||
// and just use our real device object instead.
|
||||
//
|
||||
|
||||
@ -817,7 +817,7 @@ Return Value:
|
||||
|
||||
return ExceptionCode;
|
||||
|
||||
}
|
||||
}
|
||||
//
|
||||
// Generate a pop-up.
|
||||
//
|
||||
@ -850,10 +850,10 @@ Return Value:
|
||||
}
|
||||
|
||||
//
|
||||
// It turns out some storage drivers really do set invalid non-NULL device
|
||||
// It turns out some storage drivers really do set invalid non-NULL device
|
||||
// objects to verify.
|
||||
//
|
||||
// To work around this, completely ignore the device to verify in the thread,
|
||||
// To work around this, completely ignore the device to verify in the thread,
|
||||
// and just use our real device object instead.
|
||||
//
|
||||
|
||||
@ -909,7 +909,7 @@ Return Value:
|
||||
return ExceptionCode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdCompleteRequest (
|
||||
_Inout_opt_ PIRP_CONTEXT IrpContext,
|
||||
@ -969,14 +969,14 @@ Return Value:
|
||||
Irp->IoStatus.Status = Status;
|
||||
|
||||
AssertVerifyDeviceIrp( Irp );
|
||||
|
||||
|
||||
IoCompleteRequest( Irp, IO_CD_ROM_INCREMENT );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdSetThreadContext (
|
||||
_Inout_ PIRP_CONTEXT IrpContext,
|
||||
@ -1180,7 +1180,7 @@ Return Value:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ULONG
|
||||
CdSerial32 (
|
||||
_In_reads_bytes_(ByteCount) PCHAR Buffer,
|
||||
|
@ -57,7 +57,7 @@ CdInitializeGlobalData (
|
||||
#pragma alloc_text(INIT, CdInitializeGlobalData)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -174,7 +174,7 @@ Return Value:
|
||||
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] =
|
||||
DriverObject->MajorFunction[IRP_MJ_LOCK_CONTROL] =
|
||||
DriverObject->MajorFunction[IRP_MJ_CLEANUP] =
|
||||
DriverObject->MajorFunction[IRP_MJ_PNP] =
|
||||
DriverObject->MajorFunction[IRP_MJ_PNP] =
|
||||
DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = (PDRIVER_DISPATCH) CdFsdDispatch;
|
||||
#ifdef _MSC_VER
|
||||
#pragma prefast(pop)
|
||||
@ -302,7 +302,7 @@ Return Value:
|
||||
ObDereferenceObject (CdData.HddFileSystemDeviceObject);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -364,7 +364,7 @@ Return Value:
|
||||
CdFastIoDispatch.AcquireFileForNtCreateSection = NULL;
|
||||
CdFastIoDispatch.ReleaseFileForNtCreateSection = CdReleaseForCreateSection;
|
||||
CdFastIoDispatch.FastIoQueryNetworkOpenInfo = CdFastQueryNetworkInfo; // QueryNetworkInfo
|
||||
|
||||
|
||||
CdFastIoDispatch.MdlRead = FsRtlMdlReadDev;
|
||||
CdFastIoDispatch.MdlReadComplete = FsRtlMdlReadCompleteDev;
|
||||
CdFastIoDispatch.PrepareMdlWrite = FsRtlPrepareMdlWriteDev;
|
||||
@ -417,7 +417,7 @@ Return Value:
|
||||
|
||||
CdData.CloseItem = IoAllocateWorkItem (FileSystemDeviceObject);
|
||||
if (CdData.CloseItem == NULL) {
|
||||
|
||||
|
||||
ExDeleteResourceLite( &CdData.DataResource );
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ Abstract:
|
||||
DELETE | \
|
||||
WRITE_DAC ))
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Allocation support routines, implemented in AllocSup.c
|
||||
//
|
||||
@ -203,7 +203,7 @@ CdUninitializeMcb (
|
||||
_Inout_updates_bytes_(Fcb->NodeByteSize) PFCB Fcb
|
||||
);
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Buffer control routines for data caching, implemented in CacheSup.c
|
||||
//
|
||||
@ -247,12 +247,12 @@ CdVerifyOrCreateDirStreamFile (
|
||||
//
|
||||
// Unsafe test to see if call / lock neccessary.
|
||||
//
|
||||
|
||||
|
||||
if (NULL == Fcb->FileObject) {
|
||||
|
||||
|
||||
CdCreateInternalStream( IrpContext,
|
||||
Fcb->Vcb,
|
||||
Fcb,
|
||||
Fcb,
|
||||
&Fcb->FileNamePrefix.ExactCaseName.FileName);
|
||||
}
|
||||
}
|
||||
@ -269,7 +269,7 @@ CdVerifyOrCreateDirStreamFile (
|
||||
#define CdUnpinData(IC,B) \
|
||||
if (*(B) != NULL) { CcUnpinData( *(B) ); *(B) = NULL; }
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Device I/O routines, implemented in DevIoSup.c
|
||||
//
|
||||
@ -387,8 +387,8 @@ CdHijackIrpAndFlushDevice (
|
||||
if (NULL == *(UB)) { \
|
||||
CdRaiseStatus( (IC), STATUS_INSUFFICIENT_RESOURCES); \
|
||||
} \
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#define CdLockUserBuffer(IC,BL,OP) { \
|
||||
if ((IC)->Irp->MdlAddress == NULL) { \
|
||||
@ -396,7 +396,7 @@ CdHijackIrpAndFlushDevice (
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Dirent support routines, implemented in DirSup.c
|
||||
//
|
||||
@ -417,7 +417,7 @@ CdLookupNextDirent (
|
||||
_Inout_ PDIRENT_ENUM_CONTEXT NextDirContext
|
||||
);
|
||||
|
||||
_At_(Dirent->CdTime, _Post_notnull_)
|
||||
_At_(Dirent->CdTime, _Post_notnull_)
|
||||
VOID
|
||||
CdUpdateDirentFromRawDirent (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -558,7 +558,7 @@ CdCleanupFileContext (
|
||||
&(FC)->InitialDirent->DirContext, \
|
||||
&(FC)->InitialDirent->Dirent )
|
||||
|
||||
|
||||
|
||||
//
|
||||
// The following routines are used to manipulate the fscontext fields
|
||||
// of the file object, implemented in FilObSup.c
|
||||
@ -609,7 +609,7 @@ CdFastDecodeFileObject (
|
||||
_Out_ PFCB *Fcb
|
||||
);
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Name support routines, implemented in NameSup.c
|
||||
//
|
||||
@ -687,7 +687,7 @@ CdFullCompareNames (
|
||||
_In_ PUNICODE_STRING NameB
|
||||
);
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Filesystem control operations. Implemented in Fsctrl.c
|
||||
//
|
||||
@ -708,7 +708,7 @@ CdUnlockVolumeInternal (
|
||||
_In_opt_ PFILE_OBJECT FileObject
|
||||
);
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Path table enumeration routines. Implemented in PathSup.c
|
||||
//
|
||||
@ -729,7 +729,7 @@ CdLookupNextPathEntry (
|
||||
_Inout_ PPATH_ENTRY PathEntry
|
||||
);
|
||||
|
||||
_Success_(return != FALSE)
|
||||
_Success_(return != FALSE)
|
||||
BOOLEAN
|
||||
CdFindPathEntry (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -773,7 +773,7 @@ CdUpdatePathEntryName (
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Largest matching prefix searching routines, implemented in PrefxSup.c
|
||||
//
|
||||
@ -803,7 +803,7 @@ CdFindPrefix (
|
||||
_In_ BOOLEAN IgnoreCase
|
||||
);
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Synchronization routines. Implemented in Resrcsup.c
|
||||
//
|
||||
@ -825,7 +825,7 @@ CdFindPrefix (
|
||||
//
|
||||
|
||||
typedef enum _TYPE_OF_ACQUIRE {
|
||||
|
||||
|
||||
AcquireExclusive,
|
||||
AcquireShared,
|
||||
AcquireSharedStarveExclusive
|
||||
@ -960,10 +960,10 @@ CdAcquireResource (
|
||||
|
||||
#define CdAcquireCacheForRead( IC) \
|
||||
ExAcquireResourceSharedLite( &(IC)->Vcb->SectorCacheResource, TRUE)
|
||||
|
||||
|
||||
#define CdAcquireCacheForUpdate( IC) \
|
||||
ExAcquireResourceExclusiveLite( &(IC)->Vcb->SectorCacheResource, TRUE)
|
||||
|
||||
|
||||
#define CdReleaseCache( IC) \
|
||||
ExReleaseResourceLite( &(IC)->Vcb->SectorCacheResource);
|
||||
|
||||
@ -1132,7 +1132,7 @@ CdReleaseForCreateSection (
|
||||
_In_ PFILE_OBJECT FileObject
|
||||
);
|
||||
|
||||
|
||||
|
||||
//
|
||||
// In-memory structure support routines. Implemented in StrucSup.c
|
||||
//
|
||||
@ -1394,7 +1394,7 @@ CdOperationIsDasdOpen (
|
||||
)
|
||||
{
|
||||
PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( IrpContext->Irp);
|
||||
|
||||
|
||||
return ((IrpContext->MajorFunction == IRP_MJ_CREATE) &&
|
||||
(IrpSp->FileObject->FileName.Length == 0) &&
|
||||
(IrpSp->FileObject->RelatedFileObject == NULL));
|
||||
@ -1449,7 +1449,7 @@ CdDismountVcb (
|
||||
#define CdUpdateVcbCondition( V, C) (V)->VcbCondition = (C)
|
||||
|
||||
#define CdMarkRealDevForVerify( DO) SetFlag( (DO)->Flags, DO_VERIFY_VOLUME)
|
||||
|
||||
|
||||
#define CdMarkRealDevVerifyOk( DO) ClearFlag( (DO)->Flags, DO_VERIFY_VOLUME)
|
||||
|
||||
|
||||
@ -1468,7 +1468,7 @@ CdDismountVcb (
|
||||
((S) == STATUS_NO_MEDIA_IN_DEVICE) \
|
||||
)
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Work queue routines for posting and retrieving an Irp, implemented in
|
||||
// workque.c
|
||||
@ -1497,7 +1497,7 @@ CdOplockComplete (
|
||||
_Inout_ PIRP Irp
|
||||
);
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Miscellaneous support routines
|
||||
//
|
||||
@ -1604,7 +1604,7 @@ CdOplockComplete (
|
||||
static /* ReactOS Change: GCC "multiple definition" */
|
||||
INLINE
|
||||
ULONG
|
||||
SectorsFromLlBytes(
|
||||
SectorsFromLlBytes(
|
||||
ULONGLONG Bytes
|
||||
) {
|
||||
|
||||
@ -2025,7 +2025,7 @@ CdSerial32 (
|
||||
FastIoIsPossible)) \
|
||||
)
|
||||
|
||||
|
||||
|
||||
//
|
||||
// The FSP level dispatch/main routine. This is the routine that takes
|
||||
// IRP's off of the work queue and calls the appropriate FSP level
|
||||
@ -2146,7 +2146,7 @@ CdCommonShutdown ( // Implemented in Shutdown.c
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// The following macros are used to establish the semantics needed
|
||||
// to do a return from within a try-finally clause. As a rule every
|
||||
|
@ -69,7 +69,7 @@ Abstract:
|
||||
+--------+ | Child |
|
||||
| File |
|
||||
+--------+
|
||||
|
||||
|
||||
Attached to each Directory Fcb is a prefix table containing the names
|
||||
of children of this directory for which there is an Fcb. Not all Fcb's
|
||||
will necessarily have an entry in this table.
|
||||
@ -112,7 +112,7 @@ Abstract:
|
||||
| Object|
|
||||
+--------+
|
||||
|
||||
|
||||
|
||||
Synchronization:
|
||||
|
||||
1. A resource in the CdData synchronizes access to the Vcb queue. This
|
||||
@ -170,7 +170,7 @@ typedef PVOID PBCB; //**** Bcb's are now part of the cache module
|
||||
|
||||
#define BYTE_COUNT_EMBEDDED_NAME (32)
|
||||
|
||||
|
||||
|
||||
//
|
||||
// The CD_MCB is used to store the mapping of logical file offset to
|
||||
// logical disk offset. NOTE - This package only deals with the
|
||||
@ -226,7 +226,7 @@ typedef struct _CD_MCB_ENTRY {
|
||||
} CD_MCB_ENTRY;
|
||||
typedef CD_MCB_ENTRY *PCD_MCB_ENTRY;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Cd name structure. The following structure is used to represent the
|
||||
// full Cdrom name. This name can be stored in either Unicode or ANSI
|
||||
@ -265,7 +265,7 @@ typedef struct _NAME_LINK {
|
||||
} NAME_LINK;
|
||||
typedef NAME_LINK *PNAME_LINK;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Prefix entry. There is one of these for each name in the prefix table.
|
||||
// An Fcb will have one of these embedded for the long name and an optional
|
||||
@ -306,7 +306,7 @@ typedef PREFIX_ENTRY *PPREFIX_ENTRY;
|
||||
#define PREFIX_FLAG_EXACT_CASE_IN_TREE (0x00000001)
|
||||
#define PREFIX_FLAG_IGNORE_CASE_IN_TREE (0x00000002)
|
||||
|
||||
|
||||
|
||||
//
|
||||
// The CD_DATA record is the top record in the CDROM file system in-memory
|
||||
// data structure. This structure must be allocated from non-paged pool.
|
||||
@ -426,7 +426,7 @@ typedef CD_DATA *PCD_DATA;
|
||||
// Since DVD drives allow > 100 "sessions", we need to use a larger TOC
|
||||
// than the legacy CD definition. The maximum is theoretically 0xaa-16 (max
|
||||
// number of open tracks in a session), but it's quite possible that some
|
||||
// drive does not enforce this, so we'll go with 169 (track 0xaa is always the
|
||||
// drive does not enforce this, so we'll go with 169 (track 0xaa is always the
|
||||
// leadout).
|
||||
//
|
||||
|
||||
@ -447,14 +447,14 @@ typedef struct _CDROM_TOC_LARGE {
|
||||
//
|
||||
|
||||
TRACK_DATA TrackData[ MAXIMUM_NUMBER_TRACKS_LARGE];
|
||||
|
||||
|
||||
} CDROM_TOC_LARGE, *PCDROM_TOC_LARGE;
|
||||
|
||||
typedef struct _CD_SECTOR_CACHE_CHUNK {
|
||||
|
||||
ULONG BaseLbn;
|
||||
PUCHAR Buffer;
|
||||
|
||||
|
||||
} CD_SECTOR_CACHE_CHUNK, *PCD_SECTOR_CACHE_CHUNK;
|
||||
|
||||
#define CD_SEC_CACHE_CHUNKS 4
|
||||
@ -670,7 +670,7 @@ typedef struct _VCB {
|
||||
// Directory block cache. Read large numbers of blocks on directory
|
||||
// reads, hoping to benefit from the fact that most mastered/pressed
|
||||
// discs clump metadata in one place thus allowing us to crudely
|
||||
// pre-cache and reduce seeks back to directory data during app install,
|
||||
// pre-cache and reduce seeks back to directory data during app install,
|
||||
// file copy etc.
|
||||
//
|
||||
// Note that the purpose of this is to PRE cache unread data,
|
||||
@ -681,7 +681,7 @@ typedef struct _VCB {
|
||||
PUCHAR SectorCacheBuffer;
|
||||
CD_SECTOR_CACHE_CHUNK SecCacheChunks[ CD_SEC_CACHE_CHUNKS];
|
||||
ULONG SecCacheLRUChunkIndex;
|
||||
|
||||
|
||||
PIRP SectorCacheIrp;
|
||||
KEVENT SectorCacheEvent;
|
||||
ERESOURCE SectorCacheResource;
|
||||
@ -715,7 +715,7 @@ typedef struct _VCB {
|
||||
#define VCB_STATE_SHUTDOWN (0x00000400)
|
||||
#define VCB_STATE_DISMOUNTED (0x00000800)
|
||||
|
||||
|
||||
|
||||
//
|
||||
// The Volume Device Object is an I/O system device object with a
|
||||
// workqueue and an VCB record appended to the end. There are multiple
|
||||
@ -768,7 +768,7 @@ typedef struct _VOLUME_DEVICE_OBJECT {
|
||||
} VOLUME_DEVICE_OBJECT;
|
||||
typedef VOLUME_DEVICE_OBJECT *PVOLUME_DEVICE_OBJECT;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// The following two structures are the separate union structures for
|
||||
// data and index Fcb's. The path table is actually the same structure
|
||||
@ -1059,7 +1059,7 @@ typedef FCB *PFCB;
|
||||
#define SIZEOF_FCB_INDEX \
|
||||
(FIELD_OFFSET( FCB, FcbType ) + sizeof( FCB_INDEX ))
|
||||
|
||||
|
||||
|
||||
//
|
||||
// The Ccb record is allocated for every file object
|
||||
//
|
||||
@ -1119,7 +1119,7 @@ typedef CCB *PCCB;
|
||||
#define CCB_FLAG_ENUM_INITIALIZED (0x00200000)
|
||||
#define CCB_FLAG_ENUM_NOMATCH_CONSTANT_ENTRY (0x00400000)
|
||||
|
||||
|
||||
|
||||
//
|
||||
// The Irp Context record is allocated for every orginating Irp. It is
|
||||
// created by the Fsd dispatch routines, and deallocated by the CdComplete
|
||||
@ -1265,7 +1265,7 @@ typedef IRP_CONTEXT *PIRP_CONTEXT;
|
||||
IRP_CONTEXT_FLAG_IN_FSP \
|
||||
)
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Following structure is used to queue a request to the delayed close queue.
|
||||
// This structure should be the minimum block allocation size.
|
||||
@ -1307,7 +1307,7 @@ typedef struct _IRP_CONTEXT_LITE {
|
||||
} IRP_CONTEXT_LITE;
|
||||
typedef IRP_CONTEXT_LITE *PIRP_CONTEXT_LITE;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Context structure for asynchronous I/O calls. Most of these fields
|
||||
// are actually only required for the ReadMultiple routines, but
|
||||
@ -1350,7 +1350,7 @@ typedef struct _CD_IO_CONTEXT {
|
||||
} CD_IO_CONTEXT;
|
||||
typedef CD_IO_CONTEXT *PCD_IO_CONTEXT;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Following structure is used to track the top level request. Each Cdfs
|
||||
// Fsd and Fsp entry point will examine the top level irp location in the
|
||||
@ -1385,7 +1385,7 @@ typedef struct _THREAD_CONTEXT {
|
||||
} THREAD_CONTEXT;
|
||||
typedef THREAD_CONTEXT *PTHREAD_CONTEXT;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// The following structure is used for enumerating the entries in the
|
||||
// path table. We will always map this two sectors at a time so we don't
|
||||
@ -1452,7 +1452,7 @@ typedef PATH_ENUM_CONTEXT *PPATH_ENUM_CONTEXT;
|
||||
#define VACB_MAPPING_MASK (VACB_MAPPING_GRANULARITY - 1)
|
||||
#define LAST_VACB_SECTOR_OFFSET (VACB_MAPPING_GRANULARITY - SECTOR_SIZE)
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Path Entry. This is our representation of the on disk data.
|
||||
//
|
||||
@ -1516,7 +1516,7 @@ typedef PATH_ENTRY *PPATH_ENTRY;
|
||||
|
||||
#define PATH_ENTRY_FLAG_ALLOC_BUFFER (0x00000001)
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Compound path entry. This structure combines the on-disk entries
|
||||
// with the in-memory structures.
|
||||
@ -1530,7 +1530,7 @@ typedef struct _COMPOUND_PATH_ENTRY {
|
||||
} COMPOUND_PATH_ENTRY;
|
||||
typedef COMPOUND_PATH_ENTRY *PCOMPOUND_PATH_ENTRY;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// The following is used for enumerating through a directory via the
|
||||
// dirents.
|
||||
@ -1568,7 +1568,7 @@ typedef struct _DIRENT_ENUM_CONTEXT {
|
||||
} DIRENT_ENUM_CONTEXT;
|
||||
typedef DIRENT_ENUM_CONTEXT *PDIRENT_ENUM_CONTEXT;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Following structure is used to smooth out the differences in the HSG, ISO
|
||||
// and Joliett directory entries.
|
||||
@ -1672,7 +1672,7 @@ typedef DIRENT *PDIRENT;
|
||||
|
||||
#define DIRENT_FLAG_NOT_PERSISTENT (0)
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Following structure combines the on-disk information with the normalized
|
||||
// structure.
|
||||
@ -1686,7 +1686,7 @@ typedef struct _COMPOUND_DIRENT {
|
||||
} COMPOUND_DIRENT;
|
||||
typedef COMPOUND_DIRENT *PCOMPOUND_DIRENT;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// The following structure is used to enumerate the files in a directory.
|
||||
// It contains three DirContext/Dirent pairs and then self pointers to
|
||||
@ -1738,7 +1738,7 @@ typedef FILE_ENUM_CONTEXT *PFILE_ENUM_CONTEXT;
|
||||
|
||||
#define FILE_CONTEXT_MULTIPLE_DIRENTS (0x00000001)
|
||||
|
||||
|
||||
|
||||
//
|
||||
// RIFF header. Prepended to the data of a file containing XA sectors.
|
||||
// This is a hard-coded structure except that we bias the 'ChunkSize' and
|
||||
@ -1787,7 +1787,7 @@ typedef struct _AUDIO_PLAY_HEADER {
|
||||
} AUDIO_PLAY_HEADER;
|
||||
typedef AUDIO_PLAY_HEADER *PAUDIO_PLAY_HEADER;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Some macros for supporting the use of a Generic Table
|
||||
// containing all the FCB/DCBs and indexed by their FileId.
|
||||
|
@ -132,9 +132,9 @@ Return Value:
|
||||
//
|
||||
|
||||
Vcb = Fcb->Vcb;
|
||||
|
||||
|
||||
//
|
||||
// Synchronise with reads while we set the cleanup complete
|
||||
// Synchronise with reads while we set the cleanup complete
|
||||
// flag on this fileobject. Once this flag is set, any further
|
||||
// reads will be rejected (CdVerifyFcbOperation)
|
||||
//
|
||||
@ -152,30 +152,30 @@ Return Value:
|
||||
if (TypeOfOpen == UserVolumeOpen) {
|
||||
|
||||
//
|
||||
// For a force dismount, physically disconnect this Vcb from the device so
|
||||
// a new mount can occur. Vcb deletion cannot happen at this time since
|
||||
// there is a reference on it associated with this very request, but we'll
|
||||
// For a force dismount, physically disconnect this Vcb from the device so
|
||||
// a new mount can occur. Vcb deletion cannot happen at this time since
|
||||
// there is a reference on it associated with this very request, but we'll
|
||||
// call check for dismount again later after we process this close.
|
||||
//
|
||||
|
||||
|
||||
if (FlagOn( Ccb->Flags, CCB_FLAG_DISMOUNT_ON_CLOSE )) {
|
||||
|
||||
|
||||
CdAcquireCdData( IrpContext );
|
||||
|
||||
|
||||
CdCheckForDismount( IrpContext, Vcb, TRUE );
|
||||
|
||||
|
||||
CdReleaseCdData( IrpContext );
|
||||
|
||||
|
||||
//
|
||||
// If this handle actually wrote something, flush the device buffers,
|
||||
// and then set the verify bit now just to be safe (in case there is no
|
||||
// dismount).
|
||||
//
|
||||
|
||||
|
||||
} else if (FlagOn( FileObject->Flags, FO_FILE_MODIFIED )) {
|
||||
|
||||
|
||||
CdHijackIrpAndFlushDevice( IrpContext, Irp, Vcb->TargetDeviceObject );
|
||||
|
||||
|
||||
CdMarkDevForVerifyIfVcbMounted( Vcb );
|
||||
}
|
||||
}
|
||||
@ -185,13 +185,13 @@ Return Value:
|
||||
//
|
||||
|
||||
CdAcquireFcbExclusive( IrpContext, Fcb, FALSE );
|
||||
|
||||
|
||||
//
|
||||
// Use a try-finally to facilitate cleanup.
|
||||
//
|
||||
|
||||
_SEH2_TRY {
|
||||
|
||||
|
||||
//
|
||||
// Case on the type of open that we are trying to cleanup.
|
||||
//
|
||||
@ -259,7 +259,7 @@ Return Value:
|
||||
default :
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma prefast( suppress:__WARNING_USE_OTHER_FUNCTION, "argument bogus" )
|
||||
#pragma prefast( suppress:__WARNING_USE_OTHER_FUNCTION, "argument bogus" )
|
||||
#endif
|
||||
CdBugCheck( TypeOfOpen, 0, 0 );
|
||||
}
|
||||
@ -293,14 +293,14 @@ Return Value:
|
||||
|
||||
NT_ASSERT( FlagOn( Vcb->VcbState, VCB_STATE_LOCKED));
|
||||
|
||||
IoAcquireVpbSpinLock( &SavedIrql );
|
||||
IoAcquireVpbSpinLock( &SavedIrql );
|
||||
|
||||
ClearFlag( Vcb->Vpb->Flags, VPB_LOCKED);
|
||||
ClearFlag( Vcb->VcbState, VCB_STATE_LOCKED );
|
||||
Vcb->VolumeLockFileObject = NULL;
|
||||
SendUnlockNotification = TRUE;
|
||||
|
||||
IoReleaseVpbSpinLock( SavedIrql );
|
||||
IoReleaseVpbSpinLock( SavedIrql );
|
||||
}
|
||||
|
||||
CdUnlockVcb( IrpContext, Vcb );
|
||||
@ -316,9 +316,9 @@ Return Value:
|
||||
} _SEH2_FINALLY {
|
||||
|
||||
CdReleaseFcb( IrpContext, Fcb );
|
||||
|
||||
|
||||
if (SendUnlockNotification) {
|
||||
|
||||
|
||||
FsRtlNotifyVolumeEvent( FileObject, FSRTL_VOLUME_UNLOCK );
|
||||
}
|
||||
} _SEH2_END;
|
||||
@ -328,7 +328,7 @@ Return Value:
|
||||
// this very fileobject we were cleaning up be the last reason for the
|
||||
// volume to remain, teardown will commence on completion of this Irp.
|
||||
//
|
||||
|
||||
|
||||
if (AttemptTeardown) {
|
||||
|
||||
//
|
||||
@ -336,20 +336,20 @@ Return Value:
|
||||
// may acquire CdData if there is a possibility of tearing the volume
|
||||
// down.
|
||||
//
|
||||
|
||||
|
||||
CdAcquireCdData( IrpContext);
|
||||
|
||||
_SEH2_TRY {
|
||||
|
||||
|
||||
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
|
||||
VcbAcquired = TRUE;
|
||||
|
||||
|
||||
CdPurgeVolume( IrpContext, Vcb, FALSE );
|
||||
|
||||
} _SEH2_FINALLY {
|
||||
|
||||
if (VcbAcquired) { CdReleaseVcb( IrpContext, Vcb ); }
|
||||
|
||||
|
||||
CdReleaseCdData( IrpContext);
|
||||
} _SEH2_END;
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ Return Value:
|
||||
// to do here is prevent this routine starving other threads which
|
||||
// may need this Vcb exclusively.
|
||||
//
|
||||
// Note that the check for potential teardown below is unsafe. We'll
|
||||
// Note that the check for potential teardown below is unsafe. We'll
|
||||
// repeat later within the cddata lock.
|
||||
//
|
||||
|
||||
@ -260,7 +260,7 @@ Return Value:
|
||||
(Fcb->Vcb->VcbCondition != VcbMounted) &&
|
||||
(Fcb->Vcb->VcbCondition != VcbMountInProgress) &&
|
||||
(Fcb->Vcb->VcbCleanup == 0);
|
||||
|
||||
|
||||
if (!PotentialVcbTeardown) {
|
||||
|
||||
CdReleaseCdData( IrpContext);
|
||||
@ -270,7 +270,7 @@ Return Value:
|
||||
CurrentVcb = Fcb->Vcb;
|
||||
|
||||
_Analysis_assume_( CurrentVcb != NULL );
|
||||
|
||||
|
||||
CdAcquireVcbShared( IrpContext, CurrentVcb, FALSE );
|
||||
|
||||
VcbHoldCount = 0;
|
||||
@ -404,7 +404,7 @@ Return Value:
|
||||
//
|
||||
// Clean up any CCB associated with this open.
|
||||
//
|
||||
|
||||
|
||||
if (Ccb != NULL) {
|
||||
|
||||
UserReference = 1;
|
||||
@ -417,7 +417,7 @@ Return Value:
|
||||
}
|
||||
|
||||
//
|
||||
// If this is the last reference to a user file or directory on a
|
||||
// If this is the last reference to a user file or directory on a
|
||||
// currently mounted volume, then post it to the delayed close queue. Note
|
||||
// that the VcbCondition check is unsafe, but it doesn't really matter -
|
||||
// we just might delay the volume teardown a little by posting this close.
|
||||
@ -436,7 +436,7 @@ Return Value:
|
||||
// if we can't acquire all of the resources.
|
||||
//
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
//
|
||||
@ -449,7 +449,7 @@ Return Value:
|
||||
// a number of other Fcbs (and thus their references), a simple check
|
||||
// on reference count is not appropriate.
|
||||
//
|
||||
// Do an unsafe check first to avoid taking the (global) cddata lock in the
|
||||
// Do an unsafe check first to avoid taking the (global) cddata lock in the
|
||||
// common case.
|
||||
//
|
||||
|
||||
@ -487,7 +487,7 @@ Return Value:
|
||||
CdReleaseCdData( IrpContext );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Call the worker routine to perform the actual work. This routine
|
||||
// should never raise except for a fatal error.
|
||||
@ -507,7 +507,7 @@ Return Value:
|
||||
// the request.
|
||||
//
|
||||
|
||||
}
|
||||
}
|
||||
else if (PotentialVcbTeardown) {
|
||||
|
||||
CdCheckForDismount( IrpContext, Vcb, FALSE );
|
||||
@ -532,7 +532,7 @@ Return Value:
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -685,7 +685,7 @@ Return Value:
|
||||
CdFspClose (NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdQueueClose (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -868,7 +868,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
|
@ -116,7 +116,7 @@ CdCompleteFcbOpen (
|
||||
#pragma alloc_text(PAGE, CdOpenFileFromFileContext)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
NTSTATUS
|
||||
#ifdef _MSC_VER
|
||||
@ -1018,7 +1018,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -1106,7 +1106,7 @@ Return Value:
|
||||
// This is here because the Win32 layer can't avoid sending me double
|
||||
// beginning backslashes.
|
||||
//
|
||||
|
||||
|
||||
if ((FileName->Length > sizeof( WCHAR )) &&
|
||||
(FileName->Buffer[1] == L'\\') &&
|
||||
(FileName->Buffer[0] == L'\\')) {
|
||||
@ -1246,12 +1246,12 @@ Return Value:
|
||||
//
|
||||
// Check for an overflow of the maximum filename size.
|
||||
//
|
||||
|
||||
|
||||
if (BufferLength > MAXUSHORT) {
|
||||
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Now see if we need to allocate a new buffer.
|
||||
//
|
||||
@ -1469,7 +1469,7 @@ Return Value:
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -1973,7 +1973,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -2075,7 +2075,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -2257,7 +2257,7 @@ Return Value:
|
||||
|
||||
ParentFcb = *CurrentFcb;
|
||||
*CurrentFcb = NextFcb;
|
||||
|
||||
|
||||
// Lock object is acquired using internal state
|
||||
_Analysis_suppress_lock_checking_(NextFcb->FcbNonpaged->FcbResource);
|
||||
|
||||
@ -2358,7 +2358,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -2648,7 +2648,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -2714,12 +2714,12 @@ Return Value:
|
||||
//
|
||||
|
||||
if (MAXIMUM_ALLOWED == DesiredAccess) {
|
||||
|
||||
|
||||
DesiredAccess = FILE_ALL_ACCESS & ~((TypeOfOpen != UserVolumeOpen ?
|
||||
(FILE_WRITE_ATTRIBUTES |
|
||||
FILE_WRITE_DATA |
|
||||
FILE_WRITE_EA |
|
||||
FILE_ADD_FILE |
|
||||
FILE_ADD_FILE |
|
||||
FILE_ADD_SUBDIRECTORY |
|
||||
FILE_APPEND_DATA) : 0) |
|
||||
FILE_DELETE_CHILD |
|
||||
@ -2778,7 +2778,7 @@ Return Value:
|
||||
return STATUS_SHARING_VIOLATION;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// If the Fcb already existed then we need to check the oplocks and
|
||||
// the share access.
|
||||
|
@ -41,7 +41,7 @@ CdDevCtrlCompletionRoutine (
|
||||
#pragma alloc_text(PAGE, CdCommonDevControl)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
NTSTATUS
|
||||
CdCommonDevControl (
|
||||
_Inout_ PIRP_CONTEXT IrpContext,
|
||||
@ -167,7 +167,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
|
@ -237,17 +237,17 @@ Routine Description:
|
||||
Arguments:
|
||||
|
||||
Msf - on output, set to 0xMmSsFf representation of blocks.
|
||||
|
||||
|
||||
--*/
|
||||
|
||||
{
|
||||
PAGED_CODE();
|
||||
|
||||
Blocks += 150; // Lbn 0 == 00:02:00, 1sec == 75 frames.
|
||||
|
||||
|
||||
Msf[0] = (UCHAR)(Blocks % 75); // Frames
|
||||
Blocks /= 75; // -> Seconds
|
||||
Msf[1] = (UCHAR)(Blocks % 60); // Seconds
|
||||
Msf[1] = (UCHAR)(Blocks % 60); // Seconds
|
||||
Blocks /= 60; // -> Minutes
|
||||
Msf[2] = (UCHAR)Blocks; // Minutes
|
||||
}
|
||||
@ -289,16 +289,16 @@ Return Value:
|
||||
return CDDA;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// FCB_STATE_MODE2_FILE
|
||||
//
|
||||
|
||||
|
||||
return YellowMode2;
|
||||
}
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
NTSTATUS
|
||||
CdNonCachedRead (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -388,7 +388,7 @@ Return Value:
|
||||
// If we're going to use the sector cache for this request, then
|
||||
// mark the request waitable.
|
||||
//
|
||||
|
||||
|
||||
if ((SafeNodeType( Fcb) == CDFS_NTC_FCB_INDEX) &&
|
||||
(NULL != Fcb->Vcb->SectorCacheBuffer) &&
|
||||
(VcbMounted == IrpContext->Vcb->VcbCondition)) {
|
||||
@ -418,7 +418,7 @@ Return Value:
|
||||
//
|
||||
// Call prepare buffers to set up the next entries
|
||||
// in the IoRuns array. Remember if there are any
|
||||
// unaligned entries. This routine will raise CANT_WAIT
|
||||
// unaligned entries. This routine will raise CANT_WAIT
|
||||
// if there are unaligned entries for an async request.
|
||||
//
|
||||
|
||||
@ -529,7 +529,7 @@ Return Value:
|
||||
|
||||
FlushIoBuffers = TRUE;
|
||||
}
|
||||
|
||||
|
||||
CleanupRunCount = 0;
|
||||
|
||||
//
|
||||
@ -583,9 +583,9 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
NTSTATUS
|
||||
CdNonCachedXARead (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -726,14 +726,14 @@ Return Value:
|
||||
//
|
||||
// Note: LBN 0 == 0:2:0 (MSF)
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
// Fill in the address (both MSF and Lbn format) and length fields.
|
||||
//
|
||||
|
||||
|
||||
SwapCopyUchar4( &Address, TrackData->Address);
|
||||
CdLbnToMmSsFf( Address, AudioPlayHeader->TrackAddress);
|
||||
|
||||
|
||||
SwapCopyUchar4( &AudioPlayHeader->StartingSector, TrackData->Address);
|
||||
|
||||
//
|
||||
@ -809,9 +809,9 @@ Return Value:
|
||||
//
|
||||
// CD-XA non-audio
|
||||
//
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
NT_ASSERT( FlagOn( Fcb->FcbState, FCB_STATE_MODE2_FILE | FCB_STATE_MODE2FORM2_FILE ));
|
||||
|
||||
RiffHeader = &LocalRiffHeader;
|
||||
@ -869,7 +869,7 @@ Return Value:
|
||||
//
|
||||
|
||||
if (!TryingYellowbookMode2) {
|
||||
|
||||
|
||||
RtlZeroMemory( IoRuns, sizeof( IoRuns ));
|
||||
RtlZeroMemory( RawReads, sizeof( RawReads ));
|
||||
|
||||
@ -884,7 +884,7 @@ Return Value:
|
||||
&CleanupRunCount,
|
||||
&ThisByteCount );
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Perform multiple Io to read in the data. Note that
|
||||
// there may be no Io to do if we were able to use an
|
||||
@ -914,7 +914,7 @@ Return Value:
|
||||
|
||||
if (!NT_SUCCESS( Status )) {
|
||||
|
||||
if (!TryingYellowbookMode2 &&
|
||||
if (!TryingYellowbookMode2 &&
|
||||
FlagOn( Fcb->FcbState, FCB_STATE_MODE2FORM2_FILE )) {
|
||||
|
||||
//
|
||||
@ -926,11 +926,11 @@ Return Value:
|
||||
|
||||
TryingYellowbookMode2 = TRUE;
|
||||
TrackMode = YellowMode2;
|
||||
|
||||
|
||||
//
|
||||
// Clear our 'cumulative' error status value
|
||||
//
|
||||
|
||||
|
||||
IrpContext->IoContext->Status = STATUS_SUCCESS;
|
||||
|
||||
continue;
|
||||
@ -938,9 +938,9 @@ Return Value:
|
||||
|
||||
try_return( NOTHING );
|
||||
}
|
||||
|
||||
|
||||
CleanupRunCount = 0;
|
||||
|
||||
|
||||
if (TryingYellowbookMode2) {
|
||||
|
||||
//
|
||||
@ -1008,7 +1008,7 @@ CdVolumeDasdWrite (
|
||||
Routine Description:
|
||||
|
||||
This routine performs the non-cached writes to 'cooked' sectors (2048 bytes
|
||||
per sector). This is done by filling the IoRun for the desired request
|
||||
per sector). This is done by filling the IoRun for the desired request
|
||||
and send it down to the device.
|
||||
|
||||
Arguments:
|
||||
@ -1075,7 +1075,7 @@ Return Value:
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
BOOLEAN
|
||||
CdReadSectors (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -1216,7 +1216,7 @@ Return Value:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
NTSTATUS
|
||||
CdCreateUserMdl (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -1324,7 +1324,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NTSTATUS
|
||||
CdPerformDevIoCtrlEx (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -1456,20 +1456,20 @@ CdPerformDevIoCtrl (
|
||||
{
|
||||
PAGED_CODE();
|
||||
|
||||
return CdPerformDevIoCtrlEx( IrpContext,
|
||||
IoControlCode,
|
||||
Device,
|
||||
NULL,
|
||||
0,
|
||||
OutputBuffer,
|
||||
OutputBufferLength,
|
||||
return CdPerformDevIoCtrlEx( IrpContext,
|
||||
IoControlCode,
|
||||
Device,
|
||||
NULL,
|
||||
0,
|
||||
OutputBuffer,
|
||||
OutputBufferLength,
|
||||
InternalDeviceIoControl,
|
||||
OverrideVerify,
|
||||
Iosb);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -1628,7 +1628,7 @@ Return Value:
|
||||
(CurrentByteCount < SECTOR_SIZE))) {
|
||||
|
||||
NT_ASSERT( SafeNodeType(Fcb) != CDFS_NTC_FCB_INDEX);
|
||||
|
||||
|
||||
//
|
||||
// If we can't wait then raise.
|
||||
//
|
||||
@ -1769,7 +1769,7 @@ Return Value:
|
||||
return FoundUnaligned;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -1893,7 +1893,7 @@ Return Value:
|
||||
CurrentRawOffset = (LONGLONG) ((ULONG) CurrentRawOffset / RAW_SECTOR_SIZE);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma prefast( suppress: __WARNING_RESULTOFSHIFTCASTTOLARGERSIZE, "This is fine beacuse raw sector size > sector shift" )
|
||||
#pragma prefast( suppress: __WARNING_RESULTOFSHIFTCASTTOLARGERSIZE, "This is fine beacuse raw sector size > sector shift" )
|
||||
#endif
|
||||
CurrentCookedOffset = (LONGLONG) ((ULONG) CurrentRawOffset << SECTOR_SHIFT );
|
||||
|
||||
@ -1940,7 +1940,7 @@ Return Value:
|
||||
*RunCount += 1;
|
||||
|
||||
//
|
||||
// Initialize the current position in the IoRuns array. Find the
|
||||
// Initialize the current position in the IoRuns array. Find the
|
||||
// eventual destination in the user's buffer for this portion of the transfer.
|
||||
//
|
||||
|
||||
@ -2050,7 +2050,7 @@ Return Value:
|
||||
// following are true:
|
||||
//
|
||||
// If we are to store the beginning of the raw sector in the user's buffer.
|
||||
// The current scratch buffer precedes the destination in the user's buffer
|
||||
// The current scratch buffer precedes the destination in the user's buffer
|
||||
// (and hence also lies within it)
|
||||
// There are enough bytes remaining in the buffer for at least one
|
||||
// raw sector.
|
||||
@ -2068,7 +2068,7 @@ Return Value:
|
||||
if (CurrentCookedByteCount <= Fcb->Vcb->MaximumTransferRawSectors * SECTOR_SIZE) {
|
||||
|
||||
CurrentRawByteCount = (SectorAlign( CurrentCookedByteCount) >> SECTOR_SHIFT) * RAW_SECTOR_SIZE;
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
CurrentCookedByteCount = Fcb->Vcb->MaximumTransferRawSectors * SECTOR_SIZE;
|
||||
@ -2079,7 +2079,7 @@ Return Value:
|
||||
// Now make sure we are within the page transfer limit.
|
||||
//
|
||||
|
||||
while (ADDRESS_AND_SIZE_TO_SPAN_PAGES(CurrentUserBuffer, RawSectorAlign( CurrentRawByteCount)) >
|
||||
while (ADDRESS_AND_SIZE_TO_SPAN_PAGES(CurrentUserBuffer, RawSectorAlign( CurrentRawByteCount)) >
|
||||
Fcb->Vcb->MaximumPhysicalPages ) {
|
||||
|
||||
CurrentRawByteCount -= RAW_SECTOR_SIZE;
|
||||
@ -2105,7 +2105,7 @@ Return Value:
|
||||
|
||||
CurrentRawByteCount = RemainingRawByteCount;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Update the IO run array. We point to the scratch buffer as
|
||||
// well as the buffer and Mdl in the original Irp.
|
||||
@ -2119,7 +2119,7 @@ Return Value:
|
||||
|
||||
ThisIoRun->TransferBuffer = CurrentUserBuffer;
|
||||
ThisIoRun->TransferMdl = Irp->MdlAddress;
|
||||
ThisIoRun->TransferVirtualAddress = Add2Ptr( Irp->UserBuffer,
|
||||
ThisIoRun->TransferVirtualAddress = Add2Ptr( Irp->UserBuffer,
|
||||
CurrentUserBufferOffset,
|
||||
PVOID);
|
||||
|
||||
@ -2210,7 +2210,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -2423,7 +2423,7 @@ Return Value:
|
||||
//
|
||||
// We don't want IO to get our IRP and free it.
|
||||
//
|
||||
|
||||
|
||||
return STATUS_MORE_PROCESSING_REQUIRED;
|
||||
}
|
||||
|
||||
@ -2452,7 +2452,7 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
if (NULL != IrpContext->Vcb->SectorCacheBuffer) {
|
||||
|
||||
|
||||
CdAcquireCacheForUpdate( IrpContext);
|
||||
CdFreePool( &IrpContext->Vcb->SectorCacheBuffer);
|
||||
CdReleaseCache( IrpContext);
|
||||
@ -2465,7 +2465,7 @@ CdReadDirDataThroughCache (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
_In_ PIO_RUN Run
|
||||
)
|
||||
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
@ -2520,18 +2520,18 @@ Return Value:
|
||||
CdAcquireCacheForRead( IrpContext);
|
||||
|
||||
_SEH2_TRY {
|
||||
|
||||
|
||||
//
|
||||
// Check the cache hasn't gone away due to volume verify failure (which
|
||||
// is the *only* reason it'll go away). If this is the case we raise
|
||||
// is the *only* reason it'll go away). If this is the case we raise
|
||||
// the same error any I/O would return if the cache weren't here.
|
||||
//
|
||||
|
||||
|
||||
if (NULL == Vcb->SectorCacheBuffer) {
|
||||
|
||||
|
||||
CdRaiseStatus( IrpContext, STATUS_VERIFY_REQUIRED);
|
||||
}
|
||||
|
||||
|
||||
while (Remaining) {
|
||||
|
||||
Buffer = NULL;
|
||||
@ -2539,7 +2539,7 @@ Return Value:
|
||||
//
|
||||
// Look to see if any portion is currently cached.
|
||||
//
|
||||
|
||||
|
||||
for (Index = 0; Index < CD_SEC_CACHE_CHUNKS; Index++) {
|
||||
|
||||
if ((Vcb->SecCacheChunks[ Index].BaseLbn != -1) &&
|
||||
@ -2560,8 +2560,8 @@ Return Value:
|
||||
BufferSectorOffset = Lbn - Buffer->BaseLbn;
|
||||
Found = Min( CD_SEC_CHUNK_BLOCKS - BufferSectorOffset, Remaining);
|
||||
|
||||
RtlCopyMemory( UserBuffer,
|
||||
Buffer->Buffer + BytesFromSectors( BufferSectorOffset),
|
||||
RtlCopyMemory( UserBuffer,
|
||||
Buffer->Buffer + BytesFromSectors( BufferSectorOffset),
|
||||
BytesFromSectors( Found));
|
||||
|
||||
Remaining -= Found;
|
||||
@ -2571,14 +2571,14 @@ Return Value:
|
||||
//
|
||||
// Update stats. Don't count a hit if we've just read the data in.
|
||||
//
|
||||
|
||||
|
||||
if (!JustRead) {
|
||||
|
||||
|
||||
InterlockedIncrement( (LONG*)&Vcb->SecCacheHits);
|
||||
}
|
||||
|
||||
|
||||
JustRead = FALSE;
|
||||
#endif
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -2589,18 +2589,18 @@ Return Value:
|
||||
|
||||
CdReleaseCache( IrpContext);
|
||||
CdAcquireCacheForUpdate( IrpContext);
|
||||
#if DBG
|
||||
#if DBG
|
||||
Vcb->SecCacheMisses += 1;
|
||||
#endif
|
||||
//
|
||||
// Select the chunk to replace and calculate the start block of the
|
||||
// chunk to cache. We cache blocks which start on Lbns aligned on
|
||||
// Select the chunk to replace and calculate the start block of the
|
||||
// chunk to cache. We cache blocks which start on Lbns aligned on
|
||||
// multiples of chunk size, treating block 16 (VRS start) as block
|
||||
// zero.
|
||||
//
|
||||
|
||||
Buffer = &Vcb->SecCacheChunks[ Vcb->SecCacheLRUChunkIndex];
|
||||
|
||||
|
||||
StartBlock = Lbn - ((Lbn - 16) % CD_SEC_CHUNK_BLOCKS);
|
||||
|
||||
//
|
||||
@ -2635,58 +2635,58 @@ Return Value:
|
||||
//
|
||||
// Now build / send the read request.
|
||||
//
|
||||
|
||||
|
||||
IoReuseIrp( Vcb->SectorCacheIrp, STATUS_SUCCESS);
|
||||
|
||||
KeClearEvent( &Vcb->SectorCacheEvent);
|
||||
Vcb->SectorCacheIrp->Tail.Overlay.Thread = PsGetCurrentThread();
|
||||
|
||||
|
||||
//
|
||||
// Get a pointer to the stack location of the first driver which will be
|
||||
// invoked. This is where the function codes and the parameters are set.
|
||||
//
|
||||
|
||||
|
||||
IrpSp = IoGetNextIrpStackLocation( Vcb->SectorCacheIrp);
|
||||
IrpSp->MajorFunction = (UCHAR) IRP_MJ_READ;
|
||||
|
||||
//
|
||||
// Build an MDL to describe the buffer.
|
||||
//
|
||||
|
||||
|
||||
IoAllocateMdl( Buffer->Buffer,
|
||||
BytesFromSectors( Blocks),
|
||||
FALSE,
|
||||
FALSE,
|
||||
BytesFromSectors( Blocks),
|
||||
FALSE,
|
||||
FALSE,
|
||||
Vcb->SectorCacheIrp);
|
||||
|
||||
|
||||
if (NULL == Vcb->SectorCacheIrp->MdlAddress) {
|
||||
|
||||
|
||||
IrpContext->Irp->IoStatus.Information = 0;
|
||||
CdRaiseStatus( IrpContext, STATUS_INSUFFICIENT_RESOURCES);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// We're reading/writing into the block cache (paged pool). Lock the
|
||||
// pages and update the MDL with physical page information.
|
||||
//
|
||||
|
||||
|
||||
_SEH2_TRY {
|
||||
|
||||
|
||||
MmProbeAndLockPages( Vcb->SectorCacheIrp->MdlAddress,
|
||||
KernelMode,
|
||||
(LOCK_OPERATION) IoWriteAccess );
|
||||
}
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(suppress: 6320)
|
||||
#endif
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
|
||||
|
||||
|
||||
IoFreeMdl( Vcb->SectorCacheIrp->MdlAddress );
|
||||
Vcb->SectorCacheIrp->MdlAddress = NULL;
|
||||
} _SEH2_END;
|
||||
|
||||
|
||||
if (NULL == Vcb->SectorCacheIrp->MdlAddress) {
|
||||
|
||||
|
||||
CdRaiseStatus( IrpContext, STATUS_INSUFFICIENT_RESOURCES );
|
||||
}
|
||||
|
||||
@ -2706,11 +2706,11 @@ Return Value:
|
||||
TRUE,
|
||||
TRUE,
|
||||
TRUE );
|
||||
|
||||
|
||||
Vcb->SectorCacheIrp->UserIosb = &Iosb;
|
||||
|
||||
Status = IoCallDriver( Vcb->TargetDeviceObject, Vcb->SectorCacheIrp );
|
||||
|
||||
|
||||
if (STATUS_PENDING == Status) {
|
||||
|
||||
|
||||
@ -2719,7 +2719,7 @@ Return Value:
|
||||
KernelMode,
|
||||
FALSE,
|
||||
NULL );
|
||||
|
||||
|
||||
Status = Vcb->SectorCacheIrp->IoStatus.Status;
|
||||
}
|
||||
|
||||
@ -2745,8 +2745,8 @@ Return Value:
|
||||
|
||||
Buffer->BaseLbn = StartBlock;
|
||||
Vcb->SecCacheLRUChunkIndex = (Vcb->SecCacheLRUChunkIndex + 1) % CD_SEC_CACHE_CHUNKS;
|
||||
|
||||
CdConvertCacheToShared( IrpContext);
|
||||
|
||||
CdConvertCacheToShared( IrpContext);
|
||||
#if DBG
|
||||
JustRead = TRUE;
|
||||
#endif
|
||||
@ -2841,7 +2841,7 @@ Return Value:
|
||||
//
|
||||
// For directories, use the sector cache.
|
||||
//
|
||||
|
||||
|
||||
if ((SafeNodeType( Fcb) == CDFS_NTC_FCB_INDEX) &&
|
||||
(NULL != Fcb->Vcb->SectorCacheBuffer) &&
|
||||
(VcbMounted == IrpContext->Vcb->VcbCondition)) {
|
||||
@ -2974,7 +2974,7 @@ Return Value:
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// We only need to set the associated IRP count in the master irp to
|
||||
// make it a master IRP. But we set the count to one more than our
|
||||
@ -3023,7 +3023,7 @@ Return Value:
|
||||
IoRuns[UnwindRunCount].SavedIrp = NULL;
|
||||
|
||||
if (NULL != Irp) {
|
||||
|
||||
|
||||
//
|
||||
// If IoCallDriver returns an error, it has completed the Irp
|
||||
// and the error will be caught by our completion routines
|
||||
@ -3035,7 +3035,7 @@ Return Value:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -3134,12 +3134,12 @@ Return Value:
|
||||
IrpContext->Irp->IoStatus.Information = 0;
|
||||
CdRaiseStatus( IrpContext, STATUS_INSUFFICIENT_RESOURCES );
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Should have been passed a byte count of at least one sector, and
|
||||
// Should have been passed a byte count of at least one sector, and
|
||||
// must be a multiple of sector size
|
||||
//
|
||||
|
||||
|
||||
NT_ASSERT( ThisIoRun->DiskByteCount && !SectorOffset(ThisIoRun->DiskByteCount));
|
||||
|
||||
RawByteCount = SectorsFromBytes( ThisIoRun->DiskByteCount) * RAW_SECTOR_SIZE;
|
||||
@ -3261,7 +3261,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -3305,7 +3305,7 @@ Return Value:
|
||||
//
|
||||
// For directories, look in the sector cache,
|
||||
//
|
||||
|
||||
|
||||
if ((SafeNodeType( Fcb) == CDFS_NTC_FCB_INDEX) &&
|
||||
(NULL != Fcb->Vcb->SectorCacheBuffer) &&
|
||||
(VcbMounted == IrpContext->Vcb->VcbCondition)) {
|
||||
@ -3313,7 +3313,7 @@ Return Value:
|
||||
if (CdReadDirDataThroughCache( IrpContext, Run )) {
|
||||
|
||||
if (FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT)) {
|
||||
|
||||
|
||||
IrpContext->Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
KeSetEvent( &IrpContext->IoContext->SyncEvent, 0, FALSE );
|
||||
}
|
||||
@ -3341,11 +3341,11 @@ Return Value:
|
||||
//
|
||||
|
||||
if (FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_TOP_LEVEL )) {
|
||||
|
||||
|
||||
NT_ASSERT( IrpContext->IoContext->ResourceThreadId == (ERESOURCE_THREAD)PsGetCurrentThread() );
|
||||
|
||||
|
||||
IrpContext->IoContext->ResourceThreadId = ((ULONG_PTR)IrpContext->IoContext) | 3;
|
||||
|
||||
|
||||
ExSetResourceOwnerPointer( IrpContext->IoContext->Resource,
|
||||
(PVOID)IrpContext->IoContext->ResourceThreadId );
|
||||
}
|
||||
@ -3390,7 +3390,7 @@ Return Value:
|
||||
(VOID)IoCallDriver( IrpContext->Vcb->TargetDeviceObject, IrpContext->Irp );
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -3428,7 +3428,7 @@ Return Value:
|
||||
KeClearEvent( &IrpContext->IoContext->SyncEvent );
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -3516,7 +3516,7 @@ Return Value:
|
||||
return STATUS_MORE_PROCESSING_REQUIRED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -3636,7 +3636,7 @@ Return Value:
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -3683,9 +3683,9 @@ Return Value:
|
||||
_Analysis_assume_(Context != NULL);
|
||||
|
||||
UNREFERENCED_PARAMETER( DeviceObject );
|
||||
|
||||
|
||||
AssertVerifyDeviceIrp( Irp );
|
||||
|
||||
|
||||
//
|
||||
// Store the correct information field into the Irp.
|
||||
//
|
||||
@ -3700,7 +3700,7 @@ Return Value:
|
||||
return STATUS_MORE_PROCESSING_REQUIRED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -3743,7 +3743,7 @@ Return Value:
|
||||
|
||||
_Analysis_assume_(IoContext != NULL);
|
||||
AssertVerifyDeviceIrp( Irp );
|
||||
|
||||
|
||||
//
|
||||
// Update the information field with the correct value for bytes read.
|
||||
//
|
||||
@ -3777,7 +3777,7 @@ Return Value:
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -4139,7 +4139,7 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
//
|
||||
// Get the next stack location, and copy over the stack location
|
||||
//
|
||||
|
@ -73,7 +73,7 @@ CdEnumerateIndex (
|
||||
#pragma alloc_text(PAGE, CdQueryDirectory)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
NTSTATUS
|
||||
@ -151,7 +151,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routines
|
||||
//
|
||||
@ -503,16 +503,16 @@ Return Value:
|
||||
// to guard against a user messing with the page protection and other
|
||||
// such trickery.
|
||||
//
|
||||
|
||||
|
||||
_SEH2_TRY {
|
||||
|
||||
|
||||
//
|
||||
// Zero and initialize the base part of the current entry.
|
||||
//
|
||||
|
||||
RtlZeroMemory( Add2Ptr( UserBuffer, NextEntry, PVOID ),
|
||||
BaseLength );
|
||||
|
||||
|
||||
//
|
||||
// Now we have an entry to return to our caller.
|
||||
// We'll case on the type of information requested and fill up
|
||||
@ -520,64 +520,64 @@ Return Value:
|
||||
//
|
||||
|
||||
switch (IrpSp->Parameters.QueryDirectory.FileInformationClass) {
|
||||
|
||||
|
||||
case FileBothDirectoryInformation:
|
||||
case FileFullDirectoryInformation:
|
||||
case FileIdBothDirectoryInformation:
|
||||
case FileIdFullDirectoryInformation:
|
||||
case FileDirectoryInformation:
|
||||
|
||||
|
||||
DirInfo = Add2Ptr( UserBuffer, NextEntry, PFILE_BOTH_DIR_INFORMATION );
|
||||
|
||||
|
||||
//
|
||||
// Use the create time for all the time stamps.
|
||||
//
|
||||
|
||||
|
||||
CdConvertCdTimeToNtTime( IrpContext,
|
||||
FileContext.InitialDirent->Dirent.CdTime,
|
||||
&DirInfo->CreationTime );
|
||||
|
||||
|
||||
DirInfo->LastWriteTime = DirInfo->ChangeTime = DirInfo->CreationTime;
|
||||
|
||||
|
||||
//
|
||||
// Set the attributes and sizes separately for directories and
|
||||
// files.
|
||||
//
|
||||
|
||||
|
||||
if (FlagOn( ThisDirent->DirentFlags, CD_ATTRIBUTE_DIRECTORY )) {
|
||||
|
||||
|
||||
DirInfo->EndOfFile.QuadPart = DirInfo->AllocationSize.QuadPart = 0;
|
||||
|
||||
|
||||
SetFlag( DirInfo->FileAttributes, FILE_ATTRIBUTE_DIRECTORY);
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
DirInfo->EndOfFile.QuadPart = FileContext.FileSize;
|
||||
DirInfo->AllocationSize.QuadPart = LlSectorAlign( FileContext.FileSize );
|
||||
|
||||
|
||||
SetFlag( DirInfo->FileAttributes, FILE_ATTRIBUTE_READONLY);
|
||||
}
|
||||
|
||||
if (FlagOn( ThisDirent->DirentFlags,
|
||||
CD_ATTRIBUTE_HIDDEN )) {
|
||||
|
||||
|
||||
SetFlag( DirInfo->FileAttributes, FILE_ATTRIBUTE_HIDDEN );
|
||||
}
|
||||
|
||||
|
||||
DirInfo->FileIndex = ThisDirent->DirentOffset;
|
||||
|
||||
|
||||
DirInfo->FileNameLength = FileNameBytes + SeparatorBytes + VersionStringBytes;
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case FileNamesInformation:
|
||||
|
||||
|
||||
NamesInfo = Add2Ptr( UserBuffer, NextEntry, PFILE_NAMES_INFORMATION );
|
||||
|
||||
|
||||
NamesInfo->FileIndex = ThisDirent->DirentOffset;
|
||||
|
||||
|
||||
NamesInfo->FileNameLength = FileNameBytes + SeparatorBytes + VersionStringBytes;
|
||||
|
||||
|
||||
break;
|
||||
|
||||
/* ReactOS Change: GCC "enumeration value not handled in switch" */
|
||||
@ -605,30 +605,30 @@ Return Value:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Now copy as much of the name as possible. We also may have a version
|
||||
// string to copy.
|
||||
//
|
||||
|
||||
|
||||
if (FileNameBytes != 0) {
|
||||
|
||||
|
||||
//
|
||||
// This is a Unicode name, we can copy the bytes directly.
|
||||
//
|
||||
|
||||
|
||||
RtlCopyMemory( Add2Ptr( UserBuffer, NextEntry + BaseLength, PVOID ),
|
||||
ThisDirent->CdFileName.FileName.Buffer,
|
||||
FileNameBytes );
|
||||
|
||||
|
||||
if (SeparatorBytes != 0) {
|
||||
|
||||
|
||||
*(Add2Ptr( UserBuffer,
|
||||
NextEntry + BaseLength + FileNameBytes,
|
||||
PWCHAR )) = L';';
|
||||
|
||||
|
||||
if (VersionStringBytes != 0) {
|
||||
|
||||
|
||||
RtlCopyMemory( Add2Ptr( UserBuffer,
|
||||
NextEntry + BaseLength + FileNameBytes + sizeof( WCHAR ),
|
||||
PVOID ),
|
||||
@ -650,40 +650,40 @@ Return Value:
|
||||
IrpSp->Parameters.QueryDirectory.FileInformationClass == FileIdBothDirectoryInformation) &&
|
||||
(Ccb->SearchExpression.VersionString.Length == 0) &&
|
||||
!FlagOn( ThisDirent->Flags, DIRENT_FLAG_CONSTANT_ENTRY )) {
|
||||
|
||||
|
||||
//
|
||||
// If we already have the short name then copy into the user's buffer.
|
||||
//
|
||||
|
||||
|
||||
if (FileContext.ShortName.FileName.Length != 0) {
|
||||
|
||||
|
||||
RtlCopyMemory( DirInfo->ShortName,
|
||||
FileContext.ShortName.FileName.Buffer,
|
||||
FileContext.ShortName.FileName.Length );
|
||||
|
||||
|
||||
DirInfo->ShortNameLength = (CCHAR) FileContext.ShortName.FileName.Length;
|
||||
|
||||
|
||||
//
|
||||
// If the short name length is currently zero then check if
|
||||
// the long name is not 8.3. We can copy the short name in
|
||||
// unicode form directly into the caller's buffer.
|
||||
//
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
if (!CdIs8dot3Name( IrpContext,
|
||||
ThisDirent->CdFileName.FileName )) {
|
||||
|
||||
|
||||
CdGenerate8dot3Name( IrpContext,
|
||||
&ThisDirent->CdCaseFileName.FileName,
|
||||
ThisDirent->DirentOffset,
|
||||
DirInfo->ShortName,
|
||||
&FileContext.ShortName.FileName.Length );
|
||||
|
||||
|
||||
DirInfo->ShortNameLength = (CCHAR) FileContext.ShortName.FileName.Length;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
@ -714,7 +714,7 @@ Return Value:
|
||||
|
||||
LastEntry = NextEntry;
|
||||
NextEntry = QuadAlign( Information );
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(suppress: 6320)
|
||||
#endif
|
||||
@ -725,19 +725,19 @@ Return Value:
|
||||
// fail this request. This is the only reason any exception
|
||||
// would have occured at this level.
|
||||
//
|
||||
|
||||
|
||||
Information = 0;
|
||||
try_leave( Status = _SEH2_GetExceptionCode());
|
||||
} _SEH2_END;
|
||||
}
|
||||
|
||||
|
||||
DoCcbUpdate = TRUE;
|
||||
|
||||
} _SEH2_FINALLY {
|
||||
|
||||
//
|
||||
// Cleanup our search context - *before* aquiring the FCB mutex exclusive,
|
||||
// else can block on threads in cdcreateinternalstream/purge which
|
||||
// else can block on threads in cdcreateinternalstream/purge which
|
||||
// hold the FCB but are waiting for all maps in this stream to be released.
|
||||
//
|
||||
|
||||
@ -748,13 +748,13 @@ Return Value:
|
||||
//
|
||||
|
||||
if (DoCcbUpdate && !NT_ERROR( Status )) {
|
||||
|
||||
|
||||
//
|
||||
// Update the Ccb to show the current state of the enumeration.
|
||||
//
|
||||
|
||||
CdLockFcb( IrpContext, Fcb );
|
||||
|
||||
|
||||
Ccb->CurrentDirentOffset = ThisDirent->DirentOffset;
|
||||
|
||||
ClearFlag( Ccb->Flags, CCB_FLAG_ENUM_RETURN_NEXT );
|
||||
@ -784,7 +784,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routines
|
||||
//
|
||||
@ -884,7 +884,7 @@ Return Value:
|
||||
return STATUS_PENDING;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -954,7 +954,7 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
//
|
||||
// If the user has specified that the scan be restarted, and has specicified
|
||||
// If the user has specified that the scan be restarted, and has specicified
|
||||
// a new query pattern, reinitialize the CCB.
|
||||
//
|
||||
|
||||
@ -1349,7 +1349,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -1418,7 +1418,7 @@ Return Value:
|
||||
ThisDirent = &FileContext->InitialDirent->Dirent;
|
||||
|
||||
CdUpdateDirentName( IrpContext, ThisDirent, FlagOn( Ccb->Flags, CCB_FLAG_IGNORE_CASE ));
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
ReturnNextEntry = TRUE;
|
||||
@ -1427,7 +1427,7 @@ Return Value:
|
||||
//
|
||||
// Don't bother if we have a constant entry and are ignoring them.
|
||||
//
|
||||
|
||||
|
||||
if (FlagOn( ThisDirent->Flags, DIRENT_FLAG_CONSTANT_ENTRY ) &&
|
||||
FlagOn( Ccb->Flags, CCB_FLAG_ENUM_NOMATCH_CONSTANT_ENTRY )) {
|
||||
|
||||
|
@ -120,7 +120,7 @@ CdCheckForXAExtent (
|
||||
#pragma alloc_text(PAGE, CdUpdateDirentName)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdLookupDirent (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -203,7 +203,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOLEAN
|
||||
CdLookupNextDirent (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -391,7 +391,7 @@ Return Value:
|
||||
}
|
||||
|
||||
|
||||
_At_(Dirent->CdTime, _Post_notnull_)
|
||||
_At_(Dirent->CdTime, _Post_notnull_)
|
||||
VOID
|
||||
CdUpdateDirentFromRawDirent (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -529,7 +529,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdUpdateDirentName (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -819,7 +819,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_Success_(return != FALSE) BOOLEAN
|
||||
CdFindFile (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -992,7 +992,7 @@ Return Value:
|
||||
return Found;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOLEAN
|
||||
CdFindDirectory (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -1102,7 +1102,7 @@ Return Value:
|
||||
return Found;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_At_(FileContext->ShortName.FileName.MaximumLength, _In_range_(>=, BYTE_COUNT_8_DOT_3))
|
||||
BOOLEAN
|
||||
CdFindFileByShortName (
|
||||
@ -1270,7 +1270,7 @@ Return Value:
|
||||
return Found;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOLEAN
|
||||
CdLookupNextInitialFileDirent (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -1421,7 +1421,7 @@ Return Value:
|
||||
return FoundDirent;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdLookupLastFileDirent (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -1631,7 +1631,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdCleanupFileContext (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -1679,7 +1679,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -1781,7 +1781,7 @@ Return Value:
|
||||
return NextDirentOffset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -1848,12 +1848,12 @@ Return Value:
|
||||
|
||||
//
|
||||
// Check for XA data. Note that a number of discs (video CDs)
|
||||
// have files marked as type XA Mode 2 Form 1 (2048 bytes of
|
||||
// user data), but actually record these sectors as Mode2 Form 2
|
||||
// (2352). We will fail to read these files, since for M2F1,
|
||||
// have files marked as type XA Mode 2 Form 1 (2048 bytes of
|
||||
// user data), but actually record these sectors as Mode2 Form 2
|
||||
// (2352). We will fail to read these files, since for M2F1,
|
||||
// a normal read CD command is issued (as per SCSI specs).
|
||||
//
|
||||
|
||||
|
||||
ExtentType = Mode2Form2Data;
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ CdQueryNetworkInfo (
|
||||
#pragma alloc_text(PAGE, CdQueryStandardInfo)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
NTSTATUS
|
||||
CdCommonQueryInfo (
|
||||
@ -348,7 +348,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
NTSTATUS
|
||||
CdCommonSetInfo (
|
||||
@ -463,7 +463,7 @@ Return Value:
|
||||
|
||||
|
||||
_Function_class_(FAST_IO_QUERY_BASIC_INFO)
|
||||
_IRQL_requires_same_
|
||||
_IRQL_requires_same_
|
||||
_Success_(return != FALSE)
|
||||
BOOLEAN
|
||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||
@ -855,7 +855,7 @@ Return Value:
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -918,7 +918,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -993,7 +993,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -1043,7 +1043,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -1094,7 +1094,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -1149,7 +1149,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -1193,7 +1193,7 @@ Return Value:
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
NT_ASSERT(*Length >= sizeof(ULONG));
|
||||
|
||||
|
||||
//
|
||||
// Simply copy the name in the file object to the user's buffer.
|
||||
//
|
||||
@ -1225,7 +1225,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -1317,7 +1317,7 @@ Return Value:
|
||||
ParentFcb = Fcb->ParentFcb;
|
||||
CdAcquireFileShared( IrpContext, ParentFcb );
|
||||
ReleaseParentFcb = TRUE;
|
||||
|
||||
|
||||
CdVerifyOrCreateDirStreamFile( IrpContext, ParentFcb);
|
||||
|
||||
if (CdFidIsDirectory( Fcb->FileId)) {
|
||||
@ -1359,23 +1359,23 @@ Return Value:
|
||||
|
||||
NameToUse = &FileContext.InitialDirent->Dirent.CdCaseFileName.FileName;
|
||||
DirentOffset = FileContext.InitialDirent->Dirent.DirentOffset;
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
//
|
||||
// Initialize the search dirent structures.
|
||||
//
|
||||
|
||||
|
||||
CdInitializeDirContext( IrpContext, &DirContext );
|
||||
CdInitializeDirent( IrpContext, &Dirent );
|
||||
|
||||
|
||||
CleanupFileLookup = TRUE;
|
||||
|
||||
|
||||
CdLookupDirent( IrpContext,
|
||||
ParentFcb,
|
||||
CdQueryFidDirentOffset( Fcb->FileId ),
|
||||
&DirContext );
|
||||
|
||||
|
||||
CdUpdateDirentFromRawDirent( IrpContext,
|
||||
ParentFcb,
|
||||
&DirContext,
|
||||
@ -1384,9 +1384,9 @@ Return Value:
|
||||
//
|
||||
// Now update the dirent name.
|
||||
//
|
||||
|
||||
|
||||
CdUpdateDirentName( IrpContext, &Dirent, TRUE );
|
||||
|
||||
|
||||
NameToUse = &Dirent.CdCaseFileName.FileName;
|
||||
DirentOffset = Dirent.DirentOffset;
|
||||
}
|
||||
@ -1454,7 +1454,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
|
@ -187,7 +187,7 @@ Return Value:
|
||||
|
||||
*Fcb = FileObject->FsContext;
|
||||
*Ccb = FileObject->FsContext2;
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( suppress: 4213 )
|
||||
#endif
|
||||
@ -201,7 +201,7 @@ Return Value:
|
||||
return TypeOfOpen;
|
||||
}
|
||||
|
||||
|
||||
|
||||
TYPE_OF_OPEN
|
||||
CdFastDecodeFileObject (
|
||||
_In_ PFILE_OBJECT FileObject,
|
||||
|
@ -172,7 +172,7 @@ CdFindActiveVolDescriptor (
|
||||
#pragma alloc_text(PAGE, CdVerifyVolume)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -193,13 +193,13 @@ Routine Description:
|
||||
This routine performs the actual lock volume operation. It will be called
|
||||
by anyone wishing to try to protect the volume for a long duration. PNP
|
||||
operations are such a user.
|
||||
|
||||
|
||||
The volume must be held exclusive by the caller.
|
||||
|
||||
Arguments:
|
||||
|
||||
Vcb - The volume being locked.
|
||||
|
||||
|
||||
FileObject - File corresponding to the handle locking the volume. If this
|
||||
is not specified, a system lock is assumed.
|
||||
|
||||
@ -223,7 +223,7 @@ Return Value:
|
||||
// to get rid of all of the other user references. If there is only one
|
||||
// remaining after the purge then we can allow the volume to be locked.
|
||||
//
|
||||
|
||||
|
||||
CdPurgeVolume( IrpContext, Vcb, FALSE );
|
||||
|
||||
//
|
||||
@ -253,7 +253,7 @@ Return Value:
|
||||
|
||||
SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT );
|
||||
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
|
||||
|
||||
|
||||
if (!NT_SUCCESS( Status )) {
|
||||
|
||||
return Status;
|
||||
@ -266,9 +266,9 @@ Return Value:
|
||||
// Vpb locked flag as an 'explicit lock' flag in the same way as Fat.
|
||||
//
|
||||
|
||||
IoAcquireVpbSpinLock( &SavedIrql );
|
||||
|
||||
if (!FlagOn( Vcb->Vpb->Flags, VPB_LOCKED ) &&
|
||||
IoAcquireVpbSpinLock( &SavedIrql );
|
||||
|
||||
if (!FlagOn( Vcb->Vpb->Flags, VPB_LOCKED ) &&
|
||||
(Vcb->VcbCleanup == RemainingUserReferences) &&
|
||||
(Vcb->VcbUserReference == CDFS_RESIDUAL_USER_REFERENCE + RemainingUserReferences)) {
|
||||
|
||||
@ -277,13 +277,13 @@ Return Value:
|
||||
Vcb->VolumeLockFileObject = FileObject;
|
||||
FinalStatus = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
IoReleaseVpbSpinLock( SavedIrql );
|
||||
|
||||
|
||||
IoReleaseVpbSpinLock( SavedIrql );
|
||||
|
||||
return FinalStatus;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NTSTATUS
|
||||
CdUnlockVolumeInternal (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -295,21 +295,21 @@ CdUnlockVolumeInternal (
|
||||
|
||||
Routine Description:
|
||||
|
||||
This routine performs the actual unlock volume operation.
|
||||
|
||||
This routine performs the actual unlock volume operation.
|
||||
|
||||
The volume must be held exclusive by the caller.
|
||||
|
||||
Arguments:
|
||||
|
||||
Vcb - The volume being locked.
|
||||
|
||||
|
||||
FileObject - File corresponding to the handle locking the volume. If this
|
||||
is not specified, a system lock is assumed.
|
||||
|
||||
Return Value:
|
||||
|
||||
NTSTATUS - The return status for the operation
|
||||
|
||||
|
||||
Attempting to remove a system lock that did not exist is OK.
|
||||
|
||||
--*/
|
||||
@ -325,10 +325,10 @@ Return Value:
|
||||
// lock flag. The Vpb flag is only set for an explicit lock request, not
|
||||
// for the implicit lock obtained on a volume open with zero share mode.
|
||||
//
|
||||
|
||||
IoAcquireVpbSpinLock( &SavedIrql );
|
||||
|
||||
if (FlagOn(Vcb->Vpb->Flags, VPB_LOCKED) &&
|
||||
|
||||
IoAcquireVpbSpinLock( &SavedIrql );
|
||||
|
||||
if (FlagOn(Vcb->Vpb->Flags, VPB_LOCKED) &&
|
||||
(FileObject == Vcb->VolumeLockFileObject)) {
|
||||
|
||||
ClearFlag( Vcb->VcbState, VCB_STATE_LOCKED );
|
||||
@ -336,13 +336,13 @@ Return Value:
|
||||
Vcb->VolumeLockFileObject = NULL;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
IoReleaseVpbSpinLock( SavedIrql );
|
||||
|
||||
IoReleaseVpbSpinLock( SavedIrql );
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
NTSTATUS
|
||||
@ -407,7 +407,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -527,7 +527,7 @@ CdReMountOldVcb (
|
||||
PUCHAR Buffer;
|
||||
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
ObDereferenceObject( OldVcb->TargetDeviceObject );
|
||||
|
||||
IoAcquireVpbSpinLock( &SavedIrql );
|
||||
@ -536,10 +536,10 @@ CdReMountOldVcb (
|
||||
#pragma prefast(suppress: 28175, "this is a filesystem driver, touching the vpb is allowed")
|
||||
#endif
|
||||
NewVcb->Vpb->RealDevice->Vpb = OldVcb->Vpb;
|
||||
|
||||
|
||||
OldVcb->Vpb->RealDevice = NewVcb->Vpb->RealDevice;
|
||||
OldVcb->TargetDeviceObject = DeviceObjectWeTalkTo;
|
||||
|
||||
|
||||
CdUpdateVcbCondition( OldVcb, VcbMounted);
|
||||
CdUpdateMediaChangeCount( OldVcb, NewVcb->MediaChangeCount);
|
||||
|
||||
@ -549,12 +549,12 @@ CdReMountOldVcb (
|
||||
NewVcb->SectorCacheBuffer = NULL;
|
||||
|
||||
if (NULL != Buffer) {
|
||||
|
||||
|
||||
for (Index = 0; Index < CD_SEC_CACHE_CHUNKS; Index++) {
|
||||
|
||||
|
||||
OldVcb->SecCacheChunks[ Index].Buffer = Buffer;
|
||||
OldVcb->SecCacheChunks[ Index].BaseLbn = (ULONG)-1;
|
||||
|
||||
|
||||
Buffer += CD_SEC_CHUNK_BLOCKS * SECTOR_SIZE;
|
||||
}
|
||||
}
|
||||
@ -616,7 +616,7 @@ Return Value:
|
||||
PVCB Vcb = NULL;
|
||||
PVCB OldVcb;
|
||||
UCHAR StackSize;
|
||||
|
||||
|
||||
BOOLEAN FoundPvd = FALSE;
|
||||
BOOLEAN SetDoVerifyOnFail;
|
||||
|
||||
@ -725,11 +725,11 @@ Return Value:
|
||||
&Iosb );
|
||||
|
||||
if (!NT_SUCCESS( Status )) {
|
||||
|
||||
|
||||
CdCompleteRequest( IrpContext, Irp, Status );
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
if (Iosb.Information != sizeof(ULONG)) {
|
||||
|
||||
//
|
||||
@ -873,7 +873,7 @@ Return Value:
|
||||
// If we failed to read the TOC, then bail out. Probably blank media.
|
||||
//
|
||||
|
||||
if (Status != STATUS_SUCCESS) {
|
||||
if (Status != STATUS_SUCCESS) {
|
||||
|
||||
#ifdef __REACTOS__
|
||||
|
||||
@ -886,7 +886,7 @@ Return Value:
|
||||
Status = STATUS_SUCCESS;
|
||||
} else {
|
||||
#endif
|
||||
try_leave( Status );
|
||||
try_leave( Status );
|
||||
#ifdef __REACTOS__
|
||||
}
|
||||
#endif
|
||||
@ -957,7 +957,7 @@ Return Value:
|
||||
|
||||
// Lock object is acquired and released using internal state
|
||||
_Analysis_suppress_lock_checking_(Vcb->VcbResource);
|
||||
|
||||
|
||||
//
|
||||
// Store the Vcb in the IrpContext as we didn't have one before.
|
||||
//
|
||||
@ -980,7 +980,7 @@ Return Value:
|
||||
CdMarkRealDevVerifyOk( Vcb->Vpb->RealDevice);
|
||||
|
||||
if (!FlagOn( Vcb->VcbState, VCB_STATE_AUDIO_DISK)) {
|
||||
|
||||
|
||||
//
|
||||
// Allocate a buffer to read in the volume descriptors. We allocate a full
|
||||
// page to make sure we don't hit any alignment problems.
|
||||
@ -1007,7 +1007,7 @@ Return Value:
|
||||
// We failed to find a valid VD in the data track, but there were also
|
||||
// audio tracks on this disc, so we'll try to mount it as an audio CD.
|
||||
// Since we're always last in the mount order, we won't be preventing
|
||||
// any other FS from trying to mount the data track. However if the
|
||||
// any other FS from trying to mount the data track. However if the
|
||||
// data track was at the start of the disc, then we abort, to avoid
|
||||
// having to filter it from our synthesised directory listing later. We
|
||||
// already filtered off any data track at the end.
|
||||
@ -1015,7 +1015,7 @@ Return Value:
|
||||
|
||||
if (!(TocDiskFlags & CDROM_DISK_AUDIO_TRACK) ||
|
||||
BooleanFlagOn( Vcb->CdromToc->TrackData[0].Control, TOC_DATA_TRACK)) {
|
||||
|
||||
|
||||
try_leave( Status = STATUS_UNRECOGNIZED_VOLUME);
|
||||
}
|
||||
|
||||
@ -1025,7 +1025,7 @@ Return Value:
|
||||
RawIsoVd = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Look and see if there is a secondary volume descriptor we want to
|
||||
// use.
|
||||
@ -1058,7 +1058,7 @@ Return Value:
|
||||
// Allocate a block cache to speed directory operations. We can't
|
||||
// use the cache if there is any chance the volume has link blocks
|
||||
// in the data area (i.e. was packet written and then finalized to
|
||||
// Joliet/9660). So we simply only allow the cache to operate on
|
||||
// Joliet/9660). So we simply only allow the cache to operate on
|
||||
// media with a single track - since we're really targetting pressed
|
||||
// installation media here. We can't be more precise, since D/CD-ROM
|
||||
// drives don't support READ_TRACK_INFO, which is the only way for
|
||||
@ -1076,10 +1076,10 @@ Return Value:
|
||||
ULONG Index;
|
||||
PUCHAR Buffer;
|
||||
|
||||
Buffer =
|
||||
Vcb->SectorCacheBuffer = FsRtlAllocatePool( CdPagedPool,
|
||||
Buffer =
|
||||
Vcb->SectorCacheBuffer = FsRtlAllocatePool( CdPagedPool,
|
||||
CD_SEC_CACHE_CHUNKS *
|
||||
CD_SEC_CHUNK_BLOCKS *
|
||||
CD_SEC_CHUNK_BLOCKS *
|
||||
SECTOR_SIZE);
|
||||
|
||||
for (Index = 0; Index < (ULONG)CD_SEC_CACHE_CHUNKS; Index++) {
|
||||
@ -1096,11 +1096,11 @@ Return Value:
|
||||
|
||||
try_leave( Status = STATUS_INSUFFICIENT_RESOURCES );
|
||||
}
|
||||
|
||||
IoInitializeIrp( Vcb->SectorCacheIrp,
|
||||
IoSizeOfIrp( StackSize),
|
||||
|
||||
IoInitializeIrp( Vcb->SectorCacheIrp,
|
||||
IoSizeOfIrp( StackSize),
|
||||
(CCHAR)StackSize);
|
||||
|
||||
|
||||
KeInitializeEvent( &Vcb->SectorCacheEvent, SynchronizationEvent, FALSE);
|
||||
ExInitializeResourceLite( &Vcb->SectorCacheResource);
|
||||
}
|
||||
@ -1116,13 +1116,13 @@ Return Value:
|
||||
|
||||
//
|
||||
// Link the old Vcb to point to the new device object that we
|
||||
// should be talking to, dereferencing the previous. Call a
|
||||
// should be talking to, dereferencing the previous. Call a
|
||||
// nonpaged routine to do this since we take the Vpb spinlock.
|
||||
//
|
||||
|
||||
CdReMountOldVcb( IrpContext,
|
||||
OldVcb,
|
||||
Vcb,
|
||||
CdReMountOldVcb( IrpContext,
|
||||
OldVcb,
|
||||
Vcb,
|
||||
DeviceObjectWeTalkTo);
|
||||
|
||||
//
|
||||
@ -1132,15 +1132,15 @@ Return Value:
|
||||
// Note that we do not send mount on normal remounts - that would duplicate the media
|
||||
// arrival notification of the device driver.
|
||||
//
|
||||
|
||||
|
||||
if (FlagOn( OldVcb->VcbState, VCB_STATE_NOTIFY_REMOUNT )) {
|
||||
|
||||
|
||||
ClearFlag( OldVcb->VcbState, VCB_STATE_NOTIFY_REMOUNT );
|
||||
|
||||
|
||||
FileObjectToNotify = OldVcb->RootIndexFcb->FileObject;
|
||||
ObReferenceObject( FileObjectToNotify );
|
||||
}
|
||||
|
||||
|
||||
try_leave( Status = STATUS_SUCCESS );
|
||||
}
|
||||
|
||||
@ -1233,8 +1233,8 @@ Return Value:
|
||||
//
|
||||
// If we are not mounting the device, then set the verify bit again.
|
||||
//
|
||||
|
||||
if ((_SEH2_AbnormalTermination() || (Status != STATUS_SUCCESS)) &&
|
||||
|
||||
if ((_SEH2_AbnormalTermination() || (Status != STATUS_SUCCESS)) &&
|
||||
SetDoVerifyOnFail) {
|
||||
|
||||
CdMarkRealDevForVerify( IrpContext->RealDevice);
|
||||
@ -1276,7 +1276,7 @@ Return Value:
|
||||
//
|
||||
// Now send mount notification.
|
||||
//
|
||||
|
||||
|
||||
if (FileObjectToNotify) {
|
||||
|
||||
FsRtlNotifyVolumeEvent( FileObjectToNotify, FSRTL_VOLUME_MOUNT );
|
||||
@ -1301,7 +1301,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -1426,7 +1426,7 @@ Return Value:
|
||||
|
||||
try_return( Status );
|
||||
}
|
||||
|
||||
|
||||
if (Iosb.Information != sizeof(ULONG)) {
|
||||
|
||||
//
|
||||
@ -1543,7 +1543,7 @@ Return Value:
|
||||
|
||||
try_return( Status = STATUS_WRONG_VOLUME );
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
//
|
||||
@ -1674,11 +1674,11 @@ Return Value:
|
||||
if (FlagOn( Vcb->VcbState, VCB_STATE_NOTIFY_REMOUNT )) {
|
||||
|
||||
ClearFlag( Vcb->VcbState, VCB_STATE_NOTIFY_REMOUNT );
|
||||
|
||||
|
||||
FileObjectToNotify = Vcb->RootIndexFcb->FileObject;
|
||||
ObReferenceObject( FileObjectToNotify );
|
||||
}
|
||||
|
||||
|
||||
try_exit: NOTHING;
|
||||
|
||||
//
|
||||
@ -1691,9 +1691,9 @@ Return Value:
|
||||
//
|
||||
// If the volume was already unmounted, nothing more to do.
|
||||
//
|
||||
|
||||
|
||||
if (Vcb->VcbCondition == VcbNotMounted) {
|
||||
|
||||
|
||||
Status = STATUS_WRONG_VOLUME;
|
||||
|
||||
//
|
||||
@ -1722,7 +1722,7 @@ Return Value:
|
||||
if (Vcb->VcbCleanup == 0) {
|
||||
|
||||
if (NT_SUCCESS( CdPurgeVolume( IrpContext, Vcb, FALSE ))) {
|
||||
|
||||
|
||||
ReleaseVcb = CdCheckForDismount( IrpContext, Vcb, FALSE );
|
||||
}
|
||||
}
|
||||
@ -1758,13 +1758,13 @@ Return Value:
|
||||
//
|
||||
// Now send mount notification.
|
||||
//
|
||||
|
||||
|
||||
if (FileObjectToNotify) {
|
||||
|
||||
FsRtlNotifyVolumeEvent( FileObjectToNotify, FSRTL_VOLUME_MOUNT );
|
||||
ObDereferenceObject( FileObjectToNotify );
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Complete the request if no exception.
|
||||
//
|
||||
@ -1773,7 +1773,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -1930,7 +1930,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -2013,7 +2013,7 @@ Return Value:
|
||||
//
|
||||
|
||||
CdReleaseVcb( IrpContext, Vcb );
|
||||
|
||||
|
||||
if (_SEH2_AbnormalTermination() || !NT_SUCCESS( Status )) {
|
||||
|
||||
FsRtlNotifyVolumeEvent( IrpSp->FileObject, FSRTL_VOLUME_LOCK_FAILED );
|
||||
@ -2028,7 +2028,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -2118,7 +2118,7 @@ Return Value:
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -2179,7 +2179,7 @@ Return Value:
|
||||
//
|
||||
|
||||
SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT);
|
||||
|
||||
|
||||
//
|
||||
// Acquire exclusive access to the Vcb, and take the global resource to
|
||||
// sync. against mounts, verifies etc.
|
||||
@ -2206,26 +2206,26 @@ Return Value:
|
||||
// on the volume fail and grease the rails toward dismount.
|
||||
// By definition there is no going back from a SURPRISE.
|
||||
//
|
||||
|
||||
|
||||
CdLockVcb( IrpContext, Vcb );
|
||||
|
||||
|
||||
if (Vcb->VcbCondition != VcbDismountInProgress) {
|
||||
|
||||
|
||||
CdUpdateVcbCondition( Vcb, VcbInvalid );
|
||||
}
|
||||
|
||||
SetFlag( Vcb->VcbState, VCB_STATE_DISMOUNTED );
|
||||
|
||||
|
||||
CdUnlockVcb( IrpContext, Vcb );
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Set flag to tell the close path that we want to force dismount
|
||||
// the volume when this handle is closed.
|
||||
//
|
||||
|
||||
|
||||
SetFlag( Ccb->Flags, CCB_FLAG_DISMOUNT_ON_CLOSE);
|
||||
|
||||
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@ -2250,7 +2250,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -2344,14 +2344,14 @@ Return Value:
|
||||
// Now set up to return the clean state. CDs obviously can never be dirty
|
||||
// but we want to make sure we have enforced the full semantics of this call.
|
||||
//
|
||||
|
||||
|
||||
Irp->IoStatus.Information = sizeof( ULONG );
|
||||
|
||||
CdCompleteRequest( IrpContext, Irp, STATUS_SUCCESS );
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -2412,7 +2412,7 @@ Return Value:
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -2447,7 +2447,7 @@ Return Value:
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -2481,9 +2481,9 @@ Return Value:
|
||||
NTSTATUS Status;
|
||||
PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( Irp );
|
||||
KIRQL SavedIrql;
|
||||
|
||||
|
||||
BOOLEAN UnlockVcb = FALSE;
|
||||
|
||||
|
||||
LUID TcbPrivilege = {SE_TCB_PRIVILEGE, 0};
|
||||
|
||||
HANDLE Handle;
|
||||
@ -2498,7 +2498,7 @@ Return Value:
|
||||
//
|
||||
// We only allow the invalidate call to come in on our file system devices.
|
||||
//
|
||||
|
||||
|
||||
#ifndef __REACTOS__
|
||||
if (IrpSp->DeviceObject != CdData.FileSystemDeviceObject) {
|
||||
#else
|
||||
@ -2530,7 +2530,7 @@ Return Value:
|
||||
#if defined(_WIN64) && BUILD_WOW64_ENABLED
|
||||
|
||||
if (IoIs32bitProcess( Irp )) {
|
||||
|
||||
|
||||
if (IrpSp->Parameters.FileSystemControl.InputBufferLength != sizeof( UINT32 )) {
|
||||
|
||||
CdCompleteRequest( IrpContext, Irp, STATUS_INVALID_PARAMETER );
|
||||
@ -2538,7 +2538,7 @@ Return Value:
|
||||
}
|
||||
|
||||
Handle = (HANDLE) LongToHandle( *((PUINT32) Irp->AssociatedIrp.SystemBuffer) );
|
||||
|
||||
|
||||
} else
|
||||
|
||||
#endif
|
||||
@ -2588,7 +2588,7 @@ Return Value:
|
||||
//
|
||||
// Synchronise with pnp/mount/verify paths.
|
||||
//
|
||||
|
||||
|
||||
CdAcquireCdData( IrpContext );
|
||||
|
||||
//
|
||||
@ -2621,18 +2621,18 @@ Return Value:
|
||||
if (Vcb->Vpb->RealDevice == DeviceToMarkBad) {
|
||||
|
||||
//
|
||||
// Take the VPB spinlock, and look to see if this volume is the
|
||||
// one currently mounted on the actual device. If it is, pull it
|
||||
// Take the VPB spinlock, and look to see if this volume is the
|
||||
// one currently mounted on the actual device. If it is, pull it
|
||||
// off immediately.
|
||||
//
|
||||
|
||||
|
||||
IoAcquireVpbSpinLock( &SavedIrql );
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma prefast(suppress: 28175, "this is a filesystem driver, touching the vpb is allowed")
|
||||
#endif
|
||||
if (DeviceToMarkBad->Vpb == Vcb->Vpb) {
|
||||
|
||||
|
||||
PVPB NewVpb = Vcb->SwapVpb;
|
||||
|
||||
NT_ASSERT( FlagOn( Vcb->Vpb->Flags, VPB_MOUNTED));
|
||||
@ -2660,14 +2660,14 @@ Return Value:
|
||||
IoReleaseVpbSpinLock( SavedIrql );
|
||||
|
||||
if (Vcb->VcbCondition != VcbDismountInProgress) {
|
||||
|
||||
|
||||
CdUpdateVcbCondition( Vcb, VcbInvalid);
|
||||
}
|
||||
|
||||
CdUnlockVcb( IrpContext, Vcb );
|
||||
|
||||
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE);
|
||||
|
||||
|
||||
CdPurgeVolume( IrpContext, Vcb, FALSE );
|
||||
|
||||
UnlockVcb = CdCheckForDismount( IrpContext, Vcb, FALSE );
|
||||
@ -2675,9 +2675,9 @@ Return Value:
|
||||
//
|
||||
// prefast: if UnlockVcb is false, then the VCB was already deleted, so we better not touch the Vcb.
|
||||
// tell Prefast something nice so it stops complaining about us leaking it.
|
||||
//
|
||||
|
||||
__analysis_assert( UnlockVcb == TRUE );
|
||||
//
|
||||
|
||||
__analysis_assert( UnlockVcb == TRUE );
|
||||
|
||||
if (UnlockVcb) {
|
||||
|
||||
@ -2818,7 +2818,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -2898,7 +2898,7 @@ Return Value:
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// We will make at most two passes through the volume descriptor sequence.
|
||||
//
|
||||
@ -3131,7 +3131,7 @@ Return Value:
|
||||
return FoundVd;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -3256,7 +3256,7 @@ Return Value:
|
||||
// serial numbers, volume label and TOC.
|
||||
//
|
||||
|
||||
}
|
||||
}
|
||||
else if ((OldVpb->SerialNumber == Vpb->SerialNumber) &&
|
||||
(Vcb->TocLength == (*OldVcb)->TocLength) &&
|
||||
((Vcb->TocLength == 0) || RtlEqualMemory( Vcb->CdromToc,
|
||||
@ -3280,7 +3280,7 @@ Return Value:
|
||||
return Remount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -3388,7 +3388,7 @@ Return Value:
|
||||
ESC_SEQ_LEN ))) {
|
||||
|
||||
if (!VerifyVolume) {
|
||||
|
||||
|
||||
//
|
||||
// Update the Vcb with the new volume descriptor.
|
||||
//
|
||||
@ -3398,7 +3398,7 @@ Return Value:
|
||||
|
||||
Vcb->VdSectorOffset = SectorOffset;
|
||||
}
|
||||
|
||||
|
||||
FoundSecondaryVd = TRUE;
|
||||
break;
|
||||
}
|
||||
@ -3427,12 +3427,12 @@ Return Value:
|
||||
// If we're in the verify path, our work is done, since we don't want
|
||||
// to update any Vcb/Vpb values.
|
||||
//
|
||||
|
||||
|
||||
if (VerifyVolume) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Compute the serial number and volume label from the volume descriptor.
|
||||
//
|
||||
|
@ -22,7 +22,7 @@ Abstract:
|
||||
|
||||
#define BugCheckFileId (CDFS_BUG_CHECK_FSPDISP)
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||
CdFspDispatch (
|
||||
@ -238,7 +238,7 @@ Return Value:
|
||||
|
||||
} else {
|
||||
|
||||
VolDo->PostedRequestCount -= 1;
|
||||
VolDo->PostedRequestCount -= 1;
|
||||
|
||||
Entry = NULL;
|
||||
}
|
||||
@ -250,9 +250,9 @@ Return Value:
|
||||
// the Ex Worker thread.
|
||||
//
|
||||
|
||||
if (Entry == NULL) {
|
||||
if (Entry == NULL) {
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -30,7 +30,7 @@ Abstract:
|
||||
#pragma alloc_text(PAGE, CdFastUnlockSingle)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
NTSTATUS
|
||||
CdCommonLockControl (
|
||||
_Inout_ PIRP_CONTEXT IrpContext,
|
||||
@ -136,7 +136,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOLEAN
|
||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||
CdFastLock (
|
||||
@ -288,7 +288,7 @@ Return Value:
|
||||
return Results;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOLEAN
|
||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||
CdFastUnlockSingle (
|
||||
@ -336,7 +336,7 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
UNREFERENCED_PARAMETER( DeviceObject );
|
||||
|
||||
|
||||
IoStatus->Information = 0;
|
||||
|
||||
//
|
||||
@ -431,7 +431,7 @@ Return Value:
|
||||
return Results;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOLEAN
|
||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||
CdFastUnlockAll (
|
||||
@ -470,7 +470,7 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
UNREFERENCED_PARAMETER( DeviceObject );
|
||||
|
||||
|
||||
IoStatus->Information = 0;
|
||||
|
||||
//
|
||||
@ -556,7 +556,7 @@ Return Value:
|
||||
return Results;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOLEAN
|
||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||
CdFastUnlockAllByKey (
|
||||
@ -598,7 +598,7 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
UNREFERENCED_PARAMETER( DeviceObject );
|
||||
|
||||
|
||||
IoStatus->Information = 0;
|
||||
|
||||
//
|
||||
|
@ -34,7 +34,7 @@ Abstract:
|
||||
#pragma alloc_text(PAGE, CdUpcaseName)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
_Post_satisfies_(_Old_(CdName->FileName.Length) >=
|
||||
CdName->FileName.Length + CdName->VersionString.Length)
|
||||
VOID
|
||||
@ -105,7 +105,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdConvertBigToLittleEndian (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -189,7 +189,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdUpcaseName (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -222,7 +222,7 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
//
|
||||
// If the name structures are different then initialize the different components.
|
||||
//
|
||||
@ -278,7 +278,7 @@ Return Value:
|
||||
|
||||
NT_ASSERT( Status == STATUS_SUCCESS );
|
||||
__analysis_assert( Status == STATUS_SUCCESS );
|
||||
|
||||
|
||||
if (Name->VersionString.Length != 0) {
|
||||
|
||||
Status = RtlUpcaseUnicodeString( &UpcaseName->VersionString,
|
||||
@ -290,13 +290,13 @@ Return Value:
|
||||
//
|
||||
|
||||
NT_ASSERT( Status == STATUS_SUCCESS );
|
||||
__analysis_assert( Status == STATUS_SUCCESS );
|
||||
__analysis_assert( Status == STATUS_SUCCESS );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdDissectName (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -331,7 +331,7 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
//
|
||||
// Find the offset of the next component separators.
|
||||
//
|
||||
@ -372,7 +372,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOLEAN
|
||||
CdIsLegalName (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -424,7 +424,7 @@ Return Value:
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOLEAN
|
||||
CdIs8dot3Name (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -461,7 +461,7 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
//
|
||||
// The length must be less than 24 bytes.
|
||||
//
|
||||
@ -545,7 +545,7 @@ Return Value:
|
||||
return FsRtlIsFatDbcsLegal( DbcsName, FALSE, FALSE, FALSE );
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdGenerate8dot3Name (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -591,9 +591,9 @@ Return Value:
|
||||
|
||||
--*/
|
||||
|
||||
{
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
UNICODE_STRING ShortName;
|
||||
UNICODE_STRING BiasedShortName;
|
||||
WCHAR ShortNameBuffer[ BYTE_COUNT_8_DOT_3 / sizeof( WCHAR ) ] = {0};
|
||||
@ -664,19 +664,19 @@ Return Value:
|
||||
// Generate an OEM version of the string so that we can check for double
|
||||
// byte characters.
|
||||
//
|
||||
|
||||
|
||||
Status = RtlUnicodeStringToOemString(&OemName, &ShortName, TRUE);
|
||||
|
||||
//
|
||||
// If this failed, bail out. Don't expect any problems other than no mem.
|
||||
//
|
||||
|
||||
|
||||
if (!NT_SUCCESS( Status)) {
|
||||
|
||||
NT_ASSERT( STATUS_INSUFFICIENT_RESOURCES == Status);
|
||||
CdRaiseStatus( IrpContext, Status);
|
||||
}
|
||||
|
||||
|
||||
Length = 0;
|
||||
|
||||
//
|
||||
@ -777,12 +777,12 @@ Return Value:
|
||||
OemNameOffset += 2;
|
||||
|
||||
if ((OemNameOffset + (BiasedShortName.Length / sizeof(WCHAR))) > 8) {
|
||||
|
||||
|
||||
OverflowBuffer = TRUE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
|
||||
OemNameOffset++;
|
||||
}
|
||||
|
||||
@ -839,7 +839,7 @@ Return Value:
|
||||
*ShortByteCount = Length;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOLEAN
|
||||
CdIsNameInExpression (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -883,7 +883,7 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
//
|
||||
// If there are wildcards in the expression then we call the
|
||||
// appropriate FsRtlRoutine.
|
||||
@ -950,7 +950,7 @@ Return Value:
|
||||
return Match;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ULONG
|
||||
CdShortNameDirentOffset (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -988,7 +988,7 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
//
|
||||
// Walk through the name until we either reach the end of the name
|
||||
// or find a tilde character.
|
||||
@ -1055,7 +1055,7 @@ Return Value:
|
||||
return ResultOffset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -1096,7 +1096,7 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
//
|
||||
// Figure out the minimum of the two lengths
|
||||
//
|
||||
|
@ -53,7 +53,7 @@ typedef CSHORT NODE_BYTE_SIZE;
|
||||
#ifndef SafeNodeType
|
||||
#define SafeNodeType(Ptr) (*((PNODE_TYPE_CODE)(Ptr)))
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// The following definitions are used to generate meaningful blue bugcheck
|
||||
// screens. On a bugcheck the file system can output 4 ulongs of useful
|
||||
|
@ -127,7 +127,7 @@ CdUpdatePathEntryFromRawPathEntry (
|
||||
#pragma alloc_text(PAGE, CdUpdatePathEntryName)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdLookupPathEntry (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -202,7 +202,7 @@ Return Value:
|
||||
&CompoundPathEntry->PathEntry );
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOLEAN
|
||||
CdLookupNextPathEntry (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -289,7 +289,7 @@ Return Value:
|
||||
// Now update the path entry with the values from the on-disk
|
||||
// structure.
|
||||
//
|
||||
|
||||
|
||||
return CdUpdatePathEntryFromRawPathEntry( IrpContext,
|
||||
PathEntry->Ordinal + 1,
|
||||
TRUE,
|
||||
@ -297,7 +297,7 @@ Return Value:
|
||||
PathEntry );
|
||||
}
|
||||
|
||||
_Success_(return != FALSE)
|
||||
_Success_(return != FALSE)
|
||||
BOOLEAN
|
||||
CdFindPathEntry (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -475,7 +475,7 @@ Return Value:
|
||||
return Found;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -521,7 +521,7 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
//
|
||||
// Map the new block and set the enumeration context to this
|
||||
// point. Allocate an auxilary buffer if necessary.
|
||||
@ -628,7 +628,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -663,7 +663,7 @@ Arguments:
|
||||
|
||||
Return Value:
|
||||
|
||||
TRUE if updated ok,
|
||||
TRUE if updated ok,
|
||||
FALSE if we've hit the end of the pathtable - zero name length && PT size is a multiple
|
||||
of blocksize. This is a workaround for some Video CDs. Win 9x works around this.
|
||||
|
||||
@ -676,31 +676,31 @@ Return Value:
|
||||
ULONG RemainingDataLength;
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
//
|
||||
// Check for a name length of zero. This is the first byte of the record,
|
||||
// and there must be at least one byte remaining in the buffer else we
|
||||
// and there must be at least one byte remaining in the buffer else we
|
||||
// wouldn't be here (caller would have spotted buffer end).
|
||||
//
|
||||
|
||||
|
||||
PathEntry->DirNameLen = CdRawPathIdLen( IrpContext, RawPathEntry );
|
||||
|
||||
|
||||
if (0 == PathEntry->DirNameLen) {
|
||||
|
||||
//
|
||||
// If we are in the last block, and the path table size (ie last block) is a
|
||||
// If we are in the last block, and the path table size (ie last block) is a
|
||||
// multiple of block size, then we will consider this the end of the path table
|
||||
// rather than raising an error. Workaround for NTI Cd Maker video CDs which
|
||||
// round path table length to blocksize multiple. In all other cases we consider
|
||||
// a zero length name to be corruption.
|
||||
//
|
||||
|
||||
if ( PathContext->LastDataBlock &&
|
||||
|
||||
if ( PathContext->LastDataBlock &&
|
||||
(0 == BlockOffset( IrpContext->Vcb, PathContext->DataLength))) {
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
CdRaiseStatus( IrpContext, STATUS_DISK_CORRUPT_ERROR );
|
||||
}
|
||||
|
||||
@ -708,7 +708,7 @@ Return Value:
|
||||
// Check if we should verify the path entry. If we are not in the last
|
||||
// data block then there is nothing to check.
|
||||
//
|
||||
|
||||
|
||||
if (PathContext->LastDataBlock && VerifyBounds) {
|
||||
|
||||
//
|
||||
@ -748,7 +748,7 @@ Return Value:
|
||||
//
|
||||
// We know we can safely access all of the fields of the raw path table at
|
||||
// this point.
|
||||
|
||||
|
||||
//
|
||||
// Bias the disk offset by the number of logical blocks
|
||||
//
|
||||
@ -772,7 +772,7 @@ Return Value:
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -935,7 +935,7 @@ Return Value:
|
||||
PathEntry->DirNameLen );
|
||||
|
||||
NT_ASSERT( Status == STATUS_SUCCESS );
|
||||
__analysis_assert( Status == STATUS_SUCCESS );
|
||||
__analysis_assert( Status == STATUS_SUCCESS );
|
||||
PathEntry->CdDirName.FileName.Length = (USHORT) Length;
|
||||
|
||||
} else {
|
||||
|
@ -104,7 +104,7 @@ Return Value:
|
||||
{
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
BOOLEAN PassThrough = FALSE;
|
||||
|
||||
|
||||
PIO_STACK_LOCATION IrpSp;
|
||||
|
||||
PVOLUME_DEVICE_OBJECT OurDeviceObject;
|
||||
@ -128,19 +128,19 @@ Return Value:
|
||||
OurDeviceObject = (PVOLUME_DEVICE_OBJECT) IrpSp->DeviceObject;
|
||||
|
||||
//
|
||||
// IO holds a handle reference on our VDO and holds the device lock, which
|
||||
// syncs us against mounts/verifies. However we hold no reference on the
|
||||
// volume, which may already have been torn down (and the Vpb freed), for
|
||||
// IO holds a handle reference on our VDO and holds the device lock, which
|
||||
// syncs us against mounts/verifies. However we hold no reference on the
|
||||
// volume, which may already have been torn down (and the Vpb freed), for
|
||||
// example by a force dismount. Check for this condition. We must hold this
|
||||
// lock until the pnp worker functions take additional locks/refs on the Vcb.
|
||||
//
|
||||
|
||||
CdAcquireCdData( IrpContext);
|
||||
|
||||
|
||||
//
|
||||
// Make sure this device object really is big enough to be a volume device
|
||||
// object. If it isn't, we need to get out before we try to reference some
|
||||
// field that takes us past the end of an ordinary device object.
|
||||
// field that takes us past the end of an ordinary device object.
|
||||
//
|
||||
|
||||
#ifdef _MSC_VER
|
||||
@ -148,11 +148,11 @@ Return Value:
|
||||
#endif
|
||||
if (OurDeviceObject->DeviceObject.Size != sizeof(VOLUME_DEVICE_OBJECT) ||
|
||||
NodeType( &OurDeviceObject->Vcb ) != CDFS_NTC_VCB) {
|
||||
|
||||
|
||||
//
|
||||
// We were called with something we don't understand.
|
||||
//
|
||||
|
||||
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
CdReleaseCdData( IrpContext);
|
||||
CdCompleteRequest( IrpContext, Irp, Status );
|
||||
@ -171,7 +171,7 @@ Return Value:
|
||||
// Check that the Vcb hasn't already been deleted. If so, just pass the
|
||||
// request through to the driver below, we don't need to do anything.
|
||||
//
|
||||
|
||||
|
||||
if (NULL == Vcb->Vpb) {
|
||||
|
||||
PassThrough = TRUE;
|
||||
@ -181,16 +181,16 @@ Return Value:
|
||||
//
|
||||
// Case on the minor code.
|
||||
//
|
||||
|
||||
|
||||
switch ( IrpSp->MinorFunction ) {
|
||||
|
||||
case IRP_MN_QUERY_REMOVE_DEVICE:
|
||||
|
||||
|
||||
Status = CdPnpQueryRemove( IrpContext, Irp, Vcb );
|
||||
break;
|
||||
|
||||
|
||||
case IRP_MN_SURPRISE_REMOVAL:
|
||||
|
||||
|
||||
Status = CdPnpSurpriseRemove( IrpContext, Irp, Vcb );
|
||||
break;
|
||||
|
||||
@ -200,7 +200,7 @@ Return Value:
|
||||
break;
|
||||
|
||||
case IRP_MN_CANCEL_REMOVE_DEVICE:
|
||||
|
||||
|
||||
Status = CdPnpCancelRemove( IrpContext, Irp, Vcb );
|
||||
break;
|
||||
|
||||
@ -219,18 +219,18 @@ Return Value:
|
||||
// Just pass the IRP on. As we do not need to be in the
|
||||
// way on return, ellide ourselves out of the stack.
|
||||
//
|
||||
|
||||
|
||||
IoSkipCurrentIrpStackLocation( Irp );
|
||||
|
||||
Status = IoCallDriver(Vcb->TargetDeviceObject, Irp);
|
||||
|
||||
|
||||
//
|
||||
// Cleanup our Irp Context. The driver has completed the Irp.
|
||||
//
|
||||
|
||||
|
||||
CdCompleteRequest( IrpContext, NULL, STATUS_SUCCESS );
|
||||
}
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -251,13 +251,13 @@ Routine Description:
|
||||
is responsible for answering whether there are any reasons it sees
|
||||
that the volume can not go away (and the device removed). Initiation
|
||||
of the dismount begins when we answer yes to this question.
|
||||
|
||||
|
||||
Query will be followed by a Cancel or Remove.
|
||||
|
||||
Arguments:
|
||||
|
||||
Irp - Supplies the Irp to process
|
||||
|
||||
|
||||
Vcb - Supplies the volume being queried.
|
||||
|
||||
Return Value:
|
||||
@ -280,7 +280,7 @@ Return Value:
|
||||
// underlying storage stack is undefined (and may block)
|
||||
// until the bounding CANCEL or REMOVE is sent.
|
||||
//
|
||||
// Acquire the global resource so that we can try to vaporize the volume,
|
||||
// Acquire the global resource so that we can try to vaporize the volume,
|
||||
// and the vcb resource itself.
|
||||
//
|
||||
|
||||
@ -289,11 +289,11 @@ Return Value:
|
||||
//
|
||||
// Drop a reference on the Vcb to keep it around after we drop the locks.
|
||||
//
|
||||
|
||||
|
||||
CdLockVcb( IrpContext, Vcb);
|
||||
Vcb->VcbReference += 1;
|
||||
CdUnlockVcb( IrpContext, Vcb);
|
||||
|
||||
|
||||
CdReleaseCdData( IrpContext);
|
||||
|
||||
Status = CdLockVolumeInternal( IrpContext, Vcb, NULL );
|
||||
@ -301,27 +301,27 @@ Return Value:
|
||||
//
|
||||
// Reacquire the global lock, which means dropping the Vcb resource.
|
||||
//
|
||||
|
||||
|
||||
CdReleaseVcb( IrpContext, Vcb );
|
||||
|
||||
|
||||
CdAcquireCdData( IrpContext );
|
||||
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
|
||||
|
||||
//
|
||||
// Remove our extra reference.
|
||||
//
|
||||
|
||||
|
||||
CdLockVcb( IrpContext, Vcb);
|
||||
Vcb->VcbReference -= 1;
|
||||
CdUnlockVcb( IrpContext, Vcb);
|
||||
|
||||
|
||||
if (NT_SUCCESS( Status )) {
|
||||
|
||||
//
|
||||
// We need to pass this down before starting the dismount, which
|
||||
// could disconnect us immediately from the stack.
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
// Get the next stack location, and copy over the stack location
|
||||
//
|
||||
@ -331,7 +331,7 @@ Return Value:
|
||||
//
|
||||
// Set up the completion routine
|
||||
//
|
||||
|
||||
|
||||
KeInitializeEvent( &Event, NotificationEvent, FALSE );
|
||||
IoSetCompletionRoutine( Irp,
|
||||
CdPnpCompletionRoutine,
|
||||
@ -374,19 +374,19 @@ Return Value:
|
||||
//
|
||||
|
||||
if (NT_SUCCESS( Status )) {
|
||||
|
||||
|
||||
VcbPresent = CdCheckForDismount( IrpContext, Vcb, TRUE );
|
||||
|
||||
|
||||
NT_ASSERT( !VcbPresent || Vcb->VcbCondition == VcbDismountInProgress );
|
||||
}
|
||||
|
||||
//
|
||||
// Note: Normally everything will complete and the internal streams will
|
||||
// Note: Normally everything will complete and the internal streams will
|
||||
// vaporise. However there is some code in the system which drops additional
|
||||
// references on fileobjects, including our internal stream file objects,
|
||||
// for (WMI) tracing purposes. If that happens to run concurrently with our
|
||||
// teardown, our internal streams will not vaporise until those references
|
||||
// are removed. So it's possible that the volume still remains at this
|
||||
// are removed. So it's possible that the volume still remains at this
|
||||
// point. The pnp query remove will fail due to our references on the device.
|
||||
// To be cleaner we will return an error here. We could pend the pnp
|
||||
// IRP until the volume goes away, but since we don't know when that will
|
||||
@ -405,11 +405,11 @@ Return Value:
|
||||
Status = STATUS_DEVICE_BUSY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Release the Vcb if it could still remain.
|
||||
//
|
||||
|
||||
|
||||
if (VcbPresent) {
|
||||
|
||||
CdReleaseVcb( IrpContext, Vcb );
|
||||
@ -419,7 +419,7 @@ Return Value:
|
||||
}
|
||||
|
||||
CdReleaseCdData( IrpContext );
|
||||
|
||||
|
||||
//
|
||||
// Cleanup our IrpContext and complete the IRP if neccesary.
|
||||
//
|
||||
@ -450,7 +450,7 @@ Routine Description:
|
||||
Arguments:
|
||||
|
||||
Irp - Supplies the Irp to process
|
||||
|
||||
|
||||
Vcb - Supplies the volume being removed.
|
||||
|
||||
Return Value:
|
||||
@ -478,12 +478,12 @@ Return Value:
|
||||
// for a REMOVE in the first two cases, as we try to intiate
|
||||
// dismount.
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
// Acquire the global resource so that we can try to vaporize
|
||||
// the volume, and the vcb resource itself.
|
||||
//
|
||||
|
||||
|
||||
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
|
||||
|
||||
//
|
||||
@ -502,22 +502,22 @@ Return Value:
|
||||
if (!NT_SUCCESS( Status )) {
|
||||
|
||||
CdLockVcb( IrpContext, Vcb );
|
||||
|
||||
|
||||
if (Vcb->VcbCondition != VcbDismountInProgress) {
|
||||
|
||||
|
||||
CdUpdateVcbCondition( Vcb, VcbInvalid);
|
||||
}
|
||||
|
||||
|
||||
CdUnlockVcb( IrpContext, Vcb );
|
||||
|
||||
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// We need to pass this down before starting the dismount, which
|
||||
// could disconnect us immediately from the stack.
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
// Get the next stack location, and copy over the stack location
|
||||
//
|
||||
@ -562,13 +562,13 @@ Return Value:
|
||||
// couldn't get off of it immediately.
|
||||
//
|
||||
|
||||
|
||||
|
||||
VcbPresent = CdCheckForDismount( IrpContext, Vcb, TRUE );
|
||||
|
||||
//
|
||||
// Release the Vcb if it could still remain.
|
||||
//
|
||||
|
||||
|
||||
if (VcbPresent) {
|
||||
|
||||
CdReleaseVcb( IrpContext, Vcb );
|
||||
@ -578,7 +578,7 @@ Return Value:
|
||||
}
|
||||
|
||||
CdReleaseCdData( IrpContext );
|
||||
|
||||
|
||||
//
|
||||
// Cleanup our IrpContext and complete the IRP.
|
||||
//
|
||||
@ -605,17 +605,17 @@ Routine Description:
|
||||
type of notification that the underlying storage device for the volume we
|
||||
have is gone, and is excellent indication that the volume will never reappear.
|
||||
The filesystem is responsible for initiation or completion the dismount.
|
||||
|
||||
|
||||
For the most part, only "real" drivers care about the distinction of a
|
||||
surprise remove, which is a result of our noticing that a user (usually)
|
||||
physically reached into the machine and pulled something out.
|
||||
|
||||
|
||||
Surprise will be followed by a Remove when all references have been shut down.
|
||||
|
||||
Arguments:
|
||||
|
||||
Irp - Supplies the Irp to process
|
||||
|
||||
|
||||
Vcb - Supplies the volume being removed.
|
||||
|
||||
Return Value:
|
||||
@ -632,14 +632,14 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
ASSERT_EXCLUSIVE_CDDATA;
|
||||
|
||||
|
||||
//
|
||||
// SURPRISE - a device was physically yanked away without
|
||||
// any warning. This means external forces.
|
||||
//
|
||||
|
||||
|
||||
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
|
||||
|
||||
|
||||
//
|
||||
// Invalidate the volume right now.
|
||||
//
|
||||
@ -647,21 +647,21 @@ Return Value:
|
||||
// on the volume fail and grease the rails toward dismount.
|
||||
// By definition there is no going back from a SURPRISE.
|
||||
//
|
||||
|
||||
|
||||
CdLockVcb( IrpContext, Vcb );
|
||||
|
||||
|
||||
if (Vcb->VcbCondition != VcbDismountInProgress) {
|
||||
|
||||
|
||||
CdUpdateVcbCondition( Vcb, VcbInvalid);
|
||||
}
|
||||
|
||||
|
||||
CdUnlockVcb( IrpContext, Vcb );
|
||||
|
||||
|
||||
//
|
||||
// We need to pass this down before starting the dismount, which
|
||||
// could disconnect us immediately from the stack.
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
// Get the next stack location, and copy over the stack location
|
||||
//
|
||||
@ -696,20 +696,20 @@ Return Value:
|
||||
|
||||
Status = Irp->IoStatus.Status;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Now make our dismount happen. This may not vaporize the
|
||||
// Vcb, of course, since there could be any number of handles
|
||||
// outstanding since this is an out of band notification.
|
||||
//
|
||||
|
||||
|
||||
|
||||
VcbPresent = CdCheckForDismount( IrpContext, Vcb, TRUE );
|
||||
|
||||
|
||||
//
|
||||
// Release the Vcb if it could still remain.
|
||||
//
|
||||
|
||||
|
||||
if (VcbPresent) {
|
||||
|
||||
CdReleaseVcb( IrpContext, Vcb );
|
||||
@ -719,7 +719,7 @@ Return Value:
|
||||
}
|
||||
|
||||
CdReleaseCdData( IrpContext );
|
||||
|
||||
|
||||
//
|
||||
// Cleanup our IrpContext and complete the IRP.
|
||||
//
|
||||
@ -746,11 +746,11 @@ Routine Description:
|
||||
notification that a previously proposed remove (query) was eventually
|
||||
vetoed by a component. The filesystem is responsible for cleaning up
|
||||
and getting ready for more IO.
|
||||
|
||||
|
||||
Arguments:
|
||||
|
||||
Irp - Supplies the Irp to process
|
||||
|
||||
|
||||
Vcb - Supplies the volume being removed.
|
||||
|
||||
Return Value:
|
||||
@ -781,7 +781,7 @@ Return Value:
|
||||
// with respect to the Vcb getting torn apart - merely referencing
|
||||
// the volume device object is insufficient to keep us intact.
|
||||
//
|
||||
|
||||
|
||||
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
|
||||
CdReleaseCdData( IrpContext);
|
||||
|
||||
|
@ -47,7 +47,7 @@ CdInsertNameLink (
|
||||
#pragma alloc_text(PAGE, CdRemovePrefix)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdInsertPrefix (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -202,7 +202,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdRemovePrefix (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -228,9 +228,9 @@ Return Value:
|
||||
|
||||
{
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
//
|
||||
// Start with the short name prefix entry.
|
||||
//
|
||||
@ -282,7 +282,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
@ -456,7 +456,7 @@ Return Value:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -559,7 +559,7 @@ Return Value:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
|
@ -63,7 +63,7 @@ __pragma(warning(suppress: 6320)) \
|
||||
#pragma alloc_text(PAGE, CdCommonRead)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
NTSTATUS
|
||||
@ -116,7 +116,7 @@ Return Value:
|
||||
BOOLEAN ReleaseFile = TRUE;
|
||||
|
||||
CD_IO_CONTEXT LocalIoContext;
|
||||
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
//
|
||||
@ -186,9 +186,9 @@ Return Value:
|
||||
if (PagingIo) {
|
||||
|
||||
CdAcquireFileSharedStarveExclusive( IrpContext, Fcb );
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
CdAcquireFileShared( IrpContext, Fcb );
|
||||
}
|
||||
|
||||
@ -199,13 +199,13 @@ Return Value:
|
||||
_SEH2_TRY {
|
||||
|
||||
//
|
||||
// Verify the Fcb. Allow reads if this is a DASD handle that is
|
||||
// Verify the Fcb. Allow reads if this is a DASD handle that is
|
||||
// dismounting the volume.
|
||||
//
|
||||
|
||||
if ((TypeOfOpen != UserVolumeOpen) || (NULL == Ccb) ||
|
||||
!FlagOn( Ccb->Flags, CCB_FLAG_DISMOUNT_ON_CLOSE)) {
|
||||
|
||||
|
||||
CdVerifyFcbOperation( IrpContext, Fcb );
|
||||
}
|
||||
|
||||
@ -435,7 +435,7 @@ Return Value:
|
||||
} else if (ReadByteCount != ByteCount) {
|
||||
|
||||
CdMapUserBuffer( IrpContext, &UserBuffer);
|
||||
|
||||
|
||||
SafeZeroMemory( IrpContext,
|
||||
Add2Ptr( UserBuffer,
|
||||
ByteCount,
|
||||
|
@ -31,7 +31,7 @@ Abstract:
|
||||
#pragma alloc_text(PAGE, CdReleaseFromCache)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
_When_(Type == AcquireExclusive && return != FALSE, _Acquires_exclusive_lock_(*Resource))
|
||||
@ -130,7 +130,7 @@ Return Value:
|
||||
return Acquired;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
_When_(return!=0, _Acquires_shared_lock_(*Fcb->Resource))
|
||||
@ -175,7 +175,7 @@ Return Value:
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
_Releases_lock_(*Fcb->Resource)
|
||||
VOID
|
||||
@ -208,11 +208,11 @@ Return Value:
|
||||
|
||||
NT_ASSERT(IoGetTopLevelIrp() == (PIRP)FSRTL_CACHE_TOP_LEVEL_IRP);
|
||||
IoSetTopLevelIrp( NULL );
|
||||
|
||||
|
||||
ExReleaseResourceLite( Fcb->Resource );
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOLEAN
|
||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||
CdNoopAcquire (
|
||||
@ -244,11 +244,11 @@ Return Value:
|
||||
|
||||
UNREFERENCED_PARAMETER( Fcb );
|
||||
UNREFERENCED_PARAMETER( Wait );
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||
CdNoopRelease (
|
||||
@ -314,7 +314,7 @@ Return Value:
|
||||
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
NT_ASSERT( CallbackData->Operation == FS_FILTER_ACQUIRE_FOR_SECTION_SYNCHRONIZATION );
|
||||
NT_ASSERT( CallbackData->SizeOfFsFilterCallbackData == sizeof(FS_FILTER_CALLBACK_DATA) );
|
||||
|
||||
@ -330,14 +330,14 @@ Return Value:
|
||||
|
||||
ExAcquireResourceExclusiveLite( &((PFCB) FileObject->FsContext)->FcbNonpaged->FcbResource,
|
||||
TRUE );
|
||||
|
||||
|
||||
//
|
||||
// Take the File resource shared. We need this later on when MM calls
|
||||
// QueryStandardInfo to get the file size.
|
||||
// Take the File resource shared. We need this later on when MM calls
|
||||
// QueryStandardInfo to get the file size.
|
||||
//
|
||||
// If we don't use StarveExclusive, then we can get wedged behind an
|
||||
// exclusive waiter who is waiting on someone else holding it shared in the
|
||||
// read->initializecachemap path (which calls createsection) who is in turn
|
||||
// If we don't use StarveExclusive, then we can get wedged behind an
|
||||
// exclusive waiter who is waiting on someone else holding it shared in the
|
||||
// read->initializecachemap path (which calls createsection) who is in turn
|
||||
// waiting on us to finish the create section.
|
||||
//
|
||||
|
||||
@ -362,7 +362,7 @@ Return Value:
|
||||
UNREFERENCED_PARAMETER( CompletionContext );
|
||||
}
|
||||
|
||||
|
||||
|
||||
_Function_class_(FAST_IO_RELEASE_FILE)
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
|
@ -236,7 +236,7 @@ UNICODE_STRING CdInternalStreamNames[] = {
|
||||
{ 2, 2, L"\\"}
|
||||
};
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdInitializeVcb (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -314,13 +314,13 @@ Return Value:
|
||||
|
||||
InitializeListHead( &Vcb->DirNotifyList );
|
||||
FsRtlNotifyInitializeSync( &Vcb->NotifySync );
|
||||
|
||||
|
||||
//
|
||||
// Pick up a VPB right now so we know we can pull this filesystem stack
|
||||
// off of the storage stack on demand. This can raise - if it does,
|
||||
// off of the storage stack on demand. This can raise - if it does,
|
||||
// uninitialize the notify structures before returning.
|
||||
//
|
||||
|
||||
|
||||
_SEH2_TRY {
|
||||
|
||||
Vcb->SwapVpb = FsRtlAllocatePoolWithTag( CdNonPagedPool,
|
||||
@ -330,7 +330,7 @@ Return Value:
|
||||
_SEH2_FINALLY {
|
||||
|
||||
if (_SEH2_AbnormalTermination()) {
|
||||
|
||||
|
||||
FsRtlNotifyUninitializeSync( &Vcb->NotifySync );
|
||||
}
|
||||
} _SEH2_END;
|
||||
@ -340,7 +340,7 @@ Return Value:
|
||||
//
|
||||
|
||||
RtlZeroMemory( Vcb->SwapVpb, sizeof( VPB ) );
|
||||
|
||||
|
||||
//
|
||||
// Initialize the resource variable for the Vcb and files.
|
||||
//
|
||||
@ -431,7 +431,7 @@ Return Value:
|
||||
CdUpdateMediaChangeCount( Vcb, MediaChangeCount);
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdUpdateVcbFromVolDescriptor (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -496,7 +496,7 @@ Return Value:
|
||||
//
|
||||
// We no longer accept media where blocksize != sector size.
|
||||
//
|
||||
|
||||
|
||||
if (Vcb->BlockSize != SECTOR_SIZE) {
|
||||
|
||||
CdRaiseStatus( IrpContext, STATUS_DISK_CORRUPT_ERROR );
|
||||
@ -505,7 +505,7 @@ Return Value:
|
||||
Vcb->BlocksPerSector = SECTOR_SIZE / Vcb->BlockSize;
|
||||
Vcb->BlockMask = Vcb->BlockSize - 1;
|
||||
Vcb->BlockInverseMask = ~Vcb->BlockMask;
|
||||
|
||||
|
||||
Vcb->BlockToSectorShift = 0;
|
||||
Vcb->BlockToByteShift = SECTOR_SHIFT;
|
||||
|
||||
@ -659,16 +659,16 @@ Return Value:
|
||||
|
||||
McbEntry = Vcb->VolumeDasdFcb->Mcb.McbArray;
|
||||
|
||||
McbEntry->FileOffset =
|
||||
McbEntry->FileOffset =
|
||||
McbEntry->DiskOffset = 0;
|
||||
|
||||
|
||||
McbEntry->ByteCount = Vcb->VolumeDasdFcb->AllocationSize.QuadPart;
|
||||
|
||||
|
||||
McbEntry->DataBlockByteCount =
|
||||
McbEntry->TotalBlockByteCount = McbEntry->ByteCount;
|
||||
|
||||
|
||||
Vcb->VolumeDasdFcb->Mcb.CurrentEntryCount = 1;
|
||||
|
||||
|
||||
CdUnlockFcb( IrpContext, Vcb->VolumeDasdFcb );
|
||||
|
||||
//
|
||||
@ -864,14 +864,14 @@ Return Value:
|
||||
|
||||
SetFlag( Vcb->VcbState, VCB_STATE_ISO );
|
||||
}
|
||||
|
||||
|
||||
} _SEH2_FINALLY {
|
||||
|
||||
if (UnlockVcb) { CdUnlockVcb( IrpContext, Vcb ); }
|
||||
} _SEH2_END;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdDeleteVcb (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -901,15 +901,15 @@ Return Value:
|
||||
|
||||
ASSERT_EXCLUSIVE_CDDATA;
|
||||
ASSERT_EXCLUSIVE_VCB( Vcb );
|
||||
|
||||
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
//
|
||||
// Chuck the backpocket Vpb we kept just in case.
|
||||
//
|
||||
|
||||
CdFreePool( &Vcb->SwapVpb );
|
||||
|
||||
|
||||
//
|
||||
// If there is a Vpb then we must delete it ourselves.
|
||||
//
|
||||
@ -921,7 +921,7 @@ Return Value:
|
||||
//
|
||||
|
||||
if (Vcb->TargetDeviceObject != NULL) {
|
||||
|
||||
|
||||
ObDereferenceObject( Vcb->TargetDeviceObject );
|
||||
}
|
||||
|
||||
@ -981,7 +981,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
PFCB
|
||||
CdCreateFcb (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -1075,7 +1075,7 @@ Return Value:
|
||||
default:
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma prefast( suppress: __WARNING_USE_OTHER_FUNCTION, "This is a bug." )
|
||||
#pragma prefast( suppress: __WARNING_USE_OTHER_FUNCTION, "This is a bug." )
|
||||
#endif
|
||||
CdBugCheck( 0, 0, 0 );
|
||||
}
|
||||
@ -1115,7 +1115,7 @@ Return Value:
|
||||
//
|
||||
|
||||
ExInitializeFastMutex( &NewFcb->FcbNonpaged->AdvancedFcbHeaderMutex );
|
||||
FsRtlSetupAdvancedHeader( &NewFcb->Header,
|
||||
FsRtlSetupAdvancedHeader( &NewFcb->Header,
|
||||
&NewFcb->FcbNonpaged->AdvancedFcbHeaderMutex );
|
||||
|
||||
if (NodeTypeCode == CDFS_NTC_FCB_DATA) {
|
||||
@ -1131,7 +1131,7 @@ Return Value:
|
||||
return NewFcb;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdInitializeFcbFromPathEntry (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -1220,7 +1220,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdInitializeFcbFromFileContext (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -1400,7 +1400,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
PCCB
|
||||
CdCreateCcb (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -1431,7 +1431,7 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
//
|
||||
// Allocate and initialize the structure.
|
||||
//
|
||||
@ -1457,7 +1457,7 @@ Return Value:
|
||||
return NewCcb;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdDeleteCcb (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -1483,7 +1483,7 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
if (Ccb->SearchExpression.FileName.Buffer != NULL) {
|
||||
|
||||
CdFreePool( &Ccb->SearchExpression.FileName.Buffer );
|
||||
@ -1493,7 +1493,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_When_(RaiseOnError || return, _At_(Fcb->FileLock, _Post_notnull_))
|
||||
_When_(RaiseOnError, _At_(IrpContext, _Pre_notnull_))
|
||||
BOOLEAN
|
||||
@ -1554,7 +1554,7 @@ Return Value:
|
||||
//
|
||||
|
||||
if (FileLock == NULL) {
|
||||
|
||||
|
||||
if (RaiseOnError) {
|
||||
|
||||
NT_ASSERT( ARGUMENT_PRESENT( IrpContext ));
|
||||
@ -1568,7 +1568,7 @@ Return Value:
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_Ret_valid_ PIRP_CONTEXT
|
||||
CdCreateIrpContext (
|
||||
_In_ PIRP Irp,
|
||||
@ -1623,11 +1623,11 @@ Return Value:
|
||||
}
|
||||
|
||||
NT_ASSERT( IrpSp->FileObject != NULL ||
|
||||
|
||||
|
||||
(IrpSp->MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL &&
|
||||
IrpSp->MinorFunction == IRP_MN_USER_FS_REQUEST &&
|
||||
IrpSp->Parameters.FileSystemControl.FsControlCode == FSCTL_INVALIDATE_VOLUMES) ||
|
||||
|
||||
|
||||
(IrpSp->MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL &&
|
||||
IrpSp->MinorFunction == IRP_MN_MOUNT_VOLUME ) ||
|
||||
|
||||
@ -1698,7 +1698,7 @@ Return Value:
|
||||
#endif
|
||||
|
||||
NewIrpContext->Vcb = &((PVOLUME_DEVICE_OBJECT) IrpSp->DeviceObject)->Vcb;
|
||||
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
@ -1728,7 +1728,7 @@ Return Value:
|
||||
return NewIrpContext;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdCleanupIrpContext (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -1834,7 +1834,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
CdInitializeStackIrpContext (
|
||||
_Out_ PIRP_CONTEXT IrpContext,
|
||||
@ -1910,7 +1910,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
@ -2102,7 +2102,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
PFCB
|
||||
CdLookupFcbTable (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -2150,7 +2150,7 @@ Return Value:
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
}
|
||||
|
||||
|
||||
|
||||
PFCB
|
||||
CdGetNextFcb (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -2185,7 +2185,7 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
Fcb = (PFCB) RtlEnumerateGenericTableWithoutSplaying( &Vcb->FcbTable, RestartKey );
|
||||
|
||||
if (Fcb != NULL) {
|
||||
@ -2196,7 +2196,7 @@ Return Value:
|
||||
return Fcb;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NTSTATUS
|
||||
CdProcessToc (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
@ -2260,7 +2260,7 @@ Return Value:
|
||||
// Zero the command block. This conveniently corresponds to an
|
||||
// LBA mode READ_TOC request.
|
||||
//
|
||||
|
||||
|
||||
RtlZeroMemory( &Command, sizeof( Command));
|
||||
|
||||
RetryReadToc:
|
||||
@ -2361,7 +2361,7 @@ RetryReadToc:
|
||||
// Knock 2.5 minutes off the current track to hide the final leadin.
|
||||
// 2.5 min = 150 sec = (x 75) 11250 frames (sectors).
|
||||
//
|
||||
|
||||
|
||||
SwapCopyUchar4( &Address, &Track->Address);
|
||||
Address -= 11250;
|
||||
SwapCopyUchar4( &Track->Address, &Address);
|
||||
@ -2415,7 +2415,7 @@ RetryReadToc:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -2546,7 +2546,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -2575,9 +2575,9 @@ Return Value:
|
||||
PFCB_NONPAGED FcbNonpaged;
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
//
|
||||
// Allocate the non-paged pool and initialize the various
|
||||
// synchronization objects.
|
||||
@ -2599,7 +2599,7 @@ Return Value:
|
||||
return FcbNonpaged;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -2628,9 +2628,9 @@ Return Value:
|
||||
|
||||
{
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
ExDeleteResourceLite( &FcbNonpaged->FcbResource );
|
||||
|
||||
CdDeallocateFcbNonpaged( IrpContext, *(PVOID*)&FcbNonpaged );/* ReactOS Change: GCC "passing argument 1 from incompatible pointer type" */
|
||||
@ -2638,7 +2638,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -2696,7 +2696,7 @@ Return Value:
|
||||
UNREFERENCED_PARAMETER( FcbTable );
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -2728,13 +2728,13 @@ Return Value:
|
||||
|
||||
{
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
UNREFERENCED_PARAMETER( FcbTable );
|
||||
|
||||
return( FsRtlAllocatePoolWithTag( CdPagedPool, ByteSize, TAG_FCB_TABLE ));
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -2770,7 +2770,7 @@ Return Value:
|
||||
UNREFERENCED_PARAMETER( FcbTable );
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -2814,7 +2814,7 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
//
|
||||
// Check if there are two tracks or fewer.
|
||||
//
|
||||
@ -2834,10 +2834,10 @@ Return Value:
|
||||
//
|
||||
|
||||
while (ThisTrack != LastTrack) {
|
||||
|
||||
|
||||
SwapCopyUchar4( &Address, ThisTrack->Address);
|
||||
CdLbnToMmSsFf( Address, (PUCHAR)&MsfAddress);
|
||||
|
||||
|
||||
SerialNumber += MsfAddress;
|
||||
ThisTrack += 1;
|
||||
}
|
||||
|
@ -107,9 +107,9 @@ Return Value:
|
||||
//
|
||||
// Acquire the Vcb so we're working with a stable VcbCondition.
|
||||
//
|
||||
|
||||
|
||||
CdAcquireVcbShared( IrpContext, Vcb, FALSE);
|
||||
|
||||
|
||||
//
|
||||
// If the verify operation completed it will return
|
||||
// either STATUS_SUCCESS or STATUS_WRONG_VOLUME, exactly.
|
||||
@ -129,12 +129,12 @@ Return Value:
|
||||
|
||||
//
|
||||
// If the verify succeeded, but our volume is not mounted,
|
||||
// then some other volume is on the device.
|
||||
// then some other volume is on the device.
|
||||
//
|
||||
|
||||
Status = STATUS_WRONG_VOLUME;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Do a quick unprotected check here. The routine will do
|
||||
// a safe check. After here we can release the resource.
|
||||
@ -188,7 +188,7 @@ Return Value:
|
||||
//
|
||||
// Fill in the device object if required.
|
||||
//
|
||||
|
||||
|
||||
if (IoIsErrorUserInduced( Status ) ) {
|
||||
|
||||
IoSetHardErrorOrVerifyDevice( Irp, DeviceToVerify );
|
||||
@ -220,7 +220,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
BOOLEAN
|
||||
@ -248,14 +248,14 @@ Routine Description:
|
||||
Arguments:
|
||||
|
||||
Vcb - Vcb for the volume to try to dismount.
|
||||
|
||||
|
||||
Force - Whether we will force this volume to be dismounted.
|
||||
|
||||
Return Value:
|
||||
|
||||
BOOLEAN - True if the Vcb was not gone by the time this function finished,
|
||||
False if it was deleted.
|
||||
|
||||
|
||||
This is only a trustworthy indication to the caller if it had the vcb
|
||||
exclusive itself.
|
||||
|
||||
@ -397,10 +397,10 @@ Return Value:
|
||||
//
|
||||
// Flag this to avoid the VPB spinlock in future passes.
|
||||
//
|
||||
|
||||
|
||||
SetFlag( Vcb->VcbState, VCB_STATE_VPB_NOT_ON_DEVICE);
|
||||
}
|
||||
|
||||
|
||||
IoReleaseVpbSpinLock( SavedIrql );
|
||||
|
||||
return Marked;
|
||||
@ -448,7 +448,7 @@ Return Value:
|
||||
//
|
||||
|
||||
if ((Vcb->VcbCondition == VcbInvalid) ||
|
||||
((Vcb->VcbCondition == VcbDismountInProgress) &&
|
||||
((Vcb->VcbCondition == VcbDismountInProgress) &&
|
||||
(IrpContext->MajorFunction != IRP_MJ_CREATE))) {
|
||||
|
||||
if (FlagOn( Vcb->VcbState, VCB_STATE_DISMOUNTED )) {
|
||||
@ -460,15 +460,15 @@ Return Value:
|
||||
CdRaiseStatus( IrpContext, STATUS_FILE_INVALID );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Capture the real device verify state.
|
||||
//
|
||||
|
||||
|
||||
DevMarkedForVerify = CdRealDevNeedsVerify( Vcb->Vpb->RealDevice);
|
||||
|
||||
|
||||
if (FlagOn( Vcb->VcbState, VCB_STATE_REMOVABLE_MEDIA ) && !DevMarkedForVerify) {
|
||||
|
||||
|
||||
//
|
||||
// If the media is removable and the verify volume flag in the
|
||||
// device object is not set then we want to ping the device
|
||||
@ -487,11 +487,11 @@ Return Value:
|
||||
&Iosb );
|
||||
|
||||
if (Iosb.Information != sizeof(ULONG)) {
|
||||
|
||||
|
||||
//
|
||||
// Be safe about the count in case the driver didn't fill it in
|
||||
//
|
||||
|
||||
|
||||
MediaChangeCount = 0;
|
||||
}
|
||||
|
||||
@ -504,9 +504,9 @@ Return Value:
|
||||
// set, but could be due to hardware condition)
|
||||
// 3. Media change count doesn't match the one in the Vcb
|
||||
//
|
||||
|
||||
|
||||
if (((Vcb->VcbCondition == VcbMounted) &&
|
||||
CdIsRawDevice( IrpContext, Status ))
|
||||
CdIsRawDevice( IrpContext, Status ))
|
||||
||
|
||||
(Status == STATUS_VERIFY_REQUIRED)
|
||||
||
|
||||
@ -532,13 +532,13 @@ Return Value:
|
||||
// do so only when we've actually completed a verify at a particular
|
||||
// change count value.
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// This is the 4th verify case.
|
||||
//
|
||||
// We ALWAYS force CREATE requests on unmounted volumes through the
|
||||
// We ALWAYS force CREATE requests on unmounted volumes through the
|
||||
// verify path. These requests could have been in limbo between
|
||||
// IoCheckMountedVpb and us when a verify/mount took place and caused
|
||||
// a completely different fs/volume to be mounted. In this case the
|
||||
@ -567,14 +567,14 @@ Return Value:
|
||||
//
|
||||
// Raise the verify / error if neccessary.
|
||||
//
|
||||
|
||||
|
||||
if (ForceVerify || DevMarkedForVerify || !NT_SUCCESS( Status)) {
|
||||
|
||||
|
||||
IoSetHardErrorOrVerifyDevice( IrpContext->Irp,
|
||||
Vcb->Vpb->RealDevice );
|
||||
|
||||
CdRaiseStatus( IrpContext, (ForceVerify || DevMarkedForVerify)
|
||||
? STATUS_VERIFY_REQUIRED
|
||||
|
||||
CdRaiseStatus( IrpContext, (ForceVerify || DevMarkedForVerify)
|
||||
? STATUS_VERIFY_REQUIRED
|
||||
: Status);
|
||||
}
|
||||
|
||||
@ -604,7 +604,7 @@ Return Value:
|
||||
CdRaiseStatus( IrpContext, STATUS_FILE_INVALID );
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
/* ReactOS Change: GCC "enumeration value not handled in switch" */
|
||||
default: break;
|
||||
}
|
||||
@ -644,18 +644,18 @@ Return Value:
|
||||
PIRP Irp;
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
//
|
||||
// Check that the fileobject has not been cleaned up.
|
||||
//
|
||||
|
||||
|
||||
if ( ARGUMENT_PRESENT( IrpContext )) {
|
||||
|
||||
PFILE_OBJECT FileObject;
|
||||
|
||||
Irp = IrpContext->Irp;
|
||||
FileObject = IoGetCurrentIrpStackLocation( Irp)->FileObject;
|
||||
|
||||
|
||||
if ( FileObject && FlagOn( FileObject->Flags, FO_CLEANUP_COMPLETE)) {
|
||||
|
||||
PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( Irp );
|
||||
@ -664,7 +664,7 @@ Return Value:
|
||||
// Following FAT, we allow certain operations even on cleaned up
|
||||
// file objects. Everything else, we fail.
|
||||
//
|
||||
|
||||
|
||||
if ( (FlagOn(Irp->Flags, IRP_PAGING_IO)) ||
|
||||
(IrpSp->MajorFunction == IRP_MJ_CLOSE ) ||
|
||||
(IrpSp->MajorFunction == IRP_MJ_QUERY_INFORMATION) ||
|
||||
@ -695,7 +695,7 @@ Return Value:
|
||||
CdRaiseStatus( IrpContext, STATUS_VOLUME_DISMOUNTED );
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
CdRaiseStatus( IrpContext, STATUS_FILE_INVALID );
|
||||
}
|
||||
}
|
||||
@ -753,7 +753,7 @@ Return Value:
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
BOOLEAN
|
||||
@ -922,7 +922,7 @@ Return Value:
|
||||
// Indicate we used up the swap.
|
||||
//
|
||||
|
||||
Vcb->SwapVpb = NULL;
|
||||
Vcb->SwapVpb = NULL;
|
||||
|
||||
CdUnlockVcb( IrpContext, Vcb );
|
||||
|
||||
|
@ -80,7 +80,7 @@ CdQueryFsSectorSizeInfo (
|
||||
#pragma alloc_text(PAGE, CdQueryFsSectorSizeInfo)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
NTSTATUS
|
||||
CdCommonQueryVolInfo (
|
||||
@ -221,7 +221,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -314,7 +314,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -377,7 +377,7 @@ Return Value:
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -441,7 +441,7 @@ Return Value:
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
|
@ -45,7 +45,7 @@ CdAddToWorkque (
|
||||
#pragma alloc_text(PAGE, CdPrePostIrp)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
NTSTATUS
|
||||
CdFsdPostRequest (
|
||||
@ -96,8 +96,8 @@ Return Value:
|
||||
return STATUS_PENDING;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||
@ -221,7 +221,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
@ -316,7 +316,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
|
@ -57,7 +57,7 @@ __pragma(warning(suppress: 6320)) \
|
||||
#pragma alloc_text(PAGE, CdCommonWrite)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
NTSTATUS
|
||||
CdCommonWrite (
|
||||
@ -165,7 +165,7 @@ Return Value:
|
||||
_SEH2_TRY {
|
||||
|
||||
//
|
||||
// Verify the Fcb. Allow writes if this is a DASD handle that is
|
||||
// Verify the Fcb. Allow writes if this is a DASD handle that is
|
||||
// dismounting the volume.
|
||||
//
|
||||
|
||||
@ -334,7 +334,7 @@ Return Value:
|
||||
} else if (WriteByteCount != ByteCount) {
|
||||
|
||||
CdMapUserBuffer( IrpContext, &UserBuffer );
|
||||
|
||||
|
||||
SafeZeroMemory( IrpContext,
|
||||
Add2Ptr( UserBuffer,
|
||||
ByteCount,
|
||||
|
@ -931,7 +931,7 @@ struct _EXT2_MCB {
|
||||
// List Link to Vcb->McbList
|
||||
LIST_ENTRY Link;
|
||||
|
||||
|
||||
|
||||
|
||||
struct inode Inode;
|
||||
struct dentry *de;
|
||||
|
@ -765,7 +765,7 @@ static inline int test_clear_buffer_##name(struct buffer_head *bh) \
|
||||
{ \
|
||||
return test_and_clear_bit(BH_##bit, &(bh)->b_state); \
|
||||
} \
|
||||
|
||||
|
||||
/*
|
||||
* Emit the buffer bitops functions. Note that there are also functions
|
||||
* of the form "mark_buffer_foo()". These are higher-level functions which
|
||||
|
@ -192,7 +192,7 @@ Ext2FollowLink (
|
||||
SetLongFlag(Mcb->Flags, MCB_TYPE_SYMLINK);
|
||||
ClearLongFlag(Mcb->Flags, MCB_TYPE_SPECIAL);
|
||||
ASSERT(Mcb->Target->Refercount > 0);
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
Mcb->Target = Target;
|
||||
|
@ -276,7 +276,7 @@ Ext2DispatchRequest (IN PEXT2_IRP_CONTEXT IrpContext)
|
||||
#if (_WIN32_WINNT >= 0x0500)
|
||||
case IRP_MJ_PNP:
|
||||
return Ext2Pnp(IrpContext);
|
||||
#endif //(_WIN32_WINNT >= 0x0500)
|
||||
#endif //(_WIN32_WINNT >= 0x0500)
|
||||
default:
|
||||
DEBUG(DL_ERR, ( "Ext2DispatchRequest: Unexpected major function: %xh\n",
|
||||
IrpContext->MajorFunction));
|
||||
|
@ -262,7 +262,7 @@ Ext2QueryEa (
|
||||
|
||||
// Link FullEa and LastFullEa together
|
||||
if (LastFullEa)
|
||||
LastFullEa->NextEntryOffset = (ULONG)((PCHAR)FullEa -
|
||||
LastFullEa->NextEntryOffset = (ULONG)((PCHAR)FullEa -
|
||||
(PCHAR)LastFullEa);
|
||||
|
||||
LastFullEa = FullEa;
|
||||
|
@ -686,7 +686,7 @@ Ext2LoadBlock (IN PEXT2_VCB Vcb,
|
||||
fini_bh(&bh);
|
||||
} _SEH2_END;
|
||||
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@ -1352,7 +1352,7 @@ repeat:
|
||||
}
|
||||
|
||||
if ((gd->bg_flags & cpu_to_le16(EXT4_BG_INODE_UNINIT)) ||
|
||||
(ext4_used_dirs_count(sb, gd) << 8 <
|
||||
(ext4_used_dirs_count(sb, gd) << 8 <
|
||||
ext4_free_inodes_count(sb, gd)) ) {
|
||||
Group = i + 1;
|
||||
break;
|
||||
@ -1437,7 +1437,7 @@ repeat:
|
||||
|
||||
/* this group is 100% cocucpied */
|
||||
fini_bh(&gb);
|
||||
|
||||
|
||||
i = GroupHint;
|
||||
|
||||
/*
|
||||
@ -1461,7 +1461,7 @@ repeat:
|
||||
break;
|
||||
}
|
||||
|
||||
fini_bh(&gb);
|
||||
fini_bh(&gb);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -892,7 +892,7 @@ Ext2MapIndirect(
|
||||
}
|
||||
}
|
||||
|
||||
if (Layer == 0)
|
||||
if (Layer == 0)
|
||||
dwArray = Vcb->max_blocks_per_layer[Layer] - Index;
|
||||
else
|
||||
dwArray = 1;
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
/*
|
||||
* extents_bread: This function is a wrapper of CcPinRead routine.
|
||||
*
|
||||
*
|
||||
* @sb: the device we need to undergo buffered IO on.
|
||||
* @block: the block we want to read from.
|
||||
*
|
||||
@ -19,7 +19,7 @@ extents_bread(struct super_block *sb, sector_t block)
|
||||
|
||||
/*
|
||||
* extents_bwrite: This function is a wrapper of CcPreparePinWrite routine.
|
||||
*
|
||||
*
|
||||
* @sb: the device we need to undergo buffered IO on.
|
||||
* @block: the block we want to write to.
|
||||
*/
|
||||
@ -33,7 +33,7 @@ extents_bwrite(struct super_block *sb, sector_t block)
|
||||
/*
|
||||
* extents_mark_buffer_dirty: Mark the buffer dirtied and so
|
||||
* that changes will be written back.
|
||||
*
|
||||
*
|
||||
* @bh: The corresponding buffer header that is modified.
|
||||
*/
|
||||
void extents_mark_buffer_dirty(struct buffer_head *bh)
|
||||
|
@ -1955,7 +1955,7 @@ ext4_ext_rm_leaf(void *icb, handle_t *handle, struct inode *inode,
|
||||
path[depth].p_ext = ex;
|
||||
|
||||
a = ex_ee_block > start ? ex_ee_block : start;
|
||||
b = (unsigned long long)ex_ee_block + ex_ee_len - 1 <
|
||||
b = (unsigned long long)ex_ee_block + ex_ee_len - 1 <
|
||||
EXT_MAX_BLOCKS ? ex_ee_block + ex_ee_len - 1 : EXT_MAX_BLOCKS;
|
||||
|
||||
|
||||
@ -2343,7 +2343,7 @@ static int ext4_ext_convert_to_initialized (
|
||||
|
||||
assert (le32_to_cpu(ex->ee_block) <= split);
|
||||
|
||||
if (split + blocks == le32_to_cpu(ex->ee_block) +
|
||||
if (split + blocks == le32_to_cpu(ex->ee_block) +
|
||||
ext4_ext_get_actual_len(ex)) {
|
||||
|
||||
/* split and initialize right part */
|
||||
@ -2477,7 +2477,7 @@ int ext4_ext_get_blocks(void *icb, handle_t *handle, struct inode *inode, ext4_f
|
||||
le16_to_cpu(newex.ee_len), get_default_free_blocks_flags(inode));
|
||||
goto out2;
|
||||
}
|
||||
|
||||
|
||||
ext4_mark_inode_dirty(icb, handle, inode);
|
||||
|
||||
/* previous routine could use block we allocated */
|
||||
|
@ -137,7 +137,7 @@ ext4_xattr_block_checksum(PEXT2_MCB inode_ref,
|
||||
/* Then calculate crc32 checksum block number */
|
||||
checksum = ext4_crc32c(checksum, &le64_blocknr,
|
||||
sizeof(le64_blocknr));
|
||||
/* Finally calculate crc32 checksum against
|
||||
/* Finally calculate crc32 checksum against
|
||||
* the entire xattr block */
|
||||
checksum = ext4_crc32c(checksum, header,
|
||||
ext4_sb_get_block_size(sb));
|
||||
@ -169,7 +169,7 @@ static int ext4_xattr_item_cmp(struct rb_node *_a,
|
||||
|
||||
if (a->is_data && !b->is_data)
|
||||
return -1;
|
||||
|
||||
|
||||
if (!a->is_data && b->is_data)
|
||||
return 1;
|
||||
|
||||
|
@ -67,7 +67,7 @@ Ext2MapExtent(
|
||||
flags = EXT4_GET_BLOCKS_IO_CREATE_EXT;
|
||||
max_blocks = EXT_UNWRITTEN_MAX_LEN;
|
||||
}
|
||||
|
||||
|
||||
if (Alloc) {
|
||||
if (Number && !*Number) {
|
||||
if (max_blocks > *Number) {
|
||||
|
@ -750,7 +750,7 @@ Ext2SetFileInformation (IN PEXT2_IRP_CONTEXT IrpContext)
|
||||
|
||||
if (AllocationSize.QuadPart > Fcb->Header.AllocationSize.QuadPart) {
|
||||
|
||||
Status = Ext2ExpandFile(IrpContext, Vcb, Mcb, &AllocationSize);
|
||||
Status = Ext2ExpandFile(IrpContext, Vcb, Mcb, &AllocationSize);
|
||||
Fcb->Header.AllocationSize = AllocationSize;
|
||||
NotifyFilter = FILE_NOTIFY_CHANGE_SIZE;
|
||||
SetLongFlag(Fcb->Flags, FCB_ALLOC_IN_SETINFO);
|
||||
@ -1169,7 +1169,7 @@ Ext2ExpandFile(
|
||||
return STATUS_INVALID_DEVICE_REQUEST;
|
||||
}
|
||||
|
||||
/* expandind file extents */
|
||||
/* expandind file extents */
|
||||
if (INODE_HAS_EXTENT(&Mcb->Inode)) {
|
||||
|
||||
status = Ext2ExpandExtent(IrpContext, Vcb, Mcb, Start, End, Size);
|
||||
|
@ -1406,7 +1406,7 @@ Ext2GetReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
||||
|
||||
UNICODE_STRING UniName;
|
||||
OEM_STRING OemName;
|
||||
|
||||
|
||||
PCHAR OemNameBuffer = NULL;
|
||||
int OemNameLength = 0, i;
|
||||
|
||||
@ -1419,7 +1419,7 @@ Ext2GetReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
||||
Mcb = IrpContext->Fcb->Mcb;
|
||||
Irp = IrpContext->Irp;
|
||||
IrpSp = IoGetCurrentIrpStackLocation(Irp);
|
||||
|
||||
|
||||
_SEH2_TRY {
|
||||
|
||||
if (!Mcb || !IsInodeSymLink(&Mcb->Inode) ||
|
||||
@ -1427,7 +1427,7 @@ Ext2GetReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
||||
Status = STATUS_NOT_A_REPARSE_POINT;
|
||||
_SEH2_LEAVE;
|
||||
}
|
||||
|
||||
|
||||
OutputBuffer = (PVOID)Irp->AssociatedIrp.SystemBuffer;
|
||||
OutputBufferLength = IrpSp->Parameters.FileSystemControl.OutputBufferLength;
|
||||
|
||||
@ -1493,11 +1493,11 @@ Ext2GetReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
||||
RtlMoveMemory( (PUCHAR)RDB->SymbolicLinkReparseBuffer.PathBuffer +
|
||||
RDB->SymbolicLinkReparseBuffer.SubstituteNameOffset,
|
||||
UniName.Buffer, UniName.Length);
|
||||
|
||||
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
} _SEH2_FINALLY {
|
||||
|
||||
|
||||
if (OemNameBuffer) {
|
||||
Ext2FreePool(OemNameBuffer, 'NL2E');
|
||||
}
|
||||
@ -1510,7 +1510,7 @@ Ext2GetReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
||||
}
|
||||
}
|
||||
} _SEH2_END;
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -1582,7 +1582,7 @@ Ext2SetReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
||||
PEXT2_MCB Mcb = NULL;
|
||||
|
||||
NTSTATUS Status = STATUS_UNSUCCESSFUL;
|
||||
|
||||
|
||||
PVOID InputBuffer;
|
||||
ULONG InputBufferLength;
|
||||
ULONG BytesWritten = 0;
|
||||
@ -1594,7 +1594,7 @@ Ext2SetReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
||||
|
||||
UNICODE_STRING UniName;
|
||||
OEM_STRING OemName;
|
||||
|
||||
|
||||
PCHAR OemNameBuffer = NULL;
|
||||
int OemNameLength = 0, i;
|
||||
|
||||
@ -1641,7 +1641,7 @@ Ext2SetReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
||||
_SEH2_LEAVE;
|
||||
}
|
||||
MainResourceAcquired = TRUE;
|
||||
|
||||
|
||||
InputBuffer = Irp->AssociatedIrp.SystemBuffer;
|
||||
InputBufferLength = IrpSp->Parameters.FileSystemControl.InputBufferLength;
|
||||
|
||||
@ -1717,11 +1717,11 @@ Ext2SetReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
||||
if (MainResourceAcquired) {
|
||||
ExReleaseResourceLite(&Fcb->MainResource);
|
||||
}
|
||||
|
||||
|
||||
if (OemNameBuffer) {
|
||||
Ext2FreePool(OemNameBuffer, 'NL2E');
|
||||
}
|
||||
|
||||
|
||||
if (NT_SUCCESS(Status)) {
|
||||
Ext2NotifyReportChange(
|
||||
IrpContext,
|
||||
@ -1743,7 +1743,7 @@ Ext2SetReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
||||
Ext2ReleaseFcb(ParentDcb);
|
||||
}
|
||||
} _SEH2_END;
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -1759,7 +1759,7 @@ Ext2TruncateSymlink(
|
||||
PUCHAR data = (PUCHAR)&Mcb->Inode.i_block;
|
||||
ULONG len = (ULONG)Mcb->Inode.i_size;
|
||||
LARGE_INTEGER NewSize;
|
||||
|
||||
|
||||
if (len < EXT2_LINKLEN_IN_INODE && !Mcb->Inode.i_blocks) {
|
||||
|
||||
RtlZeroMemory(data + Size, EXT2_LINKLEN_IN_INODE - Size);
|
||||
@ -1773,7 +1773,7 @@ Ext2TruncateSymlink(
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
out:
|
||||
return status;
|
||||
}
|
||||
@ -1799,7 +1799,7 @@ Ext2DeleteReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
||||
|
||||
BOOLEAN FcbLockAcquired = FALSE;
|
||||
BOOLEAN MainResourceAcquired = FALSE;
|
||||
|
||||
|
||||
|
||||
_SEH2_TRY {
|
||||
|
||||
@ -1868,7 +1868,7 @@ Ext2DeleteReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
||||
if (MainResourceAcquired) {
|
||||
ExReleaseResourceLite(&Fcb->MainResource);
|
||||
}
|
||||
|
||||
|
||||
if (NT_SUCCESS(Status)) {
|
||||
Ext2NotifyReportChange(
|
||||
IrpContext,
|
||||
@ -1878,7 +1878,7 @@ Ext2DeleteReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
||||
FILE_ACTION_MODIFIED );
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (!_SEH2_AbnormalTermination()) {
|
||||
if (Status == STATUS_PENDING || Status == STATUS_CANT_WAIT) {
|
||||
Status = Ext2QueueRequest(IrpContext);
|
||||
@ -1895,7 +1895,7 @@ Ext2DeleteReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
||||
Ext2ReleaseFcb(Fcb);
|
||||
}
|
||||
} _SEH2_END;
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -1928,11 +1928,11 @@ Ext2UserFsRequest (IN PEXT2_IRP_CONTEXT IrpContext)
|
||||
case FSCTL_GET_REPARSE_POINT:
|
||||
Status = Ext2GetReparsePoint(IrpContext);
|
||||
break;
|
||||
|
||||
|
||||
case FSCTL_SET_REPARSE_POINT:
|
||||
Status = Ext2SetReparsePoint(IrpContext);
|
||||
break;
|
||||
|
||||
|
||||
case FSCTL_DELETE_REPARSE_POINT:
|
||||
Status = Ext2DeleteReparsePoint(IrpContext);
|
||||
break;
|
||||
@ -2615,7 +2615,7 @@ Ext2CheckDismount (
|
||||
ExAcquireResourceExclusiveLite(
|
||||
&Vcb->MainResource, TRUE );
|
||||
|
||||
if (IrpContext &&
|
||||
if (IrpContext &&
|
||||
IrpContext->MajorFunction == IRP_MJ_CREATE &&
|
||||
IrpContext->RealDevice == Vcb->RealDevice) {
|
||||
UnCleanCount = 2;
|
||||
|
@ -432,7 +432,7 @@ get_block_bh_mdl(
|
||||
sector_t block,
|
||||
unsigned long size,
|
||||
int zero
|
||||
)
|
||||
)
|
||||
{
|
||||
PEXT2_VCB Vcb = bdev->bd_priv;
|
||||
LARGE_INTEGER offset;
|
||||
@ -613,7 +613,7 @@ get_block_bh_pin(
|
||||
sector_t block,
|
||||
unsigned long size,
|
||||
int zero
|
||||
)
|
||||
)
|
||||
{
|
||||
PEXT2_VCB Vcb = bdev->bd_priv;
|
||||
LARGE_INTEGER offset;
|
||||
@ -758,7 +758,7 @@ get_block_bh(
|
||||
sector_t block,
|
||||
unsigned long size,
|
||||
int zero
|
||||
)
|
||||
)
|
||||
{
|
||||
return get_block_bh_mdl(bdev, block, size, zero);
|
||||
}
|
||||
@ -776,7 +776,7 @@ get_block_bh(
|
||||
sector_t block,
|
||||
unsigned long size,
|
||||
int zero
|
||||
)
|
||||
)
|
||||
{
|
||||
return get_block_bh_pin(bdev, block, size, zero);
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ Ext2UnlinkFcb(IN PEXT2_FCB Fcb)
|
||||
DEBUG(DL_INF, ("Ext2FreeFcb: Fcb (%p) to be unlinked: %wZ.\n",
|
||||
Fcb, Mcb ? &Mcb->FullName : NULL));
|
||||
|
||||
if ((Mcb != NULL) &&
|
||||
if ((Mcb != NULL) &&
|
||||
(Mcb->Identifier.Type == EXT2MCB) &&
|
||||
(Mcb->Identifier.Size == sizeof(EXT2_MCB))) {
|
||||
|
||||
|
@ -1131,7 +1131,7 @@ Ext2WriteFile(IN PEXT2_IRP_CONTEXT IrpContext)
|
||||
}
|
||||
|
||||
if (!CcCopyWrite(FileObject, &ByteOffset, Length, Ext2CanIWait(), Buffer)) {
|
||||
if (Ext2CanIWait() ||
|
||||
if (Ext2CanIWait() ||
|
||||
!CcCopyWrite(FileObject, &ByteOffset, Length, TRUE, Buffer)) {
|
||||
Status = STATUS_PENDING;
|
||||
DbgBreak();
|
||||
|
@ -340,7 +340,7 @@ FATGetNextDirEntry(
|
||||
*pContext = NULL;
|
||||
return STATUS_NO_MORE_ENTRIES;
|
||||
}
|
||||
|
||||
|
||||
if (FAT_ENTRY_DELETED(fatDirEntry))
|
||||
{
|
||||
dirMap = 0;
|
||||
@ -365,7 +365,7 @@ FATGetNextDirEntry(
|
||||
2, longNameEntry->name11_12);
|
||||
|
||||
index = longNameEntry->id & 0x3f; // Note: it can be 0 for corrupted FS
|
||||
|
||||
|
||||
/* Make sure index is valid and we have enough space in buffer
|
||||
(we count one char for \0) */
|
||||
if (index > 0 &&
|
||||
@ -462,7 +462,7 @@ FATGetNextDirEntry(
|
||||
DirContext->LongNameU.Buffer[DirContext->LongNameU.MaximumLength / sizeof(WCHAR) - 1]
|
||||
= UNICODE_NULL;
|
||||
DirContext->LongNameU.Length = wcslen(DirContext->LongNameU.Buffer) * sizeof(WCHAR);
|
||||
|
||||
|
||||
/* Init short name */
|
||||
vfat8Dot3ToString(&DirContext->DirEntry.Fat, &DirContext->ShortNameU);
|
||||
|
||||
|
@ -500,7 +500,7 @@ FATAddEntry(
|
||||
ASSERT(SearchContext.DirEntry.Fat.FileSize == MoveContext->FileSize);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i == 100) /* FIXME : what to do after this ? */
|
||||
@ -537,7 +537,7 @@ FATAddEntry(
|
||||
needLong = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (c == L'.')
|
||||
{
|
||||
InExtension = TRUE;
|
||||
|
@ -728,7 +728,7 @@ VfatSetRenameInformation(
|
||||
|
||||
if (RenameInfo->RootDirectory != NULL)
|
||||
{
|
||||
/* Here, copy first absolute and then append relative */
|
||||
/* Here, copy first absolute and then append relative */
|
||||
RtlCopyUnicodeString(&NewName, &RootFCB->PathNameU);
|
||||
NewName.Buffer[NewName.Length / sizeof(WCHAR)] = L'\\';
|
||||
NewName.Length += sizeof(WCHAR);
|
||||
|
@ -354,7 +354,7 @@ VfatHasFileSystem(
|
||||
* Set it to 0 if you wish to use the associated FCB with caching.
|
||||
* In that specific case, Device parameter is expected to be the VCB!
|
||||
* VolumeLabel parameter is expected to be a preallocated UNICODE_STRING (ie, with buffer)
|
||||
* Its buffer has to be able to contain MAXIMUM_VOLUME_LABEL_LENGTH bytes
|
||||
* Its buffer has to be able to contain MAXIMUM_VOLUME_LABEL_LENGTH bytes
|
||||
*/
|
||||
static
|
||||
NTSTATUS
|
||||
|
@ -483,7 +483,7 @@ typedef struct _VFATFCB
|
||||
/* List of FCB's for this volume */
|
||||
LIST_ENTRY FcbListEntry;
|
||||
|
||||
/* List of FCB's for the parent */
|
||||
/* List of FCB's for the parent */
|
||||
LIST_ENTRY ParentListEntry;
|
||||
|
||||
/* pointer to the parent fcb */
|
||||
|
@ -34,7 +34,7 @@ FatCreateRestrictEveryoneToken(
|
||||
#pragma alloc_text(PAGE, FatExplicitDeviceAccessGranted)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
BOOLEAN
|
||||
FatCheckFileAccess (
|
||||
PIRP_CONTEXT IrpContext,
|
||||
@ -144,12 +144,12 @@ Return Value:
|
||||
//
|
||||
// If this is a subdirectory also allow add file/directory and delete.
|
||||
//
|
||||
|
||||
|
||||
if (FlagOn(DirentAttributes, FAT_DIRENT_ATTR_DIRECTORY)) {
|
||||
|
||||
AccessMask |= FILE_ADD_SUBDIRECTORY | FILE_ADD_FILE | FILE_DELETE_CHILD;
|
||||
}
|
||||
|
||||
|
||||
if (FlagOn(*DesiredAccess, ~AccessMask)) {
|
||||
|
||||
DebugTrace(0, Dbg, "Cannot open readonly\n", 0);
|
||||
@ -189,7 +189,7 @@ Routine Description:
|
||||
Arguments:
|
||||
|
||||
AccessState - the access state describing the security context to be checked
|
||||
|
||||
|
||||
ProcessorMode - the mode this check should occur against
|
||||
|
||||
Return Value:
|
||||
@ -220,7 +220,7 @@ Return Value:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NTSTATUS
|
||||
FatExplicitDeviceAccessGranted (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -241,9 +241,9 @@ Routine Description:
|
||||
Arguments:
|
||||
|
||||
DeviceObject - the device whose ACL will be checked
|
||||
|
||||
|
||||
AccessState - the access state describing the security context to be checked
|
||||
|
||||
|
||||
ProcessorMode - the mode this check should occur against
|
||||
|
||||
Return Value:
|
||||
@ -257,9 +257,9 @@ Return Value:
|
||||
|
||||
PACCESS_TOKEN OriginalAccessToken;
|
||||
PACCESS_TOKEN RestrictedAccessToken;
|
||||
|
||||
|
||||
PACCESS_TOKEN *EffectiveToken;
|
||||
|
||||
|
||||
ACCESS_MASK GrantedAccess;
|
||||
|
||||
PAGED_CODE();
|
||||
@ -295,7 +295,7 @@ Return Value:
|
||||
//
|
||||
|
||||
SeLockSubjectContext( &AccessState->SubjectSecurityContext );
|
||||
|
||||
|
||||
//
|
||||
// Convert the token in the subject context into one which does not
|
||||
// acquire access through the Everyone SID.
|
||||
@ -304,7 +304,7 @@ Return Value:
|
||||
// SeQuerySubjectContextToken; since there is no natural way
|
||||
// of getting a pointer to it, do it by hand.
|
||||
//
|
||||
|
||||
|
||||
if (ARGUMENT_PRESENT( AccessState->SubjectSecurityContext.ClientToken )) {
|
||||
EffectiveToken = &AccessState->SubjectSecurityContext.ClientToken;
|
||||
} else {
|
||||
@ -315,7 +315,7 @@ Return Value:
|
||||
Status = FatCreateRestrictEveryoneToken( OriginalAccessToken, &RestrictedAccessToken );
|
||||
|
||||
if (!NT_SUCCESS(Status)) {
|
||||
|
||||
|
||||
SeReleaseSubjectContext( &AccessState->SubjectSecurityContext );
|
||||
return Status;
|
||||
}
|
||||
@ -327,7 +327,7 @@ Return Value:
|
||||
//
|
||||
|
||||
*EffectiveToken = RestrictedAccessToken;
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma prefast( suppress: 28175, "we're a file system, this is ok to touch" )
|
||||
#endif
|
||||
@ -341,9 +341,9 @@ Return Value:
|
||||
ProcessorMode,
|
||||
&GrantedAccess,
|
||||
&Status );
|
||||
|
||||
|
||||
*EffectiveToken = OriginalAccessToken;
|
||||
|
||||
|
||||
//
|
||||
// Cleanup and return.
|
||||
//
|
||||
@ -354,7 +354,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NTSTATUS
|
||||
FatCreateRestrictEveryoneToken (
|
||||
IN PACCESS_TOKEN Token,
|
||||
|
@ -97,7 +97,7 @@ Routine Description:
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
FatReadVolumeFile (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -183,8 +183,8 @@ Arguments:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
FatPrepareWriteVolumeFile (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -228,7 +228,7 @@ Arguments:
|
||||
Reversible - Supplies TRUE if the specified range of modification should
|
||||
be repinned so that the operation can be reversed in a controlled
|
||||
fashion if errors are encountered.
|
||||
|
||||
|
||||
Zero - Supplies TRUE if the specified range of bytes should be zeroed
|
||||
|
||||
--*/
|
||||
@ -237,7 +237,7 @@ Arguments:
|
||||
LARGE_INTEGER Vbo;
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
//
|
||||
// Check to see that all references are within the Bios Parameter Block
|
||||
// or the fat(s).
|
||||
@ -284,7 +284,7 @@ Arguments:
|
||||
_SEH2_TRY {
|
||||
|
||||
if (Zero) {
|
||||
|
||||
|
||||
RtlZeroMemory( *Buffer, ByteCount );
|
||||
}
|
||||
|
||||
@ -303,7 +303,7 @@ Arguments:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
FatReadDirectoryFile (
|
||||
@ -349,7 +349,7 @@ Arguments:
|
||||
LARGE_INTEGER Vbo;
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
DebugTrace(+1, Dbg, "FatReadDirectoryFile\n", 0);
|
||||
DebugTrace( 0, Dbg, "Dcb = %p\n", Dcb);
|
||||
DebugTrace( 0, Dbg, "StartingVbo = %08lx\n", StartingVbo);
|
||||
@ -445,7 +445,7 @@ Arguments:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
FatPrepareWriteDirectoryFile (
|
||||
@ -484,11 +484,11 @@ Arguments:
|
||||
Buffer - Returns a pointer to the sectors, which is valid until unpinned
|
||||
|
||||
Zero - Supplies TRUE if the specified range of bytes should be zeroed
|
||||
|
||||
|
||||
Reversible - Supplies TRUE if the specified range of modification should
|
||||
be repinned so that the operation can be reversed in a controlled
|
||||
fashion if errors are encountered.
|
||||
|
||||
|
||||
Status - Returns the status of the operation.
|
||||
|
||||
--*/
|
||||
@ -503,7 +503,7 @@ Arguments:
|
||||
ULONG MappingGranularity = PAGE_SIZE;
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
DebugTrace(+1, Dbg, "FatPrepareWriteDirectoryFile\n", 0);
|
||||
DebugTrace( 0, Dbg, "Dcb = %p\n", Dcb);
|
||||
DebugTrace( 0, Dbg, "StartingVbo = %08lx\n", (ULONG)StartingVbo);
|
||||
@ -586,22 +586,22 @@ Arguments:
|
||||
//
|
||||
// We must pin in terms of pages below the boundary of the initial request.
|
||||
// Once we pass the end of the request, we are free to expand the pin size to
|
||||
// VACB_MAPPING_GRANULARITY. This will prevent Cc from returning OBCBs
|
||||
// and hence will prevent bugchecks when we then attempt to repin one, yet
|
||||
// VACB_MAPPING_GRANULARITY. This will prevent Cc from returning OBCBs
|
||||
// and hence will prevent bugchecks when we then attempt to repin one, yet
|
||||
// allow us to be more efficient by pinning in 256KB chunks instead of 4KB pages.
|
||||
//
|
||||
|
||||
if (Vbo.QuadPart > StartingVbo + InitialRequest) {
|
||||
|
||||
|
||||
MappingGranularity = VACB_MAPPING_GRANULARITY;
|
||||
}
|
||||
|
||||
//
|
||||
// If the first and final byte are both described by the same page, pin
|
||||
// If the first and final byte are both described by the same page, pin
|
||||
// the entire range. Note we pin in pages to prevent cache manager from
|
||||
// returning OBCBs, which would result in a bugcheck on CcRepinBcb.
|
||||
//
|
||||
|
||||
|
||||
if ((Vbo.QuadPart / MappingGranularity) ==
|
||||
((Vbo.QuadPart + ByteCount - 1) / MappingGranularity)) {
|
||||
|
||||
@ -619,7 +619,7 @@ Arguments:
|
||||
BooleanFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT),
|
||||
&LocalBcb,
|
||||
&LocalBuffer )) {
|
||||
|
||||
|
||||
//
|
||||
// Could not read the data without waiting (cache miss).
|
||||
//
|
||||
@ -630,7 +630,7 @@ Arguments:
|
||||
//
|
||||
// Update our caller with the beginning of their request.
|
||||
//
|
||||
|
||||
|
||||
if (*Buffer == NULL) {
|
||||
|
||||
*Buffer = LocalBuffer;
|
||||
@ -640,13 +640,13 @@ Arguments:
|
||||
DbgDoit( IrpContext->PinCount += 1 )
|
||||
|
||||
if (Zero) {
|
||||
|
||||
|
||||
//
|
||||
// We set this guy dirty right now so that we can raise CANT_WAIT when
|
||||
// it needs to be done. It'd be beautiful if we could noop the read IO
|
||||
// since we know we don't care about it.
|
||||
//
|
||||
|
||||
|
||||
RtlZeroMemory( LocalBuffer, BytesToPin );
|
||||
CcSetDirtyPinnedData( LocalBcb, NULL );
|
||||
}
|
||||
@ -655,7 +655,7 @@ Arguments:
|
||||
Vbo.QuadPart += BytesToPin;
|
||||
|
||||
if (*Bcb != LocalBcb) {
|
||||
|
||||
|
||||
FatRepinBcb( IrpContext, LocalBcb );
|
||||
FatUnpinBcb( IrpContext, LocalBcb );
|
||||
}
|
||||
@ -684,14 +684,14 @@ Arguments:
|
||||
|
||||
FatUnpinBcb( IrpContext, LocalBcb );
|
||||
}
|
||||
|
||||
|
||||
FatUnpinBcb(IrpContext, *Bcb);
|
||||
|
||||
//
|
||||
// These steps are carefully arranged - FatTruncateFileAllocation can raise.
|
||||
// Make sure we unpin the buffer. If FTFA raises, the effect should be benign.
|
||||
//
|
||||
|
||||
|
||||
if (UnwindWeAllocatedDiskSpace == TRUE) {
|
||||
|
||||
//
|
||||
@ -714,7 +714,7 @@ Arguments:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if DBG
|
||||
BOOLEAN FatDisableParentCheck = 0;
|
||||
|
||||
@ -734,32 +734,32 @@ FatIsCurrentOperationSynchedForDcbTeardown (
|
||||
ULONG Index = 0;
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
//
|
||||
// While mounting, we're OK without having to own anything.
|
||||
//
|
||||
|
||||
|
||||
if (Stack->MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL &&
|
||||
Stack->MinorFunction == IRP_MN_MOUNT_VOLUME) {
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// With the Vcb held, the close path is blocked out.
|
||||
//
|
||||
|
||||
|
||||
if (ExIsResourceAcquiredSharedLite( &Dcb->Vcb->Resource ) ||
|
||||
ExIsResourceAcquiredExclusiveLite( &Dcb->Vcb->Resource )) {
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Accept this assertion at face value. It comes from GetDirentForFcbOrDcb,
|
||||
// and is reliable.
|
||||
//
|
||||
|
||||
|
||||
if (FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_PARENT_BY_CHILD )) {
|
||||
|
||||
return TRUE;
|
||||
@ -776,29 +776,29 @@ FatIsCurrentOperationSynchedForDcbTeardown (
|
||||
}
|
||||
|
||||
if (Stack->FileObject) {
|
||||
|
||||
|
||||
ToCheck[Index++] = Stack->FileObject;
|
||||
}
|
||||
|
||||
ToCheck[Index] = NULL;
|
||||
|
||||
|
||||
//
|
||||
// If the fileobjects we have are for this dcb or a child of it, we are
|
||||
// also guaranteed that this dcb isn't going anywhere (even without
|
||||
// the Vcb).
|
||||
//
|
||||
|
||||
|
||||
for (Index = 0; ToCheck[Index] != NULL; Index++) {
|
||||
|
||||
|
||||
(VOID) FatDecodeFileObject( ToCheck[Index], &Vcb, &Fcb, &Ccb );
|
||||
|
||||
while ( Fcb ) {
|
||||
|
||||
|
||||
if (Fcb == Dcb) {
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
Fcb = Fcb->ParentDcb;
|
||||
}
|
||||
}
|
||||
@ -832,7 +832,7 @@ Return Value:
|
||||
|
||||
{
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
DebugTrace(+1, Dbg, "FatOpenDirectoryFile\n", 0);
|
||||
DebugTrace( 0, Dbg, "Dcb = %p\n", Dcb);
|
||||
|
||||
@ -843,7 +843,7 @@ Return Value:
|
||||
//
|
||||
// I really wish we had a proper Fcb synchronization model (like CDFS/UDFS/NTFS).
|
||||
//
|
||||
|
||||
|
||||
NT_ASSERT( FatIsCurrentOperationSynchedForDcbTeardown( IrpContext, Dcb ));
|
||||
|
||||
//
|
||||
@ -925,7 +925,7 @@ Return Value:
|
||||
InterlockedIncrement( (LONG*)&Dcb->Specific.Dcb.DirectoryFileOpenCount );
|
||||
|
||||
Dcb->Specific.Dcb.DirectoryFile = DirectoryFileObject;
|
||||
|
||||
|
||||
//
|
||||
// Indicate we're happy with the fileobject now.
|
||||
//
|
||||
@ -940,9 +940,9 @@ Return Value:
|
||||
//
|
||||
// Rip the object up if we couldn't get the close context.
|
||||
//
|
||||
|
||||
|
||||
if (DirectoryFileObject) {
|
||||
|
||||
|
||||
ObDereferenceObject( DirectoryFileObject );
|
||||
}
|
||||
} _SEH2_END;
|
||||
@ -974,7 +974,7 @@ Return Value:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
PFILE_OBJECT
|
||||
FatOpenEaFile (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -1002,7 +1002,7 @@ Return Value:
|
||||
PDEVICE_OBJECT RealDevice;
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
DebugTrace(+1, Dbg, "FatOpenEaFile\n", 0);
|
||||
DebugTrace( 0, Dbg, "EaFcb = %p\n", EaFcb);
|
||||
|
||||
@ -1051,7 +1051,7 @@ Return Value:
|
||||
EaFcb );
|
||||
|
||||
CcSetAdditionalCacheAttributes( EaFileObject, TRUE, TRUE );
|
||||
|
||||
|
||||
} _SEH2_FINALLY {
|
||||
|
||||
//
|
||||
@ -1060,9 +1060,9 @@ Return Value:
|
||||
// we lost trying to build the cache map - in which case we're
|
||||
// OK for the close context if we have to.
|
||||
//
|
||||
|
||||
|
||||
if (_SEH2_AbnormalTermination()) {
|
||||
|
||||
|
||||
ObDereferenceObject( EaFileObject );
|
||||
}
|
||||
} _SEH2_END;
|
||||
@ -1074,7 +1074,7 @@ Return Value:
|
||||
return EaFileObject;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatCloseEaFile (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -1088,26 +1088,26 @@ Routine Description:
|
||||
|
||||
This routine shuts down the ea file. Usually this is required when the volume
|
||||
begins to leave the system: after verify, dismount, deletion, pnp.
|
||||
|
||||
|
||||
Arguments:
|
||||
|
||||
Vcb - the volume to close the ea file on
|
||||
|
||||
|
||||
FlushFirst - whether the file should be flushed
|
||||
|
||||
|
||||
Return Value:
|
||||
|
||||
None. As a side effect, the EA fileobject in the Vcb is cleared.
|
||||
|
||||
|
||||
Caller must have the Vcb exclusive.
|
||||
|
||||
|
||||
--*/
|
||||
|
||||
{
|
||||
PFILE_OBJECT EaFileObject = Vcb->VirtualEaFile;
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
DebugTrace(+1, Dbg, "FatCloseEaFile\n", 0);
|
||||
DebugTrace( 0, Dbg, "Vcb = %p\n", Vcb);
|
||||
|
||||
@ -1138,12 +1138,12 @@ Return Value:
|
||||
|
||||
ObDereferenceObject( EaFileObject );
|
||||
}
|
||||
|
||||
|
||||
DebugTrace(-1, Dbg, "FatCloseEaFile -> %p\n", EaFileObject);
|
||||
}
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
FatSetDirtyBcb (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -1166,13 +1166,13 @@ Routine Description:
|
||||
Arguments:
|
||||
|
||||
Bcb - Supplies the Bcb being set dirty
|
||||
|
||||
|
||||
Vcb - Supplies the volume being marked dirty
|
||||
|
||||
|
||||
Reversible - Supplies TRUE if the specified range of bcb should be repinned
|
||||
so that the changes can be reversed in a controlled fashion if errors
|
||||
are encountered.
|
||||
|
||||
|
||||
Return Value:
|
||||
|
||||
None.
|
||||
@ -1190,7 +1190,7 @@ Return Value:
|
||||
//
|
||||
|
||||
if (Reversible) {
|
||||
|
||||
|
||||
FatRepinBcb( IrpContext, Bcb );
|
||||
}
|
||||
|
||||
@ -1260,7 +1260,7 @@ Return Value:
|
||||
//
|
||||
// We use a shorter volume clean timer for hot plug volumes.
|
||||
//
|
||||
|
||||
|
||||
CleanVolumeTimer.QuadPart = FlagOn( Vcb->VcbState, VCB_STATE_FLAG_DEFERRED_FLUSH)
|
||||
? (LONG)-1500*1000*10
|
||||
: (LONG)-8*1000*1000*10;
|
||||
@ -1312,7 +1312,7 @@ Return Value:
|
||||
DebugTrace(-1, Dbg, "FatSetDirtyBcb -> VOID\n", 0 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatRepinBcb (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -1342,7 +1342,7 @@ Return Value:
|
||||
ULONG i;
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
DebugTrace(+1, Dbg, "FatRepinBcb\n", 0 );
|
||||
DebugTrace( 0, Dbg, "IrpContext = %p\n", IrpContext );
|
||||
DebugTrace( 0, Dbg, "Bcb = %p\n", Bcb );
|
||||
@ -1402,7 +1402,7 @@ Return Value:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatUnpinRepinnedBcbs (
|
||||
IN PIRP_CONTEXT IrpContext
|
||||
@ -1432,7 +1432,7 @@ Return Value:
|
||||
PFCB FcbOrDcb = NULL;
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
DebugTrace(+1, Dbg, "FatUnpinRepinnedBcbs\n", 0 );
|
||||
DebugTrace( 0, Dbg, "IrpContext = %p\n", IrpContext );
|
||||
|
||||
@ -1453,21 +1453,21 @@ Return Value:
|
||||
// Extract main FCB pointer from the irp context - we
|
||||
// will need it later to detect new file creation operation.
|
||||
//
|
||||
|
||||
|
||||
if (IrpContext->MajorFunction == IRP_MJ_CREATE &&
|
||||
IrpContext->OriginatingIrp != NULL) {
|
||||
PIO_STACK_LOCATION IrpSp;
|
||||
|
||||
|
||||
IrpSp = IoGetCurrentIrpStackLocation( IrpContext->OriginatingIrp );
|
||||
|
||||
|
||||
if (IrpSp != NULL &&
|
||||
IrpSp->FileObject != NULL &&
|
||||
IrpSp->FileObject->FsContext != NULL) {
|
||||
|
||||
|
||||
FcbOrDcb = IrpSp->FileObject->FsContext;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// If the request is write through or the media is deferred flush,
|
||||
// unpin the bcb's write through.
|
||||
@ -1496,7 +1496,7 @@ Return Value:
|
||||
|
||||
IO_STATUS_BLOCK Iosb;
|
||||
|
||||
if (WriteThroughToDisk &&
|
||||
if (WriteThroughToDisk &&
|
||||
FlagOn(IrpContext->Vcb->VcbState, VCB_STATE_FLAG_DEFERRED_FLUSH)) {
|
||||
|
||||
FileObject = CcGetFileObjectFromBcb( Repinned->Bcb[i] );
|
||||
@ -1524,9 +1524,9 @@ Return Value:
|
||||
(IrpContext->MajorFunction != IRP_MJ_CLEANUP) &&
|
||||
(IrpContext->MajorFunction != IRP_MJ_FLUSH_BUFFERS) &&
|
||||
(IrpContext->MajorFunction != IRP_MJ_SET_INFORMATION)
|
||||
|
||||
|
||||
&&
|
||||
|
||||
|
||||
//
|
||||
// WinSE bug #307418 "Occasional data corruption when
|
||||
// standby/resume while copying files to removable FAT
|
||||
@ -1540,7 +1540,7 @@ Return Value:
|
||||
// Instead FatCommonCreate() will unroll the file creation
|
||||
// changes for these pages.
|
||||
//
|
||||
|
||||
|
||||
!(IrpContext->MajorFunction == IRP_MJ_CREATE &&
|
||||
Iosb.Status == STATUS_VERIFY_REQUIRED &&
|
||||
FcbOrDcb != NULL &&
|
||||
@ -1567,26 +1567,26 @@ Return Value:
|
||||
PREPINNED_BCBS RepinnedToPurge = Repinned;
|
||||
|
||||
while( RepinnedToPurge != NULL ) {
|
||||
|
||||
|
||||
for (j = k; j < REPINNED_BCBS_ARRAY_SIZE; j++) {
|
||||
|
||||
if (RepinnedToPurge->Bcb[j] != NULL) {
|
||||
|
||||
|
||||
if (CcGetFileObjectFromBcb( RepinnedToPurge->Bcb[j] ) == FileObject) {
|
||||
|
||||
CcUnpinRepinnedBcb( RepinnedToPurge->Bcb[j],
|
||||
FALSE,
|
||||
&Iosb );
|
||||
|
||||
|
||||
RepinnedToPurge->Bcb[j] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RepinnedToPurge = RepinnedToPurge->Next;
|
||||
k = 0;
|
||||
}
|
||||
|
||||
|
||||
CcPurgeCacheSection( FileObject->SectionObjectPointer,
|
||||
NULL,
|
||||
0,
|
||||
@ -1644,7 +1644,7 @@ Return Value:
|
||||
if (!FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_DISABLE_RAISE )) {
|
||||
if (IrpContext->OriginatingIrp) {
|
||||
IrpContext->OriginatingIrp->IoStatus = RaiseIosb;
|
||||
}
|
||||
}
|
||||
FatNormalizeAndRaiseStatus( IrpContext, RaiseIosb.Status );
|
||||
}
|
||||
}
|
||||
@ -1654,7 +1654,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
FINISHED
|
||||
FatZeroData (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -1684,7 +1684,7 @@ FatZeroData (
|
||||
BOOLEAN Finished;
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
SectorSize = (ULONG)Vcb->Bpb.BytesPerSector;
|
||||
|
||||
ZeroStart.LowPart = (StartingZero + (SectorSize - 1)) & ~(SectorSize - 1);
|
||||
@ -1693,23 +1693,23 @@ FatZeroData (
|
||||
// Detect overflow if we were asked to zero in the last sector of the file,
|
||||
// which must be "zeroed" already (or we're in trouble).
|
||||
//
|
||||
|
||||
|
||||
if (StartingZero != 0 && ZeroStart.LowPart == 0) {
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// Note that BeyondZeroEnd can take the value 4gb.
|
||||
//
|
||||
|
||||
|
||||
BeyondZeroEnd.QuadPart = ((ULONGLONG) StartingZero + ByteCount + (SectorSize - 1))
|
||||
& (~((LONGLONG) SectorSize - 1));
|
||||
|
||||
//
|
||||
// If we were called to just zero part of a sector we are in trouble.
|
||||
//
|
||||
|
||||
|
||||
if ( ZeroStart.QuadPart == BeyondZeroEnd.QuadPart ) {
|
||||
|
||||
return TRUE;
|
||||
@ -1723,7 +1723,7 @@ FatZeroData (
|
||||
return Finished;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NTSTATUS
|
||||
FatCompleteMdl (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -1752,7 +1752,7 @@ Return Value:
|
||||
PIO_STACK_LOCATION IrpSp;
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
DebugTrace(+1, Dbg, "FatCompleteMdl\n", 0 );
|
||||
DebugTrace( 0, Dbg, "IrpContext = %p\n", IrpContext );
|
||||
DebugTrace( 0, Dbg, "Irp = %p\n", Irp );
|
||||
@ -1807,7 +1807,7 @@ Return Value:
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
FatSyncUninitializeCacheMap (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -1835,7 +1835,7 @@ Return Value:
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
KeInitializeEvent( &UninitializeCompleteEvent.Event,
|
||||
SynchronizationEvent,
|
||||
FALSE);
|
||||
@ -1861,7 +1861,7 @@ Return Value:
|
||||
|
||||
NT_ASSERT(WaitStatus == STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
FatPinMappedData (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -1893,7 +1893,7 @@ Arguments:
|
||||
LARGE_INTEGER Vbo;
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
DebugTrace(+1, Dbg, "FatPinMappedData\n", 0);
|
||||
DebugTrace( 0, Dbg, "Dcb = %p\n", Dcb);
|
||||
DebugTrace( 0, Dbg, "StartingVbo = %08lx\n", StartingVbo);
|
||||
@ -1924,7 +1924,7 @@ Arguments:
|
||||
}
|
||||
|
||||
#if (NTDDI_VERSION >= NTDDI_WIN8)
|
||||
|
||||
|
||||
NTSTATUS
|
||||
FatPrefetchPages (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
|
@ -43,7 +43,7 @@ FatAutoUnlock (
|
||||
#pragma alloc_text(PAGE, FatFsdCleanup)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
_Function_class_(IRP_MJ_CLEANUP)
|
||||
_Function_class_(DRIVER_DISPATCH)
|
||||
NTSTATUS
|
||||
@ -139,8 +139,8 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
NTSTATUS
|
||||
FatCommonCleanup (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -270,7 +270,7 @@ Return Value:
|
||||
if ((TypeOfOpen == UserFileOpen) || (TypeOfOpen == UserDirectoryOpen)) {
|
||||
|
||||
NT_ASSERT( Fcb != NULL );
|
||||
|
||||
|
||||
(VOID)FatAcquireExclusiveFcb( IrpContext, Fcb );
|
||||
|
||||
AcquiredFcb = TRUE;
|
||||
@ -410,28 +410,28 @@ Return Value:
|
||||
// If so we may need to break an oplock. We do this in the try block
|
||||
// so that resources will be properly released.
|
||||
//
|
||||
|
||||
|
||||
if (ProcessingDeleteOnClose &&
|
||||
FatIsFileOplockable( Fcb ) &&
|
||||
((NodeType( Fcb ) != FAT_NTC_DCB) ||
|
||||
FatIsDirectoryEmpty( IrpContext, Fcb ))) {
|
||||
|
||||
|
||||
Status = FsRtlCheckOplockEx( FatGetFcbOplock(Fcb),
|
||||
Irp,
|
||||
OPLOCK_FLAG_CLOSING_DELETE_ON_CLOSE,
|
||||
IrpContext,
|
||||
FatOplockComplete,
|
||||
FatPrePostIrp );
|
||||
|
||||
|
||||
if (Status != STATUS_SUCCESS) {
|
||||
|
||||
|
||||
if (Status == STATUS_PENDING) {
|
||||
|
||||
|
||||
SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_CLEANUP_BREAKING_OPLOCK );
|
||||
try_return( Status );
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
FatNormalizeAndRaiseStatus( IrpContext, Status );
|
||||
}
|
||||
}
|
||||
@ -466,7 +466,7 @@ Return Value:
|
||||
if (FlagOn( Ccb->Flags, CCB_FLAG_COMPLETE_DISMOUNT )) {
|
||||
|
||||
FatCheckForDismount( IrpContext, Vcb, TRUE );
|
||||
|
||||
|
||||
//
|
||||
// If this handle had write access, and actually wrote something,
|
||||
// flush the device buffers, and then set the verify bit now
|
||||
@ -533,9 +533,9 @@ Return Value:
|
||||
//
|
||||
// Clear the deny defrag bit, if the handle we're cleaning up was the one that set it.
|
||||
//
|
||||
|
||||
|
||||
if( FlagOn(Fcb->FcbState, FCB_STATE_DENY_DEFRAG) && FlagOn(Ccb->Flags, CCB_FLAG_DENY_DEFRAG) ) {
|
||||
|
||||
|
||||
ClearFlag(Ccb->Flags, CCB_FLAG_DENY_DEFRAG);
|
||||
ClearFlag(Fcb->FcbState, FCB_STATE_DENY_DEFRAG );
|
||||
}
|
||||
@ -575,9 +575,9 @@ Return Value:
|
||||
//
|
||||
// Even if something goes wrong, we cannot turn back!
|
||||
//
|
||||
|
||||
|
||||
_SEH2_TRY {
|
||||
|
||||
|
||||
DELETE_CONTEXT DeleteContext;
|
||||
|
||||
|
||||
@ -585,45 +585,45 @@ Return Value:
|
||||
// Before truncating file allocation remember this
|
||||
// info for FatDeleteDirent.
|
||||
//
|
||||
|
||||
|
||||
DeleteContext.FileSize = Fcb->Header.FileSize.LowPart;
|
||||
DeleteContext.FirstClusterOfFile = Fcb->FirstClusterOfFile;
|
||||
|
||||
|
||||
//
|
||||
// Synchronize here with paging IO
|
||||
//
|
||||
|
||||
|
||||
(VOID)ExAcquireResourceExclusiveLite( Fcb->Header.PagingIoResource,
|
||||
TRUE );
|
||||
|
||||
|
||||
Fcb->Header.FileSize.LowPart = 0;
|
||||
|
||||
|
||||
ExReleaseResourceLite( Fcb->Header.PagingIoResource );
|
||||
|
||||
|
||||
//
|
||||
// Truncate the file allocation down to zero
|
||||
//
|
||||
|
||||
|
||||
DebugTrace(0, Dbg, "Delete File allocation\n", 0);
|
||||
|
||||
|
||||
FatTruncateFileAllocation( IrpContext, Fcb, 0 );
|
||||
|
||||
if (Fcb->Header.AllocationSize.LowPart == 0) {
|
||||
|
||||
|
||||
//
|
||||
// Tunnel and remove the dirent for the directory
|
||||
//
|
||||
|
||||
|
||||
DebugTrace(0, Dbg, "Delete the directory dirent\n", 0);
|
||||
|
||||
|
||||
FatTunnelFcbOrDcb( Fcb, NULL );
|
||||
|
||||
|
||||
FatDeleteDirent( IrpContext, Fcb, &DeleteContext, TRUE );
|
||||
|
||||
|
||||
//
|
||||
// Report that we have removed an entry.
|
||||
//
|
||||
|
||||
|
||||
FatNotifyReportChange( IrpContext,
|
||||
Vcb,
|
||||
Fcb,
|
||||
@ -633,7 +633,7 @@ Return Value:
|
||||
|
||||
} _SEH2_EXCEPT( FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ?
|
||||
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {
|
||||
|
||||
|
||||
FatResetExceptionState( IrpContext );
|
||||
} _SEH2_END;
|
||||
|
||||
@ -644,16 +644,16 @@ Return Value:
|
||||
// to recreate the same file over again before we
|
||||
// get a close irp.
|
||||
//
|
||||
|
||||
|
||||
FatRemoveNames( IrpContext, Fcb );
|
||||
|
||||
#if (NTDDI_VERSION >= NTDDI_WIN8)
|
||||
#if (NTDDI_VERSION >= NTDDI_WIN8)
|
||||
//
|
||||
// We've removed the names so break any parent directory oplock.
|
||||
// We've removed the names so break any parent directory oplock.
|
||||
// Directory oplock breaks are always advisory, so we will never
|
||||
// block/get STATUS_PENDING here.
|
||||
//
|
||||
|
||||
|
||||
BreakStatus = FsRtlCheckOplockEx( FatGetFcbOplock(Fcb->ParentDcb),
|
||||
Irp,
|
||||
(OPLOCK_FLAG_PARENT_OBJECT |
|
||||
@ -661,7 +661,7 @@ Return Value:
|
||||
NULL,
|
||||
NULL,
|
||||
NULL );
|
||||
|
||||
|
||||
ASSERT( BreakStatus != STATUS_PENDING );
|
||||
#endif
|
||||
}
|
||||
@ -676,7 +676,7 @@ Return Value:
|
||||
Fcb->UncleanCount -= 1;
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case UserFileOpen:
|
||||
|
||||
DebugTrace(0, Dbg, "Cleanup UserFileOpen\n", 0);
|
||||
@ -705,9 +705,9 @@ Return Value:
|
||||
//
|
||||
// Clear the deny defrag bit, if the handle we're cleaning up was the one that set it.
|
||||
//
|
||||
|
||||
|
||||
if( FlagOn(Fcb->FcbState, FCB_STATE_DENY_DEFRAG) && FlagOn(Ccb->Flags, CCB_FLAG_DENY_DEFRAG) ) {
|
||||
|
||||
|
||||
ClearFlag(Ccb->Flags, CCB_FLAG_DENY_DEFRAG);
|
||||
ClearFlag(Fcb->FcbState, FCB_STATE_DENY_DEFRAG );
|
||||
}
|
||||
@ -728,93 +728,93 @@ Return Value:
|
||||
// and we can still write to it if it hasn't been shutdown. Remember that
|
||||
// we toss all sections in the failed-verify and dismount cases.
|
||||
//
|
||||
|
||||
|
||||
if ((Vcb->VcbCondition == VcbGood) &&
|
||||
!FlagOn(Vcb->VcbState, VCB_STATE_FLAG_SHUTDOWN)) {
|
||||
|
||||
|
||||
if (Fcb->FcbCondition == FcbGood) {
|
||||
|
||||
|
||||
FatUpdateDirentFromFcb( IrpContext, FileObject, Fcb, Ccb );
|
||||
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// If the file has a unclean count of 1 then we know
|
||||
// that this is the last handle for the file object.
|
||||
//
|
||||
|
||||
|
||||
if ( (Fcb->UncleanCount == 1) && (Fcb->FcbCondition == FcbGood) ) {
|
||||
|
||||
|
||||
DELETE_CONTEXT DeleteContext;
|
||||
|
||||
|
||||
//
|
||||
// Check if we should be deleting the file. The
|
||||
// delete operation really deletes the file but
|
||||
// keeps the Fcb around for close to do away with.
|
||||
//
|
||||
|
||||
|
||||
if (FlagOn(Fcb->FcbState, FCB_STATE_DELETE_ON_CLOSE) &&
|
||||
!FlagOn(Vcb->VcbState, VCB_STATE_FLAG_WRITE_PROTECTED)) {
|
||||
|
||||
|
||||
//
|
||||
// Before truncating file allocation remember this
|
||||
// info for FatDeleteDirent.
|
||||
//
|
||||
|
||||
|
||||
DeleteContext.FileSize = Fcb->Header.FileSize.LowPart;
|
||||
DeleteContext.FirstClusterOfFile = Fcb->FirstClusterOfFile;
|
||||
|
||||
|
||||
DebugTrace(0, Dbg, "Delete File allocation\n", 0);
|
||||
|
||||
|
||||
//
|
||||
// Synchronize here with paging IO
|
||||
//
|
||||
|
||||
|
||||
(VOID)ExAcquireResourceExclusiveLite( Fcb->Header.PagingIoResource,
|
||||
TRUE );
|
||||
|
||||
|
||||
Fcb->Header.FileSize.LowPart = 0;
|
||||
Fcb->Header.ValidDataLength.LowPart = 0;
|
||||
Fcb->ValidDataToDisk = 0;
|
||||
|
||||
|
||||
ExReleaseResourceLite( Fcb->Header.PagingIoResource );
|
||||
|
||||
|
||||
_SEH2_TRY {
|
||||
|
||||
|
||||
FatSetFileSizeInDirent( IrpContext, Fcb, NULL );
|
||||
|
||||
|
||||
} _SEH2_EXCEPT( FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ?
|
||||
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {
|
||||
|
||||
|
||||
FatResetExceptionState( IrpContext );
|
||||
} _SEH2_END;
|
||||
|
||||
|
||||
Fcb->FcbState |= FCB_STATE_TRUNCATE_ON_CLOSE;
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
//
|
||||
// We must zero between ValidDataLength and FileSize
|
||||
//
|
||||
|
||||
|
||||
if (!FlagOn(Fcb->FcbState, FCB_STATE_PAGING_FILE) &&
|
||||
(Fcb->Header.ValidDataLength.LowPart < Fcb->Header.FileSize.LowPart)) {
|
||||
|
||||
|
||||
ULONG ValidDataLength;
|
||||
|
||||
|
||||
ValidDataLength = Fcb->Header.ValidDataLength.LowPart;
|
||||
|
||||
|
||||
if (ValidDataLength < Fcb->ValidDataToDisk) {
|
||||
ValidDataLength = Fcb->ValidDataToDisk;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Recheck, VDD can be >= FS
|
||||
//
|
||||
|
||||
|
||||
if (ValidDataLength < Fcb->Header.FileSize.LowPart) {
|
||||
|
||||
|
||||
_SEH2_TRY {
|
||||
|
||||
(VOID)FatZeroData( IrpContext,
|
||||
@ -858,18 +858,18 @@ Return Value:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// See if we are supposed to truncate the file on the last
|
||||
// close. If we cannot wait we'll ship this off to the fsp
|
||||
//
|
||||
|
||||
|
||||
_SEH2_TRY {
|
||||
|
||||
|
||||
if (FlagOn(Fcb->FcbState, FCB_STATE_TRUNCATE_ON_CLOSE)) {
|
||||
|
||||
|
||||
DebugTrace(0, Dbg, "truncate file allocation\n", 0);
|
||||
|
||||
|
||||
if (Vcb->VcbCondition == VcbGood) {
|
||||
|
||||
|
||||
@ -879,61 +879,61 @@ Return Value:
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// We also have to get rid of the Cache Map because
|
||||
// this is the only way we have of trashing the
|
||||
// truncated pages.
|
||||
//
|
||||
|
||||
|
||||
LocalTruncateSize = Fcb->Header.FileSize;
|
||||
TruncateSize = &LocalTruncateSize;
|
||||
|
||||
|
||||
//
|
||||
// Mark the Fcb as having now been truncated, just incase
|
||||
// we have to reship this off to the fsp.
|
||||
//
|
||||
|
||||
|
||||
Fcb->FcbState &= ~FCB_STATE_TRUNCATE_ON_CLOSE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Now check again if we are to delete the file and if
|
||||
// so then we remove the file from the disk.
|
||||
//
|
||||
|
||||
|
||||
if (FlagOn(Fcb->FcbState, FCB_STATE_DELETE_ON_CLOSE) &&
|
||||
Fcb->Header.AllocationSize.LowPart == 0) {
|
||||
|
||||
|
||||
DebugTrace(0, Dbg, "Delete File\n", 0);
|
||||
|
||||
|
||||
//
|
||||
// Now tunnel and delete the dirent
|
||||
//
|
||||
|
||||
|
||||
FatTunnelFcbOrDcb( Fcb, Ccb );
|
||||
|
||||
|
||||
FatDeleteDirent( IrpContext, Fcb, &DeleteContext, TRUE );
|
||||
|
||||
|
||||
//
|
||||
// Report that we have removed an entry.
|
||||
//
|
||||
|
||||
|
||||
FatNotifyReportChange( IrpContext,
|
||||
Vcb,
|
||||
Fcb,
|
||||
FILE_NOTIFY_CHANGE_FILE_NAME,
|
||||
FILE_ACTION_REMOVED );
|
||||
}
|
||||
|
||||
|
||||
} _SEH2_EXCEPT( FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ?
|
||||
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {
|
||||
|
||||
|
||||
FatResetExceptionState( IrpContext );
|
||||
} _SEH2_END;
|
||||
|
||||
|
||||
if (FlagOn(Fcb->FcbState, FCB_STATE_DELETE_ON_CLOSE)) {
|
||||
|
||||
|
||||
#if (NTDDI_VERSION >= NTDDI_WIN8)
|
||||
NTSTATUS BreakStatus;
|
||||
#endif
|
||||
@ -946,16 +946,16 @@ Return Value:
|
||||
// Note that we remove the name even if we couldn't
|
||||
// truncate the allocation and remove the dirent above.
|
||||
//
|
||||
|
||||
|
||||
FatRemoveNames( IrpContext, Fcb );
|
||||
|
||||
#if (NTDDI_VERSION >= NTDDI_WIN8)
|
||||
//
|
||||
// We've removed the names so break any parent directory oplock.
|
||||
// We've removed the names so break any parent directory oplock.
|
||||
// Directory oplock breaks are always advisory, so we will never
|
||||
// block/get STATUS_PENDING here.
|
||||
//
|
||||
|
||||
|
||||
BreakStatus = FsRtlCheckOplockEx( FatGetFcbOplock(Fcb->ParentDcb),
|
||||
Irp,
|
||||
(OPLOCK_FLAG_PARENT_OBJECT |
|
||||
@ -963,13 +963,13 @@ Return Value:
|
||||
NULL,
|
||||
NULL,
|
||||
NULL );
|
||||
|
||||
|
||||
ASSERT( BreakStatus != STATUS_PENDING );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// We've just finished everything associated with an unclean
|
||||
// fcb so now decrement the unclean count before releasing
|
||||
@ -996,13 +996,13 @@ Return Value:
|
||||
(Fcb->NonPaged->SectionObjectPointers.DataSectionObject != NULL)) {
|
||||
|
||||
CcFlushCache( &Fcb->NonPaged->SectionObjectPointers, NULL, 0, NULL );
|
||||
|
||||
|
||||
//
|
||||
// Grab and release PagingIo to serialize ourselves with the lazy writer.
|
||||
// This will work to ensure that all IO has completed on the cached
|
||||
// data and we will succesfully tear away the cache section.
|
||||
//
|
||||
|
||||
|
||||
ExAcquireResourceExclusiveLite( Fcb->Header.PagingIoResource, TRUE);
|
||||
ExReleaseResourceLite( Fcb->Header.PagingIoResource );
|
||||
|
||||
@ -1015,7 +1015,7 @@ Return Value:
|
||||
//
|
||||
// If the file is invalid, hint to the cache that we should throw everything out.
|
||||
//
|
||||
|
||||
|
||||
if ( Fcb->FcbCondition == FcbBad ) {
|
||||
|
||||
TruncateSize = &FatLargeZero;
|
||||
@ -1097,7 +1097,7 @@ Return Value:
|
||||
// Flush the file.
|
||||
//
|
||||
|
||||
if ((TypeOfOpen == UserFileOpen) &&
|
||||
if ((TypeOfOpen == UserFileOpen) &&
|
||||
FlagOn(FileObject->Flags, FO_FILE_MODIFIED)) {
|
||||
|
||||
Status = FatFlushFile( IrpContext, Fcb, Flush );
|
||||
@ -1107,7 +1107,7 @@ Return Value:
|
||||
// If that worked ok, then see if we should flush the FAT as well.
|
||||
//
|
||||
|
||||
if (NT_SUCCESS(Status) && Fcb && !FatIsFat12( Vcb) &&
|
||||
if (NT_SUCCESS(Status) && Fcb && !FatIsFat12( Vcb) &&
|
||||
FlagOn( Fcb->FcbState, FCB_STATE_FLUSH_FAT)) {
|
||||
|
||||
Status = FatFlushFat( IrpContext, Vcb);
|
||||
@ -1117,7 +1117,7 @@ Return Value:
|
||||
//
|
||||
|
||||
if (NT_SUCCESS(Status) && (Fcb->ParentDcb != NULL)) {
|
||||
|
||||
|
||||
Status = FatFlushFile( IrpContext, Fcb->ParentDcb, Flush );
|
||||
}
|
||||
}
|
||||
@ -1142,7 +1142,7 @@ Return Value:
|
||||
if (AcquiredVcb) { FatReleaseVcb( IrpContext, Vcb ); }
|
||||
|
||||
if (SendUnlockNotification) {
|
||||
|
||||
|
||||
FsRtlNotifyVolumeEvent( FileObject, FSRTL_VOLUME_UNLOCK );
|
||||
}
|
||||
|
||||
@ -1175,7 +1175,7 @@ FatAutoUnlock (
|
||||
//
|
||||
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
IoAcquireVpbSpinLock( &SavedIrql );
|
||||
|
||||
ClearFlag( Vcb->Vpb->Flags, (VPB_LOCKED | VPB_DIRECT_WRITES_ALLOWED) );
|
||||
|
@ -76,7 +76,7 @@ FatCloseWorker (
|
||||
#pragma alloc_text(PAGE, FatCloseWorker)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
_Function_class_(IRP_MJ_CLOSE)
|
||||
_Function_class_(DRIVER_DISPATCH)
|
||||
NTSTATUS
|
||||
@ -183,17 +183,17 @@ Return Value:
|
||||
// call the oplock package to get rid of any oplock state. This can only
|
||||
// be safely done in the FSD path.
|
||||
//
|
||||
|
||||
|
||||
if ((Fcb != NULL) &&
|
||||
!FlagOn( FileObject->Flags, FO_CLEANUP_COMPLETE ) &&
|
||||
FatIsFileOplockable( Fcb )) {
|
||||
|
||||
|
||||
//
|
||||
// This is equivalent to handling cleanup, and it always cleans up any
|
||||
// oplock immediately. Also, we don't need any locking of the FCB here;
|
||||
// the oplock's own lock will be sufficient for this purpose.
|
||||
//
|
||||
|
||||
|
||||
FsRtlCheckOplockEx( FatGetFcbOplock(Fcb),
|
||||
Irp,
|
||||
0,
|
||||
@ -204,7 +204,7 @@ Return Value:
|
||||
#endif
|
||||
|
||||
//
|
||||
// Metadata streams have had close contexts preallocated. Pull one out now, while we're
|
||||
// Metadata streams have had close contexts preallocated. Pull one out now, while we're
|
||||
// guaranteed the VCB exists.
|
||||
//
|
||||
|
||||
@ -221,7 +221,7 @@ Return Value:
|
||||
// Call the common Close routine if we are not delaying this close.
|
||||
//
|
||||
|
||||
if ((((TypeOfOpen == UserFileOpen) ||
|
||||
if ((((TypeOfOpen == UserFileOpen) ||
|
||||
(TypeOfOpen == UserDirectoryOpen)) &&
|
||||
FlagOn(Fcb->FcbState, FCB_STATE_DELAY_CLOSE) &&
|
||||
!FatData.ShutdownStarted) ||
|
||||
@ -238,7 +238,7 @@ Return Value:
|
||||
//
|
||||
|
||||
if( CloseContext == NULL ) {
|
||||
|
||||
|
||||
//
|
||||
// Free up any query template strings before using the close context fields,
|
||||
// which overlap (union)
|
||||
@ -248,7 +248,7 @@ Return Value:
|
||||
|
||||
CloseContext = &Ccb->CloseContext;
|
||||
CloseContext->Free = FALSE;
|
||||
|
||||
|
||||
SetFlag( Ccb->Flags, CCB_FLAG_CLOSE_CONTEXT );
|
||||
}
|
||||
|
||||
@ -272,12 +272,12 @@ Return Value:
|
||||
(BOOLEAN)(Fcb && FlagOn(Fcb->FcbState, FCB_STATE_DELAY_CLOSE)));
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
//
|
||||
// The close proceeded synchronously, so for the metadata objects we
|
||||
// can now drop the close context we preallocated.
|
||||
//
|
||||
|
||||
|
||||
if ((TypeOfOpen == VirtualVolumeFile) ||
|
||||
(TypeOfOpen == DirectoryFile) ||
|
||||
(TypeOfOpen == EaFile)
|
||||
@ -286,19 +286,19 @@ Return Value:
|
||||
if (CloseContext != NULL) {
|
||||
|
||||
ExFreePool( CloseContext );
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FatCompleteRequest( FatNull, Irp, Status );
|
||||
|
||||
}
|
||||
}
|
||||
_SEH2_EXCEPT(FatExceptionFilter( NULL, _SEH2_GetExceptionInformation() )) {
|
||||
|
||||
//
|
||||
// We had some trouble trying to perform the requested
|
||||
// operation, so we'll abort the I/O request with the
|
||||
// operation, so we'll abort the I/O request with the
|
||||
// error status that we get back from the exception code.
|
||||
//
|
||||
|
||||
@ -346,15 +346,15 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
UNREFERENCED_PARAMETER( DeviceObject );
|
||||
|
||||
|
||||
FsRtlEnterFileSystem();
|
||||
|
||||
|
||||
FatFspClose (Context);
|
||||
|
||||
|
||||
FsRtlExitFileSystem();
|
||||
}
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
FatFspClose (
|
||||
@ -394,9 +394,9 @@ Return Value:
|
||||
//
|
||||
// Set the top level IRP for the true FSP operation.
|
||||
//
|
||||
|
||||
|
||||
if (!ARGUMENT_PRESENT( Vcb )) {
|
||||
|
||||
|
||||
IoSetTopLevelIrp( (PIRP)FSRTL_FSP_TOP_LEVEL_IRP );
|
||||
TopLevel = TRUE;
|
||||
}
|
||||
@ -413,7 +413,7 @@ Return Value:
|
||||
//
|
||||
|
||||
if (!ARGUMENT_PRESENT(Vcb)) {
|
||||
|
||||
|
||||
if (!FatData.ShutdownStarted) {
|
||||
|
||||
if (CloseContext->Vcb != CurrentVcb) {
|
||||
@ -520,7 +520,7 @@ Return Value:
|
||||
//
|
||||
// Drop the context if it came from pool.
|
||||
//
|
||||
|
||||
|
||||
if (FreeContext) {
|
||||
|
||||
ExFreePool( CloseContext );
|
||||
@ -539,12 +539,12 @@ Return Value:
|
||||
//
|
||||
// Clean up the top level IRP hint if we owned it.
|
||||
//
|
||||
|
||||
|
||||
if (!ARGUMENT_PRESENT( Vcb )) {
|
||||
|
||||
|
||||
IoSetTopLevelIrp( NULL );
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// And return to our caller
|
||||
//
|
||||
@ -552,8 +552,8 @@ Return Value:
|
||||
DebugTrace(-1, Dbg, "FatFspClose -> NULL\n", 0);
|
||||
}
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
FatQueueClose (
|
||||
IN PCLOSE_CONTEXT CloseContext,
|
||||
@ -569,7 +569,7 @@ Routine Description:
|
||||
Arguments:
|
||||
|
||||
CloseContext - a close context to enqueue for the delayed close thread.
|
||||
|
||||
|
||||
DelayClose - whether this should go on the delayed close queue (unreferenced
|
||||
objects).
|
||||
|
||||
@ -624,8 +624,8 @@ Return Value:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
PCLOSE_CONTEXT
|
||||
FatRemoveClose (
|
||||
PVCB Vcb OPTIONAL,
|
||||
@ -641,7 +641,7 @@ Routine Description:
|
||||
Arguments:
|
||||
|
||||
Vcb - if specified, only returns close for this volume.
|
||||
|
||||
|
||||
LastVcbHint - if specified and other starvation avoidance is required by
|
||||
the system condition, will attempt to return closes for this volume.
|
||||
|
||||
@ -664,7 +664,7 @@ Return Value:
|
||||
// Remember if this is the worker thread, so we can pull down the active
|
||||
// flag should we run everything out.
|
||||
//
|
||||
|
||||
|
||||
WorkerThread = (Vcb == NULL);
|
||||
|
||||
//
|
||||
@ -685,20 +685,20 @@ Return Value:
|
||||
// Flip over to aggressive at twice the legal limit, and flip it
|
||||
// off at the legal limit.
|
||||
//
|
||||
|
||||
|
||||
if (!FatData.HighAsync && FatData.AsyncCloseCount > FatMaxDelayedCloseCount*2) {
|
||||
|
||||
FatData.HighAsync = TRUE;
|
||||
|
||||
|
||||
} else if (FatData.HighAsync && FatData.AsyncCloseCount < FatMaxDelayedCloseCount) {
|
||||
|
||||
FatData.HighAsync = FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (!FatData.HighDelayed && FatData.DelayedCloseCount > FatMaxDelayedCloseCount*2) {
|
||||
|
||||
FatData.HighDelayed = TRUE;
|
||||
|
||||
|
||||
} else if (FatData.HighDelayed && FatData.DelayedCloseCount < FatMaxDelayedCloseCount) {
|
||||
|
||||
FatData.HighDelayed = FALSE;
|
||||
@ -709,7 +709,7 @@ Return Value:
|
||||
Vcb = LastVcbHint;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Do the case when we don't care about which Vcb the close is on.
|
||||
// This is the case when we are in an ExWorkerThread and aren't
|
||||
@ -762,7 +762,7 @@ Return Value:
|
||||
CloseContext = NULL;
|
||||
|
||||
if (WorkerThread) {
|
||||
|
||||
|
||||
FatData.AsyncCloseActive = FALSE;
|
||||
}
|
||||
}
|
||||
@ -770,7 +770,7 @@ Return Value:
|
||||
//
|
||||
// We're running down a specific volume.
|
||||
//
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
@ -801,9 +801,9 @@ Return Value:
|
||||
CloseContext = CONTAINING_RECORD( Entry,
|
||||
CLOSE_CONTEXT,
|
||||
VcbLinks );
|
||||
|
||||
|
||||
RemoveEntryList( &CloseContext->GlobalLinks );
|
||||
|
||||
|
||||
//
|
||||
// If we were trying to run down the queues but didn't find anything for this
|
||||
// volume, flip over to accept anything and try again.
|
||||
@ -812,7 +812,7 @@ Return Value:
|
||||
} else if (LastVcbHint) {
|
||||
|
||||
goto AnyClose;
|
||||
|
||||
|
||||
//
|
||||
// There are no more closes to perform; show that we are done.
|
||||
//
|
||||
@ -828,8 +828,8 @@ Return Value:
|
||||
return CloseContext;
|
||||
}
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
NTSTATUS
|
||||
FatCommonClose (
|
||||
IN PVCB Vcb,
|
||||
@ -918,7 +918,7 @@ Return Value:
|
||||
IrpContext.NodeByteSize = sizeof( IrpContext );
|
||||
IrpContext.MajorFunction = IRP_MJ_CLOSE;
|
||||
IrpContext.Vcb = Vcb;
|
||||
|
||||
|
||||
if (Wait) {
|
||||
|
||||
SetFlag( IrpContext.Flags, IRP_CONTEXT_FLAG_WAIT );
|
||||
@ -1090,10 +1090,10 @@ Return Value:
|
||||
ObDereferenceObject( DirectoryFileObject );
|
||||
}
|
||||
|
||||
Fcb->OpenCount -= 1;
|
||||
Fcb->OpenCount -= 1;
|
||||
Vcb->OpenFileCount -= 1;
|
||||
if (FlagOn(Ccb->Flags, CCB_FLAG_READ_ONLY)) { Vcb->ReadOnlyCount -= 1; }
|
||||
|
||||
|
||||
FatDeleteCcb( &IrpContext, &Ccb );
|
||||
|
||||
break;
|
||||
@ -1195,7 +1195,7 @@ Return Value:
|
||||
//
|
||||
// See if there is only one open left. If so, it is ours. We only want
|
||||
// to check for a dismount if a dismount is not already in progress.
|
||||
// We also only do this if the Vcb condition is not VcbGood and the
|
||||
// We also only do this if the Vcb condition is not VcbGood and the
|
||||
// caller can handle the VCB going away. This is determined by whether
|
||||
// they passed in the VcbDeleted argument. This request also needs
|
||||
// to be top level.
|
||||
|
@ -274,7 +274,7 @@ FatCheckShareAccess (
|
||||
#pragma alloc_text(PAGE, FatSetFullNameInFcb)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
_Function_class_(IRP_MJ_CREATE)
|
||||
_Function_class_(DRIVER_DISPATCH)
|
||||
NTSTATUS
|
||||
@ -2576,7 +2576,7 @@ Return Value:
|
||||
return Iosb;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal support routine
|
||||
//
|
||||
@ -2751,7 +2751,7 @@ Arguments:
|
||||
return Iosb;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal support routine
|
||||
//
|
||||
@ -3171,7 +3171,7 @@ Return Value:
|
||||
return Iosb;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal support routine
|
||||
//
|
||||
@ -3913,7 +3913,7 @@ Return Value:
|
||||
|
||||
return Iosb;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Internal support routine
|
||||
//
|
||||
@ -4122,7 +4122,7 @@ Return Value:
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal support routine
|
||||
//
|
||||
@ -4402,7 +4402,7 @@ Return Value:
|
||||
return Iosb;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal support routine
|
||||
//
|
||||
@ -4882,7 +4882,7 @@ Return Value:
|
||||
return Iosb;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal support routine
|
||||
//
|
||||
@ -5596,7 +5596,7 @@ Return Value:
|
||||
return Iosb;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal support routine
|
||||
//
|
||||
@ -6344,7 +6344,7 @@ Return Value:
|
||||
return Iosb;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal support routine
|
||||
//
|
||||
@ -6823,7 +6823,7 @@ Return Value:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
NTSTATUS
|
||||
FatCheckSystemSecurityAccess (
|
||||
_In_ PIRP_CONTEXT IrpContext
|
||||
@ -6865,7 +6865,7 @@ FatCheckSystemSecurityAccess (
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NTSTATUS
|
||||
FatCheckShareAccess (
|
||||
_In_ PIRP_CONTEXT IrpContext,
|
||||
|
@ -44,7 +44,7 @@ FatDeviceControlCompletionRoutine(
|
||||
#pragma alloc_text(PAGE, FatFsdDeviceControl)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
_Function_class_(IRP_MJ_DEVICE_CONTROL)
|
||||
_Function_class_(DRIVER_DISPATCH)
|
||||
NTSTATUS
|
||||
@ -120,7 +120,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
NTSTATUS
|
||||
FatCommonDeviceControl (
|
||||
@ -357,7 +357,7 @@ Return Value:
|
||||
|
||||
//
|
||||
// Release all the resources that we held because of a
|
||||
// VOLSNAP_FLUSH_AND_HOLD.
|
||||
// VOLSNAP_FLUSH_AND_HOLD.
|
||||
//
|
||||
|
||||
NT_ASSERT( IrpSp->Parameters.DeviceIoControl.IoControlCode == IOCTL_VOLSNAP_FLUSH_AND_HOLD_WRITES );
|
||||
@ -380,7 +380,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -395,7 +395,7 @@ FatDeviceControlCompletionRoutine(
|
||||
|
||||
{
|
||||
PKEVENT Event = (PKEVENT) Contxt;
|
||||
|
||||
|
||||
//
|
||||
// If there is an event, this is a synch request. Signal and
|
||||
// let I/O know this isn't done yet.
|
||||
|
@ -187,7 +187,7 @@ FatSingleNonAlignedSync (
|
||||
#else
|
||||
#define FatUpdateIOCountersPCW(IsAWrite,Count)
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ALLOC_PRAGMA
|
||||
#pragma alloc_text(PAGE, FatMultipleAsync)
|
||||
#pragma alloc_text(PAGE, FatSingleAsync)
|
||||
@ -206,7 +206,7 @@ typedef struct FAT_PAGING_FILE_CONTEXT {
|
||||
PMDL RestoreMdl;
|
||||
} FAT_PAGING_FILE_CONTEXT, *PFAT_PAGING_FILE_CONTEXT;
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatPagingFileIo (
|
||||
IN PIRP Irp,
|
||||
@ -520,7 +520,7 @@ Return Value:
|
||||
|
||||
AssocIrp = IoMakeAssociatedIrp( Irp, (CCHAR)(DeviceObject->StackSize + 1) );
|
||||
}
|
||||
|
||||
|
||||
if (AssocIrp == NULL) {
|
||||
|
||||
AssocIrp = Irp;
|
||||
@ -542,7 +542,7 @@ Return Value:
|
||||
// Note that since we failed to launch this associated Irp, that the completion
|
||||
// code at the bottom will take care of completing the master Irp.
|
||||
//
|
||||
|
||||
|
||||
if (!NT_SUCCESS(Irp->IoStatus.Status)) {
|
||||
|
||||
NT_ASSERT( IrpCount );
|
||||
@ -550,22 +550,22 @@ Return Value:
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
//
|
||||
// Indicate we used an associated Irp.
|
||||
//
|
||||
|
||||
IrpCount -= 1;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// With an associated IRP, we must take over the first stack location so
|
||||
// we can have one to put the completion routine on. When re-using the
|
||||
// master IRP, its already there.
|
||||
//
|
||||
|
||||
|
||||
if (!IrpIsMaster) {
|
||||
|
||||
|
||||
//
|
||||
// Get the first IRP stack location in the associated Irp
|
||||
//
|
||||
@ -587,7 +587,7 @@ Return Value:
|
||||
//
|
||||
|
||||
NextIrpSp->DeviceObject = IrpSp->DeviceObject;
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
//
|
||||
@ -617,7 +617,7 @@ Return Value:
|
||||
//
|
||||
|
||||
if (IrpIsMaster) {
|
||||
|
||||
|
||||
IoSetCompletionRoutine( AssocIrp,
|
||||
FatPagingFileCompletionRoutineCatch,
|
||||
&Context,
|
||||
@ -626,7 +626,7 @@ Return Value:
|
||||
TRUE );
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
IoSetCompletionRoutine( AssocIrp,
|
||||
FatPagingFileCompletionRoutine,
|
||||
Irp,
|
||||
@ -671,7 +671,7 @@ Return Value:
|
||||
//
|
||||
|
||||
if (IrpIsMaster) {
|
||||
|
||||
|
||||
KeWaitForSingleObject( &Context.Event, Executive, KernelMode, FALSE, NULL );
|
||||
IrpIsMaster = MdlIsReserve = FALSE;
|
||||
|
||||
@ -684,7 +684,7 @@ Return Value:
|
||||
// associated Irp, and thus the completion code at the bottom will take care
|
||||
// of that for us.
|
||||
//
|
||||
|
||||
|
||||
if (!NT_SUCCESS(Irp->IoStatus.Status)) {
|
||||
|
||||
NT_ASSERT( IrpCount );
|
||||
@ -710,14 +710,14 @@ Return Value:
|
||||
//
|
||||
// Advance the Lbo/Vbo if we have more to do in the current run.
|
||||
//
|
||||
|
||||
|
||||
NextLbo += NextByteCount;
|
||||
NextVbo += NextByteCount;
|
||||
|
||||
NextByteCount = RemainingByteCount;
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
CurrentIndex += 1;
|
||||
|
||||
if ( CurrentIndex <= LastIndex ) {
|
||||
@ -739,11 +739,11 @@ Return Value:
|
||||
// If we didn't get enough associated Irps going to make this asynchronous, we
|
||||
// twiddle our thumbs and wait for those we did launch to complete.
|
||||
//
|
||||
|
||||
|
||||
if (IrpCount) {
|
||||
|
||||
while (Irp->AssociatedIrp.IrpCount != IrpCount) {
|
||||
|
||||
|
||||
KeDelayExecutionThread (KernelMode, FALSE, &Fat30Milliseconds);
|
||||
}
|
||||
|
||||
@ -775,7 +775,7 @@ Arguments:
|
||||
Irp - Supplies the requesting Irp.
|
||||
|
||||
ByteCount - The lengh of the operation.
|
||||
|
||||
|
||||
Return Value:
|
||||
|
||||
None.
|
||||
@ -875,9 +875,9 @@ Return Value:
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
NTSTATUS
|
||||
FatNonCachedIo (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -886,7 +886,7 @@ FatNonCachedIo (
|
||||
IN ULONG StartingVbo,
|
||||
IN ULONG ByteCount,
|
||||
IN ULONG UserByteCount,
|
||||
IN ULONG StreamFlags
|
||||
IN ULONG StreamFlags
|
||||
)
|
||||
/*++
|
||||
|
||||
@ -907,7 +907,7 @@ Arguments:
|
||||
StartingVbo - The starting point for the operation.
|
||||
|
||||
ByteCount - The lengh of the operation.
|
||||
|
||||
|
||||
UserByteCount - The last byte the user can see, rest to be zeroed.
|
||||
|
||||
StreamFlags - flag to indicate special attributes for a NonCachedIo.
|
||||
@ -1122,7 +1122,7 @@ Return Value:
|
||||
Stats->Fat.NonCachedDiskWrites += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DebugTrace( 0, Dbg, "Passing 1 Irp on to Disk Driver\n", 0 );
|
||||
|
||||
FatSingleAsync( IrpContext,
|
||||
@ -1207,7 +1207,7 @@ Return Value:
|
||||
IoRuns[NextRun].Offset = BufferOffset;
|
||||
IoRuns[NextRun].ByteCount = NextByteCount;
|
||||
NextRun += 1;
|
||||
|
||||
|
||||
//
|
||||
// Now adjust everything for the next pass through the loop.
|
||||
//
|
||||
@ -1233,7 +1233,7 @@ Return Value:
|
||||
&NextByteCount );
|
||||
|
||||
|
||||
NT_ASSERT(NextVbo == StartingVbo);
|
||||
NT_ASSERT(NextVbo == StartingVbo);
|
||||
|
||||
|
||||
}
|
||||
@ -1289,8 +1289,8 @@ Return Value:
|
||||
return Irp->IoStatus.Status;
|
||||
}
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
FatNonCachedNonAlignedRead (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -1617,7 +1617,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatMultipleAsync (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -1875,7 +1875,7 @@ Return Value:
|
||||
|
||||
//
|
||||
// For async requests if we acquired locks, transition the lock owners to an
|
||||
// object, since when we return this thread could go away before request
|
||||
// object, since when we return this thread could go away before request
|
||||
// completion, and the resource package may try to boost priority.
|
||||
//
|
||||
|
||||
@ -1952,8 +1952,8 @@ Return Value:
|
||||
if (!ExceptionExpected) {
|
||||
NT_ASSERT( ExceptionExpected );
|
||||
#ifdef _MSC_VER
|
||||
#pragma prefast( suppress:28159, "things are seriously wrong if we get here" )
|
||||
#endif
|
||||
#pragma prefast( suppress:28159, "things are seriously wrong if we get here" )
|
||||
#endif
|
||||
FatBugCheck( 0, 0, 0 );
|
||||
}
|
||||
|
||||
@ -1985,7 +1985,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatSingleAsync (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -2095,15 +2095,15 @@ Return Value:
|
||||
//
|
||||
// If this I/O requires override verify, bypass the verify logic.
|
||||
//
|
||||
|
||||
|
||||
if (FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_OVERRIDE_VERIFY )) {
|
||||
|
||||
|
||||
SetFlag( IrpSp->Flags, SL_OVERRIDE_VERIFY_VOLUME );
|
||||
}
|
||||
|
||||
//
|
||||
// For async requests if we acquired locks, transition the lock owners to an
|
||||
// object, since when we return this thread could go away before request
|
||||
// object, since when we return this thread could go away before request
|
||||
// completion, and the resource package may try to boost priority.
|
||||
//
|
||||
|
||||
@ -2128,7 +2128,7 @@ Return Value:
|
||||
//
|
||||
// Back up a copy of the IrpContext flags for later use in async completion.
|
||||
//
|
||||
|
||||
|
||||
IrpContext->FatIoContext->IrpContextFlags = IrpContext->Flags;
|
||||
|
||||
//
|
||||
@ -2166,7 +2166,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatSingleNonAlignedSync (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -2310,9 +2310,9 @@ Return Value:
|
||||
//
|
||||
// If this I/O requires override verify, bypass the verify logic.
|
||||
//
|
||||
|
||||
|
||||
if (FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_OVERRIDE_VERIFY )) {
|
||||
|
||||
|
||||
SetFlag( IrpSp->Flags, SL_OVERRIDE_VERIFY_VOLUME );
|
||||
}
|
||||
|
||||
@ -2362,7 +2362,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatWaitSync (
|
||||
IN PIRP_CONTEXT IrpContext
|
||||
@ -2396,7 +2396,7 @@ Return Value:
|
||||
DebugTrace(-1, Dbg, "FatWaitSync -> VOID\n", 0 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal Support Routine
|
||||
//
|
||||
@ -2497,7 +2497,7 @@ Return Value:
|
||||
return STATUS_MORE_PROCESSING_REQUIRED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal Support Routine
|
||||
//
|
||||
@ -2574,11 +2574,11 @@ Return Value:
|
||||
#endif
|
||||
|
||||
MasterIrp->IoStatus = Irp->IoStatus;
|
||||
|
||||
|
||||
}
|
||||
|
||||
NT_ASSERT( !(NT_SUCCESS( Irp->IoStatus.Status ) && Irp->IoStatus.Information == 0 ));
|
||||
|
||||
|
||||
if (InterlockedDecrement(&Context->IrpCount) == 0) {
|
||||
|
||||
FatDoCompletionZero( MasterIrp, Context );
|
||||
@ -2600,19 +2600,19 @@ Return Value:
|
||||
IoGetCurrentIrpStackLocation(MasterIrp)->MajorFunction == IRP_MJ_READ ?
|
||||
FO_FILE_FAST_IO_READ : FO_FILE_MODIFIED );
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
//
|
||||
// Post STATUS_VERIFY_REQUIRED failures. Only post top level IRPs, because recursive I/Os
|
||||
// cannot process volume verification.
|
||||
//
|
||||
|
||||
if (!FlagOn(Context->IrpContextFlags, IRP_CONTEXT_FLAG_RECURSIVE_CALL) &&
|
||||
|
||||
if (!FlagOn(Context->IrpContextFlags, IRP_CONTEXT_FLAG_RECURSIVE_CALL) &&
|
||||
(MasterIrp->IoStatus.Status == STATUS_VERIFY_REQUIRED)) {
|
||||
PostRequest = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
@ -2643,7 +2643,7 @@ Return Value:
|
||||
}
|
||||
|
||||
if (Context->Wait.Async.Resource2 != NULL) {
|
||||
|
||||
|
||||
ExReleaseResourceForThreadLite( Context->Wait.Async.Resource2,
|
||||
Context->Wait.Async.ResourceThreadId );
|
||||
}
|
||||
@ -2665,22 +2665,22 @@ Return Value:
|
||||
PIRP_CONTEXT IrpContext = NULL;
|
||||
|
||||
_SEH2_TRY {
|
||||
|
||||
|
||||
IrpContext = FatCreateIrpContext(Irp, TRUE );
|
||||
ClearFlag(IrpContext->Flags, IRP_CONTEXT_FLAG_RECURSIVE_CALL);
|
||||
FatFsdPostRequest( IrpContext, Irp );
|
||||
Status = STATUS_MORE_PROCESSING_REQUIRED;
|
||||
|
||||
|
||||
} _SEH2_EXCEPT( FatExceptionFilter(NULL, _SEH2_GetExceptionInformation()) ) {
|
||||
|
||||
//
|
||||
// If we failed to post the IRP, we just have to return the failure
|
||||
// to the user. :(
|
||||
//
|
||||
|
||||
|
||||
NOTHING;
|
||||
} _SEH2_END;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DebugTrace(-1, Dbg, "FatMultiAsyncCompletionRoutine -> SUCCESS\n", 0 );
|
||||
@ -2690,7 +2690,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NTSTATUS
|
||||
FatPagingFileErrorHandler (
|
||||
IN PIRP Irp,
|
||||
@ -2703,36 +2703,36 @@ Routine Description:
|
||||
|
||||
This routine attempts to guarantee that the media is marked dirty
|
||||
with the surface test bit if a paging file IO fails.
|
||||
|
||||
|
||||
The work done here has several basic problems
|
||||
|
||||
|
||||
1) when paging file writes start failing, this is a good sign
|
||||
that the rest of the system is about to fall down around us
|
||||
|
||||
|
||||
2) it has no forward progress guarantee
|
||||
|
||||
|
||||
With Whistler, it is actually quite intentional that we're rejiggering
|
||||
the paging file write path to make forward progress at all times. This
|
||||
means that the cases where it *does* fail, we're truly seeing media errors
|
||||
and this is probably going to mean the paging file is going to stop working
|
||||
very soon.
|
||||
|
||||
|
||||
It'd be nice to make this guarantee progress. It would need
|
||||
|
||||
|
||||
1) a guaranteed worker thread which can only be used by items which
|
||||
will make forward progress (i.e., not block out this one)
|
||||
|
||||
|
||||
2) the virtual volume file's pages containing the boot sector and
|
||||
1st FAT entry would have to be pinned resident and have a guaranteed
|
||||
mapping address
|
||||
|
||||
|
||||
3) mark volume would have to have a stashed irp/mdl and roll the write
|
||||
irp, or use a generalized mechanism to guarantee issue of the irp
|
||||
|
||||
|
||||
4) the lower stack would have to guarantee progress
|
||||
|
||||
|
||||
Of these, 1 and 4 may actually exist shortly.
|
||||
|
||||
|
||||
Arguments:
|
||||
|
||||
Irp - Pointer to the associated Irp which is being failed.
|
||||
@ -2795,7 +2795,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal Support Routine
|
||||
//
|
||||
@ -2822,9 +2822,9 @@ Routine Description:
|
||||
worker item to write out the dirty bit so that the next
|
||||
time we run we will do a autochk /r. This is not forward
|
||||
progress guaranteed at the moment.
|
||||
|
||||
|
||||
Clean up the Mdl used for this partial request.
|
||||
|
||||
|
||||
Note that if the Irp is failing, the error code is already where
|
||||
we want it.
|
||||
|
||||
@ -2849,7 +2849,7 @@ Return Value:
|
||||
UNREFERENCED_PARAMETER( DeviceObject );
|
||||
|
||||
DebugTrace(+1, Dbg, "FatPagingFileCompletionRoutineCatch, Context = %p\n", Context );
|
||||
|
||||
|
||||
//
|
||||
// Cleanup the existing Mdl, perhaps by returning the reserve.
|
||||
//
|
||||
@ -2858,7 +2858,7 @@ Return Value:
|
||||
|
||||
MmPrepareMdlForReuse( Irp->MdlAddress );
|
||||
KeSetEvent( &FatReserveEvent, 0, FALSE );
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
IoFreeMdl( Irp->MdlAddress );
|
||||
@ -2885,10 +2885,10 @@ Return Value:
|
||||
}
|
||||
|
||||
return STATUS_MORE_PROCESSING_REQUIRED;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal Support Routine
|
||||
//
|
||||
@ -2957,7 +2957,7 @@ Return Value:
|
||||
return FatPagingFileErrorHandler( Irp, NULL );
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal Support Routine
|
||||
//
|
||||
@ -3024,7 +3024,7 @@ Return Value:
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal Support Routine
|
||||
//
|
||||
@ -3096,7 +3096,7 @@ Return Value:
|
||||
return STATUS_MORE_PROCESSING_REQUIRED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal Support Routine
|
||||
//
|
||||
@ -3142,7 +3142,7 @@ Return Value:
|
||||
|
||||
{
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
|
||||
PFAT_IO_CONTEXT Context = Contxt;
|
||||
BOOLEAN PostRequest = FALSE;
|
||||
|
||||
@ -3178,7 +3178,7 @@ Return Value:
|
||||
DbgBreakPoint();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef SYSCACHE_COMPILE
|
||||
DbgPrint( "FAT SYSCACHE: SingleAsync (IRP %08x) -> %08x\n", Irp, Irp->IoStatus );
|
||||
#endif
|
||||
@ -3187,8 +3187,8 @@ Return Value:
|
||||
// Post STATUS_VERIFY_REQUIRED failures. Only post top level IRPs, because recursive I/Os
|
||||
// cannot process volume verification.
|
||||
//
|
||||
|
||||
if (!FlagOn(Context->IrpContextFlags, IRP_CONTEXT_FLAG_RECURSIVE_CALL) &&
|
||||
|
||||
if (!FlagOn(Context->IrpContextFlags, IRP_CONTEXT_FLAG_RECURSIVE_CALL) &&
|
||||
(Irp->IoStatus.Status == STATUS_VERIFY_REQUIRED)) {
|
||||
PostRequest = TRUE;
|
||||
}
|
||||
@ -3218,13 +3218,13 @@ Return Value:
|
||||
//
|
||||
|
||||
if (Context->Wait.Async.Resource != NULL) {
|
||||
|
||||
|
||||
ExReleaseResourceForThreadLite( Context->Wait.Async.Resource,
|
||||
Context->Wait.Async.ResourceThreadId );
|
||||
}
|
||||
|
||||
|
||||
if (Context->Wait.Async.Resource2 != NULL) {
|
||||
|
||||
|
||||
ExReleaseResourceForThreadLite( Context->Wait.Async.Resource2,
|
||||
Context->Wait.Async.ResourceThreadId );
|
||||
}
|
||||
@ -3246,19 +3246,19 @@ Return Value:
|
||||
PIRP_CONTEXT IrpContext = NULL;
|
||||
|
||||
_SEH2_TRY {
|
||||
|
||||
|
||||
IrpContext = FatCreateIrpContext(Irp, TRUE );
|
||||
ClearFlag(IrpContext->Flags, IRP_CONTEXT_FLAG_RECURSIVE_CALL);
|
||||
ClearFlag(IrpContext->Flags, IRP_CONTEXT_FLAG_RECURSIVE_CALL);
|
||||
FatFsdPostRequest( IrpContext, Irp );
|
||||
Status = STATUS_MORE_PROCESSING_REQUIRED;
|
||||
|
||||
|
||||
} _SEH2_EXCEPT( FatExceptionFilter(NULL, _SEH2_GetExceptionInformation()) ) {
|
||||
|
||||
//
|
||||
// If we failed to post the IRP, we just have to return the failure
|
||||
// to the user. :(
|
||||
//
|
||||
|
||||
|
||||
NOTHING;
|
||||
} _SEH2_END;
|
||||
}
|
||||
@ -3271,7 +3271,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatLockUserBuffer (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -3352,7 +3352,7 @@ Return Value:
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
}
|
||||
|
||||
|
||||
|
||||
PVOID
|
||||
FatMapUserBuffer (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -3366,7 +3366,7 @@ Routine Description:
|
||||
This routine conditionally maps the user buffer for the current I/O
|
||||
request in the specified mode. If the buffer is already mapped, it
|
||||
just returns its address.
|
||||
|
||||
|
||||
Note that this is the *input/output* buffer.
|
||||
|
||||
Arguments:
|
||||
@ -3392,7 +3392,7 @@ Return Value:
|
||||
if (Irp->MdlAddress == NULL) {
|
||||
|
||||
return Irp->UserBuffer;
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
PVOID Address = MmGetSystemAddressForMdlSafe( Irp->MdlAddress, NormalPagePriority | MdlMappingNoExecute );
|
||||
@ -3406,7 +3406,7 @@ Return Value:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
PVOID
|
||||
FatBufferUserBuffer (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -3420,7 +3420,7 @@ Routine Description:
|
||||
|
||||
This routine conditionally buffers the user buffer for the current I/O
|
||||
request. If the buffer is already buffered, it just returns its address.
|
||||
|
||||
|
||||
Note that this is the *input* buffer.
|
||||
|
||||
Arguments:
|
||||
@ -3428,7 +3428,7 @@ Arguments:
|
||||
Irp - Pointer to the Irp for the request.
|
||||
|
||||
BufferLength - Length of user buffer.
|
||||
|
||||
|
||||
Return Value:
|
||||
|
||||
Buffered address.
|
||||
@ -3445,12 +3445,12 @@ Return Value:
|
||||
//
|
||||
// Handle the no buffer case.
|
||||
//
|
||||
|
||||
|
||||
if (BufferLength == 0) {
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// If there is no system buffer we must have been supplied an Mdl
|
||||
// describing the users input buffer, which we will now snapshot.
|
||||
@ -3478,19 +3478,19 @@ Return Value:
|
||||
BufferLength );
|
||||
|
||||
} _SEH2_EXCEPT (EXCEPTION_EXECUTE_HANDLER) {
|
||||
|
||||
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
Status = _SEH2_GetExceptionCode();
|
||||
FatRaiseStatus( IrpContext,
|
||||
FsRtlIsNtstatusExpected(Status) ? Status : STATUS_INVALID_USER_BUFFER );
|
||||
} _SEH2_END;
|
||||
}
|
||||
|
||||
|
||||
return Irp->AssociatedIrp.SystemBuffer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NTSTATUS
|
||||
FatToggleMediaEjectDisable (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -3560,7 +3560,7 @@ Return Value:
|
||||
// So passing NULL for the final parameter is ok in this special case.
|
||||
//
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(suppress: 6387)
|
||||
#pragma warning(suppress: 6387)
|
||||
#endif
|
||||
Irp = IoBuildDeviceIoControlRequest( IOCTL_DISK_MEDIA_REMOVAL,
|
||||
Vcb->TargetDeviceObject,
|
||||
@ -3600,7 +3600,7 @@ Return Value:
|
||||
Status = IoCallDriver( Vcb->TargetDeviceObject, Irp );
|
||||
|
||||
if (Status == STATUS_PENDING) {
|
||||
|
||||
|
||||
(VOID) KeWaitForSingleObject( &SyncContext.Event,
|
||||
Executive,
|
||||
KernelMode,
|
||||
@ -3616,7 +3616,7 @@ Return Value:
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NTSTATUS
|
||||
FatPerformDevIoCtrl (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
|
@ -65,7 +65,7 @@ FatNotifyChangeDirectory (
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
_Function_class_(IRP_MJ_DIRECTORY_CONTROL)
|
||||
_Function_class_(DRIVER_DISPATCH)
|
||||
NTSTATUS
|
||||
@ -146,7 +146,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
NTSTATUS
|
||||
FatCommonDirectoryControl (
|
||||
@ -219,7 +219,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local Support Routine
|
||||
//
|
||||
@ -290,7 +290,7 @@ Return Value:
|
||||
PFILE_ID_BOTH_DIR_INFORMATION IdBothDirInfo;
|
||||
PFILE_NAMES_INFORMATION NamesInfo;
|
||||
|
||||
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
//
|
||||
@ -334,7 +334,7 @@ Return Value:
|
||||
// but UserDirectoryOpens. Also check that the filename is a valid
|
||||
// UNICODE string.
|
||||
//
|
||||
|
||||
|
||||
if (FatDecodeFileObject( IrpSp->FileObject,
|
||||
&Vcb,
|
||||
&Dcb,
|
||||
@ -375,8 +375,8 @@ Return Value:
|
||||
// order to update the search string in the Ccb. We may
|
||||
// discover that we are not the initial query once we grab the Fcb
|
||||
// and downgrade our status.
|
||||
//
|
||||
// If restartscan is set, we may be replacing the query template,
|
||||
//
|
||||
// If restartscan is set, we may be replacing the query template,
|
||||
// so take the FCB exclusive to protect against multiple people
|
||||
// changing the CCB at once.
|
||||
//
|
||||
@ -457,19 +457,19 @@ Return Value:
|
||||
// name.
|
||||
//
|
||||
|
||||
if (InitialQuery ||
|
||||
if (InitialQuery ||
|
||||
(RestartScan && UniArgFileName != NULL && UniArgFileName->Length != 0)) {
|
||||
|
||||
//
|
||||
// If we're restarting the scan, clear out the pattern in the Ccb and regenerate it,
|
||||
//
|
||||
|
||||
|
||||
if (RestartScan) {
|
||||
|
||||
|
||||
if (Ccb->UnicodeQueryTemplate.Buffer) {
|
||||
|
||||
if (FlagOn(Ccb->Flags, CCB_FLAG_FREE_UNICODE)) {
|
||||
|
||||
|
||||
ExFreePoolWithTag(Ccb->UnicodeQueryTemplate.Buffer, TAG_FILENAME_BUFFER);
|
||||
ClearFlag(Ccb->Flags, CCB_FLAG_FREE_UNICODE);
|
||||
}
|
||||
@ -486,7 +486,7 @@ Return Value:
|
||||
RtlFreeOemString( &Ccb->OemQueryTemplate.Wild );
|
||||
ClearFlag(Ccb->Flags, CCB_FLAG_FREE_OEM_BEST_FIT);
|
||||
}
|
||||
|
||||
|
||||
Ccb->OemQueryTemplate.Wild.Buffer = NULL;
|
||||
Ccb->OemQueryTemplate.Wild.Length = 0;
|
||||
Ccb->OemQueryTemplate.Wild.MaximumLength = 0;
|
||||
@ -833,11 +833,11 @@ Return Value:
|
||||
// We'll case on the type of information requested and fill up
|
||||
// the user buffer if everything fits.
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
// Determine the UNICODE length of the file name.
|
||||
//
|
||||
|
||||
|
||||
FileNameLength = RtlOemStringToCountedUnicodeSize(&Fat8Dot3String);
|
||||
|
||||
//
|
||||
@ -855,18 +855,18 @@ Return Value:
|
||||
// STATUS_SUCCESS is returned. A subsequent query will
|
||||
// pick up with this record.
|
||||
//
|
||||
|
||||
|
||||
BytesRemainingInBuffer = UserBufferLength - NextEntry;
|
||||
|
||||
|
||||
if ( (NextEntry != 0) &&
|
||||
( (BaseLength + FileNameLength > BytesRemainingInBuffer) ||
|
||||
(UserBufferLength < NextEntry) ) ) {
|
||||
|
||||
|
||||
DebugTrace(0, Dbg, "Next entry won't fit\n", 0);
|
||||
|
||||
|
||||
try_return( Status = STATUS_SUCCESS );
|
||||
}
|
||||
|
||||
|
||||
NT_ASSERT( BytesRemainingInBuffer >= BaseLength );
|
||||
|
||||
//
|
||||
@ -876,53 +876,53 @@ Return Value:
|
||||
RtlZeroMemory( &Buffer[NextEntry], BaseLength );
|
||||
|
||||
switch ( FileInformationClass ) {
|
||||
|
||||
|
||||
//
|
||||
// Now fill the base parts of the strucure that are applicable.
|
||||
//
|
||||
|
||||
|
||||
case FileBothDirectoryInformation:
|
||||
case FileFullDirectoryInformation:
|
||||
case FileIdBothDirectoryInformation:
|
||||
case FileIdFullDirectoryInformation:
|
||||
|
||||
DebugTrace(0, Dbg, "FatQueryDirectory -> Getting file full directory information\n", 0);
|
||||
|
||||
|
||||
//
|
||||
// Get the Ea file length.
|
||||
//
|
||||
|
||||
|
||||
FullDirInfo = (PFILE_FULL_DIR_INFORMATION)&Buffer[NextEntry];
|
||||
|
||||
|
||||
//
|
||||
// If the EAs are corrupt, ignore the error. We don't want
|
||||
// to abort the directory query.
|
||||
//
|
||||
|
||||
|
||||
_SEH2_TRY {
|
||||
|
||||
|
||||
FatGetEaLength( IrpContext,
|
||||
Vcb,
|
||||
Dirent,
|
||||
&FullDirInfo->EaSize );
|
||||
|
||||
|
||||
} _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
|
||||
|
||||
|
||||
FatResetExceptionState( IrpContext );
|
||||
FullDirInfo->EaSize = 0;
|
||||
} _SEH2_END;
|
||||
|
||||
|
||||
case FileDirectoryInformation:
|
||||
|
||||
|
||||
DirInfo = (PFILE_DIRECTORY_INFORMATION)&Buffer[NextEntry];
|
||||
|
||||
|
||||
FatGetDirTimes( IrpContext, Dirent, DirInfo );
|
||||
|
||||
|
||||
DirInfo->EndOfFile.QuadPart = Dirent->FileSize;
|
||||
|
||||
if (!FlagOn( Dirent->Attributes, FAT_DIRENT_ATTR_DIRECTORY )) {
|
||||
|
||||
|
||||
|
||||
DirInfo->AllocationSize.QuadPart =
|
||||
(((Dirent->FileSize + DiskAllocSize - 1) / DiskAllocSize) *
|
||||
DiskAllocSize );
|
||||
@ -937,87 +937,87 @@ Return Value:
|
||||
DirInfo->FileAttributes = 0;
|
||||
|
||||
DirInfo->FileAttributes |= FILE_ATTRIBUTE_NORMAL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DirInfo->FileIndex = NextVbo;
|
||||
|
||||
|
||||
DirInfo->FileNameLength = FileNameLength;
|
||||
|
||||
|
||||
DebugTrace(0, Dbg, "FatQueryDirectory -> Name = \"%Z\"\n", &Fat8Dot3String);
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case FileNamesInformation:
|
||||
|
||||
|
||||
DebugTrace(0, Dbg, "FatQueryDirectory -> Getting file names information\n", 0);
|
||||
|
||||
|
||||
NamesInfo = (PFILE_NAMES_INFORMATION)&Buffer[NextEntry];
|
||||
|
||||
|
||||
NamesInfo->FileIndex = NextVbo;
|
||||
|
||||
|
||||
NamesInfo->FileNameLength = FileNameLength;
|
||||
|
||||
|
||||
DebugTrace(0, Dbg, "FatQueryDirectory -> Name = \"%Z\"\n", &Fat8Dot3String );
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma prefast( suppress:28159, "things are seriously wrong if we get here" )
|
||||
#pragma prefast( suppress:28159, "things are seriously wrong if we get here" )
|
||||
#endif
|
||||
FatBugCheck( FileInformationClass, 0, 0 );
|
||||
}
|
||||
|
||||
BytesConverted = 0;
|
||||
|
||||
|
||||
Status = RtlOemToUnicodeN( (PWCH)&Buffer[NextEntry + BaseLength],
|
||||
BytesRemainingInBuffer - BaseLength,
|
||||
&BytesConverted,
|
||||
Fat8Dot3String.Buffer,
|
||||
Fat8Dot3String.Length );
|
||||
|
||||
|
||||
//
|
||||
// Check for the case that a single entry doesn't fit.
|
||||
// This should only get this far on the first entry
|
||||
//
|
||||
|
||||
|
||||
if (BytesConverted < FileNameLength) {
|
||||
|
||||
|
||||
NT_ASSERT( NextEntry == 0 );
|
||||
Status = STATUS_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Set up the previous next entry offset
|
||||
//
|
||||
|
||||
|
||||
*((PULONG)(&Buffer[LastEntry])) = NextEntry - LastEntry;
|
||||
|
||||
|
||||
//
|
||||
// And indicate how much of the user buffer we have currently
|
||||
// used up. We must compute this value before we long align
|
||||
// ourselves for the next entry
|
||||
//
|
||||
|
||||
|
||||
Irp->IoStatus.Information = QuadAlign( Irp->IoStatus.Information ) +
|
||||
BaseLength + BytesConverted;
|
||||
|
||||
|
||||
//
|
||||
// If something happened with the conversion, bail here.
|
||||
//
|
||||
|
||||
|
||||
if ( !NT_SUCCESS( Status ) ) {
|
||||
|
||||
|
||||
try_return( NOTHING );
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
ULONG ShortNameLength;
|
||||
|
||||
|
||||
FileNameLength = LongFileName.Length;
|
||||
|
||||
|
||||
//
|
||||
// Here are the rules concerning filling up the buffer:
|
||||
//
|
||||
@ -1033,20 +1033,20 @@ Return Value:
|
||||
// STATUS_SUCCESS is returned. A subsequent query will
|
||||
// pick up with this record.
|
||||
//
|
||||
|
||||
|
||||
BytesRemainingInBuffer = UserBufferLength - NextEntry;
|
||||
|
||||
|
||||
if ( (NextEntry != 0) &&
|
||||
( (BaseLength + FileNameLength > BytesRemainingInBuffer) ||
|
||||
(UserBufferLength < NextEntry) ) ) {
|
||||
|
||||
|
||||
DebugTrace(0, Dbg, "Next entry won't fit\n", 0);
|
||||
|
||||
|
||||
try_return( Status = STATUS_SUCCESS );
|
||||
}
|
||||
|
||||
|
||||
NT_ASSERT( BytesRemainingInBuffer >= BaseLength );
|
||||
|
||||
|
||||
//
|
||||
// Zero the base part of the structure.
|
||||
//
|
||||
@ -1054,90 +1054,90 @@ Return Value:
|
||||
RtlZeroMemory( &Buffer[NextEntry], BaseLength );
|
||||
|
||||
switch ( FileInformationClass ) {
|
||||
|
||||
|
||||
//
|
||||
// Now fill the base parts of the strucure that are applicable.
|
||||
//
|
||||
|
||||
|
||||
case FileBothDirectoryInformation:
|
||||
case FileIdBothDirectoryInformation:
|
||||
|
||||
|
||||
BothDirInfo = (PFILE_BOTH_DIR_INFORMATION)&Buffer[NextEntry];
|
||||
|
||||
|
||||
//
|
||||
// Now we have an entry to return to our caller. We'll convert
|
||||
// the name from the form in the dirent to a <name>.<ext> form.
|
||||
// We'll case on the type of information requested and fill up
|
||||
// the user buffer if everything fits.
|
||||
//
|
||||
|
||||
|
||||
Fat8dot3ToString( IrpContext, Dirent, FALSE, &Fat8Dot3String );
|
||||
|
||||
|
||||
NT_ASSERT( Fat8Dot3String.Length <= 12 );
|
||||
|
||||
|
||||
Status = RtlOemToUnicodeN( &BothDirInfo->ShortName[0],
|
||||
12*sizeof(WCHAR),
|
||||
&ShortNameLength,
|
||||
Fat8Dot3String.Buffer,
|
||||
Fat8Dot3String.Length );
|
||||
|
||||
|
||||
NT_ASSERT( Status != STATUS_BUFFER_OVERFLOW );
|
||||
NT_ASSERT( ShortNameLength <= 12*sizeof(WCHAR) );
|
||||
|
||||
|
||||
//
|
||||
// Copy the length into the dirinfo structure. Note
|
||||
// that the LHS below is a USHORT, so it can not
|
||||
// be specificed as the OUT parameter above.
|
||||
//
|
||||
|
||||
|
||||
BothDirInfo->ShortNameLength = (UCHAR)ShortNameLength;
|
||||
|
||||
|
||||
//
|
||||
// If something happened with the conversion, bail here.
|
||||
//
|
||||
|
||||
|
||||
if ( !NT_SUCCESS( Status ) ) {
|
||||
|
||||
|
||||
try_return( NOTHING );
|
||||
}
|
||||
|
||||
|
||||
case FileFullDirectoryInformation:
|
||||
case FileIdFullDirectoryInformation:
|
||||
|
||||
|
||||
DebugTrace(0, Dbg, "FatQueryDirectory -> Getting file full directory information\n", 0);
|
||||
|
||||
|
||||
//
|
||||
// Get the Ea file length.
|
||||
//
|
||||
|
||||
|
||||
FullDirInfo = (PFILE_FULL_DIR_INFORMATION)&Buffer[NextEntry];
|
||||
|
||||
|
||||
//
|
||||
// If the EAs are corrupt, ignore the error. We don't want
|
||||
// to abort the directory query.
|
||||
//
|
||||
|
||||
|
||||
_SEH2_TRY {
|
||||
|
||||
|
||||
FatGetEaLength( IrpContext,
|
||||
Vcb,
|
||||
Dirent,
|
||||
&FullDirInfo->EaSize );
|
||||
|
||||
|
||||
} _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
|
||||
|
||||
|
||||
FatResetExceptionState( IrpContext );
|
||||
FullDirInfo->EaSize = 0;
|
||||
} _SEH2_END;
|
||||
|
||||
|
||||
case FileDirectoryInformation:
|
||||
|
||||
|
||||
DirInfo = (PFILE_DIRECTORY_INFORMATION)&Buffer[NextEntry];
|
||||
|
||||
|
||||
FatGetDirTimes( IrpContext, Dirent, DirInfo );
|
||||
|
||||
|
||||
DirInfo->EndOfFile.QuadPart = Dirent->FileSize;
|
||||
|
||||
|
||||
if (!FlagOn( Dirent->Attributes, FAT_DIRENT_ATTR_DIRECTORY )) {
|
||||
|
||||
|
||||
@ -1147,7 +1147,7 @@ Return Value:
|
||||
/ DiskAllocSize )
|
||||
* DiskAllocSize );
|
||||
}
|
||||
|
||||
|
||||
if (Dirent->Attributes != 0) {
|
||||
DirInfo->FileAttributes = Dirent->Attributes;
|
||||
|
||||
@ -1162,31 +1162,31 @@ Return Value:
|
||||
|
||||
|
||||
DirInfo->FileIndex = NextVbo;
|
||||
|
||||
|
||||
DirInfo->FileNameLength = FileNameLength;
|
||||
|
||||
|
||||
DebugTrace(0, Dbg, "FatQueryDirectory -> Name = \"%Z\"\n", &Fat8Dot3String);
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case FileNamesInformation:
|
||||
|
||||
|
||||
DebugTrace(0, Dbg, "FatQueryDirectory -> Getting file names information\n", 0);
|
||||
|
||||
|
||||
NamesInfo = (PFILE_NAMES_INFORMATION)&Buffer[NextEntry];
|
||||
|
||||
|
||||
NamesInfo->FileIndex = NextVbo;
|
||||
|
||||
|
||||
NamesInfo->FileNameLength = FileNameLength;
|
||||
|
||||
|
||||
DebugTrace(0, Dbg, "FatQueryDirectory -> Name = \"%Z\"\n", &Fat8Dot3String );
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma prefast( suppress:28159, "things are seriously wrong if we get here" )
|
||||
#pragma prefast( suppress:28159, "things are seriously wrong if we get here" )
|
||||
#endif
|
||||
FatBugCheck( FileInformationClass, 0, 0 );
|
||||
}
|
||||
@ -1194,15 +1194,15 @@ Return Value:
|
||||
BytesConverted = BytesRemainingInBuffer - BaseLength >= FileNameLength ?
|
||||
FileNameLength :
|
||||
BytesRemainingInBuffer - BaseLength;
|
||||
|
||||
|
||||
RtlCopyMemory( &Buffer[NextEntry + BaseLength],
|
||||
&LongFileName.Buffer[0],
|
||||
BytesConverted );
|
||||
|
||||
|
||||
//
|
||||
// Set up the previous next entry offset
|
||||
//
|
||||
|
||||
|
||||
*((PULONG)(&Buffer[LastEntry])) = NextEntry - LastEntry;
|
||||
|
||||
//
|
||||
@ -1210,7 +1210,7 @@ Return Value:
|
||||
// used up. We must compute this value before we long align
|
||||
// ourselves for the next entry
|
||||
//
|
||||
|
||||
|
||||
Irp->IoStatus.Information = QuadAlign( Irp->IoStatus.Information ) +
|
||||
BaseLength + BytesConverted;
|
||||
|
||||
@ -1248,7 +1248,7 @@ Return Value:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
} _SEH2_EXCEPT (EXCEPTION_EXECUTE_HANDLER) {
|
||||
|
||||
//
|
||||
@ -1256,7 +1256,7 @@ Return Value:
|
||||
// fail this request. This is the only reason any exception
|
||||
// would have occured at this level.
|
||||
//
|
||||
|
||||
|
||||
Irp->IoStatus.Information = 0;
|
||||
UpdateCcb = FALSE;
|
||||
try_return( Status = _SEH2_GetExceptionCode());
|
||||
@ -1268,7 +1268,7 @@ Return Value:
|
||||
|
||||
LastEntry = NextEntry;
|
||||
NextEntry += (ULONG)QuadAlign(BaseLength + BytesConverted);
|
||||
|
||||
|
||||
CurrentVbo = NextVbo + sizeof( DIRENT );
|
||||
}
|
||||
|
||||
@ -1321,7 +1321,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local Support Routine
|
||||
//
|
||||
@ -1442,7 +1442,7 @@ Return Value:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local Support Routine
|
||||
//
|
||||
|
@ -194,7 +194,7 @@ FatDefragDirectory (
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
ULONG
|
||||
FatCreateNewDirent (
|
||||
@ -213,7 +213,7 @@ Routine Description:
|
||||
because the disk is full or the root directory is full) then
|
||||
it raises the appropriate status. The dirent itself is
|
||||
neither initialized nor pinned by this procedure.
|
||||
|
||||
|
||||
Arguments:
|
||||
|
||||
ParentDirectory - Supplies the DCB for the directory in which
|
||||
@ -373,7 +373,7 @@ Return Value:
|
||||
//
|
||||
|
||||
if (ParentDirectory->Header.AllocationSize.LowPart >= (64 * 1024 * sizeof(DIRENT)) ||
|
||||
|
||||
|
||||
//
|
||||
// Make sure we are not trying to expand the root directory on non
|
||||
// FAT32. FAT16 and FAT12 have fixed size allocations.
|
||||
@ -381,7 +381,7 @@ Return Value:
|
||||
|
||||
(!FatIsFat32(ParentDirectory->Vcb) &&
|
||||
NodeType(ParentDirectory) == FAT_NTC_ROOT_DCB)) {
|
||||
|
||||
|
||||
DebugTrace(0, Dbg, "Full root directory or too big on FAT32. Raise Status.\n", 0);
|
||||
|
||||
FatRaiseStatus( IrpContext, STATUS_CANNOT_MAKE );
|
||||
@ -545,7 +545,7 @@ Return Value:
|
||||
return ByteOffset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
@ -647,7 +647,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatTunnelFcbOrDcb (
|
||||
IN PFCB FcbOrDcb,
|
||||
@ -755,7 +755,7 @@ Return Value:
|
||||
if ((i*sizeof(WCHAR)) < ShortNameWithCase.Length) {
|
||||
DownCaseSeg.Buffer = &ShortNameWithCase.Buffer[i];
|
||||
DownCaseSeg.MaximumLength = DownCaseSeg.Length = ShortNameWithCase.Length - i*sizeof(WCHAR);
|
||||
|
||||
|
||||
RtlDowncaseUnicodeString(&DownCaseSeg, &DownCaseSeg, FALSE);
|
||||
}
|
||||
}
|
||||
@ -779,9 +779,9 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
FatDeleteDirent (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -838,7 +838,7 @@ Return Value:
|
||||
// Among other reasons, it'd be unfortunate if this raced with the
|
||||
// rename path.
|
||||
//
|
||||
|
||||
|
||||
NT_ASSERT( ExIsResourceAcquiredExclusiveLite( &FcbOrDcb->Vcb->Resource ));
|
||||
|
||||
//
|
||||
@ -857,9 +857,9 @@ Return Value:
|
||||
(FcbOrDcb->Header.FileSize.LowPart != 0)))) {
|
||||
|
||||
DebugTrace( 0, Dbg, "Called with non zero allocation/file size.\n", 0);
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma prefast( suppress:28159, "things are seriously wrong if we get here" )
|
||||
#pragma prefast( suppress:28159, "things are seriously wrong if we get here" )
|
||||
#endif
|
||||
FatBugCheck( 0, 0, 0 );
|
||||
}
|
||||
@ -879,9 +879,9 @@ Return Value:
|
||||
//
|
||||
// This relies on our bottom up lockorder.
|
||||
//
|
||||
|
||||
|
||||
ExAcquireResourceExclusiveLite( FcbOrDcb->ParentDcb->Header.Resource, TRUE );
|
||||
|
||||
|
||||
for ( Offset = FcbOrDcb->LfnOffsetWithinDirectory;
|
||||
Offset <= FcbOrDcb->DirentOffsetWithinDirectory;
|
||||
Offset += sizeof(DIRENT), Dirent += 1 ) {
|
||||
@ -966,7 +966,7 @@ Return Value:
|
||||
|
||||
Dirent->FileSize = DeleteContext->FileSize;
|
||||
|
||||
|
||||
|
||||
Dirent->FirstClusterOfFile = (USHORT)DeleteContext->FirstClusterOfFile;
|
||||
}
|
||||
|
||||
@ -985,11 +985,11 @@ Return Value:
|
||||
} _SEH2_FINALLY {
|
||||
|
||||
FatUnpinBcb( IrpContext, Bcb );
|
||||
|
||||
|
||||
//
|
||||
// Release our parent.
|
||||
//
|
||||
|
||||
|
||||
ExReleaseResourceLite( FcbOrDcb->ParentDcb->Header.Resource );
|
||||
} _SEH2_END;
|
||||
|
||||
@ -1017,7 +1017,7 @@ Arguments:
|
||||
|
||||
Lfn - The Lfn to look for
|
||||
|
||||
Lfn - Temporary buffer to use to search for Lfn with (if < MAX_LFN then this
|
||||
Lfn - Temporary buffer to use to search for Lfn with (if < MAX_LFN then this
|
||||
function may cause it to be allocated from pool if not large enough.
|
||||
|
||||
Retrn Value:
|
||||
@ -1045,7 +1045,7 @@ Retrn Value:
|
||||
Ccb.Flags = CCB_FLAG_SKIP_SHORT_NAME_COMPARE | CCB_FLAG_QUERY_TEMPLATE_MIXED;
|
||||
|
||||
_SEH2_TRY {
|
||||
|
||||
|
||||
FatLocateDirent( IrpContext,
|
||||
Dcb,
|
||||
&Ccb,
|
||||
@ -1057,20 +1057,20 @@ Retrn Value:
|
||||
NULL,
|
||||
LfnTmp,
|
||||
NULL );
|
||||
|
||||
|
||||
} _SEH2_FINALLY {
|
||||
|
||||
if (DirentBcb) {
|
||||
|
||||
Result = TRUE;
|
||||
}
|
||||
|
||||
|
||||
FatUnpinBcb(IrpContext, DirentBcb);
|
||||
} _SEH2_END;
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
@ -1085,7 +1085,7 @@ FatLocateDirent (
|
||||
OUT PVBO ByteOffset,
|
||||
OUT PBOOLEAN FileNameDos OPTIONAL,
|
||||
IN OUT PUNICODE_STRING LongFileName OPTIONAL,
|
||||
IN OUT PUNICODE_STRING OrigLongFileName OPTIONAL
|
||||
IN OUT PUNICODE_STRING OrigLongFileName OPTIONAL
|
||||
)
|
||||
|
||||
/*++
|
||||
@ -1138,7 +1138,7 @@ Return Value:
|
||||
UNICODE_STRING UpcasedLfn = {0};
|
||||
WCHAR LocalLfnBuffer[32];
|
||||
|
||||
|
||||
|
||||
BOOLEAN LfnInProgress = FALSE;
|
||||
UCHAR LfnChecksum = 0;
|
||||
ULONG LfnSize = 0;
|
||||
@ -1162,7 +1162,7 @@ Return Value:
|
||||
// We must have acquired the parent or the vcb to synchronize with deletion. This
|
||||
// is important since we can't survive racing a thread marking a series of lfn
|
||||
// dirents deleted - we'd get a bogus ordinal, and otherwise get really messed up.
|
||||
//
|
||||
//
|
||||
// This routine cannot do the acquire since it would be out-of-order with respect
|
||||
// to the Bcb resources on iterative calls. Our order has Bcbs as the inferior resource.
|
||||
//
|
||||
@ -1176,7 +1176,7 @@ Return Value:
|
||||
ExIsResourceAcquiredExclusiveLite( ParentDirectory->Header.Resource ) ||
|
||||
ExIsResourceAcquiredSharedLite( &ParentDirectory->Vcb->Resource ) ||
|
||||
ExIsResourceAcquiredExclusiveLite( &ParentDirectory->Vcb->Resource ));
|
||||
|
||||
|
||||
//
|
||||
// The algorithm here is pretty simple. We just walk through the
|
||||
// parent directory until we:
|
||||
@ -1188,7 +1188,7 @@ Return Value:
|
||||
//
|
||||
// In the first case we found it, in the latter three cases we did not.
|
||||
//
|
||||
|
||||
|
||||
UNREFERENCED_PARAMETER( Flags ); // future use
|
||||
|
||||
|
||||
@ -1297,7 +1297,7 @@ Return Value:
|
||||
// If the entry is marked deleted, skip. If there was an Lfn in
|
||||
// progress we throw it out at this point.
|
||||
//
|
||||
|
||||
|
||||
if ((*Dirent)->FileName[0] == FAT_DIRENT_DELETED) {
|
||||
|
||||
LfnInProgress = FALSE;
|
||||
@ -1392,7 +1392,7 @@ Return Value:
|
||||
|
||||
LfnIndex = (Ordinal - 1) * 13;
|
||||
|
||||
FatEnsureStringBufferEnough( LongFileName,
|
||||
FatEnsureStringBufferEnough( LongFileName,
|
||||
(USHORT)((LfnIndex + 13) << 1));
|
||||
|
||||
RtlCopyMemory( &LongFileName->Buffer[LfnIndex+0],
|
||||
@ -1475,7 +1475,7 @@ Return Value:
|
||||
// If we actually were asked to hand back volume labels,
|
||||
// do it.
|
||||
//
|
||||
|
||||
|
||||
if (FlagOn(Ccb->Flags, CCB_FLAG_MATCH_VOLUME_ID)) {
|
||||
|
||||
break;
|
||||
@ -1510,7 +1510,7 @@ Return Value:
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// If we are supposed to match all entries, then match this entry.
|
||||
//
|
||||
@ -1630,7 +1630,7 @@ Return Value:
|
||||
// We need a buffer. Try to avoid doing an allocation.
|
||||
//
|
||||
|
||||
FatEnsureStringBufferEnough( &UpcasedLfn,
|
||||
FatEnsureStringBufferEnough( &UpcasedLfn,
|
||||
LongFileName->Length);
|
||||
|
||||
Status = RtlUpcaseUnicodeString( &UpcasedLfn,
|
||||
@ -1644,7 +1644,7 @@ Return Value:
|
||||
|
||||
|
||||
UpcasedLfnValid = TRUE;
|
||||
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
@ -1671,7 +1671,7 @@ Return Value:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1705,7 +1705,7 @@ GetNextDirent:
|
||||
|
||||
FatFreeStringBuffer( &UpcasedLfn );
|
||||
|
||||
|
||||
|
||||
} _SEH2_END;
|
||||
|
||||
DebugTrace(-1, Dbg, "FatLocateDirent -> (VOID)\n", 0);
|
||||
@ -1715,8 +1715,8 @@ GetNextDirent:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
FatLocateSimpleOemDirent (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -1793,7 +1793,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
@ -1935,7 +1935,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
@ -2029,17 +2029,17 @@ Return Value:
|
||||
// verify) but we'll handle and raise here to save all callers checking the
|
||||
// pointers.
|
||||
//
|
||||
|
||||
|
||||
if ((NULL == *Dirent) && !ReturnOnFailure) {
|
||||
|
||||
NT_ASSERT( FALSE);
|
||||
FatRaiseStatus( IrpContext, STATUS_FILE_CORRUPT_ERROR);
|
||||
}
|
||||
|
||||
|
||||
DebugTrace(-1, Dbg, "FatGetDirentFromFcbOrDcb -> (VOID)\n", 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
BOOLEAN
|
||||
@ -2139,10 +2139,10 @@ Return Value:
|
||||
if ((Dirent->FileName[0] != FAT_DIRENT_DELETED) &&
|
||||
(Dirent->Attributes != FAT_DIRENT_ATTR_LFN)) {
|
||||
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
@ -2163,10 +2163,10 @@ Return Value:
|
||||
return IsDirectoryEmpty;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatConstructDirent (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -2248,7 +2248,7 @@ Return Value:
|
||||
FALSE,
|
||||
&Dirent->CreationTime,
|
||||
&Dirent->CreationMSec )) {
|
||||
|
||||
|
||||
//
|
||||
// No tunneled time or the tunneled time was bogus. Since we aren't
|
||||
// responsible for initializing the to-be-created Fcb with creation
|
||||
@ -2435,7 +2435,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatConstructLabelDirent (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -2494,8 +2494,8 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
FatSetFileSizeInDirent (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -2549,7 +2549,7 @@ Return Value:
|
||||
} _SEH2_END;
|
||||
}
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
FatSetFileSizeInDirentNoRaise (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -2580,9 +2580,9 @@ Return Value:
|
||||
|
||||
{
|
||||
_SEH2_TRY {
|
||||
|
||||
|
||||
FatSetFileSizeInDirent( IrpContext, Fcb, AlternativeFileSize );
|
||||
|
||||
|
||||
} _SEH2_EXCEPT(FatExceptionFilter( IrpContext, _SEH2_GetExceptionInformation() )) {
|
||||
|
||||
NOTHING;
|
||||
@ -2590,7 +2590,7 @@ Return Value:
|
||||
}
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
FatUpdateDirentFromFcb (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -2611,9 +2611,9 @@ Routine Description:
|
||||
Arguments:
|
||||
|
||||
FileObject - Fileobject representing the handle involved
|
||||
|
||||
|
||||
FcbOrDcb - File/Dir involved
|
||||
|
||||
|
||||
Ccb - User context involved
|
||||
|
||||
Return Value:
|
||||
@ -2645,7 +2645,7 @@ Return Value:
|
||||
// Nothing to do if the fcb is bad, volume is readonly or we got the
|
||||
// root dir.
|
||||
//
|
||||
|
||||
|
||||
if (FcbOrDcb->FcbCondition != FcbGood ||
|
||||
NodeType(FcbOrDcb) == FAT_NTC_ROOT_DCB ||
|
||||
FlagOn(FcbOrDcb->Vcb->VcbState, VCB_STATE_FLAG_WRITE_PROTECTED)) {
|
||||
@ -2722,7 +2722,7 @@ Return Value:
|
||||
// Break parent directory oplock. Directory oplock breaks are
|
||||
// always advisory, so we will never block/get STATUS_PENDING here.
|
||||
//
|
||||
|
||||
|
||||
if (FcbOrDcb->ParentDcb != NULL) {
|
||||
|
||||
FsRtlCheckOplockEx( FatGetFcbOplock(FcbOrDcb->ParentDcb),
|
||||
@ -2733,7 +2733,7 @@ Return Value:
|
||||
NULL );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// Get the dirent
|
||||
//
|
||||
@ -2757,7 +2757,7 @@ Return Value:
|
||||
|
||||
Dirent->Attributes |= FILE_ATTRIBUTE_ARCHIVE;
|
||||
FcbOrDcb->DirentFatFlags |= FILE_ATTRIBUTE_ARCHIVE;
|
||||
|
||||
|
||||
NotifyFilter |= FILE_NOTIFY_CHANGE_ATTRIBUTES;
|
||||
UpdateDirent = TRUE;
|
||||
}
|
||||
@ -2813,15 +2813,15 @@ Return Value:
|
||||
//
|
||||
|
||||
NT_ASSERT( NodeType(FcbOrDcb) == FAT_NTC_FCB );
|
||||
|
||||
|
||||
if (Dirent->FileSize != FcbOrDcb->Header.FileSize.LowPart) {
|
||||
|
||||
|
||||
//
|
||||
// Update the dirent file size
|
||||
//
|
||||
|
||||
|
||||
Dirent->FileSize = FcbOrDcb->Header.FileSize.LowPart;
|
||||
|
||||
|
||||
//
|
||||
// We call the notify package to report that the
|
||||
// size has changed.
|
||||
@ -2829,9 +2829,9 @@ Return Value:
|
||||
|
||||
NotifyFilter |= FILE_NOTIFY_CHANGE_SIZE;
|
||||
UpdateDirent = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -2869,7 +2869,7 @@ Return Value:
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal support routine
|
||||
//
|
||||
@ -2913,7 +2913,7 @@ Return Value:
|
||||
return Checksum;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0 // It turns out Win95 is still creating short names without a ~
|
||||
|
||||
@ -3078,7 +3078,7 @@ Return Value:
|
||||
return TRUE;
|
||||
}
|
||||
#endif //0
|
||||
|
||||
|
||||
//
|
||||
// Internal support routine
|
||||
//
|
||||
@ -3294,7 +3294,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal support routine
|
||||
//
|
||||
@ -3444,7 +3444,7 @@ Return Value:
|
||||
McbInitialized = TRUE;
|
||||
|
||||
do {
|
||||
|
||||
|
||||
FatLocateDirent( IrpContext,
|
||||
Dcb,
|
||||
&Ccb,
|
||||
@ -3668,7 +3668,7 @@ Return Value:
|
||||
//
|
||||
|
||||
_SEH2_TRY {
|
||||
|
||||
|
||||
FatUnpinRepinnedBcbs( IrpContext );
|
||||
|
||||
} _SEH2_EXCEPT(FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ?
|
||||
@ -3705,18 +3705,18 @@ Return Value:
|
||||
// to update the Fcb. If this raises, we have to give up and blow
|
||||
// evenyone else away too.
|
||||
//
|
||||
|
||||
|
||||
if (!InvalidateFcbs) {
|
||||
|
||||
|
||||
_SEH2_TRY {
|
||||
|
||||
|
||||
FatLocateSimpleOemDirent( IrpContext,
|
||||
Dcb,
|
||||
&Fcb->ShortName.Name.Oem,
|
||||
&TmpDirent,
|
||||
&TmpBcb,
|
||||
(PVBO)&TmpOffset );
|
||||
|
||||
|
||||
} _SEH2_EXCEPT(FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ?
|
||||
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) {
|
||||
|
||||
|
@ -77,7 +77,7 @@ ULONG FatDumpCurrentColumn;
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatDump (
|
||||
IN PVOID Ptr
|
||||
@ -136,7 +136,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatDumpDataHeader (
|
||||
)
|
||||
@ -186,7 +186,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatDumpVcb (
|
||||
IN PVCB Ptr
|
||||
@ -249,7 +249,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatDumpFcb (
|
||||
IN PFCB Ptr
|
||||
@ -338,7 +338,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatDumpCcb (
|
||||
IN PCCB Ptr
|
||||
|
@ -164,7 +164,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_Function_class_(IRP_MJ_SET_EA)
|
||||
_Function_class_(DRIVER_DISPATCH)
|
||||
NTSTATUS
|
||||
@ -245,7 +245,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NTSTATUS
|
||||
FatCommonQueryEa (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -270,7 +270,7 @@ Return Value:
|
||||
--*/
|
||||
|
||||
{
|
||||
#if 0
|
||||
#if 0
|
||||
PIO_STACK_LOCATION IrpSp;
|
||||
|
||||
NTSTATUS Status;
|
||||
@ -306,7 +306,7 @@ Return Value:
|
||||
|
||||
FatCompleteRequest( IrpContext, Irp, STATUS_INVALID_DEVICE_REQUEST);
|
||||
return STATUS_INVALID_DEVICE_REQUEST;
|
||||
|
||||
|
||||
#if 0
|
||||
//
|
||||
// Get the current Irp stack location
|
||||
@ -654,7 +654,7 @@ Return Value:
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
NTSTATUS
|
||||
FatCommonSetEa (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -679,7 +679,7 @@ Return Value:
|
||||
--*/
|
||||
|
||||
{
|
||||
#if 0
|
||||
#if 0
|
||||
PIO_STACK_LOCATION IrpSp;
|
||||
|
||||
NTSTATUS Status;
|
||||
@ -716,9 +716,9 @@ Return Value:
|
||||
|
||||
FatCompleteRequest( IrpContext, Irp, STATUS_INVALID_DEVICE_REQUEST);
|
||||
return STATUS_INVALID_DEVICE_REQUEST;
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
|
||||
//
|
||||
// The following booleans are used in the unwind process.
|
||||
//
|
||||
@ -856,7 +856,7 @@ Return Value:
|
||||
//
|
||||
// Now go pick up everything
|
||||
//
|
||||
|
||||
|
||||
FatAcquireSharedVcb( IrpContext, Fcb->Vcb );
|
||||
AcquiredVcb = TRUE;
|
||||
FatAcquireExclusiveFcb( IrpContext, Fcb );
|
||||
@ -1601,7 +1601,7 @@ Return Value:
|
||||
return Iosb;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local Support Routine
|
||||
//
|
||||
@ -1739,7 +1739,7 @@ Return Value:
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local Support Routine
|
||||
//
|
||||
@ -1957,7 +1957,7 @@ Return Value:
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local Support Routine
|
||||
//
|
||||
|
@ -48,7 +48,7 @@ Abstract:
|
||||
|
||||
#define EA_SECTION_SIZE (0x00040000)
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
FatGetEaLength (
|
||||
@ -202,8 +202,8 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
FatGetNeedEaCount (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -349,8 +349,8 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
FatCreateEa (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -779,7 +779,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
FatGetEaFile (
|
||||
@ -1160,7 +1160,7 @@ Return Value:
|
||||
// The discerning reader will note that this doesn't take
|
||||
// FAT32 into account, which is of course intentional.
|
||||
//
|
||||
|
||||
|
||||
(*EaDirent)->FirstClusterOfFile =
|
||||
(USHORT) FatGetIndexFromLbo( Vcb, FirstLboOfFile );
|
||||
}
|
||||
@ -1268,7 +1268,7 @@ Return Value:
|
||||
|
||||
FatReleaseFcb( IrpContext, Vcb->EaFcb );
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Dereference the Ea stream file if created.
|
||||
//
|
||||
@ -1283,7 +1283,7 @@ Return Value:
|
||||
// Always release the root Dcb (our caller releases the EA Fcb if we
|
||||
// do not raise).
|
||||
//
|
||||
|
||||
|
||||
if (UnwindLockedRootDcb) {
|
||||
|
||||
FatReleaseFcb( IrpContext, Vcb->RootDcb );
|
||||
@ -1301,7 +1301,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatReadEaSet (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -1531,8 +1531,8 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
FatDeleteEaSet (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -2003,7 +2003,7 @@ Return Value:
|
||||
//
|
||||
|
||||
if (UnwindPrevFileSize) {
|
||||
|
||||
|
||||
EaFcb->Header.FileSize.LowPart = UnwindPrevFileSize;
|
||||
EaFcb->Header.AllocationSize.LowPart = UnwindPrevFileSize;
|
||||
EaDirent->FileSize = UnwindPrevFileSize;
|
||||
@ -2014,7 +2014,7 @@ Return Value:
|
||||
(PCC_FILE_SIZES)&EaFcb->Header.AllocationSize );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// If we merged the tail with the
|
||||
// ea file header. We split it out
|
||||
@ -2086,9 +2086,9 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
FatAddEaSet (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -2390,7 +2390,7 @@ Return Value:
|
||||
|
||||
FatRaiseStatus( IrpContext, STATUS_INSUFFICIENT_RESOURCES );
|
||||
}
|
||||
|
||||
|
||||
FsRtlInitializeLargeMcb( &EaSetMcb, PagedPool );
|
||||
|
||||
UnwindInitializedEaSetMcb = TRUE;
|
||||
@ -2809,7 +2809,7 @@ Return Value:
|
||||
//
|
||||
|
||||
if (UnwindPrevFileSize) {
|
||||
|
||||
|
||||
EaFcb->Header.FileSize.LowPart = UnwindPrevFileSize;
|
||||
EaFcb->Header.AllocationSize.LowPart = UnwindPrevFileSize;
|
||||
EaDirent->FileSize = UnwindPrevFileSize;
|
||||
@ -2820,7 +2820,7 @@ Return Value:
|
||||
(PCC_FILE_SIZES)&EaFcb->Header.AllocationSize );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// If we merged the tail then split it off.
|
||||
//
|
||||
@ -2962,7 +2962,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatAppendPackedEa (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -3143,7 +3143,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatDeletePackedEa (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -3252,7 +3252,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ULONG
|
||||
FatLocateNextEa (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -3339,7 +3339,7 @@ Return Value:
|
||||
return Offset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOLEAN
|
||||
FatLocateEaByName (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -3424,7 +3424,7 @@ Return Value:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOLEAN
|
||||
FatIsEaNameValid (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -3507,7 +3507,7 @@ Return Value:
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatPinEaRange (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -3584,7 +3584,7 @@ Return Value:
|
||||
EaRange->AuxilaryBuffer = TRUE;
|
||||
|
||||
DestinationBuffer = EaRange->Data;
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
//
|
||||
@ -3704,7 +3704,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatMarkEaRangeDirty (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -3739,7 +3739,7 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
//
|
||||
// If there is an auxilary buffer we need to copy the data back into the cache.
|
||||
//
|
||||
@ -3777,7 +3777,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatUnpinEaRange (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
|
@ -38,7 +38,7 @@ typedef LBO *PLBO;
|
||||
typedef ULONG32 VBO;
|
||||
typedef VBO *PVBO;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// The boot sector is the first physical sector (LBN == 0) on the volume.
|
||||
// Part of the sector contains a BIOS Parameter Block. The BIOS in the
|
||||
@ -295,7 +295,7 @@ typedef FAT_TIME_STAMP *PFAT_TIME_STAMP;
|
||||
typedef UCHAR FAT8DOT3[11];
|
||||
typedef FAT8DOT3 *PFAT8DOT3;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// The directory entry record exists for every file/directory on the
|
||||
// disk except for the root directory.
|
||||
@ -343,14 +343,14 @@ typedef DIRENT *PDIRENT;
|
||||
//
|
||||
// These two bits are used for EFS on FAT
|
||||
// 0x1 means the file contents are encrypted
|
||||
//
|
||||
// 0x2 means the EFS metadata header is big.
|
||||
// (this optimization means we don't have to read
|
||||
// in the first sector of the file stream to get
|
||||
//
|
||||
// 0x2 means the EFS metadata header is big.
|
||||
// (this optimization means we don't have to read
|
||||
// in the first sector of the file stream to get
|
||||
// the normal header size)
|
||||
//
|
||||
|
||||
#define FAT_DIRENT_NT_BYTE_ENCRYPTED 0x01
|
||||
#define FAT_DIRENT_NT_BYTE_ENCRYPTED 0x01
|
||||
#define FAT_DIRENT_NT_BYTE_BIG_HEADER 0x02
|
||||
|
||||
//
|
||||
@ -385,7 +385,7 @@ typedef DIRENT *PDIRENT;
|
||||
#define FAT_EFS_EXTENSION_CHARCOUNT (6)
|
||||
#define FAT_EFS_EXTENSION_BYTECOUNT (12)
|
||||
|
||||
|
||||
|
||||
//
|
||||
// These macros convert a number of fields in the Bpb to bytes from sectors
|
||||
//
|
||||
@ -621,7 +621,7 @@ typedef DIRENT *PDIRENT;
|
||||
RtlEqualMemory((TIME1),(TIME2), sizeof(FAT_TIME_STAMP)) \
|
||||
)
|
||||
|
||||
|
||||
|
||||
#define EA_FILE_SIGNATURE (0x4445) // "ED"
|
||||
#define EA_SET_SIGNATURE (0x4145) // "EA"
|
||||
|
||||
|
@ -161,7 +161,7 @@ NTSTATUS FatBreakOnInterestingIrpCompletion = 0;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if DBG
|
||||
ULONG
|
||||
FatBugCheckExceptionFilter (
|
||||
@ -174,7 +174,7 @@ Routine Description:
|
||||
|
||||
An exception filter which acts as an assert that the exception should
|
||||
never occur.
|
||||
|
||||
|
||||
This is only valid on debug builds, we don't want the overhead on retail.
|
||||
|
||||
Arguments:
|
||||
@ -190,7 +190,7 @@ Return Value:
|
||||
|
||||
{
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
FatBugCheck( (ULONG_PTR)ExceptionPointer->ExceptionRecord,
|
||||
(ULONG_PTR)ExceptionPointer->ContextRecord,
|
||||
(ULONG_PTR)ExceptionPointer->ExceptionRecord->ExceptionAddress );
|
||||
@ -199,7 +199,7 @@ Return Value:
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
ULONG
|
||||
FatExceptionFilter (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -238,7 +238,7 @@ Return Value:
|
||||
if( FatBreakOnInterestingExceptionStatus != 0 && ExceptionCode == FatBreakOnInterestingExceptionStatus ) {
|
||||
DbgBreakPoint();
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
@ -316,8 +316,8 @@ Return Value:
|
||||
|
||||
return EXCEPTION_EXECUTE_HANDLER;
|
||||
}
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
NTSTATUS
|
||||
FatProcessException (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -373,7 +373,7 @@ Return Value:
|
||||
|
||||
ExceptionCode = IrpContext->ExceptionStatus;
|
||||
FatResetExceptionState( IrpContext );
|
||||
|
||||
|
||||
//
|
||||
// If this is an Mdl write request, then take care of the Mdl
|
||||
// here so that things get cleaned up properly. Cc now leaves
|
||||
@ -472,7 +472,7 @@ Return Value:
|
||||
|
||||
ExceptionCode = STATUS_FILE_LOCK_CONFLICT;
|
||||
}
|
||||
|
||||
|
||||
FatCompleteRequest( IrpContext, Irp, ExceptionCode );
|
||||
|
||||
return ExceptionCode;
|
||||
@ -511,10 +511,10 @@ Return Value:
|
||||
}
|
||||
|
||||
//
|
||||
// It turns out some storage drivers really do set invalid non-NULL device
|
||||
// It turns out some storage drivers really do set invalid non-NULL device
|
||||
// objects to verify.
|
||||
//
|
||||
// To work around this, completely ignore the device to verify in the thread,
|
||||
// To work around this, completely ignore the device to verify in the thread,
|
||||
// and just use our real device object instead.
|
||||
//
|
||||
|
||||
@ -527,7 +527,7 @@ Return Value:
|
||||
//
|
||||
// For FSCTLs, IrpContext->Vcb may not be populated, so get the IrpContext->RealDevice instead
|
||||
//
|
||||
|
||||
|
||||
Device = IrpContext->RealDevice;
|
||||
}
|
||||
|
||||
@ -597,10 +597,10 @@ Return Value:
|
||||
}
|
||||
|
||||
//
|
||||
// It turns out some storage drivers really do set invalid non-NULL device
|
||||
// It turns out some storage drivers really do set invalid non-NULL device
|
||||
// objects to verify.
|
||||
//
|
||||
// To work around this, completely ignore the device to verify in the thread,
|
||||
// To work around this, completely ignore the device to verify in the thread,
|
||||
// and just use our real device object instead.
|
||||
//
|
||||
|
||||
@ -613,7 +613,7 @@ Return Value:
|
||||
//
|
||||
// For FSCTLs, IrpContext->Vcb may not be populated, so get the IrpContext->RealDevice instead
|
||||
//
|
||||
|
||||
|
||||
RealDevice = IrpContext->RealDevice;
|
||||
}
|
||||
|
||||
@ -706,14 +706,14 @@ Return Value:
|
||||
//
|
||||
|
||||
FatAcquireExclusiveVcbNoOpCheck( IrpContext, Vcb);
|
||||
|
||||
|
||||
_SEH2_TRY {
|
||||
|
||||
if (VcbGood == Vcb->VcbCondition) {
|
||||
|
||||
FatMarkVolume( IrpContext, Vcb, TransitionState );
|
||||
}
|
||||
}
|
||||
}
|
||||
_SEH2_EXCEPT( FatExceptionFilter( IrpContext, _SEH2_GetExceptionInformation() ) ) {
|
||||
|
||||
NOTHING;
|
||||
@ -761,7 +761,7 @@ Return Value:
|
||||
if ( (FatBreakOnInterestingIrpCompletion != 0) && (Status == FatBreakOnInterestingIrpCompletion) ) {
|
||||
DbgBreakPoint();
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
@ -854,7 +854,7 @@ Return Value:
|
||||
}
|
||||
|
||||
|
||||
_Function_class_(FAST_IO_CHECK_IF_POSSIBLE)
|
||||
_Function_class_(FAST_IO_CHECK_IF_POSSIBLE)
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
FatFastIoCheckIfPossible (
|
||||
@ -963,7 +963,7 @@ Return Value:
|
||||
}
|
||||
|
||||
|
||||
_Function_class_(FAST_IO_QUERY_BASIC_INFO)
|
||||
_Function_class_(FAST_IO_QUERY_BASIC_INFO)
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
FatFastQueryBasicInfo (
|
||||
@ -1010,7 +1010,7 @@ Return Value:
|
||||
|
||||
PAGED_CODE();
|
||||
UNREFERENCED_PARAMETER( DeviceObject );
|
||||
|
||||
|
||||
//
|
||||
// Prepare the dummy irp context
|
||||
//
|
||||
@ -1143,7 +1143,7 @@ Return Value:
|
||||
}
|
||||
|
||||
|
||||
_Function_class_(FAST_IO_QUERY_STANDARD_INFO)
|
||||
_Function_class_(FAST_IO_QUERY_STANDARD_INFO)
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
FatFastQueryStdInfo (
|
||||
@ -1191,7 +1191,7 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
UNREFERENCED_PARAMETER( DeviceObject );
|
||||
|
||||
|
||||
//
|
||||
// Prepare the dummy irp context
|
||||
//
|
||||
@ -1302,7 +1302,7 @@ Return Value:
|
||||
|
||||
return Results;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_Function_class_(FAST_IO_QUERY_NETWORK_OPEN_INFO)
|
||||
BOOLEAN
|
||||
@ -1350,9 +1350,9 @@ Return Value:
|
||||
BOOLEAN FcbAcquired = FALSE;
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
UNREFERENCED_PARAMETER( DeviceObject );
|
||||
|
||||
|
||||
//
|
||||
// Prepare the dummy irp context
|
||||
//
|
||||
@ -1502,8 +1502,8 @@ Return Value:
|
||||
|
||||
return Results;
|
||||
}
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
FatPopUpFileCorrupt (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
|
@ -64,7 +64,7 @@ FatIsFujitsuFMR (
|
||||
#define FUJITSU_FMR_NAME_W L"FUJITSU FMR-"
|
||||
|
||||
|
||||
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
DriverEntry(
|
||||
@ -201,7 +201,7 @@ Return Value:
|
||||
#ifdef _MSC_VER
|
||||
#pragma prefast( pop )
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// Initialize the filter callbacks we use.
|
||||
//
|
||||
@ -247,7 +247,7 @@ Return Value:
|
||||
|
||||
InitializeListHead( &FatData.AsyncCloseList );
|
||||
InitializeListHead( &FatData.DelayedCloseList );
|
||||
|
||||
|
||||
FatData.FatCloseItem = IoAllocateWorkItem( FatDiskFileSystemDeviceObject);
|
||||
|
||||
if (FatData.FatCloseItem == NULL) {
|
||||
@ -263,7 +263,7 @@ Return Value:
|
||||
FatData.ZeroPage = ExAllocatePoolWithTag( NonPagedPoolNx, PAGE_SIZE, 'ZtaF' );
|
||||
if (FatData.ZeroPage == NULL) {
|
||||
IoDeleteDevice (FatDiskFileSystemDeviceObject);
|
||||
IoDeleteDevice (FatCdromFileSystemDeviceObject);
|
||||
IoDeleteDevice (FatCdromFileSystemDeviceObject);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
RtlZeroMemory( FatData.ZeroPage, PAGE_SIZE );
|
||||
@ -293,7 +293,7 @@ Return Value:
|
||||
|
||||
case MmLargeSystem:
|
||||
default:
|
||||
|
||||
|
||||
MaxDepth = 16;
|
||||
FatMaxDelayedCloseCount = 16 * FAT_MAX_DELAYED_CLOSES;
|
||||
break;
|
||||
@ -320,8 +320,8 @@ Return Value:
|
||||
|
||||
FatData.OurProcess = PsGetCurrentProcess();
|
||||
|
||||
//
|
||||
// Setup the number of processors we support for statistics as the current number
|
||||
//
|
||||
// Setup the number of processors we support for statistics as the current number
|
||||
// running.
|
||||
//
|
||||
|
||||
@ -438,7 +438,7 @@ Return Value:
|
||||
}
|
||||
|
||||
|
||||
_Function_class_(DRIVER_UNLOAD)
|
||||
_Function_class_(DRIVER_UNLOAD)
|
||||
VOID
|
||||
NTAPI
|
||||
FatUnload(
|
||||
@ -474,7 +474,7 @@ Return Value:
|
||||
ObDereferenceObject( FatCdromFileSystemDeviceObject);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local Support routine
|
||||
//
|
||||
@ -615,7 +615,7 @@ Return Value:
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Local Support routine
|
||||
//
|
||||
|
@ -22,7 +22,7 @@ typedef PVOID PBCB; //**** Bcb's are now part of the cache module
|
||||
#ifdef __REACTOS__
|
||||
#define __volatile volatile
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// The FAT_DATA record is the top record in the Fat file system in-memory
|
||||
// data structure. This structure must be allocated from non-paged pool.
|
||||
@ -610,7 +610,7 @@ typedef struct _FILE_SYSTEM_STATISTICS {
|
||||
|
||||
typedef FILE_SYSTEM_STATISTICS *PFILE_SYSTEM_STATISTICS;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// The Volume Device Object is an I/O system device object with a workqueue
|
||||
// and an VCB record appended to the end. There are multiple of these
|
||||
@ -670,7 +670,7 @@ typedef struct _VOLUME_DEVICE_OBJECT {
|
||||
|
||||
typedef VOLUME_DEVICE_OBJECT *PVOLUME_DEVICE_OBJECT;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This is the structure used to contains the short name for a file
|
||||
//
|
||||
@ -1239,7 +1239,7 @@ typedef DCB *PDCB;
|
||||
|
||||
#define FCB_LOOKUP_ALLOCATIONSIZE_HINT ((LONGLONG) -1)
|
||||
|
||||
|
||||
|
||||
//
|
||||
// The Ccb record is allocated for every file object. Note that this
|
||||
// record is exactly 0x34 long on x86 so that it will fit into a 0x40
|
||||
@ -1372,7 +1372,7 @@ typedef struct _CCB {
|
||||
|
||||
ULONG Flags:24;
|
||||
BOOLEAN ContainsWildCards;
|
||||
|
||||
|
||||
//
|
||||
// Pointer to EDP context.
|
||||
//
|
||||
@ -1447,7 +1447,7 @@ typedef struct _CCB {
|
||||
|
||||
} CCB;
|
||||
typedef CCB *PCCB;
|
||||
|
||||
|
||||
//
|
||||
// The Irp Context record is allocated for every orginating Irp. It is
|
||||
// created by the Fsd dispatch routines, and deallocated by the FatComplete
|
||||
@ -1576,7 +1576,7 @@ typedef IRP_CONTEXT *PIRP_CONTEXT;
|
||||
|
||||
#define IRP_CONTEXT_FLAG_PARENT_BY_CHILD (0x80000000)
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Context structure for non-cached I/O calls. Most of these fields
|
||||
// are actually only required for the Read/Write Multiple routines, but
|
||||
@ -1591,7 +1591,7 @@ typedef struct _FAT_IO_CONTEXT {
|
||||
// A copy of the IrpContext flags preserved for use in
|
||||
// async I/O completion.
|
||||
//
|
||||
|
||||
|
||||
ULONG IrpContextFlags;
|
||||
|
||||
//
|
||||
|
@ -276,7 +276,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_Function_class_(IRP_MJ_SET_INFORMATION)
|
||||
_Function_class_(DRIVER_DISPATCH)
|
||||
NTSTATUS
|
||||
@ -357,8 +357,8 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
NTSTATUS
|
||||
FatCommonQueryInformation (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -494,8 +494,8 @@ Return Value:
|
||||
// relies on the file system to validate its mapping information after a
|
||||
// power transition.
|
||||
//
|
||||
|
||||
if (!FlagOn( Fcb->FcbState, FCB_STATE_PAGING_FILE ) ||
|
||||
|
||||
if (!FlagOn( Fcb->FcbState, FCB_STATE_PAGING_FILE ) ||
|
||||
FlagOn(Fcb->Vcb->VcbState, VCB_STATE_FLAG_REMOVABLE_MEDIA)) {
|
||||
|
||||
if (!FatAcquireSharedFcb( IrpContext, Fcb )) {
|
||||
@ -657,8 +657,8 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
NTSTATUS
|
||||
FatCommonSetInformation (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -826,7 +826,7 @@ Return Value:
|
||||
//
|
||||
|
||||
if (FlagOn( Vcb->VcbState, VCB_STATE_FLAG_CREATE_IN_PROGRESS)) {
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma prefast( suppress:28159, "things are seriously wrong if we get here" )
|
||||
#endif
|
||||
@ -850,7 +850,7 @@ Return Value:
|
||||
// power transition.
|
||||
//
|
||||
|
||||
if (!FlagOn( Fcb->FcbState, FCB_STATE_PAGING_FILE ) ||
|
||||
if (!FlagOn( Fcb->FcbState, FCB_STATE_PAGING_FILE ) ||
|
||||
FlagOn(Fcb->Vcb->VcbState, VCB_STATE_FLAG_REMOVABLE_MEDIA)) {
|
||||
|
||||
if (!FatAcquireExclusiveFcb( IrpContext, Fcb )) {
|
||||
@ -908,14 +908,14 @@ Return Value:
|
||||
Irp = NULL;
|
||||
IrpContext = NULL;
|
||||
}
|
||||
|
||||
|
||||
if (!NT_SUCCESS( Status ) ||
|
||||
(Status == STATUS_PENDING)) {
|
||||
|
||||
try_return( Status );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Based on the information class we'll do different
|
||||
// actions. Each of the procedures that we're calling will either
|
||||
@ -1021,7 +1021,7 @@ Return Value:
|
||||
DebugUnwind( FatCommonSetInformation );
|
||||
|
||||
if (FcbAcquired) { FatReleaseFcb( IrpContext, Fcb ); }
|
||||
|
||||
|
||||
if (VcbAcquired) { FatReleaseVcb( IrpContext, Vcb ); }
|
||||
|
||||
if (!_SEH2_AbnormalTermination()) {
|
||||
@ -1035,7 +1035,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal Support Routine
|
||||
//
|
||||
@ -1077,7 +1077,7 @@ Return Value:
|
||||
|
||||
UNREFERENCED_PARAMETER( FileObject );
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
DebugTrace(+1, Dbg, "FatQueryBasicInfo...\n", 0);
|
||||
|
||||
//
|
||||
@ -1114,7 +1114,7 @@ Return Value:
|
||||
|
||||
Buffer->FileAttributes = Fcb->DirentFatFlags;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// If the temporary flag is set, then set it in the buffer.
|
||||
//
|
||||
@ -1146,7 +1146,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal Support Routine
|
||||
//
|
||||
@ -1233,7 +1233,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal Support Routine
|
||||
//
|
||||
@ -1272,7 +1272,7 @@ Return Value:
|
||||
PAGED_CODE();
|
||||
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
DebugTrace(+1, Dbg, "FatQueryInternalInfo...\n", 0);
|
||||
|
||||
_SEH2_TRY {
|
||||
@ -1297,7 +1297,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal Support Routine
|
||||
//
|
||||
@ -1339,7 +1339,7 @@ Return Value:
|
||||
|
||||
UNREFERENCED_PARAMETER( Fcb );
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
DebugTrace(+1, Dbg, "FatQueryEaInfo...\n", 0);
|
||||
|
||||
Bcb = NULL;
|
||||
@ -1408,7 +1408,7 @@ Return Value:
|
||||
} _SEH2_END;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal Support Routine
|
||||
//
|
||||
@ -1469,7 +1469,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal Support Routine
|
||||
//
|
||||
@ -1677,7 +1677,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal Support Routine
|
||||
//
|
||||
@ -1776,7 +1776,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal Support Routine
|
||||
//
|
||||
@ -1816,8 +1816,8 @@ Return Value:
|
||||
|
||||
{
|
||||
PAGED_CODE();
|
||||
|
||||
UNREFERENCED_PARAMETER( FileObject );
|
||||
|
||||
UNREFERENCED_PARAMETER( FileObject );
|
||||
|
||||
DebugTrace(+1, Dbg, "FatQueryNetworkInfo...\n", 0);
|
||||
|
||||
@ -1855,7 +1855,7 @@ Return Value:
|
||||
|
||||
Buffer->FileAttributes = Fcb->DirentFatFlags;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// If the temporary flag is set, then set it in the buffer.
|
||||
//
|
||||
@ -1903,7 +1903,7 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal Support routine
|
||||
//
|
||||
@ -2423,7 +2423,7 @@ Return Value:
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Internal Support Routine
|
||||
//
|
||||
@ -2685,7 +2685,7 @@ Return Value:
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal Support Routine
|
||||
//
|
||||
@ -2784,11 +2784,11 @@ Return Value:
|
||||
ULONG TargetDirentOffset = 0;
|
||||
ULONG TargetLfnOffset = 0;
|
||||
|
||||
// NewName comes from the IRP buffer or the TargetFileObject, so we can't
|
||||
// NewName comes from the IRP buffer or the TargetFileObject, so we can't
|
||||
// go around modifying it. Instead we modify NewNameCopy.
|
||||
UNICODE_STRING NewName;
|
||||
|
||||
// NB: these five UNICODE_STRINGS are allocated
|
||||
// NB: these five UNICODE_STRINGS are allocated
|
||||
// from one chopped up pool allocation called UnicodeBuffer.
|
||||
UNICODE_STRING NewNameCopy;
|
||||
UNICODE_STRING NewUpcasedName;
|
||||
@ -2803,7 +2803,7 @@ Return Value:
|
||||
WCHAR UniTunneledShortNameBuffer[12];
|
||||
UNICODE_STRING UniTunneledLongName;
|
||||
WCHAR UniTunneledLongNameBuffer[26];
|
||||
|
||||
|
||||
LARGE_INTEGER TunneledCreationTime;
|
||||
ULONG TunneledDataSize;
|
||||
BOOLEAN HaveTunneledInformation = FALSE;
|
||||
@ -2874,7 +2874,7 @@ Return Value:
|
||||
UniTunneledLongName.Length = 0;
|
||||
UniTunneledLongName.MaximumLength = sizeof(UniTunneledLongNameBuffer);
|
||||
UniTunneledLongName.Buffer = &UniTunneledLongNameBuffer[0];
|
||||
|
||||
|
||||
//
|
||||
// Remember the name in case we have to modify the name
|
||||
// value in the ea.
|
||||
@ -2960,7 +2960,7 @@ Return Value:
|
||||
if (FatIsFileOplockable( TempFcb ) &&
|
||||
(FsRtlCurrentBatchOplock( FatGetFcbOplock(TempFcb) )
|
||||
#if (NTDDI_VERSION >= NTDDI_WIN7)
|
||||
||
|
||||
||
|
||||
FsRtlCurrentOplockH( FatGetFcbOplock(TempFcb) )
|
||||
#endif
|
||||
)) {
|
||||
@ -3114,9 +3114,9 @@ Return Value:
|
||||
NewName = *((PUNICODE_STRING)&TargetFileObject->FileName);
|
||||
|
||||
RtlCopyUnicodeString(&NewNameCopy,&NewName);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// We will need an upcased version of the unicode name and the
|
||||
// old name as well.
|
||||
@ -3175,7 +3175,7 @@ Return Value:
|
||||
|
||||
RenamedAcrossDirectories = TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Upcase the name and convert it to the Oem code page.
|
||||
//
|
||||
@ -3254,7 +3254,7 @@ Return Value:
|
||||
|
||||
DirentsRequired = 1;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -3451,7 +3451,7 @@ Return Value:
|
||||
|
||||
ExFreePool( UnicodeBuffer );
|
||||
FatUnpinBcb( IrpContext, TargetDirentBcb );
|
||||
|
||||
|
||||
}
|
||||
} _SEH2_END;
|
||||
|
||||
@ -3757,7 +3757,7 @@ Return Value:
|
||||
// breaks are always advisory, so we will never block/get STATUS_PENDING
|
||||
// here.
|
||||
//
|
||||
|
||||
|
||||
FsRtlCheckOplockEx( FatGetFcbOplock(OldParentDcb),
|
||||
IrpContext->OriginatingIrp,
|
||||
OPLOCK_FLAG_PARENT_OBJECT,
|
||||
@ -3778,7 +3778,7 @@ Return Value:
|
||||
// breaks are always advisory, so we will never block/get STATUS_PENDING
|
||||
// here.
|
||||
//
|
||||
|
||||
|
||||
FsRtlCheckOplockEx( FatGetFcbOplock(TargetDcb),
|
||||
IrpContext->OriginatingIrp,
|
||||
OPLOCK_FLAG_PARENT_OBJECT,
|
||||
@ -3980,7 +3980,7 @@ Return Value:
|
||||
DebugTrace(0, Dbg, "Uninitialize our parent Stream Cache Map\n", 0);
|
||||
|
||||
CcUninitializeCacheMap( DirectoryFileObject, NULL, NULL );
|
||||
|
||||
|
||||
ObDereferenceObject( DirectoryFileObject );
|
||||
}
|
||||
|
||||
@ -4001,7 +4001,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal Support Routine
|
||||
//
|
||||
@ -4079,7 +4079,7 @@ Return Value:
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal Support Routine
|
||||
//
|
||||
@ -4377,7 +4377,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal Support Routine
|
||||
//
|
||||
@ -4563,9 +4563,9 @@ Return Value:
|
||||
_SEH2_TRY {
|
||||
|
||||
|
||||
if ( NewFileSize > Dirent->FileSize ) {
|
||||
if ( NewFileSize > Dirent->FileSize ) {
|
||||
Dirent->FileSize = NewFileSize;
|
||||
|
||||
|
||||
FatSetDirtyBcb( IrpContext, DirentBcb, Fcb->Vcb, TRUE );
|
||||
|
||||
//
|
||||
@ -4739,7 +4739,7 @@ Return Value:
|
||||
|
||||
*CcGetFileSizePointer(FileObject) = Fcb->Header.FileSize;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// WinSE bug #307418 "Occasional data corruption when
|
||||
// standby/resume while copying files to removable FAT
|
||||
@ -4753,7 +4753,7 @@ Return Value:
|
||||
// we'll also try to un-roll the change to Dirent to keep
|
||||
// in-memory and on-disk metadata in sync.
|
||||
//
|
||||
|
||||
|
||||
FatSetFileSizeInDirentNoRaise( IrpContext, Fcb, NULL );
|
||||
|
||||
}
|
||||
@ -4836,7 +4836,7 @@ Return Value:
|
||||
//
|
||||
// User must have manage volume privilege to explicitly tweak the VDL
|
||||
//
|
||||
|
||||
|
||||
if ((Ccb == NULL) || !FlagOn( Ccb->Flags, CCB_FLAG_MANAGE_VOLUME_ACCESS )) {
|
||||
|
||||
try_return( Status = STATUS_INVALID_PARAMETER );
|
||||
@ -4874,7 +4874,7 @@ Return Value:
|
||||
|
||||
if ((NewValidDataLength < Fcb->Header.ValidDataLength.LowPart) ||
|
||||
(NewValidDataLength > Fcb->Header.FileSize.LowPart)) {
|
||||
|
||||
|
||||
try_return( Status = STATUS_INVALID_PARAMETER );
|
||||
}
|
||||
|
||||
@ -4962,7 +4962,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal Support Routine
|
||||
@ -5117,7 +5117,7 @@ FatDeleteFile (
|
||||
NT_ASSERT( Fcb->LfnOffsetWithinDirectory == LfnOffset );
|
||||
|
||||
if ( Fcb->UncleanCount != 0 ) {
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma prefast( suppress:28159, "things are seriously wrong if we get here" )
|
||||
#endif
|
||||
|
@ -34,7 +34,7 @@ Abstract:
|
||||
#pragma alloc_text(PAGE, FatDecodeFileObject)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatSetFileObject (
|
||||
IN PFILE_OBJECT FileObject OPTIONAL,
|
||||
@ -292,10 +292,10 @@ Return Value:
|
||||
*Vcb = (*FcbOrDcb)->Vcb;
|
||||
|
||||
if (*Ccb != NULL ) {
|
||||
|
||||
|
||||
TypeOfOpen = UserFileOpen;
|
||||
DebugTrace(0, Dbg, "Referencing file: %wZ\n", &(*FcbOrDcb)->FullFileName);
|
||||
|
||||
DebugTrace(0, Dbg, "Referencing file: %wZ\n", &(*FcbOrDcb)->FullFileName);
|
||||
|
||||
} else {
|
||||
|
||||
//
|
||||
@ -304,16 +304,16 @@ Return Value:
|
||||
|
||||
|
||||
if ( *FcbOrDcb == (*Vcb)->EaFcb ) {
|
||||
|
||||
|
||||
TypeOfOpen = EaFile;
|
||||
DebugTrace(0, Dbg, "Referencing EA file: %wZ\n", &(*FcbOrDcb)->FullFileName);
|
||||
|
||||
DebugTrace(0, Dbg, "Referencing EA file: %wZ\n", &(*FcbOrDcb)->FullFileName);
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma prefast(suppress:28159, "things are seriously wrong if we get here")
|
||||
#endif
|
||||
FatBugCheck( NodeType(FsContext), 0, 0 );
|
||||
FatBugCheck( NodeType(FsContext), 0, 0 );
|
||||
|
||||
}
|
||||
|
||||
@ -362,7 +362,7 @@ Arguments:
|
||||
Fcb - Supplies a pointer to either an fcb or a dcb
|
||||
|
||||
FlushType - Specifies the kind of flushing to perform
|
||||
|
||||
|
||||
Return Value:
|
||||
|
||||
None.
|
||||
@ -417,8 +417,8 @@ Return Value:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
VOID
|
||||
FatForceCacheMiss (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -443,7 +443,7 @@ Arguments:
|
||||
Fcb - Supplies a pointer to an fcb
|
||||
|
||||
FlushType - Specifies the kind of flushing to perform
|
||||
|
||||
|
||||
Return Value:
|
||||
|
||||
None.
|
||||
|
@ -66,7 +66,7 @@ FatHijackCompletionRoutine (
|
||||
|
||||
|
||||
_Function_class_(IRP_MJ_FLUSH_BUFFERS)
|
||||
_Function_class_(DRIVER_DISPATCH)
|
||||
_Function_class_(DRIVER_DISPATCH)
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
FatFsdFlushBuffers (
|
||||
@ -144,8 +144,8 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
NTSTATUS
|
||||
FatCommonFlushBuffers (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -280,7 +280,7 @@ Return Value:
|
||||
Status = FatFlushFile( IrpContext, Fcb, Flush );
|
||||
|
||||
//
|
||||
// Also flush the file's dirent in the parent directory if the file
|
||||
// Also flush the file's dirent in the parent directory if the file
|
||||
// flush worked.
|
||||
//
|
||||
|
||||
@ -312,11 +312,11 @@ Return Value:
|
||||
//
|
||||
// Make sure the Fcb is OK.
|
||||
//
|
||||
|
||||
|
||||
_SEH2_TRY {
|
||||
|
||||
|
||||
FatVerifyFcb( IrpContext, NextFcb );
|
||||
|
||||
|
||||
} _SEH2_EXCEPT( FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ?
|
||||
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {
|
||||
|
||||
@ -326,16 +326,16 @@ Return Value:
|
||||
if (NextFcb->FcbCondition == FcbGood) {
|
||||
|
||||
NTSTATUS LocalStatus;
|
||||
|
||||
|
||||
LocalStatus = FatFlushFile( IrpContext, NextFcb, Flush );
|
||||
|
||||
|
||||
if (!NT_SUCCESS(LocalStatus)) {
|
||||
|
||||
|
||||
Status = LocalStatus;
|
||||
}
|
||||
|
||||
if (FlagOn(NextFcb->FcbState, FCB_STATE_FLUSH_FAT)) {
|
||||
|
||||
|
||||
FatFlushRequired = TRUE;
|
||||
}
|
||||
}
|
||||
@ -389,8 +389,8 @@ Return Value:
|
||||
{
|
||||
BOOLEAN Finished;
|
||||
#ifdef _MSC_VER
|
||||
#pragma prefast( suppress:28931, "needed for debug build" )
|
||||
#endif
|
||||
#pragma prefast( suppress:28931, "needed for debug build" )
|
||||
#endif
|
||||
Finished = FatAcquireExclusiveVcb( IrpContext, Vcb );
|
||||
NT_ASSERT( Finished );
|
||||
}
|
||||
@ -442,7 +442,7 @@ Return Value:
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma prefast( suppress:28159, "things are seriously wrong if we get here" )
|
||||
#endif
|
||||
@ -456,7 +456,7 @@ Return Value:
|
||||
DebugUnwind( FatCommonFlushBuffers );
|
||||
|
||||
if (VcbAcquired) { FatReleaseVcb( IrpContext, Vcb ); }
|
||||
|
||||
|
||||
if (FcbAcquired) { FatReleaseFcb( IrpContext, Fcb ); }
|
||||
|
||||
//
|
||||
@ -496,7 +496,7 @@ Return Value:
|
||||
|
||||
DriverStatus = IoCallDriver(Vcb->TargetDeviceObject, Irp);
|
||||
|
||||
if ((DriverStatus == STATUS_PENDING) ||
|
||||
if ((DriverStatus == STATUS_PENDING) ||
|
||||
(!NT_SUCCESS(DriverStatus) &&
|
||||
(DriverStatus != STATUS_INVALID_DEVICE_REQUEST))) {
|
||||
|
||||
@ -523,8 +523,8 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
NTSTATUS
|
||||
FatFlushDirectory (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -543,7 +543,7 @@ Arguments:
|
||||
Dcb - Supplies the Dcb being flushed
|
||||
|
||||
FlushType - Specifies the kind of flushing to perform
|
||||
|
||||
|
||||
Return Value:
|
||||
|
||||
VOID
|
||||
@ -612,44 +612,44 @@ Return Value:
|
||||
// doing the flush dance. We may encounter corruption, and
|
||||
// should continue flushing the volume as much as possible.
|
||||
//
|
||||
|
||||
|
||||
_SEH2_TRY {
|
||||
|
||||
|
||||
//
|
||||
// Standard handler to release resources, etc.
|
||||
//
|
||||
|
||||
|
||||
_SEH2_TRY {
|
||||
|
||||
|
||||
//
|
||||
// Make sure the Fcb is OK.
|
||||
//
|
||||
|
||||
|
||||
_SEH2_TRY {
|
||||
|
||||
|
||||
FatVerifyFcb( IrpContext, Fcb );
|
||||
|
||||
|
||||
} _SEH2_EXCEPT( FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ?
|
||||
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {
|
||||
|
||||
|
||||
FatResetExceptionState( IrpContext );
|
||||
} _SEH2_END;
|
||||
|
||||
|
||||
//
|
||||
// If this Fcb is not good skip it. Note that a 'continue'
|
||||
// here would be very expensive as we inside a try{} body.
|
||||
//
|
||||
|
||||
|
||||
if (Fcb->FcbCondition != FcbGood) {
|
||||
|
||||
|
||||
try_leave( NOTHING);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// In case a handle was never closed and the FS and AS are more
|
||||
// than a cluster different, do this truncate.
|
||||
//
|
||||
|
||||
|
||||
if ( FlagOn(Fcb->FcbState, FCB_STATE_TRUNCATE_ON_CLOSE) ) {
|
||||
|
||||
|
||||
@ -659,7 +659,7 @@ Return Value:
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Also compare the file's dirent in the parent directory
|
||||
// with the size information in the Fcb and update
|
||||
@ -667,7 +667,7 @@ Return Value:
|
||||
// because we will be flushing the file object presently, and
|
||||
// Mm knows what's really dirty.
|
||||
//
|
||||
|
||||
|
||||
FatGetDirentFromFcbOrDcb( IrpContext,
|
||||
Fcb,
|
||||
FALSE,
|
||||
@ -675,14 +675,14 @@ Return Value:
|
||||
&DirentBcb );
|
||||
|
||||
|
||||
CorrectedFileSize = Fcb->Header.FileSize.LowPart;
|
||||
CorrectedFileSize = Fcb->Header.FileSize.LowPart;
|
||||
|
||||
|
||||
|
||||
if (Dirent->FileSize != CorrectedFileSize) {
|
||||
|
||||
|
||||
Dirent->FileSize = CorrectedFileSize;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
@ -692,33 +692,33 @@ Return Value:
|
||||
// more children as a result, we will try to initiate teardown on it
|
||||
// and Cc will deadlock against the active count of this Bcb.
|
||||
//
|
||||
|
||||
|
||||
FatUnpinBcb( IrpContext, DirentBcb );
|
||||
|
||||
|
||||
//
|
||||
// Now flush the file. Note that this may make the Fcb
|
||||
// go away if Mm dereferences its file object.
|
||||
//
|
||||
|
||||
|
||||
Status = FatFlushFile( IrpContext, Fcb, FlushType );
|
||||
|
||||
|
||||
if (!NT_SUCCESS(Status)) {
|
||||
|
||||
|
||||
ReturnStatus = Status;
|
||||
}
|
||||
|
||||
|
||||
} _SEH2_FINALLY {
|
||||
|
||||
|
||||
FatUnpinBcb( IrpContext, DirentBcb );
|
||||
|
||||
|
||||
//
|
||||
// Since we have the Vcb exclusive we know that if any closes
|
||||
// come in it is because the CcPurgeCacheSection caused the
|
||||
// Fcb to go away.
|
||||
//
|
||||
|
||||
|
||||
if ( !FlagOn(Vcb->VcbState, VCB_STATE_FLAG_DELETED_FCB) ) {
|
||||
|
||||
|
||||
FatReleaseFcb( (IRPCONTEXT), Fcb );
|
||||
}
|
||||
} _SEH2_END;
|
||||
@ -796,7 +796,7 @@ Return Value:
|
||||
return ReturnStatus;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NTSTATUS
|
||||
FatFlushFat (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -814,7 +814,7 @@ Routine Description:
|
||||
Arguments:
|
||||
|
||||
Vcb - Supplies the Vcb whose FAT is being flushed
|
||||
|
||||
|
||||
Return Value:
|
||||
|
||||
VOID
|
||||
@ -902,7 +902,7 @@ Return Value:
|
||||
PIN_WAIT | PIN_IF_BCB,
|
||||
&Bcb,
|
||||
&DontCare )) {
|
||||
|
||||
|
||||
CcSetDirtyPinnedData( Bcb, NULL );
|
||||
CcRepinBcb( Bcb );
|
||||
CcUnpinData( Bcb );
|
||||
@ -937,7 +937,7 @@ Return Value:
|
||||
PIN_WAIT | PIN_IF_BCB,
|
||||
&Bcb,
|
||||
&DontCare )) {
|
||||
|
||||
|
||||
CcSetDirtyPinnedData( Bcb, NULL );
|
||||
CcRepinBcb( Bcb );
|
||||
CcUnpinData( Bcb );
|
||||
@ -957,7 +957,7 @@ Return Value:
|
||||
|
||||
return ReturnStatus;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
NTSTATUS
|
||||
@ -979,7 +979,7 @@ Arguments:
|
||||
Vcb - Supplies the volume being flushed
|
||||
|
||||
FlushType - Specifies the kind of flushing to perform
|
||||
|
||||
|
||||
Return Value:
|
||||
|
||||
NTSTATUS - The Status from the flush.
|
||||
@ -1036,8 +1036,8 @@ Return Value:
|
||||
return ReturnStatus;
|
||||
}
|
||||
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
|
||||
_Requires_lock_held_(_Global_critical_region_)
|
||||
NTSTATUS
|
||||
FatFlushFile (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -1056,7 +1056,7 @@ Arguments:
|
||||
Fcb - Supplies the file being flushed
|
||||
|
||||
FlushType - Specifies the kind of flushing to perform
|
||||
|
||||
|
||||
Return Value:
|
||||
|
||||
NTSTATUS - The Status from the flush.
|
||||
@ -1073,7 +1073,7 @@ Return Value:
|
||||
|
||||
|
||||
if ( !FlagOn( Vcb->VcbState, VCB_STATE_FLAG_DELETED_FCB )) {
|
||||
|
||||
|
||||
//
|
||||
// Grab and release PagingIo to serialize ourselves with the lazy writer.
|
||||
// This will work to ensure that all IO has completed on the cached
|
||||
@ -1082,21 +1082,21 @@ Return Value:
|
||||
// If we are to invalidate the file, now is the right time to do it. Do
|
||||
// it non-recursively so we don't thump children before their time.
|
||||
//
|
||||
|
||||
|
||||
ExAcquireResourceExclusiveLite( Fcb->Header.PagingIoResource, TRUE);
|
||||
|
||||
|
||||
if (FlushType == FlushAndInvalidate) {
|
||||
|
||||
|
||||
FatMarkFcbCondition( IrpContext, Fcb, FcbBad, FALSE );
|
||||
}
|
||||
|
||||
|
||||
ExReleaseResourceLite( Fcb->Header.PagingIoResource );
|
||||
}
|
||||
|
||||
return Iosb.Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NTSTATUS
|
||||
FatHijackIrpAndFlushDevice (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -1133,9 +1133,9 @@ Return Value:
|
||||
PIO_STACK_LOCATION NextIrpSp;
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
UNREFERENCED_PARAMETER( IrpContext );
|
||||
|
||||
|
||||
//
|
||||
// Get the next stack location, and copy over the stack location
|
||||
//
|
||||
@ -1186,7 +1186,7 @@ Return Value:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatFlushFatEntries (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -1259,7 +1259,7 @@ Return Value:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
FatFlushDirentForFile (
|
||||
IN PIRP_CONTEXT IrpContext,
|
||||
@ -1306,7 +1306,7 @@ Return Value:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
@ -1321,7 +1321,7 @@ FatFlushCompletionRoutine (
|
||||
|
||||
{
|
||||
NTSTATUS Status = (NTSTATUS) (ULONG_PTR) Contxt;
|
||||
|
||||
|
||||
if ( Irp->PendingReturned ) {
|
||||
|
||||
IoMarkIrpPending( Irp );
|
||||
@ -1343,7 +1343,7 @@ FatFlushCompletionRoutine (
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Local support routine
|
||||
//
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user