Codebase list donut-shellcode / a77d707 include / mmap.h
a77d707

Tree @a77d707 (Download .tar.gz)

mmap.h @a77d707raw · history · blame

#ifndef MMAP_H
#define MMAP_H

#include <io.h>
#include <windows.h>
#include <sys/types.h>

#define PROT_READ     0x1
#define PROT_WRITE    0x2
/* This flag is only available in WinXP+ */
#ifdef FILE_MAP_EXECUTE
#define PROT_EXEC     0x4
#else
#define PROT_EXEC        0x0
#define FILE_MAP_EXECUTE 0
#endif

#define MAP_SHARED    0x01
#define MAP_PRIVATE   0x02
#define MAP_ANONYMOUS 0x20
#define MAP_ANON      MAP_ANONYMOUS
#define MAP_FAILED    ((void *) -1)

#ifdef __USE_FILE_OFFSET64
# define DWORD_HI(x) (x >> 32)
# define DWORD_LO(x) ((x) & 0xffffffff)
#else
# define DWORD_HI(x) (0)
# define DWORD_LO(x) (x)
#endif

#ifdef __cplusplus
extern "C" {
#endif

void *mmap(void *start, uint32_t length, int prot, int flags, int fd, off_t offset);
void munmap(void *addr, uint32_t length);

#ifdef __cplusplus
}
#endif

#endif