How to code a Linux kernel module?

You are missing the module_init() and module_exit() macros and some crucial #defines. We need more information as well such as your make/gcc options. It may be reporting the "invalid module format" because you are compiling in 32bit when your kernel is 64bit, so ensure you are using the -64 compile and link flag.

A great hello world tutorial for Kernel Modules is located here: http://archive.is/KNkEE (the original link to the article is broken).

Welcome to writing kernel modules. They are a lot of fun compared to writing Windows drivers (I've done both). The linux kernel module interface is much simpler to use and there is a lot of base drivers you can delegate to and get the work done faster.