Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Error: No such interface supported ??


This question is answered. Helpful answers available: 1. Correct answers available: 1.


Permlink Replies: 9 - Last Post: Nov 15, 2016 11:05 AM Last Post By: Asger Joergensen Threads: [ Previous | Next ]
Asger Joergensen

Posts: 370
Registered: 11/18/08
Error: No such interface supported ??  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 13, 2016 5:39 PM
Hi

I'm trying to use Windows Portable Device API and I get this error that I don't understand.

I get HRESULT 0x80004002 E_NOINTERFACE No such interface supported.

when running this code:
   IPortableDevice* PortableDevice;
 
   hr = CoCreateInstance(CLSID_PortableDevice, NULL, 
                                         CLSCTX_INPROC_SERVER,
                                         IID_IPortableDevice, (void**)&PortableDevice );


this is the IID:
static const IID IID_IPortableDevice = { 0x728a21c5, 0x3d9e, 0x48d7, {0x98, 0x10, 0x86, 0x48, 0x48, 0xf0, 0xf4, 0x04}};

and it matches the CLSID_PortableDevice in the h file.

Earlier in the function I do a CoCreateInstance(CLSID_PortableDeviceManager .. and that goes without error.

p.s. I have also tried to use the CLSID_PortableDeviceFTM version having this ID:
static const GUID CLSID_PortableDeviceFTM = { 0xf7c0039a, 0x4762, 0x488a, {0xb4, 0xb3, 0x76, 0x0e, 0xf9, 0xa1, 0xba, 0x9b}};


What am I missing ??

Thanks in advance
Best regards
Asger
Asger Joergensen

Posts: 370
Registered: 11/18/08
Re: Error: No such interface supported ??  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 14, 2016 2:24 AM   in response to: Asger Joergensen in response to: Asger Joergensen
Asger Joergensen wrote:
static const IID IID_IPortableDevice = { 0x728a21c5, 0x3d9e, 0x48d7, {0x98, 0x10, 0x86, 0x48, 0x48, 0xf0, 0xf4, 0x04}};

This line seem to be overkill, at least when I removed it, the old lady became much more cooperative.

Best regards
Asger
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Error: No such interface supported ??
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 14, 2016 10:56 AM   in response to: Asger Joergensen in response to: Asger Joergensen
Asger wrote:

I get HRESULT 0x80004002 E_NOINTERFACE No such interface supported.

That means the requested class object does not support the requested IID.

this is the IID:

static const IID IID_IPortableDevice = { 0x728a21c5, 0x3d9e, 0x48d7,
{0x98, 0x10, 0x86, 0x48, 0x48, 0xf0, 0xf4, 0x04}};


and it matches the CLSID_PortableDevice in the h file.

And that is where your mistake is. An IID is not a CLSID! They are different
values for different purposes. The above guid is the CLSID_PortableDevice
guid. The correct IID_IPortableDevice guid is {625e2df8-6392-4cf0-9ad1-3cfa5f17775c}
instead:

static const IID IID_IPortableDevice = { 0x625e2df8, 0x6392, 0x4cf0, {0x9a, 
0xd1, 0x3c, 0xfa, 0x5f, 0x17, 0x77, 0x5c}};


Rather than declaring the guids manually, you should be using the declarations
in portabledeviceapi.h instead (unless you are using a VERY old version of
C++Builder that does not have that header - it was added in CB2007).

p.s. I have also tried to use the CLSID_PortableDeviceFTM version
having this ID:

static const GUID CLSID_PortableDeviceFTM = { 0xf7c0039a, 0x4762,
0x488a, {0xb4, 0xb3, 0x76, 0x0e, 0xf9, 0xa1, 0xba, 0x9b}};

That is the correct guid for CLSID_PortableDeviceFTM. But you still need
to use the correct guid for IID_IPortableDevice.

--
Remy Lebeau (TeamB)
Asger Joergensen

Posts: 370
Registered: 11/18/08
Re: Error: No such interface supported ??  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 14, 2016 4:14 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:

Rather than declaring the guids manually, you should be using the declarations
in portabledeviceapi.h instead (unless you are using a VERY old version of
C++Builder that does not have that header - it was added in CB2007).

I usually don't if I don't have to and in this case I did to much.
Most of the time my problems are with unresolved externals and from your reply
in the other post I thought that the IID and the CLSID all had the same values.

Yes, the guid used in __declspec(uuid) on the IPortableDeviceServiceManager
interface is the same guid used for IID_IPortableDeviceServiceManager. That
is the key that lets the __uuidof() trick work at all.

My mistake.:-)

Like now I have this error:
[ILINK32 Error] Error: Unresolved external '_WPD_OBJECT_NAME'

and I tried to fix it with this in the cpp file:
static const PROPERTYKEY WPD_OBJECT_NAME = { 0xEF6B490D, 0x5CD8, 0x437A, {0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C }};


And yes it does make the error go away, but it doesn't make my program work though,
no problem calling: KeyCollection->Add( WPD_OBJECT_NAME );

but I just get S_FALSE result on my call to Properties->GetValues(...

and an 0x80070490 ERROR_NOT_FOUND when calling:
Values->GetStringValue( WPD_OBJECT_NAME, &strValue );

and yes the first sort of guarentie the latter.

Is there a way to fix such an error in my old CB2009. ??

Thank you very much for helping
Best regards
Asger
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Error: No such interface supported ??  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 14, 2016 4:34 PM   in response to: Asger Joergensen in response to: Asger Joergensen
Asger wrote:

Most of the time my problems are with unresolved externals

That has nothing to do with the compiler. That is a linker error.

from your reply in the other post I thought that the IID and the
CLSID all had the same values.

I never said or implied that.

Like now I have this error:

[ILINK32 Error] Error: Unresolved external '_WPD_OBJECT_NAME'

Add PortableDeviceGUIDs.lib to your project.

and I tried to fix it with this in the cpp file:

 
static const PROPERTYKEY WPD_OBJECT_NAME = { 0xEF6B490D, 0x5CD8,
0x437A, {0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C }};
 

That will also work.

And yes it does make the error go away, but it doesn't make my program
work though, no problem calling: KeyCollection->Add( WPD_OBJECT_NAME
);

but I just get S_FALSE result on my call to
Properties->GetValues(...

and an 0x80070490 ERROR_NOT_FOUND when calling:
Values->GetStringValue( WPD_OBJECT_NAME, &strValue );

I can't answer that without seeing a more complete code snippet showing exactly
how, and in what context, you are using those methods.

--
Remy Lebeau (TeamB)
Asger Joergensen

Posts: 370
Registered: 11/18/08
Re: Error: No such interface supported ??  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 14, 2016 5:19 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Hi Remy

Remy Lebeau (TeamB) wrote:
Asger wrote:

from your reply in the other post I thought that the IID and the
CLSID all had the same values.

I never said or implied that.

No, and I never said that you did ;-)

Add PortableDeviceGUIDs.lib to your project.

Unfortunately that is not part of CB2009

and I tried to fix it with this in the cpp file:

 
static const PROPERTYKEY WPD_OBJECT_NAME = { 0xEF6B490D, 0x5CD8,
0x437A, {0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C }};
 

That will also work.

maybe, but I just noticed that there are some strange things going on with those properties,
in groups they are all the same e.g.:
DEFINE_PROPERTYKEY( WPD_OBJECT_ID , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 2 );
DEFINE_PROPERTYKEY( WPD_OBJECT_PARENT_ID , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 3 );
DEFINE_PROPERTYKEY( WPD_OBJECT_NAME , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 4 );

except for that extra digit at the end, which I'm not allowed to add in the cpp file

Here is the code I'm trying to make work its a function that should get the readable names
of the files on a mobile phone: (code is more or less as found on the web)
HRESULT PrintProperties( IPortableDeviceProperties* pProperties, LPCWSTR pwszObjectID, String tab)
{
    HRESULT hr;
 
    // Specify the properties we are interested in spPropertyKeys
    ComPtr<IPortableDeviceKeyCollection> spPropertyKeys;
 
    hr = CoCreateInstance( CLSID_PortableDeviceKeyCollection, NULL, CLSCTX_INPROC_SERVER,
                               IID_IPortableDeviceKeyCollection, (VOID**)&spPropertyKeys );
 
    if( hr == S_OK )
    {
        hr = spPropertyKeys->Add(WPD_OBJECT_NAME);
    }
 
    // Use the GetValues API to get the desired values
    ComPtr<IPortableDeviceValues> spPropertyValues;
 
    if( hr == S_OK )
    {
        hr = pProperties->GetValues(pwszObjectID, spPropertyKeys, &spPropertyValues);
    }
 
     LPWSTR pwszName = NULL;
 
    if( hr == S_OK )
    {
        hr = spPropertyValues->GetStringValue(WPD_OBJECT_NAME, &pwszName);
    }
 
    // Display object properties
    if( hr == S_OK )
    {
        InfoLines->Add( tab + String( pwszName ) + spacer + String( pwszObjectID ) );
    }
 
    // Free any memory allocated by GetStringValue
    if( pwszName != NULL )
        CoTaskMemFree( pwszName );
 
    return hr;
}


the function is called from the enumeration function like this:

   HRESULT hr = content->Properties( &ObjectProperties );
 
   if( SUCCEEDED( hr ) )
   {
      PrintProperties( ObjectProperties, objectID, tab );
   }


the enumeration part goes well and when I print out the ID's they mach the number
of items on the phone looking like this + a lot more
DEVICE
s10001
o1
o2
o3
o4
o5
o6
o7
o8
o9
oA
oB
oC
oD
o10

Thanks for helping
Best regards
Asger
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Error: No such interface supported ??  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 14, 2016 6:09 PM   in response to: Asger Joergensen in response to: Asger Joergensen
Asger wrote:

Add PortableDeviceGUIDs.lib to your project.
Unfortunately that is not part of CB2009

It should be, since CB2009 does have the portable device header files. Double-check
your IDE installation in the "$(BDS)\lib\win32\release\psdk" folder.

in groups they are all the same e.g.:

 
DEFINE_PROPERTYKEY( WPD_OBJECT_ID , 0xEF6B490D, 0x5CD8, 0x437A, 0xAF,
0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 2 );
 
DEFINE_PROPERTYKEY( WPD_OBJECT_PARENT_ID , 0xEF6B490D, 0x5CD8, 0x437A,
0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 3 );
 
DEFINE_PROPERTYKEY( WPD_OBJECT_NAME , 0xEF6B490D, 0x5CD8, 0x437A,
0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C , 4 );
 


except for that extra digit at the end, which I'm not allowed to add
in the cpp file

A PROPERTYKEY is more than just a guid. Here is the declaration from wtypes.h:

typedef struct _tagpropertykey
    {
    GUID fmtid;
    DWORD pid;
    } 	PROPERTYKEY;


Here is the declaration of the DEFINE_PROPERTYKEY() macro in propkeydef.h:

#ifdef INITGUID
#define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, 
pid) EXTERN_C const PROPERTYKEY DECLSPEC_SELECTANY name = { { l, w1, w2, 
{ b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }, pid }
#else
#define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, 
pid) EXTERN_C const PROPERTYKEY name
#endif // INITGUID


The three declarations you showed would be expanded by the preprocessor to
this code:

extern "C" const PROPERTYKEY __declspec(selectany) WPD_OBJECT_ID = { { 0xEF6B490D, 
0x5CD8, 0x437A, { 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C } },  2 };
 
extern "C" const PROPERTYKEY __declspec(selectany) WPD_OBJECT_PARENT_ID = 
{ { 0xEF6B490D, 0x5CD8, 0x437A, { 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 
0x3C } },  3 };
 
extern "C" const PROPERTYKEY __declspec(selectany) WPD_OBJECT_NAME = { { 
0xEF6B490D, 0x5CD8, 0x437A, { 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C 
} },  4 };


Here is the code I'm trying to make work its a function that should
get the readable names of the files on a mobile phone: (code is more
or less as found on the web)

Just because you ask GetValues() for the WPD_OBJECT_NAME property does
not guarantee that it actually exists on the device. When in doubt, set
the pKeys parameter of GetValues() to NULL and let the device report all
available properties to you, which you can then loop through using IPortableDeviceValues's
GetCount() and GetAt() methods.

--
Remy Lebeau (TeamB)
Asger Joergensen

Posts: 370
Registered: 11/18/08
Re: Error: No such interface supported ??  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 14, 2016 6:44 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:
Asger wrote:

Add PortableDeviceGUIDs.lib to your project.
Unfortunately that is not part of CB2009

It should be, since CB2009 does have the portable device header files. Double-check
your IDE installation in the "$(BDS)\lib\win32\release\psdk" folder.

I have Locate32 installed, a very excellent search engine for PC's and it say that I don't
have any lib file where the name part contains guid, wpd, porta, devi etc.
so I'm pretty sure I don't have it.

Locate32 can be found here: http://locate32.cogit.net/

extern "C" const PROPERTYKEY __declspec(selectany) WPD_OBJECT_NAME = { { 
0xEF6B490D, 0x5CD8, 0x437A, { 0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C 
} },  4 };

Ooooooh, THANK YOU so much, that was the missing part, now it looks like this in my cpp:
static const PROPERTYKEY WPD_OBJECT_NAME  = {{ 0xEF6B490D, 0x5CD8, 0x437A, {0xAF, 0xFC, 0xDA, 0x8B, 0x60, 0xEE, 0x4A, 0x3C }}, 4};


and it works like a charm getting this result. :-)

Lenovo A1010a20 - DEVICE
Telefonhukommelse - s10001
Music - o1
Podcasts - o2
Ringtones - o3
Alarms - o4
Notifications - o5
Pictures - o6
Movies - o7
Download - o8
DCIM - o9
Android - oA
data - oB
com.google.android.apps - oC
files - oD
testdata - o10
.........

Thank you very much
Best regards
Asger
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Error: No such interface supported ??  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 15, 2016 10:26 AM   in response to: Asger Joergensen in response to: Asger Joergensen
Asger wrote:

I have Locate32 installed, a very excellent search engine for PC's
and it say that I don't have any lib file where the name part
contains guid, wpd, porta, devi etc.
so I'm pretty sure I don't have it.

The exact filename is PortableDeviceGUIDs.lib. Did you even bother to
look in the IDE's PSDK folder, like I suggested? Maybe Locate32 missed
it? I don't have CB2009 installed to check myself. Maybe it was not added
until a later version. Best to make sure by looking directly.

--
Remy Lebeau (TeamB)
Asger Joergensen

Posts: 370
Registered: 11/18/08
Re: Error: No such interface supported ??  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 15, 2016 10:47 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:
Asger wrote:

The exact filename is PortableDeviceGUIDs.lib. Did you even bother to
look in the IDE's PSDK folder, like I suggested? Maybe Locate32 missed
it? I don't have CB2009 installed to check myself. Maybe it was not added
until a later version. Best to make sure by looking directly.

Of course I look!
There is not even a win32 folder in my lib folder, but that didn't stop me,
there are only these lib files starting with p in the lib hierarchy.

H:\CodeGear\lib\psdk\pkpd32.lib
H:\CodeGear\lib\psdk\powrprof.lib
H:\CodeGear\lib\psdk\prntvpt.lib
H:\CodeGear\lib\psdk\propsys.lib
H:\CodeGear\lib\psdk\psapi.lib
H:\CodeGear\lib\psdk\p2p.lib
H:\CodeGear\lib\psdk\p2pgraph.lib
H:\CodeGear\lib\psdk\parser.lib
H:\CodeGear\lib\psdk\patchwiz.lib
H:\CodeGear\lib\psdk\pdh.lib
H:\CodeGear\lib\psdk\penwin32.lib

Best regards
Asger

Edited by: Asger Joergensen on Nov 15, 2016 8:05 PM
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02