Win32ASM
Tutorial
This is my Win32ASM tutorial. It is always created, but I will continue to add content. You can go back and front page via NEXT and PREV links above.
Introduction
First make a small introduction to this tutorial. Win32ASM is not a very popular programming language and is only a few (but very good) tutorials. Most tutorials are focused on programming Win32 (eg, WinAPI, using standard Windows programming technology, etc.), rather than assembly language itself, such as the use of pseudo code, register (registers). Although you can find these in other tutorials, those tutorials are usually explained to DOS programming. Of course, you can help you learn the language, but in Windows, you no longer need to know the DOS interrupt and the fracture (Port) IN / OUR function. In Window, Windowsapi provides the standard function (Function) you can use in your program, and there will be more of this later. The goal of this tutorial is to learn the assembly language itself at the same time as the compilation Win32 program.
1.0 assembly language
The assembly is created instead of the original binary code understood by the processor. A long time ago, but there is no advanced language, and the program is written by compilation. Assembly code directly describes the code that the processor can perform, for example:
Add Eax, EDX
This instruction -ADD-adds two values together. EAX and EDX are called registers, they can save values inside the processor. This code is converted to 66 03 C2 (16). The processor reads this line of code and executes the instructions it represents, translates their own language as assembly language, and the assembler is converted to binary code:
C code
>> C Compiler>>>>>
Assembly language
>> Compiler >>
Original output (hexadecimal)
A = a b;
Add Eax, EDX
66 03 C2
(Note that the code of the assembly language of the site is simplified, the actual output is determined in the context of the C code)
1. 1- Why? (Why?)
Since writing procedures with ASM, why do you use ASM instead of c or something else? ? - The program generated by the assembly is smaller and faster. In the advanced programming language with artificial intelligence, the compiler is more difficult to generate output code (than assembly). The compiler must indicate the fastest (or smaller) way to generate assembly code, and although the compiler becomes more better, you write (assemble) code (including optional code optimization) to generate smaller faster Code. However, of course, this is much more difficult than the advanced language. There is also a different way to some of the high-level languages that use runtime DLLs, they are working in most, but sometimes because the DLL version (DLL HELL) is generated and the user always installs these DLLs. For Visual C , this is not a problem, they are installed with Windows. Visual Basic even translated its language into assembly languages (although 5 versions and above, not complete). It is highly dependent on the MSVBVM50.DLL-Visual Baisc virtual machine. The EXE file generated by VB only has simple code and many of these DLL calls. This is why VB is slow. Compilation is the fastest in all. It only uses the system's DLL like kernel32.dll, user32.dll, etc. Another misunderstanding is that many people think that compilation cannot be used to program. Of course, it is difficult, but it is not impossible. It is difficult to create a big project with compilation, I just use it to write a small program, and the code used to require speed is written in the DLL that can be imported by other languages. Moreover, DOS and Windows have a big difference. The DOS program uses the interrupt when "function". As interrupt 10 is used to display, interrupt 13 is used for file storage, and the like. In Windows, the API function is only name (such as MessageBox, CREATEWINDOWSEX). You can import library (DLL) and use the functions. This makes it easy to use ASM write programs. You will learn more about this in this regard in the next chapter.
2.0 start
The introduction is enough, let us start now. To write a program, you need some tools. Below, you can see which tools I will use in this tutorial. I suggest you install the same tool, so you can test those examples follow the tutorial. I also give some other options, although you can choose most of them, but to warn that there is a big difference in the assembler (MASM, and NASM). In this tutorial, MASM will be used because it has a useful function (like invoke), which makes programming easier. Of course, you can choose your more favorite assembler, but this will make you more difficult to take the tutorial and you have to process the examples in the tutorial to run in the assembler you.
Assembler
My choice: MASM (in Win32ASM package)
Website: win32asm.cjb.net
Description: A assembler that translates pseudo code (opcodes) to the original output (Object file) read by the processor
About: MASM, Macro (Macro) assembler is a multi-use-use feature. Like "Invoke", it can simplify the call to the API function and check the data type. You will learn behind this tutorial. If you read the words above, you know that this tutorial recommends using MASM.
Offer selection: Tasm [DL], NASM [DL]
Linker
My choice: Microsoft Additional Links (Link.exe) URL: Win32ASM.cjb.net (in Win32ASM Pack)
Description: The linker outputs the object (Object) file and the library file (imported with the DLL "link" to the final executable.
About: I will use Lin.exe in the ICZelion's Win32ASM package. But most of the linkers can be used.
Option: Tasm Linker [DL]
Resource editor
My choice: Borland Resource Editor
Website: www.crackstore.com
Description: A resource editor used to create a resource (graphics, dialog, bitmap, menu, etc.).
About: Most editors can be. I personal hobby is resource workshop but you can use you like. Note Because Resource Workshop's resource files are sometimes brought to the resource compilation, if you want to use this editor, you should down TASM, and he contains BRC32.exe for compiling Borland style resources.
Option: Symantec Resource Editor, Resource Created, etc.
text editor
My choice: UltraEdit
Website: www.ultraedit.com
Description: Do you need to explain a text editor?
About: The selection of text editors is very personal. I really like UltraEdit. You can download the grammar files I write for UltraEdit, so that the assembly code syntax can be highlighted. But at least, choose a text editor that supports syntax (keywords automatic color color). This is very useful and it makes your code easier to read and easier to write. UltraEdit has a list of functions that allow you to quickly jump to a function in your code.
Option: One of millions of text editor
Reference book
My choice: Win32 programmer reference manual
Website: www.crackstore.com (or search for the internet)
Description: You need a number of references to the API function. The most important thing is "WIN32 Programmer Reference Manual" (Win32.hlp). This is a big file, about 24MB (some versions are 12MB, but not all). In this file, all system DLL functions (kernel, user, gdi, shell, etc.) have been explained. You need at least this file, other references (Sock2.hlp, mmedia.hlp, ole.hlp, etc.) are helpful but don't.
Option: N / a
(Translator Note: This tutorial is composed earlier, and now there is an excellent MSDN to choose from)
2. 1 installation tool
Now you have got these tools and install them to a place. There are several places worth noting:
Install the MASM package to the area you intend to write the transfer program. This guarantees the correctness of the file path. Add MASM (and TASM) bin directory to the PATH of AutoExec.bat, and weigh.
If you use UltraEdit, use the syntax file you can download in front and enable Function-ListView (List View).
Create a Win32 folder (or other name you like) in a place and create a subfolder for each of the projects you created.