How can I reference CChannel.h in Visual Studio 2012? - c++

I'm trying to create a C++ DLL to register with Terminal Services to provide virtual channel functionality. Unfortunately the header CChannel.h cannot be found.
I'm using Visual Studio 2012, which is targeting Windows SDK 8.0. Sure enough, the required header is missing. However, it is present in the 8.1 \include\um directory
Reinstalling the SDK has not changed matters. Manually referencing the 8.1 include directories causes all sorts of issues.
Is there a simple way to get these headers installed under 8.0?

This seems to be a problem others have encountered before, without a direct resolution.
Oddly, cchannel.h is only missing from Windows SDK 8. It is present in SDK 7 and SDK 8.1.
I resolved the problem by using the v110_xp platform toolset. This targets a version of the Windows 7 SDK, but uses the latest compiler (as of VS2012).
VS2012 Update 4 must be installed to access this toolset. More details can be found here.

Related

Why do I get "Illegal Instruction" error when Building on windows10 and running on Windows7

I have a c++ program built using VS2017 on windows7.
When I run it on Windows7 or windows10 there is no problem.
If I Build the same program on Windows10 (still using VS2017) the program runs OK on Windows10 but when I try to run it on Windows7 I get an "0xC000001D: Illegal Instruction." error.
Is it even possible to run programs built in Windows10 on Windows7 ? and if so what can I do?
Thanks
The default SDKs will be different on your two VS2017 installations. Right-click the project, select "properties", then the "General" page. See Windows SDK Version.
You can install different SDK versions (and different Platform Toolsets) using the Visual Studio installer ("Modify").
You would probably need to install the v140 toolset.
Also see the response here:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/e19634d8-f635-4ed0-b8d7-45b64ccbd6fa/windows-sdk-7-in-visual-studio-2017?forum=visualstudiogeneral
...which states:
You can create a project with the default project template. After that, right click the project name under Solution Explorer and go to Configuration Properties-General, modify the 'Platform Toolset' to Windows7.1SDK, since you already installed the Windows SDK 7. Please have a look at the following note:
##To change the target platform toolset, you must have the associated version of Visual Studio or the Windows Platform SDK installed. For example, to target the Itanium platform with the Windows7.1SDK platform toolset, you must have Microsoft Windows SDK for Windows 7 and .NET Framework 4 SP1 installed
If the above not works, you can also modify the platform toolset to Visual Studio 2010 (v100), which has the same compiler like Windows SDK 7, if you have the VS 2010 and VS 2017 on the same computer

Missing Api-ms-win-core-errorhandling-l1-1-1.dll on Visual Studio 2015 under Windows 7

I'm using Visual Studio 2015 under Windows 7 and I'm not capable to run any programs because of missing Api-ms-win-core-errorhandling-l1-1-1.dll, independently which of the target platform version I choose (Available are 8.1 and 10).
In my folder C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs, only version l1-1-0.dll is available. I tried out different Windows Kit 10 versions, but the required api dll's were not available.
Does anyone know how to fix this problem?
1.) How can I bring VS2015 to use older versions of Api-ms-win-core-**.dlls or
2.) How can I update my existing Api-ms-win-core-*.dlls to newer versions?
Thank you for any responses
Compile your code with the Visual Studio 2015 – Windows XP (v140_xp) platform toolset to generate code which is compatible for Windows XP/Vista/7.
Based on your comment I see you used the qt-opensource-windows-x86-winrt-msvc2015-5.7.0.exe which is for Store Based apps. So this explains why you get a message that dependency files are not found.
Install the non WinRT files of QT to solve the issue.

Visual studio 2013 project with v120_xp toolset has MIDL 2072 error

I have recently moved to visual studio 2013 and upgrade all my c++ projects to use 8.1 of the windows SDK and the v120_xp toolset. A large majority of the projects are compiling and working fine i do however have two projects that refuse to build with several errors similar to the following error:
error MIDL2072: inapplicable attribute : [annotation] [ Field 'pDescription' of Struct 'D3D10_MESSAGE' ( Type 'D3D10_MESSAGE' ) ]
All the errors refer to the d3d10sdklayers.idl file. This occurs when the projects idl file is compiled as part of the project if i compile the file alone its fine.
Any help or suggestions are appreciated, thanks.
and upgrade all my c++ projects to use 8.1 of the windows SDK
That's where that went wrong. When you use the v120_xp toolset then you use an old version of the Windows SDK. Version 7.1, the last one that's still compatible with XP. With #include files that are different, and build tools like midl.exe that are older.
You cannot use this old version of midl.exe on the 8.1 version of d3d10sdklayers.idl. It contains attributes that it doesn't know how to process. It chokes on the _Field_size_(DescriptionByteLength) that's present in that file. Only the 8.x version of midl.exe can deal with it.
You are kinda lucky to run into this problem, there are a lot more hidden traps in the 8.1 SDK headers that will make your program fail to work properly on XP. Pretty hard to diagnose too. If you require XP compatibility then you must use the 7.1 headers. You'll have to fix to the damage you did to the projects, presumably the VC++ Directories settings. Or give up on supporting XP, the time has come.

Visual Studio 2012 Project targeting Windows XP using MFC

I have recently acquired source code from a VS2005 project that uses the MFC library. Firstly I upgraded the project to VS2012 and I can now successfully build and run the software on Windows 8. Next, I wanted to deploy the software on a Windows XP machine.
I have set the Platform Toolset to build to Windows XP (using the v110_xp option) and I have installed the 'Visual C++ Redistributable for Visual Studio 2012 Update 1' on the target machine. When I run the software, nothing appears to happen. Via some logging functions I can determine that a call to LoadFrame(IDR_MAINFRAME) causes an exception in kernel32.dll. I can't debug any further in to LoadFrame as remote debugging on Windows XP is not available in VS2012.
Any ideas what may be going wrong? Is the Visual C++ Redistributable package the correct version to be installing on the target machine? What should I be trying next?
UPDATE
My project is already set up to use the 7.1 SDK and has minimum required version set to 5.01 in linker options.
If I use InstallShield to generate an installer and include the MFC, CRT and ATL redistributables, the installer works and my program now runs on Windows XP. My understanding of the redistributables is that they simply copy the relevant dll's in to the system32 folder (or equivalent)? Is that correct?
However, if I simply copy the files over, run the vsredist_x86.exe or use Inno Setup to install the software & dll's, my program no longer works.
I believe you have read this blog. In summary, you need to use the 7.1 SDK, and you need to set minimum required version to 5.01 in linker options.
Using the working InstallShield project and the not-working Inno project I was able to determine that the real culprit here was an unregistered msxml4.dll. The error I was receiving gave no real clue to this outcome but I got there eventually...
regsvr32 msxml4.dll

VS 2012 - XP Issues

I installed VS 2012 Professional and the XP update as well. I built my project with v110_xp as the platform toolset on VS 2012. My project's .msi package is installing fine on Win 7 but failing on Win XP SP3. The error reported on XP SP3 is -
"The procedure entry point FlushProcessWriteBuffers could not be
located in the dynamic link library Kernel32.dll".
While the same project built from VS 2005 is installing fine on XP SP3. I am not sure what is going on VS 2012. _WIN32_WINNT is set to 0x0501. Can some one please guide as how to resolve the problem ?
Any help is highly appreciated,
Mahesh.
Yes, the C Runtime has a dependency on FlushProcessWriteBuffers(). The updated version of msvcrt110.dll and libcmtl.lib, the ones you got along with the update, no longer directly link to the function, they use GetProcAddress() to find it and limp along if it is missng. So you should never get this error.
So very high odds that you deployed the wrong version of msvcrt110.dll, an old one instead of the updated one. You can find it back in c:\windows\system32, look at the properties. Mine is version 11.00.51106.1, dated 11/5/2012. A separate installer is available for it here.
The VS2012 runtime that you are installing uses functions that are not present available in XP. See this MS article: Targeting Windows XP with C++ in Visual Studio 2012 which explains more and provides some workarounds.
Update 1 for VS2012 resolve the problem.
But Update 1 isn’t just about new Windows platforms. It also enables you to target Windows XP with native C++ applications in Visual Studio 2012.
If you are building with update 1 and still encountering problems then I suspect that you are installing an out of date runtime. You need to deploy the runtime delivered with update 1.
You can solve this by including the VC11 merge modules from your development machine(program files\common files\merge modules) in your installer. It's easier than having to run the redist exe in your installer.
If you use WIX: merge module addition
I've tested on server 03, xp64 and xp32.