
#define __STDC_FORMAT_MACROS

#include "panda/plugin.h"
#include "panda/plugin_plugin.h"


extern "C" {

#include "syscalls2/gen_syscalls_ext_typedefs.h"
#include "syscalls2/syscalls_common.h"

bool init_plugin(void *);
void uninit_plugin(void *);
void on_NtReadFile_enter(CPUState *cpu,target_ulong pc,uint32_t FileHandle,uint32_t Event,uint32_t UserApcRoutine,uint32_t UserApcContext,uint32_t IoStatusBlock,uint32_t Buffer,uint32_t BufferLength,uint32_t ByteOffset,uint32_t Key);

}
        
void on_NtReadFile_enter(CPUState *cpu,target_ulong pc,uint32_t FileHandle,uint32_t Event,uint32_t UserApcRoutine,uint32_t UserApcContext,uint32_t IoStatusBlock,uint32_t Buffer,uint32_t BufferLength,uint32_t ByteOffset,uint32_t Key) {
	printf("NtReadFile(FileHandle=%x, Event=%x, UserApcRoutine=%x, "
                     "UserApcContext=%x, IoStatusBlock=%x, Buffer=%x, "
                     "BufferLength=%x, ByteOffset=%x, Key=%x)\n",
        FileHandle, Event, UserApcRoutine, UserApcContext,
        IoStatusBlock, Buffer, BufferLength, ByteOffset, Key);
}

bool init_plugin(void *self) {
    PPP_REG_CB("syscalls2", on_NtReadFile_enter,on_NtReadFile_enter);
    return true;
}

void uninit_plugin(void *self) {
        printf("Unloading filereadmon plugin\n");
}
