Author: hbelusca
Date: Sun Jul 7 15:57:48 2013
New Revision: 59448
URL:
http://svn.reactos.org/svn/reactos?rev=59448&view=rev
Log:
[CONDRV]
- Hey Arch! You're displaying Major function codes, not IOCTL codes. Also, remove
unnecessary casts (coming from some old code), and a use-after free.
- Add some memory helpers.
Added:
trunk/reactos/drivers/base/condrv/heap.h
- copied, changed from r59436, trunk/reactos/win32ss/user/consrv/heap.h
Modified:
trunk/reactos/drivers/base/condrv/condrv.c
trunk/reactos/drivers/base/condrv/condrv.h
trunk/reactos/drivers/base/condrv/control.c
Modified: trunk/reactos/drivers/base/condrv/condrv.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/condrv/condrv…
==============================================================================
--- trunk/reactos/drivers/base/condrv/condrv.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/base/condrv/condrv.c [iso-8859-1] Sun Jul 7 15:57:48 2013
@@ -40,16 +40,16 @@
Irp->IoStatus.Information = Information;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return Irp->IoStatus.Status;
+ return Status;
}
NTSTATUS NTAPI
ConDrvDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
{
-#define HANDLE_CTRL_CODE(CtrlCode) \
- case CtrlCode : \
- { \
- DPRINT1("ConDrv: " #CtrlCode ", stack->FileObject =
0x%p\n", stack->FileObject); \
+#define HANDLE_CTRL_CODE(Code) \
+ case Code : \
+ { \
+ DPRINT1("ConDrv: " #Code ", stack->FileObject = 0x%p\n",
stack->FileObject); \
if (stack->FileObject)
\
{
\
DPRINT1("stack->FileObject->FileName = %wZ\n",
&stack->FileObject->FileName); \
@@ -58,10 +58,11 @@
}
PIO_STACK_LOCATION stack = IoGetCurrentIrpStackLocation(Irp);
- ULONG ctrlCode = stack->Parameters.DeviceIoControl.IoControlCode;
+ // ULONG ctrlCode = stack->Parameters.DeviceIoControl.IoControlCode;
+ ULONG MajorFunction = stack->MajorFunction;
/* Just display all the IRP codes for now... */
- switch (ctrlCode)
+ switch (MajorFunction)
{
HANDLE_CTRL_CODE(IRP_MJ_CREATE);
HANDLE_CTRL_CODE(IRP_MJ_CREATE_NAMED_PIPE);
@@ -96,7 +97,7 @@
default:
{
- DPRINT1("Unknown code %lu\n", ctrlCode);
+ DPRINT1("Unknown Major %lu\n", MajorFunction);
break;
}
}
Modified: trunk/reactos/drivers/base/condrv/condrv.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/condrv/condrv…
==============================================================================
--- trunk/reactos/drivers/base/condrv/condrv.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/base/condrv/condrv.h [iso-8859-1] Sun Jul 7 15:57:48 2013
@@ -10,7 +10,10 @@
#define __CONDRV_H__
/* This is needed for VisualDDK testing */
+// #define __USE_VISUALDDK_AT_HOME__
+
#ifdef __USE_VISUALDDK_AT_HOME__
+ #pragma message("Disable __USE_VISUALDDK_AT_HOME__ before committing!!")
#include "VisualDDKHelpers.h"
#endif
Modified: trunk/reactos/drivers/base/condrv/control.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/condrv/contro…
==============================================================================
--- trunk/reactos/drivers/base/condrv/control.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/base/condrv/control.c [iso-8859-1] Sun Jul 7 15:57:48 2013
@@ -44,8 +44,7 @@
&Controller);
if (!NT_SUCCESS(Status)) goto Done;
- Status = IoCreateSymbolicLink((PUNICODE_STRING)&SymlinkName,
- (PUNICODE_STRING)&DeviceName);
+ Status = IoCreateSymbolicLink(&SymlinkName, &DeviceName);
if (!NT_SUCCESS(Status))
{
IoDeleteDevice(Controller);
Copied: trunk/reactos/drivers/base/condrv/heap.h (from r59436,
trunk/reactos/win32ss/user/consrv/heap.h)
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/condrv/heap.h…
==============================================================================
--- trunk/reactos/win32ss/user/consrv/heap.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/base/condrv/heap.h [iso-8859-1] Sun Jul 7 15:57:48 2013
@@ -1,17 +1,22 @@
/*
* COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS Console Server DLL
- * FILE: win32ss/user/consrv/heap.h
+ * PROJECT: ReactOS Console Driver
+ * FILE: drivers/base/condrv/heap.h
* PURPOSE: Heap Helpers
* PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
*/
#pragma once
-/* See init.c */
-extern HANDLE ConSrvHeap;
+#define ConDrvAllocPoolNonPageable(Flags, Size, Tag) \
+ __pragma(message("WARNING - Flags parameter ignored. You may encounter
problems!")) \
+ ExAllocatePoolWithTag(NonPagedPool, Size, Tag)
-#define ConsoleAllocHeap(Flags, Size) RtlAllocateHeap(ConSrvHeap, Flags, Size)
-#define ConsoleFreeHeap(HeapBase) RtlFreeHeap(ConSrvHeap, 0, HeapBase)
+#define ConDrvAllocPoolPageable(Flags, Size, Tag) \
+ __pragma(message("WARNING - Flags parameter ignored. You may encounter
problems!")) \
+ ExAllocatePoolWithTag(PagedPool, Size, Tag)
+
+#define ConDrvFreePool(PoolBase, Tag) \
+ ExFreePoolWithTag(PoolBase, Tag)
/* EOF */