There are times when it is useful to test changes on the Windows XP and 2003 VMs, but the direct use of functions not on those platforms makes this impossible.
From: Hugh McMaster hugh.mcmaster@outlook.com
--- dlls/kernel32/tests/console.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-)
diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index f8e39c164d2..84d0e8ae84e 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -31,6 +31,8 @@ static void (WINAPI *pClosePseudoConsole)(HPCON); static HRESULT (WINAPI *pCreatePseudoConsole)(COORD,HANDLE,HANDLE,DWORD,HPCON*); static BOOL (WINAPI *pGetConsoleInputExeNameA)(DWORD, LPSTR); +static DWORD (WINAPI *pGetConsoleOriginalTitleA)(LPSTR, DWORD); +static DWORD (WINAPI *pGetConsoleOriginalTitleW)(LPWSTR, DWORD); static DWORD (WINAPI *pGetConsoleProcessList)(LPDWORD, DWORD); static HANDLE (WINAPI *pOpenConsoleW)(LPCWSTR,DWORD,BOOL,DWORD); static BOOL (WINAPI *pSetConsoleInputExeNameA)(LPCSTR); @@ -77,6 +79,8 @@ static void init_function_pointers(void) KERNEL32_GET_PROC(ClosePseudoConsole); KERNEL32_GET_PROC(CreatePseudoConsole); KERNEL32_GET_PROC(GetConsoleInputExeNameA); + KERNEL32_GET_PROC(GetConsoleOriginalTitleA); + KERNEL32_GET_PROC(GetConsoleOriginalTitleW); KERNEL32_GET_PROC(GetConsoleProcessList); KERNEL32_GET_PROC(OpenConsoleW); KERNEL32_GET_PROC(SetConsoleInputExeNameA); @@ -4231,20 +4235,26 @@ static void test_GetConsoleOriginalTitleA(void) DWORD ret; char title[] = "Original Console Title";
- ret = GetConsoleOriginalTitleA(NULL, 0); + if (!pGetConsoleOriginalTitleA) + { + win_skip("GetConsoleOriginalTitleA not available.\n"); + return; + } + + ret = pGetConsoleOriginalTitleA(NULL, 0); ok(!ret, "Unexpected string length; error %lu\n", GetLastError());
- ret = GetConsoleOriginalTitleA(buf, 0); + ret = pGetConsoleOriginalTitleA(buf, 0); ok(!ret, "Unexpected string length; error %lu\n", GetLastError());
- ret = GetConsoleOriginalTitleA(buf, ARRAY_SIZE(buf)); + ret = pGetConsoleOriginalTitleA(buf, ARRAY_SIZE(buf)); todo_wine ok(ret, "GetConsoleOriginalTitleA failed: %lu\n", GetLastError()); todo_wine ok(!strcmp(buf, title), "got %s, expected %s\n", wine_dbgstr_a(buf), wine_dbgstr_a(title));
ret = SetConsoleTitleA("test"); ok(ret, "SetConsoleTitleA failed: %lu\n", GetLastError());
- ret = GetConsoleOriginalTitleA(buf, ARRAY_SIZE(buf)); + ret = pGetConsoleOriginalTitleA(buf, ARRAY_SIZE(buf)); todo_wine ok(ret, "GetConsoleOriginalTitleA failed: %lu\n", GetLastError()); todo_wine ok(!strcmp(buf, title), "got %s, expected %s\n", wine_dbgstr_a(buf), wine_dbgstr_a(title)); } @@ -4255,13 +4265,19 @@ static void test_GetConsoleOriginalTitleW(void) DWORD ret; WCHAR title[] = L"Original Console Title";
- ret = GetConsoleOriginalTitleW(NULL, 0); + if (!pGetConsoleOriginalTitleW) + { + win_skip("GetConsoleOriginalTitleW not available.\n"); + return; + } + + ret = pGetConsoleOriginalTitleW(NULL, 0); ok(!ret, "Unexpected string length; error %lu\n", GetLastError());
- ret = GetConsoleOriginalTitleW(buf, 0); + ret = pGetConsoleOriginalTitleW(buf, 0); ok(!ret, "Unexpected string length; error %lu\n", GetLastError());
- ret = GetConsoleOriginalTitleW(buf, ARRAY_SIZE(buf)); + ret = pGetConsoleOriginalTitleW(buf, ARRAY_SIZE(buf)); todo_wine ok(ret, "GetConsoleOriginalTitleW failed: %lu\n", GetLastError()); buf[ret] = 0; todo_wine ok(!wcscmp(buf, title), "got %s, expected %s\n", wine_dbgstr_w(buf), wine_dbgstr_w(title)); @@ -4269,11 +4285,11 @@ static void test_GetConsoleOriginalTitleW(void) ret = SetConsoleTitleW(L"test"); ok(ret, "SetConsoleTitleW failed: %lu\n", GetLastError());
- ret = GetConsoleOriginalTitleW(buf, ARRAY_SIZE(buf)); + ret = pGetConsoleOriginalTitleW(buf, ARRAY_SIZE(buf)); todo_wine ok(ret, "GetConsoleOriginalTitleW failed: %lu\n", GetLastError()); todo_wine ok(!wcscmp(buf, title), "got %s, expected %s\n", wine_dbgstr_w(buf), wine_dbgstr_w(title));
- ret = GetConsoleOriginalTitleW(buf, 5); + ret = pGetConsoleOriginalTitleW(buf, 5); todo_wine ok(ret, "GetConsoleOriginalTitleW failed: %lu\n", GetLastError()); todo_wine ok(!wcscmp(buf, L"Orig"), "got %s, expected 'Orig'\n", wine_dbgstr_w(buf)); }
From: Hugh McMaster hugh.mcmaster@outlook.com
--- dlls/kernel32/tests/console.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index 84d0e8ae84e..c698618db0d 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -34,6 +34,7 @@ static BOOL (WINAPI *pGetConsoleInputExeNameA)(DWORD, LPSTR); static DWORD (WINAPI *pGetConsoleOriginalTitleA)(LPSTR, DWORD); static DWORD (WINAPI *pGetConsoleOriginalTitleW)(LPWSTR, DWORD); static DWORD (WINAPI *pGetConsoleProcessList)(LPDWORD, DWORD); +static BOOL (WINAPI *pGetCurrentConsoleFontEx)(HANDLE, BOOL, CONSOLE_FONT_INFOEX *); static HANDLE (WINAPI *pOpenConsoleW)(LPCWSTR,DWORD,BOOL,DWORD); static BOOL (WINAPI *pSetConsoleInputExeNameA)(LPCSTR); static BOOL (WINAPI *pVerifyConsoleIoHandle)(HANDLE handle); @@ -82,6 +83,7 @@ static void init_function_pointers(void) KERNEL32_GET_PROC(GetConsoleOriginalTitleA); KERNEL32_GET_PROC(GetConsoleOriginalTitleW); KERNEL32_GET_PROC(GetConsoleProcessList); + KERNEL32_GET_PROC(GetCurrentConsoleFontEx); KERNEL32_GET_PROC(OpenConsoleW); KERNEL32_GET_PROC(SetConsoleInputExeNameA); KERNEL32_GET_PROC(VerifyConsoleIoHandle); @@ -1008,17 +1010,23 @@ static void test_new_screen_buffer_properties(HANDLE hConOut) CONSOLE_FONT_INFOEX cfi, cfi2; CONSOLE_SCREEN_BUFFER_INFO csbi, csbi2;
+ if (!pGetCurrentConsoleFontEx) + { + win_skip("GetCurrentConsoleFontEx not available.\n"); + return; + } + /* Font information */ cfi.cbSize = cfi2.cbSize = sizeof(CONSOLE_FONT_INFOEX);
- ret = GetCurrentConsoleFontEx(hConOut, FALSE, &cfi); + ret = pGetCurrentConsoleFontEx(hConOut, FALSE, &cfi); ok(ret, "GetCurrentConsoleFontEx failed: error %lu\n", GetLastError());
hConOut2 = CreateConsoleScreenBuffer(GENERIC_READ|GENERIC_WRITE, 0, NULL, CONSOLE_TEXTMODE_BUFFER, NULL); ok(hConOut2 != INVALID_HANDLE_VALUE, "CreateConsoleScreenBuffer failed: error %lu\n", GetLastError());
- ret = GetCurrentConsoleFontEx(hConOut2, FALSE, &cfi2); + ret = pGetCurrentConsoleFontEx(hConOut2, FALSE, &cfi2); ok(ret, "GetCurrentConsoleFontEx failed: error %lu\n", GetLastError()); CloseHandle(hConOut2);
@@ -3433,8 +3441,6 @@ static void test_GetCurrentConsoleFont(HANDLE std_output)
static void test_GetCurrentConsoleFontEx(HANDLE std_output) { - HANDLE hmod; - BOOL (WINAPI *pGetCurrentConsoleFontEx)(HANDLE, BOOL, CONSOLE_FONT_INFOEX *); CONSOLE_FONT_INFO cfi; CONSOLE_FONT_INFOEX cfix; BOOL ret; @@ -3442,11 +3448,9 @@ static void test_GetCurrentConsoleFontEx(HANDLE std_output) HANDLE pipe1, pipe2; COORD c;
- hmod = GetModuleHandleA("kernel32.dll"); - pGetCurrentConsoleFontEx = (void *)GetProcAddress(hmod, "GetCurrentConsoleFontEx"); if (!pGetCurrentConsoleFontEx) { - win_skip("GetCurrentConsoleFontEx is not available\n"); + win_skip("GetCurrentConsoleFontEx not available.\n"); return; }
@@ -3562,9 +3566,15 @@ static void test_SetCurrentConsoleFontEx(HANDLE std_output) HANDLE pipe1, pipe2; HANDLE std_input = GetStdHandle(STD_INPUT_HANDLE);
+ if (!pGetCurrentConsoleFontEx) + { + win_skip("GetCurrentConsoleFontEx not available.\n"); + return; + } + orig_cfix.cbSize = sizeof(CONSOLE_FONT_INFOEX);
- ret = GetCurrentConsoleFontEx(std_output, FALSE, &orig_cfix); + ret = pGetCurrentConsoleFontEx(std_output, FALSE, &orig_cfix); ok(ret, "got %d, expected non-zero\n", ret);
cfix = orig_cfix;
From: Hugh McMaster hugh.mcmaster@outlook.com
--- dlls/kernel32/tests/console.c | 40 ++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index c698618db0d..3327e74b3cc 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -37,6 +37,7 @@ static DWORD (WINAPI *pGetConsoleProcessList)(LPDWORD, DWORD); static BOOL (WINAPI *pGetCurrentConsoleFontEx)(HANDLE, BOOL, CONSOLE_FONT_INFOEX *); static HANDLE (WINAPI *pOpenConsoleW)(LPCWSTR,DWORD,BOOL,DWORD); static BOOL (WINAPI *pSetConsoleInputExeNameA)(LPCSTR); +static BOOL (WINAPI *pSetCurrentConsoleFontEx)(HANDLE, BOOL, CONSOLE_FONT_INFOEX *); static BOOL (WINAPI *pVerifyConsoleIoHandle)(HANDLE handle);
static BOOL skip_nt; @@ -86,6 +87,7 @@ static void init_function_pointers(void) KERNEL32_GET_PROC(GetCurrentConsoleFontEx); KERNEL32_GET_PROC(OpenConsoleW); KERNEL32_GET_PROC(SetConsoleInputExeNameA); + KERNEL32_GET_PROC(SetCurrentConsoleFontEx); KERNEL32_GET_PROC(VerifyConsoleIoHandle);
#undef KERNEL32_GET_PROC @@ -3566,9 +3568,9 @@ static void test_SetCurrentConsoleFontEx(HANDLE std_output) HANDLE pipe1, pipe2; HANDLE std_input = GetStdHandle(STD_INPUT_HANDLE);
- if (!pGetCurrentConsoleFontEx) + if (!pGetCurrentConsoleFontEx || !pSetCurrentConsoleFontEx) { - win_skip("GetCurrentConsoleFontEx not available.\n"); + win_skip("GetCurrentConsoleFontEx or SetCurrentConsoleFontEx not available.\n"); return; }
@@ -3581,18 +3583,18 @@ static void test_SetCurrentConsoleFontEx(HANDLE std_output) cfix.cbSize = 0;
SetLastError(0xdeadbeef); - ret = SetCurrentConsoleFontEx(NULL, FALSE, &cfix); + ret = pSetCurrentConsoleFontEx(NULL, FALSE, &cfix); ok(!ret, "got %d, expected 0\n", ret); ok(GetLastError() == ERROR_INVALID_PARAMETER, "got %lu, expected 87\n", GetLastError());
SetLastError(0xdeadbeef); - ret = SetCurrentConsoleFontEx(NULL, TRUE, &cfix); + ret = pSetCurrentConsoleFontEx(NULL, TRUE, &cfix); ok(!ret, "got %d, expected 0\n", ret); ok(GetLastError() == ERROR_INVALID_PARAMETER, "got %lu, expected 87\n", GetLastError());
CreatePipe(&pipe1, &pipe2, NULL, 0); SetLastError(0xdeadbeef); - ret = SetCurrentConsoleFontEx(pipe1, FALSE, &cfix); + ret = pSetCurrentConsoleFontEx(pipe1, FALSE, &cfix); ok(!ret, "got %d, expected 0\n", ret); ok(GetLastError() == ERROR_INVALID_PARAMETER, "got %lu, expected 87\n", GetLastError()); CloseHandle(pipe1); @@ -3600,47 +3602,47 @@ static void test_SetCurrentConsoleFontEx(HANDLE std_output)
CreatePipe(&pipe1, &pipe2, NULL, 0); SetLastError(0xdeadbeef); - ret = SetCurrentConsoleFontEx(pipe1, TRUE, &cfix); + ret = pSetCurrentConsoleFontEx(pipe1, TRUE, &cfix); ok(!ret, "got %d, expected 0\n", ret); ok(GetLastError() == ERROR_INVALID_PARAMETER, "got %lu, expected 87\n", GetLastError()); CloseHandle(pipe1); CloseHandle(pipe2);
SetLastError(0xdeadbeef); - ret = SetCurrentConsoleFontEx(std_input, FALSE, &cfix); + ret = pSetCurrentConsoleFontEx(std_input, FALSE, &cfix); ok(!ret, "got %d, expected 0\n", ret); ok(GetLastError() == ERROR_INVALID_PARAMETER, "got %lu, expected 87\n", GetLastError());
SetLastError(0xdeadbeef); - ret = SetCurrentConsoleFontEx(std_input, TRUE, &cfix); + ret = pSetCurrentConsoleFontEx(std_input, TRUE, &cfix); ok(!ret, "got %d, expected 0\n", ret); ok(GetLastError() == ERROR_INVALID_PARAMETER, "got %lu, expected 87\n", GetLastError());
SetLastError(0xdeadbeef); - ret = SetCurrentConsoleFontEx(std_output, FALSE, &cfix); + ret = pSetCurrentConsoleFontEx(std_output, FALSE, &cfix); ok(!ret, "got %d, expected 0\n", ret); ok(GetLastError() == ERROR_INVALID_PARAMETER, "got %lu, expected 87\n", GetLastError());
SetLastError(0xdeadbeef); - ret = SetCurrentConsoleFontEx(std_output, TRUE, &cfix); + ret = pSetCurrentConsoleFontEx(std_output, TRUE, &cfix); ok(!ret, "got %d, expected 0\n", ret); ok(GetLastError() == ERROR_INVALID_PARAMETER, "got %lu, expected 87\n", GetLastError());
cfix = orig_cfix;
SetLastError(0xdeadbeef); - ret = SetCurrentConsoleFontEx(NULL, FALSE, &cfix); + ret = pSetCurrentConsoleFontEx(NULL, FALSE, &cfix); ok(!ret, "got %d, expected 0\n", ret); ok(GetLastError() == ERROR_INVALID_HANDLE, "got %lu, expected 6\n", GetLastError());
SetLastError(0xdeadbeef); - ret = SetCurrentConsoleFontEx(NULL, TRUE, &cfix); + ret = pSetCurrentConsoleFontEx(NULL, TRUE, &cfix); ok(!ret, "got %d, expected 0\n", ret); ok(GetLastError() == ERROR_INVALID_HANDLE, "got %lu, expected 6\n", GetLastError());
CreatePipe(&pipe1, &pipe2, NULL, 0); SetLastError(0xdeadbeef); - ret = SetCurrentConsoleFontEx(pipe1, FALSE, &cfix); + ret = pSetCurrentConsoleFontEx(pipe1, FALSE, &cfix); ok(!ret, "got %d, expected 0\n", ret); ok(GetLastError() == ERROR_INVALID_HANDLE, "got %lu, expected 6\n", GetLastError()); CloseHandle(pipe1); @@ -3648,35 +3650,35 @@ static void test_SetCurrentConsoleFontEx(HANDLE std_output)
CreatePipe(&pipe1, &pipe2, NULL, 0); SetLastError(0xdeadbeef); - ret = SetCurrentConsoleFontEx(pipe1, TRUE, &cfix); + ret = pSetCurrentConsoleFontEx(pipe1, TRUE, &cfix); ok(!ret, "got %d, expected 0\n", ret); ok(GetLastError() == ERROR_INVALID_HANDLE, "got %lu, expected 6\n", GetLastError()); CloseHandle(pipe1); CloseHandle(pipe2);
SetLastError(0xdeadbeef); - ret = SetCurrentConsoleFontEx(std_input, FALSE, &cfix); + ret = pSetCurrentConsoleFontEx(std_input, FALSE, &cfix); ok(!ret, "got %d, expected 0\n", ret); ok(GetLastError() == ERROR_INVALID_HANDLE, "got %lu, expected 6\n", GetLastError());
SetLastError(0xdeadbeef); - ret = SetCurrentConsoleFontEx(std_input, TRUE, &cfix); + ret = pSetCurrentConsoleFontEx(std_input, TRUE, &cfix); ok(!ret, "got %d, expected 0\n", ret); ok(GetLastError() == ERROR_INVALID_HANDLE, "got %lu, expected 6\n", GetLastError());
SetLastError(0xdeadbeef); - ret = SetCurrentConsoleFontEx(std_output, FALSE, &cfix); + ret = pSetCurrentConsoleFontEx(std_output, FALSE, &cfix); ok(ret, "got %d, expected non-zero\n", ret); ok(GetLastError() == 0xdeadbeef, "got %lu, expected 0xdeadbeef\n", GetLastError());
SetLastError(0xdeadbeef); - ret = SetCurrentConsoleFontEx(std_output, TRUE, &cfix); + ret = pSetCurrentConsoleFontEx(std_output, TRUE, &cfix); ok(ret, "got %d, expected non-zero\n", ret); ok(GetLastError() == 0xdeadbeef, "got %lu, expected 0xdeadbeef\n", GetLastError());
/* Restore original console font parameters */ SetLastError(0xdeadbeef); - ret = SetCurrentConsoleFontEx(std_output, FALSE, &orig_cfix); + ret = pSetCurrentConsoleFontEx(std_output, FALSE, &orig_cfix); ok(ret, "got %d, expected non-zero\n", ret); ok(GetLastError() == 0xdeadbeef, "got %lu, expected 0xdeadbeef\n", GetLastError()); }
From: Hugh McMaster hugh.mcmaster@outlook.com
--- dlls/kernel32/tests/console.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index 3327e74b3cc..09ac8250e4f 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -34,6 +34,7 @@ static BOOL (WINAPI *pGetConsoleInputExeNameA)(DWORD, LPSTR); static DWORD (WINAPI *pGetConsoleOriginalTitleA)(LPSTR, DWORD); static DWORD (WINAPI *pGetConsoleOriginalTitleW)(LPWSTR, DWORD); static DWORD (WINAPI *pGetConsoleProcessList)(LPDWORD, DWORD); +static BOOL (WINAPI *pGetConsoleScreenBufferInfoEx)(HANDLE, CONSOLE_SCREEN_BUFFER_INFOEX *); static BOOL (WINAPI *pGetCurrentConsoleFontEx)(HANDLE, BOOL, CONSOLE_FONT_INFOEX *); static HANDLE (WINAPI *pOpenConsoleW)(LPCWSTR,DWORD,BOOL,DWORD); static BOOL (WINAPI *pSetConsoleInputExeNameA)(LPCSTR); @@ -84,6 +85,7 @@ static void init_function_pointers(void) KERNEL32_GET_PROC(GetConsoleOriginalTitleA); KERNEL32_GET_PROC(GetConsoleOriginalTitleW); KERNEL32_GET_PROC(GetConsoleProcessList); + KERNEL32_GET_PROC(GetConsoleScreenBufferInfoEx); KERNEL32_GET_PROC(GetCurrentConsoleFontEx); KERNEL32_GET_PROC(OpenConsoleW); KERNEL32_GET_PROC(SetConsoleInputExeNameA); @@ -1070,9 +1072,15 @@ static void test_new_screen_buffer_color_attributes(HANDLE hConOut) HANDLE hConOut2; WORD orig_attr, orig_popup, attr;
+ if (!pGetConsoleScreenBufferInfoEx) + { + win_skip("GetConsoleScreenBufferInfoEx not available.\n"); + return; + } + csbi.cbSize = csbi2.cbSize = sizeof(CONSOLE_SCREEN_BUFFER_INFOEX);
- ret = GetConsoleScreenBufferInfoEx(hConOut, &csbi); + ret = pGetConsoleScreenBufferInfoEx(hConOut, &csbi); ok(ret, "GetConsoleScreenBufferInfoEx failed: error %lu\n", GetLastError()); orig_attr = csbi.wAttributes; orig_popup = csbi.wPopupAttributes; @@ -1081,7 +1089,7 @@ static void test_new_screen_buffer_color_attributes(HANDLE hConOut) CONSOLE_TEXTMODE_BUFFER, NULL); ok(hConOut2 != INVALID_HANDLE_VALUE, "CreateConsoleScreenBuffer failed: error %lu\n", GetLastError());
- ret = GetConsoleScreenBufferInfoEx(hConOut2, &csbi2); + ret = pGetConsoleScreenBufferInfoEx(hConOut2, &csbi2); ok(ret, "GetConsoleScreenBufferInfoEx failed: error %lu\n", GetLastError()); CloseHandle(hConOut2);
@@ -1102,7 +1110,7 @@ static void test_new_screen_buffer_color_attributes(HANDLE hConOut) memset(&csbi2, 0, sizeof(CONSOLE_SCREEN_BUFFER_INFOEX)); csbi2.cbSize = sizeof(CONSOLE_SCREEN_BUFFER_INFOEX);
- ret = GetConsoleScreenBufferInfoEx(hConOut2, &csbi2); + ret = pGetConsoleScreenBufferInfoEx(hConOut2, &csbi2); ok(ret, "GetConsoleScreenBufferInfoEx failed: error %lu\n", GetLastError()); CloseHandle(hConOut2);
@@ -1126,7 +1134,7 @@ static void test_new_screen_buffer_color_attributes(HANDLE hConOut) memset(&csbi2, 0, sizeof(CONSOLE_SCREEN_BUFFER_INFOEX)); csbi2.cbSize = sizeof(CONSOLE_SCREEN_BUFFER_INFOEX);
- ret = GetConsoleScreenBufferInfoEx(hConOut2, &csbi2); + ret = pGetConsoleScreenBufferInfoEx(hConOut2, &csbi2); ok(ret, "GetConsoleScreenBufferInfoEx failed: error %lu\n", GetLastError()); CloseHandle(hConOut2);
@@ -4008,18 +4016,14 @@ static void test_SetConsoleFont(HANDLE std_output)
static void test_GetConsoleScreenBufferInfoEx(HANDLE std_output) { - HANDLE hmod; - BOOL (WINAPI *pGetConsoleScreenBufferInfoEx)(HANDLE, CONSOLE_SCREEN_BUFFER_INFOEX *); CONSOLE_SCREEN_BUFFER_INFOEX csbix; HANDLE pipe1, pipe2; BOOL ret; HANDLE std_input = GetStdHandle(STD_INPUT_HANDLE);
- hmod = GetModuleHandleA("kernel32.dll"); - pGetConsoleScreenBufferInfoEx = (void *)GetProcAddress(hmod, "GetConsoleScreenBufferInfoEx"); if (!pGetConsoleScreenBufferInfoEx) { - win_skip("GetConsoleScreenBufferInfoEx is not available\n"); + win_skip("GetConsoleScreenBufferInfoEx not available.\n"); return; }
@@ -4200,15 +4204,13 @@ static void test_SetConsoleScreenBufferInfoEx(HANDLE std_output) HANDLE hmod; HANDLE std_input = CreateFileA("CONIN$", GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0); BOOL (WINAPI *pSetConsoleScreenBufferInfoEx)(HANDLE, CONSOLE_SCREEN_BUFFER_INFOEX *); - BOOL (WINAPI *pGetConsoleScreenBufferInfoEx)(HANDLE, CONSOLE_SCREEN_BUFFER_INFOEX *); CONSOLE_SCREEN_BUFFER_INFOEX info;
hmod = GetModuleHandleA("kernel32.dll"); pSetConsoleScreenBufferInfoEx = (void *)GetProcAddress(hmod, "SetConsoleScreenBufferInfoEx"); - pGetConsoleScreenBufferInfoEx = (void *)GetProcAddress(hmod, "GetConsoleScreenBufferInfoEx"); - if (!pSetConsoleScreenBufferInfoEx || !pGetConsoleScreenBufferInfoEx) + if (!pGetConsoleScreenBufferInfoEx || !pSetConsoleScreenBufferInfoEx) { - win_skip("SetConsoleScreenBufferInfoEx is not available\n"); + win_skip("GetConsoleScreenBufferInfoEx or SetConsoleScreenBufferInfoEx not available.\n"); return; }
From: Hugh McMaster hugh.mcmaster@outlook.com
--- dlls/kernel32/tests/console.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index 09ac8250e4f..2a071900f3c 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -38,6 +38,7 @@ static BOOL (WINAPI *pGetConsoleScreenBufferInfoEx)(HANDLE, CONSOLE_SCREEN_BUFFE static BOOL (WINAPI *pGetCurrentConsoleFontEx)(HANDLE, BOOL, CONSOLE_FONT_INFOEX *); static HANDLE (WINAPI *pOpenConsoleW)(LPCWSTR,DWORD,BOOL,DWORD); static BOOL (WINAPI *pSetConsoleInputExeNameA)(LPCSTR); +static BOOL (WINAPI *pSetConsoleScreenBufferInfoEx)(HANDLE, CONSOLE_SCREEN_BUFFER_INFOEX *); static BOOL (WINAPI *pSetCurrentConsoleFontEx)(HANDLE, BOOL, CONSOLE_FONT_INFOEX *); static BOOL (WINAPI *pVerifyConsoleIoHandle)(HANDLE handle);
@@ -89,6 +90,7 @@ static void init_function_pointers(void) KERNEL32_GET_PROC(GetCurrentConsoleFontEx); KERNEL32_GET_PROC(OpenConsoleW); KERNEL32_GET_PROC(SetConsoleInputExeNameA); + KERNEL32_GET_PROC(SetConsoleScreenBufferInfoEx); KERNEL32_GET_PROC(SetCurrentConsoleFontEx); KERNEL32_GET_PROC(VerifyConsoleIoHandle);
@@ -1072,9 +1074,9 @@ static void test_new_screen_buffer_color_attributes(HANDLE hConOut) HANDLE hConOut2; WORD orig_attr, orig_popup, attr;
- if (!pGetConsoleScreenBufferInfoEx) + if (!pGetConsoleScreenBufferInfoEx || !pSetConsoleScreenBufferInfoEx) { - win_skip("GetConsoleScreenBufferInfoEx not available.\n"); + win_skip("GetConsoleScreenBufferInfoEx or SetConsoleScreenBufferInfoEx not available.\n"); return; }
@@ -1124,7 +1126,7 @@ static void test_new_screen_buffer_color_attributes(HANDLE hConOut)
/* Test inheritance of different Popup Attributes */ csbi.wPopupAttributes = attr; - ret = SetConsoleScreenBufferInfoEx(hConOut, &csbi); + ret = pSetConsoleScreenBufferInfoEx(hConOut, &csbi); ok(ret, "SetConsoleScreenBufferInfoEx failed: error %lu\n", GetLastError());
hConOut2 = CreateConsoleScreenBuffer(GENERIC_READ|GENERIC_WRITE, 0, NULL, @@ -1144,7 +1146,7 @@ static void test_new_screen_buffer_color_attributes(HANDLE hConOut) ok(csbi2.wPopupAttributes == orig_attr, "Popup Attributes should match Character Attributes\n");
csbi.wPopupAttributes = orig_popup; - ret = SetConsoleScreenBufferInfoEx(hConOut, &csbi); + ret = pSetConsoleScreenBufferInfoEx(hConOut, &csbi); ok(ret, "SetConsoleScreenBufferInfoEx failed: error %lu\n", GetLastError()); }
@@ -4201,13 +4203,9 @@ static void test_FreeConsole(void) static void test_SetConsoleScreenBufferInfoEx(HANDLE std_output) { BOOL ret; - HANDLE hmod; HANDLE std_input = CreateFileA("CONIN$", GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0); - BOOL (WINAPI *pSetConsoleScreenBufferInfoEx)(HANDLE, CONSOLE_SCREEN_BUFFER_INFOEX *); CONSOLE_SCREEN_BUFFER_INFOEX info;
- hmod = GetModuleHandleA("kernel32.dll"); - pSetConsoleScreenBufferInfoEx = (void *)GetProcAddress(hmod, "SetConsoleScreenBufferInfoEx"); if (!pGetConsoleScreenBufferInfoEx || !pSetConsoleScreenBufferInfoEx) { win_skip("GetConsoleScreenBufferInfoEx or SetConsoleScreenBufferInfoEx not available.\n");
From: Hugh McMaster hugh.mcmaster@outlook.com
--- dlls/kernel32/tests/console.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index 2a071900f3c..c7f2218e051 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -40,6 +40,8 @@ static HANDLE (WINAPI *pOpenConsoleW)(LPCWSTR,DWORD,BOOL,DWORD); static BOOL (WINAPI *pSetConsoleInputExeNameA)(LPCSTR); static BOOL (WINAPI *pSetConsoleScreenBufferInfoEx)(HANDLE, CONSOLE_SCREEN_BUFFER_INFOEX *); static BOOL (WINAPI *pSetCurrentConsoleFontEx)(HANDLE, BOOL, CONSOLE_FONT_INFOEX *); +static BOOL (WINAPI *pUpdateProcThreadAttribute)(struct _PROC_THREAD_ATTRIBUTE_LIST *, DWORD, + DWORD_PTR, void *, SIZE_T, void *, SIZE_T *); static BOOL (WINAPI *pVerifyConsoleIoHandle)(HANDLE handle);
static BOOL skip_nt; @@ -92,6 +94,7 @@ static void init_function_pointers(void) KERNEL32_GET_PROC(SetConsoleInputExeNameA); KERNEL32_GET_PROC(SetConsoleScreenBufferInfoEx); KERNEL32_GET_PROC(SetCurrentConsoleFontEx); + KERNEL32_GET_PROC(UpdateProcThreadAttribute); KERNEL32_GET_PROC(VerifyConsoleIoHandle);
#undef KERNEL32_GET_PROC @@ -4743,9 +4746,9 @@ static void test_pseudo_console(void) BOOL ret; HRESULT hres;
- if (!pCreatePseudoConsole) + if (!pCreatePseudoConsole || !pUpdateProcThreadAttribute) { - win_skip("CreatePseudoConsole not available\n"); + win_skip("CreatePseudoConsole or UpdateProcThreadAttribute not available.\n"); return; }
@@ -4779,7 +4782,7 @@ static void test_pseudo_console(void) InitializeProcThreadAttributeList(NULL, 1, 0, &attr_size); startup.lpAttributeList = HeapAlloc(GetProcessHeap(), 0, attr_size); InitializeProcThreadAttributeList(startup.lpAttributeList, 1, 0, &attr_size); - UpdateProcThreadAttribute(startup.lpAttributeList, 0, PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE, pseudo_console, + pUpdateProcThreadAttribute(startup.lpAttributeList, 0, PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE, pseudo_console, sizeof(pseudo_console), NULL, NULL);
winetest_get_mainargs(&argv);
From: Hugh McMaster hugh.mcmaster@outlook.com
--- dlls/kernel32/tests/console.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index c7f2218e051..001518907d8 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -36,6 +36,7 @@ static DWORD (WINAPI *pGetConsoleOriginalTitleW)(LPWSTR, DWORD); static DWORD (WINAPI *pGetConsoleProcessList)(LPDWORD, DWORD); static BOOL (WINAPI *pGetConsoleScreenBufferInfoEx)(HANDLE, CONSOLE_SCREEN_BUFFER_INFOEX *); static BOOL (WINAPI *pGetCurrentConsoleFontEx)(HANDLE, BOOL, CONSOLE_FONT_INFOEX *); +static BOOL (WINAPI *pInitializeProcThreadAttributeList)(struct _PROC_THREAD_ATTRIBUTE_LIST *, DWORD, DWORD, SIZE_T *); static HANDLE (WINAPI *pOpenConsoleW)(LPCWSTR,DWORD,BOOL,DWORD); static BOOL (WINAPI *pSetConsoleInputExeNameA)(LPCSTR); static BOOL (WINAPI *pSetConsoleScreenBufferInfoEx)(HANDLE, CONSOLE_SCREEN_BUFFER_INFOEX *); @@ -90,6 +91,7 @@ static void init_function_pointers(void) KERNEL32_GET_PROC(GetConsoleProcessList); KERNEL32_GET_PROC(GetConsoleScreenBufferInfoEx); KERNEL32_GET_PROC(GetCurrentConsoleFontEx); + KERNEL32_GET_PROC(InitializeProcThreadAttributeList); KERNEL32_GET_PROC(OpenConsoleW); KERNEL32_GET_PROC(SetConsoleInputExeNameA); KERNEL32_GET_PROC(SetConsoleScreenBufferInfoEx); @@ -4746,9 +4748,9 @@ static void test_pseudo_console(void) BOOL ret; HRESULT hres;
- if (!pCreatePseudoConsole || !pUpdateProcThreadAttribute) + if (!pCreatePseudoConsole || !pInitializeProcThreadAttributeList || !pUpdateProcThreadAttribute) { - win_skip("CreatePseudoConsole or UpdateProcThreadAttribute not available.\n"); + win_skip("CreatePseudoConsole, InitializeProcThreadAttributeList or UpdateProcThreadAttribute not available.\n"); return; }
@@ -4779,9 +4781,9 @@ static void test_pseudo_console(void) ok(hres == S_OK, "CreatePseudoConsole failed: %08lx\n", hres); CloseHandle(console_pipe2);
- InitializeProcThreadAttributeList(NULL, 1, 0, &attr_size); + pInitializeProcThreadAttributeList(NULL, 1, 0, &attr_size); startup.lpAttributeList = HeapAlloc(GetProcessHeap(), 0, attr_size); - InitializeProcThreadAttributeList(startup.lpAttributeList, 1, 0, &attr_size); + pInitializeProcThreadAttributeList(startup.lpAttributeList, 1, 0, &attr_size); pUpdateProcThreadAttribute(startup.lpAttributeList, 0, PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE, pseudo_console, sizeof(pseudo_console), NULL, NULL);