[ros-dev] Re:[ros-svn] [ion] 12748: Fix incorrect LPC Object
export...we export pointers not the object
itself! Also remove more TIME stuf
Hartmut Birr
hartmut.birr at gmx.de
Mon Jan 3 17:44:13 CET 2005
Filip Navara schrieb:
> Filip Navara wrote:
>
>> Hartmut Birr wrote:
>>
>>> I think that Alex's changes are correct. If Alex's changes are
>>> wrong, all other type object initialisations are also wrong. There
>>> is only one little bug, the EXPORTED/IMPORTED definition is missing.
>>
>>
>> Hmm, you might be right...
>
>
> I have searched the net a bit and looked into my books.
>
> Windows NT Filesystem Internals:
> "...at system initialization time, the NT I/O Manager registers all
> the different I/O Manager objects (including the file object
> structure) with the NT Object Manager. The ObCreateObjectType() Object
> Manager routine is used for this purpose. Although this routine is not
> exposed by the NT Executive, it serves to make the NT Object Manager
> aware of a new object type. When invoking this routine, the I/O
> Manager also supplies the functions that must be invoked by the Object
> Manager to manipulate the object being defined. For file object
> structures, the I/O Manager supplies an internal routine called
> IopCloseFile() to be invoked whenever any handle associated with the
> file object has been closed."
>
> The ObCreateObjectType function has prototype similar to this:
>
> and it's used like
>
> RtlZeroMemory(&ObjectTypeInitializer,
> sizeof(OBJECT_TYPE_INITIALIZER));
> ObjectTypeInitializer.Length = sizeof(OBJECT_TYPE_INITIALIZER);
> ...
> RtlInitUnicodeString(&ObjectTypeName, L"Port");
> ObCreateObjectType(&ObjectTypeName, &ObjectTypeInitializer, 0,
> &LpcPortObjectType);
>
> so yes, the exported *ObjectType variables are really of type
> POBJECT_TYPE.
>
> My apologies to Alex.
>
> Regards,
> Filip
>
>
> _______________________________________________
> Ros-dev mailing list
> Ros-dev at reactos.com
> http://reactos.com:8080/mailman/listinfo/ros-dev
>
>
Hi,
I've add some code to my test driver:
Status = ZwCreateEvent(&hEvent, EVENT_ALL_ACCESS, NULL,
NotificationEvent, FALSE);
DPRINT1("%x\n", Status);
if (NT_SUCCESS(Status))
{
Status = ObReferenceObjectByHandle(hEvent, EVENT_ALL_ACCESS,
(POBJECT_TYPE)ExEventObjectType, KernelMode, (PVOID*)&Event, NULL);
DPRINT1("%x\n", Status);
if (NT_SUCCESS(Status))
{
ObDereferenceObject((PVOID)Event);
}
Status = ObReferenceObjectByHandle(hEvent, EVENT_ALL_ACCESS,
(POBJECT_TYPE)&ExEventObjectType, KernelMode, (PVOID*)&Event, NULL);
DPRINT1("%x\n", Status);
if (NT_SUCCESS(Status))
{
ObDereferenceObject((PVOID)Event);
}
ZwClose(hEvent);
}
The result on W2K is:
(memtest.c:185) 0
(memtest.c:189) 0
(memtest.c: 195) c0000024 -> STATUS_OBJECT_TYPE_MISMATCH
This means Alex's changes and the other object type initialisations are
correct.
- Hartmut
More information about the Ros-dev
mailing list