diff --git a/reactos/apps/tests/tests/GetSystemInfo/GetSystemInfo.c b/reactos/apps/tests/tests/GetSystemInfo/GetSystemInfo.c new file mode 100644 index 00000000000..c3cbf37046e --- /dev/null +++ b/reactos/apps/tests/tests/GetSystemInfo/GetSystemInfo.c @@ -0,0 +1,37 @@ +/* + * This example demonstrates dynamical loading of (internal) Win32 DLLS. + * I dont know why this was called hello5 in the wine tree - sedwards + */ +#include +#include + +int PASCAL WinMain (HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) +{ + SYSTEM_INFO si; + void CALLBACK (*fnGetSystemInfo)(LPSYSTEM_INFO si); + HMODULE kernel32; + + kernel32 = LoadLibrary("KERNEL32"); + if (kernel32<32) { + fprintf(stderr,"FATAL: could not load KERNEL32!\n"); + return 0; + } + fnGetSystemInfo = (void*)GetProcAddress(kernel32,"GetSystemInfo"); + if (!fnGetSystemInfo) { + fprintf(stderr,"FATAL: could not find GetSystemInfo!\n"); + return 0; + } + fnGetSystemInfo(&si); + fprintf(stderr,"QuerySystemInfo returns:\n"); + fprintf(stderr," wProcessorArchitecture: %d\n",si.u.s.wProcessorArchitecture); + fprintf(stderr," dwPageSize: %ld\n",si.dwPageSize); + fprintf(stderr," lpMinimumApplicationAddress: %p\n",si.lpMinimumApplicationAddress); + fprintf(stderr," lpMaximumApplicationAddress: %p\n",si.lpMaximumApplicationAddress); + fprintf(stderr," dwActiveProcessorMask: %ld\n",si.dwActiveProcessorMask); + fprintf(stderr," dwNumberOfProcessors: %ld\n",si.dwNumberOfProcessors); + fprintf(stderr," dwProcessorType: %ld\n",si.dwProcessorType); + fprintf(stderr," dwAllocationGranularity: %ld\n",si.dwAllocationGranularity); + fprintf(stderr," wProcessorLevel: %d\n",si.wProcessorLevel); + fprintf(stderr," wProcessorRevision: %d\n",si.wProcessorRevision); + return 0; +} diff --git a/reactos/apps/tests/tests/GetSystemInfo/Makefile b/reactos/apps/tests/tests/GetSystemInfo/Makefile new file mode 100644 index 00000000000..cb0c26ba631 --- /dev/null +++ b/reactos/apps/tests/tests/GetSystemInfo/Makefile @@ -0,0 +1,26 @@ +# +# +# +PATH_TO_TOP = ../../.. + +PROGS = GetSystemInfo + +OBJECTS = GetSystemInfo.o + +LIBS = +CFLAGS = + +all: $(PROGS:%=%.exe) + +.phony: all + +clean: + - $(RM) *.o *.coff *.exe *.sym + +.phony: clean + +GetSystemInfo.exe: $(OBJECTS) + $(CC) $(CFLAGS) $(OBJECTS) $(LIBS) -o GetSystemInfo.exe + $(NM) --numeric-sort GetSystemInfo.exe > GetSystemInfo.sym + +include ../../../rules.mak diff --git a/reactos/apps/tests/tests/Mutex/Makefile b/reactos/apps/tests/tests/Mutex/Makefile new file mode 100644 index 00000000000..02574fb294a --- /dev/null +++ b/reactos/apps/tests/tests/Mutex/Makefile @@ -0,0 +1,26 @@ +# 10-11-01 Steven Edwards +# Mutex Benchmarks from the Wineserver Linux Kernel Module +# + +PATH_TO_TOP = ../../.. + +PROGS = fivemutex rapidmutex + +all: $(PROGS:%=%.exe) + +.phony: all + +clean: + - $(RM) *.o *.exe *.sym + +.phony: clean + +fivemutex.exe: fivemutex.c + $(CC) fivemutex.c -lkernel32 -o fivemutex.exe + $(NM) --numeric-sort fivemutex.exe > fivemutex.sym + +rapidmutex.exe: rapidmutex.c + $(CC) rapidmutex.c -lkernel32 -o rapidmutex.exe + $(NM) --numeric-sort rapidmutex.exe > rapidmutex.sym + +include ../../../rules.mak diff --git a/reactos/apps/tests/tests/Mutex/fivemutex.c b/reactos/apps/tests/tests/Mutex/fivemutex.c new file mode 100644 index 00000000000..cde45b7a01f --- /dev/null +++ b/reactos/apps/tests/tests/Mutex/fivemutex.c @@ -0,0 +1,124 @@ +/* fivemutex.c: hungry philosophers problem + * + * (c) Copyright D.W.Howells 2000. + * All rights reserved + */ +#include +#include +#include + +#define ERR(X,Y) do { if (X) { perror(""Y""); return 1; } } while(0) +#define RUNLENGTH 4 + +int count[5]; + +const char *names[] = { + "five/1", "five/2", "five/3", "five/4", "five/5" +}; + +DWORD WINAPI child(LPVOID tparam) +{ + HANDLE left, right, first, second; + const char *lname, *rname; + int pid = (int) tparam; + int wt; + + lname = names[pid%5]; + rname = names[(pid+1)%5]; + + /* create a mutex */ + left = CreateMutex(NULL,0,lname); ERR(!left,"create left"); + right = CreateMutex(NULL,0,rname); ERR(!left,"create right"); + + printf("[%d] left: %p [%s]\n",pid,left,lname); + printf("[%d] right: %p [%s]\n",pid,right,rname); + + /* pick the forks up in numerical order, else risk starvation */ + if (pid%5 < (pid+1)%5) { + first = left; + second = right; + } + else { + first = right; + second = left; + } + + for (;;) { + /* grab the left mutex */ + wt = WaitForMultipleObjects(1,&first,0,INFINITE); + if (wt!=WAIT_OBJECT_0) + goto wait_failed; + + /* grab the right mutex */ + wt = WaitForMultipleObjects(1,&second,0,INFINITE); + if (wt!=WAIT_OBJECT_0) + goto wait_failed; + + /* got it */ + count[pid]++; + + /* pass the mutexes */ + ERR(!ReleaseMutex(left),"release left"); + ERR(!ReleaseMutex(right),"release right"); + continue; + + wait_failed: + switch (wt) { + case WAIT_OBJECT_0+1: + printf("[%d] obtained mutex __1__\n",pid); + exit(1); + case WAIT_ABANDONED_0: + case WAIT_ABANDONED_0+1: + printf("[%d] abandoned wait\n",pid); + continue; + case WAIT_TIMEOUT: + printf("[%d] wait timed out\n",pid); + exit(1); + default: + ERR(1,"WaitForMultipleObjects"); + } + + return 1; + } + + /* close the handles */ + ERR(!CloseHandle(left),"close left"); + ERR(!CloseHandle(right),"close right"); + + return 0; + +} + +int main() +{ + HANDLE hThread[5]; + DWORD tid; + int loop; + + for (loop=0; loop<5; loop++) { + + hThread[loop] = CreateThread(NULL, /* thread attributes */ + 0, /* stack size */ + child, /* start address */ + (void*)loop, /* parameter */ + 0, /* creation flags */ + &tid /* thread ID */ + ); + if (!hThread[loop]) + { + ERR(1,"CreateThread"); + } + } + + WaitForMultipleObjects(5,hThread,0,RUNLENGTH*1000); + + for (loop=0; loop<5; loop++) + TerminateThread(hThread[loop],0); + + for (loop=0; loop<5; loop++) + printf("[%d] ate %d times (%d times per second)\n", + loop,count[loop],count[loop]/RUNLENGTH + ); + + return 0; +} diff --git a/reactos/apps/tests/tests/Mutex/rapidmutex.c b/reactos/apps/tests/tests/Mutex/rapidmutex.c new file mode 100644 index 00000000000..57969966ff7 --- /dev/null +++ b/reactos/apps/tests/tests/Mutex/rapidmutex.c @@ -0,0 +1,89 @@ +/* rapidmutex.c: rapid mutex passing test client [Win32 threaded] + * + * (c) Copyright D.W.Howells 2000. + * All rights reserved + */ +#include +#include +#include + +#define ERR(X,Y) do { if (X) { perror(Y); return 1; } } while(0) +#define RUNLENGTH 4 + +int count[5]; + +DWORD WINAPI child(LPVOID tparam) +{ + HANDLE mymutex; + int pid = (int) tparam; + + /* create a mutex */ + mymutex = CreateMutex(NULL,0,"wibble"); + ERR(!mymutex,"create mutex"); + printf("[%d] Handle: %p\n",pid,mymutex); + + for (;;) { + /* grab the mutex */ + switch (WaitForMultipleObjects(1,&mymutex,0,INFINITE)) + { + case WAIT_OBJECT_0: + /* got it */ + count[pid]++; + + /* pass the mutex */ + ERR(!ReleaseMutex(mymutex),"release mutex"); + break; + + case WAIT_OBJECT_0+1: + printf("[%d] obtained mutex __1__\n",pid); + exit(0); + case WAIT_ABANDONED_0: + case WAIT_ABANDONED_0+1: + printf("[%d] abandoned wait\n",pid); + exit(0); + case WAIT_TIMEOUT: + printf("[%d] wait timed out\n",pid); + exit(0); + default: + ERR(1,"WaitForMultipleObjects"); + } + } + + return 0; +} + +int main() +{ + HANDLE hThread[5]; + DWORD tid; + int loop; + + for (loop=0; loop<5; loop++) { + + hThread[loop] = + CreateThread(NULL, /* thread attributes */ + 0, /* stack size */ + child, /* start address */ + (void*)loop, /* parameter */ + 0, /* creation flags */ + &tid /* thread ID */ + ); + if (!hThread[loop]) + { + ERR(1,"CreateThread"); + } + } + + WaitForMultipleObjects(5,hThread,0,RUNLENGTH*1000); + + for (loop=0; loop<5; loop++) + TerminateThread(hThread[loop],0); + + for (loop=0; loop<5; loop++) + printf("[%d] obtained the mutex %d times" + " (%d times per second)\n", + loop,count[loop],count[loop]/RUNLENGTH + ); + + return 0; +} diff --git a/reactos/apps/tests/tests/Parent_Child/Makefile b/reactos/apps/tests/tests/Parent_Child/Makefile new file mode 100644 index 00000000000..620027350eb --- /dev/null +++ b/reactos/apps/tests/tests/Parent_Child/Makefile @@ -0,0 +1,26 @@ +# +# +# +PATH_TO_TOP = ../../.. + +PROGS = Parent_Child + +OBJECTS = Parent_Child.o + +LIBS = ../../../dk/w32/lib/gdi32.a +CFLAGS = + +all: $(PROGS:%=%.exe) + +.phony: all + +clean: + - $(RM) *.o *.coff *.exe *.sym + +.phony: clean + +Parent_Child.exe: $(OBJECTS) + $(CC) $(CFLAGS) -Wl,--subsystem,windows $(OBJECTS) $(LIBS) -o Parent_Child.exe + $(NM) --numeric-sort Parent_Child.exe > Parent_Child.sym + +include ../../../rules.mak diff --git a/reactos/apps/tests/tests/Parent_Child/Parent_Child.c b/reactos/apps/tests/tests/Parent_Child/Parent_Child.c new file mode 100644 index 00000000000..6b9df21c6d4 --- /dev/null +++ b/reactos/apps/tests/tests/Parent_Child/Parent_Child.c @@ -0,0 +1,151 @@ +#include +#include +/* Win32 counterpart for CalcChildScroll16 is not implemented */ +/* even in MS Visual C++ */ +// #include "windef.h" +// #include "wingdi.h" +/*#include */ + +void Write (HDC dc, int x, int y, char *s) +{ + SetBkMode(dc, TRANSPARENT); + TextOut (dc, x, y, s, strlen (s)); +} + +LRESULT CALLBACK WndProc (HWND wnd, UINT msg, WPARAM w, LPARAM l) +{ + static short xChar, yChar; + static RECT rectHola; + static char* strHola = "Hola"; + HDC dc; + PAINTSTRUCT ps; + TEXTMETRIC tm; + + switch (msg){ + case WM_CREATE: + dc = GetDC (wnd); + GetTextMetrics (dc, &tm); + xChar = tm.tmAveCharWidth; + yChar = tm.tmHeight; + GetTextExtentPoint32( dc, strHola, strlen(strHola), ((LPSIZE)&rectHola) + 1 ); + OffsetRect( &rectHola, xChar, yChar ); + ReleaseDC (wnd, dc); + break; + + case WM_HSCROLL: + case WM_VSCROLL: + InvalidateRect(wnd, &rectHola, TRUE ); +// ScrollChildren(wnd, msg, w, l); + return 0; + + case WM_PAINT: + dc = BeginPaint (wnd, &ps); + Write (dc, xChar, yChar, strHola); + EndPaint (wnd, &ps); + break; + + case WM_DESTROY: + PostQuitMessage (0); + break; + + default: + return DefWindowProc (wnd, msg, w, l); + } + return 0l; +} + +LRESULT CALLBACK WndProc2 (HWND wnd, UINT msg, WPARAM w, LPARAM l) +{ + static short xChar, yChar; + static RECT rectInfo; + char buf[128]; + HDC dc; + PAINTSTRUCT ps; + TEXTMETRIC tm; + + switch (msg){ + case WM_CREATE: + dc = GetDC (wnd); + GetTextMetrics (dc, &tm); + xChar = tm.tmAveCharWidth; + yChar = tm.tmHeight; + ReleaseDC (wnd, dc); + break; + + case WM_PAINT: + dc = BeginPaint (wnd, &ps); + sprintf(buf,"ps.rcPaint = {left = %d, top = %d, right = %d, bottom = %d}", + ps.rcPaint.left,ps.rcPaint.top,ps.rcPaint.right,ps.rcPaint.bottom); + rectInfo.left = rectInfo.top = 0; + GetTextExtentPoint32 (dc, buf, strlen(buf), ((LPSIZE)&rectInfo) + 1 ); + OffsetRect (&rectInfo, xChar, yChar ); + Write (dc, xChar, yChar, buf); + EndPaint (wnd, &ps); + break; + + case WM_MOVE: + case WM_SIZE: + InvalidateRect( wnd, &rectInfo, TRUE ); + /*CalcChildScroll16( (UINT16)GetParent(wnd), SB_BOTH );*/ + break; + + case WM_DESTROY: + PostQuitMessage (0); + break; + + default: + return DefWindowProc (wnd, msg, w, l); + } + return 0l; +} + +int PASCAL WinMain (HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) +{ + HWND wnd,wnd2; + MSG msg; + WNDCLASS class; + char className[] = "class"; /* To make sure className >= 0x10000 */ + char class2Name[] = "class2"; + char winName[] = "Test app"; + + if (!prev){ + class.style = CS_HREDRAW | CS_VREDRAW; + class.lpfnWndProc = WndProc; + class.cbClsExtra = 0; + class.cbWndExtra = 0; + class.hInstance = inst; + class.hIcon = LoadIcon (0, IDI_APPLICATION); + class.hCursor = LoadCursor (0, IDC_ARROW); + class.hbrBackground = GetStockObject (WHITE_BRUSH); + class.lpszMenuName = NULL; + class.lpszClassName = className; + if (!RegisterClass (&class)) + return FALSE; + } + + wnd = CreateWindow (className, winName, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL, + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0, + 0, inst, 0); + + if (!prev){ + class.lpfnWndProc = WndProc2; + class.lpszClassName = class2Name; + class.hbrBackground = GetStockObject(GRAY_BRUSH); + if (!RegisterClass (&class)) + return FALSE; + } + + wnd2= CreateWindow (class2Name,"Child window", WS_CAPTION | WS_CHILD | WS_THICKFRAME, + 50, 50, 350, 100, wnd, 0, inst, 0); + + ShowWindow (wnd, show); + UpdateWindow (wnd); + ShowWindow (wnd2, show); + UpdateWindow (wnd2); + + while (GetMessage (&msg, 0, 0, 0)){ + TranslateMessage (&msg); + DispatchMessage (&msg); + } + return 0; +} diff --git a/reactos/apps/tests/tests/guitest/Makefile b/reactos/apps/tests/tests/guitest/Makefile new file mode 100644 index 00000000000..875f71068bd --- /dev/null +++ b/reactos/apps/tests/tests/guitest/Makefile @@ -0,0 +1,36 @@ +# +# +# +PATH_TO_TOP = ../../.. + +PROGS = guitest + +OBJECTS = guitest.o + +LIBS = ../../../dk/w32/lib/gdi32.a +CFLAGS = + +all: $(PROGS:%=%.exe) + +.phony: all + +clean: + - $(RM) *.o *.exe *.sym + +.phony: clean + +install: $(PROGS:%=$(FLOPPY_DIR)/apps/tests/%.exe) + +$(PROGS:%=$(FLOPPY_DIR)/apps/tests/%.exe): $(FLOPPY_DIR)/apps/tests/%.exe: %.exe + $(CP) $*.exe $(FLOPPY_DIR)/apps/$*.exe + +dist: $(PROGS:%=../../$(DIST_DIR)/apps/tests/%.exe) + +$(PROGS:%=../../$(DIST_DIR)/apps/tests/%.exe): ../../$(DIST_DIR)/apps/tests/%.exe: %.exe + $(CP) $*.exe ../../$(DIST_DIR)/apps/$*.exe + +guitest.exe: $(OBJECTS) + $(CC) $(CFLAGS) -Wl,--subsystem,windows $(OBJECTS) $(LIBS) -o guitest.exe + $(NM) --numeric-sort guitest.exe > guitest.sym + +include ../../../rules.mak diff --git a/reactos/apps/tests/tests/guitest/guitest.c b/reactos/apps/tests/tests/guitest/guitest.c new file mode 100644 index 00000000000..73c742a8fa2 --- /dev/null +++ b/reactos/apps/tests/tests/guitest/guitest.c @@ -0,0 +1,751 @@ +/* Windows GUI Behaviour Tester */ +/* by Ove Kåven */ + +#include +#include +#include +#include + +#include "guitest.rc" + +/* checks to include */ +#define LOGGING /* can be undefined under Wine and use -debugmsg +message instead */ +#define MAIN_STYLE WS_OVERLAPPEDWINDOW|WS_HSCROLL +#define MAIN_EXSTYLE 0 +#undef TEST_DESTROY_MAIN +#define SHOW_SUB +#undef TEST_DIALOG +#define RESIZE_DIALOG +#undef TEST_SUBDIALOG +#undef TEST_COMMCTL + +/************************/ +/*** GLOBAL VARIABLES ***/ +/************************/ + +HINSTANCE hInst; +DWORD StartTime; +HWND hListBox,hMainWnd,hSubWnd; +HWND hButton[4]={0,0,0,0}; +HWND hDialog=0,hGroup=0,hSubDlg=0; +WNDPROC wndButton[4],wndDialog,wndGroup,wndSubDlg; +BOOL Clicked=0,Ready=0; +int State=0,Rec=0; +#define STATE_CREATE 0 +#define STATE_DESTROY 1 +#define STATE_SHOW 2 +#define STATE_UPDATE 3 +#define STATE_DIALOG 4 +#define STATE_TEST 5 +#define STATE_DIRECT 6 +#define STATE_DISPATCH 7 +#define STATE_RECURS 8 +char*StateName[]={ + "Creat", + "Destr", + "Show ", + "Updat", + "Dialg", + "Test ", + "Call ", + "Disp ", + "RCall" +}; + +static char wclassname[] = "GUITestClass"; +static char wcclassname[] = "GUITestChildClass"; +static char winname[] = "GUITest"; + +/**************************/ +/*** LOGGING FACILITIES ***/ +/**************************/ + +struct MSGNAMES { + int msg; + char*name; +} MsgNames[]={ +#define MSG(x) {x,#x}, +#define MSG2(x,y) {y,#x}, +#define ENDMSG {0} + +/* we get these in CreateWindow */ +MSG(WM_GETMINMAXINFO) +MSG(WM_NCCREATE) +MSG(WM_NCCALCSIZE) +MSG(WM_CREATE) +MSG(WM_PARENTNOTIFY) + +/* we get these in ShowWindow */ +MSG(WM_SHOWWINDOW) +MSG(WM_WINDOWPOSCHANGING) +MSG(WM_QUERYNEWPALETTE) +MSG(WM_ACTIVATEAPP) +MSG(WM_NCACTIVATE) +MSG(WM_GETTEXT) +MSG(WM_ACTIVATE) +MSG(WM_SETFOCUS) +MSG(WM_NCPAINT) +MSG(WM_ERASEBKGND) +MSG(WM_WINDOWPOSCHANGED) +MSG(WM_SIZE) +MSG(WM_MOVE) + +/* we get these in DestroyWindow */ +MSG(WM_KILLFOCUS) +MSG(WM_DESTROY) +MSG(WM_NCDESTROY) + +/* we get these directly sent */ +MSG(WM_NCHITTEST) +MSG(WM_SETCURSOR) +MSG(WM_MOUSEACTIVATE) +MSG(WM_CHILDACTIVATE) +MSG(WM_COMMAND) +MSG(WM_SYSCOMMAND) + +/* posted events */ +MSG(WM_MOUSEMOVE) +MSG(WM_NCMOUSEMOVE) +MSG(WM_PAINT) +MSG(WM_LBUTTONDOWN) +MSG(WM_LBUTTONUP) +MSG(WM_LBUTTONDBLCLK) +MSG(WM_NCLBUTTONDOWN) +MSG(WM_NCLBUTTONUP) +MSG(WM_NCLBUTTONDBLCLK) + +MSG(WM_KEYDOWN) +MSG(WM_KEYUP) +MSG(WM_CHAR) + +#ifdef WIN32 +MSG(WM_CTLCOLORBTN) +MSG(WM_CTLCOLORDLG) +MSG(WM_CTLCOLORSTATIC) +#else +MSG(WM_CTLCOLOR) +#endif + +/* moving and sizing */ +MSG2(WM_ENTERSIZEMOVE,0x0231) +MSG2(WM_EXITSIZEMOVE,0x0232) +#ifdef WIN32 +MSG(WM_SIZING) +#endif + +/* menus/dialog boxes */ +MSG(WM_CANCELMODE) +MSG(WM_ENABLE) +MSG(WM_SETFONT) +MSG(WM_INITDIALOG) +MSG(WM_GETDLGCODE) +MSG(WM_ENTERIDLE) + +/* scroll bars */ +MSG(WM_HSCROLL) +MSG(WM_VSCROLL) + +/* getting these from Wine but not from Windows */ +MSG2(WM_SETVISIBLE,0x0009) /* unheard of in BC++ 4.52 */ +#ifdef WIN32 +MSG(WM_CAPTURECHANGED) +#endif + +ENDMSG}; + +struct MSGNAMES ButMsgs[]={ +MSG(BM_SETSTATE) +MSG(BM_SETSTYLE) + +ENDMSG}; + +char*MsgName(UINT msg,HWND hWnd) +{ + int i; + static char buffer[64],wclass[64]; + GetClassName(hWnd,wclass,sizeof(wclass)); + +#define MSGSEARCH(msgs) { \ + for (i=0; msgs[i].name&&msgs[i].msg!=msg; i++); \ + if (msgs[i].name) return msgs[i].name; \ + } + + if (!stricmp(wclass,"Button")) MSGSEARCH(ButMsgs); + MSGSEARCH(MsgNames); + /* WM_USER */ + if (msg>=WM_USER) { + sprintf(buffer,"WM_USER+%04x{%s}",msg-WM_USER,wclass); + return buffer; + } + /* message not found */ + sprintf(buffer,"%04x{%s}",msg,wclass); + return buffer; +} + +char*WndName(HWND hWnd,int state) +{ + static char buffer[16]; + if (!hWnd) return "0000"; + if (hWnd==hMainWnd || (state==STATE_CREATE && !hMainWnd)) return "main"; + if (hWnd==hSubWnd || (state==STATE_CREATE && !hSubWnd)) return "chld"; + if (hWnd==hDialog || (state==STATE_DIALOG && !hDialog)) return "tdlg"; + if (hWnd==hGroup) return "tgrp"; + if (hWnd==hButton[0]) return "but1"; + if (hWnd==hButton[1]) return "but2"; + if (hWnd==hButton[2]) return "but3"; + if (hWnd==hButton[3]) return "but4"; + if (hWnd==hSubDlg || (state==STATE_CREATE && !hSubDlg)) return "sdlg"; + if (hDialog) { + int id=GetDlgCtrlID(hWnd); + if (id) { + sprintf(buffer,"dlgitem(%d)",id); + return buffer; + } + } + sprintf(buffer,"%04x",hWnd); + return buffer; +} + +void Log(const char*fmt) +{ +#ifdef LOGGING + if (!Clicked) SendMessage(hListBox,LB_ADDSTRING,0,(LPARAM)fmt); +#endif +} + +void Logf(const char*fmt,...) +{ + va_list par; + static char buffer[256]; + + va_start(par,fmt); + vsprintf(buffer,fmt,par); + va_end(par); + Log(buffer); +} + +void LogChildOrder(HWND hWnd) +{ + HWND hWndChild = GetWindow(hWnd,GW_CHILD); + static char buffer[256]; + + strcpy(buffer,"child list:"); + while (hWndChild) { + strcat(strcat(buffer," "),WndName(hWndChild,State)); + hWndChild=GetWindow(hWndChild,GW_HWNDNEXT); + } + Log(buffer); +} + +void LogMessage(int state,HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam,char*name) +{ + static char buffer[256]; + DWORD tick=GetTickCount()-StartTime; + char*msgname=MsgName(msg,hWnd); + if (!name) name=WndName(hWnd,state); + switch (msg) { + case WM_SETFOCUS: + case WM_KILLFOCUS: + case WM_SETCURSOR: + Logf("%04d[%s(%d):%s]%s(%s,%08x)",tick,StateName[state],Rec, + name,msgname,WndName((HWND)wParam,State),lParam); + break; +#ifdef WIN32 + case WM_ENTERIDLE: + case WM_CTLCOLORBTN: + case WM_CTLCOLORDLG: + Logf("%04d[%s(%d):%s]%s(%08x,%s)",tick,StateName[state],Rec, + name,msgname,wParam,WndName((HWND)lParam,State)); + break; +#else + case WM_ENTERIDLE: + case WM_CTLCOLOR: + Logf("%04d[%s(%d):%s]%s(%08x,%04x:%s)",tick,StateName[state],Rec, + name,msgname,wParam,HIWORD(lParam),WndName((HWND)LOWORD(lParam),State)); + break; +#endif + case WM_WINDOWPOSCHANGING: + case WM_WINDOWPOSCHANGED: + { + WINDOWPOS*pos=(WINDOWPOS*)lParam; +#ifdef WIN32 + Logf("%04d[%s(%d):%s]%s(%08x,%p)",tick,StateName[state],Rec, + name,msgname,wParam,pos); +#else + Logf("%04d[%s(%d):%s]%s(%04x,%p)",tick,StateName[state],Rec, + name,msgname,wParam,pos); +#endif + strcpy(buffer,"FLAGS:"); + if (pos->flags&SWP_DRAWFRAME) strcat(buffer," DRAWFRAME"); + if (pos->flags&SWP_HIDEWINDOW) strcat(buffer," HIDEWINDOW"); + if (pos->flags&SWP_NOACTIVATE) strcat(buffer," NOACTIVATE"); + if (pos->flags&SWP_NOCOPYBITS) strcat(buffer," NOCOPYBITS"); + if (pos->flags&SWP_NOMOVE) strcat(buffer," NOMOVE"); + if (pos->flags&SWP_NOOWNERZORDER) strcat(buffer," NOOWNERZORDER"); + if (pos->flags&SWP_NOSIZE) strcat(buffer," NOSIZE"); + if (pos->flags&SWP_NOREDRAW) strcat(buffer," NOREDRAW"); + if (pos->flags&SWP_NOZORDER) strcat(buffer," NOZORDER"); + if (pos->flags&SWP_SHOWWINDOW) strcat(buffer," SHOWWINDOW"); + Log(buffer); + } + break; + case WM_SYSCOMMAND: + { + char*cmd=NULL; + switch (wParam&0xFFF0) { +#define CASE(x) case SC_##x: cmd=#x; break; + CASE(CLOSE) + CASE(DEFAULT) + CASE(HOTKEY) + CASE(HSCROLL) + CASE(KEYMENU) + CASE(MAXIMIZE) + CASE(MINIMIZE) + CASE(MOUSEMENU) + CASE(MOVE) + CASE(NEXTWINDOW) + CASE(PREVWINDOW) + CASE(RESTORE) + CASE(SCREENSAVE) + CASE(SIZE) + CASE(TASKLIST) + CASE(VSCROLL) +#undef CASE + } + if (cmd) { + Logf("%04d[%s(%d):%s]%s(%s+%x,%08x)",tick,StateName[state],Rec, + name,msgname,cmd,wParam&0xF,lParam); + } else goto GENERIC_MSG; + } + break; + case WM_HSCROLL: + case WM_VSCROLL: + { + char*cmd=NULL; + switch (LOWORD(wParam)) { +#define CASE(x) case SB_##x: cmd=#x; break; +#define CASE2(h,v) case SB_##h: if (msg==WM_HSCROLL) cmd=#h; else cmd=#v; break; + CASE(BOTTOM) + CASE(ENDSCROLL) + CASE2(LINELEFT,LINEUP) + CASE2(LINERIGHT,LINEDOWN) + CASE2(PAGELEFT,PAGEUP) + CASE2(PAGERIGHT,PAGEDOWN) + CASE(THUMBPOSITION) + CASE(THUMBTRACK) + CASE(TOP) +#undef CASE + } + if (cmd) { +#ifdef WIN32 + Logf("%04d[%s(%d):%s]%s(%s,%04x,%s)",tick,StateName[state],Rec, + name,msgname,cmd,HIWORD(wParam),WndName((HWND)lParam,State)); +#else + Logf("%04d[%s(%d):%s]%s(%04x,%04x,%s)",tick,StateName[state],Rec, + name,msgname,cmd,LOWORD(lParam),WndName((HWND)HIWORD(lParam),State)); +#endif + } else goto GENERIC_MSG; + } + break; + default: +GENERIC_MSG: +#ifdef WIN32 + Logf("%04d[%s(%d):%s]%s(%08x,%08x)",tick,StateName[state],Rec, + name,msgname,wParam,lParam); +#else + Logf("%04d[%s(%d):%s]%s(%04x,%08x)",tick,StateName[state],Rec, + name,msgname,wParam,lParam); +#endif + } +} + +/***************************/ +/*** GRAPHICS FACILITIES ***/ +/***************************/ + +void Paint(HWND hWnd) +{ + HDC dc; + PAINTSTRUCT ps; + dc=BeginPaint(hWnd,&ps); + EndPaint(hWnd,&ps); +} + +void FillPattern(HWND hWnd,HDC pdc) +{ + HDC dc=pdc?pdc:GetDC(hWnd); + HBRUSH oldbrush; + RECT rect; + if (!dc) { + Logf("failed to acquire DC for window %s",WndName(hWnd,State)); + return; + } else { + Logf("acquired DC for %s window %s, painting", + IsWindowVisible(hWnd)?"visible":"invisible",WndName(hWnd,State)); + } + GetClientRect(hWnd,&rect); + oldbrush=SelectObject(dc,GetStockObject(LTGRAY_BRUSH)); + PatBlt(dc,0,0,rect.right,rect.bottom,PATCOPY); + SelectObject(dc,oldbrush); + if (!pdc) ReleaseDC(hWnd,dc); +} + +void PaintPattern(HWND hWnd) +{ + HDC dc; + PAINTSTRUCT ps; + dc=BeginPaint(hWnd,&ps); + FillPattern(hWnd,dc); + EndPaint(hWnd,&ps); +} + +/*************************/ +/*** WINDOW PROCEDURES ***/ +/*************************/ + +/* MAIN WINDOW */ +LRESULT FAR CALLBACK _export MainWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + LRESULT lResult=0; + RECT rect; + int OldState=State; + + State=STATE_RECURS; Rec++; + if (!Clicked) LogMessage(OldState,hWnd,msg,wParam,lParam,NULL); + switch (msg) { + case WM_NCHITTEST: + lResult=DefWindowProc(hWnd,msg,wParam,lParam); + break; + case WM_LBUTTONDOWN: + case WM_CHAR: + if (!Clicked) { + SetParent(hListBox,hWnd); + GetClientRect(hWnd,&rect); + MoveWindow(hListBox,0,0,rect.right,rect.bottom,TRUE); + ShowWindow(hListBox,SW_SHOW); + SetFocus(hListBox); + Clicked=TRUE; + } + break; + case WM_SIZE: + GetClientRect(hWnd,&rect); + if (Clicked) { + MoveWindow(hListBox,0,0,rect.right,rect.bottom,TRUE); + } + MoveWindow(hSubWnd,0,rect.bottom/2,rect.right,rect.bottom-(rect.bottom/2),TRUE); + break; + case WM_PAINT: + Paint(hWnd); + break; + case WM_DESTROY: + PostQuitMessage(0); + break; + default: + lResult=DefWindowProc(hWnd,msg,wParam,lParam); + } + State=OldState; Rec--; + return lResult; +} + +/* CHILD WINDOW */ +LRESULT FAR CALLBACK _export SubWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + LRESULT lResult=0; + RECT rect; + int OldState=State; + + State=STATE_RECURS; Rec++; + if (!Clicked) LogMessage(OldState,hWnd,msg,wParam,lParam,NULL); + switch (msg) { + case WM_PAINT: + Paint(hWnd); + break; + default: + lResult=DefWindowProc(hWnd,msg,wParam,lParam); + } + State=OldState; Rec--; + return lResult; +} + +BOOL FAR CALLBACK _export SubDialogProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam); + +/* SUBCLASSED CONTROLS */ +LRESULT FAR CALLBACK _export SubClassWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + LRESULT lResult=0; + RECT rect; + int OldState=State; + int But=-1; + + if (hWnd==hButton[0]) But=0; else + if (hWnd==hButton[1]) But=1; else + if (hWnd==hButton[2]) But=2; else + if (hWnd==hButton[3]) But=3; + + State=STATE_RECURS; Rec++; + if (!Clicked) { + LogMessage(OldState,hWnd,msg,wParam,lParam,NULL); + if (But!=-1) { + lResult=CallWindowProc((FARPROC)wndButton[But],hWnd,msg,wParam,lParam); + if (msg==WM_LBUTTONUP) { + LogChildOrder(GetParent(hWnd)); + } + } + else if (hWnd==hDialog) { + lResult=CallWindowProc((FARPROC)wndDialog,hWnd,msg,wParam,lParam); + } + else if (hWnd==hSubDlg) { + lResult=CallWindowProc((FARPROC)wndSubDlg,hWnd,msg,wParam,lParam); + } + else if (hWnd==hGroup) { + lResult=CallWindowProc((FARPROC)wndGroup,hWnd,msg,wParam,lParam); + if (msg==WM_SETFOCUS) { + /* create subdialog */ + if (hSubDlg) { +#if 0 + SetRect(&rect,0,0,1,1); + InvalidateRect(hWnd,&rect,FALSE); +#endif + } else { +#ifdef TEST_SUBDIALOG + State=STATE_CREATE; + hSubDlg=CreateDialog(hInst,MAKEINTRESOURCE(2),hWnd,(FARPROC)SubDialogProc); + State=STATE_RECURS; +#else +#ifdef RESIZE_DIALOG + GetWindowRect(GetParent(hWnd),&rect); + rect.right++; + SetWindowPos(GetParent(hWnd),0,0,0, + rect.right-rect.left,rect.bottom-rect.top, + SWP_NOMOVE|SWP_NOZORDER); +#endif +#endif + } + } + } + } + State=OldState; Rec--; + return lResult; +} + +/* MAIN DIALOG PROCEDURE */ +BOOL FAR CALLBACK _export TestDialogProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + BOOL bResult=0; + RECT rect; + int OldState=State; + int But=-1; + + State=STATE_RECURS; Rec++; + if (!Clicked) LogMessage(OldState,hWndDlg,msg,wParam,lParam,"dlgp"); + switch (msg) { + case WM_INITDIALOG: + hDialog = hWndDlg; + /* subclass dialog window proc */ + wndDialog = (WNDPROC)SetWindowLong(hDialog,GWL_WNDPROC,(LONG)SubClassWindowProc); + Logf("dialog visible=%s",IsWindowVisible(hWndDlg)?"TRUE":"FALSE"); + /* subclass OK button */ + hButton[3] = GetDlgItem(hWndDlg,IDOK); + wndButton[3] = (WNDPROC)SetWindowLong(hButton[3],GWL_WNDPROC,(LONG)SubClassWindowProc); + /* subclass group box */ + hGroup = GetDlgItem(hWndDlg,IDC_GROUPBOX1); + wndGroup = (WNDPROC)SetWindowLong(hGroup,GWL_WNDPROC,(LONG)SubClassWindowProc); + +#ifdef RESIZE_DIALOG + GetWindowRect(hWndDlg,&rect); + rect.right--; + SetWindowPos(hWndDlg,0,0,0, + rect.right-rect.left,rect.bottom-rect.top, + SWP_NOMOVE|SWP_NOZORDER); +// ShowWindow(GetDlgItem(hWndDlg,IDCANCEL),SW_HIDE); +#endif + + bResult=TRUE; /* we don't do SetFocus */ + break; + case WM_PAINT: + PaintPattern(hWndDlg); + bResult=TRUE; + break; + case WM_COMMAND: + EndDialog(hWndDlg,LOWORD(wParam)); + bResult=TRUE; + break; + case WM_CLOSE: + EndDialog(hWndDlg,IDCANCEL); + bResult=TRUE; + break; + case WM_NCDESTROY: + hDialog = 0; + break; + } + State=OldState; Rec--; + return bResult; +} + +/* SUBDIALOG PROCEDURE */ +BOOL FAR CALLBACK _export SubDialogProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + BOOL bResult=0; + RECT rect; + int OldState=State; + int But=-1; + + State=STATE_RECURS; Rec++; + if (!Clicked) LogMessage(OldState,hWndDlg,msg,wParam,lParam,NULL); + switch (msg) { + case WM_INITDIALOG: + hSubDlg = hWndDlg; + /* subclass dialog window proc */ + wndSubDlg = (WNDPROC)SetWindowLong(hDialog,GWL_WNDPROC,(LONG)SubClassWindowProc); + + bResult=TRUE; /* we don't do SetFocus */ + break; + case WM_NCDESTROY: + hSubDlg = 0; + break; + } + State=OldState; Rec--; + return bResult; +} + +/********************/ +/*** MAIN PROGRAM ***/ +/********************/ + +BOOL AppInit(void) +{ + WNDCLASS wclass; + + wclass.style = CS_HREDRAW|CS_VREDRAW; + wclass.lpfnWndProc = MainWindowProc; + wclass.cbClsExtra = 0; + wclass.cbWndExtra = 0; + wclass.hInstance = hInst; + wclass.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(1)); + wclass.hCursor = LoadCursor(0,IDC_ARROW); + wclass.hbrBackground = GetStockObject(WHITE_BRUSH); + wclass.lpszMenuName = NULL; + wclass.lpszClassName = wclassname; + if (!RegisterClass(&wclass)) return FALSE; + wclass.lpfnWndProc = SubWindowProc; + wclass.lpszClassName = wcclassname; + if (!RegisterClass(&wclass)) return FALSE; + return TRUE; +} + +int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpszCmdLine, int nCmdShow) +{ + MSG msg; + RECT rect; + + hInst = hInstance; + if (!hPrevInstance) + if (!AppInit()) + return 0; + + StartTime=GetTickCount(); + hListBox = CreateWindow("LISTBOX","Messages",WS_BORDER|WS_VSCROLL|WS_CHILD| + LBS_HASSTRINGS|LBS_NOTIFY|LBS_WANTKEYBOARDINPUT, + 0,0,0,0,GetDesktopWindow(),0,hInst,0); + if (!hListBox) { + MessageBox(0,"Could not create list box","Error",MB_OK); + } + + State=STATE_CREATE; + hMainWnd = CreateWindowEx(MAIN_EXSTYLE,wclassname,winname,MAIN_STYLE, + CW_USEDEFAULT,0,400,300,0,0,hInst,0); + if (!hMainWnd) return 0; + State=STATE_SHOW; + ShowWindow(hMainWnd,nCmdShow); +#ifdef TEST_DESTROY_MAIN + State=STATE_DESTROY; + DestroyWindow(hMainWnd); + State=STATE_DIRECT; + while (GetMessage(&msg,0,0,0)) { + TranslateMessage(&msg); + State=STATE_DISPATCH; + DispatchMessage(&msg); + State=STATE_DIRECT; + } + State=STATE_CREATE; + hMainWnd = CreateWindowEx(MAIN_EXSTYLE,wclassname,winname,MAIN_STYLE, + CW_USEDEFAULT,0,400,300,0,0,hInst,0); + if (!hMainWnd) return 0; + State=STATE_SHOW; + ShowWindow(hMainWnd,nCmdShow); +#endif +/* update, so no WM_PAINTs are pending */ + State=STATE_UPDATE; +// UpdateWindow(hMainWnd); + Ready=TRUE; +/* fill client area with a pattern */ + FillPattern(hMainWnd,0); +/* create subwindow */ + State=STATE_CREATE; + GetClientRect(hMainWnd,&rect); + hSubWnd = CreateWindow(wcclassname,winname,WS_CHILD|WS_BORDER|WS_CLIPSIBLINGS, + 0,rect.bottom/2,rect.right,rect.bottom-(rect.bottom/2),hMainWnd,0,hInst,0); + if (!hSubWnd) return 0; +/* create buttons */ + hButton[0] = CreateWindow("BUTTON","1",WS_CHILD|WS_CLIPSIBLINGS|WS_VISIBLE, + 8,8,48,20,hMainWnd,0,hInst,0); + hButton[1] = CreateWindow("BUTTON","2",WS_CHILD|WS_CLIPSIBLINGS|WS_VISIBLE, + 32,12,48,20,hMainWnd,0,hInst,0); + hButton[2] = CreateWindow("BUTTON","3",WS_CHILD|WS_CLIPSIBLINGS|WS_VISIBLE, + 56,16,48,20,hMainWnd,0,hInst,0); +/* subclass them */ + wndButton[0] = (WNDPROC)SetWindowLong(hButton[0],GWL_WNDPROC,(LONG)SubClassWindowProc); + wndButton[1] = (WNDPROC)SetWindowLong(hButton[1],GWL_WNDPROC,(LONG)SubClassWindowProc); + wndButton[2] = (WNDPROC)SetWindowLong(hButton[2],GWL_WNDPROC,(LONG)SubClassWindowProc); +/* show them */ + State=STATE_UPDATE; + UpdateWindow(hButton[0]); + LogChildOrder(hMainWnd); + Logf("but1 visible=%d",IsWindowVisible(hButton[0])); + +/* now reparent the button to our (invisible) subwindow */ + State=STATE_TEST; + /* in different order, seeing who gets topmost */ + SetParent(hButton[0],hSubWnd); + SetParent(hButton[2],hSubWnd); + SetParent(hButton[1],hSubWnd); + LogChildOrder(hSubWnd); +/* the button should now be invisible */ + Logf("but1 visible=%d",IsWindowVisible(hButton[0])); +/* see if we can draw on them */ + FillPattern(hButton[0],0); + +#ifdef SHOW_SUB + State=STATE_SHOW; + ShowWindow(hSubWnd,SW_SHOWNORMAL); + State=STATE_UPDATE; + UpdateWindow(hSubWnd); + FillPattern(hSubWnd,0); +// InvalidateRect(hMainWnd,NULL,TRUE); + Logf("but1 visible=%d",IsWindowVisible(hButton[0])); +#endif + +#ifdef TEST_DIALOG + State=STATE_DIALOG; + DialogBox(hInst,MAKEINTRESOURCE(1),hMainWnd,(FARPROC)TestDialogProc); +#endif +#ifdef TEST_COMMCTL + { + DWORD arr[16]; + CHOOSECOLOR cc={sizeof(cc),0,hInst,0,arr,0}; + ChooseColor(&cc); + } +#endif + + State=STATE_DIRECT; + while (GetMessage(&msg,0,0,0)) { + TranslateMessage(&msg); + State=STATE_DISPATCH; + DispatchMessage(&msg); + State=STATE_DIRECT; + } + return 0; +} + + diff --git a/reactos/apps/tests/tests/guitest/guitest.rc b/reactos/apps/tests/tests/guitest/guitest.rc new file mode 100644 index 00000000000..a151c74b0d3 --- /dev/null +++ b/reactos/apps/tests/tests/guitest/guitest.rc @@ -0,0 +1,17 @@ +/**************************************************************************** + + +guitest.rh + +produced by Borland Resource Workshop + + +*****************************************************************************/ + +#define IDC_CHECKBOX1 104 +#define IDC_CHECKBOX2 105 +#define IDC_CHECKBOX3 106 +#define DIALOG_2 2 +#define IDC_GROUPBOX1 10 +#define DIALOG_1 1 +#define ICON_1 1 diff --git a/reactos/apps/tests/tests/hello/Makefile b/reactos/apps/tests/tests/hello/Makefile new file mode 100644 index 00000000000..fd2ed90b2d0 --- /dev/null +++ b/reactos/apps/tests/tests/hello/Makefile @@ -0,0 +1,26 @@ +# +# +# +PATH_TO_TOP = ../../.. + +PROGS = hello + +OBJECTS = hello.o + +LIBS = ../../../dk/w32/lib/gdi32.a +CFLAGS = + +all: $(PROGS:%=%.exe) + +.phony: all + +clean: + - $(RM) *.o *.coff *.exe *.sym + +.phony: clean + +hello.exe: $(OBJECTS) + $(CC) $(CFLAGS) -Wl,--subsystem,windows $(OBJECTS) $(LIBS) -o hello.exe + $(NM) --numeric-sort hello.exe > hello.sym + +include ../../../rules.mak diff --git a/reactos/apps/tests/tests/hello/hello.c b/reactos/apps/tests/tests/hello/hello.c new file mode 100644 index 00000000000..41036cb4a51 --- /dev/null +++ b/reactos/apps/tests/tests/hello/hello.c @@ -0,0 +1,83 @@ +#include + +char szAppName[] = "Hello"; + +long FAR PASCAL WndProc(HWND, UINT, WPARAM, LPARAM); + +int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR lpszCmdLine, + int nCmdShow) +{ + HWND hwnd; + MSG msg; + WNDCLASS wndclass; + + if(!hPrevInst) { + + wndclass.style = CS_HREDRAW | CS_VREDRAW; + wndclass.lpfnWndProc = WndProc; + wndclass.cbClsExtra = 0; + wndclass.cbWndExtra = 0; + wndclass.hInstance = hInstance; + wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION); + wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); + wndclass.hbrBackground = GetStockObject(WHITE_BRUSH); + wndclass.lpszMenuName = NULL; + wndclass.lpszClassName = szAppName; + + RegisterClass(&wndclass); + + + } + + hwnd = CreateWindow(szAppName, szAppName, + WS_HSCROLL | WS_VSCROLL | WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, CW_USEDEFAULT, 600, + 400, NULL, NULL, hInstance, NULL); + + ShowWindow(hwnd, nCmdShow); + UpdateWindow(hwnd); + + + while(GetMessage(&msg, NULL, 0, 0)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + return msg.wParam; +} + + + +long FAR PASCAL WndProc(HWND hwnd, UINT message, WPARAM wParam, + LPARAM lParam) +{ + HDC hdc; + RECT rect; + SIZE size; + PAINTSTRUCT ps; + + switch(message) { + + case WM_PAINT: + hdc = BeginPaint(hwnd, &ps); + GetClientRect(hwnd, &rect); + InflateRect(&rect, -10, -10); + if( !IsRectEmpty( &rect ) ) + { + GetTextExtentPoint32(hdc, szAppName, strlen(szAppName), &size); + SelectObject(hdc, GetStockObject(LTGRAY_BRUSH)); + Rectangle(hdc, rect.left, rect.top, rect.right, rect.bottom); + rect.left = (rect.right + rect.left - size.cx) / 2; + rect.top = (rect.bottom + rect.top - size.cy) / 2; + SetBkMode(hdc, TRANSPARENT); + TextOut(hdc, rect.left, rect.top, szAppName, strlen(szAppName) ); + } + EndPaint(hwnd, &ps); + return 0; + + case WM_DESTROY: + PostQuitMessage(0); + return 0; + } + return DefWindowProc(hwnd, message, wParam, lParam); +} + diff --git a/reactos/apps/tests/tests/hello2/Makefile b/reactos/apps/tests/tests/hello2/Makefile new file mode 100644 index 00000000000..3566f89adf3 --- /dev/null +++ b/reactos/apps/tests/tests/hello2/Makefile @@ -0,0 +1,26 @@ +# +# +# +PATH_TO_TOP = ../../.. + +PROGS = hello2 + +OBJECTS = hello2.o + +LIBS = # gdi32.a +CFLAGS = + +all: $(PROGS:%=%.exe) + +.phony: all + +clean: + - $(RM) *.o *.coff *.exe *.sym + +.phony: clean + +hello2.exe: $(OBJECTS) + $(CC) $(CFLAGS) -Wl,--subsystem,windows $(OBJECTS) $(LIBS) -o hello2.exe + $(NM) --numeric-sort hello2.exe > hello2.sym + +include ../../../rules.mak diff --git a/reactos/apps/tests/tests/hello2/hello2.c b/reactos/apps/tests/tests/hello2/hello2.c new file mode 100644 index 00000000000..166eec4daa7 --- /dev/null +++ b/reactos/apps/tests/tests/hello2/hello2.c @@ -0,0 +1,9 @@ +#include "windows.h" + +int PASCAL WinMain (HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) +{ + return MessageBox((HWND)0, + (LPSTR)"Hello, hello!", + (LPSTR)"Hello Wine Application", + (MB_OK | MB_ICONEXCLAMATION)); +} diff --git a/reactos/apps/tests/tests/make_install.bat b/reactos/apps/tests/tests/make_install.bat new file mode 100644 index 00000000000..c24b63b023e --- /dev/null +++ b/reactos/apps/tests/tests/make_install.bat @@ -0,0 +1,48 @@ +echo off +REM +REM - This is kinda dirty, I might fix it up later. - SE +REM + +REM - Make System + +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:\tests +copy GetSystemInfo\GetSystemInfo.exe C:\tests +copy guitest\guitest.exe C:\tests +copy hello\hello.exe C:\tests +copy hello2\hello2.exe C:\tests +copy Mutex\fivemutex.exe C:\tests +copy Mutex\rapidmutex.exe C:\tests +copy Parent_Child\Parent_Child.exe C:\tests +copy rolex\rolex.exe C:\tests +copy volinfo\volinfo.exe C:\tests + diff --git a/reactos/apps/tests/tests/new/Makefile b/reactos/apps/tests/tests/new/Makefile new file mode 100644 index 00000000000..cc6db5b6167 --- /dev/null +++ b/reactos/apps/tests/tests/new/Makefile @@ -0,0 +1,26 @@ +# +# +# +PATH_TO_TOP = ../../.. + +PROGS = new + +OBJECTS = new.o + +LIBS = ../../../dk/w32/lib/gdi32.a +CFLAGS = + +all: $(PROGS:%=%.exe) + +.phony: all + +clean: + - $(RM) *.o *.coff *.exe *.sym + +.phony: clean + +new.exe: $(OBJECTS) + $(CC) $(CFLAGS) -Wl,--subsystem,windows $(OBJECTS) $(LIBS) -o new.exe + $(NM) --numeric-sort new.exe > new.sym + +include ../../../rules.mak diff --git a/reactos/apps/tests/tests/new/new.c b/reactos/apps/tests/tests/new/new.c new file mode 100644 index 00000000000..dc0b5076f11 --- /dev/null +++ b/reactos/apps/tests/tests/new/new.c @@ -0,0 +1,154 @@ +#include + +HANDLE ghInstance; + + +LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM); +LRESULT CALLBACK ChildProc (HWND, UINT, WPARAM, LPARAM); + +int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpszCmdParam, int nCmdShow) + { + char szAppName[] = "ClassLook" ; + HWND hwnd ; + MSG msg ; + WNDCLASS wndclass ; + + ghInstance = hInstance; + if (!hPrevInstance) + { + wndclass.style = CS_HREDRAW | CS_VREDRAW ; + wndclass.lpfnWndProc = WndProc ; + wndclass.cbClsExtra = 0 ; + wndclass.cbWndExtra = 0 ; + wndclass.hInstance = hInstance ; + wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ; + wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ; + wndclass.hbrBackground = GetStockObject (WHITE_BRUSH) ; + wndclass.lpszMenuName = NULL ; + wndclass.lpszClassName = szAppName ; + + RegisterClass (&wndclass) ; + } + + hwnd = CreateWindow (szAppName, /* window class name */ + szAppName, /* window caption */ + WS_OVERLAPPEDWINDOW, /* window style */ + CW_USEDEFAULT, /* initial x position */ + CW_USEDEFAULT, /* initial y position */ + 600, /* initial x size */ + 400, /* initial y size */ + NULL, /* parent window handle */ + NULL, /* window menu handle */ + hInstance, /* program instance handle */ + NULL) ; /* creation parameters */ + + ShowWindow (hwnd, nCmdShow) ; + UpdateWindow (hwnd) ; + + while (GetMessage (&msg, NULL, 0, 0)) + { + TranslateMessage (&msg) ; + DispatchMessage (&msg) ; + } + return msg.wParam ; + } + +LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) + { + HDC hdc ; + PAINTSTRUCT ps ; + RECT rect ; + WNDCLASS wndclass ; + char clsName[] = "SecondClass"; + + static HWND hChild; + + switch (message) + { + case WM_CREATE : + wndclass.style = CS_PARENTDC | CS_HREDRAW | CS_VREDRAW; + wndclass.lpfnWndProc = ChildProc ; + wndclass.cbClsExtra = 0 ; + wndclass.cbWndExtra = 0 ; + wndclass.hInstance = ghInstance ; + wndclass.hIcon = NULL ; + wndclass.hCursor = LoadCursor (NULL, IDC_CROSS) ; + wndclass.hbrBackground = GetStockObject (LTGRAY_BRUSH) ; + wndclass.lpszMenuName = NULL ; + wndclass.lpszClassName = clsName; + + RegisterClass (&wndclass); + + hChild = CreateWindow(clsName,"Child Window", + WS_CHILD | WS_VISIBLE | WS_BORDER, + 10, 10, 580, 380, hwnd, NULL, ghInstance, NULL); + ShowWindow(hChild, SW_SHOW); + case WM_PAINT : + hdc = BeginPaint (hwnd, &ps) ; + + GetClientRect (hwnd, &rect) ; + + DrawText (hdc, "Hello, Windows!", -1, &rect, + DT_SINGLELINE | DT_CENTER | DT_VCENTER) ; + + EndPaint (hwnd, &ps); + return 0 ; + + case WM_DESTROY : + PostQuitMessage (0) ; + return 0 ; + } + return DefWindowProc (hwnd, message, wParam, lParam) ; + } + +LRESULT CALLBACK ChildProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + HDC hDC; + PAINTSTRUCT ps; + WNDCLASS wndClass; + char *classes[]={"EDIT","BUTTON","LISTBOX","STATIC","SCROLLBAR","COMBOBOX","COMBOLBOX", NULL}; + char** curr; + char buf[256]; + RECT rect ; + int i; + + switch (message) { + case WM_PAINT: + curr = classes; + i=0; + hDC = BeginPaint(hwnd, &ps); + SelectObject(hDC,GetStockObject(ANSI_FIXED_FONT)); + while (*curr) { + wsprintf(buf,"%12s:",*curr); + GetClassInfo(NULL, *curr, &wndClass); + if(wndClass.style&CS_VREDRAW) lstrcat(buf," | CS_VREDRAW"); + if(wndClass.style&CS_HREDRAW) lstrcat(buf," | CS_HREDRAW" ); + if(wndClass.style&CS_KEYCVTWINDOW) lstrcat(buf," | CS_KEYCVTWINDOW" ); + if(wndClass.style&CS_DBLCLKS) lstrcat(buf," | CS_DBLCLKS" ); + if(wndClass.style&CS_OWNDC) lstrcat(buf," | CS_OWNDC" ); + if(wndClass.style&CS_CLASSDC) lstrcat(buf," | CS_CLASSDC" ); + if(wndClass.style&CS_PARENTDC) lstrcat(buf," | CS_PARENTDC" ); + if(wndClass.style&CS_NOKEYCVT) lstrcat(buf," | CS_NOKEYCVT" ); + if(wndClass.style&CS_NOCLOSE) lstrcat(buf," | CS_NOCLOSE" ); + if(wndClass.style&CS_SAVEBITS) lstrcat(buf," | CS_SAVEBITS" ); + if(wndClass.style&CS_GLOBALCLASS) lstrcat(buf," | CS_GLOBALCLASS"); + GetClientRect (hwnd, &rect) ; + TextOut (hDC, 5,20+i,buf,lstrlen(buf)) ; + i += 15; + curr++; + } +/* EndPaint(hwnd, &ps); + break; + hDC = BeginPaint(hwnd, &ps); +*/ + MoveToEx(hDC, 0, 0, NULL); + LineTo(hDC, 500, 500); + EndPaint(hwnd, &ps); + break; + default: + return DefWindowProc (hwnd, message, wParam, lParam) ; + } + return (0L); +} + diff --git a/reactos/apps/tests/tests/readme.txt b/reactos/apps/tests/tests/readme.txt new file mode 100644 index 00000000000..a77a49af125 --- /dev/null +++ b/reactos/apps/tests/tests/readme.txt @@ -0,0 +1,31 @@ +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:\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. + + + + diff --git a/reactos/apps/tests/tests/rolex/Makefile b/reactos/apps/tests/tests/rolex/Makefile new file mode 100644 index 00000000000..385c9859f13 --- /dev/null +++ b/reactos/apps/tests/tests/rolex/Makefile @@ -0,0 +1,39 @@ +# +# +# +PATH_TO_TOP = ../../.. + +PROGS = rolex + +OBJECTS = rolex.o + +LIBS = ../../../dk/w32/lib/gdi32.a +CFLAGS = + +all: $(PROGS:%=%.exe) + +.phony: all + +clean: + - $(RM) *.o *.coff *.exe *.sym + +.phony: clean + +install: $(PROGS:%=$(FLOPPY_DIR)/apps/%.exe) + +$(PROGS:%=$(FLOPPY_DIR)/apps/%.exe): $(FLOPPY_DIR)/apps/%.exe: %.exe + $(CP) $*.exe $(FLOPPY_DIR)/apps/$*.exe + +dist: $(PROGS:%=../../$(DIST_DIR)/apps/%.exe) + +$(PROGS:%=../../$(DIST_DIR)/apps/%.exe): ../../$(DIST_DIR)/apps/%.exe: %.exe + $(CP) $*.exe ../../$(DIST_DIR)/apps/$*.exe + +rolex.exe: $(OBJECTS) + $(CC) $(CFLAGS) -Wl,--subsystem,windows $(OBJECTS) $(LIBS) -o rolex.exe + $(NM) --numeric-sort rolex.exe > rolex.sym + +#%.coff: %.rc +# $(RC) $(RCINC) $< -o $@ + +include ../../../rules.mak diff --git a/reactos/apps/tests/tests/rolex/rolex.c b/reactos/apps/tests/tests/rolex/rolex.c new file mode 100644 index 00000000000..4881600eda3 --- /dev/null +++ b/reactos/apps/tests/tests/rolex/rolex.c @@ -0,0 +1,254 @@ +/********************************************************************* + * * + * rolex.c: Windows clock application for WINE (by Jim Peterson) * + * * + * This is a translation of a Turbo Pascal OWL application I made * + * once, so it's a little flaky (tons of globals, functions that * + * could have been in-lined, etc.). The source code should easily * + * compile with a standard Win32 C compiler. * + * * + * To try it out, type 'make rolex'. * + * * + *********************************************************************/ + +#include +#include +#include "windows.h" + +char AppName[] = "Rolex"; +char WindowName[] = "Rolex"; +int WindowWidth = 100; +int WindowHeight = 121; +COLORREF FaceColor = RGB(192,192,192); +COLORREF HandColor = RGB(0,0,0); +COLORREF EtchColor = RGB(0,0,0); + +float Pi=3.1415926; + +typedef struct +{ + int StartX,StartY,EndX,EndY; +} HandData; + +int MaxX,MaxY; +HandData OldSecond,OldHour,OldMinute; + +HWND HWindow; + +void DrawFace(HDC dc) +{ + int MidX, MidY, t; + + MidX=MaxX/2; + MidY=MaxY/2; + SelectObject(dc,CreateSolidBrush(FaceColor)); + SelectObject(dc,CreatePen(PS_SOLID,1,EtchColor)); + Ellipse(dc,0,0,MaxX,MaxY); + + for(t=0; t<12; t++) + { + MoveToEx(dc,MidX+sin(t*Pi/6)*0.9*MidX,MidY-cos(t*Pi/6)*0.9*MidY,NULL); + LineTo(dc,MidX+sin(t*Pi/6)*0.8*MidX,MidY-cos(t*Pi/6)*0.8*MidY); + } + if(MaxX>64 && MaxY>64) + for(t=0; t<60; t++) + SetPixel(dc,MidX+sin(t*Pi/30)*0.9*MidX,MidY-cos(t*Pi/30)*0.9*MidY + ,EtchColor); + DeleteObject(SelectObject(dc,GetStockObject(NULL_BRUSH))); + DeleteObject(SelectObject(dc,GetStockObject(NULL_PEN))); + memset(&OldSecond,0,sizeof(OldSecond)); + memset(&OldMinute,0,sizeof(OldMinute)); + memset(&OldHour,0,sizeof(OldHour)); +} + +void DrawHourHand(HDC dc) +{ + MoveToEx(dc, OldHour.StartX, OldHour.StartY, NULL); + LineTo(dc, OldHour.EndX, OldHour.EndY); +} + +void DrawMinuteHand(HDC dc) +{ + MoveToEx(dc, OldMinute.StartX, OldMinute.StartY, NULL); + LineTo(dc, OldMinute.EndX, OldMinute.EndY); +} + +void DrawSecondHand(HDC dc) +{ + MoveToEx(dc, OldSecond.StartX, OldSecond.StartY, NULL); + LineTo(dc, OldSecond.EndX, OldSecond.EndY); +} + +BOOL UpdateHourHand(HDC dc,int MidX,int MidY,int XExt,int YExt,WORD Pos) +{ + int Sx, Sy, Ex, Ey; + BOOL rv; + + rv = FALSE; + Sx = MidX; Sy = MidY; + Ex = MidX+sin(Pos*Pi/6000)*XExt; + Ey = MidY-cos(Pos*Pi/6000)*YExt; + rv = ( Sx!=OldHour.StartX || Ex!=OldHour.EndX || + Sy!=OldHour.StartY || Ey!=OldHour.EndY ); + if(rv)DrawHourHand(dc); + OldHour.StartX = Sx; OldHour.EndX = Ex; + OldHour.StartY = Sy; OldHour.EndY = Ey; + return rv; +} + +BOOL UpdateMinuteHand(HDC dc,int MidX,int MidY,int XExt,int YExt,WORD Pos) +{ + int Sx, Sy, Ex, Ey; + BOOL rv; + + rv = FALSE; + Sx = MidX; Sy = MidY; + Ex = MidX+sin(Pos*Pi/30000)*XExt; + Ey = MidY-cos(Pos*Pi/30000)*YExt; + rv = ( Sx!=OldMinute.StartX || Ex!=OldMinute.EndX || + Sy!=OldMinute.StartY || Ey!=OldMinute.EndY ); + if(rv)DrawMinuteHand(dc); + OldMinute.StartX = Sx; OldMinute.EndX = Ex; + OldMinute.StartY = Sy; OldMinute.EndY = Ey; + return rv; +} + +BOOL UpdateSecondHand(HDC dc,int MidX,int MidY,int XExt,int YExt,WORD Pos) +{ + int Sx, Sy, Ex, Ey; + BOOL rv; + + rv = FALSE; + Sx = MidX; Sy = MidY; + Ex = MidX+sin(Pos*Pi/3000)*XExt; + Ey = MidY-cos(Pos*Pi/3000)*YExt; + rv = ( Sx!=OldSecond.StartX || Ex!=OldSecond.EndX || + Sy!=OldSecond.StartY || Ey!=OldSecond.EndY ); + if(rv)DrawSecondHand(dc); + OldSecond.StartX = Sx; OldSecond.EndX = Ex; + OldSecond.StartY = Sy; OldSecond.EndY = Ey; + return rv; +} + +void Idle(HDC idc) +{ + SYSTEMTIME st; + WORD H, M, S, F; + int MidX, MidY; + HDC dc; + BOOL Redraw; + + if(idc) + dc=idc; + else + dc=GetDC(HWindow); + if(!dc)return; + + GetLocalTime(&st); + H = st.wHour; + M = st.wMinute; + S = st.wSecond; + F = st.wMilliseconds / 10; + F = F + S*100; + M = M*1000+F/6; + H = H*1000+M/60; + MidX = MaxX/2; + MidY = MaxY/2; + SelectObject(dc,CreatePen(PS_SOLID,1,FaceColor)); + Redraw = FALSE; + if(UpdateHourHand(dc,MidX,MidY,MidX*0.5,MidY*0.5,H)) Redraw = TRUE; + if(UpdateMinuteHand(dc,MidX,MidY,MidX*0.65,MidY*0.65,M)) Redraw = TRUE; + if(UpdateSecondHand(dc,MidX,MidY,MidX*0.79,MidY*0.79,F)) Redraw = TRUE; + DeleteObject(SelectObject(dc,CreatePen(PS_SOLID,1,HandColor))); + if(Redraw) + { + DrawSecondHand(dc); + DrawMinuteHand(dc); + DrawHourHand(dc); + } + DeleteObject(SelectObject(dc,GetStockObject(NULL_PEN))); + if(!idc) ReleaseDC(HWindow,dc); +} + +LRESULT CALLBACK ProcessAppMsg(HWND wnd,UINT msg,WPARAM w,LPARAM l) +{ + PAINTSTRUCT PaintInfo; + HDC dc; + + switch(msg) + { + case WM_PAINT: + if(GetUpdateRect(wnd,NULL,FALSE)) + { + dc=BeginPaint(wnd,&PaintInfo); + DrawFace(dc); + Idle(dc); + EndPaint(wnd,&PaintInfo); + } + break; + + case WM_SIZE: + MaxX = LOWORD(l); + MaxY = HIWORD(l); + break; + + case WM_DESTROY: + PostQuitMessage (0); + break; + + default: + return DefWindowProc (wnd, msg, w, l); + } + return 0l; +} + +WPARAM MessageLoop() +{ + MSG msg; + + while(1) + { + Sleep(1); /* sleep 1 millisecond */ + if(PeekMessage(&msg,0,0,0,PM_REMOVE)) + { + if(msg.message == WM_QUIT) return msg.wParam; + TranslateMessage(&msg); + DispatchMessage(&msg); + } + else + Idle(NULL); + } +} + +int PASCAL WinMain (HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) +{ + WNDCLASS class; + if(!prev) + { + class.style = CS_HREDRAW | CS_VREDRAW; + class.lpfnWndProc = ProcessAppMsg; + class.cbClsExtra = 0; + class.cbWndExtra = 0; + class.hInstance = inst; + class.hIcon = 0; /* Draw my own icon */ + class.hCursor = LoadCursor (0, IDC_ARROW); + class.hbrBackground = (HBRUSH)(COLOR_BACKGROUND + 1); + class.lpszMenuName = 0; + class.lpszClassName = AppName; + } + if (!RegisterClass (&class)) return -1; + + HWindow=CreateWindowEx(WS_EX_TOPMOST,AppName,WindowName,WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT,CW_USEDEFAULT,WindowWidth,WindowHeight, + 0,0,inst,0); + memset(&OldSecond,0,sizeof(OldSecond)); + memset(&OldMinute,0,sizeof(OldMinute)); + memset(&OldHour,0,sizeof(OldHour)); + MaxX = WindowWidth; + MaxY = WindowHeight; + + ShowWindow (HWindow, show); + UpdateWindow (HWindow); + + return MessageLoop(); +} diff --git a/reactos/apps/tests/tests/rolex/rolex.spec b/reactos/apps/tests/tests/rolex/rolex.spec new file mode 100644 index 00000000000..00d6fce61cc --- /dev/null +++ b/reactos/apps/tests/tests/rolex/rolex.spec @@ -0,0 +1,8 @@ +name rolex +mode guiexe +type win32 + +import user32.dll +import gdi32.dll +import kernel32.dll +import ntdll.dll diff --git a/reactos/apps/tests/tests/volinfo/Makefile b/reactos/apps/tests/tests/volinfo/Makefile new file mode 100644 index 00000000000..f9e93f12060 --- /dev/null +++ b/reactos/apps/tests/tests/volinfo/Makefile @@ -0,0 +1,36 @@ +# +# +# +PATH_TO_TOP = ../../.. + +PROGS = volinfo + +OBJECTS = volinfo.o + +LIBS = +CFLAGS = + +all: $(PROGS:%=%.exe) + +.phony: all + +clean: + - $(RM) *.o *.exe *.sym + +.phony: clean + +install: $(PROGS:%=$(FLOPPY_DIR)/apps/%.exe) + +$(PROGS:%=$(FLOPPY_DIR)/apps/%.exe): $(FLOPPY_DIR)/apps/%.exe: %.exe + $(CP) $*.exe $(FLOPPY_DIR)/apps/$*.exe + +dist: $(PROGS:%=../../$(DIST_DIR)/apps/%.exe) + +$(PROGS:%=../../$(DIST_DIR)/apps/%.exe): ../../$(DIST_DIR)/apps/%.exe: %.exe + $(CP) $*.exe ../../$(DIST_DIR)/apps/$*.exe + +volinfo.exe: $(OBJECTS) + $(CC) $(CFLAGS) -Wl,--subsystem,windows $(OBJECTS) $(LIBS) -o volinfo.exe + $(NM) --numeric-sort volinfo.exe > volinfo.sym + +include ../../../rules.mak diff --git a/reactos/apps/tests/tests/volinfo/volinfo.c b/reactos/apps/tests/tests/volinfo/volinfo.c new file mode 100644 index 00000000000..bc639d1fdd5 --- /dev/null +++ b/reactos/apps/tests/tests/volinfo/volinfo.c @@ -0,0 +1,29 @@ +/* + * This test program was copied from the former file documentation/cdrom-label + */ +#include +#include +#include /* for strcat() */ + +int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpszCmdLine, int nCmdShow) +{ + char drive, root[]="C:\\", label[1002], fsname[1002]; + DWORD serial, flags, filenamelen, labellen = 1000, fsnamelen = 1000; + + printf("Drive Serial Flags Filename-Length " + "Label Fsname\n"); + for (drive = 'A'; drive <= 'Z'; drive++) + { + root[0] = drive; + if (GetVolumeInformation(root,label,labellen,&serial, + &filenamelen,&flags,fsname,fsnamelen)) + { + strcat(label,"\""); strcat (fsname,"\""); + printf("%c:\\ 0x%08lx 0x%08lx %15ld \"%-20s \"%-20s\n", + drive, (long) serial, (long) flags, (long) filenamelen, + label, fsname); + } + } + return 0; +}