Author: tkreuzer
Date: Sun Aug 9 13:27:25 2009
New Revision: 42552
URL:
http://svn.reactos.org/svn/reactos?rev=42552&view=rev
Log:
win32knapi: More / improved tests for NtUserSystemParametersInfo, NtGdiSelectBrush,
NtGdiSelectBitmap, NtGdiGetFontResourceInfoInternalW, NtGdiDoPalette
Modified:
trunk/rostests/apitests/w32knapi/ntgdi/NtGdiCreateDIBSection.c
trunk/rostests/apitests/w32knapi/ntgdi/NtGdiDoPalette.c
trunk/rostests/apitests/w32knapi/ntgdi/NtGdiGetFontResourceInfoInternalW.c
trunk/rostests/apitests/w32knapi/ntgdi/NtGdiSelectBitmap.c
trunk/rostests/apitests/w32knapi/ntgdi/NtGdiSelectBrush.c
trunk/rostests/apitests/w32knapi/ntuser/NtUserSelectPalette.c
trunk/rostests/apitests/w32knapi/ntuser/NtUserSystemParametersInfo.c
trunk/rostests/apitests/w32knapi/testlist.c
trunk/rostests/apitests/w32knapi/w32knapi.c
trunk/rostests/apitests/w32knapi/w32knapi.h
Modified: trunk/rostests/apitests/w32knapi/ntgdi/NtGdiCreateDIBSection.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/ntgdi/N…
==============================================================================
--- trunk/rostests/apitests/w32knapi/ntgdi/NtGdiCreateDIBSection.c [iso-8859-1]
(original)
+++ trunk/rostests/apitests/w32knapi/ntgdi/NtGdiCreateDIBSection.c [iso-8859-1] Sun Aug 9
13:27:25 2009
@@ -171,23 +171,28 @@
pbih->biBitCount = 4;
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, pbmi, 0, cjHeader, 0, 0, &pvBits);
TEST(hbmp != 0);
+ if (hbmp) DeleteObject(hbmp);
pbih->biBitCount = 8;
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, pbmi, 0, cjHeader, 0, 0, &pvBits);
TEST(hbmp != 0);
+ if (hbmp) DeleteObject(hbmp);
cjHeader = pbih->biSize;
pbih->biBitCount = 16;
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, pbmi, 0, cjHeader, 0, 0, &pvBits);
TEST(hbmp != 0);
+ if (hbmp) DeleteObject(hbmp);
pbih->biBitCount = 24;
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, pbmi, 0, cjHeader, 0, 0, &pvBits);
TEST(hbmp != 0);
+ if (hbmp) DeleteObject(hbmp);
pbih->biBitCount = 32;
hbmp = NtGdiCreateDIBSection(hDC, NULL, 0, pbmi, 0, cjHeader, 0, 0, &pvBits);
TEST(hbmp != 0);
+ if (hbmp) DeleteObject(hbmp);
/* Test BI_BITFIELDS */
cEntries = 3;
Modified: trunk/rostests/apitests/w32knapi/ntgdi/NtGdiDoPalette.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/ntgdi/N…
==============================================================================
--- trunk/rostests/apitests/w32knapi/ntgdi/NtGdiDoPalette.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/w32knapi/ntgdi/NtGdiDoPalette.c [iso-8859-1] Sun Aug 9
13:27:25 2009
@@ -206,6 +206,69 @@
INT
Test_NtGdiDoPalette_SetDIBColorTable(PTESTINFO pti)
{
+ HDC hdc;
+ HBITMAP hbmp;
+ BYTE *pjBits;
+
+ struct
+ {
+ BITMAPINFOHEADER bmiHeader;
+ ULONG bmiColors[10];
+ } bmi;
+
+ hdc = CreateCompatibleDC(0);
+ ASSERT(hdc);
+
+ bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bmi.bmiHeader.biWidth = 10;
+ bmi.bmiHeader.biHeight = 10;
+ bmi.bmiHeader.biPlanes = 1;
+ bmi.bmiHeader.biBitCount = 8;
+ bmi.bmiHeader.biCompression = BI_RGB;
+ bmi.bmiHeader.biSizeImage = 0;
+ bmi.bmiHeader.biXPelsPerMeter = 1;
+ bmi.bmiHeader.biYPelsPerMeter = 1;
+ bmi.bmiHeader.biClrUsed = 9;
+ bmi.bmiHeader.biClrImportant = 9;
+ bmi.bmiColors[0] = 0x000000;
+ bmi.bmiColors[1] = 0x202020;
+ bmi.bmiColors[2] = 0x404040;
+ bmi.bmiColors[3] = 0x606060;
+ bmi.bmiColors[4] = 0x808080;
+ bmi.bmiColors[5] = 0xA0A0A0;
+ bmi.bmiColors[6] = 0xC0C0C0;
+ bmi.bmiColors[7] = 0xE0E0E0;
+ bmi.bmiColors[8] = 0xffffff;
+ hbmp = CreateDIBSection(hdc, (BITMAPINFO*)&bmi, DIB_PAL_COLORS,
(PVOID*)&pjBits, NULL, 0);
+ ASSERT(hbmp);
+ ASSERT(pjBits);
+
+ SelectObject(hdc, hbmp);
+
+
+ pjBits[0] = 8;
+ pjBits[1] = 1;
+ pjBits[2] = 2;
+ pjBits[3] = 3;
+
+ bmi.bmiColors[8] = 0x000000;
+ bmi.bmiColors[7] = 0x202020;
+ bmi.bmiColors[6] = 0x404040;
+ bmi.bmiColors[5] = 0x606060;
+ bmi.bmiColors[4] = 0x808080;
+ bmi.bmiColors[3] = 0xA0A0A0;
+ bmi.bmiColors[2] = 0xC0C0C0;
+ bmi.bmiColors[1] = 0xE0E0E0;
+ bmi.bmiColors[0] = 0xffffff;
+ TEST(NtGdiDoPalette(hdc, 0, 9, &bmi.bmiColors, GdiPalSetColorTable, FALSE) == 9);
+
+ SetDCPenColor(hdc, 0xE0E0E0);
+ SetDCBrushColor(hdc, 0x202020);
+ Rectangle(hdc, 0, 0, 10, 10);
+
+ DeleteDC(hdc);
+ DeleteObject(hbmp);
+
return APISTATUS_NORMAL;
}
Modified: trunk/rostests/apitests/w32knapi/ntgdi/NtGdiGetFontResourceInfoInternalW.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/ntgdi/N…
==============================================================================
--- trunk/rostests/apitests/w32knapi/ntgdi/NtGdiGetFontResourceInfoInternalW.c
[iso-8859-1] (original)
+++ trunk/rostests/apitests/w32knapi/ntgdi/NtGdiGetFontResourceInfoInternalW.c
[iso-8859-1] Sun Aug 9 13:27:25 2009
@@ -2,18 +2,12 @@
INT
Test_NtGdiGetFontResourceInfoInternalW(PTESTINFO pti)
{
- WCHAR szFullFileName[MAX_PATH+1];
BOOL bRet;
DWORD dwBufSize;
LOGFONTW logfont;
UNICODE_STRING NtFileName;
- GetCurrentDirectoryW(MAX_PATH, szFullFileName);
- wcscat(szFullFileName, L"\\test.otf");
-
- ASSERT(AddFontResourceW(szFullFileName) != 0);
-
- ASSERT(RtlDosPathNameToNtPathName_U(szFullFileName,
+ ASSERT(RtlDosPathNameToNtPathName_U(L".\\test.otf",
&NtFileName,
NULL,
NULL));
@@ -36,7 +30,7 @@
printf("lfWidth = %ld\n", logfont.lfWidth);
printf("lfFaceName = %ls\n", logfont.lfFaceName);
- RemoveFontResourceW(szFullFileName);
+// RemoveFontResourceW(szFullFileName);
return APISTATUS_NORMAL;
}
Modified: trunk/rostests/apitests/w32knapi/ntgdi/NtGdiSelectBitmap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/ntgdi/N…
==============================================================================
--- trunk/rostests/apitests/w32knapi/ntgdi/NtGdiSelectBitmap.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/w32knapi/ntgdi/NtGdiSelectBitmap.c [iso-8859-1] Sun Aug 9
13:27:25 2009
@@ -1,3 +1,41 @@
+
+INT
+Test_SelectDIBSection(PTESTINFO pti)
+{
+ HDC hdc;
+ HBITMAP hbmp;
+ struct
+ {
+ BITMAPINFOHEADER bmiHeader;
+ RGBQUAD bmiColors[100];
+ } bmi;
+ PBITMAPINFO pbmi = (PBITMAPINFO)&bmi;
+ PVOID pvBits;
+
+ hdc = CreateCompatibleDC(0);
+ ASSERT(hdc);
+
+ bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bmi.bmiHeader.biWidth = 2;
+ bmi.bmiHeader.biHeight = 2;
+ bmi.bmiHeader.biPlanes = 1;
+ bmi.bmiHeader.biBitCount = 1;
+ bmi.bmiHeader.biCompression = BI_RGB;
+ bmi.bmiHeader.biSizeImage = 0;
+ bmi.bmiHeader.biXPelsPerMeter = 100;
+ bmi.bmiHeader.biYPelsPerMeter = 100;
+ bmi.bmiHeader.biClrUsed = 2;
+ bmi.bmiHeader.biClrImportant = 2;
+
+ hbmp = CreateDIBSection(hdc, pbmi, DIB_PAL_COLORS, &pvBits, NULL, 0);
+ ASSERT(hbmp);
+
+ TEST(NtGdiSelectBitmap(hdc, hbmp) != 0);
+
+ return 0;
+}
+
+
INT
Test_NtGdiSelectBitmap(PTESTINFO pti)
{
@@ -68,6 +106,8 @@
DeleteObject(hBmp);
DeleteDC(hDC);
+ Test_SelectDIBSection(pti);
+
return APISTATUS_NORMAL;
}
Modified: trunk/rostests/apitests/w32knapi/ntgdi/NtGdiSelectBrush.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/ntgdi/N…
==============================================================================
--- trunk/rostests/apitests/w32knapi/ntgdi/NtGdiSelectBrush.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/w32knapi/ntgdi/NtGdiSelectBrush.c [iso-8859-1] Sun Aug 9
13:27:25 2009
@@ -3,6 +3,7 @@
{
HDC hDC;
HBRUSH hBrush, hOldBrush;
+ DC_ATTR *pdcattr;
hDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL);
@@ -39,6 +40,25 @@
TEST(hOldBrush == hBrush);
TEST(GetLastError() == ERROR_SUCCESS);
+ /* Begin with a white brush */
+ NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH));
+ /* Select a brush in user mode */
+ SelectObject(hDC, GetStockObject(BLACK_BRUSH));
+ /* See what we get returned */
+ hOldBrush = NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH));
+ TEST(hOldBrush == GetStockObject(BLACK_BRUSH));
+
+
+ /* Begin with a white brush */
+ NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH));
+
+ pdcattr = GetHandleUserData(hDC);
+ /* Change the brush in user mode, without setting flags */
+ pdcattr->hbrush = (HBRUSH)12345;
+
+ hOldBrush = NtGdiSelectBrush(hDC, GetStockObject(BLACK_BRUSH));
+ TEST(hOldBrush == (HBRUSH)12345);
+
DeleteDC(hDC);
Modified: trunk/rostests/apitests/w32knapi/ntuser/NtUserSelectPalette.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/ntuser/…
==============================================================================
--- trunk/rostests/apitests/w32knapi/ntuser/NtUserSelectPalette.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/w32knapi/ntuser/NtUserSelectPalette.c [iso-8859-1] Sun Aug 9
13:27:25 2009
@@ -88,5 +88,61 @@
TEST(hOldPal != 0);
+
+#if 0
+ RealizePalette(hDC);
+
+ GetClientRect(hWnd, &rect);
+ FillRect(hDC, &rect, GetSysColorBrush(COLOR_BTNSHADOW));
+
+ TEST(GetNearestColor(hDC, RGB(0,0,0)) == RGB(0,0,0));
+ TEST(GetNearestColor(hDC, RGB(0,0,1)) == RGB(0,0,1));
+
+ ReleaseDC(hWnd, hDC);
+ DestroyWindow(hWnd);
+ RECT rect;
+ HBITMAP hBmp;
+
+
+ BITMAPINFOHEADER bmih = {sizeof(BITMAPINFOHEADER), // biSize
+ 3, // biWidth
+ 3, // biHeight
+ 1, // biPlanes
+ 8, // biBitCount
+ BI_RGB, // biCompression
+ 0, // biSizeImage
+ 92, // biXPelsPerMeter
+ 92, // biYPelsPerMeter
+ 6, // biClrUsed
+ 6}; // biClrImportant
+ BYTE bits[3][3] = {{0,1,2},{3,4,5},{6,1,2}};
+
+ struct
+ {
+ BITMAPINFOHEADER bmih;
+ RGBQUAD colors[6];
+ } bmi = {{sizeof(BITMAPINFOHEADER),3,3,1,8,BI_RGB,0,92,92,6,6},
+ {{0,0,0,0},{255,255,255,0},{255,0,0,0},
+ {0,255,0,0},{0,0,255,0},{128,128,128,0}}};
+
+ hBmp = CreateDIBitmap(hCompDC, &bmih, CBM_INIT, &bits, (BITMAPINFO*)&bmi,
DIB_RGB_COLORS);
+ ASSERT(hBmp);
+
+ SetLastError(0);
+ TEST(NtGdiSelectBitmap(hCompDC, hBmp));
+ hOldPal = NtUserSelectPalette(hCompDC, hPal, 0);
+ TEST(hOldPal != NULL);
+ RealizePalette(hCompDC);
+
+ TEST(GetNearestColor(hCompDC, RGB(0,0,0)) == RGB(0,0,0));
+ TEST(GetNearestColor(hCompDC, RGB(0,0,1)) == RGB(0,0,0));
+ TEST(GetNearestColor(hCompDC, RGB(100,0,0)) == RGB(0,0,0));
+ TEST(GetNearestColor(hCompDC, RGB(250,250,250)) == RGB(255,255,255));
+ TEST(GetNearestColor(hCompDC, RGB(120,100,110)) == RGB(128,128,128));
+
+printf("nearest = 0x%x\n", GetNearestColor(hCompDC, RGB(120,100,110)));
+#endif
+
+
return APISTATUS_NORMAL;
}
Modified: trunk/rostests/apitests/w32knapi/ntuser/NtUserSystemParametersInfo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/ntuser/…
==============================================================================
--- trunk/rostests/apitests/w32knapi/ntuser/NtUserSystemParametersInfo.c [iso-8859-1]
(original)
+++ trunk/rostests/apitests/w32knapi/ntuser/NtUserSystemParametersInfo.c [iso-8859-1] Sun
Aug 9 13:27:25 2009
@@ -1,6 +1,48 @@
+
+static const WCHAR* KEY_MOUSE = L"Control Panel\\Mouse";
+//static const WCHAR* VAL_MOUSE1 = L"MouseThreshold1";
+//static const WCHAR* VAL_MOUSE2 = L"MouseThreshold2";
+//static const WCHAR* VAL_MOUSE3 = L"MouseSpeed";
+//static const WCHAR* VAL_DBLCLKWIDTH = L"DoubleClickWidth";
+//static const WCHAR* VAL_DBLCLKHEIGHT = L"DoubleClickHeight";
+//static const WCHAR* VAL_DBLCLKTIME = L"DoubleClickSpeed";
+static const WCHAR* VAL_SWAP = L"SwapMouseButtons";
+
+static const WCHAR* KEY_DESKTOP = L"Control Panel\\Desktop";
+//static const WCHAR* VAL_SCRTO = L"ScreenSaveTimeOut";
+//static const WCHAR* VAL_SCRACT = L"ScreenSaveActive";
+//static const WCHAR* VAL_GRID = L"GridGranularity";
+//static const WCHAR* VAL_DRAG = L"DragFullWindows";
+//static const WCHAR* VAL_DRAGHEIGHT = L"DragHeight";
+//static const WCHAR* VAL_DRAGWIDTH = L"DragWidth";
+//static const WCHAR* VAL_FNTSMOOTH = L"FontSmoothing";
+static const WCHAR* VAL_PREFMASK = L"UserPreferencesMask";
+#define PREFMASK_MENUANIM 0x2
+#define PREFMASK_KBDCUES 0x20
+
+//static const WCHAR* KEY_MDALIGN = L"Software\\Microsoft\\Windows
NT\\CurrentVersion\\Windows";
+//static const WCHAR* VAL_MDALIGN = L"MenuDropAlignment";
+
+static const WCHAR* KEY_METRIC = L"Control Panel\\Desktop\\WindowMetrics";
+//static const WCHAR* VAL_BORDER = L"BorderWidth";
+//static const WCHAR* VAL_ICONSPC = L"IconSpacing";
+//static const WCHAR* VAL_ICONVSPC = L"IconVerticalspacing";
+//static const WCHAR* VAL_ITWRAP = L"IconTitleWrap";
+
+static const WCHAR* KEY_SOUND = L"Control Panel\\Sound";
+static const WCHAR* VAL_BEEP = L"Beep";
+
+//static const WCHAR* KEY_KBD = L"Control Panel\\Keyboard";
+//static const WCHAR* VAL_KBDSPD = L"KeyboardSpeed";
+//static const WCHAR* VAL_KBDDELAY = L"KeyboardDelay";
+
+//static const WCHAR* KEY_SHOWSNDS = L"Control
Panel\\Accessibility\\ShowSounds";
+//static const WCHAR* KEY_KDBPREF = L"Control Panel\\Accessibility\\Keyboard
Preference";
+//static const WCHAR* KEY_SCRREAD = L"Control Panel\\Accessibility\\Blind
Access";
+//static const WCHAR* VAL_ON = L"On";
LONG
-QueryUserRegValueW(LPWSTR pszSubKey, LPWSTR pszValueName, PVOID pData, LPDWORD cbSize,
LPDWORD pType)
+QueryUserRegValueW(PCWSTR pszSubKey, PCWSTR pszValueName, PVOID pData, LPDWORD cbSize,
LPDWORD pType)
{
HKEY hKey;
LONG ret;
@@ -40,24 +82,6 @@
NULL,
g_hInstance,
0);
-
-}
-
-void
-Test_SPI_87_88(PTESTINFO pti)
-{
- DWORD dwRet = 0xdeadbeef;
-
- TEST(NtUserSystemParametersInfo(87, 0, &dwRet, 0) == TRUE);
- TEST(dwRet == 0xdeadbeef);
- dwRet++;
- TEST(NtUserSystemParametersInfo(87, 0, &dwRet, 0) == TRUE);
-
-
- dwRet--;
- TEST(NtUserSystemParametersInfo(87, 0, &dwRet, 0) == TRUE);
-
-
}
void
@@ -67,7 +91,6 @@
DWORD data[1000];
UINT i, uint;
ACCESSTIMEOUT ato;
-#if 1
/* Test normal */
SetLastError(ERROR_SUCCESS);
TEST(NtUserSystemParametersInfo(SPI_GETFOCUSBORDERHEIGHT, 0, &uint, 0) == TRUE);
@@ -80,45 +103,45 @@
/* Test wrong cbSize member */
ato.cbSize = 1;
- SetLastError(ERROR_SUCCESS);
+ SetLastError(0xdeadbeef);
TEST(NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, 0, &ato, 0) == FALSE);
- TEST(GetLastError() == ERROR_SUCCESS);
-#endif
+ TEST(GetLastError() == 0xdeadbeef);
+#if 0
/* Test undocumented, but valid SPI codes */
for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef;
SetLastError(ERROR_SUCCESS);
- TEST(NtUserSystemParametersInfo(4112, 0, &data, 0) == TRUE);
+ TEST(NtUserSystemParametersInfo(0x1010, 0, &data, 0) == TRUE);
TEST(GetLastError() == ERROR_SUCCESS);
TEST(data[0] <= 1);
TEST(data[1] == 0xdeadbeef);
for(i = 0; i < 1000; i++) data[i] = 0xbeefdead;
SetLastError(ERROR_SUCCESS);
- TEST(NtUserSystemParametersInfo(4113, 0, &data, 0) == TRUE);
+ TEST(NtUserSystemParametersInfo(0x1011, 0, &data, 0) == TRUE);
TEST(GetLastError() == ERROR_SUCCESS);
TEST(data[0] == 0xbeefdead);
TEST(data[1] == 0xbeefdead);
data[0] = 0;
- NtUserSystemParametersInfo(4112, 0, &data, 0);
+ NtUserSystemParametersInfo(0x1010, 0, &data, 0);
TEST(data[0] == 1);
for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef;
SetLastError(ERROR_SUCCESS);
- TEST(NtUserSystemParametersInfo(4136, 0, &data, 0) == TRUE);
+ TEST(NtUserSystemParametersInfo(0x1028, 0, &data, 0) == TRUE);
TEST(GetLastError() == ERROR_SUCCESS);
TEST(data[0] != 0xdeadbeef);
TEST(data[1] == 0xdeadbeef);
for(i = 0; i < 1000; i++) data[i] = 0xbeefdead;
SetLastError(ERROR_SUCCESS);
- TEST(NtUserSystemParametersInfo(4137, 0, &data, 0) == TRUE);
+ TEST(NtUserSystemParametersInfo(0x1029, 0, &data, 0) == TRUE);
TEST(GetLastError() == ERROR_SUCCESS);
TEST(data[0] == 0xbeefdead);
TEST(data[1] == 0xbeefdead);
for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef;
SetLastError(ERROR_SUCCESS);
- TEST(NtUserSystemParametersInfo(4138, 0, &data, 0) == TRUE);
+ TEST(NtUserSystemParametersInfo(0x102A, 0, &data, 0) == TRUE);
TEST(GetLastError() == ERROR_SUCCESS);
TEST(data[0] != 0xdeadbeef);
TEST(data[1] == 0xdeadbeef);
@@ -255,7 +278,7 @@
TEST(GetLastError() == ERROR_SUCCESS);
TEST(data[0] == 0xbeefdead);
TEST(data[1] == 0xbeefdead);
-
+#endif
/* Test invalid pointer */
SetLastError(ERROR_SUCCESS);
TEST(NtUserSystemParametersInfo(SPI_GETFOCUSBORDERHEIGHT, 0, (PVOID)0x80000000, 0) ==
FALSE);
@@ -263,6 +286,53 @@
for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef;
/* test wrong bools */
+}
+
+void
+Test_NtUserSystemParametersInfo_Winsta(PTESTINFO pti)
+{
+ HWINSTA hwinsta, hwinstaOld;
+ INT ai[20];
+ BOOL bRet;
+// INT i;
+
+ hwinstaOld = GetProcessWindowStation();
+ hwinsta = CreateWindowStation(NULL, 0, READ_CONTROL, NULL);
+ SetProcessWindowStation(hwinsta);
+ printf("hwinstaOld=%p, hwinsta=%p\n", hwinstaOld, hwinsta);
+
+#if 1 // currently Winsta stuff is broken in ros
+ TEST(SystemParametersInfoA(SPI_GETBEEP, 0, ai, 0) == 0);
+ TEST(GetLastError() == ERROR_ACCESS_DENIED);
+ TEST(SystemParametersInfoA(SPI_SETBEEP, 0, ai, 0) == 0);
+ TEST(GetLastError() == ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION);
+ TEST(SystemParametersInfoA(SPI_GETMOUSE, 0, ai, 0) == 0);
+ TEST(GetLastError() == ERROR_ACCESS_DENIED);
+ TEST(SystemParametersInfoA(SPI_SETMOUSE, 0, ai, 0) == 0);
+ TEST(GetLastError() == ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION);
+ TEST(SystemParametersInfoA(SPI_GETBORDER, 0, ai, 0) == 0);
+ TEST(GetLastError() == ERROR_ACCESS_DENIED);
+ TEST(SystemParametersInfoA(SPI_SETBORDER, 0, ai, 0) == 0);
+ TEST(GetLastError() == ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION);
+ TEST(SystemParametersInfoA(SPI_GETKEYBOARDSPEED, 0, ai, 0) == 0);
+ TEST(GetLastError() == ERROR_ACCESS_DENIED);
+ TEST(SystemParametersInfoA(SPI_SETKEYBOARDSPEED, 0, ai, 0) == 0);
+ TEST(GetLastError() == ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION);
+ TEST(SystemParametersInfoA(SPI_ICONHORIZONTALSPACING, 0, ai, 0) == 0);
+ TEST(GetLastError() == ERROR_ACCESS_DENIED);
+ TEST(SystemParametersInfoA(SPI_ICONHORIZONTALSPACING, 32, 0, 0) == 0);
+ TEST(GetLastError() == ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION);
+ TEST(SystemParametersInfoA(SPI_GETSCREENSAVETIMEOUT, 0, ai, 0) == 0);
+ TEST(GetLastError() == ERROR_ACCESS_DENIED);
+ TEST(SystemParametersInfoA(SPI_SETSCREENSAVETIMEOUT, 0, ai, 0) == 0);
+ TEST(GetLastError() == ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION);
+ TEST(SystemParametersInfoA(SPI_GETKEYBOARDCUES, 0, &bRet, 0) == 0);
+ TEST(GetLastError() == ERROR_ACCESS_DENIED);
+ TEST(SystemParametersInfoA(SPI_SETKEYBOARDCUES, 0, (PVOID)1, 0) == 0);
+ TEST(GetLastError() == ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION);
+#endif
+
+ SetProcessWindowStation(hwinstaOld);
}
void
@@ -290,7 +360,67 @@
}
void
-Test_SPI_GETSETBEEP(PTESTINFO pti)
+Test_MetricKey(PTESTINFO pti, PCWSTR pwszVal, INT iVal)
+{
+ WCHAR szReg[10];
+ DWORD cbSize;
+
+ cbSize = sizeof(szReg);
+ TESTX(QueryUserRegValueW(KEY_METRIC, pwszVal, &szReg, &cbSize, NULL) ==
ERROR_SUCCESS, "Value=%S\n", pwszVal);
+ TESTX(_wcsicmp(szReg, L"1") == 0, "Value=%S\n", pwszVal);
+
+}
+
+INT
+Test_UserPref(PTESTINFO pti, UINT uiGet, UINT uiSet, DWORD dwPrefMask)
+{
+ BOOL bOrig, bTemp = 0;
+ DWORD dwUserPref, dwUserPrefOrg;
+ DWORD cbSize;
+
+ /* Get original values */
+ NtUserSystemParametersInfo(uiGet, 0, &bOrig, 0);
+ cbSize = sizeof(dwUserPrefOrg);
+ QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPrefOrg, &cbSize, NULL);
+
+ /* Value 0 */
+ NtUserSystemParametersInfo(uiSet, 0, NULL, SPIF_UPDATEINIFILE);
+ NtUserSystemParametersInfo(uiGet, 0, &bTemp, 0);
+ TEST(bTemp == 0);
+ cbSize = sizeof(dwUserPref);
+ TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPref, &cbSize, NULL)
== ERROR_SUCCESS);
+ TEST((dwUserPref & dwPrefMask) == 0);
+ TEST((dwUserPref & (~dwPrefMask)) == (dwUserPrefOrg & (~dwPrefMask)));
+
+ /* Value 1 without Registry */
+ NtUserSystemParametersInfo(uiSet, 0, (PVOID)1, 0);
+ NtUserSystemParametersInfo(uiGet, 0, &bTemp, 0);
+ TEST(bTemp == 1);
+ cbSize = sizeof(dwUserPref);
+ TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPref, &cbSize, NULL)
== ERROR_SUCCESS);
+ TEST((dwUserPref & dwPrefMask) == 0);
+ TEST((dwUserPref & (~dwPrefMask)) == (dwUserPrefOrg & (~dwPrefMask)));
+
+ /* Value 1 with Registry */
+ NtUserSystemParametersInfo(uiSet, 0, (PVOID)1, SPIF_UPDATEINIFILE);
+ NtUserSystemParametersInfo(uiGet, 0, &bTemp, 0);
+ TEST(bTemp == 1);
+ cbSize = sizeof(dwUserPref);
+ TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPref, &cbSize, NULL)
== ERROR_SUCCESS);
+ TEST((dwUserPref & dwPrefMask) == dwPrefMask);
+ TEST((dwUserPref & (~dwPrefMask)) == (dwUserPrefOrg & (~dwPrefMask)));
+
+ /* Restore original value */
+ NtUserSystemParametersInfo(uiSet, 0, (PVOID)bOrig, SPIF_UPDATEINIFILE);
+
+ return APISTATUS_NORMAL;
+}
+
+
+/******************************************************************************/
+
+void
+Test_SPI_SETBEEP(PTESTINFO pti)
{
BOOL bOrig, bTemp = 0;
WCHAR szReg[10];
@@ -304,7 +434,7 @@
NtUserSystemParametersInfo(SPI_GETBEEP, 0, &bTemp, 0);
TEST(bTemp == 0);
cbSize = sizeof(szReg);
- TEST(QueryUserRegValueW(L"Control Panel\\Sound", L"Beep",
&szReg, &cbSize, NULL) == ERROR_SUCCESS);
+ TEST(QueryUserRegValueW(KEY_SOUND, VAL_BEEP, &szReg, &cbSize, NULL) ==
ERROR_SUCCESS);
TEST(_wcsicmp(szReg, L"No") == 0);
/* Value 1 */
@@ -312,7 +442,7 @@
NtUserSystemParametersInfo(SPI_GETBEEP, 0, &bTemp, 0);
TEST(bTemp == 1);
cbSize = sizeof(szReg);
- TEST(QueryUserRegValueW(L"Control Panel\\Sound", L"Beep",
&szReg, &cbSize, NULL) == ERROR_SUCCESS);
+ TEST(QueryUserRegValueW(KEY_SOUND, VAL_BEEP, &szReg, &cbSize, NULL) ==
ERROR_SUCCESS);
TEST(_wcsicmp(szReg, L"Yes") == 0);
/* Value 2 */
@@ -320,38 +450,554 @@
NtUserSystemParametersInfo(SPI_GETBEEP, 0, &bTemp, 0);
TEST(bTemp == 1);
cbSize = sizeof(szReg);
- TEST(QueryUserRegValueW(L"Control Panel\\Sound", L"Beep",
&szReg, &cbSize, NULL) == ERROR_SUCCESS);
+ TEST(QueryUserRegValueW(KEY_SOUND, VAL_BEEP, &szReg, &cbSize, NULL) ==
ERROR_SUCCESS);
TEST(_wcsicmp(szReg, L"Yes") == 0);
/* Restore original value */
NtUserSystemParametersInfo(SPI_SETBEEP, 0, &bOrig, SPIF_UPDATEINIFILE);
}
-INT
+void
+Test_SPI_SETMOUSE(PTESTINFO pti)
+{
+ INT aiOrig[3], aiTemp[3];
+
+ /* Get original value */
+ NtUserSystemParametersInfo(SPI_GETMOUSE, 0, aiOrig, 0);
+
+ /* Test uiParam value */
+ TEST(NtUserSystemParametersInfo(SPI_GETMOUSE, 0, aiTemp, 0) == 1);
+ TEST(NtUserSystemParametersInfo(SPI_GETMOUSE, 1, aiTemp, 0) == 1);
+ TEST(NtUserSystemParametersInfo(SPI_GETMOUSE, -1, aiTemp, 0) == 1);
+ TEST(NtUserSystemParametersInfo(SPI_GETMOUSE, 0xdeadbeef, aiTemp, 0) == 1);
+
+ /* Set modified values */
+ aiTemp[0] = aiOrig[0] + 1;
+ aiTemp[1] = aiOrig[1] - 1;
+ aiTemp[2] = aiOrig[2] + 2;
+ NtUserSystemParametersInfo(SPI_SETMOUSE, 2, aiTemp, SPIF_UPDATEINIFILE);
+ aiTemp[0] = aiTemp[1] = aiTemp[2] = 0;
+
+ /* Get new values */
+ NtUserSystemParametersInfo(SPI_GETMOUSE, 0, aiTemp, 0);
+
+ /* Test modified values */
+ TEST(aiTemp[0] == aiOrig[0] + 1);
+ TEST(aiTemp[1] == aiOrig[1] - 1);
+ TEST(aiTemp[2] == aiOrig[2] + 2);
+
+ // FIXME: Test registry values
+
+ /* Restore original value */
+ NtUserSystemParametersInfo(SPI_SETMOUSE, 0, aiOrig, SPIF_UPDATEINIFILE);
+}
+
+void
+Test_SPI_SETBORDER(PTESTINFO pti)
+{
+ INT iOrig, iTemp = 0;
+
+ /* Get original value */
+ NtUserSystemParametersInfo(SPI_GETBORDER, 0, &iOrig, 0);
+
+ /* Value 0 */
+ NtUserSystemParametersInfo(SPI_SETBORDER, 0, NULL, SPIF_UPDATEINIFILE);
+ NtUserSystemParametersInfo(SPI_GETBORDER, 0, &iTemp, 0);
+ TEST(iTemp == 1);
+ TEST(GetSystemMetrics(SM_CXBORDER) == 1);
+
+ /* Value 1 */
+ NtUserSystemParametersInfo(SPI_SETBORDER, 1, NULL, SPIF_UPDATEINIFILE);
+ NtUserSystemParametersInfo(SPI_GETBORDER, 0, &iTemp, 0);
+ TEST(iTemp == 1);
+// Test_MetricKey(pti, VAL_BORDER, 1);
+
+ /* Value 2 */
+ NtUserSystemParametersInfo(SPI_SETBORDER, 2, NULL, SPIF_UPDATEINIFILE);
+ NtUserSystemParametersInfo(SPI_GETBORDER, 0, &iTemp, 0);
+ TEST(iTemp == 2);
+ TEST(GetSystemMetrics(SM_CXBORDER) == 1);
+
+ /* Restore original value */
+ NtUserSystemParametersInfo(SPI_SETBORDER, iOrig, NULL, SPIF_UPDATEINIFILE);
+
+}
+
+// Test_SPI_SETKEYBOARDSPEED(pti);
+// Test_SPI_LANGDRIVER(pti);
+// Test_SPI_ICONHORIZONTALSPACING(pti);
+// Test_SPI_SETSCREENSAVETIMEOUT(pti);
+// Test_SPI_SETSCREENSAVEACTIVE(pti);
+// Test_SPI_SETGRIDGRANULARITY(pti);
+
+void
Test_SPI_SETDESKWALLPAPER(PTESTINFO pti)
{
+ UNICODE_STRING ustrOld, ustrNew;
+ WCHAR szOld[MAX_PATH];
+ WCHAR szNew[MAX_PATH];
+
/* Get old Wallpaper */
-// NtUserSystemParametersInfo(SPI_GET_DESKWALLPAPER, 0,
-
-// TEST(NtUserSystemParametersInfo(SPI_SETDESKWALLPAPER, 0, &hNewWallPaper, 0) ==
0);
- return 0;
-}
-
-INT
-Test_SPI_GETSTICKYKEYS(PTESTINFO pti)
-{
- STICKYKEYS sk;
+ TEST(NtUserSystemParametersInfo(SPI_GETDESKWALLPAPER, MAX_PATH, szOld, 0) == 1);
+ RtlInitUnicodeString(&ustrOld, szOld);
+
+ /* Set no Wallpaper */
+ TEST(NtUserSystemParametersInfo(SPI_SETDESKWALLPAPER, 0, L"", 0) == 1);
+ TEST(NtUserSystemParametersInfo(SPI_GETDESKWALLPAPER, MAX_PATH, szNew, 0) == 1);
+ TEST(szNew[0] == 0);
+
+ /* Set no Wallpaper 2 */
+ RtlInitUnicodeString(&ustrNew, L"");
+ TEST(NtUserSystemParametersInfo(SPI_SETDESKWALLPAPER, 0, &ustrNew, 0) == 1);
+ TEST(NtUserSystemParametersInfo(SPI_GETDESKWALLPAPER, MAX_PATH, szNew, 0) == 1);
+ TEST(szNew[0] == 0);
+
+ /* Reset Wallpaper */
+ TEST(NtUserSystemParametersInfo(SPI_SETDESKWALLPAPER, 0, NULL, 0) == 1);
+ TEST(NtUserSystemParametersInfo(SPI_GETDESKWALLPAPER, MAX_PATH, szNew, 0) == 1);
+ TEST(wcscmp(szNew, szOld) == 0);
+
+ /* Set new Wallpaper */
+ RtlInitUnicodeString(&ustrNew, L"test.bmp");
+ TEST(NtUserSystemParametersInfo(SPI_SETDESKWALLPAPER, 0, &ustrNew, 0) == 1);
+ TEST(NtUserSystemParametersInfo(SPI_GETDESKWALLPAPER, MAX_PATH, szNew, 0) == 1);
+ TEST(wcscmp(szNew, L"test.bmp") == 0);
+
+ /* Get Wallpaper, too small buffer */
+ szNew[0] = 0; szNew[1] = 0; szNew[2] = 0;
+ TEST(NtUserSystemParametersInfo(SPI_GETDESKWALLPAPER, 3, szNew, 0) == 1);
+ TEST(szNew[0] != 0);
+ TEST(szNew[1] != 0);
+ TEST(szNew[2] != 0);
+
+ /* Set invalid Wallpaper */
+ SetLastError(0xdeadbeef);
+ RtlInitUnicodeString(&ustrNew, L"*#!!-&");
+ TEST(NtUserSystemParametersInfo(SPI_SETDESKWALLPAPER, 0, &ustrNew, 0) == 0);
+ TEST(GetLastError() == ERROR_FILE_NOT_FOUND);
+ TEST(NtUserSystemParametersInfo(SPI_GETDESKWALLPAPER, MAX_PATH, szNew, 0) == 1);
+ TEST(wcscmp(szNew, L"*#!!-&") == 0);
+
+ /* Restore old Wallpaper */
+ TEST(NtUserSystemParametersInfo(SPI_SETDESKWALLPAPER, MAX_PATH, &ustrOld,
SPIF_UPDATEINIFILE) == 1);
+
+}
+
+// Test_SPI_SETDESKPATTERN(pti);
+// Test_SPI_SETKEYBOARDDELAY(pti);
+// Test_SPI_ICONVERTICALSPACING(pti);
+// Test_SPI_SETICONTITLEWRAP(pti);
+// Test_SPI_SETMENUDROPALIGNMENT(pti);
+// Test_SPI_SETDOUBLECLKWIDTH(pti);
+// Test_SPI_SETDOUBLECLKHEIGHT(pti);
+// Test_SPI_SETDOUBLECLICKTIME(pti);
+
+INT
+Test_SPI_SETMOUSEBUTTONSWAP(PTESTINFO pti)
+{
+ BOOL bOrig, bTemp = 0;
+ WCHAR szReg[10];
+ DWORD cbSize;
+
+ /* Get original value */
+ bOrig = GetSystemMetrics(SM_SWAPBUTTON);
+
+ /* Value 0 */
+ NtUserSystemParametersInfo(SPI_SETMOUSEBUTTONSWAP, 0, NULL, SPIF_UPDATEINIFILE);
+ bTemp = GetSystemMetrics(SM_SWAPBUTTON);
+ TEST(bTemp == 0);
+ cbSize = sizeof(szReg);
+ TEST(QueryUserRegValueW(KEY_MOUSE, VAL_SWAP, &szReg, &cbSize, NULL) ==
ERROR_SUCCESS);
+ TEST(_wcsicmp(szReg, L"0") == 0);
+
+ /* Value 1 */
+ NtUserSystemParametersInfo(SPI_SETMOUSEBUTTONSWAP, 1, NULL, SPIF_UPDATEINIFILE);
+ bTemp = GetSystemMetrics(SM_SWAPBUTTON);
+ TEST(bTemp == 1);
+ cbSize = sizeof(szReg);
+ TEST(QueryUserRegValueW(KEY_MOUSE, VAL_SWAP, &szReg, &cbSize, NULL) ==
ERROR_SUCCESS);
+ TEST(_wcsicmp(szReg, L"1") == 0);
+
+ /* Value 2 */
+ NtUserSystemParametersInfo(SPI_SETMOUSEBUTTONSWAP, 2, NULL, SPIF_UPDATEINIFILE);
+ bTemp = GetSystemMetrics(SM_SWAPBUTTON);
+ TEST(bTemp == 1);
+ cbSize = sizeof(szReg);
+ TEST(QueryUserRegValueW(KEY_MOUSE, VAL_SWAP, &szReg, &cbSize, NULL) ==
ERROR_SUCCESS);
+ TEST(_wcsicmp(szReg, L"2") == 0);
+
+ /* Value -1 */
+ NtUserSystemParametersInfo(SPI_SETMOUSEBUTTONSWAP, -1, NULL, SPIF_UPDATEINIFILE);
+ bTemp = GetSystemMetrics(SM_SWAPBUTTON);
+ TEST(bTemp == 1);
+ cbSize = sizeof(szReg);
+ TEST(QueryUserRegValueW(KEY_MOUSE, VAL_SWAP, &szReg, &cbSize, NULL) ==
ERROR_SUCCESS);
+ TEST(_wcsicmp(szReg, L"-1") == 0);
+
+ /* Restore original value */
+ NtUserSystemParametersInfo(SPI_SETMOUSEBUTTONSWAP, bOrig, 0, SPIF_UPDATEINIFILE);
+
+ return APISTATUS_NORMAL;
+}
+
+INT
+Test_SPI_SETICONTITLELOGFONT(PTESTINFO pti)
+{
+ LOGFONTW lfOrig;
+ struct
+ {
+ LOGFONTW lf;
+ DWORD dwRedzone;
+ } buf;
+
+ /* Get original value */
+ ASSERT(NtUserSystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(lfOrig), &lfOrig,
0));
+
+ /* Test uiParam == 0 */
+ memset(&buf, 0, sizeof(buf));
+ buf.lf.lfFaceName[LF_FACESIZE-1] = 33;
+ buf.dwRedzone = 0xdeadbeef;
+ TEST(NtUserSystemParametersInfo(SPI_GETICONTITLELOGFONT, 0, &buf.lf, 0) == 1);
+ TEST(buf.lf.lfHeight != 0);
+ TEST(buf.lf.lfWeight != 0);
+ TEST(buf.lf.lfFaceName[0] != 0);
+ TEST(buf.lf.lfFaceName[LF_FACESIZE-1] == 0);
+ TEST(buf.dwRedzone == 0xdeadbeef);
+
+ /* Test uiParam < sizeof(LOGFONTW) */
+ memset(&buf, 0, sizeof(buf));
+ buf.lf.lfFaceName[LF_FACESIZE-1] = 33;
+ buf.dwRedzone = 0xdeadbeef;
+ TEST(NtUserSystemParametersInfo(SPI_GETICONTITLELOGFONT, 8, &buf.lf, 0) == 1);
+ TEST(buf.lf.lfHeight != 0);
+ TEST(buf.lf.lfWeight != 0);
+ TEST(buf.lf.lfFaceName[0] != 0);
+ TEST(buf.lf.lfFaceName[LF_FACESIZE-1] == 0);
+ TEST(buf.dwRedzone == 0xdeadbeef);
+
+ /* Test uiParam < 0 */
+ TEST(NtUserSystemParametersInfo(SPI_GETICONTITLELOGFONT, -1, &buf.lf, 0) == 1);
+
+ return APISTATUS_NORMAL;
+}
+
+INT
+Test_SPI_SETFASTTASKSWITCH(PTESTINFO pti)
+{
+ char buf[10];
+ TEST(NtUserSystemParametersInfo(SPI_SETFASTTASKSWITCH, 0, 0, 0) == 1);
+ TEST(NtUserSystemParametersInfo(SPI_SETFASTTASKSWITCH, 0, buf, 0) == 1);
+
+ return APISTATUS_NORMAL;
+}
+
+INT
+Test_SPI_SETDRAGFULLWINDOWS(PTESTINFO pti)
+{
+ return APISTATUS_NORMAL;
+}
+
+INT
+Test_SPI_SETNONCLIENTMETRICS(PTESTINFO pti)
+{
+ return APISTATUS_NORMAL;
+}
+
+INT
+Test_SPI_SETMINIMIZEDMETRICS(PTESTINFO pti)
+{
+ return APISTATUS_NORMAL;
+}
+
+INT
+Test_SPI_SETICONMETRICS(PTESTINFO pti)
+{
+ return APISTATUS_NORMAL;
+}
+
+INT
+Test_SPI_SETWORKAREA(PTESTINFO pti)
+{
+ RECT rcOrig, rc;
+
+ /* Get the original value */
+ ASSERT(NtUserSystemParametersInfo(SPI_GETWORKAREA, 0, &rcOrig, 0) == 1);
+
+ /* Change value */
+ rc = rcOrig;
+ rc.left += 1;
+ rc.top += 2;
+ rc.right -= 3;
+ rc.bottom -= 2;
+ TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 1, &rc, 0) == 1);
+ TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 1);
+ TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, sizeof(RECT), &rc, 0) == 1);
+
+ TEST(NtUserSystemParametersInfo(SPI_GETWORKAREA, 1, &rc, 0) == 1);
+ TEST(NtUserSystemParametersInfo(SPI_GETWORKAREA, -1, &rc, 0) == 1);
+ TEST(NtUserSystemParametersInfo(SPI_GETWORKAREA, 0xdeadbeef, &rc, 0) == 1);
+ TEST(NtUserSystemParametersInfo(SPI_GETWORKAREA, 0, (PVOID)0xdeadbeef, 0) == 0);
+
+ /* Test values */
+ rc = rcOrig; rc.left = -1;
+ TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 0);
+ rc = rcOrig; rc.top = -1;
+ TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 0);
+ rc = rcOrig; rc.top = 10; rc.bottom = 11;
+ TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 1);
+ rc = rcOrig; rc.top = 10; rc.bottom = 10;
+ TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 0);
+ rc = rcOrig; rc.top = 10; rc.bottom = 9;
+ TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 0);
+ rc = rcOrig; rc.left = 10; rc.right = 11;
+ TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 1);
+ rc = rcOrig; rc.left = 10; rc.right = 10;
+ TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 0);
+ rc = rcOrig; rc.left = 10; rc.right = 9;
+ TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 0);
+ rc = rcOrig; rc.bottom = GetSystemMetrics(SM_CYVIRTUALSCREEN);
+ TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 1);
+ rc = rcOrig; rc.bottom = GetSystemMetrics(SM_CYVIRTUALSCREEN)+1;
+ TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 0);
+ rc = rcOrig; rc.right = GetSystemMetrics(SM_CXVIRTUALSCREEN);
+ TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 1);
+ rc = rcOrig; rc.right = GetSystemMetrics(SM_CXVIRTUALSCREEN)+1;
+ TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 0);
+
+ /* Restore original value */
+ ASSERT(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rcOrig, 0) == 1);
+
+ return APISTATUS_NORMAL;
+}
+
+INT
+Test_SPI_SETPENWINDOWS(PTESTINFO pti)
+{
+ return APISTATUS_NORMAL;
+}
+
+INT
+Test_SPI_SETFILTERKEYS(PTESTINFO pti)
+{
+ return APISTATUS_NORMAL;
+}
+
+INT
+Test_SPI_SETTOGGLEKEYS(PTESTINFO pti)
+{
+ return APISTATUS_NORMAL;
+}
+
+INT
+Test_SPI_SETMOUSEKEYS(PTESTINFO pti)
+{
+ return APISTATUS_NORMAL;
+}
+
+INT
+Test_SPI_SETSHOWSOUNDS(PTESTINFO pti)
+{
+ return APISTATUS_NORMAL;
+}
+
+INT
+Test_SPI_SETSTICKYKEYS(PTESTINFO pti)
+{
+ STICKYKEYS skOrig, sk;
+
+ /* Get original values */
+ skOrig.cbSize = sizeof(STICKYKEYS);
+ ASSERT(NtUserSystemParametersInfo(SPI_GETSTICKYKEYS, 0, &skOrig, 0) == 1);
sk.cbSize = sizeof(STICKYKEYS)+1;
TEST(NtUserSystemParametersInfo(SPI_GETSTICKYKEYS, 0, &sk, 0) == 0);
+ sk.cbSize = sizeof(STICKYKEYS)-1;
+ TEST(NtUserSystemParametersInfo(SPI_GETSTICKYKEYS, 0, &sk, 0) == 0);
sk.cbSize = sizeof(STICKYKEYS);
- NtUserSystemParametersInfo(SPI_GETSTICKYKEYS, 0, &sk, 0);
- printf("sk.dwFlags = %lx\n", sk.dwFlags);
+ TEST(NtUserSystemParametersInfo(SPI_GETSTICKYKEYS, 1, &sk, 0) == 0);
+ TEST(NtUserSystemParametersInfo(SPI_GETSTICKYKEYS, -1, &sk, 0) == 0);
+ TEST(NtUserSystemParametersInfo(SPI_GETSTICKYKEYS, sk.cbSize, &sk, 0) == 1);
+ TEST(NtUserSystemParametersInfo(SPI_GETSTICKYKEYS, sk.cbSize-1, &sk, 0) == 0);
+ TEST(NtUserSystemParametersInfo(SPI_GETSTICKYKEYS, sk.cbSize+1, &sk, 0) == 0);
+
+ sk = skOrig;
+ sk.dwFlags = (skOrig.dwFlags ^ 1);
+ TEST(NtUserSystemParametersInfo(SPI_SETSTICKYKEYS, sk.cbSize+1, &sk, 0) == 0);
+ TEST(NtUserSystemParametersInfo(SPI_SETSTICKYKEYS, sk.cbSize-1, &sk, 0) == 0);
+ TEST(NtUserSystemParametersInfo(SPI_SETSTICKYKEYS, sk.cbSize, &sk, 0) == 1);
+
+ sk = skOrig;
+ TEST(NtUserSystemParametersInfo(SPI_GETSTICKYKEYS, 0, &sk, 0) == 1);
+ TEST(sk.dwFlags == (skOrig.dwFlags ^ 1));
+
+ /* Restore original values */
+ skOrig.cbSize = sizeof(STICKYKEYS);
+ ASSERT(NtUserSystemParametersInfo(SPI_SETSTICKYKEYS, 0, &skOrig, 0) == 1);
return APISTATUS_NORMAL;
}
+
+INT
+Test_SPI_SETACCESSTIMEOUT(PTESTINFO pti)
+{
+ ACCESSTIMEOUT atoOrig, atoTmp;
+
+ /* Get original values */
+ atoOrig.cbSize = sizeof(ACCESSTIMEOUT);
+ ASSERT(NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, 0, &atoOrig, 0) == 1);
+
+ atoTmp.cbSize = sizeof(ACCESSTIMEOUT) - 1;
+ TEST(NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, 0, &atoTmp, 0) == 0);
+ atoTmp.cbSize = sizeof(ACCESSTIMEOUT) + 1;
+ TEST(NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, 0, &atoTmp, 0) == 0);
+ atoTmp.cbSize = sizeof(ACCESSTIMEOUT);
+ TEST(NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, 0, &atoTmp, 0) == 1);
+ atoTmp.cbSize = sizeof(ACCESSTIMEOUT);
+ TEST(NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, 1, &atoTmp, 0) == 0);
+ atoTmp.cbSize = sizeof(ACCESSTIMEOUT);
+ TEST(NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, -1, &atoTmp, 0) == 0);
+ atoTmp.cbSize = sizeof(ACCESSTIMEOUT);
+ TEST(NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, sizeof(ACCESSTIMEOUT),
&atoTmp, 0) == 1);
+ atoTmp.cbSize = sizeof(ACCESSTIMEOUT);
+ TEST(NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, sizeof(ACCESSTIMEOUT)-1,
&atoTmp, 0) == 0);
+ atoTmp.cbSize = sizeof(ACCESSTIMEOUT);
+ TEST(NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, sizeof(ACCESSTIMEOUT)+1,
&atoTmp, 0) == 0);
+
+ /* Restore original values */
+ ASSERT(NtUserSystemParametersInfo(SPI_SETACCESSTIMEOUT, sizeof(atoOrig), &atoOrig,
0) == 1);
+
+ return APISTATUS_NORMAL;
+}
+
+INT
+Test_SPI_SETSERIALKEYS(PTESTINFO pti)
+{
+ return APISTATUS_NORMAL;
+}
+
+INT
+Test_SPI_SETSOUNDSENTRY(PTESTINFO pti)
+{
+ return APISTATUS_NORMAL;
+}
+
+INT
+Test_SPI_SETHIGHCONTRAST(PTESTINFO pti)
+{
+ return APISTATUS_NORMAL;
+}
+
+INT
+Test_SPI_SETKEYBOARDPREF(PTESTINFO pti)
+{
+ return APISTATUS_NORMAL;
+}
+
+// Test_SPI_SETSCREENREADER(pti);
+/// Test_SPI_SETANIMATION(pti);
+// Test_SPI_SETFONTSMOOTHING(pti);
+// Test_SPI_SETDRAGWIDTH(pti);
+// Test_SPI_SETDRAGHEIGHT(pti);
+// Test_SPI_SETHANDHELD(pti);
+// Test_SPI_SETLOWPOWERTIMEOUT(pti);
+// Test_SPI_SETPOWEROFFTIMEOUT(pti);
+// Test_SPI_SETLOWPOWERACTIVE(pti);
+// Test_SPI_SETPOWEROFFACTIVE(pti);
+// Test_SPI_SETCURSORS(pti);
+// Test_SPI_SETICONS(pti);
+// Test_SPI_SETDEFAULTINPUTLANG(pti);
+// Test_SPI_SETLANGTOGGLE(pti);
+// Test_SPI_GETWINDOWSEXTENSION(pti);
+// Test_SPI_SETMOUSETRAILS(pti);
+// Test_SPI_SETSNAPTODEFBUTTON(pti);
+// Test_SPI_GETSCREENSAVERRUNNING(pti);
+// Test_SPI_SETMOUSEHOVERWIDTH(pti);
+// Test_SPI_SETMOUSEHOVERHEIGHT(pti);
+// Test_SPI_SETMOUSEHOVERTIME(pti);
+// Test_SPI_SETWHEELSCROLLLINES(pti);
+// Test_SPI_SETMENUSHOWDELAY(pti);
+// Test_SPI_SETWHEELSCROLLCHARS(pti);
+// Test_SPI_SETSHOWIMEUI(pti);
+// Test_SPI_SETMOUSESPEED(pti);
+// Test_SPI_GETSCREENSAVERRUNNING(pti);
+// Test_SPI_SETAUDIODESCRIPTION(pti);
+// Test_SPI_SETSCREENSAVESECURE(pti);
+// Test_SPI_SETACTIVEWINDOWTRACKING(pti);
+
+INT
+Test_SPI_SETMENUANIMATION(PTESTINFO pti)
+{
+ BOOL bOrig, bTemp = 0;
+ DWORD dwUserPrefMask;
+ DWORD cbSize;
+
+ /* Get original values */
+ NtUserSystemParametersInfo(SPI_GETMENUANIMATION, 0, &bOrig, 0);
+
+ /* Value 0 */
+ NtUserSystemParametersInfo(SPI_SETMENUANIMATION, 0, NULL, SPIF_UPDATEINIFILE);
+ NtUserSystemParametersInfo(SPI_GETMENUANIMATION, 0, &bTemp, 0);
+ TEST(bTemp == 0);
+ cbSize = sizeof(dwUserPrefMask);
+ TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPrefMask, &cbSize,
NULL) == ERROR_SUCCESS);
+ TEST((dwUserPrefMask & PREFMASK_MENUANIM) == 0);
+
+ /* Value 1 */
+ NtUserSystemParametersInfo(SPI_SETMENUANIMATION, 0, (PVOID)1, SPIF_UPDATEINIFILE);
+ NtUserSystemParametersInfo(SPI_GETMENUANIMATION, 0, &bTemp, 0);
+ TEST(bTemp == 1);
+ cbSize = sizeof(dwUserPrefMask);
+ TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPrefMask, &cbSize,
NULL) == ERROR_SUCCESS);
+ TEST((dwUserPrefMask & PREFMASK_MENUANIM) != 0);
+
+
+ /* Restore original values */
+ NtUserSystemParametersInfo(SPI_SETMENUANIMATION, 0, (PVOID)bOrig, SPIF_UPDATEINIFILE);
+
+ return APISTATUS_NORMAL;
+}
+
+// Test_SPI_SETCOMBOBOXANIMATION(pti);
+// Test_SPI_SETLISTBOXSMOOTHSCROLLING(pti);
+// Test_SPI_SETGRADIENTCAPTIONS(pti);
+
+INT
+Test_SPI_SETKEYBOARDCUES(PTESTINFO pti)
+{
+ return Test_UserPref(pti, SPI_GETKEYBOARDCUES, SPI_SETKEYBOARDCUES,
PREFMASK_KBDCUES);
+}
+
+// Test_SPI_SETACTIVEWNDTRKZORDER(pti);
+// Test_SPI_SETHOTTRACKING(pti);
+// Test_SPI_SETMENUFADE(pti);
+// Test_SPI_SETSELECTIONFADE(pti);
+// Test_SPI_SETTOOLTIPANIMATION(pti);
+// Test_SPI_SETTOOLTIPFADE(pti);
+// Test_SPI_SETCURSORSHADOW(pti);
+// Test_SPI_SETMOUSESONAR(pti);
+// Test_SPI_SETMOUSECLICKLOCK(pti);
+// Test_SPI_SETMOUSEVANISH(pti);
+// Test_SPI_SETFLATMENU(pti);
+// Test_SPI_SETDROPSHADOW(pti);
+// Test_SPI_SETBLOCKSENDINPUTRESETS(pti);
+// Test_SPI_GETSETUIEFFECTS(pti);
+// Test_SPI_SETDISABLEOVERLAPPEDCONTENT(pti);
+// Test_SPI_SETCLIENTAREAANIMATION(pti);
+// Test_SPI_SETCLEARTYPE(pti);
+// Test_SPI_SETSPEECHRECOGNITION(pti);
+// Test_SPI_SETFOREGROUNDLOCKTIMEOUT(pti);
+// Test_SPI_SETACTIVEWNDTRKTIMEOUT(pti);
+// Test_SPI_SETFOREGROUNDFLASHCOUNT(pti);
+// Test_SPI_SETCARETWIDTH(pti);
+// Test_SPI_SETMOUSECLICKLOCKTIME(pti);
+// Test_SPI_SETFONTSMOOTHINGTYPE(pti);
+// Test_SPI_SETFONTSMOOTHINGCONTRAST(pti);
+// Test_SPI_SETFOCUSBORDERWIDTH(pti);
+// Test_SPI_SETFOCUSBORDERHEIGHT(pti);
+// Test_SPI_SETFONTSMOOTHINGORIENTATION(pti);
+
INT
Test_NtUserSystemParametersInfo(PTESTINFO pti)
@@ -360,16 +1006,111 @@
hWnd = CreateTestWindow();
ASSERT(hWnd);
+
Test_NtUserSystemParametersInfo_Params(pti);
-
Test_NtUserSystemParametersInfo_fWinIni(pti);
-
- Test_SPI_GETSETBEEP(pti);
+ Test_NtUserSystemParametersInfo_Winsta(pti);
+
+ Test_SPI_SETBEEP(pti);
+ Test_SPI_SETMOUSE(pti);
+ Test_SPI_SETBORDER(pti);
+// Test_SPI_SETKEYBOARDSPEED(pti);
+// Test_SPI_LANGDRIVER(pti);
+// Test_SPI_ICONHORIZONTALSPACING(pti);
+// Test_SPI_SETSCREENSAVETIMEOUT(pti);
+// Test_SPI_SETSCREENSAVEACTIVE(pti);
+// Test_SPI_SETGRIDGRANULARITY(pti);
Test_SPI_SETDESKWALLPAPER(pti);
-
- Test_SPI_GETSTICKYKEYS(pti);
-
- Test_SPI_87_88(pti);
+// Test_SPI_SETDESKPATTERN(pti);
+// Test_SPI_SETKEYBOARDDELAY(pti);
+// Test_SPI_ICONVERTICALSPACING(pti);
+// Test_SPI_SETICONTITLEWRAP(pti);
+// Test_SPI_SETMENUDROPALIGNMENT(pti);
+// Test_SPI_SETDOUBLECLKWIDTH(pti);
+// Test_SPI_SETDOUBLECLKHEIGHT(pti);
+// Test_SPI_SETDOUBLECLICKTIME(pti);
+ Test_SPI_SETMOUSEBUTTONSWAP(pti);
+ Test_SPI_SETICONTITLELOGFONT(pti);
+ Test_SPI_SETFASTTASKSWITCH(pti);
+ Test_SPI_SETDRAGFULLWINDOWS(pti);
+ Test_SPI_SETNONCLIENTMETRICS(pti);
+ Test_SPI_SETMINIMIZEDMETRICS(pti);
+ Test_SPI_SETICONMETRICS(pti);
+ Test_SPI_SETWORKAREA(pti);
+ Test_SPI_SETPENWINDOWS(pti);
+ Test_SPI_SETFILTERKEYS(pti);
+ Test_SPI_SETTOGGLEKEYS(pti);
+ Test_SPI_SETMOUSEKEYS(pti);
+ Test_SPI_SETSHOWSOUNDS(pti);
+ Test_SPI_SETSTICKYKEYS(pti);
+ Test_SPI_SETACCESSTIMEOUT(pti);
+ Test_SPI_SETSERIALKEYS(pti);
+ Test_SPI_SETSOUNDSENTRY(pti);
+ Test_SPI_SETHIGHCONTRAST(pti);
+ Test_SPI_SETKEYBOARDPREF(pti);
+// Test_SPI_SETSCREENREADER(pti);
+/// Test_SPI_SETANIMATION(pti);
+// Test_SPI_SETFONTSMOOTHING(pti);
+// Test_SPI_SETDRAGWIDTH(pti);
+// Test_SPI_SETDRAGHEIGHT(pti);
+// Test_SPI_SETHANDHELD(pti);
+// Test_SPI_SETLOWPOWERTIMEOUT(pti);
+// Test_SPI_SETPOWEROFFTIMEOUT(pti);
+// Test_SPI_SETLOWPOWERACTIVE(pti);
+// Test_SPI_SETPOWEROFFACTIVE(pti);
+// Test_SPI_SETCURSORS(pti);
+// Test_SPI_SETICONS(pti);
+// Test_SPI_SETDEFAULTINPUTLANG(pti);
+// Test_SPI_SETLANGTOGGLE(pti);
+// Test_SPI_GETWINDOWSEXTENSION(pti);
+// Test_SPI_SETMOUSETRAILS(pti);
+// Test_SPI_SETSNAPTODEFBUTTON(pti);
+// Test_SPI_GETSCREENSAVERRUNNING(pti);
+// Test_SPI_SETMOUSEHOVERWIDTH(pti);
+// Test_SPI_SETMOUSEHOVERHEIGHT(pti);
+// Test_SPI_SETMOUSEHOVERTIME(pti);
+// Test_SPI_SETWHEELSCROLLLINES(pti);
+// Test_SPI_SETMENUSHOWDELAY(pti);
+// Test_SPI_SETWHEELSCROLLCHARS(pti);
+// Test_SPI_SETSHOWIMEUI(pti);
+// Test_SPI_SETMOUSESPEED(pti);
+// Test_SPI_GETSCREENSAVERRUNNING(pti);
+// Test_SPI_SETAUDIODESCRIPTION(pti);
+// Test_SPI_SETSCREENSAVESECURE(pti);
+// Test_SPI_SETACTIVEWINDOWTRACKING(pti);
+ Test_SPI_SETMENUANIMATION(pti);
+// Test_SPI_SETCOMBOBOXANIMATION(pti);
+// Test_SPI_SETLISTBOXSMOOTHSCROLLING(pti);
+// Test_SPI_SETGRADIENTCAPTIONS(pti);
+ Test_SPI_SETKEYBOARDCUES(pti);
+// Test_SPI_SETACTIVEWNDTRKZORDER(pti);
+// Test_SPI_SETHOTTRACKING(pti);
+// Test_SPI_SETMENUFADE(pti);
+// Test_SPI_SETSELECTIONFADE(pti);
+// Test_SPI_SETTOOLTIPANIMATION(pti);
+// Test_SPI_SETTOOLTIPFADE(pti);
+// Test_SPI_SETCURSORSHADOW(pti);
+// Test_SPI_SETMOUSESONAR(pti);
+// Test_SPI_SETMOUSECLICKLOCK(pti);
+// Test_SPI_SETMOUSEVANISH(pti);
+// Test_SPI_SETFLATMENU(pti);
+// Test_SPI_SETDROPSHADOW(pti);
+// Test_SPI_SETBLOCKSENDINPUTRESETS(pti);
+// Test_SPI_GETSETUIEFFECTS(pti);
+// Test_SPI_SETDISABLEOVERLAPPEDCONTENT(pti);
+// Test_SPI_SETCLIENTAREAANIMATION(pti);
+// Test_SPI_SETCLEARTYPE(pti);
+// Test_SPI_SETSPEECHRECOGNITION(pti);
+// Test_SPI_SETFOREGROUNDLOCKTIMEOUT(pti);
+// Test_SPI_SETACTIVEWNDTRKTIMEOUT(pti);
+// Test_SPI_SETFOREGROUNDFLASHCOUNT(pti);
+// Test_SPI_SETCARETWIDTH(pti);
+// Test_SPI_SETMOUSECLICKLOCKTIME(pti);
+// Test_SPI_SETFONTSMOOTHINGTYPE(pti);
+// Test_SPI_SETFONTSMOOTHINGCONTRAST(pti);
+// Test_SPI_SETFOCUSBORDERWIDTH(pti);
+// Test_SPI_SETFOCUSBORDERHEIGHT(pti);
+// Test_SPI_SETFONTSMOOTHINGORIENTATION(pti);
DestroyWindow(hWnd);
Modified: trunk/rostests/apitests/w32knapi/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/testlis…
==============================================================================
--- trunk/rostests/apitests/w32knapi/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/w32knapi/testlist.c [iso-8859-1] Sun Aug 9 13:27:25 2009
@@ -58,6 +58,7 @@
#include "ntuser/NtUserSetTimer.c"
#include "ntuser/NtUserSystemParametersInfo.c"
#include "ntuser/NtUserToUnicodeEx.c"
+#include "ntuser/NtUserUpdatePerUserSystemParameters.c"
/* The List of tests */
TESTENTRY TestList[] =
@@ -121,6 +122,7 @@
{ L"NtUserSetTimer", Test_NtUserSetTimer },
{ L"NtUserSystemParametersInfo", Test_NtUserSystemParametersInfo },
{ L"NtUserToUnicodeEx", Test_NtUserToUnicodeEx },
+ { L"NtUserUpdatePerUserSystemParameters",
Test_NtUserUpdatePerUserSystemParameters },
};
/* The function that gives us the number of tests */
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 [iso-8859-1] (original)
+++ trunk/rostests/apitests/w32knapi/w32knapi.c [iso-8859-1] Sun Aug 9 13:27:25 2009
@@ -28,6 +28,23 @@
return TRUE;
}
+
+PVOID
+GetHandleUserData(HGDIOBJ hobj)
+{
+ USHORT Index = (ULONG_PTR)hobj;
+ PGDI_TABLE_ENTRY pentry = &GdiHandleTable[Index];
+
+ if (pentry->KernelData == NULL ||
+ pentry->KernelData < (PVOID)0x80000000 ||
+ (USHORT)pentry->FullUnique != (USHORT)((ULONG_PTR)hobj >> 16))
+ {
+ return NULL;
+ }
+
+ return pentry->UserData;
+}
+
static DWORD WINAPI
IntSyscall(FARPROC proc, UINT cParams, PVOID pFirstParam)
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 [iso-8859-1] (original)
+++ trunk/rostests/apitests/w32knapi/w32knapi.h [iso-8859-1] Sun Aug 9 13:27:25 2009
@@ -38,6 +38,7 @@
extern PGDI_TABLE_ENTRY GdiHandleTable;
BOOL IsHandleValid(HGDIOBJ hobj);
+PVOID GetHandleUserData(HGDIOBJ hobj);
DWORD Syscall(LPWSTR lpszFunction, int cParams, void* pParams);
BOOL InitOsVersion();
extern UINT g_OsIdx;