当前位置: 首页>>代码示例>>C++>>正文


C++ SetDllDirectory函数代码示例

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


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

示例1: LoadFTFunc

bool CText::Init()
{
#define LoadFTFunc(ptr, type, name) (FreeType_loaded&=(ptr=(type)GetProcAddress(FreeType,name))!=NULL)

	if (FreeType_loaded)
		return true;

	SetDllDirectory(CSettings::DataDir);
	FreeType=LoadLibrary(FREETYPE_DLL);
	SetDllDirectory(NULL);

	if (FreeType)
	{
		FreeType_loaded=true;
		LoadFTFunc(pFT_Init_FreeType,ptr_FT_Init_FreeType,"FT_Init_FreeType");
		LoadFTFunc(pFT_Done_FreeType,ptr_FT_Done_FreeType,"FT_Done_FreeType");
		LoadFTFunc(pFT_New_Face,ptr_FT_New_Face,"FT_New_Face");
		LoadFTFunc(pFT_Done_Face,ptr_FT_Done_Face,"FT_Done_Face");
		LoadFTFunc(pFT_Set_Char_Size,ptr_FT_Set_Char_Size,"FT_Set_Char_Size");
		LoadFTFunc(pFT_Get_Char_Index,ptr_FT_Get_Char_Index,"FT_Get_Char_Index");
		LoadFTFunc(pFT_Load_Glyph,ptr_FT_Load_Glyph,"FT_Load_Glyph");
		LoadFTFunc(pFT_Done_Glyph,ptr_FT_Done_Glyph,"FT_Done_Glyph");
		LoadFTFunc(pFT_Get_Glyph,ptr_FT_Get_Glyph,"FT_Get_Glyph");
		LoadFTFunc(pFT_Glyph_To_Bitmap,ptr_FT_Glyph_To_Bitmap,"FT_Glyph_To_Bitmap");
	}

	return FreeType_loaded;
}
开发者ID:vsemionov,项目名称:solar-space,代码行数:28,代码来源:Text.cpp

示例2: LoadRainmeterLibrary

/*
** Attempts to load Rainmeter.dll. If it fails, retries after loading our own copies of the CRT
** DLLs in the Runtime directory.
*/
HINSTANCE LoadRainmeterLibrary()
{
	HINSTANCE rmDll = LoadLibrary(L"Rainmeter.dll");
	if (!rmDll)
	{
		WCHAR path[MAX_PATH];
		if (GetModuleFileName(nullptr, path, MAX_PATH) > 0)
		{
			PathRemoveFileSpec(path);
			PathAppend(path, L"Runtime");
			SetDllDirectory(path);
			PathAppend(path, L"msvcp120.dll");

			// Loading msvcpNNN.dll will load msvcrNNN.dll as well.
			HINSTANCE msvcrDll = LoadLibrary(path);
			SetDllDirectory(L"");

			if (msvcrDll)
			{
				rmDll = LoadLibrary(L"Rainmeter.dll");
				FreeLibrary(msvcrDll);
			}
		}
	}

	return rmDll;
}
开发者ID:BraxtonEveslage,项目名称:rainmeter,代码行数:31,代码来源:Application.cpp

示例3: zenilib_main

ZENI_REST_DLL int zenilib_main(int argc, char **argv) {
#ifdef _WINDOWS
  _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );

#ifdef X64
  if(_chdir("..\\..")) {
#else
  if(_chdir("..")) {
#endif
    std::cerr << "Setting working directory failed with error code ':" << GetLastError() << "'\n";
    return -1;
  }
#ifdef X64
  if(!SetDllDirectory("bin\\x64")) {
#else
  if(!SetDllDirectory("bin")) {
#endif
    std::cerr << "Setting DLL directory failed with error code ':" << GetLastError() << "'\n";
    return -2;
  }
#else
  {
    char application_path[FILENAME_MAX];
#ifndef _MACOSX
    int length = readlink("/proc/self/exe", application_path, FILENAME_MAX);
    up_one_dir(application_path, length);
#else
    uint32_t size = sizeof(application_path);
    if(_NSGetExecutablePath(application_path, &size)) {
      std::cerr << "Loading working directory failed.\n";
      return -1;
    }
    int length = int(strlen(application_path));
    
    for(int i = 0; i != 2; ++i)
      up_one_dir(application_path, length);
    memcpy(application_path + length, "/zenilib", 9);
#endif
    if(chdir(application_path)) {
      std::cerr << "chdir: " << application_path << '\n';
      std::cerr << "Setting working directory failed with error code: '" << errno << "'\n";
      std::cerr << strerror(errno) << '\n';
      return -1;
    }
  }
#endif

  return main2(argc, argv);
}
开发者ID:heatseeker0,项目名称:olink,代码行数:49,代码来源:main.cpp

示例4: _T

bool CI8DeskSvr::StartRemoteControl()
{
	stdex::tString strFilePath = utility::GetAppPath() + _T("WinVNC\\");
	SetDllDirectory(strFilePath.c_str());

	strFilePath += TEXT("WinVNC.dll");
	m_hRemoteCtrl = LoadLibrary(strFilePath.c_str());
	if (m_hRemoteCtrl == NULL)
		return false;

	typedef BOOL (WINAPI* PFNSTARTVNC)();
	PFNSTARTVNC pfnStartVNC = GetProcAddress(m_hRemoteCtrl, "[email protected]");
	if (pfnStartVNC == NULL)
		return false;

	try
	{
		pfnStartVNC(); 
	}
	catch(...)
	{
		m_pLogger->WriteLog(LM_INFO, TEXT("加载远程控制客户端失败。\r\n"));
		BOOL (WINAPI* pfnStopVNC)();
		pfnStopVNC = GetProcAddress(m_hRemoteCtrl, "[email protected]");
		if (pfnStopVNC == NULL)
			return false;

		pfnStopVNC(); 
	}

	m_pLogger->WriteLog(LM_INFO, TEXT("加载远程控制客户端成功。\r\n"));
	return true;
}
开发者ID:lubing521,项目名称:important-files,代码行数:33,代码来源:I8DeskSvr.cpp

示例5: main

int
main(int argc, char* argv[])
{
#ifdef MOZ_WIDGET_GONK
  // The first call of ProcessState::self() (per process) will register into
  // binder driver by current thread info, so the main thread is a best one to
  // do registration because it never leaves.
  android::sp<android::ProcessState> proc(android::ProcessState::self());
#endif

#if defined(XP_WIN) && defined(DEBUG_bent)
    MessageBox(NULL, L"Hi", L"Hi", MB_OK);
#endif

    // Check for the absolute minimum number of args we need to move
    // forward here. We expect the last arg to be the child process type.
    if (argc < 1)
      return 1;
    GeckoProcessType proctype = XRE_StringToChildProcessType(argv[--argc]);

#ifdef XP_WIN
    // For plugins, this is done in PluginProcessChild::Init, as we need to
    // avoid it for unsupported plugins.  See PluginProcessChild::Init for
    // the details.
    if (proctype != GeckoProcessType_Plugin) {
        mozilla::SanitizeEnvironmentVariables();
        SetDllDirectory(L"");
    }
#endif

    nsresult rv = XRE_InitChildProcess(argc, argv, proctype);
    NS_ENSURE_SUCCESS(rv, 1);

    return 0;
}
开发者ID:hadicoffee,项目名称:jb412gecko,代码行数:35,代码来源:MozillaRuntimeMain.cpp

示例6: main

int
main(int argc, char* argv[])
{
#if defined(XP_WIN) && defined(DEBUG_bent)
    MessageBox(NULL, L"Hi", L"Hi", MB_OK);
#endif

    // Check for the absolute minimum number of args we need to move
    // forward here. We expect the last arg to be the child process type.
    if (argc < 1)
      return 1;
    GeckoProcessType proctype = XRE_StringToChildProcessType(argv[--argc]);

#ifdef XP_WIN
    // For plugins, this is done in PluginProcessChild::Init, as we need to
    // avoid it for unsupported plugins.  See PluginProcessChild::Init for
    // the details.
    if (proctype != GeckoProcessType_Plugin) {
        mozilla::SanitizeEnvironmentVariables();
        SetDllDirectory(L"");
    }
#endif

    nsresult rv = XRE_InitChildProcess(argc, argv, proctype);
    NS_ENSURE_SUCCESS(rv, 1);

    return 0;
}
开发者ID:Anachid,项目名称:mozilla-central,代码行数:28,代码来源:MozillaRuntimeMain.cpp

示例7: DllMain

BOOL APIENTRY DllMain(HMODULE hModule,
	DWORD  ul_reason_for_call,
	LPVOID lpReserved
	)
{
	WCHAR path[MAX_PATH];
	GetModuleFileName(NULL, path, MAX_PATH);
	PathRemoveFileSpec(path);
	wcscat_s(path, L"\\ffmpeg");

#if defined(_WIN64)
	BOOL Is64BitProcess = TRUE;   // 64-bit program
#else
	BOOL Is64BitProcess = FALSE;
#endif

	wcscat_s(path, Is64BitProcess ? L"\\x64" : L"\\x86");
	SetDllDirectory(path);
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}
开发者ID:Djancacz,项目名称:framework,代码行数:28,代码来源:dllmain.cpp

示例8: CheckOnRestartCommand

//////////////////////////////////////////////////////////
//
// CheckOnRestartCommand
//
// Changes current directory if required
//
//////////////////////////////////////////////////////////
SString CheckOnRestartCommand ( void )
{
    const SString strMTASAPath = GetMTASAPath ();

    SetCurrentDirectory ( strMTASAPath );
    SetDllDirectory( strMTASAPath );

    SString strOperation, strFile, strParameters, strDirectory, strShowCmd;
    if ( GetOnRestartCommand ( strOperation, strFile, strParameters, strDirectory, strShowCmd ) )
    {
        if ( strOperation == "files" || strOperation == "silent" )
        {
            //
            // Update
            //

            // Make temp path name and go there
            SString strArchivePath, strArchiveName;
            strFile.Split ( "\\", &strArchivePath, &strArchiveName, -1 );

            SString strTempPath = MakeUniquePath ( strArchivePath + "\\_" + strArchiveName + "_tmp_" );

            if ( !MkDir ( strTempPath ) )
                return "FileError1";

            if ( !SetCurrentDirectory ( strTempPath ) )
                return "FileError2";

            // Start progress bar
            if ( !strParameters.Contains( "hideprogress" ) )
               StartPseudoProgress( g_hInstance, "MTA: San Andreas", _("Extracting files...") );

            // Try to extract the files
            if ( !ExtractFiles ( strFile ) )
            {
                // If extract failed and update file is an exe, try to run it
                if ( ExtractExtension ( strFile ).CompareI ( "exe" ) )
                    ShellExecuteBlocking ( "open", strFile, "-s" );
            }

            // Stop progress bar
            StopPseudoProgress();

            // If a new "Multi Theft Auto.exe" exists, let that complete the install
            if ( FileExists ( MTA_EXE_NAME_RELEASE ) )
                return "install from far " + strOperation + " " + strParameters;

            // Otherwise use the current exe to install
            return "install from near " + strOperation + " " + strParameters;
        }
        else
        {
            AddReportLog ( 5052, SString ( "CheckOnRestartCommand: Unknown restart command %s", strOperation.c_str () ) );
        }
    }
    return "no update";
}
开发者ID:AdiBoy,项目名称:mtasa-blue,代码行数:64,代码来源:Install.cpp

示例9: _tWinMain

int APIENTRY _tWinMain(HINSTANCE	/*hInstance*/,
					 HINSTANCE		/*hPrevInstance*/,
					 LPTSTR			lpCmdLine,
					 int			/*nCmdShow*/)
{
	SetDllDirectory(L"");

	InitCommonControls();

	size_t cmdlineLen =_tcslen(lpCmdLine);
	if (lpCmdLine[0] == '"' && cmdlineLen > 1 && lpCmdLine[cmdlineLen - 1] == '"')
	{
		lpCmdLine[cmdlineLen - 1] = 0;
		++lpCmdLine;
	}
	if (lpCmdLine[0] != 0)
		g_Prompt = lpCmdLine;

	const TCHAR *yesno=_T("(yes/no)");
	const size_t lens = _tcslen(yesno);
	const TCHAR *p = lpCmdLine;
	BOOL bYesNo=FALSE;

	while(*p)
	{
		if (_tcsncicmp(p, yesno, lens) == 0)
		{
			bYesNo = TRUE;
			break;
		}
		++p;
	}

	if(bYesNo)
	{
		if (::MessageBox(nullptr, g_Prompt, _T("TortoiseGit - git CLI stdin wrapper"), MB_YESNO | MB_ICONQUESTION) == IDYES)
		{
			_tprintf(_T("yes"));
		}
		else
		{
			_tprintf(_T("no"));
		}
		return 0;
	}
	else
	{
		if (DialogBox(hInst, MAKEINTRESOURCE(IDD_ASK_PASSWORD), nullptr, PasswdDlg) == IDOK)
		{
			_tprintf(_T("%s\n"), (LPCTSTR)g_PassWord);
			return 0;
		}
		_tprintf(_T("\n"));
		return -1;
	}
}
开发者ID:tribis,项目名称:TortoiseGit,代码行数:56,代码来源:SshAskPass.cpp

示例10: SetDllDirectory

CTortoiseGitBlameApp::CTortoiseGitBlameApp()
{
	SetDllDirectory(L"");
	CCrashReportTGit crasher(L"TortoiseGitBlame " _T(APP_X64_STRING), TGIT_VERMAJOR, TGIT_VERMINOR, TGIT_VERMICRO, TGIT_VERBUILD, TGIT_VERDATE);
	CCrashReport::Instance().AddUserInfoToReport(L"CommandLine", GetCommandLine());
	EnableHtmlHelp();

	m_gdiplusToken = NULL;
	m_bHiColorIcons = TRUE;
}
开发者ID:hfeeki,项目名称:TortoiseGit,代码行数:10,代码来源:TortoiseGitBlame.cpp

示例11: SetDllDirectory

CMATLAB::CMATLAB()
{
    std::wstring wpath=string2WideString(path);
    SetDllDirectory(LPCWSTR(wpath.data()));

    libmat.setFileName("libmat");
    if (!libmat.load()) throw "CMATLAB::CMATLAB error: unable to load libmat";

    libmx.setFileName("libmx");
    if(!libmx.load()) throw "CMATLAB::CMATLAB error: unable to load libmx";

    libeng.setFileName("libeng");
    if(!libeng.load()) throw "CMATLAB::CMATLAB error: unable to load libeng";

    pMatOpen = (matftype1) libmat.resolve("matOpen");
    if (!pMatOpen)  throw "CMATLAB::CMATLAB error: unable to resolve libmat for matOpen";
    pMatClose = (matftype2) libmat.resolve("matClose");
    if (!pMatClose) throw "CMATLAB::CMATLAB error: unable to resolve libmat for matClose";
    pMatPutVariable = (matftype3) libmat.resolve("matPutVariable");
    if (!pMatPutVariable) throw "CMATLAB::CMATLAB error: unable to resolve libmat for matPutVariable";
    pMatGetVariable = (matftype4) libmat.resolve("matGetVariable");
    if (!pMatGetVariable) throw "CMATLAB::CMATLAB error: unable to resolve libmat for matGetVariable";


    pMxCreateDoubleMatrix = (mxftype1) libmx.resolve("mxCreateDoubleMatrix");
    if (!pMxCreateDoubleMatrix) throw "CMATLAB::CMATLAB error: unable to resolve libmx for mxCreateDoubleMatrix";
    pMxDestroyArray = (mxftype2) libmx.resolve("mxDestroyArray");
    if (!pMxDestroyArray) throw "CMATLAB::CMATLAB error: unable to resolve libmx for mxDestroyArray";
    pMxGetPr = (mxftype3) libmx.resolve("mxGetPr");
    if (!pMxGetPr) throw "CMATLAB::CMATLAB error: unable to resolve libmx for mxGetPr";
    pMxSetPr = (mxftype4) libmx.resolve("mxSetPr");
    if (!pMxSetPr) throw "CMATLAB::CMATLAB error: unable to resolve libmx for mxSetPr";
    pMxGetNumberOfElements = (mxftype5) libmx.resolve("mxGetNumberOfElements");
    if (!pMxGetNumberOfElements) throw "CMATLAB::CMATLAB error: unable to resolve libmx for mxGetNumberOfElements";


    pEngOpenSingleUse = (engftype1) libeng.resolve("engOpenSingleUse");
    if (!pEngOpenSingleUse) throw "CMATLAB::CMATLAB error: unable to resolve libeng for engOpenSingleUse";
    pEngOpen = (engftype2) libeng.resolve("engOpen");
    if (!pEngOpen) throw "CMATLAB::CMATLAB error: unable to resolve libeng for engOpen";
    pEngClose = (engftype3) libeng.resolve("engClose");
    if (!pEngClose) throw "CMATLAB::CMATLAB error: unable to resolve libeng for engClose";
    pEngGetVisible = (engftype4) libeng.resolve("engGetVisible");
    if (!pEngGetVisible) throw "CMATLAB::CMATLAB error: unable to resolve libeng for engGetVisible";
    pEngSetVisible = (engftype5) libeng.resolve("engSetVisible");
    if (!pEngSetVisible) throw "CMATLAB::CMATLAB error: unable to resolve libeng for engSetVisible";
    pEngEvalString = (engftype6) libeng.resolve("engEvalString");
    if (!pEngEvalString) throw "CMATLAB::CMATLAB error: unable to resolve libeng for engEvalString";
    pEngGetVariable = (engftype7) libeng.resolve("engGetVariable");
    if (!pEngGetVariable) throw "CMATLAB::CMATLAB error: unable to resolve libeng for engGetVariable";
    pEngPutVariable = (engftype8) libeng.resolve("engPutVariable");
    if (!pEngPutVariable) throw "CMATLAB::CMATLAB error: unable to resolve libeng for engPutVariable";
    pEngOutputBuffer = (engftype9) libeng.resolve("engOutputBuffer");
    if (!pEngOutputBuffer) throw "CMATLAB::CMATLAB error: unable to resolve libeng for engOutputBuffer";
}
开发者ID:davor-,项目名称:GoSum,代码行数:55,代码来源:MatlabLibrary.cpp

示例12: _tsplitpath

    void EvalService::loadPlugin( const CString& arxFilePath )
    {
        TCHAR szDrive[_MAX_DRIVE];
        TCHAR szDir[_MAX_DIR];
        TCHAR szFile[_MAX_FNAME];
        TCHAR szExt[_MAX_EXT];
        _tsplitpath( ( LPCTSTR )arxFilePath, szDrive, szDir, szFile, szExt ); // 拆分路径

        CString serviceName;
        serviceName.Format( _T( "%s_SERVICE_NAME" ), CString( szFile ).MakeUpper() );

        /* 问题:插件(cmsr2010.arx)加载过程中无法找到所有使用的其它dll
         * 奇怪:正常加载dll应该从当前目录下搜索,按理说应该是能够找到的???
         * 临时解决方案:
         *		1) 将插件所在文件夹路径添加到dll搜索路径
         *		2) 或将dll的路径添加到path环境变量
         *		3) 或提前加载插件(手动或在VVLoader中自动加载)
         */
        // 构造arx所在文件夹路径
        TCHAR szPath[_MAX_PATH];
        _tmakepath( szPath, szDrive, szDir, NULL, NULL ); // 合并盘符

        // 将该路径添加到dll搜索路径中
        // API使用前提:xp sp1(>=0x0502),在stdafx.h中修改
        SetDllDirectory( szPath );

        m_pEvalPluginManager->load( arxFilePath, serviceName );

        //TCHAR szDllPath[_MAX_PATH];
        //GetDllDirectory(_MAX_PATH, szDllPath);
        //AfxMessageBox(szDllPath);

        // 还原dll搜索路径
        SetDllDirectory( NULL );

        // 打印显示路径为空
        //     注:191版本能够正常运行,测试显示路径也是为空(默认)
        //TCHAR szDllPath2[_MAX_PATH];
        //GetDllDirectory(_MAX_PATH, szDllPath2);
        //AfxMessageBox(szDllPath2);
    }
开发者ID:kanbang,项目名称:myexercise,代码行数:41,代码来源:EvalService.cpp

示例13: DllMain

int WINAPI DllMain(HINSTANCE hModule, DWORD dwReason, PVOID pvNothing)
{
    CFilePathTranslator     FileTranslator;
    std::string             WorkingDirectory;

    if ( dwReason == DLL_PROCESS_ATTACH )
    {
        WriteDebugEvent( SString( "DLL_PROCESS_ATTACH %08x", pvNothing ) );
        if ( IsGTAProcess() )
        {
            WriteDebugEvent( SString( "ModuleFileName: %s", *GetLaunchPathFilename() ) );

            AddUtf8FileHooks();

            // Set low frag heap for XP
            ULONG heapInfo = 2 ;
            HeapSetInformation( GetProcessHeap(), HeapCompatibilityInformation, &heapInfo, sizeof( heapInfo ) );

            FileTranslator.GetGTARootDirectory ( WorkingDirectory );
            SetCurrentDirectory ( WorkingDirectory.c_str ( ) );

            // For dll searches, this call replaces the current directory entry and turns off 'SafeDllSearchMode'
            // Meaning it will search the supplied path before the system and windows directory.
            // http://msdn.microsoft.com/en-us/library/ms682586%28VS.85%29.aspx
            SetDllDirectory( CalcMTASAPath ( "MTA" ) );

            g_pCore = new CCore;

            FileTranslator.GetGTARootDirectory ( WorkingDirectory );
            SetCurrentDirectory ( WorkingDirectory.c_str ( ) );
        }
    } 
    else if (dwReason == DLL_PROCESS_DETACH)
    {
        WriteDebugEvent( SString( "DLL_PROCESS_DETACH %08x", pvNothing ) );
        if ( IsGTAProcess () )
        {
            RemoveUtf8FileHooks();

            AddReportLog( 7102, "Core - PROCESS_DETACH" );
            // For now, TerminateProcess if any destruction is attempted (or we'll crash)
            TerminateProcess ( GetCurrentProcess (), 0 );

            if ( g_pCore )
            {
                delete g_pCore;
                g_pCore = NULL;
            }
        }
    }

    return TRUE;
}
开发者ID:AdiBoy,项目名称:mtasa-blue,代码行数:53,代码来源:Core.cpp

示例14: ws_init_dll_search_path

gboolean
ws_init_dll_search_path()
{
    gboolean dll_dir_set = FALSE, npf_found = FALSE;
    wchar_t *program_path_w;
    wchar_t npcap_path_w[MAX_PATH];
    unsigned int retval;
    SC_HANDLE h_scm, h_serv;

    dll_dir_set = SetDllDirectory(_T(""));
    if (dll_dir_set) {
        /* Do not systematically add Npcap path as long as we favor WinPcap over Npcap. */
        h_scm = OpenSCManager(NULL, NULL, 0);
        if (h_scm) {
            h_serv = OpenService(h_scm, _T("npf"), SC_MANAGER_CONNECT|SERVICE_QUERY_STATUS);
            if (h_serv) {
                CloseServiceHandle(h_serv);
                npf_found = TRUE;
            }
            CloseServiceHandle(h_scm);
        }
        if (!npf_found) {
            /* npf service was not found, so WinPcap is not (properly) installed.
               Add Npcap folder to libraries search path. */
            retval = GetSystemDirectoryW(npcap_path_w, MAX_PATH);
            if (0 < retval && retval <= MAX_PATH) {
                wcscat_s(npcap_path_w, MAX_PATH, L"\\Npcap");
                dll_dir_set = SetDllDirectory(npcap_path_w);
            }
        }
    }

    if (!dll_dir_set && init_dll_load_paths()) {
        program_path_w = g_utf8_to_utf16(program_path, -1, NULL, NULL, NULL);
        SetCurrentDirectory(program_path_w);
        g_free(program_path_w);
    }

    return dll_dir_set;
}
开发者ID:alagoutte,项目名称:wireshark,代码行数:40,代码来源:file_util.c

示例15: strMessage

void CCrashDumpWriter::RunErrorTool ( CExceptionInformation* pExceptionInformation )
{
// MTA Error Reporter is now integrated into the launcher

    // Only do once
    static bool bDoneReport = false;
    if ( bDoneReport )
        return;
    bDoneReport = false;

    // Log the basic exception information
    SString strMessage ( "Crash 0x%08X 0x%08X %s"
                         " EAX=%08X EBX=%08X ECX=%08X EDX=%08X ESI=%08X"
                         " EDI=%08X EBP=%08X ESP=%08X EIP=%08X FLG=%08X"
                         " CS=%04X DS=%04X SS=%04X ES=%04X"
                         " FS=%04X GS=%04X",
                         pExceptionInformation->GetCode (),
                         pExceptionInformation->GetAddressModuleOffset (),
                         pExceptionInformation->GetModulePathName (),
                         pExceptionInformation->GetEAX (),
                         pExceptionInformation->GetEBX (),
                         pExceptionInformation->GetECX (),
                         pExceptionInformation->GetEDX (),
                         pExceptionInformation->GetESI (),
                         pExceptionInformation->GetEDI (),
                         pExceptionInformation->GetEBP (),
                         pExceptionInformation->GetESP (),
                         pExceptionInformation->GetEIP (),
                         pExceptionInformation->GetEFlags (),
                         pExceptionInformation->GetCS (),
                         pExceptionInformation->GetDS (),
                         pExceptionInformation->GetSS (),
                         pExceptionInformation->GetES (),
                         pExceptionInformation->GetFS (),
                         pExceptionInformation->GetGS ()
                        );

    AddReportLog ( 3120, strMessage );

    // Try relaunch with crashed flag
    SString strMTASAPath = GetMTASABaseDir ();
    SetCurrentDirectory ( strMTASAPath );
    SetDllDirectory( strMTASAPath );

#ifdef MTA_DEBUG
    #define MTA_EXE_NAME            "Multi Theft Auto_d.exe"
#else
    #define MTA_EXE_NAME            "Multi Theft Auto.exe"
#endif
    SString strFile = strMTASAPath + "\\" + MTA_EXE_NAME;
    ShellExecute( NULL, "open", strFile, "install_stage=crashed", NULL, SW_SHOWNORMAL );
}
开发者ID:Anubhav652,项目名称:mtasa-blue,代码行数:52,代码来源:CCrashDumpWriter.cpp


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