Skip to content

Instantly share code, notes, and snippets.

// Compile with MSVC. Target x86, then target x64.
// See what happens (run without a debugger attached).
#include <cstdint>
#include <iostream>
#include <windows.h>
LONG WINAPI MyUEF (PEXCEPTION_POINTERS pExp)
{
std::cout << "Unhandled exception with code " << std::hex <<
pExp->ExceptionRecord->ExceptionCode << std::endl;
#include <ntifs.h>
#include <ntddk.h>
#include <ntstrsafe.h>
#define MFTPF_DEV_SYMLINK_NAME L"MFTPrefetch"
#define MFTPF_DEVICE 0x8000
#define IOCTL_MFTPF_PREFETCH_MFT CTL_CODE (MFTPF_DEVICE, 0x800, METHOD_NEITHER, FILE_ANY_ACCESS)
@Donpedro13
Donpedro13 / winlogos.gif
Last active May 27, 2020 07:41
winlogos
winlogos.gif
@Donpedro13
Donpedro13 / WMI_durations.xml
Last active April 16, 2024 02:55
WMI durations Regions of Interest
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<InstrumentationManifest>
<Instrumentation>
<Regions>
<RegionRoot Guid="{EFA7A927-BAE3-48F6-92E1-000000000000}" Name="WMI-Regions">
<Region Guid="{45EEAD74-5B56-4B38-8CEC-CF66312D6F9B}" Name="WMI-Operations">
<Start>
<Event Provider="{1418ef04-b0b4-4623-bf7e-d74ab47bbdaa}" Id="11" Version="0" />
</Start>
<Stop>
#include <iostream>
#include <process.h>
#include <windows.h>
CRITICAL_SECTION g_cs;
static unsigned int ThreadMain (void* /*context*/)
{
EnterCriticalSection (&g_cs);
#include <iostream>
#include <sys/stat.h>
int main (int /*argc*/, char* argv[])
{
struct stat fileInfo;
if (stat (argv[1], &fileInfo) == 0) {
std::cout << "The file's size is: " << fileInfo.st_size <<
" bytes" << std::endl;
} else {