Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
8238c1d4
Commit
8238c1d4
authored
Apr 18, 2023
by
Zhiyi Zhang
Committed by
Alexandre Julliard
May 02, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tasklist: Support '/nh' option.
parent
62af0b5f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
6 deletions
+35
-6
tasklist.c
programs/tasklist/tasklist.c
+15
-6
tasklist.h
programs/tasklist/tasklist.h
+5
-0
tasklist.c
programs/tasklist/tests/tasklist.c
+15
-0
No files found.
programs/tasklist/tasklist.c
View file @
8238c1d4
...
...
@@ -163,17 +163,21 @@ static BOOL tasklist_get_process_info(const PROCESSENTRY32W *process_entry, stru
return
TRUE
;
}
static
void
tasklist_print
(
void
)
static
void
tasklist_print
(
const
struct
tasklist_options
*
options
)
{
struct
tasklist_process_info
header
,
info
;
PROCESSENTRY32W
*
process_list
;
DWORD
process_count
,
i
;
wprintf
(
L"
\n
"
);
tasklist_get_header
(
&
header
);
wprintf
(
L"%-25.25s %8.8s %-16.16s %11.11s %12.12s
\n
"
L"========================= ======== ================ =========== ============
\n
"
,
header
.
image_name
,
header
.
pid
,
header
.
session_name
,
header
.
session_number
,
header
.
memory_usage
);
if
(
!
options
->
no_header
)
{
tasklist_get_header
(
&
header
);
wprintf
(
L"%-25.25s %8.8s %-16.16s %11.11s %12.12s
\n
"
L"========================= ======== ================ =========== ============
\n
"
,
header
.
image_name
,
header
.
pid
,
header
.
session_name
,
header
.
session_number
,
header
.
memory_usage
);
}
process_list
=
enumerate_processes
(
&
process_count
);
for
(
i
=
0
;
i
<
process_count
;
++
i
)
...
...
@@ -189,6 +193,7 @@ static void tasklist_print(void)
int
__cdecl
wmain
(
int
argc
,
WCHAR
*
argv
[])
{
struct
tasklist_options
options
=
{
0
};
int
i
;
for
(
i
=
0
;
i
<
argc
;
i
++
)
...
...
@@ -202,12 +207,16 @@ int __cdecl wmain(int argc, WCHAR *argv[])
tasklist_message
(
STRING_USAGE
);
return
0
;
}
else
if
(
!
wcsicmp
(
argv
[
i
],
L"/nh"
))
{
options
.
no_header
=
TRUE
;
}
else
{
WINE_WARN
(
"Ignoring option %s
\n
"
,
wine_dbgstr_w
(
argv
[
i
]));
}
}
tasklist_print
();
tasklist_print
(
&
options
);
return
0
;
}
programs/tasklist/tasklist.h
View file @
8238c1d4
...
...
@@ -36,3 +36,8 @@ struct tasklist_process_info
WCHAR
session_number
[
32
];
WCHAR
memory_usage
[
32
];
};
struct
tasklist_options
{
BOOL
no_header
;
};
programs/tasklist/tests/tasklist.c
View file @
8238c1d4
...
...
@@ -108,6 +108,20 @@ static void test_basic(void)
ok
(
stderr_size
==
0
,
"Unexpected stderr buffer size %ld.
\n
"
,
stderr_size
);
}
static
void
test_no_header
(
void
)
{
char
*
pos
;
/* /nh */
run_tasklist
(
"/nh"
,
0
);
ok
(
stdout_size
>
0
,
"Unexpected stdout buffer size %ld.
\n
"
,
stdout_size
);
ok
(
stderr_size
==
0
,
"Unexpected stderr buffer size %ld.
\n
"
,
stderr_size
);
pos
=
strstr
(
stdout_buffer
,
"Image Name"
);
ok
(
!
pos
,
"Got header.
\n
"
);
pos
=
strstr
(
stdout_buffer
,
"="
);
ok
(
!
pos
,
"Got header.
\n
"
);
}
START_TEST
(
tasklist
)
{
if
(
PRIMARYLANGID
(
GetUserDefaultUILanguage
())
!=
LANG_ENGLISH
)
...
...
@@ -117,4 +131,5 @@ START_TEST(tasklist)
}
test_basic
();
test_no_header
();
}
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