mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 03:54:02 +00:00
Patch by Anton Yarotsky:
[SACDRV]: Implement DriverEntry point which connects to NTOS HeadLess Module (HDL). If HDL enabled through FreeLDR (/EMSPORT), connection should work. [SACDRV]: Fix typo's. svn path=/trunk/; revision=52320
This commit is contained in:
parent
72d1c15806
commit
3c0e77846e
4 changed files with 115 additions and 5 deletions
|
@ -49,7 +49,7 @@ InitializeDeviceData(
|
|||
}
|
||||
|
||||
BOOLEAN
|
||||
InitalizeGlobalData(
|
||||
InitializeGlobalData(
|
||||
IN PUNICODE_STRING RegistryPath,
|
||||
IN PDRIVER_OBJECT DriverObject
|
||||
)
|
||||
|
|
|
@ -80,7 +80,6 @@ TimerDpcRoutine(
|
|||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
UnloadHandler(
|
||||
IN PDRIVER_OBJECT DriverObject
|
||||
)
|
||||
|
|
|
@ -20,5 +20,74 @@ DriverEntry(
|
|||
IN PUNICODE_STRING RegistryPath
|
||||
)
|
||||
{
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
HEADLESS_RSP_QUERY_INFO HeadlessInformation;
|
||||
ULONG InfoSize;
|
||||
NTSTATUS Status;
|
||||
UNICODE_STRING DriverName;
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
PSAC_DEVICE_EXTENSION DeviceExtension;
|
||||
PAGED_CODE();
|
||||
|
||||
SAC_DBG(SAC_DBG_ENTRY_EXIT, "Entering.\n");
|
||||
|
||||
HeadlessDispatch(
|
||||
HeadlessCmdQueryInformation,
|
||||
NULL,
|
||||
0,
|
||||
&HeadlessInformation,
|
||||
&InfoSize
|
||||
);
|
||||
if ((HeadlessInformation.Serial.TerminalType != HeadlessUndefinedPortType) &&
|
||||
((HeadlessInformation.Serial.TerminalType != HeadlessSerialPort) ||
|
||||
(HeadlessInformation.Serial.TerminalAttached)))
|
||||
{
|
||||
RtlInitUnicodeString(&DriverName, L"\\Device\\SAC");
|
||||
|
||||
Status = IoCreateDevice(
|
||||
DriverObject,
|
||||
sizeof(SAC_DEVICE_EXTENSION),
|
||||
&DriverName,
|
||||
FILE_DEVICE_UNKNOWN,
|
||||
FILE_DEVICE_SECURE_OPEN,
|
||||
FALSE,
|
||||
&DeviceObject
|
||||
);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
DeviceExtension = DeviceObject->DeviceExtension;
|
||||
DeviceExtension->Initialized = FALSE;
|
||||
|
||||
RtlFillMemoryUlong(
|
||||
DriverObject->MajorFunction,
|
||||
sizeof(DriverObject->MajorFunction) / sizeof(PVOID),
|
||||
(ULONG_PTR)Dispatch);
|
||||
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] =
|
||||
DispatchDeviceControl;
|
||||
DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] =
|
||||
DispatchShutdownControl;
|
||||
DriverObject->FastIoDispatch = NULL;
|
||||
DriverObject->DriverUnload = UnloadHandler;
|
||||
|
||||
if (InitializeGlobalData(RegistryPath, DriverObject))
|
||||
{
|
||||
if (InitializeDeviceData(DeviceObject))
|
||||
{
|
||||
IoRegisterShutdownNotification(DeviceObject);
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
else
|
||||
{
|
||||
SAC_DBG(SAC_DBG_INIT, "unable to create device object: %X\n", Status);
|
||||
}
|
||||
|
||||
FreeGlobalData();
|
||||
SAC_DBG(SAC_DBG_ENTRY_EXIT, "Exiting with status 0x%x\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
return STATUS_PORT_DISCONNECTED;
|
||||
}
|
||||
|
|
|
@ -7,9 +7,11 @@
|
|||
*/
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
#include <ntddk.h>
|
||||
#include <ntifs.h>
|
||||
#include <ntoskrnl/include/internal/hdl.h>
|
||||
|
||||
#define SAC_DBG_ENTRY_EXIT 0x01
|
||||
#define SAC_DBG_INIT 0x04
|
||||
#define SAC_DBG_MM 0x1000
|
||||
|
||||
#define SAC_DBG(x, ...) \
|
||||
|
@ -154,8 +156,48 @@ typedef struct _SAC_CHANNEL_ATTRIBUTES
|
|||
PKEVENT HasNewDataEvent;
|
||||
PKEVENT LockEvent;
|
||||
PKEVENT RedrawEvent;
|
||||
GUID ChannelId;
|
||||
GUID ChannelId;
|
||||
} SAC_CHANNEL_ATTRIBUTES, *PSAC_CHANNEL_ATTRIBUTES;
|
||||
|
||||
NTSTATUS
|
||||
Dispatch(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
DispatchDeviceControl(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
DispatchShutdownControl(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp
|
||||
);
|
||||
|
||||
VOID
|
||||
UnloadHandler(
|
||||
IN PDRIVER_OBJECT DriverObject
|
||||
);
|
||||
|
||||
VOID
|
||||
FreeGlobalData(
|
||||
VOID
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
InitializeDeviceData(
|
||||
IN PDEVICE_OBJECT DeviceObject
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
InitializeGlobalData(
|
||||
IN PUNICODE_STRING RegistryPath,
|
||||
IN PDRIVER_OBJECT DriverObject
|
||||
);
|
||||
|
||||
extern ULONG SACDebug;
|
||||
|
||||
|
|
Loading…
Reference in a new issue