kernel32: Implement GetConsoleProcessList.
Signed-off-by: Roman Pišl <rpisl@seznam.cz> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
6559134702
commit
3a95a4a012
|
@ -252,7 +252,11 @@ DWORD WINAPI GetConsoleAliasW(LPWSTR lpSource, LPWSTR lpTargetBuffer,
|
|||
*/
|
||||
DWORD WINAPI GetConsoleProcessList(LPDWORD processlist, DWORD processcount)
|
||||
{
|
||||
FIXME("(%p,%ld): stub\n", processlist, processcount);
|
||||
DWORD saved;
|
||||
NTSTATUS status;
|
||||
IO_STATUS_BLOCK io;
|
||||
|
||||
TRACE("(%p,%ld)\n", processlist, processcount);
|
||||
|
||||
if (!processlist || processcount < 1)
|
||||
{
|
||||
|
@ -260,6 +264,21 @@ DWORD WINAPI GetConsoleProcessList(LPDWORD processlist, DWORD processcount)
|
|||
return 0;
|
||||
}
|
||||
|
||||
saved = *processlist;
|
||||
status = NtDeviceIoControlFile( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle,
|
||||
NULL, NULL, NULL, &io, IOCTL_CONDRV_GET_PROCESS_LIST,
|
||||
NULL, 0, processlist, processcount * sizeof(DWORD) );
|
||||
|
||||
if (!status) return io.Information / sizeof(DWORD);
|
||||
if (status == STATUS_BUFFER_TOO_SMALL)
|
||||
{
|
||||
DWORD ret = *processlist;
|
||||
*processlist = saved;
|
||||
return ret;
|
||||
}
|
||||
|
||||
*processlist = saved;
|
||||
set_ntstatus( status );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1318,7 +1318,6 @@ static void test_GetConsoleProcessList(void)
|
|||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pGetConsoleProcessList(list, 1);
|
||||
todo_wine
|
||||
ok(ret == 1, "Expected 1, got %d\n", ret);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, list);
|
||||
|
@ -1327,7 +1326,6 @@ static void test_GetConsoleProcessList(void)
|
|||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pGetConsoleProcessList(list, ret);
|
||||
todo_wine
|
||||
ok(ret == 1, "Expected 1, got %d\n", ret);
|
||||
|
||||
if (ret == 1)
|
||||
|
@ -4361,16 +4359,12 @@ static void test_AttachConsole_child(DWORD console_pid)
|
|||
|
||||
SetLastError(0xdeadbeef);
|
||||
len = pGetConsoleProcessList(list, 1);
|
||||
todo_wine
|
||||
ok(len == 2, "Expected 2 processes, got %d\n", len);
|
||||
ok(list[0] == 0xbabebabe, "Unexpected value in list %u\n", list[0]);
|
||||
|
||||
len = pGetConsoleProcessList(list, 2);
|
||||
todo_wine
|
||||
ok(len == 2, "Expected 2 processes, got %d\n", len);
|
||||
todo_wine
|
||||
ok(list[0] == console_pid || list[1] == console_pid, "Parent PID not in list\n");
|
||||
todo_wine
|
||||
ok(list[0] == pid || list[1] == pid, "PID not in list\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Unexpected last error: %u\n", GetLastError());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue