Esempio n. 1
0
        public static void AddPort(string portName)
        {
            var pi = new PORT_INFO_1 {
                Name = portName
            };

            if (NativeMethods.AddPortEx(null, 1, ref pi, "Local Port") == 0)
            {
                throw new Win32Exception(Marshal.GetLastWin32Error());
            }

            Debug.WriteLine($"Port '{portName}' added.");
        }
Esempio n. 2
0
 internal static extern int AddPortEx(string server, int level, [MarshalAs(UnmanagedType.Struct)] ref PORT_INFO_1 pi, string monitorName);