I want to write a c program that can detect CPU id for activation process. Some advise me to use UUID but I like to try CPU id instead. After searching I found some good answer. But I am using Windows 8 64bit and Mingw. So I am afraid I cant use it.
Yes, two pieces of information, since you wanted to be guided and not shown code :)
Use the CPUID x86 instruction http://x86.renejeschke.de/html/file_module_x86_id_45.html
... with gnu inline assembler syntax for C programs https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html
That's it. Create a small inline C function that has an asm {} block in it and the single instruction inthere would be CPUID.Be aware of how to return values from these assembly blocks, gcc has a special syntax for it.
With this info, I reckon you can solve your problem.