Code 38 Issue with WDF Driver on Windows 10 – Multiple INFs, Same Service

Hi everyone,
I'm running into a recurring issue (Code 38) while adapting a WDM driver for compatibility with Windows 10. To isolate the problem, I tested it with a simple WDF sample driver, but the issue persists.

Here’s the setup:
I have two .inf files:

  1. bridge.inf – Installs a driver for a bridge chip (System class).

  2. CustSerial.inf – Installs a driver for virtual serial ports (Ports class) on a UART over the local bus.

Both .inf files reference the same service name and .sys file. The installation process goes like this:

  • The bridge.inf installs without issues and enumerates the serial ports under "Other Devices" in Device Manager, as expected.

  • I then select one of the unknown devices, manually install the CustSerial.inf, and the system prompts for a reboot.

  • After rebooting, the device appears under "Ports" with the correct COMx assignment, but it shows:
    "Code 38 – Windows cannot load the device driver for this hardware because a previous instance of the driver is still in memory."

It seems the issue stems from having another instance of the driver loaded (i.e., for the bridge device). This configuration worked fine with the old WDM driver on Windows XP, but it’s failing on Windows 10. Is this approach—using the same service and .sys for two .inf files—no longer supported in modern Windows?

To rule out other factors, I tested using a simple WDM driver with distinct names (to avoid conflicts), but the same Code 38 behavior occurs.

Has anyone encountered this or have insights into what might have changed between XP and Windows 10? Any suggestions for debugging or resolving this would be appreciated!

Thanks,

To add further, as a test I made a copy of .sys file with another name and got serial inf to to load. New COMx was listed without any error.

Ideally I don't want to separate .sys(making it more complex) and hence my original question above.

The short answer is no. Before Win8 we used to process INF files like scripts so you could do a lot of stuff like this. There were a lot of problems that I don't need to get into but Win8+ the INF file is treated like a package manifest and all the files are part of/owned by the package. We're expecting that if we unload one driver package all of its files will be unloaded from memory and the other driver package is preventing this.

Is this sys file the function driver for these? Help me understand the relationship of these and maybe we can come up with a better solution

1 Like

Thank you for your response. The sys file serves as both a bus driver and a function driver.
Host -->Plx ( PCI -> local bus) -->CPLD-->UART's (multiple COM ports)

Bus Driver Role (PLX Bridge):
-Manages BAR mappings and PnP requests.
-Creates device nodes (handles query device relations etc)
-Serenum for enumeration.

Function Driver Role (Serial Ports):
-Handles serial I/O operations, including read, write, and control requests.
-Manages interrupt processing.
-Interfaces directly with UART functions for data transmission and configuration.

Thanks

I don't have a great solution for you off hand, but I'm looking into it. There are some neat ways to do this if neither INF needs to do this as a function driver, but not if only one does

1 Like