programmers resources
  http://www.intel-assembler.it/  (c)2017 intel-assembler.it   info@intel-assembler.it
 
Search :  
Lingua Italiana    English Language   
Index
 
just an empty assembly space
just an arrow Intel Platform
just an arrow Article & Guides
just an arrow Download Software


23/01/2009 Featured Article: How to remove Buzus Virus (permalink)




:::3141144:::
Bottone Scambio Directory Pubblicitaonline.it
Home Page | Articles & Guides | Download | Intel Platform | Contacts

Google
 


Bookmark and Share
Download 
Tell a friend



Win32 asm

Manage win32 projects in assembly language

(by unknown)

A very nice guide about win32 asm programming which coveres different arguments in about 50 pages.


This article is online from 2922 days and has been seen 10531 times




Win32ASM

Microsoft never documented the way to develop applications for Win32 Intel
platforms using assembly language. The only assembly language documentation
that Microsoft ever produced on the topic is the Win95 DDK, dedicated to the
development of virtual drivers (VxD) in the Win95 environment, and it 
scarcely covers any Ring 3 application programming matter.

In addition; development in a Win32 environment requires the use of numerous
reference data, such as function prototypes; structures, type and constant
definitions, macros and other data. Microsoft released these items as C 
header files (.H files) in the Win32 SDK, but no equivalent files were ever
published for assembly language.

This complete lack of documentation and tools propagates the illusion that
developing in assembly language for Win32 is something that simply could not 
be done. This is aggravated by answers commonly provided by Microsoft's 
developer's support staff, claiming that "assembly language programming for 
Win32 is not supported by Microsoft" and even more often that "No, it 
cannot be done."

The truth is very different. Programming in assembly language for Win32 is
indeed very possible,

* it is just as simple to achieve as with a High Level Language (HLL),
* there is nothing magic about it,
* the tools are the same, and
* with some initial explanations and road-mapping, the considerable C-oriented
  documentation that Microsoft (and others) have released can be used to 
  program in assembly language.


1 INTRODUCTION                                                           6
1.1 WHAT THIS DOCUMENT IS NOT ABOUT                                      7
1.2 WHAT THIS DOCUMENT IS ABOUT (AND PREREQUISITES)                      7
1.3 KEEP THE BALL ROLLING...                                            10
2 PRODUCT CHOICES                                                       11
2.1 CHOOSING AN ASSEMBLER                                               11
2.1.1 MASM 6.11a, 6.11d and 6.12                                        11
2.1.1.1 MASM availability (and uncertain future)                        11
2.1.1.2 MASM capabilities                                               12
2.1.2 TASM 5.0                                                          13
2.1.3 Other assemblers                                                  13
2.2 CHOOSING A LINKER                                                   13
2.3 CHOOSING A DEBUGGER                                                 14
2.4 CHOOSING A GUI IDE                                                  14
2.4.1 The bad news is...                                                14
2.4.2 The good news is...                                               15
2.4.2.1 Programmer's IDE for Windows 95/NT v2.3                         15
2.4.2.2 Watcom's 10.6 IDE.                                              15
3 BUILDING AN ASSEMBLY LANGUAGE WIN32 APPLICATION                       17
3.1 USING MASM                                                          17
3.1.1 MASM Vs ML                                                        17
3.1.2 MASM Documentation                                                17
3.1.3 Your MASM source code                                             18
3.1.3.1 Use of registers                                                18
3.1.3.2 Function call conventions                                       20
3.1.3.2.1 The naming convention                                         20
3.1.3.2.2 The parameter passing convention                              21
3.1.3.3 Win32 (and other) function prototypes                           22
3.1.3.4 The INCLUDELIB directive                                        23
3.1.3.5 Segments and sections                                           24
3.1.3.6 Alignment issues                                                25
3.1.3.7 END statement and Entry Point.                                  26
3.1.4 MASM options                                                      27
3.1.5 Miscellaneous OS and systems issues                               28
3.1.5.1 Beware of the CLI                                               28
3.1.5.2 Beware of the STD                                               29
3.1.6 Various MASM goodies                                              29
3.1.6.1 Data Types                                                      29
3.1.6.2 Base and Index                                                  30
3.1.6.3 Structures and Unions                                           30
3.1.6.4 Local directive                                                 30
3.1.6.5 INVOKE through a function pointer                               31
3.1.6.6 Global labels                                                   32
3.1.6.7 Structured programming directives                               32
3.1.6.8 Structure addressing                                            33
3.1.6.9 Use of SIZEOF & LENGTHOF                                        34
3.1.6.10 Use of TYPEDEF                                                 34
3.1.6.11 Use of ALIAS                                                   34
3.1.7 MASM bugs and shortcomings                                        35
3.1.7.1 Invalid code generation in INVOKE using 16 bit parameters       35
        (or a mix of 16 and 32 bit)
3.1.7.2 The infamous 512 bytes buffer                                   35
3.1.7.3 INVOKE and forward references                                   36
3.1.7.4 Macro limitations                                               36
3.1.7.5 Listing generation                                              36
3.1.7.6 Missing conditions in structuring directives                    36
3.1.7.7 Major flaws in the MASM macro language                          38
3.2 USING LINK                                                          39
3.2.1 Libraries                                                         39
3.2.2 Debugging options                                                 39
3.2.3 Linking an .EXE file                                              40
3.2.3.1 Linking a Console executable                                    40
3.2.3.2 Linking a Windows executable                                    40
3.2.4 Linking a DLL file                                                40
3.2.5 Advanced linking techniques                                       41
3.2.5.1 Grouped Sections                                                41
3.2.5.2 DLL forwarders                                                  42
3.2.5.3 Weak Externals                                                  43
3.3 DEBUGGING AN ASSEMBLY LANGUAGE WIN32 APPLICATION                    43
4 VARIOUS GRIPES                                                        44
4.1 THE ABSENCE OF LDT SUPPORT IN INTEL-BASED PLATFORMS                 44
5 WIN32ASM TOOLKIT                                                      49
5.1 THE EXAMPLE FILES                                                   49
5.2 THE INCLUDE FILES                                                   49
5.2.1 General Include files                                             50
5.2.1.1 Win32Inc.equ                                                    50
5.2.1.1.1 UnicAnsi.equ                                                  50
5.2.1.1.1.1 The UnicAnsiExtern macro:                                   50
5.2.1.1.1.2 The String macro                                            51
5.2.1.1.2 Win32Types.equ                                                51
5.2.1.1.3 Win32Defs.equ                                                 51
5.2.1.1.4 Win32Strs.equ                                                 51
5.2.1.2 Win32Res.equ                                                    51
5.2.2 API header include files                                          51
5.2.2.1 CommCtl32.equ                                                   52
5.2.2.2 CommDlg32.equ                                                   52
5.2.2.3 GDI32.equ                                                       52
5.2.2.4 Kernel32.equ                                                    52
5.2.2.5 TAPI32.equ                                                      52
5.2.2.6 User32.equ                                                      52
5.2.2.7 WinMM.equ                                                       52
5.2.2.8 WinSpool.equ                                                    52
5.3 THE MACRO FILES                                                     52
5.3.1 Instr.mac                                                         52
5.3.1.1 Structuring directive extensions                                52
5.3.1.1.1 .BLOCK & ENDBLOCK                                             52
5.3.1.1.2 FOREVER                                                       53
5.3.1.1.3 Condition mnemonics in structuring directives                 53
5.3.1.2 Saving and restoring registers                                  53
5.3.1.3 UnusedParm                                                      54
5.3.1.4 Internal consistency checking macros                            54
5.3.1.4.1 MUSTBE                                                        54
5.3.1.4.2 MUSTBEM                                                       55
5.3.1.4.3 MUSTBEMGLE                                                    55
5.3.1.4.4 SHOULDBE                                                      55
5.3.1.5 Enumeration macros                                              55
5.3.1.6 Breakpoint macros                                               56
5.3.2 InitExit.mac: Runtime Initialization / Termination Macros         56
5.4 THE SERVICE ROUTINES                                                60
5.4.1 FatalError                                                        60
6 BIBLIOGRAPHY                                                          60
6.1 [BOOTH, 96.01]                                                      60
6.2 [BRAIN, 96.01]                                                      60
6.3 [INTEL, 95.01]                                                      61
6.4 [PETZOLD 96.01]                                                     61
6.5 [PIETREK 95.01]                                                     61
6.6 [RECTOR & AL, 96.01]                                                61
6.7 [RICHTER 96.01]                                                     61
6.8 [RICHTER 97.01]                                                     61
6.9 [SCHULMAN 94.01]                                                    61

(*** download for full text ***)



Top
Download 
Tell a friend
Bookmark and Share



Similar Articles

64-Bit - Programming and Assembly Issues
Brief intro on 64 bit architecture and programming
(by Thorsten Schneider)

8080/8085 Assembly Language Programming
Assembly Language Programming Manual
(by Intel Corporation)

8085 TRS 80 Model 100 Assembly Programming
Brief guide on 8085 architecture and programming
(by Mike Berro - BCS Software)

Adam's Assembler Tutorial 1.0
A tutorial in 9 lessons on Assembler
(by Adam)

AMD64 Architecture Programmerís Manual Volume 3
General-Purpose and System Instructions
(by AMD)

AMD64 Architecture Programmerís Manual Volume 4
128-Bit Media Instructions
(by AMD)

AMD64 Architecture Programmer's Manual Volume 2
System Programming
(by AMD)

AMD64 Architecture Programmer's Manual Volume 5
64-Bit Media and x87 Floating-Point Instructions R
(by AMD)

AMD64 Programmerís Manual Volume 1
Application Programming
(by AMD)

Assembler Tutorial 1996 Edition
A guide from Guadalahara University
(by Hugo Perez Univ.Guadalajara)

Assembly Language Programming
A 14 page intro for beginners using NASM
(by Archis Gore)

Assembly language programming under Unix
A small guide for intermediate level programmers
(by G. Adam Stanislav)

Brennan's Guide to Inline Assembly
A guide to inline Unix assembly programming
(by Brennan)

Cinchy Assembly Web Server
An efficient and simple web server written in x86
(by Sterling Stuart Stein (S≥))

DLL: how to create them in x86 assembly
Example code for creating DLLs
(by G. Adam Stanislav)

Extending DOS Executables
How to modify a Windows executable relocating code
(by Digital Alchemist)

GAVIN'S GUIDE TO 80x86 ASSEMBLY
A guide about Assembler in 8 parts
(by Gavin Estey)

How to start building Win32 application with ASM
Programmaz. Win32 e GoAsm32
(by Wayne J. Radburn)

IBM Personal Computer Assembly Language Tutorial
A guide that introduces main topics of asm lang
(by Joshua Auerbach)

Intro to Assembler
An intro to Intel ASM programming
(by VLA)

Masm 5 Instructions, Directives and Interrupts
A 30 page listing for assembly programmers
(by n/d)

Optimizations for Intel's 32-Bit Processors
A 49 page guide on Intel Asm Code Optimization
(by Bev Zaharie)

PC Assembly Language Manual
A book to learn basic Assembly in 195 pages (pdf)
(by Paul Carter)

Programming from the ground up
EBook on Linux Assembler programming
(by Jonathan Bartlett)

Protected Mode Tutorial v.0.02
Tutorial for Protected Mode programming in asm
(by Till Gerken)

SIB Small is Beautifull
An small asm template of a WIN32 application
(by Steve Gibson)

Sk00l m3 ASM!!#@$!@#
An assembly programming guide
(by Ralph (AWC))

Static Detection of Vulnerabilities in x86 Code
Analysis of assembly code for security problems
(by M.Cova V.Felmetsger G.Banks G.Vigna)

The PC GAMES PROGRAMMERS ENCYCLOPEDIA 1.0
A collection of 85 asm programming documents
(by various)

Win32 Course in 35 Lessons
Una guida con codice d'esempio per w32asm
(by Iczelion)

x86 ASM Programming for Linux
Intro to assembly programming on Linux using NASM
(by mammon_)

X86 Assembly Tips And Tricks
Asm coding programming tricks
(by Laura Fairhead)

x86 Quick Reference Instruction Manual
8086/80186/80286/80386/80486 Instruction Set
(by thenet)

 Tags: win32, asm tutorial


webmaster jes
writers rguru, tech-g, aiguru, drAx

site optimized for IE/Firefox/Chrome with 1024x768 resolution

Valid HTML 4.01 Transitional


ALL TRADEMARKS ® ARE PROPERTY OF LEGITTIMATE OWNERS.
© ALL RIGHTS RESERVED.

hosting&web - www.accademia3.it

grossocactus
find rguru on
http://www.twitter.com/sicurezza3/
... send an email ...
Your name

Destination email

Message

captcha! Code