Filip Navara wrote:
ea(a)iol.it wrote:
Fix
incorrect LPC Object export...we export pointers not the object
itself!
Why?
Aren't DATA symbols exported by DLLs pointers?
Yes, they are! Alex's change is WRONG!
The attached patch reverts the incorrect changes in Alex's patch.
Index: ps/process.c
===================================================================
--- ps/process.c (revision 12754)
+++ ps/process.c (working copy)
@@ -745,7 +745,7 @@
{
Status = ObReferenceObjectByHandle(DebugPort,
PORT_ALL_ACCESS,
- LpcPortObjectType,
+ &LpcPortObjectType,
UserMode,
(PVOID*)&pDebugPort,
NULL);
@@ -767,7 +767,7 @@
{
Status = ObReferenceObjectByHandle(ExceptionPort,
PORT_ALL_ACCESS,
- LpcPortObjectType,
+ &LpcPortObjectType,
UserMode,
(PVOID*)&pExceptionPort,
NULL);
Index: ps/kill.c
===================================================================
--- ps/kill.c (revision 12754)
+++ ps/kill.c (working copy)
@@ -448,7 +448,7 @@
Status = ObReferenceObjectByHandle(PortHandle,
PORT_ALL_ACCESS,
- LpcPortObjectType,
+ &LpcPortObjectType,
KeGetCurrentThread()->PreviousMode,
(PVOID*)&TerminationPort,
NULL);
Index: include/internal/port.h
===================================================================
--- include/internal/port.h (revision 12754)
+++ include/internal/port.h (working copy)
@@ -140,7 +140,7 @@
NTSTATUS
NiInitPort (VOID);
-extern POBJECT_TYPE LpcPortObjectType;
+extern OBJECT_TYPE LpcPortObjectType;
extern ULONG LpcpNextMessageId;
extern FAST_MUTEX LpcpLock;
Index: lpc/create.c
===================================================================
--- lpc/create.c (revision 12754)
+++ lpc/create.c (working copy)
@@ -134,7 +134,7 @@
/* Ask Ob to create the object */
Status = ObCreateObject (ExGetPreviousMode(),
- LpcPortObjectType,
+ &LpcPortObjectType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
Index: lpc/port.c
===================================================================
--- lpc/port.c (revision 12754)
+++ lpc/port.c (working copy)
@@ -21,7 +21,7 @@
/* GLOBALS *******************************************************************/
-POBJECT_TYPE LpcPortObjectType = 0;
+OBJECT_TYPE LpcPortObjectType;
ULONG LpcpNextMessageId = 0; /* 0 is not a valid ID */
FAST_MUTEX LpcpLock; /* global internal sync in LPC facility */
@@ -37,32 +37,28 @@
NTSTATUS INIT_FUNCTION
NiInitPort (VOID)
{
- /* Allocate Memory for the LPC Object */
- LpcPortObjectType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
- RtlZeroMemory (LpcPortObjectType, sizeof (OBJECT_TYPE));
+
RtlRosInitUnicodeStringFromLiteral(&LpcPortObjectType.TypeName,L"Port");
-
RtlRosInitUnicodeStringFromLiteral(&LpcPortObjectType->TypeName,L"Port");
-
- LpcPortObjectType->Tag = TAG('L', 'P', 'R', 'T');
- LpcPortObjectType->MaxObjects = ULONG_MAX;
- LpcPortObjectType->MaxHandles = ULONG_MAX;
- LpcPortObjectType->TotalObjects = 0;
- LpcPortObjectType->TotalHandles = 0;
- LpcPortObjectType->PagedPoolCharge = 0;
- LpcPortObjectType->NonpagedPoolCharge = sizeof(EPORT);
- LpcPortObjectType->Mapping = &ExpPortMapping;
- LpcPortObjectType->Dump = NULL;
- LpcPortObjectType->Open = NULL;
- LpcPortObjectType->Close = NiClosePort;
- LpcPortObjectType->Delete = NiDeletePort;
- LpcPortObjectType->Parse = NULL;
- LpcPortObjectType->Security = NULL;
- LpcPortObjectType->QueryName = NULL;
- LpcPortObjectType->OkayToClose = NULL;
- LpcPortObjectType->Create = NiCreatePort;
- LpcPortObjectType->DuplicationNotify = NULL;
+ LpcPortObjectType.Tag = TAG('L', 'P', 'R', 'T');
+ LpcPortObjectType.MaxObjects = ULONG_MAX;
+ LpcPortObjectType.MaxHandles = ULONG_MAX;
+ LpcPortObjectType.TotalObjects = 0;
+ LpcPortObjectType.TotalHandles = 0;
+ LpcPortObjectType.PagedPoolCharge = 0;
+ LpcPortObjectType.NonpagedPoolCharge = sizeof(EPORT);
+ LpcPortObjectType.Mapping = &ExpPortMapping;
+ LpcPortObjectType.Dump = NULL;
+ LpcPortObjectType.Open = NULL;
+ LpcPortObjectType.Close = NiClosePort;
+ LpcPortObjectType.Delete = NiDeletePort;
+ LpcPortObjectType.Parse = NULL;
+ LpcPortObjectType.Security = NULL;
+ LpcPortObjectType.QueryName = NULL;
+ LpcPortObjectType.OkayToClose = NULL;
+ LpcPortObjectType.Create = NiCreatePort;
+ LpcPortObjectType.DuplicationNotify = NULL;
- ObpCreateTypeObject(LpcPortObjectType);
+ ObpCreateTypeObject(&LpcPortObjectType);
LpcpNextMessageId = 0;
Index: lpc/query.c
===================================================================
--- lpc/query.c (revision 12754)
+++ lpc/query.c (working copy)
@@ -50,7 +50,7 @@
Status = ObReferenceObjectByHandle (PortHandle,
PORT_ALL_ACCESS, /* AccessRequired */
- LpcPortObjectType,
+ &LpcPortObjectType,
UserMode,
(PVOID *) & Port,
NULL);
Index: lpc/complete.c
===================================================================
--- lpc/complete.c (revision 12754)
+++ lpc/complete.c (working copy)
@@ -46,7 +46,7 @@
*/
Status = ObReferenceObjectByHandle (hServerSideCommPort,
PORT_ALL_ACCESS,
- LpcPortObjectType,
+ &LpcPortObjectType,
UserMode,
(PVOID*)&ReplyPort,
NULL);
Index: lpc/connect.c
===================================================================
--- lpc/connect.c (revision 12754)
+++ lpc/connect.c (working copy)
@@ -66,7 +66,7 @@
* Create a port to represent our side of the connection
*/
Status = ObCreateObject (KernelMode,
- LpcPortObjectType,
+ &LpcPortObjectType,
NULL,
KernelMode,
NULL,
@@ -333,7 +333,7 @@
0,
NULL,
PORT_ALL_ACCESS, /* DesiredAccess */
- LpcPortObjectType,
+ &LpcPortObjectType,
UserMode,
NULL,
(PVOID*)&NamedPort);
@@ -547,7 +547,7 @@
Status = ObReferenceObjectByHandle(NamedPortHandle,
PORT_ALL_ACCESS,
- LpcPortObjectType,
+ &LpcPortObjectType,
UserMode,
(PVOID*)&NamedPort,
NULL);
@@ -563,7 +563,7 @@
if (AcceptIt)
{
Status = ObCreateObject(ExGetPreviousMode(),
- LpcPortObjectType,
+ &LpcPortObjectType,
NULL,
ExGetPreviousMode(),
NULL,
Index: lpc/send.c
===================================================================
--- lpc/send.c (revision 12754)
+++ lpc/send.c (working copy)
@@ -180,7 +180,7 @@
Status = ObReferenceObjectByHandle(PortHandle,
PORT_ALL_ACCESS,
- LpcPortObjectType,
+ &LpcPortObjectType,
UserMode,
(PVOID*)&Port,
NULL);
@@ -231,7 +231,7 @@
Status = ObReferenceObjectByHandle(PortHandle,
PORT_ALL_ACCESS,
- LpcPortObjectType,
+ &LpcPortObjectType,
UserMode,
(PVOID*)&Port,
NULL);
Index: lpc/reply.c
===================================================================
--- lpc/reply.c (revision 12754)
+++ lpc/reply.c (working copy)
@@ -88,7 +88,7 @@
Status = ObReferenceObjectByHandle(PortHandle,
PORT_ALL_ACCESS, /* AccessRequired */
- LpcPortObjectType,
+ &LpcPortObjectType,
UserMode,
(PVOID*)&Port,
NULL);
@@ -154,7 +154,7 @@
Status = ObReferenceObjectByHandle(PortHandle,
PORT_ALL_ACCESS,
- LpcPortObjectType,
+ &LpcPortObjectType,
UserMode,
(PVOID*)&Port,
NULL);