[Compuware Corporation] [Compuware NuMega home page]                [NuMega Lab]
[teal]

 [DriverStudio]    [Image][Image]
   Home
 [Driver Products]        Driver Technical Tips
   DriverStudio          Using NtKernLoadDriver in Windows 98 VxDs
   DriverBundle
   Previews              Windows 98 has over 150 new services for VxD writers. Notable
   Compatibility         among them are the services of NtKern, the driver that provides
 [Downloads]             most of the Win32 Driver Model calls on Windows 98. Some of
                          NtKern's services map closely on to the ZwXxxx system calls
 Wizards                  available in WDM. For example, NtKernCreateFile, has the same 11
   Utilities             parameters as the documented service ZwCreateFile.
   NT source
 examples                 Another interesting case is NtKernLoadDriver, a service that a
   VxD source            VxD can call to cause the system to load a kernel mode driver. It
 examples                 eventually calls ZwLoadDriver, which has the following prototype:
   WDM source
 examples                 NTSTATUS __stdcall ZwLoadDriver( PUNICODE_STRING ServiceKeyPath )
 [Resources]  
 Technical papers         Note that the parameter is not a pointer to the file name.
   Useful links          Rather, it points to the path in system registry where
   Technical tips        information about the driver is stored. For example, if the
 [Support]               driver name is MyDriver, then the path passed to ZwLoadDriver
                          would be:
 Support
   Knowledge base        \Registry\Machine\System\CurrentControlSet\Services\MyDriver
   Problem
 submission               The values under this key inform the system about the driver. The
   Product               values are the same as those used in the Service Control
 registration             Manager's registry database on Windows NT. Generally, they
   Release notes         include at least the following:
 [Shop NuMega]  
 Buy it!                      Value      Typical              Purpose
   Price list                           Value
   How to buy                                    A value of 1 indicates a kernel
   Sales offices          Type            1      mode driver
                                                  2 means start at system
                           Start           2      initialization; 3 means manual
 [Y2K Compliance]                                 start
                           ImagePath              Identifies the driver file

 [More information]        DisplayName            Name of the driver as seen by
                                                  system utilties

                          One note about ImagePath. On Windows 98, the system prefixes the
                          system root directory (e.g. C:\WINDOWS\) to any path string that
                          does not begin with a backslash '\' (hex 5C). (The only exception
                          is '\systemroot', which is converted to the system root
                          directory.) What this means is that if the driver file is not
                          under the system root, you have to use the UNC name of the file
                          in order to load it, e.g.
                          \\MyComputer\C\testdriver\i386\checked\foo.sys.

                          A kernel mode driver loaded by NtKernLoadDriver can create device
                          objects in its DriverEntry routine. However, it's important to
                          remember that a driver loaded in this fashion is not a WDM
                          driver. The system will not send it any PnP or power requests,
                          and its AddDevice entry point will not be called. It bears the
                          same relationship to a WDM driver that a statically loaded VxD
                          bears to a VxD dynamically loaded by the Configuration Manager.

                          Note that there is no NtKernUnloadDriver. Unloading the driver
                          requires special techniques.

                          Back to technical tip start page.

  DriverCentral  DriverStudio  Free downloads  Resources  Support and
                          Services  Shop NuMega
     Compuware NuMega  Tel: +1 603 578-8400  Updated: 9 August 1999 
                      Problems? Contact our webmaster.
