From: absolute on
When I query the length of a large .wav file( larger than 2G,about 46
hours), mciSendCommand return the wrong value.
My code is as below:

MCI_SET_PARMS mciSetParms;
mciSetParms.dwTimeFormat = MCI_FORMAT_SAMPLES;
if(m_ErrorCode = mciSendCommand(m_wDeviceID,MCI_SET,MCI_WAIT|
MCI_SET_TIME_FORMAT,
(DWORD)(LPVOID) &mciSetParms))
{
return false;
}
MCI_STATUS_PARMS mciStatusParms;
mciStatusParms.dwItem = MCI_STATUS_LENGTH;

if(m_ErrorCode = mciSendCommand(m_wDeviceID,
MCI_STATUS,MCI_STATUS_ITEM,
(DWORD)(LPVOID) &mciStatusParms))
{
return false;
}

I suppose the return value of mciStatusParms.dwReturn should be
1231253424, but actually,it returned 3378737072.
However, when the file is smaller than 2G, there is no problem.
So, I think maybe it is a bug .
Can anybody tell me is there a bug in mciSendCommand ?
Thank you very much.
From: David Lowndes on
>I suppose the return value of mciStatusParms.dwReturn should be
>1231253424, but actually,it returned 3378737072.

I know nothing about the mci APIs but if you convert those values to
hex you can probably see what's happened. It looks like something has
sign extended a value inappropriately?

Dave
From: absolute on

> I know nothing about the mci APIs but if you convert those values to
> hex you can probably see what's happened. It looks like something has
> sign extended a value inappropriately?
>
> Dave

Yes, I see. The two results are just different between the sign bit.

But the result is returned by the mciSendCommand API function. I debug
and find the problem.
So I think it is a bug. But I am not so sure.

PS: Again, I did a experiment using a 1.8G file and a 2.2G file. The
result returned by 1.8G file is correct, but result of 2.2G file is
wrong.
From: David Lowndes on
>Yes, I see. The two results are just different between the sign bit.

Yes.

>PS: Again, I did a experiment using a 1.8G file and a 2.2G file. The
>result returned by 1.8G file is correct, but result of 2.2G file is
>wrong.

Assuming 1024 units...

2G = 2,147,483,648 = 0x80000000

What are the absolute file sizes and the figures you get?

Dave
From: Alexander Grigoriev on
MCI API and codes were designed in the era of 200 MB discs. I suspect it was
never tested with large files, thus it has all kinds of integer overflow
bugs.

"absolute" <cool8511(a)gmail.com> wrote in message
news:9eb70c3b-0a11-4bc1-87ff-c54df4910915(a)34g2000yqp.googlegroups.com...
> When I query the length of a large .wav file( larger than 2G,about 46
> hours), mciSendCommand return the wrong value.
> My code is as below:
>
> MCI_SET_PARMS mciSetParms;
> mciSetParms.dwTimeFormat = MCI_FORMAT_SAMPLES;
> if(m_ErrorCode = mciSendCommand(m_wDeviceID,MCI_SET,MCI_WAIT|
> MCI_SET_TIME_FORMAT,
> (DWORD)(LPVOID) &mciSetParms))
> {
> return false;
> }
> MCI_STATUS_PARMS mciStatusParms;
> mciStatusParms.dwItem = MCI_STATUS_LENGTH;
>
> if(m_ErrorCode = mciSendCommand(m_wDeviceID,
> MCI_STATUS,MCI_STATUS_ITEM,
> (DWORD)(LPVOID) &mciStatusParms))
> {
> return false;
> }
>
> I suppose the return value of mciStatusParms.dwReturn should be
> 1231253424, but actually,it returned 3378737072.
> However, when the file is smaller than 2G, there is no problem.
> So, I think maybe it is a bug .
> Can anybody tell me is there a bug in mciSendCommand ?
> Thank you very much.