Dear anshad,
In Windows 64-bit editions users have two folders System32 and SysWOW64 for Windows system files. Native 64-bit executables would usually search their dependencies under System32, but 32-bit executables running over Windows 64-bit systems would usually search their dependencies under SysWOW64. So, you have to require the right architecture of your dependencies. I have as a "personal policy" regarding dependencies to require both 64-bit and 32-bit under Windows 64-bit systems. But you can do as you wish. Below is an example of how I do that in my scripts:
[Variables]
%ProgramFolder%=
%ProgramEXE%=
%ProgramTitle%=
%DependenciesList%=pdh.dll,cmd.exe,sc.exe
[Process]
Echo,Processing %ProgramTitle%...
//These lines will require the necessary files.
StrFormat,SPLIT,%DependenciesList%,#$c,0,%Count%
Loop,%ScriptFile%,Process-Dependencies,1,%Count%
If,%SourceArch%,Equal,x64,Begin
Set,%PluginArch%,x86
StrFormat,SPLIT,%DependenciesList%,#$c,0,%Countx86x64%
Loop,%ScriptFile%,Process-Dependenciesx86x64,1,%Countx86x64%
Set,%PluginArch%,%SourceArch%
End
//This is the end of requiring files.
[Process-Dependencies]
StrFormat,SPLIT,%DependenciesList%,#$c,#c,%Dependency%
If,NOT,EXISTFILE,"%Target_Win%\System32\%Dependency%",Require_FileQ,%Dependency%
[Process-Dependenciesx86x64]
StrFormat,SPLIT,%DependenciesList%,#$c,#c,%Dependencyx86x64%
If,NOT,EXISTFILE,"%Target_Win%\SysWOW64\%Dependencyx86x64%",Require_FileQ,%Dependencyx86x64%
Best regards,
Aeolis