I call CoCreateInstance from unmanaged code to a registered managed class (record HKEY_CLASSES_ROOT \ CLSID {xxxxx-xxxxxx-xxxxxx-xxxxx-xxxxxx-xxxxx} exists, and the file is downloaded from another program.
Code below:
HRESULT hRC;
CoInitialize(NULL);
char* sUTProgID = "My.Utilities";
CLSID UTClassID;
hRC = CLSIDFromProgID(
_CW(sUTProgID),
&UTClassID );
if ( S_OK != hRC )
{
DOTRACE((_T(" CLSIDFromProgID error 0x%X\n", hRC)));
}
IUnknown* pUnknown;
hRC = CoCreateInstance(
UTClassID,
0,
CLSCTX_ALL,
IID_IUnknown,
(void**) &pUnknown);
if ( S_OK != hRC )
{
}
The same code works for another application. The code compiles for x86 and runs on an x86 machine.
EDIT: Windows XP, , UAC . ClassID, . ProcMon, , , :
InProcServer32 -
InProcServerx86 -
LocalServer32 -
InProcHandler32 -
AppId -
InProcServer32\ThreadingModel -
InProcServer32\1.0.0.0 -
InProcServer32\1.0.0.0\assembly -
InProcServer32\1.0.0.0\ -
InProcServer32\1.0.0.0\class -
InProcServer32\1.0.0.0\RuntimeVersion -
InProcServer32\CodeBase - ( )
GAC, DLL.
CLIENT.EXE 1092 RegQueryKey HKCR\CLSID {...} :
CLIENT.EXE 1092 RegOpenKey HKCR\CLSID {...}\InprocHandler NAME NOT FOUND :
CLIENT.EXE 1092 RegCloseKey HKCR\CLSID {9935FEE6-39FD-4EF0-87DB-8372B0992610}
CLIENT.EXE 1092 RegOpenKey HKLM\Software\Policies\Microsoft\Windows\ :
CLIENT.EXE 1092 CreateFile LogFile.txt
, , .
EDIT2:
Dll :
Assembly asm = Assembly.LoadFile(dll_name);
RegistrationServices regAsm = new RegistrationServices();
bool bResult = regAsm.RegisterAssembly(asm, AssemblyRegistrationFlags.SetCodeBase);
EDIT3:
CorFlags.exe () DLL-:
Version : v2.0.50727
CLR Header: 2.5
PE : PE32
CorFlags : 11
ILONLY : 1
32BIT : 1
Signed : 1
EXE, DLL-:
Version : v1.1.4322
CLR Header: 2.0
PE : PE32
CorFlags : 9
ILONLY : 1
32BIT : 0
Signed : 1