Skip to content

Instantly share code, notes, and snippets.

/* ************************************************************************** */
/* */
/* :::::::: */
/* main.c :+: :+: */
/* +:+ */
/* By: dpattij <dpattij@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2020/01/11 21:49:38 by dpattij #+# #+# */
/* Updated: 2020/01/25 18:55:48 by dpattij ######## odam.nl */
/* */
#include <unistd.h>
#include <stdarg.h>
int ft_isdigit(char c)
{
return (c >= '0' && c <= '9');
}
int ft_asdigit(char c)
{
#define STATUS_ERROR -1
#define EOF -1
int pr_getc(int fd, char *c)
{
static char buffer[256];
static int head;
static int max;
if (head == 0)
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include "get_next_line.h"
#include <execinfo.h>
int ptrcnt = 0;
typedef struct despacito {
void *ptr;
@boatboatboatboat
boatboatboatboat / array.lua
Created August 31, 2019 18:59
fake static array
local Array = {};
local function lerrorf(l, s, ...)
error(string.format(s, ...), l + 1);
end
function Array.new(size)
local new =
{
size = size;
@boatboatboatboat
boatboatboatboat / vmtest.lua
Created June 14, 2019 15:38
bytecode vs dispatcher
-- Create instruction
local function inst_bytecode(opcode, ...)
local args={...}
return {
OPCODE = opcode,
ARGS = args
}
end
-- Generate closure from instruction
// based on https://www.lua.org/manual/5.3/manual.html
// (specifically chapter 3: https://www.lua.org/manual/5.3/manual.html#3)
// ignores the goto related things
program = { SOI ~ block ~ EOI }
// this is also a variable
identifier = @{ ( ASCII_ALPHA | "_" ) ~ ( ASCII_ALPHANUMERIC | "_" )+ }
// keywords
...
use winapi::minwindef::{LPVOID, DWORD, PDWORD};
fn main() {
let address = 0xDEADBEEF; // in practice i know the address is right ok, just trust me.
let old_protect: DWORD = 0;
let t = unsafe { kernel32::VirtualProtect(address as LPVOID, 1, 0x40, old_protect as PDWORD) };
println!("results: {}, {}", old_protect, t); // "t" returns 0, but I don't know why t.t
}