• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ HeapSetInformation函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中HeapSetInformation函数的典型用法代码示例。如果您正苦于以下问题:C++ HeapSetInformation函数的具体用法?C++ HeapSetInformation怎么用?C++ HeapSetInformation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了HeapSetInformation函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: SetupCRT

void SetupCRT(const CommandLine& parsed_command_line) {
#if defined(OS_WIN)
#ifdef _CRTDBG_MAP_ALLOC
  _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
  _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
#else
  if (!parsed_command_line.HasSwitch(switches::kDisableBreakpad)) {
    _CrtSetReportMode(_CRT_ASSERT, 0);
  }
#endif

  // Enable the low fragmentation heap for the CRT heap. The heap is not changed
  // if the process is run under the debugger is enabled or if certain gflags
  // are set.
  bool use_lfh = false;
  if (parsed_command_line.HasSwitch(switches::kUseLowFragHeapCrt))
    use_lfh = parsed_command_line.GetSwitchValue(switches::kUseLowFragHeapCrt)
        != L"false";
  if (use_lfh) {
    void* crt_heap = reinterpret_cast<void*>(_get_heap_handle());
    ULONG enable_lfh = 2;
    HeapSetInformation(crt_heap, HeapCompatibilityInformation,
                       &enable_lfh, sizeof(enable_lfh));
  }
#endif
}
开发者ID:KerwinMa,项目名称:berkelium,代码行数:26,代码来源:Berkelium.cpp


示例2: WinMain

//used if windows subsystem
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
	//notify user if heap is corrupt
	HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL,0);

	// Enable run-time memory leak check for debug builds.
	#if defined(DEBUG) | defined(_DEBUG)
		_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
	#endif

	MainEngine engine;
	//AbstractGame *gamePtr = new Test();
	//AbstractGame *gamePtr = new RType();
	//AbstractGame *gamePtr = new BouncingBall();
	//AbstractGame *gamePtr = new BouncingBalls();
	//AbstractGame *gamePtr = new Goniometry();
	AbstractGame *gamePtr = new Chainreaction();
	//AbstractGame *gamePtr = new SolarSystem();
	//AbstractGame *gamePtr = new ButtonTextBoxTestApp();
	//AbstractGame *gamePtr = new LineCollision();
	//AbstractGame *gamePtr = new FollowMouse();
	//AbstractGame *gamePtr = new PolygonTester();
	//AbstractGame *gamePtr = new AlteredBeast();
	//AbstractGame *gamePtr = new CaveApp();
	//AbstractGame *gamePtr = new AudioTester();

	engine.SetGame(gamePtr);
	if (SUCCEEDED(engine.Initialize()))
	{
		engine.RunMessageLoop();
	}
	delete gamePtr;
	return 0;
}
开发者ID:cskiwi,项目名称:Chainreaction,代码行数:35,代码来源:GameWinMain.cpp


示例3: wWinMain

// Program's main entry point
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR lpCmdLine, int nCmdShow)
{
#ifdef _DEBUG
	AllocConsole();

	HANDLE handle_out = GetStdHandle(STD_OUTPUT_HANDLE);
	int hCrt = _open_osfhandle((long) handle_out, _O_TEXT);
	FILE* hf_out = _fdopen(hCrt, "w");
	setvbuf(hf_out, NULL, _IONBF, 1);
	*stdout = *hf_out;

	HANDLE handle_in = GetStdHandle(STD_INPUT_HANDLE);
	hCrt = _open_osfhandle((long) handle_in, _O_TEXT);
	FILE* hf_in = _fdopen(hCrt, "r");
	setvbuf(hf_in, NULL, _IONBF, 128);
	*stdin = *hf_in;
#endif

    UNREFERENCED_PARAMETER(hPrevInstance);
    SingleFace app;

    HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);

    return app.Run(hInstance, lpCmdLine, nCmdShow);
}
开发者ID:huangxiaojian,项目名称:GIT,代码行数:26,代码来源:SingleFace.cpp


示例4: WinMain

// Provides the application entry point.
int WINAPI WinMain(
    HINSTANCE /* hInstance */,
    HINSTANCE /* hPrevInstance */,
    LPSTR /* lpCmdLine */,
    int /* nCmdShow */
)
{
    // Use HeapSetInformation to specify that the process should
    // terminate if the heap manager detects an error in any heap used
    // by the process.
    // The return value is ignored, because we want to continue running in the
    // unlikely event that HeapSetInformation fails.
    HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);

    if (SUCCEEDED(CoInitialize(NULL)))
    {
        {
            DemoApp app;

            if (SUCCEEDED(app.Initialize()))
            {
                app.RunMessageLoop();
            }
        }
        CoUninitialize();
    }

    return 0;
}
开发者ID:MarkoFilipovic,项目名称:Playground,代码行数:30,代码来源:Main.cpp


示例5: FAssert

//------------------------------------------------------------------------------
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
}
开发者ID:kawyua,项目名称:Community-Patch-DLL,代码行数:28,代码来源:CvDllContext.cpp


示例6: while

	/*
	* http://msdn.microsoft.com/en-us/library/windows/desktop/aa366750(v=vs.85).aspx
	*/
	void CMemorymgt::EnableLFH()
	{
		// get default heaps
		while (true)
		{
			DWORD lTotalHeapNum = ::GetProcessHeaps(mHeapHandleCount, mHeapHandle.begin());
			if (lTotalHeapNum == 0)
			{
				return;
			}
			if (lTotalHeapNum != mHeapHandleCount)
			{
				mHeapHandleCount = lTotalHeapNum;
				mHeapHandle.reset(mHeapHandleCount);
			}
			else 
				break;
		}
		
		// enable low fragmentation heap
		unsigned long lHeapFragValue = 2;
		for (int iter = 0; iter < mHeapHandleCount; ++iter)
		{
			if (!HeapSetInformation(
				mHeapHandle[iter],
				HeapCompatibilityInformation,
				&lHeapFragValue,
				sizeof(lHeapFragValue)
				))
			{

			}
		}

	}
开发者ID:lijunjun,项目名称:controller,代码行数:38,代码来源:mcontl.cpp


示例7: wWinMain

int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int nCmdShow)
{
	UNREFERENCED_PARAMETER(nCmdShow);
	UNREFERENCED_PARAMETER(pCmdLine);
	//notify user if heap is corrupt
	HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL,0);

	// Enable run-time memory leak check for debug builds.
	#if defined(DEBUG) | defined(_DEBUG)
		_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );

		typedef HRESULT(__stdcall *fPtr)(const IID&, void**); 
		HMODULE hDll = LoadLibrary(L"dxgidebug.dll"); 
		fPtr DXGIGetDebugInterface = (fPtr)GetProcAddress(hDll, "DXGIGetDebugInterface"); 

		IDXGIDebug* pDXGIDebug;
		DXGIGetDebugInterface(__uuidof(IDXGIDebug), (void**)&pDXGIDebug);
		//_CrtSetBreakAlloc(4039);
	#endif

	auto pGame = new MainGame();
	auto result = pGame->Run(hInstance);
	UNREFERENCED_PARAMETER(result);
	delete pGame;
	
	return 0;
}
开发者ID:Kwintenvdb,项目名称:DirectX-Turret-Game,代码行数:27,代码来源:Main.cpp


示例8: WinMain

int WINAPI WinMain(
    HINSTANCE /* hInstance */,
    HINSTANCE /* hPrevInstance */,
    LPSTR /* lpCmdLine */,
    int /* nCmdShow */
    )
{
    // Ignoring the return value because we want to continue running even in the
    // unlikely event that HeapSetInformation fails.
    HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);

    if (SUCCEEDED(CoInitialize(NULL)))
    {
        {
            DemoApp app;

            if (SUCCEEDED(app.Initialize()))
            {
                app.RunMessageLoop();
            }
        }
        CoUninitialize();
    }

    return 0;
}
开发者ID:AbdoSalem95,项目名称:WindowsSDK7-Samples,代码行数:26,代码来源:SimplePathAnimationSample.cpp


示例9: wWinMain

int WINAPI wWinMain(_In_ HINSTANCE hInstance,
	_In_opt_ HINSTANCE hPrevInstance,
	_In_ PWSTR lpCmdLine,
	_In_ int nCmdShow)
{
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);
	if (!CoInitializeSingle::Initialize()){

	}
	HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
	Metro::MUI::muiController.Init();
	_Module.Init(nullptr, hInstance);
	MSG msg;
	::InitCommonControls();
	Metro::MetroWindow iMetroWindow;
	
	RECT rect = { (::GetSystemMetrics(SM_CXSCREEN) - 720) / 2, (::GetSystemMetrics(SM_CYSCREEN) - 450) / 2, (::GetSystemMetrics(SM_CXSCREEN) + 720) / 2, (::GetSystemMetrics(SM_CYSCREEN) + 450) / 2 };
	if (iMetroWindow.Create(nullptr, rect, METRO_INTERNAL_WINDOWLNAME, WS_OVERLAPPED | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_ACCEPTFILES) == nullptr)
	{
		return -1;
	}
	DWORD dwExit = 0;
	iMetroWindow.ShowWindow(nCmdShow);
	iMetroWindow.UpdateWindow();

	while (GetMessage(&msg, nullptr, 0, 0)>0)
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
	dwExit = iMetroWindow.GetExitCode();
	_Module.Term();
	return dwExit;
}
开发者ID:codepongo,项目名称:iBurnMgr,代码行数:35,代码来源:iBurnMgrStart.cpp


示例10: wWinMain

int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR, int nCmdShow)
{
    HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);

    MSG msg;

    ZeroMemory(&msg, sizeof(msg));

    // Perform application initialization.
    if (!InitInstance(hInstance, nCmdShow))
    {
        NotifyError(NULL, L"Could not initialize the application.", 
            HRESULT_FROM_WIN32(GetLastError()));
        return FALSE;
    }

    // Main message loop.
    while (GetMessage(&msg, NULL, 0, 0))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    // Clean up.
    if (g_pPlayer)
    {
        g_pPlayer->Shutdown();
        SafeRelease(&g_pPlayer);
    }
    return 0;
}
开发者ID:TimSC,项目名称:wmf-video-player-example,代码行数:31,代码来源:winmain.cpp


示例11: _win32_initHeap

inline static void _win32_initHeap( void )
{
    g_privateHeap = HeapCreate( 0, 0, 0 );

    unsigned int info = 0;
    HeapSetInformation( g_privateHeap, HeapCompatibilityInformation, &info, sizeof(info) );
}
开发者ID:qaisjp,项目名称:green-candy,代码行数:7,代码来源:dbgheap.cpp


示例12: WinMain

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	UNREFERENCED_PARAMETER(hInstance);
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);
	UNREFERENCED_PARAMETER(nCmdShow);

#if defined (DEBUG) | (_DEBUG)
	HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);

	//Enable run-time memory leak check for debug builds.
	//_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
	//_CrtSetBreakAlloc(0)
#endif

	//Create the engine
	//Engine* pEngine = ne Engine();

	//Kick of the game
	//int result = pEngine->RunLoop();

	//Delete the engine
	//delete pEngine;

	//return result;

	return 0;
}
开发者ID:Rhenar17,项目名称:engineenjoy,代码行数:28,代码来源:WinMain.cpp


示例13: subsys_winprocess_initialize

static int
subsys_winprocess_initialize(void)
{
#ifndef HeapEnableTerminationOnCorruption
#define HeapEnableTerminationOnCorruption 1
#endif

  /* On heap corruption, just give up; don't try to play along. */
  HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);

  /* SetProcessDEPPolicy is only supported on 32-bit Windows.
   * (On 64-bit Windows it always fails, and some compilers don't like the
   * PSETDEP cast.)
   * 32-bit Windows defines _WIN32.
   * 64-bit Windows defines _WIN32 and _WIN64. */
#ifndef _WIN64
  /* Call SetProcessDEPPolicy to permanently enable DEP.
     The function will not resolve on earlier versions of Windows,
     and failure is not dangerous. */
  HMODULE hMod = GetModuleHandleA("Kernel32.dll");
  if (hMod) {
    typedef BOOL (WINAPI *PSETDEP)(DWORD);
    PSETDEP setdeppolicy = (PSETDEP)GetProcAddress(hMod,
                           "SetProcessDEPPolicy");
    if (setdeppolicy) {
      /* PROCESS_DEP_ENABLE | PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION */
      setdeppolicy(3);
    }
  }
#endif /* !defined(_WIN64) */

  return 0;
}
开发者ID:jfrazelle,项目名称:tor,代码行数:33,代码来源:winprocess_sys.c


示例14: alHeapWin32_SetLowFragmentation

bool AL_CALLTYPE alHeapWin32_SetLowFragmentation(void* _this, bool bEnableLowFragmantation)
{
	alHeapWin32i* _data = (alHeapWin32i*)_this;
	ULONG HeapFragValue = bEnableLowFragmantation ? 2 : 0;
	if (!_data->heap)
		return false;
	return !!HeapSetInformation(_data->heap, HeapCompatibilityInformation, &HeapFragValue, sizeof(HeapFragValue));
}
开发者ID:hackshields,项目名称:antivirus,代码行数:8,代码来源:al_heap_win.c


示例15: wWinMain

// Program's main entry point
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR lpCmdLine, int nCmdShow)
{
    UNREFERENCED_PARAMETER(hPrevInstance);
    MultiFace app;

    HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);

    return app.Run(hInstance, lpCmdLine, nCmdShow);
}
开发者ID:AlanChatham,项目名称:SFMKinectFacialAnimation,代码行数:10,代码来源:MultiFace.cpp


示例16: wWinMain

int WINAPI wWinMain(
    HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPWSTR pszCmdLine,
    int nCmdShow)
{
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(pszCmdLine);
    UNREFERENCED_PARAMETER(nCmdShow);

    HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);

    HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);

    if (SUCCEEDED(hr))
    {
        {
            DemoApp app;
            HWND hWndMain = NULL;

            hWndMain = app.Initialize(hInstance);
            hr = hWndMain ? S_OK : E_FAIL;

            if (SUCCEEDED(hr))
            {
                BOOL fRet;
                MSG msg;

                // Load accelerator table
                HACCEL haccel = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDA_ACCEL_TABLE));
                if (haccel == NULL) 
                {
                    hr = E_FAIL;
                }
                // Main message loop:
                while ((fRet = GetMessage(&msg, NULL, 0, 0)) != 0)
                {
                    if (fRet == -1)
                    {
                        break;
                    }
                    else
                    {
                        if (!TranslateAccelerator(hWndMain, haccel, &msg))
                        {
                            TranslateMessage(&msg);
                            DispatchMessage(&msg);
                        }
                    }
                }
            }
        }
        CoUninitialize();
    }

    return 0;
}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:57,代码来源:WICProgressiveDecoding.cpp


示例17: _gum_memory_init

void
_gum_memory_init (void)
{
  ULONG heap_frag_value = 2;

  _gum_memory_heap = HeapCreate (HEAP_GENERATE_EXCEPTIONS, 0, 0);

  HeapSetInformation (_gum_memory_heap, HeapCompatibilityInformation,
      &heap_frag_value, sizeof (heap_frag_value));
}
开发者ID:pombredanne,项目名称:frida-gum,代码行数:10,代码来源:gummemory-windows.c


示例18: HeapSetInformation

AutoDiscoveryServerImpl::AutoDiscoveryServerImpl(const std::string& type, unsigned int port)
{
    HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
    std::ostringstream ss;
    ss << port;
    DNSServiceErrorType err = RegisterService(&client, "", type.c_str(), "", NULL, ss.str().c_str(), this);
    if (!client || err != kDNSServiceErr_NoError) { 
        OSG_WARN << "AutoDiscoveryImpl :: DNSService call failed " << (long int)err << std::endl; 
    }
}
开发者ID:yueying,项目名称:osg,代码行数:10,代码来源:AutoDiscoveryWinImpl.cpp


示例19: wWinMain

int WINAPI wWinMain(HINSTANCE /* hInstance */, HINSTANCE /* hPrevInstance */, LPWSTR lpCmdLine, int /* nCmdShow */)
{
	LPWSTR* arg_list;
	int arg_num = 0;

    // Ignore the return value because we want to continue running even in the
    // unlikely event that HeapSetInformation fails.
    HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);

    if (SUCCEEDED(CoInitialize(NULL)))
    {
		App *app = new App();
		arg_list = CommandLineToArgvW(lpCmdLine, &arg_num);
		if (arg_num == 2)
		{
			CardData data;
			strcpy_s(data.username, ws2s(arg_list[0]).c_str());
			strcpy_s(data.password, ws2s(arg_list[1]).c_str());

			try
			{
				NFC_READER->Initialize();
				NFC_READER->Write(data);
				NFC_READER->Uninitialize();
			}
			catch (...)
			{
				MessageBox(NULL, L"שגיאה התרחשה בכתיבה לכרטיס או שלא נמצא כרטיס...", L"שים/י לב!", STDMSGBOX | MB_ICONWARNING);
				return 1;
			}
			return 0;
		}
        if (SUCCEEDED(app->Initialize()))
        {
			app->ChangeScreenTo(App::Screens::WaitingToCardScreen);
			MSG msg;
			memset(&msg, 0, sizeof(msg));
			while (app->AppMode != -1)
			{
				if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
				{
					TranslateMessage(&msg);
					DispatchMessage(&msg);
				}

				app->Update();
				app->Render();
			}
        }
		delete app;
        CoUninitialize();
    }
	
    return 0;
}
开发者ID:Three141,项目名称:PectoStudioNFC,代码行数:55,代码来源:Main.cpp


示例20: TEST

TEST(MallocTests, HeapInformation) {
    HANDLE heap = GetProcessHeap();
    ASSERT_NE(heap, (HANDLE)NULL);
    ULONG heap_type;
    SIZE_T got;
    BOOL res = HeapQueryInformation(heap, HeapCompatibilityInformation, &heap_type,
                                    sizeof(heap_type), &got);
    ASSERT_EQ(res, TRUE);
    ASSERT_EQ(got, sizeof(heap_type));
    ASSERT_LT(heap_type, 3); /* 0, 1, 2 are the only valid values */

    heap_type = 2;
    res = HeapSetInformation(heap, HeapCompatibilityInformation, &heap_type,
                             sizeof(heap_type));
    ASSERT_EQ(res, TRUE);
    heap_type = 2;

    res = HeapSetInformation(heap, HeapEnableTerminationOnCorruption, NULL, 0);
    ASSERT_EQ(res, TRUE);
}
开发者ID:Maximus5,项目名称:drmemory,代码行数:20,代码来源:malloc_tests_win.cpp



注:本文中的HeapSetInformation函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ HeapTupleGetOid函数代码示例发布时间:2022-05-30
下一篇:
C++ HeapReAlloc函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap