コード例 #1
0
        /// <summary>
        ///     Retrieve the specified struct
        /// </summary>
        /// <typeparam name="T">type of the struct to return</typeparam>
        /// <returns>struct of type T</returns>
        public static T QuerySessionInformation <T>(InfoClasses infoClass)
            where T : struct
        {
            var expectedType = typeof(T);

            if (!WFQuerySessionInformation(CurrentServer, CurrentSession, infoClass, out var addr, out _))
            {
                return(default);
コード例 #2
0
ファイル: WinFrame.cs プロジェクト: galri/Dapplo.Windows
        /// <summary>
        ///     Retrieve a string value from the WFQuerySessionInformation
        /// </summary>
        /// <returns>string with the value</returns>
        public static string QuerySessionInformation(InfoClasses infoClass)
        {
            IntPtr addr;
            int    returned;

            if (!WFQuerySessionInformation(CurrentServer, CurrentSession, infoClass, out addr, out returned))
            {
                return(null);
            }
            try
            {
                return(Marshal.PtrToStringAuto(addr));
            }
            finally
            {
                WFFreeMemory(addr);
            }
        }
コード例 #3
0
ファイル: WinFrame.cs プロジェクト: galri/Dapplo.Windows
        /// <summary>
        ///     Retrieve the specified struct
        /// </summary>
        /// <typeparam name="T">type of the struct to return</typeparam>
        /// <returns>struct of type T</returns>
        public static T QuerySessionInformation <T>(InfoClasses infoClass)
            where T : struct
        {
            var    expectedType = typeof(T);
            IntPtr addr;
            int    returned;

            if (!WFQuerySessionInformation(CurrentServer, CurrentSession, infoClass, out addr, out returned))
            {
                return(default(T));
            }
            try
            {
                return((T)Marshal.PtrToStructure(addr, expectedType));
            }
            finally
            {
                WFFreeMemory(addr);
            }
        }
コード例 #4
0
ファイル: WinFrame.cs プロジェクト: galri/Dapplo.Windows
 private static extern bool WFQuerySessionInformation(IntPtr hServer, int iSessionId, InfoClasses infotype, out IntPtr ppBuffer, out int pBytesReturned);