Is there any difference between win 2000 and win nt4 to open a serial port??

Discussion in 'Windows Vista Drivers' started by rain, Dec 15, 2003.

  1. rain

    rain Guest

    I have got a driver for nonpnp serial device on WIN NT4,the way the driver
    opens serial port looks like this:
    (1)use IoCreateDevice () to build my driver's Fdo,
    (2)Use IogetDeviceObjectPointer() to get the Fdo of the lower driver
    ,namely,serial.sys
    (3)use IoAttacheDeviceTodeviceStack() to combine the fdos together.
    It does works!!!!!!!!!
    in win 2000,however,this way does not seem to be valid.
    With SoftICE ,I found the function IoGetDeviceObjectPointer()'s last
    variable,namely deviceObject, becomes a Fdo of Serenum.sys,not the Fdo of
    Serial.sys,But what I want is the latter,any way to get the Fdo of
    Serial.sys??

    thanks in advance.
    NTSTATUS
    IoGetDeviceObjectPointer(
    IN PUNICODE_STRING ObjectName,
    IN ACCESS_MASK DesiredAccess,
    OUT PFILE_OBJECT *FileObject,
    OUT PDEVICE_OBJECT *DeviceObject
    );
     
    rain, Dec 15, 2003
    #1
    1. Advertisements

  2. rain

    matt Guest

    I think serial.sys on NT4 (which used to do its own
    enumeration) got broken into serenum and serial for NT5.

    For each device serenum finds it calls AddDevice (or is it
    AttachDevice) in serial.sys.

    Without digging into it further I can't give you details
    but I think you will have to work with both serenum and
    serial.

    ATB

    Matt

    IoGetDeviceObjectPointer()'s last
     
    matt, Dec 16, 2003
    #2
    1. Advertisements

  3. once you have successfully called IoGetDeviceObjectPointer you have opened
    up the serial stack for exclusive use. Once you have exclusive use there is
    no need to attach to the device with IoAttachDeviceToDeviceStack. when you
    open the serial stack in win2k and beyond, you get the top of the stack,
    which is serenum. serenum passes through all requests to serial, it is not
    a problem.

    d
     
    Doron Holan [MS], Dec 16, 2003
    #3
    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.