[ros-dev] Re:[ros-svn] [ion] 12748: Fix incorrect LPC Object export...we export pointers not the object itself! Also remove more TIME stuf

Filip Navara xnavara at volny.cz
Mon Jan 3 17:17:32 CET 2005


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:

    NTSTATUS STDCALL
    ObCreateObjectType(
        IN PUNICODE_STRING ObjectTypeName,
        IN POBJECT_TYPE_INITIALIZER ObjectTypeInitializer,
        IN ULONG Reserved,
        OUT POBJECT_TYPE *ObjectType);

    typedef struct _OBJECT_TYPE_INITIALIZER
    {
        WORD Length;
        UCHAR UseDefaultObject;
        UCHAR CaseInsensitive;
        ULONG InvalidAttributes;
        GENERIC_MAPPING GenericMapping;
        ULONG ValidAccessMask;
        UCHAR SecurityRequired;
        UCHAR MaintainHandleCount;
        UCHAR MaintainTypeList;
        POOL_TYPE PoolType;
        ULONG DefaultPagedPoolCharge;
        ULONG DefaultNonPagedPoolCharge;
        /* Prototypes for the functions below are in our headers... */
        PVOID DumpProcedure;
        PVOID OpenProcedure;
        PVOID CloseProcedure;
        PVOID DeleteProcedure;
        PVOID ParseProcedure;
        PVOID SecurityProcedure;
        PVOID QueryNameProcedure;
        PVOID OkayToCloseProcedure;
    } OBJECT_TYPE_INITIALIZER, *POBJECT_TYPE_INITIALIZER;

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




More information about the Ros-dev mailing list