[APITESTS]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Wed, 25 Aug 2010 08:48:55 +0000 (08:48 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Wed, 25 Aug 2010 08:48:55 +0000 (08:48 +0000)
Convert dciman32api, user32api and wa2_32 into wine style tests

svn path=/trunk/; revision=48619

24 files changed:
rostests/apitests/dciman32api/dciman32api.c [deleted file]
rostests/apitests/dciman32api/dciman32api.h [deleted file]
rostests/apitests/dciman32api/dciman32api.rbuild [deleted file]
rostests/apitests/dciman32api/testlist.c [deleted file]
rostests/apitests/dciman32api/tests/DCICreatePrimary.c [deleted file]
rostests/apitests/directory.rbuild
rostests/apitests/user32api/testlist.c [deleted file]
rostests/apitests/user32api/tests/GetSystemMetrics.c [deleted file]
rostests/apitests/user32api/tests/InitializeLpkHooks.c [deleted file]
rostests/apitests/user32api/tests/RealGetWindowClass.c [deleted file]
rostests/apitests/user32api/tests/ScrollDC.c [deleted file]
rostests/apitests/user32api/tests/ScrollWindowEx.c [deleted file]
rostests/apitests/user32api/user32api.c [deleted file]
rostests/apitests/user32api/user32api.h [deleted file]
rostests/apitests/user32api/user32api.rbuild [deleted file]
rostests/apitests/ws2_32/helpers.c
rostests/apitests/ws2_32/ioctlsocket.c [new file with mode: 0644]
rostests/apitests/ws2_32/recv.c [moved from rostests/apitests/ws2_32/tests/recv.c with 51% similarity]
rostests/apitests/ws2_32/testlist.c
rostests/apitests/ws2_32/tests/ioctlsocket.c [deleted file]
rostests/apitests/ws2_32/ws2_32.c [deleted file]
rostests/apitests/ws2_32/ws2_32.h
rostests/apitests/ws2_32/ws2_32.rbuild [deleted file]
rostests/apitests/ws2_32/ws2_32_apitest.rbuild [new file with mode: 0644]

diff --git a/rostests/apitests/dciman32api/dciman32api.c b/rostests/apitests/dciman32api/dciman32api.c
deleted file mode 100644 (file)
index f01aa41..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#include "dciman32api.h"
-
-HINSTANCE g_hInstance;
-
-BOOL
-IsFunctionPresent(LPWSTR lpszFunction)
-{
-    return TRUE;
-}
-
-int APIENTRY
-WinMain(HINSTANCE hInstance,
-        HINSTANCE hPrevInstance,
-        LPSTR     lpCmdLine,
-        int       nCmdShow)
-{
-    g_hInstance = hInstance;
-    return TestMain(L"dciman32api", L"dciman32.dll");
-}
diff --git a/rostests/apitests/dciman32api/dciman32api.h b/rostests/apitests/dciman32api/dciman32api.h
deleted file mode 100644 (file)
index 658e6bd..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0501
-#endif
-
-#define WIN32_NO_STATUS
-#include <windows.h>
-#include <windows.h>
-#include <ndk/ntndk.h>
-#include <wingdi.h>
-#include <winddi.h>
-#include <d3dnthal.h>
-#include <prntfont.h>
-
-/* Public Win32K Headers */
-#include <win32k/ntgdityp.h>
-#include <ntgdi.h>
-#include <win32k/ntgdihdl.h>
-
-#include "../apitest.h"
-
-
-
diff --git a/rostests/apitests/dciman32api/dciman32api.rbuild b/rostests/apitests/dciman32api/dciman32api.rbuild
deleted file mode 100644 (file)
index 7e6687b..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<module name="dciman32api" type="win32cui">
-       <include base="dciman32api">.</include>
-       <library>apitest</library>
-       <library>user32</library>
-       <library>gdi32</library>
-       <library>shell32</library>
-       <file>dciman32api.c</file>
-       <file>testlist.c</file>
-</module>
diff --git a/rostests/apitests/dciman32api/testlist.c b/rostests/apitests/dciman32api/testlist.c
deleted file mode 100644 (file)
index 2726bb7..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef _DCIMAN32TESTLIST_H
-#define _DCIMAN32TESTLIST_H
-
-#include "dciman32api.h"
-
-/* include the tests */
-#include "tests/DCICreatePrimary.c"
-
-
-
-
-
-
-
-
-
-
-/* The List of tests */
-TESTENTRY TestList[] =
-{
-    { L"DCICreatePrimary", Test_DCICreatePrimary }
-};
-
-/* The function that gives us the number of tests */
-INT NumTests(void)
-{
-       return sizeof(TestList) / sizeof(TESTENTRY);
-}
-
-#endif
-
-/* EOF */
diff --git a/rostests/apitests/dciman32api/tests/DCICreatePrimary.c b/rostests/apitests/dciman32api/tests/DCICreatePrimary.c
deleted file mode 100644 (file)
index 2590158..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-
-INT
-Test_DCICreatePrimary(PTESTINFO pti)
-{
-
-    return APISTATUS_NORMAL;
-}
-
index 319878f..f5816b8 100644 (file)
@@ -6,16 +6,16 @@
                <file>apitest.c</file>
        </module>
 
                <file>apitest.c</file>
        </module>
 
-       <directory name="dciman32api">
-               <xi:include href="dciman32api/dciman32api.rbuild" />
+       <directory name="dciman32">
+               <xi:include href="dciman32/dciman32_apitest.rbuild" />
        </directory>
 
        <directory name="gdi32">
                <xi:include href="gdi32/gdi32_apitest.rbuild" />
        </directory>
 
        </directory>
 
        <directory name="gdi32">
                <xi:include href="gdi32/gdi32_apitest.rbuild" />
        </directory>
 
-       <directory name="user32api">
-               <xi:include href="user32api/user32api.rbuild" />
+       <directory name="user32">
+               <xi:include href="user32/user32_apitest.rbuild" />
        </directory>
 
        <if property="ARCH" value="i386">
        </directory>
 
        <if property="ARCH" value="i386">
@@ -29,6 +29,6 @@
        </if>
 
        <directory name="ws2_32">
        </if>
 
        <directory name="ws2_32">
-               <xi:include href="ws2_32/ws2_32.rbuild" />
+               <xi:include href="ws2_32/ws2_32_apitest.rbuild" />
        </directory>
 </group>
        </directory>
 </group>
diff --git a/rostests/apitests/user32api/testlist.c b/rostests/apitests/user32api/testlist.c
deleted file mode 100644 (file)
index 0dc0513..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef _USER32TESTLIST_H
-#define _USER32TESTLIST_H
-
-#define ARRAY_SIZE(x)   (sizeof(x)/sizeof(x[0]))
-
-#include "user32api.h"
-
-/* include the tests */
-#include "tests/GetSystemMetrics.c"
-#include "tests/InitializeLpkHooks.c"
-#include "tests/ScrollDC.c"
-#include "tests/ScrollWindowEx.c"
-#include "tests/RealGetWindowClass.c"
-
-/* The List of tests */
-TESTENTRY TestList[] =
-{
-    { L"GetSystemMetrics", Test_GetSystemMetrics },
-    { L"InitializeLpkHooks", Test_InitializeLpkHooks },
-    { L"ScrollDC", Test_ScrollDC },
-    { L"ScrollWindowEx", Test_ScrollWindowEx },
-    { L"RealGetWindowClass", Test_RealGetWindowClass },
-};
-
-/* The function that gives us the number of tests */
-INT NumTests(void)
-{
-    return ARRAY_SIZE(TestList);
-}
-
-#endif /* _USER32TESTLIST_H */
-
-/* EOF */
diff --git a/rostests/apitests/user32api/tests/GetSystemMetrics.c b/rostests/apitests/user32api/tests/GetSystemMetrics.c
deleted file mode 100644 (file)
index 720f0f7..0000000
+++ /dev/null
@@ -1,396 +0,0 @@
-
-INT
-Test_GetSystemMetrics(PTESTINFO pti)
-{
-    INT ret;
-    HDC hDC;
-    BOOL BoolVal;
-    UINT UintVal;
-    RECT rect;
-
-    SetLastError(0);
-    hDC = GetDC(0);
-
-    ret = GetSystemMetrics(0);
-    TEST(ret > 0);
-
-    ret = GetSystemMetrics(64);
-    TEST(ret == 0);
-    ret = GetSystemMetrics(65);
-    TEST(ret == 0);
-    ret = GetSystemMetrics(66);
-    TEST(ret == 0);
-
-
-    ret = GetSystemMetrics(SM_CXSCREEN);
-    TEST(ret == GetDeviceCaps(hDC, HORZRES));
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYSCREEN);
-    TEST(ret == GetDeviceCaps(hDC, VERTRES));
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CXVSCROLL);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYHSCROLL);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYCAPTION);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CXBORDER);
-    SystemParametersInfoW(SPI_GETFOCUSBORDERWIDTH, 0, &UintVal, 0);
-    TEST(ret == UintVal);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYBORDER);
-    SystemParametersInfoW(SPI_GETFOCUSBORDERHEIGHT, 0, &UintVal, 0);
-    TEST(ret == UintVal);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CXDLGFRAME);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYDLGFRAME);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYVTHUMB);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CXHTHUMB);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CXICON);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYICON);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CXCURSOR);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYCURSOR);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYMENU);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    SystemParametersInfoW(SPI_GETWORKAREA, 0, &rect, 0);
-    ret = GetSystemMetrics(SM_CXFULLSCREEN);
-    TEST(ret == rect.right);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYFULLSCREEN);
-    TEST(ret == rect.bottom - rect.top - GetSystemMetrics(SM_CYCAPTION));
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYKANJIWINDOW);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_MOUSEPRESENT);
-    TEST(ret == 1);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYVSCROLL);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CXHSCROLL);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_DEBUG);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_SWAPBUTTON);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_RESERVED1);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_RESERVED2);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_RESERVED3);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_RESERVED4);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CXMIN);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYMIN);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CXSIZE);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYSIZE);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CXFRAME);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYFRAME);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CXMINTRACK);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYMINTRACK);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CXDOUBLECLK);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYDOUBLECLK);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CXICONSPACING);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYICONSPACING);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_MENUDROPALIGNMENT);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_PENWINDOWS);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_DBCSENABLED);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CMOUSEBUTTONS);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-#if(WINVER >= 0x0400)
-    ret = GetSystemMetrics(SM_SECURE);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CXEDGE);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYEDGE);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CXMINSPACING);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYMINSPACING);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CXSMICON);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYSMICON);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYSMCAPTION);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CXSMSIZE);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYSMSIZE);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CXMENUSIZE);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYMENUSIZE);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_ARRANGE);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CXMINIMIZED);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYMINIMIZED);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CXMAXTRACK);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYMAXTRACK);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CXMAXIMIZED);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYMAXIMIZED);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_NETWORK);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CLEANBOOT);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CXDRAG);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYDRAG);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_SHOWSOUNDS);
-    SystemParametersInfoW(SPI_GETSHOWSOUNDS, 0, &BoolVal, 0);
-    TEST(ret == BoolVal);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CXMENUCHECK);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYMENUCHECK);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_SLOWMACHINE);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_MIDEASTENABLED);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-#endif
-
-#if (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400)
-    ret = GetSystemMetrics(SM_MOUSEWHEELPRESENT);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-#endif
-
-#if(WINVER >= 0x0500)
-    ret = GetSystemMetrics(SM_XVIRTUALSCREEN);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_YVIRTUALSCREEN);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CXVIRTUALSCREEN);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYVIRTUALSCREEN);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CMONITORS);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_SAMEDISPLAYFORMAT);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-#endif
-
-#if(_WIN32_WINNT >= 0x0500)
-    ret = GetSystemMetrics(SM_IMMENABLED);
-    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-#endif
-
-#if(_WIN32_WINNT >= 0x0501)
-    ret = GetSystemMetrics(SM_CXFOCUSBORDER);
-    SystemParametersInfoW(SPI_GETFOCUSBORDERWIDTH, 0, &UintVal, 0);
-    TEST(ret == UintVal);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CYFOCUSBORDER);
-    SystemParametersInfoW(SPI_GETFOCUSBORDERHEIGHT, 0, &UintVal, 0);
-    TEST(ret == UintVal);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_TABLETPC);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_MEDIACENTER);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_STARTER);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_SERVERR2);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-#endif
-
-#if(_WIN32_WINNT >= 0x0600)
-    ret = GetSystemMetrics(SM_MOUSEHORIZONTALWHEELPRESENT);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-
-    ret = GetSystemMetrics(SM_CXPADDEDBORDER);
-//    TEST(ret == 0);
-    TEST(GetLastError() == 0);
-#endif
-
-    return APISTATUS_NORMAL;
-}
diff --git a/rostests/apitests/user32api/tests/InitializeLpkHooks.c b/rostests/apitests/user32api/tests/InitializeLpkHooks.c
deleted file mode 100644 (file)
index 85e6d7a..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-
-typedef struct _LPK_LPEDITCONTROL_LIST
-{
-    PVOID EditCreate;
-    PVOID EditIchToXY;
-    PVOID EditMouseToIch;
-    PVOID EditCchInWidth;
-    PVOID EditGetLineWidth;
-    PVOID EditDrawText;
-    PVOID EditHScroll;
-    PVOID EditMoveSelection;
-    PVOID EditVerifyText;
-    PVOID EditNextWord;
-    PVOID EditSetMenu;
-    PVOID EditProcessMenu;
-    PVOID EditCreateCaret;
-    PVOID EditAdjustCaret;
-} LPK_LPEDITCONTROL_LIST, *PLPK_LPEDITCONTROL_LIST;
-
-
-DWORD (APIENTRY *fpLpkTabbedTextOut) (LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID);
-DWORD (APIENTRY *fpLpkPSMTextOut) (LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID);
-DWORD (APIENTRY *fpLpkDrawTextEx) (LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID);
-PLPK_LPEDITCONTROL_LIST (APIENTRY *fpLpkEditControl) ();
-
-int Count_myLpkTabbedTextOut = 0;
-int Count_myLpkPSMTextOut = 0;
-int Count_myLpkDrawTextEx = 0;
-
-DWORD WINAPI myLpkTabbedTextOut (LPVOID x1,LPVOID x2,LPVOID x3, LPVOID x4, LPVOID x5, LPVOID x6, LPVOID x7, LPVOID x8, 
-                                   LPVOID x9, LPVOID x10, LPVOID x11, LPVOID x12)
-{
-    Count_myLpkTabbedTextOut++;
-    return fpLpkTabbedTextOut(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12);
-}
-
-DWORD myLpkPSMTextOut (LPVOID x1,LPVOID x2,LPVOID x3,LPVOID x4,LPVOID x5,LPVOID x6)
-{
-    Count_myLpkPSMTextOut++;
-    return fpLpkPSMTextOut ( x1,  x2,  x3,  x4,  x5,  x6);
-}
-
-DWORD myLpkDrawTextEx(LPVOID x1,LPVOID x2,LPVOID x3,LPVOID x4,LPVOID x5, LPVOID x6, LPVOID x7, LPVOID x8, LPVOID x9,LPVOID x10)
-{
-    Count_myLpkDrawTextEx++;
-    return fpLpkDrawTextEx(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10);
-}
-
-
-typedef struct _USER32_INTERN_INITALIZEHOOKS
-{
-    PVOID fpLpkTabbedTextOut;
-    PVOID fpLpkPSMTextOut;
-    PVOID fpLpkDrawTextEx;
-    PLPK_LPEDITCONTROL_LIST fpListLpkEditControl;
-} USER32_INTERN_INITALIZEHOOKS, *PUSER32_INTERN_INITALIZEHOOKS;
-
-VOID WINAPI InitializeLpkHooks (PUSER32_INTERN_INITALIZEHOOKS);
-
-INT
-Test_InitializeLpkHooks(PTESTINFO pti)
-{
-    USER32_INTERN_INITALIZEHOOKS setup;
-    HMODULE lib = LoadLibrary("LPK.DLL");
-
-    TEST(lib != NULL);
-    if (lib != NULL)
-    {
-        fpLpkTabbedTextOut = (DWORD (APIENTRY *) (LPVOID,LPVOID,LPVOID,LPVOID,LPVOID, LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID)) GetProcAddress(lib, "LpkTabbedTextOut");
-        fpLpkPSMTextOut = (DWORD (APIENTRY *) (LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID)) GetProcAddress(lib, "fpLpkPSMTextOut");
-        fpLpkDrawTextEx = (DWORD (APIENTRY *) (LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID)) GetProcAddress(lib, "LpkDrawTextEx");
-        fpLpkEditControl = (PLPK_LPEDITCONTROL_LIST (APIENTRY *) (VOID)) GetProcAddress(lib, "LpkEditControl");
-
-        setup.fpLpkTabbedTextOut = myLpkTabbedTextOut;
-        setup.fpLpkPSMTextOut = myLpkPSMTextOut;
-        setup.fpLpkDrawTextEx = myLpkDrawTextEx;
-
-        /* we have not add any test to this api */
-        setup.fpListLpkEditControl = (PLPK_LPEDITCONTROL_LIST)fpLpkEditControl;
-
-        /* use our own api that we just made */
-        InitializeLpkHooks(&setup);
-
-        /* FIXME add test now */
-
-        /* restore */
-        setup.fpLpkTabbedTextOut = fpLpkTabbedTextOut;
-        setup.fpLpkPSMTextOut = fpLpkPSMTextOut;
-        setup.fpLpkDrawTextEx = fpLpkDrawTextEx;
-        setup.fpListLpkEditControl = (PLPK_LPEDITCONTROL_LIST)fpLpkEditControl;
-        InitializeLpkHooks(&setup);
-    }
-
-    return APISTATUS_NORMAL;
-}
-
diff --git a/rostests/apitests/user32api/tests/RealGetWindowClass.c b/rostests/apitests/user32api/tests/RealGetWindowClass.c
deleted file mode 100644 (file)
index 25d94dc..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-#include "../user32api.h"
-
-typedef struct _TestData
-{
-    BOOL    OverrideWndProc;            /* TRUE if lpfnWndProc should be overridden */
-    LPCSTR  ClassName;                  /* Name of the new class to register */
-    DWORD   WndExtra;                   /* Remove these WNDCLASS::cbWndExtra flags */
-    BOOL    ExpectsHwnd;                /* TRUE if a HWND should be created to run tests on */
-    LPCSTR  ExpectedClassNameBefore;    /* Expected class name before any dialog function is called */
-    LPCSTR  ExpectedClassNameAfter;     /* Expected class name after any dialog function is called */
-} TestData;
-
-static TestData RealClassTestData[] =
-{
-    {
-        TRUE,
-        "OverrideWndProc_with_DLGWINDOWEXTRA_TRUE",
-        0,
-        TRUE,
-        "OverrideWndProc_with_DLGWINDOWEXTRA_TRUE",
-        "#32770",
-    },
-    {
-        TRUE,
-        "OverrideWndProc_without_DLGWINDOWEXTRA_TRUE",
-        DLGWINDOWEXTRA,
-        TRUE,
-        "OverrideWndProc_without_DLGWINDOWEXTRA_TRUE",
-        "OverrideWndProc_without_DLGWINDOWEXTRA_TRUE",
-    },
-    {
-        FALSE,
-        "DefaultWndProc_with_DLGWINDOWEXTRA_FALSE",
-        0,
-        TRUE,
-        "#32770",
-        "#32770",
-    },
-    {
-        FALSE,
-        "DefaultWndProc_without_DLGWINDOWEXTRA_FALSE",
-        DLGWINDOWEXTRA,
-        FALSE,
-        "N/A",
-        "N/A",
-    },
-};
-
-INT
-Test_RealGetWindowClass(PTESTINFO pti)
-{
-    int testNo;
-    UINT Result;
-    CHAR Buffer[1024];
-
-    Result = RealGetWindowClass( NULL, Buffer, ARRAY_SIZE(Buffer) );
-    TEST(Result == 0);
-    TEST(GetLastError() == ERROR_INVALID_WINDOW_HANDLE);
-
-    for (testNo = 0; testNo < ARRAY_SIZE(RealClassTestData); testNo++)
-    {
-        ATOM atom;
-        WNDCLASSA cls;
-        HWND hWnd;
-
-        /* Register classes, "derived" from built-in dialog, with and without the DLGWINDOWEXTRA flag set */
-        GetClassInfoA(0, "#32770", &cls);
-        if (RealClassTestData[testNo].OverrideWndProc)
-            cls.lpfnWndProc = DefWindowProcA;
-        cls.lpszClassName = RealClassTestData[testNo].ClassName;
-        cls.cbWndExtra &= ~RealClassTestData[testNo].WndExtra;
-        atom = RegisterClassA (&cls);
-        ASSERT(atom != 0);
-
-        /* Create a window */
-        hWnd = CreateWindowEx( WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR |
-                               WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | WS_EX_CONTROLPARENT | WS_EX_APPWINDOW,
-                               RealClassTestData[testNo].ClassName,
-                               RealClassTestData[testNo].ClassName,
-                               WS_POPUPWINDOW | WS_CLIPSIBLINGS | WS_DLGFRAME | WS_OVERLAPPED |
-                               WS_MINIMIZEBOX | WS_MAXIMIZEBOX | DS_3DLOOK | DS_SETFONT | DS_MODALFRAME,
-                               CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
-                               NULL, NULL, g_hInstance, 0);
-
-        /* Do we expect a HWND at all? */
-        if (RealClassTestData[testNo].ExpectsHwnd)
-        {
-            TEST(hWnd != NULL);
-
-            if (hWnd != NULL)
-            {
-                /* Get the "real" class name */
-                Result = RealGetWindowClass( hWnd, Buffer, ARRAY_SIZE(Buffer) );
-                printf("Buffer: %s\nExpectedClassNameBefore(%d): %s\n", Buffer, testNo, RealClassTestData[testNo].ExpectedClassNameBefore);
-                TEST( Result != 0 );
-                TEST( strcmp( Buffer, RealClassTestData[testNo].ExpectedClassNameBefore ) == 0 );
-
-                /* Call a function that requires a dialog window */
-                DefDlgProcA( hWnd, DM_SETDEFID, IDCANCEL, 0 );
-
-                /* Get the "real" class name again */
-                Result = RealGetWindowClass( hWnd, Buffer, ARRAY_SIZE(Buffer) );
-                printf("Buffer: %s\nExpectedClassNameAfter(%d): %s\n", Buffer, testNo, RealClassTestData[testNo].ExpectedClassNameAfter);
-                TEST( Result != 0 );
-                TEST( strcmp( Buffer, RealClassTestData[testNo].ExpectedClassNameAfter ) == 0 );
-            }
-        }
-        else
-        {
-            TEST(hWnd == NULL);
-        }
-
-        /* Cleanup */
-        DestroyWindow(hWnd);
-        UnregisterClass(RealClassTestData[testNo].ClassName, g_hInstance);
-    }
-
-    return APISTATUS_NORMAL;
-}
diff --git a/rostests/apitests/user32api/tests/ScrollDC.c b/rostests/apitests/user32api/tests/ScrollDC.c
deleted file mode 100644 (file)
index 88be153..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-#include "../user32api.h"
-
-INT
-Test_ScrollDC(PTESTINFO pti)
-{
-       HWND hWnd, hWnd2;
-       HDC hDC;
-       HRGN hrgn;
-       RECT rcClip;
-
-       /* Create a window */
-       hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
-                           100, 100, 100, 100,
-                           NULL, NULL, g_hInstance, 0);
-       UpdateWindow(hWnd);
-       hDC = GetDC(hWnd);
-
-       /* Assert that no update region is there */
-       hrgn = CreateRectRgn(0,0,0,0);
-       ASSERT(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
-
-    /* Test normal scrolling */
-       TEST(ScrollDC(hDC, 0, 0, NULL, NULL, hrgn, NULL) == TRUE);
-
-    /* Scroll with invalid update region */
-       DeleteObject(hrgn);
-       TEST(ScrollDC(hDC, 50, 0, NULL, NULL, hrgn, NULL) == FALSE);
-       hrgn = CreateRectRgn(0,0,0,0);
-       TEST(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
-
-    /* Scroll with invalid update rect pointer */
-       TEST(ScrollDC(hDC, 50, 0, NULL, NULL, NULL, (PRECT)1) == 0);
-       TEST(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
-
-    /* Scroll with a clip rect */
-    rcClip.left = 50; rcClip.top = 0; rcClip.right = 100; rcClip.bottom = 100;
-       TEST(ScrollDC(hDC, 50, 0, NULL, &rcClip, hrgn, NULL) == TRUE);
-       TEST(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
-
-    /* Scroll with a clip rect */
-    rcClip.left = 50; rcClip.top = 0; rcClip.right = 100; rcClip.bottom = 100;
-       TEST(ScrollDC(hDC, 50, 50, NULL, &rcClip, hrgn, NULL) == TRUE);
-       TEST(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
-
-       /* Overlap with another window */
-       hWnd2 = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
-                           30, 160, 100, 100,
-                           NULL, NULL, g_hInstance, 0);
-       UpdateWindow(hWnd2);
-
-    /* Cleanup */
-       ReleaseDC(hWnd, hDC);
-    DestroyWindow(hWnd);
-    DestroyWindow(hWnd2);
-
-       return APISTATUS_NORMAL;
-}
diff --git a/rostests/apitests/user32api/tests/ScrollWindowEx.c b/rostests/apitests/user32api/tests/ScrollWindowEx.c
deleted file mode 100644 (file)
index 2a6ed38..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#include "../user32api.h"
-
-INT
-Test_ScrollWindowEx(PTESTINFO pti)
-{
-       HWND hWnd;
-       HRGN hrgn;
-       int Result;
-
-       /* Create a window */
-       hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
-                           CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
-                           NULL, NULL, g_hInstance, 0);
-       UpdateWindow(hWnd);
-
-       /* Assert that no update region is there */
-       hrgn = CreateRectRgn(0,0,0,0);
-       ASSERT(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
-
-       Result = ScrollWindowEx(hWnd, 20, 0, NULL, NULL, NULL, NULL, 0);
-       TEST(Result == SIMPLEREGION);
-       TEST(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
-
-       Result = ScrollWindowEx(hWnd, 20, 0, NULL, NULL, NULL, NULL, SW_INVALIDATE);
-       TEST(Result == SIMPLEREGION);
-       TEST(GetUpdateRgn(hWnd, hrgn, FALSE) == SIMPLEREGION);
-       UpdateWindow(hWnd);
-
-       // test invalid update region
-       DeleteObject(hrgn);
-       Result = ScrollWindowEx(hWnd, 20, 0, NULL, NULL, hrgn, NULL, SW_INVALIDATE);
-       TEST(Result == ERROR);
-       hrgn = CreateRectRgn(0,0,0,0);
-       UpdateWindow(hWnd);
-
-       // Test invalid updaterect pointer
-       Result = ScrollWindowEx(hWnd, 20, 0, NULL, NULL, NULL, (LPRECT)1, SW_INVALIDATE);
-       TEST(Result == ERROR);
-       TEST(GetUpdateRgn(hWnd, hrgn, FALSE) == SIMPLEREGION);
-
-// test for alignment of rects
-
-       DeleteObject(hrgn);
-    DestroyWindow(hWnd);
-
-       return APISTATUS_NORMAL;
-}
diff --git a/rostests/apitests/user32api/user32api.c b/rostests/apitests/user32api/user32api.c
deleted file mode 100644 (file)
index b17e3aa..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#include "user32api.h"
-
-HINSTANCE g_hInstance;
-
-BOOL
-IsFunctionPresent(LPWSTR lpszFunction)
-{
-       return TRUE;
-}
-
-int APIENTRY WinMain(HINSTANCE hInstance,
-                     HINSTANCE hPrevInstance,
-                     LPSTR     lpCmdLine,
-                     int       nCmdShow)
-{
-       g_hInstance = hInstance;
-       return TestMain(L"user32api", L"user32.dll");
-}
diff --git a/rostests/apitests/user32api/user32api.h b/rostests/apitests/user32api/user32api.h
deleted file mode 100644 (file)
index 00115ac..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _USER32TEST_H
-#define _USER32TEST_H
-
-#include "../apitest.h"
-
-extern HINSTANCE g_hInstance;
-
-#endif /* _USER32TEST_H */
-
-/* EOF */
diff --git a/rostests/apitests/user32api/user32api.rbuild b/rostests/apitests/user32api/user32api.rbuild
deleted file mode 100644 (file)
index ea33d4e..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<module name="user32api" type="win32cui">
-       <include base="user32api">.</include>
-       <library>apitest</library>
-       <library>user32</library>
-       <library>gdi32</library>
-       <library>shell32</library>
-       <file>user32api.c</file>
-       <file>testlist.c</file>
-</module>
index 9033aed..44af7e9 100644 (file)
@@ -6,25 +6,27 @@
  * COPYRIGHT:   Copyright 2008 Colin Finck <mail@colinfinck.de>
  */
 
  * COPYRIGHT:   Copyright 2008 Colin Finck <mail@colinfinck.de>
  */
 
+#include <stdio.h>
+#include <wine/test.h>
 #include "ws2_32.h"
 
 #include "ws2_32.h"
 
-int CreateSocket(PTESTINFO pti, SOCKET* psck)
+int CreateSocket(SOCKET* psck)
 {
     /* Create the socket */
     *psck = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
 {
     /* Create the socket */
     *psck = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
-    TEST(*psck != INVALID_SOCKET);
+    ok(*psck != INVALID_SOCKET, "*psck = %d\n", *psck);
 
     if(*psck == INVALID_SOCKET)
     {
         printf("Winsock error code is %u\n", WSAGetLastError());
         WSACleanup();
 
     if(*psck == INVALID_SOCKET)
     {
         printf("Winsock error code is %u\n", WSAGetLastError());
         WSACleanup();
-        return APISTATUS_ASSERTION_FAILED;
+        return 0;
     }
 
     }
 
-    return APISTATUS_NORMAL;
+    return 1;
 }
 
 }
 
-int ConnectToReactOSWebsite(PTESTINFO pti, SOCKET sck)
+int ConnectToReactOSWebsite(SOCKET sck)
 {
     int iResult;
     struct hostent* host;
 {
     int iResult;
     struct hostent* host;
@@ -38,11 +40,11 @@ int ConnectToReactOSWebsite(PTESTINFO pti, SOCKET sck)
     sa.sin_port = htons(80);
 
     SCKTEST(connect(sck, (struct sockaddr *)&sa, sizeof(sa)));
     sa.sin_port = htons(80);
 
     SCKTEST(connect(sck, (struct sockaddr *)&sa, sizeof(sa)));
-
-    return APISTATUS_NORMAL;
+    
+    return 1;
 }
 
 }
 
-int GetRequestAndWait(PTESTINFO pti, SOCKET sck)
+int GetRequestAndWait(SOCKET sck)
 {
     const char szGetRequest[] = "GET / HTTP/1.0\r\n\r\n";
     int iResult;
 {
     const char szGetRequest[] = "GET / HTTP/1.0\r\n\r\n";
     int iResult;
@@ -50,7 +52,7 @@ int GetRequestAndWait(PTESTINFO pti, SOCKET sck)
 
     /* Send the GET request */
     SCKTEST(send(sck, szGetRequest, strlen(szGetRequest), 0));
 
     /* Send the GET request */
     SCKTEST(send(sck, szGetRequest, strlen(szGetRequest), 0));
-    TEST(iResult == strlen(szGetRequest));
+    ok(iResult == strlen(szGetRequest), "iResult = %d\n", iResult);
 
     /* Shutdown the SEND connection */
     SCKTEST(shutdown(sck, SD_SEND));
 
     /* Shutdown the SEND connection */
     SCKTEST(shutdown(sck, SD_SEND));
@@ -60,6 +62,6 @@ int GetRequestAndWait(PTESTINFO pti, SOCKET sck)
     FD_SET(sck, &readable);
 
     SCKTEST(select(0, &readable, NULL, NULL, NULL));
     FD_SET(sck, &readable);
 
     SCKTEST(select(0, &readable, NULL, NULL, NULL));
-
-    return APISTATUS_NORMAL;
+    
+    return 1;
 }
 }
diff --git a/rostests/apitests/ws2_32/ioctlsocket.c b/rostests/apitests/ws2_32/ioctlsocket.c
new file mode 100644 (file)
index 0000000..83b0d05
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * PROJECT:         ReactOS api tests
+ * LICENSE:         GPL - See COPYING in the top level directory
+ * PURPOSE:         Test for ioctlsocket
+ * PROGRAMMERS:     Colin Finck
+ */
+
+#include <stdio.h>
+#include <wine/test.h>
+#include <windows.h>
+#include "ws2_32.h"
+
+int Test_ioctlsocket()
+{
+    LPSTR pszBuf;
+    int iResult;
+    SOCKET sck;
+    ULONG BytesAvailable;
+    ULONG BytesToRead;
+    WSADATA wdata;
+
+    /* Start up Winsock */
+    iResult = WSAStartup(MAKEWORD(2, 2), &wdata);
+    ok(iResult == 0, "WSAStartup failed. iResult = %d\n", iResult);
+
+    /* If we call ioctlsocket without a socket, it should return with an error and do nothing. */
+    BytesAvailable = 0xdeadbeef;
+    iResult = ioctlsocket(0, FIONREAD, &BytesAvailable);
+    ok(iResult == SOCKET_ERROR, "iResult = %d\n", iResult);
+    ok(BytesAvailable == 0xdeadbeef, "BytesAvailable = %ld\n", BytesAvailable);
+
+    /* Create the socket */
+    if (!CreateSocket(&sck))
+    {
+        ok(0, "CreateSocket failed. Aborting test.\n");
+        return 0;
+    }
+
+    /* Now we can pass at least a socket, but we have no connection yet. The function should return 0. */
+    BytesAvailable = 0xdeadbeef;
+    iResult = ioctlsocket(sck, FIONREAD, &BytesAvailable);
+    ok(iResult == 0, "iResult = %d\n", iResult);
+    ok(BytesAvailable == 0, "BytesAvailable = %ld\n", BytesAvailable);
+
+    /* Connect to "www.reactos.org" */
+    if (!ConnectToReactOSWebsite(sck))
+    {
+        ok(0, "ConnectToReactOSWebsite failed. Aborting test.\n");
+        return 0;
+    }
+
+    /* Even with a connection, there shouldn't be any bytes available. */
+    iResult = ioctlsocket(sck, FIONREAD, &BytesAvailable);
+    ok(iResult == 0, "iResult = %d\n", iResult);
+    ok(BytesAvailable == 0, "BytesAvailable = %ld\n", BytesAvailable);
+
+    /* Send the GET request */
+    if (!GetRequestAndWait(sck))
+    {
+        ok(0, "GetRequestAndWait failed. Aborting test.\n");
+        return 0;
+    }
+
+    /* Try ioctlsocket with FIONREAD. There should be bytes available now. */
+    SCKTEST(ioctlsocket(sck, FIONREAD, &BytesAvailable));
+    ok(BytesAvailable != 0, "BytesAvailable = %ld\n", BytesAvailable);
+
+    /* Get half of the data */
+    BytesToRead = BytesAvailable / 2;
+    pszBuf = (LPSTR) HeapAlloc(GetProcessHeap(), 0, BytesToRead);
+    SCKTEST(recv(sck, pszBuf, BytesToRead, 0));
+    HeapFree(GetProcessHeap(), 0, pszBuf);
+
+    BytesToRead = BytesAvailable - BytesToRead;
+
+    /* Now try ioctlsocket again. BytesAvailable should be at the value saved in BytesToRead now. */
+    SCKTEST(ioctlsocket(sck, FIONREAD, &BytesAvailable));
+    ok(BytesAvailable == BytesToRead, "BytesAvailable = %ld\n", BytesAvailable);
+
+    /* Read those bytes */
+    pszBuf = (LPSTR) HeapAlloc(GetProcessHeap(), 0, BytesToRead);
+    SCKTEST(recv(sck, pszBuf, BytesToRead, 0));
+    HeapFree(GetProcessHeap(), 0, pszBuf);
+
+    /* Try it for the last time. BytesAvailable should be at 0 now. */
+    SCKTEST(ioctlsocket(sck, FIONREAD, &BytesAvailable));
+    ok(BytesAvailable == 0, "BytesAvailable = %ld\n", BytesAvailable);
+
+    closesocket(sck);
+    WSACleanup();
+    return 1;
+}
+
+START_TEST(ioctlsocket)
+{
+    Test_ioctlsocket();
+}
+
similarity index 51%
rename from rostests/apitests/ws2_32/tests/recv.c
rename to rostests/apitests/ws2_32/recv.c
index 4df6c0e..aab7109 100644 (file)
@@ -1,20 +1,22 @@
 /*
 /*
- * PROJECT:     ws2_32.dll API tests
- * LICENSE:     GPLv2 or any later version
- * FILE:        apitests/ws2_32/tests/recv.c
- * PURPOSE:     Tests for the recv function
- * COPYRIGHT:   Copyright 2008 Colin Finck <mail@colinfinck.de>
+ * PROJECT:         ReactOS api tests
+ * LICENSE:         GPL - See COPYING in the top level directory
+ * PURPOSE:         Test for recv
+ * PROGRAMMERS:     Colin Finck
  */
 
  */
 
-#include "../ws2_32.h"
+#include <stdio.h>
+#include <wine/test.h>
+#include <windows.h>
+#include "ws2_32.h"
 
 #define RECV_BUF   4
 
 /* For valid test results, the ReactOS Website needs to return at least 8 bytes on a "GET / HTTP/1.0" request.
    Also the first 4 bytes and the last 4 bytes need to be different.
    Both factors usually apply on standard HTTP responses. */
 
 #define RECV_BUF   4
 
 /* For valid test results, the ReactOS Website needs to return at least 8 bytes on a "GET / HTTP/1.0" request.
    Also the first 4 bytes and the last 4 bytes need to be different.
    Both factors usually apply on standard HTTP responses. */
-INT
-Test_recv(PTESTINFO pti)
+
+int Test_recv()
 {
     const char szDummyBytes[RECV_BUF] = {0xFF, 0x00, 0xFF, 0x00};
 
 {
     const char szDummyBytes[RECV_BUF] = {0xFF, 0x00, 0xFF, 0x00};
 
@@ -25,45 +27,59 @@ Test_recv(PTESTINFO pti)
     WSADATA wdata;
 
     /* Start up Winsock */
     WSADATA wdata;
 
     /* Start up Winsock */
-    TEST(WSAStartup(MAKEWORD(2, 2), &wdata) == 0);
+    iResult = WSAStartup(MAKEWORD(2, 2), &wdata);
+    ok(iResult == 0, "WSAStartup failed, iResult == %d\n", iResult);
 
     /* If we call recv without a socket, it should return with an error and do nothing. */
     memcpy(szBuf1, szDummyBytes, RECV_BUF);
 
     /* If we call recv without a socket, it should return with an error and do nothing. */
     memcpy(szBuf1, szDummyBytes, RECV_BUF);
-    TEST(recv(0, szBuf1, RECV_BUF, 0) == SOCKET_ERROR);
-    TEST(!memcmp(szBuf1, szDummyBytes, RECV_BUF));
+    iResult = recv(0, szBuf1, RECV_BUF, 0);
+    ok(iResult == SOCKET_ERROR, "iRseult = %d\n", iResult);
+    ok(!memcmp(szBuf1, szDummyBytes, RECV_BUF), "not equal\n");
 
     /* Create the socket */
 
     /* Create the socket */
-    iResult = CreateSocket(pti, &sck);
-    if(iResult != APISTATUS_NORMAL)
-        return iResult;
+    if (!CreateSocket(&sck))
+    {
+        ok(0, "CreateSocket failed. Aborting test.\n");
+        return 0;
+    }
 
     /* Now we can pass at least a socket, but we have no connection yet. Should return with an error and do nothing. */
     memcpy(szBuf1, szDummyBytes, RECV_BUF);
 
     /* Now we can pass at least a socket, but we have no connection yet. Should return with an error and do nothing. */
     memcpy(szBuf1, szDummyBytes, RECV_BUF);
-    TEST(recv(sck, szBuf1, RECV_BUF, 0) == SOCKET_ERROR);
-    TEST(!memcmp(szBuf1, szDummyBytes, RECV_BUF));
+    iResult = recv(sck, szBuf1, RECV_BUF, 0);
+    ok(iResult == SOCKET_ERROR, "iResult = %d\n", iResult);
+    ok(!memcmp(szBuf1, szDummyBytes, RECV_BUF), "not equal\n");
 
     /* Connect to "www.reactos.org" */
 
     /* Connect to "www.reactos.org" */
-    iResult = ConnectToReactOSWebsite(pti, sck);
-    if(iResult != APISTATUS_NORMAL)
-        return iResult;
+    if (!ConnectToReactOSWebsite(sck))
+    {
+        ok(0, "ConnectToReactOSWebsite failed. Aborting test.\n");
+        return 0;
+    }
 
     /* Send the GET request */
 
     /* Send the GET request */
-    iResult = GetRequestAndWait(pti, sck);
-    if(iResult != APISTATUS_NORMAL)
-        return iResult;
+    if (!GetRequestAndWait(sck))
+    {
+        ok(0, "GetRequestAndWait failed. Aborting test.\n");
+        return 0;
+    }
 
     /* Receive the data.
        MSG_PEEK will not change the internal number of bytes read, so that a subsequent request should return the same bytes again. */
     SCKTEST(recv(sck, szBuf1, RECV_BUF, MSG_PEEK));
     SCKTEST(recv(sck, szBuf2, RECV_BUF, 0));
 
     /* Receive the data.
        MSG_PEEK will not change the internal number of bytes read, so that a subsequent request should return the same bytes again. */
     SCKTEST(recv(sck, szBuf1, RECV_BUF, MSG_PEEK));
     SCKTEST(recv(sck, szBuf2, RECV_BUF, 0));
-    TEST(!memcmp(szBuf1, szBuf2, RECV_BUF));
+    ok(!memcmp(szBuf1, szBuf2, RECV_BUF), "not equal\n");
 
     /* The last recv() call moved the internal file pointer, so that the next request should return different data. */
     SCKTEST(recv(sck, szBuf1, RECV_BUF, 0));
 
     /* The last recv() call moved the internal file pointer, so that the next request should return different data. */
     SCKTEST(recv(sck, szBuf1, RECV_BUF, 0));
-    TEST(memcmp(szBuf1, szBuf2, RECV_BUF));
+    ok(memcmp(szBuf1, szBuf2, RECV_BUF), "equal\n");
 
     closesocket(sck);
     WSACleanup();
 
     closesocket(sck);
     WSACleanup();
+    return 1;
+}
 
 
-    return APISTATUS_NORMAL;
+START_TEST(recv)
+{
+    Test_recv();
 }
 }
+
index fa57980..e760096 100644 (file)
@@ -1,33 +1,18 @@
-/*
- * PROJECT:     ws2_32.dll API tests
- * LICENSE:     GPLv2 or any later version
- * FILE:        apitests/ws2_32/testlist.c
- * PURPOSE:     Test list file
- * COPYRIGHT:   Copyright 2008 Colin Finck <mail@colinfinck.de>
- */
+#define WIN32_LEAN_AND_MEAN
+#define __ROS_LONG64__
+#include <windows.h>
 
 
-#ifndef _WS2_32_TESTLIST_H
-#define _WS2_32_TESTLIST_H
+#define STANDALONE
+#include "wine/test.h"
 
 
-#define ARRAY_SIZE(x)   (sizeof(x)/sizeof(x[0]))
+extern void func_ioctlsocket(void);
+extern void func_recv(void);
 
 
-#include "ws2_32.h"
-
-/* include the tests */
-#include "tests/ioctlsocket.c"
-#include "tests/recv.c"
-
-/* The List of tests */
-TESTENTRY TestList[] =
+const struct test winetest_testlist[] =
 {
 {
-    { L"ioctlsocket", Test_ioctlsocket },
-    { L"recv", Test_recv }
-};
+    { "ioctlsocket", func_ioctlsocket },
+    { "recv", func_recv },
 
 
-/* The function that gives us the number of tests */
-INT NumTests(void)
-{
-    return ARRAY_SIZE(TestList);
-}
+    { 0, 0 }
+};
 
 
-#endif
diff --git a/rostests/apitests/ws2_32/tests/ioctlsocket.c b/rostests/apitests/ws2_32/tests/ioctlsocket.c
deleted file mode 100644 (file)
index 2d291f7..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * PROJECT:     ws2_32.dll API tests
- * LICENSE:     GPLv2 or any later version
- * FILE:        apitests/ws2_32/tests/ioctlsocket.c
- * PURPOSE:     Tests for the ioctlsocket function
- * COPYRIGHT:   Copyright 2008 Colin Finck <mail@colinfinck.de>
- */
-
-#include "../ws2_32.h"
-
-/* For valid test results, the ReactOS Website needs to return at least 2 bytes on a "GET / HTTP/1.0" request. */
-INT
-Test_ioctlsocket(PTESTINFO pti)
-{
-    LPSTR pszBuf;
-    int iResult;
-    SOCKET sck;
-    ULONG BytesAvailable;
-    ULONG BytesToRead;
-    WSADATA wdata;
-
-    /* Start up Winsock */
-    TEST(WSAStartup(MAKEWORD(2, 2), &wdata) == 0);
-
-    /* If we call ioctlsocket without a socket, it should return with an error and do nothing. */
-    BytesAvailable = 0xdeadbeef;
-    TEST(ioctlsocket(0, FIONREAD, &BytesAvailable) == SOCKET_ERROR);
-    TEST(BytesAvailable == 0xdeadbeef);
-
-    /* Create the socket */
-    iResult = CreateSocket(pti, &sck);
-    if(iResult != APISTATUS_NORMAL)
-        return iResult;
-
-    /* Now we can pass at least a socket, but we have no connection yet. The function should return 0. */
-    BytesAvailable = 0xdeadbeef;
-    TEST(ioctlsocket(sck, FIONREAD, &BytesAvailable) == 0);
-    TEST(BytesAvailable == 0);
-
-    /* Connect to "www.reactos.org" */
-    iResult = ConnectToReactOSWebsite(pti, sck);
-    if(iResult != APISTATUS_NORMAL)
-        return iResult;
-
-    /* Even with a connection, there shouldn't be any bytes available. */
-    TEST(ioctlsocket(sck, FIONREAD, &BytesAvailable) == 0);
-    TEST(BytesAvailable == 0);
-
-    /* Send the GET request */
-    iResult = GetRequestAndWait(pti, sck);
-    if(iResult != APISTATUS_NORMAL)
-        return iResult;
-
-    /* Try ioctlsocket with FIONREAD. There should be bytes available now. */
-    SCKTEST(ioctlsocket(sck, FIONREAD, &BytesAvailable));
-    TEST(BytesAvailable != 0);
-
-    /* Get half of the data */
-    BytesToRead = BytesAvailable / 2;
-    pszBuf = (LPSTR) HeapAlloc(g_hHeap, 0, BytesToRead);
-    SCKTEST(recv(sck, pszBuf, BytesToRead, 0));
-    HeapFree(g_hHeap, 0, pszBuf);
-
-    BytesToRead = BytesAvailable - BytesToRead;
-
-    /* Now try ioctlsocket again. BytesAvailable should be at the value saved in BytesToRead now. */
-    SCKTEST(ioctlsocket(sck, FIONREAD, &BytesAvailable));
-    TEST(BytesAvailable == BytesToRead);
-
-    /* Read those bytes */
-    pszBuf = (LPSTR) HeapAlloc(g_hHeap, 0, BytesToRead);
-    SCKTEST(recv(sck, pszBuf, BytesToRead, 0));
-    HeapFree(g_hHeap, 0, pszBuf);
-
-    /* Try it for the last time. BytesAvailable should be at 0 now. */
-    SCKTEST(ioctlsocket(sck, FIONREAD, &BytesAvailable));
-    TEST(BytesAvailable == 0);
-
-    closesocket(sck);
-    WSACleanup();
-
-    return APISTATUS_NORMAL;
-}
diff --git a/rostests/apitests/ws2_32/ws2_32.c b/rostests/apitests/ws2_32/ws2_32.c
deleted file mode 100644 (file)
index 42e8a9b..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * PROJECT:     ws2_32.dll API tests
- * LICENSE:     GPLv2 or any later version
- * FILE:        apitests/ws2_32/ws2_32.c
- * PURPOSE:     Program entry point
- * COPYRIGHT:   Copyright 2008 Colin Finck <mail@colinfinck.de>
- */
-
-#include "ws2_32.h"
-
-HANDLE g_hHeap;
-
-BOOL
-IsFunctionPresent(LPWSTR lpszFunction)
-{
-    return TRUE;
-}
-
-int wmain()
-{
-    g_hHeap = GetProcessHeap();
-
-    return TestMain(L"ws2_32_apitests", L"ws2_32.dll");
-}
index 6fe5240..e6fedc2 100644 (file)
 
 #include <winsock2.h>
 
 
 #include <winsock2.h>
 
-#include "../apitest.h"
-
 /* Simple macro for executing a socket command and doing cleanup operations in case of a failure */
 #define SCKTEST(_cmd_) \
     iResult = _cmd_; \
 /* Simple macro for executing a socket command and doing cleanup operations in case of a failure */
 #define SCKTEST(_cmd_) \
     iResult = _cmd_; \
-    TEST(iResult != SOCKET_ERROR); \
+    ok(iResult != SOCKET_ERROR, "iResult = %d\n", iResult); \
     if(iResult == SOCKET_ERROR) \
     { \
         printf("Winsock error code is %u\n", WSAGetLastError()); \
         closesocket(sck); \
         WSACleanup(); \
     if(iResult == SOCKET_ERROR) \
     { \
         printf("Winsock error code is %u\n", WSAGetLastError()); \
         closesocket(sck); \
         WSACleanup(); \
-        return APISTATUS_ASSERTION_FAILED; \
+        return 0; \
     }
 
 /* helpers.c */
     }
 
 /* helpers.c */
-int CreateSocket(PTESTINFO pti, SOCKET* sck);
-int ConnectToReactOSWebsite(PTESTINFO pti, SOCKET sck);
-int GetRequestAndWait(PTESTINFO pti, SOCKET sck);
+int CreateSocket(SOCKET* sck);
+int ConnectToReactOSWebsite(SOCKET sck);
+int GetRequestAndWait(SOCKET sck);
 
 /* ws2_32.c */
 extern HANDLE g_hHeap;
 
 /* ws2_32.c */
 extern HANDLE g_hHeap;
diff --git a/rostests/apitests/ws2_32/ws2_32.rbuild b/rostests/apitests/ws2_32/ws2_32.rbuild
deleted file mode 100644 (file)
index c00e7a2..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<module name="ws2_32_apitests" type="win32cui" unicode="yes">
-       <library>apitest</library>
-       <library>user32</library>
-       <library>shell32</library>
-       <library>ws2_32</library>
-       <file>helpers.c</file>
-       <file>testlist.c</file>
-       <file>ws2_32.c</file>
-</module>
diff --git a/rostests/apitests/ws2_32/ws2_32_apitest.rbuild b/rostests/apitests/ws2_32/ws2_32_apitest.rbuild
new file mode 100644 (file)
index 0000000..3564258
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
+<group>
+<module name="ws2_32_apitest" type="win32cui" installbase="bin" installname="ws2_32_apitest.exe">
+       <include base="ws2_32_apitest">.</include>
+       <library>wine</library>
+       <library>gdi32</library>
+       <library>user32</library>
+       <library>pseh</library>
+       <library>ws2_32</library>
+       <file>testlist.c</file>
+       <file>helpers.c</file>
+
+       <file>ioctlsocket.c</file>
+       <file>recv.c</file>
+
+</module>
+</group>