Converting system time to local time in WDM driver

Discussion in 'Windows Vista Drivers' started by Mattias, Dec 14, 2005.

  1. Mattias

    Mattias Guest


    In a WDM driver, how can I determine the current local time?
    KeQuerySystemTime() returns the time in the GMT time zone. The MSDN
    docs suggest to use ExSystemTimeToLocalTime for converting it, but that
    requires including ntddk.h, which is not accessible by WDM drivers.
    Mattias, Dec 14, 2005
    1. Advertisements

  2. Mattias

    Don Burn Guest

    Do you really need to support Windows 98 and ME in this driver? If not just
    use ntddk.h
    Don Burn, Dec 14, 2005
    1. Advertisements

  3. Mattias

    mischief Guest

    I had similar problems with MmAllocateContiguousMemorySpecifyCache.
    It's a pet peeve of mine that wdm.h and ntddk.h are allowed to diverge.

    I've not run into any trouble using ntddk.h in parts of a WDM driver. It's a
    mess, but it appears to work.
    mischief, Dec 14, 2005
  4. Mattias

    Don Burn Guest

    Comments inline:
    They aren't allowed to diverge they were designed to have wdm.h a subset of
    ntddk.h since WDM was supposed to work on the old Windows 9x/ME platforms.
    Note: that with the Vista WDK, ntddk.h has a #include for wdm.h

    If you are using ntddk.h for some modules use it for ALL MODULES! There is
    nothing magic that says a "WDM driver" is a driver with wdm.h. Note: once
    you use ntddk.h you are not going to use it on the Windows 9x/ME platform,
    other than that WDM is a label that conveys the driver is Plug and Play and
    power management aware.
    Don Burn, Dec 14, 2005
  5. Mattias

    Mattias Guest

    Do you believe this signifies a Microsoft strategy (such as, "ntddk.h
    will always be a strict superset of wdm.h") or just an implementation

    My concern, and the reason that I am using wdm.h instead of ntddk.h, is
    that future releases of Windows might become incompatible with the
    driver unless i use wdm.h. I do not need to support Win9x.
    Mattias, Dec 14, 2005
  6. Mattias

    Don Burn Guest

    They have presented multiple times that wdm.h will be #include'd into
    ntddk.h which will be #include'd into ntifs.h. They had developers spending
    a lot of time getting this right, and changing the include file model to
    have only one version of each file with conditionals for the various
    operating systems.

    It is their strategy.
    Don Burn, Dec 14, 2005
  7. don's right, it is the strategy. using ntddk.h will not make your driver
    incompatible with future versions of windows.

    Doron Holan [MS], Dec 14, 2005
    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.