Open: Pasted image 20251010093428.png

Windows API
- Call CreateFile application
- Create API in Kernal32.dll
- NTCreateFile in NTdll
- syscall in kernal
直接呼叫 native api 可以避免 EDR hook windows Api
Memory Management
多個程式共用 virtual memory 實際上是同一塊記憶體不會相互干擾
page
記憶體的最小單位是page
commited
已經可以正常存取並有 memory protection
reserved
page保留給未來使用 不能在這塊 Allocation
還沒有 physical frame
free
不是上面兩種就是 free
memory Protection constrans
page noaccess
---
page _execute_readwrite
RWX
正常程式不會邊執行邊改自己
page readonly
R—
memory allocation
// malloc
PVOID pAddress = malloc(100)
free(pAddress)// localalloc
PVOID pAddress = LocalAlloc(LPTR,100)
Localfree(pAddress)// heapmalloc
PVOID pAddress = HeapAlloc(GetProcessHeap(),0,100)
Heapfree(pAddress)local 跟 heap 比較常用在 windows
Common Types
型別名稱遵照匈牙利命名法
Return Error
用 GetLastError() 拿到 error code 然後查表
A & W
A = ANSL = 1byte pw
W = wide string = 2byte pw