Fully creating executables by hand
Posted: Sun Sep 18, 2011 1:59 am
Here is the situation: I have found that simply using compilers and linkers isn't very beneficial for me to understand executables at a system level; so I have been coding a few EXEs completely by hand to better see the system behavior, and better and really grasp the workings of a system itself, be it Linux, Windows, etc, and then use that knowledge on my own. I need information on how to do this with ELF/Linux binaries for 32 and 64 bits.
I have been reading the ELF specification, but without much success.
Below I have attached 3 Win32 programs with source code.
They show what I can do until now:
- I can manually create the skeleton of a Portable Executable program fully using 32-bit NASM assembly and macros
- I can use icons (implying I used icon resources of the "rsrc" section)
- I can import functions from DLLs using the "import section", only WinAPI but presumably other "normal" DLLs
- I can use Unicode strings but have to code them manually (how is it supposed to be correctly done in an assembly or a C source file?)
This is what I need or can't do right now:
- I definitely don't know how to call things/frameworks/etc. specific to C++; how to implement it in assembly and/or which conventions? Where are they?
- I can't setup startup routines that handle command lines, etc.
- I cannot create DLLs
- I can't create drivers manually but need to do so, but don't know where to find information
- I understand the memory and heap usage only to a completely basic level
- I need this kind of information for ELF too, where to find it in such detail?
And most important: knowing what I have done and cannot do by now, what should be the next thing I should master, and that I can return later to show you the results and achieve progress?
By the way, I learned a lot about the PE format here:
TinyPE
And also thanks to Matt Pietrek articles, and the pecoff_v8 specification.
And this is the GWIOPM driver, which I am trying to duplicate, but by hand, to use it as a way to truly understand stuff fully and nearer to the "true" OS level:
http://www.grahamwideman.com/gw/tech/De ... gwiopm.zip
http://www.grahamwideman.com/gw/tech/De ... /index.htm
For instance, to use driver APIs and functionality, what DLLs, or exactly what and how should I import, etc?
I'll also try to publish information about what I've achieved with PE executables when I clear out a lot of misconceptions I have identified from what I documented in the process; although you can browse the included assembly NASM source code and their included precompiled binaries.
I have been reading the ELF specification, but without much success.
Below I have attached 3 Win32 programs with source code.
They show what I can do until now:
- I can manually create the skeleton of a Portable Executable program fully using 32-bit NASM assembly and macros
- I can use icons (implying I used icon resources of the "rsrc" section)
- I can import functions from DLLs using the "import section", only WinAPI but presumably other "normal" DLLs
- I can use Unicode strings but have to code them manually (how is it supposed to be correctly done in an assembly or a C source file?)
This is what I need or can't do right now:
- I definitely don't know how to call things/frameworks/etc. specific to C++; how to implement it in assembly and/or which conventions? Where are they?
- I can't setup startup routines that handle command lines, etc.
- I cannot create DLLs
- I can't create drivers manually but need to do so, but don't know where to find information
- I understand the memory and heap usage only to a completely basic level
- I need this kind of information for ELF too, where to find it in such detail?
And most important: knowing what I have done and cannot do by now, what should be the next thing I should master, and that I can return later to show you the results and achieve progress?
By the way, I learned a lot about the PE format here:
TinyPE
And also thanks to Matt Pietrek articles, and the pecoff_v8 specification.
And this is the GWIOPM driver, which I am trying to duplicate, but by hand, to use it as a way to truly understand stuff fully and nearer to the "true" OS level:
http://www.grahamwideman.com/gw/tech/De ... gwiopm.zip
http://www.grahamwideman.com/gw/tech/De ... /index.htm
For instance, to use driver APIs and functionality, what DLLs, or exactly what and how should I import, etc?
I'll also try to publish information about what I've achieved with PE executables when I clear out a lot of misconceptions I have identified from what I documented in the process; although you can browse the included assembly NASM source code and their included precompiled binaries.