Re: breaking change in uuid attribute?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"Egbert Nierop (MVP for IIS)" <egbert_nierop@xxxxxxxxxxxxxx> wrote in
message news:OIiuu233FHA.1420@xxxxxxxxxxxxxxxxxxxx
> "Igor Tandetnik" <itandetnik@xxxxxxxx> wrote in message
> news:%23NepcOx3FHA.3844@xxxxxxxxxxxxxxxxxxxxxxx
>> Your code omitted [id] attributes on properties and methods, that's
>> why attribute provider fell back on IDispatchImpl. With your code
>> and [id] attributes in place, it does produce "hand-made IDispatch".
>
> a ha!
> so there is also an ID attribute on a method? I didn't know.
>
> Honestly, I find that bad programming.

Find what bad programming?

> The ID's should be (according to COM rules) on the COM interface, and
> not on the STDMETHODIMP's

Of course. You seem to imply I somehow suggested otherwise. I don't
recall such an event.

In case you haven't followed that other thread for some reason, here is
my example again:

// IBlah
[
object,
uuid("2FE92314-B919-4A34-828B-B15807EAFB5E"),
dual, helpstring("IBlah Interface"),
pointer_default(unique)
]
__interface IBlah : IDispatch
{
[id(1)]
HRESULT Method();
};


// NWCSession
[
coclass,
threading("both"),
support_error_info("IBlah"),
aggregatable(type=allowed),
version(4.0),
uuid("B65355A8-4F40-4875-91B6-72B99B2B18D9"),
vi_progid("Prog.Component"),
progid("Prog.Component.1"),
helpstring("NWCSession Class")
]
class ATL_NO_VTABLE NWCSession :
public IBlah,
{
public:
NWCSession()
{
}
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
public:
STDMETHODIMP Method() {return S_OK;}
};

> I do have some methods with defined IDs.

Try having _all_ methods with defined IDs.

> We can be certain that your problem exists, but really, in rare
> circumstances, the bug is 'triggered'.

Is it so unusual to have ids explicitly assigned to all methods of a
disp- or dual interface? I submit it is actually a preferred way of
doing it, rather than having MIDL assign random ids.

> I still like attributes, they way the should be, not the way MS deals
> with them.

I don't like the idea of attributes for COM programming, even if they
were completely bug-free, for reasons stated by Alexander Nickolov here:

http://groups.google.com/group/microsoft.public.vc.atl/browse_frm/thread/88d152124465c1d2/2c2ee80926c7628c

--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


.



Relevant Pages

  • RE: Intrusion Prevention requirements document
    ... The tools consider one interface as "client" and other ... Packet 1 is first sent out on client interface. ... > The product uses two network cards and so the library of over 700 ... > my previous company was Blade Software where I developed IDS Informer ...
    (Focus-IDS)
  • RE: IDS Sensor operation
    ... The snipes or rewrites that come through the sniffing interface have to ... For more complicated responses generally ... IDS and the firewall being able to find each other. ... Subject: IDS Sensor operation ...
    (Focus-IDS)
  • Re: Dual interface
    ... below sample) CCTest123 implements multiple dual interface -- ... interface ICTest123 and interface ITest456. ... IDispatchImpl: ICTest123 ... from different classes, I expect compile error ...
    (microsoft.public.vc.language)
  • Re: Theory Question
    ... Your IDS is listening to the unprotected link to ... His code could attach an IP stack to the external interface ... but it cannot be used to make further attacks. ... and back out onto the Internet. ...
    (FreeBSD-Security)
  • Re: Newbie IDS questions
    ... > the path between connections, ... IDS on a dual interface system. ... But they are not a replacement for a firewall. ...
    (Focus-IDS)