public static UInt32 LWMGMTQueryLsaStatus(string serverName, out IntPtr pLsaStatus) { UInt32 result = 0; string functionName = "LSAMgmtAPI.LWMGMTQueryLsaStatus"; IntPtr lsa_status = IntPtr.Zero; try { Logger.Log(String.Format( "{0}(serverName={1}) called", functionName, serverName), Logger.LSAMgmtLogLevel); result = PrivateLSAMgmtAPI.LWMGMTQueryLsaStatus( serverName, out lsa_status); if (result != 0) { pLsaStatus = IntPtr.Zero; return(result); } if (lsa_status.Equals(IntPtr.Zero)) { throw new Exception("Failed to read status information; null handle returned"); } Logger.Log(String.Format( "LWMGMTQueryLsaStatus returns non zero value for pLsaStatus {0}", lsa_status), Logger.LSAMgmtLogLevel); Logger.Log(String.Format( "{0}: result={1}", functionName, result), Logger.LSAMgmtLogLevel); pLsaStatus = lsa_status; } catch (Exception ex) { Logger.LogException(functionName, ex); if (result == 0) { result = 0xFFFFFFFF; } pLsaStatus = IntPtr.Zero; } return(result); }