Sep 7, 2011 at 11:36 AM
Edited Sep 7, 2011 at 11:37 AM
I am getting errors in the application log when using AlphaVSS
The error is "Volume Shadow Copy Service error: Unexpected error querying for the IVssWriterCallback interface. hr = 0x80070005, Access is denied."
What's odd is that it doesn't seem to cause any issue with the shadow copy being created.
It must be one of the following statements that generates the error
Dim oVSSImpl As Alphaleonis.Win32.Vss.IVssImplementation = Alphaleonis.Win32.Vss.VssUtils.LoadImplementation()
oVSS = oVSSImpl.CreateVssBackupComponents
oVSS.SetBackupState(True, True, Alphaleonis.Win32.Vss.VssBackupType.Full, False)
Using async As Alphaleonis.Win32.Vss.IVssAsync = oVSS.GatherWriterMetadata()
Sep 7, 2011 at 4:57 PM
On what operating system are you getting this? (Including any service pack(s) and x32/x64)? And is running the program snippet above enough to get the error in the event log?
I have now narrowed it down to the GatherWriterMetaData statement. I'm running it on Windows Server 2008 R2 SP1 (x64).
This article may be relevant, I have not been able to test it yet though
Sep 7, 2011 at 7:18 PM
Edited Sep 7, 2011 at 7:19 PM
Ahhh... This sounds like something I encountered when working on the sample application for AlphaVSS (yeah, I know, it's slow progress indeed). Anyway, I discovered that I actually didn't get information from all writers when running "Gather writer metadata"
when I compared to what VShadow.exe (the sample in the Windows SDK) produced. And it turned out to be a problem with the COM security stuff (which I don't know much about to be honest).
Now this was a while ago, so I don't remember everything I read about it off the top of my head. All I remember is that calling CoInitializeSecurity from a .NET application is not entierly straightforward or perhaps even possible. Just do a google for it.
But my sample application starts with the following commented line:
// WARNING: This call will fail if debugging this application using the Visual Studio Hosting process. It may
// also fail under other conditions. It is used to allow communication with all writers. If missing
// for example the System Writer will not show up in the IVssBackupComponents.WriterMetadata collection.
// Posts on the internet seems to suggest that the only way to reliably set this is to use a custom CLR host, which
// is out of the scope for this sample.
Perhaps this is a pointer towards the solution also to your problem?
Let me know of your progress.
Sep 8, 2011 at 7:12 AM
Edited Sep 8, 2011 at 7:15 AM
OK, looks like I've fixed it. At least, I'm not getting the error in the Event Viewer any more
I created a new class called NativeMethods with the code below.
Public Class NativeMethods
''' Define RPC_C_AUTHN_LEVEL_ constants
Public Enum RpcAuthnLevel
[Default] = 0
''' Define RPC_C_IMP_LEVEL_ constants
Public Enum RpcImpLevel
[Default] = 0
''' Define EOAC_ constants
Public Enum EoAuthnCap
None = &H0
MutualAuth = &H1
StaticCloaking = &H20
DynamicCloaking = &H40
AnyAuthority = &H80
MakeFullSIC = &H100
[Default] = &H800
SecureRefs = &H2
AccessControl = &H4
AppID = &H8
Dynamic = &H10
RequireFullSIC = &H200
AutoImpersonate = &H400
NoCustomMarshal = &H2000
DisableAAA = &H1000
<DllImport("Ole32.dll", ExactSpelling:=True, EntryPoint:="CoInitializeSecurity", CallingConvention:=CallingConvention.StdCall, SetLastError:=False, PreserveSig:=False)> _
Private Shared Sub CoInitializeSecurity(ByVal pVoid As IntPtr, ByVal cAuthSvc As Integer, ByVal asAuthSvc As IntPtr, _
ByVal pReserved1 As IntPtr, ByVal dwAuthnLevel As UInteger, ByVal dwImpLevel As UInteger, _
ByVal pAuthList As IntPtr, ByVal dwCapabilities As UInteger, ByVal pReserved3 As IntPtr)
Public Sub New()
CoInitializeSecurity(IntPtr.Zero, -1, IntPtr.Zero, IntPtr.Zero, CUInt(RpcAuthnLevel.PktPrivacy), CUInt(RpcImpLevel.Impersonate), _
IntPtr.Zero, CUInt(EoAuthnCap.DynamicCloaking), IntPtr.Zero)
Then, the very first statement of my application is :-
as New NativeMethods
Hope this helps other people!