From 389bdb217d54112d96b40bc967f86b17a605bed6 Mon Sep 17 00:00:00 2001 From: Tim Felser Date: Fri, 25 Aug 2017 16:42:50 +0200 Subject: Added a new command "removeall" Just like "findall" corresponds to "find" this new command acts like "remove" but it will also remove non-present devices. So it is easy to remove all instances of an USB driver. --- setup/devcon/cmds.cpp | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++ setup/devcon/msg.mc | 21 +++++++++++++++ 2 files changed, 94 insertions(+) (limited to 'setup/devcon') diff --git a/setup/devcon/cmds.cpp b/setup/devcon/cmds.cpp index 1af49c5c..0002b393 100644 --- a/setup/devcon/cmds.cpp +++ b/setup/devcon/cmds.cpp @@ -1551,6 +1551,78 @@ Return Value: return failcode; } +int cmdRemoveAll(_In_ LPCTSTR BaseName, _In_opt_ LPCTSTR Machine, _In_ DWORD Flags, _In_ int argc, _In_reads_(argc) PTSTR argv[]) +/*++ + +Routine Description: + +REMOVEALL +remove devices +like remove, but also remove not-present devices + +Arguments: + +BaseName - name of executable +Machine - machine name, must be NULL +argc/argv - remaining parameters + +Return Value: + +EXIT_xxxx + +--*/ +{ + GenericContext context; + TCHAR strRemove[80]; + TCHAR strReboot[80]; + TCHAR strFail[80]; + int failcode = EXIT_FAIL; + + UNREFERENCED_PARAMETER(Flags); + + if (!argc) { + // + // arguments required + // + return EXIT_USAGE; + } + if (Machine) { + // + // must be local machine as we need to involve class/co installers + // + return EXIT_USAGE; + } + if (!LoadString(NULL, IDS_REMOVED, strRemove, ARRAYSIZE(strRemove))) { + return EXIT_FAIL; + } + if (!LoadString(NULL, IDS_REMOVED_REBOOT, strReboot, ARRAYSIZE(strReboot))) { + return EXIT_FAIL; + } + if (!LoadString(NULL, IDS_REMOVE_FAILED, strFail, ARRAYSIZE(strFail))) { + return EXIT_FAIL; + } + + context.reboot = FALSE; + context.count = 0; + context.strReboot = strReboot; + context.strSuccess = strRemove; + context.strFail = strFail; + failcode = EnumerateDevices(BaseName, Machine, 0, argc, argv, RemoveCallback, &context); + + if (failcode == EXIT_OK) { + + if (!context.count) { + FormatToStream(stdout, MSG_REMOVE_TAIL_NONE); + } else if (!context.reboot) { + FormatToStream(stdout, MSG_REMOVE_TAIL, context.count); + } else { + FormatToStream(stdout, MSG_REMOVE_TAIL_REBOOT, context.count); + failcode = EXIT_REBOOT; + } + } + return failcode; +} + int cmdRescan(_In_ LPCTSTR BaseName, _In_opt_ LPCTSTR Machine, _In_ DWORD Flags, _In_ int argc, _In_reads_(argc) PTSTR argv[]) /*++ @@ -2389,6 +2461,7 @@ DispatchEntry DispatchTable[] = { { TEXT("listclass"), cmdListClass, MSG_LISTCLASS_SHORT, MSG_LISTCLASS_LONG }, { TEXT("reboot"), cmdReboot, MSG_REBOOT_SHORT, MSG_REBOOT_LONG }, { TEXT("remove"), cmdRemove, MSG_REMOVE_SHORT, MSG_REMOVE_LONG }, + { TEXT("removeall"), cmdRemoveAll, MSG_REMOVEALL_SHORT, MSG_REMOVEALL_LONG }, { TEXT("rescan"), cmdRescan, MSG_RESCAN_SHORT, MSG_RESCAN_LONG }, { TEXT("resources"), cmdResources, MSG_RESOURCES_SHORT, MSG_RESOURCES_LONG }, { TEXT("restart"), cmdRestart, MSG_RESTART_SHORT, MSG_RESTART_LONG }, diff --git a/setup/devcon/msg.mc b/setup/devcon/msg.mc index a3c677e9..ca348bde 100644 --- a/setup/devcon/msg.mc +++ b/setup/devcon/msg.mc @@ -811,6 +811,27 @@ MessageId=61204 SymbolicName=MSG_REMOVE_TAIL Language=English %1!u! device(s) were removed. . +MessageId=61205 SymbolicName=MSG_REMOVEALL_LONG +Language=English +Devcon Removeall Command +Removes devices with the specified hardware or instance ID, including devices +that are not currently attached. Valid only on the local computer. +(To reboot when necesary, Include -r .) +%1 [-r] %2 [...] +%1 [-r] %2 = [...] + Specifies a device setup class. +Examples of : + * - All devices + ISAPNP\PNP0501 - Hardware ID + *PNP* - Hardware ID with wildcards (* matches anything) + @ISAPNP\*\* - Instance ID with wildcards (@ prefixes instance ID) + '*PNP0501 - Hardware ID with apostrophe (' prefixes literal match - matches exactly as typed, + including the asterisk.) +. +MessageId=61206 SymbolicName=MSG_REMOVEALL_SHORT +Language=English +%1!-20s! Remove devices, including those that are not currently attached. +. ;// ;// RESCAN -- cgit v1.3.1 From 13ca5b69d2a1b20e5cfa8ecc94bfea9ece8aaa9a Mon Sep 17 00:00:00 2001 From: Barry Golden Date: Fri, 25 Aug 2017 20:51:02 -0700 Subject: VSTS 12737998 --- sd/miniport/sdhc/README.md | 12 +++++++++++- sd/sdiomars/README.md | 10 ++++++++++ security/elam/README.md | 10 ++++++++++ serial/VirtualSerial/README.md | 10 ++++++++++ serial/VirtualSerial2/README.md | 10 ++++++++++ serial/serenum/README.md | 10 ++++++++++ serial/serial/README.md | 10 ++++++++++ setup/devcon/README.md | 10 ++++++++++ simbatt/README.md | 12 +++++++++++- smartcrd/README.md | 10 ++++++++++ spb/SkeletonI2C/README.md | 12 +++++++++++- spb/SpbTestTool/README.md | 10 ++++++++++ storage/class/cdrom/README.md | 10 ++++++++++ storage/class/classpnp/README.md | 10 ++++++++++ storage/class/disk/README.md | 10 ++++++++++ storage/filters/addfilter/README.md | 10 ++++++++++ storage/iscsi/README.md | 10 ++++++++++ storage/miniports/lsi_u3/README.md | 10 ++++++++++ storage/miniports/storahci/README.md | 10 ++++++++++ storage/msdsm/README.md | 10 ++++++++++ storage/ramdisk/README.md | 10 ++++++++++ storage/sfloppy/README.md | 10 ++++++++++ storage/tools/spti/README.md | 10 ++++++++++ 23 files changed, 233 insertions(+), 3 deletions(-) (limited to 'setup/devcon') diff --git a/sd/miniport/sdhc/README.md b/sd/miniport/sdhc/README.md index b5c35093..a1e81cde 100644 --- a/sd/miniport/sdhc/README.md +++ b/sd/miniport/sdhc/README.md @@ -1,5 +1,15 @@ + + + Standard SD Host Controller Miniport -=================== +==================================== This is a sample for a Secure Digital (SD) Host Controller miniport driver. The driver works in conjunction with sdport.sys, which implements SD/SDIO/eMMC protocol and WDM interfaces, to provide the host register interface. diff --git a/sd/sdiomars/README.md b/sd/sdiomars/README.md index 322ac5a4..2f248936 100644 --- a/sd/sdiomars/README.md +++ b/sd/sdiomars/README.md @@ -1,3 +1,13 @@ + + + Storage SDIO Driver =================== diff --git a/security/elam/README.md b/security/elam/README.md index 927dc32d..bbd5b772 100644 --- a/security/elam/README.md +++ b/security/elam/README.md @@ -1,3 +1,13 @@ + + + Early Launch Anti-Malware Driver ================================ diff --git a/serial/VirtualSerial/README.md b/serial/VirtualSerial/README.md index 2b1bc513..59d9afb6 100644 --- a/serial/VirtualSerial/README.md +++ b/serial/VirtualSerial/README.md @@ -1,3 +1,13 @@ + + + Virtual serial driver sample ============================ diff --git a/serial/VirtualSerial2/README.md b/serial/VirtualSerial2/README.md index 3c5baf78..81405d15 100644 --- a/serial/VirtualSerial2/README.md +++ b/serial/VirtualSerial2/README.md @@ -1,3 +1,13 @@ + + + Virtual serial driver sample ============================ diff --git a/serial/serenum/README.md b/serial/serenum/README.md index 7b28ae46..c4690bbf 100644 --- a/serial/serenum/README.md +++ b/serial/serenum/README.md @@ -1,3 +1,13 @@ + + + Serenum sample ============== diff --git a/serial/serial/README.md b/serial/serial/README.md index de76bfb3..583e9cae 100644 --- a/serial/serial/README.md +++ b/serial/serial/README.md @@ -1,3 +1,13 @@ + + + Serial Port Driver ================== diff --git a/setup/devcon/README.md b/setup/devcon/README.md index b559f0f1..60e79702 100644 --- a/setup/devcon/README.md +++ b/setup/devcon/README.md @@ -1,3 +1,13 @@ + + + Device Console (DevCon) Tool ============================ diff --git a/simbatt/README.md b/simbatt/README.md index e52e7d40..24332b56 100644 --- a/simbatt/README.md +++ b/simbatt/README.md @@ -1,3 +1,13 @@ -SimBatt: Battery Battery Driver Sample + + + +SimBatt: Simulated Battery Driver Sample ====================================== SimBatt is simulated battery device driver, this source code is intended to demonstrate implementation of Windows battery driver interfaces. This is a KMDF based sample. You may use this sample as a starting point to implement a battery miniport specific to your needs. \ No newline at end of file diff --git a/smartcrd/README.md b/smartcrd/README.md index d9454735..c3b5ca74 100644 --- a/smartcrd/README.md +++ b/smartcrd/README.md @@ -1,3 +1,13 @@ + + + PCMCIA Smart Card Driver ======================== diff --git a/spb/SkeletonI2C/README.md b/spb/SkeletonI2C/README.md index 4522af7c..2e639a9d 100644 --- a/spb/SkeletonI2C/README.md +++ b/spb/SkeletonI2C/README.md @@ -1,5 +1,15 @@ + + + Skeleton I2C Sample Driver -========================= +========================== The SkeletonI2C sample demonstrates how to design a KMDF controller driver for Windows that conforms to the [simple peripheral bus](http://msdn.microsoft.com/en-us/library/windows/hardware/hh450903) (SPB) device driver interface (DDI). SPB is an abstraction for low-speed serial buses (for example, I2C and SPI) that allows peripheral drivers to be developed for cross-platform use without any knowledge of the underlying bus hardware or device connections. While this sample implements an empty I2C driver, it could just as easily be the starting point for an SPI driver with only minor modifications. diff --git a/spb/SpbTestTool/README.md b/spb/SpbTestTool/README.md index d7c9eb2e..fbee4e70 100644 --- a/spb/SpbTestTool/README.md +++ b/spb/SpbTestTool/README.md @@ -1,3 +1,13 @@ + + + SpbTestTool =========== diff --git a/storage/class/cdrom/README.md b/storage/class/cdrom/README.md index 187ca63b..92ddf79b 100644 --- a/storage/class/cdrom/README.md +++ b/storage/class/cdrom/README.md @@ -1,3 +1,13 @@ + + + CDROM Storage Class Driver ========================== diff --git a/storage/class/classpnp/README.md b/storage/class/classpnp/README.md index c3a893ba..ec3c0e9b 100644 --- a/storage/class/classpnp/README.md +++ b/storage/class/classpnp/README.md @@ -1,3 +1,13 @@ + + + ClassPnP Storage Class Driver Library ===================================== diff --git a/storage/class/disk/README.md b/storage/class/disk/README.md index 1acd4ed5..c4032547 100644 --- a/storage/class/disk/README.md +++ b/storage/class/disk/README.md @@ -1,3 +1,13 @@ + + + Disk Class Driver ================= diff --git a/storage/filters/addfilter/README.md b/storage/filters/addfilter/README.md index 3981aa20..8d3084c4 100644 --- a/storage/filters/addfilter/README.md +++ b/storage/filters/addfilter/README.md @@ -1,3 +1,13 @@ + + + AddFilter Storage Filter Tool ============================= diff --git a/storage/iscsi/README.md b/storage/iscsi/README.md index 8bfb6982..320e1206 100644 --- a/storage/iscsi/README.md +++ b/storage/iscsi/README.md @@ -1,3 +1,13 @@ + + + iSCSI WMI Client ================ diff --git a/storage/miniports/lsi_u3/README.md b/storage/miniports/lsi_u3/README.md index 2e7950ea..2ca91c64 100644 --- a/storage/miniports/lsi_u3/README.md +++ b/storage/miniports/lsi_u3/README.md @@ -1,3 +1,13 @@ + + + LSI\_U3 StorPort Miniport Driver ================================ diff --git a/storage/miniports/storahci/README.md b/storage/miniports/storahci/README.md index 7705ebd5..ed65a9ff 100644 --- a/storage/miniports/storahci/README.md +++ b/storage/miniports/storahci/README.md @@ -1,3 +1,13 @@ + + + StorAhci StorPort Miniport Driver ================================= diff --git a/storage/msdsm/README.md b/storage/msdsm/README.md index d43f1b68..599dc963 100644 --- a/storage/msdsm/README.md +++ b/storage/msdsm/README.md @@ -1,3 +1,13 @@ + + + Multipath I/O (MPIO) DSM Sample =============================== diff --git a/storage/ramdisk/README.md b/storage/ramdisk/README.md index 66e97691..83e0bae1 100644 --- a/storage/ramdisk/README.md +++ b/storage/ramdisk/README.md @@ -1,3 +1,13 @@ + + + RAMDisk Storage Driver Sample ============================= diff --git a/storage/sfloppy/README.md b/storage/sfloppy/README.md index be7bd211..a48c6230 100644 --- a/storage/sfloppy/README.md +++ b/storage/sfloppy/README.md @@ -1,3 +1,13 @@ + + + Super Floppy (sfloppy) Storage Class Driver =========================================== diff --git a/storage/tools/spti/README.md b/storage/tools/spti/README.md index 0d9ad39a..10037d01 100644 --- a/storage/tools/spti/README.md +++ b/storage/tools/spti/README.md @@ -1,3 +1,13 @@ + + + SCSI Pass-Through Interface Tool ================================ -- cgit v1.3.1