示例#1
0
        /// <summary>
        /// Returns the available memory sources.
        /// </summary>
        /// <returns>List of memory source names</returns>
        public static List <string> GetMemorySources()
        {
            //
            // Create a new struct
            //
            var structure = new MemorySource();

            //
            // Get the memory sources
            //
            GetMemorySourcesExport(ref structure);

            //
            // Convert the pointers to strings and return the list
            //
            return((from pointer in structure.MemorySources
                    where pointer != IntPtr.Zero
                    select Marshal.PtrToStringAnsi(pointer)?.Split('|')[0]).ToList());
        }
示例#2
0
 protected static extern void GetMemorySourcesExport([In][Out] ref MemorySource structure);