mirror of
https://github.com/reactos/reactos.git
synced 2024-06-01 02:01:57 +00:00
remove whitespace from end of lines
svn path=/trunk/; revision=15108
This commit is contained in:
parent
1e81d3ff1f
commit
93f075f207
|
@ -16,7 +16,7 @@
|
|||
|
||||
#ifdef ALLOC_PRAGMA
|
||||
|
||||
// Make the initialization routines discardable, so that they
|
||||
// Make the initialization routines discardable, so that they
|
||||
// don't waste space
|
||||
|
||||
#pragma alloc_text(init, DriverEntry)
|
||||
|
@ -27,8 +27,8 @@
|
|||
NTSTATUS
|
||||
STDCALL
|
||||
ACPIDispatchDeviceControl(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION IrpSp;
|
||||
NTSTATUS Status;
|
||||
|
|
|
@ -176,7 +176,7 @@ bn_add_device(
|
|||
* -------------
|
||||
* Either fixed-feature or generic (namespace) types.
|
||||
*/
|
||||
if (strncmp(device->id.hid, BN_HID_POWER_BUTTON,
|
||||
if (strncmp(device->id.hid, BN_HID_POWER_BUTTON,
|
||||
sizeof(BM_DEVICE_HID)) == 0) {
|
||||
|
||||
if (device->id.type == BM_TYPE_FIXED_BUTTON) {
|
||||
|
@ -185,7 +185,7 @@ bn_add_device(
|
|||
|
||||
/* Register for fixed-feature events. */
|
||||
status = acpi_install_fixed_event_handler(
|
||||
ACPI_EVENT_POWER_BUTTON, bn_notify_fixed,
|
||||
ACPI_EVENT_POWER_BUTTON, bn_notify_fixed,
|
||||
(void*)button);
|
||||
}
|
||||
else {
|
||||
|
@ -201,7 +201,7 @@ bn_add_device(
|
|||
* -------------
|
||||
* Either fixed-feature or generic (namespace) types.
|
||||
*/
|
||||
else if (strncmp( device->id.hid, BN_HID_SLEEP_BUTTON,
|
||||
else if (strncmp( device->id.hid, BN_HID_SLEEP_BUTTON,
|
||||
sizeof(BM_DEVICE_HID)) == 0) {
|
||||
|
||||
if (device->id.type == BM_TYPE_FIXED_BUTTON) {
|
||||
|
@ -210,7 +210,7 @@ bn_add_device(
|
|||
|
||||
/* Register for fixed-feature events. */
|
||||
status = acpi_install_fixed_event_handler(
|
||||
ACPI_EVENT_SLEEP_BUTTON, bn_notify_fixed,
|
||||
ACPI_EVENT_SLEEP_BUTTON, bn_notify_fixed,
|
||||
(void*)button);
|
||||
}
|
||||
else {
|
||||
|
@ -224,7 +224,7 @@ bn_add_device(
|
|||
* LID Switch?
|
||||
* -----------
|
||||
*/
|
||||
else if (strncmp( device->id.hid, BN_HID_LID_SWITCH,
|
||||
else if (strncmp( device->id.hid, BN_HID_LID_SWITCH,
|
||||
sizeof(BM_DEVICE_HID)) == 0) {
|
||||
|
||||
button->type = BN_TYPE_LID_SWITCH;
|
||||
|
@ -360,7 +360,7 @@ bn_initialize (void)
|
|||
*/
|
||||
MEMCPY(criteria.hid, BN_HID_LID_SWITCH, sizeof(BN_HID_LID_SWITCH));
|
||||
status = bm_register_driver(&criteria, &driver);
|
||||
|
||||
|
||||
if (status == AE_NOT_FOUND)
|
||||
status = AE_OK;
|
||||
|
||||
|
@ -457,13 +457,13 @@ bn_notify_fixed (
|
|||
|
||||
case BN_TYPE_POWER_BUTTON_FIXED:
|
||||
DEBUG_PRINT(ACPI_INFO, ("Fixed-feature button status change event detected.\n"));
|
||||
/*bm_generate_event(button->device_handle, BN_PROC_ROOT,
|
||||
/*bm_generate_event(button->device_handle, BN_PROC_ROOT,
|
||||
BN_PROC_POWER_BUTTON, BN_NOTIFY_STATUS_CHANGE, 0);*/
|
||||
break;
|
||||
|
||||
case BN_TYPE_SLEEP_BUTTON_FIXED:
|
||||
DEBUG_PRINT(ACPI_INFO, ("Fixed-feature button status change event detected.\n"));
|
||||
/*bm_generate_event(button->device_handle, BN_PROC_ROOT,
|
||||
/*bm_generate_event(button->device_handle, BN_PROC_ROOT,
|
||||
BN_PROC_SLEEP_BUTTON, BN_NOTIFY_STATUS_CHANGE, 0);*/
|
||||
break;
|
||||
|
||||
|
@ -507,11 +507,11 @@ bn_notify (
|
|||
case BM_NOTIFY_DEVICE_ADDED:
|
||||
status = bn_add_device(device_handle, context);
|
||||
break;
|
||||
|
||||
|
||||
case BM_NOTIFY_DEVICE_REMOVED:
|
||||
status = bn_remove_device(context);
|
||||
break;
|
||||
|
||||
|
||||
case BN_NOTIFY_STATUS_CHANGE:
|
||||
DEBUG_PRINT(ACPI_INFO, ("Button status change event detected.\n"));
|
||||
|
||||
|
@ -525,7 +525,7 @@ bn_notify (
|
|||
|
||||
case BN_TYPE_POWER_BUTTON:
|
||||
case BN_TYPE_POWER_BUTTON_FIXED:
|
||||
/*bm_generate_event(device_handle, BN_PROC_ROOT,
|
||||
/*bm_generate_event(device_handle, BN_PROC_ROOT,
|
||||
BN_PROC_POWER_BUTTON, notify_type, 0);*/
|
||||
break;
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ bm_get_status (
|
|||
* Evaluate _STA:
|
||||
* --------------
|
||||
*/
|
||||
status = bm_evaluate_simple_integer(device->acpi_handle, "_STA",
|
||||
status = bm_evaluate_simple_integer(device->acpi_handle, "_STA",
|
||||
&(device->status));
|
||||
|
||||
return status;
|
||||
|
@ -263,12 +263,12 @@ bm_get_identification (
|
|||
}
|
||||
|
||||
if (info.valid & ACPI_VALID_UID) {
|
||||
MEMCPY((void*)device->id.uid, (void*)info.unique_id,
|
||||
MEMCPY((void*)device->id.uid, (void*)info.unique_id,
|
||||
sizeof(BM_DEVICE_UID));
|
||||
}
|
||||
|
||||
if (info.valid & ACPI_VALID_HID) {
|
||||
MEMCPY((void*)device->id.hid, (void*)info.hardware_id,
|
||||
MEMCPY((void*)device->id.hid, (void*)info.hardware_id,
|
||||
sizeof(BM_DEVICE_HID));
|
||||
}
|
||||
|
||||
|
@ -311,7 +311,7 @@ bm_get_flags (
|
|||
/*
|
||||
* Presence of _DCK indicates a docking station.
|
||||
*/
|
||||
if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle,
|
||||
if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle,
|
||||
"_DCK", &acpi_handle))) {
|
||||
device->flags |= BM_FLAGS_DOCKING_STATION;
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ bm_get_flags (
|
|||
* Presence of _EJD and/or _EJx indicates 'ejectable'.
|
||||
* TODO: _EJx...
|
||||
*/
|
||||
if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle,
|
||||
if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle,
|
||||
"_EJD", &acpi_handle))) {
|
||||
device->flags |= BM_FLAGS_EJECTABLE;
|
||||
}
|
||||
|
@ -328,9 +328,9 @@ bm_get_flags (
|
|||
/*
|
||||
* Presence of _PR0 or _PS0 indicates 'power manageable'.
|
||||
*/
|
||||
if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle,
|
||||
if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle,
|
||||
"_PR0", &acpi_handle)) ||
|
||||
ACPI_SUCCESS(acpi_get_handle(device->acpi_handle,
|
||||
ACPI_SUCCESS(acpi_get_handle(device->acpi_handle,
|
||||
"_PS0", &acpi_handle))) {
|
||||
device->flags |= BM_FLAGS_POWER_CONTROL;
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ bm_get_flags (
|
|||
/*
|
||||
* Presence of _CRS indicates 'configurable'.
|
||||
*/
|
||||
if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle,
|
||||
if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle,
|
||||
"_CRS", &acpi_handle))) {
|
||||
device->flags |= BM_FLAGS_CONFIGURABLE;
|
||||
}
|
||||
|
@ -351,9 +351,9 @@ bm_get_flags (
|
|||
/*
|
||||
* Presence of _HID or _ADR indicates 'identifiable'.
|
||||
*/
|
||||
if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle,
|
||||
if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle,
|
||||
"_HID", &acpi_handle)) ||
|
||||
ACPI_SUCCESS(acpi_get_handle(device->acpi_handle,
|
||||
ACPI_SUCCESS(acpi_get_handle(device->acpi_handle,
|
||||
"_ADR", &acpi_handle))) {
|
||||
device->flags |= BM_FLAGS_IDENTIFIABLE;
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ bm_get_flags (
|
|||
/*
|
||||
* Presence of _STA indicates 'dynamic status'.
|
||||
*/
|
||||
if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle,
|
||||
if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle,
|
||||
"_STA", &acpi_handle))) {
|
||||
device->flags |= BM_FLAGS_DYNAMIC_STATUS;
|
||||
}
|
||||
|
@ -428,7 +428,7 @@ bm_add_namespace_device (
|
|||
/*
|
||||
* Device Type:
|
||||
* ------------
|
||||
*/
|
||||
*/
|
||||
switch (acpi_type) {
|
||||
case INTERNAL_TYPE_SCOPE:
|
||||
device->id.type = BM_TYPE_SCOPE;
|
||||
|
@ -481,7 +481,7 @@ bm_add_namespace_device (
|
|||
/*
|
||||
* Power Management:
|
||||
* -----------------
|
||||
* If this node doesn't provide direct power control
|
||||
* If this node doesn't provide direct power control
|
||||
* then we inherit PM capabilities from its parent.
|
||||
*
|
||||
* TODO: Inherit!
|
||||
|
@ -572,8 +572,8 @@ bm_enumerate_namespace (void)
|
|||
if (ACPI_SUCCESS(status)) {
|
||||
|
||||
/*
|
||||
* TODO: This is a hack to get around the problem
|
||||
* identifying scope objects. Scopes
|
||||
* TODO: This is a hack to get around the problem
|
||||
* identifying scope objects. Scopes
|
||||
* somehow need to be uniquely identified.
|
||||
*/
|
||||
status = acpi_get_type(child_handle, &acpi_type);
|
||||
|
@ -621,7 +621,7 @@ bm_enumerate_namespace (void)
|
|||
else {
|
||||
level--;
|
||||
child_handle = parent_handle;
|
||||
acpi_get_parent(parent_handle,
|
||||
acpi_get_parent(parent_handle,
|
||||
&parent_handle);
|
||||
|
||||
if (parent) {
|
||||
|
@ -683,7 +683,7 @@ bm_add_fixed_feature_device (
|
|||
node->device.acpi_handle = ACPI_ROOT_OBJECT;
|
||||
node->device.id.type = BM_TYPE_FIXED_BUTTON;
|
||||
if (device_hid) {
|
||||
MEMCPY((void*)node->device.id.hid, device_hid,
|
||||
MEMCPY((void*)node->device.id.hid, device_hid,
|
||||
sizeof(node->device.id.hid));
|
||||
}
|
||||
node->device.flags = BM_FLAGS_FIXED_FEATURE;
|
||||
|
@ -950,14 +950,14 @@ bm_initialize (void)
|
|||
*/
|
||||
DEBUG_PRINT(ACPI_INFO, ("Registering for all device notifications.\n"));
|
||||
|
||||
status = acpi_install_notify_handler(ACPI_ROOT_OBJECT,
|
||||
status = acpi_install_notify_handler(ACPI_ROOT_OBJECT,
|
||||
ACPI_SYSTEM_NOTIFY, &bm_notify, NULL);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
DEBUG_PRINT(ACPI_ERROR, ("Unable to register for standard notifications.\n"));
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
status = acpi_install_notify_handler(ACPI_ROOT_OBJECT,
|
||||
status = acpi_install_notify_handler(ACPI_ROOT_OBJECT,
|
||||
ACPI_DEVICE_NOTIFY, &bm_notify, NULL);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
DEBUG_PRINT(ACPI_ERROR, ("Unable to register for device-specific notifications.\n"));
|
||||
|
@ -1019,13 +1019,13 @@ bm_terminate (void)
|
|||
|
||||
DEBUG_PRINT(ACPI_INFO, ("Unregistering for device notifications.\n"));
|
||||
|
||||
status = acpi_remove_notify_handler(ACPI_ROOT_OBJECT,
|
||||
status = acpi_remove_notify_handler(ACPI_ROOT_OBJECT,
|
||||
ACPI_SYSTEM_NOTIFY, &bm_notify);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
DEBUG_PRINT(ACPI_ERROR, ("Unable to un-register for standard notifications.\n"));
|
||||
}
|
||||
|
||||
status = acpi_remove_notify_handler(ACPI_ROOT_OBJECT,
|
||||
status = acpi_remove_notify_handler(ACPI_ROOT_OBJECT,
|
||||
ACPI_DEVICE_NOTIFY, &bm_notify);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
DEBUG_PRINT(ACPI_ERROR, ("Unable to un-register for device-specific notifications.\n"));
|
||||
|
|
|
@ -63,13 +63,13 @@ bm_generate_notify (
|
|||
|
||||
DEBUG_PRINT(ACPI_INFO, ("Sending notify [0x%02x] to device [0x%02x].\n", notify_type, node->device.handle));
|
||||
|
||||
if (!(node->device.flags & BM_FLAGS_DRIVER_CONTROL) ||
|
||||
if (!(node->device.flags & BM_FLAGS_DRIVER_CONTROL) ||
|
||||
!(node->driver.notify)) {
|
||||
DEBUG_PRINT(ACPI_WARN, ("No driver installed for device [0x%02x].\n", node->device.handle));
|
||||
return_ACPI_STATUS(AE_NOT_EXIST);
|
||||
}
|
||||
|
||||
status = node->driver.notify(notify_type, node->device.handle,
|
||||
status = node->driver.notify(notify_type, node->device.handle,
|
||||
&(node->driver.context));
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
|
@ -130,7 +130,7 @@ bm_device_check (
|
|||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
if (old_status == node->device.status) {
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
@ -138,12 +138,12 @@ bm_device_check (
|
|||
if (status_change) {
|
||||
*status_change = TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Device Insertion?
|
||||
* -----------------
|
||||
*/
|
||||
if ((device->status & BM_STATUS_PRESENT) &&
|
||||
if ((device->status & BM_STATUS_PRESENT) &&
|
||||
!(old_status & BM_STATUS_PRESENT)) {
|
||||
/* TODO: Make sure driver is loaded, and if not, load. */
|
||||
status = bm_generate_notify(node, BM_NOTIFY_DEVICE_ADDED);
|
||||
|
@ -153,7 +153,7 @@ bm_device_check (
|
|||
* Device Removal?
|
||||
* ---------------
|
||||
*/
|
||||
else if (!(device->status & BM_STATUS_PRESENT) &&
|
||||
else if (!(device->status & BM_STATUS_PRESENT) &&
|
||||
(old_status & BM_STATUS_PRESENT)) {
|
||||
/* TODO: Unload driver if last device instance. */
|
||||
status = bm_generate_notify(node, BM_NOTIFY_DEVICE_REMOVED);
|
||||
|
@ -247,7 +247,7 @@ bm_notify (
|
|||
/*
|
||||
* Device-Specific or Standard?
|
||||
* ----------------------------
|
||||
* Device-specific notifies are forwarded to the control module's
|
||||
* Device-specific notifies are forwarded to the control module's
|
||||
* notify() function for processing. Standard notifies are handled
|
||||
* internally.
|
||||
*/
|
||||
|
|
|
@ -72,21 +72,21 @@ bm_get_inferred_power_state (
|
|||
/*
|
||||
* Calculate Power State:
|
||||
* ----------------------
|
||||
* Try to infer the devices's power state by checking the state of
|
||||
* the devices's power resources. We start by evaluating _PR0
|
||||
* (resource requirements at D0) and work through _PR1 and _PR2.
|
||||
* We know the current devices power state when all resources (for
|
||||
* a give Dx state) are ON. If no power resources are on then the
|
||||
* Try to infer the devices's power state by checking the state of
|
||||
* the devices's power resources. We start by evaluating _PR0
|
||||
* (resource requirements at D0) and work through _PR1 and _PR2.
|
||||
* We know the current devices power state when all resources (for
|
||||
* a give Dx state) are ON. If no power resources are on then the
|
||||
* device is assumed to be off (D3).
|
||||
*/
|
||||
for (i=ACPI_STATE_D0; i<ACPI_STATE_D3; i++) {
|
||||
|
||||
status = bm_evaluate_reference_list(device->acpi_handle,
|
||||
status = bm_evaluate_reference_list(device->acpi_handle,
|
||||
object_name, &pr_list);
|
||||
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
|
||||
status = bm_pr_list_get_state(&pr_list,
|
||||
status = bm_pr_list_get_state(&pr_list,
|
||||
&list_state);
|
||||
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
|
@ -137,7 +137,7 @@ bm_get_power_state (
|
|||
device->power.state = ACPI_STATE_UNKNOWN;
|
||||
|
||||
if (device->flags & BM_FLAGS_POWER_STATE) {
|
||||
status = bm_evaluate_simple_integer(device->acpi_handle,
|
||||
status = bm_evaluate_simple_integer(device->acpi_handle,
|
||||
"_PSC", &(device->power.state));
|
||||
}
|
||||
else {
|
||||
|
@ -204,24 +204,24 @@ bm_set_power_state (
|
|||
/*
|
||||
* Get Resources:
|
||||
* --------------
|
||||
* Get the power resources associated with the device's current
|
||||
* Get the power resources associated with the device's current
|
||||
* and target power states.
|
||||
*/
|
||||
if (device->power.state != ACPI_STATE_UNKNOWN) {
|
||||
object_name[3] = '0' + device->power.state;
|
||||
bm_evaluate_reference_list(device->acpi_handle,
|
||||
bm_evaluate_reference_list(device->acpi_handle,
|
||||
object_name, ¤t_list);
|
||||
}
|
||||
|
||||
object_name[3] = '0' + state;
|
||||
bm_evaluate_reference_list(device->acpi_handle, object_name,
|
||||
bm_evaluate_reference_list(device->acpi_handle, object_name,
|
||||
&target_list);
|
||||
|
||||
/*
|
||||
* Transition Resources:
|
||||
* ---------------------
|
||||
* Transition all power resources referenced by this device to
|
||||
* the correct power state (taking into consideration sequencing
|
||||
* Transition all power resources referenced by this device to
|
||||
* the correct power state (taking into consideration sequencing
|
||||
* and dependencies to other devices).
|
||||
*/
|
||||
if (current_list.count || target_list.count) {
|
||||
|
@ -234,7 +234,7 @@ bm_set_power_state (
|
|||
/*
|
||||
* Execute _PSx:
|
||||
* -------------
|
||||
* Execute the _PSx method corresponding to the target Dx state,
|
||||
* Execute the _PSx method corresponding to the target Dx state,
|
||||
* if it exists.
|
||||
*/
|
||||
object_name[2] = 'S';
|
||||
|
@ -287,17 +287,17 @@ bm_get_pm_capabilities (
|
|||
* Power Management Flags:
|
||||
* -----------------------
|
||||
*/
|
||||
if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PSC",
|
||||
if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PSC",
|
||||
&acpi_handle))) {
|
||||
device->power.flags |= BM_FLAGS_POWER_STATE;
|
||||
}
|
||||
|
||||
if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_IRC",
|
||||
if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_IRC",
|
||||
&acpi_handle))) {
|
||||
device->power.flags |= BM_FLAGS_INRUSH_CURRENT;
|
||||
}
|
||||
|
||||
if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PRW",
|
||||
if (ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PRW",
|
||||
&acpi_handle))) {
|
||||
device->power.flags |= BM_FLAGS_WAKE_CAPABLE;
|
||||
}
|
||||
|
@ -317,22 +317,22 @@ bm_get_pm_capabilities (
|
|||
* Figure out which Dx states are supported by this device for the
|
||||
* S0 (working) state. Note that D0 and D3 are required (assumed).
|
||||
*/
|
||||
device->power.dx_supported[ACPI_STATE_S0] = BM_FLAGS_D0_SUPPORT |
|
||||
device->power.dx_supported[ACPI_STATE_S0] = BM_FLAGS_D0_SUPPORT |
|
||||
BM_FLAGS_D3_SUPPORT;
|
||||
|
||||
if ((ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PR1",
|
||||
&acpi_handle))) ||
|
||||
(ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PS1",
|
||||
if ((ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PR1",
|
||||
&acpi_handle))) ||
|
||||
(ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PS1",
|
||||
&acpi_handle)))) {
|
||||
device->power.dx_supported[ACPI_STATE_S0] |=
|
||||
device->power.dx_supported[ACPI_STATE_S0] |=
|
||||
BM_FLAGS_D1_SUPPORT;
|
||||
}
|
||||
|
||||
if ((ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PR2",
|
||||
&acpi_handle))) ||
|
||||
(ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PS2",
|
||||
if ((ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PR2",
|
||||
&acpi_handle))) ||
|
||||
(ACPI_SUCCESS(acpi_get_handle(device->acpi_handle, "_PS2",
|
||||
&acpi_handle)))) {
|
||||
device->power.dx_supported[ACPI_STATE_S0] |=
|
||||
device->power.dx_supported[ACPI_STATE_S0] |=
|
||||
BM_FLAGS_D2_SUPPORT;
|
||||
}
|
||||
|
||||
|
@ -352,28 +352,28 @@ bm_get_pm_capabilities (
|
|||
/*
|
||||
* Evalute _SxD:
|
||||
* -------------
|
||||
* Which returns the highest (power) Dx state supported in
|
||||
* this system (Sx) state. We convert this value to a bit
|
||||
* Which returns the highest (power) Dx state supported in
|
||||
* this system (Sx) state. We convert this value to a bit
|
||||
* mask of supported states (conceptually simpler).
|
||||
*/
|
||||
status = bm_evaluate_simple_integer(device->acpi_handle,
|
||||
status = bm_evaluate_simple_integer(device->acpi_handle,
|
||||
object_name, &dx_supported);
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
switch (dx_supported) {
|
||||
case 0:
|
||||
device->power.dx_supported[i] |=
|
||||
device->power.dx_supported[i] |=
|
||||
BM_FLAGS_D0_SUPPORT;
|
||||
/* fall through */
|
||||
case 1:
|
||||
device->power.dx_supported[i] |=
|
||||
device->power.dx_supported[i] |=
|
||||
BM_FLAGS_D1_SUPPORT;
|
||||
/* fall through */
|
||||
case 2:
|
||||
device->power.dx_supported[i] |=
|
||||
device->power.dx_supported[i] |=
|
||||
BM_FLAGS_D2_SUPPORT;
|
||||
/* fall through */
|
||||
case 3:
|
||||
device->power.dx_supported[i] |=
|
||||
device->power.dx_supported[i] |=
|
||||
BM_FLAGS_D3_SUPPORT;
|
||||
break;
|
||||
}
|
||||
|
@ -381,12 +381,12 @@ bm_get_pm_capabilities (
|
|||
/*
|
||||
* Validate:
|
||||
* ---------
|
||||
* Mask of any states that _Sx_d falsely advertises
|
||||
* (e.g.claims D1 support but neither _PR2 or _PS2
|
||||
* exist). In other words, S1-S5 can't offer a Dx
|
||||
* Mask of any states that _Sx_d falsely advertises
|
||||
* (e.g.claims D1 support but neither _PR2 or _PS2
|
||||
* exist). In other words, S1-S5 can't offer a Dx
|
||||
* state that isn't supported by S0.
|
||||
*/
|
||||
device->power.dx_supported[i] &=
|
||||
device->power.dx_supported[i] &=
|
||||
device->power.dx_supported[ACPI_STATE_S0];
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* TODO:
|
||||
* -----
|
||||
* 1. Sequencing of power resource list transitions.
|
||||
* 2. Global serialization of power resource transtions (see ACPI
|
||||
* 2. Global serialization of power resource transtions (see ACPI
|
||||
* spec section 7.1.2/7.1.3).
|
||||
* 3. Better error handling.
|
||||
*/
|
||||
|
@ -51,13 +51,13 @@ bm_pr_notify (
|
|||
BM_NOTIFY notify_type,
|
||||
BM_HANDLE device_handle,
|
||||
void **context);
|
||||
|
||||
|
||||
ACPI_STATUS
|
||||
bm_pr_request (
|
||||
BM_REQUEST *request,
|
||||
void *context);
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Internal Functions
|
||||
****************************************************************************/
|
||||
|
@ -133,7 +133,7 @@ bm_pr_get_state (
|
|||
|
||||
pr->state = ACPI_STATE_UNKNOWN;
|
||||
|
||||
/*
|
||||
/*
|
||||
* Evaluate _STA:
|
||||
* --------------
|
||||
* Evalute _STA to determine whether the power resource is ON or OFF.
|
||||
|
@ -151,7 +151,7 @@ bm_pr_get_state (
|
|||
}
|
||||
|
||||
/*
|
||||
* Mask off all bits but the first as some systems return non-standard
|
||||
* Mask off all bits but the first as some systems return non-standard
|
||||
* values (e.g. 0x51).
|
||||
*/
|
||||
switch (device_status & 0x01) {
|
||||
|
@ -269,7 +269,7 @@ bm_pr_list_get_state (
|
|||
* -----------------------------
|
||||
* The current state of a list of power resources is ON if all
|
||||
* power resources are currently in the ON state. In other words,
|
||||
* if any power resource in the list is OFF then the collection
|
||||
* if any power resource in the list is OFF then the collection
|
||||
* isn't fully ON.
|
||||
*/
|
||||
for (i = 0; i < pr_list->count; i++) {
|
||||
|
@ -328,13 +328,13 @@ bm_pr_list_transition (
|
|||
/*
|
||||
* Reference Target:
|
||||
* -----------------
|
||||
* Reference all resources for the target power state first (so
|
||||
* the device doesn't get turned off while transitioning). Power
|
||||
* Reference all resources for the target power state first (so
|
||||
* the device doesn't get turned off while transitioning). Power
|
||||
* resources that aren't on (new reference count of 1) are turned on.
|
||||
*/
|
||||
for (i = 0; i < target_list->count; i++) {
|
||||
|
||||
status = bm_get_device_context(target_list->handles[i],
|
||||
status = bm_get_device_context(target_list->handles[i],
|
||||
(BM_DRIVER_CONTEXT*)(&pr));
|
||||
if (ACPI_FAILURE(status)) {
|
||||
DEBUG_PRINT(ACPI_WARN, ("Invalid reference to power resource [0x%02X].\n", target_list->handles[i]));
|
||||
|
@ -355,12 +355,12 @@ bm_pr_list_transition (
|
|||
* Dereference Current:
|
||||
* --------------------
|
||||
* Dereference all resources for the current power state. Power
|
||||
* resources no longer referenced (new reference count of 0) are
|
||||
* resources no longer referenced (new reference count of 0) are
|
||||
* turned off.
|
||||
*/
|
||||
for (i = 0; i < current_list->count; i++) {
|
||||
|
||||
status = bm_get_device_context(current_list->handles[i],
|
||||
status = bm_get_device_context(current_list->handles[i],
|
||||
(BM_DRIVER_CONTEXT*)(&pr));
|
||||
if (ACPI_FAILURE(status)) {
|
||||
DEBUG_PRINT(ACPI_WARN, ("Invalid reference to power resource [0x%02X].\n", target_list->handles[i]));
|
||||
|
@ -434,7 +434,7 @@ bm_pr_add_device (
|
|||
pr->device_handle = device->handle;
|
||||
pr->acpi_handle = device->acpi_handle;
|
||||
|
||||
/*
|
||||
/*
|
||||
* Get information on this power resource.
|
||||
*/
|
||||
status = acpi_evaluate_object(pr->acpi_handle, NULL, NULL, &buffer);
|
||||
|
|
|
@ -62,7 +62,7 @@ bm_generate_request (
|
|||
|
||||
DEBUG_PRINT(ACPI_INFO, ("Sending request [0x%02x] to device [0x%02x].\n", request->command, node->device.handle));
|
||||
|
||||
if (!(node->device.flags & BM_FLAGS_DRIVER_CONTROL) ||
|
||||
if (!(node->device.flags & BM_FLAGS_DRIVER_CONTROL) ||
|
||||
!(node->driver.request)) {
|
||||
DEBUG_PRINT(ACPI_WARN, ("No driver installed for device [0x%02x].\n", node->device.handle));
|
||||
return_ACPI_STATUS(AE_NOT_EXIST);
|
||||
|
@ -137,7 +137,7 @@ bm_request (
|
|||
if (ACPI_FAILURE(status)) {
|
||||
break;
|
||||
}
|
||||
status = bm_copy_to_buffer(&(request->buffer),
|
||||
status = bm_copy_to_buffer(&(request->buffer),
|
||||
&(device->power.state), sizeof(BM_POWER_STATE));
|
||||
break;
|
||||
|
||||
|
@ -145,7 +145,7 @@ bm_request (
|
|||
{
|
||||
BM_POWER_STATE *power_state = NULL;
|
||||
|
||||
status = bm_cast_buffer(&(request->buffer),
|
||||
status = bm_cast_buffer(&(request->buffer),
|
||||
(void**)&power_state, sizeof(BM_POWER_STATE));
|
||||
if (ACPI_FAILURE(status)) {
|
||||
break;
|
||||
|
|
|
@ -57,7 +57,7 @@ bm_compare (
|
|||
return AE_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Present?
|
||||
* --------
|
||||
* We're only going to match on devices that are present.
|
||||
|
@ -67,22 +67,22 @@ bm_compare (
|
|||
return AE_NOT_FOUND;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* type?
|
||||
*/
|
||||
if (criteria->type && !(criteria->type & device->id.type)) {
|
||||
return AE_NOT_FOUND;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* hid?
|
||||
*/
|
||||
if ((criteria->hid[0]) && (0 != STRNCMP(criteria->hid,
|
||||
if ((criteria->hid[0]) && (0 != STRNCMP(criteria->hid,
|
||||
device->id.hid, sizeof(BM_DEVICE_HID)))) {
|
||||
return AE_NOT_FOUND;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* adr?
|
||||
*/
|
||||
if ((criteria->adr) && (criteria->adr != device->id.adr)) {
|
||||
|
@ -149,7 +149,7 @@ bm_search(
|
|||
if (node->scope.head) {
|
||||
status = bm_compare(&(node->device), criteria);
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
results->handles[results->count++] =
|
||||
results->handles[results->count++] =
|
||||
node->device.handle;
|
||||
}
|
||||
node = node->scope.head;
|
||||
|
@ -163,16 +163,16 @@ bm_search(
|
|||
else {
|
||||
status = bm_compare(&(node->device), criteria);
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
results->handles[results->count++] =
|
||||
results->handles[results->count++] =
|
||||
node->device.handle;
|
||||
}
|
||||
|
||||
/*
|
||||
* Locate Next Device:
|
||||
* -------------------
|
||||
* The next node is either a peer at this level
|
||||
* (node->next is valid), or we work are way back
|
||||
* up the tree until we either find a non-parsed
|
||||
* The next node is either a peer at this level
|
||||
* (node->next is valid), or we work are way back
|
||||
* up the tree until we either find a non-parsed
|
||||
* peer or hit the top (node->parent is NULL).
|
||||
*/
|
||||
while (!node->next && node->parent) {
|
||||
|
|
|
@ -199,7 +199,7 @@ bm_extract_package_data (
|
|||
|
||||
if (!package || (package->type != ACPI_TYPE_PACKAGE) ||
|
||||
(package->package.count == 0) || !package_format ||
|
||||
(package_format->length < 1) ||
|
||||
(package_format->length < 1) ||
|
||||
(!package_format->pointer) || !buffer) {
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ bm_extract_package_data (
|
|||
tail_offset += sizeof(ACPI_INTEGER);
|
||||
break;
|
||||
case 'S':
|
||||
size_required += sizeof(u8*) +
|
||||
size_required += sizeof(u8*) +
|
||||
sizeof(ACPI_INTEGER) + 1;
|
||||
tail_offset += sizeof(ACPI_INTEGER);
|
||||
break;
|
||||
|
@ -243,12 +243,12 @@ bm_extract_package_data (
|
|||
case ACPI_TYPE_BUFFER:
|
||||
switch (format[i]) {
|
||||
case 'S':
|
||||
size_required += sizeof(u8*) +
|
||||
size_required += sizeof(u8*) +
|
||||
element->string.length + 1;
|
||||
tail_offset += sizeof(u8*);
|
||||
break;
|
||||
case 'B':
|
||||
size_required += sizeof(u8*) +
|
||||
size_required += sizeof(u8*) +
|
||||
element->buffer.length;
|
||||
tail_offset += sizeof(u8*);
|
||||
break;
|
||||
|
@ -293,14 +293,14 @@ bm_extract_package_data (
|
|||
case ACPI_TYPE_INTEGER:
|
||||
switch (format[i]) {
|
||||
case 'N':
|
||||
*((ACPI_INTEGER*)head) =
|
||||
*((ACPI_INTEGER*)head) =
|
||||
element->integer.value;
|
||||
head += sizeof(ACPI_INTEGER);
|
||||
break;
|
||||
case 'S':
|
||||
pointer = (u8**)head;
|
||||
*pointer = tail;
|
||||
*((ACPI_INTEGER*)tail) =
|
||||
*((ACPI_INTEGER*)tail) =
|
||||
element->integer.value;
|
||||
head += sizeof(ACPI_INTEGER*);
|
||||
tail += sizeof(ACPI_INTEGER);
|
||||
|
@ -320,7 +320,7 @@ bm_extract_package_data (
|
|||
case 'S':
|
||||
pointer = (u8**)head;
|
||||
*pointer = tail;
|
||||
memcpy(tail, element->string.pointer,
|
||||
memcpy(tail, element->string.pointer,
|
||||
element->string.length);
|
||||
head += sizeof(u8*);
|
||||
tail += element->string.length;
|
||||
|
@ -331,7 +331,7 @@ bm_extract_package_data (
|
|||
case 'B':
|
||||
pointer = (u8**)head;
|
||||
*pointer = tail;
|
||||
memcpy(tail, element->buffer.pointer,
|
||||
memcpy(tail, element->buffer.pointer,
|
||||
element->buffer.length);
|
||||
head += sizeof(u8*);
|
||||
tail += element->buffer.length;
|
||||
|
@ -361,11 +361,11 @@ bm_extract_package_data (
|
|||
* PARAMETERS: <TBD>
|
||||
*
|
||||
* RETURN: AE_OK
|
||||
* AE_BUFFER_OVERFLOW Evaluated object returned data, but
|
||||
* AE_BUFFER_OVERFLOW Evaluated object returned data, but
|
||||
* caller did not provide buffer.
|
||||
*
|
||||
* DESCRIPTION: Helper for acpi_evaluate_object that handles buffer
|
||||
* allocation. Note that the caller is responsible for
|
||||
* allocation. Note that the caller is responsible for
|
||||
* freeing buffer->pointer!
|
||||
*
|
||||
****************************************************************************/
|
||||
|
@ -389,8 +389,8 @@ bm_evaluate_object (
|
|||
/*
|
||||
* Evalute Object:
|
||||
* ---------------
|
||||
* The first attempt is just to get the size of the object data
|
||||
* (that is unless there's no return data, e.g. _INI); the second
|
||||
* The first attempt is just to get the size of the object data
|
||||
* (that is unless there's no return data, e.g. _INI); the second
|
||||
* gets the data.
|
||||
*/
|
||||
status = acpi_evaluate_object(acpi_handle, pathname, arguments, buffer);
|
||||
|
@ -407,14 +407,14 @@ bm_evaluate_object (
|
|||
}
|
||||
|
||||
/* Re-evaluate -- this time it should work */
|
||||
status = acpi_evaluate_object(acpi_handle, pathname,
|
||||
status = acpi_evaluate_object(acpi_handle, pathname,
|
||||
arguments, buffer);
|
||||
}
|
||||
|
||||
if (ACPI_FAILURE(status)) {
|
||||
DEBUG_EVAL_ERROR(ACPI_WARN, acpi_handle, pathname, status);
|
||||
if (buffer && buffer->pointer) {
|
||||
acpi_os_free(buffer->pointer);
|
||||
acpi_os_free(buffer->pointer);
|
||||
buffer->pointer = NULL;
|
||||
buffer->length = 0;
|
||||
}
|
||||
|
@ -467,7 +467,7 @@ bm_evaluate_simple_integer (
|
|||
* Validate Data:
|
||||
* --------------
|
||||
*/
|
||||
status = bm_cast_buffer(&buffer, (void**)&element,
|
||||
status = bm_cast_buffer(&buffer, (void**)&element,
|
||||
sizeof(ACPI_OBJECT));
|
||||
if (ACPI_FAILURE(status)) {
|
||||
DEBUG_EVAL_ERROR(ACPI_WARN, acpi_handle, pathname, status);
|
||||
|
@ -535,7 +535,7 @@ bm_evaluate_reference_list (
|
|||
* Validate Package:
|
||||
* -----------------
|
||||
*/
|
||||
status = bm_cast_buffer(&buffer, (void**)&package,
|
||||
status = bm_cast_buffer(&buffer, (void**)&package,
|
||||
sizeof(ACPI_OBJECT));
|
||||
if (ACPI_FAILURE(status)) {
|
||||
DEBUG_EVAL_ERROR(ACPI_WARN, acpi_handle, pathname, status);
|
||||
|
@ -571,7 +571,7 @@ bm_evaluate_reference_list (
|
|||
* Resolve reference string (e.g. "\_PR_.CPU_") to an
|
||||
* ACPI_HANDLE.
|
||||
*/
|
||||
status = acpi_get_handle(acpi_handle,
|
||||
status = acpi_get_handle(acpi_handle,
|
||||
element->string.pointer, &reference_handle);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
status = AE_BAD_DATA;
|
||||
|
@ -583,7 +583,7 @@ bm_evaluate_reference_list (
|
|||
/*
|
||||
* Resolve ACPI_HANDLE to BM_HANDLE.
|
||||
*/
|
||||
status = bm_get_handle(reference_handle,
|
||||
status = bm_get_handle(reference_handle,
|
||||
&(reference_list->handles[i]));
|
||||
if (ACPI_FAILURE(status)) {
|
||||
status = AE_BAD_DATA;
|
||||
|
|
|
@ -79,7 +79,7 @@ bm_get_device_status (
|
|||
if (!BM_NODE_PRESENT(node->parent)) {
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Dynamic Status?
|
||||
* ---------------
|
||||
|
@ -94,7 +94,7 @@ bm_get_device_status (
|
|||
* Evaluate _STA:
|
||||
* --------------
|
||||
*/
|
||||
status = bm_evaluate_simple_integer(node->device.acpi_handle, "_STA",
|
||||
status = bm_evaluate_simple_integer(node->device.acpi_handle, "_STA",
|
||||
&(node->device.status));
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
*device_status = node->device.status;
|
||||
|
@ -232,7 +232,7 @@ bm_register_driver (
|
|||
/*
|
||||
* Install driver:
|
||||
* ----------------
|
||||
* For each match, record the driver information and execute the
|
||||
* For each match, record the driver information and execute the
|
||||
* driver's Notify() funciton (if present) to notify the driver
|
||||
* of the device's presence.
|
||||
*/
|
||||
|
@ -247,7 +247,7 @@ bm_register_driver (
|
|||
DEBUG_PRINT(ACPI_INFO, ("Registering driver for device [0x%02x].\n", node->device.handle));
|
||||
|
||||
/* Notify driver of new device. */
|
||||
status = driver->notify(BM_NOTIFY_DEVICE_ADDED,
|
||||
status = driver->notify(BM_NOTIFY_DEVICE_ADDED,
|
||||
node->device.handle, &(node->driver.context));
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
node->driver.notify = driver->notify;
|
||||
|
@ -319,7 +319,7 @@ bm_unregister_driver (
|
|||
DEBUG_PRINT(ACPI_INFO, ("Unregistering driver for device [0x%02x].\n", node->device.handle));
|
||||
|
||||
/* Notify driver of device removal. */
|
||||
status = node->driver.notify(BM_NOTIFY_DEVICE_REMOVED,
|
||||
status = node->driver.notify(BM_NOTIFY_DEVICE_REMOVED,
|
||||
node->device.handle, &(node->driver.context));
|
||||
|
||||
node->device.flags &= ~BM_FLAGS_DRIVER_CONTROL;
|
||||
|
|
|
@ -128,7 +128,7 @@ AcpiCreateResourceList(PCM_RESOURCE_LIST* pResourceList,
|
|||
RESOURCE* resource;
|
||||
ULONG i;
|
||||
KIRQL Dirql;
|
||||
|
||||
|
||||
/* Count number of resources */
|
||||
Done = FALSE;
|
||||
resource = resources;
|
||||
|
@ -161,7 +161,7 @@ AcpiCreateResourceList(PCM_RESOURCE_LIST* pResourceList,
|
|||
}
|
||||
resource = (RESOURCE *) ((NATIVE_UINT) resource + (NATIVE_UINT) resource->length);
|
||||
}
|
||||
|
||||
|
||||
/* Allocate memory */
|
||||
*ResourceListSize = sizeof(CM_RESOURCE_LIST) + sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) * (NumberOfResources - 1);
|
||||
ResourceList = (PCM_RESOURCE_LIST)ExAllocatePool(PagedPool, *ResourceListSize);
|
||||
|
@ -175,7 +175,7 @@ AcpiCreateResourceList(PCM_RESOURCE_LIST* pResourceList,
|
|||
ResourceList->List[0].PartialResourceList.Revision = 1;
|
||||
ResourceList->List[0].PartialResourceList.Count = NumberOfResources;
|
||||
ResourceDescriptor = ResourceList->List[0].PartialResourceList.PartialDescriptors;
|
||||
|
||||
|
||||
/* Fill resources list structure */
|
||||
Done = FALSE;
|
||||
resource = resources;
|
||||
|
@ -189,7 +189,7 @@ AcpiCreateResourceList(PCM_RESOURCE_LIST* pResourceList,
|
|||
for (i = 0; i < irq_data->number_of_interrupts; i++)
|
||||
{
|
||||
ResourceDescriptor->Type = CmResourceTypeInterrupt;
|
||||
|
||||
|
||||
ResourceDescriptor->ShareDisposition =
|
||||
(irq_data->shared_exclusive == SHARED ? CmResourceShareShared : CmResourceShareDeviceExclusive);
|
||||
ResourceDescriptor->Flags =
|
||||
|
@ -253,7 +253,7 @@ AcpiCreateResourceList(PCM_RESOURCE_LIST* pResourceList,
|
|||
}
|
||||
resource = (RESOURCE *) ((NATIVE_UINT) resource + (NATIVE_UINT) resource->length);
|
||||
}
|
||||
|
||||
|
||||
acpi_rs_dump_resource_list(resource);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ typedef char BM_DEVICE_HID[9];
|
|||
#define BM_HID_SLEEP_BUTTON "PNP0C0E"
|
||||
|
||||
/*
|
||||
* BM_DEVICE_CID:
|
||||
* BM_DEVICE_CID:
|
||||
* The compatibility ID can be a string with 44 characters
|
||||
* The extra pad is in case there is a change. It also
|
||||
* provides 8 byte alignment for the BM_DEVICE_ID structure.
|
||||
|
@ -564,7 +564,7 @@ bm_pr_initialize (void);
|
|||
|
||||
ACPI_STATUS
|
||||
bm_pr_terminate (void);
|
||||
|
||||
|
||||
/* bmutils.c */
|
||||
|
||||
ACPI_STATUS
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
* Hardware IDs:
|
||||
* -------------
|
||||
* TODO: Power and Sleep button HIDs also exist in <bm.h>. Should all
|
||||
* HIDs (ACPI well-known devices) exist in one place (e.g.
|
||||
* HIDs (ACPI well-known devices) exist in one place (e.g.
|
||||
* acpi_hid.h)?
|
||||
*/
|
||||
#define BN_HID_POWER_BUTTON "PNP0C0C"
|
||||
|
|
|
@ -151,7 +151,7 @@ acpi_os_map_memory(ACPI_PHYSICAL_ADDRESS phys, u32 size, void **virt)
|
|||
*virt = MmMapIoSpace(Address, size, MmNonCached);
|
||||
if (!*virt)
|
||||
return AE_ERROR;
|
||||
|
||||
|
||||
return AE_OK;
|
||||
}
|
||||
|
||||
|
@ -510,7 +510,7 @@ acpi_os_delete_semaphore(
|
|||
|
||||
DPRINT("acpi_os_delete_semaphore(handle 0x%X)\n", handle);
|
||||
|
||||
if (!Mutex)
|
||||
if (!Mutex)
|
||||
return AE_BAD_PARAMETER;
|
||||
|
||||
ExFreePool(Mutex);
|
||||
|
@ -541,7 +541,7 @@ acpi_os_wait_semaphore(
|
|||
|
||||
ACPI_STATUS
|
||||
acpi_os_signal_semaphore(
|
||||
ACPI_HANDLE handle,
|
||||
ACPI_HANDLE handle,
|
||||
u32 units)
|
||||
{
|
||||
PFAST_MUTEX Mutex = (PFAST_MUTEX)handle;
|
||||
|
|
|
@ -115,21 +115,21 @@ PdoQueryResources(
|
|||
{
|
||||
PPDO_DEVICE_EXTENSION DeviceExtension;
|
||||
PCM_RESOURCE_LIST ResourceList;
|
||||
|
||||
|
||||
DeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
|
||||
if (DeviceExtension->ResourceListSize == 0)
|
||||
{
|
||||
return Irp->IoStatus.Status;
|
||||
}
|
||||
|
||||
|
||||
ResourceList = ExAllocatePool(PagedPool, DeviceExtension->ResourceListSize);
|
||||
if (!ResourceList)
|
||||
{
|
||||
Irp->IoStatus.Information = 0;
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
RtlCopyMemory(ResourceList, DeviceExtension->ResourceList, DeviceExtension->ResourceListSize);
|
||||
Irp->IoStatus.Information = (ULONG_PTR)ResourceList;
|
||||
return STATUS_SUCCESS;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#ifdef ALLOC_PRAGMA
|
||||
|
||||
// Make the initialization routines discardable, so that they
|
||||
// Make the initialization routines discardable, so that they
|
||||
// don't waste space
|
||||
|
||||
#pragma alloc_text(init, DriverEntry)
|
||||
|
@ -464,7 +464,7 @@ static NTSTATUS ParseAnsiName(PUNICODE_STRING Name, PUSHORT Size)
|
|||
*Size -= size1;
|
||||
|
||||
/* Clean whitespace from end of string */
|
||||
while ((size1 > 0) && (Buffer[--size1] == ' '))
|
||||
while ((size1 > 0) && (Buffer[--size1] == ' '))
|
||||
Buffer[size1] = '\0';
|
||||
|
||||
DPRINT("ANSI name: %s\n", Buffer);
|
||||
|
@ -986,7 +986,7 @@ static BOOLEAN CreateLogicalDevice(PISAPNP_DEVICE_EXTENSION DeviceExtension,
|
|||
case ISAPNP_SRIN_CDEVICE_ID:
|
||||
if ((Size == 4) && (compat < MAX_COMPATIBLE_ID)) {
|
||||
Peek(tmp, 4);
|
||||
LogicalDevice->CVendorId[compat] = UCHAR2USHORT(tmp[0], tmp[1]);
|
||||
LogicalDevice->CVendorId[compat] = UCHAR2USHORT(tmp[0], tmp[1]);
|
||||
LogicalDevice->CDeviceId[compat] = UCHAR2USHORT(tmp[2], tmp[3]);
|
||||
compat++;
|
||||
Size = 0;
|
||||
|
@ -1146,7 +1146,7 @@ static BOOLEAN ParseResourceMap(PISAPNP_DEVICE_EXTENSION DeviceExtension,
|
|||
size = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ISAPNP_SRIN_CDEVICE_ID:
|
||||
/* FIXME: Parse compatible IDs */
|
||||
break;
|
||||
|
@ -1433,7 +1433,7 @@ ISAPNPQueryBusRelations(
|
|||
DeviceExtension = (PISAPNP_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
if (Irp->IoStatus.Information) {
|
||||
/* FIXME: Another bus driver has already created a DEVICE_RELATIONS
|
||||
/* FIXME: Another bus driver has already created a DEVICE_RELATIONS
|
||||
structure so we must merge this structure with our own */
|
||||
}
|
||||
|
||||
|
@ -1721,7 +1721,7 @@ ISAPNPAddDevice(
|
|||
NTSTATUS
|
||||
STDCALL
|
||||
DriverEntry(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN PUNICODE_STRING RegistryPath)
|
||||
{
|
||||
DbgPrint("ISA Plug and Play Bus Driver\n");
|
||||
|
|
|
@ -208,7 +208,7 @@ FdoQueryBusRelations(
|
|||
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
if (Irp->IoStatus.Information) {
|
||||
/* FIXME: Another bus driver has already created a DEVICE_RELATIONS
|
||||
/* FIXME: Another bus driver has already created a DEVICE_RELATIONS
|
||||
structure so we must merge this structure with our own */
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#ifdef ALLOC_PRAGMA
|
||||
|
||||
// Make the initialization routines discardable, so that they
|
||||
// Make the initialization routines discardable, so that they
|
||||
// don't waste space
|
||||
|
||||
#pragma alloc_text(init, DriverEntry)
|
||||
|
@ -34,8 +34,8 @@
|
|||
NTSTATUS
|
||||
STDCALL
|
||||
PciDispatchDeviceControl(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION IrpSp;
|
||||
NTSTATUS Status;
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */
|
||||
#define PCI_STATUS_PARITY 0x100 /* Detected parity error */
|
||||
#define PCI_STATUS_DEVSEL_MASK 0x600 /* DEVSEL timing */
|
||||
#define PCI_STATUS_DEVSEL_FAST 0x000
|
||||
#define PCI_STATUS_DEVSEL_FAST 0x000
|
||||
#define PCI_STATUS_DEVSEL_MEDIUM 0x200
|
||||
#define PCI_STATUS_DEVSEL_SLOW 0x400
|
||||
#define PCI_STATUS_SIG_TARGET_ABORT 0x800 /* Set on target abort */
|
||||
|
@ -74,8 +74,8 @@
|
|||
|
||||
/*
|
||||
* Base addresses specify locations in memory or I/O space.
|
||||
* Decoded size can be determined by writing a value of
|
||||
* 0xffffffff to the register, and reading it back. Only
|
||||
* Decoded size can be determined by writing a value of
|
||||
* 0xffffffff to the register, and reading it back. Only
|
||||
* 1 bits are decoded.
|
||||
*/
|
||||
#define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */
|
||||
|
@ -99,7 +99,7 @@
|
|||
/* Header type 0 (normal devices) */
|
||||
#define PCI_CARDBUS_CIS 0x28
|
||||
#define PCI_SUBSYSTEM_VENDOR_ID 0x2c
|
||||
#define PCI_SUBSYSTEM_ID 0x2e
|
||||
#define PCI_SUBSYSTEM_ID 0x2e
|
||||
#define PCI_ROM_ADDRESS 0x30 /* Bits 31..11 are address, 10..1 reserved */
|
||||
#define PCI_ROM_ADDRESS_ENABLE 0x01
|
||||
#define PCI_ROM_ADDRESS_MASK (~0x7ffUL)
|
||||
|
|
|
@ -171,7 +171,7 @@ PdoQueryCapabilities(
|
|||
|
||||
if (DeviceCapabilities->Version != 1)
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
|
||||
|
||||
DeviceCapabilities->UniqueID = FALSE;
|
||||
DeviceCapabilities->Address = DeviceExtension->SlotNumber.u.AsULONG;
|
||||
DeviceCapabilities->UINumber = (ULONG)-1; /* FIXME */
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id:
|
||||
*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS Serial enumerator driver
|
||||
* FILE: drivers/bus/serenum/detect.c
|
||||
* PURPOSE: Detection of serial devices
|
||||
*
|
||||
*
|
||||
* PROGRAMMERS: Jason Filby (jasonfilby@yahoo.com)
|
||||
* Filip Navara (xnavara@volny.cz)
|
||||
* Hervé Poussineau (hpoussin@reactos.com)
|
||||
|
@ -26,9 +26,9 @@ SerenumDeviceIoControl(
|
|||
PIRP Irp;
|
||||
IO_STATUS_BLOCK IoStatus;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
KeInitializeEvent (&Event, NotificationEvent, FALSE);
|
||||
|
||||
|
||||
Irp = IoBuildDeviceIoControlRequest(CtlCode,
|
||||
DeviceObject,
|
||||
InputBuffer,
|
||||
|
@ -43,21 +43,21 @@ SerenumDeviceIoControl(
|
|||
DPRINT("Serenum: IoBuildDeviceIoControlRequest() failed\n");
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
Status = IoCallDriver(DeviceObject, Irp);
|
||||
|
||||
|
||||
if (Status == STATUS_PENDING)
|
||||
{
|
||||
DPRINT("Serenum: Operation pending\n");
|
||||
KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
|
||||
Status = IoStatus.Status;
|
||||
}
|
||||
|
||||
|
||||
if (OutputBufferSize)
|
||||
{
|
||||
*OutputBufferSize = IoStatus.Information;
|
||||
}
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ ReadBytes(
|
|||
KEVENT event;
|
||||
LARGE_INTEGER zero;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
KeInitializeEvent(&event, NotificationEvent, FALSE);
|
||||
zero.QuadPart = 0;
|
||||
Irp = IoBuildSynchronousFsdRequest(
|
||||
|
@ -85,7 +85,7 @@ ReadBytes(
|
|||
&ioStatus);
|
||||
if (!Irp)
|
||||
return FALSE;
|
||||
|
||||
|
||||
Status = IoCallDriver(LowerDevice, Irp);
|
||||
if (Status == STATUS_PENDING)
|
||||
{
|
||||
|
@ -110,9 +110,9 @@ ReportDetectedDevice(
|
|||
PPDO_DEVICE_EXTENSION PdoDeviceExtension = NULL;
|
||||
PFDO_DEVICE_EXTENSION FdoDeviceExtension;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
DPRINT("Serenum: SerenumReportDetectedDevice() called with %wZ (%wZ) detected\n", DeviceId, DeviceDescription);
|
||||
|
||||
|
||||
Status = IoCreateDevice(
|
||||
DeviceObject->DriverObject,
|
||||
sizeof(PDO_DEVICE_EXTENSION),
|
||||
|
@ -122,7 +122,7 @@ ReportDetectedDevice(
|
|||
FALSE,
|
||||
&Pdo);
|
||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||
|
||||
|
||||
Pdo->Flags |= DO_BUS_ENUMERATED_DEVICE;
|
||||
Pdo->Flags |= DO_POWER_PAGABLE;
|
||||
PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)Pdo->DeviceExtension;
|
||||
|
@ -137,17 +137,17 @@ ReportDetectedDevice(
|
|||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||
Status = SerenumDuplicateUnicodeString(&PdoDeviceExtension->CompatibleIds, CompatibleIds, PagedPool);
|
||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||
|
||||
|
||||
/* Device attached to serial port (Pdo) may delegate work to
|
||||
* serial port stack (Fdo = DeviceObject variable) */
|
||||
Pdo->StackSize = DeviceObject->StackSize + 1;
|
||||
|
||||
|
||||
FdoDeviceExtension->AttachedPdo = Pdo;
|
||||
PdoDeviceExtension->AttachedFdo = DeviceObject;
|
||||
|
||||
|
||||
Pdo->Flags |= DO_BUFFERED_IO;
|
||||
Pdo->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
ByeBye:
|
||||
|
@ -200,7 +200,7 @@ SerenumWait(ULONG milliseconds)
|
|||
{
|
||||
KTIMER Timer;
|
||||
LARGE_INTEGER DueTime;
|
||||
|
||||
|
||||
DueTime.QuadPart = milliseconds * -10;
|
||||
KeInitializeTimer(&Timer);
|
||||
KeSetTimer(&Timer, DueTime, NULL);
|
||||
|
@ -224,7 +224,7 @@ SerenumDetectPnpDevice(
|
|||
SERIAL_TIMEOUTS Timeouts;
|
||||
SERIALPERF_STATS PerfStats;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
/* 1. COM port initialization, check for device enumerate */
|
||||
CHECKPOINT;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR,
|
||||
|
@ -239,7 +239,7 @@ SerenumDetectPnpDevice(
|
|||
NULL, 0, &Msr, &Size);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
if ((Msr & SR_MSR_DSR) == 0) goto SerenumDisconnectIdle;
|
||||
|
||||
|
||||
/* 2. COM port setup, 1st phase */
|
||||
CHECKPOINT;
|
||||
BaudRate = SERIAL_BAUD_1200;
|
||||
|
@ -263,7 +263,7 @@ SerenumDetectPnpDevice(
|
|||
NULL, 0, NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
SerenumWait(200);
|
||||
|
||||
|
||||
/* 3. Wait for response, 1st phase */
|
||||
CHECKPOINT;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_RTS,
|
||||
|
@ -279,7 +279,7 @@ SerenumDetectPnpDevice(
|
|||
Status = ReadBytes(LowerDevice, Buffer, sizeof(Buffer), &Size);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
if (Size != 0) goto SerenumCollectPnpComDeviceId;
|
||||
|
||||
|
||||
/* 4. COM port setup, 2nd phase */
|
||||
CHECKPOINT;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR,
|
||||
|
@ -293,7 +293,7 @@ SerenumDetectPnpDevice(
|
|||
&Purge, 0, NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
SerenumWait(200);
|
||||
|
||||
|
||||
/* 5. Wait for response, 2nd phase */
|
||||
CHECKPOINT;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
|
||||
|
@ -310,7 +310,7 @@ SerenumDetectPnpDevice(
|
|||
NULL, 0, &Msr, &Size);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
if ((Msr & SR_MSR_DSR) == 0) goto SerenumVerifyDisconnect; else goto SerenumConnectIdle;
|
||||
|
||||
|
||||
/* 6. Collect PnP COM device ID */
|
||||
SerenumCollectPnpComDeviceId:
|
||||
CHECKPOINT;
|
||||
|
@ -346,7 +346,7 @@ SerenumCollectPnpComDeviceId:
|
|||
NULL, 0, &Msr, &Size);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
if ((Msr & SR_MSR_DSR) == 0) goto SerenumVerifyDisconnect;
|
||||
|
||||
|
||||
/* 7. Verify disconnect */
|
||||
SerenumVerifyDisconnect:
|
||||
CHECKPOINT;
|
||||
|
@ -358,7 +358,7 @@ SerenumVerifyDisconnect:
|
|||
if (!NT_SUCCESS(Status)) return Status;
|
||||
SerenumWait(5000);
|
||||
goto SerenumDisconnectIdle;
|
||||
|
||||
|
||||
/* 8. Connect idle */
|
||||
SerenumConnectIdle:
|
||||
CHECKPOINT;
|
||||
|
@ -382,7 +382,7 @@ SerenumConnectIdle:
|
|||
return STATUS_DEVICE_NOT_CONNECTED;
|
||||
else
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
|
||||
/* 9. Disconnect idle */
|
||||
SerenumDisconnectIdle:
|
||||
CHECKPOINT;
|
||||
|
@ -423,20 +423,20 @@ SerenumDetectLegacyDevice(
|
|||
UNICODE_STRING HardwareIds;
|
||||
UNICODE_STRING CompatibleIds;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
DPRINT("Serenum: SerenumDetectLegacyDevice(DeviceObject %p, LowerDevice %p)\n",
|
||||
DeviceObject,
|
||||
LowerDevice);
|
||||
|
||||
|
||||
RtlZeroMemory(Buffer, sizeof(Buffer));
|
||||
|
||||
|
||||
/* Reset UART */
|
||||
CHECKPOINT;
|
||||
Mcr = 0; /* MCR: DTR/RTS/OUT2 off */
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_MODEM_CONTROL,
|
||||
&Mcr, sizeof(Mcr), NULL, NULL);
|
||||
&Mcr, sizeof(Mcr), NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
|
||||
|
||||
/* Set communications parameters */
|
||||
CHECKPOINT;
|
||||
/* DLAB off */
|
||||
|
@ -456,7 +456,7 @@ SerenumDetectLegacyDevice(
|
|||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL,
|
||||
&LCR, sizeof(LCR), NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
|
||||
|
||||
/* Flush receive buffer */
|
||||
CHECKPOINT;
|
||||
Command = SERIAL_PURGE_RXCLEAR;
|
||||
|
@ -465,7 +465,7 @@ SerenumDetectLegacyDevice(
|
|||
if (!NT_SUCCESS(Status)) return Status;
|
||||
/* Wait 100 ms */
|
||||
SerenumWait(100);
|
||||
|
||||
|
||||
/* Enable DTR/RTS */
|
||||
CHECKPOINT;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
|
||||
|
@ -474,7 +474,7 @@ SerenumDetectLegacyDevice(
|
|||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_RTS,
|
||||
NULL, 0, NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
|
||||
|
||||
/* Set timeout to 500 microseconds */
|
||||
CHECKPOINT;
|
||||
Timeouts.ReadIntervalTimeout = 100;
|
||||
|
@ -484,12 +484,12 @@ SerenumDetectLegacyDevice(
|
|||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS,
|
||||
&Timeouts, sizeof(Timeouts), NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
|
||||
|
||||
/* Fill the read buffer */
|
||||
CHECKPOINT;
|
||||
Status = ReadBytes(LowerDevice, Buffer, sizeof(Buffer)/sizeof(Buffer[0]), &Count);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
|
||||
|
||||
for (i = 0; i < Count; i++)
|
||||
{
|
||||
if (Buffer[i] == 'B')
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id:
|
||||
*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS Serial enumerator driver
|
||||
* FILE: drivers/bus/serenum/fdo.c
|
||||
* PURPOSE: IRP_MJ_PNP operations for FDOs
|
||||
*
|
||||
*
|
||||
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.com)
|
||||
*/
|
||||
|
||||
|
@ -19,9 +19,9 @@ SerenumAddDevice(
|
|||
PDEVICE_OBJECT Fdo;
|
||||
PFDO_DEVICE_EXTENSION DeviceExtension;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
DPRINT("Serenum: SerenumAddDevice called. Pdo = %p\n", Pdo);
|
||||
|
||||
|
||||
/* Create new device object */
|
||||
Status = IoCreateDevice(DriverObject,
|
||||
sizeof(FDO_DEVICE_EXTENSION),
|
||||
|
@ -37,7 +37,7 @@ SerenumAddDevice(
|
|||
}
|
||||
DeviceExtension = (PFDO_DEVICE_EXTENSION)Fdo->DeviceExtension;
|
||||
RtlZeroMemory(DeviceExtension, sizeof(FDO_DEVICE_EXTENSION));
|
||||
|
||||
|
||||
/* Register device interface */
|
||||
Status = IoRegisterDeviceInterface(
|
||||
Pdo,
|
||||
|
@ -50,7 +50,7 @@ SerenumAddDevice(
|
|||
IoDeleteDevice(Fdo);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
DeviceExtension->Common.IsFDO = TRUE;
|
||||
DeviceExtension->Common.PnpState = dsStopped;
|
||||
DeviceExtension->Pdo = Pdo;
|
||||
|
@ -65,7 +65,7 @@ SerenumAddDevice(
|
|||
}
|
||||
Fdo->Flags |= DO_BUFFERED_IO;
|
||||
Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -76,21 +76,21 @@ SerenumFdoStartDevice(
|
|||
{
|
||||
PFDO_DEVICE_EXTENSION DeviceExtension;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
DPRINT("Serenum: SerenumFdoStartDevice() called\n");
|
||||
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
|
||||
ASSERT(DeviceExtension->Common.PnpState == dsStopped);
|
||||
|
||||
|
||||
Status = IoSetDeviceInterfaceState(&DeviceExtension->SerenumInterfaceName, TRUE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Serenum: IoSetDeviceInterfaceState() failed with status 0x%08lx\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
DeviceExtension->Common.PnpState = dsStarted;
|
||||
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -104,10 +104,10 @@ SerenumFdoQueryBusRelations(
|
|||
ULONG NumPDO;
|
||||
ULONG i;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
|
||||
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
ASSERT(DeviceExtension->Common.IsFDO);
|
||||
|
||||
|
||||
/* Do enumeration if needed */
|
||||
if (!(DeviceExtension->Flags & FLAG_ENUMERATION_DONE))
|
||||
{
|
||||
|
@ -124,14 +124,14 @@ SerenumFdoQueryBusRelations(
|
|||
DeviceExtension->Flags |= FLAG_ENUMERATION_DONE;
|
||||
}
|
||||
NumPDO = (DeviceExtension->AttachedPdo != NULL ? 1 : 0);
|
||||
|
||||
|
||||
DeviceRelations = (PDEVICE_RELATIONS)ExAllocatePoolWithTag(
|
||||
PagedPool,
|
||||
sizeof(DEVICE_RELATIONS) + sizeof(PDEVICE_OBJECT) * (NumPDO - 1),
|
||||
SERENUM_TAG);
|
||||
if (!DeviceRelations)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
|
||||
/* Fill returned structure */
|
||||
DeviceRelations->Count = NumPDO;
|
||||
for (i = 0; i < NumPDO; i++)
|
||||
|
@ -139,7 +139,7 @@ SerenumFdoQueryBusRelations(
|
|||
ObReferenceObject(DeviceExtension->AttachedPdo);
|
||||
DeviceRelations->Objects[i] = DeviceExtension->AttachedPdo;
|
||||
}
|
||||
|
||||
|
||||
*pDeviceRelations = DeviceRelations;
|
||||
return Status;
|
||||
}
|
||||
|
@ -153,10 +153,10 @@ SerenumFdoPnp(
|
|||
PIO_STACK_LOCATION Stack;
|
||||
ULONG_PTR Information = 0;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
MinorFunction = Stack->MinorFunction;
|
||||
|
||||
|
||||
switch (MinorFunction)
|
||||
{
|
||||
/* FIXME: do all these minor functions
|
||||
|
@ -196,7 +196,7 @@ SerenumFdoPnp(
|
|||
break;
|
||||
}
|
||||
default:
|
||||
DPRINT1("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
|
||||
DPRINT1("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
|
||||
Stack->Parameters.QueryDeviceRelations.Type);
|
||||
return ForwardIrpAndForget(DeviceObject, Irp);
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ SerenumFdoPnp(
|
|||
return ForwardIrpAndForget(DeviceObject, Irp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Irp->IoStatus.Information = Information;
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id:
|
||||
*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS Serial enumerator driver
|
||||
* FILE: drivers/dd/serenum/misc.c
|
||||
* PURPOSE: Misceallenous operations
|
||||
*
|
||||
*
|
||||
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.com)
|
||||
*/
|
||||
|
||||
|
@ -19,23 +19,23 @@ SerenumDuplicateUnicodeString(
|
|||
IN POOL_TYPE PoolType)
|
||||
{
|
||||
ASSERT(Destination);
|
||||
|
||||
|
||||
if (Source == NULL)
|
||||
{
|
||||
RtlInitUnicodeString(Destination, NULL);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Destination->Buffer = ExAllocatePool(PoolType, Source->MaximumLength);
|
||||
if (Destination->Buffer == NULL)
|
||||
{
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
Destination->MaximumLength = Source->MaximumLength;
|
||||
Destination->Length = Source->Length;
|
||||
RtlCopyMemory(Destination->Buffer, Source->Buffer, Source->MaximumLength);
|
||||
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -53,9 +53,9 @@ SerenumInitMultiSzString(
|
|||
UNICODE_STRING UnicodeString;
|
||||
ULONG DestinationSize = 0;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
|
||||
ASSERT(Destination);
|
||||
|
||||
|
||||
/* Calculate length needed for destination unicode string */
|
||||
va_start(args, Destination);
|
||||
Source = va_arg(args, PCSZ);
|
||||
|
@ -72,7 +72,7 @@ SerenumInitMultiSzString(
|
|||
RtlInitUnicodeString(Destination, NULL);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* Initialize destination string */
|
||||
DestinationSize += sizeof(WCHAR); // final NULL
|
||||
Destination->Buffer = (PWSTR)ExAllocatePoolWithTag(PagedPool, DestinationSize, SERENUM_TAG);
|
||||
|
@ -80,7 +80,7 @@ SerenumInitMultiSzString(
|
|||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
Destination->Length = 0;
|
||||
Destination->MaximumLength = (USHORT)DestinationSize;
|
||||
|
||||
|
||||
/* Copy arguments to destination string */
|
||||
/* Use a temporary unicode string, which buffer is shared with
|
||||
* destination string, to copy arguments */
|
||||
|
@ -133,18 +133,18 @@ ForwardIrpAndWait(
|
|||
PDEVICE_OBJECT LowerDevice;
|
||||
KEVENT Event;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
ASSERT(((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO);
|
||||
LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
|
||||
|
||||
|
||||
ASSERT(LowerDevice);
|
||||
|
||||
|
||||
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
||||
IoCopyCurrentIrpStackLocationToNext(Irp);
|
||||
|
||||
|
||||
DPRINT("Serenum: Calling lower device %p [%wZ]\n", LowerDevice, &LowerDevice->DriverObject->DriverName);
|
||||
IoSetCompletionRoutine(Irp, ForwardIrpAndWaitCompletion, &Event, TRUE, TRUE, TRUE);
|
||||
|
||||
|
||||
Status = IoCallDriver(LowerDevice, Irp);
|
||||
if (Status == STATUS_PENDING)
|
||||
{
|
||||
|
@ -152,7 +152,7 @@ ForwardIrpAndWait(
|
|||
if (NT_SUCCESS(Status))
|
||||
Status = Irp->IoStatus.Status;
|
||||
}
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -163,10 +163,10 @@ ForwardIrpToLowerDeviceAndForget(
|
|||
{
|
||||
PFDO_DEVICE_EXTENSION DeviceExtension;
|
||||
PDEVICE_OBJECT LowerDevice;
|
||||
|
||||
|
||||
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
ASSERT(DeviceExtension->Common.IsFDO);
|
||||
|
||||
|
||||
LowerDevice = DeviceExtension->LowerDevice;
|
||||
ASSERT(LowerDevice);
|
||||
DPRINT("Serenum: calling lower device 0x%p [%wZ]\n",
|
||||
|
@ -182,10 +182,10 @@ ForwardIrpToAttachedFdoAndForget(
|
|||
{
|
||||
PPDO_DEVICE_EXTENSION DeviceExtension;
|
||||
PDEVICE_OBJECT Fdo;
|
||||
|
||||
|
||||
DeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
ASSERT(!DeviceExtension->Common.IsFDO);
|
||||
|
||||
|
||||
Fdo = DeviceExtension->AttachedFdo;
|
||||
ASSERT(Fdo);
|
||||
DPRINT("Serenum: calling attached Fdo 0x%p [%wZ]\n",
|
||||
|
@ -200,11 +200,11 @@ ForwardIrpAndForget(
|
|||
IN PIRP Irp)
|
||||
{
|
||||
PDEVICE_OBJECT LowerDevice;
|
||||
|
||||
|
||||
ASSERT(((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO);
|
||||
LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
|
||||
ASSERT(LowerDevice);
|
||||
|
||||
|
||||
IoSkipCurrentIrpStackLocation(Irp);
|
||||
return IoCallDriver(LowerDevice, Irp);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id:
|
||||
*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS Serial enumerator driver
|
||||
* FILE: drivers/bus/serenum/pdo.c
|
||||
* PURPOSE: IRP_MJ_PNP operations for PDOs
|
||||
*
|
||||
*
|
||||
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.com)
|
||||
*/
|
||||
|
||||
|
@ -16,11 +16,11 @@ SerenumPdoStartDevice(
|
|||
IN PDEVICE_OBJECT DeviceObject)
|
||||
{
|
||||
PPDO_DEVICE_EXTENSION DeviceExtension;
|
||||
|
||||
|
||||
DeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
|
||||
ASSERT(DeviceExtension->Common.PnpState == dsStopped);
|
||||
|
||||
|
||||
DeviceExtension->Common.PnpState = dsStarted;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -36,11 +36,11 @@ SerenumPdoQueryId(
|
|||
PUNICODE_STRING SourceString;
|
||||
UNICODE_STRING String;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
IdType = IoGetCurrentIrpStackLocation(Irp)->Parameters.QueryId.IdType;
|
||||
DeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
RtlInitUnicodeString(&String, NULL);
|
||||
|
||||
|
||||
switch (IdType)
|
||||
{
|
||||
case BusQueryDeviceID:
|
||||
|
@ -71,7 +71,7 @@ SerenumPdoQueryId(
|
|||
DPRINT1("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_ID / unknown query id type 0x%lx\n", IdType);
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
Status = SerenumDuplicateUnicodeString(
|
||||
&String,
|
||||
SourceString,
|
||||
|
@ -87,21 +87,21 @@ SerenumPdoQueryDeviceRelations(
|
|||
{
|
||||
PFDO_DEVICE_EXTENSION DeviceExtension;
|
||||
PDEVICE_RELATIONS DeviceRelations;
|
||||
|
||||
|
||||
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
ASSERT(DeviceExtension->Common.IsFDO);
|
||||
|
||||
|
||||
DeviceRelations = (PDEVICE_RELATIONS)ExAllocatePoolWithTag(
|
||||
PagedPool,
|
||||
sizeof(DEVICE_RELATIONS),
|
||||
SERENUM_TAG);
|
||||
if (!DeviceRelations)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
|
||||
ObReferenceObject(DeviceObject);
|
||||
DeviceRelations->Count = 1;
|
||||
DeviceRelations->Objects[0] = DeviceObject;
|
||||
|
||||
|
||||
*pDeviceRelations = DeviceRelations;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -115,10 +115,10 @@ SerenumPdoPnp(
|
|||
PIO_STACK_LOCATION Stack;
|
||||
ULONG_PTR Information = 0;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
MinorFunction = Stack->MinorFunction;
|
||||
|
||||
|
||||
switch (MinorFunction)
|
||||
{
|
||||
/* FIXME: do all these minor functions
|
||||
|
@ -165,7 +165,7 @@ SerenumPdoPnp(
|
|||
}
|
||||
default:
|
||||
{
|
||||
DPRINT1("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
|
||||
DPRINT1("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
|
||||
Stack->Parameters.QueryDeviceRelations.Type);
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
|
@ -178,7 +178,7 @@ SerenumPdoPnp(
|
|||
PDEVICE_CAPABILITIES DeviceCapabilities;
|
||||
ULONG i;
|
||||
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_CAPABILITIES\n");
|
||||
|
||||
|
||||
DeviceCapabilities = (PDEVICE_CAPABILITIES)Stack->Parameters.DeviceCapabilities.Capabilities;
|
||||
/* FIXME: capabilities can change with connected device */
|
||||
DeviceCapabilities->LockSupported = FALSE;
|
||||
|
@ -234,7 +234,7 @@ SerenumPdoPnp(
|
|||
PUNICODE_STRING Source;
|
||||
PWSTR Description;
|
||||
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / DeviceTextDescription\n");
|
||||
|
||||
|
||||
Source = &((PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->DeviceDescription;
|
||||
Description = ExAllocatePool(PagedPool, Source->Length + sizeof(WCHAR));
|
||||
if (!Description)
|
||||
|
@ -279,7 +279,7 @@ SerenumPdoPnp(
|
|||
{
|
||||
PPNP_BUS_INFORMATION BusInfo;
|
||||
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_BUS_INFORMATION\n");
|
||||
|
||||
|
||||
BusInfo = (PPNP_BUS_INFORMATION)ExAllocatePool(PagedPool, sizeof(PNP_BUS_INFORMATION));
|
||||
if (!BusInfo)
|
||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
@ -306,7 +306,7 @@ SerenumPdoPnp(
|
|||
Status = Irp->IoStatus.Status;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Irp->IoStatus.Information = Information;
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id:
|
||||
*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS Serial enumerator driver
|
||||
* FILE: drivers/bus/serenum/serenum.c
|
||||
* PURPOSE: Serial enumeration driver entry point
|
||||
*
|
||||
*
|
||||
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.com)
|
||||
*/
|
||||
|
||||
|
@ -35,7 +35,7 @@ IrpStub(
|
|||
IN PIRP Irp)
|
||||
{
|
||||
NTSTATUS Status = STATUS_NOT_SUPPORTED;
|
||||
|
||||
|
||||
if (((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
|
||||
{
|
||||
/* Forward some IRPs to lower device */
|
||||
|
@ -82,7 +82,7 @@ IrpStub(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return Status;
|
||||
|
@ -97,16 +97,16 @@ DriverEntry(
|
|||
IN PUNICODE_STRING RegPath)
|
||||
{
|
||||
ULONG i;
|
||||
|
||||
|
||||
DriverObject->DriverUnload = DriverUnload;
|
||||
DriverObject->DriverExtension->AddDevice = SerenumAddDevice;
|
||||
|
||||
|
||||
for (i = 0; i < IRP_MJ_MAXIMUM_FUNCTION; i++)
|
||||
DriverObject->MajorFunction[i] = IrpStub;
|
||||
|
||||
|
||||
//DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = SerialQueryInformation;
|
||||
DriverObject->MajorFunction[IRP_MJ_PNP] = SerenumPnp;
|
||||
//DriverObject->MajorFunction[IRP_MJ_POWER] = SerialPower;
|
||||
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -3,41 +3,41 @@
|
|||
#include <ddk/ntddser.h>
|
||||
#include <ddk/wdmguid.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#define SR_MSR_DSR 0x20
|
||||
#define ExFreePoolWithTag(p, tag) ExFreePool(p)
|
||||
|
||||
|
||||
/* FIXME: these prototypes MUST NOT be here! */
|
||||
NTSTATUS STDCALL
|
||||
IoAttachDeviceToDeviceStackSafe(
|
||||
IN PDEVICE_OBJECT SourceDevice,
|
||||
IN PDEVICE_OBJECT TargetDevice,
|
||||
OUT PDEVICE_OBJECT *AttachedToDeviceObject);
|
||||
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
#include <ntddk.h>
|
||||
#include <ntddser.h>
|
||||
#include <c:/progra~1/winddk/inc/ddk/wdm/wxp/wdmguid.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#define STDCALL
|
||||
|
||||
|
||||
#define DPRINT1 DbgPrint("(%s:%d) ", __FILE__, __LINE__), DbgPrint
|
||||
#define CHECKPOINT1 DbgPrint("(%s:%d)\n")
|
||||
|
||||
|
||||
#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
|
||||
|
||||
|
||||
NTSTATUS STDCALL
|
||||
IoAttachDeviceToDeviceStackSafe(
|
||||
IN PDEVICE_OBJECT SourceDevice,
|
||||
IN PDEVICE_OBJECT TargetDevice,
|
||||
OUT PDEVICE_OBJECT *AttachedToDeviceObject);
|
||||
|
||||
|
||||
#define DPRINT DPRINT1
|
||||
#define CHECKPOINT CHECKPOINT1
|
||||
|
||||
|
||||
#define SR_MSR_DSR 0x20
|
||||
#else
|
||||
#error Unknown compiler!
|
||||
|
@ -61,13 +61,13 @@ typedef struct _COMMON_DEVICE_EXTENSION
|
|||
typedef struct _FDO_DEVICE_EXTENSION
|
||||
{
|
||||
COMMON_DEVICE_EXTENSION Common;
|
||||
|
||||
|
||||
PDEVICE_OBJECT LowerDevice;
|
||||
PDEVICE_OBJECT Pdo;
|
||||
IO_REMOVE_LOCK RemoveLock;
|
||||
|
||||
|
||||
UNICODE_STRING SerenumInterfaceName;
|
||||
|
||||
|
||||
PDEVICE_OBJECT AttachedPdo;
|
||||
ULONG Flags;
|
||||
} FDO_DEVICE_EXTENSION, *PFDO_DEVICE_EXTENSION;
|
||||
|
@ -75,9 +75,9 @@ typedef struct _FDO_DEVICE_EXTENSION
|
|||
typedef struct _PDO_DEVICE_EXTENSION
|
||||
{
|
||||
COMMON_DEVICE_EXTENSION Common;
|
||||
|
||||
|
||||
PDEVICE_OBJECT AttachedFdo;
|
||||
|
||||
|
||||
UNICODE_STRING DeviceDescription; // REG_SZ
|
||||
UNICODE_STRING DeviceId; // REG_SZ
|
||||
UNICODE_STRING HardwareIds; // REG_MULTI_SZ
|
||||
|
|
|
@ -220,23 +220,23 @@ ScrWrite(PDEVICE_OBJECT DeviceObject,
|
|||
vidmem[(cursorx * 2) + (cursory * columns * 2)] = ' ';
|
||||
vidmem[(cursorx * 2) + (cursory * columns * 2) + 1] = (char) DeviceExtension->CharAttribute;
|
||||
break;
|
||||
|
||||
|
||||
case '\n':
|
||||
cursory++;
|
||||
cursorx = 0;
|
||||
break;
|
||||
|
||||
|
||||
case '\r':
|
||||
cursorx = 0;
|
||||
break;
|
||||
|
||||
|
||||
case '\t':
|
||||
offset = TAB_WIDTH - (cursorx % TAB_WIDTH);
|
||||
for (j = 0; j < offset; j++)
|
||||
{
|
||||
vidmem[(cursorx * 2) + (cursory * columns * 2)] = ' ';
|
||||
cursorx++;
|
||||
|
||||
|
||||
if (cursorx >= columns)
|
||||
{
|
||||
cursory++;
|
||||
|
@ -244,7 +244,7 @@ ScrWrite(PDEVICE_OBJECT DeviceObject,
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
vidmem[(cursorx * 2) + (cursory * columns * 2)] = *pch;
|
||||
vidmem[(cursorx * 2) + (cursory * columns * 2) + 1] = (char) DeviceExtension->CharAttribute;
|
||||
|
@ -278,7 +278,7 @@ ScrWrite(PDEVICE_OBJECT DeviceObject,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Set the cursor position */
|
||||
offset = (cursory * columns) + cursorx;
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ ScrIoControl(PDEVICE_OBJECT DeviceObject,
|
|||
}
|
||||
|
||||
Buf->dwTransfered = Buf->nLength;
|
||||
|
||||
|
||||
Irp->IoStatus.Information = 0;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -224,7 +224,7 @@ InbvInitVGAMode(VOID)
|
|||
BOOL STDCALL
|
||||
VidResetDisplay(VOID)
|
||||
{
|
||||
/*
|
||||
/*
|
||||
* We are only using standard VGA facilities so we can rely on the
|
||||
* HAL 'int10mode3' reset to cleanup the hardware state.
|
||||
*/
|
||||
|
@ -368,17 +368,17 @@ InbvDisplayCompressedBitmap()
|
|||
while ((j < bminfo->bV5SizeImage) && (k < (ULONG) (bminfo->bV5Width * bminfo->bV5Height)))
|
||||
{
|
||||
unsigned char b;
|
||||
|
||||
|
||||
clen = BootimageBitmap[bfOffBits + j];
|
||||
j++;
|
||||
|
||||
|
||||
if (clen > 0)
|
||||
{
|
||||
/* Encoded mode */
|
||||
|
||||
|
||||
b = BootimageBitmap[bfOffBits + j];
|
||||
j++;
|
||||
|
||||
|
||||
for (i = 0; i < (clen / 2); i++)
|
||||
{
|
||||
ImageData[k] = (b & 0xf0) >> 4;
|
||||
|
@ -397,7 +397,7 @@ InbvDisplayCompressedBitmap()
|
|||
/* Absolute mode */
|
||||
b = BootimageBitmap[bfOffBits + j];
|
||||
j++;
|
||||
|
||||
|
||||
if (b == 0)
|
||||
{
|
||||
/* End of line */
|
||||
|
@ -428,13 +428,13 @@ InbvDisplayCompressedBitmap()
|
|||
{
|
||||
DPRINT("Unaligned copy!\n");
|
||||
}
|
||||
|
||||
|
||||
clen = b;
|
||||
for (i = 0; i < (clen / 2); i++)
|
||||
{
|
||||
b = BootimageBitmap[bfOffBits + j];
|
||||
j++;
|
||||
|
||||
|
||||
ImageData[k] = (b & 0xf0) >> 4;
|
||||
k++;
|
||||
ImageData[k] = b & 0xf;
|
||||
|
@ -559,7 +559,7 @@ VidInitialize(VOID)
|
|||
|
||||
InbvMapVideoMemory();
|
||||
InbvInitVGAMode();
|
||||
|
||||
|
||||
Status = PsCreateSystemThread(
|
||||
&BitmapThreadHandle,
|
||||
THREAD_ALL_ACCESS,
|
||||
|
@ -568,7 +568,7 @@ VidInitialize(VOID)
|
|||
&BitmapThreadId,
|
||||
InbvBitmapThreadMain,
|
||||
NULL);
|
||||
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return FALSE;
|
||||
|
@ -586,7 +586,7 @@ VidDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
|
|||
PIO_STACK_LOCATION IrpSp;
|
||||
NTSTATUS Status;
|
||||
NTBOOTVID_FUNCTION_TABLE* FunctionTable;
|
||||
|
||||
|
||||
IrpSp = IoGetCurrentIrpStackLocation(Irp);
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
|
@ -609,7 +609,7 @@ VidDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
|
|||
break;
|
||||
|
||||
case IOCTL_BOOTVID_CLEANUP:
|
||||
VidCleanUp();
|
||||
VidCleanUp();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -45,44 +45,44 @@ typedef long FXPT2DOT30;
|
|||
|
||||
typedef struct tagCIEXYZ
|
||||
{
|
||||
FXPT2DOT30 ciexyzX;
|
||||
FXPT2DOT30 ciexyzY;
|
||||
FXPT2DOT30 ciexyzZ;
|
||||
FXPT2DOT30 ciexyzX;
|
||||
FXPT2DOT30 ciexyzY;
|
||||
FXPT2DOT30 ciexyzZ;
|
||||
} CIEXYZ, *LPCIEXYZ;
|
||||
|
||||
typedef struct tagCIEXYZTRIPLE
|
||||
{
|
||||
CIEXYZ ciexyzRed;
|
||||
CIEXYZ ciexyzGreen;
|
||||
CIEXYZ ciexyzBlue;
|
||||
CIEXYZ ciexyzRed;
|
||||
CIEXYZ ciexyzGreen;
|
||||
CIEXYZ ciexyzBlue;
|
||||
} CIEXYZTRIPLE, *LPCIEXYZTRIPLE;
|
||||
|
||||
typedef struct {
|
||||
DWORD bV5Size;
|
||||
LONG bV5Width;
|
||||
LONG bV5Height;
|
||||
WORD bV5Planes;
|
||||
WORD bV5BitCount;
|
||||
DWORD bV5Compression;
|
||||
DWORD bV5SizeImage;
|
||||
LONG bV5XPelsPerMeter;
|
||||
LONG bV5YPelsPerMeter;
|
||||
DWORD bV5ClrUsed;
|
||||
DWORD bV5ClrImportant;
|
||||
DWORD bV5RedMask;
|
||||
DWORD bV5GreenMask;
|
||||
DWORD bV5BlueMask;
|
||||
DWORD bV5AlphaMask;
|
||||
DWORD bV5CSType;
|
||||
CIEXYZTRIPLE bV5Endpoints;
|
||||
DWORD bV5GammaRed;
|
||||
DWORD bV5GammaGreen;
|
||||
DWORD bV5GammaBlue;
|
||||
DWORD bV5Intent;
|
||||
DWORD bV5ProfileData;
|
||||
DWORD bV5ProfileSize;
|
||||
DWORD bV5Reserved;
|
||||
} BITMAPV5HEADER, *PBITMAPV5HEADER;
|
||||
typedef struct {
|
||||
DWORD bV5Size;
|
||||
LONG bV5Width;
|
||||
LONG bV5Height;
|
||||
WORD bV5Planes;
|
||||
WORD bV5BitCount;
|
||||
DWORD bV5Compression;
|
||||
DWORD bV5SizeImage;
|
||||
LONG bV5XPelsPerMeter;
|
||||
LONG bV5YPelsPerMeter;
|
||||
DWORD bV5ClrUsed;
|
||||
DWORD bV5ClrImportant;
|
||||
DWORD bV5RedMask;
|
||||
DWORD bV5GreenMask;
|
||||
DWORD bV5BlueMask;
|
||||
DWORD bV5AlphaMask;
|
||||
DWORD bV5CSType;
|
||||
CIEXYZTRIPLE bV5Endpoints;
|
||||
DWORD bV5GammaRed;
|
||||
DWORD bV5GammaGreen;
|
||||
DWORD bV5GammaBlue;
|
||||
DWORD bV5Intent;
|
||||
DWORD bV5ProfileData;
|
||||
DWORD bV5ProfileSize;
|
||||
DWORD bV5Reserved;
|
||||
} BITMAPV5HEADER, *PBITMAPV5HEADER;
|
||||
|
||||
/*
|
||||
* Private driver structures
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
* NOTES:
|
||||
* In your usermode application, do something like this:
|
||||
*
|
||||
* DebugHandle = CreateFile("\\\\.\\DebugOut",
|
||||
* GENERIC_WRITE,
|
||||
* 0,
|
||||
* DebugHandle = CreateFile("\\\\.\\DebugOut",
|
||||
* GENERIC_WRITE,
|
||||
* 0,
|
||||
* NULL,
|
||||
* OPEN_EXISTING,
|
||||
* FILE_ATTRIBUTE_NORMAL,
|
||||
* OPEN_EXISTING,
|
||||
* FILE_ATTRIBUTE_NORMAL,
|
||||
* NULL);
|
||||
*
|
||||
* and write to your hearts content to DebugHandle.
|
||||
|
@ -35,7 +35,7 @@ DebugOutDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
|
|||
char Buf[513];
|
||||
unsigned Remaining;
|
||||
unsigned Length;
|
||||
|
||||
|
||||
nErrCode = STATUS_SUCCESS;
|
||||
|
||||
switch(piosStack->MajorFunction)
|
||||
|
@ -88,7 +88,7 @@ DebugOutUnload(PDRIVER_OBJECT DriverObject)
|
|||
{
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
NTSTATUS STDCALL
|
||||
DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
|
||||
{
|
||||
PDEVICE_OBJECT DebugOutDevice;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id:
|
||||
*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS VT100 emulator
|
||||
* FILE: drivers/dd/green/createclose.c
|
||||
* PURPOSE: IRP_MJ_CREATE, IRP_MJ_CLOSE and IRP_MJ_CLEANUP operations
|
||||
*
|
||||
*
|
||||
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.com)
|
||||
*/
|
||||
|
||||
|
@ -17,7 +17,7 @@ GreenCreate(
|
|||
IN PIRP Irp)
|
||||
{
|
||||
DPRINT("Green: IRP_MJ_CREATE\n");
|
||||
|
||||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
@ -30,7 +30,7 @@ GreenClose(
|
|||
IN PIRP Irp)
|
||||
{
|
||||
DPRINT("Green: IRP_MJ_CLOSE\n");
|
||||
|
||||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id:
|
||||
*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS VT100 emulator
|
||||
* FILE: drivers/dd/green/dispatch.c
|
||||
* PURPOSE: Dispatch routines
|
||||
*
|
||||
*
|
||||
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.com)
|
||||
*/
|
||||
|
||||
|
@ -20,16 +20,16 @@ GreenDispatch(
|
|||
GREEN_DEVICE_TYPE DeviceType;
|
||||
ULONG_PTR Information;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
MajorFunction = IoGetCurrentIrpStackLocation(Irp)->MajorFunction;
|
||||
DeviceType = ((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Type;
|
||||
|
||||
|
||||
Information = Irp->IoStatus.Information;
|
||||
Status = Irp->IoStatus.Status;
|
||||
|
||||
|
||||
DPRINT("Green: Dispatching major function 0x%lx, DeviceType %d\n",
|
||||
MajorFunction, DeviceType);
|
||||
|
||||
|
||||
if (MajorFunction == IRP_MJ_CREATE && DeviceType == Green)
|
||||
return GreenCreate(DeviceObject, Irp);
|
||||
else if (MajorFunction == IRP_MJ_CLOSE && DeviceType == Green)
|
||||
|
@ -57,7 +57,7 @@ GreenDispatch(
|
|||
DPRINT1("Green: unknown combination: MajorFunction 0x%lx, DeviceType %d\n",
|
||||
MajorFunction, DeviceType);
|
||||
}
|
||||
|
||||
|
||||
Irp->IoStatus.Information = Information;
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest (Irp, IO_NO_INCREMENT);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id:
|
||||
*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS VT100 emulator
|
||||
* FILE: drivers/dd/green/green.c
|
||||
* PURPOSE: Driver entry point
|
||||
*
|
||||
*
|
||||
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.com)
|
||||
*/
|
||||
|
||||
|
@ -26,19 +26,19 @@ DriverEntry(
|
|||
IN PUNICODE_STRING RegPath)
|
||||
{
|
||||
ULONG i;
|
||||
|
||||
|
||||
DriverObject->DriverUnload = DriverUnload;
|
||||
DriverObject->DriverExtension->AddDevice = GreenAddDevice;
|
||||
|
||||
|
||||
for (i = 0; i < IRP_MJ_MAXIMUM_FUNCTION; i++)
|
||||
DriverObject->MajorFunction[i] = GreenDispatch;
|
||||
|
||||
|
||||
/* keyboard only */
|
||||
//DriverObject->DriverStartIo = GreenStartIo;
|
||||
|
||||
|
||||
/* keyboard and screen */
|
||||
DriverObject->MajorFunction[IRP_MJ_CREATE] = GreenCreate;
|
||||
DriverObject->MajorFunction[IRP_MJ_CLOSE] = GreenClose;
|
||||
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -4,19 +4,19 @@
|
|||
#include <ntos/halfuncs.h>
|
||||
#include <ddk/ntddblue.h>
|
||||
#include <ddk/ntddkbd.h> /* should be in kbdmou.h */
|
||||
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
|
||||
/* FIXME: should be in kbdmou.h */
|
||||
typedef struct _CONNECT_DATA {
|
||||
PDEVICE_OBJECT ClassDeviceObject;
|
||||
PVOID ClassService;
|
||||
} CONNECT_DATA, *PCONNECT_DATA;
|
||||
|
||||
|
||||
/* FIXME: should be in kbdmou.h */
|
||||
#define IOCTL_INTERNAL_KEYBOARD_CONNECT \
|
||||
CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0080, METHOD_NEITHER, FILE_ANY_ACCESS)
|
||||
|
||||
|
||||
NTSTATUS STDCALL
|
||||
ObReferenceObjectByName(PUNICODE_STRING ObjectPath,
|
||||
ULONG Attributes,
|
||||
|
@ -26,25 +26,25 @@
|
|||
KPROCESSOR_MODE AccessMode,
|
||||
PVOID ParseContext,
|
||||
PVOID* ObjectPtr);
|
||||
|
||||
|
||||
/* FIXME: should be in kbdmou.h */
|
||||
typedef VOID (*PSERVICE_CALLBACK_ROUTINE)(PDEVICE_OBJECT, PKEYBOARD_INPUT_DATA, PKEYBOARD_INPUT_DATA, PULONG);
|
||||
|
||||
|
||||
typedef struct _CLASS_INFORMATION
|
||||
{
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
PVOID CallBack;
|
||||
} CLASS_INFORMATION, *PCLASS_INFORMATION;
|
||||
|
||||
|
||||
#define KEYBOARD_BUFFER_SIZE 100
|
||||
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
#include <ntddk.h>
|
||||
#include <ntddser.h>
|
||||
#include <kbdmou.h>
|
||||
|
||||
#define STDCALL
|
||||
|
||||
|
||||
#define DPRINT1 DbgPrint("(%s:%d) ", __FILE__, __LINE__), DbgPrint
|
||||
#define CHECKPOINT1 DbgPrint("(%s:%d)\n", __FILE__, __LINE__)
|
||||
#define DPRINT DPRINT1
|
||||
|
@ -69,11 +69,11 @@ typedef struct _KEYBOARD_DEVICE_EXTENSION
|
|||
{
|
||||
COMMON_DEVICE_EXTENSION Common;
|
||||
PDEVICE_OBJECT Green;
|
||||
|
||||
|
||||
CLASS_INFORMATION ClassInformation;
|
||||
HANDLE WorkerThreadHandle;
|
||||
KDPC KeyboardDpc;
|
||||
|
||||
|
||||
ULONG ActiveQueue;
|
||||
ULONG InputDataCount[2];
|
||||
KEYBOARD_INPUT_DATA KeyboardInputData[2][KEYBOARD_BUFFER_SIZE];
|
||||
|
@ -83,7 +83,7 @@ typedef struct _SCREEN_DEVICE_EXTENSION
|
|||
{
|
||||
COMMON_DEVICE_EXTENSION Common;
|
||||
PDEVICE_OBJECT Green;
|
||||
|
||||
|
||||
PUCHAR VideoMemory; /* Pointer to video memory */
|
||||
USHORT CharAttribute; /* Current color attribute */
|
||||
ULONG Mode;
|
||||
|
@ -91,9 +91,9 @@ typedef struct _SCREEN_DEVICE_EXTENSION
|
|||
UCHAR Rows; /* Number of rows */
|
||||
UCHAR Columns; /* Number of columns */
|
||||
UCHAR TabWidth;
|
||||
|
||||
|
||||
ULONG LogicalOffset; /* Position of the cursor */
|
||||
|
||||
|
||||
UCHAR SendBuffer[1024];
|
||||
ULONG SendBufferPosition;
|
||||
} SCREEN_DEVICE_EXTENSION, *PSCREEN_DEVICE_EXTENSION;
|
||||
|
@ -102,12 +102,12 @@ typedef struct _GREEN_DEVICE_EXTENSION
|
|||
{
|
||||
COMMON_DEVICE_EXTENSION Common;
|
||||
PDEVICE_OBJECT Serial;
|
||||
|
||||
|
||||
PDEVICE_OBJECT LowerDevice;
|
||||
ULONG BaudRate;
|
||||
SERIAL_LINE_CONTROL LineControl;
|
||||
SERIAL_TIMEOUTS Timeouts;
|
||||
|
||||
|
||||
PDEVICE_OBJECT Keyboard;
|
||||
PDEVICE_OBJECT Screen;
|
||||
} GREEN_DEVICE_EXTENSION, *PGREEN_DEVICE_EXTENSION;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id:
|
||||
*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS VT100 emulator
|
||||
* FILE: drivers/dd/green/keyboard.c
|
||||
* PURPOSE: Keyboard part of green management
|
||||
*
|
||||
*
|
||||
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.com)
|
||||
*/
|
||||
|
||||
|
@ -21,14 +21,14 @@ TranslateCharToScanCodes(
|
|||
{
|
||||
BOOLEAN NormalKey = FALSE;
|
||||
USHORT MakeCode;
|
||||
|
||||
|
||||
if (InputBufferSize == 0)
|
||||
return FALSE;
|
||||
|
||||
|
||||
switch (*InputBuffer)
|
||||
{
|
||||
case 0x1b: MakeCode = 0x01; NormalKey = TRUE; break; /* ESC */
|
||||
|
||||
|
||||
case '1': MakeCode = 0x02; NormalKey = TRUE; break;
|
||||
case '2': MakeCode = 0x03; NormalKey = TRUE; break;
|
||||
case '3': MakeCode = 0x04; NormalKey = TRUE; break;
|
||||
|
@ -42,7 +42,7 @@ TranslateCharToScanCodes(
|
|||
case '-': MakeCode = 0x0c; NormalKey = TRUE; break;
|
||||
case '=': MakeCode = 0x0d; NormalKey = TRUE; break;
|
||||
case '\b': MakeCode = 0x0e; NormalKey = TRUE; break;
|
||||
|
||||
|
||||
case '\t': MakeCode = 0x0f; NormalKey = TRUE; break;
|
||||
case 'q': MakeCode = 0x10; NormalKey = TRUE; break;
|
||||
case 'w': MakeCode = 0x11; NormalKey = TRUE; break;
|
||||
|
@ -56,9 +56,9 @@ TranslateCharToScanCodes(
|
|||
case 'p': MakeCode = 0x19; NormalKey = TRUE; break;
|
||||
case '[': MakeCode = 0x1a; NormalKey = TRUE; break;
|
||||
case ']': MakeCode = 0x1b; NormalKey = TRUE; break;
|
||||
|
||||
|
||||
case '\r': MakeCode = 0x1c; NormalKey = TRUE; break;
|
||||
|
||||
|
||||
case 'a': MakeCode = 0x1e; NormalKey = TRUE; break;
|
||||
case 's': MakeCode = 0x1f; NormalKey = TRUE; break;
|
||||
case 'd': MakeCode = 0x20; NormalKey = TRUE; break;
|
||||
|
@ -70,11 +70,11 @@ TranslateCharToScanCodes(
|
|||
case 'l': MakeCode = 0x26; NormalKey = TRUE; break;
|
||||
case ';': MakeCode = 0x27; NormalKey = TRUE; break;
|
||||
case '\'': MakeCode = 0x28; NormalKey = TRUE; break;
|
||||
|
||||
|
||||
case '`': MakeCode = 0x29; NormalKey = TRUE; break;
|
||||
|
||||
|
||||
case '\\': MakeCode = 0x2b; NormalKey = TRUE; break;
|
||||
|
||||
|
||||
case 'z': MakeCode = 0x2c; NormalKey = TRUE; break;
|
||||
case 'x': MakeCode = 0x2d; NormalKey = TRUE; break;
|
||||
case 'c': MakeCode = 0x2e; NormalKey = TRUE; break;
|
||||
|
@ -85,7 +85,7 @@ TranslateCharToScanCodes(
|
|||
case ',': MakeCode = 0x33; NormalKey = TRUE; break;
|
||||
case '.': MakeCode = 0x34; NormalKey = TRUE; break;
|
||||
case '/': MakeCode = 0x35; NormalKey = TRUE; break;
|
||||
|
||||
|
||||
case ' ': MakeCode = 0x39; NormalKey = TRUE; break;
|
||||
}
|
||||
if (NormalKey && *OutputBufferSize >= 2)
|
||||
|
@ -97,7 +97,7 @@ TranslateCharToScanCodes(
|
|||
*BytesConsumed = 2;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* Consume strange character by ignoring it */
|
||||
DPRINT1("Green: strange byte received 0x%02x ('%c')\n",
|
||||
*InputBuffer, *InputBuffer >= 32 ? *InputBuffer : '.');
|
||||
|
@ -114,9 +114,9 @@ KeyboardInitialize(
|
|||
PKEYBOARD_DEVICE_EXTENSION DeviceExtension;
|
||||
UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\KeyboardClass1");
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
DPRINT("Green: KeyboardInitialize() called\n");
|
||||
|
||||
|
||||
Status = IoCreateDevice(DriverObject,
|
||||
sizeof(KEYBOARD_DEVICE_EXTENSION),
|
||||
&DeviceName, /* FIXME: don't hardcode string */
|
||||
|
@ -126,15 +126,15 @@ KeyboardInitialize(
|
|||
&Fdo);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
|
||||
|
||||
DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)Fdo->DeviceExtension;
|
||||
RtlZeroMemory(DeviceExtension, sizeof(KEYBOARD_DEVICE_EXTENSION));
|
||||
DeviceExtension->Common.Type = Keyboard;
|
||||
Fdo->Flags |= DO_POWER_PAGABLE | DO_BUFFERED_IO;
|
||||
Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||
|
||||
|
||||
*KeyboardFdo = Fdo;
|
||||
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -148,9 +148,9 @@ KeyboardDpcSendData(
|
|||
PKEYBOARD_DEVICE_EXTENSION DeviceExtension;
|
||||
ULONG Queue;
|
||||
ULONG InputDataConsumed;
|
||||
|
||||
|
||||
DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)pDeviceExtension;
|
||||
|
||||
|
||||
Queue = DeviceExtension->ActiveQueue % 2;
|
||||
InterlockedIncrement((PLONG)&DeviceExtension->ActiveQueue);
|
||||
(*(PSERVICE_CALLBACK_ROUTINE)DeviceExtension->ClassInformation.CallBack)(
|
||||
|
@ -158,7 +158,7 @@ KeyboardDpcSendData(
|
|||
DeviceExtension->KeyboardInputData[Queue],
|
||||
&DeviceExtension->KeyboardInputData[Queue][DeviceExtension->InputDataCount[Queue]],
|
||||
&InputDataConsumed);
|
||||
|
||||
|
||||
DeviceExtension->InputDataCount[Queue] = 0;
|
||||
}
|
||||
static VOID STDCALL
|
||||
|
@ -180,22 +180,22 @@ KeyboardDeviceWorker(
|
|||
ULONG BytesConsumed;
|
||||
PKEYBOARD_INPUT_DATA Input;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
DPRINT("Green: KeyboardDeviceWorker() called\n");
|
||||
|
||||
|
||||
DeviceObject = (PDEVICE_OBJECT)Context;
|
||||
DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
GreenDeviceExtension = (PGREEN_DEVICE_EXTENSION)DeviceExtension->Green->DeviceExtension;
|
||||
LowerDevice = GreenDeviceExtension->Serial;
|
||||
BufferSize = sizeof(Buffer);
|
||||
|
||||
|
||||
/* Initialize device extension */
|
||||
DeviceExtension->ActiveQueue = 0;
|
||||
DeviceExtension->InputDataCount[0] = 0;
|
||||
DeviceExtension->InputDataCount[1] = 0;
|
||||
KeInitializeDpc(&DeviceExtension->KeyboardDpc, KeyboardDpcSendData, DeviceExtension);
|
||||
RtlZeroMemory(&DeviceExtension->KeyboardInputData, sizeof(DeviceExtension->KeyboardInputData));
|
||||
|
||||
|
||||
/* main read loop */
|
||||
while (TRUE)
|
||||
{
|
||||
|
@ -214,7 +214,7 @@ KeyboardDeviceWorker(
|
|||
KeStallExecutionProcessor(10);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Status = IoCallDriver(LowerDevice, Irp);
|
||||
if (Status == STATUS_PENDING)
|
||||
{
|
||||
|
@ -223,15 +223,15 @@ KeyboardDeviceWorker(
|
|||
}
|
||||
if (!NT_SUCCESS(Status))
|
||||
continue;
|
||||
|
||||
|
||||
/* Read all available data and process */
|
||||
i = 0;
|
||||
while (i < ioStatus.Information)
|
||||
{
|
||||
Queue = DeviceExtension->ActiveQueue % 2;
|
||||
|
||||
|
||||
Input = &DeviceExtension->KeyboardInputData[Queue][DeviceExtension->InputDataCount[Queue]];
|
||||
|
||||
|
||||
/* Translate current chars to scan codes */
|
||||
SpaceInQueue = KEYBOARD_BUFFER_SIZE - DeviceExtension->InputDataCount[Queue];
|
||||
if (TranslateCharToScanCodes(
|
||||
|
@ -243,7 +243,7 @@ KeyboardDeviceWorker(
|
|||
{
|
||||
DPRINT1("Green: got char 0x%02x (%c)\n", Buffer[i], Buffer[i] >= 32 ? Buffer[i] : ' ');
|
||||
DeviceExtension->InputDataCount[Queue] += BytesConsumed;
|
||||
|
||||
|
||||
/* Send the data to the keyboard class driver */
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||
KeInsertQueueDpc(&DeviceExtension->KeyboardDpc, NULL, NULL);
|
||||
|
@ -262,7 +262,7 @@ KeyboardDeviceWorker(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PsTerminateSystemThread(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -277,30 +277,30 @@ KeyboardInternalDeviceControl(
|
|||
OBJECT_ATTRIBUTES objectAttributes;
|
||||
PDEVICE_OBJECT LowerDevice;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
Irp->IoStatus.Information = 0;
|
||||
DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
GreenDeviceExtension = (PGREEN_DEVICE_EXTENSION)DeviceExtension->Green->DeviceExtension;
|
||||
LowerDevice = GreenDeviceExtension->Serial;
|
||||
DPRINT1("Green: LowerDevice %p\n", LowerDevice);
|
||||
|
||||
|
||||
switch (Stack->Parameters.DeviceIoControl.IoControlCode)
|
||||
{
|
||||
case IOCTL_INTERNAL_KEYBOARD_CONNECT:
|
||||
{
|
||||
ULONG Fcr;
|
||||
|
||||
|
||||
DPRINT("Green: IRP_MJ_INTERNAL_DEVICE_CONTROL / IOCTL_INTERNAL_KEYBOARD_CONNECT\n");
|
||||
if (Stack->Parameters.DeviceIoControl.InputBufferLength < sizeof(CONNECT_DATA))
|
||||
{
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
DeviceExtension->ClassInformation =
|
||||
*((PCLASS_INFORMATION)Stack->Parameters.DeviceIoControl.Type3InputBuffer);
|
||||
|
||||
|
||||
/* Initialize serial port */
|
||||
Fcr = 0;
|
||||
Status = GreenDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_FIFO_CONTROL,
|
||||
|
@ -314,12 +314,12 @@ KeyboardInternalDeviceControl(
|
|||
Status = GreenDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL,
|
||||
&GreenDeviceExtension->LineControl, sizeof(GreenDeviceExtension->LineControl), NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) break;
|
||||
|
||||
|
||||
/* Set timeouts */
|
||||
Status = GreenDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS,
|
||||
&GreenDeviceExtension->Timeouts, sizeof(GreenDeviceExtension->Timeouts), NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) break;
|
||||
|
||||
|
||||
/* Start read loop */
|
||||
InitializeObjectAttributes(&objectAttributes, NULL, OBJ_KERNEL_HANDLE, NULL, NULL);
|
||||
Status = PsCreateSystemThread(
|
||||
|
@ -339,7 +339,7 @@ KeyboardInternalDeviceControl(
|
|||
Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest (Irp, IO_NO_INCREMENT);
|
||||
return Status;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id:
|
||||
*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS VT100 emulator
|
||||
* FILE: drivers/dd/green/misc.c
|
||||
* PURPOSE: Misceallenous operations
|
||||
*
|
||||
*
|
||||
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.com)
|
||||
*/
|
||||
|
||||
|
@ -24,9 +24,9 @@ GreenDeviceIoControl(
|
|||
PIRP Irp;
|
||||
IO_STATUS_BLOCK IoStatus;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
KeInitializeEvent (&Event, NotificationEvent, FALSE);
|
||||
|
||||
|
||||
Irp = IoBuildDeviceIoControlRequest(CtlCode,
|
||||
DeviceObject,
|
||||
InputBuffer,
|
||||
|
@ -41,20 +41,20 @@ GreenDeviceIoControl(
|
|||
DPRINT("Green: IoBuildDeviceIoControlRequest() failed\n");
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
Status = IoCallDriver(DeviceObject, Irp);
|
||||
|
||||
|
||||
if (Status == STATUS_PENDING)
|
||||
{
|
||||
DPRINT("Green: Operation pending\n");
|
||||
KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
|
||||
Status = IoStatus.Status;
|
||||
}
|
||||
|
||||
|
||||
if (OutputBufferSize)
|
||||
{
|
||||
*OutputBufferSize = IoStatus.Information;
|
||||
}
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id:
|
||||
*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS VT100 emulator
|
||||
* FILE: drivers/dd/green/pnp.c
|
||||
* PURPOSE: IRP_MJ_PNP operations
|
||||
*
|
||||
*
|
||||
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.com)
|
||||
*/
|
||||
|
||||
|
@ -20,9 +20,9 @@ GreenAddDevice(
|
|||
PGREEN_DEVICE_EXTENSION DeviceExtension;
|
||||
UNICODE_STRING serialPortName;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
DPRINT("Green: AddDevice(DriverObject %p, Pdo %p)\n", DriverObject, Pdo);
|
||||
|
||||
|
||||
/* Create green FDO */
|
||||
Status = IoCreateDevice(DriverObject,
|
||||
sizeof(GREEN_DEVICE_EXTENSION),
|
||||
|
@ -33,11 +33,11 @@ GreenAddDevice(
|
|||
&Fdo);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
|
||||
|
||||
DeviceExtension = (PGREEN_DEVICE_EXTENSION)Fdo->DeviceExtension;
|
||||
RtlZeroMemory(DeviceExtension, sizeof(GREEN_DEVICE_EXTENSION));
|
||||
DeviceExtension->Common.Type = Green;
|
||||
|
||||
|
||||
Status = KeyboardInitialize(DriverObject, &DeviceExtension->Keyboard);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ GreenAddDevice(
|
|||
return Status;
|
||||
}
|
||||
((PKEYBOARD_DEVICE_EXTENSION)DeviceExtension->Keyboard->DeviceExtension)->Green = Fdo;
|
||||
|
||||
|
||||
Status = ScreenInitialize(DriverObject, &DeviceExtension->Screen);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ GreenAddDevice(
|
|||
return Status;
|
||||
}
|
||||
((PSCREEN_DEVICE_EXTENSION)DeviceExtension->Screen->DeviceExtension)->Green = Fdo;
|
||||
|
||||
|
||||
/* initialize green Fdo */
|
||||
DeviceExtension->LowerDevice = IoAttachDeviceToDeviceStack(Fdo, Pdo);
|
||||
DeviceExtension->LineControl.WordLength = 8;
|
||||
|
@ -66,7 +66,7 @@ GreenAddDevice(
|
|||
DeviceExtension->Timeouts.ReadTotalTimeoutMultiplier = INFINITE;
|
||||
DeviceExtension->Timeouts.WriteTotalTimeoutMultiplier = 0; /* FIXME */
|
||||
DeviceExtension->Timeouts.WriteTotalTimeoutConstant = 0; /* FIXME */
|
||||
|
||||
|
||||
/* open associated serial port */
|
||||
RtlInitUnicodeString(&serialPortName, L"\\Device\\Serial1"); /* FIXME: don't hardcode string */
|
||||
Status = ObReferenceObjectByName(
|
||||
|
@ -79,9 +79,9 @@ GreenAddDevice(
|
|||
NULL,
|
||||
(PVOID*)&DeviceExtension->Serial);
|
||||
/* FIXME: we never ObDereferenceObject */
|
||||
|
||||
|
||||
Fdo->Flags |= DO_POWER_PAGABLE | DO_BUFFERED_IO;
|
||||
Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id:
|
||||
*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS VT100 emulator
|
||||
* FILE: drivers/dd/green/screen.c
|
||||
* PURPOSE: Screen part of green management
|
||||
*
|
||||
*
|
||||
* PROGRAMMERS: Eric Kohl (ekohl@abo.rhein-zeitung.de)
|
||||
* Art Yerkes
|
||||
* Hervé Poussineau (hpoussin@reactos.com)
|
||||
|
@ -38,7 +38,7 @@ AddToSendBuffer(
|
|||
int CurrentInt;
|
||||
UCHAR CurrentChar;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
SizeLeft = sizeof(DeviceExtension->SendBuffer) - DeviceExtension->SendBufferPosition;
|
||||
if (SizeLeft < NumberOfChars * 2 || NumberOfChars == 0)
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ AddToSendBuffer(
|
|||
DeviceExtension->SendBufferPosition = 0;
|
||||
SizeLeft = sizeof(DeviceExtension->SendBuffer);
|
||||
}
|
||||
|
||||
|
||||
va_start(args, NumberOfChars);
|
||||
while (NumberOfChars-- > 0)
|
||||
{
|
||||
|
@ -72,10 +72,10 @@ AddToSendBuffer(
|
|||
if (CurrentInt > 0)
|
||||
{
|
||||
CurrentChar = (UCHAR)CurrentInt;
|
||||
|
||||
|
||||
/* Why 0xff chars are printed on a 'dir' ? */
|
||||
if (CurrentChar == 0xff) CurrentChar = ' ';
|
||||
|
||||
|
||||
DeviceExtension->SendBuffer[DeviceExtension->SendBufferPosition++] = CurrentChar;
|
||||
SizeLeft--;
|
||||
}
|
||||
|
@ -111,9 +111,9 @@ ScreenInitialize(
|
|||
PSCREEN_DEVICE_EXTENSION DeviceExtension;
|
||||
UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\BlueScreen");
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
DPRINT("Green: ScreenInitialize() called\n");
|
||||
|
||||
|
||||
Status = IoCreateDevice(DriverObject,
|
||||
sizeof(SCREEN_DEVICE_EXTENSION),
|
||||
&DeviceName, /* FIXME: don't hardcode string */
|
||||
|
@ -123,7 +123,7 @@ ScreenInitialize(
|
|||
&Fdo);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
|
||||
|
||||
DeviceExtension = (PSCREEN_DEVICE_EXTENSION)Fdo->DeviceExtension;
|
||||
RtlZeroMemory(DeviceExtension, sizeof(SCREEN_DEVICE_EXTENSION));
|
||||
DeviceExtension->Common.Type = Screen;
|
||||
|
@ -140,21 +140,21 @@ ScreenInitialize(
|
|||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
DeviceExtension->TabWidth = 8;
|
||||
|
||||
|
||||
/* more initialization */
|
||||
DeviceExtension->Mode = ENABLE_PROCESSED_OUTPUT |
|
||||
ENABLE_WRAP_AT_EOL_OUTPUT;
|
||||
|
||||
|
||||
/* initialize screen at next write */
|
||||
AddToSendBuffer(DeviceExtension, 2, ESC, 'c'); /* reset device */
|
||||
AddToSendBuffer(DeviceExtension, 4, ESC, '[', '7', 'l'); /* disable line wrap */
|
||||
AddToSendBuffer(DeviceExtension, 4, ESC, '[', '3', 'g'); /* clear all tabs */
|
||||
|
||||
|
||||
Fdo->Flags |= DO_POWER_PAGABLE | DO_BUFFERED_IO;
|
||||
Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||
|
||||
|
||||
*ScreenFdo = Fdo;
|
||||
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -168,19 +168,19 @@ ScreenWrite(
|
|||
PSCREEN_DEVICE_EXTENSION DeviceExtension;
|
||||
PUCHAR VideoMemory; /* FIXME: is it useful? */
|
||||
ULONG VideoMemorySize; /* FIXME: is it useful? */
|
||||
|
||||
|
||||
ULONG Columns, Rows;
|
||||
ULONG CursorX, CursorY;
|
||||
ULONG i, j;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
DPRINT("Green: IRP_MJ_WRITE\n");
|
||||
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation (Irp);
|
||||
Buffer = Irp->UserBuffer;
|
||||
DeviceExtension = (PSCREEN_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
VideoMemory = DeviceExtension->VideoMemory;
|
||||
|
||||
|
||||
Columns = DeviceExtension->Columns;
|
||||
Rows = DeviceExtension->Rows;
|
||||
CursorX = (DeviceExtension->LogicalOffset / 2) % Columns + 1;
|
||||
|
@ -191,14 +191,14 @@ ScreenWrite(
|
|||
for (i = 0; i < Stack->Parameters.Write.Length; i++)
|
||||
DbgPrint(" 0x%02x", Buffer[i]);
|
||||
DbgPrint("\n");
|
||||
|
||||
|
||||
if (!(DeviceExtension->Mode & ENABLE_PROCESSED_OUTPUT))
|
||||
{
|
||||
/* raw output mode */
|
||||
CHECKPOINT;
|
||||
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
|
||||
IoCompleteRequest (Irp, IO_NO_INCREMENT);
|
||||
|
||||
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
else
|
||||
|
@ -271,7 +271,7 @@ ScreenWrite(
|
|||
DPRINT1("Y: %lu -> %lu\n", CursorY, CursorY + 1);
|
||||
CursorY++;
|
||||
AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', '1', 'H');
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -284,16 +284,16 @@ ScreenWrite(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DeviceExtension->LogicalOffset = ((CursorX-1) + (CursorY-1) * Columns) * 2;
|
||||
|
||||
|
||||
/* flush output buffer */
|
||||
AddToSendBuffer(DeviceExtension, 0);
|
||||
|
||||
|
||||
Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest (Irp, IO_NO_INCREMENT);
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -305,35 +305,35 @@ ScreenDeviceControl(
|
|||
PIO_STACK_LOCATION Stack;
|
||||
PSCREEN_DEVICE_EXTENSION DeviceExtension;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
DeviceExtension = (PSCREEN_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
|
||||
switch (Stack->Parameters.DeviceIoControl.IoControlCode)
|
||||
{
|
||||
case IOCTL_CONSOLE_GET_SCREEN_BUFFER_INFO:
|
||||
{
|
||||
PCONSOLE_SCREEN_BUFFER_INFO pcsbi;
|
||||
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_GET_SCREEN_BUFFER_INFO\n");
|
||||
|
||||
|
||||
pcsbi = (PCONSOLE_SCREEN_BUFFER_INFO)Irp->AssociatedIrp.SystemBuffer;
|
||||
|
||||
|
||||
pcsbi->dwSize.X = DeviceExtension->Columns;
|
||||
pcsbi->dwSize.Y = DeviceExtension->Rows;
|
||||
|
||||
|
||||
pcsbi->dwCursorPosition.X = (SHORT)(DeviceExtension->LogicalOffset % DeviceExtension->Columns);
|
||||
pcsbi->dwCursorPosition.Y = (SHORT)(DeviceExtension->LogicalOffset / DeviceExtension->Columns);
|
||||
|
||||
|
||||
pcsbi->wAttributes = DeviceExtension->CharAttribute;
|
||||
|
||||
|
||||
pcsbi->srWindow.Left = 1;
|
||||
pcsbi->srWindow.Right = DeviceExtension->Columns;
|
||||
pcsbi->srWindow.Top = 1;
|
||||
pcsbi->srWindow.Bottom = DeviceExtension->Rows;
|
||||
|
||||
|
||||
pcsbi->dwMaximumWindowSize.X = DeviceExtension->Columns;
|
||||
pcsbi->dwMaximumWindowSize.Y = DeviceExtension->Rows;
|
||||
|
||||
|
||||
Irp->IoStatus.Information = sizeof(CONSOLE_SCREEN_BUFFER_INFO);
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
@ -342,7 +342,7 @@ ScreenDeviceControl(
|
|||
{
|
||||
PCONSOLE_SCREEN_BUFFER_INFO pcsbi;
|
||||
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_SET_SCREEN_BUFFER_INFO\n");
|
||||
|
||||
|
||||
pcsbi = (PCONSOLE_SCREEN_BUFFER_INFO)Irp->AssociatedIrp.SystemBuffer;
|
||||
/* FIXME: remove */ { pcsbi->dwCursorPosition.X++; }
|
||||
/* FIXME: remove */ { pcsbi->dwCursorPosition.Y++; }
|
||||
|
@ -350,19 +350,19 @@ ScreenDeviceControl(
|
|||
ASSERT(pcsbi->dwCursorPosition.Y >= 1);
|
||||
ASSERT(pcsbi->dwCursorPosition.X <= DeviceExtension->Columns);
|
||||
ASSERT(pcsbi->dwCursorPosition.Y <= DeviceExtension->Rows);
|
||||
|
||||
|
||||
DeviceExtension->LogicalOffset = (
|
||||
(pcsbi->dwCursorPosition.Y-1) * DeviceExtension->Columns +
|
||||
(pcsbi->dwCursorPosition.X-1)) * 2;
|
||||
AddToSendBuffer(DeviceExtension, 6, ESC, '[',
|
||||
-(int)pcsbi->dwCursorPosition.Y, ';',
|
||||
-(int)pcsbi->dwCursorPosition.X, 'H');
|
||||
|
||||
|
||||
/* flush buffer */
|
||||
AddToSendBuffer(DeviceExtension, 0);
|
||||
|
||||
|
||||
DeviceExtension->CharAttribute = pcsbi->wAttributes;
|
||||
|
||||
|
||||
Irp->IoStatus.Information = 0;
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
@ -371,10 +371,10 @@ ScreenDeviceControl(
|
|||
{
|
||||
PCONSOLE_CURSOR_INFO pcci = (PCONSOLE_CURSOR_INFO)Irp->AssociatedIrp.SystemBuffer;
|
||||
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_GET_CURSOR_INFO\n");
|
||||
|
||||
|
||||
pcci->dwSize = 1;
|
||||
pcci->bVisible = TRUE;
|
||||
|
||||
|
||||
Irp->IoStatus.Information = sizeof (CONSOLE_CURSOR_INFO);
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
@ -383,9 +383,9 @@ ScreenDeviceControl(
|
|||
{
|
||||
PCONSOLE_MODE pcm = (PCONSOLE_MODE)Irp->AssociatedIrp.SystemBuffer;
|
||||
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_GET_MODE\n");
|
||||
|
||||
|
||||
pcm->dwMode = DeviceExtension->Mode;
|
||||
|
||||
|
||||
Irp->IoStatus.Information = sizeof(CONSOLE_MODE);
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
@ -394,9 +394,9 @@ ScreenDeviceControl(
|
|||
{
|
||||
PCONSOLE_MODE pcm = (PCONSOLE_MODE)Irp->AssociatedIrp.SystemBuffer;
|
||||
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_SET_MODE\n");
|
||||
|
||||
|
||||
DeviceExtension->Mode = pcm->dwMode;
|
||||
|
||||
|
||||
Irp->IoStatus.Information = 0;
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
@ -422,7 +422,7 @@ ScreenDeviceControl(
|
|||
case IOCTL_CONSOLE_SET_TEXT_ATTRIBUTE:
|
||||
{
|
||||
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_SET_TEXT_ATTRIBUTE\n");
|
||||
|
||||
|
||||
DeviceExtension->CharAttribute = (WORD)*(PWORD)Irp->AssociatedIrp.SystemBuffer;
|
||||
Irp->IoStatus.Information = 0;
|
||||
Status = STATUS_SUCCESS;
|
||||
|
@ -453,7 +453,7 @@ ScreenDeviceControl(
|
|||
ULONG x, y;
|
||||
BOOLEAN DoOptimization = FALSE;
|
||||
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_DRAW\n");
|
||||
|
||||
|
||||
ConsoleDraw = (PCONSOLE_DRAW)MmGetSystemAddressForMdl(Irp->MdlAddress);
|
||||
/* FIXME: remove */ { ConsoleDraw->X++; ConsoleDraw->CursorX++; }
|
||||
/* FIXME: remove */ { ConsoleDraw->Y++; ConsoleDraw->CursorY++; }
|
||||
|
@ -472,7 +472,7 @@ ScreenDeviceControl(
|
|||
ASSERT(ConsoleDraw->CursorY >= 1);
|
||||
ASSERT(ConsoleDraw->CursorX <= DeviceExtension->Columns);
|
||||
ASSERT(ConsoleDraw->CursorY <= DeviceExtension->Rows);
|
||||
|
||||
|
||||
#if 0
|
||||
if (ConsoleDraw->X == 1
|
||||
&& ConsoleDraw->Y == 1
|
||||
|
@ -501,7 +501,7 @@ ScreenDeviceControl(
|
|||
}
|
||||
#endif
|
||||
/* add here more optimizations if needed */
|
||||
|
||||
|
||||
if (!DoOptimization)
|
||||
{
|
||||
for (y = 0; y < ConsoleDraw->SizeY; y++)
|
||||
|
@ -517,17 +517,17 @@ ScreenDeviceControl(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DeviceExtension->LogicalOffset = (
|
||||
(ConsoleDraw->CursorY-1) * DeviceExtension->Columns +
|
||||
(ConsoleDraw->CursorX-1)) * 2;
|
||||
AddToSendBuffer(DeviceExtension, 6, ESC, '[',
|
||||
-(int)(ConsoleDraw->CursorY), ';',
|
||||
-(int)(ConsoleDraw->CursorX), 'H');
|
||||
|
||||
|
||||
/* flush buffer */
|
||||
AddToSendBuffer(DeviceExtension, 0);
|
||||
|
||||
|
||||
Irp->IoStatus.Information = 0;
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
@ -537,7 +537,7 @@ ScreenDeviceControl(
|
|||
Stack->Parameters.DeviceIoControl.IoControlCode);
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest (Irp, IO_NO_INCREMENT);
|
||||
return Status;
|
||||
|
|
|
@ -81,7 +81,7 @@ NTSTATUS InitDevice(
|
|||
// Parameters = Instance->DriverObject->DriverExtension;
|
||||
|
||||
DPRINT("DeviceObject at 0x%x, DeviceExtension at 0x%x\n", DeviceObject, Parameters);
|
||||
|
||||
|
||||
if (! Parameters)
|
||||
{
|
||||
DPRINT("NULL POINTER!\n");
|
||||
|
@ -103,9 +103,9 @@ NTSTATUS InitDevice(
|
|||
Parameters->IRQ = DEFAULT_IRQ;
|
||||
|
||||
// Only to be enabled once we can get support for multiple cards working :)
|
||||
/*
|
||||
/*
|
||||
DPRINT("Loading settings from: %S\n", RegistryPath);
|
||||
|
||||
|
||||
s = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, RegistryPath, Table,
|
||||
&Parameters, NULL);
|
||||
*/
|
||||
|
@ -144,7 +144,7 @@ MPU401Create(PDEVICE_OBJECT DeviceObject,
|
|||
*/
|
||||
{
|
||||
DPRINT("MPU401Create() called!\n");
|
||||
|
||||
|
||||
// Initialize the MPU-401?
|
||||
// ... do stuff ...
|
||||
|
||||
|
@ -181,7 +181,7 @@ MPU401Close(PDEVICE_OBJECT DeviceObject,
|
|||
NTSTATUS Status;
|
||||
|
||||
DPRINT("MPU401Close() called!\n");
|
||||
|
||||
|
||||
DeviceExtension = DeviceObject->DeviceExtension;
|
||||
|
||||
Status = STATUS_SUCCESS;
|
||||
|
@ -248,7 +248,7 @@ MPU401DeviceControl(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
DeviceExtension = DeviceObject->DeviceExtension;
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
|
||||
|
||||
DPRINT("Control code %d [0x%x]\n", Stack->Parameters.DeviceIoControl.IoControlCode,
|
||||
Stack->Parameters.DeviceIoControl.IoControlCode);
|
||||
|
||||
|
@ -260,7 +260,7 @@ MPU401DeviceControl(PDEVICE_OBJECT DeviceObject,
|
|||
Data = (PBYTE) Irp->AssociatedIrp.SystemBuffer;
|
||||
|
||||
DPRINT("Sending %d bytes of MIDI data to 0x%d:\n", Stack->Parameters.DeviceIoControl.InputBufferLength, DeviceExtension->Port);
|
||||
|
||||
|
||||
for (ByteCount = 0; ByteCount < Stack->Parameters.DeviceIoControl.InputBufferLength; ByteCount ++)
|
||||
{
|
||||
DPRINT("0x%x ", Data[ByteCount]);
|
||||
|
@ -272,11 +272,11 @@ MPU401DeviceControl(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
|
||||
/*
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
BOOLEAN WaitToSend(UINT BasePort)
|
||||
{
|
||||
int TimeOut;
|
||||
|
||||
|
||||
DbgPrint("WaitToSend ");
|
||||
|
||||
// Check if it's OK to send
|
||||
|
@ -31,7 +31,7 @@ BOOLEAN WaitToSend(UINT BasePort)
|
|||
DbgPrint("FAILED\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
DbgPrint("SUCCEEDED\n");
|
||||
|
||||
return TRUE;
|
||||
|
@ -55,7 +55,7 @@ BOOLEAN WaitToReceive(UINT BasePort)
|
|||
DbgPrint("FAILED\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
DbgPrint("SUCCEEDED\n");
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -29,7 +29,7 @@ NullDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
{
|
||||
PIO_STACK_LOCATION piosStack = IoGetCurrentIrpStackLocation(Irp);
|
||||
NTSTATUS nErrCode;
|
||||
|
||||
|
||||
nErrCode = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
|
@ -117,7 +117,7 @@ NullUnload(PDRIVER_OBJECT DriverObject)
|
|||
}
|
||||
|
||||
/* TODO: \Device\Zero should be memory-mappable */
|
||||
NTSTATUS STDCALL
|
||||
NTSTATUS STDCALL
|
||||
DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
|
||||
{
|
||||
PDEVICE_OBJECT pdoNullDevice;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* FILE: services/parallel/parallel.c
|
||||
* PURPOSE: Parallel port driver
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* UPDATE HISTORY:
|
||||
* ??/??/??: Created
|
||||
* 18/06/98: Made more NT like
|
||||
*/
|
||||
|
@ -44,7 +44,7 @@ static void Parallel_putchar(unsigned char ch)
|
|||
* ch = character to write
|
||||
*/
|
||||
{
|
||||
|
||||
|
||||
int count=0;
|
||||
int status;
|
||||
int wait=0;
|
||||
|
@ -55,13 +55,13 @@ static void Parallel_putchar(unsigned char ch)
|
|||
count++;
|
||||
}
|
||||
while ( count < 500000 && !(status & LP_PBUSY) );
|
||||
|
||||
|
||||
if (count==500000)
|
||||
{
|
||||
DPRINT("printer_putchar(): timed out\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
WRITE_PORT_UCHAR((PUCHAR)LP_B,ch);
|
||||
while (wait != 10000) { wait++; }
|
||||
WRITE_PORT_UCHAR((PUCHAR)LP_C, (LP_PSELECP | LP_PINITP | LP_PSTROBE ));
|
||||
|
@ -82,7 +82,7 @@ Dispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
NTSTATUS status;
|
||||
int i;
|
||||
|
||||
|
||||
switch (Stack->MajorFunction)
|
||||
{
|
||||
case IRP_MJ_CREATE:
|
||||
|
@ -90,11 +90,11 @@ Dispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
Parallel_Reset();
|
||||
status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
||||
|
||||
case IRP_MJ_CLOSE:
|
||||
status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
||||
|
||||
case IRP_MJ_WRITE:
|
||||
DPRINT("(Parallel Port Driver) Writing %d bytes\n",
|
||||
Stack->Parameters.Write.Length);
|
||||
|
@ -104,15 +104,15 @@ Dispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
}
|
||||
status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Irp->IoStatus.Status = status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return(status);
|
||||
}
|
||||
|
@ -130,9 +130,9 @@ DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
|
|||
PDEVICE_OBJECT DeviceObject;
|
||||
UNICODE_STRING DeviceName = ROS_STRING_INITIALIZER(L"\\Device\\Parallel");
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
DPRINT("Parallel Port Driver 0.0.1\n");
|
||||
|
||||
|
||||
Status = IoCreateDevice(DriverObject,
|
||||
0,
|
||||
&DeviceName,
|
||||
|
@ -150,7 +150,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
|
|||
DriverObject->MajorFunction[IRP_MJ_CREATE] = Dispatch;
|
||||
DriverObject->MajorFunction[IRP_MJ_WRITE] = Dispatch;
|
||||
DriverObject->DriverUnload = NULL;
|
||||
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
* gets inverted, but it is also active low.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* bit defines for 8255 status port
|
||||
* base + 1
|
||||
* accessed with LP_S(minor), which gets the byte...
|
||||
|
@ -110,9 +110,9 @@
|
|||
#define LP_PSELECD 0x10 /* unchanged input, active high */
|
||||
#define LP_PERRORP 0x08 /* unchanged input, active low */
|
||||
|
||||
/*
|
||||
/*
|
||||
* defines for 8255 control port
|
||||
* base + 2
|
||||
* base + 2
|
||||
* accessed with LP_C(minor)
|
||||
*/
|
||||
#define LP_PINTEN 0x10
|
||||
|
@ -121,10 +121,10 @@
|
|||
#define LP_PAUTOLF 0x02 /* inverted output, active low */
|
||||
#define LP_PSTROBE 0x01 /* inverted output, active low */
|
||||
|
||||
/*
|
||||
* the value written to ports to test existence. PC-style ports will
|
||||
/*
|
||||
* the value written to ports to test existence. PC-style ports will
|
||||
* return the value written. AT-style ports will return 0. so why not
|
||||
* make them the same ?
|
||||
* make them the same ?
|
||||
*/
|
||||
#define LP_DUMMY 0x00
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ NTSTATUS STDCALL RamdrvDispatchDeviceControl(PDEVICE_OBJECT DeviceObject,
|
|||
Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||
}
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, NT_SUCCESS(Status) ? IO_DISK_INCREMENT : IO_NO_INCREMENT);
|
||||
IoCompleteRequest(Irp, NT_SUCCESS(Status) ? IO_DISK_INCREMENT : IO_NO_INCREMENT);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -98,17 +98,17 @@ NTSTATUS STDCALL DriverEntry(IN PDRIVER_OBJECT DriverObject,
|
|||
unsigned int dstlen = 1024 * 1440;
|
||||
FILE_STANDARD_INFORMATION finfo;
|
||||
DWORD err;
|
||||
|
||||
|
||||
DPRINT("Ramdisk driver\n");
|
||||
|
||||
|
||||
/* Export other driver entry points... */
|
||||
DriverObject->MajorFunction[IRP_MJ_CREATE] = RamdrvDispatchOpenClose;
|
||||
DriverObject->MajorFunction[IRP_MJ_CLOSE] = RamdrvDispatchOpenClose;
|
||||
DriverObject->MajorFunction[IRP_MJ_READ] = RamdrvDispatchReadWrite;
|
||||
DriverObject->MajorFunction[IRP_MJ_WRITE] = RamdrvDispatchReadWrite;
|
||||
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = RamdrvDispatchDeviceControl;
|
||||
|
||||
|
||||
|
||||
|
||||
// create device and symbolic link
|
||||
Status = IoCreateDevice( DriverObject,
|
||||
sizeof( RAMDRV_DEVICE_EXTENSION ),
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id:
|
||||
*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/dd/serial/circularbuffer.c
|
||||
* PURPOSE: Operations on a circular buffer
|
||||
*
|
||||
*
|
||||
* PROGRAMMERS: Hervé Poussineau (poussine@freesurf.fr)
|
||||
*/
|
||||
|
||||
|
@ -84,7 +84,7 @@ IncreaseCircularBufferSize(
|
|||
IN ULONG NewBufferSize)
|
||||
{
|
||||
PUCHAR NewBuffer;
|
||||
|
||||
|
||||
DPRINT("Serial: IncreaseCircularBufferSize(pBuffer %p, NewBufferSize %lu)\n", pBuffer, NewBufferSize);
|
||||
ASSERT(pBuffer);
|
||||
ASSERT(pBuffer->Length);
|
||||
|
@ -92,7 +92,7 @@ IncreaseCircularBufferSize(
|
|||
return STATUS_INVALID_PARAMETER;
|
||||
else if (pBuffer->Length == NewBufferSize)
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
|
||||
NewBuffer = (PUCHAR)ExAllocatePoolWithTag(NonPagedPool, NewBufferSize * sizeof(UCHAR), SERIAL_TAG);
|
||||
if (!NewBuffer)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id:
|
||||
*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/dd/serial/cleanup.c
|
||||
* PURPOSE: Serial IRP_MJ_CLEANUP operations
|
||||
*
|
||||
*
|
||||
* PROGRAMMERS: Hervé Poussineau (poussine@freesurf.fr)
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id:
|
||||
*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/dd/serial/close.c
|
||||
* PURPOSE: Serial IRP_MJ_CLOSE operations
|
||||
*
|
||||
*
|
||||
* PROGRAMMERS: Hervé Poussineau (poussine@freesurf.fr)
|
||||
*/
|
||||
|
||||
|
@ -17,11 +17,11 @@ SerialClose(
|
|||
IN PIRP Irp)
|
||||
{
|
||||
PSERIAL_DEVICE_EXTENSION pDeviceExtension;
|
||||
|
||||
|
||||
DPRINT("Serial: IRP_MJ_CLOSE\n");
|
||||
pDeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
pDeviceExtension->IsOpened = FALSE;
|
||||
|
||||
|
||||
Irp->IoStatus.Information = 0;
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id:
|
||||
*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/dd/serial/create.c
|
||||
* PURPOSE: Serial IRP_MJ_CREATE operations
|
||||
*
|
||||
*
|
||||
* PROGRAMMERS: Hervé Poussineau (poussine@freesurf.fr)
|
||||
*/
|
||||
|
||||
|
@ -20,40 +20,40 @@ SerialCreate(
|
|||
PFILE_OBJECT FileObject;
|
||||
PSERIAL_DEVICE_EXTENSION DeviceExtension;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
DPRINT("Serial: IRP_MJ_CREATE\n");
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
FileObject = Stack->FileObject;
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
|
||||
ASSERT(FileObject);
|
||||
|
||||
|
||||
if (Stack->Parameters.Create.Options & FILE_DIRECTORY_FILE)
|
||||
{
|
||||
CHECKPOINT;
|
||||
Status = STATUS_NOT_A_DIRECTORY;
|
||||
goto ByeBye;
|
||||
}
|
||||
|
||||
if (FileObject->FileName.Length != 0 ||
|
||||
|
||||
if (FileObject->FileName.Length != 0 ||
|
||||
FileObject->RelatedFileObject != NULL)
|
||||
{
|
||||
CHECKPOINT;
|
||||
Status = STATUS_ACCESS_DENIED;
|
||||
goto ByeBye;
|
||||
}
|
||||
|
||||
|
||||
if(DeviceExtension->IsOpened)
|
||||
{
|
||||
DPRINT("Serial: COM%lu is already opened\n", DeviceExtension->ComPort);
|
||||
Status = STATUS_ACCESS_DENIED;
|
||||
goto ByeBye;
|
||||
}
|
||||
|
||||
|
||||
DPRINT("Serial: open COM%lu: successfull\n", DeviceExtension->ComPort);
|
||||
DeviceExtension->IsOpened = TRUE;
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
|
||||
ByeBye:
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id:
|
||||
*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/dd/serial/devctrl.c
|
||||
* PURPOSE: Serial IRP_MJ_DEVICE_CONTROL operations
|
||||
*
|
||||
*
|
||||
* PROGRAMMERS: Hervé Poussineau (poussine@freesurf.fr)
|
||||
*/
|
||||
|
||||
|
@ -23,7 +23,7 @@ SerialGetUserBuffers(
|
|||
ASSERT(Irp);
|
||||
ASSERT(BufferIn);
|
||||
ASSERT(BufferOut);
|
||||
|
||||
|
||||
switch (IO_METHOD_FROM_CTL_CODE(IoControlCode))
|
||||
{
|
||||
case METHOD_BUFFERED:
|
||||
|
@ -39,7 +39,7 @@ SerialGetUserBuffers(
|
|||
*BufferOut = Irp->UserBuffer;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Should never happen */
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ SerialSetBaudRate(
|
|||
PUCHAR ComPortBase = (PUCHAR)DeviceExtension->BaseAddress;
|
||||
ULONG BaudRate;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
|
||||
if (NewBaudRate & SERIAL_BAUD_USER)
|
||||
{
|
||||
BaudRate = NewBaudRate & ~SERIAL_BAUD_USER;
|
||||
|
@ -83,7 +83,7 @@ SerialSetBaudRate(
|
|||
default: Status = STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
|
@ -99,11 +99,11 @@ SerialSetBaudRate(
|
|||
WRITE_PORT_UCHAR(SER_DLM(ComPortBase), divisor >> 8);
|
||||
/* Switch back to normal registers */
|
||||
WRITE_PORT_UCHAR(SER_LCR(ComPortBase), Lcr);
|
||||
|
||||
|
||||
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
DeviceExtension->BaudRate = BaudRate;
|
||||
return Status;
|
||||
|
@ -117,13 +117,13 @@ SerialSetLineControl(
|
|||
PUCHAR ComPortBase;
|
||||
UCHAR Lcr = 0;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
ASSERT(DeviceExtension);
|
||||
ASSERT(NewSettings);
|
||||
|
||||
|
||||
DPRINT("Serial: SerialSetLineControl(COM%lu, Settings { %lu %lu %lu })\n",
|
||||
DeviceExtension->ComPort, NewSettings->StopBits, NewSettings->Parity, NewSettings->WordLength);
|
||||
|
||||
|
||||
/* Verify parameters */
|
||||
switch (NewSettings->WordLength)
|
||||
{
|
||||
|
@ -133,10 +133,10 @@ SerialSetLineControl(
|
|||
case 8: Lcr |= SR_LCR_CS8; break;
|
||||
default: return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
if (NewSettings->WordLength < 5 || NewSettings->WordLength > 8)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
|
||||
|
||||
switch (NewSettings->Parity)
|
||||
{
|
||||
case NO_PARITY: Lcr |= SR_LCR_PNO; break;
|
||||
|
@ -146,7 +146,7 @@ SerialSetLineControl(
|
|||
case SPACE_PARITY: Lcr |= SR_LCR_PSP; break;
|
||||
default: return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
switch (NewSettings->StopBits)
|
||||
{
|
||||
case STOP_BIT_1:
|
||||
|
@ -165,21 +165,21 @@ SerialSetLineControl(
|
|||
default:
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
/* Update current parameters */
|
||||
ComPortBase = (PUCHAR)DeviceExtension->BaseAddress;
|
||||
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
WRITE_PORT_UCHAR(SER_LCR(ComPortBase), Lcr);
|
||||
|
||||
|
||||
/* Read junk out of RBR */
|
||||
READ_PORT_UCHAR(SER_RBR(ComPortBase));
|
||||
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
DeviceExtension->SerialLineControl = *NewSettings;
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ SerialClearPerfStats(
|
|||
IN PSERIAL_DEVICE_EXTENSION DeviceExtension)
|
||||
{
|
||||
ASSERT(DeviceExtension);
|
||||
|
||||
|
||||
RtlZeroMemory(&DeviceExtension->SerialPerfStats, sizeof(SERIALPERF_STATS));
|
||||
DeviceExtension->BreakInterruptErrorCount = 0;
|
||||
return TRUE;
|
||||
|
@ -219,9 +219,9 @@ SerialGetCommProp(
|
|||
IN PSERIAL_DEVICE_EXTENSION DeviceExtension)
|
||||
{
|
||||
ASSERT(pCommProp);
|
||||
|
||||
|
||||
RtlZeroMemory(pCommProp, sizeof(SERIAL_COMMPROP));
|
||||
|
||||
|
||||
pCommProp->PacketLength = sizeof(SERIAL_COMMPROP);
|
||||
pCommProp->PacketVersion = 2;
|
||||
pCommProp->ServiceMask = SERIAL_SP_SERIALCOMM;
|
||||
|
@ -233,7 +233,7 @@ SerialGetCommProp(
|
|||
| SERIAL_PCF_XONXOFF;
|
||||
pCommProp->SettableParams = SERIAL_SP_BAUD | SERIAL_SP_DATABITS | SERIAL_SP_HANDSHAKING
|
||||
| SERIAL_SP_PARITY | SERIAL_SP_PARITY_CHECK | SERIAL_SP_STOPBITS;
|
||||
|
||||
|
||||
/* SettableBaud is related to Uart type */
|
||||
pCommProp->SettableBaud = SERIAL_BAUD_075 | SERIAL_BAUD_110 | SERIAL_BAUD_134_5
|
||||
| SERIAL_BAUD_150 | SERIAL_BAUD_300 | SERIAL_BAUD_600 | SERIAL_BAUD_1200
|
||||
|
@ -250,11 +250,11 @@ SerialGetCommProp(
|
|||
pCommProp->SettableBaud |= SERIAL_BAUD_56K | SERIAL_BAUD_57600 | SERIAL_BAUD_115200 | SERIAL_BAUD_128K;
|
||||
pCommProp->MaxBaud = SERIAL_BAUD_115200;
|
||||
}
|
||||
|
||||
|
||||
pCommProp->SettableData = SERIAL_DATABITS_5 | SERIAL_DATABITS_6 | SERIAL_DATABITS_7 | SERIAL_DATABITS_8;
|
||||
pCommProp->SettableStopParity = SERIAL_STOPBITS_10 | SERIAL_STOPBITS_15 | SERIAL_STOPBITS_20
|
||||
| SERIAL_PARITY_NONE | SERIAL_PARITY_ODD | SERIAL_PARITY_EVEN | SERIAL_PARITY_MARK | SERIAL_PARITY_SPACE;
|
||||
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -264,10 +264,10 @@ SerialGetCommStatus(
|
|||
IN PSERIAL_DEVICE_EXTENSION DeviceExtension)
|
||||
{
|
||||
KIRQL Irql;
|
||||
|
||||
|
||||
ASSERT(pSerialStatus);
|
||||
RtlZeroMemory(pSerialStatus, sizeof(SERIAL_STATUS));
|
||||
|
||||
|
||||
pSerialStatus->Errors = 0;
|
||||
if (DeviceExtension->BreakInterruptErrorCount)
|
||||
pSerialStatus->Errors |= SERIAL_ERROR_BREAK;
|
||||
|
@ -279,22 +279,22 @@ SerialGetCommStatus(
|
|||
pSerialStatus->Errors |= SERIAL_ERROR_QUEUEOVERRUN;
|
||||
if (DeviceExtension->SerialPerfStats.ParityErrorCount)
|
||||
pSerialStatus->Errors |= SERIAL_ERROR_PARITY;
|
||||
|
||||
|
||||
pSerialStatus->HoldReasons = 0; /* FIXME */
|
||||
|
||||
|
||||
KeAcquireSpinLock(&DeviceExtension->InputBufferLock, &Irql);
|
||||
pSerialStatus->AmountInInQueue = (DeviceExtension->InputBuffer.WritePosition + DeviceExtension->InputBuffer.Length
|
||||
- DeviceExtension->InputBuffer.ReadPosition) % DeviceExtension->InputBuffer.Length;
|
||||
KeReleaseSpinLock(&DeviceExtension->InputBufferLock, Irql);
|
||||
|
||||
|
||||
KeAcquireSpinLock(&DeviceExtension->OutputBufferLock, &Irql);
|
||||
pSerialStatus->AmountInOutQueue = (DeviceExtension->OutputBuffer.WritePosition + DeviceExtension->OutputBuffer.Length
|
||||
- DeviceExtension->OutputBuffer.ReadPosition) % DeviceExtension->OutputBuffer.Length;
|
||||
KeReleaseSpinLock(&DeviceExtension->OutputBufferLock, Irql);
|
||||
|
||||
|
||||
pSerialStatus->EofReceived = FALSE; /* always FALSE */
|
||||
pSerialStatus->WaitForImmediate = FALSE; /* always FALSE */
|
||||
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -311,9 +311,9 @@ SerialDeviceControl(
|
|||
PVOID BufferIn, BufferOut;
|
||||
PUCHAR ComPortBase;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
DPRINT("Serial: IRP_MJ_DEVICE_CONTROL dispatch\n");
|
||||
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
LengthIn = Stack->Parameters.DeviceIoControl.InputBufferLength;
|
||||
LengthOut = Stack->Parameters.DeviceIoControl.OutputBufferLength;
|
||||
|
@ -321,7 +321,7 @@ SerialDeviceControl(
|
|||
ComPortBase = (PUCHAR)DeviceExtension->BaseAddress;
|
||||
IoControlCode = Stack->Parameters.DeviceIoControl.IoControlCode;
|
||||
SerialGetUserBuffers(Irp, IoControlCode, &BufferIn, &BufferOut);
|
||||
|
||||
|
||||
/* FIXME: need to probe buffers */
|
||||
/* FIXME: see http://www.osronline.com/ddkx/serial/serref_61bm.htm */
|
||||
switch (IoControlCode)
|
||||
|
@ -339,7 +339,7 @@ SerialDeviceControl(
|
|||
case IOCTL_SERIAL_CLR_DTR:
|
||||
{
|
||||
DPRINT("Serial: IOCTL_SERIAL_CLR_DTR\n");
|
||||
/* FIXME: If the handshake flow control of the device is configured to
|
||||
/* FIXME: If the handshake flow control of the device is configured to
|
||||
* automatically use DTR, return STATUS_INVALID_PARAMETER */
|
||||
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
if (NT_SUCCESS(Status))
|
||||
|
@ -353,7 +353,7 @@ SerialDeviceControl(
|
|||
case IOCTL_SERIAL_CLR_RTS:
|
||||
{
|
||||
DPRINT("Serial: IOCTL_SERIAL_CLR_RTS\n");
|
||||
/* FIXME: If the handshake flow control of the device is configured to
|
||||
/* FIXME: If the handshake flow control of the device is configured to
|
||||
* automatically use RTS, return STATUS_INVALID_PARAMETER */
|
||||
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
if (NT_SUCCESS(Status))
|
||||
|
@ -582,7 +582,7 @@ SerialDeviceControl(
|
|||
else
|
||||
{
|
||||
ULONG PurgeMask = *(PULONG)BufferIn;
|
||||
|
||||
|
||||
Status = STATUS_SUCCESS;
|
||||
/* FIXME: use SERIAL_PURGE_RXABORT and SERIAL_PURGE_TXABORT flags */
|
||||
if (PurgeMask & SERIAL_PURGE_RXCLEAR)
|
||||
|
@ -601,7 +601,7 @@ SerialDeviceControl(
|
|||
}
|
||||
KeReleaseSpinLock(&DeviceExtension->InputBufferLock, Irql);
|
||||
}
|
||||
|
||||
|
||||
if (PurgeMask & SERIAL_PURGE_TXCLEAR)
|
||||
{
|
||||
KeAcquireSpinLock(&DeviceExtension->OutputBufferLock, &Irql);
|
||||
|
@ -664,7 +664,7 @@ SerialDeviceControl(
|
|||
}
|
||||
case IOCTL_SERIAL_SET_DTR:
|
||||
{
|
||||
/* FIXME: If the handshake flow control of the device is configured to
|
||||
/* FIXME: If the handshake flow control of the device is configured to
|
||||
* automatically use DTR, return STATUS_INVALID_PARAMETER */
|
||||
DPRINT("Serial: IOCTL_SERIAL_SET_DTR\n");
|
||||
if (!(DeviceExtension->MCR & SR_MCR_DTR))
|
||||
|
@ -762,7 +762,7 @@ SerialDeviceControl(
|
|||
}
|
||||
case IOCTL_SERIAL_SET_RTS:
|
||||
{
|
||||
/* FIXME: If the handshake flow control of the device is configured to
|
||||
/* FIXME: If the handshake flow control of the device is configured to
|
||||
* automatically use DTR, return STATUS_INVALID_PARAMETER */
|
||||
DPRINT("Serial: IOCTL_SERIAL_SET_RTS\n");
|
||||
if (!(DeviceExtension->MCR & SR_MCR_RTS))
|
||||
|
@ -841,7 +841,7 @@ SerialDeviceControl(
|
|||
return IoCallDriver(DeviceExtension->LowerDevice, Irp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Irp->IoStatus.Information = Information;
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id:
|
||||
*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/dd/serial/info.c
|
||||
* PURPOSE: Serial IRP_MJ_QUERY_INFORMATION operations
|
||||
*
|
||||
*
|
||||
* PROGRAMMERS: Hervé Poussineau (poussine@freesurf.fr)
|
||||
*/
|
||||
|
||||
|
@ -22,18 +22,18 @@ SerialQueryInformation(
|
|||
ULONG BufferLength;
|
||||
ULONG_PTR Information = 0;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
|
||||
BufferLength = Stack->Parameters.QueryFile.Length;
|
||||
|
||||
|
||||
switch (Stack->Parameters.QueryFile.FileInformationClass)
|
||||
{
|
||||
case FileStandardInformation:
|
||||
{
|
||||
PFILE_STANDARD_INFORMATION StandardInfo = (PFILE_STANDARD_INFORMATION)SystemBuffer;
|
||||
|
||||
|
||||
DPRINT("Serial: IRP_MJ_QUERY_INFORMATION / FileStandardInformation\n");
|
||||
if (BufferLength < sizeof(FILE_STANDARD_INFORMATION))
|
||||
Status = STATUS_BUFFER_OVERFLOW;
|
||||
|
@ -52,9 +52,9 @@ SerialQueryInformation(
|
|||
case FilePositionInformation:
|
||||
{
|
||||
PFILE_POSITION_INFORMATION PositionInfo = (PFILE_POSITION_INFORMATION)SystemBuffer;
|
||||
|
||||
|
||||
ASSERT(PositionInfo);
|
||||
|
||||
|
||||
DPRINT("Serial: IRP_MJ_QUERY_INFORMATION / FilePositionInformation\n");
|
||||
if (BufferLength < sizeof(PFILE_POSITION_INFORMATION))
|
||||
Status = STATUS_BUFFER_OVERFLOW;
|
||||
|
@ -73,7 +73,7 @@ SerialQueryInformation(
|
|||
return ForwardIrpAndForget(DeviceObject, Irp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Irp->IoStatus.Information = Information;
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id:
|
||||
*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/bus/serial/legacy.c
|
||||
* PURPOSE: Legacy serial port enumeration
|
||||
*
|
||||
*
|
||||
* PROGRAMMERS: Hervé Poussineau (poussine@freesurf.fr)
|
||||
* Mark Junker (mjscod@gmx.de)
|
||||
*/
|
||||
|
@ -20,16 +20,16 @@ SerialDetectUartType(
|
|||
UCHAR OldScr, Scr5A, ScrA5;
|
||||
BOOLEAN FifoEnabled;
|
||||
UCHAR NewFifoStatus;
|
||||
|
||||
|
||||
Lcr = READ_PORT_UCHAR(SER_LCR(BaseAddress));
|
||||
WRITE_PORT_UCHAR(SER_LCR(BaseAddress), Lcr ^ 0xFF);
|
||||
TestLcr = READ_PORT_UCHAR(SER_LCR(BaseAddress)) ^ 0xFF;
|
||||
WRITE_PORT_UCHAR(SER_LCR(BaseAddress), Lcr);
|
||||
|
||||
|
||||
/* Accessing the LCR must work for a usable serial port */
|
||||
if (TestLcr != Lcr)
|
||||
return UartUnknown;
|
||||
|
||||
|
||||
/* Ensure that all following accesses are done as required */
|
||||
READ_PORT_UCHAR(SER_RBR(BaseAddress));
|
||||
READ_PORT_UCHAR(SER_IER(BaseAddress));
|
||||
|
@ -39,7 +39,7 @@ SerialDetectUartType(
|
|||
READ_PORT_UCHAR(SER_LSR(BaseAddress));
|
||||
READ_PORT_UCHAR(SER_MSR(BaseAddress));
|
||||
READ_PORT_UCHAR(SER_SCR(BaseAddress));
|
||||
|
||||
|
||||
/* Test scratch pad */
|
||||
OldScr = READ_PORT_UCHAR(SER_SCR(BaseAddress));
|
||||
WRITE_PORT_UCHAR(SER_SCR(BaseAddress), 0x5A);
|
||||
|
@ -47,11 +47,11 @@ SerialDetectUartType(
|
|||
WRITE_PORT_UCHAR(SER_SCR(BaseAddress), 0xA5);
|
||||
ScrA5 = READ_PORT_UCHAR(SER_SCR(BaseAddress));
|
||||
WRITE_PORT_UCHAR(SER_SCR(BaseAddress), OldScr);
|
||||
|
||||
|
||||
/* When non-functional, we have a 8250 */
|
||||
if (Scr5A != 0x5A || ScrA5 != 0xA5)
|
||||
return Uart8250;
|
||||
|
||||
|
||||
/* Test FIFO type */
|
||||
FifoEnabled = (READ_PORT_UCHAR(SER_IIR(BaseAddress)) & 0x80) != 0;
|
||||
WRITE_PORT_UCHAR(SER_FCR(BaseAddress), SR_FCR_ENABLE_FIFO);
|
||||
|
@ -69,7 +69,7 @@ SerialDetectUartType(
|
|||
* with 0x80 */
|
||||
return Uart16550;
|
||||
}
|
||||
|
||||
|
||||
/* FIFO is only functional for 16550A+ */
|
||||
return Uart16550A;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ DetectLegacyDevice(
|
|||
PDEVICE_OBJECT Fdo;
|
||||
KIRQL Dirql;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
/* Create resource list */
|
||||
ResourceListSize = sizeof(CM_RESOURCE_LIST) + sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
||||
ResourceList = (PCM_RESOURCE_LIST)ExAllocatePoolWithTag(PagedPool, ResourceListSize, SERIAL_TAG);
|
||||
|
@ -109,7 +109,7 @@ DetectLegacyDevice(
|
|||
ResourceDescriptor->u.Port.Start.u.HighPart = 0;
|
||||
ResourceDescriptor->u.Port.Start.u.LowPart = ComPortBase;
|
||||
ResourceDescriptor->u.Port.Length = 8;
|
||||
|
||||
|
||||
ResourceDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[1];
|
||||
ResourceDescriptor->Type = CmResourceTypeInterrupt;
|
||||
ResourceDescriptor->ShareDisposition = CmResourceShareShared;
|
||||
|
@ -119,7 +119,7 @@ DetectLegacyDevice(
|
|||
&Dirql,
|
||||
&ResourceDescriptor->u.Interrupt.Affinity);
|
||||
ResourceDescriptor->u.Interrupt.Level = (ULONG)Dirql;
|
||||
|
||||
|
||||
/* Report resource list */
|
||||
Status = IoReportResourceForDetection(
|
||||
DriverObject, ResourceList, ResourceListSize,
|
||||
|
@ -136,10 +136,10 @@ DetectLegacyDevice(
|
|||
ExFreePoolWithTag(ResourceList, SERIAL_TAG);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/* Test if port exists */
|
||||
UartType = SerialDetectUartType((PUCHAR)ComPortBase);
|
||||
|
||||
|
||||
/* Report device if detected... */
|
||||
if (UartType != UartUnknown)
|
||||
{
|
||||
|
@ -181,7 +181,7 @@ DetectLegacyDevices(
|
|||
ULONG i;
|
||||
NTSTATUS Status;
|
||||
NTSTATUS ReturnedStatus = STATUS_SUCCESS;
|
||||
|
||||
|
||||
for (i = 0; i < sizeof(ComPortBase)/sizeof(ComPortBase[0]); i++)
|
||||
{
|
||||
Status = DetectLegacyDevice(DriverObject, ComPortBase[i], Irq[i], &ComPortNumber[i]);
|
||||
|
@ -189,6 +189,6 @@ DetectLegacyDevices(
|
|||
ReturnedStatus = Status;
|
||||
DPRINT("Serial: Legacy device at 0x%x (IRQ %lu): status = 0x%08lx\n", ComPortBase[i], Irq[i], Status);
|
||||
}
|
||||
|
||||
|
||||
return ReturnedStatus;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id:
|
||||
*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/dd/serial/misc.c
|
||||
* PURPOSE: Misceallenous operations
|
||||
*
|
||||
*
|
||||
* PROGRAMMERS: Hervé Poussineau (poussine@freesurf.fr)
|
||||
*/
|
||||
/* FIXME: call IoAcquireRemoveLock/IoReleaseRemoveLock around each I/O operation */
|
||||
|
@ -31,15 +31,15 @@ ForwardIrpAndWait(
|
|||
PDEVICE_OBJECT LowerDevice = ((PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
|
||||
KEVENT Event;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
ASSERT(LowerDevice);
|
||||
|
||||
|
||||
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
||||
IoCopyCurrentIrpStackLocationToNext(Irp);
|
||||
|
||||
|
||||
DPRINT("Serial: Calling lower device %p [%wZ]\n", LowerDevice, &LowerDevice->DriverObject->DriverName);
|
||||
IoSetCompletionRoutine(Irp, ForwardIrpAndWaitCompletion, &Event, TRUE, TRUE, TRUE);
|
||||
|
||||
|
||||
Status = IoCallDriver(LowerDevice, Irp);
|
||||
if (Status == STATUS_PENDING)
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ ForwardIrpAndWait(
|
|||
if (NT_SUCCESS(Status))
|
||||
Status = Irp->IoStatus.Status;
|
||||
}
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -57,9 +57,9 @@ ForwardIrpAndForget(
|
|||
IN PIRP Irp)
|
||||
{
|
||||
PDEVICE_OBJECT LowerDevice = ((PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
|
||||
|
||||
|
||||
ASSERT(LowerDevice);
|
||||
|
||||
|
||||
IoSkipCurrentIrpStackLocation(Irp);
|
||||
return IoCallDriver(LowerDevice, Irp);
|
||||
}
|
||||
|
@ -77,10 +77,10 @@ SerialReceiveByte(
|
|||
KIRQL Irql;
|
||||
UCHAR IER;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)pDeviceExtension;
|
||||
ComPortBase = (PUCHAR)DeviceExtension->BaseAddress;
|
||||
|
||||
|
||||
KeAcquireSpinLock(&DeviceExtension->InputBufferLock, &Irql);
|
||||
while (READ_PORT_UCHAR(SER_LSR(ComPortBase)) & SR_LSR_DATA_RECEIVED)
|
||||
{
|
||||
|
@ -95,7 +95,7 @@ SerialReceiveByte(
|
|||
}
|
||||
KeSetEvent(&DeviceExtension->InputBufferNotEmpty, 0, FALSE);
|
||||
KeReleaseSpinLock(&DeviceExtension->InputBufferLock, Irql);
|
||||
|
||||
|
||||
/* allow new interrupts */
|
||||
IER = READ_PORT_UCHAR(SER_IER(ComPortBase));
|
||||
WRITE_PORT_UCHAR(SER_IER(ComPortBase), IER | SR_IER_DATA_RECEIVED);
|
||||
|
@ -114,10 +114,10 @@ SerialSendByte(
|
|||
KIRQL Irql;
|
||||
UCHAR IER;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)pDeviceExtension;
|
||||
ComPortBase = (PUCHAR)DeviceExtension->BaseAddress;
|
||||
|
||||
|
||||
KeAcquireSpinLock(&DeviceExtension->OutputBufferLock, &Irql);
|
||||
while (!IsCircularBufferEmpty(&DeviceExtension->OutputBuffer)
|
||||
&& READ_PORT_UCHAR(SER_LSR(ComPortBase)) & SR_LSR_THR_EMPTY)
|
||||
|
@ -148,24 +148,24 @@ SerialInterruptService(
|
|||
PSERIAL_DEVICE_EXTENSION DeviceExtension;
|
||||
PUCHAR ComPortBase;
|
||||
UCHAR Iir;
|
||||
|
||||
|
||||
DeviceObject = (PDEVICE_OBJECT)ServiceContext;
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
ComPortBase = (PUCHAR)DeviceExtension->BaseAddress;
|
||||
|
||||
|
||||
Iir = READ_PORT_UCHAR(SER_IIR(ComPortBase));
|
||||
if (Iir == 0xff)
|
||||
return TRUE;
|
||||
Iir &= SR_IIR_ID_MASK;
|
||||
if ((Iir & SR_IIR_SELF) != 0) { return FALSE; }
|
||||
|
||||
|
||||
switch (Iir)
|
||||
{
|
||||
case SR_IIR_MSR_CHANGE:
|
||||
{
|
||||
UCHAR MSR, IER;
|
||||
DPRINT("Serial: SR_IIR_MSR_CHANGE\n");
|
||||
|
||||
|
||||
MSR = READ_PORT_UCHAR(SER_MSR(ComPortBase));
|
||||
if (MSR & SR_MSR_CTS_CHANGED)
|
||||
{
|
||||
|
@ -188,14 +188,14 @@ SerialInterruptService(
|
|||
case SR_IIR_THR_EMPTY:
|
||||
{
|
||||
DPRINT("Serial: SR_IIR_THR_EMPTY\n");
|
||||
|
||||
|
||||
KeInsertQueueDpc(&DeviceExtension->SendByteDpc, NULL, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
case SR_IIR_DATA_RECEIVED:
|
||||
{
|
||||
DPRINT("Serial: SR_IIR_DATA_RECEIVED\n");
|
||||
|
||||
|
||||
KeInsertQueueDpc(&DeviceExtension->ReceivedByteDpc, NULL, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ SerialInterruptService(
|
|||
{
|
||||
UCHAR LSR;
|
||||
DPRINT("Serial: SR_IIR_ERROR\n");
|
||||
|
||||
|
||||
LSR = READ_PORT_UCHAR(SER_LSR(ComPortBase));
|
||||
if (LSR & SR_LSR_OVERRUN_ERROR)
|
||||
InterlockedIncrement(&DeviceExtension->SerialPerfStats.SerialOverrunErrorCount);
|
||||
|
@ -213,7 +213,7 @@ SerialInterruptService(
|
|||
InterlockedIncrement(&DeviceExtension->SerialPerfStats.FrameErrorCount);
|
||||
if (LSR & SR_LSR_BREAK_INT)
|
||||
InterlockedIncrement(&DeviceExtension->BreakInterruptErrorCount);
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id:
|
||||
*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/dd/serial/pnp.c
|
||||
* PURPOSE: Serial IRP_MJ_PNP operations
|
||||
*
|
||||
*
|
||||
* PROGRAMMERS: Hervé Poussineau (poussine@freesurf.fr)
|
||||
*/
|
||||
/* FIXME: call IoAcquireRemoveLock/IoReleaseRemoveLock around each I/O operation */
|
||||
|
@ -28,12 +28,12 @@ SerialAddDeviceInternal(
|
|||
UNICODE_STRING DeviceName;
|
||||
static ULONG DeviceNumber = 0;
|
||||
static ULONG ComPortNumber = 1;
|
||||
|
||||
|
||||
DPRINT("Serial: SerialAddDeviceInternal called\n");
|
||||
|
||||
|
||||
ASSERT(DeviceObject);
|
||||
ASSERT(Pdo);
|
||||
|
||||
|
||||
/* Create new device object */
|
||||
swprintf(DeviceNameBuffer, L"\\Device\\Serial%lu", DeviceNumber);
|
||||
RtlInitUnicodeString(&DeviceName, DeviceNameBuffer);
|
||||
|
@ -52,7 +52,7 @@ SerialAddDeviceInternal(
|
|||
}
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)Fdo->DeviceExtension;
|
||||
RtlZeroMemory(DeviceExtension, sizeof(SERIAL_DEVICE_EXTENSION));
|
||||
|
||||
|
||||
/* Register device interface */
|
||||
Status = IoRegisterDeviceInterface(Pdo, &GUID_DEVINTERFACE_COMPORT, NULL, &DeviceExtension->SerialInterfaceName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -60,7 +60,7 @@ SerialAddDeviceInternal(
|
|||
DPRINT("Serial: IoRegisterDeviceInterface() failed with status 0x%08x\n", Status);
|
||||
goto ByeBye;
|
||||
}
|
||||
|
||||
|
||||
DeviceExtension->SerialPortNumber = DeviceNumber++;
|
||||
if (pComPortNumber == NULL)
|
||||
DeviceExtension->ComPort = ComPortNumber++;
|
||||
|
@ -92,7 +92,7 @@ SerialAddDeviceInternal(
|
|||
{
|
||||
*pFdo = Fdo;
|
||||
}
|
||||
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
ByeBye:
|
||||
|
@ -116,7 +116,7 @@ SerialAddDevice(
|
|||
*/
|
||||
if (Pdo == NULL)
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
|
||||
/* We have here a PDO not null. It represents a real serial
|
||||
* port. So call the internal AddDevice function.
|
||||
*/
|
||||
|
@ -147,13 +147,13 @@ SerialPnpStartDevice(
|
|||
UNICODE_STRING KeyName;
|
||||
HANDLE hKey;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
|
||||
ASSERT(ResourceList);
|
||||
ASSERT(DeviceExtension);
|
||||
ASSERT(DeviceExtension->PnpState == dsStopped);
|
||||
|
||||
|
||||
DeviceExtension->BaudRate = 19200 | SERIAL_BAUD_USER;
|
||||
DeviceExtension->BaseAddress = 0;
|
||||
Dirql = 0;
|
||||
|
@ -193,15 +193,15 @@ SerialPnpStartDevice(
|
|||
if (!Dirql)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
ComPortBase = (PUCHAR)DeviceExtension->BaseAddress;
|
||||
|
||||
|
||||
if (DeviceExtension->UartType == UartUnknown)
|
||||
DeviceExtension->UartType = SerialDetectUartType(ComPortBase);
|
||||
|
||||
|
||||
/* Get current settings */
|
||||
DeviceExtension->MCR = READ_PORT_UCHAR(SER_MCR(ComPortBase));
|
||||
DeviceExtension->MSR = READ_PORT_UCHAR(SER_MSR(ComPortBase));
|
||||
DeviceExtension->WaitMask = 0;
|
||||
|
||||
|
||||
/* Set baud rate */
|
||||
Status = SerialSetBaudRate(DeviceExtension, DeviceExtension->BaudRate);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -209,7 +209,7 @@ SerialPnpStartDevice(
|
|||
DPRINT("Serial: SerialSetBaudRate() failed with status 0x%08x\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/* Set line control */
|
||||
DeviceExtension->SerialLineControl.StopBits = STOP_BIT_1;
|
||||
DeviceExtension->SerialLineControl.Parity = NO_PARITY;
|
||||
|
@ -220,7 +220,7 @@ SerialPnpStartDevice(
|
|||
DPRINT("Serial: SerialSetLineControl() failed with status 0x%08x\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/* Clear receive/transmit buffers */
|
||||
if (DeviceExtension->UartType >= Uart16550A)
|
||||
{
|
||||
|
@ -228,7 +228,7 @@ SerialPnpStartDevice(
|
|||
WRITE_PORT_UCHAR(SER_FCR(ComPortBase),
|
||||
SR_FCR_CLEAR_RCVR | SR_FCR_CLEAR_XMIT);
|
||||
}
|
||||
|
||||
|
||||
/* Create link \DosDevices\COMX -> \Device\SerialX */
|
||||
swprintf(DeviceNameBuffer, L"\\Device\\Serial%lu", DeviceExtension->SerialPortNumber);
|
||||
swprintf(LinkNameBuffer, L"\\DosDevices\\COM%lu", DeviceExtension->ComPort);
|
||||
|
@ -242,7 +242,7 @@ SerialPnpStartDevice(
|
|||
DPRINT("Serial: IoCreateSymbolicLink() failed with status 0x%08x\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/* Activate serial interface */
|
||||
Status = IoSetDeviceInterfaceState(&DeviceExtension->SerialInterfaceName, TRUE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -251,7 +251,7 @@ SerialPnpStartDevice(
|
|||
IoDeleteSymbolicLink(&LinkName);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/* Connect interrupt and enable them */
|
||||
Status = IoConnectInterrupt(
|
||||
&DeviceExtension->Interrupt, SerialInterruptService,
|
||||
|
@ -266,7 +266,7 @@ SerialPnpStartDevice(
|
|||
IoDeleteSymbolicLink(&LinkName);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/* Write an entry value under HKLM\HARDWARE\DeviceMap\SERIALCOMM */
|
||||
/* This step is not mandatory, so don't exit in case of error */
|
||||
RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\HARDWARE\\DeviceMap\\SERIALCOMM");
|
||||
|
@ -278,18 +278,18 @@ SerialPnpStartDevice(
|
|||
ZwSetValueKey(hKey, &DeviceName, 0, REG_SZ, &ComPortBuffer, ComPort.Length + sizeof(WCHAR));
|
||||
ZwClose(hKey);
|
||||
}
|
||||
|
||||
|
||||
DeviceExtension->PnpState = dsStarted;
|
||||
|
||||
|
||||
/* Activate interrupt modes */
|
||||
IER = READ_PORT_UCHAR(SER_IER(ComPortBase));
|
||||
IER |= SR_IER_DATA_RECEIVED | SR_IER_THR_EMPTY | SR_IER_LSR_CHANGE | SR_IER_MSR_CHANGE;
|
||||
WRITE_PORT_UCHAR(SER_IER(ComPortBase), IER);
|
||||
|
||||
|
||||
/* Activate DTR, RTS */
|
||||
DeviceExtension->MCR |= SR_MCR_DTR | SR_MCR_RTS;
|
||||
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
|
||||
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -302,17 +302,17 @@ SerialPnp(
|
|||
PIO_STACK_LOCATION Stack;
|
||||
ULONG_PTR Information = 0;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
MinorFunction = Stack->MinorFunction;
|
||||
|
||||
|
||||
switch (MinorFunction)
|
||||
{
|
||||
case IRP_MN_START_DEVICE:
|
||||
{
|
||||
BOOLEAN ConflictDetected;
|
||||
DPRINT("Serial: IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
|
||||
|
||||
|
||||
/* FIXME: first HACK: PnP manager can send multiple
|
||||
* IRP_MN_START_DEVICE for one device
|
||||
*/
|
||||
|
@ -346,7 +346,7 @@ SerialPnp(
|
|||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/* Call lower driver */
|
||||
Status = ForwardIrpAndWait(DeviceObject, Irp);
|
||||
if (NT_SUCCESS(Status))
|
||||
|
@ -384,7 +384,7 @@ SerialPnp(
|
|||
return ForwardIrpAndForget(DeviceObject, Irp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Irp->IoStatus.Information = Information;
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id:
|
||||
*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/dd/serial/power.c
|
||||
* PURPOSE: Serial IRP_MJ_POWER operations
|
||||
*
|
||||
*
|
||||
* PROGRAMMERS: Hervé Poussineau (poussine@freesurf.fr)
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id:
|
||||
*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/dd/serial/create.c
|
||||
* PURPOSE: Serial IRP_MJ_READ/IRP_MJ_WRITE operations
|
||||
*
|
||||
*
|
||||
* PROGRAMMERS: Hervé Poussineau (poussine@freesurf.fr)
|
||||
*/
|
||||
|
||||
|
@ -15,7 +15,7 @@ static PVOID
|
|||
SerialGetUserBuffer(IN PIRP Irp)
|
||||
{
|
||||
ASSERT(Irp);
|
||||
|
||||
|
||||
return Irp->AssociatedIrp.SystemBuffer;
|
||||
}
|
||||
|
||||
|
@ -36,21 +36,21 @@ ReadBytes(
|
|||
PVOID ObjectsArray[2];
|
||||
ULONG_PTR Information = 0;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
ASSERT(DeviceObject);
|
||||
ASSERT(WorkItemData);
|
||||
|
||||
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
ComPortBase = (PUCHAR)DeviceExtension->BaseAddress;
|
||||
Length = IoGetCurrentIrpStackLocation(Irp)->Parameters.Read.Length;
|
||||
Buffer = SerialGetUserBuffer(Irp);
|
||||
|
||||
|
||||
DPRINT("Serial: UseIntervalTimeout = %s, IntervalTimeout = %lu\n",
|
||||
WorkItemData->UseIntervalTimeout ? "YES" : "NO",
|
||||
WorkItemData->UseIntervalTimeout ? WorkItemData->IntervalTimeout.QuadPart : 0);
|
||||
DPRINT("Serial: UseTotalTimeout = %s\n",
|
||||
WorkItemData->UseTotalTimeout ? "YES" : "NO");
|
||||
|
||||
|
||||
ObjectCount = 1;
|
||||
ObjectsArray[0] = &DeviceExtension->InputBufferNotEmpty;
|
||||
if (WorkItemData->UseTotalTimeout)
|
||||
|
@ -60,7 +60,7 @@ ReadBytes(
|
|||
ObjectsArray[ObjectCount] = &TotalTimeoutTimer;
|
||||
ObjectCount++;
|
||||
}
|
||||
|
||||
|
||||
/* while buffer is not fully filled */
|
||||
while (Length > 0)
|
||||
{
|
||||
|
@ -71,20 +71,20 @@ ReadBytes(
|
|||
{
|
||||
PopCircularBufferEntry(&DeviceExtension->InputBuffer, &ReceivedByte);
|
||||
DPRINT("Serial: reading byte from buffer: 0x%02x\n", ReceivedByte);
|
||||
|
||||
|
||||
Buffer[Information++] = ReceivedByte;
|
||||
Length--;
|
||||
}
|
||||
KeClearEvent(&DeviceExtension->InputBufferNotEmpty);
|
||||
KeReleaseSpinLock(&DeviceExtension->InputBufferLock, Irql);
|
||||
|
||||
|
||||
if (WorkItemData->DontWait
|
||||
&& !(WorkItemData->ReadAtLeastOneByte && Information == 0))
|
||||
{
|
||||
DPRINT("Serial: buffer empty. Don't wait more bytes\n");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Status = KeWaitForMultipleObjects(
|
||||
ObjectCount,
|
||||
ObjectsArray,
|
||||
|
@ -94,7 +94,7 @@ ReadBytes(
|
|||
FALSE,
|
||||
(WorkItemData->UseIntervalTimeout && Information > 0) ? &WorkItemData->IntervalTimeout : NULL,
|
||||
NULL);
|
||||
|
||||
|
||||
if (Status == STATUS_TIMEOUT /* interval timeout */
|
||||
|| Status == STATUS_WAIT_1) /* total timeout */
|
||||
{
|
||||
|
@ -102,11 +102,11 @@ ReadBytes(
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* stop total timeout timer */
|
||||
if (WorkItemData->UseTotalTimeout)
|
||||
KeCancelTimer(&TotalTimeoutTimer);
|
||||
|
||||
|
||||
Irp->IoStatus.Information = Information;
|
||||
if (Information == 0)
|
||||
Irp->IoStatus.Status = STATUS_TIMEOUT;
|
||||
|
@ -121,16 +121,16 @@ SerialReadWorkItem(
|
|||
{
|
||||
PWORKITEM_DATA WorkItemData;
|
||||
PIRP Irp;
|
||||
|
||||
|
||||
DPRINT("Serial: SerialReadWorkItem() called\n");
|
||||
|
||||
|
||||
WorkItemData = (PWORKITEM_DATA)pWorkItemData;
|
||||
Irp = WorkItemData->Irp;
|
||||
|
||||
|
||||
ReadBytes(DeviceObject, Irp, WorkItemData);
|
||||
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
|
||||
IoFreeWorkItem(WorkItemData->IoWorkItem);
|
||||
ExFreePoolWithTag(pWorkItemData, SERIAL_TAG);
|
||||
}
|
||||
|
@ -147,26 +147,26 @@ SerialRead(
|
|||
PWORKITEM_DATA WorkItemData;
|
||||
PIO_WORKITEM WorkItem;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
DPRINT("Serial: IRP_MJ_READ\n");
|
||||
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
Length = Stack->Parameters.Read.Length;
|
||||
Buffer = SerialGetUserBuffer(Irp);
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
|
||||
if (Stack->Parameters.Read.ByteOffset.QuadPart != 0 || Buffer == NULL)
|
||||
{
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
goto ByeBye;
|
||||
}
|
||||
|
||||
|
||||
if (Length == 0)
|
||||
{
|
||||
Status = STATUS_SUCCESS;
|
||||
goto ByeBye;
|
||||
}
|
||||
|
||||
|
||||
/* Allocate memory for parameters */
|
||||
WorkItemData = ExAllocatePoolWithTag(PagedPool, sizeof(WORKITEM_DATA), SERIAL_TAG);
|
||||
if (!WorkItemData)
|
||||
|
@ -176,7 +176,7 @@ SerialRead(
|
|||
}
|
||||
RtlZeroMemory(WorkItemData, sizeof(WORKITEM_DATA));
|
||||
WorkItemData->Irp = Irp;
|
||||
|
||||
|
||||
/* Calculate time outs */
|
||||
if (DeviceExtension->SerialTimeOuts.ReadIntervalTimeout == INFINITE &&
|
||||
DeviceExtension->SerialTimeOuts.ReadTotalTimeoutMultiplier == INFINITE &&
|
||||
|
@ -207,7 +207,7 @@ SerialRead(
|
|||
{
|
||||
ULONG TotalTimeout;
|
||||
LARGE_INTEGER SystemTime;
|
||||
|
||||
|
||||
WorkItemData->UseTotalTimeout = TRUE;
|
||||
TotalTimeout = DeviceExtension->SerialTimeOuts.ReadTotalTimeoutConstant +
|
||||
DeviceExtension->SerialTimeOuts.ReadTotalTimeoutMultiplier * Length;
|
||||
|
@ -216,7 +216,7 @@ SerialRead(
|
|||
TotalTimeout * 10000;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Pend IRP */
|
||||
WorkItem = IoAllocateWorkItem(DeviceObject);
|
||||
if (WorkItem)
|
||||
|
@ -226,7 +226,7 @@ SerialRead(
|
|||
IoMarkIrpPending(Irp);
|
||||
return STATUS_PENDING;
|
||||
}
|
||||
|
||||
|
||||
/* insufficient resources, we can't pend the Irp */
|
||||
CHECKPOINT;
|
||||
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
|
@ -237,7 +237,7 @@ SerialRead(
|
|||
}
|
||||
ReadBytes(DeviceObject, Irp, WorkItemData);
|
||||
Status = Irp->IoStatus.Status;
|
||||
|
||||
|
||||
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
|
||||
ByeBye:
|
||||
|
@ -259,28 +259,28 @@ SerialWrite(
|
|||
PUCHAR ComPortBase;
|
||||
KIRQL Irql;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
|
||||
DPRINT("Serial: IRP_MJ_WRITE\n");
|
||||
|
||||
|
||||
/* FIXME: pend operation if possible */
|
||||
/* FIXME: use write timeouts */
|
||||
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
Length = Stack->Parameters.Write.Length;
|
||||
Buffer = SerialGetUserBuffer(Irp);
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
ComPortBase = (PUCHAR)DeviceExtension->BaseAddress;
|
||||
|
||||
|
||||
if (Stack->Parameters.Write.ByteOffset.QuadPart != 0 || Buffer == NULL)
|
||||
{
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
goto ByeBye;
|
||||
}
|
||||
|
||||
|
||||
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
if (!NT_SUCCESS(Status))
|
||||
goto ByeBye;
|
||||
|
||||
|
||||
/* push bytes into output buffer */
|
||||
KeAcquireSpinLock(&DeviceExtension->OutputBufferLock, &Irql);
|
||||
while (Information < Length)
|
||||
|
@ -306,7 +306,7 @@ SerialWrite(
|
|||
}
|
||||
KeReleaseSpinLock(&DeviceExtension->OutputBufferLock, Irql);
|
||||
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
|
||||
|
||||
/* send bytes */
|
||||
SerialSendByte(NULL, DeviceExtension, NULL, NULL);
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* $Id:
|
||||
*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/dd/serial/serial.c
|
||||
* PURPOSE: Serial driver loading/unloading
|
||||
*
|
||||
*
|
||||
* PROGRAMMERS: Hervé Poussineau (poussine@freesurf.fr)
|
||||
*/
|
||||
|
||||
|
@ -26,10 +26,10 @@ DriverEntry(
|
|||
IN PUNICODE_STRING RegPath)
|
||||
{
|
||||
ULONG i;
|
||||
|
||||
|
||||
DriverObject->DriverUnload = DriverUnload;
|
||||
DriverObject->DriverExtension->AddDevice = SerialAddDevice;
|
||||
|
||||
|
||||
for (i = 0; i < IRP_MJ_MAXIMUM_FUNCTION; i++)
|
||||
DriverObject->MajorFunction[i] = ForwardIrpAndForget;
|
||||
DriverObject->MajorFunction[IRP_MJ_CREATE] = SerialCreate;
|
||||
|
@ -41,6 +41,6 @@ DriverEntry(
|
|||
DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = SerialQueryInformation;
|
||||
DriverObject->MajorFunction[IRP_MJ_PNP] = SerialPnp;
|
||||
DriverObject->MajorFunction[IRP_MJ_POWER] = SerialPower;
|
||||
|
||||
|
||||
return DetectLegacyDevices(DriverObject);
|
||||
}
|
||||
|
|
|
@ -2,34 +2,34 @@
|
|||
#include <ddk/ntddk.h>
|
||||
#include <ddk/ntddser.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
|
||||
/* FIXME: these prototypes MUST NOT be here! */
|
||||
NTSTATUS STDCALL
|
||||
IoAttachDeviceToDeviceStackSafe(
|
||||
IN PDEVICE_OBJECT SourceDevice,
|
||||
IN PDEVICE_OBJECT TargetDevice,
|
||||
OUT PDEVICE_OBJECT *AttachedToDeviceObject);
|
||||
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
#include <ntddk.h>
|
||||
#include <ntddser.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#define STDCALL
|
||||
|
||||
|
||||
#define DPRINT1 DbgPrint("(%s:%d) ", __FILE__, __LINE__), DbgPrint
|
||||
#define CHECKPOINT1 DbgPrint("(%s:%d)\n", __FILE__, __LINE__)
|
||||
|
||||
|
||||
#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
|
||||
|
||||
|
||||
NTSTATUS STDCALL
|
||||
IoAttachDeviceToDeviceStackSafe(
|
||||
IN PDEVICE_OBJECT SourceDevice,
|
||||
IN PDEVICE_OBJECT TargetDevice,
|
||||
OUT PDEVICE_OBJECT *AttachedToDeviceObject);
|
||||
|
||||
|
||||
#ifdef NDEBUG2
|
||||
#define DPRINT
|
||||
#define CHECKPOINT
|
||||
|
@ -76,20 +76,20 @@ typedef struct _SERIAL_DEVICE_EXTENSION
|
|||
PDEVICE_OBJECT LowerDevice;
|
||||
SERIAL_DEVICE_STATE PnpState;
|
||||
IO_REMOVE_LOCK RemoveLock;
|
||||
|
||||
|
||||
ULONG SerialPortNumber;
|
||||
|
||||
|
||||
ULONG ComPort;
|
||||
ULONG BaudRate;
|
||||
ULONG BaseAddress;
|
||||
PKINTERRUPT Interrupt;
|
||||
KDPC ReceivedByteDpc;
|
||||
KDPC SendByteDpc;
|
||||
|
||||
|
||||
SERIAL_LINE_CONTROL SerialLineControl;
|
||||
UART_TYPE UartType;
|
||||
ULONG WaitMask;
|
||||
|
||||
|
||||
ULONG BreakInterruptErrorCount;
|
||||
SERIALPERF_STATS SerialPerfStats;
|
||||
SERIAL_TIMEOUTS SerialTimeOuts;
|
||||
|
@ -99,9 +99,9 @@ typedef struct _SERIAL_DEVICE_EXTENSION
|
|||
KSPIN_LOCK InputBufferLock;
|
||||
CIRCULAR_BUFFER OutputBuffer;
|
||||
KSPIN_LOCK OutputBufferLock;
|
||||
|
||||
|
||||
UNICODE_STRING SerialInterfaceName;
|
||||
|
||||
|
||||
/* Current values */
|
||||
UCHAR MCR; /* Base+4, Modem Control Register */
|
||||
UCHAR MSR; /* Base+6, Modem Status Register */
|
||||
|
@ -111,7 +111,7 @@ typedef struct _WORKITEM_DATA
|
|||
{
|
||||
PIRP Irp;
|
||||
PIO_WORKITEM IoWorkItem;
|
||||
|
||||
|
||||
BOOLEAN UseIntervalTimeout;
|
||||
BOOLEAN UseTotalTimeout;
|
||||
LARGE_INTEGER IntervalTimeout;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
BOOLEAN WaitToSend(UINT BasePort)
|
||||
{
|
||||
int TimeOut;
|
||||
|
||||
|
||||
DPRINT("WaitToSend ");
|
||||
|
||||
// Check if it's OK to send
|
||||
|
@ -30,7 +30,7 @@ BOOLEAN WaitToSend(UINT BasePort)
|
|||
DPRINT("FAILED\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
DPRINT("SUCCEEDED\n");
|
||||
|
||||
return TRUE;
|
||||
|
@ -53,7 +53,7 @@ BOOLEAN WaitToReceive(UINT BasePort)
|
|||
DPRINT("FAILED\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
DPRINT("SUCCEEDED\n");
|
||||
|
||||
return TRUE;
|
||||
|
@ -107,6 +107,6 @@ WORD InitSoundCard(UINT BasePort)
|
|||
return FALSE;
|
||||
|
||||
DPRINT("Sound card initialized!\n");
|
||||
|
||||
|
||||
return (DSP_Major * 256) + DSP_Minor;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ NTSTATUS InitDevice(
|
|||
DPRINT("Sorry - only 1 device supported by Sound Blaster driver at present :(\n");
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
DPRINT("Creating IO device\n");
|
||||
|
||||
s = IoCreateDevice(Context, // driverobject
|
||||
|
@ -78,7 +78,7 @@ NTSTATUS InitDevice(
|
|||
// Parameters = Instance->DriverObject->DriverExtension;
|
||||
|
||||
DPRINT("DeviceObject at 0x%x, DeviceExtension at 0x%x\n", DeviceObject, Parameters);
|
||||
|
||||
|
||||
if (! Parameters)
|
||||
{
|
||||
DPRINT("NULL POINTER!\n");
|
||||
|
@ -102,9 +102,9 @@ NTSTATUS InitDevice(
|
|||
Parameters->BufferSize = DEFAULT_BUFSIZE;
|
||||
|
||||
// Only to be enabled once we can get support for multiple cards working :)
|
||||
/*
|
||||
/*
|
||||
DPRINT("Loading settings from: %S\n", RegistryPath);
|
||||
|
||||
|
||||
s = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, RegistryPath, Table,
|
||||
&Parameters, NULL);
|
||||
|
||||
|
@ -159,7 +159,7 @@ BlasterCreate(PDEVICE_OBJECT DeviceObject,
|
|||
*/
|
||||
{
|
||||
DPRINT("BlasterCreate() called!\n");
|
||||
|
||||
|
||||
// Initialize the MPU-401
|
||||
// ... do stuff ...
|
||||
|
||||
|
@ -181,7 +181,7 @@ BlasterCreate(PDEVICE_OBJECT DeviceObject,
|
|||
IO_NO_INCREMENT);
|
||||
|
||||
DPRINT("BlasterCreate() completed\n");
|
||||
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ BlasterClose(PDEVICE_OBJECT DeviceObject,
|
|||
NTSTATUS Status;
|
||||
|
||||
DPRINT("BlasterClose() called!\n");
|
||||
|
||||
|
||||
DeviceExtension = DeviceObject->DeviceExtension;
|
||||
|
||||
Status = STATUS_SUCCESS;
|
||||
|
@ -310,7 +310,7 @@ BlasterDeviceControl(PDEVICE_OBJECT DeviceObject,
|
|||
Data = (PBYTE) Irp->AssociatedIrp.SystemBuffer;
|
||||
|
||||
DPRINT("Sending %d bytes of MIDI data to 0x%d:\n", Stack->Parameters.DeviceIoControl.InputBufferLength, DeviceExtension->Port);
|
||||
|
||||
|
||||
for (ByteCount = 0; ByteCount < Stack->Parameters.DeviceIoControl.InputBufferLength; ByteCount ++)
|
||||
{
|
||||
DPRINT("0x%x ", Data[ByteCount]);
|
||||
|
@ -322,12 +322,12 @@ BlasterDeviceControl(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
|
||||
/*
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
* FILE: drivers/dd/sound/dsp.c
|
||||
* PURPOSE: Digital Signal Processing ?
|
||||
* PROGRAMMER: Snatched from ?
|
||||
*
|
||||
* UPDATE HISTORY:
|
||||
*
|
||||
* UPDATE HISTORY:
|
||||
* ??/??/??: Created
|
||||
* 10/23/02: Steven Edwards (Steven_Ed4153@yahoo.com)
|
||||
* Minor build fix
|
||||
* Minor build fix
|
||||
*/
|
||||
|
||||
#include "dsp.h"
|
||||
|
@ -68,10 +68,10 @@ sb_status reset_dsp(unsigned short base_address)
|
|||
|
||||
return SB_TRUE;
|
||||
}
|
||||
|
||||
|
||||
void write_dsp(unsigned short base,unsigned char data)
|
||||
{
|
||||
// while ((inb(base+DSP_WRITE_PORT) & 0x80) != 0);
|
||||
// outb(base+DSP_WRITE_PORT, data);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
* FILE: drivers/dd/sound/mixer.c
|
||||
* PURPOSE: Wave Mixer?
|
||||
* PROGRAMMER: ?
|
||||
*
|
||||
* UPDATE HISTORY:
|
||||
*
|
||||
* UPDATE HISTORY:
|
||||
* ??/??/??: Created
|
||||
* 10/23/02: Steven Edwards (Steven_Ed4153@yahoo.com)
|
||||
* Minor build fixes
|
||||
* Minor build fixes
|
||||
*/
|
||||
|
||||
#include "dsp.h"
|
||||
|
@ -42,7 +42,7 @@ void get_dma(SB16* sb16)
|
|||
if(hi==0x80) sb16->dma16=7;
|
||||
if(hi==0x40) sb16->dma16=6;
|
||||
if(hi==0x20) sb16->dma16=5;
|
||||
|
||||
|
||||
if(lo==0x08) sb16->dma8=3;
|
||||
if(lo==0x02) sb16->dma8=1;
|
||||
if(lo==0x01) sb16->dma8=0;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* PROGRAMMER: Steven Edwards
|
||||
* UPDATE HISTORY:
|
||||
* 19/01/04 Created
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* INCLUDES ****************************************************************/
|
||||
|
|
|
@ -6,4 +6,4 @@ typedef struct
|
|||
unsigned char dma16;
|
||||
unsigned char* buffer;
|
||||
}SB16;
|
||||
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
* PURPOSE: SoundBlaster 16 Driver
|
||||
* PROGRAMMER: Snatched from David Welch (welch@mcmail.com)
|
||||
* Modified for Soundblaster by Robert Bergkvist (fragdance@hotmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* UPDATE HISTORY:
|
||||
* ??/??/??: Created
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* FUNCTIONS **************************************************************/
|
||||
|
@ -37,7 +37,7 @@ NTSTATUS STDCALL Dispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
{
|
||||
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
NTSTATUS status;
|
||||
|
||||
|
||||
switch (Stack->MajorFunction)
|
||||
{
|
||||
case IRP_MJ_CREATE:
|
||||
|
@ -45,25 +45,25 @@ NTSTATUS STDCALL Dispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
reset_dsp(sb16.base);
|
||||
status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
||||
|
||||
case IRP_MJ_CLOSE:
|
||||
status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
||||
|
||||
case IRP_MJ_WRITE:
|
||||
DPRINT1("(SoundBlaster 16 Driver) Writing %d bytes\n",Stack->Parameters.Write.Length);
|
||||
sb16_play((WAVE_HDR*)Irp->UserBuffer);
|
||||
status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Irp->IoStatus.Status = status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return(status);
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ NTSTATUS ModuleEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
|
|||
{
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
NTSTATUS ret;
|
||||
|
||||
|
||||
DPRINT1("SoundBlaster 16 Driver 0.0.1\n");
|
||||
if(sb16_getenvironment()!=SB_TRUE)
|
||||
{
|
||||
|
@ -89,14 +89,14 @@ NTSTATUS ModuleEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
|
|||
ret = IoCreateDevice(DriverObject,0,"\\Device\\WaveOut",FILE_DEVICE_WAVE_OUT,0,FALSE,&DeviceObject);
|
||||
if (ret!=STATUS_SUCCESS)
|
||||
return(ret);
|
||||
|
||||
|
||||
DeviceObject->Flags=0;
|
||||
DriverObject->MajorFunction[IRP_MJ_CLOSE] = Dispatch;
|
||||
DriverObject->MajorFunction[IRP_MJ_CREATE] =Dispatch;
|
||||
DriverObject->MajorFunction[IRP_MJ_WRITE] = Dispatch;
|
||||
DriverObject->MajorFunction[IRP_MJ_WRITE] = Dispatch;
|
||||
DriverObject->DriverUnload = NULL;
|
||||
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
* PURPOSE: SoundBlaster 16 Driver
|
||||
* PROGRAMMER: Snatched from David Welch (welch@mcmail.com)
|
||||
* Modified for Soundblaster by Robert Bergkvist (fragdance@hotmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* UPDATE HISTORY:
|
||||
* ??/??/??: Created
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* FUNCTIONS **************************************************************/
|
||||
|
@ -43,7 +43,7 @@ void sb16_play(WAVE_HDR* wave)
|
|||
KAFFINITY Affinity;
|
||||
PKINTERRUPT IrqObject;
|
||||
unsigned int mask,newmask;
|
||||
|
||||
|
||||
unsigned int i;
|
||||
unsigned int tmp[255];
|
||||
i=0;
|
||||
|
@ -66,7 +66,7 @@ void sb16_play(WAVE_HDR* wave)
|
|||
__asm__("pushf\n\tpop %0\n\tcli\n\t"
|
||||
: "=m" (eflags)
|
||||
: );
|
||||
|
||||
|
||||
memcpy(sb16.buffer,(&wave->data),wave->dLen);
|
||||
|
||||
|
||||
|
@ -74,7 +74,7 @@ void sb16_play(WAVE_HDR* wave)
|
|||
|
||||
|
||||
|
||||
IoConnectInterrupt(&IrqObject,DMAOutputISR,0,NULL,MappedIrq,Dirql,Dirql,0,FALSE,Affinity,FALSE);
|
||||
IoConnectInterrupt(&IrqObject,DMAOutputISR,0,NULL,MappedIrq,Dirql,Dirql,0,FALSE,Affinity,FALSE);
|
||||
|
||||
// mask=inb(0x21);
|
||||
newmask=((int)1<<sb16.irq);
|
||||
|
@ -83,10 +83,10 @@ void sb16_play(WAVE_HDR* wave)
|
|||
// Restore the interrupt flag
|
||||
__asm__("push %0\n\tpopf\n\t"
|
||||
:
|
||||
: "m" (eflags));
|
||||
: "m" (eflags));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// disable_dma(sb16.dma8);
|
||||
//outb(0x0a,5);
|
||||
// clear_dma_ff(1);
|
||||
|
@ -102,9 +102,9 @@ void sb16_play(WAVE_HDR* wave)
|
|||
//outb(0x2,(((unsigned int)(sb16.buffer-IDMAP_BASE)>>8))&0xff);
|
||||
//enable_dma(sb16.dma8);
|
||||
//outb(0xa,1);
|
||||
|
||||
|
||||
write_dsp(sb16.base,0x00D1);
|
||||
|
||||
|
||||
write_dsp(sb16.base,0x40);
|
||||
write_dsp(sb16.base,((unsigned char)256-(1000000/wave->nSamplesPerSec)));
|
||||
|
||||
|
@ -113,23 +113,23 @@ void sb16_play(WAVE_HDR* wave)
|
|||
|
||||
// outb(sb16.base + 4, (int) 4);
|
||||
// outb(sb16.base + 5, (int) 0xFF);
|
||||
|
||||
|
||||
// outb(sb16.base + 4, (int) 0x22);
|
||||
// outb(sb16.base + 5, (int) 0xFF);
|
||||
|
||||
write_dsp(sb16.base,0x14);
|
||||
write_dsp(sb16.base,(wave->dLen&0x00ff));
|
||||
write_dsp(sb16.base,(wave->dLen&0x00ff));
|
||||
write_dsp(sb16.base,((wave->dLen)&0xff00)>>8);
|
||||
|
||||
// write_dsp(sb16.base,0xc0);
|
||||
// write_dsp(sb16.base,0x0);
|
||||
// OldIRQ=HalGetInterruptVector(Internal,0,0,irq+8,&irql,&affinity);
|
||||
// DPRINT1("OldIRQ: 0x%x\n",OldIRQ);
|
||||
|
||||
|
||||
// status=IoConnectInterrupt(&IrqObject,playRoutine,0,NULL,OldIRQ,irql,irql,0,FALSE,affinity,FALSE);
|
||||
// if(status!=STATUS_SUCCESS) DPRINT1("Couldn't set irq\n");
|
||||
// else DPRINT1("IRQ set\n");
|
||||
|
||||
|
||||
}
|
||||
|
||||
void dump_wav(WAVE_HDR* wave)
|
||||
|
|
|
@ -2,7 +2,7 @@ KIRQL irql;
|
|||
KAFFINITY affinity;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
{
|
||||
unsigned char rID[4] __attribute__((packed)); //4 0
|
||||
unsigned int rLen __attribute__((packed)); //4 4
|
||||
unsigned char wID[4] __attribute__((packed)); //4 8
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* FILE: services/test/test.c
|
||||
* PURPOSE: Testing driver
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* UPDATE HISTORY:
|
||||
* ??/??/??: Created
|
||||
* 18/06/98: Made more NT like
|
||||
*/
|
||||
|
@ -20,7 +20,7 @@
|
|||
NTSTATUS STDCALL TestWrite(PIRP Irp, PIO_STACK_LOCATION Stk)
|
||||
{
|
||||
PVOID Address;
|
||||
|
||||
|
||||
Address = MmGetSystemAddressForMdl(Irp->MdlAddress);
|
||||
DbgPrint("Asked to write '%s'\n",(PCH)Address);
|
||||
return(STATUS_SUCCESS);
|
||||
|
@ -38,31 +38,31 @@ NTSTATUS STDCALL TestDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
NTSTATUS status;
|
||||
int i;
|
||||
|
||||
|
||||
switch (Stack->MajorFunction)
|
||||
{
|
||||
case IRP_MJ_CREATE:
|
||||
DbgPrint("(Test Driver) Creating\n");
|
||||
status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
||||
|
||||
case IRP_MJ_CLOSE:
|
||||
status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
||||
|
||||
case IRP_MJ_WRITE:
|
||||
DbgPrint("(Test Driver) Writing\n");
|
||||
status = TestWrite(Irp,Stack);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Irp->IoStatus.Status = status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return(status);
|
||||
}
|
||||
|
@ -82,9 +82,9 @@ NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
|
|||
NTSTATUS ret;
|
||||
ANSI_STRING astr;
|
||||
UNICODE_STRING ustr;
|
||||
|
||||
|
||||
DbgPrint("Test Driver 0.0.1\n");
|
||||
|
||||
|
||||
#if 0
|
||||
RtlInitAnsiString(&astr,"\\Device\\Test");
|
||||
RtlAnsiStringToUnicodeString(&ustr,&astr,TRUE);
|
||||
|
|
|
@ -93,7 +93,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
|
|||
CdfsDirectoryControl;
|
||||
DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] =
|
||||
CdfsQueryInformation;
|
||||
DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] =
|
||||
DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] =
|
||||
CdfsSetInformation;
|
||||
DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION] =
|
||||
CdfsQueryVolumeInformation;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
* FILE: services/fs/cdfs/cleanup.c
|
||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER: Hartmut Birr
|
||||
* UPDATE HISTORY:
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
@ -60,7 +60,7 @@ CdfsCleanupFile(PDEVICE_EXTENSION DeviceExt,
|
|||
CcUninitializeCacheMap (FileObject, NULL, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
* FILE: services/fs/cdfs/close.c
|
||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER: Art Yerkes
|
||||
* UPDATE HISTORY:
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
@ -46,7 +46,7 @@ CdfsCloseFile(PDEVICE_EXTENSION DeviceExt,
|
|||
*/
|
||||
{
|
||||
PCCB Ccb;
|
||||
|
||||
|
||||
DPRINT("CdfsCloseFile(DeviceExt %x, FileObject %x)\n",
|
||||
DeviceExt,
|
||||
FileObject);
|
||||
|
|
|
@ -144,9 +144,9 @@ CdfsDeviceIoControl (IN PDEVICE_OBJECT DeviceObject,
|
|||
NTSTATUS Status;
|
||||
|
||||
DPRINT("CdfsDeviceIoControl(DeviceObject %x, CtlCode %x, "
|
||||
"InputBuffer %x, InputBufferSize %x, OutputBuffer %x, "
|
||||
"POutputBufferSize %x (%x)\n", DeviceObject, CtlCode,
|
||||
InputBuffer, InputBufferSize, OutputBuffer, OutputBufferSize,
|
||||
"InputBuffer %x, InputBufferSize %x, OutputBuffer %x, "
|
||||
"POutputBufferSize %x (%x)\n", DeviceObject, CtlCode,
|
||||
InputBuffer, InputBufferSize, OutputBuffer, OutputBufferSize,
|
||||
OutputBufferSize ? *OutputBufferSize : 0);
|
||||
|
||||
KeInitializeEvent (&Event, NotificationEvent, FALSE);
|
||||
|
|
|
@ -214,7 +214,7 @@ CdfsCreateFile(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
RequestedDisposition = ((Stack->Parameters.Create.Options >> 24) & 0xff);
|
||||
RequestedOptions = Stack->Parameters.Create.Options & FILE_VALID_OPTION_FLAGS;
|
||||
DPRINT("RequestedDisposition %x, RequestedOptions %x\n",
|
||||
DPRINT("RequestedDisposition %x, RequestedOptions %x\n",
|
||||
RequestedDisposition, RequestedOptions);
|
||||
|
||||
FileObject = Stack->FileObject;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER: Art Yerkes
|
||||
* Eric Kohl
|
||||
* UPDATE HISTORY:
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
@ -58,7 +58,7 @@ CdfsGetEntryName(PDEVICE_EXTENSION DeviceExt,
|
|||
{
|
||||
PDIR_RECORD Record = *Ptr;
|
||||
ULONG Index;
|
||||
|
||||
|
||||
if (*CurrentOffset >= DirLength)
|
||||
return(STATUS_NO_MORE_ENTRIES);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
* FILE: services/fs/cdfs/fcb.c
|
||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER: Art Yerkes
|
||||
* UPDATE HISTORY:
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
@ -434,7 +434,7 @@ CdfsAttachFCBToFileObject(PDEVICE_EXTENSION Vcb,
|
|||
FileObject->FsContext2 = newCCB;
|
||||
newCCB->PtrFileObject = FileObject;
|
||||
Fcb->DevExt = Vcb;
|
||||
|
||||
|
||||
if (CdfsFCBIsDirectory(Fcb))
|
||||
{
|
||||
#ifdef USE_ROS_CC_AND_FS
|
||||
|
@ -528,7 +528,7 @@ CdfsDirFindFile(PDEVICE_EXTENSION DeviceExt,
|
|||
DPRINT("RecordLength == 0 Stopped!\n");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
DPRINT("RecordLength %u ExtAttrRecordLength %u NameLength %u\n",
|
||||
Record->RecordLength, Record->ExtAttrRecordLength, Record->FileIdLength);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER: Art Yerkes
|
||||
* Eric Kohl
|
||||
* UPDATE HISTORY:
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
@ -62,7 +62,7 @@ CdfsGetStandardInformation(PFCB Fcb,
|
|||
|
||||
if (CdfsFCBIsDirectory(Fcb))
|
||||
{
|
||||
StandardInfo->AllocationSize.QuadPart = 0LL;;
|
||||
StandardInfo->AllocationSize.QuadPart = 0LL;
|
||||
StandardInfo->EndOfFile.QuadPart = 0LL;
|
||||
StandardInfo->Directory = TRUE;
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ CdfsGetNetworkOpenInformation(PFCB Fcb,
|
|||
&NetworkInfo->ChangeTime);
|
||||
if (CdfsFCBIsDirectory(Fcb))
|
||||
{
|
||||
NetworkInfo->AllocationSize.QuadPart = 0LL;;
|
||||
NetworkInfo->AllocationSize.QuadPart = 0LL;
|
||||
NetworkInfo->EndOfFile.QuadPart = 0LL;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -223,7 +223,7 @@ CdfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
|||
return Status;
|
||||
}
|
||||
|
||||
DPRINT("FirstSession %d, LastSession %d, FirstTrack %d\n",
|
||||
DPRINT("FirstSession %d, LastSession %d, FirstTrack %d\n",
|
||||
Toc.FirstSession, Toc.LastSession, Toc.TrackData.TrackNumber);
|
||||
|
||||
Offset = 0;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
* FILE: services/fs/cdfs/misc.c
|
||||
* PURPOSE: CDROM (ISO 9660) filesystem driver
|
||||
* PROGRAMMER: Eric Kohl
|
||||
* UPDATE HISTORY:
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
|
|
@ -171,7 +171,7 @@ CdfsRead(PDEVICE_OBJECT DeviceObject,
|
|||
{
|
||||
if (FileObject->Flags & FO_SYNCHRONOUS_IO)
|
||||
{
|
||||
FileObject->CurrentByteOffset.QuadPart =
|
||||
FileObject->CurrentByteOffset.QuadPart =
|
||||
ReadOffset.QuadPart + ReturnedReadLength;
|
||||
}
|
||||
Irp->IoStatus.Information = ReturnedReadLength;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* FILE: services/fs/ext2/attr.c
|
||||
* PURPOSE: Set/Get file attributes support
|
||||
* PROGRAMMER: David Welch (welch@cwcom.net)
|
||||
* UPDATE HISTORY:
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
@ -24,12 +24,12 @@ NTSTATUS STDCALL
|
|||
Ext2SetInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||
{
|
||||
DPRINT("Ext2SetInformation(DeviceObject %x Irp %x)\n",DeviceObject,Irp);
|
||||
|
||||
|
||||
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp,
|
||||
IO_NO_INCREMENT);
|
||||
|
||||
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
|
@ -49,15 +49,15 @@ Ext2QueryInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
PFILE_NAME_INFORMATION PFileNameInformation;
|
||||
PFILE_POSITION_INFORMATION PFilePositionInformation;
|
||||
PVOID Buffer;
|
||||
|
||||
|
||||
DPRINT("Ext2QueryInformation(DeviceObject %x Irp %x)\n", DeviceObject, Irp);
|
||||
|
||||
|
||||
Param = IoGetCurrentIrpStackLocation(Irp);
|
||||
FileObject = Param->FileObject;
|
||||
DeviceExt = DeviceObject->DeviceExtension;
|
||||
Length = Param->Parameters.QueryFile.Length;
|
||||
Buffer = Irp->AssociatedIrp.SystemBuffer;
|
||||
|
||||
|
||||
switch (Param->Parameters.QueryFile.FileInformationClass)
|
||||
{
|
||||
case FileDirectoryInformation:
|
||||
|
@ -65,64 +65,64 @@ Ext2QueryInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
case FileBothDirectoryInformation:
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
|
||||
|
||||
case FileBasicInformation:
|
||||
PFileBasicInformation = (PFILE_BASIC_INFORMATION)Buffer;
|
||||
memset(PFileBasicInformation, 0, sizeof(FILE_BASIC_INFORMATION));
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
||||
|
||||
case FileStandardInformation:
|
||||
PFileStandardInformation = (PFILE_STANDARD_INFORMATION)Buffer;
|
||||
memset(PFileStandardInformation, 0, sizeof(FILE_STANDARD_INFORMATION));
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
||||
|
||||
case FileInternalInformation:
|
||||
PFileInternalInformation = (PFILE_INTERNAL_INFORMATION)Buffer;
|
||||
memset(PFileInternalInformation, 0, sizeof(FILE_INTERNAL_INFORMATION));
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
||||
|
||||
case FileEaInformation:
|
||||
PFileEaInformation = (PFILE_EA_INFORMATION)Buffer;
|
||||
memset(PFileEaInformation, 0, sizeof(FILE_EA_INFORMATION));
|
||||
PFileEaInformation->EaSize = 0;
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
||||
|
||||
case FileAccessInformation:
|
||||
PFileAccessInformation = (PFILE_ACCESS_INFORMATION)Buffer;
|
||||
memset(PFileAccessInformation, 0, sizeof(FILE_ACCESS_INFORMATION));
|
||||
PFileAccessInformation->AccessFlags = 0;
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
||||
|
||||
case FileNameInformation:
|
||||
PFileNameInformation = (PFILE_NAME_INFORMATION)Buffer;
|
||||
memset(PFileNameInformation, 0, sizeof(FILE_NAME_INFORMATION));
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
||||
|
||||
case FilePositionInformation:
|
||||
PFilePositionInformation = (PFILE_POSITION_INFORMATION)Buffer;
|
||||
memcpy(PFilePositionInformation,
|
||||
memcpy(PFilePositionInformation,
|
||||
&FileObject->CurrentByteOffset,
|
||||
sizeof(FileObject->CurrentByteOffset));
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
||||
|
||||
case FileRenameInformation:
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
Status = STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
if (NT_SUCCESS(Status))
|
||||
Irp->IoStatus.Information =
|
||||
|
@ -131,6 +131,6 @@ Ext2QueryInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp,
|
||||
IO_NO_INCREMENT);
|
||||
|
||||
|
||||
return(Status);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* FILE: services/fs/ext2/blockdev.c
|
||||
* PURPOSE: Temporary sector reading support
|
||||
* PROGRAMMER: David Welch (welch@cwcom.net)
|
||||
* UPDATE HISTORY:
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
@ -31,14 +31,14 @@ Ext2ReadSectors(IN PDEVICE_OBJECT pDeviceObject,
|
|||
NTSTATUS status;
|
||||
ULONG sectorSize;
|
||||
int j;
|
||||
|
||||
|
||||
DPRINT("VFATReadSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n",
|
||||
pDeviceObject,DiskSector,Buffer);
|
||||
|
||||
sectorNumber.u.HighPart = 0;
|
||||
sectorNumber.u.LowPart = DiskSector * BLOCKSIZE;
|
||||
|
||||
DPRINT("DiskSector:%ld BLKSZ:%ld sectorNumber:%ld:%ld\n",
|
||||
DPRINT("DiskSector:%ld BLKSZ:%ld sectorNumber:%ld:%ld\n",
|
||||
(unsigned long) DiskSector,
|
||||
(unsigned long) BLOCKSIZE,
|
||||
(unsigned long) sectorNumber.u.HighPart,
|
||||
|
@ -58,17 +58,17 @@ Ext2ReadSectors(IN PDEVICE_OBJECT pDeviceObject,
|
|||
&event,
|
||||
&ioStatus );
|
||||
|
||||
if (!irp)
|
||||
if (!irp)
|
||||
{
|
||||
DbgPrint("READ failed!!!\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
DPRINT("Calling IO Driver...\n");
|
||||
status = IoCallDriver(pDeviceObject, irp);
|
||||
|
||||
DPRINT("Waiting for IO Operation...\n");
|
||||
if (status == STATUS_PENDING)
|
||||
if (status == STATUS_PENDING)
|
||||
{
|
||||
KeWaitForSingleObject(&event,
|
||||
Suspended,
|
||||
|
@ -79,12 +79,12 @@ Ext2ReadSectors(IN PDEVICE_OBJECT pDeviceObject,
|
|||
status = ioStatus.Status;
|
||||
}
|
||||
|
||||
if (!NT_SUCCESS(status))
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
DbgPrint("IO failed!!! Error code: %d(%x)\n", status, status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ BOOLEAN VFATWriteSectors(IN PDEVICE_OBJECT pDeviceObject,
|
|||
ULONG sectorSize;
|
||||
PULONG mbr;
|
||||
int j;
|
||||
|
||||
|
||||
DPRINT("VFATWriteSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n",
|
||||
pDeviceObject,DiskSector,Buffer);
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* FILE: services/fs/ext2/dir.c
|
||||
* PURPOSE: ext2 filesystem
|
||||
* PROGRAMMER: David Welch (welch@cwcom.net)
|
||||
* UPDATE HISTORY:
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
@ -24,7 +24,7 @@
|
|||
static VOID Ext2ConvertName(PWSTR Out, PCH In, ULONG Len)
|
||||
{
|
||||
ULONG i;
|
||||
|
||||
|
||||
for (i=0; i<Len; i++)
|
||||
{
|
||||
*Out = *In;
|
||||
|
@ -44,28 +44,28 @@ PVOID Ext2ProcessDirEntry(PDEVICE_EXTENSION DeviceExt,
|
|||
PFILE_NAMES_INFORMATION FNI;
|
||||
PFILE_BOTH_DIRECTORY_INFORMATION FBI;
|
||||
struct ext2_inode inode;
|
||||
|
||||
|
||||
DPRINT("FileIndex %d\n",FileIndex);
|
||||
DPRINT("Buffer %x\n",Buffer);
|
||||
|
||||
|
||||
Ext2ReadInode(DeviceExt,
|
||||
dir_entry->inode,
|
||||
&inode);
|
||||
|
||||
|
||||
switch (IoStack->Parameters.QueryDirectory.FileInformationClass)
|
||||
{
|
||||
case FileNamesInformation:
|
||||
FNI = (PFILE_NAMES_INFORMATION)Buffer;
|
||||
FNI->NextEntryOffset = sizeof(FileDirectoryInformation) +
|
||||
dir_entry->name_len + 1;
|
||||
FNI->FileNameLength = dir_entry->name_len;
|
||||
FNI->FileNameLength = dir_entry->name_len;
|
||||
Ext2ConvertName(FNI->FileName, dir_entry->name, dir_entry->name_len);
|
||||
Buffer = Buffer + FNI->NextEntryOffset;
|
||||
break;
|
||||
|
||||
|
||||
case FileDirectoryInformation:
|
||||
FDI = (PFILE_DIRECTORY_INFORMATION)Buffer;
|
||||
FDI->NextEntryOffset = sizeof(FileDirectoryInformation) +
|
||||
FDI->NextEntryOffset = sizeof(FileDirectoryInformation) +
|
||||
dir_entry->name_len + 1;
|
||||
FDI->FileIndex = FileIndex;
|
||||
// FDI->CreationTime = 0;
|
||||
|
@ -78,7 +78,7 @@ PVOID Ext2ProcessDirEntry(PDEVICE_EXTENSION DeviceExt,
|
|||
Ext2ConvertName(FDI->FileName, dir_entry->name, dir_entry->name_len);
|
||||
Buffer = Buffer + FDI->NextEntryOffset;
|
||||
break;
|
||||
|
||||
|
||||
case FileBothDirectoryInformation:
|
||||
FBI = (PFILE_BOTH_DIRECTORY_INFORMATION)Buffer;
|
||||
FBI->NextEntryOffset = sizeof(FileBothDirectoryInformation) +
|
||||
|
@ -91,7 +91,7 @@ PVOID Ext2ProcessDirEntry(PDEVICE_EXTENSION DeviceExt,
|
|||
memset(FBI->ShortName, 0, sizeof(FBI->ShortName));
|
||||
Buffer = Buffer + FBI->NextEntryOffset;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
@ -109,11 +109,11 @@ NTSTATUS Ext2QueryDirectory(PDEVICE_EXTENSION DeviceExt,
|
|||
ULONG StartIndex;
|
||||
PVOID Buffer = NULL;
|
||||
struct ext2_dir_entry dir_entry;
|
||||
|
||||
|
||||
Buffer = Irp->UserBuffer;
|
||||
DPRINT("Buffer %x\n",Buffer);
|
||||
DPRINT("IoStack->Flags %x\n",IoStack->Flags);
|
||||
|
||||
|
||||
if (IoStack->Flags & SL_RETURN_SINGLE_ENTRY)
|
||||
{
|
||||
Max = 1;
|
||||
|
@ -122,7 +122,7 @@ NTSTATUS Ext2QueryDirectory(PDEVICE_EXTENSION DeviceExt,
|
|||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
DPRINT("Buffer->FileIndex %d\n",
|
||||
((PFILE_DIRECTORY_INFORMATION)Buffer)->FileIndex);
|
||||
if (IoStack->Flags & SL_INDEX_SPECIFIED)
|
||||
|
@ -133,14 +133,14 @@ NTSTATUS Ext2QueryDirectory(PDEVICE_EXTENSION DeviceExt,
|
|||
{
|
||||
StartIndex = 0;
|
||||
}
|
||||
|
||||
|
||||
if (IoStack->Flags & SL_RESTART_SCAN)
|
||||
{
|
||||
StartIndex = 0;
|
||||
}
|
||||
|
||||
|
||||
DPRINT("StartIndex %d\n",StartIndex);
|
||||
|
||||
|
||||
for (i=0; i<Max ;i++)
|
||||
{
|
||||
if (!Ext2ScanDir(DeviceExt,&Fcb->inode,"*",&dir_entry,&StartIndex))
|
||||
|
@ -149,9 +149,9 @@ NTSTATUS Ext2QueryDirectory(PDEVICE_EXTENSION DeviceExt,
|
|||
return(STATUS_NO_MORE_FILES);
|
||||
}
|
||||
Buffer = Ext2ProcessDirEntry(DeviceExt,
|
||||
&dir_entry,
|
||||
IoStack,
|
||||
Buffer,
|
||||
&dir_entry,
|
||||
IoStack,
|
||||
Buffer,
|
||||
StartIndex);
|
||||
}
|
||||
return(STATUS_SUCCESS);
|
||||
|
@ -165,30 +165,30 @@ Ext2DirectoryControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
PEXT2_FCB Fcb = (PVOID)FileObject->FsContext;
|
||||
NTSTATUS Status;
|
||||
PDEVICE_EXTENSION DeviceExt;
|
||||
|
||||
|
||||
DPRINT("Ext2DirectoryControl(DeviceObject %x, Irp %x)\n",DeviceObject,Irp);
|
||||
|
||||
|
||||
DeviceExt = DeviceObject->DeviceExtension;
|
||||
|
||||
|
||||
switch (Stack->MinorFunction)
|
||||
{
|
||||
case IRP_MN_QUERY_DIRECTORY:
|
||||
Status = Ext2QueryDirectory(DeviceExt, Fcb, Irp, Stack);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return(Status);
|
||||
return(Status);
|
||||
}
|
||||
|
||||
BOOL Ext2ScanDir(PDEVICE_EXTENSION DeviceExt,
|
||||
struct ext2_inode* dir,
|
||||
struct ext2_inode* dir,
|
||||
PCH filename,
|
||||
struct ext2_dir_entry* ret,
|
||||
PULONG StartIndex)
|
||||
|
@ -200,11 +200,11 @@ BOOL Ext2ScanDir(PDEVICE_EXTENSION DeviceExt,
|
|||
struct ext2_dir_entry* current;
|
||||
ULONG block;
|
||||
BOOL b;
|
||||
|
||||
|
||||
DPRINT("Ext2ScanDir(dir %x, filename %s, ret %x)\n",dir,filename,ret);
|
||||
|
||||
|
||||
buffer = ExAllocatePool(NonPagedPool, BLOCKSIZE);
|
||||
|
||||
|
||||
for (i=0; i<((*StartIndex)/BLOCKSIZE); i++);
|
||||
for (; (block = Ext2BlockMap(DeviceExt, dir, i)) != 0; i++)
|
||||
{
|
||||
|
@ -218,15 +218,15 @@ BOOL Ext2ScanDir(PDEVICE_EXTENSION DeviceExt,
|
|||
DbgPrint("ext2fs:%s:%d: Disk io failed\n", __FILE__, __LINE__);
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
offset = (*StartIndex)%BLOCKSIZE;
|
||||
while (offset < BLOCKSIZE)
|
||||
{
|
||||
current = &buffer[offset];
|
||||
|
||||
|
||||
strncpy(name,current->name,current->name_len);
|
||||
name[current->name_len]=0;
|
||||
|
||||
|
||||
DPRINT("Scanning offset %d inode %d name %s\n",
|
||||
offset,current->inode,name);
|
||||
|
||||
|
@ -239,7 +239,7 @@ BOOL Ext2ScanDir(PDEVICE_EXTENSION DeviceExt,
|
|||
ExFreePool(buffer);
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
offset = offset + current->rec_len;
|
||||
ASSERT(current->rec_len != 0);
|
||||
DPRINT("offset %d\n",offset);
|
||||
|
@ -262,7 +262,7 @@ void unicode_to_ansi(PCH StringA, PWSTR StringW)
|
|||
*StringA = 0;
|
||||
}
|
||||
|
||||
NTSTATUS Ext2OpenFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||
NTSTATUS Ext2OpenFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||
PWSTR FileName)
|
||||
/*
|
||||
* FUNCTION: Opens a file
|
||||
|
@ -275,12 +275,12 @@ NTSTATUS Ext2OpenFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
|||
char* current_segment;
|
||||
PEXT2_FCB Fcb;
|
||||
ULONG StartIndex = 0;
|
||||
|
||||
|
||||
DPRINT("Ext2OpenFile(DeviceExt %x, FileObject %x, FileName %S)\n",
|
||||
DeviceExt,FileObject,FileName);
|
||||
|
||||
|
||||
Fcb = ExAllocatePool(NonPagedPool, sizeof(EXT2_FCB));
|
||||
|
||||
|
||||
unicode_to_ansi(name,FileName);
|
||||
DPRINT("name %s\n",name);
|
||||
DPRINT("strtok %x\n",strtok);
|
||||
|
@ -309,11 +309,11 @@ NTSTATUS Ext2OpenFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
|||
&parent_inode);
|
||||
}
|
||||
DPRINT("Found file\n");
|
||||
|
||||
|
||||
Fcb->inode = current_inode;
|
||||
CcRosInitializeFileCache(FileObject, &Fcb->Bcb, PAGE_SIZE*3);
|
||||
FileObject->FsContext = Fcb;
|
||||
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -324,15 +324,15 @@ Ext2Create(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
PFILE_OBJECT FileObject = Stack->FileObject;
|
||||
NTSTATUS Status;
|
||||
PDEVICE_EXTENSION DeviceExt;
|
||||
|
||||
|
||||
DPRINT("Ext2Create(DeviceObject %x, Irp %x)\n",DeviceObject,Irp);
|
||||
|
||||
|
||||
DeviceExt = DeviceObject->DeviceExtension;
|
||||
Status = Ext2OpenFile(DeviceExt,FileObject,FileObject->FileName.Buffer);
|
||||
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return(Status);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ struct ext2_super_block {
|
|||
* the incompatible feature set is that if there is a bit set
|
||||
* in the incompatible feature set that the kernel doesn't
|
||||
* know about, it should refuse to mount the filesystem.
|
||||
*
|
||||
*
|
||||
* e2fsck's requirements are more strict; if it doesn't know
|
||||
* about a feature in either the compatible or incompatible
|
||||
* feature set, it must abort and not try to meddle with
|
||||
|
@ -187,7 +187,7 @@ struct ext2_inode {
|
|||
#define EXT2_APPEND_FL 0x00000020 /* writes to file may only append */
|
||||
#define EXT2_NODUMP_FL 0x00000040 /* do not dump file */
|
||||
#define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Structure of a blocks group descriptor
|
||||
|
@ -257,12 +257,12 @@ typedef struct _EXT2_FCB
|
|||
ULONG Ext2BlockMap(PDEVICE_EXTENSION DeviceExt,
|
||||
struct ext2_inode* inode,
|
||||
ULONG offset);
|
||||
NTSTATUS Ext2OpenFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||
NTSTATUS Ext2OpenFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||
PWSTR FileName);
|
||||
NTSTATUS Ext2ReadFile(PDEVICE_EXTENSION DeviceExt,
|
||||
NTSTATUS Ext2ReadFile(PDEVICE_EXTENSION DeviceExt,
|
||||
PFILE_OBJECT FileObject,
|
||||
PVOID Buffer,
|
||||
ULONG Length,
|
||||
PVOID Buffer,
|
||||
ULONG Length,
|
||||
LARGE_INTEGER Offset);
|
||||
NTSTATUS STDCALL Ext2Create(PDEVICE_OBJECT DeviceObject, PIRP Irp);
|
||||
NTSTATUS STDCALL Ext2DirectoryControl(PDEVICE_OBJECT DeviceObject, PIRP Irp);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* FILE: services/fs/ext2/super.c
|
||||
* PURPOSE: ext2 filesystem
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
@ -27,7 +27,7 @@ ULONG Ext2BlockMap(PDEVICE_EXTENSION DeviceExt,
|
|||
ULONG block;
|
||||
PULONG TempBuffer;
|
||||
BOOL b;
|
||||
|
||||
|
||||
DPRINT("Ext2BlockMap(DeviceExt %x, inode %x, offset %d)\n",
|
||||
DeviceExt,inode,offset);
|
||||
if (offset < EXT2_NDIR_BLOCKS)
|
||||
|
|
|
@ -25,23 +25,23 @@ struct ext2_group_desc* Ext2LoadGroupDesc(PDEVICE_EXTENSION DeviceExt,
|
|||
struct ext2_group_desc* buffer;
|
||||
ULONG block;
|
||||
struct ext2_group_desc* gdp;
|
||||
|
||||
|
||||
buffer = ExAllocatePool(NonPagedPool, BLOCKSIZE);
|
||||
|
||||
|
||||
block = block_group / (BLOCKSIZE / sizeof(struct ext2_group_desc));
|
||||
|
||||
|
||||
Ext2ReadSectors(DeviceExt->StorageDevice,
|
||||
2 + block,
|
||||
1,
|
||||
buffer);
|
||||
|
||||
|
||||
gdp = &buffer[block_group % (BLOCKSIZE / sizeof(struct ext2_group_desc))];
|
||||
|
||||
|
||||
DPRINT("gdp->bg_free_blocks_count %d\n",gdp->bg_free_blocks_count);
|
||||
DPRINT("gdp->bg_inode_table %d\n",gdp->bg_inode_table);
|
||||
|
||||
|
||||
return(gdp);
|
||||
|
||||
|
||||
}
|
||||
|
||||
#define INODES_PER_PAGE (PAGE_SIZE / sizeof(struct ext2_inode))
|
||||
|
@ -53,29 +53,29 @@ VOID Ext2LoadInode(PDEVICE_EXTENSION DeviceExt,
|
|||
{
|
||||
ULONG block_group;
|
||||
struct ext2_group_desc* gdp;
|
||||
ULONG offset;
|
||||
ULONG offset;
|
||||
ULONG dsec;
|
||||
BOOLEAN Uptodate;
|
||||
struct ext2_inode* ibuffer;
|
||||
|
||||
|
||||
DPRINT("Ext2LoadInode(DeviceExt %x, ino %d, Inode %x)\n",
|
||||
DeviceExt, ino, Inode);
|
||||
|
||||
|
||||
block_group = (ino - 1) / DeviceExt->superblock->s_inodes_per_group;
|
||||
|
||||
|
||||
DPRINT("block_group %d\n",block_group);
|
||||
|
||||
|
||||
gdp = Ext2LoadGroupDesc(DeviceExt, block_group);
|
||||
|
||||
offset = (ino - 1) % DeviceExt->superblock->s_inodes_per_group;
|
||||
|
||||
|
||||
DPRINT("offset %d\n", offset);
|
||||
|
||||
|
||||
dsec = (gdp->bg_inode_table + (offset / INODES_PER_BLOCK)) * BLOCKSIZE;
|
||||
|
||||
DPRINT("dsec %d (dsec/BLOCKSIZE) %d PAGE_ROUND_DOWN(dsec) %d\n",
|
||||
|
||||
DPRINT("dsec %d (dsec/BLOCKSIZE) %d PAGE_ROUND_DOWN(dsec) %d\n",
|
||||
dsec, (dsec/BLOCKSIZE), PAGE_ROUND_DOWN(dsec));
|
||||
|
||||
|
||||
CcRequestCachePage(DeviceExt->Bcb,
|
||||
PAGE_ROUND_DOWN(dsec),
|
||||
&Inode->BaseAddress,
|
||||
|
@ -95,11 +95,11 @@ VOID Ext2LoadInode(PDEVICE_EXTENSION DeviceExt,
|
|||
DPRINT("Inode->BaseAddress 0x%x ibuffer 0x%x\n",
|
||||
Inode->BaseAddress, ibuffer);
|
||||
Inode->inode = &ibuffer[offset % INODES_PER_PAGE];
|
||||
|
||||
|
||||
DPRINT("inode->i_uid %d\n",Inode->inode->i_uid);
|
||||
DPRINT("inode->i_links_count %d\n",Inode->inode->i_links_count);
|
||||
DPRINT("inode->i_blocks %d\n",Inode->inode->i_blocks);
|
||||
|
||||
|
||||
DPRINT("Ext2LoadInode() finished\n");
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ VOID Ext2ReleaseInode(PDEVICE_EXTENSION DeviceExt,
|
|||
Inode->BaseAddress = NULL;
|
||||
Inode->inode = NULL;
|
||||
}
|
||||
|
||||
|
||||
VOID Ext2ReadInode(PDEVICE_EXTENSION DeviceExt,
|
||||
ULONG ino,
|
||||
struct ext2_inode* inode)
|
||||
|
@ -122,27 +122,27 @@ VOID Ext2ReadInode(PDEVICE_EXTENSION DeviceExt,
|
|||
struct ext2_group_desc* gdp;
|
||||
ULONG offset;
|
||||
struct ext2_inode* buffer;
|
||||
|
||||
|
||||
DPRINT("Ext2ReadInode(DeviceExt %x, ino %d, inode %x)\n",
|
||||
DeviceExt,ino,inode);
|
||||
|
||||
block_group = (ino - 1) / DeviceExt->superblock->s_inodes_per_group;
|
||||
|
||||
gdp = Ext2LoadGroupDesc(DeviceExt, block_group);
|
||||
|
||||
|
||||
|
||||
block_group = (ino - 1) / DeviceExt->superblock->s_inodes_per_group;
|
||||
|
||||
gdp = Ext2LoadGroupDesc(DeviceExt, block_group);
|
||||
|
||||
|
||||
|
||||
offset = (ino - 1) % DeviceExt->superblock->s_inodes_per_group;
|
||||
|
||||
|
||||
buffer = ExAllocatePool(NonPagedPool, BLOCKSIZE);
|
||||
Ext2ReadSectors(DeviceExt->StorageDevice,
|
||||
gdp->bg_inode_table + (offset / INODES_PER_BLOCK),
|
||||
1,
|
||||
buffer);
|
||||
memcpy(inode,&buffer[offset % INODES_PER_BLOCK],sizeof(struct ext2_inode));
|
||||
|
||||
|
||||
DPRINT("inode->i_uid %d\n",inode->i_uid);
|
||||
DPRINT("inode->i_links_count %d\n",inode->i_links_count);
|
||||
DPRINT("inode->i_blocks %d\n",inode->i_blocks);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* FILE: services/fs/ext2/quota.c
|
||||
* PURPOSE: Quota support
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
@ -24,12 +24,12 @@ NTSTATUS STDCALL
|
|||
Ext2QueryQuota(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return(Status);
|
||||
}
|
||||
|
@ -38,12 +38,12 @@ NTSTATUS STDCALL
|
|||
Ext2SetQuota(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return(Status);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* FILE: services/fs/ext2/super.c
|
||||
* PURPOSE: ext2 filesystem
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
@ -25,11 +25,11 @@ NTSTATUS Ext2ReadPage(PDEVICE_EXTENSION DeviceExt,
|
|||
ULONG Offset)
|
||||
{
|
||||
ULONG block, i;
|
||||
|
||||
|
||||
for (i=0; i<4; i++)
|
||||
{
|
||||
block = Ext2BlockMap(DeviceExt,
|
||||
Fcb->i.inode,
|
||||
block = Ext2BlockMap(DeviceExt,
|
||||
Fcb->i.inode,
|
||||
Offset + i);
|
||||
Ext2ReadSectors(DeviceExt->StorageDevice,
|
||||
block,
|
||||
|
@ -39,10 +39,10 @@ NTSTATUS Ext2ReadPage(PDEVICE_EXTENSION DeviceExt,
|
|||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
NTSTATUS Ext2ReadFile(PDEVICE_EXTENSION DeviceExt,
|
||||
NTSTATUS Ext2ReadFile(PDEVICE_EXTENSION DeviceExt,
|
||||
PFILE_OBJECT FileObject,
|
||||
PVOID Buffer,
|
||||
ULONG Length,
|
||||
PVOID Buffer,
|
||||
ULONG Length,
|
||||
LARGE_INTEGER OffsetL)
|
||||
{
|
||||
PVOID BaseAddress;
|
||||
|
@ -59,7 +59,7 @@ NTSTATUS Ext2ReadFile(PDEVICE_EXTENSION DeviceExt,
|
|||
Ext2LoadInode(DeviceExt,
|
||||
Fcb->inode,
|
||||
&Fcb->i);
|
||||
|
||||
|
||||
if (Offset >= Fcb->i.inode->i_size)
|
||||
{
|
||||
DPRINT("Returning end of file\n");
|
||||
|
@ -69,10 +69,10 @@ NTSTATUS Ext2ReadFile(PDEVICE_EXTENSION DeviceExt,
|
|||
{
|
||||
Length = Fcb->i.inode->i_size - Offset;
|
||||
}
|
||||
|
||||
|
||||
Ext2ReleaseInode(DeviceExt,
|
||||
&Fcb->i);
|
||||
|
||||
|
||||
if ((Offset % PAGE_SIZE) != 0)
|
||||
{
|
||||
Delta = min(PAGE_SIZE - (Offset % PAGE_SIZE),Length);
|
||||
|
@ -114,7 +114,7 @@ NTSTATUS Ext2ReadFile(PDEVICE_EXTENSION DeviceExt,
|
|||
memcpy(Buffer, BaseAddress, PAGE_SIZE);
|
||||
CcReleaseCachePage(Fcb->Bcb,
|
||||
CacheSeg,
|
||||
TRUE);
|
||||
TRUE);
|
||||
Length = Length - PAGE_SIZE;
|
||||
Offset = Offset + PAGE_SIZE;
|
||||
Buffer = Buffer + PAGE_SIZE;
|
||||
|
@ -138,10 +138,10 @@ NTSTATUS Ext2ReadFile(PDEVICE_EXTENSION DeviceExt,
|
|||
memcpy(Buffer,BaseAddress,Length);
|
||||
CcReleaseCachePage(Fcb->Bcb,
|
||||
CacheSeg,
|
||||
TRUE);
|
||||
TRUE);
|
||||
}
|
||||
CHECKPOINT;
|
||||
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ NTSTATUS STDCALL
|
|||
Ext2Write(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||
{
|
||||
DPRINT("Ext2Write(DeviceObject %x Irp %x)\n",DeviceObject,Irp);
|
||||
|
||||
|
||||
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
||||
Irp->IoStatus.Information = 0;
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
|
@ -160,7 +160,7 @@ NTSTATUS STDCALL
|
|||
Ext2FlushBuffers(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||
{
|
||||
DPRINT("Ext2FlushBuffers(DeviceObject %x Irp %x)\n",DeviceObject,Irp);
|
||||
|
||||
|
||||
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
|
@ -170,7 +170,7 @@ NTSTATUS STDCALL
|
|||
Ext2Shutdown(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||
{
|
||||
DPRINT("Ext2Shutdown(DeviceObject %x Irp %x)\n",DeviceObject,Irp);
|
||||
|
||||
|
||||
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
|
@ -180,12 +180,12 @@ NTSTATUS STDCALL
|
|||
Ext2Cleanup(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||
{
|
||||
DbgPrint("Ext2Cleanup(DeviceObject %x Irp %x)\n",DeviceObject,Irp);
|
||||
|
||||
|
||||
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
|
||||
DbgPrint("Ext2Cleanup() finished\n");
|
||||
|
||||
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
|
@ -198,22 +198,22 @@ Ext2Read(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
PFILE_OBJECT FileObject = Stack->FileObject;
|
||||
PDEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
DPRINT("Ext2Read(DeviceObject %x, FileObject %x, Irp %x)\n",
|
||||
DeviceObject, FileObject, Irp);
|
||||
|
||||
|
||||
Length = Stack->Parameters.Read.Length;
|
||||
CHECKPOINT;
|
||||
Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress);
|
||||
CHECKPOINT;
|
||||
CHECKPOINT;
|
||||
|
||||
|
||||
Status = Ext2ReadFile(DeviceExt,FileObject,Buffer,Length,
|
||||
Stack->Parameters.Read.ByteOffset);
|
||||
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = Length;
|
||||
IoCompleteRequest(Irp,IO_NO_INCREMENT);
|
||||
|
||||
|
||||
return(Status);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* FILE: services/fs/ext2/security.c
|
||||
* PURPOSE: Security support
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
@ -24,7 +24,7 @@ NTSTATUS STDCALL
|
|||
Ext2QuerySecurity(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||
{
|
||||
DPRINT("Ext2QuerySecurity(DeviceObject %x Irp %x)\n",DeviceObject,Irp);
|
||||
|
||||
|
||||
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
|
@ -34,7 +34,7 @@ NTSTATUS STDCALL
|
|||
Ext2SetSecurity(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||
{
|
||||
DPRINT("Ext2SetSecurity(DeviceObject %x Irp %x)\n",DeviceObject,Irp);
|
||||
|
||||
|
||||
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
|
||||
Irp->IoStatus.Information = 0;
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* FILE: services/fs/ext2/super.c
|
||||
* PURPOSE: ext2 filesystem
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
@ -31,20 +31,20 @@ Ext2Close(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
PDEVICE_EXTENSION DeviceExtension;
|
||||
NTSTATUS Status;
|
||||
PEXT2_FCB Fcb;
|
||||
|
||||
|
||||
DbgPrint("Ext2Close(DeviceObject %x, Irp %x)\n",DeviceObject,Irp);
|
||||
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
FileObject = Stack->FileObject;
|
||||
DeviceExtension = DeviceObject->DeviceExtension;
|
||||
|
||||
|
||||
if (FileObject == DeviceExtension->FileObject)
|
||||
{
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return(Status);
|
||||
}
|
||||
|
@ -59,12 +59,12 @@ Ext2Close(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
ExFreePool(Fcb);
|
||||
FileObject->FsContext = NULL;
|
||||
}
|
||||
|
||||
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return(Status);
|
||||
}
|
||||
|
@ -73,18 +73,18 @@ NTSTATUS Ext2Mount(PDEVICE_OBJECT DeviceToMount)
|
|||
{
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
PDEVICE_EXTENSION DeviceExt;
|
||||
PVOID BlockBuffer;
|
||||
PVOID BlockBuffer;
|
||||
struct ext2_super_block* superblock;
|
||||
|
||||
|
||||
DPRINT("Ext2Mount(DeviceToMount %x)\n",DeviceToMount);
|
||||
|
||||
|
||||
BlockBuffer = ExAllocatePool(NonPagedPool,BLOCKSIZE);
|
||||
Ext2ReadSectors(DeviceToMount,
|
||||
1,
|
||||
1,
|
||||
BlockBuffer);
|
||||
superblock = BlockBuffer;
|
||||
|
||||
|
||||
if (superblock->s_magic != EXT2_SUPER_MAGIC)
|
||||
{
|
||||
ExFreePool(BlockBuffer);
|
||||
|
@ -93,7 +93,7 @@ NTSTATUS Ext2Mount(PDEVICE_OBJECT DeviceToMount)
|
|||
DPRINT("Volume recognized\n");
|
||||
DPRINT("s_inodes_count %d\n",superblock->s_inodes_count);
|
||||
DPRINT("s_blocks_count %d\n",superblock->s_blocks_count);
|
||||
|
||||
|
||||
IoCreateDevice(DriverObject,
|
||||
sizeof(DEVICE_EXTENSION),
|
||||
NULL,
|
||||
|
@ -119,9 +119,9 @@ NTSTATUS Ext2Mount(PDEVICE_OBJECT DeviceToMount)
|
|||
CcRosInitializeFileCache(DeviceExt->FileObject,
|
||||
&DeviceExt->Bcb,
|
||||
PAGE_SIZE * 3);
|
||||
|
||||
|
||||
DPRINT("Ext2Mount() = STATUS_SUCCESS\n");
|
||||
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -132,12 +132,12 @@ Ext2FileSystemControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
PVPB vpb = Stack->Parameters.Mount.Vpb;
|
||||
PDEVICE_OBJECT DeviceToMount = Stack->Parameters.Mount.DeviceObject;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
Status = Ext2Mount(DeviceToMount);
|
||||
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return(Status);
|
||||
}
|
||||
|
@ -156,11 +156,11 @@ DriverEntry(PDRIVER_OBJECT _DriverObject,
|
|||
PDEVICE_OBJECT DeviceObject;
|
||||
NTSTATUS ret;
|
||||
UNICODE_STRING DeviceName = ROS_STRING_INITIALIZER(L"\\Device\\Ext2Fsd");
|
||||
|
||||
|
||||
DbgPrint("Ext2 FSD 0.0.1\n");
|
||||
|
||||
|
||||
DriverObject = _DriverObject;
|
||||
|
||||
|
||||
ret = IoCreateDevice(DriverObject,
|
||||
0,
|
||||
&DeviceName,
|
||||
|
@ -182,7 +182,7 @@ DriverEntry(PDRIVER_OBJECT _DriverObject,
|
|||
Ext2FileSystemControl;
|
||||
DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] =
|
||||
Ext2DirectoryControl;
|
||||
DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] =
|
||||
DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] =
|
||||
Ext2QueryInformation;
|
||||
DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] = Ext2SetInformation;
|
||||
DriverObject->MajorFunction[IRP_MJ_FLUSH_BUFFERS] = Ext2FlushBuffers;
|
||||
|
@ -192,11 +192,11 @@ DriverEntry(PDRIVER_OBJECT _DriverObject,
|
|||
DriverObject->MajorFunction[IRP_MJ_SET_SECURITY] = Ext2SetSecurity;
|
||||
DriverObject->MajorFunction[IRP_MJ_QUERY_QUOTA] = Ext2QueryQuota;
|
||||
DriverObject->MajorFunction[IRP_MJ_SET_QUOTA] = Ext2SetQuota;
|
||||
|
||||
|
||||
DriverObject->DriverUnload = NULL;
|
||||
|
||||
|
||||
IoRegisterFileSystem(DeviceObject);
|
||||
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ FsRecIsFatVolume(IN PDEVICE_OBJECT DeviceObject)
|
|||
DPRINT("FsRecDeviceIoControl faild (%x)\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
if (PartitionInfo.PartitionType)
|
||||
{
|
||||
if (PartitionInfo.PartitionType == PARTITION_FAT_12 ||
|
||||
|
@ -112,16 +112,16 @@ FsRecIsFatVolume(IN PDEVICE_OBJECT DeviceObject)
|
|||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
Status = FsRecReadSectors(DeviceObject,
|
||||
0,
|
||||
Status = FsRecReadSectors(DeviceObject,
|
||||
0,
|
||||
1,
|
||||
DiskGeometry.BytesPerSector,
|
||||
DiskGeometry.BytesPerSector,
|
||||
(PUCHAR) Boot);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
if (Boot->Signatur1 != 0xaa55)
|
||||
{
|
||||
RecognizedFS=FALSE;
|
||||
|
@ -129,28 +129,28 @@ FsRecIsFatVolume(IN PDEVICE_OBJECT DeviceObject)
|
|||
if (RecognizedFS &&
|
||||
Boot->BytesPerSector != 512 &&
|
||||
Boot->BytesPerSector != 1024 &&
|
||||
Boot->BytesPerSector != 2048 &&
|
||||
Boot->BytesPerSector != 2048 &&
|
||||
Boot->BytesPerSector == 4096)
|
||||
{
|
||||
RecognizedFS=FALSE;
|
||||
}
|
||||
|
||||
if (RecognizedFS &&
|
||||
Boot->FATCount != 1 &&
|
||||
Boot->FATCount != 1 &&
|
||||
Boot->FATCount != 2)
|
||||
{
|
||||
RecognizedFS=FALSE;
|
||||
}
|
||||
|
||||
if (RecognizedFS &&
|
||||
Boot->Media != 0xf0 &&
|
||||
Boot->Media != 0xf0 &&
|
||||
Boot->Media != 0xf8 &&
|
||||
Boot->Media != 0xf9 &&
|
||||
Boot->Media != 0xfa &&
|
||||
Boot->Media != 0xfa &&
|
||||
Boot->Media != 0xfb &&
|
||||
Boot->Media != 0xfc &&
|
||||
Boot->Media != 0xfd &&
|
||||
Boot->Media != 0xfe &&
|
||||
Boot->Media != 0xfe &&
|
||||
Boot->Media != 0xff)
|
||||
{
|
||||
RecognizedFS=FALSE;
|
||||
|
@ -159,10 +159,10 @@ FsRecIsFatVolume(IN PDEVICE_OBJECT DeviceObject)
|
|||
if (RecognizedFS &&
|
||||
Boot->SectorsPerCluster != 1 &&
|
||||
Boot->SectorsPerCluster != 2 &&
|
||||
Boot->SectorsPerCluster != 4 &&
|
||||
Boot->SectorsPerCluster != 4 &&
|
||||
Boot->SectorsPerCluster != 8 &&
|
||||
Boot->SectorsPerCluster != 16 &&
|
||||
Boot->SectorsPerCluster != 32 &&
|
||||
Boot->SectorsPerCluster != 32 &&
|
||||
Boot->SectorsPerCluster != 64 &&
|
||||
Boot->SectorsPerCluster != 128)
|
||||
{
|
||||
|
|
|
@ -167,7 +167,7 @@ int find_next_zero_bit (void * addr, int size, int offset)
|
|||
{
|
||||
unsigned long * p = ((unsigned long *) addr) + (offset >> 5);
|
||||
int set = 0, bit = offset & 31, res;
|
||||
|
||||
|
||||
if (bit) {
|
||||
/*
|
||||
* Look for zero in first byte
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* FILE: services/fs/minix/minix.c
|
||||
* PURPOSE: Minix FSD
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
@ -20,17 +20,17 @@
|
|||
|
||||
static unsigned int MinixGetBlock(PDEVICE_OBJECT DeviceObject,
|
||||
PMINIX_DEVICE_EXTENSION DeviceExt,
|
||||
struct minix_inode* inode,
|
||||
struct minix_inode* inode,
|
||||
ULONG FileOffset)
|
||||
{
|
||||
int block;
|
||||
PVOID BaseAddress;
|
||||
ULONG blk;
|
||||
|
||||
|
||||
blk = FileOffset / BLOCKSIZE;
|
||||
|
||||
|
||||
DPRINT("MinixGetBlock(inode %x, blk %d)\n",inode,blk);
|
||||
|
||||
|
||||
/*
|
||||
* The first few blocks are available in the inode
|
||||
*/
|
||||
|
@ -40,69 +40,69 @@ static unsigned int MinixGetBlock(PDEVICE_OBJECT DeviceObject,
|
|||
return(block);
|
||||
}
|
||||
blk = blk - 7;
|
||||
|
||||
|
||||
/*
|
||||
* Retrieve a single-indirect block
|
||||
*/
|
||||
if (blk < 512)
|
||||
{
|
||||
block = inode->i_zone[7];
|
||||
|
||||
|
||||
BaseAddress = ExAllocatePool(NonPagedPool, 512);
|
||||
|
||||
|
||||
MinixReadSector(DeviceObject,
|
||||
block,
|
||||
block,
|
||||
BaseAddress);
|
||||
|
||||
|
||||
block = ((PUSHORT)(BaseAddress))[blk];
|
||||
|
||||
ExFreePool(BaseAddress);
|
||||
|
||||
|
||||
return(block);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get a double indirect block
|
||||
*/
|
||||
blk = blk - 512;
|
||||
block = inode->i_zone[8];
|
||||
|
||||
|
||||
BaseAddress = ExAllocatePool(NonPagedPool, 512);
|
||||
|
||||
|
||||
MinixReadSector(DeviceObject,
|
||||
block,
|
||||
BaseAddress);
|
||||
|
||||
|
||||
block = ((PUSHORT)BaseAddress)[(blk>>9)&511];
|
||||
|
||||
ExFreePool(BaseAddress);
|
||||
|
||||
|
||||
|
||||
|
||||
BaseAddress = ExAllocatePool(NonPagedPool, 512);
|
||||
|
||||
|
||||
MinixReadSector(DeviceObject,
|
||||
block,
|
||||
BaseAddress);
|
||||
|
||||
|
||||
block = ((PUSHORT)BaseAddress)[blk&512];
|
||||
|
||||
ExFreePool(BaseAddress);
|
||||
|
||||
|
||||
return(block);
|
||||
}
|
||||
|
||||
NTSTATUS MinixReadBlock(PDEVICE_OBJECT DeviceObject,
|
||||
PMINIX_DEVICE_EXTENSION DeviceExt,
|
||||
struct minix_inode* inode,
|
||||
struct minix_inode* inode,
|
||||
ULONG FileOffset,
|
||||
PULONG DiskOffset)
|
||||
{
|
||||
unsigned int block;
|
||||
|
||||
|
||||
DPRINT("MinixReadBlock()\n");
|
||||
|
||||
|
||||
block = MinixGetBlock(DeviceObject, DeviceExt,inode, FileOffset);
|
||||
|
||||
|
||||
(*DiskOffset) = block * BLOCKSIZE;
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* FILE: services/fs/minix/minix.c
|
||||
* PURPOSE: Minix FSD
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
@ -25,7 +25,7 @@ BOOLEAN MinixReadPage(PDEVICE_OBJECT DeviceObject,
|
|||
{
|
||||
ULONG i;
|
||||
BOOLEAN Result;
|
||||
|
||||
|
||||
for (i=0; i<4; i++)
|
||||
{
|
||||
Result = MinixReadSector(DeviceObject,
|
||||
|
@ -50,10 +50,10 @@ BOOLEAN MinixReadSector(IN PDEVICE_OBJECT pDeviceObject,
|
|||
NTSTATUS status;
|
||||
ULONG sectorSize;
|
||||
PULONG mbr;
|
||||
|
||||
|
||||
DPRINT("MinixReadSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n",
|
||||
pDeviceObject,DiskSector,Buffer);
|
||||
|
||||
|
||||
sectorNumber.u.HighPart = 0;
|
||||
sectorNumber.u.LowPart = DiskSector * BLOCKSIZE;
|
||||
|
||||
|
@ -114,10 +114,10 @@ BOOLEAN MinixWriteSector(IN PDEVICE_OBJECT pDeviceObject,
|
|||
KEVENT event;
|
||||
NTSTATUS status;
|
||||
ULONG sectorSize;
|
||||
|
||||
|
||||
DPRINT("MinixWriteSector(pDeviceObject %x, DiskSector %d, Buffer %x)\n",
|
||||
pDeviceObject,DiskSector,Buffer);
|
||||
|
||||
|
||||
sectorNumber.u.HighPart = 0;
|
||||
sectorNumber.u.LowPart = DiskSector * BLOCKSIZE;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* FILE: services/fs/minix/cache.c
|
||||
* PURPOSE: Minix FSD
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
@ -26,7 +26,7 @@ NTSTATUS MinixRequestCacheBlock(PDEVICE_OBJECT DeviceObject,
|
|||
PCACHE_SEGMENT* CacheSeg)
|
||||
{
|
||||
BOOLEAN UptoDate;
|
||||
|
||||
|
||||
CcRosRequestCacheSegment(Bcb,
|
||||
FileOffset,
|
||||
BaseAddress,
|
||||
|
@ -37,9 +37,9 @@ NTSTATUS MinixRequestCacheBlock(PDEVICE_OBJECT DeviceObject,
|
|||
MinixReadPage(DeviceObject,
|
||||
PAGE_ROUND_DOWN(FileOffset),
|
||||
BaseAddress);
|
||||
}
|
||||
}
|
||||
BaseAddress = BaseAddress + (FileOffset % PAGE_SIZE);
|
||||
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* FILE: services/fs/minix/minix.c
|
||||
* PURPOSE: Minix FSD
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
@ -19,12 +19,12 @@
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
BOOLEAN MinixCompareUnicodeStringToAnsi(PCH AnsiStr,
|
||||
BOOLEAN MinixCompareUnicodeStringToAnsi(PCH AnsiStr,
|
||||
PWCHAR UnicodeStr,
|
||||
ULONG MaxLen)
|
||||
{
|
||||
unsigned int i = 0;
|
||||
|
||||
|
||||
while (i<MaxLen)
|
||||
{
|
||||
if ((*AnsiStr)!=(*UnicodeStr))
|
||||
|
@ -55,12 +55,12 @@ ULONG MinixDirLookup(PMINIX_DEVICE_EXTENSION DeviceExt,
|
|||
unsigned int inode;
|
||||
PVOID Block;
|
||||
ULONG DiskOffset;
|
||||
|
||||
|
||||
DPRINT("MinixDirLookup(DeviceExt %x, dir %x, Name %S)\n",DeviceExt,dir,
|
||||
Name);
|
||||
|
||||
|
||||
Block = ExAllocatePool(NonPagedPool, 512);
|
||||
|
||||
|
||||
for (i=0;i<(dir->i_size/MINIX_DIR_ENTRY_SIZE);i++)
|
||||
{
|
||||
CHECKPOINT;
|
||||
|
@ -106,26 +106,26 @@ NTSTATUS MinixOpen(PDEVICE_OBJECT DeviceObject,
|
|||
PWSTR string;
|
||||
struct minix_inode current_dir;
|
||||
unsigned int current_ino;
|
||||
|
||||
string = ExAllocatePool(NonPagedPool,
|
||||
|
||||
string = ExAllocatePool(NonPagedPool,
|
||||
2*(wcslen(FileObject->FileName.Buffer)+1));
|
||||
wcscpy(string, FileObject->FileName.Buffer);
|
||||
|
||||
|
||||
DbgPrint("MinixOpen(DeviceObject %x, DeviceName %S, result %x)\n",
|
||||
DeviceObject,string,result);
|
||||
|
||||
|
||||
|
||||
|
||||
next = &string[0];
|
||||
current = next+1;
|
||||
|
||||
|
||||
current_ino = MINIX_ROOT_INO;
|
||||
|
||||
|
||||
while (next != NULL && current_ino != 0)
|
||||
{
|
||||
{
|
||||
MinixReadInode(DeviceObject,DeviceExt,current_ino,¤t_dir);
|
||||
|
||||
DPRINT("current %S next %x\n",current,next);
|
||||
|
||||
|
||||
*next = '\\';
|
||||
current = next+1;
|
||||
next = wcschr(next+1,'\\');
|
||||
|
@ -133,7 +133,7 @@ NTSTATUS MinixOpen(PDEVICE_OBJECT DeviceObject,
|
|||
{
|
||||
*next=0;
|
||||
}
|
||||
|
||||
|
||||
current_ino = MinixDirLookup(DeviceExt,
|
||||
DeviceObject,
|
||||
¤t_dir,
|
||||
|
@ -141,17 +141,17 @@ NTSTATUS MinixOpen(PDEVICE_OBJECT DeviceObject,
|
|||
}
|
||||
if (next == NULL && current_ino != 0)
|
||||
{
|
||||
MinixReadInode(DeviceObject,DeviceExt,current_ino,¤t_dir);
|
||||
MinixReadInode(DeviceObject,DeviceExt,current_ino,¤t_dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
(*Information) = FILE_DOES_NOT_EXIST;
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
|
||||
result = ExAllocatePool(NonPagedPool, sizeof(MINIX_FSCONTEXT));
|
||||
memcpy(&result->inode,¤t_dir,sizeof(struct minix_inode));
|
||||
|
||||
|
||||
DPRINT("MinxOpen() = STATUS_SUCCESS\n",0);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
@ -164,12 +164,12 @@ MinixClose(PDEVICE_OBJECT DeviceObject,
|
|||
PFILE_OBJECT FileObject = Stack->FileObject;
|
||||
|
||||
DPRINT("MinixClose(DeviceObject %x Irp %x)\n",DeviceObject,Irp);
|
||||
|
||||
|
||||
ExFreePool(FileObject->FsContext);
|
||||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
@ -180,15 +180,15 @@ MinixDirectoryControl(PDEVICE_OBJECT DeviceObject,
|
|||
{
|
||||
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
// PFILE_OBJECT FileObject = Stack->FileObject;
|
||||
|
||||
|
||||
if (Stack->MinorFunction != IRP_MN_QUERY_DIRECTORY)
|
||||
{
|
||||
return(STATUS_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
@ -202,13 +202,13 @@ MinixCreate(PDEVICE_OBJECT DeviceObject,
|
|||
NTSTATUS Status;
|
||||
PMINIX_FSCONTEXT result;
|
||||
MINIX_DEVICE_EXTENSION* DeviceExt;
|
||||
|
||||
|
||||
DPRINT("MinixCreate(DeviceObject %x, Irp %x)\n",DeviceObject,Irp);
|
||||
DPRINT("Opening file %x %S\n",FileObject->FileName.Buffer,
|
||||
FileObject->FileName.Buffer);
|
||||
DPRINT("FileObject->FileName.Buffer %x\n",
|
||||
FileObject->FileName.Buffer);
|
||||
|
||||
|
||||
DeviceExt = (MINIX_DEVICE_EXTENSION *)DeviceObject->DeviceExtension;
|
||||
result = ExAllocatePool(NonPagedPool,sizeof(struct minix_inode));
|
||||
DPRINT("result %x\n",result);
|
||||
|
@ -217,17 +217,17 @@ MinixCreate(PDEVICE_OBJECT DeviceObject,
|
|||
FileObject,
|
||||
result,
|
||||
&Irp->IoStatus.Information);
|
||||
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
FileObject->FsContext = result;
|
||||
}
|
||||
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
|
||||
DPRINT("Finished MinixCreate()\n");
|
||||
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return(Status);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* FILE: services/fs/minix/minix.c
|
||||
* PURPOSE: Minix FSD
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
@ -27,7 +27,7 @@ NTSTATUS MinixDeleteInode(PDEVICE_OBJECT Volume,
|
|||
{
|
||||
PULONG Buffer;
|
||||
ULONG off;
|
||||
|
||||
|
||||
Buffer = ExAllocatePool(NonPagedPool,BLOCKSIZE);
|
||||
MinixReadSector(Volume, (ino / 8192)+2, (PVOID)Buffer);
|
||||
off = ino % 8192;
|
||||
|
@ -42,7 +42,7 @@ static ULONG MinixAllocateInode(PDEVICE_OBJECT Volume,
|
|||
ULONG i;
|
||||
PULONG Buffer;
|
||||
ULONG ino;
|
||||
|
||||
|
||||
Buffer = ExAllocatePool(NonPagedPool,BLOCKSIZE);
|
||||
for (i=0; i<DeviceExt->sb->s_imap_blocks; i++)
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ ULONG MinixNewInode(PDEVICE_OBJECT Volume,
|
|||
struct minix_inode* new_inode)
|
||||
{
|
||||
ULONG ino;
|
||||
|
||||
|
||||
ino = MinixAllocateInode(Volume,DeviceExt);
|
||||
if (ino == 0)
|
||||
{
|
||||
|
@ -77,59 +77,59 @@ ULONG MinixNewInode(PDEVICE_OBJECT Volume,
|
|||
|
||||
NTSTATUS MinixWriteInode(PDEVICE_OBJECT Volume,
|
||||
MINIX_DEVICE_EXTENSION* DeviceExt,
|
||||
ULONG ino,
|
||||
ULONG ino,
|
||||
struct minix_inode* result)
|
||||
{
|
||||
int block;
|
||||
char* buffer;
|
||||
struct minix_inode* inodes;
|
||||
|
||||
|
||||
DPRINT("MinixWriteInode(ino %x, result %x)\n",ino,result);
|
||||
|
||||
|
||||
buffer = ExAllocatePool(NonPagedPool,1024);
|
||||
inodes = (struct minix_inode *)buffer;
|
||||
|
||||
block = 2 + DeviceExt->sb->s_imap_blocks + DeviceExt->sb->s_zmap_blocks
|
||||
|
||||
block = 2 + DeviceExt->sb->s_imap_blocks + DeviceExt->sb->s_zmap_blocks
|
||||
+ ((ino-1) / MINIX_INODES_PER_BLOCK);
|
||||
MinixReadSector(Volume,block,buffer);
|
||||
memcpy(&inodes[(ino-1)%MINIX_INODES_PER_BLOCK],result,
|
||||
sizeof(struct minix_inode));
|
||||
MinixWriteSector(Volume,block,buffer);
|
||||
|
||||
|
||||
ExFreePool(buffer);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
NTSTATUS MinixReadInode(PDEVICE_OBJECT DeviceObject,
|
||||
MINIX_DEVICE_EXTENSION* DeviceExt,
|
||||
ULONG ino,
|
||||
ULONG ino,
|
||||
struct minix_inode* result)
|
||||
{
|
||||
int block;
|
||||
struct minix_inode* inodes;
|
||||
PVOID BaseAddress;
|
||||
|
||||
|
||||
DPRINT("MinixReadInode(ino %x, result %x)\n",ino,result);
|
||||
|
||||
block = 2 + DeviceExt->sb->s_imap_blocks + DeviceExt->sb->s_zmap_blocks
|
||||
|
||||
block = 2 + DeviceExt->sb->s_imap_blocks + DeviceExt->sb->s_zmap_blocks
|
||||
+ ((ino-1) / MINIX_INODES_PER_BLOCK);
|
||||
DPRINT("Reading block %x offset %x\n",block,block*BLOCKSIZE);
|
||||
DPRINT("Index %x\n",(ino-1)%MINIX_INODES_PER_BLOCK);
|
||||
|
||||
|
||||
BaseAddress = ExAllocatePool(NonPagedPool, PAGE_SIZE);
|
||||
|
||||
|
||||
MinixReadPage(DeviceObject,
|
||||
block,
|
||||
BaseAddress);
|
||||
|
||||
inodes = (struct minix_inode *)(BaseAddress + ((block % 4) * 512));
|
||||
|
||||
|
||||
memcpy(result,
|
||||
&inodes[(ino-1)%MINIX_INODES_PER_BLOCK],
|
||||
sizeof(struct minix_inode));
|
||||
DPRINT("result->i_uid %x\n",result->i_uid);
|
||||
DPRINT("result->i_size %x\n",result->i_size);
|
||||
|
||||
|
||||
ExFreePool(BaseAddress);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
|
|
|
@ -112,11 +112,11 @@ ULONG MinixNewInode(PDEVICE_OBJECT Volume,
|
|||
struct minix_inode* new_inode);
|
||||
NTSTATUS MinixWriteInode(PDEVICE_OBJECT Volume,
|
||||
MINIX_DEVICE_EXTENSION* DeviceExt,
|
||||
ULONG ino,
|
||||
ULONG ino,
|
||||
struct minix_inode* result);
|
||||
NTSTATUS MinixReadInode(PDEVICE_OBJECT DeviceObject,
|
||||
MINIX_DEVICE_EXTENSION* DeviceExt,
|
||||
ULONG ino,
|
||||
ULONG ino,
|
||||
struct minix_inode* result);
|
||||
NTSTATUS MinixDeleteInode(PDEVICE_OBJECT Volume,
|
||||
MINIX_DEVICE_EXTENSION* DeviceExt,
|
||||
|
@ -124,7 +124,7 @@ NTSTATUS MinixDeleteInode(PDEVICE_OBJECT Volume,
|
|||
|
||||
NTSTATUS MinixReadBlock(PDEVICE_OBJECT DeviceObject,
|
||||
PMINIX_DEVICE_EXTENSION DeviceExt,
|
||||
struct minix_inode* inode,
|
||||
struct minix_inode* inode,
|
||||
ULONG FileOffset,
|
||||
PULONG DiskOffset);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* FILE: services/fs/minix/minix.c
|
||||
* PURPOSE: Minix FSD
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
@ -77,13 +77,13 @@ MinixFileSystemControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
NTSTATUS Status;
|
||||
char* superblock_buf;
|
||||
struct minix_super_block* sb;
|
||||
|
||||
|
||||
DbgPrint("MinixFileSystemControl(DeviceObject %x, Irp %x)\n",DeviceObject,
|
||||
Irp);
|
||||
DPRINT("DeviceToMount %x\n",DeviceToMount);
|
||||
|
||||
superblock_buf = ExAllocatePool(NonPagedPool,BLOCKSIZE);
|
||||
|
||||
|
||||
DPRINT("MinixReadSector %x\n",MinixReadSector);
|
||||
MinixReadSector(DeviceToMount,1,superblock_buf);
|
||||
sb = (struct minix_super_block *)superblock_buf;
|
||||
|
@ -101,10 +101,10 @@ MinixFileSystemControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
DPRINT("%s() = STATUS_UNRECOGNIZED_VOLUME\n",__FUNCTION__);
|
||||
Status = STATUS_UNRECOGNIZED_VOLUME;
|
||||
}
|
||||
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return(Status);
|
||||
}
|
||||
|
@ -123,11 +123,11 @@ DriverEntry(PDRIVER_OBJECT _DriverObject,
|
|||
PDEVICE_OBJECT DeviceObject;
|
||||
NTSTATUS ret;
|
||||
UNICODE_STRING DeviceName;
|
||||
|
||||
|
||||
DbgPrint("Minix FSD 0.0.1\n");
|
||||
|
||||
|
||||
DriverObject = _DriverObject;
|
||||
|
||||
|
||||
RtlInitUnicodeString(&DeviceName,
|
||||
L"\\Device\\Minix");
|
||||
ret = IoCreateDevice(DriverObject,
|
||||
|
@ -147,14 +147,14 @@ DriverEntry(PDRIVER_OBJECT _DriverObject,
|
|||
DriverObject->MajorFunction[IRP_MJ_CREATE] = MinixCreate;
|
||||
DriverObject->MajorFunction[IRP_MJ_READ] = MinixRead;
|
||||
DriverObject->MajorFunction[IRP_MJ_WRITE] = MinixWrite;
|
||||
DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] =
|
||||
DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] =
|
||||
MinixFileSystemControl;
|
||||
DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] =
|
||||
DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] =
|
||||
MinixDirectoryControl;
|
||||
DriverObject->DriverUnload = NULL;
|
||||
|
||||
IoRegisterFileSystem(DeviceObject);
|
||||
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* FILE: services/fs/minix/rw.c
|
||||
* PURPOSE: Minix FSD
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
@ -24,7 +24,7 @@ NTSTATUS STDCALL
|
|||
MinixWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||
{
|
||||
DPRINT("MinixWrite(DeviceObject %x Irp %x)\n",DeviceObject,Irp);
|
||||
|
||||
|
||||
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
||||
Irp->IoStatus.Information = 0;
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
|
@ -69,19 +69,19 @@ MinixRead(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
PMINIX_FSCONTEXT FsContext = (PMINIX_FSCONTEXT)FileObject->FsContext;
|
||||
unsigned int i;
|
||||
PVOID DiskBuffer;
|
||||
|
||||
|
||||
DPRINT("MinixRead(DeviceObject %x, Irp %x)\n",DeviceObject,Irp);
|
||||
|
||||
|
||||
Length = Stack->Parameters.Read.Length;
|
||||
Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress);
|
||||
Offset = Stack->Parameters.Read.ByteOffset.u.LowPart;
|
||||
|
||||
|
||||
DPRINT("Length %d Buffer %x Offset %x\n",Length,Buffer,Offset);
|
||||
|
||||
|
||||
CurrentOffset=Offset;
|
||||
|
||||
|
||||
DPRINT("inode->i_size %d\n",inode->i_size);
|
||||
|
||||
|
||||
if (Offset > FsContext->inode.i_size)
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
||||
|
@ -93,11 +93,11 @@ MinixRead(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
{
|
||||
Length = FsContext->inode.i_size - Offset;
|
||||
}
|
||||
|
||||
|
||||
if ((Offset%PAGE_SIZE)!=0)
|
||||
{
|
||||
CurrentOffset = Offset - (Offset%PAGE_SIZE);
|
||||
|
||||
|
||||
MinixReadFilePage(DeviceObject,
|
||||
DeviceExt,
|
||||
FsContext,
|
||||
|
@ -107,9 +107,9 @@ MinixRead(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
memcpy(Buffer,
|
||||
DiskBuffer+(Offset%PAGE_SIZE),
|
||||
min(PAGE_SIZE - (Offset%PAGE_SIZE),Length));
|
||||
|
||||
|
||||
ExFreePool(DiskBuffer);
|
||||
|
||||
|
||||
DPRINT("(BLOCKSIZE - (Offset%BLOCKSIZE)) %d\n",
|
||||
(BLOCKSIZE - (Offset%BLOCKSIZE)));
|
||||
DPRINT("Length %d\n",Length);
|
||||
|
@ -122,27 +122,27 @@ MinixRead(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
for (i=0;i<(Length/PAGE_SIZE);i++)
|
||||
{
|
||||
CHECKPOINT;
|
||||
|
||||
|
||||
DPRINT("Length %d\n",Length);
|
||||
|
||||
|
||||
MinixReadFilePage(DeviceObject,
|
||||
DeviceExt,
|
||||
FsContext,
|
||||
CurrentOffset,
|
||||
&DiskBuffer);
|
||||
memcpy(Buffer, DiskBuffer, PAGE_SIZE);
|
||||
|
||||
|
||||
ExFreePool(DiskBuffer);
|
||||
|
||||
|
||||
CurrentOffset = CurrentOffset + PAGE_SIZE;
|
||||
Buffer = Buffer + PAGE_SIZE;
|
||||
}
|
||||
if ((Length%PAGE_SIZE) > 0)
|
||||
{
|
||||
CHECKPOINT;
|
||||
|
||||
|
||||
DPRINT("Length %x Buffer %x\n",(Length%PAGE_SIZE),Buffer);
|
||||
|
||||
|
||||
MinixReadFilePage(DeviceObject,
|
||||
DeviceExt,
|
||||
FsContext,
|
||||
|
@ -154,7 +154,7 @@ MinixRead(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
ExFreePool(DiskBuffer);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = Length;
|
||||
IoCompleteRequest(Irp,IO_NO_INCREMENT);
|
||||
|
|
|
@ -196,7 +196,7 @@ MsfsCreateMailslot(PDEVICE_OBJECT DeviceObject,
|
|||
{
|
||||
RtlFreeUnicodeString(&Mailslot->Name);
|
||||
ExFreePool(Mailslot);
|
||||
|
||||
|
||||
Mailslot = current;
|
||||
}
|
||||
else
|
||||
|
@ -237,38 +237,38 @@ MsfsClose(PDEVICE_OBJECT DeviceObject,
|
|||
PMSFS_FCB Fcb;
|
||||
PMSFS_MESSAGE Message;
|
||||
KIRQL oldIrql;
|
||||
|
||||
|
||||
DPRINT("MsfsClose(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
|
||||
|
||||
|
||||
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||
DeviceExtension = DeviceObject->DeviceExtension;
|
||||
FileObject = IoStack->FileObject;
|
||||
|
||||
|
||||
KeLockMutex(&DeviceExtension->MailslotListLock);
|
||||
|
||||
|
||||
if (DeviceExtension->MailslotListHead.Flink == &DeviceExtension->MailslotListHead)
|
||||
{
|
||||
KeUnlockMutex(&DeviceExtension->MailslotListLock);
|
||||
|
||||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
Fcb = FileObject->FsContext;
|
||||
Mailslot = Fcb->Mailslot;
|
||||
|
||||
|
||||
DPRINT("Mailslot name: %wZ\n", &Mailslot->Name);
|
||||
|
||||
|
||||
Mailslot->ReferenceCount--;
|
||||
if (Mailslot->ServerFcb == Fcb)
|
||||
{
|
||||
/* delete all messages from message-list */
|
||||
KeAcquireSpinLock(&Mailslot->MessageListLock, &oldIrql);
|
||||
|
||||
|
||||
while (Mailslot->MessageListHead.Flink != &Mailslot->MessageListHead)
|
||||
{
|
||||
Message = CONTAINING_RECORD(Mailslot->MessageListHead.Flink,
|
||||
|
@ -278,17 +278,17 @@ MsfsClose(PDEVICE_OBJECT DeviceObject,
|
|||
ExFreePool(Message);
|
||||
}
|
||||
Mailslot->MessageCount = 0;
|
||||
|
||||
|
||||
KeReleaseSpinLock(&Mailslot->MessageListLock, oldIrql);
|
||||
Mailslot->ServerFcb = NULL;
|
||||
}
|
||||
|
||||
|
||||
KeAcquireSpinLock(&Mailslot->FcbListLock, &oldIrql);
|
||||
RemoveEntryList(&Fcb->FcbListEntry);
|
||||
KeReleaseSpinLock(&Mailslot->FcbListLock, oldIrql);
|
||||
ExFreePool(Fcb);
|
||||
FileObject->FsContext = NULL;
|
||||
|
||||
|
||||
if (Mailslot->ReferenceCount == 0)
|
||||
{
|
||||
DPRINT1("ReferenceCount == 0: Deleting mailslot data\n");
|
||||
|
@ -296,14 +296,14 @@ MsfsClose(PDEVICE_OBJECT DeviceObject,
|
|||
RemoveEntryList(&Mailslot->MailslotListEntry);
|
||||
ExFreePool(Mailslot);
|
||||
}
|
||||
|
||||
|
||||
KeUnlockMutex(&DeviceExtension->MailslotListLock);
|
||||
|
||||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,9 +46,9 @@ MsfsQueryMailslotInformation(PMSFS_FCB Fcb,
|
|||
Buffer->NextSize = 0;
|
||||
}
|
||||
KeReleaseSpinLock(&Mailslot->MessageListLock, oldIrql);
|
||||
|
||||
|
||||
*BufferLength -= sizeof(FILE_MAILSLOT_QUERY_INFORMATION);
|
||||
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue