Skip to Main Content
Sockets, Shellcode, Porting, and Coding: Reverse Engineering Exploits and Tool Coding for Security Professionals
book

Sockets, Shellcode, Porting, and Coding: Reverse Engineering Exploits and Tool Coding for Security Professionals

by James C Foster
April 2005
Intermediate to advanced content levelIntermediate to advanced
700 pages
20h 39m
English
Syngress
Content preview from Sockets, Shellcode, Porting, and Coding: Reverse Engineering Exploits and Tool Coding for Security Professionals
16 /* print out if compiled on Win32 */
17 printf("WIN32\n" );
18 #else
19 printf("?\n");
20 #endif
21
22
return(0);
23 }
Example Execution
Let’s look at the Win32 and UNIX output.
Win32 Output
C:\>ifdef1.exe
WIN32
UNIX Output
obsd32# gcc –o ifdef1 ifdef1.c
obsd32# ./ifdef1
OpenBSD
Analysis
At line 12, an ifdef pre-compiler directive is used to determine if the operating
system that the program is being compiled on is OpenBSD. If it is, the code at
line 14 will be compiled, not the code at line 17.
At line 15, an ifdef pre-compiler directive is used to determine if the operating
system that the program is being compiled on is a Win32 platform. If it is, the
code at line 17 will be compiled, not the code at line 14.
At lines 14 and 16, the printf() function is called ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

32/64-Bit 80x86 Assembly Language Architecture

32/64-Bit 80x86 Assembly Language Architecture

James Leiterman

Publisher Resources

ISBN: 9781597490054