From 6360917580dd9ac0b975591f1e46cc33496c6452 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Sat, 18 Aug 2001 16:09:19 +0000 Subject: [PATCH] Because of circular dependencies between comctl32 and msvfw32, replace in comctl32 delay loading of msvfw32 by manual loading. --- dlls/Makefile.in | 4 ++-- dlls/comctl32/animate.c | 37 ++++++++++++++++++++++++++++++------- dlls/comctl32/comctl32.spec | 1 - 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/dlls/Makefile.in b/dlls/Makefile.in index 78ce0c3b02..5eb87fd8a0 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in @@ -428,7 +428,7 @@ libx11drv.@LIBEXT@: x11drv/libx11drv.@LIBEXT@ advapi32/libadvapi32.@LIBEXT@: libkernel32.@LIBEXT@ libntdll.@LIBEXT@ avifil32/libavifil32.@LIBEXT@: libmsvfw32.@LIBEXT@ libole32.@LIBEXT@ libkernel32.@LIBEXT@ libntdll.@LIBEXT@ -comctl32/libcomctl32.@LIBEXT@: libmsvfw32.@LIBEXT@ libwinmm.@LIBEXT@ libuser32.@LIBEXT@ libgdi32.@LIBEXT@ libadvapi32.@LIBEXT@ libkernel32.@LIBEXT@ libntdll.@LIBEXT@ +comctl32/libcomctl32.@LIBEXT@: libwinmm.@LIBEXT@ libuser32.@LIBEXT@ libgdi32.@LIBEXT@ libadvapi32.@LIBEXT@ libkernel32.@LIBEXT@ libntdll.@LIBEXT@ commdlg/libcomdlg32.@LIBEXT@: libshell32.@LIBEXT@ libshlwapi.@LIBEXT@ libcomctl32.@LIBEXT@ libwinspool.drv.@LIBEXT@ libuser32.@LIBEXT@ libgdi32.@LIBEXT@ libkernel32.@LIBEXT@ libntdll.@LIBEXT@ crtdll/libcrtdll.@LIBEXT@: libmsvcrt.@LIBEXT@ libkernel32.@LIBEXT@ libntdll.@LIBEXT@ dciman32/libdciman32.@LIBEXT@: libkernel32.@LIBEXT@ libntdll.@LIBEXT@ @@ -457,7 +457,7 @@ olepro32/libolepro32.@LIBEXT@: liboleaut32.@LIBEXT@ libntdll.@LIBEXT@ olesvr/libolesvr32.@LIBEXT@: libkernel32.@LIBEXT@ libntdll.@LIBEXT@ opengl32/libopengl32.@LIBEXT@: libuser32.@LIBEXT@ libx11drv.@LIBEXT@ libkernel32.@LIBEXT@ libntdll.@LIBEXT@ psapi/libpsapi.@LIBEXT@: libkernel32.@LIBEXT@ libntdll.@LIBEXT@ -quartz/libquartz.@LIBEXT@: libole2.@LIBEXT@ libntdll.@LIBEXT@ +quartz/libquartz.@LIBEXT@: libole2.@LIBEXT@ libkernel32.@LIBEXT@ libntdll.@LIBEXT@ rasapi32/librasapi32.@LIBEXT@: libkernel32.@LIBEXT@ libntdll.@LIBEXT@ richedit/libriched32.@LIBEXT@: libuser32.@LIBEXT@ libkernel32.@LIBEXT@ libntdll.@LIBEXT@ rpcrt4/librpcrt4.@LIBEXT@: libkernel32.@LIBEXT@ libntdll.@LIBEXT@ diff --git a/dlls/comctl32/animate.c b/dlls/comctl32/animate.c index d8701a79f7..3dc0702cd7 100644 --- a/dlls/comctl32/animate.c +++ b/dlls/comctl32/animate.c @@ -23,6 +23,14 @@ DEFAULT_DEBUG_CHANNEL(animate); +static struct { + HMODULE hModule; + HIC WINAPI (*fnICOpen)(DWORD, DWORD, UINT); + LRESULT WINAPI (*fnICClose)(HIC); + LRESULT WINAPI (*fnICSendMessage)(HIC, UINT, DWORD, DWORD); + DWORD WINAPIV (*fnICDecompress)(HIC,DWORD,LPBITMAPINFOHEADER,LPVOID,LPBITMAPINFOHEADER,LPVOID); +} fnIC; + typedef struct { /* reference to input stream (file or resource) */ @@ -146,7 +154,7 @@ static void ANIMATE_Free(ANIMATE_INFO *infoPtr) infoPtr->lpIndex = NULL; } if (infoPtr->hic) { - ICClose(infoPtr->hic); + fnIC.fnICClose(infoPtr->hic); infoPtr->hic = 0; } if (infoPtr->inbih) { @@ -320,7 +328,7 @@ static LRESULT ANIMATE_DrawFrame(ANIMATE_INFO* infoPtr) mmioRead(infoPtr->hMMio, infoPtr->indata, infoPtr->ash.dwSuggestedBufferSize); if (infoPtr->hic && - ICDecompress(infoPtr->hic, 0, infoPtr->inbih, infoPtr->indata, + fnIC.fnICDecompress(infoPtr->hic, 0, infoPtr->inbih, infoPtr->indata, infoPtr->outbih, infoPtr->outdata) != ICERR_OK) { LeaveCriticalSection(&infoPtr->cs); WARN("Decompression error\n"); @@ -615,13 +623,13 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr) } /* try to get a decompressor for that type */ - infoPtr->hic = ICOpen(ICTYPE_VIDEO, infoPtr->ash.fccHandler, ICMODE_DECOMPRESS); + infoPtr->hic = fnIC.fnICOpen(ICTYPE_VIDEO, infoPtr->ash.fccHandler, ICMODE_DECOMPRESS); if (!infoPtr->hic) { WARN("Can't load codec for the file\n"); return FALSE; } - outSize = ICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT, + outSize = fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT, (DWORD)infoPtr->inbih, 0L); infoPtr->outbih = HeapAlloc(GetProcessHeap(), 0, outSize); @@ -630,7 +638,7 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr) return FALSE; } - if (ICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT, + if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT, (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) { WARN("Can't get output BIH\n"); return FALSE; @@ -642,7 +650,7 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr) return FALSE; } - if (ICSendMessage(infoPtr->hic, ICM_DECOMPRESS_BEGIN, + if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_BEGIN, (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) { WARN("Can't begin decompression\n"); return FALSE; @@ -730,6 +738,22 @@ static LRESULT ANIMATE_Create(HWND hWnd, WPARAM wParam, LPARAM lParam) { ANIMATE_INFO* infoPtr; + if (!fnIC.hModule) /* FIXME: not thread safe */ + { + /* since there's a circular dep between msvfw32 and comctl32, we could either: + * - fix the build chain to allow this circular dep + * - handle it by hand + * AJ wants the latter :-( + */ + fnIC.hModule = LoadLibraryA("msvfw32.dll"); + if (!fnIC.hModule) return FALSE; + + fnIC.fnICOpen = (void*)GetProcAddress(fnIC.hModule, "ICOpen"); + fnIC.fnICClose = (void*)GetProcAddress(fnIC.hModule, "ICClose"); + fnIC.fnICSendMessage = (void*)GetProcAddress(fnIC.hModule, "ICSendMessage"); + fnIC.fnICDecompress = (void*)GetProcAddress(fnIC.hModule, "ICDecompress"); + } + /* allocate memory for info structure */ infoPtr = (ANIMATE_INFO *)COMCTL32_Alloc(sizeof(ANIMATE_INFO)); if (!infoPtr) { @@ -885,7 +909,6 @@ static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP return 0; } - void ANIMATE_Register(void) { WNDCLASSA wndClass; diff --git a/dlls/comctl32/comctl32.spec b/dlls/comctl32/comctl32.spec index 2e4c2b548d..794c41eacf 100644 --- a/dlls/comctl32/comctl32.spec +++ b/dlls/comctl32/comctl32.spec @@ -3,7 +3,6 @@ type win32 init COMCTL32_LibMain rsrc rsrc.res -import -delay msvfw32.dll import -delay winmm.dll import user32.dll import gdi32.dll -- 2.32.0.93.g670b81a890