Programmatically setting a registry key in "other driver's" hardware key

Discussion in 'Windows Vista Drivers' started by Spiro Trikaliotis, Oct 6, 2004.

  1. Hello,

    I need a way to programmatically set a registry key in a foreign
    driver's hardware registry key.

    for a parallel port. On W2K and later, this IOCTL fails if
    Parameters\EnableConnectInterruptIoctl is not set to 1 (or PNP0400\...
    in case of a non-ECP parallel port)

    Until now (development), I'm setting this value by hand. Anyway, for
    production, I want to change this setting programmatically.

    Unfortunately, I found some more sophisticated parallel port cards do
    not have a hardware key on ACPI\PNP040x, but on
    HKLM/..../MF/PCI#VEN_131F&......./*/Device Parameters
    HKLM\SYSTEM\CurrentControlSet\Enum\VSCOMBUS\BUS_0000&DEV_000B&FUN_0000\0000\Device Parameters
    HKLM\SYSTEM\CurrentControlSet\Enum\VSCOMBUS\BUS_0000&DEV_000B&FUN_0000\0001\Device Parameters

    Now, I ask myself how I could find out programmatically where these are
    located? I have searched the DDK Help, but I have not been able to find
    the appropriate call. I thought about IoGetDeviceProperty(), but it does
    not seem to help me (or I am totally overlooking something). I found a
    function to return the service (software) key. There, on
    HKLM\SYSTEM\Currentcontrolset\services\parport\enum\0, I found
    ACPI\PNP0400\5&324d5432&0 (for example). Is this what I am searching
    for, that is, append this to HKLM\System\CurrentControlSet\Enum? Or do I
    have to use another interface?

    Any input is appreciated,
    Spiro Trikaliotis, Oct 6, 2004
    1. Advertisements

  2. open up the port you want to send the IOCTL to. send it a PIRP with
    IRP_MN_QUERY_DEVICE_RELATIONS / TargetDeviceRelations. This will give you
    the PDO for that stack. You can then use IoOpenDeviceRegistryKey and set
    the value

    beware of wrap. also, i don't know if the LPT driver inspects this value
    when the IOCTL is sent or when the stack is initially started. If it is
    when it is initially started, you will need to disable and then reenable the
    stack (which you can only do from user mode).

    Doron Holan [MS], Oct 6, 2004
    1. Advertisements

  3. Hello Doron,


    Thank you for your explanation, I will try and report if I had success.

    As I have changed this registry value by hand more than once ;-) I found
    out that it is checked on each IOCTL, so this is not a problem.

    Thank you very much!

    Spiro Trikaliotis, Oct 6, 2004
  4. Hello Doron,

    Thanks, this works like a charm!

    Spiro Trikaliotis, Oct 15, 2004
  5. Hello,

    Well, setting the registry key works, but I totally forgot that I have
    to do an additional element:

    I do not only have to set EnableConnectInterruptIoctl :DWORD to 1, but I
    have also to mimic what is done when a user lets the parallel port
    driver use an interrupt in the device manager. I found out that it
    essentially sets FilterResourceMethod :DWORD to 2. Unfortunately, the
    driver does not recognize this until a reboot is done, while it does
    accept it immediately when this is changed in the device manager.

    So, my question is: Can I mimic this? I think I have to let the bus
    driver reenumerate the device, this, that it is initialized again. I
    thought I could do this with IoInvalidateDeviceRelations(), but this
    does not work.

    Can anyone give me any hints? It does not matter if this solution is
    from user or from kernel mode, anything is highly appreciated. ;-)

    Spiro Trikaliotis, Oct 15, 2004
  6. if you can do this in user mode, look at the devcon example for disable and
    then reenabling. it could be the property page is sending a
    DIF_PROPERTY_CHANGED which i think tears down and builds upt he stack again.

    Doron Holan [MS], Oct 16, 2004
  7. Hello,

    I completely forgot to mention: Your hint was very good, it works as
    expected with DIF_PROPERTY_CHANGED.

    Thank you,
    Spiro Trikaliotis, Oct 27, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.