diff --git a/reactos/apps/tests/Makefile b/reactos/apps/tests/Makefile deleted file mode 100644 index 0946f37fc3c..00000000000 --- a/reactos/apps/tests/Makefile +++ /dev/null @@ -1,79 +0,0 @@ -# -# ReactOS test applications makefile -# - -PATH_TO_TOP = ../.. - -include $(PATH_TO_TOP)/rules.mak - -# test_old tests -TEST_APPS = accelerator alive alphablend apc args atomtest bench bitblt button \ -button2 capclock carets combo consume copymove count dibtest dump_shared_data \ -edit enumwnd enumws event global_mem gradient hello mdi \ -hivetest icontest isotest lineclip linetest lpc \ -mktime mstest multithrdwin multiwin mutex nptest patblt primitives pteb \ -regtest sectest sertest shaptest shm statst statst2 stretchblt suspend \ -tcpsvr terminate txtscale thread thread_msg tokentest user32 vmtest \ -winhello wm_erasebkgnd wm_paint eventpair threadwait popupmenu \ -map_dup_inherit p_dup_handle apc2 enhmetafile dirdlg guithreadinfo fiber -# Build failure: -# kernel32 - -TEST_MISC = - -all: $(TEST_APPS) $(TEST_MISC) - -depends: - -implib: $(TEST_APPS:%=%_implib) \ - $(TEST_MISC:%=%_implib) - -clean: $(TEST_APPS:%=%_clean) \ - $(TEST_MISC:%=%_clean) - -install: $(TEST_APPS:%=%_install) \ - $(TEST_MISC:%=%_install) - -.PHONY: all depends implib clean install - - -# -# Test Applications -# -$(TEST_APPS): %: - $(MAKE) -C $* - -$(TEST_APPS:%=%_implib): %_implib: - $(MAKE) -C $* implib - -$(TEST_APPS:%=%_clean): %_clean: - $(MAKE) -C $* clean - -$(TEST_APPS:%=%_install): %_install: - $(MAKE) -C $* install - -.PHONY: $(TEST_APPS) $(TEST_APPS:%=%_implib) $(TEST_APPS:%=%_clean) $(TEST_APPS:%=%_install) - - -# -# Misc Test Applications -# -$(TEST_MISC): %: - $(MAKE) -C tests/$* - -$(TEST_MISC:%=%_implib): %_implib: - $(MAKE) -C tests/$* implib - -$(TEST_MISC:%=%_clean): %_clean: - $(MAKE) -C tests/$* clean - -$(TEST_MISC:%=%_install): %_install: - $(MAKE) -C tests/$* install - -.PHONY: $(TEST_MISC) $(TEST_MISC:%=%_implib) $(TEST_MISC:%=%_clean) $(TEST_MISC:%=%_install) - - -etags: - find . -name "*.[ch]" -print | etags --language=c - - -# EOF diff --git a/reactos/apps/tests/lineclip/.cvsignore b/reactos/apps/tests/lineclip/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/lineclip/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/lineclip/lineclip.c b/reactos/apps/tests/lineclip/lineclip.c deleted file mode 100644 index 3fba19c3d31..00000000000 --- a/reactos/apps/tests/lineclip/lineclip.c +++ /dev/null @@ -1,166 +0,0 @@ -#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 = "ClipClass"; - 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("ClipClass", - "Line clipping 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); - } - - ShowWindow(hWnd, nCmdShow); - - while(GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - return msg.wParam; -} - -static void -DrawLines(HDC hDC) -{ - static struct - { - int fromx; - int fromy; - int tox; - int toy; - } - points[ ] = - { - { 50, 99, 125, 99 }, - { 160, 99, 190, 99 }, - { 300, 99, 225, 99 }, - { 50, 100, 125, 100 }, - { 160, 100, 190, 100 }, - { 300, 100, 225, 100 }, - { 50, 125, 300, 125 }, - { 50, 149, 125, 149 }, - { 160, 149, 190, 149 }, - { 300, 149, 225, 149 }, - { 50, 150, 125, 150 }, - { 160, 150, 190, 150 }, - { 300, 150, 225, 150 }, - { 160, 249, 190, 249 }, - { 160, 250, 190, 250 }, - { 149, 50, 149, 125 }, - { 149, 160, 149, 190 }, - { 149, 300, 149, 225 }, - { 150, 50, 150, 125 }, - { 150, 160, 150, 190 }, - { 150, 300, 150, 225 }, - { 199, 50, 199, 125 }, - { 199, 160, 199, 190 }, - { 199, 300, 199, 225 }, - { 200, 50, 200, 125 }, - { 200, 160, 200, 190 }, - { 200, 300, 200, 225 }, - { 175, 50, 175, 300 }, - { 50, 55, 300, 290 }, - { 300, 295, 50, 60 }, - { 50, 290, 300, 55 }, - { 300, 60, 50, 295 }, - { 55, 50, 290, 300 }, - { 295, 300, 60, 50 }, - { 55, 300, 290, 50 }, - { 295, 50, 60, 300 } - }; - int i; - - for (i = 0; i < sizeof(points) / sizeof(points[0]); i++) - { - MoveToEx(hDC, points[i].fromx, points[i].fromy, NULL); - LineTo(hDC, points[i].tox, points[i].toy); - } -} - -LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - PAINTSTRUCT ps; - HDC hDC; - RECT clr; - HRGN ClipRgn, ExcludeRgn; - RECT Rect; - - switch(msg) - { - case WM_PAINT: - GetClientRect(hWnd, &clr); - ClipRgn = CreateRectRgnIndirect(&clr); - hDC = BeginPaint(hWnd, &ps); - Rect.left = 100; - Rect.top = 100; - Rect.right = 250; - Rect.bottom = 150; - FillRect(hDC, &Rect, CreateSolidBrush(RGB(0xFF, 0x00, 0x00))); - ExcludeRgn = CreateRectRgnIndirect(&Rect); - CombineRgn(ClipRgn, ClipRgn, ExcludeRgn, RGN_DIFF); - DeleteObject(ExcludeRgn); - Rect.left = 150; - Rect.top = 150; - Rect.right = 200; - Rect.bottom = 250; - FillRect(hDC, &Rect, CreateSolidBrush(RGB(0xFF, 0x00, 0x00))); - SelectObject(hDC, CreatePen(PS_SOLID, 0, RGB(0xFF, 0xFF, 0x00))); - DrawLines(hDC); - SelectObject(hDC, CreatePen(PS_SOLID, 0, RGB(0x00, 0x00, 0xFF))); - ExcludeRgn = CreateRectRgnIndirect(&Rect); - CombineRgn(ClipRgn, ClipRgn, ExcludeRgn, RGN_DIFF); - DeleteObject(ExcludeRgn); - SelectClipRgn(hDC, ClipRgn); - DrawLines(hDC); - 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/lineclip/makefile b/reactos/apps/tests/lineclip/makefile deleted file mode 100644 index 1be45250e2d..00000000000 --- a/reactos/apps/tests/lineclip/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 = windows - -TARGET_NAME = lineclip - -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/linetest/.cvsignore b/reactos/apps/tests/linetest/.cvsignore deleted file mode 100644 index bafdb94150e..00000000000 --- a/reactos/apps/tests/linetest/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.exe -*.sym -*.coff -*.d -*.o -*.map diff --git a/reactos/apps/tests/linetest/linetest.c b/reactos/apps/tests/linetest/linetest.c deleted file mode 100644 index f6da86da14b..00000000000 --- a/reactos/apps/tests/linetest/linetest.c +++ /dev/null @@ -1,181 +0,0 @@ -#include -#include - -LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM); - -const TCHAR* CLASS_NAME = _T("LineTestClass"); - -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, (LPCSTR)IDI_APPLICATION); - wc.hCursor = LoadCursor(NULL, (LPCSTR)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(CLASS_NAME, - _T("Line drawing test"), - WS_OVERLAPPEDWINDOW, - 0, - 0, - CW_USEDEFAULT, - CW_USEDEFAULT, - NULL, - NULL, - hInstance, - NULL); - if (hWnd == NULL) - { - fprintf(stderr, "CreateWindow failed (last error 0x%lX)\n", - GetLastError()); - return(1); - } - - ShowWindow(hWnd, nCmdShow); - - while(GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - return msg.wParam; -} - -#define red RGB(255,0,0) -#define grn RGB(0,255,0) -#define blu RGB(0,0,255) -#define blk RGB(0,0,0) - -static void -DrawLines(HDC hDC) -{ - static struct - { - int fromx; - int fromy; - int tox; - int toy; - COLORREF clr; - } - points[ ] = - { - { 10, 10, 19, 10, red }, - { 20, 10, 20, 19, grn }, - { 20, 20, 11, 20, blu }, - { 10, 20, 10, 11, blk }, - { 12, 12, 15, 15, red }, - { 18, 12, 15, 15, grn }, - { 18, 18, 15, 15, blu }, - { 12, 18, 15, 15, blk }, - - { 35, 10, 39, 14, red }, - { 40, 15, 36, 19, grn }, - { 35, 20, 31, 16, blu }, - { 30, 15, 34, 11, blk }, - - { 2, 1, 5, 2, red }, - { 6, 2, 5, 5, grn }, - { 5, 6, 2, 5, blu }, - { 1, 5, 2, 2, blk }, - - { 50, 1, 51, 1, red }, - { 50, 2, 52, 2, grn }, - { 50, 3, 53, 3, blu }, - { 50, 4, 54, 4, blk }, - { 50, 5, 55, 5, red }, - { 50, 6, 56, 6, grn }, - { 50, 7, 57, 7, blu }, - { 50, 8, 58, 8, blk }, - { 50, 9, 59, 9, red }, - { 50, 10, 60, 10, grn }, - { 50, 11, 61, 11, blu }, - { 50, 12, 62, 12, blk }, - - { 50, 14, 62, 14, red }, - { 51, 15, 62, 15, grn }, - { 52, 16, 62, 16, blu }, - { 53, 17, 62, 17, blk }, - { 54, 18, 62, 18, red }, - { 55, 19, 62, 19, grn }, - { 56, 20, 62, 20, blu }, - { 57, 21, 62, 21, blk }, - { 58, 22, 62, 22, red }, - { 59, 23, 62, 23, grn }, - { 60, 24, 62, 24, blu }, - { 61, 25, 62, 25, blk }, - }; - int i; - - for (i = 0; i < sizeof(points) / sizeof(points[0]); i++) - { - HPEN hpen, hpenold; - hpen = CreatePen ( PS_SOLID, 0, points[i].clr ); - hpenold = (HPEN)SelectObject ( hDC, hpen ); - MoveToEx ( hDC, points[i].fromx, points[i].fromy, NULL ); - LineTo ( hDC, points[i].tox, points[i].toy ); - SelectObject ( hDC, hpenold ); - DeleteObject ( hpen ); - } -} - -LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - PAINTSTRUCT ps; - HDC hDC; - RECT clr; - HBRUSH hbr; - - switch(msg) - { - case WM_PAINT: - GetClientRect(hWnd, &clr); - //ClipRgn = CreateRectRgnIndirect(&clr); - hDC = BeginPaint(hWnd, &ps); - //Rect.left = 100; - //Rect.top = 100; - //Rect.right = 250; - //Rect.bottom = 150; - //FillRect(hDC, &Rect, CreateSolidBrush(RGB(0xFF, 0x00, 0x00))); - //ExcludeRgn = CreateRectRgnIndirect(&Rect); - //CombineRgn(ClipRgn, ClipRgn, ExcludeRgn, RGN_DIFF); - //DeleteObject(ExcludeRgn); - //Rect.left = 150; - //Rect.top = 150; - //Rect.right = 200; - //Rect.bottom = 250; - hbr = CreateSolidBrush(RGB(255, 255, 255)); - FillRect ( hDC, &clr, hbr ); - DeleteObject ( hbr ); - DrawLines(hDC); - 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/linetest/makefile b/reactos/apps/tests/linetest/makefile deleted file mode 100644 index 1f7272142ff..00000000000 --- a/reactos/apps/tests/linetest/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 = windows - -TARGET_NAME = linetest - -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/lock/.cvsignore b/reactos/apps/tests/lock/.cvsignore deleted file mode 100644 index bafdb94150e..00000000000 --- a/reactos/apps/tests/lock/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.exe -*.sym -*.coff -*.d -*.o -*.map diff --git a/reactos/apps/tests/lpc/.cvsignore b/reactos/apps/tests/lpc/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/lpc/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/lpc/conport.c b/reactos/apps/tests/lpc/conport.c deleted file mode 100644 index 2fd76a7e253..00000000000 --- a/reactos/apps/tests/lpc/conport.c +++ /dev/null @@ -1,205 +0,0 @@ -/* $Id: conport.c,v 1.6 2000/04/25 23:22:46 ea Exp $ - * - * reactos/apps/lpc/conport.c - * - * To be run in a real WNT 4.0 system with - * "\SmApiPort" as argument. Do not try to - * connect to "\Windows\ApiPort" since that - * reboots immeditely. - * - * Use Russinovich' HandleEx to verify - * conport.exe owns two unnamed LPC ports: - * the one created by kernel32.dll connecting - * to csrss.exe, and one connected to here. - * - * 19990627 (Emanuele Aliberti) - * Initial implementation. - * 19990704 (EA) - * Dump object's attributes moved in dumpinfo.c. - */ -#include -#include -#include -#define PROTO_LPC -#include -#include "dumpinfo.h" - -#define LPC_CONNECT_FLAG1 0x00000001 -#define LPC_CONNECT_FLAG2 0x00000010 -#define LPC_CONNECT_FLAG3 0x00000100 -#define LPC_CONNECT_FLAG4 0x00001000 -#define LPC_CONNECT_FLAG5 0x00010000 - -NTSTATUS -(STDCALL * ConnectPort)( - OUT PHANDLE PortHandle, - IN PUNICODE_STRING PortName, - IN POBJECT_ATTRIBUTES ObjectAttributes, - IN DWORD Unknown3, - IN DWORD Unknown4, - IN DWORD Unknown5, - IN DWORD Unknown6, - IN ULONG Flags - ); - -NTSTATUS -(STDCALL * QueryObject)( - IN HANDLE ObjectHandle, - IN CINT ObjectInformationClass, - OUT PVOID ObjectInformation, - IN ULONG Length, - OUT PULONG ResultLength - ); - -NTSTATUS -(STDCALL * YieldExecution)(VOID); - -#define BUF_SIZE 1024 -#define MAXARG 1000000 - - -VOID -TryConnectPort(char *port_name) -{ - DWORD Status = 0; - HANDLE Port = 0; - int i; - UNICODE_STRING PortName; - OBJECT_ATTRIBUTES ObjectAttributes; - WORD Name [BUF_SIZE] = {0}; - int dwx = 0; - char * port_name_save = port_name; - - /* - * Convert the port's name to Unicode. - */ - for ( - PortName.Length = 0; - ( *port_name - && (PortName.Length < BUF_SIZE) - ); - ) - { - Name[PortName.Length++] = (WORD) *port_name++; - } - Name[PortName.Length] = 0; - - PortName.Length = PortName.Length * sizeof (WORD); - PortName.MaximumLength = PortName.Length + sizeof (WORD); - PortName.Buffer = (PWSTR) Name; - /* - * Prepare the port object attributes. - */ - ObjectAttributes.Length = - sizeof (OBJECT_ATTRIBUTES); - ObjectAttributes.RootDirectory = - NULL; - ObjectAttributes.ObjectName = - NULL /*& PortName */; - ObjectAttributes.Attributes = - OBJ_CASE_INSENSITIVE; - ObjectAttributes.SecurityDescriptor = - NULL; - ObjectAttributes.SecurityQualityOfService = - NULL; - /* - * Try to issue a connection request. - */ - Port = 0; - Status = ConnectPort( - & Port, /* & PortHandle */ - & PortName, /* & PortName */ - & ObjectAttributes, /* & PortAttributes */ - NULL, /* & SecurityQos */ - NULL, /* & SectionInfo */ - NULL, /* & MapInfo */ - NULL, /* & MaxMessageSize */ - LPC_CONNECT_FLAG5 /* & ConnectInfoLength */ - ); - if (Status == STATUS_SUCCESS) - { - DumpInfo( - Name, - Status, - "connected", - Port - ); - /* Hot waiting */ - for (dwx=0; dwx -#include -#include -#define PROTO_LPC -#include -#include "dumpinfo.h" - -#define LPC_CONNECT_FLAG1 0x00000001 -#define LPC_CONNECT_FLAG2 0x00000010 -#define LPC_CONNECT_FLAG3 0x00000100 -#define LPC_CONNECT_FLAG4 0x00001000 -#define LPC_CONNECT_FLAG5 0x00010000 - -NTSTATUS -(STDCALL * CreatePort)( - /*OUT PHANDLE PortHandle,*/ - PVOID Buffer, - IN POBJECT_ATTRIBUTES PortAttributes OPTIONAL, - IN ACCESS_MASK DesiredAccess, - IN DWORD Unknown3, - IN ULONG Flags - ); - -NTSTATUS -(STDCALL * QueryObject)( - IN HANDLE ObjectHandle, - IN CINT ObjectInformationClass, - OUT PVOID ObjectInformation, - IN ULONG Length, - OUT PULONG ResultLength - ); - -NTSTATUS -(STDCALL * YieldExecution)(VOID); - -#define BUF_SIZE 1024 -#define MAXARG 5000000 - - -VOID -TryCreatePort(char *port_name) -{ - DWORD Status = 0; - HANDLE Port = 0; - int i; - UNICODE_STRING PortName; - OBJECT_ATTRIBUTES ObjectAttributes; - WORD Name [BUF_SIZE] = {0}; - int dwx = 0; - char * port_name_save = port_name; - - /* - * Convert the port's name to Unicode. - */ - for ( - PortName.Length = 0; - ( *port_name - && (PortName.Length < BUF_SIZE) - ); - ) - { - Name[PortName.Length++] = (WORD) *port_name++; - } - Name[PortName.Length] = 0; - - PortName.Length = PortName.Length * sizeof (WORD); - PortName.MaximumLength = PortName.Length + sizeof (WORD); - PortName.Buffer = (PWSTR) Name; - /* - * Prepare the port object attributes. - */ - ObjectAttributes.Length = - sizeof (OBJECT_ATTRIBUTES); - ObjectAttributes.RootDirectory = - NULL; - ObjectAttributes.ObjectName = - & PortName; - ObjectAttributes.Attributes = - 0; //OBJ_CASE_INSENSITIVE --> STATUS_INVALID_PARAMETER ==> case sensitive!; - ObjectAttributes.SecurityDescriptor = - NULL; - ObjectAttributes.SecurityQualityOfService = - NULL; - /* - * Try to issue a connection request. - */ - Port = 0; - Status = CreatePort( - & Port, - & ObjectAttributes, - 0, /* ACCESS_MASK? */ - 0, /* Unknown3 */ - LPC_CONNECT_FLAG5 - ); - if (Status == STATUS_SUCCESS) - { - DumpInfo( - Name, - Status, - "created", - Port - ); - /* Hot waiting */ - for (dwx=0; dwx -#include -#include -#include - -#define BUF_SIZE 1024 -#define MAX_BASIC_INFO_SIZE 512 - - -extern -NTSTATUS -(STDCALL * QueryObject)( - IN HANDLE ObjectHandle, - IN CINT ObjectInformationClass, - OUT PVOID ObjectInformation, - IN ULONG Length, - OUT PULONG ResultLength - ); - -extern -NTSTATUS -(STDCALL * QueryInformationPort)( - IN HANDLE PortHandle, - IN CINT PortInformationClass, /* guess */ - OUT PVOID PortInformation, /* guess */ - IN ULONG PortInformationLength, /* guess */ - OUT PULONG ReturnLength /* guess */ - ); - - -/* -static -VOID -DumpBuffer( - char *Name, - BYTE *buffer, - ULONG size - ) -{ - register ULONG i = 0; - - printf("%s [%d] = ",Name,size); - for ( i = 0; - i != size; - ++i - ) - { - printf("%02X",buffer[i]); - } - printf("\n"); -} -*/ - -VOID -DumpInfo ( - LPCWSTR Name, - NTSTATUS Status, - LPCWSTR Comment, - HANDLE Port - ) -{ - BYTE ObjectInformation [BUF_SIZE] = {0}; - ULONG ResultLength; - - wprintf( - L"Port \"%s\" %s:\n", - Name, - Comment - ); - - printf("\tStatus = %08X\n",Status); - printf("\tPort = %08X\n\n",Port); - /* - * Query object information. - */ - printf("Basic Information:\n"); - Status = QueryObject( - Port, - ObjectBasicInformation, - ObjectInformation, - sizeof (LPC_PORT_BASIC_INFORMATION), - & ResultLength - ); - if (Status == STATUS_SUCCESS) - { - PLPC_PORT_BASIC_INFORMATION i; - - i = (PLPC_PORT_BASIC_INFORMATION) ObjectInformation; - - printf( "\tUnknown01 = 0x%08X\n", i->Unknown0 ); - printf( "\tUnknown02 = 0x%08X\n", i->Unknown1 ); - printf( "\tUnknown03 = 0x%08X\n", i->Unknown2 ); - printf( "\tUnknown04 = 0x%08X\n", i->Unknown3 ); - printf( "\tUnknown05 = 0x%08X\n", i->Unknown4 ); - printf( "\tUnknown06 = 0x%08X\n", i->Unknown5 ); - printf( "\tUnknown07 = 0x%08X\n", i->Unknown6 ); - printf( "\tUnknown08 = 0x%08X\n", i->Unknown7 ); - printf( "\tUnknown09 = 0x%08X\n", i->Unknown8 ); - printf( "\tUnknown10 = 0x%08X\n", i->Unknown9 ); - printf( "\tUnknown11 = 0x%08X\n", i->Unknown10 ); - printf( "\tUnknown12 = 0x%08X\n", i->Unknown11 ); - printf( "\tUnknown13 = 0x%08X\n", i->Unknown12 ); - printf( "\tUnknown14 = 0x%08X\n", i->Unknown13 ); - } - else - { - printf("\tStatus = %08X\n",Status); - } - printf("Type Information:\n"); - Status = QueryObject( - Port, - ObjectTypeInformation, - ObjectInformation, - sizeof ObjectInformation, - & ResultLength - ); - if (Status == STATUS_SUCCESS) - { - OBJECT_TYPE_INFORMATION * i; - - i = (OBJECT_TYPE_INFORMATION *) ObjectInformation; - - wprintf( - L"\tName: \"%s\"\n", - (i->Name.Length ? i->Name.Buffer : L"") - ); -/* -FIXME: why this always raise an access violation exception? - wprintf( - L"\tType: \"%s\"\n", - (i->Type.Length ? i->Type.Buffer : L"") - ); -/**/ - printf( - "\tTotal Handles: %d\n", - i->TotalHandles - ); - printf( - "\tReference Count: %d\n", - i->ReferenceCount - ); - } - else - { - printf("\tStatus = %08X\n",Status); - } - printf("Name Information:\n"); - Status = QueryObject( - Port, - ObjectNameInformation, - ObjectInformation, - sizeof ObjectInformation, - & ResultLength - ); - if (Status == STATUS_SUCCESS) - { - OBJECT_NAME_INFORMATION * i; - - i = (OBJECT_NAME_INFORMATION *) ObjectInformation; - wprintf( - L"\tName: \"%s\"\n", - (i->Name.Length ? i->Name.Buffer : L"") - ); - } - else - { - printf("\tStatus = %08X\n",Status); - } - printf("Data Information:\n"); - Status = QueryObject( - Port, - ObjectDataInformation, - ObjectInformation, - sizeof ObjectInformation, - & ResultLength - ); - if (Status == STATUS_SUCCESS) - { - OBJECT_DATA_INFORMATION * i; - - i = (OBJECT_DATA_INFORMATION *) ObjectInformation; - printf( - "\tInherit Handle: %s\n", - (i->bInheritHandle ? "TRUE" : "FALSE") - ); - printf( - "\tProtect from Close: %s\n", - (i->bProtectFromClose ? "TRUE" : "FALSE") - ); - } - else - { - printf("\tStatus = %08X\n",Status); - } -//--- - printf("Port Information:\n"); -/* Status = QueryInformationPort( - Port, - 1, /* info class * / - ObjectInformation, - sizeof ObjectInformation, - & ResultLength - ); - if (Status == STATUS_SUCCESS) - { - DWORD * i = ObjectInformation; - int j = 0; - - while (j < ResultLength / sizeof (DWORD)) - { - printf("\t%08X\n",i[j]); - ++j; - } - } - else - { - printf("\tStatus = %08X\n",Status); - } -*/ -} - - -/* EOF */ diff --git a/reactos/apps/tests/lpc/dumpinfo.h b/reactos/apps/tests/lpc/dumpinfo.h deleted file mode 100644 index 51e78736e07..00000000000 --- a/reactos/apps/tests/lpc/dumpinfo.h +++ /dev/null @@ -1,8 +0,0 @@ -VOID -DumpInfo ( - LPCWSTR Name, - NTSTATUS Status, - LPCWSTR Comment, - HANDLE Port - ); - diff --git a/reactos/apps/tests/lpc/lpcclt.c b/reactos/apps/tests/lpc/lpcclt.c deleted file mode 100644 index 5f2ee956376..00000000000 --- a/reactos/apps/tests/lpc/lpcclt.c +++ /dev/null @@ -1,92 +0,0 @@ -/* $Id: lpcclt.c,v 1.14 2004/01/06 16:07:21 ekohl Exp $ - * - * DESCRIPTION: Simple LPC Client - * PROGRAMMER: David Welch - */ -#include -#include -#include -#include -#include -#include -#include - -#include "lpctest.h" - -const char * MyName = "LPC-CLI"; -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[]) -{ - UNICODE_STRING PortName = ROS_STRING_INITIALIZER(TEST_PORT_NAME_U); - NTSTATUS Status; - HANDLE PortHandle; - LPC_MAX_MESSAGE Request; - ULONG ConnectInfo; - ULONG ConnectInfoLength = 0; - SECURITY_QUALITY_OF_SERVICE Sqos; - - printf("%s: Lpc test client\n", MyName); - - printf("%s: Connecting to port \"%s\"...\n", MyName, TEST_PORT_NAME); - ConnectInfoLength = 0; - ZeroMemory (& Sqos, sizeof Sqos); - Status = NtConnectPort(&PortHandle, - &PortName, - & Sqos, - 0, - 0, - 0, - NULL, - &ConnectInfoLength); - if (!NT_SUCCESS(Status)) - { - printf("%s: NtConnectPort() failed with status = 0x%08X.\n", MyName, Status); - return EXIT_FAILURE; - } - - printf("%s: Connected to \"%s\" with anonymous port 0x%x.\n", MyName, TEST_PORT_NAME, PortHandle); - - ZeroMemory(& Request, sizeof Request); - strcpy(Request.Data, GetCommandLineA()); - Request.Header.DataSize = strlen(Request.Data); - Request.Header.MessageSize = sizeof(LPC_MESSAGE) + - Request.Header.DataSize; - - printf("%s: Sending to port 0x%x message \"%s\"...\n", - MyName, - PortHandle, - (char *) Request.Data); - Status = NtRequestPort(PortHandle, - &Request.Header); - if (!NT_SUCCESS(Status)) - { - printf("%s: NtRequestPort(0x%x) failed with status = 0x%8X.\n", - MyName, - PortHandle, - Status); - return EXIT_FAILURE; - } - - printf("%s: Sending datagram to port 0x%x succeeded.\n", MyName, PortHandle); - - Sleep(2000); - - printf("%s: Disconnecting...", MyName); - NtClose (PortHandle); - - return EXIT_SUCCESS; -} diff --git a/reactos/apps/tests/lpc/lpcsrv.c b/reactos/apps/tests/lpc/lpcsrv.c deleted file mode 100644 index 9b488ee7053..00000000000 --- a/reactos/apps/tests/lpc/lpcsrv.c +++ /dev/null @@ -1,139 +0,0 @@ -/* $Id: lpcsrv.c,v 1.14 2004/01/06 16:07:21 ekohl Exp $ - * - * DESCRIPTION: Simple LPC Server - * PROGRAMMER: David Welch - */ -#include -#include -#include -#include -#include -#include -#include - -#include "lpctest.h" - -static const char * MyName = "LPC-SRV"; - -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[]) -{ - UNICODE_STRING PortName = ROS_STRING_INITIALIZER(TEST_PORT_NAME_U); - OBJECT_ATTRIBUTES ObjectAttributes; - NTSTATUS Status; - HANDLE NamedPortHandle; - HANDLE PortHandle; - LPC_MAX_MESSAGE ConnectMsg; - - printf("%s: Lpc test server\n", MyName); - - InitializeObjectAttributes(&ObjectAttributes, - &PortName, - 0, - NULL, - NULL); - - printf("%s: Creating port \"%s\"...\n", MyName, TEST_PORT_NAME); - Status = NtCreatePort(&NamedPortHandle, - &ObjectAttributes, - 0, - 0, - 0); - if (!NT_SUCCESS(Status)) - { - printf("%s: NtCreatePort() failed with status = 0x%08lX.\n", MyName, Status); - return EXIT_FAILURE; - } - printf("%s: Port \"%s\" created (0x%x).\n\n", MyName, TEST_PORT_NAME, NamedPortHandle); - - for (;;) - { - printf("%s: Listening for connections requests on port 0x%x...\n", MyName, NamedPortHandle); - Status = NtListenPort(NamedPortHandle, - &ConnectMsg.Header); - if (!NT_SUCCESS(Status)) - { - printf("%s: NtListenPort() failed with status = 0x%08lX.\n", MyName, Status); - return EXIT_FAILURE; - } - - printf("%s: Received connection request 0x%08x on port 0x%x.\n", MyName, - ConnectMsg.Header.MessageId, NamedPortHandle); - printf("%s: Request from: PID=%x, TID=%x.\n", MyName, - ConnectMsg.Header.ClientId.UniqueProcess, ConnectMsg.Header.ClientId.UniqueThread); - - printf("%s: Accepting connection request 0x%08x...\n", MyName, - ConnectMsg.Header.MessageId); - Status = NtAcceptConnectPort(&PortHandle, - NamedPortHandle, - & ConnectMsg.Header, - TRUE, - 0, - NULL); - if (!NT_SUCCESS(Status)) - { - printf("%s: NtAcceptConnectPort() failed with status = 0x%08lX.\n", MyName, Status); - return EXIT_FAILURE; - } - printf("%s: Connection request 0x%08x accepted as port 0x%x.\n", MyName, - ConnectMsg.Header.MessageId, PortHandle); - - printf("%s: Completing connection for port 0x%x (0x%08x).\n", MyName, - PortHandle, ConnectMsg.Header.MessageId); - Status = NtCompleteConnectPort(PortHandle); - if (!NT_SUCCESS(Status)) - { - printf("%s: NtCompleteConnectPort() failed with status = 0x%08lX.\n", MyName, Status); - return EXIT_FAILURE; - } - - printf("%s: Entering server loop for port 0x%x...\n", MyName, PortHandle); - for(;;) - { - LPC_MAX_MESSAGE Request; - - Status = NtReplyWaitReceivePort(PortHandle, - 0, - NULL, - &Request.Header); - if (!NT_SUCCESS(Status)) - { - printf("%s: NtReplyWaitReceivePort() failed with status = 0x%08lX.\n", MyName, Status); - return EXIT_FAILURE; - } - - if (LPC_DATAGRAM == PORT_MESSAGE_TYPE(Request)) - { - printf("%s: Datagram message contents are <%s>.\n", - MyName, - Request.Data); - } - else - { - printf("%s: Message with type %d received on port 0x%x.\n", MyName, - PORT_MESSAGE_TYPE(Request), PortHandle); - NtClose(PortHandle); - printf("%s: Connected port 0x%x closed.\n\n", MyName, PortHandle); - break; - } - } - } - return EXIT_SUCCESS; -} - - -/* EOF */ diff --git a/reactos/apps/tests/lpc/lpctest.h b/reactos/apps/tests/lpc/lpctest.h deleted file mode 100644 index 6e6520844e8..00000000000 --- a/reactos/apps/tests/lpc/lpctest.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef _LPCTEST_H -#define _LPCTEST_H -#define TEST_PORT_NAME "\\TestPort" -#define TEST_PORT_NAME_U L"\\TestPort" -#endif diff --git a/reactos/apps/tests/lpc/makefile b/reactos/apps/tests/lpc/makefile deleted file mode 100644 index b18cfec95b6..00000000000 --- a/reactos/apps/tests/lpc/makefile +++ /dev/null @@ -1,52 +0,0 @@ -# -# -# -PATH_TO_TOP = ../../.. - -include $(PATH_TO_TOP)/config -include $(PATH_TO_TOP)/rules.mak - -SRV_OBJECTS= lpcsrv.o -CLT_OBJECTS= lpcclt.o - -PROGS= lpcsrv.exe lpcclt.exe - -CFLAGS = $(STD_CFLAGS) - -LIBS = $(SDK_PATH_LIB)/kernel32.a \ - $(SDK_PATH_LIB)/ntdll.a - -all: $(PROGS) - -.phony: all - -implib: - -clean: - - $(RM) lpcsrv.o lpcsrv.exe lpcsrv.sym lpcclt.o lpcclt.exe lpcclt.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 - -lpcsrv.exe: $(SRV_OBJECTS) $(LIBS) - $(CC) $(SRV_OBJECTS) $(LIBS) -o lpcsrv.exe - $(NM) --numeric-sort lpcsrv.exe > lpcsrv.sym - -lpcclt.exe: $(CLT_OBJECTS) $(LIBS) - $(CC) $(CLT_OBJECTS) $(LIBS) -o lpcclt.exe - $(NM) --numeric-sort lpcclt.exe > lpcclt.sym diff --git a/reactos/apps/tests/map_dup_inherit/.cvsignore b/reactos/apps/tests/map_dup_inherit/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/map_dup_inherit/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/map_dup_inherit/makefile b/reactos/apps/tests/map_dup_inherit/makefile deleted file mode 100644 index e93605e64f7..00000000000 --- a/reactos/apps/tests/map_dup_inherit/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 = map_dup_inherit - -TARGET_SDKLIBS = kernel32.a gdi32.a ntdll.a - -TARGET_OBJECTS = $(TARGET_NAME).o - -TARGET_CFLAGS = -Wall -Werror - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/map_dup_inherit/map_dup_inherit.c b/reactos/apps/tests/map_dup_inherit/map_dup_inherit.c deleted file mode 100644 index 2abd2cac14b..00000000000 --- a/reactos/apps/tests/map_dup_inherit/map_dup_inherit.c +++ /dev/null @@ -1,91 +0,0 @@ -#include -#include -#include -#include - -/* This tests the ability of the target win32 to create an anonymous file - * mapping, create a mapping view with MapViewOfFile, and then realize the - * pages with VirtualAlloc. - */ - -int main( int argc, char **argv ) { - HANDLE file_view; - void *file_map; - int *x; - - fprintf( stderr, "%lu: Starting\n", GetCurrentProcessId() ); - - if( argc == 2 ) { - file_map = (void *)atoi(argv[1]); - } else { - file_map = CreateFileMapping( INVALID_HANDLE_VALUE, - NULL, - PAGE_READWRITE | SEC_RESERVE, - 0, 0x1000, NULL ); - if( !SetHandleInformation( file_map, - HANDLE_FLAG_INHERIT, - HANDLE_FLAG_INHERIT ) ) { - fprintf( stderr, "%lu: Could not make handle inheritable.\n", - GetCurrentProcessId() ); - return 100; - } - } - - if( !file_map ) { - fprintf( stderr, "%lu: Could not create anonymous file map.\n", - GetCurrentProcessId() ); - return 1; - } - - file_view = MapViewOfFile( file_map, - FILE_MAP_WRITE, - 0, - 0, - 0x1000 ); - - if( !file_view ) { - fprintf( stderr, "%lu: Could not map view of file.\n", - GetCurrentProcessId() ); - return 2; - } - - if( !VirtualAlloc( file_view, 0x1000, MEM_COMMIT, PAGE_READWRITE ) ) { - fprintf( stderr, "%lu: VirtualAlloc failed to realize the page.\n", - GetCurrentProcessId() ); - return 3; - } - - x = (int *)file_view; - x[0] = 0x12345678; - - if( x[0] != 0x12345678 ) { - fprintf( stderr, "%lu: Can't write to the memory (%08x != 0x12345678)\n", - GetCurrentProcessId(), x[0] ); - return 4; - } - - if( argc == 1 ) { - STARTUPINFO si; - PROCESS_INFORMATION pi; - char cmdline[1000]; - - memset( &si, 0, sizeof( si ) ); - memset( &pi, 0, sizeof( pi ) ); - - sprintf(cmdline,"%s %d", argv[0], (int)file_map); - if( !CreateProcess(NULL, cmdline, NULL, NULL, TRUE, 0, NULL, NULL, - &si, &pi ) ) { - fprintf( stderr, "%lu: Could not create child process.\n", - GetCurrentProcessId() ); - return 5; - } - - if( WaitForSingleObject( pi.hThread, INFINITE ) != WAIT_OBJECT_0 ) { - fprintf( stderr, "%lu: Failed to wait for child process to terminate.\n", - GetCurrentProcessId() ); - return 6; - } - } - - return 0; -} diff --git a/reactos/apps/tests/mdi/.cvsignore b/reactos/apps/tests/mdi/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/mdi/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/mdi/makefile b/reactos/apps/tests/mdi/makefile deleted file mode 100644 index 2f3bf94e98a..00000000000 --- a/reactos/apps/tests/mdi/makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $Id: makefile,v 1.3 2004/09/22 22:25:12 sedwards Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = no - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = mdi - -TARGET_SDKLIBS = kernel32.a gdi32.a ntdll.a comctl32.a comdlg32.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/mdi/mdi.c b/reactos/apps/tests/mdi/mdi.c deleted file mode 100644 index ecbbbea64b0..00000000000 --- a/reactos/apps/tests/mdi/mdi.c +++ /dev/null @@ -1,523 +0,0 @@ -/* - Thanks to theForger from winprog.org -*/ -#include -#include - -#include -#include "resource.h" - -const char g_szClassName[] = "myWindowClass"; -const char g_szChildClassName[] = "myMDIChildWindowClass"; - -#define IDC_MAIN_MDI 101 -#define IDC_MAIN_TOOL 102 -#define IDC_MAIN_STATUS 103 - -#define IDC_CHILD_EDIT 101 - -#define ID_MDI_FIRSTCHILD 50000 - -HWND g_hMDIClient = NULL; -HWND g_hMainWindow = NULL; - -BOOL LoadTextFileToEdit(HWND hEdit, LPCTSTR pszFileName) -{ - HANDLE hFile; - BOOL bSuccess = FALSE; - - hFile = CreateFile(pszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, - OPEN_EXISTING, 0, NULL); - if(hFile != INVALID_HANDLE_VALUE) - { - DWORD dwFileSize; - - dwFileSize = GetFileSize(hFile, NULL); - if(dwFileSize != 0xFFFFFFFF) - { - LPSTR pszFileText; - - pszFileText = GlobalAlloc(GPTR, dwFileSize + 1); - if(pszFileText != NULL) - { - DWORD dwRead; - - if(ReadFile(hFile, pszFileText, dwFileSize, &dwRead, NULL)) - { - pszFileText[dwFileSize] = 0; // Add null terminator - if(SetWindowText(hEdit, pszFileText)) - bSuccess = TRUE; // It worked! - } - GlobalFree(pszFileText); - } - } - CloseHandle(hFile); - } - return bSuccess; -} - -BOOL SaveTextFileFromEdit(HWND hEdit, LPCTSTR pszFileName) -{ - HANDLE hFile; - BOOL bSuccess = FALSE; - - hFile = CreateFile(pszFileName, GENERIC_WRITE, 0, NULL, - CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - if(hFile != INVALID_HANDLE_VALUE) - { - DWORD dwTextLength; - - dwTextLength = GetWindowTextLength(hEdit); - // No need to bother if there's no text. - if(dwTextLength > 0) - { - LPSTR pszText; - DWORD dwBufferSize = dwTextLength + 1; - - pszText = GlobalAlloc(GPTR, dwBufferSize); - if(pszText != NULL) - { - if(GetWindowText(hEdit, pszText, dwBufferSize)) - { - DWORD dwWritten; - - if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL)) - bSuccess = TRUE; - } - GlobalFree(pszText); - } - } - CloseHandle(hFile); - } - return bSuccess; -} - -void DoFileOpen(HWND hwnd) -{ - OPENFILENAME ofn; - char szFileName[MAX_PATH] = ""; - - ZeroMemory(&ofn, sizeof(ofn)); - - ofn.lStructSize = sizeof(ofn); - ofn.hwndOwner = hwnd; - ofn.lpstrFilter = "Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0"; - ofn.lpstrFile = szFileName; - ofn.nMaxFile = MAX_PATH; - ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; - ofn.lpstrDefExt = "txt"; - - if(GetOpenFileName(&ofn)) - { - HWND hEdit = GetDlgItem(hwnd, IDC_CHILD_EDIT); - if(LoadTextFileToEdit(hEdit, szFileName)) - { - SendDlgItemMessage(g_hMainWindow, IDC_MAIN_STATUS, SB_SETTEXT, 0, (LPARAM)"Opened..."); - SendDlgItemMessage(g_hMainWindow, IDC_MAIN_STATUS, SB_SETTEXT, 1, (LPARAM)szFileName); - - SetWindowText(hwnd, szFileName); - } - } -} - -void DoFileSave(HWND hwnd) -{ - OPENFILENAME ofn; - char szFileName[MAX_PATH] = ""; - - ZeroMemory(&ofn, sizeof(ofn)); - - ofn.lStructSize = sizeof(ofn); - ofn.hwndOwner = hwnd; - ofn.lpstrFilter = "Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0"; - ofn.lpstrFile = szFileName; - ofn.nMaxFile = MAX_PATH; - ofn.lpstrDefExt = "txt"; - ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; - - if(GetSaveFileName(&ofn)) - { - HWND hEdit = GetDlgItem(hwnd, IDC_CHILD_EDIT); - if(SaveTextFileFromEdit(hEdit, szFileName)) - { - SendDlgItemMessage(g_hMainWindow, IDC_MAIN_STATUS, SB_SETTEXT, 0, (LPARAM)"Saved..."); - SendDlgItemMessage(g_hMainWindow, IDC_MAIN_STATUS, SB_SETTEXT, 1, (LPARAM)szFileName); - - SetWindowText(hwnd, szFileName); - } - } -} - -HWND CreateNewMDIChild(HWND hMDIClient) -{ - MDICREATESTRUCT mcs; - HWND hChild; - - mcs.szTitle = "[Untitled]"; - mcs.szClass = g_szChildClassName; - mcs.hOwner = GetModuleHandle(NULL); - mcs.x = mcs.cx = CW_USEDEFAULT; - mcs.y = mcs.cy = CW_USEDEFAULT; - mcs.style = MDIS_ALLCHILDSTYLES; - - hChild = (HWND)SendMessage(hMDIClient, WM_MDICREATE, 0, (LONG)&mcs); - if(!hChild) - { - MessageBox(hMDIClient, "MDI Child creation failed.", "Oh Oh...", - MB_ICONEXCLAMATION | MB_OK); - } - return hChild; -} - -LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch(msg) - { - case WM_CREATE: - { - HWND hTool; - TBBUTTON tbb[3]; - TBADDBITMAP tbab; - - HWND hStatus; - int statwidths[] = {100, -1}; - - CLIENTCREATESTRUCT ccs; - - // Create MDI Client - - // Find window menu where children will be listed - ccs.hWindowMenu = GetSubMenu(GetMenu(hwnd), 2); - ccs.idFirstChild = ID_MDI_FIRSTCHILD; - - g_hMDIClient = CreateWindowEx(WS_EX_CLIENTEDGE, "mdiclient", NULL, - WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL | WS_VISIBLE, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - hwnd, (HMENU)IDC_MAIN_MDI, GetModuleHandle(NULL), (LPVOID)&ccs); - - if(g_hMDIClient == NULL) - MessageBox(hwnd, "Could not create MDI client.", "Error", MB_OK | MB_ICONERROR); - - // Create Toolbar - - hTool = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, - hwnd, (HMENU)IDC_MAIN_TOOL, GetModuleHandle(NULL), NULL); - if(hTool == NULL) - MessageBox(hwnd, "Could not create tool bar.", "Error", MB_OK | MB_ICONERROR); - - // Send the TB_BUTTONSTRUCTSIZE message, which is required for - // backward compatibility. - SendMessage(hTool, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0); - - tbab.hInst = HINST_COMMCTRL; - tbab.nID = IDB_STD_SMALL_COLOR; - SendMessage(hTool, TB_ADDBITMAP, 0, (LPARAM)&tbab); - - ZeroMemory(tbb, sizeof(tbb)); - tbb[0].iBitmap = STD_FILENEW; - tbb[0].fsState = TBSTATE_ENABLED; - tbb[0].fsStyle = TBSTYLE_BUTTON; - tbb[0].idCommand = ID_FILE_NEW; - - tbb[1].iBitmap = STD_FILEOPEN; - tbb[1].fsState = TBSTATE_ENABLED; - tbb[1].fsStyle = TBSTYLE_BUTTON; - tbb[1].idCommand = ID_FILE_OPEN; - - tbb[2].iBitmap = STD_FILESAVE; - tbb[2].fsState = TBSTATE_ENABLED; - tbb[2].fsStyle = TBSTYLE_BUTTON; - tbb[2].idCommand = ID_FILE_SAVEAS; - - SendMessage(hTool, TB_ADDBUTTONS, sizeof(tbb)/sizeof(TBBUTTON), (LPARAM)&tbb); - - // Create Status bar - - hStatus = CreateWindowEx(0, STATUSCLASSNAME, NULL, - WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP, 0, 0, 0, 0, - hwnd, (HMENU)IDC_MAIN_STATUS, GetModuleHandle(NULL), NULL); - - SendMessage(hStatus, SB_SETPARTS, sizeof(statwidths)/sizeof(int), (LPARAM)statwidths); - SendMessage(hStatus, SB_SETTEXT, 0, (LPARAM)"Hi there :)"); - } - break; - case WM_SIZE: - { - HWND hTool; - RECT rcTool; - int iToolHeight; - - HWND hStatus; - RECT rcStatus; - int iStatusHeight; - - HWND hMDI; - int iMDIHeight; - RECT rcClient; - - // Size toolbar and get height - - hTool = GetDlgItem(hwnd, IDC_MAIN_TOOL); - SendMessage(hTool, TB_AUTOSIZE, 0, 0); - - GetWindowRect(hTool, &rcTool); - iToolHeight = rcTool.bottom - rcTool.top; - - // Size status bar and get height - - hStatus = GetDlgItem(hwnd, IDC_MAIN_STATUS); - SendMessage(hStatus, WM_SIZE, 0, 0); - - GetWindowRect(hStatus, &rcStatus); - iStatusHeight = rcStatus.bottom - rcStatus.top; - - // Calculate remaining height and size edit - - GetClientRect(hwnd, &rcClient); - - iMDIHeight = rcClient.bottom - iToolHeight - iStatusHeight; - - hMDI = GetDlgItem(hwnd, IDC_MAIN_MDI); - SetWindowPos(hMDI, NULL, 0, iToolHeight, rcClient.right, iMDIHeight, SWP_NOZORDER); - } - break; - case WM_CLOSE: - DestroyWindow(hwnd); - break; - case WM_DESTROY: - PostQuitMessage(0); - break; - case WM_COMMAND: - switch(LOWORD(wParam)) - { - case ID_FILE_EXIT: - PostMessage(hwnd, WM_CLOSE, 0, 0); - break; - case ID_FILE_NEW: - CreateNewMDIChild(g_hMDIClient); - break; - case ID_FILE_OPEN: - { - HWND hChild = CreateNewMDIChild(g_hMDIClient); - if(hChild) - { - DoFileOpen(hChild); - } - } - break; - case ID_FILE_CLOSE: - { - HWND hChild = (HWND)SendMessage(g_hMDIClient, WM_MDIGETACTIVE,0,0); - if(hChild) - { - SendMessage(hChild, WM_CLOSE, 0, 0); - } - } - break; - case ID_WINDOW_TILE: - SendMessage(g_hMDIClient, WM_MDITILE, 0, 0); - break; - case ID_WINDOW_CASCADE: - SendMessage(g_hMDIClient, WM_MDICASCADE, 0, 0); - break; - default: - { - if(LOWORD(wParam) >= ID_MDI_FIRSTCHILD) - { - DefFrameProc(hwnd, g_hMDIClient, WM_COMMAND, wParam, lParam); - } - else - { - HWND hChild = (HWND)SendMessage(g_hMDIClient, WM_MDIGETACTIVE,0,0); - if(hChild) - { - SendMessage(hChild, WM_COMMAND, wParam, lParam); - } - } - } - } - break; - default: - return DefFrameProc(hwnd, g_hMDIClient, msg, wParam, lParam); - } - return 0; -} - -LRESULT CALLBACK MDIChildWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch(msg) - { - case WM_CREATE: - { - HFONT hfDefault; - HWND hEdit; - - // Create Edit Control - - hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "", - WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL, - 0, 0, 100, 100, hwnd, (HMENU)IDC_CHILD_EDIT, GetModuleHandle(NULL), NULL); - if(hEdit == NULL) - MessageBox(hwnd, "Could not create edit box.", "Error", MB_OK | MB_ICONERROR); - - hfDefault = GetStockObject(DEFAULT_GUI_FONT); - SendMessage(hEdit, WM_SETFONT, (WPARAM)hfDefault, MAKELPARAM(FALSE, 0)); - } - break; - case WM_MDIACTIVATE: - { - HMENU hMenu, hFileMenu; - UINT EnableFlag; - - hMenu = GetMenu(g_hMainWindow); - if(hwnd == (HWND)lParam) - { //being activated, enable the menus - EnableFlag = MF_ENABLED; - } - else - { //being de-activated, gray the menus - EnableFlag = MF_GRAYED; - } - - EnableMenuItem(hMenu, 1, MF_BYPOSITION | EnableFlag); - EnableMenuItem(hMenu, 2, MF_BYPOSITION | EnableFlag); - - hFileMenu = GetSubMenu(hMenu, 0); - EnableMenuItem(hFileMenu, ID_FILE_SAVEAS, MF_BYCOMMAND | EnableFlag); - - EnableMenuItem(hFileMenu, ID_FILE_CLOSE, MF_BYCOMMAND | EnableFlag); - EnableMenuItem(hFileMenu, ID_FILE_CLOSEALL, MF_BYCOMMAND | EnableFlag); - - DrawMenuBar(g_hMainWindow); - } - break; - case WM_COMMAND: - switch(LOWORD(wParam)) - { - case ID_FILE_OPEN: - DoFileOpen(hwnd); - break; - case ID_FILE_SAVEAS: - DoFileSave(hwnd); - break; - case ID_EDIT_CUT: - SendDlgItemMessage(hwnd, IDC_CHILD_EDIT, WM_CUT, 0, 0); - break; - case ID_EDIT_COPY: - SendDlgItemMessage(hwnd, IDC_CHILD_EDIT, WM_COPY, 0, 0); - break; - case ID_EDIT_PASTE: - SendDlgItemMessage(hwnd, IDC_CHILD_EDIT, WM_PASTE, 0, 0); - break; - } - break; - case WM_SIZE: - { - HWND hEdit; - RECT rcClient; - - // Calculate remaining height and size edit - - GetClientRect(hwnd, &rcClient); - - hEdit = GetDlgItem(hwnd, IDC_CHILD_EDIT); - SetWindowPos(hEdit, NULL, 0, 0, rcClient.right, rcClient.bottom, SWP_NOZORDER); - } - return DefMDIChildProc(hwnd, msg, wParam, lParam); - default: - return DefMDIChildProc(hwnd, msg, wParam, lParam); - - } - return 0; -} - -BOOL SetUpMDIChildWindowClass(HINSTANCE hInstance) -{ - WNDCLASSEX wc; - - wc.cbSize = sizeof(WNDCLASSEX); - wc.style = CS_HREDRAW | CS_VREDRAW; - wc.lpfnWndProc = MDIChildWndProc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = hInstance; - wc.hIcon = LoadIcon(NULL, (LPCTSTR)IDI_APPLICATION); - wc.hCursor = LoadCursor(NULL, (LPCTSTR)IDC_ARROW); - wc.hbrBackground = (HBRUSH)(COLOR_3DFACE+1); - wc.lpszMenuName = NULL; - wc.lpszClassName = g_szChildClassName; - wc.hIconSm = LoadIcon(NULL, (LPCTSTR)IDI_APPLICATION); - - if(!RegisterClassEx(&wc)) - { - MessageBox(0, "Could Not Register Child Window", "Oh Oh...", - MB_ICONEXCLAMATION | MB_OK); - return FALSE; - } - else - return TRUE; -} - - -int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, - LPSTR lpCmdLine, int nCmdShow) -{ - WNDCLASSEX wc; - HWND hwnd; - MSG Msg; - - InitCommonControls(); - - wc.cbSize = sizeof(WNDCLASSEX); - wc.style = 0; - wc.lpfnWndProc = WndProc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = hInstance; - wc.hIcon = LoadIcon(NULL, (LPCTSTR)IDI_APPLICATION); - wc.hCursor = LoadCursor(NULL, (LPCTSTR)IDC_ARROW); - wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); - wc.lpszMenuName = MAKEINTRESOURCE(IDR_MAINMENU); - wc.lpszClassName = g_szClassName; - wc.hIconSm = LoadIcon(NULL, (LPCTSTR)IDI_APPLICATION); - - if(!RegisterClassEx(&wc)) - { - MessageBox(NULL, "Window Registration Failed!", "Error!", - MB_ICONEXCLAMATION | MB_OK); - return 0; - } - - if(!SetUpMDIChildWindowClass(hInstance)) - return 0; - - hwnd = CreateWindowEx( - 0, - g_szClassName, - "MDI Test Application", - WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, - CW_USEDEFAULT, CW_USEDEFAULT, 480, 320, - NULL, NULL, hInstance, NULL); - - if(hwnd == NULL) - { - MessageBox(NULL, "Window Creation Failed!", "Error!", - MB_ICONEXCLAMATION | MB_OK); - return 0; - } - - g_hMainWindow = hwnd; - - ShowWindow(hwnd, nCmdShow); - UpdateWindow(hwnd); - - while(GetMessage(&Msg, NULL, 0, 0) > 0) - { - if (!TranslateMDISysAccel(g_hMDIClient, &Msg)) - { - TranslateMessage(&Msg); - DispatchMessage(&Msg); - } - } - return Msg.wParam; -} diff --git a/reactos/apps/tests/mdi/mdi.rc b/reactos/apps/tests/mdi/mdi.rc deleted file mode 100644 index c22ad1f55ae..00000000000 --- a/reactos/apps/tests/mdi/mdi.rc +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include -#include "resource.h" - -IDR_MAINMENU MENU DISCARDABLE -BEGIN - POPUP "&File" - BEGIN - MENUITEM "&New", ID_FILE_NEW - MENUITEM "&Open...", ID_FILE_OPEN - MENUITEM "Save &As...", ID_FILE_SAVEAS, GRAYED - MENUITEM SEPARATOR - MENUITEM "&Close", ID_FILE_CLOSE, GRAYED - MENUITEM SEPARATOR - MENUITEM "E&xit", ID_FILE_EXIT - END - POPUP "&Edit", GRAYED - BEGIN - MENUITEM "C&ut", ID_EDIT_CUT - MENUITEM "&Copy", ID_EDIT_COPY - MENUITEM "&Paste", ID_EDIT_PASTE - END - POPUP "&Window", GRAYED - BEGIN - MENUITEM "&Tile", ID_WINDOW_TILE - MENUITEM "&Cascade", ID_WINDOW_CASCADE - END -END - - diff --git a/reactos/apps/tests/mdi/resource.h b/reactos/apps/tests/mdi/resource.h deleted file mode 100644 index 3ea6b7e9560..00000000000 --- a/reactos/apps/tests/mdi/resource.h +++ /dev/null @@ -1,27 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by app_four.rc -// -#define IDR_MAINMENU 102 -#define ID_FILE_EXIT 40001 -#define ID_FILE_NEW 40002 -#define ID_FILE_OPEN 40003 -#define ID_FILE_SAVEAS 40005 -#define ID_WINDOW_CASCADE 40008 -#define ID_WINDOW_TILE 40009 -#define ID_FILE_CLOSE 40010 -#define ID_FILE_CLOSEALL 40011 -#define ID_EDIT_CUT 40015 -#define ID_EDIT_COPY 40016 -#define ID_EDIT_PASTE 40017 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40020 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/reactos/apps/tests/miditest/.cvsignore b/reactos/apps/tests/miditest/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/miditest/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/miditest/makefile b/reactos/apps/tests/miditest/makefile deleted file mode 100644 index 1f08718d895..00000000000 --- a/reactos/apps/tests/miditest/makefile +++ /dev/null @@ -1,23 +0,0 @@ -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = miditest - -TARGET_SDKLIBS = winmm.a - -TARGET_GCCLIBS = - -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/miditest/miditest.c b/reactos/apps/tests/miditest/miditest.c deleted file mode 100644 index 1310be32569..00000000000 --- a/reactos/apps/tests/miditest/miditest.c +++ /dev/null @@ -1,52 +0,0 @@ -#include -#include -#include - -// WINE's mmsystem.h doesn't seem to define these properly: - -#define MIDIOUTCAPS MIDIOUTCAPSA -#define MIDIINCAPS MIDIINCAPSA -#undef midiOutGetDevCaps -#define midiOutGetDevCaps midiOutGetDevCapsA -#undef midiInGetDevCaps -#define midiInGetDevCaps midiInGetDevCapsA - - -int main() -{ - UINT outs = midiOutGetNumDevs(); -// UINT ins = midiInGetNumDevs(); - - MIDIOUTCAPS outcaps; -// MIDIINCAPS incaps; - - int c; - - printf("MIDI output devices: %d\n", outs); - - for (c = 0; c < outs; c ++) - { - if (midiOutGetDevCaps(c, &outcaps, sizeof(MIDIOUTCAPS)) == MMSYSERR_NOERROR) - printf("Device #%d: %s\n", c, outcaps.szPname); - } - - printf("Opening MIDI output #0\n"); - - HMIDIOUT Handle = NULL; - UINT Result = midiOutOpen(&Handle, 0, 0, 0, CALLBACK_NULL); - printf("Result == %d Handle == %d\n", Result, (int)Handle); - - // play something: - midiOutShortMsg(Handle, 0x007f3090); - -/* - printf("\nMIDI input devices: %d\n", ins); - - for (c = 0; c < ins; c ++) - { - midiInGetDevCaps(c, &incaps, sizeof(incaps)); - printf("Device #%d: %s\n", c, incaps.szPname); - } -*/ - return 0; -} diff --git a/reactos/apps/tests/miditest/miditest.rc b/reactos/apps/tests/miditest/miditest.rc deleted file mode 100644 index c22ad1f55ae..00000000000 --- a/reactos/apps/tests/miditest/miditest.rc +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include -#include "resource.h" - -IDR_MAINMENU MENU DISCARDABLE -BEGIN - POPUP "&File" - BEGIN - MENUITEM "&New", ID_FILE_NEW - MENUITEM "&Open...", ID_FILE_OPEN - MENUITEM "Save &As...", ID_FILE_SAVEAS, GRAYED - MENUITEM SEPARATOR - MENUITEM "&Close", ID_FILE_CLOSE, GRAYED - MENUITEM SEPARATOR - MENUITEM "E&xit", ID_FILE_EXIT - END - POPUP "&Edit", GRAYED - BEGIN - MENUITEM "C&ut", ID_EDIT_CUT - MENUITEM "&Copy", ID_EDIT_COPY - MENUITEM "&Paste", ID_EDIT_PASTE - END - POPUP "&Window", GRAYED - BEGIN - MENUITEM "&Tile", ID_WINDOW_TILE - MENUITEM "&Cascade", ID_WINDOW_CASCADE - END -END - - diff --git a/reactos/apps/tests/mktime/.cvsignore b/reactos/apps/tests/mktime/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/mktime/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/mktime/makefile b/reactos/apps/tests/mktime/makefile deleted file mode 100644 index f0116f5ce39..00000000000 --- a/reactos/apps/tests/mktime/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 = mktime - -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/mktime/mktime.c b/reactos/apps/tests/mktime/mktime.c deleted file mode 100644 index f5cf40bb2a9..00000000000 --- a/reactos/apps/tests/mktime/mktime.c +++ /dev/null @@ -1,29 +0,0 @@ - -#include -#include - -struct tm time_str; - -char daybuf[20]; - -int main(void) -{ - printf("Testing mktime() by asking\n"); - printf("What day of the week is July 4, 2001?\n"); - - time_str.tm_year = 2001 - 1900; - time_str.tm_mon = 7 - 1; - time_str.tm_mday = 4; - time_str.tm_hour = 0; - time_str.tm_min = 0; - time_str.tm_sec = 1; - time_str.tm_isdst = -1; - if (mktime(&time_str) == -1) - (void)puts("-unknown-"); - else { - (void)strftime(daybuf, sizeof(daybuf), "%A", &time_str); - (void)puts(daybuf); - } - return 0; -} - diff --git a/reactos/apps/tests/moztest/.cvsignore b/reactos/apps/tests/moztest/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/moztest/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/moztest/makefile b/reactos/apps/tests/moztest/makefile deleted file mode 100644 index 0d253db8cd7..00000000000 --- a/reactos/apps/tests/moztest/makefile +++ /dev/null @@ -1,21 +0,0 @@ -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = moztest - -TARGET_SDKLIBS = ntdll.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/moztest/moztest.c b/reactos/apps/tests/moztest/moztest.c deleted file mode 100644 index 3c4ef6872bc..00000000000 --- a/reactos/apps/tests/moztest/moztest.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Mozilla Test - * Copyright (C) 2004 Filip Navara - */ - -#include -#include - -ULONG DbgPrint(PCH Format,...); - -#define DBG(x) \ - printf("%s:%i - %s", __FILE__, __LINE__, x); \ - DbgPrint("%s:%i - %s", __FILE__, __LINE__, x); - -int SocketTest() -{ - /* - * A socket pair is often used for interprocess communication, - * so we need to make sure neither socket is associated with - * the I/O completion port; otherwise it can't be used by a - * child process. - * - * The default implementation below cannot be used for NT - * because PR_Accept would have associated the I/O completion - * port with the listening and accepted sockets. - */ - SOCKET listenSock; - SOCKET osfd[2]; - struct sockaddr_in selfAddr, peerAddr; - int addrLen; - WORD wVersionRequested; - WSADATA wsaData; - int err; - - /* - * Initialization. - */ - - wVersionRequested = MAKEWORD( 2, 2 ); - - DBG("Calling WSAStartup\n"); - err = WSAStartup( wVersionRequested, &wsaData ); - if ( err != 0 ) { - /* Tell the user that we could not find a usable */ - /* WinSock DLL. */ - DBG("WSAStartup failed\n"); - return 1; - } - - /* Confirm that the WinSock DLL supports 2.2.*/ - /* Note that if the DLL supports versions greater */ - /* than 2.2 in addition to 2.2, it will still return */ - /* 2.2 in wVersion since that is the version we */ - /* requested. */ - - if ( LOBYTE( wsaData.wVersion ) != 2 || - HIBYTE( wsaData.wVersion ) != 2 ) { - /* Tell the user that we could not find a usable */ - /* WinSock DLL. */ - DBG("WSAStartup version unacceptable\n"); - WSACleanup( ); - return 1; - } - - /* The WinSock DLL is acceptable. Proceed. */ - - DBG("Calling socket\n"); - osfd[0] = osfd[1] = INVALID_SOCKET; - listenSock = socket(AF_INET, SOCK_STREAM, 0); - if (listenSock == INVALID_SOCKET) { - DBG("socket failed\n"); - goto failed; - } - - selfAddr.sin_family = AF_INET; - selfAddr.sin_port = 0; - selfAddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); /* BugZilla: 35408 */ - addrLen = sizeof(selfAddr); - DBG("Calling bind\n"); - if (bind(listenSock, (struct sockaddr *) &selfAddr, - addrLen) == SOCKET_ERROR) { - DBG("bind failed\n"); - goto failed; - } - - DBG("Calling getsockname\n"); - if (getsockname(listenSock, (struct sockaddr *) &selfAddr, - &addrLen) == SOCKET_ERROR) { - DBG("getsockname failed\n"); - goto failed; - } - - DBG("Calling listen\n"); - if (listen(listenSock, 5) == SOCKET_ERROR) { - DBG("listen failed\n"); - goto failed; - } - - DBG("Calling socket\n"); - osfd[0] = socket(AF_INET, SOCK_STREAM, 0); - if (osfd[0] == INVALID_SOCKET) { - DBG("socket failed\n"); - goto failed; - } - selfAddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - - /* - * Only a thread is used to do the connect and accept. - * I am relying on the fact that connect returns - * successfully as soon as the connect request is put - * into the listen queue (but before accept is called). - * This is the behavior of the BSD socket code. If - * connect does not return until accept is called, we - * will need to create another thread to call connect. - */ - DBG("Calling connect\n"); - if (connect(osfd[0], (struct sockaddr *) &selfAddr, - addrLen) == SOCKET_ERROR) { - DBG("connect failed\n"); - goto failed; - } - - /* - * A malicious local process may connect to the listening - * socket, so we need to verify that the accepted connection - * is made from our own socket osfd[0]. - */ - DBG("Calling getsockname\n"); - if (getsockname(osfd[0], (struct sockaddr *) &selfAddr, - &addrLen) == SOCKET_ERROR) { - DBG("getsockname failed\n"); - goto failed; - } - - DBG("Calling accept\n"); - osfd[1] = accept(listenSock, (struct sockaddr *) &peerAddr, &addrLen); - if (osfd[1] == INVALID_SOCKET) { - DBG("accept failed\n"); - goto failed; - } - if (peerAddr.sin_port != selfAddr.sin_port) { - /* the connection we accepted is not from osfd[0] */ - DBG("peerAddr.sin_port != selfAddr.sin_port\n"); - goto failed; - } - - DBG("Hurray!\n"); - - closesocket(listenSock); - - closesocket(osfd[0]); - closesocket(osfd[1]); - - WSACleanup(); - - return 0; - -failed: - if (listenSock != INVALID_SOCKET) { - closesocket(listenSock); - } - if (osfd[0] != INVALID_SOCKET) { - closesocket(osfd[0]); - } - if (osfd[1] != INVALID_SOCKET) { - closesocket(osfd[1]); - } - - WSACleanup(); - - return 1; -} - -int VirtualTest() -{ - DWORD dwErr; - SYSTEM_INFO si; - HANDLE hMap; - PBYTE pBufferStart; - PCHAR pszFileName = "test.txt"; - ULONG dwMaxSize = strlen(pszFileName); - - DBG("Calling CreateFileMappingA\n"); - hMap = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, - PAGE_READWRITE | SEC_RESERVE, 0, dwMaxSize, pszFileName); - if (!hMap) - { - DBG("CreateFileMappingA failed\n"); - return 1; - } - - dwErr = GetLastError(); - DBG("Calling MapViewOfFile\n"); - pBufferStart = (BYTE *)MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, 0); - if (!pBufferStart) - { - DBG("MapViewOfFile failed\n"); - return 1; - } - - GetSystemInfo(&si); - - if (dwErr == ERROR_ALREADY_EXISTS) - { - DBG("MapViewOfFile returned ERROR_ALREADY_EXISTS\n"); - DBG("This really shouldn't happen, but it's not fatal.\n"); - UnmapViewOfFile(pBufferStart); - CloseHandle(hMap); - return 1; - } - else - { - DBG("Calling VirtualAlloc\n"); - if (!VirtualAlloc(pBufferStart, si.dwPageSize, MEM_COMMIT, PAGE_READWRITE)) - { - DBG("VirtualAlloc failed\n"); - UnmapViewOfFile(pBufferStart); - CloseHandle(hMap); - return 1; - } - } - - DBG("Hurray!\n"); - - UnmapViewOfFile(pBufferStart); - CloseHandle(hMap); - - return 0; -} - -int main(int argc, char **argv) -{ - if (argc != 2) - { - printf("Usage: %s test_name\n\n", argv[0]); - printf("Valid test names:\n"); - printf("\tsocket\n"); - printf("\tvirtual\n"); - return 0; - } - - if (!stricmp(argv[1], "socket")) - return SocketTest(); - if (!stricmp(argv[1], "virtual")) - return VirtualTest(); - - printf("Test '%s' doesn't exist\n", argv[1]); - - return 0; -} diff --git a/reactos/apps/tests/mstest/.cvsignore b/reactos/apps/tests/mstest/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/mstest/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/mstest/Makefile b/reactos/apps/tests/mstest/Makefile deleted file mode 100644 index ea0c804c217..00000000000 --- a/reactos/apps/tests/mstest/Makefile +++ /dev/null @@ -1,52 +0,0 @@ -# -# -# -PATH_TO_TOP = ../../.. - -include $(PATH_TO_TOP)/config -include $(PATH_TO_TOP)/rules.mak - -SRV_OBJECTS = msserver.o -CLT_OBJECTS = msclient.o - -PROGS = msserver.exe msclient.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 - -msserver.exe: $(SRV_OBJECTS) $(LIBS) - $(CC) $(SRV_OBJECTS) $(LIBS) -o msserver.exe - $(NM) --numeric-sort msserver.exe > msserver.sym - -msclient.exe: $(CLT_OBJECTS) $(LIBS) - $(CC) $(CLT_OBJECTS) $(LIBS) -o msclient.exe - $(NM) --numeric-sort msclient.exe > msclient.sym diff --git a/reactos/apps/tests/mstest/msclient.c b/reactos/apps/tests/mstest/msclient.c deleted file mode 100644 index 873148fa083..00000000000 --- a/reactos/apps/tests/mstest/msclient.c +++ /dev/null @@ -1,46 +0,0 @@ -#include -#include -#include -#include -#include - -#define BUFSIZE 1024 -#define MAILSLOT_TIMEOUT 1000 - - -int main(int argc, char *argv[]) -{ - HANDLE hMailslot; - LPSTR lpszMailslotName = "\\\\.\\MAILSLOT\\mymailslot"; - LPSTR lpszTestMessage = "Mailslot test message!"; - DWORD cbLength, cbWritten; - - hMailslot = CreateFile(lpszMailslotName, - GENERIC_WRITE, - FILE_SHARE_READ, - (LPSECURITY_ATTRIBUTES)NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - (HANDLE)NULL); - printf("hMailslot %x\n", (DWORD)hMailslot); - if (hMailslot == INVALID_HANDLE_VALUE) - { - printf("CreateFile() failed\n"); - return 0; - } - - cbLength = (ULONG)strlen(lpszTestMessage)+1; - - WriteFile(hMailslot, - lpszTestMessage, - cbLength, - &cbWritten, - NULL); - - CloseHandle(hMailslot); - - return 0; -} - -/* EOF */ - diff --git a/reactos/apps/tests/mstest/msserver.c b/reactos/apps/tests/mstest/msserver.c deleted file mode 100644 index 939c0aa93e9..00000000000 --- a/reactos/apps/tests/mstest/msserver.c +++ /dev/null @@ -1,40 +0,0 @@ - - -#include - - -int main(int argc, char *argv[]) -{ - HANDLE hMailslot; - CHAR chBuf[512]; - BOOL fResult; - DWORD cbRead; - LPTSTR lpszMailslotName = "\\\\.\\mailslot\\mymailslot"; - - hMailslot = CreateMailslot(lpszMailslotName, - 512, - MAILSLOT_WAIT_FOREVER, - NULL); -for (;;) -{ - fResult = ReadFile(hMailslot, - chBuf, - 512, - &cbRead, - NULL); - if (fResult == FALSE) - { - printf("ReadFile() failed!\n"); - CloseHandle(hMailslot); - return 0; - } - - printf("Data read: %s\n", chBuf); -} - - CloseHandle(hMailslot); - - return 0; -} - -/* EOF */ diff --git a/reactos/apps/tests/multithrdwin/.cvsignore b/reactos/apps/tests/multithrdwin/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/multithrdwin/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/multithrdwin/makefile b/reactos/apps/tests/multithrdwin/makefile deleted file mode 100644 index 2b30a8f4428..00000000000 --- a/reactos/apps/tests/multithrdwin/makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $Id: makefile,v 1.2 2004/03/11 14:44:48 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = multithrdwin - -TARGET_SDKLIBS = kernel32.a gdi32.a ntdll.a - -TARGET_OBJECTS = $(TARGET_NAME).o - -TARGET_CFLAGS = -Wall -Werror - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/multithrdwin/multithrdwin.c b/reactos/apps/tests/multithrdwin/multithrdwin.c deleted file mode 100644 index fa7e8385bbd..00000000000 --- a/reactos/apps/tests/multithrdwin/multithrdwin.c +++ /dev/null @@ -1,236 +0,0 @@ -#include -#include - -typedef struct _THRDCREATEWIN -{ - HANDLE hThread; - DWORD ThreadId; - LPSTR Caption; - HWND *Parent; - HWND Window; - DWORD Style; - POINT Position; - SIZE Size; -} THRDCREATEWIN, *PTHRDCREATEWIN; - -static HINSTANCE hAppInstance; -static HANDLE WinCreatedEvent; -static THRDCREATEWIN wnds[3]; - -LRESULT WINAPI MultiWndProc(HWND, UINT, WPARAM, LPARAM); - -DWORD WINAPI -WindowThreadProc(LPVOID lpParameter) -{ - MSG msg; - char caption[64]; - PTHRDCREATEWIN cw = (PTHRDCREATEWIN)lpParameter; - - sprintf(caption, cw->Caption, GetCurrentThreadId()); - - cw->Window = CreateWindow("MultiClass", - caption, - cw->Style | WS_VISIBLE, - cw->Position.x, - cw->Position.y, - cw->Size.cx, - cw->Size.cy, - (cw->Parent ? *(cw->Parent) : 0), - NULL, - hAppInstance, - NULL); - - SetEvent(WinCreatedEvent); - - if(!cw->Window) - { - fprintf(stderr, "CreateWindow failed (last error 0x%lX)\n", - GetLastError()); - return 1; - } - CreateWindow("BUTTON","Sleep",WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_GROUP|BS_PUSHBUTTON, 10, 10, 70, 23, cw->Window, (PVOID)1, hAppInstance, NULL); - CreateWindow("BUTTON","1",WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_GROUP|BS_PUSHBUTTON, 83, 10, 20, 23, cw->Window, (PVOID)2, hAppInstance, NULL); - CreateWindow("BUTTON","2",WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_GROUP|BS_PUSHBUTTON, 105, 10, 20, 23, cw->Window, (PVOID)3, hAppInstance, NULL); - CreateWindow("BUTTON","3",WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_GROUP|BS_PUSHBUTTON, 127, 10, 20, 23, cw->Window, (PVOID)4, hAppInstance, NULL); - while(GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - return 0; -} - -int WINAPI -WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpszCmdLine, - int nCmdShow) -{ - WNDCLASS wc; - int i; - HANDLE Threads[3]; - - hAppInstance = hInstance; - - WinCreatedEvent = CreateEvent(NULL, - FALSE, - FALSE, - NULL); - - if(!WinCreatedEvent) - { - fprintf(stderr, "Failed to create event (last error 0x%lX)\n", - GetLastError()); - return 1; - } - - wc.lpszClassName = "MultiClass"; - wc.lpfnWndProc = MultiWndProc; - wc.style = CS_VREDRAW | CS_HREDRAW; - wc.hInstance = hInstance; - wc.hIcon = LoadIcon(NULL, (LPCTSTR) IDI_APPLICATION); - wc.hCursor = LoadCursor(NULL, (LPCTSTR) IDC_ARROW); - wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1); - 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); - } - - wnds[0].Caption = "TopLevel1 (ThreadID: %d)"; - wnds[0].Parent = NULL; - wnds[0].Style = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; - wnds[0].Position.x = wnds[0].Position.y = 0; - wnds[0].Size.cx = 320; - wnds[0].Size.cy = 240; - - wnds[1].Caption = "Child1 of TopLevel1 (ThreadID: %d)"; - wnds[1].Parent = &wnds[0].Window; - wnds[1].Style = WS_CHILD | WS_BORDER | WS_CAPTION | WS_VISIBLE | WS_SYSMENU | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; - wnds[1].Position.x = 20; - wnds[1].Position.y = 120; - wnds[1].Size.cx = wnds[1].Size.cy = 240; - - wnds[2].Caption = "TopLevel2 (ThreadID: %d)"; - wnds[2].Parent = NULL; - wnds[2].Style = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; - wnds[2].Position.x = 400; - wnds[2].Position.y = 0; - wnds[2].Size.cx = 160; - wnds[2].Size.cy = 490; - - for(i = 0; i < (sizeof(wnds) / sizeof(THRDCREATEWIN)); i++) - { - wnds[i].hThread = CreateThread(NULL, - 0, - WindowThreadProc, - &wnds[i], - 0, - &wnds[i].ThreadId); - Threads[i] = wnds[i].hThread; - if(!wnds[i].hThread) - { - fprintf(stderr, "CreateThread #%i failed (last error 0x%lX)\n", - i, GetLastError()); - return 1; - } - WaitForSingleObject(WinCreatedEvent, INFINITE); - } - - WaitForMultipleObjects(sizeof(Threads) / sizeof(HANDLE), &Threads[0], TRUE, INFINITE); - - UnregisterClass("MultiClass", hInstance); - - return 0; -} - -LRESULT CALLBACK MultiWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - PAINTSTRUCT ps; - HDC hDC; - RECT Client; - HBRUSH Brush; - DWORD Ret; - - static COLORREF Colors[] = - { - RGB(0x00, 0x00, 0x00), - RGB(0x80, 0x00, 0x00), - RGB(0x00, 0x80, 0x00), - RGB(0x00, 0x00, 0x80), - RGB(0x80, 0x80, 0x00), - RGB(0x80, 0x00, 0x80), - RGB(0x00, 0x80, 0x80), - RGB(0x80, 0x80, 0x80), - RGB(0xff, 0x00, 0x00), - RGB(0x00, 0xff, 0x00), - RGB(0x00, 0x00, 0xff), - RGB(0xff, 0xff, 0x00), - RGB(0xff, 0x00, 0xff), - RGB(0x00, 0xff, 0xff), - RGB(0xff, 0xff, 0xff) - }; - static unsigned CurrentColor = 0; - - switch(msg) - { - case WM_PAINT: - hDC = BeginPaint(hWnd, &ps); - GetClientRect(hWnd, &Client); - Brush = CreateSolidBrush(Colors[CurrentColor]); - FillRect(hDC, &Client, Brush); - DeleteObject(Brush); - CurrentColor++; - if (sizeof(Colors) / sizeof(Colors[0]) <= CurrentColor) - { - CurrentColor = 0; - } - EndPaint(hWnd, &ps); - break; - - case WM_COMMAND: - switch(LOWORD(wParam)) - { - case 1: - Sleep(20000); - break; - case 2: - case 3: - case 4: - if(SendMessageTimeout(wnds[LOWORD(wParam) - 2].Window, WM_NULL, 0, 0, SMTO_ABORTIFHUNG, 1000, &Ret)) - { - DbgPrint("SendMessageTimeout() OK"); - MessageBox(hWnd, "SendMessageTimeout() OK", NULL, 0); - } - else - { - if(GetLastError() == ERROR_TIMEOUT) - { - DbgPrint("SendMessageTimeout() Timeout"); - MessageBox(hWnd, "SendMessageTimeout() Timeout", NULL, 0); - } - else - { - DbgPrint("SendMessageTimeout() Failed"); - MessageBox(hWnd, "SendMessageTimeout() Failed", NULL, 0); - } - } - break; - } - break; - - case WM_DESTROY: - PostQuitMessage(0); - break; - - default: - return DefWindowProc(hWnd, msg, wParam, lParam); - } - - return 0; -} diff --git a/reactos/apps/tests/multiwin/.cvsignore b/reactos/apps/tests/multiwin/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/multiwin/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/multiwin/makefile b/reactos/apps/tests/multiwin/makefile deleted file mode 100644 index 4d67980563c..00000000000 --- a/reactos/apps/tests/multiwin/makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $Id: makefile,v 1.2 2003/11/14 17:13:18 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = multiwin - -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/multiwin/multiwin.c b/reactos/apps/tests/multiwin/multiwin.c deleted file mode 100644 index 12b6b26a5bc..00000000000 --- a/reactos/apps/tests/multiwin/multiwin.c +++ /dev/null @@ -1,147 +0,0 @@ -#include -#include - -static UINT WindowCount; -LRESULT WINAPI MultiWndProc(HWND, UINT, WPARAM, LPARAM); - -int WINAPI -WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpszCmdLine, - int nCmdShow) -{ - WNDCLASS wc; - MSG msg; - HWND hWnd1; - HWND hWnd2; - HWND hWndChild; - - wc.lpszClassName = "MultiClass"; - wc.lpfnWndProc = MultiWndProc; - wc.style = CS_VREDRAW | CS_HREDRAW; - wc.hInstance = hInstance; - wc.hIcon = LoadIcon(NULL, (LPCTSTR) IDI_APPLICATION); - wc.hCursor = LoadCursor(NULL, (LPCTSTR) IDC_ARROW); - wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1); - 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); - } - - hWnd1 = CreateWindow("MultiClass", - "TopLevel1", - WS_OVERLAPPEDWINDOW, - 0, - 0, - 320, - 240, - NULL, - NULL, - hInstance, - NULL); - - hWndChild = CreateWindow("MultiClass", - "Child1 of TopLevel1", - WS_CHILD | WS_BORDER | WS_CAPTION | WS_VISIBLE | WS_SYSMENU, - 20, - 120, - 200, - 200, - hWnd1, - NULL, - hInstance, - NULL); - - hWnd2 = CreateWindow("MultiClass", - "TopLevel2", - WS_OVERLAPPEDWINDOW, - 400, - 0, - 160, - 490, - NULL, - NULL, - hInstance, - NULL); - - if (! hWnd1 || ! hWnd2 || ! hWndChild) - { - fprintf(stderr, "CreateWindow failed (last error 0x%lX)\n", - GetLastError()); - return(1); - } - WindowCount = 2; - - ShowWindow(hWnd1, SW_NORMAL); - ShowWindow(hWnd2, SW_NORMAL); - - while(GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - return msg.wParam; -} - -LRESULT CALLBACK MultiWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - PAINTSTRUCT ps; - HDC hDC; - LONG Style; - RECT Client; - HBRUSH Brush; - static COLORREF Colors[] = - { - RGB(0x00, 0x00, 0x00), - RGB(0x80, 0x00, 0x00), - RGB(0x00, 0x80, 0x00), - RGB(0x00, 0x00, 0x80), - RGB(0x80, 0x80, 0x00), - RGB(0x80, 0x00, 0x80), - RGB(0x00, 0x80, 0x80), - RGB(0x80, 0x80, 0x80), - RGB(0xff, 0x00, 0x00), - RGB(0x00, 0xff, 0x00), - RGB(0x00, 0x00, 0xff), - RGB(0xff, 0xff, 0x00), - RGB(0xff, 0x00, 0xff), - RGB(0x00, 0xff, 0xff), - RGB(0xff, 0xff, 0xff) - }; - static unsigned CurrentColor = 0; - - switch(msg) - { - case WM_PAINT: - hDC = BeginPaint(hWnd, &ps); - GetClientRect(hWnd, &Client); - Brush = CreateSolidBrush(Colors[CurrentColor]); - FillRect(hDC, &Client, Brush); - DeleteObject(Brush); - CurrentColor++; - if (sizeof(Colors) / sizeof(Colors[0]) <= CurrentColor) - { - CurrentColor = 0; - } - EndPaint(hWnd, &ps); - break; - - case WM_DESTROY: - Style = GetWindowLong(hWnd, GWL_STYLE); - if (0 == (Style & WS_CHILD) && 0 == --WindowCount) - { - PostQuitMessage(0); - } - break; - - default: - return DefWindowProc(hWnd, msg, wParam, lParam); - } - - return 0; -} diff --git a/reactos/apps/tests/mutex/.cvsignore b/reactos/apps/tests/mutex/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/mutex/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/mutex/makefile b/reactos/apps/tests/mutex/makefile deleted file mode 100644 index 0da7ad5b6a9..00000000000 --- a/reactos/apps/tests/mutex/makefile +++ /dev/null @@ -1,24 +0,0 @@ -# -# $Id: makefile,v 1.3 2003/11/14 17:13:18 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = mutex - -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/mutex/mutex.c b/reactos/apps/tests/mutex/mutex.c deleted file mode 100644 index 0597d274af8..00000000000 --- a/reactos/apps/tests/mutex/mutex.c +++ /dev/null @@ -1,122 +0,0 @@ -#include -#include -#include -#include - - -HANDLE OutputHandle; -HANDLE InputHandle; - -HANDLE hThread[2]; -DWORD dwCounter = 0; -HANDLE hMutex; - - -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); -} - - -DWORD WINAPI thread1(LPVOID crap) -{ - DWORD dwError = 0; - DWORD i; - - dprintf("Thread 1 running!\n"); - - for (i = 0; i < 10; i++) - { - dwError = WaitForSingleObject(hMutex, INFINITE); - if (dwError == WAIT_FAILED) - { - dprintf("Thread2: WaitForSingleObject failed!\n"); - return 1; - } - else if (dwError == WAIT_ABANDONED_0) - { - dprintf("Thread2: WaitForSingleObject returned WAIT_ABANDONED_0\n"); - } - - dprintf("Thread1: dwCounter : %lu -->", dwCounter); - dwCounter++; - dprintf(" %lu\n", dwCounter); - ReleaseMutex(hMutex); - } - - dprintf("Thread 1 done!\n"); - - return 1; -} - -DWORD WINAPI thread2(LPVOID crap) -{ - DWORD dwError = 0; - DWORD i; - dprintf("Thread 2 running!\n"); - - for (i = 0; i < 10; i++) - { - dwError = WaitForSingleObject(hMutex, INFINITE); - if (dwError == WAIT_FAILED) - { - dprintf("Thread2: WaitForSingleObject failed!\n"); - return 1; - } - else if (dwError == WAIT_ABANDONED_0) - { - dprintf("Thread2: WaitForSingleObject returned WAIT_ABANDONED_0\n"); - } - - dprintf("Thread2: dwCounter : %lu -->", dwCounter); - dwCounter++; - dprintf(" %lu\n", dwCounter); - ReleaseMutex(hMutex); - } - - dprintf("Thread 2 done!\n"); - - return 1; -} - - -int main(int argc, char* argv[]) -{ - DWORD dwError; - DWORD id1,id2; - - AllocConsole(); - InputHandle = GetStdHandle(STD_INPUT_HANDLE); - OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE); - - dprintf("Calling CreateMutex()\n"); - hMutex = CreateMutexW(NULL, FALSE, L"TestMutex"); - if (hMutex == INVALID_HANDLE_VALUE) - { - dprintf("CreateMutex() failed! Error: %lu\n", GetLastError()); - return 0; - } - dprintf("CreateMutex() succeeded!\n"); - - hThread[0] = CreateThread(0, 0, thread1, 0, 0, &id1); - hThread[1] = CreateThread(0, 0, thread2, 0, 0, &id2); - - dprintf("Calling WaitForMultipleObject()\n"); - dwError = WaitForMultipleObjects(2, hThread, TRUE, INFINITE); - dprintf("WaitForMultipleObject() Error: %lu\n", dwError); - - CloseHandle(hThread[0]); - CloseHandle(hThread[1]); - - CloseHandle(hMutex); - - dprintf("Main thread done!\n"); - - return 0; -} diff --git a/reactos/apps/tests/nameserverlist/makefile b/reactos/apps/tests/nameserverlist/makefile deleted file mode 100644 index ee3bf913e06..00000000000 --- a/reactos/apps/tests/nameserverlist/makefile +++ /dev/null @@ -1,22 +0,0 @@ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = nameserverlist - -TARGET_SDKLIBS = iphlpapi.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/nameserverlist/nameserverlist.c b/reactos/apps/tests/nameserverlist/nameserverlist.c deleted file mode 100644 index 9faab029b49..00000000000 --- a/reactos/apps/tests/nameserverlist/nameserverlist.c +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include -#include -#include - -int main( int argc, char **argv ) { - ULONG OutBufLen = 0; - PFIXED_INFO pFixedInfo; - PIP_ADDR_STRING Addr; - - GetNetworkParams(NULL, &OutBufLen); - pFixedInfo = malloc(OutBufLen); - if (!pFixedInfo) { - printf( "Failed to alloc %d bytes.\n", (int)OutBufLen ); - return 1; - } - - printf( "%d Bytes allocated\n", (int)OutBufLen ); - - GetNetworkParams(pFixedInfo,&OutBufLen); - - for( Addr = &pFixedInfo->DnsServerList; - Addr; - Addr = Addr->Next ) { - printf( "%c%s\n", - Addr == pFixedInfo->CurrentDnsServer ? '*' : ' ', - Addr->IpAddress.String ); - } - - free( pFixedInfo ); - return 0; -} diff --git a/reactos/apps/tests/noexecute/makefile b/reactos/apps/tests/noexecute/makefile deleted file mode 100644 index fe2bacb3f63..00000000000 --- a/reactos/apps/tests/noexecute/makefile +++ /dev/null @@ -1,32 +0,0 @@ -# -# $Id: makefile,v 1.1 2004/09/26 17:00:15 hbirr Exp $ -# - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = noexecute - -TARGET_SDKLIBS = pseh.a - -TARGET_PCH = - -TARGET_OBJECTS = \ - noexecute.o - -TARGET_CFLAGS = -Wall -Werror -D__USE_W32API - -DEP_OBJECTS = $(TARGET_OBJECTS) - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -include $(TOOLS_PATH)/depend.mk - -# EOF diff --git a/reactos/apps/tests/noexecute/noexecute.c b/reactos/apps/tests/noexecute/noexecute.c deleted file mode 100644 index ed9b81b1ea6..00000000000 --- a/reactos/apps/tests/noexecute/noexecute.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * $Id: noexecute.c,v 1.1 2004/09/26 17:00:15 hbirr Exp $ - */ - -#include -#include -#include -#include - -#include - -int test(int x) -{ - return x+1; -} - -void execute(char* message, int(*func)(int)) -{ - ULONG status = 0; - ULONG result; - - printf("%s ... ", message); - - _SEH_TRY - { - result = func(1); - } - _SEH_HANDLE - { - status = _SEH_GetExceptionCode(); - } - _SEH_END; - if (status == 0) - { - printf("OK.\n"); - } - else - { - printf("Error, status=%lx.\n", status); - } -} - -char data[100]; - -int main(void) -{ - unsigned char stack[100]; - void* heap; - ULONG protection; - - printf("NoExecute\n"); - - execute("Executing within the code segment", test); - memcpy(data, test, 100); - execute("Executing within the data segment", (int(*)(int))data); - memcpy(stack, test, 100); - execute("Executing on stack segment", (int(*)(int))stack); - heap = VirtualAlloc(NULL, 100, MEM_COMMIT, PAGE_READWRITE); - memcpy(heap, test, 100); - execute("Executing on the heap with protection PAGE_READWRITE", (int(*)(int))heap); - VirtualProtect(heap, 100, PAGE_EXECUTE, &protection); - execute("Executing on the heap with protection PAGE_EXECUTE", (int(*)(int))heap); - - return 0; -} diff --git a/reactos/apps/tests/nptest/.cvsignore b/reactos/apps/tests/nptest/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/nptest/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/nptest/Makefile b/reactos/apps/tests/nptest/Makefile deleted file mode 100644 index ec1ac8ebd12..00000000000 --- a/reactos/apps/tests/nptest/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -# -# -# -PATH_TO_TOP = ../../.. - -include $(PATH_TO_TOP)/config -include $(PATH_TO_TOP)/rules.mak - -SRV_OBJECTS = npserver.o -CLT_OBJECTS = npclient.o - -PROGS = npserver.exe npclient.exe - -CFLAGS = $(STD_CFLAGS) - -LIBS = $(SDK_PATH_LIB)/kernel32.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 - -npserver.exe: $(SRV_OBJECTS) $(LIBS) - $(CC) $(SRV_OBJECTS) $(LIBS) -o npserver.exe - $(NM) --numeric-sort npserver.exe > npserver.sym - -npclient.exe: $(CLT_OBJECTS) $(LIBS) - $(CC) $(CLT_OBJECTS) $(LIBS) -o npclient.exe - $(NM) --numeric-sort npclient.exe > npclient.sym diff --git a/reactos/apps/tests/nptest/npclient.c b/reactos/apps/tests/nptest/npclient.c deleted file mode 100644 index 6d93f3a1acd..00000000000 --- a/reactos/apps/tests/nptest/npclient.c +++ /dev/null @@ -1,100 +0,0 @@ -#include - -VOID MyErrExit(LPTSTR Message) -{ -// MessageBox(NULL, Message, NULL, MB_OK); - puts(Message); - ExitProcess(0); -} - -int main(int argc, char *argv[]) -{ - HANDLE hPipe; - LPVOID lpvMessage; - CHAR chBuf[512]; - BOOL fSuccess; - DWORD cbRead, cbWritten, dwMode; - LPTSTR lpszPipename = "\\\\.\\pipe\\mynamedpipe"; - -// Try to open a named pipe; wait for it, if necessary. - - while (1) - { - hPipe = CreateFile( - lpszPipename, // pipe name - GENERIC_READ | // read and write access - GENERIC_WRITE, - 0, // no sharing - NULL, // no security attributes - OPEN_EXISTING, // opens existing pipe - 0, // default attributes - NULL); // no template file - - // Break if the pipe handle is valid. - - if (hPipe != INVALID_HANDLE_VALUE) - break; - - // Exit if an error other than ERROR_PIPE_BUSY occurs. - - if (GetLastError() != ERROR_PIPE_BUSY) - MyErrExit("Could not open pipe"); - - // All pipe instances are busy, so wait for 20 seconds. - - if (! WaitNamedPipe(lpszPipename, 20000) ) - MyErrExit("Could not open pipe"); - } - -// The pipe connected; change to message-read mode. - - dwMode = PIPE_READMODE_MESSAGE; - fSuccess = SetNamedPipeHandleState( - hPipe, // pipe handle - &dwMode, // new pipe mode - NULL, // don't set maximum bytes - NULL); // don't set maximum time - if (!fSuccess) - MyErrExit("SetNamedPipeHandleState"); - -// Send a message to the pipe server. - - lpvMessage = (argc > 1) ? argv[1] : "default message"; - - fSuccess = WriteFile( - hPipe, // pipe handle - lpvMessage, // message - strlen(lpvMessage) + 1, // message length - &cbWritten, // bytes written - NULL); // not overlapped - if (! fSuccess) - MyErrExit("WriteFile"); - - do - { - // Read from the pipe. - - fSuccess = ReadFile( - hPipe, // pipe handle - chBuf, // buffer to receive reply - 512, // size of buffer - &cbRead, // number of bytes read - NULL); // not overlapped - - if (! fSuccess && GetLastError() != ERROR_MORE_DATA) - break; - - // Reply from the pipe is written to STDOUT. - - if (! WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), - chBuf, cbRead, &cbWritten, NULL)) - { - break; - } - - } while (! fSuccess); // repeat loop if ERROR_MORE_DATA - - CloseHandle(hPipe); - - return 0; -} diff --git a/reactos/apps/tests/nptest/npserver.c b/reactos/apps/tests/nptest/npserver.c deleted file mode 100644 index 0969b4228a2..00000000000 --- a/reactos/apps/tests/nptest/npserver.c +++ /dev/null @@ -1,120 +0,0 @@ -#include -#include -#include -#include -#include - -#define BUFSIZE 1024 -#define PIPE_TIMEOUT 1000 - -VOID InstanceThread (LPVOID); - -VOID -GetAnswerToRequest(LPTSTR lpRequest, - LPTSTR lpReply, - LPDWORD lpcbReplyBytes) -{ -} - -VOID MyErrExit(LPTSTR Message) -{ -// MessageBox(NULL, Message, NULL, MB_OK); - puts(Message); - ExitProcess(0); -} - - - - -int xx = 0; - -int main(int argc, char *argv[]) -{ - BOOL fConnected; - DWORD dwThreadId; - HANDLE hPipe, hThread; - LPTSTR lpszPipename = TEXT("\\\\.\\pipe\\mynamedpipe"); - -// for (;;) -// { - hPipe = CreateNamedPipe(lpszPipename, - PIPE_ACCESS_DUPLEX, - PIPE_TYPE_MESSAGE | - PIPE_READMODE_MESSAGE | - PIPE_WAIT, - PIPE_UNLIMITED_INSTANCES, - BUFSIZE, - BUFSIZE, - PIPE_TIMEOUT, - NULL); - if (hPipe == INVALID_HANDLE_VALUE) - { - printf("CreateNamedPipe() failed\n"); - return 0; - } - - fConnected = ConnectNamedPipe(hPipe, - NULL) ? TRUE : (GetLastError () == - ERROR_PIPE_CONNECTED); - if (fConnected) - { - printf("Pipe connected!\n"); - - DisconnectNamedPipe(hPipe); - -#if 0 - hThread = CreateThread(NULL, - 0, - (LPTHREAD_START_ROUTINE) InstanceThread, - (LPVOID) hPipe, - 0, - &dwThreadId); - if (hThread == NULL) - MyErrExit("CreateThread"); -#endif - } - else - { -// CloseHandle(hPipe); - } -// } - - CloseHandle(hPipe); - - return 0; -} - -VOID InstanceThread (LPVOID lpvParam) -{ - CHAR chRequest[BUFSIZE]; - CHAR chReply[BUFSIZE]; - DWORD cbBytesRead, cbReplyBytes, cbWritten; - BOOL fSuccess; - HANDLE hPipe; - - hPipe = (HANDLE)lpvParam; - while (1) - { - fSuccess = ReadFile(hPipe, - chRequest, - BUFSIZE, - &cbBytesRead, - NULL); - if (!fSuccess || cbBytesRead == 0) - break; - - GetAnswerToRequest(chRequest, chReply, &cbReplyBytes); - - fSuccess = WriteFile(hPipe, - chReply, - cbReplyBytes, - &cbWritten, - NULL); - if (!fSuccess || cbReplyBytes != cbWritten) - break; - } - - FlushFileBuffers(hPipe); - DisconnectNamedPipe(hPipe); - CloseHandle(hPipe); -} diff --git a/reactos/apps/tests/oskittcp/.cvsignore b/reactos/apps/tests/oskittcp/.cvsignore deleted file mode 100644 index 379433caa8d..00000000000 --- a/reactos/apps/tests/oskittcp/.cvsignore +++ /dev/null @@ -1,9 +0,0 @@ -*.d -*.exe -*.map -*.ncb -*.opt -*.plg -*.sym -Debug -Release \ No newline at end of file diff --git a/reactos/apps/tests/oskittcp/cmd_oskit.py b/reactos/apps/tests/oskittcp/cmd_oskit.py deleted file mode 100644 index e1fac177519..00000000000 --- a/reactos/apps/tests/oskittcp/cmd_oskit.py +++ /dev/null @@ -1,10 +0,0 @@ -from socket import * -import sys - -s = socket(AF_INET,SOCK_DGRAM,0) -s.connect(('localhost',5001)) - -while 1: - sys.stdout.write('>> ') - line = sys.stdin.readline() - s.send('CMD ' + line) \ No newline at end of file diff --git a/reactos/apps/tests/oskittcp/makefile b/reactos/apps/tests/oskittcp/makefile deleted file mode 100644 index 9bbf9a386a6..00000000000 --- a/reactos/apps/tests/oskittcp/makefile +++ /dev/null @@ -1,28 +0,0 @@ -# -# $Id: makefile,v 1.5 2004/09/21 04:06:15 arty Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = oskittcp - -TARGET_SDKLIBS = ws2_32.a oskittcp.a ntdll.a - -TARGET_OBJECTS = tcptest.o - -TARGET_CPPFLAGS = -I$(PATH_TO_TOP)/drivers/lib/oskittcp/include -I$(PATH_TO_TOP)/w32api/include -I$(PATH_TO_TOP)/include -g - -TARGET_GCCLIBS = stdc++ - -TARGET_LDFLAGS = -g - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/oskittcp/tcptest.cpp b/reactos/apps/tests/oskittcp/tcptest.cpp deleted file mode 100644 index 8760ef9b73e..00000000000 --- a/reactos/apps/tests/oskittcp/tcptest.cpp +++ /dev/null @@ -1,380 +0,0 @@ -#ifdef _MSC_VER -#pragma warning ( disable : 4786 ) -#endif//_MSC_VER - -#include -#include -#include -#include -extern "C" { - typedef unsigned short u_short; -#include -#include -#include -#ifndef _MSC_VER -#include -#endif//_MSC_VER -}; - -unsigned char hwaddr[6] = { 0x08, 0x00, 0x20, 0x0b, 0xb7, 0xbb }; - -#undef malloc -#undef free - -unsigned long TCP_IPIdentification; - -#define MAX_DG_SIZE 0x10000 -#define TI_DbgPrint(x,y) printf y - -std::list output_packets; - -typedef struct _CONNECTION_ENDPOINT { - OSK_UINT State; -} CONNECTION_ENDPOINT, *PCONNECTION_ENDPOINT; - -extern "C" int is_stack_ptr ( const void* p ) -{ - MEMORY_BASIC_INFORMATION mbi1, mbi2; - VirtualQuery ( p, &mbi1, sizeof(mbi1) ); - VirtualQuery ( _alloca(1), &mbi2, sizeof(mbi2) ); - return mbi1.AllocationBase == mbi2.AllocationBase; -} - -int TCPSocketState(void *ClientData, - void *WhichSocket, - void *WhichConnection, - OSK_UINT NewState ) { - PCONNECTION_ENDPOINT Connection = (PCONNECTION_ENDPOINT)WhichConnection; - //PLIST_ENTRY Entry; - - TI_DbgPrint(MID_TRACE,("Called: NewState %x\n", NewState)); - - if( !Connection ) { - TI_DbgPrint(MID_TRACE,("Socket closing.\n")); - return 0; - } - - if( (NewState & SEL_CONNECT) && - !(Connection->State & SEL_CONNECT) ) { - } else if( (NewState & SEL_READ) || (NewState & SEL_FIN) ) { - } - - return 0; -} - -#define STRINGIFY(x) #x - -char hdr[14] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x00 }; - -int TCPPacketSend(void *ClientData, OSK_PCHAR data, OSK_UINT len ) { - output_packets.push_back( std::string( hdr, 14 ) + - std::string( (char *)data, (int)len ) ); - return 0; -} - -struct ifaddr *TCPFindInterface( void *ClientData, - OSK_UINT AddrType, - OSK_UINT FindType, - struct sockaddr *ReqAddr ) { - static struct sockaddr_in ifa = { AF_INET }, nm = { AF_INET }; - static struct ifaddr a = { - (struct sockaddr *)&ifa, - NULL, - (struct sockaddr *)&nm, - 0, - 0, - 1, - 1500 - }; - ifa.sin_addr.s_addr = inet_addr( "10.10.2.115" ); - nm.sin_addr.s_addr = inet_addr( "255.255.255.0" ); - return &a; -} - -void *TCPMalloc( void *ClientData, - OSK_UINT Bytes, OSK_PCHAR File, OSK_UINT Line ) { - void *v = malloc( Bytes ); - fprintf( stderr, "(%s:%d) malloc( %d ) => %x\n", File, Line, Bytes, v ); - return v; -} - -void TCPFree( void *ClientData, - void *data, OSK_PCHAR File, OSK_UINT Line ) { - fprintf( stderr, "(%s:%d) free( %x )\n", File, Line, data ); - free( data ); -} - -int TCPSleep( void *ClientData, void *token, int priority, char *msg, - int tmio ) { -#if 0 - PSLEEPING_THREAD SleepingThread; - - TI_DbgPrint(MID_TRACE, - ("Called TSLEEP: tok = %x, pri = %d, wmesg = %s, tmio = %x\n", - token, priority, msg, tmio)); - - SleepingThread = ExAllocatePool( NonPagedPool, sizeof( *SleepingThread ) ); - if( SleepingThread ) { - KeInitializeEvent( &SleepingThread->Event, NotificationEvent, FALSE ); - SleepingThread->SleepToken = token; - - ExAcquireFastMutex( &SleepingThreadsLock ); - InsertTailList( &SleepingThreadsList, &SleepingThread->Entry ); - ExReleaseFastMutex( &SleepingThreadsLock ); - - TI_DbgPrint(MID_TRACE,("Waiting on %x\n", token)); - KeWaitForSingleObject( &SleepingThread->Event, - WrSuspended, - KernelMode, - TRUE, - NULL ); - - ExAcquireFastMutex( &SleepingThreadsLock ); - RemoveEntryList( &SleepingThread->Entry ); - ExReleaseFastMutex( &SleepingThreadsLock ); - - ExFreePool( SleepingThread ); - } - TI_DbgPrint(MID_TRACE,("Waiting finished: %x\n", token)); -#endif - return 0; -} - -void TCPWakeup( void *ClientData, void *token ) { -#if 0 - PLIST_ENTRY Entry; - PSLEEPING_THREAD SleepingThread; - - ExAcquireFastMutex( &SleepingThreadsLock ); - Entry = SleepingThreadsList.Flink; - while( Entry != &SleepingThreadsList ) { - SleepingThread = CONTAINING_RECORD(Entry, SLEEPING_THREAD, Entry); - TI_DbgPrint(MID_TRACE,("Sleeper @ %x\n", SleepingThread)); - if( SleepingThread->SleepToken == token ) { - TI_DbgPrint(MID_TRACE,("Setting event to wake %x\n", token)); - KeSetEvent( &SleepingThread->Event, IO_NETWORK_INCREMENT, FALSE ); - } - Entry = Entry->Flink; - } - ExReleaseFastMutex( &SleepingThreadsLock ); -#endif -} - -OSKITTCP_EVENT_HANDLERS EventHandlers = { - NULL, - TCPSocketState, - TCPPacketSend, - TCPFindInterface, - TCPMalloc, - TCPFree, - TCPSleep, - TCPWakeup -}; - -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" ); -} - -int main( int argc, char **argv ) { - int asock = INVALID_SOCKET, selret, dgrecv, fromsize, err, port = 5001; - char datagram[MAX_DG_SIZE]; - void *conn = 0; - struct fd_set readf; - struct timeval tv; - struct sockaddr_in addr_from = { AF_INET }, addr_to = { AF_INET }; - std::list::iterator i; - WSADATA wsadata; - - WSAStartup( 0x101, &wsadata ); - - if( argc > 1 ) port = atoi(argv[1]); - - RegisterOskitTCPEventHandlers( &EventHandlers ); - InitOskitTCP(); - - 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; - } - - addr_to.sin_port = htons( port & (~1) ); - addr_to.sin_addr.s_addr = inet_addr("127.0.0.1"); - - 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; - - if( word == "socket" ) { - cmdin >> faddr >> theport; - - nam.sin_family = AF_INET; - nam.sin_addr.s_addr = inet_addr(faddr.c_str()); - nam.sin_port = htons(theport); - - if( (err = OskitTCPSocket( NULL, &conn, AF_INET, - SOCK_STREAM, 0 )) != 0 ) { - fprintf( stderr, "OskitTCPSocket: error %d\n", err ); - } - - if( (err = OskitTCPConnect( conn, NULL, &nam, - sizeof(nam) )) != 0 ) { - fprintf( stderr, "OskitTCPConnect: error %d\n", err ); - } else { - printf( "Socket created\n" ); - } - } - - /* The rest of the commands apply only to an open socket */ - if( !conn ) continue; - - if( word == "recv" ) { - cmdin >> bytes; - - if( (err = OskitTCPRecv( conn, (OSK_PCHAR)datagram, - sizeof(datagram), - (unsigned int *)&bytin, 0 )) != 0 ) { - fprintf( stderr, "OskitTCPRecv: error %d\n", err ); - } else { - for( off = 0; off < bytin; off += 16 ) { - display_row( datagram, off, bytin ); - } - printf( "\n" ); - } - } 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 ( (err = OskitTCPSend ( conn, (OSK_PCHAR)p, strlen(p), (OSK_UINT*)&bytin, 0 )) - != 0 ) { - 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 = OskitTCPSend( conn, (OSK_PCHAR)datagram, - off, (OSK_UINT *)&bytin, 0 )) - != 0 ) { - fprintf( stderr, "OskitTCPConnect: error %d\n", err ); - } else { - printf( "wrote %d bytes\n", bytin ); - } - } else if( word == "close" ) { - OskitTCPClose( conn ); - conn = NULL; - } - } 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 ); - OskitTCPReceiveDatagram - ( (unsigned char *)datagram + 14, - dgrecv - 14, 20 ); - } - } - } - - TimerOskitTCP(); - - 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/oskittcp/tcptest.dsp b/reactos/apps/tests/oskittcp/tcptest.dsp deleted file mode 100644 index fd5f9039a4e..00000000000 --- a/reactos/apps/tests/oskittcp/tcptest.dsp +++ /dev/null @@ -1,434 +0,0 @@ -# Microsoft Developer Studio Project File - Name="tcptest" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=tcptest - 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 "tcptest.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 "tcptest.mak" CFG="tcptest - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "tcptest - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "tcptest - 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)" == "tcptest - 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)" == "tcptest - 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 /I "../../../drivers/lib/oskittcp/include" /I "../../../drivers\lib\oskittcp\include\freebsd\src\sys" /I "../../../drivers\lib\oskittcp\include\freebsd\dev\include" /I "../../../drivers\lib\oskittcp\include\freebsd\net\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "KERNEL" /D __REACTOS__=1 /D "FREEZAP" /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 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "tcptest - Win32 Release" -# Name "tcptest - Win32 Debug" -# Begin Group "tcptest" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\tcptest.cpp - -!IF "$(CFG)" == "tcptest - Win32 Release" - -!ELSEIF "$(CFG)" == "tcptest - Win32 Debug" - -# SUBTRACT CPP /D "KERNEL" - -!ENDIF - -# End Source File -# End Group -# Begin Group "oskittcp" - -# PROP Default_Filter "" -# Begin Group "src" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\defaults.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\in.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\in_cksum.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\in_pcb.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\in_proto.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\in_rmx.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\inet_ntoa.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\interface.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\ip_input.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\ip_output.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\kern_clock.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\kern_subr.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\param.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\radix.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\random.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\raw_cb.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\raw_ip.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\raw_usrreq.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\route.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\rtsock.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\scanc.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\sleep.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\tcp_debug.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\tcp_input.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\tcp_output.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\tcp_subr.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\tcp_timer.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\tcp_usrreq.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\uipc_domain.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\uipc_mbuf.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\uipc_socket.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\oskittcp\uipc_socket2.c -# End Source File -# End Group -# Begin Group "include" - -# PROP Default_Filter "" -# Begin Group "freebsd" - -# PROP Default_Filter "" -# Begin Group "src No. 1" - -# PROP Default_Filter "" -# Begin Group "sys" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\buf.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\callout.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\cdefs.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\domain.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\errno.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\fcntl.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\file.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\filedesc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\filio.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\ioccom.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\ioctl.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\kernel.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\libkern.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\malloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\mbuf.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\param.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\proc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\protosw.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\queue.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\resource.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\resourcevar.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\rtprio.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\select.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\signal.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\signalvar.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\socket.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\socketvar.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\sockio.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\stat.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\sysctl.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\syslimits.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\syslog.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\systm.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\time.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\ttycom.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\types.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\ucred.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\uio.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\freebsd\src\sys\sys\unistd.h -# End Source File -# End Group -# End Group -# End Group -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\memtrack.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\oskitdebug.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\oskiterrno.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\oskitfreebsd.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\oskittcp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\drivers\lib\oskittcp\include\oskittypes.h -# End Source File -# End Group -# End Group -# End Target -# End Project diff --git a/reactos/apps/tests/oskittcp/tcptest.dsw b/reactos/apps/tests/oskittcp/tcptest.dsw deleted file mode 100644 index a00140eb137..00000000000 --- a/reactos/apps/tests/oskittcp/tcptest.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "tcptest"=.\tcptest.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/reactos/apps/tests/p_dup_handle/.cvsignore b/reactos/apps/tests/p_dup_handle/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/p_dup_handle/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/p_dup_handle/makefile b/reactos/apps/tests/p_dup_handle/makefile deleted file mode 100644 index 2dd34de5869..00000000000 --- a/reactos/apps/tests/p_dup_handle/makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $Id: makefile,v 1.2 2003/11/14 17:13:18 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = p_dup_handle - -TARGET_SDKLIBS = kernel32.a gdi32.a ntdll.a - -TARGET_OBJECTS = $(TARGET_NAME).o - -TARGET_CFLAGS = -Wall -Werror - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/p_dup_handle/p_dup_handle.c b/reactos/apps/tests/p_dup_handle/p_dup_handle.c deleted file mode 100644 index 6aa5f7d1c05..00000000000 --- a/reactos/apps/tests/p_dup_handle/p_dup_handle.c +++ /dev/null @@ -1,69 +0,0 @@ -#include -#include -#include -#include - -/* This tests the ability of the target win32 to duplicate a process handle, - * spawn a child, and have the child dup it's own handle back into the parent - * using the duplicated handle. - */ - -int main( int argc, char **argv ) { - HANDLE h_process; - HANDLE h_process_in_parent; - - fprintf( stderr, "%lu: Starting\n", GetCurrentProcessId() ); - - if( argc == 2 ) { - h_process = (HANDLE)atoi(argv[1]); - } else { - if( !DuplicateHandle( GetCurrentProcess(), - GetCurrentProcess(), - GetCurrentProcess(), - &h_process, - 0, - TRUE, - DUPLICATE_SAME_ACCESS) ) { - fprintf( stderr, "%lu: Could not duplicate my own process handle.\n", - GetCurrentProcessId() ); - return 101; - } - } - - if( argc == 1 ) { - STARTUPINFO si; - PROCESS_INFORMATION pi; - char cmdline[1000]; - - memset( &si, 0, sizeof( si ) ); - memset( &pi, 0, sizeof( pi ) ); - - sprintf( cmdline, "%s %lu", argv[0], (DWORD)h_process ); - if( !CreateProcess(NULL, cmdline, NULL, NULL, TRUE, 0, NULL, NULL, - &si, &pi ) ) { - fprintf( stderr, "%lu: Could not create child process.\n", - GetCurrentProcessId() ); - return 5; - } - - if( WaitForSingleObject( pi.hThread, INFINITE ) != WAIT_OBJECT_0 ) { - fprintf( stderr, "%lu: Failed to wait for child process to terminate.\n", - GetCurrentProcessId() ); - return 6; - } - } else { - if( !DuplicateHandle( GetCurrentProcess(), - GetCurrentProcess(), - h_process, - &h_process_in_parent, - 0, - TRUE, - DUPLICATE_SAME_ACCESS) ) { - fprintf( stderr, "%lu: Could not duplicate my handle into the parent.\n", - GetCurrentProcessId() ); - return 102; - } - } - - return 0; -} diff --git a/reactos/apps/tests/palbitblt/.cvsignore b/reactos/apps/tests/palbitblt/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/palbitblt/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/palbitblt/makefile b/reactos/apps/tests/palbitblt/makefile deleted file mode 100644 index a7edc024065..00000000000 --- a/reactos/apps/tests/palbitblt/makefile +++ /dev/null @@ -1,21 +0,0 @@ -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = palbitblt - -TARGET_SDKLIBS = kernel32.a gdi32.a - -TARGET_OBJECTS = pal.o - -TARGET_CFLAGS = -Wall -Werror - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/palbitblt/pal.c b/reactos/apps/tests/palbitblt/pal.c deleted file mode 100644 index 7ffa852c8f7..00000000000 --- a/reactos/apps/tests/palbitblt/pal.c +++ /dev/null @@ -1,201 +0,0 @@ -/* The idea of this test app is inspired from tutorial * - * found at http://www.theparticle.com/pgraph.html * - * * - * Developed by: Aleksey Bragin * - * Version: 1.0 */ - -#include -#include - -#define W_WIDTH 320 -#define W_HEIGHT 240 - -// special version of BITMAPINFO and LOGPALETTE for max of 256 palette entries -typedef struct -{ - BITMAPINFOHEADER bmiHeader; - RGBQUAD bmiColors[256]; -} BITMAPINFO256; - -typedef struct { - WORD palVersion; - WORD palNumEntries; - PALETTEENTRY palPalEntry[256]; -} LOGPALETTE256; - -// The only global variable --- contents of the DIBitmap -BYTE* dibits; - -void GeneratePalette(RGBQUAD* p) -{ - int i; - for(i=0;i<256;i++) - { - p[i].rgbRed = i; - p[i].rgbGreen = i; - p[i].rgbBlue = i; - p[i].rgbReserved = 0; - } -} - -void DoBlt(HBITMAP hBM) -{ - HDC hDC,Context; - HWND ActiveWindow; - RECT dest; - HBITMAP dflBmp; - - if((ActiveWindow = GetActiveWindow()) == NULL) - return; - - hDC = GetDC(ActiveWindow); - GetClientRect(ActiveWindow,&dest); - - Context = CreateCompatibleDC(0); - dflBmp = SelectObject(Context, hBM); - BitBlt(hDC, 0, 0, dest.right, dest.bottom, Context, 0, 0, SRCCOPY); - SelectObject(Context, dflBmp); - DeleteDC(Context); - DeleteObject(dflBmp); - ReleaseDC(ActiveWindow, hDC); -} - -void UpdatePalette(HBITMAP hBM){ - int i,y; - static unsigned int c=0; - - for(i=0;i 512) - c = 0; - else - c++; // It's operation of incrementing of c variable, not reference of a cool OO language :-) - } - - DoBlt(hBM); -} - -void InitBitmap(HANDLE *hBM){ - HPALETTE PalHan; - HWND ActiveWindow; - HDC hDC; - RGBQUAD palette[256]; - int i; - BITMAPINFO256 bmInf; - LOGPALETTE256 palInf; - - ActiveWindow = GetActiveWindow(); - hDC = GetDC(ActiveWindow); - - bmInf.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bmInf.bmiHeader.biWidth = W_WIDTH; - bmInf.bmiHeader.biHeight = -abs(W_HEIGHT); - bmInf.bmiHeader.biPlanes = 1; - bmInf.bmiHeader.biBitCount = 8; - bmInf.bmiHeader.biCompression = BI_RGB; - bmInf.bmiHeader.biSizeImage = 0; - bmInf.bmiHeader.biXPelsPerMeter = 0; - bmInf.bmiHeader.biYPelsPerMeter = 0; - bmInf.bmiHeader.biClrUsed = 256; - bmInf.bmiHeader.biClrImportant = 256; - - GeneratePalette(palette); - - for(i=0;i<256;i++) - bmInf.bmiColors[i] = palette[i]; - - palInf.palVersion = 0x300; - palInf.palNumEntries = 256; - for(i=0;i<256;i++){ - palInf.palPalEntry[i].peRed = palette[i].rgbRed; - palInf.palPalEntry[i].peGreen = palette[i].rgbGreen; - palInf.palPalEntry[i].peBlue = palette[i].rgbBlue; - palInf.palPalEntry[i].peFlags = PC_NOCOLLAPSE; - } - - // Create palette - PalHan = CreatePalette((LOGPALETTE*)&palInf); - - // Select it into hDC - SelectPalette(hDC,PalHan,FALSE); - - // Realize palette in hDC - RealizePalette(hDC); - - // Delete handle to palette - DeleteObject(PalHan); - - // Create dib section - *hBM = CreateDIBSection(hDC,(BITMAPINFO*)&bmInf, - DIB_RGB_COLORS,(void**)&dibits,0,0); - - // Release dc - ReleaseDC(ActiveWindow,hDC); -} - -LRESULT CALLBACK WndProc(HWND hWnd,UINT msg, WPARAM wParam,LPARAM lParam) -{ - switch(msg){ - case WM_DESTROY: - PostQuitMessage(0); - return 0; - default: - return DefWindowProc(hWnd,msg,wParam,lParam); - } -} - - - -int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance, LPSTR lpszCmdParam,int nCmdShow) -{ - WNDCLASS WndClass; - HWND hWnd; - MSG msg; - char szName[] = "Palette BitBlt test"; - BOOL exit = FALSE; - HBITMAP hBM; - - // Create and register window class (not modified!!!!!!!!!!!1) - WndClass.style = CS_HREDRAW|CS_VREDRAW|CS_OWNDC; - WndClass.lpfnWndProc = WndProc; - WndClass.cbClsExtra = 0; - WndClass.cbWndExtra = 0; - WndClass.hbrBackground = NULL;//GetStockObject(BLACK_BRUSH); - WndClass.hIcon = NULL;//LoadIcon(hInstance,NULL); - WndClass.hCursor = NULL;//LoadCursor(NULL,IDC_ARROW); - WndClass.hInstance = hInstance; - WndClass.lpszClassName = szName; - WndClass.lpszMenuName = 0; - - RegisterClass(&WndClass); - - // Create and show window (change styles !!!!!!!!) - hWnd = CreateWindow(szName, "ReactOS palette bitblt test", - WS_CAPTION|WS_MINIMIZEBOX|WS_SYSMENU, - CW_USEDEFAULT,CW_USEDEFAULT,W_WIDTH,W_HEIGHT, - 0,0,hInstance,0); - ShowWindow(hWnd,nCmdShow); - - // Prepare bitmap to be bitblt - InitBitmap(&hBM); - - // Main message loop - while (!exit) - { - UpdatePalette(hBM); - Sleep(200); - - if(PeekMessage(&msg,0,0,0,PM_NOREMOVE) == TRUE) - { - if (!GetMessage(&msg,0,0,0)) - exit = TRUE; - - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } - - return msg.wParam; -} diff --git a/reactos/apps/tests/patblt/.cvsignore b/reactos/apps/tests/patblt/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/patblt/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/patblt/Penguin.bmp b/reactos/apps/tests/patblt/Penguin.bmp deleted file mode 100644 index ec4e1daaf93..00000000000 Binary files a/reactos/apps/tests/patblt/Penguin.bmp and /dev/null differ diff --git a/reactos/apps/tests/patblt/makefile b/reactos/apps/tests/patblt/makefile deleted file mode 100644 index 347b83386c7..00000000000 --- a/reactos/apps/tests/patblt/makefile +++ /dev/null @@ -1,31 +0,0 @@ - -PATH_TO_TOP = ../../.. - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = patblt - -TARGET_NORC = yes - -TARGET_CFLAGS = -fexceptions -g -O0 -DWIN32 -D_DEBUG -D_WINDOWS -D_MBCS -W -D__USE_W32API -Werror -Wall - -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 = \ - patblt.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/patblt/patblt.cpp b/reactos/apps/tests/patblt/patblt.cpp deleted file mode 100644 index 84c5d7b26ac..00000000000 --- a/reactos/apps/tests/patblt/patblt.cpp +++ /dev/null @@ -1,270 +0,0 @@ - -// ------------------------------------------------------------------ -// Windows 2000 Graphics API Black Book -// Chapter 2 - Listing 2.1 (PatBlt Tracking Rect Demo) -// -// Created by Damon Chandler -// Updates can be downloaded at: -// -// Please do not hesistate to e-mail me at dmc27@ee.cornell.edu -// if you have any questions about this code. -// ------------------------------------------------------------------ - - -//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -#include -//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - - -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 = LoadCursor(NULL, IDC_ARROW); - wc.hbrBackground = static_cast( - GetStockObject(BLACK_BRUSH) - ); - - if (RegisterClass(&wc)) - { - HWND HWnd = - CreateWindow(WndClassName, - TEXT("PatBlt Tracking Rect Demo"), - WS_OVERLAPPEDWINDOW | WS_CAPTION | - WS_VISIBLE | WS_CLIPCHILDREN, - CW_USEDEFAULT, CW_USEDEFAULT, 640, 480, - 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; -} -//------------------------------------------------------------------ - - -// image related -HDC HMemDC = NULL; -HBITMAP HOldBmp = NULL; -const char* filename = "PENGUIN.BMP"; -RECT RImage = {225, 110, 225, 110}; - -// tracking related -bool is_tracking = false; -HDC HScreenDC = NULL; -POINT PMouse = {0, 0}; -RECT RTrack = {0, 0, 0, 0}; -const int line_width = 5; - - -// utility function to map to/from window coordinates -void MapRect(IN HWND HWndFrom, IN HWND HWndTo, IN OUT RECT& RMap) -{ - MapWindowPoints( - HWndFrom, HWndTo, - reinterpret_cast(&RMap), 2 - ); -} -//------------------------------------------------------------------ - - -// utility function that uses the PatBlt function to -// render a tracking rectangle -void RenderTrackingRect(IN HDC HDestDC, IN const RECT& RRender) -{ - const int width = RRender.right - RRender.left; - const int height = RRender.bottom - RRender.top; - const DWORD dwROP3 = DSTINVERT; // experiment with others - - // render top bar - PatBlt(HDestDC, - RRender.left, RRender.top, - width, line_width, - dwROP3); - // render bottom bar - PatBlt(HDestDC, - RRender.left, RRender.bottom - line_width, - width, line_width, - dwROP3); - // render left bar - PatBlt(HDestDC, - RRender.left, RRender.top + line_width, - line_width, height - (2 * line_width), - dwROP3); - // render right bar - PatBlt(HDestDC, - RRender.right - line_width, RRender.top + line_width, - line_width, height - (2 * line_width), - dwROP3); - -} -//------------------------------------------------------------------ - - -LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam, - LPARAM LParam) -{ - switch (Msg) - { - case WM_CREATE: - { - // create a memory DC - HMemDC = CreateCompatibleDC(NULL); - if (HMemDC) - { - // load the penguin bitmap - HBITMAP HBmp = static_cast( - LoadImage(HInst, filename, IMAGE_BITMAP, 0, 0, - LR_LOADFROMFILE | LR_DEFAULTSIZE) - ); - if (HBmp) - { - // get the bitmap's dimensions - BITMAP bmp; - if (GetObject(HBmp, sizeof(BITMAP), &bmp)) - { - RImage.right += bmp.bmWidth; - RImage.bottom += bmp.bmHeight; - - // realize the bitmap - HOldBmp = static_cast( - SelectObject(HMemDC, HBmp) - ); - } - else DeleteObject(HBmp); - } - } - break; - } - case WM_LBUTTONDOWN: - { - PMouse.x = LOWORD(LParam); - PMouse.y = HIWORD(LParam); - - RECT RClient; - if (PtInRect(&RImage, PMouse) && - GetClientRect(HWnd, &RClient)) - { - MapRect(HWnd, HWND_DESKTOP, RClient); - ClipCursor(&RClient); - - // grab a handle to the screen DC and clip - // all output to the client area of our window - HScreenDC = GetDC(NULL); - HRGN HClipRgn = CreateRectRgnIndirect(&RClient); - SelectClipRgn(HScreenDC, HClipRgn); - DeleteObject(HClipRgn); - - CopyRect(&RTrack, &RImage); - MapRect(HWnd, HWND_DESKTOP, RTrack); - - // render the first tracking rect - RenderTrackingRect(HScreenDC, RTrack); - is_tracking = true; - } - break; - } - case WM_MOUSEMOVE: - { - if (HScreenDC && is_tracking) - { - POINT PCurrent = {LOWORD(LParam), HIWORD(LParam)}; - const int dX = PCurrent.x - PMouse.x; - const int dY = PCurrent.y - PMouse.y; - - // erase the previous rectangle - RenderTrackingRect(HScreenDC, RTrack); - // update the postion - OffsetRect(&RTrack, dX, dY); - // render the new tracking rectangle - RenderTrackingRect(HScreenDC, RTrack); - - // update the mouse position - memcpy(&PMouse, &PCurrent, sizeof(POINT)); - } - break; - } - case WM_LBUTTONUP: - { - // clean up - if (is_tracking) - { - is_tracking = false; - SelectClipRgn(HScreenDC, NULL); - ReleaseDC(NULL, HScreenDC); - - InvalidateRect(HWnd, &RImage, true); - CopyRect(&RImage, &RTrack); - MapRect(HWND_DESKTOP, HWnd, RImage); - InvalidateRect(HWnd, &RImage, true); - - ClipCursor(NULL); - } - break; - } - case WM_PAINT: - { - PAINTSTRUCT ps; - HDC Hdc = BeginPaint(HWnd, &ps); - try - { - // - // TODO: Add palette support... - // - - // render the penguin - BitBlt(Hdc, RImage.left, RImage.top, - RImage.right - RImage.left, - RImage.bottom - RImage.top, - HMemDC, 0, 0, - SRCCOPY); - } - catch (...) - { - EndPaint(HWnd, &ps); - } - EndPaint(HWnd, &ps); - break; - } - case WM_DESTROY: - { - // clean up - if (HOldBmp) - { - DeleteObject(SelectObject(HMemDC, HOldBmp)); - } - if (HMemDC) - { - DeleteDC(HMemDC); - } - PostQuitMessage(0); - return 0; - } - } - return DefWindowProc(HWnd, Msg, WParam, LParam); -} -//------------------------------------------------------------------ diff --git a/reactos/apps/tests/polytest/.cvsignore b/reactos/apps/tests/polytest/.cvsignore deleted file mode 100644 index f7922c9268f..00000000000 --- a/reactos/apps/tests/polytest/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map -*.ncb -*.opt -Debug -Release diff --git a/reactos/apps/tests/polytest/polytest.cpp b/reactos/apps/tests/polytest/polytest.cpp deleted file mode 100644 index 8a440cf7d5c..00000000000 --- a/reactos/apps/tests/polytest/polytest.cpp +++ /dev/null @@ -1,874 +0,0 @@ -// this is a little 'sandbox' application I put together that duplicates -// the 'guts' of the Polygon algorithm. It allows for quick turn-around -// in testing the algorithm to see what effect your changes have. -// -// Royce3 - -// the stuff immediately following is support so that the sandbox code -// is nearly identical to the real thing. -// search for the _tagFILL_EDGE struct to find the beginning of the -// real stuff. - -#include -#include -#include -#include -#include -#include - -#define FASTCALL -#define STDCALL -#define INT int -#define CLIPOBJ int -#define SURFOBJ int -#define PBRUSHOBJ int -#define MIX char -#define BOOL bool -#define TRUE true -#define FALSE false -#define CONST const -#define MmCopyFromCaller memmove -#define ALTERNATE 0 -#define WINDING 1 - -#define ASSERT assert - -typedef struct W -{ - int polyFillMode; -} W; - -typedef struct DC -{ - CLIPOBJ CombinedClip; - W w; -} DC, *PDC; - -typedef struct tagPOINT -{ - long x, y; -} POINT, *PPOINT, *LPPOINT; - -typedef struct RECTL -{ - long left, top, right, bottom; -} RECTL, *PRECTL; - -#define EngFreeMem free - -#define FL_ZERO_MEMORY 1 - -#define DPRINT1 printf("%i:",__LINE__);printf -inline void DPRINT(...){} - -#define SCREENX 25 -#define SCREENY 15 -char screen[SCREENY][SCREENX]; - -#define EDGE_CHAR '*' -#define FILL_CHAR 'o' - -void* EngAllocMem ( int zero, unsigned long size, int tag=0 ) -{ - void* p = malloc ( size ); - if ( zero ) - memset ( p, 0, size ); - return p; -} - -template -inline T MIN ( T a, T b ) -{ - return a < b ? a : b; -} - -template -inline T MAX ( T a, T b ) -{ - return a > b ? a : b; -} - -template -inline T abs ( T t ) -{ - return t < 0 ? -t : t; -} - -void putpixel ( int x, int y, char c ) -{ - ASSERT( x >= 0 && x < SCREENX && y >= 0 && y < SCREENY ); - if ( screen[y][x] == c ) - return; - if ( screen[y][x] == ' ' ) - screen[y][x] = c; - else - screen[y][x] = '#'; -} - -void IntEngLineTo ( - SURFOBJ*, - CLIPOBJ, - PBRUSHOBJ, - int x1, int y1, int x2, int y2, - RECTL*, - MIX mix ) -{ - int dx = x2 - x1; - int dy = y2 - y1; - int absdx = abs(dx); - int absdy = abs(dy); - int EMax = MAX(absdx,absdy); - int E = EMax/2; - int xinc = dx < 0 ? -1 : 1, - yinc = dy < 0 ? -1 : 1; - if ( !dy ) - { - while ( x1 != x2 ) - { - putpixel ( x1, y1, mix ); - x1 += xinc; - } - return; - } - if ( !dx ) - { - while ( y1 != y2 ) - { - putpixel ( x1, y1, mix ); - y1 += yinc; - } - return; - } - for ( int i = 0; i < EMax; i++ ) - { - putpixel ( x1, y1, mix ); - if ( absdy > absdx ) - { - y1 += yinc; - E += absdx; - if ( E >= EMax ) - { - E -= absdy; - x1 += xinc; - } - } - else - { - x1 += xinc; - E += absdy; - if ( E >= EMax ) - { - E -= absdx; - y1 += yinc; - } - } - } -} - -#define FILL_EDGE_ALLOC_TAG 0x45465044 - -/* -** This struct is used for book keeping during polygon filling routines. -*/ -typedef struct _tagFILL_EDGE -{ - /*Basic line information*/ - int FromX; - int FromY; - int ToX; - int ToY; - int dx; - int dy; - int absdx, absdy; - int x, y; - int xmajor; - - /*Active Edge List information*/ - int XIntercept[2]; - int Error; - int ErrorMax; - int XDirection, YDirection; - - /* The next edge in the active Edge List*/ - struct _tagFILL_EDGE * pNext; -} FILL_EDGE; - -typedef struct _FILL_EDGE_LIST -{ - int Count; - FILL_EDGE** Edges; -} FILL_EDGE_LIST; - -#if 0 -static -void -DEBUG_PRINT_ACTIVE_EDGELIST ( FILL_EDGE* list ) -{ - FILL_EDGE* pThis = list; - if (0 == list) - { - DPRINT1("List is NULL\n"); - return; - } - - while(0 != pThis) - { - //DPRINT1("EDGE: (%d, %d) to (%d, %d)\n", pThis->FromX, pThis->FromY, pThis->ToX, pThis->ToY); - DPRINT1("EDGE: [%d,%d]\n", pThis->XIntercept[0], pThis->XIntercept[1] ); - pThis = pThis->pNext; - } -} -#else -#define DEBUG_PRINT_ACTIVE_EDGELIST(x) -#endif - -/* -** Hide memory clean up. -*/ -static -void -FASTCALL -POLYGONFILL_DestroyEdgeList(FILL_EDGE_LIST* list) -{ - int i; - if ( list ) - { - if ( list->Edges ) - { - for ( i = 0; i < list->Count; i++ ) - { - if ( list->Edges[i] ) - EngFreeMem ( list->Edges[i] ); - } - EngFreeMem ( list->Edges ); - } - EngFreeMem ( list ); - } -} - -/* -** This makes and initiaizes an Edge struct for a line between two points. -*/ -static -FILL_EDGE* -FASTCALL -POLYGONFILL_MakeEdge(POINT From, POINT To) -{ - FILL_EDGE* rc = (FILL_EDGE*)EngAllocMem(FL_ZERO_MEMORY, sizeof(FILL_EDGE), FILL_EDGE_ALLOC_TAG); - - if (0 == rc) - return NULL; - - //DPRINT1("Making Edge: (%d, %d) to (%d, %d)\n", From.x, From.y, To.x, To.y); - //Now Fill the struct. - if ( To.y < From.y ) - { - rc->FromX = To.x; - rc->FromY = To.y; - rc->ToX = From.x; - rc->ToY = From.y; - rc->YDirection = -1; - - // lines that go up get walked backwards, so need to be offset - // by -1 in order to make the walk identically on a pixel-level - rc->Error = -1; - } - else - { - rc->FromX = From.x; - rc->FromY = From.y; - rc->ToX = To.x; - rc->ToY = To.y; - rc->YDirection = 1; - - rc->Error = 0; - } - - rc->x = rc->FromX; - rc->y = rc->FromY; - rc->dx = rc->ToX - rc->FromX; - rc->dy = rc->ToY - rc->FromY; - rc->absdx = abs(rc->dx); - rc->absdy = abs(rc->dy); - - rc->xmajor = rc->absdx > rc->absdy; - - rc->ErrorMax = MAX(rc->absdx,rc->absdy); - - rc->Error += rc->ErrorMax / 2; - - rc->XDirection = (rc->dx < 0)?(-1):(1); - - rc->pNext = 0; - - DPRINT("MakeEdge (%i,%i)->(%i,%i) d=(%i,%i) dir=(%i,%i) err=%i max=%i\n", - From.x, From.y, To.x, To.y, rc->dx, rc->dy, rc->XDirection, rc->YDirection, rc->Error, rc->ErrorMax ); - - return rc; -} -/* -** My Edge comparison routine. -** This is for scan converting polygon fill. -** First sort by MinY, then Minx, then slope. -** -** This comparison will help us determine which -** lines will become active first when scanning from -** top (min y) to bottom (max y). -** -** Return Value Meaning -** Negative integer element1 < element2 -** Zero element1 = element2 -** Positive integer element1 > element2 -*/ -static -INT -FASTCALL -FILL_EDGE_Compare(FILL_EDGE* Edge1, FILL_EDGE* Edge2) -{ - int e1 = Edge1->XIntercept[0] + Edge1->XIntercept[1]; - int e2 = Edge2->XIntercept[0] + Edge2->XIntercept[1]; - - return e1 - e2; -} - - -/* -** Insert an edge into a list keeping the list in order. -*/ -static -void -FASTCALL -POLYGONFILL_ActiveListInsert(FILL_EDGE** activehead, FILL_EDGE* NewEdge ) -{ - FILL_EDGE *pPrev, *pThis; - //DPRINT1("In POLYGONFILL_ActiveListInsert()\n"); - ASSERT ( activehead && NewEdge ); - if ( !*activehead ) - { - NewEdge->pNext = NULL; - *activehead = NewEdge; - return; - } - /* - ** First lets check to see if we have a new smallest value. - */ - if (FILL_EDGE_Compare(NewEdge, *activehead) <= 0) - { - NewEdge->pNext = *activehead; - *activehead = NewEdge; - return; - } - /* - ** Ok, now scan to the next spot to put this item. - */ - pThis = *activehead; - pPrev = NULL; - while ( pThis && FILL_EDGE_Compare(pThis, NewEdge) < 0 ) - { - pPrev = pThis; - pThis = pThis->pNext; - } - - ASSERT(pPrev); - NewEdge->pNext = pPrev->pNext; - pPrev->pNext = NewEdge; - //DEBUG_PRINT_ACTIVE_EDGELIST(*activehead); -} - -/* -** Create a list of edges for a list of points. -*/ -static -FILL_EDGE_LIST* -FASTCALL -POLYGONFILL_MakeEdgeList(PPOINT Points, int Count) -{ - int CurPt = 0; - FILL_EDGE_LIST* list = 0; - FILL_EDGE* e = 0; - - if ( 0 == Points || 2 > Count ) - return 0; - - list = (FILL_EDGE_LIST*)EngAllocMem(FL_ZERO_MEMORY, sizeof(FILL_EDGE_LIST), FILL_EDGE_ALLOC_TAG); - if ( 0 == list ) - goto fail; - list->Count = 0; - list->Edges = (FILL_EDGE**)EngAllocMem(FL_ZERO_MEMORY, Count*sizeof(FILL_EDGE*), FILL_EDGE_ALLOC_TAG); - if ( !list->Edges ) - goto fail; - memset ( list->Edges, 0, Count * sizeof(FILL_EDGE*) ); - - for ( CurPt = 1; CurPt < Count; ++CurPt ) - { - e = POLYGONFILL_MakeEdge ( Points[CurPt-1], Points[CurPt] ); - if ( !e ) - goto fail; - // if a straight horizontal line - who cares? - if ( !e->absdy ) - EngFreeMem ( e ); - else - list->Edges[list->Count++] = e; - } - e = POLYGONFILL_MakeEdge ( Points[CurPt-1], Points[0] ); - if ( !e ) - goto fail; - if ( !e->absdy ) - EngFreeMem ( e ); - else - list->Edges[list->Count++] = e; - return list; - -fail: - DPRINT1("Out Of MEMORY!!\n"); - POLYGONFILL_DestroyEdgeList ( list ); - return 0; -} - - -/* -** This slow routine uses the data stored in the edge list to -** calculate the x intercepts for each line in the edge list -** for scanline Scanline. -**TODO: Get rid of this floating point arithmetic -*/ -static -void -FASTCALL -POLYGONFILL_UpdateScanline(FILL_EDGE* pEdge, int Scanline) -{ - if ( 0 == pEdge->dy ) - return; - - ASSERT ( pEdge->FromY <= Scanline && pEdge->ToY > Scanline ); - - if ( pEdge->xmajor ) - { - int steps; - - ASSERT ( pEdge->y == Scanline ); - - // now shoot to end of scanline collision - steps = (pEdge->ErrorMax-pEdge->Error-1)/pEdge->absdy; - if ( steps ) - { - // record first collision with scanline - int x1 = pEdge->x; - pEdge->x += steps * pEdge->XDirection; - pEdge->Error += steps * pEdge->absdy; - ASSERT ( pEdge->Error < pEdge->ErrorMax ); - pEdge->XIntercept[0] = MIN(x1,pEdge->x); - pEdge->XIntercept[1] = MAX(x1,pEdge->x); - } - else - { - pEdge->XIntercept[0] = pEdge->x; - pEdge->XIntercept[1] = pEdge->x; - } - - // we should require exactly 1 step to step onto next scanline... - ASSERT ( (pEdge->ErrorMax-pEdge->Error-1) / pEdge->absdy == 0 ); - pEdge->x += pEdge->XDirection; - pEdge->Error += pEdge->absdy; - ASSERT ( pEdge->Error >= pEdge->ErrorMax ); - - // now step onto next scanline... - pEdge->Error -= pEdge->absdx; - pEdge->y++; - } - else // then this is a y-major line - { - pEdge->XIntercept[0] = pEdge->x; - pEdge->XIntercept[1] = pEdge->x; - - pEdge->Error += pEdge->absdx; - pEdge->y++; - - if ( pEdge->Error >= pEdge->ErrorMax ) - { - pEdge->Error -= pEdge->ErrorMax; - pEdge->x += pEdge->XDirection; - ASSERT ( pEdge->Error < pEdge->ErrorMax ); - } - } - - DPRINT("Line (%d, %d) to (%d, %d) intersects scanline %d at (%d,%d)\n", - pEdge->FromX, pEdge->FromY, pEdge->ToX, pEdge->ToY, Scanline, pEdge->XIntercept[0], pEdge->XIntercept[1] ); -} - -/* -** This method updates the Active edge collection for the scanline Scanline. -*/ -static -void -STDCALL -POLYGONFILL_BuildActiveList ( int Scanline, FILL_EDGE_LIST* list, FILL_EDGE** ActiveHead ) -{ - int i; - - ASSERT ( list && ActiveHead ); - *ActiveHead = 0; - for ( i = 0; i < list->Count; i++ ) - { - FILL_EDGE* pEdge = list->Edges[i]; - ASSERT(pEdge); - if ( pEdge->FromY <= Scanline && pEdge->ToY > Scanline ) - { - POLYGONFILL_UpdateScanline ( pEdge, Scanline ); - POLYGONFILL_ActiveListInsert ( ActiveHead, pEdge ); - } - } -} - -/* -** This method fills the portion of the polygon that intersects with the scanline -** Scanline. -*/ -static -void -STDCALL -POLYGONFILL_FillScanLineAlternate( - PDC dc, - int ScanLine, - FILL_EDGE* ActiveHead, - SURFOBJ *SurfObj, - PBRUSHOBJ BrushObj, - MIX RopMode ) -{ - FILL_EDGE *pLeft, *pRight; - - if ( !ActiveHead ) - return; - - pLeft = ActiveHead; - pRight = pLeft->pNext; - ASSERT(pRight); - - while ( NULL != pRight ) - { - int x1 = pLeft->XIntercept[0]; - int x2 = pRight->XIntercept[1]; - if ( x2 > x1 ) - { - RECTL BoundRect; - BoundRect.top = ScanLine; - BoundRect.bottom = ScanLine + 1; - BoundRect.left = x1; - BoundRect.right = x2; - - DPRINT("Fill Line (%d, %d) to (%d, %d)\n",x1, ScanLine, x2, ScanLine); - IntEngLineTo( SurfObj, - dc->CombinedClip, - BrushObj, - x1, - ScanLine, - x2, - ScanLine, - &BoundRect, // Bounding rectangle - RopMode); // MIX - } - pLeft = pRight->pNext; - pRight = pLeft ? pLeft->pNext : NULL; - } -} - -static -void -STDCALL -POLYGONFILL_FillScanLineWinding( - PDC dc, - int ScanLine, - FILL_EDGE* ActiveHead, - SURFOBJ *SurfObj, - PBRUSHOBJ BrushObj, - MIX RopMode ) -{ - FILL_EDGE *pLeft, *pRight; - int x1, x2, winding = 0; - RECTL BoundRect; - - if ( !ActiveHead ) - return; - - BoundRect.top = ScanLine; - BoundRect.bottom = ScanLine + 1; - - pLeft = ActiveHead; - winding = pLeft->YDirection; - pRight = pLeft->pNext; - ASSERT(pRight); - - // setup first line... - x1 = pLeft->XIntercept[0]; - x2 = pRight->XIntercept[1]; - - pLeft = pRight; - pRight = pLeft->pNext; - winding += pLeft->YDirection; - - while ( NULL != pRight ) - { - int newx1 = pLeft->XIntercept[0]; - int newx2 = pRight->XIntercept[1]; - if ( winding ) - { - // check and see if this new line touches the previous... - if ( (newx1 >= x1 && newx1 <= x2) - || (newx2 >= x1 && newx2 <= x2) - || (x1 >= newx1 && x1 <= newx2) - || (x2 >= newx2 && x2 <= newx2) - ) - { - // yup, just tack it on to our existing line - x1 = MIN(x1,newx1); - x2 = MAX(x2,newx2); - } - else - { - // nope - render the old line.. - BoundRect.left = x1; - BoundRect.right = x2; - - DPRINT("Fill Line (%d, %d) to (%d, %d)\n",x1, ScanLine, x2, ScanLine); - IntEngLineTo( SurfObj, - dc->CombinedClip, - BrushObj, - x1, - ScanLine, - x2, - ScanLine, - &BoundRect, // Bounding rectangle - RopMode); // MIX - - x1 = newx1; - x2 = newx2; - } - } - pLeft = pRight; - pRight = pLeft->pNext; - winding += pLeft->YDirection; - } - // there will always be a line left-over, render it now... - BoundRect.left = x1; - BoundRect.right = x2; - - DPRINT("Fill Line (%d, %d) to (%d, %d)\n",x1, ScanLine, x2, ScanLine); - IntEngLineTo( SurfObj, - dc->CombinedClip, - BrushObj, - x1, - ScanLine, - x2, - ScanLine, - &BoundRect, // Bounding rectangle - RopMode); // MIX -} - -//When the fill mode is ALTERNATE, GDI fills the area between odd-numbered and -//even-numbered polygon sides on each scan line. That is, GDI fills the area between the -//first and second side, between the third and fourth side, and so on. - -//WINDING Selects winding mode (fills any region with a nonzero winding value). -//When the fill mode is WINDING, GDI fills any region that has a nonzero winding value. -//This value is defined as the number of times a pen used to draw the polygon would go around the region. -//The direction of each edge of the polygon is important. - -BOOL -STDCALL -FillPolygon( - PDC dc, - SURFOBJ *SurfObj, - PBRUSHOBJ BrushObj, - MIX RopMode, - CONST PPOINT Points, - int Count, - RECTL BoundRect ) -{ - FILL_EDGE_LIST *list = 0; - FILL_EDGE *ActiveHead = 0; - int ScanLine; - - void - STDCALL - (*FillScanLine)( - PDC dc, - int ScanLine, - FILL_EDGE* ActiveHead, - SURFOBJ *SurfObj, - PBRUSHOBJ BrushObj, - MIX RopMode ); - - DPRINT("FillPolygon\n"); - - /* Create Edge List. */ - list = POLYGONFILL_MakeEdgeList(Points, Count); - /* DEBUG_PRINT_EDGELIST(list); */ - if (NULL == list) - return FALSE; - - if ( WINDING == dc->w.polyFillMode ) - FillScanLine = POLYGONFILL_FillScanLineWinding; - else /* default */ - FillScanLine = POLYGONFILL_FillScanLineAlternate; - - /* For each Scanline from BoundRect.bottom to BoundRect.top, - * determine line segments to draw - */ - for ( ScanLine = BoundRect.top; ScanLine < BoundRect.bottom; ++ScanLine ) - { - POLYGONFILL_BuildActiveList(ScanLine, list, &ActiveHead); - //DEBUG_PRINT_ACTIVE_EDGELIST(ActiveHead); - FillScanLine ( dc, ScanLine, ActiveHead, SurfObj, BrushObj, RopMode ); - } - - /* Free Edge List. If any are left. */ - POLYGONFILL_DestroyEdgeList(list); - - return TRUE; -} - - - - - -// this is highly hacked from W32kPolygon... -BOOL -Polygon ( CONST PPOINT UnsafePoints, int Count, int polyFillMode ) -{ - BOOL ret; - RECTL DestRect; - int CurrentPoint; - PPOINT Points; - SURFOBJ* SurfObj = 0; - DC dc; - PBRUSHOBJ OutBrushObj = 0; - - dc.CombinedClip = 0; - dc.w.polyFillMode = polyFillMode; - - DPRINT1("In W32kPolygon()\n"); - - if ( NULL == UnsafePoints || Count < 2) - { - DPRINT1("ERROR_INVALID_PARAMETER\n"); - return FALSE; - } - - /* Copy points from userspace to kernelspace */ - Points = (PPOINT)EngAllocMem(0, Count * sizeof(POINT)); - if (NULL == Points) - { - DPRINT1("ERROR_NOT_ENOUGH_MEMORY\n"); - return FALSE; - } - MmCopyFromCaller(Points, UnsafePoints, Count * sizeof(POINT)); - if ( memcmp ( Points, UnsafePoints, Count * sizeof(POINT) ) ) - { - free(Points); - return FALSE; - } - - DestRect.left = Points[0].x; - DestRect.right = Points[0].x; - DestRect.top = Points[0].y; - DestRect.bottom = Points[0].y; - - for (CurrentPoint = 1; CurrentPoint < Count; ++CurrentPoint) - { - DestRect.left = MIN(DestRect.left, Points[CurrentPoint].x); - DestRect.right = MAX(DestRect.right, Points[CurrentPoint].x); - DestRect.top = MIN(DestRect.top, Points[CurrentPoint].y); - DestRect.bottom = MAX(DestRect.bottom, Points[CurrentPoint].y); - } - - // Draw the Polygon Edges with the current pen - for (CurrentPoint = 0; CurrentPoint < Count; ++CurrentPoint) - { - POINT To, From; //, Next; - - /* Let CurrentPoint be i - * if i+1 > Count, Draw a line from Points[i] to Points[0] - * Draw a line from Points[i] to Points[i+1] - */ - From = Points[CurrentPoint]; - if ( CurrentPoint + 1 >= Count) - { - To = Points[0]; - } - else - { - To = Points[CurrentPoint + 1]; - } - - DPRINT1("Polygon Making line from (%d,%d) to (%d,%d)\n", From.x, From.y, To.x, To.y ); - IntEngLineTo(SurfObj, - dc.CombinedClip, - OutBrushObj, - From.x, - From.y, - To.x, - To.y, - &DestRect, - EDGE_CHAR); /* MIX */ - } - /* determine the fill mode to fill the polygon. */ - ret = FillPolygon(&dc, SurfObj, OutBrushObj, FILL_CHAR, Points, Count, DestRect ); - free(Points); - - return ret; -} - - -int main() -{ - memset ( screen, ' ', sizeof(screen) ); - POINT pts[] = - { -#if 0 - { 0, 0 }, - { 12, 4 }, - { 4, 8 }, -#elif 0 - { 3, 0 }, - { 0, 3 }, - { 3, 6 }, -#elif 0 - { 1, 1 }, - { 3, 1 }, - { 3, 3 }, - { 1, 3 } -#elif 0 - { 0, 0 }, - { 4, 0 }, - { 4, 4 }, - { 8, 4 }, - { 8, 8 }, - { 4, 8 }, - { 4, 4 }, - { 0, 4 }, -#else - { 4, 12 }, - { 12, 0 }, - { 18, 12 }, - { 4, 4 }, - { 20, 4 } -#endif - }; - const int pts_count = sizeof(pts)/sizeof(pts[0]); - - // use ALTERNATE or WINDING for 3rd param - Polygon ( pts, pts_count, ALTERNATE ); - - // print out our "screen" - for ( int y = 0; y < SCREENY; y++ ) - { - for ( int x = 0; x < SCREENX; x++ ) - { - printf("%c", screen[y][x] ); - } - printf("\n"); - } - DPRINT1("Done!\n"); - (void)getch(); -} -/* EOF */ diff --git a/reactos/apps/tests/polytest/polytest.dsp b/reactos/apps/tests/polytest/polytest.dsp deleted file mode 100644 index a53e6d0f2c0..00000000000 --- a/reactos/apps/tests/polytest/polytest.dsp +++ /dev/null @@ -1,88 +0,0 @@ -# Microsoft Developer Studio Project File - Name="polytest" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=polytest - 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 "polytest.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 "polytest.mak" CFG="polytest - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "polytest - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "polytest - 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)" == "polytest - 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)" == "polytest - 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 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 /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "polytest - Win32 Release" -# Name "polytest - Win32 Debug" -# Begin Source File - -SOURCE=.\polytest.cpp -# End Source File -# End Target -# End Project diff --git a/reactos/apps/tests/polytest/polytest.dsw b/reactos/apps/tests/polytest/polytest.dsw deleted file mode 100644 index 308810dbdf3..00000000000 --- a/reactos/apps/tests/polytest/polytest.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "polytest"=".\polytest.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/reactos/apps/tests/popupmenu/.cvsignore b/reactos/apps/tests/popupmenu/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/popupmenu/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/popupmenu/makefile b/reactos/apps/tests/popupmenu/makefile deleted file mode 100644 index 3b162ac5bbc..00000000000 --- a/reactos/apps/tests/popupmenu/makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $Id: makefile,v 1.1 2003/12/27 23:45:48 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = no - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = popupmenu - -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/popupmenu/popupmenu.c b/reactos/apps/tests/popupmenu/popupmenu.c deleted file mode 100644 index e6a33c2e4f5..00000000000 --- a/reactos/apps/tests/popupmenu/popupmenu.c +++ /dev/null @@ -1,102 +0,0 @@ -#include -#include -#include -#include "resource.h" - -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 = "MenuTestClass"; - 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 = (LPCTSTR)IDM_MAINMENU; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - if (RegisterClass(&wc) == 0) - { - fprintf(stderr, "RegisterClass failed (last error 0x%lX)\n", - GetLastError()); - return(1); - } - - hWnd = CreateWindow("MenuTestClass", - "PopupMenu Test", - WS_OVERLAPPEDWINDOW | WS_VISIBLE, - 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); - } - - while(GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - return msg.wParam; -} - -LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch(msg) - { - case WM_COMMAND: - { - switch(LOWORD(wParam)) - { - case IDM_EXIT: - PostQuitMessage(0); - break; - } - break; - } - case WM_RBUTTONUP: - { - POINT pos; - HMENU Menu; - - pos.x = LOWORD(lParam); - pos.y = HIWORD(lParam); - ClientToScreen(hWnd, &pos); - - if((Menu = GetMenu(hWnd)) && (Menu = GetSubMenu(Menu, 1))) - { - TrackPopupMenu(Menu, 0, pos.x, pos.y, 0, hWnd, NULL); - } - break; - } - case WM_DESTROY: - { - PostQuitMessage(0); - break; - } - default: - { - return DefWindowProc(hWnd, msg, wParam, lParam); - } - } - return 0; -} diff --git a/reactos/apps/tests/popupmenu/popupmenu.rc b/reactos/apps/tests/popupmenu/popupmenu.rc deleted file mode 100644 index 9c4af8b0542..00000000000 --- a/reactos/apps/tests/popupmenu/popupmenu.rc +++ /dev/null @@ -1,47 +0,0 @@ -#include -#include -#include "resource.h" - -IDM_MAINMENU MENU LOADONCALL MOVEABLE DISCARDABLE -{ - POPUP "&File" - { - MENUITEM "&New\tCtrl+N", 1 - MENUITEM "&Open\tCtrl+O", 2 - POPUP "Open &Recent" - { - MENUITEM "&1", 11 - MENUITEM "&2", 12 - MENUITEM "&3", 13 - MENUITEM "&4", 14 - MENUITEM "&5", 15 - MENUITEM "&6", 16 - MENUITEM "&7", 17 - MENUITEM "&8", 18 - MENUITEM "&9", 19 - } - MENUITEM SEPARATOR - MENUITEM "&Save\tCtrl+S", 3 - MENUITEM "Save &as...", 4 - MENUITEM SEPARATOR - MENUITEM "E&xit\tAlt-F4", IDM_EXIT - } - POPUP "&Edit" - { - MENUITEM "&Undo\tCtrl+Z", 20 - MENUITEM "&Redo\tShift+Ctrl+Z", 21 - MENUITEM SEPARATOR - MENUITEM "&Cut\tCtrl+X", 22 - MENUITEM "&Copy\tCtrl+C", 23 - MENUITEM "&Paste\tCtrl+V", 24 - MENUITEM SEPARATOR - MENUITEM "Select &all", 25 - MENUITEM "&Delete\tDel", 26 - } - POPUP "&Help" - { - MENUITEM "&Help Topics\tF1", 30 - MENUITEM SEPARATOR - MENUITEM "&About...", 31 - } -} diff --git a/reactos/apps/tests/popupmenu/resource.h b/reactos/apps/tests/popupmenu/resource.h deleted file mode 100644 index b4929dbf2d2..00000000000 --- a/reactos/apps/tests/popupmenu/resource.h +++ /dev/null @@ -1,2 +0,0 @@ -#define IDM_MAINMENU 101 -#define IDM_EXIT 199 diff --git a/reactos/apps/tests/primitives/.cvsignore b/reactos/apps/tests/primitives/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/primitives/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/primitives/Makefile b/reactos/apps/tests/primitives/Makefile deleted file mode 100644 index d97c981483e..00000000000 --- a/reactos/apps/tests/primitives/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# ReactOS explorer -# -# Makefile -# - -PATH_TO_TOP = ../../.. - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = primitives - -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 = \ - primitives.o \ - mk_font.o - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# overide LD_CC to use g++ for linking of the executable -LD_CC = $(CXX) - -# EOF diff --git a/reactos/apps/tests/primitives/mk_font.cpp b/reactos/apps/tests/primitives/mk_font.cpp deleted file mode 100644 index 59e3cf8ca93..00000000000 --- a/reactos/apps/tests/primitives/mk_font.cpp +++ /dev/null @@ -1,69 +0,0 @@ - -// ------------------------------------------------------------------ -// Windows 2000 Graphics API Black Book -// Chapter 4 - Utility functions -// -// Created by Damon Chandler -// Updates can be downloaded at: -// -// Please do not hesistate to e-mail me at dmc27@ee.cornell.edu -// if you have any questions about this code. -// ------------------------------------------------------------------ - -//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -#include -#include - -#include "mk_font.h" -//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - -namespace font { - -// creates a logical font -HFONT MakeFont( - IN HDC hDestDC, // handle to target DC - IN LPCSTR typeface_name, // font's typeface name - IN int point_size, // font's point size - IN const BYTE charset, // font's character set - IN const DWORD style // font's styles - ) -{ - // - // NOTE: On Windows 9x/Me, GetWorldTransform is not - // supported. For compatibility with these platforms you - // should initialize the XFORM::eM22 data member to 1.0. - // - XFORM xf = {0, 0, 0, 1.0, 0, 0}; - GetWorldTransform(hDestDC, &xf); - int pixels_per_inch = GetDeviceCaps(hDestDC, LOGPIXELSY); - - POINT PSize = { - 0, - -MulDiv(static_cast(xf.eM22 * point_size + 0.5), - pixels_per_inch, 72) - }; - - HFONT hResult = NULL; - if (DPtoLP(hDestDC, &PSize, 1)) - { - LOGFONT lf; - memset(&lf, 0, sizeof(LOGFONT)); - - lf.lfHeight = PSize.y; - lf.lfCharSet = charset; - lstrcpyn(reinterpret_cast(&lf.lfFaceName), - typeface_name, LF_FACESIZE); - - lf.lfWeight = (style & FS_BOLD) ? FW_BOLD : FW_DONTCARE; - lf.lfItalic = (style & FS_ITALIC) ? true : false; - lf.lfUnderline = (style & FS_UNDERLINE) ? true : false; - lf.lfStrikeOut = (style & FS_STRIKEOUT) ? true : false; - - // create the logical font - hResult = CreateFontIndirect(&lf); - } - return hResult; -} -//------------------------------------------------------------------------- - -} // namespace font diff --git a/reactos/apps/tests/primitives/mk_font.h b/reactos/apps/tests/primitives/mk_font.h deleted file mode 100644 index 98c164c9f1d..00000000000 --- a/reactos/apps/tests/primitives/mk_font.h +++ /dev/null @@ -1,39 +0,0 @@ - -// ------------------------------------------------------------------ -// Windows 2000 Graphics API Black Book -// Chapter 4 - Utility functions -// -// Created by Damon Chandler -// Updates can be downloaded at: -// -// Please do not hesistate to e-mail me at dmc27@ee.cornell.edu -// if you have any questions about this code. -// ------------------------------------------------------------------ - -//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -#ifndef CH4_UTILS_H -#define CH4_UTILS_H - -#include -//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - -// change namespace name appropriately to suit your needs -namespace font { - -// font options -static const ULONG FS_NONE = 0x00000000; -static const ULONG FS_BOLD = 0x00000001; -static const ULONG FS_ITALIC = 0x00000002; -static const ULONG FS_UNDERLINE = 0x00000004; -static const ULONG FS_STRIKEOUT = 0x00000008; - -// creates a logical font -HFONT MakeFont(IN HDC hDestDC, IN LPCSTR typeface_name, - IN int point_size, IN const BYTE charset = ANSI_CHARSET, - IN const DWORD style = FS_NONE); - -} - -//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -#endif // CH4_UTILS_H -//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< diff --git a/reactos/apps/tests/primitives/primitives.cpp b/reactos/apps/tests/primitives/primitives.cpp deleted file mode 100644 index 1a3499967ac..00000000000 --- a/reactos/apps/tests/primitives/primitives.cpp +++ /dev/null @@ -1,351 +0,0 @@ - -// ------------------------------------------------------------------ -// Windows 2000 Graphics API Black Book -// Chapter 5 - Listing 5.1 (Output Primitives Demo) -// -// Created by Damon Chandler -// Updates can be downloaded at: -// -// Please do not hesistate to e-mail me at dmc27@ee.cornell.edu -// if you have any questions about this code. -// ------------------------------------------------------------------ - - -//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -#include -#include - -// for the MakeFont() function... -#include "mk_font.h" -//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - - -HINSTANCE hInst; -const char* WndClassName = "GMainWnd"; -LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam, - LPARAM LParam); - - -int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR, - int nCmdShow) -{ - hInst = hInstance; - - WNDCLASS wc; - memset(&wc, 0, sizeof(WNDCLASS)); - - wc.style = CS_VREDRAW | CS_HREDRAW; - wc.lpszClassName = WndClassName; - wc.lpfnWndProc = MainWndProc; - wc.hInstance = hInst; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.hbrBackground = reinterpret_cast( - COLOR_BTNFACE + 1 - ); - - if (RegisterClass(&wc)) - { - HWND hWnd = - CreateWindow( - WndClassName, TEXT("Output Primitives Demo"), - WS_OVERLAPPEDWINDOW | WS_CAPTION | - WS_VISIBLE | WS_CLIPCHILDREN, - CW_USEDEFAULT, CW_USEDEFAULT, 640, 480, - 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; -} -//------------------------------------------------------------------ - - -enum OutPrimitive { - opLine, opBezier, opRectangle, opRoundRect, - opEllipse, opArc, opPie, opChord, opCustom - }; - -void DrawPrimitive(IN HDC hDC, IN const RECT& RPrimitive, - IN OutPrimitive PrimitiveID) -{ - RECT R = RPrimitive; - InflateRect(&R, -10, -10); - - switch (PrimitiveID) - { - case opLine: - { - const POINT PLine[] = {{R.left, R.top}, {R.right, R.bottom}}; - Polyline(hDC, PLine, 2); - break; - } - case opBezier: - { - const POINT PControlPoints[] = { - {R.left, R.top}, - {(R.right - R.left) / 2, R.top}, - {(R.right - R.left) / 2, R.bottom}, - {R.right, R.bottom} - }; - PolyBezier(hDC, PControlPoints, 4); - break; - } - case opRectangle: - { - Rectangle(hDC, R.left, R.top, R.right, R.bottom); - break; - } - case opRoundRect: - { - RoundRect(hDC, R.left, R.top, R.right, R.bottom, 20, 20); - break; - } - case opEllipse: - { - Ellipse(hDC, R.left, R.top, R.right, R.bottom); - break; - } - case opArc: - { - const POINT PRads[] = { - {(R.right - R.left) / 3 + R.left, R.top}, - {(R.right - R.left) / 3 + R.left, R.bottom} - }; - Arc(hDC, R.left, R.top, R.right, R.bottom, - PRads[0].x, PRads[0].y, PRads[1].x, PRads[1].y); - break; - } - case opPie: - { - const POINT PRads[] = { - {(R.right - R.left) / 3 + R.left, R.top}, - {(R.right - R.left) / 3 + R.left, R.bottom} - }; - Pie(hDC, R.left, R.top, R.right, R.bottom, - PRads[0].x, PRads[0].y, PRads[1].x, PRads[1].y); - break; - } - case opChord: - { - const POINT PRads[] = { - {(R.right - R.left) / 3 + R.left, R.top}, - {(R.right - R.left) / 3 + R.left, R.bottom} - }; - Chord(hDC, R.left, R.top, R.right, R.bottom, - PRads[0].x, PRads[0].y, PRads[1].x, PRads[1].y); - break; - } - case opCustom: - { - const POINT PVertices[] = { - {R.left, (R.bottom - R.top) / 2 + R.top}, - {(R.right - R.left) / 2 + R.left, R.top}, - {R.right, (R.bottom - R.top) / 2 + R.top}, - {(R.right - R.left) / 2 + R.left, R.bottom} - }; - Polygon(hDC, PVertices, 4); - break; - } - } -} -//------------------------------------------------------------------ - - -HWND hListBox = NULL; // handle to the list box -HBRUSH hListBrush = NULL; // handle to the list box brush -HPEN hListPen = NULL; // handle to the list box pen -HFONT hListFont = NULL; // handle to the list box font - -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 | WS_VSCROLL | - LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | - LBS_OWNERDRAWFIXED, - 0, 0, 640, 480, - hWnd, NULL, hInst, NULL - ); - assert(hListBox != NULL); - - SetWindowLong( - hListBox, GWL_ID, reinterpret_cast(hListBox) - ); - - SNDMSG(hListBox, LB_ADDSTRING, 0, - reinterpret_cast(TEXT("Line"))); - SNDMSG(hListBox, LB_ADDSTRING, 0, - reinterpret_cast(TEXT("Bezier Curve"))); - SNDMSG(hListBox, LB_ADDSTRING, 0, - reinterpret_cast(TEXT("Rectangle"))); - SNDMSG(hListBox, LB_ADDSTRING, 0, - reinterpret_cast(TEXT("Rounded Rectangle"))); - SNDMSG(hListBox, LB_ADDSTRING, 0, - reinterpret_cast(TEXT("Ellipse"))); - SNDMSG(hListBox, LB_ADDSTRING, 0, - reinterpret_cast(TEXT("Arc"))); - SNDMSG(hListBox, LB_ADDSTRING, 0, - reinterpret_cast(TEXT("Pie Slice"))); - SNDMSG(hListBox, LB_ADDSTRING, 0, - reinterpret_cast(TEXT("Chord"))); - SNDMSG(hListBox, LB_ADDSTRING, 0, - reinterpret_cast(TEXT("Custom"))); - - hListBrush = CreateSolidBrush(PALETTERGB(64, 192, 64)); - hListPen = CreatePen(PS_SOLID, 3, PALETTERGB(0, 0, 0)); - HDC hScreenDC = GetDC(NULL); -#if 0 - try -#endif - { - // MakeFont() from Chapter 4 - hListFont = font::MakeFont( - hScreenDC, "Impact", 20, ANSI_CHARSET, - font::FS_BOLD | font::FS_UNDERLINE - ); - } -#if 0 - catch (...) -#endif - { - ReleaseDC(NULL, hScreenDC); - } - ReleaseDC(NULL, hScreenDC); - - break; - } - case WM_MEASUREITEM: - { - LPMEASUREITEMSTRUCT lpmis = - reinterpret_cast(lParam); - assert(lpmis != NULL); - - if (lpmis->CtlID == reinterpret_cast(hListBox)) - { - lpmis->itemHeight = 150; - return TRUE; - } - break; - } - case WM_DRAWITEM: - { - LPDRAWITEMSTRUCT lpdis = - reinterpret_cast(lParam); - assert(lpdis != NULL); - - if (lpdis->CtlID == reinterpret_cast(hListBox)) - { - SaveDC(lpdis->hDC); -#if 0 - try -#endif - { - SelectObject(lpdis->hDC, hListBrush); - SelectObject(lpdis->hDC, hListPen); - SelectObject(lpdis->hDC, hListFont); - - bool selected = (lpdis->itemState & ODS_SELECTED); - COLORREF clrText = GetSysColor( - selected ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT - ); - HBRUSH hListBrush = GetSysColorBrush( - selected ? COLOR_HIGHLIGHT : COLOR_WINDOW - ); - - // fill the background - FillRect(lpdis->hDC, &lpdis->rcItem, hListBrush); - - // render the output primitive - RECT RPrimitive = lpdis->rcItem; - InflateRect(&RPrimitive, -5, -5); - RPrimitive.right = static_cast( - 0.6 * lpdis->rcItem.right + 0.5 - ); - FillRect( - lpdis->hDC, &RPrimitive, - reinterpret_cast(COLOR_BTNFACE + 1) - ); - DrawPrimitive( - lpdis->hDC, RPrimitive, - static_cast(lpdis->itemID) - ); - if (selected) InvertRect(lpdis->hDC, &RPrimitive); - DrawEdge(lpdis->hDC, &RPrimitive, EDGE_SUNKEN, BF_RECT); - - // render the text - TCHAR text[13]; - if (SNDMSG(hListBox, LB_GETTEXT, lpdis->itemID, - reinterpret_cast(&text)) != LB_ERR) - { - RECT RText = RPrimitive; - RText.left = RPrimitive.right; - RText.right = lpdis->rcItem.right; - - SelectObject(lpdis->hDC, hListFont); - SetBkMode(lpdis->hDC, TRANSPARENT); - SetTextColor(lpdis->hDC, clrText); - - DrawText(lpdis->hDC, text, -1, &RText, - DT_CENTER | DT_VCENTER | DT_SINGLELINE); - } - - // indicate keyboard focus - if (lpdis->itemState & ODS_FOCUS) - { - RECT RFocus = lpdis->rcItem; - InflateRect(&RFocus, -1, -1); - DrawFocusRect(lpdis->hDC, &RFocus); - } - } -#if 0 - catch (...) -#endif - { - RestoreDC(lpdis->hDC, -1); - } - RestoreDC(lpdis->hDC, -1); - return TRUE; - } - break; - } - case WM_SIZE: - { - MoveWindow( - hListBox, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE - ); - return 0; - } - case WM_DESTROY: - { - if (hListBrush) DeleteObject(hListBrush); - if (hListPen) DeleteObject(hListPen); - if (hListFont) DeleteObject(hListFont); - - PostQuitMessage(0); - return 0; - } - } - return DefWindowProc(hWnd, msg, wParam, lParam); -} -//------------------------------------------------------------------------- - - - diff --git a/reactos/apps/tests/pseh/.cvsignore b/reactos/apps/tests/pseh/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/pseh/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/pseh/Makefile b/reactos/apps/tests/pseh/Makefile deleted file mode 100644 index 2d19be7c6a5..00000000000 --- a/reactos/apps/tests/pseh/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $Id: Makefile,v 1.1 2004/06/03 04:15:40 hyperion Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = pseh - -TARGET_OBJECTS = $(TARGET_NAME).o - -TARGET_CFLAGS = -Wall -Werror -D__USE_W32API - -TARGET_SDKLIBS = pseh.a - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/pteb/.cvsignore b/reactos/apps/tests/pteb/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/pteb/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/pteb/Makefile b/reactos/apps/tests/pteb/Makefile deleted file mode 100644 index bd0b363bc59..00000000000 --- a/reactos/apps/tests/pteb/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $Id: Makefile,v 1.9 2003/11/14 17:13:19 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = pteb - -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/pteb/pteb.c b/reactos/apps/tests/pteb/pteb.c deleted file mode 100644 index f91a2c16981..00000000000 --- a/reactos/apps/tests/pteb/pteb.c +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include - - -int main(int argc, char* argv[]) -{ - int x; - PTEB Teb; - - printf("TEB dumpper\n"); - __asm__("movl %%fs:0x18, %0\n\t" - : "=a" (x) - : /* no inputs */); - printf("fs[0x18] %x\n", x); - - Teb = (PTEB)x; - - printf("StackBase: 0x%08lX\n", (DWORD)Teb->Tib.StackBase); - printf("StackLimit: 0x%08lX\n", (DWORD)Teb->Tib.StackLimit); - printf("DeallocationStack: 0x%08lX\n", (DWORD)Teb->DeallocationStack); - - return(0); -} diff --git a/reactos/apps/tests/regdump/.cvsignore b/reactos/apps/tests/regdump/.cvsignore deleted file mode 100644 index e24713815a0..00000000000 --- a/reactos/apps/tests/regdump/.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/regdump/main.c b/reactos/apps/tests/regdump/main.c deleted file mode 100644 index dd474c39743..00000000000 --- a/reactos/apps/tests/regdump/main.c +++ /dev/null @@ -1,45 +0,0 @@ -// main.c : -// -#include -#include -#include "regdump.h" - - -HANDLE OutputHandle; -HANDLE InputHandle; - - -DWORD GetInput(char* Buffer, int buflen) -{ - DWORD Result; - - ReadConsoleA(InputHandle, Buffer, buflen, &Result, NULL); - return Result; -} - -int __cdecl main(int argc, char* argv[]) -{ - //AllocConsole(); - InputHandle = GetStdHandle(STD_INPUT_HANDLE); - OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE); - //return regmain(argc, argv); - return regdump(argc, argv); -} - - -#ifndef __GNUC__ - -//__declspec(dllimport) int __stdcall DllMain(void* hinstDll, unsigned long dwReason, void* reserved); - -char* args[] = { "regdump.exe", "0", "ansi", "verbose"}; - -int __cdecl mainCRTStartup(void) -{ - - //DllMain(NULL, DLL_PROCESS_ATTACH, NULL); - - main(1, args); - return 0; -} - -#endif /*__GNUC__*/ diff --git a/reactos/apps/tests/regdump/makefile b/reactos/apps/tests/regdump/makefile deleted file mode 100644 index 3acd56b42d5..00000000000 --- a/reactos/apps/tests/regdump/makefile +++ /dev/null @@ -1,27 +0,0 @@ -# -# $Id: makefile,v 1.0 - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = regdump - -#TARGET_CFLAGS = -DWIN32_REGDBG -DUNICODE -D_UNICODE -TARGET_CFLAGS = -DWIN32_REGDBG - -TARGET_SDKLIBS = ntdll.a kernel32.a advapi32.a - -TARGET_OBJECTS = $(TARGET_NAME).o regcmds.o regproc.o main.o - -TARGET_CFLAGS = -Wall -Werror - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/regdump/regcmds.c b/reactos/apps/tests/regdump/regcmds.c deleted file mode 100644 index 69fdcd85190..00000000000 --- a/reactos/apps/tests/regdump/regcmds.c +++ /dev/null @@ -1,224 +0,0 @@ -/* $Id: regcmds.c,v 1.2 2003/01/01 11:16:18 robd Exp $ - * - * ReactOS regedit - * - * regcmds.c - * - * Copyright (C) 2002 Robert Dickenson - * - * Original Work Copyright 2002 Andriy Palamarchuk - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -#include -#include -#include - -#ifdef WIN32_REGDBG -#else -#include -#endif - -#include "regproc.h" - - -//////////////////////////////////////////////////////////////////////////////// -// Global Variables: -// - -static char *usage = -"Usage:\n" -" regedit filename\n" -" regedit /E filename [regpath]\n" -" regedit /D regpath\n" -"\n" -"filename - registry file name\n" -"regpath - name of the registry key\n" -"\n" -"When is called without any switches adds contents of the specified\n" -"registry file to the registry\n" -"\n" -"Switches:\n" -" /E - exports contents of the specified registry key to the specified\n" -" file. Exports the whole registry if no key is specified.\n" -" /D - deletes specified registry key\n" -" /S - silent execution, can be used with any other switch.\n" -" The only existing mode, exists for compatibility with Windows regedit.\n" -" /V - advanced mode, can be used with any other switch.\n" -" Ignored, exists for compatibility with Windows regedit.\n" -" /L - location of system.dat file. Can be used with any other switch.\n" -" Ignored. Exists for compatibility with Windows regedit.\n" -" /R - location of user.dat file. Can be used with any other switch.\n" -" Ignored. Exists for compatibility with Windows regedit.\n" -" /? - print this help. Any other switches are ignored.\n" -" /C - create registry from. Not implemented.\n" -"\n" -"The switches are case-insensitive, can be prefixed either by '-' or '/'.\n" -"This program is command-line compatible with Microsoft Windows\n" -"regedit. The difference with Windows regedit - this application has\n" -"command-line interface only.\n"; - -typedef enum { - ACTION_UNDEF, ACTION_ADD, ACTION_EXPORT, ACTION_DELETE, ACTION_VIEW -} REGEDIT_ACTION; - -/** - * Process unknown switch. - * - * Params: - * chu - the switch character in upper-case. - * s - the command line string where s points to the switch character. - */ -void error_unknown_switch(char chu, char *s) -{ - if (isalpha(chu)) { - printf("Undefined switch /%c!\n", chu); - } else { - printf("Alphabetic character is expected after '%c' " - "in switch specification\n", *(s - 1)); - } - //exit(1); -} - -BOOL PerformRegAction(REGEDIT_ACTION action, LPSTR s) -{ - TCHAR filename[MAX_PATH]; - TCHAR reg_key_name[KEY_MAX_LEN]; - - switch (action) { - case ACTION_ADD: - get_file_name(&s, filename, MAX_PATH); - if (!filename[0]) { - printf("No file name is specified\n%s", usage); - return FALSE; - //exit(1); - } - while (filename[0]) { - if (!import_registry_file(filename)) { - perror(""); - printf("Can't open file \"%s\"\n", filename); - return FALSE; - //exit(1); - } - get_file_name(&s, filename, MAX_PATH); - } - break; - case ACTION_DELETE: - get_file_name(&s, reg_key_name, KEY_MAX_LEN); - if (!reg_key_name[0]) { - printf("No registry key is specified for removal\n%s", usage); - return FALSE; - //exit(1); - } - delete_registry_key(reg_key_name); - break; - case ACTION_EXPORT: - filename[0] = '\0'; - get_file_name(&s, filename, MAX_PATH); - if (!filename[0]) { - printf("No file name is specified\n%s", usage); - return FALSE; - //exit(1); - } - if (s[0]) { - get_file_name(&s, reg_key_name, KEY_MAX_LEN); - export_registry_key(filename, reg_key_name); - } else { - export_registry_key(filename, NULL); - } - break; - default: - printf("Unhandled action!\n"); - return FALSE; - } - return TRUE; -} - -BOOL ProcessCmdLine(LPSTR lpCmdLine) -{ - REGEDIT_ACTION action = ACTION_UNDEF; - LPSTR s = lpCmdLine; /* command line pointer */ - CHAR ch = *s; /* current character */ - - while (ch && ((ch == '-') || (ch == '/'))) { - char chu; - char ch2; - - s++; - ch = *s; - ch2 = *(s+1); - chu = toupper(ch); - if (!ch2 || isspace(ch2)) { - if (chu == 'S' || chu == 'V') { - /* ignore these switches */ - } else { - switch (chu) { - case 'D': - action = ACTION_DELETE; - break; - case 'E': - action = ACTION_EXPORT; - break; - case 'V': - action = ACTION_VIEW; - break; - case '?': - printf(usage); - return FALSE; - //exit(0); - break; - default: - error_unknown_switch(chu, s); - return FALSE; - break; - } - } - s++; - } else { - if (ch2 == ':') { - switch (chu) { - case 'L': - /* fall through */ - case 'R': - s += 2; - while (*s && !isspace(*s)) { - s++; - } - break; - default: - error_unknown_switch(chu, s); - return FALSE; - break; - } - } else { - /* this is a file name, starting from '/' */ - s--; - break; - } - } - /* skip spaces to the next parameter */ - ch = *s; - while (ch && isspace(ch)) { - s++; - ch = *s; - } - } - if (action == ACTION_UNDEF) { - action = ACTION_ADD; - } - return PerformRegAction(action, s); -} diff --git a/reactos/apps/tests/regdump/regdump.c b/reactos/apps/tests/regdump/regdump.c deleted file mode 100644 index 7caec5f0488..00000000000 --- a/reactos/apps/tests/regdump/regdump.c +++ /dev/null @@ -1,167 +0,0 @@ -/* $Id: regdump.c,v 1.3 2003/01/01 11:16:18 robd Exp $ - * - * ReactOS regedit - * - * regdump.c - * - * Copyright (C) 2002 Robert Dickenson - * - * 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 "regdump.h" - - -#ifdef UNICODE -//#define dprintf _tprintf -#define dprintf printf -#else -#define dprintf printf -#endif - -void RegKeyPrint(int which); - - - -const char* default_cmd_line1 = "/E HKLM_EXPORT.TXT HKEY_LOCAL_MACHINE"; -const char* default_cmd_line2 = "TEST_IMPORT.TXT"; -const char* default_cmd_line3 = "/P HKEY_LOCAL_MACHINE\\SYSTEM"; -const char* default_cmd_line4 = "/P HKEY_LOCAL_MACHINE\\SOFTWARE"; -const char* default_cmd_line5 = "/P HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes"; -const char* default_cmd_line6 = "/E HKCR_EXPORT.TXT HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes"; -const char* default_cmd_line7 = "/D HKEY_LOCAL_MACHINE\\SYSTEM"; -const char* default_cmd_line8 = "/D HKEY_LOCAL_MACHINE\\SOFTWARE"; -const char* default_cmd_line9 = "/D HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes"; - -/* Show usage */ -void usage(const char* appName) -{ - fprintf(stderr, "%s: Dump registry key to console\n", appName); - fprintf(stderr, "%s HKCR | HKCU | HKLM | HKU | HKCC | HKRR\n", appName); -} - -void show_menu(void) -{ - _tprintf(_T("\nchoose test :\n")); - _tprintf(_T(" 0 = Exit\n")); - printf(" 1 = %s\n", default_cmd_line1); - printf(" 2 = %s\n", default_cmd_line2); - printf(" 3 = %s\n", default_cmd_line3); - printf(" 4 = %s\n", default_cmd_line4); - printf(" 5 = %s\n", default_cmd_line5); - printf(" 6 = %s\n", default_cmd_line6); - printf(" 7 = %s\n", default_cmd_line7); - printf(" 8 = %s\n", default_cmd_line8); - printf(" 9 = %s\n", default_cmd_line9); -/* - _tprintf(_T(" 1 = %s\n"), default_cmd_line1); - _tprintf(_T(" 2 = %s\n"), default_cmd_line2); - _tprintf(_T(" 3 = %s\n"), default_cmd_line3); - _tprintf(_T(" 4 = %s\n"), default_cmd_line4); - _tprintf(_T(" 5 = %s\n"), default_cmd_line5); - _tprintf(_T(" 6 = %s\n"), default_cmd_line6); - _tprintf(_T(" 7 = %s\n"), default_cmd_line7); - _tprintf(_T(" 8 = %s\n"), default_cmd_line8); - _tprintf(_T(" 9 = %s\n"), default_cmd_line9); - */ -// _tprintf(_T(" A = HKEY_CLASSES_ROOT\n")); -// _tprintf(_T(" B = HKEY_CURRENT_USER\n")); -// _tprintf(_T(" C = HKEY_LOCAL_MACHINE\n")); -// _tprintf(_T(" D = HKEY_USERS\n")); -// _tprintf(_T(" E = HKEY_CURRENT_CONFIG\n")); -// _tprintf(_T(" F = REGISTRY ROOT\n")); -} - -int regdump(int argc, char* argv[]) -{ - char Buffer[500]; - - if (argc > 1) { -// if (0 == _tcsstr(argv[1], _T("HKLM"))) { - if (strstr(argv[1], "help")) { - usage(argv[0]); - } else if (strstr(argv[1], "HKCR")) { - RegKeyPrint('1'); - } else if (strstr(argv[1], "HKCU")) { - RegKeyPrint('2'); - } else if (strstr(argv[1], "HKLM")) { - RegKeyPrint('3'); - } else if (strstr(argv[1], "HKU")) { - RegKeyPrint('4'); - } else if (strstr(argv[1], "HKCC")) { - RegKeyPrint('5'); - } else if (strstr(argv[1], "HKRR")) { - RegKeyPrint('6'); - } else { - dprintf("started with argc = %d, argv[1] = %s (unknown?)\n", argc, argv[1]); - } - return 0; - } - show_menu(); - while (1) { - GetInput(Buffer, sizeof(Buffer)); - switch (toupper(Buffer[0])) { - case '0': - return(0); - case '1': - strcpy(Buffer, default_cmd_line1); - goto doit; - case '2': - strcpy(Buffer, default_cmd_line2); - goto doit; - case '3': - strcpy(Buffer, default_cmd_line3); - goto doit; - case '4': - strcpy(Buffer, default_cmd_line4); - goto doit; - case '5': - strcpy(Buffer, default_cmd_line5); - goto doit; - case '6': - strcpy(Buffer, default_cmd_line6); - goto doit; - case '7': - strcpy(Buffer, default_cmd_line7); - goto doit; - case '8': - strcpy(Buffer, default_cmd_line8); - goto doit; - case '9': - strcpy(Buffer, default_cmd_line9); - goto doit; - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - RegKeyPrint(toupper(Buffer[0]) - 'A' + 1); - break; - default: doit: - if (!ProcessCmdLine(Buffer)) { - dprintf("invalid input.\n"); - show_menu(); - } else { - dprintf("done.\n"); - } - break; - } - } - return 0; -} diff --git a/reactos/apps/tests/regdump/regdump.h b/reactos/apps/tests/regdump/regdump.h deleted file mode 100644 index be2c895817c..00000000000 --- a/reactos/apps/tests/regdump/regdump.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * ReactOS - * - * regdump.h - * - * Copyright (C) 2002 Robert Dickenson - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __REGDUMP_H__ -#define __REGDUMP_H__ - -#ifdef __cplusplus -extern "C" { -#endif - - -extern HANDLE OutputHandle; -extern HANDLE InputHandle; - -DWORD GetInput(char* Buffer, int buflen); -//void dprintf(char* fmt, ...); -int regdump(int argc, char* argv[]); -BOOL ProcessCmdLine(LPSTR lpCmdLine); - - -#ifdef __cplusplus -}; -#endif - -#endif // __REGDUMP_H__ diff --git a/reactos/apps/tests/regdump/regproc.c b/reactos/apps/tests/regdump/regproc.c deleted file mode 100644 index 6fb0a2deebd..00000000000 --- a/reactos/apps/tests/regdump/regproc.c +++ /dev/null @@ -1,1491 +0,0 @@ -/* - * Registry processing routines. Routines, common for registry - * processing frontends. - * - * Copyright 1999 Sylvain St-Germain - * Copyright 2002 Andriy Palamarchuk - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifdef WIN32_REGDBG -#include -#include -#ifndef __GNUC__ -#include -#else -#include -#endif -#include -#include -#include -#include -//#include -#include "regdump.h" -#else - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#endif - -#include "regproc.h" - - -#define REG_VAL_BUF_SIZE 4096 - -/* Delimiters used to parse the "value" to query queryValue*/ -#define QUERY_VALUE_MAX_ARGS 1 - -/* maximal number of characters in hexadecimal data line, - not including '\' character */ -#define REG_FILE_HEX_LINE_LEN 76 - -/* Globals used by the api setValue, queryValue */ -static LPTSTR currentKeyName = NULL; -static HKEY currentKeyClass = 0; -static HKEY currentKeyHandle = 0; -static BOOL bTheKeyIsOpen = FALSE; - -static TCHAR *reg_class_names[] = { - _T("HKEY_LOCAL_MACHINE"), - _T("HKEY_USERS"), - _T("HKEY_CLASSES_ROOT"), - _T("HKEY_CURRENT_CONFIG"), - _T("HKEY_CURRENT_USER") -}; - -#define REG_CLASS_NUMBER (sizeof(reg_class_names) / sizeof(reg_class_names[0])) - -static HKEY reg_class_keys[REG_CLASS_NUMBER] = { - HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_CLASSES_ROOT, - HKEY_CURRENT_CONFIG, HKEY_CURRENT_USER -}; - -/* return values */ -#define NOT_ENOUGH_MEMORY 1 -#define IO_ERROR 2 - -/* processing macros */ - -/* common check of memory allocation results */ -#ifdef UNICODE -#define CHECK_ENOUGH_MEMORY(p) \ - if (!(p)) \ - { \ - _tprintf(_T("file %S, line %d: Not enough memory"), __FILE__, __LINE__); \ - assert(0);\ - exit(NOT_ENOUGH_MEMORY); \ - } -#else -#define CHECK_ENOUGH_MEMORY(p) \ - if (!(p)) \ - { \ - _tprintf(_T("file %s, line %d: Not enough memory"), __FILE__, __LINE__); \ - assert(0);\ - exit(NOT_ENOUGH_MEMORY); \ - } -#endif - -#ifdef UNICODE -#define _TEOF WEOF -#else -#define _TEOF EOF -#endif - -/****************************************************************************** - * This is a replacement for strsep which is not portable (missing on Solaris). - */ -#if 0 -/* DISABLED */ -char* getToken(char** str, const char* delims) -{ - char* token; - - if (*str==NULL) { - /* No more tokens */ - return NULL; - } - - token=*str; - while (**str!='\0') { - if (strchr(delims,**str)!=NULL) { - **str='\0'; - (*str)++; - return token; - } - (*str)++; - } - /* There is no other token */ - *str=NULL; - return token; -} -#endif - -/****************************************************************************** - * Copies file name from command line string to the buffer. - * Rewinds the command line string pointer to the next non-spece character - * after the file name. - * Buffer contains an empty string if no filename was found; - * - * params: - * command_line - command line current position pointer - * where *s[0] is the first symbol of the file name. - * file_name - buffer to write the file name to. - */ -void get_file_nameA(CHAR **command_line, CHAR *file_name, int max_filename) -{ - CHAR *s = *command_line; - int pos = 0; /* position of pointer "s" in *command_line */ - file_name[0] = 0; - - if (!s[0]) { - return; - } - if (s[0] == '"') { - s++; - (*command_line)++; - while (s[0] != '"') { - if (!s[0]) { - _tprintf(_T("Unexpected end of file name!\n")); - assert(0); - //exit(1); - } - s++; - pos++; - } - } else { - while (s[0] && !isspace(s[0])) { - s++; - pos++; - } - } - memcpy(file_name, *command_line, pos * sizeof((*command_line)[0])); - /* remove the last backslash */ - if (file_name[pos - 1] == '\\') { - file_name[pos - 1] = '\0'; - } else { - file_name[pos] = '\0'; - } - if (s[0]) { - s++; - pos++; - } - while (s[0] && isspace(s[0])) { - s++; - pos++; - } - (*command_line) += pos; -} - -void get_file_nameW(CHAR** command_line, WCHAR* filename, int max_filename) -{ - CHAR filenameA[_MAX_PATH]; - int len; - - get_file_nameA(command_line, filenameA, _MAX_PATH); - len = strlen(filenameA); - OemToCharBuffW(filenameA, filename, max_filename); - filename[len] = _T('\0'); -/* - UNICODE_STRING UnicodeString; - ANSI_STRING AnsiString; - CHAR filenameA[_MAX_PATH]; - - get_file_nameA(command_line, filenameA, _MAX_PATH); - - //RtlInitAnsiString(&AnsiString, filenameA); - UnicodeString.Buffer = filename; - UnicodeString.MaximumLength = max_filename;//MAX_PATH; - RtlAnsiStringToUnicodeString(&UnicodeString, &AnsiString, FALSE); - */ -} - -/****************************************************************************** - * Converts a hex representation of a DWORD into a DWORD. - */ -DWORD convertHexToDWord(TCHAR* str, BYTE* buf) -{ - DWORD dw; - TCHAR xbuf[9]; - - memcpy(xbuf, str, 8 * sizeof(TCHAR)); - xbuf[88 * sizeof(TCHAR)] = '\0'; - _stscanf(xbuf, _T("%08lx"), &dw); - memcpy(buf, &dw, sizeof(DWORD)); - return sizeof(DWORD); -} - -/****************************************************************************** - * Converts a hex buffer into a hex comma separated values - */ -TCHAR* convertHexToHexCSV(BYTE* buf, ULONG bufLen) -{ - TCHAR* str; - TCHAR* ptrStr; - BYTE* ptrBuf; - - ULONG current = 0; - str = HeapAlloc(GetProcessHeap(), 0, (bufLen+1)*2*sizeof(TCHAR)); - memset(str, 0, (bufLen+1)*2); - ptrStr = str; /* Pointer to result */ - ptrBuf = buf; /* Pointer to current */ - while (current < bufLen) { - BYTE bCur = ptrBuf[current++]; - TCHAR res[3]; - _stprintf(res, _T("%02x"), (unsigned int)*&bCur); - _tcscat(str, res); - _tcscat(str, _T(",")); - } - /* Get rid of the last comma */ - str[_tcslen(str)-1] = _T('\0'); - return str; -} - -/****************************************************************************** - * Converts a hex buffer into a DWORD string - */ -TCHAR* convertHexToDWORDStr(BYTE* buf, ULONG bufLen) -{ - TCHAR* str; - DWORD dw; - - if (bufLen != sizeof(DWORD)) return NULL; - str = HeapAlloc(GetProcessHeap(), 0, ((bufLen*2)+1)*sizeof(TCHAR)); - memcpy(&dw, buf, sizeof(DWORD)); - _stprintf(str, _T("%08lx"), dw); - /* Get rid of the last comma */ - return str; -} - -/****************************************************************************** - * Converts a hex comma separated values list into a hex list. - * The Hex input string must be in exactly the correct form. - */ -DWORD convertHexCSVToHex(TCHAR* str, BYTE* buf, ULONG bufLen) -{ - TCHAR* s = str; /* Pointer to current */ - CHAR* b = buf; /* Pointer to result */ - ULONG strLen = _tcslen(str); - ULONG strPos = 0; - DWORD byteCount = 0; - - memset(buf, 0, bufLen); - /* - * warn the user if we are here with a string longer than 2 bytes that does - * not contains ",". It is more likely because the data is invalid. - */ - if ((strLen > 2) && (_tcschr(str, _T(',')) == NULL)) { - _tprintf(_T("WARNING converting CSV hex stream with no comma, ") \ - _T("input data seems invalid.\n")); - } - if (strLen > 3*bufLen) { - _tprintf(_T("ERROR converting CSV hex stream. Too long\n")); - } - while (strPos < strLen) { - TCHAR xbuf[3]; - TCHAR wc; - memcpy(xbuf, s, 2); - xbuf[3] = _T('\0'); - _stscanf(xbuf, _T("%02x"), (UINT*)&wc); - if (byteCount < bufLen) - *b++ = (unsigned char)wc; - s += 3; - strPos += 3; - ++byteCount; - } - return byteCount; -} - -/****************************************************************************** - * This function returns the HKEY associated with the data type encoded in the - * value. It modifies the input parameter (key value) in order to skip this - * "now useless" data type information. - * - * Note: Updated based on the algorithm used in 'server/registry.c' - */ -DWORD getDataType(LPTSTR* lpValue, DWORD* parse_type) -{ - struct data_type { const TCHAR *tag; int len; int type; int parse_type; }; - - static const struct data_type data_types[] = - { /* actual type */ /* type to assume for parsing */ - { _T("\""), 1, REG_SZ, REG_SZ }, - { _T("str:\""), 5, REG_SZ, REG_SZ }, -// { _T("str(2):\""), 8, REG_EXPAND_SZ, REG_SZ }, - { _T("expand:\""), 8, REG_EXPAND_SZ, REG_EXPAND_SZ }, - { _T("hex:"), 4, REG_BINARY, REG_BINARY }, - { _T("dword:"), 6, REG_DWORD, REG_DWORD }, - { _T("hex("), 4, -1, REG_BINARY }, - { NULL, 0, 0, 0 } - }; - - const struct data_type *ptr; - int type; - - for (ptr = data_types; ptr->tag; ptr++) { - if (memcmp(ptr->tag, *lpValue, ptr->len)) - continue; - - /* Found! */ - *parse_type = ptr->parse_type; - type = ptr->type; - *lpValue += ptr->len; - if (type == -1) { - TCHAR* end; - /* "hex(xx):" is special */ - type = (int)_tcstoul(*lpValue , &end, 16); - if (**lpValue == _T('\0') || *end != _T(')') || *(end+1) != _T(':')) { - type = REG_NONE; - } else { - *lpValue = end + 2; - } - } - return type; - } - return (**lpValue == _T('\0') ? REG_SZ : REG_NONE); -} - -/****************************************************************************** - * Returns an allocated buffer with a cleaned copy (removed the surrounding - * dbl quotes) of the passed value. - */ -LPTSTR getArg(LPTSTR arg) -{ - LPTSTR tmp = NULL; - ULONG len; - - if (arg == NULL) return NULL; - - // Get rid of surrounding quotes - len = _tcslen(arg); - if (arg[len-1] == _T('\"')) arg[len-1] = _T('\0'); - if (arg[0] == _T('\"')) arg++; - tmp = HeapAlloc(GetProcessHeap(), 0, (_tcslen(arg)+1) * sizeof(TCHAR)); - _tcscpy(tmp, arg); - return tmp; -} - -/****************************************************************************** - * Replaces escape sequences with the characters. - */ -void REGPROC_unescape_string(LPTSTR str) -{ - int str_idx = 0; /* current character under analysis */ - int val_idx = 0; /* the last character of the unescaped string */ - int len = _tcslen(str); - for (str_idx = 0; str_idx < len; str_idx++, val_idx++) { - if (str[str_idx] == _T('\\')) { - str_idx++; - switch (str[str_idx]) { - case _T('n'): - str[val_idx] = _T('\n'); - break; - case _T('\\'): - case _T('"'): - str[val_idx] = str[str_idx]; - break; - default: - _tprintf(_T("Warning! Unrecognized escape sequence: \\%c'\n"), str[str_idx]); - str[val_idx] = str[str_idx]; - break; - } - } else { - str[val_idx] = str[str_idx]; - } - } - str[val_idx] = _T('\0'); -} - -/****************************************************************************** - * Sets the value with name val_name to the data in val_data for the currently - * opened key. - * - * Parameters: - * val_name - name of the registry value - * val_data - registry value data - */ -HRESULT setValue(LPTSTR val_name, LPTSTR val_data) -{ - HRESULT hRes; - DWORD dwDataType, dwParseType; - LPBYTE lpbData; - BYTE convert[KEY_MAX_LEN]; - BYTE *bBigBuffer = 0; - DWORD dwLen; - - if ((val_name == NULL) || (val_data == NULL)) - return ERROR_INVALID_PARAMETER; - - /* Get the data type stored into the value field */ - dwDataType = getDataType(&val_data, &dwParseType); - -// if (dwParseType == REG_EXPAND_SZ) { -// } -// if (dwParseType == REG_SZ || dwParseType == REG_EXPAND_SZ) { /* no conversion for string */ - - if (dwParseType == REG_SZ) { /* no conversion for string */ - dwLen = _tcslen(val_data); - if (dwLen > 0 && val_data[dwLen-1] == _T('"')) { - dwLen--; - val_data[dwLen] = _T('\0'); - } - dwLen++; - dwLen *= sizeof(TCHAR); - REGPROC_unescape_string(val_data); - lpbData = val_data; - } else if (dwParseType == REG_DWORD) { /* Convert the dword types */ - dwLen = convertHexToDWord(val_data, convert); - lpbData = convert; - } else { /* Convert the hexadecimal types */ - int b_len = _tcslen(val_data)+2/3; - if (b_len > KEY_MAX_LEN) { - bBigBuffer = HeapAlloc (GetProcessHeap(), 0, b_len * sizeof(TCHAR)); - if (bBigBuffer == NULL) { - return ERROR_REGISTRY_IO_FAILED; - } - CHECK_ENOUGH_MEMORY(bBigBuffer); - dwLen = convertHexCSVToHex(val_data, bBigBuffer, b_len); - lpbData = bBigBuffer; - } else { - dwLen = convertHexCSVToHex(val_data, convert, KEY_MAX_LEN); - lpbData = convert; - } - } - hRes = RegSetValueEx(currentKeyHandle, val_name, - 0, /* Reserved */dwDataType, lpbData, dwLen); - - _tprintf(_T(" Value: %s, Data: %s\n"), val_name, lpbData); - - - if (bBigBuffer) - HeapFree(GetProcessHeap(), 0, bBigBuffer); - return hRes; -} - - -/****************************************************************************** - * Open the key - */ -HRESULT openKey(LPTSTR stdInput) -{ - DWORD dwDisp; - HRESULT hRes; - - /* Sanity checks */ - if (stdInput == NULL) - return ERROR_INVALID_PARAMETER; - - /* Get the registry class */ - currentKeyClass = getRegClass(stdInput); /* Sets global variable */ - if (currentKeyClass == (HKEY)ERROR_INVALID_PARAMETER) - return (HRESULT)ERROR_INVALID_PARAMETER; - - /* Get the key name */ - currentKeyName = getRegKeyName(stdInput); /* Sets global variable */ - if (currentKeyName == NULL) - return ERROR_INVALID_PARAMETER; - - hRes = RegCreateKeyEx( - currentKeyClass, /* Class */ - currentKeyName, /* Sub Key */ - 0, /* MUST BE 0 */ - NULL, /* object type */ - REG_OPTION_NON_VOLATILE, /* option, REG_OPTION_NON_VOLATILE ... */ - KEY_ALL_ACCESS, /* access mask, KEY_ALL_ACCESS */ - NULL, /* security attribute */ - ¤tKeyHandle, /* result */ - &dwDisp); /* disposition, REG_CREATED_NEW_KEY or - REG_OPENED_EXISTING_KEY */ - - if (hRes == ERROR_SUCCESS) - bTheKeyIsOpen = TRUE; - - return hRes; - -} - -/****************************************************************************** - * Extracts from [HKEY\some\key\path] or HKEY\some\key\path types of line - * the key name (what starts after the first '\') - */ -LPTSTR getRegKeyName(LPTSTR lpLine) -{ - LPTSTR keyNameBeg; - TCHAR lpLineCopy[KEY_MAX_LEN]; - - if (lpLine == NULL) - return NULL; - - _tcscpy(lpLineCopy, lpLine); - keyNameBeg = _tcschr(lpLineCopy, _T('\\')); /* The key name start by '\' */ - if (keyNameBeg) { - LPTSTR keyNameEnd; - - keyNameBeg++; /* is not part of the name */ - keyNameEnd = _tcschr(lpLineCopy, _T(']')); - if (keyNameEnd) { - *keyNameEnd = _T('\0'); /* remove ']' from the key name */ - } - } else { - keyNameBeg = lpLineCopy + _tcslen(lpLineCopy); /* branch - empty string */ - } - currentKeyName = HeapAlloc(GetProcessHeap(), 0, (_tcslen(keyNameBeg)+1)*sizeof(TCHAR)); - CHECK_ENOUGH_MEMORY(currentKeyName); - _tcscpy(currentKeyName, keyNameBeg); - return currentKeyName; -} - -/****************************************************************************** - * Extracts from [HKEY\some\key\path] or HKEY\some\key\path types of line - * the key class (what ends before the first '\') - */ -HKEY getRegClass(LPTSTR lpClass) -{ - LPTSTR classNameEnd; - LPTSTR classNameBeg; - int i; - - TCHAR lpClassCopy[KEY_MAX_LEN]; - - if (lpClass == NULL) - return (HKEY)ERROR_INVALID_PARAMETER; - - _tcsncpy(lpClassCopy, lpClass, KEY_MAX_LEN); - - classNameEnd = _tcschr(lpClassCopy, _T('\\')); /* The class name ends by '\' */ - if (!classNameEnd) { /* or the whole string */ - classNameEnd = lpClassCopy + _tcslen(lpClassCopy); - if (classNameEnd[-1] == _T(']')) { - classNameEnd--; - } - } - *classNameEnd = _T('\0'); /* Isolate the class name */ - if (lpClassCopy[0] == _T('[')) { - classNameBeg = lpClassCopy + 1; - } else { - classNameBeg = lpClassCopy; - } - for (i = 0; i < REG_CLASS_NUMBER; i++) { - if (!_tcscmp(classNameBeg, reg_class_names[i])) { - return reg_class_keys[i]; - } - } - return (HKEY)ERROR_INVALID_PARAMETER; -} - -/****************************************************************************** - * Close the currently opened key. - */ -void closeKey(VOID) -{ - RegCloseKey(currentKeyHandle); - HeapFree(GetProcessHeap(), 0, currentKeyName); /* Allocated by getKeyName */ - bTheKeyIsOpen = FALSE; - currentKeyName = NULL; - currentKeyClass = 0; - currentKeyHandle = 0; -} - -/****************************************************************************** - * This function is the main entry point to the setValue type of action. It - * receives the currently read line and dispatch the work depending on the - * context. - */ -void doSetValue(LPTSTR stdInput) -{ - /* - * We encountered the end of the file, make sure we - * close the opened key and exit - */ - if (stdInput == NULL) { - if (bTheKeyIsOpen != FALSE) - closeKey(); - return; - } - - if (stdInput[0] == _T('[')) { /* We are reading a new key */ - if (bTheKeyIsOpen != FALSE) { - closeKey(); /* Close the previous key before */ - } - if (openKey(stdInput) != ERROR_SUCCESS) { - _tprintf(_T("doSetValue failed to open key %s\n"), stdInput); - } - } else if ((bTheKeyIsOpen) && - ((stdInput[0] == _T('@')) || /* reading a default @=data pair */ - (stdInput[0] == _T('\"')))) { /* reading a new value=data pair */ - processSetValue(stdInput); - } else { /* since we are assuming that the file format is */ - if (bTheKeyIsOpen) /* valid we must be reading a blank line which */ - closeKey(); /* indicate end of this key processing */ - } -} - -/****************************************************************************** - * This funtion is the main entry point to the queryValue type of action. It - * receives the currently read line and dispatch the work depending on the - * context. - */ -void doQueryValue(LPTSTR stdInput) { - /* - * We encoutered the end of the file, make sure we - * close the opened key and exit - */ - if (stdInput == NULL) { - if (bTheKeyIsOpen != FALSE) - closeKey(); - return; - } - - if (stdInput[0] == _T('[')) { /* We are reading a new key */ - if (bTheKeyIsOpen != FALSE) - closeKey(); /* Close the previous key before */ - if (openKey(stdInput) != ERROR_SUCCESS ) { - _tprintf(_T("doQueryValue failed to open key %s\n"), stdInput); - } - } - else if( (bTheKeyIsOpen) && - ((stdInput[0] == _T('@')) || /* reading a default @=data pair */ - (stdInput[0] == _T('\"')))) { /* reading a new value=data pair */ - processQueryValue(stdInput); - } else { /* since we are assuming that the file format is */ - if (bTheKeyIsOpen) /* valid we must be reading a blank line which */ - closeKey(); /* indicate end of this key processing */ - } -} - -/****************************************************************************** - * This funtion is the main entry point to the deletetValue type of action. It - * receives the currently read line and dispatch the work depending on the - * context. - */ -void doDeleteValue(LPTSTR line) { - _tprintf(_T("deleteValue not yet implemented\n")); -} - -/****************************************************************************** - * This funtion is the main entry point to the deleteKey type of action. It - * receives the currently read line and dispatch the work depending on the - * context. - */ -void doDeleteKey(LPTSTR line) { - _tprintf(_T("deleteKey not yet implemented\n")); -} - -/****************************************************************************** - * This funtion is the main entry point to the createKey type of action. It - * receives the currently read line and dispatch the work depending on the - * context. - */ -void doCreateKey(LPTSTR line) { - _tprintf(_T("createKey not yet implemented\n")); -} - -/****************************************************************************** - * This function is a wrapper for the setValue function. It prepares the - * land and clean the area once completed. - * Note: this function modifies the line parameter. - * - * line - registry file unwrapped line. Should have the registry value name and - * complete registry value data. - */ -void processSetValue(LPTSTR line) -{ - LPTSTR val_name; /* registry value name */ - LPTSTR val_data; /* registry value data */ - - int line_idx = 0; /* current character under analysis */ - HRESULT hRes = 0; - - /* get value name */ - if (line[line_idx] == _T('@') && line[line_idx + 1] == _T('=')) { - line[line_idx] = _T('\0'); - val_name = line; - line_idx++; - } else if (line[line_idx] == _T('\"')) { - line_idx++; - val_name = line + line_idx; - while (TRUE) { - if (line[line_idx] == _T('\\')) { /* skip escaped character */ - line_idx += 2; - } else { - if (line[line_idx] == _T('\"')) { - line[line_idx] = _T('\0'); - line_idx++; - break; - } else { - line_idx++; - } - } - } - if (line[line_idx] != _T('=')) { - line[line_idx] = _T('\"'); - _tprintf(_T("Warning! uncrecognized line:\n%s\n"), line); - return; - } - } else { - _tprintf(_T("Warning! unrecognized line:\n%s\n"), line); - return; - } - line_idx++; /* skip the '=' character */ - val_data = line + line_idx; - REGPROC_unescape_string(val_name); - - _tprintf(_T("Key: %s, Value: %s, Data: %s\n"), currentKeyName, val_name, val_data); - - hRes = setValue(val_name, val_data); - if (hRes != ERROR_SUCCESS) { - _tprintf(_T("ERROR Key %s not created. Value: %s, Data: %s\n"), currentKeyName, val_name, val_data); - } -} - -/****************************************************************************** - * This function is a wrapper for the queryValue function. It prepares the - * land and clean the area once completed. - */ -void processQueryValue(LPTSTR cmdline) -{ - _tprintf(_T("ERROR!!! - temporary disabled")); - //exit(1); - return; -#if 0 - LPSTR argv[QUERY_VALUE_MAX_ARGS];/* args storage */ - LPSTR token = NULL; /* current token analized */ - ULONG argCounter = 0; /* counter of args */ - INT counter; - HRESULT hRes = 0; - LPSTR keyValue = NULL; - LPSTR lpsRes = NULL; - - /* - * Init storage and parse the line - */ - for (counter = 0; counter < QUERY_VALUE_MAX_ARGS; counter++) - argv[counter] = NULL; - - while ((token = getToken(&cmdline, queryValueDelim[argCounter])) != NULL) { - argv[argCounter++] = getArg(token); - if (argCounter == QUERY_VALUE_MAX_ARGS) - break; /* Stop processing args no matter what */ - } - - /* The value we look for is the first token on the line */ - if (argv[0] == NULL) - return; /* SHOULD NOT HAPPEN */ - else - keyValue = argv[0]; - - if ((keyValue[0] == '@') && (_tcslen(keyValue) == 1)) { - LONG lLen = KEY_MAX_LEN; - TCHAR* lpsData = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,KEY_MAX_LEN); - /* - * We need to query the key default value - */ - hRes = RegQueryValue(currentKeyHandle, currentKeyName, (LPBYTE)lpsData, &lLen); - if (hRes == ERROR_MORE_DATA) { - lpsData = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lpsData, lLen); - hRes = RegQueryValue(currentKeyHandle, currentKeyName, (LPBYTE)lpsData, &lLen); - } - if (hRes == ERROR_SUCCESS) { - lpsRes = HeapAlloc(GetProcessHeap(), 0, lLen); - strncpy(lpsRes, lpsData, lLen); - lpsRes[lLen-1]='\0'; - } - } else { - DWORD dwLen = KEY_MAX_LEN; - BYTE* lpbData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, KEY_MAX_LEN); - DWORD dwType; - /* - * We need to query a specific value for the key - */ - hRes = RegQueryValueEx( - currentKeyHandle, - keyValue, - 0, - &dwType, - (LPBYTE)lpbData, - &dwLen); - - if (hRes == ERROR_MORE_DATA) { - lpbData = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lpbData, dwLen * sizeof(TCHAR)); - hRes = RegQueryValueEx(currentKeyHandle, keyValue, NULL, &dwType, (LPBYTE)lpbData, &dwLen); - } - - if (hRes == ERROR_SUCCESS) { - /* - * Convert the returned data to a displayable format - */ - switch (dwType) { - case REG_SZ: - case REG_EXPAND_SZ: - lpsRes = HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(TCHAR)); - strncpy(lpsRes, lpbData, dwLen); - lpsRes[dwLen-1] = '\0'; - break; - case REG_DWORD: - lpsRes = convertHexToDWORDStr(lpbData, dwLen); - break; - default: - lpsRes = convertHexToHexCSV(lpbData, dwLen); - break; - } - } - - HeapFree(GetProcessHeap(), 0, lpbData); - } - if (hRes == ERROR_SUCCESS) { - _tprintf(_T("Value \"%s\" = \"%s\" in key [%s]\n"), keyValue, lpsRes, currentKeyName); - - } else { - _tprintf(_T("ERROR Value \"%s\" not found. for key \"%s\"\n"), keyValue, currentKeyName); - } - - /* - * Do some cleanup - */ - for (counter=0; counter= line && s <= line + lineSize); - size_remaining = lineSize - (s-line); - if (size_remaining < 2) { /* room for 1 character and the \0 */ - TCHAR *new_buffer; - size_t new_size = lineSize + REG_VAL_BUF_SIZE; - if (new_size > lineSize) /* no arithmetic overflow */ - new_buffer = HeapReAlloc (GetProcessHeap(), 0, line, new_size * sizeof(TCHAR)); - else - new_buffer = NULL; - CHECK_ENOUGH_MEMORY(new_buffer); - line = new_buffer; - s = line + lineSize - size_remaining; - lineSize = new_size; - size_remaining = lineSize - (s-line); - } - - /* Get as much as possible into the buffer, terminated either by - * eof, error, eol or getting the maximum amount. Abort on error. - */ -// -// This line is surely foobar, don't want to read INT_MAX in buffer at s, it's never going to be that big... -// size_to_get = (size_remaining > INT_MAX ? INT_MAX : size_remaining); -// -// Looks as if 'lineSize' contains the number of characters of buffer size -// - size_to_get = (size_remaining > lineSize ? lineSize : size_remaining); - - if (NULL == _fgetts(s, size_to_get, in)) { - if (ferror(in)) { - //_tperror(_T("While reading input")); - perror ("While reading input"); - //exit(IO_ERROR); - return; - } else { - assert (feof(in)); - *s = _T('\0'); - /* It is not clear to me from the definition that the - * contents of the buffer are well defined on detecting - * an eof without managing to read anything. - */ - } - } - - /* If we didn't read the eol nor the eof go around for the rest */ - s_eol = _tcschr (s, _T('\n')); - if (!feof (in) && !s_eol) { - s = _tcschr (s, _T('\0')); - /* It should be s + size_to_get - 1 but this is safer */ - continue; - } - - /* If it is a comment line then discard it and go around again */ - if (line [0] == _T('#')) { - s = line; - continue; - } - - /* Remove any line feed. Leave s_eol on the \0 */ - if (s_eol) { - *s_eol = _T('\0'); - if (s_eol > line && *(s_eol-1) == _T('\r')) - *--s_eol = _T('\0'); - } else { - s_eol = _tcschr (s, _T('\0')); - } - /* If there is a concatenating \\ then go around again */ - if (s_eol > line && *(s_eol-1) == _T('\\')) { - int c; - s = s_eol-1; - /* The following error protection could be made more self- - * correcting but I thought it not worth trying. - */ - - if ((c = _fgettc(in)) == _TEOF || c != _T(' ') || - (c = _fgettc(in)) == _TEOF || c != _T(' ')) - _tprintf(_T("ERROR - invalid continuation.\n")); - continue; - } - break; /* That is the full virtual line */ - } - command(line); - } - command(NULL); - HeapFree(GetProcessHeap(), 0, line); -} - -/****************************************************************************** - * This funtion is the main entry point to the registerDLL action. It - * receives the currently read line, then loads and registers the requested DLLs - */ -void doRegisterDLL(LPTSTR stdInput) -{ - HMODULE theLib = 0; - UINT retVal = 0; - - /* Check for valid input */ - if (stdInput == NULL) return; - - /* Load and register the library, then free it */ - theLib = LoadLibrary(stdInput); - if (theLib) { - FARPROC lpfnDLLRegProc = GetProcAddress(theLib, "DllRegisterServer"); - if (lpfnDLLRegProc) { - retVal = (*lpfnDLLRegProc)(); - } else { - _tprintf(_T("Couldn't find DllRegisterServer proc in '%s'.\n"), stdInput); - } - if (retVal != S_OK) { - _tprintf(_T("Couldn't find DllRegisterServer proc in '%s'.\n"), stdInput); - } - FreeLibrary(theLib); - } else { - _tprintf(_T("Could not load DLL '%s'.\n"), stdInput); - } -} - -/****************************************************************************** - * This funtion is the main entry point to the unregisterDLL action. It - * receives the currently read line, then loads and unregisters the requested DLLs - */ -void doUnregisterDLL(LPTSTR stdInput) -{ - HMODULE theLib = 0; - UINT retVal = 0; - - /* Check for valid input */ - if (stdInput == NULL) return; - - /* Load and unregister the library, then free it */ - theLib = LoadLibrary(stdInput); - if (theLib) { - FARPROC lpfnDLLRegProc = GetProcAddress(theLib, "DllUnregisterServer"); - if (lpfnDLLRegProc) { - retVal = (*lpfnDLLRegProc)(); - } else { - _tprintf(_T("Couldn't find DllUnregisterServer proc in '%s'.\n"), stdInput); - } - if (retVal != S_OK) { - _tprintf(_T("DLLUnregisterServer error 0x%x in '%s'.\n"), retVal, stdInput); - } - FreeLibrary(theLib); - } else { - _tprintf(_T("Could not load DLL '%s'.\n"), stdInput); - } -} - -/**************************************************************************** - * REGPROC_print_error - * - * Print the message for GetLastError - */ - -void REGPROC_print_error(VOID) -{ - LPVOID lpMsgBuf; - DWORD error_code; - int status; - - error_code = GetLastError (); - status = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, error_code, 0, (LPTSTR) &lpMsgBuf, 0, NULL); - if (!status) { - _tprintf(_T("Cannot display message for error %ld, status %ld\n"), error_code, GetLastError()); - } else { - _tprintf(_T("REGPROC_print_error() - ")); - puts(lpMsgBuf); - LocalFree((HLOCAL)lpMsgBuf); - } - //exit(1); -} - -/****************************************************************************** - * Checks whether the buffer has enough room for the string or required size. - * Resizes the buffer if necessary. - * - * Parameters: - * buffer - pointer to a buffer for string - * len - current length of the buffer in characters. - * required_len - length of the string to place to the buffer in characters. - * The length does not include the terminating null character. - */ -void REGPROC_resize_char_buffer(TCHAR **buffer, DWORD *len, DWORD required_len) -{ - required_len++; - if (required_len > *len) { - *len = required_len; - *buffer = HeapReAlloc(GetProcessHeap(), 0, *buffer, *len * sizeof(**buffer)); - CHECK_ENOUGH_MEMORY(*buffer); - } -} - -/****************************************************************************** - * Prints string str to file - */ -void REGPROC_export_string(FILE *file, TCHAR *str) -{ - size_t len = _tcslen(str); - size_t i; - - /* escaping characters */ - for (i = 0; i < len; i++) { - TCHAR c = str[i]; - switch (c) { - //case _T('\\'): _fputts(_T("\\\\"), file); break; - case _T('\"'): _fputts(_T("\\\""), file); break; - case _T('\n'): _fputts(_T("\\\n"), file); break; - default: _fputtc(c, file); break; - } - } -} - -/****************************************************************************** - * Writes contents of the registry key to the specified file stream. - * - * Parameters: - * file - writable file stream to export registry branch to. - * key - registry branch to export. - * reg_key_name_buf - name of the key with registry class. - * Is resized if necessary. - * reg_key_name_len - length of the buffer for the registry class in characters. - * val_name_buf - buffer for storing value name. - * Is resized if necessary. - * val_name_len - length of the buffer for storing value names in characters. - * val_buf - buffer for storing values while extracting. - * Is resized if necessary. - * val_size - size of the buffer for storing values in bytes. - */ -void export_hkey(FILE *file, HKEY key, - TCHAR **reg_key_name_buf, DWORD *reg_key_name_len, - TCHAR **val_name_buf, DWORD *val_name_len, - BYTE **val_buf, DWORD *val_size) -{ - DWORD max_sub_key_len; - DWORD max_val_name_len; - DWORD max_val_size; - DWORD curr_len; - DWORD i; - BOOL more_data; - LONG ret; - - /* get size information and resize the buffers if necessary */ - if (RegQueryInfoKey(key, NULL, NULL, NULL, NULL, &max_sub_key_len, NULL, - NULL, &max_val_name_len, &max_val_size, NULL, NULL) != ERROR_SUCCESS) { - REGPROC_print_error(); - } - curr_len = _tcslen(*reg_key_name_buf); - REGPROC_resize_char_buffer(reg_key_name_buf, reg_key_name_len, max_sub_key_len + curr_len + 1); - REGPROC_resize_char_buffer(val_name_buf, val_name_len, max_val_name_len); - if (max_val_size > *val_size) { - *val_size = max_val_size; - *val_buf = HeapReAlloc(GetProcessHeap(), 0, *val_buf, *val_size * sizeof(TCHAR)); - CHECK_ENOUGH_MEMORY(val_buf); - } - /* output data for the current key */ - _fputts(_T("\n["), file); - _fputts(*reg_key_name_buf, file); - _fputts(_T("]\n"), file); - /* print all the values */ - i = 0; - more_data = TRUE; - while (more_data) { - DWORD value_type; - DWORD val_name_len1 = *val_name_len; - DWORD val_size1 = *val_size; - ret = RegEnumValue(key, i, *val_name_buf, &val_name_len1, NULL, &value_type, *val_buf, &val_size1); - if (ret != ERROR_SUCCESS) { - more_data = FALSE; - if (ret != ERROR_NO_MORE_ITEMS) { - REGPROC_print_error(); - } - } else { - i++; - if ((*val_name_buf)[0]) { - _fputts(_T("\""), file); - REGPROC_export_string(file, *val_name_buf); - _fputts(_T("\"="), file); - } else { - _fputts(_T("@="), file); - } - switch (value_type) { - case REG_EXPAND_SZ: - _fputts(_T("expand:"), file); - case REG_SZ: - _fputts(_T("\""), file); - REGPROC_export_string(file, *val_buf); - _fputts(_T("\"\n"), file); - break; - case REG_DWORD: - _ftprintf(file, _T("dword:%08lx\n"), *((DWORD *)*val_buf)); - break; - default: -/* - _tprintf(_T("warning - unsupported registry format '%ld', ") \ - _T("treating as binary\n"), value_type); - _tprintf(_T("key name: \"%s\"\n"), *reg_key_name_buf); - _tprintf(_T("value name:\"%s\"\n\n"), *val_name_buf); - */ - /* falls through */ - case REG_MULTI_SZ: - /* falls through */ - case REG_BINARY: - { - DWORD i1; - TCHAR *hex_prefix; - TCHAR buf[20]; - int cur_pos; - - if (value_type == REG_BINARY) { - hex_prefix = _T("hex:"); - } else { - hex_prefix = buf; - _stprintf(buf, _T("hex(%ld):"), value_type); - } - /* position of where the next character will be printed */ - /* NOTE: yes, _tcslen("hex:") is used even for hex(x): */ - cur_pos = _tcslen(_T("\"\"=")) + _tcslen(_T("hex:")) + - _tcslen(*val_name_buf); - _fputts(hex_prefix, file); - for (i1 = 0; i1 < val_size1; i1++) { - _ftprintf(file, _T("%02x"), (unsigned int)(*val_buf)[i1]); - if (i1 + 1 < val_size1) { - _fputts(_T(","), file); - } - cur_pos += 3; - /* wrap the line */ - if (cur_pos > REG_FILE_HEX_LINE_LEN) { - _fputts(_T("\\\n "), file); - cur_pos = 2; - } - } - _fputts(_T("\n"), file); - break; - } - } - } - } - i = 0; - more_data = TRUE; - (*reg_key_name_buf)[curr_len] = _T('\\'); - while (more_data) { - DWORD buf_len = *reg_key_name_len - curr_len; - ret = RegEnumKeyEx(key, i, *reg_key_name_buf + curr_len + 1, &buf_len, NULL, NULL, NULL, NULL); - if (ret != ERROR_SUCCESS && ret != ERROR_MORE_DATA) { - more_data = FALSE; - if (ret != ERROR_NO_MORE_ITEMS) { - REGPROC_print_error(); - } - } else { - HKEY subkey; - - i++; - if (RegOpenKey(key, *reg_key_name_buf + curr_len + 1, &subkey) == ERROR_SUCCESS) { - export_hkey(file, subkey, reg_key_name_buf, reg_key_name_len, val_name_buf, val_name_len, val_buf, val_size); - RegCloseKey(subkey); - } else { - REGPROC_print_error(); - } - } - } - (*reg_key_name_buf)[curr_len] = _T('\0'); -} -/* -#define REG_NONE ( 0 ) // No value type -#define REG_SZ ( 1 ) // Unicode nul terminated string -#define REG_EXPAND_SZ ( 2 ) // Unicode nul terminated string - // (with environment variable references) -#define REG_BINARY ( 3 ) // Free form binary -#define REG_DWORD ( 4 ) // 32-bit number -#define REG_DWORD_LITTLE_ENDIAN ( 4 ) // 32-bit number (same as REG_DWORD) -#define REG_DWORD_BIG_ENDIAN ( 5 ) // 32-bit number -#define REG_LINK ( 6 ) // Symbolic Link (unicode) -#define REG_MULTI_SZ ( 7 ) // Multiple Unicode strings -#define REG_RESOURCE_LIST ( 8 ) // Resource list in the resource map -#define REG_FULL_RESOURCE_DESCRIPTOR ( 9 ) // Resource list in the hardware description -#define REG_RESOURCE_REQUIREMENTS_LIST ( 10 ) - - */ -/****************************************************************************** - * Open file for export. - */ -FILE *REGPROC_open_export_file(TCHAR *file_name) -{ -//_CRTIMP FILE * __cdecl _wfopen(const wchar_t *, const wchar_t *); - -//FILE* fopen (const char* szFileName, const char* szMode); -//FILE* _wfopen(const wchar_t *file, const wchar_t *mode); - - FILE *file = _tfopen(file_name, _T("w")); - if (!file) { - perror(""); - _tprintf(_T("REGPROC_open_export_file(%s) - Can't open file.\n"), file_name); - //exit(1); - return NULL; - } - _fputts(_T("REGEDIT4\n"), file); - return file; -} - -/****************************************************************************** - * Writes contents of the registry key to the specified file stream. - * - * Parameters: - * file_name - name of a file to export registry branch to. - * reg_key_name - registry branch to export. The whole registry is exported if - * reg_key_name is NULL or contains an empty string. - */ -BOOL export_registry_key(TCHAR* file_name, TCHAR* reg_key_name) -{ - HKEY reg_key_class; - - TCHAR *reg_key_name_buf; - TCHAR *val_name_buf; - BYTE *val_buf; - DWORD reg_key_name_len = KEY_MAX_LEN; - DWORD val_name_len = KEY_MAX_LEN; - DWORD val_size = REG_VAL_BUF_SIZE; - FILE *file = NULL; - - //_tprintf(_T("export_registry_key(%s, %s)\n"), reg_key_name, file_name); - - reg_key_name_buf = HeapAlloc(GetProcessHeap(), 0, reg_key_name_len * sizeof(*reg_key_name_buf)); - val_name_buf = HeapAlloc(GetProcessHeap(), 0, val_name_len * sizeof(*val_name_buf)); - val_buf = HeapAlloc(GetProcessHeap(), 0, val_size); - CHECK_ENOUGH_MEMORY(reg_key_name_buf && val_name_buf && val_buf); - - if (reg_key_name && reg_key_name[0]) { - TCHAR *branch_name; - HKEY key; - - REGPROC_resize_char_buffer(®_key_name_buf, ®_key_name_len, - _tcslen(reg_key_name)); - _tcscpy(reg_key_name_buf, reg_key_name); - - /* open the specified key */ - reg_key_class = getRegClass(reg_key_name); - if (reg_key_class == (HKEY)ERROR_INVALID_PARAMETER) { - _tprintf(_T("Incorrect registry class specification in '%s\n"), reg_key_name); - //exit(1); - return FALSE; - } - branch_name = getRegKeyName(reg_key_name); - CHECK_ENOUGH_MEMORY(branch_name); - if (!branch_name[0]) { - /* no branch - registry class is specified */ - file = REGPROC_open_export_file(file_name); - export_hkey(file, reg_key_class, - ®_key_name_buf, ®_key_name_len, - &val_name_buf, &val_name_len, - &val_buf, &val_size); - } else if (RegOpenKey(reg_key_class, branch_name, &key) == ERROR_SUCCESS) { - file = REGPROC_open_export_file(file_name); - export_hkey(file, key, - ®_key_name_buf, ®_key_name_len, - &val_name_buf, &val_name_len, - &val_buf, &val_size); - RegCloseKey(key); - } else { - _tprintf(_T("Can't export. Registry key '%s does not exist!\n"), reg_key_name); - REGPROC_print_error(); - } - HeapFree(GetProcessHeap(), 0, branch_name); - } else { - int i; - - /* export all registry classes */ - file = REGPROC_open_export_file(file_name); - for (i = 0; i < REG_CLASS_NUMBER; i++) { - /* do not export HKEY_CLASSES_ROOT */ - if (reg_class_keys[i] != HKEY_CLASSES_ROOT && - reg_class_keys[i] != HKEY_CURRENT_USER && - reg_class_keys[i] != HKEY_CURRENT_CONFIG) { - _tcscpy(reg_key_name_buf, reg_class_names[i]); - export_hkey(file, reg_class_keys[i], - ®_key_name_buf, ®_key_name_len, - &val_name_buf, &val_name_len, - &val_buf, &val_size); - } - } - } - if (file) { - fclose(file); - } -// HeapFree(GetProcessHeap(), 0, reg_key_name); - HeapFree(GetProcessHeap(), 0, val_buf); - HeapFree(GetProcessHeap(), 0, val_name_buf); - HeapFree(GetProcessHeap(), 0, reg_key_name_buf); - return TRUE; -} - -/****************************************************************************** - * Reads contents of the specified file into the registry. - */ -BOOL import_registry_file(LPTSTR filename) -{ - FILE* reg_file = _tfopen(filename, _T("r")); - - if (reg_file) { - processRegLines(reg_file, doSetValue); - return TRUE; - } - return FALSE; -} - -/****************************************************************************** - * Recursive function which removes the registry key with all subkeys. - */ -BOOL delete_branch(HKEY key, TCHAR** reg_key_name_buf, DWORD* reg_key_name_len) -{ - HKEY branch_key; - DWORD max_sub_key_len; - DWORD subkeys; - DWORD curr_len; - LONG ret; - long int i; - - if (RegOpenKey(key, *reg_key_name_buf, &branch_key) != ERROR_SUCCESS) { - REGPROC_print_error(); - return FALSE; - } - - /* get size information and resize the buffers if necessary */ - if (RegQueryInfoKey(branch_key, NULL, NULL, NULL, &subkeys, &max_sub_key_len, - NULL, NULL, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) { - REGPROC_print_error(); - RegCloseKey(branch_key); - return FALSE; - } - curr_len = _tcslen(*reg_key_name_buf); - REGPROC_resize_char_buffer(reg_key_name_buf, reg_key_name_len, max_sub_key_len + curr_len + 1); - - (*reg_key_name_buf)[curr_len] = '\\'; - for (i = subkeys - 1; i >= 0; i--) { - DWORD buf_len = *reg_key_name_len - curr_len; - ret = RegEnumKeyEx(branch_key, i, *reg_key_name_buf + curr_len + 1, &buf_len, NULL, NULL, NULL, NULL); - if (ret != ERROR_SUCCESS && ret != ERROR_MORE_DATA && ret != ERROR_NO_MORE_ITEMS) { - REGPROC_print_error(); - RegCloseKey(branch_key); - return FALSE; - } else { - delete_branch(key, reg_key_name_buf, reg_key_name_len); - } - } - (*reg_key_name_buf)[curr_len] = '\0'; - RegCloseKey(branch_key); - RegDeleteKey(key, *reg_key_name_buf); - return TRUE; -} - -/****************************************************************************** - * Removes the registry key with all subkeys. Parses full key name. - * - * Parameters: - * reg_key_name - full name of registry branch to delete. Ignored if is NULL, - * empty, points to register key class, does not exist. - */ -void delete_registry_key(TCHAR* reg_key_name) -{ - TCHAR* branch_name; - DWORD branch_name_len; - HKEY reg_key_class; - HKEY branch_key; - - if (!reg_key_name || !reg_key_name[0]) { - return; - } - /* open the specified key */ - reg_key_class = getRegClass(reg_key_name); - if (reg_key_class == (HKEY)ERROR_INVALID_PARAMETER) { - _tprintf(_T("Incorrect registry class specification in '%s'\n"), reg_key_name); - //exit(1); - return; - } - branch_name = getRegKeyName(reg_key_name); - CHECK_ENOUGH_MEMORY(branch_name); - branch_name_len = _tcslen(branch_name); - if (!branch_name[0]) { - _tprintf(_T("Can't delete registry class '%s'\n"), reg_key_name); - //exit(1); - return; - } - if (RegOpenKey(reg_key_class, branch_name, &branch_key) == ERROR_SUCCESS) { - /* check whether the key exists */ - RegCloseKey(branch_key); - delete_branch(reg_key_class, &branch_name, &branch_name_len); - } - HeapFree(GetProcessHeap(), 0, branch_name); -} - diff --git a/reactos/apps/tests/regdump/regproc.h b/reactos/apps/tests/regdump/regproc.h deleted file mode 100644 index 70215a1ead4..00000000000 --- a/reactos/apps/tests/regdump/regproc.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright 1999 Sylvain St-Germain - * Copyright 2002 Andriy Palamarchuk - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/****************************************************************************** - * Defines and consts - */ -#define KEY_MAX_LEN 1024 - -/* Return values */ -#define SUCCESS 0 -#define KEY_VALUE_ALREADY_SET 2 - -typedef void (*CommandAPI)(LPTSTR lpsLine); - -void doSetValue(LPTSTR lpsLine); -void doDeleteValue(LPTSTR lpsLine); -void doCreateKey(LPTSTR lpsLine); -void doDeleteKey(LPTSTR lpsLine); -void doQueryValue(LPTSTR lpsLine); -void doRegisterDLL(LPTSTR lpsLine); -void doUnregisterDLL(LPTSTR lpsLine); - -BOOL export_registry_key(TCHAR* file_name, TCHAR* reg_key_name); -BOOL import_registry_file(LPTSTR filename); -void delete_registry_key(TCHAR* reg_key_name); - -void processRegLines(FILE* in, CommandAPI command); - -/* - * Generic prototypes - */ -#ifdef _UNICODE -#define get_file_name get_file_nameW -#else -#define get_file_name get_file_nameA -#endif - -char* getToken(char** str, const char* delims); -void get_file_nameA(CHAR** command_line, CHAR* filename, int max_filename); -void get_file_nameW(CHAR** command_line, WCHAR* filename, int max_filename); -DWORD convertHexToDWord(TCHAR* str, BYTE* buf); -DWORD convertHexCSVToHex(TCHAR* str, BYTE* buf, ULONG bufLen); -LPTSTR convertHexToHexCSV(BYTE* buf, ULONG len); -LPTSTR convertHexToDWORDStr(BYTE* buf, ULONG len); -LPTSTR getRegKeyName(LPTSTR lpLine); -HKEY getRegClass(LPTSTR lpLine); -DWORD getDataType(LPTSTR* lpValue, DWORD* parse_type); -LPTSTR getArg(LPTSTR arg); -HRESULT openKey(LPTSTR stdInput); -void closeKey(VOID); - -/* - * api setValue prototypes - */ -void processSetValue(LPTSTR cmdline); -HRESULT setValue(LPTSTR val_name, LPTSTR val_data); - -/* - * api queryValue prototypes - */ -void processQueryValue(LPTSTR cmdline); - -#ifdef __GNUC__ -#ifdef WIN32_REGDBG -//typedef UINT_PTR SIZE_T, *PSIZE_T; -//#define _MAX_PATH 260 /* max. length of full pathname */ -#endif /*WIN32_REGDBG*/ - -#ifdef UNICODE -#define _tfopen _wfopen -#else -#define _tfopen fopen -#endif - -#endif /*__GNUC__*/ - -LPVOID RegHeapAlloc( - HANDLE hHeap, // handle to private heap block - DWORD dwFlags, // heap allocation control - SIZE_T dwBytes // number of bytes to allocate -); - -LPVOID RegHeapReAlloc( - HANDLE hHeap, // handle to heap block - DWORD dwFlags, // heap reallocation options - LPVOID lpMem, // pointer to memory to reallocate - SIZE_T dwBytes // number of bytes to reallocate -); - -BOOL RegHeapFree( - HANDLE hHeap, // handle to heap - DWORD dwFlags, // heap free options - LPVOID lpMem // pointer to memory -); diff --git a/reactos/apps/tests/regqueryvalue/makefile b/reactos/apps/tests/regqueryvalue/makefile deleted file mode 100644 index 85b892cc7cf..00000000000 --- a/reactos/apps/tests/regqueryvalue/makefile +++ /dev/null @@ -1,22 +0,0 @@ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = regqueryvalue - -TARGET_SDKLIBS = advapi32.a ws2_32.a kernel32.a - -TARGET_OBJECTS = $(TARGET_NAME).o - -TARGET_CFLAGS = -Wall -Werror -g - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/apps/tests/regqueryvalue/regqueryvalue.c b/reactos/apps/tests/regqueryvalue/regqueryvalue.c deleted file mode 100644 index 008d8c3ec81..00000000000 --- a/reactos/apps/tests/regqueryvalue/regqueryvalue.c +++ /dev/null @@ -1,69 +0,0 @@ -#define _DISABLE_TIDENTS -#include -#include -#include -#include -#include - -int main( int argc, char **argv ) { - ULONG ResultSize; - PWCHAR WcharResult; - WCHAR ValueNameWC[100]; - PCHAR CharResult; - HANDLE RegKey; - int i; - - if( argc < 2 ) { - printf( "Usage: regqueryvalue [key] [value]\n" ); - printf( "Returns an HKEY_LOCAL_MACHINE value from the given key.\n" ); - return 1; - } - - if ( RegOpenKeyExA( HKEY_LOCAL_MACHINE, argv[1], 0, KEY_READ, &RegKey ) - != 0 ) { - printf( "Could not open key %s\n", argv[1] ); - return 2; - } - - for( i = 0; argv[2][i]; i++ ) ValueNameWC[i] = argv[2][i]; - ValueNameWC[i] = 0; - - if(RegQueryValueExW( RegKey, ValueNameWC, NULL, NULL, NULL, &ResultSize ) - != 0) { - printf( "The value %S does not exist.\n", ValueNameWC ); - return 5; - } - - WcharResult = malloc( (ResultSize + 1) * sizeof(WCHAR) ); - - if( !WcharResult ) { - printf( "Could not alloc %d wchars\n", (int)(ResultSize + 1) ); - return 6; - } - - RegQueryValueExW( RegKey, ValueNameWC, NULL, NULL, (LPBYTE)WcharResult, - &ResultSize ); - - printf( "wchar Value: %S\n", WcharResult ); - fflush( stdout ); - - RegQueryValueExA( RegKey, argv[2], NULL, NULL, NULL, &ResultSize ); - - CharResult = malloc( ResultSize + 1 ); - - if( !CharResult ) { - printf( "Could not alloc %d chars\n", (int)(ResultSize + 1) ); - return 7; - } - - RegQueryValueExA( RegKey, argv[2], NULL, NULL, CharResult, &ResultSize ); - - printf( " char Value: %s\n", CharResult ); - fflush( stdout ); - - free( WcharResult ); - free( CharResult ); - free( ValueNameWC ); - - return 0; -} diff --git a/reactos/apps/tests/regtest/.cvsignore b/reactos/apps/tests/regtest/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/regtest/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/regtest/makefile b/reactos/apps/tests/regtest/makefile deleted file mode 100644 index 8da5ae0fe5a..00000000000 --- a/reactos/apps/tests/regtest/makefile +++ /dev/null @@ -1,24 +0,0 @@ -# -# $Id: makefile,v 1.8 2003/11/14 17:13:19 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = regtest - -TARGET_SDKLIBS = ntdll.a kernel32.a advapi32.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/regtest/regtest.c b/reactos/apps/tests/regtest/regtest.c deleted file mode 100644 index ca867d2b10a..00000000000 --- a/reactos/apps/tests/regtest/regtest.c +++ /dev/null @@ -1,995 +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;i - -#include -#include -#include -#include - -#include "wine/unicode.h" -#include "rpc.h" - -static UUID Uuid_Table[10] = { - { 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }, /* 0 (null) */ - { 0xdeadbeef, 0xdead, 0xbeef, {0x10, 0x21, 0x35, 0x56, 0x89, 0xa0, 0xf4, 0x8a} }, /* 1 */ - { 0xabadfeed, 0x49ff, 0xbead, {0x8a, 0xf4, 0xa0, 0x89, 0x56, 0x35, 0x21, 0x10} }, /* 2 */ - { 0x93da375c, 0x1324, 0x1355, {0x87, 0xff, 0x49, 0x44, 0x34, 0x44, 0x22, 0x19} }, /* 3 */ - { 0xdeadbeef, 0xdead, 0xbeef, {0x10, 0x21, 0x35, 0x56, 0x89, 0xa0, 0xf4, 0x8b} }, /* 4 (~1) */ - { 0x9badfeed, 0x49ff, 0xbead, {0x8a, 0xf4, 0xa0, 0x89, 0x56, 0x35, 0x21, 0x10} }, /* 5 (~2) */ - { 0x00000000, 0x0001, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }, /* 6 (~0) */ - { 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01} }, /* 7 (~0) */ - { 0x12312312, 0x1231, 0x1231, {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xff} }, /* 8 */ - { 0x11111111, 0x1111, 0x1111, {0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11} } /* 9 */ -}; - -/* index of "10" means "NULL" */ -static BOOL Uuid_Comparison_Grid[11][11] = { - { TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE }, - { FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, - { FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, - { FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, - { FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, - { FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE }, - { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE }, - { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE }, - { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE }, - { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE }, - { TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE } -}; - -void UuidConversionAndComparison(void) { - CHAR strx[100], x; - LPSTR str = strx; - WCHAR wstrx[100], wx; - LPWSTR wstr = wstrx; - - UUID Uuid1, Uuid2, *PUuid1, *PUuid2; - RPC_STATUS rslt; - - int i1,i2; - - /* Uuid Equality */ - for (i1 = 0; i1 < 11; i1++) - for (i2 = 0; i2 < 11; i2++) { - if (i1 < 10) { - Uuid1 = Uuid_Table[i1]; - PUuid1 = &Uuid1; - } else { - PUuid1 = NULL; - } - if (i2 < 10) { - Uuid2 = Uuid_Table[i2]; - PUuid2 = &Uuid2; - } else { - PUuid2 = NULL; - } - ok( (UuidEqual(PUuid1, PUuid2, &rslt) == Uuid_Comparison_Grid[i1][i2]), "UUID Equality" ); - } - - /* Uuid to String to Uuid (char) */ - for (i1 = 0; i1 < 10; i1++) { - Uuid1 = Uuid_Table[i1]; - ok( (UuidToStringA(&Uuid1, (unsigned char**)&str) == RPC_S_OK), "Simple UUID->String copy" ); - ok( (UuidFromStringA(str, &Uuid2) == RPC_S_OK), "Simple String->UUID copy from generated UUID String" ); - ok( UuidEqual(&Uuid1, &Uuid2, &rslt), "Uuid -> String -> Uuid transform" ); - /* invalid uuid tests -- size of valid UUID string=36 */ - for (i2 = 0; i2 < 36; i2++) { - x = str[i2]; - str[i2] = 'g'; /* whatever, but "g" is a good boundary condition */ - ok( (UuidFromStringA(str, &Uuid1) == RPC_S_INVALID_STRING_UUID), "Invalid UUID String" ); - str[i2] = x; /* change it back so remaining tests are interesting. */ - } - } - - /* Uuid to String to Uuid (wchar) */ - for (i1 = 0; i1 < 10; i1++) { - Uuid1 = Uuid_Table[i1]; - rslt=UuidToStringW(&Uuid1, &wstr); - if (rslt==RPC_S_CANNOT_SUPPORT) { - /* Must be Win9x (no Unicode support), skip the tests */ - break; - } - ok( (rslt == RPC_S_OK), "Simple UUID->WString copy" ); - ok( (UuidFromStringW(wstr, &Uuid2) == RPC_S_OK), "Simple WString->UUID copy from generated UUID String" ); - ok( UuidEqual(&Uuid1, &Uuid2, &rslt), "Uuid -> WString -> Uuid transform" ); - /* invalid uuid tests -- size of valid UUID string=36 */ - for (i2 = 0; i2 < 36; i2++) { - wx = wstr[i2]; - wstr[i2] = 'g'; /* whatever, but "g" is a good boundary condition */ - ok( (UuidFromStringW(wstr, &Uuid1) == RPC_S_INVALID_STRING_UUID), "Invalid UUID WString" ); - wstr[i2] = wx; /* change it back so remaining tests are interesting. */ - } - } -} - -START_TEST( rpc ) -{ - trace ( " ** Uuid Conversion and Comparison Tests **\n" ); - UuidConversionAndComparison(); -} diff --git a/reactos/apps/tests/rpcrt4/testlist.c b/reactos/apps/tests/rpcrt4/testlist.c deleted file mode 100644 index 844bf7834c0..00000000000 --- a/reactos/apps/tests/rpcrt4/testlist.c +++ /dev/null @@ -1,24 +0,0 @@ -/* Automatically generated file; DO NOT EDIT!! */ - -#include -#include -#include -#include "windef.h" -#include "winbase.h" - -extern void func_rpc(void); - -struct test -{ - const char *name; - void (*func)(void); -}; - -static const struct test winetest_testlist[] = -{ - { "rpc", func_rpc }, - { 0, 0 } -}; - -#define WINETEST_WANT_MAIN -#include "wine/test.h" diff --git a/reactos/apps/tests/sectest/.cvsignore b/reactos/apps/tests/sectest/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/sectest/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/sectest/Makefile b/reactos/apps/tests/sectest/Makefile deleted file mode 100644 index 93fefaecae6..00000000000 --- a/reactos/apps/tests/sectest/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# $Id: Makefile,v 1.4 2003/11/14 17:13:20 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = sectest - -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/sectest/sectest.c b/reactos/apps/tests/sectest/sectest.c deleted file mode 100644 index 2a0a387c6da..00000000000 --- a/reactos/apps/tests/sectest/sectest.c +++ /dev/null @@ -1,73 +0,0 @@ -/* $Id: sectest.c,v 1.5 2003/11/14 17:13:20 weiden Exp $ */ -#define UNICODE -#define _UNICODE -#include -#include -#include - -int main(int argc, char* argv[]) -{ - HANDLE hFile; - HANDLE Section; - PVOID BaseAddress; - - printf("Section Test\n"); - - hFile = CreateFile(_T("sectest.txt"), - GENERIC_READ | GENERIC_WRITE, - 0, - NULL, - CREATE_ALWAYS, - 0, - 0); - if (hFile == INVALID_HANDLE_VALUE) - { - printf("Failed to create file (err=%ld)", GetLastError()); - return 1; - } - - Section = CreateFileMapping(hFile, - NULL, - PAGE_READWRITE, - 0, - 4096, - NULL); - if (Section == NULL) - { - printf("Failed to create section (err=%ld)", GetLastError()); - return 1; - } - - printf("Mapping view of section\n"); - BaseAddress = MapViewOfFile(Section, - FILE_MAP_ALL_ACCESS, - 0, - 0, - 4096); - printf("BaseAddress %x\n", (UINT) BaseAddress); - if (BaseAddress == NULL) - { - printf("Failed to map section (%ld)\n", GetLastError()); - return 1; - } - - printf("Clearing section\n"); - FillMemory(BaseAddress, 4096, ' '); - printf("Copying test data to section\n"); - strcpy(BaseAddress, "test data"); - - if (!UnmapViewOfFile(BaseAddress)) - { - printf("Failed to unmap view of file (%ld)\n", GetLastError()); - return 1; - } - - if (!CloseHandle(hFile)) - { - printf("Failed to close file (%ld)\n", GetLastError()); - return 1; - } - - return 0; -} - diff --git a/reactos/apps/tests/sertest/.cvsignore b/reactos/apps/tests/sertest/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/sertest/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/sertest/makefile b/reactos/apps/tests/sertest/makefile deleted file mode 100644 index 96051f597ab..00000000000 --- a/reactos/apps/tests/sertest/makefile +++ /dev/null @@ -1,24 +0,0 @@ -# -# $Id: makefile,v 1.0 - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = sertest - -TARGET_SDKLIBS = ntdll.a kernel32.a advapi32.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/sertest/sertest.c b/reactos/apps/tests/sertest/sertest.c deleted file mode 100644 index e6d7c4eae1e..00000000000 --- a/reactos/apps/tests/sertest/sertest.c +++ /dev/null @@ -1,131 +0,0 @@ -#include -#include - -#define BUFSIZE 128 -#define MAX_PORTNAME_LEN 20 -#define APP_VERSION_STR "0.01" - -int main(int argc, char *argv[]) -{ - CHAR txBuffer[BUFSIZE]; - CHAR rxBuffer[BUFSIZE]; - DWORD dwBaud = 9600; - DWORD dwNumWritten; - DWORD dwErrors; - DCB dcb; - BOOL bResult; - HANDLE hPort; - int i; - int j; - int k; - int nPortNum = 1; - - TCHAR szPortName[MAX_PORTNAME_LEN]; - - if (argc > 1) { - //sscanf(argv[1], "%d", &dwBaud); - sscanf(argv[1], "%d", &nPortNum); - } - sprintf(szPortName, _T("COM%d"), nPortNum); - - printf("Serial Port Test Application Version %s\n", APP_VERSION_STR); - printf("Attempting to open serial port %d - %s\n", nPortNum, szPortName); - hPort = CreateFile(szPortName, - GENERIC_READ|GENERIC_WRITE, - 0, // exclusive - NULL, // sec attr - OPEN_EXISTING, - 0, // no attributes - NULL); // no template - - if (hPort == (HANDLE)-1) { - printf("ERROR: CreateFile() failed with result: %lx\n", (DWORD)hPort); - return 1; - } - printf("CreateFile() returned: %lx\n", (DWORD)hPort); - - printf("Fiddling with DTR and RTS control lines...\n"); - for (i = 0; i < 100; i++) { - bResult = EscapeCommFunction(hPort, SETDTR); - if (!bResult) { - printf("WARNING: EscapeCommFunction(SETDTR) failed: %lx\n", (DWORD)bResult); - } - bResult = EscapeCommFunction(hPort, SETRTS); - if (!bResult) { - printf("WARNING: EscapeCommFunction(SETRTS) failed: %lx\n", (DWORD)bResult); - } - for (j = 0; j < 1000; j++) { - k *= j; - } -/* -#define CLRDTR (6) -#define CLRRTS (4) -#define SETDTR (5) -#define SETRTS (3) -#define SETXOFF (1) -#define SETXON (2) -#define SETBREAK (8) -#define CLRBREAK (9) - */ - bResult = EscapeCommFunction(hPort, CLRDTR); - if (!bResult) { - printf("WARNING: EscapeCommFunction(CLRDTR) failed: %lx\n", (DWORD)bResult); - } - bResult = EscapeCommFunction(hPort, CLRRTS); - if (!bResult) { - printf("WARNING: EscapeCommFunction(CLRRTS) failed: %lx\n", (DWORD)bResult); - } - } - printf("Getting the default line characteristics...\n"); - dcb.DCBlength = sizeof(DCB); - if (!GetCommState(hPort, &dcb)) { - printf("ERROR: failed to get the dcb: %ld\n", GetLastError()); - return 2; - } - printf("Setting the line characteristics to 9600,8,N,1\n"); - dcb.BaudRate = dwBaud; - dcb.ByteSize = 8; - dcb.Parity = NOPARITY; - dcb.StopBits = ONESTOPBIT; - - bResult = SetCommState(hPort, &dcb); - if (!bResult) { - printf("ERROR: failed to set the comm state: %lx\n", (DWORD)bResult); - return 3; - } - for (i = 0; i < BUFSIZE; i++) { - txBuffer[i] = (CHAR)i; - //printf(" %d ", txBuffer[i]); - rxBuffer[i] = 0xFF; - } - printf("\n"); - printf("Writting transmit buffer to the serial port\n"); - bResult = WriteFile(hPort, txBuffer, BUFSIZE, &dwNumWritten, NULL); - if (!bResult) { - printf("ERROR: failed to write to the serial port: %lx\n", (DWORD)bResult); - return 4; - } - printf("WriteFile() returned: %lx, byteswritten: %lx\n", (DWORD)bResult, dwNumWritten); -#if 0 - printf("Attempting to read %d bytes from the serial port\n", BUFSIZE); - bResult = ReadFile(hPort, rxBuffer, BUFSIZE, &dwNumRead, NULL); - if (!bResult) { - printf("ERROR: failed to read from the serial port: %lx\n", (DWORD)bResult); - return 5; - } - printf("ReadFile() returned: %lx, bytesread: %lx\n", (DWORD)bResult, dwNumRead); - for (i = 0; i < BUFSIZE; i++) { - printf(" %d ",rxBuffer[i]); - } -#endif - printf("Attempting to close the serial port\n"); - bResult = ClearCommError(hPort, &dwErrors, NULL); - printf("ClearCommError returned: %lx, dwErrors: %lx\n", (DWORD)bResult, dwErrors); - bResult = CloseHandle(hPort); - if (!bResult) { - printf("ERROR: failed to close the serial port: %lx\n", (DWORD)bResult); - return 6; - } - printf("Finished\n"); - return 0; -} diff --git a/reactos/apps/tests/shaptest/.cvsignore b/reactos/apps/tests/shaptest/.cvsignore deleted file mode 100644 index d63774a7353..00000000000 --- a/reactos/apps/tests/shaptest/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/apps/tests/shaptest/makefile b/reactos/apps/tests/shaptest/makefile deleted file mode 100644 index 6f8a915a405..00000000000 --- a/reactos/apps/tests/shaptest/makefile +++ /dev/null @@ -1,25 +0,0 @@ -# $Id: makefile,v 1.3 2003/11/14 17:13:20 weiden Exp $ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = shaptest - -TARGET_CFLAGS = -Wall -Werror - -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/shaptest/shaptest.c b/reactos/apps/tests/shaptest/shaptest.c deleted file mode 100644 index 693cfc3f184..00000000000 --- a/reactos/apps/tests/shaptest/shaptest.c +++ /dev/null @@ -1,252 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * AUTHOR: See gditest-- (initial changes by Mark Tempel) - * shaptest - * - * This is a windowed application that should draw two polygons. One - * is drawn with ALTERNATE fill, the other is drawn with WINDING fill. - * This is used to test out the Polygon() implementation. - */ - -#include -#include -#include - -#ifndef ASSERT -#define ASSERT assert -#endif - -#define nelem(x) (sizeof (x) / sizeof *(x)) - -HFONT tf; -LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM); - -void PolygonTest ( HDC hdc ) -{ - HPEN Pen, OldPen; - HBRUSH RedBrush, OldBrush; - DWORD Mode; - POINT PointsAlternate[] = - { - { 20, 80 }, - { 60, 20 }, - { 90, 80 }, - { 20, 40 }, - { 100, 40 } - }; - POINT PointsWinding[] = - { - { 130, 80 }, - { 170, 20 }, - { 200, 80 }, - { 130, 40 }, - { 210, 40 } - }; - POINT Tri1[] = - { - { 3, 3 }, - { 5, 3 }, - { 3, 5 } - }; - POINT Tri2[] = - { - { 7, 3 }, - { 7, 7 }, - { 3, 7 }, - }; - POINT Square1[] = - { - { 1, 15 }, - { 3, 15 }, - { 3, 17 }, - { 1, 17 } - }; - POINT Square2[] = - { - { 5, 15 }, - { 7, 15 }, - { 7, 17 }, - { 5, 17 } - }; - POINT Square3[] = - { - { 1, 23 }, - { 3, 23 }, - { 3, 25 }, - { 1, 25 } - }; - POINT Square4[] = - { - { 5, 23 }, - { 7, 23 }, - { 7, 25 }, - { 5, 25 } - }; - POINT Square5[] = - { - { 1, 31 }, - { 3, 31 }, - { 3, 33 }, - { 1, 33 } - }; - POINT Square6[] = - { - { 5, 31 }, - { 7, 31 }, - { 7, 33 }, - { 5, 33 } - }; - - //create a pen to draw the shape - Pen = CreatePen(PS_SOLID, 1, RGB(0, 0, 0xff)); - ASSERT(Pen); - RedBrush = CreateSolidBrush(RGB(0xff, 0, 0)); - ASSERT(RedBrush); - - OldPen = (HPEN)SelectObject(hdc, Pen); - OldBrush = (HBRUSH)SelectObject(hdc, RedBrush); - - Mode = GetPolyFillMode(hdc); - - RoundRect ( hdc, 32, 8, 48, 24, 8, 8 ); - - SetPolyFillMode(hdc, ALTERNATE); - Polygon(hdc,PointsAlternate,nelem(PointsAlternate)); - - SetPolyFillMode(hdc, WINDING); - Polygon(hdc,PointsWinding,nelem(PointsWinding)); - - Rectangle ( hdc, 1, 1, 10, 10 ); - Polygon(hdc,Tri1,nelem(Tri1)); - Polygon(hdc,Tri2,nelem(Tri2)); - - Rectangle ( hdc, 1, 11, 4, 14 ); - Rectangle ( hdc, 5, 11, 8, 14 ); - Rectangle ( hdc, 9, 11, 12, 14 ); - Rectangle ( hdc, 13, 11, 16, 14 ); - Polygon(hdc,Square1,nelem(Square1)); - Polygon(hdc,Square2,nelem(Square2)); - Rectangle ( hdc, 1, 19, 4, 22 ); - Rectangle ( hdc, 5, 19, 8, 22 ); - Rectangle ( hdc, 9, 19, 12, 22 ); - Rectangle ( hdc, 13, 19, 16, 22 ); - Polygon(hdc,Square3,nelem(Square3)); - Polygon(hdc,Square4,nelem(Square4)); - Rectangle ( hdc, 1, 27, 4, 30 ); - Rectangle ( hdc, 5, 27, 8, 30 ); - Rectangle ( hdc, 9, 27, 12, 30 ); - Rectangle ( hdc, 13, 27, 16, 30 ); - - // switch to null pen to make surey they display correctly - DeleteObject ( SelectObject(hdc, OldPen) ); - Pen = CreatePen ( PS_NULL, 0, 0 ); - ASSERT(Pen); - OldPen = (HPEN)SelectObject(hdc, Pen); - - Polygon(hdc,Square5,nelem(Square5)); - Polygon(hdc,Square6,nelem(Square6)); - Rectangle ( hdc, 1, 35, 4, 38 ); - Rectangle ( hdc, 5, 35, 8, 38 ); - Rectangle ( hdc, 9, 35, 12, 38 ); - Rectangle ( hdc, 13, 35, 16, 38 ); - - //cleanup - SetPolyFillMode(hdc, Mode); - DeleteObject ( SelectObject(hdc, OldPen) ); - DeleteObject ( SelectObject(hdc, OldBrush) ); -} - - -void shaptest( HDC hdc ) -{ - //Test the Polygon routine. - PolygonTest(hdc); -} - - -int WINAPI -WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpszCmdLine, - int nCmdShow) -{ - WNDCLASS wc; - MSG msg; - HWND hWnd; - - wc.lpszClassName = "ShapTestClass"; - wc.lpfnWndProc = MainWndProc; - wc.style = CS_VREDRAW | CS_HREDRAW; - wc.hInstance = hInstance; - wc.hIcon = (HICON)LoadIcon(NULL, (LPCTSTR)IDI_APPLICATION); - wc.hCursor = (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%X)\n", - (unsigned int)GetLastError()); - return(1); - } - - hWnd = CreateWindow("ShapTestClass", - "Shaptest", - 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%X)\n", - (unsigned int)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) -{ - PAINTSTRUCT ps; - HDC hDC; - - switch(msg) - { - - case WM_PAINT: - hDC = BeginPaint(hWnd, &ps); - shaptest( hDC ); - 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/statst2/.cvsignore b/reactos/apps/tests/statst2/.cvsignore deleted file mode 100644 index 1f070024388..00000000000 --- a/reactos/apps/tests/statst2/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map - diff --git a/reactos/apps/tests/statst2/Makefile b/reactos/apps/tests/statst2/Makefile deleted file mode 100644 index c5a8acd106b..00000000000 --- a/reactos/apps/tests/statst2/Makefile +++ /dev/null @@ -1,22 +0,0 @@ - -PATH_TO_TOP = ../../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = windows - -TARGET_NAME = statst2 - -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/statst2/statst2.c b/reactos/apps/tests/statst2/statst2.c deleted file mode 100644 index 6ac769ed38b..00000000000 --- a/reactos/apps/tests/statst2/statst2.c +++ /dev/null @@ -1,180 +0,0 @@ -// Static Control Test.c - -//#define WIN32_LEAN_AND_MEAN -#include -#include - -#ifndef SS_ENDELLIPSIS -#define SS_ENDELLIPSIS 0x00004000L -#endif /* SS_ENDELLIPSIS */ - - -#define nMaxCtrls 32 -#define nStaticWidth 384 -#define nStaticHeight 18 - -HWND g_hwnd = NULL; -HINSTANCE g_hInst = 0; -int nNextCtrl = 0; -HWND g_hwndCtrl[nMaxCtrls]; - -static void CreateStatic ( const char* lpWindowName, DWORD dwStyle ) -{ - int n = nNextCtrl++; - assert ( n < nMaxCtrls ); - g_hwndCtrl[n] = CreateWindow ( - "STATIC", // lpClassName - lpWindowName, // lpWindowName - WS_VISIBLE|WS_CHILD|dwStyle, // dwStyle - n+2, // x - nStaticHeight*n+1, // y - nStaticWidth, // nWidth - nStaticHeight-1, // nHeight - g_hwnd, // hWndParent - NULL, // hMenu - g_hInst, // hInstance - NULL ); // lParam -} - -LRESULT CALLBACK WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) -{ - int i; - switch ( msg ) - { - case WM_CREATE: - g_hwnd = hwnd; - for ( i = 0; i < nMaxCtrls; i++ ) - g_hwndCtrl[i] = NULL; - - CreateStatic ( "SS_NOTIFY test (click/double-click here)", SS_NOTIFY ); - - CreateStatic ( "SS_ENDELLIPSIS test test test test test test test test test test test", SS_ENDELLIPSIS ); - - CreateStatic ( "SS_CENTER test", SS_CENTER ); - - CreateStatic ( "SS_RIGHT test", SS_RIGHT ); - - CreateStatic ( "SS_BLACKFRAME test:", 0 ); - CreateStatic ( "this text shouldn't be visible!", SS_BLACKFRAME ); - - CreateStatic ( "SS_BLACKRECT test:", 0 ); - CreateStatic ( "this text shouldn't be visible!", SS_BLACKRECT ); - - CreateStatic ( "SS_ETCHEDFRAME test:", 0 ); - CreateStatic ( "this text shouldn't be visible!", SS_ETCHEDFRAME ); - - CreateStatic ( "SS_ETCHEDHORZ test:", 0 ); - CreateStatic ( "this text shouldn't be visible!", SS_ETCHEDHORZ ); - - CreateStatic ( "SS_ETCHEDVERT test", 0 ); - CreateStatic ( "this text shouldn't be visible!", SS_ETCHEDVERT ); - - CreateStatic ( "SS_GRAYFRAME test", 0 ); - CreateStatic ( "this text shouldn't be visible!", SS_GRAYFRAME ); - - CreateStatic ( "SS_GRAYRECT test", 0 ); - CreateStatic ( "this text shouldn't be visible!", SS_GRAYRECT ); - - CreateStatic ( "SS_NOPREFIX &test", SS_NOPREFIX ); - - CreateStatic ( "SS_OWNERDRAW test", SS_OWNERDRAW ); - - CreateStatic ( "SS_SUNKEN test", SS_SUNKEN ); - - CreateStatic ( "SS_WHITEFRAME test:", 0 ); - CreateStatic ( "this text shouldn't be visible!", SS_WHITEFRAME ); - - CreateStatic ( "SS_WHITERECT test:", 0 ); - CreateStatic ( "this text shouldn't be visible!", SS_WHITERECT ); - - //if ( creation fails ) - // return 0; - break; - - case WM_COMMAND: - if ( HIWORD(wParam) == STN_CLICKED ) - SetWindowText ( (HWND)lParam, "SS_NOTIFY:STN_CLICKED!" ); - if ( HIWORD(wParam) == STN_DBLCLK ) - SetWindowText ( (HWND)lParam, "SS_NOTIFY:STN_DBLCLK!" ); - break; - - case WM_DRAWITEM: - { - LPDRAWITEMSTRUCT lpDrawItem = (LPDRAWITEMSTRUCT) lParam; - DrawText ( lpDrawItem->hDC, "SS_DRAWITEM test successful!", 28, &(lpDrawItem->rcItem), 0 ); - } - break; - - 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: mandatory - wc.hInstance = hInst; // owner of the class: mandatory - wc.lpszClassName = className; // mandatory - wc.hCursor = LoadCursor ( 0, (LPCTSTR)IDC_ARROW ); // optional - wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); // optional - wc.style = 0; - 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 - CW_USEDEFAULT, // x - CW_USEDEFAULT, // y - CW_USEDEFAULT, // width - CW_USEDEFAULT, // height - NULL, // hwndParent - NULL, // hMenu - hInst, // hInstance - 0 ); // lParam - - 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 [] = "Static Control Test"; - HWND hwnd; - MSG msg; - int status; - - hwnd = RegisterAndCreateWindow ( hInst, className, "Static Control Test" ); - - // Message loop - while ((status = GetMessage (& msg, 0, 0, 0)) != 0) - { - if (status == -1) - return -1; - DispatchMessage ( &msg ); - } - return msg.wParam; -} diff --git a/reactos/apps/tests/tests/make_install.bat b/reactos/apps/tests/tests/make_install.bat deleted file mode 100644 index 057e6c045ee..00000000000 --- a/reactos/apps/tests/tests/make_install.bat +++ /dev/null @@ -1,51 +0,0 @@ -echo off -REM -REM - This is kinda dirty, I might fix it up later. - SE -REM - -REM - Make System - -cd GetSysMetrics -make -cd .. -cd GetSystemInfo -make -cd .. -cd guitest -make -cd .. -cd hello -make -cd .. -cd hello2 -make -cd .. -cd Mutex -make -cd .. -cd new -make -cd .. -cd Parent_Child -make -cd .. -cd rolex -make -cd .. -cd volinfo -make -cd .. - -REM - installs - -mkdir C:\reactos\bin\tests -copy GetSystemInfo\GetSystemInfo.exe C:\reactos\bin\tests -copy guitest\guitest.exe C:\reactos\bin\tests -copy hello\hello.exe C:\reactos\bin\tests -copy hello2\hello2.exe C:\reactos\bin\tests -copy Mutex\fivemutex.exe C:\reactos\bin\tests -copy Mutex\rapidmutex.exe C:\reactos\bin\tests -copy Parent_Child\Parent_Child.exe C:\reactos\bin\tests -copy rolex\rolex.exe C:\reactos\bin\tests -copy volinfo\volinfo.exe C:\reactos\bin\tests - diff --git a/reactos/apps/tests/tests/readme.txt b/reactos/apps/tests/tests/readme.txt deleted file mode 100644 index 2da5f58e164..00000000000 --- a/reactos/apps/tests/tests/readme.txt +++ /dev/null @@ -1,31 +0,0 @@ -This is a collection of simple tests apps I have ported to the -ros build system from wine and other places. Most if not all -work great under Win9x,NT,2k and XP. I've fixed and renamed a few -of these because the old names didn't really describe them. - -If you feel like messing with this just type make_install and -everything will be installed to C:\reactos\bin\tests - -TESTS - -GetSystemInfo: Reads from kernel32.dll - -guitest: simple win32 gui test - -hello: another win32 hello window test - -hello2: yet another win32 hello window test - -Mutex: Mutex benchmarks from the wineserver kernel module - -new: example of create new window - -Parent_Child: example of child windows inside of parents - -rolex: a clock program worth $30,000 - -volinfo - This gets the volume info for all local and network drives -AVOID THIS ON 9X, it works but its very slow. - - - -