I am currently trying to build a simple Win 7 x64 USB driver using this guide: https://msdn.microsoft.com/en-us/library/windows/hardware/hh706187(v=vs.85).aspx
Host is using VS2013 & WDK 8.1
Because I don't have a null-modem cable (or any other means of setting up a debugger connection between host and target), I just filled my settings with the default ones found here, expecting some sort of error to return, but the configuration process went through without a hitch, displaying
WDK Remote User Account successfully created
Installing .NET Framework 9possible reboot)
Installing VC Redist (x64)
Installing test automation (x86)
Installing test automation (x64)
Installing debuggers (x86)
Installing debuggers (x64)
Installing driver test framewok
Registering logging components
Configure debugger settings (x64) (possible reboot)
Configure computer settings (x64) (possible reboot)
Creating system restore point
Complete
So I assumed that what I assumed about serial/com ports to be wrong and continued to attach the WKM Debugger to 'Kernel' of my target computer, which was listed under the "Available Processes" datagrid. When I click the 'Attach' button, however, I get an error that says:
Windows Debugging Extension for Visual Studio
Could not start debug session, error 80070002: The system cannot find the file specified
I've tried Building/Rebuilding the project many times, and Provisioning the target computer also multiple times to the same results. I saw that question number 25776839 also had the same issue as me, but he mentioned something about changing VS's default from Kernel Debugger to Remote Debugger, which I'm not sure how that can be accomplished, but also caused other problems. I've also tried to "attach process" using the same setting via WinDBG but did not produce anything useful.
Also, I switched from MSVS2015 and WDK10 to MSVS2013 and WDK8.1 because their tutorial files led me to missing header files (warning.h many others), and package files.
Can anyone show me what I did wrong or what I need to do to fix the 80070002 error? Yes, I am new to driver dev.
Related
TL;DR What is the sane way to automate invokation of VS 2017 vc_redist when called in a chain of several installers?
The Visual C++ Redistributable Installer that MS provides for VS 15.x (VS 2017), namely both (14.15.26706 - VS 15.8.4)):
vc_redist.x86.exe
vc_redist.x64.exe
As part of our full product installation, I have to run several vcredist installers (also older versions) silently.
The problem now is that these installers will refuse to install if a reboot is pending (e.g. "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" - PendingFileRenameOperations).
When calling these installers with vc_redist /q, they will even trigger an immediate system reboot. This can be fixed by calling them with /q /norestart, however:
When calling vc_redist /q /norestart, and if a reboot is pending prior to this installer, it will return MSI exit code 3010 which indicates that a reboot is required.
However, AFAIK, this exit code also indicates, that this very setup requires a reboot to complete.
Actual question
So, I cannot distinguish whether this installer was succesful and just requires a reboot at the very end of my installation sequence (I do install otehr stuff before and after) - or whether the installer actually refused to do anything and I would need to restart the system and start this installer again!
How can I call this vc_redist in a chain of different third party installers and
ideally require just one reboot at the very end
at the very least, determine whether it installed successfully.
Some additional infos, fwiw:
Not sure these helkp with the question, but for completeness sake.
The installer GUI clearly indicates what is going on: (sorry, german Windows)
"No action was taken because a reboot of the system is required."
This is an InnoSetup built installer for our "product suite", that will be used by customers, the installation order goes as follows:
Run MSVC 2005 (VC8) 32 bit vcredist
Run MSVC 2010 (VC10) 32 bit vcredist
Run MSVC 2017 (VC141) 64 bit vcredist
Run MSVC 2017 (VC141) 32 bit vcredist
Run a few other third party dependecy / library installers
Install the actual application files (via InnoSetup)
Reboot (ask) if any installer indicated a required reboot.
As you can see from this sequence, rebooting after each vcredist woud be insane, and luckily it seems only the 2017 redist exhibits this unfortunate behaviour so far.
Of note: My trial runs on my dev machine all started with a reboot already pending at "step 0", and both the VC2005 and VC2010 installer run just fine (as verified through their GUI progress) even if a reboot is pending before hand. It's the VC2017 installers that refuse to do anything if a reboot is pending.
MSU Packages: After decompiling the vc_redist.x64.exe - which is a WiX bundle - using this command:
dark.exe -x Extract vc_redist.x64.exe
I found that the bundle installs: Update for Universal C Runtime in Windows - KB2999226. This component consists of Windows Update files (*.msu - used by Windows Update) and not just MSI files. I would suspect that they could be designed to require a reboot before allowing installation, but I don't have proof.
Suggestion: Run a check to make sure KB2999226 is installed. How to do this? I don't know a Win32 call, but the WiX guys will probably know. Here are some other suggestions.
Windows: How to List All of the Windows and Software Updates Applied to a Computer
Why are “get-hotfix” and “wmic qfe list” in Powershell missing installed updates?
Identifying installed updates on Microsoft products
The actual Windows Update Files are (over time these file names could change as new versions of this installer with the versionless file name - vc_redist.x64.exe - are released):
Windows6.0-KB2999226-x64.msu
Windows6.1-KB2999226-x64.msu
Windows8.1-KB2999226-x64.msu
Windows8-RT-KB2999226-x64.msu
In other words for Vista, Windows 7, Windows 8 et al. Various Server OS's as well. Windows 10 has this component built-in.
Corporate Deployment: In a corporate environment I would deploy these *.msu files via
the distribution mechanism available - whatever it might be - for
example SCCM - before installing the vc_redist.x64.exe package.
This should yield better control of the distribution process as you get error messages straight from the MSUs themselves.
Frankly these are core-SOE components in my opinion. I don't know why Microsoft keep these runtimes out of the main OS installation. They are crucial for most software.
A description of the decompilation approach using the WiX toolkit's dark.exe binary can be found here: How can I compare the content of two (or more) MSI files?
Strictly speaking, error 3010 is a success result. It means that the install has completed but requires a reboot. I'm not aware of anything to indicate that it means the install didn't start at all. The typical "won't install if reboot pending" is a result of using a launch condition based on the MsiSystemRebootPending property. Failures due to this launch condition do not return return a 3010 result - they usually return a 1602 error as a kind of "user cancel" error.
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...
I just installed Qt Creator (Windows 64 bits) and I am checking that everything works as expected.
At this point the only problem I have is related to the debuggers. Firstly I tried adding gdb manually (gdb.exe) and some problem about python popped-up, so I added gdb-python (gdb-python27.exe) and the result is:
Unable to create a debugger engine of the type "No engine"
I use this kit:
MinGW -> MinGW\bin\mingw32-gcc-4.8.1.exe
GBD-Python -> MinGW\bin\gdb-python27.exe
I read this post, but didn't help me since I am using MinGW :/
Thank you in advance.
Edit1: I am open if you want to recommend me another kit configuration :-)
Edit2: I tried to execute gdb-python27.exe and I got an error (missing python27.dll). I installed it in C:\Windows\SysWOW64 and now the error (when I try to open gdb-python27.exe) is something like The application failed to initialize properly (0xc000007b). Still the same error while debugging in Qt creator.
Edit3: Is the problem related to the difference between my MinGW (32bits) and my OS (64 bits)? Don't think so (Qt creator is 32 bits). I think the message The application failed to initialize properly (0xc000007b) is because I use python27.dll (64 bits) instead of 32 bits.
Edit4: I download python27.dll (32 bits) and now I can execute gdb-python27.exe but I got this message through the cmd.exe: ImportError: No module named site.
I still got the error Unable to create a debugger engine of the type "No engine" while trying to debug with Qt creator.
I had similar issue when I installed Qt 5.8.0 having QtCreator 4.2.1 inside it.
I did not have Visual Studio 2015 installed on my machine, and I didn't want to install Visual Studio 2015 for it. So I installed visualcppbuildtools_full from microsoft website, which installed all the required compiler. QtCreator detected the MSVC compilers.
Still QtCreator complained about debugger. For that, I downloaded Windows SDK 10 stand alone with only Debugging Tools as selected. And installed the Debugging tools, which resolved the debugger issue also.
To cross check,
Verify whether C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\cdb.exe and C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\cdb.exe are created with all other binaries.
Now, open QtCreator. Go to Tools | Options | Build & Run | Debugger tab.
Verify above cdb.exe files paths are listed under Auto-detected section.
Debugging starts working after this.
Unable to create a debugger engine of the type "No engine"
This is a bug in Q1t Creator 3.3.0, if you update, you should be OK. Alternatively, it seems solvable by updating to Python 2.7.1.
The application failed to initialize properly (0xc000007b)
If Qt is 32bit, so does the Python.dll
ImportError: No module named site
This seems to be a Python configuration problem as discussed here: Python (Windows) - ImportError: No module named site
Setting the PYTHONPATH / PYTHONHOME variables
Right click the Computer icon in the start menu, go to properties. On the left tab, go to Advanced system settings. In the window that comes up, go to the Advanced tab, then at the bottom click Environment Variables. Click in the list of user variables and start typing Python, and repeat for System variables, just to make certain that you don't have mis-set variables for PYTHONPATH or PYTHONHOME. Next, add new variables (I did in System rather than User, although it may work for User too): PYTHONPATH, set to C:\Python27\Lib. PYTHONHOME, set to C:\Python27.
Alternatively, installing Python 2.7.1 seems to fix that too.
I've written a quick C++ console app using VS2010. I'd like to run it via the remote debugger on the Windows Server 2008 platform, in order to determine why I can't enumerate the CLSID_AudioInputDeviceCategory on that OS.
The console app works on the XP and W7 platforms.
The remote debugger gives the following error when I first tried to run the console app:
The program can't start because MSVCP100D.dll is missing from your computer. Try reinstalling the program to fix the problem.
I did try just copying this DLL from my development machine to the target folder on the remote machine, but it returned an even more obscure message:
The application was unable to start correctly (0xc0000007b). Click OK to close the application.
I've tried installing the VS2010 C++ re-distributable on the target host. This has no effect. I'm out of ideas, does anyone have any suggestions?
Having spent some time on this problem, I've noticed that the Windows Audio service on server 2008 was disabled, but my query is more to do with getting remote debugging working on the server 2008 platform than solving my audio hardware enumeration problem.
Thanks to Errata, I had a look at
Project Properties -> Configuration Properties -> C++ -> Code Generation
I changed Runtime Library from Multi-threaded Debug DLL to Multi-threaded Debug (/MTd).
This allows remote debugging without having to rely on the correct debug DLLs residing on the remote machine.
I hope this helps someone out there!
I had this exact situation. I grabbed copies of MSVCP100D.dll and MSVCR100D.dll. However I grabbed them from system32 (the 32-bit version), which resulted in the 0xc0000007b error.
0xc0000007b apparently means invalid DLL, often architecture mismatch between program and DLL (i.e. x86 and x64). In my case I grabbed the wrong (32-bit) version of the DLL from my developement computer resulting in 0xc0000007b. After grabbing the file from SysWOW64, it worked.
I've written a C++ console application in Visual Studio 2019 and am trying to deploy it to another windows laptop. Both laptops are up-to-date with 64 bit Windows 10, and my target laptop has installed/up-to-date .NET Framework, vc_redist.x64.exe, and DirectX.
In terms of deployment method, I followed this Microsoft walkthrough word for word, with the added step of ensuring that my newly created "setup" project was also targeting x64 platform, since some of the external libraries in my code required x64. The resulting "setup" .exe/.msi pair work as planned on the source laptop - installs and runs with no frills required.
Installation goes fine on the target laptop, but launching the program gives the error mentioned in the title of this post. After a few hours of trying to figure it out, I think I have an idea where the problem is coming from, but first, I'll share what I've tried, which is basically every recommendation found by googling this error code:
clean boot
SFC scan
chkdsk c: /f /r
repairing/fresh installing all of the frameworks mentioned in the first paragraph
running both the application installer and the installed application as administrator
restarting laptop and reinstalling application after all of those changes
What I think is the root of the problem:
In the setup/deployment project in VS, three of the "detected dependencies" (MSVCP140D.dll, ucrtbased.dll, VCRUNTIME140D.dll) have filepaths through …\System32\ rather than the identical dependencies that could be found in …\SysWOW64. The other two detected dependencies are external 64-bit DLLs (which is why I specified my entire project to x64). When I run my application through Dependency Walker, it agrees that the three formerly mentioned dependencies are "wrong CPU type", while the two latter ones are fine. This scenario does not, however, explain to me why install/run (outside of VS) works fine on the source laptop (shouldn't it not work if VS is packaging a mix of 32 and 64 bit dependencies?). In fact, running the application through Dependency Walker on the source laptop reveals the exact same thing as on the target laptop - the same 3 dependencies are "wrong CPU type", yet the application runs here.
I do not see an option in VS to change the "setup" project to read the 64 bit filepath. I have tried manually swapping in the 64-bit DLLs at various stages (including restarting the computer between DLL swap and application run), which did not seem to have any effect. In fact, I tried replacing the 3 relevant DLLs in the System32 folder with the DLLs from the SysWOW64 folder (my idea of a cheap workaround for not being able to change the filepath - just change the file) and this just caused me to get the same error on my source laptop as I had been getting on my target laptop.
All of this stuff is relatively new to me, so please let me know if I'm foolishly overlooking some fundamental detail with my process/project - at this point it would be nice if that were the case and this is easy to fix.
Wrote this before I noticed the above comment had already answered.
Just leaving it in.
Debug Binary: Looks like you have deployed a debug version of your binary (The D in the file name: MSVCP140D.dll). Try to compile in Release mode and deploy the new binary.
Cause: Debug binaries generally need the debug-versions of the VCRedist binaries to exist on the box you try to run the binary - they are only available on developer PCs with the SDK (and / or Visual Studio) installed. That error message: 0xc000007b means "STATUS_INVALID_IMAGE_FORMAT".
Tips: There are some resource links here and some tips on how to debug deployment problems.