XXX.exe is not a valid Win32 application - c++

Configuration: Windows server 2008 x64.
Software is cross platform c++ 64bit.
The previous installer defaulted to asking the user to install to
c:\Program Files (x86)\company\version
For the last release I changed the installer using a path override to install to
c:\Program Files\company\version
The guys who does testing for us said that with the new install to c:\Program Files\ sub processes don't start. Override installing to c:\Program Files (x86)\xxx everything runs fine. Going to cmd.exe and running from C:\Program Files\xxx gives the "yyy.exe is not a valid Win32 application" error. Again this is not an issue with c:\Program Files (x86).
A customer also installed to default location and gets the same errors.
My build/dev machine does not show any of these errors. It runs a demo version of server 2008 (and visual studio express) that never updates and is never rebooted.
Is there something special about the "x86" tacked onto the Program Files ?
NOTE:
This is NOT a problem on my dev machine which is also server 2008 x86_64.
dumbin /headers clearly indicates these programs are 64bit.
At this point there is no answer.
Workaround is to just install to Program Files (x86) or elsewhere and be done with it. Will put in an FAQ that users should NOT install to Program Files (they'll look at a faq if stuff goes nuclear).
This could be a problem with the installer, it could be a classic case of "quack.exe" but applied to "Program Files". There's good reason why I generally hate windows.

The Program Files (x86) directory is where 32-bit programs are installed. When a 32-bit application is running, the %ProgramFiles% environment variable is set to C:\Program Files (x86)\ (by default; this could actually be located on a different drive).
Are you absolutely sure this program is being compiled as 64-bit?

Maybe the exe finds a dll in a 32-bit somehow in that particular configuration? E.g. when sb managed to mess up his 64-bits dir with 32-bit dlls.
Remember that not loadlibraried dll's are also loaded on startup.

I think this is related to the manifest of the application. Have you changed this somehow? I got the same error when I was switching back and forth between compilers. vc9 (vs2008) created a manifest which we normally never use when we compile on .net 2003.

Related

LoadLibrary failure: %1 is not a valid Win32 application. in R

I have a C code which is loaded through R for my project. Using dyn.load, I was able to load the C code in Windows 64 bit machine and Linux server. However, I am getting the following error when I try to load .dll in Windows 32bit machine.
R error while using dyn.load
I tried using the whole path, running the dyn.load command from working directory but none of them worked.
My R version:
R version
Also, I have edited the system variables and below you can find the system variables.
`C:\ProgramData\Oracle\Java\javapath;
%SystemRoot%\system32;
%SystemRoot%;
%SystemRoot%\System32\Wbem;
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;
C:\Program Files\Common Files\Roxio Shared\DLLShared\;
C:\Program Files\Common Files\Roxio Shared\10.0\Roxio Central36;
C:\Program Files\Windows Imaging\;
C:\Program Files\QuickTime\QTSystem\;
C:\Program Files\R\R-3.3.2\bin;
C:\Rtools\bin;
C:\Rtools\mingw_32\bin;
C:\Rtools\mingw_32\lib\gcc\i686-w64-mingw32\4.9.3;
C:\Users\******\Documents\R\R-3.3.2\library\Rcpp`
The existing solutions for this type of problem did not help me.
It would be great if someone can help me solve this problem.
My computer was missing 64 bit java, all I had to do was install it:
Go here
Click on 'Windows Offline (64-bit)' to download 64 bit java
Click on the downloaded file and follow the installation instructions
Close RStudio then reopen RStudio
Everything worked!
Such errors often refer to architecture mismatch, apparently when one tries to load a x86-64 module on a x86 machine. Please, make sure that on the x86 machine you're loading a .dll compiled specifically for the x86 architecture.

Release not working on different PC

I am not so experienced with C++ and MS Visual Studio. I am currently having issue with releasing .exe and trying to run the program on different PC. In the program I'm using additional library (magick++). I've configured the Runtime Library in Visual Studio 2015 to Multi-threaded (/MT). I suppose, that with this configuration the .exe file should be running on different PCs, but when I try to run it, message with "CORE_RL_Magick++. dll is missing on this computer appears. Any idea, what might be wrong?
My second question is, if I would like to make a release with dynamic library /MD, how can I get the library to run it on different PC? Or do I have to install the library first (I mean if I have to install Imagemagick to the computer or is there some way I can get the nescessary library from the build in Visual Studio).
Thanks for every information.
Do you have CORE_RL_Magick++. dll in the path (including the directory that your exe program is running) somewhere on the computer that is failing.
The /MD and /MT commands effect what runtime is used, not what other libraries the program is dependant on.
So with /MT, it will compile a static version of the visual c libs into the exe, but if linked against the magic dll, it will still need that CORE_RL_Magick++. dll in order to run.
I think /MD is a better choice, for smaller size.
If you want to run program on other PC, you may need to install Visual Studio Redistributable (could be downloaded on Microsoft website) on the PC first.
Agree with Martin Zhai. I had this problem when attempting to run my program on another machine after upgrading to 2015. The DLL I wanted to use would not be found despite being local. Installing Visual C++ Redistributable for Visual Studio 2015 fixed this.

GCC suddenly stopped working? Missing dependencies? [duplicate]

I have a problem with our executable. I'm running this C++ 32-bit executable on my Windows 7 64-bit development box that also has all those Microsoft applications (Visual Studio 2008 + 2010, TFS, SDK, Microsoft Office)...
And it's still running just fine.
Now I got the client installation of the very same program and was asked to test it with a clean Windows 7 installation. Thus I got one Windows 7 64-bit VMware and updated it to Windows 7 SP 1 (the very same version my developer box is tuning).
But while on my developer box everything is fine the program does not work with the VMware (30 days trial) box.
The x86 Dependency Walker is telling me that the following DLL files are missing:
API-MS-WIN-CORE-COM-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL
API-MS-WIN-SHCORE-SCALING-L1-1-0.DLL
DCOMP.DLL
GPSVC.DLL
IESHIMS.DLL
I googled for those API-MS-WIN-... DLL files and found they should actually already be part of Windows 7 (some sites claiming the belong to Windows 8 and Windows Server 2012 though).
I already tried the suggested fixes I found, which are:
running 'sfc /scannow'
installing Visual Studio 2008 SP1 runtime executables
But that didn't solve anything. :-(
Side note: My development box does not have them either, and does not seem to need them. For example, the user32.dll on my box does not link against one of those, while the installation on the VMware does.
Any idea on how to fix this issue?
I tried to find a suitable download / fix on the Microsoft pages, but I failed.
After solving my issue I wanted to report what I found out, and I can't post this as an answer because the question has been closed.
Actually all the DLL files reported missing by the Dependency Walker tool, namely those
* API-MS-WIN-CORE-...
type DLL files were not part of the actual problem.
In my case the registration of three OCX files was missing and after that everything was just fine, BUT Dependency Walker tool still listed all the very same DLL files as before even when the program was just running fine now.
The gist of it: As someone elsewhere stated, the tool is a bit dated by now and does not always work properly with a newer OS. Thus keep an eye open and don't get mislead by missing 'API-MS-WIN-CORE-COM-L1-1-0.DLL', ... the problem probably lies entirely elsewhere.
This problem is related to missing the Visual Studio "redistributable package." It is not obvious which one is missing based on the dependency walk, but I would try the one that corresponds with your compiler version first and see if things run properly:
Visual Studio 2015
Visual Studio 2013
Visual Studio 2010
Visual Studio 2008
I ran into this problem because I am using the Visual Studio compilers, but not the full Visual Studio environment.
Going to dare to inject a new link here: The latest supported Visual C++ downloads. Stein Åsmul, 29.11.2018.
I just resolved the same problem with C++ Qt 5 and Windows 7 64 bits with MSCVC 2012.
In the beginning I thought it was a MSVC/Windows DLL file problem, but as BorisP said, the problem was in my project dependencies. The key is "How to know your project dependencies in Qt 5?".
As I didn't find any clear way to know it (Dependency Walker didn't help me a lot...), I followed next the "inverse procedure" that takes no more than 5 minutes and avoid a lot of headaches with DLL file dependencies:
Compile your project and take the executable file to an empty folder: myproject.exe
Try to execute it, It will retrieve an error (missing DLL files...).
Now, copy all the DLL files from Qt (in my case they were in C:\Qt\Qt5.1.1\5.1.1\msvc2012_64_opengl\bin) to this folder.
Try to execute again, it will probably works fine.
Start to delete progressively and try every time your executable still works, trying to leave the minimum necessary DLL files.
When you have all the DLL files in the same folder it is easier to find which of them are not valid (XML, WebKit, ... whatever..), and consequently this method doesn't take more than five minutes.
I just resolved the same problem.
Dependency Walker is misleading in this case and caused me to lose time. So, the list of "missing" DLL files from the first post is not helpful, and you can probably ignore it.
The solution is to find which references your project is calling and check if they are really installed on the server.
#Ben Brammer, it is not important which three .ocx files are missing, because they are missing only for Leo T Abraham's project. Your project probably calls other DLL files.
In my case, it was not three .ocx files, but missing MySQL connector DLL file. After installing of MySQL Connector for .NET on server, the problem disappeared.
So, in short, the solution is: check if all your project references are there.
As mentioned, DCOMP is part of the VC++ redistributables (implementing the OpenMP runtime) and is the only truly missing component. All the rest are false reports.
Specifically API-MS-WIN-XXXX.DLL are API-sets - essentially, an extra level of call indirection introduced gradually since Windows 7. Dependency Walker development seemingly halted long before that, and it can't handle API sets properly.
So there is nothing to worry about there. You're not missing anything more.
A better alternative to find the truly needed DLL files that are missing (if that is indeed the problem) is to run Process Monitor and step backwards from the failure, searching for sequences of failed probes for a specific DLL file in all the system path.
I also ran into this problem, but the solution that seems to be a common thread here, and I saw elsewhere on the web, is "[re]install the redistributable package". However, for me that does not work, as the problem arose when running the installer for our product (which installs the redistributable package) to test our shiny new Visual Studio 2015 builds.
The issue came up because the DLL files listed are not located in the Visual Studio install path (for example, C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist) and thus had not been added to the install. These api-ms-win-* dlls get installed to a Windows 10 SDK install path as part of the Visual Studio 2015 install (e.g. C:\Program Files (x86)\Windows Kits\10\Redist).
Installing on Windows 10 worked fine, but installing on Windows 7 required adding these DLL files to our product install. For more information, see Update for Universal C Runtime in Windows which describes the addition of these dependencies caused by Visual Studio 2015 and provides downloads for various Windows platforms; also see Introducing the Universal CRT which describes the redesign of the CRT libraries. Of particular interest is item 6 under the section titled Distributing Software that uses the Universal CRT:
Updated September 11, 2015: App-local deployment of the Universal CRT is supported. To obtain the binaries for app-local deployment, install the Windows Software Development Kit (SDK) for Windows 10. The binaries will be installed to C:\Program Files (x86)\Windows Kits\10\Redist\ucrt. You will need to copy all of the DLLs with your app (note that the set of DLL files are necessary is different on different versions of Windows, so you must include all of the DLL files in order for your program to run on all supported versions of Windows).
This contribution does not really answer the initial question, but taking into account the hit-rate of this thread I assume that there are quite a few people dealing with the problem that API-MS-WIN-CORE- libraries cannot be found.
I was able to solve a problem where my application refused to start with the error message that API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL is not found by simply updating Visual Studio.
I don't think that my build environment (Windows 7 Pro SP1, Visual Studio Ultimate 2012) was messed up completely, it worked fine for most of my projects. But under some very specific circumstances I got the error message (see below).
After updating Visual Studio 11 from the initial CD-Version (I forgot to look up the version number) to version 11.0.61030.00 Update 4 also the broken project was running again.
This solved the issue for me:
Uninstall the Visual Studio 2010 redistributable package if you have it installed already, and then install Microsoft Windows 7 SDK.
I solved the problem. When I registered the OCX files, I ran it with the Command Window that had been executed as an administrator.
For anybody who came here, but with a Photoshop problem: my solution was to uninstall the MS VC++ redistributable first x86 and 64 both. Then install one appropriate to the Windows version and architecture (86 or 64).
Installation of SQL Server Management Studio 2014 on a freshly installed Windows 7 resolved this problem at our client after a two-day ridiculous battle.
I came here with this problem occurring, after trying a fresh Windows 7 OEM install, upgrading to Windows 10.
After some searching of Microsoft forums and such I found the following solution which worked for me:
Replace C:\Windows10Upgrade\wimgapi.dll with the one from C:\Windows\System32\wimgapi.dll
I suggest also checking how much memory is currently being used.
It turns out that the inability to find these DLL files was the first symptom exhibited when trying to run a program (either run or debug) in Visual Studio.
After over a half hour with much head scratching, searching the web, running Process Monitor, and Task Manager, and depends, a completely different program that had been running since the beginning of time reported that "memory is low; try stopping some programs" or some such. After killing Firefox, Thunderbird, Process Monitor, and depends, everything worked again.
I had the same problem. After spending hours searching on the web, I found a solution for me.
I copied the file combase.dll file (C:\Windows\System32) to the release folder, and it resolved the problem.
Just to confirm answers here, my resolution was to copy the DLL that was not loading AND the ocx file that accompanied it to the system32 folder, that resolved my issue.

The program can't start because mfc120ud.dll is missing from your computer

I'm trying to run an application that I've recently developped onto another computer and which I've compiled using VS2013.
Running it I get:
The program can't start because mfc120ud.dll is missing from your computer. Try reinstalling the program to fix this problem.
I've searched the mfc120ud.dll from the net but without any result. I've copied/pasted this dll file from the computer on which I've developed that app onto the system32 of the other computer, doing that implies:
C:\Users\u\System32\mfc120ud.dll is either not designed to run on Windows or it contains an error. Try installing the program again using the original installation media or contact your system administrator or the software vendor for support.
Knowing that the computer on which I'm developing is a 64-bits one and the other one is 32-bits, and that I've copied/pasted the mfc120ud.dll version from System32, how do I to fix this issue?
The program can't start because mfc120ud.dll is missing from your computer. Try reinstalling the program to fix this problem.
That is one of the debug libraries for MFC. That's the library that you link against when you build debug releases of your program. It is present on your developer machine, but you cannot redistribute it.
You need to do the following:
Build your project for release. This will link against the release versions of any runtime DLLs.
Install the MSVC and MFC redistributable dependencies on any machine on which you plan to run your program. An alternative is to install the runtime DLLs in the same directory as your executable.
I've copied/pasted the mfc120ud.dll version from System32
You are not allowed to do that. Retrace your steps and undo that.
Check if you've accidentally defined _DEBUG in your preprocessor definitions.
I once had the same error when I copy pasted settings from the debug build.
For me, I build the project using VS2013 xp mode. Then deployed on window XP system. Then I got error that mfc120ud.dll is missing.
I installed vcredist.exe for vs2013, which fixed the issue.
I am able to run my MFC app.
When I encountered a similar problem, first installed the VS 2013 C++ redistributables vcredist_x86.exe and vcredist_x64.exe (https://support.microsoft.com/en-us/help/3138367/update-for-visual-c-2013-and-visual-c-redistributable-package), then I determined what dependencies the file had:
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin>dumpbin.exe /dependents "C:\Temp\MyLibrary.dll"
Microsoft (R) COFF/PE Dumper Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file C:\Temp\MyLibrary.dll
File Type: DLL
Image has the following dependencies:
mfc120d.dll
MSVCR120D.dll
KERNEL32.dll
USER32.dll
OLEAUT32.dll
mscoree.dll
Image has the following delay load dependencies:
MyLibraryCoreD.dll
Summary
5000 .data
2000 .nep
1000 .pdata
4E000 .rdata
1000 .reloc
1000 .rsrc
10000 .text
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin>
Next I searched the registry and it did not find mfc120d.dll, only mfc120.dll and mfc120u.dll (see https://serverfault.com/questions/576831/how-do-i-know-if-a-dll-is-registered), so instead of using the debug version I switched to the release version which uses mfc120.dll and the application worked.

MSVCP100.dll not found error even when it is installed

i get the following error when i try to run an exe on a x64 machine that was build for x86 CPU using the MC++ compiler (vs2010) on a x86 machine:
i already have visual studio 2012 (along with Visual C++ 2012 Update 4 redistributable- both x86 and x64) installed on this second (x64) machine.
A quick search tells me the "MSVCR100.dll" is already present in "C:\Windows\System32".
i tried to install the Microsoft Visual C++ 2010 Redistributable but it exited with an error telling me that a superior version is already installed.
Please guide me what i am doing wrong. :)
Firstly, in 64-bit versions of Windows, 32-bit system executables and application extension files (aka DLLs) are placed in %systemroot%\SysWOW64 instead of %systemroot%\System32 (which, somewhat counterintuitively, contains 64-bit versions in a 64-bit Windows). So the SysWOW64 folder has to be checked for the x86/32-bit MSVC(++) DLLs.
Secondly, though installation of the corresponding visual studio version on the target machine or having accompanied the distributed program with the required C(++) DLLs should, theoretically, solve the problem, it's not necessary. It's sufficient to have the corresponding MSVC++ redistributable package installed (i.e. e.g. Microsoft Visual C++ 2010 x86 redistributable package in this particular case).
Notes:
The aforementioned info are theoretically correct but damaged Windows installations or ... may not conform.
Including the C++ DLLs with the distributed program is acceptable (and possibly a conservative but correct decision) but installing a Visual Studio version solely to be able to use the DLLs in question definitely isn't.
As a side note, C++ redistributable packages don't install the debug versions of the DLLs so installation of or access to a corresponding Visual Studio version is necessary for running debug-compiled applications.
Your application needs the dll for VS2010. you should place MSVCR100.dll and MSVCP100.dll from your x86 machine beside your exe. You can also install VS2010 alongside your current VS2012. then you should also install the Service Pack1 for VS2010 to work properly. After installing VS2010 you have access to both mentioned dlls and also you probably don't need to copy them to your exe directory.