Skip to content

Instantly share code, notes, and snippets.

View wbenny's full-sized avatar

Petr Beneš wbenny

View GitHub Profile
@wbenny
wbenny / TlsCallback.c
Created September 29, 2018 19:36
TLS callback minimal example
//
// Merge .CRT section to .rdata (read only)
//
#pragma comment(linker, "/merge:.CRT=.rdata")
//
// Define variables marking the begin and the end
// of the TLS callback array.
//
@wbenny
wbenny / vmcs_field_encoding.md
Last active December 11, 2020 10:04
VMCS field encoding

VMCS field encoding

Values of VMCS fields are encoded as per section VMREAD, VMWRITE, and Encodings of VMCS Field (24.11.2, Intel Manual Volume 3C - May 2018).

This encoding can be transcribed into C:

union vmcs_component_encoding
{
 struct
@wbenny
wbenny / install-virtualbox-dependencies.sh
Last active February 12, 2017 21:55
Installs packages required to build a VirtualBox
#
# Tested on freshly installed Ubuntu 16.04 (amd64)
# with VirtualBox 5.1.14 code base.
#
#
# Note:
# After a build, there was VBoxDD.so file missing in the
# out/linux.amd64/release/bin folder.
# The file is located in the out/linux.amd64/release/obj/VBoxDD folder,
@wbenny
wbenny / nt_syscalls.md
Last active September 16, 2024 22:11
Windows syscall stubs

Windows system calls

...by stub

x86

Windows XP

B8 ?? ?? ?? ??                mov     eax, ??
BA 00 03 FE 7F                mov     edx, 7FFE0300h
#include <iostream>
#include <thread>
#include <cstdlib>
#include <cstdint>
#include <cinttypes>
static uint64_t win = 0;
static uint64_t loss = 0;
void thread_printer()