mcicda: Opens d, d:, d:\, d:\foo since w2k. Only d: is portable.
This commit is contained in:
parent
127af150e0
commit
5bff616faa
|
@ -428,23 +428,23 @@ static DWORD MCICDA_Open(UINT wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSW lpOpenPar
|
||||||
if (dwFlags & MCI_OPEN_ELEMENT) {
|
if (dwFlags & MCI_OPEN_ELEMENT) {
|
||||||
if (dwFlags & MCI_OPEN_ELEMENT_ID) {
|
if (dwFlags & MCI_OPEN_ELEMENT_ID) {
|
||||||
WARN("MCI_OPEN_ELEMENT_ID %p! Abort\n", lpOpenParms->lpstrElementName);
|
WARN("MCI_OPEN_ELEMENT_ID %p! Abort\n", lpOpenParms->lpstrElementName);
|
||||||
ret = MCIERR_NO_ELEMENT_ALLOWED;
|
ret = MCIERR_FLAGS_NOT_COMPATIBLE;
|
||||||
goto the_error;
|
goto the_error;
|
||||||
}
|
}
|
||||||
TRACE("MCI_OPEN_ELEMENT element name: %s\n", debugstr_w(lpOpenParms->lpstrElementName));
|
TRACE("MCI_OPEN_ELEMENT element name: %s\n", debugstr_w(lpOpenParms->lpstrElementName));
|
||||||
if (!isalpha(lpOpenParms->lpstrElementName[0]) || lpOpenParms->lpstrElementName[1] != ':' ||
|
/* Only the first letter counts since w2k
|
||||||
(lpOpenParms->lpstrElementName[2] && lpOpenParms->lpstrElementName[2] != '\\'))
|
* Win9x-NT accept only d: and w98SE accepts d:\foobar as well.
|
||||||
|
* Play d:\Track03.cda plays from the first track, not #3. */
|
||||||
|
if (!isalpha(lpOpenParms->lpstrElementName[0]))
|
||||||
{
|
{
|
||||||
WARN("MCI_OPEN_ELEMENT unsupported format: %s\n",
|
ret = MCIERR_INVALID_FILE;
|
||||||
debugstr_w(lpOpenParms->lpstrElementName));
|
|
||||||
ret = MCIERR_NO_ELEMENT_ALLOWED;
|
|
||||||
goto the_error;
|
goto the_error;
|
||||||
}
|
}
|
||||||
drive = toupper(lpOpenParms->lpstrElementName[0]);
|
drive = toupper(lpOpenParms->lpstrElementName[0]);
|
||||||
root[0] = drive; root[1] = ':'; root[2] = '\\'; root[3] = '\0';
|
root[0] = drive; root[1] = ':'; root[2] = '\\'; root[3] = '\0';
|
||||||
if (GetDriveTypeW(root) != DRIVE_CDROM)
|
if (GetDriveTypeW(root) != DRIVE_CDROM)
|
||||||
{
|
{
|
||||||
ret = MCIERR_INVALID_DEVICE_NAME;
|
ret = MCIERR_INVALID_FILE;
|
||||||
goto the_error;
|
goto the_error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
typedef union {
|
typedef union {
|
||||||
MCI_STATUS_PARMS status;
|
MCI_STATUS_PARMS status;
|
||||||
MCI_GETDEVCAPS_PARMS caps;
|
MCI_GETDEVCAPS_PARMS caps;
|
||||||
|
MCI_OPEN_PARMS open;
|
||||||
MCI_PLAY_PARMS play;
|
MCI_PLAY_PARMS play;
|
||||||
MCI_SEEK_PARMS seek;
|
MCI_SEEK_PARMS seek;
|
||||||
MCI_SAVE_PARMS save;
|
MCI_SAVE_PARMS save;
|
||||||
|
@ -151,8 +152,6 @@ static DWORD MSF_Add(DWORD d1, DWORD d2)
|
||||||
return MCI_MAKE_MSF(m,s,f);
|
return MCI_MAKE_MSF(m,s,f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO test_open "open X: type cdaudio" etc. */
|
|
||||||
/* TODO demonstrate open X:\ fails on win95 while open X: works. */
|
|
||||||
/* TODO show that shareable flag is not what Wine implements. */
|
/* TODO show that shareable flag is not what Wine implements. */
|
||||||
|
|
||||||
static void test_play(HWND hwnd)
|
static void test_play(HWND hwnd)
|
||||||
|
@ -607,6 +606,46 @@ static void test_play(HWND hwnd)
|
||||||
test_notification(hwnd, "STOP final", 0);
|
test_notification(hwnd, "STOP final", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_openclose(HWND hwnd)
|
||||||
|
{
|
||||||
|
MCIDEVICEID wDeviceID;
|
||||||
|
MCI_PARMS_UNION parm;
|
||||||
|
MCIERROR err;
|
||||||
|
char drive[] = {'a',':','\\','X','\0'};
|
||||||
|
|
||||||
|
/* Bug in native since NT: After OPEN "c" without MCI_OPEN_ALIAS fails with
|
||||||
|
* MCIERR_DEVICE_OPEN, any subsequent OPEN fails with EXTENSION_NOT_FOUND! */
|
||||||
|
parm.open.lpstrAlias = "x"; /* with alias, OPEN "c" behaves normally */
|
||||||
|
parm.open.lpstrDeviceType = (LPCSTR)MCI_DEVTYPE_CD_AUDIO;
|
||||||
|
parm.open.lpstrElementName = drive;
|
||||||
|
for ( ; strlen(drive); drive[strlen(drive)-1] = 0)
|
||||||
|
for (drive[0] = 'a'; drive[0] <= 'z'; drive[0]++) {
|
||||||
|
err = mciSendCommand(0, MCI_OPEN, MCI_OPEN_ELEMENT | MCI_OPEN_TYPE|MCI_OPEN_TYPE_ID
|
||||||
|
| MCI_OPEN_SHAREABLE | MCI_OPEN_ALIAS, (DWORD_PTR)&parm);
|
||||||
|
ok(!err || err == MCIERR_INVALID_FILE, "OPEN %s type: %s\n", drive, dbg_mcierr(err));
|
||||||
|
/* open X:\ fails in Win9x/NT. Only open X: works everywhere. */
|
||||||
|
if(!err) {
|
||||||
|
wDeviceID = parm.open.wDeviceID;
|
||||||
|
trace("ok with %s\n", drive);
|
||||||
|
err = mciSendCommand(wDeviceID, MCI_CLOSE, 0, 0);
|
||||||
|
ok(!err,"mciCommand close returned %s\n", dbg_mcierr(err));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
drive[0] = '\\';
|
||||||
|
err = mciSendCommand(0, MCI_OPEN, MCI_OPEN_ELEMENT|MCI_OPEN_TYPE|MCI_OPEN_TYPE_ID
|
||||||
|
| MCI_OPEN_SHAREABLE, (DWORD_PTR)&parm);
|
||||||
|
ok(err == MCIERR_INVALID_FILE, "OPEN %s type: %s\n", drive, dbg_mcierr(err));
|
||||||
|
if(!err) mciSendCommand(parm.open.wDeviceID, MCI_CLOSE, 0, 0);
|
||||||
|
|
||||||
|
if (0) {
|
||||||
|
parm.open.lpstrElementName = (LPCSTR)0xDEADBEEF;
|
||||||
|
err = mciSendCommand(0, MCI_OPEN, MCI_OPEN_ELEMENT|MCI_OPEN_ELEMENT_ID
|
||||||
|
| MCI_OPEN_TYPE|MCI_OPEN_TYPE_ID | MCI_OPEN_SHAREABLE, (DWORD_PTR)&parm);
|
||||||
|
todo_wine ok(err == MCIERR_FLAGS_NOT_COMPATIBLE, "OPEN elt_ID: %s\n", dbg_mcierr(err));
|
||||||
|
if(!err) mciSendCommand(parm.open.wDeviceID, MCI_CLOSE, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(mcicda)
|
START_TEST(mcicda)
|
||||||
{
|
{
|
||||||
MCIERROR err;
|
MCIERROR err;
|
||||||
|
@ -615,6 +654,7 @@ START_TEST(mcicda)
|
||||||
0, 0, 0, NULL);
|
0, 0, 0, NULL);
|
||||||
test_notification(hwnd, "-prior to tests-", 0);
|
test_notification(hwnd, "-prior to tests-", 0);
|
||||||
test_play(hwnd);
|
test_play(hwnd);
|
||||||
|
test_openclose(hwnd);
|
||||||
err = mciSendCommand(MCI_ALL_DEVICE_ID, MCI_STOP, 0, 0);
|
err = mciSendCommand(MCI_ALL_DEVICE_ID, MCI_STOP, 0, 0);
|
||||||
todo_wine ok(!err || broken(err == MCIERR_HARDWARE /* blank CD or testbot without CD-ROM */),
|
todo_wine ok(!err || broken(err == MCIERR_HARDWARE /* blank CD or testbot without CD-ROM */),
|
||||||
"STOP all returned %s\n", dbg_mcierr(err));
|
"STOP all returned %s\n", dbg_mcierr(err));
|
||||||
|
|
Loading…
Reference in New Issue