Author: tkreuzer
Date: Wed Aug 8 03:13:25 2007
New Revision: 28232
URL:
http://svn.reactos.org/svn/reactos?rev=28232&view=rev
Log:
- restructure syscall code, add edi to RosSyscall clobber list
- more NtGdiGetRandomRgn tests
- more TEST -> RTEST
Modified:
trunk/rostests/apitests/gdi32api/tests/CreatePen.c
trunk/rostests/apitests/gdi32api/tests/GetObject.c
trunk/rostests/apitests/gdi32api/tests/GetStockObject.c
trunk/rostests/apitests/w32knapi/ntgdi/NtGdiGetRandomRgn.c
trunk/rostests/apitests/w32knapi/w32knapi.c
trunk/rostests/apitests/w32knapi/w32knapi.h
Modified: trunk/rostests/apitests/gdi32api/tests/CreatePen.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/C…
==============================================================================
--- trunk/rostests/apitests/gdi32api/tests/CreatePen.c (original)
+++ trunk/rostests/apitests/gdi32api/tests/CreatePen.c Wed Aug 8 03:13:25 2007
@@ -8,15 +8,15 @@
SetLastError(ERROR_SUCCESS);
hPen = CreatePen(PS_DASHDOT, 5, RGB(1,2,3));
- TEST(hPen);
+ RTEST(hPen);
/* Test if we have a PEN */
- TEST(GDI_HANDLE_GET_TYPE(hPen) == GDI_OBJECT_TYPE_PEN);
+ RTEST(GDI_HANDLE_GET_TYPE(hPen) == GDI_OBJECT_TYPE_PEN);
GetObject(hPen, sizeof(logpen), &logpen);
- TEST(logpen.lopnStyle == PS_DASHDOT);
- TEST(logpen.lopnWidth.x == 5);
- TEST(logpen.lopnColor == RGB(1,2,3));
+ RTEST(logpen.lopnStyle == PS_DASHDOT);
+ RTEST(logpen.lopnWidth.x == 5);
+ RTEST(logpen.lopnColor == RGB(1,2,3));
DeleteObject(hPen);
/* PS_GEOMETRIC | PS_DASHDOT = 0x00001011 will become PS_SOLID */
Modified: trunk/rostests/apitests/gdi32api/tests/GetObject.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/G…
==============================================================================
--- trunk/rostests/apitests/gdi32api/tests/GetObject.c (original)
+++ trunk/rostests/apitests/gdi32api/tests/GetObject.c Wed Aug 8 03:13:25 2007
@@ -258,24 +258,24 @@
TEST(GetObject(hPen, 0, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD));
TEST(GetObject((HANDLE)GDI_HANDLE_GET_INDEX(hPen), 0, NULL) ==
sizeof(EXTLOGPEN)-sizeof(DWORD));
TEST(GetObject(hPen, 5, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD));
- TEST(GetObject(hPen, -5, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD));
- TEST(GetObject(hPen, 0, &extlogpen) == 0);
- TEST(GetObject(hPen, 4, &extlogpen) == 0);
+ RTEST(GetObject(hPen, -5, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD));
+ RTEST(GetObject(hPen, 0, &extlogpen) == 0);
+ RTEST(GetObject(hPen, 4, &extlogpen) == 0);
/* Nothing should be filled */
- TEST(extlogpen.elpPenStyle == 0x77777777);
- TEST(extlogpen.elpWidth == 0x77777777);
-
- TEST(GetObject(hPen, sizeof(EXTLOGPEN), &extlogpen) ==
sizeof(EXTLOGPEN)-sizeof(DWORD));
- TEST(GetObject(hPen, sizeof(EXTLOGPEN)-sizeof(DWORD), &extlogpen) ==
sizeof(EXTLOGPEN)-sizeof(DWORD));
- TEST(GetObject(hPen, sizeof(EXTLOGPEN)-sizeof(DWORD)-1, &extlogpen) == 0);
- TEST(GetObject(hPen, sizeof(EXTLOGPEN)+2, &extlogpen) ==
sizeof(EXTLOGPEN)-sizeof(DWORD));
- TEST(GetObject(hPen, -5, &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD));
+ RTEST(extlogpen.elpPenStyle == 0x77777777);
+ RTEST(extlogpen.elpWidth == 0x77777777);
+
+ RTEST(GetObject(hPen, sizeof(EXTLOGPEN), &extlogpen) ==
sizeof(EXTLOGPEN)-sizeof(DWORD));
+ RTEST(GetObject(hPen, sizeof(EXTLOGPEN)-sizeof(DWORD), &extlogpen) ==
sizeof(EXTLOGPEN)-sizeof(DWORD));
+ RTEST(GetObject(hPen, sizeof(EXTLOGPEN)-sizeof(DWORD)-1, &extlogpen) == 0);
+ RTEST(GetObject(hPen, sizeof(EXTLOGPEN)+2, &extlogpen) ==
sizeof(EXTLOGPEN)-sizeof(DWORD));
+ RTEST(GetObject(hPen, -5, &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD));
/* test if the fields are filled correctly */
- TEST(extlogpen.elpPenStyle == (PS_GEOMETRIC | PS_DASH));
- TEST(extlogpen.elpWidth == 5);
- TEST(extlogpen.elpBrushStyle == 0);
+ RTEST(extlogpen.elpPenStyle == (PS_GEOMETRIC | PS_DASH));
+ RTEST(extlogpen.elpWidth == 5);
+ RTEST(extlogpen.elpBrushStyle == 0);
RTEST(extlogpen.elpColor == RGB(1,2,3));
RTEST(extlogpen.elpHatch == 22);
RTEST(extlogpen.elpNumEntries == 0);
Modified: trunk/rostests/apitests/gdi32api/tests/GetStockObject.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/G…
==============================================================================
--- trunk/rostests/apitests/gdi32api/tests/GetStockObject.c (original)
+++ trunk/rostests/apitests/gdi32api/tests/GetStockObject.c Wed Aug 8 03:13:25 2007
@@ -5,10 +5,10 @@
{
/* Test limits and error */
SetLastError(ERROR_SUCCESS);
- TEST(GetStockObject(0) != NULL);
+ RTEST(GetStockObject(0) != NULL);
TEST(GetStockObject(21) != NULL);
- TEST(GetStockObject(-1) == NULL);
- TEST(GetStockObject(9) == NULL);
+ RTEST(GetStockObject(-1) == NULL);
+ RTEST(GetStockObject(9) == NULL);
RTEST(GetStockObject(22) == NULL);
RTEST(GetLastError() == ERROR_SUCCESS);
Modified: trunk/rostests/apitests/w32knapi/ntgdi/NtGdiGetRandomRgn.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/ntgdi/N…
==============================================================================
--- trunk/rostests/apitests/w32knapi/ntgdi/NtGdiGetRandomRgn.c (original)
+++ trunk/rostests/apitests/w32knapi/ntgdi/NtGdiGetRandomRgn.c Wed Aug 8 03:13:25 2007
@@ -31,43 +31,63 @@
hrgn = CreateRectRgn(0,0,0,0);
hrgn2 = CreateRectRgn(3,3,10,10);
SetLastError(ERROR_SUCCESS);
- TEST(NtGdiGetRandomRgn(0, hrgn, 0) == -1);
- TEST(GetLastError() == ERROR_INVALID_HANDLE);
+ RTEST(NtGdiGetRandomRgn(0, hrgn, 0) == -1);
+ RTEST(GetLastError() == ERROR_INVALID_HANDLE);
SetLastError(ERROR_SUCCESS);
- TEST(NtGdiGetRandomRgn(hDC, 0, 0) == 0);
- TEST(NtGdiGetRandomRgn(hDC, (HRGN)-5, 0) == 0);
- TEST(NtGdiGetRandomRgn(hDC, hrgn, 0) == 0);
- TEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 0);
+ RTEST(NtGdiGetRandomRgn((HDC)2345, hrgn, 1) == -1);
+ RTEST(GetLastError() == ERROR_INVALID_HANDLE);
+
+ SetLastError(ERROR_SUCCESS);
+ RTEST(NtGdiGetRandomRgn((HDC)2345, hrgn, 10) == -1);
+ RTEST(GetLastError() == ERROR_INVALID_HANDLE);
+
+ SetLastError(ERROR_SUCCESS);
+ RTEST(NtGdiGetRandomRgn((HDC)2345, (HRGN)10, 10) == -1);
+ RTEST(GetLastError() == ERROR_INVALID_HANDLE);
+
+ SetLastError(ERROR_SUCCESS);
+ RTEST(NtGdiGetRandomRgn((HDC)2345, 0, 1) == -1);
+ RTEST(GetLastError() == ERROR_INVALID_HANDLE);
+
+ SetLastError(ERROR_SUCCESS);
+ RTEST(NtGdiGetRandomRgn(hDC, 0, 0) == 0);
+ RTEST(NtGdiGetRandomRgn(hDC, 0, 1) == 0);
+ RTEST(NtGdiGetRandomRgn(hDC, (HRGN)-5, 0) == 0);
+ RTEST(NtGdiGetRandomRgn(hDC, (HRGN)-5, 1) == 0);
+ RTEST(NtGdiGetRandomRgn(hDC, hrgn, 0) == 0);
+ RTEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 0);
TEST(NtGdiGetRandomRgn(hDC, hrgn, 2) == 0);
- TEST(NtGdiGetRandomRgn(hDC, hrgn, 3) == 0);
- TEST(NtGdiGetRandomRgn(hDC, hrgn, 4) == 1);
- TEST(NtGdiGetRandomRgn(hDC, hrgn, 5) == 0);
- TEST(NtGdiGetRandomRgn(hDC, hrgn, 10) == 0);
- TEST(NtGdiGetRandomRgn(hDC, hrgn, -10) == 0);
+ RTEST(NtGdiGetRandomRgn(hDC, hrgn, 3) == 0);
+ RTEST(NtGdiGetRandomRgn(hDC, hrgn, 4) == 1);
+ RTEST(NtGdiGetRandomRgn(hDC, hrgn, 5) == 0);
+ RTEST(NtGdiGetRandomRgn(hDC, hrgn, 10) == 0);
+ RTEST(NtGdiGetRandomRgn(hDC, hrgn, -10) == 0);
RTEST(GetLastError() == ERROR_SUCCESS);
SelectClipRgn(hDC, hrgn2);
- TEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 1);
- TEST(CombineRgn(hrgn, hrgn, hrgn, RGN_OR) == SIMPLEREGION);
- TEST(CombineRgn(hrgn, hrgn, hrgn2, RGN_XOR) == NULLREGION);
+ TEST(NtGdiGetRandomRgn(hDC, 0, 1) == -1);
+ RTEST(GetLastError() == ERROR_SUCCESS);
+ RTEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 1);
+ RTEST(CombineRgn(hrgn, hrgn, hrgn, RGN_OR) == SIMPLEREGION);
+ RTEST(CombineRgn(hrgn, hrgn, hrgn2, RGN_XOR) == NULLREGION);
SetRectRgn(hrgn2,0,0,0,0);
SelectClipRgn(hDC, hrgn2);
- TEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 1);
+ RTEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 1);
- TEST(CombineRgn(hrgn2, hrgn, hrgn2, RGN_XOR) == NULLREGION);
- TEST(CombineRgn(hrgn2, hrgn, hrgn, RGN_OR) == NULLREGION);
+ RTEST(CombineRgn(hrgn2, hrgn, hrgn2, RGN_XOR) == NULLREGION);
+ RTEST(CombineRgn(hrgn2, hrgn, hrgn, RGN_OR) == NULLREGION);
SelectClipRgn(hDC, NULL);
- TEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 0);
+ RTEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 0);
- TEST(NtGdiGetRandomRgn(hDC, hrgn, 4) == 1);
+ RTEST(NtGdiGetRandomRgn(hDC, hrgn, 4) == 1);
RTEST(GetLastError() == ERROR_SUCCESS);
- DeleteDC(hDC);
+ ReleaseDC(hWnd, hDC);
DestroyWindow(hWnd);
return APISTATUS_NORMAL;
Modified: trunk/rostests/apitests/w32knapi/w32knapi.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/w32knap…
==============================================================================
--- trunk/rostests/apitests/w32knapi/w32knapi.c (original)
+++ trunk/rostests/apitests/w32knapi/w32knapi.c Wed Aug 8 03:13:25 2007
@@ -49,37 +49,6 @@
return FALSE;
}
-
-static BOOL
-RosSyscall(LPWSTR lpszFunction, int cParams, void* pParams, DWORD* pResult)
-{
- DWORD ret;
- char szFunctionName[MAX_PATH];
- int ParamSize = cParams * 4;
-
- sprintf(szFunctionName, "%ls", lpszFunction);
- FARPROC proc = (FARPROC)GetProcAddress(g_hModule, szFunctionName);
- if (!proc)
- {
- printf("Couldn't find proc: %s\n", szFunctionName);
- return FALSE;
- }
-
- asm volatile
- (
- "subl %%eax, %%esp;" // calculate new stack pos
- "movl %%esp, %%edi;" // destination is stackpointer
- "cld;" // clear direction flag
- "rep movsd;" // copy params to the stack
- "call *%%edx" // call function
- : "=a" (ret)
- : "c" (cParams), "a" (ParamSize), "S"(pParams),
"d"(proc)
- );
-
- *pResult = ret;
- return TRUE;
-}
-
static PSYSCALL_ENTRY
GetSyscallEntry(LPWSTR lpszFunction)
{
@@ -95,31 +64,60 @@
return NULL;
}
-static BOOL
-WinSyscall(LPWSTR pszFunction, void* pParams, void* pResult)
+static DWORD STDCALL
+WinSyscall(INT nSyscalNum, PVOID pFirstParam)
{
- PSYSCALL_ENTRY pEntry = GetSyscallEntry(pszFunction);
+ DWORD ret;
+ asm volatile ("int $0x2e\n" : "=a"(ret): "a" (nSyscalNum),
"d" (pFirstParam));
+ return ret;
+}
+
+static DWORD STDCALL
+RosSyscall(FARPROC proc, UINT cParams, PVOID pFirstParam)
+{
DWORD ret;
- asm volatile ("int $0x2e\n" : "=a"(ret): "a"
(pEntry->nSyscallNum), "d" (pParams));\
- *((DWORD*)pResult) = ret;
- return FALSE;
+ asm volatile
+ (
+ "pushfl;" // Save flags
+ "movl %%ecx, %%eax;"
+ "shl $2, %%eax;" // Calculate param size
+ "subl %%eax, %%esp;" // Calculate new stack pos
+ "movl %%esp, %%edi;" // Destination is stackpointer
+ "cld;" // Clear direction flag
+ "rep movsd;" // Copy params to the stack
+ "call *%%edx;" // Call function
+ "popfl;" // Restore flags
+ : "=a" (ret)
+ : "S" (pFirstParam), "c" (cParams), "d"(proc)
+ : "%edi"
+ );
+
+ return ret;
}
DWORD
Syscall(LPWSTR pszFunction, int cParams, void* pParams)
{
- DWORD dwRet = 0;
+ if (g_nOs == OS_REACTOS)
+ {
+ char szFunctionName[MAX_PATH];
- if (g_nOs == OS_REACTOS)
- {
- RosSyscall(pszFunction, cParams, pParams, &dwRet);
+ sprintf(szFunctionName, "%ls", pszFunction);
+ FARPROC proc = (FARPROC)GetProcAddress(g_hModule, szFunctionName);
+ if (!proc)
+ {
+ printf("Couldn't find proc: %s\n", szFunctionName);
+ return FALSE;
+ }
+
+ return RosSyscall(proc, cParams, pParams);
}
else
{
- WinSyscall(pszFunction, pParams, &dwRet);
+ PSYSCALL_ENTRY pEntry = GetSyscallEntry(pszFunction);
+ return WinSyscall(pEntry->nSyscallNum, pParams);
}
- return dwRet;
}
BOOL
Modified: trunk/rostests/apitests/w32knapi/w32knapi.h
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/w32knap…
==============================================================================
--- trunk/rostests/apitests/w32knapi/w32knapi.h (original)
+++ trunk/rostests/apitests/w32knapi/w32knapi.h Wed Aug 8 03:13:25 2007
@@ -10,6 +10,7 @@
#include <win32k/callback.h>
#include <win32k/ntusrtyp.h>
#include <win32k/ntgdityp.h>
+#include <win32k/ntgdihdl.h>
#define OS_UNSUPPORTED 0
#define OS_REACTOS 1