/// <summary> /// The GetShareMapping method is invoked by the client to get the shadow copy information on a given /// file share on the server. /// </summary> /// <param name="ShadowCopyId">The GUID of the shadow copy associated with the share.</param> /// <param name="ShadowCopySetId">The GUID of the shadow copy set.</param> /// <param name="ShareName">The name of the share in UNC format.</param> /// <param name="Level">The format of this data depends on the value of the level parameter.</param> /// <param name="ShareMapping">On output, a FSSAGENT_SHARE_MAPPING structure, as specified in section 2.2.3.1.</param> /// <returns></returns> public int GetShareMapping( Guid ShadowCopyId, Guid ShadowCopySetId, string ShareName, uint Level, out FSSAGENT_SHARE_MAPPING ShareMapping) { Int3264[] paramList; int retVal = 0; SafeIntPtr pShadowCopyId = TypeMarshal.ToIntPtr(ShadowCopyId); SafeIntPtr pShadowCopySetId = TypeMarshal.ToIntPtr(ShadowCopySetId); SafeIntPtr pShareName = Marshal.StringToHGlobalUni(ShareName); paramList = new Int3264[] { pShadowCopyId, pShadowCopySetId, pShareName, Level, IntPtr.Zero, IntPtr.Zero }; try { using (RpceInt3264Collection outParamList = RpceCall(paramList, (ushort)FSRVP_OPNUM.GetShareMapping)) { retVal = outParamList[5].ToInt32(); ShareMapping = new FSSAGENT_SHARE_MAPPING(); if ((FsrvpErrorCode)retVal == FsrvpErrorCode.FSRVP_SUCCESS) { ShareMapping.ShareMapping1 = TypeMarshal.ToStruct <FSSAGENT_SHARE_MAPPING_1>(Marshal.ReadIntPtr(outParamList[4])); ShareMapping.ShareMapping1IsNull = false; } else { ShareMapping.ShareMapping1IsNull = true; } } } finally { pShadowCopyId.Dispose(); pShadowCopySetId.Dispose(); pShareName.Dispose(); } return(retVal); }
/// <summary> /// The GetShareMapping method is invoked by the client to get the shadow copy information on a given /// file share on the server. /// </summary> /// <param name="ShadowCopyId">The GUID of the shadow copy associated with the share.</param> /// <param name="ShadowCopySetId">The GUID of the shadow copy set.</param> /// <param name="ShareName">The name of the share in UNC format.</param> /// <param name="Level">The format of this data depends on the value of the level parameter.</param> /// <param name="ShareMapping">On output, a FSSAGENT_SHARE_MAPPING structure, as specified in section 2.2.3.1.</param> /// <returns></returns> public int GetShareMapping( Guid ShadowCopyId, Guid ShadowCopySetId, string ShareName, uint Level, out FSSAGENT_SHARE_MAPPING ShareMapping) { Int3264[] paramList; int retVal = 0; SafeIntPtr pShadowCopyId = TypeMarshal.ToIntPtr(ShadowCopyId); SafeIntPtr pShadowCopySetId = TypeMarshal.ToIntPtr(ShadowCopySetId); SafeIntPtr pShareName = Marshal.StringToHGlobalUni(ShareName); paramList = new Int3264[] { pShadowCopyId, pShadowCopySetId, pShareName, Level, IntPtr.Zero, IntPtr.Zero }; try { using (RpceInt3264Collection outParamList = RpceCall(paramList, (ushort)FSRVP_OPNUM.GetShareMapping)) { retVal = outParamList[5].ToInt32(); ShareMapping = new FSSAGENT_SHARE_MAPPING(); if ((FsrvpErrorCode)retVal == FsrvpErrorCode.FSRVP_SUCCESS) { ShareMapping.ShareMapping1 = TypeMarshal.ToStruct<FSSAGENT_SHARE_MAPPING_1>(Marshal.ReadIntPtr(outParamList[4])); ShareMapping.ShareMapping1IsNull = false; } else { ShareMapping.ShareMapping1IsNull = true; } } } finally { pShadowCopyId.Dispose(); pShadowCopySetId.Dispose(); pShareName.Dispose(); } return retVal; }