Threading Model - com

I am going to develop an ATL COM for my device. We are using Win CE 6.0. My doubts are
What threading models are supported by COM dll in WInCE?
What threading models are supported by COM EXE in WInCE?
Does WIN CE have support for DCOM?
How can I check whether DCOM support is available in the WIN CE device I have?

COM in Windows CE supports only in-process, free-threaded automation objects
DCOM supports all threading models
DCOM Remoting is not supported (removed as of 6.0 IIRC)
To see if your device has support, look in the \Windows folder at ceconfig.h and see if it contains SYSGEN_OLE (for COM support) and/or SYSGEN_DCOM (for DCOM support).
More info can be found here.

Related

Any difference regarding remote COM server activation on Windows 7 vs on Windows XP?

I'm studying Microsoft COM technology from the book Learning DCOM 1999. I am puzzled with its Hello Universe sample program in Appendex D. The code is available here.
This sample contains a HelloClient.exe and a HelloServer.exe. They can be run on different Windows machines and HelloClient.exe is able to remotely call server's exposed IHello interface.
I tried HelloServer.exe on Windows XP and the HelloClient.exe on Win7 successfully call into the remote object.
However, when HelloServer.exe is run on Windows 7, the remote client always fails on CoCreateInstanceEx(CLSID_Hello, ...) with 0x80040154 (Class not registered).
So I think there must be some change since Windows Vista/7 that causes the failure.
Then what is the change, or, what am I missing?
BTW: I compile the code using Visual Studio 2010 SP1.

Native WCF client for Windows XP

I have created program using MSVC++ that besides it's main task calls WCF server functions. Under Windows 7 and Windows 8 everything works fine and I got several problems with Windows XP:
On some machines I have error that webservice.dll is missing and program doesn't starts. Why some Windows XP installations contain webservice.dll while others - not? How to install required dll?
On Win XP computers that has webservice.dll sometimes programm just crashes without any reporting. After recompiling program without WCF client code program runs fine. What might be starting point to look for the problem?
Windows Web Services API (WWSAPI) is an operating-system component of Windows 7 and Windows Server 2008 R2 or later versions of Microsoft Windows.
On Windows XP you need to package it with your app. The reason it works on some boxes is probably caused by one other installed application that uses that the WWSAPI as well.
The final version of the Windows Web Services API for Windows XP, Windows Vista, Windows Server 2003 and Windows Server 2008 is now available
In contrast to the past pre-released version of this API, this final version release can be used in production code and redistributed with the final versions of the product. Because of this, the final version is only available to companies who agree to terms of Windows Master Redistribution License Agreement (MRLA). To acquire the redistributable installers for this release and a copy of the Windows MRLA for review, please email a formal request.
Partially copied and adapted from Windows Core Networking blog, from Ari Pernick, dated Oct 9th, 2009.

Can a WinRT application access a COM outproc server on Desktop?

Can a WinRT application access a COM outproc server hosted by Desktop application on same machine?
Technical context
We are on x86/x64 Windows 8 (non ARM).
WinRT application can be C++/WRL or C++/CX or .Net.
COM outproc server is hosted by a .Net 4.0 or .Net 2.0 (two different versions) desktop app.
Sub questions
Is there restriction on exchanged data?
Is there examples availables?

32 and 64 bit interoperability on 64-bit Windows

Is there a good thorough authoritative reference that discusses interoperability between 32-bit and 64-bit processes? Based on googling I have deduced that:
A 32-bit DLL can only reside in a 32-bit process, and a 64-bit DLL only in a 64-bit process.
32 and 64-bit processes can only communicate using loosely coupled message systems, such as network communications, which means they can communicate using COM/DCOM.
32 and 64-bit COM components have different registry entries. A component is typically only registered in one of the two and typically only seen in one of the two worlds.
A 32-bit process can only create something registered as a 64-bit COM component if it uses CoCreateInstance with the 64-bit invocation flag, or (and I am guessing on this one, is it possible?) if the 64-bit component is somehow registered in the 32-bit registry but under the hood is still created as an out of process 64-bit process, or if there is a 32-bit shell COM component which creates the 64-bit component and then redirects calls to it?
This suggests that:
1. A 32-bit application can not use GetObject to get hold of a 64-bit version of Excel that is running? Or can it? How is the running object table (ROT) impacted by 32 versus 64-bit issue? Can a 32-bit process create an instance of Excel if only a 64-bit version of Office is installed? I would think the answer would be "no" unless the 32-bit process uses the 64-bit flag in its CoCreateInstance call, or if Excel somehow registered itself in the 32-bit world as well?
Does Microsoft automatically do anything like having CoCreateInstance from a 32-bit process check the 64-bit registry and try to create an out of process 64-bit component if there is none registered in the 32-bit registry? I have seen some release notes from 64-bit Office where Microsoft warns about access from 32-bit applications to 64-bit Excel not working, yet I know of one instance where it seemed to just work.
Is there a good technical factual reference for this?
It is explained quite well in the MSDN Library docs for CLSCTX. Lots of rules, the default behavior is:
If neither the client nor the server
specifies a preference, then:
If the computer that hosts the server is running Windows XP or
Windows Server 2003 without Service
Pack 1 (SP1) or later installed, then
COM will prefer a 64-bit version of
the server if available; otherwise it
will activate a 32-bit version of the
server.
If the computer that hosts the server is running Windows Server 2003
with SP1 or later installed, then COM
will try to match the server
architecture to the client
architecture. In other words, for a
32-bit client, COM will activate a
32-bit server if available; otherwise
it will activate a 64-bit version of
the server. For a 64-bit client, COM
will activate a 64-bit server if
available; otherwise it will activate
a 32-bit server.
Check the MSDN article if you want to override this behavior.

Can I build WCF servers using Delphi 2010?

We would like to build new application as multi tiers, we can do it as web service, but we prefer to use more advanced features as WCF, which not found in datasnap too.
can we do that with Delphi 2010 win32?
the clients will be Delphi win32, Asp.Net (C#) and maybe windows mobile phones too.
Using Delphi Prism you can, see http://www.drbob42.com/examines/examinB4.htm
Since WCF is a .NET only technology, you will need to bridge to cross from the unmanaged Win32 world to the managed .NET world.
There are a few options to get started.
All of them feel kludge-like, so it might be better to ask yourself the question "what features of WCF are so compelling over web services?"
Here it goes:
Write a .NET wrapper, export it as COM or ActiveX, then use it either as COM or ActiveX object from native Delphi Win32
Use Delphi Prism with the UnmanagedExport attribute to create a .NET wrapper that you can call from native Delphi Win32
Use Managed VCL to do .NET interop from native Delphi Win32
From another Stackoverflow question: create a C++ DLL crossing the bridge this used "mixed mode C++"
Use RemObjects Hydra on both the C# or Delphi Prism and native Delphi Win32 side (RemObjects wrote Delphi Prism, so this works like a charm)
The last one might be the real one you are after:
it can do much more than web-services, but is not as platform limited as WCF is.
--jeroen
WCF is a part of .NET, you need an .NET language to use it: No "Win32" language can do it. Delphi Prism can!