Why might COM automation from within a console app

2019-08-28 06:02发布

As part of a project I am using COM automation with CorelDRAW. The automation is via a console application which will eventually be launched by a web service but for the purposes of trying to fix the issue behind this question is run as a scheduled task. This works on my development machine (running 32 bit Windows Server 2003) but fails with COM error 80080005 on a machine running 64 bit Windows Server 2003.

There does not appear to be any extra information in the event viewer logs [see edit below].

If I log-in using the account which runs the scheduled task and run the console application, it works as expected – so I don’t think this is a 32 bit on 64 bit issue (but am happy to be corrected).

The issue appears to be that the scheduled task does not “log-in” in a way that CorelDRAW expects / requires. If this is the problem why does it not happen on my development machine? Are there some settings that I may have changed on my development machine in order to allow this but have now forgotten about?

While researching similar issue, on here and elsewhere, I have tried a number of things including:

Checking that the launching account has log on as a service and log on as a batch file set in secpol.msc.

Checking that the CorelDRAW object has local launch and local activation set in dcomcnfg.

Checking file access permissions by adding the launching user to the machine’s administrators group and auditing failed object access.

Removing permissions from the launching account on my development machine in order to reproduce the error (which I can’t).

What else should I try?

Edit

After some more digging there does seem to be extra information in the event viewer logs.

There is an audit failure with event ID 560 for object ServiceActive. I can find a fix for Windows Server 2003 SP1 but I am running SP2 on both machines. I found http://social.msdn.microsoft.com/forums/en-US/windowstransactionsprogramming/thread/98683298-75da-4952-b2c1-057419c85501/ which suggests using sc sdset ....

If I add the account which runs the scheduled task to the Administrators group I get

The application, c:\Program Files (x86)\Corel\CorelDRAW Graphics Suite X5\Programs\CorelDRW.exe, generated an application error The error occurred on 03/19/2012 @ 08:20:25.869 The exception generated was c0000005 at address 65F6378B (CrlUtl!CrlUtl::WDictionaryIterator<IBaseBind,ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t> > > >::GetNext)

which suggests that it can't find something it expects to find.

1条回答
迷人小祖宗
2楼-- · 2019-08-28 07:03

You are getting CO_E_SERVER_EXEC_FAILURE which suggest the COM server (In your case, I assume it's the local DCOM CoralDraw server) failed to start.

My guess is that this is a privilege issue. If I understand you correctly, this isn't a dev machine vs. production machine issue, but interactive login vs. scheduled task issue.

Is that correct? Just to eliminate side issues, make suare CarolDraw runs interactively fine with the user account that runs the scheduled task, and then that the console program run when launched from the command line.

Are you using the Windows scheduled? I suspect you are missing the 'NT AUTHORITY\INTERACTIVE' or the 'CONSOLE LOGON' group membership. To verify this assumption, let the command line dump the group membership and privilges of the current token (GetTokenInformation is the API) and compare what you get when running as a scheduled task and from command line.

查看更多
登录 后发表回答