Author Topic: Problems developing a 64bit driver  (Read 2915 times)

Offline msim

  • Single posting newcomer
  • *
  • Posts: 8
Problems developing a 64bit driver
« on: October 16, 2016, 07:37:27 pm »
Hi,

I am trying to create a simple driver - something I can register and watch a printed "Driver loaded!" using debugview from sysinternals.

I'm using a Windows 8.1 64bit host machine, and tried to compile the driver using Code::Blocks Kernel Mode Development and GNU GCC compiler.

The compiled driver turned out to be specifically for 32bit systems, and I know that because sc.exe returned error 1275 which I searched on the web.

I tried to use WDK's ntddk.h file, but it is not supported by GNU GCC.

Please not that I am not interested in using Visual Studio for the task.

Thanks for answers !

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11939
    • Travis build status
Re: Problems developing a 64bit driver
« Reply #1 on: October 16, 2016, 09:43:17 pm »
Are you sure you've installed GCC capable to produce 64bit executables?
Why aren't you interested in using the visual studio compiler?
Do you know you can use C::B to compile with this compiler?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline msim

  • Single posting newcomer
  • *
  • Posts: 8
Re: Problems developing a 64bit driver
« Reply #2 on: October 16, 2016, 10:51:08 pm »
Are you sure you've installed GCC capable to produce 64bit executables?
Why aren't you interested in using the visual studio compiler?
Do you know you can use C::B to compile with this compiler?

1 - No, I'm not sure I've installed such GCC. How can I be?
2 - It's not that I'm not interested in it -- I am not interested in the VS ide.
3 - Yes, I do.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6613
    • My Best Post
Re: Problems developing a 64bit driver
« Reply #3 on: October 16, 2016, 11:06:48 pm »
Are you sure you've installed GCC capable to produce 64bit executables?
Why aren't you interested in using the visual studio compiler?
Do you know you can use C::B to compile with this compiler?

Quote from: msim
1 - No, I'm not sure I've installed such GCC. How can I be?
Learn about the C++ Compiler you are using!
Learn whether it can do what you want to do!


Quote from: msim
2 - It's not that I'm not interested in it -- I am not interested in the VS ide.
Quote from: msim
3 - Yes, I do.
So, you know that the Visual Studio Compiler can be used with the CB IDE.

Tim S.
« Last Edit: October 16, 2016, 11:08:31 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Manolo

  • Multiple posting newcomer
  • *
  • Posts: 47
Re: Problems developing a 64bit driver
« Reply #4 on: October 17, 2016, 02:18:26 am »
Hint: GNU GCC is for Linux. For Windows you must use a "GCC for Windows". Look for MinGW or MinGW-64 or TDM-GCC or some one else.

Offline msim

  • Single posting newcomer
  • *
  • Posts: 8
Re: Problems developing a 64bit driver
« Reply #5 on: October 17, 2016, 06:34:03 pm »
Hint: GNU GCC is for Linux. For Windows you must use a "GCC for Windows". Look for MinGW or MinGW-64 or TDM-GCC or some one else.

I'm using C::B's GCC compiler which is MinGW

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2464
Re: Problems developing a 64bit driver
« Reply #6 on: October 17, 2016, 07:30:39 pm »
I tried to use WDK's ntddk.h file, but it is not supported by GNU GCC.
you can try the mingw64 fork. It is more up to date with the windows sdk then the normal mingw or tdm mingw that ships with c::b

*) If you want to use the mingw64 fork you have to uninstall all mingw related compiler from your system. If you are using the c::b version what is shiped with a preinstalled compiler you have to uninstall it, and install a version without compiler. Then install the mingw64 compiler and set up codeblocks so it can find the executables ( Settings->Compiler->Toolchain executables )
NOTE: i am not quite sure if mingw64 supports the windows driver sdk, you have to google it
NOTE2: i think for driver development you need the windows sdk, and for this you have to use the windows compiler

*) You can have multiple compiler installed, but especially with mingw this is a thing for advanced user, and i don't have the time to write a step by step guide of how to do it.

greetings

Offline msim

  • Single posting newcomer
  • *
  • Posts: 8
Re: Problems developing a 64bit driver
« Reply #7 on: October 18, 2016, 09:59:18 am »
I tried to use WDK's ntddk.h file, but it is not supported by GNU GCC.
you can try the mingw64 fork. It is more up to date with the windows sdk then the normal mingw or tdm mingw that ships with c::b

*) If you want to use the mingw64 fork you have to uninstall all mingw related compiler from your system. If you are using the c::b version what is shiped with a preinstalled compiler you have to uninstall it, and install a version without compiler. Then install the mingw64 compiler and set up codeblocks so it can find the executables ( Settings->Compiler->Toolchain executables )
NOTE: i am not quite sure if mingw64 supports the windows driver sdk, you have to google it
NOTE2: i think for driver development you need the windows sdk, and for this you have to use the windows compiler

*) You can have multiple compiler installed, but especially with mingw this is a thing for advanced user, and i don't have the time to write a step by step guide of how to do it.

greetings

I tried to install mingw64, it seems I have to compile it using GNUWin's 'Make', but I fail in doing it. Could you help me?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2464
Re: Problems developing a 64bit driver
« Reply #8 on: October 20, 2016, 12:04:32 am »
I tried to install mingw64, it seems I have to compile it using GNUWin's 'Make', but I fail in doing it. Could you help me?
i didn't had to do any compiling...

Download win_build and install it... (you have to klick on the "process" button on the right top)
http://win-builds.org/doku.php/download_and_installation_from_windows

Then you have to set up the compiler:
1) Start codeblocks
2) Settings->Compiler
3) Selected compiler: "GNU GCC Compiler" -> Copy -> Enter the name "Mingw64_win_build" -> OK -> OK
4) Selected compiler: "Mingw64_win_buils" -> Toolchain executables
5) Compilers installation directory -> ... -> Browse to the installation directory of win_build and there to the "bin" sub folder -> Ok
6) remove the "mingw32-" part from the Program Files -> Ok
7) Create a new project but select "Mingw64_win_buils" when asked for the Compiler
7b) if you want to migrate a existing project:
  1) Project-> Build options->On the left select your project (top most entry)->Selected compiler->"Mingw64_win_buils"-> Yes -> Ok
  2) !!!!! Make a full rebuild !!!!! -> Build->Rebuild

i hope this helps
greetings

Offline msim

  • Single posting newcomer
  • *
  • Posts: 8
Re: Problems developing a 64bit driver
« Reply #9 on: October 21, 2016, 04:50:12 pm »
I tried to install mingw64, it seems I have to compile it using GNUWin's 'Make', but I fail in doing it. Could you help me?
i didn't had to do any compiling...

Download win_build and install it... (you have to klick on the "process" button on the right top)
http://win-builds.org/doku.php/download_and_installation_from_windows

Then you have to set up the compiler:
1) Start codeblocks
2) Settings->Compiler
3) Selected compiler: "GNU GCC Compiler" -> Copy -> Enter the name "Mingw64_win_build" -> OK -> OK
4) Selected compiler: "Mingw64_win_buils" -> Toolchain executables
5) Compilers installation directory -> ... -> Browse to the installation directory of win_build and there to the "bin" sub folder -> Ok
6) remove the "mingw32-" part from the Program Files -> Ok
7) Create a new project but select "Mingw64_win_buils" when asked for the Compiler
7b) if you want to migrate a existing project:
  1) Project-> Build options->On the left select your project (top most entry)->Selected compiler->"Mingw64_win_buils"-> Yes -> Ok
  2) !!!!! Make a full rebuild !!!!! -> Build->Rebuild

i hope this helps
greetings

I managed to do it, but I still get error 1275 .. I'm using the following as ntddk.h source: https://sourceforge.net/u/earnie/winapi/winapi/ci/master/tree/

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6613
    • My Best Post
Re: Problems developing a 64bit driver
« Reply #10 on: October 21, 2016, 08:36:36 pm »
Do you have any reason to believe "https://sourceforge.net/u/earnie/winapi/winapi/ci/master/tree/" is 64 bit instead of 32 bit the way it looks to me?

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline msim

  • Single posting newcomer
  • *
  • Posts: 8
Re: Problems developing a 64bit driver
« Reply #11 on: October 22, 2016, 12:34:24 am »
Do you have any reason to believe "https://sourceforge.net/u/earnie/winapi/winapi/ci/master/tree/" is 64 bit instead of 32 bit the way it looks to me?

Tim S.

No, but I can't find a 64bit one