????

Your IP : 18.219.66.32


Current Path : C:/Program Files/Microsoft SQL Server/Client SDK/OLEDB/187/SDK/Include/
Upload File :
Current File : C:/Program Files/Microsoft SQL Server/Client SDK/OLEDB/187/SDK/Include/msoledbsql.h


/* this ALWAYS GENERATED file contains the definitions for the interfaces */


 /* File created by MIDL compiler version 8.01.0622 */
/* Compiler settings for msoledbsql.idl:
    Oicf, W1, Zp8, env=Win64 (32b run), target_arch=ARM64 8.01.0622 
    protocol : all , ms_ext, c_ext, robust
    error checks: allocation ref bounds_check enum stub_data 
    VC __declspec() decoration level: 
         __declspec(uuid()), __declspec(selectany), __declspec(novtable)
         DECLSPEC_UUID(), MIDL_INTERFACE()
*/
/* @@MIDL_FILE_HEADING(  ) */



/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 500
#endif

/* verify that the <rpcsal.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCSAL_H_VERSION__
#define __REQUIRED_RPCSAL_H_VERSION__ 100
#endif

#include "rpc.h"
#include "rpcndr.h"

#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif /* __RPCNDR_H_VERSION__ */

#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/

#ifndef __msoledbsql_h__
#define __msoledbsql_h__

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif

/* Forward Declarations */ 

#ifndef __ICommandWithParameters_FWD_DEFINED__
#define __ICommandWithParameters_FWD_DEFINED__
typedef interface ICommandWithParameters ICommandWithParameters;

#endif 	/* __ICommandWithParameters_FWD_DEFINED__ */


#ifndef __IUMSInitialize_FWD_DEFINED__
#define __IUMSInitialize_FWD_DEFINED__
typedef interface IUMSInitialize IUMSInitialize;

#endif 	/* __IUMSInitialize_FWD_DEFINED__ */


#ifndef __ISQLServerErrorInfo_FWD_DEFINED__
#define __ISQLServerErrorInfo_FWD_DEFINED__
typedef interface ISQLServerErrorInfo ISQLServerErrorInfo;

#endif 	/* __ISQLServerErrorInfo_FWD_DEFINED__ */


#ifndef __IRowsetFastLoad_FWD_DEFINED__
#define __IRowsetFastLoad_FWD_DEFINED__
typedef interface IRowsetFastLoad IRowsetFastLoad;

#endif 	/* __IRowsetFastLoad_FWD_DEFINED__ */


#ifndef __ISchemaLock_FWD_DEFINED__
#define __ISchemaLock_FWD_DEFINED__
typedef interface ISchemaLock ISchemaLock;

#endif 	/* __ISchemaLock_FWD_DEFINED__ */


#ifndef __IBCPSession_FWD_DEFINED__
#define __IBCPSession_FWD_DEFINED__
typedef interface IBCPSession IBCPSession;

#endif 	/* __IBCPSession_FWD_DEFINED__ */


#ifndef __IBCPSession2_FWD_DEFINED__
#define __IBCPSession2_FWD_DEFINED__
typedef interface IBCPSession2 IBCPSession2;

#endif 	/* __IBCPSession2_FWD_DEFINED__ */


#ifndef __ISSAbort_FWD_DEFINED__
#define __ISSAbort_FWD_DEFINED__
typedef interface ISSAbort ISSAbort;

#endif 	/* __ISSAbort_FWD_DEFINED__ */


#ifndef __ISSDataClassification_FWD_DEFINED__
#define __ISSDataClassification_FWD_DEFINED__
typedef interface ISSDataClassification ISSDataClassification;

#endif 	/* __ISSDataClassification_FWD_DEFINED__ */


#ifndef __ISSCommandWithParameters_FWD_DEFINED__
#define __ISSCommandWithParameters_FWD_DEFINED__
typedef interface ISSCommandWithParameters ISSCommandWithParameters;

#endif 	/* __ISSCommandWithParameters_FWD_DEFINED__ */


#ifndef __IDBAsynchStatus_FWD_DEFINED__
#define __IDBAsynchStatus_FWD_DEFINED__
typedef interface IDBAsynchStatus IDBAsynchStatus;

#endif 	/* __IDBAsynchStatus_FWD_DEFINED__ */


#ifndef __ISSAsynchStatus_FWD_DEFINED__
#define __ISSAsynchStatus_FWD_DEFINED__
typedef interface ISSAsynchStatus ISSAsynchStatus;

#endif 	/* __ISSAsynchStatus_FWD_DEFINED__ */


/* header files for imported files */
#include "unknwn.h"
#include "oaidl.h"

#ifdef __cplusplus
extern "C"{
#endif 


/* interface __MIDL_itf_msoledbsql_0000_0000 */
/* [local] */ 

//-----------------------------------------------------------------------------
// File:        msoledbsql.h
//
// Copyright:   Copyright (c) Microsoft Corporation
//
// Contents:    Microsoft OLE DB Driver for SQL Server definitions.
//
//-----------------------------------------------------------------------------

#if !defined(MSOLEDBSQL_VER)
#define MSOLEDBSQL_VER 1800
#endif

#if MSOLEDBSQL_VER >= 1800

#define MSOLEDBSQL_PRODUCT_NAME_FULL_ANSI          "Microsoft OLE DB Driver for SQL Server"
#define MSOLEDBSQL_PRODUCT_NAME_SHORT_ANSI         "OLE DB Driver for SQL Server"

#define MSOLEDBSQL_FILE_NAME_ANSI                  "msoledbsql"
#define MSOLEDBSQL_FILE_NAME_FULL_ANSI             "msoledbsql.dll"

#define MSOLEDBSQL_PRODUCT_NAME_FULL_UNICODE       L"Microsoft OLE DB Driver for SQL Server"
#define MSOLEDBSQL_PRODUCT_NAME_SHORT_UNICODE      L"OLE DB Driver for SQL Server"

#define MSOLEDBSQL_FILE_NAME_UNICODE               L"msoledbsql"
#define MSOLEDBSQL_FILE_NAME_FULL_UNICODE          L"msoledbsql.dll"

#define MSOLEDBSQL_VI_PROG_ID_ANSI                 "MSOLEDBSQL"
#define MSOLEDBSQL_VI_ERROR_LOOKUP_PROG_ID_ANSI    "MSOLEDBSQL.ErrorLookup"
#define MSOLEDBSQL_VI_ENUMERATOR_PROG_ID_ANSI      "MSOLEDBSQL.Enumerator"

#define MSOLEDBSQL_PROG_ID_ANSI                    "MSOLEDBSQL.1"
#define MSOLEDBSQL_ERROR_LOOKUP_PROG_ID_ANSI       "MSOLEDBSQL.ErrorLookup.1"
#define MSOLEDBSQL_ENUMERATOR_PROG_ID_ANSI         "MSOLEDBSQL.Enumerator.1"

#define MSOLEDBSQL_VI_PROG_ID_UNICODE              L"MSOLEDBSQL"
#define MSOLEDBSQL_VI_ERROR_LOOKUP_PROG_ID_UNICODE L"MSOLEDBSQL.ErrorLookup"
#define MSOLEDBSQL_VI_ENUMERATOR_PROG_ID_UNICODE   L"MSOLEDBSQL.Enumerator"

#define MSOLEDBSQL_PROG_ID_UNICODE                 L"MSOLEDBSQL.1"
#define MSOLEDBSQL_ERROR_LOOKUP_PROG_ID_UNICODE    L"MSOLEDBSQL.ErrorLookup.1"
#define MSOLEDBSQL_ENUMERATOR_PROG_ID_UNICODE      L"MSOLEDBSQL.Enumerator.1"

#define MSOLEDBSQL_CLSID                           CLSID_MSOLEDBSQL
#define MSOLEDBSQL_ERROR_CLSID                     CLSID_MSOLEDBSQL_ERROR
#define MSOLEDBSQL_ENUMERATOR_CLSID                CLSID_MSOLEDBSQL_ENUMERATOR

#endif  // MSOLEDBSQL_VER >= 1800

// define the character type agnostic constants
#if defined(_UNICODE) || defined(UNICODE)

#define MSOLEDBSQL_PRODUCT_NAME_FULL               MSOLEDBSQL_PRODUCT_NAME_FULL_UNICODE
#define MSOLEDBSQL_PRODUCT_NAME_SHORT              MSOLEDBSQL_PRODUCT_NAME_SHORT_UNICODE

#define MSOLEDBSQL_FILE_NAME                       MSOLEDBSQL_FILE_NAME_UNICODE
#define MSOLEDBSQL_FILE_NAME_FULL                  MSOLEDBSQL_FILE_NAME_FULL_UNICODE

#define MSOLEDBSQL_VI_PROG_ID                      MSOLEDBSQL_VI_PROG_ID_UNICODE
#define MSOLEDBSQL_VI_ERROR_LOOKUP_PROG_ID         MSOLEDBSQL_VI_ERROR_LOOKUP_PROG_ID_UNICODE
#define MSOLEDBSQL_VI_ENUMERATOR_PROG_ID           MSOLEDBSQL_VI_ENUMERATOR_PROG_ID_UNICODE

#define MSOLEDBSQL_PROG_ID                         MSOLEDBSQL_PROG_ID_UNICODE
#define MSOLEDBSQL_ERROR_LOOKUP_PROG_ID            MSOLEDBSQL_ERROR_LOOKUP_PROG_ID_UNICODE
#define MSOLEDBSQL_ENUMERATOR_PROG_ID              MSOLEDBSQL_ENUMERATOR_PROG_ID_UNICODE

#else   // _UNICODE || UNICODE

#define MSOLEDBSQL_PRODUCT_NAME_FULL               MSOLEDBSQL_PRODUCT_NAME_FULL_ANSI
#define MSOLEDBSQL_PRODUCT_NAME_SHORT              MSOLEDBSQL_PRODUCT_NAME_SHORT_ANSI

#define MSOLEDBSQL_FILE_NAME                       MSOLEDBSQL_FILE_NAME_ANSI
#define MSOLEDBSQL_FILE_NAME_FULL                  MSOLEDBSQL_FILE_NAME_FULL_ANSI

#define MSOLEDBSQL_VI_PROG_ID                      MSOLEDBSQL_VI_PROG_ID_ANSI
#define MSOLEDBSQL_VI_ERROR_LOOKUP_PROG_ID         MSOLEDBSQL_VI_ERROR_LOOKUP_PROG_ID_ANSI
#define MSOLEDBSQL_VI_ENUMERATOR_PROG_ID           MSOLEDBSQL_VI_ENUMERATOR_PROG_ID_ANSI

#define MSOLEDBSQL_PROG_ID                         MSOLEDBSQL_PROG_ID_ANSI
#define MSOLEDBSQL_ERROR_LOOKUP_PROG_ID            MSOLEDBSQL_ERROR_LOOKUP_PROG_ID_ANSI
#define MSOLEDBSQL_ENUMERATOR_PROG_ID              MSOLEDBSQL_ENUMERATOR_PROG_ID_ANSI

#endif  // _UNICODE || UNICODE

#ifndef  __oledb_h__
#include <oledb.h>
#endif  /*__oledb_h__*/

#if 0        // This is already defined in oledb.h

#ifdef _WIN64

// Length of a non-character object, size
typedef ULONGLONG DBLENGTH;


// Offset within a rowset
typedef LONGLONG DBROWOFFSET;


// Number of rows
typedef LONGLONG DBROWCOUNT;


typedef ULONGLONG DBCOUNTITEM;


// Ordinal (column number, etc.)
typedef ULONGLONG DBORDINAL;


typedef LONGLONG DB_LORDINAL;


// Bookmarks
typedef ULONGLONG DBBKMARK;

// Offset in the buffer

typedef ULONGLONG DBBYTEOFFSET;

// Reference count of each row/accessor  handle

typedef ULONG DBREFCOUNT;


// Parameters
typedef ULONGLONG DB_UPARAMS;


typedef LONGLONG DB_LPARAMS;


// hash values corresponding to the elements (bookmarks)
typedef DWORDLONG DBHASHVALUE;


// For reserve
typedef DWORDLONG DB_DWRESERVE;


typedef LONGLONG DB_LRESERVE;


typedef ULONGLONG DB_URESERVE;


#else //_WIN64

// Length of a non-character object, size
typedef ULONG			DBLENGTH;
// Offset within a rowset
typedef LONG			DBROWOFFSET;
// Number of rows
typedef LONG			DBROWCOUNT;
typedef ULONG			DBCOUNTITEM;
// Ordinal (column number, etc.)
typedef ULONG			DBORDINAL;
typedef LONG			DB_LORDINAL;
// Bookmarks
typedef ULONG			DBBKMARK;
// Offset in the buffer
typedef ULONG			DBBYTEOFFSET; 
// Reference count of each row handle
typedef ULONG			DBREFCOUNT;
// Parameters
typedef ULONG			DB_UPARAMS;
typedef LONG			DB_LPARAMS;
// hash values corresponding to the elements (bookmarks)
typedef DWORD			DBHASHVALUE;
// For reserve
typedef DWORD			DB_DWRESERVE;
typedef LONG			DB_LRESERVE;
typedef ULONG			DB_URESERVE;
#endif	// _WIN64
typedef DWORD DBKIND;


enum DBKINDENUM
    {
        DBKIND_GUID_NAME	= 0,
        DBKIND_GUID_PROPID	= ( DBKIND_GUID_NAME + 1 ) ,
        DBKIND_NAME	= ( DBKIND_GUID_PROPID + 1 ) ,
        DBKIND_PGUID_NAME	= ( DBKIND_NAME + 1 ) ,
        DBKIND_PGUID_PROPID	= ( DBKIND_PGUID_NAME + 1 ) ,
        DBKIND_PROPID	= ( DBKIND_PGUID_PROPID + 1 ) ,
        DBKIND_GUID	= ( DBKIND_PROPID + 1 ) 
    } ;
typedef struct tagDBID
    {
    /* [switch_is][switch_type] */ union 
        {
        /* [case()] */ GUID guid;
        /* [case()] */ GUID *pguid;
        /* [default] */  /* Empty union arm */ 
        } 	uGuid;
    DBKIND eKind;
    /* [switch_is][switch_type] */ union 
        {
        /* [case()] */ LPOLESTR pwszName;
        /* [case()] */ ULONG ulPropid;
        /* [default] */  /* Empty union arm */ 
        } 	uName;
    } 	DBID;

typedef struct tagDB_NUMERIC
    {
    BYTE precision;
    BYTE scale;
    BYTE sign;
    BYTE val[ 16 ];
    } 	DB_NUMERIC;

typedef struct tagDBDATE
    {
    SHORT year;
    USHORT month;
    USHORT day;
    } 	DBDATE;

typedef struct tagDBTIME
    {
    USHORT hour;
    USHORT minute;
    USHORT second;
    } 	DBTIME;

typedef struct tagDBTIMESTAMP
    {
    SHORT year;
    USHORT month;
    USHORT day;
    USHORT hour;
    USHORT minute;
    USHORT second;
    ULONG fraction;
    } 	DBTIMESTAMP;

typedef struct tagDBOBJECT
    {
    DWORD dwFlags;
    IID iid;
    } 	DBOBJECT;

typedef WORD DBTYPE;

typedef ULONG_PTR HACCESSOR;

typedef ULONG_PTR HCHAPTER;

typedef DWORD DBPARAMFLAGS;

typedef struct tagDBPARAMINFO
    {
    DBPARAMFLAGS dwFlags;
    DBORDINAL iOrdinal;
    LPOLESTR pwszName;
    ITypeInfo *pTypeInfo;
    DBLENGTH ulParamSize;
    DBTYPE wType;
    BYTE bPrecision;
    BYTE bScale;
    } 	DBPARAMINFO;

typedef DWORD DBPROPID;

typedef struct tagDBPROPIDSET
    {
    /* [size_is] */ DBPROPID *rgPropertyIDs;
    ULONG cPropertyIDs;
    GUID guidPropertySet;
    } 	DBPROPIDSET;

typedef DWORD DBPROPFLAGS;

typedef DWORD DBPROPOPTIONS;

typedef DWORD DBPROPSTATUS;

typedef struct tagDBPROP
    {
    DBPROPID dwPropertyID;
    DBPROPOPTIONS dwOptions;
    DBPROPSTATUS dwStatus;
    DBID colid;
    VARIANT vValue;
    } 	DBPROP;

typedef struct tagDBPROPSET
    {
    /* [size_is] */ DBPROP *rgProperties;
    ULONG cProperties;
    GUID guidPropertySet;
    } 	DBPROPSET;



extern RPC_IF_HANDLE __MIDL_itf_msoledbsql_0000_0000_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_msoledbsql_0000_0000_v0_0_s_ifspec;

#ifndef __ICommandWithParameters_INTERFACE_DEFINED__
#define __ICommandWithParameters_INTERFACE_DEFINED__

/* interface ICommandWithParameters */
/* [unique][uuid][object][local] */ 

typedef struct tagDBPARAMBINDINFO
    {
    LPOLESTR pwszDataSourceType;
    LPOLESTR pwszName;
    DBLENGTH ulParamSize;
    DBPARAMFLAGS dwFlags;
    BYTE bPrecision;
    BYTE bScale;
    } 	DBPARAMBINDINFO;


EXTERN_C const IID IID_ICommandWithParameters;

#if defined(__cplusplus) && !defined(CINTERFACE)
    
    MIDL_INTERFACE("0c733a64-2a1c-11ce-ade5-00aa0044773d")
    ICommandWithParameters : public IUnknown
    {
    public:
        virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetParameterInfo( 
            /* [out][in] */ DB_UPARAMS *pcParams,
            /* [size_is][size_is][out] */ DBPARAMINFO **prgParamInfo,
            /* [out] */ OLECHAR **ppNamesBuffer) = 0;
        
        virtual /* [local] */ HRESULT STDMETHODCALLTYPE MapParameterNames( 
            /* [in] */ DB_UPARAMS cParamNames,
            /* [size_is][in] */ const OLECHAR *rgParamNames[  ],
            /* [size_is][out] */ DB_LPARAMS rgParamOrdinals[  ]) = 0;
        
        virtual /* [local] */ HRESULT STDMETHODCALLTYPE SetParameterInfo( 
            /* [in] */ DB_UPARAMS cParams,
            /* [size_is][unique][in] */ const DB_UPARAMS rgParamOrdinals[  ],
            /* [size_is][unique][in] */ const DBPARAMBINDINFO rgParamBindInfo[  ]) = 0;
        
    };
    
    
#else 	/* C style interface */

    typedef struct ICommandWithParametersVtbl
    {
        BEGIN_INTERFACE
        
        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
            ICommandWithParameters * This,
            /* [in] */ REFIID riid,
            /* [annotation][iid_is][out] */ 
            _COM_Outptr_  void **ppvObject);
        
        ULONG ( STDMETHODCALLTYPE *AddRef )( 
            ICommandWithParameters * This);
        
        ULONG ( STDMETHODCALLTYPE *Release )( 
            ICommandWithParameters * This);
        
        /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetParameterInfo )( 
            ICommandWithParameters * This,
            /* [out][in] */ DB_UPARAMS *pcParams,
            /* [size_is][size_is][out] */ DBPARAMINFO **prgParamInfo,
            /* [out] */ OLECHAR **ppNamesBuffer);
        
        /* [local] */ HRESULT ( STDMETHODCALLTYPE *MapParameterNames )( 
            ICommandWithParameters * This,
            /* [in] */ DB_UPARAMS cParamNames,
            /* [size_is][in] */ const OLECHAR *rgParamNames[  ],
            /* [size_is][out] */ DB_LPARAMS rgParamOrdinals[  ]);
        
        /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetParameterInfo )( 
            ICommandWithParameters * This,
            /* [in] */ DB_UPARAMS cParams,
            /* [size_is][unique][in] */ const DB_UPARAMS rgParamOrdinals[  ],
            /* [size_is][unique][in] */ const DBPARAMBINDINFO rgParamBindInfo[  ]);
        
        END_INTERFACE
    } ICommandWithParametersVtbl;

    interface ICommandWithParameters
    {
        CONST_VTBL struct ICommandWithParametersVtbl *lpVtbl;
    };

    

#ifdef COBJMACROS


#define ICommandWithParameters_QueryInterface(This,riid,ppvObject)	\
    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

#define ICommandWithParameters_AddRef(This)	\
    ( (This)->lpVtbl -> AddRef(This) ) 

#define ICommandWithParameters_Release(This)	\
    ( (This)->lpVtbl -> Release(This) ) 


#define ICommandWithParameters_GetParameterInfo(This,pcParams,prgParamInfo,ppNamesBuffer)	\
    ( (This)->lpVtbl -> GetParameterInfo(This,pcParams,prgParamInfo,ppNamesBuffer) ) 

#define ICommandWithParameters_MapParameterNames(This,cParamNames,rgParamNames,rgParamOrdinals)	\
    ( (This)->lpVtbl -> MapParameterNames(This,cParamNames,rgParamNames,rgParamOrdinals) ) 

#define ICommandWithParameters_SetParameterInfo(This,cParams,rgParamOrdinals,rgParamBindInfo)	\
    ( (This)->lpVtbl -> SetParameterInfo(This,cParams,rgParamOrdinals,rgParamBindInfo) ) 

#endif /* COBJMACROS */


#endif 	/* C style interface */



/* [call_as] */ HRESULT STDMETHODCALLTYPE ICommandWithParameters_RemoteGetParameterInfo_Proxy( 
    ICommandWithParameters * This,
    /* [out][in] */ DB_UPARAMS *pcParams,
    /* [size_is][size_is][out] */ DBPARAMINFO **prgParamInfo,
    /* [size_is][size_is][out] */ DBBYTEOFFSET **prgNameOffsets,
    /* [out][in] */ DBLENGTH *pcbNamesBuffer,
    /* [size_is][size_is][unique][out][in] */ OLECHAR **ppNamesBuffer,
    /* [out] */ IErrorInfo **ppErrorInfoRem);


void __RPC_STUB ICommandWithParameters_RemoteGetParameterInfo_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);


/* [call_as] */ HRESULT STDMETHODCALLTYPE ICommandWithParameters_RemoteMapParameterNames_Proxy( 
    ICommandWithParameters * This,
    /* [in] */ DB_UPARAMS cParamNames,
    /* [size_is][in] */ LPCOLESTR *rgParamNames,
    /* [size_is][out] */ DB_LPARAMS *rgParamOrdinals,
    /* [out] */ IErrorInfo **ppErrorInfoRem);


void __RPC_STUB ICommandWithParameters_RemoteMapParameterNames_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);


/* [call_as] */ HRESULT STDMETHODCALLTYPE ICommandWithParameters_RemoteSetParameterInfo_Proxy( 
    ICommandWithParameters * This,
    /* [in] */ DB_UPARAMS cParams,
    /* [size_is][unique][in] */ const DB_UPARAMS *rgParamOrdinals,
    /* [size_is][unique][in] */ const DBPARAMBINDINFO *rgParamBindInfo,
    /* [out] */ IErrorInfo **ppErrorInfoRem);


void __RPC_STUB ICommandWithParameters_RemoteSetParameterInfo_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);



#endif 	/* __ICommandWithParameters_INTERFACE_DEFINED__ */


/* interface __MIDL_itf_msoledbsql_0000_0001 */
/* [local] */ 

typedef DWORD DBASYNCHOP;

typedef DWORD DBASYNCHPHASE;

#endif       // This is already defined in oledb.h

//-------------------------------------------------------------------
// Variant Access macros, similar to ole automation.
//-------------------------------------------------------------------
#define V_SS_VT(X)               ((X)->vt)
#define V_SS_UNION(X, Y)         ((X)->Y)

#define V_SS_UI1(X)              V_SS_UNION(X, bTinyIntVal)
#define V_SS_I2(X)               V_SS_UNION(X, sShortIntVal)
#define V_SS_I4(X)               V_SS_UNION(X, lIntVal)
#define V_SS_I8(X)               V_SS_UNION(X, llBigIntVal)

#define V_SS_R4(X)               V_SS_UNION(X, fltRealVal)
#define V_SS_R8(X)               V_SS_UNION(X, dblFloatVal)
#define V_SS_UI4(X)              V_SS_UNION(X, ulVal)

#define V_SS_MONEY(X)            V_SS_UNION(X, cyMoneyVal)
#define V_SS_SMALLMONEY(X)       V_SS_UNION(X, cyMoneyVal)

#define V_SS_WSTRING(X)          V_SS_UNION(X, NCharVal)
#define V_SS_WVARSTRING(X)       V_SS_UNION(X, NCharVal)

#define V_SS_STRING(X)           V_SS_UNION(X, CharVal)
#define V_SS_VARSTRING(X)        V_SS_UNION(X, CharVal)

#define V_SS_BIT(X)              V_SS_UNION(X, fBitVal)
#define V_SS_GUID(X)             V_SS_UNION(X, rgbGuidVal)

#define V_SS_NUMERIC(X)          V_SS_UNION(X, numNumericVal)
#define V_SS_DECIMAL(X)          V_SS_UNION(X, numNumericVal)

#define V_SS_BINARY(X)           V_SS_UNION(X, BinaryVal)
#define V_SS_VARBINARY(X)        V_SS_UNION(X, BinaryVal)

#define V_SS_DATETIME(X)         V_SS_UNION(X, tsDateTimeVal)
#define V_SS_SMALLDATETIME(X)    V_SS_UNION(X, tsDateTimeVal)

#define V_SS_UNKNOWN(X)          V_SS_UNION(X, UnknownType)

//Text and image types.
#define V_SS_IMAGE(X)            V_SS_UNION(X, ImageVal)
#define V_SS_TEXT(X)             V_SS_UNION(X, TextVal)
#define V_SS_NTEXT(X)            V_SS_UNION(X, NTextVal)

//Microsoft SQL Server 2008 datetime.
#define V_SS_DATE(X)             V_SS_UNION(X, dDateVal)
#define V_SS_TIME2(X)            V_SS_UNION(X, Time2Val)
#define V_SS_DATETIME2(X)        V_SS_UNION(X, DateTimeVal)
#define V_SS_DATETIMEOFFSET(X)   V_SS_UNION(X, DateTimeOffsetVal)

//-------------------------------------------------------------------
// define SQL Server specific types.
//-------------------------------------------------------------------
typedef enum DBTYPEENUM EOledbTypes;
#define DBTYPE_XML               ((EOledbTypes) 141) // introduced in SQL 2005
#define DBTYPE_TABLE             ((EOledbTypes) 143) // introduced in SQL 2008
#define DBTYPE_DBTIME2           ((EOledbTypes) 145) // introduced in SQL 2008
#define DBTYPE_DBTIMESTAMPOFFSET ((EOledbTypes) 146) // introduced in SQL 2008
#ifdef  _SQLOLEDB_H_
#undef DBTYPE_SQLVARIANT
#endif //_SQLOLEDB_H_
#define DBTYPE_SQLVARIANT        ((EOledbTypes) 144) // introduced in MDAC 2.5


#ifndef  _SQLOLEDB_H_
enum SQLVARENUM
    {
    VT_SS_EMPTY = DBTYPE_EMPTY,
    VT_SS_NULL = DBTYPE_NULL,
    VT_SS_UI1 = DBTYPE_UI1,
    VT_SS_I2 = DBTYPE_I2,
    VT_SS_I4 = DBTYPE_I4,
    VT_SS_I8 = DBTYPE_I8,

    //Floats
    VT_SS_R4  = DBTYPE_R4,
    VT_SS_R8 = DBTYPE_R8,

    //Money
    VT_SS_MONEY = DBTYPE_CY,
    VT_SS_SMALLMONEY  = 200,

    //Strings
    VT_SS_WSTRING    = 201,
    VT_SS_WVARSTRING = 202,

    VT_SS_STRING     = 203,
    VT_SS_VARSTRING  = 204,

    //Bit
    VT_SS_BIT        = DBTYPE_BOOL,

    //Guid
    VT_SS_GUID       = DBTYPE_GUID,

    //Exact precision
    VT_SS_NUMERIC    = DBTYPE_NUMERIC,
    VT_SS_DECIMAL    = 205,

    //Datetime
    VT_SS_DATETIME      = DBTYPE_DBTIMESTAMP,
    VT_SS_SMALLDATETIME =206,

    //Binary
    VT_SS_BINARY =207,
    VT_SS_VARBINARY = 208,
    //Future
    VT_SS_UNKNOWN   = 209,

    //Additional datetime
    VT_SS_DATE = DBTYPE_DBDATE,
    VT_SS_TIME2 = DBTYPE_DBTIME2,
    VT_SS_DATETIME2 = 212,
    VT_SS_DATETIMEOFFSET = DBTYPE_DBTIMESTAMPOFFSET,
    };
typedef unsigned short SSVARTYPE;


enum DBPARAMFLAGSENUM_SS_100
    {
        DBPARAMFLAGS_SS_ISVARIABLESCALE	= 0x40000000
    } ;
enum DBCOLUMNFLAGSENUM_SS_100
    {   DBCOLUMNFLAGS_SS_ISVARIABLESCALE    = 0x40000000,
        DBCOLUMNFLAGS_SS_ISCOLUMNSET        = 0x80000000
    } ;

//-------------------------------------------------------------------
// Class Factory Interface used to initialize pointer to UMS.
//-------------------------------------------------------------------


extern RPC_IF_HANDLE __MIDL_itf_msoledbsql_0000_0001_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_msoledbsql_0000_0001_v0_0_s_ifspec;

#ifndef __IUMSInitialize_INTERFACE_DEFINED__
#define __IUMSInitialize_INTERFACE_DEFINED__

/* interface IUMSInitialize */
/* [unique][uuid][object][local] */ 


EXTERN_C const IID IID_IUMSInitialize;

#if defined(__cplusplus) && !defined(CINTERFACE)
    
    MIDL_INTERFACE("5cf4ca14-ef21-11d0-97e7-00c04fc2ad98")
    IUMSInitialize : public IUnknown
    {
    public:
        virtual HRESULT STDMETHODCALLTYPE Initialize( 
            /* [in] */ void *pUMS) = 0;
        
    };
    
    
#else 	/* C style interface */

    typedef struct IUMSInitializeVtbl
    {
        BEGIN_INTERFACE
        
        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
            IUMSInitialize * This,
            /* [in] */ REFIID riid,
            /* [annotation][iid_is][out] */ 
            _COM_Outptr_  void **ppvObject);
        
        ULONG ( STDMETHODCALLTYPE *AddRef )( 
            IUMSInitialize * This);
        
        ULONG ( STDMETHODCALLTYPE *Release )( 
            IUMSInitialize * This);
        
        HRESULT ( STDMETHODCALLTYPE *Initialize )( 
            IUMSInitialize * This,
            /* [in] */ void *pUMS);
        
        END_INTERFACE
    } IUMSInitializeVtbl;

    interface IUMSInitialize
    {
        CONST_VTBL struct IUMSInitializeVtbl *lpVtbl;
    };

    

#ifdef COBJMACROS


#define IUMSInitialize_QueryInterface(This,riid,ppvObject)	\
    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

#define IUMSInitialize_AddRef(This)	\
    ( (This)->lpVtbl -> AddRef(This) ) 

#define IUMSInitialize_Release(This)	\
    ( (This)->lpVtbl -> Release(This) ) 


#define IUMSInitialize_Initialize(This,pUMS)	\
    ( (This)->lpVtbl -> Initialize(This,pUMS) ) 

#endif /* COBJMACROS */


#endif 	/* C style interface */




#endif 	/* __IUMSInitialize_INTERFACE_DEFINED__ */


/* interface __MIDL_itf_msoledbsql_0000_0002 */
/* [local] */ 


// the structure returned by  ISQLServerErrorInfo::GetSQLServerInfo
typedef struct tagSSErrorInfo
    {
    LPOLESTR pwszMessage;
    LPOLESTR pwszServer;
    LPOLESTR pwszProcedure;
    LONG lNative;
    BYTE bState;
    BYTE bClass;
    WORD wLineNumber;
    } 	SSERRORINFO;



extern RPC_IF_HANDLE __MIDL_itf_msoledbsql_0000_0002_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_msoledbsql_0000_0002_v0_0_s_ifspec;

#ifndef __ISQLServerErrorInfo_INTERFACE_DEFINED__
#define __ISQLServerErrorInfo_INTERFACE_DEFINED__

/* interface ISQLServerErrorInfo */
/* [unique][uuid][object][local] */ 


EXTERN_C const IID IID_ISQLServerErrorInfo;

#if defined(__cplusplus) && !defined(CINTERFACE)
    
    MIDL_INTERFACE("5CF4CA12-EF21-11d0-97E7-00C04FC2AD98")
    ISQLServerErrorInfo : public IUnknown
    {
    public:
        virtual HRESULT STDMETHODCALLTYPE GetErrorInfo( 
            /* [out] */ SSERRORINFO **ppErrorInfo,
            /* [annotation][out] */ 
            __deref_out  OLECHAR **ppStringsBuffer) = 0;
        
    };
    
    
#else 	/* C style interface */

    typedef struct ISQLServerErrorInfoVtbl
    {
        BEGIN_INTERFACE
        
        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
            ISQLServerErrorInfo * This,
            /* [in] */ REFIID riid,
            /* [annotation][iid_is][out] */ 
            _COM_Outptr_  void **ppvObject);
        
        ULONG ( STDMETHODCALLTYPE *AddRef )( 
            ISQLServerErrorInfo * This);
        
        ULONG ( STDMETHODCALLTYPE *Release )( 
            ISQLServerErrorInfo * This);
        
        HRESULT ( STDMETHODCALLTYPE *GetErrorInfo )( 
            ISQLServerErrorInfo * This,
            /* [out] */ SSERRORINFO **ppErrorInfo,
            /* [annotation][out] */ 
            __deref_out  OLECHAR **ppStringsBuffer);
        
        END_INTERFACE
    } ISQLServerErrorInfoVtbl;

    interface ISQLServerErrorInfo
    {
        CONST_VTBL struct ISQLServerErrorInfoVtbl *lpVtbl;
    };

    

#ifdef COBJMACROS


#define ISQLServerErrorInfo_QueryInterface(This,riid,ppvObject)	\
    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

#define ISQLServerErrorInfo_AddRef(This)	\
    ( (This)->lpVtbl -> AddRef(This) ) 

#define ISQLServerErrorInfo_Release(This)	\
    ( (This)->lpVtbl -> Release(This) ) 


#define ISQLServerErrorInfo_GetErrorInfo(This,ppErrorInfo,ppStringsBuffer)	\
    ( (This)->lpVtbl -> GetErrorInfo(This,ppErrorInfo,ppStringsBuffer) ) 

#endif /* COBJMACROS */


#endif 	/* C style interface */




#endif 	/* __ISQLServerErrorInfo_INTERFACE_DEFINED__ */


#ifndef __IRowsetFastLoad_INTERFACE_DEFINED__
#define __IRowsetFastLoad_INTERFACE_DEFINED__

/* interface IRowsetFastLoad */
/* [unique][uuid][object][local] */ 


EXTERN_C const IID IID_IRowsetFastLoad;

#if defined(__cplusplus) && !defined(CINTERFACE)
    
    MIDL_INTERFACE("5CF4CA13-EF21-11d0-97E7-00C04FC2AD98")
    IRowsetFastLoad : public IUnknown
    {
    public:
        virtual HRESULT STDMETHODCALLTYPE InsertRow( 
            /* [in] */ HACCESSOR hAccessor,
            /* [in] */ void *pData) = 0;
        
        virtual HRESULT STDMETHODCALLTYPE Commit( 
            /* [in] */ BOOL fDone) = 0;
        
    };
    
    
#else 	/* C style interface */

    typedef struct IRowsetFastLoadVtbl
    {
        BEGIN_INTERFACE
        
        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
            IRowsetFastLoad * This,
            /* [in] */ REFIID riid,
            /* [annotation][iid_is][out] */ 
            _COM_Outptr_  void **ppvObject);
        
        ULONG ( STDMETHODCALLTYPE *AddRef )( 
            IRowsetFastLoad * This);
        
        ULONG ( STDMETHODCALLTYPE *Release )( 
            IRowsetFastLoad * This);
        
        HRESULT ( STDMETHODCALLTYPE *InsertRow )( 
            IRowsetFastLoad * This,
            /* [in] */ HACCESSOR hAccessor,
            /* [in] */ void *pData);
        
        HRESULT ( STDMETHODCALLTYPE *Commit )( 
            IRowsetFastLoad * This,
            /* [in] */ BOOL fDone);
        
        END_INTERFACE
    } IRowsetFastLoadVtbl;

    interface IRowsetFastLoad
    {
        CONST_VTBL struct IRowsetFastLoadVtbl *lpVtbl;
    };

    

#ifdef COBJMACROS


#define IRowsetFastLoad_QueryInterface(This,riid,ppvObject)	\
    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

#define IRowsetFastLoad_AddRef(This)	\
    ( (This)->lpVtbl -> AddRef(This) ) 

#define IRowsetFastLoad_Release(This)	\
    ( (This)->lpVtbl -> Release(This) ) 


#define IRowsetFastLoad_InsertRow(This,hAccessor,pData)	\
    ( (This)->lpVtbl -> InsertRow(This,hAccessor,pData) ) 

#define IRowsetFastLoad_Commit(This,fDone)	\
    ( (This)->lpVtbl -> Commit(This,fDone) ) 

#endif /* COBJMACROS */


#endif 	/* C style interface */




#endif 	/* __IRowsetFastLoad_INTERFACE_DEFINED__ */


/* interface __MIDL_itf_msoledbsql_0000_0004 */
/* [local] */ 

#include <pshpack8.h>    // 8-byte structure packing

typedef struct tagDBTIME2
    {
    USHORT hour;
    USHORT minute;
    USHORT second;
    ULONG fraction;
    } 	DBTIME2;

typedef struct tagDBTIMESTAMPOFFSET
    {
    SHORT year;
    USHORT month;
    USHORT day;
    USHORT hour;
    USHORT minute;
    USHORT second;
    ULONG fraction;
    SHORT timezone_hour;
    SHORT timezone_minute;
    } 	DBTIMESTAMPOFFSET;

#include <poppack.h>     // restore original structure packing

// sensitivity classification metadata structures
typedef 
enum tagSENSITIVITYRANKENUM
    {
        SENSITIVITYRANK_NOT_DEFINED	= -1,
        SENSITIVITYRANK_NONE	= 0,
        SENSITIVITYRANK_LOW	= 10,
        SENSITIVITYRANK_MEDIUM	= 20,
        SENSITIVITYRANK_HIGH	= 30,
        SENSITIVITYRANK_CRITICAL	= 40
    } 	SENSITIVITYRANKENUM;

typedef struct tagSENSITIVITYLABEL
    {
    LPOLESTR pwszName;
    LPOLESTR pwszId;
    } 	SENSITIVITYLABEL;

typedef struct tagINFORMATIONTYPE
    {
    LPOLESTR pwszName;
    LPOLESTR pwszId;
    } 	INFORMATIONTYPE;

typedef struct tagSENSITIVITYPROPERTY
    {
    SENSITIVITYLABEL *pSensitivityLabel;
    INFORMATIONTYPE *pInformationType;
    SENSITIVITYRANKENUM eSensitivityRank;
    } 	SENSITIVITYPROPERTY;

typedef struct tagCOLUMNSENSITIVITYMETADATA
    {
    SENSITIVITYPROPERTY *rgSensitivityProperties;
    USHORT cSensitivityProperties;
    } 	COLUMNSENSITIVITYMETADATA;

typedef struct tagSensitivityClassification
    {
    USHORT cSensitivityLabels;
    SENSITIVITYLABEL *rgSensitivityLabels;
    USHORT cInformationTypes;
    INFORMATIONTYPE *rgInformationTypes;
    USHORT cColumnSensitivityMetadata;
    COLUMNSENSITIVITYMETADATA *rgColumnSensitivityMetadata;
    SENSITIVITYRANKENUM eQuerySensitivityRank;
    } 	SENSITIVITYCLASSIFICATION;

// End of sensitivity classification metadata structures

struct SSVARIANT
    {
    SSVARTYPE vt;
    DWORD dwReserved1;
    DWORD dwReserved2;
    union 
        {
        BYTE bTinyIntVal;
        SHORT sShortIntVal;
        LONG lIntVal;
        LONGLONG llBigIntVal;
        FLOAT fltRealVal;
        DOUBLE dblFloatVal;
        CY cyMoneyVal;
        VARIANT_BOOL fBitVal;
        BYTE rgbGuidVal[ 16 ];
        DB_NUMERIC numNumericVal;
        DBDATE dDateVal;
        DBTIMESTAMP tsDateTimeVal;
        struct _Time2Val
            {
            DBTIME2 tTime2Val;
            BYTE bScale;
            } 	Time2Val;
        struct _DateTimeVal
            {
            DBTIMESTAMP tsDateTimeVal;
            BYTE bScale;
            } 	DateTimeVal;
        struct _DateTimeOffsetVal
            {
            DBTIMESTAMPOFFSET tsoDateTimeOffsetVal;
            BYTE bScale;
            } 	DateTimeOffsetVal;
        struct _NCharVal
            {
            SHORT sActualLength;
            SHORT sMaxLength;
            WCHAR *pwchNCharVal;
            BYTE rgbReserved[ 5 ];
            DWORD dwReserved;
            WCHAR *pwchReserved;
            } 	NCharVal;
        struct _CharVal
            {
            SHORT sActualLength;
            SHORT sMaxLength;
            CHAR *pchCharVal;
            BYTE rgbReserved[ 5 ];
            DWORD dwReserved;
            WCHAR *pwchReserved;
            } 	CharVal;
        struct _BinaryVal
            {
            SHORT sActualLength;
            SHORT sMaxLength;
            BYTE *prgbBinaryVal;
            DWORD dwReserved;
            } 	BinaryVal;
        struct _UnknownType
            {
            DWORD dwActualLength;
            BYTE rgMetadata[ 16 ];
            BYTE *pUnknownData;
            } 	UnknownType;
        struct _BLOBType
            {
            DBOBJECT dbobj;
            IUnknown *pUnk;
            } 	BLOBType;
        } 	;
    } ;
typedef DWORD LOCKMODE;


enum LOCKMODEENUM
    {
        LOCKMODE_INVALID	= 0,
        LOCKMODE_EXCLUSIVE	= ( LOCKMODE_INVALID + 1 ) ,
        LOCKMODE_SHARED	= ( LOCKMODE_EXCLUSIVE + 1 ) 
    } ;


extern RPC_IF_HANDLE __MIDL_itf_msoledbsql_0000_0004_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_msoledbsql_0000_0004_v0_0_s_ifspec;

#ifndef __ISchemaLock_INTERFACE_DEFINED__
#define __ISchemaLock_INTERFACE_DEFINED__

/* interface ISchemaLock */
/* [unique][uuid][object][local] */ 


EXTERN_C const IID IID_ISchemaLock;

#if defined(__cplusplus) && !defined(CINTERFACE)
    
    MIDL_INTERFACE("4C2389FB-2511-11d4-B258-00C04F7971CE")
    ISchemaLock : public IUnknown
    {
    public:
        virtual HRESULT STDMETHODCALLTYPE GetSchemaLock( 
            /* [in] */ DBID *pTableID,
            /* [in] */ LOCKMODE lmMode,
            /* [out] */ HANDLE *phLockHandle,
            /* [out] */ ULONGLONG *pTableVersion) = 0;
        
        virtual HRESULT STDMETHODCALLTYPE ReleaseSchemaLock( 
            /* [in] */ HANDLE hLockHandle) = 0;
        
    };
    
    
#else 	/* C style interface */

    typedef struct ISchemaLockVtbl
    {
        BEGIN_INTERFACE
        
        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
            ISchemaLock * This,
            /* [in] */ REFIID riid,
            /* [annotation][iid_is][out] */ 
            _COM_Outptr_  void **ppvObject);
        
        ULONG ( STDMETHODCALLTYPE *AddRef )( 
            ISchemaLock * This);
        
        ULONG ( STDMETHODCALLTYPE *Release )( 
            ISchemaLock * This);
        
        HRESULT ( STDMETHODCALLTYPE *GetSchemaLock )( 
            ISchemaLock * This,
            /* [in] */ DBID *pTableID,
            /* [in] */ LOCKMODE lmMode,
            /* [out] */ HANDLE *phLockHandle,
            /* [out] */ ULONGLONG *pTableVersion);
        
        HRESULT ( STDMETHODCALLTYPE *ReleaseSchemaLock )( 
            ISchemaLock * This,
            /* [in] */ HANDLE hLockHandle);
        
        END_INTERFACE
    } ISchemaLockVtbl;

    interface ISchemaLock
    {
        CONST_VTBL struct ISchemaLockVtbl *lpVtbl;
    };

    

#ifdef COBJMACROS


#define ISchemaLock_QueryInterface(This,riid,ppvObject)	\
    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

#define ISchemaLock_AddRef(This)	\
    ( (This)->lpVtbl -> AddRef(This) ) 

#define ISchemaLock_Release(This)	\
    ( (This)->lpVtbl -> Release(This) ) 


#define ISchemaLock_GetSchemaLock(This,pTableID,lmMode,phLockHandle,pTableVersion)	\
    ( (This)->lpVtbl -> GetSchemaLock(This,pTableID,lmMode,phLockHandle,pTableVersion) ) 

#define ISchemaLock_ReleaseSchemaLock(This,hLockHandle)	\
    ( (This)->lpVtbl -> ReleaseSchemaLock(This,hLockHandle) ) 

#endif /* COBJMACROS */


#endif 	/* C style interface */




#endif 	/* __ISchemaLock_INTERFACE_DEFINED__ */


#ifndef __IBCPSession_INTERFACE_DEFINED__
#define __IBCPSession_INTERFACE_DEFINED__

/* interface IBCPSession */
/* [unique][uuid][object][local] */ 


EXTERN_C const IID IID_IBCPSession;

#if defined(__cplusplus) && !defined(CINTERFACE)
    
    MIDL_INTERFACE("88352D80-42D1-42f0-A170-AB0F8B45B939")
    IBCPSession : public IUnknown
    {
    public:
        virtual HRESULT STDMETHODCALLTYPE BCPColFmt( 
            /* [in] */ DBORDINAL idxUserDataCol,
            /* [in] */ int eUserDataType,
            /* [in] */ int cbIndicator,
            /* [in] */ int cbUserData,
            /* [size_is][in] */ BYTE *pbUserDataTerm,
            /* [in] */ int cbUserDataTerm,
            /* [in] */ DBORDINAL idxServerCol) = 0;
        
        virtual HRESULT STDMETHODCALLTYPE BCPColumns( 
            /* [in] */ DBCOUNTITEM nColumns) = 0;
        
        virtual HRESULT STDMETHODCALLTYPE BCPControl( 
            /* [in] */ int eOption,
            /* [in] */ void *iValue) = 0;
        
        virtual HRESULT STDMETHODCALLTYPE BCPDone( void) = 0;
        
        virtual HRESULT STDMETHODCALLTYPE BCPExec( 
            /* [out] */ DBROWCOUNT *pRowsCopied) = 0;
        
        virtual HRESULT STDMETHODCALLTYPE BCPInit( 
            /* [string][in] */ const wchar_t *pwszTable,
            /* [string][in] */ const wchar_t *pwszDataFile,
            /* [string][in] */ const wchar_t *pwszErrorFile,
            /* [in] */ int eDirection) = 0;
        
        virtual HRESULT STDMETHODCALLTYPE BCPReadFmt( 
            /* [string][in] */ const wchar_t *pwszFormatFile) = 0;
        
        virtual HRESULT STDMETHODCALLTYPE BCPWriteFmt( 
            /* [string][in] */ const wchar_t *pwszFormatFile) = 0;
        
    };
    
    
#else 	/* C style interface */

    typedef struct IBCPSessionVtbl
    {
        BEGIN_INTERFACE
        
        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
            IBCPSession * This,
            /* [in] */ REFIID riid,
            /* [annotation][iid_is][out] */ 
            _COM_Outptr_  void **ppvObject);
        
        ULONG ( STDMETHODCALLTYPE *AddRef )( 
            IBCPSession * This);
        
        ULONG ( STDMETHODCALLTYPE *Release )( 
            IBCPSession * This);
        
        HRESULT ( STDMETHODCALLTYPE *BCPColFmt )( 
            IBCPSession * This,
            /* [in] */ DBORDINAL idxUserDataCol,
            /* [in] */ int eUserDataType,
            /* [in] */ int cbIndicator,
            /* [in] */ int cbUserData,
            /* [size_is][in] */ BYTE *pbUserDataTerm,
            /* [in] */ int cbUserDataTerm,
            /* [in] */ DBORDINAL idxServerCol);
        
        HRESULT ( STDMETHODCALLTYPE *BCPColumns )( 
            IBCPSession * This,
            /* [in] */ DBCOUNTITEM nColumns);
        
        HRESULT ( STDMETHODCALLTYPE *BCPControl )( 
            IBCPSession * This,
            /* [in] */ int eOption,
            /* [in] */ void *iValue);
        
        HRESULT ( STDMETHODCALLTYPE *BCPDone )( 
            IBCPSession * This);
        
        HRESULT ( STDMETHODCALLTYPE *BCPExec )( 
            IBCPSession * This,
            /* [out] */ DBROWCOUNT *pRowsCopied);
        
        HRESULT ( STDMETHODCALLTYPE *BCPInit )( 
            IBCPSession * This,
            /* [string][in] */ const wchar_t *pwszTable,
            /* [string][in] */ const wchar_t *pwszDataFile,
            /* [string][in] */ const wchar_t *pwszErrorFile,
            /* [in] */ int eDirection);
        
        HRESULT ( STDMETHODCALLTYPE *BCPReadFmt )( 
            IBCPSession * This,
            /* [string][in] */ const wchar_t *pwszFormatFile);
        
        HRESULT ( STDMETHODCALLTYPE *BCPWriteFmt )( 
            IBCPSession * This,
            /* [string][in] */ const wchar_t *pwszFormatFile);
        
        END_INTERFACE
    } IBCPSessionVtbl;

    interface IBCPSession
    {
        CONST_VTBL struct IBCPSessionVtbl *lpVtbl;
    };

    

#ifdef COBJMACROS


#define IBCPSession_QueryInterface(This,riid,ppvObject)	\
    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

#define IBCPSession_AddRef(This)	\
    ( (This)->lpVtbl -> AddRef(This) ) 

#define IBCPSession_Release(This)	\
    ( (This)->lpVtbl -> Release(This) ) 


#define IBCPSession_BCPColFmt(This,idxUserDataCol,eUserDataType,cbIndicator,cbUserData,pbUserDataTerm,cbUserDataTerm,idxServerCol)	\
    ( (This)->lpVtbl -> BCPColFmt(This,idxUserDataCol,eUserDataType,cbIndicator,cbUserData,pbUserDataTerm,cbUserDataTerm,idxServerCol) ) 

#define IBCPSession_BCPColumns(This,nColumns)	\
    ( (This)->lpVtbl -> BCPColumns(This,nColumns) ) 

#define IBCPSession_BCPControl(This,eOption,iValue)	\
    ( (This)->lpVtbl -> BCPControl(This,eOption,iValue) ) 

#define IBCPSession_BCPDone(This)	\
    ( (This)->lpVtbl -> BCPDone(This) ) 

#define IBCPSession_BCPExec(This,pRowsCopied)	\
    ( (This)->lpVtbl -> BCPExec(This,pRowsCopied) ) 

#define IBCPSession_BCPInit(This,pwszTable,pwszDataFile,pwszErrorFile,eDirection)	\
    ( (This)->lpVtbl -> BCPInit(This,pwszTable,pwszDataFile,pwszErrorFile,eDirection) ) 

#define IBCPSession_BCPReadFmt(This,pwszFormatFile)	\
    ( (This)->lpVtbl -> BCPReadFmt(This,pwszFormatFile) ) 

#define IBCPSession_BCPWriteFmt(This,pwszFormatFile)	\
    ( (This)->lpVtbl -> BCPWriteFmt(This,pwszFormatFile) ) 

#endif /* COBJMACROS */


#endif 	/* C style interface */




#endif 	/* __IBCPSession_INTERFACE_DEFINED__ */


#ifndef __IBCPSession2_INTERFACE_DEFINED__
#define __IBCPSession2_INTERFACE_DEFINED__

/* interface IBCPSession2 */
/* [unique][uuid][object][local] */ 


EXTERN_C const IID IID_IBCPSession2;

#if defined(__cplusplus) && !defined(CINTERFACE)
    
    MIDL_INTERFACE("AD79D3B6-59DD-46a3-BFC6-E62A65FF3523")
    IBCPSession2 : public IBCPSession
    {
    public:
        virtual HRESULT STDMETHODCALLTYPE BCPSetBulkMode( 
            /* [in] */ int property,
            /* [size_is][in] */ void *pField,
            /* [in] */ int cbField,
            /* [size_is][in] */ void *pRow,
            /* [in] */ int cbRow) = 0;
        
    };
    
    
#else 	/* C style interface */

    typedef struct IBCPSession2Vtbl
    {
        BEGIN_INTERFACE
        
        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
            IBCPSession2 * This,
            /* [in] */ REFIID riid,
            /* [annotation][iid_is][out] */ 
            _COM_Outptr_  void **ppvObject);
        
        ULONG ( STDMETHODCALLTYPE *AddRef )( 
            IBCPSession2 * This);
        
        ULONG ( STDMETHODCALLTYPE *Release )( 
            IBCPSession2 * This);
        
        HRESULT ( STDMETHODCALLTYPE *BCPColFmt )( 
            IBCPSession2 * This,
            /* [in] */ DBORDINAL idxUserDataCol,
            /* [in] */ int eUserDataType,
            /* [in] */ int cbIndicator,
            /* [in] */ int cbUserData,
            /* [size_is][in] */ BYTE *pbUserDataTerm,
            /* [in] */ int cbUserDataTerm,
            /* [in] */ DBORDINAL idxServerCol);
        
        HRESULT ( STDMETHODCALLTYPE *BCPColumns )( 
            IBCPSession2 * This,
            /* [in] */ DBCOUNTITEM nColumns);
        
        HRESULT ( STDMETHODCALLTYPE *BCPControl )( 
            IBCPSession2 * This,
            /* [in] */ int eOption,
            /* [in] */ void *iValue);
        
        HRESULT ( STDMETHODCALLTYPE *BCPDone )( 
            IBCPSession2 * This);
        
        HRESULT ( STDMETHODCALLTYPE *BCPExec )( 
            IBCPSession2 * This,
            /* [out] */ DBROWCOUNT *pRowsCopied);
        
        HRESULT ( STDMETHODCALLTYPE *BCPInit )( 
            IBCPSession2 * This,
            /* [string][in] */ const wchar_t *pwszTable,
            /* [string][in] */ const wchar_t *pwszDataFile,
            /* [string][in] */ const wchar_t *pwszErrorFile,
            /* [in] */ int eDirection);
        
        HRESULT ( STDMETHODCALLTYPE *BCPReadFmt )( 
            IBCPSession2 * This,
            /* [string][in] */ const wchar_t *pwszFormatFile);
        
        HRESULT ( STDMETHODCALLTYPE *BCPWriteFmt )( 
            IBCPSession2 * This,
            /* [string][in] */ const wchar_t *pwszFormatFile);
        
        HRESULT ( STDMETHODCALLTYPE *BCPSetBulkMode )( 
            IBCPSession2 * This,
            /* [in] */ int property,
            /* [size_is][in] */ void *pField,
            /* [in] */ int cbField,
            /* [size_is][in] */ void *pRow,
            /* [in] */ int cbRow);
        
        END_INTERFACE
    } IBCPSession2Vtbl;

    interface IBCPSession2
    {
        CONST_VTBL struct IBCPSession2Vtbl *lpVtbl;
    };

    

#ifdef COBJMACROS


#define IBCPSession2_QueryInterface(This,riid,ppvObject)	\
    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

#define IBCPSession2_AddRef(This)	\
    ( (This)->lpVtbl -> AddRef(This) ) 

#define IBCPSession2_Release(This)	\
    ( (This)->lpVtbl -> Release(This) ) 


#define IBCPSession2_BCPColFmt(This,idxUserDataCol,eUserDataType,cbIndicator,cbUserData,pbUserDataTerm,cbUserDataTerm,idxServerCol)	\
    ( (This)->lpVtbl -> BCPColFmt(This,idxUserDataCol,eUserDataType,cbIndicator,cbUserData,pbUserDataTerm,cbUserDataTerm,idxServerCol) ) 

#define IBCPSession2_BCPColumns(This,nColumns)	\
    ( (This)->lpVtbl -> BCPColumns(This,nColumns) ) 

#define IBCPSession2_BCPControl(This,eOption,iValue)	\
    ( (This)->lpVtbl -> BCPControl(This,eOption,iValue) ) 

#define IBCPSession2_BCPDone(This)	\
    ( (This)->lpVtbl -> BCPDone(This) ) 

#define IBCPSession2_BCPExec(This,pRowsCopied)	\
    ( (This)->lpVtbl -> BCPExec(This,pRowsCopied) ) 

#define IBCPSession2_BCPInit(This,pwszTable,pwszDataFile,pwszErrorFile,eDirection)	\
    ( (This)->lpVtbl -> BCPInit(This,pwszTable,pwszDataFile,pwszErrorFile,eDirection) ) 

#define IBCPSession2_BCPReadFmt(This,pwszFormatFile)	\
    ( (This)->lpVtbl -> BCPReadFmt(This,pwszFormatFile) ) 

#define IBCPSession2_BCPWriteFmt(This,pwszFormatFile)	\
    ( (This)->lpVtbl -> BCPWriteFmt(This,pwszFormatFile) ) 


#define IBCPSession2_BCPSetBulkMode(This,property,pField,cbField,pRow,cbRow)	\
    ( (This)->lpVtbl -> BCPSetBulkMode(This,property,pField,cbField,pRow,cbRow) ) 

#endif /* COBJMACROS */


#endif 	/* C style interface */




#endif 	/* __IBCPSession2_INTERFACE_DEFINED__ */


/* interface __MIDL_itf_msoledbsql_0000_0007 */
/* [local] */ 


#endif //_SQLOLEDB_H_

#define ISOLATIONLEVEL_SNAPSHOT          ((ISOLATIONLEVEL)(0x01000000)) // Changes made in other transactions can not be seen.

#define DBPROPVAL_TI_SNAPSHOT            0x01000000L



extern RPC_IF_HANDLE __MIDL_itf_msoledbsql_0000_0007_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_msoledbsql_0000_0007_v0_0_s_ifspec;

#ifndef __ISSAbort_INTERFACE_DEFINED__
#define __ISSAbort_INTERFACE_DEFINED__

/* interface ISSAbort */
/* [unique][uuid][object][local] */ 


EXTERN_C const IID IID_ISSAbort;

#if defined(__cplusplus) && !defined(CINTERFACE)
    
    MIDL_INTERFACE("5CF4CA15-EF21-11d0-97E7-00C04FC2AD98")
    ISSAbort : public IUnknown
    {
    public:
        virtual HRESULT STDMETHODCALLTYPE Abort( void) = 0;
        
    };
    
    
#else 	/* C style interface */

    typedef struct ISSAbortVtbl
    {
        BEGIN_INTERFACE
        
        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
            ISSAbort * This,
            /* [in] */ REFIID riid,
            /* [annotation][iid_is][out] */ 
            _COM_Outptr_  void **ppvObject);
        
        ULONG ( STDMETHODCALLTYPE *AddRef )( 
            ISSAbort * This);
        
        ULONG ( STDMETHODCALLTYPE *Release )( 
            ISSAbort * This);
        
        HRESULT ( STDMETHODCALLTYPE *Abort )( 
            ISSAbort * This);
        
        END_INTERFACE
    } ISSAbortVtbl;

    interface ISSAbort
    {
        CONST_VTBL struct ISSAbortVtbl *lpVtbl;
    };

    

#ifdef COBJMACROS


#define ISSAbort_QueryInterface(This,riid,ppvObject)	\
    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

#define ISSAbort_AddRef(This)	\
    ( (This)->lpVtbl -> AddRef(This) ) 

#define ISSAbort_Release(This)	\
    ( (This)->lpVtbl -> Release(This) ) 


#define ISSAbort_Abort(This)	\
    ( (This)->lpVtbl -> Abort(This) ) 

#endif /* COBJMACROS */


#endif 	/* C style interface */




#endif 	/* __ISSAbort_INTERFACE_DEFINED__ */


#ifndef __ISSDataClassification_INTERFACE_DEFINED__
#define __ISSDataClassification_INTERFACE_DEFINED__

/* interface ISSDataClassification */
/* [unique][uuid][object][local] */ 


EXTERN_C const IID IID_ISSDataClassification;

#if defined(__cplusplus) && !defined(CINTERFACE)
    
    MIDL_INTERFACE("1DD0C83E-5C8F-4D39-82DA-E326B7AF834C")
    ISSDataClassification : public IUnknown
    {
    public:
        virtual HRESULT STDMETHODCALLTYPE GetSensitivityClassification( 
            SENSITIVITYCLASSIFICATION **ppSensitivityClassification) = 0;
        
    };
    
    
#else 	/* C style interface */

    typedef struct ISSDataClassificationVtbl
    {
        BEGIN_INTERFACE
        
        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
            ISSDataClassification * This,
            /* [in] */ REFIID riid,
            /* [annotation][iid_is][out] */ 
            _COM_Outptr_  void **ppvObject);
        
        ULONG ( STDMETHODCALLTYPE *AddRef )( 
            ISSDataClassification * This);
        
        ULONG ( STDMETHODCALLTYPE *Release )( 
            ISSDataClassification * This);
        
        HRESULT ( STDMETHODCALLTYPE *GetSensitivityClassification )( 
            ISSDataClassification * This,
            SENSITIVITYCLASSIFICATION **ppSensitivityClassification);
        
        END_INTERFACE
    } ISSDataClassificationVtbl;

    interface ISSDataClassification
    {
        CONST_VTBL struct ISSDataClassificationVtbl *lpVtbl;
    };

    

#ifdef COBJMACROS


#define ISSDataClassification_QueryInterface(This,riid,ppvObject)	\
    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

#define ISSDataClassification_AddRef(This)	\
    ( (This)->lpVtbl -> AddRef(This) ) 

#define ISSDataClassification_Release(This)	\
    ( (This)->lpVtbl -> Release(This) ) 


#define ISSDataClassification_GetSensitivityClassification(This,ppSensitivityClassification)	\
    ( (This)->lpVtbl -> GetSensitivityClassification(This,ppSensitivityClassification) ) 

#endif /* COBJMACROS */


#endif 	/* C style interface */




#endif 	/* __ISSDataClassification_INTERFACE_DEFINED__ */


/* interface __MIDL_itf_msoledbsql_0000_0009 */
/* [local] */ 


enum DBBINDFLAGENUM90
    {
        DBBINDFLAG_OBJECT	= 0x2
    } ;

enum SSACCESSORFLAGS
    {
        SSACCESSOR_ROWDATA	= 0x100
    } ;

enum DBPROPFLAGSENUM90
    {
        DBPROPFLAGS_PARAMETER	= 0x10000
    } ;
typedef struct tagSSPARAMPROPS
    {
    DBORDINAL iOrdinal;
    ULONG cPropertySets;
    /* [size_is] */ DBPROPSET *rgPropertySets;
    } 	SSPARAMPROPS;



extern RPC_IF_HANDLE __MIDL_itf_msoledbsql_0000_0009_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_msoledbsql_0000_0009_v0_0_s_ifspec;

#ifndef __ISSCommandWithParameters_INTERFACE_DEFINED__
#define __ISSCommandWithParameters_INTERFACE_DEFINED__

/* interface ISSCommandWithParameters */
/* [unique][uuid][object][local] */ 


EXTERN_C const IID IID_ISSCommandWithParameters;

#if defined(__cplusplus) && !defined(CINTERFACE)
    
    MIDL_INTERFACE("eec30162-6087-467c-b995-7c523ce96561")
    ISSCommandWithParameters : public ICommandWithParameters
    {
    public:
        virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetParameterProperties( 
            /* [out][in] */ DB_UPARAMS *pcParams,
            /* [size_is][size_is][out] */ SSPARAMPROPS **prgParamProperties) = 0;
        
        virtual /* [local] */ HRESULT STDMETHODCALLTYPE SetParameterProperties( 
            /* [in] */ DB_UPARAMS cParams,
            /* [size_is][unique][in] */ SSPARAMPROPS rgParamProperties[  ]) = 0;
        
    };
    
    
#else 	/* C style interface */

    typedef struct ISSCommandWithParametersVtbl
    {
        BEGIN_INTERFACE
        
        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
            ISSCommandWithParameters * This,
            /* [in] */ REFIID riid,
            /* [annotation][iid_is][out] */ 
            _COM_Outptr_  void **ppvObject);
        
        ULONG ( STDMETHODCALLTYPE *AddRef )( 
            ISSCommandWithParameters * This);
        
        ULONG ( STDMETHODCALLTYPE *Release )( 
            ISSCommandWithParameters * This);
        
        /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetParameterInfo )( 
            ISSCommandWithParameters * This,
            /* [out][in] */ DB_UPARAMS *pcParams,
            /* [size_is][size_is][out] */ DBPARAMINFO **prgParamInfo,
            /* [out] */ OLECHAR **ppNamesBuffer);
        
        /* [local] */ HRESULT ( STDMETHODCALLTYPE *MapParameterNames )( 
            ISSCommandWithParameters * This,
            /* [in] */ DB_UPARAMS cParamNames,
            /* [size_is][in] */ const OLECHAR *rgParamNames[  ],
            /* [size_is][out] */ DB_LPARAMS rgParamOrdinals[  ]);
        
        /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetParameterInfo )( 
            ISSCommandWithParameters * This,
            /* [in] */ DB_UPARAMS cParams,
            /* [size_is][unique][in] */ const DB_UPARAMS rgParamOrdinals[  ],
            /* [size_is][unique][in] */ const DBPARAMBINDINFO rgParamBindInfo[  ]);
        
        /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetParameterProperties )( 
            ISSCommandWithParameters * This,
            /* [out][in] */ DB_UPARAMS *pcParams,
            /* [size_is][size_is][out] */ SSPARAMPROPS **prgParamProperties);
        
        /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetParameterProperties )( 
            ISSCommandWithParameters * This,
            /* [in] */ DB_UPARAMS cParams,
            /* [size_is][unique][in] */ SSPARAMPROPS rgParamProperties[  ]);
        
        END_INTERFACE
    } ISSCommandWithParametersVtbl;

    interface ISSCommandWithParameters
    {
        CONST_VTBL struct ISSCommandWithParametersVtbl *lpVtbl;
    };

    

#ifdef COBJMACROS


#define ISSCommandWithParameters_QueryInterface(This,riid,ppvObject)	\
    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

#define ISSCommandWithParameters_AddRef(This)	\
    ( (This)->lpVtbl -> AddRef(This) ) 

#define ISSCommandWithParameters_Release(This)	\
    ( (This)->lpVtbl -> Release(This) ) 


#define ISSCommandWithParameters_GetParameterInfo(This,pcParams,prgParamInfo,ppNamesBuffer)	\
    ( (This)->lpVtbl -> GetParameterInfo(This,pcParams,prgParamInfo,ppNamesBuffer) ) 

#define ISSCommandWithParameters_MapParameterNames(This,cParamNames,rgParamNames,rgParamOrdinals)	\
    ( (This)->lpVtbl -> MapParameterNames(This,cParamNames,rgParamNames,rgParamOrdinals) ) 

#define ISSCommandWithParameters_SetParameterInfo(This,cParams,rgParamOrdinals,rgParamBindInfo)	\
    ( (This)->lpVtbl -> SetParameterInfo(This,cParams,rgParamOrdinals,rgParamBindInfo) ) 


#define ISSCommandWithParameters_GetParameterProperties(This,pcParams,prgParamProperties)	\
    ( (This)->lpVtbl -> GetParameterProperties(This,pcParams,prgParamProperties) ) 

#define ISSCommandWithParameters_SetParameterProperties(This,cParams,rgParamProperties)	\
    ( (This)->lpVtbl -> SetParameterProperties(This,cParams,rgParamProperties) ) 

#endif /* COBJMACROS */


#endif 	/* C style interface */




#endif 	/* __ISSCommandWithParameters_INTERFACE_DEFINED__ */


#ifndef __IDBAsynchStatus_INTERFACE_DEFINED__
#define __IDBAsynchStatus_INTERFACE_DEFINED__

/* interface IDBAsynchStatus */
/* [unique][uuid][object][local] */ 


EXTERN_C const IID IID_IDBAsynchStatus;

#if defined(__cplusplus) && !defined(CINTERFACE)
    
    MIDL_INTERFACE("0c733a95-2a1c-11ce-ade5-00aa0044773d")
    IDBAsynchStatus : public IUnknown
    {
    public:
        virtual /* [local] */ HRESULT STDMETHODCALLTYPE Abort( 
            /* [in] */ HCHAPTER hChapter,
            /* [in] */ DBASYNCHOP eOperation) = 0;
        
        virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetStatus( 
            /* [in] */ HCHAPTER hChapter,
            /* [in] */ DBASYNCHOP eOperation,
            /* [out] */ DBCOUNTITEM *pulProgress,
            /* [out] */ DBCOUNTITEM *pulProgressMax,
            /* [out] */ DBASYNCHPHASE *peAsynchPhase,
            /* [out] */ LPOLESTR *ppwszStatusText) = 0;
        
    };
    
    
#else 	/* C style interface */

    typedef struct IDBAsynchStatusVtbl
    {
        BEGIN_INTERFACE
        
        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
            IDBAsynchStatus * This,
            /* [in] */ REFIID riid,
            /* [annotation][iid_is][out] */ 
            _COM_Outptr_  void **ppvObject);
        
        ULONG ( STDMETHODCALLTYPE *AddRef )( 
            IDBAsynchStatus * This);
        
        ULONG ( STDMETHODCALLTYPE *Release )( 
            IDBAsynchStatus * This);
        
        /* [local] */ HRESULT ( STDMETHODCALLTYPE *Abort )( 
            IDBAsynchStatus * This,
            /* [in] */ HCHAPTER hChapter,
            /* [in] */ DBASYNCHOP eOperation);
        
        /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetStatus )( 
            IDBAsynchStatus * This,
            /* [in] */ HCHAPTER hChapter,
            /* [in] */ DBASYNCHOP eOperation,
            /* [out] */ DBCOUNTITEM *pulProgress,
            /* [out] */ DBCOUNTITEM *pulProgressMax,
            /* [out] */ DBASYNCHPHASE *peAsynchPhase,
            /* [out] */ LPOLESTR *ppwszStatusText);
        
        END_INTERFACE
    } IDBAsynchStatusVtbl;

    interface IDBAsynchStatus
    {
        CONST_VTBL struct IDBAsynchStatusVtbl *lpVtbl;
    };

    

#ifdef COBJMACROS


#define IDBAsynchStatus_QueryInterface(This,riid,ppvObject)	\
    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

#define IDBAsynchStatus_AddRef(This)	\
    ( (This)->lpVtbl -> AddRef(This) ) 

#define IDBAsynchStatus_Release(This)	\
    ( (This)->lpVtbl -> Release(This) ) 


#define IDBAsynchStatus_Abort(This,hChapter,eOperation)	\
    ( (This)->lpVtbl -> Abort(This,hChapter,eOperation) ) 

#define IDBAsynchStatus_GetStatus(This,hChapter,eOperation,pulProgress,pulProgressMax,peAsynchPhase,ppwszStatusText)	\
    ( (This)->lpVtbl -> GetStatus(This,hChapter,eOperation,pulProgress,pulProgressMax,peAsynchPhase,ppwszStatusText) ) 

#endif /* COBJMACROS */


#endif 	/* C style interface */



/* [call_as] */ HRESULT STDMETHODCALLTYPE IDBAsynchStatus_RemoteAbort_Proxy( 
    IDBAsynchStatus * This,
    /* [in] */ HCHAPTER hChapter,
    /* [in] */ DBASYNCHOP eOperation,
    /* [out] */ IErrorInfo **ppErrorInfoRem);


void __RPC_STUB IDBAsynchStatus_RemoteAbort_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);


/* [call_as] */ HRESULT STDMETHODCALLTYPE IDBAsynchStatus_RemoteGetStatus_Proxy( 
    IDBAsynchStatus * This,
    /* [in] */ HCHAPTER hChapter,
    /* [in] */ DBASYNCHOP eOperation,
    /* [unique][out][in] */ DBCOUNTITEM *pulProgress,
    /* [unique][out][in] */ DBCOUNTITEM *pulProgressMax,
    /* [unique][out][in] */ DBASYNCHPHASE *peAsynchPhase,
    /* [unique][out][in] */ LPOLESTR *ppwszStatusText,
    /* [out] */ IErrorInfo **ppErrorInfoRem);


void __RPC_STUB IDBAsynchStatus_RemoteGetStatus_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);



#endif 	/* __IDBAsynchStatus_INTERFACE_DEFINED__ */


#ifndef __ISSAsynchStatus_INTERFACE_DEFINED__
#define __ISSAsynchStatus_INTERFACE_DEFINED__

/* interface ISSAsynchStatus */
/* [unique][uuid][object][local] */ 


EXTERN_C const IID IID_ISSAsynchStatus;

#if defined(__cplusplus) && !defined(CINTERFACE)
    
    MIDL_INTERFACE("1FF1F743-8BB0-4c00-ACC4-C10E43B08FC1")
    ISSAsynchStatus : public IDBAsynchStatus
    {
    public:
        virtual /* [local] */ HRESULT STDMETHODCALLTYPE WaitForAsynchCompletion( 
            /* [in] */ DWORD dwMillisecTimeOut) = 0;
        
    };
    
    
#else 	/* C style interface */

    typedef struct ISSAsynchStatusVtbl
    {
        BEGIN_INTERFACE
        
        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
            ISSAsynchStatus * This,
            /* [in] */ REFIID riid,
            /* [annotation][iid_is][out] */ 
            _COM_Outptr_  void **ppvObject);
        
        ULONG ( STDMETHODCALLTYPE *AddRef )( 
            ISSAsynchStatus * This);
        
        ULONG ( STDMETHODCALLTYPE *Release )( 
            ISSAsynchStatus * This);
        
        /* [local] */ HRESULT ( STDMETHODCALLTYPE *Abort )( 
            ISSAsynchStatus * This,
            /* [in] */ HCHAPTER hChapter,
            /* [in] */ DBASYNCHOP eOperation);
        
        /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetStatus )( 
            ISSAsynchStatus * This,
            /* [in] */ HCHAPTER hChapter,
            /* [in] */ DBASYNCHOP eOperation,
            /* [out] */ DBCOUNTITEM *pulProgress,
            /* [out] */ DBCOUNTITEM *pulProgressMax,
            /* [out] */ DBASYNCHPHASE *peAsynchPhase,
            /* [out] */ LPOLESTR *ppwszStatusText);
        
        /* [local] */ HRESULT ( STDMETHODCALLTYPE *WaitForAsynchCompletion )( 
            ISSAsynchStatus * This,
            /* [in] */ DWORD dwMillisecTimeOut);
        
        END_INTERFACE
    } ISSAsynchStatusVtbl;

    interface ISSAsynchStatus
    {
        CONST_VTBL struct ISSAsynchStatusVtbl *lpVtbl;
    };

    

#ifdef COBJMACROS


#define ISSAsynchStatus_QueryInterface(This,riid,ppvObject)	\
    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 

#define ISSAsynchStatus_AddRef(This)	\
    ( (This)->lpVtbl -> AddRef(This) ) 

#define ISSAsynchStatus_Release(This)	\
    ( (This)->lpVtbl -> Release(This) ) 


#define ISSAsynchStatus_Abort(This,hChapter,eOperation)	\
    ( (This)->lpVtbl -> Abort(This,hChapter,eOperation) ) 

#define ISSAsynchStatus_GetStatus(This,hChapter,eOperation,pulProgress,pulProgressMax,peAsynchPhase,ppwszStatusText)	\
    ( (This)->lpVtbl -> GetStatus(This,hChapter,eOperation,pulProgress,pulProgressMax,peAsynchPhase,ppwszStatusText) ) 


#define ISSAsynchStatus_WaitForAsynchCompletion(This,dwMillisecTimeOut)	\
    ( (This)->lpVtbl -> WaitForAsynchCompletion(This,dwMillisecTimeOut) ) 

#endif /* COBJMACROS */


#endif 	/* C style interface */




#endif 	/* __ISSAsynchStatus_INTERFACE_DEFINED__ */


/* interface __MIDL_itf_msoledbsql_0000_0012 */
/* [local] */ 

//----------------------------------------------------------------------------
// Values for STATUS bitmask for DBSCHEMA_TABLES & DBSCHEMA_TABLES_INFO
#define TABLE_HAS_UPDATE_INSTEAD_OF_TRIGGER     0x00000001 //table has IOT defined
#define TABLE_HAS_DELETE_INSTEAD_OF_TRIGGER     0x00000002 //table has IOT defined
#define TABLE_HAS_INSERT_INSTEAD_OF_TRIGGER     0x00000004 //table has IOT defined
#define TABLE_HAS_AFTER_UPDATE_TRIGGER          0x00000008 //table has update trigger
#define TABLE_HAS_AFTER_DELETE_TRIGGER          0x00000010 //table has delete trigger
#define TABLE_HAS_AFTER_INSERT_TRIGGER          0x00000020 //table has insert trigger
#define TABLE_HAS_CASCADE_UPDATE                0x00000040 //table has cascade update
#define TABLE_HAS_CASCADE_DELETE                0x00000080 //table has cascade delete

//----------------------------------------------------------------------------
// PropIds for DBPROP_INIT_GENERALTIMEOUT
#if (OLEDBVER >= 0x0210)
#define DBPROP_INIT_GENERALTIMEOUT      0x11cL
#endif

//----------------------------------------------------------------------------
// PropIds for DBPROPSET_SQLSERVERDATASOURCE
#define SSPROP_ENABLEFASTLOAD           2
#define SSPROP_ENABLEBULKCOPY           3

//----------------------------------------------------------------------------
// PropIds for DBPROPSET_SQLSERVERDATASOURCEINFO
#define SSPROP_UNICODELCID                       2
#define SSPROP_UNICODECOMPARISONSTYLE            3
#define SSPROP_COLUMNLEVELCOLLATION              4
#define SSPROP_CHARACTERSET                      5
#define SSPROP_SORTORDER                         6
#define SSPROP_CURRENTCOLLATION                  7
#define SSPROP_INTEGRATEDAUTHENTICATIONMETHOD    8
#define SSPROP_MUTUALLYAUTHENTICATED             9

//----------------------------------------------------------------------------
// PropIds for DBPROPSET_SQLSERVERDBINIT
#define SSPROP_INIT_CURRENTLANGUAGE              4
#define SSPROP_INIT_NETWORKADDRESS               5
#define SSPROP_INIT_NETWORKLIBRARY               6
#define SSPROP_INIT_USEPROCFORPREP               7
#define SSPROP_INIT_AUTOTRANSLATE                8
#define SSPROP_INIT_PACKETSIZE                   9
#define SSPROP_INIT_APPNAME                      10
#define SSPROP_INIT_WSID                         11
#define SSPROP_INIT_FILENAME                     12
#define SSPROP_INIT_ENCRYPT                      13
#define SSPROP_AUTH_REPL_SERVER_NAME             14
#define SSPROP_INIT_TAGCOLUMNCOLLATION           15
#define SSPROP_INIT_MARSCONNECTION               16
#define SSPROP_INIT_FAILOVERPARTNER              18
#define SSPROP_AUTH_OLD_PASSWORD                 19
#define SSPROP_INIT_DATATYPECOMPATIBILITY        20
#define SSPROP_INIT_TRUST_SERVER_CERTIFICATE     21
#define SSPROP_INIT_SERVERSPN                    22
#define SSPROP_INIT_FAILOVERPARTNERSPN           23
#define SSPROP_INIT_APPLICATIONINTENT            24
#define SSPROP_INIT_MULTISUBNETFAILOVER          25
#define SSPROP_INIT_USEFMTONLY                   26
#define SSPROP_AUTH_MODE                         27
#define SSPROP_AUTH_ACCESS_TOKEN                 28
#define SSPROP_INIT_TNIR                         29
#define SSPROP_INIT_CONNECT_RETRY_COUNT          30
#define SSPROP_INIT_CONNECT_RETRY_INTERVAL       31
#define SSPROP_INIT_DISCOVEREDSERVERSPN          32

//-----------------------------------------------------------------------------
// Values for SSPROP_INIT_USEPROCFORPREP
#define SSPROPVAL_USEPROCFORPREP_OFF        0
#define SSPROPVAL_USEPROCFORPREP_ON         1
#define SSPROPVAL_USEPROCFORPREP_ON_DROP    2

//-----------------------------------------------------------------------------
// Values for SSPROP_INIT_DATATYPECOMPATIBILITY
#define SSPROPVAL_DATATYPECOMPATIBILITY_SQL2000  80
#define SSPROPVAL_DATATYPECOMPATIBILITY_DEFAULT  0

//----------------------------------------------------------------------------
// PropIds for DBPROPSET_SQLSERVERSESSION
#define SSPROP_QUOTEDCATALOGNAMES       2
#define SSPROP_ALLOWNATIVEVARIANT       3
#define SSPROP_SQLXMLXPROGID            4
#define SSPROP_ASYNCH_BULKCOPY          5

//----------------------------------------------------------------------------
// PropIds for DBPROPSET_SQLSERVERROWSET
#define SSPROP_MAXBLOBLENGTH            8
#define SSPROP_FASTLOADOPTIONS          9
#define SSPROP_FASTLOADKEEPNULLS        10
#define SSPROP_FASTLOADKEEPIDENTITY     11
#define SSPROP_CURSORAUTOFETCH          12
#define SSPROP_DEFERPREPARE             13
#define SSPROP_IRowsetFastLoad          14
#define SSPROP_QP_NOTIFICATION_TIMEOUT  17
#define SSPROP_QP_NOTIFICATION_MSGTEXT  18
#define SSPROP_QP_NOTIFICATION_OPTIONS  19
#define SSPROP_NOCOUNT_STATUS           20
#define SSPROP_COMPUTE_ID               21
#define SSPROP_COLUMN_ID                22
#define SSPROP_COMPUTE_BYLIST           23
#define SSPROP_ISSAsynchStatus          24
#define SSPROP_ISSDataClassification    25

//-----------------------------------------------------------------------------
// Values for SSPROP_QP_NOTIFICATION_TIMEOUT
#define SSPROPVAL_DEFAULT_NOTIFICATION_TIMEOUT  432000 /* in sec */
#define SSPROPVAL_MAX_NOTIFICATION_TIMEOUT      0x7FFFFFFF /* in sec */
#define MAX_NOTIFICATION_LEN                    2000 /* NVARCHAR [2000] for both ID & DELIVERY_QUEUE */

//----------------------------------------------------------------------------
// PropIds for DBPROPSET_SQLSERVERCOLUMN
#define SSPROP_COL_COLLATIONNAME                         14
#define SSPROP_COL_UDT_CATALOGNAME                       31
#define SSPROP_COL_UDT_SCHEMANAME                        32
#define SSPROP_COL_UDT_NAME                              33
#define SSPROP_COL_XML_SCHEMACOLLECTION_CATALOGNAME      34
#define SSPROP_COL_XML_SCHEMACOLLECTION_SCHEMANAME       35
#define SSPROP_COL_XML_SCHEMACOLLECTIONNAME              36
#define SSPROP_COL_COMPUTED                              37


//----------------------------------------------------------------------------
// PropIds for DBPROPSET_SQLSERVERSTREAM
#define SSPROP_STREAM_XMLROOT                            19

//----------------------------------------------------------------------------
// PropIds for DBPROPSET_SQLSERVERPARAMETER
#define SSPROP_PARAM_XML_SCHEMACOLLECTION_CATALOGNAME    24
#define SSPROP_PARAM_XML_SCHEMACOLLECTION_SCHEMANAME     25
#define SSPROP_PARAM_XML_SCHEMACOLLECTIONNAME            26
#define SSPROP_PARAM_UDT_CATALOGNAME                     27
#define SSPROP_PARAM_UDT_SCHEMANAME                      28
#define SSPROP_PARAM_UDT_NAME                            29
#define SSPROP_PARAM_TYPE_CATALOGNAME                    38
#define SSPROP_PARAM_TYPE_SCHEMANAME                     39
#define SSPROP_PARAM_TYPE_TYPENAME                       40
#define SSPROP_PARAM_TABLE_DEFAULT_COLUMNS               41
#define SSPROP_PARAM_TABLE_COLUMN_SORT_ORDER             42

//----------------------------------------------------------------------------
// PropIds for DBPROPSET_SQLSERVERINDEX
#define SSPROP_INDEX_XML         1

//-----------------------------------------------------------------------------
//
#define BCP_TYPE_DEFAULT         0x00
#define BCP_TYPE_SQLTEXT         0x23
#define BCP_TYPE_SQLVARBINARY    0x25
#define BCP_TYPE_SQLINTN         0x26
#define BCP_TYPE_SQLVARCHAR      0x27
#define BCP_TYPE_SQLBINARY       0x2d
#define BCP_TYPE_SQLIMAGE        0x22
#define BCP_TYPE_SQLCHARACTER    0x2f
#define BCP_TYPE_SQLINT1         0x30
#define BCP_TYPE_SQLBIT          0x32
#define BCP_TYPE_SQLINT2         0x34
#define BCP_TYPE_SQLINT4         0x38
#define BCP_TYPE_SQLMONEY        0x3c
#define BCP_TYPE_SQLDATETIME     0x3d
#define BCP_TYPE_SQLFLT8         0x3e
#define BCP_TYPE_SQLFLTN         0x6d
#define BCP_TYPE_SQLMONEYN       0x6e
#define BCP_TYPE_SQLDATETIMN     0x6f
#define BCP_TYPE_SQLFLT4         0x3b
#define BCP_TYPE_SQLMONEY4       0x7a
#define BCP_TYPE_SQLDATETIM4     0x3a
#define BCP_TYPE_SQLDECIMAL      0x6a
#define BCP_TYPE_SQLNUMERIC      0x6c
#define BCP_TYPE_SQLUNIQUEID     0x24
#define BCP_TYPE_SQLBIGCHAR      0xaf
#define BCP_TYPE_SQLBIGVARCHAR   0xa7
#define BCP_TYPE_SQLBIGBINARY    0xad
#define BCP_TYPE_SQLBIGVARBINARY 0xa5
#define BCP_TYPE_SQLBITN         0x68
#define BCP_TYPE_SQLNCHAR        0xef
#define BCP_TYPE_SQLNVARCHAR     0xe7
#define BCP_TYPE_SQLNTEXT        0x63
#define BCP_TYPE_SQLDECIMALN     0x6a
#define BCP_TYPE_SQLNUMERICN     0x6c
#define BCP_TYPE_SQLINT8         0x7f
#define BCP_TYPE_SQLVARIANT      0x62
#define BCP_TYPE_SQLUDT          0xf0
#define BCP_TYPE_SQLXML          0xf1
#define BCP_TYPE_SQLDATE         0x28
#define BCP_TYPE_SQLTIME         0x29
#define BCP_TYPE_SQLDATETIME2    0x2a
#define BCP_TYPE_SQLDATETIMEOFFSET 0x2b

#define BCP_DIRECTION_IN            1
#define BCP_DIRECTION_OUT           2

#define BCP_OPTION_MAXERRS          1
#define BCP_OPTION_FIRST            2
#define BCP_OPTION_LAST             3
#define BCP_OPTION_BATCH            4
#define BCP_OPTION_KEEPNULLS        5
#define BCP_OPTION_ABORT            6
#define BCP_OPTION_KEEPIDENTITY     8
#define BCP_OPTION_HINTSA           10
#define BCP_OPTION_HINTSW           11
#define BCP_OPTION_FILECP           12
#define BCP_OPTION_UNICODEFILE      13
#define BCP_OPTION_TEXTFILE         14
#define BCP_OPTION_FILEFMT          15
#define BCP_OPTION_FMTXML           16
#define BCP_OPTION_FIRSTEX          17
#define BCP_OPTION_LASTEX           18
#define BCP_OPTION_ROWCOUNT         19
#define BCP_OPTION_DELAYREADFMT     20

#define BCP_OUT_CHARACTER_MODE      0x01
#define BCP_OUT_WIDE_CHARACTER_MODE 0x02
#define BCP_OUT_NATIVE_TEXT_MODE    0x03
#define BCP_OUT_NATIVE_MODE         0x04

#define BCP_FILECP_ACP              0
#define BCP_FILECP_OEMCP            1
#define BCP_FILECP_RAW              (-1)

#ifdef UNICODE
#define BCP_OPTION_HINTS             BCP_OPTION_HINTSW
#else
#define BCP_OPTION_HINTS             BCP_OPTION_HINTSA
#endif

#define BCP_PREFIX_DEFAULT           (-10)

#define BCP_LENGTH_NULL              (-1)
#define BCP_LENGTH_VARIABLE          (-10)
//
//-----------------------------------------------------------------------------


//----------------------------------------------------------------------------
// Provider-specific Class Ids
//

#if MSOLEDBSQL_VER >= 1800

extern const GUID OLEDBDECLSPEC CLSID_MSOLEDBSQL            = {0x5a23de84L,0x1d7b,0x4a16,{0x8d,0xed,0xb2,0x9c,0x9,0xcb,0x64,0x8d}};
extern const GUID OLEDBDECLSPEC CLSID_MSOLEDBSQL_ERROR      = {0xecab1ccbL,0x116a,0x4541,{0xad,0xba,0x69,0xc,0xeb,0x9c,0xc8,0x43}};
extern const GUID OLEDBDECLSPEC CLSID_MSOLEDBSQL_ENUMERATOR = {0x720818d5L,0x1465,0x4812,{0x83,0x9f,0x9f,0x15,0xc3,0x8a,0x52,0xcb}};

#endif

extern const GUID OLEDBDECLSPEC CLSID_ROWSET_TVP            = {0xc7ef28d5L,0x7bee,0x443f,{0x86,0xda,0xe3,0x98,0x4f,0xcd,0x4d,0xf9}};

//----------------------------------------------------------------------------
// Provider-specific Interface Ids
//
#ifndef  _SQLOLEDB_H_
extern const GUID OLEDBDECLSPEC IID_ISQLServerErrorInfo      = {0x5cf4ca12,0xef21,0x11d0,{0x97,0xe7,0x0,0xc0,0x4f,0xc2,0xad,0x98}};
extern const GUID OLEDBDECLSPEC IID_IRowsetFastLoad          = {0x5cf4ca13,0xef21,0x11d0,{0x97,0xe7,0x0,0xc0,0x4f,0xc2,0xad,0x98}};
extern const GUID OLEDBDECLSPEC IID_IUMSInitialize           = {0x5cf4ca14,0xef21,0x11d0,{0x97,0xe7,0x0,0xc0,0x4f,0xc2,0xad,0x98}};
extern const GUID OLEDBDECLSPEC IID_ISchemaLock              = {0x4c2389fb,0x2511,0x11d4,{0xb2,0x58,0x0,0xc0,0x4f,0x79,0x71,0xce}};
extern const GUID OLEDBDECLSPEC IID_ISQLXMLHelper            = {0xd22a7678L,0xf860,0x40cd,{0xa5,0x67,0x15,0x63,0xde,0xb4,0x6d,0x49}};
#endif //_SQLOLEDB_H_
extern const GUID OLEDBDECLSPEC IID_ISSAbort                 = {0x5cf4ca15,0xef21,0x11d0,{0x97,0xe7,0x0,0xc0,0x4f,0xc2,0xad,0x98}};
extern const GUID OLEDBDECLSPEC IID_IBCPSession              = {0x88352D80,0x42D1,0x42f0,{0xA1,0x70,0xAB,0x0F,0x8B,0x45,0xB9,0x39}};
extern const GUID OLEDBDECLSPEC IID_IBCPSession2             = {0xad79d3b6,0x59dd,0x46a3,{0xbf,0xc6,0xe6,0x2a,0x65,0xff,0x35,0x23}};
extern const GUID OLEDBDECLSPEC IID_ISSCommandWithParameters = {0xeec30162,0x6087,0x467c,{0xb9,0x95,0x7c,0x52,0x3c,0xe9,0x65,0x61}};
extern const GUID OLEDBDECLSPEC IID_ISSAsynchStatus          = {0x1FF1F743,0x8BB0, 0x4c00,{0xAC,0xC4,0xC1,0x0E,0x43,0xB0,0x8F,0xC1}};
extern const GUID OLEDBDECLSPEC IID_ISSDataClassification    = {0x1dd0c83e,0x5c8f,0x4d39,{0x82,0xda,0xe3,0x26,0xb7,0xaf,0x83,0x4c}};


//----------------------------------------------------------------------------
// Provider-specific schema rowsets
//
#ifndef  _SQLOLEDB_H_
extern const GUID OLEDBDECLSPEC DBSCHEMA_LINKEDSERVERS               = {0x9093caf4,0x2eac,0x11d1,{0x98,0x9,0x0,0xc0,0x4f,0xc2,0xad,0x98}};
#endif //_SQLOLEDB_H_
extern const GUID OLEDBDECLSPEC DBSCHEMA_SQL_ASSEMBLIES              = {0x7c1112c8, 0xc2d3, 0x4f6e, {0x94, 0x9a, 0x98, 0x3d, 0x38, 0xa5, 0x8f, 0x46}};
extern const GUID OLEDBDECLSPEC DBSCHEMA_SQL_ASSEMBLY_DEPENDENCIES   = {0xcb0f837b, 0x974c, 0x41b8, {0x90, 0x9d, 0x64, 0x9c, 0xaf, 0x45, 0xad, 0x2f}};
extern const GUID OLEDBDECLSPEC DBSCHEMA_SQL_USER_TYPES              = {0xf1198bd8, 0xa424, 0x4ea3, {0x8d, 0x4c, 0x60, 0x7e, 0xee, 0x2b, 0xab, 0x60}};
extern const GUID OLEDBDECLSPEC DBSCHEMA_XML_COLLECTIONS             = {0x56bfad8c, 0x6e8f, 0x480d, {0x91, 0xde, 0x35, 0x16, 0xd9, 0x9a, 0x5d, 0x10}};
extern const GUID OLEDBDECLSPEC DBSCHEMA_SQL_TABLE_TYPES             = {0x4e26cde7, 0xaaa4, 0x41ed, {0x93, 0xdd, 0x37, 0x6e, 0x6d, 0x40, 0x9c, 0x17}};
extern const GUID OLEDBDECLSPEC DBSCHEMA_SQL_TABLE_TYPE_PRIMARY_KEYS = {0x9738faea, 0x31e8, 0x4f63, {0xae,  0xd, 0x61, 0x33, 0x16, 0x41, 0x8c, 0xdd}};
extern const GUID OLEDBDECLSPEC DBSCHEMA_SQL_TABLE_TYPE_COLUMNS      = {0xa663d94b, 0xddf7, 0x4a7f, {0xa5, 0x37, 0xd6, 0x1f, 0x12, 0x36, 0x5d, 0x7c}};
extern const GUID OLEDBDECLSPEC DBSCHEMA_COLUMNS_EXTENDED            = {0x66462f01, 0x633a, 0x44d9, {0xb0, 0xd0, 0xfe, 0x66, 0xf2, 0x1a, 0x0d, 0x24}};
extern const GUID OLEDBDECLSPEC DBSCHEMA_SPARSE_COLUMN_SET           = {0x31a4837c, 0xf9ff, 0x405f, {0x89, 0x82, 0x02, 0x19, 0xaa, 0xaa, 0x4a, 0x12}};


#ifndef CRESTRICTIONS_DBSCHEMA_LINKEDSERVERS
#define CRESTRICTIONS_DBSCHEMA_LINKEDSERVERS    1
#endif

#ifndef CRESTRICTIONS_DBSCHEMA_ASSEMBLIES
#define CRESTRICTIONS_DBSCHEMA_SQL_ASSEMBLIES       4
#endif

#ifndef CRESTRICTIONS_DBSCHEMA_ASSEMBLY_DEPENDENCIES
#define CRESTRICTIONS_DBSCHEMA_SQL_ASSEMBLY_DEPENDENCIES 4
#endif

#ifndef CRESTRICTIONS_DBSCHEMA_USER_TYPES
#define CRESTRICTIONS_DBSCHEMA_SQL_USER_TYPES   3
#endif

#ifndef CRESTRICTIONS_DBSCHEMA_XML_COLLECTIONS
#define CRESTRICTIONS_DBSCHEMA_XML_COLLECTIONS   4
#endif

#ifndef CRESTRICTIONS_DBSCHEMA_SQL_TABLE_TYPES
#define CRESTRICTIONS_DBSCHEMA_SQL_TABLE_TYPES    3
#endif

#ifndef CRESTRICTIONS_DBSCHEMA_SQL_TABLE_TYPE_PRIMARY_KEYS
#define CRESTRICTIONS_DBSCHEMA_SQL_TABLE_TYPE_PRIMARY_KEYS    3
#endif

#ifndef CRESTRICTIONS_DBSCHEMA_SQL_TABLE_TYPE_COLUMNS
#define CRESTRICTIONS_DBSCHEMA_SQL_TABLE_TYPE_COLUMNS    4
#endif

#ifndef CRESTRICTIONS_DBSCHEMA_COLUMNS_EXTENDED
#define CRESTRICTIONS_DBSCHEMA_COLUMNS_EXTENDED    4
#endif

#ifndef CRESTRICTIONS_DBSCHEMA_SPARSE_COLUMN_SET
#define CRESTRICTIONS_DBSCHEMA_SPARSE_COLUMN_SET    4
#endif


//----------------------------------------------------------------------------
// Provider-specific property sets
//
#ifndef  _SQLOLEDB_H_
extern const GUID OLEDBDECLSPEC DBPROPSET_SQLSERVERDATASOURCE    = {0x28efaee4,0x2d2c,0x11d1,{0x98,0x7,0x0,0xc0,0x4f,0xc2,0xad,0x98}};
extern const GUID OLEDBDECLSPEC DBPROPSET_SQLSERVERDATASOURCEINFO= {0xdf10cb94,0x35f6,0x11d2,{0x9c,0x54,0x0,0xc0,0x4f,0x79,0x71,0xd3}};
extern const GUID OLEDBDECLSPEC DBPROPSET_SQLSERVERDBINIT        = {0x5cf4ca10,0xef21,0x11d0,{0x97,0xe7,0x0,0xc0,0x4f,0xc2,0xad,0x98}};
extern const GUID OLEDBDECLSPEC DBPROPSET_SQLSERVERROWSET        = {0x5cf4ca11,0xef21,0x11d0,{0x97,0xe7,0x0,0xc0,0x4f,0xc2,0xad,0x98}};
extern const GUID OLEDBDECLSPEC DBPROPSET_SQLSERVERSESSION       = {0x28efaee5,0x2d2c,0x11d1,{0x98,0x7,0x0,0xc0,0x4f,0xc2,0xad,0x98}};
extern const GUID OLEDBDECLSPEC DBPROPSET_SQLSERVERCOLUMN        = {0x3b63fb5e,0x3fbb,0x11d3,{0x9f,0x29,0x0,0xc0,0x4f,0x8e,0xe9,0xdc}};
extern const GUID OLEDBDECLSPEC DBPROPSET_SQLSERVERSTREAM        = {0x9f79c073,0x8a6d,0x4bca,{0xa8,0xa8,0xc9,0xb7,0x9a,0x9b,0x96,0x2d}};
#endif //_SQLOLEDB_H_
extern const GUID OLEDBDECLSPEC DBPROPSET_SQLSERVERPARAMETER     = {0xfee09128,0xa67d,0x47ea,{0x8d,0x40,0x24,0xa1,0xd4,0x73,0x7e,0x8d}};
extern const GUID OLEDBDECLSPEC DBPROPSET_SQLSERVERINDEX         = {0xE428B84E,0xA6B7,0x413a,{0x94,0x65,0x56,0x23,0x2E,0x0D,0x2B,0xEB}};
extern const GUID OLEDBDECLSPEC DBPROPSET_PARAMETERALL           = {0x2cd2b7d8,0xe7c2,0x4f6c,{0x9b,0x30,0x75,0xe2,0x58,0x46,0x10,0x97}};


//----------------------------------------------------------------------------
// Provider-specific columns for IColumnsRowset
//
#define DBCOLUMN_SS_X_GUID {0x627bd890,0xed54,0x11d2,{0xb9,0x94,0x0,0xc0,0x4f,0x8c,0xa8,0x2c}}
//
#ifndef  _SQLOLEDB_H_
extern const DBID OLEDBDECLSPEC DBCOLUMN_SS_COMPFLAGS        = {DBCOLUMN_SS_X_GUID, DBKIND_GUID_PROPID, (LPOLESTR)100};
extern const DBID OLEDBDECLSPEC DBCOLUMN_SS_SORTID           = {DBCOLUMN_SS_X_GUID, DBKIND_GUID_PROPID, (LPOLESTR)101};
extern const DBID OLEDBDECLSPEC DBCOLUMN_BASETABLEINSTANCE   = {DBCOLUMN_SS_X_GUID, DBKIND_GUID_PROPID, (LPOLESTR)102};
extern const DBID OLEDBDECLSPEC DBCOLUMN_SS_TDSCOLLATION     = {DBCOLUMN_SS_X_GUID, DBKIND_GUID_PROPID, (LPOLESTR)103};
#endif //_SQLOLEDB_H_
extern const DBID OLEDBDECLSPEC DBCOLUMN_BASESERVERNAME      = {DBCOLUMN_SS_X_GUID, DBKIND_GUID_PROPID, (LPOLESTR)104};
extern const DBID OLEDBDECLSPEC DBCOLUMN_SS_XML_SCHEMACOLLECTION_CATALOGNAME= {DBCOLUMN_SS_X_GUID, DBKIND_GUID_PROPID, (LPOLESTR)105};
extern const DBID OLEDBDECLSPEC DBCOLUMN_SS_XML_SCHEMACOLLECTION_SCHEMANAME = {DBCOLUMN_SS_X_GUID, DBKIND_GUID_PROPID, (LPOLESTR)106};
extern const DBID OLEDBDECLSPEC DBCOLUMN_SS_XML_SCHEMACOLLECTIONNAME        = {DBCOLUMN_SS_X_GUID, DBKIND_GUID_PROPID, (LPOLESTR)107};
extern const DBID OLEDBDECLSPEC DBCOLUMN_SS_UDT_CATALOGNAME  = {DBCOLUMN_SS_X_GUID, DBKIND_GUID_PROPID, (LPOLESTR)108};
extern const DBID OLEDBDECLSPEC DBCOLUMN_SS_UDT_SCHEMANAME   = {DBCOLUMN_SS_X_GUID, DBKIND_GUID_PROPID, (LPOLESTR)109};
extern const DBID OLEDBDECLSPEC DBCOLUMN_SS_UDT_NAME         = {DBCOLUMN_SS_X_GUID, DBKIND_GUID_PROPID, (LPOLESTR)110};
extern const DBID OLEDBDECLSPEC DBCOLUMN_SS_ASSEMBLY_TYPENAME= {DBCOLUMN_SS_X_GUID, DBKIND_GUID_PROPID, (LPOLESTR)111};


#ifndef SQL_FILESTREAM_DEFINED
#define SQL_FILESTREAM_DEFINED
//The following facilitates opening a handle to a SQL filestream
typedef enum _SQL_FILESTREAM_DESIRED_ACCESS {
            SQL_FILESTREAM_READ        = 0,
            SQL_FILESTREAM_WRITE       = 1,
            SQL_FILESTREAM_READWRITE   = 2
} SQL_FILESTREAM_DESIRED_ACCESS;
#define SQL_FILESTREAM_OPEN_FLAG_ASYNC               0x00000001L
#define SQL_FILESTREAM_OPEN_FLAG_NO_BUFFERING        0x00000002L
#define SQL_FILESTREAM_OPEN_FLAG_NO_WRITE_THROUGH    0x00000004L
#define SQL_FILESTREAM_OPEN_FLAG_SEQUENTIAL_SCAN     0x00000008L
#define SQL_FILESTREAM_OPEN_FLAG_RANDOM_ACCESS       0x00000010L
HANDLE __stdcall OpenSqlFilestream (
           LPCWSTR                        FilestreamPath,
           SQL_FILESTREAM_DESIRED_ACCESS  DesiredAccess,
           ULONG                          OpenOptions,
           __in_bcount(FilestreamTransactionContextLength)
           LPBYTE                         FilestreamTransactionContext,
           SSIZE_T                        FilestreamTransactionContextLength,
           PLARGE_INTEGER                 AllocationSize);
#define FSCTL_SQL_FILESTREAM_FETCH_OLD_CONTENT       CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 2392, METHOD_BUFFERED, FILE_ANY_ACCESS)
#endif



#ifndef _SQLUSERINSTANCE_H_
#define _SQLUSERINSTANCE_H_

#include <windows.h>

#ifdef __cplusplus
extern "C" {
#endif


//  Recommended buffer size to store a LocalDB connection string 
#define LOCALDB_MAX_SQLCONNECTION_BUFFER_SIZE 260

// type definition for LocalDBCreateInstance function
typedef HRESULT __cdecl FnLocalDBCreateInstance (
		// I			the LocalDB version (e.g. 11.0 or 11.0.1094.2)
		__in_z			PCWSTR	wszVersion,
		// I			the instance name
		__in_z			PCWSTR	pInstanceName,
		// I			reserved for the future use. Currently should be set to 0.
		__in			DWORD	dwFlags
);

// type definition for pointer to LocalDBCreateInstance function
typedef FnLocalDBCreateInstance* PFnLocalDBCreateInstance;

// type definition for LocalDBStartInstance function
typedef HRESULT __cdecl FnLocalDBStartInstance (
		// I			the LocalDB instance name
		__in_z									PCWSTR	pInstanceName,
		// I			reserved for the future use. Currently should be set to 0.
		__in									DWORD	dwFlags,
		// O			the buffer to store the connection string to the LocalDB instance
		__out_ecount_z_opt(*lpcchSqlConnection)	LPWSTR	wszSqlConnection,
		// I/O			on input has the size of the wszSqlConnection buffer in characters. On output, if the given buffer size is 
		//				too small, has the buffer size required, in characters, including trailing null.
		__inout_opt								LPDWORD	lpcchSqlConnection
);

// type definition for pointer to LocalDBStartInstance function
typedef FnLocalDBStartInstance* PFnLocalDBStartInstance;

// Flags for the LocalDBFormatMessage function
#define LOCALDB_TRUNCATE_ERR_MESSAGE		0x0001L

// type definition for LocalDBFormatMessage function
typedef HRESULT __cdecl FnLocalDBFormatMessage(
			// I		the LocalDB error code
			__in							HRESULT	hrLocalDB,
			// I		Available flags:
			//			LOCALDB_TRUNCATE_ERR_MESSAGE - if the input buffer is too short,
			//			the error message will be truncated to fit into the buffer 
			__in							DWORD	dwFlags,
			// I		Language desired (LCID) or 0 (in which case Win32 FormatMessage order is used)
			__in							DWORD	dwLanguageId,
			// O		the buffer to store the LocalDB error message
			__out_ecount_z(*lpcchMessage)	LPWSTR	wszMessage,
			// I/O		on input has the size of the wszMessage buffer in characters. On output, if the given buffer size is 
			//			too small, has the buffer size required, in characters, including trailing null. If the function succeeds
			//			contains the number of characters in the message, excluding the trailing null
			__inout							LPDWORD	lpcchMessage
);

// type definition for function pointer to LocalDBFormatMessage function
typedef FnLocalDBFormatMessage* PFnLocalDBFormatMessage;


// MessageId: LOCALDB_ERROR_NOT_INSTALLED
//
// MessageText:
//
// LocalDB is not installed.
//
#define LOCALDB_ERROR_NOT_INSTALLED            ((HRESULT)0x89C50116L)

//---------------------------------------------------------------------
// Function: LocalDBCreateInstance
//
// Description: This function will create the new LocalDB instance.
// 
// Available Flags:
//	No flags available. Reserved for future use.
//
// Return Values:
//	S_OK, if the function succeeds
//	LOCALDB_ERROR_INVALID_PARAM_INSTANCE_NAME, if the instance name parameter is invalid
//	LOCALDB_ERROR_INVALID_PARAM_VERSION, if the version parameter is invalid
//	LOCALDB_ERROR_INVALID_PARAM_FLAGS, if the flags are invalid
//	LOCALDB_ERROR_INVALID_OPERATION, if the user tries to create a default instance
//	LOCALDB_ERROR_INSTANCE_FOLDER_PATH_TOO_LONG, if the path where instance should be stored is longer than MAX_PATH
//	LOCALDB_ERROR_VERSION_REQUESTED_NOT_INSTALLED, if the specified patch level is not installed
//	LOCALDB_ERROR_INSTANCE_FOLDER_ALREADY_EXISTS, if the instance folder already exists and is not empty
//	LOCALDB_ERROR_INSTANCE_EXISTS_WITH_LOWER_VERSION,	if the specified instance already exists but with lower version
//	LOCALDB_ERROR_CANNOT_CREATE_INSTANCE_FOLDER, if a folder cannot be created under %userprofile%
//	LOCALDB_ERROR_CANNOT_GET_USER_PROFILE_FOLDER, if a user profile folder cannot be retrieved
//	LOCALDB_ERROR_CANNOT_ACCESS_INSTANCE_FOLDER, if a instance folder cannot be accessed
//	LOCALDB_ERROR_CANNOT_ACCESS_INSTANCE_REGISTRY, if a instance registry cannot be accessed
//	LOCALDB_ERROR_INTERNAL_ERROR, if an unexpected error occurred. See event log for details
//	LOCALDB_ERROR_CANNOT_MODIFY_INSTANCE_REGISTRY, if an instance registry cannot be modified
//	LOCALDB_ERROR_CANNOT_CREATE_SQL_PROCESS, if a process for Sql Server cannot be created
//	LOCALDB_ERROR_SQL_SERVER_STARTUP_FAILED, if a Sql Server process is started but Sql Server startup failed.
//	LOCALDB_ERROR_INSTANCE_CONFIGURATION_CORRUPT, if a instance configuration is corrupted
//
FnLocalDBCreateInstance LocalDBCreateInstance;

//---------------------------------------------------------------------
// Function: LocalDBStartInstance
// 
// Description: This function will start the given LocalDB instance.
//
// Return Values:
//	S_OK, if the function succeeds
//	LOCALDB_ERROR_UNKNOWN_INSTANCE, if the specified instance doesn't exist
//	LOCALDB_ERROR_INVALID_PARAM_INSTANCE_NAME, if the instance name parameter is invalid
//	LOCALDB_ERROR_INVALID_PARAM_CONNECTION, if the wszSqlConnection parameter is NULL
//	LOCALDB_ERROR_INVALID_PARAM_FLAGS, if the flags are invalid
//	LOCALDB_ERROR_INSUFFICIENT_BUFFER, if the buffer wszSqlConnection is too small
//	LOCALDB_ERROR_INSTANCE_FOLDER_PATH_TOO_LONG, if the path where instance should be stored is longer than MAX_PATH

//	LOCALDB_ERROR_CANNOT_GET_USER_PROFILE_FOLDER, if a user profile folder cannot be retrieved
//	LOCALDB_ERROR_CANNOT_ACCESS_INSTANCE_FOLDER, if a instance folder cannot be accessed
//	LOCALDB_ERROR_CANNOT_ACCESS_INSTANCE_REGISTRY, if a instance registry cannot be accessed
//	LOCALDB_ERROR_INTERNAL_ERROR, if an unexpected error occurred. See event log for details
//	LOCALDB_ERROR_CANNOT_MODIFY_INSTANCE_REGISTRY, if an instance registry cannot be modified
//	LOCALDB_ERROR_CANNOT_CREATE_SQL_PROCESS, if a process for Sql Server cannot be created
//	LOCALDB_ERROR_SQL_SERVER_STARTUP_FAILED, if a Sql Server process is started but Sql Server startup failed.
//	LOCALDB_ERROR_INSTANCE_CONFIGURATION_CORRUPT, if a instance configuration is corrupted
//
FnLocalDBStartInstance LocalDBStartInstance;

// type definition for LocalDBStopInstance function
typedef HRESULT __cdecl FnLocalDBStopInstance (
		// I			the LocalDB instance name
		__in_z			PCWSTR	pInstanceName,
		// I			Available flags:
		//				LOCALDB_SHUTDOWN_KILL_PROCESS	- force the instance to stop immediately
		//				LOCALDB_SHUTDOWN_WITH_NOWAIT	- shutdown the instance with NOWAIT option
		__in			DWORD	dwFlags,
		// I			the time in seconds to wait this operation to complete. If this value is 0, this function will return immediately
		//				without waiting for LocalDB instance to stop
		__in			ULONG	ulTimeout
);

// type definition for pointer to LocalDBStopInstance function
typedef FnLocalDBStopInstance* PFnLocalDBStopInstance;

// Flags for the StopLocalDBInstance function
#define LOCALDB_SHUTDOWN_KILL_PROCESS		0x0001L
#define LOCALDB_SHUTDOWN_WITH_NOWAIT		0x0002L

//---------------------------------------------------------------------
// Function: LocalDBStopInstance
//
// Description: This function will shutdown the given LocalDB instance. 
// If the flag LOCALDB_SHUTDOWN_KILL_PROCESS is set, the LocalDB instance will be killed immediately.
// IF the flag LOCALDB_SHUTDOWN_WITH_NOWAIT is set, the LocalDB instance will shutdown with NOWAIT option.
//
// Return Values:
//	S_OK, if the function succeeds
//	LOCALDB_ERROR_UNKNOWN_INSTANCE, if the specified instance doesn't exist
//	LOCALDB_ERROR_INVALID_PARAM_INSTANCE_NAME, if the instance name parameter is invalid
//	LOCALDB_ERROR_INVALID_PARAM_FLAGS, if the flags are invalid
//	LOCALDB_ERROR_WAIT_TIMEOUT - if this function has not finished in given time
//	LOCALDB_ERROR_INTERNAL_ERROR, if an unexpected error occurred. See event log for details
//
FnLocalDBStopInstance LocalDBStopInstance;

// type definition for LocalDBDeleteInstance function
typedef HRESULT __cdecl FnLocalDBDeleteInstance (
		// I			the LocalDB instance name
		__in_z			PCWSTR	pInstanceName,
		// I			reserved for the future use. Currently should be set to 0.
		__in			DWORD	dwFlags
);

// type definition for pointer to LocalDBDeleteInstance function
typedef FnLocalDBDeleteInstance* PFnLocalDBDeleteInstance;

//---------------------------------------------------------------------
// Function: LocalDBDeleteInstance
//
// Description: This function will remove the given LocalDB instance. If the given instance is running this function will
// fail with the error code LOCALDB_ERROR_INSTANCE_BUSY.
//
// Return Values:
//	S_OK, if the function succeeds
//	LOCALDB_ERROR_INVALID_PARAM_INSTANCE_NAME, if the instance name parameter is invalid
//	LOCALDB_ERROR_INVALID_PARAM_FLAGS, if the flags are invalid
//	LOCALDB_ERROR_UNKNOWN_INSTANCE, if the specified instance doesn't exist
//	LOCALDB_ERROR_INSTANCE_BUSY, if the given instance is running
//	LOCALDB_ERROR_INTERNAL_ERROR, if an unexpected error occurred. See event log for details
//
FnLocalDBDeleteInstance LocalDBDeleteInstance;

// Function: LocalDBFormatMessage
//
// Description: This function will return the localized textual description for the given LocalDB error
//
// Available Flags:
//	LOCALDB_TRUNCATE_ERR_MESSAGE - the error message should be truncated to fit into the provided buffer
//
// Return Value:
//	S_OK, if the function succeeds
//
//	LOCALDB_ERROR_UNKNOWN_HRESULT,		if the given HRESULT is unknown
//	LOCALDB_ERROR_UNKNOWN_LANGUAGE_ID,	if the given language id is unknown (0 is recommended for the //	default language)
//	LOCALDB_ERROR_UNKNOWN_ERROR_CODE,	if the LocalDB error code is unknown
//	LOCALDB_ERROR_INVALID_PARAM_FLAGS,	if the flags are invalid
//	LOCALDB_ERROR_INSUFFICIENT_BUFFER,	if the input buffer is too short and LOCALDB_TRUNCATE_ERR_MESSAGE flag 
//										is not set
//	LOCALDB_ERROR_INTERNAL_ERROR,		if an unexpected error occurred. See event log for details
//
FnLocalDBFormatMessage LocalDBFormatMessage;

#define MAX_LOCALDB_INSTANCE_NAME_LENGTH 128
#define MAX_LOCALDB_PARENT_INSTANCE_LENGTH MAX_INSTANCE_NAME

typedef WCHAR TLocalDBInstanceName[MAX_LOCALDB_INSTANCE_NAME_LENGTH + 1];
typedef TLocalDBInstanceName* PTLocalDBInstanceName;

// type definition for LocalDBGetInstances function
typedef HRESULT __cdecl FnLocalDBGetInstances(
		// O					buffer for a LocalDB instance names
		__out					PTLocalDBInstanceName	pInstanceNames,
		// I/O					on input has the number slots for instance names in the pInstanceNames buffer. On output, 
		//						has the number of existing LocalDB instances
		__inout					LPDWORD					lpdwNumberOfInstances
);

// type definition for pointer to LocalDBGetInstances function
typedef FnLocalDBGetInstances* PFnLocalDBGetInstances;

// Function: LocalDBGetInstances
// 
// Description: This function returns names for all existing Local DB instances
//
// Usage Example:
//	DWORD dwN = 0;
//	LocalDBGetInstances(NULL, &dwN);

//	PTLocalDBInstanceName insts = (PTLocalDBInstanceName) malloc(dwN * sizeof(TLocalDBInstanceName));
//	LocalDBGetInstances(insts, &dwN);

//	for (int i = 0; i < dwN; i++)
//		wprintf(L"%s\n", insts[i]);
//
// Return values:
//	S_OK, if the function succeeds
//
// LOCALDB_ERROR_INSUFFICIENT_BUFFER,			the given buffer is to small
// LOCALDB_ERROR_INTERNAL_ERROR,		if an unexpected error occurred. See event log for details
//
FnLocalDBGetInstances LocalDBGetInstances;

// SID string format: S - Revision(1B) - Authority ID (6B) {- Sub authority ID (4B)} * max 15 sub-authorities = 1 + 1 + 3 + 1 + 15 + (1 + 10) * 15
#define MAX_STRING_SID_LENGTH 186

#pragma pack(push)
#pragma pack(8)

// DEVNOTE: If you want to modify this structure please read DEVNOTEs on top of function LocalDBGetInstanceInfo in sqluserinstance.cpp file.
//
typedef struct _LocalDBInstanceInfo
{
	DWORD					cbLocalDBInstanceInfoSize;
	TLocalDBInstanceName	wszInstanceName;
	BOOL					bExists;
	BOOL					bConfigurationCorrupted;
	BOOL					bIsRunning;
	DWORD					dwMajor;
	DWORD					dwMinor;
	DWORD					dwBuild;
	DWORD					dwRevision;
	FILETIME				ftLastStartDateUTC;
	WCHAR					wszConnection[LOCALDB_MAX_SQLCONNECTION_BUFFER_SIZE];
	BOOL					bIsShared;
	TLocalDBInstanceName	wszSharedInstanceName;
	WCHAR					wszOwnerSID[MAX_STRING_SID_LENGTH + 1];
	BOOL					bIsAutomatic;
} LocalDBInstanceInfo;

#pragma pack(pop)

typedef LocalDBInstanceInfo* PLocalDBInstanceInfo;

// type definition for LocalDBGetInstanceInfo function
typedef HRESULT __cdecl FnLocalDBGetInstanceInfo(
		// I		the LocalDB instance name
		__in_z		PCWSTR					wszInstanceName, 
		// O		instance information
		__out		PLocalDBInstanceInfo	pInfo,
		// I		Size of LocalDBInstanceInfo structure in bytes
		__in		DWORD					cbInfo);

// type definition for pointer to LocalDBGetInstances function
typedef FnLocalDBGetInstanceInfo* PFnLocalDBGetInstanceInfo;

// Function: LocalDBGetInstanceInfo
//
// Description: This function returns information about the given instance.
//
// Return values:
//	S_OK, if the function succeeds
//
// ERROR_INVALID_PARAMETER, if some of the parameters is invalid
// LOCALDB_ERROR_INTERNAL_ERROR,		if an unexpected error occurred. See event log for details
// 
FnLocalDBGetInstanceInfo LocalDBGetInstanceInfo;

// Version has format: Major.Minor[.Build[.Revision]]. Each of components is 32bit integer which is at most 40 digits and 3 dots
//
#define MAX_LOCALDB_VERSION_LENGTH 43

typedef WCHAR TLocalDBVersion[MAX_LOCALDB_VERSION_LENGTH + 1];
typedef TLocalDBVersion* PTLocalDBVersion;

// type definition for LocalDBGetVersions function
typedef HRESULT __cdecl FnLocalDBGetVersions(
		// O					buffer for installed LocalDB versions
		__out					PTLocalDBVersion	pVersions,
		// I/O					on input has the number slots for versions in the pVersions buffer. On output, 
		//						has the number of existing LocalDB versions
		__inout					LPDWORD				lpdwNumberOfVersions
);

// type definition for pointer to LocalDBGetVersions function
typedef FnLocalDBGetVersions* PFnLocalDBGetVersions;

// Function: LocalDBGetVersions
// 
// Description: This function returns all installed LocalDB versions. Returned versions will be in format Major.Minor
//
// Usage Example:
//	DWORD dwN = 0;
//	LocalDBGetVersions(NULL, &dwN);

//	PTLocalDBVersion versions = (PTLocalDBVersion) malloc(dwN * sizeof(TLocalDBVersion));
//	LocalDBGetVersions(insts, &dwN);

//	for (int i = 0; i < dwN; i++)
//		wprintf(L"%s\n", insts[i]);
//
// Return values:
//	S_OK, if the function succeeds
//
// LOCALDB_ERROR_INSUFFICIENT_BUFFER,			the given buffer is to small
// LOCALDB_ERROR_INTERNAL_ERROR,				if an unexpected error occurs.
//
FnLocalDBGetVersions LocalDBGetVersions;

#pragma pack(push)
#pragma pack(8)

// DEVNOTE: If you want to modify this structure please read DEVNOTEs on top of function LocalDBGetVersionInfo in sqluserinstance.cpp file.
//
typedef struct _LocalDBVersionInfo
{
	DWORD				cbLocalDBVersionInfoSize;
	TLocalDBVersion		wszVersion;
	BOOL				bExists;
	DWORD				dwMajor;
	DWORD				dwMinor;
	DWORD				dwBuild;
	DWORD				dwRevision;
} LocalDBVersionInfo;

#pragma pack(pop)

typedef LocalDBVersionInfo* PLocalDBVersionInfo;

// type definition for LocalDBGetVersionInfo function
typedef HRESULT __cdecl FnLocalDBGetVersionInfo(
		// I			LocalDB version string
		__in_z			PCWSTR					wszVersion,
		// O			version information
		__out			PLocalDBVersionInfo		pVersionInfo,
		// I			Size of LocalDBVersionInfo structure in bytes
		__in			DWORD					cbVersionInfo
);

// type definition for pointer to LocalDBGetVersionInfo function
typedef FnLocalDBGetVersionInfo* PFnLocalDBGetVersionInfo;

// Function: LocalDBGetVersionInfo
// 
// Description: This function returns information about the given LocalDB version
//
// Return values:
//	S_OK, if the function succeeds
//	LOCALDB_ERROR_INTERNAL_ERROR, if some internal error occurred
//	LOCALDB_ERROR_INVALID_PARAMETER, if a input parameter is invalid
//
FnLocalDBGetVersionInfo LocalDBGetVersionInfo;

typedef HRESULT __cdecl FnLocalDBStartTracing();
typedef FnLocalDBStartTracing* PFnLocalDBStartTracing;

// Function: LocalDBStartTracing
//
// Description: This function will write in registry that Tracing sessions should be started for the current user.
//
// Return values:
//	S_OK - on success
//	Propper HRESULT in case of failure
//
FnLocalDBStartTracing LocalDBStartTracing;

typedef HRESULT __cdecl FnLocalDBStopTracing();
typedef FnLocalDBStopTracing* PFnFnLocalDBStopTracing;

// Function: LocalDBStopTracing
//
// Description: This function will write in registry that Tracing sessions should be stopped for the current user.
//
// Return values:
//	S_OK - on success
//	Propper HRESULT in case of failure
//
FnLocalDBStopTracing LocalDBStopTracing;

// type definition for LocalDBShareInstance function
typedef HRESULT __cdecl FnLocalDBShareInstance(
		// I		the SID of the LocalDB instance owner
		__in_opt	PSID 					pOwnerSID, 
		// I		the private name of LocalDB instance which should be shared
		__in_z		PCWSTR					wszPrivateLocalDBInstanceName,
		// I		the public shared name
		__in_z		PCWSTR					wszSharedName,
		// I		reserved for the future use. Currently should be set to 0.
		__in		DWORD	dwFlags);

// type definition for pointer to LocalDBShareInstance function
typedef FnLocalDBShareInstance* PFnLocalDBShareInstance;

// Function: LocalDBShareInstance
//
// Description: This function will share the given private instance of the given user with the given shared name.
// This function has to be executed elevated.
//
// Return values:
//	HRESULT
//
FnLocalDBShareInstance LocalDBShareInstance;

// type definition for LocalDBUnshareInstance function
typedef HRESULT __cdecl FnLocalDBUnshareInstance(
		// I		the LocalDB instance name
		__in_z		PCWSTR					pInstanceName,
		// I		reserved for the future use. Currently should be set to 0.
		__in		DWORD	dwFlags);

// type definition for pointer to LocalDBUnshareInstance function
typedef FnLocalDBUnshareInstance* PFnLocalDBUnshareInstance;

// Function: LocalDBUnshareInstance
//
// Description: This function unshares the given LocalDB instance.
// If a shared name is given then that shared instance will be unshared.
// If a private name is given then we will check if the caller
// shares a private instance with the given private name and unshare it.
//
// Return values:
//	HRESULT
//
FnLocalDBUnshareInstance LocalDBUnshareInstance;

#ifdef __cplusplus
} // extern "C"
#endif

#if defined(LOCALDB_DEFINE_PROXY_FUNCTIONS)
//---------------------------------------------------------------------
// The following section is enabled only if the constant LOCALDB_DEFINE_PROXY_FUNCTIONS
// is defined. It provides an implementation of proxies for each of the LocalDB APIs.
// The proxy implementations use a common function to bind to entry points in the
// latest installed SqlUserInstance DLL, and then forward the requests.
//
// The current implementation loads the SqlUserInstance DLL on the first call into
// a proxy function. There is no provision for unloading the DLL. Note that if the
// process includes multiple binaries (EXE and one or more DLLs), each of them could
// load a separate instance of the SqlUserInstance DLL.
//
// For future consideration: allow the SqlUserInstance DLL to be unloaded dynamically.
//
// WARNING: these functions must not be called in DLL initialization, since a deadlock
// could result loading dependent DLLs.
//---------------------------------------------------------------------

// This macro provides the body for each proxy function.
//
#define LOCALDB_PROXY(LocalDBFn) static Fn##LocalDBFn* pfn##LocalDBFn = NULL; if (!pfn##LocalDBFn) {HRESULT hr = LocalDBGetPFn(#LocalDBFn, (FARPROC *)&pfn##LocalDBFn); if (FAILED(hr)) return hr;} return (*pfn##LocalDBFn)

// Structure and function to parse the "Installed Versions" registry subkeys
//
typedef struct {
    DWORD dwComponent[2];
    WCHAR wszKeyName[256];
} Version;

// The following algorithm is intended to match, in part, the .NET Version class.
// A maximum of two components are allowed, which must be separated with a period.
// Valid: "11", "11.0"
// Invalid: "", ".0", "11.", "11.0."
//
static BOOL ParseVersion(Version * pVersion)
{
    pVersion->dwComponent[0] = 0;
    pVersion->dwComponent[1] = 0;
    WCHAR * pwch = pVersion->wszKeyName;

    for (int i = 0; i<2; i++)
    {
        LONGLONG llVal = 0;
        BOOL fHaveDigit = FALSE;

        while (*pwch >= L'0' && *pwch <= L'9')
        {
            llVal = llVal * 10 + (*pwch++ - L'0');
            fHaveDigit = TRUE;

            if (llVal > 0x7fffffff)
            {
                return FALSE;
            }
        }

        if (!fHaveDigit)
            return FALSE;

        pVersion->dwComponent[i] = (DWORD) llVal;

        if (*pwch == L'\0')
            return TRUE;

        if (*pwch != L'.')
            return FALSE;

        pwch++;
    }
    // If we get here, the version string was terminated with L'.', which is not valid
    //
    return FALSE;
}

#include <assert.h>

// This function loads the correct LocalDB API DLL (if required) and returns a pointer to a procedure.
// Note that the first-loaded API DLL for the process will be used until process termination: installation of
//  a new version of the API will not be recognized after first load.
//
static HRESULT LocalDBGetPFn(LPCSTR szLocalDBFn, FARPROC *pfnLocalDBFn)
{
    static volatile HMODULE hLocalDBDll = NULL;

    if (!hLocalDBDll)
    {
        LONG    ec;
        HKEY    hkeyVersions = NULL;
        HKEY    hkeyVersion = NULL;
        Version verHigh = {0};
        Version verCurrent;
        DWORD   cchKeyName;
        DWORD   dwValueType;
        WCHAR   wszLocalDBDll[MAX_PATH+1];
        DWORD   cbLocalDBDll = sizeof(wszLocalDBDll) - sizeof(WCHAR); // to deal with RegQueryValueEx null-termination quirk
        HMODULE hLocalDBDllTemp = NULL;

        if (ERROR_SUCCESS != (ec = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Microsoft SQL Server Local DB\\Installed Versions", 0, KEY_READ, &hkeyVersions)))
        {
            goto Cleanup;
        }

        for (int i = 0; ; i++)
        {
            cchKeyName = 256;
            if (ERROR_SUCCESS != (ec = RegEnumKeyExW(hkeyVersions, i, verCurrent.wszKeyName, &cchKeyName, 0, NULL, NULL, NULL)))
            {
                if (ERROR_NO_MORE_ITEMS == ec)
                {
                    break;
                }
                goto Cleanup;
            }

            if (!ParseVersion(&verCurrent))
            {
                continue; // invalid version syntax
            }

            if (verCurrent.dwComponent[0] > verHigh.dwComponent[0] ||
                (verCurrent.dwComponent[0] == verHigh.dwComponent[0] && verCurrent.dwComponent[1] > verHigh.dwComponent[1]))
            {
                verHigh = verCurrent;
            }
        }
        if (!verHigh.wszKeyName[0])
        {
            // ec must be ERROR_NO_MORE_ITEMS here
            //
            assert(ec == ERROR_NO_MORE_ITEMS);

            // We will change the error code to ERROR_FILE_NOT_FOUND in order to indicate that
            // LocalDB instalation is not found. Registry key "SOFTWARE\\Microsoft\\Microsoft SQL Server Local DB\\Installed Versions" exists
            // but it is empty.
            //
            ec = ERROR_FILE_NOT_FOUND;
            goto Cleanup;
        }

        if (ERROR_SUCCESS != (ec = RegOpenKeyExW(hkeyVersions, verHigh.wszKeyName, 0, KEY_READ, &hkeyVersion)))
        {
            goto Cleanup;
        }
        if (ERROR_SUCCESS != (ec = RegQueryValueExW(hkeyVersion, L"InstanceAPIPath", NULL, &dwValueType, (PBYTE) wszLocalDBDll, &cbLocalDBDll)))
        {
            goto Cleanup;
        }
        if (dwValueType != REG_SZ)
        {
            ec = ERROR_INVALID_DATA;
            goto Cleanup;
        }
        // Ensure string value null-terminated
        // Note that we left a spare character in the output buffer for RegQueryValueEx for this purpose
        //
        wszLocalDBDll[cbLocalDBDll/sizeof(WCHAR)] = L'\0';

        hLocalDBDllTemp = LoadLibraryW(wszLocalDBDll);
        if (NULL == hLocalDBDllTemp)
        {
            ec = GetLastError();
            goto Cleanup;
        }
        if (NULL == InterlockedCompareExchangePointer((volatile PVOID *)&hLocalDBDll, hLocalDBDllTemp, NULL))
        {
            // We were the winner: we gave away our DLL handle
            //
            hLocalDBDllTemp = NULL;
        }
        ec = ERROR_SUCCESS;
Cleanup:
        if (hLocalDBDllTemp)
            FreeLibrary(hLocalDBDllTemp);
        if (hkeyVersion)
            RegCloseKey(hkeyVersion);
        if (hkeyVersions)
            RegCloseKey(hkeyVersions);

        // Error code ERROR_FILE_NOT_FOUND can occure if registry hive with installed LocalDB versions is missing.
        // In that case we should return the LocalDB specific error code
        //
        if (ec == ERROR_FILE_NOT_FOUND)
            return LOCALDB_ERROR_NOT_INSTALLED;

        if (ec != ERROR_SUCCESS)
            return HRESULT_FROM_WIN32(ec);
    }

    FARPROC pfn = GetProcAddress(hLocalDBDll, szLocalDBFn);

    if (!pfn)
    {
       return HRESULT_FROM_WIN32(GetLastError());
    }
    *pfnLocalDBFn = pfn;
    return S_OK;
}

// The following proxy functions forward calls to the latest LocalDB API DLL.
//

HRESULT __cdecl
LocalDBCreateInstance (
		// I			the LocalDB version (e.g. 11.0 or 11.0.1094.2)
		__in_z			PCWSTR	wszVersion,
		// I			the instance name
		__in_z			PCWSTR	pInstanceName,
		// I			reserved for the future use. Currently should be set to 0.
		__in			DWORD	dwFlags
)
{
	LOCALDB_PROXY(LocalDBCreateInstance)(wszVersion, pInstanceName, dwFlags);
}

HRESULT __cdecl
LocalDBStartInstance(
		// I			the instance name
		__in_z										PCWSTR	pInstanceName,
		// I			reserved for the future use. Currently should be set to 0.
		__in										DWORD	dwFlags,
		// O			the buffer to store the connection string to the LocalDB instance
		__out_ecount_z_opt(*lpcchSqlConnection)		LPWSTR	wszSqlConnection,
		// I/O			on input has the size of the wszSqlConnection buffer in characters. On output, if the given buffer size is 
		//				too small, has the buffer size required, in characters, including trailing null.
		__inout_opt									LPDWORD	lpcchSqlConnection
)
{
	LOCALDB_PROXY(LocalDBStartInstance)(pInstanceName, dwFlags, wszSqlConnection, lpcchSqlConnection);
}

HRESULT __cdecl
LocalDBStopInstance (
		// I			the instance name
		__in_z			PCWSTR	pInstanceName,
		// I			Available flags:
		//				LOCALDB_SHUTDOWN_KILL_PROCESS		- force the instance to stop immediately
		//				LOCALDB_SHUTDOWN_WITH_NOWAIT	- shutdown the instance with NOWAIT option
		__in			DWORD	dwFlags,
		// I			the time in seconds to wait this operation to complete. If this value is 0, this function will return immediately
		//				without waiting for LocalDB instance to stop
		__in			ULONG	ulTimeout
)
{
	LOCALDB_PROXY(LocalDBStopInstance)(pInstanceName, dwFlags, ulTimeout);
}

HRESULT __cdecl
LocalDBDeleteInstance (
		// I			the instance name
		__in_z			PCWSTR	pInstanceName,
		//				reserved for the future use. Currently should be set to 0.
		__in			DWORD	dwFlags
)
{
	LOCALDB_PROXY(LocalDBDeleteInstance)(pInstanceName, dwFlags);
}

HRESULT __cdecl
LocalDBFormatMessage(
			// I		the LocalDB error code
			__in								HRESULT	hrLocalDB,
			// I		Available flags:
			//			LOCALDB_TRUNCATE_ERR_MESSAGE - if the input buffer is too short,
			//			the error message will be truncated to fit into the buffer 
			__in								DWORD	dwFlags,
			// I		Language desired (LCID) or 0 (in which case Win32 FormatMessage order is used)
			__in								DWORD	dwLanguageId,
			// O		the buffer to store the LocalDB error message
			__out_ecount_z(*lpcchMessage)		LPWSTR	wszMessage,
			// I/O		on input has the size of the wszMessage buffer in characters. On output, if the given buffer size is 
			//			too small, has the buffer size required, in characters, including trailing null. If the function succeeds
			//			contains the number of characters in the message, excluding the trailing null
			__inout								LPDWORD	lpcchMessage
)
{
	LOCALDB_PROXY(LocalDBFormatMessage)(hrLocalDB, dwFlags, dwLanguageId, wszMessage, lpcchMessage);
}

HRESULT __cdecl
LocalDBGetInstances(
		// O					buffer with instance names
		__out					PTLocalDBInstanceName	pInstanceNames,
		// I/O					on input has the number slots for instance names in the pInstanceNames buffer. On output, 
		//						has the number of existing LocalDB instances
		__inout					LPDWORD					lpdwNumberOfInstances
)
{
	LOCALDB_PROXY(LocalDBGetInstances)(pInstanceNames, lpdwNumberOfInstances);
}

HRESULT __cdecl
LocalDBGetInstanceInfo(
		// I		the instance name
		__in_z		PCWSTR					wszInstanceName, 
		// O		instance information
		__out		PLocalDBInstanceInfo	pInfo,
		// I		Size of LocalDBInstanceInfo structure in bytes
		__in		DWORD					cbInfo
)
{
	LOCALDB_PROXY(LocalDBGetInstanceInfo)(wszInstanceName, pInfo, cbInfo);
}

HRESULT __cdecl
LocalDBStartTracing()
{
	LOCALDB_PROXY(LocalDBStartTracing)();
}

HRESULT __cdecl
LocalDBStopTracing()
{
	LOCALDB_PROXY(LocalDBStopTracing)();
}

HRESULT __cdecl 
LocalDBShareInstance(
		// I		the SID of the LocalDB instance owner
		__in_opt	PSID 					pOwnerSID, 
		// I		the private name of LocalDB instance which should be shared
		__in_z		PCWSTR					wszLocalDBInstancePrivateName,
		// I		the public shared name
		__in_z		PCWSTR					wszSharedName,
		// I		reserved for the future use. Currently should be set to 0.
		__in		DWORD	dwFlags)
{
	LOCALDB_PROXY(LocalDBShareInstance)(pOwnerSID, wszLocalDBInstancePrivateName, wszSharedName, dwFlags);
}

HRESULT __cdecl
LocalDBGetVersions(
		// O					buffer for installed LocalDB versions
		__out					PTLocalDBVersion	pVersions,
		// I/O					on input has the number slots for versions in the pVersions buffer. On output, 
		//						has the number of existing LocalDB versions
		__inout					LPDWORD				lpdwNumberOfVersions
)
{
	LOCALDB_PROXY(LocalDBGetVersions)(pVersions, lpdwNumberOfVersions);
}

HRESULT __cdecl
LocalDBUnshareInstance(
		// I		the LocalDB instance name
		__in_z		PCWSTR					pInstanceName,
		// I		reserved for the future use. Currently should be set to 0.
		__in		DWORD	dwFlags)
{
	LOCALDB_PROXY(LocalDBUnshareInstance)(pInstanceName, dwFlags);
}

HRESULT __cdecl 
LocalDBGetVersionInfo(
		// I			LocalDB version string
		__in_z			PCWSTR						wszVersion,
		// O			version information
		__out			PLocalDBVersionInfo			pVersionInfo,
		// I			Size of LocalDBVersionInfo structure in bytes
		__in			DWORD						cbVersionInfo)
{
	LOCALDB_PROXY(LocalDBGetVersionInfo)(wszVersion, pVersionInfo, cbVersionInfo);
}

#endif

#endif	// _SQLUSERINSTANCE_H_

//-----------------------------------------------------------------------------
// File:			sqluserinstancemsgs.mc
//
// Copyright:		Copyright (c) Microsoft Corporation
//-----------------------------------------------------------------------------
#ifndef _LOCALDB_MESSAGES_H_
#define _LOCALDB_MESSAGES_H_
// Header section
//
// Section with the LocalDB messages
//
//
//  Values are 32 bit values laid out as follows:
//
//   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
//   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
//  +-+-+-+-+-+---------------------+-------------------------------+
//  |S|R|C|N|r|    Facility         |               Code            |
//  +-+-+-+-+-+---------------------+-------------------------------+
//
//  where
//
//      S - Severity - indicates success/fail
//
//          0 - Success
//          1 - Fail (COERROR)
//
//      R - reserved portion of the facility code, corresponds to NT's
//              second severity bit.
//
//      C - reserved portion of the facility code, corresponds to NT's
//              C field.
//
//      N - reserved portion of the facility code. Used to indicate a
//              mapped NT status value.
//
//      r - reserved portion of the facility code. Reserved for internal
//              use. Used to indicate HRESULT values that are not status
//              values, but are instead message ids for display strings.
//
//      Facility - is the facility code
//
//      Code - is the facility's status code
//
//
// Define the facility codes
//
#define FACILITY_LOCALDB                 0x9C5


//
// Define the severity codes
//
#define LOCALDB_SEVERITY_SUCCESS         0x0
#define LOCALDB_SEVERITY_ERROR           0x2


//
// MessageId: LOCALDB_ERROR_CANNOT_CREATE_INSTANCE_FOLDER
//
// MessageText:
//
// Cannot create folder for the LocalDB instance at: %%LOCALAPPDATA%%\Microsoft\Microsoft SQL Server Local DB\Instances\<instance name>.
//
#define LOCALDB_ERROR_CANNOT_CREATE_INSTANCE_FOLDER ((HRESULT)0x89C50100L)

//
// MessageId: LOCALDB_ERROR_INVALID_PARAMETER
//
// MessageText:
//
// The parameter for the LocalDB Instance API method is incorrect. Consult the API documentation.
//
#define LOCALDB_ERROR_INVALID_PARAMETER  ((HRESULT)0x89C50101L)

//
// MessageId: LOCALDB_ERROR_INSTANCE_EXISTS_WITH_LOWER_VERSION
//
// MessageText:
//
// Unable to create the LocalDB instance with specified version. An instance with the same name already exists, but it has lower version than the specified version.
//
#define LOCALDB_ERROR_INSTANCE_EXISTS_WITH_LOWER_VERSION ((HRESULT)0x89C50102L)

//
// MessageId: LOCALDB_ERROR_CANNOT_GET_USER_PROFILE_FOLDER
//
// MessageText:
//
// Cannot access the user profile folder for local application data (%%LOCALAPPDATA%%).
//
#define LOCALDB_ERROR_CANNOT_GET_USER_PROFILE_FOLDER ((HRESULT)0x89C50103L)

//
// MessageId: LOCALDB_ERROR_INSTANCE_FOLDER_PATH_TOO_LONG
//
// MessageText:
//
// The full path length of the LocalDB instance folder is longer than MAX_PATH. The instance must be stored in folder: %%LOCALAPPDATA%%\Microsoft\Microsoft SQL Server Local DB\Instances\<instance name>.
//
#define LOCALDB_ERROR_INSTANCE_FOLDER_PATH_TOO_LONG ((HRESULT)0x89C50104L)

//
// MessageId: LOCALDB_ERROR_CANNOT_ACCESS_INSTANCE_FOLDER
//
// MessageText:
//
// Cannot access LocalDB instance folder: %%LOCALAPPDATA%%\Microsoft\Microsoft SQL Server Local DB\Instances\<instance name>.
//
#define LOCALDB_ERROR_CANNOT_ACCESS_INSTANCE_FOLDER ((HRESULT)0x89C50105L)

//
// MessageId: LOCALDB_ERROR_CANNOT_ACCESS_INSTANCE_REGISTRY
//
// MessageText:
//
// Unexpected error occurred while trying to access the LocalDB instance registry configuration. See the Windows Application event log for error details.
//
#define LOCALDB_ERROR_CANNOT_ACCESS_INSTANCE_REGISTRY ((HRESULT)0x89C50106L)

//
// MessageId: LOCALDB_ERROR_UNKNOWN_INSTANCE
//
// MessageText:
//
// The specified LocalDB instance does not exist.
//
#define LOCALDB_ERROR_UNKNOWN_INSTANCE   ((HRESULT)0x89C50107L)

//
// MessageId: LOCALDB_ERROR_INTERNAL_ERROR
//
// MessageText:
//
// Unexpected error occurred inside a LocalDB instance API method call. See the Windows Application event log for error details.
//
#define LOCALDB_ERROR_INTERNAL_ERROR     ((HRESULT)0x89C50108L)

//
// MessageId: LOCALDB_ERROR_CANNOT_MODIFY_INSTANCE_REGISTRY
//
// MessageText:
//
// Unexpected error occurred while trying to modify the registry configuration for the LocalDB instance. See the Windows Application event log for error details.
//
#define LOCALDB_ERROR_CANNOT_MODIFY_INSTANCE_REGISTRY ((HRESULT)0x89C50109L)

//
// MessageId: LOCALDB_ERROR_SQL_SERVER_STARTUP_FAILED
//
// MessageText:
//
// Error occurred during LocalDB instance startup: SQL Server process failed to start.
//
#define LOCALDB_ERROR_SQL_SERVER_STARTUP_FAILED ((HRESULT)0x89C5010AL)

//
// MessageId: LOCALDB_ERROR_INSTANCE_CONFIGURATION_CORRUPT
//
// MessageText:
//
// LocalDB instance is corrupted. See the Windows Application event log for error details.
//
#define LOCALDB_ERROR_INSTANCE_CONFIGURATION_CORRUPT ((HRESULT)0x89C5010BL)

//
// MessageId: LOCALDB_ERROR_CANNOT_CREATE_SQL_PROCESS
//
// MessageText:
//
// Error occurred during LocalDB instance startup: unable to create the SQL Server process.
//
#define LOCALDB_ERROR_CANNOT_CREATE_SQL_PROCESS ((HRESULT)0x89C5010CL)

//
// MessageId: LOCALDB_ERROR_UNKNOWN_VERSION
//
// MessageText:
//
// The specified LocalDB version is not available on this computer.
//
#define LOCALDB_ERROR_UNKNOWN_VERSION    ((HRESULT)0x89C5010DL)

//
// MessageId: LOCALDB_ERROR_UNKNOWN_LANGUAGE_ID
//
// MessageText:
//
// Error getting the localized error message. The language specified by 'Language ID' parameter is unknown.
//
#define LOCALDB_ERROR_UNKNOWN_LANGUAGE_ID ((HRESULT)0x89C5010EL)

//
// MessageId: LOCALDB_ERROR_INSTANCE_STOP_FAILED
//
// MessageText:
//
// Stop operation for LocalDB instance failed to complete within the specified time.
//
#define LOCALDB_ERROR_INSTANCE_STOP_FAILED ((HRESULT)0x89C5010FL)

//
// MessageId: LOCALDB_ERROR_UNKNOWN_ERROR_CODE
//
// MessageText:
//
// Error getting the localized error message. The specified error code is unknown.
//
#define LOCALDB_ERROR_UNKNOWN_ERROR_CODE ((HRESULT)0x89C50110L)

//
// MessageId: LOCALDB_ERROR_VERSION_REQUESTED_NOT_INSTALLED
//
// MessageText:
//
// The LocalDB version available on this workstation is lower than the requested LocalDB version.
//
#define LOCALDB_ERROR_VERSION_REQUESTED_NOT_INSTALLED ((HRESULT)0x89C50111L)

//
// MessageId: LOCALDB_ERROR_INSTANCE_BUSY
//
// MessageText:
//
// Requested operation on LocalDB instance cannot be performed because specified instance is currently in use. Stop the instance and try again.
//
#define LOCALDB_ERROR_INSTANCE_BUSY      ((HRESULT)0x89C50112L)

//
// MessageId: LOCALDB_ERROR_INVALID_OPERATION
//
// MessageText:
//
// Default LocalDB instances cannot be created, stopped or deleted manually.
//
#define LOCALDB_ERROR_INVALID_OPERATION  ((HRESULT)0x89C50113L)

//
// MessageId: LOCALDB_ERROR_INSUFFICIENT_BUFFER
//
// MessageText:
//
// The buffer passed to the LocalDB instance API method has insufficient size.
//
#define LOCALDB_ERROR_INSUFFICIENT_BUFFER ((HRESULT)0x89C50114L)

//
// MessageId: LOCALDB_ERROR_WAIT_TIMEOUT
//
// MessageText:
//
// Timeout occurred inside the LocalDB instance API method.
//
#define LOCALDB_ERROR_WAIT_TIMEOUT       ((HRESULT)0x89C50115L)

// MessageId=0x0116 message id is reserved. This message ID will be used for error LOCALDB_ERROR_NOT_INSTALLED.
// This message is specific since it has to be present in SqlUserIntsnace.h because it can be returned by discovery API.
//
//
// MessageId: LOCALDB_ERROR_XEVENT_FAILED
//
// MessageText:
//
// Failed to start XEvent engine within the LocalDB Instance API.
//
#define LOCALDB_ERROR_XEVENT_FAILED      ((HRESULT)0x89C50117L)

//
// MessageId: LOCALDB_ERROR_AUTO_INSTANCE_CREATE_FAILED
//
// MessageText:
//
// Cannot create an automatic instance. See the Windows Application event log for error details.
//
#define LOCALDB_ERROR_AUTO_INSTANCE_CREATE_FAILED ((HRESULT)0x89C50118L)

//
// MessageId: LOCALDB_ERROR_SHARED_NAME_TAKEN
//
// MessageText:
//
// Cannot create a shared instance. The specified shared instance name is already in use.
//
#define LOCALDB_ERROR_SHARED_NAME_TAKEN  ((HRESULT)0x89C50119L)

//
// MessageId: LOCALDB_ERROR_CALLER_IS_NOT_OWNER
//
// MessageText:
//
// API caller is not LocalDB instance owner.
//
#define LOCALDB_ERROR_CALLER_IS_NOT_OWNER ((HRESULT)0x89C5011AL)

//
// MessageId: LOCALDB_ERROR_INVALID_INSTANCE_NAME
//
// MessageText:
//
// Specified LocalDB instance name is invalid.
//
#define LOCALDB_ERROR_INVALID_INSTANCE_NAME ((HRESULT)0x89C5011BL)

//
// MessageId: LOCALDB_ERROR_INSTANCE_ALREADY_SHARED
//
// MessageText:
//
// The specified LocalDB instance is already shared with different shared name.
//
#define LOCALDB_ERROR_INSTANCE_ALREADY_SHARED ((HRESULT)0x89C5011CL)

//
// MessageId: LOCALDB_ERROR_INSTANCE_NOT_SHARED
//
// MessageText:
//
// The specified LocalDB instance is not shared.
//
#define LOCALDB_ERROR_INSTANCE_NOT_SHARED ((HRESULT)0x89C5011DL)

//
// MessageId: LOCALDB_ERROR_ADMIN_RIGHTS_REQUIRED
//
// MessageText:
//
// Administrator privileges are required in order to execute this operation.
//
#define LOCALDB_ERROR_ADMIN_RIGHTS_REQUIRED ((HRESULT)0x89C5011EL)

//
// MessageId: LOCALDB_ERROR_TOO_MANY_SHARED_INSTANCES
//
// MessageText:
//
// There are too many shared instance and we cannot generate unique User Instance Name. Unshare some of the existing shared instances.
//
#define LOCALDB_ERROR_TOO_MANY_SHARED_INSTANCES ((HRESULT)0x89C5011FL)

//
// MessageId: LOCALDB_ERROR_CANNOT_GET_LOCAL_APP_DATA_PATH
//
// MessageText:
//
// Cannot get a local application data path. Most probably a user profile is not loaded. If LocalDB is executed under IIS, make sure that profile loading is enabled for the current user.
//
#define LOCALDB_ERROR_CANNOT_GET_LOCAL_APP_DATA_PATH ((HRESULT)0x89C50120L)

//
// MessageId: LOCALDB_ERROR_CANNOT_LOAD_RESOURCES
//
// MessageText:
//
// Cannot load resources for this DLL. Resources for this DLL should be stored in a subfolder Resources, with the same file name as this DLL and the extension ".RLL".
//
#define LOCALDB_ERROR_CANNOT_LOAD_RESOURCES ((HRESULT)0x89C50121L)

 // Detailed error descriptions
//
// MessageId: LOCALDB_EDETAIL_DATADIRECTORY_IS_MISSING
//
// MessageText:
//
// The "DataDirectory" registry value is missing in the LocalDB instance registry key: %1
//
#define LOCALDB_EDETAIL_DATADIRECTORY_IS_MISSING ((HRESULT)0x89C50200L)

//
// MessageId: LOCALDB_EDETAIL_CANNOT_ACCESS_INSTANCE_FOLDER
//
// MessageText:
//
// Cannot access LocalDB instance folder: %1
//
#define LOCALDB_EDETAIL_CANNOT_ACCESS_INSTANCE_FOLDER ((HRESULT)0x89C50201L)

//
// MessageId: LOCALDB_EDETAIL_DATADIRECTORY_IS_TOO_LONG
//
// MessageText:
//
// The "DataDirectory" registry value is too long in the LocalDB instance registry key: %1
//
#define LOCALDB_EDETAIL_DATADIRECTORY_IS_TOO_LONG ((HRESULT)0x89C50202L)

//
// MessageId: LOCALDB_EDETAIL_PARENT_INSTANCE_IS_MISSING
//
// MessageText:
//
// The "Parent Instance" registry value is missing in the LocalDB instance registry key: %1
//
#define LOCALDB_EDETAIL_PARENT_INSTANCE_IS_MISSING ((HRESULT)0x89C50203L)

//
// MessageId: LOCALDB_EDETAIL_PARENT_INSTANCE_IS_TOO_LONG
//
// MessageText:
//
// The "Parent Instance" registry value is too long in the LocalDB instance registry key: %1
//
#define LOCALDB_EDETAIL_PARENT_INSTANCE_IS_TOO_LONG ((HRESULT)0x89C50204L)

//
// MessageId: LOCALDB_EDETAIL_DATA_DIRECTORY_INVALID
//
// MessageText:
//
// Data directory for LocalDB instance is invalid: %1
//
#define LOCALDB_EDETAIL_DATA_DIRECTORY_INVALID ((HRESULT)0x89C50205L)

//
// MessageId: LOCALDB_EDETAIL_XEVENT_ASSERT
//
// MessageText:
//
// LocalDB instance API: XEvent engine assert: %1 in %2:%3 (%4)
//
#define LOCALDB_EDETAIL_XEVENT_ASSERT    ((HRESULT)0x89C50206L)

//
// MessageId: LOCALDB_EDETAIL_XEVENT_ERROR
//
// MessageText:
//
// LocalDB instance API: XEvent error: %1
//
#define LOCALDB_EDETAIL_XEVENT_ERROR     ((HRESULT)0x89C50207L)

//
// MessageId: LOCALDB_EDETAIL_INSTALLATION_CORRUPTED
//
// MessageText:
//
// LocalDB installation is corrupted. Reinstall the LocalDB.
//
#define LOCALDB_EDETAIL_INSTALLATION_CORRUPTED ((HRESULT)0x89C50208L)

//
// MessageId: LOCALDB_EDETAIL_CANNOT_GET_PROGRAM_FILES_LOCATION
//
// MessageText:
//
// LocalDB XEvent error: cannot determine %ProgramFiles% folder location.
//
#define LOCALDB_EDETAIL_CANNOT_GET_PROGRAM_FILES_LOCATION ((HRESULT)0x89C50209L)

//
// MessageId: LOCALDB_EDETAIL_XEVENT_CANNOT_INITIALIZE
//
// MessageText:
//
// LocalDB XEvent error: Cannot initialize XEvent engine.
//
#define LOCALDB_EDETAIL_XEVENT_CANNOT_INITIALIZE ((HRESULT)0x89C5020AL)

//
// MessageId: LOCALDB_EDETAIL_XEVENT_CANNOT_FIND_CONF_FILE
//
// MessageText:
//
// LocalDB XEvent error: Cannot find XEvents configuration file: %1
//
#define LOCALDB_EDETAIL_XEVENT_CANNOT_FIND_CONF_FILE ((HRESULT)0x89C5020BL)

//
// MessageId: LOCALDB_EDETAIL_XEVENT_CANNOT_CONFIGURE
//
// MessageText:
//
// LocalDB XEvent error: Cannot configure XEvents engine with the configuration file: %1
// HRESULT returned: %2
//
#define LOCALDB_EDETAIL_XEVENT_CANNOT_CONFIGURE ((HRESULT)0x89C5020CL)

//
// MessageId: LOCALDB_EDETAIL_XEVENT_CONF_FILE_NAME_TOO_LONG
//
// MessageText:
//
// LocalDB XEvent error: XEvents engine configuration file too long
//
#define LOCALDB_EDETAIL_XEVENT_CONF_FILE_NAME_TOO_LONG ((HRESULT)0x89C5020DL)

//
// MessageId: LOCALDB_EDETAIL_COINITIALIZEEX_FAILED
//
// MessageText:
//
// CoInitializeEx API failed. HRESULT returned: %1
//
#define LOCALDB_EDETAIL_COINITIALIZEEX_FAILED ((HRESULT)0x89C5020EL)

//
// MessageId: LOCALDB_EDETAIL_PARENT_INSTANCE_VERSION_INVALID
//
// MessageText:
//
// LocalDB parent instance version is invalid: %1
//
#define LOCALDB_EDETAIL_PARENT_INSTANCE_VERSION_INVALID ((HRESULT)0x89C5020FL)

//
// MessageId: LOCALDB_EDETAIL_WINAPI_ERROR
//
// MessageText:
//
// Windows API call %1 returned error code: %2. Windows system error message is: %3Reported at line: %4. %5
//
#define LOCALDB_EDETAIL_WINAPI_ERROR     ((HRESULT)0xC9C50210L)

//
// MessageId: LOCALDB_EDETAIL_UNEXPECTED_RESULT
//
// MessageText:
//
// Function %1 returned %2 at line %3.
//
#define LOCALDB_EDETAIL_UNEXPECTED_RESULT ((HRESULT)0x89C50211L)

//
#endif


extern RPC_IF_HANDLE __MIDL_itf_msoledbsql_0000_0012_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_msoledbsql_0000_0012_v0_0_s_ifspec;

/* Additional Prototypes for ALL interfaces */

/* end of Additional Prototypes */

#ifdef __cplusplus
}
#endif

#endif