Exemple #1
7
int _tmain(int argc, _TCHAR* argv[])
{
	HANDLE hHeap = HeapCreate(HEAP_NO_SERIALIZE, PAGE_SIZE*10, PAGE_SIZE*100);

	int* pArr = (int* ) HeapAlloc(hHeap, 0, sizeof(int) * 30);
	
	for(int i = 0 ; i < 10 ; ++i)
	{
		if(i % 5 == 0)
			printf_s("\n");
		pArr[i] = (i + 1) * 100;
	}

	for(int i = 0 ; i < 30 ; ++i)
	{
		if(i % 5 == 0)
		printf_s("\n");
		printf_s("%d ", pArr[i]);
	}
	HeapFree(hHeap, 0, pArr);
	HeapDestroy(hHeap);
	
	getchar();

	return 0;
}
Exemple #2
0
int main(int argc, char *argv[]){
	void *test;
	HGLOBAL hgtest;
	HLOCAL hltest;
	HANDLE heapcreate;
	LPVOID hptest;
	//LPVOID hvtest;

	test = malloc(100);
	memset(test,'a',100);
	zfree(test);

	hgtest = GlobalAlloc(GMEM_FIXED,100);
	memset(hgtest,'a',100);
	zGlobalFree(hgtest);

	hltest = LocalAlloc(LMEM_FIXED,100);
	memset(hltest,'a',100);
	zLocalFree(hltest);

	heapcreate = HeapCreate(0,100,100);
	hptest = HeapAlloc(heapcreate,HEAP_ZERO_MEMORY,100);
	memset(hptest,'a',100);
	zHeapFree(heapcreate,0,hptest);
	HeapDestroy(heapcreate);
	/* yet to implement 
	hvtest = VirtualAlloc(NULL,100,MEM_COMMIT,PAGE_READWRITE);
	memset(hvtest,'a',100);
	zVirtualFree(hvtest,100,MEM_RELEASE);
	return 0;
	*/
}
BOOL
LongBinary::SetBinarySize(DWORD sizeNew, void* lpDataCopy){
	if (m_hMemory == NULL){ // Allocate
		m_pBuffer = NULL;
		if (sizeNew == 0)
			return TRUE;
		m_hMemory = HeapCreate(0L, sizeNew, 0L);
		ASSERT(m_hMemory);
		m_pBuffer = HeapAlloc(m_hMemory, 0L, sizeNew);
		m_dwSize = sizeNew;
	}
	else{ // Reallocate
		if (sizeNew > m_dwSize){
			// Allocate or realocate memory . #####
			m_pBuffer = HeapReAlloc(m_hMemory, 0L, m_pBuffer, sizeNew);
			m_dwSize = sizeNew;
		}
		else
			if (sizeNew == 0){
				HeapFree(m_hMemory, 0L, m_pBuffer);
				HeapDestroy(m_hMemory);
				m_pBuffer = NULL;
				m_hMemory = NULL;
				m_dwSize = 0;
			}
		}

	if( lpDataCopy != NULL && m_hMemory ){
		memcpy(m_pBuffer, lpDataCopy, sizeNew);
		}
	return TRUE;
	}
Exemple #4
0
BOOL CHeapAllocator::Initialize(SIZE_T dwInitSize)
{
    Unitialize();
    m_hHeap = HeapCreate(0,dwInitSize,0);


	// Jie JIAN changed @ 2007-12-28
	// use LFH if possible
	typedef BOOL (WINAPI *PFN_HEAPSETINFORMATION)(HANDLE, HEAP_INFORMATION_CLASS, PVOID, SIZE_T);
	
	HMODULE hKernel32 = LoadLibraryW( L"kernel32.dll" );
	if ( NULL != hKernel32 )
	{
		PFN_HEAPSETINFORMATION pfnHeapSetInformation = 
			reinterpret_cast<PFN_HEAPSETINFORMATION>(
			GetProcAddress(hKernel32, "HeapSetInformation")
			);

		if ( NULL != pfnHeapSetInformation )
		{
			ULONG ulHeapInformation = 2;
			(*pfnHeapSetInformation)( m_hHeap,
									  HeapCompatibilityInformation,
									  &ulHeapInformation,
									  sizeof(ULONG) );
		}

		FreeLibrary(hKernel32);
	}

    return TRUE;
}
// TODO: I should probably move all initalization inside the thread
// We should minimize the amount of work done in DLL_PROCESS_ATTACH as per
// http://blogs.msdn.com/b/oleglv/archive/2003/10/24/56141.aspx
static BOOL ProcessAttach()
{
    lf("memtrace.dll: ProcessAttach()");
    if (!OpenPipe()) {
        lf("memtrace.dll: couldn't open pipe");
        return FALSE;
    } else {
        lf("memtrace.dll: opened pipe");
    }

    gHeap = HeapCreate(0, 0, 0);
    if (!gHeap) {
        lf("memtrace.dll: failed to create heap");
        return FALSE;
    }

    InitializeCriticalSection(&gMemMutex);
    gSendThreadEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
    if (!gSendThreadEvent) {
        lf("memtrace.dll: couldn't create gSendThreadEvent");
        return FALSE;
    }
    gSendThread = CreateThread(NULL, 0, DataSendThreadProc, NULL, 0, 0);
    if (!gSendThread) {
        lf("memtrace.dll: couldn't create gSendThread");
        return FALSE;
    }
    InstallHooks();
    return TRUE;
}
Exemple #6
0
/* //////////////////////////////////////////////////////////////////////////////////////
 * implementation
 */
tb_bool_t tb_native_memory_init()
{   
    // enter
    tb_spinlock_enter_without_profiler(&g_lock);

    // done
    tb_bool_t ok = tb_false;
    do
    {
        // have been inited?
        tb_check_break_state(!g_heap, ok, tb_true);

        // make heap
        g_heap = (tb_handle_t)HeapCreate(0, 0, 0);
        tb_check_break(g_heap);

        // ok
        ok = tb_true;

    } while (0);

    // leave
    tb_spinlock_leave(&g_lock);

    // ok?
    return ok;
}
Exemple #7
0
inline static void _win32_initHeap( void )
{
    g_privateHeap = HeapCreate( 0, 0, 0 );

    unsigned int info = 0;
    HeapSetInformation( g_privateHeap, HeapCompatibilityInformation, &info, sizeof(info) );
}
void PatchMW2_StringList()
{
	slHashMap.set_empty_key("*DUMMYDUMMY*");
	slHashMap.set_deleted_key("*DUMMYDUMM*");

	call(0x4D2280, SL_Init, PATCH_JUMP);
	call(0x436B40, SL_GetStringOfSize, PATCH_JUMP);
	call(0x4EC1D0, SL_ConvertToString_, PATCH_JUMP);
	call(0x61BCB0, FindStringOfSize, PATCH_JUMP);
	call(0x469D80, SL_ConvertFromString, PATCH_JUMP);
	call(0x4D9B00, SL_AddRefToString, PATCH_JUMP);
	call(0x4F1500, SL_RemoveRefToStringOfSize, PATCH_JUMP);
	call(0x47CD70, SL_RemoveRefToString, PATCH_JUMP);
	call(0x417730, Scr_SetString, PATCH_JUMP);
	call(0x4401E0, SL_GetStringLen, PATCH_JUMP);
	call(0x40C050, SL_TransferRefToUser, PATCH_JUMP);
	call(0x4B4310, SL_AddUser, PATCH_JUMP);
	call(0x430510, SL_ConvertToLowercase, PATCH_JUMP);
	call(0x4F46D0, SL_ShutdownSystem, PATCH_JUMP);
	call(0x4A44A0, SL_TransferSystem, PATCH_JUMP);

	stringHeap = HeapCreate(0, 1024 * 1024, 0);

	// path_node_constant_t marking function; has some terrible string references
	*(BYTE*)0x4F74B0 = 0xC3;
}
Exemple #9
0
/*! This function has to be called before using any other
    function of hpgs. It defines the path, where additional
    files such as the truetype files for HPGL files or plugins
    are stored.

    Truetype fonts are searched in the path <prefix>/share/hpgs

    The path is internally duplicated using \c strdup.
*/
void hpgs_init(const char *path)
{
  int l;

  hpgs_reader_prefix = strdup(path);

  if (!hpgs_reader_prefix) return;

  // strip off trailing directory separators.  
  l = strlen(hpgs_reader_prefix);

  if (l && hpgs_reader_prefix[l-1] == HPGS_PATH_SEPARATOR)
    hpgs_reader_prefix[l-1] = '\0';

#ifdef WIN32
  hHeap = HeapCreate(0,4096,128*1024);
  tls_handle = TlsAlloc();
#else
  pthread_key_create (&key,free);
#endif
#ifdef HPGS_HAVE_GETTEXT
  hpgs_i18n_init();
#endif
  hpgs_font_init();
}
Exemple #10
0
CLrpHeap::CLrpHeap() : m_heap(HeapCreate(0, 0, 0))
{
	if (nullptr == m_heap)
	{
		throw runtime_error("Couldn't create a new memory heap");
	}
}
Exemple #11
0
//-------------------------------------------------------------------------
MH_STATUS WINAPI MH_Initialize(VOID)
{
    MH_STATUS status = MH_OK;

    EnterSpinLock();

    if (g_hHeap == NULL)
    {
        g_hHeap = HeapCreate(0, 0, 0);
        if (g_hHeap != NULL)
        {
            // Initialize the internal function buffer.
            InitializeBuffer();
        }
        else
        {
            status = MH_ERROR_MEMORY_ALLOC;
        }
    }
    else
    {
        status = MH_ERROR_ALREADY_INITIALIZED;
    }

    LeaveSpinLock();

    return status;
}
Exemple #12
0
HANDLE get_tls_heap()
{
	if (local_heap_tls == 0)
	{
		local_heap_tls = TlsAlloc();
		if (local_heap_tls == 0)
		{
			return (NULL);
		}
	}

	void* tls_val = TlsGetValue(local_heap_tls);

	if (tls_val == NULL)
	{
		HANDLE heap = HeapCreate(HEAP_NO_SERIALIZE, 0, 0);
		if (heap == 0)
		{
			return (NULL);
		}
		tls_val = (void*)heap;
		TlsSetValue(local_heap_tls, tls_val);
	}

	return (HANDLE)tls_val;
}
Exemple #13
0
int InitModuleNames(void)
{
	struct DBModuleName *dbmn;
	DWORD ofsThis;
	int nameLen;
	char *mod;

	hModHeap=HeapCreate(0,0,0);
	lMods.sortFunc=ModCompare;
	lMods.increment=50;
	lOfs.sortFunc=OfsCompare;
	lOfs.increment=50;

	ofsThis=dbHeader.ofsFirstModuleName;
	dbmn=(struct DBModuleName*)DBRead(ofsThis,sizeof(struct DBModuleName),NULL);
	while(ofsThis) {
		if(dbmn->signature!=DBMODULENAME_SIGNATURE) DatabaseCorruption(NULL);

		nameLen=dbmn->cbName;

		mod = (char*)HeapAlloc(hModHeap,0,nameLen+1);
		CopyMemory(mod,DBRead(ofsThis+offsetof(struct DBModuleName,name),nameLen,NULL),nameLen);
		mod[nameLen] = 0;

		AddToList(mod, nameLen, ofsThis);

		ofsThis=dbmn->ofsNext;
		dbmn=(struct DBModuleName*)DBRead(ofsThis,sizeof(struct DBModuleName),NULL);
	}
	CreateServiceFunction(MS_DB_MODULES_ENUM,EnumModuleNames);
	return 0;
}
Exemple #14
0
FStringData *FStringData::Alloc (size_t strlen)
{
	strlen += 1 + sizeof(FStringData);	// Add space for header and terminating null
	strlen = (strlen + 7) & ~7;			// Pad length up

#ifdef _WIN32
	if (StringHeap == NULL)
	{
		StringHeap = HeapCreate (0, STRING_HEAP_SIZE, 0);
		if (StringHeap == NULL)
		{
			throw std::bad_alloc();
		}
	}

	FStringData *block = (FStringData *)HeapAlloc (StringHeap, 0, strlen);
#else
	FStringData *block = (FStringData *)malloc (strlen);
#endif
	if (block == NULL)
	{
		throw std::bad_alloc();
	}
	block->Len = 0;
	block->AllocLen = (unsigned int)strlen - sizeof(FStringData) - 1;
	block->RefCount = 1;
	return block;
}
Exemple #15
0
BOOL WinAPIOverride32Init(HINSTANCE hInst) {
	TCHAR psz[MAX_PATH+32];
	TCHAR pszPID[32];
	SYSTEM_INFO siSysInfo;

	DisableThreadLibraryCalls(hInst);

	dwCurrentProcessID = GetCurrentProcessId();

	wsprintf(pszPID, "0x%X", dwCurrentProcessID);
	lstrcpy(psz, APIOVERRIDE_MUTEX);
	lstrcat(psz, pszPID);

	pSingleInstance = new CSingleInstance(psz);
	if (pSingleInstance->IsAnotherInstanceRunning()) {
		delete pSingleInstance;
		return FALSE;
	}

	GetSystemInfo(&siSysInfo); 
	dwSystemPageSize = siSysInfo.dwPageSize;

	ApiOverrideHeap = HeapCreate(HEAP_CREATE_ENABLE_EXECUTE | HEAP_GROWABLE, dwSystemPageSize, 0);

	pLinkListAPIInfos = new CLinkList(sizeof(API_INFO));
	pLinkListAPIInfos->SetHeap(ApiOverrideHeap);

	return TRUE;
}
Exemple #16
0
	Thunk32Base::Thunk32Base()
	{
		// Double checked locking, guaranteed by Acquire/Release-semantics in Microsoft's
		// volatile-implementation.
		if(bytecodeHeap == NULL)
		{
			hMutex = CreateMutex(NULL, TRUE, NULL);
			while (hMutex == (HANDLE)NULL || hMutex == (HANDLE)ERROR_ALREADY_EXISTS || hMutex == (HANDLE)ERROR_ACCESS_DENIED) {
				Sleep(1000);
			}

			if(bytecodeHeap == NULL)
			{
				bytecodeHeap = HeapCreate(HEAP_CREATE_ENABLE_EXECUTE, 0, 0);
				if(bytecodeHeap == NULL)
				{
					throw std::exception("Heap creation failed!");
				}

				// Schedule the heap to be destroyed when the application terminates.
				// Until then, it will manage its own size.
				atexit(cleanupHeap);
			}
		}

		bytecode = reinterpret_cast<Bytecode*>(HeapAlloc(bytecodeHeap, 0, sizeof(Bytecode)));
		if(bytecode == NULL) 
		{
			throw std::exception("Bytecode allocation failed!");
		}
		new (bytecode) Bytecode;
	}
Exemple #17
0
MDatabaseCache::MDatabaseCache() :
	m_lSettings(100, stringCompare),
	m_lContacts(50, NumericKeySortT),
	m_lGlobalSettings(50, compareGlobals)
{
	m_hCacheHeap = HeapCreate(0, 0, 0);
}
//------------------------------------------------------------------------------
void CvDllGameContext::InitializeSingleton()
{
	if(s_pSingleton == NULL)
	{
		FAssert(s_hHeap == INVALID_HANDLE_VALUE);
		s_hHeap = HeapCreate(0, 0, 0);

		//
		// Enable the low-fragmentation heap (LFH). Starting with Windows Vista,
		// the LFH is enabled by default but this call does not cause an error.
		//
		ULONG HeapInformation = 2;	//Low Fragmentation Heap
		HeapSetInformation(s_hHeap,
		                   HeapCompatibilityInformation,
		                   &HeapInformation,
		                   sizeof(HeapInformation));

	}
	s_pSingleton = FNEW(CvDllGameContext(), c_eCiv5GameplayDLL, 0);

#if defined(CUSTOM_MODS_H)
	CUSTOMLOG("%s - Startup (Version %u%s - Build %s %s%s)", MOD_DLL_NAME, MOD_DLL_VERSION_NUMBER, MOD_DLL_VERSION_STATUS, __DATE__, __TIME__, MOD_DLL_CUSTOM_BUILD_NAME);
#if defined(MOD_GLOBAL_MAX_MAJOR_CIVS)
	CUSTOMLOG(" - supporting %i major civilizations", MAX_MAJOR_CIVS);
#endif
#endif
}
bool SaveDump(string fileName, DWORD ep)
{
	strCurEIP = ep;
	//OPENFILENAME ofn;
	HANDLE hHeap, hFile;
	PIMAGE_DOS_HEADER idosh;
	PIMAGE_NT_HEADERS ipeh;
	PIMAGE_SECTION_HEADER isech;
	LPBYTE lpDumpData;
	DWORD dwFrom,dwSize,dwAccBytes;
	unsigned int i;
	dwFrom = PEFileInfo.dwImageBase;
	dwSize = PEFileInfo.dwSizeOfImage;
	hHeap = HeapCreate(HEAP_NO_SERIALIZE,1,0);
	lpDumpData = (LPBYTE)HeapAlloc(hHeap,HEAP_NO_SERIALIZE | HEAP_ZERO_MEMORY,dwSize);
	dwSize = Readmemory(lpDumpData,dwFrom,dwSize,MM_RESTORE);
	idosh = (PIMAGE_DOS_HEADER)lpDumpData;
	if(idosh->e_magic != IMAGE_DOS_SIGNATURE) 
	{
		MessageBox(0, "DUMP: 错误的DOS头(MZ)!!",PNAME,MB_OK | MB_ICONEXCLAMATION);
		HeapFree(hHeap,HEAP_NO_SERIALIZE,lpDumpData);
		return false;
	}
	ipeh = (PIMAGE_NT_HEADERS)(lpDumpData + idosh->e_lfanew);
	if(ipeh->Signature != IMAGE_NT_SIGNATURE) 
	{
		MessageBox(0, "DUMP: 错误的PE标志头!!",PNAME,MB_OK | MB_ICONEXCLAMATION);
		HeapFree(hHeap,HEAP_NO_SERIALIZE,lpDumpData);
		return false;
	}
	ipeh->FileHeader.NumberOfSections        = PEFileInfo.woNumOfSect;
	ipeh->OptionalHeader.ImageBase           = PEFileInfo.dwImageBase;
	ipeh->OptionalHeader.SizeOfImage         = PEFileInfo.dwSizeOfImage;
	ipeh->OptionalHeader.BaseOfCode          = PEFileInfo.dwBaseOfCode;
	ipeh->OptionalHeader.BaseOfData          = PEFileInfo.dwBaseOfData;
	ipeh->OptionalHeader.AddressOfEntryPoint = (strCurEIP - PEFileInfo.dwImageBase) ;
	isech = IMAGE_FIRST_SECTION(ipeh);
	if(FixSect) {
		for(i=0; i<(int)PEFileInfo.woNumOfSect; i++) 
		{
			strcpy((char *)(isech+i)->Name,(char *)(lpSectInfo+i)->byName);
			(isech+i)->Misc.VirtualSize = (lpSectInfo+i)->dwVSize;
			(isech+i)->VirtualAddress   = (lpSectInfo+i)->dwVOffset;
			(isech+i)->SizeOfRawData    = (lpSectInfo+i)->dwVSize;
			(isech+i)->PointerToRawData = (lpSectInfo+i)->dwVOffset;
			(isech+i)->Characteristics  = (lpSectInfo+i)->dwCharacteristics;
		}
	}

	strcpy( szFileName, fileName.c_str() );
	hFile = CreateFile(szFileName, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
	if(hFile != INVALID_HANDLE_VALUE) 
	{
		SetFilePointer(hFile, 0, 0, FILE_BEGIN);
		WriteFile(hFile, lpDumpData, dwSize, &dwAccBytes, NULL);
		CloseHandle(hFile);
	}
	HeapFree(hHeap,HEAP_NO_SERIALIZE,lpDumpData);
	return true;
}
Exemple #20
0
VOID
MmInitializeHeap(PVOID PageLookupTable)
{
    TRACE("MmInitializeHeap()\n");

    /* Create the default heap */
    FrLdrDefaultHeap = HeapCreate(DEFAULT_HEAP_SIZE, LoaderOsloaderHeap);
    ASSERT(FrLdrDefaultHeap);

    /* Create a temporary heap */
    FrLdrTempHeap = HeapCreate(TEMP_HEAP_SIZE, LoaderFirmwareTemporary);
    ASSERT(FrLdrTempHeap);

    TRACE("MmInitializeHeap() done, default heap %p, temp heap %p\n",
          FrLdrDefaultHeap, FrLdrTempHeap);
}
Exemple #21
0
void *
CMemAlloc::Create(int ElSize,int NumEls,DWORD HeapFlags)
{
void *pAllocd;
m_LastErr = 0;
if(ElSize < 1)			// make the initial allocation worth the exercise
	ElSize = 1;
if((NumEls * ElSize) < 1024)
	NumEls = (1024/ElSize) + 1;
if(m_hHeap == NULL)		// create heap, or reuse if one already created
	{
	if((m_hHeap = HeapCreate(HeapFlags,ElSize * NumEls,0))==NULL)
		{
		m_LastErr = GetLastError();
		return(NULL);
		}
	pAllocd = HeapAlloc(m_hHeap,HeapFlags,ElSize*NumEls);
	}
else
	pAllocd = HeapReAlloc(m_hHeap,0,m_pAllocd,ElSize*NumEls);
if(pAllocd != NULL)
	{
	m_ElSize = ElSize;
	m_NumEls = NumEls;
	m_pAllocd = pAllocd;
	}
else
	m_LastErr = GetLastError();
return(pAllocd);
}
Exemple #22
0
////////////////////////////////////////////////////////////////////////
// DllMain -- OCX Main Entry
//
//
extern "C" BOOL APIENTRY DllMain(HINSTANCE hDllHandle, DWORD dwReason, LPVOID /*lpReserved*/)
{
	switch (dwReason)
	{
	case DLL_PROCESS_ATTACH:
		v_hModule = hDllHandle;
        v_hPrivateHeap = HeapCreate(0, 0x1000, 0);
		v_icoOffDocIcon = (HICON)LoadImage(hDllHandle, MAKEINTRESOURCE(IDI_SMALLOFFDOC), IMAGE_ICON, 16, 16, 0);
		{
			DWORD dwVersion = GetVersion();
			v_fUnicodeAPI = ((dwVersion & 0x80000000) == 0);
			v_fWindows2KPlus = ((v_fUnicodeAPI) && (LOBYTE(LOWORD(dwVersion)) > 4));
		}
		InitializeCriticalSection(&v_csecThreadSynch);
		DisableThreadLibraryCalls(hDllHandle);
		break;

	case DLL_PROCESS_DETACH:
		if (v_icoOffDocIcon) DeleteObject(v_icoOffDocIcon);
        if (v_hPrivateHeap) HeapDestroy(v_hPrivateHeap);
        DeleteCriticalSection(&v_csecThreadSynch);
		break;
	}
	return TRUE;
}
Exemple #23
0
/*****************************************************************************
 * DllMain()
 *****************************************************************************
 * DLL entry point.
 */
BOOL WINAPI
DllMain
(
    IN      HINSTANCE   Instance,
    IN      ULONG       Reason,
    IN      PVOID       Reserved
)
{
	BOOL result = TRUE;

    switch (Reason)
    {
        case DLL_PROCESS_ATTACH:
        {
            hDllInstance = Instance;

            hDllHeap = HeapCreate(0, 0x10000, 0);

			DisableThreadLibraryCalls(hDllInstance);
        }
        break;

        case DLL_PROCESS_DETACH:
        {
            if (hDllHeap) HeapDestroy(hDllHeap);
        }
        break;
    }

    return result;
}
void _createHeap_wxString()
{
	if( win32_string_heap == INVALID_HANDLE_VALUE )
	{
		//wxASSERT( win32_string_heap_refcount == 0 );
		win32_string_heap = HeapCreate( 0, 0x200000, 0 );
	}
}
Exemple #25
0
CMemoryPool::CMemoryPool()
{
	m_heap = HeapCreate(0, 0, 0);
	if (nullptr == m_heap)
	{
		throw runtime_error("Can not create a new memory heap");
	}
}
Exemple #26
0
 CSimpleWndHelper::CSimpleWndHelper(HINSTANCE hInst,LPCTSTR pszClassName)
     :m_hInst(hInst)
     ,m_sharePtr(NULL)
 {
     InitializeCriticalSection(&m_cs);
     m_hHeap=HeapCreate(HEAP_CREATE_ENABLE_EXECUTE,0,0);
     m_atom=CSimpleWnd::RegisterSimpleWnd(hInst,pszClassName);
 }
void _createHeap_wxObject()
{
	if( win32_object_heap == INVALID_HANDLE_VALUE )
	{
		//wxASSERT( win32_object_heap_refcount == 0 );
		win32_object_heap = HeapCreate( 0, 0x200000, 0 );
	}
}
Exemple #28
0
Thread NewThread(void)
{	 
	HANDLE ThreadHeap = HeapCreate(0, 0, 1024);
    Thread thread = (Thread) HeapAlloc(ThreadHeap, HEAP_ZERO_MEMORY, sizeof(ThreadClass));	
	thread->THREADSTACK = 1024;
	thread->ThreadHeap = ThreadHeap;
	return thread;
}
Exemple #29
0
HANDLE STDMETHODCALLTYPE UtilExecutionEngine::ClrHeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize) 
{
#ifdef FEATURE_PAL
    return NULL;
#else
    return HeapCreate(flOptions, dwInitialSize, dwMaximumSize);
#endif
}
Exemple #30
0
int yr_heap_alloc(void)
{
  hHeap = HeapCreate(0, 0x8000, 0);

  if (hHeap == NULL)
    return ERROR_INTERNAL_FATAL_ERROR;

  return ERROR_SUCCESS;
}