Blame src/section/ntapi_tt_get_section_name.c

dd89bb
/********************************************************/
dd89bb
/*  ntapi: Native API core library                      */
dd89bb
/*  Copyright (C) 2013,2014,2015  Z. Gilboa             */
dd89bb
/*  Released under GPLv2 and GPLv3; see COPYING.NTAPI.  */
dd89bb
/********************************************************/
dd89bb
dd89bb
#include <psxtypes/psxtypes.h>
dd89bb
#include <ntapi/nt_memory.h>
dd89bb
#include <ntapi/nt_section.h>
dd89bb
#include <ntapi/ntapi.h>
dd89bb
#include "ntapi_impl.h"
dd89bb
dd89bb
int32_t __stdcall __ntapi_tt_get_section_name(
dd89bb
	__in	void *			addr,
dd89bb
	__out	nt_mem_sec_name *	buffer,
dd89bb
	__in	uint32_t		buffer_size)
dd89bb
{
dd89bb
	size_t len;
dd89bb
dd89bb
	/* init buffer */
dd89bb
	buffer->section_name.strlen = 0;
dd89bb
	buffer->section_name.maxlen = (uint16_t)(buffer_size - sizeof(nt_unicode_string));
dd89bb
	buffer->section_name.buffer = buffer->section_name_buffer;
dd89bb
dd89bb
	return __ntapi->zw_query_virtual_memory(
dd89bb
		NT_CURRENT_PROCESS_HANDLE,
dd89bb
		addr,
dd89bb
		NT_MEMORY_SECTION_NAME,
dd89bb
		buffer,
dd89bb
		buffer_size,
dd89bb
		&len;;
dd89bb
}