Merge pull request #134 from Microsoft/amitmsft-sqlvdi

Amitmsft sqlvdi
This commit is contained in:
Amit Banerjee
2016-09-27 18:24:26 -07:00
committed by GitHub
4 changed files with 1884 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
# SQLVDI
This folder contains the latest files and samples required to build a SQL Server VDI based backup/restore application.
### Files available
1. vdi.h
2. vdierror.h
3. vdiguid.h
A new **VDC_Complete** command was added to SQLVDI that indicates SQL Server has completed sending data to the VDI client. Therefore, the VDI client will be able to finish the backup before it sends response to SQL Server.
More details about this improvement in the SQLVDI protocol can be found in [KB3188454: Enhance VDI Protocol with VDC_Complete command in SQL Server] (https://support.microsoft.com/en-us/kb/3188454)
The following implementations have to be applied to your VDI client:
1. Request the new VDI feature VDF_RequestComplete.
2. If SQL Server supports the VDC_Complete command, it will return a not NULL response.
3. Otherwise, it would return a NULL response for the requested feature.
The code sample here shows how to request the feature: 
```
m_pvdiComponents->m_pvdConfig->features = VDF_RequestComplete;
printf("Requested features to SQL Server: 0x{0:X}", m_pvdiComponents->m_pvdConfig->features);
```
Determine whether the SQL Server supports the new VDC_Complete command by using the GetConfiguration function.
```
hr = m_pvdiComponents->m_pvdDeviceSet->GetConfiguration(timeout, m_pvdiComponents->m_pvdConfig);
if (!(m_pvdiComponents->m_pvdConfig->features & VDF_CompleteEnabled))
{
printf("Server does not support VDC_Complete.");
return VD_E_NOTSUPPORTED;
}
```
When you process the VDI messages that are fetched by the GetCommand function, add an additional case statement to process the VDC_Complete command.
```
case VDC_Complete:
// Close the media and ensure that book keeping is completed.
backupMedia->Close();
completionCode = ERROR_SUCCESS;
break;
```
File diff suppressed because it is too large Load Diff
+78
View File
@@ -0,0 +1,78 @@
#ifndef VDIERROR_H_
#define VDIERROR_H_
//****************************************************************************
// Copyright (c) Microsoft Corporation.
//
// vdierror.h
//
// Purpose:
// Declare the error codes emitted by the virtual device interface.
//
//****************************************************************************
//---------------------------------------------------------------------------------------
// Error code handling will be done in standard COM fashion:
//
// an HRESULT is returned and the caller can use
// SUCCEEDED(code) or FAILED(code) to determine
// if the function failed or not.
//
// Form an error code mask.
// All VDI errors have 0x8077 as prefix.
//
#define VD_ERROR(code) MAKE_HRESULT(SEVERITY_ERROR, 0x77, code)
// The object was not open
//
#define VD_E_NOTOPEN VD_ERROR( 2 ) /* 0x80770002 */
// The api was waiting and the timeout interval had elapsed.
//
#define VD_E_TIMEOUT VD_ERROR( 3 ) /* 0x80770003 */
// An abort request is preventing anything except termination actions.
//
#define VD_E_ABORT VD_ERROR( 4 ) /* 0x80770004 */
// Failed to create security environment.
//
#define VD_E_SECURITY VD_ERROR( 5 ) /* 0x80770005 */
// An invalid parameter was supplied
//
#define VD_E_INVALID VD_ERROR( 6 ) /* 0x80770006 */
// Failed to recognize the SQL Server instance name
//
#define VD_E_INSTANCE_NAME VD_ERROR( 7 ) /* 0x80770007 */
// The requested configuration is invalid
//
#define VD_E_NOTSUPPORTED VD_ERROR( 9 ) /* 0x80770009 */
// Out of memory
//
#define VD_E_MEMORY VD_ERROR( 10 ) /* 0x8077000a */
// Unexpected internal error
//
#define VD_E_UNEXPECTED VD_ERROR (11) /* 0x8077000b */
// Protocol error
//
#define VD_E_PROTOCOL VD_ERROR (12) /* 0x8077000c */
// All devices are open
//
#define VD_E_OPEN VD_ERROR (13) /* 0x8077000d */
// the object is now closed
//
#define VD_E_CLOSE VD_ERROR (14) /* 0x8077000e */
// the resource is busy
//
#define VD_E_BUSY VD_ERROR (15) /* 0x8077000f */
#endif
+198
View File
@@ -0,0 +1,198 @@
/* this ALWAYS GENERATED file contains the IIDs and CLSIDs */
/* link this file in with the server and any clients */
/* File created by MIDL compiler version 7.00.0408 */
/* at Tue Sep 28 18:18:04 2004
*/
/* Compiler settings for vdi.idl:
Oicf, W1, Zp8, env=Win32 (32b run)
protocol : dce , 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( )
#if !defined(_M_IA64) && !defined(_M_AMD64)
#pragma warning( disable: 4049 ) /* more than 64k source lines */
#ifdef __cplusplus
extern "C"{
#endif
#include <rpc.h>
#include <rpcndr.h>
#ifdef _MIDL_USE_GUIDDEF_
#ifndef INITGUID
#define INITGUID
#include <guiddef.h>
#undef INITGUID
#else
#include <guiddef.h>
#endif
#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8)
#else // !_MIDL_USE_GUIDDEF_
#ifndef __IID_DEFINED__
#define __IID_DEFINED__
typedef struct _IID
{
unsigned long x;
unsigned short s1;
unsigned short s2;
unsigned char c[8];
} IID;
#endif // __IID_DEFINED__
#ifndef CLSID_DEFINED
#define CLSID_DEFINED
typedef IID CLSID;
#endif // CLSID_DEFINED
#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
#endif !_MIDL_USE_GUIDDEF_
MIDL_DEFINE_GUID(IID, IID_IClientVirtualDevice,0x40700424,0x0080,0x11d2,0x85,0x1f,0x00,0xc0,0x4f,0xc2,0x17,0x59);
MIDL_DEFINE_GUID(IID, IID_IClientVirtualDeviceSet,0x40700425,0x0080,0x11d2,0x85,0x1f,0x00,0xc0,0x4f,0xc2,0x17,0x59);
MIDL_DEFINE_GUID(IID, IID_IClientVirtualDeviceSet2,0xd0e6eb07,0x7a62,0x11d2,0x85,0x73,0x00,0xc0,0x4f,0xc2,0x17,0x59);
MIDL_DEFINE_GUID(IID, IID_IServerVirtualDevice,0xb5e7a131,0xa7bd,0x11d1,0x84,0xc2,0x00,0xc0,0x4f,0xc2,0x17,0x59);
MIDL_DEFINE_GUID(IID, IID_IServerVirtualDeviceSet,0xb5e7a132,0xa7bd,0x11d1,0x84,0xc2,0x00,0xc0,0x4f,0xc2,0x17,0x59);
MIDL_DEFINE_GUID(IID, IID_IServerVirtualDeviceSet2,0xAECBD0D6,0x24C6,0x11d3,0x85,0xB7,0x00,0xC0,0x4F,0xC2,0x17,0x59);
#undef MIDL_DEFINE_GUID
#ifdef __cplusplus
}
#endif
#endif /* !defined(_M_IA64) && !defined(_M_AMD64)*/
/* this ALWAYS GENERATED file contains the IIDs and CLSIDs */
/* link this file in with the server and any clients */
/* File created by MIDL compiler version 7.00.0408 */
/* at Tue Sep 28 18:18:04 2004
*/
/* Compiler settings for vdi.idl:
Oicf, W1, Zp8, env=Win64 (32b run,appending)
protocol : dce , 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( )
#if defined(_M_IA64) || defined(_M_AMD64)
#pragma warning( disable: 4049 ) /* more than 64k source lines */
#ifdef __cplusplus
extern "C"{
#endif
#include <rpc.h>
#include <rpcndr.h>
#ifdef _MIDL_USE_GUIDDEF_
#ifndef INITGUID
#define INITGUID
#include <guiddef.h>
#undef INITGUID
#else
#include <guiddef.h>
#endif
#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8)
#else // !_MIDL_USE_GUIDDEF_
#ifndef __IID_DEFINED__
#define __IID_DEFINED__
typedef struct _IID
{
unsigned long x;
unsigned short s1;
unsigned short s2;
unsigned char c[8];
} IID;
#endif // __IID_DEFINED__
#ifndef CLSID_DEFINED
#define CLSID_DEFINED
typedef IID CLSID;
#endif // CLSID_DEFINED
#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
#endif !_MIDL_USE_GUIDDEF_
MIDL_DEFINE_GUID(IID, IID_IClientVirtualDevice,0x40700424,0x0080,0x11d2,0x85,0x1f,0x00,0xc0,0x4f,0xc2,0x17,0x59);
MIDL_DEFINE_GUID(IID, IID_IClientVirtualDeviceSet,0x40700425,0x0080,0x11d2,0x85,0x1f,0x00,0xc0,0x4f,0xc2,0x17,0x59);
MIDL_DEFINE_GUID(IID, IID_IClientVirtualDeviceSet2,0xd0e6eb07,0x7a62,0x11d2,0x85,0x73,0x00,0xc0,0x4f,0xc2,0x17,0x59);
MIDL_DEFINE_GUID(IID, IID_IServerVirtualDevice,0xb5e7a131,0xa7bd,0x11d1,0x84,0xc2,0x00,0xc0,0x4f,0xc2,0x17,0x59);
MIDL_DEFINE_GUID(IID, IID_IServerVirtualDeviceSet,0xb5e7a132,0xa7bd,0x11d1,0x84,0xc2,0x00,0xc0,0x4f,0xc2,0x17,0x59);
MIDL_DEFINE_GUID(IID, IID_IServerVirtualDeviceSet2,0xAECBD0D6,0x24C6,0x11d3,0x85,0xB7,0x00,0xC0,0x4F,0xC2,0x17,0x59);
#undef MIDL_DEFINE_GUID
#ifdef __cplusplus
}
#endif
#endif /* defined(_M_IA64) || defined(_M_AMD64)*/