Commit a95e0708 authored by Paul Vriens's avatar Paul Vriens Committed by Alexandre Julliard

kernel32: Add a stubbed GetConsoleProcessList().

parent 289047c7
...@@ -2690,3 +2690,19 @@ DWORD WINAPI GetConsoleAliasW(LPWSTR lpSource, LPWSTR lpTargetBuffer, ...@@ -2690,3 +2690,19 @@ DWORD WINAPI GetConsoleAliasW(LPWSTR lpSource, LPWSTR lpTargetBuffer,
SetLastError(ERROR_CALL_NOT_IMPLEMENTED); SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0; return 0;
} }
/******************************************************************
* GetConsoleProcessList (KERNEL32.@)
*/
DWORD WINAPI GetConsoleProcessList(LPDWORD processlist, DWORD processcount)
{
FIXME("(%p,%d): stub\n", processlist, processcount);
if (!processlist || processcount < 1)
{
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
return 0;
}
...@@ -478,7 +478,7 @@ ...@@ -478,7 +478,7 @@
@ stdcall GetConsoleMode(long ptr) @ stdcall GetConsoleMode(long ptr)
@ stub GetConsoleNlsMode @ stub GetConsoleNlsMode
@ stdcall GetConsoleOutputCP() @ stdcall GetConsoleOutputCP()
# @ stub GetConsoleProcessList @ stdcall GetConsoleProcessList(ptr long)
@ stdcall GetConsoleScreenBufferInfo(long ptr) @ stdcall GetConsoleScreenBufferInfo(long ptr)
# @ stub GetConsoleSelectionInfo # @ stub GetConsoleSelectionInfo
@ stdcall GetConsoleTitleA(ptr long) @ stdcall GetConsoleTitleA(ptr long)
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <stdio.h> #include <stdio.h>
static BOOL (WINAPI *pGetConsoleInputExeNameA)(DWORD, LPSTR); static BOOL (WINAPI *pGetConsoleInputExeNameA)(DWORD, LPSTR);
static DWORD (WINAPI *pGetConsoleProcessList)(LPDWORD, DWORD);
static BOOL (WINAPI *pSetConsoleInputExeNameA)(LPCSTR); static BOOL (WINAPI *pSetConsoleInputExeNameA)(LPCSTR);
/* DEFAULT_ATTRIB is used for all initial filling of the console. /* DEFAULT_ATTRIB is used for all initial filling of the console.
...@@ -63,6 +64,7 @@ static void init_function_pointers(void) ...@@ -63,6 +64,7 @@ static void init_function_pointers(void)
hKernel32 = GetModuleHandleA("kernel32.dll"); hKernel32 = GetModuleHandleA("kernel32.dll");
KERNEL32_GET_PROC(GetConsoleInputExeNameA); KERNEL32_GET_PROC(GetConsoleInputExeNameA);
KERNEL32_GET_PROC(GetConsoleProcessList);
KERNEL32_GET_PROC(SetConsoleInputExeNameA); KERNEL32_GET_PROC(SetConsoleInputExeNameA);
#undef KERNEL32_GET_PROC #undef KERNEL32_GET_PROC
...@@ -926,6 +928,66 @@ static void test_GetSetConsoleInputExeName(void) ...@@ -926,6 +928,66 @@ static void test_GetSetConsoleInputExeName(void)
ok(!lstrcmpA(buffer, input_exe), "got %s expected %s\n", buffer, input_exe); ok(!lstrcmpA(buffer, input_exe), "got %s expected %s\n", buffer, input_exe);
} }
static void test_GetConsoleProcessList(void)
{
DWORD ret, *list = NULL;
if (!pGetConsoleProcessList)
{
win_skip("GetConsoleProcessList is not available\n");
return;
}
SetLastError(0xdeadbeef);
ret = pGetConsoleProcessList(NULL, 0);
ok(ret == 0, "Expected failure\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
SetLastError(0xdeadbeef);
ret = pGetConsoleProcessList(NULL, 1);
ok(ret == 0, "Expected failure\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
/* We should only have 1 process but only for these specific unit tests as
* we created our own console. An AttachConsole(ATTACH_PARENT_PROCESS) would
* give us two processes for example.
*/
list = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD));
SetLastError(0xdeadbeef);
ret = pGetConsoleProcessList(list, 0);
ok(ret == 0, "Expected failure\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
SetLastError(0xdeadbeef);
ret = pGetConsoleProcessList(list, 1);
todo_wine
ok(ret == 1, "Expected 1, got %d\n", ret);
HeapFree(GetProcessHeap(), 0, list);
list = HeapAlloc(GetProcessHeap(), 0, ret * sizeof(DWORD));
SetLastError(0xdeadbeef);
ret = pGetConsoleProcessList(list, ret);
todo_wine
ok(ret == 1, "Expected 1, got %d\n", ret);
if (ret == 1)
{
DWORD pid = GetCurrentProcessId();
ok(list[0] == pid, "Expected %d, got %d\n", pid, list[0]);
}
HeapFree(GetProcessHeap(), 0, list);
}
START_TEST(console) START_TEST(console)
{ {
HANDLE hConIn, hConOut; HANDLE hConIn, hConOut;
...@@ -971,10 +1033,9 @@ START_TEST(console) ...@@ -971,10 +1033,9 @@ START_TEST(console)
/* still to be done: access rights & access on objects */ /* still to be done: access rights & access on objects */
if (!pGetConsoleInputExeNameA || !pSetConsoleInputExeNameA) if (!pGetConsoleInputExeNameA || !pSetConsoleInputExeNameA)
{
win_skip("GetConsoleInputExeNameA and/or SetConsoleInputExeNameA is not available\n"); win_skip("GetConsoleInputExeNameA and/or SetConsoleInputExeNameA is not available\n");
return;
}
else else
test_GetSetConsoleInputExeName(); test_GetSetConsoleInputExeName();
test_GetConsoleProcessList();
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment