Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Calling .NET Custom Assembly with Platform Invoke

Author  Topic 

BDRichardson
Starting Member

3 Posts

Posted - 2011-08-23 : 09:44:31
Hi,

I have generated a .NET assembly, which I have successfully configured to be invoked from a Script object of an SSIS project. The project works perfectly within Visual Studio and by using DTExec at the command line. However, when I attempt to invoke the package by SQL Agent using a Proxy account for exactly the same credentials as used in Visual Studio and DTExec, it does not work correctly.

The package doesn't fail, but I know that when the .NET assembly attempts to perform a Platform Invoke of a method within the GDI32.dll, error 127 is returned. I believe error code 127 equates to 'The specified procedure could not be found' (ERROR_PROC_NOT_FOUND).

Could it be that SQL Agent will not allow .NET assemblies to access unmanaged code? Is this really so?

Please help me untangle my (security) problem!

BDRichardson
Starting Member

3 Posts

Posted - 2011-08-23 : 10:41:12
Could it be that despite the .NET assembly being registered successfully in the GAC, the unmanaged GDI32.dll cannot be accessed since it is NOT registered in the GAC?
Go to Top of Page

BDRichardson
Starting Member

3 Posts

Posted - 2011-08-26 : 08:23:30
I have come to the conclusion that native unmanaged assemblies may only be reference by an assembly, which is registered in then GAC, if the unmanaged assemblies are also registered in the GAC by embedding them within the managed assembly.

Unfortunately, in this case, it is not possible since there are so many dependencies of the GDI32.dll, and the only feasible means of overcoming this issue was to embed information within the managed assembly, that I would have otherwise loaded using GDI32.dll.
Go to Top of Page
   

- Advertisement -