Ejemplo n.º 1
0
 /// <summary>
 /// Define a new DOS device.
 /// </summary>
 /// <param name="flags">The dos device flags.</param>
 /// <param name="device_name">The device name to define.</param>
 /// <param name="target_path">The target path.</param>
 public static void DefineDosDevice(DefineDosDeviceFlags flags, string device_name, string target_path)
 {
     if (!Win32NativeMethods.DefineDosDevice(flags, device_name, target_path))
     {
         throw new SafeWin32Exception();
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Overridden ProcessRecord.
        /// </summary>
        protected override void ProcessRecord()
        {
            DefineDosDeviceFlags flags = DefineDosDeviceFlags.None;

            if (NoBroadcastSystem)
            {
                flags |= DefineDosDeviceFlags.NoBroadcastSystem;
            }
            if (RawTargetPath)
            {
                flags |= DefineDosDeviceFlags.RawTargetPath;
            }

            string device_path = ConvertDevicePath(DeviceName);

            Win32Utils.DefineDosDevice(flags, device_path, TargetPath);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Overridden ProcessRecord.
        /// </summary>
        protected override void ProcessRecord()
        {
            DefineDosDeviceFlags flags = DefineDosDeviceFlags.RemoveDefinition;

            if (NoBroadcastSystem)
            {
                flags |= DefineDosDeviceFlags.NoBroadcastSystem;
            }
            if (RawTargetPath)
            {
                flags |= DefineDosDeviceFlags.RawTargetPath;
            }
            if (!string.IsNullOrEmpty(ExactMatchTargetPath))
            {
                flags |= DefineDosDeviceFlags.ExactMatchOnRemove;
            }

            string device_path = AddDosDeviceCmdlet.ConvertDevicePath(DeviceName);

            Win32Utils.DefineDosDevice(flags, device_path, string.IsNullOrEmpty(ExactMatchTargetPath) ? null : ExactMatchTargetPath);
        }
Ejemplo n.º 4
0
 internal static extern bool DefineDosDevice(DefineDosDeviceFlags dwFlags, string lpDeviceName, string lpTargetPath);
Ejemplo n.º 5
0
 private static extern bool DefineDosDevice(
     [In, MarshalAs(UnmanagedType.U4)] DefineDosDeviceFlags dwFlags,
     [In] string lpDeviceName,
     [In] string lpTargetPath
     );