Setting up eclipse for windows driver development - windows

I am trying to write a user-mode windows(XP, Vista & 7) virtual printer driver using WDK 7.1.0 . I plan to use eclipse IDE for development, so wanted to know if I can set it up for the same. I am looking to do following:-
1) Eclipse to recognize win32 apis (C and C++) and hence provide features like autocompletion for its function names
2) Eclipse to use compiler provided with WDK
3) Debug the code through eclipse (Not sure if this is possible or not)
OR would you suggest some other development environment for windows driver development ?

Run Eclipse from build environment that you need (free or checked with needed architecture)
Create project or import C/C++ / Existing code as makefile project. Select GNU Toolchain.
Properties -> Builders -> New -> Environment -> Select, select all variables, mark "add to all configurations", select "replace native environment with specified on". On the Main tab select full path to build.exe of the selected build environment. Select your project directory in workspace as "working directory"
Properties -> C/C++ Build -> On Bulder Settings tab remove "Use default build command" flag and type "build"
Properties -> C/C++ Build -> Tool Chain Editor -> Select Tools. Personaly I selected msvc compilers.
Properties -> C/C++ General -> Paths and Symbols -> select includes that you need including WDK ones
Enjoy

Definitely you should use MS Visual Studio with VisualDDK addon.
It allows you to compile/debug even kernel mode drivers local or remotely.

Related

Is there a way to force msbuild to only build x64?

In all of the component projects of my C# solution, "Platform target" is set x64 in Project>Properties>Build. However, the Platform property is still "Active (Any CPU") and that is the only option. In the build log, I can see that it is copying both x64 and x86 versions of some nuget packages. Two questions:
If I've specified why x64, why is it still copying x86 packages?
Is there way to eliminate "Any CPU" as a platform option and ONLY build x64?
The Platform target under Project>Properties>Build is not the right option for your build process. That option is to tell which platform the project assembly is compiled for rather than your nuget package. So, the option cannot change the build platform and your nuget package still uses the build platform to judge which version of the dll is copied into the main project output folder.
More info you can refer to this document.
Suggestion
You can use Configuration Manager under Build
You should locate your Project and then choose x64 to build your Project Platform. And if you did not have x64, you have to click New to create it.
Update 1
Your Build Configuration is in a mess. So please first enter each project Properties-->Build--> change Platform target to Any CPU to do a restore operation.
Then, enter your Configuration Manager, delete any x64 and x86 platform under Active Solution Platform and Project Platform if you have. Then, click Active Solution Platform and then create a new x64 platform.
This will set uniform platform settings for each project.
You can refer to this similar issue.

How to switch toolchains in CLion 2018.2?

I started trying to use of CLion 2018.2 today and the first problem with I stuck is how to switch toolchains in CLion.
I want to switch the toolchain from MinGW to Visual Studio and I can switch it by making Visual Studio toolchain as default (File->Settings->Build, Execution, Deployment->Toolchains->Select Visual Studio->Click Up arrow).
But I don't want to make this toolchain as default.
I just wanted to try it.
Should I press this up arrow button if I want to switch toolchains or there is any simpler way?
Thanks.
No need to many any toolchain a default one. Do the following:
Configure all necessary toolchains in settings. https://www.jetbrains.com/help/clion/how-to-create-toolchain-in-clion.html
Then in Settings | Build, Execution, Deployment | CMake configure several CMake profiles using different toolchains. https://www.jetbrains.com/help/clion/configuring-cmake.html#CMProfile
Then in the same switcher where you can change the run/debug configuration, there is also a list of available CMake profiles with corresponding toolchains. Select the combination you need and then you can run/debug.
1. Add Toolchains:
2. Switch in CMake tab, like below:

How to run MFC application in windows XP without C++ redistributable support

My Development Environment is
C++
Visual Studio 2008
Windows 7
I'm going to start a project (MFC application) and final result (exe) should run on windows xp, vista ,windows 7 or windows 8 without installing any extra packages (like Visual C++ Redistributable package).
Questions:
Which kind of project I should select in visual studio?
What are the project settings I should specify?
You have to use MFC as a static library. Pay attention in project creation wizard for this option.
These are the basic things you have to consider when you start a project in Visual studio that need to run in target computer without installing any other redistribute components.
You have to select project type Win32-> Win32 Console Application or Win32-> Win32 Project as your console or GUI requirements.
You must select No Common Language Runtime support in right click project in solution explorer -> Properties -> General -> Common Language Runtime support
Your application need run-time assemblies to run in target computer. There is two methods to deploy run time DLLs in target computer
Assemblies link statically ( right click project in solution explorer -> Properties -> General -> Use of MFC and Use of ATL). but if your application combine with multiple DLL EXE and LIBs, this method is quite troublesome.
Deploy Runtime DLLs in target computer as private assemblies (I personally recommend this method). More details here
Expanding upon what's already been said..
You need to set the project to build as a static library:
Right click the project
Go to "Properties->Configuration Properties->General->Project Defaults->Use of MFC" set to "Use MFC in a Static Library"
You may also need to turn off the /MD flag if you're using it, and swap it out for '/MT' instead:
Right click the project
Go to "Properties->Configuration Properties->C/C++->Code Generation->Runtime Library" set to "Multi-threaded /MT"

How to correct the Platform to AnyCPU in a multiple-project solution in Visual Studio?

I had a solution with one project set to AnyCPU. Then I added a Console application as a second project, who's default Platform seems to be x86. Now it's ( - the Console application) being built as an x86 and I can't change it.
The "Solution Platform" always shows "AnyCPU". But when I show the Console application's properties -> build. It shows x86 without any way to change it. So how do I change it?
Go to Build -> Configuration Manager
Select for the overall solution the Active Platform = AnyCPU
Go to the Console Application line and Set the Platform to AnyCPU
If there isn't the voice create a new configuration
Check that the Console Application is flagged for compile.
Also look at this discussion about console applications default to x86
This is an unfortunate flaw in the VS user interface design. The solution's Platform name is not relevant for managed projects, it only means something for native C++ projects. Where "AnyCPU" doesn't mean anything since native code cannot run on any cpu. This got a wee bit better in VS2010 with a new default Platform name of "x86". Merely a wee.
The only setting that really counts is the Platform target setting for the EXE project. Project + Properties, Compile tab for a C# project. The class library project settings are not relevant either since it is the EXE that nails down the bitness of the process.
Best thing to do is just ignore it. You can make that more permanent with Tools + Customize and just drag the combobox off the toolbar so you don't have to look at it again.

Windows Driver Development with Eclipse

Is that possible to integrate WDK into Eclipse? WDK seems to have its own compiler and debugger, so I wonder if there is a plug-in or it could be done manually?
See DDKBUILD for an example of how to launch the WDK build procedure from a bath file:
http://www.osronline.com/article.cfm?article=43
Typically all you need to do is modify this procedure to fit your IDE.
-scott
Run Eclipse from build environment that you need (free or checked with needed architecture)
Create project or import C/C++ / Existing code as makefile project. Select GNU Toolchain.
Properties -> Builders -> New -> Environment -> Select, select all variables, mark "add to all configurations", select "replace native environment with specified on". On the Main tab select full path to build.exe of the selected build environment. Select your project directory in workspace as "working directory"
Properties -> C/C++ Build -> On Bulder Settings tab remove "Use default build command" flag and type "build"
Properties -> C/C++ Build -> Tool Chain Editor -> Select Tools. Personaly I selected msvc compilers.
Properties -> C/C++ General -> Paths and Symbols -> select includes that you need including WDK ones
Enjoy

Resources