static byte[] IssueClusterResourceControl(SafeHResource hResource, ClusterResourceControlCode code) { uint cb = 0; uint ret = SafeNativeMethods.ClusterResourceControl(hResource, IntPtr.Zero, code, IntPtr.Zero, 0, null, 0, ref cb); if (ret == SafeNativeMethods.ERROR_SUCCESS || ret == SafeNativeMethods.ERROR_MORE_DATA) { byte[] buffer = new byte[cb]; ret = SafeNativeMethods.ClusterResourceControl(hResource, IntPtr.Zero, code, IntPtr.Zero, 0, buffer, cb, ref cb); if (ret == SafeNativeMethods.ERROR_SUCCESS) { return buffer; } } return null; }
internal static extern uint ClusterResourceControl( [In] SafeHResource hResource, [In] IntPtr hHostNode, //HNODE hHostNode, never used [In] ClusterResourceControlCode dwControlCode, [In] IntPtr lpInBuffer, // LPVOID lpInBuffer, never used [In] uint cbInBufferSize, [In, Out, MarshalAs(UnmanagedType.LPArray)] byte[] buffer, [In] uint cbOutBufferSize, [In, Out] ref uint lpcbBytesReturned);
static string IssueClusterResourceControlString(SafeHResource hResource, ClusterResourceControlCode code) { byte[] buffer = IssueClusterResourceControl(hResource, code); if (buffer == null) { return null; } try { return Encoding.Unicode.GetString(buffer, 0, buffer.Length - 2); } catch (ArgumentException) { return null; } }
private static byte[] IssueClusterResourceControl(SafeHResource hResource, ClusterResourceControlCode code) { uint lpcbBytesReturned = 0; uint num2 = SafeNativeMethods.ClusterResourceControl(hResource, IntPtr.Zero, code, IntPtr.Zero, 0, null, 0, ref lpcbBytesReturned); switch (num2) { case 0: case 0xea: { byte[] buffer = new byte[lpcbBytesReturned]; num2 = SafeNativeMethods.ClusterResourceControl(hResource, IntPtr.Zero, code, IntPtr.Zero, 0, buffer, lpcbBytesReturned, ref lpcbBytesReturned); if (num2 == 0) { return(buffer); } break; } } throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationProviderException(Microsoft.Transactions.SR.GetString("ClusterResourceControlFailed", new object[] { code, num2 }))); }
static string IssueClusterResourceControlString(SafeHResource hResource, ClusterResourceControlCode code) { byte[] buffer = IssueClusterResourceControl(hResource, code); if (buffer == null) { return null; } try { return Encoding.Unicode.GetString(buffer, 0, buffer.Length - 2); } catch (ArgumentException) { return null; } }
static byte[] IssueClusterResourceControl(SafeHResource hResource, ClusterResourceControlCode code) { uint cb = 0; uint ret = SafeNativeMethods.ClusterResourceControl(hResource, IntPtr.Zero, code, IntPtr.Zero, 0, null, 0, ref cb); if (ret == SafeNativeMethods.ERROR_SUCCESS || ret == SafeNativeMethods.ERROR_MORE_DATA) { byte[] buffer = new byte[cb]; ret = SafeNativeMethods.ClusterResourceControl(hResource, IntPtr.Zero, code, IntPtr.Zero, 0, buffer, cb, ref cb); if (ret == SafeNativeMethods.ERROR_SUCCESS) { return buffer; } } return null; }
private static string IssueClusterResourceControlString(SafeHResource hResource, ClusterResourceControlCode code) { string str; byte[] bytes = IssueClusterResourceControl(hResource, code); try { str = Encoding.Unicode.GetString(bytes, 0, bytes.Length - 2); } catch (ArgumentException exception) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationProviderException(Microsoft.Transactions.SR.GetString("ClusterResourceControlInvalidResults", new object[] { code }), exception)); } return(str); }
private static string IssueClusterResourceControlString(SafeHResource hResource, ClusterResourceControlCode code) { string str; byte[] bytes = IssueClusterResourceControl(hResource, code); try { str = Encoding.Unicode.GetString(bytes, 0, bytes.Length - 2); } catch (ArgumentException exception) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationProviderException(Microsoft.Transactions.SR.GetString("ClusterResourceControlInvalidResults", new object[] { code }), exception)); } return str; }
private static byte[] IssueClusterResourceControl(SafeHResource hResource, ClusterResourceControlCode code) { uint lpcbBytesReturned = 0; uint num2 = SafeNativeMethods.ClusterResourceControl(hResource, IntPtr.Zero, code, IntPtr.Zero, 0, null, 0, ref lpcbBytesReturned); switch (num2) { case 0: case 0xea: { byte[] buffer = new byte[lpcbBytesReturned]; num2 = SafeNativeMethods.ClusterResourceControl(hResource, IntPtr.Zero, code, IntPtr.Zero, 0, buffer, lpcbBytesReturned, ref lpcbBytesReturned); if (num2 == 0) { return buffer; } break; } } throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationProviderException(Microsoft.Transactions.SR.GetString("ClusterResourceControlFailed", new object[] { code, num2 }))); }