compile on vs2010 + remove over-allocation

This commit is contained in:
mrexodia 2017-07-29 15:23:52 +02:00
parent 0f5566b1db
commit 5d1e43bb69
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
2 changed files with 17 additions and 1 deletions

View File

@ -217,7 +217,7 @@ __declspec(dllexport) void* TITCALL InitNativeDebugW(wchar_t* szFileName, wchar_
// Convert command line and directory to UNICODE_STRING if present
SIZE_T ArgumentsLength = szCommandLine != NULL ? lstrlenW(szCommandLine) : 0;
SIZE_T BufferSize = ImagePath.Length + ((ArgumentsLength + 4) * sizeof(wchar_t));
CommandLine.Buffer = (PWSTR)RtlAllocateHeap(RtlProcessHeap(), HEAP_ZERO_MEMORY, BufferSize * 10);
CommandLine.Buffer = (PWSTR)RtlAllocateHeap(RtlProcessHeap(), HEAP_ZERO_MEMORY, BufferSize);
CommandLine.MaximumLength = (USHORT)BufferSize;
RtlAppendUnicodeToString(&CommandLine, L"\"");
RtlAppendUnicodeStringToString(&CommandLine, &ImagePath);

View File

@ -33,6 +33,22 @@
#include <time.h>
#include <stdint.h>
#ifndef _Out_writes_opt_
#define _Out_writes_opt_(x)
#endif
#ifndef _In_reads_
#define _In_reads_(x)
#endif
#ifndef _Inout_updates_bytes_
#define _Inout_updates_bytes_(x)
#endif
#ifndef _Out_writes_bytes_opt_
#define _Out_writes_bytes_opt_(X)
#endif
//#include <winternl.h>
#include "ntdll.h"
#include "aplib.h"