why AddDevice not called??gloomy&help me

Discussion in 'Windows Vista Drivers' started by Calvin Guan, Feb 16, 2004.

  1. Calvin Guan

    Calvin Guan Guest

    in my DriverEntry,

    You must fully support PNP in your driver.
    -
    Calvin Guan Software Engineer
    ATI Technologies Inc. www.ati.com
     
    Calvin Guan, Feb 16, 2004
    #1
    1. Advertisements

  2. 1) add support for irp_mj_pnp/power (no small task)
    2) you need to install a device node for your device, adding yourself under
    services is not enough anymore. see the devcon example on how to create a
    root enumerated device (which is what your device is)

    d
     
    Doron Holan [MS], Feb 16, 2004
    #2
    1. Advertisements

  3. Calvin Guan

    jia Guest

    hello everyone:)
    I have a serial smart card reader and the driver for it under nt4 ,now i
    want to migrate it to win2k.
    besides:The reader doesn't have a pnp id.
    so i think i have to install my driver as legacy driver.

    I did the following things:
    in the regeisty,under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services,i
    register the service key of my driver,eg AGSSerial,
    filled the following valuse:Type ,Start,ErrorControl,ImagePath.


    in my DriverEntry,
    NTSTATUS
    DriverEntry(
    IN PDRIVER_OBJECT DriverObject,
    IN PUNICODE_STRING RegistryPath
    )
    {
    // Initialize the Driver Object with driver's entry points
    DriverObject->MajorFunction[IRP_MJ_CREATE] = AGSCreate;
    pDriverObject->MajorFunction[IRP_MJ_CLOSE] = AGSClose;
    pDriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = AGSDeviceControl;
    pDriverObject->DriverUnload = DriverUnload;
    DriverObject->DriverExtension->AddDevice = AddDevice;
    ....
    ....
    }

    hower,the AddDevice is never called.why this happens?
    what thing else I have to do???

    can anyone help me??
    thank u very much:)
     
    jia, Feb 17, 2004
    #3
  4. Calvin Guan

    Feng Jing Guest

    I have the same problem. Do you get any solution


     
    Feng Jing, Feb 17, 2004
    #4
  5. get a new DDK, it is in there

    --
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Please reply to newsgroups only.

     
    Doron Holan [MS], Feb 18, 2004
    #5
  6. modify an example smart card INF, you will have more usable reusable pieces
    there.

    --
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Please reply to newsgroups only.

     
    Doron Holan [MS], Feb 18, 2004
    #6
  7. Calvin Guan

    laudraup Guest

    Dear Calvin:
    thank u so much.further more:
    what do u mean by saying "fully support PnP"?
    u mean ,I should support: IRP_MJ_POWER & IRP_MJ-PNP?
    But,the problem is ,even the AddDevice is not called.
    futher more ,the reader's power is provider by an external power supply.
    in this case ,shall we still need support IRP_MJ_POWER & IRP_MJ-PNP??
    Waiting for ur reply:)

     
    laudraup, Feb 18, 2004
    #7
  8. Calvin Guan

    laudraup Guest

    Dear Doron:
    thank u for ur help.

    I had go to the website
    http://www.osr.com/ddk/ddtools/devcon_86er.htm#ddk_example_33_install_a_devi
    ce_tools,
    but not quiet clear what's the meaning of "install a device node for your
    device".
    Just modify an inf file like the belowing is enough??
    .............................................................................
    .............
    Example 33: Install a device
    The following command uses the DevCon Install operation to install a
    keyboard device on the local computer. The command includes the full path to
    the INF file for the device (keyboard.inf) and a hardware ID (*PNP030b).


    devcon /r install c:\windows\inf\keyboard.inf *PNP030b
    .............................................................

    and then i had to install the driver with "Add\Remove Hardware "wizard??
    waiting for u reply:)

     
    laudraup, Feb 18, 2004
    #8
  9. Calvin Guan

    laudraup Guest

    no,i am wonding where can i download devcon.exe?I can't find it in my
    2000ddk :(
     
    laudraup, Feb 18, 2004
    #9
  10. AddDevice is a pnp concept. you cannot blindly succeed pnp and power irps,
    you must follow (the somewhat complicated) rules or thins will not work. i
    don't think you can write a ps/sc driver that is a legacy driver. you need
    to get walter oney's book and the latest DDK and do some reading.

    d
     
    Doron Holan [MS], Feb 20, 2004
    #10
  11. Calvin Guan

    laudraup Guest

    Great thanks to Doron Holan:
    I have more questions to consult u,wishing for u help.:)
    .............................................................................
    ....................

    Description about my smart card reader:
    Serial &non_pnp,I have to develop the driver for it under win2k.
    .............................................................................
    .....................
    Lack of such experience,I have several questions to ask .
    1:I think i have to install it as legacy device.Am i right?

    2:Should i develop the driver according to WDM model?What do u mean by
    saying
    fully support pnp&power?I don't think i should handle the irps,or should I
    just return
    status_success?

    3:About how to install the device?
    Should i offer the Inf file together with the sys file?
    then use Add HardWare wizard to install it??
    Do u mean if i install it this way,AddDevice would be called??
    Really not very clear,Wishing for ur help:)

    Now ,i can see my device in hidden devices of the device manager,but
    ,however,it doesn't work:(

    .............................................................................
    .........................
    this is what my driverentry did.

    NTSTATUS DriverEntry (
    IN PDRIVER_OBJECT pDriverObject,
    IN PUNICODE_STRING pRegistryPath )
    {

    ULONG ulDeviceNumber = 0;
    NTSTATUS status = STATUS_SUCCESS;
    PDEVICE_OBJECT Fdo = NULL;

    // I call AddDevice in this way
    Fdo = AddDevice(pDriverObject,pRegistryPath);

    file://in this case ,AddDevice wouldn't be called.Whhhy???
    file://In what way shall the system call AddDevice????
    // Announce the PNP AddDevice entry point
    file://pDriverObject->DriverExtension->AddDevice = AddDevice;

    if(Fdo != NULL)
    {
    pDriverObject->MajorFunction[IRP_MJ_CREATE] = AGSCreate;
    pDriverObject->MajorFunction[IRP_MJ_CLOSE] = AGSClose;
    pDriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = AGSDeviceControl;
    pDriverObject->DriverUnload = DriverUnload;
    pDriverObject->MajorFunction[IRP_MJ_PNP] = DispPnp;
    pDriverObject->MajorFunction[IRP_MJ_POWER] = DispPower;
    }


    return status;
    }
     
    laudraup, Feb 20, 2004
    #11
    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.