* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include <stdarg.h>
-
-#define COBJMACROS
-
-#include "windef.h"
-#include "winbase.h"
-#include "winnls.h"
-#include "wingdi.h"
-#include "winuser.h"
-#include "winreg.h"
-#include "winerror.h"
-
-#include "ole2.h"
-#include "shellapi.h"
-#include "shlobj.h"
-#include "vfw.h"
-#include "msacm.h"
-
#include "avifile_private.h"
-#include "wine/debug.h"
-#include "wine/unicode.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(avifile);
-
+#include <winreg.h>
/***********************************************************************
* for AVIBuildFilterW -- uses fixed size table
*/
HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
{
+ static const WCHAR all_files[] = { '*','.','*',0,0 };
static const WCHAR szClsid[] = {'C','L','S','I','D',0};
static const WCHAR szExtensionFmt[] = {';','*','.','%','s',0};
static const WCHAR szAVIFileExtensions[] =
/*
* 1. iterate over HKEY_CLASSES_ROOT\\AVIFile\\Extensions and collect
- * extensions and CLSID's
- * 2. iterate over collected CLSID's and copy its description and its
+ * extensions and CLSIDs
+ * 2. iterate over collected CLSIDs and copy its description and its
* extensions to szFilter if it fits
*
* First filter is named "All multimedia files" and its filter is a
/* add "All files" "*.*" filter if enough space left */
size = LoadStringW(AVIFILE_hModule, IDS_ALLFILES,
- szAllFiles, sizeof(szAllFiles)/sizeof(szAllFiles[0])) + 1;
- if (cbFilter > size) {
- int i;
+ szAllFiles, (sizeof(szAllFiles) - sizeof(all_files))/sizeof(WCHAR)) + 1;
+ memcpy( szAllFiles + size, all_files, sizeof(all_files) );
+ size += sizeof(all_files) / sizeof(WCHAR);
- /* replace '@' with \000 to separate description of filter */
- for (i = 0; i < size && szAllFiles[i] != 0; i++) {
- if (szAllFiles[i] == '@') {
- szAllFiles[i] = 0;
- break;
- }
- }
-
+ if (cbFilter > size) {
memcpy(szFilter, szAllFiles, size * sizeof(szAllFiles[0]));
- szFilter += size;
- szFilter[0] = 0;
-
return AVIERR_OK;
} else {
szFilter[0] = 0;
pOptions->dwFlags |= AVICOMPRESSF_VALID;
HeapFree(GetProcessHeap(), 0, afmtc.pwfxEnum);
- return (ret == S_OK ? TRUE : FALSE);
+ return ret == S_OK;
} else {
ERR(": unknown streamtype 0x%08X\n", sInfo.fccType);
return FALSE;
HRESULT hr;
int len;
- TRACE("%s,%p,%p,%d,%p,%p)\n", debugstr_a(szFile), pclsidHandler,
+ TRACE("(%s,%p,%p,%d,%p,%p)\n", debugstr_a(szFile), pclsidHandler,
lpfnCallback, nStream, ppavi, plpOptions);
if (szFile == NULL || ppavi == NULL || plpOptions == NULL)
TRACE("(%p,%p,%d)\n", pstream, asi, size);
- if (pstream == NULL)
- return AVIERR_BADHANDLE;
- if ((DWORD)size < sizeof(AVISTREAMINFOA))
+ if (size >= 0 && size < sizeof(AVISTREAMINFOA))
return AVIERR_BADSIZE;
memcpy(&asiw, asi, sizeof(asiw) - sizeof(asiw.szName));
TRACE("(%p,%p,%d)\n", pstream, asi, size);
+ if (size >= 0 && size < sizeof(AVISTREAMINFOA))
+ return AVIERR_BADSIZE;
+
hr = IAVIStream_QueryInterface(pstream, &IID_IAVIEditStream,(LPVOID*)&pEdit);
if (SUCCEEDED(hr) && pEdit != NULL) {
hr = IAVIEditStream_SetInfo(pEdit, asi, size);