From 0eb321bf2c1cc0e048faff26a01f86cdd3ec254f Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Tue, 7 Jul 2009 02:26:13 +0300 Subject: Remove trailing whitespace from most files --- loader/afl.c | 158 +++++++++++++++++----------------- loader/com.h | 2 +- loader/dmo/DMO_AudioDecoder.c | 18 ++-- loader/dmo/DMO_VideoDecoder.c | 35 ++++---- loader/dshow/DS_AudioDecoder.c | 16 ++-- loader/dshow/DS_Filter.c | 8 +- loader/dshow/DS_VideoDecoder.c | 62 +++++++------- loader/dshow/allocator.c | 2 +- loader/dshow/cmediasample.c | 14 +-- loader/dshow/inputpin.c | 22 ++--- loader/dshow/libwin32.h | 6 +- loader/dshow/mediatype.c | 6 +- loader/dshow/mediatype.h | 6 +- loader/dshow/outputpin.c | 18 ++-- loader/elfdll.c | 6 +- loader/ext.c | 2 +- loader/ldt_keeper.c | 2 +- loader/module.c | 34 ++++---- loader/pe_image.c | 178 +++++++++++++++++++------------------- loader/pe_resource.c | 16 ++-- loader/qtx/list.c | 4 +- loader/qtx/qtxload.c | 6 +- loader/qtx/qtxsdk/components.h | 4 +- loader/resource.c | 44 +++++----- loader/vfl.c | 23 +++-- loader/win32.c | 76 ++++++++--------- loader/wine/avifmt.h | 34 ++++---- loader/wine/driver.h | 2 +- loader/wine/ldt.h | 2 +- loader/wine/mmreg.h | 2 +- loader/wine/module.h | 4 +- loader/wine/msacm.h | 40 ++++----- loader/wine/msacmdrv.h | 2 +- loader/wine/ntdef.h | 4 +- loader/wine/vfw.h | 14 +-- loader/wine/winbase.h | 20 ++--- loader/wine/windef.h | 20 ++--- loader/wine/winnt.h | 188 ++++++++++++++++++++--------------------- loader/wine/winreg.h | 2 +- loader/wine/winuser.h | 74 ++++++++-------- loader/wrapper.S | 31 ++++--- loader/wrapper.h | 1 - 42 files changed, 600 insertions(+), 608 deletions(-) (limited to 'loader') diff --git a/loader/afl.c b/loader/afl.c index 36b666bb0a..e9f52e157e 100644 --- a/loader/afl.c +++ b/loader/afl.c @@ -5,7 +5,7 @@ Its content will be based mainly on wine/dlls/msacm32 actually, for audio decompression only the following functions are needed: - + acmStreamOpen ( takes formats of src and dest, returns stream handle ) acmStreamPrepareHeader ( takes stream handler and info on data ) acmStreamConvert ( the same as PrepareHeader ) @@ -13,13 +13,13 @@ acmStreamClose acmStreamSize maybe acmStreamReset - - In future I'll also add functions for format enumeration, + + In future I'll also add functions for format enumeration, but not right now. Modified for use with MPlayer, detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ - + ***************************************************************************/ #include "config.h" #include "debug.h" @@ -59,26 +59,26 @@ MMRESULT WINAPI acmDriverAddA(PHACMDRIVERID phadid, HINSTANCE hinstModule, { if (!phadid) return MMSYSERR_INVALPARAM; - + /* Check if any unknown flags */ - if (fdwAdd & + if (fdwAdd & ~(ACM_DRIVERADDF_FUNCTION|ACM_DRIVERADDF_NOTIFYHWND| ACM_DRIVERADDF_GLOBAL)) return MMSYSERR_INVALFLAG; - + /* Check if any incompatible flags */ - if ((fdwAdd & ACM_DRIVERADDF_FUNCTION) && + if ((fdwAdd & ACM_DRIVERADDF_FUNCTION) && (fdwAdd & ACM_DRIVERADDF_NOTIFYHWND)) return MMSYSERR_INVALFLAG; - - /* FIXME: in fact, should GetModuleFileName(hinstModule) and do a + + /* FIXME: in fact, should GetModuleFileName(hinstModule) and do a * LoadDriver on it, to be sure we can call SendDriverMessage on the * hDrvr handle. */ *phadid = (HACMDRIVERID) MSACM_RegisterDriver(NULL, 0, hinstModule); - + /* FIXME: lParam, dwPriority and fdwAdd ignored */ - + return MMSYSERR_NOERROR; } @@ -89,10 +89,10 @@ MMRESULT WINAPI acmDriverClose(HACMDRIVER had, DWORD fdwClose) { PWINE_ACMDRIVER p; PWINE_ACMDRIVER* tp; - + if (fdwClose) return MMSYSERR_INVALFLAG; - + p = MSACM_GetDriver(had); if (!p) return MMSYSERR_INVALHANDLE; @@ -103,12 +103,12 @@ MMRESULT WINAPI acmDriverClose(HACMDRIVER had, DWORD fdwClose) break; } } - + if (p->hDrvr && !p->obj.pACMDriverID->pACMDriverList) CloseDriver(p->hDrvr); - + HeapFree(MSACM_hHeap, 0, p); - + return MMSYSERR_NOERROR; } @@ -123,11 +123,11 @@ MMRESULT WINAPI acmDriverEnum(ACMDRIVERENUMCB fnCallback, DWORD dwInstance, DWOR if (!fnCallback) { return MMSYSERR_INVALPARAM; } - + if (fdwEnum && ~(ACM_DRIVERENUMF_NOLOCAL|ACM_DRIVERENUMF_DISABLED)) { return MMSYSERR_INVALFLAG; } - + for (p = MSACM_pFirstACMDriverID; p; p = p->pNextACMDriverID) { fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC; if (!p->bEnabled) { @@ -138,7 +138,7 @@ MMRESULT WINAPI acmDriverEnum(ACMDRIVERENUMCB fnCallback, DWORD dwInstance, DWOR } (*fnCallback)((HACMDRIVERID) p, dwInstance, fdwSupport); } - + return MMSYSERR_NOERROR; } @@ -148,19 +148,19 @@ MMRESULT WINAPI acmDriverEnum(ACMDRIVERENUMCB fnCallback, DWORD dwInstance, DWOR MMRESULT WINAPI acmDriverID(HACMOBJ hao, PHACMDRIVERID phadid, DWORD fdwDriverID) { PWINE_ACMOBJ pao; - + pao = MSACM_GetObj(hao); if (!pao) return MMSYSERR_INVALHANDLE; - + if (!phadid) return MMSYSERR_INVALPARAM; - + if (fdwDriverID) return MMSYSERR_INVALFLAG; - + *phadid = (HACMDRIVERID) pao->pACMDriverID; - + return MMSYSERR_NOERROR; } @@ -174,12 +174,12 @@ LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARA PWINE_ACMDRIVER pad = MSACM_GetDriver(had); if (!pad) return MMSYSERR_INVALPARAM; - + /* FIXME: Check if uMsg legal */ - + if (!SendDriverMessage(pad->hDrvr, uMsg, lParam1, lParam2)) return MMSYSERR_NOTSUPPORTED; - + return MMSYSERR_NOERROR; } @@ -198,14 +198,14 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe if (!phad) return MMSYSERR_INVALPARAM; - - padid = MSACM_GetDriverID(hadid); + + padid = MSACM_GetDriverID(hadid); if (!padid) return MMSYSERR_INVALHANDLE; - + if (fdwOpen) return MMSYSERR_INVALFLAG; - + pad = (PWINE_ACMDRIVER) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVER)); if (!pad) return MMSYSERR_NOMEM; @@ -221,7 +221,7 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe pad->hDrvr = OpenDriverA((long)&icopen); else pad->hDrvr = padid->hInstModule; - + if (!pad->hDrvr) { HeapFree(MSACM_hHeap, 0, pad); return MMSYSERR_ERROR; @@ -245,16 +245,16 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe MMRESULT WINAPI acmDriverRemove(HACMDRIVERID hadid, DWORD fdwRemove) { PWINE_ACMDRIVERID padid; - + padid = MSACM_GetDriverID(hadid); if (!padid) return MMSYSERR_INVALHANDLE; - + if (fdwRemove) return MMSYSERR_INVALFLAG; - + MSACM_UnregisterDriver(padid); - + return MMSYSERR_NOERROR; } @@ -267,7 +267,7 @@ PWINE_ACMDRIVERID MSACM_pFirstACMDriverID = NULL; PWINE_ACMDRIVERID MSACM_pLastACMDriverID = NULL; /*********************************************************************** - * MSACM_RegisterDriver32() + * MSACM_RegisterDriver32() */ PWINE_ACMDRIVERID MSACM_RegisterDriver(const char* pszFileName, WORD wFormatTag, @@ -295,7 +295,7 @@ PWINE_ACMDRIVERID MSACM_RegisterDriver(const char* pszFileName, MSACM_pLastACMDriverID = padid; if (!MSACM_pFirstACMDriverID) MSACM_pFirstACMDriverID = padid; - + return padid; } @@ -306,13 +306,13 @@ PWINE_ACMDRIVERID MSACM_RegisterDriver(const char* pszFileName, PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p) { PWINE_ACMDRIVERID pNextACMDriverID; - + while (p->pACMDriverList) acmDriverClose((HACMDRIVER) p->pACMDriverList, 0); - + if (p->pszFileName) free(p->pszFileName); - + if (p == MSACM_pFirstACMDriverID) MSACM_pFirstACMDriverID = p->pNextACMDriverID; if (p == MSACM_pLastACMDriverID) @@ -322,11 +322,11 @@ PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p) p->pPrevACMDriverID->pNextACMDriverID = p->pNextACMDriverID; if (p->pNextACMDriverID) p->pNextACMDriverID->pPrevACMDriverID = p->pPrevACMDriverID; - + pNextACMDriverID = p->pNextACMDriverID; - + HeapFree(MSACM_hHeap, 0, p); - + return pNextACMDriverID; } @@ -343,7 +343,7 @@ void MSACM_UnregisterAllDrivers(void) } /*********************************************************************** - * MSACM_GetDriverID32() + * MSACM_GetDriverID32() */ PWINE_ACMDRIVERID MSACM_GetDriverID(HACMDRIVERID hDriverID) { @@ -380,16 +380,16 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw MMRESULT ret; int wfxSrcSize; int wfxDstSize; - + TRACE("(%p, 0x%08x, %p, %p, %p, %ld, %ld, %ld)\n", phas, had, pwfxSrc, pwfxDst, pwfltr, dwCallback, dwInstance, fdwOpen); - TRACE("src [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%lu, nAvgBytesPerSec=%lu, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n", - pwfxSrc->wFormatTag, pwfxSrc->nChannels, pwfxSrc->nSamplesPerSec, pwfxSrc->nAvgBytesPerSec, + TRACE("src [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%lu, nAvgBytesPerSec=%lu, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n", + pwfxSrc->wFormatTag, pwfxSrc->nChannels, pwfxSrc->nSamplesPerSec, pwfxSrc->nAvgBytesPerSec, pwfxSrc->nBlockAlign, pwfxSrc->wBitsPerSample, pwfxSrc->cbSize); - TRACE("dst [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%lu, nAvgBytesPerSec=%lu, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n", - pwfxDst->wFormatTag, pwfxDst->nChannels, pwfxDst->nSamplesPerSec, pwfxDst->nAvgBytesPerSec, + TRACE("dst [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%lu, nAvgBytesPerSec=%lu, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n", + pwfxDst->wFormatTag, pwfxDst->nChannels, pwfxDst->nSamplesPerSec, pwfxDst->nAvgBytesPerSec, pwfxDst->nBlockAlign, pwfxDst->wBitsPerSample, pwfxDst->cbSize); #define SIZEOF_WFX(wfx) (sizeof(WAVEFORMATEX) + ((wfx->wFormatTag == WAVE_FORMAT_PCM) ? 0 : wfx->cbSize)) @@ -414,19 +414,19 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw } else { was->drvInst.pwfltr = NULL; } - was->drvInst.dwCallback = dwCallback; + was->drvInst.dwCallback = dwCallback; was->drvInst.dwInstance = dwInstance; was->drvInst.fdwOpen = fdwOpen; - was->drvInst.fdwDriver = 0L; - was->drvInst.dwDriver = 0L; + was->drvInst.fdwDriver = 0L; + was->drvInst.dwDriver = 0L; was->drvInst.has = (HACMSTREAM)was; - + if (had) { if (!(wad = MSACM_GetDriver(had))) { ret = MMSYSERR_INVALPARAM; goto errCleanUp; } - + was->obj.pACMDriverID = wad->obj.pACMDriverID; was->pDrv = wad; was->hAcmDriver = 0; /* not to close it in acmStreamClose */ @@ -446,13 +446,13 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw else goto errCleanUp; - ret=acmDriverOpen2(drv_tag); + ret=acmDriverOpen2(drv_tag); if (ret == MMSYSERR_NOERROR) { if ((wad = MSACM_GetDriver(had)) != 0) { was->obj.pACMDriverID = wad->obj.pACMDriverID; was->pDrv = wad; was->hAcmDriver = had; - + ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L); if (ret == MMSYSERR_NOERROR) { if (fdwOpen & ACM_STREAMOPENF_QUERY) { @@ -464,7 +464,7 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw acmDriverClose(had, 0L);*/ //if(MSACM_pFirstACMDriverID==NULL) // MSACM_RegisterAllDrivers(); - + for (wadi = MSACM_pFirstACMDriverID; wadi; wadi = wadi->pNextACMDriverID) { /* Check Format */ @@ -476,7 +476,7 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw was->obj.pACMDriverID = wad->obj.pACMDriverID; was->pDrv = wad; was->hAcmDriver = had; - + ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L); //lhacm - crash printf("RETOPEN %d\n", ret); //ret = 0; @@ -487,7 +487,7 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw break; } } - // no match, close this acm driver and try next one + // no match, close this acm driver and try next one acmDriverClose(had, 0L); } } @@ -506,7 +506,7 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw #endif return ret; } -errCleanUp: +errCleanUp: if (phas) *phas = (HACMSTREAM)0; HeapFree(MSACM_hHeap, 0, was); @@ -519,16 +519,16 @@ MMRESULT WINAPI acmStreamClose(HACMSTREAM has, DWORD fdwClose) { PWINE_ACMSTREAM was; MMRESULT ret; - + TRACE("(0x%08x, %ld)\n", has, fdwClose); - + if ((was = ACM_GetStream(has)) == NULL) { return MMSYSERR_INVALHANDLE; } ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_CLOSE, (DWORD)&was->drvInst, 0); if (ret == MMSYSERR_NOERROR) { if (was->hAcmDriver) - acmDriverClose(was->hAcmDriver, 0L); + acmDriverClose(was->hAcmDriver, 0L); HeapFree(MSACM_hHeap, 0, was); #ifdef WIN32_LOADER CodecRelease(); @@ -541,7 +541,7 @@ MMRESULT WINAPI acmStreamClose(HACMSTREAM has, DWORD fdwClose) /*********************************************************************** * acmStreamConvert (MSACM32.38) */ -MMRESULT WINAPI acmStreamConvert(HACMSTREAM has, PACMSTREAMHEADER pash, +MMRESULT WINAPI acmStreamConvert(HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwConvert) { PWINE_ACMSTREAM was; @@ -570,7 +570,7 @@ MMRESULT WINAPI acmStreamConvert(HACMSTREAM has, PACMSTREAMHEADER pash, padsh->pbPreparedDst != padsh->pbDst || padsh->cbPreparedDstLength < padsh->cbDstLength) { return MMSYSERR_INVALPARAM; - } + } padsh->fdwConvert = fdwConvert; @@ -586,7 +586,7 @@ MMRESULT WINAPI acmStreamConvert(HACMSTREAM has, PACMSTREAMHEADER pash, /*********************************************************************** * acmStreamPrepareHeader (MSACM32.41) */ -MMRESULT WINAPI acmStreamPrepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, +MMRESULT WINAPI acmStreamPrepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwPrepare) { PWINE_ACMSTREAM was; @@ -594,7 +594,7 @@ MMRESULT WINAPI acmStreamPrepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, PACMDRVSTREAMHEADER padsh; TRACE("(0x%08x, %p, %ld)\n", has, pash, fdwPrepare); - + if ((was = ACM_GetStream(has)) == NULL) return MMSYSERR_INVALHANDLE; if (!pash || pash->cbStruct < sizeof(ACMSTREAMHEADER)) @@ -669,15 +669,15 @@ MMRESULT WINAPI acmStreamReset(HACMSTREAM has, DWORD fdwReset) /*********************************************************************** * acmStreamSize (MSACM32.43) */ -MMRESULT WINAPI acmStreamSize(HACMSTREAM has, DWORD cbInput, +MMRESULT WINAPI acmStreamSize(HACMSTREAM has, DWORD cbInput, LPDWORD pdwOutputBytes, DWORD fdwSize) { PWINE_ACMSTREAM was; ACMDRVSTREAMSIZE adss; MMRESULT ret; - + TRACE("(0x%08x, %ld, %p, %ld)\n", has, cbInput, pdwOutputBytes, fdwSize); - + if ((was = ACM_GetStream(has)) == NULL) { return MMSYSERR_INVALHANDLE; } @@ -686,7 +686,7 @@ MMRESULT WINAPI acmStreamSize(HACMSTREAM has, DWORD cbInput, } *pdwOutputBytes = 0L; - + switch (fdwSize & ACM_STREAMSIZEF_QUERYMASK) { case ACM_STREAMSIZEF_DESTINATION: adss.cbDstLength = cbInput; @@ -696,13 +696,13 @@ MMRESULT WINAPI acmStreamSize(HACMSTREAM has, DWORD cbInput, adss.cbSrcLength = cbInput; adss.cbDstLength = 0; break; - default: + default: return MMSYSERR_INVALFLAG; } - + adss.cbStruct = sizeof(adss); adss.fdwSize = fdwSize; - ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_SIZE, + ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_SIZE, (DWORD)&was->drvInst, (DWORD)&adss); if (ret == MMSYSERR_NOERROR) { switch (fdwSize & ACM_STREAMSIZEF_QUERYMASK) { @@ -721,7 +721,7 @@ MMRESULT WINAPI acmStreamSize(HACMSTREAM has, DWORD cbInput, /*********************************************************************** * acmStreamUnprepareHeader (MSACM32.44) */ -MMRESULT WINAPI acmStreamUnprepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, +MMRESULT WINAPI acmStreamUnprepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwUnprepare) { PWINE_ACMSTREAM was; @@ -729,7 +729,7 @@ MMRESULT WINAPI acmStreamUnprepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, PACMDRVSTREAMHEADER padsh; TRACE("(0x%08x, %p, %ld)\n", has, pash, fdwUnprepare); - + if ((was = ACM_GetStream(has)) == NULL) return MMSYSERR_INVALHANDLE; if (!pash || pash->cbStruct < sizeof(ACMSTREAMHEADER)) @@ -750,7 +750,7 @@ MMRESULT WINAPI acmStreamUnprepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, padsh->pbPreparedDst != padsh->pbDst || padsh->cbPreparedDstLength < padsh->cbDstLength) { return MMSYSERR_INVALPARAM; - } + } padsh->fdwConvert = fdwUnprepare; diff --git a/loader/com.h b/loader/com.h index 27f6a916b7..6bbbc55b7d 100644 --- a/loader/com.h +++ b/loader/com.h @@ -71,7 +71,7 @@ struct IClassFactory struct IClassFactory_vt* vt; }; -#ifdef WIN32_LOADER +#ifdef WIN32_LOADER long CoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter, long dwClsContext, const GUID* riid, void** ppv); void* CoTaskMemAlloc(unsigned long cb); diff --git a/loader/dmo/DMO_AudioDecoder.c b/loader/dmo/DMO_AudioDecoder.c index 033133c6fc..1b08757349 100644 --- a/loader/dmo/DMO_AudioDecoder.c +++ b/loader/dmo/DMO_AudioDecoder.c @@ -14,7 +14,7 @@ #include "DMO_AudioDecoder.h" struct DMO_AudioDecoder -{ +{ DMO_MEDIA_TYPE m_sOurType, m_sDestType; DMO_Filter* m_pDMO_Filter; char* m_sVhdr; @@ -44,17 +44,17 @@ DMO_AudioDecoder * DMO_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX Setup_LDT_Keeper(); Setup_FS_Segment(); #endif - + this = malloc(sizeof(DMO_AudioDecoder)); - + this->m_iFlushed=1; - + sz = 18 + wf->cbSize; this->m_sVhdr = malloc(sz); memcpy(this->m_sVhdr, wf, sz); this->m_sVhdr2 = malloc(18); memcpy(this->m_sVhdr2, this->m_sVhdr, 18); - + pWF = (WAVEFORMATEX*)this->m_sVhdr2; pWF->wFormatTag = 1; pWF->wBitsPerSample = 16; @@ -62,7 +62,7 @@ DMO_AudioDecoder * DMO_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX pWF->nBlockAlign = 2*pWF->nChannels; //pWF->nChannels * (pWF->wBitsPerSample + 7) / 8; pWF->nAvgBytesPerSec = pWF->nBlockAlign * pWF->nSamplesPerSec; pWF->cbSize = 0; - + memset(&this->m_sOurType, 0, sizeof(this->m_sOurType)); this->m_sOurType.majortype=MEDIATYPE_Audio; this->m_sOurType.subtype=MEDIASUBTYPE_PCM; @@ -92,7 +92,7 @@ print_wave_header((WAVEFORMATEX *)this->m_sVhdr2, MSGL_V); free(this); return NULL; } - + return this; } @@ -120,7 +120,7 @@ int DMO_AudioDecoder_Convert(DMO_AudioDecoder *this, const void* in_data, unsign #ifdef WIN32_LOADER Setup_FS_Segment(); #endif - + //m_pDMO_Filter->m_pMedia->vt->Lock(m_pDMO_Filter->m_pMedia, 1); bufferin = CMediaBufferCreate(in_size, (void*)in_data, in_size, 1); r = this->m_pDMO_Filter->m_pMedia->vt->ProcessInput(this->m_pDMO_Filter->m_pMedia, 0, @@ -148,7 +148,7 @@ int DMO_AudioDecoder_Convert(DMO_AudioDecoder *this, const void* in_data, unsign ((IMediaBuffer*)db.pBuffer)->vt->GetBufferAndLength((IMediaBuffer*)db.pBuffer, 0, &written); ((IMediaBuffer*)db.pBuffer)->vt->Release((IUnknown*)db.pBuffer); - + //printf("RESULTB: %d 0x%x %ld\n", r, r, written); //printf("Converted %d -> %d\n", in_size, out_size); } diff --git a/loader/dmo/DMO_VideoDecoder.c b/loader/dmo/DMO_VideoDecoder.c index 9f3e9d7eb8..d5a56ebefd 100644 --- a/loader/dmo/DMO_VideoDecoder.c +++ b/loader/dmo/DMO_VideoDecoder.c @@ -20,7 +20,7 @@ struct DMO_VideoDecoder { IVideoDecoder iv; - + DMO_Filter* m_pDMO_Filter; AM_MEDIA_TYPE m_sOurType, m_sDestType; VIDEOINFOHEADER* m_sVhdr; @@ -63,7 +63,7 @@ struct ct { int cap; char *name; }; - + static ct check[] = { { fccI420, 12, &MEDIASUBTYPE_I420, CAP_I420, NULL }, { fccYV12, 12, &MEDIASUBTYPE_YV12, CAP_YV12, NULL }, @@ -86,10 +86,10 @@ DMO_VideoDecoder * DMO_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHE DMO_VideoDecoder *this; HRESULT result; ct* c; - + this = malloc(sizeof(DMO_VideoDecoder)); memset( this, 0, sizeof(DMO_VideoDecoder)); - + this->m_sVhdr2 = 0; this->m_iLastQuality = -1; this->m_iMaxAuto = maxauto; @@ -103,10 +103,10 @@ DMO_VideoDecoder * DMO_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHE /*try*/ { unsigned int bihs; - + bihs = (format->biSize < (int) sizeof(BITMAPINFOHEADER)) ? sizeof(BITMAPINFOHEADER) : format->biSize; - + this->iv.m_bh = malloc(bihs); memcpy(this->iv.m_bh, format, bihs); this->iv.m_bh->biSize = bihs; @@ -118,7 +118,7 @@ DMO_VideoDecoder * DMO_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHE this->iv.m_iPlaypos = -1; this->iv.m_fQuality = 0.0f; this->iv.m_bCapable16b = true; - + bihs += sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER); this->m_sVhdr = malloc(bihs); memset(this->m_sVhdr, 0, bihs); @@ -162,7 +162,7 @@ DMO_VideoDecoder * DMO_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHE this->m_sDestType.pUnk = 0; this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER); this->m_sDestType.pbFormat = (char*)this->m_sVhdr2; - + memset(&this->iv.m_obh, 0, sizeof(this->iv.m_obh)); memcpy(&this->iv.m_obh, this->iv.m_bh, sizeof(this->iv.m_obh) < (unsigned) this->iv.m_bh->biSize ? sizeof(this->iv.m_obh) : (unsigned) this->iv.m_bh->biSize); @@ -175,7 +175,7 @@ DMO_VideoDecoder * DMO_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHE this->m_pDMO_Filter = DMO_FilterCreate(dllname, guid, &this->m_sOurType, &this->m_sDestType); - + if (!this->m_pDMO_Filter) { printf("Failed to create DMO filter\n"); @@ -217,7 +217,7 @@ DMO_VideoDecoder * DMO_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHE break; #endif default: - + this->m_Caps = CAP_NONE; printf("Decoder supports the following formats: "); @@ -275,7 +275,7 @@ void DMO_VideoDecoder_StartInternal(DMO_VideoDecoder *this) Debug printf("DMO_VideoDecoder_StartInternal\n"); //cout << "DSSTART" << endl; this->m_pDMO_Filter->Start(this->m_pDMO_Filter); - + props.cBuffers = 1; props.cbBuffer = this->m_sDestType.lSampleSize; @@ -283,7 +283,7 @@ void DMO_VideoDecoder_StartInternal(DMO_VideoDecoder *this) props.cbPrefix = 0; this->m_pDMO_Filter->m_pAll->vt->SetProperties(this->m_pDMO_Filter->m_pAll, &props, &props1); this->m_pDMO_Filter->m_pAll->vt->Commit(this->m_pDMO_Filter->m_pAll); -#endif +#endif this->iv.m_State = START; } @@ -301,7 +301,7 @@ int DMO_VideoDecoder_DecodeInternal(DMO_VideoDecoder *this, const void* src, int DMO_OUTPUT_DATA_BUFFER db; CMediaBuffer* bufferin; //+ uint8_t* imdata = dest ? dest->Data() : 0; - + Debug printf("DMO_VideoDecoder_DecodeInternal(%p,%p,%d,%d,%p)\n",this,src,size,is_keyframe,imdata); // this->m_pDMO_Filter->m_pAll->vt->GetBuffer(this->m_pDMO_Filter->m_pAll, &sample, 0, 0, 0); @@ -362,14 +362,14 @@ int DMO_VideoDecoder_SetDestFmt(DMO_VideoDecoder *this, int bits, unsigned int c { HRESULT result; int should_test=1; - + Debug printf("DMO_VideoDecoder_SetDestFmt (%p, %d, %d)\n",this,bits,(int)csp); - + /* if (!CImage::Supported(csp, bits)) return -1; */ // BitmapInfo temp = m_obh; - + if (!csp) // RGB { int ok = true; @@ -400,7 +400,7 @@ int DMO_VideoDecoder_SetDestFmt(DMO_VideoDecoder *this, int bits, unsigned int c this->iv.m_obh.biCompression=3;//BI_BITFIELDS this->iv.m_obh.biSizeImage=abs((int)(2*this->iv.m_obh.biWidth*this->iv.m_obh.biHeight)); } - + if( bits == 16 ) { this->iv.m_obh.colors[0]=0xF800; this->iv.m_obh.colors[1]=0x07E0; @@ -552,4 +552,3 @@ int DMO_VideoDecoder_SetDirection(DMO_VideoDecoder *this, int d) this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight; return 0; } - diff --git a/loader/dshow/DS_AudioDecoder.c b/loader/dshow/DS_AudioDecoder.c index 645c8b517b..b18b646160 100644 --- a/loader/dshow/DS_AudioDecoder.c +++ b/loader/dshow/DS_AudioDecoder.c @@ -11,7 +11,7 @@ #include "DS_Filter.h" struct DS_AudioDecoder -{ +{ WAVEFORMATEX in_fmt; AM_MEDIA_TYPE m_sOurType, m_sDestType; DS_Filter* m_pDS_Filter; @@ -44,22 +44,22 @@ DS_AudioDecoder * DS_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX* Setup_LDT_Keeper(); Setup_FS_Segment(); #endif - + this = malloc(sizeof(DS_AudioDecoder)); - + sz = 18 + wf->cbSize; this->m_sVhdr = malloc(sz); memcpy(this->m_sVhdr, wf, sz); this->m_sVhdr2 = malloc(18); memcpy(this->m_sVhdr2, this->m_sVhdr, 18); - + pWF = (WAVEFORMATEX*)this->m_sVhdr2; pWF->wFormatTag = 1; pWF->wBitsPerSample = 16; pWF->nBlockAlign = pWF->nChannels * (pWF->wBitsPerSample + 7) / 8; pWF->cbSize = 0; pWF->nAvgBytesPerSec = pWF->nBlockAlign * pWF->nSamplesPerSec; - + memcpy(&this->in_fmt,wf,sizeof(WAVEFORMATEX)); memset(&this->m_sOurType, 0, sizeof(this->m_sOurType)); @@ -100,7 +100,7 @@ DS_AudioDecoder * DS_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX* free(this); return NULL; } - + //Commit should be done before binary codec start this->m_pDS_Filter->m_pAll->vt->Commit(this->m_pDS_Filter->m_pAll); @@ -134,7 +134,7 @@ int DS_AudioDecoder_Convert(DS_AudioDecoder *this, const void* in_data, unsigned { unsigned int written = 0; unsigned int read = 0; - + if (!in_data || !out_data) return -1; @@ -185,7 +185,7 @@ int DS_AudioDecoder_GetSrcSize(DS_AudioDecoder *this, int dest_size) double efficiency =(double) this->in_fmt.nAvgBytesPerSec / (this->in_fmt.nSamplesPerSec*this->in_fmt.nBlockAlign); int frames = (int)(dest_size*efficiency); - + if (frames < 1) frames = 1; return frames * this->in_fmt.nBlockAlign; diff --git a/loader/dshow/DS_Filter.c b/loader/dshow/DS_Filter.c index 11dd11dee9..5fb1ec73dc 100644 --- a/loader/dshow/DS_Filter.c +++ b/loader/dshow/DS_Filter.c @@ -26,8 +26,8 @@ const GUID IID_IClassFactory = {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} }; -HRESULT STDCALL CoInitialize(LPVOID pvReserved); -void STDCALL CoUninitialize(void); +HRESULT STDCALL CoInitialize(LPVOID pvReserved); +void STDCALL CoUninitialize(void); #endif static void DS_Filter_Start(DS_Filter* This) @@ -137,9 +137,9 @@ DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id, #endif /* - tempAll is not used anywhere. + tempAll is not used anywhere. MemAllocatorCreate() is called to ensure that RegisterComObject for IMemoryAllocator - will be called before possible call + will be called before possible call to CoCreateInstance(...,&IID_IMemoryAllocator,...) from binary codec. */ tempAll=MemAllocatorCreate(); diff --git a/loader/dshow/DS_VideoDecoder.c b/loader/dshow/DS_VideoDecoder.c index a10436e325..e691bb5dc5 100644 --- a/loader/dshow/DS_VideoDecoder.c +++ b/loader/dshow/DS_VideoDecoder.c @@ -14,7 +14,7 @@ struct DS_VideoDecoder { IVideoDecoder iv; - + DS_Filter* m_pDS_Filter; AM_MEDIA_TYPE m_sOurType, m_sDestType; VIDEOINFOHEADER* m_sVhdr; @@ -53,7 +53,7 @@ static SampleProcUserData sampleProcData; int DS_VideoDecoder_GetCapabilities(DS_VideoDecoder *this) {return this->m_Caps;} - + typedef struct ct ct; struct ct { @@ -62,7 +62,7 @@ struct ct { const GUID *subtype; int cap; }; - + static ct check[] = { {16, fccYUY2, &MEDIASUBTYPE_YUY2, CAP_YUY2}, {12, fccIYUV, &MEDIASUBTYPE_IYUV, CAP_IYUV}, @@ -81,10 +81,10 @@ DS_VideoDecoder * DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEAD DS_VideoDecoder *this; HRESULT result; ct* c; - + this = malloc(sizeof(DS_VideoDecoder)); memset( this, 0, sizeof(DS_VideoDecoder)); - + this->m_sVhdr2 = 0; this->m_iLastQuality = -1; this->m_iMaxAuto = maxauto; @@ -98,10 +98,10 @@ DS_VideoDecoder * DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEAD /*try*/ { unsigned int bihs; - + bihs = (format->biSize < (int) sizeof(BITMAPINFOHEADER)) ? sizeof(BITMAPINFOHEADER) : format->biSize; - + this->iv.m_bh = malloc(bihs); memcpy(this->iv.m_bh, format, bihs); this->iv.m_bh->biSize = bihs; @@ -113,7 +113,7 @@ DS_VideoDecoder * DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEAD this->iv.m_iPlaypos = -1; this->iv.m_fQuality = 0.0f; this->iv.m_bCapable16b = true; - + bihs += sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER); this->m_sVhdr = malloc(bihs); memset(this->m_sVhdr, 0, bihs); @@ -153,7 +153,7 @@ DS_VideoDecoder * DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEAD this->m_sDestType.pUnk = 0; this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER); this->m_sDestType.pbFormat = (char*)this->m_sVhdr2; - + memset(&this->iv.m_obh, 0, sizeof(this->iv.m_obh)); memcpy(&this->iv.m_obh, this->iv.m_bh, sizeof(this->iv.m_obh) < (unsigned) this->iv.m_bh->biSize ? sizeof(this->iv.m_obh) : (unsigned) this->iv.m_bh->biSize); @@ -166,7 +166,7 @@ DS_VideoDecoder * DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEAD this->m_pDS_Filter = DS_FilterCreate(dllname, guid, &this->m_sOurType, &this->m_sDestType,&sampleProcData); - + if (!this->m_pDS_Filter) { printf("Failed to create DirectShow filter\n"); @@ -207,7 +207,7 @@ DS_VideoDecoder * DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEAD break; #endif default: - + this->m_Caps = CAP_NONE; printf("Decoder supports the following YUV formats: "); @@ -269,7 +269,7 @@ void DS_VideoDecoder_StartInternal(DS_VideoDecoder *this) //cout << "DSSTART" << endl; this->m_pDS_Filter->m_pAll->vt->Commit(this->m_pDS_Filter->m_pAll); this->m_pDS_Filter->Start(this->m_pDS_Filter); - + this->iv.m_State = START; } @@ -284,17 +284,17 @@ int DS_VideoDecoder_DecodeInternal(DS_VideoDecoder *this, const void* src, int s IMediaSample* sample = 0; char* ptr; int result; - + Debug printf("DS_VideoDecoder_DecodeInternal(%p,%p,%d,%d,%p)\n",this,src,size,is_keyframe,pImage); - + this->m_pDS_Filter->m_pAll->vt->GetBuffer(this->m_pDS_Filter->m_pAll, &sample, 0, 0, 0); - + if (!sample) { Debug printf("ERROR: null sample\n"); return -1; } - + //cout << "DECODE " << (void*) pImage << " d: " << (void*) pImage->Data() << endl; @@ -409,14 +409,14 @@ int DS_VideoDecoder_SetDestFmt(DS_VideoDecoder *this, int bits, unsigned int csp ALLOCATOR_PROPERTIES props,props1; int should_test=1; int stopped = 0; - + Debug printf("DS_VideoDecoder_SetDestFmt (%p, %d, %d)\n",this,bits,(int)csp); - + /* if (!CImage::Supported(csp, bits)) return -1; */ // BitmapInfo temp = m_obh; - + if (!csp) // RGB { int ok = true; @@ -450,7 +450,7 @@ int DS_VideoDecoder_SetDestFmt(DS_VideoDecoder *this, int bits, unsigned int csp this->iv.m_obh.biCompression=3;//BI_BITFIELDS this->iv.m_obh.biSizeImage=abs((int)(2*this->iv.m_obh.biWidth*this->iv.m_obh.biHeight)); } - + if( bits == 16 ) { this->iv.m_obh.colors[0]=0xF800; this->iv.m_obh.colors[1]=0x07E0; @@ -628,7 +628,7 @@ int DS_VideoDecoder_SetDestFmt(DS_VideoDecoder *this, int bits, unsigned int csp if (stopped) { DS_VideoDecoder_StartInternal(this); - this->iv.m_State = START; + this->iv.m_State = START; } return 0; @@ -814,7 +814,7 @@ int DS_VideoDecoder_SetValue(DS_VideoDecoder *this, const char* name, int value) } return 0; } -#if 0 +#if 0 if (strcmp((const char*)record.dll, "ir50_32.dll") == 0) { IHidden2* hidden = 0; @@ -872,23 +872,23 @@ int DS_SetAttr_DivX(char* attribute, int value){ { printf("VideoDecoder::SetExtAttr: registry failure\n"); return -1; - } + } result=RegSetValueExA(newkey, "Current Post Process Mode", 0, REG_DWORD, &value, 4); if(result!=0) { printf("VideoDecoder::SetExtAttr: error writing value\n"); return -1; - } + } value=-1; result=RegSetValueExA(newkey, "Force Post Process Mode", 0, REG_DWORD, &value, 4); if(result!=0) { printf("VideoDecoder::SetExtAttr: error writing value\n"); return -1; - } + } RegCloseKey(newkey); return 0; - } + } if( (strcasecmp(attribute, "Saturation")==0) || @@ -903,21 +903,17 @@ int DS_SetAttr_DivX(char* attribute, int value){ { printf("VideoDecoder::SetExtAttr: registry failure\n"); return -1; - } + } result=RegSetValueExA(newkey, attribute, 0, REG_DWORD, &value, 4); if(result!=0) { printf("VideoDecoder::SetExtAttr: error writing value\n"); return -1; - } + } RegCloseKey(newkey); return 0; - } + } printf("Unknown attribute!\n"); return -200; } - - - - diff --git a/loader/dshow/allocator.c b/loader/dshow/allocator.c index 4323e4a176..3e0deabceb 100644 --- a/loader/dshow/allocator.c +++ b/loader/dshow/allocator.c @@ -147,7 +147,7 @@ static HRESULT STDCALL MemAllocator_SetProperties(IMemAllocator * This, *pActual = *pRequest; /* DirectShow DOCS ("Negotiating Allocators" chapter) says that allocator might not - honor the requested properties. Thus, since WMSP audio codecs requests bufer with two + honor the requested properties. Thus, since WMSP audio codecs requests bufer with two bytes length for unknown reason, we should correct requested value. Otherwise above codec don't want to load. */ diff --git a/loader/dshow/cmediasample.c b/loader/dshow/cmediasample.c index 0c7c25d119..98a864b3be 100644 --- a/loader/dshow/cmediasample.c +++ b/loader/dshow/cmediasample.c @@ -119,7 +119,7 @@ static long STDCALL CMediaSample_Release(IUnknown* This) * \param[out] address of variable that receives pointer to sample's buffer * * \return S_OK success - * \return apropriate error otherwise + * \return apropriate error otherwise * * \note The calles should not free or reallocate buffer * @@ -157,7 +157,7 @@ static long STDCALL CMediaSample_GetSize(IMediaSample * This) * * \return S_OK success * \return VFW_E_NO_STOP_TIME The sample has valid start time, but no stop time - * \return VFW_E_SAMPLE_TIME_NOT_SET The sample is not time-stamped + * \return VFW_E_SAMPLE_TIME_NOT_SET The sample is not time-stamped * * \remarks * Both values are relative to stream time @@ -334,7 +334,7 @@ static HRESULT STDCALL CMediaSample_SetActualDataLength(IMediaSample* This, * * \remarks * If media type is not changed from previous sample, ppMediaType is null - * If method returns S_OK caller should free memory allocated for structure + * If method returns S_OK caller should free memory allocated for structure * including pbFormat block */ static HRESULT STDCALL CMediaSample_GetMediaType(IMediaSample* This, @@ -384,7 +384,7 @@ static HRESULT STDCALL CMediaSample_SetMediaType(IMediaSample * This, } /** - * \brief IMediaSample::IsDiscontinuity (determines if this sample represents data break + * \brief IMediaSample::IsDiscontinuity (determines if this sample represents data break * in stream) * * \param[in] This pointer to CMediaSample object @@ -392,7 +392,7 @@ static HRESULT STDCALL CMediaSample_SetMediaType(IMediaSample * This, * \return S_OK if this sample is break in data stream * \return S_FALSE otherwise * - * \remarks + * \remarks * Discontinuity occures when filter seeks to different place in the stream or when drops * samples. * @@ -404,7 +404,7 @@ static HRESULT STDCALL CMediaSample_IsDiscontinuity(IMediaSample * This) } /** - * \brief IMediaSample::IsDiscontinuity (specifies whether this sample represents data break + * \brief IMediaSample::IsDiscontinuity (specifies whether this sample represents data break * in stream) * * \param[in] This pointer to CMediaSample object @@ -430,7 +430,7 @@ static HRESULT STDCALL CMediaSample_SetDiscontinuity(IMediaSample * This, * \param[out] pTimeEnd pointer to variable that receives end time * * \return S_OK success - * \return VFW_E_MEDIA_TIME_NOT_SET The sample is not time-stamped + * \return VFW_E_MEDIA_TIME_NOT_SET The sample is not time-stamped * */ static HRESULT STDCALL CMediaSample_GetMediaTime(IMediaSample * This, diff --git a/loader/dshow/inputpin.c b/loader/dshow/inputpin.c index c5aa5eff47..37d9f758fa 100644 --- a/loader/dshow/inputpin.c +++ b/loader/dshow/inputpin.c @@ -445,9 +445,9 @@ static long STDCALL CInputPin_QueryInternalConnections(IPin* This, * \return S_OK - success * \return E_UNEXPECTED - The pin is output pin * - * \note - * IMemoryInputPin::Receive,IMemoryInputPin::ReceiveMultiple, IMemoryInputPin::EndOfStream, - * IMemAllocator::GetBuffer runs in different (streaming) thread then other + * \note + * IMemoryInputPin::Receive,IMemoryInputPin::ReceiveMultiple, IMemoryInputPin::EndOfStream, + * IMemAllocator::GetBuffer runs in different (streaming) thread then other * methods (application thread). * IMemoryInputPin::NewSegment runs either in streaming or application thread. * Developer must use critical sections for thread-safing work. @@ -602,7 +602,7 @@ static long STDCALL CBaseFilter_GetClassID(IBaseFilter * This, * * \remarks * When filter is stopped it does onot deliver or process any samples and rejects any samples - * from upstream filter. + * from upstream filter. * Transition may be asynchronous. In this case method should return S_FALSE. * Method always sets filter's state to State_Stopped even if error occured. * @@ -700,8 +700,8 @@ static long STDCALL CBaseFilter_SetSyncSource(IBaseFilter* This, * \brief IMediafilter::GetSyncSource (gets current reference clock) * * \param[in] This pointer to IBaseFilter interface - * \param[out] pClock address of variable that receives pointer to clock's - * IReferenceClock interface + * \param[out] pClock address of variable that receives pointer to clock's + * IReferenceClock interface * * \return S_OK success * \return E_POINTER Null pointer @@ -790,7 +790,7 @@ static long STDCALL CBaseFilter_QueryFilterInfo(IBaseFilter* This, * * \remarks * Filter should not call to graph's AddRef method. - * The IFilterGraph is guaranteed to be valid until graph manager calls this method again with + * The IFilterGraph is guaranteed to be valid until graph manager calls this method again with * the value NULL. * */ @@ -943,7 +943,7 @@ static long STDCALL CBaseFilter2_GetClassID(IBaseFilter* This, * * \remarks * When filter is stopped it does onot deliver or process any samples and rejects any samples - * from upstream filter. + * from upstream filter. * Transition may be asynchronous. In this case method should return S_FALSE. * Method always sets filter's state to State_Stopped even if error occured. * @@ -1042,8 +1042,8 @@ static long STDCALL CBaseFilter2_SetSyncSource(IBaseFilter* This, * \brief IMediafilter::GetSyncSource (gets current reference clock) * * \param[in] This pointer to IBaseFilter interface - * \param[out] pClock address of variable that receives pointer to clock's - * IReferenceClock interface + * \param[out] pClock address of variable that receives pointer to clock's + * IReferenceClock interface * * \return S_OK success * \return E_POINTER Null pointer @@ -1131,7 +1131,7 @@ static long STDCALL CBaseFilter2_QueryFilterInfo(IBaseFilter* This, * * \remarks * Filter should not call to graph's AddRef method. - * The IFilterGraph is guaranteed to be valid until graph manager calls this method again with + * The IFilterGraph is guaranteed to be valid until graph manager calls this method again with * the value NULL. * */ diff --git a/loader/dshow/libwin32.h b/loader/dshow/libwin32.h index 509941432b..70d5e0f006 100644 --- a/loader/dshow/libwin32.h +++ b/loader/dshow/libwin32.h @@ -31,7 +31,7 @@ typedef struct CodecInfo typedef struct CImage // public your_libvo_mem { char* ptr; - + /*char* (*Data)(); { return 0; @@ -40,7 +40,7 @@ typedef struct CImage // public your_libvo_mem /*int (*Supported)(fourcc_t csp, int bits); { return true; - // if you support such surface + // if you support such surface }*/ }CImage; @@ -109,7 +109,7 @@ typedef struct BitmapInfo long biYPelsPerMeter; long biClrUsed; long biClrImportant; - int colors[3]; + int colors[3]; } BitmapInfo; typedef struct IVideoDecoder diff --git a/loader/dshow/mediatype.c b/loader/dshow/mediatype.c index fc37f972f3..d6597fa767 100644 --- a/loader/dshow/mediatype.c +++ b/loader/dshow/mediatype.c @@ -32,8 +32,8 @@ void DisplayMediaType(const char * label,const AM_MEDIA_TYPE* pmt){ VIDEOINFOHEADER* Vhdr; int i; GUID* iid; - - + + Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"=======================\n"); if(label){ Debug mp_msg(MSGT_LOADER,MSGL_DBG4,"AM_MEDIA_TYPE: %s\n",label); @@ -103,7 +103,7 @@ HRESULT CopyMediaType(AM_MEDIA_TYPE * pDest, const AM_MEDIA_TYPE *pSrc) if(pSrc == pDest) return E_INVALIDARG; if(!pSrc->pbFormat && pSrc->cbFormat) return E_POINTER; - + memcpy(pDest, pSrc, sizeof(AM_MEDIA_TYPE)); if (!pSrc->pbFormat) return S_OK; if (!(pDest->pbFormat = CoTaskMemAlloc(pSrc->cbFormat))) diff --git a/loader/dshow/mediatype.h b/loader/dshow/mediatype.h index c58bb32e9f..ecb696ca39 100644 --- a/loader/dshow/mediatype.h +++ b/loader/dshow/mediatype.h @@ -8,7 +8,7 @@ #define MPLAYER_MEDIATYPE_H #include "guids.h" - + typedef struct __attribute__((__packed__)) MediaType { GUID majortype; //0x0 @@ -26,7 +26,7 @@ typedef struct __attribute__((__packed__)) MediaType * \brief print info from AM_MEDIA_TYPE structure * =param[in] label short lable for media type * \param[in] pmt pointer to AM_MEDIA_TYPE - * + * * routine used for debug purposes * */ @@ -61,7 +61,7 @@ void DeleteMediaType(AM_MEDIA_TYPE* pmt); * * \return S_OK - success * \return E_POINTER - pSrc or pDst is NULL or (pSrc->cbFormat && !pSrc->pbFormat) - * \return E_INVALIDARG - (pSrc == pDst) + * \return E_INVALIDARG - (pSrc == pDst) * \return E_OUTOFMEMORY - Insufficient memory * * \note diff --git a/loader/dshow/outputpin.c b/loader/dshow/outputpin.c index 534ff13615..d876f4401f 100644 --- a/loader/dshow/outputpin.c +++ b/loader/dshow/outputpin.c @@ -493,9 +493,9 @@ static HRESULT STDCALL COutputPin_QueryInternalConnections(IPin * This, * \return S_OK - success * \return E_UNEXPECTED - The pin is output pin * - * \note - * IMemoryInputPin::Receive,IMemoryInputPin::ReceiveMultiple, IMemoryInputPin::EndOfStream, - * IMemAllocator::GetBuffer runs in different (streaming) thread then other + * \note + * IMemoryInputPin::Receive,IMemoryInputPin::ReceiveMultiple, IMemoryInputPin::EndOfStream, + * IMemAllocator::GetBuffer runs in different (streaming) thread then other * methods (application thread). * IMemoryInputPin::NewSegment runs either in streaming or application thread. * Developer must use critical sections for thread-safing work. @@ -697,9 +697,9 @@ static HRESULT STDCALL COutputMemPin_GetAllocatorRequirements(IMemInputPin* This * In the last case method might block indefinitely. If this might * happen IMemInpuPin::ReceiveCAnBlock returns S_OK * - * \note - * IMemoryInputPin::Receive,IMemoryInputPin::ReceiveMultiple, IMemoryInputPin::EndOfStream, - * IMemAllocator::GetBuffer runs in different (streaming) thread then other + * \note + * IMemoryInputPin::Receive,IMemoryInputPin::ReceiveMultiple, IMemoryInputPin::EndOfStream, + * IMemAllocator::GetBuffer runs in different (streaming) thread then other * methods (application thread). * IMemoryInputPin::NewSegment runs either in streaming or application thread. * Developer must use critical sections for thread-safing work. @@ -736,9 +736,9 @@ static HRESULT STDCALL COutputMemPin_Receive(IMemInputPin* This, * \remarks * This method behaves like IMemInputPin::Receive but for array of samples * - * \note - * IMemoryInputPin::Receive,IMemoryInputPin::ReceiveMultiple, IMemoryInputPin::EndOfStream, - * IMemAllocator::GetBuffer runs in different (streaming) thread then other + * \note + * IMemoryInputPin::Receive,IMemoryInputPin::ReceiveMultiple, IMemoryInputPin::EndOfStream, + * IMemAllocator::GetBuffer runs in different (streaming) thread then other * methods (application thread). * IMemoryInputPin::NewSegment runs either in streaming or application thread. * Developer must use critical sections for thread-safing work. diff --git a/loader/elfdll.c b/loader/elfdll.c index fe71cbd911..1927640505 100644 --- a/loader/elfdll.c +++ b/loader/elfdll.c @@ -213,7 +213,7 @@ static WINE_MODREF *ELFDLL_CreateModref(HMODULE hModule, LPCSTR path) /* Link MODREF into process list */ // EnterCriticalSection( &PROCESS_Current()->crit_section ); - + if(local_wm) { local_wm->next = (modref_list*) malloc(sizeof(modref_list)); @@ -227,7 +227,7 @@ static WINE_MODREF *ELFDLL_CreateModref(HMODULE hModule, LPCSTR path) local_wm = (modref_list*) malloc(sizeof(modref_list)); local_wm->next=local_wm->prev=NULL; local_wm->wm=wm; - } + } // LeaveCriticalSection( &PROCESS_Current()->crit_section ); return wm; @@ -263,7 +263,7 @@ WINE_MODREF *ELFDLL_LoadLibraryExA(LPCSTR path, DWORD flags) /* strcpy(soname, name); strcat(soname, "_elfdll_image"); image = (struct elfdll_image *)dlsym(dlhandle, soname); - if(!image) + if(!image) { ERR("Could not get elfdll image descriptor %s (%s)\n", soname, dlerror()); dlclose(dlhandle); diff --git a/loader/ext.c b/loader/ext.c index b57eed674b..23c0292c6c 100644 --- a/loader/ext.c +++ b/loader/ext.c @@ -250,7 +250,7 @@ LPVOID FILE_dommap( int unix_handle, LPVOID start, { ret = mmap_anon( start, size_low, prot, flags, offset_low ); } - else + else { fd = unix_handle; ret = mmap( start, size_low, prot, flags, fd, offset_low ); diff --git a/loader/ldt_keeper.c b/loader/ldt_keeper.c index f0ffe02dce..732d254a28 100644 --- a/loader/ldt_keeper.c +++ b/loader/ldt_keeper.c @@ -211,7 +211,7 @@ ldt_fs_t* Setup_LDT_Keeper(void) if (getenv("DYLD_BIND_AT_LAUNCH") == NULL) mp_tmsg(MSGT_LOADER, MSGL_WARN, "WARNING: Attempting to use DLL codecs but environment variable\n DYLD_BIND_AT_LAUNCH not set. This will likely crash.\n"); #endif /* __APPLE__ */ - + fs_seg= ldt_fs->fs_seg = mmap_anon(NULL, getpagesize(), PROT_READ | PROT_WRITE, MAP_PRIVATE, 0); if (ldt_fs->fs_seg == (void*)-1) diff --git a/loader/module.c b/loader/module.c index 4945125521..2bce928544 100644 --- a/loader/module.c +++ b/loader/module.c @@ -649,7 +649,7 @@ FARPROC WINAPI GetProcAddress( HMODULE hModule, LPCSTR function ) #ifdef DEBUG_QTX_API -/* +/* http://lists.apple.com/archives/quicktime-api/2003/Jan/msg00278.html */ @@ -720,7 +720,7 @@ static int dump_component(char* name, int type, void* orig, ComponentParameters ++c_level; ret=orig(params,glob); --c_level; - + if(ret>=0x1000) fprintf(stderr,"%*s return=0x%X\n",3*c_level,"",ret); else @@ -757,35 +757,35 @@ static int report_func(void *stack_base, int stack_size, reg386_t *reg, uint32_t char* pname=NULL; int plen=-1; // find the code: - + dptr=0x62b67ae0;dptr+=2*((reg->eax>>16)&255); // printf("FUNC: flag=%d ptr=%p\n",dptr[0],dptr[1]); if(dptr[0]&255){ dptr=dptr[1];dptr+=4*(reg->eax&65535); // printf("FUNC: ptr2=%p eax=%p edx=%p\n",dptr[1],dptr[0],dptr[2]); - pwrapper=dptr[1]; pptr=dptr[0]; plen=dptr[2]; + pwrapper=dptr[1]; pptr=dptr[0]; plen=dptr[2]; } else { pwrapper=0x62924910; switch(dptr[1]){ case 0x629248d0: dptr=0x62b672c0;dptr+=2*(reg->eax&65535); // printf("FUNC: ptr2=%p eax=%p edx=%p\n",0x62924910,dptr[0],dptr[1]); - pptr=dptr[0]; plen=dptr[1]; + pptr=dptr[0]; plen=dptr[1]; break; case 0x62924e40: dptr=0x62b67c70;dptr+=2*(reg->eax&65535); // printf("FUNC: ptr2=%p eax=%p edx=%p\n",0x62924910,dptr[0],dptr[1]); - pptr=dptr[0]; plen=dptr[1]; + pptr=dptr[0]; plen=dptr[1]; break; case 0x62924e60: dptr=0x62b68108;if(reg->eax&0x8000) dptr+=2*(reg->eax|0xffff0000); else dptr+=2*(reg->eax&65535); // printf("FUNC: ptr2=%p eax=%p edx=%p\n",0x62924910,dptr[0],dptr[1]); - pptr=dptr[0]; plen=dptr[1]; + pptr=dptr[0]; plen=dptr[1]; break; case 0x62924e80: dptr=0x62b68108;if(reg->eax&0x8000) dptr+=2*(reg->eax|0xffff0000); else dptr+=2*(reg->eax&65535); // printf("FUNC: ptr2=%p eax=%p edx=%p\n",0x62924910,dptr[0],dptr[1]); - pptr=dptr[0]; plen=dptr[1]; + pptr=dptr[0]; plen=dptr[1]; break; default: printf("FUNC: unknown ptr & psize!\n"); @@ -823,7 +823,7 @@ static int report_func(void *stack_base, int stack_size, reg386_t *reg, uint32_t fflush(stdout); #endif - + #if 1 // emulate some functions: switch(reg->eax){ @@ -914,7 +914,7 @@ static int report_func(void *stack_base, int stack_size, reg386_t *reg, uint32_t } } - // print stack/reg information + // print stack/reg information printf("ENTER(%d) stack = %d bytes @ %p\n" "eax = 0x%08x edx = 0x%08x ebx = 0x%08x ecx = 0x%08x\n" "esp = 0x%08x ebp = 0x%08x esi = 0x%08x edi = 0x%08x\n" @@ -930,15 +930,15 @@ static int report_func(void *stack_base, int stack_size, reg386_t *reg, uint32_t ++ret_i; #if 0 - // print first 7 longs in the stack (return address, arg[1], arg[2] ... ) + // print first 7 longs in the stack (return address, arg[1], arg[2] ... ) printf("stack[] = { "); for (i=0;i<7;i++) { printf("%08x ", ((uint32_t *)stack_base)[i]); } printf("}\n\n"); #endif - -// // mess with function parameters + +// // mess with function parameters // ((uint32_t *)stack_base)[1] = 0x66554433; // // mess with return address... @@ -966,7 +966,7 @@ static int report_func_ret(void *stack_base, int stack_size, reg386_t *reg, uint printf("\n"); fflush(stdout); #else - // print stack/reg information + // print stack/reg information printf("LEAVE(%d) stack = %d bytes @ %p\n" "eax = 0x%08x edx = 0x%08x ebx = 0x%08x ecx = 0x%08x\n" "esp = 0x%08x ebp = 0x%08x esi = 0x%08x edi = 0x%08x\n" @@ -978,7 +978,7 @@ static int report_func_ret(void *stack_base, int stack_size, reg386_t *reg, uint #endif #if 0 - // print first 7 longs in the stack (return address, arg[1], arg[2] ... ) + // print first 7 longs in the stack (return address, arg[1], arg[2] ... ) printf("stack[] = { "); for (i=0;i<7;i++) { printf("%08x ", ((uint32_t *)stack_base)[i]); @@ -987,8 +987,8 @@ static int report_func_ret(void *stack_base, int stack_size, reg386_t *reg, uint #endif #endif - -// // mess with function parameters + +// // mess with function parameters // ((uint32_t *)stack_base)[1] = 0x66554433; // // mess with return address... diff --git a/loader/pe_image.c b/loader/pe_image.c index 1b069b82ac..b4bdba90c8 100644 --- a/loader/pe_image.c +++ b/loader/pe_image.c @@ -1,4 +1,4 @@ -/* +/* * Copyright 1994 Eric Youndale & Erik Bos * Copyright 1995 Martin von Löwis * Copyright 1996-98 Marcus Meissner @@ -16,12 +16,12 @@ /* Notes: * Before you start changing something in this file be aware of the following: * - * - There are several functions called recursively. In a very subtle and + * - There are several functions called recursively. In a very subtle and * obscure way. DLLs can reference each other recursively etc. * - If you want to enhance, speed up or clean up something in here, think * twice WHY it is implemented in that strange way. There is usually a reason. * Though sometimes it might just be lazyness ;) - * - In PE_MapImage, right before fixup_imports() all external and internal + * - In PE_MapImage, right before fixup_imports() all external and internal * state MUST be correct since this function can be called with the SAME image * AGAIN. (Thats recursion for you.) That means MODREF.module and * NE_MODULE.module32. @@ -69,7 +69,7 @@ #define AdjustPtr(ptr,delta) ((char *)(ptr) + (delta)) static void dump_exports( HMODULE hModule ) -{ +{ char *Module; unsigned int i, j; unsigned short *ordinal; @@ -85,7 +85,7 @@ static void dump_exports( HMODULE hModule ) Module = (char*)RVA(pe_exports->Name); TRACE("*******EXPORT DATA*******\n"); - TRACE("Module name is %s, %ld functions, %ld names\n", + TRACE("Module name is %s, %ld functions, %ld names\n", Module, pe_exports->NumberOfFunctions, pe_exports->NumberOfNames); ordinal=(unsigned short*) RVA(pe_exports->AddressOfNameOrdinals); @@ -95,11 +95,11 @@ static void dump_exports( HMODULE hModule ) TRACE(" Ord RVA Addr Name\n" ); for (i=0;iNumberOfFunctions;i++, function++) { - if (!*function) continue; + if (!*function) continue; if (TRACE_ON(win32)) { dbg_printf( "%4ld %08lx %p", i + pe_exports->Base, *function, RVA(*function) ); - + for (j = 0; j < pe_exports->NumberOfNames; j++) if (ordinal[j] == i) { @@ -115,15 +115,15 @@ static void dump_exports( HMODULE hModule ) /* Look up the specified function or ordinal in the exportlist: * If it is a string: - * - look up the name in the Name list. + * - look up the name in the Name list. * - look up the ordinal with that index. * - use the ordinal as offset into the functionlist * If it is a ordinal: * - use ordinal-pe_export->Base as offset into the functionlist */ -FARPROC PE_FindExportedFunction( - WINE_MODREF *wm, - LPCSTR funcName, +FARPROC PE_FindExportedFunction( + WINE_MODREF *wm, + LPCSTR funcName, WIN_BOOL snoop ) { unsigned short * ordinals; @@ -160,7 +160,7 @@ FARPROC PE_FindExportedFunction( if (HIWORD(funcName)) { - + int min = 0, max = exports->NumberOfNames - 1; while (min <= max) { @@ -174,7 +174,7 @@ FARPROC PE_FindExportedFunction( if (res > 0) max = pos - 1; else min = pos + 1; } - + for (i = 0; i < exports->NumberOfNames; i++) { ename = (const char*) RVA(name[i]); @@ -187,10 +187,10 @@ FARPROC PE_FindExportedFunction( } return NULL; } - else + else { ordinal = LOWORD(funcName) - exports->Base; - if (snoop && name) + if (snoop && name) { for (i = 0; i < exports->NumberOfNames; i++) if (ordinals[i] == ordinal) @@ -217,11 +217,11 @@ FARPROC PE_FindExportedFunction( if (!ename) ename = "@"; // proc = SNOOP_GetProcAddress(wm->module,ename,ordinal,proc); TRACE("SNOOP_GetProcAddress n/a\n"); - + } return proc; } - else + else { WINE_MODREF *wm; char *forward = RVA(addr); @@ -248,7 +248,7 @@ static DWORD fixup_imports( WINE_MODREF *wm ) unsigned int load_addr = wm->module; int i,characteristics_detection=1; char *modname; - + assert(wm->type==MODULE32_PE); pem = &(wm->binfmt.pe); if (pem->pe_export) @@ -256,10 +256,10 @@ static DWORD fixup_imports( WINE_MODREF *wm ) else modname = ""; - + TRACE("Dumping imports list\n"); - + pe_imp = pem->pe_import; if (!pe_imp) return 0; @@ -274,16 +274,16 @@ static DWORD fixup_imports( WINE_MODREF *wm ) break; i++; } - if (!i) return 0; + if (!i) return 0; + - wm->nDeps = i; wm->deps = HeapAlloc( GetProcessHeap(), 0, i*sizeof(WINE_MODREF *) ); - /* load the imported modules. They are automatically + /* load the imported modules. They are automatically * added to the modref list of the process. */ - + for (i = 0, pe_imp = pem->pe_import; pe_imp->Name ; pe_imp++) { IMAGE_IMPORT_BY_NAME *pe_name; PIMAGE_THUNK_DATA import_list,thunk_list; @@ -294,8 +294,8 @@ static DWORD fixup_imports( WINE_MODREF *wm ) //#warning FIXME: here we should fill imports TRACE("Loading imports for %s.dll\n", name); - - if (pe_imp->u.OriginalFirstThunk != 0) { + + if (pe_imp->u.OriginalFirstThunk != 0) { TRACE("Microsoft style imports used\n"); import_list =(PIMAGE_THUNK_DATA) RVA(pe_imp->u.OriginalFirstThunk); thunk_list = (PIMAGE_THUNK_DATA) RVA(pe_imp->FirstThunk); @@ -305,9 +305,9 @@ static DWORD fixup_imports( WINE_MODREF *wm ) int ordinal = IMAGE_ORDINAL(import_list->u1.Ordinal); // TRACE("--- Ordinal %s,%d\n", name, ordinal); - + thunk_list->u1.Function=LookupExternal(name, ordinal); - } else { + } else { pe_name = (PIMAGE_IMPORT_BY_NAME)RVA(import_list->u1.AddressOfData); // TRACE("--- %s %s.%d\n", pe_name->Name, name, pe_name->Hint); thunk_list->u1.Function=LookupExternalByName(name, pe_name->Name); @@ -315,12 +315,12 @@ static DWORD fixup_imports( WINE_MODREF *wm ) import_list++; thunk_list++; } - } else { + } else { TRACE("Borland style imports used\n"); thunk_list = (PIMAGE_THUNK_DATA) RVA(pe_imp->FirstThunk); while (thunk_list->u1.Ordinal) { if (IMAGE_SNAP_BY_ORDINAL(thunk_list->u1.Ordinal)) { - + int ordinal = IMAGE_ORDINAL(thunk_list->u1.Ordinal); TRACE("--- Ordinal %s.%d\n",name,ordinal); @@ -349,8 +349,8 @@ static int calc_vma_size( HMODULE hModule ) TRACE(" Name VSz Vaddr SzRaw Fileadr *Reloc *Lineum #Reloc #Linum Char\n"); for (i = 0; i< PE_HEADER(hModule)->FileHeader.NumberOfSections; i++) { - TRACE("%8s: %4.4lx %8.8lx %8.8lx %8.8lx %8.8lx %8.8lx %4.4x %4.4x %8.8lx\n", - pe_seg->Name, + TRACE("%8s: %4.4lx %8.8lx %8.8lx %8.8lx %8.8lx %8.8lx %4.4x %4.4x %8.8lx\n", + pe_seg->Name, pe_seg->Misc.VirtualSize, pe_seg->VirtualAddress, pe_seg->SizeOfRawData, @@ -374,7 +374,7 @@ static void do_relocations( unsigned int load_addr, IMAGE_BASE_RELOCATION *r ) int ldelta = delta & 0xFFFF; if(delta == 0) - + return; while(r->VirtualAddress) { @@ -383,7 +383,7 @@ static void do_relocations( unsigned int load_addr, IMAGE_BASE_RELOCATION *r ) int i; TRACE_(fixup)("%x relocations for page %lx\n", count, r->VirtualAddress); - + for(i=0;iTypeOffset[i] & 0xFFF; @@ -400,7 +400,7 @@ static void do_relocations( unsigned int load_addr, IMAGE_BASE_RELOCATION *r ) break; case IMAGE_REL_BASED_HIGHLOW: *(int*)(page+offset) += delta; - + break; case IMAGE_REL_BASED_HIGHADJ: FIXME("Don't know what to do with IMAGE_REL_BASED_HIGHADJ\n"); @@ -416,16 +416,16 @@ static void do_relocations( unsigned int load_addr, IMAGE_BASE_RELOCATION *r ) r = (IMAGE_BASE_RELOCATION*)((char*)r + r->SizeOfBlock); } } - - - + + + /********************************************************************** * PE_LoadImage * Load one PE format DLL/EXE into memory - * - * Unluckily we can't just mmap the sections where we want them, for + * + * Unluckily we can't just mmap the sections where we want them, for * (at least) Linux does only support offsets which are page-aligned. * * BUT we have to map the whole image anyway, for Win32 programs sometimes @@ -446,9 +446,9 @@ HMODULE PE_LoadImage( int handle, LPCSTR filename, WORD *version ) int unix_handle = handle; int page_size = getpagesize(); - -// if ( GetFileInformationByHandle( hFile, &bhfi ) ) -// file_size = bhfi.nFileSizeLow; + +// if ( GetFileInformationByHandle( hFile, &bhfi ) ) +// file_size = bhfi.nFileSizeLow; file_size=lseek(handle, 0, SEEK_END); lseek(handle, 0, SEEK_SET); @@ -476,14 +476,14 @@ HMODULE PE_LoadImage( int handle, LPCSTR filename, WORD *version ) nt = PE_HEADER( hModule ); - + if ( nt->Signature != IMAGE_NT_SIGNATURE ) { WARN("%s image doesn't have PE signature, but 0x%08lx\n", filename, nt->Signature ); goto error; } - + if ( nt->FileHeader.Machine != IMAGE_FILE_MACHINE_I386 ) { dbg_printf("Trying to load PE image for unsupported architecture ("); @@ -502,10 +502,10 @@ HMODULE PE_LoadImage( int handle, LPCSTR filename, WORD *version ) goto error; } - + pe_sec = PE_SECTIONS( hModule ); rawsize = 0; lowest_va = 0x10000; - for (i = 0; i < nt->FileHeader.NumberOfSections; i++) + for (i = 0; i < nt->FileHeader.NumberOfSections; i++) { if (lowest_va > pe_sec[i].VirtualAddress) lowest_va = pe_sec[i].VirtualAddress; @@ -514,17 +514,17 @@ HMODULE PE_LoadImage( int handle, LPCSTR filename, WORD *version ) if (pe_sec[i].PointerToRawData+pe_sec[i].SizeOfRawData > rawsize) rawsize = pe_sec[i].PointerToRawData+pe_sec[i].SizeOfRawData; } - - + + if ( file_size && file_size < rawsize ) { ERR("PE module is too small (header: %d, filesize: %d), " - "probably truncated download?\n", + "probably truncated download?\n", rawsize, file_size ); goto error; } - + aoep = nt->OptionalHeader.AddressOfEntryPoint; if (aoep && (aoep < lowest_va)) FIXME("VIRUS WARNING: '%s' has an invalid entrypoint (0x%08lx) " @@ -546,11 +546,11 @@ HMODULE PE_LoadImage( int handle, LPCSTR filename, WORD *version ) if ( nt->OptionalHeader.ImageBase & 0x80000000 && !strstr(filename, "xanlib.dll")) { - HMODULE sharedMod = (HMODULE)nt->OptionalHeader.ImageBase; + HMODULE sharedMod = (HMODULE)nt->OptionalHeader.ImageBase; IMAGE_NT_HEADERS *sharedNt = (PIMAGE_NT_HEADERS) ( (LPBYTE)sharedMod + ((LPBYTE)nt - (LPBYTE)hModule) ); - /* Well, this check is not really comprehensive, + /* Well, this check is not really comprehensive, but should be good enough for now ... */ if ( !IsBadReadPtr( (LPBYTE)sharedMod, sizeof(IMAGE_DOS_HEADER) ) && memcmp( (LPBYTE)sharedMod, (LPBYTE)hModule, sizeof(IMAGE_DOS_HEADER) ) == 0 @@ -563,21 +563,21 @@ HMODULE PE_LoadImage( int handle, LPCSTR filename, WORD *version ) } - + load_addr = nt->OptionalHeader.ImageBase; vma_size = calc_vma_size( hModule ); load_addr = (DWORD)VirtualAlloc( (void*)load_addr, vma_size, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE ); - if (load_addr == 0) + if (load_addr == 0) { - + FIXME("We need to perform base relocations for %s\n", filename); dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_BASERE