Question

I've got an .NET assembly I have built to access one of our databases and passed off to another programmer to use in their Delphi application.

On Vista and Windows 7 machines running with a user login (without Admin rights) running the Delphi EXE fails with "Ole Error 8013150A" but otherwise works on all other OS types we tested.

The Delphi EXE works when Run as Administrator.

Once the EXE has been run ONCE as Administrator, from then on it will work fine when run normally.

I'm thinking there is something in the registry that needs to be written when instantiating the COM interface in the Delphi app that requires admin rights, but once written never needs to be done again... or something along those lines?

Error 8013150A seems to be related to security errors from what little information I could find on it.

Any ideas?

Was it helpful?

Solution

The issue turned out to be the following code in the .NET assembly

string cs = "ANameDoesntExist";
EventLog elog = new EventLog();
if (!EventLog.SourceExists(cs))
{
    EventLog.CreateEventSource(cs, "Application");
}
elog.Source = cs;
elog.EnableRaisingEvents = true;

Just plonking this code down on a basic form will cause an System.Security.Security exception in Vista and Windows 7 machines logged on via a User account.

It will work in admin, and of course work after that in user security since it was created!

Ironically, this logging was added to try and work out why we were having other issues the code!

The error also turned up in StackOverflow here C#: Simple Windows Service gives Security Exception but of course I was initially tracking down the OLE exception!

thanks for the help

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top