Thanks for the quick response, Tim.
Would you mind showing us your code and your INF file? There are a lot
of details to get right.
My inf file:
;
; CIP.inf
;
[Version]
Signature=“$WINDOWS NT$”
Class= Contone Image Processing
ClassGuid={4C4950D7-610E-41E5-B07C-1F46C37B6D82}
Provider=%ManufacturerName%
CatalogFile=CIP.cat
[DestinationDirs]
DefaultDestDir = 12
; ================= Class section =====================
[ClassInstall32]
Addreg=CIPClassReg
[CIPClassReg]
HKR,0,%ClassName%
HKR,Icon,-5
[SourceDisksNames]
1 = %DiskName%,“”
[SourceDisksFiles]
CIP.sys = 1,
;*****************************************
; Install Section
;*****************************************
[Manufacturer]
%ManufacturerName%=Standard,NT$ARCH$
[Standard.NT$ARCH$]
%CIP.DeviceDesc%=CIP_Device, PCI\VEN_10C5&DEV_0145&SUBSYS_014510C5&REV_01
[CIP_Device.NT]
CopyFiles=Drivers_Dir
[Drivers_Dir]
CIP.sys
;-------------- Service installation
[CIP_Device.NT.Services]
AddService = CIP,%SPSVCINST_ASSOCSERVICE%, CIP_Service_Inst
; -------------- CIP driver install sections
[CIP_Service_Inst]
DisplayName = %CIP.SVCDESC%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\CIP.sys
LoadOrderGroup = Extended Base
;
;— CIP_Device Coinstaller installation ------
;
[DestinationDirs]
CIP_Device_CoInstaller_CopyFiles = 11
[CIP_Device.NT.CoInstallers]
AddReg=CIP_Device_CoInstaller_AddReg
CopyFiles=CIP_Device_CoInstaller_CopyFiles
[CIP_Device_CoInstaller_AddReg]
HKR,CoInstallers32,0x00010000,
“WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll,WdfCoInstaller”
[CIP_Device_CoInstaller_CopyFiles]
WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll
[SourceDisksFiles]
WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll=1 ; make sure the number
matches with SourceDisksNames
[CIP_Device.NT.Wdf]
KmdfService = CIP, CIP_wdfsect
[CIP_wdfsect]
KmdfLibraryVersion = $KMDFVERSION$
[Strings]
SPSVCINST_ASSOCSERVICE= 0x00000002
ManufacturerName=“Xerox Corporation”
ClassName=“Contone Image Processor”
DiskName = “CIP Installation Disk”
CIP.DeviceDesc = “CIP Device”
CIP.SVCDESC = “CIP Service”
My source:
#include “vipimagedrv.h”
#ifdef ALLOC_PRAGMA
#pragma alloc_text(INIT, DriverEntry)
#pragma alloc_text(PAGE, CipDeviceAdd)
#endif
NTSTATUS DriverEntry(In PDRIVER_OBJECT driverObject, In
PUNICODE_STRING registryPath)
{
NTSTATUS status;
WDF_DRIVER_CONFIG config;
KdPrintEx((DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, “vipimagedrv:
DriverEntry\n”));
WDF_DRIVER_CONFIG_INIT(&config, CipDeviceAdd);
status = WdfDriverCreate(driverObject, registryPath,
WDF_NO_OBJECT_ATTRIBUTES, &config, WDF_NO_HANDLE);
if (!NT_SUCCESS(status))
{
KdPrintEx((DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, “vipimagedrv:
***Error*** WdfDriverCreate Failed: 0x%x”, status));
return status;
}
KdPrintEx((DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, “vipimagedrv:
WdfDriverCreated success”));
return status;
}
NTSTATUS CipDeviceAdd(In WDFDRIVER driver, Inout PWDFDEVICE_INIT deviceInit)
{
NTSTATUS status;
PCIP_DATA cipData;
WDFDEVICE cipDevice;
WDF_OBJECT_ATTRIBUTES cipAttributes;
UNREFERENCED_PARAMETER(driver);
PAGED_CODE();
KdPrint((“vipimagedrv: CipDeviceAdd”));
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&cipAttributes, CIP_DATA);
status = WdfDeviceCreate(&deviceInit, &cipAttributes, &cipDevice);
if (!NT_SUCCESS(status))
{
KdPrint((“vipimagedrv: ***Error*** WdfDeviceCreate failed: 0x%x”, status));
return status;
}
cipData = CIPGetData(cipDevice);
status = WdfDeviceCreateDeviceInterface(cipDevice,
(LPGUID)&GUID_CIPDEVICE, NULL);
if (!NT_SUCCESS(status))
{
KdPrint((“vipimagedrv: ***Error*** WdfDeviceCreateDeviceInterface
failed: 0x%x”, status));
return status;
}
return status;
}
vipimagedrv.h
#ifndef VIPIMAGEDRV_H
#define VIPIMAGEDRV_H
#include <ntddk.h>
#include <wdf.h>
#include “Public.h”
DRIVER_INITIALIZE DriverEntry;
EVT_WDF_DRIVER_DEVICE_ADD CipDeviceAdd;
typedef struct _CIP_DATA
{
int x;
} CIP_DATA, PCIP_DATA;
WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(CIP_DATA, CIPGetData)
#endif / VIPIMAGEDRV_H */
22?? How many processor cores do you have in this machine?
It’s a pretty beefy system. It’s has duel Intel Xeon E5-2687W CPUs. 10
hyperthreaded cores for each CPU.
Your driver has already been unloaded. The log buffer for a driver is
> cleaned up when the driver unloads. You would have to set a breakpoint
> at the end of DriverEntry to catch the log before it clears out.
I was stepping through the code and ran the dump command immediately after
it called on WdfDriverCreate. It should have still been loaded at that
point, right?
by chance, turned on Driver Verifier with the “low pool
> simulation”, have you?
It was turned on but low pool simulation was not. I turned it off and
deployed it again but the driver still resulted in an error.
I’ll take a look at the source and trace through it to see who returns this
particular error.
On Thu, Jul 14, 2016 at 10:42 AM, Tim Roberts wrote:
> xxxxx@gmail.com wrote:
> > I have a fairly barebones kmdf project setup with WDK 8.1. The only
> thing my driver currently has at the moment is the DriverEntry function and
> a device add function. This driver is to talk to two custom PCIe devices
> and I have setup the .inf file to reference the hardware id of the boards.
> > The driver deploys through visual studio, installs on the target system,
> and “attaches” (if that is the right word) to my two PCIe devices, but the
> device is in an error state. Looking at the log statements that my driver
> outputs, it states that WdfDriverCreate fails with a status of 0xC000009A,
> which looks to mean “Insufficient Resources”.
>
> Would you mind showing us your code and your INF file? There are a lot
> of details to get right.
>
> I suppose at some point I’ll have to try “deploy through Visual
> Studio”. I’ve always been afraid to try that, because I give up so much
> control.
>
>
> > So I went to debug the driver and run this !wdfkd.wdflogdump command to
> get more information.
> >
> > I believe the symbol paths are setup correctly:
> > 22: kd> .sympath
>
> 22?? How many processor cores do you have in this machine?
>
>
>
> > Trying to extract TMF information from -
> c:\winsymbols\Wdf01000.pdb\03FC6AA4329F4372BE924775887225632\Wdf01000.pdb
> > Log at 0xfffffa8036b60cf8
> > Gather log: Please wait, this may take a moment (reading 0 bytes).
> > % read so far …
> > warn: The log could not be accessed
> > hint: Are the symbols the WDF library available?
> > hint: The log is inaccessable after driver unload.
> >
> >
> > So I have two questions:
> > 1) How can I setup windbg correctly so I can dump logs after the point
> of failure?
>
> Your driver has already been unloaded. The log buffer for a driver is
> cleaned up when the driver unloads. You would have to set a breakpoint
> at the end of DriverEntry to catch the log before it clears out.
>
>
> > 2) What would cause WdfDriverCreate to fail with an Insufficent
> Resources error? The documentation for the WdfDriverCreate function doesn’t
> make any mention of that error code although it doesn’t give an explicit
> list of potential error codes other than what it might return.
>
> KMDF is open source, so you can download the source if you want.
> WdfDriverCreate itself only returns that error if its (very small)
> memory allocation fails, but it calls a number of APIs and forwards
> their return codes, so it could have come from another function. You
> haven’t, by chance, turned on Driver Verifier with the “low pool
> simulation”, have you? That causes memory allocations to fail randomly,
> and should not be used for production testing.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list online at: <
> http://www.osronline.com/showlists.cfm?list=ntdev>
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and
> software drivers!
> Details at http:
>
> To unsubscribe, visit the List Server section of OSR Online at <
> http://www.osronline.com/page.cfm?name=ListServer>
></http:></wdf.h></ntddk.h>