From 6109ada28a74f0f9a94a84b0fa1e413955c9274d Mon Sep 17 00:00:00 2001 From: "SND\\weimingzhi_cp" Date: Fri, 13 Aug 2010 05:03:24 +0000 Subject: don't use GetModuleHandle() git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@56052 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- win32/plugins/dfxvideo/winsrc/cfg.c | 20 +++++++++++++++----- win32/plugins/dfxvideo/winsrc/draw.c | 8 +++++--- win32/plugins/dfxvideo/winsrc/winmain.c | 6 +----- 3 files changed, 21 insertions(+), 13 deletions(-) (limited to 'win32/plugins') diff --git a/win32/plugins/dfxvideo/winsrc/cfg.c b/win32/plugins/dfxvideo/winsrc/cfg.c index 4cff66b5..b9d7b999 100644 --- a/win32/plugins/dfxvideo/winsrc/cfg.c +++ b/win32/plugins/dfxvideo/winsrc/cfg.c @@ -939,16 +939,19 @@ static BOOL WINAPI DirectDrawEnumCallbackEx( GUID FAR* pGUID, LPSTR strDesc, HRESULT (WINAPI *pDDrawCreateFn)(GUID *,LPDIRECTDRAW *,IUnknown *); HMODULE hDDrawDLL; - hDDrawDLL = GetModuleHandle("DDRAW.DLL"); + hDDrawDLL = LoadLibrary(TEXT("DDRAW.DLL")); if(NULL == hDDrawDLL) return FALSE; pDDrawCreateFn = (LPVOID)GetProcAddress( hDDrawDLL, "DirectDrawCreate" ); if( pDDrawCreateFn == NULL || FAILED( pDDrawCreateFn( pGUID, &pDD, 0L ) ) ) { + FreeLibrary(hDDrawDLL); return D3DENUMRET_OK; } + FreeLibrary(hDDrawDLL); + // Query the DirectDraw driver for access to Direct3D. if( FAILED(IDirectDraw_QueryInterface(pDD, &IID_IDirectDraw4, (VOID**)&g_pDD))) { @@ -999,7 +1002,7 @@ void DoDevEnum(HWND hW) { LPDIRECTDRAWENUMERATEEX pDDrawEnumFn; - HMODULE hDDrawDLL = GetModuleHandle("DDRAW.DLL"); + HMODULE hDDrawDLL = LoadLibrary(TEXT("DDRAW.DLL")); if(NULL == hDDrawDLL) return; gHWND=hW; @@ -1007,11 +1010,13 @@ void DoDevEnum(HWND hW) pDDrawEnumFn = (LPDIRECTDRAWENUMERATEEX) GetProcAddress( hDDrawDLL, "DirectDrawEnumerateExA" ); - if(pDDrawEnumFn) + if (pDDrawEnumFn != NULL) pDDrawEnumFn( DirectDrawEnumCallbackEx, NULL, DDENUM_ATTACHEDSECONDARYDEVICES | DDENUM_DETACHEDSECONDARYDEVICES | DDENUM_NONDISPLAYDEVICES ); + + FreeLibrary(hDDrawDLL); } //////////////////////////////////////////////////////////////////////// @@ -1152,13 +1157,18 @@ BOOL bTestModes(void) bDeviceOK=FALSE; - hDDrawDLL = GetModuleHandle("DDRAW.DLL"); + hDDrawDLL = LoadLibrary(TEXT("DDRAW.DLL")); if(NULL == hDDrawDLL) return FALSE; pDDrawCreateFn = (LPVOID)GetProcAddress( hDDrawDLL, "DirectDrawCreate" ); if( pDDrawCreateFn == NULL || FAILED( pDDrawCreateFn(guid, &pDD, 0L ) ) ) - return FALSE; + { + FreeLibrary(hDDrawDLL); + return FALSE; + } + + FreeLibrary(hDDrawDLL); if(FAILED(IDirectDraw_QueryInterface(pDD, &IID_IDirectDraw4, (VOID**)&g_pDD))) { diff --git a/win32/plugins/dfxvideo/winsrc/draw.c b/win32/plugins/dfxvideo/winsrc/draw.c index 81a71142..bfd7df7c 100644 --- a/win32/plugins/dfxvideo/winsrc/draw.c +++ b/win32/plugins/dfxvideo/winsrc/draw.c @@ -3669,7 +3669,7 @@ int DXinitialize() for(i=0;i