cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
LucVinck
Level 2

FindFile error

I want to check if the visual studio 2010 DLL's are installed in setup.rul
This code works fine on windows 7 x64/win32 but not on Windows 2008.
Any idea? Is there a FindFile problem on Windows 2008 server?
The code uses FindFile to check if the f.i. c:\windows\system32\mfc100.dll exists. It finds the file on Windows 7, but not on a Windows 2008 server, allthough the file is there when I check it with the windows explorer.

function OnBegin()
STRING szResult;
STRING szSystemRoot;
STRING szDir;
STRING szMsg;
int nResult;
STRING szMFC;
begin
// Search information
szMFC = "MFC100.DLL";
GetEnvVar( "SYSTEMROOT", szSystemRoot);
szDir = szSystemRoot ^ "system32" ;
SdShowMsg( "Checking " + szDir, TRUE);
nResult = FindFile( szDir, szMFC, szResult);
if( nResult < 0 ) then
szMsg = "The " + szDir + "\\" + szMFC + " dll has not been installed\n";
SdShowMsg( "", FALSE);
MessageBox( szMsg, SEVERE );
abort;
endif;
SdShowMsg( "", FALSE);
end;
Labels (1)
0 Kudos
(3) Replies
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

If this is a 64-bit installation of Windows Server 2008, does disabling file system redirection before calling FindFile change the behavior (%systemroot%\Sysnative can also be used without disabling file system redirection on Windows Vista and newer)? The FindFile function is basically a wrapper around the Win32 FindFirstFile/FindNextFile functions and therefore could be affected by file system behavior on a target machine.
0 Kudos
LucVinck
Level 2

Hi Josh, thanks for the hint. First I checked my Windows 7 x64 development workstation: de Visual Studio 2010 x86 runtime was also installed, and yes: the mfc100.dll was also in the C:\windows\syswow64 folder. When i removed it, same problem as on Windows server 2008 (indeed x64).

So i modified my setup.rul and this works.
Maybe something to set on the request list for version 2012?

Luc

prototype BOOL kernel32.Wow64DisableWow64FsRedirection(BYREF INT);
prototype BOOL kernel32.Wow64EnableWow64FsRedirection(BYREF INT);

function OnBegin()
STRING szResult;
STRING szSystemRoot;
STRING szDir;
STRING szMsg;
int nResult;
STRING szMFC;
INT dwOldValue;
BOOL bResult;
begin
// Search information
szMFC = "MFC100.DLL";
GetEnvVar( "SYSTEMROOT", szSystemRoot);
szDir = szSystemRoot ^ "system32" ;
SdShowMsg( "Checking " + szDir, TRUE);
// Disable SysWOW64 redirection
bResult = Wow64DisableWow64FsRedirection( dwOldValue );
nResult = FindFile( szDir, szMFC, szResult);
// Enable SysWOW64 redirection
bResult = Wow64EnableWow64FsRedirection( dwOldValue );
if( nResult < 0 ) then
szMsg = "The " + szDir + "\\" + szMFC + " dll has not been installed\n";
SdShowMsg( "", FALSE);
MessageBox( szMsg, SEVERE );
abort;
endif;
SdShowMsg( "", FALSE);
end;
0 Kudos
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

Can you clarify what change you would like to see with the FindFile function? Are you referring to checking both the native System32 folder and the SysWOW64 folder? A change such as this may have unintended consequences if a caller of the function is expecting to only find the requested file(s) in a specific folder (since FindFile does not return any path with files found, there would be no way to differentiate between multiple copies in the x64 and x86 system folders).
0 Kudos