Пример #1
0
        internal object DatabasePluginInfoThunk(object[] args)
        {
            DatabaseLink link = new DatabaseLink();

            link.Size = Marshal.SizeOf(typeof(DatabaseLink));
            link.GetCapability = GetCapabilityThunk;
            link.GetFriendlyName = GetFriendlyNameThunk;
            link.GrokHeader = GrokHeaderThunk;
            link.Init = InitPreThunk;
            link.MakeDatabase = MakeDatabaseThunk;
            link.Unload = UnloadPreThunk;
            DatabaseLinkHandle = new UnmanagedStructHandle<DatabaseLink>(ref link);

            DatabaseLinkGcHandle = GCHandle.Alloc(link);
            return DatabaseLinkHandle.IntPtr;
        }
Пример #2
0
        private void ProbeDatabasePluginInfoExport()
        {
            UIntPtr pProc = NativeMethods.GetProcAddress(handle, DatabasePluginInfoProc);

            if (pProc == UIntPtr.Zero)
                throw new MissingMethodException(DatabasePluginInfoProc);

            DatabasePluginInfoPrototype proc = (DatabasePluginInfoPrototype)
                Marshal.GetDelegateForFunctionPointer(Translate.ToHandle(pProc), typeof (DatabasePluginInfoPrototype));

            IntPtr pDbLink = proc(IntPtr.Zero);

            if (pDbLink != IntPtr.Zero)
                databaseLink = (DatabaseLink) Marshal.PtrToStructure(pDbLink, typeof (DatabaseLink));
            else
                throw new ArgumentException(DatabasePluginInfoProc);
        }