Re: How to inform application (attach/detach device)
From: Robin Holenweger (holi_at_nospam.com)
Date: 07/27/04
- Next message: Robin Holenweger: "Howto use DevStudio 6 for driver development"
- Previous message: Dennis Burns: "Pnp Device Driver Loaded when No Devices Present"
- In reply to: Bill McKenzie: "Re: How to inform application (attach/detach device)"
- Next in thread: Maxim S. Shatskih: "Re: How to inform application (attach/detach device)"
- Reply: Maxim S. Shatskih: "Re: How to inform application (attach/detach device)"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 27 Jul 2004 14:07:25 +0200
Bill McKenzie wrote:
> You can register for PnP notifications. See RegisterDeviceNotification in
> the Platform SDK documentation.
Thanks, that helps already a lot.
When reading and implementing, I found out something weird: for
RegisterDeviceNotification() I should fill a structure depending on what
device I want to register for. All structures have an equal "header
part" (DEV_BROADCAST_HDR), followed by type specific stuff.
As I need to get informed about a logical COM port, I chose the type
DBT_DEVTYP_PORT.
structure:
typedef struct _DEV_BROADCAST_PORT {
DWORD dbcp_size;
DWORD dbcp_devicetype;
DWORD dbcp_reserved;
TCHAR dbcp_name[1];
} DEV_BROADCAST_PORT *PDEV_BROADCAST_PORT;
description:
dbcp_name
Pointer to a null-terminated string specifying the friendly name of the
port or the device connected to the port. Friendly names are intended to
help the user quickly and accurately identify the device—for example,
"COM1" and "Standard 28800 bps Modem" are considered friendly names.
Resulting question: how the heck shall I store such a described
"friendly name" in a TCHAR array of size 1??? Is there a trick? As far
as I understand, dbcp_name is a 8-bit value, whereas I would need a
32-bit value (TCHAR*) to store a pointer to such a "friendly name".
Many thanks
Robin
- Next message: Robin Holenweger: "Howto use DevStudio 6 for driver development"
- Previous message: Dennis Burns: "Pnp Device Driver Loaded when No Devices Present"
- In reply to: Bill McKenzie: "Re: How to inform application (attach/detach device)"
- Next in thread: Maxim S. Shatskih: "Re: How to inform application (attach/detach device)"
- Reply: Maxim S. Shatskih: "Re: How to inform application (attach/detach device)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|