Exe file fails to run in Windows XP SP3 32 bit - visual-studio-2010

I don't know why. It may be run in all systems I've already tested, including Windows XP/7 32/64 bit. It's a console application generated by Visual Studio 2010. I put a simple printf as the first statement in main function. But nothing is printed on screen. It seems that the exe file can't be executed. It's dependent to some other dll's and the dll's are included in the same folder as the exe file. If they can't be located, a message box must appear to warn about it, though, i think, not? The folder is completely copied from a system which this exe file can be run on. Only this exe file can't be run. I've examined another one which is also dependent to some dll's and it may be run without any problem.
Any clue?

Related

Visual Studio 2013 Installer Projects Extension copying to root folder

I have installed Microsoft Visual Studio 2013 Installer Projects to create a simple installer. When I run the installer however it copies the files to c:\ instead of the proper folder in Program Files (even though it asks for the path).
This seems to be caused by the fact that the MSI (the only thing produced by the Installer project) is not run with elevated privileges. The other thing is that you cannot say run as administrator for MSI file (unless you do some reg-hacks).
I have searched for a solution and there seem to be loads of more or less complicated ways how to tackle this.
The question is - is there not a simple switch that would allow me just to copy the files to appropriate Program files folder? I do not want to create workarounds for something that seems to be the very basic functionality.
If adjusting the environment (UAC settings, Registry values) is totally not an option for you then maybe you could try one of the following:
The Visual Studio Setup Project produces both an MSI and a setup.exe file. The latter one you can run as administrator by right-clicking on it. No hacks.
Another way of starting a process with elevated privileges is opening a command prompt (cmd) as administrator and then launch your EXE or MSI from the command prompt window.
-
Note: Even though it may not be related to your question, I would also pay attention to the Target Platform. For instance, you cannot install a 64-bit project to the Program Files (x86) folder.

Different build result

Even though I execute same msbuild batch file with same source code which is a solution of visual studio 2013, I get different files as result.
I'm using msbuild command batch file to make deploy files. One PC has installed DevExpress, and another PC hasn't, and those 2 PCs make different build files. PC without DevExpress includes extra dll files which are not even refered in solution. After I removed DevExpress, the results became same. But I don't understand why.
Does anyone know why this happened?

How can I make an MSI file that runs all EXEs in its own directory?

Currently, our customer uses a Windows .bat file in order to batch-install a series of installers (currently .exe files produced using Inno Setup, although there are plans in the future to replace them with .msi installers) found in a directory.
However, they have requested that this be replaced with an .msi file -- it sounds crazy to me (as it doesn't actually INSTALL anything, merely search for external files already on the target machine and then run them) -- but presumably it is in order to take advantage of Windows Installers' logging functionality, as well as to prevent unauthorized tampering with the installation process.
Most of the stuff I've found on Windows Installer custom actions seems to refer to running programs installed by the MSI, not programs that were already on the target machine before the installer was run. What do I need to do to run already-existing files (in the same directory as the MSI itself) as part of an MSI's processing?
I'll accept solutions using either Visual Studio or WiX.

Analyzing Crash dumps in Visual Studio

I have a *.dmp (dump) file of my crashed application. Now, I want to analyze the crashed process on a different machine. That is, the app crashed on one machine, and I have Visual Studio on other machine.
Now, what do I need to be able to see stack trace and all symbols of my app? Is *.exe file and the *.dmp file sufficient?
Or do I need also the source code and PDB file?
If so, should the source code and executable file be placed in the same directories structure as it is on the machine the process was running?
How to attach PDB file to crash dump file in Visual Studio?
No, you definitely need the .pdb files to get decent stack traces. By far the simplest way is to do this from the machine on which you built the program, the source code and .pdb files will be in the right place.
Next best thing is to copy the exact same executables into the exact same folder in which it was installed on the failing machine. Copy the .pdb files into that same directory, that's where the debugger looks next if it can't find them in the original build location. Once the debugger lands on a statement with source code and the .pdb wasn't stripped then it will prompt you to give the source code file location.
Next best thing is Tools + Options, Debugging, Symbols and add the path to the directory that contains the .pdb files.
In that same dialog, also turn on the Microsoft Symbol Server (http://msdl.microsoft.com/download/symbols). That gets you the symbols for the Windows DLLs and lets you accurately trace back to your own code if the crash occurred in a Windows DLL.

How do I Set an Executable's Search Path?

I'm not using the default Visual Studio project path to build my program into, because I want to emulate a release, and write tools to search for resources. After tinkering with the settings, I've got VS to output to the right folder, and to copy the DLLs to a bin folder in the main folder. However, I can't get the .EXE it generates to find the DLLs, it will only find what's in it's directory, but I don't want to be messy like that. The debugger works fine, but it won't work standalone. How do I tell VS to tell the .EXE where to find it's DLLs? Do I have to edit the PATH? That seems messy, as I've never had good experiences with it. I've tried Project Settings -> VC++ Directories, but it still won't find it, as I'm assuming that that's for .LIB files.
Here is a diagram of my folder hierarchy.
-root
--bin
---[Required DLLs]
--data
---[Program Resources (images, sounds, configs, etc.)]
--Program.exe
Using Visual C++ 2010 Express Edition.
How do I tell VS to tell the .EXE where to find it's DLLs?
Edit the Release Run Configuration and change the working directory where your dlls reside.
You will still have to run your exe through the ide for this to work.
Do I have to edit the PATH?
No
This doesn't have anything to do with Visual Studio. It is Windows that can't find the DLL. It has no reason to look in an arbitrary subdirectory for a DLL. It isn't otherwise clear whether these are implicitly loaded DLLs or if you use LoadLibrary to load them yourself.
You don't have much of a problem if you use LoadLibrary(), just pass the full path name of the DLL. GetModuleFileName(NULL, ...) helps you build the path string. You'll have a Big Problem if these are implicitly loaded. In that case, there should be preciously few reasons to not store the DLLs in the same directory as the EXE. And yes, you don't want to mess with the PATH environment variable. Or the current working directory.

Resources