Author: sir_richard
Date: Fri Jun 17 17:21:20 2011
New Revision: 52320
URL:
http://svn.reactos.org/svn/reactos?rev=52320&view=rev
Log:
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.
Modified:
trunk/reactos/drivers/sac/driver/data.c
trunk/reactos/drivers/sac/driver/dispatch.c
trunk/reactos/drivers/sac/driver/init.c
trunk/reactos/drivers/sac/driver/sacdrv.h
Modified: trunk/reactos/drivers/sac/driver/data.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/sac/driver/data.c?…
==============================================================================
--- trunk/reactos/drivers/sac/driver/data.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/sac/driver/data.c [iso-8859-1] Fri Jun 17 17:21:20 2011
@@ -49,7 +49,7 @@
}
BOOLEAN
-InitalizeGlobalData(
+InitializeGlobalData(
IN PUNICODE_STRING RegistryPath,
IN PDRIVER_OBJECT DriverObject
)
Modified: trunk/reactos/drivers/sac/driver/dispatch.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/sac/driver/dispatc…
==============================================================================
--- trunk/reactos/drivers/sac/driver/dispatch.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/sac/driver/dispatch.c [iso-8859-1] Fri Jun 17 17:21:20 2011
@@ -80,7 +80,6 @@
}
VOID
-NTAPI
UnloadHandler(
IN PDRIVER_OBJECT DriverObject
)
Modified: trunk/reactos/drivers/sac/driver/init.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/sac/driver/init.c?…
==============================================================================
--- trunk/reactos/drivers/sac/driver/init.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/sac/driver/init.c [iso-8859-1] Fri Jun 17 17:21:20 2011
@@ -20,5 +20,74 @@
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;
}
Modified: trunk/reactos/drivers/sac/driver/sacdrv.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/sac/driver/sacdrv.…
==============================================================================
--- trunk/reactos/drivers/sac/driver/sacdrv.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/sac/driver/sacdrv.h [iso-8859-1] Fri Jun 17 17:21:20 2011
@@ -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 @@
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;