SysWOW64 redirection during inf install

I have a c# installer. It runs a .inf file to install a filesystem driver at some point during the install. It does a quick check to see if we are 64bit or 32bit and then picks the right driver version to use.

On 32 bit all works as expected. on 64 bit, the .sys file is placed in SysWOW64\drivers, but the binary location for the driver (as told by “sc qc”) is in System32\driver. The driver used is definitely the 64 bit version when installing on 64 bit machine, just directed into the wrong folder.

Whats the best way to get this driver to go to the correct location on a 64 bit machine? Namely, System32\drivers. Is there a way to handle this in the inf, or is it something else?

Thanks for any feedback -
Chris

Is the c# compiled as cpuany? IIRC, on 64 bit, you still run as 32 bit code . You can not install 64bit drivers with a 32 bit app

d

debt from my phone

-----Original Message-----
From: xxxxx@gmail.com
Sent: Sunday, August 21, 2011 6:48 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] SysWOW64 redirection during inf install

I have a c# installer. It runs a .inf file to install a filesystem driver at some point during the install. It does a quick check to see if we are 64bit or 32bit and then picks the right driver version to use.

On 32 bit all works as expected. on 64 bit, the .sys file is placed in SysWOW64\drivers, but the binary location for the driver (as told by “sc qc”) is in System32\driver. The driver used is definitely the 64 bit version when installing on 64 bit machine, just directed into the wrong folder.

Whats the best way to get this driver to go to the correct location on a 64 bit machine? Namely, System32\drivers. Is there a way to handle this in the inf, or is it something else?

Thanks for any feedback -
Chris


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

Thanks for the response, it was compiled as cpu any. I’ll try it as a x64 bit compilation.

I am sure the answer is no… but - is it safe to simply copy the file from %windir%\SysWOW64\drivers to %windir%\System32\drivers? If I do this manually, it all works fine. And then do the clean up manually in the uninstall as well?

Best -
Chris

Seems quite fragile to me to have those manual steps instead of things behaving properly

d

debt from my phone

-----Original Message-----
From: xxxxx@gmail.com
Sent: Monday, August 22, 2011 9:01 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] SysWOW64 redirection during inf install

Thanks for the response, it was compiled as cpu any. I’ll try it as a x64 bit compilation.

I am sure the answer is no… but - is it safe to simply copy the file from %windir%\SysWOW64\drivers to %windir%\System32\drivers? If I do this manually, it all works fine. And then do the clean up manually in the uninstall as well?

Best -
Chris


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

Better run your install code as 64bit.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> Thanks for the response, it was compiled as cpu any. I’ll try it as a x64 bit compilation.
>
> I am sure the answer is no… but - is it safe to simply copy the file from %windir%\SysWOW64\drivers to %windir%\System32\drivers? If I do this manually, it all works fine. And then do the clean up manually in the uninstall as well?
>
> Best -
> Chris
>

Maxim S. Shatskih wrote:

Better run your install code as 64bit

Or learn about the magic Wow64DisableWow64FsRedirection API.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

> Or learn about the magic Wow64DisableWow64FsRedirection API.

32bit install code on 64bit OS, for me, is so large a can of worms so I would not ever use it.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

Having recently been bitten by the pitfalls of a 32bit installer in a 64bit
world, I heartily agree.

Mark Roddy

On Tue, Aug 23, 2011 at 4:07 AM, Maxim S. Shatskih
wrote:

> > Or learn about the magic Wow64DisableWow64FsRedirection API.
>
> 32bit install code on 64bit OS, for me, is so large a can of worms so I
> would not ever use it.
>
> –
> Maxim S. Shatskih
> Windows DDK MVP
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> —
> 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
>

Thanks for all the feedback - two installers it is!

Maxim S. Shatskih wrote:

> Or learn about the magic Wow64DisableWow64FsRedirection API.
32bit install code on 64bit OS, for me, is so large a can of worms so I would not ever use it.

The rules are just not that hard to grasp. I do all of my driver
packages as a single package with a single 32-bit installer.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

The screw case I ran into involved Regsvr32 - getting a 32bit app to
successfully invoke the appropriate dll registration tool seemed way more
difficult to accomplish than it should be, and in fact I found a far easier
method: don’t do that, use a 64bit process to do it instead. Drivers install
just fine.

Mark Roddy

On Tue, Aug 23, 2011 at 12:06 PM, Tim Roberts wrote:

> Maxim S. Shatskih wrote:
> >> Or learn about the magic Wow64DisableWow64FsRedirection API.
> > 32bit install code on 64bit OS, for me, is so large a can of worms so I
> would not ever use it.
>
> The rules are just not that hard to grasp. I do all of my driver
> packages as a single package with a single 32-bit installer.
>
> –
> 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
>

32 bit installers on 64 bit systems can use the sysnative virtual directory
to access the real system32 directory. For example,
%windir%\sysnative\regsrv32 will run the 64 bit version.

Bill Wandel

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mark Roddy
Sent: Tuesday, August 23, 2011 1:15 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] SysWOW64 redirection during inf install

The screw case I ran into involved Regsvr32 - getting a 32bit app to
successfully invoke the appropriate dll registration tool seemed way more
difficult to accomplish than it should be, and in fact I found a far easier
method: don’t do that, use a 64bit process to do it instead. Drivers install
just fine.

Mark Roddy

On Tue, Aug 23, 2011 at 12:06 PM, Tim Roberts wrote:

Maxim S. Shatskih wrote:
>> Or learn about the magic Wow64DisableWow64FsRedirection API.
> 32bit install code on 64bit OS, for me, is so large a can of worms so I
would not ever use it.

The rules are just not that hard to grasp. I do all of my driver
packages as a single package with a single 32-bit installer.


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

— 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

Bill Wandel wrote:

32 bit installers on 64 bit systems can use the sysnative virtual
directory to access the real system32 directory. For example,
%windir%\sysnative\regsrv32 will run the 64 bit version.

Fascinating. I’ve been doing 32/64 bit stuff for 7 years, and this is
the first time I’ve ever seen that abomination mentioned. Sure enough,
it works.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

> The rules are just not that hard to grasp. I do all of my driver

packages as a single package with a single 32-bit installer.

So, disabling FS redirection is enough for 32bit setupapi.dll to work on 64bit OS?


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

> Fascinating. I’ve been doing 32/64 bit stuff for 7 years, and this is

the first time I’ve ever seen that abomination mentioned.

Me too. BTW, it is documented:

http://msdn.microsoft.com/en-us/library/aa384187(v=vs.85).aspx

it works.

Too bad there is no “sysnative” for 64bit code on 64bit OS.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

Maxim S. Shatskih wrote:

> The rules are just not that hard to grasp. I do all of my driver
> packages as a single package with a single 32-bit installer.
So, disabling FS redirection is enough for 32bit setupapi.dll to work on 64bit OS?

Not entirely, and that’s a good point that I will have to concede. My
32-bit installer copies files into place, but then uses DPInst to do the
setupapi work.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

On Tue, Aug 23, 2011 at 2:38 PM, Tim Roberts wrote:

> Maxim S. Shatskih wrote:
> >> The rules are just not that hard to grasp. I do all of my driver
> >> packages as a single package with a single 32-bit installer.
> > So, disabling FS redirection is enough for 32bit setupapi.dll to work on
> 64bit OS?
>
> Not entirely, and that’s a good point that I will have to concede. My
> 32-bit installer copies files into place, but then uses DPInst to do the
> setupapi work.
>
> That’s what works for me as well, and is what also lulled me into a false
sense of security with respect to other, primarily user mode, install
issues.

It isn’t that the rules are hard to grasp, it is that ‘install’ for drivers
frequently covers drivers, services, applications, associated dlls of all
flavors etc. and has to work across multiple versions of the OS and
different bittedness. Driver installers can end up being just about as
complicated an installation process as there is, other than installing an
OS.

Mark Roddy