コード例 #1
0
        public static UInt32 LWMGMTReadKeyTab(string serverName,
                                              string KeyTabPath,
                                              UInt32 LastRecordId,
                                              UInt32 RecordsPerPage,
                                              out IntPtr pKeyTabEntries)
        {
            UInt32 result       = 0;
            string functionName = "LSAMgmtAPI.LWMGMTReadKeyTab";

            IntPtr kaytab_entries = IntPtr.Zero;

            try
            {
                Logger.Log(String.Format(
                               "{0}(serverName={1}) called",
                               functionName, serverName), Logger.LSAMgmtLogLevel);

                result = PrivateLSAMgmtAPI.LWMGMTReadKeyTab(
                    serverName,
                    KeyTabPath,
                    LastRecordId,
                    RecordsPerPage,
                    out kaytab_entries);

                if (result != 0)
                {
                    pKeyTabEntries = IntPtr.Zero;
                    return(result);
                }

                if (kaytab_entries.Equals(IntPtr.Zero))
                {
                    throw new Exception("Failed to read kay tab entry information; null handle returned");
                }

                Logger.Log(String.Format(
                               "LWMGMTReadKeyTab returns non zero value for kaytab_entries {0}", kaytab_entries),
                           Logger.LSAMgmtLogLevel);

                Logger.Log(String.Format(
                               "{0}: result={1}",
                               functionName,
                               result),
                           Logger.LSAMgmtLogLevel);

                pKeyTabEntries = kaytab_entries;
            }
            catch (Exception ex)
            {
                Logger.LogException(functionName, ex);
                if (result == 0)
                {
                    result = 0xFFFFFFFF;
                }

                pKeyTabEntries = IntPtr.Zero;
            }

            return(result);
        }