ReactOS 0.4.16-dev-320-g3bd9ddc
mciwnd.c File Reference
#include <windows.h>
#include <vfw.h>
#include "wine/heap.h"
#include "wine/test.h"
Include dependency graph for mciwnd.c:

Go to the source code of this file.

Macros

#define WIN32_LEAN_AND_MEAN
 

Functions

static BOOL create_avi_file (char *fname)
 
static void test_MCIWndCreate (void)
 
 START_TEST (mciwnd)
 

Variables

static const DWORD file_header []
 
static const MainAVIHeader main_avi_header
 
static const DWORD stream_list []
 
static const AVIStreamHeader avi_stream_header
 
static const DWORD video_stream_format []
 
static const DWORD padding []
 
static const DWORD data []
 

Macro Definition Documentation

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 21 of file mciwnd.c.

Function Documentation

◆ create_avi_file()

static BOOL create_avi_file ( char fname)
static

Definition at line 112 of file mciwnd.c.

113{
115 DWORD written;
116 char temp_path[MAX_PATH];
117 BOOL ret;
118 BYTE *buffer;
119 ULONG buffer_length;
120
122 ok(ret, "Failed to get a temp path, err %d\n", GetLastError());
123 if (!ret)
124 return FALSE;
125
126 ret = GetTempFileNameA(temp_path, "mci", 0, fname);
127 ok(ret, "Failed to get a temp name, err %d\n", GetLastError());
128 if (!ret)
129 return FALSE;
130 DeleteFileA(fname);
131
132 lstrcatA(fname, ".avi");
133
135 ok(hFile != INVALID_HANDLE_VALUE, "Failed to create a file, err %d\n", GetLastError());
136 if (hFile == INVALID_HANDLE_VALUE) return FALSE;
137
138 buffer_length = padding[1];
139 buffer = heap_alloc_zero(buffer_length);
140
141 WriteFile(hFile, file_header, sizeof(file_header), &written, NULL);
142 WriteFile(hFile, &main_avi_header, sizeof(MainAVIHeader), &written, NULL);
143 WriteFile(hFile, stream_list, sizeof(stream_list), &written, NULL);
146 WriteFile(hFile, padding, sizeof(padding), &written, NULL);
147 WriteFile(hFile, buffer, buffer_length, &written, NULL);
148 WriteFile(hFile, data, sizeof(data), &written, NULL);
149
151
153 return ret;
154}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
#define MAX_PATH
Definition: compat.h:34
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2054
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
Definition: filename.c:26
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint buffer
Definition: glext.h:5915
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define CREATE_ALWAYS
Definition: disk.h:72
static const DWORD stream_list[]
Definition: mciwnd.c:52
static const DWORD video_stream_format[]
Definition: mciwnd.c:76
static const DWORD padding[]
Definition: mciwnd.c:89
static const AVIStreamHeader avi_stream_header
Definition: mciwnd.c:58
static const MainAVIHeader main_avi_header
Definition: mciwnd.c:37
static const DWORD file_header[]
Definition: mciwnd.c:29
char temp_path[MAX_PATH]
Definition: mspatcha.c:123
_In_ HANDLE hFile
Definition: mswsock.h:90
#define GENERIC_WRITE
Definition: nt_native.h:90
uint32_t ULONG
Definition: typedefs.h:59
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
unsigned char BYTE
Definition: xxhash.c:193

Referenced by test_MCIWndCreate().

◆ START_TEST()

START_TEST ( mciwnd  )

Definition at line 200 of file mciwnd.c.

201{
203}
static void test_MCIWndCreate(void)
Definition: mciwnd.c:156

◆ test_MCIWndCreate()

static void test_MCIWndCreate ( void  )
static

Definition at line 156 of file mciwnd.c.

157{
160 char fname[MAX_PATH];
161 char invalid_fname[] = "invalid.avi";
162 char error[200];
163 LRESULT ret;
164
165 create_avi_file(fname);
166
168 ok(window != NULL, "Failed to create an MCIWnd window without parent\n");
169
171 ok(!ret || broken(ret == ERROR_INVALID_HANDLE) /* w2003std, w2008s64 */,
172 "Unexpected error %ld\n", ret);
173
175
176 parent = CreateWindowExA(0, "static", "msvfw32 test",
177 WS_POPUP, 0, 0, 100, 100,
178 0, 0, 0, NULL);
179 ok(parent != NULL, "Failed to create a window\n");
181 ok(window != NULL, "Failed to create an MCIWnd window\n");
182
184 ok(!ret || broken(ret == ERROR_INVALID_HANDLE) /* w2003std, w2008s64 */,
185 "Unexpected error %ld\n", ret);
186
188
190 ok(window != NULL, "Failed to create an MCIWnd window\n");
191
193 todo_wine ok(ret == MCIERR_FILE_NOT_FOUND, "Unexpected error %ld\n", ret);
194
196
197 DeleteFileA(fname);
198}
#define broken(x)
Definition: atltest.h:178
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
HWND VFWAPIV MCIWndCreateA(HWND hwndParent, HINSTANCE hInstance, DWORD dwStyle, LPCSTR szFile)
Definition: mciwnd.c:126
r parent
Definition: btrfs.c:3010
#define error(str)
Definition: mkdosfs.c:1605
#define MCIERR_FILE_NOT_FOUND
Definition: mmsystem.h:585
static HINSTANCE hinst
Definition: edit.c:551
static IHTMLWindow2 * window
Definition: events.c:77
#define todo_wine
Definition: custom.c:89
static BOOL create_avi_file(char *fname)
Definition: mciwnd.c:112
#define WS_POPUP
Definition: pedump.c:616
#define MCIWNDM_GETERRORA
Definition: vfw.h:1964
#define MCIWNDF_NOERRORDLG
Definition: vfw.h:1807
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by START_TEST().

Variable Documentation

◆ avi_stream_header

const AVIStreamHeader avi_stream_header
static
Initial value:
=
{
0,
0,
0,
0,
0,
1,
0xf,
0,
2,
0x48,
0,
0,
{ 0, 0, 0, 0 }
}
#define streamtypeVIDEO
Definition: aviriff.h:92

Definition at line 58 of file mciwnd.c.

Referenced by create_avi_file().

◆ data

const DWORD data[]
static
Initial value:
=
{
mmioFOURCC('0', '0', 'd', 'b'), 0x48, 0x48000000, 0x08000800,
0x00100100, 0x00003e00, 0x08000000, 0x00200800,
0x00001600, 0x00000000, 0x00003a00, 0x22e306f9,
0xfc120000, 0x0a000022, 0x00000000, 0x00300000,
0x00c01200, 0x00000000, 0x02010000, 0x00000000,
mmioFOURCC('0', '0', 'd', 'b'), 0x48, 0x48000000, 0x08000800,
0x00100100, 0x00003e00, 0x08000000, 0x00200800,
0x00001600, 0x00000000, 0x00003a00, 0x22e306f9,
0xfc120000, 0x0a000022, 0x00000000, 0x00300000,
0x00c01200, 0x00000000, 0x02010000, 0x00000000,
mmioFOURCC('i', 'd', 'x', '1'), 0x20, mmioFOURCC('0', '0', 'd', 'b'), 0x10,
0x04, 0x48, mmioFOURCC('0', '0', 'd', 'b'), 0x10,
0x54, 0x48,
}
#define FOURCC_LIST
Definition: mmsystem.h:565
#define mmioFOURCC(c0, c1, c2, c3)
Definition: mmsystem.h:38
#define listtypeAVIMOVIE
Definition: vfw.h:898

Definition at line 94 of file mciwnd.c.

◆ file_header

const DWORD file_header[]
static
Initial value:
=
{
FOURCC_RIFF, 0x8c0 ,
FOURCC_LIST, 0xc0 ,
}
#define FOURCC_RIFF
Definition: mmsystem.h:564
struct _MainAVIHeader MainAVIHeader
#define listtypeAVIHEADER
Definition: vfw.h:890
#define ckidAVIMAINHDR
Definition: vfw.h:891
#define formtypeAVI
Definition: vfw.h:889

Definition at line 29 of file mciwnd.c.

Referenced by create_avi_file(), and create_bitmap().

◆ main_avi_header

const MainAVIHeader main_avi_header
static
Initial value:
=
{
0x0001046b,
0x00000000,
0x00000000,
0x00000810,
2,
0,
1,
0x48,
5,
5,
{ 0, 0, 0, 0 }
}

Definition at line 37 of file mciwnd.c.

Referenced by create_avi_file().

◆ padding

◆ stream_list

const DWORD stream_list[]
static
Initial value:
=
{
FOURCC_LIST, 0x74 ,
}
#define ckidSTREAMHEADER
Definition: aviriff.h:88
#define listtypeSTREAMHEADER
Definition: vfw.h:892

Definition at line 52 of file mciwnd.c.

Referenced by create_avi_file().

◆ video_stream_format

const DWORD video_stream_format[]
static
Initial value:
=
{
0x28 ,
0x28 ,
5 ,
5 ,
0x00180001 ,
mmioFOURCC('c', 'v', 'i', 'd'),
0x245a,
0, 0, 0, 0,
}
#define ckidSTREAMFORMAT
Definition: aviriff.h:125

Definition at line 76 of file mciwnd.c.

Referenced by create_avi_file().