From f3d860237063e5cc79d71bba144ea43fef1cc93e Mon Sep 17 00:00:00 2001 From: Jyri Palis Date: Mon, 4 Jan 2016 10:04:27 +0100 Subject: [PATCH] mssqlvdi: Fix IClientVirtualDeviceSet2::CreateEx call. Seems we need to call IClientVirtualDeviceSet2::CreateEx with as first argument the instance name when connecting to the an non default instance. Fixes #383: mssqldvi problem with connection to mssql not default instance --- AUTHORS | 1 + src/win32/plugins/filed/mssqlvdi-fd.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 45bf00b2d2f..f28f9c9b299 100644 --- a/AUTHORS +++ b/AUTHORS @@ -72,6 +72,7 @@ Jose Luis Tallon Josip Almasi Juan Luis Frances Juergen Lock +Jyri Palis Karl Cunningham Kern Sibbald Kjetil Torgrim Homme diff --git a/src/win32/plugins/filed/mssqlvdi-fd.c b/src/win32/plugins/filed/mssqlvdi-fd.c index d15d55a2d4b..23541c755ec 100644 --- a/src/win32/plugins/filed/mssqlvdi-fd.c +++ b/src/win32/plugins/filed/mssqlvdi-fd.c @@ -1424,7 +1424,16 @@ static inline bool setup_vdi_device(bpContext *ctx, struct io_pkt *io) /* * Create the VDI device set. */ - hr = p_ctx->VDIDeviceSet->CreateEx(NULL, p_ctx->vdsname, &p_ctx->VDIConfig); + if (bstrcasecmp(p_ctx->instance, DEFAULT_INSTANCE)) { + hr = p_ctx->VDIDeviceSet->CreateEx(NULL, p_ctx->vdsname, &p_ctx->VDIConfig); + } else { + POOLMEM *instance_name; + + instance_name = get_pool_memory(PM_NAME); + UTF8_2_wchar(&instance_name, p_ctx->instance); + hr = p_ctx->VDIDeviceSet->CreateEx((LPCWSTR)instance_name, p_ctx->vdsname, &p_ctx->VDIConfig); + free_pool_memory(instance_name); + } if (!SUCCEEDED(hr)) { comReportError(ctx, hr); return false;