From b862c7314cd69af6b09e4a02b7868fbbe157e220 Mon Sep 17 00:00:00 2001 From: midipix Date: Wed, 24 Jan 2024 00:30:06 +0000 Subject: __ntapi_tt_spawn_native_process(): use macro defs for alloc- and buffer size. --- src/process/ntapi_tt_spawn_native_process.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/process/ntapi_tt_spawn_native_process.c b/src/process/ntapi_tt_spawn_native_process.c index 086e4e2..76bbbc4 100644 --- a/src/process/ntapi_tt_spawn_native_process.c +++ b/src/process/ntapi_tt_spawn_native_process.c @@ -18,6 +18,9 @@ (NT_PROCESS_SPAWN_FLAG_DEBUG_EXECUTION \ | NT_PROCESS_SPAWN_FLAG_DEBUG_SUSPENDED) +#define __SPAWN_NATIVE_PROCESS_RUNTIME_BLOCK_ALLOC_SIZE (0x40000) +#define __SPAWN_NATIVE_PROCESS_RUNTIME_BLOCK_IMGBUF_SIZE (0x10000) + static int32_t __stdcall __tt_spawn_return( nt_runtime_data_block * rtblock, void * hprocess, @@ -121,7 +124,7 @@ int32_t __stdcall __ntapi_tt_spawn_native_process(nt_spawn_process_params * spar /* rtblock, rdata */ rtblock.addr = 0; - rtblock.size = 0x40000; + rtblock.size = __SPAWN_NATIVE_PROCESS_RUNTIME_BLOCK_ALLOC_SIZE; rtblock.remote_addr = 0; rtblock.remote_size = 0; rtblock.flags = 0; @@ -150,21 +153,22 @@ int32_t __stdcall __ntapi_tt_spawn_native_process(nt_spawn_process_params * spar /* imgbuf */ imgbuf = (wchar16_t *)rtblock.addr; - imgbuf += 0x30000 / sizeof(*imgbuf); + imgbuf += __SPAWN_NATIVE_PROCESS_RUNTIME_BLOCK_ALLOC_SIZE / sizeof(*imgbuf); + imgbuf -= __SPAWN_NATIVE_PROCESS_RUNTIME_BLOCK_IMGBUF_SIZE / sizeof(*imgbuf); /* hfile */ if (sparams->himage) hfile = sparams->himage; else if ((status = __ntapi_tt_open_file_utf8( &hfile,hat,patharg,1, - imgbuf,0x2000))) + imgbuf,__SPAWN_NATIVE_PROCESS_RUNTIME_BLOCK_IMGBUF_SIZE))) return status; /* imgname */ if ((status = __ntapi->zw_query_object( hfile, NT_OBJECT_NAME_INFORMATION, - imgbuf,0x10000, + imgbuf,__SPAWN_NATIVE_PROCESS_RUNTIME_BLOCK_IMGBUF_SIZE, &(uint32_t){0}))) return __tt_spawn_return( &rtblock,0,0,status); @@ -280,7 +284,7 @@ int32_t __stdcall __ntapi_tt_spawn_native_process(nt_spawn_process_params * spar buflen -= needed; } - if (buflen < 0x10000) + if (buflen < __SPAWN_NATIVE_PROCESS_RUNTIME_BLOCK_IMGBUF_SIZE) return __tt_spawn_return( &rtblock,0,0,NT_STATUS_BUFFER_TOO_SMALL); -- cgit v1.2.3