static int initWindowsDWM() { if( !HAS_INIT(_init) ) { _init |= INIT_CALLED_MASK; HANDLE hDwmAPI = LoadLibrary(TEXT("dwmapi.dll")); if (hDwmAPI) { _DwmEnableComposition = (DwmEnableCompositionPROCADDR) GetProcAddressA (hDwmAPI, "DwmEnableComposition"); _DwmIsCompositionEnabled = (DwmIsCompositionEnabledPROCADDR) GetProcAddressA (hDwmAPI, "DwmIsCompositionEnabled"); _DwmEnableBlurBehindWindow = (DwmEnableBlurBehindWindowPROCADDR) GetProcAddressA (hDwmAPI, "DwmEnableBlurBehindWindow"); _DwmExtendFrameIntoClientArea = (DwmExtendFrameIntoClientAreaPROCADDR) GetProcAddressA (hDwmAPI, "DwmExtendFrameIntoClientArea"); _DwmGetWindowAttribute = (DwmGetWindowAttributePROCADDR) GetProcAddressA (hDwmAPI, "DwmGetWindowAttribute"); _DwmSetWindowAttribute = (DwmSetWindowAttributePROCADDR) GetProcAddressA (hDwmAPI, "DwmSetWindowAttribute"); if(NULL != _DwmEnableComposition && NULL != _DwmIsCompositionEnabled && NULL != _DwmEnableBlurBehindWindow && NULL != _DwmExtendFrameIntoClientArea && NULL != _DwmGetWindowAttribute && NULL != _DwmSetWindowAttribute) { _init |= INIT_HAS_DWM_EXT_MASK; } } // FreeLibrary (hDwmAPI); HANDLE hUser32 = LoadLibrary(TEXT("user32.dll")); if (hUser32) { _GetWindowCompositionAttribute = (GetWindowCompositionAttributePROCADDR) GetProcAddressA (hUser32, "GetWindowCompositionAttribute"); _SetWindowCompositionAttribute = (SetWindowCompositionAttributePROCADDR) GetProcAddressA (hUser32, "SetWindowCompositionAttribute"); if( NULL != _GetWindowCompositionAttribute && NULL != _SetWindowCompositionAttribute ) { _init |= INIT_HAS_WINCOMP_EXT_MASK; } } // FreeLibrary (hUser32); DBG_PRINT("DWM - initWindowsDWM: hasDWM %d, hasWinComp %d\n", HAS_DWM_EXT(_init), HAS_WINCOMP_EXT(_init)); } return _init; }
FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, char* fnName, int ordinal) { if (!lateDllHandle[fnLib]) { lateDllHandle[fnLib] = LoadLibraryA(lateDllName[fnLib]); if (!lateDllHandle[fnLib]) return NULL; } #if defined(_WIN32_WCE) if (ordinal) return GetProcAddressA(lateDllHandle[fnLib], (const char *) (apr_ssize_t)ordinal); else return GetProcAddressA(lateDllHandle[fnLib], fnName); #else if (ordinal) return GetProcAddress(lateDllHandle[fnLib], (const char *) (apr_ssize_t)ordinal); else return GetProcAddress(lateDllHandle[fnLib], fnName); #endif }
static int xmlModulePlatformSymbol(void *handle, const char *name, void **symbol) { #ifdef _WIN32_WCE /* * GetProcAddressA seems only available on WinCE */ *symbol = GetProcAddressA(handle, name); #else *symbol = GetProcAddress(handle, name); #endif return (NULL == *symbol) ? -1 : 0; }
int ZipFunc::replace(const DZStrW &d, const DZStrW &s) { #ifndef UNICODE int r; HINSTANCE hKernal; MoveWithProgress mover; #endif if (Verbose) Notify(IVERBOSE, _T("replace '%s' with '%s'"), d.c_str(), s.c_str()); else CB->UserCB(zacTick); // take a little time if (d.IsEmpty() || s.IsEmpty()) { diag(_T("in replace - missing filename")); return DZ_ERM_TEMP_FAILED; } #ifdef UNICODE if (!MoveFileWithProgress(s.c_str(), d.c_str(), MoveProgress, this, MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING)) { int re = DZ_ERM_TEMP_FAILED; Notify((unsigned)re, _T(" replace: Move failed -[%s]"), SysMsg().c_str()); return re; } return DZ_ERR_GOOD; #else hKernal = LoadLibrary("kernel32.dll"); if (hKernal == NULL) return replaceOrig(d, s); mover = (MoveWithProgress) GetProcAddressA(hKernal, "MoveFileWithProgressA"); if (mover == NULL) { FreeLibrary(hKernal); return replaceOrig(d, s); } r = DZ_ERR_GOOD; CB->UserXItem(100, 2, _T("Copying Temporary File")); if (!((mover)(s, d, MoveProgress, this, MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING))) { r = DZ_ERM_TEMP_FAILED; Notify(DZ_ERM_TEMP_FAILED, _T(" replace: Move failed [%s]"), SysMsg()); } FreeLibrary(hKernal); return r; #endif }
static void * tncc_get_sym(void *handle, char *func) { void *fptr; #ifdef CONFIG_NATIVE_WINDOWS #ifdef _WIN32_WCE fptr = GetProcAddressA(handle, func); #else /* _WIN32_WCE */ fptr = GetProcAddress(handle, func); #endif /* _WIN32_WCE */ #else /* CONFIG_NATIVE_WINDOWS */ fptr = dlsym(handle, func); #endif /* CONFIG_NATIVE_WINDOWS */ return fptr; }
/* Java->C glue code: * Java package: com.jogamp.common.os.WindowsDynamicLinkerImpl * Java method: long GetProcAddressA(long hModule, java.lang.String lpProcName) * C function: PROC GetProcAddressA(HANDLE hModule, LPCSTR lpProcName); */ JNIEXPORT jlong JNICALL Java_com_jogamp_common_os_WindowsDynamicLinkerImpl_GetProcAddressA__JLjava_lang_String_2(JNIEnv *env, jclass _unused, jlong hModule, jstring lpProcName) { const char* _strchars_lpProcName = NULL; PROC _res; if (lpProcName != NULL) { _strchars_lpProcName = (*env)->GetStringUTFChars(env, lpProcName, (jboolean*)NULL); if (_strchars_lpProcName == NULL) { (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/OutOfMemoryError"), "Failed to get UTF-8 chars for argument \"lpProcName\" in native dispatcher for \"GetProcAddressA\""); return 0; } } _res = GetProcAddressA((HANDLE) (intptr_t) hModule, (LPCSTR) _strchars_lpProcName); if (lpProcName != NULL) { (*env)->ReleaseStringUTFChars(env, lpProcName, _strchars_lpProcName); } return (jlong) (intptr_t) _res; }
void * CVMdynlinkSym(void *dsoHandle, const void *name) { int i = 0; void *v = NULL; #ifdef WINCE v = GetProcAddressA((HANDLE)dsoHandle, name); #else v = GetProcAddress((HANDLE)dsoHandle, name); #endif /* Enable this if you want to know why a symbol lookup is failing. */ #if 0 if (v == NULL) { char buf[256]; int err = CVMioGetLastErrorString(buf, sizeof(buf)); fprintf(stderr, "CVMdynlinkSym(%s) failed. err=0x%x (%s)\n", name, err, err == 0 ? "???" : buf); } #endif return v; }