Ejemplo n.º 1
0
        static OCI()
        {
            int clientVersion = 0;

            // To fix bug 87290, we need to Pre-LoadLibrary the MTxOCI8.dll from the runtime
            // directory so that it can be found by PInvoke when our component is GAC'd
            StringBuilder sb = new StringBuilder(GetRuntimeDirectory());

            sb.Append(@"\");
            sb.Append(ExternDll.MtxOci8Dll);

            string pathToMTxOci8Dll = sb.ToString();

            IntPtr hModule = SafeNativeMethods.LoadLibraryExA(pathToMTxOci8Dll, IntPtr.Zero, 0);

            if (IntPtr.Zero == hModule)
            {
                _newMtxOci8Installed = false;
            }
            else
            {
                MTxOCI8_Reference = new ModuleReference(hModule);

                try {
                    UnsafeNativeMethods.MTxOciGetOracleVersion(ref clientVersion);
                    _newMtxOci8Installed = true;
                }
                catch (DllNotFoundException e)
                {
                    ADP.TraceException(e);

                    // MTxOci8 wasn't found, so we must not have gotten it installed.  Since
                    // this may be a common case, we'll just presume that they have Oracle8i
                    // installed.
                    clientVersion = 81;
                }
        #if EVERETT
                catch (EntryPointNotFoundException e)
                {
                    ADP.TraceException(e);

                    // MTxOciGetOracleVersion wasn't found, so we must have loaded the beta
                    // version instead of the release version.  We want to tell the user that
                    // this is the case, however, so they can correct it.
                    throw ADP.PleaseUninstallTheBeta();
                }
        #endif //EVERETT
            }

            if (81 > clientVersion)
            {
                throw ADP.BadOracleClientVersion();
            }

            _clientVersion = clientVersion;

#if !USEORAMTS
            int mtxOciVersion = 0;

            UnsafeNativeMethods.MTxOciGetVersion(out mtxOciVersion);

            _newMtxOciInstalled = (1 < mtxOciVersion);
#endif //!USEORAMTS
        }
Ejemplo n.º 2
0
 internal NativeBuffer_ParameterBuffer(int initialsize) : base(initialsize)
 {
     SafeNativeMethods.ZeroMemory(Ptr.Handle, Length);
 }