Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Question: IoRegisterPlugPlayNotification

111 views
Skip to first unread message

ben

unread,
Dec 1, 2002, 4:51:42 PM12/1/02
to
I registered the PNP notification:

status = IoRegisterPlugPlayNotification
(EventCategoryDeviceInterfaceChange,

PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES,

(PVOID)&GUID_PARALLEL_DEVICE,//GUID_PARALLEL_DEVICE,
pDriverObject,

(PDRIVER_NOTIFICATION_CALLBACK_ROUTINE)LbkEnumPorts,
(PVOID)NULL,//Context Points to
a caller-allocated buffer containing context that the PnP Manager passes to
the callback routine.
&NotificationHandle);

My computer has one parallel port and the function ...


NTSTATUS
LbkEnumPorts (
IN PDEVICE_INTERFACE_CHANGE_NOTIFICATION NotificationStructure,
IN PVOID Context
)
{
CUString s("abc");
DbgPrint ("+++++ %08x %04x %S",
NotificationStructure->InterfaceClassGuid.Data1,
NotificationStructure->InterfaceClassGuid.Data2,
NotificationStructure->SymbolicLinkName);
return STATUS_SUCCESS;
}


... is called once. So far so good, as I can see the InterfaceClassGuid
corresponds to GUID_PARALLEL_DEVICE.
Ok, BUT NotificationStructure->SymbolicLinkName contains '????' instead of
LPT1. Is that ok? As far as I understood the PARCLASS example this funktion
determined the devices SymbolicLinkName.


Jim Cavalaris [MS]

unread,
Dec 2, 2002, 6:22:38 PM12/2/02
to
first, note that the SymbolicLinkName field in the
DEVICE_INTERFACE_CHANGE_NOTIFICATION
structure is actually a PUNICODE_STRING, not a PWSTR.
(you need to DbgPrint the PUNICODE_STRING using %wZ,
or DbgPring the string text in the UNICODE_STRING.Buffer
PWSTR field with %S).

the SymbolicLinkName returned in the notification structure is a
plug and play device interface path, not the LPT name for the
device. the device interface path is a symbolic link to the device
stack for the parallel port device, and is preferred because it is
independent of whatever legacy DosDevices LPT symbolic link
name the device is currently assigned.

the device interface symbolic link name begins with the \?? prefix,
but your driver shouldn't need to worry about that; just know that
the string as a fully qualified object manager path which you can use
to access the device in calls such as IoGetDeviceObjectPointer or
ZwCreateFile.

hope this helps,
jim.

"ben" <b...@gmx.com> wrote in message news:3dea84aa$0$342$a961...@news.cityweb.de...

ben

unread,
Dec 3, 2002, 10:19:52 AM12/3/02
to
Many Thanks!


0 new messages