Hi All,
I have a WDM function driver which loads firmware to hardware. The driver assumes that the path to the firmware file is at C:\ProgramFiles\Broadcom\XXXX\fw.bin. This will fail if the installation is at D: or somewhere else.
I need to know the path to the firmware file in the driver. Our installation script will always install at a fixed location in Program Files folder but I need to know where the Program Files folder is present.
One approach I can think of is that the installation script can put the path in the driver’s service Registry Key which driver gets in its driver entry.
Is this the right way to do this??
Any pointers are highly appreciated.
– Aj.
Do not rely on program files in a driver. I would place the file down somewhere in %windir% (accessible via \SystemRoot)
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Ajitabh Saxena
Sent: Thursday, December 17, 2009 12:45 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Getting Path in the WDM driver.
Hi All,
I have a WDM function driver which loads firmware to hardware. The driver assumes that the path to the firmware file is at C:\ProgramFiles\Broadcom\XXXX\fw.bin. This will fail if the installation is at D: or somewhere else.
I need to know the path to the firmware file in the driver. Our installation script will always install at a fixed location in Program Files folder but I need to know where the Program Files folder is present.
One approach I can think of is that the installation script can put the path in the driver’s service Registry Key which driver gets in its driver entry.
Is this the right way to do this??
Any pointers are highly appreciated.
– Aj.
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
Ajitabh Saxena wrote:
Hi All,
I have a WDM function driver which loads firmware to hardware. The driver assumes that the path to the firmware file is at C:\ProgramFiles\Broadcom\XXXX\fw.bin. This will fail if the installation is at D: or somewhere else.
Right, which is why that’s a very poor choice. Also, the name “Program
Files” is localized; in other countries, it has a different name.
I need to know the path to the firmware file in the driver. Our installation script will always install at a fixed location in Program Files folder but I need to know where the Program Files folder is present.
One approach I can think of is that the installation script can put the path in the driver’s service Registry Key which driver gets in its driver entry.
Is this the right way to do this??
No. In my view, the right way is to copy the firmware file into
C:\windows\system32\drivers alongside the driver binary. That’s where
your driver-critical files belong. Such a file can be opened from your
driver using \SystemRoot\System32\Drivers without having to know
anything about drive letters.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
Thank you guys.
Really appreciate the help.
– Ajitabh.
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Thursday, December 17, 2009 1:04 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Getting Path in the WDM driver.
Ajitabh Saxena wrote:
Hi All,
I have a WDM function driver which loads firmware to hardware. The driver assumes that the path to the firmware file is at C:\ProgramFiles\Broadcom\XXXX\fw.bin. This will fail if the installation is at D: or somewhere else.
Right, which is why that’s a very poor choice. Also, the name “Program
Files” is localized; in other countries, it has a different name.
I need to know the path to the firmware file in the driver. Our installation script will always install at a fixed location in Program Files folder but I need to know where the Program Files folder is present.
One approach I can think of is that the installation script can put the path in the driver’s service Registry Key which driver gets in its driver entry.
Is this the right way to do this??
No. In my view, the right way is to copy the firmware file into
C:\windows\system32\drivers alongside the driver binary. That’s where
your driver-critical files belong. Such a file can be opened from your
driver using \SystemRoot\System32\Drivers without having to know
anything about drive letters.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
Or put the firmware image in the registry, in a key under your driver…
Peter
OSR
Putting fw in c:\Program Files IMHO is a very bad idea.
Personally, I would either include the fw in a header file or in the resource section of the PE file so that the fw is always accessible as long as your driverentry is callable. You only have your .sys to worry about. It avoids problems with registry corruption, file system corruption such that the .sys is ok(loadable) but your fw.bin is corrupted.
Calvin Guan
Broadcom Corp.
Connecting Everything(r)
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Ajitabh Saxena
Sent: Thursday, December 17, 2009 12:45 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Getting Path in the WDM driver.
Hi All,
I have a WDM function driver which loads firmware to hardware. The driver assumes that the path to the firmware file is at C:\ProgramFiles\Broadcom\XXXX\fw.bin. This will fail if the installation is at D: or somewhere else.
I need to know the path to the firmware file in the driver. Our installation script will always install at a fixed location in Program Files folder but I need to know where the Program Files folder is present.
One approach I can think of is that the installation script can put the path in the driver’s service Registry Key which driver gets in its driver entry.
Is this the right way to do this??
Any pointers are highly appreciated.
– Aj.
Problem with the fw as a resource or header is that you have to resign the binary if the fw file changes which is esp a pia on 64 bit where you cannot get away with not signing. If it is a file you load, changes to the fw may effect the cat signing for the entire package, but not necessarily for the sys file itself
d
-----Original Message-----
From: Calvin Guan (Business Guest)
Sent: Thursday, December 17, 2009 7:04 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Getting Path in the WDM driver.
Putting fw in c:\Program Files IMHO is a very bad idea.
Personally, I would either include the fw in a header file or in the resource section of the PE file so that the fw is always accessible as long as your driverentry is callable. You only have your .sys to worry about. It avoids problems with registry corruption, file system corruption such that the .sys is ok(loadable) but your fw.bin is corrupted.
Calvin Guan
Broadcom Corp.
Connecting Everything(r)
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Ajitabh Saxena
Sent: Thursday, December 17, 2009 12:45 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Getting Path in the WDM driver.
Hi All,
I have a WDM function driver which loads firmware to hardware. The driver assumes that the path to the firmware file is at C:\ProgramFiles\Broadcom\XXXX\fw.bin. This will fail if the installation is at D: or somewhere else.
I need to know the path to the firmware file in the driver. Our installation script will always install at a fixed location in Program Files folder but I need to know where the Program Files folder is present.
One approach I can think of is that the installation script can put the path in the driver’s service Registry Key which driver gets in its driver entry.
Is this the right way to do this??
Any pointers are highly appreciated.
– Aj.
—
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>I need to know the path to the firmware file in the driver. Our installation script will always install at a
fixed location in Program Files folder but I need to know where the Program Files folder is present.
Use %SystemRoot% env var, it points at \Windows directory with the correct drive letter - forget Program Files, the firmware file is a part of the driver and should be in system32\drivers.
Then, in the driver, use the hard-coded pathname of \SystemRoot\system32\drivers\firmware.bin
–
Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com