com

Dangers of C# MTA thread creating STA COM object

点点圈 提交于 2019-12-03 14:53:26
I'm currently looking at a problem we are having in a .Net Framework 2.0 windows service (C#) that has X number of MTA threads running that access COM components. Each thread initializes it's own instance of the com component object. The com component object does not have any UI elements. It's simply business logic that communicates with a sql server database and a C# dll with a com interface that in turn does socket communication and access to the same sql server database. Through my research I've found that you should not be instantiating STA COM components on an MTA thread but I can't find

How does COM registration work in Windows

a 夏天 提交于 2019-12-03 14:37:59
I'm an application packager trying to make sense of how the COM registry keys (SelfReg) interrelate to the given .dll in Windows. ProgID's, AppID's, TypeLibs, Extensions & Verbs are all tied around the CLSID right? Do CLSID's always use Prog/App IDs or could you just have a file extension class? Which bits are optional? Some of it seems to be 'like a router' where there's the two interfaces (internal - .dll) and external (the extension etc). How does this all fit? (The SDK documentation doesn't make sense to me) I ask as this is all pivotal to application 'healing' with Windows Installer

Icon overlay issue with Python

我是研究僧i 提交于 2019-12-03 14:24:31
I found some examples and topics on this forum about the way to implement an icon overlay handler with Python 2.7 & the win32com package but it does not work for me and I don't understand why. I create the DLL and I have no error when I register it. I have also tried directly with the script but it's the same. It's like the class is never called. Here is the code: import win32traceutil from win32com.shell import shell, shellcon import pythoncom import winerror import os REG_PATH =r'Software\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers' REG_KEY = "GdIconOverlayTest"

Set OLE Request Timeout from C++

戏子无情 提交于 2019-12-03 14:24:06
I am instantiating a local COM server using CoCreateInstance. Sometimes the application providing the server takes a long time to start. When this happens, Windows pops a dialog box like this: Server Busy The action cannot be completed because the other program is busy. Choose 'Switch To' to activate the busy program and correct the problem. [Switch To...] [Retry] [Cancel] I have found mention of a Visual Basic property on the Application object, OleRequestPendingTimeout, that can be used to control the time before this dialog comes up. I can't find any good documentation on this or an

.tlh generated on 2 machines is different

只愿长相守 提交于 2019-12-03 14:22:49
I have a .NET dll which has some interfaces\classes which are exposed to com. during the build procedure a .tlb file is generated and this tlb is referenced by some c++ code. As a result the compiler generates a .tlh file for the tlb. When I run the build locally one of the properties in one of the interfaces ends up with a corresponding method in the tlh which does not have the same name. The property in the .net code is called PropertyA end up being called get_propertyA, while PropertyB ends up called get_PropertyB. I didn't bat an eyelid when this happened, just used the method as defined

Allowing connection to .NET COM server with mismatching integrity level

£可爱£侵袭症+ 提交于 2019-12-03 14:21:05
问题 I'm having an issue with a COM based client-server setup. The COM server is written in C# (.NET 4.0) and runs as a (registered) local server. Depending on which application connects to the server, other clients will receive a Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE) The underlying issue is explained here (in the section COM is integrity aware). The way I understand it, it is being caused by the fact that an elevated application creates the server

Use DLL in PHP?

删除回忆录丶 提交于 2019-12-03 14:17:07
I'm not going to lie. I'm not all the familiar with Windows and COM objects. That's why i'm here. First of all is it possible to access a DLL from within a PHP script running out of Apache? In my journey around the internets i believe that i have 2 options: compile the dll as an extension for PHP. (i didn't make this dll) access the DLL as a COM object which is sort of what it's designed for anyways. So i'm taking the COM approach. try{ $com = new COM('WHAT_GOES_HERE'); } catch(Exception $e){ echo 'error: ' . $e->getMessage(), "\n"; } How do i go about finding out what would go into the

How to communicate between two COM objects using Running Object Table (ROT)?

£可爱£侵袭症+ 提交于 2019-12-03 14:04:53
I have two COM objects written in C++ and ATL. There are in one library and I know their IIDs and CLIDs. I can't find an example of doing this simple communication between two simple COM objects. How to create IMoniker and how to add it to ROT? And then, how to retrieve pointer of this object,in other COM in different process/thread? Does anyone can provide a small example? EDIT : More info: I'm writing an add-on for IE. There are two COM object completely unrelated that IE load for different purpose. One is BHO (Browser Helper Obect), other is Asynchronous Pluggable Protocol (APP) I found I

How to mark .NET objects exposed to COM-interop as single threaded?

故事扮演 提交于 2019-12-03 14:00:58
When defining a COM-visible class in C++ I can define the supported threading model in the header file (the threading(single) line): [ coclass, default(IComInterface), threading(single), vi_progid("Example.ComClass"), progid("Example.ComClass.1"), version(1.0), uuid("72861DF5-4C77-43ec-A4DC-ED04396F0CCD") ] Is there a comparable way of setting the threading model in .NET (for example an attribute)? I currently define my COM-class as such: [Guid("67155A91-2948-43f5-B07F-5C55CDD240E5")] [ComVisible(true)] [InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface IComInterface { ... }

What does MethodImplAttribute(InternalCall, Runtime) do for methods of COM Interop interfaces?

╄→尐↘猪︶ㄣ 提交于 2019-12-03 13:58:19
In Windows API Code Pack for .NET Framework , many methods of COM Interop interfaces are decorated with MethodImplAttribute , for example: internal interface IShellItem { [PreserveSig] [MethodImpl( MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] HResult BindToHandler( [In] IntPtr pbc, [In] ref Guid bhid, [In] ref Guid riid, [Out, MarshalAs(UnmanagedType.Interface)] out IShellFolder ppv); Documentation for MethodImplOptions.InternalCall value says: The call is internal, that is, it calls a method that is implemented within the common language runtime. Documentation for