CopyFile/CopyFileEx not working in Windows Server 2008 R2 SP1 x64 - c++

I have installed the OS in VirtualBox 4.3.8
I have compiled the Code that calls the CopyFile/CopyFileEx function in VC6, and VS2012 (for v10 and v11), but it refuses to work.
I am running the app in console mode, as Administrator.
It gives error 2: The system cannot find the file specified.
However, this code works fine for both functions on XP, Server 2003, and Windows 7.
What is the problem? Is it permissions? How can I find out what the problem is?

This is ERROR_FILE_NOT_FOUND. It's hard to look beyond the obvious explanation that the file name that you are providing when calling CopyFile refers to a file that does not exist.

Altough you don't give much info about the code, I recommend to download and run Process Monitor in background (you can filter your process).
You will see more detailed info such us if the folder really exists, etc.

Related

Problems with running the application using OpenSSL

Good day, colleagues. I'm building an application using OpenSSL - the application crashes with an error code: 0xc0000142.
The standard application openssl.exe also crashes with this error code. What could be the trouble?
According to Microsoft Support in KB 2701373:
This issue is caused by an error in the
Microsoft.powershell.consolehost.dll file. When a Windows PowerShell
script calls the Console.Write method, or when you run an executable
file for an application from a Windows PowerShell session, values are
written into the PowerShell console. Additionally, a corresponding
console handle is created. When many console handles are created, the
console handles leak, and the issue that is described in the
"Symptoms" section occurs.
There's also a question in the Microsoft Communities, CMD.EXE error 0xc0000142, and the answer appear to be "reinstall your application".
I'm not sure how MinGW affects the problem. Since MinGW is abandoned, I'm guessing its the problem and you likely won't be able to fix it. Its probably providing an old, buggy version of something with ABI problems.
Maybe you can use Cygwin for Linux on Windows. Cygwin is still actively developed and maintained.

Visual Studio 2015 error: Unable to start debugging. Unexpected GDB output from command "-target-select remote :5039". Remote connection closed

I see the following error whenever I try to debug "Cross Platform" under "C++" category: "Unable to start debugging. Unexpected GDB output from command "-target-select remote :5039". Remote connection closed"
I've installed all of the contents when I downloaded Visual Studio 2015 community and I ran it on Windows 10 Pro which supports Hyper-V.
I've been searching a solution for this and I've found an assumption:
"What is your debug target, the VS Android Emulator? When we saw this before it turned out to be a bad emulator image. Do you have this problem with all targets (e.g. if you try a physical device) or just one?"
In my case, I just tried this via Emulator(VS Emulator 5" Lolipop (5.0) XXHDP Phone (0x86 -...)
So I've sent an Email to VS 2015.
And the answer was like this:
"Sorry for the delay in responding we were looking at an emulator image of another user that ran into this problem so I was waiting until we had the results of that investigation to report back. We actually were not able to find anything wrong the emulator itself, our current hypothesis is that it is a network or adb problem interfering with GDB’s ability to connect to GDB server on the remote machine. Do you see this error every time you try to debug, or if you reboot the emulator will it work sometimes right after the reboot? Next time you see the error, can you open the emulator’s console mode by going go the Hyper-V manager and double clicking the emulator. Then find the location your app installed to and run “gdbserver --version" from the app path and let me know what it says? This will validate if the correct version of gdbserver is on the device."
So we are trying to solve this problem but I'm also asking here just in case.
Is there anyone who has magical solution for this problem?
I'll put a comment on this if I figure out how to solve this.
Thanks in advance.
** Following answer is from the manager of Visual Studio 2015:
You are only the second person who has run into this issue, and the first person that ran into it provided their everything works correctly when we run their .vhd on our machines so it appears to be some strange problem where gdbserver (which comes from the Android NDK provided by Google) crashes only when running on certain machines. Unfortunately the .vhd you provided does not appear to be the correct one it won’t boot for me. You can see the .vhd file being used by the emulator if you look under the settings of the emulator in your Hyper-V manager. .However given we got the other person’s .vhd you can hold off providing any additional information at this point. I’m waiting to hear back from the emulator team on if they have any ideas since this appears to be an issue only on specific machines since.
If you don’t mind my asking, if you don’t have a background in computers what inspired you to try C++ on Android? That scenario will be significantly more complicated than doing Java on Android.
It's been almost two months since I got this answer but I haven't got any additional response from them yet. So, I ended up quitting developing an application by using VS2015.
If you run into this problem, there are only two ways to go. Change your computer or stop developing application via VS2015.
If the project name contains spaces, the whole remote debugging fails. Visual Studio also creates weird paths. When checking out the "Blink1 for Raspberry Pi" template, I named the Project "Blink1 for Pi", which resulted in a path like this:
~/projects/Blink1?/for/pi/PI/for/pi....
And all the debugging failed. When I recreated this keeping the project name "Blink1", everything worked fine. It's a pity, that spaces aren't handled here...

is there a service to create and upload crash dumps for mac and win apps?

I have a cross platform desktop C++ app for Mac OSX and Windows, for which I'd like to collect debug info when a crash happens on a user's computer, so I can find out what the problem is and fix my code. On Windows I'm using visual studio express 2010 and on Mac I'm using Xcode 3 as IDE. I remember an online service where you could sign up and link your code with a library, so the app would upload crash info to the service, which you could then use to fix the app, but I can't find it anymore after googling for 10 minutes. Can anyone help?
Thanks!
B
Please see here for the google-breakpad project. I think this is what you need. I was going to use it for a project so I researched about it but then the project ended so I didn't have a chance to. You link your program with it and when the program crashes, it generates a crash dump that is not compatible with any of the platform-specific crash dump formats but has its own one. You can then analyse them with a program that is part of the breakpad project. As far as I remember, there is also a service that you can install, where the crash dumps can be uploaded. The service then can analyse and group them by reason etc.
Hope that helps.

Error STATUS_BAD_NETWORK_PATH when running qt executables through developer studio

I have searched and found no answer to this
I have a weird problem when running executables through developer studio (2008): a basic 'hello world' exe works OK when created through the usual dev studio project creation mechanism, but when trying to run a library based program the software crashes with STATUS_BAD_NETWORK_PATH. The program uses Qt and zlib behind the scenes and is written in C++, but (as far as I'm aware) is not dependent on any particular network locations on initialisation; we do have Sophos installed on the PC too.
The weird thing is that one cant even step into the main: the program fails well before this with the error. If we plug the network in, it starts up just fine ... The odd thing is this only occurs on a specific 64 bit Windows 7 machine.
Does anyone have any tips as to how to trace where the issue is? We've tried tracking using procmon but it is not very revealing; no obvious failures up to the point where the program crashes.
We have now figured out the answer. It transpired that there were 2 issues:
Firstly a wrapper .bat script that was launching developer studio was setting the PATH environment variable: a location in this path was being specified using a UNX style path (e.g. \\a\location\somewhere) rather than a mapped drive. The executables were not actually using this location but when the network was unplugged this it seems that this was disrupting things from dev studio
This, in tandem with a network configuration error on the PC, meant that deep down in the runes, something was failing.
So - advice if you see such an error
Check your PATH and make sure it is sensible
Look in your PC's configuration logs, and see if you can see any networking issues
...

WMI CreateProcess - spawned exes are stalling

I'm using WMI's CreateProcess() to run an installation bootstrapper process (setup.exe) on a remote machine. The setup.exe is happily able to run .msi packages but for some reason it is not able to run the vcredist.exe packages that are used to redistribute the MS VS 2008 SP1 C++ Runtimes.
What I'm seeing is that the redist package is able to extract itself into a temp folder in the root of the C:\ drive, e.g. C:\a26f91763649ecad76a09d or some such, but after that the process hangs around.
I don't know what to do to debug further - I suspect that there is a modal dialog in the hidden windows station awaiting dismissal, but I can't see what the text is. Process Explorer isn't yielding much either.
Anyone got any suggestion? The problem applies equally in Windows 2000 as in Windows 2008. We used to use a DCOM-based method to launch setup.exe remotely and this did not exhibit the problem.
Can anyone shed any light on what might be going on, or how to diagnose further.
Many thanks,
Stephen
User error! My suspicion about the modal dialog was correct. It seems that invoking the setup.exe files with a relative path somehow caused the command line arguments to get stripped when passed to the nested exe, so they ran in full UI mode! Invoking with a fully-qualified path resolved the problem.