diff --git a/reactos/apps/tests/accelerator/.cvsignore b/reactos/apps/tests/accelerator/.cvsignore deleted file mode 100644 index e24713815a0..00000000000 --- a/reactos/apps/tests/accelerator/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map \ No newline at end of file diff --git a/reactos/apps/tests/accelerator/Makefile b/reactos/apps/tests/accelerator/Makefile deleted file mode 100644 index 2ea8d4f1e50..00000000000 --- a/reactos/apps/tests/accelerator/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = accelerator - -#TARGET_SDKLIBS = kernel32.a user32.a - -TARGET_OBJECTS = accelerator.o - -TARGET_CFLAGS = -Wall -Werror - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk diff --git a/reactos/apps/tests/accelerator/accelerator.c b/reactos/apps/tests/accelerator/accelerator.c deleted file mode 100644 index 0b7aca65ef1..00000000000 --- a/reactos/apps/tests/accelerator/accelerator.c +++ /dev/null @@ -1,161 +0,0 @@ -#include -#include -#include - -#define ID_ACCEL1 0x100 -#define ID_ACCEL2 0x101 -#define ID_ACCEL3 0x102 -#define ID_ACCEL4 0x103 - -/* - * {fVirt, key, cmd} - * fVirt |= FVIRTKEY | FCONTROL | FALT | FSHIFT - */ -//static HFONT tf; -static ACCEL Accelerators[4] = { - { FVIRTKEY, VK_A, ID_ACCEL1}, - { FVIRTKEY | FSHIFT, VK_A, ID_ACCEL2}, - { FVIRTKEY | FCONTROL, VK_A, ID_ACCEL3}, - { FVIRTKEY | FALT, VK_A, ID_ACCEL4}}; -static HACCEL hAcceleratorTable; -static char Event[200]; - -LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM); - -int WINAPI -WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpszCmdLine, - int nCmdShow) -{ - WNDCLASS wc; - MSG msg; - HWND hWnd; - - wc.lpszClassName = "AcceleratorTest"; - wc.lpfnWndProc = MainWndProc; - wc.style = CS_VREDRAW | CS_HREDRAW; - wc.hInstance = hInstance; - wc.hIcon = LoadIcon(NULL, (LPCTSTR)IDI_APPLICATION); - wc.hCursor = LoadCursor(NULL, (LPCTSTR)IDC_ARROW); - wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH); - wc.lpszMenuName = NULL; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - if (RegisterClass(&wc) == 0) - { - fprintf(stderr, "RegisterClass failed (last error 0x%lX)\n", - GetLastError()); - return(1); - } - - hWnd = CreateWindow("AcceleratorTest", - "Accelerator Test", - WS_OVERLAPPEDWINDOW, - 0, - 0, - CW_USEDEFAULT, - CW_USEDEFAULT, - NULL, - NULL, - hInstance, - NULL); - if (hWnd == NULL) - { - fprintf(stderr, "CreateWindow failed (last error 0x%lX)\n", - GetLastError()); - return(1); - } - - /*tf = CreateFontA(14, 0, 0, TA_BASELINE, FW_NORMAL, FALSE, FALSE, FALSE, - ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, - DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, "Timmons");*/ - - Event[0] = 0; - - ShowWindow(hWnd, nCmdShow); - - hAcceleratorTable = CreateAcceleratorTable(Accelerators, - sizeof(Accelerators)/sizeof(Accelerators[1])); - if (hAcceleratorTable == NULL) - { - fprintf(stderr, "CreateAcceleratorTable failed (last error 0x%lX)\n", - GetLastError()); - return(1); - } - - while(GetMessage(&msg, NULL, 0, 0)) - { - if (!TranslateAccelerator(hWnd, hAcceleratorTable, &msg)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } - - if (!DestroyAcceleratorTable(hAcceleratorTable)) - { - fprintf(stderr, "DestroyAcceleratorTable failed (last error 0x%lX)\n", - GetLastError()); - return(1); - } - - //DeleteObject(tf); - - return msg.wParam; -} - -LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - PAINTSTRUCT ps; - HDC hDC; - char buf[200]; - - switch(msg) - { - case WM_PAINT: - hDC = BeginPaint(hWnd, &ps); - //SelectObject(hDC, tf); - sprintf(buf, "Event: '%s'", Event); - TextOut(hDC, 10, 10, buf, strlen(buf)); - EndPaint(hWnd, &ps); - break; - - case WM_DESTROY: - PostQuitMessage(0); - break; - - case WM_COMMAND: - - switch (LOWORD(wParam)) - { - case ID_ACCEL1: - strcpy(Event, "A"); - break; - - case ID_ACCEL2: - strcpy(Event, "SHIFT+A"); - break; - - case ID_ACCEL3: - strcpy(Event, "CTRL+A"); - break; - - case ID_ACCEL4: - strcpy(Event, "ALT+A"); - break; - - default: - sprintf(Event, "%d", LOWORD(wParam)); - break; - } - - InvalidateRect(hWnd, NULL, TRUE); - UpdateWindow(hWnd); - break; - - default: - return DefWindowProc(hWnd, msg, wParam, lParam); - } - return 0; -} diff --git a/reactos/apps/tests/advapi32/.cvsignore b/reactos/apps/tests/advapi32/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/advapi32/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/advapi32/crypt.c b/reactos/apps/tests/advapi32/crypt.c deleted file mode 100644 index 6b2437d90de..00000000000 --- a/reactos/apps/tests/advapi32/crypt.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Unit tests for crypt functions - * - * Copyright (c) 2004 Michael Jung - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -#include "wine/test.h" -#include "windef.h" -#include "winbase.h" -#include "wincrypt.h" -#include "winerror.h" - -static const char szRsaBaseProv[] = MS_DEF_PROV_A; -static const char szNonExistentProv[] = "Wine Non Existent Cryptographic Provider v11.2"; -static const char szKeySet[] = "wine_test_keyset"; -static const char szBadKeySet[] = "wine_test_bad_keyset"; -#define NON_DEF_PROV_TYPE 999 - -static void init_environment(void) -{ - HCRYPTPROV hProv; - - /* Ensure that container "wine_test_keyset" does exist */ - if (!CryptAcquireContext(&hProv, szKeySet, szRsaBaseProv, PROV_RSA_FULL, 0)) - { - CryptAcquireContext(&hProv, szKeySet, szRsaBaseProv, PROV_RSA_FULL, CRYPT_NEWKEYSET); - } - CryptReleaseContext(hProv, 0); - - /* Ensure that container "wine_test_keyset" does exist in default PROV_RSA_FULL type provider */ - if (!CryptAcquireContext(&hProv, szKeySet, NULL, PROV_RSA_FULL, 0)) - { - CryptAcquireContext(&hProv, szKeySet, NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET); - } - CryptReleaseContext(hProv, 0); - - /* Ensure that container "wine_test_bad_keyset" does not exist. */ - if (CryptAcquireContext(&hProv, szBadKeySet, szRsaBaseProv, PROV_RSA_FULL, 0)) - { - CryptReleaseContext(hProv, 0); - CryptAcquireContext(&hProv, szBadKeySet, szRsaBaseProv, PROV_RSA_FULL, CRYPT_DELETEKEYSET); - } -} - -static void clean_up_environment(void) -{ - HCRYPTPROV hProv; - - /* Remove container "wine_test_keyset" */ - if (CryptAcquireContext(&hProv, szKeySet, szRsaBaseProv, PROV_RSA_FULL, 0)) - { - CryptReleaseContext(hProv, 0); - CryptAcquireContext(&hProv, szKeySet, szRsaBaseProv, PROV_RSA_FULL, CRYPT_DELETEKEYSET); - } - - /* Remove container "wine_test_keyset" from default PROV_RSA_FULL type provider */ - if (CryptAcquireContext(&hProv, szKeySet, NULL, PROV_RSA_FULL, 0)) - { - CryptReleaseContext(hProv, 0); - CryptAcquireContext(&hProv, szKeySet, NULL, PROV_RSA_FULL, CRYPT_DELETEKEYSET); - } -} - -static void test_acquire_context(void) -{ - BOOL result; - HCRYPTPROV hProv; - - /* Provoke all kinds of error conditions (which are easy to provoke). - * The order of the error tests seems to match Windows XP's rsaenh.dll CSP, - * but since this is likely to change between CSP versions, we don't check - * this. Please don't change the order of tests. */ - result = CryptAcquireContext(&hProv, NULL, NULL, 0, 0); - ok(!result && GetLastError()==NTE_BAD_PROV_TYPE, "%08x\n", (unsigned int)GetLastError()); - - result = CryptAcquireContext(&hProv, NULL, NULL, 1000, 0); - ok(!result && GetLastError()==NTE_BAD_PROV_TYPE, "%08x\n", (unsigned int)GetLastError()); - - result = CryptAcquireContext(&hProv, NULL, NULL, NON_DEF_PROV_TYPE, 0); - ok(!result && GetLastError()==NTE_PROV_TYPE_NOT_DEF, "%08x\n", (unsigned int)GetLastError()); - - result = CryptAcquireContext(&hProv, szKeySet, szNonExistentProv, PROV_RSA_FULL, 0); - ok(!result && GetLastError()==NTE_KEYSET_NOT_DEF, "%08x\n", (unsigned int)GetLastError()); - - result = CryptAcquireContext(&hProv, szKeySet, szRsaBaseProv, NON_DEF_PROV_TYPE, 0); - ok(!result && GetLastError()==NTE_PROV_TYPE_NO_MATCH, "%08x\n", (unsigned int)GetLastError()); - - result = CryptAcquireContext(NULL, szKeySet, szRsaBaseProv, PROV_RSA_FULL, 0); - ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "%08x\n", (unsigned int)GetLastError()); - - /* Last not least, try to really acquire a context. */ - result = CryptAcquireContext(&hProv, szKeySet, szRsaBaseProv, PROV_RSA_FULL, 0); - ok(result, "%08x\n", (unsigned int)GetLastError()); - - if (GetLastError() == ERROR_SUCCESS) - CryptReleaseContext(hProv, 0); - - /* Try again, witch an empty ("\0") szProvider parameter */ - result = CryptAcquireContext(&hProv, szKeySet, "", PROV_RSA_FULL, 0); - ok(result, "%08x\n", (unsigned int)GetLastError()); - - if (GetLastError() == ERROR_SUCCESS) - CryptReleaseContext(hProv, 0); -} - -START_TEST(crypt) -{ - init_environment(); - test_acquire_context(); - clean_up_environment(); -} diff --git a/reactos/apps/tests/advapi32/makefile b/reactos/apps/tests/advapi32/makefile deleted file mode 100644 index c30eb3d5602..00000000000 --- a/reactos/apps/tests/advapi32/makefile +++ /dev/null @@ -1,26 +0,0 @@ -# $Id: makefile,v 1.1 2004/08/07 22:51:27 sedwards Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -# require os code to explicitly request A/W version of structs/functions -TARGET_CFLAGS += -D_DISABLE_TIDENTS -D__USE_W32API - -TARGET_NAME = advapi32_test - -TARGET_SDKLIBS = advapi32.a - -TARGET_OBJECTS = \ - testlist.o \ - registry.o - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/advapi32/registry.c b/reactos/apps/tests/advapi32/registry.c deleted file mode 100644 index d91acad29ec..00000000000 --- a/reactos/apps/tests/advapi32/registry.c +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Unit tests for registry functions - * - * Copyright (c) 2002 Alexandre Julliard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include "wine/test.h" -#include "windef.h" -#include "winbase.h" -#include "winreg.h" -#include "winerror.h" - -static HKEY hkey_main; - -/* delete key and all its subkeys */ -static DWORD delete_key( HKEY hkey ) -{ - char name[MAX_PATH]; - DWORD ret; - - while (!(ret = RegEnumKeyA(hkey, 0, name, sizeof(name)))) - { - HKEY tmp; - if (!(ret = RegOpenKeyExA( hkey, name, 0, KEY_ENUMERATE_SUB_KEYS, &tmp ))) - { - ret = delete_key( tmp ); - RegCloseKey( tmp ); - } - if (ret) break; - } - if (ret != ERROR_NO_MORE_ITEMS) return ret; - RegDeleteKeyA( hkey, NULL ); - return 0; -} - -static void setup_main_key(void) -{ - if (RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Test", &hkey_main )) delete_key( hkey_main ); - - assert (!RegCreateKeyExA( HKEY_CURRENT_USER, "Software\\Wine\\Test", 0, NULL, - REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey_main, NULL )); -} - -static void test_enum_value(void) -{ - DWORD res; - char value[20], data[20]; - WCHAR valueW[20], dataW[20]; - DWORD val_count, data_count, type; - static const WCHAR foobarW[] = {'f','o','o','b','a','r',0}; - static const WCHAR testW[] = {'T','e','s','t',0}; - static const WCHAR xxxW[] = {'x','x','x','x','x','x','x','x',0}; - - /* check NULL data with zero length */ - res = RegSetValueExA( hkey_main, "Test", 0, REG_SZ, NULL, 0 ); - if (GetVersion() & 0x80000000) - ok( res == ERROR_INVALID_PARAMETER, "RegSetValueExA returned %ld\n", res ); - else - ok( !res, "RegSetValueExA returned %ld\n", res ); - res = RegSetValueExA( hkey_main, "Test", 0, REG_EXPAND_SZ, NULL, 0 ); - ok( !res, "RegSetValueExA returned %ld\n", res ); - res = RegSetValueExA( hkey_main, "Test", 0, REG_BINARY, NULL, 0 ); - ok( !res, "RegSetValueExA returned %ld\n", res ); - - res = RegSetValueExA( hkey_main, "Test", 0, REG_SZ, (BYTE *)"foobar", 7 ); - ok( res == 0, "RegSetValueExA failed error %ld\n", res ); - - /* overflow both name and data */ - val_count = 2; - data_count = 2; - type = 1234; - strcpy( value, "xxxxxxxxxx" ); - strcpy( data, "xxxxxxxxxx" ); - res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count ); - ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); - ok( val_count == 2, "val_count set to %ld\n", val_count ); - ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count ); - ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); - ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'\n", value ); - ok( !strcmp( data, "xxxxxxxxxx" ), "data set to '%s'\n", data ); - - /* overflow name */ - val_count = 3; - data_count = 20; - type = 1234; - strcpy( value, "xxxxxxxxxx" ); - strcpy( data, "xxxxxxxxxx" ); - res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count ); - ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); - /* Win9x returns 2 as specified by MSDN but NT returns 3... */ - ok( val_count == 2 || val_count == 3, "val_count set to %ld\n", val_count ); - ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count ); - ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); -#if 0 - /* v5.1.2600.0 (XP Home) does not touch value or data in this case */ - ok( !strcmp( value, "Te" ), "value set to '%s' instead of 'Te'\n", value ); - ok( !strcmp( data, "foobar" ), "data set to '%s' instead of 'foobar'\n", data ); -#endif - - /* overflow empty name */ - val_count = 0; - data_count = 20; - type = 1234; - strcpy( value, "xxxxxxxxxx" ); - strcpy( data, "xxxxxxxxxx" ); - res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count ); - ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); - ok( val_count == 0, "val_count set to %ld\n", val_count ); - ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count ); - ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); - ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'\n", value ); -#if 0 - /* v5.1.2600.0 (XP Home) does not touch data in this case */ - ok( !strcmp( data, "foobar" ), "data set to '%s' instead of 'foobar'\n", data ); -#endif - - /* overflow data */ - val_count = 20; - data_count = 2; - type = 1234; - strcpy( value, "xxxxxxxxxx" ); - strcpy( data, "xxxxxxxxxx" ); - res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count ); - ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); - ok( val_count == 20, "val_count set to %ld\n", val_count ); - ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count ); - ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); - ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'\n", value ); - ok( !strcmp( data, "xxxxxxxxxx" ), "data set to '%s'\n", data ); - - /* no overflow */ - val_count = 20; - data_count = 20; - type = 1234; - strcpy( value, "xxxxxxxxxx" ); - strcpy( data, "xxxxxxxxxx" ); - res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count ); - ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", res ); - ok( val_count == 4, "val_count set to %ld instead of 4\n", val_count ); - ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count ); - ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); - ok( !strcmp( value, "Test" ), "value is '%s' instead of Test\n", value ); - ok( !strcmp( data, "foobar" ), "data is '%s' instead of foobar\n", data ); - - /* Unicode tests */ - - SetLastError(0); - res = RegSetValueExW( hkey_main, testW, 0, REG_SZ, (BYTE *)foobarW, 7*sizeof(WCHAR) ); - if (res==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) - goto CLEANUP; - ok( res == 0, "RegSetValueExW failed error %ld\n", res ); - - /* overflow both name and data */ - val_count = 2; - data_count = 2; - type = 1234; - memcpy( valueW, xxxW, sizeof(xxxW) ); - memcpy( dataW, xxxW, sizeof(xxxW) ); - res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count ); - ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); - ok( val_count == 2, "val_count set to %ld\n", val_count ); - ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count ); - ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); - ok( !memcmp( valueW, xxxW, sizeof(xxxW) ), "value modified\n" ); - ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified\n" ); - - /* overflow name */ - val_count = 3; - data_count = 20; - type = 1234; - memcpy( valueW, xxxW, sizeof(xxxW) ); - memcpy( dataW, xxxW, sizeof(xxxW) ); - res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count ); - ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); - ok( val_count == 3, "val_count set to %ld\n", val_count ); - ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count ); - ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); - ok( !memcmp( valueW, xxxW, sizeof(xxxW) ), "value modified\n" ); - ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified\n" ); - - /* overflow data */ - val_count = 20; - data_count = 2; - type = 1234; - memcpy( valueW, xxxW, sizeof(xxxW) ); - memcpy( dataW, xxxW, sizeof(xxxW) ); - res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count ); - ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); - ok( val_count == 4, "val_count set to %ld instead of 4\n", val_count ); - ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count ); - ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); - ok( !memcmp( valueW, testW, sizeof(testW) ), "value is not 'Test'\n" ); - ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified\n" ); - - /* no overflow */ - val_count = 20; - data_count = 20; - type = 1234; - memcpy( valueW, xxxW, sizeof(xxxW) ); - memcpy( dataW, xxxW, sizeof(xxxW) ); - res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count ); - ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", res ); - ok( val_count == 4, "val_count set to %ld instead of 4\n", val_count ); - ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count ); - ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); - ok( !memcmp( valueW, testW, sizeof(testW) ), "value is not 'Test'\n" ); - ok( !memcmp( dataW, foobarW, sizeof(foobarW) ), "data is not 'foobar'\n" ); - -CLEANUP: - /* cleanup */ - RegDeleteValueA( hkey_main, "Test" ); -} - -START_TEST(registry) -{ - setup_main_key(); - test_enum_value(); - - /* cleanup */ - delete_key( hkey_main ); -} diff --git a/reactos/apps/tests/advapi32/testlist.c b/reactos/apps/tests/advapi32/testlist.c deleted file mode 100644 index 9d4ad66391f..00000000000 --- a/reactos/apps/tests/advapi32/testlist.c +++ /dev/null @@ -1,25 +0,0 @@ -/* Automatically generated file; DO NOT EDIT!! */ - -/* stdarg.h is needed for Winelib */ -#include -#include -#include -#include "windef.h" -#include "winbase.h" - -extern void func_registry(void); - -struct test -{ - const char *name; - void (*func)(void); -}; - -static const struct test winetest_testlist[] = -{ - { "registry", func_registry }, - { 0, 0 } -}; - -#define WINETEST_WANT_MAIN -#include "wine/test.h" diff --git a/reactos/apps/tests/alive/.cvsignore b/reactos/apps/tests/alive/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/alive/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/alive/Makefile b/reactos/apps/tests/alive/Makefile deleted file mode 100644 index 4681416cced..00000000000 --- a/reactos/apps/tests/alive/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $Id: Makefile,v 1.7 2003/11/14 17:13:14 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = alive - -TARGET_SDKLIBS = kernel32.a user32.a - -TARGET_OBJECTS = $(TARGET_NAME).o - -TARGET_CFLAGS = -Wall -Werror - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/alive/alive.c b/reactos/apps/tests/alive/alive.c deleted file mode 100644 index e79e83a1ad2..00000000000 --- a/reactos/apps/tests/alive/alive.c +++ /dev/null @@ -1,48 +0,0 @@ -/* $Id: alive.c,v 1.2 2001/03/26 21:30:20 ea Exp $ - * - */ -#include -#include - -HANDLE StandardOutput = INVALID_HANDLE_VALUE; -CHAR Message [80]; -DWORD CharactersToWrite = 0; -DWORD WrittenCharacters = 0; -INT d = 0, h = 0, m = 0, s = 0; - -int -main (int argc, char * argv []) -{ - StandardOutput = GetStdHandle (STD_OUTPUT_HANDLE); - if (INVALID_HANDLE_VALUE == StandardOutput) - { - return (EXIT_FAILURE); - } - while (TRUE) - { - /* Prepare the message and update it */ - CharactersToWrite = - wsprintf ( - Message, - "Alive for %dd %dh %d' %d\" \r", - d, h, m, s - ); - WriteConsole ( - StandardOutput, - Message, - CharactersToWrite, - & WrittenCharacters, - NULL - ); - /* suspend the execution for 1s */ - Sleep (1000); - /* increment seconds */ - ++ s; - if (60 == s) { s = 0; ++ m; } - if (60 == m) { m = 0; ++ h; } - if (24 == h) { h = 0; ++ d; } - } - return (EXIT_SUCCESS); -} - -/* EOF */ diff --git a/reactos/apps/tests/alphablend/.cvsignore b/reactos/apps/tests/alphablend/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/alphablend/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/alphablend/alphablend.c b/reactos/apps/tests/alphablend/alphablend.c deleted file mode 100644 index ee3942d8992..00000000000 --- a/reactos/apps/tests/alphablend/alphablend.c +++ /dev/null @@ -1,213 +0,0 @@ -#include -#include - -#ifndef AC_SRC_ALPHA -#define AC_SRC_ALPHA (0x1) -#endif - -HINSTANCE HInst; -const char* WndClassName = "GMainWnd"; -LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam, - LPARAM LParam); - -WINBOOL -STDCALL -GdiAlphaBlend(HDC hdcDst,LONG DstX,LONG DstY,LONG DstCx,LONG DstCy,HDC hdcSrc,LONG SrcX,LONG SrcY,LONG SrcCx,LONG SrcCy,BLENDFUNCTION BlendFunction); - - -int APIENTRY WinMain(HINSTANCE HInstance, HINSTANCE HPrevInstance, - LPTSTR lpCmdLine, int nCmdShow) -{ - WNDCLASS wc; - MSG msg; - - HInst = HInstance; - - memset(&wc, 0, sizeof(WNDCLASS)); - - wc.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS; - wc.lpfnWndProc = MainWndProc; - wc.hInstance = HInstance; - wc.hCursor = LoadCursor(NULL, (LPCTSTR)IDC_ARROW); - /* wc.hbrBackground = reinterpret_cast(COLOR_BTNFACE + 1); */ - wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); - wc.lpszClassName = WndClassName; - - if (RegisterClass(&wc)) - { - HWND HWnd = - CreateWindow( - WndClassName, TEXT("AlphaBlend Rendering Demo"), - WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION | - WS_VISIBLE | WS_CLIPSIBLINGS, - 0, 0, 320, 430, - NULL, NULL, HInst, NULL - ); - - if (HWnd) - { - ShowWindow(HWnd, nCmdShow); - UpdateWindow(HWnd); - - while (GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } - } - return 0; -} - -/* image related */ -BITMAP bmp; -LPCSTR filename = TEXT("lena.bmp"); -HDC HMemDC = NULL, HMemDC2 = NULL; -HBITMAP HOldBmp = NULL; -PVOID pBmpBits = NULL; -HBITMAP H32BppBitmap = NULL; -BITMAPINFO bmpi; - -BOOL ConvertBitmapTo32Bpp(HDC hDC, BITMAP *bmp) -{ - ZeroMemory(&bmpi, sizeof(BITMAPINFO)); - bmpi.bmiHeader.biSize = sizeof(BITMAPINFO); - bmpi.bmiHeader.biWidth = bmp->bmWidth; - bmpi.bmiHeader.biHeight = bmp->bmHeight; - bmpi.bmiHeader.biPlanes = 1; - bmpi.bmiHeader.biBitCount = 32; - bmpi.bmiHeader.biCompression = BI_RGB; - bmpi.bmiHeader.biSizeImage = 4 * bmpi.bmiHeader.biWidth * bmpi.bmiHeader.biHeight; - H32BppBitmap = CreateDIBSection(hDC, &bmpi, DIB_RGB_COLORS, &pBmpBits, 0, 0); - if(H32BppBitmap) - { - HBITMAP bmpalpha; - SelectObject(hDC, H32BppBitmap); - BitBlt(hDC, 0, 0, bmp->bmWidth, bmp->bmHeight, HMemDC, 0, 0, SRCCOPY); - - /* load and apply alpha channel */ - bmpalpha = LoadImage(HInst, TEXT("lenaalpha.bmp"), IMAGE_BITMAP, - 0, 0, LR_LOADFROMFILE); - if(bmpalpha) - { - COLORREF *col = pBmpBits; - int x, y; - HDC hdcTemp = CreateCompatibleDC(NULL); - if(!hdcTemp) - { - DeleteObject(bmpalpha); - return FALSE; - } - SelectObject(hdcTemp, bmpalpha); - - for(y = 0; y < bmp->bmHeight; y++) - { - for(x = 0; x < bmp->bmWidth; x++) - { - COLORREF Color = (COLORREF)GetRValue(GetPixel(hdcTemp, x, y)) << 24; - *col++ |= Color; - } - } - - DeleteObject(bmpalpha); - DeleteDC(hdcTemp); - return TRUE; - } - return FALSE; - } - return FALSE; -} - -LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam, - LPARAM LParam) -{ - switch (Msg) - { - case WM_CREATE: - { - /* create a memory DC */ - HMemDC = CreateCompatibleDC(NULL); - if (HMemDC) - { - /* load a bitmap from file */ - HBITMAP HBmp = - /* static_cast */( - LoadImage(HInst, filename, IMAGE_BITMAP, - 0, 0, LR_LOADFROMFILE) - ); - if (HBmp) - { - /* extract dimensions of the bitmap */ - GetObject(HBmp, sizeof(BITMAP), &bmp); - - /* associate the bitmap with the memory DC */ - /* HOldBmp = static_cast */ - (SelectObject(HMemDC, HBmp) - ); - HMemDC2 = CreateCompatibleDC(NULL); - if(!ConvertBitmapTo32Bpp(HMemDC2, &bmp)) - { - PostQuitMessage(0); - return 0; - } - } - } - } - case WM_PAINT: - { - PAINTSTRUCT ps; - BLENDFUNCTION BlendFunc; - HDC Hdc = BeginPaint(HWnd, &ps); -#if 0 - try -#endif - { - - BlendFunc.BlendOp = AC_SRC_OVER; - BlendFunc.BlendFlags = 0; - BlendFunc.SourceConstantAlpha = 128; - BlendFunc.AlphaFormat = 0; - - BitBlt(Hdc, 100, 90, - bmp.bmWidth, bmp.bmHeight, - HMemDC2, 0, 0, - SRCCOPY); - GdiAlphaBlend(Hdc, 0, 0, bmp.bmWidth, bmp.bmHeight, - HMemDC2, 0, 0, bmp.bmWidth, bmp.bmHeight, - BlendFunc); - GdiAlphaBlend(Hdc, bmp.bmWidth - 15, 10, bmp.bmWidth / 2, bmp.bmHeight / 2, - HMemDC2, 0, 0, bmp.bmWidth, bmp.bmHeight, - BlendFunc); - - BlendFunc.SourceConstantAlpha = 255; - BlendFunc.AlphaFormat = AC_SRC_ALPHA; - - GdiAlphaBlend(Hdc, 140, 200, bmp.bmWidth, bmp.bmHeight, - HMemDC2, 0, 0, bmp.bmWidth, bmp.bmHeight, - BlendFunc); - GdiAlphaBlend(Hdc, 20, 210, (bmp.bmWidth / 3) * 2, (bmp.bmHeight / 3) * 2, - HMemDC2, 0, 0, bmp.bmWidth, bmp.bmHeight, - BlendFunc); - } -#if 0 - catch (...) - { - EndPaint(HWnd, &ps); - } -#endif - EndPaint(HWnd, &ps); - break; - } - case WM_DESTROY: - { - /* clean up */ - DeleteObject(SelectObject(HMemDC, HOldBmp)); - DeleteDC(HMemDC); - DeleteDC(HMemDC2); - - PostQuitMessage(0); - return 0; - } - } - return DefWindowProc(HWnd, Msg, WParam, LParam); -} diff --git a/reactos/apps/tests/alphablend/lena.bmp b/reactos/apps/tests/alphablend/lena.bmp deleted file mode 100644 index e9916963852..00000000000 Binary files a/reactos/apps/tests/alphablend/lena.bmp and /dev/null differ diff --git a/reactos/apps/tests/alphablend/lenaalpha.bmp b/reactos/apps/tests/alphablend/lenaalpha.bmp deleted file mode 100644 index 71982ce8b06..00000000000 Binary files a/reactos/apps/tests/alphablend/lenaalpha.bmp and /dev/null differ diff --git a/reactos/apps/tests/alphablend/makefile b/reactos/apps/tests/alphablend/makefile deleted file mode 100644 index 9beb3ca2a3c..00000000000 --- a/reactos/apps/tests/alphablend/makefile +++ /dev/null @@ -1,22 +0,0 @@ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = alphablend - -TARGET_SDKLIBS = kernel32.a gdi32.a - -TARGET_OBJECTS = $(TARGET_NAME).o - -TARGET_CFLAGS = -Wall -Werror -D__USE_W32API - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/apc/.cvsignore b/reactos/apps/tests/apc/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/apc/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/apc/apc.c b/reactos/apps/tests/apc/apc.c deleted file mode 100644 index d33da633d69..00000000000 --- a/reactos/apps/tests/apc/apc.c +++ /dev/null @@ -1,94 +0,0 @@ -#include -#include -#include -#include -#include -#include - -HANDLE OutputHandle; -HANDLE InputHandle; - -VOID STDCALL -ApcRoutine(PVOID Context, - PIO_STATUS_BLOCK IoStatus, - ULONG Reserved) -{ - printf("(apc.exe) ApcRoutine(Context %p)\n", Context); -} - - -int main(int argc, char* argv[]) -{ - NTSTATUS Status; - HANDLE FileHandle; - OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING FileName = ROS_STRING_INITIALIZER(L"\\C:\\a.txt"); - IO_STATUS_BLOCK IoStatus; - CHAR Buffer[256]; - HANDLE EventHandle; - LARGE_INTEGER off; - - AllocConsole(); - InputHandle = GetStdHandle(STD_INPUT_HANDLE); - OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE); - - printf("APC test program\n"); - - EventHandle = CreateEventW(NULL, - FALSE, - FALSE, - NULL); - if (EventHandle == INVALID_HANDLE_VALUE) - { - printf("Failed to create event\n"); - return 0; - } - - printf("Opening file\n"); - InitializeObjectAttributes(&ObjectAttributes, - &FileName, - 0, - NULL, - NULL); - - printf("Creating file\n"); - FileHandle = CreateFileW(L"C:\\a.txt", - FILE_GENERIC_READ | FILE_GENERIC_WRITE, - 0, - NULL, - OPEN_EXISTING, - FILE_FLAG_OVERLAPPED, - NULL); - - if (FileHandle == INVALID_HANDLE_VALUE) - { - - printf("Open failed last err 0x%lu\n",GetLastError()); - return 0; - } - - off.QuadPart = 0; - - printf("Reading file\n"); - Status = ZwReadFile(FileHandle, - NULL, - (PIO_APC_ROUTINE)ApcRoutine, - (PVOID) 0xdeadbeef, - &IoStatus, - Buffer, - 256,//len - &off ,//offset must exist if file was opened for asynch. i/o aka. OVERLAPPED - NULL); - - if (!NT_SUCCESS(Status)) - { - printf("Read failed status 0x%lu\n",Status); - } - printf("Waiting\n"); - WaitForSingleObjectEx(EventHandle, INFINITE, TRUE); - printf("Returned from wait\n"); - ZwClose(FileHandle); - printf("Program finished\n"); - return 0; -} - diff --git a/reactos/apps/tests/apc/makefile b/reactos/apps/tests/apc/makefile deleted file mode 100644 index 19cf9c3184a..00000000000 --- a/reactos/apps/tests/apc/makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $Id: makefile,v 1.10 2003/11/14 17:13:14 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = apc - -TARGET_SDKLIBS = ntdll.a kernel32.a - -TARGET_OBJECTS = $(TARGET_NAME).o - -TARGET_CFLAGS = -Wall -Werror - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/apc2/.cvsignore b/reactos/apps/tests/apc2/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/apc2/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/apc2/apc2.c b/reactos/apps/tests/apc2/apc2.c deleted file mode 100644 index ca3699cca58..00000000000 --- a/reactos/apps/tests/apc2/apc2.c +++ /dev/null @@ -1,53 +0,0 @@ - -#include -#include - -VOID CALLBACK TimerApcProc( - LPVOID lpArg, - DWORD dwTimerLowValue, - DWORD dwTimerHighValue ) -{ - printf("APC Callback %lu\n", *(PDWORD)lpArg); -} - - -int main() -{ - HANDLE hTimer; - BOOL bSuccess; - LARGE_INTEGER DueTime; - DWORD value = 1; - - hTimer = CreateWaitableTimer(NULL, FALSE, NULL ); - - if (!hTimer) - { - printf("CreateWaitableTimer failed!\n"); - return 0; - } - - DueTime.QuadPart = -(LONGLONG)(5 * 10000000); - - bSuccess = SetWaitableTimer( - hTimer, - &DueTime, - 2001 /*interval (using an odd number to be able to find it easy in kmode) */, - TimerApcProc, - &value /*callback argument*/, - FALSE ); - - if (!bSuccess) - { - printf("SetWaitableTimer failed!\n"); - return 0; - } - - for (;value <= 10; value++ ) - { - SleepEx(INFINITE, TRUE /*alertable*/ ); - } - - CloseHandle( hTimer ); - return 0; -} - diff --git a/reactos/apps/tests/apc2/makefile b/reactos/apps/tests/apc2/makefile deleted file mode 100644 index 50ea5606cba..00000000000 --- a/reactos/apps/tests/apc2/makefile +++ /dev/null @@ -1,23 +0,0 @@ - - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = apc2 - -TARGET_SDKLIBS = ntdll.a kernel32.a - -TARGET_CFLAGS = -Wall -Werror - -TARGET_OBJECTS = $(TARGET_NAME).o - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/args/.cvsignore b/reactos/apps/tests/args/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/args/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/args/args.c b/reactos/apps/tests/args/args.c deleted file mode 100644 index 91b0d0eb406..00000000000 --- a/reactos/apps/tests/args/args.c +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include -#include -#include - -HANDLE OutputHandle; -HANDLE InputHandle; - -void debug_printf(char* fmt, ...) -{ - va_list args; - char buffer[255]; - - va_start(args,fmt); - vsprintf(buffer,fmt,args); - WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL); - va_end(args); -} - - -int main(int argc, char* argv[]) -{ - int i; - - AllocConsole(); - InputHandle = GetStdHandle(STD_INPUT_HANDLE); - OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE); - - printf("GetCommandLineA() %s\n",GetCommandLineA()); - debug_printf("GetCommandLineA() %s\n",GetCommandLineA()); - debug_printf("argc %d\n", argc); - for (i=0; i -#include -#include -#include - -#define BUFFER_SIZE 256 - -int main(int argc, char* argv[]) -{ - PRTL_ATOM_TABLE AtomTable = NULL; - RTL_ATOM AtomA = -1, AtomB = -1, AtomC = -1; - NTSTATUS Status; - WCHAR Buffer[BUFFER_SIZE]; - ULONG NameLength, Data1, Data2; - - printf("Atom table test app\n\n"); - - printf("RtlCreateAtomTable()\n"); - Status = RtlCreateAtomTable(37, - &AtomTable); - printf(" Status 0x%08lx\n", Status); - - if (NT_SUCCESS(Status)) - { - printf(" AtomTable %p\n", AtomTable); - - printf("RtlAddAtomToAtomTable()\n"); - Status = RtlAddAtomToAtomTable(AtomTable, - L"TestAtomA", - &AtomA); - printf(" Status 0x%08lx\n", Status); - if (NT_SUCCESS(Status)) - { - printf(" AtomA 0x%x\n", AtomA); - } - - printf("RtlAddAtomToAtomTable()\n"); - Status = RtlAddAtomToAtomTable(AtomTable, - L"TestAtomB", - &AtomB); - printf(" Status 0x%08lx\n", Status); - if (NT_SUCCESS(Status)) - { - printf(" AtomB 0x%x\n", AtomB); - } - - - printf("RtlLookupAtomInAtomTable()\n"); - Status = RtlLookupAtomInAtomTable(AtomTable, - L"TestAtomA", - &AtomC); - printf(" Status 0x%08lx\n", Status); - if (NT_SUCCESS(Status)) - { - printf(" AtomC 0x%x\n", AtomC); - } - - - printf("RtlPinAtomInAtomTable()\n"); - Status = RtlPinAtomInAtomTable(AtomTable, - AtomC); - printf(" Status 0x%08lx\n", Status); - - printf("RtlPinAtomInAtomTable()\n"); - Status = RtlPinAtomInAtomTable(AtomTable, - AtomC); - printf(" Status 0x%08lx\n", Status); - - -// printf("RtlDeleteAtomFromAtomTable()\n"); -// Status = RtlDeleteAtomFromAtomTable(AtomTable, -// AtomC); -// printf(" Status 0x%08lx\n", Status); - - -// printf("RtlEmptyAtomTable()\n"); -// Status = RtlEmptyAtomTable(AtomTable, -// TRUE); -// printf(" Status 0x%08lx\n", Status); - - -// printf("RtlLookupAtomInAtomTable()\n"); -// Status = RtlLookupAtomInAtomTable(AtomTable, -// L"TestAtomA", -// &AtomC); -// printf(" Status 0x%08lx\n", Status); - - - printf("RtlQueryAtomInAtomTable()\n"); - NameLength = sizeof(WCHAR) * BUFFER_SIZE; - Status = RtlQueryAtomInAtomTable(AtomTable, - AtomC, - &Data1, - &Data2, - Buffer, - &NameLength); - printf(" Status 0x%08lx\n", Status); - if (NT_SUCCESS(Status)) - { - printf(" RefCount %ld\n", Data1); - printf(" PinCount %ld\n", Data2); - printf(" NameLength %lu\n", NameLength); - printf(" AtomName: %S\n", Buffer); - } - - printf("RtlDestroyAtomTable()\n"); - RtlDestroyAtomTable(AtomTable); - - - printf("Atom table test app finished\n"); - } - - return(0); -} diff --git a/reactos/apps/tests/atomtest/makefile b/reactos/apps/tests/atomtest/makefile deleted file mode 100644 index 1fdf6ea6d11..00000000000 --- a/reactos/apps/tests/atomtest/makefile +++ /dev/null @@ -1,22 +0,0 @@ -# $Id: makefile,v 1.6 2003/11/14 17:13:15 weiden Exp $ -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = atomtest - -TARGET_SDKLIBS = ntdll.a kernel32.a - -TARGET_OBJECTS = $(TARGET_NAME).o - -TARGET_CFLAGS = -Wall -Werror - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/bench/.cvsignore b/reactos/apps/tests/bench/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/bench/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/bench/bench-syscall.c b/reactos/apps/tests/bench/bench-syscall.c deleted file mode 100644 index 447bc0f1e24..00000000000 --- a/reactos/apps/tests/bench/bench-syscall.c +++ /dev/null @@ -1,8 +0,0 @@ -/* - * - */ - -int main(int argc, char* argv[]) -{ - -} diff --git a/reactos/apps/tests/bench/bench-thread.c b/reactos/apps/tests/bench/bench-thread.c deleted file mode 100644 index 6648a254b8a..00000000000 --- a/reactos/apps/tests/bench/bench-thread.c +++ /dev/null @@ -1,81 +0,0 @@ -#include -#include - -#define NR_THREADS (30) - - -DWORD WINAPI -thread_main1(LPVOID param) -{ - printf("Thread 1 running (Counter %lu)\n", (DWORD)param); - SleepEx(INFINITE, TRUE); - return 0; -} - - -DWORD WINAPI -thread_main2(LPVOID param) -{ - printf("Thread 2 running (Counter %lu)\n", (DWORD)param); - Sleep(INFINITE); - return 0; -} - - -int main (void) -{ - DWORD i=0; - DWORD id; - -#if 1 - printf("Creating %d threads...\n",NR_THREADS*2); - for (i=0;i - * Updates can be downloaded at: - * - * Please do not hesistate to e-mail me at dmc27@ee.cornell.edu - * if you have any questions about this code. - */ - - -#include -#include - -HINSTANCE HInst; -const char* WndClassName = "GMainWnd"; -LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam, - LPARAM LParam); - - -int APIENTRY WinMain(HINSTANCE HInstance, HINSTANCE HPrevInstance, - LPTSTR lpCmdLine, int nCmdShow) -{ - WNDCLASS wc; - MSG msg; - - HInst = HInstance; - - memset(&wc, 0, sizeof(WNDCLASS)); - - wc.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS; - wc.lpfnWndProc = MainWndProc; - wc.hInstance = HInstance; - wc.hCursor = LoadCursor(NULL, (LPCTSTR)IDC_ARROW); - /* wc.hbrBackground = reinterpret_cast(COLOR_BTNFACE + 1); */ - wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); - wc.lpszClassName = WndClassName; - - if (RegisterClass(&wc)) - { - HWND HWnd = - CreateWindow( - WndClassName, TEXT("BitBlt Bitmap Rendering Demo"), - WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION | - WS_VISIBLE | WS_CLIPSIBLINGS, - 0, 0, 220, 230, - NULL, NULL, HInst, NULL - ); - - if (HWnd) - { - ShowWindow(HWnd, nCmdShow); - UpdateWindow(HWnd); - - while (GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } - } - return 0; -} - -/* image related */ -BITMAP bmp; -LPCSTR filename = TEXT("lena.bmp"); -HDC HMemDC = NULL; -HBITMAP HOldBmp = NULL; - -LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam, - LPARAM LParam) -{ - switch (Msg) - { - case WM_CREATE: - { - /* create a memory DC */ - HMemDC = CreateCompatibleDC(NULL); - if (HMemDC) - { - /* load a bitmap from file */ - HBITMAP HBmp = - /* static_cast */( - LoadImage(HInst, filename, IMAGE_BITMAP, - 0, 0, LR_LOADFROMFILE) - ); - if (HBmp) - { - /* extract dimensions of the bitmap */ - GetObject(HBmp, sizeof(BITMAP), &bmp); - - /* associate the bitmap with the memory DC */ - /* HOldBmp = static_cast */ - (SelectObject(HMemDC, HBmp) - ); - } - } - } - case WM_PAINT: - { - PAINTSTRUCT ps; - const HDC Hdc = BeginPaint(HWnd, &ps); -#if 0 - try -#endif - { - - /* TODO: add palette support (see Chapter 9)... */ - - - BitBlt(Hdc, 20, 15, - bmp.bmWidth, bmp.bmHeight, - HMemDC, 0, 0, - SRCCOPY); - } -#if 0 - catch (...) -#endif - { - EndPaint(HWnd, &ps); - } - EndPaint(HWnd, &ps); - break; - } - case WM_DESTROY: - { - /* clean up */ - DeleteObject(SelectObject(HMemDC, HOldBmp)); - DeleteDC(HMemDC); - - PostQuitMessage(0); - return 0; - } - } - return DefWindowProc(HWnd, Msg, WParam, LParam); -} diff --git a/reactos/apps/tests/bitblt/lena.bmp b/reactos/apps/tests/bitblt/lena.bmp deleted file mode 100644 index e9916963852..00000000000 Binary files a/reactos/apps/tests/bitblt/lena.bmp and /dev/null differ diff --git a/reactos/apps/tests/bitblt/makefile b/reactos/apps/tests/bitblt/makefile deleted file mode 100644 index 1fa6bc60209..00000000000 --- a/reactos/apps/tests/bitblt/makefile +++ /dev/null @@ -1,22 +0,0 @@ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = bitblt - -TARGET_SDKLIBS = kernel32.a gdi32.a - -TARGET_OBJECTS = $(TARGET_NAME).o - -TARGET_CFLAGS = -Wall -Werror -D__USE_W32API - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/button/.cvsignore b/reactos/apps/tests/button/.cvsignore deleted file mode 100644 index e24713815a0..00000000000 --- a/reactos/apps/tests/button/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map \ No newline at end of file diff --git a/reactos/apps/tests/button/Makefile b/reactos/apps/tests/button/Makefile deleted file mode 100644 index 44e44d42c01..00000000000 --- a/reactos/apps/tests/button/Makefile +++ /dev/null @@ -1,22 +0,0 @@ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = btntest - -TARGET_SDKLIBS = kernel32.a gdi32.a - -TARGET_OBJECTS = buttontst.o - -TARGET_CFLAGS = -Wall -Werror - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/button/buttontst.c b/reactos/apps/tests/button/buttontst.c deleted file mode 100644 index c12887b6aee..00000000000 --- a/reactos/apps/tests/button/buttontst.c +++ /dev/null @@ -1,107 +0,0 @@ -/* Based on Radoslaw Sokol's static control test. */ -#include - -static LPSTR BUTTON_CLASS = "BUTTON"; -static LPSTR TEST_WND_CLASS = "TESTWND"; - -#ifdef NDEBUG - #define DPRINT(s) (void)0 -#else - #define DPRINT(s) OutputDebugStringA("BUTTONTEST: " s "\n") -#endif - -HINSTANCE AppInstance = NULL; - -LRESULT WmCreate( - HWND Wnd) -{ - DPRINT("WM_CREATE (enter)."); - DPRINT("test 1"); - CreateWindowEx(0, BUTTON_CLASS, "PushButton", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE, - 10, 10, 150, 30, Wnd, NULL, AppInstance, NULL); - DPRINT("test 2"); - CreateWindowEx(0, BUTTON_CLASS, "DefPushButton", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE, - 10, 40, 150, 30, Wnd, NULL, AppInstance, NULL); - DPRINT("test 3"); - CreateWindowEx(0, BUTTON_CLASS, "AutoRadioButton", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, - 10, 70, 150, 30, Wnd, NULL, AppInstance, NULL); - DPRINT("test 4"); - CreateWindowEx(0, BUTTON_CLASS, "AutoCheckBox", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE, - 10, 100, 150, 30, Wnd, NULL, AppInstance, NULL); - - DPRINT("WM_CREATE (leave)."); - return 0; -} - -LRESULT CALLBACK TestWndProc( - HWND Wnd, - UINT Msg, - WPARAM wParam, - LPARAM lParam) -{ - switch (Msg) { - case WM_CREATE: - return WmCreate(Wnd); - case WM_DESTROY: - PostQuitMessage(0); - return 0; - default: - return DefWindowProc(Wnd, Msg, wParam, lParam); - } -} - -int STDCALL WinMain( - HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpCmdLine, - int nShowCmd) -{ - ATOM Result; - MSG Msg; - HWND MainWindow; - WNDCLASSEX TestWndClass = {0}; - DPRINT("Application starting up."); - // Remember instance handle. - AppInstance = GetModuleHandle(NULL); - // Register test window class. - TestWndClass.cbSize = sizeof(WNDCLASSEX); - TestWndClass.lpfnWndProc = &TestWndProc; - TestWndClass.hInstance = AppInstance; - TestWndClass.hCursor = LoadCursor(0, (LPCTSTR)IDC_ARROW); - TestWndClass.hbrBackground = CreateSolidBrush(RGB(255,255,230)); - TestWndClass.lpszClassName = TEST_WND_CLASS; - Result = RegisterClassEx(&TestWndClass); - if (Result == 0) { - DPRINT("Error registering class."); - MessageBox(0, "Error registering test window class.", - "Button control test", MB_ICONSTOP | MB_OK); - ExitProcess(0); - } - // Create main window. - DPRINT("Creating main window."); - MainWindow = CreateWindowEx(WS_EX_APPWINDOW | WS_EX_CLIENTEDGE, - TEST_WND_CLASS, "Button test", - WS_OVERLAPPEDWINDOW, 50, 50, 180, 365, - NULL, NULL, AppInstance, NULL); - if (MainWindow == 0) { - DPRINT("Error creating main window."); - UnregisterClass(TEST_WND_CLASS, AppInstance); - MessageBox(0, "Error creating test window.", - "Static control test", MB_ICONSTOP | MB_OK); - ExitProcess(0); - } - DPRINT("Showing main window."); - ShowWindow(MainWindow, SW_SHOWNORMAL); - UpdateWindow(MainWindow); - // Run message loop. - DPRINT("Entering message loop."); - while (GetMessage(&Msg, NULL, 0, 0) > 0) { - TranslateMessage(&Msg); - DispatchMessage(&Msg); - } - // Unregister window class. - UnregisterClass(TEST_WND_CLASS, AppInstance); - DPRINT("Exiting."); - - return Msg.wParam; -} diff --git a/reactos/apps/tests/button2/.cvsignore b/reactos/apps/tests/button2/.cvsignore deleted file mode 100644 index e24713815a0..00000000000 --- a/reactos/apps/tests/button2/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map \ No newline at end of file diff --git a/reactos/apps/tests/button2/Makefile b/reactos/apps/tests/button2/Makefile deleted file mode 100644 index edac2e444bb..00000000000 --- a/reactos/apps/tests/button2/Makefile +++ /dev/null @@ -1,22 +0,0 @@ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = btntest2 - -TARGET_SDKLIBS = kernel32.a gdi32.a - -TARGET_OBJECTS = buttontst2.o - -TARGET_CFLAGS = -Wall -Werror - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/button2/buttontst2.c b/reactos/apps/tests/button2/buttontst2.c deleted file mode 100644 index b16c905e1aa..00000000000 --- a/reactos/apps/tests/button2/buttontst2.c +++ /dev/null @@ -1,219 +0,0 @@ -#include -#include - -HFONT tf; -LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM); - -int WINAPI -WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpszCmdLine, - int nCmdShow) -{ - WNDCLASS wc; - MSG msg; - HWND hWnd; - HWND hbtn[26]; - - wc.lpszClassName = "ButtonTest"; - wc.lpfnWndProc = MainWndProc; - wc.style = CS_VREDRAW | CS_HREDRAW; - wc.hInstance = hInstance; - wc.hIcon = LoadIcon(NULL, (LPCTSTR)IDI_APPLICATION); - wc.hCursor = LoadCursor(NULL, (LPCTSTR)IDC_ARROW); - wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH); - wc.lpszMenuName = NULL; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - if (RegisterClass(&wc) == 0) - { - fprintf(stderr, "RegisterClass failed (last error 0x%lX)\n", - GetLastError()); - return(1); - } - - hWnd = CreateWindow("ButtonTest", - "Button Test", - WS_OVERLAPPEDWINDOW, - 0, - 0, - CW_USEDEFAULT, - CW_USEDEFAULT, - NULL, - NULL, - hInstance, - NULL); - if (hWnd == NULL) - { - fprintf(stderr, "CreateWindow failed (last error 0x%lX)\n", - GetLastError()); - return(1); - } - - tf = CreateFontA(14, 0, 0, TA_BASELINE, FW_NORMAL, FALSE, FALSE, FALSE, - ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, - DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, "Timmons"); - - ShowWindow(hWnd, nCmdShow); - - hbtn[0] = CreateWindow( - "BUTTON","BS_DEFPUSHBUTTON",WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, - 10, 10, 200, 40, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - hbtn[1] = CreateWindow( - "BUTTON","BS_3STATE",WS_VISIBLE | WS_CHILD | BS_3STATE, - 10, 60, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - hbtn[2] = CreateWindow( - "BUTTON","BS_AUTO3STATE",WS_VISIBLE | WS_CHILD | BS_AUTO3STATE, - 10, 90, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - hbtn[3] = CreateWindow( - "BUTTON","BS_AUTOCHECKBOX",WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX, - 10, 120, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - hbtn[4] = CreateWindow( - "BUTTON","BS_AUTORADIOBUTTON",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON, - 10, 150, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - hbtn[5] = CreateWindow( - "BUTTON","BS_CHECKBOX",WS_VISIBLE | WS_CHILD | BS_CHECKBOX, - 10, 180, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - hbtn[6] = CreateWindow( - "BUTTON","BS_GROUPBOX",WS_VISIBLE | WS_CHILD | BS_GROUPBOX, - 10, 210, 200, 80, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - hbtn[7] = CreateWindow( - "BUTTON","BS_PUSHBUTTON",WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON, - 20, 230, 180, 30, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - hbtn[8] = CreateWindow( - "BUTTON","BS_RADIOBUTTON",WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, - 10, 300, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - hbtn[9] = CreateWindow( - "BUTTON","BS_AUTORADIOBUTTON",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON, - 220, 160, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - hbtn[10] = CreateWindow( - "BUTTON","BS_DEFPUSHBUTTON|BS_BOTTOM",WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON | BS_BOTTOM, - 220, 10, 250, 40, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - hbtn[11] = CreateWindow( - "BUTTON","BS_DEFPUSHBUTTON|BS_LEFT",WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON | BS_LEFT, - 480, 10, 250, 40, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - hbtn[12] = CreateWindow( - "BUTTON","BS_DEFPUSHBUTTON|BS_RIGHT|BS_MULTILINE",WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON | BS_RIGHT |BS_MULTILINE, - 740, 10, 150, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - hbtn[13] = CreateWindow( - "BUTTON","BS_AUTORADIOBUTTON|BS_TOP",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | BS_TOP, - 220, 60, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - // Other Combinations - - hbtn[14] = CreateWindow( - "BUTTON","BS_AUTORADIOBUTTON|BS_BOTTOM|BS_MULTILINE",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | BS_BOTTOM | BS_MULTILINE, - 480, 60, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - hbtn[15] = CreateWindow( - "BUTTON","BS_AUTORADIOBUTTON|BS_LEFT",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | BS_LEFT, - 740, 80, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - hbtn[16] = CreateWindow( - "BUTTON","BS_AUTORADIOBUTTON|BS_RIGHT|BS_TOP",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | BS_RIGHT | BS_TOP, - 220, 130, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - hbtn[17] = CreateWindow( - "BUTTON","BS_AUTORADIOBUTTON|BS_TOP|BS_MULTILINE",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | BS_TOP| BS_MULTILINE, - 480, 130, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - hbtn[18] = CreateWindow( - "BUTTON","BS_AUTOCHECKBOX|BS_BOTTOM|BS_MULTILINE",WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX | BS_BOTTOM | BS_MULTILINE, - 740, 130, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - hbtn[19] = CreateWindow( - "BUTTON","BS_AUTOCHECKBOX|BS_TOP|BS_MULTILINE",WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE, - 480, 190, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - hbtn[20] = CreateWindow( - "BUTTON","BS_AUTOCHECKBOX|BS_LEFT|BS_MULTILINE",WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX | BS_LEFT | BS_MULTILINE, - 220, 230, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - hbtn[21] = CreateWindow( - "BUTTON","BS_AUTOCHECKBOX|BS_RIGHT|BS_MULTILINE",WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX | BS_RIGHT | BS_MULTILINE, - 480, 240, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - hbtn[22] = CreateWindow( - "BUTTON","BS_GROUPBOX|BS_TOP",WS_VISIBLE | WS_CHILD | BS_GROUPBOX | BS_TOP, - 10, 340, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - hbtn[23] = CreateWindow( - "BUTTON","BS_GROUPBOX|BS_BOTTOM",WS_VISIBLE | WS_CHILD | BS_GROUPBOX | BS_BOTTOM, - 10, 410, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - hbtn[24] = CreateWindow( - "BUTTON","BS_GROUPBOXBOX|BS_LEFT",WS_VISIBLE | WS_CHILD | BS_GROUPBOX | BS_LEFT, - 520, 340, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - hbtn[25] = CreateWindow( - "BUTTON","BS_GROUPBOX|BS_RIGHT|BS_BOTTOM",WS_VISIBLE | WS_CHILD | BS_GROUPBOX | BS_BOTTOM | BS_RIGHT, - 300, 340, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); - - while(GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - DeleteObject(tf); - - return msg.wParam; -} - -LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - PAINTSTRUCT ps; - HDC hDC; - - switch(msg) - { - case WM_PAINT: - hDC = BeginPaint(hWnd, &ps); - SelectObject(hDC, tf); - EndPaint(hWnd, &ps); - break; - - case WM_DESTROY: - PostQuitMessage(0); - break; - - case WM_COMMAND: - switch(HIWORD(wParam)) - { - case BN_CLICKED: - printf("BUTTON CLICKED !\n"); - break; - case BN_DBLCLK: - printf("BUTTON DOUBLE-CLICKED !\n"); - break; - case BN_PUSHED: - printf("BUTTON PUSHED !\n"); - break; - case BN_PAINT: - printf("BUTTON PAINTED !\n"); - break; - case BN_UNPUSHED: - printf("BUTTON UNPUSHED !\n"); - break; - - } - break; - - default: - return DefWindowProc(hWnd, msg, wParam, lParam); - } - return 0; -} diff --git a/reactos/apps/tests/capclock/.cvsignore b/reactos/apps/tests/capclock/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/capclock/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/capclock/Makefile b/reactos/apps/tests/capclock/Makefile deleted file mode 100644 index d4a9d4c8f2e..00000000000 --- a/reactos/apps/tests/capclock/Makefile +++ /dev/null @@ -1,20 +0,0 @@ - -PATH_TO_TOP = ../../.. - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = capclock - -TARGET_SDKLIBS = kernel32.a - -TARGET_OBJECTS = capclock.o - -TARGET_CFLAGS = -Wall -Werror - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/capclock/capclock.c b/reactos/apps/tests/capclock/capclock.c deleted file mode 100644 index 9d0d1bf1e62..00000000000 --- a/reactos/apps/tests/capclock/capclock.c +++ /dev/null @@ -1,70 +0,0 @@ -/* $Id: capclock.c,v 1.4 2004/10/11 21:08:03 weiden Exp $ - * - * DESCRIPTION: Simple Win32 Caption Clock - * PROJECT : ReactOS (test applications) - * AUTHOR : Emanuele Aliberti - * DATE : 2003-09-03 - * LICENSE : GNU GPL v2.0 - */ -#include -#include - -UINT Timer = 1; - -static BOOL CALLBACK DialogFunc(HWND,UINT,WPARAM,LPARAM); -static VOID CALLBACK TimerProc(HWND,UINT,UINT,DWORD); - - -INT STDCALL WinMain (HINSTANCE hinst, HINSTANCE hinstPrev, LPSTR lpCmdLine, INT nCmdShow) -{ - WNDCLASS wc; - - ZeroMemory (& wc, sizeof wc); - wc.lpfnWndProc = DefDlgProc; - wc.cbWndExtra = DLGWINDOWEXTRA; - wc.hInstance = hinst; - wc.hCursor = LoadCursor(NULL, (LPCTSTR)IDC_ARROW); - wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1); - wc.lpszClassName = "CapClock"; - RegisterClass (& wc); - return DialogBox(hinst, MAKEINTRESOURCE(2), NULL, DialogFunc); - -} -static int InitializeApp (HWND hDlg,WPARAM wParam, LPARAM lParam) -{ - Timer = SetTimer (hDlg,Timer,1000,TimerProc); - TimerProc (hDlg,0,0,0); - return 1; -} -static INT_PTR CALLBACK DialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) - { - case WM_INITDIALOG: - InitializeApp(hwndDlg,wParam,lParam); - return TRUE; - case WM_CLOSE: - KillTimer (hwndDlg,Timer); - EndDialog(hwndDlg,0); - return TRUE; - } - return FALSE; -} -static VOID CALLBACK TimerProc (HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime) -{ - CHAR text [20]; - SYSTEMTIME lt; - - GetLocalTime (& lt); - wsprintf ( - text, - "%d-%02d-%02d %02d:%02d:%02d", - lt.wYear, - lt.wMonth, - lt.wDay, - lt.wHour, - lt.wMinute, - lt.wSecond); - SetWindowText (hwnd, text); -} -/* EOF */ diff --git a/reactos/apps/tests/capclock/capclock.ico b/reactos/apps/tests/capclock/capclock.ico deleted file mode 100644 index 0b52fb0ccde..00000000000 Binary files a/reactos/apps/tests/capclock/capclock.ico and /dev/null differ diff --git a/reactos/apps/tests/capclock/capclock.rc b/reactos/apps/tests/capclock/capclock.rc deleted file mode 100644 index 8d36be33a6a..00000000000 --- a/reactos/apps/tests/capclock/capclock.rc +++ /dev/null @@ -1,20 +0,0 @@ -/* $Id: capclock.rc,v 1.2 2004/10/16 20:27:20 gvg Exp $ */ - -#include - -#define REACTOS_STR_FILE_DESCRIPTION "ReactOS W32 Caption Clock\0" -#define REACTOS_STR_INTERNAL_NAME "capclock\0" -#define REACTOS_STR_ORIGINAL_FILENAME "capclock.exe\0" -#include - -/* Icons */ - -1 ICON "capclock.ico" - -/* Dialogs */ - -2 DIALOG 6, 18, 132, 0 -STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -FONT 8, "Microsoft Sans Serif" -BEGIN -END diff --git a/reactos/apps/tests/carets/.cvsignore b/reactos/apps/tests/carets/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/carets/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/carets/caret.bmp b/reactos/apps/tests/carets/caret.bmp deleted file mode 100644 index 5082a5b71a5..00000000000 Binary files a/reactos/apps/tests/carets/caret.bmp and /dev/null differ diff --git a/reactos/apps/tests/carets/carets.c b/reactos/apps/tests/carets/carets.c deleted file mode 100644 index 49007810578..00000000000 --- a/reactos/apps/tests/carets/carets.c +++ /dev/null @@ -1,150 +0,0 @@ -#include -#include -#include "resource.h" - -static int CaretWidth = 2; -static int CaretHeight = 16; -static int CharWidth = 10; -static int CharHeight = 16; -static HBITMAP CaretBitmap; - -LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM); - -int WINAPI -WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpszCmdLine, - int nCmdShow) -{ - WNDCLASS wc; - MSG msg; - HWND hWnd; - - CaretBitmap = LoadBitmap(hInstance, (LPCTSTR)IDB_CARET); - - wc.lpszClassName = "CaretTestClass"; - wc.lpfnWndProc = MainWndProc; - wc.style = CS_VREDRAW | CS_HREDRAW; - wc.hInstance = hInstance; - wc.hIcon = LoadIcon(NULL, (LPCTSTR)IDI_APPLICATION); - wc.hCursor = LoadCursor(NULL, (LPCTSTR)IDC_ARROW); - wc.hbrBackground = (HBRUSH)COLOR_WINDOW; - wc.lpszMenuName = NULL; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - if (RegisterClass(&wc) == 0) - { - fprintf(stderr, "RegisterClass failed (last error 0x%lX)\n", - GetLastError()); - return(1); - } - - hWnd = CreateWindow(wc.lpszClassName, - "Caret Test", - WS_OVERLAPPEDWINDOW, - 0, - 0, - 200, - 250, - NULL, - NULL, - hInstance, - NULL); - if (hWnd == NULL) - { - fprintf(stderr, "CreateWindow failed (last error 0x%lX)\n", - GetLastError()); - return(1); - } - - ShowWindow(hWnd, nCmdShow); - - while(GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - return msg.wParam; -} - -LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - POINT pt; - switch(msg) - { - case WM_ACTIVATE: - switch(LOWORD(wParam)) - { - case WA_ACTIVE: - case WA_CLICKACTIVE: - if(!ShowCaret(hWnd)) - DbgPrint("ShowCaret(0x%x)\n", hWnd); - break; - case WA_INACTIVE: - if(!HideCaret(hWnd)) - DbgPrint("HideCaret(0x%x)\n", hWnd); - break; - } - break; - - case WM_KEYDOWN: - if(!GetCaretPos(&pt)) - { - DbgPrint("GetCaretPos() failed!\n"); - break; - } - switch(wParam) - { - case VK_LEFT: - pt.x -= CharWidth; - break; - case VK_UP: - pt.y -= CharHeight; - break; - case VK_RIGHT: - pt.x += CharWidth; - break; - case VK_DOWN: - pt.y += CharHeight; - break; - } - if(!SetCaretPos(pt.x, pt.y)) - DbgPrint("SetCaretPos() failed!\n"); - break; - - case WM_RBUTTONDOWN: - if(!CreateCaret(hWnd, CaretBitmap, 0, 0)) - DbgPrint("CreateCaret() for window 0x%x failed!\n", hWnd); - else - if(!ShowCaret(hWnd)) - DbgPrint("ShowCaret(0x%x)\n", hWnd); - break; - - case WM_LBUTTONDOWN: - if(!CreateCaret(hWnd, (HBITMAP)0, CaretWidth, CaretHeight)) - DbgPrint("CreateCaret() for window 0x%x failed!\n", hWnd); - else - if(!ShowCaret(hWnd)) - DbgPrint("ShowCaret(0x%x)\n", hWnd); - break; - - case WM_CREATE: - if(!CreateCaret(hWnd, (HBITMAP)0, CaretWidth, CaretHeight)) - DbgPrint("CreateCaret() for window 0x%x failed!\n", hWnd); - else - if(!SetCaretPos(1, 1)) - DbgPrint("SetCaretPos(%i, %i) failed!\n", 1, 1); - break; - - case WM_DESTROY: - if(!DestroyCaret()) - DbgPrint("DestroyCaret() failed!\n"); - PostQuitMessage(0); - break; - - default: - return DefWindowProc(hWnd, msg, wParam, lParam); - } - return 0; -} diff --git a/reactos/apps/tests/carets/carets.rc b/reactos/apps/tests/carets/carets.rc deleted file mode 100644 index 46206dad917..00000000000 --- a/reactos/apps/tests/carets/carets.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include -#include -#include "resource.h" - -IDB_CARET BITMAP DISCARDABLE "caret.bmp" diff --git a/reactos/apps/tests/carets/makefile b/reactos/apps/tests/carets/makefile deleted file mode 100644 index 8bed0395a88..00000000000 --- a/reactos/apps/tests/carets/makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $Id: makefile,v 1.2 2003/11/14 17:13:16 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = no - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = carets - -TARGET_SDKLIBS = kernel32.a gdi32.a ntdll.a - -TARGET_OBJECTS = $(TARGET_NAME).o - -TARGET_CFLAGS = -Wall -Werror - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/carets/resource.h b/reactos/apps/tests/carets/resource.h deleted file mode 100644 index 4550828495a..00000000000 --- a/reactos/apps/tests/carets/resource.h +++ /dev/null @@ -1 +0,0 @@ -#define IDB_CARET 101 diff --git a/reactos/apps/tests/cliarea/.cvsignore b/reactos/apps/tests/cliarea/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/cliarea/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/combo/.cvsignore b/reactos/apps/tests/combo/.cvsignore deleted file mode 100644 index e24713815a0..00000000000 --- a/reactos/apps/tests/combo/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map \ No newline at end of file diff --git a/reactos/apps/tests/combo/combotst.c b/reactos/apps/tests/combo/combotst.c deleted file mode 100644 index f99fc87da91..00000000000 --- a/reactos/apps/tests/combo/combotst.c +++ /dev/null @@ -1,687 +0,0 @@ -/* ComboBox Control Test for ReactOS. - -* This is a test program. Not made to be fast, small -* easy to mantain, or portable. - -* I'm not erasing text because I don't want to use other functions from the API -* or make this more complex. Also Fonts are not heavily used. - -* This source code is in the PUBLIC DOMAIN and has NO WARRANTY. -* by Waldo Alvarez Cañizares , started July 11, 2003. */ - -//#define WIN32_LEAN_AND_MEAN -#include -#include "utils.h" - -#define CONTROLCLASS "COMBOBOX" /* the class name */ -#define CONTROLCLASSW L"COMBOBOX" /* the class name in unicode*/ - -#define WINDOWWIDTH 560 -#define WINDOWHEIGHT 350 - -/* --- Command IDs of some buttons --- */ -#define CREATEWINDOW_ID 106 -#define CREATEWINDOWEX_ID 107 -#define CREATEWINDOWW_ID 108 -#define INITPAGE_ID 400 -#define SECONDPAGE_ID 401 -#define BACKFIRSTPAGE_ID 402 - -/* --- Position where the result text goes --- */ -#define ResultX 0 -#define ResultY 305 - -/* --- Position where the notify text goes --- */ -#define NOTIFYX 390 -#define NOTIFYY 285 - -/* --- The width of most buttons --- */ -#define CHECKBUTWIDTH 190 -#define SCROLLAMOUNT -15 - -/* Size of buffer to hold resulting strings from conversion -and returned by messages */ -#define BUFFERLEN 80 -char TextBuffer[BUFFERLEN]={'R','e','s','u','l','t',':',' '}; - -HWND g_hwnd = NULL; -HINSTANCE g_hInst = NULL; - -int pos = 10; -int n = 0; -int yButPos = 10; -int xButPos = 0; - -DWORD ComboStyle = 0; - -/* --- Control coordinates --- */ -#define CONTROLPOSX 390 -#define CONTROLPOSY 10 -DWORD ControlWidth = 160; -DWORD ControlHeight = 150; - -static RECT srect = {CONTROLPOSX,CONTROLPOSY,WINDOWWIDTH,WINDOWHEIGHT}; - -HWND hwndEdit = NULL; - -RECT rect; -DWORD StartP,EndP; -HWND hwnd; /* main window handle */ - -char AddString[] = "string added"; - -typedef void FunctionHandler(HWND,DWORD,WPARAM,LPARAM); -typedef FunctionHandler* LPFUNCTIONHANDLER; - -void PrintTextXY(char* Text,int x,int y,int len, RECT rect) - { - HDC hdc; - hdc = GetDC (g_hwnd); - SelectObject (hdc, GetStockObject (SYSTEM_FIXED_FONT)); - - TextOut (hdc, x,y,Text,len); - ReleaseDC (g_hwnd, hdc); - - ValidateRect (g_hwnd, &rect); - } - -static -VOID -HandlePrintReturnHex(HWND handle,DWORD Msg,WPARAM wParam,LPARAM lParam) - { - LRESULT ret; - RECT rect; - ret = SendMessage(handle,Msg,wParam,lParam); - htoa((unsigned int)ret,&TextBuffer[8]); - GetWindowRect(g_hwnd,&rect); - PrintTextXY(TextBuffer,ResultX,ResultY,16,rect); - } - - -static -VOID -HandlePrintReturnStr(HWND handle,DWORD Msg,WPARAM wParam,LPARAM lParam) - { - LRESULT ret; - RECT rect; - - TextBuffer[8] = (char)(BUFFERLEN - 8); /* Setting the max size to put chars in first byte */ - ret = SendMessage(handle,Msg,wParam,lParam); - GetWindowRect(g_hwnd,&rect); - PrintTextXY(TextBuffer,ResultX,ResultY,8+(int)ret,rect); - } - -static -VOID -HandlePrintRect(HWND handle,DWORD Msg,WPARAM wParam,LPARAM lParam) - { - RECT rect; - TextBuffer[8] = (char)(BUFFERLEN - 8); /* Setting the max size to put chars in first byte */ - SendMessage(handle,Msg,wParam,lParam); - - htoa(rect.top,&TextBuffer[8]); - TextBuffer[8+8] = ' '; - htoa(rect.bottom,&TextBuffer[8+8+1]); - TextBuffer[8+8+8+1] = ' '; - htoa(rect.left,&TextBuffer[8+8+8+1+1]); - TextBuffer[8+8+8+8+1+1] = ' '; - htoa(rect.right,&TextBuffer[8+8+8+8+1+1+1]); - - GetWindowRect(g_hwnd,&rect); - PrintTextXY(TextBuffer,ResultX,ResultY,8+4*9-1,rect); - } - -struct - { - char* Text; /* Text for the button */ - DWORD MsgCode; /* Message Code */ - WPARAM wParam; /* Well hope you can understand this */ - LPARAM lParam; /* ditto */ - LPFUNCTIONHANDLER Handler; /* Funtion called to handle the result of each message */ - } -Msg[] = - { - {"CB_ADDSTRING",CB_ADDSTRING,0,(LPARAM)&AddString,&HandlePrintReturnHex}, - {"CB_ADDSTRING - long",CB_ADDSTRING,0,(LPARAM)"very loooooooooong striiinnnnnnnnnggg",&HandlePrintReturnHex}, - {"CB_DELETESTRING",CB_DELETESTRING,2,0,&HandlePrintReturnHex}, /* remember to catch WM_DELETEITEM*/ - - /* What a message, why M$ decided to implement his thing ? */ - {"CB_DIR - drives",CB_DIR,DDL_DRIVES, - /* Hoping that most machines have this */ - (LPARAM)"C:\\", - &HandlePrintReturnHex}, - - {"CB_DIR - dirs",CB_DIR,DDL_DIRECTORY,(LPARAM)"C:\\*",&HandlePrintReturnHex}, - - {"CB_DIR - files",CB_DIR, - DDL_ARCHIVE | DDL_EXCLUSIVE | DDL_HIDDEN | DDL_READONLY | DDL_READWRITE | DDL_SYSTEM, - (LPARAM)"C:\\*",&HandlePrintReturnHex}, - - /* Do not forget WM_COMPAREITEM */ - - {"CB_FINDSTRING",CB_FINDSTRING,1,(LPARAM)"str",&HandlePrintReturnHex}, - {"CB_FINDSTRINGEXACT(-1)",CB_FINDSTRINGEXACT,-1,(LPARAM)&AddString,&HandlePrintReturnHex}, - {"CB_FINDSTRINGEXACT(2)",CB_FINDSTRINGEXACT,2,(LPARAM)&AddString,&HandlePrintReturnHex}, - - /* "CB_GETCOMBOBOXINFO",CB_GETCOMBOBOXINFO,0,0,&HandlePrintReturnHex, winXP & .net server remember to handle the struct */ - - {"CB_GETCOUNT",CB_GETCOUNT,0,0,&HandlePrintReturnHex}, - - {"CB_GETCURSEL",CB_GETCURSEL,0,0,&HandlePrintReturnHex}, - - /* To implement "CB_GETEDITSEL - vars",CB_GETEDITSEL,,,&HandlePrintReturnHex, */ - - {"CB_GETEXTENDEDUI",CB_GETEXTENDEDUI,0,0,&HandlePrintReturnHex}, - {"CB_GETHORIZONTALEXTENT",CB_GETHORIZONTALEXTENT,0,0,&HandlePrintReturnHex}, - - - - {"CB_GETLBTEXT",CB_GETLBTEXT,1,(LPARAM)&TextBuffer[8],&HandlePrintReturnStr}, - {"CB_GETLBTEXTLEN",CB_GETLBTEXTLEN,1,0,&HandlePrintReturnHex}, - {"CB_GETLOCALE",CB_GETLOCALE,0,0,&HandlePrintReturnHex}, - - /* "CB_GETMINVISIBLE",CB_GETMINVISIBLE,0,0,&HandlePrintReturnHex, Included in Windows XP and Windows .NET Server. */ - - {"CB_GETTOPINDEX",CB_GETTOPINDEX,0,0,&HandlePrintReturnHex}, - - {"CB_INITSTORAGE",CB_INITSTORAGE,10,200,&HandlePrintReturnHex}, - {"CB_INSERTSTRING",CB_INSERTSTRING,2,(LPARAM)"inserted string",&HandlePrintReturnHex}, - - {"CB_LIMITTEXT",CB_LIMITTEXT,10,0,&HandlePrintReturnHex}, - {"CB_RESETCONTENT",CB_RESETCONTENT ,0,0,&HandlePrintReturnHex}, - {"CB_SELECTSTRING",CB_SELECTSTRING,2,(LPARAM)"str",&HandlePrintReturnHex}, - {"CB_SETCURSEL",CB_SETCURSEL,1,0,&HandlePrintReturnHex}, - - {"CB_SETDROPPEDWIDTH",CB_SETDROPPEDWIDTH,250,0,&HandlePrintReturnHex}, - - {"CB_SETEXTENDEDUI - set",CB_SETEXTENDEDUI,TRUE,0,&HandlePrintReturnHex}, - {"CB_SETEXTENDEDUI - clear",CB_SETEXTENDEDUI,FALSE,0,&HandlePrintReturnHex}, - - /* - * win2k have a small bug with this ^ , if you press F4 while it is cleared, - * the combobox is using style cbs_dropdown - * and the pointer is over the edit box then the mouse pointer is not changed - * to an arrow - */ - - {"CB_SETHORIZONTALEXTENT",CB_SETHORIZONTALEXTENT,500,0,&HandlePrintReturnHex}, - - {"CB_GETITEMDATA",CB_GETITEMDATA,1,0,&HandlePrintReturnHex}, - {"CB_SETITEMDATA",CB_SETITEMDATA,1,0x791031,&HandlePrintReturnHex}, - - {"CB_SETITEMHEIGHT",CB_SETITEMHEIGHT,-1,30,&HandlePrintReturnHex}, - {"CB_GETITEMHEIGHT",CB_GETITEMHEIGHT,2,0,&HandlePrintReturnHex}, - - /* "CB_SETMINVISIBLE",CB_SETMINVISIBLE,4,0,&HandlePrintReturnHex, Included in Windows XP and Windows .NET Server */ - - {"CB_GETEDITSEL",CB_GETEDITSEL,(WPARAM)NULL,(LPARAM)NULL,&HandlePrintReturnHex}, - {"CB_SETEDITSEL",CB_SETEDITSEL,0,0x00020005,&HandlePrintReturnHex}, - {"CB_SETEDITSEL - clear",CB_SETEDITSEL,0,0xFFFFFFFF,&HandlePrintReturnHex}, - - {"CB_SETTOPINDEX",CB_SETTOPINDEX,3,0,&HandlePrintReturnHex}, - - {"CB_SHOWDROPDOWN - true",CB_SHOWDROPDOWN,TRUE,0,&HandlePrintReturnHex}, - {"CB_SHOWDROPDOWN - false",CB_SHOWDROPDOWN,FALSE,0,&HandlePrintReturnHex}, - - {"CB_GETDROPPEDCONTROLRECT",CB_GETDROPPEDCONTROLRECT,0,(LPARAM)&rect,&HandlePrintRect}, - {"CB_GETDROPPEDSTATE",CB_GETDROPPEDSTATE,0,0,&HandlePrintReturnHex}, - {"CB_GETDROPPEDWIDTH",CB_GETDROPPEDWIDTH,0,0,&HandlePrintReturnHex}, - - {"WM_PASTE",WM_PASTE,0,0,&HandlePrintReturnHex}, - }; - -#define MAXMESSAGEBUTTONS 40 - -struct - { - char* Name; /* Text for the button */ - DWORD Code; /* Style Code */ - } -Styles[] = { - {"WS_DISABLED",WS_DISABLED}, - {"CBS_AUTOHSCROLL",CBS_AUTOHSCROLL}, - {"CBS_DISABLENOSCROLL",CBS_DISABLENOSCROLL}, - {"CBS_DROPDOWN",CBS_DROPDOWN}, - {"CBS_DROPDOWNLIST",CBS_DROPDOWNLIST}, - {"CBS_HASSTRINGS",CBS_HASSTRINGS}, - {"CBS_LOWERCASE",CBS_LOWERCASE}, - {"CBS_NOINTEGRALHEIGHT",CBS_NOINTEGRALHEIGHT}, - {"CBS_OEMCONVERT",CBS_OEMCONVERT}, - {"CBS_OWNERDRAWFIXED",CBS_OWNERDRAWFIXED}, - {"CBS_OWNERDRAWVARIABLE",CBS_OWNERDRAWVARIABLE}, - {"CBS_SIMPLE",CBS_SIMPLE}, - {"CBS_SORT",CBS_SORT}, - {"CBS_UPPERCASE",CBS_UPPERCASE}, - {"CBS_DISABLENOSCROLL",CBS_DISABLENOSCROLL}, - {"WS_HSCROLL",WS_HSCROLL}, - {"WS_VSCROLL",WS_VSCROLL} - }; - -/* The number of check buttons we have. -* Maybe some calculations at compile time would be better -*/ - -#define NUMBERCHECKS 17 - -#define NUMBERBUTTONS NUMBERCHECKS + 7 -HWND Buttons[NUMBERBUTTONS]; -HWND MessageButtons[MAXMESSAGEBUTTONS]; -HWND Back1But,Back2But; -HWND NextBut; - -HWND -CreateCheckButton(const char* lpWindowName, DWORD xSize, DWORD id) - { - HWND h; - h = CreateWindowEx(0, - "BUTTON", - lpWindowName, - WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, - xButPos, /* x */ - yButPos, /* y */ - xSize, /* nWidth */ - 20, /* nHeight */ - g_hwnd, - (HMENU) id, - g_hInst, - NULL - ); - yButPos += 21; - return h; - } - -HWND -CreatePushButton(const char* lpWindowName, DWORD xSize, DWORD id,DWORD Style) - { - - HWND h = CreateWindow("BUTTON", - lpWindowName, - WS_CHILD | BS_PUSHBUTTON | Style, - xButPos, /* x */ - yButPos, /* y */ - xSize, /* nWidth */ - 20, /* nHeight */ - g_hwnd, - (HMENU) id, - g_hInst, - NULL - ); - - yButPos += 21; - return h; - } - -VOID -ReadNHide() - { - int i; - ComboStyle = 0; - for (i=0 ; i< NUMBERCHECKS ; i++) - { - if(BST_CHECKED == SendMessage(Buttons[i],BM_GETCHECK,0,0)) - ComboStyle |= Styles[i].Code; - ShowWindow(Buttons[i],SW_HIDE); - } - - for (; i< NUMBERBUTTONS ; i++)ShowWindow(Buttons[i],SW_HIDE); - for (i=0 ; i< 26 ; i++) ShowWindow(MessageButtons[i],SW_SHOW); - - ShowWindow(Back1But,SW_SHOW); - ShowWindow(NextBut,SW_SHOW); - } - -VOID -ForwardToSecondPage() - { - int i; - for (i=0;i<26;i++)ShowWindow(MessageButtons[i],SW_HIDE); - for(;i= 600) - { - Msg[LOWORD(wParam)-600].Handler(hwndEdit, - Msg[LOWORD(wParam)-600].MsgCode, - Msg[LOWORD(wParam)-600].wParam, - Msg[LOWORD(wParam)-600].lParam); - break; - } - - switch(LOWORD(wParam)){ - - case 100: - ControlWidth += 10; - break; - - case 101: - ControlWidth -= 10; - break; - - case 102: - ControlHeight += 10; - break; - - case 103: - ControlHeight -= 10; - break; - - case INITPAGE_ID: - BackToInitialPage(); - break; - - case SECONDPAGE_ID: - ForwardToSecondPage(); - break; - - case BACKFIRSTPAGE_ID: - BackToFirstPage(); - break; - - case CREATEWINDOW_ID: - ReadNHide(); - srect.top = CONTROLPOSY + ControlHeight; - hwndEdit = CreateWindow(CONTROLCLASS, - NULL, - ComboStyle | WS_CHILD | WS_VISIBLE, - CONTROLPOSX, - CONTROLPOSY, - ControlWidth, - ControlHeight, - g_hwnd, - NULL, - g_hInst, - NULL); - break; - - case CREATEWINDOWEX_ID: - ReadNHide(); - srect.top = CONTROLPOSY + ControlHeight; - hwndEdit = CreateWindowEx(WS_EX_CLIENTEDGE, - CONTROLCLASS, - NULL, - ComboStyle | WS_CHILD | WS_VISIBLE , - CONTROLPOSX, - CONTROLPOSY, - ControlWidth, - ControlHeight, - g_hwnd, - NULL, - g_hInst, - NULL); - break; - - case CREATEWINDOWW_ID: - ReadNHide(); - srect.top = CONTROLPOSY + ControlHeight; - hwndEdit = CreateWindowExW(WS_EX_CLIENTEDGE, - CONTROLCLASSW, - NULL, - ComboStyle | WS_CHILD | WS_VISIBLE , - CONTROLPOSX, - CONTROLPOSY, - ControlWidth, - ControlHeight, - g_hwnd, - NULL, - g_hInst, - NULL); - break; - } - - if (lParam == (LPARAM)hwndEdit) - switch(HIWORD(wParam)) - { - case CBN_DROPDOWN: - ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect); - PrintTextXY("CBN_DROPDOWN notification",NOTIFYX,NOTIFYY,25,srect); - break; - - case CBN_CLOSEUP: - ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect); - PrintTextXY("CBN_CLOSEUP notification",NOTIFYX,NOTIFYY,24,srect); - break; - - case CBN_DBLCLK: - ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect); - PrintTextXY("CBN_DBLCLK notification",NOTIFYX,NOTIFYY,23,srect); - break; - - case CBN_EDITCHANGE: - ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect); - PrintTextXY("CBN_EDITCHANGE notification",NOTIFYX,NOTIFYY,27,srect); - break; - - case CBN_ERRSPACE: - ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect); - PrintTextXY("CBN_ERRSPACE notification",NOTIFYX,NOTIFYY,25,srect); - break; - - case CBN_KILLFOCUS: - ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect); - PrintTextXY("CBN_KILLFOCUS notification",NOTIFYX,NOTIFYY,26,srect); - break; - - case CBN_EDITUPDATE: - ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect); - PrintTextXY("CBN_EDITUPDATE notification",NOTIFYX,NOTIFYY,27,srect); - break; - - case CBN_SELCHANGE: - ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect); - PrintTextXY("CBN_SELCHANGE notification",NOTIFYX,NOTIFYY,26,srect); - break; - - case CBN_SELENDCANCEL: - ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect); - PrintTextXY("CBN_SELENDCANCEL notification",NOTIFYX,NOTIFYY,29,srect); - break; - - case CBN_SETFOCUS: - ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect); - PrintTextXY("CBN_SETFOCUS notification",NOTIFYX,NOTIFYY,25,srect); - break; - - case CBN_SELENDOK: - ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect); - PrintTextXY("CBN_SELENDOK notification",NOTIFYX,NOTIFYY,25,srect); - break; - } - - return DefWindowProc ( hwnd, msg, wParam, lParam ); - - case WM_MEASUREITEM: - ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect); - PrintTextXY("WM_MEASUREITEM called",NOTIFYX,NOTIFYY,21,srect); - break; - - case WM_COMPAREITEM: - ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect); - PrintTextXY("WM_COMPAREITEM called",NOTIFYX,NOTIFYY,21,srect); - break; - - case WM_DRAWITEM: - ScrollWindow (hwnd, 0, SCROLLAMOUNT, &srect, &srect); - PrintTextXY("WM_DRAWITEM called",NOTIFYX,NOTIFYY,18,srect); - break; - - case WM_SIZE : - return 0; - - case WM_CLOSE: - DestroyWindow (g_hwnd); - return 0; - - case WM_QUERYENDSESSION: - return 0; - - case WM_DESTROY: - PostQuitMessage(0); - return 0; - } - return DefWindowProc ( hwnd, msg, wParam, lParam ); - } - - -HWND -RegisterAndCreateWindow (HINSTANCE hInst, - const char* className, - const char* title) - { - WNDCLASSEX wc; - - - g_hInst = hInst; - - wc.cbSize = sizeof (WNDCLASSEX); - - wc.lpfnWndProc = WndProc; /* window procedure */ - wc.hInstance = hInst; /* owner of the class */ - - wc.lpszClassName = className; - wc.hCursor = LoadCursor ( 0, (LPCTSTR)IDC_ARROW ); - wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); - wc.style = CS_HREDRAW | CS_VREDRAW; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hIcon = 0; - wc.hIconSm = 0; - wc.lpszMenuName = 0; - - if ( !RegisterClassEx ( &wc ) ) - return NULL; - - hwnd = CreateWindowEx ( - 0, /* dwStyleEx */ - className, /* class name */ - title, /* window title */ - - WS_OVERLAPPEDWINDOW, /* dwStyle */ - - 1, /* x */ - 1, /* y */ - WINDOWWIDTH, /* width */ - WINDOWHEIGHT, /* height */ - NULL, /* hwndParent */ - NULL, /* hMenu */ - hInst, - 0 - ); - - if (!hwnd) return NULL; - - ShowWindow (hwnd, SW_SHOW); - UpdateWindow (hwnd); - - return hwnd; - } - -int -WINAPI -WinMain ( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdParam, int cmdShow ) - { - char className [] = "ComboBox Control Test"; - MSG msg; - - RegisterAndCreateWindow ( hInst, className, "ComboBox Control Test" ); - - while (GetMessage (&msg, NULL, 0, 0)) - { - TranslateMessage (&msg); - DispatchMessage (&msg); - } - return (int)msg.wParam; - } diff --git a/reactos/apps/tests/combo/makefile b/reactos/apps/tests/combo/makefile deleted file mode 100644 index 441f7326112..00000000000 --- a/reactos/apps/tests/combo/makefile +++ /dev/null @@ -1,25 +0,0 @@ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = combotst - -TARGET_SDKLIBS = kernel32.a gdi32.a - -TARGET_OBJECTS = \ - combotst.o \ - utils.o - -TARGET_CFLAGS = -Wall -Werror - - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/combo/utils.c b/reactos/apps/tests/combo/utils.c deleted file mode 100644 index f1eff54609f..00000000000 --- a/reactos/apps/tests/combo/utils.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Edit Control Test for ReactOS, quick n' dirty. There you go - * This source code is in the PUBLIC DOMAIN and has NO WARRANTY. - * by Waldo Alvarez Cañizares , June 22, 2003. - */ - -#include - -static const char hexvals[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; -VOID htoa (unsigned int val, char *buf) -{ - int i; - buf += 7; - - for (i=0;i<8;i++) - { - *buf-- = hexvals[val & 0x0000000F]; - val = val >> 4; - } -} - - -VOID strcpy_(char *dst, const char *src) -{ - const char* p = src; - while ((*dst++ = *p++)) {} -} - -VOID strcpyw_(wchar_t* dst,wchar_t* src) -{ - const wchar_t* p = src; - while ((*dst++ = *p++)) {} -} diff --git a/reactos/apps/tests/combo/utils.h b/reactos/apps/tests/combo/utils.h deleted file mode 100644 index f6a12649c1e..00000000000 --- a/reactos/apps/tests/combo/utils.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ -VOID htoa (unsigned int, char *); -VOID strcpy_(char *, const char *); -VOID strcpyw_(wchar_t*,wchar_t*); -#ifdef __cplusplus - } -#endif diff --git a/reactos/apps/tests/consume/.cvsignore b/reactos/apps/tests/consume/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/consume/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/consume/Makefile b/reactos/apps/tests/consume/Makefile deleted file mode 100644 index 3ea20d7ddb9..00000000000 --- a/reactos/apps/tests/consume/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# $Id: Makefile,v 1.8 2003/11/14 17:13:16 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = consume - -TARGET_OBJECTS = $(TARGET_NAME).o - -TARGET_CFLAGS = -Wall -Werror - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/consume/consume.c b/reactos/apps/tests/consume/consume.c deleted file mode 100644 index 81a52cab071..00000000000 --- a/reactos/apps/tests/consume/consume.c +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include -#include - -#define SIZE (65*1024*1024) - -ULONG x[SIZE / 4096]; - -int main() -{ - int i; - PUCHAR BaseAddress; - - BaseAddress = VirtualAlloc(NULL, - SIZE, - MEM_COMMIT, - PAGE_READONLY); - if (BaseAddress == NULL) - { - printf("Failed to allocate virtual memory"); - return(1); - } - printf("BaseAddress %p\n", BaseAddress); - for (i = 0; i < (SIZE / 4096); i++) - { - printf("%.8x ", i*4096); - x[i] = BaseAddress[i*4096]; - } - - return(0); -} diff --git a/reactos/apps/tests/copymove/.cvsignore b/reactos/apps/tests/copymove/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/copymove/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/copymove/Makefile b/reactos/apps/tests/copymove/Makefile deleted file mode 100644 index 5bd5b47741d..00000000000 --- a/reactos/apps/tests/copymove/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# $Id: Makefile,v 1.2 2003/11/14 17:13:16 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = copymove - -TARGET_OBJECTS = $(TARGET_NAME).o - -TARGET_CFLAGS = -Wall -Werror - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/copymove/copymove.c b/reactos/apps/tests/copymove/copymove.c deleted file mode 100644 index f938368b8bc..00000000000 --- a/reactos/apps/tests/copymove/copymove.c +++ /dev/null @@ -1,303 +0,0 @@ -/* - * CopyFile, MoveFile and related routines test - */ - -#include -#include -#include -#include -#include - -static TCHAR -FindOtherDrive() -{ - DWORD drives = GetLogicalDrives(); - BOOL found = FALSE; - TCHAR drive; - TCHAR rootdir[] = _T( "?:\\" ); - TCHAR currentdir[MAX_PATH + 1]; - - if (0 != GetCurrentDirectory(MAX_PATH + 1, currentdir)) { - for (drive = _T('A'); ! found && drive <= _T('Z'); drive++) { - if (0 != (drives & (1 << (drive - _T('A'))))&& - drive != _totupper(currentdir[0])) { - rootdir[0] = drive; - found = (DRIVE_FIXED == GetDriveType(rootdir)); - } - } - } - - return found ? drive - 1 : _T( ' ' ); -} - -static void -DeleteTestFile(LPCTSTR filename) -{ - SetFileAttributes(filename, FILE_ATTRIBUTE_NORMAL); - DeleteFile(filename); -} - -static void -CreateTestFile(LPCTSTR filename, DWORD attributes) -{ - HANDLE file; - char buffer[4096]; - DWORD wrote; - int c; - - DeleteTestFile(filename); - file = CreateFile(filename, - GENERIC_READ | GENERIC_WRITE, - 0, - NULL, - CREATE_ALWAYS, - 0, - 0); - - if (INVALID_HANDLE_VALUE == file) { - fprintf(stderr, "CreateFile failed with code %lu\n", GetLastError()); - exit(1); - } - for(c = 0; c < sizeof(buffer); c++) { - buffer[c] = (char) c; - } - if (! WriteFile(file, buffer, sizeof(buffer), &wrote, NULL)) { - fprintf(stderr, "WriteFile failed with code %lu\n", GetLastError()); - exit(1); - } - CloseHandle(file); - - if (! SetFileAttributes(filename, attributes)) { - fprintf(stderr, "SetFileAttributes failed with code %lu\n", GetLastError()); - exit(1); - } -} - -static void -DeleteTestDir(LPCTSTR dirname) -{ - RemoveDirectory(dirname); -} - -static void -CreateTestDir(LPCTSTR dirname) -{ - if (! CreateDirectory(dirname, NULL)) { - fprintf(stderr, "CreateDirectory failed with code %lu\n", GetLastError()); - exit(1); - } -} - -static void -CheckTestFile(LPCTSTR filename, DWORD attributes) -{ - HANDLE file; - char buffer[4096]; - DWORD read; - int c; - DWORD diskattr; - - file = CreateFile(filename, - GENERIC_READ, - 0, - NULL, - OPEN_EXISTING, - 0, - 0); - - if (INVALID_HANDLE_VALUE == file) { - fprintf(stderr, "CreateFile failed with code %lu\n", GetLastError()); - exit(1); - } - - if (! ReadFile(file, buffer, sizeof(buffer), &read, NULL)) { - fprintf(stderr, "ReadFile failed with code %lu\n", GetLastError()); - exit(1); - } - if (read != sizeof(buffer)) { - fprintf(stderr, "Trying to read %u bytes but got %lu bytes\n", sizeof(buffer), read); - exit(1); - } - for(c = 0; c < sizeof(buffer); c++) { - if (buffer[c] != (char) c) { - fprintf(stderr, "File contents changed at position %u\n", c); - exit(1); - } - } - - CloseHandle(file); - - diskattr = GetFileAttributes(filename); - if (INVALID_FILE_ATTRIBUTES == diskattr) { - fprintf(stderr, "GetFileAttributes failed with code %lu\n", GetLastError()); - exit(1); - } - if (diskattr != attributes) { - fprintf(stderr, "Attribute mismatch, expected 0x%08lx found 0x%08lx\n", attributes, diskattr); - exit(1); - } -} - -int -main(int argc, char *argv[]) -{ - TCHAR otherdrive; - TCHAR otherfile[ ] = _T("?:\\other.dat"); - - otherdrive = FindOtherDrive(); - - printf("Testing simple move\n"); - CreateTestFile(_T("begin.dat"), FILE_ATTRIBUTE_ARCHIVE); - DeleteTestFile(_T("end.dat")); - if (! MoveFile(_T("begin.dat"), _T("end.dat"))) { - fprintf(stderr, "MoveFile failed with code %lu\n", GetLastError()); - exit(1); - } - CheckTestFile(_T("end.dat"), FILE_ATTRIBUTE_ARCHIVE); - DeleteTestFile(_T("end.dat")); - - printf("Testing move of non-existing file\n"); - DeleteTestFile(_T("begin.dat")); - DeleteTestFile(_T("end.dat")); - if (MoveFile(_T("begin.dat"), _T("end.dat"))) { - fprintf(stderr, "MoveFile succeeded but shouldn't have\n"); - exit(1); - } else if (ERROR_FILE_NOT_FOUND != GetLastError()) { - fprintf(stderr, "MoveFile failed with unexpected code %lu\n", GetLastError()); - exit(1); - } - DeleteTestFile(_T("end.dat")); - -/* Not correctly implemented in ros, destination file is kept open after this */ -#if 0 - printf("Testing move to existing file\n"); - CreateTestFile(_T("begin.dat"), FILE_ATTRIBUTE_ARCHIVE); - CreateTestFile(_T("end.dat"), FILE_ATTRIBUTE_ARCHIVE); - if (MoveFile(_T("begin.dat"), _T("end.dat"))) { - fprintf(stderr, "MoveFile succeeded but shouldn't have\n"); - exit(1); - } else if (ERROR_ALREADY_EXISTS != GetLastError()) { - fprintf(stderr, "MoveFile failed with unexpected code %lu\n", GetLastError()); - exit(1); - } - DeleteTestFile(_T("begin.dat")); - DeleteTestFile(_T("end.dat")); -#endif - -/* Not implemented yet in ros */ -#if 0 - printf("Testing directory move\n"); - CreateTestDir(_T("begin")); - CreateTestFile(_T("begin\\file.dat"), FILE_ATTRIBUTE_NORMAL); - DeleteTestDir(_T("end")); - if (! MoveFile(_T("begin"), _T("end"))) { - fprintf(stderr, "MoveFile failed with code %lu\n", GetLastError()); - exit(1); - } - CheckTestFile(_T("end\\file.dat"), FILE_ATTRIBUTE_NORMAL); - DeleteTestFile(_T("end\\file.dat")); - DeleteTestDir(_T("end")); -#endif - - printf("Testing file move to different directory\n"); - CreateTestFile(_T("file.dat"), FILE_ATTRIBUTE_NORMAL); - CreateTestDir(_T("end")); - if (! MoveFile(_T("file.dat"), _T("end\\file.dat"))) { - fprintf(stderr, "MoveFile failed with code %lu\n", GetLastError()); - exit(1); - } - CheckTestFile(_T("end\\file.dat"), FILE_ATTRIBUTE_ARCHIVE); - DeleteTestFile(_T("end\\file.dat")); - DeleteTestDir(_T("end")); - - printf("Testing move of read-only file\n"); - CreateTestFile(_T("begin.dat"), FILE_ATTRIBUTE_READONLY); - DeleteTestFile(_T("end.dat")); - if (! MoveFile(_T("begin.dat"), _T("end.dat"))) { - fprintf(stderr, "MoveFile failed with code %lu\n", GetLastError()); - exit(1); - } - CheckTestFile(_T("end.dat"), FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_READONLY); - DeleteTestFile(_T("end.dat")); - - printf("Testing move to different drive\n"); - if (_T(' ') != otherdrive) { - otherfile[0] = otherdrive; - CreateTestFile(_T("begin.dat"), FILE_ATTRIBUTE_ARCHIVE); - DeleteTestFile(otherfile); - if (! MoveFile(_T("begin.dat"), otherfile)) { - fprintf(stderr, "MoveFile failed with code %lu\n", GetLastError()); - exit(1); - } - CheckTestFile(otherfile, FILE_ATTRIBUTE_ARCHIVE); - DeleteTestFile(otherfile); - } else { - printf(" Test skipped, no other drive available\n"); - } - - printf("Testing move/overwrite of existing file\n"); - CreateTestFile(_T("begin.dat"), FILE_ATTRIBUTE_ARCHIVE); - CreateTestFile(_T("end.dat"), FILE_ATTRIBUTE_ARCHIVE); - if (! MoveFileEx(_T("begin.dat"), _T("end.dat"), MOVEFILE_REPLACE_EXISTING)) { - fprintf(stderr, "MoveFileEx failed with code %lu\n", GetLastError()); - exit(1); - } - DeleteTestFile(_T("begin.dat")); - DeleteTestFile(_T("end.dat")); - -/* Not (correctly) implemented in ros yet */ -#if 0 - printf("Testing move/overwrite of existing readonly file\n"); - CreateTestFile(_T("begin.dat"), FILE_ATTRIBUTE_ARCHIVE); - CreateTestFile(_T("end.dat"), FILE_ATTRIBUTE_READONLY); - if (MoveFileEx(_T("begin.dat"), _T("end.dat"), MOVEFILE_REPLACE_EXISTING)) { - fprintf(stderr, "MoveFileEx succeeded but shouldn't have\n"); - exit(1); - } else if (ERROR_ALREADY_EXISTS != GetLastError() && - ERROR_ACCESS_DENIED != GetLastError()) { - fprintf(stderr, "MoveFileEx failed with unexpected code %lu\n", GetLastError()); - exit(1); - } - DeleteTestFile(_T("begin.dat")); - DeleteTestFile(_T("end.dat")); -#endif - -/* Not implemented in ros yet */ -#if 0 - printf("Testing move to different drive without COPY_ALLOWED\n"); - if (_T(' ') != otherdrive) { - otherfile[0] = otherdrive; - CreateTestFile(_T("begin.dat"), FILE_ATTRIBUTE_ARCHIVE); - DeleteTestFile(otherfile); - if (MoveFileEx(_T("begin.dat"), otherfile, 0)) { - fprintf(stderr, "MoveFileEx succeeded but shouldn't have\n"); - exit(1); - } else if (ERROR_NOT_SAME_DEVICE != GetLastError()) { - fprintf(stderr, "MoveFileEx failed with unexpected code %lu\n", GetLastError()); - exit(1); - } - DeleteTestFile(otherfile); - } else { - printf(" Test skipped, no other drive available\n"); - } -#endif - - printf("Testing move to different drive with COPY_ALLOWED\n"); - if (_T(' ') != otherdrive) { - otherfile[0] = otherdrive; - CreateTestFile(_T("begin.dat"), FILE_ATTRIBUTE_ARCHIVE); - DeleteTestFile(otherfile); - if (! MoveFileEx(_T("begin.dat"), otherfile, MOVEFILE_COPY_ALLOWED)) { - fprintf(stderr, "MoveFileEx failed with code %lu\n", GetLastError()); - exit(1); - } - CheckTestFile(otherfile, FILE_ATTRIBUTE_ARCHIVE); - DeleteTestFile(otherfile); - } else { - printf(" Test skipped, no other drive available\n"); - } - - printf("All tests successfully completed\n"); - - return 0; -} diff --git a/reactos/apps/tests/thread_msg/.cvsignore b/reactos/apps/tests/thread_msg/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/thread_msg/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/thread_msg/makefile b/reactos/apps/tests/thread_msg/makefile deleted file mode 100644 index 7b0a8da74f9..00000000000 --- a/reactos/apps/tests/thread_msg/makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $Id: makefile,v 1.2 2003/11/14 17:13:21 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = thread_msg - -TARGET_SDKLIBS = kernel32.a user32.a - -TARGET_OBJECTS = $(TARGET_NAME).o - -TARGET_CFLAGS = -Wall -Werror - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/thread_msg/thread_msg.c b/reactos/apps/tests/thread_msg/thread_msg.c deleted file mode 100644 index dc8359b4f94..00000000000 --- a/reactos/apps/tests/thread_msg/thread_msg.c +++ /dev/null @@ -1,97 +0,0 @@ -/** - * Test case for PostThreadMessage - * (C) 2003 ReactOS - * License: LGPL - * See: LGPL.txt in top directory. - * Author: arty - * - * Windows thread message queue test case. - * Derived from ../event/event.c in part. - */ - -#include -#include -#include - -HANDLE hWaitForFailure; -HANDLE hOkToPostThreadMessage; -HANDLE hOkToTerminate; - -DWORD WINAPI thread( LPVOID crap ) -{ - MSG msg; - - /* Failure case ... Wait for the parent to try to post a message - before queue creation */ - printf( "Waiting to create the message queue.\n" ); - - WaitForSingleObject(hWaitForFailure,INFINITE); - - printf( "Creating message queue.\n" ); - - /* "Create" a message queue */ - PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ); - - printf( "Signalling the parent that we're ready.\n" ); - - /* Signal that it's ok to post */ - SetEvent( hOkToPostThreadMessage ); - - printf( "Listening messages.\n" ); - - /* Now read some messages */ - while( GetMessage( &msg, 0,0,0 ) ) { - printf( "Received message: %04x %04x %08lx\n", - (msg.message & 0xffff), - (msg.wParam & 0xffff), - msg.lParam ); - assert( !msg.hwnd ); - } - - printf( "Finished receiving messages.\n" ); - SetEvent( hOkToTerminate ); - - return 0; -} - -int main( int argc, char **argv ) -{ - DWORD id; - - printf( "Creating events\n" ); - - hOkToPostThreadMessage = CreateEvent( NULL, FALSE, FALSE, NULL ); - hOkToTerminate = CreateEvent( NULL, FALSE, FALSE, NULL ); - hWaitForFailure = CreateEvent( NULL, FALSE, FALSE, NULL ); - - printf( "Created events\n" ); - - if( CreateThread( 0, 0, thread, 0, 0, &id ) == NULL ) { - printf( "Couldn't create one thread.\n" ); - return 0; - } - - printf( "Posting to non-existent queue\n" ); - - /* Check failure case */ - assert( PostThreadMessage( id, WM_USER + 0, 1, 2 ) == FALSE ); - - printf( "Signalling thread to advance.\n" ); - - SetEvent( hWaitForFailure ); - - printf( "Waiting for signal from thread.\n" ); - WaitForSingleObject( hOkToPostThreadMessage, INFINITE ); - - printf( "Sending three messages, then quit.\n" ); - assert( PostThreadMessage( id, WM_USER + 0, 1, 2 ) ); - assert( PostThreadMessage( id, WM_USER + 1, 3, 4 ) ); - Sleep( 500 ); /* Sleep a bit, so that the queue is empty for a bit. */ - assert( PostThreadMessage( id, WM_USER + 2, 5, 6 ) ); - assert( PostThreadMessage( id, WM_QUIT, 0,0 ) ); - - WaitForSingleObject( hOkToTerminate, INFINITE ); - printf( "Test complete.\n" ); - - return 0; -} diff --git a/reactos/apps/tests/threadwait/.cvsignore b/reactos/apps/tests/threadwait/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/threadwait/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/threadwait/makefile b/reactos/apps/tests/threadwait/makefile deleted file mode 100644 index 5180a84d3ed..00000000000 --- a/reactos/apps/tests/threadwait/makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $Id: makefile,v 1.2 2003/11/14 17:13:21 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = threadwait - -TARGET_SDKLIBS = ntdll.a - -TARGET_OBJECTS = $(TARGET_NAME).o - -TARGET_CFLAGS = -Wall -Werror - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/threadwait/threadwait.c b/reactos/apps/tests/threadwait/threadwait.c deleted file mode 100644 index 683bcc0d04f..00000000000 --- a/reactos/apps/tests/threadwait/threadwait.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Author: Skywing (skywing@valhallalegends.com) - * Date: 09/09/2003 - * Purpose: Probe for PsUnblockThread crash due to double-acquire spin lock. - */ - -#include -#include - -DWORD __stdcall threadfunc(void* UNREFERENCED) -{ - printf("Thread: Initialized\n"); - Sleep(2500); - printf("Thread: Terminating...\n"); - return 0; -} - -int main(int ac, char **av) -{ - DWORD id; - HANDLE Thread; - - Thread = CreateThread(0, 0, threadfunc, 0, 0, &id); - printf("Main: ThreadId for new thread is %08lx\n", id); - printf("Main: Waiting on thread...\n"); - WaitForSingleObject(Thread, INFINITE); - printf("Main: OK, somebody fixed the PsUnblockThread spinlock double-acquire crash\n"); - NtClose(Thread); - printf("Main: Terminating...\n"); - return 0; -} diff --git a/reactos/apps/tests/tmrqueue/.cvsignore b/reactos/apps/tests/tmrqueue/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/tmrqueue/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/tmrqueue/makefile b/reactos/apps/tests/tmrqueue/makefile deleted file mode 100644 index 58a97d29b1a..00000000000 --- a/reactos/apps/tests/tmrqueue/makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $Id: makefile,v 1.1 2004/07/08 10:32:18 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = tmrqueue - -TARGET_SDKLIBS = kernel32.a - -TARGET_OBJECTS = $(TARGET_NAME).o - -TARGET_CFLAGS = -Wall -Werror - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/tmrqueue/tmrqueue.c b/reactos/apps/tests/tmrqueue/tmrqueue.c deleted file mode 100644 index 5dd2df7f005..00000000000 --- a/reactos/apps/tests/tmrqueue/tmrqueue.c +++ /dev/null @@ -1,365 +0,0 @@ -#include -#include -#include - -#define N_TIMEOUT 3 - -/*******************************************************************************/ - -typedef struct _TEST *PTEST; - -typedef VOID (*PFNTEST)(PTEST Test, HANDLE hEvent); - -typedef struct _TEST -{ - TCHAR *description; - BOOL Result; - PFNTEST Routine; - int id; -} TEST; - -static TEST Tests[3]; - -VOID RunTests(VOID) -{ - int i, nTests; - static HANDLE hEvent; - - hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); - if(hEvent == NULL) - { - _tprintf(_T("Unable to create event!")); - return; - } - - nTests = sizeof(Tests) / sizeof(TEST); - - for(i = 0; i < nTests; i++) - { - Tests[i].id = i + 1; - - if(Tests[i].Routine == NULL) - { - continue; - } - - _tprintf(_T("+++ TEST %d: %s\n"), Tests[i].id, Tests[i].description); - - Tests[i].Routine(&Tests[i], hEvent); - - WaitForSingleObject(hEvent, INFINITE); - - _tprintf(_T("\n\n")); - } - - CloseHandle(hEvent); -} - -VOID PrintTestResults(VOID) -{ - int i, nTests, nsuccess = 0, nfailed = 0; - TCHAR *status; - - nTests = sizeof(Tests) / sizeof(TEST); - - for(i = 0; i < nTests; i++) - { - if(Tests[i].Routine == NULL) - { - status = _T("SKIPPED"); - } - else if(Tests[i].Result == TRUE) - { - status = _T("SUCCESS"); - nsuccess++; - } - else - { - status = _T("FAILED "); - nfailed++; - } - - _tprintf(_T("Test %d: %s %s\n"), i, status, Tests[i].description); - } - - _tprintf(_T("\nTests succeeded: %d, failed: %d\n"), nsuccess, nfailed); - if(nfailed == 0) - { - _tprintf(_T(" ALL TESTS SUCCESSFUL!\n")); - } -} - -/*******************************************************************************/ - -typedef struct _TESTINFO -{ - PTEST Test; - int secsleft; - HANDLE hTimer; - HANDLE hEvent; - /* additional stuff */ - union - { - struct - { - /* nothing */ - } Test1; - struct - { - HANDLE hWaitEvent; - } Test2; - struct - { - HANDLE hWaitEvent; - HANDLE hNotification; - } Test3; - }; -} TESTINFO, *PTESTINFO; - -VOID CALLBACK TimerCallback1(PVOID Param, BOOLEAN Fired) -{ - PTESTINFO Info = (PTESTINFO)Param; - - _tprintf(_T("[%d]TimerCallback(0x%x, %d) called (%d)\n"), (int)Info->Test->id, (int)Info->hTimer, (int)Fired, --Info->secsleft); - - if(Info->secsleft == 0) - { - BOOL stat; - - _tprintf(_T("[%d]Timout finished, delete timer queue..."), (int)Info->Test->id); - stat = DeleteTimerQueueTimer(NULL, Info->hTimer, NULL); - if(stat) - _tprintf(_T("returned OK -> test FAILED!\n")); - else - { - int error = GetLastError(); - - switch(error) - { - case ERROR_IO_PENDING: - _tprintf(_T("OK, Overlapped I/O operation in progress\n")); - /* this test is only successful in this case */ - Info->Test->Result = TRUE; - break; - default: - _tprintf(_T("Failed, LastError: %d\n"), (int)GetLastError()); - break; - } - } - - /* set the event to continue tests */ - SetEvent(Info->hEvent); - } -} - -VOID Test1(PTEST Test, HANDLE hEvent) -{ - static TESTINFO Info; - - Info.Test = Test; - Info.hEvent = hEvent; - Info.secsleft = N_TIMEOUT; - - if(!CreateTimerQueueTimer(&Info.hTimer, NULL, TimerCallback1, &Info, 1000, 1000, 0)) - { - _tprintf(_T("[%d]CreateTimerQueueTimer() failed, LastError: %d!"), (int)Info.Test->id, (int)GetLastError()); - /* we failed, set the event to continue tests */ - SetEvent(hEvent); - return; - } - - _tprintf(_T("[%d]CreateTimerQueueTimer() created timer 0x%x, countdown (%d sec)...\n"), (int)Info.Test->id, (int)Info.hTimer, (int)Info.secsleft); -} - -/*******************************************************************************/ - -VOID CALLBACK TimerCallback2(PVOID Param, BOOLEAN Fired) -{ - PTESTINFO Info = (PTESTINFO)Param; - - _tprintf(_T("[%d]TimerCallback(0x%x, %d) called (%d)\n"), (int)Info->Test->id, (int)Info->hTimer, (int)Fired, --Info->secsleft); - - if(Info->secsleft == 0) - { - /* set the event to continue tests */ - SetEvent(Info->Test2.hWaitEvent); - - /* sleep a bit */ - Sleep(1500); - } -} - -VOID Test2(PTEST Test, HANDLE hEvent) -{ - static TESTINFO Info; - BOOL stat; - - Info.Test = Test; - Info.hEvent = hEvent; - Info.secsleft = N_TIMEOUT; - - Info.Test2.hWaitEvent = CreateEvent(NULL, FALSE, FALSE, NULL); - if(Info.Test2.hWaitEvent == NULL) - { - _tprintf(_T("[%d]Unable to create event!\n"), (int)Info.Test->id); - return; - } - - if(!CreateTimerQueueTimer(&Info.hTimer, NULL, TimerCallback2, &Info, 1000, 1000, 0)) - { - _tprintf(_T("[%d]CreateTimerQueueTimer() failed, LastError: %d!"), (int)Info.Test->id, (int)GetLastError()); - - CloseHandle(Info.Test2.hWaitEvent); - /* we failed, set the event to continue tests */ - SetEvent(hEvent); - return; - } - - _tprintf(_T("[%d]CreateTimerQueueTimer() created timer 0x%x, countdown (%d sec)...\n"), (int)Test->id, (int)Info.hTimer, (int)Info.secsleft); - - WaitForSingleObject(Info.Test2.hWaitEvent, INFINITE); - - _tprintf(_T("[%d]Timout finished, delete timer queue..."), (int)Test->id); - stat = DeleteTimerQueueTimer(NULL, Info.hTimer, INVALID_HANDLE_VALUE); - if(stat) - { - _tprintf(_T("OK\n")); - /* this test is only successful in this case */ - Test->Result = TRUE; - } - else - { - int error = GetLastError(); - - switch(error) - { - case ERROR_IO_PENDING: - _tprintf(_T("FAILED, Overlapped I/O operation in progress\n")); - break; - default: - _tprintf(_T("Failed, LastError: %d\n"), (int)GetLastError()); - break; - } - } - - SetEvent(Info.hEvent); -} - -/*******************************************************************************/ - -VOID CALLBACK TimerCallback3(PVOID Param, BOOLEAN Fired) -{ - PTESTINFO Info = (PTESTINFO)Param; - - _tprintf(_T("[%d]TimerCallback(0x%x, %d) called (%d)\n"), (int)Info->Test->id, (int)Info->hTimer, (int)Fired, --Info->secsleft); - - if(Info->secsleft == 0) - { - /* set the event to continue tests */ - SetEvent(Info->Test3.hWaitEvent); - - /* sleep a bit */ - Sleep(1500); - } -} - -VOID Test3(PTEST Test, HANDLE hEvent) -{ - static TESTINFO Info; - BOOL stat; - - Info.Test = Test; - Info.hEvent = hEvent; - Info.secsleft = N_TIMEOUT; - - Info.Test3.hWaitEvent = CreateEvent(NULL, FALSE, FALSE, NULL); - if(Info.Test3.hWaitEvent == NULL) - { - _tprintf(_T("[%d]Unable to create event!\n"), (int)Info.Test->id); - return; - } - - Info.Test3.hNotification = CreateEvent(NULL, FALSE, FALSE, NULL); - if(Info.Test3.hNotification == NULL) - { - _tprintf(_T("[%d]Unable to create notification event!\n"), (int)Info.Test->id); - return; - } - - if(!CreateTimerQueueTimer(&Info.hTimer, NULL, TimerCallback3, &Info, 1000, 1000, 0)) - { - _tprintf(_T("[%d]CreateTimerQueueTimer() failed, LastError: %d!"), (int)Info.Test->id, (int)GetLastError()); - - CloseHandle(Info.Test3.hWaitEvent); - CloseHandle(Info.Test3.hNotification); - /* we failed, set the event to continue tests */ - SetEvent(hEvent); - return; - } - - _tprintf(_T("[%d]CreateTimerQueueTimer() created timer 0x%x, countdown (%d sec)...\n"), (int)Test->id, (int)Info.hTimer, (int)Info.secsleft); - - WaitForSingleObject(Info.Test3.hWaitEvent, INFINITE); - - _tprintf(_T("[%d]Timout finished, delete timer queue..."), (int)Test->id); - stat = DeleteTimerQueueTimer(NULL, Info.hTimer, Info.Test3.hNotification); - if(stat) - { - _tprintf(_T("returned OK -> test FAILED!\n")); - } - else - { - int error = GetLastError(); - - switch(error) - { - case ERROR_IO_PENDING: - _tprintf(_T("OK, Overlapped I/O operation in progress\n")); - /* this test is only successful in this case */ - Test->Result = TRUE; - break; - default: - _tprintf(_T("Failed, LastError: %d\n"), (int)GetLastError()); - break; - } - } - - WaitForSingleObject(Info.Test3.hNotification, INFINITE); - - CloseHandle(Info.Test3.hWaitEvent); - CloseHandle(Info.Test3.hNotification); - - SetEvent(Info.hEvent); -} - -/*******************************************************************************/ - -VOID -InitTests(VOID) -{ - ZeroMemory(Tests, sizeof(Tests)); - - Tests[0].description = _T("non-blocking DeleteTimerQueueTimer() call from callback"); - Tests[0].Routine = Test1; - - Tests[1].description = _T("blocking DeleteTimerQueueTimer() call"); - Tests[1].Routine = Test2; - - Tests[2].description = _T("blocking DeleteTimerQueueTimer() call with specified event"); - Tests[2].Routine = Test3; -} - -int main(int argc, char* argv[]) -{ - _tprintf(_T("+++ TimerQueue test running +++\n\n")); - - InitTests(); - - RunTests(); - - _tprintf(_T("\n+++ RESULTS +++\n")); - - PrintTestResults(); - - return 0; -} diff --git a/reactos/apps/tests/tokentest/.cvsignore b/reactos/apps/tests/tokentest/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/tokentest/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/tokentest/makefile b/reactos/apps/tests/tokentest/makefile deleted file mode 100644 index 97c219b8884..00000000000 --- a/reactos/apps/tests/tokentest/makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $Id: makefile,v 1.3 2003/11/14 17:13:22 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = tokentst - -TARGET_SDKLIBS = ntdll.a kernel32.a - -TARGET_OBJECTS = tokentest.o - -TARGET_CFLAGS = -Wall -Werror -Wno-format - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/tokentest/tokentest.c b/reactos/apps/tests/tokentest/tokentest.c deleted file mode 100644 index 6578f522d72..00000000000 --- a/reactos/apps/tests/tokentest/tokentest.c +++ /dev/null @@ -1,529 +0,0 @@ -#define UNICODE -#define _UNICODE - -#define ANONYMOUSUNIONS -#include -#include - -#define INCLUDE_THE_DDK_HEADERS -#ifdef INCLUDE_THE_DDK_HEADERS -#include -#define ROS_ACE_HEADER ACE_HEADER -#define ROS_ACE ACE - -// -// Allocate the System Luid. The first 1000 LUIDs are reserved. -// Use #999 here (0x3E7 = 999) -// - -#define SYSTEM_LUID { 0x3E7, 0x0 } -#define ANONYMOUS_LOGON_LUID { 0x3e6, 0x0 } -#define LOCALSERVICE_LUID { 0x3e5, 0x0 } -#define NETWORKSERVICE_LUID { 0x3e4, 0x0 } - -#else -typedef LONG NTSTATUS, *PNTSTATUS; - -typedef struct _UNICODE_STRING -{ - USHORT Length; - USHORT MaximumLength; - PWSTR Buffer; -} UNICODE_STRING, *PUNICODE_STRING; - -typedef struct _OBJECT_ATTRIBUTES { - ULONG Length; - HANDLE RootDirectory; - PUNICODE_STRING ObjectName; - ULONG Attributes; - PVOID SecurityDescriptor; // Points to type SECURITY_DESCRIPTOR - PVOID SecurityQualityOfService; // Points to type SECURITY_QUALITY_OF_SERVICE -} OBJECT_ATTRIBUTES; -typedef OBJECT_ATTRIBUTES *POBJECT_ATTRIBUTES; - -typedef struct _ROS_ACE_HEADER -{ - CHAR AceType; - CHAR AceFlags; - USHORT AceSize; -} ROS_ACE_HEADER, *PROS_ACE_HEADER; - -typedef struct -{ - ACE_HEADER Header; - ACCESS_MASK AccessMask; -} ROS_ACE, *PROS_ACE; - -NTSYSAPI -NTSTATUS -NTAPI -RtlConvertSidToUnicodeString ( - IN OUT PUNICODE_STRING String, - IN PSID Sid, - IN BOOLEAN AllocateString - ); - -NTSYSAPI -NTSTATUS -NTAPI -RtlCreateAcl( - PACL Acl, - ULONG AclSize, - ULONG AclRevision); - -NTSYSAPI -NTSTATUS -NTAPI -RtlAddAccessAllowedAce ( - PACL Acl, - ULONG Revision, - ACCESS_MASK AccessMask, - PSID Sid - ); - -NTSYSAPI -NTSTATUS -NTAPI -RtlGetAce ( - PACL Acl, - ULONG AceIndex, - PROS_ACE *Ace - ); - -NTSYSAPI -NTSTATUS -NTAPI -ZwAllocateLocallyUniqueId( - OUT PLUID Luid - ); - -NTSYSAPI -NTSTATUS -NTAPI -ZwCreateToken( - OUT PHANDLE TokenHandle, - IN ACCESS_MASK DesiredAccess, - IN POBJECT_ATTRIBUTES ObjectAttributes, - IN TOKEN_TYPE TokenType, - IN PLUID AuthenticationId, - IN PLARGE_INTEGER ExpirationTime, - IN PTOKEN_USER TokenUser, - IN PTOKEN_GROUPS TokenGroups, - IN PTOKEN_PRIVILEGES TokenPrivileges, - IN PTOKEN_OWNER TokenOwner, - IN PTOKEN_PRIMARY_GROUP TokenPrimaryGroup, - IN PTOKEN_DEFAULT_DACL TokenDefaultDacl, - IN PTOKEN_SOURCE TokenSource - ); -#define NT_SUCCESS(StatCode) ((NTSTATUS)(StatCode) >= 0) -#endif -#include - -#define INITIAL_PRIV_ENABLED SE_PRIVILEGE_ENABLED_BY_DEFAULT|SE_PRIVILEGE_ENABLED -#define INITIAL_PRIV_DISABLED 0 -LUID_AND_ATTRIBUTES InitialPrivilegeSet[] = -{ - { { 0x00000007, 0x00000000 }, INITIAL_PRIV_ENABLED }, // SeTcbPrivilege - { { 0x00000002, 0x00000000 }, INITIAL_PRIV_DISABLED }, // SeCreateTokenPrivilege - { { 0x00000009, 0x00000000 }, INITIAL_PRIV_DISABLED }, // SeTakeOwnershipPrivilege - { { 0x0000000f, 0x00000000 }, INITIAL_PRIV_ENABLED }, // SeCreatePagefilePrivilege - { { 0x00000004, 0x00000000 }, INITIAL_PRIV_ENABLED }, // SeLockMemoryPrivilege - { { 0x00000003, 0x00000000 }, INITIAL_PRIV_DISABLED }, // SeAssignPrimaryTokenPrivilege - { { 0x00000005, 0x00000000 }, INITIAL_PRIV_DISABLED }, // SeIncreaseQuotaPrivilege - { { 0x0000000e, 0x00000000 }, INITIAL_PRIV_ENABLED }, // SeIncreaseBasePriorityPrivilege - { { 0x00000010, 0x00000000 }, INITIAL_PRIV_ENABLED }, // SeCreatePermanentPrivilege - { { 0x00000014, 0x00000000 }, INITIAL_PRIV_ENABLED }, // SeDebugPrivilege - { { 0x00000015, 0x00000000 }, INITIAL_PRIV_ENABLED }, // SeAuditPrivilege - { { 0x00000008, 0x00000000 }, INITIAL_PRIV_DISABLED }, // SeSecurityPrivilege - { { 0x00000016, 0x00000000 }, INITIAL_PRIV_DISABLED }, // SeSystemEnvironmentPrivilege - { { 0x00000017, 0x00000000 }, INITIAL_PRIV_ENABLED }, // SeChangeNotifyPrivilege - { { 0x00000011, 0x00000000 }, INITIAL_PRIV_DISABLED }, // SeBackupPrivilege - { { 0x00000012, 0x00000000 }, INITIAL_PRIV_DISABLED }, // SeRestorePrivilege - { { 0x00000013, 0x00000000 }, INITIAL_PRIV_DISABLED }, // SeShutdownPrivilege - { { 0x0000000a, 0x00000000 }, INITIAL_PRIV_DISABLED }, // SeLoadDriverPrivilege - { { 0x0000000d, 0x00000000 }, INITIAL_PRIV_ENABLED }, // SeProfileSingleProcessPrivilege - { { 0x0000000c, 0x00000000 }, INITIAL_PRIV_DISABLED }, // SeSystemtimePrivilege - { { 0x00000019, 0x00000000 }, INITIAL_PRIV_DISABLED }, // SeUndockPrivilege - { { 0x0000001c, 0x00000000 }, INITIAL_PRIV_DISABLED }, // SeManageVolumePrivilege -}; - -typedef struct _SID_2 -{ - UCHAR Revision; - UCHAR SubAuthorityCount; - SID_IDENTIFIER_AUTHORITY IdentifierAuthority; - ULONG SubAuthority[2]; -} SID_2; - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -void -PrintSid(SID_AND_ATTRIBUTES* pSid, TOKEN_OWNER* pOwner, TOKEN_PRIMARY_GROUP* pPrimary) -{ - UNICODE_STRING scSid; - - RtlConvertSidToUnicodeString(&scSid, pSid->Sid, TRUE); - printf("%wZ [", &scSid); - LocalFree(scSid.Buffer); - - if ( EqualSid(pSid->Sid, pOwner->Owner) ) - printf("owner,"); - - if ( EqualSid(pSid->Sid, pPrimary->PrimaryGroup) ) - printf("primary,"); - - if ( pSid->Attributes & SE_GROUP_ENABLED ) - { - if ( pSid->Attributes & SE_GROUP_ENABLED_BY_DEFAULT ) - printf("enabled-default,"); - else - printf("enabled,"); - } - - if ( pSid->Attributes & SE_GROUP_LOGON_ID ) - printf("logon,"); - - - if ( pSid->Attributes & SE_GROUP_MANDATORY ) - printf("mandatory,"); - - printf("]\n"); -} - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -void -DisplayTokenSids(TOKEN_USER* pUser, - TOKEN_GROUPS* pGroups, - TOKEN_OWNER* pOwner, - TOKEN_PRIMARY_GROUP* pPrimary) -{ - DWORD i; - - printf("\nSids:\n"); - PrintSid(&pUser->User, pOwner, pPrimary); - printf("\nGroups:\n"); - for (i = 0; i < pGroups->GroupCount; i++) - PrintSid(&pGroups->Groups[i], pOwner, pPrimary); -} - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -void -DisplayTokenPrivileges(TOKEN_PRIVILEGES* pPriv) -{ - WCHAR buffer[256]; - DWORD i; - - printf("\nprivileges:\n"); - for (i = 0; i < pPriv->PrivilegeCount; i++) - { - DWORD cbName = sizeof(buffer) / sizeof(buffer[0]); - LookupPrivilegeName(0, &pPriv->Privileges[i].Luid, buffer, &cbName); - - printf("%S{0x%08x, 0x%08x} [", buffer, pPriv->Privileges[i].Luid.HighPart, pPriv->Privileges[i].Luid.LowPart); - - if ( pPriv->Privileges[i].Attributes & SE_PRIVILEGE_ENABLED ) - printf("enabled,"); - if ( pPriv->Privileges[i].Attributes & SE_PRIVILEGE_ENABLED_BY_DEFAULT ) - printf("default,"); - if ( pPriv->Privileges[i].Attributes & SE_PRIVILEGE_USED_FOR_ACCESS ) - printf("used"); - - printf("]\n"); - } -} - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -void -DisplayDacl(PACL pAcl) -{ - DWORD i; - NTSTATUS status; - - if ( ! pAcl ) - { - printf("\nNo Default Dacl.\n"); - return; - } - - printf("\nDacl:\n"); - for (i = 0; i < pAcl->AceCount; i++) - { - UNICODE_STRING scSid; - ROS_ACE* pAce; - LPWSTR wszType = 0; - PSID pSid; - - status = RtlGetAce(pAcl, i, (ROS_ACE**) &pAce); - if ( ! NT_SUCCESS(status) ) - { - printf("RtlGetAce(): status = 0x%08x\n", status); - break; - } - - pSid = (PSID) (pAce + 1); - if ( pAce->Header.AceType == ACCESS_ALLOWED_ACE_TYPE ) - wszType = L"allow"; - if ( pAce->Header.AceType == ACCESS_DENIED_ACE_TYPE ) - wszType = L"deny "; - - status = RtlConvertSidToUnicodeString(&scSid, pSid, TRUE); - if ( ! NT_SUCCESS(status) ) - { - printf("RtlConvertSidToUnicodeString(): status = 0x%08x\n", status); - break; - } - - printf("%d.) %S %wZ 0x%08x\n", i, wszType, &scSid, pAce->AccessMask); - LocalFree(scSid.Buffer); - } -} - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -PVOID -GetFromToken(HANDLE hToken, TOKEN_INFORMATION_CLASS tic) -{ - BOOL bResult; - DWORD n; - PBYTE p = 0; - - bResult = GetTokenInformation(hToken, tic, 0, 0, &n); - if ( ! bResult && GetLastError() != ERROR_INSUFFICIENT_BUFFER) - return 0; - - p = (PBYTE) malloc(n); - if ( ! GetTokenInformation(hToken, tic, p, n, &n) ) - { - printf("GetFromToken() failed for TOKEN_INFORMATION_CLASS(%d): %d\n", tic, GetLastError()); - free(p); - return 0; - } - - return p; -} - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -void -DisplayToken(HANDLE hTokenSource) -{ - TOKEN_USER* pTokenUser = (PTOKEN_USER) GetFromToken(hTokenSource, TokenUser); - TOKEN_GROUPS* pTokenGroups = (PTOKEN_GROUPS) GetFromToken(hTokenSource, TokenGroups); - TOKEN_OWNER* pTokenOwner = (PTOKEN_OWNER) GetFromToken(hTokenSource, TokenOwner); - TOKEN_PRIMARY_GROUP* pTokenPrimaryGroup = (PTOKEN_PRIMARY_GROUP) GetFromToken(hTokenSource, TokenPrimaryGroup); - TOKEN_PRIVILEGES* pTokenPrivileges = (PTOKEN_PRIVILEGES) GetFromToken(hTokenSource, TokenPrivileges); - TOKEN_DEFAULT_DACL* pTokenDefaultDacl = (PTOKEN_DEFAULT_DACL) GetFromToken(hTokenSource, TokenDefaultDacl); - - DisplayTokenSids(pTokenUser, pTokenGroups, pTokenOwner, pTokenPrimaryGroup); - // DisplayTokenPrivileges(pTokenPrivileges); - DisplayDacl(pTokenDefaultDacl->DefaultDacl); - - free(pTokenUser); - free(pTokenGroups); - free(pTokenOwner); - free(pTokenPrimaryGroup); - free(pTokenPrivileges); - free(pTokenDefaultDacl); -} - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -BOOL -EnablePrivilege(LPWSTR wszName) -{ - HANDLE hToken; - TOKEN_PRIVILEGES priv = {1, {{{0, 0}, SE_PRIVILEGE_ENABLED}}}; - BOOL bResult; - - LookupPrivilegeValue(0, wszName, &priv.Privileges[0].Luid); - - OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken); - - AdjustTokenPrivileges(hToken, FALSE, &priv, sizeof priv, 0, 0); - bResult = GetLastError() == ERROR_SUCCESS; - - CloseHandle(hToken); - return bResult; -} - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -NTSTATUS -CreateInitialSystemToken(HANDLE* phSystemToken) -{ - static SID sidSystem = { 1, 1, {SECURITY_NT_AUTHORITY}, {SECURITY_LOCAL_SYSTEM_RID} }; - static SID sidEveryone = { 1, 1, {SECURITY_WORLD_SID_AUTHORITY}, {SECURITY_WORLD_RID} }; - static SID sidAuthenticatedUser = { 1, 1, {SECURITY_NT_AUTHORITY}, {SECURITY_AUTHENTICATED_USER_RID} }; - static SID_2 sidAdministrators = { 1, 2, {SECURITY_NT_AUTHORITY}, {SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS} }; - static const int nGroupCount = 3; - - NTSTATUS status; - ULONG uSize; - DWORD i; - - TOKEN_USER tkUser; - TOKEN_OWNER tkDefaultOwner; - TOKEN_PRIMARY_GROUP tkPrimaryGroup; - - TOKEN_GROUPS* ptkGroups = 0; - TOKEN_PRIVILEGES* ptkPrivileges = 0; - TOKEN_DEFAULT_DACL tkDefaultDacl = { 0 }; - - LARGE_INTEGER tkExpiration; - - LUID authId = SYSTEM_LUID; - - TOKEN_SOURCE source = - { - { '*', '*', 'A', 'N', 'O', 'N', '*', '*' }, - {0, 0} - }; - - SECURITY_QUALITY_OF_SERVICE sqos = - { - sizeof(sqos), - SecurityAnonymous, - SECURITY_STATIC_TRACKING, - FALSE - }; - - OBJECT_ATTRIBUTES oa = - { - sizeof(oa), - 0, - 0, - 0, - 0, - &sqos - }; - - tkExpiration.QuadPart = -1; - status = ZwAllocateLocallyUniqueId(&source.SourceIdentifier); - if ( status != 0 ) - return status; - - tkUser.User.Sid = &sidSystem; - tkUser.User.Attributes = 0; - - // Under WinXP (the only MS OS I've tested) ZwCreateToken() - // squawks if we use sidAdministrators here -- though running - // a progrem under AT and using the DisplayToken() function - // shows that the system token does default ownership to - // Administrator. - - // For now, default ownership to system, since that works - tkDefaultOwner.Owner = &sidSystem; - tkPrimaryGroup.PrimaryGroup = &sidSystem; - - uSize = sizeof(TOKEN_GROUPS) - sizeof(ptkGroups->Groups); - uSize += sizeof(SID_AND_ATTRIBUTES) * nGroupCount; - - ptkGroups = (TOKEN_GROUPS*) malloc(uSize); - ptkGroups->GroupCount = nGroupCount; - - ptkGroups->Groups[0].Sid = (SID*) &sidAdministrators; - ptkGroups->Groups[0].Attributes = SE_GROUP_ENABLED; - - ptkGroups->Groups[1].Sid = &sidEveryone; - ptkGroups->Groups[1].Attributes = SE_GROUP_ENABLED|SE_GROUP_ENABLED_BY_DEFAULT|SE_GROUP_MANDATORY; - - ptkGroups->Groups[2].Sid = &sidAuthenticatedUser; - ptkGroups->Groups[2].Attributes = SE_GROUP_ENABLED|SE_GROUP_ENABLED_BY_DEFAULT|SE_GROUP_MANDATORY; - - uSize = sizeof(TOKEN_PRIVILEGES) - sizeof(ptkPrivileges->Privileges); - uSize += sizeof(LUID_AND_ATTRIBUTES) * sizeof(InitialPrivilegeSet) / sizeof(InitialPrivilegeSet[0]); - ptkPrivileges = (TOKEN_PRIVILEGES*) malloc(uSize); - ptkPrivileges->PrivilegeCount = sizeof(InitialPrivilegeSet) / sizeof(InitialPrivilegeSet[0]); - for (i = 0; i < ptkPrivileges->PrivilegeCount; i++) - { - ptkPrivileges->Privileges[i].Luid.HighPart = InitialPrivilegeSet[i].Luid.HighPart; - ptkPrivileges->Privileges[i].Luid.LowPart = InitialPrivilegeSet[i].Luid.LowPart; - ptkPrivileges->Privileges[i].Attributes = InitialPrivilegeSet[i].Attributes; - } - - // Calculate the length needed for the ACL - uSize = sizeof(ACL); - uSize += sizeof(ACE) + sizeof(sidSystem); - uSize += sizeof(ACE) + sizeof(sidAdministrators); - uSize = (uSize & (~3)) + 8; - tkDefaultDacl.DefaultDacl = (PACL) malloc(uSize); - - status = RtlCreateAcl(tkDefaultDacl.DefaultDacl, uSize, ACL_REVISION); - if ( ! NT_SUCCESS(status) ) - printf("RtlCreateAcl() failed: 0x%08x\n", status); - - status = RtlAddAccessAllowedAce(tkDefaultDacl.DefaultDacl, ACL_REVISION, GENERIC_ALL, &sidSystem); - if ( ! NT_SUCCESS(status) ) - printf("RtlAddAccessAllowedAce() failed: 0x%08x\n", status); - - status = RtlAddAccessAllowedAce(tkDefaultDacl.DefaultDacl, ACL_REVISION, GENERIC_READ|GENERIC_EXECUTE|READ_CONTROL, (PSID) &sidAdministrators); - if ( ! NT_SUCCESS(status) ) - printf("RtlAddAccessAllowedAce() failed: 0x%08x\n", status); - - printf("Parameters being passed into ZwCreateToken:\n\n"); - DisplayTokenSids(&tkUser, ptkGroups, &tkDefaultOwner, &tkPrimaryGroup); - DisplayDacl(tkDefaultDacl.DefaultDacl); - - printf("Calling ZwCreateToken()...\n"); - status = ZwCreateToken(phSystemToken, - TOKEN_ALL_ACCESS, - &oa, - TokenPrimary, - &authId, - &tkExpiration, - &tkUser, - ptkGroups, - ptkPrivileges, - &tkDefaultOwner, - &tkPrimaryGroup, - &tkDefaultDacl, - &source); - - // Cleanup - free(ptkGroups); - free(ptkPrivileges); - free(tkDefaultDacl.DefaultDacl); - - return status; -} - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -int -main(int argc, char* argv[]) -{ - NTSTATUS Status; - HANDLE hSystemToken; - CHAR buffer[512]; - HANDLE hOurToken; - - printf("Current process Token:\n"); - - Status=ZwOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY|TOKEN_QUERY_SOURCE, &hOurToken); - if ( NT_SUCCESS(Status) ) - { - DisplayToken(hOurToken); - CloseHandle(hOurToken); - } - else - { - printf("ZwOpenProcessToken() failed: 0x%08x\n", Status); - } - -//#define ENABLE_PRIVILEGE -#ifdef ENABLE_PRIVILEGE - EnablePrivilege(SE_CREATE_TOKEN_NAME); -#endif - - // Now do the other one - Status = CreateInitialSystemToken(&hSystemToken); - if ( NT_SUCCESS(Status) ) - { - printf("System Token: 0x%08x\n", hSystemToken); - DisplayToken(hSystemToken); - CloseHandle(hSystemToken); - } - else - { - printf("CreateInitialSystemToken() return: 0x%08x\n", Status); - } - - printf("press return"); - gets(buffer); - - return 0; -} diff --git a/reactos/apps/tests/txtscale/.cvsignore b/reactos/apps/tests/txtscale/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/txtscale/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/txtscale/Makefile b/reactos/apps/tests/txtscale/Makefile deleted file mode 100644 index fa24392842f..00000000000 --- a/reactos/apps/tests/txtscale/Makefile +++ /dev/null @@ -1,33 +0,0 @@ - -PATH_TO_TOP = ../../.. - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = txtscale - -TARGET_NORC = yes - -TARGET_CFLAGS = -fexceptions -g -O0 -DWIN32 -D_DEBUG -D_WINDOWS -D_MBCS -W -D__USE_W32API -D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501 -Wall -Werror - -TARGET_CPPFLAGS = -fexceptions -g -O0 -DWIN32 -D_DEBUG -D_WINDOWS -D_MBCS -W -D__USE_W32API -D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501 -Wall -Werror - -TARGET_SDKLIBS = \ - kernel32.a \ - user32.a \ - gdi32.a \ - comctl32.a - -TARGET_OBJECTS = \ - txtscale.o \ - mk_font.o - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# overide LD_CC to use g++ for linking of the executable -LD_CC = $(CXX) - -# EOF diff --git a/reactos/apps/tests/txtscale/mk_font.cpp b/reactos/apps/tests/txtscale/mk_font.cpp deleted file mode 100644 index 59e3cf8ca93..00000000000 --- a/reactos/apps/tests/txtscale/mk_font.cpp +++ /dev/null @@ -1,69 +0,0 @@ - -// ------------------------------------------------------------------ -// Windows 2000 Graphics API Black Book -// Chapter 4 - Utility functions -// -// Created by Damon Chandler -// Updates can be downloaded at: -// -// Please do not hesistate to e-mail me at dmc27@ee.cornell.edu -// if you have any questions about this code. -// ------------------------------------------------------------------ - -//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -#include -#include - -#include "mk_font.h" -//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - -namespace font { - -// creates a logical font -HFONT MakeFont( - IN HDC hDestDC, // handle to target DC - IN LPCSTR typeface_name, // font's typeface name - IN int point_size, // font's point size - IN const BYTE charset, // font's character set - IN const DWORD style // font's styles - ) -{ - // - // NOTE: On Windows 9x/Me, GetWorldTransform is not - // supported. For compatibility with these platforms you - // should initialize the XFORM::eM22 data member to 1.0. - // - XFORM xf = {0, 0, 0, 1.0, 0, 0}; - GetWorldTransform(hDestDC, &xf); - int pixels_per_inch = GetDeviceCaps(hDestDC, LOGPIXELSY); - - POINT PSize = { - 0, - -MulDiv(static_cast(xf.eM22 * point_size + 0.5), - pixels_per_inch, 72) - }; - - HFONT hResult = NULL; - if (DPtoLP(hDestDC, &PSize, 1)) - { - LOGFONT lf; - memset(&lf, 0, sizeof(LOGFONT)); - - lf.lfHeight = PSize.y; - lf.lfCharSet = charset; - lstrcpyn(reinterpret_cast(&lf.lfFaceName), - typeface_name, LF_FACESIZE); - - lf.lfWeight = (style & FS_BOLD) ? FW_BOLD : FW_DONTCARE; - lf.lfItalic = (style & FS_ITALIC) ? true : false; - lf.lfUnderline = (style & FS_UNDERLINE) ? true : false; - lf.lfStrikeOut = (style & FS_STRIKEOUT) ? true : false; - - // create the logical font - hResult = CreateFontIndirect(&lf); - } - return hResult; -} -//------------------------------------------------------------------------- - -} // namespace font diff --git a/reactos/apps/tests/txtscale/mk_font.h b/reactos/apps/tests/txtscale/mk_font.h deleted file mode 100644 index 98c164c9f1d..00000000000 --- a/reactos/apps/tests/txtscale/mk_font.h +++ /dev/null @@ -1,39 +0,0 @@ - -// ------------------------------------------------------------------ -// Windows 2000 Graphics API Black Book -// Chapter 4 - Utility functions -// -// Created by Damon Chandler -// Updates can be downloaded at: -// -// Please do not hesistate to e-mail me at dmc27@ee.cornell.edu -// if you have any questions about this code. -// ------------------------------------------------------------------ - -//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -#ifndef CH4_UTILS_H -#define CH4_UTILS_H - -#include -//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - -// change namespace name appropriately to suit your needs -namespace font { - -// font options -static const ULONG FS_NONE = 0x00000000; -static const ULONG FS_BOLD = 0x00000001; -static const ULONG FS_ITALIC = 0x00000002; -static const ULONG FS_UNDERLINE = 0x00000004; -static const ULONG FS_STRIKEOUT = 0x00000008; - -// creates a logical font -HFONT MakeFont(IN HDC hDestDC, IN LPCSTR typeface_name, - IN int point_size, IN const BYTE charset = ANSI_CHARSET, - IN const DWORD style = FS_NONE); - -} - -//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -#endif // CH4_UTILS_H -//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< diff --git a/reactos/apps/tests/txtscale/txtscale.cpp b/reactos/apps/tests/txtscale/txtscale.cpp deleted file mode 100644 index c77216b11b8..00000000000 --- a/reactos/apps/tests/txtscale/txtscale.cpp +++ /dev/null @@ -1,266 +0,0 @@ - -// ------------------------------------------------------------------ -// Windows 2000 Graphics API Black Book -// Chapter 8 - Listing 8.1 (Scaled Text Demo) -// -// Created by Damon Chandler -// Updates can be downloaded at: -// -// Please do not hesistate to e-mail me at dmc27@ee.cornell.edu -// if you have any questions about this code. -// ------------------------------------------------------------------ - - -//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -#include -#include -#include - -// for the MakeFont() function... -#include "mk_font.h" -//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - - -HINSTANCE hInst; -const char* WndClassName = "GMainWnd"; -LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam, - LPARAM LParam); - - -int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR, - int nCmdShow) -{ - hInst = hInstance; - - WNDCLASS wc; - memset(&wc, 0, sizeof(WNDCLASS)); - - wc.style = CS_HREDRAW | CS_VREDRAW; - wc.lpszClassName = WndClassName; - wc.lpfnWndProc = MainWndProc; - wc.hInstance = hInst; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.hbrBackground = reinterpret_cast( - COLOR_BTNFACE + 1 - ); - - if (RegisterClass(&wc)) - { - HWND hWnd = - CreateWindow( - WndClassName, TEXT("Scaled Text Demo"), - WS_OVERLAPPEDWINDOW | WS_CAPTION | - WS_VISIBLE | WS_CLIPCHILDREN, - CW_USEDEFAULT, CW_USEDEFAULT, 800, 300, - NULL, NULL, hInst, NULL - ); - - if (hWnd) - { - ShowWindow(hWnd, nCmdShow); - UpdateWindow(hWnd); - - MSG msg; - while (GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } - } - return 0; -} -//------------------------------------------------------------------------- - - -HWND hTrackBar = NULL; -HFONT hTTFont = NULL; -double scale = 0.0; -LPCSTR pText = TEXT("The Scaled Text!"); - -LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, - LPARAM lParam) -{ - switch (msg) - { - case WM_CREATE: - { - INITCOMMONCONTROLSEX icx; - icx.dwSize = sizeof(INITCOMMONCONTROLSEX); - icx.dwICC = ICC_BAR_CLASSES; - - InitCommonControlsEx(&icx); - - hTrackBar = - CreateWindow( - TRACKBAR_CLASS, "", - TBS_HORZ | TBS_BOTH | TBS_AUTOTICKS | - TBS_FIXEDLENGTH | TBS_ENABLESELRANGE | - WS_CHILD | WS_VISIBLE, - 10, 260, 375, 40, - hWnd, NULL, hInst, NULL - ); - - assert(hTrackBar != NULL); - SNDMSG(hTrackBar, TBM_SETTHUMBLENGTH, 20, 0); - SNDMSG(hTrackBar, TBM_SETRANGEMAX, TRUE, 100); - - // create the TrueType (scalable) font - HDC hDC = GetDC(hWnd); - try - { - // see Chapter 4 for the definition of MakeFont - hTTFont = font::MakeFont(hDC, "Impact", 72); - if (!hTTFont) throw; - } - catch (...) - { - ReleaseDC(hWnd, hDC); - } - ReleaseDC(hWnd, hDC); - break; - } - case WM_HSCROLL: - { - if (reinterpret_cast(lParam) == hTrackBar) - { - // - // adjust the scaling factor according to - // the position of the trackbar's slider - // - scale = static_cast( - (SNDMSG(hTrackBar, TBM_GETPOS, 0, 0) + 1) / 50.0 - ); - InvalidateRect(hWnd, NULL, true); - } - break; - } - case WM_ERASEBKGND: - { - LRESULT res = DefWindowProc(hWnd, msg, wParam, lParam); - - HDC hDC = reinterpret_cast(wParam); - HFONT hOldFont = static_cast( - SelectObject(hDC, hTTFont) - ); - try - { - SetBkMode(hDC, TRANSPARENT); - - // open a path bracket - if (!BeginPath(hDC)) throw; - - // record the text to the path - TextOut(hDC, 10, 10, pText, lstrlen(pText)); - - // close the path bracket and - // select the path into hDC - EndPath(hDC); - - // determine the number of endpoints in the path - const int num_points = GetPath(hDC, NULL, NULL, 0); - if (num_points > 0) - { - // make room for the POINTs and vertex types - POINT* pPEnds = new POINT[num_points]; - unsigned char* pTypes = new unsigned char[num_points]; - try - { - // get the path's description - int num_got = GetPath(hDC, pPEnds, pTypes, num_points); - if (num_got > 0) - { - // start a new path bracket - if (!BeginPath(hDC)) throw; - - // scale each point in the description - int iPoint; - for (iPoint = 0; iPoint < num_got; ++iPoint) - { - pPEnds[iPoint].x = static_cast( - scale * pPEnds[iPoint].x + 0.5 - ); - pPEnds[iPoint].y = static_cast( - scale * pPEnds[iPoint].y + 0.5 - ); - } - - for (iPoint = 0; iPoint < num_points; ++iPoint) - { - // handle the MoveToEx case - if (pTypes[iPoint] == PT_MOVETO) - { - MoveToEx( - hDC, pPEnds[iPoint].x, pPEnds[iPoint].y, NULL - ); - } - // handle the LineTo case - else if ( - pTypes[iPoint] == PT_LINETO || - pTypes[iPoint] == (PT_LINETO | PT_CLOSEFIGURE) - ) - { - LineTo(hDC, pPEnds[iPoint].x, pPEnds[iPoint].y); - } - // handle the PolyBezierTo case - else if ( - pTypes[iPoint] == PT_BEZIERTO || - pTypes[iPoint] == (PT_BEZIERTO | PT_CLOSEFIGURE) - ) - { - PolyBezierTo(hDC, pPEnds + iPoint, 3); - iPoint += 2; - } - } - - // close the new path bracket - EndPath(hDC); - - // stroke and fill the new path - StrokeAndFillPath(hDC); - } - } - catch (...) - { - // clean up - delete [] pTypes; - delete [] pPEnds; - throw; - } - // clean up - delete [] pTypes; - delete [] pPEnds; - } - // ... - } - catch (...) - { - SelectObject(hDC, hOldFont); - } - SelectObject(hDC, hOldFont); - return res; - } - case WM_SIZE: - { - MoveWindow( - hTrackBar, - 0, HIWORD(lParam) - 40, LOWORD(lParam), 40, - false - ); - break; - } - case WM_DESTROY: - { - // clean up - DeleteObject(hTTFont); - PostQuitMessage(0); - break; - } - } - return DefWindowProc(hWnd, msg, wParam, lParam); -} -//------------------------------------------------------------------------- - - - - diff --git a/reactos/apps/tests/user32/.cvsignore b/reactos/apps/tests/user32/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/user32/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/user32/class.c b/reactos/apps/tests/user32/class.c deleted file mode 100644 index 5d61df4c1ac..00000000000 --- a/reactos/apps/tests/user32/class.c +++ /dev/null @@ -1,478 +0,0 @@ -/* Unit test suite for window classes. - * - * Copyright 2002 Mike McCormack - * Copyright 2003 Alexandre Julliard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* To get CS_DROPSHADOW with the MSVC headers */ -#define _WIN32_WINNT 0x0501 - -#include -#include -#include -#include - -#include "wine/test.h" -#include "windef.h" -#include "winbase.h" -#include "winreg.h" -#include "wingdi.h" -#include "winuser.h" - -#define NUMCLASSWORDS 4 - -static LRESULT WINAPI ClassTest_WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - return DefWindowProcW (hWnd, msg, wParam, lParam); -} - -/*********************************************************************** - */ -static void ClassTest(HINSTANCE hInstance, BOOL global) -{ - WNDCLASSW cls, wc; - static const WCHAR className[] = {'T','e','s','t','C','l','a','s','s',0}; - static const WCHAR winName[] = {'W','i','n','C','l','a','s','s','T','e','s','t',0}; - ATOM test_atom; - HWND hTestWnd; - DWORD i; - WCHAR str[20]; - ATOM classatom; - - cls.style = CS_HREDRAW | CS_VREDRAW | (global?CS_GLOBALCLASS:0); - cls.lpfnWndProc = ClassTest_WndProc; - cls.cbClsExtra = NUMCLASSWORDS*sizeof(DWORD); - cls.cbWndExtra = 12; - cls.hInstance = hInstance; - cls.hIcon = LoadIconW (0, (LPWSTR)IDI_APPLICATION); - cls.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW); - cls.hbrBackground = GetStockObject (WHITE_BRUSH); - cls.lpszMenuName = 0; - cls.lpszClassName = className; - - classatom=RegisterClassW(&cls); - if (!classatom && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) - return; - ok(classatom, "failed to register class\n"); - - ok(!RegisterClassW (&cls), - "RegisterClass of the same class should fail for the second time\n"); - - /* Setup windows */ - hTestWnd = CreateWindowW (className, winName, - WS_OVERLAPPEDWINDOW + WS_HSCROLL + WS_VSCROLL, - CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0, - 0, hInstance, 0); - - ok(hTestWnd!=0, "Failed to create window\n"); - - /* test initial values of valid classwords */ - for(i=0; i - -#include "wine/test.h" -#include "winbase.h" -#include "winuser.h" -#include "ddeml.h" -#include "winerror.h" - -static HDDEDATA CALLBACK DdeCallback(UINT uType, UINT uFmt, HCONV hconv, - HSZ hsz1, HSZ hsz2, HDDEDATA hdata, - ULONG_PTR dwData1, ULONG_PTR dwData2) -{ - return 0; -} - -static void test_DdeCreateStringHandleW(DWORD dde_inst, int codepage) -{ - static const WCHAR dde_string[] = {'D','D','E',' ','S','t','r','i','n','g',0}; - HSZ str_handle; - WCHAR bufW[256]; - char buf[256]; - int ret; - - str_handle = DdeCreateStringHandleW(dde_inst, dde_string, codepage); - ok(str_handle != 0, "DdeCreateStringHandleW failed with error %08x\n", - DdeGetLastError(dde_inst)); - - ret = DdeQueryStringW(dde_inst, str_handle, NULL, 0, codepage); - if (codepage == CP_WINANSI) - ok(ret == 1, "DdeQueryStringW returned wrong length %d\n", ret); - else - ok(ret == lstrlenW(dde_string), "DdeQueryStringW returned wrong length %d\n", ret); - - ret = DdeQueryStringW(dde_inst, str_handle, bufW, 256, codepage); - if (codepage == CP_WINANSI) - { - ok(ret == 1, "DdeQueryStringW returned wrong length %d\n", ret); - ok(!lstrcmpA("D", (LPCSTR)bufW), "DdeQueryStringW returned wrong string\n"); - } - else - { - ok(ret == lstrlenW(dde_string), "DdeQueryStringW returned wrong length %d\n", ret); - ok(!lstrcmpW(dde_string, bufW), "DdeQueryStringW returned wrong string\n"); - } - - ret = DdeQueryStringA(dde_inst, str_handle, buf, 256, CP_WINANSI); - if (codepage == CP_WINANSI) - { - ok(ret == 1, "DdeQueryStringA returned wrong length %d\n", ret); - ok(!lstrcmpA("D", buf), "DdeQueryStringW returned wrong string\n"); - } - else - { - ok(ret == lstrlenA("DDE String"), "DdeQueryStringA returned wrong length %d\n", ret); - ok(!lstrcmpA("DDE String", buf), "DdeQueryStringA returned wrong string %s\n", buf); - } - - ret = DdeQueryStringA(dde_inst, str_handle, buf, 256, CP_WINUNICODE); - if (codepage == CP_WINANSI) - { - ok(ret == 1, "DdeQueryStringA returned wrong length %d\n", ret); - ok(!lstrcmpA("D", buf), "DdeQueryStringA returned wrong string %s\n", buf); - } - else - { - ok(ret == lstrlenA("DDE String"), "DdeQueryStringA returned wrong length %d\n", ret); - ok(!lstrcmpW(dde_string, (LPCWSTR)buf), "DdeQueryStringW returned wrong string\n"); - } - - ok(DdeFreeStringHandle(dde_inst, str_handle), "DdeFreeStringHandle failed\n"); -} - -START_TEST(dde) -{ - DWORD dde_inst, ret; - - dde_inst = 0xdeadbeef; - SetLastError(0xdeadbeef); - ret = DdeInitializeW(&dde_inst, DdeCallback, APPCMD_CLIENTONLY, 0); - if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - { - trace("Skipping the DDE test on a Win9x platform\n"); - return; - } - - ok(ret == DMLERR_INVALIDPARAMETER, "DdeInitializeW should fail, but got %04lx instead\n", ret); - ok(DdeGetLastError(dde_inst) == DMLERR_INVALIDPARAMETER, "expected DMLERR_INVALIDPARAMETER\n"); - - dde_inst = 0; - ret = DdeInitializeW(&dde_inst, DdeCallback, APPCMD_CLIENTONLY, 0); - ok(ret == DMLERR_NO_ERROR, "DdeInitializeW failed with error %04lx (%08x)\n", - ret, DdeGetLastError(dde_inst)); - - test_DdeCreateStringHandleW(dde_inst, 0); - test_DdeCreateStringHandleW(dde_inst, CP_WINUNICODE); - test_DdeCreateStringHandleW(dde_inst, CP_WINANSI); - - ok(DdeUninitialize(dde_inst), "DdeUninitialize failed\n"); -} diff --git a/reactos/apps/tests/user32/dialog.c b/reactos/apps/tests/user32/dialog.c deleted file mode 100644 index 6b9939a161d..00000000000 --- a/reactos/apps/tests/user32/dialog.c +++ /dev/null @@ -1,518 +0,0 @@ -/* Unit test suite for the dialog functions. - * - * Copyright 2004 Bill Medland - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * - * - * This test suite currently works by building a quite complex hierarchy of - * objects in a variety of styles and then performs a limited number of tests - * for the previous and next dialog group or tab items. - * - * The test specifically does not test all possibilities at this time since - * there are several cases where the Windows behaviour is rather strange and - * significant work would be required to get the Wine code to duplicate the - * strangeness, especially since most are in situations that would not - * normally be met. - */ - -#include -#include -#include - -#include "wine/test.h" -#include "windef.h" -#include "winbase.h" -#include "winuser.h" - -#define MAXHWNDS 1024 -static HWND hwnd [MAXHWNDS]; -static int numwnds=1; /* 0 is reserved for null */ - -/* Global handles */ -static HINSTANCE g_hinst; /* This application's HINSTANCE */ -static HWND g_hwndMain, g_hwndButton1, g_hwndButton2, g_hwndButtonCancel; -static int g_terminated; - -typedef struct { - int id; - int parent; - DWORD style; - DWORD exstyle; -} h_entry; - -static const h_entry hierarchy [] = { - /* 0 is reserved for the null window */ - { 1, 0, WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE}, - { 20, 1, WS_CHILD | WS_VISIBLE | WS_GROUP, 0}, - { 2, 1, WS_CHILD | WS_VISIBLE, WS_EX_CONTROLPARENT}, - { 60, 2, WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0}, - /* What happens with groups when the parent is disabled */ - { 8, 2, WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_TABSTOP, WS_EX_CONTROLPARENT}, - { 85, 8, WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_GROUP, 0}, - { 9, 8, WS_CHILD, WS_EX_CONTROLPARENT}, - { 86, 9, WS_CHILD | WS_VISIBLE, 0}, - { 87, 9, WS_CHILD | WS_VISIBLE, 0}, - { 31, 8, WS_CHILD | WS_VISIBLE | WS_GROUP, 0}, - { 10, 2, WS_CHILD | WS_VISIBLE, WS_EX_CONTROLPARENT}, - { 88, 10, WS_CHILD | WS_VISIBLE | WS_GROUP, 0}, - { 11, 10, WS_CHILD, WS_EX_CONTROLPARENT}, - { 89, 11, WS_CHILD | WS_VISIBLE, 0}, - { 32, 11, WS_CHILD | WS_VISIBLE | WS_GROUP, 0}, - { 90, 11, WS_CHILD | WS_VISIBLE, 0}, - { 33, 10, WS_CHILD | WS_VISIBLE | WS_GROUP, 0}, - { 21, 2, WS_CHILD | WS_VISIBLE | WS_GROUP, 0}, - { 61, 2, WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0}, - { 3, 1, WS_CHILD | WS_VISIBLE | DS_CONTROL, 0}, - { 22, 3, WS_CHILD | WS_VISIBLE | WS_GROUP, 0}, - { 62, 3, WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0}, - { 7, 3, WS_CHILD | WS_VISIBLE, WS_EX_CONTROLPARENT}, - { 4, 7, WS_CHILD | WS_VISIBLE | DS_CONTROL, 0}, - { 83, 4, WS_CHILD | WS_VISIBLE, 0}, - { 5, 4, WS_CHILD | WS_VISIBLE | DS_CONTROL, 0}, - /* A couple of controls around the main dialog */ - { 29, 5, WS_CHILD | WS_VISIBLE | WS_GROUP, 0}, - { 81, 5, WS_CHILD | WS_VISIBLE, 0}, - /* The main dialog with lots of controls */ - { 6, 5, WS_CHILD | WS_VISIBLE, WS_EX_CONTROLPARENT}, - /* At the start of a dialog */ - /* Disabled controls are skipped */ - { 63, 6, WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 0}, - /* Invisible controls are skipped */ - { 64, 6, WS_CHILD | WS_TABSTOP, 0}, - /* Invisible disabled controls are skipped */ - { 65, 6, WS_CHILD | WS_DISABLED | WS_TABSTOP, 0}, - /* Non-tabstop controls are skipped for tabs but not for groups */ - { 66, 6, WS_CHILD | WS_VISIBLE, 0}, - /* End of first group, with no tabstops in it */ - { 23, 6, WS_CHILD | WS_VISIBLE | WS_GROUP, 0}, - /* At last a tabstop */ - { 67, 6, WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0}, - /* A group that is totally disabled or invisible */ - { 24, 6, WS_CHILD | WS_DISABLED | WS_GROUP, 0}, - { 68, 6, WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 0}, - { 69, 6, WS_CHILD | WS_TABSTOP, 0}, - /* A valid group in the middle of the dialog (not the first nor last group*/ - { 25, 6, WS_CHILD | WS_VISIBLE | WS_GROUP, 0}, - /* A non-tabstop item will be skipped for tabs */ - { 70, 6, WS_CHILD | WS_VISIBLE, 0}, - /* A disabled item will be skipped for tabs and groups */ - { 71, 6, WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 0}, - /* A valid item will be found for tabs and groups */ - { 72, 6, WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0}, - /* A disabled item to skip when looking for the next group item */ - { 73, 6, WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 0}, - /* The next group begins with an enabled visible label */ - { 26, 6, WS_CHILD | WS_VISIBLE | WS_GROUP, 0}, - { 74, 6, WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0}, - { 75, 6, WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0}, - /* That group is terminated by a disabled label */ - { 27, 6, WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_GROUP, 0}, - { 76, 6, WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0}, - { 77, 6, WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0}, - /* That group is terminated by an invisible label */ - { 28, 6, WS_CHILD | WS_GROUP, 0}, - /* The end of the dialog with item for loop and recursion testing */ - { 78, 6, WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0}, - /* No tabstop so skipped for prev tab, but found for prev group */ - { 79, 6, WS_CHILD | WS_VISIBLE, 0}, - { 80, 6, WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 0}, - /* A couple of controls after the main dialog */ - { 82, 5, WS_CHILD | WS_VISIBLE, 0}, - { 30, 5, WS_CHILD | WS_VISIBLE | WS_GROUP, 0}, - /* And around them */ - { 84, 4, WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0}, - {0, 0, 0, 0} -}; - -static BOOL CreateWindows (HINSTANCE hinst) -{ - const h_entry *p = hierarchy; - - while (p->id != 0) - { - DWORD style, exstyle; - char ctrlname[9]; - - /* Basically assert that the hierarchy is valid and track the - * maximum control number - */ - if (p->id >= numwnds) - { - if (p->id >= sizeof(hwnd)/sizeof(hwnd[0])) - { - trace ("Control %d is out of range\n", p->id); - return FALSE; - } - else - numwnds = p->id+1; - } - if (p->id <= 0) - { - trace ("Control %d is out of range\n", p->id); - return FALSE; - } - if (hwnd[p->id] != 0) - { - trace ("Control %d is used more than once\n", p->id); - return FALSE; - } - - /* Create the control */ - sprintf (ctrlname, "ctrl%4.4d", p->id); - hwnd[p->id] = CreateWindowEx (p->exstyle, TEXT(p->parent ? "static" : "GetNextDlgItemWindowClass"), TEXT(ctrlname), p->style, 10, 10, 10, 10, hwnd[p->parent], p->parent ? (HMENU) (2000 + p->id) : 0, hinst, 0); - if (!hwnd[p->id]) - { - trace ("Failed to create control %d\n", p->id); - return FALSE; - } - - /* Check that the styles are as we specified (except the main one - * which is quite frequently messed up). If this keeps breaking then - * we could mask out the bits that don't concern us. - */ - if (p->parent) - { - style = GetWindowLong (hwnd[p->id], GWL_STYLE); - exstyle = GetWindowLong (hwnd[p->id], GWL_EXSTYLE); - if (style == p->style && exstyle == p->exstyle) - { - trace ("Style mismatch at %d: %8.8lx %8.8lx cf %8.8lx %8.8lx\n", p->id, style, exstyle, p->style, p->exstyle); - } - } - p++; - } - - return TRUE; -} - -/* Form the lParam of a WM_KEYDOWN message */ -static DWORD KeyDownData (int repeat, int scancode, int extended, int wasdown) -{ - return ((repeat & 0x0000FFFF) | ((scancode & 0x00FF) >> 16) | - (extended ? 0x01000000 : 0) | (wasdown ? 0x40000000 : 0)); -} - -/* Form a WM_KEYDOWN VK_TAB message to the specified window */ -static void FormTabMsg (MSG *pMsg, HWND hwnd) -{ - pMsg->hwnd = hwnd; - pMsg->message = WM_KEYDOWN; - pMsg->wParam = VK_TAB; - pMsg->lParam = KeyDownData (1, 0x0F, 0, 0); - /* pMsg->time is not set. It shouldn't be needed */ - /* pMsg->pt is ignored */ -} - -/* Form a WM_KEYDOWN VK_RETURN message to the specified window */ -static void FormEnterMsg (MSG *pMsg, HWND hwnd) -{ - pMsg->hwnd = hwnd; - pMsg->message = WM_KEYDOWN; - pMsg->wParam = VK_RETURN; - pMsg->lParam = KeyDownData (1, 0x1C, 0, 0); - /* pMsg->time is not set. It shouldn't be needed */ - /* pMsg->pt is ignored */ -} - -/*********************************************************************** - * - * The actual tests - */ - -typedef struct -{ - int isok; /* or is it todo */ - int test; - int dlg; - int ctl; - int tab; - int prev; - int res; -} test_record; - -static int id (HWND h) -{ - int i; - for (i = 0; i < numwnds; i++) - if (hwnd[i] == h) - return i; - return -1; -} - -/* Tests - * - * Tests 1-8 test the hCtl argument of null or the dialog itself. - * - * 1. Prev Group of null is null - * 2. Prev Tab of null is null - * 3. Prev Group of hDlg in hDlg is null - * 4. Prev Tab of hDlg in hDlg is null - * 5. Next Group of null is first visible enabled child - * Check it skips invisible, diabled and both. - * 6. Next Tab of null is first visible enabled tabstop - * Check it skips invisible, disabled, nontabstop, and in combination. - * 7. Next Group of hDlg in hDlg is as of null - * 8. Next Tab of hDlg in hDlg is as of null - * - * Tests 9-14 test descent - * - * 9. DS_CONTROL does not result in descending the hierarchy for Tab Next - * 10. DS_CONTROL does not result in descending the hierarchy for Group Next - * 11. WS_EX_CONTROLPARENT results in descending the hierarchy for Tab Next - * 12. WS_EX_CONTROLPARENT results in descending the hierarchy for Group Next - * 13. WS_EX_CONTROLPARENT results in descending the hierarchy for Tab Prev - * 14. WS_EX_CONTROLPARENT results in descending the hierarchy for Group Prev - * - * Tests 15-24 are the basic Prev/Next Group tests - * - * 15. Next Group of a visible enabled non-group control is the next visible - * enabled non-group control, if there is one before the next group - * 16. Next Group of a visible enabled non-group control wraps around to the - * beginning of the group on finding a control that starts another group. - * Note that the group is in the middle of the dialog. - * 17. As 16 except note that the next group is started with a disabled - * visible control. - * 18. As 16 except note that the next group is started with an invisible - * enabled control. - * 19. Next Group wraps around the controls of the dialog - * 20. Next Group is the same even if the initial control is disabled. - * 21. Next Group is the same even if the initial control is invisible. - * 22. Next Group is the same even if the initial control has the group style - * 23. Next Group returns the initial control if there is no visible enabled - * control in the group. (Initial control disabled and not group style). - * 24. Prev version of test 16. - * Prev Group of a visible enabled non-group control wraps around to the - * beginning of the group on finding a control that starts the group. - * Note that the group is in the middle of the dialog. - * - * In tests 25 to 28 the control is sitting under dialogs which do not have - * the WS_EX_CONTROLPARENT style and so cannot be reached from the top of - * the dialog. - * - * 25. Next Group of an inaccessible control is as if it were accessible - * 26. Prev Group of an inaccessible control begins searching at the highest - * level ancestor that did not permit recursion down the hierarchy - * 27. Next Tab of an inaccessible control is as if it were accessible - * 28. Prev Tab of an inaccessible control begins searching at the highest - * level ancestor that did not permit recursion down the hierarchy. - * - * Tests 29- are the basic Tab tests - * - * 29. Next Tab of a control is the next visible enabled control with the - * Tabstop style (N.B. skips disabled, invisible and non-tabstop) - * 30. Prev Tab of a control is the previous visible enabled control with the - * Tabstop style (N.B. skips disabled, invisible and non-tabstop) - * 31. Next Tab test with at least two layers of descent and finding the - * result not at the first control. - * 32. Next Tab test with at least two layers of descent with the descent and - * control at the start of each level. - * 33. Prev Tab test with at least two layers of descent and finding the - * result not at the last control. - * 34. Prev Tab test with at least two layers of descent with the descent and - * control at the end of each level. - * - * 35. Passing NULL may result in the first child being the one returned. - * (group test) - * 36. Passing NULL may result in the first child being the one returned. - * (tab test) - */ - -static void GetNextDlgItemTest (void) -{ - static test_record test [] = - { - /* isok test dlg ctl tab prev res */ - - { 1, 1, 6, 0, 0, 1, 0}, - { 1, 2, 6, 0, 1, 1, 0}, - { 1, 3, 6, 6, 0, 1, 0}, - { 1, 4, 6, 6, 1, 1, 0}, - { 1, 5, 6, 0, 0, 0, 66}, - { 1, 6, 6, 0, 1, 0, 67}, - { 1, 7, 6, 6, 0, 0, 66}, - { 1, 8, 6, 6, 1, 0, 67}, - - { 1, 9, 4, 83, 1, 0, 84}, - { 1, 10, 4, 83, 0, 0, 5}, - { 1, 11, 5, 81, 1, 0, 67}, - { 1, 12, 5, 81, 0, 0, 66}, - { 1, 13, 5, 82, 1, 1, 78}, - - { 1, 14, 5, 82, 0, 1, 79}, - { 1, 15, 6, 70, 0, 0, 72}, - { 1, 16, 6, 72, 0, 0, 25}, - { 1, 17, 6, 75, 0, 0, 26}, - { 1, 18, 6, 77, 0, 0, 76}, - { 1, 19, 6, 79, 0, 0, 66}, - { 1, 20, 6, 71, 0, 0, 72}, - { 1, 21, 6, 64, 0, 0, 66}, - - { 1, 22, 6, 25, 0, 0, 70}, - { 1, 23, 6, 68, 0, 0, 68}, - { 1, 24, 6, 25, 0, 1, 72}, - { 1, 25, 1, 70, 0, 0, 72}, - /*{ 0, 26, 1, 70, 0, 1, 3}, Crashes Win95*/ - { 1, 27, 1, 70, 1, 0, 72}, - /*{ 0, 28, 1, 70, 1, 1, 61}, Crashes Win95*/ - - { 1, 29, 6, 67, 1, 0, 72}, - { 1, 30, 6, 72, 1, 1, 67}, - - { 1, 35, 2, 0, 0, 0, 60}, - { 1, 36, 2, 0, 1, 0, 60}, - - { 0, 0, 0, 0, 0, 0, 0} /* End of test */ - }; - const test_record *p = test; - - ok (CreateWindows (g_hinst), "Could not create test windows\n"); - - while (p->dlg) - { - HWND a; - a = (p->tab ? GetNextDlgTabItem : GetNextDlgGroupItem) (hwnd[p->dlg], hwnd[p->ctl], p->prev); - if (p->isok) - { - ok (a == hwnd[p->res], "Test %d: %s %s item of %d in %d was %d instead of %d\n", p->test, p->prev ? "Prev" : "Next", p->tab ? "Tab" : "Group", p->ctl, p->dlg, id(a), p->res); - } - else - { - todo_wine - { - ok (a == hwnd[p->res], "Test %d: %s %s item of %d in %d was actually %d matching expected %d\n", p->test, p->prev ? "Prev" : "Next", p->tab ? "Tab" : "Group", p->ctl, p->dlg, id(a), p->res); - } - } - p++; - } -} - -/* - * OnMainWindowCreate - */ -static BOOL OnMainWindowCreate (HWND hwnd, LPCREATESTRUCT lpcs) -{ - g_hwndButton1 = CreateWindow (TEXT("button"), TEXT("Button &1"), - WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_DEFPUSHBUTTON | BS_TEXT, - 10, 10, 80, 80, hwnd, (HMENU)100, g_hinst, 0); - if (!g_hwndButton1) return FALSE; - - g_hwndButton2 = CreateWindow (TEXT("button"), TEXT("Button &2"), - WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | BS_TEXT, - 110, 10, 80, 80, hwnd, (HMENU)200, g_hinst, 0); - if (!g_hwndButton2) return FALSE; - - g_hwndButtonCancel = CreateWindow (TEXT("button"), TEXT("Cancel"), - WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | BS_TEXT, - 210, 10, 80, 80, hwnd, (HMENU)IDCANCEL, g_hinst, 0); - if (!g_hwndButtonCancel) return FALSE; - - return TRUE; -} - - -static LRESULT CALLBACK main_window_procA (HWND hwnd, UINT uiMsg, WPARAM wParam, - LPARAM lParam) -{ - LRESULT result; - switch (uiMsg) - { - /* Add blank case statements for these to ensure we don't use them - * by mistake. - */ - case DM_GETDEFID: break; - case DM_SETDEFID: break; - - case WM_CREATE: - return (OnMainWindowCreate (hwnd, - (LPCREATESTRUCTA) lParam) ? 0 : (LRESULT) -1); - case WM_COMMAND: - if (wParam == IDCANCEL) - { - g_terminated = TRUE; - return 0; - } - break; - } - - result=DefWindowProcA (hwnd, uiMsg, wParam, lParam); - return result; -} - - -static BOOL RegisterWindowClasses (void) -{ - WNDCLASSA cls; - - cls.style = 0; - cls.lpfnWndProc = DefWindowProcA; - cls.cbClsExtra = 0; - cls.cbWndExtra = 0; - cls.hInstance = g_hinst; - cls.hIcon = NULL; - cls.hCursor = LoadCursorA (NULL, IDC_ARROW); - cls.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); - cls.lpszMenuName = NULL; - cls.lpszClassName = "GetNextDlgItemWindowClass"; - - if (!RegisterClassA (&cls)) return FALSE; - - cls.lpfnWndProc = main_window_procA; - cls.lpszClassName = "IsDialogMessageWindowClass"; - - if (!RegisterClassA (&cls)) return FALSE; - - return TRUE; -} - -static void IsDialogMessageWTest (void) -{ - MSG msg; - - g_hwndMain = CreateWindow ("IsDialogMessageWindowClass", "IsDialogMessageWindowClass", - WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - NULL, NULL, g_hinst, 0); - - assert (g_hwndMain); - assert (g_hwndButton1); - assert (g_hwndButtonCancel); - - /* The focus should initially be nowhere. The first TAB should take it - * to the first button. The second TAB should take it to the Cancel - * button. - */ - FormTabMsg (&msg, g_hwndMain); - ok (IsDialogMessage (g_hwndMain, &msg), "Did not handle first TAB\n"); - ok ((GetFocus() == g_hwndButton1), "Focus did not move to first button\n"); - FormTabMsg (&msg, g_hwndButton1); - ok (IsDialogMessage (g_hwndMain, &msg), "Did not handle second TAB\n"); - ok ((GetFocus() == g_hwndButtonCancel), - "Focus did not move to cancel button\n"); - FormEnterMsg (&msg, g_hwndButtonCancel); - ok (IsDialogMessage (g_hwndMain, &msg), "Did not handle the ENTER\n"); - ok (g_terminated, "ENTER did not terminate\n"); -} - -START_TEST(dialog) -{ - g_hinst = GetModuleHandleA (0); - - if (!RegisterWindowClasses()) assert(0); - - GetNextDlgItemTest(); - IsDialogMessageWTest(); -} diff --git a/reactos/apps/tests/user32/input.c b/reactos/apps/tests/user32/input.c deleted file mode 100644 index a9b71425b6e..00000000000 --- a/reactos/apps/tests/user32/input.c +++ /dev/null @@ -1,365 +0,0 @@ -/* Test Key event to Key message translation - * - * Copyright 2003 Rein Klazes - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* test whether the right type of messages: - * WM_KEYUP/DOWN vs WM_SYSKEYUP/DOWN are sent in case of combined - * keystrokes. - * - * For instance -X can be accompished by - * the sequence ALT-KEY-DOWN, X-KEY-DOWN, ALT-KEY-UP, X-KEY-UP - * but also X-KEY-DOWN, ALT-KEY-DOWN, X-KEY-UP, ALT-KEY-UP - * Whether a KEY or a SYSKEY message is sent is not always clear, it is - * also not the same in WINNT as in WIN9X */ - -/* NOTE that there will be test failures under WIN9X - * No applications are known to me that rely on this - * so I don't fix it */ - -/* TODO: - * 1. extend it to the wm_command and wm_syscommand notifications - * 2. add some more tests with special cases like dead keys or right (alt) key - * 3. there is some adapted code from input.c in here. Should really - * make that code exactly the same. - * 4. resolve the win9x case when there is a need or the testing frame work - * offers a nice way. - * 5. The test app creates a window, the user should not take the focus - * away during its short existence. I could do something to prevent that - * if it is a problem. - * - */ - -#define _WIN32_WINNT 0x401 - -#include -#include "wine/test.h" -//#include "winbase.h" -//#include "winuser.h" - -#include - -/* globals */ -HWND hWndTest; -long timetag = 0x10000000; - -static UINT (WINAPI *ptr_SendInput) (UINT, INPUT*, size_t); - -#define MAXKEYEVENTS 6 -#define MAXKEYMESSAGES MAXKEYEVENTS /* assuming a key event generates one - and only one message */ - -/* keyboard message names, sorted as their value */ -static const char *MSGNAME[]={"WM_KEYDOWN", "WM_KEYUP", "WM_CHAR","WM_DEADCHAR", - "WM_SYSKEYDOWN", "WM_SYSKEYUP", "WM_SYSCHAR", "WM_SYSDEADCHAR" ,"WM_KEYLAST"}; - -/* keyevents, add more as needed */ -typedef enum KEVtag -{ ALTDOWN = 1, ALTUP, XDOWN, XUP, SHIFTDOWN, SHIFTUP, CTRLDOWN, CTRLUP } KEV; -/* matching VK's */ -int GETVKEY[]={0, VK_MENU, VK_MENU, 'X', 'X', VK_SHIFT, VK_SHIFT, VK_CONTROL, VK_CONTROL}; -/* matching scan codes */ -int GETSCAN[]={0, 0x38, 0x38, 0x2D, 0x2D, 0x2A, 0x2A, 0x1D, 0x1D }; -/* matching updown events */ -int GETUPDOWN[]={0, 0, KEYEVENTF_KEYUP, 0, KEYEVENTF_KEYUP, 0, KEYEVENTF_KEYUP, 0, KEYEVENTF_KEYUP}; -/* matching descripts */ -char *getdesc[]={"", "+alt","-alt","+X","-X","+shift","-shift","+ctrl","-ctrl"}; - -/* The MSVC headers ignore our NONAMELESSUNION requests so we have to define our own type */ -typedef struct -{ - DWORD type; - union - { - MOUSEINPUT mi; - KEYBDINPUT ki; - HARDWAREINPUT hi; - } u; -} TEST_INPUT; - -#define ADDTOINPUTS(kev) \ -inputs[evtctr].type = INPUT_KEYBOARD; \ - ((TEST_INPUT*)inputs)[evtctr].u.ki.wVk = GETVKEY[ kev]; \ - ((TEST_INPUT*)inputs)[evtctr].u.ki.wScan = GETSCAN[ kev]; \ - ((TEST_INPUT*)inputs)[evtctr].u.ki.dwFlags = GETUPDOWN[ kev]; \ - ((TEST_INPUT*)inputs)[evtctr].u.ki.dwExtraInfo = 0; \ - ((TEST_INPUT*)inputs)[evtctr].u.ki.time = ++timetag; \ - if( kev) evtctr++; - -typedef struct { - UINT message; - WPARAM wParam; - LPARAM lParam; -} KMSG; - -/******************************************* - * add new test sets here - * the software will make all combinations of the - * keyevent defined here - */ -struct { int nrkev; - KEV keydwn[MAXKEYEVENTS]; - KEV keyup[MAXKEYEVENTS]; -} testkeyset[]= { - { 2, { ALTDOWN, XDOWN }, { ALTUP, XUP}}, - { 3, { ALTDOWN, XDOWN , SHIFTDOWN}, { ALTUP, XUP, SHIFTUP}}, - { 3, { ALTDOWN, XDOWN , CTRLDOWN}, { ALTUP, XUP, CTRLUP}}, - { 3, { SHIFTDOWN, XDOWN , CTRLDOWN}, { SHIFTUP, XUP, CTRLUP}}, - { 0 } /* mark the end */ -}; - -/**********************adapted from input.c **********************************/ - -BYTE InputKeyStateTable[256]; -BYTE AsyncKeyStateTable[256]; -BYTE TrackSysKey = 0; /* determine whether ALT key up will cause a WM_SYSKEYUP - or a WM_KEYUP message */ -typedef union -{ - struct - { - unsigned long count : 16; - unsigned long code : 8; - unsigned long extended : 1; - unsigned long unused : 2; - unsigned long win_internal : 2; - unsigned long context : 1; - unsigned long previous : 1; - unsigned long transition : 1; - } lp1; - unsigned long lp2; -} KEYLP; - -int KbdMessage( KEV kev, WPARAM *pwParam, LPARAM *plParam ) -{ - UINT message; - int VKey = GETVKEY[kev]; - KEYLP keylp; - - keylp.lp2 = 0; - - keylp.lp1.count = 1; - keylp.lp1.code = GETSCAN[kev]; - keylp.lp1.extended = 0 ;/* FIXME (ki->dwFlags & KEYEVENTF_EXTENDEDKEY) != 0; */ - keylp.lp1.win_internal = 0; - - if (GETUPDOWN[kev] & KEYEVENTF_KEYUP ) - { - message = WM_KEYUP; - if( (InputKeyStateTable[VK_MENU] & 0x80) && ( - (VKey == VK_MENU) || (VKey == VK_CONTROL) || - !(InputKeyStateTable[VK_CONTROL] & 0x80))) { - if( TrackSysKey == VK_MENU || /* -down/-up sequence */ - (VKey != VK_MENU)) /* -down...-up */ - message = WM_SYSKEYUP; - TrackSysKey = 0; - } - InputKeyStateTable[VKey] &= ~0x80; - keylp.lp1.previous = 1; - keylp.lp1.transition = 1; - } - else - { - keylp.lp1.previous = (InputKeyStateTable[VKey] & 0x80) != 0; - keylp.lp1.transition = 0; - if (!(InputKeyStateTable[VKey] & 0x80)) InputKeyStateTable[VKey] ^= 0x01; - InputKeyStateTable[VKey] |= 0x80; - AsyncKeyStateTable[VKey] |= 0x80; - - message = WM_KEYDOWN; - if( (InputKeyStateTable[VK_MENU] & 0x80) && - !(InputKeyStateTable[VK_CONTROL] & 0x80)) { - message = WM_SYSKEYDOWN; - TrackSysKey = VKey; - } - } - - keylp.lp1.context = (InputKeyStateTable[VK_MENU] & 0x80) != 0; /* 1 if alt */ - - if( plParam) *plParam = keylp.lp2; - if( pwParam) *pwParam = VKey; - return message; -} - -/****************************** end copy input.c ****************************/ - -/* - * . prepare the keyevents for SendInputs - * . calculate the "expected" messages - * . Send the events to our window - * . retrieve the messages from the input queue - * . verify - */ -void do_test( HWND hwnd, int seqnr, KEV td[] ) -{ - HMODULE module; - INPUT inputs[MAXKEYEVENTS]; - KMSG expmsg[MAXKEYEVENTS]; - MSG msg; - char buf[100]; - UINT evtctr=0; - int kmctr, i; - - module = GetModuleHandleA("user32"); - if (!module) return; - ptr_SendInput = (void *)GetProcAddress(module, "SendInput"); - if (!ptr_SendInput) return; - - buf[0]='\0'; - TrackSysKey=0; /* see input.c */ - for( i = 0; i < MAXKEYEVENTS; i++) { - ADDTOINPUTS(td[i]) - strcat(buf, getdesc[td[i]]); - if(td[i]) - expmsg[i].message = KbdMessage(td[i], &(expmsg[i].wParam), &(expmsg[i].lParam)); /* see queue_kbd_event() */ - else - expmsg[i].message = 0; - } - for( kmctr = 0; kmctr < MAXKEYEVENTS && expmsg[kmctr].message; kmctr++) - ; - assert( evtctr <= MAXKEYEVENTS ); - assert( evtctr == ptr_SendInput(evtctr, &inputs[0], sizeof(INPUT))); - i = 0; - trace("======== key stroke sequence #%d: %s =============\n", - seqnr + 1, buf); - while( PeekMessage(&msg,hwnd,WM_KEYFIRST,WM_KEYLAST,PM_REMOVE) ) { - trace("message[%d] %-15s wParam %04x lParam %08lx time %lx\n", i, - MSGNAME[msg.message - WM_KEYFIRST], msg.wParam, msg.lParam, msg.time); - if( i < kmctr ) { - ok( msg.message == expmsg[i].message && - msg.wParam == expmsg[i].wParam && - msg.lParam == expmsg[i].lParam, - "wrong message! expected:\n" - "message[%d] %-15s wParam %04x lParam %08lx\n",i, - MSGNAME[(expmsg[i]).message - WM_KEYFIRST], - expmsg[i].wParam, expmsg[i].lParam ); - } - i++; - } - trace("%d messages retrieved\n", i); - ok( i == kmctr, "message count is wrong: got %d expected: %d\n", i, kmctr); -} - -/* test all combinations of the specified key events */ -void TestASet( HWND hWnd, int nrkev, KEV kevdwn[], KEV kevup[] ) -{ - int i,j,k,l,m,n; - static int count=0; - KEV kbuf[MAXKEYEVENTS]; - assert( nrkev==2 || nrkev==3); - for(i=0;i -#include - -#include "wine/test.h" - -#ifdef VISIBLE -#define WAIT Sleep (1000) -#define REDRAW RedrawWindow (handle, NULL, 0, RDW_UPDATENOW) -#else -#define WAIT -#define REDRAW -#endif - -HWND -create_listbox (DWORD add_style) -{ - HWND handle=CreateWindow ("LISTBOX", "TestList", - (LBS_STANDARD & ~LBS_SORT) | add_style, - 0, 0, 100, 100, - NULL, NULL, NULL, 0); - - assert (handle); - SendMessage (handle, LB_ADDSTRING, 0, (LPARAM) (LPCTSTR) "First added"); - SendMessage (handle, LB_ADDSTRING, 0, (LPARAM) (LPCTSTR) "Second added"); - SendMessage (handle, LB_ADDSTRING, 0, (LPARAM) (LPCTSTR) "Third added"); - -#ifdef VISIBLE - ShowWindow (handle, SW_SHOW); -#endif - REDRAW; - - return handle; -} - -struct listbox_prop { - DWORD add_style; -}; - -struct listbox_stat { - int selected, anchor, caret, selcount; -}; - -struct listbox_test { - struct listbox_prop prop; - struct listbox_stat init, init_todo; - struct listbox_stat click, click_todo; - struct listbox_stat step, step_todo; -}; - -void -listbox_query (HWND handle, struct listbox_stat *results) -{ - results->selected = SendMessage (handle, LB_GETCURSEL, 0, 0); - results->anchor = SendMessage (handle, LB_GETANCHORINDEX, 0, 0); - results->caret = SendMessage (handle, LB_GETCARETINDEX, 0, 0); - results->selcount = SendMessage (handle, LB_GETSELCOUNT, 0, 0); -} - -void -buttonpress (HWND handle, WORD x, WORD y) -{ - LPARAM lp=x+(y<<16); - - WAIT; - SendMessage (handle, WM_LBUTTONDOWN, (WPARAM) MK_LBUTTON, lp); - SendMessage (handle, WM_LBUTTONUP , (WPARAM) 0 , lp); - REDRAW; -} - -void -keypress (HWND handle, WPARAM keycode, BYTE scancode, BOOL extended) -{ - LPARAM lp=1+(scancode<<16)+(extended?KEYEVENTF_EXTENDEDKEY:0); - - WAIT; - SendMessage (handle, WM_KEYDOWN, keycode, lp); - SendMessage (handle, WM_KEYUP , keycode, lp | 0xc000000); - REDRAW; -} - -#define listbox_field_ok(t, s, f, got) \ - ok (t.s.f==got.f, "style %#x, step " #s ", field " #f \ - ": expected %d, got %d\n", (unsigned int)t.prop.add_style, \ - t.s.f, got.f) - -#define listbox_todo_field_ok(t, s, f, got) \ - if (t.s##_todo.f) todo_wine { listbox_field_ok(t, s, f, got); } \ - else listbox_field_ok(t, s, f, got) - -#define listbox_ok(t, s, got) \ - listbox_todo_field_ok(t, s, selected, got); \ - listbox_todo_field_ok(t, s, anchor, got); \ - listbox_todo_field_ok(t, s, caret, got); \ - listbox_todo_field_ok(t, s, selcount, got) - -void -check (const struct listbox_test test) -{ - struct listbox_stat answer; - HWND hLB=create_listbox (test.prop.add_style); - RECT second_item; - - listbox_query (hLB, &answer); - listbox_ok (test, init, answer); - - SendMessage (hLB, LB_GETITEMRECT, (WPARAM) 1, (LPARAM) &second_item); - buttonpress(hLB, (WORD)second_item.left, (WORD)second_item.top); - - listbox_query (hLB, &answer); - listbox_ok (test, click, answer); - - keypress (hLB, VK_DOWN, 0x50, TRUE); - - listbox_query (hLB, &answer); - listbox_ok (test, step, answer); - - WAIT; - DestroyWindow (hLB); -} - -START_TEST(listbox) -{ - const struct listbox_test SS = -/* {add_style} */ - {{0}, - {LB_ERR, LB_ERR, 0, LB_ERR}, {0,0,0,0}, - { 1, 1, 1, LB_ERR}, {0,1,0,0}, - { 2, 2, 2, LB_ERR}, {0,1,0,0}}; -/* {selected, anchor, caret, selcount}{TODO fields} */ - const struct listbox_test SS_NS = - {{LBS_NOSEL}, - {LB_ERR, LB_ERR, 0, LB_ERR}, {0,0,0,0}, - { 1, 1, 1, LB_ERR}, {1,1,0,0}, - { 2, 2, 2, LB_ERR}, {1,1,1,0}}; - const struct listbox_test MS = - {{LBS_MULTIPLESEL}, - { 0, LB_ERR, 0, 0}, {0,0,0,0}, - { 1, 1, 1, 1}, {0,1,0,0}, - { 2, 1, 2, 1}, {0,1,0,1}}; - const struct listbox_test MS_NS = - {{LBS_MULTIPLESEL | LBS_NOSEL}, - {LB_ERR, LB_ERR, 0, LB_ERR}, {1,0,0,1}, - { 1, 1, 1, LB_ERR}, {0,1,0,1}, - { 2, 2, 2, LB_ERR}, {0,1,0,1}}; - - trace (" Testing single selection...\n"); - check (SS); - trace (" ... with NOSEL\n"); - check (SS_NS); - trace (" Testing multiple selection...\n"); - check (MS); - trace (" ... with NOSEL\n"); - check (MS_NS); -} diff --git a/reactos/apps/tests/user32/makefile b/reactos/apps/tests/user32/makefile deleted file mode 100644 index 32e7dcaf79d..00000000000 --- a/reactos/apps/tests/user32/makefile +++ /dev/null @@ -1,34 +0,0 @@ -# $Id: makefile,v 1.4 2004/09/10 23:30:45 sedwards Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -# require os code to explicitly request A/W version of structs/functions -TARGET_CFLAGS += -D_DISABLE_TIDENTS -D__USE_W32API - -TARGET_NAME = user32_test - -TARGET_SDKLIBS = gdi32.a user32.a ntdll.a - -TARGET_OBJECTS = \ - testlist.o \ - class.o \ - dde.o \ - dialog.o \ - listbox.o \ - msg.o \ - resource.o \ - sysparams.o \ - win.o \ - wsprintf.o - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/user32/msg.c b/reactos/apps/tests/user32/msg.c deleted file mode 100644 index 55a9b2c9638..00000000000 --- a/reactos/apps/tests/user32/msg.c +++ /dev/null @@ -1,1119 +0,0 @@ -/* - * Unit tests for window message handling - * - * Copyright 1999 Ove Kaaven - * Copyright 2003 Dimitrie O. Paun - * Copyright 2004 Dmitry Timoshkov - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" - -#include "wine/test.h" - - -/* -FIXME: add tests for these -Window Edge Styles (Win31/Win95/98 look), in order of precedence: - WS_EX_DLGMODALFRAME: double border, WS_CAPTION allowed - WS_THICKFRAME: thick border - WS_DLGFRAME: double border, WS_CAPTION not allowed (but possibly shown anyway) - WS_BORDER (default for overlapped windows): single black border - none (default for child (and popup?) windows): no border -*/ - -typedef enum { - sent=0x1, posted=0x2, parent=0x4, wparam=0x8, lparam=0x10, - defwinproc=0x20, optional=0x40, hook=0x80 -} msg_flags_t; - -struct message { - UINT message; /* the WM_* code */ - msg_flags_t flags; /* message props */ - WPARAM wParam; /* expected value of wParam */ - LPARAM lParam; /* expected value of lParam */ -}; - -/* CreateWindow (for overlapped window, not initially visible) (16/32) */ -static const struct message WmCreateOverlappedSeq[] = { - { HCBT_CREATEWND, hook }, - { WM_GETMINMAXINFO, sent }, - { WM_NCCREATE, sent }, - { WM_NCCALCSIZE, sent|wparam, 0 }, - { WM_CREATE, sent }, - { 0 } -}; -/* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE) - * for a not visible overlapped window. - */ -static const struct message WmSWP_ShowOverlappedSeq[] = { - { WM_WINDOWPOSCHANGING, sent|wparam, 0 }, - { WM_NCPAINT, sent|wparam|optional, 1 }, - { WM_GETTEXT, sent|defwinproc|optional }, - { WM_ERASEBKGND, sent|optional }, - { HCBT_ACTIVATE, hook }, - { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 }, - { WM_WINDOWPOSCHANGING, sent|wparam|optional, 0 }, /* Win9x: SWP_NOSENDCHANGING */ - { WM_ACTIVATEAPP, sent|wparam, 1 }, - { WM_NCACTIVATE, sent|wparam, 1 }, - { WM_GETTEXT, sent|defwinproc|optional }, - { WM_ACTIVATE, sent|wparam, 1 }, - { HCBT_SETFOCUS, hook }, - { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 }, - { WM_SETFOCUS, sent|wparam|defwinproc, 0 }, - { WM_NCPAINT, sent|wparam|optional, 1 }, - { WM_GETTEXT, sent|defwinproc|optional }, - { WM_ERASEBKGND, sent|optional }, - { WM_WINDOWPOSCHANGED, sent|wparam, 0 }, - { WM_NCCALCSIZE, sent|wparam|optional, 1 }, - { WM_NCPAINT, sent|wparam|optional, 1 }, - { WM_ERASEBKGND, sent|optional }, - { 0 } -}; -/* SetWindowPos(SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE) - * for a visible overlapped window. - */ -static const struct message WmSWP_HideOverlappedSeq[] = { - { WM_WINDOWPOSCHANGING, sent|wparam, 0 }, - { WM_WINDOWPOSCHANGED, sent|wparam, 0 }, - { 0 } -}; -/* ShowWindow(SW_SHOW) for a not visible overlapped window */ -static const struct message WmShowOverlappedSeq[] = { - { WM_SHOWWINDOW, sent|wparam, 1 }, - { WM_NCPAINT, sent|wparam|optional, 1 }, - { WM_WINDOWPOSCHANGING, sent|wparam, 0 }, - { WM_NCPAINT, sent|wparam|optional, 1 }, - { WM_GETTEXT, sent|defwinproc|optional }, - { WM_ERASEBKGND, sent|optional }, - { HCBT_ACTIVATE, hook }, - { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 }, - { WM_WINDOWPOSCHANGING, sent|wparam, 0 }, - { WM_ACTIVATEAPP, sent|wparam, 1 }, - { WM_NCACTIVATE, sent|wparam, 1 }, - { WM_GETTEXT, sent|defwinproc|optional }, - { WM_ACTIVATE, sent|wparam, 1 }, - { HCBT_SETFOCUS, hook }, - { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 }, - { WM_SETFOCUS, sent|wparam|defwinproc, 0 }, - { WM_NCPAINT, sent|wparam|optional, 1 }, - { WM_GETTEXT, sent|defwinproc|optional }, - { WM_ERASEBKGND, sent|optional }, - { WM_WINDOWPOSCHANGED, sent|wparam, 0 }, - { WM_NCCALCSIZE, sent|optional }, - { WM_NCPAINT, sent|optional }, - { WM_ERASEBKGND, sent|optional }, -#if 0 /* CreateWindow/ShowWindow(SW_SHOW) also generates WM_SIZE/WM_MOVE - * messages. Does that mean that CreateWindow doesn't set initial - * window dimensions for overlapped windows? - */ - { WM_SIZE, sent }, - { WM_MOVE, sent }, -#endif - { 0 } -}; -/* ShowWindow(SW_HIDE) for a visible overlapped window */ -static const struct message WmHideOverlappedSeq[] = { - { WM_SHOWWINDOW, sent|wparam, 0 }, - { WM_WINDOWPOSCHANGING, sent|wparam, 0 }, - { WM_WINDOWPOSCHANGED, sent|wparam, 0 }, - { WM_SIZE, sent }, - { WM_MOVE, sent }, - { WM_NCACTIVATE, sent|wparam, 0 }, - { WM_ACTIVATE, sent|wparam, 0 }, - { WM_ACTIVATEAPP, sent|wparam, 0 }, - { WM_KILLFOCUS, sent|wparam, 0 }, - { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, - { 0 } -}; -/* DestroyWindow for a visible overlapped window */ -static const struct message WmDestroyOverlappedSeq[] = { - { HCBT_DESTROYWND, hook }, - { WM_WINDOWPOSCHANGING, sent|wparam, 0 }, - { WM_WINDOWPOSCHANGED, sent|wparam, 0 }, - { WM_NCACTIVATE, sent|wparam, 0 }, - { WM_ACTIVATE, sent|wparam, 0 }, - { WM_ACTIVATEAPP, sent|wparam, 0 }, - { WM_KILLFOCUS, sent|wparam, 0 }, - { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, - { WM_DESTROY, sent }, - { WM_NCDESTROY, sent }, - { 0 } -}; -/* CreateWindow (for a child popup window, not initially visible) */ -static const struct message WmCreateChildPopupSeq[] = { - { HCBT_CREATEWND, hook }, - { WM_NCCREATE, sent }, - { WM_NCCALCSIZE, sent|wparam, 0 }, - { WM_CREATE, sent }, - { WM_SIZE, sent }, - { WM_MOVE, sent }, - { 0 } -}; -/* CreateWindow (for a popup window, not initially visible, - * which sets WS_VISIBLE in WM_CREATE handler) - */ -static const struct message WmCreateInvisiblePopupSeq[] = { - { HCBT_CREATEWND, hook }, - { WM_NCCREATE, sent }, - { WM_NCCALCSIZE, sent|wparam, 0 }, - { WM_CREATE, sent }, - { WM_STYLECHANGING, sent }, - { WM_STYLECHANGED, sent }, - { WM_SIZE, sent }, - { WM_MOVE, sent }, - { 0 } -}; -/* ShowWindow (for a popup window with WS_VISIBLE style set) */ -static const struct message WmShowVisiblePopupSeq[] = { - { 0 } -}; -/* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER) - * for a popup window with WS_VISIBLE style set - */ -static const struct message WmShowVisiblePopupSeq_2[] = { - { WM_WINDOWPOSCHANGING, sent|wparam, 0 }, - { 0 } -}; -/* SetWindowPos(SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE) - * for a popup window with WS_VISIBLE style set - */ -static const struct message WmShowVisiblePopupSeq_3[] = { - { WM_WINDOWPOSCHANGING, sent|wparam, 0 }, - { HCBT_ACTIVATE, hook }, - { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 }, - { WM_WINDOWPOSCHANGING, sent|wparam, 0 }, - { WM_NCACTIVATE, sent|wparam, 1 }, - { WM_ACTIVATE, sent|wparam, 1 }, - { HCBT_SETFOCUS, hook }, - { WM_KILLFOCUS, sent|parent }, - { WM_IME_SETCONTEXT, sent|parent|wparam|optional, 0 }, - { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 }, - { WM_SETFOCUS, sent|defwinproc }, - { 0 } -}; -/* CreateWindow (for child window, not initially visible) */ -static const struct message WmCreateChildSeq[] = { - { HCBT_CREATEWND, hook }, - { WM_NCCREATE, sent }, - /* child is inserted into parent's child list after WM_NCCREATE returns */ - { WM_NCCALCSIZE, sent|wparam, 0 }, - { WM_CREATE, sent }, - { WM_SIZE, sent }, - { WM_MOVE, sent }, - { WM_PARENTNOTIFY, sent|parent|wparam, WM_CREATE }, - { 0 } -}; -/* CreateWindow (for maximized child window, not initially visible) */ -static const struct message WmCreateMaximizedChildSeq[] = { - { HCBT_CREATEWND, hook }, - { WM_NCCREATE, sent }, - { WM_NCCALCSIZE, sent|wparam, 0 }, - { WM_CREATE, sent }, - { WM_SIZE, sent }, - { WM_MOVE, sent }, - { HCBT_MINMAX, hook|lparam, 0, SW_MAXIMIZE }, - { WM_GETMINMAXINFO, sent }, - { WM_WINDOWPOSCHANGING, sent }, - { WM_NCCALCSIZE, sent }, - { WM_WINDOWPOSCHANGED, sent }, - { WM_SIZE, sent|defwinproc }, - { WM_PARENTNOTIFY, sent|parent|wparam, WM_CREATE }, - { 0 } -}; -/* ShowWindow(SW_SHOW) for a not visible child window */ -static const struct message WmShowChildSeq[] = { - { WM_SHOWWINDOW, sent|wparam, 1 }, - { WM_WINDOWPOSCHANGING, sent|wparam, 0 }, - { WM_ERASEBKGND, sent|parent|optional }, - { WM_WINDOWPOSCHANGED, sent|wparam, 0 }, - { 0 } -}; -/* DestroyWindow for a visible child window */ -static const struct message WmDestroyChildSeq[] = { - { HCBT_DESTROYWND, hook }, - { WM_PARENTNOTIFY, sent|parent|wparam, WM_DESTROY }, - { WM_SHOWWINDOW, sent|wparam, 0 }, - { WM_WINDOWPOSCHANGING, sent|wparam, 0 }, - { WM_ERASEBKGND, sent|parent|optional }, - { WM_WINDOWPOSCHANGED, sent|wparam, 0 }, - { HCBT_SETFOCUS, hook }, /* set focus to a parent */ - { WM_KILLFOCUS, sent }, - { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, - { WM_IME_SETCONTEXT, sent|wparam|parent|optional, 1 }, - { WM_SETFOCUS, sent|parent }, - { WM_DESTROY, sent }, - { WM_DESTROY, sent|optional }, /* a bug in win2k sp4 ? */ - { WM_NCDESTROY, sent }, - { WM_NCDESTROY, sent|optional }, /* a bug in win2k sp4 ? */ - { 0 } -}; -/* Moving the mouse in nonclient area */ -static const struct message WmMouseMoveInNonClientAreaSeq[] = { /* FIXME: add */ - { WM_NCHITTEST, sent }, - { WM_SETCURSOR, sent }, - { WM_NCMOUSEMOVE, posted }, - { 0 } -}; -/* Moving the mouse in client area */ -static const struct message WmMouseMoveInClientAreaSeq[] = { /* FIXME: add */ - { WM_NCHITTEST, sent }, - { WM_SETCURSOR, sent }, - { WM_MOUSEMOVE, posted }, - { 0 } -}; -/* Moving by dragging the title bar (after WM_NCHITTEST and WM_SETCURSOR) (outline move) */ -static const struct message WmDragTitleBarSeq[] = { /* FIXME: add */ - { WM_NCLBUTTONDOWN, sent|wparam, HTCAPTION }, - { WM_SYSCOMMAND, sent|defwinproc|wparam, SC_MOVE+2 }, - { WM_GETMINMAXINFO, sent|defwinproc }, - { WM_ENTERSIZEMOVE, sent|defwinproc }, - { WM_WINDOWPOSCHANGING, sent|defwinproc }, - { WM_WINDOWPOSCHANGED, sent|defwinproc }, - { WM_MOVE, sent|defwinproc }, - { WM_EXITSIZEMOVE, sent|defwinproc }, - { 0 } -}; -/* Sizing by dragging the thick borders (after WM_NCHITTEST and WM_SETCURSOR) (outline move) */ -static const struct message WmDragThickBordersBarSeq[] = { /* FIXME: add */ - { WM_NCLBUTTONDOWN, sent|wparam, 0xd }, - { WM_SYSCOMMAND, sent|defwinproc|wparam, 0xf004 }, - { WM_GETMINMAXINFO, sent|defwinproc }, - { WM_ENTERSIZEMOVE, sent|defwinproc }, - { WM_SIZING, sent|defwinproc|wparam, 4}, /* one for each mouse movement */ - { WM_WINDOWPOSCHANGING, sent|defwinproc }, - { WM_GETMINMAXINFO, sent|defwinproc }, - { WM_NCCALCSIZE, sent|defwinproc|wparam, 1 }, - { WM_NCPAINT, sent|defwinproc|wparam, 1 }, - { WM_GETTEXT, sent|defwinproc }, - { WM_ERASEBKGND, sent|defwinproc }, - { WM_WINDOWPOSCHANGED, sent|defwinproc }, - { WM_MOVE, sent|defwinproc }, - { WM_SIZE, sent|defwinproc }, - { WM_EXITSIZEMOVE, sent|defwinproc }, - { 0 } -}; -/* Resizing child window with MoveWindow (32) */ -static const struct message WmResizingChildWithMoveWindowSeq[] = { - { WM_WINDOWPOSCHANGING, sent }, - { WM_NCCALCSIZE, sent|wparam, 1 }, - { WM_ERASEBKGND, sent|optional }, - { WM_WINDOWPOSCHANGED, sent }, - { WM_MOVE, sent|defwinproc }, - { WM_SIZE, sent|defwinproc }, - { 0 } -}; -/* Clicking on inactive button */ -static const struct message WmClickInactiveButtonSeq[] = { /* FIXME: add */ - { WM_NCHITTEST, sent }, - { WM_PARENTNOTIFY, sent|parent|wparam, WM_LBUTTONDOWN }, - { WM_MOUSEACTIVATE, sent }, - { WM_MOUSEACTIVATE, sent|parent|defwinproc }, - { WM_SETCURSOR, sent }, - { WM_SETCURSOR, sent|parent|defwinproc }, - { WM_LBUTTONDOWN, posted }, - { WM_KILLFOCUS, posted|parent }, - { WM_SETFOCUS, posted }, - { WM_CTLCOLORBTN, posted|parent }, - { BM_SETSTATE, posted }, - { WM_CTLCOLORBTN, posted|parent }, - { WM_LBUTTONUP, posted }, - { BM_SETSTATE, posted }, - { WM_CTLCOLORBTN, posted|parent }, - { WM_COMMAND, posted|parent }, - { 0 } -}; -/* Reparenting a button (16/32) */ -/* The last child (button) reparented gets topmost for its new parent. */ -static const struct message WmReparentButtonSeq[] = { /* FIXME: add */ - { WM_SHOWWINDOW, sent|wparam, 0 }, - { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER }, - { WM_ERASEBKGND, sent|parent }, - { WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER }, - { WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOSIZE|SWP_NOZORDER }, - { WM_CHILDACTIVATE, sent }, - { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOSIZE|SWP_NOREDRAW|SWP_NOZORDER }, - { WM_MOVE, sent|defwinproc }, - { WM_SHOWWINDOW, sent|wparam, 1 }, - { 0 } -}; -/* Creation of a custom dialog (32) */ -static const struct message WmCreateCustomDialogSeq[] = { - { HCBT_CREATEWND, hook }, - { WM_GETMINMAXINFO, sent }, - { WM_NCCREATE, sent }, - { WM_NCCALCSIZE, sent|wparam, 0 }, - { WM_CREATE, sent }, - { WM_SHOWWINDOW, sent|wparam, 1 }, - { HCBT_ACTIVATE, hook }, - { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 }, - { WM_WINDOWPOSCHANGING, sent|wparam, 0 }, - { WM_NCACTIVATE, sent|wparam, 1 }, - { WM_GETTEXT, sent|optional|defwinproc }, - { WM_GETICON, sent|optional|defwinproc }, - { WM_GETICON, sent|optional|defwinproc }, - { WM_GETICON, sent|optional|defwinproc }, - { WM_GETTEXT, sent|optional|defwinproc }, - { WM_ACTIVATE, sent|wparam, 1 }, - { WM_KILLFOCUS, sent|parent }, - { WM_IME_SETCONTEXT, sent|parent|wparam|optional, 0 }, - { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, - { WM_SETFOCUS, sent }, - { WM_GETDLGCODE, sent|defwinproc|wparam, 0 }, - { WM_WINDOWPOSCHANGING, sent|wparam, 0 }, - { WM_NCPAINT, sent|wparam, 1 }, - { WM_GETTEXT, sent|optional|defwinproc }, - { WM_GETICON, sent|optional|defwinproc }, - { WM_GETICON, sent|optional|defwinproc }, - { WM_GETICON, sent|optional|defwinproc }, - { WM_GETTEXT, sent|optional|defwinproc }, - { WM_ERASEBKGND, sent }, - { WM_CTLCOLORDLG, sent|defwinproc }, - { WM_WINDOWPOSCHANGED, sent|wparam, 0 }, - { WM_GETTEXT, sent|optional }, - { WM_GETICON, sent|optional }, - { WM_GETICON, sent|optional }, - { WM_GETICON, sent|optional }, - { WM_GETTEXT, sent|optional }, - { WM_NCCALCSIZE, sent|optional }, - { WM_NCPAINT, sent|optional }, - { WM_GETTEXT, sent|optional|defwinproc }, - { WM_GETICON, sent|optional|defwinproc }, - { WM_GETICON, sent|optional|defwinproc }, - { WM_GETICON, sent|optional|defwinproc }, - { WM_GETTEXT, sent|optional|defwinproc }, - { WM_ERASEBKGND, sent|optional }, - { WM_CTLCOLORDLG, sent|optional|defwinproc }, - { WM_SIZE, sent }, - { WM_MOVE, sent }, - { 0 } -}; -/* Calling EndDialog for a custom dialog (32) */ -static const struct message WmEndCustomDialogSeq[] = { - { WM_WINDOWPOSCHANGING, sent }, - { WM_WINDOWPOSCHANGED, sent }, - { WM_GETTEXT, sent|optional }, - { WM_GETICON, sent|optional }, - { WM_GETICON, sent|optional }, - { WM_GETICON, sent|optional }, - { HCBT_ACTIVATE, hook }, - { WM_NCACTIVATE, sent|wparam, 0 }, - { WM_GETTEXT, sent|optional|defwinproc }, - { WM_GETICON, sent|optional|defwinproc }, - { WM_GETICON, sent|optional|defwinproc }, - { WM_GETICON, sent|optional|defwinproc }, - { WM_GETTEXT, sent|optional|defwinproc }, - { WM_ACTIVATE, sent|wparam, 0 }, - { WM_WINDOWPOSCHANGING, sent|optional }, - { HCBT_SETFOCUS, hook }, - { WM_KILLFOCUS, sent }, - { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, - { WM_IME_SETCONTEXT, sent|parent|wparam|defwinproc|optional, 1 }, - { WM_SETFOCUS, sent|parent|defwinproc }, - { 0 } -}; -/* Creation and destruction of a modal dialog (32) */ -static const struct message WmModalDialogSeq[] = { - { WM_CANCELMODE, sent|parent }, - { WM_KILLFOCUS, sent|parent }, - { WM_IME_SETCONTEXT, sent|parent|wparam|optional, 0 }, - { WM_ENABLE, sent|parent|wparam, 0 }, - { WM_SETFONT, sent }, - { WM_INITDIALOG, sent }, - { WM_CHANGEUISTATE, sent|optional }, - { WM_SHOWWINDOW, sent }, - { WM_WINDOWPOSCHANGING, sent }, - { WM_NCACTIVATE, sent|wparam, 1 }, - { WM_GETICON, sent|optional }, - { WM_GETICON, sent|optional }, - { WM_GETICON, sent|optional }, - { WM_GETTEXT, sent|optional }, - { WM_ACTIVATE, sent|wparam, 1 }, - { WM_WINDOWPOSCHANGING, sent }, - { WM_NCPAINT, sent }, - { WM_GETICON, sent|optional }, - { WM_GETICON, sent|optional }, - { WM_GETICON, sent|optional }, - { WM_GETTEXT, sent|optional }, - { WM_ERASEBKGND, sent }, - { WM_CTLCOLORDLG, sent }, - { WM_WINDOWPOSCHANGED, sent }, - { WM_GETICON, sent|optional }, - { WM_GETICON, sent|optional }, - { WM_GETICON, sent|optional }, - { WM_GETTEXT, sent|optional }, - { WM_NCCALCSIZE, sent|optional }, - { WM_NCPAINT, sent|optional }, - { WM_GETICON, sent|optional }, - { WM_GETICON, sent|optional }, - { WM_GETICON, sent|optional }, - { WM_GETTEXT, sent|optional }, - { WM_ERASEBKGND, sent|optional }, - { WM_CTLCOLORDLG, sent|optional }, - { WM_PAINT, sent|optional }, - { WM_CTLCOLORBTN, sent }, - { WM_ENTERIDLE, sent|parent }, - { WM_TIMER, sent }, - { WM_ENABLE, sent|parent|wparam, 1 }, - { WM_WINDOWPOSCHANGING, sent }, - { WM_WINDOWPOSCHANGED, sent }, - { WM_GETICON, sent|optional }, - { WM_GETICON, sent|optional }, - { WM_GETICON, sent|optional }, - { WM_GETTEXT, sent|optional }, - { HCBT_ACTIVATE, hook }, - { WM_NCACTIVATE, sent|wparam, 0 }, - { WM_GETICON, sent|optional }, - { WM_GETICON, sent|optional }, - { WM_GETICON, sent|optional }, - { WM_GETTEXT, sent|optional }, - { WM_ACTIVATE, sent|wparam, 0 }, - { WM_WINDOWPOSCHANGING, sent|optional }, - { HCBT_SETFOCUS, hook }, - { WM_IME_SETCONTEXT, sent|parent|wparam|defwinproc|optional, 1 }, - { WM_SETFOCUS, sent|parent|defwinproc }, - { WM_DESTROY, sent }, - { WM_NCDESTROY, sent }, - { 0 } -}; -/* Creation of a modal dialog that is resized inside WM_INITDIALOG (32) */ -static const struct message WmCreateModalDialogResizeSeq[] = { /* FIXME: add */ - /* (inside dialog proc, handling WM_INITDIALOG) */ - { WM_WINDOWPOSCHANGING, sent }, - { WM_NCCALCSIZE, sent }, - { WM_NCACTIVATE, sent|parent|wparam, 0 }, - { WM_GETTEXT, sent|defwinproc }, - { WM_ACTIVATE, sent|parent|wparam, 0 }, - { WM_WINDOWPOSCHANGING, sent }, - { WM_WINDOWPOSCHANGING, sent|parent }, - { WM_NCACTIVATE, sent|wparam, 1 }, - { WM_ACTIVATE, sent|wparam, 1 }, - { WM_WINDOWPOSCHANGED, sent }, - { WM_SIZE, sent|defwinproc }, - /* (setting focus) */ - { WM_SHOWWINDOW, sent|wparam, 1 }, - { WM_WINDOWPOSCHANGING, sent }, - { WM_NCPAINT, sent }, - { WM_GETTEXT, sent|defwinproc }, - { WM_ERASEBKGND, sent }, - { WM_CTLCOLORDLG, sent|defwinproc }, - { WM_WINDOWPOSCHANGED, sent }, - { WM_PAINT, sent }, - /* (bunch of WM_CTLCOLOR* for each control) */ - { WM_PAINT, sent|parent }, - { WM_ENTERIDLE, sent|parent|wparam, 0 }, - { WM_SETCURSOR, sent|parent }, - { 0 } -}; -/* SetMenu for NonVisible windows with size change*/ -static const struct message WmSetMenuNonVisibleSizeChangeSeq[] = { - { WM_WINDOWPOSCHANGING, sent|wparam, 0 }, - { WM_NCCALCSIZE, sent|wparam, 1 }, - { WM_WINDOWPOSCHANGED, sent|wparam, 0 }, - { WM_MOVE, sent|defwinproc }, - { WM_SIZE, sent|defwinproc }, - { WM_GETICON, sent|optional }, - { WM_GETICON, sent|optional }, - { WM_GETICON, sent|optional }, - { WM_GETTEXT, sent|optional }, - { WM_NCCALCSIZE, sent|wparam|optional, 1 }, - { 0 } -}; -/* SetMenu for NonVisible windows with no size change */ -static const struct message WmSetMenuNonVisibleNoSizeChangeSeq[] = { - { WM_WINDOWPOSCHANGING, sent|wparam, 0 }, - { WM_NCCALCSIZE, sent|wparam, 1 }, - { WM_WINDOWPOSCHANGED, sent|wparam, 0 }, - { 0 } -}; -/* SetMenu for Visible windows with size change */ -static const struct message WmSetMenuVisibleSizeChangeSeq[] = { - { WM_WINDOWPOSCHANGING, sent|wparam, 0 }, - { WM_NCCALCSIZE, sent|wparam, 1 }, - { WM_NCPAINT, sent|wparam, 1 }, - { WM_GETTEXT, sent|defwinproc|optional }, - { WM_ERASEBKGND, sent|optional }, - { WM_ACTIVATE, sent|optional }, - { WM_WINDOWPOSCHANGED, sent|wparam, 0 }, - { WM_MOVE, sent|defwinproc }, - { WM_SIZE, sent|defwinproc }, - { WM_NCCALCSIZE, sent|wparam|optional, 1 }, - { WM_NCPAINT, sent|wparam|optional, 1 }, - { WM_ERASEBKGND, sent|optional }, - { 0 } -}; -/* SetMenu for Visible windows with no size change */ -static const struct message WmSetMenuVisibleNoSizeChangeSeq[] = { - { WM_WINDOWPOSCHANGING, sent|wparam, 0 }, - { WM_NCCALCSIZE, sent|wparam, 1 }, - { WM_NCPAINT, sent|wparam, 1 }, - { WM_GETTEXT, sent|defwinproc|optional }, - { WM_ERASEBKGND, sent|optional }, - { WM_ACTIVATE, sent|optional }, - { WM_WINDOWPOSCHANGED, sent|wparam, 0 }, - { 0 } -}; -/* DrawMenuBar for a visible window */ -static const struct message WmDrawMenuBarSeq[] = -{ - { WM_WINDOWPOSCHANGING, sent|wparam, 0 }, - { WM_NCCALCSIZE, sent|wparam, 1 }, - { WM_NCPAINT, sent|wparam, 1 }, - { WM_GETTEXT, sent|defwinproc|optional }, - { WM_ERASEBKGND, sent|optional }, - { WM_WINDOWPOSCHANGED, sent|wparam, 0 }, - { 0 } -}; - -static const struct message WmSetRedrawFalseSeq[] = -{ - { WM_SETREDRAW, sent|wparam, 0 }, - { 0 } -}; - -static const struct message WmSetRedrawTrueSeq[] = -{ - { WM_SETREDRAW, sent|wparam, 1 }, - { 0 } -}; - -static int after_end_dialog; -static int sequence_cnt, sequence_size; -static struct message* sequence; - -static void add_message(const struct message *msg) -{ - if (!sequence) - { - sequence_size = 10; - sequence = HeapAlloc( GetProcessHeap(), 0, sequence_size * sizeof (struct message) ); - } - if (sequence_cnt == sequence_size) - { - sequence_size *= 2; - sequence = HeapReAlloc( GetProcessHeap(), 0, sequence, sequence_size * sizeof (struct message) ); - } - assert(sequence); - - sequence[sequence_cnt].message = msg->message; - sequence[sequence_cnt].flags = msg->flags; - sequence[sequence_cnt].wParam = msg->wParam; - sequence[sequence_cnt].lParam = msg->lParam; - - sequence_cnt++; -} - -static void flush_sequence() -{ - HeapFree(GetProcessHeap(), 0, sequence); - sequence = 0; - sequence_cnt = sequence_size = 0; -} - -static void ok_sequence(const struct message *expected, const char *context) -{ - static const struct message end_of_sequence = { 0, 0, 0, 0 }; - const struct message *actual; - - add_message(&end_of_sequence); - - actual = sequence; - - while (expected->message && actual->message) - { - trace("expected %04x - actual %04x\n", expected->message, actual->message); - - if (expected->message == actual->message) - { - if (expected->flags & wparam) - ok (expected->wParam == actual->wParam, - "%s: in msg 0x%04x expecting wParam 0x%x got 0x%x\n", - context, expected->message, expected->wParam, actual->wParam); - if (expected->flags & lparam) - ok (expected->lParam == actual->lParam, - "%s: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n", - context, expected->message, expected->lParam, actual->lParam); - ok ((expected->flags & defwinproc) == (actual->flags & defwinproc), - "%s: the msg 0x%04x should %shave been sent by DefWindowProc\n", - context, expected->message, (expected->flags & defwinproc) ? "" : "NOT "); - ok ((expected->flags & (sent|posted)) == (actual->flags & (sent|posted)), - "%s: the msg 0x%04x should have been %s\n", - context, expected->message, (expected->flags & posted) ? "posted" : "sent"); - ok ((expected->flags & parent) == (actual->flags & parent), - "%s: the msg 0x%04x was expected in %s\n", - context, expected->message, (expected->flags & parent) ? "parent" : "child"); - ok ((expected->flags & hook) == (actual->flags & hook), - "%s: the msg 0x%04x should have been sent by a hook\n", - context, expected->message); - expected++; - actual++; - } - else if (expected->flags & optional) - expected++; - else - { - todo_wine { - ok (FALSE, "%s: the msg 0x%04x was expected, but got msg 0x%04x instead\n", - context, expected->message, actual->message); - expected++; - actual++; - } - } - } - - /* skip all optional trailing messages */ - while (expected->message && (expected->flags & optional)) - expected++; - // the next test was disabled because it fails in XP - Royce3 - /*todo_wine { - if (expected->message || actual->message) - ok (FALSE, "%s: the msg sequence is not complete (got 0x%04x)\n", context, actual->message); - }*/ - - flush_sequence(); -} - -static void test_WM_SETREDRAW(HWND hwnd) -{ - DWORD style = GetWindowLongA(hwnd, GWL_STYLE); - - flush_sequence(); - - SendMessageA(hwnd, WM_SETREDRAW, FALSE, 0); - ok_sequence(WmSetRedrawFalseSeq, "SetRedraw:FALSE"); - - ok(!(GetWindowLongA(hwnd, GWL_STYLE) & WS_VISIBLE), "WS_VISIBLE should NOT be set\n"); - ok(!IsWindowVisible(hwnd), "IsWindowVisible() should return FALSE\n"); - - flush_sequence(); - SendMessageA(hwnd, WM_SETREDRAW, TRUE, 0); - ok_sequence(WmSetRedrawTrueSeq, "SetRedraw:TRUE"); - - ok(GetWindowLongA(hwnd, GWL_STYLE) & WS_VISIBLE, "WS_VISIBLE should be set\n"); - ok(IsWindowVisible(hwnd), "IsWindowVisible() should return TRUE\n"); - - /* restore original WS_VISIBLE state */ - SetWindowLongA(hwnd, GWL_STYLE, style); - - flush_sequence(); -} - -static INT_PTR CALLBACK TestModalDlgProcA(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - struct message msg; - - trace("dialog: %p, %04x, %08x, %08lx\n", hwnd, message, wParam, lParam); - - msg.message = message; - msg.flags = sent|wparam|lparam; - msg.wParam = wParam; - msg.lParam = lParam; - add_message(&msg); - - if (message == WM_INITDIALOG) SetTimer( hwnd, 1, 100, NULL ); - if (message == WM_TIMER) EndDialog( hwnd, 0 ); - return 0; -} - -/* test if we receive the right sequence of messages */ -static void test_messages(void) -{ - HWND hwnd, hparent, hchild; - HWND hchild2, hbutton; - HMENU hmenu; - - hwnd = CreateWindowExA(0, "TestWindowClass", "Test overlapped", WS_OVERLAPPEDWINDOW, - 100, 100, 200, 200, 0, 0, 0, NULL); - ok (hwnd != 0, "Failed to create overlapped window\n"); - ok_sequence(WmCreateOverlappedSeq, "CreateWindow:overlapped"); - - /* test WM_SETREDRAW on a not visible top level window */ - test_WM_SETREDRAW(hwnd); - - SetWindowPos(hwnd, 0,0,0,0,0, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE); - ok_sequence(WmSWP_ShowOverlappedSeq, "SetWindowPos:SWP_SHOWWINDOW:overlapped"); - ok(IsWindowVisible(hwnd), "window should be visible at this point\n"); - - ok(GetActiveWindow() == hwnd, "window should be active\n"); - ok(GetFocus() == hwnd, "window should have input focus\n"); - ShowWindow(hwnd, SW_HIDE); - ok_sequence(WmHideOverlappedSeq, "ShowWindow(SW_HIDE):overlapped"); - - ShowWindow(hwnd, SW_SHOW); - ok_sequence(WmShowOverlappedSeq, "ShowWindow(SW_SHOW):overlapped"); - - ok(GetActiveWindow() == hwnd, "window should be active\n"); - ok(GetFocus() == hwnd, "window should have input focus\n"); - SetWindowPos(hwnd, 0,0,0,0,0, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE); - ok_sequence(WmSWP_HideOverlappedSeq, "SetWindowPos:SWP_HIDEWINDOW:overlapped"); - ok(!IsWindowVisible(hwnd), "window should not be visible at this point\n"); - - /* test WM_SETREDRAW on a visible top level window */ - ShowWindow(hwnd, SW_SHOW); - test_WM_SETREDRAW(hwnd); - - DestroyWindow(hwnd); - ok_sequence(WmDestroyOverlappedSeq, "DestroyWindow:overlapped"); - - hparent = CreateWindowExA(0, "TestParentClass", "Test parent", WS_OVERLAPPEDWINDOW | WS_VISIBLE, - 100, 100, 200, 200, 0, 0, 0, NULL); - ok (hparent != 0, "Failed to create parent window\n"); - flush_sequence(); - - hchild = CreateWindowExA(0, "TestWindowClass", "Test child", WS_CHILD | WS_MAXIMIZE, - 0, 0, 10, 10, hparent, 0, 0, NULL); - ok (hchild != 0, "Failed to create child window\n"); - ok_sequence(WmCreateMaximizedChildSeq, "CreateWindow:maximized child"); - DestroyWindow(hchild); - flush_sequence(); - - hchild = CreateWindowExA(0, "TestWindowClass", "Test child", WS_CHILDWINDOW, - 0, 0, 10, 10, hparent, 0, 0, NULL); - ok (hchild != 0, "Failed to create child window\n"); - ok_sequence(WmCreateChildSeq, "CreateWindow:child"); - - hchild2 = CreateWindowExA(0, "SimpleWindowClass", "Test child2", WS_CHILDWINDOW, - 100, 100, 50, 50, hparent, 0, 0, NULL); - ok (hchild2 != 0, "Failed to create child2 window\n"); - flush_sequence(); - - hbutton = CreateWindowExA(0, "TestWindowClass", "Test button", WS_CHILDWINDOW, - 0, 100, 50, 50, hchild, 0, 0, NULL); - ok (hbutton != 0, "Failed to create button window\n"); - - /* test WM_SETREDRAW on a not visible child window */ - test_WM_SETREDRAW(hchild); - - ShowWindow(hchild, SW_SHOW); - ok_sequence(WmShowChildSeq, "ShowWindow:child"); - - /* test WM_SETREDRAW on a visible child window */ - test_WM_SETREDRAW(hchild); - - SetFocus(hchild); - flush_sequence(); - - MoveWindow(hchild, 10, 10, 20, 20, TRUE); - ok_sequence(WmResizingChildWithMoveWindowSeq, "MoveWindow:child"); - - DestroyWindow(hchild); - ok_sequence(WmDestroyChildSeq, "DestroyWindow:child"); - DestroyWindow(hchild2); - DestroyWindow(hbutton); - - flush_sequence(); - hchild = CreateWindowExA(0, "TestWindowClass", "Test Child Popup", WS_CHILD | WS_POPUP, - 0, 0, 100, 100, hparent, 0, 0, NULL); - ok (hchild != 0, "Failed to create child popup window\n"); - ok_sequence(WmCreateChildPopupSeq, "CreateWindow:child_popup"); - DestroyWindow(hchild); - - /* test what happens to a window which sets WS_VISIBLE in WM_CREATE */ - flush_sequence(); - hchild = CreateWindowExA(0, "TestPopupClass", "Test Popup", WS_POPUP, - 0, 0, 100, 100, hparent, 0, 0, NULL); - ok (hchild != 0, "Failed to create popup window\n"); - ok_sequence(WmCreateInvisiblePopupSeq, "CreateWindow:invisible_popup"); - ok(GetWindowLongA(hchild, GWL_STYLE) & WS_VISIBLE, "WS_VISIBLE should be set\n"); - ok(IsWindowVisible(hchild), "IsWindowVisible() should return TRUE\n"); - flush_sequence(); - ShowWindow(hchild, SW_SHOW); - ok_sequence(WmShowVisiblePopupSeq, "CreateWindow:show_visible_popup"); - flush_sequence(); - SetWindowPos(hchild, 0,0,0,0,0, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER); - ok_sequence(WmShowVisiblePopupSeq_2, "CreateWindow:show_visible_popup_2"); - flush_sequence(); - SetWindowPos(hchild, 0,0,0,0,0, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE); - ok_sequence(WmShowVisiblePopupSeq_3, "CreateWindow:show_visible_popup_3"); - DestroyWindow(hchild); - - /* this time add WS_VISIBLE for CreateWindowEx, but this fact actually - * changes nothing in message sequences. - */ - flush_sequence(); - hchild = CreateWindowExA(0, "TestPopupClass", "Test Popup", WS_POPUP | WS_VISIBLE, - 0, 0, 100, 100, hparent, 0, 0, NULL); - ok (hchild != 0, "Failed to create popup window\n"); - ok_sequence(WmCreateInvisiblePopupSeq, "CreateWindow:invisible_popup"); - ok(GetWindowLongA(hchild, GWL_STYLE) & WS_VISIBLE, "WS_VISIBLE should be set\n"); - ok(IsWindowVisible(hchild), "IsWindowVisible() should return TRUE\n"); - flush_sequence(); - ShowWindow(hchild, SW_SHOW); - ok_sequence(WmShowVisiblePopupSeq, "CreateWindow:show_visible_popup"); - flush_sequence(); - SetWindowPos(hchild, 0,0,0,0,0, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER); - ok_sequence(WmShowVisiblePopupSeq_2, "CreateWindow:show_visible_popup_2"); - DestroyWindow(hchild); - - flush_sequence(); - hwnd = CreateWindowExA(WS_EX_DLGMODALFRAME, "TestDialogClass", NULL, WS_VISIBLE|WS_CAPTION|WS_SYSMENU|WS_DLGFRAME, - 0, 0, 100, 100, hparent, 0, 0, NULL); - ok(hwnd != 0, "Failed to create custom dialog window\n"); - ok_sequence(WmCreateCustomDialogSeq, "CreateCustomDialog"); - - flush_sequence(); - after_end_dialog = 1; - EndDialog( hwnd, 0 ); - ok_sequence(WmEndCustomDialogSeq, "EndCustomDialog"); - - DestroyWindow(hwnd); - after_end_dialog = 0; - - flush_sequence(); - DialogBoxA( 0, "TEST_DIALOG", hparent, TestModalDlgProcA ); - ok_sequence(WmModalDialogSeq, "ModalDialog"); - - DestroyWindow(hparent); - flush_sequence(); - - /* Message sequence for SetMenu */ - hmenu = CreateMenu(); - ok (hmenu != 0, "Failed to create menu\n"); - ok (InsertMenuA(hmenu, -1, MF_BYPOSITION, 0x1000, "foo"), "InsertMenu failed\n"); - hwnd = CreateWindowExA(0, "TestWindowClass", "Test overlapped", WS_OVERLAPPEDWINDOW, - 100, 100, 200, 200, 0, hmenu, 0, NULL); - ok_sequence(WmCreateOverlappedSeq, "CreateWindow:overlapped"); - ok (SetMenu(hwnd, 0), "SetMenu\n"); - ok_sequence(WmSetMenuNonVisibleSizeChangeSeq, "SetMenu:NonVisibleSizeChange"); - ok (SetMenu(hwnd, 0), "SetMenu\n"); - ok_sequence(WmSetMenuNonVisibleNoSizeChangeSeq, "SetMenu:NonVisibleNoSizeChange"); - ShowWindow(hwnd, SW_SHOW); - flush_sequence(); - ok (SetMenu(hwnd, 0), "SetMenu\n"); - ok_sequence(WmSetMenuVisibleNoSizeChangeSeq, "SetMenu:VisibleNoSizeChange"); - ok (SetMenu(hwnd, hmenu), "SetMenu\n"); - ok_sequence(WmSetMenuVisibleSizeChangeSeq, "SetMenu:VisibleSizeChange"); - - ok(DrawMenuBar(hwnd), "DrawMenuBar\n"); - ok_sequence(WmDrawMenuBarSeq, "DrawMenuBar"); - - DestroyWindow(hwnd); -} - -static LRESULT WINAPI MsgCheckProcA(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - static long defwndproc_counter = 0; - LRESULT ret; - struct message msg; - - trace("%p, %04x, %08x, %08lx\n", hwnd, message, wParam, lParam); - - msg.message = message; - msg.flags = sent|wparam|lparam; - if (defwndproc_counter) msg.flags |= defwinproc; - msg.wParam = wParam; - msg.lParam = lParam; - add_message(&msg); - - if (message == WM_GETMINMAXINFO && (GetWindowLongA(hwnd, GWL_STYLE) & WS_CHILD)) - { - HWND parent = GetParent(hwnd); - RECT rc; - MINMAXINFO *minmax = (MINMAXINFO *)lParam; - - GetClientRect(parent, &rc); - trace("parent %p client size = (%ld x %ld)\n", parent, rc.right, rc.bottom); - - trace("ptReserved = (%ld,%ld)\n" - "ptMaxSize = (%ld,%ld)\n" - "ptMaxPosition = (%ld,%ld)\n" - "ptMinTrackSize = (%ld,%ld)\n" - "ptMaxTrackSize = (%ld,%ld)\n", - minmax->ptReserved.x, minmax->ptReserved.y, - minmax->ptMaxSize.x, minmax->ptMaxSize.y, - minmax->ptMaxPosition.x, minmax->ptMaxPosition.y, - minmax->ptMinTrackSize.x, minmax->ptMinTrackSize.y, - minmax->ptMaxTrackSize.x, minmax->ptMaxTrackSize.y); - - ok(minmax->ptMaxSize.x == rc.right, "default width of maximized child %ld != %ld\n", - minmax->ptMaxSize.x, rc.right); - ok(minmax->ptMaxSize.y == rc.bottom, "default height of maximized child %ld != %ld\n", - minmax->ptMaxSize.y, rc.bottom); - } - - defwndproc_counter++; - ret = DefWindowProcA(hwnd, message, wParam, lParam); - defwndproc_counter--; - - return ret; -} - -static LRESULT WINAPI PopupMsgCheckProcA(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - static long defwndproc_counter = 0; - LRESULT ret; - struct message msg; - - trace("popup: %p, %04x, %08x, %08lx\n", hwnd, message, wParam, lParam); - - msg.message = message; - msg.flags = sent|wparam|lparam; - if (defwndproc_counter) msg.flags |= defwinproc; - msg.wParam = wParam; - msg.lParam = lParam; - add_message(&msg); - - if (message == WM_CREATE) - { - DWORD style = GetWindowLongA(hwnd, GWL_STYLE) | WS_VISIBLE; - SetWindowLongA(hwnd, GWL_STYLE, style); - } - - defwndproc_counter++; - ret = DefWindowProcA(hwnd, message, wParam, lParam); - defwndproc_counter--; - - return ret; -} - -static LRESULT WINAPI ParentMsgCheckProcA(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - static long defwndproc_counter = 0; - LRESULT ret; - struct message msg; - - trace("parent: %p, %04x, %08x, %08lx\n", hwnd, message, wParam, lParam); - - if (message == WM_PARENTNOTIFY || message == WM_CANCELMODE || - message == WM_SETFOCUS || message == WM_KILLFOCUS || - message == WM_ENABLE || message == WM_ENTERIDLE || - message == WM_IME_SETCONTEXT) - { - msg.message = message; - msg.flags = sent|parent|wparam|lparam; - if (defwndproc_counter) msg.flags |= defwinproc; - msg.wParam = wParam; - msg.lParam = lParam; - add_message(&msg); - } - - defwndproc_counter++; - ret = DefWindowProcA(hwnd, message, wParam, lParam); - defwndproc_counter--; - - return ret; -} - -static LRESULT WINAPI TestDlgProcA(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - static long defwndproc_counter = 0; - LRESULT ret; - struct message msg; - - trace("dialog: %p, %04x, %08x, %08lx\n", hwnd, message, wParam, lParam); - - DefDlgProcA(hwnd, DM_SETDEFID, 1, 0); - ret = DefDlgProcA(hwnd, DM_GETDEFID, 0, 0); - if (after_end_dialog) - ok( ret == 0, "DM_GETDEFID should return 0 after EndDialog, got %lx\n", ret ); - else - ok(HIWORD(ret) == DC_HASDEFID, "DM_GETDEFID should return DC_HASDEFID, got %lx\n", ret); - - msg.message = message; - msg.flags = sent|wparam|lparam; - if (defwndproc_counter) msg.flags |= defwinproc; - msg.wParam = wParam; - msg.lParam = lParam; - add_message(&msg); - - defwndproc_counter++; - ret = DefDlgProcA(hwnd, message, wParam, lParam); - defwndproc_counter--; - - return ret; -} - -static BOOL RegisterWindowClasses(void) -{ - WNDCLASSA cls; - - cls.style = 0; - cls.lpfnWndProc = MsgCheckProcA; - cls.cbClsExtra = 0; - cls.cbWndExtra = 0; - cls.hInstance = GetModuleHandleA(0); - cls.hIcon = 0; - cls.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW); - cls.hbrBackground = GetStockObject(WHITE_BRUSH); - cls.lpszMenuName = NULL; - cls.lpszClassName = "TestWindowClass"; - if(!RegisterClassA(&cls)) return FALSE; - - cls.lpfnWndProc = PopupMsgCheckProcA; - cls.lpszClassName = "TestPopupClass"; - if(!RegisterClassA(&cls)) return FALSE; - - cls.lpfnWndProc = ParentMsgCheckProcA; - cls.lpszClassName = "TestParentClass"; - if(!RegisterClassA(&cls)) return FALSE; - - cls.lpfnWndProc = DefWindowProcA; - cls.lpszClassName = "SimpleWindowClass"; - if(!RegisterClassA(&cls)) return FALSE; - - ok(GetClassInfoA(0, "#32770", &cls), "GetClassInfo failed\n"); - cls.lpfnWndProc = TestDlgProcA; - cls.lpszClassName = "TestDialogClass"; - if(!RegisterClassA(&cls)) return FALSE; - - return TRUE; -} - -static HHOOK hCBT_hook; - -static LRESULT CALLBACK cbt_hook_proc(int nCode, WPARAM wParam, LPARAM lParam) -{ - char buf[256]; - - trace("CBT: %d, %08x, %08lx\n", nCode, wParam, lParam); - - if (GetClassNameA((HWND)wParam, buf, sizeof(buf))) - { - if (!strcmp(buf, "TestWindowClass") || - !strcmp(buf, "TestParentClass") || - !strcmp(buf, "TestPopupClass") || - !strcmp(buf, "SimpleWindowClass") || - !strcmp(buf, "TestDialogClass")) - { - struct message msg; - - msg.message = nCode; - msg.flags = hook; - msg.wParam = wParam; - msg.lParam = lParam; - add_message(&msg); - } - } - return CallNextHookEx(hCBT_hook, nCode, wParam, lParam); -} - -START_TEST(msg) -{ - if (!RegisterWindowClasses()) assert(0); - - hCBT_hook = SetWindowsHookExA(WH_CBT, cbt_hook_proc, 0, GetCurrentThreadId()); - assert(hCBT_hook); - - test_messages(); - - UnhookWindowsHookEx(hCBT_hook); -} diff --git a/reactos/apps/tests/user32/resource.c b/reactos/apps/tests/user32/resource.c deleted file mode 100644 index 66b4a1de614..00000000000 --- a/reactos/apps/tests/user32/resource.c +++ /dev/null @@ -1,59 +0,0 @@ -/* Unit test suite for resources. - * - * Copyright 2004 Ferenc Wagner - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include - -#include "wine/test.h" - -void -test_LoadStringA (void) -{ - HINSTANCE hInst = GetModuleHandle (NULL); - static const char str[] = "String resource"; /* same in resource.rc */ - char buf[128]; - struct string_test { - int bufsiz; - int expected; - }; - struct string_test tests[] = {{sizeof buf, sizeof str - 1}, - {sizeof str, sizeof str - 1}, - {sizeof str - 1, sizeof str - 2}}; - int i; - - assert (sizeof str < sizeof buf); - for (i = 0; i < sizeof tests / sizeof tests[0]; i++) { - const int bufsiz = tests[i].bufsiz; - const int expected = tests[i].expected; - const int len = LoadStringA (hInst, 0, buf, bufsiz); - - ok (len == expected, "bufsiz=%d: got %d, expected %d\n", - bufsiz, len, expected); - ok (!memcmp (buf, str, len), - "bufsiz=%d: got '%s', expected '%.*s'\n", - bufsiz, buf, len, str); - ok (buf[len] == 0, "bufsiz=%d: NUL termination missing\n", - bufsiz); - } -} - -START_TEST(resource) -{ - test_LoadStringA (); -} diff --git a/reactos/apps/tests/user32/sysparams.c b/reactos/apps/tests/user32/sysparams.c deleted file mode 100644 index 190fec695bd..00000000000 --- a/reactos/apps/tests/user32/sysparams.c +++ /dev/null @@ -1,1345 +0,0 @@ -/* Unit test suite for functions SystemParametersInfo and GetSystemMetrics. - * - * Copyright 2002 Andriy Palamarchuk - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include -#include - -#include "wine/test.h" -#include "windef.h" -#include "winbase.h" -#include "winreg.h" -#include "winuser.h" - -#ifndef SPI_GETDESKWALLPAPER -# define SPI_GETDESKWALLPAPER 0x0073 -#endif - -static int strict; - -#define eq(received, expected, label, type) \ - ok((received) == (expected), "%s: got " type " instead of " type "\n", (label),(received),(expected)) - - -#define SPI_SETBEEP_REGKEY "Control Panel\\Sound" -#define SPI_SETBEEP_VALNAME "Beep" -#define SPI_SETMOUSE_REGKEY "Control Panel\\Mouse" -#define SPI_SETMOUSE_VALNAME1 "MouseThreshold1" -#define SPI_SETMOUSE_VALNAME2 "MouseThreshold2" -#define SPI_SETMOUSE_VALNAME3 "MouseSpeed" -#define SPI_SETBORDER_REGKEY "Control Panel\\Desktop\\WindowMetrics" -#define SPI_SETBORDER_VALNAME "BorderWidth" -#define SPI_SETKEYBOARDSPEED_REGKEY "Control Panel\\Keyboard" -#define SPI_SETKEYBOARDSPEED_VALNAME "KeyboardSpeed" -#define SPI_SETSCREENSAVETIMEOUT_REGKEY "Control Panel\\Desktop" -#define SPI_SETSCREENSAVETIMEOUT_VALNAME "ScreenSaveTimeOut" -#define SPI_SETSCREENSAVEACTIVE_REGKEY "Control Panel\\Desktop" -#define SPI_SETSCREENSAVEACTIVE_VALNAME "ScreenSaveActive" -#define SPI_SETGRIDGRANULARITY_REGKEY "Control Panel\\Desktop" -#define SPI_SETGRIDGRANULARITY_VALNAME "GridGranularity" -#define SPI_SETKEYBOARDDELAY_REGKEY "Control Panel\\Keyboard" -#define SPI_SETKEYBOARDDELAY_VALNAME "KeyboardDelay" -#define SPI_SETICONTITLEWRAP_REGKEY1 "Control Panel\\Desktop\\WindowMetrics" -#define SPI_SETICONTITLEWRAP_REGKEY2 "Control Panel\\Desktop" -#define SPI_SETICONTITLEWRAP_VALNAME "IconTitleWrap" -#define SPI_SETMENUDROPALIGNMENT_REGKEY1 "Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows" -#define SPI_SETMENUDROPALIGNMENT_REGKEY2 "Control Panel\\Desktop" -#define SPI_SETMENUDROPALIGNMENT_VALNAME "MenuDropAlignment" -#define SPI_SETDOUBLECLKWIDTH_REGKEY1 "Control Panel\\Mouse" -#define SPI_SETDOUBLECLKWIDTH_REGKEY2 "Control Panel\\Desktop" -#define SPI_SETDOUBLECLKWIDTH_VALNAME "DoubleClickWidth" -#define SPI_SETDOUBLECLKHEIGHT_REGKEY1 "Control Panel\\Mouse" -#define SPI_SETDOUBLECLKHEIGHT_REGKEY2 "Control Panel\\Desktop" -#define SPI_SETDOUBLECLKHEIGHT_VALNAME "DoubleClickHeight" -#define SPI_SETDOUBLECLICKTIME_REGKEY "Control Panel\\Mouse" -#define SPI_SETDOUBLECLICKTIME_VALNAME "DoubleClickSpeed" -#define SPI_SETMOUSEBUTTONSWAP_REGKEY "Control Panel\\Mouse" -#define SPI_SETMOUSEBUTTONSWAP_VALNAME "SwapMouseButtons" -#define SPI_SETWORKAREA_REGKEY "Control Panel\\Desktop" -#define SPI_SETWORKAREA_VALNAME "WINE_WorkArea" -#define SPI_SETSHOWSOUNDS_REGKEY "Control Panel\\Accessibility\\ShowSounds" -#define SPI_SETSHOWSOUNDS_VALNAME "On" -#define SPI_SETDRAGFULLWINDOWS_REGKEY "Control Panel\\Desktop" -#define SPI_SETDRAGFULLWINDOWS_VALNAME "DragFullWindows" -#define SPI_SETMOUSEHOVERWIDTH_REGKEY "Control Panel\\Mouse" -#define SPI_SETMOUSEHOVERWIDTH_VALNAME "MouseHoverWidth" -#define SPI_SETMOUSEHOVERHEIGHT_REGKEY "Control Panel\\Mouse" -#define SPI_SETMOUSEHOVERHEIGHT_VALNAME "MouseHoverHeight" -#define SPI_SETMOUSEHOVERTIME_REGKEY "Control Panel\\Mouse" -#define SPI_SETMOUSEHOVERTIME_VALNAME "MouseHoverTime" -#define SPI_SETMOUSESCROLLLINES_REGKEY "Control Panel\\Desktop" -#define SPI_SETMOUSESCROLLLINES_VALNAME "WheelScrollLines" -#define SPI_SETMENUSHOWDELAY_REGKEY "Control Panel\\Desktop" -#define SPI_SETMENUSHOWDELAY_VALNAME "MenuShowDelay" -#define SPI_SETDESKWALLPAPER_REGKEY "Control Panel\\Desktop" -#define SPI_SETDESKWALLPAPER_VALNAME "Wallpaper" -/* FIXME - don't have access to Windows with this action (W95, NT5.0). Set real values */ -#define SPI_SETKEYBOARDPREF_REGKEY "Control Panel\\Desktop" -#define SPI_SETKEYBOARDPREF_VALNAME "WINE_WorkArea" -#define SPI_SETSCREENREADER_REGKEY "Control Panel\\Desktop" -#define SPI_SETSCREENREADER_VALNAME "???" - -/* volatile registry branch under CURRENT_USER_REGKEY for temporary values storage */ -#define WINE_CURRENT_USER_REGKEY "Wine" - -static HWND ghTestWnd; - -static DWORD WINAPI SysParamsThreadFunc( LPVOID lpParam ); -static LRESULT CALLBACK SysParamsTestWndProc( HWND hWnd, UINT msg, WPARAM wParam, - LPARAM lParam ); -static int change_counter; -static int change_last_param; - -static LRESULT CALLBACK SysParamsTestWndProc( HWND hWnd, UINT msg, WPARAM wParam, - LPARAM lParam ) -{ - switch (msg) { - - case WM_SETTINGCHANGE: - if (change_counter>0) { - ok(0,"too many changes counter=%d last change=%d\n", - change_counter,change_last_param); - } - change_counter++; - change_last_param = wParam; - break; - - case WM_DESTROY: - PostQuitMessage( 0 ); - break; - - default: - return( DefWindowProcA( hWnd, msg, wParam, lParam ) ); - } - - return 0; -} - -/* -Performs testing for system parameters messages -params: - - system parameter id - - supposed value of the registry key -*/ -static void test_change_message( int action, int optional ) -{ - if (change_counter==0 && optional==1) - return; - ok( 1 == change_counter, - "Missed a message: change_counter=%d\n", change_counter ); - change_counter = 0; - ok( action == change_last_param, - "Wrong action got %d expected %d\n", change_last_param, action ); - change_last_param = 0; -} - -/* - * Tests the HKEY_CURRENT_USER subkey value. - * The value should contain string value. - * - * Params: - * lpsSubKey - subkey name - * lpsRegName - registry entry name - * lpsTestValue - value to test - */ -static void _test_reg_key( LPCSTR subKey1, LPCSTR subKey2, LPCSTR valName, LPCSTR testValue ) -{ - CHAR value[MAX_PATH]; - DWORD valueLen; - DWORD type; - HKEY hKey; - LONG rc; - int found=0; - - *value='\0'; - valueLen=sizeof(value); - RegOpenKeyA( HKEY_CURRENT_USER, subKey1, &hKey ); - rc=RegQueryValueExA( hKey, valName, NULL, &type, value, &valueLen ); - RegCloseKey( hKey ); - if (rc==ERROR_SUCCESS) - { - ok( !strcmp( testValue, value ), - "Wrong value in registry: subKey=%s, valName=%s, testValue=%s, value=%s\n", - subKey1, valName, testValue, value ); - found++; - } - else if (strict) - { - ok(0,"Missing registry entry: subKey=%s, valName=%s\n", - subKey1, valName); - } - if (subKey2 && !strict) - { - *value='\0'; - valueLen=sizeof(value); - RegOpenKeyA( HKEY_CURRENT_USER, subKey2, &hKey ); - rc=RegQueryValueExA( hKey, valName, NULL, &type, value, &valueLen ); - RegCloseKey( hKey ); - if (rc==ERROR_SUCCESS) - { - ok( !strcmp( testValue, value ), - "Wrong value in registry: subKey=%s, valName=%s, testValue=%s, value=%s\n", - subKey2, valName, testValue, value ); - found++; - } - } - ok(found,"Missing registry entry: %s in %s or %s\n", - valName, subKey1, (subKey2?subKey2:"") ); -} - -#define test_reg_key( subKey, valName, testValue ) \ - _test_reg_key( subKey, NULL, valName, testValue ) -#define test_reg_key_ex( subKey1, subKey2, valName, testValue ) \ - _test_reg_key( subKey1, subKey2, valName, testValue ) - -static void test_SPI_SETBEEP( void ) /* 2 */ -{ - BOOL rc; - BOOL old_b; - BOOL b; - BOOL curr_val; - - trace("testing SPI_{GET,SET}BEEP\n"); - rc=SystemParametersInfoA( SPI_GETBEEP, 0, &old_b, 0 ); - ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError()); - - curr_val = TRUE; - rc=SystemParametersInfoA( SPI_SETBEEP, curr_val, 0, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE ); - ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError()); - test_change_message( SPI_SETBEEP, 0 ); - test_reg_key( SPI_SETBEEP_REGKEY, - SPI_SETBEEP_VALNAME, - curr_val ? "Yes" : "No" ); - rc=SystemParametersInfoA( SPI_GETBEEP, 0, &b, 0 ); - ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError()); - eq( b, curr_val, "SPI_{GET,SET}BEEP", "%d" ); - rc=SystemParametersInfoW( SPI_GETBEEP, 0, &b, 0 ); - if (rc!=0 || GetLastError()!=ERROR_CALL_NOT_IMPLEMENTED) - { - ok(rc!=0,"SystemParametersInfoW: rc=%d err=%ld\n",rc,GetLastError()); - eq( b, curr_val, "SystemParametersInfoW", "%d" ); - } - - /* is a message sent for the second change? */ - rc=SystemParametersInfoA( SPI_SETBEEP, curr_val, 0, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE ); - ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError()); - test_change_message( SPI_SETBEEP, 0 ); - - curr_val = FALSE; - rc=SystemParametersInfoW( SPI_SETBEEP, curr_val, 0, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE ); - if (rc==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) - rc=SystemParametersInfoA( SPI_SETBEEP, curr_val, 0, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE ); - ok(rc!=0,"SystemParametersInfo: rc=%d err=%ld\n",rc,GetLastError()); - test_change_message( SPI_SETBEEP, 0 ); - test_reg_key( SPI_SETBEEP_REGKEY, - SPI_SETBEEP_VALNAME, - curr_val ? "Yes" : "No" ); - rc=SystemParametersInfoA( SPI_GETBEEP, 0, &b, 0 ); - ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError()); - eq( b, curr_val, "SPI_{GET,SET}BEEP", "%d" ); - rc=SystemParametersInfoW( SPI_GETBEEP, 0, &b, 0 ); - if (rc!=0 || GetLastError()!=ERROR_CALL_NOT_IMPLEMENTED) - { - ok(rc!=0,"SystemParametersInfoW: rc=%d err=%ld\n",rc,GetLastError()); - eq( b, curr_val, "SystemParametersInfoW", "%d" ); - } - ok( MessageBeep( MB_OK ), "Return value of MessageBeep when sound is disabled\n" ); - - rc=SystemParametersInfoA( SPI_SETBEEP, old_b, 0, SPIF_UPDATEINIFILE ); - ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError()); -} - -static const char *setmouse_valuenames[3] = { - SPI_SETMOUSE_VALNAME1, - SPI_SETMOUSE_VALNAME2, - SPI_SETMOUSE_VALNAME3 -}; - -/* - * Runs check for one setting of spi_setmouse. - */ -static void run_spi_setmouse_test( int curr_val[], POINT *req_change, POINT *proj_change, - int nchange ) -{ - BOOL rc; - INT mi[3]; - static int aw_turn = 0; - - char buf[20]; - int i; - - aw_turn++; - rc=0; - if (aw_turn % 2!=0) /* call unicode version each second call */ - rc=SystemParametersInfoW( SPI_SETMOUSE, 0, curr_val, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE ); - if (aw_turn % 2==0 || (rc==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)) - rc=SystemParametersInfoA( SPI_SETMOUSE, 0, curr_val, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE ); - ok(rc!=0,"SystemParametersInfo: rc=%d err=%ld\n",rc,GetLastError()); - test_change_message( SPI_SETMOUSE, 0 ); - for (i = 0; i < 3; i++) - { - sprintf( buf, "%d", curr_val[i] ); - test_reg_key( SPI_SETMOUSE_REGKEY, setmouse_valuenames[i], buf ); - } - - rc=SystemParametersInfoA( SPI_GETMOUSE, 0, mi, 0 ); - ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError()); - for (i = 0; i < 3; i++) - { - ok(mi[i] == curr_val[i], - "incorrect value for %d: %d != %d\n", i, mi[i], curr_val[i]); - } - - rc=SystemParametersInfoW( SPI_GETMOUSE, 0, mi, 0 ); - if (rc!=0 && GetLastError()!=ERROR_CALL_NOT_IMPLEMENTED) - { - ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError()); - for (i = 0; i < 3; i++) - { - ok(mi[i] == curr_val[i], - "incorrect value for %d: %d != %d\n", i, mi[i], curr_val[i]); - } - } - -#if 0 /* FIXME: this always fails for me - AJ */ - for (i = 0; i < nchange; i++) - { - POINT mv; - mouse_event( MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, 0, 0, 0, 0 ); - mouse_event( MOUSEEVENTF_MOVE, req_change[i].x, req_change[i].y, 0, 0 ); - GetCursorPos( &mv ); - ok( proj_change[i].x == mv.x, "Projected dx and real dx comparison. May fail under high load.\n" ); - ok( proj_change[i].y == mv.y, "Projected dy equals real dy. May fail under high load.\n" ); - } -#endif -} - -static void test_SPI_SETMOUSE( void ) /* 4 */ -{ - BOOL rc; - INT old_mi[3]; - - /* win nt default values - 6, 10, 1 */ - INT curr_val[3] = {6, 10, 1}; - - /* requested and projected mouse movements */ - POINT req_change[] = { {6, 6}, { 7, 6}, { 8, 6}, {10, 10}, {11, 10}, {100, 100} }; - POINT proj_change1[] = { {6, 6}, {14, 6}, {16, 6}, {20, 20}, {22, 20}, {200, 200} }; - POINT proj_change2[] = { {6, 6}, {14, 6}, {16, 6}, {20, 20}, {44, 20}, {400, 400} }; - POINT proj_change3[] = { {6, 6}, {14, 6}, {16, 6}, {20, 20}, {22, 20}, {200, 200} }; - POINT proj_change4[] = { {6, 6}, { 7, 6}, { 8, 6}, {10, 10}, {11, 10}, {100, 100} }; - POINT proj_change5[] = { {6, 6}, { 7, 6}, {16, 6}, {20, 20}, {22, 20}, {200, 200} }; - POINT proj_change6[] = { {6, 6}, {28, 6}, {32, 6}, {40, 40}, {44, 40}, {400, 400} }; - POINT proj_change7[] = { {6, 6}, {14, 6}, {32, 6}, {40, 40}, {44, 40}, {400, 400} }; - POINT proj_change8[] = { {6, 6}, {28, 6}, {32, 6}, {40, 40}, {44, 40}, {400, 400} }; - - int nchange = sizeof( req_change ) / sizeof( POINT ); - - trace("testing SPI_{GET,SET}MOUSE\n"); - rc=SystemParametersInfoA( SPI_GETMOUSE, 0, old_mi, 0 ); - ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError()); - - run_spi_setmouse_test( curr_val, req_change, proj_change1, nchange ); - - /* acceleration change */ - curr_val[2] = 2; - run_spi_setmouse_test( curr_val, req_change, proj_change2, nchange ); - - /* acceleration change */ - curr_val[2] = 3; - run_spi_setmouse_test( curr_val, req_change, proj_change3, nchange ); - - /* acceleration change */ - curr_val[2] = 0; - run_spi_setmouse_test( curr_val, req_change, proj_change4, nchange ); - - /* threshold change */ - curr_val[2] = 1; - curr_val[0] = 7; - run_spi_setmouse_test( curr_val, req_change, proj_change5, nchange ); - - /* threshold change */ - curr_val[2] = 2; - curr_val[0] = 6; - curr_val[1] = 6; - run_spi_setmouse_test( curr_val, req_change, proj_change6, nchange ); - - /* threshold change */ - curr_val[1] = 7; - run_spi_setmouse_test( curr_val, req_change, proj_change7, nchange ); - - /* threshold change */ - curr_val[1] = 5; - run_spi_setmouse_test( curr_val, req_change, proj_change8, nchange ); - - rc=SystemParametersInfoA( SPI_SETMOUSE, 0, old_mi, SPIF_UPDATEINIFILE ); - ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError()); -} - -#if 0 -static void test_setborder(UINT curr_val) -{ - BOOL rc; - UINT border; - INT frame; - char buf[10]; - - rc=SystemParametersInfoA( SPI_SETBORDER, curr_val, 0, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE ); - ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError()); - test_change_message( SPI_SETBORDER, 1 ); - sprintf( buf, "%d", curr_val ); - test_reg_key( SPI_SETBORDER_REGKEY, SPI_SETBORDER_VALNAME, buf ); - - if (curr_val == 0) - curr_val = 1; - rc=SystemParametersInfoA( SPI_GETBORDER, 0, &border, 0 ); - ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError()); - eq( border, curr_val, "SPI_{GET,SET}BORDER", "%d"); - - frame = curr_val + GetSystemMetrics( SM_CXDLGFRAME ); - eq( frame, GetSystemMetrics( SM_CXFRAME ), "SM_CXFRAME", "%d" ); - eq( frame, GetSystemMetrics( SM_CYFRAME ), "SM_CYFRAME", "%d" ); - eq( frame, GetSystemMetrics( SM_CXSIZEFRAME ), "SM_CXSIZEFRAME", "%d" ); - eq( frame, GetSystemMetrics( SM_CYSIZEFRAME ), "SM_CYSIZEFRAME", "%d" ); -} - -static void test_SPI_SETBORDER( void ) /* 6 */ -{ - BOOL rc; - UINT old_border; - - /* These tests hang when XFree86 4.0 for Windows is running (tested on - * WinNT, SP2, Cygwin/XFree 4.1.0. Skip the test when XFree86 is - * running. - */ - if (FindWindowA( NULL, "Cygwin/XFree86" )) - return; - - trace("testing SPI_{GET,SET}BORDER\n"); - rc=SystemParametersInfoA( SPI_GETBORDER, 0, &old_border, 0 ); - ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError()); - - test_setborder(1); - test_setborder(0); - test_setborder(7); - test_setborder(20); - - /* This will restore sane values if the test hang previous run. */ - if ( old_border == 7 || old_border == 20 ) - old_border = -15; - - rc=SystemParametersInfoA( SPI_SETBORDER, old_border, 0, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE ); - ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError()); -} -#endif - -static void test_SPI_SETKEYBOARDSPEED( void ) /* 10 */ -{ - BOOL rc; - UINT old_speed; - const UINT vals[]={0,20,31}; - int i; - - trace("testing SPI_{GET,SET}KEYBOARDSPEED\n"); - rc=SystemParametersInfoA( SPI_GETKEYBOARDSPEED, 0, &old_speed, 0 ); - ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError()); - - for (i=0;i 32 ? old_spacing-1 : 32); - rc=SystemParametersInfoA( SPI_ICONHORIZONTALSPACING, curr_val, 0, - SPIF_UPDATEINIFILE | SPIF_SENDCHANGE); - ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError()); - test_change_message( SPI_ICONHORIZONTALSPACING, 0 ); - /* The registry keys depend on the Windows version and the values too - * => don't test them - */ - - rc=SystemParametersInfoA( SPI_ICONHORIZONTALSPACING, 0, &spacing, 0 ); - ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError()); - eq( spacing, curr_val, "ICONHORIZONTALSPACING", "%d"); - eq( GetSystemMetrics( SM_CXICONSPACING ), curr_val, "SM_CXICONSPACING", "%d" ); - - curr_val = 10; - rc=SystemParametersInfoA( SPI_ICONHORIZONTALSPACING, curr_val, 0, - SPIF_UPDATEINIFILE | SPIF_SENDCHANGE); - ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError()); - curr_val = 32; /*min value*/ - test_change_message( SPI_ICONHORIZONTALSPACING, 0 ); - - rc=SystemParametersInfoA( SPI_ICONHORIZONTALSPACING, 0, &spacing, 0 ); - ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError()); - eq( spacing, curr_val, "ICONHORIZONTALSPACING", "%d" ); - eq( GetSystemMetrics( SM_CXICONSPACING ), curr_val, "SM_CXICONSPACING", "%d" ); - - rc=SystemParametersInfoA( SPI_ICONHORIZONTALSPACING, old_spacing, 0, SPIF_UPDATEINIFILE ); - ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError()); -} - -static void test_SPI_SETSCREENSAVETIMEOUT( void ) /* 14 */ -{ - BOOL rc; - UINT old_timeout; - const UINT vals[]={0,32767}; - int i; - - trace("testing SPI_{GET,SET}SCREENSAVETIMEOUT\n"); - rc=SystemParametersInfoA( SPI_GETSCREENSAVETIMEOUT, 0, &old_timeout, 0 ); - ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError()); - - for (i=0;i don't test them - */ - - rc=SystemParametersInfoA( SPI_ICONVERTICALSPACING, 0, &spacing, 0 ); - ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError()); - eq( spacing, curr_val, "ICONVERTICALSPACING", "%d" ); - eq( GetSystemMetrics( SM_CYICONSPACING ), curr_val, "SM_CYICONSPACING", "%d" ); - - curr_val = 10; - rc=SystemParametersInfoA( SPI_ICONVERTICALSPACING, curr_val, 0, - SPIF_UPDATEINIFILE | SPIF_SENDCHANGE); - ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError()); - curr_val = 32; /*min value*/ - test_change_message( SPI_ICONVERTICALSPACING, 0 ); - - rc=SystemParametersInfoA( SPI_ICONVERTICALSPACING, 0, &spacing, 0 ); - ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError()); - eq( spacing, curr_val, "ICONVERTICALSPACING", "%d" ); - eq( GetSystemMetrics( SM_CYICONSPACING ), curr_val, "SM_CYICONSPACING", "%d" ); - - rc=SystemParametersInfoA( SPI_ICONVERTICALSPACING, old_spacing, 0, - SPIF_UPDATEINIFILE ); - ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError()); -} - -static void test_SPI_SETICONTITLEWRAP( void ) /* 26 */ -{ - BOOL rc; - BOOL old_b; - const UINT vals[]={TRUE,FALSE}; - int i; - - /* These tests hang when XFree86 4.0 for Windows is running (tested on - * WinNT, SP2, Cygwin/XFree 4.1.0. Skip the test when XFree86 is - * running. - */ - if (FindWindowA( NULL, "Cygwin/XFree86" )) - return; - - trace("testing SPI_{GET,SET}ICONTITLEWRAP\n"); - rc=SystemParametersInfoA( SPI_GETICONTITLEWRAP, 0, &old_b, 0 ); - ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError()); - - for (i=0;i= 3 && strcmp(argv[2],"strict")==0); - trace("strict=%d\n",strict); - - change_counter = 0; - change_last_param = 0; - - wc.lpszClassName = "SysParamsTestClass"; - wc.lpfnWndProc = SysParamsTestWndProc; - wc.style = CS_OWNDC | CS_VREDRAW | CS_HREDRAW; - wc.hInstance = hInstance; - wc.hIcon = LoadIconA( 0, (LPSTR)IDI_APPLICATION ); - wc.hCursor = LoadCursorA( 0, (LPSTR)IDC_ARROW ); - wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1 ); - wc.lpszMenuName = 0; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - RegisterClassA( &wc ); - - ghTestWnd = CreateWindowA( "SysParamsTestClass", "Test System Parameters Application", - WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, hInstance, NULL ); - - hThread = CreateThread( NULL, 0, SysParamsThreadFunc, 0, 0, &dwThreadId ); - assert( hThread ); - CloseHandle( hThread ); - - while( GetMessageA( &msg, 0, 0, 0 )) { - TranslateMessage( &msg ); - DispatchMessageA( &msg ); - } -} diff --git a/reactos/apps/tests/user32/testlist.c b/reactos/apps/tests/user32/testlist.c deleted file mode 100644 index 7703f6db340..00000000000 --- a/reactos/apps/tests/user32/testlist.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Automatically generated file; DO NOT EDIT!! */ - -#include -#include -#include -#include "windef.h" -#include "winbase.h" - -extern void func_class(void); -extern void func_dde(void); -extern void func_dialog(void); -//extern void func_input(void); -extern void func_listbox(void); -extern void func_msg(void); -extern void func_resource(void); -extern void func_sysparams(void); -extern void func_win(void); -extern void func_wsprintf(void); - -struct test -{ - const char *name; - void (*func)(void); -}; - -static const struct test winetest_testlist[] = -{ - { "class", func_class }, - { "dde", func_dde }, - { "dialog", func_dialog }, - //{ "input", func_input }, - { "listbox", func_listbox }, - { "msg", func_msg }, - { "resource", func_resource }, - { "sysparams", func_sysparams }, - { "win", func_win }, - { "wsprintf", func_wsprintf }, - { 0, 0 } -}; - -#define WINETEST_WANT_MAIN -#include "wine/test.h" diff --git a/reactos/apps/tests/user32/win.c b/reactos/apps/tests/user32/win.c deleted file mode 100644 index 641e3fcadf3..00000000000 --- a/reactos/apps/tests/user32/win.c +++ /dev/null @@ -1,1698 +0,0 @@ -/* - * Unit tests for window handling - * - * Copyright 2002 Bill Medland - * Copyright 2002 Alexandre Julliard - * Copyright 2003 Dmitry Timoshkov - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* To get ICON_SMALL2 with the MSVC headers */ -#define _WIN32_WINNT 0x0501 - -#include -#include -#include -#include - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" - -#include "wine/test.h" - -#ifndef SPI_GETDESKWALLPAPER -#define SPI_GETDESKWALLPAPER 0x0073 -#endif - -#define LONG_PTR INT_PTR -#define ULONG_PTR UINT_PTR - -static HWND (WINAPI *pGetAncestor)(HWND,UINT); -static BOOL (WINAPI *pGetWindowInfo)(HWND,WINDOWINFO*); - -static HWND hwndMessage; -static HWND hwndMain, hwndMain2; -static HHOOK hhook; - -/* check the values returned by the various parent/owner functions on a given window */ -static void check_parents( HWND hwnd, HWND ga_parent, HWND gwl_parent, HWND get_parent, - HWND gw_owner, HWND ga_root, HWND ga_root_owner ) -{ - HWND res; - - if (pGetAncestor) - { - res = pGetAncestor( hwnd, GA_PARENT ); - ok( res == ga_parent, "Wrong result for GA_PARENT %p expected %p\n", res, ga_parent ); - } - res = (HWND)GetWindowLongA( hwnd, GWL_HWNDPARENT ); - ok( res == gwl_parent, "Wrong result for GWL_HWNDPARENT %p expected %p\n", res, gwl_parent ); - res = GetParent( hwnd ); - ok( res == get_parent, "Wrong result for GetParent %p expected %p\n", res, get_parent ); - res = GetWindow( hwnd, GW_OWNER ); - ok( res == gw_owner, "Wrong result for GW_OWNER %p expected %p\n", res, gw_owner ); - if (pGetAncestor) - { - res = pGetAncestor( hwnd, GA_ROOT ); - ok( res == ga_root, "Wrong result for GA_ROOT %p expected %p\n", res, ga_root ); - res = pGetAncestor( hwnd, GA_ROOTOWNER ); - ok( res == ga_root_owner, "Wrong result for GA_ROOTOWNER %p expected %p\n", res, ga_root_owner ); - } -} - - -static HWND create_tool_window( LONG style, HWND parent ) -{ - HWND ret = CreateWindowExA(0, "ToolWindowClass", "Tool window 1", style, - 0, 0, 100, 100, parent, 0, 0, NULL ); - ok( ret != 0, "Creation failed\n" ); - return ret; -} - -/* test parent and owner values for various combinations */ -static void test_parent_owner(void) -{ - LONG style; - HWND test, owner, ret; - HWND desktop = GetDesktopWindow(); - HWND child = create_tool_window( WS_CHILD, hwndMain ); - - trace( "main window %p main2 %p desktop %p child %p\n", hwndMain, hwndMain2, desktop, child ); - - /* child without parent, should fail */ - test = CreateWindowExA(0, "ToolWindowClass", "Tool window 1", - WS_CHILD, 0, 0, 100, 100, 0, 0, 0, NULL ); - ok( !test, "WS_CHILD without parent created\n" ); - - /* desktop window */ - check_parents( desktop, 0, 0, 0, 0, 0, 0 ); - style = GetWindowLongA( desktop, GWL_STYLE ); - ok( !SetWindowLongA( desktop, GWL_STYLE, WS_POPUP ), "Set GWL_STYLE on desktop succeeded\n" ); - ok( !SetWindowLongA( desktop, GWL_STYLE, 0 ), "Set GWL_STYLE on desktop succeeded\n" ); - ok( GetWindowLongA( desktop, GWL_STYLE ) == style, "Desktop style changed\n" ); - - /* normal child window */ - test = create_tool_window( WS_CHILD, hwndMain ); - trace( "created child %p\n", test ); - check_parents( test, hwndMain, hwndMain, hwndMain, 0, hwndMain, hwndMain ); - SetWindowLongA( test, GWL_STYLE, 0 ); - check_parents( test, hwndMain, hwndMain, 0, 0, hwndMain, test ); - SetWindowLongA( test, GWL_STYLE, WS_POPUP ); - check_parents( test, hwndMain, hwndMain, 0, 0, hwndMain, test ); - SetWindowLongA( test, GWL_STYLE, WS_POPUP|WS_CHILD ); - check_parents( test, hwndMain, hwndMain, 0, 0, hwndMain, test ); - SetWindowLongA( test, GWL_STYLE, WS_CHILD ); - DestroyWindow( test ); - - /* normal child window with WS_MAXIMIZE */ - test = create_tool_window( WS_CHILD | WS_MAXIMIZE, hwndMain ); - DestroyWindow( test ); - - /* normal child window with WS_THICKFRAME */ - test = create_tool_window( WS_CHILD | WS_THICKFRAME, hwndMain ); - DestroyWindow( test ); - - /* popup window with WS_THICKFRAME */ - test = create_tool_window( WS_POPUP | WS_THICKFRAME, hwndMain ); - DestroyWindow( test ); - - /* child of desktop */ - test = create_tool_window( WS_CHILD, desktop ); - trace( "created child of desktop %p\n", test ); - check_parents( test, desktop, 0, desktop, 0, test, desktop ); - SetWindowLongA( test, GWL_STYLE, WS_POPUP ); - check_parents( test, desktop, 0, 0, 0, test, test ); - SetWindowLongA( test, GWL_STYLE, 0 ); - check_parents( test, desktop, 0, 0, 0, test, test ); - DestroyWindow( test ); - - /* child of desktop with WS_MAXIMIZE */ - test = create_tool_window( WS_CHILD | WS_MAXIMIZE, desktop ); - DestroyWindow( test ); - - /* child of desktop with WS_MINIMIZE */ - test = create_tool_window( WS_CHILD | WS_MINIMIZE, desktop ); - DestroyWindow( test ); - - /* child of child */ - test = create_tool_window( WS_CHILD, child ); - trace( "created child of child %p\n", test ); - check_parents( test, child, child, child, 0, hwndMain, hwndMain ); - SetWindowLongA( test, GWL_STYLE, 0 ); - check_parents( test, child, child, 0, 0, hwndMain, test ); - SetWindowLongA( test, GWL_STYLE, WS_POPUP ); - check_parents( test, child, child, 0, 0, hwndMain, test ); - DestroyWindow( test ); - - /* child of child with WS_MAXIMIZE */ - test = create_tool_window( WS_CHILD | WS_MAXIMIZE, child ); - DestroyWindow( test ); - - /* child of child with WS_MINIMIZE */ - test = create_tool_window( WS_CHILD | WS_MINIMIZE, child ); - DestroyWindow( test ); - - /* not owned top-level window */ - test = create_tool_window( 0, 0 ); - trace( "created top-level %p\n", test ); - check_parents( test, desktop, 0, 0, 0, test, test ); - SetWindowLongA( test, GWL_STYLE, WS_POPUP ); - check_parents( test, desktop, 0, 0, 0, test, test ); - SetWindowLongA( test, GWL_STYLE, WS_CHILD ); - check_parents( test, desktop, 0, desktop, 0, test, desktop ); - DestroyWindow( test ); - - /* not owned top-level window with WS_MAXIMIZE */ - test = create_tool_window( WS_MAXIMIZE, 0 ); - DestroyWindow( test ); - - /* owned top-level window */ - test = create_tool_window( 0, hwndMain ); - trace( "created owned top-level %p\n", test ); - check_parents( test, desktop, hwndMain, 0, hwndMain, test, test ); - SetWindowLongA( test, GWL_STYLE, WS_POPUP ); - check_parents( test, desktop, hwndMain, hwndMain, hwndMain, test, hwndMain ); - SetWindowLongA( test, GWL_STYLE, WS_CHILD ); - check_parents( test, desktop, hwndMain, desktop, hwndMain, test, desktop ); - DestroyWindow( test ); - - /* owned top-level window with WS_MAXIMIZE */ - test = create_tool_window( WS_MAXIMIZE, hwndMain ); - DestroyWindow( test ); - - /* not owned popup */ - test = create_tool_window( WS_POPUP, 0 ); - trace( "created popup %p\n", test ); - check_parents( test, desktop, 0, 0, 0, test, test ); - SetWindowLongA( test, GWL_STYLE, WS_CHILD ); - check_parents( test, desktop, 0, desktop, 0, test, desktop ); - SetWindowLongA( test, GWL_STYLE, 0 ); - check_parents( test, desktop, 0, 0, 0, test, test ); - DestroyWindow( test ); - - /* not owned popup with WS_MAXIMIZE */ - test = create_tool_window( WS_POPUP | WS_MAXIMIZE, 0 ); - DestroyWindow( test ); - - /* owned popup */ - test = create_tool_window( WS_POPUP, hwndMain ); - trace( "created owned popup %p\n", test ); - check_parents( test, desktop, hwndMain, hwndMain, hwndMain, test, hwndMain ); - SetWindowLongA( test, GWL_STYLE, WS_CHILD ); - check_parents( test, desktop, hwndMain, desktop, hwndMain, test, desktop ); - SetWindowLongA( test, GWL_STYLE, 0 ); - check_parents( test, desktop, hwndMain, 0, hwndMain, test, test ); - DestroyWindow( test ); - - /* owned popup with WS_MAXIMIZE */ - test = create_tool_window( WS_POPUP | WS_MAXIMIZE, hwndMain ); - DestroyWindow( test ); - - /* top-level window owned by child (same as owned by top-level) */ - test = create_tool_window( 0, child ); - trace( "created top-level owned by child %p\n", test ); - check_parents( test, desktop, hwndMain, 0, hwndMain, test, test ); - DestroyWindow( test ); - - /* top-level window owned by child (same as owned by top-level) with WS_MAXIMIZE */ - test = create_tool_window( WS_MAXIMIZE, child ); - DestroyWindow( test ); - - /* popup owned by desktop (same as not owned) */ - test = create_tool_window( WS_POPUP, desktop ); - trace( "created popup owned by desktop %p\n", test ); - check_parents( test, desktop, 0, 0, 0, test, test ); - DestroyWindow( test ); - - /* popup owned by desktop (same as not owned) with WS_MAXIMIZE */ - test = create_tool_window( WS_POPUP | WS_MAXIMIZE, desktop ); - DestroyWindow( test ); - - /* popup owned by child (same as owned by top-level) */ - test = create_tool_window( WS_POPUP, child ); - trace( "created popup owned by child %p\n", test ); - check_parents( test, desktop, hwndMain, hwndMain, hwndMain, test, hwndMain ); - DestroyWindow( test ); - - /* popup owned by child (same as owned by top-level) with WS_MAXIMIZE */ - test = create_tool_window( WS_POPUP | WS_MAXIMIZE, child ); - DestroyWindow( test ); - - /* not owned popup with WS_CHILD (same as WS_POPUP only) */ - test = create_tool_window( WS_POPUP | WS_CHILD, 0 ); - trace( "created WS_CHILD popup %p\n", test ); - check_parents( test, desktop, 0, 0, 0, test, test ); - DestroyWindow( test ); - - /* not owned popup with WS_CHILD | WS_MAXIMIZE (same as WS_POPUP only) */ - test = create_tool_window( WS_POPUP | WS_CHILD | WS_MAXIMIZE, 0 ); - DestroyWindow( test ); - - /* owned popup with WS_CHILD (same as WS_POPUP only) */ - test = create_tool_window( WS_POPUP | WS_CHILD, hwndMain ); - trace( "created owned WS_CHILD popup %p\n", test ); - check_parents( test, desktop, hwndMain, hwndMain, hwndMain, test, hwndMain ); - DestroyWindow( test ); - - /* owned popup with WS_CHILD (same as WS_POPUP only) with WS_MAXIMIZE */ - test = create_tool_window( WS_POPUP | WS_CHILD | WS_MAXIMIZE, hwndMain ); - DestroyWindow( test ); - - /******************** parent changes *************************/ - trace( "testing parent changes\n" ); - - /* desktop window */ - check_parents( desktop, 0, 0, 0, 0, 0, 0 ); -#if 0 /* this test succeeds on NT but crashes on win9x systems */ - ret = (HWND)SetWindowLongA( test, GWL_HWNDPARENT, (LONG_PTR)hwndMain2 ); - ok( !ret, "Set GWL_HWNDPARENT succeeded on desktop\n" ); - check_parents( desktop, 0, 0, 0, 0, 0, 0 ); - ok( !SetParent( desktop, hwndMain ), "SetParent succeeded on desktop\n" ); - check_parents( desktop, 0, 0, 0, 0, 0, 0 ); -#endif - /* normal child window */ - test = create_tool_window( WS_CHILD, hwndMain ); - trace( "created child %p\n", test ); - - ret = (HWND)SetWindowLongA( test, GWL_HWNDPARENT, (LONG_PTR)hwndMain2 ); - ok( ret == hwndMain, "GWL_HWNDPARENT return value %p expected %p\n", ret, hwndMain ); - check_parents( test, hwndMain2, hwndMain2, hwndMain2, 0, hwndMain2, hwndMain2 ); - - ret = (HWND)SetWindowLongA( test, GWL_HWNDPARENT, (LONG_PTR)child ); - ok( ret == hwndMain2, "GWL_HWNDPARENT return value %p expected %p\n", ret, hwndMain2 ); - check_parents( test, child, child, child, 0, hwndMain, hwndMain ); - - ret = (HWND)SetWindowLongA( test, GWL_HWNDPARENT, (LONG_PTR)desktop ); - ok( ret == child, "GWL_HWNDPARENT return value %p expected %p\n", ret, child ); - check_parents( test, desktop, 0, desktop, 0, test, desktop ); - - /* window is now child of desktop so GWL_HWNDPARENT changes owner from now on */ - ret = (HWND)SetWindowLongA( test, GWL_HWNDPARENT, (LONG_PTR)child ); - ok( ret == 0, "GWL_HWNDPARENT return value %p expected 0\n", ret ); - check_parents( test, desktop, child, desktop, child, test, desktop ); - - ret = (HWND)SetWindowLongA( test, GWL_HWNDPARENT, 0 ); - ok( ret == child, "GWL_HWNDPARENT return value %p expected %p\n", ret, child ); - check_parents( test, desktop, 0, desktop, 0, test, desktop ); - DestroyWindow( test ); - - /* not owned top-level window */ - test = create_tool_window( 0, 0 ); - trace( "created top-level %p\n", test ); - - ret = (HWND)SetWindowLongA( test, GWL_HWNDPARENT, (LONG_PTR)hwndMain2 ); - ok( ret == 0, "GWL_HWNDPARENT return value %p expected 0\n", ret ); - check_parents( test, desktop, hwndMain2, 0, hwndMain2, test, test ); - - ret = (HWND)SetWindowLongA( test, GWL_HWNDPARENT, (LONG_PTR)child ); - ok( ret == hwndMain2, "GWL_HWNDPARENT return value %p expected %p\n", ret, hwndMain2 ); - check_parents( test, desktop, child, 0, child, test, test ); - - ret = (HWND)SetWindowLongA( test, GWL_HWNDPARENT, 0 ); - ok( ret == child, "GWL_HWNDPARENT return value %p expected %p\n", ret, child ); - check_parents( test, desktop, 0, 0, 0, test, test ); - DestroyWindow( test ); - - /* not owned popup */ - test = create_tool_window( WS_POPUP, 0 ); - trace( "created popup %p\n", test ); - - ret = (HWND)SetWindowLongA( test, GWL_HWNDPARENT, (LONG_PTR)hwndMain2 ); - ok( ret == 0, "GWL_HWNDPARENT return value %p expected 0\n", ret ); - check_parents( test, desktop, hwndMain2, hwndMain2, hwndMain2, test, hwndMain2 ); - - ret = (HWND)SetWindowLongA( test, GWL_HWNDPARENT, (LONG_PTR)child ); - ok( ret == hwndMain2, "GWL_HWNDPARENT return value %p expected %p\n", ret, hwndMain2 ); - check_parents( test, desktop, child, child, child, test, hwndMain ); - - ret = (HWND)SetWindowLongA( test, GWL_HWNDPARENT, 0 ); - ok( ret == child, "GWL_HWNDPARENT return value %p expected %p\n", ret, child ); - check_parents( test, desktop, 0, 0, 0, test, test ); - DestroyWindow( test ); - - /* normal child window */ - test = create_tool_window( WS_CHILD, hwndMain ); - trace( "created child %p\n", test ); - - ret = SetParent( test, desktop ); - ok( ret == hwndMain, "SetParent return value %p expected %p\n", ret, hwndMain ); - check_parents( test, desktop, 0, desktop, 0, test, desktop ); - - ret = SetParent( test, child ); - ok( ret == desktop, "SetParent return value %p expected %p\n", ret, desktop ); - check_parents( test, child, child, child, 0, hwndMain, hwndMain ); - - ret = SetParent( test, hwndMain2 ); - ok( ret == child, "SetParent return value %p expected %p\n", ret, child ); - check_parents( test, hwndMain2, hwndMain2, hwndMain2, 0, hwndMain2, hwndMain2 ); - DestroyWindow( test ); - - /* not owned top-level window */ - test = create_tool_window( 0, 0 ); - trace( "created top-level %p\n", test ); - - ret = SetParent( test, child ); - ok( ret == desktop, "SetParent return value %p expected %p\n", ret, desktop ); - check_parents( test, child, child, 0, 0, hwndMain, test ); - DestroyWindow( test ); - - /* owned popup */ - test = create_tool_window( WS_POPUP, hwndMain2 ); - trace( "created owned popup %p\n", test ); - - ret = SetParent( test, child ); - ok( ret == desktop, "SetParent return value %p expected %p\n", ret, desktop ); - check_parents( test, child, child, hwndMain2, hwndMain2, hwndMain, hwndMain2 ); - - ret = (HWND)SetWindowLongA( test, GWL_HWNDPARENT, (ULONG_PTR)hwndMain ); - ok( ret == child, "GWL_HWNDPARENT return value %p expected %p\n", ret, child ); - check_parents( test, hwndMain, hwndMain, hwndMain2, hwndMain2, hwndMain, hwndMain2 ); - DestroyWindow( test ); - - /**************** test owner destruction *******************/ - - /* owned child popup */ - owner = create_tool_window( 0, 0 ); - test = create_tool_window( WS_POPUP, owner ); - trace( "created owner %p and popup %p\n", owner, test ); - ret = SetParent( test, child ); - ok( ret == desktop, "SetParent return value %p expected %p\n", ret, desktop ); - check_parents( test, child, child, owner, owner, hwndMain, owner ); - /* window is now child of 'child' but owned by 'owner' */ - DestroyWindow( owner ); - ok( IsWindow(test), "Window %p destroyed by owner destruction\n", test ); - check_parents( test, child, child, owner, owner, hwndMain, owner ); - ok( !IsWindow(owner), "Owner %p not destroyed\n", owner ); - DestroyWindow(test); - - /* owned top-level popup */ - owner = create_tool_window( 0, 0 ); - test = create_tool_window( WS_POPUP, owner ); - trace( "created owner %p and popup %p\n", owner, test ); - check_parents( test, desktop, owner, owner, owner, test, owner ); - DestroyWindow( owner ); - ok( !IsWindow(test), "Window %p not destroyed by owner destruction\n", test ); - - /* top-level popup owned by child */ - owner = create_tool_window( WS_CHILD, hwndMain2 ); - test = create_tool_window( WS_POPUP, 0 ); - trace( "created owner %p and popup %p\n", owner, test ); - ret = (HWND)SetWindowLongA( test, GWL_HWNDPARENT, (ULONG_PTR)owner ); - ok( ret == 0, "GWL_HWNDPARENT return value %p expected 0\n", ret ); - check_parents( test, desktop, owner, owner, owner, test, hwndMain2 ); - DestroyWindow( owner ); - ok( IsWindow(test), "Window %p destroyed by owner destruction\n", test ); - ok( !IsWindow(owner), "Owner %p not destroyed\n", owner ); - check_parents( test, desktop, owner, owner, owner, test, owner ); - DestroyWindow(test); - - /* final cleanup */ - DestroyWindow(child); -} - - -static LRESULT WINAPI main_window_procA(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) -{ - switch (msg) - { - case WM_GETMINMAXINFO: - { - MINMAXINFO* minmax = (MINMAXINFO *)lparam; - - trace("hwnd %p, WM_GETMINMAXINFO, %08x, %08lx\n", hwnd, wparam, lparam); - trace("ptReserved (%ld,%ld), ptMaxSize (%ld,%ld), ptMaxPosition (%ld,%ld)\n" - " ptMinTrackSize (%ld,%ld), ptMaxTrackSize (%ld,%ld)\n", - minmax->ptReserved.x, minmax->ptReserved.y, - minmax->ptMaxSize.x, minmax->ptMaxSize.y, - minmax->ptMaxPosition.x, minmax->ptMaxPosition.y, - minmax->ptMinTrackSize.x, minmax->ptMinTrackSize.y, - minmax->ptMaxTrackSize.x, minmax->ptMaxTrackSize.y); - SetWindowLongA(hwnd, GWL_USERDATA, 0x20031021); - break; - } - case WM_WINDOWPOSCHANGING: - { - BOOL is_win9x = GetWindowLongW(hwnd, GWL_WNDPROC) == 0; - WINDOWPOS *winpos = (WINDOWPOS *)lparam; - trace("main: WM_WINDOWPOSCHANGING\n"); - trace("%p after %p, x %d, y %d, cx %d, cy %d flags %08x\n", - winpos->hwnd, winpos->hwndInsertAfter, - winpos->x, winpos->y, winpos->cx, winpos->cy, winpos->flags); - if (!(winpos->flags & SWP_NOMOVE)) - { - ok(winpos->x >= -32768 && winpos->x <= 32767, "bad winpos->x %d\n", winpos->x); - ok(winpos->y >= -32768 && winpos->y <= 32767, "bad winpos->y %d\n", winpos->y); - } - /* Win9x does not fixup cx/xy for WM_WINDOWPOSCHANGING */ - if (!(winpos->flags & SWP_NOSIZE) && !is_win9x) - { - ok(winpos->cx >= 0 && winpos->cx <= 32767, "bad winpos->cx %d\n", winpos->cx); - ok(winpos->cy >= 0 && winpos->cy <= 32767, "bad winpos->cy %d\n", winpos->cy); - } - break; - } - case WM_WINDOWPOSCHANGED: - { - WINDOWPOS *winpos = (WINDOWPOS *)lparam; - trace("main: WM_WINDOWPOSCHANGED\n"); - trace("%p after %p, x %d, y %d, cx %d, cy %d flags %08x\n", - winpos->hwnd, winpos->hwndInsertAfter, - winpos->x, winpos->y, winpos->cx, winpos->cy, winpos->flags); - ok(winpos->x >= -32768 && winpos->x <= 32767, "bad winpos->x %d\n", winpos->x); - ok(winpos->y >= -32768 && winpos->y <= 32767, "bad winpos->y %d\n", winpos->y); - - ok(winpos->cx >= 0 && winpos->cx <= 32767, "bad winpos->cx %d\n", winpos->cx); - ok(winpos->cy >= 0 && winpos->cy <= 32767, "bad winpos->cy %d\n", winpos->cy); - break; - } - case WM_NCCREATE: - { - BOOL got_getminmaxinfo = GetWindowLongA(hwnd, GWL_USERDATA) == 0x20031021; - CREATESTRUCTA *cs = (CREATESTRUCTA *)lparam; - - trace("WM_NCCREATE: hwnd %p, parent %p, style %08lx\n", hwnd, cs->hwndParent, cs->style); - if (got_getminmaxinfo) - trace("%p got WM_GETMINMAXINFO\n", hwnd); - - if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD))) - ok(got_getminmaxinfo, "main: WM_GETMINMAXINFO should have been received before WM_NCCREATE\n"); - else - ok(!got_getminmaxinfo, "main: WM_GETMINMAXINFO should NOT have been received before WM_NCCREATE\n"); - break; - } - } - - return DefWindowProcA(hwnd, msg, wparam, lparam); -} - -static LRESULT WINAPI tool_window_procA(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) -{ - switch (msg) - { - case WM_GETMINMAXINFO: - { - MINMAXINFO* minmax = (MINMAXINFO *)lparam; - - trace("hwnd %p, WM_GETMINMAXINFO, %08x, %08lx\n", hwnd, wparam, lparam); - trace("ptReserved (%ld,%ld), ptMaxSize (%ld,%ld), ptMaxPosition (%ld,%ld)\n" - " ptMinTrackSize (%ld,%ld), ptMaxTrackSize (%ld,%ld)\n", - minmax->ptReserved.x, minmax->ptReserved.y, - minmax->ptMaxSize.x, minmax->ptMaxSize.y, - minmax->ptMaxPosition.x, minmax->ptMaxPosition.y, - minmax->ptMinTrackSize.x, minmax->ptMinTrackSize.y, - minmax->ptMaxTrackSize.x, minmax->ptMaxTrackSize.y); - SetWindowLongA(hwnd, GWL_USERDATA, 0x20031021); - break; - } - case WM_NCCREATE: - { - BOOL got_getminmaxinfo = GetWindowLongA(hwnd, GWL_USERDATA) == 0x20031021; - CREATESTRUCTA *cs = (CREATESTRUCTA *)lparam; - - trace("WM_NCCREATE: hwnd %p, parent %p, style %08lx\n", hwnd, cs->hwndParent, cs->style); - if (got_getminmaxinfo) - trace("%p got WM_GETMINMAXINFO\n", hwnd); - - if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD))) - ok(got_getminmaxinfo, "tool: WM_GETMINMAXINFO should have been received before WM_NCCREATE\n"); - else - ok(!got_getminmaxinfo, "tool: WM_GETMINMAXINFO should NOT have been received before WM_NCCREATE\n"); - break; - } - } - - return DefWindowProcA(hwnd, msg, wparam, lparam); -} - -static BOOL RegisterWindowClasses(void) -{ - WNDCLASSA cls; - - cls.style = 0; - cls.lpfnWndProc = main_window_procA; - cls.cbClsExtra = 0; - cls.cbWndExtra = 0; - cls.hInstance = GetModuleHandleA(0); - cls.hIcon = 0; - cls.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW); - cls.hbrBackground = GetStockObject(WHITE_BRUSH); - cls.lpszMenuName = NULL; - cls.lpszClassName = "MainWindowClass"; - - if(!RegisterClassA(&cls)) return FALSE; - - cls.style = 0; - cls.lpfnWndProc = tool_window_procA; - cls.cbClsExtra = 0; - cls.cbWndExtra = 0; - cls.hInstance = GetModuleHandleA(0); - cls.hIcon = 0; - cls.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW); - cls.hbrBackground = GetStockObject(WHITE_BRUSH); - cls.lpszMenuName = NULL; - cls.lpszClassName = "ToolWindowClass"; - - if(!RegisterClassA(&cls)) return FALSE; - - return TRUE; -} - -static void verify_window_info(HWND hwnd, const WINDOWINFO *info, BOOL test_borders) -{ - RECT rcWindow, rcClient; - INT border; - DWORD status; - - ok(IsWindow(hwnd), "bad window handle\n"); - - GetWindowRect(hwnd, &rcWindow); - ok(EqualRect(&rcWindow, &info->rcWindow), "wrong rcWindow\n"); - - GetClientRect(hwnd, &rcClient); - /* translate to screen coordinates */ - MapWindowPoints(hwnd, 0, (LPPOINT)&rcClient, 2); - ok(EqualRect(&rcClient, &info->rcClient), "wrong rcClient\n"); - - ok(info->dwStyle == GetWindowLongA(hwnd, GWL_STYLE), "wrong dwStyle\n"); - ok(info->dwExStyle == GetWindowLongA(hwnd, GWL_EXSTYLE), "wrong dwExStyle\n"); - status = (GetActiveWindow() == hwnd) ? WS_ACTIVECAPTION : 0; - ok(info->dwWindowStatus == status, "wrong dwWindowStatus\n"); - - if (test_borders && !IsRectEmpty(&rcWindow)) - { - trace("rcWindow: %ld,%ld - %ld,%ld\n", rcWindow.left, rcWindow.top, rcWindow.right, rcWindow.bottom); - trace("rcClient: %ld,%ld - %ld,%ld\n", rcClient.left, rcClient.top, rcClient.right, rcClient.bottom); - - ok(info->cxWindowBorders == rcClient.left - rcWindow.left, - "wrong cxWindowBorders %d != %ld\n", info->cxWindowBorders, rcClient.left - rcWindow.left); - border = min(rcWindow.bottom - rcClient.bottom, rcClient.top - rcWindow.top); - ok(info->cyWindowBorders == border, - "wrong cyWindowBorders %d != %d\n", info->cyWindowBorders, border); - } - - ok(info->atomWindowType == GetClassLongA(hwnd, GCW_ATOM), "wrong atomWindowType\n"); - ok(info->wCreatorVersion == 0x0400, "wrong wCreatorVersion %04x\n", info->wCreatorVersion); -} - -static LRESULT CALLBACK cbt_hook_proc(int nCode, WPARAM wParam, LPARAM lParam) -{ - static const char *CBT_code_name[10] = { - "HCBT_MOVESIZE", - "HCBT_MINMAX", - "HCBT_QS", - "HCBT_CREATEWND", - "HCBT_DESTROYWND", - "HCBT_ACTIVATE", - "HCBT_CLICKSKIPPED", - "HCBT_KEYSKIPPED", - "HCBT_SYSCOMMAND", - "HCBT_SETFOCUS" }; - const char *code_name = (nCode >= 0 && nCode <= HCBT_SETFOCUS) ? CBT_code_name[nCode] : "Unknown"; - - trace("CBT: %d (%s), %08x, %08lx\n", nCode, code_name, wParam, lParam); - - switch (nCode) - { - case HCBT_CREATEWND: - { -#if 0 /* Uncomment this once the test succeeds in all cases */ - static const RECT rc_null; - RECT rc; -#endif - LONG style; - CBT_CREATEWNDA *createwnd = (CBT_CREATEWNDA *)lParam; - trace("HCBT_CREATEWND: hwnd %p, parent %p, style %08lx\n", - (HWND)wParam, createwnd->lpcs->hwndParent, createwnd->lpcs->style); - ok(createwnd->hwndInsertAfter == HWND_TOP, "hwndInsertAfter should be always HWND_TOP\n"); - - /* WS_VISIBLE should be turned off yet */ - style = createwnd->lpcs->style & ~WS_VISIBLE; - ok(style == GetWindowLongA((HWND)wParam, GWL_STYLE), - "style of hwnd and style in the CREATESTRUCT do not match: %08lx != %08lx\n", - GetWindowLongA((HWND)wParam, GWL_STYLE), style); - -#if 0 /* Uncomment this once the test succeeds in all cases */ - if ((style & (WS_CHILD|WS_POPUP)) == WS_CHILD) - { - ok(GetParent((HWND)wParam) == hwndMessage, - "wrong result from GetParent %p: message window %p\n", - GetParent((HWND)wParam), hwndMessage); - } - else - ok(!GetParent((HWND)wParam), "GetParent should return 0 at this point\n"); - - ok(!GetWindow((HWND)wParam, GW_OWNER), "GW_OWNER should be set to 0 at this point\n"); -#endif -#if 0 /* while NT assigns GW_HWNDFIRST/LAST some values at this point, - * Win9x still has them set to 0. - */ - ok(GetWindow((HWND)wParam, GW_HWNDFIRST) != 0, "GW_HWNDFIRST should not be set to 0 at this point\n"); - ok(GetWindow((HWND)wParam, GW_HWNDLAST) != 0, "GW_HWNDLAST should not be set to 0 at this point\n"); -#endif - ok(!GetWindow((HWND)wParam, GW_HWNDPREV), "GW_HWNDPREV should be set to 0 at this point\n"); - ok(!GetWindow((HWND)wParam, GW_HWNDNEXT), "GW_HWNDNEXT should be set to 0 at this point\n"); - -#if 0 /* Uncomment this once the test succeeds in all cases */ - if (pGetAncestor) - { - ok(pGetAncestor((HWND)wParam, GA_PARENT) == hwndMessage, "GA_PARENT should be set to hwndMessage at this point\n"); - ok(pGetAncestor((HWND)wParam, GA_ROOT) == (HWND)wParam, - "GA_ROOT is set to %p, expected %p\n", pGetAncestor((HWND)wParam, GA_ROOT), (HWND)wParam); - - if ((style & (WS_CHILD|WS_POPUP)) == WS_CHILD) - ok(pGetAncestor((HWND)wParam, GA_ROOTOWNER) == hwndMessage, - "GA_ROOTOWNER should be set to hwndMessage at this point\n"); - else - ok(pGetAncestor((HWND)wParam, GA_ROOTOWNER) == (HWND)wParam, - "GA_ROOTOWNER is set to %p, expected %p\n", pGetAncestor((HWND)wParam, GA_ROOTOWNER), (HWND)wParam); - } - - ok(GetWindowRect((HWND)wParam, &rc), "GetWindowRect failed\n"); - ok(EqualRect(&rc, &rc_null), "window rect should be set to 0 HCBT_CREATEWND\n"); - ok(GetClientRect((HWND)wParam, &rc), "GetClientRect failed\n"); - ok(EqualRect(&rc, &rc_null), "client rect should be set to 0 on HCBT_CREATEWND\n"); -#endif - break; - } - - case HCBT_DESTROYWND: - case HCBT_SETFOCUS: - if (wParam && pGetWindowInfo) - { - WINDOWINFO info; - - info.cbSize = 0; - ok(pGetWindowInfo((HWND)wParam, &info), "GetWindowInfo should not fail\n"); - /* win2k SP4 returns broken border info if GetWindowInfo - * is being called from HCBT_DESTROYWND hook proc. - */ - verify_window_info((HWND)wParam, &info, nCode != HCBT_DESTROYWND); - - info.cbSize = sizeof(WINDOWINFO) + 1; - ok(pGetWindowInfo((HWND)wParam, &info), "GetWindowInfo should not fail\n"); - verify_window_info((HWND)wParam, &info, nCode != HCBT_DESTROYWND); - } - break; - } - - return CallNextHookEx(hhook, nCode, wParam, lParam); -} - -static void test_shell_window() -{ - BOOL ret; - DWORD error; - HMODULE hinst, hUser32; - BOOL (WINAPI*SetShellWindow)(HWND); - BOOL (WINAPI*SetShellWindowEx)(HWND, HWND); - HWND hwnd1, hwnd2, hwnd3, hwnd4, hwnd5; - HWND shellWindow, nextWnd; - - shellWindow = GetShellWindow(); - hinst = GetModuleHandle(0); - hUser32 = GetModuleHandleA("user32"); - - SetShellWindow = (void *)GetProcAddress(hUser32, "SetShellWindow"); - SetShellWindowEx = (void *)GetProcAddress(hUser32, "SetShellWindowEx"); - - trace("previous shell window: %p\n", shellWindow); - - if (shellWindow) { - DWORD pid; - HANDLE hProcess; - - ret = DestroyWindow(shellWindow); - error = GetLastError(); - - ok(!ret, "DestroyWindow(shellWindow)\n"); - /* passes on Win XP, but not on Win98 - ok(error==ERROR_ACCESS_DENIED, "ERROR_ACCESS_DENIED after DestroyWindow(shellWindow)\n"); */ - - /* close old shell instance */ - GetWindowThreadProcessId(shellWindow, &pid); - hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid); - ret = TerminateProcess(hProcess, 0); - ok(ret, "termination of previous shell process failed: GetLastError()=%ld\n", GetLastError()); - WaitForSingleObject(hProcess, INFINITE); /* wait for termination */ - CloseHandle(hProcess); - } - - hwnd1 = CreateWindowEx(0, TEXT("#32770"), TEXT("TEST1"), WS_OVERLAPPEDWINDOW/*|WS_VISIBLE*/, 100, 100, 300, 200, 0, 0, hinst, 0); - trace("created window 1: %p\n", hwnd1); - - ret = SetShellWindow(hwnd1); - ok(ret, "first call to SetShellWindow(hwnd1)\n"); - shellWindow = GetShellWindow(); - ok(shellWindow==hwnd1, "wrong shell window: %p\n", shellWindow); - - ret = SetShellWindow(hwnd1); - ok(!ret, "second call to SetShellWindow(hwnd1)\n"); - - ret = SetShellWindow(0); - error = GetLastError(); - /* passes on Win XP, but not on Win98 - ok(!ret, "reset shell window by SetShellWindow(0)\n"); - ok(error==ERROR_INVALID_WINDOW_HANDLE, "ERROR_INVALID_WINDOW_HANDLE after SetShellWindow(0)\n"); */ - - ret = SetShellWindow(hwnd1); - /* passes on Win XP, but not on Win98 - ok(!ret, "third call to SetShellWindow(hwnd1)\n"); */ - - todo_wine - { - SetWindowLong(hwnd1, GWL_EXSTYLE, GetWindowLong(hwnd1,GWL_EXSTYLE)|WS_EX_TOPMOST); - ret = GetWindowLong(hwnd1,GWL_EXSTYLE)&WS_EX_TOPMOST? TRUE: FALSE; - ok(!ret, "SetWindowExStyle(hwnd1, WS_EX_TOPMOST)\n"); - } - - ret = DestroyWindow(hwnd1); - ok(ret, "DestroyWindow(hwnd1)\n"); - - hwnd2 = CreateWindowEx(WS_EX_TOPMOST, TEXT("#32770"), TEXT("TEST2"), WS_OVERLAPPEDWINDOW/*|WS_VISIBLE*/, 150, 250, 300, 200, 0, 0, hinst, 0); - trace("created window 2: %p\n", hwnd2); - ret = SetShellWindow(hwnd2); - ok(!ret, "SetShellWindow(hwnd2) with WS_EX_TOPMOST\n"); - - hwnd3 = CreateWindowEx(0, TEXT("#32770"), TEXT("TEST3"), WS_OVERLAPPEDWINDOW/*|WS_VISIBLE*/, 200, 400, 300, 200, 0, 0, hinst, 0); - trace("created window 3: %p\n", hwnd3); - - hwnd4 = CreateWindowEx(0, TEXT("#32770"), TEXT("TEST4"), WS_OVERLAPPEDWINDOW/*|WS_VISIBLE*/, 250, 500, 300, 200, 0, 0, hinst, 0); - trace("created window 4: %p\n", hwnd4); - - nextWnd = GetWindow(hwnd4, GW_HWNDNEXT); - ok(nextWnd==hwnd3, "wrong next window for hwnd4: %p - expected hwnd3\n", nextWnd); - - ret = SetShellWindow(hwnd4); - ok(ret, "SetShellWindow(hwnd4)\n"); - shellWindow = GetShellWindow(); - ok(shellWindow==hwnd4, "wrong shell window: %p - expected hwnd4\n", shellWindow); - - nextWnd = GetWindow(hwnd4, GW_HWNDNEXT); - ok(nextWnd==0, "wrong next window for hwnd4: %p - expected 0\n", nextWnd); - - ret = SetWindowPos(hwnd4, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE); - ok(ret, "SetWindowPos(hwnd4, HWND_TOPMOST)\n"); - - ret = SetWindowPos(hwnd4, hwnd3, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE); - ok(ret, "SetWindowPos(hwnd4, hwnd3\n"); - - ret = SetShellWindow(hwnd3); - ok(!ret, "SetShellWindow(hwnd3)\n"); - shellWindow = GetShellWindow(); - ok(shellWindow==hwnd4, "wrong shell window: %p - expected hwnd4\n", shellWindow); - - hwnd5 = CreateWindowEx(0, TEXT("#32770"), TEXT("TEST5"), WS_OVERLAPPEDWINDOW/*|WS_VISIBLE*/, 300, 600, 300, 200, 0, 0, hinst, 0); - trace("created window 5: %p\n", hwnd5); - ret = SetWindowPos(hwnd4, hwnd5, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE); - ok(ret, "SetWindowPos(hwnd4, hwnd5)\n"); - - todo_wine - { - nextWnd = GetWindow(hwnd4, GW_HWNDNEXT); - ok(nextWnd==0, "wrong next window for hwnd4 after SetWindowPos(): %p - expected 0\n", nextWnd); - } - - /* destroy test windows */ - DestroyWindow(hwnd2); - DestroyWindow(hwnd3); - DestroyWindow(hwnd4); - DestroyWindow(hwnd5); -} - -/************** MDI test ****************/ - -static const char mdi_lParam_test_message[] = "just a test string"; - -static void test_MDI_create(HWND parent, HWND mdi_client) -{ - MDICREATESTRUCTA mdi_cs; - HWND mdi_child; - static const WCHAR classW[] = {'M','D','I','_','c','h','i','l','d','_','C','l','a','s','s','_','1',0}; - static const WCHAR titleW[] = {'M','D','I',' ','c','h','i','l','d',0}; - BOOL isWin9x = FALSE; - - mdi_cs.szClass = "MDI_child_Class_1"; - mdi_cs.szTitle = "MDI child"; - mdi_cs.hOwner = GetModuleHandle(0); - mdi_cs.x = CW_USEDEFAULT; - mdi_cs.y = CW_USEDEFAULT; - mdi_cs.cx = CW_USEDEFAULT; - mdi_cs.cy = CW_USEDEFAULT; - mdi_cs.style = 0; - mdi_cs.lParam = (LPARAM)mdi_lParam_test_message; - mdi_child = (HWND)SendMessageA(mdi_client, WM_MDICREATE, 0, (LPARAM)&mdi_cs); - ok(mdi_child != 0, "MDI child creation failed\n"); - DestroyWindow(mdi_child); - - mdi_cs.style = 0x7fffffff; /* without WS_POPUP */ - mdi_child = (HWND)SendMessageA(mdi_client, WM_MDICREATE, 0, (LPARAM)&mdi_cs); - ok(mdi_child != 0, "MDI child creation failed\n"); - DestroyWindow(mdi_child); - - mdi_cs.style = 0xffffffff; /* with WS_POPUP */ - mdi_child = (HWND)SendMessageA(mdi_client, WM_MDICREATE, 0, (LPARAM)&mdi_cs); - if (GetWindowLongA(mdi_client, GWL_STYLE) & MDIS_ALLCHILDSTYLES) - { - ok(!mdi_child, "MDI child with WS_POPUP and with MDIS_ALLCHILDSTYLES should fail\n"); - DestroyWindow(mdi_child); - } - else - ok(mdi_child != 0, "MDI child creation failed\n"); - - /* test MDICREATESTRUCT A<->W mapping */ - /* MDICREATESTRUCTA and MDICREATESTRUCTW have the same layout */ - mdi_cs.style = 0; - mdi_cs.szClass = (LPCSTR)classW; - mdi_cs.szTitle = (LPCSTR)titleW; - SetLastError(0xdeadbeef); - mdi_child = (HWND)SendMessageW(mdi_client, WM_MDICREATE, 0, (LPARAM)&mdi_cs); - if (!mdi_child) - { - if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - isWin9x = TRUE; - else - ok(mdi_child != 0, "MDI child creation failed\n"); - } - DestroyWindow(mdi_child); - - mdi_child = CreateMDIWindowA("MDI_child_Class_1", "MDI child", - 0, - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - mdi_client, GetModuleHandle(0), - (LPARAM)mdi_lParam_test_message); - ok(mdi_child != 0, "MDI child creation failed\n"); - DestroyWindow(mdi_child); - - mdi_child = CreateMDIWindowA("MDI_child_Class_1", "MDI child", - 0x7fffffff, /* without WS_POPUP */ - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - mdi_client, GetModuleHandle(0), - (LPARAM)mdi_lParam_test_message); - ok(mdi_child != 0, "MDI child creation failed\n"); - DestroyWindow(mdi_child); - - mdi_child = CreateMDIWindowA("MDI_child_Class_1", "MDI child", - 0xffffffff, /* with WS_POPUP */ - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - mdi_client, GetModuleHandle(0), - (LPARAM)mdi_lParam_test_message); - if (GetWindowLongA(mdi_client, GWL_STYLE) & MDIS_ALLCHILDSTYLES) - { - ok(!mdi_child, "MDI child with WS_POPUP and with MDIS_ALLCHILDSTYLES should fail\n"); - DestroyWindow(mdi_child); - } - else - ok(mdi_child != 0, "MDI child creation failed\n"); - - /* test MDICREATESTRUCT A<->W mapping */ - SetLastError(0xdeadbeef); - mdi_child = CreateMDIWindowW(classW, titleW, - 0, - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - mdi_client, GetModuleHandle(0), - (LPARAM)mdi_lParam_test_message); - if (!mdi_child) - { - if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - isWin9x = TRUE; - else - ok(mdi_child != 0, "MDI child creation failed\n"); - } - DestroyWindow(mdi_child); - - mdi_child = CreateWindowExA(WS_EX_MDICHILD, "MDI_child_Class_1", "MDI child", - 0, - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - mdi_client, 0, GetModuleHandle(0), - (LPVOID)mdi_lParam_test_message); - ok(mdi_child != 0, "MDI child creation failed\n"); - DestroyWindow(mdi_child); - - mdi_child = CreateWindowExA(WS_EX_MDICHILD, "MDI_child_Class_1", "MDI child", - 0x7fffffff, /* without WS_POPUP */ - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - mdi_client, 0, GetModuleHandle(0), - (LPVOID)mdi_lParam_test_message); - ok(mdi_child != 0, "MDI child creation failed\n"); - DestroyWindow(mdi_child); - - mdi_child = CreateWindowExA(WS_EX_MDICHILD, "MDI_child_Class_1", "MDI child", - 0xffffffff, /* with WS_POPUP */ - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - mdi_client, 0, GetModuleHandle(0), - (LPVOID)mdi_lParam_test_message); - if (GetWindowLongA(mdi_client, GWL_STYLE) & MDIS_ALLCHILDSTYLES) - { - ok(!mdi_child, "MDI child with WS_POPUP and with MDIS_ALLCHILDSTYLES should fail\n"); - DestroyWindow(mdi_child); - } - else - ok(mdi_child != 0, "MDI child creation failed\n"); - - /* test MDICREATESTRUCT A<->W mapping */ - SetLastError(0xdeadbeef); - mdi_child = CreateWindowExW(WS_EX_MDICHILD, classW, titleW, - 0, - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - mdi_client, 0, GetModuleHandle(0), - (LPVOID)mdi_lParam_test_message); - if (!mdi_child) - { - if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - isWin9x = TRUE; - else - ok(mdi_child != 0, "MDI child creation failed\n"); - } - DestroyWindow(mdi_child); - - /* This test fails on Win9x */ - if (!isWin9x) - { - mdi_child = CreateWindowExA(WS_EX_MDICHILD, "MDI_child_Class_2", "MDI child", - WS_CHILD, - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - parent, 0, GetModuleHandle(0), - (LPVOID)mdi_lParam_test_message); - ok(!mdi_child, "WS_EX_MDICHILD with a not MDIClient parent should fail\n"); - } - - mdi_child = CreateWindowExA(0, "MDI_child_Class_2", "MDI child", - WS_CHILD, /* without WS_POPUP */ - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - mdi_client, 0, GetModuleHandle(0), - (LPVOID)mdi_lParam_test_message); - ok(mdi_child != 0, "MDI child creation failed\n"); - DestroyWindow(mdi_child); - - mdi_child = CreateWindowExA(0, "MDI_child_Class_2", "MDI child", - WS_CHILD | WS_POPUP, /* with WS_POPUP */ - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - mdi_client, 0, GetModuleHandle(0), - (LPVOID)mdi_lParam_test_message); - ok(mdi_child != 0, "MDI child creation failed\n"); - DestroyWindow(mdi_child); - - /* maximized child */ - mdi_child = CreateWindowExA(0, "MDI_child_Class_2", "MDI child", - WS_CHILD | WS_MAXIMIZE, - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - mdi_client, 0, GetModuleHandle(0), - (LPVOID)mdi_lParam_test_message); - ok(mdi_child != 0, "MDI child creation failed\n"); - DestroyWindow(mdi_child); - - trace("Creating maximized child with a caption\n"); - mdi_child = CreateWindowExA(0, "MDI_child_Class_2", "MDI child", - WS_CHILD | WS_MAXIMIZE | WS_CAPTION, - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - mdi_client, 0, GetModuleHandle(0), - (LPVOID)mdi_lParam_test_message); - ok(mdi_child != 0, "MDI child creation failed\n"); - DestroyWindow(mdi_child); - - trace("Creating maximized child with a caption and a thick frame\n"); - mdi_child = CreateWindowExA(0, "MDI_child_Class_2", "MDI child", - WS_CHILD | WS_MAXIMIZE | WS_CAPTION | WS_THICKFRAME, - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - mdi_client, 0, GetModuleHandle(0), - (LPVOID)mdi_lParam_test_message); - ok(mdi_child != 0, "MDI child creation failed\n"); - DestroyWindow(mdi_child); -} - -/********************************************************************** - * MDI_ChildGetMinMaxInfo (copied from windows/mdi.c) - * - * Note: The rule here is that client rect of the maximized MDI child - * is equal to the client rect of the MDI client window. - */ -static void MDI_ChildGetMinMaxInfo( HWND client, HWND hwnd, MINMAXINFO* lpMinMax ) -{ - RECT rect; - - GetClientRect( client, &rect ); - AdjustWindowRectEx( &rect, GetWindowLongA( hwnd, GWL_STYLE ), - 0, GetWindowLongA( hwnd, GWL_EXSTYLE )); - - rect.right -= rect.left; - rect.bottom -= rect.top; - lpMinMax->ptMaxSize.x = rect.right; - lpMinMax->ptMaxSize.y = rect.bottom; - - lpMinMax->ptMaxPosition.x = rect.left; - lpMinMax->ptMaxPosition.y = rect.top; - - trace("max rect (%ld,%ld - %ld, %ld)\n", - rect.left, rect.top, rect.right, rect.bottom); -} - -static LRESULT WINAPI mdi_child_wnd_proc_1(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) -{ - switch (msg) - { - case WM_NCCREATE: - case WM_CREATE: - { - CREATESTRUCTA *cs = (CREATESTRUCTA *)lparam; - MDICREATESTRUCTA *mdi_cs = (MDICREATESTRUCTA *)cs->lpCreateParams; - - ok(cs->dwExStyle & WS_EX_MDICHILD, "WS_EX_MDICHILD should be set\n"); - ok(mdi_cs->lParam == (LPARAM)mdi_lParam_test_message, "wrong mdi_cs->lParam\n"); - - ok(!lstrcmpA(cs->lpszClass, "MDI_child_Class_1"), "wrong class name\n"); - ok(!lstrcmpA(cs->lpszClass, mdi_cs->szClass), "class name does not match\n"); - ok(!lstrcmpA(cs->lpszName, "MDI child"), "wrong title\n"); - ok(!lstrcmpA(cs->lpszName, mdi_cs->szTitle), "title does not match\n"); - ok(cs->hInstance == mdi_cs->hOwner, "%p != %p\n", cs->hInstance, mdi_cs->hOwner); - - /* MDICREATESTRUCT should have original values */ - ok(mdi_cs->style == 0 || mdi_cs->style == 0x7fffffff || mdi_cs->style == 0xffffffff, - "mdi_cs->style does not match (%08lx)\n", mdi_cs->style); - ok(mdi_cs->x == CW_USEDEFAULT, "%d != CW_USEDEFAULT\n", mdi_cs->x); - ok(mdi_cs->y == CW_USEDEFAULT, "%d != CW_USEDEFAULT\n", mdi_cs->y); - ok(mdi_cs->cx == CW_USEDEFAULT, "%d != CW_USEDEFAULT\n", mdi_cs->cx); - ok(mdi_cs->cy == CW_USEDEFAULT, "%d != CW_USEDEFAULT\n", mdi_cs->cy); - - /* CREATESTRUCT should have fixed values */ - ok(cs->x != CW_USEDEFAULT, "%d == CW_USEDEFAULT\n", cs->x); - ok(cs->y != CW_USEDEFAULT, "%d == CW_USEDEFAULT\n", cs->y); - - /* cx/cy == CW_USEDEFAULT are translated to NOT zero values */ - ok(cs->cx != CW_USEDEFAULT && cs->cx != 0, "%d == CW_USEDEFAULT\n", cs->cx); - ok(cs->cy != CW_USEDEFAULT && cs->cy != 0, "%d == CW_USEDEFAULT\n", cs->cy); - - ok(!(cs->style & WS_POPUP), "WS_POPUP is not allowed\n"); - - if (GetWindowLongA(cs->hwndParent, GWL_STYLE) & MDIS_ALLCHILDSTYLES) - { - LONG style = mdi_cs->style | WS_CHILD | WS_CLIPSIBLINGS; - ok(cs->style == style, - "cs->style does not match (%08lx)\n", cs->style); - } - else - { - LONG style = mdi_cs->style; - style &= ~WS_POPUP; - style |= WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CAPTION | - WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX; - ok(cs->style == style, - "cs->style does not match (%08lx)\n", cs->style); - } - break; - } - - case WM_GETMINMAXINFO: - { - HWND client = GetParent(hwnd); - RECT rc; - MINMAXINFO *minmax = (MINMAXINFO *)lparam; - MINMAXINFO my_minmax; - LONG style, exstyle; - - style = GetWindowLongA(hwnd, GWL_STYLE); - exstyle = GetWindowLongA(hwnd, GWL_EXSTYLE); - - GetWindowRect(client, &rc); - trace("MDI client %p window size = (%ld x %ld)\n", client, rc.right-rc.left, rc.bottom-rc.top); - GetClientRect(client, &rc); - trace("MDI client %p client size = (%ld x %ld)\n", client, rc.right, rc.bottom); - trace("screen size: %d x %d\n", GetSystemMetrics(SM_CXSCREEN), - GetSystemMetrics(SM_CYSCREEN)); - - GetClientRect(client, &rc); - if ((style & WS_CAPTION) == WS_CAPTION) - style &= ~WS_BORDER; /* WS_CAPTION = WS_DLGFRAME | WS_BORDER */ - AdjustWindowRectEx(&rc, style, 0, exstyle); - trace("MDI child: calculated max window size = (%ld x %ld)\n", rc.right-rc.left, rc.bottom-rc.top); - - trace("ptReserved = (%ld,%ld)\n" - "ptMaxSize = (%ld,%ld)\n" - "ptMaxPosition = (%ld,%ld)\n" - "ptMinTrackSize = (%ld,%ld)\n" - "ptMaxTrackSize = (%ld,%ld)\n", - minmax->ptReserved.x, minmax->ptReserved.y, - minmax->ptMaxSize.x, minmax->ptMaxSize.y, - minmax->ptMaxPosition.x, minmax->ptMaxPosition.y, - minmax->ptMinTrackSize.x, minmax->ptMinTrackSize.y, - minmax->ptMaxTrackSize.x, minmax->ptMaxTrackSize.y); - - ok(minmax->ptMaxSize.x == rc.right - rc.left, "default width of maximized child %ld != %ld\n", - minmax->ptMaxSize.x, rc.right - rc.left); - ok(minmax->ptMaxSize.y == rc.bottom - rc.top, "default height of maximized child %ld != %ld\n", - minmax->ptMaxSize.y, rc.bottom - rc.top); - - DefMDIChildProcA(hwnd, msg, wparam, lparam); - - trace("DefMDIChildProc returned:\n" - "ptReserved = (%ld,%ld)\n" - "ptMaxSize = (%ld,%ld)\n" - "ptMaxPosition = (%ld,%ld)\n" - "ptMinTrackSize = (%ld,%ld)\n" - "ptMaxTrackSize = (%ld,%ld)\n", - minmax->ptReserved.x, minmax->ptReserved.y, - minmax->ptMaxSize.x, minmax->ptMaxSize.y, - minmax->ptMaxPosition.x, minmax->ptMaxPosition.y, - minmax->ptMinTrackSize.x, minmax->ptMinTrackSize.y, - minmax->ptMaxTrackSize.x, minmax->ptMaxTrackSize.y); - - MDI_ChildGetMinMaxInfo(client, hwnd, &my_minmax); - ok(minmax->ptMaxSize.x == my_minmax.ptMaxSize.x, "default width of maximized child %ld != %ld\n", - minmax->ptMaxSize.x, my_minmax.ptMaxSize.x); - ok(minmax->ptMaxSize.y == my_minmax.ptMaxSize.y, "default height of maximized child %ld != %ld\n", - minmax->ptMaxSize.y, my_minmax.ptMaxSize.y); - - return 1; - } - } - return DefMDIChildProcA(hwnd, msg, wparam, lparam); -} - -static LRESULT WINAPI mdi_child_wnd_proc_2(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) -{ - switch (msg) - { - case WM_NCCREATE: - case WM_CREATE: - { - CREATESTRUCTA *cs = (CREATESTRUCTA *)lparam; - - trace("%s\n", (msg == WM_NCCREATE) ? "WM_NCCREATE" : "WM_CREATE"); - trace("x %d, y %d, cx %d, cy %d\n", cs->x, cs->y, cs->cx, cs->cy); - - ok(!(cs->dwExStyle & WS_EX_MDICHILD), "WS_EX_MDICHILD should not be set\n"); - ok(cs->lpCreateParams == mdi_lParam_test_message, "wrong cs->lpCreateParams\n"); - - ok(!lstrcmpA(cs->lpszClass, "MDI_child_Class_2"), "wrong class name\n"); - ok(!lstrcmpA(cs->lpszName, "MDI child"), "wrong title\n"); - - /* CREATESTRUCT should have fixed values */ - /* For some reason Win9x doesn't translate cs->x from CW_USEDEFAULT, - while NT does. */ - /*ok(cs->x != CW_USEDEFAULT, "%d == CW_USEDEFAULT\n", cs->x);*/ - ok(cs->y != CW_USEDEFAULT, "%d == CW_USEDEFAULT\n", cs->y); - - /* cx/cy == CW_USEDEFAULT are translated to 0 */ - ok(cs->cx == 0, "%d != 0\n", cs->cx); - ok(cs->cy == 0, "%d != 0\n", cs->cy); - break; - } - - case WM_GETMINMAXINFO: - { - HWND parent = GetParent(hwnd); - RECT rc; - MINMAXINFO *minmax = (MINMAXINFO *)lparam; - LONG style, exstyle; - - trace("WM_GETMINMAXINFO\n"); - - style = GetWindowLongA(hwnd, GWL_STYLE); - exstyle = GetWindowLongA(hwnd, GWL_EXSTYLE); - - GetClientRect(parent, &rc); - trace("parent %p client size = (%ld x %ld)\n", parent, rc.right, rc.bottom); - - GetClientRect(parent, &rc); - if ((style & WS_CAPTION) == WS_CAPTION) - style &= ~WS_BORDER; /* WS_CAPTION = WS_DLGFRAME | WS_BORDER */ - AdjustWindowRectEx(&rc, style, 0, exstyle); - trace("calculated max child window size = (%ld x %ld)\n", rc.right-rc.left, rc.bottom-rc.top); - - trace("ptReserved = (%ld,%ld)\n" - "ptMaxSize = (%ld,%ld)\n" - "ptMaxPosition = (%ld,%ld)\n" - "ptMinTrackSize = (%ld,%ld)\n" - "ptMaxTrackSize = (%ld,%ld)\n", - minmax->ptReserved.x, minmax->ptReserved.y, - minmax->ptMaxSize.x, minmax->ptMaxSize.y, - minmax->ptMaxPosition.x, minmax->ptMaxPosition.y, - minmax->ptMinTrackSize.x, minmax->ptMinTrackSize.y, - minmax->ptMaxTrackSize.x, minmax->ptMaxTrackSize.y); - - ok(minmax->ptMaxSize.x == rc.right - rc.left, "default width of maximized child %ld != %ld\n", - minmax->ptMaxSize.x, rc.right - rc.left); - ok(minmax->ptMaxSize.y == rc.bottom - rc.top, "default height of maximized child %ld != %ld\n", - minmax->ptMaxSize.y, rc.bottom - rc.top); - break; - } - - case WM_WINDOWPOSCHANGING: - case WM_WINDOWPOSCHANGED: - { - WINDOWPOS *winpos = (WINDOWPOS *)lparam; - WINDOWPOS my_winpos = *winpos; - - trace("%s\n", (msg == WM_WINDOWPOSCHANGING) ? "WM_WINDOWPOSCHANGING" : "WM_WINDOWPOSCHANGED"); - trace("%p after %p, x %d, y %d, cx %d, cy %d flags %08x\n", - winpos->hwnd, winpos->hwndInsertAfter, - winpos->x, winpos->y, winpos->cx, winpos->cy, winpos->flags); - - DefWindowProcA(hwnd, msg, wparam, lparam); - - trace("%p after %p, x %d, y %d, cx %d, cy %d flags %08x\n", - winpos->hwnd, winpos->hwndInsertAfter, - winpos->x, winpos->y, winpos->cx, winpos->cy, winpos->flags); - - ok(!memcmp(&my_winpos, winpos, sizeof(WINDOWPOS)), - "DefWindowProc should not change WINDOWPOS values\n"); - - return 1; - } - } - return DefWindowProcA(hwnd, msg, wparam, lparam); -} - -static LRESULT WINAPI mdi_main_wnd_procA(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) -{ - static HWND mdi_client; - - switch (msg) - { - case WM_CREATE: - { - CLIENTCREATESTRUCT client_cs; - RECT rc; - - GetClientRect(hwnd, &rc); - - client_cs.hWindowMenu = 0; - client_cs.idFirstChild = 1; - - /* MDIClient without MDIS_ALLCHILDSTYLES */ - mdi_client = CreateWindowExA(0, "mdiclient", - NULL, - WS_CHILD /*| WS_VISIBLE*/, - /* tests depend on a not zero MDIClient size */ - 0, 0, rc.right, rc.bottom, - hwnd, 0, GetModuleHandle(0), - (LPVOID)&client_cs); - assert(mdi_client); - test_MDI_create(hwnd, mdi_client); - DestroyWindow(mdi_client); - - /* MDIClient with MDIS_ALLCHILDSTYLES */ - mdi_client = CreateWindowExA(0, "mdiclient", - NULL, - WS_CHILD | MDIS_ALLCHILDSTYLES /*| WS_VISIBLE*/, - /* tests depend on a not zero MDIClient size */ - 0, 0, rc.right, rc.bottom, - hwnd, 0, GetModuleHandle(0), - (LPVOID)&client_cs); - assert(mdi_client); - test_MDI_create(hwnd, mdi_client); - DestroyWindow(mdi_client); - break; - } - - case WM_CLOSE: - PostQuitMessage(0); - break; - } - return DefFrameProcA(hwnd, mdi_client, msg, wparam, lparam); -} - -static BOOL mdi_RegisterWindowClasses(void) -{ - WNDCLASSA cls; - - cls.style = 0; - cls.lpfnWndProc = mdi_main_wnd_procA; - cls.cbClsExtra = 0; - cls.cbWndExtra = 0; - cls.hInstance = GetModuleHandleA(0); - cls.hIcon = 0; - cls.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW); - cls.hbrBackground = GetStockObject(WHITE_BRUSH); - cls.lpszMenuName = NULL; - cls.lpszClassName = "MDI_parent_Class"; - if(!RegisterClassA(&cls)) return FALSE; - - cls.lpfnWndProc = mdi_child_wnd_proc_1; - cls.lpszClassName = "MDI_child_Class_1"; - if(!RegisterClassA(&cls)) return FALSE; - - cls.lpfnWndProc = mdi_child_wnd_proc_2; - cls.lpszClassName = "MDI_child_Class_2"; - if(!RegisterClassA(&cls)) return FALSE; - - return TRUE; -} - -static void test_mdi(void) -{ - HWND mdi_hwndMain; - /*MSG msg;*/ - - if (!mdi_RegisterWindowClasses()) assert(0); - - mdi_hwndMain = CreateWindowExA(0, "MDI_parent_Class", "MDI parent window", - WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | - WS_MAXIMIZEBOX /*| WS_VISIBLE*/, - 100, 100, CW_USEDEFAULT, CW_USEDEFAULT, - GetDesktopWindow(), 0, - GetModuleHandle(0), NULL); - assert(mdi_hwndMain); -/* - while(GetMessage(&msg, 0, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } -*/ -} - -static void test_icons(void) -{ - WNDCLASSEXA cls; - HWND hwnd; - HICON icon = LoadIconA(0, (LPSTR)IDI_APPLICATION); - HICON icon2 = LoadIconA(0, (LPSTR)IDI_QUESTION); - HICON small_icon = LoadImageA(0, (LPSTR)IDI_APPLICATION, IMAGE_ICON, - GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED ); - HICON res; - - cls.cbSize = sizeof(cls); - cls.style = 0; - cls.lpfnWndProc = DefWindowProcA; - cls.cbClsExtra = 0; - cls.cbWndExtra = 0; - cls.hInstance = 0; - cls.hIcon = LoadIconA(0, (LPSTR)IDI_HAND); - cls.hIconSm = small_icon; - cls.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW); - cls.hbrBackground = GetStockObject(WHITE_BRUSH); - cls.lpszMenuName = NULL; - cls.lpszClassName = "IconWindowClass"; - - RegisterClassExA(&cls); - - hwnd = CreateWindowExA(0, "IconWindowClass", "icon test", 0, - 100, 100, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, NULL, NULL); - assert( hwnd ); - - res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_BIG, 0 ); - ok( res == 0, "wrong big icon %p/0\n", res ); - res = (HICON)SendMessageA( hwnd, WM_SETICON, ICON_BIG, (LPARAM)icon ); - ok( res == 0, "wrong previous big icon %p/0\n", res ); - res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_BIG, 0 ); - ok( res == icon, "wrong big icon after set %p/%p\n", res, icon ); - res = (HICON)SendMessageA( hwnd, WM_SETICON, ICON_BIG, (LPARAM)icon2 ); - ok( res == icon, "wrong previous big icon %p/%p\n", res, icon ); - res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_BIG, 0 ); - ok( res == icon2, "wrong big icon after set %p/%p\n", res, icon2 ); - - res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL, 0 ); - ok( res == 0, "wrong small icon %p/0\n", res ); - /* this test is XP specific */ - /*res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL2, 0 ); - ok( res != 0, "wrong small icon %p\n", res );*/ - res = (HICON)SendMessageA( hwnd, WM_SETICON, ICON_SMALL, (LPARAM)icon ); - ok( res == 0, "wrong previous small icon %p/0\n", res ); - res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL, 0 ); - ok( res == icon, "wrong small icon after set %p/%p\n", res, icon ); - /* this test is XP specific */ - /*res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL2, 0 ); - ok( res == icon, "wrong small icon after set %p/%p\n", res, icon );*/ - res = (HICON)SendMessageA( hwnd, WM_SETICON, ICON_SMALL, (LPARAM)small_icon ); - ok( res == icon, "wrong previous small icon %p/%p\n", res, icon ); - res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL, 0 ); - ok( res == small_icon, "wrong small icon after set %p/%p\n", res, small_icon ); - /* this test is XP specific */ - /*res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL2, 0 ); - ok( res == small_icon, "wrong small icon after set %p/%p\n", res, small_icon );*/ - - /* make sure the big icon hasn't changed */ - res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_BIG, 0 ); - ok( res == icon2, "wrong big icon after set %p/%p\n", res, icon2 ); -} - -static void test_SetWindowPos(HWND hwnd) -{ - SetWindowPos(hwnd, 0, -32769, -40000, -32769, -90000, SWP_NOMOVE); - SetWindowPos(hwnd, 0, 32768, 40000, 32768, 40000, SWP_NOMOVE); - - SetWindowPos(hwnd, 0, -32769, -40000, -32769, -90000, SWP_NOSIZE); - SetWindowPos(hwnd, 0, 32768, 40000, 32768, 40000, SWP_NOSIZE); -} - -static void test_SetMenu(HWND parent) -{ - HWND child; - HMENU hMenu, ret; - - hMenu = CreateMenu(); - assert(hMenu); - - /* parent */ - ret = GetMenu(parent); - ok(ret == 0, "unexpected menu id %p\n", ret); - - ok(!SetMenu(parent, (HMENU)20), "SetMenu with invalid menu handle should fail\n"); - ret = GetMenu(parent); - ok(ret == 0, "unexpected menu id %p\n", ret); - - ok(SetMenu(parent, hMenu), "SetMenu on a top level window should not fail\n"); - ret = GetMenu(parent); - ok(ret == (HMENU)hMenu, "unexpected menu id %p\n", ret); - - ok(SetMenu(parent, 0), "SetMenu(0) on a top level window should not fail\n"); - ret = GetMenu(parent); - ok(ret == 0, "unexpected menu id %p\n", ret); - - /* child */ - child = CreateWindowExA(0, "static", NULL, WS_CHILD, 0, 0, 0, 0, parent, (HMENU)10, 0, NULL); - assert(child); - - ret = GetMenu(child); - ok(ret == (HMENU)10, "unexpected menu id %p\n", ret); - - ok(!SetMenu(child, (HMENU)20), "SetMenu with invalid menu handle should fail\n"); - ret = GetMenu(child); - ok(ret == (HMENU)10, "unexpected menu id %p\n", ret); - - ok(!SetMenu(child, hMenu), "SetMenu on a child window should fail\n"); - ret = GetMenu(child); - ok(ret == (HMENU)10, "unexpected menu id %p\n", ret); - - ok(!SetMenu(child, 0), "SetMenu(0) on a child window should fail\n"); - ret = GetMenu(child); - ok(ret == (HMENU)10, "unexpected menu id %p\n", ret); - - DestroyWindow(child); - DestroyMenu(hMenu); -} - -static void test_window_tree(HWND parent, const DWORD *style, const int *order, int total) -{ - HWND child[5], hwnd; - int i; - - assert(total <= 5); - - hwnd = GetWindow(parent, GW_CHILD); - ok(!hwnd, "have to start without children to perform the test\n"); - - for (i = 0; i < total; i++) - { - child[i] = CreateWindowExA(0, "static", "", style[i], 0,0,10,10, - parent, 0, 0, NULL); - trace("child[%d] = %p\n", i, child[i]); - ok(child[i] != 0, "CreateWindowEx failed to create child window\n"); - } - - hwnd = GetWindow(parent, GW_CHILD); - ok(hwnd != 0, "GetWindow(GW_CHILD) failed\n"); - ok(hwnd == GetWindow(child[total - 1], GW_HWNDFIRST), "GW_HWNDFIRST is wrong\n"); - ok(child[order[total - 1]] == GetWindow(child[0], GW_HWNDLAST), "GW_HWNDLAST is wrong\n"); - - for (i = 0; i < total; i++) - { - trace("hwnd[%d] = %p\n", i, hwnd); - ok(child[order[i]] == hwnd, "Z order of child #%d is wrong\n", i); - - hwnd = GetWindow(hwnd, GW_HWNDNEXT); - } - - for (i = 0; i < total; i++) - ok(DestroyWindow(child[i]), "DestroyWindow failed\n"); -} - -static void test_children_zorder(HWND parent) -{ - const DWORD simple_style[5] = { WS_CHILD, WS_CHILD, WS_CHILD, WS_CHILD, - WS_CHILD }; - const int simple_order[5] = { 0, 1, 2, 3, 4 }; - - const DWORD complex_style[5] = { WS_CHILD, WS_CHILD | WS_MAXIMIZE, - WS_CHILD | WS_VISIBLE, WS_CHILD, - WS_CHILD | WS_MAXIMIZE | WS_VISIBLE }; - const int complex_order_1[1] = { 0 }; - const int complex_order_2[2] = { 1, 0 }; - const int complex_order_3[3] = { 1, 0, 2 }; - const int complex_order_4[4] = { 1, 0, 2, 3 }; - const int complex_order_5[5] = { 4, 1, 0, 2, 3 }; - - /* simple WS_CHILD */ - test_window_tree(parent, simple_style, simple_order, 5); - - /* complex children styles */ - test_window_tree(parent, complex_style, complex_order_1, 1); - test_window_tree(parent, complex_style, complex_order_2, 2); - test_window_tree(parent, complex_style, complex_order_3, 3); - test_window_tree(parent, complex_style, complex_order_4, 4); - test_window_tree(parent, complex_style, complex_order_5, 5); -} - -static void test_SetFocus(HWND hwnd) -{ - HWND child; - - /* check if we can set focus to non-visible windows */ - - ShowWindow(hwnd, SW_SHOW); - SetFocus(0); - SetFocus(hwnd); - ok( GetFocus() == hwnd, "Failed to set focus to visible window %p\n", hwnd ); - ok( GetWindowLong(hwnd,GWL_STYLE) & WS_VISIBLE, "Window %p not visible\n", hwnd ); - ShowWindow(hwnd, SW_HIDE); - SetFocus(0); - SetFocus(hwnd); - ok( GetFocus() == hwnd, "Failed to set focus to invisible window %p\n", hwnd ); - ok( !(GetWindowLong(hwnd,GWL_STYLE) & WS_VISIBLE), "Window %p still visible\n", hwnd ); - child = CreateWindowExA(0, "static", NULL, WS_CHILD, 0, 0, 0, 0, hwnd, 0, 0, NULL); - assert(child); - SetFocus(child); - ok( GetFocus() == child, "Failed to set focus to invisible child %p\n", child ); - ok( !(GetWindowLong(child,GWL_STYLE) & WS_VISIBLE), "Child %p is visible\n", child ); - ShowWindow(child, SW_SHOW); - ok( GetWindowLong(child,GWL_STYLE) & WS_VISIBLE, "Child %p is not visible\n", child ); - ok( GetFocus() == child, "Focus no longer on child %p\n", child ); - ShowWindow(child, SW_HIDE); - ok( !(GetWindowLong(child,GWL_STYLE) & WS_VISIBLE), "Child %p is visible\n", child ); - ok( GetFocus() == hwnd, "Focus should be on parent %p, not %p\n", hwnd, GetFocus() ); - ShowWindow(child, SW_SHOW); - SetFocus(child); - ok( GetFocus() == child, "Focus should be on child %p\n", child ); - SetWindowPos(child,0,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_HIDEWINDOW); - ok( GetFocus() == child, "Focus should still be on child %p\n", child ); - - ShowWindow(child, SW_HIDE); - SetFocus(hwnd); - ok( GetFocus() == hwnd, "Focus should be on parent %p, not %p\n", hwnd, GetFocus() ); - SetWindowPos(child,0,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); - ok( GetFocus() == hwnd, "Focus should still be on parent %p, not %p\n", hwnd, GetFocus() ); - ShowWindow(child, SW_HIDE); - ok( GetFocus() == hwnd, "Focus should still be on parent %p, not %p\n", hwnd, GetFocus() ); - - DestroyWindow( child ); -} - -static void test_SetActiveWindow(HWND hwnd) -{ - HWND hwnd2; - - ShowWindow(hwnd, SW_SHOW); - SetActiveWindow(0); - SetActiveWindow(hwnd); - ok( GetActiveWindow() == hwnd, "Failed to set focus to visible window %p\n", hwnd ); - SetWindowPos(hwnd,0,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_HIDEWINDOW); - ok( GetActiveWindow() == hwnd, "Window %p no longer active\n", hwnd ); - SetWindowPos(hwnd,0,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_SHOWWINDOW); - ShowWindow(hwnd, SW_HIDE); - ok( GetActiveWindow() != hwnd, "Window %p is still active\n", hwnd ); - ShowWindow(hwnd, SW_SHOW); - - hwnd2 = CreateWindowExA(0, "static", NULL, WS_POPUP|WS_VISIBLE, 0, 0, 0, 0, hwnd, 0, 0, NULL); - ok( GetActiveWindow() == hwnd2, "Window %p is not active\n", hwnd2 ); - DestroyWindow(hwnd2); - ok( GetActiveWindow() != hwnd2, "Window %p is still active\n", hwnd2 ); - - hwnd2 = CreateWindowExA(0, "static", NULL, WS_POPUP|WS_VISIBLE, 0, 0, 0, 0, hwnd, 0, 0, NULL); - ok( GetActiveWindow() == hwnd2, "Window %p is not active\n", hwnd2 ); - SetWindowPos(hwnd2,0,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_HIDEWINDOW); - ok( GetActiveWindow() == hwnd2, "Window %p no longer active (%p)\n", hwnd2, GetActiveWindow() ); - DestroyWindow(hwnd2); - ok( GetActiveWindow() != hwnd2, "Window %p is still active\n", hwnd2 ); -} - -START_TEST(win) -{ - pGetAncestor = (void *)GetProcAddress( GetModuleHandleA("user32.dll"), "GetAncestor" ); - pGetWindowInfo = (void *)GetProcAddress( GetModuleHandleA("user32.dll"), "GetWindowInfo" ); - - hwndMain = CreateWindowExA(0, "static", NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, 0, NULL); - if (hwndMain) - { - ok(!GetParent(hwndMain), "GetParent should return 0 for message only windows\n"); - if (pGetAncestor) - { - hwndMessage = pGetAncestor(hwndMain, GA_PARENT); - ok(hwndMessage != 0, "GetAncestor(GA_PARENT) should not return 0 for message only windows\n"); - trace("hwndMessage %p\n", hwndMessage); - } - DestroyWindow(hwndMain); - } - else - trace("CreateWindowExA with parent HWND_MESSAGE failed\n"); - - if (!RegisterWindowClasses()) assert(0); - - hhook = SetWindowsHookExA(WH_CBT, cbt_hook_proc, 0, GetCurrentThreadId()); - assert(hhook); - - hwndMain = CreateWindowExA(/*WS_EX_TOOLWINDOW*/ 0, "MainWindowClass", "Main window", - WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | - WS_MAXIMIZEBOX | WS_POPUP, - 100, 100, 200, 200, - 0, 0, 0, NULL); - hwndMain2 = CreateWindowExA(/*WS_EX_TOOLWINDOW*/ 0, "MainWindowClass", "Main window 2", - WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | - WS_MAXIMIZEBOX | WS_POPUP, - 100, 100, 200, 200, - 0, 0, 0, NULL); - assert( hwndMain ); - assert( hwndMain2 ); - - test_parent_owner(); - test_shell_window(); - - test_mdi(); - test_icons(); - test_SetWindowPos(hwndMain); - test_SetMenu(hwndMain); - test_SetFocus(hwndMain); - test_SetActiveWindow(hwndMain); - - test_children_zorder(hwndMain); - - UnhookWindowsHookEx(hhook); -} diff --git a/reactos/apps/tests/user32/wsprintf.c b/reactos/apps/tests/user32/wsprintf.c deleted file mode 100644 index bbebdd75f9d..00000000000 --- a/reactos/apps/tests/user32/wsprintf.c +++ /dev/null @@ -1,57 +0,0 @@ - /* Unit test suite for the wsprintf functions - * - * Copyright 2002 Bill Medland - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -#include "wine/test.h" -#include "windef.h" -#include "winbase.h" -#include "winuser.h" - -static void wsprintfATest(void) -{ - char buf[25]; - int rc; - - rc=wsprintfA(buf, "%010ld", -1); - ok(rc == 10, "wsPrintfA length failure: rc=%d error=%ld\n",rc,GetLastError()); - ok((lstrcmpA(buf, "-000000001") == 0), - "wsprintfA zero padded negative value failure: buf=[%s]\n",buf); -} - -static void wsprintfWTest(void) -{ - static const WCHAR fmt[] = {'%','0','1','0','l','d','\0'}; - static const WCHAR target[] = {'-','0','0','0','0','0','0','0','0','1', '\0'}; - WCHAR buf[25]; - int rc; - - rc=wsprintfW(buf, fmt, -1); - if (rc==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) - return; - ok(rc == 10, "wsPrintfW length failure: rc=%d error=%ld\n",rc,GetLastError()); - ok((lstrcmpW(buf, target) == 0), - "wsprintfW zero padded negative value failure\n"); -} - -START_TEST(wsprintf) -{ - wsprintfATest(); - wsprintfWTest(); -} diff --git a/reactos/apps/tests/vmtest/.cvsignore b/reactos/apps/tests/vmtest/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/vmtest/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/vmtest/Makefile b/reactos/apps/tests/vmtest/Makefile deleted file mode 100644 index bf2951385ad..00000000000 --- a/reactos/apps/tests/vmtest/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $Id: Makefile,v 1.7 2003/11/14 17:13:22 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = vmtest - -TARGET_SDKLIBS = ntdll.a kernel32.a - -TARGET_OBJECTS = $(TARGET_NAME).o - -TARGET_CFLAGS = -Wall -Werror - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/vmtest/vmtest.c b/reactos/apps/tests/vmtest/vmtest.c deleted file mode 100644 index ec7235ce06d..00000000000 --- a/reactos/apps/tests/vmtest/vmtest.c +++ /dev/null @@ -1,55 +0,0 @@ -#include -#include - -int main() -{ - PVOID Base; - PVOID Ret; - - Base = VirtualAlloc(NULL, - 1048576, - MEM_RESERVE, - PAGE_READWRITE); - if (Base == NULL) - { - printf("VirtualAlloc failed 1\n"); - } - - Ret = VirtualAlloc(Base + 4096, - 4096, - MEM_COMMIT, - PAGE_READWRITE); - if (Ret == NULL) - { - printf("VirtualAlloc failed 2\n"); - } - - Ret = VirtualAlloc(Base + 12288, - 4096, - MEM_COMMIT, - PAGE_READWRITE); - if (Ret == NULL) - { - printf("VirtualAlloc failed 3\n"); - } - - Ret = VirtualAlloc(Base + 20480, - 4096, - MEM_COMMIT, - PAGE_READWRITE); - if (Ret == NULL) - { - printf("VirtualAlloc failed 4\n"); - } - - Ret = VirtualAlloc(Base + 4096, - 28672, - MEM_RESERVE, - PAGE_READWRITE); - if (Ret == NULL) - { - printf("VirtualAlloc failed 5\n"); - } - return 0; -} - diff --git a/reactos/apps/tests/winhello/.cvsignore b/reactos/apps/tests/winhello/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/winhello/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/winhello/makefile b/reactos/apps/tests/winhello/makefile deleted file mode 100644 index f2dec186bc2..00000000000 --- a/reactos/apps/tests/winhello/makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $Id: makefile,v 1.5 2003/11/14 17:13:22 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = winhello - -TARGET_SDKLIBS = kernel32.a gdi32.a ntdll.a - -TARGET_OBJECTS = $(TARGET_NAME).o - -TARGET_CFLAGS = -Wall -Werror - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/winhello/winhello.c b/reactos/apps/tests/winhello/winhello.c deleted file mode 100644 index e55df9d5446..00000000000 --- a/reactos/apps/tests/winhello/winhello.c +++ /dev/null @@ -1,703 +0,0 @@ -/* - * ReactOS Winhello - Not So Simple Win32 Windowing test - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* What do we test with this app? - * - Windows and Class creation - * - A Simple Button - * - Some font rendering in the Window - * - Scrollbar support - * - Hotkeys - * - Messageboxes - * ???????? - */ - -#include -#include -#include - -HFONT tf; -LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM); -BOOLEAN bolWM_CHAR; -BOOLEAN bolWM_KEYDOWN; - -int WINAPI -WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpszCmdLine, - int nCmdShow) -{ - WNDCLASS wc; - MSG msg; - HWND hWnd; - bolWM_CHAR = 0; - bolWM_KEYDOWN = 0; - - wc.lpszClassName = "HelloClass"; - wc.lpfnWndProc = MainWndProc; - wc.style = CS_VREDRAW | CS_HREDRAW; - wc.hInstance = hInstance; - wc.hIcon = LoadIcon(NULL, (LPCTSTR)IDI_APPLICATION); - wc.hCursor = LoadCursor(NULL, (LPCTSTR)IDC_ARROW); - wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH); - wc.lpszMenuName = NULL; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - if (RegisterClass(&wc) == 0) - { - fprintf(stderr, "RegisterClass failed (last error 0x%lX)\n", - GetLastError()); - return(1); - } - - hWnd = CreateWindow("HelloClass", - "Hello World", - WS_OVERLAPPEDWINDOW|WS_HSCROLL|WS_VSCROLL, - 0, //Position; you can use CW_USEDEFAULT, too - 0, - 600, //height - 400, - NULL, - NULL, - hInstance, - NULL); - if (hWnd == NULL) - { - fprintf(stderr, "CreateWindow failed (last error 0x%lX)\n", - GetLastError()); - return(1); - } - - tf = CreateFontA(14, 0, 0, TA_BASELINE, FW_NORMAL, FALSE, FALSE, FALSE, - ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, - DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, "Timmons"); - - ShowWindow(hWnd, nCmdShow); - - while(GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - DeleteObject(tf); - - return msg.wParam; -} - -#define CTRLC 1 /* Define our HotKeys */ -#define ALTF1 2 /* Define our HotKeys */ - -LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - PAINTSTRUCT ps; /* Also used during window drawing */ - HDC hDC; /* A device context used for drawing */ - RECT rc, clr, wir; /* A rectangle used during drawing */ - char spr[100], sir[100]; - static HBRUSH hbrWhite=NULL, hbrGray=NULL, hbrBlack=NULL, hbrRed=NULL, hbrBlue=NULL, hbrYellow=NULL; - - /* The window handle for the "Click Me" button. */ - static HWND hwndButton = 0; - static int cx, cy; /* Height and width of our button. */ - - switch(msg) - { - - case WM_CHAR: - { - - hDC = GetDC(hWnd); - TCHAR text[2]; - text[0] = (TCHAR)wParam; - text[1] = _T('\0'); - - //Write in window - if( bolWM_KEYDOWN ) - { - TextOut(hDC, 400, 10, "WM CHAR:", strlen("WM CHAR:")); - bolWM_KEYDOWN = 0; - } - else - { - TextOut(hDC, 400, 10, "WM_CHAR:", strlen("WM_CHAR:")); - bolWM_KEYDOWN = 1; - } - TextOut(hDC, 530, 10, text, strlen(text)); - -#if 0 - // Make a line depending on the typed key - Rect.left = 10; - Rect.top = 75; - Rect.right = 610; - Rect.bottom = 85; - FillRect(hDC, &Rect, hbrWhite); - - Rect.left=308; - Rect.right=312; - FillRect(hDC, &Rect, hbrRed); - - Rect.left = 310; - Rect.top = 75; - Rect.right = 310 +text[0]*2; - Rect.bottom = 85; - HBRUSH hbrCustom = CreateSolidBrush ( RGB(text[0], text[0], text[0])); - FillRect(hDC, &Rect, hbrCustom); - DeleteObject ( hbrCustom ); - -#endif - - ReleaseDC(hWnd, hDC); - return 0; - } - - case WM_KEYDOWN: - { - - hDC = GetDC(hWnd); - RECT Rect; - TCHAR text[2]; - text[0] = (TCHAR)wParam; - text[1] = _T('\0'); - - - /* Write in window */ - Rect.left = 400; - Rect.top = 50; - Rect.right = 550; - Rect.bottom = 70; - FillRect(hDC, &Rect, hbrWhite); - if( bolWM_CHAR ) - { - TextOut(hDC, 400, 30, "WM KEYDOWN:", strlen("WM KEYDOWN:")); - bolWM_CHAR = 0; - } - else - { - TextOut(hDC, 400, 30, "WM_KEYDOWN:", strlen("WM_KEYDOWN:")); - bolWM_CHAR = 1; - } - TextOut(hDC, 530, 30, text, strlen(text)); - ReleaseDC(hWnd, hDC); - return 0; - } - - case WM_KEYUP: - { - - hDC = GetDC(hWnd); - RECT Rect; - TCHAR text[2]; - text[0] = (TCHAR)wParam; - text[1] = _T('\0'); - - - /* Write in window */ - Rect.left = 400; - Rect.top = 10; - Rect.right = 550; - Rect.bottom = 70; - FillRect(hDC, &Rect, hbrWhite); - TextOut(hDC, 400, 50, "WM_KEYUP:", strlen("WM_KEYUP:")); - TextOut(hDC, 530, 50, text, strlen(text)); - ReleaseDC(hWnd, hDC); - return 0; - } - - - case WM_LBUTTONDOWN: - { - ULONG x, y; - RECT Rect; - hDC = GetDC(hWnd); - x = LOWORD(lParam); - y = HIWORD(lParam); - - Rect.left = x - 5; - Rect.top = y - 5; - Rect.right = x + 5; - Rect.bottom = y + 5; - FillRect(hDC, &Rect, hbrRed); - - Rect.left = x - 3; - Rect.top = y - 3; - Rect.right = x + 3; - Rect.bottom = y + 3; - FillRect(hDC, &Rect, hbrBlack); - - ReleaseDC(hWnd, hDC); - break; - } - case WM_LBUTTONUP: - { - ULONG x, y; - RECT Rect; - hDC = GetDC(hWnd); - x = LOWORD(lParam); - y = HIWORD(lParam); - - Rect.left = x - 5; - Rect.top = y - 5; - Rect.right = x + 5; - Rect.bottom = y + 5; - FillRect(hDC, &Rect, hbrRed); - - Rect.left = x - 3; - Rect.top = y - 3; - Rect.right = x + 3; - Rect.bottom = y + 3; - FillRect(hDC, &Rect, hbrGray); - - ReleaseDC(hWnd, hDC); - break; - } - case WM_MBUTTONDOWN: - { - ULONG x, y; - RECT Rect; - hDC = GetDC(hWnd); - x = LOWORD(lParam); - y = HIWORD(lParam); - - Rect.left = x - 5; - Rect.top = y - 5; - Rect.right = x + 5; - Rect.bottom = y + 5; - FillRect(hDC, &Rect, hbrBlue); - - Rect.left = x - 3; - Rect.top = y - 3; - Rect.right = x + 3; - Rect.bottom = y + 3; - FillRect(hDC, &Rect, hbrBlack); - - ReleaseDC(hWnd, hDC); - break; - } - case WM_MBUTTONUP: - { - ULONG x, y; - RECT Rect; - hDC = GetDC(hWnd); - x = LOWORD(lParam); - y = HIWORD(lParam); - - Rect.left = x - 5; - Rect.top = y - 5; - Rect.right = x + 5; - Rect.bottom = y + 5; - FillRect(hDC, &Rect, hbrBlue); - - Rect.left = x - 3; - Rect.top = y - 3; - Rect.right = x + 3; - Rect.bottom = y + 3; - FillRect(hDC, &Rect, hbrGray); - - ReleaseDC(hWnd, hDC); - break; - } - case WM_RBUTTONDOWN: - { - ULONG x, y; - RECT Rect; - hDC = GetDC(hWnd); - x = LOWORD(lParam); - y = HIWORD(lParam); - - Rect.left = x - 5; - Rect.top = y - 5; - Rect.right = x + 5; - Rect.bottom = y + 5; - FillRect(hDC, &Rect, hbrYellow); - - Rect.left = x - 3; - Rect.top = y - 3; - Rect.right = x + 3; - Rect.bottom = y + 3; - FillRect(hDC, &Rect, hbrBlack); - - ReleaseDC(hWnd, hDC); - break; - } - case WM_RBUTTONUP: - { - ULONG x, y; - RECT Rect; - hDC = GetDC(hWnd); - x = LOWORD(lParam); - y = HIWORD(lParam); - - Rect.left = x - 5; - Rect.top = y - 5; - Rect.right = x + 5; - Rect.bottom = y + 5; - FillRect(hDC, &Rect, hbrYellow); - - Rect.left = x - 3; - Rect.top = y - 3; - Rect.right = x + 3; - Rect.bottom = y + 3; - FillRect(hDC, &Rect, hbrGray); - - ReleaseDC(hWnd, hDC); - break; - } - - case WM_MOUSEMOVE: - { - int fwKeys; - int x; - int y; - RECT Rect; - int temp; - TCHAR text[256]; - - hDC = GetDC(hWnd); - fwKeys = wParam; // key flags - x = LOWORD(lParam); // horizontal position of cursor - y = HIWORD(lParam); // vertical position of cursor - - Rect.left = 10; - Rect.top = 100; - Rect.right = 160; - Rect.bottom = 300; - FillRect(hDC, &Rect, hbrWhite); - - temp = _sntprintf ( text, sizeof(text)/sizeof(*text), _T("x: %d"), x ); - TextOut(hDC,10,100,text,strlen(text)); - temp = _sntprintf ( text, sizeof(text)/sizeof(*text), _T("y: %d"), y ); - TextOut(hDC,10,120,text,strlen(text)); - - Rect.left = x - 2; - Rect.top = y - 2; - Rect.right = x + 2; - Rect.bottom = y + 2; - - switch ( fwKeys ) - { - case MK_CONTROL: - TextOut(hDC,10,140,"Control",strlen("Control")); - break; - case MK_SHIFT: - TextOut(hDC,10,160,"Shift",strlen("Shift")); - break; - case MK_LBUTTON: - TextOut(hDC,10,180,"Left",strlen("Left")); - FillRect(hDC, &Rect, hbrRed); - break; - case MK_MBUTTON: - TextOut(hDC,10,200,"Middle",strlen("Middle")); - FillRect(hDC, &Rect, hbrBlue); - break; - case MK_RBUTTON: - TextOut(hDC,10,220,"Right",strlen("Right")); - FillRect(hDC, &Rect, hbrYellow); - break; - } - ReleaseDC(hWnd, hDC); - break; - } - - case WM_HSCROLL: - { - int nPos; - int temp; - RECT Rect; - int nScrollCode; - HWND hwndScrollBar; - TCHAR text[256]; - SCROLLINFO Scrollparameter; - nScrollCode = (int) LOWORD(wParam); // scroll bar value - nPos = (short int) HIWORD(wParam); // scroll box position - hwndScrollBar = (HWND) lParam; // handle to scroll bar - hDC = GetDC(hWnd); - - Scrollparameter.cbSize = sizeof(Scrollparameter); - Scrollparameter.fMask = SIF_ALL; - GetScrollInfo ( hWnd, SB_HORZ, &Scrollparameter ); - - Rect.left = 200; - Rect.top = 100; - Rect.right = 350; - Rect.bottom = 300; - FillRect(hDC, &Rect, hbrWhite); - - switch ( nScrollCode ) - { - case SB_ENDSCROLL: //Ends scroll. - TextOut(hDC,200,120,"SB_ENDSCROLL ",16); - Scrollparameter.nPos = Scrollparameter.nPos; - break; - case SB_LEFT: //Scrolls to the upper left. - TextOut(hDC,200,140,"SB_LEFT ",16); - Scrollparameter.nPos = Scrollparameter.nMin; - break; - case SB_RIGHT: //Scrolls to the lower right. - TextOut(hDC,200,160,"SB_RIGHT ",16); - Scrollparameter.nPos = Scrollparameter.nMax; - break; - case SB_LINELEFT: //Scrolls left by one unit. - TextOut(hDC,200,180,"SB_LINELEFT ",16); - Scrollparameter.nPos--; - break; - case SB_LINERIGHT: //Scrolls right by one unit. - TextOut(hDC,200,200,"SB_LINERIGHT ",16); - Scrollparameter.nPos++; - break; - case SB_PAGELEFT: //Scrolls left by the width of the window. - TextOut(hDC,200,220,"SB_PAGELEFT ",16); - Scrollparameter.nPos -= Scrollparameter.nPage; - break; - case SB_PAGERIGHT: //Scrolls right by the width of the window. - TextOut(hDC,200,240,"PAGERIGHT ",16); - Scrollparameter.nPos += Scrollparameter.nPage; - break; - case SB_THUMBPOSITION: //The user has dragged the scroll box (thumb) and released the mouse button. The nPos parameter indicates the position of the scroll box at the end of the drag operation. - TextOut(hDC,200,260,"SB_THUMBPOSITION",16); - Scrollparameter.nPos = Scrollparameter.nTrackPos; - break; - case SB_THUMBTRACK: // - TextOut(hDC,200,280,"SB_THUMBTRACK ",16); - Scrollparameter.nPos = Scrollparameter.nTrackPos; - break; - } - - SetScrollInfo( - hWnd, // handle to window with scroll bar - SB_HORZ, // scroll bar flag - &Scrollparameter, // pointer to structure with scroll parameters - 1 // redraw flag - ); - temp = _sntprintf ( text, sizeof(text)/sizeof(*text), _T("Horizontal: %d"), Scrollparameter.nPos ); - TextOut(hDC,200,100,text,strlen(text)); - ReleaseDC(hWnd, hDC); - return 0; - } - - case WM_VSCROLL: - { - int nPos; - int temp; - RECT Rect; - int nScrollCode; - HWND hwndScrollBar; - TCHAR text[256]; - SCROLLINFO Scrollparameter; - nScrollCode = (int) LOWORD(wParam); // scroll bar value - nPos = (short int) HIWORD(wParam); // scroll box position - hwndScrollBar = (HWND) lParam; // handle to scroll bar - hDC = GetDC(hWnd); - - Scrollparameter.cbSize = sizeof(Scrollparameter); - Scrollparameter.fMask = SIF_ALL; - GetScrollInfo ( hWnd, SB_VERT, &Scrollparameter ); - - Rect.left = 400; - Rect.top = 100; - Rect.right = 550; - Rect.bottom = 300; - FillRect(hDC, &Rect, hbrWhite); - - switch ( nScrollCode ) - { - case SB_ENDSCROLL: //Ends scroll. - TextOut(hDC,400,120,"SB_ENDSCROLL ",16); - Scrollparameter.nPos = Scrollparameter.nPos; - break; - case SB_LEFT: //Scrolls to the upper left. - TextOut(hDC,400,140,"SB_LEFT ",16); - Scrollparameter.nPos = Scrollparameter.nMin; - break; - case SB_RIGHT: //Scrolls to the lower right. - TextOut(hDC,400,160,"SB_RIGHT ",16); - Scrollparameter.nPos = Scrollparameter.nMax; - break; - case SB_LINELEFT: //Scrolls left by one unit. - TextOut(hDC,400,180,"SB_LINELEFT ",16); - Scrollparameter.nPos--; - break; - case SB_LINERIGHT: //Scrolls right by one unit. - TextOut(hDC,400,200,"SB_LINERIGHT ",16); - Scrollparameter.nPos++; - break; - case SB_PAGELEFT: //Scrolls left by the width of the window. - TextOut(hDC,400,220,"SB_PAGELEFT ",16); - Scrollparameter.nPos -= Scrollparameter.nPage; - break; - case SB_PAGERIGHT: //Scrolls right by the width of the window. - TextOut(hDC,400,240,"PAGERIGHT ",16); - Scrollparameter.nPos += Scrollparameter.nPage; - break; - case SB_THUMBPOSITION: //The user has dragged the scroll box (thumb) and released the mouse button. The nPos parameter indicates the position of the scroll box at the end of the drag operation. - TextOut(hDC,400,260,"SB_THUMBPOSITION",16); - Scrollparameter.nPos = Scrollparameter.nTrackPos; - break; - case SB_THUMBTRACK: // - TextOut(hDC,400,280,"SB_THUMBTRACK ",16); - Scrollparameter.nPos = Scrollparameter.nTrackPos; - break; - } - - SetScrollInfo( - hWnd, // handle to window with scroll bar - SB_VERT, // scroll bar flag - &Scrollparameter, // pointer to structure with scroll parameters - 1 // redraw flag - ); - temp = _sntprintf ( text, sizeof(text)/sizeof(*text), _T("Vertical: %d"), Scrollparameter.nPos ); - TextOut(hDC,400,100,text,strlen(text)); - ReleaseDC(hWnd, hDC); - return 0; - } - - case WM_HOTKEY: - switch(wParam) - { - case CTRLC: - MessageBox(hWnd, "You just pressed Ctrl+C", "Hotkey", MB_OK | MB_ICONINFORMATION); - break; - case ALTF1: - MessageBox(hWnd, "You just pressed Ctrl+Alt+F1", "Hotkey", MB_OK | MB_ICONINFORMATION); - break; - } - break; - - case WM_DESTROY: - UnregisterHotKey(hWnd, CTRLC); - UnregisterHotKey(hWnd, ALTF1); - PostQuitMessage(0); - DeleteObject ( hbrWhite ); - DeleteObject ( hbrGray ); - DeleteObject ( hbrBlack ); - DeleteObject ( hbrRed ); - DeleteObject ( hbrBlue ); - DeleteObject ( hbrYellow ); - break; - - case WM_CREATE: - { - /* Register a Ctrl+Alt+C hotkey*/ - RegisterHotKey(hWnd, CTRLC, MOD_CONTROL, VK_C); - RegisterHotKey(hWnd, ALTF1, MOD_CONTROL | MOD_ALT, VK_F1); - - hbrWhite = CreateSolidBrush ( RGB(0xFF, 0xFF, 0xFF)); - hbrGray = CreateSolidBrush ( RGB(0xAF, 0xAF, 0xAF)); - hbrBlack = CreateSolidBrush ( RGB(0x00, 0x00, 0x00)); - hbrRed = CreateSolidBrush ( RGB(0xFF, 0x00, 0x00)); - hbrBlue = CreateSolidBrush ( RGB(0x00, 0x00, 0xFF)); - hbrYellow = CreateSolidBrush ( RGB(0xFF, 0xFF, 0x00)); - - SCROLLINFO si; - si.cbSize = sizeof(si); - si.fMask = SIF_ALL; - si.nMin = 0; - si.nMax = 100; - si.nPage = 5; - si.nPos = 0; - - SetScrollInfo ( hWnd, SB_HORZ, &si, FALSE ); - SetScrollInfo ( hWnd, SB_VERT, &si, FALSE ); - - - /* The window is being created. Create our button - * window now. */ - TEXTMETRIC tm; - - /* First we use the system fixed font size to choose - * a nice button size. */ - hDC = GetDC (hWnd); - SelectObject (hDC, GetStockObject (SYSTEM_FIXED_FONT)); - GetTextMetrics (hDC, &tm); - cx = tm.tmAveCharWidth * 30; - cy = (tm.tmHeight + tm.tmExternalLeading) * 2; - ReleaseDC (hWnd, hDC); - - /* Now create the button */ - hwndButton = CreateWindow ( - "button", /* Builtin button class */ - "Click Here", - WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, - 0, 0, cx, cy, - hWnd, /* Parent is this window. */ - (HMENU) 1, /* Control ID: 1 */ - ((LPCREATESTRUCT) lParam)->hInstance, - NULL - ); - - return 0; - break; - } - - case WM_PAINT: - hDC = BeginPaint(hWnd, &ps); - TextOut(hDC, 10, 10, "Hello World from ReactOS!", - strlen("Hello World from ReactOS!")); - TextOut(hDC, 10, 80, "Press Ctrl+C or Ctrl+Alt+F1 to test Hotkey support.", - strlen("Press Ctrl+C or Ctrl+Alt+F1 to test Hotkey support.")); - GetClientRect(hWnd, &clr); - GetWindowRect(hWnd, &wir); - sprintf(spr, "%lu,%lu,%lu,%lu ", clr.left, clr.top, clr.right, clr.bottom); - sprintf(sir, "%lu,%lu,%lu,%lu ", wir.left, wir.top, wir.right, wir.bottom); - TextOut(hDC, 10, 30, spr, 20); - TextOut(hDC, 10, 50, sir, 20); - - /* Draw "Hello, World" in the middle of the upper - * half of the window. */ - rc.bottom = rc.bottom / 2; - DrawText (hDC, "Hello, World", -1, &rc, - DT_SINGLELINE | DT_CENTER | DT_VCENTER); - - EndPaint (hWnd, &ps); - return 0; - break; - - case WM_SIZE: - /* The window size is changing. If the button exists - * then place it in the center of the bottom half of - * the window. */ - if (hwndButton && - (wParam == SIZEFULLSCREEN || - wParam == SIZENORMAL) - ) - { - rc.left = (LOWORD(lParam) - cx) / 2; - rc.top = HIWORD(lParam) * 3 / 4 - cy / 2; - MoveWindow ( - hwndButton, - rc.left, rc.top, cx, cy, TRUE); - } - break; - - case WM_COMMAND: - /* Check the control ID, notification code and - * control handle to see if this is a button click - * message from our child button. */ - if (LOWORD(wParam) == 1 && - HIWORD(wParam) == BN_CLICKED && - (HWND) lParam == hwndButton) - { - /* Our button was clicked. Close the window. */ - DestroyWindow (hWnd); - } - return 0; - break; - - default: - return DefWindowProc(hWnd, msg, wParam, lParam); - } - return 0; -} diff --git a/reactos/apps/tests/wm_erasebkgnd/.cvsignore b/reactos/apps/tests/wm_erasebkgnd/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/wm_erasebkgnd/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/wm_erasebkgnd/BACKBITMAP.BMP b/reactos/apps/tests/wm_erasebkgnd/BACKBITMAP.BMP deleted file mode 100644 index 38bc9716b64..00000000000 Binary files a/reactos/apps/tests/wm_erasebkgnd/BACKBITMAP.BMP and /dev/null differ diff --git a/reactos/apps/tests/wm_erasebkgnd/makefile b/reactos/apps/tests/wm_erasebkgnd/makefile deleted file mode 100644 index 866a14a95e0..00000000000 --- a/reactos/apps/tests/wm_erasebkgnd/makefile +++ /dev/null @@ -1,31 +0,0 @@ - -PATH_TO_TOP = ../../.. - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = wm_erasebkgnd - -TARGET_NORC = yes - -TARGET_CFLAGS = -fexceptions -g -O0 -DWIN32 -D_DEBUG -D_WINDOWS -D_MBCS -W -D__USE_W32API -Wall -Werror - -TARGET_CPPFLAGS = -fexceptions -g -O0 -DWIN32 -D_DEBUG -D_WINDOWS -D_MBCS -W -D__USE_W32API -Wall -Werror - -TARGET_SDKLIBS = \ - kernel32.a \ - user32.a \ - gdi32.a - -TARGET_OBJECTS = \ - wm_erasebkgnd.o - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# overide LD_CC to use g++ for linking of the executable -LD_CC = $(CXX) - -# EOF diff --git a/reactos/apps/tests/wm_erasebkgnd/wm_erasebkgnd.cpp b/reactos/apps/tests/wm_erasebkgnd/wm_erasebkgnd.cpp deleted file mode 100644 index 6bfa5a37749..00000000000 --- a/reactos/apps/tests/wm_erasebkgnd/wm_erasebkgnd.cpp +++ /dev/null @@ -1,179 +0,0 @@ - -// ------------------------------------------------------------------ -// Windows 2000 Graphics API Black Book -// Chapter 2 - CD-ROM (WM_ERASEBKGND Demo) -// -// Created by Damon Chandler -// Updates can be downloaded at: -// -// Please do not hesistate to e-mail me at dmc27@ee.cornell.edu -// if you have any questions about this code. -// ------------------------------------------------------------------ - -//*********************************************************// -// // -// SYNOPSIS: // -// This sample project demonstrates how to render // -// a background image in response to the WM_ERASEBKGND // -// message. It also shows how to create a transparent // -// static (text) control by handling the // -// WM_CTLCOLORSTATIC message. // -// // -//*********************************************************// - - -//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -#include -//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - - -HINSTANCE HInst; -HINSTANCE HPrevInst; -TCHAR *cmdline; -const char* WndClassName = "GMainWnd"; -LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam, - LPARAM LParam); - - -int APIENTRY WinMain(HINSTANCE HInstance, HINSTANCE HPrevInstance, - LPTSTR lpCmdLine, int nCmdShow) -{ - HInst = HInstance; - HPrevInst = HPrevInstance; - cmdline = lpCmdLine; - - WNDCLASS wc; - memset(&wc, 0, sizeof(WNDCLASS)); - - wc.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS; - wc.lpfnWndProc = MainWndProc; - wc.hInstance = HInstance; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.hbrBackground = - reinterpret_cast(COLOR_BTNFACE + 1); - wc.lpszClassName = WndClassName; - - if (RegisterClass(&wc)) - { - HWND HWnd = - CreateWindow(WndClassName, - TEXT("WM_ERASEBKGND Demo"), - WS_OVERLAPPEDWINDOW | WS_CAPTION | - WS_VISIBLE | WS_CLIPSIBLINGS, - CW_USEDEFAULT, CW_USEDEFAULT, 205, 85, - NULL, NULL, HInstance, NULL); - - if (HWnd) - { - ShowWindow(HWnd, nCmdShow); - UpdateWindow(HWnd); - - MSG msg; - while (GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } - } - return 0; -} -//------------------------------------------------------------------ - - -// static text and bitmap-related variables -HWND HStatic; -HDC HMemDC; -HBITMAP HBmp, HOldBmp; -const char* filename = "BACKBITMAP.BMP"; - -LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam, - LPARAM LParam) -{ - switch (Msg) - { - case WM_CREATE: - { - HStatic = - CreateWindow(TEXT("STATIC"), TEXT("Static Text"), - WS_CHILD | WS_VISIBLE | SS_CENTER, - 10, 20, 175, 30, - HWnd, NULL, HInst, NULL); - - // create a memory DC compatible with the screen - HMemDC = CreateCompatibleDC(NULL); - if (HMemDC) - { - // load a DDB from file - HBmp = static_cast( - LoadImage(HInst, filename, IMAGE_BITMAP, - 0, 0, LR_LOADFROMFILE) - ); - if (HBmp) - { - // associate the DDB with the memory DC - HOldBmp = static_cast( - SelectObject(HMemDC, HBmp) - ); - } - } - } - case WM_CTLCOLORSTATIC: - { - if (reinterpret_cast(LParam) == HStatic) - { - HDC HStaticDC = reinterpret_cast(WParam); - SetBkMode(HStaticDC, TRANSPARENT); - - return reinterpret_cast( - GetStockObject(NULL_BRUSH) - ); - } - break; - } - case WM_ERASEBKGND: - { - BITMAP bmp; - if (GetObject(HBmp, sizeof(BITMAP), &bmp)) - { - RECT RClient; - GetClientRect(HWnd, &RClient); - - HDC Hdc = reinterpret_cast(WParam); - SetStretchBltMode(Hdc, COLORONCOLOR); - - // - // TODO: add palette handling code for - // palettized displays (see Chapter 9)... - // - - // render the background image - StretchBlt(Hdc, 0, 0, - RClient.right - RClient.left, - RClient.bottom - RClient.top, - HMemDC, 0, 0, bmp.bmWidth, bmp.bmHeight, - SRCCOPY); - return TRUE; - } - break; - } - case WM_DESTROY: - { - if (HBmp) - { - // free the bitmap - DeleteObject(SelectObject(HMemDC, HOldBmp)); - } - // free the memory DC - DeleteDC(HMemDC); - - PostQuitMessage(0); - return 0; - } - } - return DefWindowProc(HWnd, Msg, WParam, LParam); -} -//------------------------------------------------------------------ - - - diff --git a/reactos/apps/tests/wm_paint/.cvsignore b/reactos/apps/tests/wm_paint/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/wm_paint/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/wm_paint/makefile b/reactos/apps/tests/wm_paint/makefile deleted file mode 100644 index 371c23e8965..00000000000 --- a/reactos/apps/tests/wm_paint/makefile +++ /dev/null @@ -1,22 +0,0 @@ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = wm_paint - -TARGET_SDKLIBS = kernel32.a gdi32.a - -TARGET_OBJECTS = $(TARGET_NAME).o - -TARGET_CFLAGS = -Wall -Werror - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/wm_paint/wm_paint.c b/reactos/apps/tests/wm_paint/wm_paint.c deleted file mode 100644 index 7da173e9208..00000000000 --- a/reactos/apps/tests/wm_paint/wm_paint.c +++ /dev/null @@ -1,131 +0,0 @@ - -// ------------------------------------------------------------------ -// Windows 2000 Graphics API Black Book -// Chapter 1 - Listing 1.1 (WM_PAINT Demo) -// -// Created by Damon Chandler -// Updates can be downloaded at: -// -// Please do not hesistate to e-mail me at dmc27@ee.cornell.edu -// if you have any questions about this code. -// ------------------------------------------------------------------ - - -//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -#include -#include -//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - - -const char* WndClassName = "GMainWnd"; -LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam, - LPARAM LParam); - - -int APIENTRY WinMain(HINSTANCE HInstance, HINSTANCE HPrevInstance, - LPTSTR lpCmdLine, int nCmdShow) -{ - MSG msg; - WNDCLASS wc; - memset(&wc, 0, sizeof(WNDCLASS)); - - wc.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS; - wc.lpfnWndProc = MainWndProc; - wc.hInstance = HInstance; - wc.hCursor = LoadCursor(NULL, (LPCTSTR)IDC_ARROW); - wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); - wc.lpszClassName = WndClassName; - - if (RegisterClass(&wc)) - { - HWND HWnd = - CreateWindow(WndClassName, TEXT("WM_PAINT Demo"), - WS_OVERLAPPEDWINDOW | WS_CAPTION | WS_VISIBLE, - CW_USEDEFAULT, CW_USEDEFAULT, 200, 150, - NULL, NULL, HInstance, NULL); - - if (HWnd) - { - ShowWindow(HWnd, nCmdShow); - UpdateWindow(HWnd); - - while (GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } - } - return 0; -} -//------------------------------------------------------------------ - - -LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam, - LPARAM LParam) -{ - const char* text = "Persistent Text"; - - switch (Msg) - { - case WM_PAINT: - { - // determine the invalidated area of the window - RECT RUpdate; - HDC Hdc; - GetUpdateRect(HWnd, &RUpdate, FALSE); - - // grab a handle to our window's - // common display device context - Hdc = GetDC(HWnd); -#if 0 - try -#endif - { - RECT RClient; - GetClientRect(HWnd, &RClient); - - // set the clipping region - IntersectClipRect(Hdc, RUpdate.left, RUpdate.top, - RUpdate.right, RUpdate.bottom); - - // fill the client area with the background brush - //HBRUSH HBrush = - //reinterpret_cast - (HBRUSH)(GetClassLong(HWnd, GCL_HBRBACKGROUND) - ); - FillRect(Hdc, &RClient, NULL); - - // render the persistent text - SetTextColor(Hdc, PALETTERGB(0, 0, 255)); - DrawText(Hdc, text, strlen(text), &RClient, - DT_CENTER | DT_VCENTER | DT_SINGLELINE); - } -#if 0 - catch (...) -#endif - { - // release the device context - ReleaseDC(HWnd, Hdc); - - // validate the update area - ValidateRect(HWnd, &RUpdate); - } - // release the device context - ReleaseDC(HWnd, Hdc); - - // validate the update area - ValidateRect(HWnd, &RUpdate); - - break; - } - case WM_DESTROY: - { - PostQuitMessage(0); - return 0; - } - } - return DefWindowProc(HWnd, Msg, WParam, LParam); -} -//------------------------------------------------------------------ - diff --git a/reactos/apps/tests/zwcontinue/.cvsignore b/reactos/apps/tests/zwcontinue/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/zwcontinue/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/zwcontinue/Makefile b/reactos/apps/tests/zwcontinue/Makefile deleted file mode 100644 index a99bb3da2dc..00000000000 --- a/reactos/apps/tests/zwcontinue/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $Id: Makefile,v 1.2 2004/07/01 23:58:44 royce Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = zwcontinue - -TARGET_OBJECTS = $(TARGET_NAME).o i386/$(TARGET_NAME).o - -TARGET_CFLAGS = -Wall -Werror -D__USE_W32API - -TARGET_SDKLIBS = ntdll.a - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/zwcontinue/i386/.cvsignore b/reactos/apps/tests/zwcontinue/i386/.cvsignore deleted file mode 100644 index 6142305dc12..00000000000 --- a/reactos/apps/tests/zwcontinue/i386/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -*.o -*.d diff --git a/reactos/apps/tests/zwcontinue/i386/zwcontinue.asm b/reactos/apps/tests/zwcontinue/i386/zwcontinue.asm deleted file mode 100644 index c8116412389..00000000000 --- a/reactos/apps/tests/zwcontinue/i386/zwcontinue.asm +++ /dev/null @@ -1,48 +0,0 @@ -cpu 486 -segment .text use32 - -extern _check - -global _continuePoint -_continuePoint: - push ss - push dword 0 - pushfd - push cs - push _continuePoint - push ebp - - push eax - push ecx - push edx - push ebx - push esi - push edi - - push ds - push es - push fs - push gs - - ; TODO: floating point state - sub esp, 70h - - ; Debug registers - sub esp, 18h - - push dword 00010007h - - ; Fill the Esp field - lea eax, [esp+0CCh] - lea ecx, [esp+0C4h] - mov [ecx], eax - - ; Call the function that will compare the current context with the expected one - cld - push esp - call _check - - ; check() must not return - int 3 - -; EOF diff --git a/reactos/apps/tests/zwcontinue/zwcontinue.c b/reactos/apps/tests/zwcontinue/zwcontinue.c deleted file mode 100644 index 637f0221c51..00000000000 --- a/reactos/apps/tests/zwcontinue/zwcontinue.c +++ /dev/null @@ -1,185 +0,0 @@ -#define WIN32_LEAN_AND_MEAN -#define STRICT -#include - -#include -#include -#include -#include -#include -#include -#include - -static unsigned int nRandBytes; - -static int initrand(void) -{ - unsigned int nRandMax; - unsigned int nRandMaxBits; - time_t tLoc; - - nRandMax = RAND_MAX; - - for(nRandMaxBits = 0; nRandMax != 0; nRandMax >>= 1, ++ nRandMaxBits); - - nRandBytes = nRandMaxBits / CHAR_BIT; - - assert(nRandBytes != 0); - - srand((unsigned)(time(&tLoc) & UINT_MAX)); - - return 1; -} - -static void randbytes(void * p, size_t n) -{ - unsigned char * b; - size_t i; - int r; - - b = (unsigned char *)p; - - for(i = 0; i < n; ++ i) - { - if(i % nRandBytes == 0) - r = rand(); - - b[i] = (unsigned char)(r & UCHAR_MAX); - r >>= CHAR_BIT; - } -} - -static ULONG randULONG(void) -{ - ULONG n; - randbytes(&n, sizeof(n)); - return n; -} - -#ifdef _M_IX86 -#define ZWC_SEGMENT_BITS (0xFFFF) -#define ZWC_EFLAGS_BITS (0x3C0CD5) -#endif - -static jmp_buf jmpbuf; -static CONTEXT continueContext; - -extern void continuePoint(void); -extern void check(CONTEXT *); -extern LONG NTAPI ZwContinue(IN CONTEXT *, IN BOOLEAN); - -void check(CONTEXT * actualContext) -{ -#ifdef _M_IX86 - assert(actualContext->ContextFlags == CONTEXT_FULL); - - /* Random data segments */ - assert - ( - (actualContext->SegGs & ZWC_SEGMENT_BITS) == - (continueContext.SegGs & ZWC_SEGMENT_BITS) - ); - - assert - ( - (actualContext->SegFs & ZWC_SEGMENT_BITS) == - (continueContext.SegFs & ZWC_SEGMENT_BITS) - ); - - assert - ( - (actualContext->SegEs & ZWC_SEGMENT_BITS) == - (continueContext.SegEs & ZWC_SEGMENT_BITS) - ); - - assert - ( - (actualContext->SegDs & ZWC_SEGMENT_BITS) == - (continueContext.SegDs & ZWC_SEGMENT_BITS) - ); - - /* Integer registers */ - assert(actualContext->Edi == continueContext.Edi); - assert(actualContext->Esi == continueContext.Esi); - assert(actualContext->Ebx == continueContext.Ebx); - printf("%s %lX : %lX\n", "Edx", actualContext->Edx, continueContext.Edx); - //assert(actualContext->Edx == continueContext.Edx); - assert(actualContext->Ecx == continueContext.Ecx); - assert(actualContext->Eax == continueContext.Eax); - - /* Control registers and segments */ - assert(actualContext->Ebp == continueContext.Ebp); - assert(actualContext->Eip == continueContext.Eip); - - assert - ( - (actualContext->SegCs & ZWC_SEGMENT_BITS) == - (continueContext.SegCs & ZWC_SEGMENT_BITS) - ); - - assert - ( - (actualContext->EFlags & ZWC_EFLAGS_BITS) == - (continueContext.EFlags & ZWC_EFLAGS_BITS) - ); - - assert(actualContext->Esp == continueContext.Esp); - - assert - ( - (actualContext->SegSs & ZWC_SEGMENT_BITS) == - (continueContext.SegSs & ZWC_SEGMENT_BITS) - ); -#endif - - longjmp(jmpbuf, 1); -} - -int main(void) -{ - initrand(); - - /* First time */ - if(setjmp(jmpbuf) == 0) - { - CONTEXT bogus; - - continueContext.ContextFlags = CONTEXT_FULL; - GetThreadContext(GetCurrentThread(), &continueContext); - -#ifdef _M_IX86 - continueContext.ContextFlags = CONTEXT_FULL; - - /* Fill the integer registers with random values */ - continueContext.Edi = randULONG(); - continueContext.Esi = randULONG(); - continueContext.Ebx = randULONG(); - continueContext.Edx = randULONG(); - continueContext.Ecx = randULONG(); - continueContext.Eax = randULONG(); - continueContext.Ebp = randULONG(); - - /* Randomize all the allowed flags (determined experimentally with WinDbg) */ - continueContext.EFlags = randULONG() & 0x3C0CD5; - - /* Randomize the stack pointer as much as possible */ - continueContext.Esp = - (ULONG)(((ULONG_PTR)&bogus) & 0xFFFFFFFF) + - sizeof(bogus) - - (randULONG() & 0xF) * 4; - - /* continuePoint() is implemented in assembler */ - continueContext.Eip = (ULONG)((ULONG_PTR)continuePoint & 0xFFFFFFF); - - /* Can't do a lot about segments */ -#endif - - ZwContinue(&continueContext, FALSE); - } - /* Second time */ - else - return 0; - - assert(0); - return 1; -}