- This calling convention specifies that parameters are pushed onto
the stack from left to right and that the called function pops its own
arguments from the stack before returning.
- IDL plays an important role in the development of COM+ objects,
but it is not part of COM+. IDL is simply a tool used to help
programmers define interfaces.
- The sun is expected to last only another 4.5 billion years, after
which COM+ might lose some of its universal appeal.
- These calls are CoTaskMemAlloc, CoTaskMemFree,
CoTaskMemRealloc, and the IMalloc methods of the task
allocator object returned by CoGetMalloc.
- In early versions of OLE, applications could replace the default
memory allocator by passing the address of a custom allocator object to
CoInitializeEx. COM+ does not currently support applications
replacing this allocator, and if the parameter is anything but
NULL, CoInitializeEx returns an E_INVALIDARG
error.
- The registry is a system-wide data store that contains
information about the current user, machine configuration, application
settings, and COM+ component information. You can view and edit the
data in the registry with the registry editor utility, regedit.exe.
- This code will run without complaint in this case because our
implementation of ISum runs in-process with the client. However,
changing the object's v-table slightly or running the component
outside of the client process where it would depend on the marshaling
infrastructure of COM+ would make this code deadly.
- Actually, the compiler first converts this older C-style cast to
a static_cast, but because that would cause an error in this
case, the compiler silently demotes the cast to use the
reinterpret_cast operator. The reinterpret_cast operator is
a type-blind casting operator, which effectively is equivalent to the
older C-style casts.
- Only the IUnknown interface pointer must have the same address returned by every call to QueryInterface, other interfaces are not subject to this same restriction. You can exploit this little-known loophole to create tear-off interfaces that come and go dynamically.
- Due to the potential for race conditions in multithreaded
in-process components, COM+ might not immediately unload the DLL even
if S_OK is returned by DllCanUnloadNow.
For a discussion of this race condition, see the section,
"Making DllGetClassObject and DllCanUnloadNow Thread-Safe," in Chapter 4.
- We are not suggesting that you actually write code like this, but it
can be helpful to see that in the simple case of an in-process
component, COM+ is not doing anything incredibly complex in
CoCreateInstance.
- The COM+ SCM is often confused with the Windows 2000 Service Control
Manager used to manage Win32 services.
- These functions are part of the Win32 API, not COM+, and because
their names are relatively descriptive, they will not be described here
in detail. See the Win32 reference documentation for more
information.
- Incidentally, this is also how the Active Template Library (ATL)
handles component registration needs.
- Specifically, the functions GetFileVersionInfoSize,
GetFileVersionInfo, and VerQueryValue are used for this
purpose. For sample code that uses these functions to check whether a
component has the OLESelfRegister flag in its version
information resource, see the CheckReg.dsw work-space file in the
Samples\The IUnknown Interface\CheckReg folder on the companion CD.
- It is generally best to choose the leftmost base class when
casting because some compilers, including Visual C++, place the
leftmost base class at the top of the object layout and then do not
require an adjustor thunk to manipulate the this pointer. This
is why IMultiply is preferable to ISum for casting of the
IUnknown interface pointer.
- The limitation is actually even more stringent because you cannot
use aggregation across apartment boundaries. For details about the
apartment models, see Chapter 4.