您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetModuleHandleEx函数代码示例

51自学网 2021-06-01 21:11:12
  C++
这篇教程C++ GetModuleHandleEx函数代码示例写得很实用,希望能帮到您。

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

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

示例1: OpenProcess

int CSDShellExt::GetExtensionDirectory(wchar_t *path) {    HMODULE moduleHandle = NULL;    HANDLE processHandle =  NULL;    processHandle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, false, GetCurrentProcessId());    if(processHandle == NULL) {        //        // failed to get process handle        //        return 0;    }    if(GetModuleHandleEx(0, L"SDShellNative.dll", &moduleHandle) == 0) {        if(GetModuleHandleEx(0, L"SDShellNative32.dll", &moduleHandle) == 0) {            //            // try get for 64 bit version instead            //            if(GetModuleHandleEx(0, L"SDShellNative64.dll", &moduleHandle) == 0) {                //                // failed                //                CloseHandle(processHandle);                return 0;            }        }    }    //    // get the file path    //    if(GetModuleFileNameEx(processHandle, moduleHandle, path, MAX_PATH) == 0) {        //        // failed        //        CloseHandle(processHandle);        return 0;    }    //    // extract directory    //    int length = wcslen(path);    for(int i = length - 1;i > 0;i--) {        if(path[i] == '//') {            //            // end the string here            //            path[i + 1] = 0;            break;        }    }    CloseHandle(processHandle);    return 1;}
开发者ID:datascicat,项目名称:SecureDelete,代码行数:57,


示例2: strcat

void ofxPS3::StartSettingsDialog(){   HWND        hwnd;   MSG         msg;   WNDCLASS    wndclass;   char        szAppName[64] = "PS3 Eye settings: ";   strcat(szAppName,GUIDToString(guid).c_str());   wndclass.style         = 0;   wndclass.lpfnWndProc   = ofxPS3::WndProc;   wndclass.cbClsExtra    = 0;   wndclass.cbWndExtra    = 0;   HMODULE hInstance;   GetModuleHandleEx(0,NULL,&hInstance);   wndclass.hInstance     = hInstance;   wndclass.hIcon         = LoadIconA(hInstance, szAppName);   wndclass.hCursor       = LoadCursor(NULL, IDC_ARROW);   wndclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);   //wndclass.lpszMenuName  = szAppName;   //wndclass.lpszClassName = szAppName;   RegisterClass(&wndclass);   InitCommonControls();    hwnd = CreateWindowA(szAppName,      szAppName,      DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE,	  0, 0, 465, cameraPixelMode ? 410 : 110,      NULL, NULL, hInstance, 0);   SetWindowLongPtr(hwnd,GWLP_USERDATA,(LONG_PTR)(this));   while (GetMessage(&msg, NULL, 0, 0))    {      TranslateMessage(&msg);      DispatchMessage(&msg);   }}
开发者ID:kitronyx,项目名称:ccvs,代码行数:35,


示例3: WAI_PREFIX

WAI_NOINLINEWAI_FUNCSPECint WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length){  HMODULE module;  int length = -1;#if defined(_MSC_VER)#pragma warning(push)#pragma warning(disable: 4054)#endif  if (GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCTSTR)  #if defined(_MSC_VER)  _ReturnAddress()  #else  __builtin_extract_return_addr(__builtin_return_address(0))  #endif  , &module))#if defined(_MSC_VER)#pragma warning(pop)#endif  {    length = WAI_PREFIX(getModulePath_)(module, out, capacity, dirname_length);  }  return length;}
开发者ID:RobertLeahy,项目名称:whereami,代码行数:27,


示例4: QueryRecycleBinThreadProc

DWORD WINAPI QueryRecycleBinThreadProc(void* pParam){	// NOTE: Do not use CRT functions (since thread was created with CreateThread())!	SHQUERYRBINFO rbi = {0};	rbi.cbSize = sizeof(SHQUERYRBINFO);	SHQueryRecycleBin(NULL, &rbi);	g_BinCount = (double)rbi.i64NumItems;	g_BinSize = (double)rbi.i64Size;	EnterCriticalSection(&g_CriticalSection);	HMODULE module = NULL;	if (g_FreeInstanceInThread)	{		DWORD flags = GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT;		GetModuleHandleEx(flags, (LPCWSTR)DllMain, &module);		g_FreeInstanceInThread = false;	}	g_Thread = false;	LeaveCriticalSection(&g_CriticalSection);	if (module)	{		// Decrement the ref count and possibly unload the module if this is		// the last instance.		FreeLibraryAndExitThread(module, 0);	}	return 0;}
开发者ID:JamesAC,项目名称:rainmeter,代码行数:31,


示例5: global_symbols_link

    static dynamic_link_handle global_symbols_link( const wchar_t* library, const dynamic_link_descriptor descriptors[], size_t required ) {        ::tbb::internal::suppress_unused_warning( library );        dynamic_link_handle library_handle;#if _WIN32        if ( GetModuleHandleEx( 0, library, &library_handle ) ) {            if ( resolve_symbols( library_handle, descriptors, required ) )                return library_handle;            else                FreeLibrary( library_handle );        }#else /* _WIN32 */    #if !__TBB_DYNAMIC_LOAD_ENABLED /* only __TBB_WEAK_SYMBOLS_PRESENT is defined */        if ( !dlopen ) return 0;    #endif /* !__TBB_DYNAMIC_LOAD_ENABLED */        library_handle = dlopen( NULL, RTLD_LAZY );    #if !__ANDROID__        // On Android dlopen( NULL ) returns NULL if it is called during dynamic module initialization.        LIBRARY_ASSERT( library_handle, "The handle for the main program is NULL" );    #endif        // Check existence of the first symbol only, then use it to find the library and load all necessary symbols.        pointer_to_handler handler;        dynamic_link_descriptor desc;        desc.name = descriptors[0].name;        desc.handler = &handler;        if ( resolve_symbols( library_handle, &desc, 1 ) )            return pin_symbols( library_handle, desc, descriptors, required );#endif /* _WIN32 */        return 0;    }
开发者ID:rpgfreak128,项目名称:LoLUpdater,代码行数:29,


示例6: loadPathHack

void loadPathHack (char buf[256], void *addr){  HMODULE h;  size_t sz;  DWORD k;  BOOL brc;  char libBuf[1024];  buf[0] = '/0';  brc = GetModuleHandleEx (GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |                           GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,                           (LPCTSTR)addr, &h);  if (brc) {  /* OK: got a handle */    k = GetModuleFileName (h, libBuf, sizeof(libBuf));    if (k > 0) {                /* success */      /* do some trimming later */      sz = strlen(libBuf);      if (sz <= 255) {        memcpy (buf, libBuf, sz);        buf[sz] = '/0';      }    }  }  return;} /* loadPathHack */
开发者ID:lolow,项目名称:gdxtools,代码行数:26,


示例7: Finalize

PLUGIN_EXPORT void Finalize(void* data){	Measure* measure = (Measure*)data;	std::unique_lock<std::recursive_mutex> lock(measure->mutex);	if (measure->threadActive)	{		// Increment ref count of this module so that it will not be		// unloaded prior to thread completion.		DWORD flags = GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS;		HMODULE module;		GetModuleHandleEx(flags, (LPCWSTR)DllMain, &module);		if (measure->hProc != INVALID_HANDLE_VALUE &&			!TerminateApp(measure->hProc, measure->dwPID, (measure->state == SW_HIDE)))		{			measure->value = 105.0f;			RmLogF(measure->rm, LOG_ERROR, err_Terminate, measure->program.c_str());	// Could not terminate process (very rare!)		}		// Tell the thread to perform any cleanup		measure->threadActive = false;		return;	}	lock.unlock();	delete measure;}
开发者ID:NighthawkSLO,项目名称:rainmeter,代码行数:29,


示例8: hookDXGI

/// @param hDXGI must be a valid module handle.void hookDXGI(HMODULE hDXGI, bool preonly) {	wchar_t modulename[MODULEFILEPATH_BUFLEN];	GetModuleFileNameW(NULL, modulename, ARRAY_NUM_ELEMENTS(modulename));	ods("DXGI: hookDXGI in App '%ls'", modulename);	// Add a ref to ourselves; we do NOT want to get unloaded directly from this process.	HMODULE hTempSelf = NULL;	GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, reinterpret_cast<LPCTSTR>(&hookDXGI), &hTempSelf);	bHooked = true;	// Can we use the prepatch data?	GetModuleFileNameW(hDXGI, modulename, ARRAY_NUM_ELEMENTS(modulename));	if (_wcsicmp(dxgi->wcFileName, modulename) == 0) {		// The module seems to match the one we prepared d3dd for.		unsigned char *raw = (unsigned char *) hDXGI;		HookPresentRaw((voidFunc)(raw + dxgi->offsetPresent));		HookResizeRaw((voidFunc)(raw + dxgi->offsetResize));	} else if (! preonly) {		ods("DXGI: Interface changed, can't rawpatch. Current: %ls ; Previously: %ls", modulename, dxgi->wcFileName);	} else {		bHooked = false;	}}
开发者ID:MumbleTransifexBot,项目名称:mumble,代码行数:27,


示例9: defined

bool Renderer::initializeCompiler(){#if defined(ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES)    // Find a D3DCompiler module that had already been loaded based on a predefined list of versions.    static TCHAR* d3dCompilerNames[] = ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES;    for (size_t i = 0; i < ArraySize(d3dCompilerNames); ++i)    {        if (GetModuleHandleEx(0, d3dCompilerNames[i], &mD3dCompilerModule))        {            break;        }    }#else    // Load the version of the D3DCompiler DLL associated with the Direct3D version ANGLE was built with.    mD3dCompilerModule = LoadLibrary(D3DCOMPILER_DLL);#endif  // ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES    if (!mD3dCompilerModule)    {        ERR("No D3D compiler module found - aborting!/n");        return false;    }    mD3DCompileFunc = reinterpret_cast<pCompileFunc>(GetProcAddress(mD3dCompilerModule, "D3DCompile"));    ASSERT(mD3DCompileFunc);    return mD3DCompileFunc != NULL;}
开发者ID:ConradIrwin,项目名称:gecko-dev,代码行数:29,


示例10: MyLoadLibraryA

static HMODULE WINAPIMyLoadLibraryA(LPCSTR lpLibFileName){    if (VERBOSITY >= 2) {        debugPrintf("%s(/"%s/")/n", __FUNCTION__, lpLibFileName);    }    if (VERBOSITY > 0) {        const char *szBaseName = getBaseName(lpLibFileName);        for (unsigned i = 0; i < numReplacements; ++i) {            if (stricmp(szBaseName, replacements[i].szMatchModule) == 0) {                debugPrintf("%s(/"%s/")/n", __FUNCTION__, lpLibFileName);#ifdef __GNUC__                void *caller = __builtin_return_address (0);                HMODULE hModule = 0;                BOOL bRet = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,                                              (LPCTSTR)caller,                                              &hModule);                assert(bRet);                char szCaller[256];                DWORD dwRet = GetModuleFileNameA(hModule, szCaller, sizeof szCaller);                assert(dwRet);                debugPrintf("  called from %s/n", szCaller);#endif                break;            }        }    }    return MyLoadLibrary(lpLibFileName);}
开发者ID:hadrien-psydk,项目名称:apitrace,代码行数:32,


示例11: GetFnOffsetInModule

int GetFnOffsetInModule(voidFunc fnptr, wchar_t *refmodulepath, unsigned int refmodulepathLen, const std::string &logPrefix, const std::string &fnName) {	HMODULE hModule = NULL;	if (! GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (char *) fnptr, &hModule)) {		ods((logPrefix + ": Failed to get module for " + fnName).c_str());		return -1;	}	const bool bInit = refmodulepath[0] == '/0';	if (bInit) {		GetModuleFileNameW(hModule, refmodulepath, refmodulepathLen);	} else {		wchar_t modulename[MODULEFILEPATH_BUFLEN];		GetModuleFileNameW(hModule, modulename, ARRAY_NUM_ELEMENTS(modulename));		if (_wcsicmp(modulename, refmodulepath) != 0) {			ods((logPrefix + ": " + fnName + " functions module path does not match previously found. Now: '%ls', Previously: '%ls'").c_str(), modulename, refmodulepath);			return -2;		}	}	unsigned char *fn = reinterpret_cast<unsigned char *>(fnptr);	unsigned char *base = reinterpret_cast<unsigned char *>(hModule);	unsigned long off = static_cast<unsigned long>(fn - base);	// XXX: convert this function to use something other than int.	// Issue mumble-voip/mumble#1924.	if (off > static_cast<unsigned long>(std::numeric_limits<int>::max())) {		ods("Internal overlay error: GetFnOffsetInModule() offset greater than return type can hold.");		return -1;	}	return static_cast<int>(off);}
开发者ID:CimpianAlin,项目名称:mumble,代码行数:34,


示例12: GetModuleHandleEx

ds::ds(){    HMODULE hModule = NULL;    BOOL bRc = GetModuleHandleEx(                   GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,                   ( LPCSTR)this, &hModule );    if ( bRc )    {        GetModuleFileName(hModule, g_szProjectName, MAX_PATH);        FreeLibrary(hModule);        DebugOut(            "/n*******************Memory Check %s!/n/n",            g_szProjectName );    }    else    {        OutputDebugString("/n*******************GetModuleHandleEx Failed!/n/n");    }    _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );    _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDERR );    /*    * Set the debug-heap flag to keep freed blocks in the    * heap's linked list - This will allow us to catch any    * inadvertent use of freed memory    */    //int tmpDbgFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);    //tmpDbgFlag |= _CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF;    //_CrtSetDbgFlag(tmpDbgFlag);}
开发者ID:fatrar,项目名称:yiqiulib,代码行数:32,


示例13: WinMain

int APIENTRY WinMain(HINSTANCE hInstance,                     HINSTANCE hPrevInstance,                     LPSTR     lpCmdLine,                     int       nCmdShow ){	char    cBuff[MAX_PATH];	DWORD   dwPID;	HANDLE  hProcs;	// get the calling exe path	GetModuleFileName(NULL, cBuff, sizeof(cBuff));	// get PID	dwPID = GetProcessPathID(cBuff);	if (!dwPID)	{		MessageBox(0, "Couldn't get PID :(", NULL, MB_ICONERROR);		return -1;	}	// get procs.dll base	hProcs = GetModuleHandleEx(dwPID, "procs.dll");	if (!hProcs)	{		MessageBox(0, "GetModuleHandleEx failed :(", NULL, MB_ICONERROR);		return -1;	}	// print result	wsprintf(cBuff, "My PID: 0x%08lX/nProcs.dll base: 0x%08lX", dwPID, hProcs);	MessageBox(0, cBuff, ":D", MB_ICONINFORMATION | MB_SYSTEMMODAL);	return 0;}
开发者ID:giantbranch,项目名称:MyLearningCode,代码行数:33,


示例14: addLibrary

	bool addLibrary(char* libraryName,void* addressContained)	{		HMODULE module;		if(GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,(LPCSTR)addressContained,&module))		{			HANDLE process =  GetCurrentProcess();			_MODULEINFO moduleInfo;			if(GetModuleInformation(process,module,&moduleInfo,sizeof moduleInfo))			{				CloseHandle(process);				LibraryInfo* libraryInfo = new LibraryInfo;				libraryInfo->baseAddress = (void*) moduleInfo.lpBaseOfDll;				libraryInfo->length = moduleInfo.SizeOfImage;				libraryInfo->handle = module;				LibraryNameToLibraryInfo->insert(libraryName,libraryInfo);				return true;			}		}		return false;	}
开发者ID:ShootingKing-AM,项目名称:OrpheuPack2.3,代码行数:27,


示例15: _zbar_processor_open

int _zbar_processor_open (zbar_processor_t *proc,                          char *title,                          unsigned width,                          unsigned height){    HMODULE hmod = NULL;    if(!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |                          GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,                          (void*)_zbar_processor_open, (HINSTANCE*)&hmod))        return(err_capture(proc, SEV_ERROR, ZBAR_ERR_WINAPI, __func__,                           "failed to obtain module handle"));    ATOM wca = win_register_class(hmod);    if(!wca)        return(err_capture(proc, SEV_ERROR, ZBAR_ERR_WINAPI, __func__,                           "failed to register window class"));    RECT r = { 0, 0, width, height };    AdjustWindowRectEx(&r, WIN_STYLE, 0, EXT_STYLE);    proc->display = CreateWindowEx(EXT_STYLE, (LPCTSTR)(long)wca,                                   "ZBar", WIN_STYLE,                                   CW_USEDEFAULT, CW_USEDEFAULT,                                   r.right - r.left, r.bottom - r.top,                                   NULL, NULL, hmod, proc);    if(!proc->display)        return(err_capture(proc, SEV_ERROR, ZBAR_ERR_WINAPI, __func__,                           "failed to open window"));    return(0);}
开发者ID:liumeng1201,项目名称:qrcode_scan,代码行数:30,


示例16: lcb_create_libuv_io_opts

LCBUV_APIlcb_error_t lcb_create_libuv_io_opts(int version,                                     lcb_io_opt_t *io,                                     lcbuv_options_t *options){    lcb_io_opt_t iop;    uv_loop_t *loop = NULL;    my_iops_t *ret;    if (version != 0) {        return LCB_PLUGIN_VERSION_MISMATCH;    }#ifdef _WIN32    {        /** UV unloading on Windows doesn't work well */        HMODULE module;        /* We need to provide a symbol */        static int dummy;        BOOL result;        result = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |                                   GET_MODULE_HANDLE_EX_FLAG_PIN,                                   (LPCSTR)&dummy,                                   &module);        if (!result) {            return LCB_EINTERNAL;        }    }#endif    ret = calloc(1, sizeof(*ret));    if (!ret) {        return LCB_CLIENT_ENOMEM;    }    iop = &ret->base;    iop->version = 2;    iop->destructor = iops_lcb_dtor;    iop->v.v2.get_procs = wire_iops2;    ret->iops_refcount = 1;    *io = iop;    if (options) {        if (options->v.v0.loop) {            ret->external_loop = 1;            loop = options->v.v0.loop;        }        ret->startstop_noop = options->v.v0.startsop_noop;    }    if (!loop) {        loop = uv_loop_new();    }    ret->loop = loop;    return LCB_SUCCESS;}
开发者ID:00christian00,项目名称:couchnode,代码行数:60,


示例17: TRACE_EVENT0

bool Renderer::initializeCompiler(){    TRACE_EVENT0("gpu", "initializeCompiler");#if defined(ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES)    // Find a D3DCompiler module that had already been loaded based on a predefined list of versions.    static TCHAR* d3dCompilerNames[] = ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES;    for (size_t i = 0; i < ArraySize(d3dCompilerNames); ++i)    {        if (GetModuleHandleEx(0, d3dCompilerNames[i], &mD3dCompilerModule))        {            break;        }    }#endif  // ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES    // Load the compiler DLL specified by the environment, or default to QT_D3DCOMPILER_DLL#if !defined(ANGLE_OS_WINRT)    const wchar_t *defaultCompiler = _wgetenv(L"QT_D3DCOMPILER_DLL");    if (!defaultCompiler)        defaultCompiler = QT_D3DCOMPILER_DLL;#else // !ANGLE_OS_WINRT#  ifdef _DEBUG    const wchar_t *defaultCompiler = L"d3dcompiler_qtd.dll";#  else    const wchar_t *defaultCompiler = L"d3dcompiler_qt.dll";#  endif#endif // ANGLE_OS_WINRT    const wchar_t *compilerDlls[] = {        defaultCompiler,        L"d3dcompiler_47.dll",        L"d3dcompiler_46.dll",        L"d3dcompiler_45.dll",        L"d3dcompiler_44.dll",        L"d3dcompiler_43.dll",        0    };    // Load the first available known compiler DLL    for (int i = 0; compilerDlls[i]; ++i)    {        // Load the version of the D3DCompiler DLL associated with the Direct3D version ANGLE was built with.        mD3dCompilerModule = LoadLibrary(compilerDlls[i]);        if (mD3dCompilerModule)            break;    }    if (!mD3dCompilerModule)    {        ERR("No D3D compiler module found - aborting!/n");        return false;    }    mD3DCompileFunc = reinterpret_cast<pCompileFunc>(GetProcAddress(mD3dCompilerModule, "D3DCompile"));    ASSERT(mD3DCompileFunc);    return mD3DCompileFunc != NULL;}
开发者ID:0x163mL,项目名称:phantomjs,代码行数:59,


示例18: GetModuleFromAddress

/* * GetModuleFromAddress *      Finds module handle from some address inside it */static HMODULE GetModuleFromAddress(LPVOID address){    HMODULE module;    if(GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS|GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,                         (char*)address, &module))        return module;    return nullptr;}
开发者ID:victor2566,项目名称:modloader,代码行数:12,


示例19: wutil_LibModuleHandle

HMODULE wutil_LibModuleHandle(){	HMODULE hModule;	const DWORD flags = GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS|GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT;	const BOOL ok = GetModuleHandleEx(flags, (LPCWSTR)&wutil_LibModuleHandle, &hModule);	// (avoid ENSURE etc. because we're called from debug_DisplayError)	wdbg_assert(ok);	return hModule;}
开发者ID:Gallaecio,项目名称:0ad,代码行数:9,


示例20: GetModuleFromAddress

static HMODULE GetModuleFromAddress(void * address){    DWORD flags = GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT |        GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS;    HMODULE module = 0;    GetModuleHandleEx(flags, (LPCWSTR)address, &module);    return module;}
开发者ID:91yuan,项目名称:bones,代码行数:9,


示例21: GetModuleHandleEx

 HINSTANCE console::_get_instance() {     HINSTANCE instance = NULL;     GetModuleHandleEx(         GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |         GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,         reinterpret_cast<LPCWSTR>(&_get_instance),         &instance);     return instance; }
开发者ID:d-b,项目名称:console-win,代码行数:9,


示例22: OPENSSL_atexit

int OPENSSL_atexit(void (*handler)(void)){    OPENSSL_INIT_STOP *newhand;#if !defined(OPENSSL_NO_DSO) && !defined(OPENSSL_USE_NODELETE)    {        union {            void *sym;            void (*func)(void);        } handlersym;        handlersym.func = handler;# ifdef DSO_WIN32        {            HMODULE handle = NULL;            BOOL ret;            /*             * We don't use the DSO route for WIN32 because there is a better             * way             */            ret = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS                                    | GET_MODULE_HANDLE_EX_FLAG_PIN,                                    handlersym.sym, &handle);            if (!ret)                return 0;        }# else        /*         * Deliberately leak a reference to the handler. This will force the         * library/code containing the handler to remain loaded until we run the         * atexit handler. If -znodelete has been used then this is         * unnecessary.         */        {            DSO *dso = NULL;            ERR_set_mark();            dso = DSO_dsobyaddr(handlersym.sym, DSO_FLAG_NO_UNLOAD_ON_FREE);            DSO_free(dso);            ERR_pop_to_mark();        }# endif    }#endif    newhand = OPENSSL_malloc(sizeof(*newhand));    if (newhand == NULL)        return 0;    newhand->handler = handler;    newhand->next = stop_handlers;    stop_handlers = newhand;    return 1;}
开发者ID:YueLinHo,项目名称:TortoiseSvn,代码行数:57,


示例23: dll_loader_unload_dsc

/*---------------------------------------------------------------------------*/void __stdcalldll_loader_unload_dsc(void *addr){  HMODULE handle;  GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | 		    GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, addr, &handle);  FreeLibrary(handle);}
开发者ID:13416795,项目名称:contiki,代码行数:10,


示例24: Assert

    unsigned int WINAPI BackgroundJobProcessor::StaticThreadProc(void *lpParam)    {        Assert(lpParam);#ifdef _M_X64_OR_ARM64#ifdef RECYCLER_WRITE_BARRIER        Memory::RecyclerWriteBarrierManager::OnThreadInit();#endif#endif#if !defined(_UCRT)        HMODULE dllHandle = NULL;        if (!GetModuleHandleEx(0, AutoSystemInfo::GetJscriptDllFileName(), &dllHandle))        {            dllHandle = NULL;        }#endif        ParallelThreadData * threadData = static_cast<ParallelThreadData *>(lpParam);        BackgroundJobProcessor *const processor = threadData->processor;        // Indicate to the constructor that the thread has fully started.        threadData->threadStartedOrClosing.Set();#if DBG        threadData->backgroundPageAllocator.SetConcurrentThreadId(GetCurrentThreadId());#endif#ifdef DISABLE_SEH        processor->Run(threadData);#else        __try        {            processor->Run(threadData);        }        __except(ExceptFilter(GetExceptionInformation()))        {            Assert(false);        }#endif        // Indicate to Close that the thread is about to exit. This has to be done before CoUninitialize because CoUninitialize        // may require the loader lock and if Close was called while holding the loader lock during DLL_THREAD_DETACH, it could        // end up waiting forever, causing a deadlock.        threadData->threadStartedOrClosing.Set();#if !defined(_UCRT)        if (dllHandle)        {            FreeLibraryAndExitThread(dllHandle, 0);        }        else#endif        {            return 0;        }    }
开发者ID:litian2025,项目名称:ChakraCore,代码行数:56,


示例25: m_bInit

CSpyHookBase::CSpyHookBase(): m_bInit(false), m_hHookHandle(NULL), m_hModuleHandle(NULL){    uint32_t eipForHandleFetch = 0;    BEATS_ASSI_GET_EIP(eipForHandleFetch);    m_bInit = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCTSTR) eipForHandleFetch, &m_hModuleHandle) == TRUE;    BEATS_ASSERT(m_bInit);}
开发者ID:beyondlwm,项目名称:Beats,代码行数:10,


示例26: NetworkThreadProc

DWORD WINAPI NetworkThreadProc(void* pParam){	// NOTE: Do not use CRT functions (since thread was created by CreateThread())!	MeasureData* measure = (MeasureData*)pParam;	const DWORD bufferSize = sizeof(ICMP_ECHO_REPLY) + 32;	BYTE buffer[bufferSize];	double value = 0.0;	HANDLE hIcmpFile = IcmpCreateFile();	if (hIcmpFile != INVALID_HANDLE_VALUE)	{		IcmpSendEcho(hIcmpFile, measure->destAddr, NULL, 0, NULL, buffer, bufferSize, measure->timeout);		IcmpCloseHandle(hIcmpFile);		ICMP_ECHO_REPLY* reply = (ICMP_ECHO_REPLY*)buffer;		value = (reply->Status != IP_SUCCESS) ? measure->timeoutValue : reply->RoundTripTime;		if (!measure->finishAction.empty())		{			RmExecute(measure->skin, measure->finishAction.c_str());		}	}	HMODULE module = NULL;	EnterCriticalSection(&g_CriticalSection);	if (measure->threadActive)	{		measure->value = value;		measure->threadActive = false;	}	else	{		// Thread is not attached to an existing measure any longer, so delete		// unreferenced data.		delete measure;		DWORD flags = GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT;		GetModuleHandleEx(flags, (LPCWSTR)DllMain, &module);	}	LeaveCriticalSection(&g_CriticalSection);	if (module)	{		// Decrement the ref count and possibly unload the module if this is		// the last instance.		FreeLibraryAndExitThread(module, 0);	}	return 0;}
开发者ID:AlfiyaZi,项目名称:rainmeter,代码行数:52,


示例27: GetModuleHandleEx

// GetCurrentModule////      Helper to get the module handle for the application.//HMODULE ResourceFontFileStream::GetCurrentModule(){    HMODULE handle = NULL;    // Determine the module handle from the address of this function.    GetModuleHandleEx(        GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,        reinterpret_cast<LPCTSTR>(&GetCurrentModule),        &handle        );    return handle;}
开发者ID:ebithril,项目名称:ModelViewer,代码行数:17,


示例28: menum

BOOL CALLBACK menum(PCTSTR ModuleName, DWORD64 ModuleBase, ULONG ModuleSize, PVOID UserContext){  dbg("Module: <%s>", ModuleName);    HMODULE mod = NULL;  GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS|GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCSTR)ModuleBase, &mod);  if(mod)    dumpImports(mod);  else    dbg("  Cannot find module?");    return TRUE;}
开发者ID:KimimaroTsukimiya,项目名称:SoftTH,代码行数:13,


示例29: PRINT_HOOKED_FUNCTION

// AddRef - Calls to IMalloc::AddRef end up here. This function is just a//   wrapper around the real IMalloc::AddRef implementation.////  Return Value:////    Returns the value returned by the system implementation of//    IMalloc::AddRef.//ULONG VisualLeakDetector::AddRef (){    PRINT_HOOKED_FUNCTION();    assert(m_iMalloc != NULL);    if (m_iMalloc) {        // Increment the library reference count to defer unloading the library,        // since this function increments the reference count of the IMalloc interface.        HMODULE module = NULL;        GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCTSTR)m_vldBase, &module);        return m_iMalloc->AddRef();    }    return 0;}
开发者ID:ioannis-e,项目名称:vld,代码行数:21,



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


C++ GetModuleHandleW函数代码示例
C++ GetModuleHandle函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。