Rizin
unix-like reverse engineering framework and cli tools
libc.h File Reference
#include <ntifs.h>

Go to the source code of this file.

Functions

EXTERN_C __drv_when (return!=0, __drv_allocatesMem(pBlock)) __checkReturn __drv_maxIRQL(DISPATCH_LEVEL) __bcount_opt(size) void *__cdecl malloc(__in size_t size)
 
EXTERN_C __drv_when (return !=0, __drv_allocatesMem(p)) __checkReturn __drv_maxIRQL(DISPATCH_LEVEL) __bcount_opt(size *n) void *__cdecl calloc(size_t n
 
EXTERN_C __drv_when (return!=0, __drv_allocatesMem(inblock)) __checkReturn __drv_maxIRQL(DISPATCH_LEVEL) __bcount_opt(size) void *__cdecl realloc(__in_opt void *ptr
 
EXTERN_C __drv_maxIRQL (DISPATCH_LEVEL) void __cdecl free(__inout_opt __drv_freesMem(Mem) void *ptr)
 
int __cdecl vsnprintf (char *buffer, size_t count, const char *format, va_list argptr)
 

Variables

EXTERN_C size_t size
 

Detailed Description

Author
created by: Peter Hlavaty

Definition in file libc.h.

Function Documentation

◆ __drv_maxIRQL()

EXTERN_C __drv_maxIRQL ( DISPATCH_LEVEL  )

Definition at line 101 of file libc.cpp.

106 {
107  if (ptr)
108  ExFreePoolWithTag(CONTAINING_RECORD(ptr, MEMBLOCK, data), _LIBC_POOL_TAG);
109 }
#define _LIBC_POOL_TAG
Definition: libc.cpp:14

References _LIBC_POOL_TAG.

◆ __drv_when() [1/3]

EXTERN_C __drv_when ( return !  = 0,
__drv_allocatesMem(p  
)

◆ __drv_when() [2/3]

EXTERN_C __drv_when ( return!  = 0,
__drv_allocatesMem(inblock  
)

◆ __drv_when() [3/3]

EXTERN_C __drv_when ( return!  = 0,
__drv_allocatesMem(pBlock)   
)

Definition at line 29 of file libc.cpp.

37 {
38  /* A specially crafted size value can trigger the overflow.
39  If the sum in a value that overflows or underflows the capacity of the type,
40  the function returns nullptr. */
41  size_t number_of_bytes = 0;
42  if (!NT_SUCCESS(RtlSizeTAdd(size, sizeof(MEMBLOCK), &number_of_bytes))){
43  return nullptr;
44  }
45  MEMBLOCK *pBlock = static_cast<MEMBLOCK*>(
47  NonPagedPoolNxCacheAligned,
48  number_of_bytes,
50 
51  if (nullptr == pBlock)
52  return nullptr;
53 
54  pBlock->size = size;
55  return pBlock->data;
56 }
voidpf void uLong size
Definition: ioapi.h:138
ExAllocatePoolWithTag
Definition: kernel.h:18
EXTERN_C size_t size
Definition: libc.cpp:65
size_t size
Definition: libc.cpp:20
#define NT_SUCCESS(status)
Definition: winapi.h:52

References _LIBC_POOL_TAG, ExAllocatePoolWithTag, NT_SUCCESS, MEMBLOCK::size, and size.

◆ vsnprintf()

int __cdecl vsnprintf ( char *  buffer,
size_t  count,
const char *  format,
va_list  argptr 
)

Definition at line 135 of file libc.cpp.

141 {
142  return vsprintf_s(buffer, count, format, argptr);
143 }
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
Definition: sflib.h:98
Definition: buffer.h:15

References count.

Variable Documentation

◆ size

EXTERN_C __in size_t size

Definition at line 23 of file libc.h.