From 24617fc41e6b69cb16ceef99ccabc8653a0768b4 Mon Sep 17 00:00:00 2001 From: Steven Edwards Date: Thu, 21 Oct 2004 11:58:12 +0000 Subject: [PATCH] Almost done removing old tests svn path=/trunk/; revision=11370 --- reactos/apps/tests/dnsquery/dnsquery.c | 28 - reactos/apps/tests/dnsquery/makefile | 22 - .../apps/tests/dump_shared_data/.cvsignore | 6 - .../tests/dump_shared_data/dump_shared_data.c | 52 - reactos/apps/tests/dump_shared_data/makefile | 22 - reactos/apps/tests/edit/.cvsignore | 6 - reactos/apps/tests/edit/edittest.c | 649 ------ reactos/apps/tests/edit/makefile | 24 - reactos/apps/tests/edit/utils.c | 33 - reactos/apps/tests/edit/utils.h | 9 - reactos/apps/tests/enhmetafile/.cvsignore | 6 - reactos/apps/tests/enhmetafile/enhmetafile.c | 123 - reactos/apps/tests/enhmetafile/makefile | 23 - reactos/apps/tests/enhmetafile/test.emf | Bin 120908 -> 0 bytes reactos/apps/tests/enumfonts/enumfonts.cpp | 271 --- reactos/apps/tests/enumfonts/makefile | 24 - reactos/apps/tests/enumwnd/.cvsignore | 6 - reactos/apps/tests/enumwnd/enumwnd.c | 187 -- reactos/apps/tests/enumwnd/enumwnd.dsp | 90 - reactos/apps/tests/enumwnd/makefile | 23 - reactos/apps/tests/enumws/.cvsignore | 6 - reactos/apps/tests/enumws/enumws.c | 35 - reactos/apps/tests/enumws/makefile | 21 - reactos/apps/tests/event/.cvsignore | 6 - reactos/apps/tests/event/event.c | 33 - reactos/apps/tests/event/makefile | 23 - reactos/apps/tests/eventpair/.cvsignore | 6 - reactos/apps/tests/eventpair/eventpair.c | 65 - reactos/apps/tests/eventpair/makefile | 23 - reactos/apps/tests/fiber/.cvsignore | 6 - reactos/apps/tests/fiber/Makefile | 21 - reactos/apps/tests/fiber/fiber.c | 446 ---- reactos/apps/tests/global_mem/.cvsignore | 6 - reactos/apps/tests/global_mem/Makefile | 21 - reactos/apps/tests/global_mem/global_mem.c | 1062 --------- reactos/apps/tests/gradient/.cvsignore | 6 - reactos/apps/tests/gradient/gradient.c | 181 -- reactos/apps/tests/gradient/makefile | 23 - reactos/apps/tests/guithreadinfo/.cvsignore | 6 - .../apps/tests/guithreadinfo/guithreadinfo.c | 132 -- reactos/apps/tests/guithreadinfo/makefile | 23 - reactos/apps/tests/hello/.cvsignore | 6 - reactos/apps/tests/hello/hello.c | 8 - reactos/apps/tests/hello/makefile | 21 - reactos/apps/tests/hivetest/.cvsignore | 6 - reactos/apps/tests/hivetest/hivetest.c | 1196 ---------- reactos/apps/tests/hivetest/makefile | 24 - reactos/apps/tests/icontest/.cvsignore | 6 - reactos/apps/tests/icontest/icon.ico | Bin 766 -> 0 bytes reactos/apps/tests/icontest/icontest.c | 216 -- reactos/apps/tests/icontest/icontest.rc | 5 - reactos/apps/tests/icontest/makefile | 21 - reactos/apps/tests/icontest/resource.h | 1 - reactos/apps/tests/iptest/iptest.cpp | 476 ---- reactos/apps/tests/iptest/makefile | 26 - reactos/apps/tests/isotest/.cvsignore | 6 - reactos/apps/tests/isotest/isotest.c | 230 -- reactos/apps/tests/isotest/makefile | 25 - reactos/apps/tests/kernel32/.cvsignore | 6 - reactos/apps/tests/kernel32/Makefile | 46 - reactos/apps/tests/kernel32/Makefile.in | 33 - reactos/apps/tests/kernel32/alloc.c | 408 ---- reactos/apps/tests/kernel32/atom.c | 191 -- reactos/apps/tests/kernel32/change.c | 237 -- reactos/apps/tests/kernel32/codepage.c | 62 - reactos/apps/tests/kernel32/comm.c | 640 ------ reactos/apps/tests/kernel32/console.c | 561 ----- reactos/apps/tests/kernel32/directory.c | 342 --- reactos/apps/tests/kernel32/drive.c | 183 -- reactos/apps/tests/kernel32/environ.c | 218 -- reactos/apps/tests/kernel32/file.c | 1199 ---------- reactos/apps/tests/kernel32/format_msg.c | 226 -- reactos/apps/tests/kernel32/generated.c | 1187 ---------- reactos/apps/tests/kernel32/heap.c | 89 - reactos/apps/tests/kernel32/locale.c | 2045 ----------------- reactos/apps/tests/kernel32/mailslot.c | 330 --- reactos/apps/tests/kernel32/path.c | 924 -------- reactos/apps/tests/kernel32/pipe.c | 763 ------ reactos/apps/tests/kernel32/process.c | 1202 ---------- reactos/apps/tests/kernel32/profile.c | 92 - reactos/apps/tests/kernel32/testlist.c | 66 - reactos/apps/tests/kernel32/thread.c | 572 ----- reactos/apps/tests/kernel32/time.c | 123 - reactos/apps/tests/kernel32/virtual.c | 113 - reactos/apps/tests/lan/lantest.cpp | 218 -- reactos/apps/tests/lan/makefile | 24 - reactos/apps/tests/shm/.cvsignore | 6 - reactos/apps/tests/shm/makefile | 54 - reactos/apps/tests/shm/shmclt.c | 61 - reactos/apps/tests/shm/shmsrv.c | 53 - reactos/apps/tests/statst/.cvsignore | 7 - reactos/apps/tests/statst/Makefile | 21 - reactos/apps/tests/statst/statst.c | 165 -- reactos/apps/tests/stretchblt/.cvsignore | 6 - reactos/apps/tests/stretchblt/lena.bmp | Bin 89322 -> 0 bytes reactos/apps/tests/stretchblt/makefile | 31 - reactos/apps/tests/stretchblt/stretchblt.cpp | 380 --- reactos/apps/tests/subclass/.cvsignore | 6 - reactos/apps/tests/subclass/makefile | 23 - reactos/apps/tests/subclass/subclass.c | 173 -- reactos/apps/tests/suspend/.cvsignore | 6 - reactos/apps/tests/suspend/Makefile | 21 - reactos/apps/tests/suspend/suspend.c | 74 - reactos/apps/tests/tcpsvr/.cvsignore | 6 - reactos/apps/tests/tcpsvr/makefile | 23 - reactos/apps/tests/tcpsvr/tcpsvr.c | 175 -- reactos/apps/tests/terminate/.cvsignore | 6 - reactos/apps/tests/terminate/Makefile | 21 - reactos/apps/tests/terminate/terminate.c | 76 - reactos/apps/tests/test_old/bug2.c | 11 - reactos/apps/tests/test_old/bug3.c | 53 - reactos/apps/tests/test_old/makefile | 68 - reactos/apps/tests/test_old/temptest.c | 27 - reactos/apps/tests/test_old/test-fseek.c | 85 - reactos/apps/tests/test_old/test-fwrite.c | 68 - reactos/apps/tests/test_old/test-stdio.c | 55 - reactos/apps/tests/test_old/test_rdwr.c | 129 -- reactos/apps/tests/test_old/testfsd.c | 315 --- reactos/apps/tests/test_old/testsuite.c | 65 - reactos/apps/tests/test_old/testsuite.h | 44 - reactos/apps/tests/test_old/time_t.c | 12 - reactos/apps/tests/test_old/tst-printf.c | 311 --- reactos/apps/tests/test_old/tstdiomisc.c | 56 - .../apps/tests/tests/GetSysMetrics/.cvsignore | 6 - .../tests/tests/GetSysMetrics/GetSysMetrics.c | 102 - .../apps/tests/tests/GetSysMetrics/Makefile | 22 - .../apps/tests/tests/GetSystemInfo/.cvsignore | 4 - .../tests/tests/GetSystemInfo/GetSystemInfo.c | 37 - .../apps/tests/tests/GetSystemInfo/Makefile | 26 - reactos/apps/tests/tests/Mutex/.cvsignore | 3 - reactos/apps/tests/tests/Mutex/Makefile | 26 - reactos/apps/tests/tests/Mutex/fivemutex.c | 124 - reactos/apps/tests/tests/Mutex/rapidmutex.c | 89 - .../apps/tests/tests/Parent_Child/.cvsignore | 4 - .../apps/tests/tests/Parent_Child/Makefile | 26 - .../tests/tests/Parent_Child/Parent_Child.c | 152 -- reactos/apps/tests/tests/guitest/.cvsignore | 4 - reactos/apps/tests/tests/guitest/Makefile | 31 - reactos/apps/tests/tests/guitest/guitest.c | 747 ------ reactos/apps/tests/tests/guitest/guitest.rc | 17 - reactos/apps/tests/tests/hello/.cvsignore | 4 - reactos/apps/tests/tests/hello/Makefile | 26 - reactos/apps/tests/tests/hello/hello.c | 84 - reactos/apps/tests/tests/new/.cvsignore | 4 - reactos/apps/tests/tests/new/Makefile | 26 - reactos/apps/tests/tests/new/new.c | 154 -- 146 files changed, 22539 deletions(-) delete mode 100644 reactos/apps/tests/dnsquery/dnsquery.c delete mode 100644 reactos/apps/tests/dnsquery/makefile delete mode 100644 reactos/apps/tests/dump_shared_data/.cvsignore delete mode 100644 reactos/apps/tests/dump_shared_data/dump_shared_data.c delete mode 100644 reactos/apps/tests/dump_shared_data/makefile delete mode 100644 reactos/apps/tests/edit/.cvsignore delete mode 100644 reactos/apps/tests/edit/edittest.c delete mode 100644 reactos/apps/tests/edit/makefile delete mode 100644 reactos/apps/tests/edit/utils.c delete mode 100644 reactos/apps/tests/edit/utils.h delete mode 100644 reactos/apps/tests/enhmetafile/.cvsignore delete mode 100644 reactos/apps/tests/enhmetafile/enhmetafile.c delete mode 100644 reactos/apps/tests/enhmetafile/makefile delete mode 100644 reactos/apps/tests/enhmetafile/test.emf delete mode 100755 reactos/apps/tests/enumfonts/enumfonts.cpp delete mode 100644 reactos/apps/tests/enumfonts/makefile delete mode 100644 reactos/apps/tests/enumwnd/.cvsignore delete mode 100644 reactos/apps/tests/enumwnd/enumwnd.c delete mode 100644 reactos/apps/tests/enumwnd/enumwnd.dsp delete mode 100644 reactos/apps/tests/enumwnd/makefile delete mode 100644 reactos/apps/tests/enumws/.cvsignore delete mode 100644 reactos/apps/tests/enumws/enumws.c delete mode 100644 reactos/apps/tests/enumws/makefile delete mode 100644 reactos/apps/tests/event/.cvsignore delete mode 100644 reactos/apps/tests/event/event.c delete mode 100644 reactos/apps/tests/event/makefile delete mode 100644 reactos/apps/tests/eventpair/.cvsignore delete mode 100644 reactos/apps/tests/eventpair/eventpair.c delete mode 100644 reactos/apps/tests/eventpair/makefile delete mode 100644 reactos/apps/tests/fiber/.cvsignore delete mode 100644 reactos/apps/tests/fiber/Makefile delete mode 100644 reactos/apps/tests/fiber/fiber.c delete mode 100644 reactos/apps/tests/global_mem/.cvsignore delete mode 100644 reactos/apps/tests/global_mem/Makefile delete mode 100644 reactos/apps/tests/global_mem/global_mem.c delete mode 100644 reactos/apps/tests/gradient/.cvsignore delete mode 100644 reactos/apps/tests/gradient/gradient.c delete mode 100644 reactos/apps/tests/gradient/makefile delete mode 100644 reactos/apps/tests/guithreadinfo/.cvsignore delete mode 100644 reactos/apps/tests/guithreadinfo/guithreadinfo.c delete mode 100644 reactos/apps/tests/guithreadinfo/makefile delete mode 100644 reactos/apps/tests/hello/.cvsignore delete mode 100644 reactos/apps/tests/hello/hello.c delete mode 100644 reactos/apps/tests/hello/makefile delete mode 100644 reactos/apps/tests/hivetest/.cvsignore delete mode 100644 reactos/apps/tests/hivetest/hivetest.c delete mode 100644 reactos/apps/tests/hivetest/makefile delete mode 100644 reactos/apps/tests/icontest/.cvsignore delete mode 100644 reactos/apps/tests/icontest/icon.ico delete mode 100644 reactos/apps/tests/icontest/icontest.c delete mode 100644 reactos/apps/tests/icontest/icontest.rc delete mode 100644 reactos/apps/tests/icontest/makefile delete mode 100644 reactos/apps/tests/icontest/resource.h delete mode 100644 reactos/apps/tests/iptest/iptest.cpp delete mode 100644 reactos/apps/tests/iptest/makefile delete mode 100644 reactos/apps/tests/isotest/.cvsignore delete mode 100644 reactos/apps/tests/isotest/isotest.c delete mode 100644 reactos/apps/tests/isotest/makefile delete mode 100644 reactos/apps/tests/kernel32/.cvsignore delete mode 100644 reactos/apps/tests/kernel32/Makefile delete mode 100644 reactos/apps/tests/kernel32/Makefile.in delete mode 100644 reactos/apps/tests/kernel32/alloc.c delete mode 100644 reactos/apps/tests/kernel32/atom.c delete mode 100644 reactos/apps/tests/kernel32/change.c delete mode 100644 reactos/apps/tests/kernel32/codepage.c delete mode 100644 reactos/apps/tests/kernel32/comm.c delete mode 100644 reactos/apps/tests/kernel32/console.c delete mode 100644 reactos/apps/tests/kernel32/directory.c delete mode 100644 reactos/apps/tests/kernel32/drive.c delete mode 100644 reactos/apps/tests/kernel32/environ.c delete mode 100644 reactos/apps/tests/kernel32/file.c delete mode 100644 reactos/apps/tests/kernel32/format_msg.c delete mode 100644 reactos/apps/tests/kernel32/generated.c delete mode 100644 reactos/apps/tests/kernel32/heap.c delete mode 100644 reactos/apps/tests/kernel32/locale.c delete mode 100644 reactos/apps/tests/kernel32/mailslot.c delete mode 100644 reactos/apps/tests/kernel32/path.c delete mode 100644 reactos/apps/tests/kernel32/pipe.c delete mode 100644 reactos/apps/tests/kernel32/process.c delete mode 100644 reactos/apps/tests/kernel32/profile.c delete mode 100644 reactos/apps/tests/kernel32/testlist.c delete mode 100644 reactos/apps/tests/kernel32/thread.c delete mode 100644 reactos/apps/tests/kernel32/time.c delete mode 100644 reactos/apps/tests/kernel32/virtual.c delete mode 100644 reactos/apps/tests/lan/lantest.cpp delete mode 100644 reactos/apps/tests/lan/makefile delete mode 100644 reactos/apps/tests/shm/.cvsignore delete mode 100644 reactos/apps/tests/shm/makefile delete mode 100644 reactos/apps/tests/shm/shmclt.c delete mode 100644 reactos/apps/tests/shm/shmsrv.c delete mode 100644 reactos/apps/tests/statst/.cvsignore delete mode 100644 reactos/apps/tests/statst/Makefile delete mode 100644 reactos/apps/tests/statst/statst.c delete mode 100644 reactos/apps/tests/stretchblt/.cvsignore delete mode 100644 reactos/apps/tests/stretchblt/lena.bmp delete mode 100644 reactos/apps/tests/stretchblt/makefile delete mode 100644 reactos/apps/tests/stretchblt/stretchblt.cpp delete mode 100644 reactos/apps/tests/subclass/.cvsignore delete mode 100644 reactos/apps/tests/subclass/makefile delete mode 100644 reactos/apps/tests/subclass/subclass.c delete mode 100644 reactos/apps/tests/suspend/.cvsignore delete mode 100644 reactos/apps/tests/suspend/Makefile delete mode 100644 reactos/apps/tests/suspend/suspend.c delete mode 100644 reactos/apps/tests/tcpsvr/.cvsignore delete mode 100644 reactos/apps/tests/tcpsvr/makefile delete mode 100644 reactos/apps/tests/tcpsvr/tcpsvr.c delete mode 100644 reactos/apps/tests/terminate/.cvsignore delete mode 100644 reactos/apps/tests/terminate/Makefile delete mode 100644 reactos/apps/tests/terminate/terminate.c delete mode 100644 reactos/apps/tests/test_old/bug2.c delete mode 100644 reactos/apps/tests/test_old/bug3.c delete mode 100644 reactos/apps/tests/test_old/makefile delete mode 100644 reactos/apps/tests/test_old/temptest.c delete mode 100644 reactos/apps/tests/test_old/test-fseek.c delete mode 100644 reactos/apps/tests/test_old/test-fwrite.c delete mode 100644 reactos/apps/tests/test_old/test-stdio.c delete mode 100644 reactos/apps/tests/test_old/test_rdwr.c delete mode 100644 reactos/apps/tests/test_old/testfsd.c delete mode 100644 reactos/apps/tests/test_old/testsuite.c delete mode 100644 reactos/apps/tests/test_old/testsuite.h delete mode 100644 reactos/apps/tests/test_old/time_t.c delete mode 100644 reactos/apps/tests/test_old/tst-printf.c delete mode 100644 reactos/apps/tests/test_old/tstdiomisc.c delete mode 100644 reactos/apps/tests/tests/GetSysMetrics/.cvsignore delete mode 100644 reactos/apps/tests/tests/GetSysMetrics/GetSysMetrics.c delete mode 100644 reactos/apps/tests/tests/GetSysMetrics/Makefile delete mode 100644 reactos/apps/tests/tests/GetSystemInfo/.cvsignore delete mode 100644 reactos/apps/tests/tests/GetSystemInfo/GetSystemInfo.c delete mode 100644 reactos/apps/tests/tests/GetSystemInfo/Makefile delete mode 100644 reactos/apps/tests/tests/Mutex/.cvsignore delete mode 100644 reactos/apps/tests/tests/Mutex/Makefile delete mode 100644 reactos/apps/tests/tests/Mutex/fivemutex.c delete mode 100644 reactos/apps/tests/tests/Mutex/rapidmutex.c delete mode 100644 reactos/apps/tests/tests/Parent_Child/.cvsignore delete mode 100644 reactos/apps/tests/tests/Parent_Child/Makefile delete mode 100644 reactos/apps/tests/tests/Parent_Child/Parent_Child.c delete mode 100644 reactos/apps/tests/tests/guitest/.cvsignore delete mode 100644 reactos/apps/tests/tests/guitest/Makefile delete mode 100644 reactos/apps/tests/tests/guitest/guitest.c delete mode 100644 reactos/apps/tests/tests/guitest/guitest.rc delete mode 100644 reactos/apps/tests/tests/hello/.cvsignore delete mode 100644 reactos/apps/tests/tests/hello/Makefile delete mode 100644 reactos/apps/tests/tests/hello/hello.c delete mode 100644 reactos/apps/tests/tests/new/.cvsignore delete mode 100644 reactos/apps/tests/tests/new/Makefile delete mode 100644 reactos/apps/tests/tests/new/new.c diff --git a/reactos/apps/tests/dnsquery/dnsquery.c b/reactos/apps/tests/dnsquery/dnsquery.c deleted file mode 100644 index 45780207eae..00000000000 --- a/reactos/apps/tests/dnsquery/dnsquery.c +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include -#include -#include -#include - -int main( int argc, char **argv ) { - PDNS_RECORD QueryReply, AddrResponse; - DWORD Addr; - - assert (DnsQuery ("www.reactos.com", DNS_TYPE_A, DNS_QUERY_STANDARD, - NULL, &QueryReply, NULL) == ERROR_SUCCESS); - AddrResponse = QueryReply; - while( AddrResponse ) { - if( AddrResponse->wType == DNS_TYPE_A ) { - Addr = ntohl( AddrResponse->Data.A.IpAddress ); - printf( "www.reactos.com == %d.%d.%d.%d\n", - (int)(Addr >> 24) & 0xff, - (int)(Addr >> 16) & 0xff, - (int)(Addr >> 8) & 0xff, - (int)Addr & 0xff ); - } - AddrResponse = AddrResponse->pNext; - } - DnsRecordListFree( QueryReply, DnsFreeRecordList ); - - return 0; -} diff --git a/reactos/apps/tests/dnsquery/makefile b/reactos/apps/tests/dnsquery/makefile deleted file mode 100644 index 842c1ea1aab..00000000000 --- a/reactos/apps/tests/dnsquery/makefile +++ /dev/null @@ -1,22 +0,0 @@ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = dnsquery - -TARGET_SDKLIBS = dnsapi.a ws2_32.a kernel32.a - -TARGET_OBJECTS = $(TARGET_NAME).o - -TARGET_CFLAGS = -D__USE_W32API -Wall -Werror -g - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/dump_shared_data/.cvsignore b/reactos/apps/tests/dump_shared_data/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/dump_shared_data/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/dump_shared_data/dump_shared_data.c b/reactos/apps/tests/dump_shared_data/dump_shared_data.c deleted file mode 100644 index 6ae2aeb0d9e..00000000000 --- a/reactos/apps/tests/dump_shared_data/dump_shared_data.c +++ /dev/null @@ -1,52 +0,0 @@ -#include -#include - -int main() -{ - int i; - - printf("TickCountLow: %lx\n", - SharedUserData->TickCountLow); - printf("Drives: "); - for (i = 0; i < 26; i++) - { - printf("%c", (SharedUserData->DosDeviceMap & (1 << i))?'1':'0'); - } - printf("\n"); - for (i = 0; i < 26; i++) - { - if (SharedUserData->DosDeviceMap & (1 << i)) - { - printf("%c: ", 'A'+i); - switch(SharedUserData->DosDeviceDriveType[i]) - { - case DOSDEVICE_DRIVE_UNKNOWN: - printf("Unknown\n"); - break; - case DOSDEVICE_DRIVE_CALCULATE: - printf("No root\n"); - break; - case DOSDEVICE_DRIVE_REMOVABLE: - printf("Removable\n"); - break; - case DOSDEVICE_DRIVE_FIXED: - printf("Fixed\n"); - break; - case DOSDEVICE_DRIVE_REMOTE: - printf("Remote\n"); - break; - case DOSDEVICE_DRIVE_CDROM: - printf("CD-ROM\n"); - break; - case DOSDEVICE_DRIVE_RAMDISK: - printf("Ram disk\n"); - break; - default: - printf("undefined type\n"); - break; - } - } - } - printf("\n\n"); - return 0; -} diff --git a/reactos/apps/tests/dump_shared_data/makefile b/reactos/apps/tests/dump_shared_data/makefile deleted file mode 100644 index 022d2470951..00000000000 --- a/reactos/apps/tests/dump_shared_data/makefile +++ /dev/null @@ -1,22 +0,0 @@ -# $Id: makefile,v 1.7 2003/11/14 17:13:16 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = dump_shared_data - -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/edit/.cvsignore b/reactos/apps/tests/edit/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/edit/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/edit/edittest.c b/reactos/apps/tests/edit/edittest.c deleted file mode 100644 index 723464651c8..00000000000 --- a/reactos/apps/tests/edit/edittest.c +++ /dev/null @@ -1,649 +0,0 @@ -/* Edit Control Test for ReactOS, quick n' dirty. Very rigid too. - * There you go, is only a test program. Not made to be fast, small - * easy to mantain, or portable. Lots of duplicated code too. - - * I'm not erasing text because I don't want to use other functions from th API - * or make this more complex. - - * This source code is in the PUBLIC DOMAIN and has NO WARRANTY. - * by Waldo Alvarez Caņizares , June 22, 2003. */ - -//#define WIN32_LEAN_AND_MEAN -#include -#include "utils.h" - -#define CREATEWINDOW 106 -#define CREATEWINDOWEX 107 -#define CREATEWINDOWW 108 - -#define ResultX 0 -#define ResultY 305 - -#define NOTIFYX 350 -#define NOTIFYY 285 - -#define BUFFERLEN 80 /* Size of buffer to hold result strings */ - -/* Edit is created with this text */ -#define TestStr "The quick brown fox jumps over the lazy dog" - -#define TestStrW L"This is a WCHAR string" /* Wide to support unicode edits */ - -#define MAXMESSAGEBUTTONS 42 - -HWND g_hwnd = NULL; -HINSTANCE g_hInst = NULL; - -int pos = 10; -int n = 0; -int yButPos = 10; -int xButPos = 10; - -DWORD EditStyle = 0; -DWORD EditWidth = 240; -DWORD EditHeight = 250; - -BOOL UnicodeUsed = FALSE; - -HWND hwndEdit = NULL; - -POINTL point={10,3}; -RECT rect = {0,0,20,20},rect2; -DWORD StartP,EndP; - -#define ReplaceTextStr "->> Replaced!! <<-" - -char* AllocatedText; /* Buffer in the heap to feed it to the edit control */ -char* NewText = "New text for the edit control"; -wchar_t* NewTextW = L"New text for the edit control in UNICODE"; // Wide - -char TextBuffer[BUFFERLEN]={'R','e','s','u','l','t',':',' '}; - -typedef void FunctionHandler(HWND,DWORD,WPARAM,LPARAM); -typedef FunctionHandler* LPFUNCTIONHANDLER; - -VOID -PrintTextXY(char* Text,int x,int y,int len) -{ - 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) - { - int ret; - ret = SendMessage(handle,Msg,wParam,lParam); - htoa(ret,&TextBuffer[8]); - PrintTextXY(TextBuffer,ResultX,ResultY,16); - } - -static -VOID -HandleSetHandlePrintHex(HWND handle,DWORD Msg,WPARAM wParam,LPARAM lParam) - { - LPVOID pMem; - HANDLE hNewBuffer; - int ret; - - LocalFree((HLOCAL)SendMessage(handle, EM_GETHANDLE, 0, 0L)); - if (UnicodeUsed) - { - hNewBuffer = LocalAlloc(LMEM_MOVEABLE | LMEM_ZEROINIT, 100); - pMem = LocalLock(hNewBuffer); - strcpyw_((wchar_t*)pMem,NewTextW); - } - else - { - hNewBuffer = LocalAlloc(LMEM_MOVEABLE | LMEM_ZEROINIT,50); - pMem = LocalLock(hNewBuffer); - strcpy_((char*)pMem,NewText); - } - - LocalUnlock(pMem); - hNewBuffer = LocalHandle(pMem); - - /* Updates the buffer and displays new buffer */ - ret = SendMessage(handle, EM_SETHANDLE, (WPARAM)hNewBuffer, 0L); - - htoa(ret,&TextBuffer[8]); - PrintTextXY(TextBuffer,ResultX,ResultY,16); - } - -static -VOID -HandlePrintReturnStr(HWND handle,DWORD Msg,WPARAM wParam,LPARAM lParam) - { - int ret; - TextBuffer[8] = (char)(BUFFERLEN - 8); /* Setting the max size to put chars in first byte */ - ret = SendMessage(handle,Msg,wParam,lParam); - PrintTextXY(TextBuffer,ResultX,ResultY,8+ret); - } - -static -VOID -HandlePrintRect(HWND handle,DWORD Msg,WPARAM wParam,LPARAM lParam) - { - 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]); - - PrintTextXY(TextBuffer,ResultX,ResultY,8+4*9-1); - } - -static -VOID -HandlePrintPasswdChar(HWND handle,DWORD Msg,WPARAM wParam,LPARAM lParam) - { - HDC hdc; - int ret = SendMessage(handle,Msg,wParam,lParam); - - int s; - - if (ret) - { - s = 1; - TextBuffer[8] = (char)(ret); - } - else - { - TextBuffer[8] = 'N'; - TextBuffer[9] = 'U'; - TextBuffer[10] = 'L'; - TextBuffer[11] = 'L'; - s = 4; - } - - hdc = GetDC (g_hwnd); - SelectObject (hdc, GetStockObject (SYSTEM_FIXED_FONT)); - - TextOut (hdc,ResultX ,ResultY,TextBuffer,8+s); - ReleaseDC (g_hwnd, hdc); - ValidateRect (g_hwnd, &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[] = -{ - {"EM_CANUNDO",EM_CANUNDO,0,0,&HandlePrintReturnHex}, - {"EM_CHARFROMPOS",EM_CHARFROMPOS,(WPARAM)&point,0,&HandlePrintReturnHex}, - {"EM_EMPTYUNDOBUFFER",EM_EMPTYUNDOBUFFER,0,0,&HandlePrintReturnHex}, - {"EM_FMTLINES",EM_FMTLINES,TRUE,0,&HandlePrintReturnHex}, - {"EM_GETFIRSTVISIBLELINE",EM_GETFIRSTVISIBLELINE,0,0,&HandlePrintReturnHex}, - - {"EM_GETLIMITTEXT",EM_GETLIMITTEXT,0,0,&HandlePrintReturnHex}, - {"EM_GETLINE",EM_GETLINE,2,(WPARAM)&TextBuffer[8],&HandlePrintReturnStr}, - {"EM_GETLINECOUNT",EM_GETLINECOUNT,0,0,&HandlePrintReturnHex}, - {"EM_GETMARGINS",EM_GETMARGINS,0,0,&HandlePrintReturnHex}, - {"EM_SETMARGINS",EM_SETMARGINS,EC_LEFTMARGIN,10,&HandlePrintReturnHex}, - - {"EM_GETMODIFY",EM_GETMODIFY,0,0,&HandlePrintReturnHex}, - {"EM_SETMODIFY",EM_SETMODIFY,TRUE,0,&HandlePrintReturnHex}, - - {"EM_GETSEL",EM_GETSEL,(WPARAM)&StartP,(LPARAM)&EndP,&HandlePrintReturnHex}, - - {"EM_GETTHUMB",EM_GETTHUMB,0,0,&HandlePrintReturnHex}, - - {"EM_LIMITTEXT",EM_LIMITTEXT,10,0,&HandlePrintReturnHex}, - {"EM_LINEFROMCHAR",EM_LINEFROMCHAR,-1,0,&HandlePrintReturnHex}, - {"EM_POSFROMCHAR",EM_POSFROMCHAR,10,0,&HandlePrintReturnHex}, - {"EM_LINEINDEX",EM_LINEINDEX,2,0,&HandlePrintReturnHex}, - {"EM_LINELENGTH",EM_LINELENGTH,-1,0,&HandlePrintReturnHex}, - - {"EM_GETWORDBREAKPROC",EM_GETWORDBREAKPROC,0,0,&HandlePrintReturnHex}, - {"EM_REPLACESEL",EM_REPLACESEL,TRUE,(LPARAM)&ReplaceTextStr,&HandlePrintReturnHex}, - - {"EM_LINESCROLL",EM_LINESCROLL,5,1,&HandlePrintReturnHex}, - {"EM_SCROLL",EM_SCROLL,SB_LINEDOWN,0,&HandlePrintReturnHex}, - {"EM_SCROLLCARET",EM_SCROLLCARET,0,0,&HandlePrintReturnHex}, - - {"EM_SETHANDLE",EM_SETHANDLE,0,0,&HandleSetHandlePrintHex}, - {"EM_GETHANDLE",EM_GETHANDLE,0,0,&HandlePrintReturnHex}, - {"EM_GETPASSWORDCHAR",EM_GETPASSWORDCHAR,0,0,&HandlePrintPasswdChar}, - {"EM_SETPASSWORDCHAR - clear",EM_SETPASSWORDCHAR,0,0,&HandlePrintReturnHex}, - {"EM_SETPASSWORDCHAR - x",EM_SETPASSWORDCHAR,'x',0,&HandlePrintReturnHex}, - - {"EM_SETREADONLY - set",EM_SETREADONLY,TRUE,0,&HandlePrintReturnHex}, - {"EM_SETREADONLY - clear",EM_SETREADONLY,FALSE,0,&HandlePrintReturnHex}, - - {"EM_GETRECT",EM_GETRECT,0,(LPARAM)&rect2,&HandlePrintRect}, - {"EM_SETRECT",EM_SETRECT,0,(LPARAM)&rect,&HandlePrintReturnHex}, - {"EM_SETRECTNP",EM_SETRECTNP,0,(LPARAM)&rect,&HandlePrintReturnHex}, - {"EM_SETSEL",EM_SETSEL,1,3,&HandlePrintReturnHex}, - - {"EM_SETSEL - all",EM_SETSEL,0,-1,&HandlePrintReturnHex}, - {"EM_SETSEL - remove",EM_SETSEL,-1,0,&HandlePrintReturnHex}, - {"EM_UNDO",EM_UNDO,0,0,&HandlePrintReturnHex}, - {"WM_UNDO",WM_UNDO,0,0,&HandlePrintReturnHex}, - {"WM_PASTE",WM_PASTE,0,0,&HandlePrintReturnHex}, - - {"WM_CUT",WM_CUT,0,0,&HandlePrintReturnHex}, - {"WM_COPY",WM_COPY,0,0,&HandlePrintReturnHex} - -}; - -DWORD EditStyles[] = { - WS_THICKFRAME,WS_DISABLED,WS_BORDER,ES_LOWERCASE,ES_UPPERCASE,ES_NUMBER,ES_AUTOVSCROLL, - ES_AUTOHSCROLL,ES_LEFT,ES_CENTER,ES_RIGHT,ES_MULTILINE, - ES_NOHIDESEL,ES_OEMCONVERT,ES_PASSWORD,ES_READONLY,ES_WANTRETURN, - WS_HSCROLL,WS_VSCROLL - }; - -char* StyleNames[] = { - "WS_THICKFRAME","WS_DISABLED","WS_BORDER","ES_LOWERCASE","ES_UPPERCASE","ES_NUMBER","ES_AUTOVSCROLL", - "ES_AUTOHSCROLL","ES_LEFT","ES_CENTER","ES_RIGHT","ES_MULTILINE", - "ES_NOHIDESEL","ES_OEMCONVERT","ES_PASSWORD","ES_READONLY","ES_WANTRETURN", - "WS_HSCROLL","WS_VSCROLL" - }; - -#define NUMBERBUTTONS 26 -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; - EditStyle = 0; - for (i=0 ; i< 19 ; i++) - { - if(BST_CHECKED == SendMessage(Buttons[i],BM_GETCHECK,0,0)) - EditStyle |= EditStyles[i]; - 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: - EditWidth += 10; - break; - - case 101: - EditWidth -= 10; - break; - - case 102: - EditHeight += 10; - break; - - case 103: - EditHeight -= 10; - break; - - case 400: - BackToInitialPage(); - break; - - case 401: - ForwardToSecondPage(); - break; - - case 402: - BackToFirstPage(); - break; - - case CREATEWINDOW: - UnicodeUsed = FALSE; - ReadNHide(); - hwndEdit = CreateWindow("EDIT", - TestStr, - EditStyle | WS_CHILD | WS_VISIBLE, - 350, - 10, - EditWidth, - EditHeight, - g_hwnd, - NULL, - g_hInst, - NULL); - break; - - case CREATEWINDOWEX: - UnicodeUsed = FALSE; - ReadNHide(); - hwndEdit = CreateWindowEx(WS_EX_CLIENTEDGE, - "EDIT", - TestStr, - EditStyle | WS_CHILD | WS_VISIBLE , - 350, - 10, - EditWidth, - EditHeight, - g_hwnd, - NULL, - g_hInst, - NULL); - break; - - case CREATEWINDOWW: - UnicodeUsed = TRUE; - ReadNHide(); - hwndEdit = CreateWindowExW(WS_EX_CLIENTEDGE, - L"EDIT", - TestStrW, - EditStyle | WS_CHILD | WS_VISIBLE , - 350, - 10, - EditWidth, - EditHeight, - g_hwnd, - NULL, - g_hInst, - NULL); - break; - } - - if (lParam == (LPARAM)hwndEdit) - switch(HIWORD(wParam)) - { - case EN_CHANGE: - PrintTextXY("EN_CHANGE notification",NOTIFYX,NOTIFYY,22); - break; - - case EN_ERRSPACE: - PrintTextXY("EN_ERRSPACE notification",NOTIFYX,NOTIFYY,24); - break; - - /* --- FIXME not defined in w32api-2.3 headers - case H_SCROLL: - PrintTextXY("H_SCROLL notification",NOTIFYX,NOTIFYY,21); - break; */ - - /* --- FIXME not defined in w32api-2.3 headers - case KILL_FOCUS: - PrintTextXY("KILL_FOCUS notification",NOTIFYX,NOTIFYY,23); - break; */ - - /* --- FIXME not defined in w32api-2.3 headers - case EN_MAXTEST: - PrintTextXY("EN_MAXTEXT notification",NOTIFYX,NOTIFYY,23); - break; */ - - case EN_SETFOCUS: - PrintTextXY("EN_SETFOCUS notification",NOTIFYX,NOTIFYY,24); - break; - - case EN_UPDATE: - PrintTextXY("EN_UPDATE notification",NOTIFYX,NOTIFYY + 20,22); - break; - - case EN_VSCROLL: - PrintTextXY("EN_VSCROLL notification",NOTIFYX,NOTIFYY,23); - break; - - } - - 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; - HWND hwnd; - - 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 */ - 560, /* width */ - 350, /* 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 [] = "Edit Control Test"; - MSG msg; - - RegisterAndCreateWindow ( hInst, className, "Edit Control Styles Test" ); - - // Message loop - while (GetMessage (&msg, NULL, 0, 0)) - { - TranslateMessage (&msg); - DispatchMessage (&msg); - } - return msg.wParam; - -} diff --git a/reactos/apps/tests/edit/makefile b/reactos/apps/tests/edit/makefile deleted file mode 100644 index 40df87b76b1..00000000000 --- a/reactos/apps/tests/edit/makefile +++ /dev/null @@ -1,24 +0,0 @@ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = edittest - -TARGET_SDKLIBS = kernel32.a gdi32.a - -TARGET_OBJECTS = \ - edittest.o \ - utils.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/edit/utils.c b/reactos/apps/tests/edit/utils.c deleted file mode 100644 index f1eff54609f..00000000000 --- a/reactos/apps/tests/edit/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/edit/utils.h b/reactos/apps/tests/edit/utils.h deleted file mode 100644 index f6a12649c1e..00000000000 --- a/reactos/apps/tests/edit/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/enhmetafile/.cvsignore b/reactos/apps/tests/enhmetafile/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/enhmetafile/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/enhmetafile/enhmetafile.c b/reactos/apps/tests/enhmetafile/enhmetafile.c deleted file mode 100644 index cd90e6e42f7..00000000000 --- a/reactos/apps/tests/enhmetafile/enhmetafile.c +++ /dev/null @@ -1,123 +0,0 @@ -#include -#include -#include - -//HFONT tf; -HENHMETAFILE EnhMetafile; -SIZE EnhMetafileSize; -LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM); - -int WINAPI -WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpszCmdLine, - int nCmdShow) -{ - WNDCLASS wc; - MSG msg; - HWND hWnd; - ENHMETAHEADER emh; - - EnhMetafile = GetEnhMetaFile("test.emf"); - if(!EnhMetafile) - { - fprintf(stderr, "GetEnhMetaFile failed (last error 0x%lX)\n", - GetLastError()); - return(1); - } - GetEnhMetaFileHeader(EnhMetafile, sizeof(ENHMETAHEADER), &emh); - EnhMetafileSize.cx = emh.rclBounds.right - emh.rclBounds.left; - EnhMetafileSize.cy = emh.rclBounds.bottom - emh.rclBounds.top; - - wc.lpszClassName = "EnhMetaFileClass"; - 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_BTNFACE + 1); - wc.lpszMenuName = NULL; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - if (RegisterClass(&wc) == 0) - { - DeleteEnhMetaFile(EnhMetafile); - fprintf(stderr, "RegisterClass failed (last error 0x%lX)\n", - GetLastError()); - return(1); - } - - hWnd = CreateWindow("EnhMetaFileClass", - "Enhanced Metafile test", - WS_OVERLAPPEDWINDOW, - 0, - 0, - EnhMetafileSize.cx + (2 * GetSystemMetrics(SM_CXSIZEFRAME)) + 2, - EnhMetafileSize.cy + (2 * GetSystemMetrics(SM_CYSIZEFRAME)) + GetSystemMetrics(SM_CYCAPTION) + 2, - NULL, - NULL, - hInstance, - NULL); - if (hWnd == NULL) - { - DeleteEnhMetaFile(EnhMetafile); - 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); - } - - DeleteEnhMetaFile(EnhMetafile); - - //DeleteObject(tf); - UnregisterClass("EnhMetaFileClass", hInstance); - - return msg.wParam; -} - -LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch(msg) - { - - case WM_PAINT: - { - PAINTSTRUCT ps; - RECT rc; - HDC hDC; - int bk; - - GetClientRect(hWnd, &rc); - hDC = BeginPaint(hWnd, &ps); - rc.left = (rc.right / 2) - (EnhMetafileSize.cx / 2); - rc.top = (rc.bottom / 2) - (EnhMetafileSize.cy / 2); - rc.right = rc.left + EnhMetafileSize.cx; - rc.bottom = rc.top + EnhMetafileSize.cy; - bk = SetBkMode(hDC, TRANSPARENT); - Rectangle(hDC, rc.left - 1, rc.top - 1, rc.right + 1, rc.bottom + 1); - SetBkMode(hDC, bk); - PlayEnhMetaFile(hDC, EnhMetafile, &rc); - EndPaint(hWnd, &ps); - break; - } - - case WM_DESTROY: - PostQuitMessage(0); - break; - - default: - return DefWindowProc(hWnd, msg, wParam, lParam); - } - return 0; -} diff --git a/reactos/apps/tests/enhmetafile/makefile b/reactos/apps/tests/enhmetafile/makefile deleted file mode 100644 index 508694d8480..00000000000 --- a/reactos/apps/tests/enhmetafile/makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $Id: makefile,v 1.1 2003/11/15 14:05:30 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = enhmetafile - -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/enhmetafile/test.emf b/reactos/apps/tests/enhmetafile/test.emf deleted file mode 100644 index d056e2070df42f2bc1dba9539d22e13042c74239..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 120908 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 -// 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 - - -#ifndef SNDMSG -#define SNDMSG ::SendMessage -#endif /* ifndef SNDMSG */ - - -//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - - -HWND hListBox = NULL; -const int ID_LISTBOX = 101; - -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_VREDRAW | CS_HREDRAW; - wc.lpszClassName = WndClassName; - wc.lpfnWndProc = MainWndProc; - wc.hInstance = hInstance; - wc.hCursor = NULL; //LoadCursor(NULL, IDC_ARROW); - wc.hbrBackground = reinterpret_cast( - COLOR_BTNFACE + 1 - ); - - if (RegisterClass(&wc)) - { - HWND hWnd = - CreateWindow( - WndClassName, TEXT("Font Enumeration Demo"), - WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION | - WS_VISIBLE | WS_CLIPCHILDREN, - CW_USEDEFAULT, CW_USEDEFAULT, 295, 285, - 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; -} -//------------------------------------------------------------------------- - - -int CALLBACK MyEnumFontFamExProc(ENUMLOGFONTEX *lpelfe, - NEWTEXTMETRICEX* lpntme, int FontType, LPARAM lParam) -{ - if (FontType == TRUETYPE_FONTTYPE) - { - // if the typeface name is not already in the list - LPARAM name = reinterpret_cast(lpelfe->elfFullName); - if (SNDMSG(hListBox, LB_FINDSTRINGEXACT, (ULONG)-1, name) == LB_ERR) - { - // add each font to the list box - int index = SNDMSG(hListBox, LB_ADDSTRING, 0, name); - - // fix the size of the font - lpelfe->elfLogFont.lfHeight = -20; - lpelfe->elfLogFont.lfWidth = 0; - - // create a new font and store its handle - // as the data of the newly added item - HFONT hFont = CreateFontIndirect(&lpelfe->elfLogFont); - SNDMSG(hListBox, LB_SETITEMDATA, index, - reinterpret_cast(hFont)); - } - } - return TRUE; -} -//------------------------------------------------------------------------- - - -void AddScreenFonts() -{ - // grab a handle to the screen's DC - HDC hScreenDC = GetDC(NULL); - try - { - // - // NOTE: Windows 95, 98 and Me requires that the lpLogfont - // (second) parameter of the EnumFontFamiliesEx function is - // non-NULL. This parameter can be NULL on Windows NT/2000. - // - LOGFONT lf = {0}; - lf.lfCharSet = DEFAULT_CHARSET; - - // enumerate the current screen fonts - EnumFontFamiliesEx( - hScreenDC, &lf, - (FONTENUMPROC)MyEnumFontFamExProc, - 0, 0 - ); - } - catch (...) - { - // release the screen's DC - ReleaseDC(NULL, hScreenDC); - } - // release the screen's DC - ReleaseDC(NULL, hScreenDC); -} -//------------------------------------------------------------------------- - - -LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, - LPARAM lParam) -{ - switch (msg) - { - case WM_CREATE: - { - hListBox = - CreateWindowEx( - WS_EX_CLIENTEDGE, TEXT("LISTBOX"), TEXT(""), - WS_CHILD | WS_VISIBLE | LBS_STANDARD | - LBS_HASSTRINGS | LBS_OWNERDRAWFIXED, - 20, 10, 250, 250, - hWnd, reinterpret_cast(ID_LISTBOX), - hInst, NULL - ); - if (hListBox) - { - AddScreenFonts(); - } - } - case WM_MEASUREITEM: - { - // grab a pointer to the MEASUREITEMSTRUCT structure - LPMEASUREITEMSTRUCT lpmis = - reinterpret_cast(lParam); - - // test the identifier of the control that - // the message is meant for - if ((int)lpmis->CtlID == ID_LISTBOX) - { - // adjust the height - lpmis->itemHeight = 25; - - return TRUE; - } - break; - } - case WM_DRAWITEM: - { - // grab a pointer to the DRAWITEMSTRUCT structure - LPDRAWITEMSTRUCT lpdis = - reinterpret_cast(lParam); - - // test the identifier of the control that - // the message is meant for - if ((int)lpdis->CtlID == ID_LISTBOX) - { - COLORREF OldColor = GetTextColor(lpdis->hDC); - int stock = WHITE_BRUSH; - - // if the item is currently selected - if (lpdis->itemState & ODS_SELECTED) - { - // set the text color to white and - // the background color to black - COLORREF clrWhite = PALETTERGB(255, 255, 255); - OldColor = SetTextColor(lpdis->hDC, clrWhite); - stock = BLACK_BRUSH; - } - FillRect( - lpdis->hDC, &lpdis->rcItem, - static_cast(GetStockObject(stock)) - ); - - if ((int)lpdis->itemID != -1) - { - // extract the item's text - char text[MAX_PATH]; - SNDMSG(hListBox, LB_GETTEXT, lpdis->itemID, - reinterpret_cast(text)); - - // extract the corresponding font handle - DWORD value = - SNDMSG(hListBox, LB_GETITEMDATA, lpdis->itemID, 0); - HFONT hFont = reinterpret_cast(value); - - // select the corresponding font - // into the device context - HFONT HOldFont = static_cast( - SelectObject(lpdis->hDC, hFont) - ); - - // render the text transparently - SetBkMode(lpdis->hDC, TRANSPARENT); - - // render the text - RECT RText = lpdis->rcItem; - InflateRect(&RText, -2, -2); - DrawText(lpdis->hDC, text, strlen(text), &RText, - DT_LEFT | DT_VCENTER | DT_SINGLELINE); - - // restore the previous font - SelectObject(lpdis->hDC, HOldFont); - } - - // render the focus rectangle - if (lpdis->itemState & ODS_FOCUS) - { - DrawFocusRect(lpdis->hDC, &lpdis->rcItem); - } - - // restore the previous color/mode - SetTextColor(lpdis->hDC, OldColor); - SetBkMode(lpdis->hDC, OPAQUE); - - return TRUE; - } - break; - } - case WM_DESTROY: - { - // delete each created font object - int count = SNDMSG(hListBox, LB_GETCOUNT, 0, 0); - for (int index = 0; index < count; ++index) - { - DWORD value = SNDMSG(hListBox, LB_GETITEMDATA, index, 0); - DeleteObject(reinterpret_cast(value)); - } - - PostQuitMessage(0); - break; - } - } - return DefWindowProc(hWnd, msg, wParam, lParam); -} -//------------------------------------------------------------------------- - - - diff --git a/reactos/apps/tests/enumfonts/makefile b/reactos/apps/tests/enumfonts/makefile deleted file mode 100644 index 6a26b5d4252..00000000000 --- a/reactos/apps/tests/enumfonts/makefile +++ /dev/null @@ -1,24 +0,0 @@ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = enumfonts - -TARGET_SDKLIBS = kernel32.a gdi32.a - -TARGET_OBJECTS = $(TARGET_NAME).o - -TARGET_GCCLIBS = stdc++ - -TARGET_CPPFLAGS = -Wall -Werror -D__USE_W32API -DWIN32 -D_WIN32_IE=0x0600 -D_WIN32_WINNT=0x0501 -fexceptions -Wall -I. - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/enumwnd/.cvsignore b/reactos/apps/tests/enumwnd/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/enumwnd/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/enumwnd/enumwnd.c b/reactos/apps/tests/enumwnd/enumwnd.c deleted file mode 100644 index c5b60ef6a03..00000000000 --- a/reactos/apps/tests/enumwnd/enumwnd.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * enumwnd.c - * - * application to test the various Window Enumeration functions - */ - -//#define WIN32_LEAN_AND_MEAN -#include -#include -#include - -HBRUSH hbrBackground; -HFONT tf; -int test = 0; -const TCHAR* APP_NAME = "EnumWnd Test"; -const TCHAR* CLASS_NAME = "EnumWndTestClass"; - -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 = CLASS_NAME; - 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) - { - _ftprintf ( stderr, _T("RegisterClass failed (last error 0x%lX)\n"), - GetLastError()); - return(1); - } - - hWnd = CreateWindow(CLASS_NAME, - APP_NAME, - WS_OVERLAPPEDWINDOW, - 0, - 0, - CW_USEDEFAULT, - CW_USEDEFAULT, - NULL, - NULL, - hInstance, - NULL); - if (hWnd == NULL) - { - _ftprintf ( stderr, _T("CreateWindow failed (last error 0x%lX)\n"), - GetLastError()); - return(1); - } - - tf = CreateFont (14, 0, 0, TA_BASELINE, FW_NORMAL, FALSE, FALSE, FALSE, - ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, - DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, _T("Timmons")); - - hbrBackground = CreateSolidBrush ( RGB(192,192,192) ); - - ShowWindow ( hWnd, nCmdShow ); - - while(GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - DeleteObject(hbrBackground); - - DeleteObject(tf); - - return msg.wParam; -} - -void MyTextOut ( HDC hdc, int x, int y, const TCHAR* text ) -{ - TextOut ( hdc, x, y, text, _tcslen(text) ); -} - -typedef struct _EnumData -{ - HDC hdc; - int x; - int y; -} EnumData; - -BOOL CALLBACK MyWindowEnumProc ( HWND hwnd, LPARAM lParam ) -{ - TCHAR wndcaption[1024], buf[1024]; - EnumData* ped = (EnumData*)lParam; - GetWindowText ( hwnd, wndcaption, sizeof(wndcaption)/sizeof(*wndcaption) ); - _sntprintf ( buf, sizeof(buf)/sizeof(*buf), _T("%x - %s"), hwnd, wndcaption ); - MyTextOut ( ped->hdc, ped->x, ped->y, buf ); - ped->y += 13; - return TRUE; -} - -LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - PAINTSTRUCT ps; - HDC hDC; - RECT rect; - TCHAR buf[100]; - EnumData ed; - - switch(msg) - { - case WM_PAINT: - hDC = BeginPaint(hWnd, &ps); - SelectObject(hDC, tf); - - GetClientRect ( hWnd, &rect ); - FillRect ( hDC, &rect, hbrBackground ); - - MyTextOut ( hDC, 10, 10, "EnumWnd Test" ); - - _sntprintf ( buf, sizeof(buf)/sizeof(*buf), _T("My HWND: %x"), hWnd ); - MyTextOut ( hDC, 10, 30, buf ); - - ed.hdc = hDC; - ed.x = 10; - ed.y = 70; - - switch ( test ) - { - case 1: - MyTextOut ( hDC, 10, 50, _T("Test #1: EnumWindows()") ); - EnumWindows ( MyWindowEnumProc, (LPARAM)&ed ); - break; - case 2: - MyTextOut ( hDC, 10, 50, _T("Test #2: EnumChildWindows()") ); - EnumChildWindows ( hWnd, MyWindowEnumProc, (LPARAM)&ed ); - break; - case 3: - MyTextOut ( hDC, 10, 50, _T("Test #3: EnumDesktopWindows") ); - EnumDesktopWindows ( NULL, MyWindowEnumProc, (LPARAM)&ed ); - break; - case 4: - MyTextOut ( hDC, 10, 50, _T("Test #4: EnumThreadWindows") ); - EnumThreadWindows ( GetCurrentThreadId(), MyWindowEnumProc, (LPARAM)&ed ); - break; - default: - MyTextOut ( hDC, 10, 50, _T("Press any of the number keys from 1 to 4 to run a test") ); - MyTextOut ( hDC, 10, 70, _T("Press the left and right mouse buttons to cycle through the tests") ); - break; - } - - EndPaint(hWnd, &ps); - break; - - case WM_CHAR: - test = (TCHAR)wParam - '1' + 1; - RedrawWindow ( hWnd, NULL, NULL, RDW_INVALIDATE ); - break; - - case WM_LBUTTONDOWN: - if ( ++test > 4 ) - test = 1; - RedrawWindow ( hWnd, NULL, NULL, RDW_INVALIDATE ); - break; - - case WM_RBUTTONDOWN: - if ( !--test ) - test = 4; - RedrawWindow ( hWnd, NULL, NULL, RDW_INVALIDATE ); - break; - - case WM_DESTROY: - PostQuitMessage(0); - break; - - default: - return DefWindowProc(hWnd, msg, wParam, lParam); - } - return 0; -} diff --git a/reactos/apps/tests/enumwnd/enumwnd.dsp b/reactos/apps/tests/enumwnd/enumwnd.dsp deleted file mode 100644 index 8225c197eda..00000000000 --- a/reactos/apps/tests/enumwnd/enumwnd.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="enumwnd" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=enumwnd - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "enumwnd.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "enumwnd.mak" CFG="enumwnd - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "enumwnd - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "enumwnd - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "enumwnd - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "enumwnd - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /debug /machine:I386 /pdbtype:sept -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "enumwnd - Win32 Release" -# Name "enumwnd - Win32 Debug" -# Begin Source File - -SOURCE=.\enumwnd.c -# End Source File -# End Target -# End Project diff --git a/reactos/apps/tests/enumwnd/makefile b/reactos/apps/tests/enumwnd/makefile deleted file mode 100644 index b289471a0ec..00000000000 --- a/reactos/apps/tests/enumwnd/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 = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = enumwnd - -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/enumws/.cvsignore b/reactos/apps/tests/enumws/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/enumws/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/enumws/enumws.c b/reactos/apps/tests/enumws/enumws.c deleted file mode 100644 index 93d5a216bb2..00000000000 --- a/reactos/apps/tests/enumws/enumws.c +++ /dev/null @@ -1,35 +0,0 @@ -#include -#include - -BOOL CALLBACK -EnumDesktopProc(LPWSTR lpszWindowStation, LPARAM lParam) -{ - printf("\t%S\n", lpszWindowStation); - - return TRUE; -} - -BOOL CALLBACK -EnumWindowStationProc(LPWSTR lpszWindowStation, LPARAM lParam) -{ - HWINSTA hWinSta; - - printf("%S\n", lpszWindowStation); - hWinSta = OpenWindowStationW(lpszWindowStation, FALSE, - WINSTA_ENUMDESKTOPS); - if (hWinSta == NULL) - { - printf("\tCan't open window station.\n"); - return TRUE; - } - EnumDesktopsW(hWinSta, EnumDesktopProc, 0xdede); - - return TRUE; -} - -int main() -{ - EnumWindowStationsW(EnumWindowStationProc, 0xbadbed); - - return 0; -} diff --git a/reactos/apps/tests/enumws/makefile b/reactos/apps/tests/enumws/makefile deleted file mode 100644 index f1ad683c312..00000000000 --- a/reactos/apps/tests/enumws/makefile +++ /dev/null @@ -1,21 +0,0 @@ -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = enumws - -TARGET_SDKLIBS = 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/event/.cvsignore b/reactos/apps/tests/event/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/event/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/event/event.c b/reactos/apps/tests/event/event.c deleted file mode 100644 index 9942bea0745..00000000000 --- a/reactos/apps/tests/event/event.c +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include - -HANDLE events[2]; - -DWORD WINAPI thread( LPVOID crap ) -{ - SetEvent( events[0] ); - if( crap ) - SetEvent( events[1] ); - return 1; -} - -int main( void ) -{ - DWORD id, Status; - printf( "Creating events\n" ); - events[0] = CreateEvent( 0, TRUE, FALSE, 0 ); - events[1] = CreateEvent( 0, TRUE, FALSE, 0 ); - printf( "Created events\n" ); - CreateThread( 0, 0, thread, 0, 0, &id ); - printf( "WaitForSingleObject %s\n", ( WaitForSingleObject( events[0], INFINITE ) == WAIT_OBJECT_0 ? "worked" : "failed" ) ); - ResetEvent( events[0] ); - CreateThread( 0, 0, thread, 0, 0, &id ); - printf( "WaitForMultipleObjects with waitall = FALSE %s\n", ( WaitForMultipleObjects( 2, events, FALSE, INFINITE ) == WAIT_OBJECT_0 ? "worked" : "failed" ) ); - ResetEvent( events[0] ); - CreateThread( 0, 0, thread, (void *)1, 0, &id ); - Status = WaitForMultipleObjects( 2, events, TRUE, INFINITE ); - printf( "WaitForMultipleObjects with waitall = TRUE %s\n", ( Status == WAIT_OBJECT_0 || Status == WAIT_OBJECT_0 + 1 ? "worked" : "failed" ) ); - ResetEvent( events[0] ); - printf( "WaitForSingleObject with timeout %s\n", ( WaitForSingleObject( events[0], 100 ) == WAIT_TIMEOUT ? "worked" : "failed" ) ); - return 0; -} diff --git a/reactos/apps/tests/event/makefile b/reactos/apps/tests/event/makefile deleted file mode 100644 index a8a0277d64c..00000000000 --- a/reactos/apps/tests/event/makefile +++ /dev/null @@ -1,23 +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 = event - -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/eventpair/.cvsignore b/reactos/apps/tests/eventpair/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/eventpair/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/eventpair/eventpair.c b/reactos/apps/tests/eventpair/eventpair.c deleted file mode 100644 index f20a725a7f9..00000000000 --- a/reactos/apps/tests/eventpair/eventpair.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Author: Skywing (skywing@valhallalegends.com) - * Date: 09/09/2003 - * Purpose: Test Thread-EventPair functionality. - */ - -#include -#include -#include - -#ifndef NTAPI -#define NTAPI WINAPI -#endif - -HANDLE MakeEventPair() -{ - NTSTATUS Status; - HANDLE EventPair; - OBJECT_ATTRIBUTES Attributes; - - InitializeObjectAttributes(&Attributes, NULL, 0, NULL, NULL); - Status = NtCreateEventPair(&EventPair, STANDARD_RIGHTS_ALL, &Attributes); - printf("Status %08lx creating eventpair\n", Status); - return EventPair; -} - -DWORD __stdcall threadfunc(void* eventpair) -{ - printf("Thread: Set eventpair status %08lx\n", NtSetInformationThread(NtCurrentThread(), ThreadEventPair, &eventpair, sizeof(HANDLE))); - Sleep(2500); - - printf("Thread: Setting low and waiting high...\n"); - printf("Thread: status = %08lx\n", NtSetLowWaitHighThread()); - printf("Thread: status = %08lx\n", NtSetHighWaitLowThread()); - printf("Thread: Terminating...\n"); - return 0; -} - -int main(int ac, char **av) -{ - DWORD id; - HANDLE EventPair, Thread; - - printf("Main: NtSetLowWaitHighThread is at %08lx\n", NtSetLowWaitHighThread()); - - EventPair = MakeEventPair(); - - if(!EventPair) { - printf("Main: Could not create event pair.\n"); - return 0; - } - - printf("Main: EventPair = %08lx\n", (DWORD)EventPair); - Thread = CreateThread(0, 0, threadfunc, EventPair, 0, &id); - printf("Main: ThreadId for new thread is %08lx\n", id); - printf("Main: Setting high and waiting low\n"); - printf("Main: status = %08lx\n", NtSetHighWaitLowEventPair(EventPair)); - Sleep(2500); - printf("Main: status = %08lx\n", NtSetLowWaitHighEventPair(EventPair)); - NtClose(EventPair); - /* WaitForSingleObject(Thread, INFINITE); FIXME: Waiting on thread handle causes double spinlock acquisition (and subsequent crash) in PsUnblockThread - ntoskrnl/ps/thread.c */ - NtClose(Thread); - printf("Main: Terminating...\n"); - return 0; -} diff --git a/reactos/apps/tests/eventpair/makefile b/reactos/apps/tests/eventpair/makefile deleted file mode 100644 index 282845953b8..00000000000 --- a/reactos/apps/tests/eventpair/makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $Id: makefile,v 1.2 2003/11/14 17:13:17 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = eventpair - -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/fiber/.cvsignore b/reactos/apps/tests/fiber/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/fiber/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/fiber/Makefile b/reactos/apps/tests/fiber/Makefile deleted file mode 100644 index 1e3a7d6c980..00000000000 --- a/reactos/apps/tests/fiber/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# $Id: Makefile,v 1.2 2004/03/07 20:07:04 hyperion Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = fiber - -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/fiber/fiber.c b/reactos/apps/tests/fiber/fiber.c deleted file mode 100644 index 94318f56d13..00000000000 --- a/reactos/apps/tests/fiber/fiber.c +++ /dev/null @@ -1,446 +0,0 @@ -/* $Id: fiber.c,v 1.4 2004/07/07 22:29:37 gvg Exp $ -*/ - -#include -#include -#include -#include -#include - -#include -#include - -#ifndef InitializeListHead -#define InitializeListHead(PLH__) ((PLH__)->Flink = (PLH__)->Blink = (PLH__)) -#endif - -#ifndef IsListEmpty -#define IsListEmpty(PLH__) ((PLH__)->Flink == (PVOID)(PLH__)) -#endif - -#ifndef RemoveEntryList - -#define RemoveEntryList(PLE__) \ -{ \ - PLIST_ENTRY pleBack__ = (PLIST_ENTRY)((PLE__)->Blink); \ - PLIST_ENTRY pleForward__ = (PLIST_ENTRY)((PLE__)->Flink); \ - \ - pleBack__->Flink = pleForward__; \ - pleForward__->Blink = pleBack__; \ -} - -#endif - -#ifndef InsertTailList - -#define InsertTailList(PLH__, PLE__) \ -{ \ - PLIST_ENTRY pleListHead__ = (PLH__); \ - PLIST_ENTRY pleBlink__ = (PLIST_ENTRY)((PLH__)->Blink); \ - \ - (PLE__)->Flink = pleListHead__; \ - (PLE__)->Blink = pleBlink__; \ - pleBlink__->Flink = (PLE__); \ - pleListHead__->Blink = (PLE__); \ -} - -#endif - -#ifndef RemoveHeadList - -#define RemoveHeadList(PLH__) \ - (PLIST_ENTRY)((PLH__)->Flink); \ - RemoveEntryList((PLIST_ENTRY)((PLH__)->Flink)); - -#endif - -#define FIBERTEST_COUNT 500 - -struct FiberData -{ - unsigned nMagic; - unsigned nId; - unsigned nPrio; - unsigned nRealPrio; - PVOID pFiber; - LIST_ENTRY leQueue; - int nQuantumQueued; - int nBoost; - struct FiberData * pfdPrev; - int bExitPrev; -}; - -static LIST_ENTRY a_leQueues[32]; -static unsigned nQuantum = 0; -static struct FiberData * pfdLastStarveScan = NULL; - -void Fbt_Create(int); -void Fbt_Exit(void); -void Fbt_Yield(void); - -struct FiberData * Fbt_GetCurrent(void); -unsigned Fbt_GetCurrentId(void); -VOID CALLBACK Fbt_Startup(PVOID); -void Fbt_Dispatch(struct FiberData *, int); -void Fbt_AfterSwitch(struct FiberData *); - -void DoStuff(void); - -struct FiberData * Fbt_GetCurrent(VOID) -{ - return GetFiberData(); -} - -unsigned Fbt_GetCurrentId(VOID) -{ - return Fbt_GetCurrent()->nId; -} - -void Fbt_Yield(VOID) -{ - struct FiberData * pfdCur; - - pfdCur = Fbt_GetCurrent(); - - if(pfdCur->nBoost) - { - -- pfdCur->nBoost; - - if(!pfdCur->nBoost) - pfdCur->nPrio = pfdCur->nRealPrio; - } - else if((rand() % 100) > 50 - (45 * pfdCur->nPrio) / 32) - Fbt_Dispatch(pfdCur, 0); -} - -void Fbt_AfterSwitch(struct FiberData * pfdCur) -{ - struct FiberData * pfdPrev; - - pfdPrev = pfdCur->pfdPrev; - - /* The previous fiber left some homework for us */ - if(pfdPrev) - { - /* Kill the predecessor */ - if(pfdCur->bExitPrev) - { - if(pfdLastStarveScan == pfdPrev) - pfdLastStarveScan = 0; - - DeleteFiber(pfdPrev->pFiber); - free(pfdPrev); - } - /* Enqueue the previous fiber in the correct ready queue */ - else - { - /* Remember the quantum in which the previous fiber was queued */ - pfdPrev->nQuantumQueued = nQuantum; - - /* Disable the anti-starvation boost */ - if(pfdPrev->nBoost) - { - pfdPrev->nBoost = 0; - pfdPrev->nPrio = pfdPrev->nRealPrio; - } - - /* Enqueue the previous fiber */ - InsertTailList - ( - &a_leQueues[pfdPrev->nPrio], - &pfdPrev->leQueue - ); - } - } -} - -VOID CALLBACK Fbt_Startup(PVOID pParam) -{ - assert(pParam == GetFiberData()); - Fbt_AfterSwitch(pParam); - DoStuff(); - Fbt_Exit(); -} - -void Fbt_Dispatch(struct FiberData * pfdCur, int bExit) -{ - UCHAR i; - UCHAR n; - struct FiberData * pfdNext; - - assert(pfdCur == GetFiberData()); - - ++ nQuantum; - - /* Every ten quantums check for starving threads */ - /* FIXME: this implementation of starvation prevention isn't that great */ - if(nQuantum % 10 == 0) - { - int j; - int k; - int b; - int bResume; - PLIST_ENTRY ple = NULL; - - bResume = 0; - i = 0; - - /* Pick up from where we left last time */ - if(pfdLastStarveScan) - { - unsigned nPrio; - - nPrio = pfdLastStarveScan->nPrio; - - /* The last fiber we scanned for starvation isn't queued anymore */ - if(IsListEmpty(&pfdLastStarveScan->leQueue)) - /* Scan the ready queue for its priority */ - i = nPrio; - /* Last fiber for its priority level */ - else if(pfdLastStarveScan->leQueue.Flink == &a_leQueues[nPrio]) - /* Scan the ready queue for the next priority level */ - i = nPrio + 1; - /* Scan the next fiber in the ready queue */ - else - { - i = nPrio; - ple = pfdLastStarveScan->leQueue.Flink; - bResume = 1; - } - - /* Priority levels 15-31 are never checked for starvation */ - if(i >= 15) - { - if(bResume) - bResume = 0; - - i = 0; - } - } - - /* - Scan at most 16 threads, in the priority range 0-14, applying in total at - most 10 boosts. This loop scales O(1) - */ - for(j = 0, k = 0, b = 0; j < 16 && k < 15 && b < 10; ++ j) - { - unsigned nDiff; - - /* No previous state to resume from */ - if(!bResume) - { - int nQueue; - - /* Get the first element in the current queue */ - nQueue = (k + i) % 15; - - if(IsListEmpty(&a_leQueues[nQueue])) - { - ++ k; - continue; - } - - ple = (PLIST_ENTRY)a_leQueues[nQueue].Flink; - } - else - bResume = 0; - - /* Get the current fiber */ - pfdLastStarveScan = CONTAINING_RECORD(ple, struct FiberData, leQueue); - assert(pfdLastStarveScan->nMagic == 0x12345678); - assert(pfdLastStarveScan != pfdCur); - - /* Calculate the number of quantums the fiber has been in the queue */ - if(nQuantum > pfdLastStarveScan->nQuantumQueued) - nDiff = nQuantum - pfdLastStarveScan->nQuantumQueued; - else - nDiff = UINT_MAX - pfdLastStarveScan->nQuantumQueued + nQuantum; - - /* The fiber has been ready for more than 30 quantums: it's starving */ - if(nDiff > 30) - { - /* Plus one boost applied */ - ++ b; - - /* Apply the boost */ - pfdLastStarveScan->nBoost = 1; - pfdLastStarveScan->nRealPrio = pfdLastStarveScan->nPrio; - pfdLastStarveScan->nPrio = 15; - - /* Re-enqueue the fiber in the correct priority queue */ - RemoveEntryList(&pfdLastStarveScan->leQueue); - InsertTailList(&a_leQueues[15], &pfdLastStarveScan->leQueue); - } - } - } - - pfdNext = NULL; - - /* This fiber is going to die: scan all ready queues */ - if(bExit) - n = 1; - /* - Scan only ready queues for priorities greater than or equal to the priority of - the current thread (round-robin) - */ - else - n = pfdCur->nPrio + 1; - - /* This loop scales O(1) */ - for(i = 32; i >= n; -- i) - { - PLIST_ENTRY pleNext; - - /* No fiber ready for this priority level */ - if(IsListEmpty(&a_leQueues[i - 1])) - continue; - - /* Get the next ready fiber */ - pleNext = RemoveHeadList(&a_leQueues[i - 1]); - InitializeListHead(pleNext); - pfdNext = CONTAINING_RECORD(pleNext, struct FiberData, leQueue); - assert(pfdNext->pFiber != GetCurrentFiber()); - assert(pfdNext->nMagic == 0x12345678); - break; - } - - /* Next fiber chosen */ - if(pfdNext) - { - /* Give some homework to the next fiber */ - pfdNext->pfdPrev = pfdCur; - pfdNext->bExitPrev = bExit; - - /* Switch to the next fiber */ - SwitchToFiber(pfdNext->pFiber); - - /* Complete the switch back to this fiber */ - Fbt_AfterSwitch(pfdCur); - } - /* No next fiber, and current fiber exiting */ - else if(bExit) - { - PVOID pCurFiber; - - /* Delete the current fiber. This kills the thread and stops the simulation */ - if(pfdLastStarveScan == pfdCur) - pfdLastStarveScan = NULL; - - pCurFiber = pfdCur->pFiber; - free(pfdCur); - DeleteFiber(pCurFiber); - } - /* No next fiber: continue running the current one */ -} - -void Fbt_Exit(VOID) -{ - Fbt_Dispatch(GetFiberData(), 1); -} - -void Fbt_CreateFiber(int bInitial) -{ - PVOID pFiber; - struct FiberData * pData; - static int s_bFiberPrioSeeded = 0; - static LONG s_nFiberIdSeed = 0; - - pData = malloc(sizeof(struct FiberData)); - - assert(pData); - - if(bInitial) - pFiber = ConvertThreadToFiber(pData); - else - pFiber = CreateFiber(0, Fbt_Startup, pData); - - if(!s_bFiberPrioSeeded) - { - unsigned nFiberPrioSeed; - time_t tCurTime; - - tCurTime = time(NULL); - memcpy(&nFiberPrioSeed, &tCurTime, sizeof(nFiberPrioSeed)); - srand(nFiberPrioSeed); - s_bFiberPrioSeeded = 1; - } - - assert(pFiber); - - pData->nMagic = 0x12345678; - pData->nId = InterlockedIncrement(&s_nFiberIdSeed); - pData->nPrio = rand() % 32; - pData->pFiber = pFiber; - pData->nQuantumQueued = 0; - pData->nBoost = 0; - pData->nRealPrio = pData->nPrio; - pData->pfdPrev = NULL; - pData->bExitPrev = 0; - - if(bInitial) - { - InitializeListHead(&pData->leQueue); - } - else - { - InsertTailList - ( - &a_leQueues[pData->nPrio], - &pData->leQueue - ); - } -} - -void DoStuff(void) -{ - unsigned i; - unsigned n; - unsigned nId; - - n = rand() % 1000; - nId = Fbt_GetCurrentId(); - - _ftprintf(stderr, _T("[%u] BEGIN\n"), nId); - - for(i = 0; i < n; ++ i) - { - unsigned j; - unsigned m; - - _ftprintf(stderr, _T("[%u] [%u/%u]\n"), nId, i + 1, n); - - m = rand() % 1000; - - for(j = 0; j < m; ++ j) - Sleep(0); - - Fbt_Yield(); - } - - _ftprintf(stderr, _T("[%u] END\n"), nId); -} - -int _tmain(int argc, _TCHAR const * const * argv) -{ - unsigned i; - unsigned nFibers; - - if(argc > 1) - nFibers = _tcstoul(argv[1], NULL, 0); - else - nFibers = FIBERTEST_COUNT; - - for(i = 0; i < 32; ++ i) - { - InitializeListHead(&a_leQueues[i]); - } - - for(i = 0; i < nFibers; ++ i) - Fbt_CreateFiber(i == 0); - - Fbt_Startup(GetFiberData()); - - return 0; -} - -/* EOF */ diff --git a/reactos/apps/tests/global_mem/.cvsignore b/reactos/apps/tests/global_mem/.cvsignore deleted file mode 100644 index e24713815a0..00000000000 --- a/reactos/apps/tests/global_mem/.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/global_mem/Makefile b/reactos/apps/tests/global_mem/Makefile deleted file mode 100644 index 14c5b5b32c5..00000000000 --- a/reactos/apps/tests/global_mem/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# $Id: Makefile,v 1.2 2003/11/14 17:13:17 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = global_mem - -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/global_mem/global_mem.c b/reactos/apps/tests/global_mem/global_mem.c deleted file mode 100644 index b9cb7149871..00000000000 --- a/reactos/apps/tests/global_mem/global_mem.c +++ /dev/null @@ -1,1062 +0,0 @@ -/* File: global_mem.c -** -** This program is a test application used for testing correctness of the -** GlobalXXX memory API implementation. -** -** Programmer: Mark Tempel -*/ -#include -#include -#include - -/* -** All output is line wrapped to fit a 80 column screen. -** these defines control that formatting. To shrink the -** screen columns, just change the DISPLAY_COMUMNS macro. -*/ -#define DISPLAY_COLUMNS 78 -#define LINE_BUFFER_SIZE DISPLAY_COLUMNS + 2 - -/* -** This define controls the size of a memory allocation request. -** For this test suite to really be comprehensive, we should -** probably be testing many different block sizes. -*/ -#define MEM_BLOCK_SIZE 0x80000 - -/* -** This enumeration is really the return value for the program. -** All test return a TestStatus and test statuses can be combined -** with the relation TEST_CombineStatus. -*/ -typedef enum TestStatus -{ - FAILED = 0, - PASSED = 1, - SKIPPED = -1 -} TEST_STATUS; - -/*--------------------------------------------------------------------------- -** This is a relation used to combine two test statuses. -** The combine rules are as follows: -** FAIL & Anything == FAIL -** SKIPPED & Anything == Anything -** -*/ -TEST_STATUS TEST_CombineStatus(TEST_STATUS a, TEST_STATUS b) -{ - TEST_STATUS result = a; - - switch (a) - { - case PASSED: result = (PASSED == b || SKIPPED == b) ? (PASSED) : (FAILED); break; - case FAILED: result = FAILED; break; - case SKIPPED: result = b; break; - } - - return result; -} - -/*--------------------------------------------------------------------------- -** This outputs the banner border lines. -*/ -void OUTPUT_BannerLine() -{ - int c = 0; - printf("+"); - for (c = 1; c < DISPLAY_COLUMNS; c++) - { - printf("-"); - } - printf("\n"); -} - - -/*--------------------------------------------------------------------------- -** This method prints a line that has a | on the left, and is line wrapped -** to be no more that DISPLAY_COLUMNS +2 wide. -*/ -void OUTPUT_Line(const char *szLine) -{ - int spaceIndex = 0; - char output[LINE_BUFFER_SIZE]; - - memset(output, 0, DISPLAY_COLUMNS + 2); - - /*If this line is longer than DISPLAY_COLUMNS, - * break it at the first space. - */ - if (DISPLAY_COLUMNS - 2 < strlen(szLine)) - { - for (spaceIndex = DISPLAY_COLUMNS / 2; spaceIndex < DISPLAY_COLUMNS - 2; spaceIndex++) - { - if (' ' == szLine[spaceIndex]) - { - break; - } - } - - memcpy(output + 2, szLine, spaceIndex + 1); - output[0] = '|'; - output[1] = ' '; - output[strlen(output)] = '\n'; - printf(output); - - OUTPUT_Line(szLine + spaceIndex + 1); - } - else - { - sprintf(output,"| %s\n", szLine); - printf(output); - } - -} - -/*--------------------------------------------------------------------------- -** -*/ -void OUTPUT_Banner(const char *szBanner) -{ - OUTPUT_BannerLine(); - OUTPUT_Line(szBanner); - OUTPUT_BannerLine(); -} - -/*--------------------------------------------------------------------------- -** -*/ -void OUTPUT_Result(TEST_STATUS status) -{ - switch (status) - { - case PASSED: OUTPUT_Line("==> PASSED"); break; - case FAILED: OUTPUT_Line("*** FAILED"); break; - case SKIPPED: OUTPUT_Line("==> SKIPPED"); break; - } - OUTPUT_Line(""); -} - -/*--------------------------------------------------------------------------- -** -*/ -void OUTPUT_HexDword(DWORD dw) -{ - char buffer[32]; - sprintf(buffer, "0x%lX",dw); - OUTPUT_Line(buffer); -} - -/*--------------------------------------------------------------------------- -** -*/ -void OutputAllocFlags(UINT pFlags) -{ - if (pFlags & GMEM_MOVEABLE) - { - OUTPUT_Line("Movable Memory"); - } - else - { - OUTPUT_Line("Fixed Memory"); - } - - if (pFlags & GMEM_ZEROINIT) - { - OUTPUT_Line("Zero Initialized Memory"); - } -} - -/*--------------------------------------------------------------------------- -** -*/ -void OutputErrorCode() -{ - char buffer[256]; - - sprintf(buffer,"GetLastError() returned %lu", GetLastError()); - - OUTPUT_Line(buffer); -} -/*--------------------------------------------------------------------------- -** -*/ -TEST_STATUS TEST_MemoryWrite(LPVOID mem, DWORD cbSize) -{ - TEST_STATUS result = FAILED; - - if (0 == IsBadWritePtr(mem, cbSize)) - { - result = PASSED; - } - return result; -} - -/*--------------------------------------------------------------------------- -** -*/ -TEST_STATUS TEST_MemoryRead(LPVOID mem, DWORD cbSize) -{ - TEST_STATUS result = FAILED; - - if (0 == IsBadReadPtr(mem, cbSize)) - { - result = PASSED; - } - return result; -} - -/*--------------------------------------------------------------------------- -** This method tests to see if a block of global memory is movable -** by seeing if the value returned from GlobalLock is different from -** the passed in value. -*/ -int IsMovable(HGLOBAL hMem) -{ - LPVOID pMem = 0; - int rc = 0; - - pMem = GlobalLock(hMem); - if (pMem != hMem) - { - rc = 1; - } - GlobalUnlock(hMem); - - return rc; -} - -/*--------------------------------------------------------------------------- -** -*/ -TEST_STATUS TestGlobalAllocNFree(UINT allocFlags) -{ - TEST_STATUS status = SKIPPED; - HGLOBAL hTest = 0; - OUTPUT_Banner("Testing the GlobalAlloc and GlobalFree calls"); - OUTPUT_Line("Allocate a buffer"); - - OutputAllocFlags(allocFlags); - - status = FAILED; - hTest = GlobalAlloc(allocFlags, MEM_BLOCK_SIZE); - if (0 != hTest) - { - if (0 == GlobalFree(hTest)); - { - status = PASSED; - } - } - - OUTPUT_Line("Result for this run:"); - OUTPUT_Result(status); - OUTPUT_Line(""); - - return status; -} - -/*--------------------------------------------------------------------------- -** -*/ -TEST_STATUS TestGlobalLockNUnlock(UINT allocFlags) -{ - HGLOBAL hMem = 0; - LPVOID pMem = 0; - TEST_STATUS subtest = SKIPPED; - TEST_STATUS result = FAILED; - - OUTPUT_Banner("Testing the GlobalLock/Unlock functions."); - OutputAllocFlags(allocFlags); - OUTPUT_Line(""); - - hMem = GlobalAlloc(allocFlags, MEM_BLOCK_SIZE); - if (0 != hMem) - { - OUTPUT_Line("Allocated a memory block"); - - OUTPUT_Line("Testing Lock"); - pMem = GlobalLock(hMem); - if (0 != pMem) - { - OUTPUT_Result(PASSED); - - OUTPUT_Line("Testing memory for read."); - subtest = TEST_MemoryRead(pMem, MEM_BLOCK_SIZE); - OUTPUT_Result(subtest); - result = TEST_CombineStatus(PASSED, subtest); - - - OUTPUT_Line("Testing memory for write."); - subtest = TEST_MemoryRead(pMem, MEM_BLOCK_SIZE); - OUTPUT_Result(subtest); - result = TEST_CombineStatus(result, subtest); - - - OUTPUT_Line("Unlocking memory"); - if (GlobalUnlock(hMem)) - { - OUTPUT_Result(PASSED); - result = TEST_CombineStatus(result, PASSED); - } - else - { - if (NO_ERROR == GetLastError()) - { - OUTPUT_Result(PASSED); - result = TEST_CombineStatus(result, PASSED); - } - else - { - OutputErrorCode(); - OUTPUT_Result(FAILED); - result = TEST_CombineStatus(result, FAILED); - } - } - } - - OUTPUT_Line("Freeing memory"); - if (0 == GlobalFree(hMem)) - { - OUTPUT_Result(PASSED); - result = TEST_CombineStatus(result, PASSED); - } - else - { - OutputErrorCode(); - OUTPUT_Result(FAILED); - result = TEST_CombineStatus(result, FAILED); - } - } - return result; -} - -/*--------------------------------------------------------------------------- -** -*/ -TEST_STATUS TestGlobalReAllocFixed() -{ - HGLOBAL hMem = 0; - HGLOBAL hReAlloced = 0; - LPVOID pMem = 0; - TEST_STATUS subtest = SKIPPED; - TEST_STATUS result = SKIPPED; - - OUTPUT_Line("Testing GlobalReAlloc() on memory allocated as GMEM_FIXED"); - - /* Case 1: convert a fixed block to a movable block. */ - OUTPUT_Line("Allocating buffer"); - hMem = GlobalAlloc(GMEM_FIXED, MEM_BLOCK_SIZE); - if (0 != hMem) - { - OUTPUT_Line("Testing to see if this is converted into a movable block"); - hReAlloced = GlobalReAlloc(hMem, MEM_BLOCK_SIZE + 100, GMEM_MOVEABLE | GMEM_MODIFY); - if (0 == hReAlloced) - { - OUTPUT_Line("GlobalReAlloc failed-- returned NULL"); - subtest = TEST_CombineStatus(subtest, FAILED); - OUTPUT_Result(subtest); - } - else - { - hMem = hReAlloced; - if (0 == IsMovable(hMem)) - { - OUTPUT_Line("GlobalReAlloc returned a fixed pointer."); - subtest = TEST_CombineStatus(subtest, FAILED); - OUTPUT_Result(subtest); - } - else - { - pMem = GlobalLock(hMem); - subtest = TEST_CombineStatus(subtest, PASSED); - subtest = TEST_CombineStatus(subtest, TEST_MemoryRead(pMem, MEM_BLOCK_SIZE + 100)); - if (FAILED == subtest) - { - OUTPUT_Line("Memory Read failed."); - } - subtest = TEST_CombineStatus(subtest, TEST_MemoryWrite(pMem, MEM_BLOCK_SIZE + 100)); - if (FAILED == subtest) - { - OUTPUT_Line("Memory Write failed."); - } - GlobalUnlock(hMem); - } - } - - GlobalFree(hMem); - } - else - { - OUTPUT_Line("Global Alloc Failed."); - subtest = TEST_CombineStatus(subtest, FAILED); - } - OUTPUT_Line("Subtest result:"); - OUTPUT_Result(subtest); - OUTPUT_Line(""); - - result = TEST_CombineStatus(result, subtest); - subtest = SKIPPED; - - /* case 2 only move a fixed block */ - OUTPUT_Line("Allocating buffer"); - hMem = GlobalAlloc(GMEM_FIXED, MEM_BLOCK_SIZE); - if (0 != hMem) - { - OUTPUT_Line("Testing to see if a new fixed block is returned."); - hReAlloced = GlobalReAlloc(hMem, MEM_BLOCK_SIZE - 100, GMEM_MOVEABLE); - if (0 == hReAlloced) - { - OUTPUT_Line("GlobalReAlloc failed-- returned NULL"); - subtest = TEST_CombineStatus(subtest, FAILED); - OUTPUT_Result(subtest); - } - else - { - OUTPUT_Line("Alloced Handle: "); - OUTPUT_HexDword((DWORD)hMem); - OUTPUT_Line("ReAlloced Handle: "); - OUTPUT_HexDword((DWORD)hReAlloced); - if (hMem == hReAlloced) - { - OUTPUT_Line("GlobalReAlloc returned the same pointer. The documentation states that this is wrong, but Windows NT works this way."); - } - - hMem = hReAlloced; - subtest = TEST_CombineStatus(subtest, PASSED); - subtest = TEST_CombineStatus(subtest, TEST_MemoryRead((LPVOID)hMem, MEM_BLOCK_SIZE - 100)); - subtest = TEST_CombineStatus(subtest, TEST_MemoryWrite((LPVOID)hMem, MEM_BLOCK_SIZE - 100)); - } - - GlobalFree(hMem); - } - else - { - subtest = TEST_CombineStatus(subtest, FAILED); - } - OUTPUT_Line("Subtest result:"); - OUTPUT_Result(subtest); - OUTPUT_Line(""); - - result = TEST_CombineStatus(result, subtest); - subtest = SKIPPED; - - /* Case 3: re-allocate a fixed block in place */ - OUTPUT_Line("Allocating buffer"); - hMem = GlobalAlloc(GMEM_FIXED, MEM_BLOCK_SIZE); - if (0 != hMem) - { - OUTPUT_Line("Testing to see if a fixed pointer is reallocated in place."); - hReAlloced = GlobalReAlloc(hMem, MEM_BLOCK_SIZE - 100, 0); - if (0 == hReAlloced) - { - OUTPUT_Line("GlobalReAlloc failed-- returned NULL"); - subtest = TEST_CombineStatus(subtest, FAILED); - OUTPUT_Result(subtest); - } - else - { - OUTPUT_Line("Alloced Handle: "); - OUTPUT_HexDword((DWORD)hMem); - OUTPUT_Line("ReAlloced Handle: "); - OUTPUT_HexDword((DWORD)hReAlloced); - if (hMem != hReAlloced) - { - OUTPUT_Line("GlobalReAlloc returned a different."); - subtest = TEST_CombineStatus(subtest, FAILED); - OUTPUT_Result(subtest); - } - else - { - subtest = TEST_CombineStatus(subtest, PASSED); - subtest = TEST_CombineStatus(subtest, TEST_MemoryRead((LPVOID)hMem, MEM_BLOCK_SIZE - 100)); - subtest = TEST_CombineStatus(subtest, TEST_MemoryWrite((LPVOID)hMem, MEM_BLOCK_SIZE - 100)); - } - } - - GlobalFree(hMem); - } - else - { - subtest = TEST_CombineStatus(subtest, FAILED); - } - OUTPUT_Line("Subtest result:"); - OUTPUT_Result(subtest); - OUTPUT_Line(""); - - result = TEST_CombineStatus(result, subtest); - - OUTPUT_Line(""); - return result; -} -/*--------------------------------------------------------------------------- -** -*/ -TEST_STATUS TestGlobalReAllocMovable() -{ - HGLOBAL hMem = 0; - HGLOBAL hReAlloced = 0; - LPVOID pMem = 0; - TEST_STATUS subtest = SKIPPED; - TEST_STATUS result = SKIPPED; - - OUTPUT_Line("Testing GlobalReAlloc() on memory allocated as GMGM_MOVEABLE"); - - /* case 1 test reallocing a movable block that is unlocked. */ - OUTPUT_Line("Allocating buffer"); - hMem = GlobalAlloc(GMEM_MOVEABLE, MEM_BLOCK_SIZE); - if (0 != hMem) - { - OUTPUT_Line("Testing GlobalReAlloc on a unlocked block."); - hReAlloced = GlobalReAlloc(hMem, MEM_BLOCK_SIZE - 100, 0); - if (0 == hReAlloced) - { - OUTPUT_Line("GlobalReAlloc failed-- returned NULL"); - subtest = TEST_CombineStatus(subtest, FAILED); - OUTPUT_Result(subtest); - } - else - { - OUTPUT_Line("Alloced Handle: "); - OUTPUT_HexDword((DWORD)hMem); - OUTPUT_Line("ReAlloced Handle: "); - OUTPUT_HexDword((DWORD)hReAlloced); - - pMem = GlobalLock(hReAlloced); - hMem = hReAlloced; - subtest = TEST_CombineStatus(subtest, PASSED); - subtest = TEST_CombineStatus(subtest, TEST_MemoryRead(pMem, MEM_BLOCK_SIZE - 100)); - subtest = TEST_CombineStatus(subtest, TEST_MemoryWrite(pMem, MEM_BLOCK_SIZE - 100)); - GlobalUnlock(hReAlloced); - } - - GlobalFree(hMem); - } - else - { - subtest = TEST_CombineStatus(subtest, FAILED); - } - OUTPUT_Line("Subtest result:"); - OUTPUT_Result(subtest); - OUTPUT_Line(""); - - result = TEST_CombineStatus(result, subtest); - subtest = SKIPPED; - - /* Case 2: re-allocate a moveable block that is locked */ - OUTPUT_Line("Allocating buffer"); - hMem = GlobalAlloc(GMEM_MOVEABLE, MEM_BLOCK_SIZE); - if (0 != hMem) - { - - OUTPUT_Line("Testing GlobalReAlloc on a locked block."); - pMem = GlobalLock(hMem); - hReAlloced = GlobalReAlloc(hMem, MEM_BLOCK_SIZE - 100, 0); - if (0 == hReAlloced) - { - OUTPUT_Line("GlobalReAlloc failed-- returned NULL"); - subtest = TEST_CombineStatus(subtest, FAILED); - OUTPUT_Result(subtest); - } - else - { - OUTPUT_Line("Alloced Handle: "); - OUTPUT_HexDword((DWORD)hMem); - OUTPUT_Line("ReAlloced Handle: "); - OUTPUT_HexDword((DWORD)hReAlloced); - if (hMem != hReAlloced) - { - OUTPUT_Line("GlobalReAlloc returned a different block."); - } - pMem = GlobalLock(hReAlloced); - subtest = TEST_CombineStatus(subtest, PASSED); - subtest = TEST_CombineStatus(subtest, TEST_MemoryRead(pMem, MEM_BLOCK_SIZE - 100)); - subtest = TEST_CombineStatus(subtest, TEST_MemoryWrite(pMem , MEM_BLOCK_SIZE - 100)); - GlobalUnlock(hReAlloced); - - } - - GlobalUnlock(hMem); - - GlobalFree(hMem); - } - else - { - subtest = TEST_CombineStatus(subtest, FAILED); - } - OUTPUT_Line("Subtest result:"); - OUTPUT_Result(subtest); - OUTPUT_Line(""); - - result = TEST_CombineStatus(result, subtest); - - OUTPUT_Line(""); - return result; -} - -/*--------------------------------------------------------------------------- -** -*/ -TEST_STATUS TestGlobalReAlloc() -{ - OUTPUT_Banner("Testing GlobalReAlloc()"); - TEST_STATUS result = SKIPPED; - - result = TEST_CombineStatus(result, TestGlobalReAllocFixed()); - result = TEST_CombineStatus(result, TestGlobalReAllocMovable()); - - OUTPUT_Line("GlobalReAlloc test result:"); - OUTPUT_Result(result); - return result; -} - -/*--------------------------------------------------------------------------- -** -*/ -TEST_STATUS TestGlobalFlagsMoveable() -{ - HGLOBAL hMem = 0; - UINT uFlags = 0; - TEST_STATUS result = SKIPPED; - - OUTPUT_Line("Test for the proper lock count"); - - hMem = GlobalAlloc(GMEM_MOVEABLE, MEM_BLOCK_SIZE); - if (0 != hMem) - { - - OUTPUT_Line("Testing initial allocation"); - - OUTPUT_Line("Testing for a lock of 0"); - uFlags = GlobalFlags(hMem); - if (((GMEM_LOCKCOUNT & uFlags) == 0)) /*no locks*/ - { - result = TEST_CombineStatus(result, PASSED); - } - else - { - result = TEST_CombineStatus(result, FAILED); - } - OUTPUT_Result(result); - - OUTPUT_Line("Pointer from handle: "); - OUTPUT_HexDword((DWORD)GlobalLock(hMem)); - - OUTPUT_Line("Testing after a lock"); - OUTPUT_Line("Testing for a lock of 1"); - uFlags = GlobalFlags(hMem); - if (((GMEM_LOCKCOUNT & uFlags) == 1)) /*no locks*/ - { - result = TEST_CombineStatus(result, PASSED); - } - else - { - result = TEST_CombineStatus(result, FAILED); - } - OUTPUT_Result(result); - - GlobalUnlock(hMem); - OUTPUT_Line("Testing after an unlock"); - OUTPUT_Line("Testing for a lock of 0"); - uFlags = GlobalFlags(hMem); - if (((GMEM_LOCKCOUNT & uFlags) == 0)) /*no locks*/ - { - result = TEST_CombineStatus(result, PASSED); - } - else - { - result = TEST_CombineStatus(result, FAILED); - } - OUTPUT_Result(result); - } - else - { - OUTPUT_Line("GlobalAlloc failed!"); - result = TEST_CombineStatus(result, FAILED); - } - - OUTPUT_Line("Test for discarded memory"); - OUTPUT_Line("Allocating an empty moveable block---automatically marked as discarded"); - hMem = GlobalAlloc(GMEM_MOVEABLE, 0); /*allocate a discarded block*/ - if (0 != hMem) - { - OUTPUT_Line("Allocation handle: "); - OUTPUT_HexDword((DWORD)hMem); - OUTPUT_Line("Testing for a discarded flag"); - uFlags = GlobalFlags(hMem); - if (0 != (uFlags & GMEM_DISCARDED)) /*discarded*/ - { - result = TEST_CombineStatus(result, PASSED); - } - else - { - result = TEST_CombineStatus(result, FAILED); - } - OUTPUT_Line("Flags:"); - OUTPUT_HexDword(uFlags); - OUTPUT_Result(result); - - GlobalFree(hMem); - } - else - { - OUTPUT_Line("GlobalAlloc failed!"); - result = TEST_CombineStatus(result, FAILED); - } - return result; -} - - -/*--------------------------------------------------------------------------- -** -*/ -TEST_STATUS TestGlobalFlagsFixed() -{ - HGLOBAL hMem = 0; - UINT uFlags = 0; - TEST_STATUS result = SKIPPED; - - OUTPUT_Line("Testing for correct handling of GMEM_FIXED memory"); - hMem = GlobalAlloc(GMEM_FIXED, MEM_BLOCK_SIZE); - if (0 != hMem) - { - - OUTPUT_Line("Allocation handle: "); - OUTPUT_HexDword((DWORD)hMem); - - OUTPUT_Line("Testing initial allocation"); - OUTPUT_Line("Testing for non-discarded and lock of 0"); - uFlags = GlobalFlags(hMem); - if (((GMEM_LOCKCOUNT & uFlags) == 0) && /*no locks*/ - (((uFlags >> 8) & 0xff) == 0 )) /*not discarded*/ - { - result = TEST_CombineStatus(result, PASSED); - } - else - { - result = TEST_CombineStatus(result, FAILED); - } - OUTPUT_Result(result); - - OUTPUT_Line("Pointer from handle: "); - OUTPUT_HexDword((DWORD)GlobalLock(hMem)); - OUTPUT_Line("Testing after a lock"); - OUTPUT_Line("Testing for non-discarded and lock of 0"); - uFlags = GlobalFlags(hMem); - if (((GMEM_LOCKCOUNT & uFlags) == 0) && /*no locks*/ - (((uFlags >> 8) & 0xff) == 0 )) /*not discarded*/ - { - result = TEST_CombineStatus(result, PASSED); - } - else - { - result = TEST_CombineStatus(result, FAILED); - } - OUTPUT_Result(result); - - GlobalFree(hMem); - } - else - { - OUTPUT_Line("GlobalAlloc failed!"); - result = TEST_CombineStatus(result, FAILED); - } - - return result; -} -/*--------------------------------------------------------------------------- -** -*/ -TEST_STATUS TestGlobalFlags() -{ - OUTPUT_Banner("Testing GlobalFlags()"); - TEST_STATUS result = SKIPPED; - - result = TEST_CombineStatus(result, TestGlobalFlagsFixed()); - result = TEST_CombineStatus(result, TestGlobalFlagsMoveable()); - - OUTPUT_Line("GlobalFlags result:"); - OUTPUT_Result(result); - return result; -} -/*--------------------------------------------------------------------------- -** -*/ -TEST_STATUS TestGlobalHandle() -{ - HGLOBAL hMem = 0; - HGLOBAL hTest = 0; - PVOID pMem = 0; - TEST_STATUS subtest = SKIPPED; - TEST_STATUS result = SKIPPED; - - OUTPUT_Banner("Testing GlobalHandle()"); - - OUTPUT_Line("Testing GlobalHandle with a block of GMEM_FIXED memory"); - hMem = GlobalAlloc(GMEM_FIXED, MEM_BLOCK_SIZE); - if (0 != hMem) - { - - OUTPUT_Line("Allocation handle: "); - OUTPUT_HexDword((DWORD)hMem); - - hTest = GlobalHandle(hMem); - if (hMem == hTest) - { - subtest = TEST_CombineStatus(subtest, PASSED); - } - else - { - OUTPUT_Line("GlobalHandle returned:"); - OUTPUT_HexDword((DWORD)hTest); - subtest = TEST_CombineStatus(subtest, FAILED); - } - - GlobalFree(hMem); - } - else - { - OUTPUT_Line("GlobalAlloc failed!"); - subtest = TEST_CombineStatus(subtest, FAILED); - } - - OUTPUT_Line("Result from subtest:"); - OUTPUT_Result(subtest); - result = TEST_CombineStatus(result, subtest); - - - subtest = SKIPPED; - OUTPUT_Line("Testing GlobalHandle with a block of GMEM_MOVEABLE memory"); - hMem = GlobalAlloc(GMEM_MOVEABLE, MEM_BLOCK_SIZE); - if (0 != hMem) - { - - OUTPUT_Line("Allocation handle: "); - OUTPUT_HexDword((DWORD)hMem); - pMem = GlobalLock(hMem); - hTest = GlobalHandle(pMem); - if (hMem == hTest) - { - subtest = TEST_CombineStatus(subtest, PASSED); - } - else - { - OUTPUT_Line("GlobalHandle returned:"); - OUTPUT_HexDword((DWORD)hTest); - subtest = TEST_CombineStatus(subtest, FAILED); - } - - GlobalUnlock(hMem); - GlobalFree(hMem); - } - else - { - OUTPUT_Line("GlobalAlloc failed!"); - subtest = TEST_CombineStatus(subtest, FAILED); - } - - OUTPUT_Line("Result from subtest:"); - OUTPUT_Result(subtest); - result = TEST_CombineStatus(result, subtest); - - - OUTPUT_Line("Global Handle test results:"); - OUTPUT_Result(result); - return result; -} - -/*--------------------------------------------------------------------------- -** -*/ -TEST_STATUS TestGlobalSize() -{ - HGLOBAL hMem = 0; - SIZE_T size = 0; - TEST_STATUS subtest = SKIPPED; - TEST_STATUS result = SKIPPED; - OUTPUT_Banner("Testing GlobalSize()"); - - OUTPUT_Line("Testing GlobalSize with a block of GMEM_FIXED memory"); - hMem = GlobalAlloc(GMEM_FIXED, MEM_BLOCK_SIZE); - if (0 != hMem) - { - size = GlobalSize(hMem); - if (MEM_BLOCK_SIZE <= size) - { - subtest = TEST_CombineStatus(subtest, PASSED); - } - else - { - OUTPUT_Line("GlobalSize returned:"); - OUTPUT_HexDword(size); - subtest = TEST_CombineStatus(subtest, FAILED); - } - - GlobalFree(hMem); - } - else - { - OUTPUT_Line("GlobalAlloc failed!"); - subtest = TEST_CombineStatus(subtest, FAILED); - } - - OUTPUT_Line("Result from subtest:"); - OUTPUT_Result(subtest); - result = TEST_CombineStatus(result, subtest); - - OUTPUT_Line("Testing GlobalSize with a block of GMEM_MOVEABLE memory"); - hMem = GlobalAlloc(GMEM_MOVEABLE, MEM_BLOCK_SIZE); - if (0 != hMem) - { - size = GlobalSize(hMem); - if (MEM_BLOCK_SIZE <= size) - { - subtest = TEST_CombineStatus(subtest, PASSED); - } - else - { - OUTPUT_Line("GlobalSize returned:"); - OUTPUT_HexDword(size); - subtest = TEST_CombineStatus(subtest, FAILED); - } - - GlobalFree(hMem); - } - else - { - OUTPUT_Line("GlobalAlloc failed!"); - subtest = TEST_CombineStatus(subtest, FAILED); - } - - OUTPUT_Line("Result from subtest:"); - OUTPUT_Result(subtest); - result = TEST_CombineStatus(result, subtest); - - OUTPUT_Line("Testing GlobalSize with discarded memory"); - hMem = GlobalAlloc(GMEM_MOVEABLE, 0); - if (0 != hMem) - { - size = GlobalSize(hMem); - if (0 == size) - { - subtest = TEST_CombineStatus(subtest, PASSED); - } - else - { - OUTPUT_Line("GlobalSize returned:"); - OUTPUT_HexDword(size); - subtest = TEST_CombineStatus(subtest, FAILED); - } - - GlobalFree(hMem); - } - else - { - OUTPUT_Line("GlobalAlloc failed!"); - subtest = TEST_CombineStatus(subtest, FAILED); - } - - OUTPUT_Line("Result from subtest:"); - OUTPUT_Result(subtest); - result = TEST_CombineStatus(result, subtest); - - OUTPUT_Line("Test result:"); - OUTPUT_Result(result); - return result; -} - -/*--------------------------------------------------------------------------- -** -*/ -TEST_STATUS TestGlobalDiscard() -{ - HGLOBAL hMem = 0; - HGLOBAL hTest = 0; - DWORD uFlags = 0; - TEST_STATUS subtest = SKIPPED; - TEST_STATUS result = SKIPPED; - - OUTPUT_Banner("Testing GlobalDiscard()"); - hMem = GlobalAlloc(GMEM_MOVEABLE, MEM_BLOCK_SIZE); - if (0 != hMem) - { - OUTPUT_Line("Allocation handle: "); - OUTPUT_HexDword((DWORD)hMem); - - hTest = GlobalDiscard(hMem); - if (0 == hTest) - { - OUTPUT_Line("GlobalDiscard returned NULL"); - subtest = TEST_CombineStatus(subtest, FAILED); - } - else - { - uFlags = GlobalFlags(hTest); - OUTPUT_Line("Flags from the new memory block."); - OUTPUT_HexDword(uFlags); - if (0 != (uFlags & GMEM_DISCARDED)) - { - subtest = TEST_CombineStatus(subtest, PASSED); - } - else - { - OUTPUT_Line("Block is not marked as discardable."); - subtest = TEST_CombineStatus(subtest, FAILED); - } - } - - GlobalFree(hTest); - } - else - { - OUTPUT_Line("GlobalAlloc failed!"); - subtest = TEST_CombineStatus(subtest, FAILED); - } - - OUTPUT_Line("Result from subtest:"); - OUTPUT_Result(subtest); - - result = TEST_CombineStatus(result, subtest); - - OUTPUT_Result(result); - return result; -} - -/*--------------------------------------------------------------------------- -** -*/ -int main(int argc, char ** argv) -{ - TEST_STATUS test_set = SKIPPED; - OUTPUT_Banner("Testing GlobalXXX memory management functions."); - - test_set = TEST_CombineStatus(test_set, TestGlobalAllocNFree(GPTR)); - test_set = TEST_CombineStatus(test_set, TestGlobalAllocNFree(GHND)); - test_set = TEST_CombineStatus(test_set, TestGlobalAllocNFree(GMEM_FIXED)); - test_set = TEST_CombineStatus(test_set, TestGlobalAllocNFree(GMEM_MOVEABLE)); - - if (FAILED == test_set) - { - OUTPUT_Line("Skipping any further tests. GlobalAlloc/Free fails."); - OUTPUT_Result(test_set); - return test_set; - } - - test_set = TEST_CombineStatus(test_set, TestGlobalLockNUnlock(GPTR)); - test_set = TEST_CombineStatus(test_set, TestGlobalLockNUnlock(GHND)); - test_set = TEST_CombineStatus(test_set, TestGlobalLockNUnlock(GMEM_FIXED)); - test_set = TEST_CombineStatus(test_set, TestGlobalLockNUnlock(GMEM_MOVEABLE)); - - test_set = TEST_CombineStatus(test_set, TestGlobalReAlloc()); - - test_set = TEST_CombineStatus(test_set, TestGlobalFlags()); - - test_set = TEST_CombineStatus(test_set, TestGlobalHandle()); - - test_set = TEST_CombineStatus(test_set, TestGlobalSize()); - - test_set = TEST_CombineStatus(test_set, TestGlobalDiscard()); - - /* output the result for the entire set of tests*/ - OUTPUT_Banner("Test suite result"); - OUTPUT_Result(test_set); - return test_set; -} diff --git a/reactos/apps/tests/gradient/.cvsignore b/reactos/apps/tests/gradient/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/gradient/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/gradient/gradient.c b/reactos/apps/tests/gradient/gradient.c deleted file mode 100644 index e291b2101ec..00000000000 --- a/reactos/apps/tests/gradient/gradient.c +++ /dev/null @@ -1,181 +0,0 @@ -#include -#include -#include - -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 = "GradientClass"; - 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("GradientClass", - "GradientFill Test", - WS_OVERLAPPEDWINDOW|WS_HSCROLL|WS_VSCROLL, - 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); - - 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) -{ - HDC hDC; - - switch(msg) - { - case WM_PAINT: - { - PAINTSTRUCT ps; - TRIVERTEX vert [5] ; - GRADIENT_TRIANGLE gTRi[3]; - GRADIENT_RECT gRect[2]; - hDC = BeginPaint(hWnd, &ps); - - vert [0] .x = 0; - vert [0] .y = 0; - vert [0] .Red = 0xff00; - vert [0] .Green = 0xff00; - vert [0] .Blue = 0xff00; - vert [0] .Alpha = 0x0000; - - vert [1] .x = 300; - vert [1] .y = 20; - vert [1] .Red = 0x0000; - vert [1] .Green = 0x0000; - vert [1] .Blue = 0xff00; - vert [1] .Alpha = 0x0000; - - vert [2] .x = 100; - vert [2] .y = 200; - vert [2] .Red = 0xff00; - vert [2] .Green = 0x0000; - vert [2] .Blue = 0x0000; - vert [2] .Alpha = 0x0000; - - vert [3] .x = 250; - vert [3] .y = 300; - vert [3] .Red = 0x8000; - vert [3] .Green = 0x8000; - vert [3] .Blue = 0x0000; - vert [3] .Alpha = 0x0000; - - vert [4] .x = 325; - vert [4] .y = 300; - vert [4] .Red = 0x0000; - vert [4] .Green = 0xff00; - vert [4] .Blue = 0x0000; - vert [4] .Alpha = 0x0000; - - gTRi[0].Vertex1 = 0; - gTRi[0].Vertex2 = 1; - gTRi[0].Vertex3 = 2; - - gTRi[1].Vertex1 = 1; - gTRi[1].Vertex2 = 2; - gTRi[1].Vertex3 = 3; - - gTRi[2].Vertex1 = 1; - gTRi[2].Vertex2 = 3; - gTRi[2].Vertex3 = 4; - - GdiGradientFill(hDC,vert,5,&gTRi,3,GRADIENT_FILL_TRIANGLE); - - - vert [0] .x = 5; - vert [0] .y = 200; - vert [0] .Red = 0x0000; - vert [0] .Green = 0x0000; - vert [0] .Blue = 0x0000; - vert [0] .Alpha = 0x0000; - - vert [1] .x = 90; - vert [1] .y = 240; - vert [1] .Red = 0x0000; - vert [1] .Green = 0x0000; - vert [1] .Blue = 0xff00; - vert [1] .Alpha = 0x0000; - - vert [2] .x = 5; - vert [2] .y = 245; - vert [2] .Red = 0x0000; - vert [2] .Green = 0x0000; - vert [2] .Blue = 0x0000; - vert [2] .Alpha = 0x0000; - - vert [3] .x = 90; - vert [3] .y = 300; - vert [3] .Red = 0x0000; - vert [3] .Green = 0x0000; - vert [3] .Blue = 0xff00; - vert [3] .Alpha = 0x0000; - - gRect[0].UpperLeft = 0; - gRect[0].LowerRight = 1; - - gRect[1].UpperLeft = 2; - gRect[1].LowerRight = 3; - - GdiGradientFill(hDC,vert,4,&gRect[0],1,GRADIENT_FILL_RECT_H); - GdiGradientFill(hDC,vert,4,&gRect[1],1,GRADIENT_FILL_RECT_V); - - EndPaint(hWnd, &ps); - break; - } - - case WM_DESTROY: - PostQuitMessage(0); - break; - - default: - return DefWindowProc(hWnd, msg, wParam, lParam); - } - return 0; -} diff --git a/reactos/apps/tests/gradient/makefile b/reactos/apps/tests/gradient/makefile deleted file mode 100644 index d4988c2da10..00000000000 --- a/reactos/apps/tests/gradient/makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $Id: makefile,v 1.1 2004/02/08 21:57:35 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = gradient - -TARGET_SDKLIBS = 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/guithreadinfo/.cvsignore b/reactos/apps/tests/guithreadinfo/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/guithreadinfo/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/guithreadinfo/guithreadinfo.c b/reactos/apps/tests/guithreadinfo/guithreadinfo.c deleted file mode 100644 index 8e8da78b0cf..00000000000 --- a/reactos/apps/tests/guithreadinfo/guithreadinfo.c +++ /dev/null @@ -1,132 +0,0 @@ -#include -#include -#include - -static GUITHREADINFO gti; -//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; - - wc.lpszClassName = "GuiThreadInfoClass"; - 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("GuiThreadInfoClass", - "GetGUIThreadInfo", - WS_OVERLAPPEDWINDOW|WS_HSCROLL|WS_VSCROLL, - 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"); - - gti.cbSize = sizeof(GUITHREADINFO); - GetGUIThreadInfo(0, >i); - - SetTimer(hWnd, 1, 1000, NULL); - ShowWindow(hWnd, nCmdShow); - - 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; - char str[255]; - - switch(msg) - { - - case WM_PAINT: - hDC = BeginPaint(hWnd, &ps); - wsprintf(str, "flags: "); - if(gti.flags & GUI_16BITTASK) lstrcat(str, "GUI_16BITTASK "); - if(gti.flags & GUI_CARETBLINKING) lstrcat(str, "GUI_CARETBLINKING "); - if(gti.flags & GUI_INMENUMODE) lstrcat(str, "GUI_INMENUMODE "); - if(gti.flags & GUI_INMOVESIZE) lstrcat(str, "GUI_INMOVESIZE "); - if(gti.flags & GUI_POPUPMENUMODE) lstrcat(str, "GUI_POPUPMENUMODE "); - if(gti.flags & GUI_SYSTEMMENUMODE) lstrcat(str, "GUI_SYSTEMMENUMODE "); - TextOut(hDC, 10, 10, str, strlen(str)); - - wsprintf(str, "hwndActive == %08X", gti.hwndActive); - TextOut(hDC, 10, 30, str, strlen(str)); - wsprintf(str, "hwndFocus == %08X", gti.hwndFocus); - TextOut(hDC, 10, 50, str, strlen(str)); - wsprintf(str, "hwndCapture == %08X", gti.hwndCapture); - TextOut(hDC, 10, 70, str, strlen(str)); - wsprintf(str, "hwndMenuOwner == %08X", gti.hwndMenuOwner); - TextOut(hDC, 10, 90, str, strlen(str)); - wsprintf(str, "hwndMoveSize == %08X", gti.hwndMoveSize); - TextOut(hDC, 10, 110, str, strlen(str)); - wsprintf(str, "hwndCaret == %08X", gti.hwndCaret); - TextOut(hDC, 10, 130, str, strlen(str)); - wsprintf(str, "rcCaret == (%lu, %lu, %lu, %lu)", gti.rcCaret.left, gti.rcCaret.top, gti.rcCaret.right, gti.rcCaret.bottom); - TextOut(hDC, 10, 150, str, strlen(str)); - - wsprintf(str, "GetGuiResources for the current process: %08X", GetCurrentProcess()); - TextOut(hDC, 10, 180, str, strlen(str)); - wsprintf(str, "GetGuiResources: GR_GDIOBJECTS == %04X", GetGuiResources(GetCurrentProcess(), GR_GDIOBJECTS)); - TextOut(hDC, 10, 200, str, strlen(str)); - wsprintf(str, "GetGuiResources: GR_USEROBJECTS == %04x", GetGuiResources(GetCurrentProcess(), GR_USEROBJECTS)); - TextOut(hDC, 10, 220, str, strlen(str)); - EndPaint(hWnd, &ps); - break; - - case WM_TIMER: - GetGUIThreadInfo(0, >i); - InvalidateRect(hWnd, NULL, TRUE); - break; - - case WM_DESTROY: - PostQuitMessage(0); - break; - - default: - return DefWindowProc(hWnd, msg, wParam, lParam); - } - return 0; -} diff --git a/reactos/apps/tests/guithreadinfo/makefile b/reactos/apps/tests/guithreadinfo/makefile deleted file mode 100644 index 64e0cb6fed6..00000000000 --- a/reactos/apps/tests/guithreadinfo/makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $Id: makefile,v 1.1 2003/11/18 23:33:31 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = guithreadinfo - -TARGET_SDKLIBS = kernel32.a gdi32.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/hello/.cvsignore b/reactos/apps/tests/hello/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/hello/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/hello/hello.c b/reactos/apps/tests/hello/hello.c deleted file mode 100644 index 9e793383d21..00000000000 --- a/reactos/apps/tests/hello/hello.c +++ /dev/null @@ -1,8 +0,0 @@ -#include -#include - -int main(int argc, char* argv[]) -{ - printf("Hello world\n"); - return(0); -} diff --git a/reactos/apps/tests/hello/makefile b/reactos/apps/tests/hello/makefile deleted file mode 100644 index a7cb506069e..00000000000 --- a/reactos/apps/tests/hello/makefile +++ /dev/null @@ -1,21 +0,0 @@ -# $Id: makefile,v 1.17 2003/11/14 17:13:17 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = hello - -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/hivetest/.cvsignore b/reactos/apps/tests/hivetest/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/hivetest/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/hivetest/hivetest.c b/reactos/apps/tests/hivetest/hivetest.c deleted file mode 100644 index 2dc2fa31f54..00000000000 --- a/reactos/apps/tests/hivetest/hivetest.c +++ /dev/null @@ -1,1196 +0,0 @@ -#include -#include -#include -#include -#include -#include - -HANDLE OutputHandle; -HANDLE InputHandle; - -void dprintf(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); -} - -void do_enumeratekey(PWSTR Name) -{ - ULONG Index,Length,i; - KEY_BASIC_INFORMATION KeyInformation[5]; - NTSTATUS Status; - OBJECT_ATTRIBUTES ObjectAttributes; - HANDLE hKey1; - UNICODE_STRING KeyName; - - RtlInitUnicodeString(&KeyName, Name); - InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE - , NULL, NULL); - Status=NtOpenKey( &hKey1, MAXIMUM_ALLOWED, &ObjectAttributes); - dprintf("NtEnumerateKey : \n"); - Index=0; - while(Status == STATUS_SUCCESS) - { - Status=NtEnumerateKey(hKey1,Index++,KeyBasicInformation - ,&KeyInformation[0], sizeof(KeyInformation) - ,&Length); - if(Status== STATUS_SUCCESS) - { - dprintf("\tSubKey Name = "); - for (i=0;icn%QsOz)*{@oMAe>gRuof_QZ+nnN<^C^zT3p{YL8!w!v!|~LxQ1AyP zTijSt@0`ov%z|(n$B7$5Nm|&@I?n!n=t?gHs2{FFmjV#mm7D@%+dF#z{2`)z1p*mF zX9mcQ&I}Ntc;Z&}iaTK{s9)D6RtM(^)l$45H^U!VIq~}xW61qF`~a6P;P?rgsLPF4 qB)GC@$f<%l@X{O=W0#7$593vx6@Xm20R?*ea{OajUp8X31aqG$e diff --git a/reactos/apps/tests/icontest/icontest.c b/reactos/apps/tests/icontest/icontest.c deleted file mode 100644 index e93adcf4323..00000000000 --- a/reactos/apps/tests/icontest/icontest.c +++ /dev/null @@ -1,216 +0,0 @@ -#include -#include "resource.h" -#include -#include - -#ifndef GetCursorInfo - #define _GetCursorInfo -#endif - -const char titleDrwIco[] = "DrawIcon Output"; -const char titleMask[] = "Mask(AND image)"; -const char titleXor[] = "XOR(color image)"; -const char file[] = "Icon from file:"; -const char res[] = "Icon from Resorce:"; -const char cursor[] = "Current Cursor:"; -const char cursormask[] = "Cursor Mask Bitmap"; -const char cursorcolor[] = "Cursor Color Bitmap"; - -#ifdef _GetCursorInfo -typedef BOOL (__stdcall *GETCURSORINFO) (CURSORINFO *CursorInfo); - -static GETCURSORINFO GetCursorInfo = NULL; -#endif - -HFONT tf; -HINSTANCE hInst; - -LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM); - -int WINAPI -WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpszCmdLine, - int nCmdShow) -{ - WNDCLASS wc; - MSG msg; - HWND hWnd; - - hInst = hInstance; - - #ifdef _GetCursorInfo - GetCursorInfo = (GETCURSORINFO)GetProcAddress(GetModuleHandleW(L"user32.dll"), "GetCursorInfo"); - #endif - - wc.lpszClassName = "IconTestClass"; - 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_BTNFACE + 1); - wc.lpszMenuName = NULL; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - if (RegisterClass(&wc) == 0) - { - DbgPrint("RegisterClass failed (last error 0x%X)\n", GetLastError()); - return(1); - } - - hWnd = CreateWindow("IconTestClass", - "Icon Test", - WS_OVERLAPPEDWINDOW|WS_HSCROLL|WS_VSCROLL, - CW_USEDEFAULT, - CW_USEDEFAULT, - 480, - 480, - NULL, - NULL, - hInstance, - NULL); - if (hWnd == NULL) - { - DbgPrint("CreateWindow failed (last error 0x%X)\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); - - SetTimer(hWnd, 1, 1000, NULL); - - while(GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - return msg.wParam; -} - -LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - PAINTSTRUCT ps; - HDC hDC; - HICON hIcon; - HGDIOBJ hOld; - HDC hMemDC; - CURSORINFO cursorinfo; - ICONINFO iconinfo; - BITMAP bmp; - RECT rc; - CHAR str[20]; - - switch(msg) - { - case WM_PAINT: - hDC = BeginPaint(hWnd, &ps); - SelectObject(hDC, tf); - SetBkMode(hDC, TRANSPARENT); - - TextOut(hDC, 160, 10, file, strlen(file)); - TextOut(hDC, 15, 85, titleDrwIco, strlen(titleDrwIco)); - TextOut(hDC, 160, 85, titleMask, strlen(titleMask)); - TextOut(hDC, 300, 85, titleXor, strlen(titleXor)); - - hIcon = LoadImage(NULL, "icon.ico", IMAGE_ICON, 0, 0, LR_DEFAULTSIZE|LR_LOADFROMFILE); - DrawIcon(hDC,50,50,hIcon); - - hMemDC = CreateCompatibleDC(hDC); - GetIconInfo(hIcon, &iconinfo); - DestroyIcon(hIcon); - - hOld = SelectObject(hMemDC, iconinfo.hbmMask); - BitBlt(hDC, 200, 50, 32, 32, hMemDC, 0, 0, SRCCOPY); - SelectObject(hMemDC, iconinfo.hbmColor); - BitBlt(hDC, 350, 50, 32, 32, hMemDC, 0, 0, SRCCOPY); - - DeleteObject(iconinfo.hbmMask); - DeleteObject(iconinfo.hbmColor); - - TextOut(hDC, 145, 150, res, strlen(res)); - TextOut(hDC, 15, 225, titleDrwIco, strlen(titleDrwIco)); - TextOut(hDC, 160, 225, titleMask, strlen(titleMask)); - TextOut(hDC, 300, 225, titleXor, strlen(titleXor)); - - hIcon = LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE); - DrawIcon(hDC,50,190,hIcon); - - GetIconInfo(hIcon, &iconinfo); - DestroyIcon(hIcon); - - SelectObject(hMemDC, iconinfo.hbmMask); - BitBlt(hDC, 200, 190, 32, 32, hMemDC, 0, 0, SRCCOPY); - SelectObject(hMemDC, iconinfo.hbmColor); - BitBlt(hDC, 350, 190, 32, 32, hMemDC, 0, 0, SRCCOPY); - - DeleteObject(iconinfo.hbmMask); - DeleteObject(iconinfo.hbmColor); - - cursorinfo.cbSize = sizeof(CURSORINFO); - if(GetCursorInfo(&cursorinfo)) - { - if(cursorinfo.hCursor && cursorinfo.flags) - { - TextOut(hDC, 160, 290, cursor, strlen(cursor)); - DrawIcon(hDC, 50, 330, cursorinfo.hCursor); - GetIconInfo(cursorinfo.hCursor, &iconinfo); - TextOut(hDC, 15, 365, titleDrwIco, strlen(titleDrwIco)); - - sprintf(str, "Hotspot: %ld; %ld", iconinfo.xHotspot, iconinfo.yHotspot); - TextOut(hDC, 15, 380, str, strlen(str)); - - if(iconinfo.hbmMask) - { - GetObjectW(iconinfo.hbmMask, sizeof(BITMAP), &bmp); - SelectObject(hMemDC, iconinfo.hbmMask); - BitBlt(hDC, 200, 330, bmp.bmWidth, bmp.bmHeight, hMemDC, 0, 0, SRCCOPY); - DeleteObject(iconinfo.hbmMask); - TextOut(hDC, 160, 365 - 32 + bmp.bmHeight, cursormask, strlen(cursormask)); - - sprintf(str, "%dBPP", bmp.bmBitsPixel); - TextOut(hDC, 160, 380 - 32 + bmp.bmHeight, str, strlen(str)); - } - - if(iconinfo.hbmColor) - { - GetObjectW(iconinfo.hbmColor, sizeof(BITMAP), &bmp); - SelectObject(hMemDC, iconinfo.hbmColor); - BitBlt(hDC, 350, 330, bmp.bmWidth, bmp.bmHeight, hMemDC, 0, 0, SRCCOPY); - DeleteObject(iconinfo.hbmColor); - TextOut(hDC, 300, 365 - 32 + bmp.bmHeight, cursorcolor, strlen(cursorcolor)); - - sprintf(str, "%dBPP", bmp.bmBitsPixel); - TextOut(hDC, 300, 380 - 32 + bmp.bmHeight, str, strlen(str)); - } - } - } - - SelectObject(hMemDC, hOld); - - DeleteObject(hMemDC); - EndPaint(hWnd, &ps); - break; - - case WM_TIMER: - rc.left = 0; - rc.top = 330; - rc.right = 480; - rc.bottom = 480; - InvalidateRect(hWnd, &rc, TRUE); - break; - - case WM_DESTROY: - PostQuitMessage(0); - break; - - default: - return DefWindowProc(hWnd, msg, wParam, lParam); - } - return 0; -} diff --git a/reactos/apps/tests/icontest/icontest.rc b/reactos/apps/tests/icontest/icontest.rc deleted file mode 100644 index 5003913f534..00000000000 --- a/reactos/apps/tests/icontest/icontest.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include -#include -#include "resource.h" - -IDI_ICON ICON DISCARDABLE "icon.ico" diff --git a/reactos/apps/tests/icontest/makefile b/reactos/apps/tests/icontest/makefile deleted file mode 100644 index 39dd5cec5e5..00000000000 --- a/reactos/apps/tests/icontest/makefile +++ /dev/null @@ -1,21 +0,0 @@ -PATH_TO_TOP = ../../.. - -TARGET_NORC = no - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = icontest - -TARGET_SDKLIBS = ntdll.a 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/icontest/resource.h b/reactos/apps/tests/icontest/resource.h deleted file mode 100644 index 5d9eb75e1c4..00000000000 --- a/reactos/apps/tests/icontest/resource.h +++ /dev/null @@ -1 +0,0 @@ -#define IDI_ICON 101 diff --git a/reactos/apps/tests/iptest/iptest.cpp b/reactos/apps/tests/iptest/iptest.cpp deleted file mode 100644 index e4420609e1c..00000000000 --- a/reactos/apps/tests/iptest/iptest.cpp +++ /dev/null @@ -1,476 +0,0 @@ -#include -#include -#include -#include -extern "C" { - typedef unsigned short u_short; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -}; - -/* Undis */ -extern "C" VOID ExpInitLookasideLists(); - -std::list output_packets; -DWORD DebugTraceLevel = 0x7fffffff; -PVOID GlobalBufferPool, GlobalPacketPool; - -#define MAX_DG_SIZE 16384 - -char hwaddr[6] = { 0x08, 0x00, 0x20, 0x0b, 0xb7, 0xbb }; - -char hdr[14] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x00 }; - -#define STRINGIFY(x) #x - -void display_row( char *data, int off, int len ) { - int i; - - printf( "%08x:", off ); - for( i = off; i < len && i < off + 16; i++ ) { - printf( " %02x", data[i] & 0xff ); - } - - printf( " -- " ); - - for( i = off; i < len && i < off + 16; i++ ) { - printf( "%c", (data[i] >= ' ') ? data[i] : '.' ); - } - - printf( "\n" ); -} - -void connect_complete( void *context, NTSTATUS status, unsigned long count ) { - printf( "Connection: status %x\n", status ); -} - -void receive_complete( void *context, NTSTATUS status, unsigned long count ) { - printf( "Receive: status %s (bytes %d)\n", status, count ); - if( !status && count ) { - for( int off = 0; off < count; off += 16 ) { - display_row( (char *)context, off, count ); - } - printf( "\n" ); - } -} - -class SocketObject { -public: - virtual ~SocketObject() { } - virtual int send( char *buf, int len, int *bytes, - struct sockaddr_in *si ) = 0; - virtual int recv( char *buf, int len, int *bytes, - struct sockaddr_in *si ) = 0; -}; - -UINT TdiAddressSizeFromType( UINT AddressType ) { - switch( AddressType ) { - case TDI_ADDRESS_TYPE_IP: - return sizeof(TA_IP_ADDRESS); - default: - KeBugCheck( 0 ); - } - return 0; -} - -NTSTATUS TdiBuildNullConnectionInfoInPlace -( PTDI_CONNECTION_INFORMATION ConnInfo, - ULONG Type ) -/* - * FUNCTION: Builds a NULL TDI connection information structure - * ARGUMENTS: - * ConnectionInfo = Address of buffer to place connection information - * Type = TDI style address type (TDI_ADDRESS_TYPE_XXX). - * RETURNS: - * Status of operation - */ -{ - ULONG TdiAddressSize; - - TdiAddressSize = TdiAddressSizeFromType(Type); - - RtlZeroMemory(ConnInfo, - sizeof(TDI_CONNECTION_INFORMATION) + - TdiAddressSize); - - ConnInfo->OptionsLength = sizeof(ULONG); - ConnInfo->RemoteAddressLength = 0; - ConnInfo->RemoteAddress = NULL; - - return STATUS_SUCCESS; -} - -NTSTATUS TdiBuildNullConnectionInfo -( PTDI_CONNECTION_INFORMATION *ConnectionInfo, - ULONG Type ) -/* - * FUNCTION: Builds a NULL TDI connection information structure - * ARGUMENTS: - * ConnectionInfo = Address of buffer pointer to allocate connection - * information in - * Type = TDI style address type (TDI_ADDRESS_TYPE_XXX). - * RETURNS: - * Status of operation - */ -{ - PTDI_CONNECTION_INFORMATION ConnInfo; - ULONG TdiAddressSize; - NTSTATUS Status; - - TdiAddressSize = TdiAddressSizeFromType(Type); - - ConnInfo = (PTDI_CONNECTION_INFORMATION) - ExAllocatePool(NonPagedPool, - sizeof(TDI_CONNECTION_INFORMATION) + - TdiAddressSize); - if (!ConnInfo) - return STATUS_INSUFFICIENT_RESOURCES; - - Status = TdiBuildNullConnectionInfoInPlace( ConnInfo, Type ); - - if (!NT_SUCCESS(Status)) - ExFreePool( ConnInfo ); - else - *ConnectionInfo = ConnInfo; - - ConnInfo->RemoteAddress = (PTA_ADDRESS)&ConnInfo[1]; - ConnInfo->RemoteAddressLength = TdiAddressSize; - - return Status; -} - - -UINT TaLengthOfTransportAddress( PTRANSPORT_ADDRESS Addr ) { - UINT AddrLen = 2 * sizeof( ULONG ) + Addr->Address[0].AddressLength; - printf("AddrLen %x\n", AddrLen); - return AddrLen; -} - -NTSTATUS -TdiBuildConnectionInfoInPlace -( PTDI_CONNECTION_INFORMATION ConnectionInfo, - PTA_ADDRESS Address ) { - NTSTATUS Status = STATUS_SUCCESS; - - RtlCopyMemory( ConnectionInfo->RemoteAddress, - Address, - ConnectionInfo->RemoteAddressLength ); - - return Status; -} - -NTSTATUS -TdiBuildConnectionInfo -( PTDI_CONNECTION_INFORMATION *ConnectionInfo, - PTA_ADDRESS Address ) { - NTSTATUS Status = TdiBuildNullConnectionInfo( ConnectionInfo, - Address->AddressType ); - - if( NT_SUCCESS(Status) ) - TdiBuildConnectionInfoInPlace( *ConnectionInfo, Address ); - - return Status; -} - -class TCPSocketObject : public SocketObject { -public: - TCPSocketObject( std::string host, int port, NTSTATUS *status ) { - TA_IP_ADDRESS ConnectTo; - PTDI_CONNECTION_INFORMATION ConnInfo; - - ConnectTo.TAAddressCount = 1; - ConnectTo.Address[0].AddressLength = sizeof(TDI_ADDRESS_IP); - ConnectTo.Address[0].AddressType = TDI_ADDRESS_TYPE_IP; - ConnectTo.Address[0].Address[0].sin_port = htons(port); - ConnectTo.Address[0].Address[0].in_addr = 0x6a020a0a; - - TdiBuildConnectionInfo( &ConnInfo, (PTA_ADDRESS)&ConnectTo ); - - Connection = TCPAllocateConnectionEndpoint( NULL ); - *status = TCPSocket( Connection, - AF_INET, - SOCK_STREAM, IPPROTO_TCP ); - if( !*status ) - *status = TCPConnect( Connection, - ConnInfo, - NULL, - connect_complete, - NULL ); - } - - ~TCPSocketObject() { - TCPClose( Connection ); - if( Connection ) TCPFreeConnectionEndpoint( Connection ); - } - - int send( char *buf, int len, int *bytes, struct sockaddr_in *si ) { - NTSTATUS Status = STATUS_UNSUCCESSFUL; - - if( Connection ) - Status = TCPSendData( Connection, - buf, - len, - (PULONG)bytes, - 0 ); - return Status; - } - - int recv( char *buf, int len, int *bytes, struct sockaddr_in *si ) { - NTSTATUS Status = STATUS_UNSUCCESSFUL; - - if( Connection ) - Status = TCPSendData( Connection, - buf, - len, - (PULONG)bytes, - 0 ); - return Status; - } - -private: - PCONNECTION_ENDPOINT Connection; -}; - -VOID SendPacket( PVOID Context, - PNDIS_PACKET NdisPacket, - UINT Offset, - PVOID LinkAddress, - USHORT Type ) { - PCHAR DataOut; - PUCHAR Addr = (PUCHAR)LinkAddress; - UINT Size; - std::string output_packet; - - printf( "Sending packet: %02x:%02x:%02x:%02x:%02x:%02x\n", - Addr[0], Addr[1], Addr[2], Addr[3], Addr[4], Addr[5] ); - - GetDataPtr( NdisPacket, Offset, &DataOut, &Size ); - for( int off = 0; off < Size; off += 16 ) { - display_row( DataOut, off, Size ); - } - printf( "\n" ); - - output_packet += std::string( hwaddr, sizeof(hwaddr) ); - output_packet += std::string( (char *)LinkAddress, sizeof(hwaddr) ); - output_packet += (char)(Type >> 8); - output_packet += (char)Type; - output_packet += std::string( DataOut + Offset, Size - Offset ); - - output_packets.push_back( output_packet ); -} - -#if 0 -UINT CopyBufferToBufferChain -( PNDIS_BUFFER DstBuffer, UINT DstOffset, PCHAR SrcData, UINT Length ) { - assert( 0 ); -} -#endif - -int main( int argc, char **argv ) { - int asock = INVALID_SOCKET, selret, dgrecv, fromsize, err, port = 5001; - int bytes, adapter_id, mtu, speed; - char datagram[MAX_DG_SIZE]; - struct fd_set readf; - struct timeval tv; - struct sockaddr_in addr_from = { AF_INET }, addr_to; - std::string word, cmdin, host; - std::list::iterator i; - WSADATA wsadata; - NTSTATUS Status; - UNICODE_STRING RegistryUnicodePath; - PCONNECTION_ENDPOINT Connection; - PIP_INTERFACE Interface; - IP_PACKET IPPacket; - LLIP_BIND_INFO BindInfo; - SocketObject *S = NULL; - - RtlInitUnicodeString - ( &RegistryUnicodePath, - L"\\SYSTEM\\CurrentControlSet\\Services" - L"\\Tcpip" ); - - ExpInitLookasideLists(); - - WSAStartup( 0x101, &wsadata ); - - if( argc > 1 ) port = atoi(argv[1]); - - IPStartup( &RegistryUnicodePath ); - - BindInfo.Context = NULL; - BindInfo.HeaderSize = sizeof(ETH_HEADER); - BindInfo.MTU = 1500; /* MTU for ethernet */ - BindInfo.Address = (PUCHAR)hwaddr; - BindInfo.AddressLength = sizeof(hwaddr); - BindInfo.Transmit = SendPacket; - - IPCreateInterface( &BindInfo ); - - asock = socket( AF_INET, SOCK_DGRAM, 0 ); - - addr_from.sin_port = htons( port ); - - if( bind( asock, (struct sockaddr *)&addr_from, sizeof( addr_from ) ) ) { - printf( "Bind error\n" ); - return 0; - } - - while( true ) { - FD_ZERO( &readf ); - FD_SET( asock, &readf ); - tv.tv_sec = 0; - tv.tv_usec = 10000; - selret = select( asock + 1, &readf, NULL, NULL, &tv ); - - if( FD_ISSET( asock, &readf ) ) { - fromsize = sizeof( addr_from ); - dgrecv = recvfrom( asock, datagram, sizeof(datagram), 0, - (struct sockaddr *)&addr_from, &fromsize ); - - if( datagram[0] == 'C' && datagram[1] == 'M' && - datagram[2] == 'D' && datagram[3] == ' ' ) { - int theport, bytes, recvret, off, bytin; - struct sockaddr_in nam; - std::string faddr, word; - std::istringstream - cmdin( std::string( datagram + 4, dgrecv - 4 ) ); - - cmdin >> word; - -/* UDP Section */ - if( word == "udpsocket" ) { -/* TCP Section */ - } else if( word == "tcpsocket" ) { - cmdin >> host >> port; - S = new TCPSocketObject( host, port, &Status ); - fprintf( stderr, "Socket: Result %x\n", Status ); - } else if( word == "close" ) { - TCPClose( Connection ); - TCPFreeConnectionEndpoint( Connection ); - } else if( word == "type" ) { - std::string therest = &cmdin.str()[word.size()]; - char* p = &therest[0]; - p += strspn ( p, " \t" ); - char* src = p; - char* dst = p; - while ( *src ) - { - char c = *src++; - if ( c == '\r' || c == '\n' ) break; - if ( c == '\\' ) - { - c = *src++; - switch ( c ) - { - case 'b': c = '\b'; break; - case 'n': c = '\n'; break; - case 'r': c = '\r'; break; - case 't': c = '\t'; break; - case 'v': c = '\v'; break; - } - } - *dst++ = c; - } - *dst = '\0'; - if( S ) - err = S->send( p, strlen(p), &bytes, NULL ); - if( err > 0 ) { bytin = err; err = 0; } - - if( err ) - fprintf ( stderr, "OskitTCPConnect: error %d\n", - err ); - else { - printf ( "wrote %d bytes\n", bytin ); - } - } else if( word == "send" ) { - off = 0; - while( cmdin >> word ) { - datagram[off++] = - atoi( (std::string("0x") + word).c_str() ); - } - - if( (err = S->send( datagram, off, &bytin, NULL )) != 0 ) { - fprintf( stderr, "OskitTCPConnect: error %d\n", err ); - } else { - printf( "wrote %d bytes\n", bytin ); - } - } else if( word == "recv" ) { - cmdin >> bytes; - - if( (err = S->recv( datagram, - sizeof(datagram), - &bytes, - NULL )) != 0 ) { - fprintf( stderr, "OskitTCPRecv: error %d\n", err ); - } - -/* Misc section */ - } else if( word == "end" ) { - return 0; - } - } else if( dgrecv > 14 ) { - addr_to = addr_from; - - if( datagram[12] == 8 && datagram[13] == 6 ) { - /* Answer arp query */ - char laddr[4]; - /* Mark patch as to the previous sender */ - memcpy( datagram + 32, datagram + 6, 6 ); - memcpy( datagram, datagram + 6, 6 ); - /* Mark packet as from us */ - memcpy( datagram + 22, hwaddr, 6 ); - memcpy( datagram + 6, hwaddr, 6 ); - /* Swap inet addresses */ - memcpy( laddr, datagram + 28, 4 ); - memcpy( datagram + 28, datagram + 38, 4 ); - memcpy( datagram + 38, laddr, 4 ); - /* Set reply opcode */ - datagram[21] = 2; - - err = sendto( asock, datagram, dgrecv, 0, - (struct sockaddr *)&addr_to, - sizeof(addr_to) ); - - if( err != 0 ) - printf( "sendto: %d\n", err ); - } else { - memcpy( hdr, datagram + 6, 6 ); - memcpy( hdr + 6, datagram, 6 ); - memcpy( hdr + 12, datagram + 12, 2 ); - IPPacket.Header = datagram; - IPPacket.Data = datagram + 14; - IPPacket.TotalSize = dgrecv; - IPReceive( Interface, &IPPacket ); - } - } - } - - IPTimeout(NULL, NULL, NULL, NULL); - - for( i = output_packets.begin(); i != output_packets.end(); i++ ) { - err = sendto( asock, i->c_str(), i->size(), 0, - (struct sockaddr *)&addr_to, sizeof(addr_to) ); - - fprintf( stderr, "** SENDING PACKET %d bytes **\n", i->size() ); - - if( err != 0 ) - printf( "sendto: %d\n", err ); - } - - output_packets.clear(); - } -} - diff --git a/reactos/apps/tests/iptest/makefile b/reactos/apps/tests/iptest/makefile deleted file mode 100644 index 190e5af9dbe..00000000000 --- a/reactos/apps/tests/iptest/makefile +++ /dev/null @@ -1,26 +0,0 @@ -# -# $Id: makefile,v 1.1 2004/10/04 04:26:00 arty Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = iptest - -TARGET_SDKLIBS = ws2_32.a ip.a oskittcp.a undis.a ntdll.a - -TARGET_OBJECTS = iptest.o - -TARGET_CPPFLAGS = -I$(PATH_TO_TOP)/drivers/lib/oskittcp/include -I$(PATH_TO_TOP)/w32api/include -I$(PATH_TO_TOP)/include -I$(PATH_TO_TOP)/drivers/net/tcpip/include -g - -TARGET_GCCLIBS = stdc++ - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/isotest/.cvsignore b/reactos/apps/tests/isotest/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/isotest/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/isotest/isotest.c b/reactos/apps/tests/isotest/isotest.c deleted file mode 100644 index bfba7f99c5e..00000000000 --- a/reactos/apps/tests/isotest/isotest.c +++ /dev/null @@ -1,230 +0,0 @@ -/* - * isotest - display cdrom information - */ - -#include -//#include -#include -#include -#include -#include - - -void HexDump(char *buffer, ULONG size) -{ - ULONG offset = 0; - unsigned char *ptr; - - while (offset < (size & ~15)) - { - ptr = (unsigned char*)((ULONG)buffer + offset); - printf("%08lx %02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx-%02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx", - offset, - ptr[0], - ptr[1], - ptr[2], - ptr[3], - ptr[4], - ptr[5], - ptr[6], - ptr[7], - ptr[8], - ptr[9], - ptr[10], - ptr[11], - ptr[12], - ptr[13], - ptr[14], - ptr[15]); - - printf(" %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n", - isprint(ptr[0])?ptr[0]:'.', - isprint(ptr[1])?ptr[1]:'.', - isprint(ptr[2])?ptr[2]:'.', - isprint(ptr[3])?ptr[3]:'.', - isprint(ptr[4])?ptr[4]:'.', - isprint(ptr[5])?ptr[5]:'.', - isprint(ptr[6])?ptr[6]:'.', - isprint(ptr[7])?ptr[7]:'.', - isprint(ptr[8])?ptr[8]:'.', - isprint(ptr[9])?ptr[9]:'.', - isprint(ptr[10])?ptr[10]:'.', - isprint(ptr[11])?ptr[11]:'.', - isprint(ptr[12])?ptr[12]:'.', - isprint(ptr[13])?ptr[13]:'.', - isprint(ptr[14])?ptr[14]:'.', - isprint(ptr[15])?ptr[15]:'.'); - - offset += 16; - } - - ptr = (unsigned char*)((ULONG)buffer + offset); - if (offset < size) - { - printf("%08lx ", offset); - while (offset < size) - { - printf(" %02hx", *ptr); - offset++; - ptr++; - } - } - - printf("\n\n"); -} - - -#ifndef EVENT_ALL_ACCESS -#define EVENT_ALL_ACCESS (0x1f0003L) -#endif - -BOOL -ReadBlock(HANDLE FileHandle, - PVOID Buffer, - PLARGE_INTEGER Offset, - ULONG Length, - PULONG BytesRead) -{ - IO_STATUS_BLOCK IoStatusBlock; - OBJECT_ATTRIBUTES ObjectAttributes; - NTSTATUS Status; - HANDLE EventHandle; - - InitializeObjectAttributes(&ObjectAttributes, - NULL, 0, NULL, NULL); - - Status = NtCreateEvent(&EventHandle, - EVENT_ALL_ACCESS, - &ObjectAttributes, - TRUE, - FALSE); - if (!NT_SUCCESS(Status)) - { - printf("NtCreateEvent() failed\n"); - return(FALSE); - } - - Status = NtReadFile(FileHandle, - EventHandle, - NULL, - NULL, - &IoStatusBlock, - Buffer, - Length, - Offset, - NULL); - if (Status == STATUS_PENDING) - { - NtWaitForSingleObject(EventHandle, FALSE, NULL); - Status = IoStatusBlock.Status; - } - - NtClose(EventHandle); - - if (Status != STATUS_PENDING && BytesRead != NULL) - { - *BytesRead = IoStatusBlock.Information; - } - if (!NT_SUCCESS(Status) && Status != STATUS_END_OF_FILE) - { - printf("ReadBlock() failed (Status: %lx)\n", Status); - return(FALSE); - } - - return(TRUE); -} - - - -int main (int argc, char *argv[]) -{ - HANDLE hDisk; - DWORD dwRead; - char *Buffer; - CHAR Filename[80]; - LARGE_INTEGER FilePosition; - - if (argc != 2) - { - printf("Usage: isotest [Drive:]\n"); - return 0; - } - - strcpy(Filename, "\\\\.\\"); - strcat(Filename, argv[1]); - - hDisk = CreateFile(Filename, - GENERIC_READ, - FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, - OPEN_EXISTING, - 0, - NULL); - if (hDisk == INVALID_HANDLE_VALUE) - { - printf("CreateFile(): Invalid disk handle!\n"); - return 0; - } - - Buffer = (char*)malloc(2048); - if (Buffer == NULL) - { - CloseHandle(hDisk); - printf("Out of memory!\n"); - return 0; - } - memset(Buffer, 0, 2048); - - - FilePosition.QuadPart = 16 * 2048; -#if 0 - SetLastError(NO_ERROR); - SetFilePointer(hDisk, - FilePosition.u.LowPart, - &FilePosition.u.HighPart, - FILE_BEGIN); - if (GetLastError() != NO_ERROR) - { - CloseHandle(hDisk); - free(Buffer); - printf("SetFilePointer() failed!\n"); - return 0; - } - - if (ReadFile(hDisk, - Buffer, - 2048, - &dwRead, - NULL) == FALSE) - { - CloseHandle(hDisk); - free(Buffer); - printf("ReadFile() failed!\n"); - return 0; - } -#endif - - if (ReadBlock(hDisk, - Buffer, - &FilePosition, - 2048, - &dwRead) == FALSE) - { - CloseHandle(hDisk); - free(Buffer); -#if 0 - printf("ReadBlock() failed!\n"); -#endif - return 0; - } - - HexDump(Buffer, 128); - - CloseHandle(hDisk); - - free(Buffer); - - return 0; -} - -/* EOF */ diff --git a/reactos/apps/tests/isotest/makefile b/reactos/apps/tests/isotest/makefile deleted file mode 100644 index 6a8be725368..00000000000 --- a/reactos/apps/tests/isotest/makefile +++ /dev/null @@ -1,25 +0,0 @@ -# $Id: makefile,v 1.3 2003/11/14 17:13:17 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = isotest - -#TARGET_CFLAGS = -fnative_struct - -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/kernel32/.cvsignore b/reactos/apps/tests/kernel32/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/kernel32/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/kernel32/Makefile b/reactos/apps/tests/kernel32/Makefile deleted file mode 100644 index 37b0c465549..00000000000 --- a/reactos/apps/tests/kernel32/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# $Id: Makefile,v 1.2 2004/05/04 17:25:18 navaraf 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 -DWINVER=0x0500 - -TARGET_NAME = kernel32_test - -TARGET_SDKLIBS = kernel32.a - -TARGET_OBJECTS = \ - testlist.o \ - atom.o \ - change.o \ - codepage.o \ - comm.o \ - console.o \ - directory.o \ - drive.o \ - environ.o \ - file.o \ - format_msg.o \ - heap.o \ - locale.o \ - mailslot.o \ - path.o \ - pipe.o \ - process.o \ - profile.o \ - thread.o \ - virtual.o - -#FIXME alloc.o \ - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/kernel32/Makefile.in b/reactos/apps/tests/kernel32/Makefile.in deleted file mode 100644 index 7e6923e58e5..00000000000 --- a/reactos/apps/tests/kernel32/Makefile.in +++ /dev/null @@ -1,33 +0,0 @@ -TOPSRCDIR = @top_srcdir@ -TOPOBJDIR = ../../.. -SRCDIR = @srcdir@ -VPATH = @srcdir@ -TESTDLL = kernel32.dll -IMPORTS = kernel32 - -CTESTS = \ - alloc.c \ - atom.c \ - change.c \ - codepage.c \ - comm.c \ - console.c \ - directory.c \ - drive.c \ - environ.c \ - file.c \ - format_msg.c \ - generated.c \ - heap.c \ - locale.c \ - mailslot.c \ - path.c \ - pipe.c \ - process.c \ - profile.c \ - thread.c \ - virtual.c - -@MAKE_TEST_RULES@ - -### Dependencies: diff --git a/reactos/apps/tests/kernel32/alloc.c b/reactos/apps/tests/kernel32/alloc.c deleted file mode 100644 index ae02789506d..00000000000 --- a/reactos/apps/tests/kernel32/alloc.c +++ /dev/null @@ -1,408 +0,0 @@ -/* - * Unit test suite for memory allocation functions. - * - * Copyright 2002 Geoffrey Hausheer - * - * 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 "winerror.h" - - - /* The following functions don't have tests, because either I don't know how - to test them, or they are WinNT only, or require multiple threads. - Since the last two issues shouldn't really stop the tests from being - written, assume for now that it is all due to the first case - HeapCompact - HeapLock - HeapQueryInformation - HeapSetInformation - HeapUnlock - HeapValidate - HeapWalk -*/ -/* In addition, these features aren't being tested - HEAP_NO_SERIALIZE - HEAP_GENERATE_EXCEPTIONS - STATUS_ACCESS_VIOLATION (error code from HeapAlloc) -*/ - -static void test_Heap(void) -{ - SYSTEM_INFO sysInfo; - ULONG memchunk; - HANDLE heap; - LPVOID mem1,mem1a,mem3; - UCHAR *mem2,*mem2a; - UINT error,i; - DWORD dwSize; - -/* Retrieve the page size for this system */ - sysInfo.dwPageSize=0; - GetSystemInfo(&sysInfo); - ok(sysInfo.dwPageSize>0,"GetSystemInfo should return a valid page size\n"); - -/* Create a Heap with a minimum and maximum size */ -/* Note that Windows and Wine seem to behave a bit differently with respect - to memory allocation. In Windows, you can't access all the memory - specified in the heap (due to overhead), so choosing a reasonable maximum - size for the heap was done mostly by trial-and-error on Win2k. It may need - more tweaking for otherWindows variants. -*/ - memchunk=10*sysInfo.dwPageSize; - heap=HeapCreate(0,2*memchunk,5*memchunk); - -/* Check that HeapCreate allocated the right amount of ram */ - todo_wine { - /* Today HeapCreate seems to return a memory block larger than specified. - MSDN says the maximum heap size should be dwMaximumSize rounded up to the - nearest page boundary - */ - mem1=HeapAlloc(heap,0,5*memchunk+1); - ok(mem1==NULL,"HeapCreate allocated more Ram than it should have\n"); - if(mem1) { - HeapFree(heap,0,mem1); - } - } - -/* Check that a normal alloc works */ - mem1=HeapAlloc(heap,0,memchunk); - ok(mem1!=NULL,"HeapAlloc failed\n"); - if(mem1) { - ok(HeapSize(heap,0,mem1)>=memchunk, "HeapAlloc should return a big enough memory block\n"); - } - -/* Check that a 'zeroing' alloc works */ - mem2=HeapAlloc(heap,HEAP_ZERO_MEMORY,memchunk); - ok(mem2!=NULL,"HeapAlloc failed\n"); - if(mem2) { - ok(HeapSize(heap,0,mem2)>=memchunk,"HeapAlloc should return a big enough memory block\n"); - error=0; - for(i=0;i=memchunk+5*sysInfo.dwPageSize,"HeapReAlloc failed\n"); - error=0; - for(i=0;i<5*sysInfo.dwPageSize;i++) { - if(mem2a[memchunk+i]!=0) { - error=1; - } - } - ok(!error,"HeapReAlloc should have zeroed out it's allocated memory\n"); - } - -/* Check that HeapRealloc honours HEAP_REALLOC_IN_PLACE_ONLY */ - error=0; - mem1a=HeapReAlloc(heap,HEAP_REALLOC_IN_PLACE_ONLY,mem1,memchunk+sysInfo.dwPageSize); - if(mem1a!=NULL) { - if(mem1a!=mem1) { - error=1; - } - } - ok(mem1a==NULL || error==0,"HeapReAlloc didn't honour HEAP_REALLOC_IN_PLACE_ONLY\n"); - -/* Check that HeapFree works correctly */ - if(mem1a) { - ok(HeapFree(heap,0,mem1a),"HeapFree failed\n"); - } else { - ok(HeapFree(heap,0,mem1),"HeapFree failed\n"); - } - if(mem2a) { - ok(HeapFree(heap,0,mem2a),"HeapFree failed\n"); - } else { - ok(HeapFree(heap,0,mem2),"HeapFree failed\n"); - } - - /* 0-length buffer */ - mem1 = HeapAlloc(heap, 0, 0); - ok(mem1 != NULL, "Reserved memory\n"); - - dwSize = HeapSize(heap, 0, mem1); - /* should work with 0-length buffer */ - ok((dwSize >= 0) && (dwSize < 0xFFFFFFFF), - "The size of the 0-length buffer\n"); - ok(HeapFree(heap, 0, mem1), "Freed the 0-length buffer\n"); - -/* Check that HeapDestry works */ - ok(HeapDestroy(heap),"HeapDestroy failed\n"); -} - -/* The following functions don't have tests, because either I don't know how - to test them, or they are WinNT only, or require multiple threads. - Since the last two issues shouldn't really stop the tests from being - written, assume for now that it is all due to the first case - GlobalFlags - GlobalMemoryStatus - GlobalMemoryStatusEx -*/ -/* In addition, these features aren't being tested - GMEM_DISCADABLE - GMEM_NOCOMPACT -*/ -static void test_Global(void) -{ - ULONG memchunk; - HGLOBAL mem1,mem2,mem2a,mem2b; - UCHAR *mem2ptr; - UINT error,i; - memchunk=100000; - - SetLastError(NO_ERROR); -/* Check that a normal alloc works */ - mem1=GlobalAlloc(0,memchunk); - ok(mem1!=NULL,"GlobalAlloc failed\n"); - if(mem1) { - ok(GlobalSize(mem1)>=memchunk, "GlobalAlloc should return a big enough memory block\n"); - } - -/* Check that a 'zeroing' alloc works */ - mem2=GlobalAlloc(GMEM_ZEROINIT,memchunk); - ok(mem2!=NULL,"GlobalAlloc failed: error=%ld\n",GetLastError()); - if(mem2) { - ok(GlobalSize(mem2)>=memchunk,"GlobalAlloc should return a big enough memory block\n"); - mem2ptr=GlobalLock(mem2); - ok(mem2ptr==mem2,"GlobalLock should have returned the same memory as was allocated\n"); - if(mem2ptr) { - error=0; - for(i=0;i=2*memchunk,"GlobalReAlloc failed\n"); - mem2ptr=GlobalLock(mem2a); - ok(mem2ptr!=NULL,"GlobalLock Failed\n"); - if(mem2ptr) { - error=0; - for(i=0;i=memchunk, "LocalAlloc should return a big enough memory block\n"); - } - -/* Check that a 'zeroing' and lock alloc works */ - mem2=LocalAlloc(LMEM_ZEROINIT|LMEM_MOVEABLE,memchunk); - ok(mem2!=NULL,"LocalAlloc failed: error=%ld\n",GetLastError()); - if(mem2) { - ok(LocalSize(mem2)>=memchunk,"LocalAlloc should return a big enough memory block\n"); - mem2ptr=LocalLock(mem2); - ok(mem2ptr!=NULL,"LocalLock: error=%ld\n",GetLastError()); - if(mem2ptr) { - error=0; - for(i=0;i=2*memchunk,"LocalReAlloc failed\n"); - mem2ptr=LocalLock(mem2a); - ok(mem2ptr!=NULL,"LocalLock Failed\n"); - if(mem2ptr) { - error=0; - for(i=0;i0,"GetSystemInfo should return a valid page size\n"); - -/* Choose a reasonable allocation size */ - memchunk=10*sysInfo.dwPageSize; - -/* Check that a normal alloc works */ - mem1=VirtualAlloc(NULL,memchunk,MEM_COMMIT,PAGE_READWRITE); - ok(mem1!=NULL,"VirtualAlloc failed\n"); - if(mem1) { -/* check that memory is initialized to 0 */ - error=0; - for(i=0;i -#include - -#include "wine/test.h" -#include "windef.h" -#include "winbase.h" -#include "winerror.h" - -static const WCHAR foobarW[] = {'f','o','o','b','a','r',0}; -static const WCHAR FOOBARW[] = {'F','O','O','B','A','R',0}; -static const WCHAR _foobarW[] = {'_','f','o','o','b','a','r',0}; - -static BOOL unicode_OS; - -static void test_add_atom(void) -{ - ATOM atom, w_atom; - int i; - - SetLastError( 0xdeadbeef ); - atom = GlobalAddAtomA( "foobar" ); - ok( atom >= 0xc000, "bad atom id %x\n", atom ); - ok( GetLastError() == 0xdeadbeef, "GlobalAddAtomA set last error\n" ); - - /* Verify that it can be found (or not) appropriately */ - ok( GlobalFindAtomA( "foobar" ) == atom, "could not find atom foobar\n" ); - ok( GlobalFindAtomA( "FOOBAR" ) == atom, "could not find atom FOOBAR\n" ); - ok( !GlobalFindAtomA( "_foobar" ), "found _foobar\n" ); - - /* Add the same atom, specifying string as unicode; should - * find the first one, not add a new one */ - SetLastError( 0xdeadbeef ); - w_atom = GlobalAddAtomW( foobarW ); - if (w_atom && GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) - unicode_OS = TRUE; - else - trace("WARNING: Unicode atom APIs are not supported on this platform\n"); - - if (unicode_OS) - { - ok( w_atom == atom, "Unicode atom does not match ASCII\n" ); - ok( GetLastError() == 0xdeadbeef, "GlobalAddAtomW set last error\n" ); - } - - /* Verify that it can be found (or not) appropriately via unicode name */ - if (unicode_OS) - { - ok( GlobalFindAtomW( foobarW ) == atom, "could not find atom foobar\n" ); - ok( GlobalFindAtomW( FOOBARW ) == atom, "could not find atom FOOBAR\n" ); - ok( !GlobalFindAtomW( _foobarW ), "found _foobar\n" ); - } - - /* Test integer atoms - * (0x0001 .. 0xbfff) should be valid; - * (0xc000 .. 0xffff) should be invalid */ - - SetLastError( 0xdeadbeef ); - ok( GlobalAddAtomA(0) == 0 && GetLastError() == 0xdeadbeef, "succeeded to add atom 0\n" ); - if (unicode_OS) - { - SetLastError( 0xdeadbeef ); - ok( GlobalAddAtomW(0) == 0 && GetLastError() == 0xdeadbeef, "succeeded to add atom 0\n" ); - } - - SetLastError( 0xdeadbeef ); - for (i = 1; i <= 0xbfff; i++) - { - SetLastError( 0xdeadbeef ); - ok( GlobalAddAtomA((LPCSTR)i) == i && GetLastError() == 0xdeadbeef, - "failed to add atom %x\n", i ); - if (unicode_OS) - { - SetLastError( 0xdeadbeef ); - ok( GlobalAddAtomW((LPCWSTR)i) == i && GetLastError() == 0xdeadbeef, - "failed to add atom %x\n", i ); - } - } - - for (i = 0xc000; i <= 0xffff; i++) - { - ok( !GlobalAddAtomA((LPCSTR)i), "succeeded adding %x\n", i ); - if (unicode_OS) - ok( !GlobalAddAtomW((LPCWSTR)i), "succeeded adding %x\n", i ); - } -} - -static void test_get_atom_name(void) -{ - char buf[10]; - WCHAR bufW[10]; - int i; - UINT len; - static const WCHAR resultW[] = {'f','o','o','b','a','r',0,'.','.','.'}; - - ATOM atom = GlobalAddAtomA( "foobar" ); - - /* Get the name of the atom we added above */ - memset( buf, '.', sizeof(buf) ); - len = GlobalGetAtomNameA( atom, buf, 10 ); - ok( len == strlen("foobar"), "bad length %d\n", len ); - ok( !memcmp( buf, "foobar\0...", 10 ), "bad buffer contents\n" ); - - /* Repeat, unicode-style */ - if (unicode_OS) - { - for (i = 0; i < 10; i++) bufW[i] = '.'; - SetLastError( 0xdeadbeef ); - len = GlobalGetAtomNameW( atom, bufW, 10 ); - ok( len && GetLastError() == 0xdeadbeef, "GlobalGetAtomNameW failed\n" ); - ok( len == lstrlenW(foobarW), "bad length %d\n", len ); - ok( !memcmp( bufW, resultW, 10*sizeof(WCHAR) ), "bad buffer contents\n" ); - } - - /* Check error code returns */ - memset(buf, '.', 10); - ok( !GlobalGetAtomNameA( atom, buf, 0 ), "succeeded\n" ); - ok( !memcmp( buf, "..........", 10 ), "should not touch buffer\n" ); - - if (unicode_OS) - { - static const WCHAR sampleW[10] = {'.','.','.','.','.','.','.','.','.','.'}; - - for (i = 0; i < 10; i++) bufW[i] = '.'; - ok( !GlobalGetAtomNameW( atom, bufW, 0 ), "succeeded\n" ); - ok( !memcmp( bufW, sampleW, 10 * sizeof(WCHAR) ), "should not touch buffer\n" ); - } - - /* Test integer atoms */ - for (i = 0; i <= 0xbfff; i++) - { - memset( buf, 'a', 10 ); - len = GlobalGetAtomNameA( (ATOM)i, buf, 10 ); - if (i) - { - char res[20]; - ok( (len > 1) && (len < 7), "bad length %d\n", len ); - sprintf( res, "#%d", i ); - memset( res + strlen(res) + 1, 'a', 10 ); - ok( !memcmp( res, buf, 10 ), "bad buffer contents %s\n", buf ); - } - else - ok( !len, "bad length %d\n", len ); - } -} - -static void test_error_handling(void) -{ - char buffer[260]; - WCHAR bufferW[260]; - int i; - - memset( buffer, 'a', 256 ); - buffer[256] = 0; - ok( !GlobalAddAtomA(buffer), "add succeeded\n" ); - ok( !GlobalFindAtomA(buffer), "find succeeded\n" ); - - if (unicode_OS) - { - for (i = 0; i < 256; i++) bufferW[i] = 'b'; - bufferW[256] = 0; - ok( !GlobalAddAtomW(bufferW), "add succeeded\n" ); - ok( !GlobalFindAtomW(bufferW), "find succeeded\n" ); - } -} - -START_TEST(atom) -{ - test_add_atom(); - test_get_atom_name(); - test_error_handling(); -} diff --git a/reactos/apps/tests/kernel32/change.c b/reactos/apps/tests/kernel32/change.c deleted file mode 100644 index 88353f5538e..00000000000 --- a/reactos/apps/tests/kernel32/change.c +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Tests for file change notification functions - * - * Copyright (c) 2004 Hans Leidekker - * - * 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 - */ - -/* TODO: - security attribute changes - * - compound filter and multiple notifications - * - subtree notifications - * - non-documented flags FILE_NOTIFY_CHANGE_LAST_ACCESS and - * FILE_NOTIFY_CHANGE_CREATION - */ - -#include -#include - -#include "wine/test.h" -#include -#include - -static DWORD CALLBACK NotificationThread(LPVOID arg) -{ - HANDLE change = (HANDLE) arg; - BOOL ret = FALSE; - DWORD status; - - status = WaitForSingleObject(change, 100); - - if (status == WAIT_OBJECT_0 ) { - ret = FindNextChangeNotification(change); - } - - ok(FindCloseChangeNotification(change), "FindCloseChangeNotification error: %ld\n", - GetLastError()); - - ExitThread((DWORD)ret); -} - -static HANDLE StartNotificationThread(LPCSTR path, BOOL subtree, DWORD flags) -{ - HANDLE change, thread; - DWORD threadId; - - change = FindFirstChangeNotificationA(path, subtree, flags); - ok(change != INVALID_HANDLE_VALUE, "FindFirstChangeNotification error: %ld\n", GetLastError()); - - thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)NotificationThread, (LPVOID)change, - 0, &threadId); - ok(thread != INVALID_HANDLE_VALUE, "CreateThread error: %ld\n", GetLastError()); - - return thread; -} - -static DWORD FinishNotificationThread(HANDLE thread) -{ - DWORD status, exitcode; - - status = WaitForSingleObject(thread, 5000); - ok(status == WAIT_OBJECT_0, "WaitForSingleObject status %ld error %ld\n", status, GetLastError()); - - ok(GetExitCodeThread(thread, &exitcode), "Could not retrieve thread exit code\n"); - - return exitcode; -} - -static void test_FindFirstChangeNotification(void) -{ - HANDLE change, file, thread; - DWORD attributes, count; - BOOL ret; - - char workdir[MAX_PATH], dirname1[MAX_PATH], dirname2[MAX_PATH]; - char filename1[MAX_PATH], filename2[MAX_PATH]; - static const char prefix[] = "FCN"; - char buffer[2048]; - - /* pathetic checks */ - - change = FindFirstChangeNotificationA("not-a-file", FALSE, FILE_NOTIFY_CHANGE_FILE_NAME); - ok(change == INVALID_HANDLE_VALUE && GetLastError() == ERROR_FILE_NOT_FOUND, - "FindFirstChangeNotification error: %ld\n", GetLastError()); - - if (0) /* This documents win2k behavior. It crashes on win98. */ - { - change = FindFirstChangeNotificationA(NULL, FALSE, FILE_NOTIFY_CHANGE_FILE_NAME); - ok(change == NULL && GetLastError() == ERROR_PATH_NOT_FOUND, - "FindFirstChangeNotification error: %ld\n", GetLastError()); - } - - ret = FindNextChangeNotification(NULL); - ok(!ret && GetLastError() == ERROR_INVALID_HANDLE, "FindNextChangeNotification error: %ld\n", - GetLastError()); - - ret = FindCloseChangeNotification(NULL); - ok(!ret && GetLastError() == ERROR_INVALID_HANDLE, "FindCloseChangeNotification error: %ld\n", - GetLastError()); - - ret = GetTempPathA(MAX_PATH, workdir); - ok(ret, "GetTempPathA error: %ld\n", GetLastError()); - - lstrcatA(workdir, "testFileChangeNotification"); - - ret = CreateDirectoryA(workdir, NULL); - ok(ret, "CreateDirectoryA error: %ld\n", GetLastError()); - - ret = GetTempFileNameA(workdir, prefix, 0, filename1); - ok(ret, "GetTempFileNameA error: %ld\n", GetLastError()); - - file = CreateFileA(filename1, GENERIC_WRITE|GENERIC_READ, 0, NULL, CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, 0); - ok(file != INVALID_HANDLE_VALUE, "CreateFileA error: %ld\n", GetLastError()); - ok(CloseHandle(file), "CloseHandle error: %ld\n", GetLastError()); - - /* Try to register notification for a file. win98 and win2k behave differently here */ - change = FindFirstChangeNotificationA(filename1, FALSE, FILE_NOTIFY_CHANGE_FILE_NAME); - ok(change == INVALID_HANDLE_VALUE && (GetLastError() == ERROR_DIRECTORY || - GetLastError() == ERROR_FILE_NOT_FOUND), - "FindFirstChangeNotification error: %ld\n", GetLastError()); - - lstrcpyA(dirname1, filename1); - lstrcatA(dirname1, "dir"); - - ret = CreateDirectoryA(dirname1, NULL); - ok(ret, "CreateDirectoryA error: %ld\n", GetLastError()); - - /* What if we remove the directory we registered notification for? */ - thread = StartNotificationThread(dirname1, FALSE, FILE_NOTIFY_CHANGE_DIR_NAME); - ret = RemoveDirectoryA(dirname1); - ok(ret, "RemoveDirectoryA error: %ld\n", GetLastError()); - - /* win98 and win2k behave differently here */ - ret = FinishNotificationThread(thread); - ok(ret || !ret, "You'll never read this\n"); - - /* functional checks */ - - /* Create a directory */ - thread = StartNotificationThread(workdir, FALSE, FILE_NOTIFY_CHANGE_DIR_NAME); - ret = CreateDirectoryA(dirname1, NULL); - ok(ret, "CreateDirectoryA error: %ld\n", GetLastError()); - ok(FinishNotificationThread(thread), "Missed notification\n"); - - lstrcpyA(dirname2, dirname1); - lstrcatA(dirname2, "new"); - - /* Rename a directory */ - thread = StartNotificationThread(workdir, FALSE, FILE_NOTIFY_CHANGE_DIR_NAME); - ret = MoveFileA(dirname1, dirname2); - ok(ret, "MoveFileA error: %ld\n", GetLastError()); - ok(FinishNotificationThread(thread), "Missed notification\n"); - - /* Delete a directory */ - thread = StartNotificationThread(workdir, FALSE, FILE_NOTIFY_CHANGE_DIR_NAME); - ret = RemoveDirectoryA(dirname2); - ok(ret, "RemoveDirectoryA error: %ld\n", GetLastError()); - ok(FinishNotificationThread(thread), "Missed notification\n"); - - lstrcpyA(filename2, filename1); - lstrcatA(filename2, "new"); - - /* Rename a file */ - thread = StartNotificationThread(workdir, FALSE, FILE_NOTIFY_CHANGE_FILE_NAME); - ret = MoveFileA(filename1, filename2); - ok(ret, "MoveFileA error: %ld\n", GetLastError()); - ok(FinishNotificationThread(thread), "Missed notification\n"); - - /* Delete a file */ - thread = StartNotificationThread(workdir, FALSE, FILE_NOTIFY_CHANGE_FILE_NAME); - ret = DeleteFileA(filename2); - ok(ret, "DeleteFileA error: %ld\n", GetLastError()); - ok(FinishNotificationThread(thread), "Missed notification\n"); - - /* Create a file */ - thread = StartNotificationThread(workdir, FALSE, FILE_NOTIFY_CHANGE_FILE_NAME); - file = CreateFileA(filename2, GENERIC_WRITE|GENERIC_READ, 0, NULL, CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, 0); - ok(file != INVALID_HANDLE_VALUE, "CreateFileA error: %ld\n", GetLastError()); - ok(CloseHandle(file), "CloseHandle error: %ld\n", GetLastError()); - ok(FinishNotificationThread(thread), "Missed notification\n"); - - attributes = GetFileAttributesA(filename2); - ok(attributes != INVALID_FILE_ATTRIBUTES, "GetFileAttributesA error: %ld\n", GetLastError()); - attributes &= FILE_ATTRIBUTE_READONLY; - - /* Change file attributes */ - thread = StartNotificationThread(workdir, FALSE, FILE_NOTIFY_CHANGE_ATTRIBUTES); - ret = SetFileAttributesA(filename2, attributes); - ok(ret, "SetFileAttributesA error: %ld\n", GetLastError()); - ok(FinishNotificationThread(thread), "Missed notification\n"); - - /* Change last write time by writing to a file */ - thread = StartNotificationThread(workdir, FALSE, FILE_NOTIFY_CHANGE_LAST_WRITE); - file = CreateFileA(filename2, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, 0); - ok(file != INVALID_HANDLE_VALUE, "CreateFileA error: %ld\n", GetLastError()); - ret = WriteFile(file, buffer, sizeof(buffer), &count, NULL); - ok(ret && count == sizeof(buffer), "WriteFile error: %ld\n", GetLastError()); - ok(CloseHandle(file), "CloseHandle error: %ld\n", GetLastError()); - ok(FinishNotificationThread(thread), "Missed notification\n"); - - /* Change file size by truncating a file */ - thread = StartNotificationThread(workdir, FALSE, FILE_NOTIFY_CHANGE_SIZE); - file = CreateFileA(filename2, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, 0); - ok(file != INVALID_HANDLE_VALUE, "CreateFileA error: %ld\n", GetLastError()); - ret = WriteFile(file, buffer, sizeof(buffer) / 2, &count, NULL); - ok(ret && count == sizeof(buffer) / 2, "WriteFileA error: %ld\n", GetLastError()); - ok(CloseHandle(file), "CloseHandle error: %ld\n", GetLastError()); - ok(FinishNotificationThread(thread), "Missed notification\n"); - - /* clean up */ - - ret = DeleteFileA(filename2); - ok(ret, "DeleteFileA error: %ld\n", GetLastError()); - - ret = RemoveDirectoryA(workdir); - ok(ret, "RemoveDirectoryA error: %ld\n", GetLastError()); -} - -START_TEST(change) -{ - test_FindFirstChangeNotification(); -} diff --git a/reactos/apps/tests/kernel32/codepage.c b/reactos/apps/tests/kernel32/codepage.c deleted file mode 100644 index 038b428f9bd..00000000000 --- a/reactos/apps/tests/kernel32/codepage.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Unit tests for code page to/from unicode translations - * - * Copyright (c) 2002 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 "wine/test.h" -#include "windef.h" -#include "winbase.h" -#include "winnls.h" - -/* lstrcmpW is not supported on Win9x! */ -static int mylstrcmpW(const WCHAR* str1, const WCHAR* str2) -{ - while (*str1 && *str1==*str2) { - str1++; - str2++; - } - return *str1-*str2; -} - -static void test_negative_source_length(void) -{ - int len; - char buf[10]; - WCHAR bufW[10]; - static const WCHAR foobarW[] = {'f','o','o','b','a','r',0}; - - /* Test, whether any negative source length works as strlen() + 1 */ - SetLastError( 0xdeadbeef ); - memset(buf,'x',sizeof(buf)); - len = WideCharToMultiByte(CP_ACP, 0, foobarW, -2002, buf, 10, NULL, NULL); - ok(len == 7 && !lstrcmpA(buf, "foobar") && GetLastError() == 0xdeadbeef, - "WideCharToMultiByte(-2002): len=%d error=%ld\n",len,GetLastError()); - - SetLastError( 0xdeadbeef ); - memset(bufW,'x',sizeof(bufW)); - len = MultiByteToWideChar(CP_ACP, 0, "foobar", -2002, bufW, 10); - ok(len == 7 && !mylstrcmpW(bufW, foobarW) && GetLastError() == 0xdeadbeef, - "MultiByteToWideChar(-2002): len=%d error=%ld\n",len,GetLastError()); -} - -START_TEST(codepage) -{ - test_negative_source_length(); -} diff --git a/reactos/apps/tests/kernel32/comm.c b/reactos/apps/tests/kernel32/comm.c deleted file mode 100644 index 166bfb39061..00000000000 --- a/reactos/apps/tests/kernel32/comm.c +++ /dev/null @@ -1,640 +0,0 @@ -/* Unit test suite for comm functions - * - * Copyright 2003 Kevin Groeneveld - * - * 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 "winbase.h" -#include "winnls.h" - -typedef struct -{ - char string[100]; - BOOL result; - BOOL old_style; - DCB dcb1, dcb2; - COMMTIMEOUTS timeouts1, timeouts2; -} TEST; - -static TEST test[] = -{ - { - "baud=9600 parity=e data=5 stop=1 xon=on odsr=off octs=off dtr=on rts=on idsr=on", - TRUE, FALSE, - { 0x00000000, 0x00002580, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x05, 0x02, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0x00002580, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x05, 0x02, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "baud=0 parity=M data=6 stop=1.5 xon=off odsr=on octs=ON dtr=off rts=off idsr=OFF", - TRUE, FALSE, - { 0x00000000, 0x00000000, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x06, 0x03, 0x01, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0x00000000, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x06, 0x03, 0x01, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "BAUD=4000000000 parity=n data=7 stop=2 to=off", - TRUE, FALSE, - { 0x00000000, 0xee6b2800, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x00, 0x02, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0xee6b2800, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x00, 0x02, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } - }, - { - "Baud=115200 Parity=O Data=8 To=On", - TRUE, FALSE, - { 0x00000000, 0x0001c200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x01, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0x0001c200, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0x01, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000EA60 }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000EA60 } - }, - { - "PaRiTy=s Data=7 DTR=on", - TRUE, FALSE, - { 0x00000000, 0x00000000, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x04, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x04, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "data=4", - FALSE, FALSE, - { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "data=9", - FALSE, FALSE, - { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "parity=no", - FALSE, FALSE, - { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "stop=0", - FALSE, FALSE, - { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "stop=1.501", - FALSE, FALSE, - { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "stop=3", - FALSE, FALSE, - { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "to=foobar", - FALSE, FALSE, - { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - " baud=9600", - FALSE, FALSE, - { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "baud= 9600", - FALSE, FALSE, - { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "baud=9600,data=8", - FALSE, FALSE, - { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "11,n,8,1", - TRUE, TRUE, - { 0x00000000, 0x0000006e, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0x0000006e, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0x00, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "30 ,E, 5,1.5", - TRUE, TRUE, - { 0x00000000, 0x0000012c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x05, 0x02, 0x01, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0x0000012c, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x05, 0x02, 0x01, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "60, m, 6, 2 ", - TRUE, TRUE, - { 0x00000000, 0x00000258, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x06, 0x03, 0x02, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0x00000258, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x06, 0x03, 0x02, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "12 , o , 7 , 1", - TRUE, TRUE, - { 0x00000000, 0x000004b0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x01, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0x000004b0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x01, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "24,s,8,1.5", - TRUE, TRUE, - { 0x00000000, 0x00000960, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x04, 0x01, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0x00000960, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0x04, 0x01, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "48,n,8,1,p", - TRUE, TRUE, - { 0x00000000, 0x000012c0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0x000012c0, 1, 1, 1, 1, 2, 1, 1, 0, 0, 1, 1, 2, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0x00, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "96,N,8,1 , x ", - TRUE, TRUE, - { 0x00000000, 0x00002580, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0x00002580, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0x00, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "19, e, 7, 1, x", - TRUE, TRUE, - { 0x00000000, 0x00004b00, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x02, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0x00004b00, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x02, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "0,M,7,1,P", - TRUE, TRUE, - { 0x00000000, 0x00000000, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x03, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0x00000000, 1, 1, 1, 1, 2, 1, 1, 0, 0, 1, 1, 2, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x03, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "4000000000,O,7,1.5,X", - TRUE, TRUE, - { 0x00000000, 0xee6b2800, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x01, 0x01, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0xee6b2800, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x01, 0x01, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "96,N,8,1 to=on", - FALSE, TRUE, - { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "96,NO,8,1", - FALSE, TRUE, - { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "96,N,4,1", - FALSE, TRUE, - { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "96,N,9,1", - FALSE, TRUE, - { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "96,N,8,0", - FALSE, TRUE, - { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "96,N,8,3", - FALSE, TRUE, - { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "96,N,8,1,K", - FALSE, TRUE, - { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "COM0:baud=115200", - FALSE, FALSE, - { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "COMx:baud=38400 data=8", - TRUE, FALSE, - { 0x00000000, 0x00009600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0x00009600, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0xff, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "COMx :to=on stop=1.5", - TRUE, FALSE, - { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x01, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0x01, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000EA60 }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000EA60 } - }, - { - "COMx: baud=12345 data=7", - TRUE, FALSE, - { 0x00000000, 0x00003039, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0x00003039, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0xff, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "COMx : xon=on odsr=off", - TRUE, FALSE, - { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0xffffffff, 1, 1, 1, 0, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "COM0:9600,N,8,1", - FALSE, TRUE, - { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "COMx:9600,N,8,1", - TRUE, TRUE, - { 0x00000000, 0x00002580, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0x00002580, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0x00, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "COMx: 11,E,7,2", - TRUE, TRUE, - { 0x00000000, 0x0000006e, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x02, 0x02, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0x0000006e, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x02, 0x02, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "COMx :19,M,5,1", - TRUE, TRUE, - { 0x00000000, 0x00004b00, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x05, 0x03, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0x00004b00, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x05, 0x03, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, - { - "COMx : 57600,S,6,2,x", - TRUE, TRUE, - { 0x00000000, 0x0000e100, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x06, 0x04, 0x02, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 }, - { 0xffffffff, 0x0000e100, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x06, 0x04, 0x02, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff }, - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } - }, -}; - -#define TEST_COUNT (sizeof(test) / sizeof(TEST)) - -/* This function can be useful if you are modifiying the test cases and want to - output the contents of a DCB structure. */ -/*static print_dcb(DCB *pdcb) -{ - printf("0x%08x, 0x%08x, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, 0x%05x, 0x%04x, 0x%04x, 0x%04x, 0x%02x, 0x%02x, 0x%02x, (char)0x%02x, (char)0x%02x, (char)0x%02x, (char)0x%02x, (char)0x%02x, 0x%04x\n", - pdcb->DCBlength, - pdcb->BaudRate, - pdcb->fBinary, - pdcb->fParity, - pdcb->fOutxCtsFlow, - pdcb->fOutxDsrFlow, - pdcb->fDtrControl, - pdcb->fDsrSensitivity, - pdcb->fTXContinueOnXoff, - pdcb->fOutX, - pdcb->fInX, - pdcb->fErrorChar, - pdcb->fNull, - pdcb->fRtsControl, - pdcb->fAbortOnError, - pdcb->fDummy2, - pdcb->wReserved, - pdcb->XonLim, - pdcb->XoffLim, - pdcb->ByteSize, - pdcb->Parity, - pdcb->StopBits, - pdcb->XonChar & 0xff, - pdcb->XoffChar & 0xff, - pdcb->ErrorChar & 0xff, - pdcb->EofChar & 0xff, - pdcb->EvtChar & 0xff, - pdcb->wReserved1 & 0xffff ); -} */ - -static void check_result(char *function, TEST *ptest, int initial_value, BOOL result) -{ - DWORD LastError = GetLastError(); - DWORD CorrectError = (ptest->result ? 0xdeadbeef : ERROR_INVALID_PARAMETER); - - ok(LastError == CorrectError, "%s(\"%s\"), 0x%02x: GetLastError() returned 0x%08lx, should be 0x%08lx\n", function, ptest->string, initial_value, LastError, CorrectError); - ok(result == ptest->result, "%s(\"%s\"), 0x%02x: return value should be %s\n", function, ptest->string, initial_value, ptest->result ? "TRUE" : "FALSE"); -} - -#define check_dcb_member(a,b) ok(pdcb1->a == pdcb2->a, "%s(\"%s\"), 0x%02x: "#a" is "b", should be "b"\n", function, ptest->string, initial_value, pdcb1->a, pdcb2->a) -#define check_dcb_member2(a,c,b) if(pdcb2->a == c) { check_dcb_member(a,b); } else { ok(pdcb1->a == pdcb2->a || pdcb1->a == c, "%s(\"%s\"), 0x%02x: "#a" is "b", should be "b" or "b"\n", function, ptest->string, initial_value, pdcb1->a, pdcb2->a, c); } - -static void check_dcb(char *function, TEST *ptest, int initial_value, DCB *pdcb1, DCB *pdcb2) -{ - /* DCBlength is a special case since Win 9x sets it but NT does not. - We will accept either as correct. */ - check_dcb_member2(DCBlength, (DWORD)sizeof(DCB), "%lu"); - - /* For old style control strings Win 9x does not set the next five members, NT does. */ - if(ptest->old_style && ptest->result) - { - check_dcb_member2(fOutxCtsFlow, ((unsigned int)initial_value & 1), "%u"); - check_dcb_member2(fDtrControl, ((unsigned int)initial_value & 3), "%u"); - check_dcb_member2(fOutX, ((unsigned int)initial_value & 1), "%u"); - check_dcb_member2(fInX, ((unsigned)initial_value & 1), "%u"); - check_dcb_member2(fRtsControl, ((unsigned)initial_value & 3), "%u"); - } - else - { - check_dcb_member(fOutxCtsFlow, "%u"); - check_dcb_member(fDtrControl, "%u"); - check_dcb_member(fOutX, "%u"); - check_dcb_member(fInX, "%u"); - check_dcb_member(fRtsControl, "%u"); - } - - if(ptest->result) - { - /* For the idsr=xxx parameter, NT sets fDsrSensitivity, 9x sets - fOutxDsrFlow. */ - if(!ptest->old_style) - { - check_dcb_member2(fOutxDsrFlow, pdcb2->fDsrSensitivity, "%u"); - check_dcb_member2(fDsrSensitivity, pdcb2->fOutxDsrFlow, "%u"); - } - else - { - /* For old style control strings Win 9x does not set the - fOutxDsrFlow member, NT does. */ - check_dcb_member2(fOutxDsrFlow, ((unsigned int)initial_value & 1), "%u"); - check_dcb_member(fDsrSensitivity, "%u"); - } - } - else - { - check_dcb_member(fOutxDsrFlow, "%u"); - check_dcb_member(fDsrSensitivity, "%u"); - } - - /* Check the result of the DCB members. */ - check_dcb_member(BaudRate, "%lu"); - check_dcb_member(fBinary, "%u"); - check_dcb_member(fParity, "%u"); - check_dcb_member(fTXContinueOnXoff, "%u"); - check_dcb_member(fErrorChar, "%u"); - check_dcb_member(fNull, "%u"); - check_dcb_member(fAbortOnError, "%u"); - check_dcb_member(fDummy2, "%u"); - check_dcb_member(wReserved, "%u"); - check_dcb_member(XonLim, "%u"); - check_dcb_member(XoffLim, "%u"); - check_dcb_member(ByteSize, "%u"); - check_dcb_member(Parity, "%u"); - check_dcb_member(StopBits, "%u"); - check_dcb_member(XonChar, "%d"); - check_dcb_member(XoffChar, "%d"); - check_dcb_member(ErrorChar, "%d"); - check_dcb_member(EofChar, "%d"); - check_dcb_member(EvtChar, "%d"); - check_dcb_member(wReserved1, "%u"); -} - -#define check_timeouts_member(a) ok(ptimeouts1->a == ptimeouts2->a, "%s(\"%s\"), 0x%02x: "#a" is %lu, should be %lu\n", function, ptest->string, initial_value, ptimeouts1->a, ptimeouts2->a); - -static void check_timeouts(char *function, TEST *ptest, int initial_value, COMMTIMEOUTS *ptimeouts1, COMMTIMEOUTS *ptimeouts2) -{ - check_timeouts_member(ReadIntervalTimeout); - check_timeouts_member(ReadTotalTimeoutMultiplier); - check_timeouts_member(ReadTotalTimeoutConstant); - check_timeouts_member(WriteTotalTimeoutMultiplier); - check_timeouts_member(WriteTotalTimeoutConstant); -} - -static void test_BuildCommDCBA(TEST *ptest, int initial_value, DCB *pexpected_dcb) -{ - BOOL result; - DCB dcb; - - /* set initial conditions */ - memset(&dcb, initial_value, sizeof(DCB)); - SetLastError(0xdeadbeef); - - result = BuildCommDCBA(ptest->string, &dcb); - - /* check results */ - check_result("BuildCommDCBA", ptest, initial_value, result); - check_dcb("BuildCommDCBA", ptest, initial_value, &dcb, pexpected_dcb); -} - -static void test_BuildCommDCBAndTimeoutsA(TEST *ptest, int initial_value, DCB *pexpected_dcb, COMMTIMEOUTS *pexpected_timeouts) -{ - BOOL result; - DCB dcb; - COMMTIMEOUTS timeouts; - - /* set initial conditions */ - memset(&dcb, initial_value, sizeof(DCB)); - memset(&timeouts, initial_value, sizeof(COMMTIMEOUTS)); - SetLastError(0xdeadbeef); - - result = BuildCommDCBAndTimeoutsA(ptest->string, &dcb, &timeouts); - - /* check results */ - check_result("BuildCommDCBAndTimeoutsA", ptest, initial_value, result); - check_dcb("BuildCommDCBAndTimeoutsA", ptest, initial_value, &dcb, pexpected_dcb); - check_timeouts("BuildCommDCBAndTimeoutsA", ptest, initial_value, &timeouts, pexpected_timeouts); -} - -static void test_BuildCommDCBW(TEST *ptest, int initial_value, DCB *pexpected_dcb) -{ - BOOL result; - DCB dcb; - WCHAR wide_string[sizeof(ptest->string)]; - - MultiByteToWideChar(CP_ACP, 0, ptest->string, -1, wide_string, sizeof(wide_string) / sizeof(WCHAR)); - - /* set initial conditions */ - memset(&dcb, initial_value, sizeof(DCB)); - SetLastError(0xdeadbeef); - - result = BuildCommDCBW(wide_string, &dcb); - - if(GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - return; - - /* check results */ - check_result("BuildCommDCBW", ptest, initial_value, result); - check_dcb("BuildCommDCBW", ptest, initial_value, &dcb, pexpected_dcb); -} - -static void test_BuildCommDCBAndTimeoutsW(TEST *ptest, int initial_value, DCB *pexpected_dcb, COMMTIMEOUTS *pexpected_timeouts) -{ - BOOL result; - DCB dcb; - COMMTIMEOUTS timeouts; - WCHAR wide_string[sizeof(ptest->string)]; - - MultiByteToWideChar(CP_ACP, 0, ptest->string, -1, wide_string, sizeof(wide_string) / sizeof(WCHAR)); - - /* set initial conditions */ - memset(&dcb, initial_value, sizeof(DCB)); - memset(&timeouts, initial_value, sizeof(COMMTIMEOUTS)); - SetLastError(0xdeadbeef); - - result = BuildCommDCBAndTimeoutsW(wide_string, &dcb, &timeouts); - - if(GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - return; - - /* check results */ - check_result("BuildCommDCBAndTimeoutsA", ptest, initial_value, result); - check_dcb("BuildCommDCBAndTimeoutsA", ptest, initial_value, &dcb, pexpected_dcb); - check_timeouts("BuildCommDCBAndTimeoutsA", ptest, initial_value, &timeouts, pexpected_timeouts); -} - -static void test_BuildCommDCB(void) -{ - char port_name[] = "COMx"; - char port = 0; - int i; - char *ptr; - - /* Some of these tests require a valid COM port. This loop will try to find - a valid port. */ - for(port_name[3] = '1'; port_name[3] <= '9'; port_name[3]++) - { - COMMCONFIG commconfig; - DWORD size = sizeof(COMMCONFIG); - - if(GetDefaultCommConfig(port_name, &commconfig, &size)) - { - port = port_name[3]; - break; - } - } - - if(!port) - trace("Could not find a valid COM port. Some tests will be skipped.\n"); - - for(i = 0; i < TEST_COUNT; i++) - { - /* Check if this test case needs a valid COM port. */ - ptr = strstr(test[i].string, "COMx"); - - /* If required, substitute valid port number into device control string. */ - if(ptr) - { - if(port) - ptr[3] = port; - else - continue; - } - - test_BuildCommDCBA(&test[i], 0x00, &test[i].dcb1); - test_BuildCommDCBA(&test[i], 0xff, &test[i].dcb2); - test_BuildCommDCBAndTimeoutsA(&test[i], 0x00, &test[i].dcb1, &test[i].timeouts1); - test_BuildCommDCBAndTimeoutsA(&test[i], 0xff, &test[i].dcb2, &test[i].timeouts2); - - test_BuildCommDCBW(&test[i], 0x00, &test[i].dcb1); - test_BuildCommDCBW(&test[i], 0xff, &test[i].dcb2); - test_BuildCommDCBAndTimeoutsW(&test[i], 0x00, &test[i].dcb1, &test[i].timeouts1); - test_BuildCommDCBAndTimeoutsW(&test[i], 0xff, &test[i].dcb2, &test[i].timeouts2); - } -} - -START_TEST(comm) -{ - test_BuildCommDCB(); -} diff --git a/reactos/apps/tests/kernel32/console.c b/reactos/apps/tests/kernel32/console.c deleted file mode 100644 index 67e7e428618..00000000000 --- a/reactos/apps/tests/kernel32/console.c +++ /dev/null @@ -1,561 +0,0 @@ -/* - * Unit tests for console API - * - * Copyright (c) 2003 Eric Pouech - * - * 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 "wine/test.h" -#include -#include - -/* DEFAULT_ATTRIB is used for all initial filling of the console. - * all modifications are made with TEST_ATTRIB so that we could check - * what has to be modified or not - */ -#define TEST_ATTRIB (BACKGROUND_BLUE | FOREGROUND_GREEN) -#define DEFAULT_ATTRIB (FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED) -/* when filling the screen with non-blank chars, this macro defines - * what character should be at position 'c' - */ -#define CONTENT(c) ('A' + (((c).Y * 17 + (c).X) % 23)) - -#define okCURSOR(hCon, c) do { \ - CONSOLE_SCREEN_BUFFER_INFO __sbi; \ - BOOL expect = GetConsoleScreenBufferInfo((hCon), &__sbi) && \ - __sbi.dwCursorPosition.X == (c).X && __sbi.dwCursorPosition.Y == (c).Y; \ - ok(expect, "Expected cursor at (%d,%d), got (%d,%d)\n", \ - (c).X, (c).Y, __sbi.dwCursorPosition.X, __sbi.dwCursorPosition.Y); \ -} while (0) - -#define okCHAR(hCon, c, ch, attr) do { \ - char __ch; WORD __attr; DWORD __len; BOOL expect; \ - expect = ReadConsoleOutputCharacter((hCon), &__ch, 1, (c), &__len) == 1 && __len == 1 && __ch == (ch); \ - ok(expect, "At (%d,%d): expecting char '%c'/%02x got '%c'/%02x\n", (c).X, (c).Y, (ch), (ch), __ch, __ch); \ - expect = ReadConsoleOutputAttribute((hCon), &__attr, 1, (c), &__len) == 1 && __len == 1 && __attr == (attr); \ - ok(expect, "At (%d,%d): expecting attr %04x got %04x\n", (c).X, (c).Y, (attr), __attr); \ -} while (0) - -/* FIXME: this could be optimized on a speed point of view */ -static void resetContent(HANDLE hCon, COORD sbSize, BOOL content) -{ - COORD c; - WORD attr = DEFAULT_ATTRIB; - char ch; - DWORD len; - - for (c.X = 0; c.X < sbSize.X; c.X++) - { - for (c.Y = 0; c.Y < sbSize.Y; c.Y++) - { - ch = (content) ? CONTENT(c) : ' '; - WriteConsoleOutputAttribute(hCon, &attr, 1, c, &len); - WriteConsoleOutputCharacterA(hCon, &ch, 1, c, &len); - } - } -} - -static void testCursor(HANDLE hCon, COORD sbSize) -{ - COORD c; - - c.X = c.Y = 0; - ok(SetConsoleCursorPosition(0, c) == 0, "No handle\n"); - ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError: expecting %u got %lu\n", - ERROR_INVALID_HANDLE, GetLastError()); - - c.X = c.Y = 0; - ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left\n"); - okCURSOR(hCon, c); - - c.X = sbSize.X - 1; - c.Y = sbSize.Y - 1; - ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in lower-right\n"); - okCURSOR(hCon, c); - - c.X = sbSize.X; - c.Y = sbSize.Y - 1; - ok(SetConsoleCursorPosition(hCon, c) == 0, "Cursor is outside\n"); - ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %lu\n", - ERROR_INVALID_PARAMETER, GetLastError()); - - c.X = sbSize.X - 1; - c.Y = sbSize.Y; - ok(SetConsoleCursorPosition(hCon, c) == 0, "Cursor is outside\n"); - ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %lu\n", - ERROR_INVALID_PARAMETER, GetLastError()); - - c.X = -1; - c.Y = 0; - ok(SetConsoleCursorPosition(hCon, c) == 0, "Cursor is outside\n"); - ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %lu\n", - ERROR_INVALID_PARAMETER, GetLastError()); - - c.X = 0; - c.Y = -1; - ok(SetConsoleCursorPosition(hCon, c) == 0, "Cursor is outside\n"); - ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %lu\n", - ERROR_INVALID_PARAMETER, GetLastError()); -} - -static void testWriteSimple(HANDLE hCon, COORD sbSize) -{ - COORD c; - DWORD len; - const char* mytest = "abcdefg"; - const int mylen = strlen(mytest); - - /* single line write */ - c.X = c.Y = 0; - ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left\n"); - - ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n"); - c.Y = 0; - for (c.X = 0; c.X < mylen; c.X++) - { - okCHAR(hCon, c, mytest[c.X], TEST_ATTRIB); - } - - okCURSOR(hCon, c); - okCHAR(hCon, c, ' ', DEFAULT_ATTRIB); -} - -static void testWriteNotWrappedNotProcessed(HANDLE hCon, COORD sbSize) -{ - COORD c; - DWORD len, mode; - char* mytest; - int mylen; - int ret; - int p; - - ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon, mode & ~(ENABLE_PROCESSED_OUTPUT|ENABLE_WRAP_AT_EOL_OUTPUT)), - "clearing wrap at EOL & processed output\n"); - - /* write line, wrapping disabled, buffer exceeds sb width */ - c.X = sbSize.X - 3; c.Y = 0; - ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-3\n"); - - mytest = "123"; - - mylen = strlen(mytest); - - ret = WriteConsole(hCon, mytest, mylen, &len, NULL); - ok(ret != 0 && len == mylen, "Couldn't write, ret = %d, len = %ld\n", ret, len); - c.Y = 0; - for (p = mylen - 3; p < mylen; p++) - { - c.X = sbSize.X - 3 + p % 3; - okCHAR(hCon, c, mytest[p], TEST_ATTRIB); - } - - c.X = 0; c.Y = 1; - okCHAR(hCon, c, ' ', DEFAULT_ATTRIB); - - p = sbSize.X - 3 + mylen % 3; - c.X = p; c.Y = 0; - - /* write line, wrapping disabled, strings end on end of line */ - c.X = sbSize.X - mylen; c.Y = 0; - ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-3\n"); - - ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n"); -} - -static void testWriteNotWrappedProcessed(HANDLE hCon, COORD sbSize) -{ - COORD c; - DWORD len, mode; - const char* mytest = "abcd\nf\tg"; - const int mylen = strlen(mytest); - const int mylen2 = strchr(mytest, '\n') - mytest; - int p; - - ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon, (mode | ENABLE_PROCESSED_OUTPUT) & ~ENABLE_WRAP_AT_EOL_OUTPUT), - "clearing wrap at EOL & setting processed output\n"); - - /* write line, wrapping disabled, buffer exceeds sb width */ - c.X = sbSize.X - 5; c.Y = 0; - ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-5\n"); - - ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n"); - c.Y = 0; - for (c.X = sbSize.X - 5; c.X < sbSize.X - 1; c.X++) - { - okCHAR(hCon, c, mytest[c.X - sbSize.X + 5], TEST_ATTRIB); - } - okCHAR(hCon, c, ' ', DEFAULT_ATTRIB); - - c.X = 0; c.Y++; - okCHAR(hCon, c, mytest[5], TEST_ATTRIB); - for (c.X = 1; c.X < 8; c.X++) - okCHAR(hCon, c, ' ', TEST_ATTRIB); - okCHAR(hCon, c, mytest[7], TEST_ATTRIB); - c.X++; - okCHAR(hCon, c, ' ', DEFAULT_ATTRIB); - - okCURSOR(hCon, c); - - /* write line, wrapping disabled, strings end on end of line */ - c.X = sbSize.X - 4; c.Y = 0; - ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-4\n"); - - ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n"); - c.Y = 0; - for (c.X = sbSize.X - 4; c.X < sbSize.X; c.X++) - { - okCHAR(hCon, c, mytest[c.X - sbSize.X + 4], TEST_ATTRIB); - } - c.X = 0; c.Y++; - okCHAR(hCon, c, mytest[5], TEST_ATTRIB); - for (c.X = 1; c.X < 8; c.X++) - okCHAR(hCon, c, ' ', TEST_ATTRIB); - okCHAR(hCon, c, mytest[7], TEST_ATTRIB); - c.X++; - okCHAR(hCon, c, ' ', DEFAULT_ATTRIB); - - okCURSOR(hCon, c); - - /* write line, wrapping disabled, strings end after end of line */ - c.X = sbSize.X - 3; c.Y = 0; - ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-4\n"); - - ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n"); - c.Y = 0; - for (p = mylen2 - 3; p < mylen2; p++) - { - c.X = sbSize.X - 3 + p % 3; - okCHAR(hCon, c, mytest[p], TEST_ATTRIB); - } - c.X = 0; c.Y = 1; - okCHAR(hCon, c, mytest[5], TEST_ATTRIB); - for (c.X = 1; c.X < 8; c.X++) - okCHAR(hCon, c, ' ', TEST_ATTRIB); - okCHAR(hCon, c, mytest[7], TEST_ATTRIB); - c.X++; - okCHAR(hCon, c, ' ', DEFAULT_ATTRIB); - - okCURSOR(hCon, c); -} - -static void testWriteWrappedNotProcessed(HANDLE hCon, COORD sbSize) -{ - COORD c; - DWORD len, mode; - const char* mytest = "abcd\nf\tg"; - const int mylen = strlen(mytest); - int p; - - ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon,(mode | ENABLE_WRAP_AT_EOL_OUTPUT) & ~(ENABLE_PROCESSED_OUTPUT)), - "setting wrap at EOL & clearing processed output\n"); - - /* write line, wrapping enabled, buffer doesn't exceed sb width */ - c.X = sbSize.X - 9; c.Y = 0; - ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-9\n"); - - ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n"); - c.Y = 0; - for (p = 0; p < mylen; p++) - { - c.X = sbSize.X - 9 + p; - okCHAR(hCon, c, mytest[p], TEST_ATTRIB); - } - c.X = sbSize.X - 9 + mylen; - okCHAR(hCon, c, ' ', DEFAULT_ATTRIB); - c.X = 0; c.Y = 1; - okCHAR(hCon, c, ' ', DEFAULT_ATTRIB); - - /* write line, wrapping enabled, buffer does exceed sb width */ - c.X = sbSize.X - 3; c.Y = 0; - ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-3\n"); - - c.Y = 1; - c.X = mylen - 3; - okCHAR(hCon, c, ' ', DEFAULT_ATTRIB); -} - -static void testWriteWrappedProcessed(HANDLE hCon, COORD sbSize) -{ - COORD c; - DWORD len, mode; - const char* mytest = "abcd\nf\tg"; - const int mylen = strlen(mytest); - int p; - - ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon, mode | (ENABLE_WRAP_AT_EOL_OUTPUT|ENABLE_PROCESSED_OUTPUT)), - "setting wrap at EOL & processed output\n"); - - /* write line, wrapping enabled, buffer doesn't exceed sb width */ - c.X = sbSize.X - 9; c.Y = 0; - ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-9\n"); - - ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n"); - for (p = 0; p < 4; p++) - { - c.X = sbSize.X - 9 + p; - okCHAR(hCon, c, mytest[p], TEST_ATTRIB); - } - c.X = sbSize.X - 9 + p; - okCHAR(hCon, c, ' ', DEFAULT_ATTRIB); - c.X = 0; c.Y++; - okCHAR(hCon, c, mytest[5], TEST_ATTRIB); - for (c.X = 1; c.X < 8; c.X++) - okCHAR(hCon, c, ' ', TEST_ATTRIB); - okCHAR(hCon, c, mytest[7], TEST_ATTRIB); - c.X++; - okCHAR(hCon, c, ' ', DEFAULT_ATTRIB); - okCURSOR(hCon, c); - - /* write line, wrapping enabled, buffer does exceed sb width */ - c.X = sbSize.X - 3; c.Y = 2; - ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-3\n"); - - ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n"); - for (p = 0; p < 3; p++) - { - c.X = sbSize.X - 3 + p; - okCHAR(hCon, c, mytest[p], TEST_ATTRIB); - } - c.X = 0; c.Y++; - okCHAR(hCon, c, mytest[3], TEST_ATTRIB); - c.X++; - okCHAR(hCon, c, ' ', DEFAULT_ATTRIB); - - c.X = 0; c.Y++; - okCHAR(hCon, c, mytest[5], TEST_ATTRIB); - for (c.X = 1; c.X < 8; c.X++) - okCHAR(hCon, c, ' ', TEST_ATTRIB); - okCHAR(hCon, c, mytest[7], TEST_ATTRIB); - c.X++; - okCHAR(hCon, c, ' ', DEFAULT_ATTRIB); - okCURSOR(hCon, c); -} - -static void testWrite(HANDLE hCon, COORD sbSize) -{ - /* FIXME: should in fact insure that the sb is at least 10 character wide */ - ok(SetConsoleTextAttribute(hCon, TEST_ATTRIB), "Setting default text color\n"); - resetContent(hCon, sbSize, FALSE); - testWriteSimple(hCon, sbSize); - resetContent(hCon, sbSize, FALSE); - testWriteNotWrappedNotProcessed(hCon, sbSize); - resetContent(hCon, sbSize, FALSE); - testWriteNotWrappedProcessed(hCon, sbSize); - resetContent(hCon, sbSize, FALSE); - testWriteWrappedNotProcessed(hCon, sbSize); - resetContent(hCon, sbSize, FALSE); - testWriteWrappedProcessed(hCon, sbSize); -} - -#if 0 -static void testScroll(HANDLE hCon, COORD sbSize) -{ - SMALL_RECT scroll, clip; - COORD dst, c, tc; - CHAR_INFO ci; - -#define W 11 -#define H 7 - - /* no clipping, src & dst rect don't overlap */ - resetContent(hCon, sbSize, TRUE); - -#define IN_SRECT(r,c) ((r).Left <= (c).X && (c).X <= (r).Right && (r).Top <= (c).Y && (c).Y <= (r).Bottom) -#define IN_SRECT2(r,d,c) ((d).X <= (c).X && (c).X <= (d).X + (r).Right - (r).Left && (d).Y <= (c).Y && (c).Y <= (d).Y + (r).Bottom - (r).Top) - - scroll.Left = 0; - scroll.Right = W - 1; - scroll.Top = 0; - scroll.Bottom = H - 1; - dst.X = W + 3; - dst.Y = H + 3; - ci.Char.UnicodeChar = '#'; - ci.Attributes = TEST_ATTRIB; - - clip.Left = 0; - clip.Right = sbSize.X - 1; - clip.Top = 0; - clip.Bottom = sbSize.Y - 1; - - ok(ScrollConsoleScreenBuffer(hCon, &scroll, NULL, dst, &ci), "Scrolling SB\n"); - - for (c.Y = 0; c.Y < sbSize.Y; c.Y++) - { - for (c.X = 0; c.X < sbSize.X; c.X++) - { - if (IN_SRECT2(scroll, dst, c) && IN_SRECT(clip, c)) - { - tc.X = c.X - dst.X; - tc.Y = c.Y - dst.Y; - okCHAR(hCon, c, CONTENT(tc), DEFAULT_ATTRIB); - } - else if (IN_SRECT(scroll, c) && IN_SRECT(clip, c)) - okCHAR(hCon, c, '#', TEST_ATTRIB); - else okCHAR(hCon, c, CONTENT(c), DEFAULT_ATTRIB); - } - } - - /* no clipping, src & dst rect do overlap */ - resetContent(hCon, sbSize, TRUE); - - scroll.Left = 0; - scroll.Right = W - 1; - scroll.Top = 0; - scroll.Bottom = H - 1; - dst.X = W /2; - dst.Y = H / 2; - ci.Char.UnicodeChar = '#'; - ci.Attributes = TEST_ATTRIB; - - clip.Left = 0; - clip.Right = sbSize.X - 1; - clip.Top = 0; - clip.Bottom = sbSize.Y - 1; - - ok(ScrollConsoleScreenBuffer(hCon, &scroll, NULL, dst, &ci), "Scrolling SB\n"); - - for (c.Y = 0; c.Y < sbSize.Y; c.Y++) - { - for (c.X = 0; c.X < sbSize.X; c.X++) - { - if (dst.X <= c.X && c.X < dst.X + W && dst.Y <= c.Y && c.Y < dst.Y + H) - { - tc.X = c.X - dst.X; - tc.Y = c.Y - dst.Y; - okCHAR(hCon, c, CONTENT(tc), DEFAULT_ATTRIB); - } - else if (c.X < W && c.Y < H) okCHAR(hCon, c, '#', TEST_ATTRIB); - else okCHAR(hCon, c, CONTENT(c), DEFAULT_ATTRIB); - } - } - - /* clipping, src & dst rect don't overlap */ - resetContent(hCon, sbSize, TRUE); - - scroll.Left = 0; - scroll.Right = W - 1; - scroll.Top = 0; - scroll.Bottom = H - 1; - dst.X = W + 3; - dst.Y = H + 3; - ci.Char.UnicodeChar = '#'; - ci.Attributes = TEST_ATTRIB; - - clip.Left = W / 2; - clip.Right = min(W + W / 2, sbSize.X - 1); - clip.Top = H / 2; - clip.Bottom = min(H + H / 2, sbSize.Y - 1); - - ok(ScrollConsoleScreenBuffer(hCon, &scroll, &clip, dst, &ci), "Scrolling SB\n"); - - for (c.Y = 0; c.Y < sbSize.Y; c.Y++) - { - for (c.X = 0; c.X < sbSize.X; c.X++) - { - if (IN_SRECT2(scroll, dst, c) && IN_SRECT(clip, c)) - { - tc.X = c.X - dst.X; - tc.Y = c.Y - dst.Y; - okCHAR(hCon, c, CONTENT(tc), DEFAULT_ATTRIB); - } - else if (IN_SRECT(scroll, c) && IN_SRECT(clip, c)) - okCHAR(hCon, c, '#', TEST_ATTRIB); - else okCHAR(hCon, c, CONTENT(c), DEFAULT_ATTRIB); - } - } - - /* clipping, src & dst rect do overlap */ - resetContent(hCon, sbSize, TRUE); - - scroll.Left = 0; - scroll.Right = W - 1; - scroll.Top = 0; - scroll.Bottom = H - 1; - dst.X = W / 2 - 3; - dst.Y = H / 2 - 3; - ci.Char.UnicodeChar = '#'; - ci.Attributes = TEST_ATTRIB; - - clip.Left = W / 2; - clip.Right = min(W + W / 2, sbSize.X - 1); - clip.Top = H / 2; - clip.Bottom = min(H + H / 2, sbSize.Y - 1); - - ok(ScrollConsoleScreenBuffer(hCon, &scroll, &clip, dst, &ci), "Scrolling SB\n"); - - for (c.Y = 0; c.Y < sbSize.Y; c.Y++) - { - for (c.X = 0; c.X < sbSize.X; c.X++) - { - if (IN_SRECT2(scroll, dst, c) && IN_SRECT(clip, c)) - { - tc.X = c.X - dst.X; - tc.Y = c.Y - dst.Y; - okCHAR(hCon, c, CONTENT(tc), DEFAULT_ATTRIB); - } - else if (IN_SRECT(scroll, c) && IN_SRECT(clip, c)) - okCHAR(hCon, c, '#', TEST_ATTRIB); - else okCHAR(hCon, c, CONTENT(c), DEFAULT_ATTRIB); - } - } -} -#endif - -START_TEST(console) -{ - HANDLE hConIn, hConOut; - BOOL ret; - CONSOLE_SCREEN_BUFFER_INFO sbi; - - /* be sure we have a clean console (and that's our own) - * FIXME: this will make the test fail (currently) if we don't run - * under X11 - * Another solution would be to rerun the test under wineconsole with - * the curses backend - */ - - hConIn = CreateFileA("CONIN$", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0); - hConOut = CreateFileA("CONOUT$", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0); - - /* first, we need to be sure we're attached to a console */ - if (hConIn == INVALID_HANDLE_VALUE || hConOut == INVALID_HANDLE_VALUE) - { - /* we're not attached to a console, let's do it */ - AllocConsole(); - hConIn = CreateFileA("CONIN$", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0); - hConOut = CreateFileA("CONOUT$", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0); - } - /* now verify everything's ok */ - ok(hConIn != INVALID_HANDLE_VALUE, "Opening ConIn\n"); - ok(hConOut != INVALID_HANDLE_VALUE, "Opening ConOut\n"); - - ok(ret = GetConsoleScreenBufferInfo(hConOut, &sbi), "Getting sb info\n"); - if (!ret) return; - - /* Non interactive tests */ - testCursor(hConOut, sbi.dwSize); - /* will test wrapped (on/off) & processed (on/off) strings output */ - testWrite(hConOut, sbi.dwSize); - /* will test line scrolling at the bottom of the screen */ - /* testBottomScroll(); */ - /* will test all the scrolling operations */ - /* this one is disabled for now, Wine's result are way too bad */ - /* testScroll(hCon, sbi.dwSize); */ - /* will test sb creation / modification... */ - /* testScreenBuffer() */ - - /* still to be done: events generation, access rights & access on objects */ -} diff --git a/reactos/apps/tests/kernel32/directory.c b/reactos/apps/tests/kernel32/directory.c deleted file mode 100644 index 5374ce05796..00000000000 --- a/reactos/apps/tests/kernel32/directory.c +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Unit test suite for directory functions. - * - * Copyright 2002 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 "wine/test.h" -#include "windef.h" -#include "winbase.h" -#include "winerror.h" - -/* If you change something in these tests, please do the same - * for GetSystemDirectory tests. - */ -static void test_GetWindowsDirectoryA(void) -{ - UINT len, len_with_null; - char buf[MAX_PATH]; - - len_with_null = GetWindowsDirectoryA(NULL, 0); - ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH\n"); - - lstrcpyA(buf, "foo"); - len_with_null = GetWindowsDirectoryA(buf, 1); - ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer\n"); - - lstrcpyA(buf, "foo"); - len = GetWindowsDirectoryA(buf, len_with_null - 1); - ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer\n"); - ok(len == len_with_null, "GetWindowsDirectoryW returned %d, expected %d\n", - len, len_with_null); - - lstrcpyA(buf, "foo"); - len = GetWindowsDirectoryA(buf, len_with_null); - ok(lstrcmpA(buf, "foo") != 0, "should touch the buffer\n"); - ok(len == strlen(buf), "returned length should be equal to the length of string\n"); - ok(len == len_with_null-1, "GetWindowsDirectoryA returned %d, expected %d\n", - len, len_with_null-1); -} - -static void test_GetWindowsDirectoryW(void) -{ - UINT len, len_with_null; - WCHAR buf[MAX_PATH]; - static const WCHAR fooW[] = {'f','o','o',0}; - - len_with_null = GetWindowsDirectoryW(NULL, 0); - if (len_with_null==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) - return; - ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH\n"); - - lstrcpyW(buf, fooW); - len = GetWindowsDirectoryW(buf, 1); - ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer\n"); - ok(len == len_with_null, "GetWindowsDirectoryW returned %d, expected %d\n", - len, len_with_null); - - lstrcpyW(buf, fooW); - len = GetWindowsDirectoryW(buf, len_with_null - 1); - ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer\n"); - ok(len == len_with_null, "GetWindowsDirectoryW returned %d, expected %d\n", - len, len_with_null); - - lstrcpyW(buf, fooW); - len = GetWindowsDirectoryW(buf, len_with_null); - ok(lstrcmpW(buf, fooW) != 0, "should touch the buffer\n"); - ok(len == lstrlenW(buf), "returned length should be equal to the length of string\n"); - ok(len == len_with_null-1, "GetWindowsDirectoryW returned %d, expected %d\n", - len, len_with_null-1); -} - - -/* If you change something in these tests, please do the same - * for GetWindowsDirectory tests. - */ -static void test_GetSystemDirectoryA(void) -{ - UINT len, len_with_null; - char buf[MAX_PATH]; - - len_with_null = GetSystemDirectoryA(NULL, 0); - ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH\n"); - - lstrcpyA(buf, "foo"); - len = GetSystemDirectoryA(buf, 1); - ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer\n"); - ok(len == len_with_null, "GetSystemDirectoryA returned %d, expected %d\n", - len, len_with_null); - - lstrcpyA(buf, "foo"); - len = GetSystemDirectoryA(buf, len_with_null - 1); - ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer\n"); - ok(len == len_with_null, "GetSystemDirectoryA returned %d, expected %d\n", - len, len_with_null); - - lstrcpyA(buf, "foo"); - len = GetSystemDirectoryA(buf, len_with_null); - ok(lstrcmpA(buf, "foo") != 0, "should touch the buffer\n"); - ok(len == strlen(buf), "returned length should be equal to the length of string\n"); - ok(len == len_with_null-1, "GetSystemDirectoryW returned %d, expected %d\n", - len, len_with_null-1); -} - -static void test_GetSystemDirectoryW(void) -{ - UINT len, len_with_null; - WCHAR buf[MAX_PATH]; - static const WCHAR fooW[] = {'f','o','o',0}; - - len_with_null = GetSystemDirectoryW(NULL, 0); - if (len_with_null==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) - return; - ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH\n"); - - lstrcpyW(buf, fooW); - len = GetSystemDirectoryW(buf, 1); - ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer\n"); - ok(len == len_with_null, "GetSystemDirectoryW returned %d, expected %d\n", - len, len_with_null); - - lstrcpyW(buf, fooW); - len = GetSystemDirectoryW(buf, len_with_null - 1); - ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer\n"); - ok(len == len_with_null, "GetSystemDirectoryW returned %d, expected %d\n", - len, len_with_null); - - lstrcpyW(buf, fooW); - len = GetSystemDirectoryW(buf, len_with_null); - ok(lstrcmpW(buf, fooW) != 0, "should touch the buffer\n"); - ok(len == lstrlenW(buf), "returned length should be equal to the length of string\n"); - ok(len == len_with_null-1, "GetSystemDirectoryW returned %d, expected %d\n", - len, len_with_null-1); -} - -static void test_CreateDirectoryA(void) -{ - char tmpdir[MAX_PATH]; - BOOL ret; - - ret = CreateDirectoryA(NULL, NULL); - ok(ret == FALSE && (GetLastError() == ERROR_PATH_NOT_FOUND || - GetLastError() == ERROR_INVALID_PARAMETER), - "CreateDirectoryA(NULL,NULL): ret=%d error=%ld\n",ret,GetLastError()); - - ret = CreateDirectoryA("", NULL); - ok(ret == FALSE && (GetLastError() == ERROR_BAD_PATHNAME || - GetLastError() == ERROR_PATH_NOT_FOUND), - "CreateDirectoryA(\"\",NULL): ret=%d error=%ld\n",ret,GetLastError()); - - ret = GetSystemDirectoryA(tmpdir, MAX_PATH); - ok(ret < MAX_PATH, "System directory should fit into MAX_PATH\n"); - - ret = SetCurrentDirectoryA(tmpdir); - ok(ret == TRUE, "could not chdir to the System directory\n"); - - ret = CreateDirectoryA(".", NULL); - ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path\n"); - - ret = CreateDirectoryA("..", NULL); - ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path\n"); - - GetTempPathA(MAX_PATH, tmpdir); - tmpdir[3] = 0; /* truncate the path */ - ret = CreateDirectoryA(tmpdir, NULL); - ok(ret == FALSE && (GetLastError() == ERROR_ALREADY_EXISTS || - GetLastError() == ERROR_ACCESS_DENIED), - "CreateDirectoryA(drive_root): ret=%d error=%ld\n",ret,GetLastError()); - - GetTempPathA(MAX_PATH, tmpdir); - lstrcatA(tmpdir, "Please Remove Me"); - ret = CreateDirectoryA(tmpdir, NULL); - ok(ret == TRUE, "CreateDirectoryA should always succeed\n"); - - ret = CreateDirectoryA(tmpdir, NULL); - ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path\n"); - - ret = RemoveDirectoryA(tmpdir); - ok(ret == TRUE, "RemoveDirectoryA should always succeed\n"); - - lstrcatA(tmpdir, "?"); - ret = CreateDirectoryA(tmpdir, NULL); - ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME, - "CreateDirectoryA with ? wildcard name should fail, ret=%s error=%ld\n", - ret ? " True" : "False", GetLastError()); - ret = RemoveDirectoryA(tmpdir); - - tmpdir[lstrlenA(tmpdir) - 1] = '*'; - ret = CreateDirectoryA(tmpdir, NULL); - ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME, - "CreateDirectoryA with * wildcard name should fail, ret=%s error=%ld\n", - ret ? " True" : "False", GetLastError()); - ret = RemoveDirectoryA(tmpdir); -} - -static void test_CreateDirectoryW(void) -{ - WCHAR tmpdir[MAX_PATH]; - BOOL ret; - static const WCHAR empty_strW[] = { 0 }; - static const WCHAR tmp_dir_name[] = {'P','l','e','a','s','e',' ','R','e','m','o','v','e',' ','M','e',0}; - static const WCHAR dotW[] = {'.',0}; - static const WCHAR dotdotW[] = {'.','.',0}; - static const WCHAR questionW[] = {'?',0}; - - ret = CreateDirectoryW(NULL, NULL); - if (!ret && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) - return; - ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND, "should not create NULL path\n"); - - ret = CreateDirectoryW(empty_strW, NULL); - ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND, "should not create empty path\n"); - - ret = GetSystemDirectoryW(tmpdir, MAX_PATH); - ok(ret < MAX_PATH, "System directory should fit into MAX_PATH\n"); - - ret = SetCurrentDirectoryW(tmpdir); - ok(ret == TRUE, "could not chdir to the System directory\n"); - - ret = CreateDirectoryW(dotW, NULL); - ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path\n"); - - ret = CreateDirectoryW(dotdotW, NULL); - ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path\n"); - - GetTempPathW(MAX_PATH, tmpdir); - tmpdir[3] = 0; /* truncate the path */ - ret = CreateDirectoryW(tmpdir, NULL); - ok(ret == FALSE && GetLastError() == ERROR_ACCESS_DENIED, "should deny access to the drive root\n"); - - GetTempPathW(MAX_PATH, tmpdir); - lstrcatW(tmpdir, tmp_dir_name); - ret = CreateDirectoryW(tmpdir, NULL); - ok(ret == TRUE, "CreateDirectoryW should always succeed\n"); - - ret = CreateDirectoryW(tmpdir, NULL); - ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path\n"); - - ret = RemoveDirectoryW(tmpdir); - ok(ret == TRUE, "RemoveDirectoryW should always succeed\n"); - - lstrcatW(tmpdir, questionW); - ret = CreateDirectoryW(tmpdir, NULL); - ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME, - "CreateDirectoryW with ? wildcard name should fail with error 183, ret=%s error=%ld\n", - ret ? " True" : "False", GetLastError()); - ret = RemoveDirectoryW(tmpdir); - - tmpdir[lstrlenW(tmpdir) - 1] = '*'; - ret = CreateDirectoryW(tmpdir, NULL); - ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME, - "CreateDirectoryW with * wildcard name should fail with error 183, ret=%s error=%ld\n", - ret ? " True" : "False", GetLastError()); - ret = RemoveDirectoryW(tmpdir); -} - -static void test_RemoveDirectoryA(void) -{ - char tmpdir[MAX_PATH]; - BOOL ret; - - GetTempPathA(MAX_PATH, tmpdir); - lstrcatA(tmpdir, "Please Remove Me"); - ret = CreateDirectoryA(tmpdir, NULL); - ok(ret == TRUE, "CreateDirectoryA should always succeed\n"); - - ret = RemoveDirectoryA(tmpdir); - ok(ret == TRUE, "RemoveDirectoryA should always succeed\n"); - - lstrcatA(tmpdir, "?"); - ret = RemoveDirectoryA(tmpdir); - ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME, - "RemoveDirectoryA with ? wildcard name should fail with error 183, ret=%s error=%ld\n", - ret ? " True" : "False", GetLastError()); - - tmpdir[lstrlenA(tmpdir) - 1] = '*'; - ret = RemoveDirectoryA(tmpdir); - ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME, - "RemoveDirectoryA with * wildcard name should fail with error 183, ret=%s error=%ld\n", - ret ? " True" : "False", GetLastError()); -} - -static void test_RemoveDirectoryW(void) -{ - WCHAR tmpdir[MAX_PATH]; - BOOL ret; - static const WCHAR tmp_dir_name[] = {'P','l','e','a','s','e',' ','R','e','m','o','v','e',' ','M','e',0}; - static const WCHAR questionW[] = {'?',0}; - - GetTempPathW(MAX_PATH, tmpdir); - lstrcatW(tmpdir, tmp_dir_name); - ret = CreateDirectoryW(tmpdir, NULL); - if (!ret && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) - return; - - ok(ret == TRUE, "CreateDirectoryW should always succeed\n"); - - ret = RemoveDirectoryW(tmpdir); - ok(ret == TRUE, "RemoveDirectoryW should always succeed\n"); - - lstrcatW(tmpdir, questionW); - ret = RemoveDirectoryW(tmpdir); - ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME, - "RemoveDirectoryW with wildcard should fail with error 183, ret=%s error=%ld\n", - ret ? " True" : "False", GetLastError()); - - tmpdir[lstrlenW(tmpdir) - 1] = '*'; - ret = RemoveDirectoryW(tmpdir); - ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME, - "RemoveDirectoryW with * wildcard name should fail with error 183, ret=%s error=%ld\n", - ret ? " True" : "False", GetLastError()); -} - -START_TEST(directory) -{ - test_GetWindowsDirectoryA(); - test_GetWindowsDirectoryW(); - - test_GetSystemDirectoryA(); - test_GetSystemDirectoryW(); - - test_CreateDirectoryA(); - test_CreateDirectoryW(); - - test_RemoveDirectoryA(); - test_RemoveDirectoryW(); -} diff --git a/reactos/apps/tests/kernel32/drive.c b/reactos/apps/tests/kernel32/drive.c deleted file mode 100644 index 085f317ad41..00000000000 --- a/reactos/apps/tests/kernel32/drive.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Unit test suite for drive functions. - * - * Copyright 2002 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 "wine/test.h" -#include "windef.h" -#include "winbase.h" -#include "winerror.h" - -void test_GetDriveTypeA(void) -{ - char drive[] = "?:\\"; - DWORD logical_drives; - UINT type; - - logical_drives = GetLogicalDrives(); - ok(logical_drives != 0, "GetLogicalDrives error %ld\n", GetLastError()); - - for (drive[0] = 'A'; drive[0] <= 'Z'; drive[0]++) - { - type = GetDriveTypeA(drive); - ok(type > 0 && type <= 6, "not a valid drive %c: type %u\n", drive[0], type); - - if (!(logical_drives & 1)) - ok(type == DRIVE_NO_ROOT_DIR, - "GetDriveTypeA should return DRIVE_NO_ROOT_DIR for inexistant drive %c: but not %u\n", - drive[0], type); - - logical_drives >>= 1; - } -} - -void test_GetDriveTypeW(void) -{ - WCHAR drive[] = {'?',':','\\',0}; - DWORD logical_drives; - UINT type; - - logical_drives = GetLogicalDrives(); - ok(logical_drives != 0, "GetLogicalDrives error %ld\n", GetLastError()); - - for (drive[0] = 'A'; drive[0] <= 'Z'; drive[0]++) - { - type = GetDriveTypeW(drive); - if (type == DRIVE_UNKNOWN && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) - { - /* Must be Win9x which doesn't support the Unicode functions */ - return; - } - ok(type > 0 && type <= 6, "not a valid drive %c: type %u\n", drive[0], type); - - if (!(logical_drives & 1)) - ok(type == DRIVE_NO_ROOT_DIR, - "GetDriveTypeW should return DRIVE_NO_ROOT_DIR for inexistant drive %c: but not %u\n", - drive[0], type); - - logical_drives >>= 1; - } -} - -void test_GetDiskFreeSpaceA(void) -{ - BOOL ret; - DWORD sectors_per_cluster, bytes_per_sector, free_clusters, total_clusters; - char drive[] = "?:\\"; - DWORD logical_drives; - - ret = GetDiskFreeSpaceA(NULL, §ors_per_cluster, &bytes_per_sector, &free_clusters, &total_clusters); - ok(ret, "GetDiskFreeSpaceA error %ld\n", GetLastError()); - - ret = GetDiskFreeSpaceA("", §ors_per_cluster, &bytes_per_sector, &free_clusters, &total_clusters); - ok(!ret && (GetLastError() == ERROR_PATH_NOT_FOUND || GetLastError() == ERROR_INVALID_NAME), - "GetDiskFreeSpaceA(\"\"): ret=%d GetLastError=%ld\n", - ret, GetLastError()); - - ret = GetDiskFreeSpaceA("\\", §ors_per_cluster, &bytes_per_sector, &free_clusters, &total_clusters); - ok(ret, "GetDiskFreeSpaceA error %ld\n", GetLastError()); - - ret = GetDiskFreeSpaceA("/", §ors_per_cluster, &bytes_per_sector, &free_clusters, &total_clusters); - ok(ret, "GetDiskFreeSpaceA error %ld\n", GetLastError()); - - logical_drives = GetLogicalDrives(); - ok(logical_drives != 0, "GetLogicalDrives error %ld\n", GetLastError()); - - for (drive[0] = 'A'; drive[0] <= 'Z'; drive[0]++) - { - /* Skip floppy drives because NT pops up a MessageBox if no - * floppy is present - */ - if (GetDriveTypeA(drive)!=DRIVE_REMOVABLE) - { - ret = GetDiskFreeSpaceA(drive, §ors_per_cluster, &bytes_per_sector, &free_clusters, &total_clusters); - if (!(logical_drives & 1)) - ok(!ret && (GetLastError() == ERROR_PATH_NOT_FOUND || GetLastError() == ERROR_INVALID_DRIVE), - "GetDiskFreeSpaceA(%s): ret=%d GetLastError=%ld\n", - drive, ret, GetLastError()); - else - ok(ret || - (!ret && (GetLastError() == ERROR_NOT_READY || GetLastError() == ERROR_INVALID_DRIVE)), - "GetDiskFreeSpaceA(%s): ret=%d GetLastError=%ld\n", - drive, ret, GetLastError()); - } - logical_drives >>= 1; - } -} - -void test_GetDiskFreeSpaceW(void) -{ - BOOL ret; - DWORD sectors_per_cluster, bytes_per_sector, free_clusters, total_clusters; - WCHAR drive[] = {'?',':','\\',0}; - DWORD logical_drives; - static const WCHAR empty_pathW[] = { 0 }; - static const WCHAR root_pathW[] = { '\\', 0 }; - static const WCHAR unix_style_root_pathW[] = { '/', 0 }; - - ret = GetDiskFreeSpaceW(NULL, §ors_per_cluster, &bytes_per_sector, &free_clusters, &total_clusters); - if (ret == 0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) - { - /* Must be Win9x which doesn't support the Unicode functions */ - return; - } - ok(ret, "GetDiskFreeSpaceW error %ld\n", GetLastError()); - - ret = GetDiskFreeSpaceW(empty_pathW, §ors_per_cluster, &bytes_per_sector, &free_clusters, &total_clusters); - ok(!ret && GetLastError() == ERROR_PATH_NOT_FOUND, - "GetDiskFreeSpaceW(\"\"): ret=%d GetLastError=%ld\n", - ret, GetLastError()); - - ret = GetDiskFreeSpaceW(root_pathW, §ors_per_cluster, &bytes_per_sector, &free_clusters, &total_clusters); - ok(ret, "GetDiskFreeSpaceW(\"\") error %ld\n", GetLastError()); - - ret = GetDiskFreeSpaceW(unix_style_root_pathW, §ors_per_cluster, &bytes_per_sector, &free_clusters, &total_clusters); - ok(ret, "GetDiskFreeSpaceW error %ld\n", GetLastError()); - - logical_drives = GetLogicalDrives(); - ok(logical_drives != 0, "GetLogicalDrives error %ld\n", GetLastError()); - - for (drive[0] = 'A'; drive[0] <= 'Z'; drive[0]++) - { - /* Skip floppy drives because NT4 pops up a MessageBox if no floppy is present */ - if (GetDriveTypeW(drive)!=DRIVE_REMOVABLE) - { - ret = GetDiskFreeSpaceW(drive, §ors_per_cluster, &bytes_per_sector, &free_clusters, &total_clusters); - if (!(logical_drives & 1)) - ok(!ret && GetLastError() == ERROR_PATH_NOT_FOUND, - "GetDiskFreeSpaceW(%c): ret=%d GetLastError=%ld\n", - drive[0], ret, GetLastError()); - else - ok(ret || GetLastError() == ERROR_NOT_READY, - "GetDiskFreeSpaceW(%c): ret=%d GetLastError=%ld\n", - drive[0], ret, GetLastError()); - } - logical_drives >>= 1; - } -} - -START_TEST(drive) -{ - test_GetDriveTypeA(); - test_GetDriveTypeW(); - - test_GetDiskFreeSpaceA(); - test_GetDiskFreeSpaceW(); -} diff --git a/reactos/apps/tests/kernel32/environ.c b/reactos/apps/tests/kernel32/environ.c deleted file mode 100644 index ed327034997..00000000000 --- a/reactos/apps/tests/kernel32/environ.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Unit test suite for environment functions. - * - * Copyright 2002 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 "wine/test.h" -#include "windef.h" -#include "winbase.h" -#include "winerror.h" - -static void test_GetSetEnvironmentVariableA(void) -{ - char buf[256]; - BOOL ret; - DWORD ret_size; - static const char name[] = "SomeWildName"; - static const char name_cased[] = "sOMEwILDnAME"; - static const char value[] = "SomeWildValue"; - - ret = SetEnvironmentVariableA(name, value); - ok(ret == TRUE, - "unexpected error in SetEnvironmentVariableA, GetLastError=%ld\n", - GetLastError()); - - /* Try to retrieve the environment variable we just set */ - ret_size = GetEnvironmentVariableA(name, NULL, 0); - ok(ret_size == strlen(value) + 1, - "should return length with terminating 0 ret_size=%ld\n", ret_size); - - lstrcpyA(buf, "foo"); - ret_size = GetEnvironmentVariableA(name, buf, lstrlenA(value)); - ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer\n"); - ok(ret_size == strlen(value) + 1, - "should return length with terminating 0 ret_size=%ld\n", ret_size); - - lstrcpyA(buf, "foo"); - ret_size = GetEnvironmentVariableA(name, buf, lstrlenA(value) + 1); - ok(lstrcmpA(buf, value) == 0, "should touch the buffer\n"); - ok(ret_size == strlen(value), - "should return length without terminating 0 ret_size=%ld\n", ret_size); - - lstrcpyA(buf, "foo"); - ret_size = GetEnvironmentVariableA(name_cased, buf, lstrlenA(value) + 1); - ok(lstrcmpA(buf, value) == 0, "should touch the buffer\n"); - ok(ret_size == strlen(value), - "should return length without terminating 0 ret_size=%ld\n", ret_size); - - /* Remove that environment variable */ - ret = SetEnvironmentVariableA(name_cased, NULL); - ok(ret == TRUE, "should erase existing variable\n"); - - lstrcpyA(buf, "foo"); - ret_size = GetEnvironmentVariableA(name, buf, lstrlenA(value) + 1); - ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer\n"); - ok(ret_size == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND, - "should not find variable but ret_size=%ld GetLastError=%ld\n", - ret_size, GetLastError()); - - /* Check behavior of SetEnvironmentVariableA(name, "") */ - ret = SetEnvironmentVariableA(name, value); - ok(ret == TRUE, - "unexpected error in SetEnvironmentVariableA, GetLastError=%ld\n", - GetLastError()); - - lstrcpyA(buf, "foo"); - ret_size = GetEnvironmentVariableA(name_cased, buf, lstrlenA(value) + 1); - ok(lstrcmpA(buf, value) == 0, "should touch the buffer\n"); - ok(ret_size == strlen(value), - "should return length without terminating 0 ret_size=%ld\n", ret_size); - - ret = SetEnvironmentVariableA(name_cased, ""); - ok(ret == TRUE, - "should not fail with empty value but GetLastError=%ld\n", GetLastError()); - - lstrcpyA(buf, "foo"); - SetLastError(0); - ret_size = GetEnvironmentVariableA(name, buf, lstrlenA(value) + 1); - ok(ret_size == 0 && - ((GetLastError() == 0 && lstrcmpA(buf, "") == 0) || - (GetLastError() == ERROR_ENVVAR_NOT_FOUND)), - "%s should be set to \"\" (NT) or removed (Win9x) but ret_size=%ld GetLastError=%ld and buf=%s\n", - name, ret_size, GetLastError(), buf); - - /* Test the limits */ - ret_size = GetEnvironmentVariableA(NULL, NULL, 0); - ok(ret_size == 0 && (GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == ERROR_ENVVAR_NOT_FOUND), - "should not find variable but ret_size=%ld GetLastError=%ld\n", - ret_size, GetLastError()); - - ret_size = GetEnvironmentVariableA(NULL, buf, lstrlenA(value) + 1); - ok(ret_size == 0 && (GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == ERROR_ENVVAR_NOT_FOUND), - "should not find variable but ret_size=%ld GetLastError=%ld\n", - ret_size, GetLastError()); - - ret_size = GetEnvironmentVariableA("", buf, lstrlenA(value) + 1); - ok(ret_size == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND, - "should not find variable but ret_size=%ld GetLastError=%ld\n", - ret_size, GetLastError()); -} - -static void test_GetSetEnvironmentVariableW(void) -{ - WCHAR buf[256]; - BOOL ret; - DWORD ret_size; - static const WCHAR name[] = {'S','o','m','e','W','i','l','d','N','a','m','e',0}; - static const WCHAR value[] = {'S','o','m','e','W','i','l','d','V','a','l','u','e',0}; - static const WCHAR name_cased[] = {'s','O','M','E','w','I','L','D','n','A','M','E',0}; - static const WCHAR empty_strW[] = { 0 }; - static const WCHAR fooW[] = {'f','o','o',0}; - - ret = SetEnvironmentVariableW(name, value); - if (ret == FALSE && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) - { - /* Must be Win9x which doesn't support the Unicode functions */ - return; - } - ok(ret == TRUE, - "unexpected error in SetEnvironmentVariableW, GetLastError=%ld\n", - GetLastError()); - - /* Try to retrieve the environment variable we just set */ - ret_size = GetEnvironmentVariableW(name, NULL, 0); - ok(ret_size == lstrlenW(value) + 1, - "should return length with terminating 0 ret_size=%ld\n", - ret_size); - - lstrcpyW(buf, fooW); - ret_size = GetEnvironmentVariableW(name, buf, lstrlenW(value)); - ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer\n"); - - ok(ret_size == lstrlenW(value) + 1, - "should return length with terminating 0 ret_size=%ld\n", ret_size); - - lstrcpyW(buf, fooW); - ret_size = GetEnvironmentVariableW(name, buf, lstrlenW(value) + 1); - ok(lstrcmpW(buf, value) == 0, "should touch the buffer\n"); - ok(ret_size == lstrlenW(value), - "should return length without terminating 0 ret_size=%ld\n", ret_size); - - lstrcpyW(buf, fooW); - ret_size = GetEnvironmentVariableW(name_cased, buf, lstrlenW(value) + 1); - ok(lstrcmpW(buf, value) == 0, "should touch the buffer\n"); - ok(ret_size == lstrlenW(value), - "should return length without terminating 0 ret_size=%ld\n", ret_size); - - /* Remove that environment variable */ - ret = SetEnvironmentVariableW(name_cased, NULL); - ok(ret == TRUE, "should erase existing variable\n"); - - lstrcpyW(buf, fooW); - ret_size = GetEnvironmentVariableW(name, buf, lstrlenW(value) + 1); - ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer\n"); - ok(ret_size == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND, - "should not find variable but ret_size=%ld GetLastError=%ld\n", - ret_size, GetLastError()); - - /* Check behavior of SetEnvironmentVariableW(name, "") */ - ret = SetEnvironmentVariableW(name, value); - ok(ret == TRUE, - "unexpected error in SetEnvironmentVariableW, GetLastError=%ld\n", - GetLastError()); - - lstrcpyW(buf, fooW); - ret_size = GetEnvironmentVariableW(name, buf, lstrlenW(value) + 1); - ok(lstrcmpW(buf, value) == 0, "should touch the buffer\n"); - ok(ret_size == lstrlenW(value), - "should return length without terminating 0 ret_size=%ld\n", ret_size); - - ret = SetEnvironmentVariableW(name_cased, empty_strW); - ok(ret == TRUE, "should not fail with empty value but GetLastError=%ld\n", GetLastError()); - - lstrcpyW(buf, fooW); - ret_size = GetEnvironmentVariableW(name, buf, lstrlenW(value) + 1); - ok(ret_size == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND, - "should not find variable but ret_size=%ld GetLastError=%ld\n", - ret_size, GetLastError()); - ok(lstrcmpW(buf, empty_strW) == 0, "should copy an empty string\n"); - - /* Test the limits */ - ret_size = GetEnvironmentVariableW(NULL, NULL, 0); - ok(ret_size == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND, - "should not find variable but ret_size=%ld GetLastError=%ld\n", - ret_size, GetLastError()); - - ret_size = GetEnvironmentVariableW(NULL, buf, lstrlenW(value) + 1); - ok(ret_size == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND, - "should not find variable but ret_size=%ld GetLastError=%ld\n", - ret_size, GetLastError()); - - ret = SetEnvironmentVariableW(NULL, NULL); - ok(ret == FALSE && (GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == ERROR_ENVVAR_NOT_FOUND), - "should fail with NULL, NULL but ret=%d and GetLastError=%ld\n", - ret, GetLastError()); -} - -START_TEST(environ) -{ - test_GetSetEnvironmentVariableA(); - test_GetSetEnvironmentVariableW(); -} diff --git a/reactos/apps/tests/kernel32/file.c b/reactos/apps/tests/kernel32/file.c deleted file mode 100644 index 651763e8cbe..00000000000 --- a/reactos/apps/tests/kernel32/file.c +++ /dev/null @@ -1,1199 +0,0 @@ -/* - * Unit tests for file functions in Wine - * - * Copyright (c) 2002, 2004 Jakob Eriksson - * - * 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 "wine/test.h" -#include "windef.h" -#include "winbase.h" -#include "winerror.h" - -static int dll_capable(const char *dll, const char *function) -{ - HMODULE module = GetModuleHandleA(dll); - if (!module) return 0; - - return (GetProcAddress(module, function) != NULL); -} - - -LPCSTR filename = "testfile.xxx"; -LPCSTR sillytext = -"en larvig liten text dx \033 gx hej 84 hej 4484 ! \001\033 bla bl\na.. bla bla." -"1234 43 4kljf lf &%%%&&&&&& 34 4 34 3############# 33 3 3 3 # 3## 3" -"1234 43 4kljf lf &%%%&&&&&& 34 4 34 3############# 33 3 3 3 # 3## 3" -"1234 43 4kljf lf &%%%&&&&&& 34 4 34 3############# 33 3 3 3 # 3## 3" -"1234 43 4kljf lf &%%%&&&&&& 34 4 34 3############# 33 3 3 3 # 3## 3" -"1234 43 4kljf lf &%%%&&&&&& 34 4 34 3############# 33 3 3 3 # 3## 3" -"1234 43 4kljf lf &%%%&&&&&& 34 4 34 3############# 33 3 3 3 # 3## 3" -"1234 43 4kljf lf &%%%&&&&&& 34 4 34 3############# 33 3 3 3 # 3## 3" -"1234 43 4kljf lf &%%%&&&&&& 34 4 34 3############# 33 3 3 3 # 3## 3" -"sdlkfjasdlkfj a dslkj adsklf \n \nasdklf askldfa sdlkf \nsadklf asdklf asdf "; - - -static void test__hread( void ) -{ - HFILE filehandle; - char buffer[10000]; - long bytes_read; - long bytes_wanted; - long i; - - SetFileAttributesA(filename,FILE_ATTRIBUTE_NORMAL); /* be sure to remove stale files */ - DeleteFileA( filename ); - filehandle = _lcreat( filename, 0 ); - if (filehandle == HFILE_ERROR) - { - ok(0,"couldn't create file \"%s\" (err=%ld)\n",filename,GetLastError()); - return; - } - - ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains\n" ); - - ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" ); - - filehandle = _lopen( filename, OF_READ ); - - ok( HFILE_ERROR != filehandle, "couldn't open file \"%s\" again (err=%ld)\n", filename, GetLastError( ) ); - - bytes_read = _hread( filehandle, buffer, 2 * strlen( sillytext ) ); - - ok( lstrlenA( sillytext ) == bytes_read, "file read size error\n" ); - - for (bytes_wanted = 0; bytes_wanted < lstrlenA( sillytext ); bytes_wanted++) - { - ok( 0 == _llseek( filehandle, 0, FILE_BEGIN ), "_llseek complains\n" ); - ok( _hread( filehandle, buffer, bytes_wanted ) == bytes_wanted, "erratic _hread return value\n" ); - for (i = 0; i < bytes_wanted; i++) - { - ok( buffer[i] == sillytext[i], "that's not what's written\n" ); - } - } - - ok( HFILE_ERROR != _lclose( filehandle ), "_lclose complains\n" ); - - ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) ); -} - - -static void test__hwrite( void ) -{ - HFILE filehandle; - char buffer[10000]; - long bytes_read; - long bytes_written; - long blocks; - long i; - char *contents; - HLOCAL memory_object; - char checksum[1]; - - filehandle = _lcreat( filename, 0 ); - if (filehandle == HFILE_ERROR) - { - ok(0,"couldn't create file \"%s\" (err=%ld)\n",filename,GetLastError()); - return; - } - - ok( HFILE_ERROR != _hwrite( filehandle, "", 0 ), "_hwrite complains\n" ); - - ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" ); - - filehandle = _lopen( filename, OF_READ ); - - bytes_read = _hread( filehandle, buffer, 1); - - ok( 0 == bytes_read, "file read size error\n" ); - - ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" ); - - filehandle = _lopen( filename, OF_READWRITE ); - - bytes_written = 0; - checksum[0] = '\0'; - srand( (unsigned)time( NULL ) ); - for (blocks = 0; blocks < 100; blocks++) - { - for (i = 0; i < (long)sizeof( buffer ); i++) - { - buffer[i] = rand( ); - checksum[0] = checksum[0] + buffer[i]; - } - ok( HFILE_ERROR != _hwrite( filehandle, buffer, sizeof( buffer ) ), "_hwrite complains\n" ); - bytes_written = bytes_written + sizeof( buffer ); - } - - ok( HFILE_ERROR != _hwrite( filehandle, checksum, 1 ), "_hwrite complains\n" ); - bytes_written++; - - ok( HFILE_ERROR != _lclose( filehandle ), "_lclose complains\n" ); - - memory_object = LocalAlloc( LPTR, bytes_written ); - - ok( 0 != memory_object, "LocalAlloc fails. (Could be out of memory.)\n" ); - - contents = LocalLock( memory_object ); - - filehandle = _lopen( filename, OF_READ ); - - contents = LocalLock( memory_object ); - - ok( NULL != contents, "LocalLock whines\n" ); - - ok( bytes_written == _hread( filehandle, contents, bytes_written), "read length differ from write length\n" ); - - checksum[0] = '\0'; - i = 0; - do - { - checksum[0] = checksum[0] + contents[i]; - i++; - } - while (i < bytes_written - 1); - - ok( checksum[0] == contents[i], "stored checksum differ from computed checksum\n" ); - - ok( HFILE_ERROR != _lclose( filehandle ), "_lclose complains\n" ); - - ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) ); -} - - -static void test__lclose( void ) -{ - HFILE filehandle; - - filehandle = _lcreat( filename, 0 ); - if (filehandle == HFILE_ERROR) - { - ok(0,"couldn't create file \"%s\" (err=%ld)\n",filename,GetLastError()); - return; - } - - ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains\n" ); - - ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" ); - - ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) ); -} - - -static void test__lcreat( void ) -{ - HFILE filehandle; - char buffer[10000]; - WIN32_FIND_DATAA search_results; - char slashname[] = "testfi/"; - int err; - HANDLE find; - - filehandle = _lcreat( filename, 0 ); - if (filehandle == HFILE_ERROR) - { - ok(0,"couldn't create file \"%s\" (err=%ld)\n",filename,GetLastError()); - return; - } - - ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains\n" ); - - ok( 0 == _llseek( filehandle, 0, FILE_BEGIN ), "_llseek complains\n" ); - - ok( _hread( filehandle, buffer, strlen( sillytext ) ) == lstrlenA( sillytext ), "erratic _hread return value\n" ); - - ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" ); - - ok( INVALID_HANDLE_VALUE != FindFirstFileA( filename, &search_results ), "should be able to find file\n" ); - - ok( DeleteFileA(filename) != 0, "DeleteFile failed (%ld)\n", GetLastError()); - - filehandle = _lcreat( filename, 1 ); /* readonly */ - ok( HFILE_ERROR != filehandle, "couldn't create file \"%s\" (err=%ld)\n", filename, GetLastError( ) ); - - ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite shouldn't be able to write never the less\n" ); - - ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" ); - - ok( INVALID_HANDLE_VALUE != FindFirstFileA( filename, &search_results ), "should be able to find file\n" ); - - ok( 0 == DeleteFileA( filename ), "shouldn't be able to delete a readonly file\n" ); - - ok( SetFileAttributesA(filename, FILE_ATTRIBUTE_NORMAL ) != 0, "couldn't change attributes on file\n" ); - - ok( DeleteFileA( filename ) != 0, "now it should be possible to delete the file!\n" ); - - filehandle = _lcreat( filename, 2 ); - ok( HFILE_ERROR != filehandle, "couldn't create file \"%s\" (err=%ld)\n", filename, GetLastError( ) ); - - ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains\n" ); - - ok( 0 == _llseek( filehandle, 0, FILE_BEGIN ), "_llseek complains\n" ); - - ok( _hread( filehandle, buffer, strlen( sillytext ) ) == lstrlenA( sillytext ), "erratic _hread return value\n" ); - - ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" ); - - ok( INVALID_HANDLE_VALUE != FindFirstFileA( filename, &search_results ), "should STILL be able to find file\n" ); - - ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) ); - - filehandle = _lcreat( filename, 4 ); /* SYSTEM file */ - ok( HFILE_ERROR != filehandle, "couldn't create file \"%s\" (err=%ld)\n", filename, GetLastError( ) ); - - ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains\n" ); - - ok( 0 == _llseek( filehandle, 0, FILE_BEGIN ), "_llseek complains\n" ); - - ok( _hread( filehandle, buffer, strlen( sillytext ) ) == lstrlenA( sillytext ), "erratic _hread return value\n" ); - - ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" ); - - ok( INVALID_HANDLE_VALUE != FindFirstFileA( filename, &search_results ), "should STILL be able to find file\n" ); - - ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) ); - - filehandle=_lcreat (slashname, 0); /* illegal name */ - if (HFILE_ERROR==filehandle) { - err=GetLastError (); - ok (err==ERROR_INVALID_NAME || err==ERROR_PATH_NOT_FOUND, - "creating file \"%s\" failed with error %d\n", slashname, err); - } else { /* only NT succeeds */ - _lclose(filehandle); - find=FindFirstFileA (slashname, &search_results); - if (INVALID_HANDLE_VALUE!=find) - { - ok (0!=FindClose (find), "FindClose complains (%ld)\n", GetLastError ()); - slashname[strlen(slashname)-1]=0; - ok (!strcmp (slashname, search_results.cFileName), - "found unexpected name \"%s\"\n", search_results.cFileName); - ok (FILE_ATTRIBUTE_ARCHIVE==search_results.dwFileAttributes, - "attributes of file \"%s\" are 0x%04lx\n", search_results.cFileName, - search_results.dwFileAttributes); - } - ok (0!=DeleteFileA (slashname), "Can't delete \"%s\" (%ld)\n", slashname, - GetLastError ()); - } - - filehandle=_lcreat (filename, 8); /* illegal attribute */ - if (HFILE_ERROR==filehandle) - ok (0, "couldn't create volume label \"%s\"\n", filename); - else { - _lclose(filehandle); - find=FindFirstFileA (filename, &search_results); - if (INVALID_HANDLE_VALUE==find) - ok (0, "file \"%s\" not found\n", filename); - else { - ok (0!=FindClose (find), "FindClose complains (%ld)\n", GetLastError ()); - ok (!strcmp (filename, search_results.cFileName), - "found unexpected name \"%s\"\n", search_results.cFileName); - ok (FILE_ATTRIBUTE_ARCHIVE==search_results.dwFileAttributes, - "attributes of file \"%s\" are 0x%04lx\n", search_results.cFileName, - search_results.dwFileAttributes); - } - ok (0!=DeleteFileA (filename), "Can't delete \"%s\" (%ld)\n", slashname, - GetLastError ()); - } -} - - -static void test__llseek( void ) -{ - INT i; - HFILE filehandle; - char buffer[1]; - long bytes_read; - - filehandle = _lcreat( filename, 0 ); - if (filehandle == HFILE_ERROR) - { - ok(0,"couldn't create file \"%s\" (err=%ld)\n",filename,GetLastError()); - return; - } - - for (i = 0; i < 400; i++) - { - ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains\n" ); - } - ok( HFILE_ERROR != _llseek( filehandle, 400 * strlen( sillytext ), FILE_CURRENT ), "should be able to seek\n" ); - ok( HFILE_ERROR != _llseek( filehandle, 27 + 35 * strlen( sillytext ), FILE_BEGIN ), "should be able to seek\n" ); - - bytes_read = _hread( filehandle, buffer, 1); - ok( 1 == bytes_read, "file read size error\n" ); - ok( buffer[0] == sillytext[27], "_llseek error, it got lost seeking\n" ); - ok( HFILE_ERROR != _llseek( filehandle, -400 * strlen( sillytext ), FILE_END ), "should be able to seek\n" ); - - bytes_read = _hread( filehandle, buffer, 1); - ok( 1 == bytes_read, "file read size error\n" ); - ok( buffer[0] == sillytext[0], "_llseek error, it got lost seeking\n" ); - ok( HFILE_ERROR != _llseek( filehandle, 1000000, FILE_END ), "should be able to seek past file; poor, poor Windows programmers\n" ); - ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" ); - - ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) ); -} - - -static void test__llopen( void ) -{ - HFILE filehandle; - UINT bytes_read; - char buffer[10000]; - - filehandle = _lcreat( filename, 0 ); - if (filehandle == HFILE_ERROR) - { - ok(0,"couldn't create file \"%s\" (err=%ld)\n",filename,GetLastError()); - return; - } - - ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains\n" ); - ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" ); - - filehandle = _lopen( filename, OF_READ ); - ok( HFILE_ERROR == _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite shouldn't be able to write!\n" ); - bytes_read = _hread( filehandle, buffer, strlen( sillytext ) ); - ok( strlen( sillytext ) == bytes_read, "file read size error\n" ); - ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" ); - - filehandle = _lopen( filename, OF_READWRITE ); - bytes_read = _hread( filehandle, buffer, 2 * strlen( sillytext ) ); - ok( strlen( sillytext ) == bytes_read, "file read size error\n" ); - ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite should write just fine\n" ); - ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" ); - - filehandle = _lopen( filename, OF_WRITE ); - ok( HFILE_ERROR == _hread( filehandle, buffer, 1 ), "you should only be able to write this file\n" ); - ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite should write just fine\n" ); - ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" ); - - ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) ); - /* TODO - add tests for the SHARE modes - use two processes to pull this one off */ -} - - -static void test__lread( void ) -{ - HFILE filehandle; - char buffer[10000]; - long bytes_read; - UINT bytes_wanted; - UINT i; - - filehandle = _lcreat( filename, 0 ); - if (filehandle == HFILE_ERROR) - { - ok(0,"couldn't create file \"%s\" (err=%ld)\n",filename,GetLastError()); - return; - } - - ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains\n" ); - - ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" ); - - filehandle = _lopen( filename, OF_READ ); - - ok( HFILE_ERROR != filehandle, "couldn't open file \"%s\" again (err=%ld)\n", filename, GetLastError()); - - bytes_read = _lread( filehandle, buffer, 2 * strlen( sillytext ) ); - - ok( lstrlenA( sillytext ) == bytes_read, "file read size error\n" ); - - for (bytes_wanted = 0; bytes_wanted < strlen( sillytext ); bytes_wanted++) - { - ok( 0 == _llseek( filehandle, 0, FILE_BEGIN ), "_llseek complains\n" ); - ok( _lread( filehandle, buffer, bytes_wanted ) == bytes_wanted, "erratic _hread return value\n" ); - for (i = 0; i < bytes_wanted; i++) - { - ok( buffer[i] == sillytext[i], "that's not what's written\n" ); - } - } - - ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" ); - - ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) ); -} - - -static void test__lwrite( void ) -{ - HFILE filehandle; - char buffer[10000]; - long bytes_read; - long bytes_written; - long blocks; - long i; - char *contents; - HLOCAL memory_object; - char checksum[1]; - - filehandle = _lcreat( filename, 0 ); - if (filehandle == HFILE_ERROR) - { - ok(0,"couldn't create file \"%s\" (err=%ld)\n",filename,GetLastError()); - return; - } - - ok( HFILE_ERROR != _lwrite( filehandle, "", 0 ), "_hwrite complains\n" ); - - ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" ); - - filehandle = _lopen( filename, OF_READ ); - - bytes_read = _hread( filehandle, buffer, 1); - - ok( 0 == bytes_read, "file read size error\n" ); - - ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" ); - - filehandle = _lopen( filename, OF_READWRITE ); - - bytes_written = 0; - checksum[0] = '\0'; - srand( (unsigned)time( NULL ) ); - for (blocks = 0; blocks < 100; blocks++) - { - for (i = 0; i < (long)sizeof( buffer ); i++) - { - buffer[i] = rand( ); - checksum[0] = checksum[0] + buffer[i]; - } - ok( HFILE_ERROR != _lwrite( filehandle, buffer, sizeof( buffer ) ), "_hwrite complains\n" ); - bytes_written = bytes_written + sizeof( buffer ); - } - - ok( HFILE_ERROR != _lwrite( filehandle, checksum, 1 ), "_hwrite complains\n" ); - bytes_written++; - - ok( HFILE_ERROR != _lclose( filehandle ), "_lclose complains\n" ); - - memory_object = LocalAlloc( LPTR, bytes_written ); - - ok( 0 != memory_object, "LocalAlloc fails, could be out of memory\n" ); - - contents = LocalLock( memory_object ); - - filehandle = _lopen( filename, OF_READ ); - - contents = LocalLock( memory_object ); - - ok( NULL != contents, "LocalLock whines\n" ); - - ok( bytes_written == _hread( filehandle, contents, bytes_written), "read length differ from write length\n" ); - - checksum[0] = '\0'; - i = 0; - do - { - checksum[0] += contents[i]; - i++; - } - while (i < bytes_written - 1); - - ok( checksum[0] == contents[i], "stored checksum differ from computed checksum\n" ); - - ok( HFILE_ERROR != _lclose( filehandle ), "_lclose complains\n" ); - - ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) ); -} - -static void test_CopyFileA(void) -{ - char temp_path[MAX_PATH]; - char source[MAX_PATH], dest[MAX_PATH]; - static const char prefix[] = "pfx"; - DWORD ret; - - ret = GetTempPathA(MAX_PATH, temp_path); - ok(ret != 0, "GetTempPathA error %ld\n", GetLastError()); - ok(ret < MAX_PATH, "temp path should fit into MAX_PATH\n"); - - ret = GetTempFileNameA(temp_path, prefix, 0, source); - ok(ret != 0, "GetTempFileNameA error %ld\n", GetLastError()); - - ret = GetTempFileNameA(temp_path, prefix, 0, dest); - ok(ret != 0, "GetTempFileNameA error %ld\n", GetLastError()); - - ret = CopyFileA(source, dest, TRUE); - ok(!ret && GetLastError() == ERROR_FILE_EXISTS, - "CopyFileA: unexpected error %ld\n", GetLastError()); - - ret = CopyFileA(source, dest, FALSE); - ok(ret, "CopyFileA: error %ld\n", GetLastError()); - - ret = DeleteFileA(source); - ok(ret, "DeleteFileA: error %ld\n", GetLastError()); - ret = DeleteFileA(dest); - ok(ret, "DeleteFileA: error %ld\n", GetLastError()); -} - -static void test_CopyFileW(void) -{ - WCHAR temp_path[MAX_PATH]; - WCHAR source[MAX_PATH], dest[MAX_PATH]; - static const WCHAR prefix[] = {'p','f','x',0}; - DWORD ret; - - ret = GetTempPathW(MAX_PATH, temp_path); - if (ret==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) - return; - ok(ret != 0, "GetTempPathW error %ld\n", GetLastError()); - ok(ret < MAX_PATH, "temp path should fit into MAX_PATH\n"); - - ret = GetTempFileNameW(temp_path, prefix, 0, source); - ok(ret != 0, "GetTempFileNameW error %ld\n", GetLastError()); - - ret = GetTempFileNameW(temp_path, prefix, 0, dest); - ok(ret != 0, "GetTempFileNameW error %ld\n", GetLastError()); - - ret = CopyFileW(source, dest, TRUE); - ok(!ret && GetLastError() == ERROR_FILE_EXISTS, - "CopyFileW: unexpected error %ld\n", GetLastError()); - - ret = CopyFileW(source, dest, FALSE); - ok(ret, "CopyFileW: error %ld\n", GetLastError()); - - ret = DeleteFileW(source); - ok(ret, "DeleteFileW: error %ld\n", GetLastError()); - ret = DeleteFileW(dest); - ok(ret, "DeleteFileW: error %ld\n", GetLastError()); -} - -static void test_CreateFileA(void) -{ - HANDLE hFile; - char temp_path[MAX_PATH]; - char filename[MAX_PATH]; - static const char prefix[] = "pfx"; - DWORD ret; - - ret = GetTempPathA(MAX_PATH, temp_path); - ok(ret != 0, "GetTempPathA error %ld\n", GetLastError()); - ok(ret < MAX_PATH, "temp path should fit into MAX_PATH\n"); - - ret = GetTempFileNameA(temp_path, prefix, 0, filename); - ok(ret != 0, "GetTempFileNameA error %ld\n", GetLastError()); - - hFile = CreateFileA(filename, GENERIC_READ, 0, NULL, - CREATE_NEW, FILE_FLAG_RANDOM_ACCESS, 0); - ok(hFile == INVALID_HANDLE_VALUE && GetLastError() == ERROR_FILE_EXISTS, - "CREATE_NEW should fail if file exists and last error value should be ERROR_FILE_EXISTS\n"); - - ret = DeleteFileA(filename); - ok(ret, "DeleteFileA: error %ld\n", GetLastError()); -} - -static void test_CreateFileW(void) -{ - HANDLE hFile; - WCHAR temp_path[MAX_PATH]; - WCHAR filename[MAX_PATH]; - static const WCHAR emptyW[]={'\0'}; - static const WCHAR prefix[] = {'p','f','x',0}; - DWORD ret; - - ret = GetTempPathW(MAX_PATH, temp_path); - if (ret==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) - return; - ok(ret != 0, "GetTempPathW error %ld\n", GetLastError()); - ok(ret < MAX_PATH, "temp path should fit into MAX_PATH\n"); - - ret = GetTempFileNameW(temp_path, prefix, 0, filename); - ok(ret != 0, "GetTempFileNameW error %ld\n", GetLastError()); - - hFile = CreateFileW(filename, GENERIC_READ, 0, NULL, - CREATE_NEW, FILE_FLAG_RANDOM_ACCESS, 0); - ok(hFile == INVALID_HANDLE_VALUE && GetLastError() == ERROR_FILE_EXISTS, - "CREATE_NEW should fail if file exists and last error value should be ERROR_FILE_EXISTS\n"); - - ret = DeleteFileW(filename); - ok(ret, "DeleteFileW: error %ld\n", GetLastError()); - - hFile = CreateFileW(NULL, GENERIC_READ, 0, NULL, - CREATE_NEW, FILE_FLAG_RANDOM_ACCESS, 0); - ok(hFile == INVALID_HANDLE_VALUE && GetLastError() == ERROR_PATH_NOT_FOUND, - "CreateFileW(NULL) returned ret=%p error=%ld\n",hFile,GetLastError()); - - hFile = CreateFileW(emptyW, GENERIC_READ, 0, NULL, - CREATE_NEW, FILE_FLAG_RANDOM_ACCESS, 0); - ok(hFile == INVALID_HANDLE_VALUE && GetLastError() == ERROR_PATH_NOT_FOUND, - "CreateFileW(\"\") returned ret=%p error=%ld\n",hFile,GetLastError()); -} - -static void test_GetTempFileNameA() -{ - UINT result; - char out[MAX_PATH]; - char expected[MAX_PATH + 10]; - char windowsdir[MAX_PATH + 10]; - char windowsdrive[3]; - - result = GetWindowsDirectory(windowsdir, sizeof(windowsdir)); - ok(result < sizeof(windowsdir), "windowsdir is abnormally long!\n"); - ok(result != 0, "GetWindowsDirectory: error %ld\n", GetLastError()); - - /* If the Windows directory is the root directory, it ends in backslash, not else. */ - if (strlen(windowsdir) != 3) /* As in "C:\" or "F:\" */ - { - strcat(windowsdir, "\\"); - } - - windowsdrive[0] = windowsdir[0]; - windowsdrive[1] = windowsdir[1]; - windowsdrive[2] = '\0'; - - result = GetTempFileNameA(windowsdrive, "abc", 1, out); - ok(result != 0, "GetTempFileNameA: error %ld\n", GetLastError()); - ok(((out[0] == windowsdrive[0]) && (out[1] == ':')) && (out[2] == '\\'), - "GetTempFileNameA: first three characters should be %c:\\, string was actually %s\n", - windowsdrive[0], out); - - result = GetTempFileNameA(windowsdir, "abc", 2, out); - ok(result != 0, "GetTempFileNameA: error %ld\n", GetLastError()); - expected[0] = '\0'; - strcat(expected, windowsdir); - strcat(expected, "abc2.tmp"); - ok(lstrcmpiA(out, expected) == 0, "GetTempFileNameA: Unexpected output \"%s\" vs \"%s\"\n", - out, expected); -} - -static void test_DeleteFileA( void ) -{ - BOOL ret; - - ret = DeleteFileA(NULL); - ok(!ret && (GetLastError() == ERROR_INVALID_PARAMETER || - GetLastError() == ERROR_PATH_NOT_FOUND), - "DeleteFileA(NULL) returned ret=%d error=%ld\n",ret,GetLastError()); - - ret = DeleteFileA(""); - ok(!ret && (GetLastError() == ERROR_PATH_NOT_FOUND || - GetLastError() == ERROR_BAD_PATHNAME), - "DeleteFileA(\"\") returned ret=%d error=%ld\n",ret,GetLastError()); - - ret = DeleteFileA("nul"); - ok(!ret && (GetLastError() == ERROR_FILE_NOT_FOUND || - GetLastError() == ERROR_INVALID_PARAMETER || - GetLastError() == ERROR_ACCESS_DENIED), - "DeleteFileA(\"nul\") returned ret=%d error=%ld\n",ret,GetLastError()); -} - -static void test_DeleteFileW( void ) -{ - BOOL ret; - static const WCHAR emptyW[]={'\0'}; - - ret = DeleteFileW(NULL); - if (ret==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) - return; - ok(!ret && GetLastError() == ERROR_PATH_NOT_FOUND, - "DeleteFileW(NULL) returned ret=%d error=%ld\n",ret,GetLastError()); - - ret = DeleteFileW(emptyW); - ok(!ret && GetLastError() == ERROR_PATH_NOT_FOUND, - "DeleteFileW(\"\") returned ret=%d error=%ld\n",ret,GetLastError()); -} - -#define IsDotDir(x) ((x[0] == '.') && ((x[1] == 0) || ((x[1] == '.') && (x[2] == 0)))) - -static void test_MoveFileA(void) -{ - char tempdir[MAX_PATH]; - char source[MAX_PATH], dest[MAX_PATH]; - static const char prefix[] = "pfx"; - DWORD ret; - - ret = GetTempPathA(MAX_PATH, tempdir); - ok(ret != 0, "GetTempPathA error %ld\n", GetLastError()); - ok(ret < MAX_PATH, "temp path should fit into MAX_PATH\n"); - - ret = GetTempFileNameA(tempdir, prefix, 0, source); - ok(ret != 0, "GetTempFileNameA error %ld\n", GetLastError()); - - ret = GetTempFileNameA(tempdir, prefix, 0, dest); - ok(ret != 0, "GetTempFileNameA error %ld\n", GetLastError()); - - ret = MoveFileA(source, dest); - ok(!ret && GetLastError() == ERROR_ALREADY_EXISTS, - "MoveFileA: unexpected error %ld\n", GetLastError()); - - ret = DeleteFileA(dest); - ok(ret, "DeleteFileA: error %ld\n", GetLastError()); - - ret = MoveFileA(source, dest); - ok(ret, "MoveFileA: failed, error %ld\n", GetLastError()); - - lstrcatA(tempdir, "Remove Me"); - ret = CreateDirectoryA(tempdir, NULL); - ok(ret == TRUE, "CreateDirectoryA failed\n"); - - lstrcpyA(source, dest); - lstrcpyA(dest, tempdir); - lstrcatA(dest, "\\wild?.*"); - /* FIXME: if we create a file with wildcards we can't delete it now that DeleteFile works correctly */ - ret = MoveFileA(source, dest); - ok(!ret, "MoveFileA: shouldn't move to wildcard file\n"); - ok(GetLastError() == ERROR_INVALID_NAME, - "MoveFileA: with wildcards, unexpected error %ld\n", GetLastError()); - if (ret || (GetLastError() != ERROR_INVALID_NAME)) - { - WIN32_FIND_DATAA fd; - char temppath[MAX_PATH]; - HANDLE hFind; - - lstrcpyA(temppath, tempdir); - lstrcatA(temppath, "\\*.*"); - hFind = FindFirstFileA(temppath, &fd); - if (INVALID_HANDLE_VALUE != hFind) - { - LPSTR lpName; - do - { - lpName = fd.cAlternateFileName; - if (!lpName[0]) - lpName = fd.cFileName; - ok(IsDotDir(lpName), "MoveFileA: wildcards file created!\n"); - } - while (FindNextFileA(hFind, &fd)); - FindClose(hFind); - } - } - ret = DeleteFileA(source); - ok(ret, "DeleteFileA: error %ld\n", GetLastError()); - ret = DeleteFileA(dest); - ok(!ret, "DeleteFileA: error %ld\n", GetLastError()); - ret = RemoveDirectoryA(tempdir); - ok(ret, "DeleteDirectoryA: error %ld\n", GetLastError()); -} - -static void test_MoveFileW(void) -{ - WCHAR temp_path[MAX_PATH]; - WCHAR source[MAX_PATH], dest[MAX_PATH]; - static const WCHAR prefix[] = {'p','f','x',0}; - DWORD ret; - - ret = GetTempPathW(MAX_PATH, temp_path); - if (ret==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) - return; - ok(ret != 0, "GetTempPathW error %ld\n", GetLastError()); - ok(ret < MAX_PATH, "temp path should fit into MAX_PATH\n"); - - ret = GetTempFileNameW(temp_path, prefix, 0, source); - ok(ret != 0, "GetTempFileNameW error %ld\n", GetLastError()); - - ret = GetTempFileNameW(temp_path, prefix, 0, dest); - ok(ret != 0, "GetTempFileNameW error %ld\n", GetLastError()); - - ret = MoveFileW(source, dest); - ok(!ret && GetLastError() == ERROR_ALREADY_EXISTS, - "CopyFileW: unexpected error %ld\n", GetLastError()); - - ret = DeleteFileW(source); - ok(ret, "DeleteFileW: error %ld\n", GetLastError()); - ret = DeleteFileW(dest); - ok(ret, "DeleteFileW: error %ld\n", GetLastError()); -} - -#define PATTERN_OFFSET 0x10 - -static void test_offset_in_overlapped_structure(void) -{ - HANDLE hFile; - OVERLAPPED ov; - DWORD done; - BOOL rc; - BYTE buf[256], pattern[] = "TeSt"; - UINT i; - char temp_path[MAX_PATH], temp_fname[MAX_PATH]; - - ok(GetTempPathA(MAX_PATH, temp_path) != 0, "GetTempPathA error %ld\n", GetLastError()); - ok(GetTempFileNameA(temp_path, "pfx", 0, temp_fname) != 0, "GetTempFileNameA error %ld\n", GetLastError()); - - /*** Write File *****************************************************/ - - hFile = CreateFileA(temp_fname, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); - ok(hFile != INVALID_HANDLE_VALUE, "CreateFileA error %ld\n", GetLastError()); - - for(i = 0; i < sizeof(buf); i++) buf[i] = i; - ok(WriteFile(hFile, buf, sizeof(buf), &done, NULL), "WriteFile error %ld\n", GetLastError()); - ok(done == sizeof(buf), "expected number of bytes written %lu\n", done); - - memset(&ov, 0, sizeof(ov)); - ov.Offset = PATTERN_OFFSET; - ov.OffsetHigh = 0; - rc=WriteFile(hFile, pattern, sizeof(pattern), &done, &ov); - /* Win 9x does not support the overlapped I/O on files */ - if (rc || GetLastError()!=ERROR_INVALID_PARAMETER) { - ok(rc, "WriteFile error %ld\n", GetLastError()); - ok(done == sizeof(pattern), "expected number of bytes written %lu\n", done); - /*trace("Current offset = %04lx\n", SetFilePointer(hFile, 0, NULL, FILE_CURRENT));*/ - ok(SetFilePointer(hFile, 0, NULL, FILE_CURRENT) == (PATTERN_OFFSET + sizeof(pattern)), - "expected file offset %d\n", PATTERN_OFFSET + sizeof(pattern)); - - ov.Offset = sizeof(buf) * 2; - ov.OffsetHigh = 0; - ok(WriteFile(hFile, pattern, sizeof(pattern), &done, &ov), "WriteFile error %ld\n", GetLastError()); - ok(done == sizeof(pattern), "expected number of bytes written %lu\n", done); - /*trace("Current offset = %04lx\n", SetFilePointer(hFile, 0, NULL, FILE_CURRENT));*/ - ok(SetFilePointer(hFile, 0, NULL, FILE_CURRENT) == (sizeof(buf) * 2 + sizeof(pattern)), - "expected file offset %d\n", sizeof(buf) * 2 + sizeof(pattern)); - } - - CloseHandle(hFile); - - /*** Read File *****************************************************/ - - hFile = CreateFileA(temp_fname, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0); - ok(hFile != INVALID_HANDLE_VALUE, "CreateFileA error %ld\n", GetLastError()); - - memset(buf, 0, sizeof(buf)); - memset(&ov, 0, sizeof(ov)); - ov.Offset = PATTERN_OFFSET; - ov.OffsetHigh = 0; - rc=ReadFile(hFile, buf, sizeof(pattern), &done, &ov); - /* Win 9x does not support the overlapped I/O on files */ - if (rc || GetLastError()!=ERROR_INVALID_PARAMETER) { - ok(rc, "ReadFile error %ld\n", GetLastError()); - ok(done == sizeof(pattern), "expected number of bytes read %lu\n", done); - /*trace("Current offset = %04lx\n", SetFilePointer(hFile, 0, NULL, FILE_CURRENT));*/ - ok(SetFilePointer(hFile, 0, NULL, FILE_CURRENT) == (PATTERN_OFFSET + sizeof(pattern)), - "expected file offset %d\n", PATTERN_OFFSET + sizeof(pattern)); - ok(!memcmp(buf, pattern, sizeof(pattern)), "pattern match failed\n"); - } - - CloseHandle(hFile); - - ok(DeleteFileA(temp_fname), "DeleteFileA error %ld\n", GetLastError()); -} - -static void test_LockFile(void) -{ - HANDLE handle; - DWORD written; - OVERLAPPED overlapped; - int limited_LockFile; - int limited_UnLockFile; - int lockfileex_capable; - - handle = CreateFileA( filename, GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, - CREATE_ALWAYS, 0, 0 ); - if (handle == INVALID_HANDLE_VALUE) - { - ok(0,"couldn't create file \"%s\" (err=%ld)\n",filename,GetLastError()); - return; - } - ok( WriteFile( handle, sillytext, strlen(sillytext), &written, NULL ), "write failed\n" ); - - ok( LockFile( handle, 0, 0, 0, 0 ), "LockFile failed\n" ); - ok( UnlockFile( handle, 0, 0, 0, 0 ), "UnlockFile failed\n" ); - - limited_UnLockFile = 0; - if (UnlockFile( handle, 0, 0, 0, 0 )) - { - limited_UnLockFile = 1; - } - - ok( LockFile( handle, 10, 0, 20, 0 ), "LockFile 10,20 failed\n" ); - /* overlapping locks must fail */ - ok( !LockFile( handle, 12, 0, 10, 0 ), "LockFile 12,10 succeeded\n" ); - ok( !LockFile( handle, 5, 0, 6, 0 ), "LockFile 5,6 succeeded\n" ); - /* non-overlapping locks must succeed */ - ok( LockFile( handle, 5, 0, 5, 0 ), "LockFile 5,5 failed\n" ); - - ok( !UnlockFile( handle, 10, 0, 10, 0 ), "UnlockFile 10,10 succeeded\n" ); - ok( UnlockFile( handle, 10, 0, 20, 0 ), "UnlockFile 10,20 failed\n" ); - ok( !UnlockFile( handle, 10, 0, 20, 0 ), "UnlockFile 10,20 again succeeded\n" ); - ok( UnlockFile( handle, 5, 0, 5, 0 ), "UnlockFile 5,5 failed\n" ); - - overlapped.Offset = 100; - overlapped.OffsetHigh = 0; - overlapped.hEvent = 0; - - lockfileex_capable = dll_capable("kernel32", "LockFileEx"); - if (lockfileex_capable) - { - /* Test for broken LockFileEx a la Windows 95 OSR2. */ - if (LockFileEx( handle, 0, 0, 100, 0, &overlapped )) - { - /* LockFileEx is probably OK, test it more. */ - ok( LockFileEx( handle, 0, 0, 100, 0, &overlapped ), - "LockFileEx 100,100 failed\n" ); - } - } - - /* overlapping shared locks are OK */ - overlapped.Offset = 150; - limited_UnLockFile || ok( LockFileEx( handle, 0, 0, 100, 0, &overlapped ), "LockFileEx 150,100 failed\n" ); - - /* but exclusive is not */ - if (lockfileex_capable) - { - ok( !LockFileEx( handle, LOCKFILE_EXCLUSIVE_LOCK|LOCKFILE_FAIL_IMMEDIATELY, - 0, 50, 0, &overlapped ), - "LockFileEx exclusive 150,50 succeeded\n" ); - if (dll_capable("kernel32.dll", "UnlockFileEx")) - { - if (!UnlockFileEx( handle, 0, 100, 0, &overlapped )) - { /* UnLockFile is capable. */ - overlapped.Offset = 100; - ok( !UnlockFileEx( handle, 0, 100, 0, &overlapped ), - "UnlockFileEx 150,100 again succeeded\n" ); - } - } - } - - ok( LockFile( handle, 0, 0x10000000, 0, 0xf0000000 ), "LockFile failed\n" ); - ok( !LockFile( handle, ~0, ~0, 1, 0 ), "LockFile ~0,1 succeeded\n" ); - ok( !LockFile( handle, 0, 0x20000000, 20, 0 ), "LockFile 0x20000000,20 succeeded\n" ); - ok( UnlockFile( handle, 0, 0x10000000, 0, 0xf0000000 ), "UnlockFile failed\n" ); - - /* wrap-around lock should not do anything */ - /* (but still succeeds on NT4 so we don't check result) */ - LockFile( handle, 0, 0x10000000, 0, 0xf0000001 ); - - limited_LockFile = 0; - if (!LockFile( handle, ~0, ~0, 1, 0 )) - { - limited_LockFile = 1; - } - - limited_UnLockFile || ok( UnlockFile( handle, ~0, ~0, 1, 0 ), "Unlockfile ~0,1 failed\n" ); - - /* zero-byte lock */ - ok( LockFile( handle, 100, 0, 0, 0 ), "LockFile 100,0 failed\n" ); - limited_LockFile || ok( !LockFile( handle, 98, 0, 4, 0 ), "LockFile 98,4 succeeded\n" ); - ok( LockFile( handle, 90, 0, 10, 0 ), "LockFile 90,10 failed\n" ); - limited_LockFile || ok( !LockFile( handle, 100, 0, 10, 0 ), "LockFile 100,10 failed\n" ); - - ok( UnlockFile( handle, 90, 0, 10, 0 ), "UnlockFile 90,10 failed\n" ); - !ok( UnlockFile( handle, 100, 0, 10, 0 ), "UnlockFile 100,10 failed\n" ); - - ok( UnlockFile( handle, 100, 0, 0, 0 ), "UnlockFile 100,0 failed\n" ); - - CloseHandle( handle ); - DeleteFileA( filename ); -} - -static inline int is_sharing_compatible( DWORD access1, DWORD sharing1, DWORD access2, DWORD sharing2 ) -{ - if (!access1 || !access2) return 1; - if ((access1 & GENERIC_READ) && !(sharing2 & FILE_SHARE_READ)) return 0; - if ((access1 & GENERIC_WRITE) && !(sharing2 & FILE_SHARE_WRITE)) return 0; - if ((access2 & GENERIC_READ) && !(sharing1 & FILE_SHARE_READ)) return 0; - if ((access2 & GENERIC_WRITE) && !(sharing1 & FILE_SHARE_WRITE)) return 0; - return 1; -} - -static void test_file_sharing(void) -{ - static const DWORD access_modes[4] = { 0, GENERIC_READ, GENERIC_WRITE, GENERIC_READ|GENERIC_WRITE }; - static const DWORD sharing_modes[4] = { 0, FILE_SHARE_READ, FILE_SHARE_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE }; - int a1, s1, a2, s2; - int ret; - - /* make sure the file exists */ - HANDLE h = CreateFileA( filename, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0 ); - CloseHandle( h ); - - for (a1 = 0; a1 < 4; a1++) - { - for (s1 = 0; s1 < 4; s1++) - { - HANDLE h = CreateFileA( filename, access_modes[a1], sharing_modes[s1], - NULL, OPEN_EXISTING, 0, 0 ); - if (h == INVALID_HANDLE_VALUE) - { - ok(0,"couldn't create file \"%s\" (err=%ld)\n",filename,GetLastError()); - return; - } - for (a2 = 0; a2 < 4; a2++) - { - for (s2 = 0; s2 < 4; s2++) - { - HANDLE h2 = CreateFileA( filename, access_modes[a2], sharing_modes[s2], - NULL, OPEN_EXISTING, 0, 0 ); - if (is_sharing_compatible( access_modes[a1], sharing_modes[s1], - access_modes[a2], sharing_modes[s2] )) - { - ret = GetLastError(); - ok( ERROR_SHARING_VIOLATION == ret || 0 == ret, - "Windows 95 sets GetLastError() = ERROR_SHARING_VIOLATION and\n" - " Windows XP GetLastError() = 0, but now it is %d.\n" - " indexes = %d, %d, %d, %d\n" - " modes =\n %lx/%lx/%lx/%lx\n", - ret, - a1, s1, a2, s2, - access_modes[a1], sharing_modes[s1], - access_modes[a2], sharing_modes[s2] - ); - } - else - { - ok( h2 == INVALID_HANDLE_VALUE, - "open succeeded for modes %lx/%lx/%lx/%lx\n", - access_modes[a1], sharing_modes[s1], - access_modes[a2], sharing_modes[s2] ); - if (h2 == INVALID_HANDLE_VALUE) - ok( GetLastError() == ERROR_SHARING_VIOLATION, - "wrong error code %ld\n", GetLastError() ); - } - if (h2 != INVALID_HANDLE_VALUE) CloseHandle( h2 ); - } - } - CloseHandle( h ); - } - } - DeleteFileA( filename ); -} - -static void test_FindFirstFileA() -{ - HANDLE handle; - WIN32_FIND_DATAA search_results; - int err; - - handle = FindFirstFileA("C:\\",&search_results); - err = GetLastError(); - ok ( handle == INVALID_HANDLE_VALUE , "FindFirstFile on Root directory should Fail\n"); - if (handle == INVALID_HANDLE_VALUE) - ok ( err == ERROR_FILE_NOT_FOUND, "Bad Error number %d\n", err); - handle = FindFirstFileA("C:\\*",&search_results); - ok ( handle != INVALID_HANDLE_VALUE, "FindFirstFile on C:\\* should succeed\n" ); - ok ( FindClose(handle) == TRUE, "Failed to close handle\n"); -} - -static void test_FindNextFileA() -{ - HANDLE handle; - WIN32_FIND_DATAA search_results; - int err; - - handle = FindFirstFileA("C:\\*",&search_results); - ok ( handle != INVALID_HANDLE_VALUE, "FindFirstFile on C:\\* should succeed\n" ); - while (FindNextFile(handle, &search_results)) - { - /* get to the end of the files */ - } - ok ( FindClose(handle) == TRUE, "Failed to close handle\n"); - err = GetLastError(); - ok ( err == ERROR_NO_MORE_FILES, "GetLastError should return ERROR_NO_MORE_FILES\n"); -} - -static int test_Mapfile_createtemp(HANDLE *handle) -{ - SetFileAttributesA(filename,FILE_ATTRIBUTE_NORMAL); - DeleteFile(filename); - *handle = CreateFile(filename, GENERIC_READ|GENERIC_WRITE, 0, 0, - CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - if (*handle != INVALID_HANDLE_VALUE) { - - return 1; - } - - return 0; -} - -static void test_MapFile() -{ - HANDLE handle; - HANDLE hmap; - - ok(test_Mapfile_createtemp(&handle), "Couldn't create test file.\n"); - - hmap = CreateFileMapping( handle, NULL, PAGE_READWRITE, 0, 0x1000, "named_file_map" ); - ok( hmap != NULL, "mapping should work, I named it!\n" ); - - ok( CloseHandle( hmap ), "can't close mapping handle\n"); - - /* We have to close file before we try new stuff with mapping again. - Else we would always succeed on XP or block descriptors on 95. */ - hmap = CreateFileMapping( handle, NULL, PAGE_READWRITE, 0, 0, NULL ); - ok( hmap != NULL, "We should still be able to map!\n" ); - ok( CloseHandle( hmap ), "can't close mapping handle\n"); - ok( CloseHandle( handle ), "can't close file handle\n"); - handle = NULL; - - ok(test_Mapfile_createtemp(&handle), "Couldn't create test file.\n"); - - hmap = CreateFileMapping( handle, NULL, PAGE_READWRITE, 0, 0, NULL ); - ok( hmap == NULL, "Mapping should not work, no name provided.\n" ); - - ok( hmap == NULL, "mapped zero size file\n"); - ok( GetLastError() == ERROR_FILE_INVALID, "not ERROR_FILE_INVALID\n"); - - hmap = CreateFileMapping( handle, NULL, PAGE_READWRITE, 0x1000, 0, NULL ); - ok( hmap == NULL, "mapping should fail\n"); - /* GetLastError() varies between win9x and WinNT and also depends on the filesystem */ - - hmap = CreateFileMapping( handle, NULL, PAGE_READWRITE, 0x1000, 0x10000, NULL ); - ok( hmap == NULL, "mapping should fail\n"); - /* GetLastError() varies between win9x and WinNT and also depends on the filesystem */ - - /* On XP you can now map again, on Win 95 you can not. */ - - ok( CloseHandle( handle ), "can't close file handle\n"); - ok( DeleteFileA( filename ), "DeleteFile failed after map\n" ); -} - -static void test_GetFileType(void) -{ - DWORD type; - HANDLE h = CreateFileA( filename, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0 ); - ok( h != INVALID_HANDLE_VALUE, "open %s failed\n", filename ); - type = GetFileType(h); - ok( type == FILE_TYPE_DISK, "expected type disk got %ld\n", type ); - CloseHandle( h ); - h = CreateFileA( "nul", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0 ); - ok( h != INVALID_HANDLE_VALUE, "open nul failed\n" ); - type = GetFileType(h); - ok( type == FILE_TYPE_CHAR, "expected type char for nul got %ld\n", type ); - CloseHandle( h ); - DeleteFileA( filename ); -} - -START_TEST(file) -{ - test__hread( ); - test__hwrite( ); - test__lclose( ); - test__lcreat( ); - test__llseek( ); - test__llopen( ); - test__lread( ); - test__lwrite( ); - test_GetTempFileNameA(); - test_CopyFileA(); - test_CopyFileW(); - test_CreateFileA(); - test_CreateFileW(); - test_DeleteFileA(); - test_DeleteFileW(); - test_MoveFileA(); - test_MoveFileW(); - test_FindFirstFileA(); - test_FindNextFileA(); - test_LockFile(); - test_file_sharing(); - test_offset_in_overlapped_structure(); - test_MapFile(); - test_GetFileType(); -} diff --git a/reactos/apps/tests/kernel32/format_msg.c b/reactos/apps/tests/kernel32/format_msg.c deleted file mode 100644 index e6f317c7db2..00000000000 --- a/reactos/apps/tests/kernel32/format_msg.c +++ /dev/null @@ -1,226 +0,0 @@ -/* Unit test suite for FormatMessageA - * - * Copyright 2002 Mike McCormack for CodeWeavers - * - * 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" - -/* #define ok(cond,failstr) if(!(cond)) {printf("line %d : %s\n",__LINE__,failstr);exit(1);} */ - -DWORD doit(DWORD flags, LPCVOID src, DWORD msg_id, DWORD lang_id, - LPSTR out, DWORD outsize, ... ) -{ - va_list list; - DWORD r; - - va_start(list, outsize); - r = FormatMessageA(flags, src, msg_id, - lang_id, out, outsize, &list); - va_end(list); - return r; -} - -void test_message_from_string(void) -{ - CHAR out[0x100] = {0}; - DWORD r; - static const WCHAR szwTest[] = { 't','e','s','t',0}; - - /* the basics */ - r = FormatMessageA(FORMAT_MESSAGE_FROM_STRING, "test", 0, - 0, out, sizeof(out)/sizeof(CHAR),NULL); - ok(!strcmp("test", out),"failed out=[%s]\n",out); - ok(r==4,"failed: r=%ld\n",r); - - /* using the format feature */ - r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!s!", 0, - 0, out, sizeof(out)/sizeof(CHAR), "test"); - ok(!strcmp("test", out),"failed out=[%s]\n",out); - ok(r==4,"failed: r=%ld\n",r); - - /* no format */ - r = doit(FORMAT_MESSAGE_FROM_STRING, "%1", 0, - 0, out, sizeof(out)/sizeof(CHAR), "test"); - ok(!strcmp("test", out),"failed out=[%s]\n",out); - ok(r==4,"failed: r=%ld\n",r); - - /* two pieces */ - r = doit(FORMAT_MESSAGE_FROM_STRING, "%1%2", 0, - 0, out, sizeof(out)/sizeof(CHAR), "te","st"); - ok(!strcmp("test", out),"failed out=[%s]\n",out); - ok(r==4,"failed: r=%ld\n",r); - - /* three pieces */ - r = doit(FORMAT_MESSAGE_FROM_STRING, "%1%3%2%1", 0, - 0, out, sizeof(out)/sizeof(CHAR), "t","s","e"); - ok(!strcmp("test", out),"failed out=[%s]\n",out); - ok(r==4,"failed: r=%ld\n",r); - - /* s doesn't seem to work in format strings */ - r = doit(FORMAT_MESSAGE_FROM_STRING, "%!s!", 0, - 0, out, sizeof(out)/sizeof(CHAR), "test"); - ok(!strcmp("!s!", out),"failed out=[%s]\n",out); - ok(r==3,"failed: r=%ld\n",r); - - /* S is unicode */ - r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!S!", 0, - 0, out, sizeof(out)/sizeof(CHAR), szwTest); - ok(!strcmp("test", out),"failed out=[%s]\n",out); - ok(r==4,"failed: r=%ld\n",r); - - /* as characters */ - r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!c!%2!c!%3!c!%1!c!", 0, - 0, out, sizeof(out)/sizeof(CHAR), 't','e','s'); - ok(!strcmp("test", out),"failed out=[%s]\n",out); - ok(r==4,"failed: r=%ld\n",r); - - /* some numbers */ - r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!d!%2!d!%3!d!", 0, - 0, out, sizeof(out)/sizeof(CHAR), 1,2,3); - ok(!strcmp("123", out),"failed out=[%s]\n",out); - ok(r==3,"failed: r=%ld\n",r); - - /* a single digit with some spacing */ - r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4d!", 0, - 0, out, sizeof(out)/sizeof(CHAR), 1); - ok(!strcmp(" 1", out),"failed out=[%s]\n",out); - ok(r==4,"failed: r=%ld\n",r); - - /* a single digit, left justified */ - r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!-4d!", 0, - 0, out, sizeof(out)/sizeof(CHAR), 1); - ok(!strcmp("1 ", out),"failed out=[%s]\n",out); - ok(r==4,"failed: r=%ld\n",r); - - /* two digit decimal number */ - r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4d!", 0, - 0, out, sizeof(out)/sizeof(CHAR), 11); - ok(!strcmp(" 11", out),"failed out=[%s]\n",out); - ok(r==4,"failed: r=%ld\n",r); - - /* a hex number */ - r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4x!", 0, - 0, out, sizeof(out)/sizeof(CHAR), 11); - ok(!strcmp(" b", out),"failed out=[%s]\n",out); - ok(r==4,"failed: r=%ld\n",r); - - /* a hex number, upper case */ - r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4X!", 0, - 0, out, sizeof(out)/sizeof(CHAR), 11); - ok(!strcmp(" B", out),"failed out=[%s]\n",out); - ok(r==4,"failed: r=%ld\n",r); - - /* a hex number, upper case, left justified */ - r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!-4X!", 0, - 0, out, sizeof(out)/sizeof(CHAR), 11); - ok(!strcmp("B ", out),"failed out=[%s]\n",out); - ok(r==4,"failed: r=%ld\n",r); - - /* a long hex number, upper case */ - r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4X!", 0, - 0, out, sizeof(out)/sizeof(CHAR), 0x1ab); - ok(!strcmp(" 1AB", out),"failed out=[%s]\n",out); - ok(r==4,"failed: r=%ld\n",r); - - /* two percent... */ - r = doit(FORMAT_MESSAGE_FROM_STRING, " %%%% ", 0, - 0, out, sizeof(out)/sizeof(CHAR)); - ok(!strcmp(" %% ", out),"failed out=[%s]\n",out); - ok(r==4,"failed: r=%ld\n",r); - - /* periods are special cases */ - r = doit(FORMAT_MESSAGE_FROM_STRING, " %.%. %1!d!", 0, - 0, out, sizeof(out)/sizeof(CHAR), 0x1ab); - ok(!strcmp(" .. 427", out),"failed out=[%s]\n",out); - ok(r==7,"failed: r=%ld\n",r); - - /* %0 ends the line */ - r = doit(FORMAT_MESSAGE_FROM_STRING, "test%0test", 0, - 0, out, sizeof(out)/sizeof(CHAR)); - ok(!strcmp("test", out),"failed out=[%s]\n",out); - ok(r==4,"failed: r=%ld\n",r); - - /* %! prints an exclaimation */ - r = doit(FORMAT_MESSAGE_FROM_STRING, "yah%!%0 ", 0, - 0, out, sizeof(out)/sizeof(CHAR)); - ok(!strcmp("yah!", out),"failed out=[%s]\n",out); - ok(r==4,"failed: r=%ld\n",r); - - /* %space */ - r = doit(FORMAT_MESSAGE_FROM_STRING, "% % ", 0, - 0, out, sizeof(out)/sizeof(CHAR)); - ok(!strcmp(" ", out),"failed out=[%s]\n",out); - ok(r==4,"failed: r=%ld\n",r); - - /* line feed */ - r = doit(FORMAT_MESSAGE_FROM_STRING, "hi\n", 0, - 0, out, sizeof(out)/sizeof(CHAR)); - ok(!strcmp("hi\r\n", out),"failed out=[%s]\n",out); - ok(r==4,"failed: r=%ld\n",r); - - /* carriage return line feed */ - r = doit(FORMAT_MESSAGE_FROM_STRING, "hi\r\n", 0, - 0, out, sizeof(out)/sizeof(CHAR)); - ok(!strcmp("hi\r\n", out),"failed out=[%s]\n",out); - ok(r==4,"failed: r=%ld\n",r); - - /* carriage return line feed */ - r = doit(FORMAT_MESSAGE_FROM_STRING, "\r", 0, - 0, out, sizeof(out)/sizeof(CHAR)); - ok(!strcmp("\r\n", out),"failed out=[%s]\n",out); - ok(r==2,"failed: r=%ld\n",r); - - /* carriage return line feed */ - r = doit(FORMAT_MESSAGE_FROM_STRING, "\r\r\n", 0, - 0, out, sizeof(out)/sizeof(CHAR)); - ok(!strcmp("\r\n\r\n", out),"failed out=[%s]\n",out); - ok(r==4,"failed: r=%ld\n",r); - - /* change of pace... test the low byte of dwflags */ - /* line feed */ - r = doit(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, "hi\n", 0, - 0, out, sizeof(out)/sizeof(CHAR)); - ok(!strcmp("hi ", out) || !strcmp("hi\r\n", out),"failed out=[%s]\n",out); - ok(r==3 || r==4,"failed: r=%ld\n",r); - - /* carriage return line feed */ - r = doit(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, "hi\r\n", 0, - 0, out, sizeof(out)/sizeof(CHAR)); - ok(!strcmp("hi ", out),"failed out=[%s]\n",out); - ok(r==3,"failed: r=%ld\n",r); - - /* carriage return line feed */ - r = doit(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, "\r", 0, - 0, out, sizeof(out)/sizeof(CHAR)); - ok(!strcmp(" ", out),"failed out=[%s]\n",out); - ok(r==1,"failed: r=%ld\n",r); - - /* carriage return line feed */ - r = doit(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, "\r\r\n", 0, - 0, out, sizeof(out)/sizeof(CHAR)); - ok(!strcmp(" ", out),"failed out=[%s]\n",out); - ok(r==2,"failed: r=%ld\n",r); -} - -START_TEST(format_msg) -{ - test_message_from_string(); -} diff --git a/reactos/apps/tests/kernel32/generated.c b/reactos/apps/tests/kernel32/generated.c deleted file mode 100644 index d1ceedf21ba..00000000000 --- a/reactos/apps/tests/kernel32/generated.c +++ /dev/null @@ -1,1187 +0,0 @@ -/* File generated automatically from tools/winapi/test.dat; do not edit! */ -/* This file can be copied, modified and distributed without restriction. */ - -/* - * Unit tests for data structure packing - */ - -#define WINVER 0x0501 -#define _WIN32_IE 0x0501 -#define _WIN32_WINNT 0x0501 - -#define WINE_NOWINSOCK - -#include "windows.h" - -#include "wine/test.h" - -/*********************************************************************** - * Compability macros - */ - -#define DWORD_PTR UINT_PTR -#define LONG_PTR INT_PTR -#define ULONG_PTR UINT_PTR - -/*********************************************************************** - * Windows API extension - */ - -#if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus) -# define FIELD_ALIGNMENT(type, field) __alignof(((type*)0)->field) -#elif defined(__GNUC__) -# define FIELD_ALIGNMENT(type, field) __alignof__(((type*)0)->field) -#else -/* FIXME: Not sure if is possible to do without compiler extension */ -#endif - -#if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus) -# define _TYPE_ALIGNMENT(type) __alignof(type) -#elif defined(__GNUC__) -# define _TYPE_ALIGNMENT(type) __alignof__(type) -#else -/* - * FIXME: Not sure if is possible to do without compiler extension - * (if type is not just a name that is, if so the normal) - * TYPE_ALIGNMENT can be used) - */ -#endif - -#if !defined(TYPE_ALIGNMENT) && defined(_TYPE_ALIGNMENT) -# define TYPE_ALIGNMENT _TYPE_ALIGNMENT -#endif - -/*********************************************************************** - * Test helper macros - */ - -#ifdef FIELD_ALIGNMENT -# define TEST_FIELD_ALIGNMENT(type, field, align) \ - ok(FIELD_ALIGNMENT(type, field) == align, \ - "FIELD_ALIGNMENT(" #type ", " #field ") == %d (expected " #align ")\n", \ - FIELD_ALIGNMENT(type, field)) -#else -# define TEST_FIELD_ALIGNMENT(type, field, align) do { } while (0) -#endif - -#define TEST_FIELD_OFFSET(type, field, offset) \ - ok(FIELD_OFFSET(type, field) == offset, \ - "FIELD_OFFSET(" #type ", " #field ") == %ld (expected " #offset ")\n", \ - FIELD_OFFSET(type, field)) - -#ifdef _TYPE_ALIGNMENT -#define TEST__TYPE_ALIGNMENT(type, align) \ - ok(_TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")\n", _TYPE_ALIGNMENT(type)) -#else -# define TEST__TYPE_ALIGNMENT(type, align) do { } while (0) -#endif - -#ifdef TYPE_ALIGNMENT -#define TEST_TYPE_ALIGNMENT(type, align) \ - ok(TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")\n", TYPE_ALIGNMENT(type)) -#else -# define TEST_TYPE_ALIGNMENT(type, align) do { } while (0) -#endif - -#define TEST_TYPE_SIZE(type, size) \ - ok(sizeof(type) == size, "sizeof(" #type ") == %d (expected " #size ")\n", sizeof(type)) - -/*********************************************************************** - * Test macros - */ - -#define TEST_FIELD(type, field_type, field_name, field_offset, field_size, field_align) \ - TEST_TYPE_SIZE(field_type, field_size); \ - TEST_FIELD_ALIGNMENT(type, field_name, field_align); \ - TEST_FIELD_OFFSET(type, field_name, field_offset); \ - -#define TEST_TYPE(type, size, align) \ - TEST_TYPE_ALIGNMENT(type, align); \ - TEST_TYPE_SIZE(type, size) - -#define TEST_TYPE_POINTER(type, size, align) \ - TEST__TYPE_ALIGNMENT(*(type)0, align); \ - TEST_TYPE_SIZE(*(type)0, size) - -#define TEST_TYPE_SIGNED(type) \ - ok((type) -1 < 0, "(" #type ") -1 < 0\n"); - -#define TEST_TYPE_UNSIGNED(type) \ - ok((type) -1 > 0, "(" #type ") -1 > 0\n"); - -static void test_pack_LPOSVERSIONINFOA(void) -{ - /* LPOSVERSIONINFOA */ - TEST_TYPE(LPOSVERSIONINFOA, 4, 4); - TEST_TYPE_POINTER(LPOSVERSIONINFOA, 148, 4); -} - -static void test_pack_LPOSVERSIONINFOEXA(void) -{ - /* LPOSVERSIONINFOEXA */ - TEST_TYPE(LPOSVERSIONINFOEXA, 4, 4); - TEST_TYPE_POINTER(LPOSVERSIONINFOEXA, 156, 4); -} - -static void test_pack_LPOSVERSIONINFOEXW(void) -{ - /* LPOSVERSIONINFOEXW */ - TEST_TYPE(LPOSVERSIONINFOEXW, 4, 4); - TEST_TYPE_POINTER(LPOSVERSIONINFOEXW, 284, 4); -} - -static void test_pack_LPOSVERSIONINFOW(void) -{ - /* LPOSVERSIONINFOW */ - TEST_TYPE(LPOSVERSIONINFOW, 4, 4); - TEST_TYPE_POINTER(LPOSVERSIONINFOW, 276, 4); -} - -static void test_pack_OSVERSIONINFOA(void) -{ - /* OSVERSIONINFOA (pack 4) */ - TEST_TYPE(OSVERSIONINFOA, 148, 4); - TEST_FIELD(OSVERSIONINFOA, DWORD, dwOSVersionInfoSize, 0, 4, 4); - TEST_FIELD(OSVERSIONINFOA, DWORD, dwMajorVersion, 4, 4, 4); - TEST_FIELD(OSVERSIONINFOA, DWORD, dwMinorVersion, 8, 4, 4); - TEST_FIELD(OSVERSIONINFOA, DWORD, dwBuildNumber, 12, 4, 4); - TEST_FIELD(OSVERSIONINFOA, DWORD, dwPlatformId, 16, 4, 4); - TEST_FIELD(OSVERSIONINFOA, CHAR[128], szCSDVersion, 20, 128, 1); -} - -static void test_pack_OSVERSIONINFOEXA(void) -{ - /* OSVERSIONINFOEXA (pack 4) */ - TEST_TYPE(OSVERSIONINFOEXA, 156, 4); - TEST_FIELD(OSVERSIONINFOEXA, DWORD, dwOSVersionInfoSize, 0, 4, 4); - TEST_FIELD(OSVERSIONINFOEXA, DWORD, dwMajorVersion, 4, 4, 4); - TEST_FIELD(OSVERSIONINFOEXA, DWORD, dwMinorVersion, 8, 4, 4); - TEST_FIELD(OSVERSIONINFOEXA, DWORD, dwBuildNumber, 12, 4, 4); - TEST_FIELD(OSVERSIONINFOEXA, DWORD, dwPlatformId, 16, 4, 4); - TEST_FIELD(OSVERSIONINFOEXA, CHAR[128], szCSDVersion, 20, 128, 1); - TEST_FIELD(OSVERSIONINFOEXA, WORD, wServicePackMajor, 148, 2, 2); - TEST_FIELD(OSVERSIONINFOEXA, WORD, wServicePackMinor, 150, 2, 2); - TEST_FIELD(OSVERSIONINFOEXA, WORD, wSuiteMask, 152, 2, 2); - TEST_FIELD(OSVERSIONINFOEXA, BYTE, wProductType, 154, 1, 1); - TEST_FIELD(OSVERSIONINFOEXA, BYTE, wReserved, 155, 1, 1); -} - -static void test_pack_OSVERSIONINFOEXW(void) -{ - /* OSVERSIONINFOEXW (pack 4) */ - TEST_TYPE(OSVERSIONINFOEXW, 284, 4); - TEST_FIELD(OSVERSIONINFOEXW, DWORD, dwOSVersionInfoSize, 0, 4, 4); - TEST_FIELD(OSVERSIONINFOEXW, DWORD, dwMajorVersion, 4, 4, 4); - TEST_FIELD(OSVERSIONINFOEXW, DWORD, dwMinorVersion, 8, 4, 4); - TEST_FIELD(OSVERSIONINFOEXW, DWORD, dwBuildNumber, 12, 4, 4); - TEST_FIELD(OSVERSIONINFOEXW, DWORD, dwPlatformId, 16, 4, 4); - TEST_FIELD(OSVERSIONINFOEXW, WCHAR[128], szCSDVersion, 20, 256, 2); - TEST_FIELD(OSVERSIONINFOEXW, WORD, wServicePackMajor, 276, 2, 2); - TEST_FIELD(OSVERSIONINFOEXW, WORD, wServicePackMinor, 278, 2, 2); - TEST_FIELD(OSVERSIONINFOEXW, WORD, wSuiteMask, 280, 2, 2); - TEST_FIELD(OSVERSIONINFOEXW, BYTE, wProductType, 282, 1, 1); - TEST_FIELD(OSVERSIONINFOEXW, BYTE, wReserved, 283, 1, 1); -} - -static void test_pack_OSVERSIONINFOW(void) -{ - /* OSVERSIONINFOW (pack 4) */ - TEST_TYPE(OSVERSIONINFOW, 276, 4); - TEST_FIELD(OSVERSIONINFOW, DWORD, dwOSVersionInfoSize, 0, 4, 4); - TEST_FIELD(OSVERSIONINFOW, DWORD, dwMajorVersion, 4, 4, 4); - TEST_FIELD(OSVERSIONINFOW, DWORD, dwMinorVersion, 8, 4, 4); - TEST_FIELD(OSVERSIONINFOW, DWORD, dwBuildNumber, 12, 4, 4); - TEST_FIELD(OSVERSIONINFOW, DWORD, dwPlatformId, 16, 4, 4); - TEST_FIELD(OSVERSIONINFOW, WCHAR[128], szCSDVersion, 20, 256, 2); -} - -static void test_pack_POSVERSIONINFOA(void) -{ - /* POSVERSIONINFOA */ - TEST_TYPE(POSVERSIONINFOA, 4, 4); - TEST_TYPE_POINTER(POSVERSIONINFOA, 148, 4); -} - -static void test_pack_POSVERSIONINFOEXA(void) -{ - /* POSVERSIONINFOEXA */ - TEST_TYPE(POSVERSIONINFOEXA, 4, 4); - TEST_TYPE_POINTER(POSVERSIONINFOEXA, 156, 4); -} - -static void test_pack_POSVERSIONINFOEXW(void) -{ - /* POSVERSIONINFOEXW */ - TEST_TYPE(POSVERSIONINFOEXW, 4, 4); - TEST_TYPE_POINTER(POSVERSIONINFOEXW, 284, 4); -} - -static void test_pack_POSVERSIONINFOW(void) -{ - /* POSVERSIONINFOW */ - TEST_TYPE(POSVERSIONINFOW, 4, 4); - TEST_TYPE_POINTER(POSVERSIONINFOW, 276, 4); -} - -static void test_pack_LPLONG(void) -{ - /* LPLONG */ - TEST_TYPE(LPLONG, 4, 4); -} - -static void test_pack_LPVOID(void) -{ - /* LPVOID */ - TEST_TYPE(LPVOID, 4, 4); -} - -static void test_pack_PHKEY(void) -{ - /* PHKEY */ - TEST_TYPE(PHKEY, 4, 4); -} - -static void test_pack_ACTCTXA(void) -{ - /* ACTCTXA (pack 4) */ - TEST_TYPE(ACTCTXA, 32, 4); - TEST_FIELD(ACTCTXA, ULONG, cbSize, 0, 4, 4); - TEST_FIELD(ACTCTXA, DWORD, dwFlags, 4, 4, 4); - TEST_FIELD(ACTCTXA, LPCSTR, lpSource, 8, 4, 4); - TEST_FIELD(ACTCTXA, USHORT, wProcessorArchitecture, 12, 2, 2); - TEST_FIELD(ACTCTXA, LANGID, wLangId, 14, 2, 2); - TEST_FIELD(ACTCTXA, LPCSTR, lpAssemblyDirectory, 16, 4, 4); - TEST_FIELD(ACTCTXA, LPCSTR, lpResourceName, 20, 4, 4); - TEST_FIELD(ACTCTXA, LPCSTR, lpApplicationName, 24, 4, 4); - TEST_FIELD(ACTCTXA, HMODULE, hModule, 28, 4, 4); -} - -static void test_pack_ACTCTXW(void) -{ - /* ACTCTXW (pack 4) */ - TEST_TYPE(ACTCTXW, 32, 4); - TEST_FIELD(ACTCTXW, ULONG, cbSize, 0, 4, 4); - TEST_FIELD(ACTCTXW, DWORD, dwFlags, 4, 4, 4); - TEST_FIELD(ACTCTXW, LPCWSTR, lpSource, 8, 4, 4); - TEST_FIELD(ACTCTXW, USHORT, wProcessorArchitecture, 12, 2, 2); - TEST_FIELD(ACTCTXW, LANGID, wLangId, 14, 2, 2); - TEST_FIELD(ACTCTXW, LPCWSTR, lpAssemblyDirectory, 16, 4, 4); - TEST_FIELD(ACTCTXW, LPCWSTR, lpResourceName, 20, 4, 4); - TEST_FIELD(ACTCTXW, LPCWSTR, lpApplicationName, 24, 4, 4); - TEST_FIELD(ACTCTXW, HMODULE, hModule, 28, 4, 4); -} - -static void test_pack_ACTCTX_SECTION_KEYED_DATA(void) -{ - /* ACTCTX_SECTION_KEYED_DATA (pack 4) */ - TEST_TYPE(ACTCTX_SECTION_KEYED_DATA, 64, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA, ULONG, cbSize, 0, 4, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA, ULONG, ulDataFormatVersion, 4, 4, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA, PVOID, lpData, 8, 4, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA, ULONG, ulLength, 12, 4, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA, PVOID, lpSectionGlobalData, 16, 4, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA, ULONG, ulSectionGlobalDataLength, 20, 4, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA, PVOID, lpSectionBase, 24, 4, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA, ULONG, ulSectionTotalLength, 28, 4, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA, HANDLE, hActCtx, 32, 4, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA, ULONG, ulAssemblyRosterIndex, 36, 4, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA, ULONG, ulFlags, 40, 4, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA, ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA, AssemblyMetadata, 44, 20, 4); -} - -static void test_pack_ACTCTX_SECTION_KEYED_DATA_2600(void) -{ - /* ACTCTX_SECTION_KEYED_DATA_2600 (pack 4) */ - TEST_TYPE(ACTCTX_SECTION_KEYED_DATA_2600, 40, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA_2600, ULONG, cbSize, 0, 4, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA_2600, ULONG, ulDataFormatVersion, 4, 4, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA_2600, PVOID, lpData, 8, 4, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA_2600, ULONG, ulLength, 12, 4, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA_2600, PVOID, lpSectionGlobalData, 16, 4, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA_2600, ULONG, ulSectionGlobalDataLength, 20, 4, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA_2600, PVOID, lpSectionBase, 24, 4, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA_2600, ULONG, ulSectionTotalLength, 28, 4, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA_2600, HANDLE, hActCtx, 32, 4, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA_2600, ULONG, ulAssemblyRosterIndex, 36, 4, 4); -} - -static void test_pack_ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA(void) -{ - /* ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA (pack 4) */ - TEST_TYPE(ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA, 20, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA, PVOID, lpInformation, 0, 4, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA, PVOID, lpSectionBase, 4, 4, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA, ULONG, ulSectionLength, 8, 4, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA, PVOID, lpSectionGlobalDataBase, 12, 4, 4); - TEST_FIELD(ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA, ULONG, ulSectionGlobalDataLength, 16, 4, 4); -} - -static void test_pack_ACTIVATION_CONTEXT_BASIC_INFORMATION(void) -{ - /* ACTIVATION_CONTEXT_BASIC_INFORMATION (pack 4) */ - TEST_TYPE(ACTIVATION_CONTEXT_BASIC_INFORMATION, 8, 4); - TEST_FIELD(ACTIVATION_CONTEXT_BASIC_INFORMATION, HANDLE, hActCtx, 0, 4, 4); - TEST_FIELD(ACTIVATION_CONTEXT_BASIC_INFORMATION, DWORD, dwFlags, 4, 4, 4); -} - -static void test_pack_BY_HANDLE_FILE_INFORMATION(void) -{ - /* BY_HANDLE_FILE_INFORMATION (pack 4) */ - TEST_TYPE(BY_HANDLE_FILE_INFORMATION, 52, 4); - TEST_FIELD(BY_HANDLE_FILE_INFORMATION, DWORD, dwFileAttributes, 0, 4, 4); - TEST_FIELD(BY_HANDLE_FILE_INFORMATION, FILETIME, ftCreationTime, 4, 8, 4); - TEST_FIELD(BY_HANDLE_FILE_INFORMATION, FILETIME, ftLastAccessTime, 12, 8, 4); - TEST_FIELD(BY_HANDLE_FILE_INFORMATION, FILETIME, ftLastWriteTime, 20, 8, 4); - TEST_FIELD(BY_HANDLE_FILE_INFORMATION, DWORD, dwVolumeSerialNumber, 28, 4, 4); - TEST_FIELD(BY_HANDLE_FILE_INFORMATION, DWORD, nFileSizeHigh, 32, 4, 4); - TEST_FIELD(BY_HANDLE_FILE_INFORMATION, DWORD, nFileSizeLow, 36, 4, 4); - TEST_FIELD(BY_HANDLE_FILE_INFORMATION, DWORD, nNumberOfLinks, 40, 4, 4); - TEST_FIELD(BY_HANDLE_FILE_INFORMATION, DWORD, nFileIndexHigh, 44, 4, 4); - TEST_FIELD(BY_HANDLE_FILE_INFORMATION, DWORD, nFileIndexLow, 48, 4, 4); -} - -static void test_pack_COMMPROP(void) -{ - /* COMMPROP (pack 4) */ - TEST_TYPE(COMMPROP, 64, 4); - TEST_FIELD(COMMPROP, WORD, wPacketLength, 0, 2, 2); - TEST_FIELD(COMMPROP, WORD, wPacketVersion, 2, 2, 2); - TEST_FIELD(COMMPROP, DWORD, dwServiceMask, 4, 4, 4); - TEST_FIELD(COMMPROP, DWORD, dwReserved1, 8, 4, 4); - TEST_FIELD(COMMPROP, DWORD, dwMaxTxQueue, 12, 4, 4); - TEST_FIELD(COMMPROP, DWORD, dwMaxRxQueue, 16, 4, 4); - TEST_FIELD(COMMPROP, DWORD, dwMaxBaud, 20, 4, 4); - TEST_FIELD(COMMPROP, DWORD, dwProvSubType, 24, 4, 4); - TEST_FIELD(COMMPROP, DWORD, dwProvCapabilities, 28, 4, 4); - TEST_FIELD(COMMPROP, DWORD, dwSettableParams, 32, 4, 4); - TEST_FIELD(COMMPROP, DWORD, dwSettableBaud, 36, 4, 4); - TEST_FIELD(COMMPROP, WORD, wSettableData, 40, 2, 2); - TEST_FIELD(COMMPROP, WORD, wSettableStopParity, 42, 2, 2); - TEST_FIELD(COMMPROP, DWORD, dwCurrentTxQueue, 44, 4, 4); - TEST_FIELD(COMMPROP, DWORD, dwCurrentRxQueue, 48, 4, 4); - TEST_FIELD(COMMPROP, DWORD, dwProvSpec1, 52, 4, 4); - TEST_FIELD(COMMPROP, DWORD, dwProvSpec2, 56, 4, 4); - TEST_FIELD(COMMPROP, WCHAR[1], wcProvChar, 60, 2, 2); -} - -static void test_pack_COMMTIMEOUTS(void) -{ - /* COMMTIMEOUTS (pack 4) */ - TEST_TYPE(COMMTIMEOUTS, 20, 4); - TEST_FIELD(COMMTIMEOUTS, DWORD, ReadIntervalTimeout, 0, 4, 4); - TEST_FIELD(COMMTIMEOUTS, DWORD, ReadTotalTimeoutMultiplier, 4, 4, 4); - TEST_FIELD(COMMTIMEOUTS, DWORD, ReadTotalTimeoutConstant, 8, 4, 4); - TEST_FIELD(COMMTIMEOUTS, DWORD, WriteTotalTimeoutMultiplier, 12, 4, 4); - TEST_FIELD(COMMTIMEOUTS, DWORD, WriteTotalTimeoutConstant, 16, 4, 4); -} - -static void test_pack_CREATE_PROCESS_DEBUG_INFO(void) -{ - /* CREATE_PROCESS_DEBUG_INFO (pack 4) */ - TEST_TYPE(CREATE_PROCESS_DEBUG_INFO, 40, 4); - TEST_FIELD(CREATE_PROCESS_DEBUG_INFO, HANDLE, hFile, 0, 4, 4); - TEST_FIELD(CREATE_PROCESS_DEBUG_INFO, HANDLE, hProcess, 4, 4, 4); - TEST_FIELD(CREATE_PROCESS_DEBUG_INFO, HANDLE, hThread, 8, 4, 4); - TEST_FIELD(CREATE_PROCESS_DEBUG_INFO, LPVOID, lpBaseOfImage, 12, 4, 4); - TEST_FIELD(CREATE_PROCESS_DEBUG_INFO, DWORD, dwDebugInfoFileOffset, 16, 4, 4); - TEST_FIELD(CREATE_PROCESS_DEBUG_INFO, DWORD, nDebugInfoSize, 20, 4, 4); - TEST_FIELD(CREATE_PROCESS_DEBUG_INFO, LPVOID, lpThreadLocalBase, 24, 4, 4); - TEST_FIELD(CREATE_PROCESS_DEBUG_INFO, LPTHREAD_START_ROUTINE, lpStartAddress, 28, 4, 4); - TEST_FIELD(CREATE_PROCESS_DEBUG_INFO, LPVOID, lpImageName, 32, 4, 4); - TEST_FIELD(CREATE_PROCESS_DEBUG_INFO, WORD, fUnicode, 36, 2, 2); -} - -static void test_pack_CREATE_THREAD_DEBUG_INFO(void) -{ - /* CREATE_THREAD_DEBUG_INFO (pack 4) */ - TEST_TYPE(CREATE_THREAD_DEBUG_INFO, 12, 4); - TEST_FIELD(CREATE_THREAD_DEBUG_INFO, HANDLE, hThread, 0, 4, 4); - TEST_FIELD(CREATE_THREAD_DEBUG_INFO, LPVOID, lpThreadLocalBase, 4, 4, 4); - TEST_FIELD(CREATE_THREAD_DEBUG_INFO, LPTHREAD_START_ROUTINE, lpStartAddress, 8, 4, 4); -} - -static void test_pack_CRITICAL_SECTION(void) -{ - /* CRITICAL_SECTION */ - TEST_TYPE(CRITICAL_SECTION, 24, 4); -} - -static void test_pack_CRITICAL_SECTION_DEBUG(void) -{ - /* CRITICAL_SECTION_DEBUG */ - TEST_TYPE(CRITICAL_SECTION_DEBUG, 32, 4); -} - -static void test_pack_ENUMRESLANGPROCA(void) -{ - /* ENUMRESLANGPROCA */ - TEST_TYPE(ENUMRESLANGPROCA, 4, 4); -} - -static void test_pack_ENUMRESLANGPROCW(void) -{ - /* ENUMRESLANGPROCW */ - TEST_TYPE(ENUMRESLANGPROCW, 4, 4); -} - -static void test_pack_ENUMRESNAMEPROCA(void) -{ - /* ENUMRESNAMEPROCA */ - TEST_TYPE(ENUMRESNAMEPROCA, 4, 4); -} - -static void test_pack_ENUMRESNAMEPROCW(void) -{ - /* ENUMRESNAMEPROCW */ - TEST_TYPE(ENUMRESNAMEPROCW, 4, 4); -} - -static void test_pack_ENUMRESTYPEPROCA(void) -{ - /* ENUMRESTYPEPROCA */ - TEST_TYPE(ENUMRESTYPEPROCA, 4, 4); -} - -static void test_pack_ENUMRESTYPEPROCW(void) -{ - /* ENUMRESTYPEPROCW */ - TEST_TYPE(ENUMRESTYPEPROCW, 4, 4); -} - -static void test_pack_EXCEPTION_DEBUG_INFO(void) -{ - /* EXCEPTION_DEBUG_INFO (pack 4) */ - TEST_TYPE(EXCEPTION_DEBUG_INFO, 84, 4); - TEST_FIELD(EXCEPTION_DEBUG_INFO, EXCEPTION_RECORD, ExceptionRecord, 0, 80, 4); - TEST_FIELD(EXCEPTION_DEBUG_INFO, DWORD, dwFirstChance, 80, 4, 4); -} - -static void test_pack_EXIT_PROCESS_DEBUG_INFO(void) -{ - /* EXIT_PROCESS_DEBUG_INFO (pack 4) */ - TEST_TYPE(EXIT_PROCESS_DEBUG_INFO, 4, 4); - TEST_FIELD(EXIT_PROCESS_DEBUG_INFO, DWORD, dwExitCode, 0, 4, 4); -} - -static void test_pack_EXIT_THREAD_DEBUG_INFO(void) -{ - /* EXIT_THREAD_DEBUG_INFO (pack 4) */ - TEST_TYPE(EXIT_THREAD_DEBUG_INFO, 4, 4); - TEST_FIELD(EXIT_THREAD_DEBUG_INFO, DWORD, dwExitCode, 0, 4, 4); -} - -static void test_pack_HW_PROFILE_INFOA(void) -{ - /* HW_PROFILE_INFOA (pack 4) */ - TEST_TYPE(HW_PROFILE_INFOA, 124, 4); - TEST_FIELD(HW_PROFILE_INFOA, DWORD, dwDockInfo, 0, 4, 4); - TEST_FIELD(HW_PROFILE_INFOA, CHAR[HW_PROFILE_GUIDLEN], szHwProfileGuid, 4, 39, 1); - TEST_FIELD(HW_PROFILE_INFOA, CHAR[MAX_PROFILE_LEN], szHwProfileName, 43, 80, 1); -} - -static void test_pack_HW_PROFILE_INFOW(void) -{ - /* HW_PROFILE_INFOW (pack 4) */ - TEST_TYPE(HW_PROFILE_INFOW, 244, 4); - TEST_FIELD(HW_PROFILE_INFOW, DWORD, dwDockInfo, 0, 4, 4); - TEST_FIELD(HW_PROFILE_INFOW, WCHAR[HW_PROFILE_GUIDLEN], szHwProfileGuid, 4, 78, 2); - TEST_FIELD(HW_PROFILE_INFOW, WCHAR[MAX_PROFILE_LEN], szHwProfileName, 82, 160, 2); -} - -static void test_pack_LOAD_DLL_DEBUG_INFO(void) -{ - /* LOAD_DLL_DEBUG_INFO (pack 4) */ - TEST_TYPE(LOAD_DLL_DEBUG_INFO, 24, 4); - TEST_FIELD(LOAD_DLL_DEBUG_INFO, HANDLE, hFile, 0, 4, 4); - TEST_FIELD(LOAD_DLL_DEBUG_INFO, LPVOID, lpBaseOfDll, 4, 4, 4); - TEST_FIELD(LOAD_DLL_DEBUG_INFO, DWORD, dwDebugInfoFileOffset, 8, 4, 4); - TEST_FIELD(LOAD_DLL_DEBUG_INFO, DWORD, nDebugInfoSize, 12, 4, 4); - TEST_FIELD(LOAD_DLL_DEBUG_INFO, LPVOID, lpImageName, 16, 4, 4); - TEST_FIELD(LOAD_DLL_DEBUG_INFO, WORD, fUnicode, 20, 2, 2); -} - -static void test_pack_LPBY_HANDLE_FILE_INFORMATION(void) -{ - /* LPBY_HANDLE_FILE_INFORMATION */ - TEST_TYPE(LPBY_HANDLE_FILE_INFORMATION, 4, 4); - TEST_TYPE_POINTER(LPBY_HANDLE_FILE_INFORMATION, 52, 4); -} - -static void test_pack_LPCOMMPROP(void) -{ - /* LPCOMMPROP */ - TEST_TYPE(LPCOMMPROP, 4, 4); - TEST_TYPE_POINTER(LPCOMMPROP, 64, 4); -} - -static void test_pack_LPCOMMTIMEOUTS(void) -{ - /* LPCOMMTIMEOUTS */ - TEST_TYPE(LPCOMMTIMEOUTS, 4, 4); - TEST_TYPE_POINTER(LPCOMMTIMEOUTS, 20, 4); -} - -static void test_pack_LPCRITICAL_SECTION(void) -{ - /* LPCRITICAL_SECTION */ - TEST_TYPE(LPCRITICAL_SECTION, 4, 4); -} - -static void test_pack_LPCRITICAL_SECTION_DEBUG(void) -{ - /* LPCRITICAL_SECTION_DEBUG */ - TEST_TYPE(LPCRITICAL_SECTION_DEBUG, 4, 4); -} - -static void test_pack_LPEXCEPTION_POINTERS(void) -{ - /* LPEXCEPTION_POINTERS */ - TEST_TYPE(LPEXCEPTION_POINTERS, 4, 4); -} - -static void test_pack_LPEXCEPTION_RECORD(void) -{ - /* LPEXCEPTION_RECORD */ - TEST_TYPE(LPEXCEPTION_RECORD, 4, 4); -} - -static void test_pack_LPFIBER_START_ROUTINE(void) -{ - /* LPFIBER_START_ROUTINE */ - TEST_TYPE(LPFIBER_START_ROUTINE, 4, 4); -} - -static void test_pack_LPHW_PROFILE_INFOA(void) -{ - /* LPHW_PROFILE_INFOA */ - TEST_TYPE(LPHW_PROFILE_INFOA, 4, 4); - TEST_TYPE_POINTER(LPHW_PROFILE_INFOA, 124, 4); -} - -static void test_pack_LPHW_PROFILE_INFOW(void) -{ - /* LPHW_PROFILE_INFOW */ - TEST_TYPE(LPHW_PROFILE_INFOW, 4, 4); - TEST_TYPE_POINTER(LPHW_PROFILE_INFOW, 244, 4); -} - -static void test_pack_LPMEMORYSTATUS(void) -{ - /* LPMEMORYSTATUS */ - TEST_TYPE(LPMEMORYSTATUS, 4, 4); - TEST_TYPE_POINTER(LPMEMORYSTATUS, 32, 4); -} - -static void test_pack_LPOFSTRUCT(void) -{ - /* LPOFSTRUCT */ - TEST_TYPE(LPOFSTRUCT, 4, 4); - TEST_TYPE_POINTER(LPOFSTRUCT, 136, 2); -} - -static void test_pack_LPOVERLAPPED(void) -{ - /* LPOVERLAPPED */ - TEST_TYPE(LPOVERLAPPED, 4, 4); - TEST_TYPE_POINTER(LPOVERLAPPED, 20, 4); -} - -static void test_pack_LPOVERLAPPED_COMPLETION_ROUTINE(void) -{ - /* LPOVERLAPPED_COMPLETION_ROUTINE */ - TEST_TYPE(LPOVERLAPPED_COMPLETION_ROUTINE, 4, 4); -} - -static void test_pack_LPPROCESS_INFORMATION(void) -{ - /* LPPROCESS_INFORMATION */ - TEST_TYPE(LPPROCESS_INFORMATION, 4, 4); - TEST_TYPE_POINTER(LPPROCESS_INFORMATION, 16, 4); -} - -static void test_pack_LPPROGRESS_ROUTINE(void) -{ - /* LPPROGRESS_ROUTINE */ - TEST_TYPE(LPPROGRESS_ROUTINE, 4, 4); -} - -static void test_pack_LPSECURITY_ATTRIBUTES(void) -{ - /* LPSECURITY_ATTRIBUTES */ - TEST_TYPE(LPSECURITY_ATTRIBUTES, 4, 4); - TEST_TYPE_POINTER(LPSECURITY_ATTRIBUTES, 12, 4); -} - -static void test_pack_LPSTARTUPINFOA(void) -{ - /* LPSTARTUPINFOA */ - TEST_TYPE(LPSTARTUPINFOA, 4, 4); - TEST_TYPE_POINTER(LPSTARTUPINFOA, 68, 4); -} - -static void test_pack_LPSTARTUPINFOW(void) -{ - /* LPSTARTUPINFOW */ - TEST_TYPE(LPSTARTUPINFOW, 4, 4); - TEST_TYPE_POINTER(LPSTARTUPINFOW, 68, 4); -} - -static void test_pack_LPSYSTEMTIME(void) -{ - /* LPSYSTEMTIME */ - TEST_TYPE(LPSYSTEMTIME, 4, 4); - TEST_TYPE_POINTER(LPSYSTEMTIME, 16, 2); -} - -static void test_pack_LPSYSTEM_POWER_STATUS(void) -{ - /* LPSYSTEM_POWER_STATUS */ - TEST_TYPE(LPSYSTEM_POWER_STATUS, 4, 4); - TEST_TYPE_POINTER(LPSYSTEM_POWER_STATUS, 12, 4); -} - -static void test_pack_LPTHREAD_START_ROUTINE(void) -{ - /* LPTHREAD_START_ROUTINE */ - TEST_TYPE(LPTHREAD_START_ROUTINE, 4, 4); -} - -static void test_pack_LPTIME_ZONE_INFORMATION(void) -{ - /* LPTIME_ZONE_INFORMATION */ - TEST_TYPE(LPTIME_ZONE_INFORMATION, 4, 4); - TEST_TYPE_POINTER(LPTIME_ZONE_INFORMATION, 172, 4); -} - -static void test_pack_LPWIN32_FILE_ATTRIBUTE_DATA(void) -{ - /* LPWIN32_FILE_ATTRIBUTE_DATA */ - TEST_TYPE(LPWIN32_FILE_ATTRIBUTE_DATA, 4, 4); - TEST_TYPE_POINTER(LPWIN32_FILE_ATTRIBUTE_DATA, 36, 4); -} - -static void test_pack_LPWIN32_FIND_DATAA(void) -{ - /* LPWIN32_FIND_DATAA */ - TEST_TYPE(LPWIN32_FIND_DATAA, 4, 4); - TEST_TYPE_POINTER(LPWIN32_FIND_DATAA, 320, 4); -} - -static void test_pack_LPWIN32_FIND_DATAW(void) -{ - /* LPWIN32_FIND_DATAW */ - TEST_TYPE(LPWIN32_FIND_DATAW, 4, 4); - TEST_TYPE_POINTER(LPWIN32_FIND_DATAW, 592, 4); -} - -static void test_pack_MEMORYSTATUS(void) -{ - /* MEMORYSTATUS (pack 4) */ - TEST_TYPE(MEMORYSTATUS, 32, 4); - TEST_FIELD(MEMORYSTATUS, DWORD, dwLength, 0, 4, 4); - TEST_FIELD(MEMORYSTATUS, DWORD, dwMemoryLoad, 4, 4, 4); - TEST_FIELD(MEMORYSTATUS, SIZE_T, dwTotalPhys, 8, 4, 4); - TEST_FIELD(MEMORYSTATUS, SIZE_T, dwAvailPhys, 12, 4, 4); - TEST_FIELD(MEMORYSTATUS, SIZE_T, dwTotalPageFile, 16, 4, 4); - TEST_FIELD(MEMORYSTATUS, SIZE_T, dwAvailPageFile, 20, 4, 4); - TEST_FIELD(MEMORYSTATUS, SIZE_T, dwTotalVirtual, 24, 4, 4); - TEST_FIELD(MEMORYSTATUS, SIZE_T, dwAvailVirtual, 28, 4, 4); -} - -static void test_pack_OFSTRUCT(void) -{ - /* OFSTRUCT (pack 4) */ - TEST_TYPE(OFSTRUCT, 136, 2); - TEST_FIELD(OFSTRUCT, BYTE, cBytes, 0, 1, 1); - TEST_FIELD(OFSTRUCT, BYTE, fFixedDisk, 1, 1, 1); - TEST_FIELD(OFSTRUCT, WORD, nErrCode, 2, 2, 2); - TEST_FIELD(OFSTRUCT, WORD, Reserved1, 4, 2, 2); - TEST_FIELD(OFSTRUCT, WORD, Reserved2, 6, 2, 2); - TEST_FIELD(OFSTRUCT, BYTE[OFS_MAXPATHNAME], szPathName, 8, 128, 1); -} - -static void test_pack_OUTPUT_DEBUG_STRING_INFO(void) -{ - /* OUTPUT_DEBUG_STRING_INFO (pack 4) */ - TEST_TYPE(OUTPUT_DEBUG_STRING_INFO, 8, 4); - TEST_FIELD(OUTPUT_DEBUG_STRING_INFO, LPSTR, lpDebugStringData, 0, 4, 4); - TEST_FIELD(OUTPUT_DEBUG_STRING_INFO, WORD, fUnicode, 4, 2, 2); - TEST_FIELD(OUTPUT_DEBUG_STRING_INFO, WORD, nDebugStringLength, 6, 2, 2); -} - -static void test_pack_OVERLAPPED(void) -{ - /* OVERLAPPED (pack 4) */ - TEST_TYPE(OVERLAPPED, 20, 4); - TEST_FIELD(OVERLAPPED, DWORD, Internal, 0, 4, 4); - TEST_FIELD(OVERLAPPED, DWORD, InternalHigh, 4, 4, 4); - TEST_FIELD(OVERLAPPED, DWORD, Offset, 8, 4, 4); - TEST_FIELD(OVERLAPPED, DWORD, OffsetHigh, 12, 4, 4); - TEST_FIELD(OVERLAPPED, HANDLE, hEvent, 16, 4, 4); -} - -static void test_pack_PACTCTXA(void) -{ - /* PACTCTXA */ - TEST_TYPE(PACTCTXA, 4, 4); - TEST_TYPE_POINTER(PACTCTXA, 32, 4); -} - -static void test_pack_PACTCTXW(void) -{ - /* PACTCTXW */ - TEST_TYPE(PACTCTXW, 4, 4); - TEST_TYPE_POINTER(PACTCTXW, 32, 4); -} - -static void test_pack_PACTCTX_SECTION_KEYED_DATA(void) -{ - /* PACTCTX_SECTION_KEYED_DATA */ - TEST_TYPE(PACTCTX_SECTION_KEYED_DATA, 4, 4); - TEST_TYPE_POINTER(PACTCTX_SECTION_KEYED_DATA, 64, 4); -} - -static void test_pack_PACTCTX_SECTION_KEYED_DATA_2600(void) -{ - /* PACTCTX_SECTION_KEYED_DATA_2600 */ - TEST_TYPE(PACTCTX_SECTION_KEYED_DATA_2600, 4, 4); - TEST_TYPE_POINTER(PACTCTX_SECTION_KEYED_DATA_2600, 40, 4); -} - -static void test_pack_PACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA(void) -{ - /* PACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA */ - TEST_TYPE(PACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA, 4, 4); - TEST_TYPE_POINTER(PACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA, 20, 4); -} - -static void test_pack_PACTIVATION_CONTEXT_BASIC_INFORMATION(void) -{ - /* PACTIVATION_CONTEXT_BASIC_INFORMATION */ - TEST_TYPE(PACTIVATION_CONTEXT_BASIC_INFORMATION, 4, 4); - TEST_TYPE_POINTER(PACTIVATION_CONTEXT_BASIC_INFORMATION, 8, 4); -} - -static void test_pack_PAPCFUNC(void) -{ - /* PAPCFUNC */ - TEST_TYPE(PAPCFUNC, 4, 4); -} - -static void test_pack_PBY_HANDLE_FILE_INFORMATION(void) -{ - /* PBY_HANDLE_FILE_INFORMATION */ - TEST_TYPE(PBY_HANDLE_FILE_INFORMATION, 4, 4); - TEST_TYPE_POINTER(PBY_HANDLE_FILE_INFORMATION, 52, 4); -} - -static void test_pack_PCACTCTXA(void) -{ - /* PCACTCTXA */ - TEST_TYPE(PCACTCTXA, 4, 4); - TEST_TYPE_POINTER(PCACTCTXA, 32, 4); -} - -static void test_pack_PCACTCTXW(void) -{ - /* PCACTCTXW */ - TEST_TYPE(PCACTCTXW, 4, 4); - TEST_TYPE_POINTER(PCACTCTXW, 32, 4); -} - -static void test_pack_PCACTCTX_SECTION_KEYED_DATA(void) -{ - /* PCACTCTX_SECTION_KEYED_DATA */ - TEST_TYPE(PCACTCTX_SECTION_KEYED_DATA, 4, 4); - TEST_TYPE_POINTER(PCACTCTX_SECTION_KEYED_DATA, 64, 4); -} - -static void test_pack_PCACTCTX_SECTION_KEYED_DATA_2600(void) -{ - /* PCACTCTX_SECTION_KEYED_DATA_2600 */ - TEST_TYPE(PCACTCTX_SECTION_KEYED_DATA_2600, 4, 4); - TEST_TYPE_POINTER(PCACTCTX_SECTION_KEYED_DATA_2600, 40, 4); -} - -static void test_pack_PCACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA(void) -{ - /* PCACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA */ - TEST_TYPE(PCACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA, 4, 4); - TEST_TYPE_POINTER(PCACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA, 20, 4); -} - -static void test_pack_PCRITICAL_SECTION(void) -{ - /* PCRITICAL_SECTION */ - TEST_TYPE(PCRITICAL_SECTION, 4, 4); -} - -static void test_pack_PCRITICAL_SECTION_DEBUG(void) -{ - /* PCRITICAL_SECTION_DEBUG */ - TEST_TYPE(PCRITICAL_SECTION_DEBUG, 4, 4); -} - -static void test_pack_PFIBER_START_ROUTINE(void) -{ - /* PFIBER_START_ROUTINE */ - TEST_TYPE(PFIBER_START_ROUTINE, 4, 4); -} - -static void test_pack_POFSTRUCT(void) -{ - /* POFSTRUCT */ - TEST_TYPE(POFSTRUCT, 4, 4); - TEST_TYPE_POINTER(POFSTRUCT, 136, 2); -} - -static void test_pack_PPROCESS_INFORMATION(void) -{ - /* PPROCESS_INFORMATION */ - TEST_TYPE(PPROCESS_INFORMATION, 4, 4); - TEST_TYPE_POINTER(PPROCESS_INFORMATION, 16, 4); -} - -static void test_pack_PQUERYACTCTXW_FUNC(void) -{ - /* PQUERYACTCTXW_FUNC */ - TEST_TYPE(PQUERYACTCTXW_FUNC, 4, 4); -} - -static void test_pack_PROCESS_INFORMATION(void) -{ - /* PROCESS_INFORMATION (pack 4) */ - TEST_TYPE(PROCESS_INFORMATION, 16, 4); - TEST_FIELD(PROCESS_INFORMATION, HANDLE, hProcess, 0, 4, 4); - TEST_FIELD(PROCESS_INFORMATION, HANDLE, hThread, 4, 4, 4); - TEST_FIELD(PROCESS_INFORMATION, DWORD, dwProcessId, 8, 4, 4); - TEST_FIELD(PROCESS_INFORMATION, DWORD, dwThreadId, 12, 4, 4); -} - -static void test_pack_PSECURITY_ATTRIBUTES(void) -{ - /* PSECURITY_ATTRIBUTES */ - TEST_TYPE(PSECURITY_ATTRIBUTES, 4, 4); - TEST_TYPE_POINTER(PSECURITY_ATTRIBUTES, 12, 4); -} - -static void test_pack_PSYSTEMTIME(void) -{ - /* PSYSTEMTIME */ - TEST_TYPE(PSYSTEMTIME, 4, 4); - TEST_TYPE_POINTER(PSYSTEMTIME, 16, 2); -} - -static void test_pack_PTIMERAPCROUTINE(void) -{ - /* PTIMERAPCROUTINE */ - TEST_TYPE(PTIMERAPCROUTINE, 4, 4); -} - -static void test_pack_PTIME_ZONE_INFORMATION(void) -{ - /* PTIME_ZONE_INFORMATION */ - TEST_TYPE(PTIME_ZONE_INFORMATION, 4, 4); - TEST_TYPE_POINTER(PTIME_ZONE_INFORMATION, 172, 4); -} - -static void test_pack_PWIN32_FIND_DATAA(void) -{ - /* PWIN32_FIND_DATAA */ - TEST_TYPE(PWIN32_FIND_DATAA, 4, 4); - TEST_TYPE_POINTER(PWIN32_FIND_DATAA, 320, 4); -} - -static void test_pack_PWIN32_FIND_DATAW(void) -{ - /* PWIN32_FIND_DATAW */ - TEST_TYPE(PWIN32_FIND_DATAW, 4, 4); - TEST_TYPE_POINTER(PWIN32_FIND_DATAW, 592, 4); -} - -static void test_pack_RIP_INFO(void) -{ - /* RIP_INFO (pack 4) */ - TEST_TYPE(RIP_INFO, 8, 4); - TEST_FIELD(RIP_INFO, DWORD, dwError, 0, 4, 4); - TEST_FIELD(RIP_INFO, DWORD, dwType, 4, 4, 4); -} - -static void test_pack_SECURITY_ATTRIBUTES(void) -{ - /* SECURITY_ATTRIBUTES (pack 4) */ - TEST_TYPE(SECURITY_ATTRIBUTES, 12, 4); - TEST_FIELD(SECURITY_ATTRIBUTES, DWORD, nLength, 0, 4, 4); - TEST_FIELD(SECURITY_ATTRIBUTES, LPVOID, lpSecurityDescriptor, 4, 4, 4); - TEST_FIELD(SECURITY_ATTRIBUTES, BOOL, bInheritHandle, 8, 4, 4); -} - -static void test_pack_STARTUPINFOA(void) -{ - /* STARTUPINFOA (pack 4) */ - TEST_TYPE(STARTUPINFOA, 68, 4); - TEST_FIELD(STARTUPINFOA, DWORD, cb, 0, 4, 4); - TEST_FIELD(STARTUPINFOA, LPSTR, lpReserved, 4, 4, 4); - TEST_FIELD(STARTUPINFOA, LPSTR, lpDesktop, 8, 4, 4); - TEST_FIELD(STARTUPINFOA, LPSTR, lpTitle, 12, 4, 4); - TEST_FIELD(STARTUPINFOA, DWORD, dwX, 16, 4, 4); - TEST_FIELD(STARTUPINFOA, DWORD, dwY, 20, 4, 4); - TEST_FIELD(STARTUPINFOA, DWORD, dwXSize, 24, 4, 4); - TEST_FIELD(STARTUPINFOA, DWORD, dwYSize, 28, 4, 4); - TEST_FIELD(STARTUPINFOA, DWORD, dwXCountChars, 32, 4, 4); - TEST_FIELD(STARTUPINFOA, DWORD, dwYCountChars, 36, 4, 4); - TEST_FIELD(STARTUPINFOA, DWORD, dwFillAttribute, 40, 4, 4); - TEST_FIELD(STARTUPINFOA, DWORD, dwFlags, 44, 4, 4); - TEST_FIELD(STARTUPINFOA, WORD, wShowWindow, 48, 2, 2); - TEST_FIELD(STARTUPINFOA, WORD, cbReserved2, 50, 2, 2); - TEST_FIELD(STARTUPINFOA, BYTE *, lpReserved2, 52, 4, 4); - TEST_FIELD(STARTUPINFOA, HANDLE, hStdInput, 56, 4, 4); - TEST_FIELD(STARTUPINFOA, HANDLE, hStdOutput, 60, 4, 4); - TEST_FIELD(STARTUPINFOA, HANDLE, hStdError, 64, 4, 4); -} - -static void test_pack_STARTUPINFOW(void) -{ - /* STARTUPINFOW (pack 4) */ - TEST_TYPE(STARTUPINFOW, 68, 4); - TEST_FIELD(STARTUPINFOW, DWORD, cb, 0, 4, 4); - TEST_FIELD(STARTUPINFOW, LPWSTR, lpReserved, 4, 4, 4); - TEST_FIELD(STARTUPINFOW, LPWSTR, lpDesktop, 8, 4, 4); - TEST_FIELD(STARTUPINFOW, LPWSTR, lpTitle, 12, 4, 4); - TEST_FIELD(STARTUPINFOW, DWORD, dwX, 16, 4, 4); - TEST_FIELD(STARTUPINFOW, DWORD, dwY, 20, 4, 4); - TEST_FIELD(STARTUPINFOW, DWORD, dwXSize, 24, 4, 4); - TEST_FIELD(STARTUPINFOW, DWORD, dwYSize, 28, 4, 4); - TEST_FIELD(STARTUPINFOW, DWORD, dwXCountChars, 32, 4, 4); - TEST_FIELD(STARTUPINFOW, DWORD, dwYCountChars, 36, 4, 4); - TEST_FIELD(STARTUPINFOW, DWORD, dwFillAttribute, 40, 4, 4); - TEST_FIELD(STARTUPINFOW, DWORD, dwFlags, 44, 4, 4); - TEST_FIELD(STARTUPINFOW, WORD, wShowWindow, 48, 2, 2); - TEST_FIELD(STARTUPINFOW, WORD, cbReserved2, 50, 2, 2); - TEST_FIELD(STARTUPINFOW, BYTE *, lpReserved2, 52, 4, 4); - TEST_FIELD(STARTUPINFOW, HANDLE, hStdInput, 56, 4, 4); - TEST_FIELD(STARTUPINFOW, HANDLE, hStdOutput, 60, 4, 4); - TEST_FIELD(STARTUPINFOW, HANDLE, hStdError, 64, 4, 4); -} - -static void test_pack_SYSLEVEL(void) -{ - /* SYSLEVEL (pack 4) */ - TEST_TYPE(SYSLEVEL, 28, 4); - TEST_FIELD(SYSLEVEL, CRITICAL_SECTION, crst, 0, 24, 4); - TEST_FIELD(SYSLEVEL, INT, level, 24, 4, 4); -} - -static void test_pack_SYSTEMTIME(void) -{ - /* SYSTEMTIME (pack 4) */ - TEST_TYPE(SYSTEMTIME, 16, 2); - TEST_FIELD(SYSTEMTIME, WORD, wYear, 0, 2, 2); - TEST_FIELD(SYSTEMTIME, WORD, wMonth, 2, 2, 2); - TEST_FIELD(SYSTEMTIME, WORD, wDayOfWeek, 4, 2, 2); - TEST_FIELD(SYSTEMTIME, WORD, wDay, 6, 2, 2); - TEST_FIELD(SYSTEMTIME, WORD, wHour, 8, 2, 2); - TEST_FIELD(SYSTEMTIME, WORD, wMinute, 10, 2, 2); - TEST_FIELD(SYSTEMTIME, WORD, wSecond, 12, 2, 2); - TEST_FIELD(SYSTEMTIME, WORD, wMilliseconds, 14, 2, 2); -} - -static void test_pack_SYSTEM_POWER_STATUS(void) -{ - /* SYSTEM_POWER_STATUS (pack 4) */ - TEST_TYPE(SYSTEM_POWER_STATUS, 12, 4); - TEST_FIELD(SYSTEM_POWER_STATUS, BYTE, ACLineStatus, 0, 1, 1); - TEST_FIELD(SYSTEM_POWER_STATUS, BYTE, BatteryFlag, 1, 1, 1); - TEST_FIELD(SYSTEM_POWER_STATUS, BYTE, BatteryLifePercent, 2, 1, 1); - TEST_FIELD(SYSTEM_POWER_STATUS, BYTE, Reserved1, 3, 1, 1); - TEST_FIELD(SYSTEM_POWER_STATUS, DWORD, BatteryLifeTime, 4, 4, 4); - TEST_FIELD(SYSTEM_POWER_STATUS, DWORD, BatteryFullLifeTime, 8, 4, 4); -} - -static void test_pack_TIME_ZONE_INFORMATION(void) -{ - /* TIME_ZONE_INFORMATION (pack 4) */ - TEST_TYPE(TIME_ZONE_INFORMATION, 172, 4); - TEST_FIELD(TIME_ZONE_INFORMATION, LONG, Bias, 0, 4, 4); - TEST_FIELD(TIME_ZONE_INFORMATION, WCHAR[32], StandardName, 4, 64, 2); - TEST_FIELD(TIME_ZONE_INFORMATION, SYSTEMTIME, StandardDate, 68, 16, 2); - TEST_FIELD(TIME_ZONE_INFORMATION, LONG, StandardBias, 84, 4, 4); - TEST_FIELD(TIME_ZONE_INFORMATION, WCHAR[32], DaylightName, 88, 64, 2); - TEST_FIELD(TIME_ZONE_INFORMATION, SYSTEMTIME, DaylightDate, 152, 16, 2); - TEST_FIELD(TIME_ZONE_INFORMATION, LONG, DaylightBias, 168, 4, 4); -} - -static void test_pack_UNLOAD_DLL_DEBUG_INFO(void) -{ - /* UNLOAD_DLL_DEBUG_INFO (pack 4) */ - TEST_TYPE(UNLOAD_DLL_DEBUG_INFO, 4, 4); - TEST_FIELD(UNLOAD_DLL_DEBUG_INFO, LPVOID, lpBaseOfDll, 0, 4, 4); -} - -static void test_pack_WAITORTIMERCALLBACK(void) -{ - /* WAITORTIMERCALLBACK */ - TEST_TYPE(WAITORTIMERCALLBACK, 4, 4); -} - -static void test_pack_WIN32_FILE_ATTRIBUTE_DATA(void) -{ - /* WIN32_FILE_ATTRIBUTE_DATA (pack 4) */ - TEST_TYPE(WIN32_FILE_ATTRIBUTE_DATA, 36, 4); - TEST_FIELD(WIN32_FILE_ATTRIBUTE_DATA, DWORD, dwFileAttributes, 0, 4, 4); - TEST_FIELD(WIN32_FILE_ATTRIBUTE_DATA, FILETIME, ftCreationTime, 4, 8, 4); - TEST_FIELD(WIN32_FILE_ATTRIBUTE_DATA, FILETIME, ftLastAccessTime, 12, 8, 4); - TEST_FIELD(WIN32_FILE_ATTRIBUTE_DATA, FILETIME, ftLastWriteTime, 20, 8, 4); - TEST_FIELD(WIN32_FILE_ATTRIBUTE_DATA, DWORD, nFileSizeHigh, 28, 4, 4); - TEST_FIELD(WIN32_FILE_ATTRIBUTE_DATA, DWORD, nFileSizeLow, 32, 4, 4); -} - -static void test_pack_WIN32_FIND_DATAA(void) -{ - /* WIN32_FIND_DATAA (pack 4) */ - TEST_TYPE(WIN32_FIND_DATAA, 320, 4); - TEST_FIELD(WIN32_FIND_DATAA, DWORD, dwFileAttributes, 0, 4, 4); - TEST_FIELD(WIN32_FIND_DATAA, FILETIME, ftCreationTime, 4, 8, 4); - TEST_FIELD(WIN32_FIND_DATAA, FILETIME, ftLastAccessTime, 12, 8, 4); - TEST_FIELD(WIN32_FIND_DATAA, FILETIME, ftLastWriteTime, 20, 8, 4); - TEST_FIELD(WIN32_FIND_DATAA, DWORD, nFileSizeHigh, 28, 4, 4); - TEST_FIELD(WIN32_FIND_DATAA, DWORD, nFileSizeLow, 32, 4, 4); - TEST_FIELD(WIN32_FIND_DATAA, DWORD, dwReserved0, 36, 4, 4); - TEST_FIELD(WIN32_FIND_DATAA, DWORD, dwReserved1, 40, 4, 4); - TEST_FIELD(WIN32_FIND_DATAA, CHAR[260], cFileName, 44, 260, 1); - TEST_FIELD(WIN32_FIND_DATAA, CHAR[14], cAlternateFileName, 304, 14, 1); -} - -static void test_pack_WIN32_FIND_DATAW(void) -{ - /* WIN32_FIND_DATAW (pack 4) */ - TEST_TYPE(WIN32_FIND_DATAW, 592, 4); - TEST_FIELD(WIN32_FIND_DATAW, DWORD, dwFileAttributes, 0, 4, 4); - TEST_FIELD(WIN32_FIND_DATAW, FILETIME, ftCreationTime, 4, 8, 4); - TEST_FIELD(WIN32_FIND_DATAW, FILETIME, ftLastAccessTime, 12, 8, 4); - TEST_FIELD(WIN32_FIND_DATAW, FILETIME, ftLastWriteTime, 20, 8, 4); - TEST_FIELD(WIN32_FIND_DATAW, DWORD, nFileSizeHigh, 28, 4, 4); - TEST_FIELD(WIN32_FIND_DATAW, DWORD, nFileSizeLow, 32, 4, 4); - TEST_FIELD(WIN32_FIND_DATAW, DWORD, dwReserved0, 36, 4, 4); - TEST_FIELD(WIN32_FIND_DATAW, DWORD, dwReserved1, 40, 4, 4); - TEST_FIELD(WIN32_FIND_DATAW, WCHAR[260], cFileName, 44, 520, 2); - TEST_FIELD(WIN32_FIND_DATAW, WCHAR[14], cAlternateFileName, 564, 28, 2); -} - -static void test_pack(void) -{ - test_pack_ACTCTXA(); - test_pack_ACTCTXW(); - test_pack_ACTCTX_SECTION_KEYED_DATA(); - test_pack_ACTCTX_SECTION_KEYED_DATA_2600(); - test_pack_ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA(); - test_pack_ACTIVATION_CONTEXT_BASIC_INFORMATION(); - test_pack_BY_HANDLE_FILE_INFORMATION(); - test_pack_COMMPROP(); - test_pack_COMMTIMEOUTS(); - test_pack_CREATE_PROCESS_DEBUG_INFO(); - test_pack_CREATE_THREAD_DEBUG_INFO(); - test_pack_CRITICAL_SECTION(); - test_pack_CRITICAL_SECTION_DEBUG(); - test_pack_ENUMRESLANGPROCA(); - test_pack_ENUMRESLANGPROCW(); - test_pack_ENUMRESNAMEPROCA(); - test_pack_ENUMRESNAMEPROCW(); - test_pack_ENUMRESTYPEPROCA(); - test_pack_ENUMRESTYPEPROCW(); - test_pack_EXCEPTION_DEBUG_INFO(); - test_pack_EXIT_PROCESS_DEBUG_INFO(); - test_pack_EXIT_THREAD_DEBUG_INFO(); - test_pack_HW_PROFILE_INFOA(); - test_pack_HW_PROFILE_INFOW(); - test_pack_LOAD_DLL_DEBUG_INFO(); - test_pack_LPBY_HANDLE_FILE_INFORMATION(); - test_pack_LPCOMMPROP(); - test_pack_LPCOMMTIMEOUTS(); - test_pack_LPCRITICAL_SECTION(); - test_pack_LPCRITICAL_SECTION_DEBUG(); - test_pack_LPEXCEPTION_POINTERS(); - test_pack_LPEXCEPTION_RECORD(); - test_pack_LPFIBER_START_ROUTINE(); - test_pack_LPHW_PROFILE_INFOA(); - test_pack_LPHW_PROFILE_INFOW(); - test_pack_LPLONG(); - test_pack_LPMEMORYSTATUS(); - test_pack_LPOFSTRUCT(); - test_pack_LPOSVERSIONINFOA(); - test_pack_LPOSVERSIONINFOEXA(); - test_pack_LPOSVERSIONINFOEXW(); - test_pack_LPOSVERSIONINFOW(); - test_pack_LPOVERLAPPED(); - test_pack_LPOVERLAPPED_COMPLETION_ROUTINE(); - test_pack_LPPROCESS_INFORMATION(); - test_pack_LPPROGRESS_ROUTINE(); - test_pack_LPSECURITY_ATTRIBUTES(); - test_pack_LPSTARTUPINFOA(); - test_pack_LPSTARTUPINFOW(); - test_pack_LPSYSTEMTIME(); - test_pack_LPSYSTEM_POWER_STATUS(); - test_pack_LPTHREAD_START_ROUTINE(); - test_pack_LPTIME_ZONE_INFORMATION(); - test_pack_LPVOID(); - test_pack_LPWIN32_FILE_ATTRIBUTE_DATA(); - test_pack_LPWIN32_FIND_DATAA(); - test_pack_LPWIN32_FIND_DATAW(); - test_pack_MEMORYSTATUS(); - test_pack_OFSTRUCT(); - test_pack_OSVERSIONINFOA(); - test_pack_OSVERSIONINFOEXA(); - test_pack_OSVERSIONINFOEXW(); - test_pack_OSVERSIONINFOW(); - test_pack_OUTPUT_DEBUG_STRING_INFO(); - test_pack_OVERLAPPED(); - test_pack_PACTCTXA(); - test_pack_PACTCTXW(); - test_pack_PACTCTX_SECTION_KEYED_DATA(); - test_pack_PACTCTX_SECTION_KEYED_DATA_2600(); - test_pack_PACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA(); - test_pack_PACTIVATION_CONTEXT_BASIC_INFORMATION(); - test_pack_PAPCFUNC(); - test_pack_PBY_HANDLE_FILE_INFORMATION(); - test_pack_PCACTCTXA(); - test_pack_PCACTCTXW(); - test_pack_PCACTCTX_SECTION_KEYED_DATA(); - test_pack_PCACTCTX_SECTION_KEYED_DATA_2600(); - test_pack_PCACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA(); - test_pack_PCRITICAL_SECTION(); - test_pack_PCRITICAL_SECTION_DEBUG(); - test_pack_PFIBER_START_ROUTINE(); - test_pack_PHKEY(); - test_pack_POFSTRUCT(); - test_pack_POSVERSIONINFOA(); - test_pack_POSVERSIONINFOEXA(); - test_pack_POSVERSIONINFOEXW(); - test_pack_POSVERSIONINFOW(); - test_pack_PPROCESS_INFORMATION(); - test_pack_PQUERYACTCTXW_FUNC(); - test_pack_PROCESS_INFORMATION(); - test_pack_PSECURITY_ATTRIBUTES(); - test_pack_PSYSTEMTIME(); - test_pack_PTIMERAPCROUTINE(); - test_pack_PTIME_ZONE_INFORMATION(); - test_pack_PWIN32_FIND_DATAA(); - test_pack_PWIN32_FIND_DATAW(); - test_pack_RIP_INFO(); - test_pack_SECURITY_ATTRIBUTES(); - test_pack_STARTUPINFOA(); - test_pack_STARTUPINFOW(); - test_pack_SYSLEVEL(); - test_pack_SYSTEMTIME(); - test_pack_SYSTEM_POWER_STATUS(); - test_pack_TIME_ZONE_INFORMATION(); - test_pack_UNLOAD_DLL_DEBUG_INFO(); - test_pack_WAITORTIMERCALLBACK(); - test_pack_WIN32_FILE_ATTRIBUTE_DATA(); - test_pack_WIN32_FIND_DATAA(); - test_pack_WIN32_FIND_DATAW(); -} - -START_TEST(generated) -{ - test_pack(); -} diff --git a/reactos/apps/tests/kernel32/heap.c b/reactos/apps/tests/kernel32/heap.c deleted file mode 100644 index 358b00d0a5e..00000000000 --- a/reactos/apps/tests/kernel32/heap.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Unit test suite for heap functions - * - * Copyright 2003 Dimitrie O. Paun - * - * 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 "wine/test.h" - -START_TEST(heap) -{ - void *mem; - HGLOBAL gbl; - SIZE_T size; - - /* Heap*() functions */ - mem = HeapAlloc(GetProcessHeap(), 0, 0); - ok(mem != NULL, "memory not allocated for size 0\n"); - - mem = HeapReAlloc(GetProcessHeap(), 0, NULL, 10); - ok(mem == NULL, "memory allocated by HeapReAlloc\n"); - - /* Global*() functions */ - gbl = GlobalAlloc(GMEM_MOVEABLE, 0); - ok(gbl != NULL, "global memory not allocated for size 0\n"); - - gbl = GlobalReAlloc(gbl, 10, GMEM_MOVEABLE); - ok(gbl != NULL, "Can't realloc global memory\n"); - size = GlobalSize(gbl); - ok(size >= 10 && size <= 16, "Memory not resized to size 10, instead size=%ld\n", size); - - todo_wine - { - gbl = GlobalReAlloc(gbl, 0, GMEM_MOVEABLE); - ok(gbl != NULL, "GlobalReAlloc should not fail on size 0\n"); - } - - size = GlobalSize(gbl); - ok(size == 0, "Memory not resized to size 0, instead size=%ld\n", size); - ok(GlobalFree(gbl) == NULL, "Memory not freed\n"); - size = GlobalSize(gbl); - ok(size == 0, "Memory should have been freed, size=%ld\n", size); - - gbl = GlobalReAlloc(0, 10, GMEM_MOVEABLE); - ok(gbl == NULL, "global realloc allocated memory\n"); - - /* Local*() functions */ - gbl = LocalAlloc(GMEM_MOVEABLE, 0); - ok(gbl != NULL, "local memory not allocated for size 0\n"); - - gbl = LocalReAlloc(gbl, 10, GMEM_MOVEABLE); - ok(gbl != NULL, "Can't realloc local memory\n"); - size = LocalSize(gbl); - ok(size >= 10 && size <= 16, "Memory not resized to size 10, instead size=%ld\n", size); - - todo_wine - { - gbl = LocalReAlloc(gbl, 0, GMEM_MOVEABLE); - ok(gbl != NULL, "LocalReAlloc should not fail on size 0\n"); - } - - size = LocalSize(gbl); - ok(size == 0, "Memory not resized to size 0, instead size=%ld\n", size); - ok(LocalFree(gbl) == NULL, "Memory not freed\n"); - size = LocalSize(gbl); - ok(size == 0, "Memory should have been freed, size=%ld\n", size); - - gbl = LocalReAlloc(0, 10, GMEM_MOVEABLE); - ok(gbl == NULL, "local realloc allocated memory\n"); - -} diff --git a/reactos/apps/tests/kernel32/locale.c b/reactos/apps/tests/kernel32/locale.c deleted file mode 100644 index 5c044a968b7..00000000000 --- a/reactos/apps/tests/kernel32/locale.c +++ /dev/null @@ -1,2045 +0,0 @@ -/* - * Unit tests for locale functions - * - * Copyright 2002 YASAR Mehmet - * Copyright 2003 Dmitry Timoshkov - * Copyright 2003 Jon Griffiths - * - * 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 - * - * NOTES - * We must pass LOCALE_NOUSEROVERRIDE (NUO) to formatting functions so that - * even when the user has overridden their default i8n settings (e.g. in - * the control panel i8n page), we will still get the expected results. - */ - -#include -#include -#include - -#include "wine/test.h" -#include "windef.h" -#include "winbase.h" -#include "winerror.h" -#include "winnls.h" - -static inline unsigned int strlenW( const WCHAR *str ) -{ - const WCHAR *s = str; - while (*s) s++; - return s - str; -} - -static inline int strncmpW( const WCHAR *str1, const WCHAR *str2, int n ) -{ - if (n <= 0) return 0; - while ((--n > 0) && *str1 && (*str1 == *str2)) { str1++; str2++; } - return *str1 - *str2; -} - -static inline WCHAR *strchrW( const WCHAR *str, WCHAR ch ) -{ - for ( ; *str; str++) if (*str == ch) return (WCHAR *)str; - return NULL; -} - -inline static int isdigitW( WCHAR wc ) -{ - WORD type; - GetStringTypeW( CT_CTYPE1, &wc, 1, &type ); - return type & C1_DIGIT; -} - -/* Some functions are only in later versions of kernel32.dll */ -static HMODULE hKernel32; - -typedef BOOL (WINAPI *EnumSystemLanguageGroupsAFn)(LANGUAGEGROUP_ENUMPROC, - DWORD, LONG_PTR); -static EnumSystemLanguageGroupsAFn pEnumSystemLanguageGroupsA; -typedef BOOL (WINAPI *EnumLanguageGroupLocalesAFn)(LANGGROUPLOCALE_ENUMPROC, - LGRPID, DWORD, LONG_PTR); -static EnumLanguageGroupLocalesAFn pEnumLanguageGroupLocalesA; - -typedef INT (WINAPI *FoldStringAFn)(DWORD, LPCSTR, INT, LPSTR, INT); -static FoldStringAFn pFoldStringA; -typedef INT (WINAPI *FoldStringWFn)(DWORD, LPCWSTR, INT, LPWSTR, INT); -static FoldStringWFn pFoldStringW; - -typedef BOOL (WINAPI *IsValidLanguageGroupFn)(LGRPID, DWORD); -static IsValidLanguageGroupFn pIsValidLanguageGroup; - -static void InitFunctionPointers(void) -{ - hKernel32 = GetModuleHandleA("kernel32"); - - if (hKernel32) - { - pEnumSystemLanguageGroupsA = (void*)GetProcAddress(hKernel32, "EnumSystemLanguageGroupsA"); - pEnumLanguageGroupLocalesA = (void*)GetProcAddress(hKernel32, "EnumLanguageGroupLocalesA"); - pFoldStringA = (void*)GetProcAddress(hKernel32, "FoldStringA"); - pFoldStringW = (void*)GetProcAddress(hKernel32, "FoldStringW"); - pIsValidLanguageGroup = (void*)GetProcAddress(hKernel32, "IsValidLanguageGroup"); - } -} - -#define eq(received, expected, label, type) \ - ok((received) == (expected), "%s: got " type " instead of " type "\n", \ - (label), (received), (expected)) - -#define BUFFER_SIZE 128 -char GlobalBuffer[BUFFER_SIZE]; /* Buffer used by callback function */ -#define COUNTOF(x) (sizeof(x)/sizeof(x)[0]) - -#define EXPECT_LEN(len) ok(ret == (len), "Expected Len %d, got %d\n", (len), ret) -#define EXPECT_INVALID ok(GetLastError() == ERROR_INVALID_PARAMETER, \ - "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError()) -#define EXPECT_BUFFER ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, \ - "Expected ERROR_INSUFFICIENT_BUFFER, got %ld\n", GetLastError()) -#define EXPECT_FLAGS ok(GetLastError() == ERROR_INVALID_FLAGS, \ - "Expected ERROR_INVALID_FLAGS, got %ld\n", GetLastError()) -#define EXPECT_INVALIDFLAGS ok(GetLastError() == ERROR_INVALID_FLAGS || \ - GetLastError() == ERROR_INVALID_PARAMETER, \ - "Expected ERROR_INVALID_FLAGS, got %ld\n", GetLastError()) -#define EXPECT_VALID ok(GetLastError() == 0, \ - "Expected GetLastError() == 0, got %ld\n", GetLastError()) - -#define STRINGSA(x,y) strcpy(input, x); strcpy(Expected, y); SetLastError(0); buffer[0] = '\0' -#define EXPECT_LENA EXPECT_LEN((int)strlen(Expected)+1) -#define EXPECT_EQA ok(strncmp(buffer, Expected, strlen(Expected)) == 0, \ - "Expected '%s', got '%s'\n", Expected, buffer) - -#define STRINGSW(x,y) MultiByteToWideChar(CP_ACP,0,x,-1,input,COUNTOF(input)); \ - MultiByteToWideChar(CP_ACP,0,y,-1,Expected,COUNTOF(Expected)); \ - SetLastError(0); buffer[0] = '\0' -#define EXPECT_LENW EXPECT_LEN((int)strlenW(Expected)+1) -#define EXPECT_EQW ok(strncmpW(buffer, Expected, strlenW(Expected)) == 0, "Bad conversion\n") - -#define NUO LOCALE_NOUSEROVERRIDE - -static void test_GetLocaleInfoA() -{ - int ret; - LCID lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT); - char buffer[BUFFER_SIZE]; - - ok(lcid == 0x409, "wrong LCID calculated - %ld\n", lcid); - - /* HTMLKit and "Font xplorer lite" expect GetLocaleInfoA to - * partially fill the buffer even if it is too short. See bug 637. - */ - SetLastError(0); memset(buffer, 0, COUNTOF(buffer)); - ret = GetLocaleInfoA(lcid, NUO|LOCALE_SDAYNAME1, buffer, 0); - ok(ret == 7 && !buffer[0], "Expected len=7, got %d\n", ret); - - SetLastError(0); memset(buffer, 0, COUNTOF(buffer)); - ret = GetLocaleInfoA(lcid, NUO|LOCALE_SDAYNAME1, buffer, 3); - EXPECT_BUFFER; EXPECT_LEN(0); - ok(!strcmp(buffer, "Mon"), "Expected 'Mon', got '%s'\n", buffer); - - SetLastError(0); memset(buffer, 0, COUNTOF(buffer)); - ret = GetLocaleInfoA(lcid, NUO|LOCALE_SDAYNAME1, buffer, 10); - EXPECT_VALID; EXPECT_LEN(7); - ok(!strcmp(buffer, "Monday"), "Expected 'Monday', got '%s'\n", buffer); -} - -static void test_GetTimeFormatA() -{ - int ret; - SYSTEMTIME curtime; - LCID lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT); - char buffer[BUFFER_SIZE], input[BUFFER_SIZE], Expected[BUFFER_SIZE]; - - memset(&curtime, 2, sizeof(SYSTEMTIME)); - STRINGSA("tt HH':'mm'@'ss", ""); /* Invalid time */ - ret = GetTimeFormatA(lcid, TIME_FORCE24HOURFORMAT, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_INVALID; EXPECT_LEN(0); EXPECT_EQA; - - curtime.wHour = 8; - curtime.wMinute = 56; - curtime.wSecond = 13; - curtime.wMilliseconds = 22; - STRINGSA("tt HH':'mm'@'ss", "AM 08:56@13"); /* Valid time */ - ret = GetTimeFormatA(lcid, TIME_FORCE24HOURFORMAT, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("tt HH':'mm'@'ss", "A"); /* Insufficent buffer */ - ret = GetTimeFormatA(lcid, TIME_FORCE24HOURFORMAT, &curtime, input, buffer, 2); - EXPECT_BUFFER; EXPECT_LEN(0); EXPECT_EQA; - - STRINGSA("tt HH':'mm'@'ss", "AM 08:56@13"); /* Calculate length only */ - ret = GetTimeFormatA(lcid, TIME_FORCE24HOURFORMAT, &curtime, input, NULL, 0); - EXPECT_VALID; EXPECT_LENA; - - STRINGSA("", "8 AM"); /* TIME_NOMINUTESORSECONDS, default format */ - ret = GetTimeFormatA(lcid, NUO|TIME_NOMINUTESORSECONDS, &curtime, NULL, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("m1s2m3s4", ""); /* TIME_NOMINUTESORSECONDS/complex format */ - ret = GetTimeFormatA(lcid, TIME_NOMINUTESORSECONDS, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("", "8:56 AM"); /* TIME_NOSECONDS/Default format */ - ret = GetTimeFormatA(lcid, NUO|TIME_NOSECONDS, &curtime, NULL, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("h:m:s tt", "8:56 AM"); /* TIME_NOSECONDS */ - strcpy(Expected, "8:56 AM"); - ret = GetTimeFormatA(lcid, TIME_NOSECONDS, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("h.@:m.@:s.@:tt", "8.@:56AM"); /* Multiple delimiters */ - ret = GetTimeFormatA(lcid, TIME_NOSECONDS, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("s1s2s3", ""); /* Duplicate tokens */ - ret = GetTimeFormatA(lcid, TIME_NOSECONDS, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("t/tt", "A/AM"); /* AM time marker */ - ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - curtime.wHour = 13; - STRINGSA("t/tt", "P/PM"); /* PM time marker */ - ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("h1t2tt3m", "156"); /* TIME_NOTIMEMARKER: removes text around time marker token */ - ret = GetTimeFormatA(lcid, TIME_NOTIMEMARKER, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("h:m:s tt", "13:56:13 PM"); /* TIME_FORCE24HOURFORMAT */ - ret = GetTimeFormatA(lcid, TIME_FORCE24HOURFORMAT, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("h:m:s", "13:56:13"); /* TIME_FORCE24HOURFORMAT doesn't add time marker */ - ret = GetTimeFormatA(lcid, TIME_FORCE24HOURFORMAT, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - curtime.wHour = 14; /* change this to 14 or 2pm */ - curtime.wMinute = 5; - curtime.wSecond = 3; - STRINGSA("h hh H HH m mm s ss t tt", "2 02 14 14 5 05 3 03 P PM"); /* 24 hrs, leading 0 */ - ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - curtime.wHour = 0; - STRINGSA("h/H/hh/HH", "12/0/12/00"); /* "hh" and "HH" */ - ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("h:m:s tt", "12:5:3 AM"); /* non-zero flags should fail with format, doesn't */ - ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - /* try to convert formatting strings with more than two letters - * "h:hh:hhh:H:HH:HHH:m:mm:mmm:M:MM:MMM:s:ss:sss:S:SS:SSS" - * NOTE: We expect any letter for which there is an upper case value - * we should see a replacement. For letters that DO NOT have - * upper case values we should see NO REPLACEMENT. - */ - curtime.wHour = 8; - curtime.wMinute = 56; - curtime.wSecond = 13; - curtime.wMilliseconds = 22; - STRINGSA("h:hh:hhh H:HH:HHH m:mm:mmm M:MM:MMM s:ss:sss S:SS:SSS", - "8:08:08 8:08:08 56:56:56 M:MM:MMM 13:13:13 S:SS:SSS"); - ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("h", "text"); /* Don't write to buffer if len is 0 */ - strcpy(buffer, "text"); - ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, 0); - EXPECT_VALID; EXPECT_LEN(2); EXPECT_EQA; - - STRINGSA("h 'h' H 'H' HH 'HH' m 'm' s 's' t 't' tt 'tt'", - "8 h 8 H 08 HH 56 m 13 s A t AM tt"); /* "'" preserves tokens */ - ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("'''", "'"); /* invalid quoted string */ - ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - /* test that msdn suggested single quotation usage works as expected */ - STRINGSA("''''", "'"); /* single quote mark */ - ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("''HHHHHH", "08"); /* Normal use */ - ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - /* and test for normal use of the single quotation mark */ - STRINGSA("'''HHHHHH'", "'HHHHHH"); /* Normal use */ - ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("'''HHHHHH", "'HHHHHH"); /* Odd use */ - ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("'123'tt", ""); /* TIME_NOTIMEMARKER drops literals too */ - ret = GetTimeFormatA(lcid, TIME_NOTIMEMARKER, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - curtime.wHour = 25; - STRINGSA("'123'tt", ""); /* Invalid time */ - ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_INVALID; EXPECT_LEN(0); EXPECT_EQA; - - curtime.wHour = 12; - curtime.wMonth = 60; /* Invalid */ - STRINGSA("h:m:s", "12:56:13"); /* Invalid date */ - ret = GetTimeFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; -} - -static void test_GetDateFormatA() -{ - int ret; - SYSTEMTIME curtime; - LCID lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT); - char buffer[BUFFER_SIZE], input[BUFFER_SIZE], Expected[BUFFER_SIZE]; - - memset(&curtime, 2, sizeof(SYSTEMTIME)); /* Invalid time */ - STRINGSA("ddd',' MMM dd yy",""); - ret = GetDateFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_INVALID; EXPECT_LEN(0); EXPECT_EQA; - - curtime.wYear = 2002; - curtime.wMonth = 5; - curtime.wDay = 4; - curtime.wDayOfWeek = 3; - STRINGSA("ddd',' MMM dd yy","Sat, May 04 02"); /* Simple case */ - ret = GetDateFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("ddd',' MMM dd yy","Sat, May 04 02"); /* Format containing "'" */ - ret = GetDateFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - curtime.wHour = 36; /* Invalid */ - STRINGSA("ddd',' MMM dd ''''yy","Sat, May 04 '02"); /* Invalid time */ - ret = GetDateFormatA(lcid, 0, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("ddd',' MMM dd ''''yy",""); /* Get size only */ - ret = GetDateFormatA(lcid, 0, &curtime, input, NULL, 0); - EXPECT_VALID; EXPECT_LEN(16); EXPECT_EQA; - - STRINGSA("ddd',' MMM dd ''''yy",""); /* Buffer too small */ - ret = GetDateFormatA(lcid, 0, &curtime, input, buffer, 2); - EXPECT_BUFFER; EXPECT_LEN(0); EXPECT_EQA; - - STRINGSA("ddd',' MMM dd ''''yy","5/4/2002"); /* Default to DATE_SHORTDATE */ - ret = GetDateFormat(lcid, NUO, &curtime, NULL, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("ddd',' MMM dd ''''yy", "Saturday, May 04, 2002"); /* DATE_LONGDATE */ - ret = GetDateFormat(lcid, NUO|DATE_LONGDATE, &curtime, NULL, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - /* test for expected DATE_YEARMONTH behavior with null format */ - /* NT4 returns ERROR_INVALID_FLAGS for DATE_YEARMONTH */ - STRINGSA("ddd',' MMM dd ''''yy", ""); /* DATE_YEARMONTH */ - ret = GetDateFormat(lcid, NUO|DATE_YEARMONTH, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_FLAGS; EXPECT_LEN(0); EXPECT_EQA; - - /* Test that using invalid DATE_* flags results in the correct error */ - /* and return values */ - STRINGSA("m/d/y", ""); /* Invalid flags */ - ret = GetDateFormat(lcid, DATE_YEARMONTH|DATE_SHORTDATE|DATE_LONGDATE, - &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_FLAGS; EXPECT_LEN(0); EXPECT_EQA; -} - -static void test_GetDateFormatW() -{ - int ret; - SYSTEMTIME curtime; - WCHAR buffer[BUFFER_SIZE], input[BUFFER_SIZE], Expected[BUFFER_SIZE]; - LCID lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT); - - STRINGSW("",""); /* If flags is not zero then format must be NULL */ - ret = GetDateFormatW(LOCALE_SYSTEM_DEFAULT, DATE_LONGDATE, NULL, - input, buffer, COUNTOF(buffer)); - if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - return; - EXPECT_FLAGS; EXPECT_LEN(0); EXPECT_EQW; - - STRINGSW("",""); /* NULL buffer, len > 0 */ - ret = GetDateFormatW (lcid, 0, NULL, input, NULL, COUNTOF(buffer)); - EXPECT_INVALID; EXPECT_LEN(0); EXPECT_EQW; - - STRINGSW("",""); /* NULL buffer, len == 0 */ - ret = GetDateFormatW (lcid, 0, NULL, input, NULL, 0); - EXPECT_VALID; EXPECT_LENW; EXPECT_EQW; - - curtime.wYear = 2002; - curtime.wMonth = 10; - curtime.wDay = 23; - curtime.wDayOfWeek = 45612; /* Should be 3 - Wednesday */ - curtime.wHour = 65432; /* Invalid */ - curtime.wMinute = 34512; /* Invalid */ - curtime.wSecond = 65535; /* Invalid */ - curtime.wMilliseconds = 12345; - STRINGSW("dddd d MMMM yyyy","Wednesday 23 October 2002"); /* Incorrect DOW and time */ - ret = GetDateFormatW (lcid, 0, &curtime, input, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENW; EXPECT_EQW; -} - - -#define CY_POS_LEFT 0 -#define CY_POS_RIGHT 1 -#define CY_POS_LEFT_SPACE 2 -#define CY_POS_RIGHT_SPACE 3 - -static void test_GetCurrencyFormatA() -{ - static char szDot[] = { '.', '\0' }; - static char szComma[] = { ',', '\0' }; - static char szDollar[] = { '$', '\0' }; - int ret; - LCID lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT); - char buffer[BUFFER_SIZE], Expected[BUFFER_SIZE], input[BUFFER_SIZE]; - CURRENCYFMTA format; - - memset(&format, 0, sizeof(format)); - - STRINGSA("23",""); /* NULL output, length > 0 --> Error */ - ret = GetCurrencyFormatA(lcid, 0, input, NULL, NULL, COUNTOF(buffer)); - EXPECT_INVALID; EXPECT_LEN(0); EXPECT_EQA; - - STRINGSA("23,53",""); /* Invalid character --> Error */ - ret = GetCurrencyFormatA(lcid, 0, input, NULL, buffer, COUNTOF(buffer)); - EXPECT_INVALID; EXPECT_LEN(0); EXPECT_EQA; - - STRINGSA("--",""); /* Double '-' --> Error */ - ret = GetCurrencyFormatA(lcid, 0, input, NULL, buffer, COUNTOF(buffer)); - EXPECT_INVALID; EXPECT_LEN(0); EXPECT_EQA; - - STRINGSA("0-",""); /* Trailing '-' --> Error */ - ret = GetCurrencyFormatA(lcid, 0, input, NULL, buffer, COUNTOF(buffer)); - EXPECT_INVALID; EXPECT_LEN(0); EXPECT_EQA; - - STRINGSA("0..",""); /* Double '.' --> Error */ - ret = GetCurrencyFormatA(lcid, 0, input, NULL, buffer, COUNTOF(buffer)); - EXPECT_INVALID; EXPECT_LEN(0); EXPECT_EQA; - - STRINGSA(" 0.1",""); /* Leading space --> Error */ - ret = GetCurrencyFormatA(lcid, 0, input, NULL, buffer, COUNTOF(buffer)); - EXPECT_INVALID; EXPECT_LEN(0); EXPECT_EQA; - - STRINGSA("1234","$"); /* Length too small --> Write up to length chars */ - ret = GetCurrencyFormatA(lcid, NUO, input, NULL, buffer, 2); - EXPECT_BUFFER; EXPECT_LEN(0); EXPECT_EQA; - - STRINGSA("2353",""); /* Format and flags given --> Error */ - ret = GetCurrencyFormatA(lcid, NUO, input, &format, buffer, COUNTOF(buffer)); - EXPECT_INVALIDFLAGS; EXPECT_LEN(0); EXPECT_EQA; - - STRINGSA("2353",""); /* Invalid format --> Error */ - ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_INVALID; EXPECT_LEN(0); EXPECT_EQA; - - STRINGSA("2353","$2,353.00"); /* Valid number */ - ret = GetCurrencyFormatA(lcid, NUO, input, NULL, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("-2353","($2,353.00)"); /* Valid negative number */ - ret = GetCurrencyFormatA(lcid, NUO, input, NULL, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("2353.1","$2,353.10"); /* Valid real number */ - ret = GetCurrencyFormatA(lcid, NUO, input, NULL, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("2353.111","$2,353.11"); /* Too many DP --> Truncated */ - ret = GetCurrencyFormatA(lcid, NUO, input, NULL, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("2353.119","$2,353.12"); /* Too many DP --> Rounded */ - ret = GetCurrencyFormatA(lcid, NUO, input, NULL, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.NumDigits = 0; /* No decimal separator */ - format.LeadingZero = 0; - format.Grouping = 0; /* No grouping char */ - format.NegativeOrder = 0; - format.PositiveOrder = CY_POS_LEFT; - format.lpDecimalSep = szDot; - format.lpThousandSep = szComma; - format.lpCurrencySymbol = szDollar; - - STRINGSA("2353","$2353"); /* No decimal or grouping chars expected */ - ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.NumDigits = 1; /* 1 DP --> Expect decimal separator */ - STRINGSA("2353","$2353.0"); - ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.Grouping = 2; /* Group by 100's */ - STRINGSA("2353","$23,53.0"); - ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.LeadingZero = 1; /* Always provide leading zero */ - STRINGSA(".5","$0.5"); - ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.PositiveOrder = CY_POS_RIGHT; - STRINGSA("1","1.0$"); - ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.PositiveOrder = CY_POS_LEFT_SPACE; - STRINGSA("1","$ 1.0"); - ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.PositiveOrder = CY_POS_RIGHT_SPACE; - STRINGSA("1","1.0 $"); - ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.NegativeOrder = 0; - STRINGSA("-1","($1.0)"); - ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.NegativeOrder = 1; - STRINGSA("-1","-$1.0"); - ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.NegativeOrder = 2; - STRINGSA("-1","$-1.0"); - ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.NegativeOrder = 3; - STRINGSA("-1","$1.0-"); - ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.NegativeOrder = 4; - STRINGSA("-1","(1.0$)"); - ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.NegativeOrder = 5; - STRINGSA("-1","-1.0$"); - ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.NegativeOrder = 6; - STRINGSA("-1","1.0-$"); - ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.NegativeOrder = 7; - STRINGSA("-1","1.0$-"); - ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.NegativeOrder = 8; - STRINGSA("-1","-1.0 $"); - ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.NegativeOrder = 9; - STRINGSA("-1","-$ 1.0"); - ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.NegativeOrder = 10; - STRINGSA("-1","1.0 $-"); - ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.NegativeOrder = 11; - STRINGSA("-1","$ 1.0-"); - ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.NegativeOrder = 12; - STRINGSA("-1","$ -1.0"); - ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.NegativeOrder = 13; - STRINGSA("-1","1.0- $"); - ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.NegativeOrder = 14; - STRINGSA("-1","($ 1.0)"); - ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.NegativeOrder = 15; - STRINGSA("-1","(1.0 $)"); - ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; -} - -#define NEG_PARENS 0 /* "(1.1)" */ -#define NEG_LEFT 1 /* "-1.1" */ -#define NEG_LEFT_SPACE 2 /* "- 1.1" */ -#define NEG_RIGHT 3 /* "1.1-" */ -#define NEG_RIGHT_SPACE 4 /* "1.1 -" */ - -static void test_GetNumberFormatA() -{ - static char szDot[] = { '.', '\0' }; - static char szComma[] = { ',', '\0' }; - int ret; - LCID lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT); - char buffer[BUFFER_SIZE], Expected[BUFFER_SIZE], input[BUFFER_SIZE]; - NUMBERFMTA format; - - memset(&format, 0, sizeof(format)); - - STRINGSA("23",""); /* NULL output, length > 0 --> Error */ - ret = GetNumberFormatA(lcid, 0, input, NULL, NULL, COUNTOF(buffer)); - EXPECT_INVALID; EXPECT_LEN(0); EXPECT_EQA; - - STRINGSA("23,53",""); /* Invalid character --> Error */ - ret = GetNumberFormatA(lcid, 0, input, NULL, buffer, COUNTOF(buffer)); - EXPECT_INVALID; EXPECT_LEN(0); EXPECT_EQA; - - STRINGSA("--",""); /* Double '-' --> Error */ - ret = GetNumberFormatA(lcid, 0, input, NULL, buffer, COUNTOF(buffer)); - EXPECT_INVALID; EXPECT_LEN(0); EXPECT_EQA; - - STRINGSA("0-",""); /* Trailing '-' --> Error */ - ret = GetNumberFormatA(lcid, 0, input, NULL, buffer, COUNTOF(buffer)); - EXPECT_INVALID; EXPECT_LEN(0); EXPECT_EQA; - - STRINGSA("0..",""); /* Double '.' --> Error */ - ret = GetNumberFormatA(lcid, 0, input, NULL, buffer, COUNTOF(buffer)); - EXPECT_INVALID; EXPECT_LEN(0); EXPECT_EQA; - - STRINGSA(" 0.1",""); /* Leading space --> Error */ - ret = GetNumberFormatA(lcid, 0, input, NULL, buffer, COUNTOF(buffer)); - EXPECT_INVALID; EXPECT_LEN(0); EXPECT_EQA; - - STRINGSA("1234","1"); /* Length too small --> Write up to length chars */ - ret = GetNumberFormatA(lcid, NUO, input, NULL, buffer, 2); - EXPECT_BUFFER; EXPECT_LEN(0); EXPECT_EQA; - - STRINGSA("2353",""); /* Format and flags given --> Error */ - ret = GetNumberFormatA(lcid, NUO, input, &format, buffer, COUNTOF(buffer)); - EXPECT_INVALIDFLAGS; EXPECT_LEN(0); EXPECT_EQA; - - STRINGSA("2353",""); /* Invalid format --> Error */ - ret = GetNumberFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_INVALID; EXPECT_LEN(0); EXPECT_EQA; - - STRINGSA("2353","2,353.00"); /* Valid number */ - ret = GetNumberFormatA(lcid, NUO, input, NULL, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("-2353","-2,353.00"); /* Valid negative number */ - ret = GetNumberFormatA(lcid, NUO, input, NULL, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("-353","-353.00"); /* test for off by one error in grouping */ - ret = GetNumberFormatA(lcid, NUO, input, NULL, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("2353.1","2,353.10"); /* Valid real number */ - ret = GetNumberFormatA(lcid, NUO, input, NULL, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("2353.111","2,353.11"); /* Too many DP --> Truncated */ - ret = GetNumberFormatA(lcid, NUO, input, NULL, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - STRINGSA("2353.119","2,353.12"); /* Too many DP --> Rounded */ - ret = GetNumberFormatA(lcid, NUO, input, NULL, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.NumDigits = 0; /* No decimal separator */ - format.LeadingZero = 0; - format.Grouping = 0; /* No grouping char */ - format.NegativeOrder = 0; - format.lpDecimalSep = szDot; - format.lpThousandSep = szComma; - - STRINGSA("2353","2353"); /* No decimal or grouping chars expected */ - ret = GetNumberFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.NumDigits = 1; /* 1 DP --> Expect decimal separator */ - STRINGSA("2353","2353.0"); - ret = GetNumberFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.Grouping = 2; /* Group by 100's */ - STRINGSA("2353","23,53.0"); - ret = GetNumberFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.LeadingZero = 1; /* Always provide leading zero */ - STRINGSA(".5","0.5"); - ret = GetNumberFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.NegativeOrder = NEG_PARENS; - STRINGSA("-1","(1.0)"); - ret = GetNumberFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.NegativeOrder = NEG_LEFT; - STRINGSA("-1","-1.0"); - ret = GetNumberFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.NegativeOrder = NEG_LEFT_SPACE; - STRINGSA("-1","- 1.0"); - ret = GetNumberFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.NegativeOrder = NEG_RIGHT; - STRINGSA("-1","1.0-"); - ret = GetNumberFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - format.NegativeOrder = NEG_RIGHT_SPACE; - STRINGSA("-1","1.0 -"); - ret = GetNumberFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - - lcid = MAKELCID(MAKELANGID(LANG_FRENCH, SUBLANG_DEFAULT), SORT_DEFAULT); - - if (IsValidLocale(lcid, 0)) - { - STRINGSA("-12345","-12 345,00"); /* Try French formatting */ - Expected[3] = 160; /* Non breaking space */ - ret = GetNumberFormatA(lcid, NUO, input, NULL, buffer, COUNTOF(buffer)); - EXPECT_VALID; EXPECT_LENA; EXPECT_EQA; - } -} - - -/* Callback function used by TestEnumTimeFormats */ -static BOOL CALLBACK EnumTimeFormatsProc(char * lpTimeFormatString) -{ - trace("%s\n", lpTimeFormatString); - strcpy(GlobalBuffer, lpTimeFormatString); -#if 0 - return TRUE; -#endif - return FALSE; -} - -void test_EnumTimeFormats() -{ - int ret; - LCID lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT); - - GlobalBuffer[0] = '\0'; - ret = EnumTimeFormatsA(EnumTimeFormatsProc, lcid, 0); - ok (ret == 1 && !strcmp(GlobalBuffer,"h:mm:ss tt"), "Expected %d '%s'\n", ret, GlobalBuffer); -} - -static void test_CompareStringA() -{ - int ret; - LCID lcid = MAKELCID(MAKELANGID(LANG_FRENCH, SUBLANG_DEFAULT), SORT_DEFAULT); - - ret = CompareStringA(lcid, NORM_IGNORECASE, "Salut", -1, "Salute", -1); - ok (ret== 1, "(Salut/Salute) Expected 1, got %d\n", ret); - - ret = CompareStringA(lcid, NORM_IGNORECASE, "Salut", -1, "SaLuT", -1); - ok (ret== 2, "(Salut/SaLuT) Expected 2, got %d\n", ret); - - ret = CompareStringA(lcid, NORM_IGNORECASE, "Salut", -1, "hola", -1); - ok (ret== 3, "(Salut/hola) Expected 3, got %d\n", ret); - - ret = CompareStringA(lcid, NORM_IGNORECASE, "haha", -1, "hoho", -1); - ok (ret== 1, "(haha/hoho) Expected 1, got %d\n", ret); - - lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT); - - ret = CompareStringA(lcid, NORM_IGNORECASE, "haha", -1, "hoho", -1); - ok (ret== 1, "(haha/hoho) Expected 1, got %d\n", ret); - - ret = CompareStringA(lcid, NORM_IGNORECASE, "haha", -1, "hoho", 0); - ok (ret== 3, "(haha/hoho) Expected 3, got %d\n", ret); - - ret = CompareStringA(lcid, NORM_IGNORECASE, "Salut", 5, "saLuT", -1); - ok (ret == 2, "(Salut/saLuT) Expected 2, got %d\n", ret); - - SetLastError(0xdeadbeef); - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0x10, "NULL", -1, "NULL", -1); - ok(GetLastError() == ERROR_INVALID_FLAGS, - "unexpected error code %ld\n", GetLastError()); - ok(!ret, "CompareStringA must fail with invalid flag\n"); - - ret = lstrcmpA("", ""); - ok (ret == 0, "lstrcmpA(\"\", \"\") should return 0, got %d\n", ret); - - ret = lstrcmpA(NULL, NULL); - ok (ret == 0, "lstrcmpA(NULL, NULL) should return 0, got %d\n", ret); - - ret = lstrcmpA("", NULL); - ok (ret == 1, "lstrcmpA(\"\", NULL) should return 1, got %d\n", ret); - - ret = lstrcmpA(NULL, ""); - ok (ret == -1, "lstrcmpA(NULL, \"\") should return -1, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT,0,"EndDialog",-1,"_Property",-1); - ok( ret == 3, "EndDialog vs _Property ... expected 3, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT,0,"osp_vba.sreg0070",-1,"_IEWWBrowserComp",-1); - ok( ret == 3, "osp_vba.sreg0070 vs _IEWWBrowserComp ... expected 3, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT,0,"r",-1,"\\",-1); - ok( ret == 3, "r vs \\ ... expected 3, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT,0,"osp_vba.sreg0031", -1, "OriginalDatabase", -1 ); - ok( ret == 3, "osp_vba.sreg0031 vs OriginalDatabase ... expected 3, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "AAA", -1, "aaa", -1 ); - ok( ret == 3, "AAA vs aaa expected 3, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "AAA", -1, "aab", -1 ); - ok( ret == 1, "AAA vs aab expected 1, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "AAA", -1, "Aab", -1 ); - ok( ret == 1, "AAA vs Aab expected 1, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, ".AAA", -1, "Aab", -1 ); - ok( ret == 1, ".AAA vs Aab expected 1, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, ".AAA", -1, "A.ab", -1 ); - ok( ret == 1, ".AAA vs A.ab expected 1, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "aa", -1, "AB", -1 ); - ok( ret == 1, "aa vs AB expected 1, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "aa", -1, "Aab", -1 ); - ok( ret == 1, "aa vs Aab expected 1, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "aB", -1, "Aab", -1 ); - ok( ret == 3, "aB vs Aab expected 3, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "Ba", -1, "bab", -1 ); - ok( ret == 1, "Ba vs bab expected 1, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "{100}{83}{71}{71}{71}", -1, "Global_DataAccess_JRO", -1 ); - ok( ret == 1, "{100}{83}{71}{71}{71} vs Global_DataAccess_JRO expected 1, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "a", -1, "{", -1 ); - ok( ret == 3, "a vs { expected 3, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "A", -1, "{", -1 ); - ok( ret == 3, "A vs { expected 3, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "3.5", 0, "4.0", -1 ); - ok(ret == 1, "3.5/0 vs 4.0/-1 expected 1, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "3.5", -1, "4.0", -1 ); - ok(ret == 1, "3.5 vs 4.0 expected 1, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "3.520.4403.2", -1, "4.0.2927.10", -1 ); - ok(ret == 1, "3.520.4403.2 vs 4.0.2927.10 expected 1, got %d\n", ret); - - /* hyphen and apostrophe are treated differently depending on - * whether SORT_STRINGSORT specified or not - */ - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "-o", -1, "/m", -1 ); - ok(ret == 3, "-o vs /m expected 3, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "/m", -1, "-o", -1 ); - ok(ret == 1, "/m vs -o expected 1, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, SORT_STRINGSORT, "-o", -1, "/m", -1 ); - ok(ret == 1, "-o vs /m expected 1, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, SORT_STRINGSORT, "/m", -1, "-o", -1 ); - ok(ret == 3, "/m vs -o expected 3, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "'o", -1, "/m", -1 ); - ok(ret == 3, "'o vs /m expected 3, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "/m", -1, "'o", -1 ); - ok(ret == 1, "/m vs 'o expected 1, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, SORT_STRINGSORT, "'o", -1, "/m", -1 ); - ok(ret == 1, "'o vs /m expected 1, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, SORT_STRINGSORT, "/m", -1, "'o", -1 ); - ok(ret == 3, "/m vs 'o expected 3, got %d\n", ret); - -#if 0 /* this requires collation table patch to make it MS compatible */ - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "'o", -1, "-o", -1 ); - ok(ret == 1, "'o vs -o expected 1, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, SORT_STRINGSORT, "'o", -1, "-o", -1 ); - ok(ret == 1, "'o vs -o expected 1, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "'", -1, "-", -1 ); - ok(ret == 1, "' vs - expected 1, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, SORT_STRINGSORT, "'", -1, "-", -1 ); - ok(ret == 1, "' vs - expected 1, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "`o", -1, "/m", -1 ); - ok(ret == 3, "`o vs /m expected 3, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "/m", -1, "`o", -1 ); - ok(ret == 1, "/m vs `o expected 1, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, SORT_STRINGSORT, "`o", -1, "/m", -1 ); - ok(ret == 3, "`o vs /m expected 3, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, SORT_STRINGSORT, "/m", -1, "`o", -1 ); - ok(ret == 1, "/m vs `o expected 1, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "`o", -1, "-m", -1 ); - ok(ret == 1, "`o vs -m expected 1, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, 0, "-m", -1, "`o", -1 ); - ok(ret == 3, "-m vs `o expected 3, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, SORT_STRINGSORT, "`o", -1, "-m", -1 ); - ok(ret == 3, "`o vs -m expected 3, got %d\n", ret); - - ret = CompareStringA(LOCALE_SYSTEM_DEFAULT, SORT_STRINGSORT, "-m", -1, "`o", -1 ); - ok(ret == 1, "-m vs `o expected 1, got %d\n", ret); -#endif - - ret = CompareStringA(LOCALE_USER_DEFAULT, 0, "aLuZkUtZ", 8, "aLuZkUtZ", 9); - ok(ret == 2, "aLuZkUtZ vs aLuZkUtZ\\0 expected 2, got %d\n", ret); - - ret = CompareStringA(LOCALE_USER_DEFAULT, 0, "aLuZkUtZ", 7, "aLuZkUtZ\0A", 10); - ok(ret == 1, "aLuZkUtZ vs aLuZkUtZ\\0A expected 1, got %d\n", ret); - - ret = CompareStringA(LOCALE_USER_DEFAULT, 0, "aLuZkUtZ", 8, "aLuZkUtZ\0A", 10); - ok(ret == 2, "aLuZkUtZ vs aLuZkUtZ\\0A expected 2, got %d\n", ret); - - ret = CompareStringA(LOCALE_USER_DEFAULT, 0, "aLu\0ZkUtZ", 8, "aLu\0ZkUtZ\0A", 10); - ok(ret == 2, "aLu\\0ZkUtZ vs aLu\\0ZkUtZ\\0A expected 2, got %d\n", ret); -} - -void test_LCMapStringA(void) -{ - int ret, ret2; - char buf[256], buf2[256]; - static const char upper_case[] = "\tJUST! A, TEST; STRING 1/*+-.\r\n"; - static const char lower_case[] = "\tjust! a, test; string 1/*+-.\r\n"; - static const char symbols_stripped[] = "justateststring1"; - - ret = LCMapStringA(LOCALE_USER_DEFAULT, LCMAP_LOWERCASE | LCMAP_UPPERCASE, - upper_case, -1, buf, sizeof(buf)); - ok(!ret, "LCMAP_LOWERCASE and LCMAP_UPPERCASE are mutually exclusive\n"); - ok(GetLastError() == ERROR_INVALID_FLAGS, - "unexpected error code %ld\n", GetLastError()); - - ret = LCMapStringA(LOCALE_USER_DEFAULT, LCMAP_HIRAGANA | LCMAP_KATAKANA, - upper_case, -1, buf, sizeof(buf)); - ok(!ret, "LCMAP_HIRAGANA and LCMAP_KATAKANA are mutually exclusive\n"); - ok(GetLastError() == ERROR_INVALID_FLAGS, - "unexpected error code %ld\n", GetLastError()); - - ret = LCMapStringA(LOCALE_USER_DEFAULT, LCMAP_HALFWIDTH | LCMAP_FULLWIDTH, - - upper_case, -1, buf, sizeof(buf)); - ok(!ret, "LCMAP_HALFWIDTH | LCMAP_FULLWIDTH are mutually exclusive\n"); - ok(GetLastError() == ERROR_INVALID_FLAGS, - "unexpected error code %ld\n", GetLastError()); - - ret = LCMapStringA(LOCALE_USER_DEFAULT, LCMAP_TRADITIONAL_CHINESE | LCMAP_SIMPLIFIED_CHINESE, - upper_case, -1, buf, sizeof(buf)); - ok(!ret, "LCMAP_TRADITIONAL_CHINESE and LCMAP_SIMPLIFIED_CHINESE are mutually exclusive\n"); - ok(GetLastError() == ERROR_INVALID_FLAGS, - "unexpected error code %ld\n", GetLastError()); - - /* SORT_STRINGSORT must be used exclusively with LCMAP_SORTKEY */ - SetLastError(0xdeadbeef); - ret = LCMapStringA(LOCALE_USER_DEFAULT, LCMAP_LOWERCASE | SORT_STRINGSORT, - upper_case, -1, buf, sizeof(buf)); - ok(GetLastError() == ERROR_INVALID_FLAGS, "expected ERROR_INVALID_FLAGS, got %ld\n", GetLastError()); - ok(!ret, "SORT_STRINGSORT without LCMAP_SORTKEY must fail\n"); - - /* test LCMAP_LOWERCASE */ - ret = LCMapStringA(LOCALE_USER_DEFAULT, LCMAP_LOWERCASE, - upper_case, -1, buf, sizeof(buf)); - ok(ret == lstrlenA(upper_case) + 1, - "ret %d, error %ld, expected value %d\n", - ret, GetLastError(), lstrlenA(upper_case) + 1); - ok(!lstrcmpA(buf, lower_case), "LCMapStringA should return %s, but not %s\n", lower_case, buf); - - /* test LCMAP_UPPERCASE */ - ret = LCMapStringA(LOCALE_USER_DEFAULT, LCMAP_UPPERCASE, - lower_case, -1, buf, sizeof(buf)); - ok(ret == lstrlenA(lower_case) + 1, - "ret %d, error %ld, expected value %d\n", - ret, GetLastError(), lstrlenA(lower_case) + 1); - ok(!lstrcmpA(buf, upper_case), "LCMapStringA should return %s, but not %s\n", upper_case, buf); - - /* test buffer overflow */ - SetLastError(0xdeadbeef); - ret = LCMapStringA(LOCALE_USER_DEFAULT, LCMAP_UPPERCASE, - lower_case, -1, buf, 4); - ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, - "should return 0 and ERROR_INSUFFICIENT_BUFFER, got %d\n", ret); - - /* LCMAP_UPPERCASE or LCMAP_LOWERCASE should accept src == dst */ - lstrcpyA(buf, lower_case); - ret = LCMapStringA(LOCALE_USER_DEFAULT, LCMAP_UPPERCASE, - buf, -1, buf, sizeof(buf)); - if (!ret) /* Win9x */ - trace("Ignoring LCMapStringA(LCMAP_UPPERCASE, buf, buf) error on Win9x\n"); - else - { - ok(ret == lstrlenA(lower_case) + 1, - "ret %d, error %ld, expected value %d\n", - ret, GetLastError(), lstrlenA(lower_case) + 1); - ok(!lstrcmpA(buf, upper_case), "LCMapStringA should return %s, but not %s\n", upper_case, buf); - } - lstrcpyA(buf, upper_case); - ret = LCMapStringA(LOCALE_USER_DEFAULT, LCMAP_LOWERCASE, - buf, -1, buf, sizeof(buf)); - if (!ret) /* Win9x */ - trace("Ignoring LCMapStringA(LCMAP_LOWERCASE, buf, buf) error on Win9x\n"); - else - { - ok(ret == lstrlenA(upper_case) + 1, - "ret %d, error %ld, expected value %d\n", - ret, GetLastError(), lstrlenA(lower_case) + 1); - ok(!lstrcmpA(buf, lower_case), "LCMapStringA should return %s, but not %s\n", lower_case, buf); - } - - /* otherwise src == dst should fail */ - SetLastError(0xdeadbeef); - ret = LCMapStringA(LOCALE_USER_DEFAULT, LCMAP_SORTKEY | LCMAP_UPPERCASE, - buf, 10, buf, sizeof(buf)); - ok(GetLastError() == ERROR_INVALID_FLAGS /* NT */ || - GetLastError() == ERROR_INVALID_PARAMETER /* Win9x */, - "unexpected error code %ld\n", GetLastError()); - ok(!ret, "src == dst without LCMAP_UPPERCASE or LCMAP_LOWERCASE must fail\n"); - - /* test whether '\0' is always appended */ - ret = LCMapStringA(LOCALE_USER_DEFAULT, LCMAP_SORTKEY, - upper_case, -1, buf, sizeof(buf)); - ok(ret, "LCMapStringA must succeed\n"); - ret2 = LCMapStringA(LOCALE_USER_DEFAULT, LCMAP_SORTKEY, - upper_case, lstrlenA(upper_case), buf2, sizeof(buf2)); - ok(ret, "LCMapStringA must succeed\n"); - ok(ret == ret2, "lengths of sort keys must be equal\n"); - ok(!lstrcmpA(buf, buf2), "sort keys must be equal\n"); - - /* test LCMAP_SORTKEY | NORM_IGNORECASE */ - ret = LCMapStringA(LOCALE_USER_DEFAULT, LCMAP_SORTKEY | NORM_IGNORECASE, - upper_case, -1, buf, sizeof(buf)); - ok(ret, "LCMapStringA must succeed\n"); - ret2 = LCMapStringA(LOCALE_USER_DEFAULT, LCMAP_SORTKEY, - lower_case, -1, buf2, sizeof(buf2)); - ok(ret2, "LCMapStringA must succeed\n"); - ok(ret == ret2, "lengths of sort keys must be equal\n"); - ok(!lstrcmpA(buf, buf2), "sort keys must be equal\n"); - - /* test LCMAP_SORTKEY | NORM_IGNORENONSPACE */ - ret = LCMapStringA(LOCALE_USER_DEFAULT, LCMAP_SORTKEY | NORM_IGNORENONSPACE, - lower_case, -1, buf, sizeof(buf)); - ok(ret, "LCMapStringA must succeed\n"); - ret2 = LCMapStringA(LOCALE_USER_DEFAULT, LCMAP_SORTKEY, - lower_case, -1, buf2, sizeof(buf2)); - ok(ret2, "LCMapStringA must succeed\n"); - ok(ret == ret2, "lengths of sort keys must be equal\n"); - ok(!lstrcmpA(buf, buf2), "sort keys must be equal\n"); - - /* test LCMAP_SORTKEY | NORM_IGNORESYMBOLS */ - ret = LCMapStringA(LOCALE_USER_DEFAULT, LCMAP_SORTKEY | NORM_IGNORESYMBOLS, - lower_case, -1, buf, sizeof(buf)); - ok(ret, "LCMapStringA must succeed\n"); - ret2 = LCMapStringA(LOCALE_USER_DEFAULT, LCMAP_SORTKEY, - symbols_stripped, -1, buf2, sizeof(buf2)); - ok(ret2, "LCMapStringA must succeed\n"); - ok(ret == ret2, "lengths of sort keys must be equal\n"); - ok(!lstrcmpA(buf, buf2), "sort keys must be equal\n"); - - /* test NORM_IGNORENONSPACE */ - lstrcpyA(buf, "foo"); - ret = LCMapStringA(LOCALE_USER_DEFAULT, NORM_IGNORENONSPACE, - lower_case, -1, buf, sizeof(buf)); - ok(ret == lstrlenA(lower_case) + 1, "LCMapStringA should return %d, ret = %d\n", - lstrlenA(lower_case) + 1, ret); - ok(!lstrcmpA(buf, lower_case), "LCMapStringA should return %s, but not %s\n", lower_case, buf); - - /* test NORM_IGNORESYMBOLS */ - lstrcpyA(buf, "foo"); - ret = LCMapStringA(LOCALE_USER_DEFAULT, NORM_IGNORESYMBOLS, - lower_case, -1, buf, sizeof(buf)); - ok(ret == lstrlenA(symbols_stripped) + 1, "LCMapStringA should return %d, ret = %d\n", - lstrlenA(symbols_stripped) + 1, ret); - ok(!lstrcmpA(buf, symbols_stripped), "LCMapStringA should return %s, but not %s\n", lower_case, buf); - - /* test srclen = 0 */ - SetLastError(0xdeadbeef); - ret = LCMapStringA(LOCALE_USER_DEFAULT, 0, upper_case, 0, buf, sizeof(buf)); - ok(!ret, "LCMapStringA should fail with srclen = 0\n"); - ok(GetLastError() == ERROR_INVALID_PARAMETER, - "unexpected error code %ld\n", GetLastError()); -} - -void test_LCMapStringW(void) -{ - int ret, ret2; - WCHAR buf[256], buf2[256]; - char *p_buf = (char *)buf, *p_buf2 = (char *)buf2; - static const WCHAR upper_case[] = {'\t','J','U','S','T','!',' ','A',',',' ','T','E','S','T',';',' ','S','T','R','I','N','G',' ','1','/','*','+','-','.','\r','\n',0}; - static const WCHAR lower_case[] = {'\t','j','u','s','t','!',' ','a',',',' ','t','e','s','t',';',' ','s','t','r','i','n','g',' ','1','/','*','+','-','.','\r','\n',0}; - static const WCHAR symbols_stripped[] = {'j','u','s','t','a','t','e','s','t','s','t','r','i','n','g','1',0}; - static const WCHAR fooW[] = {'f','o','o',0}; - - ret = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_LOWERCASE | LCMAP_UPPERCASE, - upper_case, -1, buf, sizeof(buf)/sizeof(WCHAR)); - if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - { - trace("Skipping LCMapStringW tests on Win9x\n"); - return; - } - ok(!ret, "LCMAP_LOWERCASE and LCMAP_UPPERCASE are mutually exclusive\n"); - ok(GetLastError() == ERROR_INVALID_FLAGS, - "unexpected error code %ld\n", GetLastError()); - - ret = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_HIRAGANA | LCMAP_KATAKANA, - upper_case, -1, buf, sizeof(buf)/sizeof(WCHAR)); - ok(!ret, "LCMAP_HIRAGANA and LCMAP_KATAKANA are mutually exclusive\n"); - ok(GetLastError() == ERROR_INVALID_FLAGS, - "unexpected error code %ld\n", GetLastError()); - - ret = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_HALFWIDTH | LCMAP_FULLWIDTH, - upper_case, -1, buf, sizeof(buf)/sizeof(WCHAR)); - ok(!ret, "LCMAP_HALFWIDTH | LCMAP_FULLWIDTH are mutually exclusive\n"); - ok(GetLastError() == ERROR_INVALID_FLAGS, - "unexpected error code %ld\n", GetLastError()); - - ret = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_TRADITIONAL_CHINESE | LCMAP_SIMPLIFIED_CHINESE, - upper_case, -1, buf, sizeof(buf)/sizeof(WCHAR)); - ok(!ret, "LCMAP_TRADITIONAL_CHINESE and LCMAP_SIMPLIFIED_CHINESE are mutually exclusive\n"); - ok(GetLastError() == ERROR_INVALID_FLAGS, - "unexpected error code %ld\n", GetLastError()); - - /* SORT_STRINGSORT must be used exclusively with LCMAP_SORTKEY */ - SetLastError(0xdeadbeef); - ret = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_LOWERCASE | SORT_STRINGSORT, - upper_case, -1, buf, sizeof(buf)/sizeof(WCHAR)); - ok(GetLastError() == ERROR_INVALID_FLAGS, "expected ERROR_INVALID_FLAGS, got %ld\n", GetLastError()); - ok(!ret, "SORT_STRINGSORT without LCMAP_SORTKEY must fail\n"); - - /* test LCMAP_LOWERCASE */ - ret = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_LOWERCASE, - upper_case, -1, buf, sizeof(buf)/sizeof(WCHAR)); - ok(ret == lstrlenW(upper_case) + 1, - "ret %d, error %ld, expected value %d\n", - ret, GetLastError(), lstrlenW(upper_case) + 1); - ok(!lstrcmpW(buf, lower_case), "string compare mismatch\n"); - - /* test LCMAP_UPPERCASE */ - ret = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_UPPERCASE, - lower_case, -1, buf, sizeof(buf)/sizeof(WCHAR)); - ok(ret == lstrlenW(lower_case) + 1, - "ret %d, error %ld, expected value %d\n", - ret, GetLastError(), lstrlenW(lower_case) + 1); - ok(!lstrcmpW(buf, upper_case), "string compare mismatch\n"); - - /* test buffer overflow */ - SetLastError(0xdeadbeef); - ret = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_UPPERCASE, - lower_case, -1, buf, 4); - ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, - "should return 0 and ERROR_INSUFFICIENT_BUFFER, got %d\n", ret); - - /* LCMAP_UPPERCASE or LCMAP_LOWERCASE should accept src == dst */ - lstrcpyW(buf, lower_case); - ret = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_UPPERCASE, - buf, -1, buf, sizeof(buf)/sizeof(WCHAR)); - ok(ret == lstrlenW(lower_case) + 1, - "ret %d, error %ld, expected value %d\n", - ret, GetLastError(), lstrlenW(lower_case) + 1); - ok(!lstrcmpW(buf, upper_case), "string compare mismatch\n"); - - lstrcpyW(buf, upper_case); - ret = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_LOWERCASE, - buf, -1, buf, sizeof(buf)/sizeof(WCHAR)); - ok(ret == lstrlenW(upper_case) + 1, - "ret %d, error %ld, expected value %d\n", - ret, GetLastError(), lstrlenW(lower_case) + 1); - ok(!lstrcmpW(buf, lower_case), "string compare mismatch\n"); - - /* otherwise src == dst should fail */ - SetLastError(0xdeadbeef); - ret = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_SORTKEY | LCMAP_UPPERCASE, - buf, 10, buf, sizeof(buf)); - ok(GetLastError() == ERROR_INVALID_FLAGS /* NT */ || - GetLastError() == ERROR_INVALID_PARAMETER /* Win9x */, - "unexpected error code %ld\n", GetLastError()); - ok(!ret, "src == dst without LCMAP_UPPERCASE or LCMAP_LOWERCASE must fail\n"); - - /* test whether '\0' is always appended */ - ret = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_SORTKEY, - upper_case, -1, buf, sizeof(buf)); - ok(ret, "LCMapStringW must succeed\n"); - ret2 = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_SORTKEY, - upper_case, lstrlenW(upper_case), buf2, sizeof(buf2)); - ok(ret, "LCMapStringW must succeed\n"); - ok(ret == ret2, "lengths of sort keys must be equal\n"); - ok(!lstrcmpA(p_buf, p_buf2), "sort keys must be equal\n"); - - /* test LCMAP_SORTKEY | NORM_IGNORECASE */ - ret = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_SORTKEY | NORM_IGNORECASE, - upper_case, -1, buf, sizeof(buf)); - ok(ret, "LCMapStringW must succeed\n"); - ret2 = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_SORTKEY, - lower_case, -1, buf2, sizeof(buf2)); - ok(ret2, "LCMapStringW must succeed\n"); - ok(ret == ret2, "lengths of sort keys must be equal\n"); - ok(!lstrcmpA(p_buf, p_buf2), "sort keys must be equal\n"); - - /* test LCMAP_SORTKEY | NORM_IGNORENONSPACE */ - ret = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_SORTKEY | NORM_IGNORENONSPACE, - lower_case, -1, buf, sizeof(buf)); - ok(ret, "LCMapStringW must succeed\n"); - ret2 = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_SORTKEY, - lower_case, -1, buf2, sizeof(buf2)); - ok(ret2, "LCMapStringW must succeed\n"); - ok(ret == ret2, "lengths of sort keys must be equal\n"); - ok(!lstrcmpA(p_buf, p_buf2), "sort keys must be equal\n"); - - /* test LCMAP_SORTKEY | NORM_IGNORESYMBOLS */ - ret = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_SORTKEY | NORM_IGNORESYMBOLS, - lower_case, -1, buf, sizeof(buf)); - ok(ret, "LCMapStringW must succeed\n"); - ret2 = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_SORTKEY, - symbols_stripped, -1, buf2, sizeof(buf2)); - ok(ret2, "LCMapStringW must succeed\n"); - ok(ret == ret2, "lengths of sort keys must be equal\n"); - ok(!lstrcmpA(p_buf, p_buf2), "sort keys must be equal\n"); - - /* test NORM_IGNORENONSPACE */ - lstrcpyW(buf, fooW); - ret = LCMapStringW(LOCALE_USER_DEFAULT, NORM_IGNORENONSPACE, - lower_case, -1, buf, sizeof(buf)/sizeof(WCHAR)); - ok(ret == lstrlenW(lower_case) + 1, "LCMapStringW should return %d, ret = %d\n", - lstrlenW(lower_case) + 1, ret); - ok(!lstrcmpW(buf, lower_case), "string comparison mismatch\n"); - - /* test NORM_IGNORESYMBOLS */ - lstrcpyW(buf, fooW); - ret = LCMapStringW(LOCALE_USER_DEFAULT, NORM_IGNORESYMBOLS, - lower_case, -1, buf, sizeof(buf)/sizeof(WCHAR)); - ok(ret == lstrlenW(symbols_stripped) + 1, "LCMapStringW should return %d, ret = %d\n", - lstrlenW(symbols_stripped) + 1, ret); - ok(!lstrcmpW(buf, symbols_stripped), "string comparison mismatch\n"); - - /* test srclen = 0 */ - SetLastError(0xdeadbeef); - ret = LCMapStringW(LOCALE_USER_DEFAULT, 0, upper_case, 0, buf, sizeof(buf)); - ok(!ret, "LCMapStringW should fail with srclen = 0\n"); - ok(GetLastError() == ERROR_INVALID_PARAMETER, - "unexpected error code %ld\n", GetLastError()); -} - -#if 0 /* this requires collation table patch to make it MS compatible */ -const char *strings_sorted[] = -{ -"'", -"-", -"!", -"\"", -".", -":", -"\\", -"_", -"`", -"{", -"}", -"+", -"0", -"1", -"2", -"3", -"4", -"5", -"6", -"7", -"8", -"9", -"a", -"A", -"b", -"B", -"c", -"C" -}; - -const char *strings[] = -{ -"C", -"\"", -"9", -"'", -"}", -"-", -"7", -"+", -"`", -"1", -"a", -"5", -"\\", -"8", -"B", -"3", -"_", -"6", -"{", -"2", -"c", -"4", -"!", -"0", -"A", -":", -"b", -"." -}; - -static int compare_string1(const void *e1, const void *e2) -{ - const char *s1 = *(const char **)e1; - const char *s2 = *(const char **)e2; - - return lstrcmpA(s1, s2); -} - -static int compare_string2(const void *e1, const void *e2) -{ - const char *s1 = *(const char **)e1; - const char *s2 = *(const char **)e2; - - return CompareStringA(0, 0, s1, -1, s2, -1) - 2; -} - -static int compare_string3(const void *e1, const void *e2) -{ - const char *s1 = *(const char **)e1; - const char *s2 = *(const char **)e2; - char key1[256], key2[256]; - - LCMapStringA(0, LCMAP_SORTKEY, s1, -1, key1, sizeof(key1)); - LCMapStringA(0, LCMAP_SORTKEY, s2, -1, key2, sizeof(key2)); - return strcmp(key1, key2); -} - -static void test_sorting(void) -{ - char buf[256]; - char **str_buf = (char **)buf; - int i; - - assert(sizeof(buf) >= sizeof(strings)); - - /* 1. sort using lstrcmpA */ - memcpy(buf, strings, sizeof(strings)); - qsort(buf, sizeof(strings)/sizeof(strings[0]), sizeof(strings[0]), compare_string1); - for (i = 0; i < sizeof(strings)/sizeof(strings[0]); i++) - { - ok(!strcmp(strings_sorted[i], str_buf[i]), - "qsort using lstrcmpA failed for element %d\n", i); - } - /* 2. sort using CompareStringA */ - memcpy(buf, strings, sizeof(strings)); - qsort(buf, sizeof(strings)/sizeof(strings[0]), sizeof(strings[0]), compare_string2); - for (i = 0; i < sizeof(strings)/sizeof(strings[0]); i++) - { - ok(!strcmp(strings_sorted[i], str_buf[i]), - "qsort using CompareStringA failed for element %d\n", i); - } - /* 3. sort using sort keys */ - memcpy(buf, strings, sizeof(strings)); - qsort(buf, sizeof(strings)/sizeof(strings[0]), sizeof(strings[0]), compare_string3); - for (i = 0; i < sizeof(strings)/sizeof(strings[0]); i++) - { - ok(!strcmp(strings_sorted[i], str_buf[i]), - "qsort using sort keys failed for element %d\n", i); - } -} -#endif - -static void test_FoldStringA(void) -{ - int ret, i; - char src[256], dst[256]; - static const char digits_src[] = { 0xB9,0xB2,0xB3,'\0' }; - static const char digits_dst[] = { '1','2','3','\0' }; - static const char composite_src[] = - { - 0x8a,0x8e,0x9a,0x9e,0x9f,0xc0,0xc1,0xc2, - 0xc3,0xc4,0xc5,0xc7,0xc8,0xc9,0xca,0xcb, - 0xcc,0xcd,0xce,0xcf,0xd1,0xd2,0xd3,0xd4, - 0xd5,0xd6,0xd8,0xd9,0xda,0xdb,0xdc,0xdd, - 0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe7,0xe8, - 0xe9,0xea,0xeb,0xec,0xed,0xee,0xef,0xf1, - 0xf2,0xf3,0xf4,0xf5,0xf6,0xf8,0xf9,0xfa, - 0xfb,0xfc,0xfd,0xff,'\0' - }; - static const char composite_dst[] = - { - 0x53,0x3f,0x5a,0x3f,0x73,0x3f,0x7a,0x3f, - 0x59,0xa8,0x41,0x60,0x41,0xb4,0x41,0x5e, - 0x41,0x7e,0x41,0xa8,0x41,0xb0,0x43,0xb8, - 0x45,0x60,0x45,0xb4,0x45,0x5e,0x45,0xa8, - 0x49,0x60,0x49,0xb4,0x49,0x5e,0x49,0xa8, - 0x4e,0x7e,0x4f,0x60,0x4f,0xb4,0x4f,0x5e, - 0x4f,0x7e,0x4f,0xa8,0x4f,0x3f,0x55,0x60, - 0x55,0xb4,0x55,0x5e,0x55,0xa8,0x59,0xb4, - 0x61,0x60,0x61,0xb4,0x61,0x5e,0x61,0x7e, - 0x61,0xa8,0x61,0xb0,0x63,0xb8,0x65,0x60, - 0x65,0xb4,0x65,0x5e,0x65,0xa8,0x69,0x60, - 0x69,0xb4,0x69,0x5e,0x69,0xa8,0x6e,0x7e, - 0x6f,0x60,0x6f,0xb4,0x6f,0x5e,0x6f,0x7e, - 0x6f,0xa8,0x6f,0x3f,0x75,0x60,0x75,0xb4, - 0x75,0x5e,0x75,0xa8,0x79,0xb4,0x79,0xa8,'\0' - }; - static const char ligatures_src[] = - { - 0x8C,0x9C,0xC6,0xDE,0xDF,0xE6,0xFE,'\0' - }; - static const char ligatures_dst[] = - { - 'O','E','o','e','A','E','T','H','s','s','a','e','t','h','\0' - }; - - if (!pFoldStringA) - return; /* FoldString is present in NT v3.1+, but not 95/98/Me */ - - /* these tests are locale specific */ - if (GetACP() != 1252) - { - trace("Skipping FoldStringA tests for a not Latin 1 locale\n"); - return; - } - - /* MAP_FOLDDIGITS */ - SetLastError(0); - ret = pFoldStringA(MAP_FOLDDIGITS, digits_src, -1, dst, 256); - if (GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) - return; - EXPECT_LEN(4); EXPECT_VALID; - ok(strcmp(dst, digits_dst) == 0, - "MAP_FOLDDIGITS: Expected '%s', got '%s'\n", digits_dst, dst); - for (i = 1; i < 256; i++) - { - if (!strchr(digits_src, i)) - { - src[0] = i; - src[1] = '\0'; - SetLastError(0); - ret = pFoldStringA(MAP_FOLDDIGITS, src, -1, dst, 256); - EXPECT_LEN(2); EXPECT_VALID; - ok(dst[0] == src[0], - "MAP_FOLDDIGITS: Expected '%s', got '%s'\n", src, dst); - } - } - - /* MAP_EXPAND_LIGATURES */ - SetLastError(0); - ret = pFoldStringA(MAP_EXPAND_LIGATURES, ligatures_src, -1, dst, 256); - EXPECT_LEN(sizeof(ligatures_dst)); EXPECT_VALID; - ok(strcmp(dst, ligatures_dst) == 0, - "MAP_EXPAND_LIGATURES: Expected '%s', got '%s'\n", ligatures_dst, dst); - for (i = 1; i < 256; i++) - { - if (!strchr(ligatures_src, i)) - { - src[0] = i; - src[1] = '\0'; - SetLastError(0); - ret = pFoldStringA(MAP_EXPAND_LIGATURES, src, -1, dst, 256); - EXPECT_LEN(2); EXPECT_VALID; - ok(dst[0] == src[0], - "MAP_EXPAND_LIGATURES: Expected '%s', got '%s'\n", src, dst); - } - } - - /* MAP_COMPOSITE */ - SetLastError(0); - ret = pFoldStringA(MAP_COMPOSITE, composite_src, -1, dst, 256); - EXPECT_VALID; - todo_wine - { - /* Wine gets close, but doesn't produce quite the same result as native */ - EXPECT_LEN(121); - ok(strcmp(dst, composite_dst) == 0, - "MAP_COMPOSITE: Expected '%s', got '%s'\n", composite_dst, dst); - } - - for (i = 1; i < 256; i++) - { - if (!strchr(composite_src, i)) - { - src[0] = i; - src[1] = '\0'; - SetLastError(0); - ret = pFoldStringA(MAP_COMPOSITE, src, -1, dst, 256); - EXPECT_LEN(2); EXPECT_VALID; - ok(dst[0] == src[0], - "0x%02x, 0x%02x,0x%02x,0x%02x,\n", (unsigned char)src[0], - (unsigned char)dst[0],(unsigned char)dst[1],(unsigned char)dst[2]); - } - } - - /* MAP_FOLDCZONE */ - for (i = 1; i < 256; i++) - { - src[0] = i; - src[1] = '\0'; - SetLastError(0); - ret = pFoldStringA(MAP_FOLDCZONE, src, -1, dst, 256); - EXPECT_LEN(2); EXPECT_VALID; - ok(src[0] == dst[0], - "MAP_FOLDCZONE: Expected 0x%02x, got 0x%02x\n", - (unsigned char)src[0], (unsigned char)dst[0]); - } - - /* MAP_PRECOMPOSED */ - for (i = 1; i < 256; i++) - { - src[0] = i; - src[1] = '\0'; - SetLastError(0); - ret = pFoldStringA(MAP_PRECOMPOSED, src, -1, dst, 256); - EXPECT_LEN(2); EXPECT_VALID; - ok(src[0] == dst[0], - "MAP_PRECOMPOSED: Expected 0x%02x, got 0x%02x\n", - (unsigned char)src[0], (unsigned char)dst[0]); - } -} - -static void test_FoldStringW(void) -{ - int ret; - size_t i, j; - WCHAR src[256], dst[256], ch, prev_ch = 1; - static const DWORD badFlags[] = - { - 0, - MAP_PRECOMPOSED|MAP_COMPOSITE, - MAP_PRECOMPOSED|MAP_EXPAND_LIGATURES, - MAP_COMPOSITE|MAP_EXPAND_LIGATURES - }; - /* Ranges of digits 0-9 : Must be sorted! */ - static const WCHAR digitRanges[] = - { - 0x0030, /* '0'-'9' */ - 0x0660, /* Eastern Arabic */ - 0x06F0, /* Arabic - Hindu */ - 0x0966, /* Devengari */ - 0x09E6, /* Bengalii */ - 0x0A66, /* Gurmukhi */ - 0x0AE6, /* Gujarati */ - 0x0B66, /* Oriya */ - 0x0BE6, /* Tamil - No 0 */ - 0x0C66, /* Telugu */ - 0x0CE6, /* Kannada */ - 0x0D66, /* Maylayalam */ - 0x0E50, /* Thai */ - 0x0ED0, /* Laos */ - 0x2070, /* Superscript - 1, 2, 3 are out of sequence */ - 0x2080, /* Subscript */ - 0x245F, /* Circled - 0 is out of sequence */ - 0x2473, /* Bracketed */ - 0x2487, /* Full stop */ - 0x2775, /* Inverted circled - No 0 */ - 0x277F, /* Patterned circled - No 0 */ - 0x2789, /* Inverted Patterned circled - No 0 */ - 0xff10, /* Pliene chasse (?) */ - 0xffff /* Terminator */ - }; - /* Digits which are represented, but out of sequence */ - static const WCHAR outOfSequenceDigits[] = - { - 0xB9, /* Superscript 1 */ - 0xB2, /* Superscript 2 */ - 0xB3, /* Superscript 3 */ - 0x24EA, /* Circled 0 */ - '\0' /* Terminator */ - }; - /* Digits in digitRanges for which no representation is available */ - static const WCHAR noDigitAvailable[] = - { - 0x0BE6, /* No Tamil 0 */ - 0x2473, /* No Bracketed 0 */ - 0x2487, /* No 0 Full stop */ - 0x2775, /* No inverted circled 0 */ - 0x277F, /* No patterned circled */ - 0x2789, /* No inverted Patterned circled */ - '\0' /* Terminator */ - }; - /* Compatibility conversion results */ - static const WCHAR compat_F900_FA2F[256+48] = - { - 0x8c48, 0x66f4, 0x8eca, 0x8cc8, 0x6ed1, 0x4e32, 0x53e5, 0x9f9c, - 0x9f9c, 0x5951, 0x91d1, 0x5587, 0x5948, 0x61f6, 0x7669, 0x7f85, - 0x863f, 0x87ba, 0x88f8, 0x908f, 0x6a02, 0x6d1b, 0x70d9, 0x73de, - 0x843d, 0x916a, 0x99f1, 0x4e82, 0x5375, 0x6b04, 0x721b, 0x862d, - 0x9e1e, 0x5d50, 0x6feb, 0x85cd, 0x8964, 0x62c9, 0x81d8, 0x881f, - 0x5eca, 0x6717, 0x6d6a, 0x72fc, 0x0000, 0x4f86, 0x51b7, 0x52de, - 0x64c4, 0x6ad3, 0x7210, 0x76e7, 0x8001, 0x8606, 0x865c, 0x8def, - 0x9732, 0x9b6f, 0x9dfa, 0x788c, 0x797f, 0x7da0, 0x83c9, 0x9304, - 0x9e7f, 0x8ad6, 0x58df, 0x5f04, 0x7c60, 0x807e, 0x7262, 0x78ca, - 0x8cc2, 0x96f7, 0x58d8, 0x5c62, 0x6a13, 0x6dda, 0x6f0f, 0x7d2f, - 0x7e37, 0x964b, 0x52d2, 0x808b, 0x51dc, 0x51cc, 0x7a1c, 0x7dbe, - 0x83f1, 0x9675, 0x8b80, 0x62cf, 0x6a02, 0x8afe, 0x4e39, 0x5be7, - 0x6012, 0x7387, 0x7570, 0x5317, 0x78fb, 0x4fbf, 0x5fa9, 0x4e0d, - 0x6ccc, 0x6578, 0x7d22, 0x53c3, 0x585e, 0x7701, 0x8449, 0x8aaa, - 0x6bba, 0x8fb0, 0x6c88, 0x62fe, 0x82e5, 0x63a0, 0x7565, 0x4eae, - 0x5169, 0x0000, 0x6881, 0x7ce7, 0x826f, 0x8ad2, 0x91cf, 0x52f5, - 0x5442, 0x5973, 0x5eec, 0x65c5, 0x6ffe, 0x792a, 0x95ad, 0x9a6a, - 0x9e97, 0x9ece, 0x529b, 0x66c6, 0x6b77, 0x8f62, 0x5e74, 0x6190, - 0x6200, 0x649a, 0x6f23, 0x7149, 0x7489, 0x0000, 0x7df4, 0x806f, - 0x8f26, 0x84ee, 0x9023, 0x934a, 0x5217, 0x52a3, 0x54bd, 0x70c8, - 0x88c2, 0x8aaa, 0x5ec9, 0x5ff5, 0x637b, 0x6bae, 0x7c3e, 0x7375, - 0x4ee4, 0x56f9, 0x5be7, 0x5dba, 0x601c, 0x73b2, 0x7469, 0x7f9a, - 0x8046, 0x9234, 0x96f6, 0x9748, 0x9818, 0x4f8b, 0x79ae, 0x91b4, - 0x96b8, 0x60e1, 0x4e86, 0x50da, 0x5bee, 0x5c3f, 0x6599, 0x6a02, - 0x71ce, 0x7642, 0x84fc, 0x907c, 0x9f8d, 0x6688, 0x962e, 0x5289, - 0x677b, 0x67f3, 0x6d41, 0x6e9c, 0x7409, 0x7559, 0x786b, 0x7d10, - 0x985e, 0x516d, 0x622e, 0x9678, 0x502b, 0x5d19, 0x6dea, 0x8f2a, - 0x5f8b, 0x6144, 0x6817, 0x7387, 0x9686, 0x5229, 0x540f, 0x5c65, - 0x6613, 0x674e, 0x68a8, 0x6ce5, 0x7406, 0x75e2, 0x7f79, 0x0000, - 0x88e1, 0x91cc, 0x96e2, 0x533f, 0x6eba, 0x541d, 0x71d0, 0x7498, - 0x85fa, 0x0000, 0x9c57, 0x9e9f, 0x6797, 0x6dcb, 0x81e8, 0x7acb, - 0x7b20, 0x7c92, 0x72c0, 0x7099, 0x8b58, 0x4ec0, 0x8336, 0x523a, - 0x5207, 0x5ea6, 0x62d3, 0x7cd6, 0x5b85, 0x6d1e, 0x66b4, 0x8f3b, - 0x884c, 0x964d, 0x898b, 0x5ed3, 0x0000, 0x0000, 0x0000, 0x0000, - 0x585a, 0x0000, 0x6674, 0x0000, 0x0000, 0x51de, 0x8c6c, 0x76ca, - 0x0000, 0x795e, 0x7965, 0x798f, 0x9756, 0x7cbe, 0x7fbd, 0x0000, - 0x0000, 0x0000, 0x8af8, 0x0000, 0x0000, 0x9038, 0x90fd, 0x0000, - 0x0000, 0x0000, 0x98ef, 0x98fc, 0x9928, 0x9db4, 0x0000, 0x0000 - }; - static const WCHAR compat_FE30_FEF7[200] = - { - 0x2025, 0x2014, 0x2013, 0x005f, 0x005f, 0x0028, 0x0029, 0x007b, - 0x007d, 0x3014, 0x3015, 0x3010, 0x3011, 0x300a, 0x300b, 0x3008, - 0x3009, 0x300c, 0x300d, 0x300e, 0x300f, 0x0000, 0x0000, 0x0000, - 0x0000, 0x203e, 0x203e, 0x203e, 0x203e, 0x005f, 0x005f, 0x005f, - 0x002c, 0x3001, 0x002e, 0x0000, 0x003b, 0x003a, 0x003f, 0x0021, - 0x2014, 0x0028, 0x0029, 0x007b, 0x007d, 0x3014, 0x3015, 0x0023, - 0x0026, 0x002a, 0x002b, 0x002d, 0x003c, 0x003e, 0x003d, 0x0000, - 0x0000, 0x0024, 0x0025, 0x0040, 0x0000, 0x0000, 0x0000, 0x0000, - 0x064b, 0x064b, 0x064c, 0x0000, 0x064d, 0x0000, 0x064e, 0x064e, - 0x064f, 0x064f, 0x0650, 0x0650, 0x0651, 0x0651, 0x0652, 0x0652, - 0x0621, 0x0622, 0x0622, 0x0623, 0x0623, 0x0624, 0x0624, 0x0625, - 0x0625, 0x0626, 0x0626, 0x0626, 0x0626, 0x0627, 0x0627, 0x0628, - 0x0628, 0x0628, 0x0628, 0x0629, 0x0629, 0x062a, 0x062a, 0x062a, - 0x062a, 0x062b, 0x062b, 0x062b, 0x062b, 0x062c, 0x062c, 0x062c, - 0x062c, 0x062d, 0x062d, 0x062d, 0x062d, 0x062e, 0x062e, 0x062e, - 0x062e, 0x062f, 0x062f, 0x0630, 0x0630, 0x0631, 0x0631, 0x0632, - 0x0632, 0x0633, 0x0633, 0x0633, 0x0633, 0x0634, 0x0634, 0x0634, - 0x0634, 0x0635, 0x0635, 0x0635, 0x0635, 0x0636, 0x0636, 0x0636, - 0x0636, 0x0637, 0x0637, 0x0637, 0x0637, 0x0638, 0x0638, 0x0638, - 0x0638, 0x0639, 0x0639, 0x0639, 0x0639, 0x063a, 0x063a, 0x063a, - 0x063a, 0x0641, 0x0641, 0x0641, 0x0641, 0x0642, 0x0642, 0x0642, - 0x0642, 0x0643, 0x0643, 0x0643, 0x0643, 0x0644, 0x0644, 0x0644, - 0x0644, 0x0645, 0x0645, 0x0645, 0x0645, 0x0646, 0x0646, 0x0646, - 0x0646, 0x0647, 0x0647, 0x0647, 0x0647, 0x0648, 0x0648, 0x0649, - 0x0649, 0x064a, 0x064a, 0x064a, 0x064a, 0x0000, 0x0000, 0x0000 - }; - static const WCHAR compat_FF00_FFEF[240] = - { - 0x0000, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005a, 0x005b, 0x0000, 0x005d, 0x005e, 0x005f, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x0000, - 0x0000, 0x3002, 0x300c, 0x300d, 0x3001, 0x30fb, 0x30f2, 0x30a1, - 0x30a3, 0x30a5, 0x30a7, 0x30a9, 0x30e3, 0x30e5, 0x30e7, 0x30c3, - 0x30fc, 0x30a2, 0x30a4, 0x30a6, 0x30a8, 0x30aa, 0x30ab, 0x30ad, - 0x30af, 0x30b1, 0x30b3, 0x30b5, 0x30b7, 0x30b9, 0x30bb, 0x30bd, - 0x30bf, 0x30c1, 0x30c4, 0x30c6, 0x30c8, 0x30ca, 0x30cb, 0x30cc, - 0x30cd, 0x30ce, 0x30cf, 0x30d2, 0x30d5, 0x30d8, 0x30db, 0x30de, - 0x30df, 0x30e0, 0x30e1, 0x30e2, 0x30e4, 0x30e6, 0x30e8, 0x30e9, - 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ef, 0x30f3, 0x309b, 0x309c, - 0x3164, 0x3131, 0x3132, 0x3133, 0x3134, 0x3135, 0x3136, 0x3137, - 0x3138, 0x3139, 0x313a, 0x313b, 0x313c, 0x313d, 0x313e, 0x313f, - 0x3140, 0x3141, 0x3142, 0x3143, 0x3144, 0x3145, 0x3146, 0x3147, - 0x3148, 0x3149, 0x314a, 0x314b, 0x314c, 0x314d, 0x314e, 0x0000, - 0x0000, 0x0000, 0x314f, 0x3150, 0x3151, 0x3152, 0x3153, 0x3154, - 0x0000, 0x0000, 0x3155, 0x3156, 0x3157, 0x3158, 0x3159, 0x315a, - 0x0000, 0x0000, 0x315b, 0x315c, 0x315d, 0x315e, 0x315f, 0x3160, - 0x0000, 0x0000, 0x3161, 0x3162, 0x3163, 0x0000, 0x0000, 0x0000, - 0x00a2, 0x00a3, 0x00ac, 0x00af, 0x00a6, 0x00a5, 0x20a9, 0x0000, - 0x2502, 0x2190, 0x2191, 0x2192, 0x2193, 0x25a0, 0x25cb, 0x0000 - }; - static const WCHAR ligatures_src[] = - { - 0x00c6, 0x00de, 0x00df, 0x00e6, 0x00fe, 0x0132, 0x0133, 0x0152, - 0x0153, 0x01c4, 0x01c5, 0x01c6, 0x01c7, 0x01c8, 0x01c9, 0x01ca, - 0x01cb, 0x01cc, 0x01e2, 0x01e3, 0x01f1, 0x01f2, 0x01f3, 0x01fc, - 0x01fd, 0x05f0, 0x05f1, 0x05f2, 0xfb00, 0xfb01, 0xfb02, 0xfb03, - 0xfb04, 0xfb05, 0xfb06, '\0' - }; - static const WCHAR ligatures_dst[] = - { - 'A','E','T','H','s','s','a','e','t','h','I','J','i','j','O','E','o','e', - 'D',0x017d,'D',0x017e,'d',0x017e,'L','J','L','j','l','j','N','J','N','j', - 'n','j',0x0100,0x0112,0x0101,0x0113,'D','Z','D','z','d','z',0x00c1,0x00c9, - 0x00e1,0x00e9,0x05d5,0x05d5,0x05d5,0x05d9,0x05d9,0x05d9,'f','f','f','i', - 'f','l','f','f','i','f','f','l',0x017f,'t','s','t','\0' - }; - - if (!pFoldStringW) - return; /* FoldString is present in NT v3.1+, but not 95/98/Me */ - - /* Invalid flag combinations */ - for (i = 0; i < sizeof(badFlags)/sizeof(badFlags[0]); i++) - { - src[0] = dst[0] = '\0'; - SetLastError(0); - ret = pFoldStringW(badFlags[i], src, 256, dst, 256); - if (GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) - return; - EXPECT_LEN(0); EXPECT_FLAGS; - } - - /* src & dst cannot be the same */ - SetLastError(0); - ret = pFoldStringW(MAP_FOLDCZONE, src, -1, src, 256); - EXPECT_LEN(0); EXPECT_INVALID; - - /* src can't be NULL */ - SetLastError(0); - ret = pFoldStringW(MAP_FOLDCZONE, NULL, -1, dst, 256); - EXPECT_LEN(0); EXPECT_INVALID; - - /* srclen can't be 0 */ - SetLastError(0); - ret = pFoldStringW(MAP_FOLDCZONE, src, 0, dst, 256); - EXPECT_LEN(0); EXPECT_INVALID; - - /* dstlen can't be < 0 */ - SetLastError(0); - ret = pFoldStringW(MAP_FOLDCZONE, src, -1, dst, -1); - EXPECT_LEN(0); EXPECT_INVALID; - - /* Ret includes terminating NUL which is appended if srclen = -1 */ - SetLastError(0); - src[0] = 'A'; - src[1] = '\0'; - dst[0] = '\0'; - ret = pFoldStringW(MAP_FOLDCZONE, src, -1, dst, 256); - EXPECT_LEN(2); EXPECT_VALID; - ok(dst[0] == 'A' && dst[1] == '\0', - "srclen=-1: Expected ret=2 [%d,%d], got ret=%d [%d,%d], err=%ld\n", - 'A', '\0', ret, dst[0], dst[1], GetLastError()); - - /* If size is given, result is not NUL terminated */ - SetLastError(0); - src[0] = 'A'; - src[1] = 'A'; - dst[0] = 'X'; - dst[1] = 'X'; - ret = pFoldStringW(MAP_FOLDCZONE, src, 1, dst, 256); - EXPECT_LEN(1); EXPECT_VALID; - ok(dst[0] == 'A' && dst[1] == 'X', - "srclen=1: Expected ret=1, [%d,%d], got ret=%d,[%d,%d], err=%ld\n", - 'A','X', ret, dst[0], dst[1], GetLastError()); - - /* MAP_FOLDDIGITS */ - for (j = 0; j < sizeof(digitRanges)/sizeof(digitRanges[0]); j++) - { - /* Check everything before this range */ - for (ch = prev_ch; ch < digitRanges[j]; ch++) - { - SetLastError(0); - src[0] = ch; - src[1] = dst[0] = '\0'; - ret = pFoldStringW(MAP_FOLDDIGITS, src, -1, dst, 256); - EXPECT_LEN(2); EXPECT_VALID; - - ok(dst[0] == ch || strchrW(outOfSequenceDigits, ch) || - /* Wine (correctly) maps all Unicode 4.0+ digits */ - isdigitW(ch) || (ch >= 0x24F5 && ch <= 0x24FD) || ch == 0x24FF, - "MAP_FOLDDIGITS: ch %d 0x%04x Expected unchanged got %d\n", ch, ch, dst[0]); - } - - if (digitRanges[j] == 0xffff) - break; /* Finished the whole code point space */ - - for (ch = digitRanges[j]; ch < digitRanges[j] + 10; ch++) - { - WCHAR c; - - /* Map out of sequence characters */ - if (ch == 0x2071) c = 0x00B9; /* Superscript 1 */ - else if (ch == 0x2072) c = 0x00B2; /* Superscript 2 */ - else if (ch == 0x2073) c = 0x00B3; /* Superscript 3 */ - else if (ch == 0x245F) c = 0x24EA; /* Circled 0 */ - else c = ch; - SetLastError(0); - src[0] = c; - src[1] = dst[0] = '\0'; - ret = pFoldStringW(MAP_FOLDDIGITS, src, -1, dst, 256); - EXPECT_LEN(2); EXPECT_VALID; - - ok((dst[0] == '0' + ch - digitRanges[j] && dst[1] == '\0') || - strchrW(noDigitAvailable, c), - "MAP_FOLDDIGITS: ch %d Expected %d got %d\n", - ch, '0' + digitRanges[j] - ch, dst[0]); - } - prev_ch = ch; - } - - /* MAP_FOLDCZONE */ - for (ch = 1; ch <0xffff; ch++) - { - WCHAR expected = 0; - - if (ch >= 0xF900 && ch <= 0xFA2F) - expected = compat_F900_FA2F[ch - 0xF900]; - else if (ch >= 0xFE30 && ch <= 0xFEF7) - expected = compat_FE30_FEF7[ch - 0xFE30]; - else if (ch >= 0xFF00 && ch <= 0xFFEF) - expected = compat_FF00_FFEF[ch - 0xFF00]; - - if (!expected) - expected = ch; - - SetLastError(0); - src[0] = ch; - src[1] = dst[0] = '\0'; - ret = pFoldStringW(MAP_FOLDCZONE, src, -1, dst, 256); - EXPECT_LEN(2); EXPECT_VALID; - ok(dst[0] == expected || - /* Wine (correctly) uses updated mappings for some Unicode 4.0 chars */ - (ch >= 0xFA0D && ch <= 0xFA47) || - 0xf92c || ch == 0xf979 || ch == 0xf995 || ch == 0xf9e7 || ch == 0xf9f1, - "MAP_FOLDCZONE: ch %d 0x%04x Expected 0x%04x got 0x%04x\n", - ch, ch, expected, dst[0]); - } - - /* MAP_EXPAND_LIGATURES */ - SetLastError(0); - ret = pFoldStringW(MAP_EXPAND_LIGATURES, ligatures_src, -1, dst, 256); - EXPECT_LEN(sizeof(ligatures_dst)/sizeof(ligatures_dst[0])); EXPECT_VALID; - ok(!memcmp(dst, ligatures_dst, sizeof(ligatures_dst)), - "MAP_EXPAND_LIGATURES: Expanded incorrectly\n"); - for (i = 1; i <= 0xffff; i++) - { - if (!strchrW(ligatures_src, i)) - { - src[0] = i; - src[1] = '\0'; - SetLastError(0); - ret = pFoldStringW(MAP_EXPAND_LIGATURES, src, -1, dst, 256); - EXPECT_LEN(2); EXPECT_VALID; - ok(dst[0] == src[0], - "MAP_EXPAND_LIGATURES: 0x%02x : Expected 0x%02x, got 0x%02x\n", - i, src[0], dst[0]); - } - } - - /* FIXME: MAP_PRECOMPOSED : MAP_COMPOSITE */ -} - - - -#define LCID_OK(l) \ - ok(lcid == l, "Expected lcid = %08lx, got %08lx\n", l, lcid) -#define MKLCID(x,y,z) MAKELCID(MAKELANGID(x, y), z) -#define LCID_RES(src, res) lcid = ConvertDefaultLocale(src); LCID_OK(res) -#define TEST_LCIDLANG(a,b) LCID_RES(MAKELCID(a,b), MAKELCID(a,b)) -#define TEST_LCID(a,b,c) LCID_RES(MKLCID(a,b,c), MKLCID(a,b,c)) - -static void test_ConvertDefaultLocale(void) -{ - LCID lcid; - - /* Doesn't change lcid, even if non default sublang/sort used */ - TEST_LCID(LANG_ENGLISH, SUBLANG_ENGLISH_US, SORT_DEFAULT); - TEST_LCID(LANG_ENGLISH, SUBLANG_ENGLISH_UK, SORT_DEFAULT); - TEST_LCID(LANG_JAPANESE, SUBLANG_DEFAULT, SORT_DEFAULT); - TEST_LCID(LANG_JAPANESE, SUBLANG_DEFAULT, SORT_JAPANESE_UNICODE); - - /* SUBLANG_NEUTRAL -> SUBLANG_DEFAULT */ - LCID_RES(MKLCID(LANG_ENGLISH, SUBLANG_NEUTRAL, SORT_DEFAULT), - MKLCID(LANG_ENGLISH, SUBLANG_DEFAULT, SORT_DEFAULT)); - LCID_RES(MKLCID(LANG_JAPANESE, SUBLANG_NEUTRAL, SORT_DEFAULT), - MKLCID(LANG_JAPANESE, SUBLANG_DEFAULT, SORT_DEFAULT)); - LCID_RES(MKLCID(LANG_JAPANESE, SUBLANG_NEUTRAL, SORT_JAPANESE_UNICODE), - MKLCID(LANG_JAPANESE, SUBLANG_DEFAULT, SORT_JAPANESE_UNICODE)); - - /* Invariant language is not treated specially */ - TEST_LCID(LANG_INVARIANT, SUBLANG_DEFAULT, SORT_DEFAULT); - LCID_RES(MKLCID(LANG_INVARIANT, SUBLANG_NEUTRAL, SORT_DEFAULT), - MKLCID(LANG_INVARIANT, SUBLANG_DEFAULT, SORT_DEFAULT)); - - /* User/system default languages alone are not mapped */ - TEST_LCIDLANG(LANG_SYSTEM_DEFAULT, SORT_JAPANESE_UNICODE); - TEST_LCIDLANG(LANG_USER_DEFAULT, SORT_JAPANESE_UNICODE); - - /* Default lcids */ - LCID_RES(LOCALE_SYSTEM_DEFAULT, GetSystemDefaultLCID()); - LCID_RES(LOCALE_USER_DEFAULT, GetUserDefaultLCID()); - LCID_RES(LOCALE_NEUTRAL, GetUserDefaultLCID()); -} - -static BOOL CALLBACK langgrp_procA(LGRPID lgrpid, LPSTR lpszNum, LPSTR lpszName, - DWORD dwFlags, LONG_PTR lParam) -{ - trace("%08lx, %s, %s, %08lx, %08lx\n", - lgrpid, lpszNum, lpszName, dwFlags, lParam); - - ok(pIsValidLanguageGroup(lgrpid, dwFlags) == TRUE, - "Enumerated grp %ld not valid (flags %ld)\n", lgrpid, dwFlags); - - /* If lParam is one, we are calling with flags defaulted from 0 */ - ok(!lParam || (dwFlags == LGRPID_INSTALLED || dwFlags == LGRPID_SUPPORTED), - "Expected dwFlags == LGRPID_INSTALLED || dwFlags == LGRPID_SUPPORTED, got %ld\n", dwFlags); - - return TRUE; -} - -static void test_EnumSystemLanguageGroupsA(void) -{ - if (!pEnumSystemLanguageGroupsA || !pIsValidLanguageGroup) - return; - - /* No enumeration proc */ - SetLastError(0); - pEnumSystemLanguageGroupsA(0, LGRPID_INSTALLED, 0); - EXPECT_INVALID; - - /* Invalid flags */ - SetLastError(0); - pEnumSystemLanguageGroupsA(langgrp_procA, LGRPID_INSTALLED|LGRPID_SUPPORTED, 0); - EXPECT_FLAGS; - - /* No flags - defaults to LGRPID_INSTALLED */ - SetLastError(0); - pEnumSystemLanguageGroupsA(langgrp_procA, 0, 1); - EXPECT_VALID; - - pEnumSystemLanguageGroupsA(langgrp_procA, LGRPID_INSTALLED, 0); - pEnumSystemLanguageGroupsA(langgrp_procA, LGRPID_SUPPORTED, 0); -} - - -static BOOL CALLBACK lgrplocale_procA(LGRPID lgrpid, LCID lcid, LPSTR lpszNum, - LONG_PTR lParam) -{ - trace("%08lx, %08lx, %s, %08lx\n", lgrpid, lcid, lpszNum, lParam); - - ok(pIsValidLanguageGroup(lgrpid, LGRPID_SUPPORTED) == TRUE, - "Enumerated grp %ld not valid\n", lgrpid); - ok(IsValidLocale(lcid, LCID_SUPPORTED) == TRUE, - "Enumerated grp locale %ld not valid\n", lcid); - return TRUE; -} - -static void test_EnumLanguageGroupLocalesA(void) -{ - if (!pEnumLanguageGroupLocalesA || !pIsValidLanguageGroup) - return; - - /* No enumeration proc */ - SetLastError(0); - pEnumLanguageGroupLocalesA(0, LGRPID_WESTERN_EUROPE, 0, 0); - EXPECT_INVALID; - - /* lgrpid too small */ - SetLastError(0); - pEnumLanguageGroupLocalesA(lgrplocale_procA, 0, 0, 0); - EXPECT_INVALID; - - /* lgrpid too big */ - SetLastError(0); - pEnumLanguageGroupLocalesA(lgrplocale_procA, LGRPID_ARMENIAN + 1, 0, 0); - EXPECT_INVALID; - - /* dwFlags is reserved */ - SetLastError(0); - pEnumLanguageGroupLocalesA(0, LGRPID_WESTERN_EUROPE, 0x1, 0); - EXPECT_INVALID; - - pEnumLanguageGroupLocalesA(lgrplocale_procA, LGRPID_WESTERN_EUROPE, 0, 0); -} - -static void test_SetLocaleInfoA(void) -{ - BOOL bRet; - LCID lcid = GetUserDefaultLCID(); - - /* Null data */ - SetLastError(0); - bRet = SetLocaleInfoA(lcid, LOCALE_SDATE, 0); - EXPECT_INVALID; - - /* IDATE */ - SetLastError(0); - bRet = SetLocaleInfoA(lcid, LOCALE_IDATE, (LPSTR)test_SetLocaleInfoA); - EXPECT_FLAGS; - - /* ILDATE */ - SetLastError(0); - bRet = SetLocaleInfoA(lcid, LOCALE_ILDATE, (LPSTR)test_SetLocaleInfoA); - EXPECT_FLAGS; -} - -START_TEST(locale) -{ - InitFunctionPointers(); - -#if 0 - test_EnumTimeFormats(); -#endif - test_GetLocaleInfoA(); - test_GetTimeFormatA(); - test_GetDateFormatA(); - test_GetDateFormatW(); - test_GetCurrencyFormatA(); /* Also tests the W version */ - test_GetNumberFormatA(); /* Also tests the W version */ - test_CompareStringA(); - test_LCMapStringA(); - test_LCMapStringW(); - test_FoldStringA(); - test_FoldStringW(); - test_ConvertDefaultLocale(); - test_EnumSystemLanguageGroupsA(); - test_EnumLanguageGroupLocalesA(); - test_SetLocaleInfoA(); -#if 0 /* this requires collation table patch to make it MS compatible */ - test_sorting(); -#endif -} diff --git a/reactos/apps/tests/kernel32/mailslot.c b/reactos/apps/tests/kernel32/mailslot.c deleted file mode 100644 index 27f1d61b405..00000000000 --- a/reactos/apps/tests/kernel32/mailslot.c +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Mailslot regression test - * - * Copyright 2003 Mike McCormack - * - * 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 - -#ifndef STANDALONE -#include "wine/test.h" -#else -#define START_TEST(name) main(int argc, char **argv) - -#define ok(cond,str) do{ if(!(cond)) printf("line %d: %s\n",__LINE__,str); }while (0) -#define todo_wine - -#endif - -static const char szmspath[] = "\\\\.\\mailslot\\wine_mailslot_test"; - -static int mailslot_test() -{ - HANDLE hSlot, hSlot2, hWriter, hWriter2; - unsigned char buffer[16]; - DWORD count, dwMax, dwNext, dwMsgCount, dwTimeout; - - /* sanity check on GetMailslotInfo */ - dwMax = dwNext = dwMsgCount = dwTimeout = 0; - ok( !GetMailslotInfo( INVALID_HANDLE_VALUE, &dwMax, &dwNext, - &dwMsgCount, &dwTimeout ), "getmailslotinfo succeeded\n"); - - /* open a mailslot that doesn't exist */ - hWriter = CreateFile(szmspath, GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); - ok( hWriter == INVALID_HANDLE_VALUE, "non-existing mailslot\n"); - - /* open a mailslot without the right name */ - hSlot = CreateMailslot( "blah", 0, 0, NULL ); - ok( hSlot == INVALID_HANDLE_VALUE, - "Created mailslot with invalid name\n"); - todo_wine - { - ok( GetLastError() == ERROR_INVALID_NAME, - "error should be ERROR_INVALID_NAME\n"); - } - - /* open a mailslot with a null name */ - hSlot = CreateMailslot( NULL, 0, 0, NULL ); - ok( hSlot == INVALID_HANDLE_VALUE, - "Created mailslot with invalid name\n"); - todo_wine - { - ok( GetLastError() == ERROR_PATH_NOT_FOUND, - "error should be ERROR_PATH_NOT_FOUND\n"); - } - - todo_wine - { - /* valid open, but with wacky parameters ... then check them */ - hSlot = CreateMailslot( szmspath, -1, -1, NULL ); - ok( hSlot != INVALID_HANDLE_VALUE , "mailslot with valid name failed\n"); - dwMax = dwNext = dwMsgCount = dwTimeout = 0; - ok( GetMailslotInfo( hSlot, &dwMax, &dwNext, &dwMsgCount, &dwTimeout ), - "getmailslotinfo failed\n"); - ok( dwMax == -1, "dwMax incorrect\n"); - ok( dwNext == MAILSLOT_NO_MESSAGE, "dwNext incorrect\n"); - } - ok( dwMsgCount == 0, "dwMsgCount incorrect\n"); - todo_wine - { - ok( dwTimeout == -1, "dwTimeout incorrect\n"); - ok( GetMailslotInfo( hSlot, NULL, NULL, NULL, NULL ), - "getmailslotinfo failed\n"); - ok( CloseHandle(hSlot), "failed to close mailslot\n"); - } - - todo_wine - { - /* now open it for real */ - hSlot = CreateMailslot( szmspath, 0, 0, NULL ); - ok( hSlot != INVALID_HANDLE_VALUE , "valid mailslot failed\n"); - } - - /* try and read/write to it */ - count = 0; - memset(buffer, 0, sizeof buffer); - ok( !ReadFile( hSlot, buffer, sizeof buffer, &count, NULL), - "slot read\n"); - ok( !WriteFile( hSlot, buffer, sizeof buffer, &count, NULL), - "slot write\n"); - - /* now try and openthe client, but with the wrong sharing mode */ - hWriter = CreateFile(szmspath, GENERIC_READ|GENERIC_WRITE, - 0, NULL, OPEN_EXISTING, 0, NULL); - ok( hWriter == INVALID_HANDLE_VALUE, "bad sharing mode\n"); - todo_wine - { - ok( GetLastError() == ERROR_SHARING_VIOLATION, - "error should be ERROR_SHARING_VIOLATION\n"); - - /* now open the client with the correct sharing mode */ - hWriter = CreateFile(szmspath, GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); - ok( hWriter != INVALID_HANDLE_VALUE, "existing mailslot\n"); - } - - /* - * opening a client should make no difference to - * whether we can read or write the mailslot - */ - ok( !ReadFile( hSlot, buffer, sizeof buffer/2, &count, NULL), - "slot read\n"); - ok( !WriteFile( hSlot, buffer, sizeof buffer/2, &count, NULL), - "slot write\n"); - - /* - * we can't read from this client, - * but we should be able to write to it - */ - ok( !ReadFile( hWriter, buffer, sizeof buffer/2, &count, NULL), - "can read client\n"); - todo_wine - { - ok( WriteFile( hWriter, buffer, sizeof buffer/2, &count, NULL), - "can't write client\n"); - } - ok( !ReadFile( hWriter, buffer, sizeof buffer/2, &count, NULL), - "can read client\n"); - - /* - * seeing as there's something in the slot, - * we should be able to read it once - */ - todo_wine - { - ok( ReadFile( hSlot, buffer, sizeof buffer, &count, NULL), - "slot read\n"); - ok( count == (sizeof buffer/2), "short read\n" ); - } - - /* but not again */ - ok( !ReadFile( hSlot, buffer, sizeof buffer, &count, NULL), - "slot read\n"); - - /* now try open another writer... should fail */ - hWriter2 = CreateFile(szmspath, GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); - ok( hWriter2 == INVALID_HANDLE_VALUE, "two writers\n"); - - /* now try open another as a reader ... also fails */ - hWriter2 = CreateFile(szmspath, GENERIC_READ, - FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); - ok( hWriter2 == INVALID_HANDLE_VALUE, "writer + reader\n"); - - /* now try open another as a writer ... still fails */ - hWriter2 = CreateFile(szmspath, GENERIC_WRITE, - FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); - ok( hWriter2 == INVALID_HANDLE_VALUE, "writer\n"); - - /* now open another one */ - hSlot2 = CreateMailslot( szmspath, 0, 0, NULL ); - ok( hSlot2 == INVALID_HANDLE_VALUE , "opened two mailslots\n"); - - todo_wine - { - /* close the client again */ - ok( CloseHandle( hWriter ), "closing the client\n"); - - /* - * now try reopen it with slightly different permissions ... - * shared writing - */ - hWriter = CreateFile(szmspath, GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); - ok( hWriter != INVALID_HANDLE_VALUE, "sharing writer\n"); - } - - /* - * now try open another as a writer ... - * but don't share with the first ... fail - */ - hWriter2 = CreateFile(szmspath, GENERIC_WRITE, - FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); - ok( hWriter2 == INVALID_HANDLE_VALUE, "greedy writer succeeded\n"); - - todo_wine - { - /* now try open another as a writer ... and share with the first */ - hWriter2 = CreateFile(szmspath, GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); - ok( hWriter2 != INVALID_HANDLE_VALUE, "2nd sharing writer\n"); - - /* check the mailslot info */ - dwMax = dwNext = dwMsgCount = dwTimeout = 0; - ok( GetMailslotInfo( hSlot, &dwMax, &dwNext, &dwMsgCount, &dwTimeout ), - "getmailslotinfo failed\n"); - ok( dwNext == MAILSLOT_NO_MESSAGE, "dwNext incorrect\n"); - } - ok( dwMax == 0, "dwMax incorrect\n"); - ok( dwMsgCount == 0, "dwMsgCount incorrect\n"); - ok( dwTimeout == 0, "dwTimeout incorrect\n"); - - /* check there's still no data */ - ok( !ReadFile( hSlot, buffer, sizeof buffer, &count, NULL), "slot read\n"); - - /* write two messages */ - todo_wine - { - buffer[0] = 'a'; - ok( WriteFile( hWriter, buffer, 1, &count, NULL), "1st write failed\n"); - - /* check the mailslot info */ - dwNext = dwMsgCount = 0; - ok( GetMailslotInfo( hSlot, NULL, &dwNext, &dwMsgCount, NULL ), - "getmailslotinfo failed\n"); - ok( dwNext == 1, "dwNext incorrect\n"); - ok( dwMsgCount == 1, "dwMsgCount incorrect\n"); - - buffer[0] = 'b'; - buffer[1] = 'c'; - ok( WriteFile( hWriter2, buffer, 2, &count, NULL), "2nd write failed\n"); - - /* check the mailslot info */ - dwNext = dwMsgCount = 0; - ok( GetMailslotInfo( hSlot, NULL, &dwNext, &dwMsgCount, NULL ), - "getmailslotinfo failed\n"); - ok( dwNext == 1, "dwNext incorrect\n"); - ok( dwMsgCount == 2, "dwMsgCount incorrect\n"); - - /* write a 3rd message with zero size */ - ok( WriteFile( hWriter2, buffer, 0, &count, NULL), "3rd write failed\n"); - - /* check the mailslot info */ - dwNext = dwMsgCount = 0; - ok( GetMailslotInfo( hSlot, NULL, &dwNext, &dwMsgCount, NULL ), - "getmailslotinfo failed\n"); - ok( dwNext == 1, "dwNext incorrect\n"); - ok( dwMsgCount == 3, "dwMsgCount incorrect\n"); - - buffer[0]=buffer[1]=0; - - /* - * then check that they come out with the correct order and size, - * then the slot is empty - */ - ok( ReadFile( hSlot, buffer, sizeof buffer, &count, NULL), - "1st slot read failed\n"); - ok( count == 1, "failed to get 1st message\n"); - ok( buffer[0] == 'a', "1st message wrong\n"); - - /* check the mailslot info */ - dwNext = dwMsgCount = 0; - ok( GetMailslotInfo( hSlot, NULL, &dwNext, &dwMsgCount, NULL ), - "getmailslotinfo failed\n"); - ok( dwNext == 2, "dwNext incorrect\n"); - ok( dwMsgCount == 2, "dwMsgCount incorrect\n"); - - /* read the second message */ - ok( ReadFile( hSlot, buffer, sizeof buffer, &count, NULL), - "2nd slot read failed\n"); - ok( count == 2, "failed to get 2nd message\n"); - ok( ( buffer[0] == 'b' ) && ( buffer[1] == 'c' ), "2nd message wrong\n"); - - /* check the mailslot info */ - dwNext = dwMsgCount = 0; - ok( GetMailslotInfo( hSlot, NULL, &dwNext, &dwMsgCount, NULL ), - "getmailslotinfo failed\n"); - } - ok( dwNext == 0, "dwNext incorrect\n"); - todo_wine - { - ok( dwMsgCount == 1, "dwMsgCount incorrect\n"); - - /* read the 3rd (zero length) message */ - ok( ReadFile( hSlot, buffer, sizeof buffer, &count, NULL), - "3rd slot read failed\n"); - } - ok( count == 0, "failed to get 3rd message\n"); - - /* - * now there should be no more messages - * check the mailslot info - */ - todo_wine - { - dwNext = dwMsgCount = 0; - ok( GetMailslotInfo( hSlot, NULL, &dwNext, &dwMsgCount, NULL ), - "getmailslotinfo failed\n"); - ok( dwNext == MAILSLOT_NO_MESSAGE, "dwNext incorrect\n"); - } - ok( dwMsgCount == 0, "dwMsgCount incorrect\n"); - - /* check that reads fail */ - ok( !ReadFile( hSlot, buffer, sizeof buffer, &count, NULL), - "3rd slot read succeeded\n"); - - /* finally close the mailslot and its client */ - todo_wine - { - ok( CloseHandle( hWriter2 ), "closing 2nd client\n"); - ok( CloseHandle( hWriter ), "closing the client\n"); - ok( CloseHandle( hSlot ), "closing the mailslot\n"); - } - - return 0; -} - -START_TEST(mailslot) -{ - mailslot_test(); -} diff --git a/reactos/apps/tests/kernel32/path.c b/reactos/apps/tests/kernel32/path.c deleted file mode 100644 index 0f68989a63e..00000000000 --- a/reactos/apps/tests/kernel32/path.c +++ /dev/null @@ -1,924 +0,0 @@ -/* - * Unit test suite for Get*PathNamesA and (Get|Set)CurrentDirectoryA. - * - * Copyright 2002 Geoffrey Hausheer - * - * 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 "winuser.h" -#include "winerror.h" -#include "winnls.h" - -#define HAS_TRAIL_SLASH_A(string) (string[lstrlenA(string)-1]=='\\') - -#define LONGFILE "Long File test.path" -#define SHORTFILE "pathtest.pth" -#define SHORTDIR "shortdir" -#define LONGDIR "Long Directory" -#define NONFILE_SHORT "noexist.pth" -#define NONFILE_LONG "Non Existent File" -#define NONDIR_SHORT "notadir" -#define NONDIR_LONG "Non Existent Directory" - -#define NOT_A_VALID_DRIVE '@' - -/* the following characters don't work well with GetFullPathNameA - in Win98. I don't know if this is a FAT thing, or if it is an OS thing - but I don't test these characters now. - NOTE: Win2k allows GetFullPathNameA to work with them though - |<>" -*/ -static const CHAR funny_chars[]="!@#$%^&*()=+{}[],?'`"; -static const CHAR is_char_ok[] ="11111110111111111011"; - -static DWORD (WINAPI *pGetLongPathNameA)(LPCSTR,LPSTR,DWORD); - -/* a structure to deal with wine todos somewhat cleanly */ -typedef struct { - DWORD shortlen; - DWORD shorterror; - DWORD s2llen; - DWORD s2lerror; - DWORD longlen; - DWORD longerror; -} SLpassfail; - -/* function that tests GetFullPathNameA, GetShortPathNameA,GetLongPathNameA */ -/* NOTE: the passfail structure is used to allow cutomizeable todo checking - for wine. It is not very pretty, but it sure beats duplicating this - function lots of times -*/ -static void test_ValidPathA(CHAR *curdir, CHAR *subdir, CHAR *filename, - CHAR *shortstr, SLpassfail *passfail, CHAR *errstr) { - CHAR tmpstr[MAX_PATH], - fullpath[MAX_PATH], /*full path to the file (not short/long) */ - subpath[MAX_PATH], /*relative path to the file */ - fullpathshort[MAX_PATH], /*absolue path to the file (short format) */ - fullpathlong[MAX_PATH], /*absolute path to the file (long format) */ - curdirshort[MAX_PATH], /*absolute path to the current dir (short) */ - curdirlong[MAX_PATH]; /*absolute path to the current dir (long) */ - LPSTR strptr; /*ptr to the filename portion of the path */ - DWORD len; -/* if passfail is NULL, we can perform all checks within this function, - otherwise, we will return the relevant data in the passfail struct, so - we must initialize it first -*/ - if(passfail!=NULL) { - passfail->shortlen=-1;passfail->s2llen=-1;passfail->longlen=-1; - passfail->shorterror=0;passfail->s2lerror=0;passfail->longerror=0; - } -/* GetLongPathNameA is only supported on Win2k+ and Win98+ */ - if(pGetLongPathNameA) { - ok((len=pGetLongPathNameA(curdir,curdirlong,MAX_PATH)), - "%s: GetLongPathNameA failed\n",errstr); -/*GetLongPathNameA can return a trailing '\\' but shouldn't do so here */ - ok(! HAS_TRAIL_SLASH_A(curdirlong), - "%s: GetLongPathNameA should not have a trailing \\\n",errstr); - } - ok((len=GetShortPathNameA(curdir,curdirshort,MAX_PATH)), - "%s: GetShortPathNameA failed\n",errstr); -/*GetShortPathNameA can return a trailing '\\' but shouldn't do so here */ - ok(! HAS_TRAIL_SLASH_A(curdirshort), - "%s: GetShortPathNameA should not have a trailing \\\n",errstr); -/* build relative and absolute paths from inputs */ - if(lstrlenA(subdir)) { - sprintf(subpath,"%s\\%s",subdir,filename); - } else { - lstrcpyA(subpath,filename); - } - sprintf(fullpath,"%s\\%s",curdir,subpath); - sprintf(fullpathshort,"%s\\%s",curdirshort,subpath); - sprintf(fullpathlong,"%s\\%s",curdirlong,subpath); -/* Test GetFullPathNameA functionality */ - len=GetFullPathNameA(subpath,MAX_PATH,tmpstr,&strptr); - ok(len, "GetFullPathNameA failed for: '%s'\n",subpath); - if(HAS_TRAIL_SLASH_A(subpath)) { - ok(strptr==NULL, - "%s: GetFullPathNameA should not return a filename ptr\n",errstr); - ok(lstrcmpiA(fullpath,tmpstr)==0, - "%s: GetFullPathNameA returned '%s' instead of '%s'\n", - errstr,tmpstr,fullpath); - } else { - ok(lstrcmpiA(strptr,filename)==0, - "%s: GetFullPathNameA returned '%s' instead of '%s'\n", - errstr,strptr,filename); - ok(lstrcmpiA(fullpath,tmpstr)==0, - "%s: GetFullPathNameA returned '%s' instead of '%s'\n", - errstr,tmpstr,fullpath); - } -/* Test GetShortPathNameA functionality */ - SetLastError(0); - len=GetShortPathNameA(fullpathshort,shortstr,MAX_PATH); - if(passfail==NULL) { - ok(len, "%s: GetShortPathNameA failed\n",errstr); - } else { - passfail->shortlen=len; - passfail->shorterror=GetLastError(); - } -/* Test GetLongPathNameA functionality - We test both conversion from GetFullPathNameA and from GetShortPathNameA -*/ - if(pGetLongPathNameA) { - if(len!=0) { - SetLastError(0); - len=pGetLongPathNameA(shortstr,tmpstr,MAX_PATH); - if(passfail==NULL) { - ok(len, - "%s: GetLongPathNameA failed during Short->Long conversion\n", errstr); - ok(lstrcmpiA(fullpathlong,tmpstr)==0, - "%s: GetLongPathNameA returned '%s' instead of '%s'\n", - errstr,tmpstr,fullpathlong); - } else { - passfail->s2llen=len; - passfail->s2lerror=GetLastError(); - } - } - SetLastError(0); - len=pGetLongPathNameA(fullpath,tmpstr,MAX_PATH); - if(passfail==NULL) { - ok(len, "%s: GetLongPathNameA failed\n",errstr); - if(HAS_TRAIL_SLASH_A(fullpath)) { - ok(lstrcmpiA(fullpathlong,tmpstr)==0, - "%s: GetLongPathNameA returned '%s' instead of '%s'\n", - errstr,tmpstr,fullpathlong); - } else { - ok(lstrcmpiA(fullpathlong,tmpstr)==0, - "%s: GetLongPathNameA returned '%s' instead of '%s'\n", - errstr,tmpstr,fullpathlong); - } - } else { - passfail->longlen=len; - passfail->longerror=GetLastError(); - } - } -} - -/* split path into leading directory, and 8.3 filename */ -static void test_SplitShortPathA(CHAR *path,CHAR *dir,CHAR *eight,CHAR *three) { - int done,error; - int ext,fil; - int len,i; - len=lstrlenA(path); - ext=len; fil=len; done=0; error=0; -/* walk backwards over path looking for '.' or '\\' separators */ - for(i=len-1;(i>=0) && (!done);i--) { - if(path[i]=='.') - if(ext!=len) error=1; else ext=i; - else if(path[i]=='\\') { - if(i==len-1) { - error=1; - } else { - fil=i; - done=1; - } - } - } -/* Check that we didn't find a trailing '\\' or multiple '.' */ - ok(!error,"Illegal file found in 8.3 path '%s'\n",path); -/* Separate dir, root, and extension */ - if(ext!=len) lstrcpyA(three,path+ext+1); else lstrcpyA(three,""); - if(fil!=len) { - lstrcpynA(eight,path+fil+1,ext-fil); - lstrcpynA(dir,path,fil+1); - } else { - lstrcpynA(eight,path,ext+1); - lstrcpyA(dir,""); - } -/* Validate that root and extension really are 8.3 */ - ok(lstrlenA(eight)<=8 && lstrlenA(three)<=3, - "GetShortPathNAmeA did not return an 8.3 path\n"); -} - -/* Check that GetShortPathNameA returns a valid 8.3 path */ -static void test_LongtoShortA(CHAR *teststr,CHAR *goodstr, - CHAR *ext,CHAR *errstr) { - CHAR dir[MAX_PATH],eight[MAX_PATH],three[MAX_PATH]; - - test_SplitShortPathA(teststr,dir,eight,three); - ok(lstrcmpiA(dir,goodstr)==0, - "GetShortPathNameA returned '%s' instead of '%s'\n",dir,goodstr); - ok(lstrcmpiA(three,ext)==0, - "GetShortPathNameA returned '%s' with incorrect extension\n",three); -} - -/* Test that Get(Short|Long|Full)PathNameA work correctly with interesting - characters in the filename. - 'valid' indicates whether this would be an allowed filename - 'todo' indicates that wine doesn't get this right yet. - NOTE: We always call this routine with a non-existent filename, so - Get(Short|Long)PathNameA should never pass, but GetFullPathNameA - should. -*/ -static void test_FunnyChars(CHAR *curdir,CHAR *filename, INT valid,CHAR *errstr) -{ - CHAR tmpstr[MAX_PATH],tmpstr1[MAX_PATH]; - SLpassfail passfail; - - test_ValidPathA(curdir,"",filename,tmpstr,&passfail,errstr); - if(valid) { - sprintf(tmpstr1,"%s\\%s",curdir,filename); - ok((passfail.shortlen==0 && - (passfail.shorterror==ERROR_FILE_NOT_FOUND || passfail.shorterror==ERROR_PATH_NOT_FOUND || !passfail.shorterror)) || - (passfail.shortlen==strlen(tmpstr1) && lstrcmpiA(tmpstr,tmpstr1)==0), - "%s: GetShortPathNameA error: len=%ld error=%ld tmpstr=[%s]\n", - errstr,passfail.shortlen,passfail.shorterror,tmpstr); - } else { - ok(passfail.shortlen==0 && - (passfail.shorterror==ERROR_INVALID_NAME || passfail.shorterror==ERROR_FILE_NOT_FOUND || !passfail.shorterror), - "%s: GetShortPathA should have failed len=%ld, error=%ld\n", - errstr,passfail.shortlen,passfail.shorterror); - } - if(pGetLongPathNameA) { - ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have\n"); - if(valid) { - ok(passfail.longerror==ERROR_FILE_NOT_FOUND, - "%s: GetLongPathA returned %ld and not %d\n", - errstr,passfail.longerror,ERROR_FILE_NOT_FOUND); - } else { - ok(passfail.longerror==ERROR_INVALID_NAME || - passfail.longerror==ERROR_FILE_NOT_FOUND, - "%s: GetLongPathA returned %ld and not %d or %d'\n", - errstr, passfail.longerror,ERROR_INVALID_NAME,ERROR_FILE_NOT_FOUND); - } - } -} - -/* Routine to test that SetCurrentDirectory behaves as expected. */ -static void test_setdir(CHAR *olddir,CHAR *newdir, - CHAR *cmprstr, INT pass,CHAR *errstr) -{ - CHAR tmppath[MAX_PATH], *dirptr; - DWORD val,len,chklen; - - val=SetCurrentDirectoryA(newdir); - len=GetCurrentDirectoryA(MAX_PATH,tmppath); -/* if 'pass' then the SetDirectoryA was supposed to pass */ - if(pass) { - dirptr=(cmprstr==NULL) ? newdir : cmprstr; - chklen=lstrlenA(dirptr); - ok(val,"%s: SetCurrentDirectoryA failed\n",errstr); - ok(len==chklen, - "%s: SetCurrentDirectory did not change the directory, though it passed\n", - errstr); - ok(lstrcmpiA(dirptr,tmppath)==0, - "%s: SetCurrentDirectory did not change the directory, though it passed\n", - errstr); - ok(SetCurrentDirectoryA(olddir), - "%s: Couldn't set directory to it's original value\n",errstr); - } else { -/* else thest that it fails correctly */ - chklen=lstrlenA(olddir); - ok(val==0, - "%s: SetCurrentDirectoryA passed when it should have failed\n",errstr); - ok(len==chklen, - "%s: SetCurrentDirectory changed the directory, though it failed\n", - errstr); - ok(lstrcmpiA(olddir,tmppath)==0, - "%s: SetCurrentDirectory changed the directory, though it failed\n", - errstr); - } -} -static void test_InitPathA(CHAR *newdir, CHAR *curDrive, CHAR *otherDrive) -{ - CHAR tmppath[MAX_PATH], /*path to TEMP */ - tmpstr[MAX_PATH], - tmpstr1[MAX_PATH]; - DWORD len,len1,drives; - INT id; - HANDLE hndl; - - *curDrive = *otherDrive = NOT_A_VALID_DRIVE; - -/* Get the current drive letter */ - if( GetCurrentDirectoryA( MAX_PATH, tmpstr)) - *curDrive = tmpstr[0]; - else - trace( "Unable to discover current drive, some tests will not be conducted.\n"); - -/* Test GetTempPathA */ - len=GetTempPathA(MAX_PATH,tmppath); - ok(len!=0 && len < MAX_PATH,"GetTempPathA failed\n"); - ok(HAS_TRAIL_SLASH_A(tmppath), - "GetTempPathA returned a path that did not end in '\\'\n"); - lstrcpyA(tmpstr,"aaaaaaaa"); - len1=GetTempPathA(len,tmpstr); - ok(len1==len+1, - "GetTempPathA should return string length %ld instead of %ld\n",len+1,len1); - -/* Test GetTmpFileNameA - The only test we do here is whether GetTempFileNameA passes or not. - We do not thoroughly test this function yet (specifically, whether - it behaves correctly when 'unique' is non zero) -*/ - ok((id=GetTempFileNameA(tmppath,"path",0,newdir)),"GetTempFileNameA failed\n"); - sprintf(tmpstr,"pat%.4x.tmp",id & 0xffff); - sprintf(tmpstr1,"pat%x.tmp",id & 0xffff); - ok(lstrcmpiA(newdir+lstrlenA(tmppath),tmpstr)==0 || - lstrcmpiA(newdir+lstrlenA(tmppath),tmpstr1)==0, - "GetTempPath returned '%s' which doesn't match '%s' or '%s'. id=%x\n", - newdir,tmpstr,tmpstr1,id); - -/* Find first valid drive letter that is neither newdir[0] nor curDrive */ - drives = GetLogicalDrives() & ~(1<<(newdir[0]-'A')); - if( *curDrive != NOT_A_VALID_DRIVE) - drives &= ~(1<<(*curDrive-'A')); - if( drives) - for( *otherDrive='A'; (drives & 1) == 0; drives>>=1, (*otherDrive)++); - else - trace( "Could not find alternative drive, some tests will not be conducted.\n"); - -/* Do some CreateDirectoryA tests */ -/* It would be nice to do test the SECURITY_ATTRIBUTES, but I don't - really understand how they work. - More formal tests should be done along with CreateFile tests -*/ - ok(CreateDirectoryA(newdir,NULL)==0, - "CreateDirectoryA succeeded even though a file of the same name exists\n"); - ok(DeleteFileA(newdir),"Couldn't delete the temporary file we just created\n"); - ok(CreateDirectoryA(newdir,NULL),"CreateDirectoryA failed\n"); -/* Create some files to test other functions. Note, we will test CreateFileA - at some later point -*/ - sprintf(tmpstr,"%s\\%s",newdir,SHORTDIR); - ok(CreateDirectoryA(tmpstr,NULL),"CreateDirectoryA failed\n"); - sprintf(tmpstr,"%s\\%s",newdir,LONGDIR); - ok(CreateDirectoryA(tmpstr,NULL),"CreateDirectoryA failed\n"); - sprintf(tmpstr,"%s\\%s\\%s",newdir,SHORTDIR,SHORTFILE); - hndl=CreateFileA(tmpstr,GENERIC_WRITE,0,NULL, - CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL); - ok(hndl!=INVALID_HANDLE_VALUE,"CreateFileA failed\n"); - ok(CloseHandle(hndl),"CloseHandle failed\n"); - sprintf(tmpstr,"%s\\%s\\%s",newdir,SHORTDIR,LONGFILE); - hndl=CreateFileA(tmpstr,GENERIC_WRITE,0,NULL, - CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL); - ok(hndl!=INVALID_HANDLE_VALUE,"CreateFileA failed\n"); - ok(CloseHandle(hndl),"CloseHandle failed\n"); - sprintf(tmpstr,"%s\\%s\\%s",newdir,LONGDIR,SHORTFILE); - hndl=CreateFileA(tmpstr,GENERIC_WRITE,0,NULL, - CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL); - ok(hndl!=INVALID_HANDLE_VALUE,"CreateFileA failed\n"); - ok(CloseHandle(hndl),"CloseHandle failed\n"); - sprintf(tmpstr,"%s\\%s\\%s",newdir,LONGDIR,LONGFILE); - hndl=CreateFileA(tmpstr,GENERIC_WRITE,0,NULL, - CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL); - ok(hndl!=INVALID_HANDLE_VALUE,"CreateFileA failed\n"); - ok(CloseHandle(hndl),"CloseHandle failed\n"); -} - -/* Test GetCurrentDirectory & SetCurrentDirectory */ -static void test_CurrentDirectoryA(CHAR *origdir, CHAR *newdir) -{ - CHAR tmpstr[MAX_PATH],tmpstr1[MAX_PATH]; - DWORD len,len1; -/* Save the original directory, so that we can return to it at the end - of the test -*/ - len=GetCurrentDirectoryA(MAX_PATH,origdir); - ok(len!=0 && len < MAX_PATH,"GetCurrentDirectoryA failed\n"); - ok(lstrcmpiA(origdir+(len-1),"\\")!=0, - "GetCurrentDirectoryA should not have a trailing \\\n"); -/* Make sure that CetCurrentDirectoryA doesn't overwrite the buffer when the - buffer size is too small to hold the current directory -*/ - lstrcpyA(tmpstr,"aaaaaaa"); - len1=GetCurrentDirectoryA(len,tmpstr); - ok(len1==len+1, "GetCurrentDirectoryA returned %ld instead of %ld\n",len1,len+1); - ok(lstrcmpiA(tmpstr,"aaaaaaa")==0, - "GetCurrentDirectoryA should not have modified the buffer\n"); -/* SetCurrentDirectoryA shouldn't care whether the string has a - trailing '\\' or not -*/ - sprintf(tmpstr,"%s\\",newdir); - test_setdir(origdir,tmpstr,newdir,1,"check 1"); - test_setdir(origdir,newdir,NULL,1,"check 2"); -/* Set the directory to the working area. We just tested that this works, - so why check it again. -*/ - SetCurrentDirectoryA(newdir); -/* Check that SetCurrentDirectory fails when a non-existent dir is specified */ - sprintf(tmpstr,"%s\\%s\\%s",newdir,SHORTDIR,NONDIR_SHORT); - test_setdir(newdir,tmpstr,NULL,0,"check 3"); -/* Check that SetCurrentDirectory fails for a non-existent lond directory */ - sprintf(tmpstr,"%s\\%s\\%s",newdir,SHORTDIR,NONDIR_LONG); - test_setdir(newdir,tmpstr,NULL,0,"check 4"); -/* Check that SetCurrentDirectory passes with a long directory */ - sprintf(tmpstr,"%s\\%s",newdir,LONGDIR); - test_setdir(newdir,tmpstr,NULL,1,"check 5"); -/* Check that SetCurrentDirectory passes with a short relative directory */ - sprintf(tmpstr,"%s",SHORTDIR); - sprintf(tmpstr1,"%s\\%s",newdir,SHORTDIR); - test_setdir(newdir,tmpstr,tmpstr1,1,"check 6"); -/* starting with a '.' */ - sprintf(tmpstr,".\\%s",SHORTDIR); - test_setdir(newdir,tmpstr,tmpstr1,1,"check 7"); -/* Check that SetCurrentDirectory passes with a short relative directory */ - sprintf(tmpstr,"%s",LONGDIR); - sprintf(tmpstr1,"%s\\%s",newdir,LONGDIR); - test_setdir(newdir,tmpstr,tmpstr1,1,"check 8"); -/* starting with a '.' */ - sprintf(tmpstr,".\\%s",LONGDIR); - test_setdir(newdir,tmpstr,tmpstr1,1,"check 9"); -} - -/* Cleanup the mess we made while executing these tests */ -static void test_CleanupPathA(CHAR *origdir, CHAR *curdir) -{ - CHAR tmpstr[MAX_PATH]; - sprintf(tmpstr,"%s\\%s\\%s",curdir,SHORTDIR,SHORTFILE); - ok(DeleteFileA(tmpstr),"DeleteFileA failed\n"); - sprintf(tmpstr,"%s\\%s\\%s",curdir,SHORTDIR,LONGFILE); - ok(DeleteFileA(tmpstr),"DeleteFileA failed\n"); - sprintf(tmpstr,"%s\\%s\\%s",curdir,LONGDIR,SHORTFILE); - ok(DeleteFileA(tmpstr),"DeleteFileA failed\n"); - sprintf(tmpstr,"%s\\%s\\%s",curdir,LONGDIR,LONGFILE); - ok(DeleteFileA(tmpstr),"DeleteFileA failed\n"); - sprintf(tmpstr,"%s\\%s",curdir,SHORTDIR); - ok(RemoveDirectoryA(tmpstr),"RemoveDirectoryA failed\n"); - sprintf(tmpstr,"%s\\%s",curdir,LONGDIR); - ok(RemoveDirectoryA(tmpstr),"RemoveDirectoryA failed\n"); - ok(SetCurrentDirectoryA(origdir),"SetCurrentDirectoryA failed\n"); - ok(RemoveDirectoryA(curdir),"RemoveDirectoryA failed\n"); -} - -/* This routine will test Get(Full|Short|Long)PathNameA */ -static void test_PathNameA(CHAR *curdir, CHAR curDrive, CHAR otherDrive) -{ - CHAR curdir_short[MAX_PATH], - longdir_short[MAX_PATH]; - CHAR tmpstr[MAX_PATH],tmpstr1[MAX_PATH],tmpstr2[MAX_PATH]; - LPSTR strptr; /*ptr to the filename portion of the path */ - DWORD len; - INT i; - CHAR dir[MAX_PATH],eight[MAX_PATH],three[MAX_PATH]; - SLpassfail passfail; - -/* Get the short form of the current directory */ - ok((len=GetShortPathNameA(curdir,curdir_short,MAX_PATH)), - "GetShortPathNameA failed\n"); - ok(!HAS_TRAIL_SLASH_A(curdir_short), - "GetShortPathNameA should not have a trailing \\\n"); -/* Get the short form of the absolute-path to LONGDIR */ - sprintf(tmpstr,"%s\\%s",curdir_short,LONGDIR); - ok((len=GetShortPathNameA(tmpstr,longdir_short,MAX_PATH)), - "GetShortPathNameA failed\n"); - ok(lstrcmpiA(longdir_short+(len-1),"\\")!=0, - "GetShortPathNameA should not have a trailing \\\n"); - - if (pGetLongPathNameA) { - DWORD rc1,rc2; - sprintf(tmpstr,"%s\\%s\\%s",curdir,LONGDIR,LONGFILE); - rc1=(*pGetLongPathNameA)(tmpstr,NULL,0); - rc2=(*pGetLongPathNameA)(curdir,NULL,0); - ok((rc1-strlen(tmpstr))==(rc2-strlen(curdir)), - "GetLongPathNameA: wrong return code, %ld instead of %d\n", - rc1, strlen(tmpstr)+1); - - sprintf(dir,"%c:",curDrive); - rc1=(*pGetLongPathNameA)(dir,tmpstr,sizeof(tmpstr)); - ok(strcmp(dir,tmpstr)==0, - "GetLongPathNameA: returned '%s' instead of '%s' (rc=%ld)\n", - tmpstr,dir,rc1); - } - -/* Check the cases where both file and directory exist first */ -/* Start with a 8.3 directory, 8.3 filename */ - test_ValidPathA(curdir,SHORTDIR,SHORTFILE,tmpstr,NULL,"test1"); - sprintf(tmpstr1,"%s\\%s\\%s",curdir_short,SHORTDIR,SHORTFILE); - ok(lstrcmpiA(tmpstr,tmpstr1)==0, - "GetShortPathNameA returned '%s' instead of '%s'\n",tmpstr,tmpstr1); -/* Now try a 8.3 directory, long file name */ - test_ValidPathA(curdir,SHORTDIR,LONGFILE,tmpstr,NULL,"test2"); - sprintf(tmpstr1,"%s\\%s",curdir_short,SHORTDIR); - test_LongtoShortA(tmpstr,tmpstr1,"PAT","test2"); -/* Next is a long directory, 8.3 file */ - test_ValidPathA(curdir,LONGDIR,SHORTFILE,tmpstr,NULL,"test3"); - sprintf(tmpstr1,"%s\\%s",longdir_short,SHORTFILE); - ok(lstrcmpiA(tmpstr,tmpstr1)==0, - "GetShortPathNameA returned '%s' instead of '%s'\n",tmpstr,tmpstr1); -/*Lastly a long directory, long file */ - test_ValidPathA(curdir,LONGDIR,LONGFILE,tmpstr,NULL,"test4"); - test_LongtoShortA(tmpstr,longdir_short,"PAT","test4"); - -/* Now check all of the invalid file w/ valid directory combinations */ -/* Start with a 8.3 directory, 8.3 filename */ - test_ValidPathA(curdir,SHORTDIR,NONFILE_SHORT,tmpstr,&passfail,"test5"); - sprintf(tmpstr1,"%s\\%s\\%s",curdir_short,SHORTDIR,NONFILE_SHORT); - ok((passfail.shortlen==0 && - (passfail.shorterror==ERROR_PATH_NOT_FOUND || - passfail.shorterror==ERROR_FILE_NOT_FOUND)) || - (passfail.shortlen==strlen(tmpstr1) && lstrcmpiA(tmpstr,tmpstr1)==0), - "GetShortPathNameA error: len=%ld error=%ld tmpstr=[%s]\n", - passfail.shortlen,passfail.shorterror,tmpstr); - if(pGetLongPathNameA) { - ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have\n"); - ok(passfail.longerror==ERROR_FILE_NOT_FOUND, - "GetlongPathA should have returned 'ERROR_FILE_NOT_FOUND'\n"); - } -/* Now try a 8.3 directory, long file name */ - test_ValidPathA(curdir,SHORTDIR,NONFILE_LONG,tmpstr,&passfail,"test6"); - ok(passfail.shortlen==0,"GetShortPathNameA passed when it shouldn't have\n"); - ok(passfail.shorterror==ERROR_PATH_NOT_FOUND || - passfail.shorterror==ERROR_FILE_NOT_FOUND || - !passfail.shorterror, - "GetShortPathA should have returned 'ERROR_FILE_NOT_FOUND'\n"); - if(pGetLongPathNameA) { - ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have\n"); - ok(passfail.longerror==ERROR_FILE_NOT_FOUND, - "GetlongPathA should have returned 'ERROR_FILE_NOT_FOUND'\n"); - } -/* Next is a long directory, 8.3 file */ - test_ValidPathA(curdir,LONGDIR,NONFILE_SHORT,tmpstr,&passfail,"test7"); - sprintf(tmpstr2,"%s\\%s",curdir_short,LONGDIR); - GetShortPathNameA(tmpstr2,tmpstr1,MAX_PATH); - strcat(tmpstr1,"\\" NONFILE_SHORT); - ok((passfail.shortlen==0 && - (passfail.shorterror==ERROR_PATH_NOT_FOUND || - passfail.shorterror==ERROR_FILE_NOT_FOUND)) || - (passfail.shortlen==strlen(tmpstr1) && lstrcmpiA(tmpstr,tmpstr1)==0), - "GetShortPathNameA error: len=%ld error=%ld tmpstr=[%s]\n", - passfail.shortlen,passfail.shorterror,tmpstr); - if(pGetLongPathNameA) { - ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have\n"); - ok(passfail.longerror==ERROR_FILE_NOT_FOUND, - "GetlongPathA should have returned 'ERROR_FILE_NOT_FOUND'\n"); - } -/*Lastly a long directory, long file */ - test_ValidPathA(curdir,LONGDIR,NONFILE_LONG,tmpstr,&passfail,"test8"); - ok(passfail.shortlen==0,"GetShortPathNameA passed when it shouldn't have\n"); - ok(passfail.shorterror==ERROR_PATH_NOT_FOUND || - passfail.shorterror==ERROR_FILE_NOT_FOUND || - !passfail.shorterror, - "GetShortPathA should have returned 'ERROR_FILE_NOT_FOUND'\n"); - if(pGetLongPathNameA) { - ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have\n"); - ok(passfail.longerror==ERROR_FILE_NOT_FOUND, - "GetlongPathA should have returned 'ERROR_FILE_NOT_FOUND'\n"); - } -/* Now try again with directories that don't exist */ -/* 8.3 directory, 8.3 filename */ - test_ValidPathA(curdir,NONDIR_SHORT,SHORTFILE,tmpstr,&passfail,"test9"); - sprintf(tmpstr1,"%s\\%s\\%s",curdir_short,NONDIR_SHORT,SHORTFILE); - ok((passfail.shortlen==0 && - (passfail.shorterror==ERROR_PATH_NOT_FOUND || - passfail.shorterror==ERROR_FILE_NOT_FOUND)) || - (passfail.shortlen==strlen(tmpstr1) && lstrcmpiA(tmpstr,tmpstr1)==0), - "GetShortPathNameA error: len=%ld error=%ld tmpstr=[%s]\n", - passfail.shortlen,passfail.shorterror,tmpstr); - if(pGetLongPathNameA) { - ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have\n"); - ok(passfail.longerror==ERROR_PATH_NOT_FOUND || - passfail.longerror==ERROR_FILE_NOT_FOUND, - "GetLongPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'\n", - passfail.longerror); - } -/* Now try a 8.3 directory, long file name */ - test_ValidPathA(curdir,NONDIR_SHORT,LONGFILE,tmpstr,&passfail,"test10"); - ok(passfail.shortlen==0,"GetShortPathNameA passed when it shouldn't have\n"); - ok(passfail.shorterror==ERROR_PATH_NOT_FOUND || - passfail.shorterror==ERROR_FILE_NOT_FOUND || - !passfail.shorterror, - "GetShortPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'\n", - passfail.shorterror); - if(pGetLongPathNameA) { - ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have\n"); - ok(passfail.longerror==ERROR_PATH_NOT_FOUND || - passfail.longerror==ERROR_FILE_NOT_FOUND, - "GetLongPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'\n", - passfail.longerror); - } -/* Next is a long directory, 8.3 file */ - test_ValidPathA(curdir,NONDIR_LONG,SHORTFILE,tmpstr,&passfail,"test11"); - ok(passfail.shortlen==0,"GetShortPathNameA passed when it shouldn't have\n"); - ok(passfail.shorterror==ERROR_PATH_NOT_FOUND || - passfail.shorterror==ERROR_FILE_NOT_FOUND || - !passfail.shorterror, - "GetShortPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'\n", - passfail.shorterror); - if(pGetLongPathNameA) { - ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have\n"); - ok(passfail.longerror==ERROR_PATH_NOT_FOUND || - passfail.longerror==ERROR_FILE_NOT_FOUND, - "GetLongPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'\n", - passfail.longerror); - } -/*Lastly a long directory, long file */ - test_ValidPathA(curdir,NONDIR_LONG,LONGFILE,tmpstr,&passfail,"test12"); - ok(passfail.shortlen==0,"GetShortPathNameA passed when it shouldn't have\n"); - ok(passfail.shorterror==ERROR_PATH_NOT_FOUND || - passfail.shorterror==ERROR_FILE_NOT_FOUND || - !passfail.shorterror, - "GetShortPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'\n", - passfail.shorterror); - if(pGetLongPathNameA) { - ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have\n"); - ok(passfail.longerror==ERROR_PATH_NOT_FOUND || - passfail.longerror==ERROR_FILE_NOT_FOUND, - "GetLongPathA returned %ld and not 'ERROR_PATH_NOT_FOUND'\n", - passfail.longerror); - } -/* Next try directories ending with '\\' */ -/* Existing Directories */ - sprintf(tmpstr,"%s\\",SHORTDIR); - test_ValidPathA(curdir,"",tmpstr,tmpstr1,NULL,"test13"); - sprintf(tmpstr,"%s\\",LONGDIR); - test_ValidPathA(curdir,"",tmpstr,tmpstr1,NULL,"test14"); -/* Non-existent directories */ - sprintf(tmpstr,"%s\\",NONDIR_SHORT); - test_ValidPathA(curdir,"",tmpstr,tmpstr1,&passfail,"test15"); - sprintf(tmpstr2,"%s\\%s",curdir,tmpstr); - ok((passfail.shortlen==0 && - (passfail.shorterror==ERROR_PATH_NOT_FOUND || - passfail.shorterror==ERROR_FILE_NOT_FOUND)) || - (passfail.shortlen==strlen(tmpstr2) && lstrcmpiA(tmpstr1,tmpstr2)==0), - "GetShortPathNameA error: len=%ld error=%ld tmpstr=[%s]\n", - passfail.shortlen,passfail.shorterror,tmpstr); - if(pGetLongPathNameA) { - ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have\n"); - ok(passfail.longerror==ERROR_FILE_NOT_FOUND, - "GetLongPathA returned %ld and not 'ERROR_FILE_NOT_FOUND'\n", - passfail.longerror); - } - sprintf(tmpstr,"%s\\",NONDIR_LONG); - test_ValidPathA(curdir,"",tmpstr,tmpstr1,&passfail,"test16"); - ok(passfail.shortlen==0,"GetShortPathNameA passed when it shouldn't have\n"); - ok(passfail.shorterror==ERROR_PATH_NOT_FOUND || - passfail.shorterror==ERROR_FILE_NOT_FOUND || - !passfail.shorterror, - "GetShortPathA returned %ld and not 'ERROR_FILE_NOT_FOUND'\n", - passfail.shorterror); - if(pGetLongPathNameA) { - ok(passfail.longlen==0,"GetLongPathNameA passed when it shouldn't have\n"); - ok(passfail.longerror==ERROR_FILE_NOT_FOUND, - "GetLongPathA returned %ld and not 'ERROR_FILE_NOT_FOUND'\n", - passfail.longerror); - } -/* Test GetFullPathNameA with drive letters */ - if( curDrive != NOT_A_VALID_DRIVE) { - sprintf(tmpstr,"%c:",curdir[0]); - ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr2,&strptr), - "GetFullPathNameA(%c:) failed\n", curdir[0]); - GetCurrentDirectoryA(MAX_PATH,tmpstr); - sprintf(tmpstr1,"%s\\",tmpstr); - ok(lstrcmpiA(tmpstr,tmpstr2)==0 || lstrcmpiA(tmpstr1,tmpstr2)==0, - "GetFullPathNameA(%c:) returned '%s' instead of '%s' or '%s'\n", - curdir[0],tmpstr2,tmpstr,tmpstr1); - - sprintf(tmpstr,"%c:\\%s\\%s",curDrive,SHORTDIR,SHORTFILE); - ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr1,&strptr),"GetFullPathNameA failed\n"); - ok(lstrcmpiA(tmpstr,tmpstr1)==0, - "GetFullPathNameA returned '%s' instead of '%s'\n",tmpstr1,tmpstr); - ok(lstrcmpiA(SHORTFILE,strptr)==0, - "GetFullPathNameA returned part '%s' instead of '%s'\n",strptr,SHORTFILE); - } -/* Without a leading slash, insert the current directory if on the current drive */ - sprintf(tmpstr,"%c:%s\\%s",curdir[0],SHORTDIR,SHORTFILE); - ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr1,&strptr),"GetFullPathNameA failed\n"); - sprintf(tmpstr,"%s\\%s\\%s",curdir,SHORTDIR,SHORTFILE); - ok(lstrcmpiA(tmpstr,tmpstr1)==0, - "GetFullPathNameA returned '%s' instead of '%s'\n",tmpstr1,tmpstr); - ok(lstrcmpiA(SHORTFILE,strptr)==0, - "GetFullPathNameA returned part '%s' instead of '%s'\n",strptr,SHORTFILE); -/* Otherwise insert the missing leading slash */ - if( otherDrive != NOT_A_VALID_DRIVE) { - sprintf(tmpstr,"%c:%s\\%s",otherDrive,SHORTDIR,SHORTFILE); - ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr1,&strptr),"GetFullPathNameA failed for %s\n", tmpstr); - sprintf(tmpstr,"%c:\\%s\\%s",otherDrive,SHORTDIR,SHORTFILE); - ok(lstrcmpiA(tmpstr,tmpstr1)==0, - "GetFullPathNameA returned '%s' instead of '%s'\n",tmpstr1,tmpstr); - ok(lstrcmpiA(SHORTFILE,strptr)==0, - "GetFullPathNameA returned part '%s' instead of '%s'\n",strptr,SHORTFILE); - } -/* Xilinx tools like to mix Unix and DOS formats, which Windows handles fine. - So test for them. */ - if( curDrive != NOT_A_VALID_DRIVE) { - sprintf(tmpstr,"%c:/%s\\%s",curDrive,SHORTDIR,SHORTFILE); - ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr1,&strptr),"GetFullPathNameA failed\n"); - sprintf(tmpstr,"%c:\\%s\\%s",curDrive,SHORTDIR,SHORTFILE); - ok(lstrcmpiA(tmpstr,tmpstr1)==0, - "GetFullPathNameA returned '%s' instead of '%s'\n",tmpstr1,tmpstr); - ok(lstrcmpiA(SHORTFILE,strptr)==0, - "GetFullPathNameA returned part '%s' instead of '%s'\n",strptr,SHORTFILE); - } -/**/ - sprintf(tmpstr,"%c:%s/%s",curdir[0],SHORTDIR,SHORTFILE); - ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr1,&strptr),"GetFullPathNameA failed\n"); - sprintf(tmpstr,"%s\\%s\\%s",curdir,SHORTDIR,SHORTFILE); - ok(lstrcmpiA(tmpstr,tmpstr1)==0, - "GetFullPathNameA returned '%s' instead of '%s'\n",tmpstr1,tmpstr); - ok(lstrcmpiA(SHORTFILE,strptr)==0, - "GetFullPathNameA returned part '%s' instead of '%s'\n",strptr,SHORTFILE); -/* Windows will insert a drive letter in front of an absolute UNIX path, but - Wine probably shouldn't. */ - sprintf(tmpstr,"/%s/%s",SHORTDIR,SHORTFILE); - ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr1,&strptr),"GetFullPathNameA failed\n"); - todo_wine { - if( curDrive != NOT_A_VALID_DRIVE) { - sprintf(tmpstr,"C:\\%s\\%s",SHORTDIR,SHORTFILE); - ok(lstrcmpiA(tmpstr,tmpstr1)==0, - "GetFullPathNameA returned '%s' instead of '%s'\n",tmpstr1,tmpstr); - } - } -/* This passes in Wine because it still contains the pointer from the previous test */ - ok(lstrcmpiA(SHORTFILE,strptr)==0, - "GetFullPathNameA returned part '%s' instead of '%s'\n",strptr,SHORTFILE); - -/* Now try some relative paths */ - ok(GetShortPathNameA(LONGDIR,tmpstr,MAX_PATH),"GetShortPathNameA failed\n"); - test_SplitShortPathA(tmpstr,dir,eight,three); - if(pGetLongPathNameA) { - ok(pGetLongPathNameA(tmpstr,tmpstr1,MAX_PATH),"GetLongPathNameA failed\n"); - ok(lstrcmpiA(tmpstr1,LONGDIR)==0, - "GetLongPathNameA returned '%s' instead of '%s'\n",tmpstr1,LONGDIR); - } - sprintf(tmpstr,".\\%s",LONGDIR); - ok(GetShortPathNameA(tmpstr,tmpstr1,MAX_PATH),"GetShortPathNameA failed\n"); - test_SplitShortPathA(tmpstr1,dir,eight,three); - ok(lstrcmpiA(dir,".")==0 || dir[0]=='\0', - "GetShortPathNameA did not keep relative directory [%s]\n",tmpstr1); - if(pGetLongPathNameA) { - ok(pGetLongPathNameA(tmpstr1,tmpstr1,MAX_PATH),"GetLongPathNameA failed %s\n", - tmpstr); - ok(lstrcmpiA(tmpstr1,tmpstr)==0, - "GetLongPathNameA returned '%s' instead of '%s'\n",tmpstr1,tmpstr); - } -/* Check out Get*PathNameA on some funny characters */ - for(i=0;i= len_with_null, "Expected >= %lu, got %lu\n", len_with_null, len); - - len = GetTempPathA(0, NULL); - ok(len >= len_with_null, "Expected >= %lu, got %lu\n", len_with_null, len); - - /* The call above gave us the buffer size that Windows thinks is needed - * so the next call should work - */ - lstrcpyA(buf, "foo"); - len = GetTempPathA(len, buf); - ok(lstrcmpiA(buf, tmp_dir) == 0, "expected [%s], got [%s]\n",tmp_dir,buf); - ok(len == strlen(buf), "returned length should be equal to the length of string\n"); -} - -static void test_GetTempPathW(char* tmp_dir) -{ - DWORD len, len_with_null; - WCHAR buf[MAX_PATH]; - WCHAR tmp_dirW[MAX_PATH]; - static const WCHAR fooW[] = {'f','o','o',0}; - - MultiByteToWideChar(CP_ACP,0,tmp_dir,-1,tmp_dirW,sizeof(tmp_dirW)/sizeof(*tmp_dirW)); - len_with_null = lstrlenW(tmp_dirW) + 1; - - /* This one is different from ANSI version: ANSI version doesn't - * touch the buffer, unicode version usually truncates the buffer - * to zero size. NT still exagerates the required buffer size - * sometimes so we cannot test for an exact match. Finally, the - * 'len_with_null - 1' case is so buggy on Windows it's not testable. - * For instance on NT4 it will sometimes return a path without the - * trailing '\\' and sometimes return an error. - */ - - lstrcpyW(buf, fooW); - len = GetTempPathW(MAX_PATH, buf); - if (len==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) - return; - ok(lstrcmpiW(buf, tmp_dirW) == 0, "GetTempPathW returned an incorrect temporary path\n"); - ok(len == lstrlenW(buf), "returned length should be equal to the length of string\n"); - - lstrcpyW(buf, fooW); - len = GetTempPathW(1, buf); - ok(buf[0] == 0, "unicode version should truncate the buffer to zero size\n"); - ok(len >= len_with_null, "Expected >= %lu, got %lu\n", len_with_null, len); - - len = GetTempPathW(0, NULL); - ok(len >= len_with_null, "Expected >= %lu, got %lu\n", len_with_null, len); - - lstrcpyW(buf, fooW); - len = GetTempPathW(len, buf); - ok(lstrcmpiW(buf, tmp_dirW) == 0, "GetTempPathW returned an incorrect temporary path\n"); - ok(len == lstrlenW(buf), "returned length should be equal to the length of string\n"); -} - -static void test_GetTempPath(void) -{ - char save_TMP[MAX_PATH]; - char windir[MAX_PATH]; - char buf[MAX_PATH]; - - GetEnvironmentVariableA("TMP", save_TMP, sizeof(save_TMP)); - - /* test default configuration */ - trace("TMP=%s\n", save_TMP); - strcpy(buf,save_TMP); - if (buf[strlen(buf)-1]!='\\') - strcat(buf,"\\"); - test_GetTempPathA(buf); - test_GetTempPathW(buf); - - /* TMP=C:\WINDOWS */ - GetWindowsDirectoryA(windir, sizeof(windir)); - SetEnvironmentVariableA("TMP", windir); - GetEnvironmentVariableA("TMP", buf, sizeof(buf)); - trace("TMP=%s\n", buf); - strcat(windir,"\\"); - test_GetTempPathA(windir); - test_GetTempPathW(windir); - - /* TMP=C:\ */ - GetWindowsDirectoryA(windir, sizeof(windir)); - windir[3] = 0; - SetEnvironmentVariableA("TMP", windir); - GetEnvironmentVariableA("TMP", buf, sizeof(buf)); - trace("TMP=%s\n", buf); - test_GetTempPathA(windir); - test_GetTempPathW(windir); - - /* TMP=C: i.e. use current working directory of the specified drive */ - GetWindowsDirectoryA(windir, sizeof(windir)); - SetCurrentDirectoryA(windir); - windir[2] = 0; - SetEnvironmentVariableA("TMP", windir); - GetEnvironmentVariableA("TMP", buf, sizeof(buf)); - trace("TMP=%s\n", buf); - GetWindowsDirectoryA(windir, sizeof(windir)); - strcat(windir,"\\"); - test_GetTempPathA(windir); - test_GetTempPathW(windir); - - SetEnvironmentVariableA("TMP", save_TMP); -} - -START_TEST(path) -{ - CHAR origdir[MAX_PATH],curdir[MAX_PATH], curDrive, otherDrive; - pGetLongPathNameA = (void*)GetProcAddress( GetModuleHandleA("kernel32.dll"), - "GetLongPathNameA" ); - test_InitPathA(curdir, &curDrive, &otherDrive); - test_CurrentDirectoryA(origdir,curdir); - test_PathNameA(curdir, curDrive, otherDrive); - test_CleanupPathA(origdir,curdir); - test_GetTempPath(); -} diff --git a/reactos/apps/tests/kernel32/pipe.c b/reactos/apps/tests/kernel32/pipe.c deleted file mode 100644 index d892f86fc1a..00000000000 --- a/reactos/apps/tests/kernel32/pipe.c +++ /dev/null @@ -1,763 +0,0 @@ -/* - * Unit tests for named pipe functions in Wine - * - * Copyright (c) 2002 Dan Kegel - * - * 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 - -#include -#include -#include - -#ifndef STANDALONE -#include "wine/test.h" -#else -#include -#define START_TEST(name) main(int argc, char **argv) -#define ok(condition, msg) \ - do { \ - if(!(condition)) \ - { \ - fprintf(stderr,"failed at %d\n",__LINE__); \ - exit(0); \ - } \ - } while(0) - -#define todo_wine -#endif - -#include -#include - -#define PIPENAME "\\\\.\\PiPe\\tests_" __FILE__ - -#define NB_SERVER_LOOPS 8 - -static HANDLE alarm_event; - -static void test_CreateNamedPipe(pipemode) -{ - HANDLE hnp; - HANDLE hFile; - static const char obuf[] = "Bit Bucket"; - static const char obuf2[] = "More bits"; - char ibuf[32], *pbuf; - DWORD written; - DWORD readden; - DWORD avail; - DWORD lpmode; - - if (pipemode == PIPE_TYPE_BYTE) - trace("test_CreateNamedPipe starting in byte mode\n"); - else - trace("test_CreateNamedPipe starting in message mode\n"); - /* Bad parameter checks */ - hnp = CreateNamedPipe("not a named pipe", PIPE_ACCESS_DUPLEX, pipemode | PIPE_WAIT, - /* nMaxInstances */ 1, - /* nOutBufSize */ 1024, - /* nInBufSize */ 1024, - /* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT, - /* lpSecurityAttrib */ NULL); - - if (hnp == INVALID_HANDLE_VALUE && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) { - /* Is this the right way to notify user of skipped tests? */ - ok(hnp == INVALID_HANDLE_VALUE && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED, - "CreateNamedPipe not supported on this platform, skipping tests.\n"); - return; - } - ok(hnp == INVALID_HANDLE_VALUE && GetLastError() == ERROR_INVALID_NAME, - "CreateNamedPipe should fail if name doesn't start with \\\\.\\pipe\n"); - - hnp = CreateNamedPipe(NULL, - PIPE_ACCESS_DUPLEX, pipemode | PIPE_WAIT, - 1, 1024, 1024, NMPWAIT_USE_DEFAULT_WAIT, NULL); - ok(hnp == INVALID_HANDLE_VALUE && GetLastError() == ERROR_PATH_NOT_FOUND, - "CreateNamedPipe should fail if name is NULL\n"); - - hFile = CreateFileA(PIPENAME, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0); - ok(hFile == INVALID_HANDLE_VALUE - && GetLastError() == ERROR_FILE_NOT_FOUND, - "connecting to nonexistent named pipe should fail with ERROR_FILE_NOT_FOUND\n"); - - /* Functional checks */ - - hnp = CreateNamedPipe(PIPENAME, PIPE_ACCESS_DUPLEX, pipemode | PIPE_WAIT, - /* nMaxInstances */ 1, - /* nOutBufSize */ 1024, - /* nInBufSize */ 1024, - /* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT, - /* lpSecurityAttrib */ NULL); - ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed\n"); - - hFile = CreateFileA(PIPENAME, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0); - ok(hFile != INVALID_HANDLE_VALUE, "CreateFile failed\n"); - - /* don't try to do i/o if one side couldn't be opened, as it hangs */ - if (hFile != INVALID_HANDLE_VALUE) { - HANDLE hFile2; - - /* Make sure we can read and write a few bytes in both directions */ - memset(ibuf, 0, sizeof(ibuf)); - ok(WriteFile(hnp, obuf, sizeof(obuf), &written, NULL), "WriteFile\n"); - ok(written == sizeof(obuf), "write file len 1\n"); - ok(PeekNamedPipe(hFile, NULL, 0, NULL, &readden, NULL), "Peek\n"); - ok(readden == sizeof(obuf), "peek 1 got %ld bytes\n", readden); - ok(ReadFile(hFile, ibuf, sizeof(ibuf), &readden, NULL), "ReadFile\n"); - ok(readden == sizeof(obuf), "read 1 got %ld bytes\n", readden); - ok(memcmp(obuf, ibuf, written) == 0, "content 1 check\n"); - - memset(ibuf, 0, sizeof(ibuf)); - ok(WriteFile(hFile, obuf2, sizeof(obuf2), &written, NULL), "WriteFile\n"); - ok(written == sizeof(obuf2), "write file len 2\n"); - ok(PeekNamedPipe(hnp, NULL, 0, NULL, &readden, NULL), "Peek\n"); - ok(readden == sizeof(obuf2), "peek 2 got %ld bytes\n", readden); - ok(ReadFile(hnp, ibuf, sizeof(ibuf), &readden, NULL), "ReadFile\n"); - ok(readden == sizeof(obuf2), "read 2 got %ld bytes\n", readden); - ok(memcmp(obuf2, ibuf, written) == 0, "content 2 check\n"); - - /* Test reading of multiple writes */ - memset(ibuf, 0, sizeof(ibuf)); - ok(WriteFile(hnp, obuf, sizeof(obuf), &written, NULL), "WriteFile3a\n"); - ok(written == sizeof(obuf), "write file len 3a\n"); - ok(WriteFile(hnp, obuf2, sizeof(obuf2), &written, NULL), " WriteFile3b\n"); - ok(written == sizeof(obuf2), "write file len 3b\n"); - ok(PeekNamedPipe(hFile, ibuf, sizeof(ibuf), &readden, &avail, NULL), "Peek3\n"); - if (pipemode == PIPE_TYPE_BYTE) { - todo_wine { - /* should return all 23 bytes */ - ok(readden == sizeof(obuf) + sizeof(obuf2), "peek3 got %ld bytes\n", readden); - } - } - else - ok(readden == sizeof(obuf), "peek3 got %ld bytes\n", readden); - todo_wine { - ok(avail == sizeof(obuf) + sizeof(obuf2), "peek3 got %ld bytes available\n", avail); - } - pbuf = ibuf; - ok(memcmp(obuf, pbuf, sizeof(obuf)) == 0, "pipe content 3a check\n"); - if (pipemode == PIPE_TYPE_BYTE) { - todo_wine { - pbuf += sizeof(obuf); - ok(memcmp(obuf2, pbuf, sizeof(obuf2)) == 0, "pipe content 3b check\n"); - } - } - ok(ReadFile(hFile, ibuf, sizeof(ibuf), &readden, NULL), "ReadFile\n"); - ok(readden == sizeof(obuf) + sizeof(obuf2), "read 3 got %ld bytes\n", readden); - pbuf = ibuf; - ok(memcmp(obuf, pbuf, sizeof(obuf)) == 0, "content 3a check\n"); - pbuf += sizeof(obuf); - ok(memcmp(obuf2, pbuf, sizeof(obuf2)) == 0, "content 3b check\n"); - - /* Multiple writes in the reverse direction */ - memset(ibuf, 0, sizeof(ibuf)); - ok(WriteFile(hFile, obuf, sizeof(obuf), &written, NULL), "WriteFile4a\n"); - ok(written == sizeof(obuf), "write file len 4a\n"); - ok(WriteFile(hFile, obuf2, sizeof(obuf2), &written, NULL), " WriteFile4b\n"); - ok(written == sizeof(obuf2), "write file len 4b\n"); - ok(PeekNamedPipe(hnp, ibuf, sizeof(ibuf), &readden, &avail, NULL), "Peek4\n"); - if (pipemode == PIPE_TYPE_BYTE) { - todo_wine { - /* should return all 23 bytes */ - ok(readden == sizeof(obuf) + sizeof(obuf2), "peek4 got %ld bytes\n", readden); - } - } - else - ok(readden == sizeof(obuf), "peek4 got %ld bytes\n", readden); - todo_wine { - ok(avail == sizeof(obuf) + sizeof(obuf2), "peek4 got %ld bytes available\n", avail); - } - pbuf = ibuf; - ok(memcmp(obuf, pbuf, sizeof(obuf)) == 0, "pipe content 4a check\n"); - if (pipemode == PIPE_TYPE_BYTE) { - todo_wine { - pbuf += sizeof(obuf); - ok(memcmp(obuf2, pbuf, sizeof(obuf2)) == 0, "pipe content 4b check\n"); - } - } - ok(ReadFile(hnp, ibuf, sizeof(ibuf), &readden, NULL), "ReadFile\n"); - if (pipemode == PIPE_TYPE_BYTE) { - ok(readden == sizeof(obuf) + sizeof(obuf2), "read 4 got %ld bytes\n", readden); - } - else { - todo_wine { - ok(readden == sizeof(obuf), "read 4 got %ld bytes\n", readden); - } - } - pbuf = ibuf; - ok(memcmp(obuf, pbuf, sizeof(obuf)) == 0, "content 4a check\n"); - if (pipemode == PIPE_TYPE_BYTE) { - pbuf += sizeof(obuf); - ok(memcmp(obuf2, pbuf, sizeof(obuf2)) == 0, "content 4b check\n"); - } - - /* Test reading of multiple writes after a mode change - (CreateFile always creates a byte mode pipe) */ - lpmode = PIPE_READMODE_MESSAGE; - if (pipemode == PIPE_TYPE_BYTE) { - /* trying to change the client end of a byte pipe to message mode should fail */ - ok(!SetNamedPipeHandleState(hFile, &lpmode, NULL, NULL), "Change mode\n"); - } - else { - todo_wine { - ok(SetNamedPipeHandleState(hFile, &lpmode, NULL, NULL), "Change mode\n"); - } - - memset(ibuf, 0, sizeof(ibuf)); - ok(WriteFile(hnp, obuf, sizeof(obuf), &written, NULL), "WriteFile5a\n"); - ok(written == sizeof(obuf), "write file len 3a\n"); - ok(WriteFile(hnp, obuf2, sizeof(obuf2), &written, NULL), " WriteFile5b\n"); - ok(written == sizeof(obuf2), "write file len 3b\n"); - ok(PeekNamedPipe(hFile, ibuf, sizeof(ibuf), &readden, &avail, NULL), "Peek5\n"); - ok(readden == sizeof(obuf), "peek5 got %ld bytes\n", readden); - todo_wine { - ok(avail == sizeof(obuf) + sizeof(obuf2), "peek5 got %ld bytes available\n", avail); - } - pbuf = ibuf; - ok(memcmp(obuf, pbuf, sizeof(obuf)) == 0, "content 5a check\n"); - ok(ReadFile(hFile, ibuf, sizeof(ibuf), &readden, NULL), "ReadFile\n"); - todo_wine { - ok(readden == sizeof(obuf), "read 5 got %ld bytes\n", readden); - } - pbuf = ibuf; - ok(memcmp(obuf, pbuf, sizeof(obuf)) == 0, "content 5a check\n"); - - /* Multiple writes in the reverse direction */ - /* the write of obuf2 from write4 should still be in the buffer */ - ok(PeekNamedPipe(hnp, ibuf, sizeof(ibuf), &readden, &avail, NULL), "Peek6a\n"); - todo_wine { - ok(readden == sizeof(obuf2), "peek6a got %ld bytes\n", readden); - ok(avail == sizeof(obuf2), "peek6a got %ld bytes available\n", avail); - } - if (avail > 0) { - ok(ReadFile(hnp, ibuf, sizeof(ibuf), &readden, NULL), "ReadFile\n"); - ok(readden == sizeof(obuf2), "read 6a got %ld bytes\n", readden); - pbuf = ibuf; - ok(memcmp(obuf2, pbuf, sizeof(obuf2)) == 0, "content 6a check\n"); - } - memset(ibuf, 0, sizeof(ibuf)); - ok(WriteFile(hFile, obuf, sizeof(obuf), &written, NULL), "WriteFile6a\n"); - ok(written == sizeof(obuf), "write file len 6a\n"); - ok(WriteFile(hFile, obuf2, sizeof(obuf2), &written, NULL), " WriteFile6b\n"); - ok(written == sizeof(obuf2), "write file len 6b\n"); - ok(PeekNamedPipe(hnp, ibuf, sizeof(ibuf), &readden, &avail, NULL), "Peek6\n"); - ok(readden == sizeof(obuf), "peek6 got %ld bytes\n", readden); - todo_wine { - ok(avail == sizeof(obuf) + sizeof(obuf2), "peek6b got %ld bytes available\n", avail); - } - pbuf = ibuf; - ok(memcmp(obuf, pbuf, sizeof(obuf)) == 0, "content 6a check\n"); - ok(ReadFile(hnp, ibuf, sizeof(ibuf), &readden, NULL), "ReadFile\n"); - todo_wine { - ok(readden == sizeof(obuf), "read 6b got %ld bytes\n", readden); - } - pbuf = ibuf; - ok(memcmp(obuf, pbuf, sizeof(obuf)) == 0, "content 6a check\n"); - } - - /* Picky conformance tests */ - - /* Verify that you can't connect to pipe again - * until server calls DisconnectNamedPipe+ConnectNamedPipe - * or creates a new pipe - * case 1: other client not yet closed - */ - hFile2 = CreateFileA(PIPENAME, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0); - ok(hFile2 == INVALID_HANDLE_VALUE, - "connecting to named pipe after other client closes but before DisconnectNamedPipe should fail\n"); - ok(GetLastError() == ERROR_PIPE_BUSY, - "connecting to named pipe before other client closes should fail with ERROR_PIPE_BUSY\n"); - - ok(CloseHandle(hFile), "CloseHandle\n"); - - /* case 2: other client already closed */ - hFile = CreateFileA(PIPENAME, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0); - ok(hFile == INVALID_HANDLE_VALUE, - "connecting to named pipe after other client closes but before DisconnectNamedPipe should fail\n"); - ok(GetLastError() == ERROR_PIPE_BUSY, - "connecting to named pipe after other client closes but before DisconnectNamedPipe should fail with ERROR_PIPE_BUSY\n"); - - ok(DisconnectNamedPipe(hnp), "DisconnectNamedPipe\n"); - - /* case 3: server has called DisconnectNamedPipe but not ConnectNamed Pipe */ - hFile = CreateFileA(PIPENAME, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0); - ok(hFile == INVALID_HANDLE_VALUE, - "connecting to named pipe after other client closes but before DisconnectNamedPipe should fail\n"); - ok(GetLastError() == ERROR_PIPE_BUSY, - "connecting to named pipe after other client closes but before ConnectNamedPipe should fail with ERROR_PIPE_BUSY\n"); - - /* to be complete, we'd call ConnectNamedPipe here and loop, - * but by default that's blocking, so we'd either have - * to turn on the uncommon nonblocking mode, or - * use another thread. - */ - } - - ok(CloseHandle(hnp), "CloseHandle\n"); - - trace("test_CreateNamedPipe returning\n"); -} - -void test_CreateNamedPipe_instances_must_match(void) -{ - HANDLE hnp, hnp2; - - /* Check no mismatch */ - hnp = CreateNamedPipe(PIPENAME, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_WAIT, - /* nMaxInstances */ 2, - /* nOutBufSize */ 1024, - /* nInBufSize */ 1024, - /* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT, - /* lpSecurityAttrib */ NULL); - ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed\n"); - - hnp2 = CreateNamedPipe(PIPENAME, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_WAIT, - /* nMaxInstances */ 2, - /* nOutBufSize */ 1024, - /* nInBufSize */ 1024, - /* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT, - /* lpSecurityAttrib */ NULL); - ok(hnp2 != INVALID_HANDLE_VALUE, "CreateNamedPipe failed\n"); - - ok(CloseHandle(hnp), "CloseHandle\n"); - ok(CloseHandle(hnp2), "CloseHandle\n"); - - /* Check nMaxInstances */ - hnp = CreateNamedPipe(PIPENAME, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_WAIT, - /* nMaxInstances */ 1, - /* nOutBufSize */ 1024, - /* nInBufSize */ 1024, - /* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT, - /* lpSecurityAttrib */ NULL); - ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed\n"); - - hnp2 = CreateNamedPipe(PIPENAME, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_WAIT, - /* nMaxInstances */ 1, - /* nOutBufSize */ 1024, - /* nInBufSize */ 1024, - /* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT, - /* lpSecurityAttrib */ NULL); - ok(hnp2 == INVALID_HANDLE_VALUE - && GetLastError() == ERROR_PIPE_BUSY, "nMaxInstances not obeyed\n"); - - ok(CloseHandle(hnp), "CloseHandle\n"); - - /* Check PIPE_ACCESS_* */ - hnp = CreateNamedPipe(PIPENAME, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_WAIT, - /* nMaxInstances */ 2, - /* nOutBufSize */ 1024, - /* nInBufSize */ 1024, - /* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT, - /* lpSecurityAttrib */ NULL); - ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed\n"); - - hnp2 = CreateNamedPipe(PIPENAME, PIPE_ACCESS_INBOUND, PIPE_TYPE_BYTE | PIPE_WAIT, - /* nMaxInstances */ 1, - /* nOutBufSize */ 1024, - /* nInBufSize */ 1024, - /* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT, - /* lpSecurityAttrib */ NULL); - ok(hnp2 == INVALID_HANDLE_VALUE - && GetLastError() == ERROR_ACCESS_DENIED, "PIPE_ACCESS_* mismatch allowed\n"); - - ok(CloseHandle(hnp), "CloseHandle\n"); - - /* etc, etc */ -} - -/** implementation of alarm() */ -static DWORD CALLBACK alarmThreadMain(LPVOID arg) -{ - DWORD timeout = (DWORD) arg; - trace("alarmThreadMain\n"); - if (WaitForSingleObject( alarm_event, timeout ) == WAIT_TIMEOUT) - { - ok(FALSE, "alarm\n"); - ExitProcess(1); - } - return 1; -} - -HANDLE hnp = INVALID_HANDLE_VALUE; - -/** Trivial byte echo server - disconnects after each session */ -static DWORD CALLBACK serverThreadMain1(LPVOID arg) -{ - int i; - - trace("serverThreadMain1 start\n"); - /* Set up a simple echo server */ - hnp = CreateNamedPipe(PIPENAME "serverThreadMain1", PIPE_ACCESS_DUPLEX, - PIPE_TYPE_BYTE | PIPE_WAIT, - /* nMaxInstances */ 1, - /* nOutBufSize */ 1024, - /* nInBufSize */ 1024, - /* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT, - /* lpSecurityAttrib */ NULL); - - ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed\n"); - for (i = 0; i < NB_SERVER_LOOPS; i++) { - char buf[512]; - DWORD written; - DWORD readden; - DWORD success; - - /* Wait for client to connect */ - trace("Server calling ConnectNamedPipe...\n"); - ok(ConnectNamedPipe(hnp, NULL) - || GetLastError() == ERROR_PIPE_CONNECTED, "ConnectNamedPipe\n"); - trace("ConnectNamedPipe returned.\n"); - - /* Echo bytes once */ - memset(buf, 0, sizeof(buf)); - - trace("Server reading...\n"); - success = ReadFile(hnp, buf, sizeof(buf), &readden, NULL); - trace("Server done reading.\n"); - ok(success, "ReadFile\n"); - ok(readden, "short read\n"); - - trace("Server writing...\n"); - ok(WriteFile(hnp, buf, readden, &written, NULL), "WriteFile\n"); - trace("Server done writing.\n"); - ok(written == readden, "write file len\n"); - - /* finish this connection, wait for next one */ - ok(FlushFileBuffers(hnp), "FlushFileBuffers\n"); - trace("Server done flushing.\n"); - ok(DisconnectNamedPipe(hnp), "DisconnectNamedPipe\n"); - trace("Server done disconnecting.\n"); - } - return 0; -} - -/** Trivial byte echo server - closes after each connection */ -static DWORD CALLBACK serverThreadMain2(LPVOID arg) -{ - int i; - HANDLE hnpNext = 0; - - trace("serverThreadMain2\n"); - /* Set up a simple echo server */ - hnp = CreateNamedPipe(PIPENAME "serverThreadMain2", PIPE_ACCESS_DUPLEX, - PIPE_TYPE_BYTE | PIPE_WAIT, - /* nMaxInstances */ 2, - /* nOutBufSize */ 1024, - /* nInBufSize */ 1024, - /* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT, - /* lpSecurityAttrib */ NULL); - ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed\n"); - - for (i = 0; i < NB_SERVER_LOOPS; i++) { - char buf[512]; - DWORD written; - DWORD readden; - DWORD success; - - /* Wait for client to connect */ - trace("Server calling ConnectNamedPipe...\n"); - ok(ConnectNamedPipe(hnp, NULL) - || GetLastError() == ERROR_PIPE_CONNECTED, "ConnectNamedPipe\n"); - trace("ConnectNamedPipe returned.\n"); - - /* Echo bytes once */ - memset(buf, 0, sizeof(buf)); - - trace("Server reading...\n"); - success = ReadFile(hnp, buf, sizeof(buf), &readden, NULL); - trace("Server done reading.\n"); - ok(success, "ReadFile\n"); - - trace("Server writing...\n"); - ok(WriteFile(hnp, buf, readden, &written, NULL), "WriteFile\n"); - trace("Server done writing.\n"); - ok(written == readden, "write file len\n"); - - /* finish this connection, wait for next one */ - ok(FlushFileBuffers(hnp), "FlushFileBuffers\n"); - ok(DisconnectNamedPipe(hnp), "DisconnectNamedPipe\n"); - - /* Set up next echo server */ - hnpNext = - CreateNamedPipe(PIPENAME "serverThreadMain2", PIPE_ACCESS_DUPLEX, - PIPE_TYPE_BYTE | PIPE_WAIT, - /* nMaxInstances */ 2, - /* nOutBufSize */ 1024, - /* nInBufSize */ 1024, - /* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT, - /* lpSecurityAttrib */ NULL); - - ok(hnpNext != INVALID_HANDLE_VALUE, "CreateNamedPipe failed\n"); - - ok(CloseHandle(hnp), "CloseHandle\n"); - hnp = hnpNext; - } - return 0; -} - -/** Trivial byte echo server - uses overlapped named pipe calls */ -static DWORD CALLBACK serverThreadMain3(LPVOID arg) -{ - int i; - HANDLE hEvent; - - trace("serverThreadMain3\n"); - /* Set up a simple echo server */ - hnp = CreateNamedPipe(PIPENAME "serverThreadMain3", PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, - PIPE_TYPE_BYTE | PIPE_WAIT, - /* nMaxInstances */ 1, - /* nOutBufSize */ 1024, - /* nInBufSize */ 1024, - /* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT, - /* lpSecurityAttrib */ NULL); - ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed\n"); - - hEvent = CreateEvent(NULL, /* security attribute */ - TRUE, /* manual reset event */ - FALSE, /* initial state */ - NULL); /* name */ - ok(hEvent != NULL, "CreateEvent\n"); - - for (i = 0; i < NB_SERVER_LOOPS; i++) { - char buf[512]; - DWORD written; - DWORD readden; - DWORD dummy; - DWORD success; - OVERLAPPED oOverlap; - int letWFSOEwait = (i & 2); - int letGORwait = (i & 1); - DWORD err; - - memset(&oOverlap, 0, sizeof(oOverlap)); - oOverlap.hEvent = hEvent; - - /* Wait for client to connect */ - trace("Server calling overlapped ConnectNamedPipe...\n"); - success = ConnectNamedPipe(hnp, &oOverlap); - err = GetLastError(); - ok(success || err == ERROR_IO_PENDING - || err == ERROR_PIPE_CONNECTED, "overlapped ConnectNamedPipe\n"); - trace("overlapped ConnectNamedPipe returned.\n"); - if (!success && (err == ERROR_IO_PENDING) && letWFSOEwait) - ok(WaitForSingleObjectEx(hEvent, INFINITE, TRUE) == 0, "wait ConnectNamedPipe\n"); - success = GetOverlappedResult(hnp, &oOverlap, &dummy, letGORwait); - if (!letGORwait && !letWFSOEwait && !success) { - ok(GetLastError() == ERROR_IO_INCOMPLETE, "GetOverlappedResult\n"); - success = GetOverlappedResult(hnp, &oOverlap, &dummy, TRUE); - } - ok(success, "GetOverlappedResult ConnectNamedPipe\n"); - trace("overlapped ConnectNamedPipe operation complete.\n"); - - /* Echo bytes once */ - memset(buf, 0, sizeof(buf)); - - trace("Server reading...\n"); - success = ReadFile(hnp, buf, sizeof(buf), NULL, &oOverlap); - trace("Server ReadFile returned...\n"); - err = GetLastError(); - ok(success || err == ERROR_IO_PENDING, "overlapped ReadFile\n"); - trace("overlapped ReadFile returned.\n"); - if (!success && (err == ERROR_IO_PENDING) && letWFSOEwait) - ok(WaitForSingleObjectEx(hEvent, INFINITE, TRUE) == 0, "wait ReadFile\n"); - success = GetOverlappedResult(hnp, &oOverlap, &readden, letGORwait); - if (!letGORwait && !letWFSOEwait && !success) { - ok(GetLastError() == ERROR_IO_INCOMPLETE, "GetOverlappedResult\n"); - success = GetOverlappedResult(hnp, &oOverlap, &readden, TRUE); - } - trace("Server done reading.\n"); - ok(success, "overlapped ReadFile\n"); - - trace("Server writing...\n"); - success = WriteFile(hnp, buf, readden, NULL, &oOverlap); - trace("Server WriteFile returned...\n"); - err = GetLastError(); - ok(success || err == ERROR_IO_PENDING, "overlapped WriteFile\n"); - trace("overlapped WriteFile returned.\n"); - if (!success && (err == ERROR_IO_PENDING) && letWFSOEwait) - ok(WaitForSingleObjectEx(hEvent, INFINITE, TRUE) == 0, "wait WriteFile\n"); - success = GetOverlappedResult(hnp, &oOverlap, &written, letGORwait); - if (!letGORwait && !letWFSOEwait && !success) { - ok(GetLastError() == ERROR_IO_INCOMPLETE, "GetOverlappedResult\n"); - success = GetOverlappedResult(hnp, &oOverlap, &written, TRUE); - } - trace("Server done writing.\n"); - ok(success, "overlapped WriteFile\n"); - ok(written == readden, "write file len\n"); - - /* finish this connection, wait for next one */ - ok(FlushFileBuffers(hnp), "FlushFileBuffers\n"); - ok(DisconnectNamedPipe(hnp), "DisconnectNamedPipe\n"); - } - return 0; -} - -static void exercizeServer(const char *pipename, HANDLE serverThread) -{ - int i; - - trace("exercizeServer starting\n"); - for (i = 0; i < NB_SERVER_LOOPS; i++) { - HANDLE hFile=INVALID_HANDLE_VALUE; - static const char obuf[] = "Bit Bucket"; - char ibuf[32]; - DWORD written; - DWORD readden; - int loop; - - for (loop = 0; loop < 3; loop++) { - DWORD err; - trace("Client connecting...\n"); - /* Connect to the server */ - hFile = CreateFileA(pipename, GENERIC_READ | GENERIC_WRITE, 0, - NULL, OPEN_EXISTING, 0, 0); - if (hFile != INVALID_HANDLE_VALUE) - break; - err = GetLastError(); - if (loop == 0) - ok(err == ERROR_PIPE_BUSY || err == ERROR_FILE_NOT_FOUND, "connecting to pipe\n"); - else - ok(err == ERROR_PIPE_BUSY, "connecting to pipe\n"); - trace("connect failed, retrying\n"); - Sleep(200); - } - ok(hFile != INVALID_HANDLE_VALUE, "client opening named pipe\n"); - - /* Make sure it can echo */ - memset(ibuf, 0, sizeof(ibuf)); - trace("Client writing...\n"); - ok(WriteFile(hFile, obuf, sizeof(obuf), &written, NULL), "WriteFile to client end of pipe\n"); - ok(written == sizeof(obuf), "write file len\n"); - trace("Client reading...\n"); - ok(ReadFile(hFile, ibuf, sizeof(obuf), &readden, NULL), "ReadFile from client end of pipe\n"); - ok(readden == sizeof(obuf), "read file len\n"); - ok(memcmp(obuf, ibuf, written) == 0, "content check\n"); - - trace("Client closing...\n"); - ok(CloseHandle(hFile), "CloseHandle\n"); - } - - ok(WaitForSingleObject(serverThread,INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject\n"); - CloseHandle(hnp); - trace("exercizeServer returning\n"); -} - -static void test_NamedPipe_2(void) -{ - HANDLE serverThread; - DWORD serverThreadId; - HANDLE alarmThread; - DWORD alarmThreadId; - - trace("test_NamedPipe_2 starting\n"); - /* Set up a ten second timeout */ - alarm_event = CreateEvent( NULL, TRUE, FALSE, NULL ); - alarmThread = CreateThread(NULL, 0, alarmThreadMain, (void *) 10000, 0, &alarmThreadId); - - /* The servers we're about to exercize do try to clean up carefully, - * but to reduce the change of a test failure due to a pipe handle - * leak in the test code, we'll use a different pipe name for each server. - */ - - /* Try server #1 */ - serverThread = CreateThread(NULL, 0, serverThreadMain1, (void *)8, 0, &serverThreadId); - ok(serverThread != INVALID_HANDLE_VALUE, "CreateThread\n"); - exercizeServer(PIPENAME "serverThreadMain1", serverThread); - - /* Try server #2 */ - serverThread = CreateThread(NULL, 0, serverThreadMain2, 0, 0, &serverThreadId); - ok(serverThread != INVALID_HANDLE_VALUE, "CreateThread\n"); - exercizeServer(PIPENAME "serverThreadMain2", serverThread); - - if( 0 ) /* overlapped pipe server doesn't work yet - it randomly fails */ - { - /* Try server #3 */ - serverThread = CreateThread(NULL, 0, serverThreadMain3, 0, 0, &serverThreadId); - ok(serverThread != INVALID_HANDLE_VALUE, "CreateThread\n"); - exercizeServer(PIPENAME "serverThreadMain3", serverThread); - } - - ok(SetEvent( alarm_event ), "SetEvent\n"); - CloseHandle( alarm_event ); - trace("test_NamedPipe_2 returning\n"); -} - -static void test_DisconnectNamedPipe(void) -{ - HANDLE hnp; - HANDLE hFile; - static const char obuf[] = "Bit Bucket"; - char ibuf[32]; - DWORD written; - DWORD readden; - - hnp = CreateNamedPipe(PIPENAME, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_WAIT, - /* nMaxInstances */ 1, - /* nOutBufSize */ 1024, - /* nInBufSize */ 1024, - /* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT, - /* lpSecurityAttrib */ NULL); - ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed\n"); - - ok(WriteFile(hnp, obuf, sizeof(obuf), &written, NULL) == 0 - && GetLastError() == ERROR_PIPE_LISTENING, "WriteFile to not-yet-connected pipe\n"); - ok(ReadFile(hnp, ibuf, sizeof(ibuf), &readden, NULL) == 0 - && GetLastError() == ERROR_PIPE_LISTENING, "ReadFile from not-yet-connected pipe\n"); - - hFile = CreateFileA(PIPENAME, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0); - ok(hFile != INVALID_HANDLE_VALUE, "CreateFile failed\n"); - - /* don't try to do i/o if one side couldn't be opened, as it hangs */ - if (hFile != INVALID_HANDLE_VALUE) { - - /* see what happens if server calls DisconnectNamedPipe - * when there are bytes in the pipe - */ - - ok(WriteFile(hFile, obuf, sizeof(obuf), &written, NULL), "WriteFile\n"); - ok(written == sizeof(obuf), "write file len\n"); - ok(DisconnectNamedPipe(hnp), "DisconnectNamedPipe while messages waiting\n"); - ok(WriteFile(hFile, obuf, sizeof(obuf), &written, NULL) == 0 - && GetLastError() == ERROR_PIPE_NOT_CONNECTED, "WriteFile to disconnected pipe\n"); - ok(ReadFile(hnp, ibuf, sizeof(ibuf), &readden, NULL) == 0 - && GetLastError() == ERROR_PIPE_NOT_CONNECTED, - "ReadFile from disconnected pipe with bytes waiting\n"); - ok(CloseHandle(hFile), "CloseHandle\n"); - } - - ok(CloseHandle(hnp), "CloseHandle\n"); - -} - -START_TEST(pipe) -{ - trace("test 1 of 4:\n"); - test_DisconnectNamedPipe(); - trace("test 2 of 4:\n"); - test_CreateNamedPipe_instances_must_match(); - trace("test 3 of 4:\n"); - test_NamedPipe_2(); - trace("test 4 of 4:\n"); - test_CreateNamedPipe(PIPE_TYPE_BYTE); - trace("all tests done\n"); - test_CreateNamedPipe(PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE); - trace("all tests done\n"); -} diff --git a/reactos/apps/tests/kernel32/process.c b/reactos/apps/tests/kernel32/process.c deleted file mode 100644 index 0d745c89e2a..00000000000 --- a/reactos/apps/tests/kernel32/process.c +++ /dev/null @@ -1,1202 +0,0 @@ -/* - * Unit test suite for CreateProcess function. - * - * Copyright 2002 Eric Pouech - * - * 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 "winuser.h" -#include "wincon.h" -#include "winnls.h" - -static char base[MAX_PATH]; -static char selfname[MAX_PATH]; -static char resfile[MAX_PATH]; - -static int myARGC; -static char** myARGV; - -/* As some environment variables get very long on Unix, we only test for - * the first 127 bytes. - * Note that increasing this value past 256 may exceed the buffer size - * limitations of the *Profile functions (at least on Wine). - */ -#define MAX_LISTED_ENV_VAR 128 - -/* ---------------- portable memory allocation thingie */ - -static char memory[1024*32]; -static char* memory_index = memory; - -static char* grab_memory(size_t len) -{ - char* ret = memory_index; - /* align on dword */ - len = (len + 3) & ~3; - memory_index += len; - assert(memory_index <= memory + sizeof(memory)); - return ret; -} - -static void release_memory(void) -{ - memory_index = memory; -} - -/* ---------------- simplistic tool to encode/decode strings (to hide \ " ' and such) */ - -static const char* encodeA(const char* str) -{ - char* ptr; - size_t len,i; - - if (!str) return ""; - len = strlen(str) + 1; - ptr = grab_memory(len * 2 + 1); - for (i = 0; i < len; i++) - sprintf(&ptr[i * 2], "%02x", (unsigned char)str[i]); - ptr[2 * len] = '\0'; - return ptr; -} - -static const char* encodeW(const WCHAR* str) -{ - char* ptr; - size_t len,i; - - if (!str) return ""; - len = lstrlenW(str) + 1; - ptr = grab_memory(len * 4 + 1); - assert(ptr); - for (i = 0; i < len; i++) - sprintf(&ptr[i * 4], "%04x", (unsigned int)(unsigned short)str[i]); - ptr[4 * len] = '\0'; - return ptr; -} - -static unsigned decode_char(char c) -{ - if (c >= '0' && c <= '9') return c - '0'; - if (c >= 'a' && c <= 'f') return c - 'a' + 10; - assert(c >= 'A' && c <= 'F'); - return c - 'A' + 10; -} - -static char* decodeA(const char* str) -{ - char* ptr; - size_t len,i; - - len = strlen(str) / 2; - if (!len--) return NULL; - ptr = grab_memory(len + 1); - for (i = 0; i < len; i++) - ptr[i] = (decode_char(str[2 * i]) << 4) | decode_char(str[2 * i + 1]); - ptr[len] = '\0'; - return ptr; -} - -#if 0 -/* This will be needed to decode Unicode strings saved by the child process - * when we test Unicode functions. - */ -static WCHAR* decodeW(const char* str) -{ - size_t len; - WCHAR* ptr; - int i; - - len = strlen(str) / 4; - if (!len--) return NULL; - ptr = (WCHAR*)grab_memory(len * 2 + 1); - for (i = 0; i < len; i++) - ptr[i] = (decode_char(str[4 * i]) << 12) | - (decode_char(str[4 * i + 1]) << 8) | - (decode_char(str[4 * i + 2]) << 4) | - (decode_char(str[4 * i + 3]) << 0); - ptr[len] = '\0'; - return ptr; -} -#endif - -/****************************************************************** - * init - * - * generates basic information like: - * base: absolute path to curr dir - * selfname: the way to reinvoke ourselves - */ -static int init(void) -{ - myARGC = winetest_get_mainargs( &myARGV ); - if (!GetCurrentDirectoryA(sizeof(base), base)) return 0; - strcpy(selfname, myARGV[0]); - return 1; -} - -/****************************************************************** - * get_file_name - * - * generates an absolute file_name for temporary file - * - */ -static void get_file_name(char* buf) -{ - char path[MAX_PATH]; - - buf[0] = '\0'; - GetTempPathA(sizeof(path), path); - GetTempFileNameA(path, "wt", 0, buf); -} - -/****************************************************************** - * static void childPrintf - * - */ -static void childPrintf(HANDLE h, const char* fmt, ...) -{ - va_list valist; - char buffer[1024+4*MAX_LISTED_ENV_VAR]; - DWORD w; - - va_start(valist, fmt); - vsprintf(buffer, fmt, valist); - va_end(valist); - WriteFile(h, buffer, strlen(buffer), &w, NULL); -} - - -/****************************************************************** - * doChild - * - * output most of the information in the child process - */ -static void doChild(const char* file, const char* option) -{ - STARTUPINFOA siA; - STARTUPINFOW siW; - int i; - char* ptrA; - WCHAR* ptrW; - char bufA[MAX_PATH]; - WCHAR bufW[MAX_PATH]; - HANDLE hFile = CreateFileA(file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0); - - if (hFile == INVALID_HANDLE_VALUE) return; - - /* output of startup info (Ansi) */ - GetStartupInfoA(&siA); - childPrintf(hFile, - "[StartupInfoA]\ncb=%08ld\nlpDesktop=%s\nlpTitle=%s\n" - "dwX=%lu\ndwY=%lu\ndwXSize=%lu\ndwYSize=%lu\n" - "dwXCountChars=%lu\ndwYCountChars=%lu\ndwFillAttribute=%lu\n" - "dwFlags=%lu\nwShowWindow=%u\n" - "hStdInput=%lu\nhStdOutput=%lu\nhStdError=%lu\n\n", - siA.cb, encodeA(siA.lpDesktop), encodeA(siA.lpTitle), - siA.dwX, siA.dwY, siA.dwXSize, siA.dwYSize, - siA.dwXCountChars, siA.dwYCountChars, siA.dwFillAttribute, - siA.dwFlags, siA.wShowWindow, - (DWORD)siA.hStdInput, (DWORD)siA.hStdOutput, (DWORD)siA.hStdError); - - /* since GetStartupInfoW is only implemented in win2k, - * zero out before calling so we can notice the difference - */ - memset(&siW, 0, sizeof(siW)); - GetStartupInfoW(&siW); - childPrintf(hFile, - "[StartupInfoW]\ncb=%08ld\nlpDesktop=%s\nlpTitle=%s\n" - "dwX=%lu\ndwY=%lu\ndwXSize=%lu\ndwYSize=%lu\n" - "dwXCountChars=%lu\ndwYCountChars=%lu\ndwFillAttribute=%lu\n" - "dwFlags=%lu\nwShowWindow=%u\n" - "hStdInput=%lu\nhStdOutput=%lu\nhStdError=%lu\n\n", - siW.cb, encodeW(siW.lpDesktop), encodeW(siW.lpTitle), - siW.dwX, siW.dwY, siW.dwXSize, siW.dwYSize, - siW.dwXCountChars, siW.dwYCountChars, siW.dwFillAttribute, - siW.dwFlags, siW.wShowWindow, - (DWORD)siW.hStdInput, (DWORD)siW.hStdOutput, (DWORD)siW.hStdError); - - /* Arguments */ - childPrintf(hFile, "[Arguments]\nargcA=%d\n", myARGC); - for (i = 0; i < myARGC; i++) - { - childPrintf(hFile, "argvA%d=%s\n", i, encodeA(myARGV[i])); - } - childPrintf(hFile, "CommandLineA=%s\n", encodeA(GetCommandLineA())); - -#if 0 - int argcW; - WCHAR** argvW; - - /* this is part of shell32... and should be tested there */ - argvW = CommandLineToArgvW(GetCommandLineW(), &argcW); - for (i = 0; i < argcW; i++) - { - childPrintf(hFile, "argvW%d=%s\n", i, encodeW(argvW[i])); - } -#endif - childPrintf(hFile, "CommandLineW=%s\n\n", encodeW(GetCommandLineW())); - - /* output of environment (Ansi) */ - ptrA = GetEnvironmentStringsA(); - if (ptrA) - { - char env_var[MAX_LISTED_ENV_VAR]; - - childPrintf(hFile, "[EnvironmentA]\n"); - i = 0; - while (*ptrA) - { - strncpy(env_var, ptrA, MAX_LISTED_ENV_VAR - 1); - env_var[MAX_LISTED_ENV_VAR - 1] = '\0'; - childPrintf(hFile, "env%d=%s\n", i, encodeA(env_var)); - i++; - ptrA += strlen(ptrA) + 1; - } - childPrintf(hFile, "len=%d\n\n", i); - } - - /* output of environment (Unicode) */ - ptrW = GetEnvironmentStringsW(); - if (ptrW) - { - WCHAR env_var[MAX_LISTED_ENV_VAR]; - - childPrintf(hFile, "[EnvironmentW]\n"); - i = 0; - while (*ptrW) - { - lstrcpynW(env_var, ptrW, MAX_LISTED_ENV_VAR - 1); - env_var[MAX_LISTED_ENV_VAR - 1] = '\0'; - childPrintf(hFile, "env%d=%s\n", i, encodeW(env_var)); - i++; - ptrW += lstrlenW(ptrW) + 1; - } - childPrintf(hFile, "len=%d\n\n", i); - } - - childPrintf(hFile, "[Misc]\n"); - if (GetCurrentDirectoryA(sizeof(bufA), bufA)) - childPrintf(hFile, "CurrDirA=%s\n", encodeA(bufA)); - if (GetCurrentDirectoryW(sizeof(bufW) / sizeof(bufW[0]), bufW)) - childPrintf(hFile, "CurrDirW=%s\n", encodeW(bufW)); - childPrintf(hFile, "\n"); - - if (option && strcmp(option, "console") == 0) - { - CONSOLE_SCREEN_BUFFER_INFO sbi; - HANDLE hConIn = GetStdHandle(STD_INPUT_HANDLE); - HANDLE hConOut = GetStdHandle(STD_OUTPUT_HANDLE); - DWORD modeIn, modeOut; - - childPrintf(hFile, "[Console]\n"); - if (GetConsoleScreenBufferInfo(hConOut, &sbi)) - { - childPrintf(hFile, "SizeX=%d\nSizeY=%d\nCursorX=%d\nCursorY=%d\nAttributes=%d\n", - sbi.dwSize.X, sbi.dwSize.Y, sbi.dwCursorPosition.X, sbi.dwCursorPosition.Y, sbi.wAttributes); - childPrintf(hFile, "winLeft=%d\nwinTop=%d\nwinRight=%d\nwinBottom=%d\n", - sbi.srWindow.Left, sbi.srWindow.Top, sbi.srWindow.Right, sbi.srWindow.Bottom); - childPrintf(hFile, "maxWinWidth=%d\nmaxWinHeight=%d\n", - sbi.dwMaximumWindowSize.X, sbi.dwMaximumWindowSize.Y); - } - childPrintf(hFile, "InputCP=%d\nOutputCP=%d\n", - GetConsoleCP(), GetConsoleOutputCP()); - if (GetConsoleMode(hConIn, &modeIn)) - childPrintf(hFile, "InputMode=%ld\n", modeIn); - if (GetConsoleMode(hConOut, &modeOut)) - childPrintf(hFile, "OutputMode=%ld\n", modeOut); - - /* now that we have written all relevant information, let's change it */ - ok(SetConsoleCP(1252), "Setting CP\n"); - ok(SetConsoleOutputCP(1252), "Setting SB CP\n"); - ok(SetConsoleMode(hConIn, modeIn ^ 1), "Setting mode (%ld)\n", GetLastError()); - ok(SetConsoleMode(hConOut, modeOut ^ 1), "Setting mode (%ld)\n", GetLastError()); - sbi.dwCursorPosition.X ^= 1; - sbi.dwCursorPosition.Y ^= 1; - ok(SetConsoleCursorPosition(hConOut, sbi.dwCursorPosition), "Setting cursor position (%ld)\n", GetLastError()); - } - if (option && strcmp(option, "stdhandle") == 0) - { - HANDLE hStdIn = GetStdHandle(STD_INPUT_HANDLE); - HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); - - if (hStdIn != INVALID_HANDLE_VALUE || hStdOut != INVALID_HANDLE_VALUE) - { - char buf[1024]; - DWORD r, w; - - ok(ReadFile(hStdIn, buf, sizeof(buf), &r, NULL) && r > 0, "Reading message from input pipe\n"); - childPrintf(hFile, "[StdHandle]\nmsg=%s\n\n", encodeA(buf)); - ok(WriteFile(hStdOut, buf, r, &w, NULL) && w == r, "Writing message to output pipe\n"); - } - } - - if (option && strcmp(option, "exit_code") == 0) - { - childPrintf(hFile, "[ExitCode]\nvalue=%d\n\n", 123); - CloseHandle(hFile); - ExitProcess(123); - } - - CloseHandle(hFile); -} - -static char* getChildString(const char* sect, const char* key) -{ - char buf[1024+4*MAX_LISTED_ENV_VAR]; - char* ret; - - GetPrivateProfileStringA(sect, key, "-", buf, sizeof(buf), resfile); - if (buf[0] == '\0' || (buf[0] == '-' && buf[1] == '\0')) return NULL; - assert(!(strlen(buf) & 1)); - ret = decodeA(buf); - return ret; -} - -/* FIXME: this may be moved to the wtmain.c file, because it may be needed by - * others... (windows uses stricmp while Un*x uses strcasecmp...) - */ -static int wtstrcasecmp(const char* p1, const char* p2) -{ - char c1, c2; - - c1 = c2 = '@'; - while (c1 == c2 && c1) - { - c1 = *p1++; c2 = *p2++; - if (c1 != c2) - { - c1 = toupper(c1); c2 = toupper(c2); - } - } - return c1 - c2; -} - -static int strCmp(const char* s1, const char* s2, BOOL sensitive) -{ - if (!s1 && !s2) return 0; - if (!s2) return -1; - if (!s1) return 1; - return (sensitive) ? strcmp(s1, s2) : wtstrcasecmp(s1, s2); -} - -#define okChildString(sect, key, expect) \ - do { \ - char* result = getChildString((sect), (key)); \ - ok(strCmp(result, expect, 1) == 0, "%s:%s expected '%s', got '%s'\n", (sect), (key), (expect)?(expect):"(null)", result); \ - } while (0) - -#define okChildIString(sect, key, expect) \ - do { \ - char* result = getChildString(sect, key); \ - ok(strCmp(result, expect, 0) == 0, "%s:%s expected '%s', got '%s'\n", sect, key, expect, result); \ - } while (0) - -/* using !expect insures that the test will fail if the sect/key isn't present - * in result file - */ -#define okChildInt(sect, key, expect) \ - do { \ - UINT result = GetPrivateProfileIntA((sect), (key), !(expect), resfile); \ - ok(result == expect, "%s:%s expected %d, but got %d\n", (sect), (key), (int)(expect), result); \ - } while (0) - -static void test_Startup(void) -{ - char buffer[MAX_PATH]; - PROCESS_INFORMATION info; - STARTUPINFOA startup,si; - - /* let's start simplistic */ - memset(&startup, 0, sizeof(startup)); - startup.cb = sizeof(startup); - startup.dwFlags = STARTF_USESHOWWINDOW; - startup.wShowWindow = SW_SHOWNORMAL; - - get_file_name(resfile); - sprintf(buffer, "%s tests/process.c %s", selfname, resfile); - ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n"); - /* wait for child to terminate */ - ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); - /* child process has changed result file, so let profile functions know about it */ - WritePrivateProfileStringA(NULL, NULL, NULL, resfile); - - GetStartupInfoA(&si); - okChildInt("StartupInfoA", "cb", startup.cb); - okChildString("StartupInfoA", "lpDesktop", si.lpDesktop); - okChildString("StartupInfoA", "lpTitle", si.lpTitle); - okChildInt("StartupInfoA", "dwX", startup.dwX); - okChildInt("StartupInfoA", "dwY", startup.dwY); - okChildInt("StartupInfoA", "dwXSize", startup.dwXSize); - okChildInt("StartupInfoA", "dwYSize", startup.dwYSize); - okChildInt("StartupInfoA", "dwXCountChars", startup.dwXCountChars); - okChildInt("StartupInfoA", "dwYCountChars", startup.dwYCountChars); - okChildInt("StartupInfoA", "dwFillAttribute", startup.dwFillAttribute); - okChildInt("StartupInfoA", "dwFlags", startup.dwFlags); - okChildInt("StartupInfoA", "wShowWindow", startup.wShowWindow); - release_memory(); - assert(DeleteFileA(resfile) != 0); - - /* not so simplistic now */ - memset(&startup, 0, sizeof(startup)); - startup.cb = sizeof(startup); - startup.dwFlags = STARTF_USESHOWWINDOW; - startup.wShowWindow = SW_SHOWNORMAL; - startup.lpTitle = "I'm the title string"; - startup.lpDesktop = "I'm the desktop string"; - startup.dwXCountChars = 0x12121212; - startup.dwYCountChars = 0x23232323; - startup.dwX = 0x34343434; - startup.dwY = 0x45454545; - startup.dwXSize = 0x56565656; - startup.dwYSize = 0x67676767; - startup.dwFillAttribute = 0xA55A; - - get_file_name(resfile); - sprintf(buffer, "%s tests/process.c %s", selfname, resfile); - ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n"); - /* wait for child to terminate */ - ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); - /* child process has changed result file, so let profile functions know about it */ - WritePrivateProfileStringA(NULL, NULL, NULL, resfile); - - okChildInt("StartupInfoA", "cb", startup.cb); - okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop); - okChildString("StartupInfoA", "lpTitle", startup.lpTitle); - okChildInt("StartupInfoA", "dwX", startup.dwX); - okChildInt("StartupInfoA", "dwY", startup.dwY); - okChildInt("StartupInfoA", "dwXSize", startup.dwXSize); - okChildInt("StartupInfoA", "dwYSize", startup.dwYSize); - okChildInt("StartupInfoA", "dwXCountChars", startup.dwXCountChars); - okChildInt("StartupInfoA", "dwYCountChars", startup.dwYCountChars); - okChildInt("StartupInfoA", "dwFillAttribute", startup.dwFillAttribute); - okChildInt("StartupInfoA", "dwFlags", startup.dwFlags); - okChildInt("StartupInfoA", "wShowWindow", startup.wShowWindow); - release_memory(); - assert(DeleteFileA(resfile) != 0); - - /* not so simplistic now */ - memset(&startup, 0, sizeof(startup)); - startup.cb = sizeof(startup); - startup.dwFlags = STARTF_USESHOWWINDOW; - startup.wShowWindow = SW_SHOWNORMAL; - startup.lpTitle = "I'm the title string"; - startup.lpDesktop = NULL; - startup.dwXCountChars = 0x12121212; - startup.dwYCountChars = 0x23232323; - startup.dwX = 0x34343434; - startup.dwY = 0x45454545; - startup.dwXSize = 0x56565656; - startup.dwYSize = 0x67676767; - startup.dwFillAttribute = 0xA55A; - - get_file_name(resfile); - sprintf(buffer, "%s tests/process.c %s", selfname, resfile); - ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n"); - /* wait for child to terminate */ - ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); - /* child process has changed result file, so let profile functions know about it */ - WritePrivateProfileStringA(NULL, NULL, NULL, resfile); - - okChildInt("StartupInfoA", "cb", startup.cb); - okChildString("StartupInfoA", "lpDesktop", si.lpDesktop); - okChildString("StartupInfoA", "lpTitle", startup.lpTitle); - okChildInt("StartupInfoA", "dwX", startup.dwX); - okChildInt("StartupInfoA", "dwY", startup.dwY); - okChildInt("StartupInfoA", "dwXSize", startup.dwXSize); - okChildInt("StartupInfoA", "dwYSize", startup.dwYSize); - okChildInt("StartupInfoA", "dwXCountChars", startup.dwXCountChars); - okChildInt("StartupInfoA", "dwYCountChars", startup.dwYCountChars); - okChildInt("StartupInfoA", "dwFillAttribute", startup.dwFillAttribute); - okChildInt("StartupInfoA", "dwFlags", startup.dwFlags); - okChildInt("StartupInfoA", "wShowWindow", startup.wShowWindow); - release_memory(); - assert(DeleteFileA(resfile) != 0); - - /* not so simplistic now */ - memset(&startup, 0, sizeof(startup)); - startup.cb = sizeof(startup); - startup.dwFlags = STARTF_USESHOWWINDOW; - startup.wShowWindow = SW_SHOWNORMAL; - startup.lpTitle = "I'm the title string"; - startup.lpDesktop = ""; - startup.dwXCountChars = 0x12121212; - startup.dwYCountChars = 0x23232323; - startup.dwX = 0x34343434; - startup.dwY = 0x45454545; - startup.dwXSize = 0x56565656; - startup.dwYSize = 0x67676767; - startup.dwFillAttribute = 0xA55A; - - get_file_name(resfile); - sprintf(buffer, "%s tests/process.c %s", selfname, resfile); - ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n"); - /* wait for child to terminate */ - ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); - /* child process has changed result file, so let profile functions know about it */ - WritePrivateProfileStringA(NULL, NULL, NULL, resfile); - - okChildInt("StartupInfoA", "cb", startup.cb); - todo_wine okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop); - okChildString("StartupInfoA", "lpTitle", startup.lpTitle); - okChildInt("StartupInfoA", "dwX", startup.dwX); - okChildInt("StartupInfoA", "dwY", startup.dwY); - okChildInt("StartupInfoA", "dwXSize", startup.dwXSize); - okChildInt("StartupInfoA", "dwYSize", startup.dwYSize); - okChildInt("StartupInfoA", "dwXCountChars", startup.dwXCountChars); - okChildInt("StartupInfoA", "dwYCountChars", startup.dwYCountChars); - okChildInt("StartupInfoA", "dwFillAttribute", startup.dwFillAttribute); - okChildInt("StartupInfoA", "dwFlags", startup.dwFlags); - okChildInt("StartupInfoA", "wShowWindow", startup.wShowWindow); - release_memory(); - assert(DeleteFileA(resfile) != 0); - - /* not so simplistic now */ - memset(&startup, 0, sizeof(startup)); - startup.cb = sizeof(startup); - startup.dwFlags = STARTF_USESHOWWINDOW; - startup.wShowWindow = SW_SHOWNORMAL; - startup.lpTitle = NULL; - startup.lpDesktop = "I'm the desktop string"; - startup.dwXCountChars = 0x12121212; - startup.dwYCountChars = 0x23232323; - startup.dwX = 0x34343434; - startup.dwY = 0x45454545; - startup.dwXSize = 0x56565656; - startup.dwYSize = 0x67676767; - startup.dwFillAttribute = 0xA55A; - - get_file_name(resfile); - sprintf(buffer, "%s tests/process.c %s", selfname, resfile); - ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n"); - /* wait for child to terminate */ - ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); - /* child process has changed result file, so let profile functions know about it */ - WritePrivateProfileStringA(NULL, NULL, NULL, resfile); - - okChildInt("StartupInfoA", "cb", startup.cb); - okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop); - okChildString("StartupInfoA", "lpTitle", si.lpTitle); - okChildInt("StartupInfoA", "dwX", startup.dwX); - okChildInt("StartupInfoA", "dwY", startup.dwY); - okChildInt("StartupInfoA", "dwXSize", startup.dwXSize); - okChildInt("StartupInfoA", "dwYSize", startup.dwYSize); - okChildInt("StartupInfoA", "dwXCountChars", startup.dwXCountChars); - okChildInt("StartupInfoA", "dwYCountChars", startup.dwYCountChars); - okChildInt("StartupInfoA", "dwFillAttribute", startup.dwFillAttribute); - okChildInt("StartupInfoA", "dwFlags", startup.dwFlags); - okChildInt("StartupInfoA", "wShowWindow", startup.wShowWindow); - release_memory(); - assert(DeleteFileA(resfile) != 0); - - /* not so simplistic now */ - memset(&startup, 0, sizeof(startup)); - startup.cb = sizeof(startup); - startup.dwFlags = STARTF_USESHOWWINDOW; - startup.wShowWindow = SW_SHOWNORMAL; - startup.lpTitle = ""; - startup.lpDesktop = "I'm the desktop string"; - startup.dwXCountChars = 0x12121212; - startup.dwYCountChars = 0x23232323; - startup.dwX = 0x34343434; - startup.dwY = 0x45454545; - startup.dwXSize = 0x56565656; - startup.dwYSize = 0x67676767; - startup.dwFillAttribute = 0xA55A; - - get_file_name(resfile); - sprintf(buffer, "%s tests/process.c %s", selfname, resfile); - ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n"); - /* wait for child to terminate */ - ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); - /* child process has changed result file, so let profile functions know about it */ - WritePrivateProfileStringA(NULL, NULL, NULL, resfile); - - okChildInt("StartupInfoA", "cb", startup.cb); - okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop); - todo_wine okChildString("StartupInfoA", "lpTitle", startup.lpTitle); - okChildInt("StartupInfoA", "dwX", startup.dwX); - okChildInt("StartupInfoA", "dwY", startup.dwY); - okChildInt("StartupInfoA", "dwXSize", startup.dwXSize); - okChildInt("StartupInfoA", "dwYSize", startup.dwYSize); - okChildInt("StartupInfoA", "dwXCountChars", startup.dwXCountChars); - okChildInt("StartupInfoA", "dwYCountChars", startup.dwYCountChars); - okChildInt("StartupInfoA", "dwFillAttribute", startup.dwFillAttribute); - okChildInt("StartupInfoA", "dwFlags", startup.dwFlags); - okChildInt("StartupInfoA", "wShowWindow", startup.wShowWindow); - release_memory(); - assert(DeleteFileA(resfile) != 0); - - /* not so simplistic now */ - memset(&startup, 0, sizeof(startup)); - startup.cb = sizeof(startup); - startup.dwFlags = STARTF_USESHOWWINDOW; - startup.wShowWindow = SW_SHOWNORMAL; - startup.lpTitle = ""; - startup.lpDesktop = ""; - startup.dwXCountChars = 0x12121212; - startup.dwYCountChars = 0x23232323; - startup.dwX = 0x34343434; - startup.dwY = 0x45454545; - startup.dwXSize = 0x56565656; - startup.dwYSize = 0x67676767; - startup.dwFillAttribute = 0xA55A; - - get_file_name(resfile); - sprintf(buffer, "%s tests/process.c %s", selfname, resfile); - ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n"); - /* wait for child to terminate */ - ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); - /* child process has changed result file, so let profile functions know about it */ - WritePrivateProfileStringA(NULL, NULL, NULL, resfile); - - okChildInt("StartupInfoA", "cb", startup.cb); - todo_wine okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop); - todo_wine okChildString("StartupInfoA", "lpTitle", startup.lpTitle); - okChildInt("StartupInfoA", "dwX", startup.dwX); - okChildInt("StartupInfoA", "dwY", startup.dwY); - okChildInt("StartupInfoA", "dwXSize", startup.dwXSize); - okChildInt("StartupInfoA", "dwYSize", startup.dwYSize); - okChildInt("StartupInfoA", "dwXCountChars", startup.dwXCountChars); - okChildInt("StartupInfoA", "dwYCountChars", startup.dwYCountChars); - okChildInt("StartupInfoA", "dwFillAttribute", startup.dwFillAttribute); - okChildInt("StartupInfoA", "dwFlags", startup.dwFlags); - okChildInt("StartupInfoA", "wShowWindow", startup.wShowWindow); - release_memory(); - assert(DeleteFileA(resfile) != 0); - - /* TODO: test for A/W and W/A and W/W */ -} - -static void test_CommandLine(void) -{ - char buffer[MAX_PATH]; - PROCESS_INFORMATION info; - STARTUPINFOA startup; - - memset(&startup, 0, sizeof(startup)); - startup.cb = sizeof(startup); - startup.dwFlags = STARTF_USESHOWWINDOW; - startup.wShowWindow = SW_SHOWNORMAL; - - /* the basics */ - get_file_name(resfile); - sprintf(buffer, "%s tests/process.c %s \"C:\\Program Files\\my nice app.exe\"", selfname, resfile); - ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n"); - /* wait for child to terminate */ - ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); - /* child process has changed result file, so let profile functions know about it */ - WritePrivateProfileStringA(NULL, NULL, NULL, resfile); - - okChildInt("Arguments", "argcA", 4); - okChildString("Arguments", "argvA3", "C:\\Program Files\\my nice app.exe"); - okChildString("Arguments", "argvA4", NULL); - okChildString("Arguments", "CommandLineA", buffer); - release_memory(); - assert(DeleteFileA(resfile) != 0); - - memset(&startup, 0, sizeof(startup)); - startup.cb = sizeof(startup); - startup.dwFlags = STARTF_USESHOWWINDOW; - startup.wShowWindow = SW_SHOWNORMAL; - - /* from Frangois */ - get_file_name(resfile); - sprintf(buffer, "%s tests/process.c %s \"a\\\"b\\\\\" c\\\" d", selfname, resfile); - ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n"); - /* wait for child to terminate */ - ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); - /* child process has changed result file, so let profile functions know about it */ - WritePrivateProfileStringA(NULL, NULL, NULL, resfile); - - okChildInt("Arguments", "argcA", 6); - okChildString("Arguments", "argvA3", "a\"b\\"); - okChildString("Arguments", "argvA4", "c\""); - okChildString("Arguments", "argvA5", "d"); - okChildString("Arguments", "argvA6", NULL); - okChildString("Arguments", "CommandLineA", buffer); - release_memory(); - assert(DeleteFileA(resfile) != 0); -} - -static void test_Directory(void) -{ - char buffer[MAX_PATH]; - PROCESS_INFORMATION info; - STARTUPINFOA startup; - char windir[MAX_PATH]; - - memset(&startup, 0, sizeof(startup)); - startup.cb = sizeof(startup); - startup.dwFlags = STARTF_USESHOWWINDOW; - startup.wShowWindow = SW_SHOWNORMAL; - - /* the basics */ - get_file_name(resfile); - sprintf(buffer, "%s tests/process.c %s", selfname, resfile); - GetWindowsDirectoryA( windir, sizeof(windir) ); - ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, windir, &startup, &info), "CreateProcess\n"); - /* wait for child to terminate */ - ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); - /* child process has changed result file, so let profile functions know about it */ - WritePrivateProfileStringA(NULL, NULL, NULL, resfile); - - okChildIString("Misc", "CurrDirA", windir); - release_memory(); - assert(DeleteFileA(resfile) != 0); -} - -static BOOL is_str_env_drive_dir(const char* str) -{ - return str[0] == '=' && str[1] >= 'A' && str[1] <= 'Z' && str[2] == ':' && - str[3] == '=' && str[4] == str[1]; -} - -/* compared expected child's environment (in gesA) from actual - * environment our child got - */ -static void cmpEnvironment(const char* gesA) -{ - int i, clen; - const char* ptrA; - char* res; - char key[32]; - BOOL found; - - clen = GetPrivateProfileIntA("EnvironmentA", "len", 0, resfile); - - /* now look each parent env in child */ - if ((ptrA = gesA) != NULL) - { - while (*ptrA) - { - for (i = 0; i < clen; i++) - { - sprintf(key, "env%d", i); - res = getChildString("EnvironmentA", key); - if (strncmp(ptrA, res, MAX_LISTED_ENV_VAR - 1) == 0) - break; - } - found = i < clen; - ok(found, "Parent-env string %s isn't in child process\n", ptrA); - - ptrA += strlen(ptrA) + 1; - release_memory(); - } - } - /* and each child env in parent */ - for (i = 0; i < clen; i++) - { - sprintf(key, "env%d", i); - res = getChildString("EnvironmentA", key); - if ((ptrA = gesA) != NULL) - { - while (*ptrA) - { - if (strncmp(res, ptrA, MAX_LISTED_ENV_VAR - 1) == 0) - break; - ptrA += strlen(ptrA) + 1; - } - if (!*ptrA) ptrA = NULL; - } - - if (!is_str_env_drive_dir(res)) - { - found = ptrA != NULL; - ok(found, "Child-env string %s isn't in parent process\n", res); - } - /* else => should also test we get the right per drive default directory here... */ - } -} - -static void test_Environment(void) -{ - char buffer[MAX_PATH]; - PROCESS_INFORMATION info; - STARTUPINFOA startup; - char child_env[4096]; - char* ptr; - char* env; - - memset(&startup, 0, sizeof(startup)); - startup.cb = sizeof(startup); - startup.dwFlags = STARTF_USESHOWWINDOW; - startup.wShowWindow = SW_SHOWNORMAL; - - /* the basics */ - get_file_name(resfile); - sprintf(buffer, "%s tests/process.c %s", selfname, resfile); - ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n"); - /* wait for child to terminate */ - ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); - /* child process has changed result file, so let profile functions know about it */ - WritePrivateProfileStringA(NULL, NULL, NULL, resfile); - - cmpEnvironment(GetEnvironmentStringsA()); - release_memory(); - assert(DeleteFileA(resfile) != 0); - - memset(&startup, 0, sizeof(startup)); - startup.cb = sizeof(startup); - startup.dwFlags = STARTF_USESHOWWINDOW; - startup.wShowWindow = SW_SHOWNORMAL; - - /* the basics */ - get_file_name(resfile); - sprintf(buffer, "%s tests/process.c %s", selfname, resfile); - ptr = child_env; - sprintf(ptr, "=%c:=%s", 'C', "C:\\FOO\\BAR"); - ptr += strlen(ptr) + 1; - strcpy(ptr, "PATH=C:\\WINDOWS;C:\\WINDOWS\\SYSTEM;C:\\MY\\OWN\\DIR"); - ptr += strlen(ptr) + 1; - strcpy(ptr, "FOO=BAR"); - ptr += strlen(ptr) + 1; - strcpy(ptr, "BAR=FOOBAR"); - ptr += strlen(ptr) + 1; - /* copy all existing variables except: - * - WINELOADER - * - PATH (already set above) - * - the directory definitions (=[A-Z]:=) - */ - for (env = GetEnvironmentStringsA(); *env; env += strlen(env) + 1) - { - if (strncmp(env, "PATH=", 5) != 0 && - strncmp(env, "WINELOADER=", 11) != 0 && - !is_str_env_drive_dir(env)) - { - strcpy(ptr, env); - ptr += strlen(ptr) + 1; - } - } - *ptr = '\0'; - ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, child_env, NULL, &startup, &info), "CreateProcess\n"); - /* wait for child to terminate */ - ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); - /* child process has changed result file, so let profile functions know about it */ - WritePrivateProfileStringA(NULL, NULL, NULL, resfile); - - cmpEnvironment(child_env); - - release_memory(); - assert(DeleteFileA(resfile) != 0); -} - -static void test_SuspendFlag(void) -{ - char buffer[MAX_PATH]; - PROCESS_INFORMATION info; - STARTUPINFOA startup; - DWORD exit_status; - - /* let's start simplistic */ - memset(&startup, 0, sizeof(startup)); - startup.cb = sizeof(startup); - startup.dwFlags = STARTF_USESHOWWINDOW; - startup.wShowWindow = SW_SHOWNORMAL; - - get_file_name(resfile); - sprintf(buffer, "%s tests/process.c %s", selfname, resfile); - ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, NULL, &startup, &info), "CreateProcess\n"); - - ok(GetExitCodeThread(info.hThread, &exit_status) && exit_status == STILL_ACTIVE, "thread still running\n"); - Sleep(8000); - ok(GetExitCodeThread(info.hThread, &exit_status) && exit_status == STILL_ACTIVE, "thread still running\n"); - ok(ResumeThread(info.hThread) == 1, "Resuming thread\n"); - - /* wait for child to terminate */ - ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); - /* child process has changed result file, so let profile functions know about it */ - WritePrivateProfileStringA(NULL, NULL, NULL, resfile); - - okChildInt("StartupInfoA", "cb", startup.cb); - okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop); - okChildString("StartupInfoA", "lpTitle", startup.lpTitle); - okChildInt("StartupInfoA", "dwX", startup.dwX); - okChildInt("StartupInfoA", "dwY", startup.dwY); - okChildInt("StartupInfoA", "dwXSize", startup.dwXSize); - okChildInt("StartupInfoA", "dwYSize", startup.dwYSize); - okChildInt("StartupInfoA", "dwXCountChars", startup.dwXCountChars); - okChildInt("StartupInfoA", "dwYCountChars", startup.dwYCountChars); - okChildInt("StartupInfoA", "dwFillAttribute", startup.dwFillAttribute); - okChildInt("StartupInfoA", "dwFlags", startup.dwFlags); - okChildInt("StartupInfoA", "wShowWindow", startup.wShowWindow); - release_memory(); - assert(DeleteFileA(resfile) != 0); -} - -static void test_DebuggingFlag(void) -{ - char buffer[MAX_PATH]; - PROCESS_INFORMATION info; - STARTUPINFOA startup; - DEBUG_EVENT de; - unsigned dbg = 0; - - /* let's start simplistic */ - memset(&startup, 0, sizeof(startup)); - startup.cb = sizeof(startup); - startup.dwFlags = STARTF_USESHOWWINDOW; - startup.wShowWindow = SW_SHOWNORMAL; - - get_file_name(resfile); - sprintf(buffer, "%s tests/process.c %s", selfname, resfile); - ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, DEBUG_PROCESS, NULL, NULL, &startup, &info), "CreateProcess\n"); - - /* get all startup events up to the entry point break exception */ - do - { - ok(WaitForDebugEvent(&de, INFINITE), "reading debug event\n"); - ContinueDebugEvent(de.dwProcessId, de.dwThreadId, DBG_CONTINUE); - if (de.dwDebugEventCode != EXCEPTION_DEBUG_EVENT) dbg++; - } while (de.dwDebugEventCode != EXIT_PROCESS_DEBUG_EVENT); - - ok(dbg, "I have seen a debug event\n"); - /* wait for child to terminate */ - ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); - /* child process has changed result file, so let profile functions know about it */ - WritePrivateProfileStringA(NULL, NULL, NULL, resfile); - - okChildInt("StartupInfoA", "cb", startup.cb); - okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop); - okChildString("StartupInfoA", "lpTitle", startup.lpTitle); - okChildInt("StartupInfoA", "dwX", startup.dwX); - okChildInt("StartupInfoA", "dwY", startup.dwY); - okChildInt("StartupInfoA", "dwXSize", startup.dwXSize); - okChildInt("StartupInfoA", "dwYSize", startup.dwYSize); - okChildInt("StartupInfoA", "dwXCountChars", startup.dwXCountChars); - okChildInt("StartupInfoA", "dwYCountChars", startup.dwYCountChars); - okChildInt("StartupInfoA", "dwFillAttribute", startup.dwFillAttribute); - okChildInt("StartupInfoA", "dwFlags", startup.dwFlags); - okChildInt("StartupInfoA", "wShowWindow", startup.wShowWindow); - release_memory(); - assert(DeleteFileA(resfile) != 0); -} - -static void test_Console(void) -{ - char buffer[MAX_PATH]; - PROCESS_INFORMATION info; - STARTUPINFOA startup; - SECURITY_ATTRIBUTES sa; - CONSOLE_SCREEN_BUFFER_INFO sbi, sbiC; - DWORD modeIn, modeOut, modeInC, modeOutC; - DWORD cpIn, cpOut, cpInC, cpOutC; - DWORD w; - HANDLE hChildIn, hChildInInh, hChildOut, hChildOutInh, hParentIn, hParentOut; - const char* msg = "This is a std-handle inheritance test."; - unsigned msg_len; - - memset(&startup, 0, sizeof(startup)); - startup.cb = sizeof(startup); - startup.dwFlags = STARTF_USESHOWWINDOW|STARTF_USESTDHANDLES; - startup.wShowWindow = SW_SHOWNORMAL; - - sa.nLength = sizeof(sa); - sa.lpSecurityDescriptor = NULL; - sa.bInheritHandle = TRUE; - - startup.hStdInput = CreateFileA("CONIN$", GENERIC_READ|GENERIC_WRITE, 0, &sa, OPEN_EXISTING, 0, 0); - startup.hStdOutput = CreateFileA("CONOUT$", GENERIC_READ|GENERIC_WRITE, 0, &sa, OPEN_EXISTING, 0, 0); - - /* first, we need to be sure we're attached to a console */ - if (startup.hStdInput == INVALID_HANDLE_VALUE || startup.hStdOutput == INVALID_HANDLE_VALUE) - { - /* we're not attached to a console, let's do it */ - AllocConsole(); - startup.hStdInput = CreateFileA("CONIN$", GENERIC_READ|GENERIC_WRITE, 0, &sa, OPEN_EXISTING, 0, 0); - startup.hStdOutput = CreateFileA("CONOUT$", GENERIC_READ|GENERIC_WRITE, 0, &sa, OPEN_EXISTING, 0, 0); - } - /* now verify everything's ok */ - ok(startup.hStdInput != INVALID_HANDLE_VALUE, "Opening ConIn\n"); - ok(startup.hStdOutput != INVALID_HANDLE_VALUE, "Opening ConOut\n"); - startup.hStdError = startup.hStdOutput; - - ok(GetConsoleScreenBufferInfo(startup.hStdOutput, &sbi), "Getting sb info\n"); - ok(GetConsoleMode(startup.hStdInput, &modeIn) && - GetConsoleMode(startup.hStdOutput, &modeOut), "Getting console modes\n"); - cpIn = GetConsoleCP(); - cpOut = GetConsoleOutputCP(); - - get_file_name(resfile); - sprintf(buffer, "%s tests/process.c %s console", selfname, resfile); - ok(CreateProcessA(NULL, buffer, NULL, NULL, TRUE, 0, NULL, NULL, &startup, &info), "CreateProcess\n"); - - /* wait for child to terminate */ - ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); - /* child process has changed result file, so let profile functions know about it */ - WritePrivateProfileStringA(NULL, NULL, NULL, resfile); - - /* now get the modification the child has made, and resets parents expected values */ - ok(GetConsoleScreenBufferInfo(startup.hStdOutput, &sbiC), "Getting sb info\n"); - ok(GetConsoleMode(startup.hStdInput, &modeInC) && - GetConsoleMode(startup.hStdOutput, &modeOutC), "Getting console modes\n"); - - SetConsoleMode(startup.hStdInput, modeIn); - SetConsoleMode(startup.hStdOutput, modeOut); - - cpInC = GetConsoleCP(); - cpOutC = GetConsoleOutputCP(); - SetConsoleCP(cpIn); - SetConsoleOutputCP(cpOut); - - okChildInt("StartupInfoA", "cb", startup.cb); - okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop); - okChildString("StartupInfoA", "lpTitle", startup.lpTitle); - okChildInt("StartupInfoA", "dwX", startup.dwX); - okChildInt("StartupInfoA", "dwY", startup.dwY); - okChildInt("StartupInfoA", "dwXSize", startup.dwXSize); - okChildInt("StartupInfoA", "dwYSize", startup.dwYSize); - okChildInt("StartupInfoA", "dwXCountChars", startup.dwXCountChars); - okChildInt("StartupInfoA", "dwYCountChars", startup.dwYCountChars); - okChildInt("StartupInfoA", "dwFillAttribute", startup.dwFillAttribute); - okChildInt("StartupInfoA", "dwFlags", startup.dwFlags); - okChildInt("StartupInfoA", "wShowWindow", startup.wShowWindow); - - /* check child correctly inherited the console */ - okChildInt("StartupInfoA", "hStdInput", (DWORD)startup.hStdInput); - okChildInt("StartupInfoA", "hStdOutput", (DWORD)startup.hStdOutput); - okChildInt("StartupInfoA", "hStdError", (DWORD)startup.hStdError); - okChildInt("Console", "SizeX", sbi.dwSize.X); - okChildInt("Console", "SizeY", sbi.dwSize.Y); - okChildInt("Console", "CursorX", sbi.dwCursorPosition.X); - okChildInt("Console", "CursorY", sbi.dwCursorPosition.Y); - okChildInt("Console", "Attributes", sbi.wAttributes); - okChildInt("Console", "winLeft", sbi.srWindow.Left); - okChildInt("Console", "winTop", sbi.srWindow.Top); - okChildInt("Console", "winRight", sbi.srWindow.Right); - okChildInt("Console", "winBottom", sbi.srWindow.Bottom); - okChildInt("Console", "maxWinWidth", sbi.dwMaximumWindowSize.X); - okChildInt("Console", "maxWinHeight", sbi.dwMaximumWindowSize.Y); - okChildInt("Console", "InputCP", cpIn); - okChildInt("Console", "OutputCP", cpOut); - okChildInt("Console", "InputMode", modeIn); - okChildInt("Console", "OutputMode", modeOut); - - todo_wine ok(cpInC == 1252, "Wrong console CP (expected 1252 got %ld/%ld)\n", cpInC, cpIn); - todo_wine ok(cpOutC == 1252, "Wrong console-SB CP (expected 1252 got %ld/%ld)\n", cpOutC, cpOut); - ok(modeInC == (modeIn ^ 1), "Wrong console mode\n"); - ok(modeOutC == (modeOut ^ 1), "Wrong console-SB mode\n"); - ok(sbiC.dwCursorPosition.X == (sbi.dwCursorPosition.X ^ 1), "Wrong cursor position\n"); - ok(sbiC.dwCursorPosition.Y == (sbi.dwCursorPosition.Y ^ 1), "Wrong cursor position\n"); - - release_memory(); - assert(DeleteFileA(resfile) != 0); - - ok(CreatePipe(&hParentIn, &hChildOut, NULL, 0), "Creating parent-input pipe\n"); - ok(DuplicateHandle(GetCurrentProcess(), hChildOut, GetCurrentProcess(), - &hChildOutInh, 0, TRUE, DUPLICATE_SAME_ACCESS), - "Duplicating as inheritable child-output pipe\n"); - CloseHandle(hChildOut); - - ok(CreatePipe(&hChildIn, &hParentOut, NULL, 0), "Creating parent-output pipe\n"); - ok(DuplicateHandle(GetCurrentProcess(), hChildIn, GetCurrentProcess(), - &hChildInInh, 0, TRUE, DUPLICATE_SAME_ACCESS), - "Duplicating as inheritable child-input pipe\n"); - CloseHandle(hChildIn); - - memset(&startup, 0, sizeof(startup)); - startup.cb = sizeof(startup); - startup.dwFlags = STARTF_USESHOWWINDOW|STARTF_USESTDHANDLES; - startup.wShowWindow = SW_SHOWNORMAL; - startup.hStdInput = hChildInInh; - startup.hStdOutput = hChildOutInh; - startup.hStdError = hChildOutInh; - - get_file_name(resfile); - sprintf(buffer, "%s tests/process.c %s stdhandle", selfname, resfile); - ok(CreateProcessA(NULL, buffer, NULL, NULL, TRUE, DETACHED_PROCESS, NULL, NULL, &startup, &info), "CreateProcess\n"); - ok(CloseHandle(hChildInInh), "Closing handle\n"); - ok(CloseHandle(hChildOutInh), "Closing handle\n"); - - msg_len = strlen(msg) + 1; - ok(WriteFile(hParentOut, msg, msg_len, &w, NULL), "Writing to child\n"); - ok(w == msg_len, "Should have written %u bytes, actually wrote %lu\n", msg_len, w); - memset(buffer, 0, sizeof(buffer)); - ok(ReadFile(hParentIn, buffer, sizeof(buffer), &w, NULL), "Reading from child\n"); - ok(strcmp(buffer, msg) == 0, "Should have received '%s'\n", msg); - - /* wait for child to terminate */ - ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); - /* child process has changed result file, so let profile functions know about it */ - WritePrivateProfileStringA(NULL, NULL, NULL, resfile); - - okChildString("StdHandle", "msg", msg); - - release_memory(); - assert(DeleteFileA(resfile) != 0); -} - -static void test_ExitCode(void) -{ - char buffer[MAX_PATH]; - PROCESS_INFORMATION info; - STARTUPINFOA startup; - DWORD code; - - /* let's start simplistic */ - memset(&startup, 0, sizeof(startup)); - startup.cb = sizeof(startup); - startup.dwFlags = STARTF_USESHOWWINDOW; - startup.wShowWindow = SW_SHOWNORMAL; - - get_file_name(resfile); - sprintf(buffer, "%s tests/process.c %s exit_code", selfname, resfile); - ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &startup, &info), "CreateProcess\n"); - - /* wait for child to terminate */ - ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); - /* child process has changed result file, so let profile functions know about it */ - WritePrivateProfileStringA(NULL, NULL, NULL, resfile); - - ok(GetExitCodeProcess(info.hProcess, &code), "Getting exit code\n"); - okChildInt("ExitCode", "value", code); - - release_memory(); - assert(DeleteFileA(resfile) != 0); -} - -START_TEST(process) -{ - int b = init(); - ok(b, "Basic init of CreateProcess test\n"); - if (!b) return; - - if (myARGC >= 3) - { - doChild(myARGV[2], (myARGC == 3) ? NULL : myARGV[3]); - return; - } - test_Startup(); - test_CommandLine(); - test_Directory(); - test_Environment(); - test_SuspendFlag(); - test_DebuggingFlag(); - test_Console(); - test_ExitCode(); - /* things that can be tested: - * lookup: check the way program to be executed is searched - * handles: check the handle inheritance stuff (+sec options) - * console: check if console creation parameters work - */ -} diff --git a/reactos/apps/tests/kernel32/profile.c b/reactos/apps/tests/kernel32/profile.c deleted file mode 100644 index 3fff5a45e13..00000000000 --- a/reactos/apps/tests/kernel32/profile.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Unit tests for profile functions - * - * Copyright (c) 2003 Stefan Leichter - * - * 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 "windows.h" - -#define KEY "ProfileInt" -#define SECTION "Test" -#define TESTFILE ".\\testwine.ini" - -struct _profileInt { - LPCSTR section; - LPCSTR key; - LPCSTR value; - LPCSTR iniFile; - INT defaultVal; - UINT result; -}; - -static void test_profile_int(void) -{ - struct _profileInt profileInt[]={ - { NULL, NULL, NULL, NULL, 70, 0 }, /* 0 */ - { NULL, NULL, NULL, TESTFILE, -1, 4294967295U}, - { NULL, NULL, NULL, TESTFILE, 1, 1 }, - { SECTION, NULL, NULL, TESTFILE, -1, 4294967295U}, - { SECTION, NULL, NULL, TESTFILE, 1, 1 }, - { NULL, KEY, NULL, TESTFILE, -1, 4294967295U}, /* 5 */ - { NULL, KEY, NULL, TESTFILE, 1, 1 }, - { SECTION, KEY, NULL, TESTFILE, -1, 4294967295U}, - { SECTION, KEY, NULL, TESTFILE, 1, 1 }, - { SECTION, KEY, "-1", TESTFILE, -1, 4294967295U}, - { SECTION, KEY, "-1", TESTFILE, 1, 4294967295U}, /* 10 */ - { SECTION, KEY, "1", TESTFILE, -1, 1 }, - { SECTION, KEY, "1", TESTFILE, 1, 1 }, - { SECTION, KEY, "+1", TESTFILE, -1, 1 }, - { SECTION, KEY, "+1", TESTFILE, 1, 1 }, - { SECTION, KEY, "4294967296", TESTFILE, -1, 0 }, /* 15 */ - { SECTION, KEY, "4294967296", TESTFILE, 1, 0 }, - { SECTION, KEY, "4294967297", TESTFILE, -1, 1 }, - { SECTION, KEY, "4294967297", TESTFILE, 1, 1 }, - { SECTION, KEY, "-4294967297", TESTFILE, -1, 4294967295U}, - { SECTION, KEY, "-4294967297", TESTFILE, 1, 4294967295U}, /* 20 */ - { SECTION, KEY, "42A94967297", TESTFILE, -1, 42 }, - { SECTION, KEY, "42A94967297", TESTFILE, 1, 42 }, - { SECTION, KEY, "B4294967297", TESTFILE, -1, 0 }, - { SECTION, KEY, "B4294967297", TESTFILE, 1, 0 }, - }; - int i, num_test = (sizeof(profileInt)/sizeof(struct _profileInt)); - UINT res; - - DeleteFileA( TESTFILE); - - for (i=0; i < num_test; i++) { - if (profileInt[i].value) - WritePrivateProfileStringA(SECTION, KEY, profileInt[i].value, - profileInt[i].iniFile); - - res = GetPrivateProfileIntA(profileInt[i].section, profileInt[i].key, - profileInt[i].defaultVal, profileInt[i].iniFile); - ok(res == profileInt[i].result, "test<%02d>: ret<%010u> exp<%010u>\n", - i, res, profileInt[i].result); - } - - DeleteFileA( TESTFILE); -} - -START_TEST(profile) -{ - test_profile_int(); -} diff --git a/reactos/apps/tests/kernel32/testlist.c b/reactos/apps/tests/kernel32/testlist.c deleted file mode 100644 index 38ab39345c8..00000000000 --- a/reactos/apps/tests/kernel32/testlist.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Automatically generated file; DO NOT EDIT!! */ - -#include -#include -#include -#include "windef.h" -#include "winbase.h" - -#if 0 -extern void func_alloc(void); -#endif -extern void func_atom(void); -extern void func_change(void); -extern void func_codepage(void); -extern void func_comm(void); -extern void func_console(void); -extern void func_directory(void); -extern void func_drive(void); -extern void func_environ(void); -extern void func_file(void); -extern void func_format_msg(void); -extern void func_heap(void); -extern void func_locale(void); -extern void func_mailslot(void); -extern void func_path(void); -extern void func_pipe(void); -extern void func_process(void); -extern void func_profile(void); -extern void func_thread(void); -extern void func_virtual(void); - -struct test -{ - const char *name; - void (*func)(void); -}; - -static const struct test winetest_testlist[] = -{ -#if 0 - { "alloc", func_alloc }, -#endif - { "atom", func_atom }, - { "change", func_change }, - { "codepage", func_codepage }, - { "comm", func_comm }, - { "console", func_console }, - { "directory", func_directory }, - { "drive", func_drive }, - { "environ", func_environ }, - { "file", func_file }, - { "format_msg", func_format_msg }, - { "heap", func_heap }, - { "locale", func_locale }, - { "mailslot", func_mailslot }, - { "path", func_path }, - { "pipe", func_pipe }, - { "process", func_process }, - { "profile", func_profile }, - { "thread", func_thread }, - { "virtual", func_virtual }, - { 0, 0 } -}; - -#define WINETEST_WANT_MAIN -#include "wine/test.h" diff --git a/reactos/apps/tests/kernel32/thread.c b/reactos/apps/tests/kernel32/thread.c deleted file mode 100644 index 5fae9682a91..00000000000 --- a/reactos/apps/tests/kernel32/thread.c +++ /dev/null @@ -1,572 +0,0 @@ -/* - * Unit test suite for directory functions. - * - * Copyright 2002 Geoffrey Hausheer - * - * 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 - */ - -/* Define _WIN32_WINNT to get SetThreadIdealProcessor on Windows */ -#define _WIN32_WINNT 0x0500 - -#include - -#include "wine/test.h" -#include -#include -#include -#include - -/* Specify the number of simultaneous threads to test */ -#define NUM_THREADS 4 -/* Specify whether to test the extended priorities for Win2k/XP */ -#define USE_EXTENDED_PRIORITIES 0 -/* Specify whether to test the stack allocation in CreateThread */ -#define CHECK_STACK 0 - -/* Set CHECK_STACK to 1 if you want to try to test the stack-limit from - CreateThread. So far I have been unable to make this work, and - I am in doubt as to how portable it is. Also, according to MSDN, - you shouldn't mix C-run-time-libraries (i.e. alloca) with CreateThread. - Anyhow, the check is currently commented out -*/ -#if CHECK_STACK - #ifdef __try - #define __TRY __try - #define __EXCEPT __except - #define __ENDTRY - #else - #include "wine/exception.h" - #endif -#endif - -typedef BOOL (WINAPI *GetThreadPriorityBoost_t)(HANDLE,PBOOL); -static GetThreadPriorityBoost_t pGetThreadPriorityBoost=NULL; - -typedef HANDLE (WINAPI *OpenThread_t)(DWORD,BOOL,DWORD); -static OpenThread_t pOpenThread=NULL; - -typedef DWORD (WINAPI *SetThreadIdealProcessor_t)(HANDLE,DWORD); -static SetThreadIdealProcessor_t pSetThreadIdealProcessor=NULL; - -typedef BOOL (WINAPI *SetThreadPriorityBoost_t)(HANDLE,BOOL); -static SetThreadPriorityBoost_t pSetThreadPriorityBoost=NULL; - -/* Functions not tested yet: - AttachThreadInput - CreateRemoteThread - SetThreadContext - SwitchToThread - -In addition there are no checks that the inheritance works properly in -CreateThread -*/ - -DWORD tlsIndex; - -typedef struct { - int threadnum; - HANDLE *event; - DWORD *threadmem; -} t1Struct; - -/* Basic test that simulatneous threads can access shared memory, - that the thread local storage routines work correctly, and that - threads actually run concurrently -*/ -VOID WINAPI threadFunc1(t1Struct *tstruct) -{ - int i; -/* write our thread # into shared memory */ - tstruct->threadmem[tstruct->threadnum]=GetCurrentThreadId(); - ok(TlsSetValue(tlsIndex,(LPVOID)(tstruct->threadnum+1))!=0, - "TlsSetValue failed\n"); -/* The threads synchronize before terminating. This is done by - Signaling an event, and waiting for all events to occur -*/ - SetEvent(tstruct->event[tstruct->threadnum]); - WaitForMultipleObjects(NUM_THREADS,tstruct->event,TRUE,INFINITE); -/* Double check that all threads really did run by validating that - they have all written to the shared memory. There should be no race - here, since all threads were synchronized after the write.*/ - for(i=0;ithreadmem[i]==0) ; - } -/* Check that noone cahnged our tls memory */ - ok((int)TlsGetValue(tlsIndex)-1==tstruct->threadnum, - "TlsGetValue failed\n"); - ExitThread(NUM_THREADS+tstruct->threadnum); -} - -VOID WINAPI threadFunc2() -{ - ExitThread(99); -} - -VOID WINAPI threadFunc3() -{ - HANDLE thread; - thread=GetCurrentThread(); - SuspendThread(thread); - ExitThread(99); -} - -VOID WINAPI threadFunc4(HANDLE event) -{ - if(event != NULL) { - SetEvent(event); - } - Sleep(99000); - ExitThread(0); -} - -#if CHECK_STACK -VOID WINAPI threadFunc5(DWORD *exitCode) -{ - SYSTEM_INFO sysInfo; - sysInfo.dwPageSize=0; - GetSystemInfo(&sysInfo); - *exitCode=0; - __TRY - { - alloca(2*sysInfo.dwPageSize); - } - __EXCEPT(1) { - *exitCode=1; - } - __ENDTRY - ExitThread(0); -} -#endif - -/* Check basic funcationality of CreateThread and Tls* functions */ -VOID test_CreateThread_basic() -{ - HANDLE thread[NUM_THREADS],event[NUM_THREADS]; - DWORD threadid[NUM_THREADS],curthreadId; - DWORD threadmem[NUM_THREADS]; - DWORD exitCode; - t1Struct tstruct[NUM_THREADS]; - int error; - DWORD i,j; -/* Retrieve current Thread ID for later comparisons */ - curthreadId=GetCurrentThreadId(); -/* Allocate some local storage */ - ok((tlsIndex=TlsAlloc())!=TLS_OUT_OF_INDEXES,"TlsAlloc failed\n"); -/* Create events for thread synchronization */ - for(i=0;i0,"GetSystemInfo should return a valid page size\n"); - thread = CreateThread(NULL,sysInfo.dwPageSize, - (LPTHREAD_START_ROUTINE)threadFunc5,&exitCode, - 0,&threadId); - ok(WaitForSingleObject(thread,5000)==WAIT_OBJECT_0, - "TerminateThread didn't work\n"); - ok(exitCode==1,"CreateThread did not obey stack-size-limit\n"); - ok(CloseHandle(thread)!=0,"CloseHandle failed\n"); -#endif -} - -/* Check whether setting/retrieving thread priorities works */ -VOID test_thread_priority() -{ - HANDLE curthread,access_thread; - DWORD curthreadId,exitCode; - int min_priority=-2,max_priority=2; - BOOL disabled; - int i; - - curthread=GetCurrentThread(); - curthreadId=GetCurrentThreadId(); -/* Check thread priority */ -/* NOTE: on Win2k/XP priority can be from -7 to 6. All other platforms it - is -2 to 2. However, even on a real Win2k system, using thread - priorities beyond the -2 to 2 range does not work. If you want to try - anyway, enable USE_EXTENDED_PRIORITIES -*/ - ok(GetThreadPriority(curthread)==THREAD_PRIORITY_NORMAL, - "GetThreadPriority Failed\n"); - - if (pOpenThread) { -/* check that access control is obeyed */ - access_thread=pOpenThread(THREAD_ALL_ACCESS & - (~THREAD_QUERY_INFORMATION) & (~THREAD_SET_INFORMATION), - 0,curthreadId); - ok(access_thread!=NULL,"OpenThread returned an invalid handle\n"); - if (access_thread!=NULL) { - ok(SetThreadPriority(access_thread,1)==0, - "SetThreadPriority did not obey access restrictions\n"); - ok(GetThreadPriority(access_thread)==THREAD_PRIORITY_ERROR_RETURN, - "GetThreadPriority did not obey access restrictions\n"); - if (pSetThreadPriorityBoost) - ok(pSetThreadPriorityBoost(access_thread,1)==0, - "SetThreadPriorityBoost did not obey access restrictions\n"); - if (pGetThreadPriorityBoost) - ok(pGetThreadPriorityBoost(access_thread,&disabled)==0, - "GetThreadPriorityBoost did not obey access restrictions\n"); - ok(GetExitCodeThread(access_thread,&exitCode)==0, - "GetExitCodeThread did not obey access restrictions\n"); - ok(CloseHandle(access_thread),"Error Closing thread handle\n"); - } -#if USE_EXTENDED_PRIORITIES - min_priority=-7; max_priority=6; -#endif - } - for(i=min_priority;i<=max_priority;i++) { - ok(SetThreadPriority(curthread,i)!=0, - "SetThreadPriority Failed for priority: %d\n",i); - ok(GetThreadPriority(curthread)==i, - "GetThreadPriority Failed for priority: %d\n",i); - } - ok(SetThreadPriority(curthread,THREAD_PRIORITY_TIME_CRITICAL)!=0, - "SetThreadPriority Failed\n"); - ok(GetThreadPriority(curthread)==THREAD_PRIORITY_TIME_CRITICAL, - "GetThreadPriority Failed\n"); - ok(SetThreadPriority(curthread,THREAD_PRIORITY_IDLE)!=0, - "SetThreadPriority Failed\n"); - ok(GetThreadPriority(curthread)==THREAD_PRIORITY_IDLE, - "GetThreadPriority Failed\n"); - ok(SetThreadPriority(curthread,0)!=0,"SetThreadPriority Failed\n"); - -/* Check thread priority boost */ - if (pGetThreadPriorityBoost && pSetThreadPriorityBoost) { - BOOL rc; - todo_wine { - SetLastError(0); - rc=pGetThreadPriorityBoost(curthread,&disabled); - if (rc!=0 || GetLastError()!=ERROR_CALL_NOT_IMPLEMENTED) { - ok(rc!=0,"error=%ld\n",GetLastError()); - - ok(pSetThreadPriorityBoost(curthread,1)!=0, - "error=%ld\n",GetLastError()); - rc=pGetThreadPriorityBoost(curthread,&disabled); - ok(rc!=0 && disabled==1, - "rc=%d error=%ld disabled=%d\n",rc,GetLastError(),disabled); - - ok(pSetThreadPriorityBoost(curthread,0)!=0, - "error=%ld\n",GetLastError()); - rc=pGetThreadPriorityBoost(curthread,&disabled); - ok(rc!=0 && disabled==0, - "rc=%d error=%ld disabled=%d\n",rc,GetLastError(),disabled); - } - } - } -} - -/* check the GetThreadTimes function */ -VOID test_GetThreadTimes() -{ - HANDLE thread,access_thread=NULL; - FILETIME creationTime,exitTime,kernelTime,userTime; - DWORD threadId; - int error; - - thread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)threadFunc2,NULL, - CREATE_SUSPENDED,&threadId); - - ok(thread!=NULL,"Create Thread failed\n"); -/* check that access control is obeyed */ - if (pOpenThread) { - access_thread=pOpenThread(THREAD_ALL_ACCESS & - (~THREAD_QUERY_INFORMATION), 0,threadId); - ok(access_thread!=NULL, - "OpenThread returned an invalid handle\n"); - } - ok(ResumeThread(thread)==1,"Resume thread returned an invalid value\n"); - ok(WaitForSingleObject(thread,5000)==WAIT_OBJECT_0, - "ResumeThread didn't work\n"); - if(access_thread!=NULL) { - error=GetThreadTimes(access_thread,&creationTime,&exitTime, - &kernelTime,&userTime); - ok(error==0, "GetThreadTimes did not obey access restrictions\n"); - ok(CloseHandle(access_thread)!=0,"CloseHandle Failed\n"); - } - creationTime.dwLowDateTime=99; creationTime.dwHighDateTime=99; - exitTime.dwLowDateTime=99; exitTime.dwHighDateTime=99; - kernelTime.dwLowDateTime=99; kernelTime.dwHighDateTime=99; - userTime.dwLowDateTime=99; userTime.dwHighDateTime=99; -/* GetThreadTimes should set all of the parameters passed to it */ - error=GetThreadTimes(thread,&creationTime,&exitTime, - &kernelTime,&userTime); - if (error!=0 || GetLastError()!=ERROR_CALL_NOT_IMPLEMENTED) { - ok(error!=0,"GetThreadTimes failed\n"); - ok(creationTime.dwLowDateTime!=99 || creationTime.dwHighDateTime!=99, - "creationTime was invalid\n"); - ok(exitTime.dwLowDateTime!=99 || exitTime.dwHighDateTime!=99, - "exitTime was invalid\n"); - ok(kernelTime.dwLowDateTime!=99 || kernelTime.dwHighDateTime!=99, - "kernelTimewas invalid\n"); - ok(userTime.dwLowDateTime!=99 || userTime.dwHighDateTime!=99, - "userTime was invalid\n"); - ok(CloseHandle(thread)!=0,"CloseHandle failed\n"); - } -} - -/* Check the processor affinity functions */ -/* NOTE: These functions should also be checked that they obey access control -*/ -VOID test_thread_processor() -{ - HANDLE curthread,curproc; - DWORD processMask,systemMask; - SYSTEM_INFO sysInfo; - int error=0; - - sysInfo.dwNumberOfProcessors=0; - GetSystemInfo(&sysInfo); - ok(sysInfo.dwNumberOfProcessors>0, - "GetSystemInfo failed to return a valid # of processors\n"); -/* Use the current Thread/process for all tests */ - curthread=GetCurrentThread(); - ok(curthread!=NULL,"GetCurrentThread failed\n"); - curproc=GetCurrentProcess(); - ok(curproc!=NULL,"GetCurrentProcess failed\n"); -/* Check the Affinity Mask functions */ - ok(GetProcessAffinityMask(curproc,&processMask,&systemMask)!=0, - "GetProcessAffinityMask failed\n"); - ok(SetThreadAffinityMask(curthread,processMask)==1, - "SetThreadAffinityMask failed\n"); - ok(SetThreadAffinityMask(curthread,processMask+1)==0, - "SetThreadAffinityMask passed for an illegal processor\n"); -/* NOTE: This only works on WinNT/2000/XP) */ - if (pSetThreadIdealProcessor) { - todo_wine { - SetLastError(0); - error=pSetThreadIdealProcessor(curthread,0); - if (GetLastError()!=ERROR_CALL_NOT_IMPLEMENTED) { - ok(error!=-1, "SetThreadIdealProcessor failed\n"); - } - } - if (GetLastError()!=ERROR_CALL_NOT_IMPLEMENTED) { - error=pSetThreadIdealProcessor(curthread,MAXIMUM_PROCESSORS+1); - ok(error==-1, - "SetThreadIdealProcessor succeeded with an illegal processor #\n"); - todo_wine { - error=pSetThreadIdealProcessor(curthread,MAXIMUM_PROCESSORS); - ok(error==0, "SetThreadIdealProcessor returned an incorrect value\n"); - } - } - } -} - -START_TEST(thread) -{ - HINSTANCE lib; -/* Neither Cygwin nor mingW export OpenThread, so do a dynamic check - so that the compile passes -*/ - lib=LoadLibraryA("kernel32"); - ok(lib!=NULL,"Couldn't load kernel32.dll\n"); - pGetThreadPriorityBoost=(GetThreadPriorityBoost_t)GetProcAddress(lib,"GetThreadPriorityBoost"); - pOpenThread=(OpenThread_t)GetProcAddress(lib,"OpenThread"); - pSetThreadIdealProcessor=(SetThreadIdealProcessor_t)GetProcAddress(lib,"SetThreadIdealProcessor"); - pSetThreadPriorityBoost=(SetThreadPriorityBoost_t)GetProcAddress(lib,"SetThreadPriorityBoost"); - test_CreateThread_basic(); - test_CreateThread_suspended(); - test_SuspendThread(); - test_TerminateThread(); - test_CreateThread_stack(); - test_thread_priority(); - test_GetThreadTimes(); - test_thread_processor(); -} diff --git a/reactos/apps/tests/kernel32/time.c b/reactos/apps/tests/kernel32/time.c deleted file mode 100644 index 5592fafef48..00000000000 --- a/reactos/apps/tests/kernel32/time.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Unit test suite for time functions - * - * Copyright 2004 Uwe Bonnes - * - * 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 "wine/test.h" -#include "winbase.h" - -#define SECSPERMIN 60 -#define SECSPERDAY 86400 -/* 1601 to 1970 is 369 years plus 89 leap days */ -#define SECS_1601_TO_1970 ((369 * 365 + 89) * (ULONGLONG)SECSPERDAY) -#define TICKSPERSEC 10000000 -#define TICKSPERMSEC 10000 -#define TICKS_1601_TO_1970 (SECS_1601_TO_1970 * TICKSPERSEC) - - -void test_GetTimeZoneInformation() -{ - TIME_ZONE_INFORMATION tzinfo, tzinfo1; - DWORD res = GetTimeZoneInformation(&tzinfo); - ok(res != 0, "GetTimeZoneInformation failed\n"); - ok(SetEnvironmentVariableA("TZ","GMT0") != 0, - "SetEnvironmentVariableA failed\n"); - res = GetTimeZoneInformation(&tzinfo1); - ok(res != 0, "GetTimeZoneInformation failed\n"); - - ok(((tzinfo.Bias == tzinfo1.Bias) && - (tzinfo.StandardBias == tzinfo1.StandardBias) && - (tzinfo.DaylightBias == tzinfo1.DaylightBias)), - "Bias influenced by TZ variable\n"); - ok(SetEnvironmentVariableA("TZ",NULL) != 0, - "SetEnvironmentVariableA failed\n"); - -} - -void test_FileTimeToSystemTime() -{ - FILETIME ft; - SYSTEMTIME st; - ULONGLONG time = (ULONGLONG)TICKSPERSEC + TICKS_1601_TO_1970; - - ft.dwHighDateTime = 0; - ft.dwLowDateTime = 0; - ok(FileTimeToSystemTime(&ft, &st), - "FileTimeToSystemTime() failed with Error 0x%08lx\n",GetLastError()); - ok(((st.wYear == 1601) && (st.wMonth == 1) && (st.wDay == 1) && - (st.wHour == 0) && (st.wMinute == 0) && (st.wSecond == 0) && - (st.wMilliseconds == 0)), - "Got Year %4d Month %2d Day %2d\n", st.wYear, st.wMonth, st.wDay); - - ft.dwHighDateTime = (UINT)(time >> 32); - ft.dwLowDateTime = (UINT)time; - ok(FileTimeToSystemTime(&ft, &st), - "FileTimeToSystemTime() failed with Error 0x%08lx\n",GetLastError()); - ok(((st.wYear == 1970) && (st.wMonth == 1) && (st.wDay == 1) && - (st.wHour == 0) && (st.wMinute == 0) && (st.wSecond == 1) && - (st.wMilliseconds == 0)), - "Got Year %4d Month %2d Day %2d Hour %2d Min %2d Sec %2d mSec %3d\n", - st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, - st.wMilliseconds); -} - -void test_FileTimeToLocalFileTime() -{ - FILETIME ft, lft; - SYSTEMTIME st; - TIME_ZONE_INFORMATION tzinfo; - DWORD res = GetTimeZoneInformation(&tzinfo); - ULONGLONG time = (ULONGLONG)TICKSPERSEC + TICKS_1601_TO_1970 - + (ULONGLONG)tzinfo.Bias*SECSPERMIN *TICKSPERSEC; - - ok( res != 0, "GetTimeZoneInformation failed\n"); - ft.dwHighDateTime = (UINT)(time >> 32); - ft.dwLowDateTime = (UINT)time; - ok(FileTimeToLocalFileTime(&ft, &lft) !=0 , - "FileTimeToLocalFileTime() failed with Error 0x%08lx\n",GetLastError()); - FileTimeToSystemTime(&lft, &st); - ok(((st.wYear == 1970) && (st.wMonth == 1) && (st.wDay == 1) && - (st.wHour == 0) && (st.wMinute == 0) && (st.wSecond == 1) && - (st.wMilliseconds == 0)), - "Got Year %4d Month %2d Day %2d Hour %2d Min %2d Sec %2d mSec %3d\n", - st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, - st.wMilliseconds); - - ok(SetEnvironmentVariableA("TZ","GMT") != 0, - "SetEnvironmentVariableA failed\n"); - ok(res != 0, "GetTimeZoneInformation failed\n"); - ok(FileTimeToLocalFileTime(&ft, &lft) !=0 , - "FileTimeToLocalFileTime() failed with Error 0x%08lx\n",GetLastError()); - FileTimeToSystemTime(&lft, &st); - ok(((st.wYear == 1970) && (st.wMonth == 1) && (st.wDay == 1) && - (st.wHour == 0) && (st.wMinute == 0) && (st.wSecond == 1) && - (st.wMilliseconds == 0)), - "Got Year %4d Month %2d Day %2d Hour %2d Min %2d Sec %2d mSec %3d\n", - st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, - st.wMilliseconds); - ok(SetEnvironmentVariableA("TZ",NULL) != 0, - "SetEnvironmentVariableA failed\n"); -} - -START_TEST(time) -{ - test_GetTimeZoneInformation(); - test_FileTimeToSystemTime(); - test_FileTimeToLocalFileTime(); - -} diff --git a/reactos/apps/tests/kernel32/virtual.c b/reactos/apps/tests/kernel32/virtual.c deleted file mode 100644 index b4b40683deb..00000000000 --- a/reactos/apps/tests/kernel32/virtual.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Unit test suite for Virtual* family of APIs. - * - * 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 "windef.h" -#include "winbase.h" -#include "winerror.h" -#include "wine/test.h" - -static void test_VirtualAlloc(void) -{ - void *addr1, *addr2; - DWORD old_prot; - MEMORY_BASIC_INFORMATION info; - - SetLastError(0xdeadbeef); - addr1 = VirtualAlloc(0, 0, MEM_RESERVE, PAGE_NOACCESS); - ok(addr1 == NULL, "VirtualAlloc should fail on zero-sized allocation\n"); - ok(GetLastError() == ERROR_INVALID_PARAMETER /* NT */ || - GetLastError() == ERROR_NOT_ENOUGH_MEMORY, /* Win9x */ - "got %ld, expected ERROR_INVALID_PARAMETER\n", GetLastError()); - - addr1 = VirtualAlloc(0, 0xFFFC, MEM_RESERVE, PAGE_NOACCESS); - ok(addr1 != NULL, "VirtualAlloc failed\n"); - - /* test a not committed memory */ - ok(VirtualQuery(addr1, &info, sizeof(info)) == sizeof(info), - "VirtualQuery failed\n"); - ok(info.BaseAddress == addr1, "%p != %p\n", info.BaseAddress, addr1); - ok(info.AllocationBase == addr1, "%p != %p\n", info.AllocationBase, addr1); - ok(info.AllocationProtect == PAGE_NOACCESS, "%lx != PAGE_NOACCESS\n", info.AllocationProtect); - ok(info.RegionSize == 0x10000, "%lx != 0x10000\n", info.RegionSize); - ok(info.State == MEM_RESERVE, "%lx != MEM_RESERVE\n", info.State); - /* NT reports Protect == 0 for a not committed memory block */ - ok(info.Protect == 0 /* NT */ || - info.Protect == PAGE_NOACCESS, /* Win9x */ - "%lx != PAGE_NOACCESS\n", info.Protect); - ok(info.Type == MEM_PRIVATE, "%lx != MEM_PRIVATE\n", info.Type); - - SetLastError(0xdeadbeef); - ok(!VirtualProtect(addr1, 0xFFFC, PAGE_READONLY, &old_prot), - "VirtualProtect should fail on a not committed memory\n"); - ok(GetLastError() == ERROR_INVALID_ADDRESS /* NT */ || - GetLastError() == ERROR_INVALID_PARAMETER, /* Win9x */ - "got %ld, expected ERROR_INVALID_ADDRESS\n", GetLastError()); - - addr2 = VirtualAlloc(addr1, 0x1000, MEM_COMMIT, PAGE_NOACCESS); - ok(addr1 == addr2, "VirtualAlloc failed\n"); - - /* test a committed memory */ - ok(VirtualQuery(addr1, &info, sizeof(info)) == sizeof(info), - "VirtualQuery failed\n"); - ok(info.BaseAddress == addr1, "%p != %p\n", info.BaseAddress, addr1); - ok(info.AllocationBase == addr1, "%p != %p\n", info.AllocationBase, addr1); - ok(info.AllocationProtect == PAGE_NOACCESS, "%lx != PAGE_NOACCESS\n", info.AllocationProtect); - ok(info.RegionSize == 0x1000, "%lx != 0x1000\n", info.RegionSize); - ok(info.State == MEM_COMMIT, "%lx != MEM_COMMIT\n", info.State); - /* this time NT reports PAGE_NOACCESS as well */ - ok(info.Protect == PAGE_NOACCESS, "%lx != PAGE_NOACCESS\n", info.Protect); - ok(info.Type == MEM_PRIVATE, "%lx != MEM_PRIVATE\n", info.Type); - - /* this should fail, since not the whole range is committed yet */ - SetLastError(0xdeadbeef); - ok(!VirtualProtect(addr1, 0xFFFC, PAGE_READONLY, &old_prot), - "VirtualProtect should fail on a not committed memory\n"); - ok(GetLastError() == ERROR_INVALID_ADDRESS /* NT */ || - GetLastError() == ERROR_INVALID_PARAMETER, /* Win9x */ - "got %ld, expected ERROR_INVALID_ADDRESS\n", GetLastError()); - - ok(VirtualProtect(addr1, 0x1000, PAGE_READONLY, &old_prot), "VirtualProtect failed\n"); - ok(old_prot == PAGE_NOACCESS, - "wrong old protection: got %04lx instead of PAGE_NOACCESS\n", old_prot); - - ok(VirtualProtect(addr1, 0x1000, PAGE_READWRITE, &old_prot), "VirtualProtect failed\n"); - ok(old_prot == PAGE_READONLY, - "wrong old protection: got %04lx instead of PAGE_READONLY\n", old_prot); - - ok(!VirtualFree(addr1, 0x10000, 0), "VirtualFree should fail with type 0\n"); - ok(GetLastError() == ERROR_INVALID_PARAMETER, - "got %ld, expected ERROR_INVALID_PARAMETER\n", GetLastError()); - - ok(VirtualFree(addr1, 0x10000, MEM_DECOMMIT), "VirtualFree failed\n"); - - /* if the type is MEM_RELEASE, size must be 0 */ - ok(!VirtualFree(addr1, 1, MEM_RELEASE), "VirtualFree should fail\n"); - ok(GetLastError() == ERROR_INVALID_PARAMETER, - "got %ld, expected ERROR_INVALID_PARAMETER\n", GetLastError()); - - ok(VirtualFree(addr1, 0, MEM_RELEASE), "VirtualFree failed\n"); -} - -START_TEST(virtual) -{ - test_VirtualAlloc(); -} diff --git a/reactos/apps/tests/lan/lantest.cpp b/reactos/apps/tests/lan/lantest.cpp deleted file mode 100644 index 5a02cc3e9ae..00000000000 --- a/reactos/apps/tests/lan/lantest.cpp +++ /dev/null @@ -1,218 +0,0 @@ -#include -#include -#include -#include -#include -#include - -using std::string; -using std::cin; -using std::cout; -using std::cerr; -using std::endl; - -void display_row( char *data, int off, int len ) { - int i; - - printf( "%08x:", off ); - for( i = off; i < len && i < off + 16; i++ ) { - printf( " %02x", data[i] & 0xff ); - } - - for( ; i < off + 16; i++ ) - printf(" "); - - printf( " -- " ); - - for( i = off; i < len && i < off + 16; i++ ) { - printf( "%c", (data[i] >= ' ' && data[i] <= '~') ? data[i] : '.' ); - } - - printf( "\n" ); -} - -void display_buffer( char *Packet, int ReadLen ) { - UINT PktLen; - for( PktLen = 0; PktLen < ReadLen; PktLen += 16 ) - display_row( Packet, PktLen, ReadLen ); -} - -int byte_till_end( char *Packet, int PktLen ) { - int byte; - std::string word; - - cin >> word; - while( word != "end" ) { - byte = strtoul( (string("0x") + word).c_str(), 0, 0 ); - fprintf( stderr, "Byte[%d]: %x\n", PktLen, byte & 0xff ); - Packet[PktLen++] = byte; - cin >> word; - } - - return PktLen; -} - -/* Ethernet types. We swap constants so we can compare values at runtime - without swapping them there */ -#define ETYPE_IPv4 WH2N(0x0800) -#define ETYPE_IPv6 WH2N(0x86DD) -#define ETYPE_ARP WH2N(0x0806) - -extern "C" -NTSTATUS STDCALL NtCreateFile( - PHANDLE FileHandle, - ACCESS_MASK DesiredAccess, - POBJECT_ATTRIBUTES ObjectAttributes, - PIO_STATUS_BLOCK IoStatusBlock, - PLARGE_INTEGER AllocationSize, - ULONG FileAttributes, - ULONG ShareAccess, - ULONG CreateDisposition, - ULONG CreateOptions, - PVOID EaBuffer, - ULONG EaLength); - -int main( int argc, char **argv ) { - string word; - HANDLE LanFile; - OBJECT_ATTRIBUTES Attributes; - UNICODE_STRING LanDevice; - IO_STATUS_BLOCK Iosb; - HANDLE Event; - PFILE_FULL_EA_INFORMATION EaBuffer; - NTSTATUS Status; - DWORD On = 1, PktLen; - CHAR Packet[1600]; - PLAN_PACKET_HEADER Hdr = (PLAN_PACKET_HEADER)Packet; - PLAN_ADDRESS Addr = (PLAN_ADDRESS)Packet; - USHORT TypesToListen[] = { ETYPE_IPv4, ETYPE_IPv6, ETYPE_ARP }; - UINT EaLength = LAN_EA_INFO_SIZE(sizeof(TypesToListen)/sizeof(USHORT)); - - Status = NtCreateEvent(&Event, - EVENT_ALL_ACCESS, - NULL, - 0, - 0 ); - - RtlInitUnicodeString( &LanDevice, L"\\Device\\Lan" ); - - InitializeObjectAttributes( &Attributes, - &LanDevice, - OBJ_CASE_INSENSITIVE, - NULL, - NULL ); - - EaBuffer = (PFILE_FULL_EA_INFORMATION)calloc( EaLength, 1 ); - LAN_FILL_EA_INFO(EaBuffer,sizeof(TypesToListen)/sizeof(USHORT), - TypesToListen); - - Status = ZwCreateFile( &LanFile, - SYNCHRONIZE | GENERIC_READ | GENERIC_WRITE | - GENERIC_EXECUTE, - &Attributes, - &Iosb, - NULL, - FILE_ATTRIBUTE_NORMAL, - FILE_SHARE_READ | FILE_SHARE_WRITE, - FILE_OPEN_IF, - FILE_SYNCHRONOUS_IO_NONALERT, - EaBuffer, - EaLength ); - - if( !NT_SUCCESS(Status) ) { - cerr << "Could not open lan device " << Status << "\n"; - return 1; - } - - Status = DeviceIoControl( LanFile, - IOCTL_IF_BUFFERED_MODE, - &On, - sizeof(On), - 0, - 0, - &PktLen, - NULL ); - - if( !Status ) { - cerr << "Could not turn on buffered mode " << Status << "\n"; - return 1; - } - - while( cin >> word ) { - if( word == "end" ) { - NtClose( LanFile ); - return 0; - } else if( word == "enum" ) { - Status = DeviceIoControl( LanFile, - IOCTL_IF_ENUM_ADAPTERS, - NULL, - 0, - Packet, - sizeof(Packet), - &PktLen, - NULL ); - - cout << "EnumAdapters: " << Status << "\n"; - if( Status ) - display_buffer( Packet, PktLen ); - } else if( word == "query" ) { - cin >> PktLen; - - Status = DeviceIoControl( LanFile, - IOCTL_IF_ADAPTER_INFO, - &PktLen, - sizeof(PktLen), - Packet, - sizeof(Packet), - &PktLen, - NULL ); - - cout << "QueryAdapterInfo: " << Status << "\n"; - if( Status ) - display_buffer( Packet, PktLen ); - } else if( word == "send" ) { - cin >> Hdr->Fixed.Adapter - >> Hdr->Fixed.AddressType - >> Hdr->Fixed.AddressLen - >> Hdr->Fixed.PacketType; - Hdr->Fixed.Mdl = NULL; - PktLen = byte_till_end( Packet, Hdr->Address - (PCHAR)Hdr ); - Status = NtWriteFile( LanFile, - NULL, - NULL, - NULL, - &Iosb, - Packet, - PktLen, - NULL, - NULL ); - - cout << "NtWriteFile: " << Status << "\n"; - } else if( word == "recv" ) { - ULONG ReadLen; - Status = NtReadFile( LanFile, - Event, - NULL, - NULL, - &Iosb, - Packet, - sizeof(Packet), - NULL, - NULL ); - cout << "NtReadFile: " << Status << "\n"; - if( Status == STATUS_PENDING ) { - LARGE_INTEGER Timeout = { 0 }; - Status = NtWaitForSingleObject( Event, 1, &Timeout ); - } - - ReadLen = Iosb.Information; - - if( Status == STATUS_SUCCESS ) { - cout << "Read " << ReadLen << " bytes\n"; - display_buffer( Packet, ReadLen ); - } - } - } - - return 0; -} diff --git a/reactos/apps/tests/lan/makefile b/reactos/apps/tests/lan/makefile deleted file mode 100644 index f8d57337c65..00000000000 --- a/reactos/apps/tests/lan/makefile +++ /dev/null @@ -1,24 +0,0 @@ -# -# $Id: makefile,v 1.1 2004/09/17 16:07:41 arty Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = lantest - -TARGET_SDKLIBS = ws2_32.a ntdll.a - -TARGET_OBJECTS = lantest.o -lstdc++ - -TARGET_CPPFLAGS = -I$(PATH_TO_TOP)/include -g - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/shm/.cvsignore b/reactos/apps/tests/shm/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/shm/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/shm/makefile b/reactos/apps/tests/shm/makefile deleted file mode 100644 index 296a486cd27..00000000000 --- a/reactos/apps/tests/shm/makefile +++ /dev/null @@ -1,54 +0,0 @@ -# -# -# -PATH_TO_TOP = ../../.. - -include $(PATH_TO_TOP)/config -include $(PATH_TO_TOP)/rules.mak - -SRV_OBJECTS= shmsrv.o -CLT_OBJECTS= shmclt.o - -PROGS= shmsrv.exe shmclt.exe - -CFLAGS = $(STD_CFLAGS) - -LIBS = $(SDK_PATH_LIB)/kernel32.a \ - $(SDK_PATH_LIB)/ntdll.a - -all: $(PROGS) - -.phony: all - -implib: - -clean: - - $(RM) *.o *.exe *.sym - -.phony: implib clean - -ifneq ($(BOOTCD_INSTALL),) - -install: $(PROGS:%=$(INSTALL_DIR)/%) - -$(PROGS:%=$(INSTALL_DIR)/%): $(INSTALL_DIR)/%: % - $(CP) $* $(INSTALL_DIR)/$* - -else # BOOTCD_INSTALL - -install: $(PROGS:%=$(INSTALL_DIR)/bin/%) - -$(PROGS:%=$(INSTALL_DIR)/bin/%): $(INSTALL_DIR)/bin/%: % - $(CP) $* $(INSTALL_DIR)/bin/$* - -endif # BOOTCD_INSTALL - -shmsrv.exe: $(SRV_OBJECTS) $(LIBS) - $(CC) $(SRV_OBJECTS) $(LIBS) -o shmsrv.exe - $(NM) --numeric-sort shmsrv.exe > shmsrv.sym - -shmclt.exe: $(CLT_OBJECTS) $(LIBS) - $(CC) $(CLT_OBJECTS) $(LIBS) -o shmclt.exe - $(NM) --numeric-sort shmsrv.exe > shmclt.sym - -# EOF diff --git a/reactos/apps/tests/shm/shmclt.c b/reactos/apps/tests/shm/shmclt.c deleted file mode 100644 index 4b1f5da3997..00000000000 --- a/reactos/apps/tests/shm/shmclt.c +++ /dev/null @@ -1,61 +0,0 @@ -#include -#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[]) -{ - HANDLE Section; - PVOID BaseAddress; - char buffer[256]; - - printf("Shm test server\n"); - - Section = OpenFileMappingW ( -// PAGE_EXECUTE_READWRITE, invalid parameter - FILE_MAP_WRITE, - FALSE, - L"TestSection" - ); - if (Section == NULL) - { - printf("Failed to open section (err=%d)", GetLastError()); - return 1; - } - - BaseAddress = MapViewOfFile(Section, - FILE_MAP_ALL_ACCESS, - 0, - 0, - 8192); - if (BaseAddress == NULL) - { - printf("Failed to map section (err=%d)\n", GetLastError()); - return 1; - } - printf("BaseAddress %x\n", (UINT) BaseAddress); - printf("Copying from section\n"); - strcpy(buffer, BaseAddress); - printf("Copyed <%s>\n", buffer); - -// for(;;); - return 0; -} - diff --git a/reactos/apps/tests/shm/shmsrv.c b/reactos/apps/tests/shm/shmsrv.c deleted file mode 100644 index 4877e96c77b..00000000000 --- a/reactos/apps/tests/shm/shmsrv.c +++ /dev/null @@ -1,53 +0,0 @@ -/* $Id: shmsrv.c,v 1.5 2000/06/29 23:35:10 dwelch Exp $ - * - * FILE : reactos/apps/shm/shmsrv.c - * AUTHOR: David Welch - */ -#include -#include -#include -#include -#include - -int main(int argc, char* argv[]) -{ - HANDLE Section; - PVOID BaseAddress; - - printf("Shm test server\n"); - - Section = CreateFileMappingW ( - (HANDLE) 0xFFFFFFFF, - NULL, - PAGE_READWRITE, - 0, - 8192, - L"TestSection" - ); - if (Section == NULL) - { - printf("Failed to create section (err=%d)", GetLastError()); - return 1; - } - - printf("Mapping view of section\n"); - BaseAddress = MapViewOfFile(Section, - FILE_MAP_ALL_ACCESS, - 0, - 0, - 8192); - printf("BaseAddress %x\n", (UINT) BaseAddress); - if (BaseAddress == NULL) - { - printf("Failed to map section\n"); - } - - printf("Copying to section\n"); - printf("Copying %s\n", GetCommandLineA()); - strcpy(BaseAddress, GetCommandLineA()); - - Sleep(INFINITE); - - return 0; -} - diff --git a/reactos/apps/tests/statst/.cvsignore b/reactos/apps/tests/statst/.cvsignore deleted file mode 100644 index 1f070024388..00000000000 --- a/reactos/apps/tests/statst/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map - diff --git a/reactos/apps/tests/statst/Makefile b/reactos/apps/tests/statst/Makefile deleted file mode 100644 index 36383795569..00000000000 --- a/reactos/apps/tests/statst/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = statst - -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/statst/statst.c b/reactos/apps/tests/statst/statst.c deleted file mode 100644 index 080b77baddb..00000000000 --- a/reactos/apps/tests/statst/statst.c +++ /dev/null @@ -1,165 +0,0 @@ -//#define WIN32_LEAN_AND_MEAN -#include - -static LPSTR STATIC_CLASS = "STATIC"; -static LPSTR TEST_WND_CLASS = "TESTWND"; - -#ifdef NDEBUG - #define DPRINT(s) (void)0 -#else - #define DPRINT(s) OutputDebugStringA("STATICTEST: " s "\n") -#endif - -HINSTANCE AppInstance = NULL; - -LRESULT WmCreate( - HWND Wnd) -{ - UCHAR i; - DPRINT("WM_CREATE (enter)."); - // Test 1 - black rectangle. - DPRINT("test 1"); - CreateWindowEx(0, STATIC_CLASS, NULL, WS_CHILD | WS_VISIBLE | SS_BLACKRECT, - 10, 10, 100, 20, Wnd, NULL, AppInstance, NULL); - // Test 2 - black frame. - DPRINT("test 2"); - CreateWindowEx(0, STATIC_CLASS, NULL, WS_CHILD | WS_VISIBLE | SS_BLACKFRAME, - 10, 40, 100, 20, Wnd, NULL, AppInstance, NULL); - // Test 3 - gray rectangle. - DPRINT("test 3"); - CreateWindowEx(0, STATIC_CLASS, NULL, WS_CHILD | WS_VISIBLE | SS_GRAYRECT, - 10, 70, 100, 20, Wnd, NULL, AppInstance, NULL); - // Test 4 - gray frame. - DPRINT("test 4"); - CreateWindowEx(0, STATIC_CLASS, NULL, WS_CHILD | WS_VISIBLE | SS_GRAYFRAME, - 10, 100, 100, 20, Wnd, NULL, AppInstance, NULL); - // Test 5 - left-aligned text. - DPRINT("test 5"); - CreateWindowEx(0, STATIC_CLASS, - "&Left-aligned text &static control window", - WS_CHILD | WS_VISIBLE | SS_LEFT, - 10, 130, 100, 50, Wnd, NULL, AppInstance, NULL); - // Test 6 - right-aligned text. - DPRINT("test 6"); - CreateWindowEx(0, STATIC_CLASS, - "&Right-aligned text &static control window", - WS_CHILD | WS_VISIBLE | SS_RIGHT, - 10, 185, 100, 50, Wnd, NULL, AppInstance, NULL); - // Test 7 - centered text. - DPRINT("test 7"); - CreateWindowEx(0, STATIC_CLASS, - "&Centered text &static control window", - WS_CHILD | WS_VISIBLE | SS_CENTER, - 10, 240, 100, 50, Wnd, NULL, AppInstance, NULL); - // Test 8 - left-aligned text with no word wrap and no prefixes. - DPRINT("test 8"); - CreateWindowEx(0, STATIC_CLASS, - "&No prefix and no word wrapping", - WS_CHILD | WS_VISIBLE | SS_LEFTNOWORDWRAP | SS_NOPREFIX, - 10, 295, 100, 20, Wnd, NULL, AppInstance, NULL); - // Test 9 - white rectangle. - DPRINT("test 9"); - CreateWindowEx(0, STATIC_CLASS, NULL, WS_CHILD | WS_VISIBLE | SS_WHITERECT, - 120, 10, 100, 20, Wnd, NULL, AppInstance, NULL); - // Test 10 - white frame. - DPRINT("test 10"); - CreateWindowEx(0, STATIC_CLASS, NULL, WS_CHILD | WS_VISIBLE | SS_WHITEFRAME, - 120, 40, 100, 20, Wnd, NULL, AppInstance, NULL); - // Test 11 - etched frame. - DPRINT("test 11"); - CreateWindowEx(0, STATIC_CLASS, NULL, WS_CHILD | WS_VISIBLE - | SS_ETCHEDFRAME, 120, 70, 100, 20, Wnd, NULL, AppInstance, NULL); - // Test 12 - etched horizontal lines. - DPRINT("test 12"); - for (i = 0; i < 5; ++i) - CreateWindowEx(0, STATIC_CLASS, NULL, WS_CHILD | WS_VISIBLE - | SS_ETCHEDHORZ, 120, 100 + (4L * i), 100, 4, Wnd, - NULL, AppInstance, NULL); - // Test 13 - etched vertical lines. - DPRINT("test 13"); - for (i = 0; i < 25; ++i) - CreateWindowEx(0, STATIC_CLASS, NULL, WS_CHILD | WS_VISIBLE - | SS_ETCHEDVERT, 120 + (4L * i), 130, 4, 20, Wnd, - NULL, AppInstance, NULL); - // Test 14 - sunken border. - DPRINT("test 14"); - CreateWindowEx(0, STATIC_CLASS, - "Sunken frame and word ellipsis", - WS_CHILD | WS_VISIBLE | SS_SUNKEN | SS_WORDELLIPSIS, - 120, 160, 100, 20, 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.", - "Static 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, "Static control test", - WS_OVERLAPPEDWINDOW, 50, 50, 245, 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/stretchblt/.cvsignore b/reactos/apps/tests/stretchblt/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/stretchblt/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/stretchblt/lena.bmp b/reactos/apps/tests/stretchblt/lena.bmp deleted file mode 100644 index e9916963852a9748baf1b9ac6093fb3b9179dbbc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 89322 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 diff --git a/reactos/apps/tests/stretchblt/makefile b/reactos/apps/tests/stretchblt/makefile deleted file mode 100644 index 2aef3b5e626..00000000000 --- a/reactos/apps/tests/stretchblt/makefile +++ /dev/null @@ -1,31 +0,0 @@ - -PATH_TO_TOP = ../../.. - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = stretchblt - -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 = \ -stretchblt.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/stretchblt/stretchblt.cpp b/reactos/apps/tests/stretchblt/stretchblt.cpp deleted file mode 100644 index dec7dd56a71..00000000000 --- a/reactos/apps/tests/stretchblt/stretchblt.cpp +++ /dev/null @@ -1,380 +0,0 @@ - -// ------------------------------------------------------------------ -// Windows 2000 Graphics API Black Book -// Chapter 1 - Listing 1.5 (StretchBlt Zooming 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. -// ------------------------------------------------------------------ - -// Modified by Aleksey Bragin (aleksey at studiocerebral.com) -// to support non-uniform scaling, and output via sretchdibits -// (type something in the command line to invoke this mode, -// in future it will be source BPP) - -//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -#include -#include -//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - - -HWND HListBox = NULL; -HWND VListBox = NULL; -const int ID_LISTBOX = 101; -const int ID_LISTBOX2 = 102; -BOOL useDIBits=FALSE; // How to display the image - via StretchDIBits - -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("StretchBlt NonUniform Zooming Demo"), - WS_OVERLAPPEDWINDOW | WS_CAPTION | - WS_VISIBLE | WS_CLIPSIBLINGS, - 0, 0, 675, 560, - NULL, NULL, HInst, NULL); - - if (HWnd) - { - HListBox = - CreateWindowEx(WS_EX_CLIENTEDGE, "LISTBOX", "", - LBS_NOTIFY | WS_CHILD | WS_VISIBLE, - 530, 5, 130, 150, HWnd, - reinterpret_cast(ID_LISTBOX), - HInst, NULL); - VListBox = - CreateWindowEx(WS_EX_CLIENTEDGE, "LISTBOX", "", - LBS_NOTIFY | WS_CHILD | WS_VISIBLE, - 530, 5+170, 130, 150, HWnd, - reinterpret_cast(ID_LISTBOX2), - HInst, NULL); - - if (HListBox && VListBox) - { -// horizontal zoom - SNDMSG(HListBox, LB_ADDSTRING, 0, - reinterpret_cast("Zoom 25%")); - SNDMSG(HListBox, LB_ADDSTRING, 0, - reinterpret_cast("Zoom 50%")); - SNDMSG(HListBox, LB_ADDSTRING, 0, - reinterpret_cast("Zoom 75%")); - SNDMSG(HListBox, LB_ADDSTRING, 0, - reinterpret_cast("Zoom 100%")); - SNDMSG(HListBox, LB_ADDSTRING, 0, - reinterpret_cast("Zoom 125%")); - SNDMSG(HListBox, LB_ADDSTRING, 0, - reinterpret_cast("Zoom 150%")); - SNDMSG(HListBox, LB_ADDSTRING, 0, - reinterpret_cast("Zoom 200%")); - SNDMSG(HListBox, LB_ADDSTRING, 0, - reinterpret_cast("Zoom 300%")); -// vertical zoom - SNDMSG(VListBox, LB_ADDSTRING, 0, - reinterpret_cast("Zoom 25%")); - SNDMSG(VListBox, LB_ADDSTRING, 0, - reinterpret_cast("Zoom 50%")); - SNDMSG(VListBox, LB_ADDSTRING, 0, - reinterpret_cast("Zoom 75%")); - SNDMSG(VListBox, LB_ADDSTRING, 0, - reinterpret_cast("Zoom 100%")); - SNDMSG(VListBox, LB_ADDSTRING, 0, - reinterpret_cast("Zoom 125%")); - SNDMSG(VListBox, LB_ADDSTRING, 0, - reinterpret_cast("Zoom 150%")); - SNDMSG(VListBox, LB_ADDSTRING, 0, - reinterpret_cast("Zoom 200%")); - SNDMSG(VListBox, LB_ADDSTRING, 0, - reinterpret_cast("Zoom 300%")); - - } - - ShowWindow(HWnd, nCmdShow); - UpdateWindow(HWnd); - - MSG msg; - while (GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } - } - return 0; -} -//------------------------------------------------------------------ - - -// image related -BITMAP bmp; -BITMAPINFO bmInfo; -char *bbits = NULL; // bitmap bits -const char* filename = "LENA.BMP"; -HDC HMemDC = NULL; -HBITMAP HOldBmp = NULL; - -// zooming related -float zoom_factor_h = 0.5; -float zoom_factor_v = 0.5; -RECT RDest = {5, 5, 0, 0}; -enum {ID_ZOOM25, ID_ZOOM50, ID_ZOOM75, ID_ZOOM100, - ID_ZOOM125, ID_ZOOM150, ID_ZOOM200, ID_ZOOM300}; - -LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam, - LPARAM LParam) -{ - switch (Msg) - { - case WM_CREATE: - { - // check commandline - if (strlen(cmdline) != 0) - { - - useDIBits = TRUE; - } - else - useDIBits = FALSE; - - // 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); - - // fill the BITMAPINFO stucture for further use by StretchDIBits - bmInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bmInfo.bmiHeader.biWidth = bmp.bmWidth; - bmInfo.bmiHeader.biHeight = bmp.bmHeight; - bmInfo.bmiHeader.biPlanes = 1;//bmp.bmPlanes; - bmInfo.bmiHeader.biBitCount = bmp.bmBitsPixel; - bmInfo.bmiHeader.biCompression = BI_RGB; - bmInfo.bmiHeader.biSizeImage = 0; - bmInfo.bmiHeader.biXPelsPerMeter = 0; - bmInfo.bmiHeader.biClrImportant = 0; - bmInfo.bmiHeader.biClrUsed = 0; - - // associate the bitmap with the memory DC - HOldBmp = static_cast( - SelectObject(HMemDC, HBmp) - ); - - if (useDIBits) - { - bbits = new char[bmp.bmHeight*bmp.bmWidthBytes*(bmp.bmBitsPixel / 8)]; - //GetDIBits(HMemDC, HBmp, 0, bmp.bmHeight, bbits, &bmInfo, DIB_RGB_COLORS); - - // Here goes a temp hack, since GetDIBits doesn't exist in ReactOS yet - FILE *f = fopen(filename, "rb"); - BITMAPFILEHEADER bmpHeader; - - fread(&bmpHeader, sizeof(BITMAPFILEHEADER), 1, f); - fread(&bmInfo, sizeof(BITMAPINFO), 1, f); - fseek(f, bmpHeader.bfOffBits, SEEK_SET); - fread(bbits, bmp.bmHeight*bmp.bmWidthBytes*(bmp.bmBitsPixel / 8), 1, f); - - fclose(f); - } - } - } - } - case WM_COMMAND: - { - if (WParam == MAKEWPARAM(ID_LISTBOX, LBN_SELCHANGE) || - WParam == MAKEWPARAM(ID_LISTBOX2, LBN_SELCHANGE)) - { - switch (SNDMSG(HListBox, LB_GETCURSEL, 0, 0)) - { - case ID_ZOOM25: zoom_factor_h = 0.25; break; - case ID_ZOOM50: zoom_factor_h = 0.50; break; - case ID_ZOOM75: zoom_factor_h = 0.75; break; - case ID_ZOOM100: zoom_factor_h = 1.00; break; - case ID_ZOOM125: zoom_factor_h = 1.25; break; - case ID_ZOOM150: zoom_factor_h = 1.50; break; - case ID_ZOOM200: zoom_factor_h = 2.00; break; - case ID_ZOOM300: zoom_factor_h = 3.00; break; - } - - switch (SNDMSG(VListBox, LB_GETCURSEL, 0, 0)) - { - case ID_ZOOM25: zoom_factor_v = 0.25; break; - case ID_ZOOM50: zoom_factor_v = 0.50; break; - case ID_ZOOM75: zoom_factor_v = 0.75; break; - case ID_ZOOM100: zoom_factor_v = 1.00; break; - case ID_ZOOM125: zoom_factor_v = 1.25; break; - case ID_ZOOM150: zoom_factor_v = 1.50; break; - case ID_ZOOM200: zoom_factor_v = 2.00; break; - case ID_ZOOM300: zoom_factor_v = 3.00; break; - } - - // calculate the new width and height - const int new_width = - static_cast(zoom_factor_h * bmp.bmWidth); - const int new_height = - static_cast(zoom_factor_v * bmp.bmHeight); - - // is zooming in? - bool zoom_in = (new_width > RDest.right - RDest.left); - - // caculate the area that needs to be updated - RECT RUpdate = { - RDest.left, RDest.top, - RDest.left + max(new_width, RDest.right - RDest.left), - RDest.top + max(new_height, RDest.bottom - RDest.top) - }; - - // adjust the dimenstions of the - // destination rectangle - RDest.right = RDest.left + new_width; - RDest.bottom = RDest.top + new_height; - - // create an update region from the XOR combination - // of the update and destination rectangles - HRGN HUpdateRgn = CreateRectRgnIndirect(&RUpdate); - HRGN HDestRgn = CreateRectRgnIndirect(&RDest); - int result = - CombineRgn(HUpdateRgn, HUpdateRgn, HDestRgn, RGN_XOR); - - // incite a repaint - if (result != NULLREGION && result != ERROR) - { - InvalidateRgn(HWnd, HUpdateRgn, true); - RedrawWindow(HWnd, &RDest, NULL, RDW_NOERASE | RDW_INVALIDATE); - } - else if (result == NULLREGION) - { - InvalidateRect(HWnd, &RUpdate, zoom_in ? false : true); - } - - // clean up - DeleteObject(HUpdateRgn); - DeleteObject(HDestRgn); - } - break; - } - case WM_PAINT: - { - PAINTSTRUCT ps; - const HDC Hdc = BeginPaint(HWnd, &ps); -#if 0 - try -#endif - { - // - // TODO: add palette support (see Chapter 9)... - // - if (useDIBits) - { - if (RDest.right - RDest.left > 0) - { - if (zoom_factor_h < 1.0 || zoom_factor_v < 1.0) - { - SetStretchBltMode(Hdc, COLORONCOLOR); - } - - // render the zoomed image - StretchDIBits(Hdc, RDest.left, RDest.top, - RDest.right - RDest.left, - RDest.bottom - RDest.top, - 0, 0, - bmp.bmWidth, bmp.bmHeight, - bbits, &bmInfo, - DIB_RGB_COLORS, - SRCCOPY); - } - } - else - { - if (RDest.right - RDest.left > 0) - { - - // use BitBlt when not zooming - if (zoom_factor_h == 1.0 && zoom_factor_v == 1.0) - { - BitBlt(Hdc, RDest.left, RDest.top, - RDest.right - RDest.left, - RDest.bottom - RDest.top, - HMemDC, 0, 0, - SRCCOPY); - } - else - { - if (zoom_factor_h < 1.0 || zoom_factor_v < 1.0) - { - SetStretchBltMode(Hdc, COLORONCOLOR); - } - - // render the zoomed image - StretchBlt(Hdc, RDest.left, RDest.top, - RDest.right - RDest.left, - RDest.bottom - RDest.top, - HMemDC, 0, 0, - bmp.bmWidth, bmp.bmHeight, - SRCCOPY); - } - } - } - } -#if 0 - catch (...) -#endif - { - EndPaint(HWnd, &ps); - } - EndPaint(HWnd, &ps); - break; - } - case WM_DESTROY: - { - // clean up - DeleteObject(SelectObject(HMemDC, HOldBmp)); - DeleteDC(HMemDC); - - if (bbits) - delete bbits; - - PostQuitMessage(0); - return 0; - } - } - return DefWindowProc(HWnd, Msg, WParam, LParam); -} -//------------------------------------------------------------------ - - - diff --git a/reactos/apps/tests/subclass/.cvsignore b/reactos/apps/tests/subclass/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/subclass/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/subclass/makefile b/reactos/apps/tests/subclass/makefile deleted file mode 100644 index 00b18340a06..00000000000 --- a/reactos/apps/tests/subclass/makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $Id: makefile,v 1.2 2003/11/14 17:13:20 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = subclass - -TARGET_SDKLIBS = kernel32.a gdi32.a - -TARGET_OBJECTS = $(TARGET_NAME).o - -TARGET_CFLAGS += -D_DISABLE_TIDENTS -Werror -Wall - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/subclass/subclass.c b/reactos/apps/tests/subclass/subclass.c deleted file mode 100644 index 9340e74844c..00000000000 --- a/reactos/apps/tests/subclass/subclass.c +++ /dev/null @@ -1,173 +0,0 @@ -#include -#include - -LRESULT WINAPI UnicodeWndProc(HWND, UINT, WPARAM, LPARAM); -LRESULT WINAPI UnicodeSubclassProc(HWND, UINT, WPARAM, LPARAM); -LRESULT WINAPI AnsiSubclassProc(HWND, UINT, WPARAM, LPARAM); - -static WNDPROC SavedWndProcW; -static WNDPROC SavedWndProcA; - -int WINAPI -WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpszCmdLine, - int nCmdShow) -{ - WNDCLASSW wc; - MSG msg; - HWND hWnd; - WCHAR WindowTextW[256]; - char WindowTextA[256]; - - wc.lpszClassName = L"UnicodeClass"; - wc.lpfnWndProc = UnicodeWndProc; - wc.style = 0; - wc.hInstance = hInstance; - wc.hIcon = NULL; - wc.hCursor = NULL; - wc.hbrBackground = NULL; - wc.lpszMenuName = NULL; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - if (RegisterClassW(&wc) == 0) - { - fprintf(stderr, "RegisterClassW failed (last error 0x%X)\n", - GetLastError()); - return 1; - } - printf("Unicode class registered, WndProc = 0x%08x\n", wc.lpfnWndProc); - - hWnd = CreateWindowA("UnicodeClass", - "Unicode Window", - WS_OVERLAPPEDWINDOW, - 0, - 0, - CW_USEDEFAULT, - CW_USEDEFAULT, - NULL, - NULL, - hInstance, - NULL); - if (hWnd == NULL) - { - fprintf(stderr, "CreateWindowA failed (last error 0x%X)\n", - GetLastError()); - return 1; - } - - printf("Window created, IsWindowUnicode returns %s\n", IsWindowUnicode(hWnd) ? "TRUE" : "FALSE"); - - printf("Calling GetWindowTextW\n"); - if (! GetWindowTextW(hWnd, WindowTextW, sizeof(WindowTextW) / sizeof(WindowTextW[0]))) - { - fprintf(stderr, "GetWindowTextW failed (last error 0x%X)\n", GetLastError()); - return 1; - } - printf("GetWindowTextW returned Unicode string \"%S\"\n", WindowTextW); - - printf("Calling GetWindowTextA\n"); - if (! GetWindowTextA(hWnd, WindowTextA, sizeof(WindowTextA) / sizeof(WindowTextA[0]))) - { - fprintf(stderr, "GetWindowTextA failed (last error 0x%X)\n", GetLastError()); - return 1; - } - printf("GetWindowTextA returned Ansi string \"%s\"\n", WindowTextA); - printf("\n"); - - SavedWndProcW = (WNDPROC) GetWindowLongW(hWnd, GWL_WNDPROC); - printf("GetWindowLongW returned 0x%08x\n", SavedWndProcW); - SavedWndProcA = (WNDPROC) GetWindowLongA(hWnd, GWL_WNDPROC); - printf("GetWindowLongA returned 0x%08x\n", SavedWndProcA); - printf("\n"); - - printf("Subclassing window using SetWindowLongW, new WndProc 0x%08x\n", UnicodeSubclassProc); - SetWindowLongW(hWnd, GWL_WNDPROC, (LONG) UnicodeSubclassProc); - printf("After subclass, IsWindowUnicode %s, WndProcA 0x%08x, WndProcW 0x%08x\n", - IsWindowUnicode(hWnd) ? "TRUE" : "FALSE", GetWindowLongA(hWnd, GWL_WNDPROC), - GetWindowLongW(hWnd, GWL_WNDPROC)); - - printf("Calling GetWindowTextW\n"); - if (! GetWindowTextW(hWnd, WindowTextW, sizeof(WindowTextW) / sizeof(WindowTextW[0]))) - { - fprintf(stderr, "GetWindowTextW failed (last error 0x%X)\n", GetLastError()); - return 1; - } - printf("GetWindowTextW returned Unicode string \"%S\"\n", WindowTextW); - printf("\n"); - - printf("Subclassing window using SetWindowLongA, new WndProc 0x%08x\n", AnsiSubclassProc); - SetWindowLongA(hWnd, GWL_WNDPROC, (LONG) AnsiSubclassProc); - printf("After subclass, IsWindowUnicode %s, WndProcA 0x%08x, WndProcW 0x%08x\n", - IsWindowUnicode(hWnd) ? "TRUE" : "FALSE", GetWindowLongA(hWnd, GWL_WNDPROC), - GetWindowLongW(hWnd, GWL_WNDPROC)); - - printf("Calling GetWindowTextW\n"); - if (! GetWindowTextW(hWnd, WindowTextW, sizeof(WindowTextW) / sizeof(WindowTextW[0]))) - { - fprintf(stderr, "GetWindowTextW failed (last error 0x%X)\n", GetLastError()); - return 1; - } - printf("GetWindowTextW returned Unicode string \"%S\"\n", WindowTextW); - - DestroyWindow(hWnd); - - return 0; -} - -LRESULT CALLBACK UnicodeWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - LRESULT Result; - - switch(msg) - { - case WM_GETTEXT: - printf("UnicodeWndProc calling DefWindowProcW\n"); - Result = DefWindowProcW(hWnd, msg, wParam, lParam); - printf("UnicodeWndProc Unicode window text \"%S\"\n", (LPWSTR) lParam); - break; - default: - Result = DefWindowProcW(hWnd, msg, wParam, lParam); - break; - } - - return Result; -} - -LRESULT CALLBACK UnicodeSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - LRESULT Result; - - switch(msg) - { - case WM_GETTEXT: - printf("UnicodeSubclassProc calling SavedWindowProc\n"); - Result = CallWindowProcW(SavedWndProcW, hWnd, msg, wParam, lParam); - printf("UnicodeSubclassProc Unicode window text \"%S\"\n", (LPWSTR) lParam); - break; - default: - Result = CallWindowProcW(SavedWndProcW, hWnd, msg, wParam, lParam); - break; - } - - return Result; -} - -LRESULT CALLBACK AnsiSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - LRESULT Result; - - switch(msg) - { - case WM_GETTEXT: - printf("AnsiSubclassProc calling SavedWindowProcA\n"); - Result = CallWindowProcA(SavedWndProcA, hWnd, msg, wParam, lParam); - printf("AnsiSubclassProc Ansi window text \"%s\"\n", (LPSTR) lParam); - break; - default: - Result = CallWindowProcA(SavedWndProcA, hWnd, msg, wParam, lParam); - break; - } - - return Result; -} diff --git a/reactos/apps/tests/suspend/.cvsignore b/reactos/apps/tests/suspend/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/suspend/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/suspend/Makefile b/reactos/apps/tests/suspend/Makefile deleted file mode 100644 index 29c40fd237e..00000000000 --- a/reactos/apps/tests/suspend/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# $Id: Makefile,v 1.2 2003/11/14 17:13:20 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = suspend - -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/suspend/suspend.c b/reactos/apps/tests/suspend/suspend.c deleted file mode 100644 index 15a245fdbb0..00000000000 --- a/reactos/apps/tests/suspend/suspend.c +++ /dev/null @@ -1,74 +0,0 @@ -#define UNICODE - -#define NTOS_MODE_USER -#include -#include -#include - -#define DBG -#define NDEBUG -#include - -static volatile DWORD z; -static volatile DWORD x=0; - -static NTSTATUS STDCALL -thread_1(PVOID Param) -{ - DWORD y=0; - - for(;;) - { - z++; - if(x>50) - { - printf("I should have been suspended for years :-)\n"); - Sleep(100); - x=0;y++; - if(y==3) ExitProcess(0); - } - } -} - -int -main(int argc, char *argv[]) -{ - HANDLE thread; - DWORD thread_id; - CONTEXT context; - - context.ContextFlags=CONTEXT_CONTROL; - - z=0; - thread=CreateThread(NULL, - 0x1000, - (LPTHREAD_START_ROUTINE)thread_1, - NULL, - 0, - &thread_id); - - if(!thread) - { - printf("Error: could not create thread ...\n"); - ExitProcess(0); - } - - Sleep(1000); - - SuspendThread(thread); - - for(;;) - { - printf("%lx ", z); - Sleep(100);x++; - if(x>100 && GetThreadContext(thread, &context)) - { - printf("EIP: %lx\n", context.Eip); - printf("Calling resumethread ... \n"); - ResumeThread(thread); - } - } - - ExitProcess(0); - return(0); -} diff --git a/reactos/apps/tests/tcpsvr/.cvsignore b/reactos/apps/tests/tcpsvr/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/tcpsvr/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/tcpsvr/makefile b/reactos/apps/tests/tcpsvr/makefile deleted file mode 100644 index 397ba0c46a3..00000000000 --- a/reactos/apps/tests/tcpsvr/makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $Id: makefile,v 1.3 2004/01/11 20:46:05 navaraf Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = tcpsvr - -TARGET_SDKLIBS = kernel32.a ws2_32.a - -TARGET_OBJECTS = $(TARGET_NAME).o - -TARGET_CFLAGS = -D__USE_W32API -Wall -Werror - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/tcpsvr/tcpsvr.c b/reactos/apps/tests/tcpsvr/tcpsvr.c deleted file mode 100644 index 10eda654a8a..00000000000 --- a/reactos/apps/tests/tcpsvr/tcpsvr.c +++ /dev/null @@ -1,175 +0,0 @@ -/* tcpServer.c - * - * Simple Winsock TCP server test. - * Later will be used as base for ReactOS telnetd - * - * HISTORY: - * 6-15-02 - Added Winsock support to UNIX tcp test - * 6-16-02 - Removed Unix support - * 6-17-02 - Added extra comments to code - * - */ - -#include -#include -#include -#include - -#undef ERROR -#define SUCCESS 0 -#define ERROR 1 - -#define END_LINE 0x0A -#define SERVER_PORT 23 -#define MAX_MSG 100 - -/* function readline */ -int read_line(); - -int main (int argc, char *argv[]) { - - WORD wVersionRequested; - WSADATA WsaData; - INT Status; - int sd, newSd, cliLen; - - struct sockaddr_in cliAddr, servAddr; - char line[MAX_MSG]; - - wVersionRequested = MAKEWORD(2, 2); - - Status = WSAStartup(wVersionRequested, &WsaData); - if (Status != 0) { - printf("Could not initialize winsock dll.\n"); - return FALSE; - } - - /* create socket */ - sd = socket(AF_INET, SOCK_STREAM, 0); - if(sd<0) { - perror("cannot open socket "); - WSACleanup(); - return ERROR; - } - - /* bind server port */ - servAddr.sin_family = AF_INET; - servAddr.sin_addr.s_addr = htonl(INADDR_ANY); - servAddr.sin_port = htons(SERVER_PORT); - - if(bind(sd, (struct sockaddr *) &servAddr, sizeof(servAddr))<0) { - perror("cannot bind port "); - WSACleanup(); - return ERROR; - } - - listen(sd,5); - - while(1) { - - printf("%s: \n" - "To start test, Please telnet to localhost (127.0.0.1) port 23 \n" - "When connected input raw data followed by End of Line\n" - "Test is now running on TCP port %u\n",argv[0],SERVER_PORT); - - cliLen = sizeof(cliAddr); - newSd = accept(sd, (struct sockaddr *) &cliAddr, &cliLen); - if(newSd<0) { - perror("cannot accept connection "); - WSACleanup(); - return ERROR; - } - - /* init line */ - memset(line,0x0,MAX_MSG); - - /* receive segments */ - while(read_line(newSd,line)!=ERROR) { - - printf("%s: received from %s:TCP%d : %s\n", argv[0], - inet_ntoa(cliAddr.sin_addr), - ntohs(cliAddr.sin_port), line); - /* init line */ - memset(line,0x0,MAX_MSG); - - } /* while(read_line) */ - - } /* while (1) */ - -} - - -/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING */ -/* this function is experimental.. I don't know yet if it works */ -/* correctly or not. Use Steven's readline() function to have */ -/* something robust. */ -/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING */ - -/* rcv_line is my function readline(). Data is read from the socket when */ -/* needed, but not byte after bytes. All the received data is read. */ -/* This means only one call to recv(), instead of one call for */ -/* each received byte. */ -/* You can set END_CHAR to whatever means endofline for you. (0x0A is \n)*/ -/* read_lin returns the number of bytes returned in line_to_return */ -int read_line(int newSd, char *line_to_return) { - - static int rcv_ptr=0; - static char rcv_msg[MAX_MSG]; - static int n; - int offset; - - offset=0; - - while(1) { - if(rcv_ptr==0) { - /* read data from socket */ - memset(rcv_msg,0x0,MAX_MSG); /* init buffer */ - n = recv(newSd, rcv_msg, MAX_MSG, 0); /* wait for data */ - if (n<0) { - perror(" cannot receive data "); - return ERROR; - } else if (n==0) { - printf(" connection closed by client\n"); - close(newSd); - WSACleanup(); - return ERROR; - } - } - - /* if new data read on socket */ - /* OR */ - /* if another line is still in buffer */ - - /* copy line into 'line_to_return' */ - while(*(rcv_msg+rcv_ptr)!=END_LINE && rcv_ptr return line */ - if(rcv_ptr==n-1) { - /* set last byte to END_LINE */ - *(line_to_return+offset)=END_LINE; - rcv_ptr=0; - return ++offset; - } - - /* end of line but still some data in buffer => return line */ - if(rcv_ptr */ - /* wait for more data to arrive on socket */ - if(rcv_ptr == n) { - rcv_ptr = 0; - } - - } /* while */ -} - - diff --git a/reactos/apps/tests/terminate/.cvsignore b/reactos/apps/tests/terminate/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/terminate/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/terminate/Makefile b/reactos/apps/tests/terminate/Makefile deleted file mode 100644 index 48ff88faa67..00000000000 --- a/reactos/apps/tests/terminate/Makefile +++ /dev/null @@ -1,21 +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 = terminate - -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/terminate/terminate.c b/reactos/apps/tests/terminate/terminate.c deleted file mode 100644 index 986de455800..00000000000 --- a/reactos/apps/tests/terminate/terminate.c +++ /dev/null @@ -1,76 +0,0 @@ -#define UNICODE - -#define NTOS_MODE_USER -#include -#include -#include - -#define DBG -#define NDEBUG -#include - -static volatile DWORD z; -static volatile DWORD x=0; - -static NTSTATUS STDCALL -thread_1(PVOID Param) -{ - DWORD y=0; - - for(;;) - { - z++; - if(x>50) - { - Sleep(100); - x=0;y++; - if(y==3) return(0); - } - } -} - -int -main(int argc, char *argv[]) -{ - HANDLE thread; - DWORD thread_id; - CONTEXT context; - DWORD z = 0; - - context.ContextFlags=CONTEXT_CONTROL; - - while (z < 50) - { - z++; - thread=CreateThread(NULL, - 0x1000, - (LPTHREAD_START_ROUTINE)thread_1, - NULL, - 0, - &thread_id); - - if(!thread) - { - printf("Error: could not create thread ...\n"); - ExitProcess(0); - } - - Sleep(1000); - - printf("T"); - if ((z % 5) == 0) - { - TerminateThread(thread, 0); - } - printf("C"); - GetThreadContext(thread, &context); - printf("S"); - SuspendThread(thread); - printf("R"); - ResumeThread(thread); - TerminateThread(thread, 0); - } - - ExitProcess(0); - return(0); -} diff --git a/reactos/apps/tests/test_old/bug2.c b/reactos/apps/tests/test_old/bug2.c deleted file mode 100644 index 79b89a4d289..00000000000 --- a/reactos/apps/tests/test_old/bug2.c +++ /dev/null @@ -1,11 +0,0 @@ -#include - -int -main (void) -{ - int i; - puts ("This should print \"wow = I\" for I from 0 to 39 inclusive."); - for (i = 0; i < 40; i++) - printf ("%s = %d\n", "wow", i); - return 0; -} diff --git a/reactos/apps/tests/test_old/bug3.c b/reactos/apps/tests/test_old/bug3.c deleted file mode 100644 index 6b2ed6b8e0c..00000000000 --- a/reactos/apps/tests/test_old/bug3.c +++ /dev/null @@ -1,53 +0,0 @@ -#include -#include - -int -main (void) -{ - FILE *f; - int i; - const char filename[] = "/tmp/bug3.test"; - - f = fopen(filename, "w+"); - for (i=0; i<9000; i++) - putc ('x', f); - fseek (f, 8180L, 0); - fwrite ("Where does this text go?", 1, 24, f); - fflush (f); - - rewind (f); - for (i=0; i<9000; i++) - { - int j; - - if ((j = getc(f)) != 'x') - { - if (i != 8180) - { - printf ("Test FAILED!"); - return 1; - } - else - { - char buf[25]; - - buf[0] = j; - fread (buf + 1, 1, 23, f); - buf[24] = '\0'; - if (strcmp (buf, "Where does this text go?") != 0) - { - printf ("%s\nTest FAILED!\n", buf); - return 1; - } - i += 23; - } - } - } - - fclose(f); - remove(filename); - - puts ("Test succeeded."); - - return 0; -} diff --git a/reactos/apps/tests/test_old/makefile b/reactos/apps/tests/test_old/makefile deleted file mode 100644 index 3c309607036..00000000000 --- a/reactos/apps/tests/test_old/makefile +++ /dev/null @@ -1,68 +0,0 @@ -# -# -# -PATH_TO_TOP = ../.. - -PROGS= test-stdio tst-printf tstdiomisc bug2 bug3 \ - temptest test-fseek test_rdwr testfsd time_t - -all: $(PROGS:%=%.exe) - -.phony: all - -implib: - -clean: - - $(RM) *.o *.exe *.sym - -.phony: implib clean - -install: # $(PROGS:%=$(FLOPPY_DIR)/apps/%.exe) - -$(PROGS:%=$(FLOPPY_DIR)/apps/%.exe): $(FLOPPY_DIR)/apps/%.exe: %.exe - -bug2.exe: bug2.c - $(CC) bug2.c -lkernel32 -o bug2.exe - $(NM) --numeric-sort bug2.exe > bug2.sym - -bug3.exe: bug3.c - $(CC) bug3.c -lkernel32 -o bug3.exe - $(NM) --numeric-sort bug3.exe > bug3.sym - -temptest.exe: temptest.c - $(CC) temptest.c -lkernel32 -o temptest.exe - $(NM) --numeric-sort temptest.exe > temptest.sym - -test-fseek.exe: test-fseek.c - $(CC) test-fseek.c -lkernel32 -o test-fseek.exe - $(NM) --numeric-sort test-fseek.exe > test-fseek.sym - -test-fwrite.exe: test-fwrite.c - $(CC) test-fwrite.c -lkernel32 -o test-fwrite.exe - $(NM) --numeric-sort test-fwrite.exe > test-fwrite.sym - -test_rdwr.exe: test_rdwr.c - $(CC) test_rdwr.c -lkernel32 -o test_rdwr.exe - $(NM) --numeric-sort test_rdwr.exe > test_rdwr.sym - -test-stdio.exe: test-stdio.c - $(CC) test-stdio.c -lkernel32 -o test-stdio.exe - $(NM) --numeric-sort test-stdio.exe > test-stdio.sym - -tst-printf.exe: tst-printf.c - $(CC) tst-printf.c -lkernel32 -o tst-printf.exe - $(NM) --numeric-sort tst-printf.exe > tst-printf.sym - -tstdiomisc.exe: tstdiomisc.c - $(CC) tstdiomisc.c -lkernel32 -o tstdiomisc.exe - $(NM) --numeric-sort tstdiomisc.exe > tstdiomisc.sym - -testfsd.exe: testfsd.c testsuite.c - $(CC) testfsd.c testsuite.c -lkernel32 -o testfsd.exe - $(NM) --numeric-sort testfsd.exe > testfsd.sym - -time_t.exe: time_t.c - $(CC) time_t.c -lkernel32 -o time_t.exe - $(NM) --numeric-sort time_t.exe > time_t.sym - -include ../../rules.mak diff --git a/reactos/apps/tests/test_old/temptest.c b/reactos/apps/tests/test_old/temptest.c deleted file mode 100644 index 35ea4dc8086..00000000000 --- a/reactos/apps/tests/test_old/temptest.c +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include - -char *files[500]; - -int -main (int argc, char *argv[]) -{ - FILE *fp; - int i; - - for (i = 0; i < 500; i++) { - files[i] = tempnam (NULL, "file"); - if (files[i] == NULL) { - printf ("tempnam failed\n"); - exit (1); - } - printf ("file: %s\n", files[i]); - fp = fopen (files[i], "w"); - fclose (fp); - } - - for (i = 0; i < 500; i++) - remove (files[i]); - - exit (0); -} diff --git a/reactos/apps/tests/test_old/test-fseek.c b/reactos/apps/tests/test_old/test-fseek.c deleted file mode 100644 index e736ed7cdc3..00000000000 --- a/reactos/apps/tests/test_old/test-fseek.c +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#define TESTFILE "/tmp/test.dat" - -int -main (void) -{ - FILE *fp; - int i, j; - - puts ("\nFile seek test"); - fp = fopen (TESTFILE, "w"); - if (fp == NULL) - { - perror (TESTFILE); - return 1; - } - - for (i = 0; i < 256; i++) - putc (i, fp); - if (freopen (TESTFILE, "r", fp) != fp) - { - perror ("Cannot open file for reading"); - return 1; - } - - for (i = 1; i <= 255; i++) - { - printf ("%3d\n", i); - fseek (fp, (long) -i, SEEK_END); - if ((j = getc (fp)) != 256 - i) - { - printf ("SEEK_END failed %d\n", j); - break; - } - if (fseek (fp, (long) i, SEEK_SET)) - { - puts ("Cannot SEEK_SET"); - break; - } - if ((j = getc (fp)) != i) - { - printf ("SEEK_SET failed %d\n", j); - break; - } - if (fseek (fp, (long) i, SEEK_SET)) - { - puts ("Cannot SEEK_SET"); - break; - } - if (fseek (fp, (long) (i >= 128 ? -128 : 128), SEEK_CUR)) - { - puts ("Cannot SEEK_CUR"); - break; - } - if ((j = getc (fp)) != (i >= 128 ? i - 128 : i + 128)) - { - printf ("SEEK_CUR failed %d\n", j); - break; - } - } - fclose (fp); - remove (TESTFILE); - - puts ((i > 255) ? "Test succeeded." : "Test FAILED!"); - return (i > 255) ? 0 : 1; -} diff --git a/reactos/apps/tests/test_old/test-fwrite.c b/reactos/apps/tests/test_old/test-fwrite.c deleted file mode 100644 index ce541699310..00000000000 --- a/reactos/apps/tests/test_old/test-fwrite.c +++ /dev/null @@ -1,68 +0,0 @@ -#include -#include - -int -main (int argc, char *argv[]) -{ - FILE *f = tmpfile (); - char obuf[99999], ibuf[sizeof obuf]; - char *line; - size_t linesz; - - if (! f) - { - perror ("tmpfile"); - return 1; - } - - if (fputs ("line\n", f) == EOF) - { - perror ("fputs"); - return 1; - } - - memset (obuf, 'z', sizeof obuf); - memset (ibuf, 'y', sizeof ibuf); - - if (fwrite (obuf, sizeof obuf, 1, f) != 1) - { - perror ("fwrite"); - return 1; - } - - rewind (f); - - line = NULL; - linesz = 0; - if (getline (&line, &linesz, f) != 5) - { - perror ("getline"); - return 1; - } - if (strcmp (line, "line\n")) - { - puts ("Lines differ. Test FAILED!"); - return 1; - } - - if (fread (ibuf, sizeof ibuf, 1, f) != 1) - { - perror ("fread"); - return 1; - } - - if (memcmp (ibuf, obuf, sizeof ibuf)) - { - puts ("Buffers differ. Test FAILED!"); - return 1; - } - - asprintf (&line, "\ -GDB is free software and you are welcome to distribute copies of it\n\ - under certain conditions; type \"show copying\" to see the conditions.\n\ -There is absolutely no warranty for GDB; type \"show warranty\" for details.\n\ -"); - - puts ("Test succeeded."); - return 0; -} diff --git a/reactos/apps/tests/test_old/test-stdio.c b/reactos/apps/tests/test_old/test-stdio.c deleted file mode 100644 index 913abc2e807..00000000000 --- a/reactos/apps/tests/test_old/test-stdio.c +++ /dev/null @@ -1,55 +0,0 @@ -#include -#include - -int main() -{ - char msg1[] = "testing _write\n"; - char msg2[] = "testing putchar."; - char msg3[] = "testing printf."; - char tmpbuf[255]; - FILE* f1; - - write(1, msg1, strlen(msg1)); - - write(1, msg2, strlen(msg2)); - putchar('o'); putchar('k'); putchar('\n'); - - write(1, msg3, strlen(msg3)); - printf("ok\n"); - - printf("Testing fopen\n"); - f1 = fopen("tmp.txt","w+b"); - if (f1 == NULL) - { - printf("fopen failed\n"); - return(1); - } - - printf("Testing fwrite\n"); - if (fwrite(msg1, 1, strlen(msg1)+1, f1) != (strlen(msg1)+1)) - { - printf("fwrite failed\n"); - return(1); - } - - printf("Testing fread\n"); - fseek(f1, 0, SEEK_SET); - if (fread(tmpbuf, 1, strlen(msg1)+1, f1) != (strlen(msg1)+1)) - { - printf("fread failed\n"); - return(1); - } - if (strcmp(tmpbuf,msg1) != 0) - { - printf("fread failed, data corrupt\n"); - return(1); - } - - printf("Testing fclose\n"); - if (fclose(f1) != 0) - { - printf("fclose failed\n"); - return(1); - } - return(0); -} diff --git a/reactos/apps/tests/test_old/test_rdwr.c b/reactos/apps/tests/test_old/test_rdwr.c deleted file mode 100644 index a3b01b7c7ce..00000000000 --- a/reactos/apps/tests/test_old/test_rdwr.c +++ /dev/null @@ -1,129 +0,0 @@ -/* Copyright (C) 1991, 1992, 1996, 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include -#include - - -int -main (int argc, char **argv) -{ - static const char hello[] = "Hello, world.\n"; - static const char replace[] = "Hewwo, world.\n"; - static const size_t replace_from = 2, replace_to = 4; - char filename[FILENAME_MAX]; - char *name = strrchr (*argv, '/'); - char buf[BUFSIZ]; - FILE *f; - int lose = 0; - - if (name != NULL) - ++name; - else - name = *argv; - - (void) sprintf (filename, "/tmp/%s.test", name); - - f = fopen (filename, "w+"); - if (f == NULL) - { - perror (filename); - exit (1); - } - - (void) fputs (hello, f); - rewind (f); - (void) fgets (buf, sizeof (buf), f); - rewind (f); - (void) fputs (buf, f); - rewind (f); - { - size_t i; - for (i = 0; i < replace_from; ++i) - { - int c = getc (f); - if (c == EOF) - { - printf ("EOF at %Zu.\n", i); - lose = 1; - break; - } - else if (c != hello[i]) - { - printf ("Got '%c' instead of '%c' at %Zu.\n", - (unsigned char) c, hello[i], i); - lose = 1; - break; - } - } - } - - { - long int where = ftell (f); - if (where == (long int) replace_from) - { - register size_t i; - for (i = replace_from; i < replace_to; ++i) - if (putc(replace[i], f) == EOF) - { - printf ("putc('%c') got %s at %Zu.\n", - replace[i], strerror (errno), i); - lose = 1; - break; - } - } - else if (where == -1L) - { - printf ("ftell got %s (should be at %Zu).\n", - strerror (errno), replace_from); - lose = 1; - } - else - { - printf ("ftell returns %lu; should be %Zu.\n", where, replace_from); - lose = 1; - } - } - - if (!lose) - { - rewind (f); - if (fgets (buf, sizeof (buf), f) == NULL) - { - printf ("fgets got %s.\n", strerror(errno)); - lose = 1; - } - else if (strcmp (buf, replace)) - { - printf ("Read \"%s\" instead of \"%s\".\n", buf, replace); - lose = 1; - } - } - - if (lose) - printf ("Test FAILED! Losing file is \"%s\".\n", filename); - else - { - (void) remove (filename); - puts ("Test succeeded."); - } - - exit (lose ? EXIT_FAILURE : EXIT_SUCCESS); -} diff --git a/reactos/apps/tests/test_old/testfsd.c b/reactos/apps/tests/test_old/testfsd.c deleted file mode 100644 index 2bf9cadd5c7..00000000000 --- a/reactos/apps/tests/test_old/testfsd.c +++ /dev/null @@ -1,315 +0,0 @@ -/* $Id: testfsd.c,v 1.4 2001/07/04 03:07:54 rex Exp $ - * - * FILE: testFSD.c - * PURPOSE: A test set for the File System Driver - * PROJECT: ReactOS kernel - * COPYRIGHT: See COPYING in the top level directory - * PROGRAMMER: Rex Jolliff (rex@lvcablemodem.com) - * - */ - -#include -#include -#include -#include - -#include "testsuite.h" - -const char *rootDir = "c:\\"; -const char *systemRootDir = "c:\\ReactOS"; -const char *systemDllDir = "c:\\ReactOS\\System32"; -const char *bogusRootFile = "c:\\bogus"; -const char *bogusDirAndFile = "c:\\bogus\\bogus"; -const char *bogusSystemRootFile = "c:\\ReactOS\\bogus"; -const char *bogusSystemDllFile = "c:\\ReactOS\\System32\\bogus"; -const char *shortFile = "c:\\ReactOS\\boot.bat"; -const char *longFile = "c:\\ReactOS\\loadros.com"; - -void testOpenExistant (void) -{ - HANDLE fileHandle; - - fileHandle = CreateFile (rootDir, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); - ASSERT (fileHandle != INVALID_HANDLE_VALUE); - CloseHandle (fileHandle); - fileHandle = CreateFile (systemRootDir, GENERIC_READ, 0, 0, - OPEN_EXISTING, 0, 0); - ASSERT (fileHandle != INVALID_HANDLE_VALUE); - CloseHandle (fileHandle); - fileHandle = CreateFile (systemDllDir, GENERIC_READ, 0, 0, - OPEN_EXISTING, 0, 0); - ASSERT (fileHandle != INVALID_HANDLE_VALUE); - CloseHandle (fileHandle); -} - -void testOpenNonExistant (void) -{ - DWORD status; - HANDLE fileHandle; - - fileHandle = CreateFile (bogusRootFile, GENERIC_READ, 0, 0, - OPEN_EXISTING, 0, 0); - ASSERT (fileHandle == INVALID_HANDLE_VALUE); - status = GetLastError (); - ASSERT (status == ERROR_FILE_NOT_FOUND); - CloseHandle (fileHandle); - fileHandle = CreateFile (bogusDirAndFile, GENERIC_READ, 0, 0, - OPEN_EXISTING, 0, 0); - ASSERT (fileHandle == INVALID_HANDLE_VALUE); - status = GetLastError (); - ASSERT (status == ERROR_PATH_NOT_FOUND); - CloseHandle (fileHandle); - fileHandle = CreateFile (bogusSystemRootFile, GENERIC_READ, 0, 0, - OPEN_EXISTING, 0, 0); - ASSERT (fileHandle == INVALID_HANDLE_VALUE); - status = GetLastError (); - ASSERT (status == ERROR_FILE_NOT_FOUND); - CloseHandle (fileHandle); - fileHandle = CreateFile (bogusSystemDllFile, GENERIC_READ, 0, 0, - OPEN_EXISTING, 0, 0); - ASSERT (fileHandle == INVALID_HANDLE_VALUE); - status = GetLastError (); - ASSERT (status == ERROR_FILE_NOT_FOUND); - CloseHandle (fileHandle); -} - -void testCreateExistant (void) -{ - DWORD status; - HANDLE fileHandle; - - fileHandle = CreateFile (rootDir, GENERIC_READ, 0, 0, - CREATE_NEW, 0, 0); - ASSERT (fileHandle == INVALID_HANDLE_VALUE); - status = GetLastError (); - ASSERT (status == ERROR_ALREADY_EXISTS); - fileHandle = CreateFile (systemRootDir, GENERIC_READ, 0, 0, - CREATE_NEW, 0, 0); - ASSERT (fileHandle == INVALID_HANDLE_VALUE); - status = GetLastError (); - ASSERT (status == ERROR_ALREADY_EXISTS); - fileHandle = CreateFile (systemDllDir, GENERIC_READ, 0, 0, - CREATE_NEW, 0, 0); - ASSERT (fileHandle == INVALID_HANDLE_VALUE); - status = GetLastError (); - ASSERT (status == ERROR_ALREADY_EXISTS); -} - -void testCreateNonExistant (void) -{ - DWORD status; - HANDLE fileHandle; - - fileHandle = CreateFile (bogusRootFile, GENERIC_READ, 0, 0, - CREATE_NEW, 0, 0); - ASSERT (fileHandle != INVALID_HANDLE_VALUE); - CloseHandle (fileHandle); - fileHandle = CreateFile (bogusSystemRootFile, GENERIC_READ, 0, 0, - CREATE_NEW, 0, 0); - ASSERT (fileHandle != INVALID_HANDLE_VALUE); - CloseHandle (fileHandle); - fileHandle = CreateFile (bogusSystemDllFile, GENERIC_READ, 0, 0, - CREATE_NEW, 0, 0); - ASSERT (fileHandle != INVALID_HANDLE_VALUE); - CloseHandle (fileHandle); -#if 0 - fileHandle = CreateFile (bogusDirAndFile, GENERIC_READ, 0, 0, - CREATE_NEW, 0, 0); - ASSERT (fileHandle == INVALID_HANDLE_VALUE); - status = GetLastError (); - ASSERT (status == ERROR_PATH_NOT_FOUND); - CloseHandle (fileHandle); -#endif -} - -void testDeleteFiles (void) -{ - BOOL returnValue; - HANDLE fileHandle; - - fileHandle = CreateFile ("bogus", GENERIC_READ, 0, 0, - CREATE_NEW, 0, 0); - ASSERT (fileHandle != INVALID_HANDLE_VALUE); - CloseHandle (fileHandle); - returnValue = DeleteFile ("bogus"); - ASSERT_MSG (returnValue, - "Delete of bogus failed, error:%d", - GetLastError ()); - -#if 0 - returnValue = DeleteFile (bogusRootFile); - ASSERT_MSG (returnValue, - "Delete of %s failed, error:%d", - bogusRootFile, - GetLastError ()); - returnValue = DeleteFile (bogusRootFile); - ASSERT_MSG (!returnValue, - "2nd Delete of %s succeeded but should fail", - bogusRootFile); - returnValue = DeleteFile (bogusSystemRootFile); - ASSERT_MSG (returnValue, - "Delete of %s failed, error:%d", - bogusSystemRootFile, - GetLastError ()); - returnValue = DeleteFile (bogusSystemRootFile); - ASSERT_MSG (!returnValue, - "2nd Delete of %s succeeded but should fail", - bogusSystemRootFile); - returnValue = DeleteFile (bogusSystemDllFile); - ASSERT_MSG (returnValue, - "Delete of %s failed, error:%d", - bogusSystemDllFile, - GetLastError ()); - returnValue = DeleteFile (bogusSystemDllFile); - ASSERT_MSG (!returnValue, - "2nd Delete of %s succeeded but should fail", - bogusSystemDllFile); - returnValue = DeleteFile (bogusDirAndFile); - ASSERT_MSG (!returnValue, - "Delete of %s succeded but should fail", - bogusDirAndFile); -#endif -} - -void testOpenWithBlankPathElements (void) -{ - HANDLE fileHandle; - - fileHandle = CreateFile ("c:", GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); - ASSERT (fileHandle != INVALID_HANDLE_VALUE); - CloseHandle (fileHandle); - fileHandle = CreateFile ("c:\\\\", GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); - ASSERT (fileHandle != INVALID_HANDLE_VALUE); - CloseHandle (fileHandle); - fileHandle = CreateFile ("c:\\\\reactos\\", GENERIC_READ, 0, 0, - OPEN_EXISTING, 0, 0); - ASSERT (fileHandle != INVALID_HANDLE_VALUE); - CloseHandle (fileHandle); - fileHandle = CreateFile ("c:\\reactos\\\\", GENERIC_READ, 0, 0, - OPEN_EXISTING, 0, 0); - ASSERT (fileHandle != INVALID_HANDLE_VALUE); - CloseHandle (fileHandle); - fileHandle = CreateFile ("c:\\reactos\\\\system32\\", GENERIC_READ, 0, 0, - OPEN_EXISTING, 0, 0); - ASSERT (fileHandle != INVALID_HANDLE_VALUE); - CloseHandle (fileHandle); - fileHandle = CreateFile ("c:\\reactos\\system32\\\\", GENERIC_READ, 0, 0, - OPEN_EXISTING, 0, 0); - ASSERT (fileHandle != INVALID_HANDLE_VALUE); - CloseHandle (fileHandle); -} - -void testReadOnInvalidHandle (void) -{ - BOOL returnValue; - char buffer [256]; - DWORD bytesRead; - - returnValue = ReadFile (INVALID_HANDLE_VALUE, - buffer, - 256, - &bytesRead, - NULL); - ASSERT_MSG (!returnValue, - "Read from invalid handle succeeded but should fail",0); - ASSERT (GetLastError () != ENOFILE); -} - -void testReadOnZeroLengthFile (void) -{ - BOOL returnValue; - HANDLE fileHandle; - char buffer [256]; - DWORD bytesRead; - - fileHandle = CreateFile (bogusRootFile, GENERIC_READ, 0, 0, - CREATE_NEW, 0, 0); - ASSERT (fileHandle != INVALID_HANDLE_VALUE); - CloseHandle (fileHandle); - fileHandle = CreateFile (bogusRootFile, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); - ASSERT (fileHandle != INVALID_HANDLE_VALUE); - returnValue = ReadFile (fileHandle, buffer, 256, &bytesRead, NULL); - ASSERT_MSG (!returnValue, - "Read from zero length file succeeded but should fail",0); - ASSERT (GetLastError () != ERROR_HANDLE_EOF); - CloseHandle (fileHandle); - returnValue = DeleteFile (bogusRootFile); - ASSERT_MSG (returnValue, - "Delete of %s failed, error:%d", - bogusRootFile, - GetLastError ()); -} - -void testReadOnShortFile (void) -{ - BOOL returnValue; - HANDLE fileHandle; - char buffer [256]; - DWORD bytesRead; - - fileHandle = CreateFile (shortFile, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); - ASSERT (fileHandle != INVALID_HANDLE_VALUE); - returnValue = ReadFile (fileHandle, - buffer, - 256, - &bytesRead, - NULL); - ASSERT_MSG (returnValue, - "Read from short length file failed, error:%d", - GetLastError ()); - ASSERT (bytesRead > 0 && bytesRead < 256); - CloseHandle (fileHandle); -} - -void testReadOnLongFile (void) -{ - BOOL returnValue; - HANDLE fileHandle; - char buffer [256]; - DWORD bytesRead; - int count; - - fileHandle = CreateFile (longFile, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); - ASSERT (fileHandle != INVALID_HANDLE_VALUE); - for (count = 0; count < 20; count++) - { - returnValue = ReadFile (fileHandle, - buffer, - 256, - &bytesRead, - NULL); - ASSERT_MSG (returnValue, - "Read from short length file failed, error:%d", - GetLastError ()); - ASSERT (bytesRead == 256); - } - CloseHandle (fileHandle); -} - -int main (void) -{ - TEST_RUNNER testRunner; - TEST_SUITE testsToRun [] = - { - ADD_TEST (testOpenExistant), - ADD_TEST (testOpenNonExistant), - ADD_TEST (testCreateExistant), - ADD_TEST (testCreateNonExistant), - ADD_TEST (testDeleteFiles), -/* ADD_TEST (testOverwriteExistant),*/ -/* ADD_TEST (testOverwriteNonExistant),*/ - ADD_TEST (testOpenWithBlankPathElements), - ADD_TEST (testReadOnInvalidHandle), - ADD_TEST (testReadOnZeroLengthFile), - ADD_TEST (testReadOnShortFile), - ADD_TEST (testReadOnLongFile), -/* ADD_TEST (test), */ - END_TESTS - }; - - memset (&testRunner, 0, sizeof (TEST_RUNNER)); - tsRunTests (&testRunner, testsToRun); - tsReportResults (&testRunner); -} - - diff --git a/reactos/apps/tests/test_old/testsuite.c b/reactos/apps/tests/test_old/testsuite.c deleted file mode 100644 index 617bde8550f..00000000000 --- a/reactos/apps/tests/test_old/testsuite.c +++ /dev/null @@ -1,65 +0,0 @@ - -#include -#include - -#include "testsuite.h" - -static PTEST_RUNNER iTestRunner = 0; - -void tsRunTests (PTEST_RUNNER pTestRunner, PTEST_SUITE pTests) -{ - int testIndex; - - iTestRunner = pTestRunner; - for (testIndex = 0; pTests [testIndex].testFunc != 0; testIndex++) - { - pTests [testIndex].testFunc (); - pTestRunner->tests++; - } -} - -void tsReportResults (PTEST_RUNNER pTestRunner) -{ - printf ("\nTotal of %d tests.\n" - "Assertions: %d\n" - " Assertions which passed: %d\n" - " Assertions which failed: %d\n", - pTestRunner->tests, - pTestRunner->assertions, - pTestRunner->successes, - pTestRunner->failures); - if (pTestRunner->failures == 0) - { - printf ("\n*** OK ***\n"); - } - else - { - printf ("\n*** FAIL ***\n"); - } -} - -void tsDoAssertion (BOOL pTest, - PCHAR pTestText, - PCHAR pFunction, - int pLine, - ...) -{ - va_list ap; - - iTestRunner->assertions++; - if (!pTest) - { - va_start (ap, pLine); - printf ("%s(%d): ", pFunction, pLine); - vprintf (pTestText, ap); - printf ("\n"); - va_end(ap); - iTestRunner->failures++; - } - else - { - iTestRunner->successes++; - } -} - - diff --git a/reactos/apps/tests/test_old/testsuite.h b/reactos/apps/tests/test_old/testsuite.h deleted file mode 100644 index 0abc2ef2b7d..00000000000 --- a/reactos/apps/tests/test_old/testsuite.h +++ /dev/null @@ -1,44 +0,0 @@ - -#ifndef H_TESTSUITE_H -#define H_TESTSUITE_H - -struct TestSuite -{ - char *name; - void (*testFunc)(void); -}; - -typedef struct TestSuite TEST_SUITE, *PTEST_SUITE; - -#define ADD_TEST(x) {#x, x} -#define END_TESTS {0, 0} -#define COUNT_TESTS(x) (sizeof x/sizeof (struct TestSuite)) - -struct TestRunner -{ - int tests; - int assertions; - int failures; - int successes; -}; - -typedef struct TestRunner TEST_RUNNER, *PTEST_RUNNER; - -void tsDoAssertion (BOOL pTest, - PCHAR pTestText, - PCHAR pFunction, - int pLine, - ...); - -#ifdef ASSERT -#undef ASSERT -#endif -#define ASSERT(x) tsDoAssertion (x, "assertion \"" ## #x ## "\" failed", __FUNCTION__, __LINE__) -#define ASSERT_MSG(x,y,a...) tsDoAssertion (x, y, __FUNCTION__, __LINE__,a) - -void tsRunTests (PTEST_RUNNER pTestRunner, PTEST_SUITE pTests); -void tsReportResults (PTEST_RUNNER pTestRunner); - -#endif - - diff --git a/reactos/apps/tests/test_old/time_t.c b/reactos/apps/tests/test_old/time_t.c deleted file mode 100644 index 63353556e3d..00000000000 --- a/reactos/apps/tests/test_old/time_t.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include - -int main(void) -{ - struct tm *ptr; - time_t lt; - - lt = time(NULL); - ptr = localtime(<); - printf(asctime(ptr)); -} \ No newline at end of file diff --git a/reactos/apps/tests/test_old/tst-printf.c b/reactos/apps/tests/test_old/tst-printf.c deleted file mode 100644 index 8c4feedead8..00000000000 --- a/reactos/apps/tests/test_old/tst-printf.c +++ /dev/null @@ -1,311 +0,0 @@ -/* Copyright (C) 1991, 92, 93, 95, 96, 97, 98 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifdef BSD -#include -#define EXIT_SUCCESS 0 -#else -#include -#include -#include -#endif - -#include - -void rfg1 (void); -void rfg2 (void); - - -void -fmtchk (const char *fmt) -{ - (void) fputs(fmt, stdout); - (void) printf(":\t`"); - (void) printf(fmt, 0x12); - (void) printf("'\n"); -} - -void -fmtst1chk (const char *fmt) -{ - (void) fputs(fmt, stdout); - (void) printf(":\t`"); - (void) printf(fmt, 4, 0x12); - (void) printf("'\n"); -} - -void -fmtst2chk (const char *fmt) -{ - (void) fputs(fmt, stdout); - (void) printf(":\t`"); - (void) printf(fmt, 4, 4, 0x12); - (void) printf("'\n"); -} - -/* This page is covered by the following copyright: */ - -/* (C) Copyright C E Chew - * - * Feel free to copy, use and distribute this software provided: - * - * 1. you do not pretend that you wrote it - * 2. you leave this copyright notice intact. - */ - -/* - * Extracted from exercise.c for glibc-1.05 bug report by Bruce Evans. - */ - -#define DEC -123 -#define INT 255 -#define UNS (~0) - -/* Formatted Output Test - * - * This exercises the output formatting code. - */ - -void -fp_test (void) -{ - int i, j, k, l; - char buf[7]; - char *prefix = buf; - char tp[20]; - - puts("\nFormatted output test"); - printf("prefix 6d 6o 6x 6X 6u\n"); - strcpy(prefix, "%"); - for (i = 0; i < 2; i++) { - for (j = 0; j < 2; j++) { - for (k = 0; k < 2; k++) { - for (l = 0; l < 2; l++) { - strcpy(prefix, "%"); - if (i == 0) strcat(prefix, "-"); - if (j == 0) strcat(prefix, "+"); - if (k == 0) strcat(prefix, "#"); - if (l == 0) strcat(prefix, "0"); - printf("%5s |", prefix); - strcpy(tp, prefix); - strcat(tp, "6d |"); - printf(tp, DEC); - strcpy(tp, prefix); - strcat(tp, "6o |"); - printf(tp, INT); - strcpy(tp, prefix); - strcat(tp, "6x |"); - printf(tp, INT); - strcpy(tp, prefix); - strcat(tp, "6X |"); - printf(tp, INT); - strcpy(tp, prefix); - strcat(tp, "6u |"); - printf(tp, UNS); - printf("\n"); - } - } - } - } - printf("%10s\n", (char *) NULL); - printf("%-10s\n", (char *) NULL); -} - -int -main (int argc, char *argv[]) -{ - static char shortstr[] = "Hi, Z."; - static char longstr[] = "Good morning, Doctor Chandra. This is Hal. \ -I am ready for my first lesson today."; - - fmtchk("%.4x"); - fmtchk("%04x"); - fmtchk("%4.4x"); - fmtchk("%04.4x"); - fmtchk("%4.3x"); - fmtchk("%04.3x"); - - fmtst1chk("%.*x"); - fmtst1chk("%0*x"); - fmtst2chk("%*.*x"); - fmtst2chk("%0*.*x"); - -#ifndef BSD - printf("bad format:\t\"%b\"\n"); - printf("nil pointer (padded):\t\"%10p\"\n", (void *) NULL); -#endif - - printf("decimal negative:\t\"%d\"\n", -2345); - printf("octal negative:\t\"%o\"\n", -2345); - printf("hex negative:\t\"%x\"\n", -2345); - printf("long decimal number:\t\"%ld\"\n", -123456L); - printf("long octal negative:\t\"%lo\"\n", -2345L); - printf("long unsigned decimal number:\t\"%lu\"\n", -123456L); - printf("zero-padded LDN:\t\"%010ld\"\n", -123456L); - printf("left-adjusted ZLDN:\t\"%-010ld\"\n", -123456); - printf("space-padded LDN:\t\"%10ld\"\n", -123456L); - printf("left-adjusted SLDN:\t\"%-10ld\"\n", -123456L); - - printf("zero-padded string:\t\"%010s\"\n", shortstr); - printf("left-adjusted Z string:\t\"%-010s\"\n", shortstr); - printf("space-padded string:\t\"%10s\"\n", shortstr); - printf("left-adjusted S string:\t\"%-10s\"\n", shortstr); - printf("null string:\t\"%s\"\n", (char *)NULL); - printf("limited string:\t\"%.22s\"\n", longstr); - - printf("e-style >= 1:\t\"%e\"\n", 12.34); - printf("e-style >= .1:\t\"%e\"\n", 0.1234); - printf("e-style < .1:\t\"%e\"\n", 0.001234); - printf("e-style big:\t\"%.60e\"\n", 1e20); - printf ("e-style == .1:\t\"%e\"\n", 0.1); - printf("f-style >= 1:\t\"%f\"\n", 12.34); - printf("f-style >= .1:\t\"%f\"\n", 0.1234); - printf("f-style < .1:\t\"%f\"\n", 0.001234); - printf("g-style >= 1:\t\"%g\"\n", 12.34); - printf("g-style >= .1:\t\"%g\"\n", 0.1234); - printf("g-style < .1:\t\"%g\"\n", 0.001234); - printf("g-style big:\t\"%.60g\"\n", 1e20); - - printf (" %6.5f\n", .099999999860301614); - printf (" %6.5f\n", .1); - printf ("x%5.4fx\n", .5); - - printf ("%#03x\n", 1); - - { - double d = FLT_MIN; - int niter = 17; - - while (niter-- != 0) - printf ("%.17e\n", d / 2); - fflush (stdout); - } - - printf ("%15.5e\n", 4.9406564584124654e-324); - -#define FORMAT "|%12.4f|%12.4e|%12.4g|\n" - printf (FORMAT, 0.0, 0.0, 0.0); - printf (FORMAT, 1.0, 1.0, 1.0); - printf (FORMAT, -1.0, -1.0, -1.0); - printf (FORMAT, 100.0, 100.0, 100.0); - printf (FORMAT, 1000.0, 1000.0, 1000.0); - printf (FORMAT, 10000.0, 10000.0, 10000.0); - printf (FORMAT, 12345.0, 12345.0, 12345.0); - printf (FORMAT, 100000.0, 100000.0, 100000.0); - printf (FORMAT, 123456.0, 123456.0, 123456.0); -#undef FORMAT - - { - char buf[20]; - printf ("sprintf (\"%%30s\", \"foo\") == %d, \"%.*s\"\n", - sprintf (buf, "%30s", "foo"), sizeof (buf), buf); - } - - fp_test (); - - printf ("%e should be 1.234568e+06\n", 1234567.8); - printf ("%f should be 1234567.800000\n", 1234567.8); - printf ("%g should be 1.23457e+06\n", 1234567.8); - printf ("%g should be 123.456\n", 123.456); - printf ("%g should be 1e+06\n", 1000000.0); - printf ("%g should be 10\n", 10.0); - printf ("%g should be 0.02\n", 0.02); - - { - double x=1.0; - printf("%.17f\n",(1.0/x/10.0+1.0)*x-x); - } - - puts ("--- Should be no further output. ---"); - rfg1 (); - rfg2 (); - - { - char buf[200]; - int result; - - sprintf(buf,"%*s%*s%*s",-1,"one",-20,"two",-30,"three"); - - result = strcmp (buf, - "onetwo three "); - - puts (result != 0 ? "Test failed!" : "Test ok."); - return result != 0; - } -} - -void -rfg1 (void) -{ - char buf[100]; - - sprintf (buf, "%5.s", "xyz"); - if (strcmp (buf, " ") != 0) - printf ("got: '%s', expected: '%s'\n", buf, " "); - sprintf (buf, "%5.f", 33.3); - if (strcmp (buf, " 33") != 0) - printf ("got: '%s', expected: '%s'\n", buf, " 33"); - sprintf (buf, "%8.e", 33.3e7); - if (strcmp (buf, " 3e+08") != 0) - printf ("got: '%s', expected: '%s'\n", buf, " 3e+08"); - sprintf (buf, "%8.E", 33.3e7); - if (strcmp (buf, " 3E+08") != 0) - printf ("got: '%s', expected: '%s'\n", buf, " 3E+08"); - sprintf (buf, "%.g", 33.3); - if (strcmp (buf, "3e+01") != 0) - printf ("got: '%s', expected: '%s'\n", buf, "3e+01"); - sprintf (buf, "%.G", 33.3); - if (strcmp (buf, "3E+01") != 0) - printf ("got: '%s', expected: '%s'\n", buf, "3E+01"); -} - -void -rfg2 (void) -{ - int prec; - char buf[100]; - - prec = 0; - sprintf (buf, "%.*g", prec, 3.3); - if (strcmp (buf, "3") != 0) - printf ("got: '%s', expected: '%s'\n", buf, "3"); - prec = 0; - sprintf (buf, "%.*G", prec, 3.3); - if (strcmp (buf, "3") != 0) - printf ("got: '%s', expected: '%s'\n", buf, "3"); - prec = 0; - sprintf (buf, "%7.*G", prec, 3.33); - if (strcmp (buf, " 3") != 0) - printf ("got: '%s', expected: '%s'\n", buf, " 3"); - prec = 3; - sprintf (buf, "%04.*o", prec, 33); - if (strcmp (buf, " 041") != 0) - printf ("got: '%s', expected: '%s'\n", buf, " 041"); - prec = 7; - sprintf (buf, "%09.*u", prec, 33); - if (strcmp (buf, " 0000033") != 0) - printf ("got: '%s', expected: '%s'\n", buf, " 0000033"); - prec = 3; - sprintf (buf, "%04.*x", prec, 33); - if (strcmp (buf, " 021") != 0) - printf ("got: '%s', expected: '%s'\n", buf, " 021"); - prec = 3; - sprintf (buf, "%04.*X", prec, 33); - if (strcmp (buf, " 021") != 0) - printf ("got: '%s', expected: '%s'\n", buf, " 021"); -} diff --git a/reactos/apps/tests/test_old/tstdiomisc.c b/reactos/apps/tests/test_old/tstdiomisc.c deleted file mode 100644 index 1affac5b511..00000000000 --- a/reactos/apps/tests/test_old/tstdiomisc.c +++ /dev/null @@ -1,56 +0,0 @@ -#include - -int -t1 (void) -{ - int n = -1; - sscanf ("abc ", "abc %n", &n); - printf ("t1: count=%d\n", n); - - return n != 5; -} - -int -t2 (void) -{ - int result = 0; - int n; - long N; - int retval; -#define SCAN(INPUT, FORMAT, VAR, EXP_RES, EXP_VAL) \ - VAR = -1; \ - retval = sscanf (INPUT, FORMAT, &VAR); \ - printf ("sscanf (\"%s\", \"%s\", &x) => %d, x = %ld\n", \ - INPUT, FORMAT, retval, (long int) VAR); \ - result |= retval != EXP_RES || VAR != EXP_VAL - - SCAN ("12345", "%ld", N, 1, 12345); - SCAN ("12345", "%llllld", N, 0, -1); - SCAN ("12345", "%LLLLLd", N, 0, -1); - SCAN ("test ", "%*s%n", n, 0, 4); - SCAN ("test ", "%2*s%n", n, 0, -1); - SCAN ("12 ", "%l2d", n, 0, -1); - SCAN ("12 ", "%2ld", N, 1, 12); - - n = -1; - N = -1; - retval = sscanf ("1 1", "%d %Z", &n, &N); - printf ("sscanf (\"1 1\", \"%%d %%Z\", &n, &N) => %d, n = %d, N = %ld\n", \ - retval, n, N); \ - result |= retval != 1 || n != 1 || N != -1; - - return result; -} - -int -main (int argc, char *argv[]) -{ - int result = 0; - - result |= t1 (); - result |= t2 (); - - result |= fflush (stdout) == EOF; - - return result; -} diff --git a/reactos/apps/tests/tests/GetSysMetrics/.cvsignore b/reactos/apps/tests/tests/GetSysMetrics/.cvsignore deleted file mode 100644 index 7b5ccfa7a07..00000000000 --- a/reactos/apps/tests/tests/GetSysMetrics/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.sym -*.exe -*.dsp -*.dsw -*.map diff --git a/reactos/apps/tests/tests/GetSysMetrics/GetSysMetrics.c b/reactos/apps/tests/tests/GetSysMetrics/GetSysMetrics.c deleted file mode 100644 index 918dc7c044b..00000000000 --- a/reactos/apps/tests/tests/GetSysMetrics/GetSysMetrics.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Simple program to display the Windows System Metrics. - * - * This source code is in the PUBLIC DOMAIN and has NO WARRANTY. - * - * Robert Dickenson , July 11, 2002. - */ -#include -#include - - -int PASCAL WinMain (HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) -{ - fprintf(stderr,"Windows System Metric:\t Value\n"); - - fprintf(stderr," SM_ARRANGE:\t\t %d\n", GetSystemMetrics(SM_ARRANGE)); - fprintf(stderr," SM_CLEANBOOT:\t %d\n", GetSystemMetrics(SM_CLEANBOOT)); -// fprintf(stderr," SM_CMONITORS:\t %d\n", GetSystemMetrics(SM_CMONITORS)); - fprintf(stderr," SM_CMOUSEBUTTONS:\t %d\n", GetSystemMetrics(SM_CMOUSEBUTTONS)); - fprintf(stderr," SM_CXBORDER:\t %d\n", GetSystemMetrics(SM_CXBORDER)); - fprintf(stderr," SM_CYBORDER:\t %d\n", GetSystemMetrics(SM_CYBORDER)); - fprintf(stderr," SM_CXCURSOR:\t %d\n", GetSystemMetrics(SM_CXCURSOR)); - fprintf(stderr," SM_CYCURSOR:\t %d\n", GetSystemMetrics(SM_CYCURSOR)); - fprintf(stderr," SM_CXDLGFRAME:\t %d\n", GetSystemMetrics(SM_CXDLGFRAME)); - fprintf(stderr," SM_CYDLGFRAME:\t %d\n", GetSystemMetrics(SM_CYDLGFRAME)); - fprintf(stderr," SM_CXDOUBLECLK:\t %d\n", GetSystemMetrics(SM_CXDOUBLECLK)); - fprintf(stderr," SM_CYDOUBLECLK:\t %d\n", GetSystemMetrics(SM_CYDOUBLECLK)); - fprintf(stderr," SM_CXDRAG:\t\t %d\n", GetSystemMetrics(SM_CXDRAG)); - fprintf(stderr," SM_CYDRAG:\t\t %d\n", GetSystemMetrics(SM_CYDRAG)); - fprintf(stderr," SM_CXEDGE:\t\t %d\n", GetSystemMetrics(SM_CXEDGE)); - fprintf(stderr," SM_CYEDGE:\t\t %d\n", GetSystemMetrics(SM_CYEDGE)); - fprintf(stderr," SM_CXFIXEDFRAME:\t %d\n", GetSystemMetrics(SM_CXFIXEDFRAME)); - fprintf(stderr," SM_CYFIXEDFRAME:\t %d\n", GetSystemMetrics(SM_CYFIXEDFRAME)); - fprintf(stderr," SM_CXFRAME:\t\t %d\n", GetSystemMetrics(SM_CXFRAME)); - fprintf(stderr," SM_CYFRAME:\t\t %d\n", GetSystemMetrics(SM_CYFRAME)); - fprintf(stderr," SM_CXFULLSCREEN:\t %d\n", GetSystemMetrics(SM_CXFULLSCREEN)); - fprintf(stderr," SM_CYFULLSCREEN:\t %d\n", GetSystemMetrics(SM_CYFULLSCREEN)); - fprintf(stderr," SM_CXHSCROLL:\t %d\n", GetSystemMetrics(SM_CXHSCROLL)); - fprintf(stderr," SM_CYHSCROLL:\t %d\n", GetSystemMetrics(SM_CYHSCROLL)); - fprintf(stderr," SM_CXHTHUMB:\t %d\n", GetSystemMetrics(SM_CXHTHUMB)); - fprintf(stderr," SM_CXICON:\t\t %d\n", GetSystemMetrics(SM_CXICON)); - fprintf(stderr," SM_CYICON:\t\t %d\n", GetSystemMetrics(SM_CYICON)); - fprintf(stderr," SM_CXICONSPACING:\t %d\n", GetSystemMetrics(SM_CXICONSPACING)); - fprintf(stderr," SM_CYICONSPACING:\t %d\n", GetSystemMetrics(SM_CYICONSPACING)); - fprintf(stderr," SM_CXMAXIMIZED:\t %d\n", GetSystemMetrics(SM_CXMAXIMIZED)); - fprintf(stderr," SM_CYMAXIMIZED:\t %d\n", GetSystemMetrics(SM_CYMAXIMIZED)); - fprintf(stderr," SM_CXMAXTRACK:\t %d\n", GetSystemMetrics(SM_CXMAXTRACK)); - fprintf(stderr," SM_CYMAXTRACK:\t %d\n", GetSystemMetrics(SM_CYMAXTRACK)); - fprintf(stderr," SM_CXMENUCHECK:\t %d\n", GetSystemMetrics(SM_CXMENUCHECK)); - fprintf(stderr," SM_CYMENUCHECK:\t %d\n", GetSystemMetrics(SM_CYMENUCHECK)); - fprintf(stderr," SM_CXMENUSIZE:\t %d\n", GetSystemMetrics(SM_CXMENUSIZE)); - fprintf(stderr," SM_CYMENUSIZE:\t %d\n", GetSystemMetrics(SM_CYMENUSIZE)); - fprintf(stderr," SM_CXMIN:\t\t %d\n", GetSystemMetrics(SM_CXMIN)); - fprintf(stderr," SM_CYMIN:\t\t %d\n", GetSystemMetrics(SM_CYMIN)); - fprintf(stderr," SM_CXMINIMIZED:\t %d\n", GetSystemMetrics(SM_CXMINIMIZED)); - fprintf(stderr," SM_CYMINIMIZED:\t %d\n", GetSystemMetrics(SM_CYMINIMIZED)); - fprintf(stderr," SM_CXMINSPACING:\t %d\n", GetSystemMetrics(SM_CXMINSPACING)); - fprintf(stderr," SM_CYMINSPACING:\t %d\n", GetSystemMetrics(SM_CYMINSPACING)); - fprintf(stderr," SM_CXMINTRACK:\t %d\n", GetSystemMetrics(SM_CXMINTRACK)); - fprintf(stderr," SM_CYMINTRACK:\t %d\n", GetSystemMetrics(SM_CYMINTRACK)); - fprintf(stderr," SM_CXSCREEN:\t %d\n", GetSystemMetrics(SM_CXSCREEN)); - fprintf(stderr," SM_CYSCREEN:\t %d\n", GetSystemMetrics(SM_CYSCREEN)); - fprintf(stderr," SM_CXSIZE:\t\t %d\n", GetSystemMetrics(SM_CXSIZE)); - fprintf(stderr," SM_CYSIZE:\t\t %d\n", GetSystemMetrics(SM_CYSIZE)); - fprintf(stderr," SM_CXSIZEFRAME:\t %d\n", GetSystemMetrics(SM_CXSIZEFRAME)); - fprintf(stderr," SM_CYSIZEFRAME:\t %d\n", GetSystemMetrics(SM_CYSIZEFRAME)); - - fprintf(stderr," SM_CXSMICON:\t %d\n", GetSystemMetrics(SM_CXSMICON)); - fprintf(stderr," SM_CYSMICON:\t %d\n", GetSystemMetrics(SM_CYSMICON)); - fprintf(stderr," SM_CXSMSIZE:\t %d\n", GetSystemMetrics(SM_CXSMSIZE)); - fprintf(stderr," SM_CYSMSIZE:\t %d\n", GetSystemMetrics(SM_CYSMSIZE)); -// fprintf(stderr," SM_CXVIRTUALSCREEN:\t %d\n", GetSystemMetrics(SM_CXVIRTUALSCREEN)); -// fprintf(stderr," SM_CYVIRTUALSCREEN:\t %d\n", GetSystemMetrics(SM_CYVIRTUALSCREEN)); - fprintf(stderr," SM_CXVSCROLL:\t %d\n", GetSystemMetrics(SM_CXVSCROLL)); - fprintf(stderr," SM_CYVSCROLL:\t %d\n", GetSystemMetrics(SM_CYVSCROLL)); - fprintf(stderr," SM_CYCAPTION:\t %d\n", GetSystemMetrics(SM_CYCAPTION)); - fprintf(stderr," SM_CYKANJIWINDOW:\t %d\n", GetSystemMetrics(SM_CYKANJIWINDOW)); - fprintf(stderr," SM_CYMENU:\t\t %d\n", GetSystemMetrics(SM_CYMENU)); - fprintf(stderr," SM_CYSMCAPTION:\t %d\n", GetSystemMetrics(SM_CYSMCAPTION)); - fprintf(stderr," SM_CYVTHUMB:\t %d\n", GetSystemMetrics(SM_CYVTHUMB)); - fprintf(stderr," SM_DBCSENABLED:\t %d\n", GetSystemMetrics(SM_DBCSENABLED)); - fprintf(stderr," SM_DEBUG:\t\t %d\n", GetSystemMetrics(SM_DEBUG)); -// fprintf(stderr," SM_IMMENABLED:\t %d\n", GetSystemMetrics(SM_IMMENABLED)); - - fprintf(stderr," SM_MENUDROPALIGNMENT: %d\n", GetSystemMetrics(SM_MENUDROPALIGNMENT)); - fprintf(stderr," SM_MIDEASTENABLED:\t %d\n", GetSystemMetrics(SM_MIDEASTENABLED)); - fprintf(stderr," SM_MOUSEPRESENT:\t %d\n", GetSystemMetrics(SM_MOUSEPRESENT)); -#ifndef _MSC_VER - fprintf(stderr," SM_MOUSEWHEELPRESENT: %d\n", GetSystemMetrics(SM_MOUSEWHEELPRESENT)); -#endif - fprintf(stderr," SM_NETWORK:\t\t %d\n", GetSystemMetrics(SM_NETWORK)); - fprintf(stderr," SM_PENWINDOWS:\t %d\n", GetSystemMetrics(SM_PENWINDOWS)); -// fprintf(stderr," SM_REMOTESESSION:\t %d\n", GetSystemMetrics(SM_REMOTESESSION)); - fprintf(stderr," SM_SECURE:\t\t %d\n", GetSystemMetrics(SM_SECURE)); -// fprintf(stderr," SM_SAMEDISPLAYFORMAT: %d\n", GetSystemMetrics(SM_SAMEDISPLAYFORMAT)); - fprintf(stderr," SM_SHOWSOUNDS:\t %d\n", GetSystemMetrics(SM_SHOWSOUNDS)); - fprintf(stderr," SM_SLOWMACHINE:\t %d\n", GetSystemMetrics(SM_SLOWMACHINE)); - fprintf(stderr," SM_SWAPBUTTON:\t %d\n", GetSystemMetrics(SM_SWAPBUTTON)); -// fprintf(stderr," SM_XVIRTUALSCREEN: %d\n", GetSystemMetrics(SM_XVIRTUALSCREEN)); -// fprintf(stderr," SM_YVIRTUALSCREEN: %d\n", GetSystemMetrics(SM_YVIRTUALSCREEN)); - return 0; -} diff --git a/reactos/apps/tests/tests/GetSysMetrics/Makefile b/reactos/apps/tests/tests/GetSysMetrics/Makefile deleted file mode 100644 index 2607845594d..00000000000 --- a/reactos/apps/tests/tests/GetSysMetrics/Makefile +++ /dev/null @@ -1,22 +0,0 @@ - -PATH_TO_TOP = ../../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = GetSysMetrics - -TARGET_SDKLIBS = 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/tests/GetSystemInfo/.cvsignore b/reactos/apps/tests/tests/GetSystemInfo/.cvsignore deleted file mode 100644 index 2c287efaa24..00000000000 --- a/reactos/apps/tests/tests/GetSystemInfo/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -*.exe -*.o -*.sym -*.map diff --git a/reactos/apps/tests/tests/GetSystemInfo/GetSystemInfo.c b/reactos/apps/tests/tests/GetSystemInfo/GetSystemInfo.c deleted file mode 100644 index 0dc240852ae..00000000000 --- a/reactos/apps/tests/tests/GetSystemInfo/GetSystemInfo.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This example demonstrates dynamical loading of (internal) Win32 DLLS. - * I dont know why this was called hello5 in the wine tree - sedwards - */ -#include -#include - -int PASCAL WinMain (HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) -{ - SYSTEM_INFO si; - void CALLBACK (*fnGetSystemInfo)(LPSYSTEM_INFO si); - HMODULE kernel32; - - kernel32 = LoadLibrary("KERNEL32"); - if (kernel32 == NULL) { - fprintf(stderr,"FATAL: could not load KERNEL32!\n"); - return 0; - } - fnGetSystemInfo = (void*)GetProcAddress(kernel32,"GetSystemInfo"); - if (!fnGetSystemInfo) { - fprintf(stderr,"FATAL: could not find GetSystemInfo!\n"); - return 0; - } - fnGetSystemInfo(&si); - fprintf(stderr,"QuerySystemInfo returns:\n"); - fprintf(stderr," wProcessorArchitecture: %d\n",si.u.s.wProcessorArchitecture); - fprintf(stderr," dwPageSize: %ld\n",si.dwPageSize); - fprintf(stderr," lpMinimumApplicationAddress: %p\n",si.lpMinimumApplicationAddress); - fprintf(stderr," lpMaximumApplicationAddress: %p\n",si.lpMaximumApplicationAddress); - fprintf(stderr," dwActiveProcessorMask: %ld\n",si.dwActiveProcessorMask); - fprintf(stderr," dwNumberOfProcessors: %ld\n",si.dwNumberOfProcessors); - fprintf(stderr," dwProcessorType: %ld\n",si.dwProcessorType); - fprintf(stderr," dwAllocationGranularity: %ld\n",si.dwAllocationGranularity); - fprintf(stderr," wProcessorLevel: %d\n",si.wProcessorLevel); - fprintf(stderr," wProcessorRevision: %d\n",si.wProcessorRevision); - return 0; -} diff --git a/reactos/apps/tests/tests/GetSystemInfo/Makefile b/reactos/apps/tests/tests/GetSystemInfo/Makefile deleted file mode 100644 index c15d9e76f02..00000000000 --- a/reactos/apps/tests/tests/GetSystemInfo/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# -# -# -PATH_TO_TOP = ../../../.. - -PROGS = GetSystemInfo - -OBJECTS = GetSystemInfo.o - -LIBS = -CFLAGS = -Wall -Werror - -all: $(PROGS:%=%.exe) - -.phony: all - -clean: - - $(RM) *.o *.coff *.exe *.sym - -.phony: clean - -GetSystemInfo.exe: $(OBJECTS) - $(CC) $(CFLAGS) $(OBJECTS) $(LIBS) -o GetSystemInfo.exe - $(NM) --numeric-sort GetSystemInfo.exe > GetSystemInfo.sym - -include $(PATH_TO_TOP)/rules.mak diff --git a/reactos/apps/tests/tests/Mutex/.cvsignore b/reactos/apps/tests/tests/Mutex/.cvsignore deleted file mode 100644 index 365fbf117e9..00000000000 --- a/reactos/apps/tests/tests/Mutex/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -*.exe -*.sym -*.map diff --git a/reactos/apps/tests/tests/Mutex/Makefile b/reactos/apps/tests/tests/Mutex/Makefile deleted file mode 100644 index be53e579712..00000000000 --- a/reactos/apps/tests/tests/Mutex/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# 10-11-01 Steven Edwards -# Mutex Benchmarks from the Wineserver Linux Kernel Module -# - -PATH_TO_TOP = ../../../.. - -PROGS = fivemutex rapidmutex - -all: $(PROGS:%=%.exe) - -.phony: all - -clean: - - $(RM) *.o *.exe *.sym - -.phony: clean - -fivemutex.exe: fivemutex.c - $(CC) fivemutex.c -lkernel32 -o fivemutex.exe - $(NM) --numeric-sort fivemutex.exe > fivemutex.sym - -rapidmutex.exe: rapidmutex.c - $(CC) rapidmutex.c -lkernel32 -o rapidmutex.exe - $(NM) --numeric-sort rapidmutex.exe > rapidmutex.sym - -include $(PATH_TO_TOP)/rules.mak diff --git a/reactos/apps/tests/tests/Mutex/fivemutex.c b/reactos/apps/tests/tests/Mutex/fivemutex.c deleted file mode 100644 index cde45b7a01f..00000000000 --- a/reactos/apps/tests/tests/Mutex/fivemutex.c +++ /dev/null @@ -1,124 +0,0 @@ -/* fivemutex.c: hungry philosophers problem - * - * (c) Copyright D.W.Howells 2000. - * All rights reserved - */ -#include -#include -#include - -#define ERR(X,Y) do { if (X) { perror(""Y""); return 1; } } while(0) -#define RUNLENGTH 4 - -int count[5]; - -const char *names[] = { - "five/1", "five/2", "five/3", "five/4", "five/5" -}; - -DWORD WINAPI child(LPVOID tparam) -{ - HANDLE left, right, first, second; - const char *lname, *rname; - int pid = (int) tparam; - int wt; - - lname = names[pid%5]; - rname = names[(pid+1)%5]; - - /* create a mutex */ - left = CreateMutex(NULL,0,lname); ERR(!left,"create left"); - right = CreateMutex(NULL,0,rname); ERR(!left,"create right"); - - printf("[%d] left: %p [%s]\n",pid,left,lname); - printf("[%d] right: %p [%s]\n",pid,right,rname); - - /* pick the forks up in numerical order, else risk starvation */ - if (pid%5 < (pid+1)%5) { - first = left; - second = right; - } - else { - first = right; - second = left; - } - - for (;;) { - /* grab the left mutex */ - wt = WaitForMultipleObjects(1,&first,0,INFINITE); - if (wt!=WAIT_OBJECT_0) - goto wait_failed; - - /* grab the right mutex */ - wt = WaitForMultipleObjects(1,&second,0,INFINITE); - if (wt!=WAIT_OBJECT_0) - goto wait_failed; - - /* got it */ - count[pid]++; - - /* pass the mutexes */ - ERR(!ReleaseMutex(left),"release left"); - ERR(!ReleaseMutex(right),"release right"); - continue; - - wait_failed: - switch (wt) { - case WAIT_OBJECT_0+1: - printf("[%d] obtained mutex __1__\n",pid); - exit(1); - case WAIT_ABANDONED_0: - case WAIT_ABANDONED_0+1: - printf("[%d] abandoned wait\n",pid); - continue; - case WAIT_TIMEOUT: - printf("[%d] wait timed out\n",pid); - exit(1); - default: - ERR(1,"WaitForMultipleObjects"); - } - - return 1; - } - - /* close the handles */ - ERR(!CloseHandle(left),"close left"); - ERR(!CloseHandle(right),"close right"); - - return 0; - -} - -int main() -{ - HANDLE hThread[5]; - DWORD tid; - int loop; - - for (loop=0; loop<5; loop++) { - - hThread[loop] = CreateThread(NULL, /* thread attributes */ - 0, /* stack size */ - child, /* start address */ - (void*)loop, /* parameter */ - 0, /* creation flags */ - &tid /* thread ID */ - ); - if (!hThread[loop]) - { - ERR(1,"CreateThread"); - } - } - - WaitForMultipleObjects(5,hThread,0,RUNLENGTH*1000); - - for (loop=0; loop<5; loop++) - TerminateThread(hThread[loop],0); - - for (loop=0; loop<5; loop++) - printf("[%d] ate %d times (%d times per second)\n", - loop,count[loop],count[loop]/RUNLENGTH - ); - - return 0; -} diff --git a/reactos/apps/tests/tests/Mutex/rapidmutex.c b/reactos/apps/tests/tests/Mutex/rapidmutex.c deleted file mode 100644 index 57969966ff7..00000000000 --- a/reactos/apps/tests/tests/Mutex/rapidmutex.c +++ /dev/null @@ -1,89 +0,0 @@ -/* rapidmutex.c: rapid mutex passing test client [Win32 threaded] - * - * (c) Copyright D.W.Howells 2000. - * All rights reserved - */ -#include -#include -#include - -#define ERR(X,Y) do { if (X) { perror(Y); return 1; } } while(0) -#define RUNLENGTH 4 - -int count[5]; - -DWORD WINAPI child(LPVOID tparam) -{ - HANDLE mymutex; - int pid = (int) tparam; - - /* create a mutex */ - mymutex = CreateMutex(NULL,0,"wibble"); - ERR(!mymutex,"create mutex"); - printf("[%d] Handle: %p\n",pid,mymutex); - - for (;;) { - /* grab the mutex */ - switch (WaitForMultipleObjects(1,&mymutex,0,INFINITE)) - { - case WAIT_OBJECT_0: - /* got it */ - count[pid]++; - - /* pass the mutex */ - ERR(!ReleaseMutex(mymutex),"release mutex"); - break; - - case WAIT_OBJECT_0+1: - printf("[%d] obtained mutex __1__\n",pid); - exit(0); - case WAIT_ABANDONED_0: - case WAIT_ABANDONED_0+1: - printf("[%d] abandoned wait\n",pid); - exit(0); - case WAIT_TIMEOUT: - printf("[%d] wait timed out\n",pid); - exit(0); - default: - ERR(1,"WaitForMultipleObjects"); - } - } - - return 0; -} - -int main() -{ - HANDLE hThread[5]; - DWORD tid; - int loop; - - for (loop=0; loop<5; loop++) { - - hThread[loop] = - CreateThread(NULL, /* thread attributes */ - 0, /* stack size */ - child, /* start address */ - (void*)loop, /* parameter */ - 0, /* creation flags */ - &tid /* thread ID */ - ); - if (!hThread[loop]) - { - ERR(1,"CreateThread"); - } - } - - WaitForMultipleObjects(5,hThread,0,RUNLENGTH*1000); - - for (loop=0; loop<5; loop++) - TerminateThread(hThread[loop],0); - - for (loop=0; loop<5; loop++) - printf("[%d] obtained the mutex %d times" - " (%d times per second)\n", - loop,count[loop],count[loop]/RUNLENGTH - ); - - return 0; -} diff --git a/reactos/apps/tests/tests/Parent_Child/.cvsignore b/reactos/apps/tests/tests/Parent_Child/.cvsignore deleted file mode 100644 index 50e015af324..00000000000 --- a/reactos/apps/tests/tests/Parent_Child/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -*.sym -*.exe -*.o -*.map diff --git a/reactos/apps/tests/tests/Parent_Child/Makefile b/reactos/apps/tests/tests/Parent_Child/Makefile deleted file mode 100644 index 1dbcbeb058f..00000000000 --- a/reactos/apps/tests/tests/Parent_Child/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# -# -# -PATH_TO_TOP = ../../../.. - -PROGS = Parent_Child - -OBJECTS = Parent_Child.o - -LIBS = $(PATH_TO_TOP)/dk/w32/lib/gdi32.a -CFLAGS = -Wall -Werror - -all: $(PROGS:%=%.exe) - -.phony: all - -clean: - - $(RM) *.o *.coff *.exe *.sym - -.phony: clean - -Parent_Child.exe: $(OBJECTS) - $(CC) $(CFLAGS) -Wl,--subsystem,windows $(OBJECTS) $(LIBS) -o Parent_Child.exe - $(NM) --numeric-sort Parent_Child.exe > Parent_Child.sym - -include $(PATH_TO_TOP)/rules.mak diff --git a/reactos/apps/tests/tests/Parent_Child/Parent_Child.c b/reactos/apps/tests/tests/Parent_Child/Parent_Child.c deleted file mode 100644 index bf9ab719cb3..00000000000 --- a/reactos/apps/tests/tests/Parent_Child/Parent_Child.c +++ /dev/null @@ -1,152 +0,0 @@ -#include -#include -#include -/* Win32 counterpart for CalcChildScroll16 is not implemented */ -/* even in MS Visual C++ */ -// #include "windef.h" -// #include "wingdi.h" -/*#include */ - -void Write (HDC dc, int x, int y, char *s) -{ - SetBkMode(dc, TRANSPARENT); - TextOut (dc, x, y, s, strlen (s)); -} - -LRESULT CALLBACK WndProc (HWND wnd, UINT msg, WPARAM w, LPARAM l) -{ - static short xChar, yChar; - static RECT rectHola; - static char* strHola = "Hola"; - HDC dc; - PAINTSTRUCT ps; - TEXTMETRIC tm; - - switch (msg){ - case WM_CREATE: - dc = GetDC (wnd); - GetTextMetrics (dc, &tm); - xChar = tm.tmAveCharWidth; - yChar = tm.tmHeight; - GetTextExtentPoint32( dc, strHola, strlen(strHola), ((LPSIZE)&rectHola) + 1 ); - OffsetRect( &rectHola, xChar, yChar ); - ReleaseDC (wnd, dc); - break; - - case WM_HSCROLL: - case WM_VSCROLL: - InvalidateRect(wnd, &rectHola, TRUE ); -// ScrollChildren(wnd, msg, w, l); - return 0; - - case WM_PAINT: - dc = BeginPaint (wnd, &ps); - Write (dc, xChar, yChar, strHola); - EndPaint (wnd, &ps); - break; - - case WM_DESTROY: - PostQuitMessage (0); - break; - - default: - return DefWindowProc (wnd, msg, w, l); - } - return 0l; -} - -LRESULT CALLBACK WndProc2 (HWND wnd, UINT msg, WPARAM w, LPARAM l) -{ - static short xChar, yChar; - static RECT rectInfo; - char buf[128]; - HDC dc; - PAINTSTRUCT ps; - TEXTMETRIC tm; - - switch (msg){ - case WM_CREATE: - dc = GetDC (wnd); - GetTextMetrics (dc, &tm); - xChar = tm.tmAveCharWidth; - yChar = tm.tmHeight; - ReleaseDC (wnd, dc); - break; - - case WM_PAINT: - dc = BeginPaint (wnd, &ps); - sprintf(buf,"ps.rcPaint = {left = %lu, top = %lu, right = %lu, bottom = %lu}", - ps.rcPaint.left,ps.rcPaint.top,ps.rcPaint.right,ps.rcPaint.bottom); - rectInfo.left = rectInfo.top = 0; - GetTextExtentPoint32 (dc, buf, strlen(buf), ((LPSIZE)&rectInfo) + 1 ); - OffsetRect (&rectInfo, xChar, yChar ); - Write (dc, xChar, yChar, buf); - EndPaint (wnd, &ps); - break; - - case WM_MOVE: - case WM_SIZE: - InvalidateRect( wnd, &rectInfo, TRUE ); - /*CalcChildScroll16( (UINT16)GetParent(wnd), SB_BOTH );*/ - break; - - case WM_DESTROY: - PostQuitMessage (0); - break; - - default: - return DefWindowProc (wnd, msg, w, l); - } - return 0l; -} - -int PASCAL WinMain (HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) -{ - HWND wnd,wnd2; - MSG msg; - WNDCLASS class; - char className[] = "class"; /* To make sure className >= 0x10000 */ - char class2Name[] = "class2"; - char winName[] = "Test app"; - - if (!prev){ - class.style = CS_HREDRAW | CS_VREDRAW; - class.lpfnWndProc = WndProc; - class.cbClsExtra = 0; - class.cbWndExtra = 0; - class.hInstance = inst; - class.hIcon = LoadIcon (0, MAKEINTRESOURCE(IDI_APPLICATION)); - class.hCursor = LoadCursor (0, MAKEINTRESOURCE(IDC_ARROW)); - class.hbrBackground = GetStockObject (WHITE_BRUSH); - class.lpszMenuName = NULL; - class.lpszClassName = className; - if (!RegisterClass (&class)) - return FALSE; - } - - wnd = CreateWindow (className, winName, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL, - CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0, - 0, inst, 0); - - if (!prev){ - class.lpfnWndProc = WndProc2; - class.lpszClassName = class2Name; - class.hbrBackground = GetStockObject(GRAY_BRUSH); - if (!RegisterClass (&class)) - return FALSE; - } - - wnd2= CreateWindow (class2Name,"Child window", WS_CAPTION | WS_CHILD | WS_THICKFRAME, - 50, 50, 350, 100, wnd, 0, inst, 0); - - ShowWindow (wnd, show); - UpdateWindow (wnd); - ShowWindow (wnd2, show); - UpdateWindow (wnd2); - - while (GetMessage (&msg, 0, 0, 0)){ - TranslateMessage (&msg); - DispatchMessage (&msg); - } - return 0; -} diff --git a/reactos/apps/tests/tests/guitest/.cvsignore b/reactos/apps/tests/tests/guitest/.cvsignore deleted file mode 100644 index 2c287efaa24..00000000000 --- a/reactos/apps/tests/tests/guitest/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -*.exe -*.o -*.sym -*.map diff --git a/reactos/apps/tests/tests/guitest/Makefile b/reactos/apps/tests/tests/guitest/Makefile deleted file mode 100644 index b5927381b88..00000000000 --- a/reactos/apps/tests/tests/guitest/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -# -# -# -PATH_TO_TOP = ../../../.. - -PROGS = guitest - -OBJECTS = guitest.o - -LIBS = $(PATH_TO_TOP)/dk/w32/lib/gdi32.a -CFLAGS = -Wall -Werror - -all: $(PROGS:%=%.exe) - -.phony: all - -clean: - - $(RM) *.o *.exe *.sym - -.phony: clean - -install: $(PROGS:%=$(FLOPPY_DIR)/apps/tests/%.exe) - -$(PROGS:%=$(FLOPPY_DIR)/apps/tests/%.exe): $(FLOPPY_DIR)/apps/tests/%.exe: %.exe - $(CP) $*.exe $(FLOPPY_DIR)/apps/$*.exe - -guitest.exe: $(OBJECTS) - $(CC) $(CFLAGS) -Wl,--subsystem,windows $(OBJECTS) $(LIBS) -o guitest.exe - $(NM) --numeric-sort guitest.exe > guitest.sym - -include $(PATH_TO_TOP)/rules.mak diff --git a/reactos/apps/tests/tests/guitest/guitest.c b/reactos/apps/tests/tests/guitest/guitest.c deleted file mode 100644 index 6fec85d5180..00000000000 --- a/reactos/apps/tests/tests/guitest/guitest.c +++ /dev/null @@ -1,747 +0,0 @@ -/* Windows GUI Behaviour Tester */ -/* by Ove Kåven */ - -#include -#include -#include -#include - -#include "guitest.rc" - -/* checks to include */ -#define LOGGING /* can be undefined under Wine and use -debugmsg +message instead */ -#define MAIN_STYLE WS_OVERLAPPEDWINDOW|WS_HSCROLL -#define MAIN_EXSTYLE 0 -#undef TEST_DESTROY_MAIN -#define SHOW_SUB -#undef TEST_DIALOG -#define RESIZE_DIALOG -#undef TEST_SUBDIALOG -#undef TEST_COMMCTL - -/************************/ -/*** GLOBAL VARIABLES ***/ -/************************/ - -HINSTANCE hInst; -DWORD StartTime; -HWND hListBox,hMainWnd,hSubWnd; -HWND hButton[4]={0,0,0,0}; -HWND hDialog=0,hGroup=0,hSubDlg=0; -WNDPROC wndButton[4],wndDialog,wndGroup,wndSubDlg; -BOOL Clicked=0,Ready=0; -int State=0,Rec=0; -#define STATE_CREATE 0 -#define STATE_DESTROY 1 -#define STATE_SHOW 2 -#define STATE_UPDATE 3 -#define STATE_DIALOG 4 -#define STATE_TEST 5 -#define STATE_DIRECT 6 -#define STATE_DISPATCH 7 -#define STATE_RECURS 8 -char*StateName[]={ - "Creat", - "Destr", - "Show ", - "Updat", - "Dialg", - "Test ", - "Call ", - "Disp ", - "RCall" -}; - -static char wclassname[] = "GUITestClass"; -static char wcclassname[] = "GUITestChildClass"; -static char winname[] = "GUITest"; - -/**************************/ -/*** LOGGING FACILITIES ***/ -/**************************/ - -struct MSGNAMES { - int msg; - char*name; -} MsgNames[]={ -#define MSG(x) {x,#x}, -#define MSG2(x,y) {y,#x}, -#define ENDMSG {0} - -/* we get these in CreateWindow */ -MSG(WM_GETMINMAXINFO) -MSG(WM_NCCREATE) -MSG(WM_NCCALCSIZE) -MSG(WM_CREATE) -MSG(WM_PARENTNOTIFY) - -/* we get these in ShowWindow */ -MSG(WM_SHOWWINDOW) -MSG(WM_WINDOWPOSCHANGING) -MSG(WM_QUERYNEWPALETTE) -MSG(WM_ACTIVATEAPP) -MSG(WM_NCACTIVATE) -MSG(WM_GETTEXT) -MSG(WM_ACTIVATE) -MSG(WM_SETFOCUS) -MSG(WM_NCPAINT) -MSG(WM_ERASEBKGND) -MSG(WM_WINDOWPOSCHANGED) -MSG(WM_SIZE) -MSG(WM_MOVE) - -/* we get these in DestroyWindow */ -MSG(WM_KILLFOCUS) -MSG(WM_DESTROY) -MSG(WM_NCDESTROY) - -/* we get these directly sent */ -MSG(WM_NCHITTEST) -MSG(WM_SETCURSOR) -MSG(WM_MOUSEACTIVATE) -MSG(WM_CHILDACTIVATE) -MSG(WM_COMMAND) -MSG(WM_SYSCOMMAND) - -/* posted events */ -MSG(WM_MOUSEMOVE) -MSG(WM_NCMOUSEMOVE) -MSG(WM_PAINT) -MSG(WM_LBUTTONDOWN) -MSG(WM_LBUTTONUP) -MSG(WM_LBUTTONDBLCLK) -MSG(WM_NCLBUTTONDOWN) -MSG(WM_NCLBUTTONUP) -MSG(WM_NCLBUTTONDBLCLK) - -MSG(WM_KEYDOWN) -MSG(WM_KEYUP) -MSG(WM_CHAR) - -#ifdef WIN32 -MSG(WM_CTLCOLORBTN) -MSG(WM_CTLCOLORDLG) -MSG(WM_CTLCOLORSTATIC) -#else -MSG(WM_CTLCOLOR) -#endif - -/* moving and sizing */ -MSG2(WM_ENTERSIZEMOVE,0x0231) -MSG2(WM_EXITSIZEMOVE,0x0232) -#ifdef WIN32 -MSG(WM_SIZING) -#endif - -/* menus/dialog boxes */ -MSG(WM_CANCELMODE) -MSG(WM_ENABLE) -MSG(WM_SETFONT) -MSG(WM_INITDIALOG) -MSG(WM_GETDLGCODE) -MSG(WM_ENTERIDLE) - -/* scroll bars */ -MSG(WM_HSCROLL) -MSG(WM_VSCROLL) - -/* getting these from Wine but not from Windows */ -MSG2(WM_SETVISIBLE,0x0009) /* unheard of in BC++ 4.52 */ -#ifdef WIN32 -MSG(WM_CAPTURECHANGED) -#endif - -ENDMSG}; - -struct MSGNAMES ButMsgs[]={ -MSG(BM_SETSTATE) -MSG(BM_SETSTYLE) - -ENDMSG}; - -char*MsgName(UINT msg,HWND hWnd) -{ - int i; - static char buffer[64],wclass[64]; - GetClassName(hWnd,wclass,sizeof(wclass)); - -#define MSGSEARCH(msgs) { \ - for (i=0; msgs[i].name&&msgs[i].msg!=msg; i++); \ - if (msgs[i].name) return msgs[i].name; \ - } - - if (!stricmp(wclass,"Button")) MSGSEARCH(ButMsgs); - MSGSEARCH(MsgNames); - /* WM_USER */ - if (msg>=WM_USER) { - sprintf(buffer,"WM_USER+%04x{%s}",msg-WM_USER,wclass); - return buffer; - } - /* message not found */ - sprintf(buffer,"%04x{%s}",msg,wclass); - return buffer; -} - -char*WndName(HWND hWnd,int state) -{ - static char buffer[16]; - if (!hWnd) return "0000"; - if (hWnd==hMainWnd || (state==STATE_CREATE && !hMainWnd)) return "main"; - if (hWnd==hSubWnd || (state==STATE_CREATE && !hSubWnd)) return "chld"; - if (hWnd==hDialog || (state==STATE_DIALOG && !hDialog)) return "tdlg"; - if (hWnd==hGroup) return "tgrp"; - if (hWnd==hButton[0]) return "but1"; - if (hWnd==hButton[1]) return "but2"; - if (hWnd==hButton[2]) return "but3"; - if (hWnd==hButton[3]) return "but4"; - if (hWnd==hSubDlg || (state==STATE_CREATE && !hSubDlg)) return "sdlg"; - if (hDialog) { - int id=GetDlgCtrlID(hWnd); - if (id) { - sprintf(buffer,"dlgitem(%d)",id); - return buffer; - } - } - sprintf(buffer,"%p",hWnd); - return buffer; -} - -void Log(const char*fmt) -{ -#ifdef LOGGING - if (!Clicked) SendMessage(hListBox,LB_ADDSTRING,0,(LPARAM)fmt); -#endif -} - -void Logf(const char*fmt,...) -{ - va_list par; - static char buffer[256]; - - va_start(par,fmt); - vsprintf(buffer,fmt,par); - va_end(par); - Log(buffer); -} - -void LogChildOrder(HWND hWnd) -{ - HWND hWndChild = GetWindow(hWnd,GW_CHILD); - static char buffer[256]; - - strcpy(buffer,"child list:"); - while (hWndChild) { - strcat(strcat(buffer," "),WndName(hWndChild,State)); - hWndChild=GetWindow(hWndChild,GW_HWNDNEXT); - } - Log(buffer); -} - -void LogMessage(int state,HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam,char*name) -{ - static char buffer[256]; - DWORD tick=GetTickCount()-StartTime; - char*msgname=MsgName(msg,hWnd); - if (!name) name=WndName(hWnd,state); - switch (msg) { - case WM_SETFOCUS: - case WM_KILLFOCUS: - case WM_SETCURSOR: - Logf("%04d[%s(%d):%s]%s(%s,%08x)",tick,StateName[state],Rec, - name,msgname,WndName((HWND)wParam,State),lParam); - break; -#ifdef WIN32 - case WM_ENTERIDLE: - case WM_CTLCOLORBTN: - case WM_CTLCOLORDLG: - Logf("%04d[%s(%d):%s]%s(%08x,%s)",tick,StateName[state],Rec, - name,msgname,wParam,WndName((HWND)lParam,State)); - break; -#else - case WM_ENTERIDLE: - case WM_CTLCOLOR: - Logf("%04d[%s(%d):%s]%s(%08x,%04x:%s)",tick,StateName[state],Rec, - name,msgname,wParam,HIWORD(lParam),WndName((HWND)LOWORD(lParam),State)); - break; -#endif - case WM_WINDOWPOSCHANGING: - case WM_WINDOWPOSCHANGED: - { - WINDOWPOS*pos=(WINDOWPOS*)lParam; -#ifdef WIN32 - Logf("%04d[%s(%d):%s]%s(%08x,%p)",tick,StateName[state],Rec, - name,msgname,wParam,pos); -#else - Logf("%04d[%s(%d):%s]%s(%04x,%p)",tick,StateName[state],Rec, - name,msgname,wParam,pos); -#endif - strcpy(buffer,"FLAGS:"); - if (pos->flags&SWP_DRAWFRAME) strcat(buffer," DRAWFRAME"); - if (pos->flags&SWP_HIDEWINDOW) strcat(buffer," HIDEWINDOW"); - if (pos->flags&SWP_NOACTIVATE) strcat(buffer," NOACTIVATE"); - if (pos->flags&SWP_NOCOPYBITS) strcat(buffer," NOCOPYBITS"); - if (pos->flags&SWP_NOMOVE) strcat(buffer," NOMOVE"); - if (pos->flags&SWP_NOOWNERZORDER) strcat(buffer," NOOWNERZORDER"); - if (pos->flags&SWP_NOSIZE) strcat(buffer," NOSIZE"); - if (pos->flags&SWP_NOREDRAW) strcat(buffer," NOREDRAW"); - if (pos->flags&SWP_NOZORDER) strcat(buffer," NOZORDER"); - if (pos->flags&SWP_SHOWWINDOW) strcat(buffer," SHOWWINDOW"); - Log(buffer); - } - break; - case WM_SYSCOMMAND: - { - char*cmd=NULL; - switch (wParam&0xFFF0) { -#define CASE(x) case SC_##x: cmd=#x; break; - CASE(CLOSE) - CASE(DEFAULT) - CASE(HOTKEY) - CASE(HSCROLL) - CASE(KEYMENU) - CASE(MAXIMIZE) - CASE(MINIMIZE) - CASE(MOUSEMENU) - CASE(MOVE) - CASE(NEXTWINDOW) - CASE(PREVWINDOW) - CASE(RESTORE) - CASE(SCREENSAVE) - CASE(SIZE) - CASE(TASKLIST) - CASE(VSCROLL) -#undef CASE - } - if (cmd) { - Logf("%04d[%s(%d):%s]%s(%s+%x,%08x)",tick,StateName[state],Rec, - name,msgname,cmd,wParam&0xF,lParam); - } else goto GENERIC_MSG; - } - break; - case WM_HSCROLL: - case WM_VSCROLL: - { - char*cmd=NULL; - switch (LOWORD(wParam)) { -#define CASE(x) case SB_##x: cmd=#x; break; -#define CASE2(h,v) case SB_##h: if (msg==WM_HSCROLL) cmd=#h; else cmd=#v; break; - CASE(BOTTOM) - CASE(ENDSCROLL) - CASE2(LINELEFT,LINEUP) - CASE2(LINERIGHT,LINEDOWN) - CASE2(PAGELEFT,PAGEUP) - CASE2(PAGERIGHT,PAGEDOWN) - CASE(THUMBPOSITION) - CASE(THUMBTRACK) - CASE(TOP) -#undef CASE - } - if (cmd) { -#ifdef WIN32 - Logf("%04d[%s(%d):%s]%s(%s,%04x,%s)",tick,StateName[state],Rec, - name,msgname,cmd,HIWORD(wParam),WndName((HWND)lParam,State)); -#else - Logf("%04d[%s(%d):%s]%s(%04x,%04x,%s)",tick,StateName[state],Rec, - name,msgname,cmd,LOWORD(lParam),WndName((HWND)HIWORD(lParam),State)); -#endif - } else goto GENERIC_MSG; - } - break; - default: -GENERIC_MSG: -#ifdef WIN32 - Logf("%04d[%s(%d):%s]%s(%08x,%08x)",tick,StateName[state],Rec, - name,msgname,wParam,lParam); -#else - Logf("%04d[%s(%d):%s]%s(%04x,%08x)",tick,StateName[state],Rec, - name,msgname,wParam,lParam); -#endif - } -} - -/***************************/ -/*** GRAPHICS FACILITIES ***/ -/***************************/ - -void Paint(HWND hWnd) -{ - HDC dc; - PAINTSTRUCT ps; - dc=BeginPaint(hWnd,&ps); - EndPaint(hWnd,&ps); -} - -void FillPattern(HWND hWnd,HDC pdc) -{ - HDC dc=pdc?pdc:GetDC(hWnd); - HBRUSH oldbrush; - RECT rect; - if (!dc) { - Logf("failed to acquire DC for window %s",WndName(hWnd,State)); - return; - } else { - Logf("acquired DC for %s window %s, painting", - IsWindowVisible(hWnd)?"visible":"invisible",WndName(hWnd,State)); - } - GetClientRect(hWnd,&rect); - oldbrush=SelectObject(dc,GetStockObject(LTGRAY_BRUSH)); - PatBlt(dc,0,0,rect.right,rect.bottom,PATCOPY); - SelectObject(dc,oldbrush); - if (!pdc) ReleaseDC(hWnd,dc); -} - -void PaintPattern(HWND hWnd) -{ - HDC dc; - PAINTSTRUCT ps; - dc=BeginPaint(hWnd,&ps); - FillPattern(hWnd,dc); - EndPaint(hWnd,&ps); -} - -/*************************/ -/*** WINDOW PROCEDURES ***/ -/*************************/ - -/* MAIN WINDOW */ -LRESULT FAR CALLBACK _export MainWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - LRESULT lResult=0; - RECT rect; - int OldState=State; - - State=STATE_RECURS; Rec++; - if (!Clicked) LogMessage(OldState,hWnd,msg,wParam,lParam,NULL); - switch (msg) { - case WM_NCHITTEST: - lResult=DefWindowProc(hWnd,msg,wParam,lParam); - break; - case WM_LBUTTONDOWN: - case WM_CHAR: - if (!Clicked) { - SetParent(hListBox,hWnd); - GetClientRect(hWnd,&rect); - MoveWindow(hListBox,0,0,rect.right,rect.bottom,TRUE); - ShowWindow(hListBox,SW_SHOW); - SetFocus(hListBox); - Clicked=TRUE; - } - break; - case WM_SIZE: - GetClientRect(hWnd,&rect); - if (Clicked) { - MoveWindow(hListBox,0,0,rect.right,rect.bottom,TRUE); - } - MoveWindow(hSubWnd,0,rect.bottom/2,rect.right,rect.bottom-(rect.bottom/2),TRUE); - break; - case WM_PAINT: - Paint(hWnd); - break; - case WM_DESTROY: - PostQuitMessage(0); - break; - default: - lResult=DefWindowProc(hWnd,msg,wParam,lParam); - } - State=OldState; Rec--; - return lResult; -} - -/* CHILD WINDOW */ -LRESULT FAR CALLBACK _export SubWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - LRESULT lResult=0; - int OldState=State; - - State=STATE_RECURS; Rec++; - if (!Clicked) LogMessage(OldState,hWnd,msg,wParam,lParam,NULL); - switch (msg) { - case WM_PAINT: - Paint(hWnd); - break; - default: - lResult=DefWindowProc(hWnd,msg,wParam,lParam); - } - State=OldState; Rec--; - return lResult; -} - -BOOL FAR CALLBACK _export SubDialogProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam); - -/* SUBCLASSED CONTROLS */ -LRESULT FAR CALLBACK _export SubClassWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - LRESULT lResult=0; - RECT rect; - int OldState=State; - int But=-1; - - if (hWnd==hButton[0]) But=0; else - if (hWnd==hButton[1]) But=1; else - if (hWnd==hButton[2]) But=2; else - if (hWnd==hButton[3]) But=3; - - State=STATE_RECURS; Rec++; - if (!Clicked) { - LogMessage(OldState,hWnd,msg,wParam,lParam,NULL); - if (But!=-1) { - lResult=CallWindowProc(wndButton[But],hWnd,msg,wParam,lParam); - if (msg==WM_LBUTTONUP) { - LogChildOrder(GetParent(hWnd)); - } - } - else if (hWnd==hDialog) { - lResult=CallWindowProc(wndDialog,hWnd,msg,wParam,lParam); - } - else if (hWnd==hSubDlg) { - lResult=CallWindowProc(wndSubDlg,hWnd,msg,wParam,lParam); - } - else if (hWnd==hGroup) { - lResult=CallWindowProc(wndGroup,hWnd,msg,wParam,lParam); - if (msg==WM_SETFOCUS) { - /* create subdialog */ - if (hSubDlg) { -#if 0 - SetRect(&rect,0,0,1,1); - InvalidateRect(hWnd,&rect,FALSE); -#endif - } else { -#ifdef TEST_SUBDIALOG - State=STATE_CREATE; - hSubDlg=CreateDialog(hInst,MAKEINTRESOURCE(2),hWnd,(FARPROC)SubDialogProc); - State=STATE_RECURS; -#else -#ifdef RESIZE_DIALOG - GetWindowRect(GetParent(hWnd),&rect); - rect.right++; - SetWindowPos(GetParent(hWnd),0,0,0, - rect.right-rect.left,rect.bottom-rect.top, - SWP_NOMOVE|SWP_NOZORDER); -#endif -#endif - } - } - } - } - State=OldState; Rec--; - return lResult; -} - -/* MAIN DIALOG PROCEDURE */ -BOOL FAR CALLBACK _export TestDialogProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - BOOL bResult=0; - RECT rect; - int OldState=State; - - State=STATE_RECURS; Rec++; - if (!Clicked) LogMessage(OldState,hWndDlg,msg,wParam,lParam,"dlgp"); - switch (msg) { - case WM_INITDIALOG: - hDialog = hWndDlg; - /* subclass dialog window proc */ - wndDialog = (WNDPROC)SetWindowLong(hDialog,GWL_WNDPROC,(LONG)SubClassWindowProc); - Logf("dialog visible=%s",IsWindowVisible(hWndDlg)?"TRUE":"FALSE"); - /* subclass OK button */ - hButton[3] = GetDlgItem(hWndDlg,IDOK); - wndButton[3] = (WNDPROC)SetWindowLong(hButton[3],GWL_WNDPROC,(LONG)SubClassWindowProc); - /* subclass group box */ - hGroup = GetDlgItem(hWndDlg,IDC_GROUPBOX1); - wndGroup = (WNDPROC)SetWindowLong(hGroup,GWL_WNDPROC,(LONG)SubClassWindowProc); - -#ifdef RESIZE_DIALOG - GetWindowRect(hWndDlg,&rect); - rect.right--; - SetWindowPos(hWndDlg,0,0,0, - rect.right-rect.left,rect.bottom-rect.top, - SWP_NOMOVE|SWP_NOZORDER); -// ShowWindow(GetDlgItem(hWndDlg,IDCANCEL),SW_HIDE); -#endif - - bResult=TRUE; /* we don't do SetFocus */ - break; - case WM_PAINT: - PaintPattern(hWndDlg); - bResult=TRUE; - break; - case WM_COMMAND: - EndDialog(hWndDlg,LOWORD(wParam)); - bResult=TRUE; - break; - case WM_CLOSE: - EndDialog(hWndDlg,IDCANCEL); - bResult=TRUE; - break; - case WM_NCDESTROY: - hDialog = 0; - break; - } - State=OldState; Rec--; - return bResult; -} - -/* SUBDIALOG PROCEDURE */ -BOOL FAR CALLBACK _export SubDialogProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - BOOL bResult=0; - int OldState=State; - - State=STATE_RECURS; Rec++; - if (!Clicked) LogMessage(OldState,hWndDlg,msg,wParam,lParam,NULL); - switch (msg) { - case WM_INITDIALOG: - hSubDlg = hWndDlg; - /* subclass dialog window proc */ - wndSubDlg = (WNDPROC)SetWindowLong(hDialog,GWL_WNDPROC,(LONG)SubClassWindowProc); - - bResult=TRUE; /* we don't do SetFocus */ - break; - case WM_NCDESTROY: - hSubDlg = 0; - break; - } - State=OldState; Rec--; - return bResult; -} - -/********************/ -/*** MAIN PROGRAM ***/ -/********************/ - -BOOL AppInit(void) -{ - WNDCLASS wclass; - - wclass.style = CS_HREDRAW|CS_VREDRAW; - wclass.lpfnWndProc = MainWindowProc; - wclass.cbClsExtra = 0; - wclass.cbWndExtra = 0; - wclass.hInstance = hInst; - wclass.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(1)); - wclass.hCursor = LoadCursor(0, MAKEINTRESOURCE(IDC_ARROW)); - wclass.hbrBackground = GetStockObject(WHITE_BRUSH); - wclass.lpszMenuName = NULL; - wclass.lpszClassName = wclassname; - if (!RegisterClass(&wclass)) return FALSE; - wclass.lpfnWndProc = SubWindowProc; - wclass.lpszClassName = wcclassname; - if (!RegisterClass(&wclass)) return FALSE; - return TRUE; -} - -int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, - LPSTR lpszCmdLine, int nCmdShow) -{ - MSG msg; - RECT rect; - - hInst = hInstance; - if (!hPrevInstance) - if (!AppInit()) - return 0; - - StartTime=GetTickCount(); - hListBox = CreateWindow("LISTBOX","Messages",WS_BORDER|WS_VSCROLL|WS_CHILD| - LBS_HASSTRINGS|LBS_NOTIFY|LBS_WANTKEYBOARDINPUT, - 0,0,0,0,GetDesktopWindow(),0,hInst,0); - if (!hListBox) { - MessageBox(0,"Could not create list box","Error",MB_OK); - } - - State=STATE_CREATE; - hMainWnd = CreateWindowEx(MAIN_EXSTYLE,wclassname,winname,MAIN_STYLE, - CW_USEDEFAULT,0,400,300,0,0,hInst,0); - if (!hMainWnd) return 0; - State=STATE_SHOW; - ShowWindow(hMainWnd,nCmdShow); -#ifdef TEST_DESTROY_MAIN - State=STATE_DESTROY; - DestroyWindow(hMainWnd); - State=STATE_DIRECT; - while (GetMessage(&msg,0,0,0)) { - TranslateMessage(&msg); - State=STATE_DISPATCH; - DispatchMessage(&msg); - State=STATE_DIRECT; - } - State=STATE_CREATE; - hMainWnd = CreateWindowEx(MAIN_EXSTYLE,wclassname,winname,MAIN_STYLE, - CW_USEDEFAULT,0,400,300,0,0,hInst,0); - if (!hMainWnd) return 0; - State=STATE_SHOW; - ShowWindow(hMainWnd,nCmdShow); -#endif -/* update, so no WM_PAINTs are pending */ - State=STATE_UPDATE; -// UpdateWindow(hMainWnd); - Ready=TRUE; -/* fill client area with a pattern */ - FillPattern(hMainWnd,0); -/* create subwindow */ - State=STATE_CREATE; - GetClientRect(hMainWnd,&rect); - hSubWnd = CreateWindow(wcclassname,winname,WS_CHILD|WS_BORDER|WS_CLIPSIBLINGS, - 0,rect.bottom/2,rect.right,rect.bottom-(rect.bottom/2),hMainWnd,0,hInst,0); - if (!hSubWnd) return 0; -/* create buttons */ - hButton[0] = CreateWindow("BUTTON","1",WS_CHILD|WS_CLIPSIBLINGS|WS_VISIBLE, - 8,8,48,20,hMainWnd,0,hInst,0); - hButton[1] = CreateWindow("BUTTON","2",WS_CHILD|WS_CLIPSIBLINGS|WS_VISIBLE, - 32,12,48,20,hMainWnd,0,hInst,0); - hButton[2] = CreateWindow("BUTTON","3",WS_CHILD|WS_CLIPSIBLINGS|WS_VISIBLE, - 56,16,48,20,hMainWnd,0,hInst,0); -/* subclass them */ - wndButton[0] = (WNDPROC)SetWindowLong(hButton[0],GWL_WNDPROC,(LONG)SubClassWindowProc); - wndButton[1] = (WNDPROC)SetWindowLong(hButton[1],GWL_WNDPROC,(LONG)SubClassWindowProc); - wndButton[2] = (WNDPROC)SetWindowLong(hButton[2],GWL_WNDPROC,(LONG)SubClassWindowProc); -/* show them */ - State=STATE_UPDATE; - UpdateWindow(hButton[0]); - LogChildOrder(hMainWnd); - Logf("but1 visible=%d",IsWindowVisible(hButton[0])); - -/* now reparent the button to our (invisible) subwindow */ - State=STATE_TEST; - /* in different order, seeing who gets topmost */ - SetParent(hButton[0],hSubWnd); - SetParent(hButton[2],hSubWnd); - SetParent(hButton[1],hSubWnd); - LogChildOrder(hSubWnd); -/* the button should now be invisible */ - Logf("but1 visible=%d",IsWindowVisible(hButton[0])); -/* see if we can draw on them */ - FillPattern(hButton[0],0); - -#ifdef SHOW_SUB - State=STATE_SHOW; - ShowWindow(hSubWnd,SW_SHOWNORMAL); - State=STATE_UPDATE; - UpdateWindow(hSubWnd); - FillPattern(hSubWnd,0); -// InvalidateRect(hMainWnd,NULL,TRUE); - Logf("but1 visible=%d",IsWindowVisible(hButton[0])); -#endif - -#ifdef TEST_DIALOG - State=STATE_DIALOG; - DialogBox(hInst,MAKEINTRESOURCE(1),hMainWnd,(FARPROC)TestDialogProc); -#endif -#ifdef TEST_COMMCTL - { - DWORD arr[16]; - CHOOSECOLOR cc={sizeof(cc),0,hInst,0,arr,0}; - ChooseColor(&cc); - } -#endif - - State=STATE_DIRECT; - while (GetMessage(&msg,0,0,0)) { - TranslateMessage(&msg); - State=STATE_DISPATCH; - DispatchMessage(&msg); - State=STATE_DIRECT; - } - return 0; -} - - diff --git a/reactos/apps/tests/tests/guitest/guitest.rc b/reactos/apps/tests/tests/guitest/guitest.rc deleted file mode 100644 index a151c74b0d3..00000000000 --- a/reactos/apps/tests/tests/guitest/guitest.rc +++ /dev/null @@ -1,17 +0,0 @@ -/**************************************************************************** - - -guitest.rh - -produced by Borland Resource Workshop - - -*****************************************************************************/ - -#define IDC_CHECKBOX1 104 -#define IDC_CHECKBOX2 105 -#define IDC_CHECKBOX3 106 -#define DIALOG_2 2 -#define IDC_GROUPBOX1 10 -#define DIALOG_1 1 -#define ICON_1 1 diff --git a/reactos/apps/tests/tests/hello/.cvsignore b/reactos/apps/tests/tests/hello/.cvsignore deleted file mode 100644 index 3bd497145ed..00000000000 --- a/reactos/apps/tests/tests/hello/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -*.exe -*.sym -*.o -*.map diff --git a/reactos/apps/tests/tests/hello/Makefile b/reactos/apps/tests/tests/hello/Makefile deleted file mode 100644 index 12be8cd16ce..00000000000 --- a/reactos/apps/tests/tests/hello/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# -# -# -PATH_TO_TOP = ../../../.. - -PROGS = hello - -OBJECTS = hello.o - -LIBS = $(PATH_TO_TOP)/dk/w32/lib/gdi32.a -CFLAGS = -Wall -Werror - -all: $(PROGS:%=%.exe) - -.phony: all - -clean: - - $(RM) *.o *.coff *.exe *.sym - -.phony: clean - -hello.exe: $(OBJECTS) - $(CC) $(CFLAGS) -Wl,--subsystem,windows $(OBJECTS) $(LIBS) -o hello.exe - $(NM) --numeric-sort hello.exe > hello.sym - -include $(PATH_TO_TOP)/rules.mak diff --git a/reactos/apps/tests/tests/hello/hello.c b/reactos/apps/tests/tests/hello/hello.c deleted file mode 100644 index 4a4a7ebdcbf..00000000000 --- a/reactos/apps/tests/tests/hello/hello.c +++ /dev/null @@ -1,84 +0,0 @@ -#include -#include - -char szAppName[] = "Hello"; - -long FAR PASCAL WndProc(HWND, UINT, WPARAM, LPARAM); - -int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR lpszCmdLine, - int nCmdShow) -{ - HWND hwnd; - MSG msg; - WNDCLASS wndclass; - - if(!hPrevInst) { - - wndclass.style = CS_HREDRAW | CS_VREDRAW; - wndclass.lpfnWndProc = WndProc; - wndclass.cbClsExtra = 0; - wndclass.cbWndExtra = 0; - wndclass.hInstance = hInstance; - wndclass.hIcon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_APPLICATION)); - wndclass.hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)); - wndclass.hbrBackground = GetStockObject(WHITE_BRUSH); - wndclass.lpszMenuName = NULL; - wndclass.lpszClassName = szAppName; - - RegisterClass(&wndclass); - - - } - - hwnd = CreateWindow(szAppName, szAppName, - WS_HSCROLL | WS_VSCROLL | WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, CW_USEDEFAULT, 600, - 400, NULL, NULL, hInstance, NULL); - - ShowWindow(hwnd, nCmdShow); - UpdateWindow(hwnd); - - - while(GetMessage(&msg, NULL, 0, 0)) { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - return msg.wParam; -} - - - -long FAR PASCAL WndProc(HWND hwnd, UINT message, WPARAM wParam, - LPARAM lParam) -{ - HDC hdc; - RECT rect; - SIZE size; - PAINTSTRUCT ps; - - switch(message) { - - case WM_PAINT: - hdc = BeginPaint(hwnd, &ps); - GetClientRect(hwnd, &rect); - InflateRect(&rect, -10, -10); - if( !IsRectEmpty( &rect ) ) - { - GetTextExtentPoint32(hdc, szAppName, strlen(szAppName), &size); - SelectObject(hdc, GetStockObject(LTGRAY_BRUSH)); - Rectangle(hdc, rect.left, rect.top, rect.right, rect.bottom); - rect.left = (rect.right + rect.left - size.cx) / 2; - rect.top = (rect.bottom + rect.top - size.cy) / 2; - SetBkMode(hdc, TRANSPARENT); - TextOut(hdc, rect.left, rect.top, szAppName, strlen(szAppName) ); - } - EndPaint(hwnd, &ps); - return 0; - - case WM_DESTROY: - PostQuitMessage(0); - return 0; - } - return DefWindowProc(hwnd, message, wParam, lParam); -} - diff --git a/reactos/apps/tests/tests/new/.cvsignore b/reactos/apps/tests/tests/new/.cvsignore deleted file mode 100644 index 2c287efaa24..00000000000 --- a/reactos/apps/tests/tests/new/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -*.exe -*.o -*.sym -*.map diff --git a/reactos/apps/tests/tests/new/Makefile b/reactos/apps/tests/tests/new/Makefile deleted file mode 100644 index 044648e96b6..00000000000 --- a/reactos/apps/tests/tests/new/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# -# -# -PATH_TO_TOP = ../../../.. - -PROGS = new - -OBJECTS = new.o - -LIBS = $(PATH_TO_TOP)/dk/w32/lib/gdi32.a -CFLAGS = -Wall -Werror - -all: $(PROGS:%=%.exe) - -.phony: all - -clean: - - $(RM) *.o *.coff *.exe *.sym - -.phony: clean - -new.exe: $(OBJECTS) - $(CC) $(CFLAGS) -Wl,--subsystem,windows $(OBJECTS) $(LIBS) -o new.exe - $(NM) --numeric-sort new.exe > new.sym - -include $(PATH_TO_TOP)/rules.mak diff --git a/reactos/apps/tests/tests/new/new.c b/reactos/apps/tests/tests/new/new.c deleted file mode 100644 index 548d2cf6b04..00000000000 --- a/reactos/apps/tests/tests/new/new.c +++ /dev/null @@ -1,154 +0,0 @@ -#include - -HANDLE ghInstance; - - -LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM); -LRESULT CALLBACK ChildProc (HWND, UINT, WPARAM, LPARAM); - -int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, - LPSTR lpszCmdParam, int nCmdShow) - { - char szAppName[] = "ClassLook" ; - HWND hwnd ; - MSG msg ; - WNDCLASS wndclass ; - - ghInstance = hInstance; - if (!hPrevInstance) - { - wndclass.style = CS_HREDRAW | CS_VREDRAW ; - wndclass.lpfnWndProc = WndProc ; - wndclass.cbClsExtra = 0 ; - wndclass.cbWndExtra = 0 ; - wndclass.hInstance = hInstance ; - wndclass.hIcon = LoadIcon (NULL, MAKEINTRESOURCE(IDI_APPLICATION)) ; - wndclass.hCursor = LoadCursor (NULL, MAKEINTRESOURCE(IDC_ARROW)) ; - wndclass.hbrBackground = GetStockObject (WHITE_BRUSH) ; - wndclass.lpszMenuName = NULL ; - wndclass.lpszClassName = szAppName ; - - RegisterClass (&wndclass) ; - } - - hwnd = CreateWindow (szAppName, /* window class name */ - szAppName, /* window caption */ - WS_OVERLAPPEDWINDOW, /* window style */ - CW_USEDEFAULT, /* initial x position */ - CW_USEDEFAULT, /* initial y position */ - 600, /* initial x size */ - 400, /* initial y size */ - NULL, /* parent window handle */ - NULL, /* window menu handle */ - hInstance, /* program instance handle */ - NULL) ; /* creation parameters */ - - ShowWindow (hwnd, nCmdShow) ; - UpdateWindow (hwnd) ; - - while (GetMessage (&msg, NULL, 0, 0)) - { - TranslateMessage (&msg) ; - DispatchMessage (&msg) ; - } - return msg.wParam ; - } - -LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) - { - HDC hdc ; - PAINTSTRUCT ps ; - RECT rect ; - WNDCLASS wndclass ; - char clsName[] = "SecondClass"; - - static HWND hChild; - - switch (message) - { - case WM_CREATE : - wndclass.style = CS_PARENTDC | CS_HREDRAW | CS_VREDRAW; - wndclass.lpfnWndProc = ChildProc ; - wndclass.cbClsExtra = 0 ; - wndclass.cbWndExtra = 0 ; - wndclass.hInstance = ghInstance ; - wndclass.hIcon = NULL ; - wndclass.hCursor = LoadCursor (NULL, MAKEINTRESOURCE(IDC_CROSS)) ; - wndclass.hbrBackground = GetStockObject (LTGRAY_BRUSH) ; - wndclass.lpszMenuName = NULL ; - wndclass.lpszClassName = clsName; - - RegisterClass (&wndclass); - - hChild = CreateWindow(clsName,"Child Window", - WS_CHILD | WS_VISIBLE | WS_BORDER, - 10, 10, 580, 380, hwnd, NULL, ghInstance, NULL); - ShowWindow(hChild, SW_SHOW); - case WM_PAINT : - hdc = BeginPaint (hwnd, &ps) ; - - GetClientRect (hwnd, &rect) ; - - DrawText (hdc, "Hello, Windows!", -1, &rect, - DT_SINGLELINE | DT_CENTER | DT_VCENTER) ; - - EndPaint (hwnd, &ps); - return 0 ; - - case WM_DESTROY : - PostQuitMessage (0) ; - return 0 ; - } - return DefWindowProc (hwnd, message, wParam, lParam) ; - } - -LRESULT CALLBACK ChildProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - HDC hDC; - PAINTSTRUCT ps; - WNDCLASS wndClass; - char *classes[]={"EDIT","BUTTON","LISTBOX","STATIC","SCROLLBAR","COMBOBOX","COMBOLBOX", NULL}; - char** curr; - char buf[256]; - RECT rect ; - int i; - - switch (message) { - case WM_PAINT: - curr = classes; - i=0; - hDC = BeginPaint(hwnd, &ps); - SelectObject(hDC,GetStockObject(ANSI_FIXED_FONT)); - while (*curr) { - wsprintf(buf,"%12s:",*curr); - GetClassInfo(NULL, *curr, &wndClass); - if(wndClass.style&CS_VREDRAW) lstrcat(buf," | CS_VREDRAW"); - if(wndClass.style&CS_HREDRAW) lstrcat(buf," | CS_HREDRAW" ); - if(wndClass.style&CS_KEYCVTWINDOW) lstrcat(buf," | CS_KEYCVTWINDOW" ); - if(wndClass.style&CS_DBLCLKS) lstrcat(buf," | CS_DBLCLKS" ); - if(wndClass.style&CS_OWNDC) lstrcat(buf," | CS_OWNDC" ); - if(wndClass.style&CS_CLASSDC) lstrcat(buf," | CS_CLASSDC" ); - if(wndClass.style&CS_PARENTDC) lstrcat(buf," | CS_PARENTDC" ); - if(wndClass.style&CS_NOKEYCVT) lstrcat(buf," | CS_NOKEYCVT" ); - if(wndClass.style&CS_NOCLOSE) lstrcat(buf," | CS_NOCLOSE" ); - if(wndClass.style&CS_SAVEBITS) lstrcat(buf," | CS_SAVEBITS" ); - if(wndClass.style&CS_GLOBALCLASS) lstrcat(buf," | CS_GLOBALCLASS"); - GetClientRect (hwnd, &rect) ; - TextOut (hDC, 5,20+i,buf,lstrlen(buf)) ; - i += 15; - curr++; - } -/* EndPaint(hwnd, &ps); - break; - hDC = BeginPaint(hwnd, &ps); -*/ - MoveToEx(hDC, 0, 0, NULL); - LineTo(hDC, 500, 500); - EndPaint(hwnd, &ps); - break; - default: - return DefWindowProc (hwnd, message, wParam, lParam) ; - } - return (0L); -} -