Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
707d299d
Commit
707d299d
authored
Aug 22, 2023
by
Piotr Caban
Committed by
Alexandre Julliard
Aug 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wmic: Fix output when redirected to pipe.
parent
846d1640
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
16 deletions
+14
-16
main.c
programs/wmic/main.c
+14
-16
No files found.
programs/wmic/main.c
View file @
707d299d
...
@@ -19,6 +19,8 @@
...
@@ -19,6 +19,8 @@
#define COBJMACROS
#define COBJMACROS
#include <fcntl.h>
#include <io.h>
#include <locale.h>
#include <locale.h>
#include <stdio.h>
#include <stdio.h>
#include "windows.h"
#include "windows.h"
...
@@ -63,29 +65,25 @@ static const WCHAR *find_class( const WCHAR *alias )
...
@@ -63,29 +65,25 @@ static const WCHAR *find_class( const WCHAR *alias )
return
NULL
;
return
NULL
;
}
}
static
int
WINAPIV
output_string
(
HANDLE
handle
,
const
WCHAR
*
msg
,
...
)
static
int
WINAPIV
output_string
(
const
WCHAR
*
msg
,
...
)
{
{
static
const
WCHAR
bomW
[]
=
{
0xfeff
}
;
int
count
,
bom_count
=
0
;
static
BOOL
bom
;
static
BOOL
bom
;
va_list
va_args
;
va_list
va_args
;
int
len
;
DWORD
count
,
bom_count
=
0
;
WCHAR
buffer
[
8192
];
va_start
(
va_args
,
msg
);
len
=
vswprintf
(
buffer
,
ARRAY_SIZE
(
buffer
),
msg
,
va_args
);
va_end
(
va_args
);
if
(
!
WriteConsoleW
(
handle
,
buffer
,
len
,
&
count
,
NULL
))
{
if
(
!
bom
)
if
(
!
bom
)
{
{
WriteFile
(
handle
,
bomW
,
sizeof
(
bomW
),
&
bom_count
,
FALSE
);
if
(
GetFileType
((
HANDLE
)
_get_osfhandle
(
STDOUT_FILENO
))
==
FILE_TYPE_DISK
)
bom
=
TRUE
;
{
_setmode
(
STDOUT_FILENO
,
_O_U16TEXT
);
bom_count
=
wprintf
(
L"
\xfeff
"
);
}
}
WriteFile
(
handle
,
buffer
,
len
*
sizeof
(
WCHAR
),
&
count
,
FALSE
)
;
bom
=
TRUE
;
}
}
va_start
(
va_args
,
msg
);
count
=
vwprintf
(
msg
,
va_args
);
va_end
(
va_args
);
return
count
+
bom_count
;
return
count
+
bom_count
;
}
}
...
@@ -99,12 +97,12 @@ static int output_error( int msg )
...
@@ -99,12 +97,12 @@ static int output_error( int msg )
static
int
output_text
(
const
WCHAR
*
str
,
ULONG
column_width
)
static
int
output_text
(
const
WCHAR
*
str
,
ULONG
column_width
)
{
{
return
output_string
(
GetStdHandle
(
STD_OUTPUT_HANDLE
),
L"%-*s"
,
column_width
,
str
);
return
output_string
(
L"%-*s"
,
column_width
,
str
);
}
}
static
int
output_newline
(
void
)
static
int
output_newline
(
void
)
{
{
return
output_string
(
GetStdHandle
(
STD_OUTPUT_HANDLE
),
L"
\r
\n
"
);
return
output_string
(
L"
\n
"
);
}
}
static
WCHAR
*
strip_spaces
(
WCHAR
*
start
)
static
WCHAR
*
strip_spaces
(
WCHAR
*
start
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment