summaryrefslogtreecommitdiff
path: root/setup/devcon
diff options
context:
space:
mode:
authorWei Mao <[email protected]>2017-03-21 06:44:26 -0700
committerWei Mao <[email protected]>2017-03-21 06:49:43 -0700
commit0fcda712a220abea5dc7a6e60c4f406ca14d34dc (patch)
treeef033bf9d5b601b72976d0300dbd7041ad36ae78 /setup/devcon
parentde981510f34192ff725f68130f99a99e5fa0e200 (diff)
Add cmdline option -u for Unicode (UTF-16) output
Diffstat (limited to 'setup/devcon')
-rw-r--r--setup/devcon/cmds.cpp2
-rw-r--r--setup/devcon/devcon.cpp20
-rw-r--r--setup/devcon/devcon.h8
-rw-r--r--setup/devcon/msg.mc27
4 files changed, 33 insertions, 24 deletions
diff --git a/setup/devcon/cmds.cpp b/setup/devcon/cmds.cpp
index 61e36b20..1af49c5c 100644
--- a/setup/devcon/cmds.cpp
+++ b/setup/devcon/cmds.cpp
@@ -99,10 +99,10 @@ Return Value:
//
// enumerate through each command and display short help for each
//
+ _fputts(TEXT("\n"), stdout);
for(dispIndex = 0;DispatchTable[dispIndex].cmd;dispIndex++) {
if(DispatchTable[dispIndex].shortHelp) {
FormatToStream(stdout,DispatchTable[dispIndex].shortHelp,DispatchTable[dispIndex].cmd);
- _fputts(TEXT("\n"), stdout);
}
}
}
diff --git a/setup/devcon/devcon.cpp b/setup/devcon/devcon.cpp
index 08736c82..1328b91c 100644
--- a/setup/devcon/devcon.cpp
+++ b/setup/devcon/devcon.cpp
@@ -14,8 +14,6 @@ Abstract:
--*/
#include "devcon.h"
-#include <io.h>
-#include <fcntl.h>
struct IdEntry {
LPCTSTR String; // string looking for
@@ -1077,13 +1075,9 @@ Return Value:
// -m:<machine> - remote
// -r - auto reboot
// -f - force operation
+ // -u - unicode output
//
-#ifdef UNICODE
- _setmode(_fileno(stdout), _O_WTEXT);
- _setmode(_fileno(stderr), _O_WTEXT);
-#endif
-
baseName = _tcsrchr(argv[0],TEXT('\\'));
if(!baseName) {
baseName = argv[0];
@@ -1117,6 +1111,18 @@ Return Value:
} else {
flags |= DEVCON_FLAG_FORCE;
}
+ } else if((argv[firstArg][1]==TEXT('u')) || (argv[firstArg][1]==TEXT('U'))) {
+ if((argv[firstArg][2]!=TEXT('\0')) ) {
+ //
+ // don't recognize this switch
+ //
+ break;
+ } else {
+#ifdef UNICODE
+ _setmode(_fileno(stdout), _O_WTEXT);
+ _setmode(_fileno(stderr), _O_WTEXT);
+#endif
+ }
} else {
//
// don't recognize this switch
diff --git a/setup/devcon/devcon.h b/setup/devcon/devcon.h
index 6dd1ba2f..d7034004 100644
--- a/setup/devcon/devcon.h
+++ b/setup/devcon/devcon.h
@@ -25,6 +25,8 @@ Abstract:
#include <newdev.h>
#include <objbase.h>
#include <strsafe.h>
+#include <io.h>
+#include <fcntl.h>
#include "msg.h"
#include "rc_ids.h"
@@ -63,9 +65,9 @@ extern DispatchEntry DispatchTable[];
void FormatToStream(_In_ FILE * stream, _In_ DWORD fmt,...);
void Padding(_In_ int pad);
bool SplitCommandLine(
- _In_ int & argc,
- _In_reads_(argc) LPTSTR * & argv,
- _Out_ int & argc_right,
+ _In_ int & argc,
+ _In_reads_(argc) LPTSTR * & argv,
+ _Out_ int & argc_right,
_Outref_result_buffer_(argc_right) LPTSTR * & argv_right);
int EnumerateDevices(_In_ LPCTSTR BaseName, _In_opt_ LPCTSTR Machine, _In_ DWORD Flags, _In_ int argc, _In_reads_(argc) PWSTR* argv, _In_ CallbackFunc Callback, _In_ LPVOID Context);
LPTSTR GetDeviceStringProperty(_In_ HDEVINFO Devs, _In_ PSP_DEVINFO_DATA DevInfo, _In_ DWORD Prop);
diff --git a/setup/devcon/msg.mc b/setup/devcon/msg.mc
index bc506d6d..a3c677e9 100644
--- a/setup/devcon/msg.mc
+++ b/setup/devcon/msg.mc
@@ -28,7 +28,8 @@ Language=English
Device Console Help:
%1 [-r] [-m:\\<machine>] <command> [<arg>...]
-r Reboots the system only when a restart or reboot is required.
-<machine> Specifies a remote computer.
+-u Unicode (UTF-16) output
+<machine> Specifies a remote computer.
<command> Specifies a Devcon command (see command list below).
<arg>... One or more arguments that modify a command.
For help with a specific command, type: %1 help <command>
@@ -221,7 +222,7 @@ Lists hardware resources of devices with the specified hardware or instance ID.
Valid on local and remote computers.
%1 [-m:\\<machine>] %2 <id> [<id>...]
%1 [-m:\\<machine>] %2 =<class> [<id>...]
-<machine> Specifies a remote computer.
+<machine> Specifies a remote computer.
<class> Specifies a device setup class.
Examples of <id>:
Examples of <id>:
@@ -305,7 +306,7 @@ Language=English
.
MessageId=60502 SymbolicName=MSG_ENABLE_TAIL_NONE
Language=English
-No devices were enabled, either because the devices were not found,
+No devices were enabled, either because the devices were not found,
or because the devices could not be enabled.
.
MessageId=60503 SymbolicName=MSG_ENABLE_TAIL_REBOOT
@@ -591,7 +592,7 @@ Error retrieving the device's status.
MessageId=61000 SymbolicName=MSG_INSTALL_LONG
Language=English
Devcon Install Command
-Installs the specified device manually. Valid only on the local computer.
+Installs the specified device manually. Valid only on the local computer.
(To reboot when necesary, Include -r .)
%1 [-r] %2 <inf> <hwid>
<inf> Specifies an INF file with installation information for the device.
@@ -613,7 +614,7 @@ Device node created. Install is complete when drivers are installed...
MessageId=61100 SymbolicName=MSG_UPDATE_LONG
Language=English
Devcon Update Command
-Updates drivers for all devices with the specified hardware ID (<hwid>).
+Updates drivers for all devices with the specified hardware ID (<hwid>).
Valid only on the local computer. (To reboot when necesary, Include -r .)
%1 [-r] %2 <inf> <hwid>
-r Reboots the system only when a restart or reboot is required.
@@ -686,7 +687,7 @@ Language=English
%1 %2
Lists the third-party (OEM) driver packages installed on this machine.
This command will only work on the local machine.
-Values returned from dp_enum can be sent to dp_delete
+Values returned from dp_enum can be sent to dp_delete
to be removed from the machine.
.
MessageId=61112 SymbolicName=MSG_DPENUM_SHORT
@@ -819,7 +820,7 @@ Language=English
Devcon Rescan Command
Directs Plug and Play to scan for new hardware. Valid on a local or remote computer.
%1 [-m:\\<machine>] %2
-<machine> Specifies a remote computer.
+<machine> Specifies a remote computer.
.
MessageId=61301 SymbolicName=MSG_RESCAN_SHORT
Language=English
@@ -880,14 +881,14 @@ or the machine is rebooted.
upper Identifies an upper filter driver.
lower Identifies a lower filter driver.
-To list the upper/lower filter drivers for a class,
+To list the upper/lower filter drivers for a class,
type: devcon classfilter <class> {upper | lower}
-The Devcon classfilter command uses subcommands, which consist of an
+The Devcon classfilter command uses subcommands, which consist of an
operator (=, @, -, +, !) and a filter driver name.
The Devcon classfilter command uses a virtual cursor to move through
-the list of filter drivers. The cursor starts at the beginning of the
+the list of filter drivers. The cursor starts at the beginning of the
list (before the first filter). Unless returned to the starting position,
the cursor always moves forward.
@@ -905,10 +906,10 @@ Operators
+ Add after. Insert the specified filter after the filter on which the cursor
is positioned. If the cursor is not positioned on a filter, Devcon inserts the
new filter at the end of the list. When the subcommand completes, the cursor
- cursor is positioned on the newly-added filter.
+ cursor is positioned on the newly-added filter.
- ! Deletes the next occurrence of the specified filter. When the subcommand
- completes, the cursor occupies the position of the deleted filter.
+ ! Deletes the next occurrence of the specified filter. When the subcommand
+ completes, the cursor occupies the position of the deleted filter.
Subsequent - or + subcommands insert a new filter at the cursor position.