mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-26 19:33:31 +00:00
[FORMATTING][NTOS][HAL][DRIVERS][SDK] Fix trailing spaces
This commit is contained in:
@@ -77,7 +77,7 @@ ConDrvDeleteController(IN PDRIVER_OBJECT DriverObject)
|
|||||||
|
|
||||||
RtlInitUnicodeString(&SymlinkName, DD_CONDRV_CTRL_SYMLNK_NAME_U);
|
RtlInitUnicodeString(&SymlinkName, DD_CONDRV_CTRL_SYMLNK_NAME_U);
|
||||||
IoDeleteSymbolicLink(&SymlinkName);
|
IoDeleteSymbolicLink(&SymlinkName);
|
||||||
|
|
||||||
/* Delete the controller device itself */
|
/* Delete the controller device itself */
|
||||||
IoDeleteDevice(Controller);
|
IoDeleteDevice(Controller);
|
||||||
|
|
||||||
|
|||||||
@@ -59,13 +59,13 @@ get_packet:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
CheckSum += (CHAR)Byte;
|
CheckSum += (CHAR)Byte;
|
||||||
|
|
||||||
/* See if we should escape */
|
/* See if we should escape */
|
||||||
if (Byte == 0x7d)
|
if (Byte == 0x7d)
|
||||||
{
|
{
|
||||||
Status = KdpReceiveByte(&Byte);
|
Status = KdpReceiveByte(&Byte);
|
||||||
if (Status != KdPacketReceived)
|
if (Status != KdPacketReceived)
|
||||||
return Status;
|
return Status;
|
||||||
CheckSum += (CHAR)Byte;
|
CheckSum += (CHAR)Byte;
|
||||||
Byte ^= 0x20;
|
Byte ^= 0x20;
|
||||||
}
|
}
|
||||||
@@ -100,7 +100,7 @@ end:
|
|||||||
case '$':
|
case '$':
|
||||||
KDDBGPRINT("Received new packet just after %s.\n", gdb_input);
|
KDDBGPRINT("Received new packet just after %s.\n", gdb_input);
|
||||||
goto get_packet;
|
goto get_packet;
|
||||||
case 0x03:
|
case 0x03:
|
||||||
KdContext->KdpControlCPending = TRUE;
|
KdContext->KdpControlCPending = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ send_gdb_packet(_In_ const CHAR* Buffer)
|
|||||||
return finish_gdb_packet();
|
return finish_gdb_packet();
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
send_gdb_partial_binary(
|
send_gdb_partial_binary(
|
||||||
_In_ const VOID* Buffer,
|
_In_ const VOID* Buffer,
|
||||||
_In_ size_t Length)
|
_In_ size_t Length)
|
||||||
@@ -136,7 +136,7 @@ send_gdb_partial_binary(
|
|||||||
return Sent;
|
return Sent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
send_gdb_partial_memory(
|
send_gdb_partial_memory(
|
||||||
_In_ const VOID* Buffer,
|
_In_ const VOID* Buffer,
|
||||||
_In_ size_t Length)
|
_In_ size_t Length)
|
||||||
@@ -172,7 +172,7 @@ gdb_send_debug_io(
|
|||||||
CHAR gdb_out[3];
|
CHAR gdb_out[3];
|
||||||
CHAR* ptr = String->Buffer;
|
CHAR* ptr = String->Buffer;
|
||||||
USHORT Length = String->Length;
|
USHORT Length = String->Length;
|
||||||
|
|
||||||
gdb_out[2] = '\0';
|
gdb_out[2] = '\0';
|
||||||
|
|
||||||
start_gdb_packet();
|
start_gdb_packet();
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ find_thread(
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
#if !MONOPROCESS
|
#if !MONOPROCESS
|
||||||
(Pid == 0) &&
|
(Pid == 0) &&
|
||||||
#endif
|
#endif
|
||||||
(Tid == 0))
|
(Tid == 0))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ NTSTATUS NTAPI FreeBT_AddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJEC
|
|||||||
deviceExtension->OutStandingIO = 1;
|
deviceExtension->OutStandingIO = 1;
|
||||||
KeInitializeSpinLock(&deviceExtension->IOCountLock);
|
KeInitializeSpinLock(&deviceExtension->IOCountLock);
|
||||||
|
|
||||||
#ifdef ENABLE_WMI
|
#ifdef ENABLE_WMI
|
||||||
// Delegating to WMILIB
|
// Delegating to WMILIB
|
||||||
ntStatus = FreeBT_WmiRegistration(deviceExtension);
|
ntStatus = FreeBT_WmiRegistration(deviceExtension);
|
||||||
if (!NT_SUCCESS(ntStatus))
|
if (!NT_SUCCESS(ntStatus))
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
#define FBT_HCI_PACKET_BOUNDARY_FRAGMENT 0x01
|
#define FBT_HCI_PACKET_BOUNDARY_FRAGMENT 0x01
|
||||||
#define FBT_HCI_PACKET_BOUNDARY_START 0x02
|
#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_ACTIVE_SLAVE 0x01
|
||||||
#define FBT_HCI_BROADCAST_PARKED_SLAVE 0x02
|
#define FBT_HCI_BROADCAST_PARKED_SLAVE 0x02
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class CReg
|
|||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
CReg(LPCSTR lpszSubKey, HKEY hRootKey=HKEY_CURRENT_USER, REGSAM regSam=KEY_ALL_ACCESS, BOOL bCreate=TRUE);
|
CReg(LPCSTR lpszSubKey, HKEY hRootKey=HKEY_CURRENT_USER, REGSAM regSam=KEY_ALL_ACCESS, BOOL bCreate=TRUE);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~CReg();
|
~CReg();
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ class CReg
|
|||||||
// BOOL GetValue(LPCSTR lpszValueName, CString &szData, DWORD *dwDataType=NULL);
|
// BOOL GetValue(LPCSTR lpszValueName, CString &szData, DWORD *dwDataType=NULL);
|
||||||
BOOL GetValue(LPCSTR lpszValueName, DWORD &dwData);
|
BOOL GetValue(LPCSTR lpszValueName, DWORD &dwData);
|
||||||
BOOL GetValue(LPCSTR lpszValueName, BOOL &bData);
|
BOOL GetValue(LPCSTR lpszValueName, BOOL &bData);
|
||||||
|
|
||||||
// Set the specified registry value
|
// Set the specified registry value
|
||||||
BOOL SetValue(LPCSTR lpszValueName, const LPVOID lpvData, DWORD dwDataSize, DWORD dwDataType=REG_SZ);
|
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);
|
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
|
// Delete all the values in the key
|
||||||
BOOL DeleteValues();
|
BOOL DeleteValues();
|
||||||
|
|
||||||
// Delete a sub key
|
// Delete a sub key
|
||||||
BOOL DeleteKey(LPCSTR lpszKeyName);
|
BOOL DeleteKey(LPCSTR lpszKeyName);
|
||||||
|
|
||||||
// Retrieve the names of the values in the key
|
// Retrieve the names of the values in the key
|
||||||
// BOOL EnumerateValues(CStringArray &nszValueNames);
|
// BOOL EnumerateValues(CStringArray &nszValueNames);
|
||||||
|
|
||||||
BOOL IsValid() {return m_hKey!=NULL;}
|
BOOL IsValid() {return m_hKey!=NULL;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -47,12 +47,12 @@ class CReg
|
|||||||
LONG Open(LPCSTR lpszSubKey, HKEY hRootKey, HKEY *hKey=NULL, REGSAM regSam=NULL, BOOL bCreate=TRUE);
|
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);
|
BOOL DeleteKey(HKEY hRootKey, HKEY hKey, LPCSTR szKey, LPCSTR szSubKey);
|
||||||
|
|
||||||
// CString m_szKey; // Name of key this object wraps
|
// CString m_szKey; // Name of key this object wraps
|
||||||
char m_szKey[1024]; // 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_hRootKey; // Root key of the wrapped key
|
||||||
HKEY m_hKey; // Key generated by Open/Create
|
HKEY m_hKey; // Key generated by Open/Create
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -92,7 +92,7 @@ acpi_button_notify_fixed (
|
|||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
struct acpi_button *button = (struct acpi_button *) data;
|
struct acpi_button *button = (struct acpi_button *) data;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_button_notify_fixed");
|
ACPI_FUNCTION_TRACE("acpi_button_notify_fixed");
|
||||||
|
|
||||||
if (!button)
|
if (!button)
|
||||||
@@ -134,35 +134,35 @@ acpi_button_add (
|
|||||||
button->type = ACPI_BUTTON_TYPE_POWER;
|
button->type = ACPI_BUTTON_TYPE_POWER;
|
||||||
sprintf(acpi_device_name(device), "%s",
|
sprintf(acpi_device_name(device), "%s",
|
||||||
ACPI_BUTTON_DEVICE_NAME_POWER);
|
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);
|
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
|
||||||
}
|
}
|
||||||
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWERF)) {
|
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWERF)) {
|
||||||
button->type = ACPI_BUTTON_TYPE_POWERF;
|
button->type = ACPI_BUTTON_TYPE_POWERF;
|
||||||
sprintf(acpi_device_name(device), "%s",
|
sprintf(acpi_device_name(device), "%s",
|
||||||
ACPI_BUTTON_DEVICE_NAME_POWERF);
|
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);
|
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
|
||||||
}
|
}
|
||||||
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEP)) {
|
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEP)) {
|
||||||
button->type = ACPI_BUTTON_TYPE_SLEEP;
|
button->type = ACPI_BUTTON_TYPE_SLEEP;
|
||||||
sprintf(acpi_device_name(device), "%s",
|
sprintf(acpi_device_name(device), "%s",
|
||||||
ACPI_BUTTON_DEVICE_NAME_SLEEP);
|
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);
|
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
|
||||||
}
|
}
|
||||||
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEPF)) {
|
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEPF)) {
|
||||||
button->type = ACPI_BUTTON_TYPE_SLEEPF;
|
button->type = ACPI_BUTTON_TYPE_SLEEPF;
|
||||||
sprintf(acpi_device_name(device), "%s",
|
sprintf(acpi_device_name(device), "%s",
|
||||||
ACPI_BUTTON_DEVICE_NAME_SLEEPF);
|
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);
|
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
|
||||||
}
|
}
|
||||||
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_LID)) {
|
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_LID)) {
|
||||||
button->type = ACPI_BUTTON_TYPE_LID;
|
button->type = ACPI_BUTTON_TYPE_LID;
|
||||||
sprintf(acpi_device_name(device), "%s",
|
sprintf(acpi_device_name(device), "%s",
|
||||||
ACPI_BUTTON_DEVICE_NAME_LID);
|
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);
|
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -239,7 +239,7 @@ acpi_button_add (
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("%s [%s]\n",
|
DPRINT("%s [%s]\n",
|
||||||
acpi_device_name(device), acpi_device_bid(device));
|
acpi_device_name(device), acpi_device_bid(device));
|
||||||
|
|
||||||
end:
|
end:
|
||||||
@@ -294,7 +294,7 @@ acpi_button_remove (struct acpi_device *device, int type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
acpi_button_init (void)
|
acpi_button_init (void)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
@@ -310,7 +310,7 @@ acpi_button_init (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
acpi_button_exit (void)
|
acpi_button_exit (void)
|
||||||
{
|
{
|
||||||
ACPI_FUNCTION_TRACE("acpi_button_exit");
|
ACPI_FUNCTION_TRACE("acpi_button_exit");
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Modified for ReactOS and latest ACPICA
|
/* Modified for ReactOS and latest ACPICA
|
||||||
* Copyright (C)2009 Samuel Serapion
|
* Copyright (C)2009 Samuel Serapion
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <precomp.h>
|
#include <precomp.h>
|
||||||
@@ -84,7 +84,7 @@ acpi_system_add (
|
|||||||
sprintf(acpi_device_class(device), "%s", ACPI_SYSTEM_CLASS);
|
sprintf(acpi_device_class(device), "%s", ACPI_SYSTEM_CLASS);
|
||||||
acpi_driver_data(device) = system;
|
acpi_driver_data(device) = system;
|
||||||
|
|
||||||
DPRINT("%s [%s] (supports",
|
DPRINT("%s [%s] (supports",
|
||||||
acpi_device_name(device), acpi_device_bid(device));
|
acpi_device_name(device), acpi_device_bid(device));
|
||||||
for (i=0; i<ACPI_S_STATE_COUNT; i++) {
|
for (i=0; i<ACPI_S_STATE_COUNT; i++) {
|
||||||
UINT8 type_a, type_b;
|
UINT8 type_a, type_b;
|
||||||
@@ -97,7 +97,7 @@ acpi_system_add (
|
|||||||
system->states[i] = 1;
|
system->states[i] = 1;
|
||||||
}
|
}
|
||||||
/* no break */
|
/* no break */
|
||||||
default:
|
default:
|
||||||
if (ACPI_SUCCESS(status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
system->states[i] = 1;
|
system->states[i] = 1;
|
||||||
DPRINT(" S%d", i);
|
DPRINT(" S%d", i);
|
||||||
@@ -156,7 +156,7 @@ ACPI_STATUS
|
|||||||
acpi_system_restore_state(
|
acpi_system_restore_state(
|
||||||
UINT32 state)
|
UINT32 state)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* We should only be here if we're coming back from STR or STD.
|
* 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
|
* And, in the case of the latter, the memory image should have already
|
||||||
* been loaded from disk.
|
* been loaded from disk.
|
||||||
@@ -167,7 +167,7 @@ acpi_system_restore_state(
|
|||||||
/* Do _early_ resume for irqs. Required by
|
/* Do _early_ resume for irqs. Required by
|
||||||
* ACPI specs.
|
* ACPI specs.
|
||||||
*/
|
*/
|
||||||
/* TBD: call arch dependant reinitialization of the
|
/* TBD: call arch dependant reinitialization of the
|
||||||
* interrupts.
|
* interrupts.
|
||||||
*/
|
*/
|
||||||
#ifdef _X86_
|
#ifdef _X86_
|
||||||
@@ -239,7 +239,7 @@ acpi_system_save_state(
|
|||||||
// return error;
|
// return error;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/* flush caches */
|
/* flush caches */
|
||||||
ACPI_FLUSH_CPU_CACHE();
|
ACPI_FLUSH_CPU_CACHE();
|
||||||
|
|
||||||
@@ -395,7 +395,7 @@ acpi_suspend (
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
acpi_system_init (void)
|
acpi_system_init (void)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
/* Modified for ReactOS and latest ACPICA
|
/* Modified for ReactOS and latest ACPICA
|
||||||
* Copyright (C)2009 Samuel Serapion
|
* Copyright (C)2009 Samuel Serapion
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _COMPONENT ACPI_BUS_COMPONENT
|
#define _COMPONENT ACPI_BUS_COMPONENT
|
||||||
@@ -301,24 +301,24 @@ acpi_evaluate_reference (
|
|||||||
package = (ACPI_OBJECT *) buffer.Pointer;
|
package = (ACPI_OBJECT *) buffer.Pointer;
|
||||||
|
|
||||||
if ((buffer.Length == 0) || !package) {
|
if ((buffer.Length == 0) || !package) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"No return object (len %X ptr %p)\n",
|
"No return object (len %X ptr %p)\n",
|
||||||
buffer.Length, package));
|
buffer.Length, package));
|
||||||
status = AE_BAD_DATA;
|
status = AE_BAD_DATA;
|
||||||
acpi_util_eval_error(handle, pathname, status);
|
acpi_util_eval_error(handle, pathname, status);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if (package->Type != ACPI_TYPE_PACKAGE) {
|
if (package->Type != ACPI_TYPE_PACKAGE) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Expecting a [Package], found type %X\n",
|
"Expecting a [Package], found type %X\n",
|
||||||
package->Type));
|
package->Type));
|
||||||
status = AE_BAD_DATA;
|
status = AE_BAD_DATA;
|
||||||
acpi_util_eval_error(handle, pathname, status);
|
acpi_util_eval_error(handle, pathname, status);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if (!package->Package.Count) {
|
if (!package->Package.Count) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"[Package] has zero elements (%p)\n",
|
"[Package] has zero elements (%p)\n",
|
||||||
package));
|
package));
|
||||||
status = AE_BAD_DATA;
|
status = AE_BAD_DATA;
|
||||||
acpi_util_eval_error(handle, pathname, status);
|
acpi_util_eval_error(handle, pathname, status);
|
||||||
@@ -338,13 +338,13 @@ acpi_evaluate_reference (
|
|||||||
|
|
||||||
if (element->Type != ACPI_TYPE_LOCAL_REFERENCE) {
|
if (element->Type != ACPI_TYPE_LOCAL_REFERENCE) {
|
||||||
status = AE_BAD_DATA;
|
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",
|
"Expecting a [Reference] package element, found type %X\n",
|
||||||
element->type));
|
element->type));
|
||||||
acpi_util_eval_error(handle, pathname, status);
|
acpi_util_eval_error(handle, pathname, status);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!element->Reference.Handle) {
|
if (!element->Reference.Handle) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid reference in"
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid reference in"
|
||||||
" package %s\n", pathname));
|
" package %s\n", pathname));
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ Bus_PDO_PnP (
|
|||||||
PoSetPowerState(DeviceData->Common.Self, DevicePowerState, state);
|
PoSetPowerState(DeviceData->Common.Self, DevicePowerState, state);
|
||||||
DeviceData->Common.DevicePowerState = PowerDeviceD3;
|
DeviceData->Common.DevicePowerState = PowerDeviceD3;
|
||||||
}
|
}
|
||||||
|
|
||||||
SET_NEW_PNP_STATE(DeviceData->Common, Stopped);
|
SET_NEW_PNP_STATE(DeviceData->Common, Stopped);
|
||||||
status = STATUS_SUCCESS;
|
status = STATUS_SUCCESS;
|
||||||
break;
|
break;
|
||||||
@@ -541,7 +541,7 @@ Bus_PDO_QueryDeviceId(
|
|||||||
if (DeviceData->AcpiHandle)
|
if (DeviceData->AcpiHandle)
|
||||||
{
|
{
|
||||||
acpi_bus_get_device(DeviceData->AcpiHandle, &Device);
|
acpi_bus_get_device(DeviceData->AcpiHandle, &Device);
|
||||||
|
|
||||||
if (!Device->flags.hardware_id)
|
if (!Device->flags.hardware_id)
|
||||||
{
|
{
|
||||||
/* We don't have the ID to satisfy this request */
|
/* 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 */
|
/* We don't have the ID to satisfy this request */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("Device name: %s\n", Device->pnp.device_name);
|
DPRINT("Device name: %s\n", Device->pnp.device_name);
|
||||||
DPRINT("Hardware ID: %s\n", Device->pnp.hardware_id);
|
DPRINT("Hardware ID: %s\n", Device->pnp.hardware_id);
|
||||||
|
|
||||||
if (strcmp(Device->pnp.hardware_id, "Processor") == 0)
|
if (strcmp(Device->pnp.hardware_id, "Processor") == 0)
|
||||||
{
|
{
|
||||||
length += swprintf(&temp[length],
|
length += swprintf(&temp[length],
|
||||||
@@ -640,13 +640,13 @@ Bus_PDO_QueryDeviceId(
|
|||||||
L"ACPI\\%hs",
|
L"ACPI\\%hs",
|
||||||
Device->pnp.cid_list->Ids[i].String);
|
Device->pnp.cid_list->Ids[i].String);
|
||||||
temp[length++] = UNICODE_NULL;
|
temp[length++] = UNICODE_NULL;
|
||||||
|
|
||||||
length += swprintf(&temp[length],
|
length += swprintf(&temp[length],
|
||||||
L"*%hs",
|
L"*%hs",
|
||||||
Device->pnp.cid_list->Ids[i].String);
|
Device->pnp.cid_list->Ids[i].String);
|
||||||
temp[length++] = UNICODE_NULL;
|
temp[length++] = UNICODE_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
temp[length++] = UNICODE_NULL;
|
temp[length++] = UNICODE_NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -654,7 +654,7 @@ Bus_PDO_QueryDeviceId(
|
|||||||
/* No compatible IDs */
|
/* No compatible IDs */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
NT_ASSERT(length * sizeof(WCHAR) <= sizeof(temp));
|
NT_ASSERT(length * sizeof(WCHAR) <= sizeof(temp));
|
||||||
|
|
||||||
buffer = ExAllocatePoolWithTag(PagedPool, length * sizeof(WCHAR), 'IpcA');
|
buffer = ExAllocatePoolWithTag(PagedPool, length * sizeof(WCHAR), 'IpcA');
|
||||||
|
|||||||
+117
-117
@@ -22,7 +22,7 @@ KTIMER CmBattWakeDpcTimerObject;
|
|||||||
KDPC CmBattWakeDpcObject;
|
KDPC CmBattWakeDpcObject;
|
||||||
PDEVICE_OBJECT AcAdapterPdo;
|
PDEVICE_OBJECT AcAdapterPdo;
|
||||||
LARGE_INTEGER CmBattWakeDpcDelay;
|
LARGE_INTEGER CmBattWakeDpcDelay;
|
||||||
|
|
||||||
/* FUNCTIONS ******************************************************************/
|
/* FUNCTIONS ******************************************************************/
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
@@ -35,7 +35,7 @@ CmBattPowerCallBack(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
PDEVICE_OBJECT DeviceObject;
|
PDEVICE_OBJECT DeviceObject;
|
||||||
if (CmBattDebug & 0x10)
|
if (CmBattDebug & 0x10)
|
||||||
DbgPrint("CmBattPowerCallBack: action: %d, value: %d \n", Action, Value);
|
DbgPrint("CmBattPowerCallBack: action: %d, value: %d \n", Action, Value);
|
||||||
|
|
||||||
/* Check if a transition is going to happen */
|
/* Check if a transition is going to happen */
|
||||||
if (Action == PO_CB_SYSTEM_STATE_LOCK)
|
if (Action == PO_CB_SYSTEM_STATE_LOCK)
|
||||||
{
|
{
|
||||||
@@ -82,7 +82,7 @@ CmBattWakeDpc(IN PKDPC Dpc,
|
|||||||
PCMBATT_DEVICE_EXTENSION DeviceExtension;
|
PCMBATT_DEVICE_EXTENSION DeviceExtension;
|
||||||
ULONG ArFlag;
|
ULONG ArFlag;
|
||||||
if (CmBattDebug & 2) DbgPrint("CmBattWakeDpc: Entered.\n");
|
if (CmBattDebug & 2) DbgPrint("CmBattWakeDpc: Entered.\n");
|
||||||
|
|
||||||
/* Loop all device objects */
|
/* Loop all device objects */
|
||||||
for (CurrentObject = FdoExtension->DeviceObject;
|
for (CurrentObject = FdoExtension->DeviceObject;
|
||||||
CurrentObject;
|
CurrentObject;
|
||||||
@@ -91,7 +91,7 @@ CmBattWakeDpc(IN PKDPC Dpc,
|
|||||||
/* Turn delay flag off, we're back in S0 */
|
/* Turn delay flag off, we're back in S0 */
|
||||||
DeviceExtension = CurrentObject->DeviceExtension;
|
DeviceExtension = CurrentObject->DeviceExtension;
|
||||||
DeviceExtension->DelayNotification = 0;
|
DeviceExtension->DelayNotification = 0;
|
||||||
|
|
||||||
/* Check if this is an AC adapter */
|
/* Check if this is an AC adapter */
|
||||||
if (DeviceExtension->FdoType == CmBattAcAdapter)
|
if (DeviceExtension->FdoType == CmBattAcAdapter)
|
||||||
{
|
{
|
||||||
@@ -145,20 +145,20 @@ CmBattNotifyHandler(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
ULONG ArFlag;
|
ULONG ArFlag;
|
||||||
PCMBATT_DEVICE_EXTENSION FdoExtension;
|
PCMBATT_DEVICE_EXTENSION FdoExtension;
|
||||||
PDEVICE_OBJECT DeviceObject;
|
PDEVICE_OBJECT DeviceObject;
|
||||||
|
|
||||||
if (CmBattDebug & (CMBATT_ACPI_ASSERT | CMBATT_PNP_INFO))
|
if (CmBattDebug & (CMBATT_ACPI_ASSERT | CMBATT_PNP_INFO))
|
||||||
DbgPrint("CmBattNotifyHandler: CmBatt 0x%08x Type %d Number %d Notify Value: %x\n",
|
DbgPrint("CmBattNotifyHandler: CmBatt 0x%08x Type %d Number %d Notify Value: %x\n",
|
||||||
DeviceExtension,
|
DeviceExtension,
|
||||||
DeviceExtension->FdoType,
|
DeviceExtension->FdoType,
|
||||||
DeviceExtension->DeviceId,
|
DeviceExtension->DeviceId,
|
||||||
NotifyValue);
|
NotifyValue);
|
||||||
|
|
||||||
/* Check what kind of notification was received */
|
/* Check what kind of notification was received */
|
||||||
switch (NotifyValue)
|
switch (NotifyValue)
|
||||||
{
|
{
|
||||||
/* ACPI Specification says is sends a "Bus Check" when power source changes */
|
/* ACPI Specification says is sends a "Bus Check" when power source changes */
|
||||||
case ACPI_BUS_CHECK:
|
case ACPI_BUS_CHECK:
|
||||||
|
|
||||||
/* We treat it as possible physical change */
|
/* We treat it as possible physical change */
|
||||||
DeviceExtension->ArFlag |= (CMBATT_AR_NOTIFY | CMBATT_AR_INSERT);
|
DeviceExtension->ArFlag |= (CMBATT_AR_NOTIFY | CMBATT_AR_INSERT);
|
||||||
if ((DeviceExtension->Tag) &&
|
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",
|
DbgPrint("CmBattNotifyHandler: Received battery #%x insertion, but tag was not invalid.\n",
|
||||||
DeviceExtension->DeviceId);
|
DeviceExtension->DeviceId);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Status of the battery has changed */
|
/* Status of the battery has changed */
|
||||||
case ACPI_BATT_NOTIFY_STATUS:
|
case ACPI_BATT_NOTIFY_STATUS:
|
||||||
|
|
||||||
/* All we'll do is notify the class driver */
|
/* All we'll do is notify the class driver */
|
||||||
DeviceExtension->ArFlag |= CMBATT_AR_NOTIFY;
|
DeviceExtension->ArFlag |= CMBATT_AR_NOTIFY;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Information on the battery has changed, such as physical presence */
|
/* Information on the battery has changed, such as physical presence */
|
||||||
case ACPI_DEVICE_CHECK:
|
case ACPI_DEVICE_CHECK:
|
||||||
case ACPI_BATT_NOTIFY_INFO:
|
case ACPI_BATT_NOTIFY_INFO:
|
||||||
|
|
||||||
/* Reset all state and let the class driver re-evaluate it all */
|
/* Reset all state and let the class driver re-evaluate it all */
|
||||||
DeviceExtension->ArFlag |= (CMBATT_AR_NOTIFY |
|
DeviceExtension->ArFlag |= (CMBATT_AR_NOTIFY |
|
||||||
CMBATT_AR_INSERT |
|
CMBATT_AR_INSERT |
|
||||||
CMBATT_AR_REMOVE);
|
CMBATT_AR_REMOVE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
if (CmBattDebug & CMBATT_PNP_INFO)
|
if (CmBattDebug & CMBATT_PNP_INFO)
|
||||||
DbgPrint("CmBattNotifyHandler: Unknown Notify Value: %x\n", NotifyValue);
|
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 */
|
/* 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);
|
DbgPrint("CmBattNotifyHandler: Performing ARs: %01x\n", DeviceExtension->ArFlag);
|
||||||
|
|
||||||
/* Check if this is a battery or AC adapter notification */
|
/* 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 */
|
/* Reset the current trip point */
|
||||||
DeviceExtension->TripPointValue = BATTERY_UNKNOWN_CAPACITY;
|
DeviceExtension->TripPointValue = BATTERY_UNKNOWN_CAPACITY;
|
||||||
|
|
||||||
/* Check what ARs have to be done */
|
/* Check what ARs have to be done */
|
||||||
ArFlag = DeviceExtension->ArFlag;
|
ArFlag = DeviceExtension->ArFlag;
|
||||||
|
|
||||||
/* New battery inserted, reset lock value */
|
/* New battery inserted, reset lock value */
|
||||||
if (ArFlag & CMBATT_AR_INSERT) InterlockedExchange(&DeviceExtension->ArLockValue, 0);
|
if (ArFlag & CMBATT_AR_INSERT) InterlockedExchange(&DeviceExtension->ArLockValue, 0);
|
||||||
|
|
||||||
/* Check if the battery may have been removed */
|
/* Check if the battery may have been removed */
|
||||||
if (ArFlag & CMBATT_AR_REMOVE) DeviceExtension->Tag = 0;
|
if (ArFlag & CMBATT_AR_REMOVE) DeviceExtension->Tag = 0;
|
||||||
|
|
||||||
/* Check if there's been any sort of change to the battery */
|
/* Check if there's been any sort of change to the battery */
|
||||||
if (ArFlag & CMBATT_AR_NOTIFY)
|
if (ArFlag & CMBATT_AR_NOTIFY)
|
||||||
{
|
{
|
||||||
@@ -244,7 +244,7 @@ CmBattNotifyHandler(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ARs have been processed */
|
/* ARs have been processed */
|
||||||
DeviceExtension->ArFlag = 0;
|
DeviceExtension->ArFlag = 0;
|
||||||
}
|
}
|
||||||
@@ -254,7 +254,7 @@ NTAPI
|
|||||||
CmBattUnload(IN PDRIVER_OBJECT DriverObject)
|
CmBattUnload(IN PDRIVER_OBJECT DriverObject)
|
||||||
{
|
{
|
||||||
if (CmBattDebug & CMBATT_GENERIC_INFO) DPRINT("CmBattUnload: \n");
|
if (CmBattDebug & CMBATT_GENERIC_INFO) DPRINT("CmBattUnload: \n");
|
||||||
|
|
||||||
/* Check if we have a registered power callback */
|
/* Check if we have a registered power callback */
|
||||||
if (CmBattPowerCallBackObject)
|
if (CmBattPowerCallBackObject)
|
||||||
{
|
{
|
||||||
@@ -262,7 +262,7 @@ CmBattUnload(IN PDRIVER_OBJECT DriverObject)
|
|||||||
ExUnregisterCallback(CmBattPowerCallBackRegistration);
|
ExUnregisterCallback(CmBattPowerCallBackRegistration);
|
||||||
ObDereferenceObject(CmBattPowerCallBackObject);
|
ObDereferenceObject(CmBattPowerCallBackObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free the registry buffer if it exists */
|
/* Free the registry buffer if it exists */
|
||||||
if (GlobalRegistryPath.Buffer) ExFreePool(GlobalRegistryPath.Buffer);
|
if (GlobalRegistryPath.Buffer) ExFreePool(GlobalRegistryPath.Buffer);
|
||||||
|
|
||||||
@@ -279,7 +279,7 @@ CmBattVerifyStaticInfo(PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
ULONG BatteryTag)
|
ULONG BatteryTag)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
@@ -298,7 +298,7 @@ CmBattOpenClose(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
/* Grab the device extension and lock it */
|
/* Grab the device extension and lock it */
|
||||||
DeviceExtension = DeviceObject->DeviceExtension;
|
DeviceExtension = DeviceObject->DeviceExtension;
|
||||||
ExAcquireFastMutex(&DeviceExtension->FastMutex);
|
ExAcquireFastMutex(&DeviceExtension->FastMutex);
|
||||||
|
|
||||||
/* Check if someone is trying to open a device that doesn't exist yet */
|
/* Check if someone is trying to open a device that doesn't exist yet */
|
||||||
Count = DeviceExtension->HandleCount;
|
Count = DeviceExtension->HandleCount;
|
||||||
if (Count == 0xFFFFFFFF)
|
if (Count == 0xFFFFFFFF)
|
||||||
@@ -312,14 +312,14 @@ CmBattOpenClose(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
}
|
}
|
||||||
goto Complete;
|
goto Complete;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if this is an open or close */
|
/* Check if this is an open or close */
|
||||||
IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
|
IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
|
||||||
Major = IoStackLocation->MajorFunction;
|
Major = IoStackLocation->MajorFunction;
|
||||||
if (Major == IRP_MJ_CREATE)
|
if (Major == IRP_MJ_CREATE)
|
||||||
{
|
{
|
||||||
/* Increment the open count */
|
/* Increment the open count */
|
||||||
DeviceExtension->HandleCount = Count + 1;
|
DeviceExtension->HandleCount = Count + 1;
|
||||||
if (CmBattDebug & CMBATT_PNP_INFO)
|
if (CmBattDebug & CMBATT_PNP_INFO)
|
||||||
{
|
{
|
||||||
DbgPrint("CmBattOpenClose: Open (DeviceNumber = %x)(count = %x).\n",
|
DbgPrint("CmBattOpenClose: Open (DeviceNumber = %x)(count = %x).\n",
|
||||||
@@ -342,7 +342,7 @@ Complete:
|
|||||||
ExReleaseFastMutex(&DeviceExtension->FastMutex);
|
ExReleaseFastMutex(&DeviceExtension->FastMutex);
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
@@ -366,7 +366,7 @@ CmBattIoctl(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return STATUS_DEVICE_REMOVED;
|
return STATUS_DEVICE_REMOVED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* There's nothing to do for an AC adapter */
|
/* There's nothing to do for an AC adapter */
|
||||||
if (DeviceExtension->FdoType == CmBattAcAdapter)
|
if (DeviceExtension->FdoType == CmBattAcAdapter)
|
||||||
{
|
{
|
||||||
@@ -376,7 +376,7 @@ CmBattIoctl(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, Irp);
|
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, Irp);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send to class driver */
|
/* Send to class driver */
|
||||||
Status = BatteryClassIoctl(DeviceExtension->ClassData, Irp);
|
Status = BatteryClassIoctl(DeviceExtension->ClassData, Irp);
|
||||||
if (Status == STATUS_NOT_SUPPORTED)
|
if (Status == STATUS_NOT_SUPPORTED)
|
||||||
@@ -388,12 +388,12 @@ CmBattIoctl(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
InputBufferLength = IoStackLocation->Parameters.DeviceIoControl.InputBufferLength;
|
InputBufferLength = IoStackLocation->Parameters.DeviceIoControl.InputBufferLength;
|
||||||
if (CmBattDebug & 4)
|
if (CmBattDebug & 4)
|
||||||
DbgPrint("CmBattIoctl: Received Direct Access IOCTL %x\n", IoControlCode);
|
DbgPrint("CmBattIoctl: Received Direct Access IOCTL %x\n", IoControlCode);
|
||||||
|
|
||||||
/* Handle internal IOCTLs */
|
/* Handle internal IOCTLs */
|
||||||
switch (IoControlCode)
|
switch (IoControlCode)
|
||||||
{
|
{
|
||||||
case IOCTL_BATTERY_QUERY_UNIQUE_ID:
|
case IOCTL_BATTERY_QUERY_UNIQUE_ID:
|
||||||
|
|
||||||
/* Data is 4 bytes long */
|
/* Data is 4 bytes long */
|
||||||
if (OutputBufferLength == sizeof(ULONG))
|
if (OutputBufferLength == sizeof(ULONG))
|
||||||
{
|
{
|
||||||
@@ -408,9 +408,9 @@ CmBattIoctl(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
Status = STATUS_INVALID_BUFFER_SIZE;
|
Status = STATUS_INVALID_BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_BATTERY_QUERY_STA:
|
case IOCTL_BATTERY_QUERY_STA:
|
||||||
|
|
||||||
/* Data is 4 bytes long */
|
/* Data is 4 bytes long */
|
||||||
if (OutputBufferLength == sizeof(ULONG))
|
if (OutputBufferLength == sizeof(ULONG))
|
||||||
{
|
{
|
||||||
@@ -425,9 +425,9 @@ CmBattIoctl(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
Status = STATUS_INVALID_BUFFER_SIZE;
|
Status = STATUS_INVALID_BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_BATTERY_QUERY_PSR:
|
case IOCTL_BATTERY_QUERY_PSR:
|
||||||
|
|
||||||
/* Data is 4 bytes long */
|
/* Data is 4 bytes long */
|
||||||
if (OutputBufferLength == sizeof(ULONG))
|
if (OutputBufferLength == sizeof(ULONG))
|
||||||
{
|
{
|
||||||
@@ -451,9 +451,9 @@ CmBattIoctl(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
Status = STATUS_INVALID_BUFFER_SIZE;
|
Status = STATUS_INVALID_BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_BATTERY_SET_TRIP_POINT:
|
case IOCTL_BATTERY_SET_TRIP_POINT:
|
||||||
|
|
||||||
/* Data is 4 bytes long */
|
/* Data is 4 bytes long */
|
||||||
if (InputBufferLength == sizeof(ULONG))
|
if (InputBufferLength == sizeof(ULONG))
|
||||||
{
|
{
|
||||||
@@ -468,9 +468,9 @@ CmBattIoctl(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
Status = STATUS_INVALID_BUFFER_SIZE;
|
Status = STATUS_INVALID_BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_BATTERY_QUERY_BIF:
|
case IOCTL_BATTERY_QUERY_BIF:
|
||||||
|
|
||||||
/* Data is 1060 bytes long */
|
/* Data is 1060 bytes long */
|
||||||
if (OutputBufferLength == sizeof(ACPI_BIF_DATA))
|
if (OutputBufferLength == sizeof(ACPI_BIF_DATA))
|
||||||
{
|
{
|
||||||
@@ -485,9 +485,9 @@ CmBattIoctl(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
Status = STATUS_INVALID_BUFFER_SIZE;
|
Status = STATUS_INVALID_BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_BATTERY_QUERY_BST:
|
case IOCTL_BATTERY_QUERY_BST:
|
||||||
|
|
||||||
/* Data is 16 bytes long */
|
/* Data is 16 bytes long */
|
||||||
if (OutputBufferLength == sizeof(ACPI_BST_DATA))
|
if (OutputBufferLength == sizeof(ACPI_BST_DATA))
|
||||||
{
|
{
|
||||||
@@ -502,15 +502,15 @@ CmBattIoctl(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
Status = STATUS_INVALID_BUFFER_SIZE;
|
Status = STATUS_INVALID_BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
/* Unknown, let us pass it on to ACPI */
|
/* Unknown, let us pass it on to ACPI */
|
||||||
if (CmBattDebug & 0xC)
|
if (CmBattDebug & 0xC)
|
||||||
DbgPrint("CmBattIoctl: Unknown IOCTL %x\n", IoControlCode);
|
DbgPrint("CmBattIoctl: Unknown IOCTL %x\n", IoControlCode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Did someone pick it up? */
|
/* Did someone pick it up? */
|
||||||
if (Status != STATUS_NOT_SUPPORTED)
|
if (Status != STATUS_NOT_SUPPORTED)
|
||||||
{
|
{
|
||||||
@@ -544,11 +544,11 @@ CmBattQueryTag(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
if (CmBattDebug & (CMBATT_ACPI_WARNING | CMBATT_GENERIC_INFO))
|
if (CmBattDebug & (CMBATT_ACPI_WARNING | CMBATT_GENERIC_INFO))
|
||||||
DbgPrint("CmBattQueryTag - Tag (%d), Battery %x, Device %d\n",
|
DbgPrint("CmBattQueryTag - Tag (%d), Battery %x, Device %d\n",
|
||||||
*Tag, DeviceExtension, DeviceExtension->DeviceId);
|
*Tag, DeviceExtension, DeviceExtension->DeviceId);
|
||||||
|
|
||||||
/* Get PDO and clear notification flag */
|
/* Get PDO and clear notification flag */
|
||||||
PdoDevice = DeviceExtension->PdoDeviceObject;
|
PdoDevice = DeviceExtension->PdoDeviceObject;
|
||||||
DeviceExtension->NotifySent = 0;
|
DeviceExtension->NotifySent = 0;
|
||||||
|
|
||||||
/* Get _STA from PDO (we need the machine status, not the battery status) */
|
/* Get _STA from PDO (we need the machine status, not the battery status) */
|
||||||
Status = CmBattGetStaData(PdoDevice, &StaData);
|
Status = CmBattGetStaData(PdoDevice, &StaData);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
@@ -565,11 +565,11 @@ CmBattQueryTag(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
DeviceExtension->Tag = NewTag;
|
DeviceExtension->Tag = NewTag;
|
||||||
if (CmBattDebug & CMBATT_GENERIC_INFO)
|
if (CmBattDebug & CMBATT_GENERIC_INFO)
|
||||||
DbgPrint("CmBattQueryTag - New Tag: (%d)\n", DeviceExtension->Tag);
|
DbgPrint("CmBattQueryTag - New Tag: (%d)\n", DeviceExtension->Tag);
|
||||||
|
|
||||||
/* Reset trip point data */
|
/* Reset trip point data */
|
||||||
DeviceExtension->TripPointOld = 0;
|
DeviceExtension->TripPointOld = 0;
|
||||||
DeviceExtension->TripPointValue = BATTERY_UNKNOWN_CAPACITY;
|
DeviceExtension->TripPointValue = BATTERY_UNKNOWN_CAPACITY;
|
||||||
|
|
||||||
/* Clear AR lock and set new interrupt time */
|
/* Clear AR lock and set new interrupt time */
|
||||||
InterlockedExchange(&DeviceExtension->ArLockValue, 0);
|
InterlockedExchange(&DeviceExtension->ArLockValue, 0);
|
||||||
DeviceExtension->InterruptTime = KeQueryInterruptTime();
|
DeviceExtension->InterruptTime = KeQueryInterruptTime();
|
||||||
@@ -582,7 +582,7 @@ CmBattQueryTag(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
Status = STATUS_NO_SUCH_DEVICE;
|
Status = STATUS_NO_SUCH_DEVICE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the tag and status result */
|
/* Return the tag and status result */
|
||||||
*Tag = DeviceExtension->Tag;
|
*Tag = DeviceExtension->Tag;
|
||||||
if (CmBattDebug & CMBATT_ACPI_WARNING)
|
if (CmBattDebug & CMBATT_ACPI_WARNING)
|
||||||
@@ -626,7 +626,7 @@ CmBattDisableStatusNotify(IN PCMBATT_DEVICE_EXTENSION DeviceExtension)
|
|||||||
/* Nothing we can do */
|
/* Nothing we can do */
|
||||||
Status = STATUS_OBJECT_NAME_NOT_FOUND;
|
Status = STATUS_OBJECT_NAME_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return status */
|
/* Return status */
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@@ -645,14 +645,14 @@ CmBattSetStatusNotify(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
if (CmBattDebug & (CMBATT_ACPI_WARNING | CMBATT_GENERIC_INFO))
|
if (CmBattDebug & (CMBATT_ACPI_WARNING | CMBATT_GENERIC_INFO))
|
||||||
DbgPrint("CmBattSetStatusNotify: Tag (%d) Target(0x%x)\n",
|
DbgPrint("CmBattSetStatusNotify: Tag (%d) Target(0x%x)\n",
|
||||||
BatteryTag, BatteryNotify->LowCapacity);
|
BatteryTag, BatteryNotify->LowCapacity);
|
||||||
|
|
||||||
/* Update any ACPI evaluations */
|
/* Update any ACPI evaluations */
|
||||||
Status = CmBattVerifyStaticInfo(DeviceExtension, BatteryTag);
|
Status = CmBattVerifyStaticInfo(DeviceExtension, BatteryTag);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
/* Trip point not supported, fail */
|
/* Trip point not supported, fail */
|
||||||
if (!DeviceExtension->TripPointSet) return STATUS_OBJECT_NAME_NOT_FOUND;
|
if (!DeviceExtension->TripPointSet) return STATUS_OBJECT_NAME_NOT_FOUND;
|
||||||
|
|
||||||
/* Are both capacities known? */
|
/* Are both capacities known? */
|
||||||
if ((BatteryNotify->HighCapacity == BATTERY_UNKNOWN_CAPACITY) ||
|
if ((BatteryNotify->HighCapacity == BATTERY_UNKNOWN_CAPACITY) ||
|
||||||
(BatteryNotify->LowCapacity == 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");
|
DbgPrint("CmBattSetStatusNotify: Failing request because of BATTERY_UNKNOWN_CAPACITY.\n");
|
||||||
return STATUS_NOT_SUPPORTED;
|
return STATUS_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Is the battery charging? */
|
/* Is the battery charging? */
|
||||||
Charging = DeviceExtension->BstData.State & ACPI_BATT_STAT_CHARGING;
|
Charging = DeviceExtension->BstData.State & ACPI_BATT_STAT_CHARGING;
|
||||||
if (Charging)
|
if (Charging)
|
||||||
@@ -704,7 +704,7 @@ CmBattSetStatusNotify(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
Status = STATUS_NOT_SUPPORTED;
|
Status = STATUS_NOT_SUPPORTED;
|
||||||
if (CmBattDebug & CMBATT_ACPI_WARNING)
|
if (CmBattDebug & CMBATT_ACPI_WARNING)
|
||||||
DbgPrint("CmBattSetStatusNotify: Can't calculate BTP, DesignVoltage = 0x%08x\n",
|
DbgPrint("CmBattSetStatusNotify: Can't calculate BTP, DesignVoltage = 0x%08x\n",
|
||||||
DesignVoltage);
|
DesignVoltage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Charging)
|
else if (Charging)
|
||||||
@@ -726,7 +726,7 @@ CmBattSetStatusNotify(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
DbgPrint("CmBattSetStatusNotify: Keeping original setting: %X\n", DeviceExtension->TripPointValue);
|
DbgPrint("CmBattSetStatusNotify: Keeping original setting: %X\n", DeviceExtension->TripPointValue);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the trip point with ACPI and check for success */
|
/* Set the trip point with ACPI and check for success */
|
||||||
DeviceExtension->TripPointValue = NewTripPoint;
|
DeviceExtension->TripPointValue = NewTripPoint;
|
||||||
Status = CmBattSetTripPpoint(DeviceExtension, NewTripPoint);
|
Status = CmBattSetTripPpoint(DeviceExtension, NewTripPoint);
|
||||||
@@ -739,7 +739,7 @@ CmBattSetStatusNotify(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
DbgPrint("CmBattSetStatusNotify: SetTripPoint failed - %x\n", Status);
|
DbgPrint("CmBattSetStatusNotify: SetTripPoint failed - %x\n", Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the new BST data to see the latest state */
|
/* Read the new BST data to see the latest state */
|
||||||
Status = CmBattGetBstData(DeviceExtension, &BstData);
|
Status = CmBattGetBstData(DeviceExtension, &BstData);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
@@ -762,7 +762,7 @@ CmBattSetStatusNotify(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
if (CmBattDebug & CMBATT_GENERIC_WARNING)
|
if (CmBattDebug & CMBATT_GENERIC_WARNING)
|
||||||
DbgPrint("CmBattSetStatusNotify: Trip point already crossed (1): TP = %08x, remaining capacity = %08x\n",
|
DbgPrint("CmBattSetStatusNotify: Trip point already crossed (1): TP = %08x, remaining capacity = %08x\n",
|
||||||
NewTripPoint, BstData.RemainingCapacity);
|
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! */
|
/* 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();
|
PAGED_CODE();
|
||||||
if (CmBattDebug & CMBATT_GENERIC_INFO)
|
if (CmBattDebug & CMBATT_GENERIC_INFO)
|
||||||
DbgPrint("CmBattGetBatteryStatus - CmBatt (%08x) Tag (%d)\n", DeviceExtension, Tag);
|
DbgPrint("CmBattGetBatteryStatus - CmBatt (%08x) Tag (%d)\n", DeviceExtension, Tag);
|
||||||
|
|
||||||
/* Validate ACPI data */
|
/* Validate ACPI data */
|
||||||
Status = CmBattVerifyStaticInfo(DeviceExtension, Tag);
|
Status = CmBattVerifyStaticInfo(DeviceExtension, Tag);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
@@ -810,8 +810,8 @@ CmBattGetBatteryStatus(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
InterlockedExchange(&DeviceExtension->ArLockValue, 0);
|
InterlockedExchange(&DeviceExtension->ArLockValue, 0);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear current BST information */
|
/* Clear current BST information */
|
||||||
DeviceExtension->State = 0;
|
DeviceExtension->State = 0;
|
||||||
DeviceExtension->RemainingCapacity = 0;
|
DeviceExtension->RemainingCapacity = 0;
|
||||||
DeviceExtension->PresentVoltage = 0;
|
DeviceExtension->PresentVoltage = 0;
|
||||||
@@ -819,7 +819,7 @@ CmBattGetBatteryStatus(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
|
|
||||||
/* Get battery state */
|
/* Get battery state */
|
||||||
BstState = DeviceExtension->BstData.State;
|
BstState = DeviceExtension->BstData.State;
|
||||||
|
|
||||||
/* Is the battery both charging and discharging? */
|
/* Is the battery both charging and discharging? */
|
||||||
if ((BstState & ACPI_BATT_STAT_DISCHARG) && (BstState & ACPI_BATT_STAT_CHARGING) &&
|
if ((BstState & ACPI_BATT_STAT_DISCHARG) && (BstState & ACPI_BATT_STAT_CHARGING) &&
|
||||||
(CmBattDebug & (CMBATT_ACPI_WARNING | CMBATT_GENERIC_WARNING)))
|
(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"
|
"CmBattGetBatteryStatus: Invalid state: _BST method returned 0x%08x for Battery State.\n"
|
||||||
"* One battery cannot be charging and discharging at the same time.\n",
|
"* One battery cannot be charging and discharging at the same time.\n",
|
||||||
BstState);
|
BstState);
|
||||||
|
|
||||||
/* Is the battery discharging? */
|
/* Is the battery discharging? */
|
||||||
if (BstState & ACPI_BATT_STAT_DISCHARG)
|
if (BstState & ACPI_BATT_STAT_DISCHARG)
|
||||||
{
|
{
|
||||||
/* Set power state and check if it just started discharging now */
|
/* 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 */
|
/* Battery is charging, update power state */
|
||||||
DeviceExtension->State |= (BATTERY_CHARGING | BATTERY_POWER_ON_LINE);
|
DeviceExtension->State |= (BATTERY_CHARGING | BATTERY_POWER_ON_LINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Is the battery in a critical state? */
|
/* Is the battery in a critical state? */
|
||||||
if (BstState & ACPI_BATT_STAT_CRITICAL) DeviceExtension->State |= BATTERY_CRITICAL;
|
if (BstState & ACPI_BATT_STAT_CRITICAL) DeviceExtension->State |= BATTERY_CRITICAL;
|
||||||
|
|
||||||
/* Read the voltage data */
|
/* Read the voltage data */
|
||||||
DeviceExtension->PresentVoltage = DeviceExtension->BstData.PresentVoltage;
|
DeviceExtension->PresentVoltage = DeviceExtension->BstData.PresentVoltage;
|
||||||
|
|
||||||
/* Check if we have an A/C adapter */
|
/* Check if we have an A/C adapter */
|
||||||
if (AcAdapterPdo)
|
if (AcAdapterPdo)
|
||||||
{
|
{
|
||||||
@@ -868,10 +868,10 @@ CmBattGetBatteryStatus(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Assume no charger */
|
/* Assume no charger */
|
||||||
PsrData = 0;
|
PsrData = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Is there a charger? */
|
/* Is there a charger? */
|
||||||
if (PsrData)
|
if (PsrData)
|
||||||
{
|
{
|
||||||
@@ -882,21 +882,21 @@ CmBattGetBatteryStatus(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
}
|
}
|
||||||
else if (CmBattDebug & (CMBATT_GENERIC_INFO | CMBATT_GENERIC_STATUS))
|
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 */
|
/* Get some data we'll need */
|
||||||
DesignVoltage = DeviceExtension->BifData.DesignVoltage;
|
DesignVoltage = DeviceExtension->BifData.DesignVoltage;
|
||||||
PresentRate = DeviceExtension->BstData.PresentRate;
|
PresentRate = DeviceExtension->BstData.PresentRate;
|
||||||
RemainingCapacity = DeviceExtension->BstData.RemainingCapacity;
|
RemainingCapacity = DeviceExtension->BstData.RemainingCapacity;
|
||||||
|
|
||||||
/* Check if we have battery data in Watts instead of Amps */
|
/* Check if we have battery data in Watts instead of Amps */
|
||||||
if (DeviceExtension->BifData.PowerUnit == ACPI_BATT_POWER_UNIT_WATTS)
|
if (DeviceExtension->BifData.PowerUnit == ACPI_BATT_POWER_UNIT_WATTS)
|
||||||
{
|
{
|
||||||
/* Get the data from the BST */
|
/* Get the data from the BST */
|
||||||
DeviceExtension->RemainingCapacity = RemainingCapacity;
|
DeviceExtension->RemainingCapacity = RemainingCapacity;
|
||||||
DeviceExtension->Rate = PresentRate;
|
DeviceExtension->Rate = PresentRate;
|
||||||
|
|
||||||
/* Check if the rate is invalid */
|
/* Check if the rate is invalid */
|
||||||
if (PresentRate > CM_MAX_VALUE)
|
if (PresentRate > CM_MAX_VALUE)
|
||||||
{
|
{
|
||||||
@@ -927,7 +927,7 @@ CmBattGetBatteryStatus(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
/* Compute the capacity with the information we have */
|
/* Compute the capacity with the information we have */
|
||||||
DeviceExtension->RemainingCapacity = (DesignVoltage * RemainingCapacity + 500) / 1000;
|
DeviceExtension->RemainingCapacity = (DesignVoltage * RemainingCapacity + 500) / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if we have a rate */
|
/* Check if we have a rate */
|
||||||
if (PresentRate != CM_UNKNOWN_VALUE)
|
if (PresentRate != CM_UNKNOWN_VALUE)
|
||||||
{
|
{
|
||||||
@@ -942,14 +942,14 @@ CmBattGetBatteryStatus(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
DbgPrint("---------------------- Overflow: PresentRate = 0x%08x\n", PresentRate);
|
DbgPrint("---------------------- Overflow: PresentRate = 0x%08x\n", PresentRate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compute the rate */
|
/* Compute the rate */
|
||||||
DeviceExtension->Rate = (PresentRate * DesignVoltage + 500) / 1000;
|
DeviceExtension->Rate = (PresentRate * DesignVoltage + 500) / 1000;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* We don't have a rate, so set unknown value */
|
/* 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)
|
if (CmBattDebug & CMBATT_ACPI_WARNING)
|
||||||
{
|
{
|
||||||
DbgPrint("CmBattGetBatteryStatus - Can't calculate Rate \n");
|
DbgPrint("CmBattGetBatteryStatus - Can't calculate Rate \n");
|
||||||
@@ -968,7 +968,7 @@ CmBattGetBatteryStatus(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
DbgPrint("---------------------- DesignVoltage = 0x%08x\n", DesignVoltage);
|
DbgPrint("---------------------- DesignVoltage = 0x%08x\n", DesignVoltage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if we have an unknown rate */
|
/* Check if we have an unknown rate */
|
||||||
if (DeviceExtension->Rate == BATTERY_UNKNOWN_RATE)
|
if (DeviceExtension->Rate == BATTERY_UNKNOWN_RATE)
|
||||||
{
|
{
|
||||||
@@ -990,7 +990,7 @@ CmBattGetBatteryStatus(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
DeviceExtension->Rate);
|
DeviceExtension->Rate);
|
||||||
DeviceExtension->Rate = 0;
|
DeviceExtension->Rate = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Done */
|
/* Done */
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -1036,9 +1036,9 @@ CmBattQueryInformation(IN PCMBATT_DEVICE_EXTENSION FdoExtension,
|
|||||||
QueryData = &FdoExtension->BatteryInformation;
|
QueryData = &FdoExtension->BatteryInformation;
|
||||||
QueryLength = sizeof(BATTERY_INFORMATION);
|
QueryLength = sizeof(BATTERY_INFORMATION);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BatteryGranularityInformation:
|
case BatteryGranularityInformation:
|
||||||
|
|
||||||
/* Return our static information, we have two scales */
|
/* Return our static information, we have two scales */
|
||||||
BatteryReportingScale[0].Granularity = FdoExtension->BatteryCapacityGranularity1;
|
BatteryReportingScale[0].Granularity = FdoExtension->BatteryCapacityGranularity1;
|
||||||
BatteryReportingScale[0].Capacity = FdoExtension->BatteryInformation.DefaultAlert1;
|
BatteryReportingScale[0].Capacity = FdoExtension->BatteryInformation.DefaultAlert1;
|
||||||
@@ -1047,25 +1047,25 @@ CmBattQueryInformation(IN PCMBATT_DEVICE_EXTENSION FdoExtension,
|
|||||||
QueryData = BatteryReportingScale;
|
QueryData = BatteryReportingScale;
|
||||||
QueryLength = sizeof(BATTERY_REPORTING_SCALE) * 2;
|
QueryLength = sizeof(BATTERY_REPORTING_SCALE) * 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BatteryEstimatedTime:
|
case BatteryEstimatedTime:
|
||||||
|
|
||||||
/* Check if it's been more than 2 1/2 minutes since the last change */
|
/* Check if it's been more than 2 1/2 minutes since the last change */
|
||||||
if ((KeQueryInterruptTime() - 150000000) > (FdoExtension->InterruptTime))
|
if ((KeQueryInterruptTime() - 150000000) > (FdoExtension->InterruptTime))
|
||||||
{
|
{
|
||||||
/* Get new battery status */
|
/* Get new battery status */
|
||||||
CmBattGetBatteryStatus(FdoExtension, FdoExtension->Tag);
|
CmBattGetBatteryStatus(FdoExtension, FdoExtension->Tag);
|
||||||
|
|
||||||
/* If the caller didn't specify a rate, use our static one */
|
/* If the caller didn't specify a rate, use our static one */
|
||||||
Rate = AtRate;
|
Rate = AtRate;
|
||||||
if (!Rate) Rate = FdoExtension->Rate;
|
if (!Rate) Rate = FdoExtension->Rate;
|
||||||
|
|
||||||
/* If we don't have a valid negative rate, use unknown value */
|
/* If we don't have a valid negative rate, use unknown value */
|
||||||
if (Rate >= 0) Rate = BATTERY_UNKNOWN_RATE;
|
if (Rate >= 0) Rate = BATTERY_UNKNOWN_RATE;
|
||||||
|
|
||||||
/* Grab the remaining capacity */
|
/* Grab the remaining capacity */
|
||||||
RemainingCapacity = FdoExtension->RemainingCapacity;
|
RemainingCapacity = FdoExtension->RemainingCapacity;
|
||||||
|
|
||||||
/* See if we don't know one or the other */
|
/* See if we don't know one or the other */
|
||||||
if ((Rate == BATTERY_UNKNOWN_RATE) ||
|
if ((Rate == BATTERY_UNKNOWN_RATE) ||
|
||||||
(RemainingCapacity == BATTERY_UNKNOWN_CAPACITY))
|
(RemainingCapacity == BATTERY_UNKNOWN_CAPACITY))
|
||||||
@@ -1074,7 +1074,7 @@ CmBattQueryInformation(IN PCMBATT_DEVICE_EXTENSION FdoExtension,
|
|||||||
if ((FdoExtension->BstData.State & ACPI_BATT_STAT_DISCHARG) &&
|
if ((FdoExtension->BstData.State & ACPI_BATT_STAT_DISCHARG) &&
|
||||||
(CmBattDebug & CMBATT_GENERIC_WARNING))
|
(CmBattDebug & CMBATT_GENERIC_WARNING))
|
||||||
DbgPrint("CmBattQueryInformation: Can't calculate EstimatedTime.\n");
|
DbgPrint("CmBattQueryInformation: Can't calculate EstimatedTime.\n");
|
||||||
|
|
||||||
/* Check if we don't have a rate and capacity is going down */
|
/* Check if we don't have a rate and capacity is going down */
|
||||||
if ((FdoExtension->Rate == BATTERY_UNKNOWN_RATE) &&
|
if ((FdoExtension->Rate == BATTERY_UNKNOWN_RATE) &&
|
||||||
(FdoExtension->BstData.State & ACPI_BATT_STAT_DISCHARG))
|
(FdoExtension->BstData.State & ACPI_BATT_STAT_DISCHARG))
|
||||||
@@ -1084,7 +1084,7 @@ CmBattQueryInformation(IN PCMBATT_DEVICE_EXTENSION FdoExtension,
|
|||||||
if (CmBattDebug & CMBATT_GENERIC_WARNING)
|
if (CmBattDebug & CMBATT_GENERIC_WARNING)
|
||||||
DbgPrint("---------------------- PresentRate = BATTERY_UNKNOWN_RATE\n");
|
DbgPrint("---------------------- PresentRate = BATTERY_UNKNOWN_RATE\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we don't have capacity, the rate is useless */
|
/* If we don't have capacity, the rate is useless */
|
||||||
if (RemainingCapacity == BATTERY_UNKNOWN_CAPACITY)
|
if (RemainingCapacity == BATTERY_UNKNOWN_CAPACITY)
|
||||||
{
|
{
|
||||||
@@ -1110,49 +1110,49 @@ CmBattQueryInformation(IN PCMBATT_DEVICE_EXTENSION FdoExtension,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the remaining time */
|
/* Return the remaining time */
|
||||||
QueryData = &RemainingTime;
|
QueryData = &RemainingTime;
|
||||||
QueryLength = sizeof(ULONG);
|
QueryLength = sizeof(ULONG);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BatteryDeviceName:
|
case BatteryDeviceName:
|
||||||
|
|
||||||
/* Build the model number string */
|
/* Build the model number string */
|
||||||
RtlInitAnsiString(&TempString, FdoExtension->ModelNumber);
|
RtlInitAnsiString(&TempString, FdoExtension->ModelNumber);
|
||||||
|
|
||||||
/* Convert it to Unicode */
|
/* Convert it to Unicode */
|
||||||
InfoString.Buffer = InfoBuffer;
|
InfoString.Buffer = InfoBuffer;
|
||||||
InfoString.MaximumLength = sizeof(InfoBuffer);
|
InfoString.MaximumLength = sizeof(InfoBuffer);
|
||||||
Status = RtlAnsiStringToUnicodeString(&InfoString, &TempString, 0);
|
Status = RtlAnsiStringToUnicodeString(&InfoString, &TempString, 0);
|
||||||
|
|
||||||
/* Return the unicode buffer */
|
/* Return the unicode buffer */
|
||||||
QueryData = InfoString.Buffer;
|
QueryData = InfoString.Buffer;
|
||||||
QueryLength = InfoString.Length;
|
QueryLength = InfoString.Length;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BatteryTemperature:
|
case BatteryTemperature:
|
||||||
case BatteryManufactureDate:
|
case BatteryManufactureDate:
|
||||||
|
|
||||||
/* We don't support these */
|
/* We don't support these */
|
||||||
Status = STATUS_INVALID_DEVICE_REQUEST;
|
Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BatteryManufactureName:
|
case BatteryManufactureName:
|
||||||
|
|
||||||
/* Build the OEM info string */
|
/* Build the OEM info string */
|
||||||
RtlInitAnsiString(&TempString, FdoExtension->OemInfo);
|
RtlInitAnsiString(&TempString, FdoExtension->OemInfo);
|
||||||
|
|
||||||
/* Convert it to Unicode */
|
/* Convert it to Unicode */
|
||||||
InfoString.Buffer = InfoBuffer;
|
InfoString.Buffer = InfoBuffer;
|
||||||
InfoString.MaximumLength = sizeof(InfoBuffer);
|
InfoString.MaximumLength = sizeof(InfoBuffer);
|
||||||
Status = RtlAnsiStringToUnicodeString(&InfoString, &TempString, 0);
|
Status = RtlAnsiStringToUnicodeString(&InfoString, &TempString, 0);
|
||||||
|
|
||||||
/* Return the unicode buffer */
|
/* Return the unicode buffer */
|
||||||
QueryData = InfoString.Buffer;
|
QueryData = InfoString.Buffer;
|
||||||
QueryLength = InfoString.Length;
|
QueryLength = InfoString.Length;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BatteryUniqueID:
|
case BatteryUniqueID:
|
||||||
|
|
||||||
/* Build the serial number string */
|
/* Build the serial number string */
|
||||||
@@ -1166,32 +1166,32 @@ CmBattQueryInformation(IN PCMBATT_DEVICE_EXTENSION FdoExtension,
|
|||||||
/* Setup a temporary string for concatenation */
|
/* Setup a temporary string for concatenation */
|
||||||
TempString2.Buffer = TempBuffer;
|
TempString2.Buffer = TempBuffer;
|
||||||
TempString2.MaximumLength = sizeof(TempBuffer);
|
TempString2.MaximumLength = sizeof(TempBuffer);
|
||||||
|
|
||||||
/* Check if there's an OEM string */
|
/* Check if there's an OEM string */
|
||||||
if (FdoExtension->OemInfo[0])
|
if (FdoExtension->OemInfo[0])
|
||||||
{
|
{
|
||||||
/* Build the OEM info string */
|
/* Build the OEM info string */
|
||||||
RtlInitAnsiString(&TempString, FdoExtension->OemInfo);
|
RtlInitAnsiString(&TempString, FdoExtension->OemInfo);
|
||||||
|
|
||||||
/* Convert it to Unicode and append it */
|
/* Convert it to Unicode and append it */
|
||||||
RtlAnsiStringToUnicodeString(&TempString2, &TempString, 0);
|
RtlAnsiStringToUnicodeString(&TempString2, &TempString, 0);
|
||||||
RtlAppendUnicodeStringToString(&InfoString, &TempString2);
|
RtlAppendUnicodeStringToString(&InfoString, &TempString2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build the model number string */
|
/* Build the model number string */
|
||||||
RtlInitAnsiString(&TempString, FdoExtension->ModelNumber);
|
RtlInitAnsiString(&TempString, FdoExtension->ModelNumber);
|
||||||
|
|
||||||
/* Convert it to Unicode and append it */
|
/* Convert it to Unicode and append it */
|
||||||
RtlAnsiStringToUnicodeString(&TempString2, &TempString, 0);
|
RtlAnsiStringToUnicodeString(&TempString2, &TempString, 0);
|
||||||
RtlAppendUnicodeStringToString(&InfoString, &TempString2);
|
RtlAppendUnicodeStringToString(&InfoString, &TempString2);
|
||||||
|
|
||||||
/* Return the final appended string */
|
/* Return the final appended string */
|
||||||
QueryData = InfoString.Buffer;
|
QueryData = InfoString.Buffer;
|
||||||
QueryLength = InfoString.Length;
|
QueryLength = InfoString.Length;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
/* Everything else is unknown */
|
/* Everything else is unknown */
|
||||||
Status = STATUS_INVALID_PARAMETER;
|
Status = STATUS_INVALID_PARAMETER;
|
||||||
break;
|
break;
|
||||||
@@ -1203,7 +1203,7 @@ CmBattQueryInformation(IN PCMBATT_DEVICE_EXTENSION FdoExtension,
|
|||||||
|
|
||||||
/* Copy the data if there's enough space and it exists */
|
/* Copy the data if there's enough space and it exists */
|
||||||
if ((NT_SUCCESS(Status)) && (QueryData)) RtlCopyMemory(Buffer, QueryData, QueryLength);
|
if ((NT_SUCCESS(Status)) && (QueryData)) RtlCopyMemory(Buffer, QueryData, QueryLength);
|
||||||
|
|
||||||
/* Return function result */
|
/* Return function result */
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@@ -1218,7 +1218,7 @@ CmBattQueryStatus(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
if (CmBattDebug & (CMBATT_ACPI_WARNING | CMBATT_GENERIC_INFO))
|
if (CmBattDebug & (CMBATT_ACPI_WARNING | CMBATT_GENERIC_INFO))
|
||||||
DbgPrint("CmBattQueryStatus - Tag (%d) Device %x\n", Tag, DeviceExtension->DeviceId);
|
DbgPrint("CmBattQueryStatus - Tag (%d) Device %x\n", Tag, DeviceExtension->DeviceId);
|
||||||
|
|
||||||
/* Query ACPI information */
|
/* Query ACPI information */
|
||||||
Status = CmBattGetBatteryStatus(DeviceExtension, Tag);
|
Status = CmBattGetBatteryStatus(DeviceExtension, Tag);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
@@ -1228,7 +1228,7 @@ CmBattQueryStatus(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
BatteryStatus->Voltage = DeviceExtension->PresentVoltage;
|
BatteryStatus->Voltage = DeviceExtension->PresentVoltage;
|
||||||
BatteryStatus->Rate = DeviceExtension->Rate;
|
BatteryStatus->Rate = DeviceExtension->Rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return status */
|
/* Return status */
|
||||||
if (CmBattDebug & (CMBATT_GENERIC_INFO))
|
if (CmBattDebug & (CMBATT_GENERIC_INFO))
|
||||||
DbgPrint("CmBattQueryStatus: Returning [%#08lx][%#08lx][%#08lx][%#08lx]\n",
|
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.");
|
DbgPrint("CmBatt: Couldn't allocate pool for registry path.");
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Buffer allocated, copy the string */
|
/* Buffer allocated, copy the string */
|
||||||
RtlCopyUnicodeString(&GlobalRegistryPath, RegistryPath);
|
RtlCopyUnicodeString(&GlobalRegistryPath, RegistryPath);
|
||||||
if (CmBattDebug & CMBATT_GENERIC_INFO)
|
if (CmBattDebug & CMBATT_GENERIC_INFO)
|
||||||
DbgPrint("CmBatt DriverEntry - Obj (%08x) Path \"%ws\"\n",
|
DbgPrint("CmBatt DriverEntry - Obj (%08x) Path \"%ws\"\n",
|
||||||
DriverObject,
|
DriverObject,
|
||||||
RegistryPath->Buffer);
|
RegistryPath->Buffer);
|
||||||
|
|
||||||
/* Setup the major dispatchers */
|
/* Setup the major dispatchers */
|
||||||
DriverObject->MajorFunction[IRP_MJ_CREATE] = CmBattOpenClose;
|
DriverObject->MajorFunction[IRP_MJ_CREATE] = CmBattOpenClose;
|
||||||
DriverObject->MajorFunction[IRP_MJ_CLOSE] = CmBattOpenClose;
|
DriverObject->MajorFunction[IRP_MJ_CLOSE] = CmBattOpenClose;
|
||||||
@@ -1280,12 +1280,12 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject,
|
|||||||
|
|
||||||
/* And the unload routine */
|
/* And the unload routine */
|
||||||
DriverObject->DriverUnload = CmBattUnload;
|
DriverObject->DriverUnload = CmBattUnload;
|
||||||
|
|
||||||
/* And the add device routine */
|
/* And the add device routine */
|
||||||
DriverExtension = DriverObject->DriverExtension;
|
DriverExtension = DriverObject->DriverExtension;
|
||||||
DriverExtension->AddDevice = CmBattAddDevice;
|
DriverExtension->AddDevice = CmBattAddDevice;
|
||||||
|
|
||||||
/* Create a power callback */
|
/* Create a power callback */
|
||||||
RtlInitUnicodeString(&CallbackName, L"\\Callback\\PowerState");
|
RtlInitUnicodeString(&CallbackName, L"\\Callback\\PowerState");
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&CallbackName,
|
&CallbackName,
|
||||||
@@ -1318,7 +1318,7 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject,
|
|||||||
if (CmBattDebug & CMBATT_GENERIC_WARNING)
|
if (CmBattDebug & CMBATT_GENERIC_WARNING)
|
||||||
DbgPrint("CmBattRegisterPowerCallBack: ExRegisterCallback failed.\n");
|
DbgPrint("CmBattRegisterPowerCallBack: ExRegisterCallback failed.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* All good */
|
/* All good */
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,13 +15,13 @@
|
|||||||
#include <wdmguid.h>
|
#include <wdmguid.h>
|
||||||
|
|
||||||
#define IOCTL_BATTERY_QUERY_UNIQUE_ID \
|
#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 \
|
#define IOCTL_BATTERY_QUERY_STA \
|
||||||
CTL_CODE(FILE_DEVICE_BATTERY, 0x102, METHOD_BUFFERED, FILE_READ_ACCESS) // 0x294408
|
CTL_CODE(FILE_DEVICE_BATTERY, 0x102, METHOD_BUFFERED, FILE_READ_ACCESS) // 0x294408
|
||||||
|
|
||||||
#define IOCTL_BATTERY_QUERY_PSR \
|
#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 \
|
#define IOCTL_BATTERY_SET_TRIP_POINT \
|
||||||
CTL_CODE(FILE_DEVICE_BATTERY, 0x104, METHOD_BUFFERED, FILE_READ_ACCESS) // 0x294410
|
CTL_CODE(FILE_DEVICE_BATTERY, 0x104, METHOD_BUFFERED, FILE_READ_ACCESS) // 0x294410
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#define IOCTL_BATTERY_QUERY_BST \
|
#define IOCTL_BATTERY_QUERY_BST \
|
||||||
CTL_CODE(FILE_DEVICE_BATTERY, 0x106, METHOD_BUFFERED, FILE_READ_ACCESS) // 0x294418
|
CTL_CODE(FILE_DEVICE_BATTERY, 0x106, METHOD_BUFFERED, FILE_READ_ACCESS) // 0x294418
|
||||||
|
|
||||||
#define CMBATT_GENERIC_STATUS 0x01
|
#define CMBATT_GENERIC_STATUS 0x01
|
||||||
#define CMBATT_GENERIC_INFO 0x02
|
#define CMBATT_GENERIC_INFO 0x02
|
||||||
#define CMBATT_GENERIC_WARNING 0x04
|
#define CMBATT_GENERIC_WARNING 0x04
|
||||||
@@ -246,7 +246,7 @@ CmBattQueryInformation(
|
|||||||
IN ULONG BufferLength,
|
IN ULONG BufferLength,
|
||||||
OUT PULONG ReturnedLength
|
OUT PULONG ReturnedLength
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
CmBattQueryStatus(
|
CmBattQueryStatus(
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ CmBattQueryWmiRegInfo(PDEVICE_OBJECT DeviceObject,
|
|||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
CmBattQueryWmiDataBlock(PDEVICE_OBJECT DeviceObject,
|
CmBattQueryWmiDataBlock(PDEVICE_OBJECT DeviceObject,
|
||||||
@@ -83,7 +83,7 @@ CmBattQueryWmiDataBlock(PDEVICE_OBJECT DeviceObject,
|
|||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
CmBattSetWmiDataBlock(PDEVICE_OBJECT DeviceObject,
|
CmBattSetWmiDataBlock(PDEVICE_OBJECT DeviceObject,
|
||||||
PIRP Irp,
|
PIRP Irp,
|
||||||
ULONG GuidIndex,
|
ULONG GuidIndex,
|
||||||
ULONG InstanceIndex,
|
ULONG InstanceIndex,
|
||||||
ULONG BufferSize,
|
ULONG BufferSize,
|
||||||
@@ -112,10 +112,10 @@ NTAPI
|
|||||||
CmBattWmiDeRegistration(IN PCMBATT_DEVICE_EXTENSION DeviceExtension)
|
CmBattWmiDeRegistration(IN PCMBATT_DEVICE_EXTENSION DeviceExtension)
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* De-register */
|
/* De-register */
|
||||||
return IoWMIRegistrationControl(DeviceExtension->FdoDeviceObject,
|
return IoWMIRegistrationControl(DeviceExtension->FdoDeviceObject,
|
||||||
WMIREG_ACTION_DEREGISTER);
|
WMIREG_ACTION_DEREGISTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
@@ -123,12 +123,12 @@ NTAPI
|
|||||||
CmBattWmiRegistration(IN PCMBATT_DEVICE_EXTENSION DeviceExtension)
|
CmBattWmiRegistration(IN PCMBATT_DEVICE_EXTENSION DeviceExtension)
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* GUID information */
|
/* GUID information */
|
||||||
DeviceExtension->WmiLibInfo.GuidCount = sizeof(CmBattWmiGuidList) /
|
DeviceExtension->WmiLibInfo.GuidCount = sizeof(CmBattWmiGuidList) /
|
||||||
sizeof(WMIGUIDREGINFO);
|
sizeof(WMIGUIDREGINFO);
|
||||||
DeviceExtension->WmiLibInfo.GuidList = CmBattWmiGuidList;
|
DeviceExtension->WmiLibInfo.GuidList = CmBattWmiGuidList;
|
||||||
|
|
||||||
/* Callbacks */
|
/* Callbacks */
|
||||||
DeviceExtension->WmiLibInfo.QueryWmiRegInfo = CmBattQueryWmiRegInfo;
|
DeviceExtension->WmiLibInfo.QueryWmiRegInfo = CmBattQueryWmiRegInfo;
|
||||||
DeviceExtension->WmiLibInfo.QueryWmiDataBlock = CmBattQueryWmiDataBlock;
|
DeviceExtension->WmiLibInfo.QueryWmiDataBlock = CmBattQueryWmiDataBlock;
|
||||||
@@ -136,7 +136,7 @@ CmBattWmiRegistration(IN PCMBATT_DEVICE_EXTENSION DeviceExtension)
|
|||||||
DeviceExtension->WmiLibInfo.SetWmiDataItem = CmBattSetWmiDataItem;
|
DeviceExtension->WmiLibInfo.SetWmiDataItem = CmBattSetWmiDataItem;
|
||||||
DeviceExtension->WmiLibInfo.ExecuteWmiMethod = NULL;
|
DeviceExtension->WmiLibInfo.ExecuteWmiMethod = NULL;
|
||||||
DeviceExtension->WmiLibInfo.WmiFunctionControl = NULL;
|
DeviceExtension->WmiLibInfo.WmiFunctionControl = NULL;
|
||||||
|
|
||||||
/* Register */
|
/* Register */
|
||||||
return IoWMIRegistrationControl(DeviceExtension->FdoDeviceObject,
|
return IoWMIRegistrationControl(DeviceExtension->FdoDeviceObject,
|
||||||
WMIREG_ACTION_REGISTER);
|
WMIREG_ACTION_REGISTER);
|
||||||
@@ -155,7 +155,7 @@ CmBattSystemControl(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
if (CmBattDebug & 2)
|
if (CmBattDebug & 2)
|
||||||
DbgPrint("CmBatt: SystemControl: %s\n",
|
DbgPrint("CmBatt: SystemControl: %s\n",
|
||||||
WMIMinorFunctionString(IoGetCurrentIrpStackLocation(Irp)->MinorFunction));
|
WMIMinorFunctionString(IoGetCurrentIrpStackLocation(Irp)->MinorFunction));
|
||||||
|
|
||||||
/* Acquire the remove lock */
|
/* Acquire the remove lock */
|
||||||
DeviceExtension = DeviceObject->DeviceExtension;
|
DeviceExtension = DeviceObject->DeviceExtension;
|
||||||
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, 0);
|
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, 0);
|
||||||
@@ -166,7 +166,7 @@ CmBattSystemControl(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return STATUS_DEVICE_REMOVED;
|
return STATUS_DEVICE_REMOVED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* What kind of device is this? */
|
/* What kind of device is this? */
|
||||||
WmiLibContext = &DeviceExtension->WmiLibInfo;
|
WmiLibContext = &DeviceExtension->WmiLibInfo;
|
||||||
if (DeviceExtension->FdoType == CmBattBattery)
|
if (DeviceExtension->FdoType == CmBattBattery)
|
||||||
@@ -191,26 +191,26 @@ CmBattSystemControl(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
switch (Disposition)
|
switch (Disposition)
|
||||||
{
|
{
|
||||||
case IrpNotCompleted:
|
case IrpNotCompleted:
|
||||||
|
|
||||||
/* Complete it here */
|
/* Complete it here */
|
||||||
if (CmBattDebug & 2) DbgPrint("CmBatt: SystemControl: Irp Not Completed.\n");
|
if (CmBattDebug & 2) DbgPrint("CmBatt: SystemControl: Irp Not Completed.\n");
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IrpForward:
|
case IrpForward:
|
||||||
|
|
||||||
/* Forward it to ACPI */
|
/* Forward it to ACPI */
|
||||||
if (CmBattDebug & 2) DbgPrint("CmBatt: SystemControl: Irp Forward.\n");
|
if (CmBattDebug & 2) DbgPrint("CmBatt: SystemControl: Irp Forward.\n");
|
||||||
IoSkipCurrentIrpStackLocation(Irp);
|
IoSkipCurrentIrpStackLocation(Irp);
|
||||||
Status = IoCallDriver(DeviceExtension->AttachedDevice, Irp);
|
Status = IoCallDriver(DeviceExtension->AttachedDevice, Irp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IrpProcessed:
|
case IrpProcessed:
|
||||||
|
|
||||||
/* Nothing to do */
|
/* Nothing to do */
|
||||||
if (CmBattDebug & 2) DbgPrint("CmBatt: SystemControl: Irp Processed.\n");
|
if (CmBattDebug & 2) DbgPrint("CmBatt: SystemControl: Irp Processed.\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ASSERT(FALSE);
|
ASSERT(FALSE);
|
||||||
}
|
}
|
||||||
@@ -219,5 +219,5 @@ CmBattSystemControl(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, 0);
|
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, 0);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ GetDwordElement(IN PACPI_METHOD_ARGUMENT Argument,
|
|||||||
OUT PULONG Value)
|
OUT PULONG Value)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
/* Must have an integer */
|
/* Must have an integer */
|
||||||
if (Argument->Type != ACPI_METHOD_ARGUMENT_INTEGER)
|
if (Argument->Type != ACPI_METHOD_ARGUMENT_INTEGER)
|
||||||
{
|
{
|
||||||
@@ -37,7 +37,7 @@ GetDwordElement(IN PACPI_METHOD_ARGUMENT Argument,
|
|||||||
*Value = Argument->Argument;
|
*Value = Argument->Argument;
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return status */
|
/* Return status */
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ GetStringElement(IN PACPI_METHOD_ARGUMENT Argument,
|
|||||||
OUT PCHAR Value)
|
OUT PCHAR Value)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
/* Must have a string of buffer */
|
/* Must have a string of buffer */
|
||||||
if ((Argument->Type == ACPI_METHOD_ARGUMENT_STRING) ||
|
if ((Argument->Type == ACPI_METHOD_ARGUMENT_STRING) ||
|
||||||
(Argument->Type == ACPI_METHOD_ARGUMENT_BUFFER))
|
(Argument->Type == ACPI_METHOD_ARGUMENT_BUFFER))
|
||||||
@@ -75,7 +75,7 @@ GetStringElement(IN PACPI_METHOD_ARGUMENT Argument,
|
|||||||
if (CmBattDebug & 0x4C)
|
if (CmBattDebug & 0x4C)
|
||||||
DbgPrint("GetStringElement: Object contained wrong data type - %d\n", Argument->Type);
|
DbgPrint("GetStringElement: Object contained wrong data type - %d\n", Argument->Type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the status */
|
/* Return the status */
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@ CmBattSendDownStreamIrp(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
|
|
||||||
/* Initialize our wait event */
|
/* Initialize our wait event */
|
||||||
KeInitializeEvent(&Event, SynchronizationEvent, 0);
|
KeInitializeEvent(&Event, SynchronizationEvent, 0);
|
||||||
|
|
||||||
/* Allocate the IRP */
|
/* Allocate the IRP */
|
||||||
Irp = IoBuildDeviceIoControlRequest(IoControlCode,
|
Irp = IoBuildDeviceIoControlRequest(IoControlCode,
|
||||||
DeviceObject,
|
DeviceObject,
|
||||||
@@ -115,7 +115,7 @@ CmBattSendDownStreamIrp(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
DbgPrint("CmBattSendDownStreamIrp: Failed to allocate Irp\n");
|
DbgPrint("CmBattSendDownStreamIrp: Failed to allocate Irp\n");
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call ACPI */
|
/* Call ACPI */
|
||||||
if (CmBattDebug & 0x40)
|
if (CmBattDebug & 0x40)
|
||||||
DbgPrint("CmBattSendDownStreamIrp: Irp %x [Tid] %x\n",
|
DbgPrint("CmBattSendDownStreamIrp: Irp %x [Tid] %x\n",
|
||||||
@@ -131,7 +131,7 @@ CmBattSendDownStreamIrp(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
NULL);
|
NULL);
|
||||||
Status = Irp->IoStatus.Status;
|
Status = Irp->IoStatus.Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if caller wanted output */
|
/* Check if caller wanted output */
|
||||||
if (OutputBuffer)
|
if (OutputBuffer)
|
||||||
{
|
{
|
||||||
@@ -143,7 +143,7 @@ CmBattSendDownStreamIrp(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
Status = STATUS_ACPI_INVALID_DATA;
|
Status = STATUS_ACPI_INVALID_DATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return status */
|
/* Return status */
|
||||||
if (CmBattDebug & 0x40)
|
if (CmBattDebug & 0x40)
|
||||||
DbgPrint("CmBattSendDownStreamIrp: Irp %x completed %x! [Tid] %x\n",
|
DbgPrint("CmBattSendDownStreamIrp: Irp %x completed %x! [Tid] %x\n",
|
||||||
@@ -163,11 +163,11 @@ CmBattGetPsrData(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
if (CmBattDebug & 0x40)
|
if (CmBattDebug & 0x40)
|
||||||
DbgPrint("CmBattGetPsrData: Entered with Pdo %x Tid %x\n",
|
DbgPrint("CmBattGetPsrData: Entered with Pdo %x Tid %x\n",
|
||||||
DeviceObject, KeGetCurrentThread());
|
DeviceObject, KeGetCurrentThread());
|
||||||
|
|
||||||
/* Initialize to zero */
|
/* Initialize to zero */
|
||||||
ASSERT(PsrData != NULL);
|
ASSERT(PsrData != NULL);
|
||||||
*PsrData = 0;
|
*PsrData = 0;
|
||||||
|
|
||||||
/* Request the _PSR method */
|
/* Request the _PSR method */
|
||||||
*(PULONG)InputBuffer.MethodName = 'RSP_';
|
*(PULONG)InputBuffer.MethodName = 'RSP_';
|
||||||
InputBuffer.Signature = ACPI_EVAL_INPUT_BUFFER_SIGNATURE;
|
InputBuffer.Signature = ACPI_EVAL_INPUT_BUFFER_SIGNATURE;
|
||||||
@@ -191,7 +191,7 @@ CmBattGetPsrData(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
/* Failure */
|
/* Failure */
|
||||||
DbgPrint("CmBattGetPsrData: Failed _PSR method - Status (0x%x)\n", Status);
|
DbgPrint("CmBattGetPsrData: Failed _PSR method - Status (0x%x)\n", Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return status */
|
/* Return status */
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@@ -208,11 +208,11 @@ CmBattGetStaData(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
if (CmBattDebug & 0x40)
|
if (CmBattDebug & 0x40)
|
||||||
DbgPrint("CmBattGetStaData: Entered with Pdo %x Tid %x\n",
|
DbgPrint("CmBattGetStaData: Entered with Pdo %x Tid %x\n",
|
||||||
DeviceObject, KeGetCurrentThread());
|
DeviceObject, KeGetCurrentThread());
|
||||||
|
|
||||||
/* Initialize to zero */
|
/* Initialize to zero */
|
||||||
ASSERT(StaData != NULL);
|
ASSERT(StaData != NULL);
|
||||||
*StaData = 0;
|
*StaData = 0;
|
||||||
|
|
||||||
/* Request the _PSR method */
|
/* Request the _PSR method */
|
||||||
*(PULONG)InputBuffer.MethodName = 'ATS_';
|
*(PULONG)InputBuffer.MethodName = 'ATS_';
|
||||||
InputBuffer.Signature = ACPI_EVAL_INPUT_BUFFER_SIGNATURE;
|
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);
|
DbgPrint("CmBattGetStaData: Failed _STA method - Status (0x%x)\n", Status);
|
||||||
Status = STATUS_NO_SUCH_DEVICE;
|
Status = STATUS_NO_SUCH_DEVICE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return status */
|
/* Return status */
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@@ -254,11 +254,11 @@ CmBattGetUniqueId(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
if (CmBattDebug & 0x40)
|
if (CmBattDebug & 0x40)
|
||||||
DbgPrint("CmBattGetUniqueId: Entered with Pdo %x Tid %x\n",
|
DbgPrint("CmBattGetUniqueId: Entered with Pdo %x Tid %x\n",
|
||||||
DeviceObject, KeGetCurrentThread());
|
DeviceObject, KeGetCurrentThread());
|
||||||
|
|
||||||
/* Initialize to zero */
|
/* Initialize to zero */
|
||||||
ASSERT(UniqueId != NULL);
|
ASSERT(UniqueId != NULL);
|
||||||
*UniqueId = 0;
|
*UniqueId = 0;
|
||||||
|
|
||||||
/* Request the _PSR method */
|
/* Request the _PSR method */
|
||||||
*(PULONG)InputBuffer.MethodName = 'DIU_';
|
*(PULONG)InputBuffer.MethodName = 'DIU_';
|
||||||
InputBuffer.Signature = ACPI_EVAL_INPUT_BUFFER_SIGNATURE;
|
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);
|
DbgPrint("CmBattGetUniqueId: Failed _UID method - Status (0x%x)\n", Status);
|
||||||
Status = STATUS_NO_SUCH_DEVICE;
|
Status = STATUS_NO_SUCH_DEVICE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return status */
|
/* Return status */
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@@ -299,7 +299,7 @@ CmBattSetTripPpoint(IN PCMBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
if (CmBattDebug & 0x440)
|
if (CmBattDebug & 0x440)
|
||||||
DbgPrint("CmBattSetTripPpoint: _BTP Alarm Value %x Device %x Tid %x\n",
|
DbgPrint("CmBattSetTripPpoint: _BTP Alarm Value %x Device %x Tid %x\n",
|
||||||
AlarmValue, DeviceExtension->DeviceId, KeGetCurrentThread);
|
AlarmValue, DeviceExtension->DeviceId, KeGetCurrentThread);
|
||||||
|
|
||||||
/* Request the _BTP method */
|
/* Request the _BTP method */
|
||||||
*(PULONG)InputBuffer.MethodName = 'PTB_';
|
*(PULONG)InputBuffer.MethodName = 'PTB_';
|
||||||
InputBuffer.Signature = ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_SIGNATURE;
|
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))
|
if (!(NT_SUCCESS(Status)) && (CmBattDebug & 0x440))
|
||||||
DbgPrint("CmBattSetTripPpoint: Failed _BTP method on device %x - Status (0x%x)\n",
|
DbgPrint("CmBattSetTripPpoint: Failed _BTP method on device %x - Status (0x%x)\n",
|
||||||
DeviceExtension->DeviceId, Status);
|
DeviceExtension->DeviceId, Status);
|
||||||
|
|
||||||
/* Return status */
|
/* Return status */
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,12 +25,12 @@ CompBattOpenClose(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
if (CompBattDebug & 0x100) DbgPrint("CompBatt: ENTERING OpenClose\n");
|
if (CompBattDebug & 0x100) DbgPrint("CompBatt: ENTERING OpenClose\n");
|
||||||
|
|
||||||
/* Complete the IRP with success */
|
/* Complete the IRP with success */
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
|
||||||
/* Return success */
|
/* Return success */
|
||||||
if (CompBattDebug & 0x100) DbgPrint("CompBatt: Exiting OpenClose\n");
|
if (CompBattDebug & 0x100) DbgPrint("CompBatt: Exiting OpenClose\n");
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
@@ -45,7 +45,7 @@ CompBattSystemControl(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING System Control\n");
|
if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING System Control\n");
|
||||||
|
|
||||||
/* Are we attached yet? */
|
/* Are we attached yet? */
|
||||||
if (DeviceExtension->AttachedDevice)
|
if (DeviceExtension->AttachedDevice)
|
||||||
{
|
{
|
||||||
@@ -60,7 +60,7 @@ CompBattSystemControl(IN PDEVICE_OBJECT DeviceObject,
|
|||||||
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
|
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return status */
|
/* Return status */
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@@ -109,13 +109,13 @@ CompBattRecalculateTag(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
|
|||||||
DeviceExtension->NextTag = Tag + 1;
|
DeviceExtension->NextTag = Tag + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No tag for this device extension, clear it */
|
/* No tag for this device extension, clear it */
|
||||||
DeviceExtension->Tag = 0;
|
DeviceExtension->Tag = 0;
|
||||||
NextEntry = NextEntry->Flink;
|
NextEntry = NextEntry->Flink;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We're done */
|
/* We're done */
|
||||||
ExReleaseFastMutex(&DeviceExtension->Lock);
|
ExReleaseFastMutex(&DeviceExtension->Lock);
|
||||||
if (CompBattDebug & 0x100) DbgPrint("CompBatt: EXITING CompBattRecalculateTag\n");
|
if (CompBattDebug & 0x100) DbgPrint("CompBatt: EXITING CompBattRecalculateTag\n");
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ CompBattQueryTag(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
/* Assign one */
|
/* Assign one */
|
||||||
CompBattRecalculateTag(DeviceExtension);
|
CompBattRecalculateTag(DeviceExtension);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do we have a tag now? */
|
/* Do we have a tag now? */
|
||||||
if ((DeviceExtension->Flags & COMPBATT_TAG_ASSIGNED) && (DeviceExtension->Tag))
|
if ((DeviceExtension->Flags & COMPBATT_TAG_ASSIGNED) && (DeviceExtension->Tag))
|
||||||
{
|
{
|
||||||
@@ -173,7 +173,7 @@ CompBattQueryTag(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
*Tag = 0;
|
*Tag = 0;
|
||||||
Status = STATUS_NO_SUCH_DEVICE;
|
Status = STATUS_NO_SUCH_DEVICE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return status */
|
/* Return status */
|
||||||
if (CompBattDebug & 0x100) DbgPrint("CompBatt: EXITING QueryTag\n");
|
if (CompBattDebug & 0x100) DbgPrint("CompBatt: EXITING QueryTag\n");
|
||||||
return Status;
|
return Status;
|
||||||
@@ -236,12 +236,12 @@ CompBattGetBatteryInformation(OUT PBATTERY_INFORMATION BatteryInfo,
|
|||||||
PCOMPBATT_BATTERY_DATA BatteryData;
|
PCOMPBATT_BATTERY_DATA BatteryData;
|
||||||
PLIST_ENTRY ListHead, NextEntry;
|
PLIST_ENTRY ListHead, NextEntry;
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING GetBatteryInformation\n");
|
if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING GetBatteryInformation\n");
|
||||||
|
|
||||||
/* Set defaults */
|
/* Set defaults */
|
||||||
BatteryInfo->DefaultAlert1 = 0;
|
BatteryInfo->DefaultAlert1 = 0;
|
||||||
BatteryInfo->DefaultAlert2 = 0;
|
BatteryInfo->DefaultAlert2 = 0;
|
||||||
BatteryInfo->CriticalBias = 0;
|
BatteryInfo->CriticalBias = 0;
|
||||||
|
|
||||||
/* Loop the battery list */
|
/* Loop the battery list */
|
||||||
ExAcquireFastMutex(&DeviceExtension->Lock);
|
ExAcquireFastMutex(&DeviceExtension->Lock);
|
||||||
ListHead = &DeviceExtension->BatteryList;
|
ListHead = &DeviceExtension->BatteryList;
|
||||||
@@ -254,12 +254,12 @@ CompBattGetBatteryInformation(OUT PBATTERY_INFORMATION BatteryInfo,
|
|||||||
{
|
{
|
||||||
/* Now release the device lock since the battery can't go away */
|
/* Now release the device lock since the battery can't go away */
|
||||||
ExReleaseFastMutex(&DeviceExtension->Lock);
|
ExReleaseFastMutex(&DeviceExtension->Lock);
|
||||||
|
|
||||||
/* Build the query */
|
/* Build the query */
|
||||||
InputBuffer.BatteryTag = BatteryData->Tag;
|
InputBuffer.BatteryTag = BatteryData->Tag;
|
||||||
InputBuffer.InformationLevel = BatteryInformation;
|
InputBuffer.InformationLevel = BatteryInformation;
|
||||||
InputBuffer.AtRate = 0;
|
InputBuffer.AtRate = 0;
|
||||||
|
|
||||||
/* Make sure the battery has a tag */
|
/* Make sure the battery has a tag */
|
||||||
if (BatteryData->Tag)
|
if (BatteryData->Tag)
|
||||||
{
|
{
|
||||||
@@ -284,7 +284,7 @@ CompBattGetBatteryInformation(OUT PBATTERY_INFORMATION BatteryInfo,
|
|||||||
IoReleaseRemoveLock(&BatteryData->RemoveLock, 0);
|
IoReleaseRemoveLock(&BatteryData->RemoveLock, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Next time we can use the static copy */
|
/* Next time we can use the static copy */
|
||||||
BatteryData->Flags |= COMPBATT_BATTERY_INFORMATION_PRESENT;
|
BatteryData->Flags |= COMPBATT_BATTERY_INFORMATION_PRESENT;
|
||||||
if (CompBattDebug & 2)
|
if (CompBattDebug & 2)
|
||||||
@@ -307,7 +307,7 @@ CompBattGetBatteryInformation(OUT PBATTERY_INFORMATION BatteryInfo,
|
|||||||
|
|
||||||
/* Combine capabilities */
|
/* Combine capabilities */
|
||||||
BatteryInfo->Capabilities |= BatteryData->BatteryInformation.Capabilities;
|
BatteryInfo->Capabilities |= BatteryData->BatteryInformation.Capabilities;
|
||||||
|
|
||||||
/* Add-on capacity */
|
/* Add-on capacity */
|
||||||
if (BatteryData->BatteryInformation.DesignedCapacity != BATTERY_UNKNOWN_CAPACITY)
|
if (BatteryData->BatteryInformation.DesignedCapacity != BATTERY_UNKNOWN_CAPACITY)
|
||||||
{
|
{
|
||||||
@@ -319,7 +319,7 @@ CompBattGetBatteryInformation(OUT PBATTERY_INFORMATION BatteryInfo,
|
|||||||
{
|
{
|
||||||
BatteryInfo->FullChargedCapacity += BatteryData->BatteryInformation.FullChargedCapacity;
|
BatteryInfo->FullChargedCapacity += BatteryData->BatteryInformation.FullChargedCapacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Choose the highest alert */
|
/* Choose the highest alert */
|
||||||
BatteryInfo->DefaultAlert1 = max(BatteryInfo->DefaultAlert1,
|
BatteryInfo->DefaultAlert1 = max(BatteryInfo->DefaultAlert1,
|
||||||
BatteryData->BatteryInformation.DefaultAlert1);
|
BatteryData->BatteryInformation.DefaultAlert1);
|
||||||
@@ -327,22 +327,22 @@ CompBattGetBatteryInformation(OUT PBATTERY_INFORMATION BatteryInfo,
|
|||||||
/* Choose the highest alert */
|
/* Choose the highest alert */
|
||||||
BatteryInfo->DefaultAlert2 = max(BatteryInfo->DefaultAlert2,
|
BatteryInfo->DefaultAlert2 = max(BatteryInfo->DefaultAlert2,
|
||||||
BatteryData->BatteryInformation.DefaultAlert2);
|
BatteryData->BatteryInformation.DefaultAlert2);
|
||||||
|
|
||||||
/* Choose the highest critical bias */
|
/* Choose the highest critical bias */
|
||||||
BatteryInfo->CriticalBias = max(BatteryInfo->CriticalBias,
|
BatteryInfo->CriticalBias = max(BatteryInfo->CriticalBias,
|
||||||
BatteryData->BatteryInformation.CriticalBias);
|
BatteryData->BatteryInformation.CriticalBias);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Re-acquire the device extension lock and release the remove lock */
|
/* Re-acquire the device extension lock and release the remove lock */
|
||||||
ExAcquireFastMutex(&DeviceExtension->Lock);
|
ExAcquireFastMutex(&DeviceExtension->Lock);
|
||||||
IoReleaseRemoveLock(&BatteryData->RemoveLock, 0);
|
IoReleaseRemoveLock(&BatteryData->RemoveLock, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Next entry */
|
/* Next entry */
|
||||||
NextEntry = NextEntry->Flink;
|
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);
|
ExReleaseFastMutex(&DeviceExtension->Lock);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
@@ -351,7 +351,7 @@ CompBattGetBatteryInformation(OUT PBATTERY_INFORMATION BatteryInfo,
|
|||||||
{
|
{
|
||||||
BatteryInfo->FullChargedCapacity = BatteryInfo->DesignedCapacity;
|
BatteryInfo->FullChargedCapacity = BatteryInfo->DesignedCapacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print out final combined data */
|
/* Print out final combined data */
|
||||||
if (CompBattDebug & 2)
|
if (CompBattDebug & 2)
|
||||||
DbgPrint("CompBattGetBatteryInformation: Returning BATTERY_INFORMATION\n"
|
DbgPrint("CompBattGetBatteryInformation: Returning BATTERY_INFORMATION\n"
|
||||||
@@ -369,14 +369,14 @@ CompBattGetBatteryInformation(OUT PBATTERY_INFORMATION BatteryInfo,
|
|||||||
BatteryInfo->DefaultAlert2,
|
BatteryInfo->DefaultAlert2,
|
||||||
BatteryInfo->CriticalBias,
|
BatteryInfo->CriticalBias,
|
||||||
BatteryInfo->CycleCount);
|
BatteryInfo->CycleCount);
|
||||||
|
|
||||||
/* Copy the data into the device extension */
|
/* Copy the data into the device extension */
|
||||||
RtlCopyMemory(&DeviceExtension->BatteryInformation,
|
RtlCopyMemory(&DeviceExtension->BatteryInformation,
|
||||||
BatteryInfo,
|
BatteryInfo,
|
||||||
sizeof(DeviceExtension->BatteryInformation));
|
sizeof(DeviceExtension->BatteryInformation));
|
||||||
DeviceExtension->Flags |= COMPBATT_BATTERY_INFORMATION_PRESENT;
|
DeviceExtension->Flags |= COMPBATT_BATTERY_INFORMATION_PRESENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We are done */
|
/* We are done */
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING GetBatteryInformation\n");
|
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING GetBatteryInformation\n");
|
||||||
return Status;
|
return Status;
|
||||||
@@ -394,13 +394,13 @@ CompBattGetBatteryGranularity(OUT PBATTERY_REPORTING_SCALE ReportingScale,
|
|||||||
PLIST_ENTRY ListHead, NextEntry;
|
PLIST_ENTRY ListHead, NextEntry;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING GetBatteryGranularity\n");
|
if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING GetBatteryGranularity\n");
|
||||||
|
|
||||||
/* Set defaults */
|
/* Set defaults */
|
||||||
ReportingScale[0].Granularity = -1;
|
ReportingScale[0].Granularity = -1;
|
||||||
ReportingScale[1].Granularity = -1;
|
ReportingScale[1].Granularity = -1;
|
||||||
ReportingScale[2].Granularity = -1;
|
ReportingScale[2].Granularity = -1;
|
||||||
ReportingScale[3].Granularity = -1;
|
ReportingScale[3].Granularity = -1;
|
||||||
|
|
||||||
/* Loop the battery list */
|
/* Loop the battery list */
|
||||||
ExAcquireFastMutex(&DeviceExtension->Lock);
|
ExAcquireFastMutex(&DeviceExtension->Lock);
|
||||||
ListHead = &DeviceExtension->BatteryList;
|
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 */
|
/* Now release the device lock since the battery can't go away */
|
||||||
ExReleaseFastMutex(&DeviceExtension->Lock);
|
ExReleaseFastMutex(&DeviceExtension->Lock);
|
||||||
|
|
||||||
/* Build the query */
|
/* Build the query */
|
||||||
InputBuffer.BatteryTag = BatteryData->Tag;
|
InputBuffer.BatteryTag = BatteryData->Tag;
|
||||||
InputBuffer.InformationLevel = BatteryGranularityInformation;
|
InputBuffer.InformationLevel = BatteryGranularityInformation;
|
||||||
|
|
||||||
/* Make sure the battery has a tag */
|
/* Make sure the battery has a tag */
|
||||||
if (BatteryData->Tag)
|
if (BatteryData->Tag)
|
||||||
{
|
{
|
||||||
@@ -438,7 +438,7 @@ CompBattGetBatteryGranularity(OUT PBATTERY_REPORTING_SCALE ReportingScale,
|
|||||||
IoReleaseRemoveLock(&BatteryData->RemoveLock, 0);
|
IoReleaseRemoveLock(&BatteryData->RemoveLock, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Loop all 4 scales */
|
/* Loop all 4 scales */
|
||||||
for (i = 0; i < 4; i++)
|
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 = min(BatteryScale[i].Granularity,
|
||||||
ReportingScale[i].Granularity);
|
ReportingScale[i].Granularity);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Re-acquire the device extension lock and release the remove lock */
|
/* Re-acquire the device extension lock and release the remove lock */
|
||||||
ExAcquireFastMutex(&DeviceExtension->Lock);
|
ExAcquireFastMutex(&DeviceExtension->Lock);
|
||||||
IoReleaseRemoveLock(&BatteryData->RemoveLock, 0);
|
IoReleaseRemoveLock(&BatteryData->RemoveLock, 0);
|
||||||
@@ -461,7 +461,7 @@ CompBattGetBatteryGranularity(OUT PBATTERY_REPORTING_SCALE ReportingScale,
|
|||||||
/* Next entry */
|
/* Next entry */
|
||||||
NextEntry = NextEntry->Flink;
|
NextEntry = NextEntry->Flink;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* All done */
|
/* All done */
|
||||||
ExReleaseFastMutex(&DeviceExtension->Lock);
|
ExReleaseFastMutex(&DeviceExtension->Lock);
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING GetBatteryGranularity\n");
|
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING GetBatteryGranularity\n");
|
||||||
@@ -476,7 +476,7 @@ CompBattGetEstimatedTime(OUT PULONG Time,
|
|||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
CompBattQueryInformation(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
|
CompBattQueryInformation(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
|
||||||
@@ -505,12 +505,12 @@ CompBattQueryInformation(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
/* Not right, so fail */
|
/* Not right, so fail */
|
||||||
return STATUS_NO_SUCH_DEVICE;
|
return STATUS_NO_SUCH_DEVICE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check what caller wants */
|
/* Check what caller wants */
|
||||||
switch (InfoLevel)
|
switch (InfoLevel)
|
||||||
{
|
{
|
||||||
case BatteryInformation:
|
case BatteryInformation:
|
||||||
|
|
||||||
/* Query combined battery information */
|
/* Query combined battery information */
|
||||||
RtlZeroMemory(&BatteryInfo, sizeof(BatteryInfo));
|
RtlZeroMemory(&BatteryInfo, sizeof(BatteryInfo));
|
||||||
Status = CompBattGetBatteryInformation(&BatteryInfo, DeviceExtension);
|
Status = CompBattGetBatteryInformation(&BatteryInfo, DeviceExtension);
|
||||||
@@ -521,7 +521,7 @@ CompBattQueryInformation(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
QueryLength = sizeof(BatteryInfo);
|
QueryLength = sizeof(BatteryInfo);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BatteryGranularityInformation:
|
case BatteryGranularityInformation:
|
||||||
|
|
||||||
/* Query combined granularity information */
|
/* Query combined granularity information */
|
||||||
@@ -534,9 +534,9 @@ CompBattQueryInformation(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
QueryData = &BatteryGranularity;
|
QueryData = &BatteryGranularity;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BatteryEstimatedTime:
|
case BatteryEstimatedTime:
|
||||||
|
|
||||||
/* Query combined time estimate information */
|
/* Query combined time estimate information */
|
||||||
RtlZeroMemory(&Time, sizeof(Time));
|
RtlZeroMemory(&Time, sizeof(Time));
|
||||||
Status = CompBattGetEstimatedTime(&Time, DeviceExtension);
|
Status = CompBattGetEstimatedTime(&Time, DeviceExtension);
|
||||||
@@ -544,20 +544,20 @@ CompBattQueryInformation(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
{
|
{
|
||||||
/* Return the data if successful */
|
/* Return the data if successful */
|
||||||
QueryLength = sizeof(Time);
|
QueryLength = sizeof(Time);
|
||||||
QueryData = &Time;
|
QueryData = &Time;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BatteryManufactureName:
|
case BatteryManufactureName:
|
||||||
case BatteryDeviceName:
|
case BatteryDeviceName:
|
||||||
|
|
||||||
/* Return the static buffer */
|
/* Return the static buffer */
|
||||||
QueryData = BatteryName;
|
QueryData = BatteryName;
|
||||||
QueryLength = sizeof(L"Composite Battery");
|
QueryLength = sizeof(L"Composite Battery");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BatteryManufactureDate:
|
case BatteryManufactureDate:
|
||||||
|
|
||||||
/* Static data */
|
/* Static data */
|
||||||
//Date.Day = 26;
|
//Date.Day = 26;
|
||||||
//Date.Month = 06;
|
//Date.Month = 06;
|
||||||
@@ -572,7 +572,7 @@ CompBattQueryInformation(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
|
|||||||
QueryData = &Dummy;
|
QueryData = &Dummy;
|
||||||
QueryLength = sizeof(Dummy);
|
QueryLength = sizeof(Dummy);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* Everything else is unknown */
|
/* Everything else is unknown */
|
||||||
Status = STATUS_INVALID_PARAMETER;
|
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 */
|
/* Copy the data if there's enough space and it exists */
|
||||||
if ((NT_SUCCESS(Status)) && (QueryData)) RtlCopyMemory(Buffer, QueryData, QueryLength);
|
if ((NT_SUCCESS(Status)) && (QueryData)) RtlCopyMemory(Buffer, QueryData, QueryLength);
|
||||||
|
|
||||||
/* Return function result */
|
/* Return function result */
|
||||||
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING QueryInformation\n");
|
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING QueryInformation\n");
|
||||||
return Status;
|
return Status;
|
||||||
@@ -598,7 +598,7 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject,
|
|||||||
{
|
{
|
||||||
/* Register add device routine */
|
/* Register add device routine */
|
||||||
DriverObject->DriverExtension->AddDevice = CompBattAddDevice;
|
DriverObject->DriverExtension->AddDevice = CompBattAddDevice;
|
||||||
|
|
||||||
/* Register other handlers */
|
/* Register other handlers */
|
||||||
DriverObject->MajorFunction[IRP_MJ_CREATE] = CompBattOpenClose;
|
DriverObject->MajorFunction[IRP_MJ_CREATE] = CompBattOpenClose;
|
||||||
DriverObject->MajorFunction[IRP_MJ_CLOSE] = CompBattOpenClose;
|
DriverObject->MajorFunction[IRP_MJ_CLOSE] = CompBattOpenClose;
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ CompBattQueryInformation(
|
|||||||
IN ULONG BufferLength,
|
IN ULONG BufferLength,
|
||||||
OUT PULONG ReturnedLength
|
OUT PULONG ReturnedLength
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
CompBattQueryStatus(
|
CompBattQueryStatus(
|
||||||
@@ -144,7 +144,7 @@ CompBattGetDeviceObjectPointer(
|
|||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
BatteryIoctl(
|
BatteryIoctl(
|
||||||
IN ULONG IoControlCode,
|
IN ULONG IoControlCode,
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN PVOID InputBuffer,
|
IN PVOID InputBuffer,
|
||||||
IN ULONG InputBufferLength,
|
IN ULONG InputBufferLength,
|
||||||
|
|||||||
@@ -250,6 +250,6 @@ Bus_PDO_EvalMethod(PPDO_DEVICE_DATA DeviceData,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
DPRINT1("Query method %4s failed on %p\n", EvalInputBuff->MethodName, DeviceData->AcpiHandle);
|
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 acpi_device_power_state {
|
||||||
struct {
|
struct {
|
||||||
UINT8 valid:1;
|
UINT8 valid:1;
|
||||||
UINT8 explicit_set:1; /* _PSx present? */
|
UINT8 explicit_set:1; /* _PSx present? */
|
||||||
UINT8 reserved:6;
|
UINT8 reserved:6;
|
||||||
} flags;
|
} flags;
|
||||||
@@ -227,7 +227,7 @@ struct acpi_device_perf_flags {
|
|||||||
|
|
||||||
struct acpi_device_perf_state {
|
struct acpi_device_perf_state {
|
||||||
struct {
|
struct {
|
||||||
UINT8 valid:1;
|
UINT8 valid:1;
|
||||||
UINT8 reserved:7;
|
UINT8 reserved:7;
|
||||||
} flags;
|
} flags;
|
||||||
UINT8 power; /* % Power (compared to P0) */
|
UINT8 power; /* % Power (compared to P0) */
|
||||||
|
|||||||
@@ -87,7 +87,7 @@
|
|||||||
#define ACPI_BUTTON_NOTIFY_STATUS 0x80
|
#define ACPI_BUTTON_NOTIFY_STATUS 0x80
|
||||||
|
|
||||||
#define ACPI_BUTTON_SUBCLASS_POWER "power"
|
#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_HID_POWERF "ACPI_FPB"
|
||||||
#define ACPI_BUTTON_DEVICE_NAME_POWER "Power Button (CM)"
|
#define ACPI_BUTTON_DEVICE_NAME_POWER "Power Button (CM)"
|
||||||
#define ACPI_BUTTON_DEVICE_NAME_POWERF "Power Button (FF)"
|
#define ACPI_BUTTON_DEVICE_NAME_POWERF "Power Button (FF)"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#ifndef _LINUX_LIST_H
|
#ifndef _LINUX_LIST_H
|
||||||
#define _LINUX_LIST_H
|
#define _LINUX_LIST_H
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Simple doubly linked list implementation.
|
* Simple doubly linked list implementation.
|
||||||
@@ -11,23 +11,23 @@
|
|||||||
* generate better code by using them directly rather than
|
* generate better code by using them directly rather than
|
||||||
* using the generic single-entry routines.
|
* using the generic single-entry routines.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct list_head {
|
struct list_head {
|
||||||
struct list_head *next, *prev;
|
struct list_head *next, *prev;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LIST_HEAD_INIT(name) { &(name), &(name) }
|
#define LIST_HEAD_INIT(name) { &(name), &(name) }
|
||||||
|
|
||||||
#define LIST_HEAD(name) \
|
#define LIST_HEAD(name) \
|
||||||
struct list_head name = LIST_HEAD_INIT(name)
|
struct list_head name = LIST_HEAD_INIT(name)
|
||||||
|
|
||||||
#define INIT_LIST_HEAD(ptr) do { \
|
#define INIT_LIST_HEAD(ptr) do { \
|
||||||
(ptr)->next = (ptr); (ptr)->prev = (ptr); \
|
(ptr)->next = (ptr); (ptr)->prev = (ptr); \
|
||||||
} while (0)
|
} 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
|
* This is only for internal list manipulation where we know
|
||||||
* the prev/next entries already!
|
* the prev/next entries already!
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
new->prev = prev;
|
new->prev = prev;
|
||||||
prev->next = new;
|
prev->next = new;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* list_add - add a new entry
|
* list_add - add a new entry
|
||||||
* @new: new entry to be added
|
* @new: new entry to be added
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
{
|
{
|
||||||
__list_add(new, head, head->next);
|
__list_add(new, head, head->next);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* list_add_tail - add a new entry
|
* list_add_tail - add a new entry
|
||||||
* @new: new entry to be added
|
* @new: new entry to be added
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
{
|
{
|
||||||
__list_add(new, head->prev, head);
|
__list_add(new, head->prev, head);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Delete a list entry by making the prev/next entries
|
* Delete a list entry by making the prev/next entries
|
||||||
* point to each other.
|
* point to each other.
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
next->prev = prev;
|
next->prev = prev;
|
||||||
prev->next = next;
|
prev->next = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* list_del - deletes entry from list.
|
* list_del - deletes entry from list.
|
||||||
* @entry: the element to delete from the list.
|
* @entry: the element to delete from the list.
|
||||||
@@ -92,7 +92,7 @@
|
|||||||
entry->next = (void *) 0;
|
entry->next = (void *) 0;
|
||||||
entry->prev = (void *) 0;
|
entry->prev = (void *) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* list_del_init - deletes entry from list and reinitialize it.
|
* list_del_init - deletes entry from list and reinitialize it.
|
||||||
* @entry: the element to delete from the list.
|
* @entry: the element to delete from the list.
|
||||||
@@ -100,9 +100,9 @@
|
|||||||
static inline void list_del_init(struct list_head *entry)
|
static inline void list_del_init(struct list_head *entry)
|
||||||
{
|
{
|
||||||
__list_del(entry->prev, entry->next);
|
__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_move - delete from one list and add as another's head
|
||||||
* @list: the entry to move
|
* @list: the entry to move
|
||||||
@@ -113,7 +113,7 @@
|
|||||||
__list_del(list->prev, list->next);
|
__list_del(list->prev, list->next);
|
||||||
list_add(list, head);
|
list_add(list, head);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* list_move_tail - delete from one list and add as another's tail
|
* list_move_tail - delete from one list and add as another's tail
|
||||||
* @list: the entry to move
|
* @list: the entry to move
|
||||||
@@ -125,7 +125,7 @@
|
|||||||
__list_del(list->prev, list->next);
|
__list_del(list->prev, list->next);
|
||||||
list_add_tail(list, head);
|
list_add_tail(list, head);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* list_empty - tests whether a list is empty
|
* list_empty - tests whether a list is empty
|
||||||
* @head: the list to test.
|
* @head: the list to test.
|
||||||
@@ -134,21 +134,21 @@
|
|||||||
{
|
{
|
||||||
return head->next == head;
|
return head->next == head;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void __list_splice(struct list_head *list,
|
static inline void __list_splice(struct list_head *list,
|
||||||
struct list_head *head)
|
struct list_head *head)
|
||||||
{
|
{
|
||||||
struct list_head *first = list->next;
|
struct list_head *first = list->next;
|
||||||
struct list_head *last = list->prev;
|
struct list_head *last = list->prev;
|
||||||
struct list_head *at = head->next;
|
struct list_head *at = head->next;
|
||||||
|
|
||||||
first->prev = head;
|
first->prev = head;
|
||||||
head->next = first;
|
head->next = first;
|
||||||
|
|
||||||
last->next = at;
|
last->next = at;
|
||||||
at->prev = last;
|
at->prev = last;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* list_splice - join two lists
|
* list_splice - join two lists
|
||||||
* @list: the new list to add.
|
* @list: the new list to add.
|
||||||
@@ -159,7 +159,7 @@
|
|||||||
if (!list_empty(list))
|
if (!list_empty(list))
|
||||||
__list_splice(list, head);
|
__list_splice(list, head);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* list_splice_init - join two lists and reinitialise the emptied list.
|
* list_splice_init - join two lists and reinitialise the emptied list.
|
||||||
* @list: the new list to add.
|
* @list: the new list to add.
|
||||||
@@ -175,7 +175,7 @@
|
|||||||
INIT_LIST_HEAD(list);
|
INIT_LIST_HEAD(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* list_entry - get the struct for this entry
|
* list_entry - get the struct for this entry
|
||||||
* @ptr: the &struct list_head pointer.
|
* @ptr: the &struct list_head pointer.
|
||||||
@@ -184,7 +184,7 @@
|
|||||||
*/
|
*/
|
||||||
#define list_entry(ptr, type, member) \
|
#define list_entry(ptr, type, member) \
|
||||||
((type *)((char *)(ptr)-(uintptr_t)(&((type *)0)->member)))
|
((type *)((char *)(ptr)-(uintptr_t)(&((type *)0)->member)))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* list_for_each - iterate over a list
|
* list_for_each - iterate over a list
|
||||||
* @pos: the &struct list_head to use as a loop counter.
|
* @pos: the &struct list_head to use as a loop counter.
|
||||||
@@ -201,7 +201,7 @@
|
|||||||
#define list_for_each_prev(pos, head) \
|
#define list_for_each_prev(pos, head) \
|
||||||
for (pos = (head)->prev; pos != (head); \
|
for (pos = (head)->prev; pos != (head); \
|
||||||
pos = pos->prev)
|
pos = pos->prev)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* list_for_each_safe - iterate over a list safe against removal of list entry
|
* 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.
|
* @pos: the &struct list_head to use as a loop counter.
|
||||||
@@ -211,7 +211,7 @@
|
|||||||
#define list_for_each_safe(pos, n, head) \
|
#define list_for_each_safe(pos, n, head) \
|
||||||
for (pos = (head)->next, n = pos->next; pos != (head); \
|
for (pos = (head)->next, n = pos->next; pos != (head); \
|
||||||
pos = n, n = pos->next)
|
pos = n, n = pos->next)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* list_for_each_entry - iterate over list of given type
|
* list_for_each_entry - iterate over list of given type
|
||||||
* @pos: the type * to use as a loop counter.
|
* @pos: the type * to use as a loop counter.
|
||||||
@@ -222,7 +222,7 @@
|
|||||||
for (pos = list_entry((head)->next, typeof(*pos), member); \
|
for (pos = list_entry((head)->next, typeof(*pos), member); \
|
||||||
&pos->member != (head); \
|
&pos->member != (head); \
|
||||||
pos = list_entry(pos->member.next, typeof(*pos), member))
|
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
|
* 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.
|
* @pos: the type * to use as a loop counter.
|
||||||
@@ -235,7 +235,7 @@
|
|||||||
n = list_entry(pos->member.next, typeof(*pos), member); \
|
n = list_entry(pos->member.next, typeof(*pos), member); \
|
||||||
&pos->member != (head); \
|
&pos->member != (head); \
|
||||||
pos = n, n = list_entry(n->member.next, typeof(*n), member))
|
pos = n, n = list_entry(n->member.next, typeof(*n), member))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* list_for_each_entry_continue - iterate over list of given type
|
* list_for_each_entry_continue - iterate over list of given type
|
||||||
* continuing after existing point
|
* continuing after existing point
|
||||||
@@ -247,5 +247,5 @@
|
|||||||
for (pos = list_entry(pos->member.next, typeof(*pos), member); \
|
for (pos = list_entry(pos->member.next, typeof(*pos), member); \
|
||||||
&pos->member != (head); \
|
&pos->member != (head); \
|
||||||
pos = list_entry(pos->member.next, typeof(*pos), member))
|
pos = list_entry(pos->member.next, typeof(*pos), member))
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ ACPIDispatchDeviceControl(
|
|||||||
|
|
||||||
status = STATUS_PENDING;
|
status = STATUS_PENDING;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_BATTERY_QUERY_TAG:
|
case IOCTL_BATTERY_QUERY_TAG:
|
||||||
DPRINT("IOCTL_BATTERY_QUERY_TAG is not supported!\n");
|
DPRINT("IOCTL_BATTERY_QUERY_TAG is not supported!\n");
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ Bus_FDO_PnP (
|
|||||||
{
|
{
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
ULONG length, prevcount, numPdosPresent;
|
ULONG length, prevcount, numPdosPresent;
|
||||||
PLIST_ENTRY entry;
|
PLIST_ENTRY entry;
|
||||||
PPDO_DEVICE_DATA pdoData;
|
PPDO_DEVICE_DATA pdoData;
|
||||||
PDEVICE_RELATIONS relations, oldRelations;
|
PDEVICE_RELATIONS relations, oldRelations;
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ Bus_FDO_PnP (
|
|||||||
|
|
||||||
//
|
//
|
||||||
// The PnP manager is trying to stop the device
|
// The PnP manager is trying to stop the device
|
||||||
// for resource rebalancing.
|
// for resource rebalancing.
|
||||||
//
|
//
|
||||||
SET_NEW_PNP_STATE(DeviceData->Common, StopPending);
|
SET_NEW_PNP_STATE(DeviceData->Common, StopPending);
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ Bus_FDO_Power (
|
|||||||
DbgDevicePowerString(powerState.DeviceState)));
|
DbgDevicePowerString(powerState.DeviceState)));
|
||||||
|
|
||||||
if (powerType == SystemPowerState)
|
if (powerType == SystemPowerState)
|
||||||
{
|
{
|
||||||
switch (powerState.SystemState) {
|
switch (powerState.SystemState) {
|
||||||
case PowerSystemSleeping1:
|
case PowerSystemSleeping1:
|
||||||
AcpiState = ACPI_STATE_S1;
|
AcpiState = ACPI_STATE_S1;
|
||||||
|
|||||||
@@ -374,7 +374,7 @@ PciDebugPrintCmResList(IN PCM_RESOURCE_LIST PartialList)
|
|||||||
ListCount = PartialList->Count;
|
ListCount = PartialList->Count;
|
||||||
FullDescriptor = PartialList->List;
|
FullDescriptor = PartialList->List;
|
||||||
DPRINT1(" CM_RESOURCE_LIST (PCI Bus Driver) (List Count = %u)\n", PartialList->Count);
|
DPRINT1(" CM_RESOURCE_LIST (PCI Bus Driver) (List Count = %u)\n", PartialList->Count);
|
||||||
|
|
||||||
/* Loop full list */
|
/* Loop full list */
|
||||||
for (i = 0; i < ListCount; i++)
|
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 */
|
/* Check for hack which only allows bus to have one child device */
|
||||||
if (PdoExtension->HackFlags & PCI_HACK_ONE_CHILD) MaxDevice = 1;
|
if (PdoExtension->HackFlags & PCI_HACK_ONE_CHILD) MaxDevice = 1;
|
||||||
|
|
||||||
/* Check if the secondary bus number has changed */
|
/* Check if the secondary bus number has changed */
|
||||||
PciReadDeviceConfig(PdoExtension,
|
PciReadDeviceConfig(PdoExtension,
|
||||||
&SecondaryBus,
|
&SecondaryBus,
|
||||||
|
|||||||
+51
-51
@@ -128,7 +128,7 @@ PciIdPrintf(IN PPCI_ID_BUFFER IdBuffer,
|
|||||||
va_list va;
|
va_list va;
|
||||||
|
|
||||||
ASSERT(IdBuffer->Count < MAX_ANSI_STRINGS);
|
ASSERT(IdBuffer->Count < MAX_ANSI_STRINGS);
|
||||||
|
|
||||||
/* Do the actual string formatting into the character buffer */
|
/* Do the actual string formatting into the character buffer */
|
||||||
va_start(va, Format);
|
va_start(va, Format);
|
||||||
vsprintf(IdBuffer->CharBuffer, Format, va);
|
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 */
|
/* Initialize the ANSI_STRING that will hold this string buffer */
|
||||||
AnsiString = &IdBuffer->Strings[IdBuffer->Count];
|
AnsiString = &IdBuffer->Strings[IdBuffer->Count];
|
||||||
RtlInitAnsiString(AnsiString, IdBuffer->CharBuffer);
|
RtlInitAnsiString(AnsiString, IdBuffer->CharBuffer);
|
||||||
|
|
||||||
/* Calculate the final size of the string, in Unicode */
|
/* Calculate the final size of the string, in Unicode */
|
||||||
Size = RtlAnsiStringToUnicodeSize(AnsiString);
|
Size = RtlAnsiStringToUnicodeSize(AnsiString);
|
||||||
|
|
||||||
/* Update hte buffer with the size,and update the character pointer */
|
/* Update hte buffer with the size,and update the character pointer */
|
||||||
IdBuffer->StringSize[IdBuffer->Count] = Size;
|
IdBuffer->StringSize[IdBuffer->Count] = Size;
|
||||||
IdBuffer->TotalLength += Size;
|
IdBuffer->TotalLength += Size;
|
||||||
Length = AnsiString->Length + sizeof(ANSI_NULL);
|
Length = AnsiString->Length + sizeof(ANSI_NULL);
|
||||||
IdBuffer->CharBuffer += Length;
|
IdBuffer->CharBuffer += Length;
|
||||||
|
|
||||||
/* Move to the next string for next time */
|
/* Move to the next string for next time */
|
||||||
IdBuffer->Count++;
|
IdBuffer->Count++;
|
||||||
|
|
||||||
/* Return the length */
|
/* Return the length */
|
||||||
return Length;
|
return Length;
|
||||||
}
|
}
|
||||||
@@ -165,13 +165,13 @@ PciIdPrintfAppend(IN PPCI_ID_BUFFER IdBuffer,
|
|||||||
va_list va;
|
va_list va;
|
||||||
|
|
||||||
ASSERT(IdBuffer->Count);
|
ASSERT(IdBuffer->Count);
|
||||||
|
|
||||||
/* Choose the next static ANSI_STRING to use */
|
/* Choose the next static ANSI_STRING to use */
|
||||||
NextId = IdBuffer->Count - 1;
|
NextId = IdBuffer->Count - 1;
|
||||||
|
|
||||||
/* Max length is from the end of the buffer up until the current pointer */
|
/* 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 */
|
/* Do the actual append, and return the length this string took */
|
||||||
va_start(va, Format);
|
va_start(va, Format);
|
||||||
Length = vsprintf(IdBuffer->CharBuffer - 1, Format, va);
|
Length = vsprintf(IdBuffer->CharBuffer - 1, Format, va);
|
||||||
@@ -182,15 +182,15 @@ PciIdPrintfAppend(IN PPCI_ID_BUFFER IdBuffer,
|
|||||||
AnsiString = &IdBuffer->Strings[NextId];
|
AnsiString = &IdBuffer->Strings[NextId];
|
||||||
AnsiString->Length += Length;
|
AnsiString->Length += Length;
|
||||||
AnsiString->MaximumLength += Length;
|
AnsiString->MaximumLength += Length;
|
||||||
|
|
||||||
/* Calculate the final size of the string, in Unicode */
|
/* Calculate the final size of the string, in Unicode */
|
||||||
Size = RtlAnsiStringToUnicodeSize(AnsiString);
|
Size = RtlAnsiStringToUnicodeSize(AnsiString);
|
||||||
|
|
||||||
/* Update the buffer with the size, and update the character pointer */
|
/* Update the buffer with the size, and update the character pointer */
|
||||||
IdBuffer->StringSize[NextId] = Size;
|
IdBuffer->StringSize[NextId] = Size;
|
||||||
IdBuffer->TotalLength += Size;
|
IdBuffer->TotalLength += Size;
|
||||||
IdBuffer->CharBuffer += Length;
|
IdBuffer->CharBuffer += Length;
|
||||||
|
|
||||||
/* Return the size */
|
/* Return the size */
|
||||||
return Size;
|
return Size;
|
||||||
}
|
}
|
||||||
@@ -212,28 +212,28 @@ PciQueryId(IN PPCI_PDO_EXTENSION DeviceExtension,
|
|||||||
UNICODE_STRING DestinationString;
|
UNICODE_STRING DestinationString;
|
||||||
PCI_ID_BUFFER IdBuffer;
|
PCI_ID_BUFFER IdBuffer;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Assume failure */
|
/* Assume failure */
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
*Buffer = NULL;
|
*Buffer = NULL;
|
||||||
|
|
||||||
/* Start with the genric vendor string, which is the vendor ID + device ID */
|
/* Start with the genric vendor string, which is the vendor ID + device ID */
|
||||||
sprintf(VendorString,
|
sprintf(VendorString,
|
||||||
"PCI\\VEN_%04X&DEV_%04X",
|
"PCI\\VEN_%04X&DEV_%04X",
|
||||||
DeviceExtension->VendorId,
|
DeviceExtension->VendorId,
|
||||||
DeviceExtension->DeviceId);
|
DeviceExtension->DeviceId);
|
||||||
|
|
||||||
/* Initialize the PCI ID Buffer */
|
/* Initialize the PCI ID Buffer */
|
||||||
PciInitIdBuffer(&IdBuffer);
|
PciInitIdBuffer(&IdBuffer);
|
||||||
|
|
||||||
/* Build the subsystem ID as shown in PCI ID Strings */
|
/* Build the subsystem ID as shown in PCI ID Strings */
|
||||||
SubsysId = DeviceExtension->SubsystemVendorId | (DeviceExtension->SubsystemId << 16);
|
SubsysId = DeviceExtension->SubsystemVendorId | (DeviceExtension->SubsystemId << 16);
|
||||||
|
|
||||||
/* Check what the caller is requesting */
|
/* Check what the caller is requesting */
|
||||||
switch (QueryType)
|
switch (QueryType)
|
||||||
{
|
{
|
||||||
case BusQueryDeviceID:
|
case BusQueryDeviceID:
|
||||||
|
|
||||||
/* A single ID, the vendor string + the revision ID */
|
/* A single ID, the vendor string + the revision ID */
|
||||||
PciIdPrintf(&IdBuffer,
|
PciIdPrintf(&IdBuffer,
|
||||||
"%s&SUBSYS_%08X&REV_%02X",
|
"%s&SUBSYS_%08X&REV_%02X",
|
||||||
@@ -241,22 +241,22 @@ PciQueryId(IN PPCI_PDO_EXTENSION DeviceExtension,
|
|||||||
SubsysId,
|
SubsysId,
|
||||||
DeviceExtension->RevisionId);
|
DeviceExtension->RevisionId);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BusQueryHardwareIDs:
|
case BusQueryHardwareIDs:
|
||||||
|
|
||||||
/* First the vendor string + the subsystem ID + the revision ID */
|
/* First the vendor string + the subsystem ID + the revision ID */
|
||||||
PciIdPrintf(&IdBuffer,
|
PciIdPrintf(&IdBuffer,
|
||||||
"%s&SUBSYS_%08X&REV_%02X",
|
"%s&SUBSYS_%08X&REV_%02X",
|
||||||
VendorString,
|
VendorString,
|
||||||
SubsysId,
|
SubsysId,
|
||||||
DeviceExtension->RevisionId);
|
DeviceExtension->RevisionId);
|
||||||
|
|
||||||
/* Next, without the revision */
|
/* Next, without the revision */
|
||||||
PciIdPrintf(&IdBuffer,
|
PciIdPrintf(&IdBuffer,
|
||||||
"%s&SUBSYS_%08X",
|
"%s&SUBSYS_%08X",
|
||||||
VendorString,
|
VendorString,
|
||||||
SubsysId);
|
SubsysId);
|
||||||
|
|
||||||
/* Next, the vendor string + the base class + sub class + progif */
|
/* Next, the vendor string + the base class + sub class + progif */
|
||||||
PciIdPrintf(&IdBuffer,
|
PciIdPrintf(&IdBuffer,
|
||||||
"%s&CC_%02X%02X%02X",
|
"%s&CC_%02X%02X%02X",
|
||||||
@@ -271,13 +271,13 @@ PciQueryId(IN PPCI_PDO_EXTENSION DeviceExtension,
|
|||||||
VendorString,
|
VendorString,
|
||||||
DeviceExtension->BaseClass,
|
DeviceExtension->BaseClass,
|
||||||
DeviceExtension->SubClass);
|
DeviceExtension->SubClass);
|
||||||
|
|
||||||
/* And finally, a terminator */
|
/* And finally, a terminator */
|
||||||
PciIdPrintf(&IdBuffer, "\0");
|
PciIdPrintf(&IdBuffer, "\0");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BusQueryCompatibleIDs:
|
case BusQueryCompatibleIDs:
|
||||||
|
|
||||||
/* First, the vendor + revision ID only */
|
/* First, the vendor + revision ID only */
|
||||||
PciIdPrintf(&IdBuffer,
|
PciIdPrintf(&IdBuffer,
|
||||||
"%s&REV_%02X",
|
"%s&REV_%02X",
|
||||||
@@ -286,7 +286,7 @@ PciQueryId(IN PPCI_PDO_EXTENSION DeviceExtension,
|
|||||||
|
|
||||||
/* Next, the vendor string alone */
|
/* Next, the vendor string alone */
|
||||||
PciIdPrintf(&IdBuffer, "%s", VendorString);
|
PciIdPrintf(&IdBuffer, "%s", VendorString);
|
||||||
|
|
||||||
/* Next, the vendor ID + the base class + the sub class + progif */
|
/* Next, the vendor ID + the base class + the sub class + progif */
|
||||||
PciIdPrintf(&IdBuffer,
|
PciIdPrintf(&IdBuffer,
|
||||||
"PCI\\VEN_%04X&CC_%02X%02X%02X",
|
"PCI\\VEN_%04X&CC_%02X%02X%02X",
|
||||||
@@ -319,22 +319,22 @@ PciQueryId(IN PPCI_PDO_EXTENSION DeviceExtension,
|
|||||||
"PCI\\CC_%02X%02X",
|
"PCI\\CC_%02X%02X",
|
||||||
DeviceExtension->BaseClass,
|
DeviceExtension->BaseClass,
|
||||||
DeviceExtension->SubClass);
|
DeviceExtension->SubClass);
|
||||||
|
|
||||||
/* And finally, a terminator */
|
/* And finally, a terminator */
|
||||||
PciIdPrintf(&IdBuffer, "\0");
|
PciIdPrintf(&IdBuffer, "\0");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BusQueryInstanceID:
|
case BusQueryInstanceID:
|
||||||
|
|
||||||
/* Start with a terminator */
|
/* Start with a terminator */
|
||||||
PciIdPrintf(&IdBuffer, "\0");
|
PciIdPrintf(&IdBuffer, "\0");
|
||||||
|
|
||||||
/* And then encode the device and function number */
|
/* And then encode the device and function number */
|
||||||
PciIdPrintfAppend(&IdBuffer,
|
PciIdPrintfAppend(&IdBuffer,
|
||||||
"%02X",
|
"%02X",
|
||||||
(DeviceExtension->Slot.u.bits.DeviceNumber << 3) |
|
(DeviceExtension->Slot.u.bits.DeviceNumber << 3) |
|
||||||
DeviceExtension->Slot.u.bits.FunctionNumber);
|
DeviceExtension->Slot.u.bits.FunctionNumber);
|
||||||
|
|
||||||
/* Loop every parent until the root */
|
/* Loop every parent until the root */
|
||||||
ParentExtension = DeviceExtension->ParentFdoExtension;
|
ParentExtension = DeviceExtension->ParentFdoExtension;
|
||||||
while (!PCI_IS_ROOT_FDO(ParentExtension))
|
while (!PCI_IS_ROOT_FDO(ParentExtension))
|
||||||
@@ -347,37 +347,37 @@ PciQueryId(IN PPCI_PDO_EXTENSION DeviceExtension,
|
|||||||
PdoExtension->Slot.u.bits.FunctionNumber);
|
PdoExtension->Slot.u.bits.FunctionNumber);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
/* Unknown query type */
|
/* Unknown query type */
|
||||||
DPRINT1("PciQueryId expected ID type = %d\n", QueryType);
|
DPRINT1("PciQueryId expected ID type = %d\n", QueryType);
|
||||||
return STATUS_NOT_SUPPORTED;
|
return STATUS_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Something should've been generated if this has been reached */
|
/* Something should've been generated if this has been reached */
|
||||||
ASSERT(IdBuffer.Count > 0);
|
ASSERT(IdBuffer.Count > 0);
|
||||||
|
|
||||||
/* Allocate the final string buffer to hold the ID */
|
/* Allocate the final string buffer to hold the ID */
|
||||||
StringBuffer = ExAllocatePoolWithTag(PagedPool, IdBuffer.TotalLength, 'BicP');
|
StringBuffer = ExAllocatePoolWithTag(PagedPool, IdBuffer.TotalLength, 'BicP');
|
||||||
if (!StringBuffer) return STATUS_INSUFFICIENT_RESOURCES;
|
if (!StringBuffer) return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
|
||||||
/* Build the UNICODE_STRING structure for it */
|
/* Build the UNICODE_STRING structure for it */
|
||||||
DPRINT1("PciQueryId(%d)\n", QueryType);
|
DPRINT1("PciQueryId(%d)\n", QueryType);
|
||||||
DestinationString.Buffer = StringBuffer;
|
DestinationString.Buffer = StringBuffer;
|
||||||
DestinationString.MaximumLength = IdBuffer.TotalLength;
|
DestinationString.MaximumLength = IdBuffer.TotalLength;
|
||||||
|
|
||||||
/* Loop every ID in the buffer */
|
/* Loop every ID in the buffer */
|
||||||
for (i = 0; i < IdBuffer.Count; i++)
|
for (i = 0; i < IdBuffer.Count; i++)
|
||||||
{
|
{
|
||||||
/* Select the ANSI_STRING for the ID */
|
/* Select the ANSI_STRING for the ID */
|
||||||
NextString = &IdBuffer.Strings[i];
|
NextString = &IdBuffer.Strings[i];
|
||||||
DPRINT1(" <- \"%s\"\n", NextString->Buffer);
|
DPRINT1(" <- \"%s\"\n", NextString->Buffer);
|
||||||
|
|
||||||
/* Convert it to a UNICODE_STRING */
|
/* Convert it to a UNICODE_STRING */
|
||||||
Status = RtlAnsiStringToUnicodeString(&DestinationString, NextString, FALSE);
|
Status = RtlAnsiStringToUnicodeString(&DestinationString, NextString, FALSE);
|
||||||
ASSERT(NT_SUCCESS(Status));
|
ASSERT(NT_SUCCESS(Status));
|
||||||
|
|
||||||
/* Add it into the final destination buffer */
|
/* Add it into the final destination buffer */
|
||||||
Size = IdBuffer.StringSize[i];
|
Size = IdBuffer.StringSize[i];
|
||||||
DestinationString.MaximumLength -= Size;
|
DestinationString.MaximumLength -= Size;
|
||||||
@@ -399,25 +399,25 @@ PciQueryDeviceText(IN PPCI_PDO_EXTENSION PdoExtension,
|
|||||||
PWCHAR MessageBuffer, LocationBuffer;
|
PWCHAR MessageBuffer, LocationBuffer;
|
||||||
ULONG Length;
|
ULONG Length;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER(Locale);
|
UNREFERENCED_PARAMETER(Locale);
|
||||||
|
|
||||||
/* Check what the caller is requesting */
|
/* Check what the caller is requesting */
|
||||||
switch (QueryType)
|
switch (QueryType)
|
||||||
{
|
{
|
||||||
case DeviceTextDescription:
|
case DeviceTextDescription:
|
||||||
|
|
||||||
/* Get the message from the resource section */
|
/* Get the message from the resource section */
|
||||||
MessageBuffer = PciGetDeviceDescriptionMessage(PdoExtension->BaseClass,
|
MessageBuffer = PciGetDeviceDescriptionMessage(PdoExtension->BaseClass,
|
||||||
PdoExtension->SubClass);
|
PdoExtension->SubClass);
|
||||||
|
|
||||||
/* Return it to the caller, and select proper status code */
|
/* Return it to the caller, and select proper status code */
|
||||||
*Buffer = MessageBuffer;
|
*Buffer = MessageBuffer;
|
||||||
Status = MessageBuffer ? STATUS_SUCCESS : STATUS_NOT_SUPPORTED;
|
Status = MessageBuffer ? STATUS_SUCCESS : STATUS_NOT_SUPPORTED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DeviceTextLocationInformation:
|
case DeviceTextLocationInformation:
|
||||||
|
|
||||||
/* Get the message from the resource section */
|
/* Get the message from the resource section */
|
||||||
MessageBuffer = PciGetDescriptionMessage(0x10000, &Length);
|
MessageBuffer = PciGetDescriptionMessage(0x10000, &Length);
|
||||||
if (!MessageBuffer)
|
if (!MessageBuffer)
|
||||||
@@ -426,14 +426,14 @@ PciQueryDeviceText(IN PPCI_PDO_EXTENSION PdoExtension,
|
|||||||
Status = STATUS_NOT_SUPPORTED;
|
Status = STATUS_NOT_SUPPORTED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add space for a null-terminator, and allocate the buffer */
|
/* Add space for a null-terminator, and allocate the buffer */
|
||||||
Length += 2 * sizeof(UNICODE_NULL);
|
Length += 2 * sizeof(UNICODE_NULL);
|
||||||
LocationBuffer = ExAllocatePoolWithTag(PagedPool,
|
LocationBuffer = ExAllocatePoolWithTag(PagedPool,
|
||||||
Length * sizeof(WCHAR),
|
Length * sizeof(WCHAR),
|
||||||
'BicP');
|
'BicP');
|
||||||
*Buffer = LocationBuffer;
|
*Buffer = LocationBuffer;
|
||||||
|
|
||||||
/* Check if the allocation succeeded */
|
/* Check if the allocation succeeded */
|
||||||
if (LocationBuffer)
|
if (LocationBuffer)
|
||||||
{
|
{
|
||||||
@@ -444,21 +444,21 @@ PciQueryDeviceText(IN PPCI_PDO_EXTENSION PdoExtension,
|
|||||||
PdoExtension->Slot.u.bits.FunctionNumber,
|
PdoExtension->Slot.u.bits.FunctionNumber,
|
||||||
PdoExtension->Slot.u.bits.DeviceNumber);
|
PdoExtension->Slot.u.bits.DeviceNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free the original string from the resource section */
|
/* Free the original string from the resource section */
|
||||||
ExFreePoolWithTag(MessageBuffer, 0);
|
ExFreePoolWithTag(MessageBuffer, 0);
|
||||||
|
|
||||||
/* Select the correct status */
|
/* Select the correct status */
|
||||||
Status = LocationBuffer ? STATUS_SUCCESS : STATUS_INSUFFICIENT_RESOURCES;
|
Status = LocationBuffer ? STATUS_SUCCESS : STATUS_INSUFFICIENT_RESOURCES;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
/* Anything else is unsupported */
|
/* Anything else is unsupported */
|
||||||
Status = STATUS_NOT_SUPPORTED;
|
Status = STATUS_NOT_SUPPORTED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return whether or not a device text string was indeed found */
|
/* Return whether or not a device text string was indeed found */
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -611,7 +611,7 @@ PciGetHackFlags(IN USHORT VendorId,
|
|||||||
ULONGLONG HackFlags;
|
ULONGLONG HackFlags;
|
||||||
ULONG LastWeight, MatchWeight;
|
ULONG LastWeight, MatchWeight;
|
||||||
ULONG EntryFlags;
|
ULONG EntryFlags;
|
||||||
|
|
||||||
/* ReactOS SetupLDR Hack */
|
/* ReactOS SetupLDR Hack */
|
||||||
if (!PciHackTable) return 0;
|
if (!PciHackTable) return 0;
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
// Next default values for new objects
|
// Next default values for new objects
|
||||||
//
|
//
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||||
|
|||||||
@@ -83,12 +83,12 @@ CdDiskOffsetFromMcbEntry (
|
|||||||
#pragma alloc_text(PAGE, CdUninitializeMcb)
|
#pragma alloc_text(PAGE, CdUninitializeMcb)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
// PREFast currently has no way to express the Fcb==Fcb->Vcb->VolumeDasdFcb early return
|
// 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
|
#endif
|
||||||
CdLookupAllocation (
|
CdLookupAllocation (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -330,7 +330,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdAddAllocationFromDirent (
|
CdAddAllocationFromDirent (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -479,7 +479,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdAddInitialAllocation (
|
CdAddInitialAllocation (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_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 is called to set up the initial entry in an Mcb.
|
||||||
|
|
||||||
This routine handles the single initial entry for a directory file. We will
|
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
|
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
|
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
|
where there is a single entry and we want to align the data on a sector
|
||||||
boundary.
|
boundary.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
@@ -570,7 +570,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdTruncateAllocation (
|
CdTruncateAllocation (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -623,7 +623,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_At_(Fcb->NodeByteSize, _In_range_(>=, FIELD_OFFSET( FCB, FcbType )))
|
_At_(Fcb->NodeByteSize, _In_range_(>=, FIELD_OFFSET( FCB, FcbType )))
|
||||||
VOID
|
VOID
|
||||||
CdInitializeMcb (
|
CdInitializeMcb (
|
||||||
@@ -655,7 +655,7 @@ Return Value:
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
ASSERT_IRP_CONTEXT( IrpContext );
|
ASSERT_IRP_CONTEXT( IrpContext );
|
||||||
ASSERT_FCB( Fcb );
|
ASSERT_FCB( Fcb );
|
||||||
|
|
||||||
@@ -672,7 +672,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_At_(Fcb->NodeByteSize, _In_range_(>=, FIELD_OFFSET( FCB, FcbType )))
|
_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_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)))
|
_When_(Fcb->NodeTypeCode == CDFS_NTC_FCB_INDEX, _At_(Fcb->NodeByteSize, _In_range_(==, SIZEOF_FCB_INDEX)))
|
||||||
@@ -707,7 +707,7 @@ Return Value:
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
ASSERT_IRP_CONTEXT( IrpContext );
|
ASSERT_IRP_CONTEXT( IrpContext );
|
||||||
ASSERT_FCB( Fcb );
|
ASSERT_FCB( Fcb );
|
||||||
|
|
||||||
@@ -723,7 +723,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local suupport routine
|
// Local suupport routine
|
||||||
//
|
//
|
||||||
@@ -764,7 +764,7 @@ Return Value:
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
ASSERT_IRP_CONTEXT( IrpContext );
|
ASSERT_IRP_CONTEXT( IrpContext );
|
||||||
ASSERT_FCB( Fcb );
|
ASSERT_FCB( Fcb );
|
||||||
ASSERT_LOCKED_FCB( Fcb );
|
ASSERT_LOCKED_FCB( Fcb );
|
||||||
@@ -803,7 +803,7 @@ Return Value:
|
|||||||
return CurrentMcbOffset;
|
return CurrentMcbOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -858,7 +858,7 @@ Return Value:
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
ASSERT_IRP_CONTEXT( IrpContext );
|
ASSERT_IRP_CONTEXT( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ Abstract:
|
|||||||
#pragma alloc_text(PAGE, CdPurgeVolume)
|
#pragma alloc_text(PAGE, CdPurgeVolume)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdCreateInternalStream (
|
CdCreateInternalStream (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -128,9 +128,9 @@ Return Value:
|
|||||||
StreamFileOpen,
|
StreamFileOpen,
|
||||||
Fcb,
|
Fcb,
|
||||||
NULL );
|
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,
|
// NULL this in CdDeleteInternalStream before OB deletes the file object,
|
||||||
// and before CdRemovePrefix is called (which frees Fcb names).
|
// and before CdRemovePrefix is called (which frees Fcb names).
|
||||||
//
|
//
|
||||||
@@ -328,7 +328,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdDeleteInternalStream (
|
CdDeleteInternalStream (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -398,7 +398,7 @@ Return Value:
|
|||||||
// Null the name pointer, since the stream file object never actually
|
// Null the name pointer, since the stream file object never actually
|
||||||
// 'owns' the names, we just point it to existing ones.
|
// 'owns' the names, we just point it to existing ones.
|
||||||
//
|
//
|
||||||
|
|
||||||
FileObject->FileName.Buffer = NULL;
|
FileObject->FileName.Buffer = NULL;
|
||||||
FileObject->FileName.MaximumLength = FileObject->FileName.Length = 0;
|
FileObject->FileName.MaximumLength = FileObject->FileName.Length = 0;
|
||||||
|
|
||||||
@@ -406,7 +406,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdCompleteMdl (
|
CdCompleteMdl (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -458,7 +458,7 @@ Return Value:
|
|||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ typedef FILE_ID *PFILE_ID;
|
|||||||
#define TOC_DATA_TRACK (0x04)
|
#define TOC_DATA_TRACK (0x04)
|
||||||
#define TOC_LAST_TRACK (0xaa)
|
#define TOC_LAST_TRACK (0xaa)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// There is considerable rearrangement of the volume descriptors for
|
// There is considerable rearrangement of the volume descriptors for
|
||||||
// ISO and HSG. However, within each standard the same structure can
|
// 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)
|
#define MAX_FILE_ID_LENGTH (255)
|
||||||
|
|
||||||
|
|
||||||
typedef struct _RAW_ISO_VD {
|
typedef struct _RAW_ISO_VD {
|
||||||
|
|
||||||
UCHAR DescType; // volume type: 1 = standard, 2 = coded
|
UCHAR DescType; // volume type: 1 = standard, 2 = coded
|
||||||
@@ -165,7 +165,7 @@ typedef struct _RAW_ISO_VD {
|
|||||||
} RAW_ISO_VD;
|
} RAW_ISO_VD;
|
||||||
typedef RAW_ISO_VD *PRAW_ISO_VD;
|
typedef RAW_ISO_VD *PRAW_ISO_VD;
|
||||||
|
|
||||||
|
|
||||||
typedef struct _RAW_HSG_VD {
|
typedef struct _RAW_HSG_VD {
|
||||||
|
|
||||||
ULONG BlkNumI; // logical block number Intel
|
ULONG BlkNumI; // logical block number Intel
|
||||||
@@ -209,7 +209,7 @@ typedef struct _RAW_HSG_VD {
|
|||||||
} RAW_HSG_VD;
|
} RAW_HSG_VD;
|
||||||
typedef RAW_HSG_VD *PRAW_HSG_VD;
|
typedef RAW_HSG_VD *PRAW_HSG_VD;
|
||||||
|
|
||||||
|
|
||||||
typedef struct _RAW_JOLIET_VD {
|
typedef struct _RAW_JOLIET_VD {
|
||||||
|
|
||||||
UCHAR DescType; // volume type: 2 = coded
|
UCHAR DescType; // volume type: 2 = coded
|
||||||
@@ -316,7 +316,7 @@ typedef RAW_JOLIET_VD *PRAW_JOLIET_VD;
|
|||||||
((PRAW_ISO_VD) (R))->VolSpaceI \
|
((PRAW_ISO_VD) (R))->VolSpaceI \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// This structure is used to overlay a region of a disk sector
|
// This structure is used to overlay a region of a disk sector
|
||||||
// to retrieve a single directory entry. There is a difference
|
// 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 on-disk representation of a Path Table entry differs between
|
||||||
// the ISO version and the HSG version. The fields are the same
|
// 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 \
|
(RP)->DirLoc \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// System use are for XA data. The following is the system use area for
|
// System use are for XA data. The following is the system use area for
|
||||||
// directory entries on XA data disks.
|
// directory entries on XA data disks.
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ BOOLEAN CdTestTopLevel = TRUE;
|
|||||||
BOOLEAN CdTestRaisedStatus = TRUE;
|
BOOLEAN CdTestRaisedStatus = TRUE;
|
||||||
BOOLEAN CdBreakOnAnyRaise = FALSE;
|
BOOLEAN CdBreakOnAnyRaise = FALSE;
|
||||||
BOOLEAN CdTraceRaises = FALSE;
|
BOOLEAN CdTraceRaises = FALSE;
|
||||||
NTSTATUS CdInterestingExceptionCodes[] = { STATUS_DISK_CORRUPT_ERROR,
|
NTSTATUS CdInterestingExceptionCodes[] = { STATUS_DISK_CORRUPT_ERROR,
|
||||||
STATUS_FILE_CORRUPT_ERROR,
|
STATUS_FILE_CORRUPT_ERROR,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0 };
|
0, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
#endif
|
#endif
|
||||||
@@ -427,7 +427,7 @@ Return Value:
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case IRP_MJ_SHUTDOWN :
|
case IRP_MJ_SHUTDOWN :
|
||||||
|
|
||||||
Status = CdCommonShutdown( IrpContext, Irp );
|
Status = CdCommonShutdown( IrpContext, Irp );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -469,7 +469,7 @@ CdRaiseStatusEx (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
BOOLEAN BreakIn = FALSE;
|
BOOLEAN BreakIn = FALSE;
|
||||||
|
|
||||||
AssertVerifyDevice( IrpContext, Status);
|
AssertVerifyDevice( IrpContext, Status);
|
||||||
|
|
||||||
if (CdTraceRaises) {
|
if (CdTraceRaises) {
|
||||||
@@ -481,8 +481,8 @@ CdRaiseStatusEx (
|
|||||||
|
|
||||||
ULONG Index;
|
ULONG Index;
|
||||||
|
|
||||||
for (Index = 0;
|
for (Index = 0;
|
||||||
Index < (sizeof( CdInterestingExceptionCodes) / sizeof( CdInterestingExceptionCodes[0]));
|
Index < (sizeof( CdInterestingExceptionCodes) / sizeof( CdInterestingExceptionCodes[0]));
|
||||||
Index++) {
|
Index++) {
|
||||||
|
|
||||||
if ((STATUS_SUCCESS != CdInterestingExceptionCodes[Index]) &&
|
if ((STATUS_SUCCESS != CdInterestingExceptionCodes[Index]) &&
|
||||||
@@ -495,7 +495,7 @@ CdRaiseStatusEx (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (BreakIn || CdBreakOnAnyRaise) {
|
if (BreakIn || CdBreakOnAnyRaise) {
|
||||||
|
|
||||||
DbgPrint( "CDFS: Breaking on raised status %08x (BI=%d,BA=%d)\n", Status, 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: (FILEID %d LINE %d)\n", FileId, Line);
|
||||||
DbgPrint( "CDFS: Contact CDFS.SYS component owner for triage.\n");
|
DbgPrint( "CDFS: Contact CDFS.SYS component owner for triage.\n");
|
||||||
@@ -503,7 +503,7 @@ CdRaiseStatusEx (
|
|||||||
|
|
||||||
NT_ASSERT(FALSE);
|
NT_ASSERT(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NormalizeStatus) {
|
if (NormalizeStatus) {
|
||||||
|
|
||||||
IrpContext->ExceptionStatus = FsRtlNormalizeNtstatus( Status, STATUS_UNEXPECTED_IO_ERROR);
|
IrpContext->ExceptionStatus = FsRtlNormalizeNtstatus( Status, STATUS_UNEXPECTED_IO_ERROR);
|
||||||
@@ -514,7 +514,7 @@ CdRaiseStatusEx (
|
|||||||
}
|
}
|
||||||
|
|
||||||
IrpContext->RaisedAtLineFile = (FileId << 16) | Line;
|
IrpContext->RaisedAtLineFile = (FileId << 16) | Line;
|
||||||
|
|
||||||
ExRaiseStatus( IrpContext->ExceptionStatus);
|
ExRaiseStatus( IrpContext->ExceptionStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -591,7 +591,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
|
|
||||||
AssertVerifyDevice( IrpContext, IrpContext->ExceptionStatus );
|
AssertVerifyDevice( IrpContext, IrpContext->ExceptionStatus );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Bug check if this status is not supported.
|
// Bug check if this status is not supported.
|
||||||
//
|
//
|
||||||
@@ -610,7 +610,7 @@ Return Value:
|
|||||||
return EXCEPTION_EXECUTE_HANDLER;
|
return EXCEPTION_EXECUTE_HANDLER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
@@ -653,7 +653,7 @@ Return Value:
|
|||||||
|
|
||||||
ASSERT_OPTIONAL_IRP_CONTEXT( IrpContext );
|
ASSERT_OPTIONAL_IRP_CONTEXT( IrpContext );
|
||||||
ASSERT_IRP( Irp );
|
ASSERT_IRP( Irp );
|
||||||
|
|
||||||
//
|
//
|
||||||
// If there is not an irp context, then complete the request with the
|
// If there is not an irp context, then complete the request with the
|
||||||
// current status code.
|
// current status code.
|
||||||
@@ -679,7 +679,7 @@ Return Value:
|
|||||||
// or we are forcing this to be posted.
|
// or we are forcing this to be posted.
|
||||||
//
|
//
|
||||||
// - Status code is STATUS_VERIFY_REQUIRED and we are at APC level
|
// - 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.
|
// the verify path in this case.
|
||||||
//
|
//
|
||||||
// Set the MORE_PROCESSING flag in the IrpContext to keep if from being
|
// Set the MORE_PROCESSING flag in the IrpContext to keep if from being
|
||||||
@@ -697,17 +697,17 @@ Return Value:
|
|||||||
|
|
||||||
ExceptionCode = CdFsdPostRequest( IrpContext, Irp );
|
ExceptionCode = CdFsdPostRequest( IrpContext, Irp );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((ExceptionCode == STATUS_VERIFY_REQUIRED) &&
|
else if ((ExceptionCode == STATUS_VERIFY_REQUIRED) &&
|
||||||
FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_TOP_LEVEL ) &&
|
FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_TOP_LEVEL ) &&
|
||||||
KeAreAllApcsDisabled()) {
|
KeAreAllApcsDisabled()) {
|
||||||
|
|
||||||
ExceptionCode = CdFsdPostRequest( IrpContext, Irp );
|
ExceptionCode = CdFsdPostRequest( IrpContext, Irp );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT( CdExceptionFilter( IrpContext, _SEH2_GetExceptionInformation() )) {
|
_SEH2_EXCEPT( CdExceptionFilter( IrpContext, _SEH2_GetExceptionInformation() )) {
|
||||||
|
|
||||||
ExceptionCode = _SEH2_GetExceptionCode();
|
ExceptionCode = _SEH2_GetExceptionCode();
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
//
|
//
|
||||||
// If we posted the request or our caller will retry then just return here.
|
// 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 );
|
Device = IoGetDeviceToVerify( Irp->Tail.Overlay.Thread );
|
||||||
IoSetDeviceToVerify( Irp->Tail.Overlay.Thread, NULL );
|
IoSetDeviceToVerify( Irp->Tail.Overlay.Thread, NULL );
|
||||||
|
|
||||||
//
|
//
|
||||||
// If there is no device in that location then check in the
|
// If there is no device in that location then check in the
|
||||||
// current thread.
|
// 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.
|
// 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.
|
// and just use our real device object instead.
|
||||||
//
|
//
|
||||||
|
|
||||||
@@ -817,7 +817,7 @@ Return Value:
|
|||||||
|
|
||||||
return ExceptionCode;
|
return ExceptionCode;
|
||||||
|
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Generate a pop-up.
|
// 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.
|
// 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.
|
// and just use our real device object instead.
|
||||||
//
|
//
|
||||||
|
|
||||||
@@ -909,7 +909,7 @@ Return Value:
|
|||||||
return ExceptionCode;
|
return ExceptionCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdCompleteRequest (
|
CdCompleteRequest (
|
||||||
_Inout_opt_ PIRP_CONTEXT IrpContext,
|
_Inout_opt_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -969,14 +969,14 @@ Return Value:
|
|||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
|
|
||||||
AssertVerifyDeviceIrp( Irp );
|
AssertVerifyDeviceIrp( Irp );
|
||||||
|
|
||||||
IoCompleteRequest( Irp, IO_CD_ROM_INCREMENT );
|
IoCompleteRequest( Irp, IO_CD_ROM_INCREMENT );
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdSetThreadContext (
|
CdSetThreadContext (
|
||||||
_Inout_ PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -1180,7 +1180,7 @@ Return Value:
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
CdSerial32 (
|
CdSerial32 (
|
||||||
_In_reads_bytes_(ByteCount) PCHAR Buffer,
|
_In_reads_bytes_(ByteCount) PCHAR Buffer,
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ CdInitializeGlobalData (
|
|||||||
#pragma alloc_text(INIT, CdInitializeGlobalData)
|
#pragma alloc_text(INIT, CdInitializeGlobalData)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -174,7 +174,7 @@ Return Value:
|
|||||||
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] =
|
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] =
|
||||||
DriverObject->MajorFunction[IRP_MJ_LOCK_CONTROL] =
|
DriverObject->MajorFunction[IRP_MJ_LOCK_CONTROL] =
|
||||||
DriverObject->MajorFunction[IRP_MJ_CLEANUP] =
|
DriverObject->MajorFunction[IRP_MJ_CLEANUP] =
|
||||||
DriverObject->MajorFunction[IRP_MJ_PNP] =
|
DriverObject->MajorFunction[IRP_MJ_PNP] =
|
||||||
DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = (PDRIVER_DISPATCH) CdFsdDispatch;
|
DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = (PDRIVER_DISPATCH) CdFsdDispatch;
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma prefast(pop)
|
#pragma prefast(pop)
|
||||||
@@ -302,7 +302,7 @@ Return Value:
|
|||||||
ObDereferenceObject (CdData.HddFileSystemDeviceObject);
|
ObDereferenceObject (CdData.HddFileSystemDeviceObject);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -364,7 +364,7 @@ Return Value:
|
|||||||
CdFastIoDispatch.AcquireFileForNtCreateSection = NULL;
|
CdFastIoDispatch.AcquireFileForNtCreateSection = NULL;
|
||||||
CdFastIoDispatch.ReleaseFileForNtCreateSection = CdReleaseForCreateSection;
|
CdFastIoDispatch.ReleaseFileForNtCreateSection = CdReleaseForCreateSection;
|
||||||
CdFastIoDispatch.FastIoQueryNetworkOpenInfo = CdFastQueryNetworkInfo; // QueryNetworkInfo
|
CdFastIoDispatch.FastIoQueryNetworkOpenInfo = CdFastQueryNetworkInfo; // QueryNetworkInfo
|
||||||
|
|
||||||
CdFastIoDispatch.MdlRead = FsRtlMdlReadDev;
|
CdFastIoDispatch.MdlRead = FsRtlMdlReadDev;
|
||||||
CdFastIoDispatch.MdlReadComplete = FsRtlMdlReadCompleteDev;
|
CdFastIoDispatch.MdlReadComplete = FsRtlMdlReadCompleteDev;
|
||||||
CdFastIoDispatch.PrepareMdlWrite = FsRtlPrepareMdlWriteDev;
|
CdFastIoDispatch.PrepareMdlWrite = FsRtlPrepareMdlWriteDev;
|
||||||
@@ -417,7 +417,7 @@ Return Value:
|
|||||||
|
|
||||||
CdData.CloseItem = IoAllocateWorkItem (FileSystemDeviceObject);
|
CdData.CloseItem = IoAllocateWorkItem (FileSystemDeviceObject);
|
||||||
if (CdData.CloseItem == NULL) {
|
if (CdData.CloseItem == NULL) {
|
||||||
|
|
||||||
ExDeleteResourceLite( &CdData.DataResource );
|
ExDeleteResourceLite( &CdData.DataResource );
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ Abstract:
|
|||||||
DELETE | \
|
DELETE | \
|
||||||
WRITE_DAC ))
|
WRITE_DAC ))
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Allocation support routines, implemented in AllocSup.c
|
// Allocation support routines, implemented in AllocSup.c
|
||||||
//
|
//
|
||||||
@@ -203,7 +203,7 @@ CdUninitializeMcb (
|
|||||||
_Inout_updates_bytes_(Fcb->NodeByteSize) PFCB Fcb
|
_Inout_updates_bytes_(Fcb->NodeByteSize) PFCB Fcb
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Buffer control routines for data caching, implemented in CacheSup.c
|
// Buffer control routines for data caching, implemented in CacheSup.c
|
||||||
//
|
//
|
||||||
@@ -247,12 +247,12 @@ CdVerifyOrCreateDirStreamFile (
|
|||||||
//
|
//
|
||||||
// Unsafe test to see if call / lock neccessary.
|
// Unsafe test to see if call / lock neccessary.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (NULL == Fcb->FileObject) {
|
if (NULL == Fcb->FileObject) {
|
||||||
|
|
||||||
CdCreateInternalStream( IrpContext,
|
CdCreateInternalStream( IrpContext,
|
||||||
Fcb->Vcb,
|
Fcb->Vcb,
|
||||||
Fcb,
|
Fcb,
|
||||||
&Fcb->FileNamePrefix.ExactCaseName.FileName);
|
&Fcb->FileNamePrefix.ExactCaseName.FileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -269,7 +269,7 @@ CdVerifyOrCreateDirStreamFile (
|
|||||||
#define CdUnpinData(IC,B) \
|
#define CdUnpinData(IC,B) \
|
||||||
if (*(B) != NULL) { CcUnpinData( *(B) ); *(B) = NULL; }
|
if (*(B) != NULL) { CcUnpinData( *(B) ); *(B) = NULL; }
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Device I/O routines, implemented in DevIoSup.c
|
// Device I/O routines, implemented in DevIoSup.c
|
||||||
//
|
//
|
||||||
@@ -387,8 +387,8 @@ CdHijackIrpAndFlushDevice (
|
|||||||
if (NULL == *(UB)) { \
|
if (NULL == *(UB)) { \
|
||||||
CdRaiseStatus( (IC), STATUS_INSUFFICIENT_RESOURCES); \
|
CdRaiseStatus( (IC), STATUS_INSUFFICIENT_RESOURCES); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define CdLockUserBuffer(IC,BL,OP) { \
|
#define CdLockUserBuffer(IC,BL,OP) { \
|
||||||
if ((IC)->Irp->MdlAddress == NULL) { \
|
if ((IC)->Irp->MdlAddress == NULL) { \
|
||||||
@@ -396,7 +396,7 @@ CdHijackIrpAndFlushDevice (
|
|||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Dirent support routines, implemented in DirSup.c
|
// Dirent support routines, implemented in DirSup.c
|
||||||
//
|
//
|
||||||
@@ -417,7 +417,7 @@ CdLookupNextDirent (
|
|||||||
_Inout_ PDIRENT_ENUM_CONTEXT NextDirContext
|
_Inout_ PDIRENT_ENUM_CONTEXT NextDirContext
|
||||||
);
|
);
|
||||||
|
|
||||||
_At_(Dirent->CdTime, _Post_notnull_)
|
_At_(Dirent->CdTime, _Post_notnull_)
|
||||||
VOID
|
VOID
|
||||||
CdUpdateDirentFromRawDirent (
|
CdUpdateDirentFromRawDirent (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -558,7 +558,7 @@ CdCleanupFileContext (
|
|||||||
&(FC)->InitialDirent->DirContext, \
|
&(FC)->InitialDirent->DirContext, \
|
||||||
&(FC)->InitialDirent->Dirent )
|
&(FC)->InitialDirent->Dirent )
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The following routines are used to manipulate the fscontext fields
|
// The following routines are used to manipulate the fscontext fields
|
||||||
// of the file object, implemented in FilObSup.c
|
// of the file object, implemented in FilObSup.c
|
||||||
@@ -609,7 +609,7 @@ CdFastDecodeFileObject (
|
|||||||
_Out_ PFCB *Fcb
|
_Out_ PFCB *Fcb
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Name support routines, implemented in NameSup.c
|
// Name support routines, implemented in NameSup.c
|
||||||
//
|
//
|
||||||
@@ -687,7 +687,7 @@ CdFullCompareNames (
|
|||||||
_In_ PUNICODE_STRING NameB
|
_In_ PUNICODE_STRING NameB
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Filesystem control operations. Implemented in Fsctrl.c
|
// Filesystem control operations. Implemented in Fsctrl.c
|
||||||
//
|
//
|
||||||
@@ -708,7 +708,7 @@ CdUnlockVolumeInternal (
|
|||||||
_In_opt_ PFILE_OBJECT FileObject
|
_In_opt_ PFILE_OBJECT FileObject
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Path table enumeration routines. Implemented in PathSup.c
|
// Path table enumeration routines. Implemented in PathSup.c
|
||||||
//
|
//
|
||||||
@@ -729,7 +729,7 @@ CdLookupNextPathEntry (
|
|||||||
_Inout_ PPATH_ENTRY PathEntry
|
_Inout_ PPATH_ENTRY PathEntry
|
||||||
);
|
);
|
||||||
|
|
||||||
_Success_(return != FALSE)
|
_Success_(return != FALSE)
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdFindPathEntry (
|
CdFindPathEntry (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -773,7 +773,7 @@ CdUpdatePathEntryName (
|
|||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Largest matching prefix searching routines, implemented in PrefxSup.c
|
// Largest matching prefix searching routines, implemented in PrefxSup.c
|
||||||
//
|
//
|
||||||
@@ -803,7 +803,7 @@ CdFindPrefix (
|
|||||||
_In_ BOOLEAN IgnoreCase
|
_In_ BOOLEAN IgnoreCase
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Synchronization routines. Implemented in Resrcsup.c
|
// Synchronization routines. Implemented in Resrcsup.c
|
||||||
//
|
//
|
||||||
@@ -825,7 +825,7 @@ CdFindPrefix (
|
|||||||
//
|
//
|
||||||
|
|
||||||
typedef enum _TYPE_OF_ACQUIRE {
|
typedef enum _TYPE_OF_ACQUIRE {
|
||||||
|
|
||||||
AcquireExclusive,
|
AcquireExclusive,
|
||||||
AcquireShared,
|
AcquireShared,
|
||||||
AcquireSharedStarveExclusive
|
AcquireSharedStarveExclusive
|
||||||
@@ -960,10 +960,10 @@ CdAcquireResource (
|
|||||||
|
|
||||||
#define CdAcquireCacheForRead( IC) \
|
#define CdAcquireCacheForRead( IC) \
|
||||||
ExAcquireResourceSharedLite( &(IC)->Vcb->SectorCacheResource, TRUE)
|
ExAcquireResourceSharedLite( &(IC)->Vcb->SectorCacheResource, TRUE)
|
||||||
|
|
||||||
#define CdAcquireCacheForUpdate( IC) \
|
#define CdAcquireCacheForUpdate( IC) \
|
||||||
ExAcquireResourceExclusiveLite( &(IC)->Vcb->SectorCacheResource, TRUE)
|
ExAcquireResourceExclusiveLite( &(IC)->Vcb->SectorCacheResource, TRUE)
|
||||||
|
|
||||||
#define CdReleaseCache( IC) \
|
#define CdReleaseCache( IC) \
|
||||||
ExReleaseResourceLite( &(IC)->Vcb->SectorCacheResource);
|
ExReleaseResourceLite( &(IC)->Vcb->SectorCacheResource);
|
||||||
|
|
||||||
@@ -1132,7 +1132,7 @@ CdReleaseForCreateSection (
|
|||||||
_In_ PFILE_OBJECT FileObject
|
_In_ PFILE_OBJECT FileObject
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// In-memory structure support routines. Implemented in StrucSup.c
|
// In-memory structure support routines. Implemented in StrucSup.c
|
||||||
//
|
//
|
||||||
@@ -1394,7 +1394,7 @@ CdOperationIsDasdOpen (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( IrpContext->Irp);
|
PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( IrpContext->Irp);
|
||||||
|
|
||||||
return ((IrpContext->MajorFunction == IRP_MJ_CREATE) &&
|
return ((IrpContext->MajorFunction == IRP_MJ_CREATE) &&
|
||||||
(IrpSp->FileObject->FileName.Length == 0) &&
|
(IrpSp->FileObject->FileName.Length == 0) &&
|
||||||
(IrpSp->FileObject->RelatedFileObject == NULL));
|
(IrpSp->FileObject->RelatedFileObject == NULL));
|
||||||
@@ -1449,7 +1449,7 @@ CdDismountVcb (
|
|||||||
#define CdUpdateVcbCondition( V, C) (V)->VcbCondition = (C)
|
#define CdUpdateVcbCondition( V, C) (V)->VcbCondition = (C)
|
||||||
|
|
||||||
#define CdMarkRealDevForVerify( DO) SetFlag( (DO)->Flags, DO_VERIFY_VOLUME)
|
#define CdMarkRealDevForVerify( DO) SetFlag( (DO)->Flags, DO_VERIFY_VOLUME)
|
||||||
|
|
||||||
#define CdMarkRealDevVerifyOk( DO) ClearFlag( (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) \
|
((S) == STATUS_NO_MEDIA_IN_DEVICE) \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Work queue routines for posting and retrieving an Irp, implemented in
|
// Work queue routines for posting and retrieving an Irp, implemented in
|
||||||
// workque.c
|
// workque.c
|
||||||
@@ -1497,7 +1497,7 @@ CdOplockComplete (
|
|||||||
_Inout_ PIRP Irp
|
_Inout_ PIRP Irp
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Miscellaneous support routines
|
// Miscellaneous support routines
|
||||||
//
|
//
|
||||||
@@ -1604,7 +1604,7 @@ CdOplockComplete (
|
|||||||
static /* ReactOS Change: GCC "multiple definition" */
|
static /* ReactOS Change: GCC "multiple definition" */
|
||||||
INLINE
|
INLINE
|
||||||
ULONG
|
ULONG
|
||||||
SectorsFromLlBytes(
|
SectorsFromLlBytes(
|
||||||
ULONGLONG Bytes
|
ULONGLONG Bytes
|
||||||
) {
|
) {
|
||||||
|
|
||||||
@@ -2025,7 +2025,7 @@ CdSerial32 (
|
|||||||
FastIoIsPossible)) \
|
FastIoIsPossible)) \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The FSP level dispatch/main routine. This is the routine that takes
|
// 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
|
// 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
|
// The following macros are used to establish the semantics needed
|
||||||
// to do a return from within a try-finally clause. As a rule every
|
// to do a return from within a try-finally clause. As a rule every
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ Abstract:
|
|||||||
+--------+ | Child |
|
+--------+ | Child |
|
||||||
| File |
|
| File |
|
||||||
+--------+
|
+--------+
|
||||||
|
|
||||||
Attached to each Directory Fcb is a prefix table containing the names
|
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
|
of children of this directory for which there is an Fcb. Not all Fcb's
|
||||||
will necessarily have an entry in this table.
|
will necessarily have an entry in this table.
|
||||||
@@ -112,7 +112,7 @@ Abstract:
|
|||||||
| Object|
|
| Object|
|
||||||
+--------+
|
+--------+
|
||||||
|
|
||||||
|
|
||||||
Synchronization:
|
Synchronization:
|
||||||
|
|
||||||
1. A resource in the CdData synchronizes access to the Vcb queue. This
|
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)
|
#define BYTE_COUNT_EMBEDDED_NAME (32)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The CD_MCB is used to store the mapping of logical file offset to
|
// The CD_MCB is used to store the mapping of logical file offset to
|
||||||
// logical disk offset. NOTE - This package only deals with the
|
// logical disk offset. NOTE - This package only deals with the
|
||||||
@@ -226,7 +226,7 @@ typedef struct _CD_MCB_ENTRY {
|
|||||||
} CD_MCB_ENTRY;
|
} CD_MCB_ENTRY;
|
||||||
typedef CD_MCB_ENTRY *PCD_MCB_ENTRY;
|
typedef CD_MCB_ENTRY *PCD_MCB_ENTRY;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cd name structure. The following structure is used to represent the
|
// Cd name structure. The following structure is used to represent the
|
||||||
// full Cdrom name. This name can be stored in either Unicode or ANSI
|
// full Cdrom name. This name can be stored in either Unicode or ANSI
|
||||||
@@ -265,7 +265,7 @@ typedef struct _NAME_LINK {
|
|||||||
} NAME_LINK;
|
} NAME_LINK;
|
||||||
typedef NAME_LINK *PNAME_LINK;
|
typedef NAME_LINK *PNAME_LINK;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Prefix entry. There is one of these for each name in the prefix table.
|
// 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
|
// 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_EXACT_CASE_IN_TREE (0x00000001)
|
||||||
#define PREFIX_FLAG_IGNORE_CASE_IN_TREE (0x00000002)
|
#define PREFIX_FLAG_IGNORE_CASE_IN_TREE (0x00000002)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The CD_DATA record is the top record in the CDROM file system in-memory
|
// 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.
|
// 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
|
// 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
|
// 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
|
// 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).
|
// leadout).
|
||||||
//
|
//
|
||||||
|
|
||||||
@@ -447,14 +447,14 @@ typedef struct _CDROM_TOC_LARGE {
|
|||||||
//
|
//
|
||||||
|
|
||||||
TRACK_DATA TrackData[ MAXIMUM_NUMBER_TRACKS_LARGE];
|
TRACK_DATA TrackData[ MAXIMUM_NUMBER_TRACKS_LARGE];
|
||||||
|
|
||||||
} CDROM_TOC_LARGE, *PCDROM_TOC_LARGE;
|
} CDROM_TOC_LARGE, *PCDROM_TOC_LARGE;
|
||||||
|
|
||||||
typedef struct _CD_SECTOR_CACHE_CHUNK {
|
typedef struct _CD_SECTOR_CACHE_CHUNK {
|
||||||
|
|
||||||
ULONG BaseLbn;
|
ULONG BaseLbn;
|
||||||
PUCHAR Buffer;
|
PUCHAR Buffer;
|
||||||
|
|
||||||
} CD_SECTOR_CACHE_CHUNK, *PCD_SECTOR_CACHE_CHUNK;
|
} CD_SECTOR_CACHE_CHUNK, *PCD_SECTOR_CACHE_CHUNK;
|
||||||
|
|
||||||
#define CD_SEC_CACHE_CHUNKS 4
|
#define CD_SEC_CACHE_CHUNKS 4
|
||||||
@@ -670,7 +670,7 @@ typedef struct _VCB {
|
|||||||
// Directory block cache. Read large numbers of blocks on directory
|
// Directory block cache. Read large numbers of blocks on directory
|
||||||
// reads, hoping to benefit from the fact that most mastered/pressed
|
// reads, hoping to benefit from the fact that most mastered/pressed
|
||||||
// discs clump metadata in one place thus allowing us to crudely
|
// 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.
|
// file copy etc.
|
||||||
//
|
//
|
||||||
// Note that the purpose of this is to PRE cache unread data,
|
// Note that the purpose of this is to PRE cache unread data,
|
||||||
@@ -681,7 +681,7 @@ typedef struct _VCB {
|
|||||||
PUCHAR SectorCacheBuffer;
|
PUCHAR SectorCacheBuffer;
|
||||||
CD_SECTOR_CACHE_CHUNK SecCacheChunks[ CD_SEC_CACHE_CHUNKS];
|
CD_SECTOR_CACHE_CHUNK SecCacheChunks[ CD_SEC_CACHE_CHUNKS];
|
||||||
ULONG SecCacheLRUChunkIndex;
|
ULONG SecCacheLRUChunkIndex;
|
||||||
|
|
||||||
PIRP SectorCacheIrp;
|
PIRP SectorCacheIrp;
|
||||||
KEVENT SectorCacheEvent;
|
KEVENT SectorCacheEvent;
|
||||||
ERESOURCE SectorCacheResource;
|
ERESOURCE SectorCacheResource;
|
||||||
@@ -715,7 +715,7 @@ typedef struct _VCB {
|
|||||||
#define VCB_STATE_SHUTDOWN (0x00000400)
|
#define VCB_STATE_SHUTDOWN (0x00000400)
|
||||||
#define VCB_STATE_DISMOUNTED (0x00000800)
|
#define VCB_STATE_DISMOUNTED (0x00000800)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Volume Device Object is an I/O system device object with a
|
// 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
|
// workqueue and an VCB record appended to the end. There are multiple
|
||||||
@@ -768,7 +768,7 @@ typedef struct _VOLUME_DEVICE_OBJECT {
|
|||||||
} VOLUME_DEVICE_OBJECT;
|
} VOLUME_DEVICE_OBJECT;
|
||||||
typedef VOLUME_DEVICE_OBJECT *PVOLUME_DEVICE_OBJECT;
|
typedef VOLUME_DEVICE_OBJECT *PVOLUME_DEVICE_OBJECT;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The following two structures are the separate union structures for
|
// The following two structures are the separate union structures for
|
||||||
// data and index Fcb's. The path table is actually the same structure
|
// data and index Fcb's. The path table is actually the same structure
|
||||||
@@ -1059,7 +1059,7 @@ typedef FCB *PFCB;
|
|||||||
#define SIZEOF_FCB_INDEX \
|
#define SIZEOF_FCB_INDEX \
|
||||||
(FIELD_OFFSET( FCB, FcbType ) + sizeof( FCB_INDEX ))
|
(FIELD_OFFSET( FCB, FcbType ) + sizeof( FCB_INDEX ))
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Ccb record is allocated for every file object
|
// 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_INITIALIZED (0x00200000)
|
||||||
#define CCB_FLAG_ENUM_NOMATCH_CONSTANT_ENTRY (0x00400000)
|
#define CCB_FLAG_ENUM_NOMATCH_CONSTANT_ENTRY (0x00400000)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Irp Context record is allocated for every orginating Irp. It is
|
// The Irp Context record is allocated for every orginating Irp. It is
|
||||||
// created by the Fsd dispatch routines, and deallocated by the CdComplete
|
// 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 \
|
IRP_CONTEXT_FLAG_IN_FSP \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Following structure is used to queue a request to the delayed close queue.
|
// Following structure is used to queue a request to the delayed close queue.
|
||||||
// This structure should be the minimum block allocation size.
|
// This structure should be the minimum block allocation size.
|
||||||
@@ -1307,7 +1307,7 @@ typedef struct _IRP_CONTEXT_LITE {
|
|||||||
} IRP_CONTEXT_LITE;
|
} IRP_CONTEXT_LITE;
|
||||||
typedef IRP_CONTEXT_LITE *PIRP_CONTEXT_LITE;
|
typedef IRP_CONTEXT_LITE *PIRP_CONTEXT_LITE;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Context structure for asynchronous I/O calls. Most of these fields
|
// Context structure for asynchronous I/O calls. Most of these fields
|
||||||
// are actually only required for the ReadMultiple routines, but
|
// are actually only required for the ReadMultiple routines, but
|
||||||
@@ -1350,7 +1350,7 @@ typedef struct _CD_IO_CONTEXT {
|
|||||||
} CD_IO_CONTEXT;
|
} CD_IO_CONTEXT;
|
||||||
typedef CD_IO_CONTEXT *PCD_IO_CONTEXT;
|
typedef CD_IO_CONTEXT *PCD_IO_CONTEXT;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Following structure is used to track the top level request. Each Cdfs
|
// 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
|
// Fsd and Fsp entry point will examine the top level irp location in the
|
||||||
@@ -1385,7 +1385,7 @@ typedef struct _THREAD_CONTEXT {
|
|||||||
} THREAD_CONTEXT;
|
} THREAD_CONTEXT;
|
||||||
typedef THREAD_CONTEXT *PTHREAD_CONTEXT;
|
typedef THREAD_CONTEXT *PTHREAD_CONTEXT;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The following structure is used for enumerating the entries in the
|
// 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
|
// 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 VACB_MAPPING_MASK (VACB_MAPPING_GRANULARITY - 1)
|
||||||
#define LAST_VACB_SECTOR_OFFSET (VACB_MAPPING_GRANULARITY - SECTOR_SIZE)
|
#define LAST_VACB_SECTOR_OFFSET (VACB_MAPPING_GRANULARITY - SECTOR_SIZE)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Path Entry. This is our representation of the on disk data.
|
// 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)
|
#define PATH_ENTRY_FLAG_ALLOC_BUFFER (0x00000001)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Compound path entry. This structure combines the on-disk entries
|
// Compound path entry. This structure combines the on-disk entries
|
||||||
// with the in-memory structures.
|
// with the in-memory structures.
|
||||||
@@ -1530,7 +1530,7 @@ typedef struct _COMPOUND_PATH_ENTRY {
|
|||||||
} COMPOUND_PATH_ENTRY;
|
} COMPOUND_PATH_ENTRY;
|
||||||
typedef COMPOUND_PATH_ENTRY *PCOMPOUND_PATH_ENTRY;
|
typedef COMPOUND_PATH_ENTRY *PCOMPOUND_PATH_ENTRY;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The following is used for enumerating through a directory via the
|
// The following is used for enumerating through a directory via the
|
||||||
// dirents.
|
// dirents.
|
||||||
@@ -1568,7 +1568,7 @@ typedef struct _DIRENT_ENUM_CONTEXT {
|
|||||||
} DIRENT_ENUM_CONTEXT;
|
} DIRENT_ENUM_CONTEXT;
|
||||||
typedef DIRENT_ENUM_CONTEXT *PDIRENT_ENUM_CONTEXT;
|
typedef DIRENT_ENUM_CONTEXT *PDIRENT_ENUM_CONTEXT;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Following structure is used to smooth out the differences in the HSG, ISO
|
// Following structure is used to smooth out the differences in the HSG, ISO
|
||||||
// and Joliett directory entries.
|
// and Joliett directory entries.
|
||||||
@@ -1672,7 +1672,7 @@ typedef DIRENT *PDIRENT;
|
|||||||
|
|
||||||
#define DIRENT_FLAG_NOT_PERSISTENT (0)
|
#define DIRENT_FLAG_NOT_PERSISTENT (0)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Following structure combines the on-disk information with the normalized
|
// Following structure combines the on-disk information with the normalized
|
||||||
// structure.
|
// structure.
|
||||||
@@ -1686,7 +1686,7 @@ typedef struct _COMPOUND_DIRENT {
|
|||||||
} COMPOUND_DIRENT;
|
} COMPOUND_DIRENT;
|
||||||
typedef COMPOUND_DIRENT *PCOMPOUND_DIRENT;
|
typedef COMPOUND_DIRENT *PCOMPOUND_DIRENT;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The following structure is used to enumerate the files in a directory.
|
// The following structure is used to enumerate the files in a directory.
|
||||||
// It contains three DirContext/Dirent pairs and then self pointers to
|
// 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)
|
#define FILE_CONTEXT_MULTIPLE_DIRENTS (0x00000001)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// RIFF header. Prepended to the data of a file containing XA sectors.
|
// 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
|
// 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;
|
} AUDIO_PLAY_HEADER;
|
||||||
typedef AUDIO_PLAY_HEADER *PAUDIO_PLAY_HEADER;
|
typedef AUDIO_PLAY_HEADER *PAUDIO_PLAY_HEADER;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Some macros for supporting the use of a Generic Table
|
// Some macros for supporting the use of a Generic Table
|
||||||
// containing all the FCB/DCBs and indexed by their FileId.
|
// containing all the FCB/DCBs and indexed by their FileId.
|
||||||
|
|||||||
@@ -132,9 +132,9 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
Vcb = Fcb->Vcb;
|
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
|
// flag on this fileobject. Once this flag is set, any further
|
||||||
// reads will be rejected (CdVerifyFcbOperation)
|
// reads will be rejected (CdVerifyFcbOperation)
|
||||||
//
|
//
|
||||||
@@ -152,30 +152,30 @@ Return Value:
|
|||||||
if (TypeOfOpen == UserVolumeOpen) {
|
if (TypeOfOpen == UserVolumeOpen) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// For a force dismount, physically disconnect this Vcb from the device so
|
// 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
|
// 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
|
// 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.
|
// call check for dismount again later after we process this close.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (FlagOn( Ccb->Flags, CCB_FLAG_DISMOUNT_ON_CLOSE )) {
|
if (FlagOn( Ccb->Flags, CCB_FLAG_DISMOUNT_ON_CLOSE )) {
|
||||||
|
|
||||||
CdAcquireCdData( IrpContext );
|
CdAcquireCdData( IrpContext );
|
||||||
|
|
||||||
CdCheckForDismount( IrpContext, Vcb, TRUE );
|
CdCheckForDismount( IrpContext, Vcb, TRUE );
|
||||||
|
|
||||||
CdReleaseCdData( IrpContext );
|
CdReleaseCdData( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// If this handle actually wrote something, flush the device buffers,
|
// 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
|
// and then set the verify bit now just to be safe (in case there is no
|
||||||
// dismount).
|
// dismount).
|
||||||
//
|
//
|
||||||
|
|
||||||
} else if (FlagOn( FileObject->Flags, FO_FILE_MODIFIED )) {
|
} else if (FlagOn( FileObject->Flags, FO_FILE_MODIFIED )) {
|
||||||
|
|
||||||
CdHijackIrpAndFlushDevice( IrpContext, Irp, Vcb->TargetDeviceObject );
|
CdHijackIrpAndFlushDevice( IrpContext, Irp, Vcb->TargetDeviceObject );
|
||||||
|
|
||||||
CdMarkDevForVerifyIfVcbMounted( Vcb );
|
CdMarkDevForVerifyIfVcbMounted( Vcb );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -185,13 +185,13 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
CdAcquireFcbExclusive( IrpContext, Fcb, FALSE );
|
CdAcquireFcbExclusive( IrpContext, Fcb, FALSE );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Use a try-finally to facilitate cleanup.
|
// Use a try-finally to facilitate cleanup.
|
||||||
//
|
//
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Case on the type of open that we are trying to cleanup.
|
// Case on the type of open that we are trying to cleanup.
|
||||||
//
|
//
|
||||||
@@ -259,7 +259,7 @@ Return Value:
|
|||||||
default :
|
default :
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma prefast( suppress:__WARNING_USE_OTHER_FUNCTION, "argument bogus" )
|
#pragma prefast( suppress:__WARNING_USE_OTHER_FUNCTION, "argument bogus" )
|
||||||
#endif
|
#endif
|
||||||
CdBugCheck( TypeOfOpen, 0, 0 );
|
CdBugCheck( TypeOfOpen, 0, 0 );
|
||||||
}
|
}
|
||||||
@@ -293,14 +293,14 @@ Return Value:
|
|||||||
|
|
||||||
NT_ASSERT( FlagOn( Vcb->VcbState, VCB_STATE_LOCKED));
|
NT_ASSERT( FlagOn( Vcb->VcbState, VCB_STATE_LOCKED));
|
||||||
|
|
||||||
IoAcquireVpbSpinLock( &SavedIrql );
|
IoAcquireVpbSpinLock( &SavedIrql );
|
||||||
|
|
||||||
ClearFlag( Vcb->Vpb->Flags, VPB_LOCKED);
|
ClearFlag( Vcb->Vpb->Flags, VPB_LOCKED);
|
||||||
ClearFlag( Vcb->VcbState, VCB_STATE_LOCKED );
|
ClearFlag( Vcb->VcbState, VCB_STATE_LOCKED );
|
||||||
Vcb->VolumeLockFileObject = NULL;
|
Vcb->VolumeLockFileObject = NULL;
|
||||||
SendUnlockNotification = TRUE;
|
SendUnlockNotification = TRUE;
|
||||||
|
|
||||||
IoReleaseVpbSpinLock( SavedIrql );
|
IoReleaseVpbSpinLock( SavedIrql );
|
||||||
}
|
}
|
||||||
|
|
||||||
CdUnlockVcb( IrpContext, Vcb );
|
CdUnlockVcb( IrpContext, Vcb );
|
||||||
@@ -316,9 +316,9 @@ Return Value:
|
|||||||
} _SEH2_FINALLY {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
CdReleaseFcb( IrpContext, Fcb );
|
CdReleaseFcb( IrpContext, Fcb );
|
||||||
|
|
||||||
if (SendUnlockNotification) {
|
if (SendUnlockNotification) {
|
||||||
|
|
||||||
FsRtlNotifyVolumeEvent( FileObject, FSRTL_VOLUME_UNLOCK );
|
FsRtlNotifyVolumeEvent( FileObject, FSRTL_VOLUME_UNLOCK );
|
||||||
}
|
}
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
@@ -328,7 +328,7 @@ Return Value:
|
|||||||
// this very fileobject we were cleaning up be the last reason for the
|
// this very fileobject we were cleaning up be the last reason for the
|
||||||
// volume to remain, teardown will commence on completion of this Irp.
|
// volume to remain, teardown will commence on completion of this Irp.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (AttemptTeardown) {
|
if (AttemptTeardown) {
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -336,20 +336,20 @@ Return Value:
|
|||||||
// may acquire CdData if there is a possibility of tearing the volume
|
// may acquire CdData if there is a possibility of tearing the volume
|
||||||
// down.
|
// down.
|
||||||
//
|
//
|
||||||
|
|
||||||
CdAcquireCdData( IrpContext);
|
CdAcquireCdData( IrpContext);
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
|
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
|
||||||
VcbAcquired = TRUE;
|
VcbAcquired = TRUE;
|
||||||
|
|
||||||
CdPurgeVolume( IrpContext, Vcb, FALSE );
|
CdPurgeVolume( IrpContext, Vcb, FALSE );
|
||||||
|
|
||||||
} _SEH2_FINALLY {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
if (VcbAcquired) { CdReleaseVcb( IrpContext, Vcb ); }
|
if (VcbAcquired) { CdReleaseVcb( IrpContext, Vcb ); }
|
||||||
|
|
||||||
CdReleaseCdData( IrpContext);
|
CdReleaseCdData( IrpContext);
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ Return Value:
|
|||||||
// to do here is prevent this routine starving other threads which
|
// to do here is prevent this routine starving other threads which
|
||||||
// may need this Vcb exclusively.
|
// 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.
|
// repeat later within the cddata lock.
|
||||||
//
|
//
|
||||||
|
|
||||||
@@ -260,7 +260,7 @@ Return Value:
|
|||||||
(Fcb->Vcb->VcbCondition != VcbMounted) &&
|
(Fcb->Vcb->VcbCondition != VcbMounted) &&
|
||||||
(Fcb->Vcb->VcbCondition != VcbMountInProgress) &&
|
(Fcb->Vcb->VcbCondition != VcbMountInProgress) &&
|
||||||
(Fcb->Vcb->VcbCleanup == 0);
|
(Fcb->Vcb->VcbCleanup == 0);
|
||||||
|
|
||||||
if (!PotentialVcbTeardown) {
|
if (!PotentialVcbTeardown) {
|
||||||
|
|
||||||
CdReleaseCdData( IrpContext);
|
CdReleaseCdData( IrpContext);
|
||||||
@@ -270,7 +270,7 @@ Return Value:
|
|||||||
CurrentVcb = Fcb->Vcb;
|
CurrentVcb = Fcb->Vcb;
|
||||||
|
|
||||||
_Analysis_assume_( CurrentVcb != NULL );
|
_Analysis_assume_( CurrentVcb != NULL );
|
||||||
|
|
||||||
CdAcquireVcbShared( IrpContext, CurrentVcb, FALSE );
|
CdAcquireVcbShared( IrpContext, CurrentVcb, FALSE );
|
||||||
|
|
||||||
VcbHoldCount = 0;
|
VcbHoldCount = 0;
|
||||||
@@ -404,7 +404,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Clean up any CCB associated with this open.
|
// Clean up any CCB associated with this open.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (Ccb != NULL) {
|
if (Ccb != NULL) {
|
||||||
|
|
||||||
UserReference = 1;
|
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
|
// currently mounted volume, then post it to the delayed close queue. Note
|
||||||
// that the VcbCondition check is unsafe, but it doesn't really matter -
|
// 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.
|
// 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.
|
// if we can't acquire all of the resources.
|
||||||
//
|
//
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -449,7 +449,7 @@ Return Value:
|
|||||||
// a number of other Fcbs (and thus their references), a simple check
|
// a number of other Fcbs (and thus their references), a simple check
|
||||||
// on reference count is not appropriate.
|
// 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.
|
// common case.
|
||||||
//
|
//
|
||||||
|
|
||||||
@@ -487,7 +487,7 @@ Return Value:
|
|||||||
CdReleaseCdData( IrpContext );
|
CdReleaseCdData( IrpContext );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Call the worker routine to perform the actual work. This routine
|
// Call the worker routine to perform the actual work. This routine
|
||||||
// should never raise except for a fatal error.
|
// should never raise except for a fatal error.
|
||||||
@@ -507,7 +507,7 @@ Return Value:
|
|||||||
// the request.
|
// the request.
|
||||||
//
|
//
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (PotentialVcbTeardown) {
|
else if (PotentialVcbTeardown) {
|
||||||
|
|
||||||
CdCheckForDismount( IrpContext, Vcb, FALSE );
|
CdCheckForDismount( IrpContext, Vcb, FALSE );
|
||||||
@@ -532,7 +532,7 @@ Return Value:
|
|||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -685,7 +685,7 @@ Return Value:
|
|||||||
CdFspClose (NULL);
|
CdFspClose (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdQueueClose (
|
CdQueueClose (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -868,7 +868,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ CdCompleteFcbOpen (
|
|||||||
#pragma alloc_text(PAGE, CdOpenFileFromFileContext)
|
#pragma alloc_text(PAGE, CdOpenFileFromFileContext)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@@ -1018,7 +1018,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -1106,7 +1106,7 @@ Return Value:
|
|||||||
// This is here because the Win32 layer can't avoid sending me double
|
// This is here because the Win32 layer can't avoid sending me double
|
||||||
// beginning backslashes.
|
// beginning backslashes.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ((FileName->Length > sizeof( WCHAR )) &&
|
if ((FileName->Length > sizeof( WCHAR )) &&
|
||||||
(FileName->Buffer[1] == L'\\') &&
|
(FileName->Buffer[1] == L'\\') &&
|
||||||
(FileName->Buffer[0] == L'\\')) {
|
(FileName->Buffer[0] == L'\\')) {
|
||||||
@@ -1246,12 +1246,12 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Check for an overflow of the maximum filename size.
|
// Check for an overflow of the maximum filename size.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (BufferLength > MAXUSHORT) {
|
if (BufferLength > MAXUSHORT) {
|
||||||
|
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Now see if we need to allocate a new buffer.
|
// Now see if we need to allocate a new buffer.
|
||||||
//
|
//
|
||||||
@@ -1469,7 +1469,7 @@ Return Value:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -1973,7 +1973,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -2075,7 +2075,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -2257,7 +2257,7 @@ Return Value:
|
|||||||
|
|
||||||
ParentFcb = *CurrentFcb;
|
ParentFcb = *CurrentFcb;
|
||||||
*CurrentFcb = NextFcb;
|
*CurrentFcb = NextFcb;
|
||||||
|
|
||||||
// Lock object is acquired using internal state
|
// Lock object is acquired using internal state
|
||||||
_Analysis_suppress_lock_checking_(NextFcb->FcbNonpaged->FcbResource);
|
_Analysis_suppress_lock_checking_(NextFcb->FcbNonpaged->FcbResource);
|
||||||
|
|
||||||
@@ -2358,7 +2358,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -2648,7 +2648,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -2714,12 +2714,12 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
if (MAXIMUM_ALLOWED == DesiredAccess) {
|
if (MAXIMUM_ALLOWED == DesiredAccess) {
|
||||||
|
|
||||||
DesiredAccess = FILE_ALL_ACCESS & ~((TypeOfOpen != UserVolumeOpen ?
|
DesiredAccess = FILE_ALL_ACCESS & ~((TypeOfOpen != UserVolumeOpen ?
|
||||||
(FILE_WRITE_ATTRIBUTES |
|
(FILE_WRITE_ATTRIBUTES |
|
||||||
FILE_WRITE_DATA |
|
FILE_WRITE_DATA |
|
||||||
FILE_WRITE_EA |
|
FILE_WRITE_EA |
|
||||||
FILE_ADD_FILE |
|
FILE_ADD_FILE |
|
||||||
FILE_ADD_SUBDIRECTORY |
|
FILE_ADD_SUBDIRECTORY |
|
||||||
FILE_APPEND_DATA) : 0) |
|
FILE_APPEND_DATA) : 0) |
|
||||||
FILE_DELETE_CHILD |
|
FILE_DELETE_CHILD |
|
||||||
@@ -2778,7 +2778,7 @@ Return Value:
|
|||||||
return STATUS_SHARING_VIOLATION;
|
return STATUS_SHARING_VIOLATION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// If the Fcb already existed then we need to check the oplocks and
|
// If the Fcb already existed then we need to check the oplocks and
|
||||||
// the share access.
|
// the share access.
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ CdDevCtrlCompletionRoutine (
|
|||||||
#pragma alloc_text(PAGE, CdCommonDevControl)
|
#pragma alloc_text(PAGE, CdCommonDevControl)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdCommonDevControl (
|
CdCommonDevControl (
|
||||||
_Inout_ PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -167,7 +167,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
|
|||||||
+111
-111
@@ -237,17 +237,17 @@ Routine Description:
|
|||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Msf - on output, set to 0xMmSsFf representation of blocks.
|
Msf - on output, set to 0xMmSsFf representation of blocks.
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
Blocks += 150; // Lbn 0 == 00:02:00, 1sec == 75 frames.
|
Blocks += 150; // Lbn 0 == 00:02:00, 1sec == 75 frames.
|
||||||
|
|
||||||
Msf[0] = (UCHAR)(Blocks % 75); // Frames
|
Msf[0] = (UCHAR)(Blocks % 75); // Frames
|
||||||
Blocks /= 75; // -> Seconds
|
Blocks /= 75; // -> Seconds
|
||||||
Msf[1] = (UCHAR)(Blocks % 60); // Seconds
|
Msf[1] = (UCHAR)(Blocks % 60); // Seconds
|
||||||
Blocks /= 60; // -> Minutes
|
Blocks /= 60; // -> Minutes
|
||||||
Msf[2] = (UCHAR)Blocks; // Minutes
|
Msf[2] = (UCHAR)Blocks; // Minutes
|
||||||
}
|
}
|
||||||
@@ -289,16 +289,16 @@ Return Value:
|
|||||||
return CDDA;
|
return CDDA;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// FCB_STATE_MODE2_FILE
|
// FCB_STATE_MODE2_FILE
|
||||||
//
|
//
|
||||||
|
|
||||||
return YellowMode2;
|
return YellowMode2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdNonCachedRead (
|
CdNonCachedRead (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -388,7 +388,7 @@ Return Value:
|
|||||||
// If we're going to use the sector cache for this request, then
|
// If we're going to use the sector cache for this request, then
|
||||||
// mark the request waitable.
|
// mark the request waitable.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ((SafeNodeType( Fcb) == CDFS_NTC_FCB_INDEX) &&
|
if ((SafeNodeType( Fcb) == CDFS_NTC_FCB_INDEX) &&
|
||||||
(NULL != Fcb->Vcb->SectorCacheBuffer) &&
|
(NULL != Fcb->Vcb->SectorCacheBuffer) &&
|
||||||
(VcbMounted == IrpContext->Vcb->VcbCondition)) {
|
(VcbMounted == IrpContext->Vcb->VcbCondition)) {
|
||||||
@@ -418,7 +418,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Call prepare buffers to set up the next entries
|
// Call prepare buffers to set up the next entries
|
||||||
// in the IoRuns array. Remember if there are any
|
// 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.
|
// if there are unaligned entries for an async request.
|
||||||
//
|
//
|
||||||
|
|
||||||
@@ -529,7 +529,7 @@ Return Value:
|
|||||||
|
|
||||||
FlushIoBuffers = TRUE;
|
FlushIoBuffers = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
CleanupRunCount = 0;
|
CleanupRunCount = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -583,9 +583,9 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdNonCachedXARead (
|
CdNonCachedXARead (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -726,14 +726,14 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Note: LBN 0 == 0:2:0 (MSF)
|
// Note: LBN 0 == 0:2:0 (MSF)
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// Fill in the address (both MSF and Lbn format) and length fields.
|
// Fill in the address (both MSF and Lbn format) and length fields.
|
||||||
//
|
//
|
||||||
|
|
||||||
SwapCopyUchar4( &Address, TrackData->Address);
|
SwapCopyUchar4( &Address, TrackData->Address);
|
||||||
CdLbnToMmSsFf( Address, AudioPlayHeader->TrackAddress);
|
CdLbnToMmSsFf( Address, AudioPlayHeader->TrackAddress);
|
||||||
|
|
||||||
SwapCopyUchar4( &AudioPlayHeader->StartingSector, TrackData->Address);
|
SwapCopyUchar4( &AudioPlayHeader->StartingSector, TrackData->Address);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -809,9 +809,9 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// CD-XA non-audio
|
// CD-XA non-audio
|
||||||
//
|
//
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
NT_ASSERT( FlagOn( Fcb->FcbState, FCB_STATE_MODE2_FILE | FCB_STATE_MODE2FORM2_FILE ));
|
NT_ASSERT( FlagOn( Fcb->FcbState, FCB_STATE_MODE2_FILE | FCB_STATE_MODE2FORM2_FILE ));
|
||||||
|
|
||||||
RiffHeader = &LocalRiffHeader;
|
RiffHeader = &LocalRiffHeader;
|
||||||
@@ -869,7 +869,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
if (!TryingYellowbookMode2) {
|
if (!TryingYellowbookMode2) {
|
||||||
|
|
||||||
RtlZeroMemory( IoRuns, sizeof( IoRuns ));
|
RtlZeroMemory( IoRuns, sizeof( IoRuns ));
|
||||||
RtlZeroMemory( RawReads, sizeof( RawReads ));
|
RtlZeroMemory( RawReads, sizeof( RawReads ));
|
||||||
|
|
||||||
@@ -884,7 +884,7 @@ Return Value:
|
|||||||
&CleanupRunCount,
|
&CleanupRunCount,
|
||||||
&ThisByteCount );
|
&ThisByteCount );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Perform multiple Io to read in the data. Note that
|
// Perform multiple Io to read in the data. Note that
|
||||||
// there may be no Io to do if we were able to use an
|
// 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 (!NT_SUCCESS( Status )) {
|
||||||
|
|
||||||
if (!TryingYellowbookMode2 &&
|
if (!TryingYellowbookMode2 &&
|
||||||
FlagOn( Fcb->FcbState, FCB_STATE_MODE2FORM2_FILE )) {
|
FlagOn( Fcb->FcbState, FCB_STATE_MODE2FORM2_FILE )) {
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -926,11 +926,11 @@ Return Value:
|
|||||||
|
|
||||||
TryingYellowbookMode2 = TRUE;
|
TryingYellowbookMode2 = TRUE;
|
||||||
TrackMode = YellowMode2;
|
TrackMode = YellowMode2;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Clear our 'cumulative' error status value
|
// Clear our 'cumulative' error status value
|
||||||
//
|
//
|
||||||
|
|
||||||
IrpContext->IoContext->Status = STATUS_SUCCESS;
|
IrpContext->IoContext->Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@@ -938,9 +938,9 @@ Return Value:
|
|||||||
|
|
||||||
try_return( NOTHING );
|
try_return( NOTHING );
|
||||||
}
|
}
|
||||||
|
|
||||||
CleanupRunCount = 0;
|
CleanupRunCount = 0;
|
||||||
|
|
||||||
if (TryingYellowbookMode2) {
|
if (TryingYellowbookMode2) {
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1008,7 +1008,7 @@ CdVolumeDasdWrite (
|
|||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
This routine performs the non-cached writes to 'cooked' sectors (2048 bytes
|
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.
|
and send it down to the device.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
@@ -1075,7 +1075,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdReadSectors (
|
CdReadSectors (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -1216,7 +1216,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdCreateUserMdl (
|
CdCreateUserMdl (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -1324,7 +1324,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdPerformDevIoCtrlEx (
|
CdPerformDevIoCtrlEx (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -1456,20 +1456,20 @@ CdPerformDevIoCtrl (
|
|||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
return CdPerformDevIoCtrlEx( IrpContext,
|
return CdPerformDevIoCtrlEx( IrpContext,
|
||||||
IoControlCode,
|
IoControlCode,
|
||||||
Device,
|
Device,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
OutputBuffer,
|
OutputBuffer,
|
||||||
OutputBufferLength,
|
OutputBufferLength,
|
||||||
InternalDeviceIoControl,
|
InternalDeviceIoControl,
|
||||||
OverrideVerify,
|
OverrideVerify,
|
||||||
Iosb);
|
Iosb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -1628,7 +1628,7 @@ Return Value:
|
|||||||
(CurrentByteCount < SECTOR_SIZE))) {
|
(CurrentByteCount < SECTOR_SIZE))) {
|
||||||
|
|
||||||
NT_ASSERT( SafeNodeType(Fcb) != CDFS_NTC_FCB_INDEX);
|
NT_ASSERT( SafeNodeType(Fcb) != CDFS_NTC_FCB_INDEX);
|
||||||
|
|
||||||
//
|
//
|
||||||
// If we can't wait then raise.
|
// If we can't wait then raise.
|
||||||
//
|
//
|
||||||
@@ -1769,7 +1769,7 @@ Return Value:
|
|||||||
return FoundUnaligned;
|
return FoundUnaligned;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -1893,7 +1893,7 @@ Return Value:
|
|||||||
CurrentRawOffset = (LONGLONG) ((ULONG) CurrentRawOffset / RAW_SECTOR_SIZE);
|
CurrentRawOffset = (LONGLONG) ((ULONG) CurrentRawOffset / RAW_SECTOR_SIZE);
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#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
|
#endif
|
||||||
CurrentCookedOffset = (LONGLONG) ((ULONG) CurrentRawOffset << SECTOR_SHIFT );
|
CurrentCookedOffset = (LONGLONG) ((ULONG) CurrentRawOffset << SECTOR_SHIFT );
|
||||||
|
|
||||||
@@ -1940,7 +1940,7 @@ Return Value:
|
|||||||
*RunCount += 1;
|
*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.
|
// eventual destination in the user's buffer for this portion of the transfer.
|
||||||
//
|
//
|
||||||
|
|
||||||
@@ -2050,7 +2050,7 @@ Return Value:
|
|||||||
// following are true:
|
// following are true:
|
||||||
//
|
//
|
||||||
// If we are to store the beginning of the raw sector in the user's buffer.
|
// 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)
|
// (and hence also lies within it)
|
||||||
// There are enough bytes remaining in the buffer for at least one
|
// There are enough bytes remaining in the buffer for at least one
|
||||||
// raw sector.
|
// raw sector.
|
||||||
@@ -2068,7 +2068,7 @@ Return Value:
|
|||||||
if (CurrentCookedByteCount <= Fcb->Vcb->MaximumTransferRawSectors * SECTOR_SIZE) {
|
if (CurrentCookedByteCount <= Fcb->Vcb->MaximumTransferRawSectors * SECTOR_SIZE) {
|
||||||
|
|
||||||
CurrentRawByteCount = (SectorAlign( CurrentCookedByteCount) >> SECTOR_SHIFT) * RAW_SECTOR_SIZE;
|
CurrentRawByteCount = (SectorAlign( CurrentCookedByteCount) >> SECTOR_SHIFT) * RAW_SECTOR_SIZE;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
CurrentCookedByteCount = Fcb->Vcb->MaximumTransferRawSectors * SECTOR_SIZE;
|
CurrentCookedByteCount = Fcb->Vcb->MaximumTransferRawSectors * SECTOR_SIZE;
|
||||||
@@ -2079,7 +2079,7 @@ Return Value:
|
|||||||
// Now make sure we are within the page transfer limit.
|
// 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 ) {
|
Fcb->Vcb->MaximumPhysicalPages ) {
|
||||||
|
|
||||||
CurrentRawByteCount -= RAW_SECTOR_SIZE;
|
CurrentRawByteCount -= RAW_SECTOR_SIZE;
|
||||||
@@ -2105,7 +2105,7 @@ Return Value:
|
|||||||
|
|
||||||
CurrentRawByteCount = RemainingRawByteCount;
|
CurrentRawByteCount = RemainingRawByteCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Update the IO run array. We point to the scratch buffer as
|
// Update the IO run array. We point to the scratch buffer as
|
||||||
// well as the buffer and Mdl in the original Irp.
|
// well as the buffer and Mdl in the original Irp.
|
||||||
@@ -2119,7 +2119,7 @@ Return Value:
|
|||||||
|
|
||||||
ThisIoRun->TransferBuffer = CurrentUserBuffer;
|
ThisIoRun->TransferBuffer = CurrentUserBuffer;
|
||||||
ThisIoRun->TransferMdl = Irp->MdlAddress;
|
ThisIoRun->TransferMdl = Irp->MdlAddress;
|
||||||
ThisIoRun->TransferVirtualAddress = Add2Ptr( Irp->UserBuffer,
|
ThisIoRun->TransferVirtualAddress = Add2Ptr( Irp->UserBuffer,
|
||||||
CurrentUserBufferOffset,
|
CurrentUserBufferOffset,
|
||||||
PVOID);
|
PVOID);
|
||||||
|
|
||||||
@@ -2210,7 +2210,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -2423,7 +2423,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// We don't want IO to get our IRP and free it.
|
// We don't want IO to get our IRP and free it.
|
||||||
//
|
//
|
||||||
|
|
||||||
return STATUS_MORE_PROCESSING_REQUIRED;
|
return STATUS_MORE_PROCESSING_REQUIRED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2452,7 +2452,7 @@ Return Value:
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
if (NULL != IrpContext->Vcb->SectorCacheBuffer) {
|
if (NULL != IrpContext->Vcb->SectorCacheBuffer) {
|
||||||
|
|
||||||
CdAcquireCacheForUpdate( IrpContext);
|
CdAcquireCacheForUpdate( IrpContext);
|
||||||
CdFreePool( &IrpContext->Vcb->SectorCacheBuffer);
|
CdFreePool( &IrpContext->Vcb->SectorCacheBuffer);
|
||||||
CdReleaseCache( IrpContext);
|
CdReleaseCache( IrpContext);
|
||||||
@@ -2465,7 +2465,7 @@ CdReadDirDataThroughCache (
|
|||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
_In_ PIO_RUN Run
|
_In_ PIO_RUN Run
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
@@ -2520,18 +2520,18 @@ Return Value:
|
|||||||
CdAcquireCacheForRead( IrpContext);
|
CdAcquireCacheForRead( IrpContext);
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check the cache hasn't gone away due to volume verify failure (which
|
// 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.
|
// the same error any I/O would return if the cache weren't here.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (NULL == Vcb->SectorCacheBuffer) {
|
if (NULL == Vcb->SectorCacheBuffer) {
|
||||||
|
|
||||||
CdRaiseStatus( IrpContext, STATUS_VERIFY_REQUIRED);
|
CdRaiseStatus( IrpContext, STATUS_VERIFY_REQUIRED);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (Remaining) {
|
while (Remaining) {
|
||||||
|
|
||||||
Buffer = NULL;
|
Buffer = NULL;
|
||||||
@@ -2539,7 +2539,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Look to see if any portion is currently cached.
|
// Look to see if any portion is currently cached.
|
||||||
//
|
//
|
||||||
|
|
||||||
for (Index = 0; Index < CD_SEC_CACHE_CHUNKS; Index++) {
|
for (Index = 0; Index < CD_SEC_CACHE_CHUNKS; Index++) {
|
||||||
|
|
||||||
if ((Vcb->SecCacheChunks[ Index].BaseLbn != -1) &&
|
if ((Vcb->SecCacheChunks[ Index].BaseLbn != -1) &&
|
||||||
@@ -2560,8 +2560,8 @@ Return Value:
|
|||||||
BufferSectorOffset = Lbn - Buffer->BaseLbn;
|
BufferSectorOffset = Lbn - Buffer->BaseLbn;
|
||||||
Found = Min( CD_SEC_CHUNK_BLOCKS - BufferSectorOffset, Remaining);
|
Found = Min( CD_SEC_CHUNK_BLOCKS - BufferSectorOffset, Remaining);
|
||||||
|
|
||||||
RtlCopyMemory( UserBuffer,
|
RtlCopyMemory( UserBuffer,
|
||||||
Buffer->Buffer + BytesFromSectors( BufferSectorOffset),
|
Buffer->Buffer + BytesFromSectors( BufferSectorOffset),
|
||||||
BytesFromSectors( Found));
|
BytesFromSectors( Found));
|
||||||
|
|
||||||
Remaining -= Found;
|
Remaining -= Found;
|
||||||
@@ -2571,14 +2571,14 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Update stats. Don't count a hit if we've just read the data in.
|
// Update stats. Don't count a hit if we've just read the data in.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (!JustRead) {
|
if (!JustRead) {
|
||||||
|
|
||||||
InterlockedIncrement( (LONG*)&Vcb->SecCacheHits);
|
InterlockedIncrement( (LONG*)&Vcb->SecCacheHits);
|
||||||
}
|
}
|
||||||
|
|
||||||
JustRead = FALSE;
|
JustRead = FALSE;
|
||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2589,18 +2589,18 @@ Return Value:
|
|||||||
|
|
||||||
CdReleaseCache( IrpContext);
|
CdReleaseCache( IrpContext);
|
||||||
CdAcquireCacheForUpdate( IrpContext);
|
CdAcquireCacheForUpdate( IrpContext);
|
||||||
#if DBG
|
#if DBG
|
||||||
Vcb->SecCacheMisses += 1;
|
Vcb->SecCacheMisses += 1;
|
||||||
#endif
|
#endif
|
||||||
//
|
//
|
||||||
// Select the chunk to replace and calculate the start block of the
|
// Select the chunk to replace and calculate the start block of the
|
||||||
// chunk to cache. We cache blocks which start on Lbns aligned on
|
// chunk to cache. We cache blocks which start on Lbns aligned on
|
||||||
// multiples of chunk size, treating block 16 (VRS start) as block
|
// multiples of chunk size, treating block 16 (VRS start) as block
|
||||||
// zero.
|
// zero.
|
||||||
//
|
//
|
||||||
|
|
||||||
Buffer = &Vcb->SecCacheChunks[ Vcb->SecCacheLRUChunkIndex];
|
Buffer = &Vcb->SecCacheChunks[ Vcb->SecCacheLRUChunkIndex];
|
||||||
|
|
||||||
StartBlock = Lbn - ((Lbn - 16) % CD_SEC_CHUNK_BLOCKS);
|
StartBlock = Lbn - ((Lbn - 16) % CD_SEC_CHUNK_BLOCKS);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2635,58 +2635,58 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Now build / send the read request.
|
// Now build / send the read request.
|
||||||
//
|
//
|
||||||
|
|
||||||
IoReuseIrp( Vcb->SectorCacheIrp, STATUS_SUCCESS);
|
IoReuseIrp( Vcb->SectorCacheIrp, STATUS_SUCCESS);
|
||||||
|
|
||||||
KeClearEvent( &Vcb->SectorCacheEvent);
|
KeClearEvent( &Vcb->SectorCacheEvent);
|
||||||
Vcb->SectorCacheIrp->Tail.Overlay.Thread = PsGetCurrentThread();
|
Vcb->SectorCacheIrp->Tail.Overlay.Thread = PsGetCurrentThread();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get a pointer to the stack location of the first driver which will be
|
// 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.
|
// invoked. This is where the function codes and the parameters are set.
|
||||||
//
|
//
|
||||||
|
|
||||||
IrpSp = IoGetNextIrpStackLocation( Vcb->SectorCacheIrp);
|
IrpSp = IoGetNextIrpStackLocation( Vcb->SectorCacheIrp);
|
||||||
IrpSp->MajorFunction = (UCHAR) IRP_MJ_READ;
|
IrpSp->MajorFunction = (UCHAR) IRP_MJ_READ;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Build an MDL to describe the buffer.
|
// Build an MDL to describe the buffer.
|
||||||
//
|
//
|
||||||
|
|
||||||
IoAllocateMdl( Buffer->Buffer,
|
IoAllocateMdl( Buffer->Buffer,
|
||||||
BytesFromSectors( Blocks),
|
BytesFromSectors( Blocks),
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE,
|
FALSE,
|
||||||
Vcb->SectorCacheIrp);
|
Vcb->SectorCacheIrp);
|
||||||
|
|
||||||
if (NULL == Vcb->SectorCacheIrp->MdlAddress) {
|
if (NULL == Vcb->SectorCacheIrp->MdlAddress) {
|
||||||
|
|
||||||
IrpContext->Irp->IoStatus.Information = 0;
|
IrpContext->Irp->IoStatus.Information = 0;
|
||||||
CdRaiseStatus( IrpContext, STATUS_INSUFFICIENT_RESOURCES);
|
CdRaiseStatus( IrpContext, STATUS_INSUFFICIENT_RESOURCES);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// We're reading/writing into the block cache (paged pool). Lock the
|
// We're reading/writing into the block cache (paged pool). Lock the
|
||||||
// pages and update the MDL with physical page information.
|
// pages and update the MDL with physical page information.
|
||||||
//
|
//
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
MmProbeAndLockPages( Vcb->SectorCacheIrp->MdlAddress,
|
MmProbeAndLockPages( Vcb->SectorCacheIrp->MdlAddress,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
(LOCK_OPERATION) IoWriteAccess );
|
(LOCK_OPERATION) IoWriteAccess );
|
||||||
}
|
}
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(suppress: 6320)
|
#pragma warning(suppress: 6320)
|
||||||
#endif
|
#endif
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
|
||||||
|
|
||||||
IoFreeMdl( Vcb->SectorCacheIrp->MdlAddress );
|
IoFreeMdl( Vcb->SectorCacheIrp->MdlAddress );
|
||||||
Vcb->SectorCacheIrp->MdlAddress = NULL;
|
Vcb->SectorCacheIrp->MdlAddress = NULL;
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
|
|
||||||
if (NULL == Vcb->SectorCacheIrp->MdlAddress) {
|
if (NULL == Vcb->SectorCacheIrp->MdlAddress) {
|
||||||
|
|
||||||
CdRaiseStatus( IrpContext, STATUS_INSUFFICIENT_RESOURCES );
|
CdRaiseStatus( IrpContext, STATUS_INSUFFICIENT_RESOURCES );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2706,11 +2706,11 @@ Return Value:
|
|||||||
TRUE,
|
TRUE,
|
||||||
TRUE,
|
TRUE,
|
||||||
TRUE );
|
TRUE );
|
||||||
|
|
||||||
Vcb->SectorCacheIrp->UserIosb = &Iosb;
|
Vcb->SectorCacheIrp->UserIosb = &Iosb;
|
||||||
|
|
||||||
Status = IoCallDriver( Vcb->TargetDeviceObject, Vcb->SectorCacheIrp );
|
Status = IoCallDriver( Vcb->TargetDeviceObject, Vcb->SectorCacheIrp );
|
||||||
|
|
||||||
if (STATUS_PENDING == Status) {
|
if (STATUS_PENDING == Status) {
|
||||||
|
|
||||||
|
|
||||||
@@ -2719,7 +2719,7 @@ Return Value:
|
|||||||
KernelMode,
|
KernelMode,
|
||||||
FALSE,
|
FALSE,
|
||||||
NULL );
|
NULL );
|
||||||
|
|
||||||
Status = Vcb->SectorCacheIrp->IoStatus.Status;
|
Status = Vcb->SectorCacheIrp->IoStatus.Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2745,8 +2745,8 @@ Return Value:
|
|||||||
|
|
||||||
Buffer->BaseLbn = StartBlock;
|
Buffer->BaseLbn = StartBlock;
|
||||||
Vcb->SecCacheLRUChunkIndex = (Vcb->SecCacheLRUChunkIndex + 1) % CD_SEC_CACHE_CHUNKS;
|
Vcb->SecCacheLRUChunkIndex = (Vcb->SecCacheLRUChunkIndex + 1) % CD_SEC_CACHE_CHUNKS;
|
||||||
|
|
||||||
CdConvertCacheToShared( IrpContext);
|
CdConvertCacheToShared( IrpContext);
|
||||||
#if DBG
|
#if DBG
|
||||||
JustRead = TRUE;
|
JustRead = TRUE;
|
||||||
#endif
|
#endif
|
||||||
@@ -2841,7 +2841,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// For directories, use the sector cache.
|
// For directories, use the sector cache.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ((SafeNodeType( Fcb) == CDFS_NTC_FCB_INDEX) &&
|
if ((SafeNodeType( Fcb) == CDFS_NTC_FCB_INDEX) &&
|
||||||
(NULL != Fcb->Vcb->SectorCacheBuffer) &&
|
(NULL != Fcb->Vcb->SectorCacheBuffer) &&
|
||||||
(VcbMounted == IrpContext->Vcb->VcbCondition)) {
|
(VcbMounted == IrpContext->Vcb->VcbCondition)) {
|
||||||
@@ -2974,7 +2974,7 @@ Return Value:
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// We only need to set the associated IRP count in the master irp to
|
// 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
|
// 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;
|
IoRuns[UnwindRunCount].SavedIrp = NULL;
|
||||||
|
|
||||||
if (NULL != Irp) {
|
if (NULL != Irp) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// If IoCallDriver returns an error, it has completed the Irp
|
// If IoCallDriver returns an error, it has completed the Irp
|
||||||
// and the error will be caught by our completion routines
|
// and the error will be caught by our completion routines
|
||||||
@@ -3035,7 +3035,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -3134,12 +3134,12 @@ Return Value:
|
|||||||
IrpContext->Irp->IoStatus.Information = 0;
|
IrpContext->Irp->IoStatus.Information = 0;
|
||||||
CdRaiseStatus( IrpContext, STATUS_INSUFFICIENT_RESOURCES );
|
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
|
// must be a multiple of sector size
|
||||||
//
|
//
|
||||||
|
|
||||||
NT_ASSERT( ThisIoRun->DiskByteCount && !SectorOffset(ThisIoRun->DiskByteCount));
|
NT_ASSERT( ThisIoRun->DiskByteCount && !SectorOffset(ThisIoRun->DiskByteCount));
|
||||||
|
|
||||||
RawByteCount = SectorsFromBytes( ThisIoRun->DiskByteCount) * RAW_SECTOR_SIZE;
|
RawByteCount = SectorsFromBytes( ThisIoRun->DiskByteCount) * RAW_SECTOR_SIZE;
|
||||||
@@ -3261,7 +3261,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -3305,7 +3305,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// For directories, look in the sector cache,
|
// For directories, look in the sector cache,
|
||||||
//
|
//
|
||||||
|
|
||||||
if ((SafeNodeType( Fcb) == CDFS_NTC_FCB_INDEX) &&
|
if ((SafeNodeType( Fcb) == CDFS_NTC_FCB_INDEX) &&
|
||||||
(NULL != Fcb->Vcb->SectorCacheBuffer) &&
|
(NULL != Fcb->Vcb->SectorCacheBuffer) &&
|
||||||
(VcbMounted == IrpContext->Vcb->VcbCondition)) {
|
(VcbMounted == IrpContext->Vcb->VcbCondition)) {
|
||||||
@@ -3313,7 +3313,7 @@ Return Value:
|
|||||||
if (CdReadDirDataThroughCache( IrpContext, Run )) {
|
if (CdReadDirDataThroughCache( IrpContext, Run )) {
|
||||||
|
|
||||||
if (FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT)) {
|
if (FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT)) {
|
||||||
|
|
||||||
IrpContext->Irp->IoStatus.Status = STATUS_SUCCESS;
|
IrpContext->Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
KeSetEvent( &IrpContext->IoContext->SyncEvent, 0, FALSE );
|
KeSetEvent( &IrpContext->IoContext->SyncEvent, 0, FALSE );
|
||||||
}
|
}
|
||||||
@@ -3341,11 +3341,11 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
if (FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_TOP_LEVEL )) {
|
if (FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_TOP_LEVEL )) {
|
||||||
|
|
||||||
NT_ASSERT( IrpContext->IoContext->ResourceThreadId == (ERESOURCE_THREAD)PsGetCurrentThread() );
|
NT_ASSERT( IrpContext->IoContext->ResourceThreadId == (ERESOURCE_THREAD)PsGetCurrentThread() );
|
||||||
|
|
||||||
IrpContext->IoContext->ResourceThreadId = ((ULONG_PTR)IrpContext->IoContext) | 3;
|
IrpContext->IoContext->ResourceThreadId = ((ULONG_PTR)IrpContext->IoContext) | 3;
|
||||||
|
|
||||||
ExSetResourceOwnerPointer( IrpContext->IoContext->Resource,
|
ExSetResourceOwnerPointer( IrpContext->IoContext->Resource,
|
||||||
(PVOID)IrpContext->IoContext->ResourceThreadId );
|
(PVOID)IrpContext->IoContext->ResourceThreadId );
|
||||||
}
|
}
|
||||||
@@ -3390,7 +3390,7 @@ Return Value:
|
|||||||
(VOID)IoCallDriver( IrpContext->Vcb->TargetDeviceObject, IrpContext->Irp );
|
(VOID)IoCallDriver( IrpContext->Vcb->TargetDeviceObject, IrpContext->Irp );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -3428,7 +3428,7 @@ Return Value:
|
|||||||
KeClearEvent( &IrpContext->IoContext->SyncEvent );
|
KeClearEvent( &IrpContext->IoContext->SyncEvent );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -3516,7 +3516,7 @@ Return Value:
|
|||||||
return STATUS_MORE_PROCESSING_REQUIRED;
|
return STATUS_MORE_PROCESSING_REQUIRED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -3636,7 +3636,7 @@ Return Value:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -3683,9 +3683,9 @@ Return Value:
|
|||||||
_Analysis_assume_(Context != NULL);
|
_Analysis_assume_(Context != NULL);
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( DeviceObject );
|
UNREFERENCED_PARAMETER( DeviceObject );
|
||||||
|
|
||||||
AssertVerifyDeviceIrp( Irp );
|
AssertVerifyDeviceIrp( Irp );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Store the correct information field into the Irp.
|
// Store the correct information field into the Irp.
|
||||||
//
|
//
|
||||||
@@ -3700,7 +3700,7 @@ Return Value:
|
|||||||
return STATUS_MORE_PROCESSING_REQUIRED;
|
return STATUS_MORE_PROCESSING_REQUIRED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -3743,7 +3743,7 @@ Return Value:
|
|||||||
|
|
||||||
_Analysis_assume_(IoContext != NULL);
|
_Analysis_assume_(IoContext != NULL);
|
||||||
AssertVerifyDeviceIrp( Irp );
|
AssertVerifyDeviceIrp( Irp );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Update the information field with the correct value for bytes read.
|
// Update the information field with the correct value for bytes read.
|
||||||
//
|
//
|
||||||
@@ -3777,7 +3777,7 @@ Return Value:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -4139,7 +4139,7 @@ Return Value:
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the next stack location, and copy over the stack location
|
// Get the next stack location, and copy over the stack location
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ CdEnumerateIndex (
|
|||||||
#pragma alloc_text(PAGE, CdQueryDirectory)
|
#pragma alloc_text(PAGE, CdQueryDirectory)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
@@ -151,7 +151,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routines
|
// Local support routines
|
||||||
//
|
//
|
||||||
@@ -503,16 +503,16 @@ Return Value:
|
|||||||
// to guard against a user messing with the page protection and other
|
// to guard against a user messing with the page protection and other
|
||||||
// such trickery.
|
// such trickery.
|
||||||
//
|
//
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Zero and initialize the base part of the current entry.
|
// Zero and initialize the base part of the current entry.
|
||||||
//
|
//
|
||||||
|
|
||||||
RtlZeroMemory( Add2Ptr( UserBuffer, NextEntry, PVOID ),
|
RtlZeroMemory( Add2Ptr( UserBuffer, NextEntry, PVOID ),
|
||||||
BaseLength );
|
BaseLength );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Now we have an entry to return to our caller.
|
// Now we have an entry to return to our caller.
|
||||||
// We'll case on the type of information requested and fill up
|
// We'll case on the type of information requested and fill up
|
||||||
@@ -520,64 +520,64 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
switch (IrpSp->Parameters.QueryDirectory.FileInformationClass) {
|
switch (IrpSp->Parameters.QueryDirectory.FileInformationClass) {
|
||||||
|
|
||||||
case FileBothDirectoryInformation:
|
case FileBothDirectoryInformation:
|
||||||
case FileFullDirectoryInformation:
|
case FileFullDirectoryInformation:
|
||||||
case FileIdBothDirectoryInformation:
|
case FileIdBothDirectoryInformation:
|
||||||
case FileIdFullDirectoryInformation:
|
case FileIdFullDirectoryInformation:
|
||||||
case FileDirectoryInformation:
|
case FileDirectoryInformation:
|
||||||
|
|
||||||
DirInfo = Add2Ptr( UserBuffer, NextEntry, PFILE_BOTH_DIR_INFORMATION );
|
DirInfo = Add2Ptr( UserBuffer, NextEntry, PFILE_BOTH_DIR_INFORMATION );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Use the create time for all the time stamps.
|
// Use the create time for all the time stamps.
|
||||||
//
|
//
|
||||||
|
|
||||||
CdConvertCdTimeToNtTime( IrpContext,
|
CdConvertCdTimeToNtTime( IrpContext,
|
||||||
FileContext.InitialDirent->Dirent.CdTime,
|
FileContext.InitialDirent->Dirent.CdTime,
|
||||||
&DirInfo->CreationTime );
|
&DirInfo->CreationTime );
|
||||||
|
|
||||||
DirInfo->LastWriteTime = DirInfo->ChangeTime = DirInfo->CreationTime;
|
DirInfo->LastWriteTime = DirInfo->ChangeTime = DirInfo->CreationTime;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set the attributes and sizes separately for directories and
|
// Set the attributes and sizes separately for directories and
|
||||||
// files.
|
// files.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (FlagOn( ThisDirent->DirentFlags, CD_ATTRIBUTE_DIRECTORY )) {
|
if (FlagOn( ThisDirent->DirentFlags, CD_ATTRIBUTE_DIRECTORY )) {
|
||||||
|
|
||||||
DirInfo->EndOfFile.QuadPart = DirInfo->AllocationSize.QuadPart = 0;
|
DirInfo->EndOfFile.QuadPart = DirInfo->AllocationSize.QuadPart = 0;
|
||||||
|
|
||||||
SetFlag( DirInfo->FileAttributes, FILE_ATTRIBUTE_DIRECTORY);
|
SetFlag( DirInfo->FileAttributes, FILE_ATTRIBUTE_DIRECTORY);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
DirInfo->EndOfFile.QuadPart = FileContext.FileSize;
|
DirInfo->EndOfFile.QuadPart = FileContext.FileSize;
|
||||||
DirInfo->AllocationSize.QuadPart = LlSectorAlign( FileContext.FileSize );
|
DirInfo->AllocationSize.QuadPart = LlSectorAlign( FileContext.FileSize );
|
||||||
|
|
||||||
SetFlag( DirInfo->FileAttributes, FILE_ATTRIBUTE_READONLY);
|
SetFlag( DirInfo->FileAttributes, FILE_ATTRIBUTE_READONLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FlagOn( ThisDirent->DirentFlags,
|
if (FlagOn( ThisDirent->DirentFlags,
|
||||||
CD_ATTRIBUTE_HIDDEN )) {
|
CD_ATTRIBUTE_HIDDEN )) {
|
||||||
|
|
||||||
SetFlag( DirInfo->FileAttributes, FILE_ATTRIBUTE_HIDDEN );
|
SetFlag( DirInfo->FileAttributes, FILE_ATTRIBUTE_HIDDEN );
|
||||||
}
|
}
|
||||||
|
|
||||||
DirInfo->FileIndex = ThisDirent->DirentOffset;
|
DirInfo->FileIndex = ThisDirent->DirentOffset;
|
||||||
|
|
||||||
DirInfo->FileNameLength = FileNameBytes + SeparatorBytes + VersionStringBytes;
|
DirInfo->FileNameLength = FileNameBytes + SeparatorBytes + VersionStringBytes;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FileNamesInformation:
|
case FileNamesInformation:
|
||||||
|
|
||||||
NamesInfo = Add2Ptr( UserBuffer, NextEntry, PFILE_NAMES_INFORMATION );
|
NamesInfo = Add2Ptr( UserBuffer, NextEntry, PFILE_NAMES_INFORMATION );
|
||||||
|
|
||||||
NamesInfo->FileIndex = ThisDirent->DirentOffset;
|
NamesInfo->FileIndex = ThisDirent->DirentOffset;
|
||||||
|
|
||||||
NamesInfo->FileNameLength = FileNameBytes + SeparatorBytes + VersionStringBytes;
|
NamesInfo->FileNameLength = FileNameBytes + SeparatorBytes + VersionStringBytes;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* ReactOS Change: GCC "enumeration value not handled in switch" */
|
/* ReactOS Change: GCC "enumeration value not handled in switch" */
|
||||||
@@ -605,30 +605,30 @@ Return Value:
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Now copy as much of the name as possible. We also may have a version
|
// Now copy as much of the name as possible. We also may have a version
|
||||||
// string to copy.
|
// string to copy.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (FileNameBytes != 0) {
|
if (FileNameBytes != 0) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// This is a Unicode name, we can copy the bytes directly.
|
// This is a Unicode name, we can copy the bytes directly.
|
||||||
//
|
//
|
||||||
|
|
||||||
RtlCopyMemory( Add2Ptr( UserBuffer, NextEntry + BaseLength, PVOID ),
|
RtlCopyMemory( Add2Ptr( UserBuffer, NextEntry + BaseLength, PVOID ),
|
||||||
ThisDirent->CdFileName.FileName.Buffer,
|
ThisDirent->CdFileName.FileName.Buffer,
|
||||||
FileNameBytes );
|
FileNameBytes );
|
||||||
|
|
||||||
if (SeparatorBytes != 0) {
|
if (SeparatorBytes != 0) {
|
||||||
|
|
||||||
*(Add2Ptr( UserBuffer,
|
*(Add2Ptr( UserBuffer,
|
||||||
NextEntry + BaseLength + FileNameBytes,
|
NextEntry + BaseLength + FileNameBytes,
|
||||||
PWCHAR )) = L';';
|
PWCHAR )) = L';';
|
||||||
|
|
||||||
if (VersionStringBytes != 0) {
|
if (VersionStringBytes != 0) {
|
||||||
|
|
||||||
RtlCopyMemory( Add2Ptr( UserBuffer,
|
RtlCopyMemory( Add2Ptr( UserBuffer,
|
||||||
NextEntry + BaseLength + FileNameBytes + sizeof( WCHAR ),
|
NextEntry + BaseLength + FileNameBytes + sizeof( WCHAR ),
|
||||||
PVOID ),
|
PVOID ),
|
||||||
@@ -650,40 +650,40 @@ Return Value:
|
|||||||
IrpSp->Parameters.QueryDirectory.FileInformationClass == FileIdBothDirectoryInformation) &&
|
IrpSp->Parameters.QueryDirectory.FileInformationClass == FileIdBothDirectoryInformation) &&
|
||||||
(Ccb->SearchExpression.VersionString.Length == 0) &&
|
(Ccb->SearchExpression.VersionString.Length == 0) &&
|
||||||
!FlagOn( ThisDirent->Flags, DIRENT_FLAG_CONSTANT_ENTRY )) {
|
!FlagOn( ThisDirent->Flags, DIRENT_FLAG_CONSTANT_ENTRY )) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// If we already have the short name then copy into the user's buffer.
|
// If we already have the short name then copy into the user's buffer.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (FileContext.ShortName.FileName.Length != 0) {
|
if (FileContext.ShortName.FileName.Length != 0) {
|
||||||
|
|
||||||
RtlCopyMemory( DirInfo->ShortName,
|
RtlCopyMemory( DirInfo->ShortName,
|
||||||
FileContext.ShortName.FileName.Buffer,
|
FileContext.ShortName.FileName.Buffer,
|
||||||
FileContext.ShortName.FileName.Length );
|
FileContext.ShortName.FileName.Length );
|
||||||
|
|
||||||
DirInfo->ShortNameLength = (CCHAR) FileContext.ShortName.FileName.Length;
|
DirInfo->ShortNameLength = (CCHAR) FileContext.ShortName.FileName.Length;
|
||||||
|
|
||||||
//
|
//
|
||||||
// If the short name length is currently zero then check if
|
// 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
|
// the long name is not 8.3. We can copy the short name in
|
||||||
// unicode form directly into the caller's buffer.
|
// unicode form directly into the caller's buffer.
|
||||||
//
|
//
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (!CdIs8dot3Name( IrpContext,
|
if (!CdIs8dot3Name( IrpContext,
|
||||||
ThisDirent->CdFileName.FileName )) {
|
ThisDirent->CdFileName.FileName )) {
|
||||||
|
|
||||||
CdGenerate8dot3Name( IrpContext,
|
CdGenerate8dot3Name( IrpContext,
|
||||||
&ThisDirent->CdCaseFileName.FileName,
|
&ThisDirent->CdCaseFileName.FileName,
|
||||||
ThisDirent->DirentOffset,
|
ThisDirent->DirentOffset,
|
||||||
DirInfo->ShortName,
|
DirInfo->ShortName,
|
||||||
&FileContext.ShortName.FileName.Length );
|
&FileContext.ShortName.FileName.Length );
|
||||||
|
|
||||||
DirInfo->ShortNameLength = (CCHAR) FileContext.ShortName.FileName.Length;
|
DirInfo->ShortNameLength = (CCHAR) FileContext.ShortName.FileName.Length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -714,7 +714,7 @@ Return Value:
|
|||||||
|
|
||||||
LastEntry = NextEntry;
|
LastEntry = NextEntry;
|
||||||
NextEntry = QuadAlign( Information );
|
NextEntry = QuadAlign( Information );
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(suppress: 6320)
|
#pragma warning(suppress: 6320)
|
||||||
#endif
|
#endif
|
||||||
@@ -725,19 +725,19 @@ Return Value:
|
|||||||
// fail this request. This is the only reason any exception
|
// fail this request. This is the only reason any exception
|
||||||
// would have occured at this level.
|
// would have occured at this level.
|
||||||
//
|
//
|
||||||
|
|
||||||
Information = 0;
|
Information = 0;
|
||||||
try_leave( Status = _SEH2_GetExceptionCode());
|
try_leave( Status = _SEH2_GetExceptionCode());
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
DoCcbUpdate = TRUE;
|
DoCcbUpdate = TRUE;
|
||||||
|
|
||||||
} _SEH2_FINALLY {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cleanup our search context - *before* aquiring the FCB mutex exclusive,
|
// 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.
|
// 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 )) {
|
if (DoCcbUpdate && !NT_ERROR( Status )) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Update the Ccb to show the current state of the enumeration.
|
// Update the Ccb to show the current state of the enumeration.
|
||||||
//
|
//
|
||||||
|
|
||||||
CdLockFcb( IrpContext, Fcb );
|
CdLockFcb( IrpContext, Fcb );
|
||||||
|
|
||||||
Ccb->CurrentDirentOffset = ThisDirent->DirentOffset;
|
Ccb->CurrentDirentOffset = ThisDirent->DirentOffset;
|
||||||
|
|
||||||
ClearFlag( Ccb->Flags, CCB_FLAG_ENUM_RETURN_NEXT );
|
ClearFlag( Ccb->Flags, CCB_FLAG_ENUM_RETURN_NEXT );
|
||||||
@@ -784,7 +784,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routines
|
// Local support routines
|
||||||
//
|
//
|
||||||
@@ -884,7 +884,7 @@ Return Value:
|
|||||||
return STATUS_PENDING;
|
return STATUS_PENDING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -954,7 +954,7 @@ Return Value:
|
|||||||
PAGED_CODE();
|
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.
|
// a new query pattern, reinitialize the CCB.
|
||||||
//
|
//
|
||||||
|
|
||||||
@@ -1349,7 +1349,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -1418,7 +1418,7 @@ Return Value:
|
|||||||
ThisDirent = &FileContext->InitialDirent->Dirent;
|
ThisDirent = &FileContext->InitialDirent->Dirent;
|
||||||
|
|
||||||
CdUpdateDirentName( IrpContext, ThisDirent, FlagOn( Ccb->Flags, CCB_FLAG_IGNORE_CASE ));
|
CdUpdateDirentName( IrpContext, ThisDirent, FlagOn( Ccb->Flags, CCB_FLAG_IGNORE_CASE ));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
ReturnNextEntry = TRUE;
|
ReturnNextEntry = TRUE;
|
||||||
@@ -1427,7 +1427,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Don't bother if we have a constant entry and are ignoring them.
|
// Don't bother if we have a constant entry and are ignoring them.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (FlagOn( ThisDirent->Flags, DIRENT_FLAG_CONSTANT_ENTRY ) &&
|
if (FlagOn( ThisDirent->Flags, DIRENT_FLAG_CONSTANT_ENTRY ) &&
|
||||||
FlagOn( Ccb->Flags, CCB_FLAG_ENUM_NOMATCH_CONSTANT_ENTRY )) {
|
FlagOn( Ccb->Flags, CCB_FLAG_ENUM_NOMATCH_CONSTANT_ENTRY )) {
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ CdCheckForXAExtent (
|
|||||||
#pragma alloc_text(PAGE, CdUpdateDirentName)
|
#pragma alloc_text(PAGE, CdUpdateDirentName)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdLookupDirent (
|
CdLookupDirent (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -203,7 +203,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdLookupNextDirent (
|
CdLookupNextDirent (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -391,7 +391,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_At_(Dirent->CdTime, _Post_notnull_)
|
_At_(Dirent->CdTime, _Post_notnull_)
|
||||||
VOID
|
VOID
|
||||||
CdUpdateDirentFromRawDirent (
|
CdUpdateDirentFromRawDirent (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -529,7 +529,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdUpdateDirentName (
|
CdUpdateDirentName (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -819,7 +819,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Success_(return != FALSE) BOOLEAN
|
_Success_(return != FALSE) BOOLEAN
|
||||||
CdFindFile (
|
CdFindFile (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -992,7 +992,7 @@ Return Value:
|
|||||||
return Found;
|
return Found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdFindDirectory (
|
CdFindDirectory (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -1102,7 +1102,7 @@ Return Value:
|
|||||||
return Found;
|
return Found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_At_(FileContext->ShortName.FileName.MaximumLength, _In_range_(>=, BYTE_COUNT_8_DOT_3))
|
_At_(FileContext->ShortName.FileName.MaximumLength, _In_range_(>=, BYTE_COUNT_8_DOT_3))
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdFindFileByShortName (
|
CdFindFileByShortName (
|
||||||
@@ -1270,7 +1270,7 @@ Return Value:
|
|||||||
return Found;
|
return Found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdLookupNextInitialFileDirent (
|
CdLookupNextInitialFileDirent (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -1421,7 +1421,7 @@ Return Value:
|
|||||||
return FoundDirent;
|
return FoundDirent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdLookupLastFileDirent (
|
CdLookupLastFileDirent (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -1631,7 +1631,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdCleanupFileContext (
|
CdCleanupFileContext (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -1679,7 +1679,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -1781,7 +1781,7 @@ Return Value:
|
|||||||
return NextDirentOffset;
|
return NextDirentOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -1848,12 +1848,12 @@ Return Value:
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Check for XA data. Note that a number of discs (video CDs)
|
// 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
|
// have files marked as type XA Mode 2 Form 1 (2048 bytes of
|
||||||
// user data), but actually record these sectors as Mode2 Form 2
|
// user data), but actually record these sectors as Mode2 Form 2
|
||||||
// (2352). We will fail to read these files, since for M2F1,
|
// (2352). We will fail to read these files, since for M2F1,
|
||||||
// a normal read CD command is issued (as per SCSI specs).
|
// a normal read CD command is issued (as per SCSI specs).
|
||||||
//
|
//
|
||||||
|
|
||||||
ExtentType = Mode2Form2Data;
|
ExtentType = Mode2Form2Data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ CdQueryNetworkInfo (
|
|||||||
#pragma alloc_text(PAGE, CdQueryStandardInfo)
|
#pragma alloc_text(PAGE, CdQueryStandardInfo)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdCommonQueryInfo (
|
CdCommonQueryInfo (
|
||||||
@@ -348,7 +348,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdCommonSetInfo (
|
CdCommonSetInfo (
|
||||||
@@ -463,7 +463,7 @@ Return Value:
|
|||||||
|
|
||||||
|
|
||||||
_Function_class_(FAST_IO_QUERY_BASIC_INFO)
|
_Function_class_(FAST_IO_QUERY_BASIC_INFO)
|
||||||
_IRQL_requires_same_
|
_IRQL_requires_same_
|
||||||
_Success_(return != FALSE)
|
_Success_(return != FALSE)
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
@@ -855,7 +855,7 @@ Return Value:
|
|||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -918,7 +918,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -993,7 +993,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -1043,7 +1043,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -1094,7 +1094,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -1149,7 +1149,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -1193,7 +1193,7 @@ Return Value:
|
|||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
NT_ASSERT(*Length >= sizeof(ULONG));
|
NT_ASSERT(*Length >= sizeof(ULONG));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Simply copy the name in the file object to the user's buffer.
|
// Simply copy the name in the file object to the user's buffer.
|
||||||
//
|
//
|
||||||
@@ -1225,7 +1225,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -1317,7 +1317,7 @@ Return Value:
|
|||||||
ParentFcb = Fcb->ParentFcb;
|
ParentFcb = Fcb->ParentFcb;
|
||||||
CdAcquireFileShared( IrpContext, ParentFcb );
|
CdAcquireFileShared( IrpContext, ParentFcb );
|
||||||
ReleaseParentFcb = TRUE;
|
ReleaseParentFcb = TRUE;
|
||||||
|
|
||||||
CdVerifyOrCreateDirStreamFile( IrpContext, ParentFcb);
|
CdVerifyOrCreateDirStreamFile( IrpContext, ParentFcb);
|
||||||
|
|
||||||
if (CdFidIsDirectory( Fcb->FileId)) {
|
if (CdFidIsDirectory( Fcb->FileId)) {
|
||||||
@@ -1359,23 +1359,23 @@ Return Value:
|
|||||||
|
|
||||||
NameToUse = &FileContext.InitialDirent->Dirent.CdCaseFileName.FileName;
|
NameToUse = &FileContext.InitialDirent->Dirent.CdCaseFileName.FileName;
|
||||||
DirentOffset = FileContext.InitialDirent->Dirent.DirentOffset;
|
DirentOffset = FileContext.InitialDirent->Dirent.DirentOffset;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize the search dirent structures.
|
// Initialize the search dirent structures.
|
||||||
//
|
//
|
||||||
|
|
||||||
CdInitializeDirContext( IrpContext, &DirContext );
|
CdInitializeDirContext( IrpContext, &DirContext );
|
||||||
CdInitializeDirent( IrpContext, &Dirent );
|
CdInitializeDirent( IrpContext, &Dirent );
|
||||||
|
|
||||||
CleanupFileLookup = TRUE;
|
CleanupFileLookup = TRUE;
|
||||||
|
|
||||||
CdLookupDirent( IrpContext,
|
CdLookupDirent( IrpContext,
|
||||||
ParentFcb,
|
ParentFcb,
|
||||||
CdQueryFidDirentOffset( Fcb->FileId ),
|
CdQueryFidDirentOffset( Fcb->FileId ),
|
||||||
&DirContext );
|
&DirContext );
|
||||||
|
|
||||||
CdUpdateDirentFromRawDirent( IrpContext,
|
CdUpdateDirentFromRawDirent( IrpContext,
|
||||||
ParentFcb,
|
ParentFcb,
|
||||||
&DirContext,
|
&DirContext,
|
||||||
@@ -1384,9 +1384,9 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Now update the dirent name.
|
// Now update the dirent name.
|
||||||
//
|
//
|
||||||
|
|
||||||
CdUpdateDirentName( IrpContext, &Dirent, TRUE );
|
CdUpdateDirentName( IrpContext, &Dirent, TRUE );
|
||||||
|
|
||||||
NameToUse = &Dirent.CdCaseFileName.FileName;
|
NameToUse = &Dirent.CdCaseFileName.FileName;
|
||||||
DirentOffset = Dirent.DirentOffset;
|
DirentOffset = Dirent.DirentOffset;
|
||||||
}
|
}
|
||||||
@@ -1454,7 +1454,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ Return Value:
|
|||||||
|
|
||||||
*Fcb = FileObject->FsContext;
|
*Fcb = FileObject->FsContext;
|
||||||
*Ccb = FileObject->FsContext2;
|
*Ccb = FileObject->FsContext2;
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning( suppress: 4213 )
|
#pragma warning( suppress: 4213 )
|
||||||
#endif
|
#endif
|
||||||
@@ -201,7 +201,7 @@ Return Value:
|
|||||||
return TypeOfOpen;
|
return TypeOfOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TYPE_OF_OPEN
|
TYPE_OF_OPEN
|
||||||
CdFastDecodeFileObject (
|
CdFastDecodeFileObject (
|
||||||
_In_ PFILE_OBJECT FileObject,
|
_In_ PFILE_OBJECT FileObject,
|
||||||
|
|||||||
+111
-111
@@ -172,7 +172,7 @@ CdFindActiveVolDescriptor (
|
|||||||
#pragma alloc_text(PAGE, CdVerifyVolume)
|
#pragma alloc_text(PAGE, CdVerifyVolume)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -193,13 +193,13 @@ Routine Description:
|
|||||||
This routine performs the actual lock volume operation. It will be called
|
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
|
by anyone wishing to try to protect the volume for a long duration. PNP
|
||||||
operations are such a user.
|
operations are such a user.
|
||||||
|
|
||||||
The volume must be held exclusive by the caller.
|
The volume must be held exclusive by the caller.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Vcb - The volume being locked.
|
Vcb - The volume being locked.
|
||||||
|
|
||||||
FileObject - File corresponding to the handle locking the volume. If this
|
FileObject - File corresponding to the handle locking the volume. If this
|
||||||
is not specified, a system lock is assumed.
|
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
|
// 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.
|
// remaining after the purge then we can allow the volume to be locked.
|
||||||
//
|
//
|
||||||
|
|
||||||
CdPurgeVolume( IrpContext, Vcb, FALSE );
|
CdPurgeVolume( IrpContext, Vcb, FALSE );
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -253,7 +253,7 @@ Return Value:
|
|||||||
|
|
||||||
SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT );
|
SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT );
|
||||||
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
|
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
|
||||||
|
|
||||||
if (!NT_SUCCESS( Status )) {
|
if (!NT_SUCCESS( Status )) {
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
@@ -266,9 +266,9 @@ Return Value:
|
|||||||
// Vpb locked flag as an 'explicit lock' flag in the same way as Fat.
|
// Vpb locked flag as an 'explicit lock' flag in the same way as Fat.
|
||||||
//
|
//
|
||||||
|
|
||||||
IoAcquireVpbSpinLock( &SavedIrql );
|
IoAcquireVpbSpinLock( &SavedIrql );
|
||||||
|
|
||||||
if (!FlagOn( Vcb->Vpb->Flags, VPB_LOCKED ) &&
|
if (!FlagOn( Vcb->Vpb->Flags, VPB_LOCKED ) &&
|
||||||
(Vcb->VcbCleanup == RemainingUserReferences) &&
|
(Vcb->VcbCleanup == RemainingUserReferences) &&
|
||||||
(Vcb->VcbUserReference == CDFS_RESIDUAL_USER_REFERENCE + RemainingUserReferences)) {
|
(Vcb->VcbUserReference == CDFS_RESIDUAL_USER_REFERENCE + RemainingUserReferences)) {
|
||||||
|
|
||||||
@@ -277,13 +277,13 @@ Return Value:
|
|||||||
Vcb->VolumeLockFileObject = FileObject;
|
Vcb->VolumeLockFileObject = FileObject;
|
||||||
FinalStatus = STATUS_SUCCESS;
|
FinalStatus = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
IoReleaseVpbSpinLock( SavedIrql );
|
IoReleaseVpbSpinLock( SavedIrql );
|
||||||
|
|
||||||
return FinalStatus;
|
return FinalStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdUnlockVolumeInternal (
|
CdUnlockVolumeInternal (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -295,21 +295,21 @@ CdUnlockVolumeInternal (
|
|||||||
|
|
||||||
Routine Description:
|
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.
|
The volume must be held exclusive by the caller.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Vcb - The volume being locked.
|
Vcb - The volume being locked.
|
||||||
|
|
||||||
FileObject - File corresponding to the handle locking the volume. If this
|
FileObject - File corresponding to the handle locking the volume. If this
|
||||||
is not specified, a system lock is assumed.
|
is not specified, a system lock is assumed.
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
|
|
||||||
NTSTATUS - The return status for the operation
|
NTSTATUS - The return status for the operation
|
||||||
|
|
||||||
Attempting to remove a system lock that did not exist is OK.
|
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
|
// 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.
|
// for the implicit lock obtained on a volume open with zero share mode.
|
||||||
//
|
//
|
||||||
|
|
||||||
IoAcquireVpbSpinLock( &SavedIrql );
|
IoAcquireVpbSpinLock( &SavedIrql );
|
||||||
|
|
||||||
if (FlagOn(Vcb->Vpb->Flags, VPB_LOCKED) &&
|
if (FlagOn(Vcb->Vpb->Flags, VPB_LOCKED) &&
|
||||||
(FileObject == Vcb->VolumeLockFileObject)) {
|
(FileObject == Vcb->VolumeLockFileObject)) {
|
||||||
|
|
||||||
ClearFlag( Vcb->VcbState, VCB_STATE_LOCKED );
|
ClearFlag( Vcb->VcbState, VCB_STATE_LOCKED );
|
||||||
@@ -336,13 +336,13 @@ Return Value:
|
|||||||
Vcb->VolumeLockFileObject = NULL;
|
Vcb->VolumeLockFileObject = NULL;
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
IoReleaseVpbSpinLock( SavedIrql );
|
IoReleaseVpbSpinLock( SavedIrql );
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
@@ -407,7 +407,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -527,7 +527,7 @@ CdReMountOldVcb (
|
|||||||
PUCHAR Buffer;
|
PUCHAR Buffer;
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
ObDereferenceObject( OldVcb->TargetDeviceObject );
|
ObDereferenceObject( OldVcb->TargetDeviceObject );
|
||||||
|
|
||||||
IoAcquireVpbSpinLock( &SavedIrql );
|
IoAcquireVpbSpinLock( &SavedIrql );
|
||||||
@@ -536,10 +536,10 @@ CdReMountOldVcb (
|
|||||||
#pragma prefast(suppress: 28175, "this is a filesystem driver, touching the vpb is allowed")
|
#pragma prefast(suppress: 28175, "this is a filesystem driver, touching the vpb is allowed")
|
||||||
#endif
|
#endif
|
||||||
NewVcb->Vpb->RealDevice->Vpb = OldVcb->Vpb;
|
NewVcb->Vpb->RealDevice->Vpb = OldVcb->Vpb;
|
||||||
|
|
||||||
OldVcb->Vpb->RealDevice = NewVcb->Vpb->RealDevice;
|
OldVcb->Vpb->RealDevice = NewVcb->Vpb->RealDevice;
|
||||||
OldVcb->TargetDeviceObject = DeviceObjectWeTalkTo;
|
OldVcb->TargetDeviceObject = DeviceObjectWeTalkTo;
|
||||||
|
|
||||||
CdUpdateVcbCondition( OldVcb, VcbMounted);
|
CdUpdateVcbCondition( OldVcb, VcbMounted);
|
||||||
CdUpdateMediaChangeCount( OldVcb, NewVcb->MediaChangeCount);
|
CdUpdateMediaChangeCount( OldVcb, NewVcb->MediaChangeCount);
|
||||||
|
|
||||||
@@ -549,12 +549,12 @@ CdReMountOldVcb (
|
|||||||
NewVcb->SectorCacheBuffer = NULL;
|
NewVcb->SectorCacheBuffer = NULL;
|
||||||
|
|
||||||
if (NULL != Buffer) {
|
if (NULL != Buffer) {
|
||||||
|
|
||||||
for (Index = 0; Index < CD_SEC_CACHE_CHUNKS; Index++) {
|
for (Index = 0; Index < CD_SEC_CACHE_CHUNKS; Index++) {
|
||||||
|
|
||||||
OldVcb->SecCacheChunks[ Index].Buffer = Buffer;
|
OldVcb->SecCacheChunks[ Index].Buffer = Buffer;
|
||||||
OldVcb->SecCacheChunks[ Index].BaseLbn = (ULONG)-1;
|
OldVcb->SecCacheChunks[ Index].BaseLbn = (ULONG)-1;
|
||||||
|
|
||||||
Buffer += CD_SEC_CHUNK_BLOCKS * SECTOR_SIZE;
|
Buffer += CD_SEC_CHUNK_BLOCKS * SECTOR_SIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -616,7 +616,7 @@ Return Value:
|
|||||||
PVCB Vcb = NULL;
|
PVCB Vcb = NULL;
|
||||||
PVCB OldVcb;
|
PVCB OldVcb;
|
||||||
UCHAR StackSize;
|
UCHAR StackSize;
|
||||||
|
|
||||||
BOOLEAN FoundPvd = FALSE;
|
BOOLEAN FoundPvd = FALSE;
|
||||||
BOOLEAN SetDoVerifyOnFail;
|
BOOLEAN SetDoVerifyOnFail;
|
||||||
|
|
||||||
@@ -725,11 +725,11 @@ Return Value:
|
|||||||
&Iosb );
|
&Iosb );
|
||||||
|
|
||||||
if (!NT_SUCCESS( Status )) {
|
if (!NT_SUCCESS( Status )) {
|
||||||
|
|
||||||
CdCompleteRequest( IrpContext, Irp, Status );
|
CdCompleteRequest( IrpContext, Irp, Status );
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Iosb.Information != sizeof(ULONG)) {
|
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 we failed to read the TOC, then bail out. Probably blank media.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (Status != STATUS_SUCCESS) {
|
if (Status != STATUS_SUCCESS) {
|
||||||
|
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
|
|
||||||
@@ -886,7 +886,7 @@ Return Value:
|
|||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
try_leave( Status );
|
try_leave( Status );
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -957,7 +957,7 @@ Return Value:
|
|||||||
|
|
||||||
// Lock object is acquired and released using internal state
|
// Lock object is acquired and released using internal state
|
||||||
_Analysis_suppress_lock_checking_(Vcb->VcbResource);
|
_Analysis_suppress_lock_checking_(Vcb->VcbResource);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Store the Vcb in the IrpContext as we didn't have one before.
|
// Store the Vcb in the IrpContext as we didn't have one before.
|
||||||
//
|
//
|
||||||
@@ -980,7 +980,7 @@ Return Value:
|
|||||||
CdMarkRealDevVerifyOk( Vcb->Vpb->RealDevice);
|
CdMarkRealDevVerifyOk( Vcb->Vpb->RealDevice);
|
||||||
|
|
||||||
if (!FlagOn( Vcb->VcbState, VCB_STATE_AUDIO_DISK)) {
|
if (!FlagOn( Vcb->VcbState, VCB_STATE_AUDIO_DISK)) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Allocate a buffer to read in the volume descriptors. We allocate a full
|
// Allocate a buffer to read in the volume descriptors. We allocate a full
|
||||||
// page to make sure we don't hit any alignment problems.
|
// 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
|
// 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.
|
// 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
|
// 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
|
// 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
|
// having to filter it from our synthesised directory listing later. We
|
||||||
// already filtered off any data track at the end.
|
// already filtered off any data track at the end.
|
||||||
@@ -1015,7 +1015,7 @@ Return Value:
|
|||||||
|
|
||||||
if (!(TocDiskFlags & CDROM_DISK_AUDIO_TRACK) ||
|
if (!(TocDiskFlags & CDROM_DISK_AUDIO_TRACK) ||
|
||||||
BooleanFlagOn( Vcb->CdromToc->TrackData[0].Control, TOC_DATA_TRACK)) {
|
BooleanFlagOn( Vcb->CdromToc->TrackData[0].Control, TOC_DATA_TRACK)) {
|
||||||
|
|
||||||
try_leave( Status = STATUS_UNRECOGNIZED_VOLUME);
|
try_leave( Status = STATUS_UNRECOGNIZED_VOLUME);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1025,7 +1025,7 @@ Return Value:
|
|||||||
RawIsoVd = NULL;
|
RawIsoVd = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Look and see if there is a secondary volume descriptor we want to
|
// Look and see if there is a secondary volume descriptor we want to
|
||||||
// use.
|
// use.
|
||||||
@@ -1058,7 +1058,7 @@ Return Value:
|
|||||||
// Allocate a block cache to speed directory operations. We can't
|
// Allocate a block cache to speed directory operations. We can't
|
||||||
// use the cache if there is any chance the volume has link blocks
|
// 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
|
// 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
|
// media with a single track - since we're really targetting pressed
|
||||||
// installation media here. We can't be more precise, since D/CD-ROM
|
// 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
|
// drives don't support READ_TRACK_INFO, which is the only way for
|
||||||
@@ -1076,10 +1076,10 @@ Return Value:
|
|||||||
ULONG Index;
|
ULONG Index;
|
||||||
PUCHAR Buffer;
|
PUCHAR Buffer;
|
||||||
|
|
||||||
Buffer =
|
Buffer =
|
||||||
Vcb->SectorCacheBuffer = FsRtlAllocatePool( CdPagedPool,
|
Vcb->SectorCacheBuffer = FsRtlAllocatePool( CdPagedPool,
|
||||||
CD_SEC_CACHE_CHUNKS *
|
CD_SEC_CACHE_CHUNKS *
|
||||||
CD_SEC_CHUNK_BLOCKS *
|
CD_SEC_CHUNK_BLOCKS *
|
||||||
SECTOR_SIZE);
|
SECTOR_SIZE);
|
||||||
|
|
||||||
for (Index = 0; Index < (ULONG)CD_SEC_CACHE_CHUNKS; Index++) {
|
for (Index = 0; Index < (ULONG)CD_SEC_CACHE_CHUNKS; Index++) {
|
||||||
@@ -1096,11 +1096,11 @@ Return Value:
|
|||||||
|
|
||||||
try_leave( Status = STATUS_INSUFFICIENT_RESOURCES );
|
try_leave( Status = STATUS_INSUFFICIENT_RESOURCES );
|
||||||
}
|
}
|
||||||
|
|
||||||
IoInitializeIrp( Vcb->SectorCacheIrp,
|
IoInitializeIrp( Vcb->SectorCacheIrp,
|
||||||
IoSizeOfIrp( StackSize),
|
IoSizeOfIrp( StackSize),
|
||||||
(CCHAR)StackSize);
|
(CCHAR)StackSize);
|
||||||
|
|
||||||
KeInitializeEvent( &Vcb->SectorCacheEvent, SynchronizationEvent, FALSE);
|
KeInitializeEvent( &Vcb->SectorCacheEvent, SynchronizationEvent, FALSE);
|
||||||
ExInitializeResourceLite( &Vcb->SectorCacheResource);
|
ExInitializeResourceLite( &Vcb->SectorCacheResource);
|
||||||
}
|
}
|
||||||
@@ -1116,13 +1116,13 @@ Return Value:
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Link the old Vcb to point to the new device object that we
|
// 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.
|
// nonpaged routine to do this since we take the Vpb spinlock.
|
||||||
//
|
//
|
||||||
|
|
||||||
CdReMountOldVcb( IrpContext,
|
CdReMountOldVcb( IrpContext,
|
||||||
OldVcb,
|
OldVcb,
|
||||||
Vcb,
|
Vcb,
|
||||||
DeviceObjectWeTalkTo);
|
DeviceObjectWeTalkTo);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1132,15 +1132,15 @@ Return Value:
|
|||||||
// Note that we do not send mount on normal remounts - that would duplicate the media
|
// Note that we do not send mount on normal remounts - that would duplicate the media
|
||||||
// arrival notification of the device driver.
|
// arrival notification of the device driver.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (FlagOn( OldVcb->VcbState, VCB_STATE_NOTIFY_REMOUNT )) {
|
if (FlagOn( OldVcb->VcbState, VCB_STATE_NOTIFY_REMOUNT )) {
|
||||||
|
|
||||||
ClearFlag( OldVcb->VcbState, VCB_STATE_NOTIFY_REMOUNT );
|
ClearFlag( OldVcb->VcbState, VCB_STATE_NOTIFY_REMOUNT );
|
||||||
|
|
||||||
FileObjectToNotify = OldVcb->RootIndexFcb->FileObject;
|
FileObjectToNotify = OldVcb->RootIndexFcb->FileObject;
|
||||||
ObReferenceObject( FileObjectToNotify );
|
ObReferenceObject( FileObjectToNotify );
|
||||||
}
|
}
|
||||||
|
|
||||||
try_leave( Status = STATUS_SUCCESS );
|
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 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) {
|
SetDoVerifyOnFail) {
|
||||||
|
|
||||||
CdMarkRealDevForVerify( IrpContext->RealDevice);
|
CdMarkRealDevForVerify( IrpContext->RealDevice);
|
||||||
@@ -1276,7 +1276,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Now send mount notification.
|
// Now send mount notification.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (FileObjectToNotify) {
|
if (FileObjectToNotify) {
|
||||||
|
|
||||||
FsRtlNotifyVolumeEvent( FileObjectToNotify, FSRTL_VOLUME_MOUNT );
|
FsRtlNotifyVolumeEvent( FileObjectToNotify, FSRTL_VOLUME_MOUNT );
|
||||||
@@ -1301,7 +1301,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -1426,7 +1426,7 @@ Return Value:
|
|||||||
|
|
||||||
try_return( Status );
|
try_return( Status );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Iosb.Information != sizeof(ULONG)) {
|
if (Iosb.Information != sizeof(ULONG)) {
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1543,7 +1543,7 @@ Return Value:
|
|||||||
|
|
||||||
try_return( Status = STATUS_WRONG_VOLUME );
|
try_return( Status = STATUS_WRONG_VOLUME );
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1674,11 +1674,11 @@ Return Value:
|
|||||||
if (FlagOn( Vcb->VcbState, VCB_STATE_NOTIFY_REMOUNT )) {
|
if (FlagOn( Vcb->VcbState, VCB_STATE_NOTIFY_REMOUNT )) {
|
||||||
|
|
||||||
ClearFlag( Vcb->VcbState, VCB_STATE_NOTIFY_REMOUNT );
|
ClearFlag( Vcb->VcbState, VCB_STATE_NOTIFY_REMOUNT );
|
||||||
|
|
||||||
FileObjectToNotify = Vcb->RootIndexFcb->FileObject;
|
FileObjectToNotify = Vcb->RootIndexFcb->FileObject;
|
||||||
ObReferenceObject( FileObjectToNotify );
|
ObReferenceObject( FileObjectToNotify );
|
||||||
}
|
}
|
||||||
|
|
||||||
try_exit: NOTHING;
|
try_exit: NOTHING;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1691,9 +1691,9 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// If the volume was already unmounted, nothing more to do.
|
// If the volume was already unmounted, nothing more to do.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (Vcb->VcbCondition == VcbNotMounted) {
|
if (Vcb->VcbCondition == VcbNotMounted) {
|
||||||
|
|
||||||
Status = STATUS_WRONG_VOLUME;
|
Status = STATUS_WRONG_VOLUME;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1722,7 +1722,7 @@ Return Value:
|
|||||||
if (Vcb->VcbCleanup == 0) {
|
if (Vcb->VcbCleanup == 0) {
|
||||||
|
|
||||||
if (NT_SUCCESS( CdPurgeVolume( IrpContext, Vcb, FALSE ))) {
|
if (NT_SUCCESS( CdPurgeVolume( IrpContext, Vcb, FALSE ))) {
|
||||||
|
|
||||||
ReleaseVcb = CdCheckForDismount( IrpContext, Vcb, FALSE );
|
ReleaseVcb = CdCheckForDismount( IrpContext, Vcb, FALSE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1758,13 +1758,13 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Now send mount notification.
|
// Now send mount notification.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (FileObjectToNotify) {
|
if (FileObjectToNotify) {
|
||||||
|
|
||||||
FsRtlNotifyVolumeEvent( FileObjectToNotify, FSRTL_VOLUME_MOUNT );
|
FsRtlNotifyVolumeEvent( FileObjectToNotify, FSRTL_VOLUME_MOUNT );
|
||||||
ObDereferenceObject( FileObjectToNotify );
|
ObDereferenceObject( FileObjectToNotify );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Complete the request if no exception.
|
// Complete the request if no exception.
|
||||||
//
|
//
|
||||||
@@ -1773,7 +1773,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -1930,7 +1930,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -2013,7 +2013,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
CdReleaseVcb( IrpContext, Vcb );
|
CdReleaseVcb( IrpContext, Vcb );
|
||||||
|
|
||||||
if (_SEH2_AbnormalTermination() || !NT_SUCCESS( Status )) {
|
if (_SEH2_AbnormalTermination() || !NT_SUCCESS( Status )) {
|
||||||
|
|
||||||
FsRtlNotifyVolumeEvent( IrpSp->FileObject, FSRTL_VOLUME_LOCK_FAILED );
|
FsRtlNotifyVolumeEvent( IrpSp->FileObject, FSRTL_VOLUME_LOCK_FAILED );
|
||||||
@@ -2028,7 +2028,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -2118,7 +2118,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -2179,7 +2179,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT);
|
SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Acquire exclusive access to the Vcb, and take the global resource to
|
// Acquire exclusive access to the Vcb, and take the global resource to
|
||||||
// sync. against mounts, verifies etc.
|
// sync. against mounts, verifies etc.
|
||||||
@@ -2206,26 +2206,26 @@ Return Value:
|
|||||||
// on the volume fail and grease the rails toward dismount.
|
// on the volume fail and grease the rails toward dismount.
|
||||||
// By definition there is no going back from a SURPRISE.
|
// By definition there is no going back from a SURPRISE.
|
||||||
//
|
//
|
||||||
|
|
||||||
CdLockVcb( IrpContext, Vcb );
|
CdLockVcb( IrpContext, Vcb );
|
||||||
|
|
||||||
if (Vcb->VcbCondition != VcbDismountInProgress) {
|
if (Vcb->VcbCondition != VcbDismountInProgress) {
|
||||||
|
|
||||||
CdUpdateVcbCondition( Vcb, VcbInvalid );
|
CdUpdateVcbCondition( Vcb, VcbInvalid );
|
||||||
}
|
}
|
||||||
|
|
||||||
SetFlag( Vcb->VcbState, VCB_STATE_DISMOUNTED );
|
SetFlag( Vcb->VcbState, VCB_STATE_DISMOUNTED );
|
||||||
|
|
||||||
CdUnlockVcb( IrpContext, Vcb );
|
CdUnlockVcb( IrpContext, Vcb );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set flag to tell the close path that we want to force dismount
|
// Set flag to tell the close path that we want to force dismount
|
||||||
// the volume when this handle is closed.
|
// the volume when this handle is closed.
|
||||||
//
|
//
|
||||||
|
|
||||||
SetFlag( Ccb->Flags, CCB_FLAG_DISMOUNT_ON_CLOSE);
|
SetFlag( Ccb->Flags, CCB_FLAG_DISMOUNT_ON_CLOSE);
|
||||||
|
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2250,7 +2250,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -2344,14 +2344,14 @@ Return Value:
|
|||||||
// Now set up to return the clean state. CDs obviously can never be dirty
|
// 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.
|
// but we want to make sure we have enforced the full semantics of this call.
|
||||||
//
|
//
|
||||||
|
|
||||||
Irp->IoStatus.Information = sizeof( ULONG );
|
Irp->IoStatus.Information = sizeof( ULONG );
|
||||||
|
|
||||||
CdCompleteRequest( IrpContext, Irp, STATUS_SUCCESS );
|
CdCompleteRequest( IrpContext, Irp, STATUS_SUCCESS );
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -2412,7 +2412,7 @@ Return Value:
|
|||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -2447,7 +2447,7 @@ Return Value:
|
|||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -2481,9 +2481,9 @@ Return Value:
|
|||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( Irp );
|
PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( Irp );
|
||||||
KIRQL SavedIrql;
|
KIRQL SavedIrql;
|
||||||
|
|
||||||
BOOLEAN UnlockVcb = FALSE;
|
BOOLEAN UnlockVcb = FALSE;
|
||||||
|
|
||||||
LUID TcbPrivilege = {SE_TCB_PRIVILEGE, 0};
|
LUID TcbPrivilege = {SE_TCB_PRIVILEGE, 0};
|
||||||
|
|
||||||
HANDLE Handle;
|
HANDLE Handle;
|
||||||
@@ -2498,7 +2498,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// We only allow the invalidate call to come in on our file system devices.
|
// We only allow the invalidate call to come in on our file system devices.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef __REACTOS__
|
#ifndef __REACTOS__
|
||||||
if (IrpSp->DeviceObject != CdData.FileSystemDeviceObject) {
|
if (IrpSp->DeviceObject != CdData.FileSystemDeviceObject) {
|
||||||
#else
|
#else
|
||||||
@@ -2530,7 +2530,7 @@ Return Value:
|
|||||||
#if defined(_WIN64) && BUILD_WOW64_ENABLED
|
#if defined(_WIN64) && BUILD_WOW64_ENABLED
|
||||||
|
|
||||||
if (IoIs32bitProcess( Irp )) {
|
if (IoIs32bitProcess( Irp )) {
|
||||||
|
|
||||||
if (IrpSp->Parameters.FileSystemControl.InputBufferLength != sizeof( UINT32 )) {
|
if (IrpSp->Parameters.FileSystemControl.InputBufferLength != sizeof( UINT32 )) {
|
||||||
|
|
||||||
CdCompleteRequest( IrpContext, Irp, STATUS_INVALID_PARAMETER );
|
CdCompleteRequest( IrpContext, Irp, STATUS_INVALID_PARAMETER );
|
||||||
@@ -2538,7 +2538,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
|
|
||||||
Handle = (HANDLE) LongToHandle( *((PUINT32) Irp->AssociatedIrp.SystemBuffer) );
|
Handle = (HANDLE) LongToHandle( *((PUINT32) Irp->AssociatedIrp.SystemBuffer) );
|
||||||
|
|
||||||
} else
|
} else
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -2588,7 +2588,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Synchronise with pnp/mount/verify paths.
|
// Synchronise with pnp/mount/verify paths.
|
||||||
//
|
//
|
||||||
|
|
||||||
CdAcquireCdData( IrpContext );
|
CdAcquireCdData( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2621,18 +2621,18 @@ Return Value:
|
|||||||
if (Vcb->Vpb->RealDevice == DeviceToMarkBad) {
|
if (Vcb->Vpb->RealDevice == DeviceToMarkBad) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Take the VPB spinlock, and look to see if this volume is the
|
// 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
|
// one currently mounted on the actual device. If it is, pull it
|
||||||
// off immediately.
|
// off immediately.
|
||||||
//
|
//
|
||||||
|
|
||||||
IoAcquireVpbSpinLock( &SavedIrql );
|
IoAcquireVpbSpinLock( &SavedIrql );
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma prefast(suppress: 28175, "this is a filesystem driver, touching the vpb is allowed")
|
#pragma prefast(suppress: 28175, "this is a filesystem driver, touching the vpb is allowed")
|
||||||
#endif
|
#endif
|
||||||
if (DeviceToMarkBad->Vpb == Vcb->Vpb) {
|
if (DeviceToMarkBad->Vpb == Vcb->Vpb) {
|
||||||
|
|
||||||
PVPB NewVpb = Vcb->SwapVpb;
|
PVPB NewVpb = Vcb->SwapVpb;
|
||||||
|
|
||||||
NT_ASSERT( FlagOn( Vcb->Vpb->Flags, VPB_MOUNTED));
|
NT_ASSERT( FlagOn( Vcb->Vpb->Flags, VPB_MOUNTED));
|
||||||
@@ -2660,14 +2660,14 @@ Return Value:
|
|||||||
IoReleaseVpbSpinLock( SavedIrql );
|
IoReleaseVpbSpinLock( SavedIrql );
|
||||||
|
|
||||||
if (Vcb->VcbCondition != VcbDismountInProgress) {
|
if (Vcb->VcbCondition != VcbDismountInProgress) {
|
||||||
|
|
||||||
CdUpdateVcbCondition( Vcb, VcbInvalid);
|
CdUpdateVcbCondition( Vcb, VcbInvalid);
|
||||||
}
|
}
|
||||||
|
|
||||||
CdUnlockVcb( IrpContext, Vcb );
|
CdUnlockVcb( IrpContext, Vcb );
|
||||||
|
|
||||||
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE);
|
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE);
|
||||||
|
|
||||||
CdPurgeVolume( IrpContext, Vcb, FALSE );
|
CdPurgeVolume( IrpContext, Vcb, FALSE );
|
||||||
|
|
||||||
UnlockVcb = CdCheckForDismount( 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.
|
// 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.
|
// tell Prefast something nice so it stops complaining about us leaking it.
|
||||||
//
|
//
|
||||||
|
|
||||||
__analysis_assert( UnlockVcb == TRUE );
|
__analysis_assert( UnlockVcb == TRUE );
|
||||||
|
|
||||||
if (UnlockVcb) {
|
if (UnlockVcb) {
|
||||||
|
|
||||||
@@ -2818,7 +2818,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -2898,7 +2898,7 @@ Return Value:
|
|||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// We will make at most two passes through the volume descriptor sequence.
|
// We will make at most two passes through the volume descriptor sequence.
|
||||||
//
|
//
|
||||||
@@ -3131,7 +3131,7 @@ Return Value:
|
|||||||
return FoundVd;
|
return FoundVd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -3256,7 +3256,7 @@ Return Value:
|
|||||||
// serial numbers, volume label and TOC.
|
// serial numbers, volume label and TOC.
|
||||||
//
|
//
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ((OldVpb->SerialNumber == Vpb->SerialNumber) &&
|
else if ((OldVpb->SerialNumber == Vpb->SerialNumber) &&
|
||||||
(Vcb->TocLength == (*OldVcb)->TocLength) &&
|
(Vcb->TocLength == (*OldVcb)->TocLength) &&
|
||||||
((Vcb->TocLength == 0) || RtlEqualMemory( Vcb->CdromToc,
|
((Vcb->TocLength == 0) || RtlEqualMemory( Vcb->CdromToc,
|
||||||
@@ -3280,7 +3280,7 @@ Return Value:
|
|||||||
return Remount;
|
return Remount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -3388,7 +3388,7 @@ Return Value:
|
|||||||
ESC_SEQ_LEN ))) {
|
ESC_SEQ_LEN ))) {
|
||||||
|
|
||||||
if (!VerifyVolume) {
|
if (!VerifyVolume) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Update the Vcb with the new volume descriptor.
|
// Update the Vcb with the new volume descriptor.
|
||||||
//
|
//
|
||||||
@@ -3398,7 +3398,7 @@ Return Value:
|
|||||||
|
|
||||||
Vcb->VdSectorOffset = SectorOffset;
|
Vcb->VdSectorOffset = SectorOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
FoundSecondaryVd = TRUE;
|
FoundSecondaryVd = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -3427,12 +3427,12 @@ Return Value:
|
|||||||
// If we're in the verify path, our work is done, since we don't want
|
// If we're in the verify path, our work is done, since we don't want
|
||||||
// to update any Vcb/Vpb values.
|
// to update any Vcb/Vpb values.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (VerifyVolume) {
|
if (VerifyVolume) {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Compute the serial number and volume label from the volume descriptor.
|
// Compute the serial number and volume label from the volume descriptor.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ Abstract:
|
|||||||
|
|
||||||
#define BugCheckFileId (CDFS_BUG_CHECK_FSPDISP)
|
#define BugCheckFileId (CDFS_BUG_CHECK_FSPDISP)
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdFspDispatch (
|
CdFspDispatch (
|
||||||
@@ -238,7 +238,7 @@ Return Value:
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
VolDo->PostedRequestCount -= 1;
|
VolDo->PostedRequestCount -= 1;
|
||||||
|
|
||||||
Entry = NULL;
|
Entry = NULL;
|
||||||
}
|
}
|
||||||
@@ -250,9 +250,9 @@ Return Value:
|
|||||||
// the Ex Worker thread.
|
// the Ex Worker thread.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (Entry == NULL) {
|
if (Entry == NULL) {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ Abstract:
|
|||||||
#pragma alloc_text(PAGE, CdFastUnlockSingle)
|
#pragma alloc_text(PAGE, CdFastUnlockSingle)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdCommonLockControl (
|
CdCommonLockControl (
|
||||||
_Inout_ PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -136,7 +136,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdFastLock (
|
CdFastLock (
|
||||||
@@ -288,7 +288,7 @@ Return Value:
|
|||||||
return Results;
|
return Results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdFastUnlockSingle (
|
CdFastUnlockSingle (
|
||||||
@@ -336,7 +336,7 @@ Return Value:
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( DeviceObject );
|
UNREFERENCED_PARAMETER( DeviceObject );
|
||||||
|
|
||||||
IoStatus->Information = 0;
|
IoStatus->Information = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -431,7 +431,7 @@ Return Value:
|
|||||||
return Results;
|
return Results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdFastUnlockAll (
|
CdFastUnlockAll (
|
||||||
@@ -470,7 +470,7 @@ Return Value:
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( DeviceObject );
|
UNREFERENCED_PARAMETER( DeviceObject );
|
||||||
|
|
||||||
IoStatus->Information = 0;
|
IoStatus->Information = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -556,7 +556,7 @@ Return Value:
|
|||||||
return Results;
|
return Results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdFastUnlockAllByKey (
|
CdFastUnlockAllByKey (
|
||||||
@@ -598,7 +598,7 @@ Return Value:
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( DeviceObject );
|
UNREFERENCED_PARAMETER( DeviceObject );
|
||||||
|
|
||||||
IoStatus->Information = 0;
|
IoStatus->Information = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ Abstract:
|
|||||||
#pragma alloc_text(PAGE, CdUpcaseName)
|
#pragma alloc_text(PAGE, CdUpcaseName)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
_Post_satisfies_(_Old_(CdName->FileName.Length) >=
|
_Post_satisfies_(_Old_(CdName->FileName.Length) >=
|
||||||
CdName->FileName.Length + CdName->VersionString.Length)
|
CdName->FileName.Length + CdName->VersionString.Length)
|
||||||
VOID
|
VOID
|
||||||
@@ -105,7 +105,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdConvertBigToLittleEndian (
|
CdConvertBigToLittleEndian (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -189,7 +189,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdUpcaseName (
|
CdUpcaseName (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -222,7 +222,7 @@ Return Value:
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// If the name structures are different then initialize the different components.
|
// If the name structures are different then initialize the different components.
|
||||||
//
|
//
|
||||||
@@ -278,7 +278,7 @@ Return Value:
|
|||||||
|
|
||||||
NT_ASSERT( Status == STATUS_SUCCESS );
|
NT_ASSERT( Status == STATUS_SUCCESS );
|
||||||
__analysis_assert( Status == STATUS_SUCCESS );
|
__analysis_assert( Status == STATUS_SUCCESS );
|
||||||
|
|
||||||
if (Name->VersionString.Length != 0) {
|
if (Name->VersionString.Length != 0) {
|
||||||
|
|
||||||
Status = RtlUpcaseUnicodeString( &UpcaseName->VersionString,
|
Status = RtlUpcaseUnicodeString( &UpcaseName->VersionString,
|
||||||
@@ -290,13 +290,13 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
NT_ASSERT( Status == STATUS_SUCCESS );
|
NT_ASSERT( Status == STATUS_SUCCESS );
|
||||||
__analysis_assert( Status == STATUS_SUCCESS );
|
__analysis_assert( Status == STATUS_SUCCESS );
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdDissectName (
|
CdDissectName (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -331,7 +331,7 @@ Return Value:
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Find the offset of the next component separators.
|
// Find the offset of the next component separators.
|
||||||
//
|
//
|
||||||
@@ -372,7 +372,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdIsLegalName (
|
CdIsLegalName (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -424,7 +424,7 @@ Return Value:
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdIs8dot3Name (
|
CdIs8dot3Name (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -461,7 +461,7 @@ Return Value:
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// The length must be less than 24 bytes.
|
// The length must be less than 24 bytes.
|
||||||
//
|
//
|
||||||
@@ -545,7 +545,7 @@ Return Value:
|
|||||||
return FsRtlIsFatDbcsLegal( DbcsName, FALSE, FALSE, FALSE );
|
return FsRtlIsFatDbcsLegal( DbcsName, FALSE, FALSE, FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdGenerate8dot3Name (
|
CdGenerate8dot3Name (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -591,9 +591,9 @@ Return Value:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
UNICODE_STRING ShortName;
|
UNICODE_STRING ShortName;
|
||||||
UNICODE_STRING BiasedShortName;
|
UNICODE_STRING BiasedShortName;
|
||||||
WCHAR ShortNameBuffer[ BYTE_COUNT_8_DOT_3 / sizeof( WCHAR ) ] = {0};
|
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
|
// Generate an OEM version of the string so that we can check for double
|
||||||
// byte characters.
|
// byte characters.
|
||||||
//
|
//
|
||||||
|
|
||||||
Status = RtlUnicodeStringToOemString(&OemName, &ShortName, TRUE);
|
Status = RtlUnicodeStringToOemString(&OemName, &ShortName, TRUE);
|
||||||
|
|
||||||
//
|
//
|
||||||
// If this failed, bail out. Don't expect any problems other than no mem.
|
// If this failed, bail out. Don't expect any problems other than no mem.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (!NT_SUCCESS( Status)) {
|
if (!NT_SUCCESS( Status)) {
|
||||||
|
|
||||||
NT_ASSERT( STATUS_INSUFFICIENT_RESOURCES == Status);
|
NT_ASSERT( STATUS_INSUFFICIENT_RESOURCES == Status);
|
||||||
CdRaiseStatus( IrpContext, Status);
|
CdRaiseStatus( IrpContext, Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
Length = 0;
|
Length = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -777,12 +777,12 @@ Return Value:
|
|||||||
OemNameOffset += 2;
|
OemNameOffset += 2;
|
||||||
|
|
||||||
if ((OemNameOffset + (BiasedShortName.Length / sizeof(WCHAR))) > 8) {
|
if ((OemNameOffset + (BiasedShortName.Length / sizeof(WCHAR))) > 8) {
|
||||||
|
|
||||||
OverflowBuffer = TRUE;
|
OverflowBuffer = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
OemNameOffset++;
|
OemNameOffset++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -839,7 +839,7 @@ Return Value:
|
|||||||
*ShortByteCount = Length;
|
*ShortByteCount = Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdIsNameInExpression (
|
CdIsNameInExpression (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -883,7 +883,7 @@ Return Value:
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// If there are wildcards in the expression then we call the
|
// If there are wildcards in the expression then we call the
|
||||||
// appropriate FsRtlRoutine.
|
// appropriate FsRtlRoutine.
|
||||||
@@ -950,7 +950,7 @@ Return Value:
|
|||||||
return Match;
|
return Match;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
CdShortNameDirentOffset (
|
CdShortNameDirentOffset (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -988,7 +988,7 @@ Return Value:
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Walk through the name until we either reach the end of the name
|
// Walk through the name until we either reach the end of the name
|
||||||
// or find a tilde character.
|
// or find a tilde character.
|
||||||
@@ -1055,7 +1055,7 @@ Return Value:
|
|||||||
return ResultOffset;
|
return ResultOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -1096,7 +1096,7 @@ Return Value:
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Figure out the minimum of the two lengths
|
// Figure out the minimum of the two lengths
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ typedef CSHORT NODE_BYTE_SIZE;
|
|||||||
#ifndef SafeNodeType
|
#ifndef SafeNodeType
|
||||||
#define SafeNodeType(Ptr) (*((PNODE_TYPE_CODE)(Ptr)))
|
#define SafeNodeType(Ptr) (*((PNODE_TYPE_CODE)(Ptr)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// The following definitions are used to generate meaningful blue bugcheck
|
// The following definitions are used to generate meaningful blue bugcheck
|
||||||
// screens. On a bugcheck the file system can output 4 ulongs of useful
|
// screens. On a bugcheck the file system can output 4 ulongs of useful
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ CdUpdatePathEntryFromRawPathEntry (
|
|||||||
#pragma alloc_text(PAGE, CdUpdatePathEntryName)
|
#pragma alloc_text(PAGE, CdUpdatePathEntryName)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdLookupPathEntry (
|
CdLookupPathEntry (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -202,7 +202,7 @@ Return Value:
|
|||||||
&CompoundPathEntry->PathEntry );
|
&CompoundPathEntry->PathEntry );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdLookupNextPathEntry (
|
CdLookupNextPathEntry (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -289,7 +289,7 @@ Return Value:
|
|||||||
// Now update the path entry with the values from the on-disk
|
// Now update the path entry with the values from the on-disk
|
||||||
// structure.
|
// structure.
|
||||||
//
|
//
|
||||||
|
|
||||||
return CdUpdatePathEntryFromRawPathEntry( IrpContext,
|
return CdUpdatePathEntryFromRawPathEntry( IrpContext,
|
||||||
PathEntry->Ordinal + 1,
|
PathEntry->Ordinal + 1,
|
||||||
TRUE,
|
TRUE,
|
||||||
@@ -297,7 +297,7 @@ Return Value:
|
|||||||
PathEntry );
|
PathEntry );
|
||||||
}
|
}
|
||||||
|
|
||||||
_Success_(return != FALSE)
|
_Success_(return != FALSE)
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdFindPathEntry (
|
CdFindPathEntry (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -475,7 +475,7 @@ Return Value:
|
|||||||
return Found;
|
return Found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -521,7 +521,7 @@ Return Value:
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Map the new block and set the enumeration context to this
|
// Map the new block and set the enumeration context to this
|
||||||
// point. Allocate an auxilary buffer if necessary.
|
// point. Allocate an auxilary buffer if necessary.
|
||||||
@@ -628,7 +628,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -663,7 +663,7 @@ Arguments:
|
|||||||
|
|
||||||
Return Value:
|
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
|
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.
|
of blocksize. This is a workaround for some Video CDs. Win 9x works around this.
|
||||||
|
|
||||||
@@ -676,31 +676,31 @@ Return Value:
|
|||||||
ULONG RemainingDataLength;
|
ULONG RemainingDataLength;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check for a name length of zero. This is the first byte of the record,
|
// 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).
|
// wouldn't be here (caller would have spotted buffer end).
|
||||||
//
|
//
|
||||||
|
|
||||||
PathEntry->DirNameLen = CdRawPathIdLen( IrpContext, RawPathEntry );
|
PathEntry->DirNameLen = CdRawPathIdLen( IrpContext, RawPathEntry );
|
||||||
|
|
||||||
if (0 == PathEntry->DirNameLen) {
|
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
|
// 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
|
// 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
|
// round path table length to blocksize multiple. In all other cases we consider
|
||||||
// a zero length name to be corruption.
|
// a zero length name to be corruption.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ( PathContext->LastDataBlock &&
|
if ( PathContext->LastDataBlock &&
|
||||||
(0 == BlockOffset( IrpContext->Vcb, PathContext->DataLength))) {
|
(0 == BlockOffset( IrpContext->Vcb, PathContext->DataLength))) {
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
CdRaiseStatus( IrpContext, STATUS_DISK_CORRUPT_ERROR );
|
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
|
// Check if we should verify the path entry. If we are not in the last
|
||||||
// data block then there is nothing to check.
|
// data block then there is nothing to check.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (PathContext->LastDataBlock && VerifyBounds) {
|
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
|
// We know we can safely access all of the fields of the raw path table at
|
||||||
// this point.
|
// this point.
|
||||||
|
|
||||||
//
|
//
|
||||||
// Bias the disk offset by the number of logical blocks
|
// Bias the disk offset by the number of logical blocks
|
||||||
//
|
//
|
||||||
@@ -772,7 +772,7 @@ Return Value:
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -935,7 +935,7 @@ Return Value:
|
|||||||
PathEntry->DirNameLen );
|
PathEntry->DirNameLen );
|
||||||
|
|
||||||
NT_ASSERT( Status == STATUS_SUCCESS );
|
NT_ASSERT( Status == STATUS_SUCCESS );
|
||||||
__analysis_assert( Status == STATUS_SUCCESS );
|
__analysis_assert( Status == STATUS_SUCCESS );
|
||||||
PathEntry->CdDirName.FileName.Length = (USHORT) Length;
|
PathEntry->CdDirName.FileName.Length = (USHORT) Length;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ Return Value:
|
|||||||
{
|
{
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
BOOLEAN PassThrough = FALSE;
|
BOOLEAN PassThrough = FALSE;
|
||||||
|
|
||||||
PIO_STACK_LOCATION IrpSp;
|
PIO_STACK_LOCATION IrpSp;
|
||||||
|
|
||||||
PVOLUME_DEVICE_OBJECT OurDeviceObject;
|
PVOLUME_DEVICE_OBJECT OurDeviceObject;
|
||||||
@@ -128,19 +128,19 @@ Return Value:
|
|||||||
OurDeviceObject = (PVOLUME_DEVICE_OBJECT) IrpSp->DeviceObject;
|
OurDeviceObject = (PVOLUME_DEVICE_OBJECT) IrpSp->DeviceObject;
|
||||||
|
|
||||||
//
|
//
|
||||||
// IO holds a handle reference on our VDO and holds the device lock, which
|
// 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
|
// 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
|
// 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
|
// 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.
|
// lock until the pnp worker functions take additional locks/refs on the Vcb.
|
||||||
//
|
//
|
||||||
|
|
||||||
CdAcquireCdData( IrpContext);
|
CdAcquireCdData( IrpContext);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Make sure this device object really is big enough to be a volume device
|
// 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
|
// 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
|
#ifdef _MSC_VER
|
||||||
@@ -148,11 +148,11 @@ Return Value:
|
|||||||
#endif
|
#endif
|
||||||
if (OurDeviceObject->DeviceObject.Size != sizeof(VOLUME_DEVICE_OBJECT) ||
|
if (OurDeviceObject->DeviceObject.Size != sizeof(VOLUME_DEVICE_OBJECT) ||
|
||||||
NodeType( &OurDeviceObject->Vcb ) != CDFS_NTC_VCB) {
|
NodeType( &OurDeviceObject->Vcb ) != CDFS_NTC_VCB) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// We were called with something we don't understand.
|
// We were called with something we don't understand.
|
||||||
//
|
//
|
||||||
|
|
||||||
Status = STATUS_INVALID_PARAMETER;
|
Status = STATUS_INVALID_PARAMETER;
|
||||||
CdReleaseCdData( IrpContext);
|
CdReleaseCdData( IrpContext);
|
||||||
CdCompleteRequest( IrpContext, Irp, Status );
|
CdCompleteRequest( IrpContext, Irp, Status );
|
||||||
@@ -171,7 +171,7 @@ Return Value:
|
|||||||
// Check that the Vcb hasn't already been deleted. If so, just pass the
|
// 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.
|
// request through to the driver below, we don't need to do anything.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (NULL == Vcb->Vpb) {
|
if (NULL == Vcb->Vpb) {
|
||||||
|
|
||||||
PassThrough = TRUE;
|
PassThrough = TRUE;
|
||||||
@@ -181,16 +181,16 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Case on the minor code.
|
// Case on the minor code.
|
||||||
//
|
//
|
||||||
|
|
||||||
switch ( IrpSp->MinorFunction ) {
|
switch ( IrpSp->MinorFunction ) {
|
||||||
|
|
||||||
case IRP_MN_QUERY_REMOVE_DEVICE:
|
case IRP_MN_QUERY_REMOVE_DEVICE:
|
||||||
|
|
||||||
Status = CdPnpQueryRemove( IrpContext, Irp, Vcb );
|
Status = CdPnpQueryRemove( IrpContext, Irp, Vcb );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IRP_MN_SURPRISE_REMOVAL:
|
case IRP_MN_SURPRISE_REMOVAL:
|
||||||
|
|
||||||
Status = CdPnpSurpriseRemove( IrpContext, Irp, Vcb );
|
Status = CdPnpSurpriseRemove( IrpContext, Irp, Vcb );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -200,7 +200,7 @@ Return Value:
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case IRP_MN_CANCEL_REMOVE_DEVICE:
|
case IRP_MN_CANCEL_REMOVE_DEVICE:
|
||||||
|
|
||||||
Status = CdPnpCancelRemove( IrpContext, Irp, Vcb );
|
Status = CdPnpCancelRemove( IrpContext, Irp, Vcb );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -219,18 +219,18 @@ Return Value:
|
|||||||
// Just pass the IRP on. As we do not need to be in the
|
// Just pass the IRP on. As we do not need to be in the
|
||||||
// way on return, ellide ourselves out of the stack.
|
// way on return, ellide ourselves out of the stack.
|
||||||
//
|
//
|
||||||
|
|
||||||
IoSkipCurrentIrpStackLocation( Irp );
|
IoSkipCurrentIrpStackLocation( Irp );
|
||||||
|
|
||||||
Status = IoCallDriver(Vcb->TargetDeviceObject, Irp);
|
Status = IoCallDriver(Vcb->TargetDeviceObject, Irp);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cleanup our Irp Context. The driver has completed the Irp.
|
// Cleanup our Irp Context. The driver has completed the Irp.
|
||||||
//
|
//
|
||||||
|
|
||||||
CdCompleteRequest( IrpContext, NULL, STATUS_SUCCESS );
|
CdCompleteRequest( IrpContext, NULL, STATUS_SUCCESS );
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,13 +251,13 @@ Routine Description:
|
|||||||
is responsible for answering whether there are any reasons it sees
|
is responsible for answering whether there are any reasons it sees
|
||||||
that the volume can not go away (and the device removed). Initiation
|
that the volume can not go away (and the device removed). Initiation
|
||||||
of the dismount begins when we answer yes to this question.
|
of the dismount begins when we answer yes to this question.
|
||||||
|
|
||||||
Query will be followed by a Cancel or Remove.
|
Query will be followed by a Cancel or Remove.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Irp - Supplies the Irp to process
|
Irp - Supplies the Irp to process
|
||||||
|
|
||||||
Vcb - Supplies the volume being queried.
|
Vcb - Supplies the volume being queried.
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
@@ -280,7 +280,7 @@ Return Value:
|
|||||||
// underlying storage stack is undefined (and may block)
|
// underlying storage stack is undefined (and may block)
|
||||||
// until the bounding CANCEL or REMOVE is sent.
|
// 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.
|
// 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.
|
// Drop a reference on the Vcb to keep it around after we drop the locks.
|
||||||
//
|
//
|
||||||
|
|
||||||
CdLockVcb( IrpContext, Vcb);
|
CdLockVcb( IrpContext, Vcb);
|
||||||
Vcb->VcbReference += 1;
|
Vcb->VcbReference += 1;
|
||||||
CdUnlockVcb( IrpContext, Vcb);
|
CdUnlockVcb( IrpContext, Vcb);
|
||||||
|
|
||||||
CdReleaseCdData( IrpContext);
|
CdReleaseCdData( IrpContext);
|
||||||
|
|
||||||
Status = CdLockVolumeInternal( IrpContext, Vcb, NULL );
|
Status = CdLockVolumeInternal( IrpContext, Vcb, NULL );
|
||||||
@@ -301,27 +301,27 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Reacquire the global lock, which means dropping the Vcb resource.
|
// Reacquire the global lock, which means dropping the Vcb resource.
|
||||||
//
|
//
|
||||||
|
|
||||||
CdReleaseVcb( IrpContext, Vcb );
|
CdReleaseVcb( IrpContext, Vcb );
|
||||||
|
|
||||||
CdAcquireCdData( IrpContext );
|
CdAcquireCdData( IrpContext );
|
||||||
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
|
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Remove our extra reference.
|
// Remove our extra reference.
|
||||||
//
|
//
|
||||||
|
|
||||||
CdLockVcb( IrpContext, Vcb);
|
CdLockVcb( IrpContext, Vcb);
|
||||||
Vcb->VcbReference -= 1;
|
Vcb->VcbReference -= 1;
|
||||||
CdUnlockVcb( IrpContext, Vcb);
|
CdUnlockVcb( IrpContext, Vcb);
|
||||||
|
|
||||||
if (NT_SUCCESS( Status )) {
|
if (NT_SUCCESS( Status )) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// We need to pass this down before starting the dismount, which
|
// We need to pass this down before starting the dismount, which
|
||||||
// could disconnect us immediately from the stack.
|
// could disconnect us immediately from the stack.
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the next stack location, and copy over the stack location
|
// Get the next stack location, and copy over the stack location
|
||||||
//
|
//
|
||||||
@@ -331,7 +331,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Set up the completion routine
|
// Set up the completion routine
|
||||||
//
|
//
|
||||||
|
|
||||||
KeInitializeEvent( &Event, NotificationEvent, FALSE );
|
KeInitializeEvent( &Event, NotificationEvent, FALSE );
|
||||||
IoSetCompletionRoutine( Irp,
|
IoSetCompletionRoutine( Irp,
|
||||||
CdPnpCompletionRoutine,
|
CdPnpCompletionRoutine,
|
||||||
@@ -374,19 +374,19 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
if (NT_SUCCESS( Status )) {
|
if (NT_SUCCESS( Status )) {
|
||||||
|
|
||||||
VcbPresent = CdCheckForDismount( IrpContext, Vcb, TRUE );
|
VcbPresent = CdCheckForDismount( IrpContext, Vcb, TRUE );
|
||||||
|
|
||||||
NT_ASSERT( !VcbPresent || Vcb->VcbCondition == VcbDismountInProgress );
|
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
|
// vaporise. However there is some code in the system which drops additional
|
||||||
// references on fileobjects, including our internal stream file objects,
|
// references on fileobjects, including our internal stream file objects,
|
||||||
// for (WMI) tracing purposes. If that happens to run concurrently with our
|
// for (WMI) tracing purposes. If that happens to run concurrently with our
|
||||||
// teardown, our internal streams will not vaporise until those references
|
// 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.
|
// 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
|
// 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
|
// 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;
|
Status = STATUS_DEVICE_BUSY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Release the Vcb if it could still remain.
|
// Release the Vcb if it could still remain.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (VcbPresent) {
|
if (VcbPresent) {
|
||||||
|
|
||||||
CdReleaseVcb( IrpContext, Vcb );
|
CdReleaseVcb( IrpContext, Vcb );
|
||||||
@@ -419,7 +419,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
|
|
||||||
CdReleaseCdData( IrpContext );
|
CdReleaseCdData( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cleanup our IrpContext and complete the IRP if neccesary.
|
// Cleanup our IrpContext and complete the IRP if neccesary.
|
||||||
//
|
//
|
||||||
@@ -450,7 +450,7 @@ Routine Description:
|
|||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Irp - Supplies the Irp to process
|
Irp - Supplies the Irp to process
|
||||||
|
|
||||||
Vcb - Supplies the volume being removed.
|
Vcb - Supplies the volume being removed.
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
@@ -478,12 +478,12 @@ Return Value:
|
|||||||
// for a REMOVE in the first two cases, as we try to intiate
|
// for a REMOVE in the first two cases, as we try to intiate
|
||||||
// dismount.
|
// dismount.
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// Acquire the global resource so that we can try to vaporize
|
// Acquire the global resource so that we can try to vaporize
|
||||||
// the volume, and the vcb resource itself.
|
// the volume, and the vcb resource itself.
|
||||||
//
|
//
|
||||||
|
|
||||||
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
|
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -502,22 +502,22 @@ Return Value:
|
|||||||
if (!NT_SUCCESS( Status )) {
|
if (!NT_SUCCESS( Status )) {
|
||||||
|
|
||||||
CdLockVcb( IrpContext, Vcb );
|
CdLockVcb( IrpContext, Vcb );
|
||||||
|
|
||||||
if (Vcb->VcbCondition != VcbDismountInProgress) {
|
if (Vcb->VcbCondition != VcbDismountInProgress) {
|
||||||
|
|
||||||
CdUpdateVcbCondition( Vcb, VcbInvalid);
|
CdUpdateVcbCondition( Vcb, VcbInvalid);
|
||||||
}
|
}
|
||||||
|
|
||||||
CdUnlockVcb( IrpContext, Vcb );
|
CdUnlockVcb( IrpContext, Vcb );
|
||||||
|
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// We need to pass this down before starting the dismount, which
|
// We need to pass this down before starting the dismount, which
|
||||||
// could disconnect us immediately from the stack.
|
// could disconnect us immediately from the stack.
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the next stack location, and copy over the stack location
|
// Get the next stack location, and copy over the stack location
|
||||||
//
|
//
|
||||||
@@ -562,13 +562,13 @@ Return Value:
|
|||||||
// couldn't get off of it immediately.
|
// couldn't get off of it immediately.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
VcbPresent = CdCheckForDismount( IrpContext, Vcb, TRUE );
|
VcbPresent = CdCheckForDismount( IrpContext, Vcb, TRUE );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Release the Vcb if it could still remain.
|
// Release the Vcb if it could still remain.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (VcbPresent) {
|
if (VcbPresent) {
|
||||||
|
|
||||||
CdReleaseVcb( IrpContext, Vcb );
|
CdReleaseVcb( IrpContext, Vcb );
|
||||||
@@ -578,7 +578,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
|
|
||||||
CdReleaseCdData( IrpContext );
|
CdReleaseCdData( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cleanup our IrpContext and complete the IRP.
|
// 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
|
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.
|
have is gone, and is excellent indication that the volume will never reappear.
|
||||||
The filesystem is responsible for initiation or completion the dismount.
|
The filesystem is responsible for initiation or completion the dismount.
|
||||||
|
|
||||||
For the most part, only "real" drivers care about the distinction of a
|
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)
|
surprise remove, which is a result of our noticing that a user (usually)
|
||||||
physically reached into the machine and pulled something out.
|
physically reached into the machine and pulled something out.
|
||||||
|
|
||||||
Surprise will be followed by a Remove when all references have been shut down.
|
Surprise will be followed by a Remove when all references have been shut down.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Irp - Supplies the Irp to process
|
Irp - Supplies the Irp to process
|
||||||
|
|
||||||
Vcb - Supplies the volume being removed.
|
Vcb - Supplies the volume being removed.
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
@@ -632,14 +632,14 @@ Return Value:
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
ASSERT_EXCLUSIVE_CDDATA;
|
ASSERT_EXCLUSIVE_CDDATA;
|
||||||
|
|
||||||
//
|
//
|
||||||
// SURPRISE - a device was physically yanked away without
|
// SURPRISE - a device was physically yanked away without
|
||||||
// any warning. This means external forces.
|
// any warning. This means external forces.
|
||||||
//
|
//
|
||||||
|
|
||||||
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
|
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Invalidate the volume right now.
|
// Invalidate the volume right now.
|
||||||
//
|
//
|
||||||
@@ -647,21 +647,21 @@ Return Value:
|
|||||||
// on the volume fail and grease the rails toward dismount.
|
// on the volume fail and grease the rails toward dismount.
|
||||||
// By definition there is no going back from a SURPRISE.
|
// By definition there is no going back from a SURPRISE.
|
||||||
//
|
//
|
||||||
|
|
||||||
CdLockVcb( IrpContext, Vcb );
|
CdLockVcb( IrpContext, Vcb );
|
||||||
|
|
||||||
if (Vcb->VcbCondition != VcbDismountInProgress) {
|
if (Vcb->VcbCondition != VcbDismountInProgress) {
|
||||||
|
|
||||||
CdUpdateVcbCondition( Vcb, VcbInvalid);
|
CdUpdateVcbCondition( Vcb, VcbInvalid);
|
||||||
}
|
}
|
||||||
|
|
||||||
CdUnlockVcb( IrpContext, Vcb );
|
CdUnlockVcb( IrpContext, Vcb );
|
||||||
|
|
||||||
//
|
//
|
||||||
// We need to pass this down before starting the dismount, which
|
// We need to pass this down before starting the dismount, which
|
||||||
// could disconnect us immediately from the stack.
|
// could disconnect us immediately from the stack.
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the next stack location, and copy over the stack location
|
// Get the next stack location, and copy over the stack location
|
||||||
//
|
//
|
||||||
@@ -696,20 +696,20 @@ Return Value:
|
|||||||
|
|
||||||
Status = Irp->IoStatus.Status;
|
Status = Irp->IoStatus.Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Now make our dismount happen. This may not vaporize the
|
// Now make our dismount happen. This may not vaporize the
|
||||||
// Vcb, of course, since there could be any number of handles
|
// Vcb, of course, since there could be any number of handles
|
||||||
// outstanding since this is an out of band notification.
|
// outstanding since this is an out of band notification.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
VcbPresent = CdCheckForDismount( IrpContext, Vcb, TRUE );
|
VcbPresent = CdCheckForDismount( IrpContext, Vcb, TRUE );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Release the Vcb if it could still remain.
|
// Release the Vcb if it could still remain.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (VcbPresent) {
|
if (VcbPresent) {
|
||||||
|
|
||||||
CdReleaseVcb( IrpContext, Vcb );
|
CdReleaseVcb( IrpContext, Vcb );
|
||||||
@@ -719,7 +719,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
|
|
||||||
CdReleaseCdData( IrpContext );
|
CdReleaseCdData( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cleanup our IrpContext and complete the IRP.
|
// Cleanup our IrpContext and complete the IRP.
|
||||||
//
|
//
|
||||||
@@ -746,11 +746,11 @@ Routine Description:
|
|||||||
notification that a previously proposed remove (query) was eventually
|
notification that a previously proposed remove (query) was eventually
|
||||||
vetoed by a component. The filesystem is responsible for cleaning up
|
vetoed by a component. The filesystem is responsible for cleaning up
|
||||||
and getting ready for more IO.
|
and getting ready for more IO.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Irp - Supplies the Irp to process
|
Irp - Supplies the Irp to process
|
||||||
|
|
||||||
Vcb - Supplies the volume being removed.
|
Vcb - Supplies the volume being removed.
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
@@ -781,7 +781,7 @@ Return Value:
|
|||||||
// with respect to the Vcb getting torn apart - merely referencing
|
// with respect to the Vcb getting torn apart - merely referencing
|
||||||
// the volume device object is insufficient to keep us intact.
|
// the volume device object is insufficient to keep us intact.
|
||||||
//
|
//
|
||||||
|
|
||||||
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
|
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
|
||||||
CdReleaseCdData( IrpContext);
|
CdReleaseCdData( IrpContext);
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ CdInsertNameLink (
|
|||||||
#pragma alloc_text(PAGE, CdRemovePrefix)
|
#pragma alloc_text(PAGE, CdRemovePrefix)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdInsertPrefix (
|
CdInsertPrefix (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -202,7 +202,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdRemovePrefix (
|
CdRemovePrefix (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -228,9 +228,9 @@ Return Value:
|
|||||||
|
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Start with the short name prefix entry.
|
// Start with the short name prefix entry.
|
||||||
//
|
//
|
||||||
@@ -282,7 +282,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
@@ -456,7 +456,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -559,7 +559,7 @@ Return Value:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ __pragma(warning(suppress: 6320)) \
|
|||||||
#pragma alloc_text(PAGE, CdCommonRead)
|
#pragma alloc_text(PAGE, CdCommonRead)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
@@ -116,7 +116,7 @@ Return Value:
|
|||||||
BOOLEAN ReleaseFile = TRUE;
|
BOOLEAN ReleaseFile = TRUE;
|
||||||
|
|
||||||
CD_IO_CONTEXT LocalIoContext;
|
CD_IO_CONTEXT LocalIoContext;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -186,9 +186,9 @@ Return Value:
|
|||||||
if (PagingIo) {
|
if (PagingIo) {
|
||||||
|
|
||||||
CdAcquireFileSharedStarveExclusive( IrpContext, Fcb );
|
CdAcquireFileSharedStarveExclusive( IrpContext, Fcb );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
CdAcquireFileShared( IrpContext, Fcb );
|
CdAcquireFileShared( IrpContext, Fcb );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,13 +199,13 @@ Return Value:
|
|||||||
_SEH2_TRY {
|
_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.
|
// dismounting the volume.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ((TypeOfOpen != UserVolumeOpen) || (NULL == Ccb) ||
|
if ((TypeOfOpen != UserVolumeOpen) || (NULL == Ccb) ||
|
||||||
!FlagOn( Ccb->Flags, CCB_FLAG_DISMOUNT_ON_CLOSE)) {
|
!FlagOn( Ccb->Flags, CCB_FLAG_DISMOUNT_ON_CLOSE)) {
|
||||||
|
|
||||||
CdVerifyFcbOperation( IrpContext, Fcb );
|
CdVerifyFcbOperation( IrpContext, Fcb );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -435,7 +435,7 @@ Return Value:
|
|||||||
} else if (ReadByteCount != ByteCount) {
|
} else if (ReadByteCount != ByteCount) {
|
||||||
|
|
||||||
CdMapUserBuffer( IrpContext, &UserBuffer);
|
CdMapUserBuffer( IrpContext, &UserBuffer);
|
||||||
|
|
||||||
SafeZeroMemory( IrpContext,
|
SafeZeroMemory( IrpContext,
|
||||||
Add2Ptr( UserBuffer,
|
Add2Ptr( UserBuffer,
|
||||||
ByteCount,
|
ByteCount,
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ Abstract:
|
|||||||
#pragma alloc_text(PAGE, CdReleaseFromCache)
|
#pragma alloc_text(PAGE, CdReleaseFromCache)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
_When_(Type == AcquireExclusive && return != FALSE, _Acquires_exclusive_lock_(*Resource))
|
_When_(Type == AcquireExclusive && return != FALSE, _Acquires_exclusive_lock_(*Resource))
|
||||||
@@ -130,7 +130,7 @@ Return Value:
|
|||||||
return Acquired;
|
return Acquired;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
_When_(return!=0, _Acquires_shared_lock_(*Fcb->Resource))
|
_When_(return!=0, _Acquires_shared_lock_(*Fcb->Resource))
|
||||||
@@ -175,7 +175,7 @@ Return Value:
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
_Releases_lock_(*Fcb->Resource)
|
_Releases_lock_(*Fcb->Resource)
|
||||||
VOID
|
VOID
|
||||||
@@ -208,11 +208,11 @@ Return Value:
|
|||||||
|
|
||||||
NT_ASSERT(IoGetTopLevelIrp() == (PIRP)FSRTL_CACHE_TOP_LEVEL_IRP);
|
NT_ASSERT(IoGetTopLevelIrp() == (PIRP)FSRTL_CACHE_TOP_LEVEL_IRP);
|
||||||
IoSetTopLevelIrp( NULL );
|
IoSetTopLevelIrp( NULL );
|
||||||
|
|
||||||
ExReleaseResourceLite( Fcb->Resource );
|
ExReleaseResourceLite( Fcb->Resource );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdNoopAcquire (
|
CdNoopAcquire (
|
||||||
@@ -244,11 +244,11 @@ Return Value:
|
|||||||
|
|
||||||
UNREFERENCED_PARAMETER( Fcb );
|
UNREFERENCED_PARAMETER( Fcb );
|
||||||
UNREFERENCED_PARAMETER( Wait );
|
UNREFERENCED_PARAMETER( Wait );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdNoopRelease (
|
CdNoopRelease (
|
||||||
@@ -314,7 +314,7 @@ Return Value:
|
|||||||
|
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
NT_ASSERT( CallbackData->Operation == FS_FILTER_ACQUIRE_FOR_SECTION_SYNCHRONIZATION );
|
NT_ASSERT( CallbackData->Operation == FS_FILTER_ACQUIRE_FOR_SECTION_SYNCHRONIZATION );
|
||||||
NT_ASSERT( CallbackData->SizeOfFsFilterCallbackData == sizeof(FS_FILTER_CALLBACK_DATA) );
|
NT_ASSERT( CallbackData->SizeOfFsFilterCallbackData == sizeof(FS_FILTER_CALLBACK_DATA) );
|
||||||
|
|
||||||
@@ -330,14 +330,14 @@ Return Value:
|
|||||||
|
|
||||||
ExAcquireResourceExclusiveLite( &((PFCB) FileObject->FsContext)->FcbNonpaged->FcbResource,
|
ExAcquireResourceExclusiveLite( &((PFCB) FileObject->FsContext)->FcbNonpaged->FcbResource,
|
||||||
TRUE );
|
TRUE );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Take the File resource shared. We need this later on when MM calls
|
// Take the File resource shared. We need this later on when MM calls
|
||||||
// QueryStandardInfo to get the file size.
|
// QueryStandardInfo to get the file size.
|
||||||
//
|
//
|
||||||
// If we don't use StarveExclusive, then we can get wedged behind an
|
// 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
|
// exclusive waiter who is waiting on someone else holding it shared in the
|
||||||
// read->initializecachemap path (which calls createsection) who is in turn
|
// read->initializecachemap path (which calls createsection) who is in turn
|
||||||
// waiting on us to finish the create section.
|
// waiting on us to finish the create section.
|
||||||
//
|
//
|
||||||
|
|
||||||
@@ -362,7 +362,7 @@ Return Value:
|
|||||||
UNREFERENCED_PARAMETER( CompletionContext );
|
UNREFERENCED_PARAMETER( CompletionContext );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Function_class_(FAST_IO_RELEASE_FILE)
|
_Function_class_(FAST_IO_RELEASE_FILE)
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ UNICODE_STRING CdInternalStreamNames[] = {
|
|||||||
{ 2, 2, L"\\"}
|
{ 2, 2, L"\\"}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdInitializeVcb (
|
CdInitializeVcb (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -314,13 +314,13 @@ Return Value:
|
|||||||
|
|
||||||
InitializeListHead( &Vcb->DirNotifyList );
|
InitializeListHead( &Vcb->DirNotifyList );
|
||||||
FsRtlNotifyInitializeSync( &Vcb->NotifySync );
|
FsRtlNotifyInitializeSync( &Vcb->NotifySync );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Pick up a VPB right now so we know we can pull this filesystem stack
|
// 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.
|
// uninitialize the notify structures before returning.
|
||||||
//
|
//
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
Vcb->SwapVpb = FsRtlAllocatePoolWithTag( CdNonPagedPool,
|
Vcb->SwapVpb = FsRtlAllocatePoolWithTag( CdNonPagedPool,
|
||||||
@@ -330,7 +330,7 @@ Return Value:
|
|||||||
_SEH2_FINALLY {
|
_SEH2_FINALLY {
|
||||||
|
|
||||||
if (_SEH2_AbnormalTermination()) {
|
if (_SEH2_AbnormalTermination()) {
|
||||||
|
|
||||||
FsRtlNotifyUninitializeSync( &Vcb->NotifySync );
|
FsRtlNotifyUninitializeSync( &Vcb->NotifySync );
|
||||||
}
|
}
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
@@ -340,7 +340,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
RtlZeroMemory( Vcb->SwapVpb, sizeof( VPB ) );
|
RtlZeroMemory( Vcb->SwapVpb, sizeof( VPB ) );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize the resource variable for the Vcb and files.
|
// Initialize the resource variable for the Vcb and files.
|
||||||
//
|
//
|
||||||
@@ -431,7 +431,7 @@ Return Value:
|
|||||||
CdUpdateMediaChangeCount( Vcb, MediaChangeCount);
|
CdUpdateMediaChangeCount( Vcb, MediaChangeCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdUpdateVcbFromVolDescriptor (
|
CdUpdateVcbFromVolDescriptor (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -496,7 +496,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// We no longer accept media where blocksize != sector size.
|
// We no longer accept media where blocksize != sector size.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (Vcb->BlockSize != SECTOR_SIZE) {
|
if (Vcb->BlockSize != SECTOR_SIZE) {
|
||||||
|
|
||||||
CdRaiseStatus( IrpContext, STATUS_DISK_CORRUPT_ERROR );
|
CdRaiseStatus( IrpContext, STATUS_DISK_CORRUPT_ERROR );
|
||||||
@@ -505,7 +505,7 @@ Return Value:
|
|||||||
Vcb->BlocksPerSector = SECTOR_SIZE / Vcb->BlockSize;
|
Vcb->BlocksPerSector = SECTOR_SIZE / Vcb->BlockSize;
|
||||||
Vcb->BlockMask = Vcb->BlockSize - 1;
|
Vcb->BlockMask = Vcb->BlockSize - 1;
|
||||||
Vcb->BlockInverseMask = ~Vcb->BlockMask;
|
Vcb->BlockInverseMask = ~Vcb->BlockMask;
|
||||||
|
|
||||||
Vcb->BlockToSectorShift = 0;
|
Vcb->BlockToSectorShift = 0;
|
||||||
Vcb->BlockToByteShift = SECTOR_SHIFT;
|
Vcb->BlockToByteShift = SECTOR_SHIFT;
|
||||||
|
|
||||||
@@ -659,16 +659,16 @@ Return Value:
|
|||||||
|
|
||||||
McbEntry = Vcb->VolumeDasdFcb->Mcb.McbArray;
|
McbEntry = Vcb->VolumeDasdFcb->Mcb.McbArray;
|
||||||
|
|
||||||
McbEntry->FileOffset =
|
McbEntry->FileOffset =
|
||||||
McbEntry->DiskOffset = 0;
|
McbEntry->DiskOffset = 0;
|
||||||
|
|
||||||
McbEntry->ByteCount = Vcb->VolumeDasdFcb->AllocationSize.QuadPart;
|
McbEntry->ByteCount = Vcb->VolumeDasdFcb->AllocationSize.QuadPart;
|
||||||
|
|
||||||
McbEntry->DataBlockByteCount =
|
McbEntry->DataBlockByteCount =
|
||||||
McbEntry->TotalBlockByteCount = McbEntry->ByteCount;
|
McbEntry->TotalBlockByteCount = McbEntry->ByteCount;
|
||||||
|
|
||||||
Vcb->VolumeDasdFcb->Mcb.CurrentEntryCount = 1;
|
Vcb->VolumeDasdFcb->Mcb.CurrentEntryCount = 1;
|
||||||
|
|
||||||
CdUnlockFcb( IrpContext, Vcb->VolumeDasdFcb );
|
CdUnlockFcb( IrpContext, Vcb->VolumeDasdFcb );
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -864,14 +864,14 @@ Return Value:
|
|||||||
|
|
||||||
SetFlag( Vcb->VcbState, VCB_STATE_ISO );
|
SetFlag( Vcb->VcbState, VCB_STATE_ISO );
|
||||||
}
|
}
|
||||||
|
|
||||||
} _SEH2_FINALLY {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
if (UnlockVcb) { CdUnlockVcb( IrpContext, Vcb ); }
|
if (UnlockVcb) { CdUnlockVcb( IrpContext, Vcb ); }
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdDeleteVcb (
|
CdDeleteVcb (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -901,15 +901,15 @@ Return Value:
|
|||||||
|
|
||||||
ASSERT_EXCLUSIVE_CDDATA;
|
ASSERT_EXCLUSIVE_CDDATA;
|
||||||
ASSERT_EXCLUSIVE_VCB( Vcb );
|
ASSERT_EXCLUSIVE_VCB( Vcb );
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Chuck the backpocket Vpb we kept just in case.
|
// Chuck the backpocket Vpb we kept just in case.
|
||||||
//
|
//
|
||||||
|
|
||||||
CdFreePool( &Vcb->SwapVpb );
|
CdFreePool( &Vcb->SwapVpb );
|
||||||
|
|
||||||
//
|
//
|
||||||
// If there is a Vpb then we must delete it ourselves.
|
// If there is a Vpb then we must delete it ourselves.
|
||||||
//
|
//
|
||||||
@@ -921,7 +921,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
if (Vcb->TargetDeviceObject != NULL) {
|
if (Vcb->TargetDeviceObject != NULL) {
|
||||||
|
|
||||||
ObDereferenceObject( Vcb->TargetDeviceObject );
|
ObDereferenceObject( Vcb->TargetDeviceObject );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -981,7 +981,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PFCB
|
PFCB
|
||||||
CdCreateFcb (
|
CdCreateFcb (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -1075,7 +1075,7 @@ Return Value:
|
|||||||
default:
|
default:
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#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
|
#endif
|
||||||
CdBugCheck( 0, 0, 0 );
|
CdBugCheck( 0, 0, 0 );
|
||||||
}
|
}
|
||||||
@@ -1115,7 +1115,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
ExInitializeFastMutex( &NewFcb->FcbNonpaged->AdvancedFcbHeaderMutex );
|
ExInitializeFastMutex( &NewFcb->FcbNonpaged->AdvancedFcbHeaderMutex );
|
||||||
FsRtlSetupAdvancedHeader( &NewFcb->Header,
|
FsRtlSetupAdvancedHeader( &NewFcb->Header,
|
||||||
&NewFcb->FcbNonpaged->AdvancedFcbHeaderMutex );
|
&NewFcb->FcbNonpaged->AdvancedFcbHeaderMutex );
|
||||||
|
|
||||||
if (NodeTypeCode == CDFS_NTC_FCB_DATA) {
|
if (NodeTypeCode == CDFS_NTC_FCB_DATA) {
|
||||||
@@ -1131,7 +1131,7 @@ Return Value:
|
|||||||
return NewFcb;
|
return NewFcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdInitializeFcbFromPathEntry (
|
CdInitializeFcbFromPathEntry (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -1220,7 +1220,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdInitializeFcbFromFileContext (
|
CdInitializeFcbFromFileContext (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -1400,7 +1400,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PCCB
|
PCCB
|
||||||
CdCreateCcb (
|
CdCreateCcb (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -1431,7 +1431,7 @@ Return Value:
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Allocate and initialize the structure.
|
// Allocate and initialize the structure.
|
||||||
//
|
//
|
||||||
@@ -1457,7 +1457,7 @@ Return Value:
|
|||||||
return NewCcb;
|
return NewCcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdDeleteCcb (
|
CdDeleteCcb (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -1483,7 +1483,7 @@ Return Value:
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
if (Ccb->SearchExpression.FileName.Buffer != NULL) {
|
if (Ccb->SearchExpression.FileName.Buffer != NULL) {
|
||||||
|
|
||||||
CdFreePool( &Ccb->SearchExpression.FileName.Buffer );
|
CdFreePool( &Ccb->SearchExpression.FileName.Buffer );
|
||||||
@@ -1493,7 +1493,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_When_(RaiseOnError || return, _At_(Fcb->FileLock, _Post_notnull_))
|
_When_(RaiseOnError || return, _At_(Fcb->FileLock, _Post_notnull_))
|
||||||
_When_(RaiseOnError, _At_(IrpContext, _Pre_notnull_))
|
_When_(RaiseOnError, _At_(IrpContext, _Pre_notnull_))
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
@@ -1554,7 +1554,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
if (FileLock == NULL) {
|
if (FileLock == NULL) {
|
||||||
|
|
||||||
if (RaiseOnError) {
|
if (RaiseOnError) {
|
||||||
|
|
||||||
NT_ASSERT( ARGUMENT_PRESENT( IrpContext ));
|
NT_ASSERT( ARGUMENT_PRESENT( IrpContext ));
|
||||||
@@ -1568,7 +1568,7 @@ Return Value:
|
|||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Ret_valid_ PIRP_CONTEXT
|
_Ret_valid_ PIRP_CONTEXT
|
||||||
CdCreateIrpContext (
|
CdCreateIrpContext (
|
||||||
_In_ PIRP Irp,
|
_In_ PIRP Irp,
|
||||||
@@ -1623,11 +1623,11 @@ Return Value:
|
|||||||
}
|
}
|
||||||
|
|
||||||
NT_ASSERT( IrpSp->FileObject != NULL ||
|
NT_ASSERT( IrpSp->FileObject != NULL ||
|
||||||
|
|
||||||
(IrpSp->MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL &&
|
(IrpSp->MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL &&
|
||||||
IrpSp->MinorFunction == IRP_MN_USER_FS_REQUEST &&
|
IrpSp->MinorFunction == IRP_MN_USER_FS_REQUEST &&
|
||||||
IrpSp->Parameters.FileSystemControl.FsControlCode == FSCTL_INVALIDATE_VOLUMES) ||
|
IrpSp->Parameters.FileSystemControl.FsControlCode == FSCTL_INVALIDATE_VOLUMES) ||
|
||||||
|
|
||||||
(IrpSp->MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL &&
|
(IrpSp->MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL &&
|
||||||
IrpSp->MinorFunction == IRP_MN_MOUNT_VOLUME ) ||
|
IrpSp->MinorFunction == IRP_MN_MOUNT_VOLUME ) ||
|
||||||
|
|
||||||
@@ -1698,7 +1698,7 @@ Return Value:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
NewIrpContext->Vcb = &((PVOLUME_DEVICE_OBJECT) IrpSp->DeviceObject)->Vcb;
|
NewIrpContext->Vcb = &((PVOLUME_DEVICE_OBJECT) IrpSp->DeviceObject)->Vcb;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1728,7 +1728,7 @@ Return Value:
|
|||||||
return NewIrpContext;
|
return NewIrpContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdCleanupIrpContext (
|
CdCleanupIrpContext (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -1834,7 +1834,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdInitializeStackIrpContext (
|
CdInitializeStackIrpContext (
|
||||||
_Out_ PIRP_CONTEXT IrpContext,
|
_Out_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -1910,7 +1910,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
@@ -2102,7 +2102,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PFCB
|
PFCB
|
||||||
CdLookupFcbTable (
|
CdLookupFcbTable (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -2150,7 +2150,7 @@ Return Value:
|
|||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PFCB
|
PFCB
|
||||||
CdGetNextFcb (
|
CdGetNextFcb (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -2185,7 +2185,7 @@ Return Value:
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
Fcb = (PFCB) RtlEnumerateGenericTableWithoutSplaying( &Vcb->FcbTable, RestartKey );
|
Fcb = (PFCB) RtlEnumerateGenericTableWithoutSplaying( &Vcb->FcbTable, RestartKey );
|
||||||
|
|
||||||
if (Fcb != NULL) {
|
if (Fcb != NULL) {
|
||||||
@@ -2196,7 +2196,7 @@ Return Value:
|
|||||||
return Fcb;
|
return Fcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdProcessToc (
|
CdProcessToc (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
@@ -2260,7 +2260,7 @@ Return Value:
|
|||||||
// Zero the command block. This conveniently corresponds to an
|
// Zero the command block. This conveniently corresponds to an
|
||||||
// LBA mode READ_TOC request.
|
// LBA mode READ_TOC request.
|
||||||
//
|
//
|
||||||
|
|
||||||
RtlZeroMemory( &Command, sizeof( Command));
|
RtlZeroMemory( &Command, sizeof( Command));
|
||||||
|
|
||||||
RetryReadToc:
|
RetryReadToc:
|
||||||
@@ -2361,7 +2361,7 @@ RetryReadToc:
|
|||||||
// Knock 2.5 minutes off the current track to hide the final leadin.
|
// Knock 2.5 minutes off the current track to hide the final leadin.
|
||||||
// 2.5 min = 150 sec = (x 75) 11250 frames (sectors).
|
// 2.5 min = 150 sec = (x 75) 11250 frames (sectors).
|
||||||
//
|
//
|
||||||
|
|
||||||
SwapCopyUchar4( &Address, &Track->Address);
|
SwapCopyUchar4( &Address, &Track->Address);
|
||||||
Address -= 11250;
|
Address -= 11250;
|
||||||
SwapCopyUchar4( &Track->Address, &Address);
|
SwapCopyUchar4( &Track->Address, &Address);
|
||||||
@@ -2415,7 +2415,7 @@ RetryReadToc:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -2546,7 +2546,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -2575,9 +2575,9 @@ Return Value:
|
|||||||
PFCB_NONPAGED FcbNonpaged;
|
PFCB_NONPAGED FcbNonpaged;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Allocate the non-paged pool and initialize the various
|
// Allocate the non-paged pool and initialize the various
|
||||||
// synchronization objects.
|
// synchronization objects.
|
||||||
@@ -2599,7 +2599,7 @@ Return Value:
|
|||||||
return FcbNonpaged;
|
return FcbNonpaged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -2628,9 +2628,9 @@ Return Value:
|
|||||||
|
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
ExDeleteResourceLite( &FcbNonpaged->FcbResource );
|
ExDeleteResourceLite( &FcbNonpaged->FcbResource );
|
||||||
|
|
||||||
CdDeallocateFcbNonpaged( IrpContext, *(PVOID*)&FcbNonpaged );/* ReactOS Change: GCC "passing argument 1 from incompatible pointer type" */
|
CdDeallocateFcbNonpaged( IrpContext, *(PVOID*)&FcbNonpaged );/* ReactOS Change: GCC "passing argument 1 from incompatible pointer type" */
|
||||||
@@ -2638,7 +2638,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -2696,7 +2696,7 @@ Return Value:
|
|||||||
UNREFERENCED_PARAMETER( FcbTable );
|
UNREFERENCED_PARAMETER( FcbTable );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -2728,13 +2728,13 @@ Return Value:
|
|||||||
|
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( FcbTable );
|
UNREFERENCED_PARAMETER( FcbTable );
|
||||||
|
|
||||||
return( FsRtlAllocatePoolWithTag( CdPagedPool, ByteSize, TAG_FCB_TABLE ));
|
return( FsRtlAllocatePoolWithTag( CdPagedPool, ByteSize, TAG_FCB_TABLE ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -2770,7 +2770,7 @@ Return Value:
|
|||||||
UNREFERENCED_PARAMETER( FcbTable );
|
UNREFERENCED_PARAMETER( FcbTable );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -2814,7 +2814,7 @@ Return Value:
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check if there are two tracks or fewer.
|
// Check if there are two tracks or fewer.
|
||||||
//
|
//
|
||||||
@@ -2834,10 +2834,10 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
while (ThisTrack != LastTrack) {
|
while (ThisTrack != LastTrack) {
|
||||||
|
|
||||||
SwapCopyUchar4( &Address, ThisTrack->Address);
|
SwapCopyUchar4( &Address, ThisTrack->Address);
|
||||||
CdLbnToMmSsFf( Address, (PUCHAR)&MsfAddress);
|
CdLbnToMmSsFf( Address, (PUCHAR)&MsfAddress);
|
||||||
|
|
||||||
SerialNumber += MsfAddress;
|
SerialNumber += MsfAddress;
|
||||||
ThisTrack += 1;
|
ThisTrack += 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,9 +107,9 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Acquire the Vcb so we're working with a stable VcbCondition.
|
// Acquire the Vcb so we're working with a stable VcbCondition.
|
||||||
//
|
//
|
||||||
|
|
||||||
CdAcquireVcbShared( IrpContext, Vcb, FALSE);
|
CdAcquireVcbShared( IrpContext, Vcb, FALSE);
|
||||||
|
|
||||||
//
|
//
|
||||||
// If the verify operation completed it will return
|
// If the verify operation completed it will return
|
||||||
// either STATUS_SUCCESS or STATUS_WRONG_VOLUME, exactly.
|
// either STATUS_SUCCESS or STATUS_WRONG_VOLUME, exactly.
|
||||||
@@ -129,12 +129,12 @@ Return Value:
|
|||||||
|
|
||||||
//
|
//
|
||||||
// If the verify succeeded, but our volume is not mounted,
|
// 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;
|
Status = STATUS_WRONG_VOLUME;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Do a quick unprotected check here. The routine will do
|
// Do a quick unprotected check here. The routine will do
|
||||||
// a safe check. After here we can release the resource.
|
// a safe check. After here we can release the resource.
|
||||||
@@ -188,7 +188,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Fill in the device object if required.
|
// Fill in the device object if required.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (IoIsErrorUserInduced( Status ) ) {
|
if (IoIsErrorUserInduced( Status ) ) {
|
||||||
|
|
||||||
IoSetHardErrorOrVerifyDevice( Irp, DeviceToVerify );
|
IoSetHardErrorOrVerifyDevice( Irp, DeviceToVerify );
|
||||||
@@ -220,7 +220,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
@@ -248,14 +248,14 @@ Routine Description:
|
|||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Vcb - Vcb for the volume to try to dismount.
|
Vcb - Vcb for the volume to try to dismount.
|
||||||
|
|
||||||
Force - Whether we will force this volume to be dismounted.
|
Force - Whether we will force this volume to be dismounted.
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
|
|
||||||
BOOLEAN - True if the Vcb was not gone by the time this function finished,
|
BOOLEAN - True if the Vcb was not gone by the time this function finished,
|
||||||
False if it was deleted.
|
False if it was deleted.
|
||||||
|
|
||||||
This is only a trustworthy indication to the caller if it had the vcb
|
This is only a trustworthy indication to the caller if it had the vcb
|
||||||
exclusive itself.
|
exclusive itself.
|
||||||
|
|
||||||
@@ -397,10 +397,10 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Flag this to avoid the VPB spinlock in future passes.
|
// Flag this to avoid the VPB spinlock in future passes.
|
||||||
//
|
//
|
||||||
|
|
||||||
SetFlag( Vcb->VcbState, VCB_STATE_VPB_NOT_ON_DEVICE);
|
SetFlag( Vcb->VcbState, VCB_STATE_VPB_NOT_ON_DEVICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
IoReleaseVpbSpinLock( SavedIrql );
|
IoReleaseVpbSpinLock( SavedIrql );
|
||||||
|
|
||||||
return Marked;
|
return Marked;
|
||||||
@@ -448,7 +448,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
if ((Vcb->VcbCondition == VcbInvalid) ||
|
if ((Vcb->VcbCondition == VcbInvalid) ||
|
||||||
((Vcb->VcbCondition == VcbDismountInProgress) &&
|
((Vcb->VcbCondition == VcbDismountInProgress) &&
|
||||||
(IrpContext->MajorFunction != IRP_MJ_CREATE))) {
|
(IrpContext->MajorFunction != IRP_MJ_CREATE))) {
|
||||||
|
|
||||||
if (FlagOn( Vcb->VcbState, VCB_STATE_DISMOUNTED )) {
|
if (FlagOn( Vcb->VcbState, VCB_STATE_DISMOUNTED )) {
|
||||||
@@ -460,15 +460,15 @@ Return Value:
|
|||||||
CdRaiseStatus( IrpContext, STATUS_FILE_INVALID );
|
CdRaiseStatus( IrpContext, STATUS_FILE_INVALID );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Capture the real device verify state.
|
// Capture the real device verify state.
|
||||||
//
|
//
|
||||||
|
|
||||||
DevMarkedForVerify = CdRealDevNeedsVerify( Vcb->Vpb->RealDevice);
|
DevMarkedForVerify = CdRealDevNeedsVerify( Vcb->Vpb->RealDevice);
|
||||||
|
|
||||||
if (FlagOn( Vcb->VcbState, VCB_STATE_REMOVABLE_MEDIA ) && !DevMarkedForVerify) {
|
if (FlagOn( Vcb->VcbState, VCB_STATE_REMOVABLE_MEDIA ) && !DevMarkedForVerify) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// If the media is removable and the verify volume flag in the
|
// If the media is removable and the verify volume flag in the
|
||||||
// device object is not set then we want to ping the device
|
// device object is not set then we want to ping the device
|
||||||
@@ -487,11 +487,11 @@ Return Value:
|
|||||||
&Iosb );
|
&Iosb );
|
||||||
|
|
||||||
if (Iosb.Information != sizeof(ULONG)) {
|
if (Iosb.Information != sizeof(ULONG)) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Be safe about the count in case the driver didn't fill it in
|
// Be safe about the count in case the driver didn't fill it in
|
||||||
//
|
//
|
||||||
|
|
||||||
MediaChangeCount = 0;
|
MediaChangeCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -504,9 +504,9 @@ Return Value:
|
|||||||
// set, but could be due to hardware condition)
|
// set, but could be due to hardware condition)
|
||||||
// 3. Media change count doesn't match the one in the Vcb
|
// 3. Media change count doesn't match the one in the Vcb
|
||||||
//
|
//
|
||||||
|
|
||||||
if (((Vcb->VcbCondition == VcbMounted) &&
|
if (((Vcb->VcbCondition == VcbMounted) &&
|
||||||
CdIsRawDevice( IrpContext, Status ))
|
CdIsRawDevice( IrpContext, Status ))
|
||||||
||
|
||
|
||||||
(Status == STATUS_VERIFY_REQUIRED)
|
(Status == STATUS_VERIFY_REQUIRED)
|
||||||
||
|
||
|
||||||
@@ -532,13 +532,13 @@ Return Value:
|
|||||||
// do so only when we've actually completed a verify at a particular
|
// do so only when we've actually completed a verify at a particular
|
||||||
// change count value.
|
// change count value.
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// This is the 4th verify case.
|
// 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
|
// verify path. These requests could have been in limbo between
|
||||||
// IoCheckMountedVpb and us when a verify/mount took place and caused
|
// IoCheckMountedVpb and us when a verify/mount took place and caused
|
||||||
// a completely different fs/volume to be mounted. In this case the
|
// a completely different fs/volume to be mounted. In this case the
|
||||||
@@ -567,14 +567,14 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Raise the verify / error if neccessary.
|
// Raise the verify / error if neccessary.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (ForceVerify || DevMarkedForVerify || !NT_SUCCESS( Status)) {
|
if (ForceVerify || DevMarkedForVerify || !NT_SUCCESS( Status)) {
|
||||||
|
|
||||||
IoSetHardErrorOrVerifyDevice( IrpContext->Irp,
|
IoSetHardErrorOrVerifyDevice( IrpContext->Irp,
|
||||||
Vcb->Vpb->RealDevice );
|
Vcb->Vpb->RealDevice );
|
||||||
|
|
||||||
CdRaiseStatus( IrpContext, (ForceVerify || DevMarkedForVerify)
|
CdRaiseStatus( IrpContext, (ForceVerify || DevMarkedForVerify)
|
||||||
? STATUS_VERIFY_REQUIRED
|
? STATUS_VERIFY_REQUIRED
|
||||||
: Status);
|
: Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -604,7 +604,7 @@ Return Value:
|
|||||||
CdRaiseStatus( IrpContext, STATUS_FILE_INVALID );
|
CdRaiseStatus( IrpContext, STATUS_FILE_INVALID );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* ReactOS Change: GCC "enumeration value not handled in switch" */
|
/* ReactOS Change: GCC "enumeration value not handled in switch" */
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
@@ -644,18 +644,18 @@ Return Value:
|
|||||||
PIRP Irp;
|
PIRP Irp;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check that the fileobject has not been cleaned up.
|
// Check that the fileobject has not been cleaned up.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ( ARGUMENT_PRESENT( IrpContext )) {
|
if ( ARGUMENT_PRESENT( IrpContext )) {
|
||||||
|
|
||||||
PFILE_OBJECT FileObject;
|
PFILE_OBJECT FileObject;
|
||||||
|
|
||||||
Irp = IrpContext->Irp;
|
Irp = IrpContext->Irp;
|
||||||
FileObject = IoGetCurrentIrpStackLocation( Irp)->FileObject;
|
FileObject = IoGetCurrentIrpStackLocation( Irp)->FileObject;
|
||||||
|
|
||||||
if ( FileObject && FlagOn( FileObject->Flags, FO_CLEANUP_COMPLETE)) {
|
if ( FileObject && FlagOn( FileObject->Flags, FO_CLEANUP_COMPLETE)) {
|
||||||
|
|
||||||
PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( Irp );
|
PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( Irp );
|
||||||
@@ -664,7 +664,7 @@ Return Value:
|
|||||||
// Following FAT, we allow certain operations even on cleaned up
|
// Following FAT, we allow certain operations even on cleaned up
|
||||||
// file objects. Everything else, we fail.
|
// file objects. Everything else, we fail.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ( (FlagOn(Irp->Flags, IRP_PAGING_IO)) ||
|
if ( (FlagOn(Irp->Flags, IRP_PAGING_IO)) ||
|
||||||
(IrpSp->MajorFunction == IRP_MJ_CLOSE ) ||
|
(IrpSp->MajorFunction == IRP_MJ_CLOSE ) ||
|
||||||
(IrpSp->MajorFunction == IRP_MJ_QUERY_INFORMATION) ||
|
(IrpSp->MajorFunction == IRP_MJ_QUERY_INFORMATION) ||
|
||||||
@@ -695,7 +695,7 @@ Return Value:
|
|||||||
CdRaiseStatus( IrpContext, STATUS_VOLUME_DISMOUNTED );
|
CdRaiseStatus( IrpContext, STATUS_VOLUME_DISMOUNTED );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
CdRaiseStatus( IrpContext, STATUS_FILE_INVALID );
|
CdRaiseStatus( IrpContext, STATUS_FILE_INVALID );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -753,7 +753,7 @@ Return Value:
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
@@ -922,7 +922,7 @@ Return Value:
|
|||||||
// Indicate we used up the swap.
|
// Indicate we used up the swap.
|
||||||
//
|
//
|
||||||
|
|
||||||
Vcb->SwapVpb = NULL;
|
Vcb->SwapVpb = NULL;
|
||||||
|
|
||||||
CdUnlockVcb( IrpContext, Vcb );
|
CdUnlockVcb( IrpContext, Vcb );
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ CdQueryFsSectorSizeInfo (
|
|||||||
#pragma alloc_text(PAGE, CdQueryFsSectorSizeInfo)
|
#pragma alloc_text(PAGE, CdQueryFsSectorSizeInfo)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdCommonQueryVolInfo (
|
CdCommonQueryVolInfo (
|
||||||
@@ -221,7 +221,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -314,7 +314,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -377,7 +377,7 @@ Return Value:
|
|||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -441,7 +441,7 @@ Return Value:
|
|||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ CdAddToWorkque (
|
|||||||
#pragma alloc_text(PAGE, CdPrePostIrp)
|
#pragma alloc_text(PAGE, CdPrePostIrp)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdFsdPostRequest (
|
CdFsdPostRequest (
|
||||||
@@ -96,8 +96,8 @@ Return Value:
|
|||||||
return STATUS_PENDING;
|
return STATUS_PENDING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
@@ -221,7 +221,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
@@ -316,7 +316,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ __pragma(warning(suppress: 6320)) \
|
|||||||
#pragma alloc_text(PAGE, CdCommonWrite)
|
#pragma alloc_text(PAGE, CdCommonWrite)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdCommonWrite (
|
CdCommonWrite (
|
||||||
@@ -165,7 +165,7 @@ Return Value:
|
|||||||
_SEH2_TRY {
|
_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.
|
// dismounting the volume.
|
||||||
//
|
//
|
||||||
|
|
||||||
@@ -334,7 +334,7 @@ Return Value:
|
|||||||
} else if (WriteByteCount != ByteCount) {
|
} else if (WriteByteCount != ByteCount) {
|
||||||
|
|
||||||
CdMapUserBuffer( IrpContext, &UserBuffer );
|
CdMapUserBuffer( IrpContext, &UserBuffer );
|
||||||
|
|
||||||
SafeZeroMemory( IrpContext,
|
SafeZeroMemory( IrpContext,
|
||||||
Add2Ptr( UserBuffer,
|
Add2Ptr( UserBuffer,
|
||||||
ByteCount,
|
ByteCount,
|
||||||
|
|||||||
@@ -931,7 +931,7 @@ struct _EXT2_MCB {
|
|||||||
// List Link to Vcb->McbList
|
// List Link to Vcb->McbList
|
||||||
LIST_ENTRY Link;
|
LIST_ENTRY Link;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct inode Inode;
|
struct inode Inode;
|
||||||
struct dentry *de;
|
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); \
|
return test_and_clear_bit(BH_##bit, &(bh)->b_state); \
|
||||||
} \
|
} \
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Emit the buffer bitops functions. Note that there are also functions
|
* Emit the buffer bitops functions. Note that there are also functions
|
||||||
* of the form "mark_buffer_foo()". These are higher-level functions which
|
* of the form "mark_buffer_foo()". These are higher-level functions which
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ Ext2FollowLink (
|
|||||||
SetLongFlag(Mcb->Flags, MCB_TYPE_SYMLINK);
|
SetLongFlag(Mcb->Flags, MCB_TYPE_SYMLINK);
|
||||||
ClearLongFlag(Mcb->Flags, MCB_TYPE_SPECIAL);
|
ClearLongFlag(Mcb->Flags, MCB_TYPE_SPECIAL);
|
||||||
ASSERT(Mcb->Target->Refercount > 0);
|
ASSERT(Mcb->Target->Refercount > 0);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Mcb->Target = Target;
|
Mcb->Target = Target;
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ Ext2DispatchRequest (IN PEXT2_IRP_CONTEXT IrpContext)
|
|||||||
#if (_WIN32_WINNT >= 0x0500)
|
#if (_WIN32_WINNT >= 0x0500)
|
||||||
case IRP_MJ_PNP:
|
case IRP_MJ_PNP:
|
||||||
return Ext2Pnp(IrpContext);
|
return Ext2Pnp(IrpContext);
|
||||||
#endif //(_WIN32_WINNT >= 0x0500)
|
#endif //(_WIN32_WINNT >= 0x0500)
|
||||||
default:
|
default:
|
||||||
DEBUG(DL_ERR, ( "Ext2DispatchRequest: Unexpected major function: %xh\n",
|
DEBUG(DL_ERR, ( "Ext2DispatchRequest: Unexpected major function: %xh\n",
|
||||||
IrpContext->MajorFunction));
|
IrpContext->MajorFunction));
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ Ext2QueryEa (
|
|||||||
|
|
||||||
// Link FullEa and LastFullEa together
|
// Link FullEa and LastFullEa together
|
||||||
if (LastFullEa)
|
if (LastFullEa)
|
||||||
LastFullEa->NextEntryOffset = (ULONG)((PCHAR)FullEa -
|
LastFullEa->NextEntryOffset = (ULONG)((PCHAR)FullEa -
|
||||||
(PCHAR)LastFullEa);
|
(PCHAR)LastFullEa);
|
||||||
|
|
||||||
LastFullEa = FullEa;
|
LastFullEa = FullEa;
|
||||||
|
|||||||
@@ -686,7 +686,7 @@ Ext2LoadBlock (IN PEXT2_VCB Vcb,
|
|||||||
fini_bh(&bh);
|
fini_bh(&bh);
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1352,7 +1352,7 @@ repeat:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((gd->bg_flags & cpu_to_le16(EXT4_BG_INODE_UNINIT)) ||
|
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)) ) {
|
ext4_free_inodes_count(sb, gd)) ) {
|
||||||
Group = i + 1;
|
Group = i + 1;
|
||||||
break;
|
break;
|
||||||
@@ -1437,7 +1437,7 @@ repeat:
|
|||||||
|
|
||||||
/* this group is 100% cocucpied */
|
/* this group is 100% cocucpied */
|
||||||
fini_bh(&gb);
|
fini_bh(&gb);
|
||||||
|
|
||||||
i = GroupHint;
|
i = GroupHint;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1461,7 +1461,7 @@ repeat:
|
|||||||
break;
|
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;
|
dwArray = Vcb->max_blocks_per_layer[Layer] - Index;
|
||||||
else
|
else
|
||||||
dwArray = 1;
|
dwArray = 1;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* extents_bread: This function is a wrapper of CcPinRead routine.
|
* extents_bread: This function is a wrapper of CcPinRead routine.
|
||||||
*
|
*
|
||||||
* @sb: the device we need to undergo buffered IO on.
|
* @sb: the device we need to undergo buffered IO on.
|
||||||
* @block: the block we want to read from.
|
* @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.
|
* extents_bwrite: This function is a wrapper of CcPreparePinWrite routine.
|
||||||
*
|
*
|
||||||
* @sb: the device we need to undergo buffered IO on.
|
* @sb: the device we need to undergo buffered IO on.
|
||||||
* @block: the block we want to write to.
|
* @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
|
* extents_mark_buffer_dirty: Mark the buffer dirtied and so
|
||||||
* that changes will be written back.
|
* that changes will be written back.
|
||||||
*
|
*
|
||||||
* @bh: The corresponding buffer header that is modified.
|
* @bh: The corresponding buffer header that is modified.
|
||||||
*/
|
*/
|
||||||
void extents_mark_buffer_dirty(struct buffer_head *bh)
|
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;
|
path[depth].p_ext = ex;
|
||||||
|
|
||||||
a = ex_ee_block > start ? ex_ee_block : start;
|
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;
|
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);
|
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)) {
|
ext4_ext_get_actual_len(ex)) {
|
||||||
|
|
||||||
/* split and initialize right part */
|
/* 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));
|
le16_to_cpu(newex.ee_len), get_default_free_blocks_flags(inode));
|
||||||
goto out2;
|
goto out2;
|
||||||
}
|
}
|
||||||
|
|
||||||
ext4_mark_inode_dirty(icb, handle, inode);
|
ext4_mark_inode_dirty(icb, handle, inode);
|
||||||
|
|
||||||
/* previous routine could use block we allocated */
|
/* 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 */
|
/* Then calculate crc32 checksum block number */
|
||||||
checksum = ext4_crc32c(checksum, &le64_blocknr,
|
checksum = ext4_crc32c(checksum, &le64_blocknr,
|
||||||
sizeof(le64_blocknr));
|
sizeof(le64_blocknr));
|
||||||
/* Finally calculate crc32 checksum against
|
/* Finally calculate crc32 checksum against
|
||||||
* the entire xattr block */
|
* the entire xattr block */
|
||||||
checksum = ext4_crc32c(checksum, header,
|
checksum = ext4_crc32c(checksum, header,
|
||||||
ext4_sb_get_block_size(sb));
|
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)
|
if (a->is_data && !b->is_data)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!a->is_data && b->is_data)
|
if (!a->is_data && b->is_data)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ Ext2MapExtent(
|
|||||||
flags = EXT4_GET_BLOCKS_IO_CREATE_EXT;
|
flags = EXT4_GET_BLOCKS_IO_CREATE_EXT;
|
||||||
max_blocks = EXT_UNWRITTEN_MAX_LEN;
|
max_blocks = EXT_UNWRITTEN_MAX_LEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Alloc) {
|
if (Alloc) {
|
||||||
if (Number && !*Number) {
|
if (Number && !*Number) {
|
||||||
if (max_blocks > *Number) {
|
if (max_blocks > *Number) {
|
||||||
|
|||||||
@@ -750,7 +750,7 @@ Ext2SetFileInformation (IN PEXT2_IRP_CONTEXT IrpContext)
|
|||||||
|
|
||||||
if (AllocationSize.QuadPart > Fcb->Header.AllocationSize.QuadPart) {
|
if (AllocationSize.QuadPart > Fcb->Header.AllocationSize.QuadPart) {
|
||||||
|
|
||||||
Status = Ext2ExpandFile(IrpContext, Vcb, Mcb, &AllocationSize);
|
Status = Ext2ExpandFile(IrpContext, Vcb, Mcb, &AllocationSize);
|
||||||
Fcb->Header.AllocationSize = AllocationSize;
|
Fcb->Header.AllocationSize = AllocationSize;
|
||||||
NotifyFilter = FILE_NOTIFY_CHANGE_SIZE;
|
NotifyFilter = FILE_NOTIFY_CHANGE_SIZE;
|
||||||
SetLongFlag(Fcb->Flags, FCB_ALLOC_IN_SETINFO);
|
SetLongFlag(Fcb->Flags, FCB_ALLOC_IN_SETINFO);
|
||||||
@@ -1169,7 +1169,7 @@ Ext2ExpandFile(
|
|||||||
return STATUS_INVALID_DEVICE_REQUEST;
|
return STATUS_INVALID_DEVICE_REQUEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* expandind file extents */
|
/* expandind file extents */
|
||||||
if (INODE_HAS_EXTENT(&Mcb->Inode)) {
|
if (INODE_HAS_EXTENT(&Mcb->Inode)) {
|
||||||
|
|
||||||
status = Ext2ExpandExtent(IrpContext, Vcb, Mcb, Start, End, Size);
|
status = Ext2ExpandExtent(IrpContext, Vcb, Mcb, Start, End, Size);
|
||||||
|
|||||||
@@ -1406,7 +1406,7 @@ Ext2GetReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
|||||||
|
|
||||||
UNICODE_STRING UniName;
|
UNICODE_STRING UniName;
|
||||||
OEM_STRING OemName;
|
OEM_STRING OemName;
|
||||||
|
|
||||||
PCHAR OemNameBuffer = NULL;
|
PCHAR OemNameBuffer = NULL;
|
||||||
int OemNameLength = 0, i;
|
int OemNameLength = 0, i;
|
||||||
|
|
||||||
@@ -1419,7 +1419,7 @@ Ext2GetReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
|||||||
Mcb = IrpContext->Fcb->Mcb;
|
Mcb = IrpContext->Fcb->Mcb;
|
||||||
Irp = IrpContext->Irp;
|
Irp = IrpContext->Irp;
|
||||||
IrpSp = IoGetCurrentIrpStackLocation(Irp);
|
IrpSp = IoGetCurrentIrpStackLocation(Irp);
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
if (!Mcb || !IsInodeSymLink(&Mcb->Inode) ||
|
if (!Mcb || !IsInodeSymLink(&Mcb->Inode) ||
|
||||||
@@ -1427,7 +1427,7 @@ Ext2GetReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
|||||||
Status = STATUS_NOT_A_REPARSE_POINT;
|
Status = STATUS_NOT_A_REPARSE_POINT;
|
||||||
_SEH2_LEAVE;
|
_SEH2_LEAVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputBuffer = (PVOID)Irp->AssociatedIrp.SystemBuffer;
|
OutputBuffer = (PVOID)Irp->AssociatedIrp.SystemBuffer;
|
||||||
OutputBufferLength = IrpSp->Parameters.FileSystemControl.OutputBufferLength;
|
OutputBufferLength = IrpSp->Parameters.FileSystemControl.OutputBufferLength;
|
||||||
|
|
||||||
@@ -1493,11 +1493,11 @@ Ext2GetReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
|||||||
RtlMoveMemory( (PUCHAR)RDB->SymbolicLinkReparseBuffer.PathBuffer +
|
RtlMoveMemory( (PUCHAR)RDB->SymbolicLinkReparseBuffer.PathBuffer +
|
||||||
RDB->SymbolicLinkReparseBuffer.SubstituteNameOffset,
|
RDB->SymbolicLinkReparseBuffer.SubstituteNameOffset,
|
||||||
UniName.Buffer, UniName.Length);
|
UniName.Buffer, UniName.Length);
|
||||||
|
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
} _SEH2_FINALLY {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
if (OemNameBuffer) {
|
if (OemNameBuffer) {
|
||||||
Ext2FreePool(OemNameBuffer, 'NL2E');
|
Ext2FreePool(OemNameBuffer, 'NL2E');
|
||||||
}
|
}
|
||||||
@@ -1510,7 +1510,7 @@ Ext2GetReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1582,7 +1582,7 @@ Ext2SetReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
|||||||
PEXT2_MCB Mcb = NULL;
|
PEXT2_MCB Mcb = NULL;
|
||||||
|
|
||||||
NTSTATUS Status = STATUS_UNSUCCESSFUL;
|
NTSTATUS Status = STATUS_UNSUCCESSFUL;
|
||||||
|
|
||||||
PVOID InputBuffer;
|
PVOID InputBuffer;
|
||||||
ULONG InputBufferLength;
|
ULONG InputBufferLength;
|
||||||
ULONG BytesWritten = 0;
|
ULONG BytesWritten = 0;
|
||||||
@@ -1594,7 +1594,7 @@ Ext2SetReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
|||||||
|
|
||||||
UNICODE_STRING UniName;
|
UNICODE_STRING UniName;
|
||||||
OEM_STRING OemName;
|
OEM_STRING OemName;
|
||||||
|
|
||||||
PCHAR OemNameBuffer = NULL;
|
PCHAR OemNameBuffer = NULL;
|
||||||
int OemNameLength = 0, i;
|
int OemNameLength = 0, i;
|
||||||
|
|
||||||
@@ -1641,7 +1641,7 @@ Ext2SetReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
|||||||
_SEH2_LEAVE;
|
_SEH2_LEAVE;
|
||||||
}
|
}
|
||||||
MainResourceAcquired = TRUE;
|
MainResourceAcquired = TRUE;
|
||||||
|
|
||||||
InputBuffer = Irp->AssociatedIrp.SystemBuffer;
|
InputBuffer = Irp->AssociatedIrp.SystemBuffer;
|
||||||
InputBufferLength = IrpSp->Parameters.FileSystemControl.InputBufferLength;
|
InputBufferLength = IrpSp->Parameters.FileSystemControl.InputBufferLength;
|
||||||
|
|
||||||
@@ -1717,11 +1717,11 @@ Ext2SetReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
|||||||
if (MainResourceAcquired) {
|
if (MainResourceAcquired) {
|
||||||
ExReleaseResourceLite(&Fcb->MainResource);
|
ExReleaseResourceLite(&Fcb->MainResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OemNameBuffer) {
|
if (OemNameBuffer) {
|
||||||
Ext2FreePool(OemNameBuffer, 'NL2E');
|
Ext2FreePool(OemNameBuffer, 'NL2E');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NT_SUCCESS(Status)) {
|
if (NT_SUCCESS(Status)) {
|
||||||
Ext2NotifyReportChange(
|
Ext2NotifyReportChange(
|
||||||
IrpContext,
|
IrpContext,
|
||||||
@@ -1743,7 +1743,7 @@ Ext2SetReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
|||||||
Ext2ReleaseFcb(ParentDcb);
|
Ext2ReleaseFcb(ParentDcb);
|
||||||
}
|
}
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1759,7 +1759,7 @@ Ext2TruncateSymlink(
|
|||||||
PUCHAR data = (PUCHAR)&Mcb->Inode.i_block;
|
PUCHAR data = (PUCHAR)&Mcb->Inode.i_block;
|
||||||
ULONG len = (ULONG)Mcb->Inode.i_size;
|
ULONG len = (ULONG)Mcb->Inode.i_size;
|
||||||
LARGE_INTEGER NewSize;
|
LARGE_INTEGER NewSize;
|
||||||
|
|
||||||
if (len < EXT2_LINKLEN_IN_INODE && !Mcb->Inode.i_blocks) {
|
if (len < EXT2_LINKLEN_IN_INODE && !Mcb->Inode.i_blocks) {
|
||||||
|
|
||||||
RtlZeroMemory(data + Size, EXT2_LINKLEN_IN_INODE - Size);
|
RtlZeroMemory(data + Size, EXT2_LINKLEN_IN_INODE - Size);
|
||||||
@@ -1773,7 +1773,7 @@ Ext2TruncateSymlink(
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -1799,7 +1799,7 @@ Ext2DeleteReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
|||||||
|
|
||||||
BOOLEAN FcbLockAcquired = FALSE;
|
BOOLEAN FcbLockAcquired = FALSE;
|
||||||
BOOLEAN MainResourceAcquired = FALSE;
|
BOOLEAN MainResourceAcquired = FALSE;
|
||||||
|
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
@@ -1868,7 +1868,7 @@ Ext2DeleteReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
|||||||
if (MainResourceAcquired) {
|
if (MainResourceAcquired) {
|
||||||
ExReleaseResourceLite(&Fcb->MainResource);
|
ExReleaseResourceLite(&Fcb->MainResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NT_SUCCESS(Status)) {
|
if (NT_SUCCESS(Status)) {
|
||||||
Ext2NotifyReportChange(
|
Ext2NotifyReportChange(
|
||||||
IrpContext,
|
IrpContext,
|
||||||
@@ -1878,7 +1878,7 @@ Ext2DeleteReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
|||||||
FILE_ACTION_MODIFIED );
|
FILE_ACTION_MODIFIED );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_SEH2_AbnormalTermination()) {
|
if (!_SEH2_AbnormalTermination()) {
|
||||||
if (Status == STATUS_PENDING || Status == STATUS_CANT_WAIT) {
|
if (Status == STATUS_PENDING || Status == STATUS_CANT_WAIT) {
|
||||||
Status = Ext2QueueRequest(IrpContext);
|
Status = Ext2QueueRequest(IrpContext);
|
||||||
@@ -1895,7 +1895,7 @@ Ext2DeleteReparsePoint (IN PEXT2_IRP_CONTEXT IrpContext)
|
|||||||
Ext2ReleaseFcb(Fcb);
|
Ext2ReleaseFcb(Fcb);
|
||||||
}
|
}
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1928,11 +1928,11 @@ Ext2UserFsRequest (IN PEXT2_IRP_CONTEXT IrpContext)
|
|||||||
case FSCTL_GET_REPARSE_POINT:
|
case FSCTL_GET_REPARSE_POINT:
|
||||||
Status = Ext2GetReparsePoint(IrpContext);
|
Status = Ext2GetReparsePoint(IrpContext);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FSCTL_SET_REPARSE_POINT:
|
case FSCTL_SET_REPARSE_POINT:
|
||||||
Status = Ext2SetReparsePoint(IrpContext);
|
Status = Ext2SetReparsePoint(IrpContext);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FSCTL_DELETE_REPARSE_POINT:
|
case FSCTL_DELETE_REPARSE_POINT:
|
||||||
Status = Ext2DeleteReparsePoint(IrpContext);
|
Status = Ext2DeleteReparsePoint(IrpContext);
|
||||||
break;
|
break;
|
||||||
@@ -2615,7 +2615,7 @@ Ext2CheckDismount (
|
|||||||
ExAcquireResourceExclusiveLite(
|
ExAcquireResourceExclusiveLite(
|
||||||
&Vcb->MainResource, TRUE );
|
&Vcb->MainResource, TRUE );
|
||||||
|
|
||||||
if (IrpContext &&
|
if (IrpContext &&
|
||||||
IrpContext->MajorFunction == IRP_MJ_CREATE &&
|
IrpContext->MajorFunction == IRP_MJ_CREATE &&
|
||||||
IrpContext->RealDevice == Vcb->RealDevice) {
|
IrpContext->RealDevice == Vcb->RealDevice) {
|
||||||
UnCleanCount = 2;
|
UnCleanCount = 2;
|
||||||
|
|||||||
@@ -432,7 +432,7 @@ get_block_bh_mdl(
|
|||||||
sector_t block,
|
sector_t block,
|
||||||
unsigned long size,
|
unsigned long size,
|
||||||
int zero
|
int zero
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
PEXT2_VCB Vcb = bdev->bd_priv;
|
PEXT2_VCB Vcb = bdev->bd_priv;
|
||||||
LARGE_INTEGER offset;
|
LARGE_INTEGER offset;
|
||||||
@@ -613,7 +613,7 @@ get_block_bh_pin(
|
|||||||
sector_t block,
|
sector_t block,
|
||||||
unsigned long size,
|
unsigned long size,
|
||||||
int zero
|
int zero
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
PEXT2_VCB Vcb = bdev->bd_priv;
|
PEXT2_VCB Vcb = bdev->bd_priv;
|
||||||
LARGE_INTEGER offset;
|
LARGE_INTEGER offset;
|
||||||
@@ -758,7 +758,7 @@ get_block_bh(
|
|||||||
sector_t block,
|
sector_t block,
|
||||||
unsigned long size,
|
unsigned long size,
|
||||||
int zero
|
int zero
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return get_block_bh_mdl(bdev, block, size, zero);
|
return get_block_bh_mdl(bdev, block, size, zero);
|
||||||
}
|
}
|
||||||
@@ -776,7 +776,7 @@ get_block_bh(
|
|||||||
sector_t block,
|
sector_t block,
|
||||||
unsigned long size,
|
unsigned long size,
|
||||||
int zero
|
int zero
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return get_block_bh_pin(bdev, block, size, 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",
|
DEBUG(DL_INF, ("Ext2FreeFcb: Fcb (%p) to be unlinked: %wZ.\n",
|
||||||
Fcb, Mcb ? &Mcb->FullName : NULL));
|
Fcb, Mcb ? &Mcb->FullName : NULL));
|
||||||
|
|
||||||
if ((Mcb != NULL) &&
|
if ((Mcb != NULL) &&
|
||||||
(Mcb->Identifier.Type == EXT2MCB) &&
|
(Mcb->Identifier.Type == EXT2MCB) &&
|
||||||
(Mcb->Identifier.Size == sizeof(EXT2_MCB))) {
|
(Mcb->Identifier.Size == sizeof(EXT2_MCB))) {
|
||||||
|
|
||||||
|
|||||||
@@ -1131,7 +1131,7 @@ Ext2WriteFile(IN PEXT2_IRP_CONTEXT IrpContext)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!CcCopyWrite(FileObject, &ByteOffset, Length, Ext2CanIWait(), Buffer)) {
|
if (!CcCopyWrite(FileObject, &ByteOffset, Length, Ext2CanIWait(), Buffer)) {
|
||||||
if (Ext2CanIWait() ||
|
if (Ext2CanIWait() ||
|
||||||
!CcCopyWrite(FileObject, &ByteOffset, Length, TRUE, Buffer)) {
|
!CcCopyWrite(FileObject, &ByteOffset, Length, TRUE, Buffer)) {
|
||||||
Status = STATUS_PENDING;
|
Status = STATUS_PENDING;
|
||||||
DbgBreak();
|
DbgBreak();
|
||||||
|
|||||||
@@ -340,7 +340,7 @@ FATGetNextDirEntry(
|
|||||||
*pContext = NULL;
|
*pContext = NULL;
|
||||||
return STATUS_NO_MORE_ENTRIES;
|
return STATUS_NO_MORE_ENTRIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FAT_ENTRY_DELETED(fatDirEntry))
|
if (FAT_ENTRY_DELETED(fatDirEntry))
|
||||||
{
|
{
|
||||||
dirMap = 0;
|
dirMap = 0;
|
||||||
@@ -365,7 +365,7 @@ FATGetNextDirEntry(
|
|||||||
2, longNameEntry->name11_12);
|
2, longNameEntry->name11_12);
|
||||||
|
|
||||||
index = longNameEntry->id & 0x3f; // Note: it can be 0 for corrupted FS
|
index = longNameEntry->id & 0x3f; // Note: it can be 0 for corrupted FS
|
||||||
|
|
||||||
/* Make sure index is valid and we have enough space in buffer
|
/* Make sure index is valid and we have enough space in buffer
|
||||||
(we count one char for \0) */
|
(we count one char for \0) */
|
||||||
if (index > 0 &&
|
if (index > 0 &&
|
||||||
@@ -462,7 +462,7 @@ FATGetNextDirEntry(
|
|||||||
DirContext->LongNameU.Buffer[DirContext->LongNameU.MaximumLength / sizeof(WCHAR) - 1]
|
DirContext->LongNameU.Buffer[DirContext->LongNameU.MaximumLength / sizeof(WCHAR) - 1]
|
||||||
= UNICODE_NULL;
|
= UNICODE_NULL;
|
||||||
DirContext->LongNameU.Length = wcslen(DirContext->LongNameU.Buffer) * sizeof(WCHAR);
|
DirContext->LongNameU.Length = wcslen(DirContext->LongNameU.Buffer) * sizeof(WCHAR);
|
||||||
|
|
||||||
/* Init short name */
|
/* Init short name */
|
||||||
vfat8Dot3ToString(&DirContext->DirEntry.Fat, &DirContext->ShortNameU);
|
vfat8Dot3ToString(&DirContext->DirEntry.Fat, &DirContext->ShortNameU);
|
||||||
|
|
||||||
|
|||||||
@@ -500,7 +500,7 @@ FATAddEntry(
|
|||||||
ASSERT(SearchContext.DirEntry.Fat.FileSize == MoveContext->FileSize);
|
ASSERT(SearchContext.DirEntry.Fat.FileSize == MoveContext->FileSize);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i == 100) /* FIXME : what to do after this ? */
|
if (i == 100) /* FIXME : what to do after this ? */
|
||||||
@@ -537,7 +537,7 @@ FATAddEntry(
|
|||||||
needLong = TRUE;
|
needLong = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == L'.')
|
if (c == L'.')
|
||||||
{
|
{
|
||||||
InExtension = TRUE;
|
InExtension = TRUE;
|
||||||
|
|||||||
@@ -728,7 +728,7 @@ VfatSetRenameInformation(
|
|||||||
|
|
||||||
if (RenameInfo->RootDirectory != NULL)
|
if (RenameInfo->RootDirectory != NULL)
|
||||||
{
|
{
|
||||||
/* Here, copy first absolute and then append relative */
|
/* Here, copy first absolute and then append relative */
|
||||||
RtlCopyUnicodeString(&NewName, &RootFCB->PathNameU);
|
RtlCopyUnicodeString(&NewName, &RootFCB->PathNameU);
|
||||||
NewName.Buffer[NewName.Length / sizeof(WCHAR)] = L'\\';
|
NewName.Buffer[NewName.Length / sizeof(WCHAR)] = L'\\';
|
||||||
NewName.Length += sizeof(WCHAR);
|
NewName.Length += sizeof(WCHAR);
|
||||||
|
|||||||
@@ -354,7 +354,7 @@ VfatHasFileSystem(
|
|||||||
* Set it to 0 if you wish to use the associated FCB with caching.
|
* 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!
|
* 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)
|
* 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
|
static
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
|||||||
@@ -483,7 +483,7 @@ typedef struct _VFATFCB
|
|||||||
/* List of FCB's for this volume */
|
/* List of FCB's for this volume */
|
||||||
LIST_ENTRY FcbListEntry;
|
LIST_ENTRY FcbListEntry;
|
||||||
|
|
||||||
/* List of FCB's for the parent */
|
/* List of FCB's for the parent */
|
||||||
LIST_ENTRY ParentListEntry;
|
LIST_ENTRY ParentListEntry;
|
||||||
|
|
||||||
/* pointer to the parent fcb */
|
/* pointer to the parent fcb */
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ FatCreateRestrictEveryoneToken(
|
|||||||
#pragma alloc_text(PAGE, FatExplicitDeviceAccessGranted)
|
#pragma alloc_text(PAGE, FatExplicitDeviceAccessGranted)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
FatCheckFileAccess (
|
FatCheckFileAccess (
|
||||||
PIRP_CONTEXT IrpContext,
|
PIRP_CONTEXT IrpContext,
|
||||||
@@ -144,12 +144,12 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// If this is a subdirectory also allow add file/directory and delete.
|
// If this is a subdirectory also allow add file/directory and delete.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (FlagOn(DirentAttributes, FAT_DIRENT_ATTR_DIRECTORY)) {
|
if (FlagOn(DirentAttributes, FAT_DIRENT_ATTR_DIRECTORY)) {
|
||||||
|
|
||||||
AccessMask |= FILE_ADD_SUBDIRECTORY | FILE_ADD_FILE | FILE_DELETE_CHILD;
|
AccessMask |= FILE_ADD_SUBDIRECTORY | FILE_ADD_FILE | FILE_DELETE_CHILD;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FlagOn(*DesiredAccess, ~AccessMask)) {
|
if (FlagOn(*DesiredAccess, ~AccessMask)) {
|
||||||
|
|
||||||
DebugTrace(0, Dbg, "Cannot open readonly\n", 0);
|
DebugTrace(0, Dbg, "Cannot open readonly\n", 0);
|
||||||
@@ -189,7 +189,7 @@ Routine Description:
|
|||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
AccessState - the access state describing the security context to be checked
|
AccessState - the access state describing the security context to be checked
|
||||||
|
|
||||||
ProcessorMode - the mode this check should occur against
|
ProcessorMode - the mode this check should occur against
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
@@ -220,7 +220,7 @@ Return Value:
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FatExplicitDeviceAccessGranted (
|
FatExplicitDeviceAccessGranted (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -241,9 +241,9 @@ Routine Description:
|
|||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
DeviceObject - the device whose ACL will be checked
|
DeviceObject - the device whose ACL will be checked
|
||||||
|
|
||||||
AccessState - the access state describing the security context to be checked
|
AccessState - the access state describing the security context to be checked
|
||||||
|
|
||||||
ProcessorMode - the mode this check should occur against
|
ProcessorMode - the mode this check should occur against
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
@@ -257,9 +257,9 @@ Return Value:
|
|||||||
|
|
||||||
PACCESS_TOKEN OriginalAccessToken;
|
PACCESS_TOKEN OriginalAccessToken;
|
||||||
PACCESS_TOKEN RestrictedAccessToken;
|
PACCESS_TOKEN RestrictedAccessToken;
|
||||||
|
|
||||||
PACCESS_TOKEN *EffectiveToken;
|
PACCESS_TOKEN *EffectiveToken;
|
||||||
|
|
||||||
ACCESS_MASK GrantedAccess;
|
ACCESS_MASK GrantedAccess;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
@@ -295,7 +295,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
SeLockSubjectContext( &AccessState->SubjectSecurityContext );
|
SeLockSubjectContext( &AccessState->SubjectSecurityContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Convert the token in the subject context into one which does not
|
// Convert the token in the subject context into one which does not
|
||||||
// acquire access through the Everyone SID.
|
// acquire access through the Everyone SID.
|
||||||
@@ -304,7 +304,7 @@ Return Value:
|
|||||||
// SeQuerySubjectContextToken; since there is no natural way
|
// SeQuerySubjectContextToken; since there is no natural way
|
||||||
// of getting a pointer to it, do it by hand.
|
// of getting a pointer to it, do it by hand.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (ARGUMENT_PRESENT( AccessState->SubjectSecurityContext.ClientToken )) {
|
if (ARGUMENT_PRESENT( AccessState->SubjectSecurityContext.ClientToken )) {
|
||||||
EffectiveToken = &AccessState->SubjectSecurityContext.ClientToken;
|
EffectiveToken = &AccessState->SubjectSecurityContext.ClientToken;
|
||||||
} else {
|
} else {
|
||||||
@@ -315,7 +315,7 @@ Return Value:
|
|||||||
Status = FatCreateRestrictEveryoneToken( OriginalAccessToken, &RestrictedAccessToken );
|
Status = FatCreateRestrictEveryoneToken( OriginalAccessToken, &RestrictedAccessToken );
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status)) {
|
if (!NT_SUCCESS(Status)) {
|
||||||
|
|
||||||
SeReleaseSubjectContext( &AccessState->SubjectSecurityContext );
|
SeReleaseSubjectContext( &AccessState->SubjectSecurityContext );
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@@ -327,7 +327,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
*EffectiveToken = RestrictedAccessToken;
|
*EffectiveToken = RestrictedAccessToken;
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma prefast( suppress: 28175, "we're a file system, this is ok to touch" )
|
#pragma prefast( suppress: 28175, "we're a file system, this is ok to touch" )
|
||||||
#endif
|
#endif
|
||||||
@@ -341,9 +341,9 @@ Return Value:
|
|||||||
ProcessorMode,
|
ProcessorMode,
|
||||||
&GrantedAccess,
|
&GrantedAccess,
|
||||||
&Status );
|
&Status );
|
||||||
|
|
||||||
*EffectiveToken = OriginalAccessToken;
|
*EffectiveToken = OriginalAccessToken;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cleanup and return.
|
// Cleanup and return.
|
||||||
//
|
//
|
||||||
@@ -354,7 +354,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FatCreateRestrictEveryoneToken (
|
FatCreateRestrictEveryoneToken (
|
||||||
IN PACCESS_TOKEN Token,
|
IN PACCESS_TOKEN Token,
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ Routine Description:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatReadVolumeFile (
|
FatReadVolumeFile (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -183,8 +183,8 @@ Arguments:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatPrepareWriteVolumeFile (
|
FatPrepareWriteVolumeFile (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -228,7 +228,7 @@ Arguments:
|
|||||||
Reversible - Supplies TRUE if the specified range of modification should
|
Reversible - Supplies TRUE if the specified range of modification should
|
||||||
be repinned so that the operation can be reversed in a controlled
|
be repinned so that the operation can be reversed in a controlled
|
||||||
fashion if errors are encountered.
|
fashion if errors are encountered.
|
||||||
|
|
||||||
Zero - Supplies TRUE if the specified range of bytes should be zeroed
|
Zero - Supplies TRUE if the specified range of bytes should be zeroed
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
@@ -237,7 +237,7 @@ Arguments:
|
|||||||
LARGE_INTEGER Vbo;
|
LARGE_INTEGER Vbo;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check to see that all references are within the Bios Parameter Block
|
// Check to see that all references are within the Bios Parameter Block
|
||||||
// or the fat(s).
|
// or the fat(s).
|
||||||
@@ -284,7 +284,7 @@ Arguments:
|
|||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
if (Zero) {
|
if (Zero) {
|
||||||
|
|
||||||
RtlZeroMemory( *Buffer, ByteCount );
|
RtlZeroMemory( *Buffer, ByteCount );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,7 +303,7 @@ Arguments:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatReadDirectoryFile (
|
FatReadDirectoryFile (
|
||||||
@@ -349,7 +349,7 @@ Arguments:
|
|||||||
LARGE_INTEGER Vbo;
|
LARGE_INTEGER Vbo;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
DebugTrace(+1, Dbg, "FatReadDirectoryFile\n", 0);
|
DebugTrace(+1, Dbg, "FatReadDirectoryFile\n", 0);
|
||||||
DebugTrace( 0, Dbg, "Dcb = %p\n", Dcb);
|
DebugTrace( 0, Dbg, "Dcb = %p\n", Dcb);
|
||||||
DebugTrace( 0, Dbg, "StartingVbo = %08lx\n", StartingVbo);
|
DebugTrace( 0, Dbg, "StartingVbo = %08lx\n", StartingVbo);
|
||||||
@@ -445,7 +445,7 @@ Arguments:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatPrepareWriteDirectoryFile (
|
FatPrepareWriteDirectoryFile (
|
||||||
@@ -484,11 +484,11 @@ Arguments:
|
|||||||
Buffer - Returns a pointer to the sectors, which is valid until unpinned
|
Buffer - Returns a pointer to the sectors, which is valid until unpinned
|
||||||
|
|
||||||
Zero - Supplies TRUE if the specified range of bytes should be zeroed
|
Zero - Supplies TRUE if the specified range of bytes should be zeroed
|
||||||
|
|
||||||
Reversible - Supplies TRUE if the specified range of modification should
|
Reversible - Supplies TRUE if the specified range of modification should
|
||||||
be repinned so that the operation can be reversed in a controlled
|
be repinned so that the operation can be reversed in a controlled
|
||||||
fashion if errors are encountered.
|
fashion if errors are encountered.
|
||||||
|
|
||||||
Status - Returns the status of the operation.
|
Status - Returns the status of the operation.
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
@@ -503,7 +503,7 @@ Arguments:
|
|||||||
ULONG MappingGranularity = PAGE_SIZE;
|
ULONG MappingGranularity = PAGE_SIZE;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
DebugTrace(+1, Dbg, "FatPrepareWriteDirectoryFile\n", 0);
|
DebugTrace(+1, Dbg, "FatPrepareWriteDirectoryFile\n", 0);
|
||||||
DebugTrace( 0, Dbg, "Dcb = %p\n", Dcb);
|
DebugTrace( 0, Dbg, "Dcb = %p\n", Dcb);
|
||||||
DebugTrace( 0, Dbg, "StartingVbo = %08lx\n", (ULONG)StartingVbo);
|
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.
|
// 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
|
// 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
|
// VACB_MAPPING_GRANULARITY. This will prevent Cc from returning OBCBs
|
||||||
// and hence will prevent bugchecks when we then attempt to repin one, yet
|
// 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.
|
// allow us to be more efficient by pinning in 256KB chunks instead of 4KB pages.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (Vbo.QuadPart > StartingVbo + InitialRequest) {
|
if (Vbo.QuadPart > StartingVbo + InitialRequest) {
|
||||||
|
|
||||||
MappingGranularity = VACB_MAPPING_GRANULARITY;
|
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
|
// the entire range. Note we pin in pages to prevent cache manager from
|
||||||
// returning OBCBs, which would result in a bugcheck on CcRepinBcb.
|
// returning OBCBs, which would result in a bugcheck on CcRepinBcb.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ((Vbo.QuadPart / MappingGranularity) ==
|
if ((Vbo.QuadPart / MappingGranularity) ==
|
||||||
((Vbo.QuadPart + ByteCount - 1) / MappingGranularity)) {
|
((Vbo.QuadPart + ByteCount - 1) / MappingGranularity)) {
|
||||||
|
|
||||||
@@ -619,7 +619,7 @@ Arguments:
|
|||||||
BooleanFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT),
|
BooleanFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT),
|
||||||
&LocalBcb,
|
&LocalBcb,
|
||||||
&LocalBuffer )) {
|
&LocalBuffer )) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Could not read the data without waiting (cache miss).
|
// Could not read the data without waiting (cache miss).
|
||||||
//
|
//
|
||||||
@@ -630,7 +630,7 @@ Arguments:
|
|||||||
//
|
//
|
||||||
// Update our caller with the beginning of their request.
|
// Update our caller with the beginning of their request.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (*Buffer == NULL) {
|
if (*Buffer == NULL) {
|
||||||
|
|
||||||
*Buffer = LocalBuffer;
|
*Buffer = LocalBuffer;
|
||||||
@@ -640,13 +640,13 @@ Arguments:
|
|||||||
DbgDoit( IrpContext->PinCount += 1 )
|
DbgDoit( IrpContext->PinCount += 1 )
|
||||||
|
|
||||||
if (Zero) {
|
if (Zero) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// We set this guy dirty right now so that we can raise CANT_WAIT when
|
// 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
|
// 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.
|
// since we know we don't care about it.
|
||||||
//
|
//
|
||||||
|
|
||||||
RtlZeroMemory( LocalBuffer, BytesToPin );
|
RtlZeroMemory( LocalBuffer, BytesToPin );
|
||||||
CcSetDirtyPinnedData( LocalBcb, NULL );
|
CcSetDirtyPinnedData( LocalBcb, NULL );
|
||||||
}
|
}
|
||||||
@@ -655,7 +655,7 @@ Arguments:
|
|||||||
Vbo.QuadPart += BytesToPin;
|
Vbo.QuadPart += BytesToPin;
|
||||||
|
|
||||||
if (*Bcb != LocalBcb) {
|
if (*Bcb != LocalBcb) {
|
||||||
|
|
||||||
FatRepinBcb( IrpContext, LocalBcb );
|
FatRepinBcb( IrpContext, LocalBcb );
|
||||||
FatUnpinBcb( IrpContext, LocalBcb );
|
FatUnpinBcb( IrpContext, LocalBcb );
|
||||||
}
|
}
|
||||||
@@ -684,14 +684,14 @@ Arguments:
|
|||||||
|
|
||||||
FatUnpinBcb( IrpContext, LocalBcb );
|
FatUnpinBcb( IrpContext, LocalBcb );
|
||||||
}
|
}
|
||||||
|
|
||||||
FatUnpinBcb(IrpContext, *Bcb);
|
FatUnpinBcb(IrpContext, *Bcb);
|
||||||
|
|
||||||
//
|
//
|
||||||
// These steps are carefully arranged - FatTruncateFileAllocation can raise.
|
// These steps are carefully arranged - FatTruncateFileAllocation can raise.
|
||||||
// Make sure we unpin the buffer. If FTFA raises, the effect should be benign.
|
// Make sure we unpin the buffer. If FTFA raises, the effect should be benign.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (UnwindWeAllocatedDiskSpace == TRUE) {
|
if (UnwindWeAllocatedDiskSpace == TRUE) {
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -714,7 +714,7 @@ Arguments:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if DBG
|
#if DBG
|
||||||
BOOLEAN FatDisableParentCheck = 0;
|
BOOLEAN FatDisableParentCheck = 0;
|
||||||
|
|
||||||
@@ -734,32 +734,32 @@ FatIsCurrentOperationSynchedForDcbTeardown (
|
|||||||
ULONG Index = 0;
|
ULONG Index = 0;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
//
|
//
|
||||||
// While mounting, we're OK without having to own anything.
|
// While mounting, we're OK without having to own anything.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (Stack->MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL &&
|
if (Stack->MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL &&
|
||||||
Stack->MinorFunction == IRP_MN_MOUNT_VOLUME) {
|
Stack->MinorFunction == IRP_MN_MOUNT_VOLUME) {
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// With the Vcb held, the close path is blocked out.
|
// With the Vcb held, the close path is blocked out.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (ExIsResourceAcquiredSharedLite( &Dcb->Vcb->Resource ) ||
|
if (ExIsResourceAcquiredSharedLite( &Dcb->Vcb->Resource ) ||
|
||||||
ExIsResourceAcquiredExclusiveLite( &Dcb->Vcb->Resource )) {
|
ExIsResourceAcquiredExclusiveLite( &Dcb->Vcb->Resource )) {
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Accept this assertion at face value. It comes from GetDirentForFcbOrDcb,
|
// Accept this assertion at face value. It comes from GetDirentForFcbOrDcb,
|
||||||
// and is reliable.
|
// and is reliable.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_PARENT_BY_CHILD )) {
|
if (FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_PARENT_BY_CHILD )) {
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -776,29 +776,29 @@ FatIsCurrentOperationSynchedForDcbTeardown (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Stack->FileObject) {
|
if (Stack->FileObject) {
|
||||||
|
|
||||||
ToCheck[Index++] = Stack->FileObject;
|
ToCheck[Index++] = Stack->FileObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
ToCheck[Index] = NULL;
|
ToCheck[Index] = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
// If the fileobjects we have are for this dcb or a child of it, we are
|
// 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
|
// also guaranteed that this dcb isn't going anywhere (even without
|
||||||
// the Vcb).
|
// the Vcb).
|
||||||
//
|
//
|
||||||
|
|
||||||
for (Index = 0; ToCheck[Index] != NULL; Index++) {
|
for (Index = 0; ToCheck[Index] != NULL; Index++) {
|
||||||
|
|
||||||
(VOID) FatDecodeFileObject( ToCheck[Index], &Vcb, &Fcb, &Ccb );
|
(VOID) FatDecodeFileObject( ToCheck[Index], &Vcb, &Fcb, &Ccb );
|
||||||
|
|
||||||
while ( Fcb ) {
|
while ( Fcb ) {
|
||||||
|
|
||||||
if (Fcb == Dcb) {
|
if (Fcb == Dcb) {
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Fcb = Fcb->ParentDcb;
|
Fcb = Fcb->ParentDcb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -832,7 +832,7 @@ Return Value:
|
|||||||
|
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
DebugTrace(+1, Dbg, "FatOpenDirectoryFile\n", 0);
|
DebugTrace(+1, Dbg, "FatOpenDirectoryFile\n", 0);
|
||||||
DebugTrace( 0, Dbg, "Dcb = %p\n", Dcb);
|
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).
|
// I really wish we had a proper Fcb synchronization model (like CDFS/UDFS/NTFS).
|
||||||
//
|
//
|
||||||
|
|
||||||
NT_ASSERT( FatIsCurrentOperationSynchedForDcbTeardown( IrpContext, Dcb ));
|
NT_ASSERT( FatIsCurrentOperationSynchedForDcbTeardown( IrpContext, Dcb ));
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -925,7 +925,7 @@ Return Value:
|
|||||||
InterlockedIncrement( (LONG*)&Dcb->Specific.Dcb.DirectoryFileOpenCount );
|
InterlockedIncrement( (LONG*)&Dcb->Specific.Dcb.DirectoryFileOpenCount );
|
||||||
|
|
||||||
Dcb->Specific.Dcb.DirectoryFile = DirectoryFileObject;
|
Dcb->Specific.Dcb.DirectoryFile = DirectoryFileObject;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Indicate we're happy with the fileobject now.
|
// 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.
|
// Rip the object up if we couldn't get the close context.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (DirectoryFileObject) {
|
if (DirectoryFileObject) {
|
||||||
|
|
||||||
ObDereferenceObject( DirectoryFileObject );
|
ObDereferenceObject( DirectoryFileObject );
|
||||||
}
|
}
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
@@ -974,7 +974,7 @@ Return Value:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PFILE_OBJECT
|
PFILE_OBJECT
|
||||||
FatOpenEaFile (
|
FatOpenEaFile (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -1002,7 +1002,7 @@ Return Value:
|
|||||||
PDEVICE_OBJECT RealDevice;
|
PDEVICE_OBJECT RealDevice;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
DebugTrace(+1, Dbg, "FatOpenEaFile\n", 0);
|
DebugTrace(+1, Dbg, "FatOpenEaFile\n", 0);
|
||||||
DebugTrace( 0, Dbg, "EaFcb = %p\n", EaFcb);
|
DebugTrace( 0, Dbg, "EaFcb = %p\n", EaFcb);
|
||||||
|
|
||||||
@@ -1051,7 +1051,7 @@ Return Value:
|
|||||||
EaFcb );
|
EaFcb );
|
||||||
|
|
||||||
CcSetAdditionalCacheAttributes( EaFileObject, TRUE, TRUE );
|
CcSetAdditionalCacheAttributes( EaFileObject, TRUE, TRUE );
|
||||||
|
|
||||||
} _SEH2_FINALLY {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1060,9 +1060,9 @@ Return Value:
|
|||||||
// we lost trying to build the cache map - in which case we're
|
// we lost trying to build the cache map - in which case we're
|
||||||
// OK for the close context if we have to.
|
// OK for the close context if we have to.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (_SEH2_AbnormalTermination()) {
|
if (_SEH2_AbnormalTermination()) {
|
||||||
|
|
||||||
ObDereferenceObject( EaFileObject );
|
ObDereferenceObject( EaFileObject );
|
||||||
}
|
}
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
@@ -1074,7 +1074,7 @@ Return Value:
|
|||||||
return EaFileObject;
|
return EaFileObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatCloseEaFile (
|
FatCloseEaFile (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -1088,26 +1088,26 @@ Routine Description:
|
|||||||
|
|
||||||
This routine shuts down the ea file. Usually this is required when the volume
|
This routine shuts down the ea file. Usually this is required when the volume
|
||||||
begins to leave the system: after verify, dismount, deletion, pnp.
|
begins to leave the system: after verify, dismount, deletion, pnp.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Vcb - the volume to close the ea file on
|
Vcb - the volume to close the ea file on
|
||||||
|
|
||||||
FlushFirst - whether the file should be flushed
|
FlushFirst - whether the file should be flushed
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
|
|
||||||
None. As a side effect, the EA fileobject in the Vcb is cleared.
|
None. As a side effect, the EA fileobject in the Vcb is cleared.
|
||||||
|
|
||||||
Caller must have the Vcb exclusive.
|
Caller must have the Vcb exclusive.
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
{
|
{
|
||||||
PFILE_OBJECT EaFileObject = Vcb->VirtualEaFile;
|
PFILE_OBJECT EaFileObject = Vcb->VirtualEaFile;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
DebugTrace(+1, Dbg, "FatCloseEaFile\n", 0);
|
DebugTrace(+1, Dbg, "FatCloseEaFile\n", 0);
|
||||||
DebugTrace( 0, Dbg, "Vcb = %p\n", Vcb);
|
DebugTrace( 0, Dbg, "Vcb = %p\n", Vcb);
|
||||||
|
|
||||||
@@ -1138,12 +1138,12 @@ Return Value:
|
|||||||
|
|
||||||
ObDereferenceObject( EaFileObject );
|
ObDereferenceObject( EaFileObject );
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugTrace(-1, Dbg, "FatCloseEaFile -> %p\n", EaFileObject);
|
DebugTrace(-1, Dbg, "FatCloseEaFile -> %p\n", EaFileObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatSetDirtyBcb (
|
FatSetDirtyBcb (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -1166,13 +1166,13 @@ Routine Description:
|
|||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Bcb - Supplies the Bcb being set dirty
|
Bcb - Supplies the Bcb being set dirty
|
||||||
|
|
||||||
Vcb - Supplies the volume being marked dirty
|
Vcb - Supplies the volume being marked dirty
|
||||||
|
|
||||||
Reversible - Supplies TRUE if the specified range of bcb should be repinned
|
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
|
so that the changes can be reversed in a controlled fashion if errors
|
||||||
are encountered.
|
are encountered.
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
|
|
||||||
None.
|
None.
|
||||||
@@ -1190,7 +1190,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
if (Reversible) {
|
if (Reversible) {
|
||||||
|
|
||||||
FatRepinBcb( IrpContext, Bcb );
|
FatRepinBcb( IrpContext, Bcb );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1260,7 +1260,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// We use a shorter volume clean timer for hot plug volumes.
|
// We use a shorter volume clean timer for hot plug volumes.
|
||||||
//
|
//
|
||||||
|
|
||||||
CleanVolumeTimer.QuadPart = FlagOn( Vcb->VcbState, VCB_STATE_FLAG_DEFERRED_FLUSH)
|
CleanVolumeTimer.QuadPart = FlagOn( Vcb->VcbState, VCB_STATE_FLAG_DEFERRED_FLUSH)
|
||||||
? (LONG)-1500*1000*10
|
? (LONG)-1500*1000*10
|
||||||
: (LONG)-8*1000*1000*10;
|
: (LONG)-8*1000*1000*10;
|
||||||
@@ -1312,7 +1312,7 @@ Return Value:
|
|||||||
DebugTrace(-1, Dbg, "FatSetDirtyBcb -> VOID\n", 0 );
|
DebugTrace(-1, Dbg, "FatSetDirtyBcb -> VOID\n", 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatRepinBcb (
|
FatRepinBcb (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -1342,7 +1342,7 @@ Return Value:
|
|||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
DebugTrace(+1, Dbg, "FatRepinBcb\n", 0 );
|
DebugTrace(+1, Dbg, "FatRepinBcb\n", 0 );
|
||||||
DebugTrace( 0, Dbg, "IrpContext = %p\n", IrpContext );
|
DebugTrace( 0, Dbg, "IrpContext = %p\n", IrpContext );
|
||||||
DebugTrace( 0, Dbg, "Bcb = %p\n", Bcb );
|
DebugTrace( 0, Dbg, "Bcb = %p\n", Bcb );
|
||||||
@@ -1402,7 +1402,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatUnpinRepinnedBcbs (
|
FatUnpinRepinnedBcbs (
|
||||||
IN PIRP_CONTEXT IrpContext
|
IN PIRP_CONTEXT IrpContext
|
||||||
@@ -1432,7 +1432,7 @@ Return Value:
|
|||||||
PFCB FcbOrDcb = NULL;
|
PFCB FcbOrDcb = NULL;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
DebugTrace(+1, Dbg, "FatUnpinRepinnedBcbs\n", 0 );
|
DebugTrace(+1, Dbg, "FatUnpinRepinnedBcbs\n", 0 );
|
||||||
DebugTrace( 0, Dbg, "IrpContext = %p\n", IrpContext );
|
DebugTrace( 0, Dbg, "IrpContext = %p\n", IrpContext );
|
||||||
|
|
||||||
@@ -1453,21 +1453,21 @@ Return Value:
|
|||||||
// Extract main FCB pointer from the irp context - we
|
// Extract main FCB pointer from the irp context - we
|
||||||
// will need it later to detect new file creation operation.
|
// will need it later to detect new file creation operation.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (IrpContext->MajorFunction == IRP_MJ_CREATE &&
|
if (IrpContext->MajorFunction == IRP_MJ_CREATE &&
|
||||||
IrpContext->OriginatingIrp != NULL) {
|
IrpContext->OriginatingIrp != NULL) {
|
||||||
PIO_STACK_LOCATION IrpSp;
|
PIO_STACK_LOCATION IrpSp;
|
||||||
|
|
||||||
IrpSp = IoGetCurrentIrpStackLocation( IrpContext->OriginatingIrp );
|
IrpSp = IoGetCurrentIrpStackLocation( IrpContext->OriginatingIrp );
|
||||||
|
|
||||||
if (IrpSp != NULL &&
|
if (IrpSp != NULL &&
|
||||||
IrpSp->FileObject != NULL &&
|
IrpSp->FileObject != NULL &&
|
||||||
IrpSp->FileObject->FsContext != NULL) {
|
IrpSp->FileObject->FsContext != NULL) {
|
||||||
|
|
||||||
FcbOrDcb = IrpSp->FileObject->FsContext;
|
FcbOrDcb = IrpSp->FileObject->FsContext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// If the request is write through or the media is deferred flush,
|
// If the request is write through or the media is deferred flush,
|
||||||
// unpin the bcb's write through.
|
// unpin the bcb's write through.
|
||||||
@@ -1496,7 +1496,7 @@ Return Value:
|
|||||||
|
|
||||||
IO_STATUS_BLOCK Iosb;
|
IO_STATUS_BLOCK Iosb;
|
||||||
|
|
||||||
if (WriteThroughToDisk &&
|
if (WriteThroughToDisk &&
|
||||||
FlagOn(IrpContext->Vcb->VcbState, VCB_STATE_FLAG_DEFERRED_FLUSH)) {
|
FlagOn(IrpContext->Vcb->VcbState, VCB_STATE_FLAG_DEFERRED_FLUSH)) {
|
||||||
|
|
||||||
FileObject = CcGetFileObjectFromBcb( Repinned->Bcb[i] );
|
FileObject = CcGetFileObjectFromBcb( Repinned->Bcb[i] );
|
||||||
@@ -1524,9 +1524,9 @@ Return Value:
|
|||||||
(IrpContext->MajorFunction != IRP_MJ_CLEANUP) &&
|
(IrpContext->MajorFunction != IRP_MJ_CLEANUP) &&
|
||||||
(IrpContext->MajorFunction != IRP_MJ_FLUSH_BUFFERS) &&
|
(IrpContext->MajorFunction != IRP_MJ_FLUSH_BUFFERS) &&
|
||||||
(IrpContext->MajorFunction != IRP_MJ_SET_INFORMATION)
|
(IrpContext->MajorFunction != IRP_MJ_SET_INFORMATION)
|
||||||
|
|
||||||
&&
|
&&
|
||||||
|
|
||||||
//
|
//
|
||||||
// WinSE bug #307418 "Occasional data corruption when
|
// WinSE bug #307418 "Occasional data corruption when
|
||||||
// standby/resume while copying files to removable FAT
|
// standby/resume while copying files to removable FAT
|
||||||
@@ -1540,7 +1540,7 @@ Return Value:
|
|||||||
// Instead FatCommonCreate() will unroll the file creation
|
// Instead FatCommonCreate() will unroll the file creation
|
||||||
// changes for these pages.
|
// changes for these pages.
|
||||||
//
|
//
|
||||||
|
|
||||||
!(IrpContext->MajorFunction == IRP_MJ_CREATE &&
|
!(IrpContext->MajorFunction == IRP_MJ_CREATE &&
|
||||||
Iosb.Status == STATUS_VERIFY_REQUIRED &&
|
Iosb.Status == STATUS_VERIFY_REQUIRED &&
|
||||||
FcbOrDcb != NULL &&
|
FcbOrDcb != NULL &&
|
||||||
@@ -1567,26 +1567,26 @@ Return Value:
|
|||||||
PREPINNED_BCBS RepinnedToPurge = Repinned;
|
PREPINNED_BCBS RepinnedToPurge = Repinned;
|
||||||
|
|
||||||
while( RepinnedToPurge != NULL ) {
|
while( RepinnedToPurge != NULL ) {
|
||||||
|
|
||||||
for (j = k; j < REPINNED_BCBS_ARRAY_SIZE; j++) {
|
for (j = k; j < REPINNED_BCBS_ARRAY_SIZE; j++) {
|
||||||
|
|
||||||
if (RepinnedToPurge->Bcb[j] != NULL) {
|
if (RepinnedToPurge->Bcb[j] != NULL) {
|
||||||
|
|
||||||
if (CcGetFileObjectFromBcb( RepinnedToPurge->Bcb[j] ) == FileObject) {
|
if (CcGetFileObjectFromBcb( RepinnedToPurge->Bcb[j] ) == FileObject) {
|
||||||
|
|
||||||
CcUnpinRepinnedBcb( RepinnedToPurge->Bcb[j],
|
CcUnpinRepinnedBcb( RepinnedToPurge->Bcb[j],
|
||||||
FALSE,
|
FALSE,
|
||||||
&Iosb );
|
&Iosb );
|
||||||
|
|
||||||
RepinnedToPurge->Bcb[j] = NULL;
|
RepinnedToPurge->Bcb[j] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RepinnedToPurge = RepinnedToPurge->Next;
|
RepinnedToPurge = RepinnedToPurge->Next;
|
||||||
k = 0;
|
k = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CcPurgeCacheSection( FileObject->SectionObjectPointer,
|
CcPurgeCacheSection( FileObject->SectionObjectPointer,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
@@ -1644,7 +1644,7 @@ Return Value:
|
|||||||
if (!FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_DISABLE_RAISE )) {
|
if (!FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_DISABLE_RAISE )) {
|
||||||
if (IrpContext->OriginatingIrp) {
|
if (IrpContext->OriginatingIrp) {
|
||||||
IrpContext->OriginatingIrp->IoStatus = RaiseIosb;
|
IrpContext->OriginatingIrp->IoStatus = RaiseIosb;
|
||||||
}
|
}
|
||||||
FatNormalizeAndRaiseStatus( IrpContext, RaiseIosb.Status );
|
FatNormalizeAndRaiseStatus( IrpContext, RaiseIosb.Status );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1654,7 +1654,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FINISHED
|
FINISHED
|
||||||
FatZeroData (
|
FatZeroData (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -1684,7 +1684,7 @@ FatZeroData (
|
|||||||
BOOLEAN Finished;
|
BOOLEAN Finished;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
SectorSize = (ULONG)Vcb->Bpb.BytesPerSector;
|
SectorSize = (ULONG)Vcb->Bpb.BytesPerSector;
|
||||||
|
|
||||||
ZeroStart.LowPart = (StartingZero + (SectorSize - 1)) & ~(SectorSize - 1);
|
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,
|
// 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).
|
// which must be "zeroed" already (or we're in trouble).
|
||||||
//
|
//
|
||||||
|
|
||||||
if (StartingZero != 0 && ZeroStart.LowPart == 0) {
|
if (StartingZero != 0 && ZeroStart.LowPart == 0) {
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Note that BeyondZeroEnd can take the value 4gb.
|
// Note that BeyondZeroEnd can take the value 4gb.
|
||||||
//
|
//
|
||||||
|
|
||||||
BeyondZeroEnd.QuadPart = ((ULONGLONG) StartingZero + ByteCount + (SectorSize - 1))
|
BeyondZeroEnd.QuadPart = ((ULONGLONG) StartingZero + ByteCount + (SectorSize - 1))
|
||||||
& (~((LONGLONG) SectorSize - 1));
|
& (~((LONGLONG) SectorSize - 1));
|
||||||
|
|
||||||
//
|
//
|
||||||
// If we were called to just zero part of a sector we are in trouble.
|
// If we were called to just zero part of a sector we are in trouble.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ( ZeroStart.QuadPart == BeyondZeroEnd.QuadPart ) {
|
if ( ZeroStart.QuadPart == BeyondZeroEnd.QuadPart ) {
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -1723,7 +1723,7 @@ FatZeroData (
|
|||||||
return Finished;
|
return Finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FatCompleteMdl (
|
FatCompleteMdl (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -1752,7 +1752,7 @@ Return Value:
|
|||||||
PIO_STACK_LOCATION IrpSp;
|
PIO_STACK_LOCATION IrpSp;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
DebugTrace(+1, Dbg, "FatCompleteMdl\n", 0 );
|
DebugTrace(+1, Dbg, "FatCompleteMdl\n", 0 );
|
||||||
DebugTrace( 0, Dbg, "IrpContext = %p\n", IrpContext );
|
DebugTrace( 0, Dbg, "IrpContext = %p\n", IrpContext );
|
||||||
DebugTrace( 0, Dbg, "Irp = %p\n", Irp );
|
DebugTrace( 0, Dbg, "Irp = %p\n", Irp );
|
||||||
@@ -1807,7 +1807,7 @@ Return Value:
|
|||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatSyncUninitializeCacheMap (
|
FatSyncUninitializeCacheMap (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -1835,7 +1835,7 @@ Return Value:
|
|||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
KeInitializeEvent( &UninitializeCompleteEvent.Event,
|
KeInitializeEvent( &UninitializeCompleteEvent.Event,
|
||||||
SynchronizationEvent,
|
SynchronizationEvent,
|
||||||
FALSE);
|
FALSE);
|
||||||
@@ -1861,7 +1861,7 @@ Return Value:
|
|||||||
|
|
||||||
NT_ASSERT(WaitStatus == STATUS_SUCCESS);
|
NT_ASSERT(WaitStatus == STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatPinMappedData (
|
FatPinMappedData (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -1893,7 +1893,7 @@ Arguments:
|
|||||||
LARGE_INTEGER Vbo;
|
LARGE_INTEGER Vbo;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
DebugTrace(+1, Dbg, "FatPinMappedData\n", 0);
|
DebugTrace(+1, Dbg, "FatPinMappedData\n", 0);
|
||||||
DebugTrace( 0, Dbg, "Dcb = %p\n", Dcb);
|
DebugTrace( 0, Dbg, "Dcb = %p\n", Dcb);
|
||||||
DebugTrace( 0, Dbg, "StartingVbo = %08lx\n", StartingVbo);
|
DebugTrace( 0, Dbg, "StartingVbo = %08lx\n", StartingVbo);
|
||||||
@@ -1924,7 +1924,7 @@ Arguments:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if (NTDDI_VERSION >= NTDDI_WIN8)
|
#if (NTDDI_VERSION >= NTDDI_WIN8)
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FatPrefetchPages (
|
FatPrefetchPages (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ FatAutoUnlock (
|
|||||||
#pragma alloc_text(PAGE, FatFsdCleanup)
|
#pragma alloc_text(PAGE, FatFsdCleanup)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
_Function_class_(IRP_MJ_CLEANUP)
|
_Function_class_(IRP_MJ_CLEANUP)
|
||||||
_Function_class_(DRIVER_DISPATCH)
|
_Function_class_(DRIVER_DISPATCH)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
@@ -139,8 +139,8 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FatCommonCleanup (
|
FatCommonCleanup (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -270,7 +270,7 @@ Return Value:
|
|||||||
if ((TypeOfOpen == UserFileOpen) || (TypeOfOpen == UserDirectoryOpen)) {
|
if ((TypeOfOpen == UserFileOpen) || (TypeOfOpen == UserDirectoryOpen)) {
|
||||||
|
|
||||||
NT_ASSERT( Fcb != NULL );
|
NT_ASSERT( Fcb != NULL );
|
||||||
|
|
||||||
(VOID)FatAcquireExclusiveFcb( IrpContext, Fcb );
|
(VOID)FatAcquireExclusiveFcb( IrpContext, Fcb );
|
||||||
|
|
||||||
AcquiredFcb = TRUE;
|
AcquiredFcb = TRUE;
|
||||||
@@ -410,28 +410,28 @@ Return Value:
|
|||||||
// If so we may need to break an oplock. We do this in the try block
|
// If so we may need to break an oplock. We do this in the try block
|
||||||
// so that resources will be properly released.
|
// so that resources will be properly released.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (ProcessingDeleteOnClose &&
|
if (ProcessingDeleteOnClose &&
|
||||||
FatIsFileOplockable( Fcb ) &&
|
FatIsFileOplockable( Fcb ) &&
|
||||||
((NodeType( Fcb ) != FAT_NTC_DCB) ||
|
((NodeType( Fcb ) != FAT_NTC_DCB) ||
|
||||||
FatIsDirectoryEmpty( IrpContext, Fcb ))) {
|
FatIsDirectoryEmpty( IrpContext, Fcb ))) {
|
||||||
|
|
||||||
Status = FsRtlCheckOplockEx( FatGetFcbOplock(Fcb),
|
Status = FsRtlCheckOplockEx( FatGetFcbOplock(Fcb),
|
||||||
Irp,
|
Irp,
|
||||||
OPLOCK_FLAG_CLOSING_DELETE_ON_CLOSE,
|
OPLOCK_FLAG_CLOSING_DELETE_ON_CLOSE,
|
||||||
IrpContext,
|
IrpContext,
|
||||||
FatOplockComplete,
|
FatOplockComplete,
|
||||||
FatPrePostIrp );
|
FatPrePostIrp );
|
||||||
|
|
||||||
if (Status != STATUS_SUCCESS) {
|
if (Status != STATUS_SUCCESS) {
|
||||||
|
|
||||||
if (Status == STATUS_PENDING) {
|
if (Status == STATUS_PENDING) {
|
||||||
|
|
||||||
SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_CLEANUP_BREAKING_OPLOCK );
|
SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_CLEANUP_BREAKING_OPLOCK );
|
||||||
try_return( Status );
|
try_return( Status );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
FatNormalizeAndRaiseStatus( IrpContext, Status );
|
FatNormalizeAndRaiseStatus( IrpContext, Status );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -466,7 +466,7 @@ Return Value:
|
|||||||
if (FlagOn( Ccb->Flags, CCB_FLAG_COMPLETE_DISMOUNT )) {
|
if (FlagOn( Ccb->Flags, CCB_FLAG_COMPLETE_DISMOUNT )) {
|
||||||
|
|
||||||
FatCheckForDismount( IrpContext, Vcb, TRUE );
|
FatCheckForDismount( IrpContext, Vcb, TRUE );
|
||||||
|
|
||||||
//
|
//
|
||||||
// If this handle had write access, and actually wrote something,
|
// If this handle had write access, and actually wrote something,
|
||||||
// flush the device buffers, and then set the verify bit now
|
// 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.
|
// 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) ) {
|
if( FlagOn(Fcb->FcbState, FCB_STATE_DENY_DEFRAG) && FlagOn(Ccb->Flags, CCB_FLAG_DENY_DEFRAG) ) {
|
||||||
|
|
||||||
ClearFlag(Ccb->Flags, CCB_FLAG_DENY_DEFRAG);
|
ClearFlag(Ccb->Flags, CCB_FLAG_DENY_DEFRAG);
|
||||||
ClearFlag(Fcb->FcbState, FCB_STATE_DENY_DEFRAG );
|
ClearFlag(Fcb->FcbState, FCB_STATE_DENY_DEFRAG );
|
||||||
}
|
}
|
||||||
@@ -575,9 +575,9 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Even if something goes wrong, we cannot turn back!
|
// Even if something goes wrong, we cannot turn back!
|
||||||
//
|
//
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
DELETE_CONTEXT DeleteContext;
|
DELETE_CONTEXT DeleteContext;
|
||||||
|
|
||||||
|
|
||||||
@@ -585,45 +585,45 @@ Return Value:
|
|||||||
// Before truncating file allocation remember this
|
// Before truncating file allocation remember this
|
||||||
// info for FatDeleteDirent.
|
// info for FatDeleteDirent.
|
||||||
//
|
//
|
||||||
|
|
||||||
DeleteContext.FileSize = Fcb->Header.FileSize.LowPart;
|
DeleteContext.FileSize = Fcb->Header.FileSize.LowPart;
|
||||||
DeleteContext.FirstClusterOfFile = Fcb->FirstClusterOfFile;
|
DeleteContext.FirstClusterOfFile = Fcb->FirstClusterOfFile;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Synchronize here with paging IO
|
// Synchronize here with paging IO
|
||||||
//
|
//
|
||||||
|
|
||||||
(VOID)ExAcquireResourceExclusiveLite( Fcb->Header.PagingIoResource,
|
(VOID)ExAcquireResourceExclusiveLite( Fcb->Header.PagingIoResource,
|
||||||
TRUE );
|
TRUE );
|
||||||
|
|
||||||
Fcb->Header.FileSize.LowPart = 0;
|
Fcb->Header.FileSize.LowPart = 0;
|
||||||
|
|
||||||
ExReleaseResourceLite( Fcb->Header.PagingIoResource );
|
ExReleaseResourceLite( Fcb->Header.PagingIoResource );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Truncate the file allocation down to zero
|
// Truncate the file allocation down to zero
|
||||||
//
|
//
|
||||||
|
|
||||||
DebugTrace(0, Dbg, "Delete File allocation\n", 0);
|
DebugTrace(0, Dbg, "Delete File allocation\n", 0);
|
||||||
|
|
||||||
FatTruncateFileAllocation( IrpContext, Fcb, 0 );
|
FatTruncateFileAllocation( IrpContext, Fcb, 0 );
|
||||||
|
|
||||||
if (Fcb->Header.AllocationSize.LowPart == 0) {
|
if (Fcb->Header.AllocationSize.LowPart == 0) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tunnel and remove the dirent for the directory
|
// Tunnel and remove the dirent for the directory
|
||||||
//
|
//
|
||||||
|
|
||||||
DebugTrace(0, Dbg, "Delete the directory dirent\n", 0);
|
DebugTrace(0, Dbg, "Delete the directory dirent\n", 0);
|
||||||
|
|
||||||
FatTunnelFcbOrDcb( Fcb, NULL );
|
FatTunnelFcbOrDcb( Fcb, NULL );
|
||||||
|
|
||||||
FatDeleteDirent( IrpContext, Fcb, &DeleteContext, TRUE );
|
FatDeleteDirent( IrpContext, Fcb, &DeleteContext, TRUE );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Report that we have removed an entry.
|
// Report that we have removed an entry.
|
||||||
//
|
//
|
||||||
|
|
||||||
FatNotifyReportChange( IrpContext,
|
FatNotifyReportChange( IrpContext,
|
||||||
Vcb,
|
Vcb,
|
||||||
Fcb,
|
Fcb,
|
||||||
@@ -633,7 +633,7 @@ Return Value:
|
|||||||
|
|
||||||
} _SEH2_EXCEPT( FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ?
|
} _SEH2_EXCEPT( FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ?
|
||||||
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {
|
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {
|
||||||
|
|
||||||
FatResetExceptionState( IrpContext );
|
FatResetExceptionState( IrpContext );
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
|
|
||||||
@@ -644,16 +644,16 @@ Return Value:
|
|||||||
// to recreate the same file over again before we
|
// to recreate the same file over again before we
|
||||||
// get a close irp.
|
// get a close irp.
|
||||||
//
|
//
|
||||||
|
|
||||||
FatRemoveNames( IrpContext, Fcb );
|
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
|
// Directory oplock breaks are always advisory, so we will never
|
||||||
// block/get STATUS_PENDING here.
|
// block/get STATUS_PENDING here.
|
||||||
//
|
//
|
||||||
|
|
||||||
BreakStatus = FsRtlCheckOplockEx( FatGetFcbOplock(Fcb->ParentDcb),
|
BreakStatus = FsRtlCheckOplockEx( FatGetFcbOplock(Fcb->ParentDcb),
|
||||||
Irp,
|
Irp,
|
||||||
(OPLOCK_FLAG_PARENT_OBJECT |
|
(OPLOCK_FLAG_PARENT_OBJECT |
|
||||||
@@ -661,7 +661,7 @@ Return Value:
|
|||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL );
|
NULL );
|
||||||
|
|
||||||
ASSERT( BreakStatus != STATUS_PENDING );
|
ASSERT( BreakStatus != STATUS_PENDING );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -676,7 +676,7 @@ Return Value:
|
|||||||
Fcb->UncleanCount -= 1;
|
Fcb->UncleanCount -= 1;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UserFileOpen:
|
case UserFileOpen:
|
||||||
|
|
||||||
DebugTrace(0, Dbg, "Cleanup UserFileOpen\n", 0);
|
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.
|
// 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) ) {
|
if( FlagOn(Fcb->FcbState, FCB_STATE_DENY_DEFRAG) && FlagOn(Ccb->Flags, CCB_FLAG_DENY_DEFRAG) ) {
|
||||||
|
|
||||||
ClearFlag(Ccb->Flags, CCB_FLAG_DENY_DEFRAG);
|
ClearFlag(Ccb->Flags, CCB_FLAG_DENY_DEFRAG);
|
||||||
ClearFlag(Fcb->FcbState, FCB_STATE_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
|
// 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.
|
// we toss all sections in the failed-verify and dismount cases.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ((Vcb->VcbCondition == VcbGood) &&
|
if ((Vcb->VcbCondition == VcbGood) &&
|
||||||
!FlagOn(Vcb->VcbState, VCB_STATE_FLAG_SHUTDOWN)) {
|
!FlagOn(Vcb->VcbState, VCB_STATE_FLAG_SHUTDOWN)) {
|
||||||
|
|
||||||
if (Fcb->FcbCondition == FcbGood) {
|
if (Fcb->FcbCondition == FcbGood) {
|
||||||
|
|
||||||
|
|
||||||
FatUpdateDirentFromFcb( IrpContext, FileObject, Fcb, Ccb );
|
FatUpdateDirentFromFcb( IrpContext, FileObject, Fcb, Ccb );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// If the file has a unclean count of 1 then we know
|
// If the file has a unclean count of 1 then we know
|
||||||
// that this is the last handle for the file object.
|
// that this is the last handle for the file object.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ( (Fcb->UncleanCount == 1) && (Fcb->FcbCondition == FcbGood) ) {
|
if ( (Fcb->UncleanCount == 1) && (Fcb->FcbCondition == FcbGood) ) {
|
||||||
|
|
||||||
DELETE_CONTEXT DeleteContext;
|
DELETE_CONTEXT DeleteContext;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check if we should be deleting the file. The
|
// Check if we should be deleting the file. The
|
||||||
// delete operation really deletes the file but
|
// delete operation really deletes the file but
|
||||||
// keeps the Fcb around for close to do away with.
|
// keeps the Fcb around for close to do away with.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (FlagOn(Fcb->FcbState, FCB_STATE_DELETE_ON_CLOSE) &&
|
if (FlagOn(Fcb->FcbState, FCB_STATE_DELETE_ON_CLOSE) &&
|
||||||
!FlagOn(Vcb->VcbState, VCB_STATE_FLAG_WRITE_PROTECTED)) {
|
!FlagOn(Vcb->VcbState, VCB_STATE_FLAG_WRITE_PROTECTED)) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Before truncating file allocation remember this
|
// Before truncating file allocation remember this
|
||||||
// info for FatDeleteDirent.
|
// info for FatDeleteDirent.
|
||||||
//
|
//
|
||||||
|
|
||||||
DeleteContext.FileSize = Fcb->Header.FileSize.LowPart;
|
DeleteContext.FileSize = Fcb->Header.FileSize.LowPart;
|
||||||
DeleteContext.FirstClusterOfFile = Fcb->FirstClusterOfFile;
|
DeleteContext.FirstClusterOfFile = Fcb->FirstClusterOfFile;
|
||||||
|
|
||||||
DebugTrace(0, Dbg, "Delete File allocation\n", 0);
|
DebugTrace(0, Dbg, "Delete File allocation\n", 0);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Synchronize here with paging IO
|
// Synchronize here with paging IO
|
||||||
//
|
//
|
||||||
|
|
||||||
(VOID)ExAcquireResourceExclusiveLite( Fcb->Header.PagingIoResource,
|
(VOID)ExAcquireResourceExclusiveLite( Fcb->Header.PagingIoResource,
|
||||||
TRUE );
|
TRUE );
|
||||||
|
|
||||||
Fcb->Header.FileSize.LowPart = 0;
|
Fcb->Header.FileSize.LowPart = 0;
|
||||||
Fcb->Header.ValidDataLength.LowPart = 0;
|
Fcb->Header.ValidDataLength.LowPart = 0;
|
||||||
Fcb->ValidDataToDisk = 0;
|
Fcb->ValidDataToDisk = 0;
|
||||||
|
|
||||||
ExReleaseResourceLite( Fcb->Header.PagingIoResource );
|
ExReleaseResourceLite( Fcb->Header.PagingIoResource );
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
FatSetFileSizeInDirent( IrpContext, Fcb, NULL );
|
FatSetFileSizeInDirent( IrpContext, Fcb, NULL );
|
||||||
|
|
||||||
} _SEH2_EXCEPT( FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ?
|
} _SEH2_EXCEPT( FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ?
|
||||||
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {
|
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {
|
||||||
|
|
||||||
FatResetExceptionState( IrpContext );
|
FatResetExceptionState( IrpContext );
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
|
|
||||||
Fcb->FcbState |= FCB_STATE_TRUNCATE_ON_CLOSE;
|
Fcb->FcbState |= FCB_STATE_TRUNCATE_ON_CLOSE;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
//
|
//
|
||||||
// We must zero between ValidDataLength and FileSize
|
// We must zero between ValidDataLength and FileSize
|
||||||
//
|
//
|
||||||
|
|
||||||
if (!FlagOn(Fcb->FcbState, FCB_STATE_PAGING_FILE) &&
|
if (!FlagOn(Fcb->FcbState, FCB_STATE_PAGING_FILE) &&
|
||||||
(Fcb->Header.ValidDataLength.LowPart < Fcb->Header.FileSize.LowPart)) {
|
(Fcb->Header.ValidDataLength.LowPart < Fcb->Header.FileSize.LowPart)) {
|
||||||
|
|
||||||
ULONG ValidDataLength;
|
ULONG ValidDataLength;
|
||||||
|
|
||||||
ValidDataLength = Fcb->Header.ValidDataLength.LowPart;
|
ValidDataLength = Fcb->Header.ValidDataLength.LowPart;
|
||||||
|
|
||||||
if (ValidDataLength < Fcb->ValidDataToDisk) {
|
if (ValidDataLength < Fcb->ValidDataToDisk) {
|
||||||
ValidDataLength = Fcb->ValidDataToDisk;
|
ValidDataLength = Fcb->ValidDataToDisk;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Recheck, VDD can be >= FS
|
// Recheck, VDD can be >= FS
|
||||||
//
|
//
|
||||||
|
|
||||||
if (ValidDataLength < Fcb->Header.FileSize.LowPart) {
|
if (ValidDataLength < Fcb->Header.FileSize.LowPart) {
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
(VOID)FatZeroData( IrpContext,
|
(VOID)FatZeroData( IrpContext,
|
||||||
@@ -858,18 +858,18 @@ Return Value:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// See if we are supposed to truncate the file on the last
|
// 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
|
// close. If we cannot wait we'll ship this off to the fsp
|
||||||
//
|
//
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
if (FlagOn(Fcb->FcbState, FCB_STATE_TRUNCATE_ON_CLOSE)) {
|
if (FlagOn(Fcb->FcbState, FCB_STATE_TRUNCATE_ON_CLOSE)) {
|
||||||
|
|
||||||
DebugTrace(0, Dbg, "truncate file allocation\n", 0);
|
DebugTrace(0, Dbg, "truncate file allocation\n", 0);
|
||||||
|
|
||||||
if (Vcb->VcbCondition == VcbGood) {
|
if (Vcb->VcbCondition == VcbGood) {
|
||||||
|
|
||||||
|
|
||||||
@@ -879,61 +879,61 @@ Return Value:
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// We also have to get rid of the Cache Map because
|
// We also have to get rid of the Cache Map because
|
||||||
// this is the only way we have of trashing the
|
// this is the only way we have of trashing the
|
||||||
// truncated pages.
|
// truncated pages.
|
||||||
//
|
//
|
||||||
|
|
||||||
LocalTruncateSize = Fcb->Header.FileSize;
|
LocalTruncateSize = Fcb->Header.FileSize;
|
||||||
TruncateSize = &LocalTruncateSize;
|
TruncateSize = &LocalTruncateSize;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Mark the Fcb as having now been truncated, just incase
|
// Mark the Fcb as having now been truncated, just incase
|
||||||
// we have to reship this off to the fsp.
|
// we have to reship this off to the fsp.
|
||||||
//
|
//
|
||||||
|
|
||||||
Fcb->FcbState &= ~FCB_STATE_TRUNCATE_ON_CLOSE;
|
Fcb->FcbState &= ~FCB_STATE_TRUNCATE_ON_CLOSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Now check again if we are to delete the file and if
|
// Now check again if we are to delete the file and if
|
||||||
// so then we remove the file from the disk.
|
// so then we remove the file from the disk.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (FlagOn(Fcb->FcbState, FCB_STATE_DELETE_ON_CLOSE) &&
|
if (FlagOn(Fcb->FcbState, FCB_STATE_DELETE_ON_CLOSE) &&
|
||||||
Fcb->Header.AllocationSize.LowPart == 0) {
|
Fcb->Header.AllocationSize.LowPart == 0) {
|
||||||
|
|
||||||
DebugTrace(0, Dbg, "Delete File\n", 0);
|
DebugTrace(0, Dbg, "Delete File\n", 0);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Now tunnel and delete the dirent
|
// Now tunnel and delete the dirent
|
||||||
//
|
//
|
||||||
|
|
||||||
FatTunnelFcbOrDcb( Fcb, Ccb );
|
FatTunnelFcbOrDcb( Fcb, Ccb );
|
||||||
|
|
||||||
FatDeleteDirent( IrpContext, Fcb, &DeleteContext, TRUE );
|
FatDeleteDirent( IrpContext, Fcb, &DeleteContext, TRUE );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Report that we have removed an entry.
|
// Report that we have removed an entry.
|
||||||
//
|
//
|
||||||
|
|
||||||
FatNotifyReportChange( IrpContext,
|
FatNotifyReportChange( IrpContext,
|
||||||
Vcb,
|
Vcb,
|
||||||
Fcb,
|
Fcb,
|
||||||
FILE_NOTIFY_CHANGE_FILE_NAME,
|
FILE_NOTIFY_CHANGE_FILE_NAME,
|
||||||
FILE_ACTION_REMOVED );
|
FILE_ACTION_REMOVED );
|
||||||
}
|
}
|
||||||
|
|
||||||
} _SEH2_EXCEPT( FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ?
|
} _SEH2_EXCEPT( FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ?
|
||||||
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {
|
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {
|
||||||
|
|
||||||
FatResetExceptionState( IrpContext );
|
FatResetExceptionState( IrpContext );
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
|
|
||||||
if (FlagOn(Fcb->FcbState, FCB_STATE_DELETE_ON_CLOSE)) {
|
if (FlagOn(Fcb->FcbState, FCB_STATE_DELETE_ON_CLOSE)) {
|
||||||
|
|
||||||
#if (NTDDI_VERSION >= NTDDI_WIN8)
|
#if (NTDDI_VERSION >= NTDDI_WIN8)
|
||||||
NTSTATUS BreakStatus;
|
NTSTATUS BreakStatus;
|
||||||
#endif
|
#endif
|
||||||
@@ -946,16 +946,16 @@ Return Value:
|
|||||||
// Note that we remove the name even if we couldn't
|
// Note that we remove the name even if we couldn't
|
||||||
// truncate the allocation and remove the dirent above.
|
// truncate the allocation and remove the dirent above.
|
||||||
//
|
//
|
||||||
|
|
||||||
FatRemoveNames( IrpContext, Fcb );
|
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
|
// Directory oplock breaks are always advisory, so we will never
|
||||||
// block/get STATUS_PENDING here.
|
// block/get STATUS_PENDING here.
|
||||||
//
|
//
|
||||||
|
|
||||||
BreakStatus = FsRtlCheckOplockEx( FatGetFcbOplock(Fcb->ParentDcb),
|
BreakStatus = FsRtlCheckOplockEx( FatGetFcbOplock(Fcb->ParentDcb),
|
||||||
Irp,
|
Irp,
|
||||||
(OPLOCK_FLAG_PARENT_OBJECT |
|
(OPLOCK_FLAG_PARENT_OBJECT |
|
||||||
@@ -963,13 +963,13 @@ Return Value:
|
|||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL );
|
NULL );
|
||||||
|
|
||||||
ASSERT( BreakStatus != STATUS_PENDING );
|
ASSERT( BreakStatus != STATUS_PENDING );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// We've just finished everything associated with an unclean
|
// We've just finished everything associated with an unclean
|
||||||
// fcb so now decrement the unclean count before releasing
|
// fcb so now decrement the unclean count before releasing
|
||||||
@@ -996,13 +996,13 @@ Return Value:
|
|||||||
(Fcb->NonPaged->SectionObjectPointers.DataSectionObject != NULL)) {
|
(Fcb->NonPaged->SectionObjectPointers.DataSectionObject != NULL)) {
|
||||||
|
|
||||||
CcFlushCache( &Fcb->NonPaged->SectionObjectPointers, NULL, 0, NULL );
|
CcFlushCache( &Fcb->NonPaged->SectionObjectPointers, NULL, 0, NULL );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Grab and release PagingIo to serialize ourselves with the lazy writer.
|
// Grab and release PagingIo to serialize ourselves with the lazy writer.
|
||||||
// This will work to ensure that all IO has completed on the cached
|
// This will work to ensure that all IO has completed on the cached
|
||||||
// data and we will succesfully tear away the cache section.
|
// data and we will succesfully tear away the cache section.
|
||||||
//
|
//
|
||||||
|
|
||||||
ExAcquireResourceExclusiveLite( Fcb->Header.PagingIoResource, TRUE);
|
ExAcquireResourceExclusiveLite( Fcb->Header.PagingIoResource, TRUE);
|
||||||
ExReleaseResourceLite( Fcb->Header.PagingIoResource );
|
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 the file is invalid, hint to the cache that we should throw everything out.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ( Fcb->FcbCondition == FcbBad ) {
|
if ( Fcb->FcbCondition == FcbBad ) {
|
||||||
|
|
||||||
TruncateSize = &FatLargeZero;
|
TruncateSize = &FatLargeZero;
|
||||||
@@ -1097,7 +1097,7 @@ Return Value:
|
|||||||
// Flush the file.
|
// Flush the file.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ((TypeOfOpen == UserFileOpen) &&
|
if ((TypeOfOpen == UserFileOpen) &&
|
||||||
FlagOn(FileObject->Flags, FO_FILE_MODIFIED)) {
|
FlagOn(FileObject->Flags, FO_FILE_MODIFIED)) {
|
||||||
|
|
||||||
Status = FatFlushFile( IrpContext, Fcb, Flush );
|
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 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)) {
|
FlagOn( Fcb->FcbState, FCB_STATE_FLUSH_FAT)) {
|
||||||
|
|
||||||
Status = FatFlushFat( IrpContext, Vcb);
|
Status = FatFlushFat( IrpContext, Vcb);
|
||||||
@@ -1117,7 +1117,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
if (NT_SUCCESS(Status) && (Fcb->ParentDcb != NULL)) {
|
if (NT_SUCCESS(Status) && (Fcb->ParentDcb != NULL)) {
|
||||||
|
|
||||||
Status = FatFlushFile( IrpContext, Fcb->ParentDcb, Flush );
|
Status = FatFlushFile( IrpContext, Fcb->ParentDcb, Flush );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1142,7 +1142,7 @@ Return Value:
|
|||||||
if (AcquiredVcb) { FatReleaseVcb( IrpContext, Vcb ); }
|
if (AcquiredVcb) { FatReleaseVcb( IrpContext, Vcb ); }
|
||||||
|
|
||||||
if (SendUnlockNotification) {
|
if (SendUnlockNotification) {
|
||||||
|
|
||||||
FsRtlNotifyVolumeEvent( FileObject, FSRTL_VOLUME_UNLOCK );
|
FsRtlNotifyVolumeEvent( FileObject, FSRTL_VOLUME_UNLOCK );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1175,7 +1175,7 @@ FatAutoUnlock (
|
|||||||
//
|
//
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
IoAcquireVpbSpinLock( &SavedIrql );
|
IoAcquireVpbSpinLock( &SavedIrql );
|
||||||
|
|
||||||
ClearFlag( Vcb->Vpb->Flags, (VPB_LOCKED | VPB_DIRECT_WRITES_ALLOWED) );
|
ClearFlag( Vcb->Vpb->Flags, (VPB_LOCKED | VPB_DIRECT_WRITES_ALLOWED) );
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ FatCloseWorker (
|
|||||||
#pragma alloc_text(PAGE, FatCloseWorker)
|
#pragma alloc_text(PAGE, FatCloseWorker)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
_Function_class_(IRP_MJ_CLOSE)
|
_Function_class_(IRP_MJ_CLOSE)
|
||||||
_Function_class_(DRIVER_DISPATCH)
|
_Function_class_(DRIVER_DISPATCH)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
@@ -183,17 +183,17 @@ Return Value:
|
|||||||
// call the oplock package to get rid of any oplock state. This can only
|
// call the oplock package to get rid of any oplock state. This can only
|
||||||
// be safely done in the FSD path.
|
// be safely done in the FSD path.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ((Fcb != NULL) &&
|
if ((Fcb != NULL) &&
|
||||||
!FlagOn( FileObject->Flags, FO_CLEANUP_COMPLETE ) &&
|
!FlagOn( FileObject->Flags, FO_CLEANUP_COMPLETE ) &&
|
||||||
FatIsFileOplockable( Fcb )) {
|
FatIsFileOplockable( Fcb )) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// This is equivalent to handling cleanup, and it always cleans up any
|
// 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;
|
// oplock immediately. Also, we don't need any locking of the FCB here;
|
||||||
// the oplock's own lock will be sufficient for this purpose.
|
// the oplock's own lock will be sufficient for this purpose.
|
||||||
//
|
//
|
||||||
|
|
||||||
FsRtlCheckOplockEx( FatGetFcbOplock(Fcb),
|
FsRtlCheckOplockEx( FatGetFcbOplock(Fcb),
|
||||||
Irp,
|
Irp,
|
||||||
0,
|
0,
|
||||||
@@ -204,7 +204,7 @@ Return Value:
|
|||||||
#endif
|
#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.
|
// guaranteed the VCB exists.
|
||||||
//
|
//
|
||||||
|
|
||||||
@@ -221,7 +221,7 @@ Return Value:
|
|||||||
// Call the common Close routine if we are not delaying this close.
|
// Call the common Close routine if we are not delaying this close.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ((((TypeOfOpen == UserFileOpen) ||
|
if ((((TypeOfOpen == UserFileOpen) ||
|
||||||
(TypeOfOpen == UserDirectoryOpen)) &&
|
(TypeOfOpen == UserDirectoryOpen)) &&
|
||||||
FlagOn(Fcb->FcbState, FCB_STATE_DELAY_CLOSE) &&
|
FlagOn(Fcb->FcbState, FCB_STATE_DELAY_CLOSE) &&
|
||||||
!FatData.ShutdownStarted) ||
|
!FatData.ShutdownStarted) ||
|
||||||
@@ -238,7 +238,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
if( CloseContext == NULL ) {
|
if( CloseContext == NULL ) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Free up any query template strings before using the close context fields,
|
// Free up any query template strings before using the close context fields,
|
||||||
// which overlap (union)
|
// which overlap (union)
|
||||||
@@ -248,7 +248,7 @@ Return Value:
|
|||||||
|
|
||||||
CloseContext = &Ccb->CloseContext;
|
CloseContext = &Ccb->CloseContext;
|
||||||
CloseContext->Free = FALSE;
|
CloseContext->Free = FALSE;
|
||||||
|
|
||||||
SetFlag( Ccb->Flags, CCB_FLAG_CLOSE_CONTEXT );
|
SetFlag( Ccb->Flags, CCB_FLAG_CLOSE_CONTEXT );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,12 +272,12 @@ Return Value:
|
|||||||
(BOOLEAN)(Fcb && FlagOn(Fcb->FcbState, FCB_STATE_DELAY_CLOSE)));
|
(BOOLEAN)(Fcb && FlagOn(Fcb->FcbState, FCB_STATE_DELAY_CLOSE)));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
//
|
//
|
||||||
// The close proceeded synchronously, so for the metadata objects we
|
// The close proceeded synchronously, so for the metadata objects we
|
||||||
// can now drop the close context we preallocated.
|
// can now drop the close context we preallocated.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ((TypeOfOpen == VirtualVolumeFile) ||
|
if ((TypeOfOpen == VirtualVolumeFile) ||
|
||||||
(TypeOfOpen == DirectoryFile) ||
|
(TypeOfOpen == DirectoryFile) ||
|
||||||
(TypeOfOpen == EaFile)
|
(TypeOfOpen == EaFile)
|
||||||
@@ -286,19 +286,19 @@ Return Value:
|
|||||||
if (CloseContext != NULL) {
|
if (CloseContext != NULL) {
|
||||||
|
|
||||||
ExFreePool( CloseContext );
|
ExFreePool( CloseContext );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FatCompleteRequest( FatNull, Irp, Status );
|
FatCompleteRequest( FatNull, Irp, Status );
|
||||||
|
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(FatExceptionFilter( NULL, _SEH2_GetExceptionInformation() )) {
|
_SEH2_EXCEPT(FatExceptionFilter( NULL, _SEH2_GetExceptionInformation() )) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// We had some trouble trying to perform the requested
|
// 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.
|
// error status that we get back from the exception code.
|
||||||
//
|
//
|
||||||
|
|
||||||
@@ -346,15 +346,15 @@ Return Value:
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( DeviceObject );
|
UNREFERENCED_PARAMETER( DeviceObject );
|
||||||
|
|
||||||
FsRtlEnterFileSystem();
|
FsRtlEnterFileSystem();
|
||||||
|
|
||||||
FatFspClose (Context);
|
FatFspClose (Context);
|
||||||
|
|
||||||
FsRtlExitFileSystem();
|
FsRtlExitFileSystem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatFspClose (
|
FatFspClose (
|
||||||
@@ -394,9 +394,9 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Set the top level IRP for the true FSP operation.
|
// Set the top level IRP for the true FSP operation.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (!ARGUMENT_PRESENT( Vcb )) {
|
if (!ARGUMENT_PRESENT( Vcb )) {
|
||||||
|
|
||||||
IoSetTopLevelIrp( (PIRP)FSRTL_FSP_TOP_LEVEL_IRP );
|
IoSetTopLevelIrp( (PIRP)FSRTL_FSP_TOP_LEVEL_IRP );
|
||||||
TopLevel = TRUE;
|
TopLevel = TRUE;
|
||||||
}
|
}
|
||||||
@@ -413,7 +413,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
if (!ARGUMENT_PRESENT(Vcb)) {
|
if (!ARGUMENT_PRESENT(Vcb)) {
|
||||||
|
|
||||||
if (!FatData.ShutdownStarted) {
|
if (!FatData.ShutdownStarted) {
|
||||||
|
|
||||||
if (CloseContext->Vcb != CurrentVcb) {
|
if (CloseContext->Vcb != CurrentVcb) {
|
||||||
@@ -520,7 +520,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Drop the context if it came from pool.
|
// Drop the context if it came from pool.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (FreeContext) {
|
if (FreeContext) {
|
||||||
|
|
||||||
ExFreePool( CloseContext );
|
ExFreePool( CloseContext );
|
||||||
@@ -539,12 +539,12 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Clean up the top level IRP hint if we owned it.
|
// Clean up the top level IRP hint if we owned it.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (!ARGUMENT_PRESENT( Vcb )) {
|
if (!ARGUMENT_PRESENT( Vcb )) {
|
||||||
|
|
||||||
IoSetTopLevelIrp( NULL );
|
IoSetTopLevelIrp( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// And return to our caller
|
// And return to our caller
|
||||||
//
|
//
|
||||||
@@ -552,8 +552,8 @@ Return Value:
|
|||||||
DebugTrace(-1, Dbg, "FatFspClose -> NULL\n", 0);
|
DebugTrace(-1, Dbg, "FatFspClose -> NULL\n", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatQueueClose (
|
FatQueueClose (
|
||||||
IN PCLOSE_CONTEXT CloseContext,
|
IN PCLOSE_CONTEXT CloseContext,
|
||||||
@@ -569,7 +569,7 @@ Routine Description:
|
|||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
CloseContext - a close context to enqueue for the delayed close thread.
|
CloseContext - a close context to enqueue for the delayed close thread.
|
||||||
|
|
||||||
DelayClose - whether this should go on the delayed close queue (unreferenced
|
DelayClose - whether this should go on the delayed close queue (unreferenced
|
||||||
objects).
|
objects).
|
||||||
|
|
||||||
@@ -624,8 +624,8 @@ Return Value:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
PCLOSE_CONTEXT
|
PCLOSE_CONTEXT
|
||||||
FatRemoveClose (
|
FatRemoveClose (
|
||||||
PVCB Vcb OPTIONAL,
|
PVCB Vcb OPTIONAL,
|
||||||
@@ -641,7 +641,7 @@ Routine Description:
|
|||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Vcb - if specified, only returns close for this volume.
|
Vcb - if specified, only returns close for this volume.
|
||||||
|
|
||||||
LastVcbHint - if specified and other starvation avoidance is required by
|
LastVcbHint - if specified and other starvation avoidance is required by
|
||||||
the system condition, will attempt to return closes for this volume.
|
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
|
// Remember if this is the worker thread, so we can pull down the active
|
||||||
// flag should we run everything out.
|
// flag should we run everything out.
|
||||||
//
|
//
|
||||||
|
|
||||||
WorkerThread = (Vcb == NULL);
|
WorkerThread = (Vcb == NULL);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -685,20 +685,20 @@ Return Value:
|
|||||||
// Flip over to aggressive at twice the legal limit, and flip it
|
// Flip over to aggressive at twice the legal limit, and flip it
|
||||||
// off at the legal limit.
|
// off at the legal limit.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (!FatData.HighAsync && FatData.AsyncCloseCount > FatMaxDelayedCloseCount*2) {
|
if (!FatData.HighAsync && FatData.AsyncCloseCount > FatMaxDelayedCloseCount*2) {
|
||||||
|
|
||||||
FatData.HighAsync = TRUE;
|
FatData.HighAsync = TRUE;
|
||||||
|
|
||||||
} else if (FatData.HighAsync && FatData.AsyncCloseCount < FatMaxDelayedCloseCount) {
|
} else if (FatData.HighAsync && FatData.AsyncCloseCount < FatMaxDelayedCloseCount) {
|
||||||
|
|
||||||
FatData.HighAsync = FALSE;
|
FatData.HighAsync = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!FatData.HighDelayed && FatData.DelayedCloseCount > FatMaxDelayedCloseCount*2) {
|
if (!FatData.HighDelayed && FatData.DelayedCloseCount > FatMaxDelayedCloseCount*2) {
|
||||||
|
|
||||||
FatData.HighDelayed = TRUE;
|
FatData.HighDelayed = TRUE;
|
||||||
|
|
||||||
} else if (FatData.HighDelayed && FatData.DelayedCloseCount < FatMaxDelayedCloseCount) {
|
} else if (FatData.HighDelayed && FatData.DelayedCloseCount < FatMaxDelayedCloseCount) {
|
||||||
|
|
||||||
FatData.HighDelayed = FALSE;
|
FatData.HighDelayed = FALSE;
|
||||||
@@ -709,7 +709,7 @@ Return Value:
|
|||||||
Vcb = LastVcbHint;
|
Vcb = LastVcbHint;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Do the case when we don't care about which Vcb the close is on.
|
// 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
|
// This is the case when we are in an ExWorkerThread and aren't
|
||||||
@@ -762,7 +762,7 @@ Return Value:
|
|||||||
CloseContext = NULL;
|
CloseContext = NULL;
|
||||||
|
|
||||||
if (WorkerThread) {
|
if (WorkerThread) {
|
||||||
|
|
||||||
FatData.AsyncCloseActive = FALSE;
|
FatData.AsyncCloseActive = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -770,7 +770,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// We're running down a specific volume.
|
// We're running down a specific volume.
|
||||||
//
|
//
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
||||||
@@ -801,9 +801,9 @@ Return Value:
|
|||||||
CloseContext = CONTAINING_RECORD( Entry,
|
CloseContext = CONTAINING_RECORD( Entry,
|
||||||
CLOSE_CONTEXT,
|
CLOSE_CONTEXT,
|
||||||
VcbLinks );
|
VcbLinks );
|
||||||
|
|
||||||
RemoveEntryList( &CloseContext->GlobalLinks );
|
RemoveEntryList( &CloseContext->GlobalLinks );
|
||||||
|
|
||||||
//
|
//
|
||||||
// If we were trying to run down the queues but didn't find anything for this
|
// 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.
|
// volume, flip over to accept anything and try again.
|
||||||
@@ -812,7 +812,7 @@ Return Value:
|
|||||||
} else if (LastVcbHint) {
|
} else if (LastVcbHint) {
|
||||||
|
|
||||||
goto AnyClose;
|
goto AnyClose;
|
||||||
|
|
||||||
//
|
//
|
||||||
// There are no more closes to perform; show that we are done.
|
// There are no more closes to perform; show that we are done.
|
||||||
//
|
//
|
||||||
@@ -828,8 +828,8 @@ Return Value:
|
|||||||
return CloseContext;
|
return CloseContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FatCommonClose (
|
FatCommonClose (
|
||||||
IN PVCB Vcb,
|
IN PVCB Vcb,
|
||||||
@@ -918,7 +918,7 @@ Return Value:
|
|||||||
IrpContext.NodeByteSize = sizeof( IrpContext );
|
IrpContext.NodeByteSize = sizeof( IrpContext );
|
||||||
IrpContext.MajorFunction = IRP_MJ_CLOSE;
|
IrpContext.MajorFunction = IRP_MJ_CLOSE;
|
||||||
IrpContext.Vcb = Vcb;
|
IrpContext.Vcb = Vcb;
|
||||||
|
|
||||||
if (Wait) {
|
if (Wait) {
|
||||||
|
|
||||||
SetFlag( IrpContext.Flags, IRP_CONTEXT_FLAG_WAIT );
|
SetFlag( IrpContext.Flags, IRP_CONTEXT_FLAG_WAIT );
|
||||||
@@ -1090,10 +1090,10 @@ Return Value:
|
|||||||
ObDereferenceObject( DirectoryFileObject );
|
ObDereferenceObject( DirectoryFileObject );
|
||||||
}
|
}
|
||||||
|
|
||||||
Fcb->OpenCount -= 1;
|
Fcb->OpenCount -= 1;
|
||||||
Vcb->OpenFileCount -= 1;
|
Vcb->OpenFileCount -= 1;
|
||||||
if (FlagOn(Ccb->Flags, CCB_FLAG_READ_ONLY)) { Vcb->ReadOnlyCount -= 1; }
|
if (FlagOn(Ccb->Flags, CCB_FLAG_READ_ONLY)) { Vcb->ReadOnlyCount -= 1; }
|
||||||
|
|
||||||
FatDeleteCcb( &IrpContext, &Ccb );
|
FatDeleteCcb( &IrpContext, &Ccb );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -1195,7 +1195,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// See if there is only one open left. If so, it is ours. We only want
|
// 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.
|
// 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
|
// caller can handle the VCB going away. This is determined by whether
|
||||||
// they passed in the VcbDeleted argument. This request also needs
|
// they passed in the VcbDeleted argument. This request also needs
|
||||||
// to be top level.
|
// to be top level.
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ FatCheckShareAccess (
|
|||||||
#pragma alloc_text(PAGE, FatSetFullNameInFcb)
|
#pragma alloc_text(PAGE, FatSetFullNameInFcb)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
_Function_class_(IRP_MJ_CREATE)
|
_Function_class_(IRP_MJ_CREATE)
|
||||||
_Function_class_(DRIVER_DISPATCH)
|
_Function_class_(DRIVER_DISPATCH)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
@@ -2576,7 +2576,7 @@ Return Value:
|
|||||||
return Iosb;
|
return Iosb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal support routine
|
// Internal support routine
|
||||||
//
|
//
|
||||||
@@ -2751,7 +2751,7 @@ Arguments:
|
|||||||
return Iosb;
|
return Iosb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal support routine
|
// Internal support routine
|
||||||
//
|
//
|
||||||
@@ -3171,7 +3171,7 @@ Return Value:
|
|||||||
return Iosb;
|
return Iosb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal support routine
|
// Internal support routine
|
||||||
//
|
//
|
||||||
@@ -3913,7 +3913,7 @@ Return Value:
|
|||||||
|
|
||||||
return Iosb;
|
return Iosb;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal support routine
|
// Internal support routine
|
||||||
//
|
//
|
||||||
@@ -4122,7 +4122,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal support routine
|
// Internal support routine
|
||||||
//
|
//
|
||||||
@@ -4402,7 +4402,7 @@ Return Value:
|
|||||||
return Iosb;
|
return Iosb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal support routine
|
// Internal support routine
|
||||||
//
|
//
|
||||||
@@ -4882,7 +4882,7 @@ Return Value:
|
|||||||
return Iosb;
|
return Iosb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal support routine
|
// Internal support routine
|
||||||
//
|
//
|
||||||
@@ -5596,7 +5596,7 @@ Return Value:
|
|||||||
return Iosb;
|
return Iosb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal support routine
|
// Internal support routine
|
||||||
//
|
//
|
||||||
@@ -6344,7 +6344,7 @@ Return Value:
|
|||||||
return Iosb;
|
return Iosb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal support routine
|
// Internal support routine
|
||||||
//
|
//
|
||||||
@@ -6823,7 +6823,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FatCheckSystemSecurityAccess (
|
FatCheckSystemSecurityAccess (
|
||||||
_In_ PIRP_CONTEXT IrpContext
|
_In_ PIRP_CONTEXT IrpContext
|
||||||
@@ -6865,7 +6865,7 @@ FatCheckSystemSecurityAccess (
|
|||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FatCheckShareAccess (
|
FatCheckShareAccess (
|
||||||
_In_ PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ FatDeviceControlCompletionRoutine(
|
|||||||
#pragma alloc_text(PAGE, FatFsdDeviceControl)
|
#pragma alloc_text(PAGE, FatFsdDeviceControl)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
_Function_class_(IRP_MJ_DEVICE_CONTROL)
|
_Function_class_(IRP_MJ_DEVICE_CONTROL)
|
||||||
_Function_class_(DRIVER_DISPATCH)
|
_Function_class_(DRIVER_DISPATCH)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
@@ -120,7 +120,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FatCommonDeviceControl (
|
FatCommonDeviceControl (
|
||||||
@@ -357,7 +357,7 @@ Return Value:
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Release all the resources that we held because of a
|
// 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 );
|
NT_ASSERT( IrpSp->Parameters.DeviceIoControl.IoControlCode == IOCTL_VOLSNAP_FLUSH_AND_HOLD_WRITES );
|
||||||
@@ -380,7 +380,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -395,7 +395,7 @@ FatDeviceControlCompletionRoutine(
|
|||||||
|
|
||||||
{
|
{
|
||||||
PKEVENT Event = (PKEVENT) Contxt;
|
PKEVENT Event = (PKEVENT) Contxt;
|
||||||
|
|
||||||
//
|
//
|
||||||
// If there is an event, this is a synch request. Signal and
|
// If there is an event, this is a synch request. Signal and
|
||||||
// let I/O know this isn't done yet.
|
// let I/O know this isn't done yet.
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ FatSingleNonAlignedSync (
|
|||||||
#else
|
#else
|
||||||
#define FatUpdateIOCountersPCW(IsAWrite,Count)
|
#define FatUpdateIOCountersPCW(IsAWrite,Count)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ALLOC_PRAGMA
|
#ifdef ALLOC_PRAGMA
|
||||||
#pragma alloc_text(PAGE, FatMultipleAsync)
|
#pragma alloc_text(PAGE, FatMultipleAsync)
|
||||||
#pragma alloc_text(PAGE, FatSingleAsync)
|
#pragma alloc_text(PAGE, FatSingleAsync)
|
||||||
@@ -206,7 +206,7 @@ typedef struct FAT_PAGING_FILE_CONTEXT {
|
|||||||
PMDL RestoreMdl;
|
PMDL RestoreMdl;
|
||||||
} FAT_PAGING_FILE_CONTEXT, *PFAT_PAGING_FILE_CONTEXT;
|
} FAT_PAGING_FILE_CONTEXT, *PFAT_PAGING_FILE_CONTEXT;
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatPagingFileIo (
|
FatPagingFileIo (
|
||||||
IN PIRP Irp,
|
IN PIRP Irp,
|
||||||
@@ -520,7 +520,7 @@ Return Value:
|
|||||||
|
|
||||||
AssocIrp = IoMakeAssociatedIrp( Irp, (CCHAR)(DeviceObject->StackSize + 1) );
|
AssocIrp = IoMakeAssociatedIrp( Irp, (CCHAR)(DeviceObject->StackSize + 1) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AssocIrp == NULL) {
|
if (AssocIrp == NULL) {
|
||||||
|
|
||||||
AssocIrp = Irp;
|
AssocIrp = Irp;
|
||||||
@@ -542,7 +542,7 @@ Return Value:
|
|||||||
// Note that since we failed to launch this associated Irp, that the completion
|
// 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.
|
// code at the bottom will take care of completing the master Irp.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (!NT_SUCCESS(Irp->IoStatus.Status)) {
|
if (!NT_SUCCESS(Irp->IoStatus.Status)) {
|
||||||
|
|
||||||
NT_ASSERT( IrpCount );
|
NT_ASSERT( IrpCount );
|
||||||
@@ -550,22 +550,22 @@ Return Value:
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Indicate we used an associated Irp.
|
// Indicate we used an associated Irp.
|
||||||
//
|
//
|
||||||
|
|
||||||
IrpCount -= 1;
|
IrpCount -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// With an associated IRP, we must take over the first stack location so
|
// 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
|
// we can have one to put the completion routine on. When re-using the
|
||||||
// master IRP, its already there.
|
// master IRP, its already there.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (!IrpIsMaster) {
|
if (!IrpIsMaster) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the first IRP stack location in the associated Irp
|
// Get the first IRP stack location in the associated Irp
|
||||||
//
|
//
|
||||||
@@ -587,7 +587,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
NextIrpSp->DeviceObject = IrpSp->DeviceObject;
|
NextIrpSp->DeviceObject = IrpSp->DeviceObject;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -617,7 +617,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
if (IrpIsMaster) {
|
if (IrpIsMaster) {
|
||||||
|
|
||||||
IoSetCompletionRoutine( AssocIrp,
|
IoSetCompletionRoutine( AssocIrp,
|
||||||
FatPagingFileCompletionRoutineCatch,
|
FatPagingFileCompletionRoutineCatch,
|
||||||
&Context,
|
&Context,
|
||||||
@@ -626,7 +626,7 @@ Return Value:
|
|||||||
TRUE );
|
TRUE );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
IoSetCompletionRoutine( AssocIrp,
|
IoSetCompletionRoutine( AssocIrp,
|
||||||
FatPagingFileCompletionRoutine,
|
FatPagingFileCompletionRoutine,
|
||||||
Irp,
|
Irp,
|
||||||
@@ -671,7 +671,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
if (IrpIsMaster) {
|
if (IrpIsMaster) {
|
||||||
|
|
||||||
KeWaitForSingleObject( &Context.Event, Executive, KernelMode, FALSE, NULL );
|
KeWaitForSingleObject( &Context.Event, Executive, KernelMode, FALSE, NULL );
|
||||||
IrpIsMaster = MdlIsReserve = FALSE;
|
IrpIsMaster = MdlIsReserve = FALSE;
|
||||||
|
|
||||||
@@ -684,7 +684,7 @@ Return Value:
|
|||||||
// associated Irp, and thus the completion code at the bottom will take care
|
// associated Irp, and thus the completion code at the bottom will take care
|
||||||
// of that for us.
|
// of that for us.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (!NT_SUCCESS(Irp->IoStatus.Status)) {
|
if (!NT_SUCCESS(Irp->IoStatus.Status)) {
|
||||||
|
|
||||||
NT_ASSERT( IrpCount );
|
NT_ASSERT( IrpCount );
|
||||||
@@ -710,14 +710,14 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Advance the Lbo/Vbo if we have more to do in the current run.
|
// Advance the Lbo/Vbo if we have more to do in the current run.
|
||||||
//
|
//
|
||||||
|
|
||||||
NextLbo += NextByteCount;
|
NextLbo += NextByteCount;
|
||||||
NextVbo += NextByteCount;
|
NextVbo += NextByteCount;
|
||||||
|
|
||||||
NextByteCount = RemainingByteCount;
|
NextByteCount = RemainingByteCount;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
CurrentIndex += 1;
|
CurrentIndex += 1;
|
||||||
|
|
||||||
if ( CurrentIndex <= LastIndex ) {
|
if ( CurrentIndex <= LastIndex ) {
|
||||||
@@ -739,11 +739,11 @@ Return Value:
|
|||||||
// If we didn't get enough associated Irps going to make this asynchronous, we
|
// 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.
|
// twiddle our thumbs and wait for those we did launch to complete.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (IrpCount) {
|
if (IrpCount) {
|
||||||
|
|
||||||
while (Irp->AssociatedIrp.IrpCount != IrpCount) {
|
while (Irp->AssociatedIrp.IrpCount != IrpCount) {
|
||||||
|
|
||||||
KeDelayExecutionThread (KernelMode, FALSE, &Fat30Milliseconds);
|
KeDelayExecutionThread (KernelMode, FALSE, &Fat30Milliseconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -775,7 +775,7 @@ Arguments:
|
|||||||
Irp - Supplies the requesting Irp.
|
Irp - Supplies the requesting Irp.
|
||||||
|
|
||||||
ByteCount - The lengh of the operation.
|
ByteCount - The lengh of the operation.
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
|
|
||||||
None.
|
None.
|
||||||
@@ -875,9 +875,9 @@ Return Value:
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FatNonCachedIo (
|
FatNonCachedIo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -886,7 +886,7 @@ FatNonCachedIo (
|
|||||||
IN ULONG StartingVbo,
|
IN ULONG StartingVbo,
|
||||||
IN ULONG ByteCount,
|
IN ULONG ByteCount,
|
||||||
IN ULONG UserByteCount,
|
IN ULONG UserByteCount,
|
||||||
IN ULONG StreamFlags
|
IN ULONG StreamFlags
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
@@ -907,7 +907,7 @@ Arguments:
|
|||||||
StartingVbo - The starting point for the operation.
|
StartingVbo - The starting point for the operation.
|
||||||
|
|
||||||
ByteCount - The lengh of the operation.
|
ByteCount - The lengh of the operation.
|
||||||
|
|
||||||
UserByteCount - The last byte the user can see, rest to be zeroed.
|
UserByteCount - The last byte the user can see, rest to be zeroed.
|
||||||
|
|
||||||
StreamFlags - flag to indicate special attributes for a NonCachedIo.
|
StreamFlags - flag to indicate special attributes for a NonCachedIo.
|
||||||
@@ -1122,7 +1122,7 @@ Return Value:
|
|||||||
Stats->Fat.NonCachedDiskWrites += 1;
|
Stats->Fat.NonCachedDiskWrites += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugTrace( 0, Dbg, "Passing 1 Irp on to Disk Driver\n", 0 );
|
DebugTrace( 0, Dbg, "Passing 1 Irp on to Disk Driver\n", 0 );
|
||||||
|
|
||||||
FatSingleAsync( IrpContext,
|
FatSingleAsync( IrpContext,
|
||||||
@@ -1207,7 +1207,7 @@ Return Value:
|
|||||||
IoRuns[NextRun].Offset = BufferOffset;
|
IoRuns[NextRun].Offset = BufferOffset;
|
||||||
IoRuns[NextRun].ByteCount = NextByteCount;
|
IoRuns[NextRun].ByteCount = NextByteCount;
|
||||||
NextRun += 1;
|
NextRun += 1;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Now adjust everything for the next pass through the loop.
|
// Now adjust everything for the next pass through the loop.
|
||||||
//
|
//
|
||||||
@@ -1233,7 +1233,7 @@ Return Value:
|
|||||||
&NextByteCount );
|
&NextByteCount );
|
||||||
|
|
||||||
|
|
||||||
NT_ASSERT(NextVbo == StartingVbo);
|
NT_ASSERT(NextVbo == StartingVbo);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1289,8 +1289,8 @@ Return Value:
|
|||||||
return Irp->IoStatus.Status;
|
return Irp->IoStatus.Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatNonCachedNonAlignedRead (
|
FatNonCachedNonAlignedRead (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -1617,7 +1617,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatMultipleAsync (
|
FatMultipleAsync (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -1875,7 +1875,7 @@ Return Value:
|
|||||||
|
|
||||||
//
|
//
|
||||||
// For async requests if we acquired locks, transition the lock owners to an
|
// 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.
|
// completion, and the resource package may try to boost priority.
|
||||||
//
|
//
|
||||||
|
|
||||||
@@ -1952,8 +1952,8 @@ Return Value:
|
|||||||
if (!ExceptionExpected) {
|
if (!ExceptionExpected) {
|
||||||
NT_ASSERT( ExceptionExpected );
|
NT_ASSERT( ExceptionExpected );
|
||||||
#ifdef _MSC_VER
|
#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
|
#endif
|
||||||
FatBugCheck( 0, 0, 0 );
|
FatBugCheck( 0, 0, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1985,7 +1985,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatSingleAsync (
|
FatSingleAsync (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -2095,15 +2095,15 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// If this I/O requires override verify, bypass the verify logic.
|
// If this I/O requires override verify, bypass the verify logic.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_OVERRIDE_VERIFY )) {
|
if (FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_OVERRIDE_VERIFY )) {
|
||||||
|
|
||||||
SetFlag( IrpSp->Flags, SL_OVERRIDE_VERIFY_VOLUME );
|
SetFlag( IrpSp->Flags, SL_OVERRIDE_VERIFY_VOLUME );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// For async requests if we acquired locks, transition the lock owners to an
|
// 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.
|
// 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.
|
// Back up a copy of the IrpContext flags for later use in async completion.
|
||||||
//
|
//
|
||||||
|
|
||||||
IrpContext->FatIoContext->IrpContextFlags = IrpContext->Flags;
|
IrpContext->FatIoContext->IrpContextFlags = IrpContext->Flags;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2166,7 +2166,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatSingleNonAlignedSync (
|
FatSingleNonAlignedSync (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -2310,9 +2310,9 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// If this I/O requires override verify, bypass the verify logic.
|
// If this I/O requires override verify, bypass the verify logic.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_OVERRIDE_VERIFY )) {
|
if (FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_OVERRIDE_VERIFY )) {
|
||||||
|
|
||||||
SetFlag( IrpSp->Flags, SL_OVERRIDE_VERIFY_VOLUME );
|
SetFlag( IrpSp->Flags, SL_OVERRIDE_VERIFY_VOLUME );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2362,7 +2362,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatWaitSync (
|
FatWaitSync (
|
||||||
IN PIRP_CONTEXT IrpContext
|
IN PIRP_CONTEXT IrpContext
|
||||||
@@ -2396,7 +2396,7 @@ Return Value:
|
|||||||
DebugTrace(-1, Dbg, "FatWaitSync -> VOID\n", 0 );
|
DebugTrace(-1, Dbg, "FatWaitSync -> VOID\n", 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal Support Routine
|
// Internal Support Routine
|
||||||
//
|
//
|
||||||
@@ -2497,7 +2497,7 @@ Return Value:
|
|||||||
return STATUS_MORE_PROCESSING_REQUIRED;
|
return STATUS_MORE_PROCESSING_REQUIRED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal Support Routine
|
// Internal Support Routine
|
||||||
//
|
//
|
||||||
@@ -2574,11 +2574,11 @@ Return Value:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
MasterIrp->IoStatus = Irp->IoStatus;
|
MasterIrp->IoStatus = Irp->IoStatus;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NT_ASSERT( !(NT_SUCCESS( Irp->IoStatus.Status ) && Irp->IoStatus.Information == 0 ));
|
NT_ASSERT( !(NT_SUCCESS( Irp->IoStatus.Status ) && Irp->IoStatus.Information == 0 ));
|
||||||
|
|
||||||
if (InterlockedDecrement(&Context->IrpCount) == 0) {
|
if (InterlockedDecrement(&Context->IrpCount) == 0) {
|
||||||
|
|
||||||
FatDoCompletionZero( MasterIrp, Context );
|
FatDoCompletionZero( MasterIrp, Context );
|
||||||
@@ -2600,19 +2600,19 @@ Return Value:
|
|||||||
IoGetCurrentIrpStackLocation(MasterIrp)->MajorFunction == IRP_MJ_READ ?
|
IoGetCurrentIrpStackLocation(MasterIrp)->MajorFunction == IRP_MJ_READ ?
|
||||||
FO_FILE_FAST_IO_READ : FO_FILE_MODIFIED );
|
FO_FILE_FAST_IO_READ : FO_FILE_MODIFIED );
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Post STATUS_VERIFY_REQUIRED failures. Only post top level IRPs, because recursive I/Os
|
// Post STATUS_VERIFY_REQUIRED failures. Only post top level IRPs, because recursive I/Os
|
||||||
// cannot process volume verification.
|
// 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)) {
|
(MasterIrp->IoStatus.Status == STATUS_VERIFY_REQUIRED)) {
|
||||||
PostRequest = TRUE;
|
PostRequest = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2643,7 +2643,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Context->Wait.Async.Resource2 != NULL) {
|
if (Context->Wait.Async.Resource2 != NULL) {
|
||||||
|
|
||||||
ExReleaseResourceForThreadLite( Context->Wait.Async.Resource2,
|
ExReleaseResourceForThreadLite( Context->Wait.Async.Resource2,
|
||||||
Context->Wait.Async.ResourceThreadId );
|
Context->Wait.Async.ResourceThreadId );
|
||||||
}
|
}
|
||||||
@@ -2665,22 +2665,22 @@ Return Value:
|
|||||||
PIRP_CONTEXT IrpContext = NULL;
|
PIRP_CONTEXT IrpContext = NULL;
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
IrpContext = FatCreateIrpContext(Irp, TRUE );
|
IrpContext = FatCreateIrpContext(Irp, TRUE );
|
||||||
ClearFlag(IrpContext->Flags, IRP_CONTEXT_FLAG_RECURSIVE_CALL);
|
ClearFlag(IrpContext->Flags, IRP_CONTEXT_FLAG_RECURSIVE_CALL);
|
||||||
FatFsdPostRequest( IrpContext, Irp );
|
FatFsdPostRequest( IrpContext, Irp );
|
||||||
Status = STATUS_MORE_PROCESSING_REQUIRED;
|
Status = STATUS_MORE_PROCESSING_REQUIRED;
|
||||||
|
|
||||||
} _SEH2_EXCEPT( FatExceptionFilter(NULL, _SEH2_GetExceptionInformation()) ) {
|
} _SEH2_EXCEPT( FatExceptionFilter(NULL, _SEH2_GetExceptionInformation()) ) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// If we failed to post the IRP, we just have to return the failure
|
// If we failed to post the IRP, we just have to return the failure
|
||||||
// to the user. :(
|
// to the user. :(
|
||||||
//
|
//
|
||||||
|
|
||||||
NOTHING;
|
NOTHING;
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugTrace(-1, Dbg, "FatMultiAsyncCompletionRoutine -> SUCCESS\n", 0 );
|
DebugTrace(-1, Dbg, "FatMultiAsyncCompletionRoutine -> SUCCESS\n", 0 );
|
||||||
@@ -2690,7 +2690,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FatPagingFileErrorHandler (
|
FatPagingFileErrorHandler (
|
||||||
IN PIRP Irp,
|
IN PIRP Irp,
|
||||||
@@ -2703,36 +2703,36 @@ Routine Description:
|
|||||||
|
|
||||||
This routine attempts to guarantee that the media is marked dirty
|
This routine attempts to guarantee that the media is marked dirty
|
||||||
with the surface test bit if a paging file IO fails.
|
with the surface test bit if a paging file IO fails.
|
||||||
|
|
||||||
The work done here has several basic problems
|
The work done here has several basic problems
|
||||||
|
|
||||||
1) when paging file writes start failing, this is a good sign
|
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
|
that the rest of the system is about to fall down around us
|
||||||
|
|
||||||
2) it has no forward progress guarantee
|
2) it has no forward progress guarantee
|
||||||
|
|
||||||
With Whistler, it is actually quite intentional that we're rejiggering
|
With Whistler, it is actually quite intentional that we're rejiggering
|
||||||
the paging file write path to make forward progress at all times. This
|
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
|
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
|
and this is probably going to mean the paging file is going to stop working
|
||||||
very soon.
|
very soon.
|
||||||
|
|
||||||
It'd be nice to make this guarantee progress. It would need
|
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
|
1) a guaranteed worker thread which can only be used by items which
|
||||||
will make forward progress (i.e., not block out this one)
|
will make forward progress (i.e., not block out this one)
|
||||||
|
|
||||||
2) the virtual volume file's pages containing the boot sector and
|
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
|
1st FAT entry would have to be pinned resident and have a guaranteed
|
||||||
mapping address
|
mapping address
|
||||||
|
|
||||||
3) mark volume would have to have a stashed irp/mdl and roll the write
|
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
|
irp, or use a generalized mechanism to guarantee issue of the irp
|
||||||
|
|
||||||
4) the lower stack would have to guarantee progress
|
4) the lower stack would have to guarantee progress
|
||||||
|
|
||||||
Of these, 1 and 4 may actually exist shortly.
|
Of these, 1 and 4 may actually exist shortly.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Irp - Pointer to the associated Irp which is being failed.
|
Irp - Pointer to the associated Irp which is being failed.
|
||||||
@@ -2795,7 +2795,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal Support Routine
|
// Internal Support Routine
|
||||||
//
|
//
|
||||||
@@ -2822,9 +2822,9 @@ Routine Description:
|
|||||||
worker item to write out the dirty bit so that the next
|
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
|
time we run we will do a autochk /r. This is not forward
|
||||||
progress guaranteed at the moment.
|
progress guaranteed at the moment.
|
||||||
|
|
||||||
Clean up the Mdl used for this partial request.
|
Clean up the Mdl used for this partial request.
|
||||||
|
|
||||||
Note that if the Irp is failing, the error code is already where
|
Note that if the Irp is failing, the error code is already where
|
||||||
we want it.
|
we want it.
|
||||||
|
|
||||||
@@ -2849,7 +2849,7 @@ Return Value:
|
|||||||
UNREFERENCED_PARAMETER( DeviceObject );
|
UNREFERENCED_PARAMETER( DeviceObject );
|
||||||
|
|
||||||
DebugTrace(+1, Dbg, "FatPagingFileCompletionRoutineCatch, Context = %p\n", Context );
|
DebugTrace(+1, Dbg, "FatPagingFileCompletionRoutineCatch, Context = %p\n", Context );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cleanup the existing Mdl, perhaps by returning the reserve.
|
// Cleanup the existing Mdl, perhaps by returning the reserve.
|
||||||
//
|
//
|
||||||
@@ -2858,7 +2858,7 @@ Return Value:
|
|||||||
|
|
||||||
MmPrepareMdlForReuse( Irp->MdlAddress );
|
MmPrepareMdlForReuse( Irp->MdlAddress );
|
||||||
KeSetEvent( &FatReserveEvent, 0, FALSE );
|
KeSetEvent( &FatReserveEvent, 0, FALSE );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
IoFreeMdl( Irp->MdlAddress );
|
IoFreeMdl( Irp->MdlAddress );
|
||||||
@@ -2885,10 +2885,10 @@ Return Value:
|
|||||||
}
|
}
|
||||||
|
|
||||||
return STATUS_MORE_PROCESSING_REQUIRED;
|
return STATUS_MORE_PROCESSING_REQUIRED;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal Support Routine
|
// Internal Support Routine
|
||||||
//
|
//
|
||||||
@@ -2957,7 +2957,7 @@ Return Value:
|
|||||||
return FatPagingFileErrorHandler( Irp, NULL );
|
return FatPagingFileErrorHandler( Irp, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal Support Routine
|
// Internal Support Routine
|
||||||
//
|
//
|
||||||
@@ -3024,7 +3024,7 @@ Return Value:
|
|||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal Support Routine
|
// Internal Support Routine
|
||||||
//
|
//
|
||||||
@@ -3096,7 +3096,7 @@ Return Value:
|
|||||||
return STATUS_MORE_PROCESSING_REQUIRED;
|
return STATUS_MORE_PROCESSING_REQUIRED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal Support Routine
|
// Internal Support Routine
|
||||||
//
|
//
|
||||||
@@ -3142,7 +3142,7 @@ Return Value:
|
|||||||
|
|
||||||
{
|
{
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
PFAT_IO_CONTEXT Context = Contxt;
|
PFAT_IO_CONTEXT Context = Contxt;
|
||||||
BOOLEAN PostRequest = FALSE;
|
BOOLEAN PostRequest = FALSE;
|
||||||
|
|
||||||
@@ -3178,7 +3178,7 @@ Return Value:
|
|||||||
DbgBreakPoint();
|
DbgBreakPoint();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SYSCACHE_COMPILE
|
#ifdef SYSCACHE_COMPILE
|
||||||
DbgPrint( "FAT SYSCACHE: SingleAsync (IRP %08x) -> %08x\n", Irp, Irp->IoStatus );
|
DbgPrint( "FAT SYSCACHE: SingleAsync (IRP %08x) -> %08x\n", Irp, Irp->IoStatus );
|
||||||
#endif
|
#endif
|
||||||
@@ -3187,8 +3187,8 @@ Return Value:
|
|||||||
// Post STATUS_VERIFY_REQUIRED failures. Only post top level IRPs, because recursive I/Os
|
// Post STATUS_VERIFY_REQUIRED failures. Only post top level IRPs, because recursive I/Os
|
||||||
// cannot process volume verification.
|
// 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)) {
|
(Irp->IoStatus.Status == STATUS_VERIFY_REQUIRED)) {
|
||||||
PostRequest = TRUE;
|
PostRequest = TRUE;
|
||||||
}
|
}
|
||||||
@@ -3218,13 +3218,13 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
if (Context->Wait.Async.Resource != NULL) {
|
if (Context->Wait.Async.Resource != NULL) {
|
||||||
|
|
||||||
ExReleaseResourceForThreadLite( Context->Wait.Async.Resource,
|
ExReleaseResourceForThreadLite( Context->Wait.Async.Resource,
|
||||||
Context->Wait.Async.ResourceThreadId );
|
Context->Wait.Async.ResourceThreadId );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Context->Wait.Async.Resource2 != NULL) {
|
if (Context->Wait.Async.Resource2 != NULL) {
|
||||||
|
|
||||||
ExReleaseResourceForThreadLite( Context->Wait.Async.Resource2,
|
ExReleaseResourceForThreadLite( Context->Wait.Async.Resource2,
|
||||||
Context->Wait.Async.ResourceThreadId );
|
Context->Wait.Async.ResourceThreadId );
|
||||||
}
|
}
|
||||||
@@ -3246,19 +3246,19 @@ Return Value:
|
|||||||
PIRP_CONTEXT IrpContext = NULL;
|
PIRP_CONTEXT IrpContext = NULL;
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
IrpContext = FatCreateIrpContext(Irp, TRUE );
|
IrpContext = FatCreateIrpContext(Irp, TRUE );
|
||||||
ClearFlag(IrpContext->Flags, IRP_CONTEXT_FLAG_RECURSIVE_CALL);
|
ClearFlag(IrpContext->Flags, IRP_CONTEXT_FLAG_RECURSIVE_CALL);
|
||||||
FatFsdPostRequest( IrpContext, Irp );
|
FatFsdPostRequest( IrpContext, Irp );
|
||||||
Status = STATUS_MORE_PROCESSING_REQUIRED;
|
Status = STATUS_MORE_PROCESSING_REQUIRED;
|
||||||
|
|
||||||
} _SEH2_EXCEPT( FatExceptionFilter(NULL, _SEH2_GetExceptionInformation()) ) {
|
} _SEH2_EXCEPT( FatExceptionFilter(NULL, _SEH2_GetExceptionInformation()) ) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// If we failed to post the IRP, we just have to return the failure
|
// If we failed to post the IRP, we just have to return the failure
|
||||||
// to the user. :(
|
// to the user. :(
|
||||||
//
|
//
|
||||||
|
|
||||||
NOTHING;
|
NOTHING;
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
}
|
}
|
||||||
@@ -3271,7 +3271,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatLockUserBuffer (
|
FatLockUserBuffer (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -3352,7 +3352,7 @@ Return Value:
|
|||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PVOID
|
PVOID
|
||||||
FatMapUserBuffer (
|
FatMapUserBuffer (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -3366,7 +3366,7 @@ Routine Description:
|
|||||||
This routine conditionally maps the user buffer for the current I/O
|
This routine conditionally maps the user buffer for the current I/O
|
||||||
request in the specified mode. If the buffer is already mapped, it
|
request in the specified mode. If the buffer is already mapped, it
|
||||||
just returns its address.
|
just returns its address.
|
||||||
|
|
||||||
Note that this is the *input/output* buffer.
|
Note that this is the *input/output* buffer.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
@@ -3392,7 +3392,7 @@ Return Value:
|
|||||||
if (Irp->MdlAddress == NULL) {
|
if (Irp->MdlAddress == NULL) {
|
||||||
|
|
||||||
return Irp->UserBuffer;
|
return Irp->UserBuffer;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
PVOID Address = MmGetSystemAddressForMdlSafe( Irp->MdlAddress, NormalPagePriority | MdlMappingNoExecute );
|
PVOID Address = MmGetSystemAddressForMdlSafe( Irp->MdlAddress, NormalPagePriority | MdlMappingNoExecute );
|
||||||
@@ -3406,7 +3406,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PVOID
|
PVOID
|
||||||
FatBufferUserBuffer (
|
FatBufferUserBuffer (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -3420,7 +3420,7 @@ Routine Description:
|
|||||||
|
|
||||||
This routine conditionally buffers the user buffer for the current I/O
|
This routine conditionally buffers the user buffer for the current I/O
|
||||||
request. If the buffer is already buffered, it just returns its address.
|
request. If the buffer is already buffered, it just returns its address.
|
||||||
|
|
||||||
Note that this is the *input* buffer.
|
Note that this is the *input* buffer.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
@@ -3428,7 +3428,7 @@ Arguments:
|
|||||||
Irp - Pointer to the Irp for the request.
|
Irp - Pointer to the Irp for the request.
|
||||||
|
|
||||||
BufferLength - Length of user buffer.
|
BufferLength - Length of user buffer.
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
|
|
||||||
Buffered address.
|
Buffered address.
|
||||||
@@ -3445,12 +3445,12 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Handle the no buffer case.
|
// Handle the no buffer case.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (BufferLength == 0) {
|
if (BufferLength == 0) {
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// If there is no system buffer we must have been supplied an Mdl
|
// If there is no system buffer we must have been supplied an Mdl
|
||||||
// describing the users input buffer, which we will now snapshot.
|
// describing the users input buffer, which we will now snapshot.
|
||||||
@@ -3478,19 +3478,19 @@ Return Value:
|
|||||||
BufferLength );
|
BufferLength );
|
||||||
|
|
||||||
} _SEH2_EXCEPT (EXCEPTION_EXECUTE_HANDLER) {
|
} _SEH2_EXCEPT (EXCEPTION_EXECUTE_HANDLER) {
|
||||||
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Status = _SEH2_GetExceptionCode();
|
Status = _SEH2_GetExceptionCode();
|
||||||
FatRaiseStatus( IrpContext,
|
FatRaiseStatus( IrpContext,
|
||||||
FsRtlIsNtstatusExpected(Status) ? Status : STATUS_INVALID_USER_BUFFER );
|
FsRtlIsNtstatusExpected(Status) ? Status : STATUS_INVALID_USER_BUFFER );
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Irp->AssociatedIrp.SystemBuffer;
|
return Irp->AssociatedIrp.SystemBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FatToggleMediaEjectDisable (
|
FatToggleMediaEjectDisable (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -3560,7 +3560,7 @@ Return Value:
|
|||||||
// So passing NULL for the final parameter is ok in this special case.
|
// So passing NULL for the final parameter is ok in this special case.
|
||||||
//
|
//
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(suppress: 6387)
|
#pragma warning(suppress: 6387)
|
||||||
#endif
|
#endif
|
||||||
Irp = IoBuildDeviceIoControlRequest( IOCTL_DISK_MEDIA_REMOVAL,
|
Irp = IoBuildDeviceIoControlRequest( IOCTL_DISK_MEDIA_REMOVAL,
|
||||||
Vcb->TargetDeviceObject,
|
Vcb->TargetDeviceObject,
|
||||||
@@ -3600,7 +3600,7 @@ Return Value:
|
|||||||
Status = IoCallDriver( Vcb->TargetDeviceObject, Irp );
|
Status = IoCallDriver( Vcb->TargetDeviceObject, Irp );
|
||||||
|
|
||||||
if (Status == STATUS_PENDING) {
|
if (Status == STATUS_PENDING) {
|
||||||
|
|
||||||
(VOID) KeWaitForSingleObject( &SyncContext.Event,
|
(VOID) KeWaitForSingleObject( &SyncContext.Event,
|
||||||
Executive,
|
Executive,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
@@ -3616,7 +3616,7 @@ Return Value:
|
|||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FatPerformDevIoCtrl (
|
FatPerformDevIoCtrl (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ FatNotifyChangeDirectory (
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
_Function_class_(IRP_MJ_DIRECTORY_CONTROL)
|
_Function_class_(IRP_MJ_DIRECTORY_CONTROL)
|
||||||
_Function_class_(DRIVER_DISPATCH)
|
_Function_class_(DRIVER_DISPATCH)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
@@ -146,7 +146,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FatCommonDirectoryControl (
|
FatCommonDirectoryControl (
|
||||||
@@ -219,7 +219,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local Support Routine
|
// Local Support Routine
|
||||||
//
|
//
|
||||||
@@ -290,7 +290,7 @@ Return Value:
|
|||||||
PFILE_ID_BOTH_DIR_INFORMATION IdBothDirInfo;
|
PFILE_ID_BOTH_DIR_INFORMATION IdBothDirInfo;
|
||||||
PFILE_NAMES_INFORMATION NamesInfo;
|
PFILE_NAMES_INFORMATION NamesInfo;
|
||||||
|
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -334,7 +334,7 @@ Return Value:
|
|||||||
// but UserDirectoryOpens. Also check that the filename is a valid
|
// but UserDirectoryOpens. Also check that the filename is a valid
|
||||||
// UNICODE string.
|
// UNICODE string.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (FatDecodeFileObject( IrpSp->FileObject,
|
if (FatDecodeFileObject( IrpSp->FileObject,
|
||||||
&Vcb,
|
&Vcb,
|
||||||
&Dcb,
|
&Dcb,
|
||||||
@@ -375,8 +375,8 @@ Return Value:
|
|||||||
// order to update the search string in the Ccb. We may
|
// order to update the search string in the Ccb. We may
|
||||||
// discover that we are not the initial query once we grab the Fcb
|
// discover that we are not the initial query once we grab the Fcb
|
||||||
// and downgrade our status.
|
// 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
|
// so take the FCB exclusive to protect against multiple people
|
||||||
// changing the CCB at once.
|
// changing the CCB at once.
|
||||||
//
|
//
|
||||||
@@ -457,19 +457,19 @@ Return Value:
|
|||||||
// name.
|
// name.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (InitialQuery ||
|
if (InitialQuery ||
|
||||||
(RestartScan && UniArgFileName != NULL && UniArgFileName->Length != 0)) {
|
(RestartScan && UniArgFileName != NULL && UniArgFileName->Length != 0)) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// If we're restarting the scan, clear out the pattern in the Ccb and regenerate it,
|
// If we're restarting the scan, clear out the pattern in the Ccb and regenerate it,
|
||||||
//
|
//
|
||||||
|
|
||||||
if (RestartScan) {
|
if (RestartScan) {
|
||||||
|
|
||||||
if (Ccb->UnicodeQueryTemplate.Buffer) {
|
if (Ccb->UnicodeQueryTemplate.Buffer) {
|
||||||
|
|
||||||
if (FlagOn(Ccb->Flags, CCB_FLAG_FREE_UNICODE)) {
|
if (FlagOn(Ccb->Flags, CCB_FLAG_FREE_UNICODE)) {
|
||||||
|
|
||||||
ExFreePoolWithTag(Ccb->UnicodeQueryTemplate.Buffer, TAG_FILENAME_BUFFER);
|
ExFreePoolWithTag(Ccb->UnicodeQueryTemplate.Buffer, TAG_FILENAME_BUFFER);
|
||||||
ClearFlag(Ccb->Flags, CCB_FLAG_FREE_UNICODE);
|
ClearFlag(Ccb->Flags, CCB_FLAG_FREE_UNICODE);
|
||||||
}
|
}
|
||||||
@@ -486,7 +486,7 @@ Return Value:
|
|||||||
RtlFreeOemString( &Ccb->OemQueryTemplate.Wild );
|
RtlFreeOemString( &Ccb->OemQueryTemplate.Wild );
|
||||||
ClearFlag(Ccb->Flags, CCB_FLAG_FREE_OEM_BEST_FIT);
|
ClearFlag(Ccb->Flags, CCB_FLAG_FREE_OEM_BEST_FIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ccb->OemQueryTemplate.Wild.Buffer = NULL;
|
Ccb->OemQueryTemplate.Wild.Buffer = NULL;
|
||||||
Ccb->OemQueryTemplate.Wild.Length = 0;
|
Ccb->OemQueryTemplate.Wild.Length = 0;
|
||||||
Ccb->OemQueryTemplate.Wild.MaximumLength = 0;
|
Ccb->OemQueryTemplate.Wild.MaximumLength = 0;
|
||||||
@@ -833,11 +833,11 @@ Return Value:
|
|||||||
// We'll case on the type of information requested and fill up
|
// We'll case on the type of information requested and fill up
|
||||||
// the user buffer if everything fits.
|
// the user buffer if everything fits.
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// Determine the UNICODE length of the file name.
|
// Determine the UNICODE length of the file name.
|
||||||
//
|
//
|
||||||
|
|
||||||
FileNameLength = RtlOemStringToCountedUnicodeSize(&Fat8Dot3String);
|
FileNameLength = RtlOemStringToCountedUnicodeSize(&Fat8Dot3String);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -855,18 +855,18 @@ Return Value:
|
|||||||
// STATUS_SUCCESS is returned. A subsequent query will
|
// STATUS_SUCCESS is returned. A subsequent query will
|
||||||
// pick up with this record.
|
// pick up with this record.
|
||||||
//
|
//
|
||||||
|
|
||||||
BytesRemainingInBuffer = UserBufferLength - NextEntry;
|
BytesRemainingInBuffer = UserBufferLength - NextEntry;
|
||||||
|
|
||||||
if ( (NextEntry != 0) &&
|
if ( (NextEntry != 0) &&
|
||||||
( (BaseLength + FileNameLength > BytesRemainingInBuffer) ||
|
( (BaseLength + FileNameLength > BytesRemainingInBuffer) ||
|
||||||
(UserBufferLength < NextEntry) ) ) {
|
(UserBufferLength < NextEntry) ) ) {
|
||||||
|
|
||||||
DebugTrace(0, Dbg, "Next entry won't fit\n", 0);
|
DebugTrace(0, Dbg, "Next entry won't fit\n", 0);
|
||||||
|
|
||||||
try_return( Status = STATUS_SUCCESS );
|
try_return( Status = STATUS_SUCCESS );
|
||||||
}
|
}
|
||||||
|
|
||||||
NT_ASSERT( BytesRemainingInBuffer >= BaseLength );
|
NT_ASSERT( BytesRemainingInBuffer >= BaseLength );
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -876,53 +876,53 @@ Return Value:
|
|||||||
RtlZeroMemory( &Buffer[NextEntry], BaseLength );
|
RtlZeroMemory( &Buffer[NextEntry], BaseLength );
|
||||||
|
|
||||||
switch ( FileInformationClass ) {
|
switch ( FileInformationClass ) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Now fill the base parts of the strucure that are applicable.
|
// Now fill the base parts of the strucure that are applicable.
|
||||||
//
|
//
|
||||||
|
|
||||||
case FileBothDirectoryInformation:
|
case FileBothDirectoryInformation:
|
||||||
case FileFullDirectoryInformation:
|
case FileFullDirectoryInformation:
|
||||||
case FileIdBothDirectoryInformation:
|
case FileIdBothDirectoryInformation:
|
||||||
case FileIdFullDirectoryInformation:
|
case FileIdFullDirectoryInformation:
|
||||||
|
|
||||||
DebugTrace(0, Dbg, "FatQueryDirectory -> Getting file full directory information\n", 0);
|
DebugTrace(0, Dbg, "FatQueryDirectory -> Getting file full directory information\n", 0);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the Ea file length.
|
// Get the Ea file length.
|
||||||
//
|
//
|
||||||
|
|
||||||
FullDirInfo = (PFILE_FULL_DIR_INFORMATION)&Buffer[NextEntry];
|
FullDirInfo = (PFILE_FULL_DIR_INFORMATION)&Buffer[NextEntry];
|
||||||
|
|
||||||
//
|
//
|
||||||
// If the EAs are corrupt, ignore the error. We don't want
|
// If the EAs are corrupt, ignore the error. We don't want
|
||||||
// to abort the directory query.
|
// to abort the directory query.
|
||||||
//
|
//
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
FatGetEaLength( IrpContext,
|
FatGetEaLength( IrpContext,
|
||||||
Vcb,
|
Vcb,
|
||||||
Dirent,
|
Dirent,
|
||||||
&FullDirInfo->EaSize );
|
&FullDirInfo->EaSize );
|
||||||
|
|
||||||
} _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
|
} _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
|
||||||
|
|
||||||
FatResetExceptionState( IrpContext );
|
FatResetExceptionState( IrpContext );
|
||||||
FullDirInfo->EaSize = 0;
|
FullDirInfo->EaSize = 0;
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
|
|
||||||
case FileDirectoryInformation:
|
case FileDirectoryInformation:
|
||||||
|
|
||||||
DirInfo = (PFILE_DIRECTORY_INFORMATION)&Buffer[NextEntry];
|
DirInfo = (PFILE_DIRECTORY_INFORMATION)&Buffer[NextEntry];
|
||||||
|
|
||||||
FatGetDirTimes( IrpContext, Dirent, DirInfo );
|
FatGetDirTimes( IrpContext, Dirent, DirInfo );
|
||||||
|
|
||||||
DirInfo->EndOfFile.QuadPart = Dirent->FileSize;
|
DirInfo->EndOfFile.QuadPart = Dirent->FileSize;
|
||||||
|
|
||||||
if (!FlagOn( Dirent->Attributes, FAT_DIRENT_ATTR_DIRECTORY )) {
|
if (!FlagOn( Dirent->Attributes, FAT_DIRENT_ATTR_DIRECTORY )) {
|
||||||
|
|
||||||
|
|
||||||
DirInfo->AllocationSize.QuadPart =
|
DirInfo->AllocationSize.QuadPart =
|
||||||
(((Dirent->FileSize + DiskAllocSize - 1) / DiskAllocSize) *
|
(((Dirent->FileSize + DiskAllocSize - 1) / DiskAllocSize) *
|
||||||
DiskAllocSize );
|
DiskAllocSize );
|
||||||
@@ -937,87 +937,87 @@ Return Value:
|
|||||||
DirInfo->FileAttributes = 0;
|
DirInfo->FileAttributes = 0;
|
||||||
|
|
||||||
DirInfo->FileAttributes |= FILE_ATTRIBUTE_NORMAL;
|
DirInfo->FileAttributes |= FILE_ATTRIBUTE_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
DirInfo->FileIndex = NextVbo;
|
DirInfo->FileIndex = NextVbo;
|
||||||
|
|
||||||
DirInfo->FileNameLength = FileNameLength;
|
DirInfo->FileNameLength = FileNameLength;
|
||||||
|
|
||||||
DebugTrace(0, Dbg, "FatQueryDirectory -> Name = \"%Z\"\n", &Fat8Dot3String);
|
DebugTrace(0, Dbg, "FatQueryDirectory -> Name = \"%Z\"\n", &Fat8Dot3String);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FileNamesInformation:
|
case FileNamesInformation:
|
||||||
|
|
||||||
DebugTrace(0, Dbg, "FatQueryDirectory -> Getting file names information\n", 0);
|
DebugTrace(0, Dbg, "FatQueryDirectory -> Getting file names information\n", 0);
|
||||||
|
|
||||||
NamesInfo = (PFILE_NAMES_INFORMATION)&Buffer[NextEntry];
|
NamesInfo = (PFILE_NAMES_INFORMATION)&Buffer[NextEntry];
|
||||||
|
|
||||||
NamesInfo->FileIndex = NextVbo;
|
NamesInfo->FileIndex = NextVbo;
|
||||||
|
|
||||||
NamesInfo->FileNameLength = FileNameLength;
|
NamesInfo->FileNameLength = FileNameLength;
|
||||||
|
|
||||||
DebugTrace(0, Dbg, "FatQueryDirectory -> Name = \"%Z\"\n", &Fat8Dot3String );
|
DebugTrace(0, Dbg, "FatQueryDirectory -> Name = \"%Z\"\n", &Fat8Dot3String );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#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
|
#endif
|
||||||
FatBugCheck( FileInformationClass, 0, 0 );
|
FatBugCheck( FileInformationClass, 0, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
BytesConverted = 0;
|
BytesConverted = 0;
|
||||||
|
|
||||||
Status = RtlOemToUnicodeN( (PWCH)&Buffer[NextEntry + BaseLength],
|
Status = RtlOemToUnicodeN( (PWCH)&Buffer[NextEntry + BaseLength],
|
||||||
BytesRemainingInBuffer - BaseLength,
|
BytesRemainingInBuffer - BaseLength,
|
||||||
&BytesConverted,
|
&BytesConverted,
|
||||||
Fat8Dot3String.Buffer,
|
Fat8Dot3String.Buffer,
|
||||||
Fat8Dot3String.Length );
|
Fat8Dot3String.Length );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check for the case that a single entry doesn't fit.
|
// Check for the case that a single entry doesn't fit.
|
||||||
// This should only get this far on the first entry
|
// This should only get this far on the first entry
|
||||||
//
|
//
|
||||||
|
|
||||||
if (BytesConverted < FileNameLength) {
|
if (BytesConverted < FileNameLength) {
|
||||||
|
|
||||||
NT_ASSERT( NextEntry == 0 );
|
NT_ASSERT( NextEntry == 0 );
|
||||||
Status = STATUS_BUFFER_OVERFLOW;
|
Status = STATUS_BUFFER_OVERFLOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set up the previous next entry offset
|
// Set up the previous next entry offset
|
||||||
//
|
//
|
||||||
|
|
||||||
*((PULONG)(&Buffer[LastEntry])) = NextEntry - LastEntry;
|
*((PULONG)(&Buffer[LastEntry])) = NextEntry - LastEntry;
|
||||||
|
|
||||||
//
|
//
|
||||||
// And indicate how much of the user buffer we have currently
|
// And indicate how much of the user buffer we have currently
|
||||||
// used up. We must compute this value before we long align
|
// used up. We must compute this value before we long align
|
||||||
// ourselves for the next entry
|
// ourselves for the next entry
|
||||||
//
|
//
|
||||||
|
|
||||||
Irp->IoStatus.Information = QuadAlign( Irp->IoStatus.Information ) +
|
Irp->IoStatus.Information = QuadAlign( Irp->IoStatus.Information ) +
|
||||||
BaseLength + BytesConverted;
|
BaseLength + BytesConverted;
|
||||||
|
|
||||||
//
|
//
|
||||||
// If something happened with the conversion, bail here.
|
// If something happened with the conversion, bail here.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ( !NT_SUCCESS( Status ) ) {
|
if ( !NT_SUCCESS( Status ) ) {
|
||||||
|
|
||||||
try_return( NOTHING );
|
try_return( NOTHING );
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
ULONG ShortNameLength;
|
ULONG ShortNameLength;
|
||||||
|
|
||||||
FileNameLength = LongFileName.Length;
|
FileNameLength = LongFileName.Length;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Here are the rules concerning filling up the buffer:
|
// Here are the rules concerning filling up the buffer:
|
||||||
//
|
//
|
||||||
@@ -1033,20 +1033,20 @@ Return Value:
|
|||||||
// STATUS_SUCCESS is returned. A subsequent query will
|
// STATUS_SUCCESS is returned. A subsequent query will
|
||||||
// pick up with this record.
|
// pick up with this record.
|
||||||
//
|
//
|
||||||
|
|
||||||
BytesRemainingInBuffer = UserBufferLength - NextEntry;
|
BytesRemainingInBuffer = UserBufferLength - NextEntry;
|
||||||
|
|
||||||
if ( (NextEntry != 0) &&
|
if ( (NextEntry != 0) &&
|
||||||
( (BaseLength + FileNameLength > BytesRemainingInBuffer) ||
|
( (BaseLength + FileNameLength > BytesRemainingInBuffer) ||
|
||||||
(UserBufferLength < NextEntry) ) ) {
|
(UserBufferLength < NextEntry) ) ) {
|
||||||
|
|
||||||
DebugTrace(0, Dbg, "Next entry won't fit\n", 0);
|
DebugTrace(0, Dbg, "Next entry won't fit\n", 0);
|
||||||
|
|
||||||
try_return( Status = STATUS_SUCCESS );
|
try_return( Status = STATUS_SUCCESS );
|
||||||
}
|
}
|
||||||
|
|
||||||
NT_ASSERT( BytesRemainingInBuffer >= BaseLength );
|
NT_ASSERT( BytesRemainingInBuffer >= BaseLength );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Zero the base part of the structure.
|
// Zero the base part of the structure.
|
||||||
//
|
//
|
||||||
@@ -1054,90 +1054,90 @@ Return Value:
|
|||||||
RtlZeroMemory( &Buffer[NextEntry], BaseLength );
|
RtlZeroMemory( &Buffer[NextEntry], BaseLength );
|
||||||
|
|
||||||
switch ( FileInformationClass ) {
|
switch ( FileInformationClass ) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Now fill the base parts of the strucure that are applicable.
|
// Now fill the base parts of the strucure that are applicable.
|
||||||
//
|
//
|
||||||
|
|
||||||
case FileBothDirectoryInformation:
|
case FileBothDirectoryInformation:
|
||||||
case FileIdBothDirectoryInformation:
|
case FileIdBothDirectoryInformation:
|
||||||
|
|
||||||
BothDirInfo = (PFILE_BOTH_DIR_INFORMATION)&Buffer[NextEntry];
|
BothDirInfo = (PFILE_BOTH_DIR_INFORMATION)&Buffer[NextEntry];
|
||||||
|
|
||||||
//
|
//
|
||||||
// Now we have an entry to return to our caller. We'll convert
|
// 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.
|
// 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
|
// We'll case on the type of information requested and fill up
|
||||||
// the user buffer if everything fits.
|
// the user buffer if everything fits.
|
||||||
//
|
//
|
||||||
|
|
||||||
Fat8dot3ToString( IrpContext, Dirent, FALSE, &Fat8Dot3String );
|
Fat8dot3ToString( IrpContext, Dirent, FALSE, &Fat8Dot3String );
|
||||||
|
|
||||||
NT_ASSERT( Fat8Dot3String.Length <= 12 );
|
NT_ASSERT( Fat8Dot3String.Length <= 12 );
|
||||||
|
|
||||||
Status = RtlOemToUnicodeN( &BothDirInfo->ShortName[0],
|
Status = RtlOemToUnicodeN( &BothDirInfo->ShortName[0],
|
||||||
12*sizeof(WCHAR),
|
12*sizeof(WCHAR),
|
||||||
&ShortNameLength,
|
&ShortNameLength,
|
||||||
Fat8Dot3String.Buffer,
|
Fat8Dot3String.Buffer,
|
||||||
Fat8Dot3String.Length );
|
Fat8Dot3String.Length );
|
||||||
|
|
||||||
NT_ASSERT( Status != STATUS_BUFFER_OVERFLOW );
|
NT_ASSERT( Status != STATUS_BUFFER_OVERFLOW );
|
||||||
NT_ASSERT( ShortNameLength <= 12*sizeof(WCHAR) );
|
NT_ASSERT( ShortNameLength <= 12*sizeof(WCHAR) );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Copy the length into the dirinfo structure. Note
|
// Copy the length into the dirinfo structure. Note
|
||||||
// that the LHS below is a USHORT, so it can not
|
// that the LHS below is a USHORT, so it can not
|
||||||
// be specificed as the OUT parameter above.
|
// be specificed as the OUT parameter above.
|
||||||
//
|
//
|
||||||
|
|
||||||
BothDirInfo->ShortNameLength = (UCHAR)ShortNameLength;
|
BothDirInfo->ShortNameLength = (UCHAR)ShortNameLength;
|
||||||
|
|
||||||
//
|
//
|
||||||
// If something happened with the conversion, bail here.
|
// If something happened with the conversion, bail here.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ( !NT_SUCCESS( Status ) ) {
|
if ( !NT_SUCCESS( Status ) ) {
|
||||||
|
|
||||||
try_return( NOTHING );
|
try_return( NOTHING );
|
||||||
}
|
}
|
||||||
|
|
||||||
case FileFullDirectoryInformation:
|
case FileFullDirectoryInformation:
|
||||||
case FileIdFullDirectoryInformation:
|
case FileIdFullDirectoryInformation:
|
||||||
|
|
||||||
DebugTrace(0, Dbg, "FatQueryDirectory -> Getting file full directory information\n", 0);
|
DebugTrace(0, Dbg, "FatQueryDirectory -> Getting file full directory information\n", 0);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the Ea file length.
|
// Get the Ea file length.
|
||||||
//
|
//
|
||||||
|
|
||||||
FullDirInfo = (PFILE_FULL_DIR_INFORMATION)&Buffer[NextEntry];
|
FullDirInfo = (PFILE_FULL_DIR_INFORMATION)&Buffer[NextEntry];
|
||||||
|
|
||||||
//
|
//
|
||||||
// If the EAs are corrupt, ignore the error. We don't want
|
// If the EAs are corrupt, ignore the error. We don't want
|
||||||
// to abort the directory query.
|
// to abort the directory query.
|
||||||
//
|
//
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
FatGetEaLength( IrpContext,
|
FatGetEaLength( IrpContext,
|
||||||
Vcb,
|
Vcb,
|
||||||
Dirent,
|
Dirent,
|
||||||
&FullDirInfo->EaSize );
|
&FullDirInfo->EaSize );
|
||||||
|
|
||||||
} _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
|
} _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
|
||||||
|
|
||||||
FatResetExceptionState( IrpContext );
|
FatResetExceptionState( IrpContext );
|
||||||
FullDirInfo->EaSize = 0;
|
FullDirInfo->EaSize = 0;
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
|
|
||||||
case FileDirectoryInformation:
|
case FileDirectoryInformation:
|
||||||
|
|
||||||
DirInfo = (PFILE_DIRECTORY_INFORMATION)&Buffer[NextEntry];
|
DirInfo = (PFILE_DIRECTORY_INFORMATION)&Buffer[NextEntry];
|
||||||
|
|
||||||
FatGetDirTimes( IrpContext, Dirent, DirInfo );
|
FatGetDirTimes( IrpContext, Dirent, DirInfo );
|
||||||
|
|
||||||
DirInfo->EndOfFile.QuadPart = Dirent->FileSize;
|
DirInfo->EndOfFile.QuadPart = Dirent->FileSize;
|
||||||
|
|
||||||
if (!FlagOn( Dirent->Attributes, FAT_DIRENT_ATTR_DIRECTORY )) {
|
if (!FlagOn( Dirent->Attributes, FAT_DIRENT_ATTR_DIRECTORY )) {
|
||||||
|
|
||||||
|
|
||||||
@@ -1147,7 +1147,7 @@ Return Value:
|
|||||||
/ DiskAllocSize )
|
/ DiskAllocSize )
|
||||||
* DiskAllocSize );
|
* DiskAllocSize );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Dirent->Attributes != 0) {
|
if (Dirent->Attributes != 0) {
|
||||||
DirInfo->FileAttributes = Dirent->Attributes;
|
DirInfo->FileAttributes = Dirent->Attributes;
|
||||||
|
|
||||||
@@ -1162,31 +1162,31 @@ Return Value:
|
|||||||
|
|
||||||
|
|
||||||
DirInfo->FileIndex = NextVbo;
|
DirInfo->FileIndex = NextVbo;
|
||||||
|
|
||||||
DirInfo->FileNameLength = FileNameLength;
|
DirInfo->FileNameLength = FileNameLength;
|
||||||
|
|
||||||
DebugTrace(0, Dbg, "FatQueryDirectory -> Name = \"%Z\"\n", &Fat8Dot3String);
|
DebugTrace(0, Dbg, "FatQueryDirectory -> Name = \"%Z\"\n", &Fat8Dot3String);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FileNamesInformation:
|
case FileNamesInformation:
|
||||||
|
|
||||||
DebugTrace(0, Dbg, "FatQueryDirectory -> Getting file names information\n", 0);
|
DebugTrace(0, Dbg, "FatQueryDirectory -> Getting file names information\n", 0);
|
||||||
|
|
||||||
NamesInfo = (PFILE_NAMES_INFORMATION)&Buffer[NextEntry];
|
NamesInfo = (PFILE_NAMES_INFORMATION)&Buffer[NextEntry];
|
||||||
|
|
||||||
NamesInfo->FileIndex = NextVbo;
|
NamesInfo->FileIndex = NextVbo;
|
||||||
|
|
||||||
NamesInfo->FileNameLength = FileNameLength;
|
NamesInfo->FileNameLength = FileNameLength;
|
||||||
|
|
||||||
DebugTrace(0, Dbg, "FatQueryDirectory -> Name = \"%Z\"\n", &Fat8Dot3String );
|
DebugTrace(0, Dbg, "FatQueryDirectory -> Name = \"%Z\"\n", &Fat8Dot3String );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#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
|
#endif
|
||||||
FatBugCheck( FileInformationClass, 0, 0 );
|
FatBugCheck( FileInformationClass, 0, 0 );
|
||||||
}
|
}
|
||||||
@@ -1194,15 +1194,15 @@ Return Value:
|
|||||||
BytesConverted = BytesRemainingInBuffer - BaseLength >= FileNameLength ?
|
BytesConverted = BytesRemainingInBuffer - BaseLength >= FileNameLength ?
|
||||||
FileNameLength :
|
FileNameLength :
|
||||||
BytesRemainingInBuffer - BaseLength;
|
BytesRemainingInBuffer - BaseLength;
|
||||||
|
|
||||||
RtlCopyMemory( &Buffer[NextEntry + BaseLength],
|
RtlCopyMemory( &Buffer[NextEntry + BaseLength],
|
||||||
&LongFileName.Buffer[0],
|
&LongFileName.Buffer[0],
|
||||||
BytesConverted );
|
BytesConverted );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set up the previous next entry offset
|
// Set up the previous next entry offset
|
||||||
//
|
//
|
||||||
|
|
||||||
*((PULONG)(&Buffer[LastEntry])) = NextEntry - LastEntry;
|
*((PULONG)(&Buffer[LastEntry])) = NextEntry - LastEntry;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1210,7 +1210,7 @@ Return Value:
|
|||||||
// used up. We must compute this value before we long align
|
// used up. We must compute this value before we long align
|
||||||
// ourselves for the next entry
|
// ourselves for the next entry
|
||||||
//
|
//
|
||||||
|
|
||||||
Irp->IoStatus.Information = QuadAlign( Irp->IoStatus.Information ) +
|
Irp->IoStatus.Information = QuadAlign( Irp->IoStatus.Information ) +
|
||||||
BaseLength + BytesConverted;
|
BaseLength + BytesConverted;
|
||||||
|
|
||||||
@@ -1248,7 +1248,7 @@ Return Value:
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
} _SEH2_EXCEPT (EXCEPTION_EXECUTE_HANDLER) {
|
} _SEH2_EXCEPT (EXCEPTION_EXECUTE_HANDLER) {
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1256,7 +1256,7 @@ Return Value:
|
|||||||
// fail this request. This is the only reason any exception
|
// fail this request. This is the only reason any exception
|
||||||
// would have occured at this level.
|
// would have occured at this level.
|
||||||
//
|
//
|
||||||
|
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
UpdateCcb = FALSE;
|
UpdateCcb = FALSE;
|
||||||
try_return( Status = _SEH2_GetExceptionCode());
|
try_return( Status = _SEH2_GetExceptionCode());
|
||||||
@@ -1268,7 +1268,7 @@ Return Value:
|
|||||||
|
|
||||||
LastEntry = NextEntry;
|
LastEntry = NextEntry;
|
||||||
NextEntry += (ULONG)QuadAlign(BaseLength + BytesConverted);
|
NextEntry += (ULONG)QuadAlign(BaseLength + BytesConverted);
|
||||||
|
|
||||||
CurrentVbo = NextVbo + sizeof( DIRENT );
|
CurrentVbo = NextVbo + sizeof( DIRENT );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1321,7 +1321,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local Support Routine
|
// Local Support Routine
|
||||||
//
|
//
|
||||||
@@ -1442,7 +1442,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local Support Routine
|
// Local Support Routine
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ FatDefragDirectory (
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
ULONG
|
ULONG
|
||||||
FatCreateNewDirent (
|
FatCreateNewDirent (
|
||||||
@@ -213,7 +213,7 @@ Routine Description:
|
|||||||
because the disk is full or the root directory is full) then
|
because the disk is full or the root directory is full) then
|
||||||
it raises the appropriate status. The dirent itself is
|
it raises the appropriate status. The dirent itself is
|
||||||
neither initialized nor pinned by this procedure.
|
neither initialized nor pinned by this procedure.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
ParentDirectory - Supplies the DCB for the directory in which
|
ParentDirectory - Supplies the DCB for the directory in which
|
||||||
@@ -373,7 +373,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
if (ParentDirectory->Header.AllocationSize.LowPart >= (64 * 1024 * sizeof(DIRENT)) ||
|
if (ParentDirectory->Header.AllocationSize.LowPart >= (64 * 1024 * sizeof(DIRENT)) ||
|
||||||
|
|
||||||
//
|
//
|
||||||
// Make sure we are not trying to expand the root directory on non
|
// Make sure we are not trying to expand the root directory on non
|
||||||
// FAT32. FAT16 and FAT12 have fixed size allocations.
|
// FAT32. FAT16 and FAT12 have fixed size allocations.
|
||||||
@@ -381,7 +381,7 @@ Return Value:
|
|||||||
|
|
||||||
(!FatIsFat32(ParentDirectory->Vcb) &&
|
(!FatIsFat32(ParentDirectory->Vcb) &&
|
||||||
NodeType(ParentDirectory) == FAT_NTC_ROOT_DCB)) {
|
NodeType(ParentDirectory) == FAT_NTC_ROOT_DCB)) {
|
||||||
|
|
||||||
DebugTrace(0, Dbg, "Full root directory or too big on FAT32. Raise Status.\n", 0);
|
DebugTrace(0, Dbg, "Full root directory or too big on FAT32. Raise Status.\n", 0);
|
||||||
|
|
||||||
FatRaiseStatus( IrpContext, STATUS_CANNOT_MAKE );
|
FatRaiseStatus( IrpContext, STATUS_CANNOT_MAKE );
|
||||||
@@ -545,7 +545,7 @@ Return Value:
|
|||||||
return ByteOffset;
|
return ByteOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
@@ -647,7 +647,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatTunnelFcbOrDcb (
|
FatTunnelFcbOrDcb (
|
||||||
IN PFCB FcbOrDcb,
|
IN PFCB FcbOrDcb,
|
||||||
@@ -755,7 +755,7 @@ Return Value:
|
|||||||
if ((i*sizeof(WCHAR)) < ShortNameWithCase.Length) {
|
if ((i*sizeof(WCHAR)) < ShortNameWithCase.Length) {
|
||||||
DownCaseSeg.Buffer = &ShortNameWithCase.Buffer[i];
|
DownCaseSeg.Buffer = &ShortNameWithCase.Buffer[i];
|
||||||
DownCaseSeg.MaximumLength = DownCaseSeg.Length = ShortNameWithCase.Length - i*sizeof(WCHAR);
|
DownCaseSeg.MaximumLength = DownCaseSeg.Length = ShortNameWithCase.Length - i*sizeof(WCHAR);
|
||||||
|
|
||||||
RtlDowncaseUnicodeString(&DownCaseSeg, &DownCaseSeg, FALSE);
|
RtlDowncaseUnicodeString(&DownCaseSeg, &DownCaseSeg, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -779,9 +779,9 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatDeleteDirent (
|
FatDeleteDirent (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -838,7 +838,7 @@ Return Value:
|
|||||||
// Among other reasons, it'd be unfortunate if this raced with the
|
// Among other reasons, it'd be unfortunate if this raced with the
|
||||||
// rename path.
|
// rename path.
|
||||||
//
|
//
|
||||||
|
|
||||||
NT_ASSERT( ExIsResourceAcquiredExclusiveLite( &FcbOrDcb->Vcb->Resource ));
|
NT_ASSERT( ExIsResourceAcquiredExclusiveLite( &FcbOrDcb->Vcb->Resource ));
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -857,9 +857,9 @@ Return Value:
|
|||||||
(FcbOrDcb->Header.FileSize.LowPart != 0)))) {
|
(FcbOrDcb->Header.FileSize.LowPart != 0)))) {
|
||||||
|
|
||||||
DebugTrace( 0, Dbg, "Called with non zero allocation/file size.\n", 0);
|
DebugTrace( 0, Dbg, "Called with non zero allocation/file size.\n", 0);
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#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
|
#endif
|
||||||
FatBugCheck( 0, 0, 0 );
|
FatBugCheck( 0, 0, 0 );
|
||||||
}
|
}
|
||||||
@@ -879,9 +879,9 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// This relies on our bottom up lockorder.
|
// This relies on our bottom up lockorder.
|
||||||
//
|
//
|
||||||
|
|
||||||
ExAcquireResourceExclusiveLite( FcbOrDcb->ParentDcb->Header.Resource, TRUE );
|
ExAcquireResourceExclusiveLite( FcbOrDcb->ParentDcb->Header.Resource, TRUE );
|
||||||
|
|
||||||
for ( Offset = FcbOrDcb->LfnOffsetWithinDirectory;
|
for ( Offset = FcbOrDcb->LfnOffsetWithinDirectory;
|
||||||
Offset <= FcbOrDcb->DirentOffsetWithinDirectory;
|
Offset <= FcbOrDcb->DirentOffsetWithinDirectory;
|
||||||
Offset += sizeof(DIRENT), Dirent += 1 ) {
|
Offset += sizeof(DIRENT), Dirent += 1 ) {
|
||||||
@@ -966,7 +966,7 @@ Return Value:
|
|||||||
|
|
||||||
Dirent->FileSize = DeleteContext->FileSize;
|
Dirent->FileSize = DeleteContext->FileSize;
|
||||||
|
|
||||||
|
|
||||||
Dirent->FirstClusterOfFile = (USHORT)DeleteContext->FirstClusterOfFile;
|
Dirent->FirstClusterOfFile = (USHORT)DeleteContext->FirstClusterOfFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -985,11 +985,11 @@ Return Value:
|
|||||||
} _SEH2_FINALLY {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
FatUnpinBcb( IrpContext, Bcb );
|
FatUnpinBcb( IrpContext, Bcb );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Release our parent.
|
// Release our parent.
|
||||||
//
|
//
|
||||||
|
|
||||||
ExReleaseResourceLite( FcbOrDcb->ParentDcb->Header.Resource );
|
ExReleaseResourceLite( FcbOrDcb->ParentDcb->Header.Resource );
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
|
|
||||||
@@ -1017,7 +1017,7 @@ Arguments:
|
|||||||
|
|
||||||
Lfn - The Lfn to look for
|
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.
|
function may cause it to be allocated from pool if not large enough.
|
||||||
|
|
||||||
Retrn Value:
|
Retrn Value:
|
||||||
@@ -1045,7 +1045,7 @@ Retrn Value:
|
|||||||
Ccb.Flags = CCB_FLAG_SKIP_SHORT_NAME_COMPARE | CCB_FLAG_QUERY_TEMPLATE_MIXED;
|
Ccb.Flags = CCB_FLAG_SKIP_SHORT_NAME_COMPARE | CCB_FLAG_QUERY_TEMPLATE_MIXED;
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
FatLocateDirent( IrpContext,
|
FatLocateDirent( IrpContext,
|
||||||
Dcb,
|
Dcb,
|
||||||
&Ccb,
|
&Ccb,
|
||||||
@@ -1057,20 +1057,20 @@ Retrn Value:
|
|||||||
NULL,
|
NULL,
|
||||||
LfnTmp,
|
LfnTmp,
|
||||||
NULL );
|
NULL );
|
||||||
|
|
||||||
} _SEH2_FINALLY {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
if (DirentBcb) {
|
if (DirentBcb) {
|
||||||
|
|
||||||
Result = TRUE;
|
Result = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
FatUnpinBcb(IrpContext, DirentBcb);
|
FatUnpinBcb(IrpContext, DirentBcb);
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
@@ -1085,7 +1085,7 @@ FatLocateDirent (
|
|||||||
OUT PVBO ByteOffset,
|
OUT PVBO ByteOffset,
|
||||||
OUT PBOOLEAN FileNameDos OPTIONAL,
|
OUT PBOOLEAN FileNameDos OPTIONAL,
|
||||||
IN OUT PUNICODE_STRING LongFileName 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};
|
UNICODE_STRING UpcasedLfn = {0};
|
||||||
WCHAR LocalLfnBuffer[32];
|
WCHAR LocalLfnBuffer[32];
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN LfnInProgress = FALSE;
|
BOOLEAN LfnInProgress = FALSE;
|
||||||
UCHAR LfnChecksum = 0;
|
UCHAR LfnChecksum = 0;
|
||||||
ULONG LfnSize = 0;
|
ULONG LfnSize = 0;
|
||||||
@@ -1162,7 +1162,7 @@ Return Value:
|
|||||||
// We must have acquired the parent or the vcb to synchronize with deletion. This
|
// 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
|
// 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.
|
// 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
|
// 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.
|
// 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 ) ||
|
ExIsResourceAcquiredExclusiveLite( ParentDirectory->Header.Resource ) ||
|
||||||
ExIsResourceAcquiredSharedLite( &ParentDirectory->Vcb->Resource ) ||
|
ExIsResourceAcquiredSharedLite( &ParentDirectory->Vcb->Resource ) ||
|
||||||
ExIsResourceAcquiredExclusiveLite( &ParentDirectory->Vcb->Resource ));
|
ExIsResourceAcquiredExclusiveLite( &ParentDirectory->Vcb->Resource ));
|
||||||
|
|
||||||
//
|
//
|
||||||
// The algorithm here is pretty simple. We just walk through the
|
// The algorithm here is pretty simple. We just walk through the
|
||||||
// parent directory until we:
|
// 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.
|
// In the first case we found it, in the latter three cases we did not.
|
||||||
//
|
//
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( Flags ); // future use
|
UNREFERENCED_PARAMETER( Flags ); // future use
|
||||||
|
|
||||||
|
|
||||||
@@ -1297,7 +1297,7 @@ Return Value:
|
|||||||
// If the entry is marked deleted, skip. If there was an Lfn in
|
// If the entry is marked deleted, skip. If there was an Lfn in
|
||||||
// progress we throw it out at this point.
|
// progress we throw it out at this point.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ((*Dirent)->FileName[0] == FAT_DIRENT_DELETED) {
|
if ((*Dirent)->FileName[0] == FAT_DIRENT_DELETED) {
|
||||||
|
|
||||||
LfnInProgress = FALSE;
|
LfnInProgress = FALSE;
|
||||||
@@ -1392,7 +1392,7 @@ Return Value:
|
|||||||
|
|
||||||
LfnIndex = (Ordinal - 1) * 13;
|
LfnIndex = (Ordinal - 1) * 13;
|
||||||
|
|
||||||
FatEnsureStringBufferEnough( LongFileName,
|
FatEnsureStringBufferEnough( LongFileName,
|
||||||
(USHORT)((LfnIndex + 13) << 1));
|
(USHORT)((LfnIndex + 13) << 1));
|
||||||
|
|
||||||
RtlCopyMemory( &LongFileName->Buffer[LfnIndex+0],
|
RtlCopyMemory( &LongFileName->Buffer[LfnIndex+0],
|
||||||
@@ -1475,7 +1475,7 @@ Return Value:
|
|||||||
// If we actually were asked to hand back volume labels,
|
// If we actually were asked to hand back volume labels,
|
||||||
// do it.
|
// do it.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (FlagOn(Ccb->Flags, CCB_FLAG_MATCH_VOLUME_ID)) {
|
if (FlagOn(Ccb->Flags, CCB_FLAG_MATCH_VOLUME_ID)) {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -1510,7 +1510,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// If we are supposed to match all entries, then match this entry.
|
// 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.
|
// We need a buffer. Try to avoid doing an allocation.
|
||||||
//
|
//
|
||||||
|
|
||||||
FatEnsureStringBufferEnough( &UpcasedLfn,
|
FatEnsureStringBufferEnough( &UpcasedLfn,
|
||||||
LongFileName->Length);
|
LongFileName->Length);
|
||||||
|
|
||||||
Status = RtlUpcaseUnicodeString( &UpcasedLfn,
|
Status = RtlUpcaseUnicodeString( &UpcasedLfn,
|
||||||
@@ -1644,7 +1644,7 @@ Return Value:
|
|||||||
|
|
||||||
|
|
||||||
UpcasedLfnValid = TRUE;
|
UpcasedLfnValid = TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1671,7 +1671,7 @@ Return Value:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1705,7 +1705,7 @@ GetNextDirent:
|
|||||||
|
|
||||||
FatFreeStringBuffer( &UpcasedLfn );
|
FatFreeStringBuffer( &UpcasedLfn );
|
||||||
|
|
||||||
|
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
|
|
||||||
DebugTrace(-1, Dbg, "FatLocateDirent -> (VOID)\n", 0);
|
DebugTrace(-1, Dbg, "FatLocateDirent -> (VOID)\n", 0);
|
||||||
@@ -1715,8 +1715,8 @@ GetNextDirent:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatLocateSimpleOemDirent (
|
FatLocateSimpleOemDirent (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -1793,7 +1793,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
@@ -1935,7 +1935,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
@@ -2029,17 +2029,17 @@ Return Value:
|
|||||||
// verify) but we'll handle and raise here to save all callers checking the
|
// verify) but we'll handle and raise here to save all callers checking the
|
||||||
// pointers.
|
// pointers.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ((NULL == *Dirent) && !ReturnOnFailure) {
|
if ((NULL == *Dirent) && !ReturnOnFailure) {
|
||||||
|
|
||||||
NT_ASSERT( FALSE);
|
NT_ASSERT( FALSE);
|
||||||
FatRaiseStatus( IrpContext, STATUS_FILE_CORRUPT_ERROR);
|
FatRaiseStatus( IrpContext, STATUS_FILE_CORRUPT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugTrace(-1, Dbg, "FatGetDirentFromFcbOrDcb -> (VOID)\n", 0);
|
DebugTrace(-1, Dbg, "FatGetDirentFromFcbOrDcb -> (VOID)\n", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
@@ -2139,10 +2139,10 @@ Return Value:
|
|||||||
if ((Dirent->FileName[0] != FAT_DIRENT_DELETED) &&
|
if ((Dirent->FileName[0] != FAT_DIRENT_DELETED) &&
|
||||||
(Dirent->Attributes != FAT_DIRENT_ATTR_LFN)) {
|
(Dirent->Attributes != FAT_DIRENT_ATTR_LFN)) {
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2163,10 +2163,10 @@ Return Value:
|
|||||||
return IsDirectoryEmpty;
|
return IsDirectoryEmpty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatConstructDirent (
|
FatConstructDirent (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -2248,7 +2248,7 @@ Return Value:
|
|||||||
FALSE,
|
FALSE,
|
||||||
&Dirent->CreationTime,
|
&Dirent->CreationTime,
|
||||||
&Dirent->CreationMSec )) {
|
&Dirent->CreationMSec )) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// No tunneled time or the tunneled time was bogus. Since we aren't
|
// No tunneled time or the tunneled time was bogus. Since we aren't
|
||||||
// responsible for initializing the to-be-created Fcb with creation
|
// responsible for initializing the to-be-created Fcb with creation
|
||||||
@@ -2435,7 +2435,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatConstructLabelDirent (
|
FatConstructLabelDirent (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -2494,8 +2494,8 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatSetFileSizeInDirent (
|
FatSetFileSizeInDirent (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -2549,7 +2549,7 @@ Return Value:
|
|||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatSetFileSizeInDirentNoRaise (
|
FatSetFileSizeInDirentNoRaise (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -2580,9 +2580,9 @@ Return Value:
|
|||||||
|
|
||||||
{
|
{
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
FatSetFileSizeInDirent( IrpContext, Fcb, AlternativeFileSize );
|
FatSetFileSizeInDirent( IrpContext, Fcb, AlternativeFileSize );
|
||||||
|
|
||||||
} _SEH2_EXCEPT(FatExceptionFilter( IrpContext, _SEH2_GetExceptionInformation() )) {
|
} _SEH2_EXCEPT(FatExceptionFilter( IrpContext, _SEH2_GetExceptionInformation() )) {
|
||||||
|
|
||||||
NOTHING;
|
NOTHING;
|
||||||
@@ -2590,7 +2590,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatUpdateDirentFromFcb (
|
FatUpdateDirentFromFcb (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -2611,9 +2611,9 @@ Routine Description:
|
|||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
FileObject - Fileobject representing the handle involved
|
FileObject - Fileobject representing the handle involved
|
||||||
|
|
||||||
FcbOrDcb - File/Dir involved
|
FcbOrDcb - File/Dir involved
|
||||||
|
|
||||||
Ccb - User context involved
|
Ccb - User context involved
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
@@ -2645,7 +2645,7 @@ Return Value:
|
|||||||
// Nothing to do if the fcb is bad, volume is readonly or we got the
|
// Nothing to do if the fcb is bad, volume is readonly or we got the
|
||||||
// root dir.
|
// root dir.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (FcbOrDcb->FcbCondition != FcbGood ||
|
if (FcbOrDcb->FcbCondition != FcbGood ||
|
||||||
NodeType(FcbOrDcb) == FAT_NTC_ROOT_DCB ||
|
NodeType(FcbOrDcb) == FAT_NTC_ROOT_DCB ||
|
||||||
FlagOn(FcbOrDcb->Vcb->VcbState, VCB_STATE_FLAG_WRITE_PROTECTED)) {
|
FlagOn(FcbOrDcb->Vcb->VcbState, VCB_STATE_FLAG_WRITE_PROTECTED)) {
|
||||||
@@ -2722,7 +2722,7 @@ Return Value:
|
|||||||
// Break parent directory oplock. Directory oplock breaks are
|
// Break parent directory oplock. Directory oplock breaks are
|
||||||
// always advisory, so we will never block/get STATUS_PENDING here.
|
// always advisory, so we will never block/get STATUS_PENDING here.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (FcbOrDcb->ParentDcb != NULL) {
|
if (FcbOrDcb->ParentDcb != NULL) {
|
||||||
|
|
||||||
FsRtlCheckOplockEx( FatGetFcbOplock(FcbOrDcb->ParentDcb),
|
FsRtlCheckOplockEx( FatGetFcbOplock(FcbOrDcb->ParentDcb),
|
||||||
@@ -2733,7 +2733,7 @@ Return Value:
|
|||||||
NULL );
|
NULL );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the dirent
|
// Get the dirent
|
||||||
//
|
//
|
||||||
@@ -2757,7 +2757,7 @@ Return Value:
|
|||||||
|
|
||||||
Dirent->Attributes |= FILE_ATTRIBUTE_ARCHIVE;
|
Dirent->Attributes |= FILE_ATTRIBUTE_ARCHIVE;
|
||||||
FcbOrDcb->DirentFatFlags |= FILE_ATTRIBUTE_ARCHIVE;
|
FcbOrDcb->DirentFatFlags |= FILE_ATTRIBUTE_ARCHIVE;
|
||||||
|
|
||||||
NotifyFilter |= FILE_NOTIFY_CHANGE_ATTRIBUTES;
|
NotifyFilter |= FILE_NOTIFY_CHANGE_ATTRIBUTES;
|
||||||
UpdateDirent = TRUE;
|
UpdateDirent = TRUE;
|
||||||
}
|
}
|
||||||
@@ -2813,15 +2813,15 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
NT_ASSERT( NodeType(FcbOrDcb) == FAT_NTC_FCB );
|
NT_ASSERT( NodeType(FcbOrDcb) == FAT_NTC_FCB );
|
||||||
|
|
||||||
if (Dirent->FileSize != FcbOrDcb->Header.FileSize.LowPart) {
|
if (Dirent->FileSize != FcbOrDcb->Header.FileSize.LowPart) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Update the dirent file size
|
// Update the dirent file size
|
||||||
//
|
//
|
||||||
|
|
||||||
Dirent->FileSize = FcbOrDcb->Header.FileSize.LowPart;
|
Dirent->FileSize = FcbOrDcb->Header.FileSize.LowPart;
|
||||||
|
|
||||||
//
|
//
|
||||||
// We call the notify package to report that the
|
// We call the notify package to report that the
|
||||||
// size has changed.
|
// size has changed.
|
||||||
@@ -2829,9 +2829,9 @@ Return Value:
|
|||||||
|
|
||||||
NotifyFilter |= FILE_NOTIFY_CHANGE_SIZE;
|
NotifyFilter |= FILE_NOTIFY_CHANGE_SIZE;
|
||||||
UpdateDirent = TRUE;
|
UpdateDirent = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2869,7 +2869,7 @@ Return Value:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal support routine
|
// Internal support routine
|
||||||
//
|
//
|
||||||
@@ -2913,7 +2913,7 @@ Return Value:
|
|||||||
return Checksum;
|
return Checksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if 0 // It turns out Win95 is still creating short names without a ~
|
#if 0 // It turns out Win95 is still creating short names without a ~
|
||||||
|
|
||||||
@@ -3078,7 +3078,7 @@ Return Value:
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif //0
|
#endif //0
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal support routine
|
// Internal support routine
|
||||||
//
|
//
|
||||||
@@ -3294,7 +3294,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal support routine
|
// Internal support routine
|
||||||
//
|
//
|
||||||
@@ -3444,7 +3444,7 @@ Return Value:
|
|||||||
McbInitialized = TRUE;
|
McbInitialized = TRUE;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
FatLocateDirent( IrpContext,
|
FatLocateDirent( IrpContext,
|
||||||
Dcb,
|
Dcb,
|
||||||
&Ccb,
|
&Ccb,
|
||||||
@@ -3668,7 +3668,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
FatUnpinRepinnedBcbs( IrpContext );
|
FatUnpinRepinnedBcbs( IrpContext );
|
||||||
|
|
||||||
} _SEH2_EXCEPT(FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ?
|
} _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
|
// to update the Fcb. If this raises, we have to give up and blow
|
||||||
// evenyone else away too.
|
// evenyone else away too.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (!InvalidateFcbs) {
|
if (!InvalidateFcbs) {
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
FatLocateSimpleOemDirent( IrpContext,
|
FatLocateSimpleOemDirent( IrpContext,
|
||||||
Dcb,
|
Dcb,
|
||||||
&Fcb->ShortName.Name.Oem,
|
&Fcb->ShortName.Name.Oem,
|
||||||
&TmpDirent,
|
&TmpDirent,
|
||||||
&TmpBcb,
|
&TmpBcb,
|
||||||
(PVBO)&TmpOffset );
|
(PVBO)&TmpOffset );
|
||||||
|
|
||||||
} _SEH2_EXCEPT(FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ?
|
} _SEH2_EXCEPT(FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ?
|
||||||
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) {
|
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) {
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ ULONG FatDumpCurrentColumn;
|
|||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatDump (
|
FatDump (
|
||||||
IN PVOID Ptr
|
IN PVOID Ptr
|
||||||
@@ -136,7 +136,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatDumpDataHeader (
|
FatDumpDataHeader (
|
||||||
)
|
)
|
||||||
@@ -186,7 +186,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatDumpVcb (
|
FatDumpVcb (
|
||||||
IN PVCB Ptr
|
IN PVCB Ptr
|
||||||
@@ -249,7 +249,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatDumpFcb (
|
FatDumpFcb (
|
||||||
IN PFCB Ptr
|
IN PFCB Ptr
|
||||||
@@ -338,7 +338,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatDumpCcb (
|
FatDumpCcb (
|
||||||
IN PCCB Ptr
|
IN PCCB Ptr
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Function_class_(IRP_MJ_SET_EA)
|
_Function_class_(IRP_MJ_SET_EA)
|
||||||
_Function_class_(DRIVER_DISPATCH)
|
_Function_class_(DRIVER_DISPATCH)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
@@ -245,7 +245,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FatCommonQueryEa (
|
FatCommonQueryEa (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -270,7 +270,7 @@ Return Value:
|
|||||||
--*/
|
--*/
|
||||||
|
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
PIO_STACK_LOCATION IrpSp;
|
PIO_STACK_LOCATION IrpSp;
|
||||||
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
@@ -306,7 +306,7 @@ Return Value:
|
|||||||
|
|
||||||
FatCompleteRequest( IrpContext, Irp, STATUS_INVALID_DEVICE_REQUEST);
|
FatCompleteRequest( IrpContext, Irp, STATUS_INVALID_DEVICE_REQUEST);
|
||||||
return STATUS_INVALID_DEVICE_REQUEST;
|
return STATUS_INVALID_DEVICE_REQUEST;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
//
|
//
|
||||||
// Get the current Irp stack location
|
// Get the current Irp stack location
|
||||||
@@ -654,7 +654,7 @@ Return Value:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FatCommonSetEa (
|
FatCommonSetEa (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -679,7 +679,7 @@ Return Value:
|
|||||||
--*/
|
--*/
|
||||||
|
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
PIO_STACK_LOCATION IrpSp;
|
PIO_STACK_LOCATION IrpSp;
|
||||||
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
@@ -716,9 +716,9 @@ Return Value:
|
|||||||
|
|
||||||
FatCompleteRequest( IrpContext, Irp, STATUS_INVALID_DEVICE_REQUEST);
|
FatCompleteRequest( IrpContext, Irp, STATUS_INVALID_DEVICE_REQUEST);
|
||||||
return STATUS_INVALID_DEVICE_REQUEST;
|
return STATUS_INVALID_DEVICE_REQUEST;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
//
|
//
|
||||||
// The following booleans are used in the unwind process.
|
// The following booleans are used in the unwind process.
|
||||||
//
|
//
|
||||||
@@ -856,7 +856,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Now go pick up everything
|
// Now go pick up everything
|
||||||
//
|
//
|
||||||
|
|
||||||
FatAcquireSharedVcb( IrpContext, Fcb->Vcb );
|
FatAcquireSharedVcb( IrpContext, Fcb->Vcb );
|
||||||
AcquiredVcb = TRUE;
|
AcquiredVcb = TRUE;
|
||||||
FatAcquireExclusiveFcb( IrpContext, Fcb );
|
FatAcquireExclusiveFcb( IrpContext, Fcb );
|
||||||
@@ -1601,7 +1601,7 @@ Return Value:
|
|||||||
return Iosb;
|
return Iosb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local Support Routine
|
// Local Support Routine
|
||||||
//
|
//
|
||||||
@@ -1739,7 +1739,7 @@ Return Value:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local Support Routine
|
// Local Support Routine
|
||||||
//
|
//
|
||||||
@@ -1957,7 +1957,7 @@ Return Value:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local Support Routine
|
// Local Support Routine
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ Abstract:
|
|||||||
|
|
||||||
#define EA_SECTION_SIZE (0x00040000)
|
#define EA_SECTION_SIZE (0x00040000)
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatGetEaLength (
|
FatGetEaLength (
|
||||||
@@ -202,8 +202,8 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatGetNeedEaCount (
|
FatGetNeedEaCount (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -349,8 +349,8 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatCreateEa (
|
FatCreateEa (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -779,7 +779,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatGetEaFile (
|
FatGetEaFile (
|
||||||
@@ -1160,7 +1160,7 @@ Return Value:
|
|||||||
// The discerning reader will note that this doesn't take
|
// The discerning reader will note that this doesn't take
|
||||||
// FAT32 into account, which is of course intentional.
|
// FAT32 into account, which is of course intentional.
|
||||||
//
|
//
|
||||||
|
|
||||||
(*EaDirent)->FirstClusterOfFile =
|
(*EaDirent)->FirstClusterOfFile =
|
||||||
(USHORT) FatGetIndexFromLbo( Vcb, FirstLboOfFile );
|
(USHORT) FatGetIndexFromLbo( Vcb, FirstLboOfFile );
|
||||||
}
|
}
|
||||||
@@ -1268,7 +1268,7 @@ Return Value:
|
|||||||
|
|
||||||
FatReleaseFcb( IrpContext, Vcb->EaFcb );
|
FatReleaseFcb( IrpContext, Vcb->EaFcb );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Dereference the Ea stream file if created.
|
// 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
|
// Always release the root Dcb (our caller releases the EA Fcb if we
|
||||||
// do not raise).
|
// do not raise).
|
||||||
//
|
//
|
||||||
|
|
||||||
if (UnwindLockedRootDcb) {
|
if (UnwindLockedRootDcb) {
|
||||||
|
|
||||||
FatReleaseFcb( IrpContext, Vcb->RootDcb );
|
FatReleaseFcb( IrpContext, Vcb->RootDcb );
|
||||||
@@ -1301,7 +1301,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatReadEaSet (
|
FatReadEaSet (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -1531,8 +1531,8 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatDeleteEaSet (
|
FatDeleteEaSet (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -2003,7 +2003,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
if (UnwindPrevFileSize) {
|
if (UnwindPrevFileSize) {
|
||||||
|
|
||||||
EaFcb->Header.FileSize.LowPart = UnwindPrevFileSize;
|
EaFcb->Header.FileSize.LowPart = UnwindPrevFileSize;
|
||||||
EaFcb->Header.AllocationSize.LowPart = UnwindPrevFileSize;
|
EaFcb->Header.AllocationSize.LowPart = UnwindPrevFileSize;
|
||||||
EaDirent->FileSize = UnwindPrevFileSize;
|
EaDirent->FileSize = UnwindPrevFileSize;
|
||||||
@@ -2014,7 +2014,7 @@ Return Value:
|
|||||||
(PCC_FILE_SIZES)&EaFcb->Header.AllocationSize );
|
(PCC_FILE_SIZES)&EaFcb->Header.AllocationSize );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// If we merged the tail with the
|
// If we merged the tail with the
|
||||||
// ea file header. We split it out
|
// ea file header. We split it out
|
||||||
@@ -2086,9 +2086,9 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatAddEaSet (
|
FatAddEaSet (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -2390,7 +2390,7 @@ Return Value:
|
|||||||
|
|
||||||
FatRaiseStatus( IrpContext, STATUS_INSUFFICIENT_RESOURCES );
|
FatRaiseStatus( IrpContext, STATUS_INSUFFICIENT_RESOURCES );
|
||||||
}
|
}
|
||||||
|
|
||||||
FsRtlInitializeLargeMcb( &EaSetMcb, PagedPool );
|
FsRtlInitializeLargeMcb( &EaSetMcb, PagedPool );
|
||||||
|
|
||||||
UnwindInitializedEaSetMcb = TRUE;
|
UnwindInitializedEaSetMcb = TRUE;
|
||||||
@@ -2809,7 +2809,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
if (UnwindPrevFileSize) {
|
if (UnwindPrevFileSize) {
|
||||||
|
|
||||||
EaFcb->Header.FileSize.LowPart = UnwindPrevFileSize;
|
EaFcb->Header.FileSize.LowPart = UnwindPrevFileSize;
|
||||||
EaFcb->Header.AllocationSize.LowPart = UnwindPrevFileSize;
|
EaFcb->Header.AllocationSize.LowPart = UnwindPrevFileSize;
|
||||||
EaDirent->FileSize = UnwindPrevFileSize;
|
EaDirent->FileSize = UnwindPrevFileSize;
|
||||||
@@ -2820,7 +2820,7 @@ Return Value:
|
|||||||
(PCC_FILE_SIZES)&EaFcb->Header.AllocationSize );
|
(PCC_FILE_SIZES)&EaFcb->Header.AllocationSize );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// If we merged the tail then split it off.
|
// If we merged the tail then split it off.
|
||||||
//
|
//
|
||||||
@@ -2962,7 +2962,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatAppendPackedEa (
|
FatAppendPackedEa (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -3143,7 +3143,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatDeletePackedEa (
|
FatDeletePackedEa (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -3252,7 +3252,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
FatLocateNextEa (
|
FatLocateNextEa (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -3339,7 +3339,7 @@ Return Value:
|
|||||||
return Offset;
|
return Offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
FatLocateEaByName (
|
FatLocateEaByName (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -3424,7 +3424,7 @@ Return Value:
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
FatIsEaNameValid (
|
FatIsEaNameValid (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -3507,7 +3507,7 @@ Return Value:
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatPinEaRange (
|
FatPinEaRange (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -3584,7 +3584,7 @@ Return Value:
|
|||||||
EaRange->AuxilaryBuffer = TRUE;
|
EaRange->AuxilaryBuffer = TRUE;
|
||||||
|
|
||||||
DestinationBuffer = EaRange->Data;
|
DestinationBuffer = EaRange->Data;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -3704,7 +3704,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatMarkEaRangeDirty (
|
FatMarkEaRangeDirty (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -3739,7 +3739,7 @@ Return Value:
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// If there is an auxilary buffer we need to copy the data back into the cache.
|
// If there is an auxilary buffer we need to copy the data back into the cache.
|
||||||
//
|
//
|
||||||
@@ -3777,7 +3777,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatUnpinEaRange (
|
FatUnpinEaRange (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ typedef LBO *PLBO;
|
|||||||
typedef ULONG32 VBO;
|
typedef ULONG32 VBO;
|
||||||
typedef VBO *PVBO;
|
typedef VBO *PVBO;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The boot sector is the first physical sector (LBN == 0) on the volume.
|
// 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
|
// 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 UCHAR FAT8DOT3[11];
|
||||||
typedef FAT8DOT3 *PFAT8DOT3;
|
typedef FAT8DOT3 *PFAT8DOT3;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The directory entry record exists for every file/directory on the
|
// The directory entry record exists for every file/directory on the
|
||||||
// disk except for the root directory.
|
// disk except for the root directory.
|
||||||
@@ -343,14 +343,14 @@ typedef DIRENT *PDIRENT;
|
|||||||
//
|
//
|
||||||
// These two bits are used for EFS on FAT
|
// These two bits are used for EFS on FAT
|
||||||
// 0x1 means the file contents are encrypted
|
// 0x1 means the file contents are encrypted
|
||||||
//
|
//
|
||||||
// 0x2 means the EFS metadata header is big.
|
// 0x2 means the EFS metadata header is big.
|
||||||
// (this optimization means we don't have to read
|
// (this optimization means we don't have to read
|
||||||
// in the first sector of the file stream to get
|
// in the first sector of the file stream to get
|
||||||
// the normal header size)
|
// 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
|
#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_CHARCOUNT (6)
|
||||||
#define FAT_EFS_EXTENSION_BYTECOUNT (12)
|
#define FAT_EFS_EXTENSION_BYTECOUNT (12)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// These macros convert a number of fields in the Bpb to bytes from sectors
|
// 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)) \
|
RtlEqualMemory((TIME1),(TIME2), sizeof(FAT_TIME_STAMP)) \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
#define EA_FILE_SIGNATURE (0x4445) // "ED"
|
#define EA_FILE_SIGNATURE (0x4445) // "ED"
|
||||||
#define EA_SET_SIGNATURE (0x4145) // "EA"
|
#define EA_SET_SIGNATURE (0x4145) // "EA"
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ NTSTATUS FatBreakOnInterestingIrpCompletion = 0;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if DBG
|
#if DBG
|
||||||
ULONG
|
ULONG
|
||||||
FatBugCheckExceptionFilter (
|
FatBugCheckExceptionFilter (
|
||||||
@@ -174,7 +174,7 @@ Routine Description:
|
|||||||
|
|
||||||
An exception filter which acts as an assert that the exception should
|
An exception filter which acts as an assert that the exception should
|
||||||
never occur.
|
never occur.
|
||||||
|
|
||||||
This is only valid on debug builds, we don't want the overhead on retail.
|
This is only valid on debug builds, we don't want the overhead on retail.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
@@ -190,7 +190,7 @@ Return Value:
|
|||||||
|
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
FatBugCheck( (ULONG_PTR)ExceptionPointer->ExceptionRecord,
|
FatBugCheck( (ULONG_PTR)ExceptionPointer->ExceptionRecord,
|
||||||
(ULONG_PTR)ExceptionPointer->ContextRecord,
|
(ULONG_PTR)ExceptionPointer->ContextRecord,
|
||||||
(ULONG_PTR)ExceptionPointer->ExceptionRecord->ExceptionAddress );
|
(ULONG_PTR)ExceptionPointer->ExceptionRecord->ExceptionAddress );
|
||||||
@@ -199,7 +199,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
FatExceptionFilter (
|
FatExceptionFilter (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -238,7 +238,7 @@ Return Value:
|
|||||||
if( FatBreakOnInterestingExceptionStatus != 0 && ExceptionCode == FatBreakOnInterestingExceptionStatus ) {
|
if( FatBreakOnInterestingExceptionStatus != 0 && ExceptionCode == FatBreakOnInterestingExceptionStatus ) {
|
||||||
DbgBreakPoint();
|
DbgBreakPoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -316,8 +316,8 @@ Return Value:
|
|||||||
|
|
||||||
return EXCEPTION_EXECUTE_HANDLER;
|
return EXCEPTION_EXECUTE_HANDLER;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FatProcessException (
|
FatProcessException (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -373,7 +373,7 @@ Return Value:
|
|||||||
|
|
||||||
ExceptionCode = IrpContext->ExceptionStatus;
|
ExceptionCode = IrpContext->ExceptionStatus;
|
||||||
FatResetExceptionState( IrpContext );
|
FatResetExceptionState( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// If this is an Mdl write request, then take care of the Mdl
|
// If this is an Mdl write request, then take care of the Mdl
|
||||||
// here so that things get cleaned up properly. Cc now leaves
|
// here so that things get cleaned up properly. Cc now leaves
|
||||||
@@ -472,7 +472,7 @@ Return Value:
|
|||||||
|
|
||||||
ExceptionCode = STATUS_FILE_LOCK_CONFLICT;
|
ExceptionCode = STATUS_FILE_LOCK_CONFLICT;
|
||||||
}
|
}
|
||||||
|
|
||||||
FatCompleteRequest( IrpContext, Irp, ExceptionCode );
|
FatCompleteRequest( IrpContext, Irp, ExceptionCode );
|
||||||
|
|
||||||
return 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.
|
// 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.
|
// 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
|
// For FSCTLs, IrpContext->Vcb may not be populated, so get the IrpContext->RealDevice instead
|
||||||
//
|
//
|
||||||
|
|
||||||
Device = IrpContext->RealDevice;
|
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.
|
// 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.
|
// 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
|
// For FSCTLs, IrpContext->Vcb may not be populated, so get the IrpContext->RealDevice instead
|
||||||
//
|
//
|
||||||
|
|
||||||
RealDevice = IrpContext->RealDevice;
|
RealDevice = IrpContext->RealDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -706,14 +706,14 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
FatAcquireExclusiveVcbNoOpCheck( IrpContext, Vcb);
|
FatAcquireExclusiveVcbNoOpCheck( IrpContext, Vcb);
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
if (VcbGood == Vcb->VcbCondition) {
|
if (VcbGood == Vcb->VcbCondition) {
|
||||||
|
|
||||||
FatMarkVolume( IrpContext, Vcb, TransitionState );
|
FatMarkVolume( IrpContext, Vcb, TransitionState );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT( FatExceptionFilter( IrpContext, _SEH2_GetExceptionInformation() ) ) {
|
_SEH2_EXCEPT( FatExceptionFilter( IrpContext, _SEH2_GetExceptionInformation() ) ) {
|
||||||
|
|
||||||
NOTHING;
|
NOTHING;
|
||||||
@@ -761,7 +761,7 @@ Return Value:
|
|||||||
if ( (FatBreakOnInterestingIrpCompletion != 0) && (Status == FatBreakOnInterestingIrpCompletion) ) {
|
if ( (FatBreakOnInterestingIrpCompletion != 0) && (Status == FatBreakOnInterestingIrpCompletion) ) {
|
||||||
DbgBreakPoint();
|
DbgBreakPoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -854,7 +854,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Function_class_(FAST_IO_CHECK_IF_POSSIBLE)
|
_Function_class_(FAST_IO_CHECK_IF_POSSIBLE)
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
FatFastIoCheckIfPossible (
|
FatFastIoCheckIfPossible (
|
||||||
@@ -963,7 +963,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Function_class_(FAST_IO_QUERY_BASIC_INFO)
|
_Function_class_(FAST_IO_QUERY_BASIC_INFO)
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
FatFastQueryBasicInfo (
|
FatFastQueryBasicInfo (
|
||||||
@@ -1010,7 +1010,7 @@ Return Value:
|
|||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
UNREFERENCED_PARAMETER( DeviceObject );
|
UNREFERENCED_PARAMETER( DeviceObject );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Prepare the dummy irp context
|
// 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
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
FatFastQueryStdInfo (
|
FatFastQueryStdInfo (
|
||||||
@@ -1191,7 +1191,7 @@ Return Value:
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( DeviceObject );
|
UNREFERENCED_PARAMETER( DeviceObject );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Prepare the dummy irp context
|
// Prepare the dummy irp context
|
||||||
//
|
//
|
||||||
@@ -1302,7 +1302,7 @@ Return Value:
|
|||||||
|
|
||||||
return Results;
|
return Results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Function_class_(FAST_IO_QUERY_NETWORK_OPEN_INFO)
|
_Function_class_(FAST_IO_QUERY_NETWORK_OPEN_INFO)
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
@@ -1350,9 +1350,9 @@ Return Value:
|
|||||||
BOOLEAN FcbAcquired = FALSE;
|
BOOLEAN FcbAcquired = FALSE;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( DeviceObject );
|
UNREFERENCED_PARAMETER( DeviceObject );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Prepare the dummy irp context
|
// Prepare the dummy irp context
|
||||||
//
|
//
|
||||||
@@ -1502,8 +1502,8 @@ Return Value:
|
|||||||
|
|
||||||
return Results;
|
return Results;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatPopUpFileCorrupt (
|
FatPopUpFileCorrupt (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ FatIsFujitsuFMR (
|
|||||||
#define FUJITSU_FMR_NAME_W L"FUJITSU FMR-"
|
#define FUJITSU_FMR_NAME_W L"FUJITSU FMR-"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
DriverEntry(
|
DriverEntry(
|
||||||
@@ -201,7 +201,7 @@ Return Value:
|
|||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma prefast( pop )
|
#pragma prefast( pop )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize the filter callbacks we use.
|
// Initialize the filter callbacks we use.
|
||||||
//
|
//
|
||||||
@@ -247,7 +247,7 @@ Return Value:
|
|||||||
|
|
||||||
InitializeListHead( &FatData.AsyncCloseList );
|
InitializeListHead( &FatData.AsyncCloseList );
|
||||||
InitializeListHead( &FatData.DelayedCloseList );
|
InitializeListHead( &FatData.DelayedCloseList );
|
||||||
|
|
||||||
FatData.FatCloseItem = IoAllocateWorkItem( FatDiskFileSystemDeviceObject);
|
FatData.FatCloseItem = IoAllocateWorkItem( FatDiskFileSystemDeviceObject);
|
||||||
|
|
||||||
if (FatData.FatCloseItem == NULL) {
|
if (FatData.FatCloseItem == NULL) {
|
||||||
@@ -263,7 +263,7 @@ Return Value:
|
|||||||
FatData.ZeroPage = ExAllocatePoolWithTag( NonPagedPoolNx, PAGE_SIZE, 'ZtaF' );
|
FatData.ZeroPage = ExAllocatePoolWithTag( NonPagedPoolNx, PAGE_SIZE, 'ZtaF' );
|
||||||
if (FatData.ZeroPage == NULL) {
|
if (FatData.ZeroPage == NULL) {
|
||||||
IoDeleteDevice (FatDiskFileSystemDeviceObject);
|
IoDeleteDevice (FatDiskFileSystemDeviceObject);
|
||||||
IoDeleteDevice (FatCdromFileSystemDeviceObject);
|
IoDeleteDevice (FatCdromFileSystemDeviceObject);
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
RtlZeroMemory( FatData.ZeroPage, PAGE_SIZE );
|
RtlZeroMemory( FatData.ZeroPage, PAGE_SIZE );
|
||||||
@@ -293,7 +293,7 @@ Return Value:
|
|||||||
|
|
||||||
case MmLargeSystem:
|
case MmLargeSystem:
|
||||||
default:
|
default:
|
||||||
|
|
||||||
MaxDepth = 16;
|
MaxDepth = 16;
|
||||||
FatMaxDelayedCloseCount = 16 * FAT_MAX_DELAYED_CLOSES;
|
FatMaxDelayedCloseCount = 16 * FAT_MAX_DELAYED_CLOSES;
|
||||||
break;
|
break;
|
||||||
@@ -320,8 +320,8 @@ Return Value:
|
|||||||
|
|
||||||
FatData.OurProcess = PsGetCurrentProcess();
|
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.
|
// running.
|
||||||
//
|
//
|
||||||
|
|
||||||
@@ -438,7 +438,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Function_class_(DRIVER_UNLOAD)
|
_Function_class_(DRIVER_UNLOAD)
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
FatUnload(
|
FatUnload(
|
||||||
@@ -474,7 +474,7 @@ Return Value:
|
|||||||
ObDereferenceObject( FatCdromFileSystemDeviceObject);
|
ObDereferenceObject( FatCdromFileSystemDeviceObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local Support routine
|
// Local Support routine
|
||||||
//
|
//
|
||||||
@@ -615,7 +615,7 @@ Return Value:
|
|||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local Support routine
|
// Local Support routine
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ typedef PVOID PBCB; //**** Bcb's are now part of the cache module
|
|||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
#define __volatile volatile
|
#define __volatile volatile
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// The FAT_DATA record is the top record in the Fat file system in-memory
|
// 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.
|
// 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;
|
typedef FILE_SYSTEM_STATISTICS *PFILE_SYSTEM_STATISTICS;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Volume Device Object is an I/O system device object with a workqueue
|
// 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
|
// 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;
|
typedef VOLUME_DEVICE_OBJECT *PVOLUME_DEVICE_OBJECT;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// This is the structure used to contains the short name for a file
|
// 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)
|
#define FCB_LOOKUP_ALLOCATIONSIZE_HINT ((LONGLONG) -1)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Ccb record is allocated for every file object. Note that this
|
// 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
|
// 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;
|
ULONG Flags:24;
|
||||||
BOOLEAN ContainsWildCards;
|
BOOLEAN ContainsWildCards;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Pointer to EDP context.
|
// Pointer to EDP context.
|
||||||
//
|
//
|
||||||
@@ -1447,7 +1447,7 @@ typedef struct _CCB {
|
|||||||
|
|
||||||
} CCB;
|
} CCB;
|
||||||
typedef CCB *PCCB;
|
typedef CCB *PCCB;
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Irp Context record is allocated for every orginating Irp. It is
|
// The Irp Context record is allocated for every orginating Irp. It is
|
||||||
// created by the Fsd dispatch routines, and deallocated by the FatComplete
|
// 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)
|
#define IRP_CONTEXT_FLAG_PARENT_BY_CHILD (0x80000000)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Context structure for non-cached I/O calls. Most of these fields
|
// Context structure for non-cached I/O calls. Most of these fields
|
||||||
// are actually only required for the Read/Write Multiple routines, but
|
// 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
|
// A copy of the IrpContext flags preserved for use in
|
||||||
// async I/O completion.
|
// async I/O completion.
|
||||||
//
|
//
|
||||||
|
|
||||||
ULONG IrpContextFlags;
|
ULONG IrpContextFlags;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Function_class_(IRP_MJ_SET_INFORMATION)
|
_Function_class_(IRP_MJ_SET_INFORMATION)
|
||||||
_Function_class_(DRIVER_DISPATCH)
|
_Function_class_(DRIVER_DISPATCH)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
@@ -357,8 +357,8 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FatCommonQueryInformation (
|
FatCommonQueryInformation (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -494,8 +494,8 @@ Return Value:
|
|||||||
// relies on the file system to validate its mapping information after a
|
// relies on the file system to validate its mapping information after a
|
||||||
// power transition.
|
// 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)) {
|
FlagOn(Fcb->Vcb->VcbState, VCB_STATE_FLAG_REMOVABLE_MEDIA)) {
|
||||||
|
|
||||||
if (!FatAcquireSharedFcb( IrpContext, Fcb )) {
|
if (!FatAcquireSharedFcb( IrpContext, Fcb )) {
|
||||||
@@ -657,8 +657,8 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FatCommonSetInformation (
|
FatCommonSetInformation (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -826,7 +826,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
|
|
||||||
if (FlagOn( Vcb->VcbState, VCB_STATE_FLAG_CREATE_IN_PROGRESS)) {
|
if (FlagOn( Vcb->VcbState, VCB_STATE_FLAG_CREATE_IN_PROGRESS)) {
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#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
|
#endif
|
||||||
@@ -850,7 +850,7 @@ Return Value:
|
|||||||
// power transition.
|
// 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)) {
|
FlagOn(Fcb->Vcb->VcbState, VCB_STATE_FLAG_REMOVABLE_MEDIA)) {
|
||||||
|
|
||||||
if (!FatAcquireExclusiveFcb( IrpContext, Fcb )) {
|
if (!FatAcquireExclusiveFcb( IrpContext, Fcb )) {
|
||||||
@@ -908,14 +908,14 @@ Return Value:
|
|||||||
Irp = NULL;
|
Irp = NULL;
|
||||||
IrpContext = NULL;
|
IrpContext = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!NT_SUCCESS( Status ) ||
|
if (!NT_SUCCESS( Status ) ||
|
||||||
(Status == STATUS_PENDING)) {
|
(Status == STATUS_PENDING)) {
|
||||||
|
|
||||||
try_return( Status );
|
try_return( Status );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Based on the information class we'll do different
|
// Based on the information class we'll do different
|
||||||
// actions. Each of the procedures that we're calling will either
|
// actions. Each of the procedures that we're calling will either
|
||||||
@@ -1021,7 +1021,7 @@ Return Value:
|
|||||||
DebugUnwind( FatCommonSetInformation );
|
DebugUnwind( FatCommonSetInformation );
|
||||||
|
|
||||||
if (FcbAcquired) { FatReleaseFcb( IrpContext, Fcb ); }
|
if (FcbAcquired) { FatReleaseFcb( IrpContext, Fcb ); }
|
||||||
|
|
||||||
if (VcbAcquired) { FatReleaseVcb( IrpContext, Vcb ); }
|
if (VcbAcquired) { FatReleaseVcb( IrpContext, Vcb ); }
|
||||||
|
|
||||||
if (!_SEH2_AbnormalTermination()) {
|
if (!_SEH2_AbnormalTermination()) {
|
||||||
@@ -1035,7 +1035,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal Support Routine
|
// Internal Support Routine
|
||||||
//
|
//
|
||||||
@@ -1077,7 +1077,7 @@ Return Value:
|
|||||||
|
|
||||||
UNREFERENCED_PARAMETER( FileObject );
|
UNREFERENCED_PARAMETER( FileObject );
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
DebugTrace(+1, Dbg, "FatQueryBasicInfo...\n", 0);
|
DebugTrace(+1, Dbg, "FatQueryBasicInfo...\n", 0);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1114,7 +1114,7 @@ Return Value:
|
|||||||
|
|
||||||
Buffer->FileAttributes = Fcb->DirentFatFlags;
|
Buffer->FileAttributes = Fcb->DirentFatFlags;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// If the temporary flag is set, then set it in the buffer.
|
// If the temporary flag is set, then set it in the buffer.
|
||||||
//
|
//
|
||||||
@@ -1146,7 +1146,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal Support Routine
|
// Internal Support Routine
|
||||||
//
|
//
|
||||||
@@ -1233,7 +1233,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal Support Routine
|
// Internal Support Routine
|
||||||
//
|
//
|
||||||
@@ -1272,7 +1272,7 @@ Return Value:
|
|||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
DebugTrace(+1, Dbg, "FatQueryInternalInfo...\n", 0);
|
DebugTrace(+1, Dbg, "FatQueryInternalInfo...\n", 0);
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
@@ -1297,7 +1297,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal Support Routine
|
// Internal Support Routine
|
||||||
//
|
//
|
||||||
@@ -1339,7 +1339,7 @@ Return Value:
|
|||||||
|
|
||||||
UNREFERENCED_PARAMETER( Fcb );
|
UNREFERENCED_PARAMETER( Fcb );
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
DebugTrace(+1, Dbg, "FatQueryEaInfo...\n", 0);
|
DebugTrace(+1, Dbg, "FatQueryEaInfo...\n", 0);
|
||||||
|
|
||||||
Bcb = NULL;
|
Bcb = NULL;
|
||||||
@@ -1408,7 +1408,7 @@ Return Value:
|
|||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal Support Routine
|
// Internal Support Routine
|
||||||
//
|
//
|
||||||
@@ -1469,7 +1469,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal Support Routine
|
// Internal Support Routine
|
||||||
//
|
//
|
||||||
@@ -1677,7 +1677,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal Support Routine
|
// Internal Support Routine
|
||||||
//
|
//
|
||||||
@@ -1776,7 +1776,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal Support Routine
|
// Internal Support Routine
|
||||||
//
|
//
|
||||||
@@ -1816,8 +1816,8 @@ Return Value:
|
|||||||
|
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( FileObject );
|
UNREFERENCED_PARAMETER( FileObject );
|
||||||
|
|
||||||
DebugTrace(+1, Dbg, "FatQueryNetworkInfo...\n", 0);
|
DebugTrace(+1, Dbg, "FatQueryNetworkInfo...\n", 0);
|
||||||
|
|
||||||
@@ -1855,7 +1855,7 @@ Return Value:
|
|||||||
|
|
||||||
Buffer->FileAttributes = Fcb->DirentFatFlags;
|
Buffer->FileAttributes = Fcb->DirentFatFlags;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// If the temporary flag is set, then set it in the buffer.
|
// If the temporary flag is set, then set it in the buffer.
|
||||||
//
|
//
|
||||||
@@ -1903,7 +1903,7 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal Support routine
|
// Internal Support routine
|
||||||
//
|
//
|
||||||
@@ -2423,7 +2423,7 @@ Return Value:
|
|||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal Support Routine
|
// Internal Support Routine
|
||||||
//
|
//
|
||||||
@@ -2685,7 +2685,7 @@ Return Value:
|
|||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal Support Routine
|
// Internal Support Routine
|
||||||
//
|
//
|
||||||
@@ -2784,11 +2784,11 @@ Return Value:
|
|||||||
ULONG TargetDirentOffset = 0;
|
ULONG TargetDirentOffset = 0;
|
||||||
ULONG TargetLfnOffset = 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.
|
// go around modifying it. Instead we modify NewNameCopy.
|
||||||
UNICODE_STRING NewName;
|
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.
|
// from one chopped up pool allocation called UnicodeBuffer.
|
||||||
UNICODE_STRING NewNameCopy;
|
UNICODE_STRING NewNameCopy;
|
||||||
UNICODE_STRING NewUpcasedName;
|
UNICODE_STRING NewUpcasedName;
|
||||||
@@ -2803,7 +2803,7 @@ Return Value:
|
|||||||
WCHAR UniTunneledShortNameBuffer[12];
|
WCHAR UniTunneledShortNameBuffer[12];
|
||||||
UNICODE_STRING UniTunneledLongName;
|
UNICODE_STRING UniTunneledLongName;
|
||||||
WCHAR UniTunneledLongNameBuffer[26];
|
WCHAR UniTunneledLongNameBuffer[26];
|
||||||
|
|
||||||
LARGE_INTEGER TunneledCreationTime;
|
LARGE_INTEGER TunneledCreationTime;
|
||||||
ULONG TunneledDataSize;
|
ULONG TunneledDataSize;
|
||||||
BOOLEAN HaveTunneledInformation = FALSE;
|
BOOLEAN HaveTunneledInformation = FALSE;
|
||||||
@@ -2874,7 +2874,7 @@ Return Value:
|
|||||||
UniTunneledLongName.Length = 0;
|
UniTunneledLongName.Length = 0;
|
||||||
UniTunneledLongName.MaximumLength = sizeof(UniTunneledLongNameBuffer);
|
UniTunneledLongName.MaximumLength = sizeof(UniTunneledLongNameBuffer);
|
||||||
UniTunneledLongName.Buffer = &UniTunneledLongNameBuffer[0];
|
UniTunneledLongName.Buffer = &UniTunneledLongNameBuffer[0];
|
||||||
|
|
||||||
//
|
//
|
||||||
// Remember the name in case we have to modify the name
|
// Remember the name in case we have to modify the name
|
||||||
// value in the ea.
|
// value in the ea.
|
||||||
@@ -2960,7 +2960,7 @@ Return Value:
|
|||||||
if (FatIsFileOplockable( TempFcb ) &&
|
if (FatIsFileOplockable( TempFcb ) &&
|
||||||
(FsRtlCurrentBatchOplock( FatGetFcbOplock(TempFcb) )
|
(FsRtlCurrentBatchOplock( FatGetFcbOplock(TempFcb) )
|
||||||
#if (NTDDI_VERSION >= NTDDI_WIN7)
|
#if (NTDDI_VERSION >= NTDDI_WIN7)
|
||||||
||
|
||
|
||||||
FsRtlCurrentOplockH( FatGetFcbOplock(TempFcb) )
|
FsRtlCurrentOplockH( FatGetFcbOplock(TempFcb) )
|
||||||
#endif
|
#endif
|
||||||
)) {
|
)) {
|
||||||
@@ -3114,9 +3114,9 @@ Return Value:
|
|||||||
NewName = *((PUNICODE_STRING)&TargetFileObject->FileName);
|
NewName = *((PUNICODE_STRING)&TargetFileObject->FileName);
|
||||||
|
|
||||||
RtlCopyUnicodeString(&NewNameCopy,&NewName);
|
RtlCopyUnicodeString(&NewNameCopy,&NewName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// We will need an upcased version of the unicode name and the
|
// We will need an upcased version of the unicode name and the
|
||||||
// old name as well.
|
// old name as well.
|
||||||
@@ -3175,7 +3175,7 @@ Return Value:
|
|||||||
|
|
||||||
RenamedAcrossDirectories = TRUE;
|
RenamedAcrossDirectories = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Upcase the name and convert it to the Oem code page.
|
// Upcase the name and convert it to the Oem code page.
|
||||||
//
|
//
|
||||||
@@ -3254,7 +3254,7 @@ Return Value:
|
|||||||
|
|
||||||
DirentsRequired = 1;
|
DirentsRequired = 1;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3451,7 +3451,7 @@ Return Value:
|
|||||||
|
|
||||||
ExFreePool( UnicodeBuffer );
|
ExFreePool( UnicodeBuffer );
|
||||||
FatUnpinBcb( IrpContext, TargetDirentBcb );
|
FatUnpinBcb( IrpContext, TargetDirentBcb );
|
||||||
|
|
||||||
}
|
}
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
|
|
||||||
@@ -3757,7 +3757,7 @@ Return Value:
|
|||||||
// breaks are always advisory, so we will never block/get STATUS_PENDING
|
// breaks are always advisory, so we will never block/get STATUS_PENDING
|
||||||
// here.
|
// here.
|
||||||
//
|
//
|
||||||
|
|
||||||
FsRtlCheckOplockEx( FatGetFcbOplock(OldParentDcb),
|
FsRtlCheckOplockEx( FatGetFcbOplock(OldParentDcb),
|
||||||
IrpContext->OriginatingIrp,
|
IrpContext->OriginatingIrp,
|
||||||
OPLOCK_FLAG_PARENT_OBJECT,
|
OPLOCK_FLAG_PARENT_OBJECT,
|
||||||
@@ -3778,7 +3778,7 @@ Return Value:
|
|||||||
// breaks are always advisory, so we will never block/get STATUS_PENDING
|
// breaks are always advisory, so we will never block/get STATUS_PENDING
|
||||||
// here.
|
// here.
|
||||||
//
|
//
|
||||||
|
|
||||||
FsRtlCheckOplockEx( FatGetFcbOplock(TargetDcb),
|
FsRtlCheckOplockEx( FatGetFcbOplock(TargetDcb),
|
||||||
IrpContext->OriginatingIrp,
|
IrpContext->OriginatingIrp,
|
||||||
OPLOCK_FLAG_PARENT_OBJECT,
|
OPLOCK_FLAG_PARENT_OBJECT,
|
||||||
@@ -3980,7 +3980,7 @@ Return Value:
|
|||||||
DebugTrace(0, Dbg, "Uninitialize our parent Stream Cache Map\n", 0);
|
DebugTrace(0, Dbg, "Uninitialize our parent Stream Cache Map\n", 0);
|
||||||
|
|
||||||
CcUninitializeCacheMap( DirectoryFileObject, NULL, NULL );
|
CcUninitializeCacheMap( DirectoryFileObject, NULL, NULL );
|
||||||
|
|
||||||
ObDereferenceObject( DirectoryFileObject );
|
ObDereferenceObject( DirectoryFileObject );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4001,7 +4001,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal Support Routine
|
// Internal Support Routine
|
||||||
//
|
//
|
||||||
@@ -4079,7 +4079,7 @@ Return Value:
|
|||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal Support Routine
|
// Internal Support Routine
|
||||||
//
|
//
|
||||||
@@ -4377,7 +4377,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal Support Routine
|
// Internal Support Routine
|
||||||
//
|
//
|
||||||
@@ -4563,9 +4563,9 @@ Return Value:
|
|||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
|
|
||||||
if ( NewFileSize > Dirent->FileSize ) {
|
if ( NewFileSize > Dirent->FileSize ) {
|
||||||
Dirent->FileSize = NewFileSize;
|
Dirent->FileSize = NewFileSize;
|
||||||
|
|
||||||
FatSetDirtyBcb( IrpContext, DirentBcb, Fcb->Vcb, TRUE );
|
FatSetDirtyBcb( IrpContext, DirentBcb, Fcb->Vcb, TRUE );
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -4739,7 +4739,7 @@ Return Value:
|
|||||||
|
|
||||||
*CcGetFileSizePointer(FileObject) = Fcb->Header.FileSize;
|
*CcGetFileSizePointer(FileObject) = Fcb->Header.FileSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// WinSE bug #307418 "Occasional data corruption when
|
// WinSE bug #307418 "Occasional data corruption when
|
||||||
// standby/resume while copying files to removable FAT
|
// 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
|
// we'll also try to un-roll the change to Dirent to keep
|
||||||
// in-memory and on-disk metadata in sync.
|
// in-memory and on-disk metadata in sync.
|
||||||
//
|
//
|
||||||
|
|
||||||
FatSetFileSizeInDirentNoRaise( IrpContext, Fcb, NULL );
|
FatSetFileSizeInDirentNoRaise( IrpContext, Fcb, NULL );
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4836,7 +4836,7 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// User must have manage volume privilege to explicitly tweak the VDL
|
// User must have manage volume privilege to explicitly tweak the VDL
|
||||||
//
|
//
|
||||||
|
|
||||||
if ((Ccb == NULL) || !FlagOn( Ccb->Flags, CCB_FLAG_MANAGE_VOLUME_ACCESS )) {
|
if ((Ccb == NULL) || !FlagOn( Ccb->Flags, CCB_FLAG_MANAGE_VOLUME_ACCESS )) {
|
||||||
|
|
||||||
try_return( Status = STATUS_INVALID_PARAMETER );
|
try_return( Status = STATUS_INVALID_PARAMETER );
|
||||||
@@ -4874,7 +4874,7 @@ Return Value:
|
|||||||
|
|
||||||
if ((NewValidDataLength < Fcb->Header.ValidDataLength.LowPart) ||
|
if ((NewValidDataLength < Fcb->Header.ValidDataLength.LowPart) ||
|
||||||
(NewValidDataLength > Fcb->Header.FileSize.LowPart)) {
|
(NewValidDataLength > Fcb->Header.FileSize.LowPart)) {
|
||||||
|
|
||||||
try_return( Status = STATUS_INVALID_PARAMETER );
|
try_return( Status = STATUS_INVALID_PARAMETER );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4962,7 +4962,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal Support Routine
|
// Internal Support Routine
|
||||||
@@ -5117,7 +5117,7 @@ FatDeleteFile (
|
|||||||
NT_ASSERT( Fcb->LfnOffsetWithinDirectory == LfnOffset );
|
NT_ASSERT( Fcb->LfnOffsetWithinDirectory == LfnOffset );
|
||||||
|
|
||||||
if ( Fcb->UncleanCount != 0 ) {
|
if ( Fcb->UncleanCount != 0 ) {
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#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
|
#endif
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ Abstract:
|
|||||||
#pragma alloc_text(PAGE, FatDecodeFileObject)
|
#pragma alloc_text(PAGE, FatDecodeFileObject)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatSetFileObject (
|
FatSetFileObject (
|
||||||
IN PFILE_OBJECT FileObject OPTIONAL,
|
IN PFILE_OBJECT FileObject OPTIONAL,
|
||||||
@@ -292,10 +292,10 @@ Return Value:
|
|||||||
*Vcb = (*FcbOrDcb)->Vcb;
|
*Vcb = (*FcbOrDcb)->Vcb;
|
||||||
|
|
||||||
if (*Ccb != NULL ) {
|
if (*Ccb != NULL ) {
|
||||||
|
|
||||||
TypeOfOpen = UserFileOpen;
|
TypeOfOpen = UserFileOpen;
|
||||||
DebugTrace(0, Dbg, "Referencing file: %wZ\n", &(*FcbOrDcb)->FullFileName);
|
DebugTrace(0, Dbg, "Referencing file: %wZ\n", &(*FcbOrDcb)->FullFileName);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -304,16 +304,16 @@ Return Value:
|
|||||||
|
|
||||||
|
|
||||||
if ( *FcbOrDcb == (*Vcb)->EaFcb ) {
|
if ( *FcbOrDcb == (*Vcb)->EaFcb ) {
|
||||||
|
|
||||||
TypeOfOpen = EaFile;
|
TypeOfOpen = EaFile;
|
||||||
DebugTrace(0, Dbg, "Referencing EA file: %wZ\n", &(*FcbOrDcb)->FullFileName);
|
DebugTrace(0, Dbg, "Referencing EA file: %wZ\n", &(*FcbOrDcb)->FullFileName);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#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
|
#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
|
Fcb - Supplies a pointer to either an fcb or a dcb
|
||||||
|
|
||||||
FlushType - Specifies the kind of flushing to perform
|
FlushType - Specifies the kind of flushing to perform
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
|
|
||||||
None.
|
None.
|
||||||
@@ -417,8 +417,8 @@ Return Value:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
FatForceCacheMiss (
|
FatForceCacheMiss (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -443,7 +443,7 @@ Arguments:
|
|||||||
Fcb - Supplies a pointer to an fcb
|
Fcb - Supplies a pointer to an fcb
|
||||||
|
|
||||||
FlushType - Specifies the kind of flushing to perform
|
FlushType - Specifies the kind of flushing to perform
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
|
|
||||||
None.
|
None.
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ FatHijackCompletionRoutine (
|
|||||||
|
|
||||||
|
|
||||||
_Function_class_(IRP_MJ_FLUSH_BUFFERS)
|
_Function_class_(IRP_MJ_FLUSH_BUFFERS)
|
||||||
_Function_class_(DRIVER_DISPATCH)
|
_Function_class_(DRIVER_DISPATCH)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
FatFsdFlushBuffers (
|
FatFsdFlushBuffers (
|
||||||
@@ -144,8 +144,8 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FatCommonFlushBuffers (
|
FatCommonFlushBuffers (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -280,7 +280,7 @@ Return Value:
|
|||||||
Status = FatFlushFile( IrpContext, Fcb, Flush );
|
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.
|
// flush worked.
|
||||||
//
|
//
|
||||||
|
|
||||||
@@ -312,11 +312,11 @@ Return Value:
|
|||||||
//
|
//
|
||||||
// Make sure the Fcb is OK.
|
// Make sure the Fcb is OK.
|
||||||
//
|
//
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
FatVerifyFcb( IrpContext, NextFcb );
|
FatVerifyFcb( IrpContext, NextFcb );
|
||||||
|
|
||||||
} _SEH2_EXCEPT( FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ?
|
} _SEH2_EXCEPT( FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ?
|
||||||
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {
|
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {
|
||||||
|
|
||||||
@@ -326,16 +326,16 @@ Return Value:
|
|||||||
if (NextFcb->FcbCondition == FcbGood) {
|
if (NextFcb->FcbCondition == FcbGood) {
|
||||||
|
|
||||||
NTSTATUS LocalStatus;
|
NTSTATUS LocalStatus;
|
||||||
|
|
||||||
LocalStatus = FatFlushFile( IrpContext, NextFcb, Flush );
|
LocalStatus = FatFlushFile( IrpContext, NextFcb, Flush );
|
||||||
|
|
||||||
if (!NT_SUCCESS(LocalStatus)) {
|
if (!NT_SUCCESS(LocalStatus)) {
|
||||||
|
|
||||||
Status = LocalStatus;
|
Status = LocalStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FlagOn(NextFcb->FcbState, FCB_STATE_FLUSH_FAT)) {
|
if (FlagOn(NextFcb->FcbState, FCB_STATE_FLUSH_FAT)) {
|
||||||
|
|
||||||
FatFlushRequired = TRUE;
|
FatFlushRequired = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -389,8 +389,8 @@ Return Value:
|
|||||||
{
|
{
|
||||||
BOOLEAN Finished;
|
BOOLEAN Finished;
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma prefast( suppress:28931, "needed for debug build" )
|
#pragma prefast( suppress:28931, "needed for debug build" )
|
||||||
#endif
|
#endif
|
||||||
Finished = FatAcquireExclusiveVcb( IrpContext, Vcb );
|
Finished = FatAcquireExclusiveVcb( IrpContext, Vcb );
|
||||||
NT_ASSERT( Finished );
|
NT_ASSERT( Finished );
|
||||||
}
|
}
|
||||||
@@ -442,7 +442,7 @@ Return Value:
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#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
|
#endif
|
||||||
@@ -456,7 +456,7 @@ Return Value:
|
|||||||
DebugUnwind( FatCommonFlushBuffers );
|
DebugUnwind( FatCommonFlushBuffers );
|
||||||
|
|
||||||
if (VcbAcquired) { FatReleaseVcb( IrpContext, Vcb ); }
|
if (VcbAcquired) { FatReleaseVcb( IrpContext, Vcb ); }
|
||||||
|
|
||||||
if (FcbAcquired) { FatReleaseFcb( IrpContext, Fcb ); }
|
if (FcbAcquired) { FatReleaseFcb( IrpContext, Fcb ); }
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -496,7 +496,7 @@ Return Value:
|
|||||||
|
|
||||||
DriverStatus = IoCallDriver(Vcb->TargetDeviceObject, Irp);
|
DriverStatus = IoCallDriver(Vcb->TargetDeviceObject, Irp);
|
||||||
|
|
||||||
if ((DriverStatus == STATUS_PENDING) ||
|
if ((DriverStatus == STATUS_PENDING) ||
|
||||||
(!NT_SUCCESS(DriverStatus) &&
|
(!NT_SUCCESS(DriverStatus) &&
|
||||||
(DriverStatus != STATUS_INVALID_DEVICE_REQUEST))) {
|
(DriverStatus != STATUS_INVALID_DEVICE_REQUEST))) {
|
||||||
|
|
||||||
@@ -523,8 +523,8 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FatFlushDirectory (
|
FatFlushDirectory (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -543,7 +543,7 @@ Arguments:
|
|||||||
Dcb - Supplies the Dcb being flushed
|
Dcb - Supplies the Dcb being flushed
|
||||||
|
|
||||||
FlushType - Specifies the kind of flushing to perform
|
FlushType - Specifies the kind of flushing to perform
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
@@ -612,44 +612,44 @@ Return Value:
|
|||||||
// doing the flush dance. We may encounter corruption, and
|
// doing the flush dance. We may encounter corruption, and
|
||||||
// should continue flushing the volume as much as possible.
|
// should continue flushing the volume as much as possible.
|
||||||
//
|
//
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Standard handler to release resources, etc.
|
// Standard handler to release resources, etc.
|
||||||
//
|
//
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Make sure the Fcb is OK.
|
// Make sure the Fcb is OK.
|
||||||
//
|
//
|
||||||
|
|
||||||
_SEH2_TRY {
|
_SEH2_TRY {
|
||||||
|
|
||||||
FatVerifyFcb( IrpContext, Fcb );
|
FatVerifyFcb( IrpContext, Fcb );
|
||||||
|
|
||||||
} _SEH2_EXCEPT( FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ?
|
} _SEH2_EXCEPT( FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ?
|
||||||
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {
|
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {
|
||||||
|
|
||||||
FatResetExceptionState( IrpContext );
|
FatResetExceptionState( IrpContext );
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
|
|
||||||
//
|
//
|
||||||
// If this Fcb is not good skip it. Note that a 'continue'
|
// If this Fcb is not good skip it. Note that a 'continue'
|
||||||
// here would be very expensive as we inside a try{} body.
|
// here would be very expensive as we inside a try{} body.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (Fcb->FcbCondition != FcbGood) {
|
if (Fcb->FcbCondition != FcbGood) {
|
||||||
|
|
||||||
try_leave( NOTHING);
|
try_leave( NOTHING);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// In case a handle was never closed and the FS and AS are more
|
// In case a handle was never closed and the FS and AS are more
|
||||||
// than a cluster different, do this truncate.
|
// than a cluster different, do this truncate.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ( FlagOn(Fcb->FcbState, FCB_STATE_TRUNCATE_ON_CLOSE) ) {
|
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
|
// Also compare the file's dirent in the parent directory
|
||||||
// with the size information in the Fcb and update
|
// 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
|
// because we will be flushing the file object presently, and
|
||||||
// Mm knows what's really dirty.
|
// Mm knows what's really dirty.
|
||||||
//
|
//
|
||||||
|
|
||||||
FatGetDirentFromFcbOrDcb( IrpContext,
|
FatGetDirentFromFcbOrDcb( IrpContext,
|
||||||
Fcb,
|
Fcb,
|
||||||
FALSE,
|
FALSE,
|
||||||
@@ -675,14 +675,14 @@ Return Value:
|
|||||||
&DirentBcb );
|
&DirentBcb );
|
||||||
|
|
||||||
|
|
||||||
CorrectedFileSize = Fcb->Header.FileSize.LowPart;
|
CorrectedFileSize = Fcb->Header.FileSize.LowPart;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (Dirent->FileSize != CorrectedFileSize) {
|
if (Dirent->FileSize != CorrectedFileSize) {
|
||||||
|
|
||||||
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
|
// more children as a result, we will try to initiate teardown on it
|
||||||
// and Cc will deadlock against the active count of this Bcb.
|
// and Cc will deadlock against the active count of this Bcb.
|
||||||
//
|
//
|
||||||
|
|
||||||
FatUnpinBcb( IrpContext, DirentBcb );
|
FatUnpinBcb( IrpContext, DirentBcb );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Now flush the file. Note that this may make the Fcb
|
// Now flush the file. Note that this may make the Fcb
|
||||||
// go away if Mm dereferences its file object.
|
// go away if Mm dereferences its file object.
|
||||||
//
|
//
|
||||||
|
|
||||||
Status = FatFlushFile( IrpContext, Fcb, FlushType );
|
Status = FatFlushFile( IrpContext, Fcb, FlushType );
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status)) {
|
if (!NT_SUCCESS(Status)) {
|
||||||
|
|
||||||
ReturnStatus = Status;
|
ReturnStatus = Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
} _SEH2_FINALLY {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
FatUnpinBcb( IrpContext, DirentBcb );
|
FatUnpinBcb( IrpContext, DirentBcb );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Since we have the Vcb exclusive we know that if any closes
|
// Since we have the Vcb exclusive we know that if any closes
|
||||||
// come in it is because the CcPurgeCacheSection caused the
|
// come in it is because the CcPurgeCacheSection caused the
|
||||||
// Fcb to go away.
|
// Fcb to go away.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ( !FlagOn(Vcb->VcbState, VCB_STATE_FLAG_DELETED_FCB) ) {
|
if ( !FlagOn(Vcb->VcbState, VCB_STATE_FLAG_DELETED_FCB) ) {
|
||||||
|
|
||||||
FatReleaseFcb( (IRPCONTEXT), Fcb );
|
FatReleaseFcb( (IRPCONTEXT), Fcb );
|
||||||
}
|
}
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
@@ -796,7 +796,7 @@ Return Value:
|
|||||||
return ReturnStatus;
|
return ReturnStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FatFlushFat (
|
FatFlushFat (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -814,7 +814,7 @@ Routine Description:
|
|||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Vcb - Supplies the Vcb whose FAT is being flushed
|
Vcb - Supplies the Vcb whose FAT is being flushed
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
@@ -902,7 +902,7 @@ Return Value:
|
|||||||
PIN_WAIT | PIN_IF_BCB,
|
PIN_WAIT | PIN_IF_BCB,
|
||||||
&Bcb,
|
&Bcb,
|
||||||
&DontCare )) {
|
&DontCare )) {
|
||||||
|
|
||||||
CcSetDirtyPinnedData( Bcb, NULL );
|
CcSetDirtyPinnedData( Bcb, NULL );
|
||||||
CcRepinBcb( Bcb );
|
CcRepinBcb( Bcb );
|
||||||
CcUnpinData( Bcb );
|
CcUnpinData( Bcb );
|
||||||
@@ -937,7 +937,7 @@ Return Value:
|
|||||||
PIN_WAIT | PIN_IF_BCB,
|
PIN_WAIT | PIN_IF_BCB,
|
||||||
&Bcb,
|
&Bcb,
|
||||||
&DontCare )) {
|
&DontCare )) {
|
||||||
|
|
||||||
CcSetDirtyPinnedData( Bcb, NULL );
|
CcSetDirtyPinnedData( Bcb, NULL );
|
||||||
CcRepinBcb( Bcb );
|
CcRepinBcb( Bcb );
|
||||||
CcUnpinData( Bcb );
|
CcUnpinData( Bcb );
|
||||||
@@ -957,7 +957,7 @@ Return Value:
|
|||||||
|
|
||||||
return ReturnStatus;
|
return ReturnStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
@@ -979,7 +979,7 @@ Arguments:
|
|||||||
Vcb - Supplies the volume being flushed
|
Vcb - Supplies the volume being flushed
|
||||||
|
|
||||||
FlushType - Specifies the kind of flushing to perform
|
FlushType - Specifies the kind of flushing to perform
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
|
|
||||||
NTSTATUS - The Status from the flush.
|
NTSTATUS - The Status from the flush.
|
||||||
@@ -1036,8 +1036,8 @@ Return Value:
|
|||||||
return ReturnStatus;
|
return ReturnStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Requires_lock_held_(_Global_critical_region_)
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FatFlushFile (
|
FatFlushFile (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -1056,7 +1056,7 @@ Arguments:
|
|||||||
Fcb - Supplies the file being flushed
|
Fcb - Supplies the file being flushed
|
||||||
|
|
||||||
FlushType - Specifies the kind of flushing to perform
|
FlushType - Specifies the kind of flushing to perform
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
|
|
||||||
NTSTATUS - The Status from the flush.
|
NTSTATUS - The Status from the flush.
|
||||||
@@ -1073,7 +1073,7 @@ Return Value:
|
|||||||
|
|
||||||
|
|
||||||
if ( !FlagOn( Vcb->VcbState, VCB_STATE_FLAG_DELETED_FCB )) {
|
if ( !FlagOn( Vcb->VcbState, VCB_STATE_FLAG_DELETED_FCB )) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Grab and release PagingIo to serialize ourselves with the lazy writer.
|
// Grab and release PagingIo to serialize ourselves with the lazy writer.
|
||||||
// This will work to ensure that all IO has completed on the cached
|
// 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
|
// 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.
|
// it non-recursively so we don't thump children before their time.
|
||||||
//
|
//
|
||||||
|
|
||||||
ExAcquireResourceExclusiveLite( Fcb->Header.PagingIoResource, TRUE);
|
ExAcquireResourceExclusiveLite( Fcb->Header.PagingIoResource, TRUE);
|
||||||
|
|
||||||
if (FlushType == FlushAndInvalidate) {
|
if (FlushType == FlushAndInvalidate) {
|
||||||
|
|
||||||
FatMarkFcbCondition( IrpContext, Fcb, FcbBad, FALSE );
|
FatMarkFcbCondition( IrpContext, Fcb, FcbBad, FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
ExReleaseResourceLite( Fcb->Header.PagingIoResource );
|
ExReleaseResourceLite( Fcb->Header.PagingIoResource );
|
||||||
}
|
}
|
||||||
|
|
||||||
return Iosb.Status;
|
return Iosb.Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FatHijackIrpAndFlushDevice (
|
FatHijackIrpAndFlushDevice (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -1133,9 +1133,9 @@ Return Value:
|
|||||||
PIO_STACK_LOCATION NextIrpSp;
|
PIO_STACK_LOCATION NextIrpSp;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( IrpContext );
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the next stack location, and copy over the stack location
|
// Get the next stack location, and copy over the stack location
|
||||||
//
|
//
|
||||||
@@ -1186,7 +1186,7 @@ Return Value:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatFlushFatEntries (
|
FatFlushFatEntries (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -1259,7 +1259,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FatFlushDirentForFile (
|
FatFlushDirentForFile (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
IN PIRP_CONTEXT IrpContext,
|
||||||
@@ -1306,7 +1306,7 @@ Return Value:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
@@ -1321,7 +1321,7 @@ FatFlushCompletionRoutine (
|
|||||||
|
|
||||||
{
|
{
|
||||||
NTSTATUS Status = (NTSTATUS) (ULONG_PTR) Contxt;
|
NTSTATUS Status = (NTSTATUS) (ULONG_PTR) Contxt;
|
||||||
|
|
||||||
if ( Irp->PendingReturned ) {
|
if ( Irp->PendingReturned ) {
|
||||||
|
|
||||||
IoMarkIrpPending( Irp );
|
IoMarkIrpPending( Irp );
|
||||||
@@ -1343,7 +1343,7 @@ FatFlushCompletionRoutine (
|
|||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user