Advertisement

07.01.2008 at 10:09PM PDT, ID: 23532512 | Points: 500
[x]
Attachment Details

Receiving an S_OK but an HRESULT_FROM_WIN32(ERROR_INVALID_HANDLE) from get_CurrentMediaStatus() but not from get_CurrentPhysicalMediaType()

Asked by bodmcn in Microsoft Visual C++.Net, Microsoft Visual C++

Tags: Microsoft, IMAPI2, v2.0

Getting further with the IMAPI2, but I am stumped by the following 'error' being returned.

When calling IDiscFormat2Data::get_CurrentMediaStatus() method, I am getting an S_OK result returned with the enum set to 0x6.  There is no entry for this, but there is an error with this code on the MSDN return values.  HRESULT_FROM_WIN32(ERROR_INVALID_HANDLE) is the error description.

However, using the same iDiscFormat2Data object, the get_CurrentPhysicalMediaType() is returning the correct value.

Given that no handle is passed into get_CurrentMediaStatus(), why is it reporting the error for one method of this object instance, but not another?

Any ideas would be very welcome.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
//  This call returns an error...
unsigned int getMediaStatus( char cDriveLetter )
{
    HRESULT  hResult;
    IMAPI_FORMAT2_DATA_MEDIA_STATE  mediaStatus = IMAPI_FORMAT2_DATA_MEDIA_STATE_UNKNOWN;
    int  iPos;
 
 
    //  Select the drive to get the status of
    for( iPos = 0; iPos < driveLetters.size(); iPos++ )
    {
        if ( driveLetters[ iPos ] == cDriveLetter )
        {
            hResult = discFormat2Data[ iPos ]->get_CurrentMediaStatus( &mediaStatus );
            break;
        }
    }
    
    return( mediaStatus );
}
 
 
//  This call does not return an error, but the correct value
unsigned int getMediaType( char cDriveLetter )
{
    HRESULT  hResult;
    IMAPI_MEDIA_PHYSICAL_TYPE  mediaType = IMAPI_MEDIA_TYPE_UNKNOWN;
    int  iPos;
 
 
    //  Select the drive to get the status of
    for( iPos = 0; iPos < driveLetters.size(); iPos++ )
    {
        if ( driveLetters[ iPos ] == cDriveLetter )
        {
            hResult = discFormat2Data[ iPos ]->get_CurrentPhysicalMediaType( &mediaType );
            break;
        }
    }
    
    return( mediaType );
}
 
Loading Advertisement...
 
[+][-]07.20.2008 at 08:11AM PDT, ID: 22046006

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.17.2008 at 08:21AM PDT, ID: 22247228

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]08.20.2008 at 02:22AM PDT, ID: 22267471

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.22.2008 at 05:24PM PDT, ID: 22295133

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628