Access Denied in VC++ COM
-
RevathiRamakumar wrote:
HRESULT Of ::CoCreateInstance() returned 0 and the interface pointer points a valid address..But, again Access Denied while calling the server method...
That's odd... If you're able to successfully create the server and get a valid pointer to the interface, I cannot see how you could get an access violation making the call. It feels like there's some kind of mismatch between the server, typelib and client. If you have changed from an IDispatch-derived interface to an IUnknown-derived, the virtual table the client tries to use may be out of sync. That's why I suggested that you should unregister all and rebuild from scratch. How is your interface declared in the IDL-file? It should be something like this:
[
object,
uuid( xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx ),
oleautomation,
helpstring( "IGetStatus interface" ),
]
interface IGetStatus : IUnknown
{
HRESULT GetBeat( [out] BSTR* pbstrTheBeat );
HRESULT GetCPU( [out] unsigned long* pulCpuLoad );
HRESULT GetMemory( [out] unsigned long* pulMemory );
};Also make sure in the client that the
IGetStatus
interface, declared in the complier generated header file, only containsQueryInterface()
,AddRef()
,Release()
,GetBeat()
,GetCPU()
andGetMemory()
. Try using one of the other interface functions since it's more straight forward with integer values and you don't have to worry about string obscurities. When you get that working you can continue withIGetStatus::GetBeat()
."It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknownHi Mr.Roger I got it working after changing the Authentication level to NONE in dcomcnfg...Initially it was dEFAULT after changing it to NONE its working fine.. Thank u... :)