Why could COM interop layer be 40 times slower when client is compiled in VS 2010 vs VS 2005?

It was kind of a long shot. Glad I could help. Matching MTA vs STA (threading model) is really important when making lots of distinct calls into any COM object. An [STAThread] directive at the top of a method is one way to be sure of threading model for every call in that method. Looks … Read more

What is the ($Foo)PS project in my $Foo ATL solution for?

COM supports making interface method calls across two different threads, two different processes or two different machines. This is called marshaling. Two different threads is the most common case, a COM server is often not thread-safe. COM implements thread-safety for such single-threaded coclasses by marshaling the call from the ‘wrong’ thread to the thread that … Read more

RegSvr32 exit codes documentation?

The exit codes are not documented. The documentation is here: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/regsvr32 However, the source code for a version REGSVR32.EXE is shipped with Visual Studio 2008. This gives its version as 4.0.0, so is not the same as the one shipped with windows, which reports version 6. http://msdn.microsoft.com/en-us/library/ms177531(v=vs.90).aspx A quick look shows these: #define FAIL_ARGS 1 … Read more

How do I properly instantiate 32-bit COM objects in classic ASP after installing Windows Update KB4340558?

We were affected with multiple customers too. I ruled out invalid strong-name signing of our assemblies, since the .NET Assemblies from the Framework itself were affected by that access-denied error too. Finally I managed to solve the issue by configuration. Apparently the authenticating identity of the website has now to match the identity of the … Read more

How to call a complex COM method from PowerShell?

This problem did interest me, so I did some real digging and I have found a solution (though I have only tested on some simple cases)! Concept The key solution is using [System.Type]::InvokeMember which allows you to pass parameter names in one of its overloads. Here is the basic concept. $Object.GetType().InvokeMember($Method, [System.Reflection.BindingFlags]::InvokeMethod, $null, ## Binder … Read more

COM, COM+, DCOM, where to start?

If you are serious about learning COM, Don Box’s “Essential COM” is definitely an absolute “must read”. COM can be confusing and in my humble opinion Don Box is one of the few people who actually “got it”. The example code in “Essential COM” is in C++. You won’t find many books that support COM … Read more

Exposing .NET events to COM?

The key concept in .NET code is to define event(s) as method(s) on a separate interface and connect it to the class via [ComSourceInterfacesAttribute]. In the example this is done with this code [ComSourceInterfaces(typeof(IEvents))] where IEvents interface defines the event(s) which should be handled on COM client. Note to event naming: Event names defined in … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)