Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Windows APT Warfare

You're reading from   Windows APT Warfare Identify and prevent Windows APT attacks effectively

Arrow left icon
Product type Paperback
Published in Mar 2023
Publisher Packt
ISBN-13 9781804618110
Length 258 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Sheng-Hao Ma Sheng-Hao Ma
Author Profile Icon Sheng-Hao Ma
Sheng-Hao Ma
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Part 1 – Modern Windows Compiler
2. Chapter 1: From Source to Binaries – The Journey of a C Program FREE CHAPTER 3. Chapter 2: Process Memory – File Mapping, PE Parser, tinyLinker, and Hollowing 4. Chapter 3: Dynamic API Calling – Thread, Process, and Environment Information 5. Part 2 – Windows Process Internals
6. Chapter 4: Shellcode Technique – Exported Function Parsing 7. Chapter 5: Application Loader Design 8. Chapter 6: PE Module Relocation 9. Part 3 – Abuse System Design and Red Team Tips
10. Chapter 7: PE to Shellcode – Transforming PE Files into Shellcode 11. Chapter 8: Software Packer Design 12. Chapter 9: Digital Signature – Authenticode Verification 13. Chapter 10: Reversing User Account Control and Bypassing Tricks 14. Index 15. Other Books You May Enjoy Appendix – NTFS, Paths, and Symbols

The simplest Windows program in C

Any software is designed with some functionality in mind. This functionality could include tasks such as reading external inputs, processing them in the way the engineer expects them to be processed, or accomplishing a specific function or task. All of these actions require interaction with the underlying operating system (OS). A program, in order to interact with the underlying OS, must call system functions. It might be nearly impossible to design a meaningful program that does not use any system calls.

In addition to that, in Windows, the programmer, when compiling a C program, needs to specify a subsystem (you can read more about it at https://docs.microsoft.com/en-us/cpp/build/reference/subsystem-specify-subsystem); windows and console are probably the two of the most common ones.

Let’s look at a simple example of a C program for Windows:

#include <Windows.h>
Int main(void) {
MessageBoxA(0, "hi there.", "info", 0);
return 0;
}

Presented here is the most simplified C program for Windows. Its purpose is to call the USER32!MessageBox() function at the entry point of the main() function to pop up a window with the info title and the hi there content.

You have been reading a chapter from
Windows APT Warfare
Published in: Mar 2023
Publisher: Packt
ISBN-13: 9781804618110
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime