Link to home
Start Free TrialLog in
Avatar of bhanuj
bhanuj

asked on

INT File being Rejested, Application CreateFile() Call fails when trying to access the driver.

Hi Guys,

I am completely new windows drivers.
I have been doing Linux/RTOS drivers extensively but NOT windows until now. So, I read some docs extensively from MSDN about WDK before coming here.

I am trying to debug a Windows Vista Firewall (FE)driver written by someone else.

About the driver:
Ther driver is a simple IOCTL based drivers, NO Read, NO Write.  
He just registers the driver and IOCTL only. He also create a queue.
The driver is designed to support Vista 32-bit OS. I am testing in on the same.
Also it is a non-pnp driver. It does not have the AddDevice Call implemented. Everything is done just in the DriverEntry Call.

Problem 1:
Application CreateFile() call fails with Error "2", which means "There is no file present". (In Linux we see thios error if the driver is NOT loaded properly/failed at open time.)
So, I started reading the code and found problem 2. below.
 
Problem 2:
With What I read, I think this is a Device Installation Application type of loading a driver. link below.
     http://msdn.microsoft.com/en-us/library/dd419816.aspx

It is a Firewall client Application.
When I look into the code, I see that the application tries to find the waclient.sys driver in the system32/drivers folder.  And if it is NOT present, it gets the driver data which is embedded within the application with FindResource, LoadResouce Calls.
Then it creates a waclient.sys and copies the data into it.
Thats it.
 
They do nothing after it. Will the load the driver. I doubt what they do?
What else is needed in this case to load the driver??
 
Problem 3:
Understaing that there is a problem above, I wanted to try to load the driver manually "New Hardware" Wizard.
With What I have read from doc in the link below
http://www.microsoft.com/whdc/driver/wdf/KMDF-build.mspx

The driver code does not have a INX in it. So, not INF file is generated. So, I wrote a simple (may be completely wrong)  INF file by seeing the docs in the link below.
 
I created a directory on my "E:\test_drv", copied the
    waclient.sys file (checked build),
    waclient.inf (written by me)
    and the C:\WinDDK\6001.18002\redist\wdf\x86\WdfCoInstaller01007.
 
Ran the Windows New Hardware Wizard and point it to that Directory. It said
"The folder you specified does't contain a compatible software driver for your device.
  If the folder contains a driver, make sure it is designed to work with Windows for 32-bit systems."
 
What is wrong in my INF file that it comes with this message?
 
I might be missing some information you need. Please ask me. Am I missing anything. What else am I required to do to load the driver on my test system.
 
- Mukund Jampala
 

INT FILE
----------
[DestinationDirs]
waclientClassInstallerCopyFiles = 11
 
[waclient.NT.CoInstallers]
AddReg=waclient_CoInstaller_AddReg
CopyFiles= waclientClassInstallerCopyFiles
 
[waclient_CoInstaller_AddReg]
HKR,,CoInstallers32,0x00010007, "WdfCoInstaller01007.dll,WdfCoInstaller"
 
[waclient_CoInstaller_CopyFiles]
WdfCoInstaller01007.dll
 
[SourceDisksFiles]
WdfCoInstaller01007.dll=1 ;
 
[waclient.NT.Wdf]
KmdfService = waclient, waclient_wdfsect
[waclient_wdfsect]
KmdfLibraryVersion = 1.7

Open in new window

Avatar of DanRollins
DanRollins
Flag of United States of America image

Please show your code for the CreateFile() function call. It is most likely a simple mispelling of the filename, incorrect path, etc..
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bhanuj
bhanuj

ASKER

Thanks for the solution,
I got a direction with this help to where to go form here.
The real problem was that the driver was not being built properly and the service calls that were to used create and start service were incorrect. The create/start service fialure cases was not handled properly. Fixed these places and the App goes Kool.

Thank you