How to obtain a device type?

Hi all :slight_smile:

Anybody knows how I can obtain information about device?
For example - \Device\Harddisk0

How I can know exactly that this device is a block device?
I need to collect information about all valid block devices in Windows NT
but I have too few information abou Native API. I have some prototypes of
functions like NtOpenDirectoryObject(), NtQueryDirectoryObject etc. but
these functions not gives me all information that I need.
I found function NtQueryObject in NTDLL.DLL and I think that this function
probably can help me but I haven’t its prototype.

Thanks in advance

**********************************************
Best regards, Alex Pro (Alexey Prokoptchuk),
System Administrator
Contact phone - +380-6452 99622
ICQ - 17815755
**********************************************

Here is the prototype:

NTSYSAPI
NTSTATUS
NTAPI
NtQueryObject(
IN HANDLE hObject,
IN OBJECT_INFO_CLASS ObjectInfoClass,
OUT PVOID Buffer,
IN ULONG BufferSize,
OUT PULONG BytesReturned
);

following are the defines for ObjectInfoClass and associated Buffers.

typedef enum _OBJECT_INFO_CLASS {
ObjectBasicInfo,
ObjectNameInfo,
ObjectTypeInfo,
ObjectAllTypesInfo,
ObjectProtectionInfo
} OBJECT_INFO_CLASS;

typedef struct ObjectBasicInfo_t {
char Unknown1[8];
ULONG HandleCount;
ULONG ReferenceCount;
ULONG PagedQuota;
ULONG NonPagedQuota;
char Unknown2[32];
} OBJECT_BASIC_INFO, *POBJECT_BASIC_INFO;

typedef struct ObjectNameInfo_t {
UNICODE_STRING ObjectName;
WCHAR ObjectNameBuffer[1];
} OBJECT_NAME_INFO, *POBJECT_NAME_INFO;

typedef struct ObjectTypeInfo_t {
UNICODE_STRING ObjectTypeName;
char Unknown[0x58];
WCHAR ObjectTypeNameBuffer[1];
} OBJECT_TYPE_INFO, *POBJECT_TYPE_INFO;

typedef struct ObjectAllTypeInfo_t {
ULONG NumberOfObjectTypes;
OBJECT_TYPE_INFO ObjectsTypeInfo[1];
} OBJECT_ALL_TYPES_INFO, *POBJECT_ALL_TYPES_INFO;

typedef struct ObjectProtectionInfo_t {
BOOLEAN bInherit;
BOOLEAN bProtectHandle;
} OBJECT_PROTECTION_INFO, *POBJECT_PROTECTION_INFO;


Prakash Bilodi

----- Original Message -----
From: Alexey V. Prokoptchuk
To: File Systems Developers
Sent: Wednesday, March 22, 2000 10:04 AM
Subject: [ntfsd] How to obtain a device type?

> Hi all :slight_smile:
>
> Anybody knows how I can obtain information about device?
> For example - \Device\Harddisk0
>
> How I can know exactly that this device is a block device?
> I need to collect information about all valid block devices in Windows NT
> but I have too few information abou Native API. I have some prototypes of
> functions like NtOpenDirectoryObject(), NtQueryDirectoryObject etc. but
> these functions not gives me all information that I need.
> I found function NtQueryObject in NTDLL.DLL and I think that this function

> probably can help me but I haven’t its prototype.
>
> Thanks in advance
>
>
>
> Best regards, Alex Pro (Alexey Prokoptchuk),
> System Administrator
> Contact phone - +380-6452 99622
> ICQ - 17815755
>

>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@interactivesi.com
> To unsubscribe send a blank email to $subst(‘Email.Unsub’)
>
>

Hello,

Check out “Undocumented Windows NT” ISBN 0764545698.
The UNDOCNT.H on the CD-ROM attached with the book
provides the prototypes for around 220 system services
along with the detailed structure parameter
definitions.

For more details about the book, visit
http://wwww.cybermedia.co.in

-Prasad

— “Alexey V. Prokoptchuk”
wrote:
> Hi all :slight_smile:
>
> Anybody knows how I can obtain information about
> device?
> For example - \Device\Harddisk0
>
> How I can know exactly that this device is a block
> device?
> I need to collect information about all valid block
> devices in Windows NT
> but I have too few information abou Native API. I
> have some prototypes of
> functions like NtOpenDirectoryObject(),
> NtQueryDirectoryObject etc. but
> these functions not gives me all information that I
> need.
> I found function NtQueryObject in NTDLL.DLL and I
> think that this function
> probably can help me but I haven’t its prototype.
>
> Thanks in advance
>
>
>
> Best regards, Alex Pro (Alexey Prokoptchuk),
> System Administrator
> Contact phone - +380-6452 99622
> ICQ - 17815755
>

>
>
> —
> You are currently subscribed to ntfsd as:
> xxxxx@yahoo.com
> To unsubscribe send a blank email to
> $subst(‘Email.Unsub’)
>
>

=====
Prasad S. Dabak
Director of Engineering, Windows NT/2000 Division
Cybermedia Software Private Limited
http://www.cybermedia.co.in
Co-author of the book “Undocumented Windows NT”
ISBN 0764545698

__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

> How I can know exactly that this device is a block device?

Check for FILE_DEVICE_DISK and FILE_DEVICE_CDROM DeviceTypes.
(“block device” usually means “the device on which a filesystem can be
mounted” - and the above types in NT are used for such devices).

Max