⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nativemethods.cs

📁 wrox c#高级编程
💻 CS
📖 第 1 页 / 共 5 页
字号:
using System;
using System.Runtime.InteropServices;

namespace SqlAdmin {

    internal sealed class NativeMethods {

        private NativeMethods() {
        }


        public class SQLDMO_SCRIPT_TYPE {
            public const int SQLDMOScript_None = 0;
            public const int SQLDMOScript_Default = 4;
            public const int SQLDMOScript_Drops = 1;
            public const int SQLDMOScript_ObjectPermissions = 2;
            public const int SQLDMOScript_PrimaryObject = 4;
            public const int SQLDMOScript_ClusteredIndexes = 8;
            public const int SQLDMOScript_Triggers = 16;
            public const int SQLDMOScript_DatabasePermissions = 32;
            public const int SQLDMOScript_Permissions = 34;
            public const int SQLDMOScript_ToFileOnly = 64;
            public const int SQLDMOScript_Bindings = 128;
            public const int SQLDMOScript_AppendToFile = 256;
            public const int SQLDMOScript_NoDRI = 512;
            public const int SQLDMOScript_UDDTsToBaseType = 1024;
            public const int SQLDMOScript_IncludeIfNotExists = 4096;
            public const int SQLDMOScript_NonClusteredIndexes = 8192;
            public const int SQLDMOScript_Indexes = 0x00012008;
            public const int SQLDMOScript_Aliases = 16384;
            public const int SQLDMOScript_NoCommandTerm = 32768;
            public const int SQLDMOScript_DRIIndexes = 0x00010000;
            public const int SQLDMOScript_IncludeHeaders = 0x00020000;
            public const int SQLDMOScript_OwnerQualify = 0x00040000;
            public const int SQLDMOScript_TimestampToBinary = 0x00080000;
            public const int SQLDMOScript_SortedData = 0x00100000;
            public const int SQLDMOScript_SortedDataReorg = 0x00200000;
            public const int SQLDMOScript_TransferDefault = 0x000670ff;
            public const int SQLDMOScript_DRI_NonClustered = 0x00400000;
            public const int SQLDMOScript_DRI_Clustered = 0x00800000;
            public const int SQLDMOScript_DRI_Checks = 0x01000000;
            public const int SQLDMOScript_DRI_Defaults = 0x02000000;
            public const int SQLDMOScript_DRI_UniqueKeys = 0x04000000;
            public const int SQLDMOScript_DRI_ForeignKeys = 0x08000000;
            public const int SQLDMOScript_DRI_PrimaryKey = 0x10000000;
            public const int SQLDMOScript_DRI_AllKeys = 0x1c000000;
            public const int SQLDMOScript_DRI_AllConstraints = 0x1f000000;
            public const int SQLDMOScript_DRI_All = 0x1fc00000;
            public const int SQLDMOScript_DRIWithNoCheck = 0x20000000;
            public const int SQLDMOScript_NoIdentity = 0x40000000;
            // Too big for int, need uint, but we don't use it anyway
            //public const int SQLDMOScript_UseQuotedIdentifiers = 0x80000000;
        }

        public class SQLDMO_DBSTATUS_TYPE {
            public const int SQLDMODBStat_Normal = 0;
            public const int SQLDMODBStat_Loading = 32;
            public const int SQLDMODBStat_Recovering = 192;
            public const int SQLDMODBStat_Suspect = 256;
            public const int SQLDMODBStat_Offline = 512;
            public const int SQLDMODBStat_Inaccessible = 992;
            public const int SQLDMODBStat_EmergencyMode = 32768;
            public const int SQLDMODBStat_Standby = 1024;
            public const int SQLDMODBStat_All = 34784;
        }

        public class SQLDMO_GROWTH_TYPE {
            public const int SQLDMOGrowth_MB = 0;
            public const int SQLDMOGrowth_Percent = 1;
            public const int SQLDMOGrowth_Invalid = 99;
        }

        public class SQLDMO_KEY_TYPE {
            public const int SQLDMOKey_Unknown = 0;
            public const int SQLDMOKey_Primary = 1;
            public const int SQLDMOKey_Unique = 2;
            public const int SQLDMOKey_Foreign = 3;
        }


        [ComVisible(true), ComImport(), Guid("10020200-E260-11CF-AE68-00AA004A34D5")]
        public class SqlServer {
        }

        [ComVisible(true), ComImport(), Guid("10020206-E260-11CF-AE68-00AA004A34D5"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)]
        public interface ISqlServer {
            int Bogus_Application(); // HRESULT Application([out, retval] Application** ppApp);
            int Bogus_Parent(); // HRESULT Parent([out, retval] _IVSQLDMOStdObject** ppParent);
            int Bogus_UserData1(); // HRESULT UserData([out, retval] long* pRetVal);
            int Bogus_UserData2(); // HRESULT UserData([in] long pRetVal);
            int Bogus_TypeOf(); // HRESULT TypeOf([out, retval] SQLDMO_OBJECT_TYPE* pRetVal);
            int Bogus_Properties(); // HRESULT Properties([out, retval] Properties** ppVBObjRet);

            IDatabases GetDatabases(); //HRESULT Databases([out, retval] Databases** ppVBObjRet);

            int Bogus_Password1(); // HRESULT Password([out, retval] BSTR* pRetVal);
            int Bogus_Password2(); // HRESULT Password([in] BSTR pRetVal);
            int Bogus_Name1(); // HRESULT Name([out, retval] BSTR* pRetVal);
            int Bogus_Name2(); // HRESULT Name([in] BSTR pRetVal);
            int Bogus_Login1(); // HRESULT Login([out, retval] BSTR* pRetVal);
            int Bogus_Login2(); // HRESULT Login([in] BSTR pRetVal);
            int Bogus_VersionString(); // HRESULT VersionString([out, retval] BSTR* pRetVal);
            int Bogus_BackupDevices(); // HRESULT BackupDevices([out, retval] BackupDevices** ppVBObjRet);
            int Bogus_VersionMajor(); // HRESULT VersionMajor([out, retval] long* pRetVal);
            int Bogus_VersionMinor(); // HRESULT VersionMinor([out, retval] long* pRetVal);
            int Bogus_CommandTerminator1(); // HRESULT CommandTerminator([out, retval] BSTR* pRetVal);
            int Bogus_CommandTerminator2(); // HRESULT CommandTerminator([in] BSTR pRetVal);
            int Bogus_TrueName(); // HRESULT TrueName([out, retval] BSTR* pRetVal);
            int Bogus_ConnectionID(); // HRESULT ConnectionID([out, retval] long* pRetVal);
            int Bogus_TrueLogin(); // HRESULT TrueLogin([out, retval] BSTR* pRetVal);
            int Bogus_IntegratedSecurity(); // HRESULT IntegratedSecurity([out, retval] IntegratedSecurity** ppVBObjRet);
            int Bogus_Languages(); // HRESULT Languages([out, retval] Languages** ppVBObjRet);
            int Bogus_RemoteServers(); // HRESULT RemoteServers([out, retval] RemoteServers** ppVBObjRet);
            int Bogus_Logins(); // HRESULT Logins([out, retval] Logins** ppVBObjRet);
            int Bogus_UserProfile(); // HRESULT UserProfile([out, retval] SQLDMO_SRVUSERPROFILE_TYPE* pRetVal);
            int Bogus_MaxNumericPrecision(); // HRESULT MaxNumericPrecision([out, retval] long* pRetVal);
            int Bogus_NextDeviceNumber(); // HRESULT NextDeviceNumber([out, retval] long* pRetVal);
            int Bogus_QueryTimeout1(); // HRESULT QueryTimeout([out, retval] long* pRetVal);
            int Bogus_QueryTimeout2(); // HRESULT QueryTimeout([in] long pRetVal);
            int Bogus_LoginTimeout1(); // HRESULT LoginTimeout([out, retval] long* pRetVal);
            int Bogus_LoginTimeout2(); // HRESULT LoginTimeout([in] long pRetVal);
            int Bogus_NetPacketSize1(); // HRESULT NetPacketSize([out, retval] long* pRetVal);
            int Bogus_NetPacketSize2(); // HRESULT NetPacketSize([in] long pRetVal);
            int Bogus_HostName1(); // HRESULT HostName([out, retval] BSTR* pRetVal);
            int Bogus_HostName2(); // HRESULT HostName([in] BSTR pRetVal);
            int Bogus_ApplicationName1(); // HRESULT ApplicationName([out, retval] BSTR* pRetVal);
            int Bogus_ApplicationName2(); // HRESULT ApplicationName([in] BSTR pRetVal);
            int Bogus_LoginSecure1(); // HRESULT LoginSecure([out, retval] VARIANT_BOOL* pRetVal);
            int Bogus_LoginSecure2(); // HRESULT LoginSecure([in] VARIANT_BOOL pRetVal);
            int Bogus_ProcessID(); // HRESULT ProcessID([out, retval] long* pRetVal);
            int Bogus_Status(); // HRESULT Status([out, retval] SQLDMO_SVCSTATUS_TYPE* pRetVal);
            int Bogus_Registry(); // HRESULT Registry([out, retval] Registry** ppVBObjRet);
            int Bogus_Configuration(); // HRESULT Configuration([out, retval] Configuration** ppVBObjRet);
            int Bogus_JobServer(); // HRESULT JobServer([out, retval] JobServer** ppVBObjRet);
            int Bogus_ProcessOutputBuffer1(); // HRESULT ProcessInputBuffer([in] long ProcessID, [out, retval] BSTR* pRetVal);
            int Bogus_ProcessOutputBuffer2(); // HRESULT ProcessOutputBuffer([in] long ProcessID, [out, retval] BSTR* pRetVal);
            int Bogus_Language1(); // HRESULT Language([out, retval] BSTR* pRetVal);
            int Bogus_Language2(); // HRESULT Language([in] BSTR pRetVal);
            int Bogus_AutoReConnect1(); // HRESULT AutoReConnect([out, retval] VARIANT_BOOL* pRetVal);
            int Bogus_AutoReConnect2(); // HRESULT AutoReConnect([in] VARIANT_BOOL pRetVal);
            int Bogus_StatusInfoRefetchInterval1(); // HRESULT StatusInfoRefetchInterval([in] SQLDMO_STATUSINFO_TYPE StatusInfoType, [out, retval] long* pRetVal);
            int Bogus_StatusInfoRefetchInterval2(); // HRESULT StatusInfoRefetchInterval([in] SQLDMO_STATUSINFO_TYPE StatusInfoType, [in] long pRetVal);
            int Bogus_SaLogin(); // HRESULT SaLogin([out, retval] VARIANT_BOOL* pRetVal);
            int Bogus_AnsiNulls1(); // HRESULT AnsiNulls([out, retval] VARIANT_BOOL* pRetVal);
            int Bogus_AnsiNull2(); // HRESULT AnsiNulls([in] VARIANT_BOOL pRetVal);

            //[PreserveSig]
            int Connect([In, MarshalAs(UnmanagedType.Struct)] object ServerName, [In, MarshalAs(UnmanagedType.Struct)] object Login, [In, MarshalAs(UnmanagedType.Struct)] object Password); //HRESULT Connect([in, optional] VARIANT ServerName, [in, optional] VARIANT Login, [in, optional] VARIANT Password);

            int Bogus_Close(); // HRESULT Close();

            [PreserveSig]
            int DisConnect(); //HRESULT DisConnect();

            int Bogus_KillProcess(); // HRESULT KillProcess([in] long lProcessID);
            int Bogus_ExecuteImmediate(); // HRESULT ExecuteImmediate([in] BSTR Command, [in, optional, defaultvalue(0)] SQLDMO_EXEC_TYPE ExecType, [in, optional] VARIANT Length);
            int Bogus_ReConnect(); // HRESULT ReConnect();
            int Bogus_Shutdown(); // HRESULT Shutdown([in, optional] VARIANT Wait);
            int Bogus_Start(); // HRESULT Start([in] VARIANT_BOOL StartMode, [in, optional] VARIANT Server, [in, optional] VARIANT Login, [in, optional] VARIANT Password);
            int Bogus_UnloadODSDLL(); // HRESULT UnloadODSDLL([in] BSTR DLLName);
            int Bogus_KillDatabase(); // HRESULT KillDatabase([in] BSTR DatabaseName);
            int Bogus_ExecuteWithResults(); // HRESULT ([in] BSTR Command, [in, optional] VARIANT Length, [out, retval] QueryResults** ppVBObjRet);
            int Bogus_ListStartupProcedures(); // HRESULT ListStartupProcedures([out, retval] SQLObjectList** ppVBObjRet);
            int Bogus_BeginTransaction(); // HRESULT BeginTransaction([in, optional] VARIANT TransactionName);
            int Bogus_CommitTransaction(); // HRESULT CommitTransaction([in, optional] VARIANT TransactionName);
            int Bogus_SaveTransaction(); // HRESULT SaveTransaction([in] BSTR SavepointName);
            int Bogus_RollbackTransaction(); // HRESULT RollbackTransaction([in, optional] VARIANT TransactionOrSavepointName);
            int Bogus_CommandShellImmediate(); // HRESULT CommandShellImmediate([in] BSTR Command);
            int Bogus_ReadErrorLog(); // HRESULT ReadErrorLog([in, optional] VARIANT LogNumber, [out, retval] QueryResults** ppVBObjRet);
            int Bogus_EnumErrorLogs(); // HRESULT EnumErrorLogs([out, retval] QueryResults** ppVBObjRet);
            int Bogus_EnumAvailableMedia(); // HRESULT EnumAvailableMedia([in, optional, defaultvalue(15)] SQLDMO_MEDIA_TYPE MediaType, [out, retval] QueryResults** ppVBObjRet);
            int Bogus_EnumDirectories(); // HRESULT EnumDirectories([in] BSTR PathName, [out, retval] QueryResults** ppVBObjRet);
            int Bogus_EnumServerAttributes(); // HRESULT EnumServerAttributes([out, retval] QueryResults** ppVBObjRet);
            int Bogus_EnumVersionInfo(); // HRESULT EnumVersionInfo([in, optional] VARIANT Prefixes, [out, retval] QueryResults** ppVBObjRet);
            int Bogus_EnumLocks(); // HRESULT EnumLocks([in, optional] VARIANT WhoByID, [out, retval] QueryResults** ppVBObjRet);
            int Bogus_CommandShellWithResults(); // HRESULT CommandShellWithResults([in] BSTR Command, [out, retval] QueryResults** ppVBObjRet);
            int Bogus_ReadBackupHeader(); // HRESULT ReadBackupHeader([in] Restore* LoadSpec, [out, retval] QueryResults** ppVBObjRet);
            int Bogus_EnumProcesses(); // HRESULT EnumProcesses([in, optional] VARIANT WhoByNameOrID, [out, retval] QueryResults** ppVBObjRet);
            int Bogus_Pause(); // HRESULT Pause();
            int Bogus_Continue(); // HRESULT Continue();
            int Bogus_VerifyConnection(); // HRESULT VerifyConnection([in, optional] VARIANT ReconnectIfDead, [out, retval] VARIANT_BOOL* pRetVal);
            int Bogus_IsOS(); // HRESULT IsOS([in] SQLDMO_OS_TYPE lType, [out, retval] VARIANT_BOOL* pRetVal);
            int Bogus_AddStartParameter(); // HRESULT AddStartParameter([in] BSTR NewParam);
            int Bogus_NetName(); // HRESULT NetName([out, retval] BSTR* pRetVal);
            int Bogus_ExecuteWithResultsAndMessages(); // HRESULT ExecuteWithResultsAndMessages([in] BSTR Command, [in, optional] VARIANT Length, [out] BSTR* Messages, [out, retval] QueryResults** ppVBObjRet);
            int Bogus_EnumLoginMappings(); // HRESULT EnumLoginMappings([out, retval] QueryResults** ppVBObjRet);
            int Bogus_Replication(); // HRESULT Replication([out, retval] Replication** pRetVal);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -