Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
f3b7cadf
Commit
f3b7cadf
authored
Jul 21, 2004
by
Robert Reif
Committed by
Alexandre Julliard
Jul 21, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds *GetDevCapsW bad pointer check.
Adds waveOutGetDevCapsW test.
parent
e3e6704d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
33 deletions
+68
-33
wave.c
dlls/winmm/tests/wave.c
+44
-27
winmm.c
dlls/winmm/winmm.c
+24
-6
No files found.
dlls/winmm/tests/wave.c
View file @
f3b7cadf
...
...
@@ -379,13 +379,14 @@ static void wave_out_test_deviceOut(int device, double duration, LPWAVEFORMATEX
static
void
wave_out_test_device
(
int
device
)
{
WAVEOUTCAPS
caps
;
WAVEOUTCAPSA
capsA
;
WAVEOUTCAPSW
capsW
;
WAVEFORMATEX
format
,
oformat
;
HWAVEOUT
wout
;
MMRESULT
rc
;
UINT
f
;
WCHAR
*
wname
;
CHAR
*
name
;
WCHAR
*
nameW
;
CHAR
*
name
A
;
DWORD
size
;
DWORD
dwPageSize
;
BYTE
*
twoPages
;
...
...
@@ -396,51 +397,67 @@ static void wave_out_test_device(int device)
GetSystemInfo
(
&
sSysInfo
);
dwPageSize
=
sSysInfo
.
dwPageSize
;
rc
=
waveOutGetDevCapsA
(
device
,
&
caps
,
sizeof
(
caps
));
rc
=
waveOutGetDevCapsA
(
device
,
&
caps
A
,
sizeof
(
capsA
));
ok
(
rc
==
MMSYSERR_NOERROR
||
rc
==
MMSYSERR_BADDEVICEID
||
rc
==
MMSYSERR_NODRIVER
,
"waveOutGetDevCapsA: failed to get capabilities of device %s: rc=%s
\n
"
,
dev_name
(
device
),
wave_out_error
(
rc
));
if
(
rc
==
MMSYSERR_BADDEVICEID
||
rc
==
MMSYSERR_NODRIVER
)
return
;
rc
=
waveOutGetDevCapsA
(
device
,
0
,
sizeof
(
caps
));
rc
=
waveOutGetDevCapsW
(
device
,
&
capsW
,
sizeof
(
capsW
));
ok
(
rc
==
MMSYSERR_NOERROR
,
"waveOutGetDevCapsW: failed to get capabilities of device %s: rc=%s
\n
"
,
dev_name
(
device
),
wave_out_error
(
rc
));
rc
=
waveOutGetDevCapsA
(
device
,
0
,
sizeof
(
capsA
));
ok
(
rc
==
MMSYSERR_INVALPARAM
,
"waveOutGetDevCapsA: MMSYSERR_INVALPARAM expected, got %s
\n
"
,
wave_out_error
(
rc
));
rc
=
waveOutGetDevCapsW
(
device
,
0
,
sizeof
(
capsW
));
ok
(
rc
==
MMSYSERR_INVALPARAM
,
"waveOutGetDevCapsA: MMSYSERR_INVALPARAM expected, got %s
\n
"
,
wave_out_error
(
rc
));
#if 0 /* FIXME: this works on windows but crashes wine */
rc=waveOutGetDevCapsA(device,(LPWAVEOUTCAPS
)1,sizeof(caps
));
rc=waveOutGetDevCapsA(device,(LPWAVEOUTCAPS
A)1,sizeof(capsA
));
ok(rc==MMSYSERR_INVALPARAM,
"waveOutGetDevCapsA: MMSYSERR_INVALPARAM expected, got %s\n",wave_out_error(rc));
rc=waveOutGetDevCapsW(device,(LPWAVEOUTCAPSW)1,sizeof(capsW));
ok(rc==MMSYSERR_INVALPARAM,
"waveOutGetDevCapsW: MMSYSERR_INVALPARAM expected, got %s\n",wave_out_error(rc));
#endif
rc
=
waveOutGetDevCapsA
(
device
,
&
caps
,
4
);
rc
=
waveOutGetDevCapsA
(
device
,
&
caps
A
,
4
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"waveOutGetDevCapsA: MMSYSERR_NOERROR expected, got %s
\n
"
,
wave_out_error
(
rc
));
name
=
NULL
;
rc
=
waveOutGetDevCapsW
(
device
,
&
capsW
,
4
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"waveOutGetDevCapsW: MMSYSERR_NOERROR expected, got %s
\n
"
,
wave_out_error
(
rc
));
nameA
=
NULL
;
rc
=
waveOutMessage
((
HWAVEOUT
)
device
,
DRV_QUERYDEVICEINTERFACESIZE
,
(
DWORD_PTR
)
&
size
,
0
);
ok
(
rc
==
MMSYSERR_NOERROR
||
rc
==
MMSYSERR_INVALPARAM
||
rc
==
MMSYSERR_NOTSUPPORTED
,
"waveOutMessage: failed to get interface size for device: %s rc=%s
\n
"
,
dev_name
(
device
),
wave_out_error
(
rc
));
if
(
rc
==
MMSYSERR_NOERROR
)
{
wname
=
(
WCHAR
*
)
malloc
(
size
);
rc
=
waveOutMessage
((
HWAVEOUT
)
device
,
DRV_QUERYDEVICEINTERFACE
,
(
DWORD_PTR
)
wname
,
size
);
nameW
=
(
WCHAR
*
)
malloc
(
size
);
rc
=
waveOutMessage
((
HWAVEOUT
)
device
,
DRV_QUERYDEVICEINTERFACE
,
(
DWORD_PTR
)
nameW
,
size
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"waveOutMessage: failed to get interface name for device: %s rc=%s
\n
"
,
dev_name
(
device
),
wave_out_error
(
rc
));
ok
(
lstrlenW
(
wname
)
+
1
==
size
/
sizeof
(
WCHAR
),
"got an incorrect size: %ld instead of %d
\n
"
,
size
,(
lstrlenW
(
wname
)
+
1
)
*
sizeof
(
WCHAR
));
ok
(
lstrlenW
(
nameW
)
+
1
==
size
/
sizeof
(
WCHAR
),
"got an incorrect size: %ld instead of %d
\n
"
,
size
,(
lstrlenW
(
nameW
)
+
1
)
*
sizeof
(
WCHAR
));
if
(
rc
==
MMSYSERR_NOERROR
)
{
name
=
malloc
(
size
/
sizeof
(
WCHAR
));
WideCharToMultiByte
(
CP_ACP
,
0
,
wname
,
size
/
sizeof
(
WCHAR
),
name
,
size
/
sizeof
(
WCHAR
),
NULL
,
NULL
);
name
A
=
malloc
(
size
/
sizeof
(
WCHAR
));
WideCharToMultiByte
(
CP_ACP
,
0
,
nameW
,
size
/
sizeof
(
WCHAR
),
nameA
,
size
/
sizeof
(
WCHAR
),
NULL
,
NULL
);
}
free
(
wname
);
free
(
nameW
);
}
else
if
(
rc
==
MMSYSERR_NOTSUPPORTED
)
{
name
=
strdup
(
"not supported"
);
name
A
=
strdup
(
"not supported"
);
}
trace
(
" %s:
\"
%s
\"
(%s) %d.%d (%d:%d): channels=%d formats=%05lx support=%04lx(%s)
\n
"
,
dev_name
(
device
),
caps
.
szPname
,(
name
?
name
:
"failed"
),
caps
.
vDriverVersion
>>
8
,
caps
.
vDriverVersion
&
0xff
,
caps
.
wMid
,
caps
.
wPid
,
caps
.
wChannels
,
caps
.
dwFormats
,
caps
.
dwSupport
,
wave_out_caps
(
caps
.
dwSupport
));
free
(
name
);
dev_name
(
device
),
caps
A
.
szPname
,(
nameA
?
nameA
:
"failed"
),
capsA
.
vDriverVersion
>>
8
,
caps
A
.
vDriverVersion
&
0xff
,
caps
A
.
wMid
,
capsA
.
wPid
,
caps
A
.
wChannels
,
capsA
.
dwFormats
,
capsA
.
dwSupport
,
wave_out_caps
(
capsA
.
dwSupport
));
free
(
name
A
);
if
(
winetest_interactive
&&
(
device
!=
WAVE_MAPPER
))
{
...
...
@@ -454,7 +471,7 @@ static void wave_out_test_device(int device)
format
.
nBlockAlign
=
format
.
nChannels
*
format
.
wBitsPerSample
/
8
;
format
.
nAvgBytesPerSec
=
format
.
nSamplesPerSec
*
format
.
nBlockAlign
;
format
.
cbSize
=
0
;
wave_out_test_deviceOut
(
device
,
5
.
0
,
&
format
,
WAVE_FORMAT_2M08
,
0
,
&
caps
);
wave_out_test_deviceOut
(
device
,
5
.
0
,
&
format
,
WAVE_FORMAT_2M08
,
0
,
&
caps
A
);
}
for
(
f
=
0
;
f
<
NB_WIN_FORMATS
;
f
++
)
{
...
...
@@ -465,10 +482,10 @@ static void wave_out_test_device(int device)
format
.
nBlockAlign
=
format
.
nChannels
*
format
.
wBitsPerSample
/
8
;
format
.
nAvgBytesPerSec
=
format
.
nSamplesPerSec
*
format
.
nBlockAlign
;
format
.
cbSize
=
0
;
wave_out_test_deviceOut
(
device
,
1
.
0
,
&
format
,
win_formats
[
f
][
0
],
0
,
&
caps
);
wave_out_test_deviceOut
(
device
,
1
.
0
,
&
format
,
win_formats
[
f
][
0
],
WAVE_FORMAT_DIRECT
,
&
caps
);
wave_out_test_deviceOut
(
device
,
1
.
0
,
&
format
,
win_formats
[
f
][
0
],
0
,
&
caps
A
);
wave_out_test_deviceOut
(
device
,
1
.
0
,
&
format
,
win_formats
[
f
][
0
],
WAVE_FORMAT_DIRECT
,
&
caps
A
);
if
(
device
!=
WAVE_MAPPER
)
wave_out_test_deviceOut
(
device
,
1
.
0
,
&
format
,
win_formats
[
f
][
0
],
WAVE_MAPPED
,
&
caps
);
wave_out_test_deviceOut
(
device
,
1
.
0
,
&
format
,
win_formats
[
f
][
0
],
WAVE_MAPPED
,
&
caps
A
);
}
/* Try a PCMWAVEFORMAT aligned next to an unaccessable page for bounds checking */
...
...
@@ -485,10 +502,10 @@ static void wave_out_test_device(int device)
pwfx
->
nSamplesPerSec
=
22050
;
pwfx
->
nBlockAlign
=
pwfx
->
nChannels
*
pwfx
->
wBitsPerSample
/
8
;
pwfx
->
nAvgBytesPerSec
=
pwfx
->
nSamplesPerSec
*
pwfx
->
nBlockAlign
;
wave_out_test_deviceOut
(
device
,
1
.
0
,
pwfx
,
WAVE_FORMAT_2M08
,
0
,
&
caps
);
wave_out_test_deviceOut
(
device
,
1
.
0
,
pwfx
,
WAVE_FORMAT_2M08
,
WAVE_FORMAT_DIRECT
,
&
caps
);
wave_out_test_deviceOut
(
device
,
1
.
0
,
pwfx
,
WAVE_FORMAT_2M08
,
0
,
&
caps
A
);
wave_out_test_deviceOut
(
device
,
1
.
0
,
pwfx
,
WAVE_FORMAT_2M08
,
WAVE_FORMAT_DIRECT
,
&
caps
A
);
if
(
device
!=
WAVE_MAPPER
)
wave_out_test_deviceOut
(
device
,
1
.
0
,
pwfx
,
WAVE_FORMAT_2M08
,
WAVE_MAPPED
,
&
caps
);
wave_out_test_deviceOut
(
device
,
1
.
0
,
pwfx
,
WAVE_FORMAT_2M08
,
WAVE_MAPPED
,
&
caps
A
);
}
VirtualFree
(
twoPages
,
2
*
dwPageSize
,
MEM_RELEASE
);
}
...
...
dlls/winmm/winmm.c
View file @
f3b7cadf
...
...
@@ -281,8 +281,11 @@ UINT WINAPI mixerGetDevCapsA(UINT_PTR uDeviceID, LPMIXERCAPSA lpCaps, UINT uSize
UINT
WINAPI
mixerGetDevCapsW
(
UINT_PTR
uDeviceID
,
LPMIXERCAPSW
lpCaps
,
UINT
uSize
)
{
MIXERCAPSA
micA
;
UINT
ret
=
mixerGetDevCapsA
(
uDeviceID
,
&
micA
,
sizeof
(
micA
));
UINT
ret
;
if
(
lpCaps
==
NULL
)
return
MMSYSERR_INVALPARAM
;
ret
=
mixerGetDevCapsA
(
uDeviceID
,
&
micA
,
sizeof
(
micA
));
if
(
ret
==
MMSYSERR_NOERROR
)
{
MIXERCAPSW
micW
;
micW
.
wMid
=
micA
.
wMid
;
...
...
@@ -662,8 +665,11 @@ UINT WINAPI auxGetNumDevs(void)
UINT
WINAPI
auxGetDevCapsW
(
UINT_PTR
uDeviceID
,
LPAUXCAPSW
lpCaps
,
UINT
uSize
)
{
AUXCAPSA
acA
;
UINT
ret
=
auxGetDevCapsA
(
uDeviceID
,
&
acA
,
sizeof
(
acA
))
;
UINT
ret
;
if
(
lpCaps
==
NULL
)
return
MMSYSERR_INVALPARAM
;
ret
=
auxGetDevCapsA
(
uDeviceID
,
&
acA
,
sizeof
(
acA
));
if
(
ret
==
MMSYSERR_NOERROR
)
{
AUXCAPSW
acW
;
acW
.
wMid
=
acA
.
wMid
;
...
...
@@ -1214,8 +1220,11 @@ UINT WINAPI midiOutGetDevCapsW(UINT_PTR uDeviceID, LPMIDIOUTCAPSW lpCaps,
UINT
uSize
)
{
MIDIOUTCAPSA
mocA
;
UINT
ret
=
midiOutGetDevCapsA
(
uDeviceID
,
&
mocA
,
sizeof
(
mocA
));
UINT
ret
;
if
(
lpCaps
==
NULL
)
return
MMSYSERR_INVALPARAM
;
ret
=
midiOutGetDevCapsA
(
uDeviceID
,
&
mocA
,
sizeof
(
mocA
));
if
(
ret
==
MMSYSERR_NOERROR
)
{
MIDIOUTCAPSW
mocW
;
mocW
.
wMid
=
mocA
.
wMid
;
...
...
@@ -1591,8 +1600,11 @@ UINT WINAPI midiInGetNumDevs(void)
UINT
WINAPI
midiInGetDevCapsW
(
UINT_PTR
uDeviceID
,
LPMIDIINCAPSW
lpCaps
,
UINT
uSize
)
{
MIDIINCAPSA
micA
;
UINT
ret
=
midiInGetDevCapsA
(
uDeviceID
,
&
micA
,
sizeof
(
micA
));
UINT
ret
;
if
(
lpCaps
==
NULL
)
return
MMSYSERR_INVALPARAM
;
ret
=
midiInGetDevCapsA
(
uDeviceID
,
&
micA
,
sizeof
(
micA
));
if
(
ret
==
MMSYSERR_NOERROR
)
{
MIDIINCAPSW
micW
;
micW
.
wMid
=
micA
.
wMid
;
...
...
@@ -2556,8 +2568,11 @@ UINT WINAPI waveOutGetDevCapsW(UINT_PTR uDeviceID, LPWAVEOUTCAPSW lpCaps,
UINT
uSize
)
{
WAVEOUTCAPSA
wocA
;
UINT
ret
=
waveOutGetDevCapsA
(
uDeviceID
,
&
wocA
,
sizeof
(
wocA
));
UINT
ret
;
if
(
lpCaps
==
NULL
)
return
MMSYSERR_INVALPARAM
;
ret
=
waveOutGetDevCapsA
(
uDeviceID
,
&
wocA
,
sizeof
(
wocA
));
if
(
ret
==
MMSYSERR_NOERROR
)
{
WAVEOUTCAPSW
wocW
;
wocW
.
wMid
=
wocA
.
wMid
;
...
...
@@ -2948,8 +2963,11 @@ UINT WINAPI waveInGetNumDevs(void)
UINT
WINAPI
waveInGetDevCapsW
(
UINT_PTR
uDeviceID
,
LPWAVEINCAPSW
lpCaps
,
UINT
uSize
)
{
WAVEINCAPSA
wicA
;
UINT
ret
=
waveInGetDevCapsA
(
uDeviceID
,
&
wicA
,
sizeof
(
wicA
));
UINT
ret
;
if
(
lpCaps
==
NULL
)
return
MMSYSERR_INVALPARAM
;
ret
=
waveInGetDevCapsA
(
uDeviceID
,
&
wicA
,
sizeof
(
wicA
));
if
(
ret
==
MMSYSERR_NOERROR
)
{
WAVEINCAPSW
wicW
;
wicW
.
wMid
=
wicA
.
wMid
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment