Archive: Problem with GetDLLVersion on W2K3 Server 64 and WXP 64


Problem with GetDLLVersion on W2K3 Server 64 and WXP 64
Hi,

I'm experiencing a strange behaviour of GettDLLVersion on Windows Server 2003/Windows XP 64bit versions.

My installer installs network drivers according the OS found.
Before installing I test if I have to perform an update/repair or if the driver on the system is newer.

I do this by comparing the version numbers of the driver in the installer and on the system.
The driver to be installed is written to $APPDATA\TMP and its version is retrieved vie GetDLLVersion. Then i try to get the version from "$SYSDIR\drivers\$DriverName" also via GetDLLVersion.

This works on all OSes from W2K ...Vista64 except for W2K3 Server 64bit and XP 64 bit. On these OSes the returned value is always empty.
Even putting a ClearError before the call doesn't help.

In a very much stripped-down version of the installer GetDLLVersion works as expected.


in my .oninit function i have:


Check OS
Check for AdminAccount
Unpack driver.sys file to $AppData\TMP setting $SysName to driver.sys

GetDllVersion "$TMPDIR\$SysName" $R0 $R1
IntOp $R6 $R0 / 0x00010000
IntOp $R7 $R0 & 0x0000FFFF
IntOp $R8 $R1 / 0x00010000
IntOp $R9 $R1 & 0x0000FFFF
StrCpy $DriverVersion "$R6.$R7.$R8.$R9"
(this one works fine)

Check for installed version of the driver package in the registry
Open a log file

and then

MessageBox MB_ICONINFORMATION|MB_OK "Looking for $SYSDIR\drivers\$SysName"
ClearErrors
GetDllVersion "$SYSDIR\drivers\$SysName" $R0 $R1
MessageBox MB_ICONINFORMATION|MB_OK "Version ($SYSDIR\drivers\$SysName) = $R0 $R1"

(this one always fails on W2k3Srv/XP 64bit)
:
:


I can check the driver.sys file's version using properties|version but $R0 and $R1 are always undef after GetDllVersion...


Any hints??

First, you should use GetDLLVersionLocal instead of extracting the DLL and then using GetDLLVersion.

Next, include some more details. I can't reproduce this on Windows XP x64. If you can attach the DLL itself, it'd be best.


Originally posted by kichik
First, you should use GetDLLVersionLocal instead of extracting the DLL and then using GetDLLVersion.

Next, include some more details. I can't reproduce this on Windows XP x64. If you can attach the DLL itself, it'd be best.
Hi,

I've changed the extract to TMP and GetDLLVersion to GetDLLVersionLocal. Works nice.

I put the Call to GetDllVersion as early as possible and made it execute always (independent of other tests).

I removed the Uninstall in case of failed installation due to missing hardware and I'll attach that installer to this post.

It won't harm the system and will completely uninstall.
To see the bug you'll have to run it once, then copy the
.sys file from Program Files\Marvell\Miniport Driver\ to
Windows\System32\drivers and run the installer again.

It will show the message box Looking for .... and then a second one saying Version of (xxxx (sys file))= yyyyy zzzzz

If the error occurs yyyy and zzzz are empty strings.
The relevant code snippet is :


StrCpy $CurrentSys "$SYSDIR\drivers\$SysName"

MessageBox MB_ICONINFORMATION|MB_OK "Looking for $CurrentSys"
ClearErrors
GetDllVersion "$CurrentSys" $R0 $R1
MessageBox MB_ICONINFORMATION|MB_OK "Version ($CurrentSys) = $R0 $R1"



I hope this helps, at least you should be able to see the error.

Hmm... $SYSDIR points to C:\Windows\SysWOW64 on x64. That's probably the problem. Try turning off redirection using DisableX64FSRedirection from x64.nsh before you use GetDllVersion. Don't forget to re-enable it immediately after the test.


Sort of undocumented, but %windir%\Sysnative should point to the real system dir for 32bit processes


That only works on Vista x64 and not on XP x64.


Originally posted by kichik
Hmm... $SYSDIR points to C:\Windows\SysWOW64 on x64. That's probably the problem. Try turning off redirection using DisableX64FSRedirection from x64.nsh before you use GetDllVersion. Don't forget to re-enable it immediately after the test.
Yeah! That's it!
On XP65 the enhanced version works. I still have to check Vista64.

Thanks a lot for the support.