From 4d930e07e8431bcf0f0e7b0504ea10d6655fdab8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Fri, 12 Feb 2016 15:10:59 +0000 Subject: [PATCH] [ROSTESTS]: Add "sysicon" test back, and augment it. svn path=/trunk/; revision=70710 --- rostests/CMakeLists.txt | 2 +- rostests/win32/CMakeLists.txt | 1 + rostests/win32/user32/CMakeLists.txt | 1 + rostests/win32/user32/sysicon/CMakeLists.txt | 10 + rostests/win32/user32/sysicon/sysicon.c | 276 +++++++++++-------- rostests/win32/user32/sysicon/sysicon.ico | Bin 0 -> 22486 bytes 6 files changed, 167 insertions(+), 123 deletions(-) create mode 100644 rostests/win32/user32/CMakeLists.txt create mode 100644 rostests/win32/user32/sysicon/CMakeLists.txt create mode 100644 rostests/win32/user32/sysicon/sysicon.ico diff --git a/rostests/CMakeLists.txt b/rostests/CMakeLists.txt index 033ec828f84..186a50aa639 100644 --- a/rostests/CMakeLists.txt +++ b/rostests/CMakeLists.txt @@ -13,7 +13,7 @@ add_subdirectory(kmtests) #add_subdirectory(regtests) add_subdirectory(rosautotest) add_subdirectory(tests) -#add_subdirectory(win32) +add_subdirectory(win32) add_subdirectory(winetests) diff --git a/rostests/win32/CMakeLists.txt b/rostests/win32/CMakeLists.txt index 3a70c221bb6..512f6adae6c 100644 --- a/rostests/win32/CMakeLists.txt +++ b/rostests/win32/CMakeLists.txt @@ -1 +1,2 @@ add_subdirectory(kernel32) +add_subdirectory(user32) diff --git a/rostests/win32/user32/CMakeLists.txt b/rostests/win32/user32/CMakeLists.txt new file mode 100644 index 00000000000..ae7ed50b9a2 --- /dev/null +++ b/rostests/win32/user32/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(sysicon) diff --git a/rostests/win32/user32/sysicon/CMakeLists.txt b/rostests/win32/user32/sysicon/CMakeLists.txt new file mode 100644 index 00000000000..25741349108 --- /dev/null +++ b/rostests/win32/user32/sysicon/CMakeLists.txt @@ -0,0 +1,10 @@ + +list(APPEND SOURCE + sysicon.c + sysicon.rc) + +add_executable(sysicon ${SOURCE}) +target_link_libraries(sysicon ${PSEH_LIB}) +set_module_type(sysicon win32gui UNICODE) +add_importlibs(sysicon gdi32 user32 msvcrt kernel32) +add_cd_file(TARGET sysicon DESTINATION reactos/bin FOR all) diff --git a/rostests/win32/user32/sysicon/sysicon.c b/rostests/win32/user32/sysicon/sysicon.c index 0e74fbbcbd5..6271a6af02d 100644 --- a/rostests/win32/user32/sysicon/sysicon.c +++ b/rostests/win32/user32/sysicon/sysicon.c @@ -21,143 +21,175 @@ * about WS_EX_DLGMODALFRAME and WS_EX_TOOLWINDOW */ -#include "windows.h" -#include "stdio.h" -#include "resource.h" +#include +#include WCHAR WndClass[] = L"sysicon_class"; +HICON hIcon = NULL, hIconSm = NULL; LRESULT CALLBACK WndProc(HWND hWnd, - UINT msg, - WPARAM wParam, - LPARAM lParam) + UINT msg, + WPARAM wParam, + LPARAM lParam) { - - switch (msg) - { - - case WM_PAINT: + switch (msg) { - HDC hDc; - PAINTSTRUCT Ps; - RECT Rect; - GetClientRect(hWnd, &Rect); + case WM_PAINT: + { + HDC hDc; + PAINTSTRUCT Ps; + RECT Rect; + GetClientRect(hWnd, &Rect); - Rect.left = 10; - Rect.top = 10; - Rect.right-=10; - Rect.bottom = 25; + Rect.left = 10; + Rect.top = 10; + Rect.right -= 10; + Rect.bottom = 25; - hDc = BeginPaint(hWnd, &Ps); - SetBkMode( hDc, TRANSPARENT ); + hDc = BeginPaint(hWnd, &Ps); + SetBkMode(hDc, TRANSPARENT); - DrawCaption(hWnd, hDc, &Rect, DC_GRADIENT | DC_ACTIVE | DC_TEXT | DC_ICON); + DrawCaption(hWnd, hDc, &Rect, DC_GRADIENT | DC_ACTIVE | DC_TEXT | DC_ICON); - EndPaint(hWnd, &Ps); + EndPaint(hWnd, &Ps); - return 0; - } + return 0; + } - case WM_DESTROY: - PostQuitMessage(0); - return 0; - } + case WM_DESTROY: + PostQuitMessage(0); + return 0; + } - return DefWindowProc(hWnd, msg, wParam, lParam); + return DefWindowProcW(hWnd, msg, wParam, lParam); } int APIENTRY wWinMain(HINSTANCE hInst, - HINSTANCE hPrevInstance, - LPWSTR lpCmdLine, - int nCmdShow) + HINSTANCE hPrevInstance, + LPWSTR lpCmdLine, + int nCmdShow) { - HWND hWnd1, hWnd2, hWnd3; - MSG msg; - WNDCLASSEX wcx; - UINT result; - - memset(&wcx, 0, sizeof(wcx)); - wcx.cbSize = sizeof(wcx); - wcx.lpfnWndProc = (WNDPROC) WndProc; - wcx.hInstance = hInst; - wcx.hbrBackground = (HBRUSH)COLOR_WINDOW; - wcx.lpszClassName = WndClass; - - if(!(result = RegisterClassEx(&wcx))) - { - return 1; - } - - /* WS_EX_DLGMODALFRAME */ - hWnd1 = CreateWindowEx(WS_EX_DLGMODALFRAME, - WndClass, - L"WS_SYSMENU | WS_EX_DLGMODALFRAME", - WS_CAPTION | WS_SYSMENU , - CW_USEDEFAULT, - CW_USEDEFAULT, - 400, - 100, - NULL, - 0, - hInst, - NULL); - - if(!hWnd1) - { - return 1; - } - - ShowWindow(hWnd1, SW_SHOW); - UpdateWindow(hWnd1); - - hWnd2 = CreateWindowEx(WS_EX_TOOLWINDOW, - WndClass, - L"WS_SYSMENU | WS_EX_TOOLWINDOW", - WS_CAPTION | WS_SYSMENU , - CW_USEDEFAULT, - CW_USEDEFAULT, - 400, - 100, - NULL, - 0, - hInst, - NULL); - - if(!hWnd2) - { - return 1; - } - - ShowWindow(hWnd2, SW_SHOW); - UpdateWindow(hWnd2); - - hWnd3 = CreateWindowEx(0, - WndClass, - L"WS_SYSMENU ", - WS_CAPTION | WS_SYSMENU , - CW_USEDEFAULT, - CW_USEDEFAULT, - 400, - 100, - NULL, - 0, - hInst, - NULL); - - if(!hWnd3) - { - return 1; - } - - ShowWindow(hWnd3, SW_SHOW); - UpdateWindow(hWnd3); - - while(GetMessage(&msg, NULL, 0, 0 )) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - UnregisterClass(WndClass, hInst); - return 0; + HWND hWnd1a, hWnd1b, hWnd2a, hWnd2b, hWnd3a, hWnd3b; + MSG msg; + WNDCLASSEXW wcx; + UINT result; + + memset(&wcx, 0, sizeof(wcx)); + wcx.cbSize = sizeof(wcx); + wcx.lpfnWndProc = (WNDPROC) WndProc; + wcx.hInstance = hInst; + wcx.hbrBackground = (HBRUSH)COLOR_WINDOW; + wcx.lpszClassName = WndClass; + + if (!(result = RegisterClassExW(&wcx))) + return 1; + + /* Load the user icons */ + hIcon = (HICON)LoadImageW(hInst, MAKEINTRESOURCEW(100), IMAGE_ICON, 0, 0, LR_SHARED | LR_DEFAULTSIZE); + hIconSm = (HICON)CopyImage(hIcon, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_COPYFROMRESOURCE); + + /* WS_EX_DLGMODALFRAME */ + hWnd1a = CreateWindowExW(WS_EX_DLGMODALFRAME, + WndClass, + L"WS_SYSMENU | WS_EX_DLGMODALFRAME without user icon", + WS_CAPTION | WS_SYSMENU , + CW_USEDEFAULT, CW_USEDEFAULT, + 400, 100, + NULL, 0, + hInst, NULL); + if (!hWnd1a) + return 1; + + ShowWindow(hWnd1a, SW_SHOW); + UpdateWindow(hWnd1a); + + /* WS_EX_DLGMODALFRAME */ + hWnd1b = CreateWindowExW(WS_EX_DLGMODALFRAME, + WndClass, + L"WS_SYSMENU | WS_EX_DLGMODALFRAME with user icon", + WS_CAPTION | WS_SYSMENU , + CW_USEDEFAULT, CW_USEDEFAULT, + 400, 100, + NULL, 0, + hInst, NULL); + + if (!hWnd1b) + return 1; + + ShowWindow(hWnd1b, SW_SHOW); + UpdateWindow(hWnd1b); + SendMessageW(hWnd1b, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm); + SendMessageW(hWnd1b, WM_SETICON, ICON_BIG, (LPARAM)hIcon); + + hWnd2a = CreateWindowExW(WS_EX_TOOLWINDOW, + WndClass, + L"WS_SYSMENU | WS_EX_TOOLWINDOW without user icon", + WS_CAPTION | WS_SYSMENU , + CW_USEDEFAULT, CW_USEDEFAULT, + 400, 100, + NULL, 0, + hInst, NULL); + if (!hWnd2a) + return 1; + + ShowWindow(hWnd2a, SW_SHOW); + UpdateWindow(hWnd2a); + + hWnd2b = CreateWindowExW(WS_EX_TOOLWINDOW, + WndClass, + L"WS_SYSMENU | WS_EX_TOOLWINDOW with user icon", + WS_CAPTION | WS_SYSMENU , + CW_USEDEFAULT, CW_USEDEFAULT, + 400, 100, + NULL, 0, + hInst, NULL); + if (!hWnd2b) + return 1; + + ShowWindow(hWnd2b, SW_SHOW); + UpdateWindow(hWnd2b); + SendMessageW(hWnd2b, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm); + SendMessageW(hWnd2b, WM_SETICON, ICON_BIG, (LPARAM)hIcon); + + hWnd3a = CreateWindowExW(0, + WndClass, + L"WS_SYSMENU without user icon", + WS_CAPTION | WS_SYSMENU, + CW_USEDEFAULT, CW_USEDEFAULT, + 400, 100, + NULL, 0, + hInst, NULL); + if (!hWnd3a) + return 1; + + ShowWindow(hWnd3a, SW_SHOW); + UpdateWindow(hWnd3a); + + hWnd3b = CreateWindowExW(0, + WndClass, + L"WS_SYSMENU with user icon", + WS_CAPTION | WS_SYSMENU, + CW_USEDEFAULT, CW_USEDEFAULT, + 400, 100, + NULL, 0, + hInst, NULL); + if (!hWnd3b) + return 1; + + ShowWindow(hWnd3b, SW_SHOW); + UpdateWindow(hWnd3b); + SendMessageW(hWnd3b, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm); + SendMessageW(hWnd3b, WM_SETICON, ICON_BIG, (LPARAM)hIcon); + + while(GetMessageW(&msg, NULL, 0, 0 )) + { + TranslateMessage(&msg); + DispatchMessageW(&msg); + } + + if (hIcon) DestroyIcon(hIcon); + if (hIconSm) DestroyIcon(hIconSm); + + UnregisterClassW(WndClass, hInst); + return 0; } diff --git a/rostests/win32/user32/sysicon/sysicon.ico b/rostests/win32/user32/sysicon/sysicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..2c32fdf002289cca3985489800a06f2224f4dc21 GIT binary patch literal 22486 zcmeI4yRXzn6o=1!ao-Ov+(beo+7J?jDnzd6u5OQn6j77PqR6A93DQ>7c?roKMG}!B z4M_PDD1vLKsE|NHkpdl3iph7zJASS0_3nCiy<%rM9?#4_<`dm4d0^^$KR2gt0LciDe@V0 zqC&ocRF8)4mW`szQgUyMk#4suL{OItyf!9ZGs)<74Of0PCZ~H_Uc7iAVHnE8hYuwP z0`Yxcu3o(=p6AKAbLZsRH6uUE6EXjU^61IG^5o@9`QeX05%#E4tq!12M3cyfN1jKX zr+MgA7N30T6`y>ce4l(33&;=1N3R6r2jmk;NPb9uNIuvkB;SxWq)lk6H7N9`+@m57 zAy4g6^JTQ1*@W5bUg24lW2L=xe9vCciFnD0_z~F(w1A~VG z4;&siJd49b=2;{@_xKMiK3J^DVDVAzqsXUHA1u}l6sn(nu=rrHZUKi64qw{<96mU# ztH9xd!3Tp626dee4j&9Y7(%t1t92oIq91ANUiA*B&>g^KU5)MlOaV#*6a-)j&>c{y z?H`~!K(}oUtDAiE2j~ybuT2!7KfpHu7y>W^^e=5Tyke~ z!GOVl!GOVl!GOVbCoqIyFkmoX2*E%#5d2^;U@%}XV4!Mn-MS@r?%a{PckjyM$B*T~g9q~T=~H?3?3p}&{#;(Y zdL?h(ypgwW-^%O%jQo1l<~#sZ%k3ErB%u=GLIFv60~)D3Ish-l+;(TYdbM0!940du3r~r;xu?pp1WMzbNeO zmGTz~RPi62&WHW|O8!29LHviy>2Uh=K>mzC9sV;z(a})&;XkU6|4bBW`=`f$rk+0!lTfRD6ZXTy!TsSN8wU2zEc?Mhb$?#! z50%eXKl{>B`SZA297@NBV)otL;_+m=JQR*^t;EvoTNa&jV9u3VAs_hzwAWlyr$r!MxX zE#IfI?_6VNxX#{fX=!tFD>ohJzBE&wW9TnWHc(nsL3zwjRvvATc6Lh3Ekji~r+ut`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